## Automatically generated incremental diff ## From: linux-2.6.7-rc2 ## To: linux-2.6.7-rc3 ## Robot: $Id: make-incremental-diff,v 1.12 2004/01/06 07:19:36 hpa Exp $ diff -urN linux-2.6.7-rc2/Documentation/SubmittingPatches linux-2.6.7-rc3/Documentation/SubmittingPatches --- linux-2.6.7-rc2/Documentation/SubmittingPatches 2004-06-07 12:54:47.972999746 -0700 +++ linux-2.6.7-rc3/Documentation/SubmittingPatches 2004-06-07 12:55:00.639524346 -0700 @@ -259,6 +259,47 @@ +11) Sign your work + +To improve tracking of who did what, especially with patches that can +percolate to their final resting place in the kernel through several +layers of maintainers, we've introduced a "sign-off" procedure on +patches that are being emailed around. + +The sign-off is a simple line at the end of the explanation for the +patch, which certifies that you wrote it or otherwise have the right to +pass it on as a open-source patch. The rules are pretty simple: if you +can certify the below: + + Developer's Certificate of Origin 1.0 + + By making a contribution to this project, I certify that: + + (a) The contribution was created in whole or in part by me and I + have the right to submit it under the open source license + indicated in the file; or + + (b) The contribution is based upon previous work that, to the best + of my knowledge, is covered under an appropriate open source + license and I have the right under that license to submit that + work with modifications, whether created in whole or in part + by me, under the same open source license (unless I am + permitted to submit under a different license), as indicated + in the file; or + + (c) The contribution was provided directly to me by some other + person who certified (a), (b) or (c) and I have not modified + it. + +then you just add a line saying + + Signed-off-by: Random J Developer + +Some people also put extra tags at the end. They'll just be ignored for +now, but you can do this to mark internal company procedures or just +point out some special detail about the sign-off. + + ----------------------------------- SECTION 2 - HINTS, TIPS, AND TRICKS ----------------------------------- diff -urN linux-2.6.7-rc2/Documentation/fb/vesafb.txt linux-2.6.7-rc3/Documentation/fb/vesafb.txt --- linux-2.6.7-rc2/Documentation/fb/vesafb.txt 2004-05-09 19:32:54.000000000 -0700 +++ linux-2.6.7-rc3/Documentation/fb/vesafb.txt 2004-06-07 12:55:00.822531925 -0700 @@ -146,6 +146,10 @@ mtrr setup memory type range registers for the vesafb framebuffer. +vram:n remap 'n' MiB of video RAM. If 0 or not specified, remap memory + according to video mode. (2.5.66 patch/idea by Antonino Daplas + reversed to give override possibility (allocate more fb memory + than the kernel would) to 2.4 by tmb@iki.fi) Have fun! diff -urN linux-2.6.7-rc2/Documentation/filesystems/Exporting linux-2.6.7-rc3/Documentation/filesystems/Exporting --- linux-2.6.7-rc2/Documentation/filesystems/Exporting 2004-05-09 19:32:28.000000000 -0700 +++ linux-2.6.7-rc3/Documentation/filesystems/Exporting 2004-06-07 12:55:00.823531967 -0700 @@ -32,7 +32,7 @@ all of the ancestors of that filesystem object are also in the dcache. As normal access is by filename this prefix is created naturally and maintained easily (by each object maintaining a reference count on -it's parent). +its parent). However when objects are included into the dcache by interpreting a filehandle fragment, there is no automatic creation of a path prefix @@ -44,15 +44,15 @@ 2/ The dcache must be prepared for a newly found (via ->lookup) directory to already have a (non-connected) dentry, and must be able to move that dentry into place (based on the parent and name in the - ->lookup). This is particuarly needed for directories as + ->lookup). This is particularly needed for directories as it is a dcache invariant that directories only have one dentry. To implement these features, the dcache has: -a/ A dentry flag DCACHE_DISCONNECTED which is set on - and dentry that might not be part of the proper prefix. +a/ A dentry flag DCACHE_DISCONNECTED which is set on + any dentry that might not be part of the proper prefix. This is set when anonymous dentries are created, and cleared when a - dentry is noticed to be a child on a dentry which is in the proper + dentry is noticed to be a child of a dentry which is in the proper prefix. b/ A per-superblock list "s_anon" of dentries which are the roots of @@ -123,9 +123,9 @@ get_name. When given a parent dentry and a child dentry, this should find a name in the directory identified by the parent dentry, which leads to the object identified by the child dentry. - If no get_name function is supplied, a default implementation - which used vfs_readdir to find potential names, and matches inode - numbers to find the correct match. + If no get_name function is supplied, a default implementation is + provided which uses vfs_readdir to find potential names, and + matches inode numbers to find the correct match. get_parent. When given a dentry for a directory, this should return a dentry for the parent. Quite possibly the parent dentry will @@ -135,7 +135,7 @@ ->lookup("..") is *not* used as a default as it can leave ".." entries in the dcache which are too messy to work with. - get_dentry. When given a opaque datum, this should find the + get_dentry. When given an opaque datum, this should find the implied object and create a dentry for it (possibly with d_alloc_anon). The opaque datum is whatever is passed down by the decode_fh @@ -143,7 +143,7 @@ fragment. decode_fh passes two datums through find_exported_dentry. One that should be used to identify the target object, and one that can be - used to identify the objects parent, should that be necessary. + used to identify the object's parent, should that be necessary. The default get_dentry function assumes that the datum contains an inode number and a generation number, and it attempts to get the inode using "iget" and check it's validity by matching the @@ -164,8 +164,8 @@ passed them to find_exported_dentry. -A filehandle fragment consists of an array of 1 or more 4byte words. -Together with a one byte "type". +A filehandle fragment consists of an array of 1 or more 4byte words, +together with a one byte "type". The decode_fh routine should not depend on the stated size that is passed to it. This size may be larger than the original filehandle generated by encode_fh, in which case it will have been padded with diff -urN linux-2.6.7-rc2/Documentation/filesystems/ntfs.txt linux-2.6.7-rc3/Documentation/filesystems/ntfs.txt --- linux-2.6.7-rc2/Documentation/filesystems/ntfs.txt 2004-06-07 12:54:48.076004012 -0700 +++ linux-2.6.7-rc3/Documentation/filesystems/ntfs.txt 2004-06-07 12:55:00.823531967 -0700 @@ -273,6 +273,9 @@ Note, a technical ChangeLog aimed at kernel hackers is in fs/ntfs/ChangeLog. +2.1.12: + - Fix the second fix to the decompression engine from the 2.1.9 release + and some further internals cleanups. 2.1.11: - Driver internal cleanups. 2.1.10: diff -urN linux-2.6.7-rc2/Documentation/ide.txt linux-2.6.7-rc3/Documentation/ide.txt --- linux-2.6.7-rc2/Documentation/ide.txt 2004-05-09 19:32:53.000000000 -0700 +++ linux-2.6.7-rc3/Documentation/ide.txt 2004-06-07 12:55:00.835532464 -0700 @@ -248,6 +248,13 @@ allowing ide-floppy, ide-tape, and ide-cdrom|writers to use ide-scsi emulation on a device specific option. + "hdx=stroke" : Should you have a system w/ an AWARD Bios and your + drives are larger than 32GB and it will not boot, + one is required to perform a few OEM operations first. + The option is called "stroke" because it allows one + to "soft clip" the drive to work around a barrier + limit. + "idebus=xx" : inform IDE driver of VESA/PCI bus speed in MHz, where "xx" is between 20 and 66 inclusive, used when tuning chipset PIO modes. diff -urN linux-2.6.7-rc2/Documentation/kernel-parameters.txt linux-2.6.7-rc3/Documentation/kernel-parameters.txt --- linux-2.6.7-rc2/Documentation/kernel-parameters.txt 2004-05-09 19:33:22.000000000 -0700 +++ linux-2.6.7-rc3/Documentation/kernel-parameters.txt 2004-06-07 12:55:00.972538138 -0700 @@ -896,8 +896,8 @@ psmouse.rate= [HW,MOUSE] Set desired mouse report rate, in reports per second. psmouse.resetafter= - [HW,MOUSE] Try to reset Synaptics Touchpad after so many - bad packets (0 = never). + [HW,MOUSE] Try to reset the device after so many bad packets + (0 = never). psmouse.resolution= [HW,MOUSE] Set desired mouse resolution, in dpi. psmouse.smartscroll= diff -urN linux-2.6.7-rc2/MAINTAINERS linux-2.6.7-rc3/MAINTAINERS --- linux-2.6.7-rc2/MAINTAINERS 2004-06-07 12:54:48.227010266 -0700 +++ linux-2.6.7-rc3/MAINTAINERS 2004-06-07 12:55:01.176546588 -0700 @@ -359,6 +359,8 @@ M: maxk@qualcomm.com L: bluez-devel@lists.sf.net W: http://bluez.sf.net +W: http://www.bluez.org +W: http://www.holtmann.org/linux/bluetooth/ S: Maintained BLUETOOTH RFCOMM LAYER @@ -366,7 +368,6 @@ M: marcel@holtmann.org P: Maxim Krasnyansky M: maxk@qualcomm.com -W: http://bluez.sf.net S: Maintained BLUETOOTH BNEP LAYER @@ -374,71 +375,60 @@ M: marcel@holtmann.org P: Maxim Krasnyansky M: maxk@qualcomm.com -W: http://bluez.sf.net S: Maintained BLUETOOTH CMTP LAYER P: Marcel Holtmann M: marcel@holtmann.org -W: http://www.holtmann.org/linux/bluetooth/ S: Maintained -BLUETOOTH HCI USB DRIVER +BLUETOOTH HCI UART DRIVER P: Marcel Holtmann M: marcel@holtmann.org P: Maxim Krasnyansky M: maxk@qualcomm.com -W: http://bluez.sf.net S: Maintained -BLUETOOTH HCI UART DRIVER +BLUETOOTH HCI USB DRIVER P: Marcel Holtmann M: marcel@holtmann.org P: Maxim Krasnyansky M: maxk@qualcomm.com -W: http://bluez.sf.net S: Maintained BLUETOOTH HCI BCM203X DRIVER P: Marcel Holtmann M: marcel@holtmann.org -W: http://www.holtmann.org/linux/bluetooth/ S: Maintained BLUETOOTH HCI BFUSB DRIVER P: Marcel Holtmann M: marcel@holtmann.org -W: http://www.holtmann.org/linux/bluetooth/ S: Maintained BLUETOOTH HCI DTL1 DRIVER P: Marcel Holtmann M: marcel@holtmann.org -W: http://www.holtmann.org/linux/bluetooth/ S: Maintained BLUETOOTH HCI BLUECARD DRIVER P: Marcel Holtmann M: marcel@holtmann.org -W: http://www.holtmann.org/linux/bluetooth/ S: Maintained BLUETOOTH HCI BT3C DRIVER P: Marcel Holtmann M: marcel@holtmann.org -W: http://www.holtmann.org/linux/bluetooth/ S: Maintained BLUETOOTH HCI BTUART DRIVER P: Marcel Holtmann M: marcel@holtmann.org -W: http://www.holtmann.org/linux/bluetooth/ S: Maintained BLUETOOTH HCI VHCI DRIVER P: Maxim Krasnyansky M: maxk@qualcomm.com -W: http://bluez.sf.net S: Maintained BONDING DRIVER @@ -954,15 +944,15 @@ IA64 (Itanium) PLATFORM P: David Mosberger-Tang M: davidm@hpl.hp.com -L: linux-ia64@linuxia64.org -W: http://www.linuxia64.org/ +L: linux-ia64@vger.kernel.org +W: http://www.ia64-linux.org/ S: Maintained SN-IA64 (Itanium) SUB-PLATFORM P: Jesse Barnes M: jbarnes@sgi.com L: linux-altix@sgi.com -L: linux-ia64@linuxia64.org +L: linux-ia64@vger.kernel.org W: http://www.sgi.com/altix S: Maintained diff -urN linux-2.6.7-rc2/Makefile linux-2.6.7-rc3/Makefile --- linux-2.6.7-rc2/Makefile 2004-06-07 12:54:48.228010308 -0700 +++ linux-2.6.7-rc3/Makefile 2004-06-07 12:55:01.178546670 -0700 @@ -1,7 +1,7 @@ VERSION = 2 PATCHLEVEL = 6 SUBLEVEL = 7 -EXTRAVERSION =-rc2 +EXTRAVERSION =-rc3 NAME=Zonked Quokka # *DOCUMENTATION* @@ -904,6 +904,7 @@ @echo ' rpm - Build a kernel as an RPM package' @echo ' tags/TAGS - Generate tags file for editors' @echo ' cscope - Generate cscope index' + @echo ' checkstack - Generate a list of stack hogs' @echo '' @echo 'Documentation targets:' @$(MAKE) -f $(srctree)/Documentation/DocBook/Makefile dochelp diff -urN linux-2.6.7-rc2/arch/alpha/kernel/core_cia.c linux-2.6.7-rc3/arch/alpha/kernel/core_cia.c --- linux-2.6.7-rc2/arch/alpha/kernel/core_cia.c 2004-05-09 19:32:39.000000000 -0700 +++ linux-2.6.7-rc3/arch/alpha/kernel/core_cia.c 2004-06-07 12:55:01.179546712 -0700 @@ -762,7 +762,7 @@ *(vip)CIA_IOC_PCI_W3_MASK = 0xfff00000; *(vip)CIA_IOC_PCI_T3_BASE = 0 >> 2; - alpha_mv.pci_dac_offset = 0x200000000; + alpha_mv.pci_dac_offset = 0x200000000UL; *(vip)CIA_IOC_PCI_W_DAC = alpha_mv.pci_dac_offset >> 32; } diff -urN linux-2.6.7-rc2/arch/alpha/kernel/core_irongate.c linux-2.6.7-rc3/arch/alpha/kernel/core_irongate.c --- linux-2.6.7-rc2/arch/alpha/kernel/core_irongate.c 2004-05-09 19:32:54.000000000 -0700 +++ linux-2.6.7-rc3/arch/alpha/kernel/core_irongate.c 2004-06-07 12:55:01.180546753 -0700 @@ -287,9 +287,9 @@ hose->sparse_mem_base = 0; hose->sparse_io_base = 0; hose->dense_mem_base - = (IRONGATE_MEM & 0xffffffffff) | 0x80000000000; + = (IRONGATE_MEM & 0xffffffffffUL) | 0x80000000000UL; hose->dense_io_base - = (IRONGATE_IO & 0xffffffffff) | 0x80000000000; + = (IRONGATE_IO & 0xffffffffffUL) | 0x80000000000UL; hose->sg_isa = hose->sg_pci = NULL; __direct_map_base = 0; diff -urN linux-2.6.7-rc2/arch/alpha/kernel/core_marvel.c linux-2.6.7-rc3/arch/alpha/kernel/core_marvel.c --- linux-2.6.7-rc2/arch/alpha/kernel/core_marvel.c 2004-05-09 19:32:00.000000000 -0700 +++ linux-2.6.7-rc3/arch/alpha/kernel/core_marvel.c 2004-06-07 12:55:01.180546753 -0700 @@ -718,7 +718,7 @@ if (((long)addr >> 41) == -2) return; /* kseg map, nothing to do */ if (addr) - return vfree((void *)(PAGE_MASK & addr)); + vfree((void *)(PAGE_MASK & addr)); } #ifndef CONFIG_ALPHA_GENERIC diff -urN linux-2.6.7-rc2/arch/alpha/kernel/core_titan.c linux-2.6.7-rc3/arch/alpha/kernel/core_titan.c --- linux-2.6.7-rc2/arch/alpha/kernel/core_titan.c 2004-05-09 19:32:27.000000000 -0700 +++ linux-2.6.7-rc3/arch/alpha/kernel/core_titan.c 2004-06-07 12:55:01.181546795 -0700 @@ -258,9 +258,9 @@ hose->sparse_mem_base = 0; hose->sparse_io_base = 0; hose->dense_mem_base - = (TITAN_MEM(index) & 0xffffffffff) | 0x80000000000; + = (TITAN_MEM(index) & 0xffffffffffUL) | 0x80000000000UL; hose->dense_io_base - = (TITAN_IO(index) & 0xffffffffff) | 0x80000000000; + = (TITAN_IO(index) & 0xffffffffffUL) | 0x80000000000UL; hose->config_space_base = TITAN_CONF(index); hose->index = index; diff -urN linux-2.6.7-rc2/arch/alpha/kernel/core_wildfire.c linux-2.6.7-rc3/arch/alpha/kernel/core_wildfire.c --- linux-2.6.7-rc2/arch/alpha/kernel/core_wildfire.c 2004-05-09 19:31:56.000000000 -0700 +++ linux-2.6.7-rc3/arch/alpha/kernel/core_wildfire.c 2004-06-07 12:55:01.181546795 -0700 @@ -285,8 +285,8 @@ fe = WILDFIRE_fe(soft_qbb, i); if ((iop->iop_hose[i].init.csr & 1) == 1 && - ((ne->ne_what_am_i.csr & 0xf00000300) == 0x100000300) && - ((fe->fe_what_am_i.csr & 0xf00000300) == 0x100000200)) + ((ne->ne_what_am_i.csr & 0xf00000300UL) == 0x100000300UL) && + ((fe->fe_what_am_i.csr & 0xf00000300UL) == 0x100000200UL)) { wildfire_pca_mask |= 1 << ((soft_qbb << 2) + i); } diff -urN linux-2.6.7-rc2/arch/alpha/kernel/err_marvel.c linux-2.6.7-rc3/arch/alpha/kernel/err_marvel.c --- linux-2.6.7-rc2/arch/alpha/kernel/err_marvel.c 2004-05-09 19:33:20.000000000 -0700 +++ linux-2.6.7-rc3/arch/alpha/kernel/err_marvel.c 2004-06-07 12:55:01.182546836 -0700 @@ -1077,7 +1077,8 @@ default: /* Don't know it - pass it up. */ - return ev7_machine_check(vector, la_ptr, regs); + ev7_machine_check(vector, la_ptr, regs); + return; } /* diff -urN linux-2.6.7-rc2/arch/alpha/kernel/err_titan.c linux-2.6.7-rc3/arch/alpha/kernel/err_titan.c --- linux-2.6.7-rc2/arch/alpha/kernel/err_titan.c 2004-05-09 19:33:19.000000000 -0700 +++ linux-2.6.7-rc3/arch/alpha/kernel/err_titan.c 2004-06-07 12:55:01.183546877 -0700 @@ -407,8 +407,10 @@ /* * Only handle system errors here */ - if ((vector != SCB_Q_SYSMCHK) && (vector != SCB_Q_SYSERR)) - return ev6_machine_check(vector, la_ptr, regs); + if ((vector != SCB_Q_SYSMCHK) && (vector != SCB_Q_SYSERR)) { + ev6_machine_check(vector, la_ptr, regs); + return; + } /* * It's a system error, handle it here diff -urN linux-2.6.7-rc2/arch/alpha/kernel/machvec_impl.h linux-2.6.7-rc3/arch/alpha/kernel/machvec_impl.h --- linux-2.6.7-rc2/arch/alpha/kernel/machvec_impl.h 2004-05-09 19:32:54.000000000 -0700 +++ linux-2.6.7-rc3/arch/alpha/kernel/machvec_impl.h 2004-06-07 12:55:01.183546877 -0700 @@ -20,10 +20,10 @@ #define TITAN_HAE_ADDRESS (&alpha_mv.hae_cache) #define WILDFIRE_HAE_ADDRESS (&alpha_mv.hae_cache) -#if CIA_ONE_HAE_WINDOW +#ifdef CIA_ONE_HAE_WINDOW #define CIA_HAE_ADDRESS (&alpha_mv.hae_cache) #endif -#if MCPCIA_ONE_HAE_WINDOW +#ifdef MCPCIA_ONE_HAE_WINDOW #define MCPCIA_HAE_ADDRESS (&alpha_mv.hae_cache) #endif diff -urN linux-2.6.7-rc2/arch/alpha/kernel/osf_sys.c linux-2.6.7-rc3/arch/alpha/kernel/osf_sys.c --- linux-2.6.7-rc2/arch/alpha/kernel/osf_sys.c 2004-05-09 19:31:55.000000000 -0700 +++ linux-2.6.7-rc3/arch/alpha/kernel/osf_sys.c 2004-06-07 12:55:01.186547002 -0700 @@ -91,7 +91,7 @@ * braindamage (it can't really handle filesystems where the directory * offset differences aren't the same as "d_reclen"). */ -#define NAME_OFFSET(de) ((int) ((de)->d_name - (char *) (de))) +#define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de))) #define ROUND_UP(x) (((x)+3) & ~3) struct osf_dirent { @@ -102,8 +102,8 @@ }; struct osf_dirent_callback { - struct osf_dirent *dirent; - long *basep; + struct osf_dirent __user *dirent; + long __user *basep; unsigned int count; int error; }; @@ -112,7 +112,7 @@ osf_filldir(void *__buf, const char *name, int namlen, loff_t offset, ino_t ino, unsigned int d_type) { - struct osf_dirent *dirent; + struct osf_dirent __user *dirent; struct osf_dirent_callback *buf = (struct osf_dirent_callback *) __buf; unsigned int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1); @@ -131,15 +131,15 @@ if (copy_to_user(dirent->d_name, name, namlen) || put_user(0, dirent->d_name + namlen)) return -EFAULT; - dirent = (void *)dirent + reclen; + dirent = (void __user *)dirent + reclen; buf->dirent = dirent; buf->count -= reclen; return 0; } asmlinkage int -osf_getdirentries(unsigned int fd, struct osf_dirent *dirent, - unsigned int count, long *basep) +osf_getdirentries(unsigned int fd, struct osf_dirent __user *dirent, + unsigned int count, long __user *basep) { int error; struct file *file; @@ -215,10 +215,10 @@ int f_files; int f_ffree; __kernel_fsid_t f_fsid; -} *osf_stat; +}; static int -linux_to_osf_statfs(struct kstatfs *linux_stat, struct osf_statfs *osf_stat, +linux_to_osf_statfs(struct kstatfs *linux_stat, struct osf_statfs __user *osf_stat, unsigned long bufsiz) { struct osf_statfs tmp_stat; @@ -239,7 +239,7 @@ } static int -do_osf_statfs(struct dentry * dentry, struct osf_statfs *buffer, +do_osf_statfs(struct dentry * dentry, struct osf_statfs __user *buffer, unsigned long bufsiz) { struct kstatfs linux_stat; @@ -250,7 +250,7 @@ } asmlinkage int -osf_statfs(char *path, struct osf_statfs *buffer, unsigned long bufsiz) +osf_statfs(char __user *path, struct osf_statfs __user *buffer, unsigned long bufsiz) { struct nameidata nd; int retval; @@ -264,7 +264,7 @@ } asmlinkage int -osf_fstatfs(unsigned long fd, struct osf_statfs *buffer, unsigned long bufsiz) +osf_fstatfs(unsigned long fd, struct osf_statfs __user *buffer, unsigned long bufsiz) { struct file *file; int retval; @@ -284,13 +284,13 @@ * Although to be frank, neither are the native Linux/i386 ones.. */ struct ufs_args { - char *devname; + char __user *devname; int flags; uid_t exroot; }; struct cdfs_args { - char *devname; + char __user *devname; int flags; uid_t exroot; @@ -299,7 +299,7 @@ }; struct procfs_args { - char *devname; + char __user *devname; int flags; uid_t exroot; }; @@ -313,7 +313,7 @@ * unhappy with OSF UFS. [CHECKME] */ static int -osf_ufs_mount(char *dirname, struct ufs_args *args, int flags) +osf_ufs_mount(char *dirname, struct ufs_args __user *args, int flags) { int retval; struct cdfs_args tmp; @@ -333,7 +333,7 @@ } static int -osf_cdfs_mount(char *dirname, struct cdfs_args *args, int flags) +osf_cdfs_mount(char *dirname, struct cdfs_args __user *args, int flags) { int retval; struct cdfs_args tmp; @@ -353,7 +353,7 @@ } static int -osf_procfs_mount(char *dirname, struct procfs_args *args, int flags) +osf_procfs_mount(char *dirname, struct procfs_args __user *args, int flags) { struct procfs_args tmp; @@ -364,7 +364,7 @@ } asmlinkage int -osf_mount(unsigned long typenr, char *path, int flag, void *data) +osf_mount(unsigned long typenr, char __user *path, int flag, void __user *data) { int retval = -EINVAL; char *name; @@ -377,13 +377,13 @@ goto out; switch (typenr) { case 1: - retval = osf_ufs_mount(name, (struct ufs_args *) data, flag); + retval = osf_ufs_mount(name, data, flag); break; case 6: - retval = osf_cdfs_mount(name, (struct cdfs_args *) data, flag); + retval = osf_cdfs_mount(name, data, flag); break; case 9: - retval = osf_procfs_mount(name, (struct procfs_args *) data, flag); + retval = osf_procfs_mount(name, data, flag); break; default: printk("osf_mount(%ld, %x)\n", typenr, flag); @@ -395,7 +395,7 @@ } asmlinkage int -osf_utsname(char *name) +osf_utsname(char __user *name) { int error; @@ -434,7 +434,7 @@ * For compatibility with OSF/1 only. Use utsname(2) instead. */ asmlinkage int -osf_getdomainname(char *name, int namelen) +osf_getdomainname(char __user *name, int namelen) { unsigned len; int i, error; @@ -459,7 +459,7 @@ } asmlinkage long -osf_shmat(int shmid, void *shmaddr, int shmflg) +osf_shmat(int shmid, void __user *shmaddr, int shmflg) { unsigned long raddr; long err; @@ -497,39 +497,39 @@ union pl_args { struct setargs { - char *path; + char __user *path; long follow; long nbytes; - char *buf; + char __user *buf; } set; struct fsetargs { long fd; long nbytes; - char *buf; + char __user *buf; } fset; struct getargs { - char *path; + char __user *path; long follow; - struct proplistname_args *name_args; + struct proplistname_args __user *name_args; long nbytes; - char *buf; - int *min_buf_size; + char __user *buf; + int __user *min_buf_size; } get; struct fgetargs { long fd; - struct proplistname_args *name_args; + struct proplistname_args __user *name_args; long nbytes; - char *buf; - int *min_buf_size; + char __user *buf; + int __user *min_buf_size; } fget; struct delargs { - char *path; + char __user *path; long follow; - struct proplistname_args *name_args; + struct proplistname_args __user *name_args; } del; struct fdelargs { long fd; - struct proplistname_args *name_args; + struct proplistname_args __user *name_args; } fdel; }; @@ -540,24 +540,20 @@ }; asmlinkage long -osf_proplist_syscall(enum pl_code code, union pl_args *args) +osf_proplist_syscall(enum pl_code code, union pl_args __user *args) { long error; - int *min_buf_size_ptr; + int __user *min_buf_size_ptr; lock_kernel(); switch (code) { case PL_SET: - error = verify_area(VERIFY_READ, &args->set.nbytes, - sizeof(args->set.nbytes)); - if (!error) - error = args->set.nbytes; + if (get_user(error, &args->set.nbytes)) + error = -EFAULT; break; case PL_FSET: - error = verify_area(VERIFY_READ, &args->fset.nbytes, - sizeof(args->fset.nbytes)); - if (!error) - error = args->fset.nbytes; + if (get_user(error, &args->fset.nbytes)) + error = -EFAULT; break; case PL_GET: error = get_user(min_buf_size_ptr, &args->get.min_buf_size); @@ -584,7 +580,7 @@ } asmlinkage int -osf_sigstack(struct sigstack *uss, struct sigstack *uoss) +osf_sigstack(struct sigstack __user *uss, struct sigstack __user *uoss) { unsigned long usp = rdusp(); unsigned long oss_sp = current->sas_ss_sp + current->sas_ss_size; @@ -625,7 +621,7 @@ } asmlinkage long -osf_sysinfo(int command, char *buf, long count) +osf_sysinfo(int command, char __user *buf, long count) { static char * sysinfo_table[] = { system_utsname.sysname, @@ -664,8 +660,8 @@ } asmlinkage unsigned long -osf_getsysinfo(unsigned long op, void *buffer, unsigned long nbytes, - int *start, void *arg) +osf_getsysinfo(unsigned long op, void __user *buffer, unsigned long nbytes, + int __user *start, void __user *arg) { unsigned long w; struct percpu_struct *cpu; @@ -677,7 +673,7 @@ w = current_thread_info()->ieee_state & IEEE_SW_MASK; w = swcr_update_status(w, rdfpcr()); - if (put_user(w, (unsigned long *) buffer)) + if (put_user(w, (unsigned long __user *) buffer)) return -EFAULT; return 0; @@ -693,7 +689,7 @@ if (nbytes < sizeof(unsigned int)) return -EINVAL; w = (current_thread_info()->flags >> UAC_SHIFT) & UAC_BITMASK; - if (put_user(w, (unsigned int *)buffer)) + if (put_user(w, (unsigned int __user *)buffer)) return -EFAULT; return 1; @@ -703,7 +699,7 @@ cpu = (struct percpu_struct*) ((char*)hwrpb + hwrpb->processor_offset); w = cpu->type; - if (put_user(w, (unsigned long *)buffer)) + if (put_user(w, (unsigned long __user*)buffer)) return -EFAULT; return 1; @@ -722,8 +718,8 @@ } asmlinkage unsigned long -osf_setsysinfo(unsigned long op, void *buffer, unsigned long nbytes, - int *start, void *arg) +osf_setsysinfo(unsigned long op, void __user *buffer, unsigned long nbytes, + int __user *start, void __user *arg) { switch (op) { case SSI_IEEE_FP_CONTROL: { @@ -737,7 +733,7 @@ */ /* Update softare trap enable bits. */ - if (get_user(swcr, (unsigned long *)buffer)) + if (get_user(swcr, (unsigned long __user *)buffer)) return -EFAULT; current_thread_info()->ieee_state = ((current_thread_info()->ieee_state & ~IEEE_SW_MASK) @@ -788,9 +784,9 @@ for (i = 0; i < nbytes; ++i) { - if (get_user(v, 2*i + (unsigned int *)buffer)) + if (get_user(v, 2*i + (unsigned int __user *)buffer)) return -EFAULT; - if (get_user(w, 2*i + 1 + (unsigned int *)buffer)) + if (get_user(w, 2*i + 1 + (unsigned int __user *)buffer)) return -EFAULT; switch (v) { case SSIN_UACPROC: @@ -835,7 +831,7 @@ }; static inline long -get_tv32(struct timeval *o, struct timeval32 *i) +get_tv32(struct timeval *o, struct timeval32 __user *i) { return (!access_ok(VERIFY_READ, i, sizeof(*i)) || (__get_user(o->tv_sec, &i->tv_sec) | @@ -843,7 +839,7 @@ } static inline long -put_tv32(struct timeval32 *o, struct timeval *i) +put_tv32(struct timeval32 __user *o, struct timeval *i) { return (!access_ok(VERIFY_WRITE, o, sizeof(*o)) || (__put_user(i->tv_sec, &o->tv_sec) | @@ -851,7 +847,7 @@ } static inline long -get_it32(struct itimerval *o, struct itimerval32 *i) +get_it32(struct itimerval *o, struct itimerval32 __user *i) { return (!access_ok(VERIFY_READ, i, sizeof(*i)) || (__get_user(o->it_interval.tv_sec, &i->it_interval.tv_sec) | @@ -861,7 +857,7 @@ } static inline long -put_it32(struct itimerval32 *o, struct itimerval *i) +put_it32(struct itimerval32 __user *o, struct itimerval *i) { return (!access_ok(VERIFY_WRITE, o, sizeof(*o)) || (__put_user(i->it_interval.tv_sec, &o->it_interval.tv_sec) | @@ -878,7 +874,7 @@ } asmlinkage int -osf_gettimeofday(struct timeval32 *tv, struct timezone *tz) +osf_gettimeofday(struct timeval32 __user *tv, struct timezone __user *tz) { if (tv) { struct timeval ktv; @@ -894,7 +890,7 @@ } asmlinkage int -osf_settimeofday(struct timeval32 *tv, struct timezone *tz) +osf_settimeofday(struct timeval32 __user *tv, struct timezone __user *tz) { struct timespec kts; struct timezone ktz; @@ -914,7 +910,7 @@ } asmlinkage int -osf_getitimer(int which, struct itimerval32 *it) +osf_getitimer(int which, struct itimerval32 __user *it) { struct itimerval kit; int error; @@ -927,7 +923,7 @@ } asmlinkage int -osf_setitimer(int which, struct itimerval32 *in, struct itimerval32 *out) +osf_setitimer(int which, struct itimerval32 __user *in, struct itimerval32 __user *out) { struct itimerval kin, kout; int error; @@ -950,16 +946,9 @@ } asmlinkage int -osf_utimes(const char *filename, struct timeval32 *tvs) +osf_utimes(char __user *filename, struct timeval32 __user *tvs) { - char *kfilename; struct timeval ktvs[2]; - mm_segment_t old_fs; - int ret; - - kfilename = getname(filename); - if (IS_ERR(kfilename)) - return PTR_ERR(kfilename); if (tvs) { if (get_tv32(&ktvs[0], &tvs[0]) || @@ -967,22 +956,15 @@ return -EFAULT; } - old_fs = get_fs(); - set_fs(KERNEL_DS); - ret = sys_utimes(kfilename, tvs ? ktvs : 0); - set_fs(old_fs); - - putname(kfilename); - - return ret; + return do_utimes(filename, tvs ? ktvs : 0); } #define MAX_SELECT_SECONDS \ ((unsigned long) (MAX_SCHEDULE_TIMEOUT / HZ)-1) asmlinkage int -osf_select(int n, fd_set *inp, fd_set *outp, fd_set *exp, - struct timeval32 *tvp) +osf_select(int n, fd_set __user *inp, fd_set __user *outp, fd_set __user *exp, + struct timeval32 __user *tvp) { fd_set_bits fds; char *bits; @@ -1081,7 +1063,7 @@ }; asmlinkage int -osf_getrusage(int who, struct rusage32 *ru) +osf_getrusage(int who, struct rusage32 __user *ru) { struct rusage32 r; @@ -1116,7 +1098,7 @@ } asmlinkage int -osf_wait4(pid_t pid, int *ustatus, int options, struct rusage32 *ur) +osf_wait4(pid_t pid, int __user *ustatus, int options, struct rusage32 __user *ur) { if (!ur) { return sys_wait4(pid, ustatus, options, NULL); @@ -1163,7 +1145,7 @@ * one is the time remaining.. Ho humm.. No documentation. */ asmlinkage int -osf_usleep_thread(struct timeval32 *sleep, struct timeval32 *remain) +osf_usleep_thread(struct timeval32 __user *sleep, struct timeval32 __user *remain) { struct timeval tmp; unsigned long ticks; @@ -1221,7 +1203,7 @@ }; asmlinkage int -sys_old_adjtimex(struct timex32 *txc_p) +sys_old_adjtimex(struct timex32 __user *txc_p) { struct timex txc; int ret; @@ -1316,12 +1298,12 @@ compatibility with old versions of OSF/1 where iov_len was defined as int. */ static int -osf_fix_iov_len(const struct iovec *iov, unsigned long count) +osf_fix_iov_len(const struct iovec __user *iov, unsigned long count) { unsigned long i; for (i = 0 ; i < count ; i++) { - int *iov_len_high = (int *)&iov[i].iov_len + 1; + int *iov_len_high = (int __user *)&iov[i].iov_len + 1; if (put_user(0, iov_len_high)) return -EFAULT; @@ -1330,7 +1312,7 @@ } asmlinkage ssize_t -osf_readv(unsigned long fd, const struct iovec * vector, unsigned long count) +osf_readv(unsigned long fd, const struct iovec __user * vector, unsigned long count) { if (unlikely(personality(current->personality) == PER_OSF4)) if (osf_fix_iov_len(vector, count)) @@ -1339,7 +1321,7 @@ } asmlinkage ssize_t -osf_writev(unsigned long fd, const struct iovec * vector, unsigned long count) +osf_writev(unsigned long fd, const struct iovec __user * vector, unsigned long count) { if (unlikely(personality(current->personality) == PER_OSF4)) if (osf_fix_iov_len(vector, count)) diff -urN linux-2.6.7-rc2/arch/alpha/kernel/process.c linux-2.6.7-rc3/arch/alpha/kernel/process.c --- linux-2.6.7-rc2/arch/alpha/kernel/process.c 2004-06-07 12:54:48.230010390 -0700 +++ linux-2.6.7-rc3/arch/alpha/kernel/process.c 2004-06-07 12:55:01.186547002 -0700 @@ -239,8 +239,9 @@ * with parameters (SIGCHLD, 0). */ int -alpha_clone(unsigned long clone_flags, unsigned long usp, int *parent_tid, - int *child_tid, unsigned long tls_value, struct pt_regs *regs) +alpha_clone(unsigned long clone_flags, unsigned long usp, + int __user *parent_tid, int __user *child_tid, + unsigned long tls_value, struct pt_regs *regs) { if (!usp) usp = rdusp(); @@ -464,7 +465,8 @@ * Don't do this at home. */ asmlinkage int -sys_execve(char *ufilename, char **argv, char **envp, +sys_execve(char __user *ufilename, char __user * __user *argv, + char __user * __user *envp, unsigned long a3, unsigned long a4, unsigned long a5, struct pt_regs regs) { diff -urN linux-2.6.7-rc2/arch/alpha/kernel/semaphore.c linux-2.6.7-rc3/arch/alpha/kernel/semaphore.c --- linux-2.6.7-rc2/arch/alpha/kernel/semaphore.c 2004-05-09 19:32:37.000000000 -0700 +++ linux-2.6.7-rc3/arch/alpha/kernel/semaphore.c 2004-06-07 12:55:01.187547043 -0700 @@ -163,7 +163,7 @@ void __sched down(struct semaphore *sem) { -#if WAITQUEUE_DEBUG +#ifdef WAITQUEUE_DEBUG CHECK_MAGIC(sem->__magic); #endif #ifdef CONFIG_DEBUG_SEMAPHORE @@ -177,7 +177,7 @@ int __sched down_interruptible(struct semaphore *sem) { -#if WAITQUEUE_DEBUG +#ifdef WAITQUEUE_DEBUG CHECK_MAGIC(sem->__magic); #endif #ifdef CONFIG_DEBUG_SEMAPHORE @@ -193,7 +193,7 @@ { int ret; -#if WAITQUEUE_DEBUG +#ifdef WAITQUEUE_DEBUG CHECK_MAGIC(sem->__magic); #endif @@ -212,7 +212,7 @@ void up(struct semaphore *sem) { -#if WAITQUEUE_DEBUG +#ifdef WAITQUEUE_DEBUG CHECK_MAGIC(sem->__magic); #endif #ifdef CONFIG_DEBUG_SEMAPHORE diff -urN linux-2.6.7-rc2/arch/alpha/kernel/setup.c linux-2.6.7-rc3/arch/alpha/kernel/setup.c --- linux-2.6.7-rc2/arch/alpha/kernel/setup.c 2004-05-09 19:32:02.000000000 -0700 +++ linux-2.6.7-rc3/arch/alpha/kernel/setup.c 2004-06-07 12:55:01.187547043 -0700 @@ -1359,7 +1359,7 @@ L1I = L1D = CSHAPE(8*1024, 5, 1); L3 = -1; - car = *(vuip) phys_to_virt (0x120000078); + car = *(vuip) phys_to_virt (0x120000078UL); size = 64*1024 * (1 << ((car >> 5) & 7)); /* No typo -- 8 byte cacheline size. Whodathunk. */ L2 = (car & 1 ? CSHAPE (size, 3, 1) : -1); @@ -1374,7 +1374,7 @@ L1I = L1D = CSHAPE(8*1024, 5, 1); /* Check the line size of the Scache. */ - sc_ctl = *(vulp) phys_to_virt (0xfffff000a8); + sc_ctl = *(vulp) phys_to_virt (0xfffff000a8UL); width = sc_ctl & 0x1000 ? 6 : 5; L2 = CSHAPE (96*1024, width, 3); @@ -1406,7 +1406,7 @@ } L3 = -1; - cbox_config = *(vulp) phys_to_virt (0xfffff00008); + cbox_config = *(vulp) phys_to_virt (0xfffff00008UL); size = 512*1024 * (1 << ((cbox_config >> 12) & 3)); #if 0 diff -urN linux-2.6.7-rc2/arch/alpha/kernel/signal.c linux-2.6.7-rc3/arch/alpha/kernel/signal.c --- linux-2.6.7-rc2/arch/alpha/kernel/signal.c 2004-05-09 19:32:29.000000000 -0700 +++ linux-2.6.7-rc3/arch/alpha/kernel/signal.c 2004-06-07 12:55:01.188547085 -0700 @@ -84,8 +84,8 @@ } asmlinkage int -osf_sigaction(int sig, const struct osf_sigaction *act, - struct osf_sigaction *oact) +osf_sigaction(int sig, const struct osf_sigaction __user *act, + struct osf_sigaction __user *oact) { struct k_sigaction new_ka, old_ka; int ret; @@ -115,8 +115,9 @@ } asmlinkage long -sys_rt_sigaction(int sig, const struct sigaction *act, struct sigaction *oact, - size_t sigsetsize, void *restorer) +sys_rt_sigaction(int sig, const struct sigaction __user *act, + struct sigaction __user *oact, + size_t sigsetsize, void __user *restorer) { struct k_sigaction new_ka, old_ka; int ret; @@ -165,7 +166,7 @@ } asmlinkage int -do_rt_sigsuspend(sigset_t *uset, size_t sigsetsize, +do_rt_sigsuspend(sigset_t __user *uset, size_t sigsetsize, struct pt_regs *reg, struct switch_stack *sw) { sigset_t oldset, set; @@ -192,7 +193,7 @@ } asmlinkage int -sys_sigaltstack(const stack_t *uss, stack_t *uoss) +sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss) { return do_sigaltstack(uss, uoss, rdusp()); } @@ -223,7 +224,7 @@ #define INSN_CALLSYS 0x00000083 static long -restore_sigcontext(struct sigcontext *sc, struct pt_regs *regs, +restore_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs, struct switch_stack *sw) { unsigned long usp; @@ -276,7 +277,7 @@ registers and transfer control from userland. */ asmlinkage void -do_sigreturn(struct sigcontext *sc, struct pt_regs *regs, +do_sigreturn(struct sigcontext __user *sc, struct pt_regs *regs, struct switch_stack *sw) { sigset_t set; @@ -314,7 +315,7 @@ } asmlinkage void -do_rt_sigreturn(struct rt_sigframe *frame, struct pt_regs *regs, +do_rt_sigreturn(struct rt_sigframe __user *frame, struct pt_regs *regs, struct switch_stack *sw) { sigset_t set; @@ -356,17 +357,17 @@ * Set up a signal frame. */ -static inline void * +static inline void __user * get_sigframe(struct k_sigaction *ka, unsigned long sp, size_t frame_size) { if ((ka->sa.sa_flags & SA_ONSTACK) != 0 && ! on_sig_stack(sp)) sp = current->sas_ss_sp + current->sas_ss_size; - return (void *)((sp - frame_size) & -32ul); + return (void __user *)((sp - frame_size) & -32ul); } static long -setup_sigcontext(struct sigcontext *sc, struct pt_regs *regs, +setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs, struct switch_stack *sw, unsigned long mask, unsigned long sp) { long i, err = 0; @@ -426,7 +427,7 @@ struct pt_regs *regs, struct switch_stack * sw) { unsigned long oldsp, r26, err = 0; - struct sigframe *frame; + struct sigframe __user *frame; oldsp = rdusp(); frame = get_sigframe(ka, oldsp, sizeof(*frame)); @@ -479,7 +480,7 @@ sigset_t *set, struct pt_regs *regs, struct switch_stack * sw) { unsigned long oldsp, r26, err = 0; - struct rt_sigframe *frame; + struct rt_sigframe __user *frame; oldsp = rdusp(); frame = get_sigframe(ka, oldsp, sizeof(*frame)); diff -urN linux-2.6.7-rc2/arch/alpha/kernel/smp.c linux-2.6.7-rc3/arch/alpha/kernel/smp.c --- linux-2.6.7-rc2/arch/alpha/kernel/smp.c 2004-06-07 12:54:48.231010432 -0700 +++ linux-2.6.7-rc3/arch/alpha/kernel/smp.c 2004-06-07 12:55:01.189547126 -0700 @@ -779,7 +779,7 @@ void smp_send_reschedule(int cpu) { -#if DEBUG_IPI_MSG +#ifdef DEBUG_IPI_MSG if (cpu == hard_smp_processor_id()) printk(KERN_WARNING "smp_send_reschedule: Sending IPI to self.\n"); @@ -791,7 +791,7 @@ smp_send_stop(void) { unsigned long to_whom = cpu_present_mask & ~(1UL << smp_processor_id()); -#if DEBUG_IPI_MSG +#ifdef DEBUG_IPI_MSG if (hard_smp_processor_id() != boot_cpu_id) printk(KERN_WARNING "smp_send_stop: Not on boot cpu.\n"); #endif diff -urN linux-2.6.7-rc2/arch/alpha/kernel/sys_sx164.c linux-2.6.7-rc3/arch/alpha/kernel/sys_sx164.c --- linux-2.6.7-rc2/arch/alpha/kernel/sys_sx164.c 2004-05-09 19:32:29.000000000 -0700 +++ linux-2.6.7-rc3/arch/alpha/kernel/sys_sx164.c 2004-06-07 12:55:01.190547167 -0700 @@ -51,7 +51,7 @@ if (alpha_using_srm) init_srm_irqs(40, 0x3f0000); else - init_pyxis_irqs(0xff00003f0000); + init_pyxis_irqs(0xff00003f0000UL); setup_irq(16+6, &timer_cascade_irqaction); } diff -urN linux-2.6.7-rc2/arch/alpha/lib/csum_partial_copy.c linux-2.6.7-rc3/arch/alpha/lib/csum_partial_copy.c --- linux-2.6.7-rc2/arch/alpha/lib/csum_partial_copy.c 2004-05-09 19:32:36.000000000 -0700 +++ linux-2.6.7-rc3/arch/alpha/lib/csum_partial_copy.c 2004-06-07 12:55:01.192547250 -0700 @@ -99,7 +99,7 @@ * Ok. This isn't fun, but this is the EASY case. */ static inline unsigned long -csum_partial_cfu_aligned(const unsigned long *src, unsigned long *dst, +csum_partial_cfu_aligned(const unsigned long __user *src, unsigned long *dst, long len, unsigned long checksum, int *errp) { @@ -139,7 +139,8 @@ * easy. */ static inline unsigned long -csum_partial_cfu_dest_aligned(const unsigned long *src, unsigned long *dst, +csum_partial_cfu_dest_aligned(const unsigned long __user *src, + unsigned long *dst, unsigned long soff, long len, unsigned long checksum, int *errp) @@ -327,7 +328,7 @@ } static unsigned int -do_csum_partial_copy_from_user(const char *src, char *dst, int len, +do_csum_partial_copy_from_user(const char __user *src, char *dst, int len, unsigned int sum, int *errp) { unsigned long checksum = (unsigned) sum; @@ -338,12 +339,12 @@ if (!doff) { if (!soff) checksum = csum_partial_cfu_aligned( - (const unsigned long *) src, + (const unsigned long __user *) src, (unsigned long *) dst, len-8, checksum, errp); else checksum = csum_partial_cfu_dest_aligned( - (const unsigned long *) src, + (const unsigned long __user *) src, (unsigned long *) dst, soff, len-8, checksum, errp); } else { @@ -351,13 +352,13 @@ ldq_u(partial_dest, dst); if (!soff) checksum = csum_partial_cfu_src_aligned( - (const unsigned long *) src, + (const unsigned long __user *) src, (unsigned long *) dst, doff, len-8, checksum, partial_dest, errp); else checksum = csum_partial_cfu_unaligned( - (const unsigned long *) src, + (const unsigned long __user *) src, (unsigned long *) dst, soff, doff, len-8, checksum, partial_dest, errp); @@ -368,7 +369,7 @@ } unsigned int -csum_partial_copy_from_user(const char *src, char *dst, int len, +csum_partial_copy_from_user(const char __user *src, char *dst, int len, unsigned int sum, int *errp) { if (!access_ok(src, len, VERIFY_READ)) { diff -urN linux-2.6.7-rc2/arch/alpha/math-emu/math.c linux-2.6.7-rc3/arch/alpha/math-emu/math.c --- linux-2.6.7-rc2/arch/alpha/math-emu/math.c 2004-06-07 12:54:48.234010556 -0700 +++ linux-2.6.7-rc3/arch/alpha/math-emu/math.c 2004-06-07 12:55:01.193547292 -0700 @@ -106,7 +106,7 @@ __u32 insn; long si_code; - get_user(insn, (__u32*)pc); + get_user(insn, (__u32 __user *)pc); fc = (insn >> 0) & 0x1f; /* destination register */ fb = (insn >> 16) & 0x1f; fa = (insn >> 21) & 0x1f; @@ -171,7 +171,7 @@ _FP_FRAC_SET_1(DB, _FP_ZEROFRAC_1); } FP_CMP_D(res, DA, DB, 3); - vc = 0x4000000000000000; + vc = 0x4000000000000000UL; /* CMPTEQ, CMPTUN don't trap on QNaN, while CMPTLT and CMPTLE do */ if (res == 3 @@ -351,7 +351,7 @@ * up to the first occurrence of such an instruction. */ while (write_mask) { - get_user(insn, (__u32*)(trigger_pc)); + get_user(insn, (__u32 __user *)(trigger_pc)); opcode = insn >> 26; rc = insn & 0x1f; diff -urN linux-2.6.7-rc2/arch/alpha/mm/fault.c linux-2.6.7-rc3/arch/alpha/mm/fault.c --- linux-2.6.7-rc2/arch/alpha/mm/fault.c 2004-05-09 19:32:27.000000000 -0700 +++ linux-2.6.7-rc3/arch/alpha/mm/fault.c 2004-06-07 12:55:01.193547292 -0700 @@ -40,7 +40,7 @@ unsigned long last_asn = ASN_FIRST_VERSION; #endif -extern void +void __load_new_mm_context(struct mm_struct *next_mm) { unsigned long mmc; diff -urN linux-2.6.7-rc2/arch/alpha/mm/init.c linux-2.6.7-rc3/arch/alpha/mm/init.c --- linux-2.6.7-rc2/arch/alpha/mm/init.c 2004-06-07 12:54:48.234010556 -0700 +++ linux-2.6.7-rc3/arch/alpha/mm/init.c 2004-06-07 12:55:01.194547333 -0700 @@ -152,9 +152,9 @@ /* Set the vptb. This is often done by the bootloader, but shouldn't be required. */ - if (hwrpb->vptb != 0xfffffffe00000000) { - wrvptptr(0xfffffffe00000000); - hwrpb->vptb = 0xfffffffe00000000; + if (hwrpb->vptb != 0xfffffffe00000000UL) { + wrvptptr(0xfffffffe00000000UL); + hwrpb->vptb = 0xfffffffe00000000UL; hwrpb_update_checksum(hwrpb); } @@ -301,8 +301,8 @@ /* Move the vptb back to where the SRM console expects it. */ swapper_pg_dir[1] = swapper_pg_dir[1023]; tbia(); - wrvptptr(0x200000000); - hwrpb->vptb = 0x200000000; + wrvptptr(0x200000000UL); + hwrpb->vptb = 0x200000000UL; hwrpb_update_checksum(hwrpb); /* Reload the page tables that the console had in use. */ diff -urN linux-2.6.7-rc2/arch/arm/kernel/entry-armv.S linux-2.6.7-rc3/arch/arm/kernel/entry-armv.S --- linux-2.6.7-rc2/arch/arm/kernel/entry-armv.S 2004-06-07 12:54:48.243010929 -0700 +++ linux-2.6.7-rc3/arch/arm/kernel/entry-armv.S 2004-06-07 12:55:01.203547706 -0700 @@ -679,19 +679,19 @@ .macro get_irqnr_and_base, irqnr, irqstat, base, tmp ldr \base, =IO_ADDRESS(OMAP_IH1_BASE) - ldr \irqnr, [\base, #IRQ_ITR] - ldr \tmp, [\base, #IRQ_MIR] + ldr \irqnr, [\base, #IRQ_ITR_REG_OFFSET] + ldr \tmp, [\base, #IRQ_MIR_REG_OFFSET] mov \irqstat, #0xffffffff bic \tmp, \irqstat, \tmp tst \irqnr, \tmp beq 1510f - ldr \irqnr, [\base, #IRQ_SIR_FIQ] + ldr \irqnr, [\base, #IRQ_SIR_FIQ_REG_OFFSET] cmp \irqnr, #0 - ldreq \irqnr, [\base, #IRQ_SIR_IRQ] + ldreq \irqnr, [\base, #IRQ_SIR_IRQ_REG_OFFSET] cmpeq \irqnr, #INT_IH2_IRQ ldreq \base, =IO_ADDRESS(OMAP_IH2_BASE) - ldreq \irqnr, [\base, #IRQ_SIR_IRQ] + ldreq \irqnr, [\base, #IRQ_SIR_IRQ_REG_OFFSET] addeqs \irqnr, \irqnr, #32 1510: .endm diff -urN linux-2.6.7-rc2/arch/arm/kernel/irq.c linux-2.6.7-rc3/arch/arm/kernel/irq.c --- linux-2.6.7-rc2/arch/arm/kernel/irq.c 2004-06-07 12:54:48.244010970 -0700 +++ linux-2.6.7-rc3/arch/arm/kernel/irq.c 2004-06-07 12:55:01.204547747 -0700 @@ -447,7 +447,7 @@ * come via this function. Instead, they should provide their * own 'handler' */ -asmlinkage void asm_do_IRQ(int irq, struct pt_regs *regs) +asmlinkage void asm_do_IRQ(unsigned int irq, struct pt_regs *regs) { struct irqdesc *desc = irq_desc + irq; diff -urN linux-2.6.7-rc2/arch/arm/kernel/ptrace.c linux-2.6.7-rc3/arch/arm/kernel/ptrace.c --- linux-2.6.7-rc2/arch/arm/kernel/ptrace.c 2004-05-09 19:32:00.000000000 -0700 +++ linux-2.6.7-rc3/arch/arm/kernel/ptrace.c 2004-06-07 12:55:01.205547789 -0700 @@ -622,7 +622,7 @@ ret = access_process_vm(child, addr, &tmp, sizeof(unsigned long), 0); if (ret == sizeof(unsigned long)) - ret = put_user(tmp, (unsigned long *) data); + ret = put_user(tmp, (unsigned long __user *) data); else ret = -EIO; break; diff -urN linux-2.6.7-rc2/arch/arm/kernel/signal.c linux-2.6.7-rc3/arch/arm/kernel/signal.c --- linux-2.6.7-rc2/arch/arm/kernel/signal.c 2004-06-07 12:54:48.246011053 -0700 +++ linux-2.6.7-rc3/arch/arm/kernel/signal.c 2004-06-07 12:55:01.206547830 -0700 @@ -564,10 +564,10 @@ regs->ARM_r7 = __NR_restart_syscall; regs->ARM_pc -= 2; } else { - u32 *usp; + u32 __user *usp; regs->ARM_sp -= 12; - usp = (u32 *)regs->ARM_sp; + usp = (u32 __user *)regs->ARM_sp; put_user(regs->ARM_pc, &usp[0]); /* swi __NR_restart_syscall */ diff -urN linux-2.6.7-rc2/arch/arm/mach-clps711x/clep7312.c linux-2.6.7-rc3/arch/arm/mach-clps711x/clep7312.c --- linux-2.6.7-rc2/arch/arm/mach-clps711x/clep7312.c 2004-05-09 19:32:37.000000000 -0700 +++ linux-2.6.7-rc3/arch/arm/mach-clps711x/clep7312.c 2004-06-07 12:55:01.208547913 -0700 @@ -31,7 +31,6 @@ char **cmdline, struct meminfo *mi) { mi->nr_banks=1; - mi->end = 0xc0FFFFFF; mi->bank[0].start = 0xc0000000; mi->bank[0].size = 0x01000000; mi->bank[0].node = 0; diff -urN linux-2.6.7-rc2/arch/arm/mach-clps711x/fortunet.c linux-2.6.7-rc3/arch/arm/mach-clps711x/fortunet.c --- linux-2.6.7-rc2/arch/arm/mach-clps711x/fortunet.c 2004-05-09 19:32:52.000000000 -0700 +++ linux-2.6.7-rc3/arch/arm/mach-clps711x/fortunet.c 2004-06-07 12:55:01.208547913 -0700 @@ -34,7 +34,16 @@ extern void clps711x_map_io(void); extern void clps711x_init_irq(void); -struct meminfo memmap = { 1, 0xC1000000, {{0xC0000000,0x01000000,0}}}; +struct meminfo memmap = { + .nr_banks = 1, + .bank = { + { + .start = 0xC0000000, + .size = 0x01000000, + .node = 0 + }, + }, +}; typedef struct tag_IMAGE_PARAMS { @@ -53,9 +62,8 @@ fortunet_fixup(struct machine_desc *desc, struct tag *tags, char **cmdline, struct meminfo *mi) { - IMAGE_PARAMS *ip; - ip = (IMAGE_PARAMS *)__phys_to_virt(IMAGE_PARAMS_PHYS); - *cmdline = (char *)__phys_to_virt(ip->command_line); + IMAGE_PARAMS *ip = phys_to_virt(IMAGE_PARAMS_PHYS); + *cmdline = phys_to_virt(ip->command_line); #ifdef CONFIG_BLK_DEV_INITRD if(ip->ramdisk_ok) { @@ -64,7 +72,6 @@ } #endif memmap.bank[0].size = ip->ram_size; - memmap.end = ip->ram_size+0xC0000000; *mi = memmap; } diff -urN linux-2.6.7-rc2/arch/arm/mach-integrator/core.c linux-2.6.7-rc3/arch/arm/mach-integrator/core.c --- linux-2.6.7-rc2/arch/arm/mach-integrator/core.c 2004-05-09 19:32:54.000000000 -0700 +++ linux-2.6.7-rc3/arch/arm/mach-integrator/core.c 2004-06-07 12:55:01.208547913 -0700 @@ -108,7 +108,7 @@ #define CM_CTRL IO_ADDRESS(INTEGRATOR_HDR_BASE) + INTEGRATOR_HDR_CTRL_OFFSET -static spinlock_t cm_lock; +static spinlock_t cm_lock = SPIN_LOCK_UNLOCKED; /** * cm_control - update the CM_CTRL register. diff -urN linux-2.6.7-rc2/arch/arm/mach-pxa/idp.c linux-2.6.7-rc3/arch/arm/mach-pxa/idp.c --- linux-2.6.7-rc2/arch/arm/mach-pxa/idp.c 2004-05-09 19:31:55.000000000 -0700 +++ linux-2.6.7-rc3/arch/arm/mach-pxa/idp.c 2004-06-07 12:55:01.228548741 -0700 @@ -27,6 +27,8 @@ #include #include +#include + #include "generic.h" #ifndef PXA_IDP_REV02 diff -urN linux-2.6.7-rc2/arch/arm/mach-pxa/leds-idp.c linux-2.6.7-rc3/arch/arm/mach-pxa/leds-idp.c --- linux-2.6.7-rc2/arch/arm/mach-pxa/leds-idp.c 2004-05-09 19:33:13.000000000 -0700 +++ linux-2.6.7-rc3/arch/arm/mach-pxa/leds-idp.c 2004-06-07 12:55:01.228548741 -0700 @@ -19,6 +19,8 @@ #include #include +#include + #include "leds.h" #define LED_STATE_ENABLED 1 diff -urN linux-2.6.7-rc2/arch/arm/mach-pxa/leds-lubbock.c linux-2.6.7-rc3/arch/arm/mach-pxa/leds-lubbock.c --- linux-2.6.7-rc2/arch/arm/mach-pxa/leds-lubbock.c 2004-06-07 12:54:48.268011964 -0700 +++ linux-2.6.7-rc3/arch/arm/mach-pxa/leds-lubbock.c 2004-06-07 12:55:01.228548741 -0700 @@ -17,6 +17,7 @@ #include #include #include +#include #include "leds.h" diff -urN linux-2.6.7-rc2/arch/arm/mach-pxa/leds-mainstone.c linux-2.6.7-rc3/arch/arm/mach-pxa/leds-mainstone.c --- linux-2.6.7-rc2/arch/arm/mach-pxa/leds-mainstone.c 2004-06-07 12:54:48.268011964 -0700 +++ linux-2.6.7-rc3/arch/arm/mach-pxa/leds-mainstone.c 2004-06-07 12:55:01.229548783 -0700 @@ -17,6 +17,8 @@ #include #include +#include + #include "leds.h" diff -urN linux-2.6.7-rc2/arch/arm/mach-pxa/lubbock.c linux-2.6.7-rc3/arch/arm/mach-pxa/lubbock.c --- linux-2.6.7-rc2/arch/arm/mach-pxa/lubbock.c 2004-06-07 12:54:48.269012006 -0700 +++ linux-2.6.7-rc3/arch/arm/mach-pxa/lubbock.c 2004-06-07 12:55:01.229548783 -0700 @@ -29,6 +29,7 @@ #include #include +#include #include #include #include diff -urN linux-2.6.7-rc2/arch/arm/mach-pxa/mainstone.c linux-2.6.7-rc3/arch/arm/mach-pxa/mainstone.c --- linux-2.6.7-rc2/arch/arm/mach-pxa/mainstone.c 2004-06-07 12:54:48.269012006 -0700 +++ linux-2.6.7-rc3/arch/arm/mach-pxa/mainstone.c 2004-06-07 12:55:01.230548824 -0700 @@ -30,6 +30,8 @@ #include #include +#include + #include "generic.h" diff -urN linux-2.6.7-rc2/arch/arm/mach-pxa/pm.c linux-2.6.7-rc3/arch/arm/mach-pxa/pm.c --- linux-2.6.7-rc2/arch/arm/mach-pxa/pm.c 2004-06-07 12:54:48.270012047 -0700 +++ linux-2.6.7-rc3/arch/arm/mach-pxa/pm.c 2004-06-07 12:55:01.230548824 -0700 @@ -19,6 +19,7 @@ #include #include #include +#include /* diff -urN linux-2.6.7-rc2/arch/arm/mach-pxa/pxa25x.c linux-2.6.7-rc3/arch/arm/mach-pxa/pxa25x.c --- linux-2.6.7-rc2/arch/arm/mach-pxa/pxa25x.c 2004-06-07 12:54:48.270012047 -0700 +++ linux-2.6.7-rc3/arch/arm/mach-pxa/pxa25x.c 2004-06-07 12:55:01.231548866 -0700 @@ -83,12 +83,21 @@ EXPORT_SYMBOL(get_clk_frequency_khz); /* - * Return the current lclk requency in units of 10kHz + * Return the current memory clock frequency in units of 10kHz */ -unsigned int get_lclk_frequency_10khz(void) +unsigned int get_memclk_frequency_10khz(void) { return L_clk_mult[(CCCR >> 0) & 0x1f] * BASE_CLK / 10000; } -EXPORT_SYMBOL(get_lclk_frequency_10khz); +EXPORT_SYMBOL(get_memclk_frequency_10khz); +/* + * Return the current LCD clock frequency in units of 10kHz + */ +unsigned int get_lcdclk_frequency_10khz(void) +{ + return get_memclk_frequency_10khz(); +} + +EXPORT_SYMBOL(get_lcdclk_frequency_10khz); diff -urN linux-2.6.7-rc2/arch/arm/mach-pxa/pxa27x.c linux-2.6.7-rc3/arch/arm/mach-pxa/pxa27x.c --- linux-2.6.7-rc2/arch/arm/mach-pxa/pxa27x.c 2004-06-07 12:54:48.270012047 -0700 +++ linux-2.6.7-rc3/arch/arm/mach-pxa/pxa27x.c 2004-06-07 12:55:01.231548866 -0700 @@ -21,100 +21,98 @@ #include "generic.h" -/* Crystal clock : 13-MHZ*/ +/* Crystal clock: 13MHz */ #define BASE_CLK 13000000 /* * Get the clock frequency as reflected by CCSR and the turbo flag. * We assume these values have been applied via a fcs. * If info is not 0 we also display the current settings. - * - * For more details, refer to Bulverde Manual, section 3.8.2.1 */ unsigned int get_clk_frequency_khz( int info) { - unsigned long ccsr, turbo, b, ht; - unsigned int l, L, m, M, n2, N, S, cccra; + unsigned long ccsr, clkcfg; + unsigned int l, L, m, M, n2, N, S; + int cccr_a, t, ht, b; ccsr = CCSR; - cccra = CCCR & (0x1 << 25); + cccr_a = CCCR & (1 << 25); /* Read clkcfg register: it has turbo, b, half-turbo (and f) */ - asm( "mrc\tp14, 0, %0, c6, c0, 0" : "=r" (turbo) ); - b = (turbo & (0x1 << 3)); - ht = (turbo & (0x1 << 2)); + asm( "mrc\tp14, 0, %0, c6, c0, 0" : "=r" (clkcfg) ); + t = clkcfg & (1 << 1); + ht = clkcfg & (1 << 2); + b = clkcfg & (1 << 3); l = ccsr & 0x1f; n2 = (ccsr>>7) & 0xf; - if (l == 31) { - /* The calculation from the Yellow Book is incorrect: - it says M=4 for L=21-30 (which is easy to calculate - by subtracting 1 and then dividing by 10, but not - with 31, so we'll do it manually */ - m = 1 << 2; - } else { - m = 1 << ((l-1)/10); - } + m = (l <= 10) ? 1 : (l <= 20) ? 2 : 4; - L = l * BASE_CLK; - N = (n2 * L) / 2; - S = (b) ? L : (L/2); - if (cccra == 0) - M = L/m; - else - M = (b) ? L : (L/2); + L = l * BASE_CLK; + N = (L * n2) / 2; + M = (!cccr_a) ? (L/m) : ((b) ? L : (L/2)); + S = (b) ? L : (L/2); if (info) { printk( KERN_INFO "Run Mode clock: %d.%02dMHz (*%d)\n", L / 1000000, (L % 1000000) / 10000, l ); - printk( KERN_INFO "Memory clock: %d.%02dMHz (/%d)\n", - M / 1000000, (M % 1000000) / 10000, m ); printk( KERN_INFO "Turbo Mode clock: %d.%02dMHz (*%d.%d, %sactive)\n", N / 1000000, (N % 1000000)/10000, n2 / 2, (n2 % 2)*5, - (turbo & 1) ? "" : "in" ); + (t) ? "" : "in" ); + printk( KERN_INFO "Memory clock: %d.%02dMHz (/%d)\n", + M / 1000000, (M % 1000000) / 10000, m ); printk( KERN_INFO "System bus clock: %d.%02dMHz \n", S / 1000000, (S % 1000000) / 10000 ); } - return (turbo & 1) ? (N/1000) : (L/1000); + return (t) ? (N/1000) : (L/1000); } /* * Return the current mem clock frequency in units of 10kHz as * reflected by CCCR[A], B, and L */ -unsigned int get_lclk_frequency_10khz(void) +unsigned int get_memclk_frequency_10khz(void) { - unsigned long ccsr, clkcfg, b; - unsigned int l, L, m, M, cccra; + unsigned long ccsr, clkcfg; + unsigned int l, L, m, M; + int cccr_a, b; - cccra = CCCR & (0x1 << 25); + ccsr = CCSR; + cccr_a = CCCR & (1 << 25); - /* Read clkcfg register to obtain b */ + /* Read clkcfg register: it has turbo, b, half-turbo (and f) */ asm( "mrc\tp14, 0, %0, c6, c0, 0" : "=r" (clkcfg) ); - b = (clkcfg & (0x1 << 3)); + b = clkcfg & (1 << 3); - ccsr = CCSR; - l = ccsr & 0x1f; - if (l == 31) { - /* The calculation from the Yellow Book is incorrect: - it says M=4 for L=21-30 (which is easy to calculate - by subtracting 1 and then dividing by 10, but not - with 31, so we'll do it manually */ - m = 1 << 2; - } else { - m = 1 << ((l-1)/10); - } + l = ccsr & 0x1f; + m = (l <= 10) ? 1 : (l <= 20) ? 2 : 4; L = l * BASE_CLK; - if (cccra == 0) - M = L/m; - else - M = (b) ? L : L/2; + M = (!cccr_a) ? (L/m) : ((b) ? L : (L/2)); return (M / 10000); } -EXPORT_SYMBOL(get_clk_frequency_khz); -EXPORT_SYMBOL(get_lclk_frequency_10khz); +/* + * Return the current LCD clock frequency in units of 10kHz as + */ +unsigned int get_lcdclk_frequency_10khz(void) +{ + unsigned long ccsr; + unsigned int l, L, k, K; + + ccsr = CCSR; + + l = ccsr & 0x1f; + k = (l <= 7) ? 1 : (l <= 16) ? 2 : 4; + L = l * BASE_CLK; + K = L / k; + + return (K / 10000); +} + +EXPORT_SYMBOL(get_clk_frequency_khz); +EXPORT_SYMBOL(get_memclk_frequency_10khz); +EXPORT_SYMBOL(get_lcdclk_frequency_10khz); diff -urN linux-2.6.7-rc2/arch/arm/mm/fault-armv.c linux-2.6.7-rc3/arch/arm/mm/fault-armv.c --- linux-2.6.7-rc2/arch/arm/mm/fault-armv.c 2004-06-07 12:54:48.275012254 -0700 +++ linux-2.6.7-rc3/arch/arm/mm/fault-armv.c 2004-06-07 12:55:01.236549073 -0700 @@ -8,6 +8,7 @@ * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ +#include #include #include #include @@ -75,7 +76,7 @@ return 0; } -void __flush_dcache_page(struct page *page) +static void __flush_dcache_page(struct page *page) { struct address_space *mapping = page_mapping(page); struct mm_struct *mm = current->active_mm; @@ -111,6 +112,17 @@ flush_dcache_mmap_unlock(mapping); } +void flush_dcache_page(struct page *page) +{ + struct address_space *mapping = page_mapping(page); + + if (mapping && !mapping_mapped(mapping)) + set_bit(PG_dcache_dirty, &page->flags); + else + __flush_dcache_page(page); +} +EXPORT_SYMBOL(flush_dcache_page); + static void make_coherent(struct vm_area_struct *vma, unsigned long addr, struct page *page, int dirty) { diff -urN linux-2.6.7-rc2/arch/arm/mm/fault.c linux-2.6.7-rc3/arch/arm/mm/fault.c --- linux-2.6.7-rc2/arch/arm/mm/fault.c 2004-05-09 19:32:39.000000000 -0700 +++ linux-2.6.7-rc3/arch/arm/mm/fault.c 2004-06-07 12:55:01.236549073 -0700 @@ -348,7 +348,7 @@ if (pmd_none(*pmd_k)) goto bad_area; - set_pmd(pmd, *pmd_k); + copy_pmd(pmd, pmd_k); return 0; bad_area: diff -urN linux-2.6.7-rc2/arch/arm/mm/init.c linux-2.6.7-rc3/arch/arm/mm/init.c --- linux-2.6.7-rc2/arch/arm/mm/init.c 2004-06-07 12:54:48.275012254 -0700 +++ linux-2.6.7-rc3/arch/arm/mm/init.c 2004-06-07 12:55:01.237549114 -0700 @@ -225,6 +225,8 @@ bootmem_pages += np[i].bootmap_pages; } + high_memory = __va(memend_pfn << PAGE_SHIFT); + /* * This doesn't seem to be used by the Linux memory * manager any more. If we can get rid of it, we @@ -232,7 +234,6 @@ */ max_low_pfn = memend_pfn - O_PFN_DOWN(PHYS_OFFSET); max_pfn = memend_pfn - O_PFN_DOWN(PHYS_OFFSET); - mi->end = memend_pfn << PAGE_SHIFT; return bootmem_pages; } @@ -280,6 +281,7 @@ static __init void reserve_node_zero(unsigned int bootmap_pfn, unsigned int bootmap_pages) { pg_data_t *pgdat = NODE_DATA(0); + unsigned long res_size = 0; /* * Register the kernel text and data with bootmem. @@ -303,31 +305,32 @@ bootmap_pages << PAGE_SHIFT); /* - * Hmm... This should go elsewhere, but we really really - * need to stop things allocating the low memory; we need - * a better implementation of GFP_DMA which does not assume - * that DMA-able memory starts at zero. + * Hmm... This should go elsewhere, but we really really need to + * stop things allocating the low memory; ideally we need a better + * implementation of GFP_DMA which does not assume that DMA-able + * memory starts at zero. */ - if (machine_is_integrator()) - reserve_bootmem_node(pgdat, 0, __pa(swapper_pg_dir)); + if (machine_is_integrator() || machine_is_cintegrator()) + res_size = __pa(swapper_pg_dir) - PHYS_OFFSET; + /* - * These should likewise go elsewhere. They pre-reserve - * the screen memory region at the start of main system - * memory. + * These should likewise go elsewhere. They pre-reserve the + * screen memory region at the start of main system memory. */ - if (machine_is_archimedes() || machine_is_a5k()) - reserve_bootmem_node(pgdat, 0x02000000, 0x00080000); if (machine_is_edb7211()) - reserve_bootmem_node(pgdat, 0xc0000000, 0x00020000); + res_size = 0x00020000; if (machine_is_p720t()) - reserve_bootmem_node(pgdat, PHYS_OFFSET, 0x00014000); + res_size = 0x00014000; + #ifdef CONFIG_SA1111 /* - * Because of the SA1111 DMA bug, we want to preserve - * our precious DMA-able memory... + * Because of the SA1111 DMA bug, we want to preserve our + * precious DMA-able memory... */ - reserve_bootmem_node(pgdat, PHYS_OFFSET, __pa(swapper_pg_dir)-PHYS_OFFSET); + res_size = __pa(swapper_pg_dir) - PHYS_OFFSET; #endif + if (res_size) + reserve_bootmem_node(pgdat, PHYS_OFFSET, res_size); } /* @@ -546,7 +549,6 @@ datapages = &_end - &_etext; initpages = &__init_end - &__init_begin; - high_memory = (void *)__va(meminfo.end); #ifndef CONFIG_DISCONTIGMEM max_mapnr = virt_to_page(high_memory) - mem_map; #endif @@ -601,7 +603,7 @@ void free_initmem(void) { - if (!machine_is_integrator()) { + if (!machine_is_integrator() && !machine_is_cintegrator()) { free_area((unsigned long)(&__init_begin), (unsigned long)(&__init_end), "init"); diff -urN linux-2.6.7-rc2/arch/arm/mm/mmap.c linux-2.6.7-rc3/arch/arm/mm/mmap.c --- linux-2.6.7-rc2/arch/arm/mm/mmap.c 2004-05-09 19:32:37.000000000 -0700 +++ linux-2.6.7-rc3/arch/arm/mm/mmap.c 2004-06-07 12:55:01.238549155 -0700 @@ -40,7 +40,7 @@ */ cache_type = read_cpuid(CPUID_CACHETYPE); if (cache_type != read_cpuid(CPUID_ID)) { - aliasing = (cache_type | cache_type >> 12) & (1 << 9); + aliasing = (cache_type | cache_type >> 12) & (1 << 11); if (aliasing) do_align = filp || flags & MAP_SHARED; } diff -urN linux-2.6.7-rc2/arch/arm/mm/proc-syms.c linux-2.6.7-rc3/arch/arm/mm/proc-syms.c --- linux-2.6.7-rc2/arch/arm/mm/proc-syms.c 2004-05-09 19:32:29.000000000 -0700 +++ linux-2.6.7-rc3/arch/arm/mm/proc-syms.c 2004-06-07 12:55:01.238549155 -0700 @@ -14,8 +14,6 @@ #include #include -EXPORT_SYMBOL(__flush_dcache_page); - #ifndef MULTI_CPU EXPORT_SYMBOL(cpu_dcache_clean_area); EXPORT_SYMBOL(cpu_set_pte); @@ -28,7 +26,6 @@ EXPORT_SYMBOL_NOVERS(__cpuc_flush_user_all); EXPORT_SYMBOL_NOVERS(__cpuc_flush_user_range); EXPORT_SYMBOL_NOVERS(__cpuc_coherent_kern_range); -EXPORT_SYMBOL_NOVERS(__cpuc_flush_dcache_page); #else EXPORT_SYMBOL(cpu_cache); #endif diff -urN linux-2.6.7-rc2/arch/arm/tools/mach-types linux-2.6.7-rc3/arch/arm/tools/mach-types --- linux-2.6.7-rc2/arch/arm/tools/mach-types 2004-05-09 19:32:29.000000000 -0700 +++ linux-2.6.7-rc3/arch/arm/tools/mach-types 2004-06-07 12:55:01.239549197 -0700 @@ -6,7 +6,7 @@ # To add an entry into this database, please see Documentation/arm/README, # or contact rmk@arm.linux.org.uk # -# Last update: Thu Apr 29 19:06:33 2004 +# Last update: Fri May 28 13:17:46 2004 # # machine_is_xxx CONFIG_xxxx MACH_TYPE_xxx number # @@ -509,7 +509,7 @@ smdk5500 MACH_SMDK5500 SMDK5500 499 signalsync MACH_SIGNALSYNC SIGNALSYNC 500 nbc MACH_NBC NBC 501 -er4525 MACH_ER4525 ER4525 502 +kodiak MACH_KODIAK KODIAK 502 netbookpro MACH_NETBOOKPRO NETBOOKPRO 503 hw90200 MACH_HW90200 HW90200 504 condor MACH_CONDOR CONDOR 505 @@ -533,3 +533,16 @@ tidsc25 MACH_TIDSC25 TIDSC25 523 akcpmxl MACH_AKCPMXL AKCPMXL 524 av3xx MACH_AV3XX AV3XX 525 +avila MACH_AVILA AVILA 526 +pxa_mpm10 MACH_PXA_MPM10 PXA_MPM10 527 +pxa_kyanite MACH_PXA_KYANITE PXA_KYANITE 528 +sgold MACH_SGOLD SGOLD 529 +oscar MACH_OSCAR OSCAR 530 +epxa4usb2 MACH_EPXA4USB2 EPXA4USB2 531 +xsengine MACH_XSENGINE XSENGINE 532 +ip600 MACH_IP600 IP600 533 +mcan2 MACH_MCAN2 MCAN2 534 +ddi_blueridge MACH_DDI_BLUERIDGE DDI_BLUERIDGE 535 +skyminder MACH_SKYMINDER SKYMINDER 536 +lpd79520 MACH_LPD79520 LPD79520 537 +edb9302 MACH_EDB9302 EDB9302 538 diff -urN linux-2.6.7-rc2/arch/cris/Kconfig linux-2.6.7-rc3/arch/cris/Kconfig --- linux-2.6.7-rc2/arch/cris/Kconfig 2004-05-09 19:33:19.000000000 -0700 +++ linux-2.6.7-rc3/arch/cris/Kconfig 2004-06-07 12:55:01.240549238 -0700 @@ -27,19 +27,11 @@ source "fs/Kconfig.binfmt" -config ETRAX_KGDB - bool "Use kernel gdb debugger" - ---help--- - The CRIS version of gdb can be used to remotely debug a running - Linux kernel via the serial debug port. Provided you have gdb-cris - installed, run gdb-cris vmlinux, then type - - (gdb) set remotebaud 115200 <- kgdb uses 115200 as default - (gdb) target remote /dev/ttyS0 <- maybe you use another port - - This should connect you to your booted kernel (or boot it now if you - didn't before). The kernel halts when it boots, waiting for gdb if - this option is turned on! +config ETRAX_CMDLINE + string "Kernel command line" + default "root=/dev/mtdblock3" + help + Pass additional commands to the kernel. config ETRAX_WATCHDOG bool "Enable ETRAX watchdog" @@ -99,11 +91,6 @@ help Support the xsim ETRAX Simulator. -config ETRAX200LX - bool "ETRAX-200LX-V32" - help - Support CRIS V32. - endchoice config ETRAX_ARCH_V10 @@ -111,11 +98,6 @@ default y if ETRAX100LX || ETRAX100LX_V2 default n if !(ETRAX100LX || ETRAX100LX_V2) -config ETRAX_ARCH_V32 - bool - default y if ETRAX200LX - default n if !(ETRAX200LX) - config ETRAX_DRAM_SIZE int "DRAM size (dec, in MB)" default "8" @@ -128,35 +110,18 @@ help Width in bytes of the Flash bus (1, 2 or 4). Is usually 2. -config ETRAX_ROOT_DEVICE - string "Root device name" - default "/dev/mtdblock3" - help - Specifies the device that should be mounted as root file system - when booting from flash. The axisflashmap driver adds an additional - mtd partition for the appended root file system image, so this option - should normally be the mtdblock device for the partition after the - last partition in the partition table. - -# duplicate choice configs are not yet supported, so the followinguse -# doesn't work: - source arch/cris/arch-v10/Kconfig endmenu # bring in ETRAX built-in drivers menu "Drivers for built-in interfaces" - source arch/cris/arch-v10/drivers/Kconfig endmenu source "drivers/base/Kconfig" -# bring in Etrax built-in drivers -source "arch/cris/drivers/Kconfig" - # standard linux drivers source "drivers/mtd/Kconfig" @@ -212,6 +177,37 @@ depends on PROFILE default "2" +config ETRAX_KGDB + bool "Use kernel GDB debugger" + ---help--- + The CRIS version of gdb can be used to remotely debug a running + Linux kernel via the serial debug port. Provided you have gdb-cris + installed, run gdb-cris vmlinux, then type + + (gdb) set remotebaud 115200 <- kgdb uses 115200 as default + (gdb) target remote /dev/ttyS0 <- maybe you use another port + + This should connect you to your booted kernel (or boot it now if you + didn't before). The kernel halts when it boots, waiting for gdb if + this option is turned on! + + +config DEBUG_INFO + bool "Compile the kernel with debug info" + help + If you say Y here the resulting kernel image will include + debugging info resulting in a larger kernel image. + Say Y here only if you plan to use gdb to debug the kernel. + If you don't debug the kernel, you can say N. + +config FRAME_POINTER + bool "Compile the kernel with frame pointers" + help + If you say Y here the resulting kernel image will be slightly larger + and slower, but it will give very useful debugging information. + If you don't debug the kernel, you can say N, but we may not be able + to solve problems without frame pointers. + endmenu source "security/Kconfig" diff -urN linux-2.6.7-rc2/arch/cris/Makefile linux-2.6.7-rc3/arch/cris/Makefile --- linux-2.6.7-rc2/arch/cris/Makefile 2004-06-07 12:54:48.278012378 -0700 +++ linux-2.6.7-rc3/arch/cris/Makefile 2004-06-07 12:55:01.241549280 -0700 @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.15 2003/07/04 12:47:53 tobiasa Exp $ +# $Id: Makefile,v 1.20 2004/05/14 14:35:58 orjanf Exp $ # cris/Makefile # # This file is included by the global makefile so that you can add your own @@ -34,7 +34,7 @@ CFLAGS := $(CFLAGS) -mlinux -march=$(arch-y) -pipe -ifdef CONFIG_ETRAX_KGDB +ifdef CONFIG_FRAME_POINTER CFLAGS := $(subst -fomit-frame-pointer,,$(CFLAGS)) -g CFLAGS += -fno-omit-frame-pointer endif @@ -90,10 +90,14 @@ # Create some links to make all tools happy arch/$(ARCH)/.links: + @rm -rf arch/$(ARCH)/drivers @ln -sfn $(SARCH)/drivers arch/$(ARCH)/drivers + @rm -rf arch/$(ARCH)/boot @ln -sfn $(SARCH)/boot arch/$(ARCH)/boot + @rm -rf arch/$(ARCH)/lib @ln -sfn $(SARCH)/lib arch/$(ARCH)/lib - @ln -sfn $(SARCH)/vmlinux.lds.S arch/$(ARCH)/kernel/vmlinux.lds.S + @ln -sfn $(SARCH) arch/$(ARCH)/arch + @ln -sfn ../$(SARCH)/vmlinux.lds.S arch/$(ARCH)/kernel/vmlinux.lds.S @touch $@ # Create link to sub arch includes diff -urN linux-2.6.7-rc2/arch/cris/arch-v10/boot/compressed/misc.c linux-2.6.7-rc3/arch/cris/arch-v10/boot/compressed/misc.c --- linux-2.6.7-rc2/arch/cris/arch-v10/boot/compressed/misc.c 2004-05-09 19:33:13.000000000 -0700 +++ linux-2.6.7-rc3/arch/cris/arch-v10/boot/compressed/misc.c 2004-06-07 12:55:01.241549280 -0700 @@ -1,7 +1,7 @@ /* * misc.c * - * $Id: misc.c,v 1.4 2003/04/09 05:20:45 starvik Exp $ + * $Id: misc.c,v 1.6 2003/10/27 08:04:31 starvik Exp $ * * This is a collection of several routines from gzip-1.0.3 * adapted for Linux. @@ -263,7 +263,7 @@ __asm__ volatile ("move vr,%0" : "=rm" (revision)); if (revision < 10) { - puts("You need an ETRAX 100LX to run linux 2.4\n"); + puts("You need an ETRAX 100LX to run linux 2.6\n"); while(1); } diff -urN linux-2.6.7-rc2/arch/cris/arch-v10/defconfig linux-2.6.7-rc3/arch/cris/arch-v10/defconfig --- linux-2.6.7-rc2/arch/cris/arch-v10/defconfig 2004-05-09 19:32:26.000000000 -0700 +++ linux-2.6.7-rc3/arch/cris/arch-v10/defconfig 2004-06-07 12:55:01.241549280 -0700 @@ -267,6 +267,7 @@ # CONFIG_BLK_DEV_ISAPNP is not set # CONFIG_IDE_CHIPSETS is not set # CONFIG_IDEDMA_AUTO is not set +# CONFIG_BLK_DEV_IDE_MODES is not set # # SCSI support diff -urN linux-2.6.7-rc2/arch/cris/arch-v10/drivers/Kconfig linux-2.6.7-rc3/arch/cris/arch-v10/drivers/Kconfig --- linux-2.6.7-rc2/arch/cris/arch-v10/drivers/Kconfig 2004-05-09 19:32:25.000000000 -0700 +++ linux-2.6.7-rc3/arch/cris/arch-v10/drivers/Kconfig 2004-06-07 12:55:01.242549321 -0700 @@ -11,29 +11,6 @@ bool depends on ETRAX_ETHERNET default y - ---help--- - Ethernet (also called IEEE 802.3 or ISO 8802-2) is the most common - type of Local Area Network (LAN) in universities and companies. - - Common varieties of Ethernet are: 10BASE-2 or Thinnet (10 Mbps over - coaxial cable, linking computers in a chain), 10BASE-T or twisted - pair (10 Mbps over twisted pair cable, linking computers to central - hubs), 10BASE-F (10 Mbps over optical fiber links, using hubs), - 100BASE-TX (100 Mbps over two twisted pair cables, using hubs), - 100BASE-T4 (100 Mbps over 4 standard voice-grade twisted pair - cables, using hubs), 100BASE-FX (100 Mbps over optical fiber links) - [the 100BASE varieties are also known as Fast Ethernet], and Gigabit - Ethernet (1 Gbps over optical fiber or short copper links). - - If your Linux machine will be connected to an Ethernet and you have - an Ethernet network interface card (NIC) installed in your computer, - say Y here and read the Ethernet-HOWTO, available from - . You will then also have - to say Y to the driver for your particular NIC. - - Note that the answer to this question won't directly affect the - kernel: saying N will just cause the configurator to skip all - the questions about Ethernet network cards. If unsure, say N. choice prompt "Network LED behavior" @@ -110,6 +87,32 @@ the same DMA channels. choice + prompt "Ser0 DMA out assignment" + depends on ETRAX_SERIAL_PORT0 + default ETRAX_SERIAL_PORT0_DMA6_OUT + +config CONFIG_ETRAX_SERIAL_PORT0_NO_DMA_OUT + bool "No DMA out" + +config CONFIG_ETRAX_SERIAL_PORT0_DMA6_OUT + bool "DMA 6" + +endchoice + +choice + prompt "Ser0 DMA in assignment" + depends on ETRAX_SERIAL_PORT0 + default ETRAX_SERIAL_PORT0_DMA7_IN + +config CONFIG_ETRAX_SERIAL_PORT0_NO_DMA_IN + bool "No DMA in" + +config CONFIG_ETRAX_SERIAL_PORT0_DMA7_IN + bool "DMA 7" + +endchoice + +choice prompt "Ser0 DTR, RI, DSR and CD assignment" depends on ETRAX_SERIAL_PORT0 default ETRAX_SER0_DTR_RI_DSR_CD_ON_NONE @@ -198,6 +201,32 @@ Enables the ETRAX 100 serial driver for ser1 (ttyS1). choice + prompt "Ser1 DMA out assignment" + depends on ETRAX_SERIAL_PORT1 + default ETRAX_SERIAL_PORT1_DMA8_OUT + +config CONFIG_ETRAX_SERIAL_PORT1_NO_DMA_OUT + bool "No DMA out" + +config CONFIG_ETRAX_SERIAL_PORT1_DMA8_OUT + bool "DMA 8" + +endchoice + +choice + prompt "Ser1 DMA in assignment" + depends on ETRAX_SERIAL_PORT1 + default ETRAX_SERIAL_PORT1_DMA9_IN + +config CONFIG_ETRAX_SERIAL_PORT1_NO_DMA_IN + bool "No DMA in" + +config CONFIG_ETRAX_SERIAL_PORT1_DMA9_IN + bool "DMA 9" + +endchoice + +choice prompt "Ser1 DTR, RI, DSR and CD assignment" depends on ETRAX_SERIAL_PORT1 default ETRAX_SER1_DTR_RI_DSR_CD_ON_NONE @@ -289,6 +318,32 @@ Enables the ETRAX 100 serial driver for ser2 (ttyS2). choice + prompt "Ser2 DMA out assignment" + depends on ETRAX_SERIAL_PORT2 + default ETRAX_SERIAL_PORT2_DMA2_OUT + +config CONFIG_ETRAX_SERIAL_PORT2_NO_DMA_OUT + bool "No DMA out" + +config CONFIG_ETRAX_SERIAL_PORT2_DMA2_OUT + bool "DMA 2" + +endchoice + +choice + prompt "Ser2 DMA in assignment" + depends on ETRAX_SERIAL_PORT2 + default ETRAX_SERIAL_PORT2_DMA3_IN + +config CONFIG_ETRAX_SERIAL_PORT2_NO_DMA_IN + bool "No DMA in" + +config CONFIG_ETRAX_SERIAL_PORT2_DMA3_IN + bool "DMA 3" + +endchoice + +choice prompt "Ser2 DTR, RI, DSR and CD assignment" depends on ETRAX_SERIAL_PORT2 default ETRAX_SER2_DTR_RI_DSR_CD_ON_NONE @@ -377,6 +432,32 @@ Enables the ETRAX 100 serial driver for ser3 (ttyS3). choice + prompt "Ser3 DMA out assignment" + depends on ETRAX_SERIAL_PORT3 + default ETRAX_SERIAL_PORT3_DMA4_OUT + +config CONFIG_ETRAX_SERIAL_PORT3_NO_DMA_OUT + bool "No DMA out" + +config CONFIG_ETRAX_SERIAL_PORT3_DMA4_OUT + bool "DMA 4" + +endchoice + +choice + prompt "Ser3 DMA in assignment" + depends on ETRAX_SERIAL_PORT3 + default ETRAX_SERIAL_PORT3_DMA5_IN + +config CONFIG_ETRAX_SERIAL_PORT3_NO_DMA_IN + bool "No DMA in" + +config CONFIG_ETRAX_SERIAL_PORT3_DMA5_IN + bool "DMA 5" + +endchoice + +choice prompt "Ser3 DTR, RI, DSR and CD assignment" depends on ETRAX_SERIAL_PORT3 default ETRAX_SER3_DTR_RI_DSR_CD_ON_NONE @@ -466,6 +547,95 @@ loopback. Not all products are able to do this in software only. Axis 2400/2401 must disable receiver. +config ETRAX_IDE + bool "ATA/IDE support" + help + Enable this to get support for ATA/IDE. + You can't use parallell ports or SCSI ports + at the same time. + +# here we should add the CONFIG_'s necessary to enable the basic +# general ide drivers so the common case does not need to go +# into that config submenu. enable disk and CD support. others +# need to go fiddle in the submenu.. +config IDE + tristate + depends on ETRAX_IDE + default y + +config BLK_DEV_IDE + tristate + depends on ETRAX_IDE + default y + +config BLK_DEV_IDEDISK + tristate + depends on ETRAX_IDE + default y + +config BLK_DEV_IDECD + tristate + depends on ETRAX_IDE + default y + +config BLK_DEV_IDEDMA + bool + depends on ETRAX_IDE + default y + +config DMA_NONPCI + bool + depends on ETRAX_IDE + default y + +config ETRAX_IDE_DELAY + int "Delay for drives to regain consciousness" + depends on ETRAX_IDE + default 15 + help + Number of seconds to wait for IDE drives to spin up after an IDE + reset. +choice + prompt "IDE reset pin" + depends on ETRAX_IDE + default ETRAX_IDE_PB7_RESET + +config ETRAX_IDE_PB7_RESET + bool "Port_PB_Bit_7" + help + IDE reset on pin 7 on port B + +config ETRAX_IDE_G27_RESET + bool "Port_G_Bit_27" + help + IDE reset on pin 27 on port G + +endchoice + + +config ETRAX_USB_HOST + bool "USB host" + help + This option enables the host functionality of the ETRAX 100LX + built-in USB controller. In host mode the controller is designed + for CTRL and BULK traffic only, INTR traffic may work as well + however (depending on the requirements of timeliness). + +config USB + tristate + depends on ETRAX_USB_HOST + default y + +config ETRAX_USB_HOST_PORT1 + bool " USB port 1 enabled" + depends on ETRAX_USB_HOST + default n + +config ETRAX_USB_HOST_PORT2 + bool " USB port 2 enabled" + depends on ETRAX_USB_HOST + default n + config ETRAX_AXISFLASHMAP bool "Axis flash-map support" depends on ETRAX_ARCH_V10 diff -urN linux-2.6.7-rc2/arch/cris/arch-v10/drivers/Makefile linux-2.6.7-rc3/arch/cris/arch-v10/drivers/Makefile --- linux-2.6.7-rc2/arch/cris/arch-v10/drivers/Makefile 2004-05-09 19:31:56.000000000 -0700 +++ linux-2.6.7-rc3/arch/cris/arch-v10/drivers/Makefile 2004-06-07 12:55:01.243549363 -0700 @@ -10,5 +10,7 @@ obj-$(CONFIG_ETRAX_GPIO) += gpio.o obj-$(CONFIG_ETRAX_DS1302) += ds1302.o obj-$(CONFIG_ETRAX_PCF8563) += pcf8563.o +obj-$(CONFIG_ETRAX_IDE) += ide.o +obj-$(CONFIG_ETRAX_USB_HOST) += usb-host.o diff -urN linux-2.6.7-rc2/arch/cris/arch-v10/drivers/axisflashmap.c linux-2.6.7-rc3/arch/cris/arch-v10/drivers/axisflashmap.c --- linux-2.6.7-rc2/arch/cris/arch-v10/drivers/axisflashmap.c 2004-05-09 19:33:10.000000000 -0700 +++ linux-2.6.7-rc3/arch/cris/arch-v10/drivers/axisflashmap.c 2004-06-07 12:55:01.243549363 -0700 @@ -11,6 +11,9 @@ * partition split defined below. * * $Log: axisflashmap.c,v $ + * Revision 1.8 2004/05/14 07:58:03 starvik + * Merge of changes from 2.4 + * * Revision 1.6 2003/07/04 08:27:37 starvik * Merge of Linux 2.5.74 * @@ -153,6 +156,9 @@ /* From head.S */ extern unsigned long romfs_start, romfs_length, romfs_in_flash; +/* The master mtd for the entire flash. */ +struct mtd_info* axisflash_mtd = NULL; + /* Map driver functions. */ static __u8 flash_read8(struct map_info *map, unsigned long ofs) @@ -314,7 +320,8 @@ { struct mtd_info *mtd_cs = NULL; - printk("%s: Probing a 0x%08lx bytes large window at 0x%08lx.\n", + printk(KERN_INFO + "%s: Probing a 0x%08lx bytes large window at 0x%08lx.\n", map_cs->name, map_cs->size, map_cs->map_priv_1); #ifdef CONFIG_MTD_AMDSTD @@ -398,7 +405,7 @@ struct mtd_info *mymtd; int err = 0; int pidx = 0; - struct partitiontable_head *ptable_head; + struct partitiontable_head *ptable_head = NULL; struct partitiontable_entry *ptable; int use_default_ptable = 1; /* Until proven otherwise. */ const char *pmsg = " /dev/flash%d at 0x%08x, size 0x%08x\n"; @@ -407,19 +414,22 @@ /* There's no reason to use this module if no flash chip can * be identified. Make sure that's understood. */ - panic("axisflashmap found no flash chip!\n"); + printk(KERN_INFO "axisflashmap: Found no flash chip.\n"); + } else { + printk(KERN_INFO "%s: 0x%08x bytes of flash memory.\n", + mymtd->name, mymtd->size); + axisflash_mtd = mymtd; } - printk("%s: 0x%08x bytes of flash memory.\n", - mymtd->name, mymtd->size); - - mymtd->owner = THIS_MODULE; - - ptable_head = (struct partitiontable_head *)(FLASH_CACHED_ADDR + - CONFIG_ETRAX_PTABLE_SECTOR + PARTITION_TABLE_OFFSET); + if (mymtd) { + mymtd->owner = THIS_MODULE; + ptable_head = (struct partitiontable_head *)(FLASH_CACHED_ADDR + + CONFIG_ETRAX_PTABLE_SECTOR + + PARTITION_TABLE_OFFSET); + } pidx++; /* First partition is always set to the default. */ - if ((ptable_head->magic == PARTITION_TABLE_MAGIC) + if (ptable_head && (ptable_head->magic == PARTITION_TABLE_MAGIC) && (ptable_head->size < (MAX_PARTITIONS * sizeof(struct partitiontable_entry) + PARTITIONTABLE_END_MARKER_SIZE)) @@ -454,7 +464,7 @@ ptable_ok = (csum == ptable_head->checksum); /* Read the entries and use/show the info. */ - printk(" Found a%s partition table at 0x%p-0x%p.\n", + printk(KERN_INFO " Found a%s partition table at 0x%p-0x%p.\n", (ptable_ok ? " valid" : "n invalid"), ptable_head, max_addr); @@ -486,22 +496,25 @@ axis_partitions[pidx].offset = romfs_start - FLASH_CACHED_ADDR; axis_partitions[pidx].mask_flags |= MTD_WRITEABLE; - printk(" Adding readonly flash partition for romfs image:\n"); + printk(KERN_INFO + " Adding readonly flash partition for romfs image:\n"); printk(pmsg, pidx, axis_partitions[pidx].offset, axis_partitions[pidx].size); pidx++; } - if (use_default_ptable) { - printk(" Using default partition table.\n"); - err = add_mtd_partitions(mymtd, axis_default_partitions, - NUM_DEFAULT_PARTITIONS); - } else { - err = add_mtd_partitions(mymtd, axis_partitions, pidx); - } + if (mymtd) { + if (use_default_ptable) { + printk(KERN_INFO " Using default partition table.\n"); + err = add_mtd_partitions(mymtd, axis_default_partitions, + NUM_DEFAULT_PARTITIONS); + } else { + err = add_mtd_partitions(mymtd, axis_partitions, pidx); + } - if (err) { - panic("axisflashmap could not add MTD partitions!\n"); + if (err) { + panic("axisflashmap could not add MTD partitions!\n"); + } } if (!romfs_in_flash) { @@ -522,7 +535,7 @@ "mtd_info!\n"); } - printk(" Adding RAM partition for romfs image:\n"); + printk(KERN_INFO " Adding RAM partition for romfs image:\n"); printk(pmsg, pidx, romfs_start, romfs_length); err = mtdram_init_device(mtd_ram, (void*)romfs_start, @@ -539,3 +552,5 @@ /* This adds the above to the kernels init-call chain. */ module_init(init_axis_flash); + +EXPORT_SYMBOL(axisflash_mtd); diff -urN linux-2.6.7-rc2/arch/cris/arch-v10/drivers/ds1302.c linux-2.6.7-rc3/arch/cris/arch-v10/drivers/ds1302.c --- linux-2.6.7-rc2/arch/cris/arch-v10/drivers/ds1302.c 2004-05-09 19:33:19.000000000 -0700 +++ linux-2.6.7-rc3/arch/cris/arch-v10/drivers/ds1302.c 2004-06-07 12:55:01.244549404 -0700 @@ -4,9 +4,18 @@ *! *! DESCRIPTION: Implements an interface for the DS1302 RTC through Etrax I/O *! -*! Functions exported: ds1302_readreg, ds1302_writereg, ds1302_init, get_rtc_status +*! Functions exported: ds1302_readreg, ds1302_writereg, ds1302_init *! *! $Log: ds1302.c,v $ +*! Revision 1.13 2004/05/28 09:26:59 starvik +*! Modified I2C initialization to work in 2.6. +*! +*! Revision 1.12 2004/05/14 07:58:03 starvik +*! Merge of changes from 2.4 +*! +*! Revision 1.10 2004/02/04 09:25:12 starvik +*! Merge of Linux 2.6.2 +*! *! Revision 1.9 2003/07/04 08:27:37 starvik *! Merge of Linux 2.5.74 *! @@ -114,7 +123,7 @@ *! *! (C) Copyright 1999, 2000, 2001 Axis Communications AB, LUND, SWEDEN *! -*! $Id: ds1302.c,v 1.9 2003/07/04 08:27:37 starvik Exp $ +*! $Id: ds1302.c,v 1.13 2004/05/28 09:26:59 starvik Exp $ *! *!***************************************************************************/ @@ -283,12 +292,23 @@ void ds1302_writereg(int reg, unsigned char val) { - ds1302_wenable(); - start(); - out_byte(0x80 | (reg << 1)); /* write register */ - out_byte(val); - stop(); - ds1302_wdisable(); +#ifndef CONFIG_ETRAX_RTC_READONLY + int do_writereg = 1; +#else + int do_writereg = 0; + + if (reg == RTC_TRICKLECHARGER) + do_writereg = 1; +#endif + + if (do_writereg) { + ds1302_wenable(); + start(); + out_byte(0x80 | (reg << 1)); /* write register */ + out_byte(val); + stop(); + ds1302_wdisable(); + } } void @@ -426,20 +446,33 @@ tcs_val = RTC_TCR_PATTERN | (tcs_val & 0x0F); ds1302_writereg(RTC_TRICKLECHARGER, tcs_val); return 0; - } + } + case RTC_VLOW_RD: + { + /* TODO: + * Implement voltage low detection support + */ + printk(KERN_WARNING "DS1302: RTC Voltage Low detection" + " is not supported\n"); + return 0; + } + case RTC_VLOW_SET: + { + /* TODO: + * Nothing to do since Voltage Low detection is not supported + */ + return 0; + } default: return -ENOIOCTLCMD; } } -int -get_rtc_status(char *buf) +static void +print_rtc_status(void) { - char *p; struct rtc_time tm; - p = buf; - get_rtc_time(&tm); /* @@ -447,16 +480,12 @@ * time or for Universal Standard Time (GMT). Probably local though. */ - p += sprintf(p, - "rtc_time\t: %02d:%02d:%02d\n" - "rtc_date\t: %04d-%02d-%02d\n", - tm.tm_hour, tm.tm_min, tm.tm_sec, - tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday); - - return p - buf; + printk(KERN_INFO "rtc_time\t: %02d:%02d:%02d\n", + tm.tm_hour, tm.tm_min, tm.tm_sec); + printk(KERN_INFO "rtc_date\t: %04d-%02d-%02d\n", + tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday); } - /* The various file operations we support. */ static struct file_operations rtc_fops = { @@ -487,11 +516,10 @@ out_byte(0xc1); /* read RAM byte 0 */ if((res = in_byte()) == MAGIC_PATTERN) { - char buf[100]; stop(); ds1302_wdisable(); - printk("%s: RTC found.\n", ds1302_name); - printk("%s: SDA, SCL, RST on PB%i, PB%i, %s%i\n", + printk(KERN_INFO "%s: RTC found.\n", ds1302_name); + printk(KERN_INFO "%s: SDA, SCL, RST on PB%i, PB%i, %s%i\n", ds1302_name, CONFIG_ETRAX_DS1302_SDABIT, CONFIG_ETRAX_DS1302_SCLBIT, @@ -501,12 +529,10 @@ "PB", #endif CONFIG_ETRAX_DS1302_RSTBIT); - get_rtc_status(buf); - printk(buf); + print_rtc_status(); retval = 1; } else { stop(); - printk("%s: RTC not found.\n", ds1302_name); retval = 0; } @@ -518,7 +544,9 @@ int __init ds1302_init(void) -{ +{ + i2c_init(); + if (!ds1302_probe()) { #ifdef CONFIG_ETRAX_DS1302_RST_ON_GENERIC_PORT #if CONFIG_ETRAX_DS1302_RSTBIT == 27 @@ -539,16 +567,20 @@ (IO_STATE(R_GEN_CONFIG, g0dir, out))); *R_GEN_CONFIG = genconfig_shadow; #endif - if (!ds1302_probe()) + if (!ds1302_probe()) { + printk(KERN_WARNING "%s: RTC not found.\n", ds1302_name); return -1; + } #else + printk(KERN_WARNING "%s: RTC not found.\n", ds1302_name); return -1; #endif } - /* Initialise trickle charger */ ds1302_writereg(RTC_TRICKLECHARGER, RTC_TCR_PATTERN |(CONFIG_ETRAX_DS1302_TRICKLE_CHARGE & 0x0F)); + /* Start clock by resetting CLOCK_HALT */ + ds1302_writereg(RTC_SECONDS, (ds1302_readreg(RTC_SECONDS) & 0x7F)); return 0; } diff -urN linux-2.6.7-rc2/arch/cris/arch-v10/drivers/eeprom.c linux-2.6.7-rc3/arch/cris/arch-v10/drivers/eeprom.c --- linux-2.6.7-rc2/arch/cris/arch-v10/drivers/eeprom.c 2004-05-09 19:32:28.000000000 -0700 +++ linux-2.6.7-rc3/arch/cris/arch-v10/drivers/eeprom.c 2004-06-07 12:55:01.245549445 -0700 @@ -20,6 +20,9 @@ *! in the spin-lock. *! *! $Log: eeprom.c,v $ +*! Revision 1.10 2003/09/11 07:29:48 starvik +*! Merge of Linux 2.6.0-test5 +*! *! Revision 1.9 2003/07/04 08:27:37 starvik *! Merge of Linux 2.5.74 *! @@ -441,9 +444,9 @@ static int eeprom_open(struct inode * inode, struct file * file) { - if(iminor(inode) != EEPROM_MINOR_NR) + if(MINOR(inode->i_rdev) != EEPROM_MINOR_NR) return -ENXIO; - if(imajor(inode) != EEPROM_MAJOR_NR) + if(MAJOR(inode->i_rdev) != EEPROM_MAJOR_NR) return -ENXIO; if( eeprom.size > 0 ) diff -urN linux-2.6.7-rc2/arch/cris/arch-v10/drivers/ethernet.c linux-2.6.7-rc3/arch/cris/arch-v10/drivers/ethernet.c --- linux-2.6.7-rc2/arch/cris/arch-v10/drivers/ethernet.c 2004-05-09 19:32:29.000000000 -0700 +++ linux-2.6.7-rc3/arch/cris/arch-v10/drivers/ethernet.c 2004-06-07 12:55:01.247549528 -0700 @@ -1,4 +1,4 @@ -/* $Id: ethernet.c,v 1.17 2003/07/04 08:27:37 starvik Exp $ +/* $Id: ethernet.c,v 1.22 2004/05/14 07:58:03 starvik Exp $ * * e100net.c: A network driver for the ETRAX 100LX network controller. * @@ -7,6 +7,15 @@ * The outline of this driver comes from skeleton.c. * * $Log: ethernet.c,v $ + * Revision 1.22 2004/05/14 07:58:03 starvik + * Merge of changes from 2.4 + * + * Revision 1.20 2004/03/11 11:38:40 starvik + * Merge of Linux 2.6.4 + * + * Revision 1.18 2003/12/03 13:45:46 starvik + * Use hardware pad for short packets to prevent information leakage. + * * Revision 1.17 2003/07/04 08:27:37 starvik * Merge of Linux 2.5.74 * @@ -258,6 +267,16 @@ struct sk_buff* skb; } etrax_eth_descr; +/* Some transceivers requires special handling */ +struct transceiver_ops +{ + unsigned int oui; + void (*check_speed)(void); + void (*check_duplex)(void); +}; + +struct transceiver_ops* transceiver; + /* Duplex settings */ enum duplex { @@ -278,10 +297,17 @@ */ #define MDIO_BASE_STATUS_REG 0x1 #define MDIO_BASE_CONTROL_REG 0x0 +#define MDIO_PHY_ID_HIGH_REG 0x2 +#define MDIO_PHY_ID_LOW_REG 0x3 #define MDIO_BC_NEGOTIATE 0x0200 #define MDIO_BC_FULL_DUPLEX_MASK 0x0100 #define MDIO_BC_AUTO_NEG_MASK 0x1000 #define MDIO_BC_SPEED_SELECT_MASK 0x2000 +#define MDIO_STATUS_100_FD 0x4000 +#define MDIO_STATUS_100_HD 0x2000 +#define MDIO_STATUS_10_FD 0x1000 +#define MDIO_STATUS_10_HD 0x0800 +#define MDIO_STATUS_SPEED_DUPLEX_MASK 0x7800 #define MDIO_ADVERTISMENT_REG 0x4 #define MDIO_ADVERT_100_FD 0x100 #define MDIO_ADVERT_100_HD 0x080 @@ -295,9 +321,13 @@ /* Broadcom specific */ #define MDIO_AUX_CTRL_STATUS_REG 0x18 -#define MDIO_FULL_DUPLEX_IND 0x1 -#define MDIO_SPEED 0x2 -#define MDIO_PHYS_ADDR 0x0 +#define MDIO_BC_FULL_DUPLEX_IND 0x1 +#define MDIO_BC_SPEED 0x2 + +/* TDK specific */ +#define MDIO_TDK_DIAGNOSTIC_REG 18 +#define MDIO_TDK_DIAGNOSTIC_RATE 0x400 +#define MDIO_TDK_DIAGNOSTIC_DPLX 0x800 /* Network flash constants */ #define NET_FLASH_TIME (HZ/50) /* 20 ms */ @@ -341,6 +371,9 @@ static etrax_eth_descr TxDescList[NBR_OF_TX_DESC] __attribute__ ((aligned(32))); static unsigned int network_rec_config_shadow = 0; +static unsigned int mdio_phy_addr; /* Transciever address */ + +static unsigned int network_tr_ctrl_shadow = 0; /* Network speed indication. */ static struct timer_list speed_timer = TIMER_INITIALIZER(NULL, 0, 0); @@ -376,6 +409,7 @@ static void e100_hardware_send_packet(char *buf, int length); static void update_rx_stats(struct net_device_stats *); static void update_tx_stats(struct net_device_stats *); +static int e100_probe_transceiver(void); static void e100_check_speed(unsigned long dummy); static void e100_set_speed(unsigned long speed); @@ -393,6 +427,21 @@ static void e100_clear_network_leds(unsigned long dummy); static void e100_set_network_leds(int active); +static void broadcom_check_speed(void); +static void broadcom_check_duplex(void); +static void tdk_check_speed(void); +static void tdk_check_duplex(void); +static void generic_check_speed(void); +static void generic_check_duplex(void); + +struct transceiver_ops transceivers[] = +{ + {0x1018, broadcom_check_speed, broadcom_check_duplex}, /* Broadcom */ + {0xC039, tdk_check_speed, tdk_check_duplex}, /* TDK 2120 */ + {0x039C, tdk_check_speed, tdk_check_duplex}, /* TDK 2120C */ + {0x0000, generic_check_speed, generic_check_duplex} /* Generic, must be last */ +}; + #define tx_done(dev) (*R_DMA_CH0_CMD == 0) /* @@ -409,7 +458,8 @@ struct net_device *dev; int i, err; - printk("ETRAX 100LX 10/100MBit ethernet v2.0 (c) 2000-2003 Axis Communications AB\n"); + printk(KERN_INFO + "ETRAX 100LX 10/100MBit ethernet v2.0 (c) 2000-2003 Axis Communications AB\n"); dev = alloc_etherdev(sizeof(struct net_local)); if (!dev) @@ -496,7 +546,6 @@ current_speed_selection = 0; /* Auto */ speed_timer.expires = jiffies + NET_LINK_UP_CHECK_INTERVAL; speed_timer.function = e100_check_speed; - add_timer(&speed_timer); clear_led_timer.function = e100_clear_network_leds; @@ -504,7 +553,6 @@ current_duplex = autoneg; duplex_timer.expires = jiffies + NET_DUPLEX_CHECK_INTERVAL; duplex_timer.function = e100_check_duplex; - add_timer(&duplex_timer); /* Initialize group address registers to make sure that no */ /* unwanted addresses are matched */ @@ -543,7 +591,7 @@ /* show it in the log as well */ - printk("%s: changed MAC to ", dev->name); + printk(KERN_INFO "%s: changed MAC to ", dev->name); for (i = 0; i < 5; i++) printk("%02X:", dev->dev_addr[i]); @@ -569,12 +617,6 @@ { unsigned long flags; - /* disable the ethernet interface while we configure it */ - - *R_NETWORK_GEN_CONFIG = - IO_STATE(R_NETWORK_GEN_CONFIG, phy, mii_clk) | - IO_STATE(R_NETWORK_GEN_CONFIG, enable, off); - /* enable the MDIO output pin */ *R_NETWORK_MGM_CTRL = IO_STATE(R_NETWORK_MGM_CTRL, mdoe, enable); @@ -645,14 +687,14 @@ IO_STATE(R_NETWORK_GEN_CONFIG, phy, mii_clk) | IO_STATE(R_NETWORK_GEN_CONFIG, enable, on); - *R_NETWORK_TR_CTRL = - IO_STATE(R_NETWORK_TR_CTRL, clr_error, clr) | - IO_STATE(R_NETWORK_TR_CTRL, delay, none) | - IO_STATE(R_NETWORK_TR_CTRL, cancel, dont) | - IO_STATE(R_NETWORK_TR_CTRL, cd, enable) | - IO_STATE(R_NETWORK_TR_CTRL, retry, enable) | - IO_STATE(R_NETWORK_TR_CTRL, pad, enable) | - IO_STATE(R_NETWORK_TR_CTRL, crc, enable); + SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, clr_error, clr); + SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, delay, none); + SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, cancel, dont); + SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, cd, enable); + SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, retry, enable); + SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, pad, enable); + SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, crc, enable); + *R_NETWORK_TR_CTRL = network_tr_ctrl_shadow; save_flags(flags); cli(); @@ -660,7 +702,8 @@ /* enable the irq's for ethernet DMA */ *R_IRQ_MASK2_SET = - IO_STATE(R_IRQ_MASK2_SET, dma1_eop, set); + IO_STATE(R_IRQ_MASK2_SET, dma0_eop, set) | + IO_STATE(R_IRQ_MASK2_SET, dma1_eop, set); *R_IRQ_MASK0_SET = IO_STATE(R_IRQ_MASK0_SET, overrun, set) | @@ -689,6 +732,14 @@ restore_flags(flags); + /* Probe for transceiver */ + if (e100_probe_transceiver()) + goto grace_exit3; + + /* Start duplex/speed timers */ + add_timer(&speed_timer); + add_timer(&duplex_timer); + /* We are now ready to accept transmit requeusts from * the queueing layer of the networking. */ @@ -696,6 +747,8 @@ return 0; +grace_exit3: + free_irq(NETWORK_STATUS_IRQ_NBR, (void *)dev); grace_exit2: free_irq(NETWORK_DMA_TX_IRQ_NBR, (void *)dev); grace_exit1: @@ -706,8 +759,37 @@ static void +generic_check_speed(void) +{ + unsigned long data; + data = e100_get_mdio_reg(MDIO_ADVERTISMENT_REG); + if ((data & MDIO_ADVERT_100_FD) || + (data & MDIO_ADVERT_100_HD)) + current_speed = 100; + else + current_speed = 10; +} + +static void +tdk_check_speed(void) +{ + unsigned long data; + data = e100_get_mdio_reg(MDIO_TDK_DIAGNOSTIC_REG); + current_speed = (data & MDIO_TDK_DIAGNOSTIC_RATE ? 100 : 10); +} + +static void +broadcom_check_speed(void) +{ + unsigned long data; + data = e100_get_mdio_reg(MDIO_AUX_CTRL_STATUS_REG); + current_speed = (data & MDIO_BC_SPEED ? 100 : 10); +} + +static void e100_check_speed(unsigned long dummy) { + static int led_initiated = 0; unsigned long data; int old_speed = current_speed; @@ -715,12 +797,13 @@ if (!(data & MDIO_LINK_UP_MASK)) { current_speed = 0; } else { - data = e100_get_mdio_reg(MDIO_AUX_CTRL_STATUS_REG); - current_speed = (data & MDIO_SPEED ? 100 : 10); + transceiver->check_speed(); } - if (old_speed != current_speed) + if ((old_speed != current_speed) || !led_initiated) { + led_initiated = 1; e100_set_network_leds(NO_NETWORK_ACTIVITY); + } /* Reinitialize the timer. */ speed_timer.expires = jiffies + NET_LINK_UP_CHECK_INTERVAL; @@ -781,29 +864,21 @@ static void e100_set_speed(unsigned long speed) { - current_speed_selection = speed; - e100_negotiate(); + if (speed != current_speed_selection) { + current_speed_selection = speed; + e100_negotiate(); + } } static void e100_check_duplex(unsigned long dummy) { - unsigned long data; - - data = e100_get_mdio_reg(MDIO_AUX_CTRL_STATUS_REG); - - if (data & MDIO_FULL_DUPLEX_IND) { - if (!full_duplex) { /* Duplex changed to full? */ - full_duplex = 1; - SETF(network_rec_config_shadow, R_NETWORK_REC_CONFIG, duplex, full_duplex); - *R_NETWORK_REC_CONFIG = network_rec_config_shadow; - } - } else { /* half */ - if (full_duplex) { /* Duplex changed to half? */ - full_duplex = 0; - SETF(network_rec_config_shadow, R_NETWORK_REC_CONFIG, duplex, full_duplex); - *R_NETWORK_REC_CONFIG = network_rec_config_shadow; - } + int old_duplex = full_duplex; + transceiver->check_duplex(); + if (old_duplex != full_duplex) { + /* Duplex changed */ + SETF(network_rec_config_shadow, R_NETWORK_REC_CONFIG, duplex, full_duplex); + *R_NETWORK_REC_CONFIG = network_rec_config_shadow; } /* Reinitialize the timer. */ @@ -811,13 +886,72 @@ add_timer(&duplex_timer); } +static void +generic_check_duplex(void) +{ + unsigned long data; + data = e100_get_mdio_reg(MDIO_ADVERTISMENT_REG); + if ((data & MDIO_ADVERT_100_FD) || + (data & MDIO_ADVERT_10_FD)) + full_duplex = 1; + else + full_duplex = 0; +} + +static void +tdk_check_duplex(void) +{ + unsigned long data; + data = e100_get_mdio_reg(MDIO_TDK_DIAGNOSTIC_REG); + full_duplex = (data & MDIO_TDK_DIAGNOSTIC_DPLX) ? 1 : 0; +} + +static void +broadcom_check_duplex(void) +{ + unsigned long data; + data = e100_get_mdio_reg(MDIO_AUX_CTRL_STATUS_REG); + full_duplex = (data & MDIO_BC_FULL_DUPLEX_IND) ? 1 : 0; +} + static void e100_set_duplex(enum duplex new_duplex) { - current_duplex = new_duplex; - e100_negotiate(); + if (new_duplex != current_duplex) { + current_duplex = new_duplex; + e100_negotiate(); + } } +static int +e100_probe_transceiver(void) +{ + unsigned int phyid_high; + unsigned int phyid_low; + unsigned int oui; + struct transceiver_ops* ops = NULL; + + /* Probe MDIO physical address */ + for (mdio_phy_addr = 0; mdio_phy_addr <= 31; mdio_phy_addr++) { + if (e100_get_mdio_reg(MDIO_BASE_STATUS_REG) != 0xffff) + break; + } + if (mdio_phy_addr == 32) + return -ENODEV; + + /* Get manufacturer */ + phyid_high = e100_get_mdio_reg(MDIO_PHY_ID_HIGH_REG); + phyid_low = e100_get_mdio_reg(MDIO_PHY_ID_LOW_REG); + oui = (phyid_high << 6) | (phyid_low >> 10); + + for (ops = &transceivers[0]; ops->oui; ops++) { + if (ops->oui == oui) + break; + } + transceiver = ops; + + return 0; +} static unsigned short e100_get_mdio_reg(unsigned char reg_num) @@ -827,7 +961,7 @@ int bitCounter; /* Start of frame, OP Code, Physical Address, Register Address */ - cmd = (MDIO_START << 14) | (MDIO_READ << 12) | (MDIO_PHYS_ADDR << 7) | + cmd = (MDIO_START << 14) | (MDIO_READ << 12) | (mdio_phy_addr << 7) | (reg_num << 2); e100_send_mdio_cmd(cmd, 0); @@ -848,7 +982,7 @@ int bitCounter; unsigned short cmd; - cmd = (MDIO_START << 14) | (MDIO_WRITE << 12) | (MDIO_PHYS_ADDR << 7) | + cmd = (MDIO_START << 14) | (MDIO_WRITE << 12) | (mdio_phy_addr << 7) | (reg << 2); e100_send_mdio_cmd(cmd, 1); @@ -916,7 +1050,7 @@ data = e100_get_mdio_reg(MDIO_BASE_CONTROL_REG); - cmd = (MDIO_START << 14) | (MDIO_WRITE << 12) | (MDIO_PHYS_ADDR << 7) | (MDIO_BASE_CONTROL_REG << 2); + cmd = (MDIO_START << 14) | (MDIO_WRITE << 12) | (mdio_phy_addr << 7) | (MDIO_BASE_CONTROL_REG << 2); e100_send_mdio_cmd(cmd, 1); @@ -984,7 +1118,6 @@ e100_send_packet(struct sk_buff *skb, struct net_device *dev) { struct net_local *np = (struct net_local *)dev->priv; - int length = ETH_ZLEN < skb->len ? skb->len : ETH_ZLEN; unsigned char *buf = skb->data; unsigned long flags; @@ -997,15 +1130,12 @@ dev->trans_start = jiffies; - e100_hardware_send_packet(buf, length); + e100_hardware_send_packet(buf, skb->len); myNextTxDesc = phys_to_virt(myNextTxDesc->descr.next); /* Stop queue if full */ if (myNextTxDesc == myFirstTxDesc) { - /* Enable transmit interrupt to wake up queue */ - *R_DMA_CH0_CLR_INTR = IO_STATE(R_DMA_CH0_CLR_INTR, clr_eop, do); - *R_IRQ_MASK2_SET = IO_STATE(R_IRQ_MASK2_SET, dma0_eop, set); netif_stop_queue(dev); } @@ -1026,6 +1156,11 @@ struct net_local *np = (struct net_local *)dev->priv; unsigned long irqbits = *R_IRQ_MASK2_RD; + /* Disable RX/TX IRQs to avoid reentrancy */ + *R_IRQ_MASK2_CLR = + IO_STATE(R_IRQ_MASK2_CLR, dma0_eop, clr) | + IO_STATE(R_IRQ_MASK2_CLR, dma1_eop, clr); + /* Handle received packets */ if (irqbits & IO_STATE(R_IRQ_MASK2_RD, dma1_eop, active)) { /* acknowledge the eop interrupt */ @@ -1069,9 +1204,14 @@ if (irqbits & IO_STATE(R_IRQ_MASK2_RD, dma0_eop, active)) { /* acknowledge the eop interrupt and wake up queue */ *R_DMA_CH0_CLR_INTR = IO_STATE(R_DMA_CH0_CLR_INTR, clr_eop, do); - *R_IRQ_MASK2_CLR = IO_STATE(R_IRQ_MASK2_CLR, dma0_eop, clr); netif_wake_queue(dev); } + + /* Enable RX/TX IRQs again */ + *R_IRQ_MASK2_SET = + IO_STATE(R_IRQ_MASK2_SET, dma0_eop, set) | + IO_STATE(R_IRQ_MASK2_SET, dma1_eop, set); + return IRQ_HANDLED; } @@ -1084,7 +1224,9 @@ /* check for underrun irq */ if (irqbits & IO_STATE(R_IRQ_MASK0_RD, underrun, active)) { - *R_NETWORK_TR_CTRL = IO_STATE(R_NETWORK_TR_CTRL, clr_error, clr); + SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, clr_error, clr); + *R_NETWORK_TR_CTRL = network_tr_ctrl_shadow; + SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, clr_error, nop); np->stats.tx_errors++; D(printk("ethernet receiver underrun!\n")); } @@ -1096,6 +1238,9 @@ } /* check for excessive collision irq */ if (irqbits & IO_STATE(R_IRQ_MASK0_RD, excessive_col, active)) { + SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, clr_error, clr); + *R_NETWORK_TR_CTRL = network_tr_ctrl_shadow; + SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, clr_error, nop); *R_NETWORK_TR_CTRL = IO_STATE(R_NETWORK_TR_CTRL, clr_error, clr); np->stats.tx_errors++; D(printk("ethernet excessive collisions!\n")); @@ -1210,14 +1355,10 @@ { struct net_local *np = (struct net_local *)dev->priv; - printk("Closing %s.\n", dev->name); + printk(KERN_INFO "Closing %s.\n", dev->name); netif_stop_queue(dev); - *R_NETWORK_GEN_CONFIG = - IO_STATE(R_NETWORK_GEN_CONFIG, phy, mii_clk) | - IO_STATE(R_NETWORK_GEN_CONFIG, enable, off); - *R_IRQ_MASK0_CLR = IO_STATE(R_IRQ_MASK0_CLR, overrun, clr) | IO_STATE(R_IRQ_MASK0_CLR, underrun, clr) | @@ -1245,21 +1386,25 @@ update_rx_stats(&np->stats); update_tx_stats(&np->stats); + /* Stop speed/duplex timers */ + del_timer(&speed_timer); + del_timer(&duplex_timer); + return 0; } static int e100_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) { - struct mii_ioctl_data *data = (struct mii_ioctl_data *)&ifr->ifr_data; - struct net_local *np = (struct net_local *)dev->priv; + struct mii_ioctl_data *data = if_mii(ifr); + struct net_local *np = netdev_priv(dev); spin_lock(&np->lock); /* Preempt protection */ switch (cmd) { case SIOCETHTOOL: return e100_ethtool_ioctl(dev,ifr); case SIOCGMIIPHY: /* Get PHY address */ - data->phy_id = MDIO_PHYS_ADDR; + data->phy_id = mdio_phy_addr; break; case SIOCGMIIREG: /* Read MII register */ data->val_out = e100_get_mdio_reg(data->reg_num); @@ -1278,7 +1423,7 @@ case SET_ETH_SPEED_AUTO: /* Auto negotiate speed */ e100_set_speed(0); break; - case SET_ETH_DUPLEX_HALF: /* Hhalf duplex. */ + case SET_ETH_DUPLEX_HALF: /* Half duplex. */ e100_set_duplex(half); break; case SET_ETH_DUPLEX_FULL: /* Full duplex. */ @@ -1312,12 +1457,12 @@ SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full; ecmd.port = PORT_TP; ecmd.transceiver = XCVR_EXTERNAL; - ecmd.phy_address = MDIO_PHYS_ADDR; + ecmd.phy_address = mdio_phy_addr; ecmd.speed = current_speed; ecmd.duplex = full_duplex ? DUPLEX_FULL : DUPLEX_HALF; ecmd.advertising = ADVERTISED_TP; if (current_duplex == autoneg && current_speed_selection == 0) - ecmd.advertising = ADVERTISED_Autoneg; + ecmd.advertising |= ADVERTISED_Autoneg; else { ecmd.advertising |= ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full | @@ -1355,7 +1500,7 @@ struct ethtool_drvinfo info; memset((void *) &info, 0, sizeof (info)); strncpy(info.driver, "ETRAX 100LX", sizeof(info.driver) - 1); - strncpy(info.version, "$Revision: 1.17 $", sizeof(info.version) - 1); + strncpy(info.version, "$Revision: 1.22 $", sizeof(info.version) - 1); strncpy(info.fw_version, "N/A", sizeof(info.fw_version) - 1); strncpy(info.bus_info, "N/A", sizeof(info.bus_info) - 1); info.regdump_len = 0; @@ -1595,7 +1740,11 @@ if (!current_speed) { /* Make LED red, link is down */ +#if defined(CONFIG_ETRAX_NETWORK_RED_ON_NO_CONNECTION) + LED_NETWORK_SET(LED_RED); +#else LED_NETWORK_SET(LED_OFF); +#endif } else if (light_leds) { if (current_speed == 10) { @@ -1615,4 +1764,26 @@ return etrax_ethernet_init(); } +static int __init +e100_boot_setup(char* str) +{ + struct sockaddr sa = {0}; + int i; + + /* Parse the colon separated Ethernet station address */ + for (i = 0; i < ETH_ALEN; i++) { + unsigned int tmp; + if (sscanf(str + 3*i, "%2x", &tmp) != 1) { + printk(KERN_WARNING "Malformed station address"); + return 0; + } + sa.sa_data[i] = (char)tmp; + } + + default_mac = sa; + return 1; +} + +__setup("etrax100_eth=", e100_boot_setup); + module_init(etrax_init_module); diff -urN linux-2.6.7-rc2/arch/cris/arch-v10/drivers/gpio.c linux-2.6.7-rc3/arch/cris/arch-v10/drivers/gpio.c --- linux-2.6.7-rc2/arch/cris/arch-v10/drivers/gpio.c 2004-05-09 19:31:56.000000000 -0700 +++ linux-2.6.7-rc3/arch/cris/arch-v10/drivers/gpio.c 2004-06-07 12:55:01.248549570 -0700 @@ -1,4 +1,4 @@ -/* $Id: gpio.c,v 1.8 2003/07/04 08:27:37 starvik Exp $ +/* $Id: gpio.c,v 1.11 2004/05/14 07:58:03 starvik Exp $ * * Etrax general port I/O device * @@ -9,6 +9,12 @@ * Johan Adolfsson (read/set directions, write, port G) * * $Log: gpio.c,v $ + * Revision 1.11 2004/05/14 07:58:03 starvik + * Merge of changes from 2.4 + * + * Revision 1.9 2003/09/11 07:29:48 starvik + * Merge of Linux 2.6.0-test5 + * * Revision 1.8 2003/07/04 08:27:37 starvik * Merge of Linux 2.5.74 * @@ -183,6 +189,7 @@ static struct gpio_private *alarmlist = 0; static int gpio_some_alarms = 0; /* Set if someone uses alarm */ +static unsigned long gpio_pa_irq_enabled_mask = 0; /* Port A and B use 8 bit access, but Port G is 32 bit */ #define NUM_PORTS (GPIO_MINOR_B+1) @@ -252,13 +259,19 @@ unsigned long data; poll_wait(file, &priv->alarm_wq, wait); if (priv->minor == GPIO_MINOR_A) { + unsigned long flags; unsigned long tmp; data = *R_PORT_PA_DATA; /* PA has support for high level interrupt - * lets activate for those low and with highalarm set */ tmp = ~data & priv->highalarm & 0xFF; - *R_IRQ_MASK1_SET = (tmp << R_IRQ_MASK1_SET__pa0__BITNR); + tmp = (tmp << R_IRQ_MASK1_SET__pa0__BITNR); + save_flags(flags); cli(); + gpio_pa_irq_enabled_mask |= tmp; + *R_IRQ_MASK1_SET = tmp; + restore_flags(flags); + } else if (priv->minor == GPIO_MINOR_B) data = *R_PORT_PB_DATA; else if (priv->minor == GPIO_MINOR_G) @@ -312,12 +325,15 @@ { unsigned long tmp; /* Find what PA interrupts are active */ - tmp = (*R_IRQ_READ1 >> R_IRQ_READ1__pa0__BITNR) & 0xFF; + tmp = (*R_IRQ_READ1); + + /* Find those that we have enabled */ + tmp &= gpio_pa_irq_enabled_mask; + /* Clear them.. */ - /* NOTE: Maybe we need to be more careful here if some other - * driver uses PA interrupt as well? - */ - *R_IRQ_MASK1_CLR = (tmp << R_IRQ_MASK1_CLR__pa0__BITNR); + *R_IRQ_MASK1_CLR = tmp; + gpio_pa_irq_enabled_mask &= ~tmp; + if (gpio_some_alarms) { return IRQ_RETVAL(etrax_gpio_wake_up_check()); } @@ -386,7 +402,7 @@ gpio_open(struct inode *inode, struct file *filp) { struct gpio_private *priv; - int p = iminor(inode); + int p = MINOR(inode->i_rdev); if (p > GPIO_MINOR_LAST) return -EINVAL; @@ -479,6 +495,7 @@ return ~(*priv->dir_shadow) & 0xFF; /* Only 8 bits */ } else if (priv->minor == GPIO_MINOR_G) { /* We must fiddle with R_GEN_CONFIG to change dir */ + save_flags(flags); cli(); if (((arg & dir_g_in_bits) != arg) && (arg & changeable_dir_g)) { arg &= changeable_dir_g; @@ -503,16 +520,17 @@ dir_g_in_bits |= (1<<24); dir_g_out_bits &= ~(1<<24); } - printk("gpio: SETINPUT on port G set " - "genconfig to 0x%08lX " - "in_bits: 0x%08lX " - "out_bits: 0x%08lX\n", - (unsigned long)genconfig_shadow, - dir_g_in_bits, dir_g_out_bits); + D(printk(KERN_INFO "gpio: SETINPUT on port G set " + "genconfig to 0x%08lX " + "in_bits: 0x%08lX " + "out_bits: 0x%08lX\n", + (unsigned long)genconfig_shadow, + dir_g_in_bits, dir_g_out_bits)); *R_GEN_CONFIG = genconfig_shadow; /* Must be a >120 ns delay before writing this again */ } + restore_flags(flags); return dir_g_in_bits; } return 0; @@ -529,6 +547,7 @@ return *priv->dir_shadow; } else if (priv->minor == GPIO_MINOR_G) { /* We must fiddle with R_GEN_CONFIG to change dir */ + save_flags(flags); cli(); if (((arg & dir_g_out_bits) != arg) && (arg & changeable_dir_g)) { /* Set bits in genconfig to set to output */ @@ -552,15 +571,16 @@ dir_g_out_bits |= (1<<24); dir_g_in_bits &= ~(1<<24); } - printk("gpio: SETOUTPUT on port G set " - "genconfig to 0x%08lX " - "in_bits: 0x%08lX " - "out_bits: 0x%08lX\n", - (unsigned long)genconfig_shadow, - dir_g_in_bits, dir_g_out_bits); + D(printk(KERN_INFO "gpio: SETOUTPUT on port G set " + "genconfig to 0x%08lX " + "in_bits: 0x%08lX " + "out_bits: 0x%08lX\n", + (unsigned long)genconfig_shadow, + dir_g_in_bits, dir_g_out_bits)); *R_GEN_CONFIG = genconfig_shadow; /* Must be a >120 ns delay before writing this again */ } + restore_flags(flags); return dir_g_out_bits & 0x7FFFFFFF; } return 0; @@ -625,6 +645,20 @@ // clear alarm for bits with 1 in arg priv->highalarm &= ~arg; priv->lowalarm &= ~arg; + { + /* Must update gpio_some_alarms */ + struct gpio_private *p = alarmlist; + int some_alarms; + some_alarms = 0; + while (p) { + if (p->highalarm | p->lowalarm) { + some_alarms = 1; + break; + } + p = p->next; + } + gpio_some_alarms = some_alarms; + } break; case IO_READDIR: /* Use IO_SETGET_INPUT/OUTPUT instead! */ /* Read direction 0=input 1=output */ @@ -844,9 +878,9 @@ dir_g_in_bits |= (~dir_g_shadow & changeable_dir_g); - printk("GPIO port G: in_bits: 0x%08lX out_bits: 0x%08lX val: %08lX\n", + printk(KERN_INFO "GPIO port G: in_bits: 0x%08lX out_bits: 0x%08lX val: %08lX\n", dir_g_in_bits, dir_g_out_bits, (unsigned long)*R_PORT_G_DATA); - printk("GPIO port G: dir: %08lX changeable: %08lX\n", + printk(KERN_INFO "GPIO port G: dir: %08lX changeable: %08lX\n", dir_g_shadow, changeable_dir_g); } @@ -883,7 +917,7 @@ #endif gpio_init_port_g(); - printk("ETRAX 100LX GPIO driver v2.5, (c) 2001, 2002 Axis Communications AB\n"); + printk(KERN_INFO "ETRAX 100LX GPIO driver v2.5, (c) 2001, 2002 Axis Communications AB\n"); /* We call etrax_gpio_wake_up_check() from timer interrupt and * from cpu_idle() in kernel/process.c * The check in cpu_idle() reduces latency from ~15 ms to ~6 ms @@ -891,11 +925,11 @@ */ if (request_irq(TIMER0_IRQ_NBR, gpio_poll_timer_interrupt, SA_SHIRQ | SA_INTERRUPT,"gpio poll", NULL)) { - printk("err: timer0 irq for gpio\n"); + printk(KERN_CRIT "err: timer0 irq for gpio\n"); } if (request_irq(PA_IRQ_NBR, gpio_pa_interrupt, SA_SHIRQ | SA_INTERRUPT,"gpio PA", NULL)) { - printk("err: PA irq for gpio\n"); + printk(KERN_CRIT "err: PA irq for gpio\n"); } diff -urN linux-2.6.7-rc2/arch/cris/arch-v10/drivers/i2c.c linux-2.6.7-rc3/arch/cris/arch-v10/drivers/i2c.c --- linux-2.6.7-rc2/arch/cris/arch-v10/drivers/i2c.c 2004-05-09 19:31:59.000000000 -0700 +++ linux-2.6.7-rc3/arch/cris/arch-v10/drivers/i2c.c 2004-06-07 12:55:01.249549611 -0700 @@ -12,6 +12,12 @@ *! don't use PB_I2C if DS1302 uses same bits, *! use PB. *! $Log: i2c.c,v $ +*! Revision 1.7 2004/05/28 09:26:59 starvik +*! Modified I2C initialization to work in 2.6. +*! +*! Revision 1.6 2004/05/14 07:58:03 starvik +*! Merge of changes from 2.4 +*! *! Revision 1.4 2002/12/11 13:13:57 starvik *! Added arch/ to v10 specific includes *! Added fix from Linux 2.4 in serial.c (flush_to_flip_buffer) @@ -63,7 +69,7 @@ *! (C) Copyright 1999-2002 Axis Communications AB, LUND, SWEDEN *! *!***************************************************************************/ -/* $Id: i2c.c,v 1.4 2002/12/11 13:13:57 starvik Exp $ */ +/* $Id: i2c.c,v 1.7 2004/05/28 09:26:59 starvik Exp $ */ /****************** INCLUDE FILES SECTION ***********************************/ @@ -310,6 +316,12 @@ } i2c_clk(I2C_CLOCK_HIGH); i2c_delay(CLOCK_HIGH_TIME); + + /* + * we leave the clock low, getbyte is usually followed + * by sendack/nack, they assume the clock to be low + */ + i2c_clk(I2C_CLOCK_LOW); return aBitByte; } @@ -372,6 +384,13 @@ } /* + * our clock is high now, make sure data is low + * before we enable our output. If we keep data high + * and enable output, we would generate a stop condition. + */ + i2c_data(I2C_DATA_LOW); + + /* * end clock pulse */ i2c_enable(); @@ -428,6 +447,37 @@ /*#--------------------------------------------------------------------------- *# +*# FUNCTION NAME: i2c_sendnack +*# +*# DESCRIPTION : Sends NACK on received data +*# +*#--------------------------------------------------------------------------*/ +void +i2c_sendnack(void) +{ + /* + * enable output + */ + i2c_delay(CLOCK_LOW_TIME); + i2c_dir_out(); + /* + * set data high + */ + i2c_data(I2C_DATA_HIGH); + /* + * generate clock pulse + */ + i2c_delay(CLOCK_HIGH_TIME/6); + i2c_clk(I2C_CLOCK_HIGH); + i2c_delay(CLOCK_HIGH_TIME); + i2c_clk(I2C_CLOCK_LOW); + i2c_delay(CLOCK_LOW_TIME); + + i2c_dir_in(); +} + +/*#--------------------------------------------------------------------------- +*# *# FUNCTION NAME: i2c_writereg *# *# DESCRIPTION : Writes a value to an I2C device @@ -489,7 +539,7 @@ } while(error && cntr--); i2c_delay(CLOCK_LOW_TIME); - + return -error; } @@ -557,7 +607,8 @@ */ b = i2c_inbyte(); /* - * send Ack + * last received byte needs to be nacked + * instead of acked */ i2c_sendack(); /* @@ -634,11 +685,9 @@ .release = i2c_release, }; -static int __init +int __init i2c_init(void) { - int res; - /* Setup and enable the Port B I2C interface */ #ifndef CONFIG_ETRAX_I2C_USES_PB_NOT_PB_I2C @@ -656,21 +705,28 @@ IO_STATE(R_PORT_PB_DIR, dir0, input) | IO_STATE(R_PORT_PB_DIR, dir1, output)); - /* register char device */ + return 0; +} + +static int __init +i2c_register(void) +{ + int res; - res = register_chrdev(I2C_MAJOR, i2c_name, &i2c_fops); + i2c_init(); + res = register_chrdev(I2C_MAJOR, i2c_name, &i2c_fops); if(res < 0) { printk(KERN_ERR "i2c: couldn't get a major number.\n"); return res; } - printk("I2C driver v2.2, (c) 1999-2001 Axis Communications AB\n"); + printk(KERN_INFO "I2C driver v2.2, (c) 1999-2001 Axis Communications AB\n"); return 0; } -/* this makes sure that i2c_init is called during boot */ +/* this makes sure that i2c_register is called during boot */ -module_init(i2c_init); +module_init(i2c_register); /****************** END OF FILE i2c.c ********************************/ diff -urN linux-2.6.7-rc2/arch/cris/arch-v10/drivers/i2c.h linux-2.6.7-rc3/arch/cris/arch-v10/drivers/i2c.h --- linux-2.6.7-rc2/arch/cris/arch-v10/drivers/i2c.h 2004-05-09 19:33:13.000000000 -0700 +++ linux-2.6.7-rc3/arch/cris/arch-v10/drivers/i2c.h 2004-06-07 12:55:01.249549611 -0700 @@ -1,4 +1,6 @@ -/* $Id: i2c.h,v 1.2 2002/11/18 13:16:06 starvik Exp $ */ +/* $Id: i2c.h,v 1.3 2004/05/28 09:26:59 starvik Exp $ */ + +int i2c_init(void); /* High level I2C actions */ int i2c_writereg(unsigned char theSlave, unsigned char theReg, unsigned char theValue); diff -urN linux-2.6.7-rc2/arch/cris/arch-v10/drivers/ide.c linux-2.6.7-rc3/arch/cris/arch-v10/drivers/ide.c --- linux-2.6.7-rc2/arch/cris/arch-v10/drivers/ide.c 1969-12-31 16:00:00.000000000 -0800 +++ linux-2.6.7-rc3/arch/cris/arch-v10/drivers/ide.c 2004-06-07 12:55:01.251549694 -0700 @@ -0,0 +1,945 @@ +/* $Id: ide.c,v 1.1 2004/01/22 08:22:58 starvik Exp $ + * + * Etrax specific IDE functions, like init and PIO-mode setting etc. + * Almost the entire ide.c is used for the rest of the Etrax ATA driver. + * Copyright (c) 2000-2004 Axis Communications AB + * + * Authors: Bjorn Wesen (initial version) + * Mikael Starvik (pio setup stuff, Linux 2.6 port) + */ + +/* Regarding DMA: + * + * There are two forms of DMA - "DMA handshaking" between the interface and the drive, + * and DMA between the memory and the interface. We can ALWAYS use the latter, since it's + * something built-in in the Etrax. However only some drives support the DMA-mode handshaking + * on the ATA-bus. The normal PC driver and Triton interface disables memory-if DMA when the + * device can't do DMA handshaking for some stupid reason. We don't need to do that. + */ + +#undef REALLY_SLOW_IO /* most systems can safely undef this */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +/* number of Etrax DMA descriptors */ +#define MAX_DMA_DESCRS 64 + +/* number of times to retry busy-flags when reading/writing IDE-registers + * this can't be too high because a hung harddisk might cause the watchdog + * to trigger (sometimes INB and OUTB are called with irq's disabled) + */ + +#define IDE_REGISTER_TIMEOUT 300 + +#ifdef CONFIG_ETRAX_IDE_CSE1_16_RESET +/* address where the memory-mapped IDE reset bit lives, if used */ +static volatile unsigned long *reset_addr; +#endif + +static int e100_read_command = 0; + +#define LOWDB(x) +#define D(x) + +void +etrax100_ide_outw(unsigned short data, ide_ioreg_t reg) { + int timeleft; + LOWDB(printk("ow: data 0x%x, reg 0x%x\n", data, reg)); + + /* note the lack of handling any timeouts. we stop waiting, but we don't + * really notify anybody. + */ + + timeleft = IDE_REGISTER_TIMEOUT; + /* wait for busy flag */ + while(timeleft && (*R_ATA_STATUS_DATA & IO_MASK(R_ATA_STATUS_DATA, busy))) + timeleft--; + + /* + * Fall through at a timeout, so the ongoing command will be + * aborted by the write below, which is expected to be a dummy + * command to the command register. This happens when a faulty + * drive times out on a command. See comment on timeout in + * INB. + */ + if(!timeleft) + printk("ATA timeout reg 0x%lx := 0x%x\n", reg, data); + + *R_ATA_CTRL_DATA = reg | data; /* write data to the drive's register */ + + timeleft = IDE_REGISTER_TIMEOUT; + /* wait for transmitter ready */ + while(timeleft && !(*R_ATA_STATUS_DATA & + IO_MASK(R_ATA_STATUS_DATA, tr_rdy))) + timeleft--; +} + +void +etrax100_ide_outb(unsigned char data, ide_ioreg_t reg) +{ + etrax100_ide_outw(data, reg); +} + +void +etrax100_ide_outbsync(ide_drive_t *drive, u8 addr, unsigned long port) +{ + etrax100_ide_outw(addr, port); +} + +unsigned short +etrax100_ide_inw(ide_ioreg_t reg) { + int status; + int timeleft; + + timeleft = IDE_REGISTER_TIMEOUT; + /* wait for busy flag */ + while(timeleft && (*R_ATA_STATUS_DATA & IO_MASK(R_ATA_STATUS_DATA, busy))) + timeleft--; + + if(!timeleft) { + /* + * If we're asked to read the status register, like for + * example when a command does not complete for an + * extended time, but the ATA interface is stuck in a + * busy state at the *ETRAX* ATA interface level (as has + * happened repeatedly with at least one bad disk), then + * the best thing to do is to pretend that we read + * "busy" in the status register, so the IDE driver will + * time-out, abort the ongoing command and perform a + * reset sequence. Note that the subsequent OUT_BYTE + * call will also timeout on busy, but as long as the + * write is still performed, everything will be fine. + */ + if ((reg & IO_MASK (R_ATA_CTRL_DATA, addr)) + == IO_FIELD (R_ATA_CTRL_DATA, addr, IDE_STATUS_OFFSET)) + return BUSY_STAT; + else + /* For other rare cases we assume 0 is good enough. */ + return 0; + } + + *R_ATA_CTRL_DATA = reg | IO_STATE(R_ATA_CTRL_DATA, rw, read); /* read data */ + + timeleft = IDE_REGISTER_TIMEOUT; + /* wait for available */ + while(timeleft && !((status = *R_ATA_STATUS_DATA) & + IO_MASK(R_ATA_STATUS_DATA, dav))) + timeleft--; + + if(!timeleft) + return 0; + + LOWDB(printk("inb: 0x%x from reg 0x%x\n", status & 0xff, reg)); + + return (unsigned short)status; +} + +unsigned char +etrax100_ide_inb(ide_ioreg_t reg) +{ + return (unsigned char)etrax100_ide_inw(reg); +} + +/* PIO timing (in R_ATA_CONFIG) + * + * _____________________________ + * ADDRESS : ________/ + * + * _______________ + * DIOR : ____________/ \__________ + * + * _______________ + * DATA : XXXXXXXXXXXXXXXX_______________XXXXXXXX + * + * + * DIOR is unbuffered while address and data is buffered. + * This creates two problems: + * 1. The DIOR pulse is to early (because it is unbuffered) + * 2. The rise time of DIOR is long + * + * There are at least three different plausible solutions + * 1. Use a pad capable of larger currents in Etrax + * 2. Use an external buffer + * 3. Make the strobe pulse longer + * + * Some of the strobe timings below are modified to compensate + * for this. This implies a slight performance decrease. + * + * THIS SHOULD NEVER BE CHANGED! + * + * TODO: Is this true for the latest LX boards still ? + */ + +#define ATA_DMA2_STROBE 4 +#define ATA_DMA2_HOLD 0 +#define ATA_DMA1_STROBE 4 +#define ATA_DMA1_HOLD 1 +#define ATA_DMA0_STROBE 12 +#define ATA_DMA0_HOLD 9 +#define ATA_PIO4_SETUP 1 +#define ATA_PIO4_STROBE 5 +#define ATA_PIO4_HOLD 0 +#define ATA_PIO3_SETUP 1 +#define ATA_PIO3_STROBE 5 +#define ATA_PIO3_HOLD 1 +#define ATA_PIO2_SETUP 1 +#define ATA_PIO2_STROBE 6 +#define ATA_PIO2_HOLD 2 +#define ATA_PIO1_SETUP 2 +#define ATA_PIO1_STROBE 11 +#define ATA_PIO1_HOLD 4 +#define ATA_PIO0_SETUP 4 +#define ATA_PIO0_STROBE 19 +#define ATA_PIO0_HOLD 4 + +static int e100_dma_check (ide_drive_t *drive); +static int e100_dma_begin (ide_drive_t *drive); +static int e100_dma_end (ide_drive_t *drive); +static int e100_dma_read (ide_drive_t *drive); +static int e100_dma_write (ide_drive_t *drive); +static void e100_ide_input_data (ide_drive_t *drive, void *, unsigned int); +static void e100_ide_output_data (ide_drive_t *drive, void *, unsigned int); +static void e100_atapi_input_bytes(ide_drive_t *drive, void *, unsigned int); +static void e100_atapi_output_bytes(ide_drive_t *drive, void *, unsigned int); +static int e100_dma_off (ide_drive_t *drive); +static int e100_dma_verbose (ide_drive_t *drive); + + +/* + * good_dma_drives() lists the model names (from "hdparm -i") + * of drives which do not support mword2 DMA but which are + * known to work fine with this interface under Linux. + */ + +const char *good_dma_drives[] = {"Micropolis 2112A", + "CONNER CTMA 4000", + "CONNER CTT8000-A", + NULL}; + +static void tune_e100_ide(ide_drive_t *drive, byte pio) +{ + pio = 4; + /* pio = ide_get_best_pio_mode(drive, pio, 4, NULL); */ + + /* set pio mode! */ + + switch(pio) { + case 0: + *R_ATA_CONFIG = ( IO_FIELD( R_ATA_CONFIG, enable, 1 ) | + IO_FIELD( R_ATA_CONFIG, dma_strobe, ATA_DMA2_STROBE ) | + IO_FIELD( R_ATA_CONFIG, dma_hold, ATA_DMA2_HOLD ) | + IO_FIELD( R_ATA_CONFIG, pio_setup, ATA_PIO0_SETUP ) | + IO_FIELD( R_ATA_CONFIG, pio_strobe, ATA_PIO0_STROBE ) | + IO_FIELD( R_ATA_CONFIG, pio_hold, ATA_PIO0_HOLD ) ); + break; + case 1: + *R_ATA_CONFIG = ( IO_FIELD( R_ATA_CONFIG, enable, 1 ) | + IO_FIELD( R_ATA_CONFIG, dma_strobe, ATA_DMA2_STROBE ) | + IO_FIELD( R_ATA_CONFIG, dma_hold, ATA_DMA2_HOLD ) | + IO_FIELD( R_ATA_CONFIG, pio_setup, ATA_PIO1_SETUP ) | + IO_FIELD( R_ATA_CONFIG, pio_strobe, ATA_PIO1_STROBE ) | + IO_FIELD( R_ATA_CONFIG, pio_hold, ATA_PIO1_HOLD ) ); + break; + case 2: + *R_ATA_CONFIG = ( IO_FIELD( R_ATA_CONFIG, enable, 1 ) | + IO_FIELD( R_ATA_CONFIG, dma_strobe, ATA_DMA2_STROBE ) | + IO_FIELD( R_ATA_CONFIG, dma_hold, ATA_DMA2_HOLD ) | + IO_FIELD( R_ATA_CONFIG, pio_setup, ATA_PIO2_SETUP ) | + IO_FIELD( R_ATA_CONFIG, pio_strobe, ATA_PIO2_STROBE ) | + IO_FIELD( R_ATA_CONFIG, pio_hold, ATA_PIO2_HOLD ) ); + break; + case 3: + *R_ATA_CONFIG = ( IO_FIELD( R_ATA_CONFIG, enable, 1 ) | + IO_FIELD( R_ATA_CONFIG, dma_strobe, ATA_DMA2_STROBE ) | + IO_FIELD( R_ATA_CONFIG, dma_hold, ATA_DMA2_HOLD ) | + IO_FIELD( R_ATA_CONFIG, pio_setup, ATA_PIO3_SETUP ) | + IO_FIELD( R_ATA_CONFIG, pio_strobe, ATA_PIO3_STROBE ) | + IO_FIELD( R_ATA_CONFIG, pio_hold, ATA_PIO3_HOLD ) ); + break; + case 4: + *R_ATA_CONFIG = ( IO_FIELD( R_ATA_CONFIG, enable, 1 ) | + IO_FIELD( R_ATA_CONFIG, dma_strobe, ATA_DMA2_STROBE ) | + IO_FIELD( R_ATA_CONFIG, dma_hold, ATA_DMA2_HOLD ) | + IO_FIELD( R_ATA_CONFIG, pio_setup, ATA_PIO4_SETUP ) | + IO_FIELD( R_ATA_CONFIG, pio_strobe, ATA_PIO4_STROBE ) | + IO_FIELD( R_ATA_CONFIG, pio_hold, ATA_PIO4_HOLD ) ); + break; + } +} + +void __init +init_e100_ide (void) +{ + volatile unsigned int dummy; + int h; + + printk("ide: ETRAX 100LX built-in ATA DMA controller\n"); + + /* first fill in some stuff in the ide_hwifs fields */ + + for(h = 0; h < MAX_HWIFS; h++) { + ide_hwif_t *hwif = &ide_hwifs[h]; + hwif->mmio = 2; + hwif->chipset = ide_etrax100; + hwif->tuneproc = &tune_e100_ide; + hwif->ata_input_data = &e100_ide_input_data; + hwif->ata_output_data = &e100_ide_output_data; + hwif->atapi_input_bytes = &e100_atapi_input_bytes; + hwif->atapi_output_bytes = &e100_atapi_output_bytes; + hwif->ide_dma_check = &e100_dma_check; + hwif->ide_dma_end = &e100_dma_end; + hwif->ide_dma_write = &e100_dma_write; + hwif->ide_dma_read = &e100_dma_read; + hwif->ide_dma_begin = &e100_dma_begin; + hwif->OUTB = &etrax100_ide_outb; + hwif->OUTW = &etrax100_ide_outw; + hwif->OUTBSYNC = &etrax100_ide_outbsync; + hwif->INB = &etrax100_ide_inb; + hwif->INW = &etrax100_ide_inw; + hwif->ide_dma_off_quietly = &e100_dma_off; + hwif->ide_dma_verbose = &e100_dma_verbose; + hwif->sg_table = + kmalloc(sizeof(struct scatterlist) * PRD_ENTRIES, GFP_KERNEL); + } + + /* actually reset and configure the etrax100 ide/ata interface */ + + *R_ATA_CTRL_DATA = 0; + *R_ATA_TRANSFER_CNT = 0; + *R_ATA_CONFIG = 0; + + genconfig_shadow = (genconfig_shadow & + ~IO_MASK(R_GEN_CONFIG, dma2) & + ~IO_MASK(R_GEN_CONFIG, dma3) & + ~IO_MASK(R_GEN_CONFIG, ata)) | + ( IO_STATE( R_GEN_CONFIG, dma3, ata ) | + IO_STATE( R_GEN_CONFIG, dma2, ata ) | + IO_STATE( R_GEN_CONFIG, ata, select ) ); + + *R_GEN_CONFIG = genconfig_shadow; + + /* pull the chosen /reset-line low */ + +#ifdef CONFIG_ETRAX_IDE_G27_RESET + REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow, 27, 0); +#endif +#ifdef CONFIG_ETRAX_IDE_CSE1_16_RESET + REG_SHADOW_SET(port_cse1_addr, port_cse1_shadow, 16, 0); +#endif +#ifdef CONFIG_ETRAX_IDE_CSP0_8_RESET + REG_SHADOW_SET(port_csp0_addr, port_csp0_shadow, 8, 0); +#endif +#ifdef CONFIG_ETRAX_IDE_PB7_RESET + port_pb_dir_shadow = port_pb_dir_shadow | + IO_STATE(R_PORT_PB_DIR, dir7, output); + *R_PORT_PB_DIR = port_pb_dir_shadow; + REG_SHADOW_SET(R_PORT_PB_DATA, port_pb_data_shadow, 7, 1); +#endif + + /* wait some */ + + udelay(25); + + /* de-assert bus-reset */ + +#ifdef CONFIG_ETRAX_IDE_CSE1_16_RESET + REG_SHADOW_SET(port_cse1_addr, port_cse1_shadow, 16, 1); +#endif +#ifdef CONFIG_ETRAX_IDE_CSP0_8_RESET + REG_SHADOW_SET(port_csp0_addr, port_csp0_shadow, 8, 1); +#endif +#ifdef CONFIG_ETRAX_IDE_G27_RESET + REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow, 27, 1); +#endif + + /* make a dummy read to set the ata controller in a proper state */ + dummy = *R_ATA_STATUS_DATA; + + *R_ATA_CONFIG = ( IO_FIELD( R_ATA_CONFIG, enable, 1 ) | + IO_FIELD( R_ATA_CONFIG, dma_strobe, ATA_DMA2_STROBE ) | + IO_FIELD( R_ATA_CONFIG, dma_hold, ATA_DMA2_HOLD ) | + IO_FIELD( R_ATA_CONFIG, pio_setup, ATA_PIO4_SETUP ) | + IO_FIELD( R_ATA_CONFIG, pio_strobe, ATA_PIO4_STROBE ) | + IO_FIELD( R_ATA_CONFIG, pio_hold, ATA_PIO4_HOLD ) ); + + *R_ATA_CTRL_DATA = ( IO_STATE( R_ATA_CTRL_DATA, rw, read) | + IO_FIELD( R_ATA_CTRL_DATA, addr, 1 ) ); + + while(*R_ATA_STATUS_DATA & IO_MASK(R_ATA_STATUS_DATA, busy)); /* wait for busy flag*/ + + *R_IRQ_MASK0_SET = ( IO_STATE( R_IRQ_MASK0_SET, ata_irq0, set ) | + IO_STATE( R_IRQ_MASK0_SET, ata_irq1, set ) | + IO_STATE( R_IRQ_MASK0_SET, ata_irq2, set ) | + IO_STATE( R_IRQ_MASK0_SET, ata_irq3, set ) ); + + printk("ide: waiting %d seconds for drives to regain consciousness\n", + CONFIG_ETRAX_IDE_DELAY); + + h = jiffies + (CONFIG_ETRAX_IDE_DELAY * HZ); + while(time_before(jiffies, h)) /* nothing */ ; + + /* reset the dma channels we will use */ + + RESET_DMA(ATA_TX_DMA_NBR); + RESET_DMA(ATA_RX_DMA_NBR); + WAIT_DMA(ATA_TX_DMA_NBR); + WAIT_DMA(ATA_RX_DMA_NBR); + +} + +static int e100_dma_off (ide_drive_t *drive) +{ + return 0; +} + +static int e100_dma_verbose (ide_drive_t *drive) +{ + printk(", DMA(mode 2)"); + return 0; +} + +static etrax_dma_descr mydescr; + +/* + * The following routines are mainly used by the ATAPI drivers. + * + * These routines will round up any request for an odd number of bytes, + * so if an odd bytecount is specified, be sure that there's at least one + * extra byte allocated for the buffer. + */ +static void +e100_atapi_input_bytes (ide_drive_t *drive, void *buffer, unsigned int bytecount) +{ + ide_ioreg_t data_reg = IDE_DATA_REG; + + D(printk("atapi_input_bytes, dreg 0x%x, buffer 0x%x, count %d\n", + data_reg, buffer, bytecount)); + + if(bytecount & 1) { + printk("warning, odd bytecount in cdrom_in_bytes = %d.\n", bytecount); + bytecount++; /* to round off */ + } + + /* make sure the DMA channel is available */ + RESET_DMA(ATA_RX_DMA_NBR); + WAIT_DMA(ATA_RX_DMA_NBR); + + /* setup DMA descriptor */ + + mydescr.sw_len = bytecount; + mydescr.ctrl = d_eol; + mydescr.buf = virt_to_phys(buffer); + + /* start the dma channel */ + + *R_DMA_CH3_FIRST = virt_to_phys(&mydescr); + *R_DMA_CH3_CMD = IO_STATE(R_DMA_CH3_CMD, cmd, start); + + /* initiate a multi word dma read using PIO handshaking */ + + *R_ATA_TRANSFER_CNT = IO_FIELD(R_ATA_TRANSFER_CNT, count, bytecount >> 1); + + *R_ATA_CTRL_DATA = data_reg | + IO_STATE(R_ATA_CTRL_DATA, rw, read) | + IO_STATE(R_ATA_CTRL_DATA, src_dst, dma) | + IO_STATE(R_ATA_CTRL_DATA, handsh, pio) | + IO_STATE(R_ATA_CTRL_DATA, multi, on) | + IO_STATE(R_ATA_CTRL_DATA, dma_size, word); + + /* wait for completion */ + + LED_DISK_READ(1); + WAIT_DMA(ATA_RX_DMA_NBR); + LED_DISK_READ(0); + +#if 0 + /* old polled transfer code + * this should be moved into a new function that can do polled + * transfers if DMA is not available + */ + + /* initiate a multi word read */ + + *R_ATA_TRANSFER_CNT = wcount << 1; + + *R_ATA_CTRL_DATA = data_reg | + IO_STATE(R_ATA_CTRL_DATA, rw, read) | + IO_STATE(R_ATA_CTRL_DATA, src_dst, register) | + IO_STATE(R_ATA_CTRL_DATA, handsh, pio) | + IO_STATE(R_ATA_CTRL_DATA, multi, on) | + IO_STATE(R_ATA_CTRL_DATA, dma_size, word); + + /* svinto has a latency until the busy bit actually is set */ + + nop(); nop(); + nop(); nop(); + nop(); nop(); + nop(); nop(); + nop(); nop(); + + /* unit should be busy during multi transfer */ + while((status = *R_ATA_STATUS_DATA) & IO_MASK(R_ATA_STATUS_DATA, busy)) { + while(!(status & IO_MASK(R_ATA_STATUS_DATA, dav))) + status = *R_ATA_STATUS_DATA; + *ptr++ = (unsigned short)(status & 0xffff); + } +#endif +} + +static void +e100_atapi_output_bytes (ide_drive_t *drive, void *buffer, unsigned int bytecount) +{ + ide_ioreg_t data_reg = IDE_DATA_REG; + + D(printk("atapi_output_bytes, dreg 0x%x, buffer 0x%x, count %d\n", + data_reg, buffer, bytecount)); + + if(bytecount & 1) { + printk("odd bytecount %d in atapi_out_bytes!\n", bytecount); + bytecount++; + } + + /* make sure the DMA channel is available */ + RESET_DMA(ATA_TX_DMA_NBR); + WAIT_DMA(ATA_TX_DMA_NBR); + + /* setup DMA descriptor */ + + mydescr.sw_len = bytecount; + mydescr.ctrl = d_eol; + mydescr.buf = virt_to_phys(buffer); + + /* start the dma channel */ + + *R_DMA_CH2_FIRST = virt_to_phys(&mydescr); + *R_DMA_CH2_CMD = IO_STATE(R_DMA_CH2_CMD, cmd, start); + + /* initiate a multi word dma write using PIO handshaking */ + + *R_ATA_TRANSFER_CNT = IO_FIELD(R_ATA_TRANSFER_CNT, count, bytecount >> 1); + + *R_ATA_CTRL_DATA = data_reg | + IO_STATE(R_ATA_CTRL_DATA, rw, write) | + IO_STATE(R_ATA_CTRL_DATA, src_dst, dma) | + IO_STATE(R_ATA_CTRL_DATA, handsh, pio) | + IO_STATE(R_ATA_CTRL_DATA, multi, on) | + IO_STATE(R_ATA_CTRL_DATA, dma_size, word); + + /* wait for completion */ + + LED_DISK_WRITE(1); + WAIT_DMA(ATA_TX_DMA_NBR); + LED_DISK_WRITE(0); + +#if 0 + /* old polled write code - see comment in input_bytes */ + + /* wait for busy flag */ + while(*R_ATA_STATUS_DATA & IO_MASK(R_ATA_STATUS_DATA, busy)); + + /* initiate a multi word write */ + + *R_ATA_TRANSFER_CNT = bytecount >> 1; + + ctrl = data_reg | + IO_STATE(R_ATA_CTRL_DATA, rw, write) | + IO_STATE(R_ATA_CTRL_DATA, src_dst, register) | + IO_STATE(R_ATA_CTRL_DATA, handsh, pio) | + IO_STATE(R_ATA_CTRL_DATA, multi, on) | + IO_STATE(R_ATA_CTRL_DATA, dma_size, word); + + LED_DISK_WRITE(1); + + /* Etrax will set busy = 1 until the multi pio transfer has finished + * and tr_rdy = 1 after each successful word transfer. + * When the last byte has been transferred Etrax will first set tr_tdy = 1 + * and then busy = 0 (not in the same cycle). If we read busy before it + * has been set to 0 we will think that we should transfer more bytes + * and then tr_rdy would be 0 forever. This is solved by checking busy + * in the inner loop. + */ + + do { + *R_ATA_CTRL_DATA = ctrl | *ptr++; + while(!(*R_ATA_STATUS_DATA & IO_MASK(R_ATA_STATUS_DATA, tr_rdy)) && + (*R_ATA_STATUS_DATA & IO_MASK(R_ATA_STATUS_DATA, busy))); + } while(*R_ATA_STATUS_DATA & IO_MASK(R_ATA_STATUS_DATA, busy)); + + LED_DISK_WRITE(0); +#endif + +} + +/* + * This is used for most PIO data transfers *from* the IDE interface + */ +static void +e100_ide_input_data (ide_drive_t *drive, void *buffer, unsigned int wcount) +{ + e100_atapi_input_bytes(drive, buffer, wcount << 2); +} + +/* + * This is used for most PIO data transfers *to* the IDE interface + */ +static void +e100_ide_output_data (ide_drive_t *drive, void *buffer, unsigned int wcount) +{ + e100_atapi_output_bytes(drive, buffer, wcount << 2); +} + +/* we only have one DMA channel on the chip for ATA, so we can keep these statically */ +static etrax_dma_descr ata_descrs[MAX_DMA_DESCRS]; +static unsigned int ata_tot_size; + +/* + * e100_ide_build_dmatable() prepares a dma request. + * Returns 0 if all went okay, returns 1 otherwise. + */ +static int e100_ide_build_dmatable (ide_drive_t *drive) +{ + ide_hwif_t *hwif = HWIF(drive); + struct scatterlist* sg; + struct request *rq = HWGROUP(drive)->rq; + unsigned long size, addr; + unsigned int count = 0; + int i = 0; + + sg = hwif->sg_table; + + ata_tot_size = 0; + + if (HWGROUP(drive)->rq->flags & REQ_DRIVE_TASKFILE) { + u8 *virt_addr = rq->buffer; + int sector_count = rq->nr_sectors; + memset(&sg[0], 0, sizeof(*sg)); + sg[0].page = virt_to_page(virt_addr); + sg[0].offset = offset_in_page(virt_addr); + sg[0].length = sector_count * SECTOR_SIZE; + hwif->sg_nents = i = 1; + } + else + { + hwif->sg_nents = i = blk_rq_map_sg(drive->queue, rq, hwif->sg_table); + } + + + while(i) { + /* + * Determine addr and size of next buffer area. We assume that + * individual virtual buffers are always composed linearly in + * physical memory. For example, we assume that any 8kB buffer + * is always composed of two adjacent physical 4kB pages rather + * than two possibly non-adjacent physical 4kB pages. + */ + /* group sequential buffers into one large buffer */ + addr = page_to_phys(sg->page) + sg->offset; + size = sg_dma_len(sg); + while (sg++, --i) { + if ((addr + size) != page_to_phys(sg->page) + sg->offset) + break; + size += sg_dma_len(sg); + } + + /* did we run out of descriptors? */ + + if(count >= MAX_DMA_DESCRS) { + printk("%s: too few DMA descriptors\n", drive->name); + return 1; + } + + /* however, this case is more difficult - R_ATA_TRANSFER_CNT cannot be more + than 65536 words per transfer, so in that case we need to either + 1) use a DMA interrupt to re-trigger R_ATA_TRANSFER_CNT and continue with + the descriptors, or + 2) simply do the request here, and get dma_intr to only ide_end_request on + those blocks that were actually set-up for transfer. + */ + + if(ata_tot_size + size > 131072) { + printk("too large total ATA DMA request, %d + %d!\n", ata_tot_size, (int)size); + return 1; + } + + /* If size > 65536 it has to be splitted into new descriptors. Since we don't handle + size > 131072 only one split is necessary */ + + if(size > 65536) { + /* ok we want to do IO at addr, size bytes. set up a new descriptor entry */ + ata_descrs[count].sw_len = 0; /* 0 means 65536, this is a 16-bit field */ + ata_descrs[count].ctrl = 0; + ata_descrs[count].buf = addr; + ata_descrs[count].next = virt_to_phys(&ata_descrs[count + 1]); + count++; + ata_tot_size += 65536; + /* size and addr should refere to not handled data */ + size -= 65536; + addr += 65536; + } + /* ok we want to do IO at addr, size bytes. set up a new descriptor entry */ + if(size == 65536) { + ata_descrs[count].sw_len = 0; /* 0 means 65536, this is a 16-bit field */ + } else { + ata_descrs[count].sw_len = size; + } + ata_descrs[count].ctrl = 0; + ata_descrs[count].buf = addr; + ata_descrs[count].next = virt_to_phys(&ata_descrs[count + 1]); + count++; + ata_tot_size += size; + } + + if (count) { + /* set the end-of-list flag on the last descriptor */ + ata_descrs[count - 1].ctrl |= d_eol; + /* return and say all is ok */ + return 0; + } + + printk("%s: empty DMA table?\n", drive->name); + return 1; /* let the PIO routines handle this weirdness */ +} + +static int config_drive_for_dma (ide_drive_t *drive) +{ + const char **list; + struct hd_driveid *id = drive->id; + + if (id && (id->capability & 1)) { + /* Enable DMA on any drive that supports mword2 DMA */ + if ((id->field_valid & 2) && (id->dma_mword & 0x404) == 0x404) { + drive->using_dma = 1; + return 0; /* DMA enabled */ + } + + /* Consult the list of known "good" drives */ + list = good_dma_drives; + while (*list) { + if (!strcmp(*list++,id->model)) { + drive->using_dma = 1; + return 0; /* DMA enabled */ + } + } + } + return 1; /* DMA not enabled */ +} + +/* + * etrax_dma_intr() is the handler for disk read/write DMA interrupts + */ +static ide_startstop_t etrax_dma_intr (ide_drive_t *drive) +{ + int i, dma_stat; + byte stat; + + LED_DISK_READ(0); + LED_DISK_WRITE(0); + + dma_stat = HWIF(drive)->ide_dma_end(drive); + stat = HWIF(drive)->INB(IDE_STATUS_REG); /* get drive status */ + if (OK_STAT(stat,DRIVE_READY,drive->bad_wstat|DRQ_STAT)) { + if (!dma_stat) { + struct request *rq; + rq = HWGROUP(drive)->rq; + for (i = rq->nr_sectors; i > 0;) { + i -= rq->current_nr_sectors; + DRIVER(drive)->end_request(drive, 1, rq->nr_sectors); + } + return ide_stopped; + } + printk("%s: bad DMA status\n", drive->name); + } + return DRIVER(drive)->error(drive, "dma_intr", stat); +} + +/* + * Functions below initiates/aborts DMA read/write operations on a drive. + * + * The caller is assumed to have selected the drive and programmed the drive's + * sector address using CHS or LBA. All that remains is to prepare for DMA + * and then issue the actual read/write DMA/PIO command to the drive. + * + * For ATAPI devices, we just prepare for DMA and return. The caller should + * then issue the packet command to the drive and call us again with + * ide_dma_begin afterwards. + * + * Returns 0 if all went well. + * Returns 1 if DMA read/write could not be started, in which case + * the caller should revert to PIO for the current request. + */ + +static int e100_dma_check(ide_drive_t *drive) +{ + return config_drive_for_dma (drive); +} + +static int e100_dma_end(ide_drive_t *drive) +{ + /* TODO: check if something went wrong with the DMA */ + return 0; +} + +static int e100_start_dma(ide_drive_t *drive, int atapi, int reading) +{ + if(reading) { + + RESET_DMA(ATA_RX_DMA_NBR); /* sometimes the DMA channel get stuck so we need to do this */ + WAIT_DMA(ATA_RX_DMA_NBR); + + /* set up the Etrax DMA descriptors */ + + if(e100_ide_build_dmatable (drive)) + return 1; + + if(!atapi) { + /* set the irq handler which will finish the request when DMA is done */ + + ide_set_handler(drive, &etrax_dma_intr, WAIT_CMD, NULL); + + /* issue cmd to drive */ + if ((HWGROUP(drive)->rq->cmd == IDE_DRIVE_TASKFILE) && + (drive->addressing == 1)) { + ide_task_t *args = HWGROUP(drive)->rq->special; + etrax100_ide_outb(args->tfRegister[IDE_COMMAND_OFFSET], IDE_COMMAND_REG); + } else if (drive->addressing) { + etrax100_ide_outb(WIN_READDMA_EXT, IDE_COMMAND_REG); + } else { + etrax100_ide_outb(WIN_READDMA, IDE_COMMAND_REG); + } + } + + /* begin DMA */ + + /* need to do this before RX DMA due to a chip bug + * it is enough to just flush the part of the cache that + * corresponds to the buffers we start, but since HD transfers + * usually are more than 8 kB, it is easier to optimize for the + * normal case and just flush the entire cache. its the only + * way to be sure! (OB movie quote) + */ + flush_etrax_cache(); + *R_DMA_CH3_FIRST = virt_to_phys(ata_descrs); + *R_DMA_CH3_CMD = IO_STATE(R_DMA_CH3_CMD, cmd, start); + + /* initiate a multi word dma read using DMA handshaking */ + + *R_ATA_TRANSFER_CNT = + IO_FIELD(R_ATA_TRANSFER_CNT, count, ata_tot_size >> 1); + + *R_ATA_CTRL_DATA = + IO_FIELD(R_ATA_CTRL_DATA, data, IDE_DATA_REG) | + IO_STATE(R_ATA_CTRL_DATA, rw, read) | + IO_STATE(R_ATA_CTRL_DATA, src_dst, dma) | + IO_STATE(R_ATA_CTRL_DATA, handsh, dma) | + IO_STATE(R_ATA_CTRL_DATA, multi, on) | + IO_STATE(R_ATA_CTRL_DATA, dma_size, word); + + LED_DISK_READ(1); + + D(printk("dma read of %d bytes.\n", ata_tot_size)); + + } else { + /* writing */ + + RESET_DMA(ATA_TX_DMA_NBR); /* sometimes the DMA channel get stuck so we need to do this */ + WAIT_DMA(ATA_TX_DMA_NBR); + + /* set up the Etrax DMA descriptors */ + + if(e100_ide_build_dmatable (drive)) + return 1; + + if(!atapi) { + /* set the irq handler which will finish the request when DMA is done */ + + ide_set_handler(drive, &etrax_dma_intr, WAIT_CMD, NULL); + + /* issue cmd to drive */ + if ((HWGROUP(drive)->rq->cmd == IDE_DRIVE_TASKFILE) && + (drive->addressing == 1)) { + ide_task_t *args = HWGROUP(drive)->rq->special; + etrax100_ide_outb(args->tfRegister[IDE_COMMAND_OFFSET], IDE_COMMAND_REG); + } else if (drive->addressing) { + etrax100_ide_outb(WIN_WRITEDMA_EXT, IDE_COMMAND_REG); + } else { + etrax100_ide_outb(WIN_WRITEDMA, IDE_COMMAND_REG); + } + } + + /* begin DMA */ + + *R_DMA_CH2_FIRST = virt_to_phys(ata_descrs); + *R_DMA_CH2_CMD = IO_STATE(R_DMA_CH2_CMD, cmd, start); + + /* initiate a multi word dma write using DMA handshaking */ + + *R_ATA_TRANSFER_CNT = + IO_FIELD(R_ATA_TRANSFER_CNT, count, ata_tot_size >> 1); + + *R_ATA_CTRL_DATA = + IO_FIELD(R_ATA_CTRL_DATA, data, IDE_DATA_REG) | + IO_STATE(R_ATA_CTRL_DATA, rw, write) | + IO_STATE(R_ATA_CTRL_DATA, src_dst, dma) | + IO_STATE(R_ATA_CTRL_DATA, handsh, dma) | + IO_STATE(R_ATA_CTRL_DATA, multi, on) | + IO_STATE(R_ATA_CTRL_DATA, dma_size, word); + + LED_DISK_WRITE(1); + + D(printk("dma write of %d bytes.\n", ata_tot_size)); + } + return 0; +} + +static int e100_dma_write(ide_drive_t *drive) +{ + e100_read_command = 0; + /* ATAPI-devices (not disks) first call ide_dma_read/write to set the direction + * then they call ide_dma_begin after they have issued the appropriate drive command + * themselves to actually start the chipset DMA. so we just return here if we're + * not a diskdrive. + */ + if (drive->media != ide_disk) + return 0; + return e100_start_dma(drive, 0, 0); +} + +static int e100_dma_read(ide_drive_t *drive) +{ + e100_read_command = 1; + /* ATAPI-devices (not disks) first call ide_dma_read/write to set the direction + * then they call ide_dma_begin after they have issued the appropriate drive command + * themselves to actually start the chipset DMA. so we just return here if we're + * not a diskdrive. + */ + if (drive->media != ide_disk) + return 0; + return e100_start_dma(drive, 0, 1); +} + +static int e100_dma_begin(ide_drive_t *drive) +{ + /* begin DMA, used by ATAPI devices which want to issue the + * appropriate IDE command themselves. + * + * they have already called ide_dma_read/write to set the + * static reading flag, now they call ide_dma_begin to do + * the real stuff. we tell our code below not to issue + * any IDE commands itself and jump into it. + */ + return e100_start_dma(drive, 1, e100_read_command); +} diff -urN linux-2.6.7-rc2/arch/cris/arch-v10/drivers/pcf8563.c linux-2.6.7-rc3/arch/cris/arch-v10/drivers/pcf8563.c --- linux-2.6.7-rc2/arch/cris/arch-v10/drivers/pcf8563.c 2004-06-07 12:54:48.278012378 -0700 +++ linux-2.6.7-rc3/arch/cris/arch-v10/drivers/pcf8563.c 2004-06-07 12:55:01.252549735 -0700 @@ -15,7 +15,7 @@ * * Author: Tobias Anderberg . * - * $Id: pcf8563.c,v 1.1 2002/12/12 08:27:26 starvik Exp $ + * $Id: pcf8563.c,v 1.4 2004/05/28 09:26:59 starvik Exp $ */ #include @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -39,7 +40,7 @@ #define PCF8563_MAJOR 121 /* Local major number. */ #define DEVICE_NAME "rtc" /* Name which is registered in /proc/devices. */ #define PCF8563_NAME "PCF8563" -#define DRIVER_VERSION "$Revision: 1.1 $" +#define DRIVER_VERSION "$Revision: 1.4 $" /* I2C bus slave registers. */ #define RTC_I2C_READ 0xa3 @@ -85,7 +86,12 @@ void pcf8563_writereg(int reg, unsigned char val) { - i2c_writereg(RTC_I2C_WRITE,reg,val); +#ifdef CONFIG_ETRAX_RTC_READONLY + if (reg == RTC_CONTROL1 || (reg >= RTC_SECONDS && reg <= RTC_YEAR)) + return; +#endif + + rtc_write(reg, val); } void @@ -120,6 +126,9 @@ pcf8563_init(void) { unsigned char ret; + + i2c_init(); + /* * First of all we need to reset the chip. This is done by * clearing control1, control2 and clk freq, clear the @@ -152,14 +161,6 @@ if (rtc_write(RTC_WEEKDAY_ALARM, 0x00) < 0) goto err; - - if (register_chrdev(PCF8563_MAJOR, DEVICE_NAME, &pcf8563_fops) < 0) { - printk(KERN_INFO "%s: Unable to get major numer %d for RTC device.\n", - PCF8563_NAME, PCF8563_MAJOR); - return -1; - } - - printk(KERN_INFO "%s Real-Time Clock Driver, %s\n", PCF8563_NAME, DRIVER_VERSION); /* Check for low voltage, and warn about it.. */ if (rtc_read(RTC_SECONDS) & 0x80) @@ -210,9 +211,11 @@ break; case RTC_SET_TIME: { +#ifdef CONFIG_ETRAX_RTC_READONLY + return -EPERM; +#else int leap; int century; - unsigned long flags; struct rtc_time tm; memset(&tm, 0, sizeof (struct rtc_time)); @@ -256,8 +259,35 @@ rtc_write(RTC_SECONDS, tm.tm_sec); return 0; +#endif /* !CONFIG_ETRAX_RTC_READONLY */ } - break; + + case RTC_VLOW_RD: + { + int vl_bit = 0; + + if (rtc_read(RTC_SECONDS) & 0x80) { + vl_bit = 1; + printk(KERN_WARNING "%s: RTC Voltage Low - reliable " + "date/time information is no longer guaranteed!\n", + PCF8563_NAME); + } + if (copy_to_user((int *) arg, &vl_bit, sizeof(int))) + return -EFAULT; + + return 0; + } + + case RTC_VLOW_SET: + { + /* Clear the VL bit in the seconds register */ + int ret = rtc_read(RTC_SECONDS); + + rtc_write(RTC_SECONDS, (ret & 0x7F)); + + return 0; + } + default: return -ENOTTY; } @@ -265,5 +295,19 @@ return 0; } -module_init(pcf8563_init); +static int __init +pcf8563_register(void) +{ + pcf8563_init(); + if (register_chrdev(PCF8563_MAJOR, DEVICE_NAME, &pcf8563_fops) < 0) { + printk(KERN_INFO "%s: Unable to get major numer %d for RTC device.\n", + PCF8563_NAME, PCF8563_MAJOR); + return -1; + } + + printk(KERN_INFO "%s Real-Time Clock Driver, %s\n", PCF8563_NAME, DRIVER_VERSION); + return 0; +} + +module_init(pcf8563_register); module_exit(pcf8563_exit); diff -urN linux-2.6.7-rc2/arch/cris/arch-v10/drivers/serial.c linux-2.6.7-rc3/arch/cris/arch-v10/drivers/serial.c --- linux-2.6.7-rc2/arch/cris/arch-v10/drivers/serial.c 2004-05-09 19:32:53.000000000 -0700 +++ linux-2.6.7-rc3/arch/cris/arch-v10/drivers/serial.c 2004-06-07 12:55:01.259550025 -0700 @@ -1,4 +1,4 @@ -/* $Id: serial.c,v 1.17 2003/07/04 08:27:37 starvik Exp $ +/* $Id: serial.c,v 1.20 2004/05/24 12:00:20 starvik Exp $ * * Serial port driver for the ETRAX 100LX chip * @@ -7,6 +7,16 @@ * Many, many authors. Based once upon a time on serial.c for 16x50. * * $Log: serial.c,v $ + * Revision 1.20 2004/05/24 12:00:20 starvik + * Big merge of stuff from Linux 2.4 (e.g. manual mode for the serial port). + * + * Revision 1.19 2004/05/17 13:12:15 starvik + * Kernel console hook + * Big merge from Linux 2.4 still pending. + * + * Revision 1.18 2003/10/28 07:18:30 starvik + * Compiles with debug info + * * Revision 1.17 2003/07/04 08:27:37 starvik * Merge of Linux 2.5.74 * @@ -399,7 +409,7 @@ * */ -static char *serial_version = "$Revision: 1.17 $"; +static char *serial_version = "$Revision: 1.20 $"; #include #include @@ -447,6 +457,10 @@ #error "RX_TIMEOUT_TICKS == 0 not allowed, use 1" #endif +#if defined(CONFIG_ETRAX_RS485_ON_PA) && defined(CONFIG_ETRAX_RS485_ON_PORT_G) +#error "Disable either CONFIG_ETRAX_RS485_ON_PA or CONFIG_ETRAX_RS485_ON_PORT_G" +#endif + /* * All of the compatibilty code so we can compile serial.c against * older kernels is hidden in serial_compat.h @@ -473,7 +487,7 @@ //#define SERIAL_DEBUG_DATA //#define SERIAL_DEBUG_THROTTLE //#define SERIAL_DEBUG_IO /* Debug for Extra control and status pins */ -#define SERIAL_DEBUG_LINE 0 /* What serport we want to debug */ +//#define SERIAL_DEBUG_LINE 0 /* What serport we want to debug */ /* Enable this to use serial interrupts to handle when you expect the first received event on the serial port to @@ -481,14 +495,74 @@ from eLinux */ #define SERIAL_HANDLE_EARLY_ERRORS -#define TTY_THROTTLE_LIMIT (TTY_FLIPBUF_SIZE/10) +/* Defined and used in n_tty.c, but we need it here as well */ +#define TTY_THRESHOLD_THROTTLE 128 +/* Due to buffersizes and threshold values, our SERIAL_DESCR_BUF_SIZE + * must not be to high or flow control won't work if we leave it to the tty + * layer so we have our own throttling in flush_to_flip + * TTY_FLIPBUF_SIZE=512, + * TTY_THRESHOLD_THROTTLE/UNTHROTTLE=128 + * BUF_SIZE can't be > 128 + */ +/* Currently 16 descriptors x 128 bytes = 2048 bytes */ #define SERIAL_DESCR_BUF_SIZE 256 +#define SERIAL_PRESCALE_BASE 3125000 /* 3.125MHz */ +#define DEF_BAUD_BASE SERIAL_PRESCALE_BASE + +/* We don't want to load the system with massive fast timer interrupt + * on high baudrates so limit it to 250 us (4kHz) */ +#define MIN_FLUSH_TIME_USEC 250 + /* Add an x here to log a lot of timer stuff */ #define TIMERD(x) +/* Debug details of interrupt handling */ +#define DINTR1(x) /* irq on/off, errors */ +#define DINTR2(x) /* tx and rx */ +/* Debug flip buffer stuff */ +#define DFLIP(x) +/* Debug flow control and overview of data flow */ +#define DFLOW(x) +#define DBAUD(x) +#define DLOG_INT_TRIG(x) +//#define DEBUG_LOG_INCLUDED +#ifndef DEBUG_LOG_INCLUDED #define DEBUG_LOG(line, string, value) +#else +struct debug_log_info +{ + unsigned long time; + unsigned long timer_data; +// int line; + const char *string; + int value; +}; +#define DEBUG_LOG_SIZE 4096 + +struct debug_log_info debug_log[DEBUG_LOG_SIZE]; +int debug_log_pos = 0; + +#define DEBUG_LOG(_line, _string, _value) do { \ + if ((_line) == SERIAL_DEBUG_LINE) {\ + debug_log_func(_line, _string, _value); \ + }\ +}while(0) + +void debug_log_func(int line, const char *string, int value) +{ + if (debug_log_pos < DEBUG_LOG_SIZE) { + debug_log[debug_log_pos].time = jiffies; + debug_log[debug_log_pos].timer_data = *R_TIMER_DATA; +// debug_log[debug_log_pos].line = line; + debug_log[debug_log_pos].string = string; + debug_log[debug_log_pos].value = value; + debug_log_pos++; + } + /*printk(string, value);*/ +} +#endif #ifndef CONFIG_ETRAX_SERIAL_RX_TIMEOUT_TICKS /* Default number of timer ticks before flushing rx fifo @@ -498,11 +572,14 @@ #define CONFIG_ETRAX_SERIAL_RX_TIMEOUT_TICKS 5 #endif +unsigned long timer_data_to_ns(unsigned long timer_data); + static void change_speed(struct e100_serial *info); +static void rs_throttle(struct tty_struct * tty); static void rs_wait_until_sent(struct tty_struct *tty, int timeout); static int rs_write(struct tty_struct * tty, int from_user, const unsigned char *buf, int count); -static inline int raw_write(struct tty_struct * tty, int from_user, +extern _INLINE_ int rs_raw_write(struct tty_struct * tty, int from_user, const unsigned char *buf, int count); #ifdef CONFIG_ETRAX_RS485 static int e100_write_rs485(struct tty_struct * tty, int from_user, @@ -511,7 +588,7 @@ static int get_lsr_info(struct e100_serial * info, unsigned int *value); -#define DEF_BAUD 0x99 /* 115.2 kbit/s */ +#define DEF_BAUD 115200 /* 115.2 kbit/s */ #define STD_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST) #define DEF_RX 0x20 /* or SERIAL_CTRL_W >> 8 */ /* Default value of tx_ctrl register: has txd(bit 7)=1 (idle) as default */ @@ -520,6 +597,7 @@ /* offsets from R_SERIALx_CTRL */ #define REG_DATA 0 +#define REG_DATA_STATUS32 0 /* this is the 32 bit register R_SERIALx_READ */ #define REG_TR_DATA 0 #define REG_STATUS 1 #define REG_TR_CTRL 1 @@ -555,60 +633,162 @@ */ +/* Mask for the irqs possibly enabled in R_IRQ_MASK1_RD etc. */ +static const unsigned long e100_ser_int_mask = 0 +#ifdef CONFIG_ETRAX_SERIAL_PORT0 +| IO_MASK(R_IRQ_MASK1_RD, ser0_data) | IO_MASK(R_IRQ_MASK1_RD, ser0_ready) +#endif +#ifdef CONFIG_ETRAX_SERIAL_PORT1 +| IO_MASK(R_IRQ_MASK1_RD, ser1_data) | IO_MASK(R_IRQ_MASK1_RD, ser1_ready) +#endif +#ifdef CONFIG_ETRAX_SERIAL_PORT2 +| IO_MASK(R_IRQ_MASK1_RD, ser2_data) | IO_MASK(R_IRQ_MASK1_RD, ser2_ready) +#endif +#ifdef CONFIG_ETRAX_SERIAL_PORT3 +| IO_MASK(R_IRQ_MASK1_RD, ser3_data) | IO_MASK(R_IRQ_MASK1_RD, ser3_ready) +#endif +; +unsigned long r_alt_ser_baudrate_shadow = 0; + /* this is the data for the four serial ports in the etrax100 */ /* DMA2(ser2), DMA4(ser3), DMA6(ser0) or DMA8(ser1) */ /* R_DMA_CHx_CLR_INTR, R_DMA_CHx_FIRST, R_DMA_CHx_CMD */ static struct e100_serial rs_table[] = { - { DEF_BAUD, (unsigned char *)R_SERIAL0_CTRL, 1U << 12, /* uses DMA 6 and 7 */ - R_DMA_CH6_CLR_INTR, R_DMA_CH6_FIRST, R_DMA_CH6_CMD, - R_DMA_CH6_STATUS, R_DMA_CH6_HWSW, R_DMA_CH6_DESCR, - R_DMA_CH7_CLR_INTR, R_DMA_CH7_FIRST, R_DMA_CH7_CMD, - R_DMA_CH7_STATUS, R_DMA_CH7_HWSW, R_DMA_CH7_DESCR, - STD_FLAGS, DEF_RX, DEF_TX, 2, + { .baud = DEF_BAUD, + .port = (unsigned char *)R_SERIAL0_CTRL, + .irq = 1U << 12, /* uses DMA 6 and 7 */ + .oclrintradr = R_DMA_CH6_CLR_INTR, + .ofirstadr = R_DMA_CH6_FIRST, + .ocmdadr = R_DMA_CH6_CMD, + .ostatusadr = R_DMA_CH6_STATUS, + .iclrintradr = R_DMA_CH7_CLR_INTR, + .ifirstadr = R_DMA_CH7_FIRST, + .icmdadr = R_DMA_CH7_CMD, + .idescradr = R_DMA_CH7_DESCR, + .flags = STD_FLAGS, + .rx_ctrl = DEF_RX, + .tx_ctrl = DEF_TX, + .iseteop = 2, #ifdef CONFIG_ETRAX_SERIAL_PORT0 - 1 + .enabled = 1, +#ifdef CONFIG_ETRAX_SERIAL_PORT0_DMA6_OUT + .dma_out_enabled = 1, +#else + .dma_out_enabled = 0, +#endif +#ifdef CONFIG_ETRAX_SERIAL_PORT0_DMA7_IN + .dma_in_enabled = 1, +#else + .dma_in_enabled = 0 +#endif #else - 0 + .enabled = 0, + .dma_out_enabled = 0, + .dma_in_enabled = 0 #endif + }, /* ttyS0 */ #ifndef CONFIG_SVINTO_SIM - { DEF_BAUD, (unsigned char *)R_SERIAL1_CTRL, 1U << 16, /* uses DMA 8 and 9 */ - R_DMA_CH8_CLR_INTR, R_DMA_CH8_FIRST, R_DMA_CH8_CMD, - R_DMA_CH8_STATUS, R_DMA_CH8_HWSW, R_DMA_CH8_DESCR, - R_DMA_CH9_CLR_INTR, R_DMA_CH9_FIRST, R_DMA_CH9_CMD, - R_DMA_CH9_STATUS, R_DMA_CH9_HWSW, R_DMA_CH9_DESCR, - STD_FLAGS, DEF_RX, DEF_TX, 3 , + { .baud = DEF_BAUD, + .port = (unsigned char *)R_SERIAL1_CTRL, + .irq = 1U << 16, /* uses DMA 8 and 9 */ + .oclrintradr = R_DMA_CH8_CLR_INTR, + .ofirstadr = R_DMA_CH8_FIRST, + .ocmdadr = R_DMA_CH8_CMD, + .ostatusadr = R_DMA_CH8_STATUS, + .iclrintradr = R_DMA_CH9_CLR_INTR, + .ifirstadr = R_DMA_CH9_FIRST, + .icmdadr = R_DMA_CH9_CMD, + .idescradr = R_DMA_CH9_DESCR, + .flags = STD_FLAGS, + .rx_ctrl = DEF_RX, + .tx_ctrl = DEF_TX, + .iseteop = 3, #ifdef CONFIG_ETRAX_SERIAL_PORT1 - 1 + .enabled = 1, +#ifdef CONFIG_ETRAX_SERIAL_PORT1_DMA8_OUT + .dma_out_enabled = 1, +#else + .dma_out_enabled = 0, +#endif +#ifdef CONFIG_ETRAX_SERIAL_PORT1_DMA9_IN + .dma_in_enabled = 1, +#else + .dma_in_enabled = 0 +#endif #else - 0 + .enabled = 0, + .dma_out_enabled = 0, + .dma_in_enabled = 0 #endif }, /* ttyS1 */ - { DEF_BAUD, (unsigned char *)R_SERIAL2_CTRL, 1U << 4, /* uses DMA 2 and 3 */ - R_DMA_CH2_CLR_INTR, R_DMA_CH2_FIRST, R_DMA_CH2_CMD, - R_DMA_CH2_STATUS, R_DMA_CH2_HWSW, R_DMA_CH2_DESCR, - R_DMA_CH3_CLR_INTR, R_DMA_CH3_FIRST, R_DMA_CH3_CMD, - R_DMA_CH3_STATUS, R_DMA_CH3_HWSW, R_DMA_CH3_DESCR, - STD_FLAGS, DEF_RX, DEF_TX, 0, + { .baud = DEF_BAUD, + .port = (unsigned char *)R_SERIAL2_CTRL, + .irq = 1U << 4, /* uses DMA 2 and 3 */ + .oclrintradr = R_DMA_CH2_CLR_INTR, + .ofirstadr = R_DMA_CH2_FIRST, + .ocmdadr = R_DMA_CH2_CMD, + .ostatusadr = R_DMA_CH2_STATUS, + .iclrintradr = R_DMA_CH3_CLR_INTR, + .ifirstadr = R_DMA_CH3_FIRST, + .icmdadr = R_DMA_CH3_CMD, + .idescradr = R_DMA_CH3_DESCR, + .flags = STD_FLAGS, + .rx_ctrl = DEF_RX, + .tx_ctrl = DEF_TX, + .iseteop = 0, #ifdef CONFIG_ETRAX_SERIAL_PORT2 - 1 + .enabled = 1, +#ifdef CONFIG_ETRAX_SERIAL_PORT2_DMA2_OUT + .dma_out_enabled = 1, +#else + .dma_out_enabled = 0, +#endif +#ifdef CONFIG_ETRAX_SERIAL_PORT2_DMA3_IN + .dma_in_enabled = 1, #else - 0 + .dma_in_enabled = 0 +#endif +#else + .enabled = 0, + .dma_out_enabled = 0, + .dma_in_enabled = 0 #endif }, /* ttyS2 */ - { DEF_BAUD, (unsigned char *)R_SERIAL3_CTRL, 1U << 8, /* uses DMA 4 and 5 */ - R_DMA_CH4_CLR_INTR, R_DMA_CH4_FIRST, R_DMA_CH4_CMD, - R_DMA_CH4_STATUS, R_DMA_CH4_HWSW, R_DMA_CH4_DESCR, - R_DMA_CH5_CLR_INTR, R_DMA_CH5_FIRST, R_DMA_CH5_CMD, - R_DMA_CH5_STATUS, R_DMA_CH5_HWSW, R_DMA_CH5_DESCR, - STD_FLAGS, DEF_RX, DEF_TX, 1, + { .baud = DEF_BAUD, + .port = (unsigned char *)R_SERIAL3_CTRL, + .irq = 1U << 8, /* uses DMA 4 and 5 */ + .oclrintradr = R_DMA_CH4_CLR_INTR, + .ofirstadr = R_DMA_CH4_FIRST, + .ocmdadr = R_DMA_CH4_CMD, + .ostatusadr = R_DMA_CH4_STATUS, + .iclrintradr = R_DMA_CH5_CLR_INTR, + .ifirstadr = R_DMA_CH5_FIRST, + .icmdadr = R_DMA_CH5_CMD, + .idescradr = R_DMA_CH5_DESCR, + .flags = STD_FLAGS, + .rx_ctrl = DEF_RX, + .tx_ctrl = DEF_TX, + .iseteop = 1, #ifdef CONFIG_ETRAX_SERIAL_PORT3 - 1 + .enabled = 1, +#ifdef CONFIG_ETRAX_SERIAL_PORT3_DMA4_OUT + .dma_out_enabled = 1, +#else + .dma_out_enabled = 0, +#endif +#ifdef CONFIG_ETRAX_SERIAL_PORT3_DMA5_IN + .dma_in_enabled = 1, #else - 0 + .dma_in_enabled = 0 +#endif +#else + .enabled = 0, + .dma_out_enabled = 0, + .dma_in_enabled = 0 #endif } /* ttyS3 */ #endif @@ -616,6 +796,9 @@ #define NR_PORTS (sizeof(rs_table)/sizeof(struct e100_serial)) + +static struct termios *serial_termios[NR_PORTS]; +static struct termios *serial_termios_locked[NR_PORTS]; #ifdef CONFIG_ETRAX_SERIAL_FAST_TIMER static struct fast_timer fast_timers[NR_PORTS]; #endif @@ -652,6 +835,9 @@ #if defined(CONFIG_ETRAX_RS485_ON_PA) static int rs485_pa_bit = CONFIG_ETRAX_RS485_ON_PA_BIT; #endif +#if defined(CONFIG_ETRAX_RS485_ON_PORT_G) +static int rs485_port_g_bit = CONFIG_ETRAX_RS485_ON_PORT_G_BIT; +#endif #endif /* Info and macros needed for each ports extra control/status signals. */ @@ -761,7 +947,7 @@ # endif #endif -#define SER0_PB_BITSUM (CONFIG_ETRAX_SER1_DTR_ON_PB_BIT+CONFIG_ETRAX_SER1_RI_ON_PB_BIT+CONFIG_ETRAX_SER1_DSR_ON_PB_BIT+CONFIG_ETRAX_SER1_CD_ON_PB_BIT) +#define SER1_PB_BITSUM (CONFIG_ETRAX_SER1_DTR_ON_PB_BIT+CONFIG_ETRAX_SER1_RI_ON_PB_BIT+CONFIG_ETRAX_SER1_DSR_ON_PB_BIT+CONFIG_ETRAX_SER1_CD_ON_PB_BIT) #if SER1_PB_BITSUM != -4 # if CONFIG_ETRAX_SER1_DTR_ON_PB_BIT == -1 @@ -1081,15 +1267,9 @@ }; #endif /* !CONFIG_ETRAX_SERX_DTR_RI_DSR_CD_MIXED */ -#if defined(CONFIG_ETRAX_RS485) && defined(CONFIG_ETRAX_RS485_ON_PA) -unsigned char rs485_pa_port = CONFIG_ETRAX_RS485_ON_PA_BIT; -#endif - - #define E100_RTS_MASK 0x20 #define E100_CTS_MASK 0x40 - /* All serial port signals are active low: * active = 0 -> 3.3V to RS-232 driver -> -12V on RS-232 level * inactive = 1 -> 0V to RS-232 driver -> +12V on RS-232 level @@ -1151,6 +1331,10 @@ /* calc timeout */ info->char_time_usec = ((bits * 1000000) / info->baud) + 1; + info->flush_time_usec = 4*info->char_time_usec; + if (info->flush_time_usec < MIN_FLUSH_TIME_USEC) + info->flush_time_usec = MIN_FLUSH_TIME_USEC; + } /* @@ -1250,9 +1434,13 @@ e100_rts(struct e100_serial *info, int set) { #ifndef CONFIG_SVINTO_SIM + unsigned long flags; + save_flags(flags); + cli(); info->rx_ctrl &= ~E100_RTS_MASK; info->rx_ctrl |= (set ? 0 : E100_RTS_MASK); /* RTS is active low */ info->port[REG_REC_CTRL] = info->rx_ctrl; + restore_flags(flags); #ifdef SERIAL_DEBUG_IO printk("ser%i rts %i\n", info->line, set); #endif @@ -1326,6 +1514,7 @@ #ifdef SERIAL_DEBUG_INTR printk("rxdma_irq(%d): 0\n",info->line); #endif + DINTR1(DEBUG_LOG(info->line,"IRQ disable_rxdma_irq %i\n", info->line)); *R_IRQ_MASK2_CLR = (info->irq << 2) | (info->irq << 3); } @@ -1335,30 +1524,33 @@ #ifdef SERIAL_DEBUG_INTR printk("rxdma_irq(%d): 1\n",info->line); #endif + DINTR1(DEBUG_LOG(info->line,"IRQ enable_rxdma_irq %i\n", info->line)); *R_IRQ_MASK2_SET = (info->irq << 2) | (info->irq << 3); } /* the tx DMA uses only dma_descr interrupt */ -static inline void +static _INLINE_ void e100_disable_txdma_irq(struct e100_serial *info) { #ifdef SERIAL_DEBUG_INTR printk("txdma_irq(%d): 0\n",info->line); #endif + DINTR1(DEBUG_LOG(info->line,"IRQ disable_txdma_irq %i\n", info->line)); *R_IRQ_MASK2_CLR = info->irq; } -static inline void +static _INLINE_ void e100_enable_txdma_irq(struct e100_serial *info) { #ifdef SERIAL_DEBUG_INTR printk("txdma_irq(%d): 1\n",info->line); #endif + DINTR1(DEBUG_LOG(info->line,"IRQ enable_txdma_irq %i\n", info->line)); *R_IRQ_MASK2_SET = info->irq; } -static inline void +static _INLINE_ void e100_disable_txdma_channel(struct e100_serial *info) { unsigned long flags; @@ -1367,32 +1559,46 @@ * ( set to something other then serialX) */ save_flags(flags); - cli(); + cli(); + DFLOW(DEBUG_LOG(info->line, "disable_txdma_channel %i\n", info->line)); if (info->line == 0) { - genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, dma6); - genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma6, unused); + if ((genconfig_shadow & IO_MASK(R_GEN_CONFIG, dma6)) == + IO_STATE(R_GEN_CONFIG, dma6, serial0)) { + genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, dma6); + genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma6, unused); + } } else if (info->line == 1) { - genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, dma8); - genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma8, usb); + if ((genconfig_shadow & IO_MASK(R_GEN_CONFIG, dma8)) == + IO_STATE(R_GEN_CONFIG, dma8, serial1)) { + genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, dma8); + genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma8, usb); + } } else if (info->line == 2) { - genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, dma2); - genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma2, par0); + if ((genconfig_shadow & IO_MASK(R_GEN_CONFIG, dma2)) == + IO_STATE(R_GEN_CONFIG, dma2, serial2)) { + genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, dma2); + genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma2, par0); + } } else if (info->line == 3) { - genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, dma4); - genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma4, par1); + if ((genconfig_shadow & IO_MASK(R_GEN_CONFIG, dma4)) == + IO_STATE(R_GEN_CONFIG, dma4, serial3)) { + genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, dma4); + genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma4, par1); + } } *R_GEN_CONFIG = genconfig_shadow; restore_flags(flags); } -static inline void +static _INLINE_ void e100_enable_txdma_channel(struct e100_serial *info) { unsigned long flags; save_flags(flags); - cli(); + cli(); + DFLOW(DEBUG_LOG(info->line, "enable_txdma_channel %i\n", info->line)); /* Enable output DMA channel for the serial port in question */ if (info->line == 0) { genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, dma6); @@ -1411,6 +1617,70 @@ restore_flags(flags); } +static _INLINE_ void +e100_disable_rxdma_channel(struct e100_serial *info) +{ + unsigned long flags; + + /* Disable input DMA channel for the serial port in question + * ( set to something other then serialX) + */ + save_flags(flags); + cli(); + if (info->line == 0) { + if ((genconfig_shadow & IO_MASK(R_GEN_CONFIG, dma7)) == + IO_STATE(R_GEN_CONFIG, dma7, serial0)) { + genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, dma7); + genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma7, unused); + } + } else if (info->line == 1) { + if ((genconfig_shadow & IO_MASK(R_GEN_CONFIG, dma9)) == + IO_STATE(R_GEN_CONFIG, dma9, serial1)) { + genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, dma9); + genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma9, usb); + } + } else if (info->line == 2) { + if ((genconfig_shadow & IO_MASK(R_GEN_CONFIG, dma3)) == + IO_STATE(R_GEN_CONFIG, dma3, serial2)) { + genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, dma3); + genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma3, par0); + } + } else if (info->line == 3) { + if ((genconfig_shadow & IO_MASK(R_GEN_CONFIG, dma5)) == + IO_STATE(R_GEN_CONFIG, dma5, serial3)) { + genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, dma5); + genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma5, par1); + } + } + *R_GEN_CONFIG = genconfig_shadow; + restore_flags(flags); +} + + +static _INLINE_ void +e100_enable_rxdma_channel(struct e100_serial *info) +{ + unsigned long flags; + + save_flags(flags); + cli(); + /* Enable input DMA channel for the serial port in question */ + if (info->line == 0) { + genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, dma7); + genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma7, serial0); + } else if (info->line == 1) { + genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, dma9); + genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma9, serial1); + } else if (info->line == 2) { + genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, dma3); + genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma3, serial2); + } else if (info->line == 3) { + genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, dma5); + genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma5, serial3); + } + *R_GEN_CONFIG = genconfig_shadow; + restore_flags(flags); +} #ifdef SERIAL_HANDLE_EARLY_ERRORS /* in order to detect and fix errors on the first byte @@ -1422,6 +1692,7 @@ #ifdef SERIAL_DEBUG_INTR printk("ser_irq(%d): 0\n",info->line); #endif + DINTR1(DEBUG_LOG(info->line,"IRQ disable data_irq %i\n", info->line)); *R_IRQ_MASK1_CLR = (1U << (8+2*info->line)); } @@ -1434,10 +1705,49 @@ (8+2*info->line), (1U << (8+2*info->line))); #endif + DINTR1(DEBUG_LOG(info->line,"IRQ enable data_irq %i\n", info->line)); *R_IRQ_MASK1_SET = (1U << (8+2*info->line)); } #endif +static inline void +e100_disable_serial_tx_ready_irq(struct e100_serial *info) +{ +#ifdef SERIAL_DEBUG_INTR + printk("ser_tx_irq(%d): 0\n",info->line); +#endif + DINTR1(DEBUG_LOG(info->line,"IRQ disable ready_irq %i\n", info->line)); + *R_IRQ_MASK1_CLR = (1U << (8+1+2*info->line)); +} + +static inline void +e100_enable_serial_tx_ready_irq(struct e100_serial *info) +{ +#ifdef SERIAL_DEBUG_INTR + printk("ser_tx_irq(%d): 1\n",info->line); + printk("**** %d = %d\n", + (8+1+2*info->line), + (1U << (8+1+2*info->line))); +#endif + DINTR2(DEBUG_LOG(info->line,"IRQ enable ready_irq %i\n", info->line)); + *R_IRQ_MASK1_SET = (1U << (8+1+2*info->line)); +} + +static inline void e100_enable_rx_irq(struct e100_serial *info) +{ + if (info->uses_dma_in) + e100_enable_rxdma_irq(info); + else + e100_enable_serial_data_irq(info); +} +static inline void e100_disable_rx_irq(struct e100_serial *info) +{ + if (info->uses_dma_in) + e100_disable_rxdma_irq(info); + else + e100_disable_serial_data_irq(info); +} + #if defined(CONFIG_ETRAX_RS485) /* Enable RS-485 mode on selected port. This is UGLY. */ static int @@ -1448,10 +1758,23 @@ #if defined(CONFIG_ETRAX_RS485_ON_PA) *R_PORT_PA_DATA = port_pa_data_shadow |= (1 << rs485_pa_bit); #endif +#if defined(CONFIG_ETRAX_RS485_ON_PORT_G) + REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow, + rs485_port_g_bit, 1); +#endif +#if defined(CONFIG_ETRAX_RS485_LTC1387) + REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow, + CONFIG_ETRAX_RS485_LTC1387_DXEN_PORT_G_BIT, 1); + REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow, + CONFIG_ETRAX_RS485_LTC1387_RXEN_PORT_G_BIT, 1); +#endif info->rs485.rts_on_send = 0x01 & r->rts_on_send; info->rs485.rts_after_sent = 0x01 & r->rts_after_sent; - info->rs485.delay_rts_before_send = r->delay_rts_before_send; + if (r->delay_rts_before_send >= 1000) + info->rs485.delay_rts_before_send = 1000; + else + info->rs485.delay_rts_before_send = r->delay_rts_before_send; info->rs485.enabled = r->enabled; /* printk("rts: on send = %i, after = %i, enabled = %i", info->rs485.rts_on_send, @@ -1491,7 +1814,7 @@ e100_rts(info, info->rs485.rts_after_sent); #if defined(CONFIG_ETRAX_RS485_DISABLE_RECEIVER) e100_enable_rx(info); - e100_enable_rxdma_irq(info); + e100_enable_rx_irq(info); #endif } #endif @@ -1513,8 +1836,12 @@ if (info) { unsigned long flags; unsigned long xoff; - + save_flags(flags); cli(); + DFLOW(DEBUG_LOG(info->line, "XOFF rs_stop xmit %i\n", + CIRC_CNT(info->xmit.head, + info->xmit.tail,SERIAL_XMIT_SIZE))); + xoff = IO_FIELD(R_SERIAL0_XOFF, xoff_char, STOP_CHAR(info->tty)); xoff |= IO_STATE(R_SERIAL0_XOFF, tx_stop, stop); if (tty->termios->c_iflag & IXON ) { @@ -1535,6 +1862,9 @@ unsigned long xoff; save_flags(flags); cli(); + DFLOW(DEBUG_LOG(info->line, "XOFF rs_start xmit %i\n", + CIRC_CNT(info->xmit.head, + info->xmit.tail,SERIAL_XMIT_SIZE))); xoff = IO_FIELD(R_SERIAL0_XOFF, xoff_char, STOP_CHAR(tty)); xoff |= IO_STATE(R_SERIAL0_XOFF, tx_stop, enable); if (tty->termios->c_iflag & IXON ) { @@ -1542,6 +1872,9 @@ } *((unsigned long *)&info->port[REG_XOFF]) = xoff; + if (!info->uses_dma_out && + info->xmit.head != info->xmit.tail && info->xmit.buf) + e100_enable_serial_tx_ready_irq(info); restore_flags(flags); } @@ -1576,6 +1909,8 @@ rs_sched_event(struct e100_serial *info, int event) { + if (info->event & (1 << event)) + return; info->event |= 1 << event; schedule_work(&info->work); } @@ -1592,7 +1927,7 @@ */ static void -transmit_chars(struct e100_serial *info) +transmit_chars_dma(struct e100_serial *info) { unsigned int c, sentl; struct etrax_dma_descr *descr; @@ -1600,11 +1935,11 @@ #ifdef CONFIG_SVINTO_SIM /* This will output too little if tail is not 0 always since * we don't reloop to send the other part. Anyway this SHOULD be a - * no-op - transmit_chars would never really be called during sim + * no-op - transmit_chars_dma would never really be called during sim * since rs_write does not write into the xmit buffer then. */ if (info->xmit.tail) - printk("Error in serial.c:transmit_chars(), tail!=0\n"); + printk("Error in serial.c:transmit_chars-dma(), tail!=0\n"); if (info->xmit.head != info->xmit.tail) { SIMCOUT(info->xmit.buf + info->xmit.tail, CIRC_CNT(info->xmit.head, @@ -1626,7 +1961,7 @@ #endif if (!info->tr_running) { /* weirdo... we shouldn't get here! */ - printk(KERN_WARNING "Achtung: transmit_chars with !tr_running\n"); + printk(KERN_WARNING "Achtung: transmit_chars_dma with !tr_running\n"); return; } @@ -1642,6 +1977,8 @@ /* otherwise we find the amount of data sent here */ sentl = descr->hw_len; + DFLOW(DEBUG_LOG(info->line, "TX %i done\n", sentl)); + /* update stats */ info->icount.tx += sentl; @@ -1659,6 +1996,13 @@ c = CIRC_CNT_TO_END(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE); + /* Don't send all in one DMA transfer - divide it so we wake up + * application before all is sent + */ + + if (c >= 4*WAKEUP_CHARS) + c = c/2; + if (c <= 0) { /* our job here is done, don't schedule any new DMA transfer */ info->tr_running = 0; @@ -1678,17 +2022,17 @@ /* ok we can schedule a dma send of c chars starting at info->xmit.tail */ /* set up the descriptor correctly for output */ - + DFLOW(DEBUG_LOG(info->line, "TX %i\n", c)); descr->ctrl = d_int | d_eol | d_wait; /* Wait needed for tty_wait_until_sent() */ descr->sw_len = c; descr->buf = virt_to_phys(info->xmit.buf + info->xmit.tail); descr->status = 0; *info->ofirstadr = virt_to_phys(descr); /* write to R_DMAx_FIRST */ - *info->ocmdadr = 1; /* dma command start -> R_DMAx_CMD */ + *info->ocmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, start); /* DMA is now running (hopefully) */ -} /* transmit_chars */ +} /* transmit_chars_dma */ static void start_transmit(struct e100_serial *info) @@ -1702,15 +2046,17 @@ info->tr_descr.hw_len = 0; info->tr_descr.status = 0; info->tr_running = 1; - - transmit_chars(info); + if (info->uses_dma_out) + transmit_chars_dma(info); + else + e100_enable_serial_tx_ready_irq(info); } /* start_transmit */ #ifdef CONFIG_ETRAX_SERIAL_FAST_TIMER static int serial_fast_timer_started = 0; static int serial_fast_timer_expired = 0; static void flush_timeout_function(unsigned long data); -#define START_FLUSH_FAST_TIMER(info, string) {\ +#define START_FLUSH_FAST_TIMER_TIME(info, string, usec) {\ unsigned long timer_flags; \ save_flags(timer_flags); \ cli(); \ @@ -1721,7 +2067,7 @@ start_one_shot_timer(&fast_timers[info->line], \ flush_timeout_function, \ (unsigned long)info, \ - info->char_time_usec*4, \ + (usec), \ string); \ } \ else { \ @@ -1729,8 +2075,10 @@ } \ restore_flags(timer_flags); \ } +#define START_FLUSH_FAST_TIMER(info, string) START_FLUSH_FAST_TIMER_TIME(info, string, info->flush_time_usec) #else +#define START_FLUSH_FAST_TIMER_TIME(info, string, usec) #define START_FLUSH_FAST_TIMER(info, string) #endif @@ -1775,17 +2123,26 @@ add_char_and_flag(struct e100_serial *info, unsigned char data, unsigned char flag) { struct etrax_recv_buffer *buffer; + if (info->uses_dma_in) { + if (!(buffer = alloc_recv_buffer(4))) + return 0; - if (!(buffer = alloc_recv_buffer(4))) - return 0; - - buffer->length = 1; - buffer->error = flag; - buffer->buffer[0] = data; + buffer->length = 1; + buffer->error = flag; + buffer->buffer[0] = data; - append_recv_buffer(info, buffer); + append_recv_buffer(info, buffer); - info->icount.rx++; + info->icount.rx++; + } else { + struct tty_struct *tty = info->tty; + *tty->flip.char_buf_ptr = data; + *tty->flip.flag_buf_ptr = flag; + tty->flip.flag_buf_ptr++; + tty->flip.char_buf_ptr++; + tty->flip.count++; + info->icount.rx++; + } return 1; } @@ -1847,7 +2204,14 @@ /* Reset the status information */ descr->status = 0; - DEBUG_LOG(info->line, "recvl %lu\n", recvl); + DFLOW( DEBUG_LOG(info->line, "RX %lu\n", recvl); + if (info->tty->stopped) { + unsigned char *buf = phys_to_virt(descr->buf); + DEBUG_LOG(info->line, "rx 0x%02X\n", buf[0]); + DEBUG_LOG(info->line, "rx 0x%02X\n", buf[1]); + DEBUG_LOG(info->line, "rx 0x%02X\n", buf[2]); + } + ); /* update stats */ info->icount.rx += recvl; @@ -1859,7 +2223,7 @@ } static _INLINE_ void -receive_chars(struct e100_serial *info) +receive_chars_dma(struct e100_serial *info) { struct tty_struct *tty; unsigned char rstat; @@ -1881,7 +2245,8 @@ return; #ifdef SERIAL_HANDLE_EARLY_ERRORS - e100_enable_serial_data_irq(info); + if (info->uses_dma_in) + e100_enable_serial_data_irq(info); #endif if (info->errorcode == ERRCODE_INSERT_BREAK) @@ -1891,6 +2256,9 @@ /* Read the status register to detect errors */ rstat = info->port[REG_STATUS]; + if (rstat & IO_MASK(R_SERIAL0_STATUS, xoff_detect) ) { + DFLOW(DEBUG_LOG(info->line, "XOFF detect stat %x\n", rstat)); + } if (rstat & SER_ERROR_MASK) { /* If we got an error, we must reset it by reading the @@ -1959,16 +2327,16 @@ */ return; #endif - - /* reset the input dma channel to be sure it works */ - - *info->icmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, reset); - while (IO_EXTRACT(R_DMA_CH6_CMD, cmd, *info->icmdadr) == - IO_STATE_VALUE(R_DMA_CH6_CMD, cmd, reset)); - info->tty->flip.count = 0; + if (info->uses_dma_in) { + /* reset the input dma channel to be sure it works */ - start_recv_dma(info); + *info->icmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, reset); + while (IO_EXTRACT(R_DMA_CH6_CMD, cmd, *info->icmdadr) == + IO_STATE_VALUE(R_DMA_CH6_CMD, cmd, reset)); + + start_recv_dma(info); + } } @@ -2014,27 +2382,27 @@ for (i = 0; i < NR_PORTS; i++) { info = rs_table + i; - if (!info->enabled || !info->uses_dma) + if (!info->enabled || !info->uses_dma_out) continue; /* check for dma_descr (don't need to check for dma_eop in output dma for serial */ if (ireg & info->irq) { handled = 1; /* we can send a new dma bunch. make it so. */ - DEBUG_LOG(info->line, "tr_interrupt %i\n", i); + DINTR2(DEBUG_LOG(info->line, "tr_interrupt %i\n", i)); /* Read jiffies_usec first, * we want this time to be as late as possible */ PROCSTAT(ser_stat[info->line].tx_dma_ints++); info->last_tx_active_usec = GET_JIFFIES_USEC(); info->last_tx_active = jiffies; - transmit_chars(info); + transmit_chars_dma(info); } /* FIXME: here we should really check for a change in the status lines and if so call status_handle(info) */ } return IRQ_RETVAL(handled); -} +} /* tr_interrupt */ /* dma input channel interrupt handler */ @@ -2054,7 +2422,7 @@ const char *s = "What? rec_interrupt in simulator??\n"; SIMCOUT(s,strlen(s)); } - return; + return IRQ_HANDLED; #endif /* find out the line that caused this irq and get it from rs_table */ @@ -2063,20 +2431,20 @@ for (i = 0; i < NR_PORTS; i++) { info = rs_table + i; - if (!info->enabled || !info->uses_dma) + if (!info->enabled || !info->uses_dma_in) continue; /* check for both dma_eop and dma_descr for the input dma channel */ if (ireg & ((info->irq << 2) | (info->irq << 3))) { handled = 1; /* we have received something */ - receive_chars(info); + receive_chars_dma(info); } /* FIXME: here we should really check for a change in the status lines and if so call status_handle(info) */ } return IRQ_RETVAL(handled); -} +} /* rec_interrupt */ static _INLINE_ int force_eop_if_needed(struct e100_serial *info) @@ -2116,20 +2484,21 @@ if (!info->forced_eop) { info->forced_eop = 1; PROCSTAT(ser_stat[info->line].timeout_flush_cnt++); - DEBUG_LOG(info->line, "timeout EOP %i\n", info->line); + TIMERD(DEBUG_LOG(info->line, "timeout EOP %i\n", info->line)); FORCE_EOP(info); } return 1; } -static _INLINE_ void +extern _INLINE_ void flush_to_flip_buffer(struct e100_serial *info) { struct tty_struct *tty; struct etrax_recv_buffer *buffer; unsigned int length; unsigned long flags; + int max_flip_size; if (!info->first_recv_buffer) return; @@ -2143,12 +2512,46 @@ } length = tty->flip.count; + /* Don't flip more than the ldisc has room for. + * The return value from ldisc.receive_room(tty) - might not be up to + * date, the previous flip of up to TTY_FLIPBUF_SIZE might be on the + * processed and not accounted for yet. + * Since we use DMA, 1 SERIAL_DESCR_BUF_SIZE could be on the way. + * Lets buffer data here and let flow control take care of it. + * Since we normally flip large chunks, the ldisc don't react + * with throttle until too late if we flip to much. + */ + max_flip_size = tty->ldisc.receive_room(tty); + if (max_flip_size < 0) + max_flip_size = 0; + if (max_flip_size <= (TTY_FLIPBUF_SIZE + /* Maybe not accounted for */ + length + info->recv_cnt + /* We have this queued */ + 2*SERIAL_DESCR_BUF_SIZE + /* This could be on the way */ + TTY_THRESHOLD_THROTTLE)) { /* Some slack */ + /* check TTY_THROTTLED first so it indicates our state */ + if (!test_and_set_bit(TTY_THROTTLED, &tty->flags)) { + DFLOW(DEBUG_LOG(info->line,"flush_to_flip throttles room %lu\n", max_flip_size)); + rs_throttle(tty); + } +#if 0 + else if (max_flip_size <= (TTY_FLIPBUF_SIZE + /* Maybe not accounted for */ + length + info->recv_cnt + /* We have this queued */ + SERIAL_DESCR_BUF_SIZE + /* This could be on the way */ + TTY_THRESHOLD_THROTTLE)) { /* Some slack */ + DFLOW(DEBUG_LOG(info->line,"flush_to_flip throttles again! %lu\n", max_flip_size)); + rs_throttle(tty); + } +#endif + } + + if (max_flip_size > TTY_FLIPBUF_SIZE) + max_flip_size = TTY_FLIPBUF_SIZE; - while ((buffer = info->first_recv_buffer) && length < TTY_FLIPBUF_SIZE) { + while ((buffer = info->first_recv_buffer) && length < max_flip_size) { unsigned int count = buffer->length; - if (length + count > TTY_FLIPBUF_SIZE) - count = TTY_FLIPBUF_SIZE - length; + if (length + count > max_flip_size) + count = max_flip_size - length; memcpy(tty->flip.char_buf_ptr + length, buffer->buffer, count); memset(tty->flip.flag_buf_ptr + length, TTY_NORMAL, count); @@ -2156,6 +2559,7 @@ length += count; info->recv_cnt -= count; + DFLIP(DEBUG_LOG(info->line,"flip: %i\n", length)); if (count == buffer->length) { info->first_recv_buffer = buffer->next; @@ -2171,9 +2575,30 @@ info->last_recv_buffer = NULL; tty->flip.count = length; - + DFLIP(if (tty->ldisc.chars_in_buffer(tty) > 3500) { + DEBUG_LOG(info->line, "ldisc %lu\n", + tty->ldisc.chars_in_buffer(tty)); + DEBUG_LOG(info->line, "flip.count %lu\n", + tty->flip.count); + } + ); restore_flags(flags); + DFLIP( + if (1) { + + if (test_bit(TTY_DONT_FLIP, &tty->flags)) { + DEBUG_LOG(info->line, "*** TTY_DONT_FLIP set flip.count %i ***\n", tty->flip.count); + DEBUG_LOG(info->line, "*** recv_cnt %i\n", info->recv_cnt); + } else { + } + DEBUG_LOG(info->line, "*** rxtot %i\n", info->icount.rx); + DEBUG_LOG(info->line, "ldisc %lu\n", tty->ldisc.chars_in_buffer(tty)); + DEBUG_LOG(info->line, "room %lu\n", tty->ldisc.receive_room(tty)); + } + + ); + /* this includes a check for low-latency */ tty_flip_buffer_push(tty); } @@ -2181,12 +2606,19 @@ static _INLINE_ void check_flush_timeout(struct e100_serial *info) { - force_eop_if_needed(info); - + /* Flip what we've got (if we can) */ flush_to_flip_buffer(info); + /* We might need to flip later, but not to fast + * since the system is busy processing input... */ if (info->first_recv_buffer) - START_FLUSH_FAST_TIMER(info, "flip"); + START_FLUSH_FAST_TIMER_TIME(info, "flip", 2000); + + /* Force eop last, since data might have come while we're processing + * and if we started the slow timer above, we won't start a fast + * below. + */ + force_eop_if_needed(info); } #ifdef CONFIG_ETRAX_SERIAL_FAST_TIMER @@ -2222,7 +2654,7 @@ for (i = 0; i < NR_PORTS; i++) { info = rs_table + i; - if (info->uses_dma) + if (info->uses_dma_in) check_flush_timeout(info); } @@ -2301,14 +2733,158 @@ */ -extern irqreturn_t _INLINE_ handle_ser_interrupt(struct e100_serial *info) +extern _INLINE_ +struct e100_serial * handle_ser_rx_interrupt_no_dma(struct e100_serial *info) { - unsigned char rstat = info->port[REG_STATUS]; + unsigned long data_read; + struct tty_struct *tty = info->tty; + + if (!tty) { + printk("!NO TTY!\n"); + return info; + } + if (tty->flip.count >= TTY_FLIPBUF_SIZE - TTY_THRESHOLD_THROTTLE) { + /* check TTY_THROTTLED first so it indicates our state */ + if (!test_and_set_bit(TTY_THROTTLED, &tty->flags)) { + DFLOW(DEBUG_LOG(info->line, "rs_throttle flip.count: %i\n", tty->flip.count)); + rs_throttle(tty); + } + } + if (tty->flip.count >= TTY_FLIPBUF_SIZE) { + DEBUG_LOG(info->line, "force FLIP! %i\n", tty->flip.count); + tty->flip.work.func((void *) tty); + if (tty->flip.count >= TTY_FLIPBUF_SIZE) { + DEBUG_LOG(info->line, "FLIP FULL! %i\n", tty->flip.count); + return info; /* if TTY_DONT_FLIP is set */ + } + } + /* Read data and status at the same time */ + data_read = *((unsigned long *)&info->port[REG_DATA_STATUS32]); +more_data: + if (data_read & IO_MASK(R_SERIAL0_READ, xoff_detect) ) { + DFLOW(DEBUG_LOG(info->line, "XOFF detect\n", 0)); + } + DINTR2(DEBUG_LOG(info->line, "ser_rx %c\n", IO_EXTRACT(R_SERIAL0_READ, data_in, data_read))); + + if (data_read & ( IO_MASK(R_SERIAL0_READ, framing_err) | + IO_MASK(R_SERIAL0_READ, par_err) | + IO_MASK(R_SERIAL0_READ, overrun) )) { + /* An error */ + info->last_rx_active_usec = GET_JIFFIES_USEC(); + info->last_rx_active = jiffies; + DINTR1(DEBUG_LOG(info->line, "ser_rx err stat_data %04X\n", data_read)); + DLOG_INT_TRIG( + if (!log_int_trig1_pos) { + log_int_trig1_pos = log_int_pos; + log_int(rdpc(), 0, 0); + } + ); + + + if ( ((data_read & IO_MASK(R_SERIAL0_READ, data_in)) == 0) && + (data_read & IO_MASK(R_SERIAL0_READ, framing_err)) ) { + /* Most likely a break, but we get interrupts over and + * over again. + */ + + if (!info->break_detected_cnt) { + DEBUG_LOG(info->line, "#BRK start\n", 0); + } + if (data_read & IO_MASK(R_SERIAL0_READ, rxd)) { + /* The RX pin is high now, so the break + * must be over, but.... + * we can't really know if we will get another + * last byte ending the break or not. + * And we don't know if the byte (if any) will + * have an error or look valid. + */ + DEBUG_LOG(info->line, "# BL BRK\n", 0); + info->errorcode = ERRCODE_INSERT_BREAK; + } + info->break_detected_cnt++; + } else { + /* The error does not look like a break, but could be + * the end of one + */ + if (info->break_detected_cnt) { + DEBUG_LOG(info->line, "EBRK %i\n", info->break_detected_cnt); + info->errorcode = ERRCODE_INSERT_BREAK; + } else { + if (info->errorcode == ERRCODE_INSERT_BREAK) { + info->icount.brk++; + *tty->flip.char_buf_ptr = 0; + *tty->flip.flag_buf_ptr = TTY_BREAK; + tty->flip.flag_buf_ptr++; + tty->flip.char_buf_ptr++; + tty->flip.count++; + info->icount.rx++; + } + *tty->flip.char_buf_ptr = IO_EXTRACT(R_SERIAL0_READ, data_in, data_read); + + if (data_read & IO_MASK(R_SERIAL0_READ, par_err)) { + info->icount.parity++; + *tty->flip.flag_buf_ptr = TTY_PARITY; + } else if (data_read & IO_MASK(R_SERIAL0_READ, overrun)) { + info->icount.overrun++; + *tty->flip.flag_buf_ptr = TTY_OVERRUN; + } else if (data_read & IO_MASK(R_SERIAL0_READ, framing_err)) { + info->icount.frame++; + *tty->flip.flag_buf_ptr = TTY_FRAME; + } + info->errorcode = 0; + } + info->break_detected_cnt = 0; + } + } else if (data_read & IO_MASK(R_SERIAL0_READ, data_avail)) { + /* No error */ + DLOG_INT_TRIG( + if (!log_int_trig1_pos) { + if (log_int_pos >= log_int_size) { + log_int_pos = 0; + } + log_int_trig0_pos = log_int_pos; + log_int(rdpc(), 0, 0); + } + ); + *tty->flip.char_buf_ptr = IO_EXTRACT(R_SERIAL0_READ, data_in, data_read); + *tty->flip.flag_buf_ptr = 0; + } else { + DEBUG_LOG(info->line, "ser_rx int but no data_avail %08lX\n", data_read); + } + + + tty->flip.flag_buf_ptr++; + tty->flip.char_buf_ptr++; + tty->flip.count++; + info->icount.rx++; + data_read = *((unsigned long *)&info->port[REG_DATA_STATUS32]); + if (data_read & IO_MASK(R_SERIAL0_READ, data_avail)) { + DEBUG_LOG(info->line, "ser_rx %c in loop\n", IO_EXTRACT(R_SERIAL0_READ, data_in, data_read)); + goto more_data; + } + + tty_flip_buffer_push(info->tty); + return info; +} + +extern _INLINE_ +struct e100_serial* handle_ser_rx_interrupt(struct e100_serial *info) +{ + unsigned char rstat; #ifdef SERIAL_DEBUG_INTR printk("Interrupt from serport %d\n", i); #endif /* DEBUG_LOG(info->line, "ser_interrupt stat %03X\n", rstat | (i << 8)); */ + if (!info->uses_dma_in) { + return handle_ser_rx_interrupt_no_dma(info); + } + /* DMA is used */ + rstat = info->port[REG_STATUS]; + if (rstat & IO_MASK(R_SERIAL0_STATUS, xoff_detect) ) { + DFLOW(DEBUG_LOG(info->line, "XOFF detect\n", 0)); + } + if (rstat & SER_ERROR_MASK) { unsigned char data; @@ -2318,7 +2894,8 @@ * data_in field */ data = info->port[REG_DATA]; - + DINTR1(DEBUG_LOG(info->line, "ser_rx! %c\n", data)); + DINTR1(DEBUG_LOG(info->line, "ser_rx err stat %02X\n", rstat)); if (!data && (rstat & SER_FRAMING_ERR_MASK)) { /* Most likely a break, but we get interrupts over and * over again. @@ -2347,15 +2924,22 @@ DEBUG_LOG(info->line, "EBRK %i\n", info->break_detected_cnt); info->errorcode = ERRCODE_INSERT_BREAK; } else { - if (info->errorcode == ERRCODE_INSERT_BREAK) + if (info->errorcode == ERRCODE_INSERT_BREAK) { + info->icount.brk++; add_char_and_flag(info, '\0', TTY_BREAK); + } - if (rstat & SER_PAR_ERR_MASK) + if (rstat & SER_PAR_ERR_MASK) { + info->icount.parity++; add_char_and_flag(info, data, TTY_PARITY); - else if (rstat & SER_OVERRUN_MASK) + } else if (rstat & SER_OVERRUN_MASK) { + info->icount.overrun++; add_char_and_flag(info, data, TTY_OVERRUN); - else if (rstat & SER_FRAMING_ERR_MASK) + } else if (rstat & SER_FRAMING_ERR_MASK) { + info->icount.frame++; add_char_and_flag(info, data, TTY_FRAME); + } + info->errorcode = 0; } info->break_detected_cnt = 0; @@ -2379,7 +2963,7 @@ if (elapsed_usec < 2*info->char_time_usec) { DEBUG_LOG(info->line, "FBRK %i\n", info->line); /* Report as BREAK (error) and let - * receive_chars() handle it + * receive_chars_dma() handle it */ info->errorcode = ERRCODE_SET_BREAK; } else { @@ -2392,38 +2976,196 @@ printk("** OK, disabling ser_interrupts\n"); #endif e100_disable_serial_data_irq(info); - + DINTR2(DEBUG_LOG(info->line, "ser_rx OK %d\n", info->line)); info->break_detected_cnt = 0; PROCSTAT(ser_stat[info->line].ser_ints_ok_cnt++); - DEBUG_LOG(info->line, "ser_int OK %d\n", info->line); } - /* Restarting the DMA never hurts */ *info->icmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, restart); START_FLUSH_FAST_TIMER(info, "ser_int"); - return IRQ_HANDLED; -} /* handle_ser_interrupt */ + return info; +} /* handle_ser_rx_interrupt */ + +extern _INLINE_ void handle_ser_tx_interrupt(struct e100_serial *info) +{ + unsigned long flags; + + if (info->x_char) { + unsigned char rstat; + DFLOW(DEBUG_LOG(info->line, "tx_int: xchar 0x%02X\n", info->x_char)); + save_flags(flags); cli(); + rstat = info->port[REG_STATUS]; + DFLOW(DEBUG_LOG(info->line, "stat %x\n", rstat)); + + info->port[REG_TR_DATA] = info->x_char; + info->icount.tx++; + info->x_char = 0; + /* We must enable since it is disabled in ser_interrupt */ + e100_enable_serial_tx_ready_irq(info); + restore_flags(flags); + return; + } + if (info->uses_dma_out) { + unsigned char rstat; + int i; + /* We only use normal tx interrupt when sending x_char */ + DFLOW(DEBUG_LOG(info->line, "tx_int: xchar sent\n", 0)); + save_flags(flags); cli(); + rstat = info->port[REG_STATUS]; + DFLOW(DEBUG_LOG(info->line, "stat %x\n", rstat)); + e100_disable_serial_tx_ready_irq(info); + if (info->tty->stopped) + rs_stop(info->tty); + /* Enable the DMA channel and tell it to continue */ + e100_enable_txdma_channel(info); + /* Wait 12 cycles before doing the DMA command */ + for(i = 6; i > 0; i--) + nop(); + + *info->ocmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, continue); + restore_flags(flags); + return; + } + /* Normal char-by-char interrupt */ + if (info->xmit.head == info->xmit.tail + || info->tty->stopped + || info->tty->hw_stopped) { + DFLOW(DEBUG_LOG(info->line, "tx_int: stopped %i\n", info->tty->stopped)); + e100_disable_serial_tx_ready_irq(info); + info->tr_running = 0; + return; + } + DINTR2(DEBUG_LOG(info->line, "tx_int %c\n", info->xmit.buf[info->xmit.tail])); + /* Send a byte, rs485 timing is critical so turn of ints */ + save_flags(flags); cli(); + info->port[REG_TR_DATA] = info->xmit.buf[info->xmit.tail]; + info->xmit.tail = (info->xmit.tail + 1) & (SERIAL_XMIT_SIZE-1); + info->icount.tx++; + if (info->xmit.head == info->xmit.tail) { +#if defined(CONFIG_ETRAX_RS485) && defined(CONFIG_ETRAX_FAST_TIMER) + if (info->rs485.enabled) { + /* Set a short timer to toggle RTS */ + start_one_shot_timer(&fast_timers_rs485[info->line], + rs485_toggle_rts_timer_function, + (unsigned long)info, + info->char_time_usec*2, + "RS-485"); + } +#endif /* RS485 */ + info->last_tx_active_usec = GET_JIFFIES_USEC(); + info->last_tx_active = jiffies; + e100_disable_serial_tx_ready_irq(info); + info->tr_running = 0; + DFLOW(DEBUG_LOG(info->line, "tx_int: stop2\n", 0)); + } else { + /* We must enable since it is disabled in ser_interrupt */ + e100_enable_serial_tx_ready_irq(info); + } + restore_flags(flags); + + if (CIRC_CNT(info->xmit.head, + info->xmit.tail, + SERIAL_XMIT_SIZE) < WAKEUP_CHARS) + rs_sched_event(info, RS_EVENT_WRITE_WAKEUP); + +} /* handle_ser_tx_interrupt */ +/* result of time measurements: + * RX duration 54-60 us when doing something, otherwise 6-9 us + * ser_int duration: just sending: 8-15 us normally, up to 73 us + */ static irqreturn_t ser_interrupt(int irq, void *dev_id, struct pt_regs *regs) { + static volatile int tx_started = 0; struct e100_serial *info; int i; + unsigned long flags; + unsigned long irq_mask1_rd; + unsigned long data_mask = (1 << (8+2*0)); /* ser0 data_avail */ int handled = 0; + static volatile unsigned long reentered_ready_mask = 0; + save_flags(flags); cli(); + irq_mask1_rd = *R_IRQ_MASK1_RD; + /* First handle all rx interrupts with ints disabled */ + info = rs_table; + irq_mask1_rd &= e100_ser_int_mask; for (i = 0; i < NR_PORTS; i++) { - info = rs_table + i; - - if (!info->enabled || !info->uses_dma) - continue; - - /* Which line caused the irq? */ - if (*R_IRQ_MASK1_RD & (1U << (8+2*info->line))) { + /* Which line caused the data irq? */ + if (irq_mask1_rd & data_mask) { handled = 1; - handle_ser_interrupt(info); + handle_ser_rx_interrupt(info); } + info += 1; + data_mask <<= 2; } + /* Handle tx interrupts with interrupts enabled so we + * can take care of new data interrupts while transmitting + * We protect the tx part with the tx_started flag. + * We disable the tr_ready interrupts we are about to handle and + * unblock the serial interrupt so new serial interrupts may come. + * + * If we get a new interrupt: + * - it migth be due to synchronous serial ports. + * - serial irq will be blocked by general irq handler. + * - async data will be handled above (sync will be ignored). + * - tx_started flag will prevent us from trying to send again and + * we will exit fast - no need to unblock serial irq. + * - Next (sync) serial interrupt handler will be runned with + * disabled interrupt due to restore_flags() at end of function, + * so sync handler will not be preempted or reentered. + */ + if (!tx_started) { + unsigned long ready_mask; + unsigned long + tx_started = 1; + /* Only the tr_ready interrupts left */ + irq_mask1_rd &= (IO_MASK(R_IRQ_MASK1_RD, ser0_ready) | + IO_MASK(R_IRQ_MASK1_RD, ser1_ready) | + IO_MASK(R_IRQ_MASK1_RD, ser2_ready) | + IO_MASK(R_IRQ_MASK1_RD, ser3_ready)); + while (irq_mask1_rd) { + /* Disable those we are about to handle */ + *R_IRQ_MASK1_CLR = irq_mask1_rd; + /* Unblock the serial interrupt */ + *R_VECT_MASK_SET = IO_STATE(R_VECT_MASK_SET, serial, set); + + sti(); + ready_mask = (1 << (8+1+2*0)); /* ser0 tr_ready */ + info = rs_table; + for (i = 0; i < NR_PORTS; i++) { + /* Which line caused the ready irq? */ + if (irq_mask1_rd & ready_mask) { + handled = 1; + handle_ser_tx_interrupt(info); + } + info += 1; + ready_mask <<= 2; + } + /* handle_ser_tx_interrupt enables tr_ready interrupts */ + cli(); + /* Handle reentered TX interrupt */ + irq_mask1_rd = reentered_ready_mask; + } + cli(); + tx_started = 0; + } else { + unsigned long ready_mask; + ready_mask = irq_mask1_rd & (IO_MASK(R_IRQ_MASK1_RD, ser0_ready) | + IO_MASK(R_IRQ_MASK1_RD, ser1_ready) | + IO_MASK(R_IRQ_MASK1_RD, ser2_ready) | + IO_MASK(R_IRQ_MASK1_RD, ser3_ready)); + if (ready_mask) { + reentered_ready_mask |= ready_mask; + /* Disable those we are about to handle */ + *R_IRQ_MASK1_CLR = ready_mask; + DFLOW(DEBUG_LOG(SERIAL_DEBUG_LINE, "ser_int reentered with TX %X\n", ready_mask)); + } + } + + restore_flags(flags); return IRQ_RETVAL(handled); } /* ser_interrupt */ #endif @@ -2489,7 +3231,7 @@ info->xmit.buf = (unsigned char *) xmit_page; #ifdef SERIAL_DEBUG_OPEN - printk("starting up ttyS%d (xmit_buf 0x%p, recv_buf 0x%p)...\n", info->line, info->xmit.buf, info->recv.buf); + printk("starting up ttyS%d (xmit_buf 0x%p)...\n", info->line, info->xmit.buf); #endif #ifdef CONFIG_SVINTO_SIM @@ -2520,24 +3262,39 @@ * Reset the DMA channels and make sure their interrupts are cleared */ - info->uses_dma = 1; - *info->icmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, reset); - *info->ocmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, reset); - - /* Wait until reset cycle is complete */ - while (IO_EXTRACT(R_DMA_CH6_CMD, cmd, *info->icmdadr) == - IO_STATE_VALUE(R_DMA_CH6_CMD, cmd, reset)); + if (info->dma_in_enabled) { + info->uses_dma_in = 1; + e100_enable_rxdma_channel(info); + + *info->icmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, reset); + + /* Wait until reset cycle is complete */ + while (IO_EXTRACT(R_DMA_CH6_CMD, cmd, *info->icmdadr) == + IO_STATE_VALUE(R_DMA_CH6_CMD, cmd, reset)); + + /* Make sure the irqs are cleared */ + *info->iclrintradr = + IO_STATE(R_DMA_CH6_CLR_INTR, clr_descr, do) | + IO_STATE(R_DMA_CH6_CLR_INTR, clr_eop, do); + } else { + e100_disable_rxdma_channel(info); + } - while (IO_EXTRACT(R_DMA_CH6_CMD, cmd, *info->ocmdadr) == - IO_STATE_VALUE(R_DMA_CH6_CMD, cmd, reset)); + if (info->dma_out_enabled) { + info->uses_dma_out = 1; + e100_enable_txdma_channel(info); + *info->ocmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, reset); - /* Make sure the irqs are cleared */ - *info->iclrintradr = - IO_STATE(R_DMA_CH6_CLR_INTR, clr_descr, do) | - IO_STATE(R_DMA_CH6_CLR_INTR, clr_eop, do); - *info->oclrintradr = - IO_STATE(R_DMA_CH6_CLR_INTR, clr_descr, do) | - IO_STATE(R_DMA_CH6_CLR_INTR, clr_eop, do); + while (IO_EXTRACT(R_DMA_CH6_CMD, cmd, *info->ocmdadr) == + IO_STATE_VALUE(R_DMA_CH6_CMD, cmd, reset)); + + /* Make sure the irqs are cleared */ + *info->oclrintradr = + IO_STATE(R_DMA_CH6_CLR_INTR, clr_descr, do) | + IO_STATE(R_DMA_CH6_CLR_INTR, clr_eop, do); + } else { + e100_disable_txdma_channel(info); + } if (info->tty) clear_bit(TTY_IO_ERROR, &info->tty->flags); @@ -2563,9 +3320,10 @@ (void)info->port[REG_DATA]; /* enable the interrupts */ + if (info->uses_dma_out) + e100_enable_txdma_irq(info); - e100_enable_txdma_irq(info); - e100_enable_rxdma_irq(info); + e100_enable_rx_irq(info); info->tr_running = 0; /* to be sure we don't lock up the transmitter */ @@ -2606,20 +3364,28 @@ #ifndef CONFIG_SVINTO_SIM /* shut down the transmitter and receiver */ - + DFLOW(DEBUG_LOG(info->line, "shutdown %i\n", info->line)); e100_disable_rx(info); info->port[REG_TR_CTRL] = (info->tx_ctrl &= ~0x40); - e100_disable_rxdma_irq(info); - e100_disable_txdma_irq(info); - - info->tr_running = 0; - - /* reset both dma channels */ + /* disable interrupts, reset dma channels */ + if (info->uses_dma_in) { + e100_disable_rxdma_irq(info); + *info->icmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, reset); + info->uses_dma_in = 0; + } else { + e100_disable_serial_data_irq(info); + } - *info->icmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, reset); - *info->ocmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, reset); - info->uses_dma = 0; + if (info->uses_dma_out) { + e100_disable_txdma_irq(info); + info->tr_running = 0; + *info->ocmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, reset); + info->uses_dma_out = 0; + } else { + e100_disable_serial_tx_ready_irq(info); + info->tr_running = 0; + } #endif /* CONFIG_SVINTO_SIM */ @@ -2667,7 +3433,7 @@ { unsigned int cflag; unsigned long xoff; - + unsigned long flags; /* first some safety checks */ if (!info->tty || !info->tty->termios) @@ -2676,17 +3442,80 @@ return; cflag = info->tty->termios->c_cflag; - + /* possibly, the tx/rx should be disabled first to do this safely */ /* change baud-rate and write it to the hardware */ - - info->baud = cflag_to_baud(cflag); + if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST) { + /* Special baudrate */ + u32 mask = 0xFF << (info->line*8); /* Each port has 8 bits */ + unsigned long alt_source = + IO_STATE(R_ALT_SER_BAUDRATE, ser0_rec, normal) | + IO_STATE(R_ALT_SER_BAUDRATE, ser0_tr, normal); + /* R_ALT_SER_BAUDRATE selects the source */ + DBAUD(printk("Custom baudrate: baud_base/divisor %lu/%i\n", + (unsigned long)info->baud_base, info->custom_divisor)); + if (info->baud_base == SERIAL_PRESCALE_BASE) { + /* 0, 2-65535 (0=65536) */ + u16 divisor = info->custom_divisor; + /* R_SERIAL_PRESCALE (upper 16 bits of R_CLOCK_PRESCALE) */ + /* baudrate is 3.125MHz/custom_divisor */ + alt_source = + IO_STATE(R_ALT_SER_BAUDRATE, ser0_rec, prescale) | + IO_STATE(R_ALT_SER_BAUDRATE, ser0_tr, prescale); + alt_source = 0x11; + DBAUD(printk("Writing SERIAL_PRESCALE: divisor %i\n", divisor)); + *R_SERIAL_PRESCALE = divisor; + info->baud = SERIAL_PRESCALE_BASE/divisor; + } +#ifdef CONFIG_ETRAX_EXTERN_PB6CLK_ENABLED + else if ((info->baud_base==CONFIG_ETRAX_EXTERN_PB6CLK_FREQ/8 && + info->custom_divisor == 1) || + (info->baud_base==CONFIG_ETRAX_EXTERN_PB6CLK_FREQ && + info->custom_divisor == 8)) { + /* ext_clk selected */ + alt_source = + IO_STATE(R_ALT_SER_BAUDRATE, ser0_rec, extern) | + IO_STATE(R_ALT_SER_BAUDRATE, ser0_tr, extern); + DBAUD(printk("using external baudrate: %lu\n", CONFIG_ETRAX_EXTERN_PB6CLK_FREQ/8)); + info->baud = CONFIG_ETRAX_EXTERN_PB6CLK_FREQ/8; + } + } +#endif + else + { + /* Bad baudbase, we don't support using timer0 + * for baudrate. + */ + printk(KERN_WARNING "Bad baud_base/custom_divisor: %lu/%i\n", + (unsigned long)info->baud_base, info->custom_divisor); + } + r_alt_ser_baudrate_shadow &= ~mask; + r_alt_ser_baudrate_shadow |= (alt_source << (info->line*8)); + *R_ALT_SER_BAUDRATE = r_alt_ser_baudrate_shadow; + } else { + /* Normal baudrate */ + /* Make sure we use normal baudrate */ + u32 mask = 0xFF << (info->line*8); /* Each port has 8 bits */ + unsigned long alt_source = + IO_STATE(R_ALT_SER_BAUDRATE, ser0_rec, normal) | + IO_STATE(R_ALT_SER_BAUDRATE, ser0_tr, normal); + r_alt_ser_baudrate_shadow &= ~mask; + r_alt_ser_baudrate_shadow |= (alt_source << (info->line*8)); +#ifndef CONFIG_SVINTO_SIM + *R_ALT_SER_BAUDRATE = r_alt_ser_baudrate_shadow; +#endif /* CONFIG_SVINTO_SIM */ + + info->baud = cflag_to_baud(cflag); +#ifndef CONFIG_SVINTO_SIM + info->port[REG_BAUD] = cflag_to_etrax_baud(cflag); +#endif /* CONFIG_SVINTO_SIM */ + } #ifndef CONFIG_SVINTO_SIM - info->port[REG_BAUD] = cflag_to_etrax_baud(cflag); /* start with default settings and then fill in changes */ - + save_flags(flags); + cli(); /* 8 bit, no/even parity */ info->rx_ctrl &= ~(IO_MASK(R_SERIAL0_REC_CTRL, rec_bitnr) | IO_MASK(R_SERIAL0_REC_CTRL, rec_par_en) | @@ -2717,24 +3546,19 @@ } if (cflag & CMSPAR) { - /* enable stick parity */ + /* enable stick parity, PARODD mean Mark which matches ETRAX */ info->tx_ctrl |= IO_STATE(R_SERIAL0_TR_CTRL, tr_stick_par, stick); info->rx_ctrl |= IO_STATE(R_SERIAL0_REC_CTRL, rec_stick_par, stick); - if (!(cflag & PARODD)) { - /* set mark parity */ - info->tx_ctrl |= IO_STATE(R_SERIAL0_TR_CTRL, tr_par, odd); - info->rx_ctrl |= IO_STATE(R_SERIAL0_REC_CTRL, rec_par, odd); - } - } else { - if (cflag & PARODD) { - /* set odd parity */ - info->tx_ctrl |= IO_STATE(R_SERIAL0_TR_CTRL, tr_par, odd); - info->rx_ctrl |= IO_STATE(R_SERIAL0_REC_CTRL, rec_par, odd); - } + } + if (cflag & PARODD) { + /* set odd parity (or Mark if CMSPAR) */ + info->tx_ctrl |= IO_STATE(R_SERIAL0_TR_CTRL, tr_par, odd); + info->rx_ctrl |= IO_STATE(R_SERIAL0_REC_CTRL, rec_par, odd); } if (cflag & CRTSCTS) { /* enable automatic CTS handling */ + DFLOW(DEBUG_LOG(info->line, "FLOW auto_cts enabled\n", 0)); info->tx_ctrl |= IO_STATE(R_SERIAL0_TR_CTRL, auto_cts, active); } @@ -2750,13 +3574,16 @@ xoff = IO_FIELD(R_SERIAL0_XOFF, xoff_char, STOP_CHAR(info->tty)); xoff |= IO_STATE(R_SERIAL0_XOFF, tx_stop, enable); if (info->tty->termios->c_iflag & IXON ) { + DFLOW(DEBUG_LOG(info->line, "FLOW XOFF enabled 0x%02X\n", STOP_CHAR(info->tty))); xoff |= IO_STATE(R_SERIAL0_XOFF, auto_xoff, enable); } *((unsigned long *)&info->port[REG_XOFF]) = xoff; + restore_flags(flags); #endif /* !CONFIG_SVINTO_SIM */ update_char_time(info); + } /* change_speed */ /* start transmitting chars NOW */ @@ -2786,8 +3613,8 @@ restore_flags(flags); } -extern inline int -raw_write(struct tty_struct * tty, int from_user, +extern _INLINE_ int +rs_raw_write(struct tty_struct * tty, int from_user, const unsigned char *buf, int count) { int c, ret = 0; @@ -2801,7 +3628,7 @@ #ifdef SERIAL_DEBUG_DATA if (info->line == SERIAL_DEBUG_LINE) - printk("raw_write (%d), status %d\n", + printk("rs_raw_write (%d), status %d\n", count, info->port[REG_STATUS]); #endif @@ -2811,6 +3638,9 @@ return count; #endif save_flags(flags); + DFLOW(DEBUG_LOG(info->line, "write count %i ", count)); + DFLOW(DEBUG_LOG(info->line, "ldisc %i\n", tty->ldisc.chars_in_buffer(tty))); + /* the cli/restore_flags pairs below are needed because the * DMA interrupt handler moves the info->xmit values. the memcpy @@ -2878,6 +3708,7 @@ * this does not need IRQ protection since if tr_running == 0 * the IRQ's are not running anyway for this port. */ + DFLOW(DEBUG_LOG(info->line, "write ret %i\n", ret)); if (info->xmit.head != info->xmit.tail && !tty->stopped && @@ -2887,7 +3718,7 @@ } return ret; -} /* raw_write() */ +} /* raw_raw_write() */ static int rs_write(struct tty_struct * tty, int from_user, @@ -2909,7 +3740,7 @@ e100_rts(info, info->rs485.rts_on_send); #if defined(CONFIG_ETRAX_RS485_DISABLE_RECEIVER) e100_disable_rx(info); - e100_disable_rxdma_irq(info); + e100_enable_rx_irq(info); #endif if (info->rs485.delay_rts_before_send > 0) { @@ -2919,7 +3750,7 @@ } #endif /* CONFIG_ETRAX_RS485 */ - count = raw_write(tty, from_user, buf, count); + count = rs_raw_write(tty, from_user, buf, count); #if defined(CONFIG_ETRAX_RS485) if (info->rs485.enabled) @@ -3003,23 +3834,33 @@ * This function is used to send a high-priority XON/XOFF character to * the device * - * Since we use DMA we don't check for info->x_char in transmit_chars, - * just disable DMA channel and write the character when possible. + * Since we use DMA we don't check for info->x_char in transmit_chars_dma(), + * but we do it in handle_ser_tx_interrupt(). + * We disable DMA channel and enable tx ready interrupt and write the + * character when possible. */ static void rs_send_xchar(struct tty_struct *tty, char ch) { struct e100_serial *info = (struct e100_serial *)tty->driver_data; + unsigned long flags; + save_flags(flags); cli(); + if (info->uses_dma_out) { + /* Put the DMA on hold and disable the channel */ + *info->ocmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, hold); + while (IO_EXTRACT(R_DMA_CH6_CMD, cmd, *info->ocmdadr) != + IO_STATE_VALUE(R_DMA_CH6_CMD, cmd, hold)); + e100_disable_txdma_channel(info); + } - e100_disable_txdma_channel(info); - - /* Wait for tr_ready */ - while (!(info->port[REG_STATUS] & IO_MASK(R_SERIAL0_STATUS, tr_ready))) - /* wait */; - - /* Write the XON/XOFF char */ - info->port[REG_TR_DATA] = ch; + /* Must make sure transmitter is not stopped before we can transmit */ + if (tty->stopped) + rs_start(tty); - e100_enable_txdma_channel(info); + /* Enable manual transmit interrupt and send from there */ + DFLOW(DEBUG_LOG(info->line, "rs_send_xchar 0x%02X\n", ch)); + info->x_char = ch; + e100_enable_serial_tx_ready_irq(info); + restore_flags(flags); } /* @@ -3034,21 +3875,18 @@ rs_throttle(struct tty_struct * tty) { struct e100_serial *info = (struct e100_serial *)tty->driver_data; - unsigned long flags; #ifdef SERIAL_DEBUG_THROTTLE char buf[64]; - printk("throttle %s: %d....\n", _tty_name(tty, buf), - tty->ldisc.chars_in_buffer(tty)); + printk("throttle %s: %lu....\n", tty_name(tty, buf), + (unsigned long)tty->ldisc.chars_in_buffer(tty)); #endif + DFLOW(DEBUG_LOG(info->line,"rs_throttle %lu\n", tty->ldisc.chars_in_buffer(tty))); /* Do RTS before XOFF since XOFF might take some time */ if (tty->termios->c_cflag & CRTSCTS) { - /* Turn off RTS line (do this atomic) */ - save_flags(flags); - cli(); + /* Turn off RTS line */ e100_rts(info, 0); - restore_flags(flags); } if (I_IXOFF(tty)) rs_send_xchar(tty, STOP_CHAR(tty)); @@ -3059,21 +3897,18 @@ rs_unthrottle(struct tty_struct * tty) { struct e100_serial *info = (struct e100_serial *)tty->driver_data; - unsigned long flags; #ifdef SERIAL_DEBUG_THROTTLE char buf[64]; - printk("unthrottle %s: %d....\n", _tty_name(tty, buf), - tty->ldisc.chars_in_buffer(tty)); + printk("unthrottle %s: %lu....\n", tty_name(tty, buf), + (unsigned long)tty->ldisc.chars_in_buffer(tty)); #endif - + DFLOW(DEBUG_LOG(info->line,"rs_unthrottle ldisc %d\n", tty->ldisc.chars_in_buffer(tty))); + DFLOW(DEBUG_LOG(info->line,"rs_unthrottle flip.count: %i\n", tty->flip.count)); /* Do RTS before XOFF since XOFF might take some time */ if (tty->termios->c_cflag & CRTSCTS) { - /* Assert RTS line (do this atomic) */ - save_flags(flags); - cli(); + /* Assert RTS line */ e100_rts(info, 1); - restore_flags(flags); } if (I_IXOFF(tty)) { @@ -3110,8 +3945,10 @@ tmp.port = (int)info->port; tmp.irq = info->irq; tmp.flags = info->flags; + tmp.baud_base = info->baud_base; tmp.close_delay = info->close_delay; tmp.closing_wait = info->closing_wait; + tmp.custom_divisor = info->custom_divisor; if (copy_to_user(retinfo, &tmp, sizeof(*retinfo))) return -EFAULT; return 0; @@ -3149,8 +3986,10 @@ * At this point, we start making changes..... */ + info->baud_base = new_serial.baud_base; info->flags = ((info->flags & ~ASYNC_FLAGS) | (new_serial.flags & ASYNC_FLAGS)); + info->custom_divisor = new_serial.custom_divisor; info->type = new_serial.type; info->close_delay = new_serial.close_delay; info->closing_wait = new_serial.closing_wait; @@ -3418,6 +4257,7 @@ change_speed(info); + /* Handle turning off CRTSCTS */ if ((old_termios->c_cflag & CRTSCTS) && !(tty->termios->c_cflag & CRTSCTS)) { tty->hw_stopped = 0; @@ -3426,6 +4266,42 @@ } +/* In debugport.c - register a console write function that uses the normal + * serial driver + */ +typedef int (*debugport_write_function)(int i, const char *buf, unsigned int len); + +extern debugport_write_function debug_write_function; + +static int rs_debug_write_function(int i, const char *buf, unsigned int len) +{ + int cnt; + struct tty_struct *tty; + static int recurse_cnt = 0; + + tty = rs_table[i].tty; + if (tty) { + unsigned long flags; + if (recurse_cnt > 5) /* We skip this debug output */ + return 1; + + local_irq_save(flags); + recurse_cnt++; + do { + cnt = rs_write(tty, 0, buf, len); + if (cnt >= 0) { + buf += cnt; + len -= cnt; + } else + len = cnt; + } while(len > 0); + recurse_cnt--; + local_irq_restore(flags); + return 1; + } + return 0; +} + /* * ------------------------------------------------------------ * rs_close() @@ -3483,6 +4359,12 @@ } info->flags |= ASYNC_CLOSING; /* + * Save the termios structure, since this port may have + * separate termios for callout and dialin. + */ + if (info->flags & ASYNC_NORMAL_ACTIVE) + info->normal_termios = *tty->termios; + /* * Now we wait for the transmit buffer to clear; and we notify * the line discipline to only process XON/XOFF characters. */ @@ -3499,7 +4381,7 @@ #ifndef CONFIG_SVINTO_SIM e100_disable_rx(info); - e100_disable_rxdma_irq(info); + e100_disable_rx_irq(info); if (info->flags & ASYNC_INITIALIZED) { /* @@ -3538,6 +4420,16 @@ #if defined(CONFIG_ETRAX_RS485_ON_PA) *R_PORT_PA_DATA = port_pa_data_shadow &= ~(1 << rs485_pa_bit); #endif +#if defined(CONFIG_ETRAX_RS485_ON_PORT_G) + REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow, + rs485_port_g_bit, 0); +#endif +#if defined(CONFIG_ETRAX_RS485_LTC1387) + REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow, + CONFIG_ETRAX_RS485_LTC1387_DXEN_PORT_G_BIT, 0); + REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow, + CONFIG_ETRAX_RS485_LTC1387_RXEN_PORT_G_BIT, 0); +#endif } #endif } @@ -3637,8 +4529,9 @@ return 0; } - if (tty->termios->c_cflag & CLOCAL) - do_clocal = 1; + if (tty->termios->c_cflag & CLOCAL) { + do_clocal = 1; + } /* * Block waiting for the carrier detect and the line to become @@ -3664,7 +4557,7 @@ while (1) { save_flags(flags); cli(); - /* assert RTS and DTR */ + /* assert RTS and DTR */ e100_rts(info, 1); e100_dtr(info, 1); restore_flags(flags); @@ -3681,7 +4574,7 @@ #endif break; } - if (!(info->flags & ASYNC_CLOSING) && do_clocal) + if (!(info->flags & ASYNC_CLOSING) && do_clocal) /* && (do_clocal || DCD_IS_ASSERTED) */ break; if (signal_pending(current)) { @@ -3787,10 +4680,21 @@ #endif return retval; } - + + if ((info->count == 1) && (info->flags & ASYNC_SPLIT_TERMIOS)) { + *tty->termios = info->normal_termios; + change_speed(info); + } + #ifdef SERIAL_DEBUG_OPEN printk("rs_open ttyS%d successful...\n", info->line); #endif + DLOG_INT_TRIG( log_int_pos = 0); + + DFLIP( if (info->line == SERIAL_DEBUG_LINE) { + info->icount.rx = 0; + } ); + return 0; } @@ -3798,10 +4702,11 @@ * /proc fs routines.... */ -extern inline int line_info(char *buf, struct e100_serial *info) +extern _INLINE_ int line_info(char *buf, struct e100_serial *info) { char stat_buf[30]; int ret; + unsigned long tmp; ret = sprintf(buf, "%d: uart:E100 port:%lX irq:%d", info->line, (unsigned long)info->port, info->irq); @@ -3831,11 +4736,39 @@ ret += sprintf(buf+ret, " tx:%lu rx:%lu", (unsigned long)info->icount.tx, (unsigned long)info->icount.rx); + tmp = CIRC_CNT(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE); + if (tmp) { + ret += sprintf(buf+ret, " tx_pend:%lu/%lu", + (unsigned long)tmp, + (unsigned long)SERIAL_XMIT_SIZE); + } ret += sprintf(buf+ret, " rx_pend:%lu/%lu", (unsigned long)info->recv_cnt, (unsigned long)info->max_recv_cnt); +#if 1 + if (info->tty) { + + if (info->tty->stopped) + ret += sprintf(buf+ret, " stopped:%i", + (int)info->tty->stopped); + if (info->tty->hw_stopped) + ret += sprintf(buf+ret, " hw_stopped:%i", + (int)info->tty->hw_stopped); + } + + { + unsigned char rstat = info->port[REG_STATUS]; + if (rstat & IO_MASK(R_SERIAL0_STATUS, xoff_detect) ) + ret += sprintf(buf+ret, " xoff_detect:1"); + } + +#endif + + + + if (info->icount.frame) ret += sprintf(buf+ret, " fe:%lu", (unsigned long)info->icount.frame); @@ -3879,6 +4812,22 @@ len = 0; } } +#ifdef DEBUG_LOG_INCLUDED + for (i = 0; i < debug_log_pos; i++) { + len += sprintf(page + len, "%-4i %lu.%lu ", i, debug_log[i].time, timer_data_to_ns(debug_log[i].timer_data)); + len += sprintf(page + len, debug_log[i].string, debug_log[i].value); + if (len+begin > off+count) + goto done; + if (len+begin < off) { + begin += len; + len = 0; + } + } + len += sprintf(page + len, "debug_log %i/%i %li bytes\n", + i, DEBUG_LOG_SIZE, begin+len); + debug_log_pos = 0; +#endif + *eof = 1; done: if (off >= len+begin) @@ -3893,7 +4842,7 @@ show_serial_version(void) { printk(KERN_INFO - "ETRAX 100LX serial-driver %s, (c) 2000-2003 Axis Communications AB\r\n", + "ETRAX 100LX serial-driver %s, (c) 2000-2004 Axis Communications AB\r\n", &serial_version[11]); /* "$Revision: x.yy" */ } @@ -3952,20 +4901,25 @@ driver->init_termios.c_cflag = B115200 | CS8 | CREAD | HUPCL | CLOCAL; /* is normally B9600 default... */ driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS; + driver->termios = serial_termios; + driver->termios_locked = serial_termios_locked; + tty_set_operations(driver, &rs_ops); + serial_driver = driver; if (tty_register_driver(driver)) panic("Couldn't register serial driver\n"); - serial_driver = driver; - /* do some initializing for the separate ports */ for (i = 0, info = rs_table; i < NR_PORTS; i++,info++) { - info->uses_dma = 0; + info->uses_dma_in = 0; + info->uses_dma_out = 0; info->line = i; info->tty = 0; info->type = PORT_ETRAX; info->tr_running = 0; info->forced_eop = 0; + info->baud_base = DEF_BAUD_BASE; + info->custom_divisor = 0; info->flags = 0; info->close_delay = 5*HZ/10; info->closing_wait = 30*HZ; @@ -3973,6 +4927,7 @@ info->event = 0; info->count = 0; info->blocked_open = 0; + info->normal_termios = driver->init_termios; init_waitqueue_head(&info->open_wait); init_waitqueue_head(&info->close_wait); info->xmit.buf = NULL; @@ -4009,39 +4964,62 @@ #ifndef CONFIG_SVINTO_SIM /* Not needed in simulator. May only complicate stuff. */ /* hook the irq's for DMA channel 6 and 7, serial output and input, and some more... */ + + if (request_irq(SERIAL_IRQ_NBR, ser_interrupt, SA_SHIRQ | SA_INTERRUPT, "serial ", NULL)) + panic("irq8"); + #ifdef CONFIG_ETRAX_SERIAL_PORT0 +#ifdef CONFIG_ETRAX_SERIAL_PORT0_DMA6_OUT if (request_irq(SER0_DMA_TX_IRQ_NBR, tr_interrupt, SA_INTERRUPT, "serial 0 dma tr", NULL)) panic("irq22"); +#endif +#ifdef CONFIG_ETRAX_SERIAL_PORT0_DMA7_IN if (request_irq(SER0_DMA_RX_IRQ_NBR, rec_interrupt, SA_INTERRUPT, "serial 0 dma rec", NULL)) panic("irq23"); #endif -#ifdef SERIAL_HANDLE_EARLY_ERRORS - if (request_irq(SERIAL_IRQ_NBR, ser_interrupt, SA_SHIRQ | SA_INTERRUPT, "serial ", NULL)) - panic("irq8"); #endif + #ifdef CONFIG_ETRAX_SERIAL_PORT1 +#ifdef CONFIG_ETRAX_SERIAL_PORT1_DMA8_OUT if (request_irq(SER1_DMA_TX_IRQ_NBR, tr_interrupt, SA_INTERRUPT, "serial 1 dma tr", NULL)) panic("irq24"); +#endif +#ifdef CONFIG_ETRAX_SERIAL_PORT1_DMA9_IN if (request_irq(SER1_DMA_RX_IRQ_NBR, rec_interrupt, SA_INTERRUPT, "serial 1 dma rec", NULL)) panic("irq25"); #endif +#endif #ifdef CONFIG_ETRAX_SERIAL_PORT2 /* DMA Shared with par0 (and SCSI0 and ATA) */ - if (request_irq(SER2_DMA_TX_IRQ_NBR, tr_interrupt, SA_SHIRQ, "serial 2 dma tr", NULL)) +#ifdef CONFIG_ETRAX_SERIAL_PORT2_DMA2_OUT + if (request_irq(SER2_DMA_TX_IRQ_NBR, tr_interrupt, SA_SHIRQ | SA_INTERRUPT, "serial 2 dma tr", NULL)) panic("irq18"); - if (request_irq(SER2_DMA_RX_IRQ_NBR, rec_interrupt, SA_SHIRQ, "serial 2 dma rec", NULL)) +#endif +#ifdef CONFIG_ETRAX_SERIAL_PORT2_DMA3_IN + if (request_irq(SER2_DMA_RX_IRQ_NBR, rec_interrupt, SA_SHIRQ | SA_INTERRUPT, "serial 2 dma rec", NULL)) panic("irq19"); #endif +#endif #ifdef CONFIG_ETRAX_SERIAL_PORT3 /* DMA Shared with par1 (and SCSI1 and Extern DMA 0) */ - if (request_irq(SER3_DMA_TX_IRQ_NBR, tr_interrupt, SA_SHIRQ, "serial 3 dma tr", NULL)) +#ifdef CONFIG_ETRAX_SERIAL_PORT3_DMA4_OUT + if (request_irq(SER3_DMA_TX_IRQ_NBR, tr_interrupt, SA_SHIRQ | SA_INTERRUPT, "serial 3 dma tr", NULL)) panic("irq20"); - if (request_irq(SER3_DMA_RX_IRQ_NBR, rec_interrupt, SA_SHIRQ, "serial 3 dma rec", NULL)) +#endif +#ifdef CONFIG_ETRAX_SERIAL_PORT3_DMA5_IN + if (request_irq(SER3_DMA_RX_IRQ_NBR, rec_interrupt, SA_SHIRQ | SA_INTERRUPT, "serial 3 dma rec", NULL)) panic("irq21"); #endif +#endif +#ifdef CONFIG_ETRAX_SERIAL_FLUSH_DMA_FAST + if (request_irq(TIMER1_IRQ_NBR, timeout_interrupt, SA_SHIRQ | SA_INTERRUPT, + "fast serial dma timeout", NULL)) { + printk(KERN_CRIT "err: timer1 irq\n"); + } +#endif #endif /* CONFIG_SVINTO_SIM */ - + debug_write_function = rs_debug_write_function; return 0; } diff -urN linux-2.6.7-rc2/arch/cris/arch-v10/drivers/serial.h linux-2.6.7-rc3/arch/cris/arch-v10/drivers/serial.h --- linux-2.6.7-rc2/arch/cris/arch-v10/drivers/serial.h 2004-05-09 19:33:19.000000000 -0700 +++ linux-2.6.7-rc3/arch/cris/arch-v10/drivers/serial.h 2004-06-07 12:55:01.259550025 -0700 @@ -44,15 +44,11 @@ volatile u32 *ofirstadr; /* adr to R_DMA_CHx_FIRST */ volatile u8 *ocmdadr; /* adr to R_DMA_CHx_CMD */ const volatile u8 *ostatusadr; /* adr to R_DMA_CHx_STATUS */ - volatile u32 *ohwswadr; /* adr to R_DMA_CHx_HWSW */ - volatile u32 *odescradr; /* adr to R_DMA_CHx_DESCR */ /* Input registers */ volatile u8 *iclrintradr; /* adr to R_DMA_CHx_CLR_INTR */ volatile u32 *ifirstadr; /* adr to R_DMA_CHx_FIRST */ volatile u8 *icmdadr; /* adr to R_DMA_CHx_CMD */ - const volatile u8 *istatusadr; /* adr to R_DMA_CHx_STATUS */ - volatile u32 *ihwswadr; /* adr to R_DMA_CHx_HWSW */ volatile u32 *idescradr; /* adr to R_DMA_CHx_DESCR */ int flags; /* defined in tty.h */ @@ -60,14 +56,17 @@ u8 rx_ctrl; /* shadow for R_SERIALx_REC_CTRL */ u8 tx_ctrl; /* shadow for R_SERIALx_TR_CTRL */ u8 iseteop; /* bit number for R_SET_EOP for the input dma */ - int enabled; /* Set to 1 if the port is enabled in HW config */ - - /* end of fields defined in rs_table[] in .c-file */ - int uses_dma; /* Set to 1 if DMA should be used */ - unsigned char forced_eop; /* a fifo eop has been forced */ + u8 dma_out_enabled:1; /* Set to 1 if DMA should be used */ + u8 dma_in_enabled:1; /* Set to 1 if DMA should be used */ + /* end of fields defined in rs_table[] in .c-file */ + u8 uses_dma_in; /* Set to 1 if DMA is used */ + u8 uses_dma_out; /* Set to 1 if DMA is used */ + u8 forced_eop; /* a fifo eop has been forced */ + int baud_base; /* For special baudrates */ + int custom_divisor; /* For special baudrates */ struct etrax_dma_descr tr_descr; struct etrax_dma_descr rec_descr[SERIAL_RECV_DESCRIPTORS]; int cur_rec_descr; @@ -95,6 +94,8 @@ struct work_struct work; struct async_icount icount; /* error-statistics etc.*/ + struct termios normal_termios; + struct termios callout_termios; #ifdef DECLARE_WAITQUEUE wait_queue_head_t open_wait; wait_queue_head_t close_wait; @@ -104,6 +105,7 @@ #endif unsigned long char_time_usec; /* The time for 1 char, in usecs */ + unsigned long flush_time_usec; /* How often we should flush */ unsigned long last_tx_active_usec; /* Last tx usec in the jiffies */ unsigned long last_tx_active; /* Last tx time in jiffies */ unsigned long last_rx_active_usec; /* Last rx usec in the jiffies */ diff -urN linux-2.6.7-rc2/arch/cris/arch-v10/kernel/debugport.c linux-2.6.7-rc3/arch/cris/arch-v10/kernel/debugport.c --- linux-2.6.7-rc2/arch/cris/arch-v10/kernel/debugport.c 2004-05-09 19:31:59.000000000 -0700 +++ linux-2.6.7-rc3/arch/cris/arch-v10/kernel/debugport.c 2004-06-07 12:55:01.260550067 -0700 @@ -12,6 +12,15 @@ * init_etrax_debug() * * $Log: debugport.c,v $ + * Revision 1.14 2004/05/17 13:11:29 starvik + * Disable DMA until real serial driver is up + * + * Revision 1.13 2004/05/14 07:58:01 starvik + * Merge of changes from 2.4 + * + * Revision 1.12 2003/09/11 07:29:49 starvik + * Merge of Linux 2.6.0-test5 + * * Revision 1.11 2003/07/07 09:53:36 starvik * Revert all the 2.5.74 merge changes to make the console work again * @@ -59,7 +68,7 @@ #include #include #include - +#include #include #include #include /* Get SIMCOUT. */ @@ -124,22 +133,28 @@ #define MIN_SIZE 32 /* Size that triggers the FIFO to flush characters to interface */ -/* Write a string of count length to the console (debug port) using DMA, polled - * for completion. Interrupts are disabled during the whole process. Some - * caution needs to be taken to not interfere with ttyS business on this port. - */ +static struct tty_driver *serial_driver; + +typedef int (*debugport_write_function)(int i, const char *buf, unsigned int len); + +debugport_write_function debug_write_function = NULL; + +static void +console_write_direct(struct console *co, const char *buf, unsigned int len) +{ + int i; + /* Send data */ + for (i = 0; i < len; i++) { + /* Wait until transmitter is ready and send.*/ + while(!(*DEBUG_READ & IO_MASK(R_SERIAL0_READ, tr_ready))); + *DEBUG_WRITE = buf[i]; + } +} static void console_write(struct console *co, const char *buf, unsigned int len) { - - static struct etrax_dma_descr descr; - static struct etrax_dma_descr descr2; - static char tmp_buf[MIN_SIZE]; - static int tmp_size = 0; - - unsigned long flags; - + unsigned long flags; #ifdef CONFIG_ETRAX_DEBUG_PORT_NULL /* no debug printout at all */ return; @@ -150,86 +165,18 @@ SIMCOUT(buf,len); return; #endif - - local_save_flags(flags); - local_irq_disable(); #ifdef CONFIG_ETRAX_KGDB /* kgdb needs to output debug info using the gdb protocol */ putDebugString(buf, len); - local_irq_restore(flags); return; #endif - /* To make this work together with the real serial port driver - * we have to make sure that everything is flushed when we leave - * here. The following steps are made to assure this: - * 1. Wait until DMA stops, FIFO is empty and serial port pipeline empty. - * 2. Write at least half the FIFO to trigger flush to serial port. - * 3. Wait until DMA stops, FIFO is empty and serial port pipeline empty. - */ - - /* Do we have enough characters to make the DMA/FIFO happy? */ - if (tmp_size + len < MIN_SIZE) - { - int size = min((int)(MIN_SIZE - tmp_size),(int)len); - memcpy(&tmp_buf[tmp_size], buf, size); - tmp_size += size; - len -= size; - - /* Pad with space if complete line */ - if (tmp_buf[tmp_size-1] == '\n') - { - memset(&tmp_buf[tmp_size-1], ' ', MIN_SIZE - tmp_size); - tmp_buf[MIN_SIZE - 1] = '\n'; - tmp_size = MIN_SIZE; - len = 0; - } - else - { - /* Wait for more characters */ - local_irq_restore(flags); + local_irq_save(flags); + if (debug_write_function) + if (debug_write_function(co->index, buf, len)) return; - } - } - - /* make sure the transmitter is enabled. - * NOTE: this overrides any setting done in ttySx, to 8N1, no auto-CTS. - * in the future, move the tr/rec_ctrl shadows from etrax100ser.c to - * shadows.c and use it here as well... - */ - - *DEBUG_TR_CTRL = 0x40; - while(*DEBUG_OCMD & 7); /* Until DMA is not running */ - while(*DEBUG_STATUS & 0x7f); /* wait until output FIFO is empty as well */ - udelay(200); /* Wait for last two characters to leave the serial transmitter */ - - if (tmp_size) - { - descr.ctrl = len ? 0 : d_eop | d_wait | d_eol; - descr.sw_len = tmp_size; - descr.buf = virt_to_phys(tmp_buf); - descr.next = virt_to_phys(&descr2); - descr2.ctrl = d_eop | d_wait | d_eol; - descr2.sw_len = len; - descr2.buf = virt_to_phys((char*)buf); - } - else - { - descr.ctrl = d_eop | d_wait | d_eol; - descr.sw_len = len; - descr.buf = virt_to_phys((char*)buf); - } - - *DEBUG_FIRST = virt_to_phys(&descr); /* write to R_DMAx_FIRST */ - *DEBUG_OCMD = 1; /* dma command start -> R_DMAx_CMD */ - - /* wait until the output dma channel is ready again */ - while(*DEBUG_OCMD & 7); - while(*DEBUG_STATUS & 0x7f); - udelay(200); - - tmp_size = 0; + console_write_direct(co, buf, len); local_irq_restore(flags); } @@ -279,10 +226,11 @@ *DEBUG_REC_CTRL = IO_STATE(R_SERIAL0_REC_CTRL, rec_enable, enable); } -static kdev_t -console_device(struct console *c) +static struct tty_driver* +console_device(struct console *c, int *index) { - return mk_kdev(TTY_MAJOR, 64 + c->index); + *index = c->index; + return serial_driver; } static int __init @@ -311,5 +259,33 @@ void __init init_etrax_debug(void) { +#if CONFIG_ETRAX_DEBUG_PORT_NULL + return; +#endif + +#if DEBUG_PORT_IDX == 0 + genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, dma6); + genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma6, unused); +#elif DEBUG_PORT_IDX == 1 + genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, dma8); + genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma8, usb); +#elif DEBUG_PORT_IDX == 2 + genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, dma2); + genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma2, par0); +#elif DEBUG_PORT_IDX == 3 + genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, dma4); + genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma4, par1); +#endif + *R_GEN_CONFIG = genconfig_shadow; + register_console(&sercons); } + +int __init +init_console(void) +{ + serial_driver = alloc_tty_driver(1); + if (!serial_driver) + return -ENOMEM; + return 0; +} diff -urN linux-2.6.7-rc2/arch/cris/arch-v10/kernel/entry.S linux-2.6.7-rc3/arch/cris/arch-v10/kernel/entry.S --- linux-2.6.7-rc2/arch/cris/arch-v10/kernel/entry.S 2004-05-09 19:32:28.000000000 -0700 +++ linux-2.6.7-rc3/arch/cris/arch-v10/kernel/entry.S 2004-06-07 12:55:01.261550108 -0700 @@ -1,4 +1,4 @@ -/* $Id: entry.S,v 1.16 2003/07/04 08:27:41 starvik Exp $ +/* $Id: entry.S,v 1.18 2004/05/11 12:28:25 starvik Exp $ * * linux/arch/cris/entry.S * @@ -7,6 +7,12 @@ * Authors: Bjorn Wesen (bjornw@axis.com) * * $Log: entry.S,v $ + * Revision 1.18 2004/05/11 12:28:25 starvik + * Merge of Linux 2.6.6 + * + * Revision 1.17 2003/09/11 07:29:49 starvik + * Merge of Linux 2.6.0-test5 + * * Revision 1.16 2003/07/04 08:27:41 starvik * Merge of Linux 2.5.74 * @@ -1060,6 +1066,19 @@ .long sys_clock_nanosleep .long sys_statfs64 .long sys_fstatfs64 + .long sys_tgkill /* 270 */ + .long sys_utimes + .long sys_fadvise64_64 + .long sys_ni_syscall /* sys_vserver */ + .long sys_ni_syscall /* sys_mbind */ + .long sys_ni_syscall /* 275 sys_get_mempolicy */ + .long sys_ni_syscall /* sys_set_mempolicy */ + .long sys_mq_open + .long sys_mq_unlink + .long sys_mq_timedsend + .long sys_mq_timedreceive /* 280 */ + .long sys_mq_notify + .long sys_mq_getsetattr /* * NOTE!! This doesn't have to be exact - we just have diff -urN linux-2.6.7-rc2/arch/cris/arch-v10/kernel/fasttimer.c linux-2.6.7-rc3/arch/cris/arch-v10/kernel/fasttimer.c --- linux-2.6.7-rc2/arch/cris/arch-v10/kernel/fasttimer.c 2004-05-09 19:32:02.000000000 -0700 +++ linux-2.6.7-rc3/arch/cris/arch-v10/kernel/fasttimer.c 2004-06-07 12:55:01.262550150 -0700 @@ -1,10 +1,16 @@ -/* $Id: fasttimer.c,v 1.4 2003/07/04 08:27:41 starvik Exp $ +/* $Id: fasttimer.c,v 1.6 2004/05/14 10:18:39 starvik Exp $ * linux/arch/cris/kernel/fasttimer.c * * Fast timers for ETRAX100/ETRAX100LX * This may be useful in other OS than Linux so use 2 space indentation... * * $Log: fasttimer.c,v $ + * Revision 1.6 2004/05/14 10:18:39 starvik + * Export fast_timer_list + * + * Revision 1.5 2004/05/14 07:58:01 starvik + * Merge of changes from 2.4 + * * Revision 1.4 2003/07/04 08:27:41 starvik * Merge of Linux 2.5.74 * @@ -130,7 +136,7 @@ static int fast_timer_is_init = 0; static int fast_timer_ints = 0; -static struct fast_timer *fast_timer_list = NULL; +struct fast_timer *fast_timer_list = NULL; #ifdef DEBUG_LOG_INCLUDED #define DEBUG_LOG_MAX 128 @@ -325,7 +331,8 @@ { if (tmp == t) { - printk("timer name: %s data: 0x%08lX already in list!\n", name, data); + printk(KERN_WARNING + "timer name: %s data: 0x%08lX already in list!\n", name, data); sanity_failed++; return; } @@ -784,7 +791,7 @@ cli(); if (t->next != nextt) { - printk("timer removed!\n"); + printk(KERN_WARNING "timer removed!\n"); } t = nextt; } @@ -965,7 +972,7 @@ int i; #endif - printk("fast_timer_init()\n"); + printk(KERN_INFO "fast_timer_init()\n"); #if 0 && defined(FAST_TIMER_TEST) for (i = 0; i <= TIMER0_DIV; i++) diff -urN linux-2.6.7-rc2/arch/cris/arch-v10/kernel/head.S linux-2.6.7-rc3/arch/cris/arch-v10/kernel/head.S --- linux-2.6.7-rc2/arch/cris/arch-v10/kernel/head.S 2004-05-09 19:33:20.000000000 -0700 +++ linux-2.6.7-rc3/arch/cris/arch-v10/kernel/head.S 2004-06-07 12:55:01.262550150 -0700 @@ -1,4 +1,4 @@ -/* $Id: head.S,v 1.6 2003/04/28 05:31:46 starvik Exp $ +/* $Id: head.S,v 1.7 2004/05/14 07:58:01 starvik Exp $ * * Head of the kernel - alter with care * @@ -7,6 +7,9 @@ * Authors: Bjorn Wesen (bjornw@axis.com) * * $Log: head.S,v $ + * Revision 1.7 2004/05/14 07:58:01 starvik + * Merge of changes from 2.4 + * * Revision 1.6 2003/04/28 05:31:46 starvik * Added section attributes * @@ -331,7 +334,16 @@ move.d START_ETHERNET_CLOCK, $r0 move.d $r0, [R_NETWORK_GEN_CONFIG] #endif - + + ;; Set up waitstates etc according to kernel configuration. +#ifndef CONFIG_SVINTO_SIM + move.d CONFIG_ETRAX_DEF_R_WAITSTATES, $r0 + move.d $r0, [R_WAITSTATES] + + move.d CONFIG_ETRAX_DEF_R_BUS_CONFIG, $r0 + move.d $r0, [R_BUS_CONFIG] +#endif + ;; We need to initialze DRAM registers before we start using the DRAM cmp.d RAM_INIT_MAGIC, $r8 ; Already initialized? @@ -626,8 +638,19 @@ | IO_STATE (R_GEN_CONFIG, dma4, extdma0),$r0 #endif -#if defined(CONFIG_BLUETOOTH) && (defined(CONFIG_BLUETOOTH_RESET_G10) || defined(CONFIG_BLUETOOTH_RESET_G11)) - or.d IO_STATE (R_GEN_CONFIG, g8_15dir, out),$r0 +#if defined(CONFIG_ETRAX_DEF_R_PORT_G0_DIR_OUT) + or.d IO_STATE (R_GEN_CONFIG, g0dir, out),$r0 +#endif + +#if defined(CONFIG_ETRAX_DEF_R_PORT_G8_15_DIR_OUT) + or.d IO_STATE (R_GEN_CONFIG, g8_15dir, out),$r0 +#endif +#if defined(CONFIG_ETRAX_DEF_R_PORT_G16_23_DIR_OUT) + or.d IO_STATE (R_GEN_CONFIG, g16_23dir, out),$r0 +#endif + +#if defined(CONFIG_ETRAX_DEF_R_PORT_G24_DIR_OUT) + or.d IO_STATE (R_GEN_CONFIG, g24dir, out),$r0 #endif move.d $r0,[genconfig_shadow] ; init a shadow register of R_GEN_CONFIG diff -urN linux-2.6.7-rc2/arch/cris/arch-v10/kernel/process.c linux-2.6.7-rc3/arch/cris/arch-v10/kernel/process.c --- linux-2.6.7-rc2/arch/cris/arch-v10/kernel/process.c 2004-06-07 12:54:48.278012378 -0700 +++ linux-2.6.7-rc3/arch/cris/arch-v10/kernel/process.c 2004-06-07 12:55:01.263550191 -0700 @@ -1,4 +1,4 @@ -/* $Id: process.c,v 1.3 2003/07/04 08:27:41 starvik Exp $ +/* $Id: process.c,v 1.6 2004/05/11 12:28:25 starvik Exp $ * * linux/arch/cris/kernel/process.c * @@ -16,6 +16,7 @@ #include #include #include +#include #include #ifdef CONFIG_ETRAX_GPIO @@ -249,3 +250,19 @@ } #undef last_sched #undef first_sched + +void show_regs(struct pt_regs * regs) +{ + unsigned long usp = rdusp(); + printk("IRP: %08lx SRP: %08lx DCCR: %08lx USP: %08lx MOF: %08lx\n", + regs->irp, regs->srp, regs->dccr, usp, regs->mof ); + printk(" r0: %08lx r1: %08lx r2: %08lx r3: %08lx\n", + regs->r0, regs->r1, regs->r2, regs->r3); + printk(" r4: %08lx r5: %08lx r6: %08lx r7: %08lx\n", + regs->r4, regs->r5, regs->r6, regs->r7); + printk(" r8: %08lx r9: %08lx r10: %08lx r11: %08lx\n", + regs->r8, regs->r9, regs->r10, regs->r11); + printk("r12: %08lx r13: %08lx oR10: %08lx\n", + regs->r12, regs->r13, regs->orig_r10); +} + diff -urN linux-2.6.7-rc2/arch/cris/arch-v10/kernel/ptrace.c linux-2.6.7-rc3/arch/cris/arch-v10/kernel/ptrace.c --- linux-2.6.7-rc2/arch/cris/arch-v10/kernel/ptrace.c 2004-05-09 19:33:20.000000000 -0700 +++ linux-2.6.7-rc3/arch/cris/arch-v10/kernel/ptrace.c 2004-06-07 12:55:01.263550191 -0700 @@ -118,19 +118,13 @@ /* Read the word at location address in the USER area. */ case PTRACE_PEEKUSR: { unsigned long tmp; - + ret = -EIO; - if ((addr & 3) || addr < 0 || addr >= sizeof(struct user)) + if ((addr & 3) || addr < 0 || addr > PT_MAX << 2) break; - - tmp = 0; /* Default return condition */ - ret = -EIO; - - if (addr < sizeof(struct pt_regs)) { - tmp = get_reg(child, addr >> 2); - ret = put_user(tmp, (unsigned long *)data); - } - + + tmp = get_reg(child, addr >> 2); + ret = put_user(tmp, (unsigned long *)data); break; } @@ -148,28 +142,21 @@ /* Write the word at location address in the USER area. */ case PTRACE_POKEUSR: ret = -EIO; - - if ((addr & 3) || addr < 0 || addr >= sizeof(struct user)) + if ((addr & 3) || addr < 0 || addr > PT_MAX << 2) break; - if (addr < sizeof(struct pt_regs)) { - addr >>= 2; + addr >>= 2; - if (addr == PT_DCCR) { - /* - * Don't allow the tracing process to - * change stuff like interrupt enable, - * kernel/user bit, etc. - */ - data &= DCCR_MASK; - data |= get_reg(child, PT_DCCR) & ~DCCR_MASK; - } - - if (put_reg(child, addr, data)) - break; - - ret = 0; + if (addr == PT_DCCR) { + /* don't allow the tracing process to change stuff like + * interrupt enable, kernel/user bit, dma enables etc. + */ + data &= DCCR_MASK; + data |= get_reg(child, PT_DCCR) & ~DCCR_MASK; } + if (put_reg(child, addr, data)) + break; + ret = 0; break; case PTRACE_SYSCALL: @@ -237,7 +224,7 @@ if (put_user(tmp, (unsigned long *) data)) { ret = -EFAULT; - break; + goto out_tsk; } data += sizeof(long); @@ -255,7 +242,7 @@ for (i = 0; i <= PT_MAX; i++) { if (get_user(tmp, (unsigned long *) data)) { ret = -EFAULT; - break; + goto out_tsk; } if (i == PT_DCCR) { @@ -290,12 +277,10 @@ if (!(current->ptrace & PT_PTRACED)) return; - current->exit_code = SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) - ? 0x80 : 0); - - current->state = TASK_STOPPED; - notify_parent(current, SIGCHLD); - schedule(); + /* the 0x80 provides a way for the tracing parent to distinguish + between a syscall stop and SIGTRAP delivery */ + ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) + ? 0x80 : 0)); /* * This isn't the same as continuing with a signal, but it will do for diff -urN linux-2.6.7-rc2/arch/cris/arch-v10/kernel/setup.c linux-2.6.7-rc3/arch/cris/arch-v10/kernel/setup.c --- linux-2.6.7-rc2/arch/cris/arch-v10/kernel/setup.c 2004-05-09 19:33:13.000000000 -0700 +++ linux-2.6.7-rc3/arch/cris/arch-v10/kernel/setup.c 2004-06-07 12:55:01.264550232 -0700 @@ -1,4 +1,4 @@ -/* $Id: setup.c,v 1.1 2002/12/11 15:42:02 starvik Exp $ +/* * * linux/arch/cris/arch-v10/kernel/setup.c * @@ -94,3 +94,10 @@ } #endif /* CONFIG_PROC_FS */ + +void +show_etrax_copyright(void) +{ + printk(KERN_INFO + "Linux/CRIS port on ETRAX 100LX (c) 2001 Axis Communications AB\n"); +} diff -urN linux-2.6.7-rc2/arch/cris/arch-v10/kernel/signal.c linux-2.6.7-rc3/arch/cris/arch-v10/kernel/signal.c --- linux-2.6.7-rc2/arch/cris/arch-v10/kernel/signal.c 2004-05-09 19:31:59.000000000 -0700 +++ linux-2.6.7-rc3/arch/cris/arch-v10/kernel/signal.c 2004-06-07 12:55:01.264550232 -0700 @@ -180,6 +180,9 @@ unsigned int err = 0; unsigned long old_usp; + /* Always make any pending restarted system calls return -EINTR */ + current_thread_info()->restart_block.fn = do_no_restart_syscall; + /* restore the regs from &sc->regs (same as sc, since regs is first) * (sc is already checked for VERIFY_READ since the sigframe was * checked in sys_sigreturn previously) @@ -492,7 +495,6 @@ /* If so, check system call restarting.. */ switch (regs->r10) { case -ERESTART_RESTARTBLOCK: - current_thread_info()->restart_block.fn = do_no_restart_syscall; case -ERESTARTNOHAND: /* ERESTARTNOHAND means that the syscall should only be restarted if there was no handler for the signal, and since diff -urN linux-2.6.7-rc2/arch/cris/arch-v10/kernel/time.c linux-2.6.7-rc3/arch/cris/arch-v10/kernel/time.c --- linux-2.6.7-rc2/arch/cris/arch-v10/kernel/time.c 2004-05-09 19:32:53.000000000 -0700 +++ linux-2.6.7-rc3/arch/cris/arch-v10/kernel/time.c 2004-06-07 12:55:01.265550274 -0700 @@ -1,4 +1,4 @@ -/* $Id: time.c,v 1.2 2003/07/04 08:27:41 starvik Exp $ +/* $Id: time.c,v 1.3 2004/06/01 05:38:42 starvik Exp $ * * linux/arch/cris/arch-v10/kernel/time.c * @@ -277,6 +277,12 @@ update_xtime_from_cmos(); } + /* + * Initialize wall_to_monotonic such that adding it to xtime will yield zero, the + * tv_nsec field must be normalized (i.e., 0 <= nsec < NSEC_PER_SEC). + */ + set_normalized_timespec(&wall_to_monotonic, -xtime.tv_sec, -xtime.tv_nsec); + /* Setup the etrax timers * Base frequency is 25000 hz, divider 250 -> 100 HZ * In normal mode, we use timer0, so timer1 is free. In cascade diff -urN linux-2.6.7-rc2/arch/cris/arch-v10/lib/dram_init.S linux-2.6.7-rc3/arch/cris/arch-v10/lib/dram_init.S --- linux-2.6.7-rc2/arch/cris/arch-v10/lib/dram_init.S 2004-05-09 19:33:13.000000000 -0700 +++ linux-2.6.7-rc3/arch/cris/arch-v10/lib/dram_init.S 2004-06-07 12:55:01.265550274 -0700 @@ -1,4 +1,4 @@ -/* $Id: dram_init.S,v 1.3 2003/03/31 09:38:37 starvik Exp $ +/* $Id: dram_init.S,v 1.4 2003/09/22 09:21:59 starvik Exp $ * * DRAM/SDRAM initialization - alter with care * This file is intended to be included from other assembler files @@ -11,6 +11,10 @@ * Authors: Mikael Starvik (starvik@axis.com) * * $Log: dram_init.S,v $ + * Revision 1.4 2003/09/22 09:21:59 starvik + * Decompresser is linked to 0x407xxxxx and sdram commands are at 0x000xxxxx + * so we need to mask off 12 bits. + * * Revision 1.3 2003/03/31 09:38:37 starvik * Corrected calculation of end of sdram init commands * @@ -152,9 +156,9 @@ ; Issue initialization command sequence move.d _sdram_commands_start, $r2 - and.d 0x00ffffff, $r2 ; Make sure commands are read from flash + and.d 0x000fffff, $r2 ; Make sure commands are read from flash move.d _sdram_commands_end, $r3 - and.d 0x00ffffff, $r3 + and.d 0x000fffff, $r3 1: clear.d $r4 move.b [$r2+], $r4 lslq 9, $r4 ; Command starts at bit 9 diff -urN linux-2.6.7-rc2/arch/cris/arch-v10/lib/old_checksum.c linux-2.6.7-rc3/arch/cris/arch-v10/lib/old_checksum.c --- linux-2.6.7-rc2/arch/cris/arch-v10/lib/old_checksum.c 2004-05-09 19:33:13.000000000 -0700 +++ linux-2.6.7-rc3/arch/cris/arch-v10/lib/old_checksum.c 2004-06-07 12:55:01.265550274 -0700 @@ -1,4 +1,4 @@ -/* $Id: old_checksum.c,v 1.2 2002/11/05 06:45:12 starvik Exp $ +/* $Id: old_checksum.c,v 1.3 2003/10/27 08:04:32 starvik Exp $ * * INET An implementation of the TCP/IP protocol suite for the LINUX * operating system. INET is implemented using the BSD Socket @@ -76,7 +76,7 @@ sum += *((unsigned short *)buff)++; } if(endMarker - buff > 0) { - sum += *buff; /* add extra byte separately */ + sum += *buff; /* add extra byte seperately */ } BITOFF; return(sum); diff -urN linux-2.6.7-rc2/arch/cris/arch-v10/mm/fault.c linux-2.6.7-rc3/arch/cris/arch-v10/mm/fault.c --- linux-2.6.7-rc2/arch/cris/arch-v10/mm/fault.c 2004-05-09 19:33:20.000000000 -0700 +++ linux-2.6.7-rc3/arch/cris/arch-v10/mm/fault.c 2004-06-07 12:55:01.266550315 -0700 @@ -30,7 +30,7 @@ *search_exception_tables(unsigned long addr); asmlinkage void do_page_fault(unsigned long address, struct pt_regs *regs, - int error_code); + int protection, int writeaccess); /* fast TLB-fill fault handler * this is called from entry.S with interrupts disabled @@ -39,8 +39,9 @@ void handle_mmu_bus_fault(struct pt_regs *regs) { - int cause, select; + int cause; #ifdef DEBUG + int select; int index; int page_id; int acc, inv; @@ -48,15 +49,14 @@ int miss, we, writeac; pmd_t *pmd; pte_t pte; - int errcode; unsigned long address; cause = *R_MMU_CAUSE; - select = *R_TLB_SELECT; address = cause & PAGE_MASK; /* get faulting address */ #ifdef DEBUG + select = *R_TLB_SELECT; page_id = IO_EXTRACT(R_MMU_CAUSE, page_id, cause); acc = IO_EXTRACT(R_MMU_CAUSE, acc_excp, cause); inv = IO_EXTRACT(R_MMU_CAUSE, inv_excp, cause); @@ -82,12 +82,6 @@ if(writeac) regs->csrinstr &= ~(1 << 5); - /* Set errcode's R/W flag according to the mode which caused the - * fault - */ - - errcode = writeac << 1; - D(printk("bus_fault from IRP 0x%lx: addr 0x%lx, miss %d, inv %d, we %d, acc %d, dx %d pid %d\n", regs->irp, address, miss, inv, we, acc, index, page_id)); @@ -99,16 +93,20 @@ */ pmd = (pmd_t *)(current_pgd + pgd_index(address)); - if (pmd_none(*pmd)) - goto dofault; + if (pmd_none(*pmd)) { + do_page_fault(address, regs, 0, writeac); + return; + } if (pmd_bad(*pmd)) { printk("bad pgdir entry 0x%lx at 0x%p\n", *(unsigned long*)pmd, pmd); pmd_clear(pmd); return; } pte = *pte_offset_kernel(pmd, address); - if (!pte_present(pte)) - goto dofault; + if (!pte_present(pte)) { + do_page_fault(address, regs, 0, writeac); + return; + } #ifdef DEBUG printk(" found pte %lx pg %p ", pte_val(pte), pte_page(pte)); @@ -143,14 +141,10 @@ *R_TLB_LO = pte_val(pte); return; - } - - errcode = 1 | (we << 1); + } - dofault: - /* leave it to the MM system fault handler below */ - D(printk("do_page_fault %lx errcode %d\n", address, errcode)); - do_page_fault(address, regs, errcode); + /* leave it to the MM system fault handler */ + do_page_fault(address, regs, 1, we); } /* Called from arch/cris/mm/fault.c to find fixup code. */ diff -urN linux-2.6.7-rc2/arch/cris/arch-v10/mm/tlb.c linux-2.6.7-rc3/arch/cris/arch-v10/mm/tlb.c --- linux-2.6.7-rc2/arch/cris/arch-v10/mm/tlb.c 2004-05-09 19:33:21.000000000 -0700 +++ linux-2.6.7-rc3/arch/cris/arch-v10/mm/tlb.c 2004-06-07 12:55:01.266550315 -0700 @@ -212,7 +212,7 @@ void switch_mm(struct mm_struct *prev, struct mm_struct *next, - struct task_struct *tsk, int cpu) + struct task_struct *tsk) { /* make sure we have a context */ diff -urN linux-2.6.7-rc2/arch/cris/defconfig linux-2.6.7-rc3/arch/cris/defconfig --- linux-2.6.7-rc2/arch/cris/defconfig 2004-05-09 19:32:26.000000000 -0700 +++ linux-2.6.7-rc3/arch/cris/defconfig 2004-06-07 12:55:01.267550357 -0700 @@ -1,25 +1,55 @@ # # Automatically generated make config: don't edit # +CONFIG_MMU=y CONFIG_UID16=y CONFIG_RWSEM_GENERIC_SPINLOCK=y -# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set # # Code maturity level options # CONFIG_EXPERIMENTAL=y +CONFIG_CLEAN_COMPILE=y +CONFIG_STANDALONE=y +CONFIG_BROKEN_ON_SMP=y # # General setup # -CONFIG_NET=y -CONFIG_SYSVIPC=y +CONFIG_SWAP=y +# CONFIG_SYSVIPC is not set +# CONFIG_POSIX_MQUEUE is not set # CONFIG_BSD_PROCESS_ACCT is not set -# CONFIG_SYSCTL is not set +CONFIG_SYSCTL=y +# CONFIG_AUDIT is not set +CONFIG_LOG_BUF_SHIFT=14 +# CONFIG_HOTPLUG is not set +# CONFIG_IKCONFIG is not set +CONFIG_EMBEDDED=y +# CONFIG_KALLSYMS is not set +CONFIG_FUTEX=y +CONFIG_EPOLL=y +CONFIG_IOSCHED_NOOP=y +CONFIG_IOSCHED_AS=y +CONFIG_IOSCHED_DEADLINE=y +CONFIG_IOSCHED_CFQ=y +# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set + +# +# Loadable module support +# +# CONFIG_MODULES is not set + +# +# General setup +# CONFIG_BINFMT_ELF=y -# CONFIG_ETRAX_KGDB is not set -# CONFIG_ETRAX_WATCHDOG is not set +# CONFIG_BINFMT_MISC is not set +CONFIG_ETRAX_CMDLINE="root=/dev/mtdblock3 init=/linuxrc" +CONFIG_ETRAX_WATCHDOG=y +CONFIG_ETRAX_WATCHDOG_NICE_DOGGY=y +CONFIG_ETRAX_FAST_TIMER=y +# CONFIG_PREEMPT is not set # # Hardware setup @@ -27,74 +57,170 @@ CONFIG_ETRAX100LX=y # CONFIG_ETRAX100LX_V2 is not set # CONFIG_SVINTO_SIM is not set -CONFIG_ETRAX_DRAM_SIZE=8 +CONFIG_ETRAX_ARCH_V10=y +CONFIG_ETRAX_DRAM_SIZE=16 CONFIG_ETRAX_FLASH_BUSWIDTH=2 -CONFIG_ETRAX_ROOT_DEVICE="/dev/mtdblock3" +CONFIG_CRIS_LOW_MAP=y +CONFIG_ETRAX_DRAM_VIRTUAL_BASE=60000000 +CONFIG_ETRAX_PA_LEDS=y +# CONFIG_ETRAX_PB_LEDS is not set +# CONFIG_ETRAX_CSP0_LEDS is not set +# CONFIG_ETRAX_NO_LEDS is not set +CONFIG_ETRAX_LED1G=2 +CONFIG_ETRAX_LED1R=2 +CONFIG_ETRAX_LED2G=3 +CONFIG_ETRAX_LED2R=3 +CONFIG_ETRAX_LED3G=2 +CONFIG_ETRAX_LED3R=2 +CONFIG_ETRAX_DEBUG_PORT0=y +# CONFIG_ETRAX_DEBUG_PORT1 is not set +# CONFIG_ETRAX_DEBUG_PORT2 is not set +# CONFIG_ETRAX_DEBUG_PORT3 is not set +# CONFIG_ETRAX_DEBUG_PORT_NULL is not set +CONFIG_ETRAX_RESCUE_SER0=y +# CONFIG_ETRAX_RESCUE_SER1 is not set +# CONFIG_ETRAX_RESCUE_SER2 is not set +# CONFIG_ETRAX_RESCUE_SER3 is not set +CONFIG_ETRAX_DEF_R_WAITSTATES=0x95f8 +CONFIG_ETRAX_DEF_R_BUS_CONFIG=0x104 +CONFIG_ETRAX_SDRAM=y +CONFIG_ETRAX_DEF_R_SDRAM_CONFIG=0x00e03636 +CONFIG_ETRAX_DEF_R_SDRAM_TIMING=0x80008002 +CONFIG_ETRAX_DEF_R_PORT_PA_DIR=0x1d +CONFIG_ETRAX_DEF_R_PORT_PA_DATA=0xf0 +CONFIG_ETRAX_DEF_R_PORT_PB_CONFIG=0x00 +CONFIG_ETRAX_DEF_R_PORT_PB_DIR=0x1e +CONFIG_ETRAX_DEF_R_PORT_PB_DATA=0xf3 +# CONFIG_ETRAX_SOFT_SHUTDOWN is not set # -# Drivers for ETRAX 100LX built-in interfaces +# Drivers for built-in interfaces +# +CONFIG_ETRAX_ETHERNET=y +CONFIG_NET_ETHERNET=y +# CONFIG_ETRAX_NETWORK_LED_ON_WHEN_LINK is not set +CONFIG_ETRAX_NETWORK_LED_ON_WHEN_ACTIVITY=y +CONFIG_ETRAX_SERIAL=y +CONFIG_ETRAX_SERIAL_FAST_TIMER=y +CONFIG_ETRAX_SERIAL_PORT0=y +# CONFIG_CONFIG_ETRAX_SERIAL_PORT0_NO_DMA_OUT is not set +CONFIG_CONFIG_ETRAX_SERIAL_PORT0_DMA6_OUT=y +# CONFIG_CONFIG_ETRAX_SERIAL_PORT0_NO_DMA_IN is not set +CONFIG_CONFIG_ETRAX_SERIAL_PORT0_DMA7_IN=y +CONFIG_ETRAX_SER0_DTR_RI_DSR_CD_ON_NONE=y +# CONFIG_ETRAX_SER0_DTR_RI_DSR_CD_ON_PA is not set +# CONFIG_ETRAX_SER0_DTR_RI_DSR_CD_ON_PB is not set +# CONFIG_ETRAX_SER0_DTR_RI_DSR_CD_MIXED is not set +CONFIG_ETRAX_SER0_DTR_ON_PA_BIT=-1 +CONFIG_ETRAX_SER0_RI_ON_PA_BIT=-1 +CONFIG_ETRAX_SER0_DSR_ON_PA_BIT=-1 +CONFIG_ETRAX_SER0_CD_ON_PA_BIT=-1 +CONFIG_ETRAX_SER0_DTR_ON_PB_BIT=-1 +CONFIG_ETRAX_SER0_RI_ON_PB_BIT=-1 +CONFIG_ETRAX_SER0_DSR_ON_PB_BIT=-1 +CONFIG_ETRAX_SER0_CD_ON_PB_BIT=-1 +# CONFIG_ETRAX_SERIAL_PORT1 is not set +CONFIG_ETRAX_SERIAL_PORT2=y +# CONFIG_CONFIG_ETRAX_SERIAL_PORT2_NO_DMA_OUT is not set +CONFIG_CONFIG_ETRAX_SERIAL_PORT2_DMA2_OUT=y +# CONFIG_CONFIG_ETRAX_SERIAL_PORT2_NO_DMA_IN is not set +CONFIG_CONFIG_ETRAX_SERIAL_PORT2_DMA3_IN=y +CONFIG_ETRAX_SER2_DTR_RI_DSR_CD_ON_NONE=y +# CONFIG_ETRAX_SER2_DTR_RI_DSR_CD_ON_PA is not set +# CONFIG_ETRAX_SER2_DTR_RI_DSR_CD_ON_PB is not set +# CONFIG_ETRAX_SER2_DTR_RI_DSR_CD_MIXED is not set +CONFIG_ETRAX_SER2_DTR_ON_PA_BIT=-1 +CONFIG_ETRAX_SER2_RI_ON_PA_BIT=-1 +CONFIG_ETRAX_SER2_DSR_ON_PA_BIT=-1 +CONFIG_ETRAX_SER2_CD_ON_PA_BIT=-1 +CONFIG_ETRAX_SER2_DTR_ON_PB_BIT=-1 +CONFIG_ETRAX_SER2_RI_ON_PB_BIT=-1 +CONFIG_ETRAX_SER2_DSR_ON_PB_BIT=-1 +CONFIG_ETRAX_SER2_CD_ON_PB_BIT=-1 +# CONFIG_ETRAX_SERIAL_PORT3 is not set +# CONFIG_ETRAX_RS485 is not set +# CONFIG_ETRAX_IDE is not set +# CONFIG_IDE is not set +# CONFIG_ETRAX_USB_HOST is not set +CONFIG_ETRAX_AXISFLASHMAP=y +CONFIG_ETRAX_PTABLE_SECTOR=65536 +CONFIG_MTD=y +CONFIG_MTD_CFI=y +CONFIG_MTD_CFI_AMDSTD=y +CONFIG_MTD_OBSOLETE_CHIPS=y +CONFIG_MTD_AMDSTD=y +CONFIG_MTD_CHAR=y +CONFIG_MTD_BLOCK=y +CONFIG_MTD_PARTITIONS=y +CONFIG_MTD_CONCAT=y +# CONFIG_ETRAX_I2C is not set +CONFIG_ETRAX_GPIO=y +CONFIG_ETRAX_PA_BUTTON_BITMASK=0x02 +CONFIG_ETRAX_PA_CHANGEABLE_DIR=0x00 +CONFIG_ETRAX_PA_CHANGEABLE_BITS=0xFF +CONFIG_ETRAX_PB_CHANGEABLE_DIR=0x00 +CONFIG_ETRAX_PB_CHANGEABLE_BITS=0xFF +# CONFIG_ETRAX_RTC is not set + +# +# Generic Driver Options # # # Memory Technology Devices (MTD) # -CONFIG_MTD=y # CONFIG_MTD_DEBUG is not set +# CONFIG_MTD_REDBOOT_PARTS is not set +# CONFIG_MTD_CMDLINE_PARTS is not set # -# Disk-On-Chip Device Drivers +# User Modules And Translation Layers # -# CONFIG_MTD_DOC1000 is not set -# CONFIG_MTD_DOC2000 is not set -# CONFIG_MTD_DOC2001 is not set -# CONFIG_MTD_DOCPROBE is not set +# CONFIG_FTL is not set +# CONFIG_NFTL is not set +# CONFIG_INFTL is not set # -# RAM/ROM Device Drivers +# RAM/ROM/Flash chip drivers # -# CONFIG_MTD_PMC551 is not set -# CONFIG_MTD_SLRAM is not set -# CONFIG_MTD_RAM is not set +# CONFIG_MTD_JEDECPROBE is not set +CONFIG_MTD_GEN_PROBE=y +# CONFIG_MTD_CFI_ADV_OPTIONS is not set +# CONFIG_MTD_CFI_INTELEXT is not set +# CONFIG_MTD_CFI_STAA is not set +CONFIG_MTD_RAM=y # CONFIG_MTD_ROM is not set -# CONFIG_MTD_MTDRAM is not set +# CONFIG_MTD_ABSENT is not set +# CONFIG_MTD_SHARP is not set +# CONFIG_MTD_JEDEC is not set # -# Linearly Mapped Flash Device Drivers +# Mapping drivers for chip access # -CONFIG_MTD_CFI=y -# CONFIG_MTD_CFI_GEOMETRY is not set -# CONFIG_MTD_CFI_INTELEXT is not set -CONFIG_MTD_CFI_AMDSTD=y -CONFIG_MTD_AMDSTD=y -# CONFIG_MTD_SHARP is not set +CONFIG_MTD_COMPLEX_MAPPINGS=y # CONFIG_MTD_PHYSMAP is not set -# CONFIG_MTD_NORA is not set -# CONFIG_MTD_PNC2000 is not set -# CONFIG_MTD_RPXLITE is not set -# CONFIG_MTD_SC520CDP is not set -# CONFIG_MTD_SBC_MEDIAGX is not set -# CONFIG_MTD_ELAN_104NC is not set -# CONFIG_MTD_SA1100 is not set -# CONFIG_MTD_DC21285 is not set -# CONFIG_MTD_CSTM_CFI_JEDEC is not set -# CONFIG_MTD_JEDEC is not set -# CONFIG_MTD_MIXMEM is not set -# CONFIG_MTD_OCTAGON is not set -# CONFIG_MTD_VMAX is not set # -# NAND Flash Device Drivers +# Self-contained MTD device drivers # -# CONFIG_MTD_NAND is not set -# CONFIG_MTD_NAND_SPIA is not set +# CONFIG_MTD_SLRAM is not set +CONFIG_MTD_MTDRAM=y +CONFIG_MTDRAM_TOTAL_SIZE=0 +CONFIG_MTDRAM_ERASE_SIZE=64 +CONFIG_MTDRAM_ABS_POS=0x0 +# CONFIG_MTD_BLKMTD is not set # -# User Modules And Translation Layers +# Disk-On-Chip Device Drivers # -CONFIG_MTD_CHAR=y -CONFIG_MTD_BLOCK=y -# CONFIG_FTL is not set -# CONFIG_NFTL is not set +# CONFIG_MTD_DOC2000 is not set +# CONFIG_MTD_DOC2001 is not set +# CONFIG_MTD_DOC2001PLUS is not set + +# +# NAND Flash Device Drivers +# +# CONFIG_MTD_NAND is not set # # Parallel port support @@ -102,51 +228,98 @@ # CONFIG_PARPORT is not set # -# Plug and Play configuration +# Plug and Play support # -# CONFIG_PNP is not set -# CONFIG_ISAPNP is not set # # Block devices # # CONFIG_BLK_DEV_FD is not set -# CONFIG_BLK_DEV_XD is not set -# CONFIG_PARIDE is not set -# CONFIG_BLK_CPQ_DA is not set -# CONFIG_BLK_CPQ_CISS_DA is not set -# CONFIG_BLK_DEV_DAC960 is not set # CONFIG_BLK_DEV_LOOP is not set # CONFIG_BLK_DEV_NBD is not set -# CONFIG_BLK_DEV_RAM is not set +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_SIZE=4096 # CONFIG_BLK_DEV_INITRD is not set # +# Multi-device support (RAID and LVM) +# +# CONFIG_MD is not set + +# +# ATA/ATAPI/MFM/RLL support +# + +# +# SCSI device support +# +# CONFIG_SCSI is not set + +# +# IEEE 1394 (FireWire) support +# +# CONFIG_IEEE1394 is not set + +# +# I2O device support +# + +# +# Networking support +# +CONFIG_NET=y + +# # Networking options # -# CONFIG_PACKET is not set -# CONFIG_NETLINK is not set -# CONFIG_NETFILTER is not set -# CONFIG_FILTER is not set +CONFIG_PACKET=y +# CONFIG_PACKET_MMAP is not set +# CONFIG_NETLINK_DEV is not set CONFIG_UNIX=y +# CONFIG_NET_KEY is not set CONFIG_INET=y # CONFIG_IP_MULTICAST is not set # CONFIG_IP_ADVANCED_ROUTER is not set # CONFIG_IP_PNP is not set # CONFIG_NET_IPIP is not set # CONFIG_NET_IPGRE is not set -# CONFIG_INET_ECN is not set +# CONFIG_ARPD is not set # CONFIG_SYN_COOKIES is not set +# CONFIG_INET_AH is not set +# CONFIG_INET_ESP is not set +# CONFIG_INET_IPCOMP is not set + +# +# IP: Virtual Server Configuration +# +# CONFIG_IP_VS is not set # CONFIG_IPV6 is not set -# CONFIG_KHTTPD is not set +CONFIG_NETFILTER=y +# CONFIG_NETFILTER_DEBUG is not set + +# +# IP: Netfilter Configuration +# +# CONFIG_IP_NF_CONNTRACK is not set +# CONFIG_IP_NF_QUEUE is not set +# CONFIG_IP_NF_IPTABLES is not set +# CONFIG_IP_NF_ARPTABLES is not set +# CONFIG_IP_NF_COMPAT_IPCHAINS is not set +# CONFIG_IP_NF_COMPAT_IPFWADM is not set + +# +# SCTP Configuration (EXPERIMENTAL) +# +# CONFIG_IP_SCTP is not set # CONFIG_ATM is not set +# CONFIG_BRIDGE is not set +# CONFIG_VLAN_8021Q is not set +# CONFIG_DECNET is not set +# CONFIG_LLC2 is not set # CONFIG_IPX is not set # CONFIG_ATALK is not set -# CONFIG_DECNET is not set -# CONFIG_BRIDGE is not set # CONFIG_X25 is not set # CONFIG_LAPB is not set -# CONFIG_LLC is not set # CONFIG_NET_DIVERT is not set # CONFIG_ECONET is not set # CONFIG_WAN_ROUTER is not set @@ -159,167 +332,114 @@ # CONFIG_NET_SCHED is not set # -# Telephony Support -# -# CONFIG_PHONE is not set -# CONFIG_PHONE_IXJ is not set - -# -# ATA/IDE/MFM/RLL support -# -# CONFIG_IDE is not set - -# -# IDE, ATA and ATAPI Block devices -# -# CONFIG_BLK_DEV_IDE is not set -# CONFIG_BLK_DEV_HD_IDE is not set -# CONFIG_BLK_DEV_HD is not set -# CONFIG_BLK_DEV_IDEDISK is not set -# CONFIG_IDEDISK_MULTI_MODE is not set -# CONFIG_BLK_DEV_IDECS is not set -# CONFIG_BLK_DEV_IDECD is not set -# CONFIG_BLK_DEV_IDETAPE is not set -# CONFIG_BLK_DEV_IDEFLOPPY is not set -# CONFIG_BLK_DEV_IDESCSI is not set -# CONFIG_BLK_DEV_CMD640 is not set -# CONFIG_BLK_DEV_CMD640_ENHANCED is not set -# CONFIG_BLK_DEV_ISAPNP is not set -# CONFIG_IDE_CHIPSETS is not set -# CONFIG_IDEDMA_AUTO is not set - -# -# SCSI support -# -# CONFIG_SCSI is not set - -# -# I2O device support -# -# CONFIG_I2O is not set -# CONFIG_I2O_BLOCK is not set -# CONFIG_I2O_LAN is not set -# CONFIG_I2O_SCSI is not set -# CONFIG_I2O_PROC is not set - -# -# Network device support +# Network testing # +# CONFIG_NET_PKTGEN is not set +# CONFIG_NETPOLL is not set +# CONFIG_NET_POLL_CONTROLLER is not set +# CONFIG_HAMRADIO is not set +# CONFIG_IRDA is not set +# CONFIG_BT is not set CONFIG_NETDEVICES=y - -# -# ARCnet devices -# -# CONFIG_ARCNET is not set # CONFIG_DUMMY is not set # CONFIG_BONDING is not set # CONFIG_EQUALIZER is not set # CONFIG_TUN is not set -# CONFIG_NET_SB1000 is not set # # Ethernet (10 or 100Mbit) # -CONFIG_NET_ETHERNET=y -# CONFIG_NET_VENDOR_3COM is not set -# CONFIG_LANCE is not set -# CONFIG_NET_VENDOR_SMC is not set -# CONFIG_NET_VENDOR_RACAL is not set -# CONFIG_AT1700 is not set -# CONFIG_DEPCA is not set -# CONFIG_NET_ISA is not set -# CONFIG_NET_PCI is not set -# CONFIG_NET_POCKET is not set +# CONFIG_MII is not set # # Ethernet (1000 Mbit) # -# CONFIG_ACENIC is not set -# CONFIG_HAMACHI is not set -# CONFIG_YELLOWFIN is not set -# CONFIG_SK98LIN is not set -# CONFIG_FDDI is not set -# CONFIG_HIPPI is not set -# CONFIG_PLIP is not set -# CONFIG_PPP is not set -# CONFIG_SLIP is not set # -# Wireless LAN (non-hamradio) +# Ethernet (10000 Mbit) # -# CONFIG_NET_RADIO is not set # # Token Ring devices # -# CONFIG_TR is not set -# CONFIG_NET_FC is not set -# CONFIG_RCPCI is not set -# CONFIG_SHAPER is not set + +# +# Wireless LAN (non-hamradio) +# +# CONFIG_NET_RADIO is not set # # Wan interfaces # # CONFIG_WAN is not set +# CONFIG_PPP is not set +# CONFIG_SLIP is not set +# CONFIG_SHAPER is not set +# CONFIG_NETCONSOLE is not set # -# Amateur Radio support +# ISDN subsystem # -# CONFIG_HAMRADIO is not set +# CONFIG_ISDN is not set # -# IrDA (infrared) support +# Telephony Support # -# CONFIG_IRDA is not set +# CONFIG_PHONE is not set # -# ISDN subsystem +# Input device support # -# CONFIG_ISDN is not set +# CONFIG_INPUT is not set # -# CD-ROM drivers (not for SCSI or IDE/ATAPI drives) +# Userland interfaces # -# CONFIG_CD_NO_IDESCSI is not set # -# Input core support +# Input I/O drivers +# +# CONFIG_GAMEPORT is not set +CONFIG_SOUND_GAMEPORT=y +CONFIG_SERIO=y +# CONFIG_SERIO_I8042 is not set +# CONFIG_SERIO_SERPORT is not set +# CONFIG_SERIO_CT82C710 is not set + +# +# Input Device Drivers # -# CONFIG_INPUT is not set # # Character devices # # CONFIG_VT is not set -# CONFIG_SERIAL is not set -# CONFIG_SERIAL_EXTENDED is not set # CONFIG_SERIAL_NONSTANDARD is not set -# CONFIG_UNIX98_PTYS is not set # -# I2C support +# Serial drivers # -# CONFIG_I2C is not set +# CONFIG_SERIAL_8250 is not set # -# Mice +# Non-8250 serial port support # -# CONFIG_BUSMOUSE is not set -# CONFIG_MOUSE is not set +CONFIG_UNIX98_PTYS=y +CONFIG_LEGACY_PTYS=y +CONFIG_LEGACY_PTY_COUNT=256 +# CONFIG_QIC02_TAPE is not set # -# Joysticks +# IPMI # -# CONFIG_JOYSTICK is not set -# CONFIG_QIC02_TAPE is not set +# CONFIG_IPMI_HANDLER is not set # # Watchdog Cards # # CONFIG_WATCHDOG is not set -# CONFIG_INTEL_RNG is not set -# CONFIG_NVRAM is not set # CONFIG_RTC is not set +# CONFIG_GEN_RTC is not set # CONFIG_DTLK is not set # CONFIG_R3964 is not set # CONFIG_APPLICOM is not set @@ -330,6 +450,7 @@ # CONFIG_FTAPE is not set # CONFIG_AGP is not set # CONFIG_DRM is not set +# CONFIG_RAW_DRIVER is not set # # Multimedia devices @@ -337,76 +458,98 @@ # CONFIG_VIDEO_DEV is not set # +# Digital Video Broadcasting Devices +# +# CONFIG_DVB is not set + +# # File systems # +# CONFIG_EXT2_FS is not set +# CONFIG_EXT3_FS is not set +# CONFIG_JBD is not set +# CONFIG_REISERFS_FS is not set +# CONFIG_JFS_FS is not set +# CONFIG_XFS_FS is not set +# CONFIG_MINIX_FS is not set +# CONFIG_ROMFS_FS is not set # CONFIG_QUOTA is not set # CONFIG_AUTOFS_FS is not set # CONFIG_AUTOFS4_FS is not set + +# +# CD-ROM/DVD Filesystems +# +# CONFIG_ISO9660_FS is not set +# CONFIG_UDF_FS is not set + +# +# DOS/FAT/NT Filesystems +# +# CONFIG_FAT_FS is not set +# CONFIG_NTFS_FS is not set + +# +# Pseudo filesystems +# +CONFIG_PROC_FS=y +CONFIG_PROC_KCORE=y +CONFIG_SYSFS=y +# CONFIG_DEVFS_FS is not set +# CONFIG_DEVPTS_FS_XATTR is not set +CONFIG_TMPFS=y +# CONFIG_HUGETLB_PAGE is not set +CONFIG_RAMFS=y + +# +# Miscellaneous filesystems +# # CONFIG_ADFS_FS is not set -# CONFIG_ADFS_FS_RW is not set # CONFIG_AFFS_FS is not set # CONFIG_HFS_FS is not set +# CONFIG_HFSPLUS_FS is not set +# CONFIG_BEFS_FS is not set # CONFIG_BFS_FS is not set -# CONFIG_FAT_FS is not set -# CONFIG_MSDOS_FS is not set -# CONFIG_UMSDOS_FS is not set -# CONFIG_VFAT_FS is not set # CONFIG_EFS_FS is not set -# CONFIG_JFFS_FS is not set +CONFIG_JFFS_FS=y +CONFIG_JFFS_FS_VERBOSE=0 +# CONFIG_JFFS2_FS is not set CONFIG_CRAMFS=y -CONFIG_RAMFS=y -# CONFIG_ISO9660_FS is not set -# CONFIG_JOLIET is not set -# CONFIG_MINIX_FS is not set -# CONFIG_NTFS_FS is not set -# CONFIG_NTFS_DEBUG is not set -# CONFIG_NTFS_RW is not set +# CONFIG_VXFS_FS is not set # CONFIG_HPFS_FS is not set -CONFIG_PROC_FS=y -# CONFIG_DEVFS_FS is not set -# CONFIG_DEVFS_MOUNT is not set -# CONFIG_DEVFS_DEBUG is not set -# CONFIG_DEVPTS_FS is not set # CONFIG_QNX4FS_FS is not set -# CONFIG_QNX4FS_RW is not set -# CONFIG_ROMFS_FS is not set -# CONFIG_EXT2_FS is not set # CONFIG_SYSV_FS is not set -# CONFIG_SYSV_FS_WRITE is not set -# CONFIG_UDF_FS is not set -# CONFIG_UDF_RW is not set # CONFIG_UFS_FS is not set -# CONFIG_UFS_FS_WRITE is not set # # Network File Systems # -# CONFIG_CODA_FS is not set -# CONFIG_NFS_FS is not set -# CONFIG_NFS_V3 is not set -# CONFIG_ROOT_NFS is not set +CONFIG_NFS_FS=y +CONFIG_NFS_V3=y +# CONFIG_NFS_V4 is not set +# CONFIG_NFS_DIRECTIO is not set # CONFIG_NFSD is not set -# CONFIG_NFSD_V3 is not set -# CONFIG_SUNRPC is not set -# CONFIG_LOCKD is not set +CONFIG_LOCKD=y +CONFIG_LOCKD_V4=y +# CONFIG_EXPORTFS is not set +CONFIG_SUNRPC=y +# CONFIG_RPCSEC_GSS_KRB5 is not set # CONFIG_SMB_FS is not set +# CONFIG_CIFS is not set # CONFIG_NCP_FS is not set -# CONFIG_NCPFS_PACKET_SIGNING is not set -# CONFIG_NCPFS_IOCTL_LOCKING is not set -# CONFIG_NCPFS_STRONG is not set -# CONFIG_NCPFS_NFS_NS is not set -# CONFIG_NCPFS_OS2_NS is not set -# CONFIG_NCPFS_SMALLDOS is not set -# CONFIG_NCPFS_MOUNT_SUBDIR is not set -# CONFIG_NCPFS_NDS_DOMAINS is not set -# CONFIG_NCPFS_NLS is not set -# CONFIG_NCPFS_EXTRAS is not set +# CONFIG_CODA_FS is not set +# CONFIG_INTERMEZZO_FS is not set +# CONFIG_AFS_FS is not set # # Partition Types # # CONFIG_PARTITION_ADVANCED is not set CONFIG_MSDOS_PARTITION=y + +# +# Native Language Support +# # CONFIG_NLS is not set # @@ -417,9 +560,33 @@ # # USB support # -# CONFIG_USB is not set + +# +# USB Gadget Support +# +# CONFIG_USB_GADGET is not set # # Kernel hacking # # CONFIG_PROFILE is not set +# CONFIG_ETRAX_KGDB is not set +# CONFIG_DEBUG_INFO is not set +# CONFIG_FRAME_POINTER is not set + +# +# Security options +# +# CONFIG_SECURITY is not set + +# +# Cryptographic options +# +# CONFIG_CRYPTO is not set + +# +# Library routines +# +# CONFIG_CRC32 is not set +# CONFIG_LIBCRC32C is not set +CONFIG_ZLIB_INFLATE=y diff -urN linux-2.6.7-rc2/arch/cris/kernel/Makefile linux-2.6.7-rc3/arch/cris/kernel/Makefile --- linux-2.6.7-rc2/arch/cris/kernel/Makefile 2004-05-09 19:32:39.000000000 -0700 +++ linux-2.6.7-rc3/arch/cris/kernel/Makefile 2004-06-07 12:55:01.268550398 -0700 @@ -1,14 +1,14 @@ -# $Id: Makefile,v 1.8 2003/04/09 05:20:47 starvik Exp $ +# $Id: Makefile,v 1.10 2004/05/14 10:18:12 starvik Exp $ # # Makefile for the linux kernel. # -extra-y := vmlinux.lds.s +extra-y := vmlinux.lds.s obj-y := process.o traps.o irq.o ptrace.o setup.o \ time.o sys_cris.o semaphore.o -obj-$(CONFIG_MODULES) += ksyms.o +obj-$(CONFIG_MODULES) += crisksyms.o obj-$(CONFIG_MODULES) += module.o clean: diff -urN linux-2.6.7-rc2/arch/cris/kernel/crisksyms.c linux-2.6.7-rc3/arch/cris/kernel/crisksyms.c --- linux-2.6.7-rc2/arch/cris/kernel/crisksyms.c 1969-12-31 16:00:00.000000000 -0800 +++ linux-2.6.7-rc3/arch/cris/kernel/crisksyms.c 2004-06-07 12:55:01.268550398 -0700 @@ -0,0 +1,104 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern void dump_thread(struct pt_regs *, struct user *); +extern unsigned long get_cmos_time(void); +extern void __Udiv(void); +extern void __Umod(void); +extern void __Div(void); +extern void __Mod(void); +extern void __ashrdi3(void); +extern void iounmap(void *addr); + +/* Platform dependent support */ +EXPORT_SYMBOL(dump_thread); +EXPORT_SYMBOL(enable_irq); +EXPORT_SYMBOL(disable_irq); +EXPORT_SYMBOL(kernel_thread); +EXPORT_SYMBOL(get_cmos_time); +EXPORT_SYMBOL(loops_per_usec); + +/* String functions */ +EXPORT_SYMBOL(memcmp); +EXPORT_SYMBOL(memmove); +EXPORT_SYMBOL(strpbrk); +EXPORT_SYMBOL(strstr); +EXPORT_SYMBOL(strcpy); +EXPORT_SYMBOL(strchr); +EXPORT_SYMBOL(strcmp); +EXPORT_SYMBOL(strlen); +EXPORT_SYMBOL(strcat); +EXPORT_SYMBOL(strncat); +EXPORT_SYMBOL(strncmp); +EXPORT_SYMBOL(strncpy); + +/* Math functions */ +EXPORT_SYMBOL(__Udiv); +EXPORT_SYMBOL(__Umod); +EXPORT_SYMBOL(__Div); +EXPORT_SYMBOL(__Mod); +EXPORT_SYMBOL(__ashrdi3); + +/* Memory functions */ +EXPORT_SYMBOL(__ioremap); +EXPORT_SYMBOL(iounmap); + +/* Semaphore functions */ +EXPORT_SYMBOL(__up); +EXPORT_SYMBOL(__down); +EXPORT_SYMBOL(__down_interruptible); +EXPORT_SYMBOL(__down_trylock); + +/* Export shadow registers for the CPU I/O pins */ +EXPORT_SYMBOL(genconfig_shadow); +EXPORT_SYMBOL(port_pa_data_shadow); +EXPORT_SYMBOL(port_pa_dir_shadow); +EXPORT_SYMBOL(port_pb_data_shadow); +EXPORT_SYMBOL(port_pb_dir_shadow); +EXPORT_SYMBOL(port_pb_config_shadow); +EXPORT_SYMBOL(port_g_data_shadow); + +/* Userspace access functions */ +EXPORT_SYMBOL(__copy_user_zeroing); +EXPORT_SYMBOL(__copy_user); + +/* Cache flush functions */ +EXPORT_SYMBOL(flush_etrax_cache); +EXPORT_SYMBOL(prepare_rx_descriptor); + +#undef memcpy +#undef memset +extern void * memset(void *, int, __kernel_size_t); +extern void * memcpy(void *, const void *, __kernel_size_t); +EXPORT_SYMBOL_NOVERS(memcpy); +EXPORT_SYMBOL_NOVERS(memset); + +#ifdef CONFIG_ETRAX_FAST_TIMER +/* Fast timer functions */ +EXPORT_SYMBOL(fast_timer_list); +EXPORT_SYMBOL(start_one_shot_timer); +EXPORT_SYMBOL(del_fast_timer); +EXPORT_SYMBOL(schedule_usleep); +#endif + diff -urN linux-2.6.7-rc2/arch/cris/kernel/hexify.c linux-2.6.7-rc3/arch/cris/kernel/hexify.c --- linux-2.6.7-rc2/arch/cris/kernel/hexify.c 2004-05-09 19:33:13.000000000 -0700 +++ linux-2.6.7-rc3/arch/cris/kernel/hexify.c 1969-12-31 16:00:00.000000000 -0800 @@ -1,31 +0,0 @@ -#include - - -void main() -{ - int c; - int comma=0; - int count=0; - while((c=getchar())!=EOF) - { - unsigned char x=c; - if(comma) - printf(","); - else - comma=1; - if(count==8) - { - count=0; - printf("\n"); - } - if(count==0) - printf("\t"); - printf("0x%02X",c); - count++; - } - if(count) - printf("\n"); - exit(0); -} - - diff -urN linux-2.6.7-rc2/arch/cris/kernel/irq.c linux-2.6.7-rc3/arch/cris/kernel/irq.c --- linux-2.6.7-rc2/arch/cris/kernel/irq.c 2004-05-09 19:33:21.000000000 -0700 +++ linux-2.6.7-rc3/arch/cris/kernel/irq.c 2004-06-07 12:55:01.272550564 -0700 @@ -1,4 +1,4 @@ -/* $Id: irq.c,v 1.8 2003/07/04 08:27:52 starvik Exp $ +/* * * linux/arch/cris/kernel/irq.c * @@ -99,7 +99,7 @@ if (!action) goto skip; seq_printf(p, "%2d: %10u %c %s", - i, kstat_cpu(0).irqs[i], + i, kstat_this_cpu.irqs[i], (action->flags & SA_INTERRUPT) ? '+' : ' ', action->name); for (action = action->next; action; action = action->next) { @@ -129,13 +129,12 @@ cpu = smp_processor_id(); irq_enter(); - kstat_cpu(cpu).irqs[irq]++; + kstat_cpu(cpu).irqs[irq - FIRST_IRQ]++; + action = irq_action[irq - FIRST_IRQ]; - action = irq_action[irq]; if (action) { if (!(action->flags & SA_INTERRUPT)) local_irq_enable(); - action = irq_action[irq]; do_random = 0; do { do_random |= action->flags; @@ -175,7 +174,7 @@ struct irqaction *old, **p; unsigned long flags; - p = irq_action + irq; + p = irq_action + irq - FIRST_IRQ; if ((old = *p) != NULL) { /* Can't share interrupts unless both agree to */ if (!(old->flags & new->flags & SA_SHIRQ)) @@ -230,12 +229,6 @@ int retval; struct irqaction * action; - /* interrupts 0 and 1 are hardware breakpoint and NMI and we can't support - these yet. interrupt 15 is the multiple irq, it's special. */ - - if(irq < 2 || irq == 15 || irq >= NR_IRQS) - return -EINVAL; - if(!handler) return -EINVAL; @@ -270,7 +263,7 @@ printk("Trying to free IRQ%d\n",irq); return; } - for (p = irq + irq_action; (action = *p) != NULL; p = &action->next) { + for (p = irq - FIRST_IRQ + irq_action; (action = *p) != NULL; p = &action->next) { if (action->dev_id != dev_id) continue; @@ -278,7 +271,7 @@ local_save_flags(flags); local_irq_disable(); *p = action->next; - if (!irq_action[irq]) { + if (!irq_action[irq - FIRST_IRQ]) { mask_irq(irq); arch_free_irq(irq); } diff -urN linux-2.6.7-rc2/arch/cris/kernel/ksyms.c linux-2.6.7-rc3/arch/cris/kernel/ksyms.c --- linux-2.6.7-rc2/arch/cris/kernel/ksyms.c 2004-05-09 19:32:54.000000000 -0700 +++ linux-2.6.7-rc3/arch/cris/kernel/ksyms.c 1969-12-31 16:00:00.000000000 -0800 @@ -1,96 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -extern void dump_thread(struct pt_regs *, struct user *); -extern unsigned long get_cmos_time(void); -extern void __Udiv(void); -extern void __Umod(void); -extern void __Div(void); -extern void __Mod(void); -extern void __ashrdi3(void); -extern void iounmap(void *addr); - -/* Platform dependent support */ -EXPORT_SYMBOL(dump_thread); -EXPORT_SYMBOL(enable_irq); -EXPORT_SYMBOL(disable_irq); -EXPORT_SYMBOL(kernel_thread); -EXPORT_SYMBOL(get_cmos_time); -EXPORT_SYMBOL(loops_per_usec); - -/* String functions */ -EXPORT_SYMBOL(memcmp); -EXPORT_SYMBOL(memmove); -EXPORT_SYMBOL(strpbrk); -EXPORT_SYMBOL(strstr); -EXPORT_SYMBOL(strcpy); -EXPORT_SYMBOL(strchr); -EXPORT_SYMBOL(strcmp); -EXPORT_SYMBOL(strlen); -EXPORT_SYMBOL(strcat); -EXPORT_SYMBOL(strncat); -EXPORT_SYMBOL(strncmp); -EXPORT_SYMBOL(strncpy); - -/* Math functions */ -EXPORT_SYMBOL(__Udiv); -EXPORT_SYMBOL(__Umod); -EXPORT_SYMBOL(__Div); -EXPORT_SYMBOL(__Mod); -EXPORT_SYMBOL(__ashrdi3); - -/* Memory functions */ -EXPORT_SYMBOL(__ioremap); -EXPORT_SYMBOL(iounmap); - -/* Semaphore functions */ -EXPORT_SYMBOL(__up); -EXPORT_SYMBOL(__down); -EXPORT_SYMBOL(__down_interruptible); -EXPORT_SYMBOL(__down_trylock); - -/* Export shadow registers for the CPU I/O pins */ -EXPORT_SYMBOL(genconfig_shadow); -EXPORT_SYMBOL(port_pa_data_shadow); -EXPORT_SYMBOL(port_pa_dir_shadow); -EXPORT_SYMBOL(port_pb_data_shadow); -EXPORT_SYMBOL(port_pb_dir_shadow); -EXPORT_SYMBOL(port_pb_config_shadow); -EXPORT_SYMBOL(port_g_data_shadow); - -/* Userspace access functions */ -EXPORT_SYMBOL(__copy_user_zeroing); -EXPORT_SYMBOL(__copy_user); - -/* Cache flush functions */ -EXPORT_SYMBOL(flush_etrax_cache); -EXPORT_SYMBOL(prepare_rx_descriptor); - -#undef memcpy -#undef memset -extern void * memset(void *, int, __kernel_size_t); -extern void * memcpy(void *, const void *, __kernel_size_t); -EXPORT_SYMBOL_NOVERS(memcpy); -EXPORT_SYMBOL_NOVERS(memset); - - diff -urN linux-2.6.7-rc2/arch/cris/kernel/module.c linux-2.6.7-rc3/arch/cris/kernel/module.c --- linux-2.6.7-rc2/arch/cris/kernel/module.c 2004-05-09 19:32:27.000000000 -0700 +++ linux-2.6.7-rc3/arch/cris/kernel/module.c 2004-06-07 12:55:01.274550647 -0700 @@ -75,8 +75,6 @@ sym = (Elf32_Sym *)sechdrs[symindex].sh_addr + ELF32_R_SYM(rel[i].r_info); - /* TODO: This is probably not correct */ - printk("Beware: untested code in module.c!\n"); /* We add the value into the location given */ *location += sym->st_value; } @@ -89,9 +87,26 @@ unsigned int relsec, struct module *me) { - printk(KERN_ERR "module %s: ADD RELOCATION unsupported\n", - me->name); - return -ENOEXEC; + unsigned int i; + Elf32_Rela *rela = (void *)sechdrs[relsec].sh_addr; + + DEBUGP ("Applying relocate section %u to %u\n", relsec, + sechdrs[relsec].sh_info); + + for (i = 0; i < sechdrs[relsec].sh_size / sizeof (*rela); i++) { + /* This is where to make the change */ + uint32_t *loc + = ((void *)sechdrs[sechdrs[relsec].sh_info].sh_addr + + rela[i].r_offset); + /* This is the symbol it is referring to. Note that all + undefined symbols have been resolved. */ + Elf32_Sym *sym + = ((Elf32_Sym *)sechdrs[symindex].sh_addr + + ELF32_R_SYM (rela[i].r_info)); + *loc = sym->st_value + rela[i].r_addend; + } + + return 0; } int module_finalize(const Elf_Ehdr *hdr, diff -urN linux-2.6.7-rc2/arch/cris/kernel/process.c linux-2.6.7-rc3/arch/cris/kernel/process.c --- linux-2.6.7-rc2/arch/cris/kernel/process.c 2004-05-09 19:32:52.000000000 -0700 +++ linux-2.6.7-rc3/arch/cris/kernel/process.c 2004-06-07 12:55:01.274550647 -0700 @@ -1,4 +1,4 @@ -/* $Id: process.c,v 1.14 2003/06/10 10:21:12 johana Exp $ +/* $Id: process.c,v 1.17 2004/04/05 13:53:48 starvik Exp $ * * linux/arch/cris/kernel/process.c * @@ -8,9 +8,18 @@ * Authors: Bjorn Wesen (bjornw@axis.com) * * $Log: process.c,v $ + * Revision 1.17 2004/04/05 13:53:48 starvik + * Merge of Linux 2.6.5 + * + * Revision 1.16 2003/10/27 08:04:33 starvik + * Merge of Linux 2.6.0-test9 + * + * Revision 1.15 2003/09/11 07:29:52 starvik + * Merge of Linux 2.6.0-test5 + * * Revision 1.14 2003/06/10 10:21:12 johana * Moved thread_saved_pc() from arch/cris/kernel/process.c to - * subarch specific process.c. + * subarch specific process.c. arch-v32 has an erp, no irp. * * Revision 1.13 2003/04/09 05:20:47 starvik * Merge of Linux 2.5.67 @@ -94,6 +103,7 @@ #include #include #include +#include #include #include #include @@ -182,13 +192,17 @@ { /* endless idle loop with no priority at all */ while (1) { - void (*idle)(void) = pm_idle; - if (!idle) - idle = default_idle; - while (!need_resched()) + while (!need_resched()) { + void (*idle)(void) = pm_idle; + + if (!idle) + idle = default_idle; + idle(); + } schedule(); } + } void hard_reset_now (void); diff -urN linux-2.6.7-rc2/arch/cris/kernel/setup.c linux-2.6.7-rc3/arch/cris/kernel/setup.c --- linux-2.6.7-rc2/arch/cris/kernel/setup.c 2004-05-09 19:33:19.000000000 -0700 +++ linux-2.6.7-rc3/arch/cris/kernel/setup.c 2004-06-07 12:55:01.275550688 -0700 @@ -1,4 +1,4 @@ -/* $Id: setup.c,v 1.7 2003/07/04 08:27:52 starvik Exp $ +/* * * linux/arch/cris/kernel/setup.c * @@ -10,6 +10,7 @@ * This file handles the architecture-dependent parts of initialization */ +#include #include #include #include @@ -38,6 +39,8 @@ extern unsigned long romfs_start, romfs_length, romfs_in_flash; /* from head.S */ +extern void show_etrax_copyright(void); /* arch-vX/kernel/setup.c */ + /* This mainly sets up the memory area, and can be really confusing. * * The physical DRAM is virtually mapped into dram_start to dram_end @@ -153,18 +156,16 @@ *cmdline_p = command_line; #ifdef CONFIG_ETRAX_CMDLINE - strlcpy(command_line, CONFIG_ETRAX_CMDLINE, sizeof(command_line)); -#elif defined(CONFIG_ETRAX_ROOT_DEVICE) - strlcpy(command_line, "root=", sizeof(command_line)); - strlcat(command_line, CONFIG_ETRAX_ROOT_DEVICE, - sizeof(command_line)); -#endif + strlcpy(command_line, CONFIG_ETRAX_CMDLINE, COMMAND_LINE_SIZE); command_line[COMMAND_LINE_SIZE - 1] = '\0'; - /* give credit for the CRIS port */ - - printk("Linux/CRIS port on ETRAX 100LX (c) 2001 Axis Communications AB\n"); + /* Save command line for future references. */ + memcpy(saved_command_line, command_line, COMMAND_LINE_SIZE); + saved_command_line[COMMAND_LINE_SIZE - 1] = '\0'; +#endif + /* give credit for the CRIS port */ + show_etrax_copyright(); } static void *c_start(struct seq_file *m, loff_t *pos) diff -urN linux-2.6.7-rc2/arch/cris/kernel/sys_cris.c linux-2.6.7-rc3/arch/cris/kernel/sys_cris.c --- linux-2.6.7-rc2/arch/cris/kernel/sys_cris.c 2004-05-09 19:31:58.000000000 -0700 +++ linux-2.6.7-rc3/arch/cris/kernel/sys_cris.c 2004-06-07 12:55:01.275550688 -0700 @@ -1,4 +1,4 @@ -/* $Id: sys_cris.c,v 1.5 2003/07/04 08:27:52 starvik Exp $ +/* $Id: sys_cris.c,v 1.6 2004/03/11 11:38:40 starvik Exp $ * * linux/arch/cris/kernel/sys_cris.c * diff -urN linux-2.6.7-rc2/arch/cris/kernel/time.c linux-2.6.7-rc3/arch/cris/kernel/time.c --- linux-2.6.7-rc2/arch/cris/kernel/time.c 2004-05-09 19:32:38.000000000 -0700 +++ linux-2.6.7-rc3/arch/cris/kernel/time.c 2004-06-07 12:55:01.275550688 -0700 @@ -1,4 +1,4 @@ -/* $Id: time.c,v 1.9 2003/07/04 08:27:52 starvik Exp $ +/* $Id: time.c,v 1.14 2004/06/01 05:38:11 starvik Exp $ * * linux/arch/cris/kernel/time.c * @@ -29,6 +29,7 @@ #include #include #include +#include u64 jiffies_64 = INITIAL_JIFFIES; @@ -39,6 +40,8 @@ #define TICK_SIZE tick extern unsigned long wall_jiffies; +extern unsigned long loops_per_jiffy; /* init/main.c */ +unsigned long loops_per_usec; extern unsigned long do_slow_gettimeoffset(void); static unsigned long (*do_gettimeoffset)(void) = do_slow_gettimeoffset; @@ -62,6 +65,15 @@ if (lost) usec += lost * (1000000 / HZ); } + + /* + * If time_adjust is negative then NTP is slowing the clock + * so make sure not to go into next possible interval. + * Better to lose some accuracy than have time go backwards.. + */ + if (unlikely(time_adjust < 0) && usec > tickadj) + usec = tickadj; + sec = xtime.tv_sec; usec += xtime.tv_nsec / 1000; local_irq_restore(flags); @@ -79,35 +91,33 @@ int do_settimeofday(struct timespec *tv) { - unsigned long flags; + time_t wtm_sec, sec = tv->tv_sec; + long wtm_nsec, nsec = tv->tv_nsec; - if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC) + if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC) return -EINVAL; - local_irq_save(flags); - local_irq_disable(); - - /* This is revolting. We need to set the xtime.tv_usec - * correctly. However, the value in this location is - * is value at the last tick. - * Discover what correction gettimeofday - * would have done, and then undo it! + write_seqlock_irq(&xtime_lock); + /* + * This is revolting. We need to set "xtime" correctly. However, the + * value in this location is the value at the most recent update of + * wall time. Discover what correction gettimeofday() would have + * made, and then undo it! */ - tv->tv_nsec -= do_gettimeoffset() * 1000; - tv->tv_nsec -= (jiffies - wall_jiffies) * TICK_NSEC; + nsec -= do_gettimeoffset() * NSEC_PER_USEC; + nsec -= (jiffies - wall_jiffies) * TICK_NSEC; + + wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec); + wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec); + + set_normalized_timespec(&xtime, sec, nsec); + set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec); - while (tv->tv_nsec < 0) { - tv->tv_nsec += NSEC_PER_SEC; - tv->tv_sec--; - } - xtime.tv_sec = tv->tv_sec; - xtime.tv_nsec = tv->tv_nsec; time_adjust = 0; /* stop active adjtime() */ time_status |= STA_UNSYNC; - time_state = TIME_ERROR; /* p. 24, (a) */ time_maxerror = NTP_PHASE_LIMIT; time_esterror = NTP_PHASE_LIMIT; - local_irq_restore(flags); + write_sequnlock_irq(&xtime_lock); clock_was_set(); return 0; } @@ -125,7 +135,7 @@ int retval = 0; int real_seconds, real_minutes, cmos_minutes; - printk("set_rtc_mmss(%lu)\n", nowtime); + printk(KERN_DEBUG "set_rtc_mmss(%lu)\n", nowtime); if(!have_rtc) return 0; @@ -174,7 +184,8 @@ mon = CMOS_READ(RTC_MONTH); year = CMOS_READ(RTC_YEAR); - printk("rtc: sec 0x%x min 0x%x hour 0x%x day 0x%x mon 0x%x year 0x%x\n", + printk(KERN_DEBUG + "rtc: sec 0x%x min 0x%x hour 0x%x day 0x%x mon 0x%x year 0x%x\n", sec, min, hour, day, mon, year); BCD_TO_BIN(sec); @@ -202,3 +213,20 @@ xtime.tv_nsec = 0; } } + +/* + * Scheduler clock - returns current time in nanosec units. + */ +unsigned long long sched_clock(void) +{ + return (unsigned long long)jiffies * (1000000000 / HZ); +} + +static int +__init init_udelay(void) +{ + loops_per_usec = (loops_per_jiffy * HZ) / 1000000; + return 0; +} + +__initcall(init_udelay); diff -urN linux-2.6.7-rc2/arch/cris/kernel/traps.c linux-2.6.7-rc3/arch/cris/kernel/traps.c --- linux-2.6.7-rc2/arch/cris/kernel/traps.c 2004-05-09 19:33:13.000000000 -0700 +++ linux-2.6.7-rc3/arch/cris/kernel/traps.c 2004-06-07 12:55:01.276550729 -0700 @@ -1,4 +1,4 @@ -/* $Id: traps.c,v 1.7 2003/07/04 08:27:52 starvik Exp $ +/* $Id: traps.c,v 1.9 2004/05/11 12:28:26 starvik Exp $ * * linux/arch/cris/traps.c * @@ -14,6 +14,7 @@ */ #include +#include #include #include diff -urN linux-2.6.7-rc2/arch/cris/mm/fault.c linux-2.6.7-rc3/arch/cris/mm/fault.c --- linux-2.6.7-rc2/arch/cris/mm/fault.c 2004-05-09 19:33:19.000000000 -0700 +++ linux-2.6.7-rc3/arch/cris/mm/fault.c 2004-06-07 12:55:01.276550729 -0700 @@ -6,9 +6,18 @@ * Authors: Bjorn Wesen * * $Log: fault.c,v $ + * Revision 1.11 2004/05/14 07:58:05 starvik + * Merge of changes from 2.4 + * + * Revision 1.10 2003/10/27 14:51:24 starvik + * Removed debugcode + * + * Revision 1.9 2003/10/27 14:50:42 starvik + * Changed do_page_fault signature + * * Revision 1.8 2003/07/04 13:02:48 tobiasa * Moved code snippet from arch/cris/mm/fault.c that searches for fixup code - * to separate function in arch-specific files. + * to seperate function in arch-specific files. * * Revision 1.7 2003/01/22 06:48:38 starvik * Fixed warnings issued by GCC 3.2.1 @@ -95,10 +104,6 @@ extern int find_fixup_code(struct pt_regs *); extern void die_if_kernel(const char *, struct pt_regs *, long); -asmlinkage void do_invalid_op (struct pt_regs *, unsigned long); -asmlinkage void do_page_fault(unsigned long address, struct pt_regs *regs, - int error_code); - /* debug of low-level TLB reload */ #undef DEBUG @@ -134,14 +139,16 @@ asmlinkage void do_page_fault(unsigned long address, struct pt_regs *regs, - int error_code) + int protection, int writeaccess) { struct task_struct *tsk; struct mm_struct *mm; struct vm_area_struct * vma; - int writeaccess; siginfo_t info; + D(printk("Page fault for %X at %X, prot %d write %d\n", + address, regs->erp, protection, writeaccess)); + tsk = current; /* @@ -164,7 +171,7 @@ */ if (address >= VMALLOC_START && - !(error_code & 1) && + !protection && !user_mode(regs)) goto vmalloc_fault; @@ -172,7 +179,6 @@ sti(); mm = tsk->mm; - writeaccess = error_code & 2; info.si_code = SEGV_MAPERR; /* @@ -291,7 +297,7 @@ printk(KERN_ALERT "Unable to handle kernel access"); printk(" at virtual address %08lx\n",address); - die_if_kernel("Oops", regs, error_code); + die_if_kernel("Oops", regs, (writeaccess << 1) | protection); do_exit(SIGKILL); diff -urN linux-2.6.7-rc2/arch/cris/mm/init.c linux-2.6.7-rc3/arch/cris/mm/init.c --- linux-2.6.7-rc2/arch/cris/mm/init.c 2004-05-09 19:32:29.000000000 -0700 +++ linux-2.6.7-rc3/arch/cris/mm/init.c 2004-06-07 12:55:01.277550771 -0700 @@ -7,6 +7,13 @@ * Authors: Bjorn Wesen (bjornw@axis.com) * * $Log: init.c,v $ + * Revision 1.11 2004/05/28 09:28:56 starvik + * Calculation of loops_per_usec moved because initalization order has changed + * in Linux 2.6. + * + * Revision 1.10 2004/05/14 07:58:05 starvik + * Merge of changes from 2.4 + * * Revision 1.9 2003/07/04 08:27:54 starvik * Merge of Linux 2.5.74 * @@ -120,9 +127,6 @@ unsigned long empty_zero_page; -extern unsigned long loops_per_jiffy; /* init/main.c */ -unsigned long loops_per_usec; - extern char _stext, _edata, _etext; /* From linkerscript */ extern char __init_begin, __init_end; @@ -190,7 +194,8 @@ datasize = (unsigned long) &_edata - (unsigned long) &_etext; initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin; - printk("Memory: %luk/%luk available (%dk kernel code, %dk reserved, %dk data, " + printk(KERN_INFO + "Memory: %luk/%luk available (%dk kernel code, %dk reserved, %dk data, " "%dk init)\n" , (unsigned long) nr_free_pages() << (PAGE_SHIFT-10), max_mapnr << (PAGE_SHIFT-10), @@ -199,16 +204,6 @@ datasize >> 10, initsize >> 10 ); - - /* HACK alert - calculate a loops_per_usec for asm/delay.h here - * since this is called just after calibrate_delay in init/main.c - * but before places which use udelay. cannot be in time.c since - * that is called _before_ calibrate_delay - */ - - loops_per_usec = (loops_per_jiffy * HZ) / 1000000; - - return; } /* free the pages occupied by initialization code */ @@ -225,6 +220,6 @@ free_page(addr); totalram_pages++; } - printk ("Freeing unused kernel memory: %luk freed\n", + printk (KERN_INFO "Freeing unused kernel memory: %luk freed\n", (unsigned long)((&__init_end - &__init_begin) >> 10)); } diff -urN linux-2.6.7-rc2/arch/cris/mm/ioremap.c linux-2.6.7-rc3/arch/cris/mm/ioremap.c --- linux-2.6.7-rc2/arch/cris/mm/ioremap.c 2004-05-09 19:32:00.000000000 -0700 +++ linux-2.6.7-rc3/arch/cris/mm/ioremap.c 2004-06-07 12:55:01.277550771 -0700 @@ -118,31 +118,6 @@ if (!size || last_addr < phys_addr) return NULL; -#if 0 - /* TODO: Here we can put checks for driver-writer abuse... */ - - /* - * Don't remap the low PCI/ISA area, it's always mapped.. - */ - if (phys_addr >= 0xA0000 && last_addr < 0x100000) - return phys_to_virt(phys_addr); - - /* - * Don't allow anybody to remap normal RAM that we're using.. - */ - if (phys_addr < virt_to_phys(high_memory)) { - char *t_addr, *t_end; - struct page *page; - - t_addr = __va(phys_addr); - t_end = t_addr + (size - 1); - - for(page = virt_to_page(t_addr); page <= virt_to_page(t_end); page++) - if(!PageReserved(page)) - return NULL; - } -#endif - /* * Mappings have to be page-aligned */ diff -urN linux-2.6.7-rc2/arch/i386/Kconfig linux-2.6.7-rc3/arch/i386/Kconfig --- linux-2.6.7-rc2/arch/i386/Kconfig 2004-06-07 12:54:48.288012793 -0700 +++ linux-2.6.7-rc3/arch/i386/Kconfig 2004-06-07 12:55:01.287551185 -0700 @@ -823,7 +823,7 @@ This option is only useful on systems that have EFI firmware and will result in a kernel image that is ~8k larger. In addition, you must use the latest ELILO loader available at - in order to take advantage of + in order to take advantage of kernel initialization using EFI information (neither GRUB nor LILO know anything about EFI). However, even with this option, the resultant kernel should continue to boot on existing non-EFI platforms. diff -urN linux-2.6.7-rc2/arch/i386/Makefile linux-2.6.7-rc3/arch/i386/Makefile --- linux-2.6.7-rc2/arch/i386/Makefile 2004-06-07 12:54:48.288012793 -0700 +++ linux-2.6.7-rc3/arch/i386/Makefile 2004-06-07 12:55:01.287551185 -0700 @@ -18,6 +18,7 @@ LDFLAGS := -m elf_i386 OBJCOPYFLAGS := -O binary -R .note -R .comment -S LDFLAGS_vmlinux := +CHECK := $(CHECK) -D__i386__=1 CFLAGS += -pipe -msoft-float diff -urN linux-2.6.7-rc2/arch/i386/kernel/acpi/wakeup.S linux-2.6.7-rc3/arch/i386/kernel/acpi/wakeup.S --- linux-2.6.7-rc2/arch/i386/kernel/acpi/wakeup.S 2004-05-09 19:32:02.000000000 -0700 +++ linux-2.6.7-rc3/arch/i386/kernel/acpi/wakeup.S 2004-06-07 12:55:01.290551309 -0700 @@ -270,6 +270,7 @@ call save_registers pushl $3 call acpi_enter_sleep_state + addl $4,%esp ret .p2align 4,,7 ret_point: diff -urN linux-2.6.7-rc2/arch/i386/kernel/cpu/cpufreq/gx-suspmod.c linux-2.6.7-rc3/arch/i386/kernel/cpu/cpufreq/gx-suspmod.c --- linux-2.6.7-rc2/arch/i386/kernel/cpu/cpufreq/gx-suspmod.c 2004-06-07 12:54:48.293013000 -0700 +++ linux-2.6.7-rc3/arch/i386/kernel/cpu/cpufreq/gx-suspmod.c 2004-06-07 12:55:01.292551392 -0700 @@ -75,7 +75,6 @@ #include #include -#include #include #include #include diff -urN linux-2.6.7-rc2/arch/i386/kernel/cpu/cpufreq/longhaul.c linux-2.6.7-rc3/arch/i386/kernel/cpu/cpufreq/longhaul.c --- linux-2.6.7-rc2/arch/i386/kernel/cpu/cpufreq/longhaul.c 2004-06-07 12:54:48.294013041 -0700 +++ linux-2.6.7-rc3/arch/i386/kernel/cpu/cpufreq/longhaul.c 2004-06-07 12:55:01.293551434 -0700 @@ -18,7 +18,8 @@ */ #include -#include +#include +#include #include #include #include @@ -30,25 +31,28 @@ #include "longhaul.h" -#define DEBUG - -#ifdef DEBUG -#define dprintk(msg...) printk(msg) -#else -#define dprintk(msg...) do { } while(0) -#endif - #define PFX "longhaul: " static unsigned int numscales=16, numvscales; +static unsigned int fsb; static int minvid, maxvid; static int can_scale_voltage; static int vrmrev; - /* Module parameters */ static int dont_scale_voltage; -static unsigned int fsb; +static int debug; + +static void dprintk(const char *fmt, ...) +{ + va_list args; + if (debug == 0) + return; + va_start(args, fmt); + printk(fmt, args); + va_end(args); +} + #define __hlt() __asm__ __volatile__("hlt": : :"memory") @@ -78,11 +82,7 @@ rdmsr (MSR_IA32_EBL_CR_POWERON, lo, hi); invalue = (lo & (1<<22|1<<23|1<<24|1<<25)) >>22; - if (longhaul_version==2) { - if (lo & (1<<27)) - invalue+=16; - } - if (longhaul_version==4) { + if (longhaul_version==2 || longhaul_version==3) { if (lo & (1<<27)) invalue+=16; } @@ -118,8 +118,7 @@ cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); - dprintk (KERN_INFO PFX "FSB:%d Mult:%d.%dx\n", fsb, - mult/10, mult%10); + dprintk (KERN_INFO PFX "FSB:%d Mult:%d.%dx\n", fsb, mult/10, mult%10); switch (longhaul_version) { case 1: @@ -162,21 +161,21 @@ longhaul.bits.RevisionKey = 3; wrmsrl (MSR_VIA_LONGHAUL, longhaul.val); break; - case 4: + case 3: rdmsrl (MSR_VIA_LONGHAUL, longhaul.val); longhaul.bits.SoftBusRatio = clock_ratio_index & 0xf; longhaul.bits.SoftBusRatio4 = (clock_ratio_index & 0x10) >> 4; longhaul.bits.EnableSoftBusRatio = 1; - + longhaul.bits.RevisionKey = 0x0; - + wrmsrl(MSR_VIA_LONGHAUL, longhaul.val); __hlt(); - + rdmsrl (MSR_VIA_LONGHAUL, longhaul.val); longhaul.bits.EnableSoftBusRatio = 0; longhaul.bits.RevisionKey = 0xf; - wrmsrl (MSR_VIA_LONGHAUL, longhaul.val); + wrmsrl (MSR_VIA_LONGHAUL, longhaul.val); break; } @@ -227,7 +226,7 @@ static int __init longhaul_get_ranges (void) { struct cpuinfo_x86 *c = cpu_data; - unsigned long invalue,invalue2; + unsigned long invalue; unsigned int minmult=0, maxmult=0; unsigned int multipliers[32]= { 50,30,40,100,55,35,45,95,90,70,80,60,120,75,85,65, @@ -235,7 +234,8 @@ unsigned int j, k = 0; union msr_longhaul longhaul; unsigned long lo, hi; - unsigned int eblcr_fsb_table[] = { 66, 133, 100, -1 }; + unsigned int eblcr_fsb_table_v1[] = { 66, 133, 100, -1 }; + unsigned int eblcr_fsb_table_v2[] = { 133, 100, -1, 66 }; switch (longhaul_version) { case 1: @@ -246,7 +246,7 @@ rdmsr (MSR_IA32_EBL_CR_POWERON, lo, hi); invalue = (lo & (1<<18|1<<19)) >>18; if (c->x86_model==6) - fsb = eblcr_fsb_table[invalue]; + fsb = eblcr_fsb_table_v1[invalue]; else fsb = guess_fsb(maxmult); break; @@ -265,53 +265,38 @@ else minmult = multipliers[invalue]; - switch (longhaul.bits.MaxMHzFSB) { - case 0x0: fsb=133; - break; - case 0x1: fsb=100; - break; - case 0x2: printk (KERN_INFO PFX "Invalid (reserved) FSB!\n"); - return -EINVAL; - case 0x3: fsb=66; - break; - } + fsb = eblcr_fsb_table_v2[longhaul.bits.MaxMHzFSB]; break; - - case 4: + + case 3: rdmsrl (MSR_VIA_LONGHAUL, longhaul.val); - - //TODO: Nehemiah may have borken MaxMHzBR. - // need to extrapolate from FSB. - - invalue2 = longhaul.bits.MinMHzBR; - invalue = longhaul.bits.MaxMHzBR; - if (longhaul.bits.MaxMHzBR4) - invalue += 16; - maxmult=multipliers[invalue]; - - maxmult=longhaul_get_cpu_mult(); - - printk(KERN_INFO PFX " invalue: %ld maxmult: %d \n", invalue, maxmult); - printk(KERN_INFO PFX " invalue2: %ld \n", invalue2); - + + /* + * TODO: This code works, but raises a lot of questions. + * - Some Nehemiah's seem to have broken Min/MaxMHzBR's. + * We get around this by using a hardcoded multiplier of 5.0x + * for the minimimum speed, and the speed we booted up at for the max. + * This is done in longhaul_get_cpu_mult() by reading the EBLCR register. + * - According to some VIA documentation EBLCR is only + * in pre-Nehemiah C3s. How this still works is a mystery. + * We're possibly using something undocumented and unsupported, + * But it works, so we don't grumble. + */ minmult=50; - - switch (longhaul.bits.MaxMHzFSB) { - case 0x0: fsb=133; - break; - case 0x1: fsb=100; - break; - case 0x2: printk (KERN_INFO PFX "Invalid (reserved) FSB!\n"); - return -EINVAL; - case 0x3: fsb=66; - break; - } - - break; + maxmult=longhaul_get_cpu_mult(); + + fsb = eblcr_fsb_table_v2[longhaul.bits.MaxMHzFSB]; + break; } dprintk (KERN_INFO PFX "MinMult=%d.%dx MaxMult=%d.%dx\n", minmult/10, minmult%10, maxmult/10, maxmult%10); + + if (fsb == -1) { + printk (KERN_INFO PFX "Invalid (reserved) FSB!\n"); + return -EINVAL; + } + highest_speed = calc_speed (maxmult, fsb); lowest_speed = calc_speed (minmult,fsb); dprintk (KERN_INFO PFX "FSB: %dMHz Lowestspeed=%dMHz Highestspeed=%dMHz\n", @@ -418,13 +403,13 @@ unsigned int relation) { unsigned int table_index = 0; - unsigned int new_clock_ratio = 0; + unsigned int new_clock_ratio = 0; if (cpufreq_frequency_table_target(policy, longhaul_table, target_freq, relation, &table_index)) return -EINVAL; new_clock_ratio = longhaul_table[table_index].index & 0xFF; - + longhaul_setstate(new_clock_ratio); return 0; @@ -480,7 +465,7 @@ break; case 9: - longhaul_version=4; + longhaul_version=3; numscales=32; switch (c->x86_mask) { case 0 ... 1: @@ -500,7 +485,6 @@ break; } break; - default: cpuname = "Unknown"; @@ -514,11 +498,11 @@ if (ret != 0) return ret; - if ((longhaul_version==2) && (dont_scale_voltage==0)) + if ((longhaul_version==2) && (dont_scale_voltage==0)) longhaul_setup_voltagescaling(); policy->governor = CPUFREQ_DEFAULT_GOVERNOR; - policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; + policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; policy->cur = calc_speed (longhaul_get_cpu_mult(), fsb); ret = cpufreq_frequency_table_cpuinfo(policy, longhaul_table); @@ -530,7 +514,7 @@ return 0; } -static int __exit longhaul_cpu_exit(struct cpufreq_policy *policy) +static int __devexit longhaul_cpu_exit(struct cpufreq_policy *policy) { cpufreq_frequency_table_put_attr(policy->cpu); return 0; @@ -542,14 +526,14 @@ }; static struct cpufreq_driver longhaul_driver = { - .verify = longhaul_verify, - .target = longhaul_target, - .get = longhaul_get, - .init = longhaul_cpu_init, - .exit = longhaul_cpu_exit, - .name = "longhaul", - .owner = THIS_MODULE, - .attr = longhaul_attr, + .verify = longhaul_verify, + .target = longhaul_target, + .get = longhaul_get, + .init = longhaul_cpu_init, + .exit = __devexit_p(longhaul_cpu_exit), + .name = "longhaul", + .owner = THIS_MODULE, + .attr = longhaul_attr, }; static int __init longhaul_init (void) @@ -560,12 +544,8 @@ return -ENODEV; switch (c->x86_model) { - case 6 ... 8: + case 6 ... 9: return cpufreq_register_driver(&longhaul_driver); - case 9: - printk (KERN_INFO PFX "Nehemiah unsupported: Waiting on working silicon " - "from VIA before this is usable.\n"); - break; default: printk (KERN_INFO PFX "Unknown VIA CPU. Contact davej@codemonkey.org.uk\n"); } @@ -579,7 +559,11 @@ kfree(longhaul_table); } -MODULE_PARM (dont_scale_voltage, "i"); +module_param (dont_scale_voltage, int, 0644); +MODULE_PARM_DESC(dont_scale_voltage, "Don't scale voltage of processor"); + +module_param (debug, int, 0644); +MODULE_PARM_DESC(debug, "Dump debugging information."); MODULE_AUTHOR ("Dave Jones "); MODULE_DESCRIPTION ("Longhaul driver for VIA Cyrix processors."); diff -urN linux-2.6.7-rc2/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c linux-2.6.7-rc3/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c --- linux-2.6.7-rc2/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c 2004-06-07 12:54:48.296013124 -0700 +++ linux-2.6.7-rc3/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c 2004-06-07 12:55:01.295551516 -0700 @@ -27,7 +27,6 @@ #include #include #include -#include #include #include @@ -35,7 +34,7 @@ #include "speedstep-lib.h" -#define PFX "cpufreq: " +#define PFX "p4-clockmod: " /* * Duty Cycle (3bits), note DC_DISABLE is not specified in diff -urN linux-2.6.7-rc2/arch/i386/kernel/cpu/cpufreq/powernow-k7.c linux-2.6.7-rc3/arch/i386/kernel/cpu/cpufreq/powernow-k7.c --- linux-2.6.7-rc2/arch/i386/kernel/cpu/cpufreq/powernow-k7.c 2004-06-07 12:54:48.297013165 -0700 +++ linux-2.6.7-rc3/arch/i386/kernel/cpu/cpufreq/powernow-k7.c 2004-06-07 12:55:01.296551558 -0700 @@ -16,7 +16,7 @@ #include #include -#include +#include #include #include #include @@ -28,7 +28,7 @@ #include #include -#ifdef CONFIG_ACPI_PROCESSOR +#if defined(CONFIG_ACPI_PROCESSOR) || defined(CONFIG_ACPI_PROCESSOR_MODULE) #include #include #endif @@ -63,7 +63,7 @@ u8 numpstates; }; -#ifdef CONFIG_ACPI_PROCESSOR +#if defined(CONFIG_ACPI_PROCESSOR) || defined(CONFIG_ACPI_PROCESSOR_MODULE) union powernow_acpi_control_t { struct { unsigned long fid:5, @@ -86,7 +86,7 @@ /* divide by 10 to get FID. */ static int fid_codes[32] = { 110, 115, 120, 125, 50, 55, 60, 65, - 70, 75, 80, 85, 90, 95, 100, 105, + 70, 75, 80, 85, 90, 95, 100, 105, 30, 190, 40, 200, 130, 135, 140, 210, 150, 225, 160, 165, 170, 180, -1, -1, }; @@ -95,7 +95,7 @@ * configuration purpose. */ -static int powernow_acpi_force; +static int acpi_force; static struct cpufreq_frequency_table *powernow_table; @@ -144,6 +144,11 @@ } cpuid(0x80000007, &eax, &ebx, &ecx, &edx); + + /* Check we can actually do something before we say anything.*/ + if (!(edx & (1 << 1 | 1 << 2))) + return 0; + printk (KERN_INFO PFX "PowerNOW! Technology present. Can scale: "); if (edx & 1 << 1) { @@ -159,11 +164,6 @@ can_scale_vid=1; } - if (!(edx & (1 << 1 | 1 << 2))) { - printk ("nothing.\n"); - return 0; - } - printk (".\n"); return 1; } @@ -293,7 +293,7 @@ } -#ifdef CONFIG_ACPI_PROCESSOR +#if defined(CONFIG_ACPI_PROCESSOR) || defined(CONFIG_ACPI_PROCESSOR_MODULE) struct acpi_processor_performance *acpi_processor_perf; @@ -572,7 +572,7 @@ } dprintk(KERN_INFO PFX "FSB: %3d.%03d MHz\n", fsb/1000, fsb%1000); - if ((dmi_broken & BROKEN_CPUFREQ) || powernow_acpi_force) { + if ((dmi_broken & BROKEN_CPUFREQ) || acpi_force) { printk (KERN_INFO PFX "PSB/PST known to be broken. Trying ACPI instead\n"); result = powernow_acpi_init(); } else { @@ -642,7 +642,7 @@ static void __exit powernow_exit (void) { -#ifdef CONFIG_ACPI_PROCESSOR +#if defined(CONFIG_ACPI_PROCESSOR) || defined(CONFIG_ACPI_PROCESSOR_MODULE) if (acpi_processor_perf) { acpi_processor_unregister_performance(acpi_processor_perf, 0); kfree(acpi_processor_perf); @@ -653,8 +653,7 @@ kfree(powernow_table); } -module_param(powernow_acpi_force, int, 0444); - +module_param(acpi_force, int, 0444); MODULE_PARM_DESC(acpi_force, "Force ACPI to be used"); MODULE_AUTHOR ("Dave Jones "); diff -urN linux-2.6.7-rc2/arch/i386/kernel/cpu/cpufreq/powernow-k8.c linux-2.6.7-rc3/arch/i386/kernel/cpu/cpufreq/powernow-k8.c --- linux-2.6.7-rc2/arch/i386/kernel/cpu/cpufreq/powernow-k8.c 2004-06-07 12:54:48.298013207 -0700 +++ linux-2.6.7-rc3/arch/i386/kernel/cpu/cpufreq/powernow-k8.c 2004-06-07 12:55:01.297551599 -0700 @@ -553,7 +553,7 @@ printk(KERN_ERR PFX "no p states to transition\n"); return -ENODEV; } - + if (check_pst_table(data, pst, maxvid)) return -EINVAL; @@ -736,9 +736,9 @@ /* verify only 1 entry from the lo frequency table */ if ((fid < HI_FID_TABLE_BOTTOM) && (cntlofreq++)) { printk(KERN_ERR PFX "Too many lo freq table entries\n"); - goto err_out; + goto err_out_mem; } - + if (powernow_table[i].frequency != (data->acpi_data.states[i].core_frequency * 1000)) { printk(KERN_INFO PFX "invalid freq entries %u kHz vs. %u kHz\n", powernow_table[i].frequency, @@ -757,12 +757,16 @@ print_basics(data); powernow_k8_acpi_pst_values(data, 0); return 0; + +err_out_mem: + kfree(powernow_table); + err_out: acpi_processor_unregister_performance(&data->acpi_data, data->cpu); /* data->acpi_data.state_count informs us at ->exit() whether ACPI was used */ data->acpi_data.state_count = 0; - + return -ENODEV; } @@ -945,7 +949,7 @@ if ((num_online_cpus() != 1) || (num_possible_cpus() != 1)) { printk(KERN_INFO PFX "MP systems not supported by PSB BIOS structure\n"); kfree(data); - return 0; + return -ENODEV; } rc = find_psb_table(data); if (rc) { @@ -1047,7 +1051,7 @@ if (query_current_values_with_pending_wait(data)) goto out; - khz = find_khz_freq_from_fid(data->currfid); + khz = find_khz_freq_from_fid(data->currfid); out: preempt_enable_no_resched(); diff -urN linux-2.6.7-rc2/arch/i386/kernel/dmi_scan.c linux-2.6.7-rc3/arch/i386/kernel/dmi_scan.c --- linux-2.6.7-rc2/arch/i386/kernel/dmi_scan.c 2004-05-09 19:32:28.000000000 -0700 +++ linux-2.6.7-rc3/arch/i386/kernel/dmi_scan.c 2004-06-07 12:55:01.302551806 -0700 @@ -783,6 +783,7 @@ { exploding_pnp_bios, "ASUS P4P800", { /* PnPBIOS GPF on boot */ MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer Inc."), MATCH(DMI_BOARD_NAME, "P4P800"), + NO_MATCH, NO_MATCH } }, /* Machines which have problems handling enabled local APICs */ diff -urN linux-2.6.7-rc2/arch/i386/kernel/i387.c linux-2.6.7-rc3/arch/i386/kernel/i387.c --- linux-2.6.7-rc2/arch/i386/kernel/i387.c 2004-05-09 19:33:21.000000000 -0700 +++ linux-2.6.7-rc3/arch/i386/kernel/i387.c 2004-06-07 12:55:01.303551848 -0700 @@ -246,7 +246,7 @@ to = &buf->_st[0]; from = (struct _fpxreg *) &fxsave->st_space[0]; for ( i = 0 ; i < 8 ; i++, to++, from++ ) { - unsigned long *t = (unsigned long *)to; + unsigned long __user *t = (unsigned long __user *)to; unsigned long *f = (unsigned long *)from; if (__put_user(*f, t) || @@ -281,7 +281,7 @@ from = &buf->_st[0]; for ( i = 0 ; i < 8 ; i++, to++, from++ ) { unsigned long *t = (unsigned long *)to; - unsigned long *f = (unsigned long *)from; + unsigned long __user *f = (unsigned long __user *)from; if (__get_user(*t, f) || __get_user(*(t + 1), f + 1) || diff -urN linux-2.6.7-rc2/arch/i386/kernel/microcode.c linux-2.6.7-rc3/arch/i386/kernel/microcode.c --- linux-2.6.7-rc2/arch/i386/kernel/microcode.c 2004-05-09 19:32:26.000000000 -0700 +++ linux-2.6.7-rc3/arch/i386/kernel/microcode.c 2004-06-07 12:55:01.307552013 -0700 @@ -113,7 +113,7 @@ /* no concurrent ->write()s are allowed on /dev/cpu/microcode */ static DECLARE_MUTEX(microcode_sem); -static void *user_buffer; /* user area microcode data buffer */ +static void __user *user_buffer; /* user area microcode data buffer */ static unsigned int user_buffer_size; /* it's size */ typedef enum mc_error_code { @@ -425,7 +425,7 @@ return error; } -static ssize_t microcode_write (struct file *file, const char *buf, size_t len, loff_t *ppos) +static ssize_t microcode_write (struct file *file, const char __user *buf, size_t len, loff_t *ppos) { ssize_t ret; @@ -441,7 +441,7 @@ down(µcode_sem); - user_buffer = (void *) buf; + user_buffer = (void __user *) buf; user_buffer_size = (int) len; ret = do_microcode_update(); diff -urN linux-2.6.7-rc2/arch/i386/kernel/msr.c linux-2.6.7-rc3/arch/i386/kernel/msr.c --- linux-2.6.7-rc2/arch/i386/kernel/msr.c 2004-06-07 12:54:48.307013579 -0700 +++ linux-2.6.7-rc3/arch/i386/kernel/msr.c 2004-06-07 12:55:01.309552096 -0700 @@ -184,7 +184,7 @@ static ssize_t msr_read(struct file *file, char __user * buf, size_t count, loff_t * ppos) { - u32 *tmp = (u32 *) buf; + u32 __user *tmp = (u32 __user *) buf; u32 data[2]; size_t rv; u32 reg = *ppos; @@ -203,13 +203,13 @@ tmp += 2; } - return ((char *)tmp) - buf; + return ((char __user *)tmp) - buf; } static ssize_t msr_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { - const u32 *tmp = (const u32 *)buf; + const u32 __user *tmp = (const u32 __user *)buf; u32 data[2]; size_t rv; u32 reg = *ppos; @@ -228,7 +228,7 @@ tmp += 2; } - return ((char *)tmp) - buf; + return ((char __user *)tmp) - buf; } static int msr_open(struct inode *inode, struct file *file) diff -urN linux-2.6.7-rc2/arch/i386/kernel/ptrace.c linux-2.6.7-rc3/arch/i386/kernel/ptrace.c --- linux-2.6.7-rc2/arch/i386/kernel/ptrace.c 2004-06-07 12:54:48.309013662 -0700 +++ linux-2.6.7-rc3/arch/i386/kernel/ptrace.c 2004-06-07 12:55:01.311552179 -0700 @@ -235,6 +235,7 @@ struct task_struct *child; struct user * dummy = NULL; int i, ret; + unsigned long __user *datap = (unsigned long __user *)data; lock_kernel(); ret = -EPERM; @@ -283,7 +284,7 @@ ret = -EIO; if (copied != sizeof(tmp)) break; - ret = put_user(tmp,(unsigned long *) data); + ret = put_user(tmp, datap); break; } @@ -305,7 +306,7 @@ addr = addr >> 2; tmp = child->thread.debugreg[addr]; } - ret = put_user(tmp,(unsigned long *) data); + ret = put_user(tmp, datap); break; } @@ -423,13 +424,13 @@ break; case PTRACE_GETREGS: { /* Get all gp regs from the child. */ - if (!access_ok(VERIFY_WRITE, (unsigned *)data, FRAME_SIZE*sizeof(long))) { + if (!access_ok(VERIFY_WRITE, datap, FRAME_SIZE*sizeof(long))) { ret = -EIO; break; } for ( i = 0; i < FRAME_SIZE*sizeof(long); i += sizeof(long) ) { - __put_user(getreg(child, i),(unsigned long *) data); - data += sizeof(long); + __put_user(getreg(child, i), datap); + datap++; } ret = 0; break; @@ -437,21 +438,21 @@ case PTRACE_SETREGS: { /* Set all gp regs in the child. */ unsigned long tmp; - if (!access_ok(VERIFY_READ, (unsigned *)data, FRAME_SIZE*sizeof(long))) { + if (!access_ok(VERIFY_READ, datap, FRAME_SIZE*sizeof(long))) { ret = -EIO; break; } for ( i = 0; i < FRAME_SIZE*sizeof(long); i += sizeof(long) ) { - __get_user(tmp, (unsigned long *) data); + __get_user(tmp, datap); putreg(child, i, tmp); - data += sizeof(long); + datap++; } ret = 0; break; } case PTRACE_GETFPREGS: { /* Get the child FPU state. */ - if (!access_ok(VERIFY_WRITE, (unsigned *)data, + if (!access_ok(VERIFY_WRITE, datap, sizeof(struct user_i387_struct))) { ret = -EIO; break; @@ -464,7 +465,7 @@ } case PTRACE_SETFPREGS: { /* Set the child FPU state. */ - if (!access_ok(VERIFY_READ, (unsigned *)data, + if (!access_ok(VERIFY_READ, datap, sizeof(struct user_i387_struct))) { ret = -EIO; break; @@ -476,7 +477,7 @@ } case PTRACE_GETFPXREGS: { /* Get the child extended FPU state. */ - if (!access_ok(VERIFY_WRITE, (unsigned *)data, + if (!access_ok(VERIFY_WRITE, datap, sizeof(struct user_fxsr_struct))) { ret = -EIO; break; @@ -488,7 +489,7 @@ } case PTRACE_SETFPXREGS: { /* Set the child extended FPU state. */ - if (!access_ok(VERIFY_READ, (unsigned *)data, + if (!access_ok(VERIFY_READ, datap, sizeof(struct user_fxsr_struct))) { ret = -EIO; break; @@ -499,13 +500,13 @@ } case PTRACE_GET_THREAD_AREA: - ret = ptrace_get_thread_area(child, - addr, (struct user_desc __user *) data); + ret = ptrace_get_thread_area(child, addr, + (struct user_desc __user *) data); break; case PTRACE_SET_THREAD_AREA: - ret = ptrace_set_thread_area(child, - addr, (struct user_desc __user *) data); + ret = ptrace_set_thread_area(child, addr, + (struct user_desc __user *) data); break; default: diff -urN linux-2.6.7-rc2/arch/i386/kernel/scx200.c linux-2.6.7-rc3/arch/i386/kernel/scx200.c --- linux-2.6.7-rc2/arch/i386/kernel/scx200.c 2004-05-09 19:33:19.000000000 -0700 +++ linux-2.6.7-rc3/arch/i386/kernel/scx200.c 2004-06-07 12:55:01.311552179 -0700 @@ -86,7 +86,10 @@ if ((bridge = pci_find_device(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_SCx200_BRIDGE, - NULL)) == NULL) + NULL)) == NULL + && (bridge = pci_find_device(PCI_VENDOR_ID_NS, + PCI_DEVICE_ID_NS_SC1100_BRIDGE, + NULL)) == NULL) return -ENODEV; base = pci_resource_start(bridge, 0); diff -urN linux-2.6.7-rc2/arch/i386/kernel/signal.c linux-2.6.7-rc3/arch/i386/kernel/signal.c --- linux-2.6.7-rc2/arch/i386/kernel/signal.c 2004-06-07 12:54:48.310013704 -0700 +++ linux-2.6.7-rc3/arch/i386/kernel/signal.c 2004-06-07 12:55:01.312552220 -0700 @@ -269,12 +269,12 @@ tmp = 0; __asm__("movl %%gs,%0" : "=r"(tmp): "0"(tmp)); - err |= __put_user(tmp, (unsigned int *)&sc->gs); + err |= __put_user(tmp, (unsigned int __user *)&sc->gs); __asm__("movl %%fs,%0" : "=r"(tmp): "0"(tmp)); - err |= __put_user(tmp, (unsigned int *)&sc->fs); + err |= __put_user(tmp, (unsigned int __user *)&sc->fs); - err |= __put_user(regs->xes, (unsigned int *)&sc->es); - err |= __put_user(regs->xds, (unsigned int *)&sc->ds); + err |= __put_user(regs->xes, (unsigned int __user *)&sc->es); + err |= __put_user(regs->xds, (unsigned int __user *)&sc->ds); err |= __put_user(regs->edi, &sc->edi); err |= __put_user(regs->esi, &sc->esi); err |= __put_user(regs->ebp, &sc->ebp); @@ -286,10 +286,10 @@ err |= __put_user(current->thread.trap_no, &sc->trapno); err |= __put_user(current->thread.error_code, &sc->err); err |= __put_user(regs->eip, &sc->eip); - err |= __put_user(regs->xcs, (unsigned int *)&sc->cs); + err |= __put_user(regs->xcs, (unsigned int __user *)&sc->cs); err |= __put_user(regs->eflags, &sc->eflags); err |= __put_user(regs->esp, &sc->esp_at_signal); - err |= __put_user(regs->xss, (unsigned int *)&sc->ss); + err |= __put_user(regs->xss, (unsigned int __user *)&sc->ss); tmp = save_i387(fpstate); if (tmp < 0) @@ -381,9 +381,9 @@ * reasons and because gdb uses it as a signature to notice * signal handler stack frames. */ - err |= __put_user(0xb858, (short *)(frame->retcode+0)); - err |= __put_user(__NR_sigreturn, (int *)(frame->retcode+2)); - err |= __put_user(0x80cd, (short *)(frame->retcode+6)); + err |= __put_user(0xb858, (short __user *)(frame->retcode+0)); + err |= __put_user(__NR_sigreturn, (int __user *)(frame->retcode+2)); + err |= __put_user(0x80cd, (short __user *)(frame->retcode+6)); if (err) goto give_sigsegv; @@ -462,9 +462,9 @@ * reasons and because gdb uses it as a signature to notice * signal handler stack frames. */ - err |= __put_user(0xb8, (char *)(frame->retcode+0)); - err |= __put_user(__NR_rt_sigreturn, (int *)(frame->retcode+1)); - err |= __put_user(0x80cd, (short *)(frame->retcode+5)); + err |= __put_user(0xb8, (char __user *)(frame->retcode+0)); + err |= __put_user(__NR_rt_sigreturn, (int __user *)(frame->retcode+1)); + err |= __put_user(0x80cd, (short __user *)(frame->retcode+5)); if (err) goto give_sigsegv; diff -urN linux-2.6.7-rc2/arch/i386/kernel/traps.c linux-2.6.7-rc3/arch/i386/kernel/traps.c --- linux-2.6.7-rc2/arch/i386/kernel/traps.c 2004-06-07 12:54:48.313013828 -0700 +++ linux-2.6.7-rc3/arch/i386/kernel/traps.c 2004-06-07 12:55:01.315552345 -0700 @@ -283,7 +283,7 @@ file = ""; printk("------------[ cut here ]------------\n"); - printk("kernel BUG at %s:%d!\n", file, line); + printk(KERN_ALERT "kernel BUG at %s:%d!\n", file, line); no_bug: return; @@ -304,7 +304,7 @@ spin_lock_irq(&die_lock); bust_spinlocks(1); handle_BUG(regs); - printk("%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter); + printk(KERN_ALERT "%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter); #ifdef CONFIG_PREEMPT printk("PREEMPT "); nl = 1; diff -urN linux-2.6.7-rc2/arch/i386/mach-default/topology.c linux-2.6.7-rc3/arch/i386/mach-default/topology.c --- linux-2.6.7-rc2/arch/i386/mach-default/topology.c 2004-05-09 19:33:13.000000000 -0700 +++ linux-2.6.7-rc3/arch/i386/mach-default/topology.c 2004-06-07 12:55:01.316552386 -0700 @@ -41,8 +41,10 @@ { int i; - for (i = 0; i < num_online_nodes(); i++) - arch_register_node(i); + for (i = 0; i < MAX_NUMNODES; i++) { + if (node_online(i)) + arch_register_node(i); + } for (i = 0; i < NR_CPUS; i++) if (cpu_possible(i)) arch_register_cpu(i); return 0; diff -urN linux-2.6.7-rc2/arch/i386/mm/fault.c linux-2.6.7-rc3/arch/i386/mm/fault.c --- linux-2.6.7-rc2/arch/i386/mm/fault.c 2004-05-09 19:31:57.000000000 -0700 +++ linux-2.6.7-rc3/arch/i386/mm/fault.c 2004-06-07 12:55:01.326552800 -0700 @@ -411,7 +411,7 @@ else printk(KERN_ALERT "Unable to handle kernel paging request"); printk(" at virtual address %08lx\n",address); - printk(" printing eip:\n"); + printk(KERN_ALERT " printing eip:\n"); printk("%08lx\n", regs->eip); asm("movl %%cr3,%0":"=r" (page)); page = ((unsigned long *) __va(page))[address >> 22]; diff -urN linux-2.6.7-rc2/arch/i386/pci/fixup.c linux-2.6.7-rc3/arch/i386/pci/fixup.c --- linux-2.6.7-rc2/arch/i386/pci/fixup.c 2004-06-07 12:54:48.326014366 -0700 +++ linux-2.6.7-rc3/arch/i386/pci/fixup.c 2004-06-07 12:55:01.328552883 -0700 @@ -226,7 +226,12 @@ fixed_val = rev < 0xC1 ? 0x1F01FF01 : 0x9F01FF01; pci_read_config_dword(dev, 0x6c, &val); - if (val != fixed_val) { + + /* + * Apply fixup only if C1 Halt Disconnect is enabled + * (bit28) because it is not supported on some boards. + */ + if ((val & (1 << 28)) && val != fixed_val) { printk(KERN_WARNING "PCI: nForce2 C1 Halt Disconnect fixup\n"); pci_write_config_dword(dev, 0x6c, fixed_val); } diff -urN linux-2.6.7-rc2/arch/ia64/Kconfig linux-2.6.7-rc3/arch/ia64/Kconfig --- linux-2.6.7-rc2/arch/ia64/Kconfig 2004-06-07 12:54:48.327014408 -0700 +++ linux-2.6.7-rc3/arch/ia64/Kconfig 2004-06-07 12:55:01.330552966 -0700 @@ -78,15 +78,6 @@ endchoice -config HOTPLUG_CPU - bool "Support for hot-pluggable CPUs (EXPERIMENTAL)" - depends on SMP && HOTPLUG && EXPERIMENTAL - default n - ---help--- - Say Y here to experiment with turning CPUs off and on. CPUs - can be controlled through /sys/devices/system/cpu/cpu#. - Say N if you want to disable cpu hotplug. - choice prompt "Processor type" default ITANIUM @@ -253,6 +244,15 @@ than 64 will cause the use of a CPU mask array, causing a small performance hit. +config HOTPLUG_CPU + bool "Support for hot-pluggable CPUs (EXPERIMENTAL)" + depends on SMP && HOTPLUG && EXPERIMENTAL + default n + ---help--- + Say Y here to experiment with turning CPUs off and on. CPUs + can be controlled through /sys/devices/system/cpu/cpu#. + Say N if you want to disable CPU hotplug. + config PREEMPT bool "Preemptible Kernel" help diff -urN linux-2.6.7-rc2/arch/ia64/configs/sim_defconfig linux-2.6.7-rc3/arch/ia64/configs/sim_defconfig --- linux-2.6.7-rc2/arch/ia64/configs/sim_defconfig 1969-12-31 16:00:00.000000000 -0800 +++ linux-2.6.7-rc3/arch/ia64/configs/sim_defconfig 2004-06-07 12:55:01.331553007 -0700 @@ -0,0 +1,535 @@ +# +# Automatically generated make config: don't edit +# + +# +# Code maturity level options +# +CONFIG_EXPERIMENTAL=y +# CONFIG_CLEAN_COMPILE is not set +# CONFIG_STANDALONE is not set +CONFIG_BROKEN=y +CONFIG_BROKEN_ON_SMP=y + +# +# General setup +# +CONFIG_SWAP=y +CONFIG_SYSVIPC=y +# CONFIG_POSIX_MQUEUE is not set +# CONFIG_BSD_PROCESS_ACCT is not set +CONFIG_SYSCTL=y +# CONFIG_AUDIT is not set +CONFIG_LOG_BUF_SHIFT=16 +# CONFIG_HOTPLUG is not set +CONFIG_IKCONFIG=y +CONFIG_IKCONFIG_PROC=y +# CONFIG_EMBEDDED is not set +CONFIG_KALLSYMS=y +# CONFIG_KALLSYMS_ALL is not set +CONFIG_FUTEX=y +CONFIG_EPOLL=y +CONFIG_IOSCHED_NOOP=y +CONFIG_IOSCHED_AS=y +CONFIG_IOSCHED_DEADLINE=y +CONFIG_IOSCHED_CFQ=y +# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set + +# +# Loadable module support +# +CONFIG_MODULES=y +CONFIG_MODULE_UNLOAD=y +CONFIG_MODULE_FORCE_UNLOAD=y +CONFIG_OBSOLETE_MODPARM=y +CONFIG_MODVERSIONS=y +CONFIG_KMOD=y +CONFIG_STOP_MACHINE=y + +# +# Processor type and features +# +CONFIG_IA64=y +CONFIG_64BIT=y +CONFIG_MMU=y +CONFIG_RWSEM_XCHGADD_ALGORITHM=y +CONFIG_TIME_INTERPOLATION=y +CONFIG_EFI=y +# CONFIG_IA64_GENERIC is not set +# CONFIG_IA64_DIG is not set +# CONFIG_IA64_HP_ZX1 is not set +# CONFIG_IA64_SGI_SN2 is not set +CONFIG_IA64_HP_SIM=y +# CONFIG_ITANIUM is not set +CONFIG_MCKINLEY=y +# CONFIG_IA64_PAGE_SIZE_4KB is not set +# CONFIG_IA64_PAGE_SIZE_8KB is not set +# CONFIG_IA64_PAGE_SIZE_16KB is not set +CONFIG_IA64_PAGE_SIZE_64KB=y +CONFIG_IA64_L1_CACHE_SHIFT=7 +# CONFIG_MCKINLEY_ASTEP_SPECIFIC is not set +# CONFIG_VIRTUAL_MEM_MAP is not set +# CONFIG_IA64_CYCLONE is not set +CONFIG_FORCE_MAX_ZONEORDER=18 +CONFIG_SMP=y +CONFIG_NR_CPUS=64 +CONFIG_PREEMPT=y +CONFIG_HAVE_DEC_LOCK=y +CONFIG_IA32_SUPPORT=y +CONFIG_COMPAT=y +# CONFIG_PERFMON is not set +CONFIG_IA64_PALINFO=m + +# +# Firmware Drivers +# +CONFIG_EFI_VARS=y +# CONFIG_SMBIOS is not set +CONFIG_BINFMT_ELF=y +CONFIG_BINFMT_MISC=y + +# +# Power management and ACPI +# + +# +# Device Drivers +# + +# +# Generic Driver Options +# +# CONFIG_DEBUG_DRIVER is not set + +# +# Memory Technology Devices (MTD) +# +# CONFIG_MTD is not set + +# +# Parallel port support +# +# CONFIG_PARPORT is not set + +# +# Plug and Play support +# + +# +# Block devices +# +CONFIG_BLK_DEV_LOOP=y +# CONFIG_BLK_DEV_CRYPTOLOOP is not set +# CONFIG_BLK_DEV_NBD is not set +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_SIZE=4096 +# CONFIG_BLK_DEV_INITRD is not set + +# +# ATA/ATAPI/MFM/RLL support +# +# CONFIG_IDE is not set + +# +# SCSI device support +# +CONFIG_SCSI=y +CONFIG_SCSI_PROC_FS=y + +# +# SCSI support type (disk, tape, CD-ROM) +# +CONFIG_BLK_DEV_SD=y +# CONFIG_CHR_DEV_ST is not set +# CONFIG_CHR_DEV_OSST is not set +# CONFIG_BLK_DEV_SR is not set +# CONFIG_CHR_DEV_SG is not set + +# +# Some SCSI devices (e.g. CD jukebox) support multiple LUNs +# +CONFIG_SCSI_MULTI_LUN=y +CONFIG_SCSI_CONSTANTS=y +CONFIG_SCSI_LOGGING=y + +# +# SCSI Transport Attributes +# +CONFIG_SCSI_SPI_ATTRS=y +# CONFIG_SCSI_FC_ATTRS is not set + +# +# SCSI low-level drivers +# +# CONFIG_SCSI_AIC7XXX_OLD is not set +# CONFIG_SCSI_SATA is not set +# CONFIG_SCSI_EATA_PIO is not set +# CONFIG_SCSI_DEBUG is not set + +# +# Multi-device support (RAID and LVM) +# +# CONFIG_MD is not set + +# +# Fusion MPT device support +# + +# +# IEEE 1394 (FireWire) support +# +# CONFIG_IEEE1394 is not set + +# +# I2O device support +# + +# +# Networking support +# +CONFIG_NET=y + +# +# Networking options +# +CONFIG_PACKET=y +# CONFIG_PACKET_MMAP is not set +# CONFIG_NETLINK_DEV is not set +# CONFIG_UNIX is not set +# CONFIG_NET_KEY is not set +CONFIG_INET=y +CONFIG_IP_MULTICAST=y +# CONFIG_IP_ADVANCED_ROUTER is not set +# CONFIG_IP_PNP is not set +# CONFIG_NET_IPIP is not set +# CONFIG_NET_IPGRE is not set +# CONFIG_IP_MROUTE is not set +# CONFIG_ARPD is not set +# CONFIG_SYN_COOKIES is not set +# CONFIG_INET_AH is not set +# CONFIG_INET_ESP is not set +# CONFIG_INET_IPCOMP is not set +# CONFIG_IPV6 is not set +# CONFIG_NETFILTER is not set + +# +# SCTP Configuration (EXPERIMENTAL) +# +# CONFIG_IP_SCTP is not set +# CONFIG_ATM is not set +# CONFIG_BRIDGE is not set +# CONFIG_VLAN_8021Q is not set +# CONFIG_DECNET is not set +# CONFIG_LLC2 is not set +# CONFIG_IPX is not set +# CONFIG_ATALK is not set +# CONFIG_X25 is not set +# CONFIG_LAPB is not set +# CONFIG_NET_DIVERT is not set +# CONFIG_ECONET is not set +# CONFIG_WAN_ROUTER is not set +# CONFIG_NET_FASTROUTE is not set +# CONFIG_NET_HW_FLOWCONTROL is not set + +# +# QoS and/or fair queueing +# +# CONFIG_NET_SCHED is not set + +# +# Network testing +# +# CONFIG_NET_PKTGEN is not set +# CONFIG_NETPOLL is not set +# CONFIG_NET_POLL_CONTROLLER is not set +# CONFIG_HAMRADIO is not set +# CONFIG_IRDA is not set +# CONFIG_BT is not set +# CONFIG_NETDEVICES is not set + +# +# ISDN subsystem +# +# CONFIG_ISDN is not set + +# +# Telephony Support +# +# CONFIG_PHONE is not set + +# +# Input device support +# +CONFIG_INPUT=y + +# +# Userland interfaces +# +CONFIG_INPUT_MOUSEDEV=y +CONFIG_INPUT_MOUSEDEV_PSAUX=y +CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 +CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 +# CONFIG_INPUT_JOYDEV is not set +# CONFIG_INPUT_TSDEV is not set +# CONFIG_INPUT_EVDEV is not set +# CONFIG_INPUT_EVBUG is not set + +# +# Input I/O drivers +# +# CONFIG_GAMEPORT is not set +CONFIG_SOUND_GAMEPORT=y +CONFIG_SERIO=y +# CONFIG_SERIO_I8042 is not set +CONFIG_SERIO_SERPORT=y +# CONFIG_SERIO_CT82C710 is not set + +# +# Input Device Drivers +# +# CONFIG_INPUT_KEYBOARD is not set +# CONFIG_INPUT_MOUSE is not set +# CONFIG_INPUT_JOYSTICK is not set +# CONFIG_INPUT_TOUCHSCREEN is not set +# CONFIG_INPUT_MISC is not set + +# +# Character devices +# +CONFIG_VT=y +CONFIG_VT_CONSOLE=y +CONFIG_HW_CONSOLE=y +# CONFIG_SERIAL_NONSTANDARD is not set + +# +# Serial drivers +# +# CONFIG_SERIAL_8250 is not set + +# +# Non-8250 serial port support +# +CONFIG_UNIX98_PTYS=y +# CONFIG_LEGACY_PTYS is not set +# CONFIG_QIC02_TAPE is not set + +# +# IPMI +# +# CONFIG_IPMI_HANDLER is not set + +# +# Watchdog Cards +# +# CONFIG_WATCHDOG is not set +CONFIG_EFI_RTC=y +# CONFIG_DTLK is not set +# CONFIG_R3964 is not set +# CONFIG_APPLICOM is not set + +# +# Ftape, the floppy tape device driver +# +# CONFIG_FTAPE is not set +# CONFIG_AGP is not set +# CONFIG_DRM is not set +# CONFIG_RAW_DRIVER is not set + +# +# I2C support +# +# CONFIG_I2C is not set + +# +# Misc devices +# + +# +# Multimedia devices +# +# CONFIG_VIDEO_DEV is not set + +# +# Digital Video Broadcasting Devices +# +# CONFIG_DVB is not set + +# +# Graphics support +# +# CONFIG_FB is not set + +# +# Console display driver support +# +# CONFIG_VGA_CONSOLE is not set +# CONFIG_MDA_CONSOLE is not set +CONFIG_DUMMY_CONSOLE=y + +# +# Sound +# +# CONFIG_SOUND is not set + +# +# USB support +# + +# +# USB Gadget Support +# +# CONFIG_USB_GADGET is not set + +# +# File systems +# +CONFIG_EXT2_FS=y +# CONFIG_EXT2_FS_XATTR is not set +CONFIG_EXT3_FS=y +# CONFIG_EXT3_FS_XATTR is not set +CONFIG_JBD=y +# CONFIG_JBD_DEBUG is not set +# CONFIG_REISERFS_FS is not set +# CONFIG_JFS_FS is not set +# CONFIG_XFS_FS is not set +# CONFIG_MINIX_FS is not set +# CONFIG_ROMFS_FS is not set +# CONFIG_QUOTA is not set +# CONFIG_AUTOFS_FS is not set +# CONFIG_AUTOFS4_FS is not set + +# +# CD-ROM/DVD Filesystems +# +# CONFIG_ISO9660_FS is not set +# CONFIG_UDF_FS is not set + +# +# DOS/FAT/NT Filesystems +# +# CONFIG_FAT_FS is not set +# CONFIG_NTFS_FS is not set + +# +# Pseudo filesystems +# +CONFIG_PROC_FS=y +CONFIG_PROC_KCORE=y +CONFIG_SYSFS=y +# CONFIG_DEVFS_FS is not set +# CONFIG_DEVPTS_FS_XATTR is not set +# CONFIG_TMPFS is not set +CONFIG_HUGETLBFS=y +CONFIG_HUGETLB_PAGE=y +CONFIG_RAMFS=y + +# +# Miscellaneous filesystems +# +# CONFIG_ADFS_FS is not set +# CONFIG_AFFS_FS is not set +# CONFIG_HFS_FS is not set +# CONFIG_HFSPLUS_FS is not set +# CONFIG_BEFS_FS is not set +# CONFIG_BFS_FS is not set +# CONFIG_EFS_FS is not set +# CONFIG_CRAMFS is not set +# CONFIG_VXFS_FS is not set +# CONFIG_HPFS_FS is not set +# CONFIG_QNX4FS_FS is not set +# CONFIG_SYSV_FS is not set +# CONFIG_UFS_FS is not set + +# +# Network File Systems +# +CONFIG_NFS_FS=y +# CONFIG_NFS_V3 is not set +# CONFIG_NFS_V4 is not set +CONFIG_NFS_DIRECTIO=y +CONFIG_NFSD=y +CONFIG_NFSD_V3=y +# CONFIG_NFSD_V4 is not set +# CONFIG_NFSD_TCP is not set +CONFIG_LOCKD=y +CONFIG_LOCKD_V4=y +CONFIG_EXPORTFS=y +CONFIG_SUNRPC=y +# CONFIG_RPCSEC_GSS_KRB5 is not set +# CONFIG_SMB_FS is not set +# CONFIG_CIFS is not set +# CONFIG_NCP_FS is not set +# CONFIG_CODA_FS is not set +# CONFIG_AFS_FS is not set + +# +# Partition Types +# +CONFIG_PARTITION_ADVANCED=y +# CONFIG_ACORN_PARTITION is not set +# CONFIG_OSF_PARTITION is not set +# CONFIG_AMIGA_PARTITION is not set +# CONFIG_ATARI_PARTITION is not set +# CONFIG_MAC_PARTITION is not set +CONFIG_MSDOS_PARTITION=y +# CONFIG_BSD_DISKLABEL is not set +# CONFIG_MINIX_SUBPARTITION is not set +# CONFIG_SOLARIS_X86_PARTITION is not set +# CONFIG_UNIXWARE_DISKLABEL is not set +# CONFIG_LDM_PARTITION is not set +# CONFIG_NEC98_PARTITION is not set +# CONFIG_SGI_PARTITION is not set +# CONFIG_ULTRIX_PARTITION is not set +# CONFIG_SUN_PARTITION is not set +CONFIG_EFI_PARTITION=y + +# +# Native Language Support +# +# CONFIG_NLS is not set + +# +# Library routines +# +CONFIG_CRC32=y +# CONFIG_LIBCRC32C is not set + +# +# HP Simulator drivers +# +CONFIG_HP_SIMETH=y +CONFIG_HP_SIMSERIAL=y +CONFIG_HP_SIMSERIAL_CONSOLE=y +CONFIG_HP_SIMSCSI=y + +# +# Profiling support +# +# CONFIG_PROFILING is not set + +# +# Kernel hacking +# +# CONFIG_IA64_GRANULE_16MB is not set +CONFIG_IA64_GRANULE_64MB=y +CONFIG_DEBUG_KERNEL=y +# CONFIG_IA64_PRINT_HAZARDS is not set +# CONFIG_DISABLE_VHPT is not set +# CONFIG_MAGIC_SYSRQ is not set +# CONFIG_DEBUG_SLAB is not set +# CONFIG_DEBUG_SPINLOCK is not set +# CONFIG_DEBUG_SPINLOCK_SLEEP is not set +# CONFIG_IA64_DEBUG_CMPXCHG is not set +# CONFIG_IA64_DEBUG_IRQ is not set +CONFIG_DEBUG_INFO=y +CONFIG_SYSVIPC_COMPAT=y + +# +# Security options +# +# CONFIG_SECURITY is not set + +# +# Cryptographic options +# +# CONFIG_CRYPTO is not set diff -urN linux-2.6.7-rc2/arch/ia64/ia32/binfmt_elf32.c linux-2.6.7-rc3/arch/ia64/ia32/binfmt_elf32.c --- linux-2.6.7-rc2/arch/ia64/ia32/binfmt_elf32.c 2004-06-07 12:54:48.330014532 -0700 +++ linux-2.6.7-rc3/arch/ia64/ia32/binfmt_elf32.c 2004-06-07 12:55:01.333553090 -0700 @@ -218,3 +218,16 @@ return ia32_do_mmap(filep, (addr & IA32_PAGE_MASK), eppnt->p_filesz + pgoff, prot, type, eppnt->p_offset - pgoff); } + +#define cpu_uses_ia32el() (local_cpu_data->family > 0x1f) + +static int __init check_elf32_binfmt(void) +{ + if (cpu_uses_ia32el()) { + printk("Please use IA-32 EL for executing IA-32 binaries\n"); + return unregister_binfmt(&elf_format); + } + return 0; +} + +module_init(check_elf32_binfmt) diff -urN linux-2.6.7-rc2/arch/ia64/kernel/entry.S linux-2.6.7-rc3/arch/ia64/kernel/entry.S --- linux-2.6.7-rc2/arch/ia64/kernel/entry.S 2004-06-07 12:54:48.336014781 -0700 +++ linux-2.6.7-rc3/arch/ia64/kernel/entry.S 2004-06-07 12:55:01.339553339 -0700 @@ -21,7 +21,7 @@ * Jonathan Nicklin * Patrick O'Rourke * 11/07/2000 - / + */ /* * Global (preserved) predicate usage on syscall entry/exit path: * diff -urN linux-2.6.7-rc2/arch/ia64/kernel/head.S linux-2.6.7-rc3/arch/ia64/kernel/head.S --- linux-2.6.7-rc2/arch/ia64/kernel/head.S 2004-06-07 12:54:48.337014822 -0700 +++ linux-2.6.7-rc3/arch/ia64/kernel/head.S 2004-06-07 12:55:01.341553422 -0700 @@ -815,6 +815,42 @@ br.ret.sptk.many rp END(ia64_delay_loop) +/* + * Return a CPU-local timestamp in nano-seconds. This timestamp is + * NOT synchronized across CPUs its return value must never be + * compared against the values returned on another CPU. The usage in + * kernel/sched.c ensures that. + * + * The return-value of sched_clock() is NOT supposed to wrap-around. + * If it did, it would cause some scheduling hiccups (at the worst). + * Fortunately, with a 64-bit cycle-counter ticking at 100GHz, even + * that would happen only once every 5+ years. + * + * The code below basically calculates: + * + * (ia64_get_itc() * local_cpu_data->nsec_per_cyc) >> IA64_NSEC_PER_CYC_SHIFT + * + * except that the multiplication and the shift are done with 128-bit + * intermediate precision so that we can produce a full 64-bit result. + */ +GLOBAL_ENTRY(sched_clock) + addl r8=THIS_CPU(cpu_info) + IA64_CPUINFO_NSEC_PER_CYC_OFFSET,r0 + mov.m r9=ar.itc // fetch cycle-counter (35 cyc) + ;; + ldf8 f8=[r8] + ;; + setf.sig f9=r9 // certain to stall, so issue it _after_ ldf8... + ;; + xmpy.lu f10=f9,f8 // calculate low 64 bits of 128-bit product (4 cyc) + xmpy.hu f11=f9,f8 // calculate high 64 bits of 128-bit product + ;; + getf.sig r8=f10 // (5 cyc) + getf.sig r9=f11 + ;; + shrp r8=r9,r8,IA64_NSEC_PER_CYC_SHIFT + br.ret.sptk.many rp +END(sched_clock) + GLOBAL_ENTRY(start_kernel_thread) .prologue .save rp, r0 // this is the end of the call-chain diff -urN linux-2.6.7-rc2/arch/ia64/kernel/iosapic.c linux-2.6.7-rc3/arch/ia64/kernel/iosapic.c --- linux-2.6.7-rc2/arch/ia64/kernel/iosapic.c 2004-06-07 12:54:48.338014863 -0700 +++ linux-2.6.7-rc3/arch/ia64/kernel/iosapic.c 2004-06-07 12:55:01.342553463 -0700 @@ -100,7 +100,7 @@ #endif static spinlock_t iosapic_lock = SPIN_LOCK_UNLOCKED; -cpumask_t __cacheline_aligned pending_irq_cpumask[NR_IRQS]; +extern cpumask_t __cacheline_aligned pending_irq_cpumask[NR_IRQS]; /* These tables map IA-64 vectors to the IOSAPIC pin that generates this vector. */ diff -urN linux-2.6.7-rc2/arch/ia64/kernel/irq.c linux-2.6.7-rc3/arch/ia64/kernel/irq.c --- linux-2.6.7-rc2/arch/ia64/kernel/irq.c 2004-06-07 12:54:48.339014905 -0700 +++ linux-2.6.7-rc3/arch/ia64/kernel/irq.c 2004-06-07 12:55:01.343553504 -0700 @@ -56,7 +56,6 @@ #include #include -extern cpumask_t __cacheline_aligned pending_irq_cpumask[NR_IRQS]; /* * Linux has a controller-independent x86 interrupt architecture. @@ -85,6 +84,11 @@ } }; +/* + * This is updated when the user sets irq affinity via /proc + */ +cpumask_t __cacheline_aligned pending_irq_cpumask[NR_IRQS]; + #ifdef CONFIG_IA64_GENERIC irq_desc_t * __ia64_irq_desc (unsigned int irq) { diff -urN linux-2.6.7-rc2/arch/ia64/kernel/setup.c linux-2.6.7-rc3/arch/ia64/kernel/setup.c --- linux-2.6.7-rc2/arch/ia64/kernel/setup.c 2004-06-07 12:54:48.355015567 -0700 +++ linux-2.6.7-rc3/arch/ia64/kernel/setup.c 2004-06-07 12:55:01.358554126 -0700 @@ -330,18 +330,8 @@ setup_serial_hcdp(efi.hcdp); } #endif - /* - * Without HCDP, we won't discover any serial ports until the serial driver looks - * in the ACPI namespace. If ACPI claims there are some legacy devices, register - * the legacy COM ports so serial console works earlier. This is slightly dangerous - * because we don't *really* know whether there's anything there, but we hope that - * all new boxes will implement HCDP. - */ - { - extern unsigned char acpi_legacy_devices; - if (!efi.hcdp && acpi_legacy_devices) - setup_serial_legacy(); - } + if (!efi.hcdp) + setup_serial_legacy(); #endif #ifdef CONFIG_VT @@ -635,6 +625,9 @@ ia32_cpu_init(); #endif + /* Clear ITC to eliminiate sched_clock() overflows in human time. */ + ia64_set_itc(0); + /* disable all local interrupt sources: */ ia64_set_itv(1 << 16); ia64_set_lrr0(1 << 16); diff -urN linux-2.6.7-rc2/arch/ia64/kernel/smpboot.c linux-2.6.7-rc3/arch/ia64/kernel/smpboot.c --- linux-2.6.7-rc2/arch/ia64/kernel/smpboot.c 2004-06-07 12:54:48.357015650 -0700 +++ linux-2.6.7-rc3/arch/ia64/kernel/smpboot.c 2004-06-07 12:55:01.360554209 -0700 @@ -202,7 +202,6 @@ { long i, delta, adj, adjust_latency = 0, done = 0; unsigned long flags, rt, master_time_stamp, bound; - extern void ia64_cpu_local_tick (void); #if DEBUG_ITC_SYNC struct { long rt; /* roundtrip time */ @@ -525,7 +524,7 @@ #else # error Fixme: Dunno how to build CPU-to-node map. #endif - cpu_to_node_map[cpu] = node; + cpu_to_node_map[cpu] = (node >= 0) ? node : 0; if (node >= 0) cpu_set(cpu, node_to_cpu_mask[node]); } diff -urN linux-2.6.7-rc2/arch/ia64/kernel/time.c linux-2.6.7-rc3/arch/ia64/kernel/time.c --- linux-2.6.7-rc2/arch/ia64/kernel/time.c 2004-06-07 12:54:48.357015650 -0700 +++ linux-2.6.7-rc3/arch/ia64/kernel/time.c 2004-06-07 12:55:01.361554250 -0700 @@ -45,14 +45,6 @@ #endif -unsigned long long -sched_clock (void) -{ - unsigned long offset = ia64_get_itc(); - - return (offset * local_cpu_data->nsec_per_cyc) >> IA64_NSEC_PER_CYC_SHIFT; -} - static void itc_reset (void) { diff -urN linux-2.6.7-rc2/arch/ia64/kernel/vmlinux.lds.S linux-2.6.7-rc3/arch/ia64/kernel/vmlinux.lds.S --- linux-2.6.7-rc2/arch/ia64/kernel/vmlinux.lds.S 2004-05-09 19:33:13.000000000 -0700 +++ linux-2.6.7-rc3/arch/ia64/kernel/vmlinux.lds.S 2004-06-07 12:55:01.363554333 -0700 @@ -195,11 +195,10 @@ .data : AT(ADDR(.data) - LOAD_OFFSET) { *(.data) *(.data1) *(.gnu.linkonce.d*) CONSTRUCTORS } - . = ALIGN(16); - __gp = . + 0x200000; /* gp must be 16-byte aligned for exc. table */ - + . = ALIGN(16); /* gp must be 16-byte aligned for exc. table */ .got : AT(ADDR(.got) - LOAD_OFFSET) { *(.got.plt) *(.got) } + __gp = ADDR(.got) + 0x200000; /* We want the small data sections together, so single-instruction offsets can access them all, and initialized data all before uninitialized, so we can shorten the on-disk segment size. */ diff -urN linux-2.6.7-rc2/arch/ia64/lib/Makefile linux-2.6.7-rc3/arch/ia64/lib/Makefile --- linux-2.6.7-rc2/arch/ia64/lib/Makefile 2004-05-09 19:33:20.000000000 -0700 +++ linux-2.6.7-rc3/arch/ia64/lib/Makefile 2004-06-07 12:55:01.364554374 -0700 @@ -6,7 +6,7 @@ lib-y := __divsi3.o __udivsi3.o __modsi3.o __umodsi3.o \ __divdi3.o __udivdi3.o __moddi3.o __umoddi3.o \ - checksum.o clear_page.o csum_partial_copy.o copy_page.o \ + bitop.o checksum.o clear_page.o csum_partial_copy.o copy_page.o \ clear_user.o strncpy_from_user.o strlen_user.o strnlen_user.o \ flush.o ip_fast_csum.o do_csum.o \ memset.o strlen.o swiotlb.o diff -urN linux-2.6.7-rc2/arch/ia64/lib/bitop.c linux-2.6.7-rc3/arch/ia64/lib/bitop.c --- linux-2.6.7-rc2/arch/ia64/lib/bitop.c 1969-12-31 16:00:00.000000000 -0800 +++ linux-2.6.7-rc3/arch/ia64/lib/bitop.c 2004-06-07 12:55:01.364554374 -0700 @@ -0,0 +1,88 @@ +#include +#include +#include +#include +#include + +/* + * Find next zero bit in a bitmap reasonably efficiently.. + */ + +int __find_next_zero_bit (void *addr, unsigned long size, unsigned long offset) +{ + unsigned long *p = ((unsigned long *) addr) + (offset >> 6); + unsigned long result = offset & ~63UL; + unsigned long tmp; + + if (offset >= size) + return size; + size -= result; + offset &= 63UL; + if (offset) { + tmp = *(p++); + tmp |= ~0UL >> (64-offset); + if (size < 64) + goto found_first; + if (~tmp) + goto found_middle; + size -= 64; + result += 64; + } + while (size & ~63UL) { + if (~(tmp = *(p++))) + goto found_middle; + result += 64; + size -= 64; + } + if (!size) + return result; + tmp = *p; +found_first: + tmp |= ~0UL << size; + if (tmp == ~0UL) /* any bits zero? */ + return result + size; /* nope */ +found_middle: + return result + ffz(tmp); +} +EXPORT_SYMBOL(__find_next_zero_bit); + +/* + * Find next bit in a bitmap reasonably efficiently.. + */ +int __find_next_bit(const void *addr, unsigned long size, unsigned long offset) +{ + unsigned long *p = ((unsigned long *) addr) + (offset >> 6); + unsigned long result = offset & ~63UL; + unsigned long tmp; + + if (offset >= size) + return size; + size -= result; + offset &= 63UL; + if (offset) { + tmp = *(p++); + tmp &= ~0UL << offset; + if (size < 64) + goto found_first; + if (tmp) + goto found_middle; + size -= 64; + result += 64; + } + while (size & ~63UL) { + if ((tmp = *(p++))) + goto found_middle; + result += 64; + size -= 64; + } + if (!size) + return result; + tmp = *p; + found_first: + tmp &= ~0UL >> (64-size); + if (tmp == 0UL) /* Are any bits set? */ + return result + size; /* Nope. */ + found_middle: + return result + __ffs(tmp); +} +EXPORT_SYMBOL(__find_next_bit); diff -urN linux-2.6.7-rc2/arch/ia64/pci/pci.c linux-2.6.7-rc3/arch/ia64/pci/pci.c --- linux-2.6.7-rc2/arch/ia64/pci/pci.c 2004-05-09 19:32:29.000000000 -0700 +++ linux-2.6.7-rc3/arch/ia64/pci/pci.c 2004-06-07 12:55:01.366554457 -0700 @@ -323,8 +323,10 @@ struct pci_controller *controller = PCI_CONTROLLER(dev); struct pci_window *window; int i, j; + int limit = (dev->hdr_type == PCI_HEADER_TYPE_NORMAL) ? \ + PCI_ROM_RESOURCE : PCI_NUM_RESOURCES; - for (i = 0; i < PCI_NUM_RESOURCES; i++) { + for (i = 0; i < limit; i++) { if (!dev->resource[i].start) continue; diff -urN linux-2.6.7-rc2/arch/ia64/sn/io/machvec/iomv.c linux-2.6.7-rc3/arch/ia64/sn/io/machvec/iomv.c --- linux-2.6.7-rc2/arch/ia64/sn/io/machvec/iomv.c 2004-05-09 19:32:37.000000000 -0700 +++ linux-2.6.7-rc3/arch/ia64/sn/io/machvec/iomv.c 2004-06-07 12:55:01.367554499 -0700 @@ -71,6 +71,6 @@ { while ((((volatile unsigned long) (*pda->pio_write_status_addr)) & SH_PIO_WRITE_STATUS_0_PENDING_WRITE_COUNT_MASK) != SH_PIO_WRITE_STATUS_0_PENDING_WRITE_COUNT_MASK) - udelay(1); + cpu_relax(); } EXPORT_SYMBOL(sn_mmiob); diff -urN linux-2.6.7-rc2/arch/ia64/sn/io/sn2/pcibr/pcibr_slot.c linux-2.6.7-rc3/arch/ia64/sn/io/sn2/pcibr/pcibr_slot.c --- linux-2.6.7-rc2/arch/ia64/sn/io/sn2/pcibr/pcibr_slot.c 2004-05-09 19:32:29.000000000 -0700 +++ linux-2.6.7-rc3/arch/ia64/sn/io/sn2/pcibr/pcibr_slot.c 2004-06-07 12:55:01.374554788 -0700 @@ -3,7 +3,7 @@ * License. See the file "COPYING" in the main directory of this archive * for more details. * - * Copyright (C) 2001-2003 Silicon Graphics, Inc. All rights reserved. + * Copyright (C) 2001-2004 Silicon Graphics, Inc. All rights reserved. */ #include @@ -1615,6 +1615,46 @@ piomap->bp_kvaddr + offset, len, valp); } +static uint64_t +pcibr_disable_mst_timeout(pcibr_soft_t pcibr_soft) +{ + uint64_t old_enable; + uint64_t new_enable; + uint64_t intr_bits; + + intr_bits = PIC_ISR_PCI_MST_TIMEOUT + | PIC_ISR_PCIX_MTOUT | PIC_ISR_PCIX_SPLIT_EMSG; + old_enable = pcireg_intr_enable_get(pcibr_soft); + pcireg_intr_enable_bit_clr(pcibr_soft, intr_bits); + new_enable = pcireg_intr_enable_get(pcibr_soft); + + if (old_enable == new_enable) { + return 0; /* was already disabled */ + } else { + return 1; + } +} + +static int +pcibr_enable_mst_timeout(pcibr_soft_t pcibr_soft) +{ + uint64_t old_enable; + uint64_t new_enable; + uint64_t intr_bits; + + intr_bits = PIC_ISR_PCI_MST_TIMEOUT + | PIC_ISR_PCIX_MTOUT | PIC_ISR_PCIX_SPLIT_EMSG; + old_enable = pcireg_intr_enable_get(pcibr_soft); + pcireg_intr_enable_bit_set(pcibr_soft, intr_bits); + new_enable = pcireg_intr_enable_get(pcibr_soft); + + if (old_enable == new_enable) { + return 0; /* was alread enabled */ + } else { + return 1; + } +} + /* * pcibr_probe_slot: read a config space word * while trapping any errors; return zero if @@ -1628,7 +1668,7 @@ int len, void *valp) { - int rv; + int rv, changed; /* * Sanity checks ... @@ -1642,15 +1682,19 @@ return -1; /* invalid alignment */ } + changed = pcibr_disable_mst_timeout(pcibr_soft); + rv = snia_badaddr_val((void *)addr, len, valp); /* Clear the int_view register incase it was set */ pcireg_intr_reset_set(pcibr_soft, BRIDGE_IRR_MULTI_CLR); + if (changed) { + pcibr_enable_mst_timeout(pcibr_soft); + } return (rv ? 1 : 0); /* return 1 for snia_badaddr_val error, 0 if ok */ } - void pcibr_device_info_free(vertex_hdl_t pcibr_vhdl, pciio_slot_t slot) { diff -urN linux-2.6.7-rc2/arch/ppc/kernel/irq.c linux-2.6.7-rc3/arch/ppc/kernel/irq.c --- linux-2.6.7-rc2/arch/ppc/kernel/irq.c 2004-05-09 19:33:13.000000000 -0700 +++ linux-2.6.7-rc3/arch/ppc/kernel/irq.c 2004-06-07 12:55:01.639565764 -0700 @@ -304,8 +304,10 @@ void disable_irq(unsigned int irq) { + irq_desc_t *desc = irq_desc + irq; disable_irq_nosync(irq); - synchronize_irq(irq); + if (desc->action) + synchronize_irq(irq); } /** diff -urN linux-2.6.7-rc2/arch/ppc/kernel/pci.c linux-2.6.7-rc3/arch/ppc/kernel/pci.c --- linux-2.6.7-rc2/arch/ppc/kernel/pci.c 2004-05-09 19:32:29.000000000 -0700 +++ linux-2.6.7-rc3/arch/ppc/kernel/pci.c 2004-06-07 12:55:01.640565806 -0700 @@ -128,7 +128,7 @@ struct resource *res = dev->resource + i; if (!res->flags) continue; - if (!res->start || res->end == 0xffffffff) { + if (res->end == 0xffffffff) { DBG("PCI:%s Resource %d [%08lx-%08lx] is unassigned\n", pci_name(dev), i, res->start, res->end); res->end -= res->start; @@ -347,6 +347,8 @@ return -1; } res = bus->resource[i]; + if (res == NULL) + return -1; pr = NULL; for (j = 0; j < 4; j++) { struct resource *r = parent->resource[j]; @@ -659,11 +661,11 @@ return; bus_range = (int *) get_property(node, "bus-range", &len); if (bus_range == NULL || len < 2 * sizeof(int)) { - printk(KERN_WARNING "Can't get bus-range for %s\n", - node->full_name); - return; - } - pci_to_OF_bus_map[pci_bus] = bus_range[0]; + printk(KERN_WARNING "Can't get bus-range for %s, " + "assuming it starts at 0\n", node->full_name); + pci_to_OF_bus_map[pci_bus] = 0; + } else + pci_to_OF_bus_map[pci_bus] = bus_range[0]; for (node=node->child; node != 0;node = node->sibling) { struct pci_dev* dev; @@ -1073,6 +1075,8 @@ u16 w; struct resource res; + if (bus->resource[0] == NULL) + return; res = *(bus->resource[0]); DBG("Remapping Bus %d, bridge: %s\n", bus->number, bridge->slot_name); @@ -1168,7 +1172,8 @@ int has_vga = 0; for (parent_io=0; parent_io<4; parent_io++) - if (bus->resource[parent_io]->flags & IORESOURCE_IO) + if (bus->resource[parent_io] + && bus->resource[parent_io]->flags & IORESOURCE_IO) break; if (parent_io >= 4) return; diff -urN linux-2.6.7-rc2/arch/ppc/kernel/ppc_htab.c linux-2.6.7-rc3/arch/ppc/kernel/ppc_htab.c --- linux-2.6.7-rc2/arch/ppc/kernel/ppc_htab.c 2004-05-09 19:31:59.000000000 -0700 +++ linux-2.6.7-rc3/arch/ppc/kernel/ppc_htab.c 2004-06-07 12:55:01.641565847 -0700 @@ -101,7 +101,7 @@ { unsigned long mmcr0 = 0, pmc1 = 0, pmc2 = 0; int n = 0; -#ifdef CONFIG_PPC_STD_MMU +#if defined(CONFIG_PPC_STD_MMU) && !defined(CONFIG_PPC64BRIDGE) unsigned int kptes = 0, uptes = 0; PTE *ptr; #endif /* CONFIG_PPC_STD_MMU */ @@ -135,6 +135,7 @@ goto return_string; } +#ifndef CONFIG_PPC64BRIDGE for (ptr = Hash; ptr < Hash_end; ptr++) { unsigned int mctx, vsid; @@ -148,6 +149,7 @@ else uptes++; } +#endif n += sprintf( buffer + n, "PTE Hash Table Information\n" @@ -155,16 +157,20 @@ "Buckets\t\t: %lu\n" "Address\t\t: %08lx\n" "Entries\t\t: %lu\n" +#ifndef CONFIG_PPC64BRIDGE "User ptes\t: %u\n" "Kernel ptes\t: %u\n" - "Percent full\t: %lu%%\n", - (unsigned long)(Hash_size>>10), + "Percent full\t: %lu%%\n" +#endif + , (unsigned long)(Hash_size>>10), (Hash_size/(sizeof(PTE)*8)), (unsigned long)Hash, - Hash_size/sizeof(PTE), - uptes, + Hash_size/sizeof(PTE) +#ifndef CONFIG_PPC64BRIDGE + , uptes, kptes, ((kptes+uptes)*100) / (Hash_size/sizeof(PTE)) +#endif ); n += sprintf( buffer + n, diff -urN linux-2.6.7-rc2/arch/ppc/kernel/ppc_ksyms.c linux-2.6.7-rc3/arch/ppc/kernel/ppc_ksyms.c --- linux-2.6.7-rc2/arch/ppc/kernel/ppc_ksyms.c 2004-06-07 12:54:48.650027785 -0700 +++ linux-2.6.7-rc3/arch/ppc/kernel/ppc_ksyms.c 2004-06-07 12:55:01.641565847 -0700 @@ -200,15 +200,6 @@ EXPORT_SYMBOL(giveup_altivec); #endif /* CONFIG_ALTIVEC */ #ifdef CONFIG_SMP -#ifdef CONFIG_DEBUG_SPINLOCK -EXPORT_SYMBOL(_raw_spin_lock); -EXPORT_SYMBOL(_raw_spin_unlock); -EXPORT_SYMBOL(_raw_spin_trylock); -EXPORT_SYMBOL(_raw_read_lock); -EXPORT_SYMBOL(_raw_read_unlock); -EXPORT_SYMBOL(_raw_write_lock); -EXPORT_SYMBOL(_raw_write_unlock); -#endif EXPORT_SYMBOL(smp_call_function); EXPORT_SYMBOL(smp_hw_index); EXPORT_SYMBOL(synchronize_irq); diff -urN linux-2.6.7-rc2/arch/ppc/kernel/process.c linux-2.6.7-rc3/arch/ppc/kernel/process.c --- linux-2.6.7-rc2/arch/ppc/kernel/process.c 2004-06-07 12:54:48.651027827 -0700 +++ linux-2.6.7-rc3/arch/ppc/kernel/process.c 2004-06-07 12:55:01.642565889 -0700 @@ -163,7 +163,7 @@ void enable_kernel_altivec(void) { - WARN_ON(current_thread_info()->preempt_count == 0 && !irqs_disabled()); + WARN_ON(preemptible()); #ifdef CONFIG_SMP if (current->thread.regs && (current->thread.regs->msr & MSR_VEC)) @@ -180,7 +180,7 @@ void enable_kernel_fp(void) { - WARN_ON(current_thread_info()->preempt_count == 0 && !irqs_disabled()); + WARN_ON(preemptible()); #ifdef CONFIG_SMP if (current->thread.regs && (current->thread.regs->msr & MSR_FP)) diff -urN linux-2.6.7-rc2/arch/ppc/lib/locks.c linux-2.6.7-rc3/arch/ppc/lib/locks.c --- linux-2.6.7-rc2/arch/ppc/lib/locks.c 2004-05-09 19:32:26.000000000 -0700 +++ linux-2.6.7-rc3/arch/ppc/lib/locks.c 2004-06-07 12:55:01.645566013 -0700 @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -22,7 +23,7 @@ * since they may inhibit forward progress by other CPUs in getting * a lock. */ -unsigned long __spin_trylock(volatile unsigned long *lock) +static inline unsigned long __spin_trylock(volatile unsigned long *lock) { unsigned long ret; @@ -62,6 +63,7 @@ lock->owner_pc = (unsigned long)__builtin_return_address(0); lock->owner_cpu = cpu; } +EXPORT_SYMBOL(_raw_spin_lock); int _raw_spin_trylock(spinlock_t *lock) { @@ -71,6 +73,7 @@ lock->owner_pc = (unsigned long)__builtin_return_address(0); return 1; } +EXPORT_SYMBOL(_raw_spin_trylock); void _raw_spin_unlock(spinlock_t *lp) { @@ -86,6 +89,7 @@ wmb(); lp->lock = 0; } +EXPORT_SYMBOL(_raw_spin_unlock); /* @@ -119,6 +123,7 @@ } wmb(); } +EXPORT_SYMBOL(_raw_read_lock); void _raw_read_unlock(rwlock_t *rw) { @@ -129,6 +134,7 @@ wmb(); atomic_dec((atomic_t *) &(rw)->lock); } +EXPORT_SYMBOL(_raw_read_unlock); void _raw_write_lock(rwlock_t *rw) { @@ -169,6 +175,22 @@ } wmb(); } +EXPORT_SYMBOL(_raw_write_lock); + +int _raw_write_trylock(rwlock_t *rw) +{ + if (test_and_set_bit(31, &(rw)->lock)) /* someone has a write lock */ + return 0; + + if ((rw)->lock & ~(1<<31)) { /* someone has a read lock */ + /* clear our write lock and wait for reads to go away */ + clear_bit(31,&(rw)->lock); + return 0; + } + wmb(); + return 1; +} +EXPORT_SYMBOL(_raw_write_trylock); void _raw_write_unlock(rwlock_t *rw) { @@ -179,5 +201,6 @@ wmb(); clear_bit(31,&(rw)->lock); } +EXPORT_SYMBOL(_raw_write_unlock); #endif diff -urN linux-2.6.7-rc2/arch/ppc/mm/tlb.c linux-2.6.7-rc3/arch/ppc/mm/tlb.c --- linux-2.6.7-rc2/arch/ppc/mm/tlb.c 2004-05-09 19:32:53.000000000 -0700 +++ linux-2.6.7-rc3/arch/ppc/mm/tlb.c 2004-06-07 12:55:01.652566303 -0700 @@ -67,6 +67,17 @@ } /* + * Called by ptep_set_access_flags, must flush on CPUs for which the + * DSI handler can't just "fixup" the TLB on a write fault + */ +void flush_tlb_page_nohash(struct vm_area_struct *vma, unsigned long addr) +{ + if (Hash != 0) + return; + _tlbie(addr); +} + +/* * Called at the end of a mmu_gather operation to make sure the * TLB flush is completely done. */ diff -urN linux-2.6.7-rc2/arch/ppc/syslib/Makefile linux-2.6.7-rc3/arch/ppc/syslib/Makefile --- linux-2.6.7-rc2/arch/ppc/syslib/Makefile 2004-06-07 12:54:48.682029111 -0700 +++ linux-2.6.7-rc3/arch/ppc/syslib/Makefile 2004-06-07 12:55:01.674567214 -0700 @@ -9,8 +9,8 @@ EXTRA_AFLAGS := -Wa,-m405 endif -CFLAGS_prom_init.o += -mrelocatable-lib -CFLAGS_btext.o += -mrelocatable-lib +CFLAGS_prom_init.o += -fPIC +CFLAGS_btext.o += -fPIC obj-$(CONFIG_PPCBUG_NVRAM) += prep_nvram.o obj-$(CONFIG_PPC_OCP) += ocp.o @@ -72,3 +72,5 @@ endif obj-$(CONFIG_BOOTX_TEXT) += btext.o obj-$(CONFIG_MPC10X_BRIDGE) += mpc10x_common.o indirect_pci.o +obj-$(CONFIG_40x) += dcr.o +obj-$(CONFIG_BOOKE) += dcr.o diff -urN linux-2.6.7-rc2/arch/ppc/syslib/dcr.S linux-2.6.7-rc3/arch/ppc/syslib/dcr.S --- linux-2.6.7-rc2/arch/ppc/syslib/dcr.S 1969-12-31 16:00:00.000000000 -0800 +++ linux-2.6.7-rc3/arch/ppc/syslib/dcr.S 2004-06-07 12:55:01.674567214 -0700 @@ -0,0 +1,41 @@ +/* + * arch/ppc/syslib/dcr.S + * + * "Indirect" DCR access + * + * Copyright (c) 2004 Eugene Surovegin + * + * 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. + */ + +#include +#include + +#define DCR_ACCESS_PROLOG(table) \ + rlwinm r3,r3,4,18,27; \ + lis r5,table@h; \ + ori r5,r5,table@l; \ + add r3,r3,r5; \ + mtctr r3; \ + bctr + +_GLOBAL(__mfdcr) + DCR_ACCESS_PROLOG(__mfdcr_table) + +_GLOBAL(__mtdcr) + DCR_ACCESS_PROLOG(__mtdcr_table) + +__mfdcr_table: + mfdcr r3,0; blr +__mtdcr_table: + mtdcr 0,r4; blr + +dcr = 1 + .rept 1023 + mfdcr r3,dcr; blr + mtdcr dcr,r4; blr + dcr = dcr + 1 + .endr diff -urN linux-2.6.7-rc2/arch/ppc64/Makefile linux-2.6.7-rc3/arch/ppc64/Makefile --- linux-2.6.7-rc2/arch/ppc64/Makefile 2004-05-09 19:32:01.000000000 -0700 +++ linux-2.6.7-rc3/arch/ppc64/Makefile 2004-06-07 12:55:01.680567463 -0700 @@ -17,12 +17,13 @@ HAS_BIARCH := $(shell if $(CC) -m64 -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo y; else echo n; fi;) ifeq ($(HAS_BIARCH),y) -AS := $(AS) -64 +AS := $(AS) -a64 LD := $(LD) -m elf64ppc CC := $(CC) -m64 -CHECK := $(CHECK) -m64 endif +CHECK := $(CHECK) -m64 -D__powerpc__=1 + LDFLAGS := -m elf64ppc LDFLAGS_vmlinux := -Bstatic -e $(KERNELLOAD) -Ttext $(KERNELLOAD) CFLAGS += -msoft-float -pipe -Wno-uninitialized -mminimal-toc \ diff -urN linux-2.6.7-rc2/arch/ppc64/configs/iSeries_defconfig linux-2.6.7-rc3/arch/ppc64/configs/iSeries_defconfig --- linux-2.6.7-rc2/arch/ppc64/configs/iSeries_defconfig 2004-05-09 19:33:21.000000000 -0700 +++ linux-2.6.7-rc3/arch/ppc64/configs/iSeries_defconfig 2004-06-07 12:55:01.681567504 -0700 @@ -23,19 +23,23 @@ # CONFIG_SWAP=y CONFIG_SYSVIPC=y +# CONFIG_POSIX_MQUEUE is not set # CONFIG_BSD_PROCESS_ACCT is not set CONFIG_SYSCTL=y +# CONFIG_AUDIT is not set CONFIG_LOG_BUF_SHIFT=17 CONFIG_HOTPLUG=y CONFIG_IKCONFIG=y CONFIG_IKCONFIG_PROC=y -CONFIG_EMBEDDED=y +# CONFIG_EMBEDDED is not set CONFIG_KALLSYMS=y +# CONFIG_KALLSYMS_ALL is not set CONFIG_FUTEX=y CONFIG_EPOLL=y CONFIG_IOSCHED_NOOP=y CONFIG_IOSCHED_AS=y CONFIG_IOSCHED_DEADLINE=y +CONFIG_IOSCHED_CFQ=y # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set # @@ -48,6 +52,7 @@ # CONFIG_MODVERSIONS is not set # CONFIG_KMOD is not set CONFIG_STOP_MACHINE=y +CONFIG_SYSVIPC_COMPAT=y # # Platform support @@ -60,6 +65,7 @@ # CONFIG_IOMMU_VMERGE is not set CONFIG_SMP=y CONFIG_NR_CPUS=32 +# CONFIG_SCHED_SMT is not set CONFIG_MSCHUNKS=y CONFIG_LPARCFG=y @@ -72,6 +78,7 @@ # CONFIG_BINFMT_MISC is not set CONFIG_PCI_LEGACY_PROC=y CONFIG_PCI_NAMES=y +# CONFIG_HOTPLUG_CPU is not set # # PCMCIA/CardBus support @@ -148,7 +155,6 @@ # Some SCSI devices (e.g. CD jukebox) support multiple LUNs # CONFIG_SCSI_MULTI_LUN=y -CONFIG_SCSI_REPORT_LUNS=y CONFIG_SCSI_CONSTANTS=y # CONFIG_SCSI_LOGGING is not set @@ -180,6 +186,7 @@ # CONFIG_SCSI_IPS is not set # CONFIG_SCSI_INIA100 is not set # CONFIG_SCSI_SYM53C8XX_2 is not set +# CONFIG_SCSI_IPR is not set # CONFIG_SCSI_QLOGIC_ISP is not set # CONFIG_SCSI_QLOGIC_FC is not set # CONFIG_SCSI_QLOGIC_1280 is not set @@ -221,6 +228,7 @@ # # I2O device support # +# CONFIG_I2O is not set # # Macintosh device drivers @@ -247,7 +255,6 @@ # CONFIG_NET_IPGRE is not set # CONFIG_IP_MROUTE is not set # CONFIG_ARPD is not set -CONFIG_INET_ECN=y CONFIG_SYN_COOKIES=y CONFIG_INET_AH=m CONFIG_INET_ESP=m @@ -258,8 +265,6 @@ # # CONFIG_IP_VS is not set # CONFIG_IPV6 is not set -# CONFIG_DECNET is not set -# CONFIG_BRIDGE is not set CONFIG_NETFILTER=y # CONFIG_NETFILTER_DEBUG is not set @@ -319,16 +324,18 @@ CONFIG_IP_NF_ARP_MANGLE=m CONFIG_IP_NF_COMPAT_IPCHAINS=m CONFIG_IP_NF_COMPAT_IPFWADM=m +# CONFIG_IP_NF_RAW is not set CONFIG_XFRM=y CONFIG_XFRM_USER=m # # SCTP Configuration (EXPERIMENTAL) # -CONFIG_IPV6_SCTP__=y # CONFIG_IP_SCTP is not set # CONFIG_ATM is not set +# CONFIG_BRIDGE is not set # CONFIG_VLAN_8021Q is not set +# CONFIG_DECNET is not set CONFIG_LLC=y # CONFIG_LLC2 is not set # CONFIG_IPX is not set @@ -350,16 +357,23 @@ # Network testing # # CONFIG_NET_PKTGEN is not set +CONFIG_NETPOLL=y +CONFIG_NETPOLL_RX=y +CONFIG_NETPOLL_TRAP=y +CONFIG_NET_POLL_CONTROLLER=y +# CONFIG_HAMRADIO is not set +# CONFIG_IRDA is not set +# CONFIG_BT is not set CONFIG_NETDEVICES=y +CONFIG_DUMMY=m +CONFIG_BONDING=m +# CONFIG_EQUALIZER is not set +CONFIG_TUN=m # # ARCnet devices # # CONFIG_ARCNET is not set -CONFIG_DUMMY=m -CONFIG_BONDING=m -# CONFIG_EQUALIZER is not set -CONFIG_TUN=m # # Ethernet (10 or 100Mbit) @@ -397,43 +411,9 @@ # CONFIG_VIA_RHINE is not set # -# Ethernet (1000 Mbit) +# Gigabit Ethernet (1000/10000 Mbit) # -CONFIG_ACENIC=y -CONFIG_ACENIC_OMIT_TIGON_I=y -# CONFIG_DL2K is not set -CONFIG_E1000=y -# CONFIG_E1000_NAPI is not set -# CONFIG_NS83820 is not set -# CONFIG_HAMACHI is not set -# CONFIG_YELLOWFIN is not set -# CONFIG_R8169 is not set -# CONFIG_SIS190 is not set -# CONFIG_SK98LIN is not set -# CONFIG_TIGON3 is not set - -# -# Ethernet (10000 Mbit) -# -CONFIG_IXGB=m -# CONFIG_IXGB_NAPI is not set -# CONFIG_VETH is not set -# CONFIG_FDDI is not set -# CONFIG_HIPPI is not set -CONFIG_PPP=m -# CONFIG_PPP_MULTILINK is not set -# CONFIG_PPP_FILTER is not set -CONFIG_PPP_ASYNC=m -CONFIG_PPP_SYNC_TTY=m -CONFIG_PPP_DEFLATE=m -CONFIG_PPP_BSDCOMP=m -CONFIG_PPPOE=m -# CONFIG_SLIP is not set - -# -# Wireless LAN (non-hamradio) -# -# CONFIG_NET_RADIO is not set +# CONFIG_NET_GIGE is not set # # Token Ring devices @@ -443,33 +423,31 @@ # CONFIG_IBMLS is not set # CONFIG_3C359 is not set # CONFIG_TMS380TR is not set -# CONFIG_NET_FC is not set -# CONFIG_SHAPER is not set -CONFIG_NETCONSOLE=y - -# -# Wan interfaces -# -# CONFIG_WAN is not set - -# -# Amateur Radio support -# -# CONFIG_HAMRADIO is not set # -# IrDA (infrared) support +# Wireless LAN (non-hamradio) # -# CONFIG_IRDA is not set +# CONFIG_NET_RADIO is not set # -# Bluetooth support +# Wan interfaces # -# CONFIG_BT is not set -CONFIG_NETPOLL=y -CONFIG_NETPOLL_RX=y -CONFIG_NETPOLL_TRAP=y -CONFIG_NET_POLL_CONTROLLER=y +# CONFIG_WAN is not set +CONFIG_ISERIES_VETH=y +# CONFIG_FDDI is not set +# CONFIG_HIPPI is not set +CONFIG_PPP=m +# CONFIG_PPP_MULTILINK is not set +# CONFIG_PPP_FILTER is not set +CONFIG_PPP_ASYNC=m +CONFIG_PPP_SYNC_TTY=m +CONFIG_PPP_DEFLATE=m +CONFIG_PPP_BSDCOMP=m +CONFIG_PPPOE=m +# CONFIG_SLIP is not set +# CONFIG_NET_FC is not set +# CONFIG_SHAPER is not set +CONFIG_NETCONSOLE=y # # ISDN subsystem @@ -489,7 +467,10 @@ # # Userland interfaces # -# CONFIG_INPUT_MOUSEDEV is not set +CONFIG_INPUT_MOUSEDEV=y +CONFIG_INPUT_MOUSEDEV_PSAUX=y +CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 +CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 # CONFIG_INPUT_JOYDEV is not set # CONFIG_INPUT_TSDEV is not set # CONFIG_INPUT_EVDEV is not set @@ -518,7 +499,6 @@ # # Character devices # -# CONFIG_VT is not set # CONFIG_SERIAL_NONSTANDARD is not set # @@ -532,11 +512,6 @@ CONFIG_UNIX98_PTYS=y CONFIG_LEGACY_PTYS=y CONFIG_LEGACY_PTY_COUNT=256 - -# -# Mice -# -# CONFIG_BUSMOUSE is not set # CONFIG_QIC02_TAPE is not set # @@ -618,6 +593,7 @@ CONFIG_REISERFS_FS=y # CONFIG_REISERFS_CHECK is not set # CONFIG_REISERFS_PROC_INFO is not set +# CONFIG_REISERFS_FS_XATTR is not set CONFIG_JFS_FS=y CONFIG_JFS_POSIX_ACL=y # CONFIG_JFS_DEBUG is not set @@ -655,6 +631,7 @@ # CONFIG_PROC_FS=y CONFIG_PROC_KCORE=y +CONFIG_SYSFS=y # CONFIG_DEVFS_FS is not set CONFIG_DEVPTS_FS_XATTR=y # CONFIG_DEVPTS_FS_SECURITY is not set @@ -695,10 +672,11 @@ CONFIG_LOCKD_V4=y CONFIG_EXPORTFS=y CONFIG_SUNRPC=y -CONFIG_SUNRPC_GSS=m -CONFIG_RPCSEC_GSS_KRB5=m +CONFIG_SUNRPC_GSS=y +CONFIG_RPCSEC_GSS_KRB5=y # CONFIG_SMB_FS is not set CONFIG_CIFS=m +# CONFIG_CIFS_STATS is not set # CONFIG_NCP_FS is not set # CONFIG_CODA_FS is not set # CONFIG_AFS_FS is not set @@ -757,8 +735,8 @@ # CONFIG_VIOCONS=y CONFIG_VIODASD=y -CONFIG_VIOCD=y -# CONFIG_VIOTAPE is not set +CONFIG_VIOCD=m +CONFIG_VIOTAPE=m CONFIG_VIOPATH=y # @@ -778,6 +756,7 @@ # CONFIG_DEBUGGER is not set # CONFIG_PPCDBG is not set # CONFIG_DEBUG_INFO is not set +# CONFIG_IRQSTACKS is not set # # Security options @@ -791,11 +770,11 @@ CONFIG_CRYPTO_HMAC=y CONFIG_CRYPTO_NULL=m CONFIG_CRYPTO_MD4=m -CONFIG_CRYPTO_MD5=m +CONFIG_CRYPTO_MD5=y CONFIG_CRYPTO_SHA1=m CONFIG_CRYPTO_SHA256=m CONFIG_CRYPTO_SHA512=m -CONFIG_CRYPTO_DES=m +CONFIG_CRYPTO_DES=y CONFIG_CRYPTO_BLOWFISH=m CONFIG_CRYPTO_TWOFISH=m CONFIG_CRYPTO_SERPENT=m @@ -804,11 +783,14 @@ CONFIG_CRYPTO_CAST6=m CONFIG_CRYPTO_ARC4=m CONFIG_CRYPTO_DEFLATE=m +# CONFIG_CRYPTO_MICHAEL_MIC is not set +# CONFIG_CRYPTO_CRC32C is not set CONFIG_CRYPTO_TEST=m # # Library routines # CONFIG_CRC32=y +# CONFIG_LIBCRC32C is not set CONFIG_ZLIB_INFLATE=y CONFIG_ZLIB_DEFLATE=m diff -urN linux-2.6.7-rc2/arch/ppc64/kernel/align.c linux-2.6.7-rc3/arch/ppc64/kernel/align.c --- linux-2.6.7-rc2/arch/ppc64/kernel/align.c 2004-06-07 12:54:48.689029401 -0700 +++ linux-2.6.7-rc3/arch/ppc64/kernel/align.c 2004-06-07 12:55:01.682567545 -0700 @@ -217,7 +217,7 @@ unsigned dsisr; unsigned char __user *addr; unsigned char __user *p; - unsigned long *lp; + unsigned long __user *lp; union { long ll; double dd; @@ -242,9 +242,9 @@ if (cur_cpu_spec->cpu_features & CPU_FTR_NODSISRALIGN) { unsigned int real_instr; - if (__get_user(real_instr, (unsigned int *)regs->nip)) + if (__get_user(real_instr, (unsigned int __user *)regs->nip)) return 0; - dsisr = make_dsisr(*((unsigned *)regs->nip)); + dsisr = make_dsisr(real_instr); } /* extract the operation and registers from the dsisr */ @@ -361,7 +361,7 @@ p = addr; switch (nb) { case 128: /* Special case - must be dcbz */ - lp = (unsigned long *)p; + lp = (unsigned long __user *)p; for (i = 0; i < L1_CACHE_BYTES / sizeof(long); ++i) ret |= __put_user(0, lp++); break; diff -urN linux-2.6.7-rc2/arch/ppc64/kernel/asm-offsets.c linux-2.6.7-rc3/arch/ppc64/kernel/asm-offsets.c --- linux-2.6.7-rc2/arch/ppc64/kernel/asm-offsets.c 2004-05-09 19:32:53.000000000 -0700 +++ linux-2.6.7-rc3/arch/ppc64/kernel/asm-offsets.c 2004-06-07 12:55:01.682567545 -0700 @@ -73,7 +73,6 @@ DEFINE(ICACHEL1LINESIZE, offsetof(struct systemcfg, iCacheL1LineSize)); DEFINE(ICACHEL1LOGLINESIZE, offsetof(struct naca_struct, iCacheL1LogLineSize)); DEFINE(ICACHEL1LINESPERPAGE, offsetof(struct naca_struct, iCacheL1LinesPerPage)); - DEFINE(SLBSIZE, offsetof(struct naca_struct, slb_size)); DEFINE(PLATFORM, offsetof(struct systemcfg, platform)); /* paca */ diff -urN linux-2.6.7-rc2/arch/ppc64/kernel/eeh.c linux-2.6.7-rc3/arch/ppc64/kernel/eeh.c --- linux-2.6.7-rc2/arch/ppc64/kernel/eeh.c 2004-05-09 19:32:52.000000000 -0700 +++ linux-2.6.7-rc3/arch/ppc64/kernel/eeh.c 2004-06-07 12:55:01.683567587 -0700 @@ -612,33 +612,25 @@ } /** - * eeh_add_device - perform EEH initialization for the indicated pci device - * @dev: pci device for which to set up EEH + * eeh_add_device_early - enable EEH for the indicated device_node + * @dn: device node for which to set up EEH * - * This routine can be used to perform EEH initialization for PCI + * This routine must be used to perform EEH initialization for PCI * devices that were added after system boot (e.g. hotplug, dlpar). + * This routine must be called before any i/o is performed to the + * adapter (inluding any config-space i/o). * Whether this actually enables EEH or not for this device depends - * on the type of the device, on earlier boot command-line - * arguments & etc. + * on the CEC architecture, type of the device, on earlier boot + * command-line arguments & etc. */ -void eeh_add_device(struct pci_dev *dev) +void eeh_add_device_early(struct device_node *dn) { - struct device_node *dn; struct pci_controller *phb; struct eeh_early_enable_info info; - if (!dev || !eeh_subsystem_enabled) - return; - -#ifdef DEBUG - printk(KERN_DEBUG "EEH: adding device %s %s\n", pci_name(dev), - pci_pretty_name(dev)); -#endif - dn = pci_device_to_OF_node(dev); - if (NULL == dn) + if (!dn || !eeh_subsystem_enabled) return; - - phb = PCI_GET_PHB_PTR(dev); + phb = dn->phb; if (NULL == phb || 0 == phb->buid) { printk(KERN_WARNING "EEH: Expected buid but found none\n"); return; @@ -646,11 +638,30 @@ info.buid_hi = BUID_HI(phb->buid); info.buid_lo = BUID_LO(phb->buid); - early_enable_eeh(dn, &info); +} +EXPORT_SYMBOL(eeh_add_device_early); + +/** + * eeh_add_device_late - perform EEH initialization for the indicated pci device + * @dev: pci device for which to set up EEH + * + * This routine must be used to complete EEH initialization for PCI + * devices that were added after system boot (e.g. hotplug, dlpar). + */ +void eeh_add_device_late(struct pci_dev *dev) +{ + if (!dev || !eeh_subsystem_enabled) + return; + +#ifdef DEBUG + printk(KERN_DEBUG "EEH: adding device %s %s\n", pci_name(dev), + pci_pretty_name(dev)); +#endif + pci_addr_cache_insert_device (dev); } -EXPORT_SYMBOL(eeh_add_device); +EXPORT_SYMBOL(eeh_add_device_late); /** * eeh_remove_device - undo EEH setup for the indicated pci device diff -urN linux-2.6.7-rc2/arch/ppc64/kernel/head.S linux-2.6.7-rc3/arch/ppc64/kernel/head.S --- linux-2.6.7-rc2/arch/ppc64/kernel/head.S 2004-06-07 12:54:48.690029442 -0700 +++ linux-2.6.7-rc3/arch/ppc64/kernel/head.S 2004-06-07 12:55:01.685567670 -0700 @@ -926,8 +926,8 @@ stb r0,PACAPROCENABLED(r20) /* Soft Disabled */ mfmsr r0 - ori r0,r0,MSR_EE+MSR_RI - mtmsrd r0 /* Hard Enable, RI on */ + ori r0,r0,MSR_EE + mtmsrd r0,1 /* Hard Enable */ #endif /* @@ -946,9 +946,9 @@ */ mfmsr r0 li r4,0 - ori r4,r4,MSR_EE+MSR_RI + ori r4,r4,MSR_EE andc r0,r0,r4 - mtmsrd r0 /* Hard Disable, RI off */ + mtmsrd r0,1 /* Hard Disable */ ld r0,SOFTE(r1) cmpdi 0,r0,0 /* See if we will soft enable in */ @@ -1123,13 +1123,11 @@ */ /* r20 = paca */ - /* use a cpu feature mask if we ever change our slb size */ -SLB_NUM_ENTRIES = 64 1: ld r22,PACASTABRR(r20) addi r21,r22,1 cmpdi r21,SLB_NUM_ENTRIES blt+ 2f - li r21,1 /* dont touch bolted slot 0 */ + li r21,2 /* dont touch slot 0 or 1 */ 2: std r21,PACASTABRR(r20) /* r20 = paca, r22 = entry */ diff -urN linux-2.6.7-rc2/arch/ppc64/kernel/iSeries_setup.c linux-2.6.7-rc3/arch/ppc64/kernel/iSeries_setup.c --- linux-2.6.7-rc2/arch/ppc64/kernel/iSeries_setup.c 2004-05-09 19:32:54.000000000 -0700 +++ linux-2.6.7-rc3/arch/ppc64/kernel/iSeries_setup.c 2004-06-07 12:55:01.685567670 -0700 @@ -563,11 +563,6 @@ lmb_add(0, systemcfg->physicalMemorySize); lmb_analyze(); /* ?? */ lmb_reserve(0, __pa(klimit)); - - /* - * Hardcode to GP size. I am not sure where to get this info. DRENG - */ - naca->slb_size = 64; } /* @@ -858,3 +853,12 @@ } } } + +int __init iSeries_src_init(void) +{ + /* clear the progress line */ + ppc_md.progress(" ", 0xffff); + return 0; +} + +late_initcall(iSeries_src_init); diff -urN linux-2.6.7-rc2/arch/ppc64/kernel/pacaData.c linux-2.6.7-rc3/arch/ppc64/kernel/pacaData.c --- linux-2.6.7-rc2/arch/ppc64/kernel/pacaData.c 2004-06-07 12:54:48.695029649 -0700 +++ linux-2.6.7-rc3/arch/ppc64/kernel/pacaData.c 2004-06-07 12:55:01.690567877 -0700 @@ -42,6 +42,7 @@ .xStab_data = { \ .real = (asrr), /* Real pointer to segment table */ \ .virt = (asrv), /* Virt pointer to segment table */ \ + .next_round_robin = 1, \ }, \ .lpQueuePtr = (lpq), /* &xItLpQueue, */ \ /* .xRtas = { \ @@ -54,7 +55,8 @@ .xFPRegsInUse = 1, \ .xDynProcStatus = 2, \ .xDecrVal = 0x00ff0000, \ - .xEndOfQuantum = 0xfffffffffffffffful \ + .xEndOfQuantum = 0xfffffffffffffffful, \ + .xSLBCount = 64, \ }, \ .xRegSav = { \ .xDesc = 0xd397d9e2, /* "LpRS" */ \ diff -urN linux-2.6.7-rc2/arch/ppc64/kernel/process.c linux-2.6.7-rc3/arch/ppc64/kernel/process.c --- linux-2.6.7-rc2/arch/ppc64/kernel/process.c 2004-06-07 12:54:48.696029691 -0700 +++ linux-2.6.7-rc3/arch/ppc64/kernel/process.c 2004-06-07 12:55:01.691567918 -0700 @@ -332,8 +332,8 @@ * entry is the TOC value we need to use. */ set_fs(USER_DS); - __get_user(entry, (unsigned long *)fdptr); - __get_user(toc, (unsigned long *)fdptr+1); + __get_user(entry, (unsigned long __user *)fdptr); + __get_user(toc, (unsigned long __user *)fdptr+1); /* Check whether the e_entry function descriptor entries * need to be relocated before we can use them. @@ -386,7 +386,7 @@ unsigned int val; val = __unpack_fe01(tsk->thread.fpexc_mode); - return put_user(val, (unsigned int *) adr); + return put_user(val, (unsigned int __user *) adr); } int sys_clone(unsigned long clone_flags, unsigned long p2, unsigned long p3, @@ -546,7 +546,7 @@ * We look for the "regshere" marker in the current frame. */ if (validate_sp(sp, p, sizeof(struct pt_regs) + 400) - && _sp[12] == 0x7265677368657265) { + && _sp[12] == 0x7265677368657265ul) { struct pt_regs *regs = (struct pt_regs *) (sp + STACK_FRAME_OVERHEAD); printk("--- Exception: %lx", regs->trap); diff -urN linux-2.6.7-rc2/arch/ppc64/kernel/prom.c linux-2.6.7-rc3/arch/ppc64/kernel/prom.c --- linux-2.6.7-rc2/arch/ppc64/kernel/prom.c 2004-06-07 12:54:48.698029773 -0700 +++ linux-2.6.7-rc3/arch/ppc64/kernel/prom.c 2004-06-07 12:55:01.693568001 -0700 @@ -458,13 +458,6 @@ PROM_BUG(); } - /* - * Hardcode to GP size. I am not sure where to get this info - * in general, as there does not appear to be a slb-size OF - * entry. At least in Condor and earlier. DRENG - */ - _naca->slb_size = 64; - /* Add an eye catcher and the systemcfg layout version number */ strcpy(_systemcfg->eye_catcher, RELOC("SYSTEMCFG:PPC64")); _systemcfg->version.major = SYSTEMCFG_MAJOR; @@ -654,8 +647,6 @@ #endif /* DEBUG_PROM */ } -static char hypertas_funcs[1024]; - static void __init prom_instantiate_rtas(void) { @@ -665,6 +656,7 @@ struct systemcfg *_systemcfg = RELOC(systemcfg); ihandle prom_rtas; u32 getprop_rval; + char hypertas_funcs[4]; #ifdef DEBUG_PROM prom_print(RELOC("prom_instantiate_rtas: start...\n")); @@ -1556,7 +1548,7 @@ if (*mem_end != RELOC(initrd_start)) prom_panic(RELOC("No memory for copy_device_tree")); - prom_print("Huge device_tree: moving initrd\n"); + prom_print(RELOC("Huge device_tree: moving initrd\n")); /* Move by 4M. */ initrd_len = RELOC(initrd_end) - RELOC(initrd_start); *mem_end = RELOC(initrd_start) + 4 * 1024 * 1024; @@ -1590,6 +1582,7 @@ char *prev_name, *namep; unsigned char *valp; unsigned long offset = reloc_offset(); + phandle ibm_phandle; np = make_room(mem_start, mem_end, struct device_node); memset(np, 0, sizeof(*np)); @@ -1652,23 +1645,24 @@ prev_propp = &pp->next; } - /* Add a "linux_phandle" value */ - if (np->node) { - u32 ibm_phandle = 0; - int len; - - /* First see if "ibm,phandle" exists and use its value */ - len = (int) - call_prom(RELOC("getprop"), 4, 1, node, RELOC("ibm,phandle"), - &ibm_phandle, sizeof(ibm_phandle)); - if (len < 0) { - np->linux_phandle = np->node; - } else { - np->linux_phandle = ibm_phandle; - } - } - - *prev_propp = 0; + /* Add a "linux,phandle" property. */ + namep = make_room(mem_start, mem_end, char[16]); + strcpy(namep, RELOC("linux,phandle")); + pp = make_room(mem_start, mem_end, struct property); + pp->name = PTRUNRELOC(namep); + pp->length = sizeof(phandle); + valp = make_room(mem_start, mem_end, phandle); + pp->value = PTRUNRELOC(valp); + *(phandle *)valp = node; + *prev_propp = PTRUNRELOC(pp); + pp->next = NULL; + + /* Set np->linux_phandle to the value of the ibm,phandle property + if it exists, otherwise to the phandle for this node. */ + np->linux_phandle = node; + if ((int)call_prom(RELOC("getprop"), 4, 1, node, RELOC("ibm,phandle"), + &ibm_phandle, sizeof(ibm_phandle)) > 0) + np->linux_phandle = ibm_phandle; /* get the node's full name */ namep = (char *)*mem_start; diff -urN linux-2.6.7-rc2/arch/ppc64/kernel/ptrace.c linux-2.6.7-rc3/arch/ppc64/kernel/ptrace.c --- linux-2.6.7-rc2/arch/ppc64/kernel/ptrace.c 2004-05-09 19:33:13.000000000 -0700 +++ linux-2.6.7-rc3/arch/ppc64/kernel/ptrace.c 2004-06-07 12:55:01.693568001 -0700 @@ -101,7 +101,7 @@ ret = -EIO; if (copied != sizeof(tmp)) break; - ret = put_user(tmp,(unsigned long *) data); + ret = put_user(tmp,(unsigned long __user *) data); break; } @@ -123,7 +123,7 @@ giveup_fpu(child); tmp = ((unsigned long *)child->thread.fpr)[index - PT_FPR0]; } - ret = put_user(tmp,(unsigned long *) data); + ret = put_user(tmp,(unsigned long __user *) data); break; } @@ -213,7 +213,7 @@ case PPC_PTRACE_GETREGS: { /* Get GPRs 0 - 31. */ int i; unsigned long *reg = &((unsigned long *)child->thread.regs)[0]; - unsigned long *tmp = (unsigned long *)addr; + unsigned long __user *tmp = (unsigned long __user *)addr; for (i = 0; i < 32; i++) { ret = put_user(*reg, tmp); @@ -228,7 +228,7 @@ case PPC_PTRACE_SETREGS: { /* Set GPRs 0 - 31. */ int i; unsigned long *reg = &((unsigned long *)child->thread.regs)[0]; - unsigned long *tmp = (unsigned long *)addr; + unsigned long __user *tmp = (unsigned long __user *)addr; for (i = 0; i < 32; i++) { ret = get_user(*reg, tmp); @@ -243,7 +243,7 @@ case PPC_PTRACE_GETFPREGS: { /* Get FPRs 0 - 31. */ int i; unsigned long *reg = &((unsigned long *)child->thread.fpr)[0]; - unsigned long *tmp = (unsigned long *)addr; + unsigned long __user *tmp = (unsigned long __user *)addr; if (child->thread.regs->msr & MSR_FP) giveup_fpu(child); @@ -261,7 +261,7 @@ case PPC_PTRACE_SETFPREGS: { /* Get FPRs 0 - 31. */ int i; unsigned long *reg = &((unsigned long *)child->thread.fpr)[0]; - unsigned long *tmp = (unsigned long *)addr; + unsigned long __user *tmp = (unsigned long __user *)addr; if (child->thread.regs->msr & MSR_FP) giveup_fpu(child); diff -urN linux-2.6.7-rc2/arch/ppc64/kernel/ptrace32.c linux-2.6.7-rc3/arch/ppc64/kernel/ptrace32.c --- linux-2.6.7-rc2/arch/ppc64/kernel/ptrace32.c 2004-05-09 19:32:38.000000000 -0700 +++ linux-2.6.7-rc3/arch/ppc64/kernel/ptrace32.c 2004-06-07 12:55:01.694568043 -0700 @@ -89,7 +89,7 @@ ret = -EIO; if (copied != sizeof(tmp)) break; - ret = put_user(tmp, (u32*)data); + ret = put_user(tmp, (u32 __user *)data); break; } @@ -106,19 +106,19 @@ case PPC_PTRACE_PEEKDATA_3264: { u32 tmp; int copied; - u32* addrOthers; + u32 __user * addrOthers; ret = -EIO; /* Get the addr in the other process that we want to read */ - if (get_user(addrOthers, (u32**)addr) != 0) + if (get_user(addrOthers, (u32 __user * __user *)addr) != 0) break; copied = access_process_vm(child, (u64)addrOthers, &tmp, sizeof(tmp), 0); if (copied != sizeof(tmp)) break; - ret = put_user(tmp, (u32*)data); + ret = put_user(tmp, (u32 __user *)data); break; } @@ -145,7 +145,7 @@ */ tmp = ((unsigned int *)child->thread.fpr)[index - PT_FPR0]; } - ret = put_user((unsigned int)tmp, (u32*)data); + ret = put_user((unsigned int)tmp, (u32 __user *)data); break; } @@ -186,7 +186,7 @@ tmp = get_reg(child, numReg); } reg32bits = ((u32*)&tmp)[part]; - ret = put_user(reg32bits, (u32*)data); + ret = put_user(reg32bits, (u32 __user *)data); break; } @@ -215,11 +215,11 @@ case PPC_PTRACE_POKETEXT_3264: case PPC_PTRACE_POKEDATA_3264: { u32 tmp = data; - u32* addrOthers; + u32 __user * addrOthers; /* Get the addr in the other process that we want to write into */ ret = -EIO; - if (get_user(addrOthers, (u32**)addr) != 0) + if (get_user(addrOthers, (u32 __user * __user *)addr) != 0) break; ret = 0; if (access_process_vm(child, (u64)addrOthers, &tmp, @@ -347,7 +347,7 @@ case PPC_PTRACE_GETREGS: { /* Get GPRs 0 - 31. */ int i; unsigned long *reg = &((unsigned long *)child->thread.regs)[0]; - unsigned int *tmp = (unsigned int *)addr; + unsigned int __user *tmp = (unsigned int __user *)addr; for (i = 0; i < 32; i++) { ret = put_user(*reg, tmp); @@ -362,7 +362,7 @@ case PPC_PTRACE_SETREGS: { /* Set GPRs 0 - 31. */ int i; unsigned long *reg = &((unsigned long *)child->thread.regs)[0]; - unsigned int *tmp = (unsigned int *)addr; + unsigned int __user *tmp = (unsigned int __user *)addr; for (i = 0; i < 32; i++) { ret = get_user(*reg, tmp); @@ -377,7 +377,7 @@ case PPC_PTRACE_GETFPREGS: { /* Get FPRs 0 - 31. */ int i; unsigned long *reg = &((unsigned long *)child->thread.fpr)[0]; - unsigned int *tmp = (unsigned int *)addr; + unsigned int __user *tmp = (unsigned int __user *)addr; if (child->thread.regs->msr & MSR_FP) giveup_fpu(child); @@ -395,7 +395,7 @@ case PPC_PTRACE_SETFPREGS: { /* Get FPRs 0 - 31. */ int i; unsigned long *reg = &((unsigned long *)child->thread.fpr)[0]; - unsigned int *tmp = (unsigned int *)addr; + unsigned int __user *tmp = (unsigned int __user *)addr; if (child->thread.regs->msr & MSR_FP) giveup_fpu(child); diff -urN linux-2.6.7-rc2/arch/ppc64/kernel/signal.c linux-2.6.7-rc3/arch/ppc64/kernel/signal.c --- linux-2.6.7-rc2/arch/ppc64/kernel/signal.c 2004-06-07 12:54:48.701029898 -0700 +++ linux-2.6.7-rc3/arch/ppc64/kernel/signal.c 2004-06-07 12:55:01.698568208 -0700 @@ -154,7 +154,7 @@ /* We always copy to/from vrsave, it's 0 if we don't have or don't * use altivec. */ - err |= __put_user(current->thread.vrsave, (u32 *)&v_regs[33]); + err |= __put_user(current->thread.vrsave, (u32 __user *)&v_regs[33]); #else /* CONFIG_ALTIVEC */ err |= __put_user(0, &sc->v_regs); #endif /* CONFIG_ALTIVEC */ @@ -216,7 +216,7 @@ memset(¤t->thread.vr, 0, 33); /* Always get VRSAVE back */ if (v_regs != 0) - err |= __get_user(current->thread.vrsave, (u32 *)&v_regs[33]); + err |= __get_user(current->thread.vrsave, (u32 __user *)&v_regs[33]); else current->thread.vrsave = 0; #endif /* CONFIG_ALTIVEC */ @@ -311,8 +311,8 @@ if (new_ctx == NULL) return 0; if (verify_area(VERIFY_READ, new_ctx, sizeof(*new_ctx)) - || __get_user(tmp, (u8 *) new_ctx) - || __get_user(tmp, (u8 *) (new_ctx + 1) - 1)) + || __get_user(tmp, (u8 __user *) new_ctx) + || __get_user(tmp, (u8 __user *) (new_ctx + 1) - 1)) return -EFAULT; /* @@ -384,7 +384,7 @@ * descriptor is the entry address of signal and the second * entry is the TOC value we need to use. */ - func_descr_t *funct_desc_ptr; + func_descr_t __user *funct_desc_ptr; struct rt_sigframe __user *frame; unsigned long newsp = 0; long err = 0; @@ -418,11 +418,11 @@ if (err) goto badframe; - funct_desc_ptr = (func_descr_t *) ka->sa.sa_handler; + funct_desc_ptr = (func_descr_t __user *) ka->sa.sa_handler; /* Allocate a dummy caller frame for the signal handler. */ newsp = (unsigned long)frame - __SIGNAL_FRAMESIZE; - err |= put_user(0, (unsigned long *)newsp); + err |= put_user(0, (unsigned long __user *)newsp); /* Set up "regs" so we "return" to the signal handler. */ err |= get_user(regs->nip, &funct_desc_ptr->entry); @@ -432,8 +432,8 @@ regs->gpr[3] = signr; regs->result = 0; if (ka->sa.sa_flags & SA_SIGINFO) { - err |= get_user(regs->gpr[4], (unsigned long *)&frame->pinfo); - err |= get_user(regs->gpr[5], (unsigned long *)&frame->puc); + err |= get_user(regs->gpr[4], (unsigned long __user *)&frame->pinfo); + err |= get_user(regs->gpr[5], (unsigned long __user *)&frame->puc); regs->gpr[6] = (unsigned long) frame; } else { regs->gpr[4] = (unsigned long)&frame->uc.uc_mcontext; diff -urN linux-2.6.7-rc2/arch/ppc64/kernel/signal32.c linux-2.6.7-rc3/arch/ppc64/kernel/signal32.c --- linux-2.6.7-rc2/arch/ppc64/kernel/signal32.c 2004-06-07 12:54:48.702029939 -0700 +++ linux-2.6.7-rc3/arch/ppc64/kernel/signal32.c 2004-06-07 12:55:01.699568250 -0700 @@ -165,7 +165,7 @@ * significant bits of a vector, we "cheat" and stuff VRSAVE in the * most significant bits of that same vector. --BenH */ - if (__put_user(current->thread.vrsave, (u32 *)&frame->mc_vregs[32])) + if (__put_user(current->thread.vrsave, (u32 __user *)&frame->mc_vregs[32])) return 1; #endif /* CONFIG_ALTIVEC */ @@ -232,7 +232,7 @@ memset(¤t->thread.vr, 0, ELF_NVRREG32 * sizeof(vector128)); /* Always get VRSAVE back */ - if (__get_user(current->thread.vrsave, (u32 *)&sr->mc_vregs[32])) + if (__get_user(current->thread.vrsave, (u32 __user *)&sr->mc_vregs[32])) return 1; #endif /* CONFIG_ALTIVEC */ @@ -289,8 +289,8 @@ } } -long sys32_sigaction(int sig, struct old_sigaction32 *act, - struct old_sigaction32 *oact) +long sys32_sigaction(int sig, struct old_sigaction32 __user *act, + struct old_sigaction32 __user *oact) { struct k_sigaction new_ka, old_ka; int ret; @@ -589,9 +589,11 @@ * sigaltatck sys32_sigaltstack */ -int sys32_sigaltstack(u32 newstack, u32 oldstack, int r5, +int sys32_sigaltstack(u32 __new, u32 __old, int r5, int r6, int r7, int r8, struct pt_regs *regs) { + stack_32_t __user * newstack = (stack_32_t __user *)(long) __new; + stack_32_t __user * oldstack = (stack_32_t __user *)(long) __old; stack_t uss, uoss; int ret; mm_segment_t old_fs; @@ -605,12 +607,9 @@ /* Put new stack info in local 64 bit stack struct */ if (newstack && - (get_user((long)uss.ss_sp, - &((stack_32_t *)(long)newstack)->ss_sp) || - __get_user(uss.ss_flags, - &((stack_32_t *)(long)newstack)->ss_flags) || - __get_user(uss.ss_size, - &((stack_32_t *)(long)newstack)->ss_size))) + (get_user((long)uss.ss_sp, &newstack->ss_sp) || + __get_user(uss.ss_flags, &newstack->ss_flags) || + __get_user(uss.ss_size, &newstack->ss_size))) return -EFAULT; old_fs = get_fs(); @@ -623,12 +622,9 @@ set_fs(old_fs); /* Copy the stack information to the user output buffer */ if (!ret && oldstack && - (put_user((long)uoss.ss_sp, - &((stack_32_t *)(long)oldstack)->ss_sp) || - __put_user(uoss.ss_flags, - &((stack_32_t *)(long)oldstack)->ss_flags) || - __put_user(uoss.ss_size, - &((stack_32_t *)(long)oldstack)->ss_size))) + (put_user((long)uoss.ss_sp, &oldstack->ss_sp) || + __put_user(uoss.ss_flags, &oldstack->ss_flags) || + __put_user(uoss.ss_size, &oldstack->ss_size))) return -EFAULT; return ret; } @@ -746,8 +742,8 @@ if (new_ctx == NULL) return 0; if (verify_area(VERIFY_READ, new_ctx, sizeof(*new_ctx)) - || __get_user(tmp, (u8 *) new_ctx) - || __get_user(tmp, (u8 *) (new_ctx + 1) - 1)) + || __get_user(tmp, (u8 __user *) new_ctx) + || __get_user(tmp, (u8 __user *) (new_ctx + 1) - 1)) return -EFAULT; /* diff -urN linux-2.6.7-rc2/arch/ppc64/kernel/smp.c linux-2.6.7-rc3/arch/ppc64/kernel/smp.c --- linux-2.6.7-rc2/arch/ppc64/kernel/smp.c 2004-06-07 12:54:48.703029981 -0700 +++ linux-2.6.7-rc3/arch/ppc64/kernel/smp.c 2004-06-07 12:55:01.700568291 -0700 @@ -912,8 +912,20 @@ * use this value that I found through experimentation. * -- Cort */ - for (c = 5000; c && !cpu_callin_map[cpu]; c--) - udelay(100); + if (system_state == SYSTEM_BOOTING) + for (c = 5000; c && !cpu_callin_map[cpu]; c--) + udelay(100); +#ifdef CONFIG_HOTPLUG_CPU + else + /* + * CPUs can take much longer to come up in the + * hotplug case. Wait five seconds. + */ + for (c = 25; c && !cpu_callin_map[cpu]; c--) { + set_current_state(TASK_UNINTERRUPTIBLE); + schedule_timeout(HZ/5); + } +#endif if (!cpu_callin_map[cpu]) { printk("Processor %u is stuck.\n", cpu); diff -urN linux-2.6.7-rc2/arch/ppc64/kernel/stab.c linux-2.6.7-rc3/arch/ppc64/kernel/stab.c --- linux-2.6.7-rc2/arch/ppc64/kernel/stab.c 2004-05-09 19:33:10.000000000 -0700 +++ linux-2.6.7-rc3/arch/ppc64/kernel/stab.c 2004-06-07 12:55:01.701568332 -0700 @@ -24,6 +24,23 @@ static void make_slbe(unsigned long esid, unsigned long vsid, int large, int kernel_segment); +static inline void slb_add_bolted(void) +{ +#ifndef CONFIG_PPC_ISERIES + unsigned long esid = GET_ESID(VMALLOCBASE); + unsigned long vsid = get_kernel_vsid(VMALLOCBASE); + + WARN_ON(!irqs_disabled()); + + /* + * Bolt in the first vmalloc segment. Since modules end + * up there it gets hit very heavily. + */ + get_paca()->xStab_data.next_round_robin = 1; + make_slbe(esid, vsid, 0, 1); +#endif +} + /* * Build an entry for the base kernel segment and put it into * the segment table or SLB. All other segment table or SLB @@ -48,9 +65,12 @@ asm volatile("isync":::"memory"); asm volatile("slbmte %0,%0"::"r" (0) : "memory"); asm volatile("isync; slbia; isync":::"memory"); + get_paca()->xStab_data.next_round_robin = 0; make_slbe(esid, vsid, seg0_largepages, 1); asm volatile("isync":::"memory"); #endif + + slb_add_bolted(); } else { asm volatile("isync; slbia; isync":::"memory"); make_ste(stab, esid, vsid); @@ -317,6 +337,7 @@ unsigned long word0; slb_dword1 data; } vsid_data; + struct paca_struct *lpaca = get_paca(); /* * We take the next entry, round robin. Previously we tried @@ -330,18 +351,25 @@ * for the kernel stack during the first part of exception exit * which gets invalidated due to a tlbie from another cpu at a * non recoverable point (after setting srr0/1) - Anton + * + * paca Ksave is always valid (even when on the interrupt stack) + * so we use that. */ - castout_entry = get_paca()->xStab_data.next_round_robin; + castout_entry = lpaca->xStab_data.next_round_robin; do { entry = castout_entry; castout_entry++; - if (castout_entry >= naca->slb_size) - castout_entry = 1; + /* + * We bolt in the first kernel segment and the first + * vmalloc segment. + */ + if (castout_entry >= SLB_NUM_ENTRIES) + castout_entry = 2; asm volatile("slbmfee %0,%1" : "=r" (esid_data) : "r" (entry)); } while (esid_data.data.v && - esid_data.data.esid == GET_ESID(__get_SP())); + esid_data.data.esid == GET_ESID(lpaca->xKsave)); - get_paca()->xStab_data.next_round_robin = castout_entry; + lpaca->xStab_data.next_round_robin = castout_entry; /* slbie not needed as the previous mapping is still valid. */ @@ -422,6 +450,9 @@ } esid = GET_ESID(ea); +#ifndef CONFIG_PPC_ISERIES + BUG_ON((esid << SID_SHIFT) == VMALLOCBASE); +#endif __slb_allocate(esid, vsid, context); return 0; @@ -479,18 +510,19 @@ slb_dword0 data; } esid_data; - if (offset <= NR_STAB_CACHE_ENTRIES) { int i; asm volatile("isync" : : : "memory"); for (i = 0; i < offset; i++) { esid_data.word0 = 0; esid_data.data.esid = __get_cpu_var(stab_cache[i]); + BUG_ON(esid_data.data.esid == GET_ESID(VMALLOCBASE)); asm volatile("slbie %0" : : "r" (esid_data)); } asm volatile("isync" : : : "memory"); } else { asm volatile("isync; slbia; isync" : : : "memory"); + slb_add_bolted(); } /* Workaround POWER5 < DD2.1 issue */ diff -urN linux-2.6.7-rc2/arch/ppc64/kernel/sys_ppc32.c linux-2.6.7-rc3/arch/ppc64/kernel/sys_ppc32.c --- linux-2.6.7-rc2/arch/ppc64/kernel/sys_ppc32.c 2004-06-07 12:54:48.708030188 -0700 +++ linux-2.6.7-rc3/arch/ppc64/kernel/sys_ppc32.c 2004-06-07 12:55:01.705568498 -0700 @@ -173,7 +173,7 @@ goto efault; if (__put_user(0, dirent->d_name + namlen)) goto efault; - if (__put_user(d_type, (char *) dirent + reclen - 1)) + if (__put_user(d_type, (char __user *) dirent + reclen - 1)) goto efault; buf->previous = dirent; dirent = (void __user *)dirent + reclen; @@ -1105,7 +1105,7 @@ int error; size_t oldlen; size_t __user *oldlenp = NULL; - unsigned long addr = (((long)&args->__unused[0]) + 7) & ~7; + unsigned long addr = (((unsigned long)&args->__unused[0]) + 7) & ~7; if (copy_from_user(&tmp, args, sizeof(tmp))) return -EFAULT; @@ -1118,7 +1118,7 @@ glibc's __sysctl uses rw memory for the structure anyway. */ oldlenp = (size_t __user *)addr; - if (get_user(oldlen, (u32 *)A(tmp.oldlenp)) || + if (get_user(oldlen, (u32 __user *)A(tmp.oldlenp)) || put_user(oldlen, oldlenp)) return -EFAULT; } diff -urN linux-2.6.7-rc2/arch/ppc64/kernel/time.c linux-2.6.7-rc3/arch/ppc64/kernel/time.c --- linux-2.6.7-rc2/arch/ppc64/kernel/time.c 2004-06-07 12:54:48.709030229 -0700 +++ linux-2.6.7-rc3/arch/ppc64/kernel/time.c 2004-06-07 12:55:01.707568581 -0700 @@ -430,7 +430,7 @@ * fields itself. This way, the fields which are used for * do_settimeofday get updated too. */ -long ppc64_sys32_stime(int* tptr) +long ppc64_sys32_stime(int __user * tptr) { int value; struct timespec myTimeval; @@ -455,7 +455,7 @@ * fields itself. This way, the fields which are used for * do_settimeofday get updated too. */ -long ppc64_sys_stime(long* tptr) +long ppc64_sys_stime(long __user * tptr) { long value; struct timespec myTimeval; diff -urN linux-2.6.7-rc2/arch/ppc64/kernel/viopath.c linux-2.6.7-rc3/arch/ppc64/kernel/viopath.c --- linux-2.6.7-rc2/arch/ppc64/kernel/viopath.c 2004-06-07 12:54:48.711030312 -0700 +++ linux-2.6.7-rc3/arch/ppc64/kernel/viopath.c 2004-06-07 12:55:01.708568622 -0700 @@ -191,7 +191,6 @@ { char *buf; u16 vlanMap; - int vlanIndex; dma_addr_t handle; HvLpEvent_Rc hvrc; DECLARE_MUTEX_LOCKED(Semaphore); @@ -219,17 +218,10 @@ down(&Semaphore); vlanMap = HvLpConfig_getVirtualLanIndexMap(); - vlanIndex = 0; - while (vlanMap != 0){ - if (vlanMap & 0x8000) - vlanIndex++;; - vlanMap = vlanMap << 1; - } buf[PAGE_SIZE-1] = '\0'; seq_printf(m, "%s", buf); - - seq_printf(m, "AVAILABLE_VETH=%d\n", vlanIndex ); + seq_printf(m, "AVAILABLE_VETH=%x\n", vlanMap); seq_printf(m, "SRLNBR=%c%c%c%c%c%c%c\n", e2a(xItExtVpdPanel.mfgID[2]), e2a(xItExtVpdPanel.mfgID[3]), diff -urN linux-2.6.7-rc2/arch/ppc64/mm/fault.c linux-2.6.7-rc3/arch/ppc64/mm/fault.c --- linux-2.6.7-rc2/arch/ppc64/mm/fault.c 2004-05-09 19:33:05.000000000 -0700 +++ linux-2.6.7-rc3/arch/ppc64/mm/fault.c 2004-06-07 12:55:01.710568705 -0700 @@ -45,7 +45,7 @@ { unsigned int inst; - if (get_user(inst, (unsigned int *)regs->nip)) + if (get_user(inst, (unsigned int __user *)regs->nip)) return 0; /* check for 1 in the rA field */ if (((inst >> 16) & 0x1f) != 1) diff -urN linux-2.6.7-rc2/arch/ppc64/xmon/xmon.c linux-2.6.7-rc3/arch/ppc64/xmon/xmon.c --- linux-2.6.7-rc2/arch/ppc64/xmon/xmon.c 2004-06-07 12:54:48.737031389 -0700 +++ linux-2.6.7-rc3/arch/ppc64/xmon/xmon.c 2004-06-07 12:55:01.735569741 -0700 @@ -1402,7 +1402,7 @@ /* Look for "regshere" marker to see if this is an exception frame. */ if (mread(sp + 0x60, &marker, sizeof(unsigned long)) - && marker == 0x7265677368657265) { + && marker == 0x7265677368657265ul) { if (mread(sp + 0x70, ®s, sizeof(regs)) != sizeof(regs)) { printf("Couldn't read registers at %lx\n", @@ -2512,7 +2512,7 @@ printf("SLB contents of cpu %x\n", smp_processor_id()); - for (i = 0; i < naca->slb_size; i++) { + for (i = 0; i < SLB_NUM_ENTRIES; i++) { asm volatile("slbmfee %0,%1" : "=r" (tmp) : "r" (i)); printf("%02d %016lx ", i, tmp); diff -urN linux-2.6.7-rc2/arch/s390/defconfig linux-2.6.7-rc3/arch/s390/defconfig --- linux-2.6.7-rc2/arch/s390/defconfig 2004-06-07 12:54:48.738031430 -0700 +++ linux-2.6.7-rc3/arch/s390/defconfig 2004-06-07 12:55:01.736569782 -0700 @@ -28,6 +28,7 @@ CONFIG_IKCONFIG_PROC=y # CONFIG_EMBEDDED is not set CONFIG_KALLSYMS=y +# CONFIG_KALLSYMS_ALL is not set CONFIG_FUTEX=y CONFIG_EPOLL=y CONFIG_IOSCHED_NOOP=y @@ -112,7 +113,6 @@ # Some SCSI devices (e.g. CD jukebox) support multiple LUNs # CONFIG_SCSI_MULTI_LUN=y -# CONFIG_SCSI_REPORT_LUNS is not set CONFIG_SCSI_CONSTANTS=y CONFIG_SCSI_LOGGING=y @@ -126,6 +126,7 @@ # SCSI low-level drivers # # CONFIG_SCSI_AIC7XXX_OLD is not set +# CONFIG_SCSI_DPT_I2O is not set # CONFIG_SCSI_SATA is not set # CONFIG_SCSI_EATA_PIO is not set # CONFIG_SCSI_DEBUG is not set @@ -310,11 +311,7 @@ # CONFIG_MII is not set # -# Ethernet (1000 Mbit) -# - -# -# Ethernet (10000 Mbit) +# Gigabit Ethernet (1000/10000 Mbit) # # diff -urN linux-2.6.7-rc2/arch/sparc/Makefile linux-2.6.7-rc3/arch/sparc/Makefile --- linux-2.6.7-rc2/arch/sparc/Makefile 2004-05-09 19:32:01.000000000 -0700 +++ linux-2.6.7-rc3/arch/sparc/Makefile 2004-06-07 12:55:01.746570196 -0700 @@ -13,6 +13,7 @@ AS := $(AS) -32 LDFLAGS := -m elf32_sparc +CHECK := $(CHECK) -D__sparc__=1 #CFLAGS := $(CFLAGS) -g -pipe -fcall-used-g5 -fcall-used-g7 CFLAGS := $(CFLAGS) -m32 -pipe -mno-fpu -fcall-used-g5 -fcall-used-g7 diff -urN linux-2.6.7-rc2/arch/sparc/kernel/apc.c linux-2.6.7-rc3/arch/sparc/kernel/apc.c --- linux-2.6.7-rc2/arch/sparc/kernel/apc.c 2004-05-09 19:33:21.000000000 -0700 +++ linux-2.6.7-rc3/arch/sparc/kernel/apc.c 2004-06-07 12:55:01.746570196 -0700 @@ -84,47 +84,44 @@ } static int apc_ioctl(struct inode *inode, struct file *f, - unsigned int cmd, unsigned long arg) + unsigned int cmd, unsigned long __arg) { - __u8 inarg; + __u8 inarg, __user *arg; + arg = (__u8 __user *) __arg; switch (cmd) { - case APCIOCGFANCTL: - if(put_user(apc_readb(APC_FANCTL_REG) & APC_REGMASK, (__u8*) arg)) { + case APCIOCGFANCTL: + if (put_user(apc_readb(APC_FANCTL_REG) & APC_REGMASK, arg)) return -EFAULT; - } - break; - case APCIOCGCPWR: - if(put_user(apc_readb(APC_CPOWER_REG) & APC_REGMASK, (__u8*) arg)) { - return -EFAULT; - } - break; - case APCIOCGBPORT: - if(put_user(apc_readb(APC_BPORT_REG) & APC_BPMASK, (__u8*) arg)) { - return -EFAULT; - } - break; + break; - case APCIOCSFANCTL: - if(get_user(inarg, (__u8*) arg)) { - return -EFAULT; - } - apc_writeb(inarg & APC_REGMASK, APC_FANCTL_REG); - break; - case APCIOCSCPWR: - if(get_user(inarg, (__u8*) arg)) { - return -EFAULT; - } - apc_writeb(inarg & APC_REGMASK, APC_CPOWER_REG); - break; - case APCIOCSBPORT: - if(get_user(inarg, (__u8*) arg)) { - return -EFAULT; - } - apc_writeb(inarg & APC_BPMASK, APC_BPORT_REG); - break; - default: - return -EINVAL; + case APCIOCGCPWR: + if (put_user(apc_readb(APC_CPOWER_REG) & APC_REGMASK, arg)) + return -EFAULT; + break; + + case APCIOCGBPORT: + if (put_user(apc_readb(APC_BPORT_REG) & APC_BPMASK, arg)) + return -EFAULT; + break; + + case APCIOCSFANCTL: + if (get_user(inarg, arg)) + return -EFAULT; + apc_writeb(inarg & APC_REGMASK, APC_FANCTL_REG); + break; + case APCIOCSCPWR: + if (get_user(inarg, arg)) + return -EFAULT; + apc_writeb(inarg & APC_REGMASK, APC_CPOWER_REG); + break; + case APCIOCSBPORT: + if (get_user(inarg, arg)) + return -EFAULT; + apc_writeb(inarg & APC_BPMASK, APC_BPORT_REG); + break; + default: + return -EINVAL; }; return 0; diff -urN linux-2.6.7-rc2/arch/sparc/kernel/ebus.c linux-2.6.7-rc3/arch/sparc/kernel/ebus.c --- linux-2.6.7-rc2/arch/sparc/kernel/ebus.c 2004-05-09 19:33:20.000000000 -0700 +++ linux-2.6.7-rc3/arch/sparc/kernel/ebus.c 2004-06-07 12:55:01.747570238 -0700 @@ -238,7 +238,7 @@ child->bus = dev->bus; fill_ebus_child(node, ®s[0], child); - while ((node = prom_getsibling(node))) { + while ((node = prom_getsibling(node)) != 0) { child->next = (struct linux_ebus_child *) ebus_alloc(sizeof(struct linux_ebus_child)); @@ -330,7 +330,7 @@ dev->bus = ebus; fill_ebus_device(nd, dev); - while ((nd = prom_getsibling(nd))) { + while ((nd = prom_getsibling(nd)) != 0) { dev->next = (struct linux_ebus_device *) ebus_alloc(sizeof(struct linux_ebus_device)); diff -urN linux-2.6.7-rc2/arch/sparc/kernel/irq.c linux-2.6.7-rc3/arch/sparc/kernel/irq.c --- linux-2.6.7-rc2/arch/sparc/kernel/irq.c 2004-05-09 19:31:59.000000000 -0700 +++ linux-2.6.7-rc3/arch/sparc/kernel/irq.c 2004-06-07 12:55:01.747570238 -0700 @@ -216,7 +216,8 @@ if (sparc_cpu_model == sun4d) { extern void sun4d_free_irq(unsigned int, void *); - return sun4d_free_irq(irq, dev_id); + sun4d_free_irq(irq, dev_id); + return; } cpu_irq = irq & (NR_IRQS - 1); if (cpu_irq > 14) { /* 14 irq levels on the sparc */ diff -urN linux-2.6.7-rc2/arch/sparc/kernel/muldiv.c linux-2.6.7-rc3/arch/sparc/kernel/muldiv.c --- linux-2.6.7-rc2/arch/sparc/kernel/muldiv.c 2004-05-09 19:32:54.000000000 -0700 +++ linux-2.6.7-rc3/arch/sparc/kernel/muldiv.c 2004-06-07 12:55:01.747570238 -0700 @@ -54,25 +54,25 @@ } } -#define fetch_reg(reg, regs) ({ \ - struct reg_window *win; \ - register unsigned long ret; \ - \ - if (!(reg)) ret = 0; \ - else if((reg) < 16) { \ - ret = regs->u_regs[(reg)]; \ - } else { \ - /* Ho hum, the slightly complicated case. */ \ - win = (struct reg_window *)regs->u_regs[UREG_FP]; \ - if (get_user (ret, &win->locals[(reg) - 16])) return -1; \ - } \ - ret; \ +#define fetch_reg(reg, regs) ({ \ + struct reg_window __user *win; \ + register unsigned long ret; \ + \ + if (!(reg)) ret = 0; \ + else if ((reg) < 16) { \ + ret = regs->u_regs[(reg)]; \ + } else { \ + /* Ho hum, the slightly complicated case. */ \ + win = (struct reg_window __user *)regs->u_regs[UREG_FP];\ + if (get_user (ret, &win->locals[(reg) - 16])) return -1;\ + } \ + ret; \ }) static inline int store_reg(unsigned int result, unsigned int reg, struct pt_regs *regs) { - struct reg_window *win; + struct reg_window __user *win; if (!reg) return 0; @@ -81,7 +81,7 @@ return 0; } else { /* need to use put_user() in this case: */ - win = (struct reg_window *)regs->u_regs[UREG_FP]; + win = (struct reg_window __user *) regs->u_regs[UREG_FP]; return (put_user(result, &win->locals[reg - 16])); } } @@ -89,23 +89,30 @@ extern void handle_hw_divzero (struct pt_regs *regs, unsigned long pc, unsigned long npc, unsigned long psr); -/* Should return 0 if mul/div emulation succeeded and SIGILL should not be issued */ +/* Should return 0 if mul/div emulation succeeded and SIGILL should + * not be issued. + */ int do_user_muldiv(struct pt_regs *regs, unsigned long pc) { unsigned int insn; int inst; unsigned int rs1, rs2, rdv; - if (!pc) return -1; /* This happens to often, I think */ - if (get_user (insn, (unsigned int *)pc)) return -1; - if ((insn & 0xc1400000) != 0x80400000) return -1; + if (!pc) + return -1; /* This happens to often, I think */ + if (get_user (insn, (unsigned int __user *)pc)) + return -1; + if ((insn & 0xc1400000) != 0x80400000) + return -1; inst = ((insn >> 19) & 0xf); - if ((inst & 0xe) != 10 && (inst & 0xe) != 14) return -1; + if ((inst & 0xe) != 10 && (inst & 0xe) != 14) + return -1; + /* Now we know we have to do something with umul, smul, udiv or sdiv */ rs1 = (insn >> 14) & 0x1f; rs2 = insn & 0x1f; rdv = (insn >> 25) & 0x1f; - if(has_imm13(insn)) { + if (has_imm13(insn)) { maybe_flush_windows(rs1, 0, rdv); rs2 = sign_extend_imm13(insn); } else { diff -urN linux-2.6.7-rc2/arch/sparc/kernel/process.c linux-2.6.7-rc3/arch/sparc/kernel/process.c --- linux-2.6.7-rc2/arch/sparc/kernel/process.c 2004-06-07 12:54:48.748031844 -0700 +++ linux-2.6.7-rc3/arch/sparc/kernel/process.c 2004-06-07 12:55:01.748570279 -0700 @@ -400,23 +400,30 @@ } } -static __inline__ struct sparc_stackf * -clone_stackframe(struct sparc_stackf *dst, struct sparc_stackf *src) +static __inline__ struct sparc_stackf __user * +clone_stackframe(struct sparc_stackf __user *dst, + struct sparc_stackf __user *src) { - unsigned long size; - struct sparc_stackf *sp; - - size = ((unsigned long)src->fp) - ((unsigned long)src); - sp = (struct sparc_stackf *)(((unsigned long)dst) - size); + unsigned long size, fp; + struct sparc_stackf *tmp; + struct sparc_stackf __user *sp; + + if (get_user(tmp, &src->fp)) + return NULL; + + fp = (unsigned long) tmp; + size = (fp - ((unsigned long) src)); + fp = (unsigned long) dst; + sp = (struct sparc_stackf __user *)(fp - size); /* do_fork() grabs the parent semaphore, we must release it * temporarily so we can build the child clone stack frame * without deadlocking. */ - if (copy_to_user(sp, src, size)) - sp = (struct sparc_stackf *) 0; - else if (put_user(dst, &sp->fp)) - sp = (struct sparc_stackf *) 0; + if (__copy_user(sp, src, size)) + sp = NULL; + else if (put_user(fp, &sp->fp)) + sp = NULL; return sp; } @@ -435,8 +442,8 @@ return do_fork(clone_flags, stack_start, regs, stack_size, - (int *) parent_tid_ptr, - (int *) child_tid_ptr); + (int __user *) parent_tid_ptr, + (int __user *) child_tid_ptr); } /* Copy a Sparc thread. The fork() return value conventions @@ -519,15 +526,17 @@ p->thread.current_ds = USER_DS; if (sp != regs->u_regs[UREG_FP]) { - struct sparc_stackf *childstack; - struct sparc_stackf *parentstack; + struct sparc_stackf __user *childstack; + struct sparc_stackf __user *parentstack; /* * This is a clone() call with supplied user stack. * Set some valid stack frames to give to the child. */ - childstack = (struct sparc_stackf *) (sp & ~0x7UL); - parentstack = (struct sparc_stackf *) regs->u_regs[UREG_FP]; + childstack = (struct sparc_stackf __user *) + (sp & ~0x7UL); + parentstack = (struct sparc_stackf __user *) + regs->u_regs[UREG_FP]; #if 0 printk("clone: parent stack:\n"); @@ -654,12 +663,14 @@ if(regs->u_regs[UREG_G1] == 0) base = 1; - filename = getname((char *)regs->u_regs[base + UREG_I0]); + filename = getname((char __user *)regs->u_regs[base + UREG_I0]); error = PTR_ERR(filename); if(IS_ERR(filename)) goto out; - error = do_execve(filename, (char **) regs->u_regs[base + UREG_I1], - (char **) regs->u_regs[base + UREG_I2], regs); + error = do_execve(filename, + (char __user * __user *)regs->u_regs[base + UREG_I1], + (char __user * __user *)regs->u_regs[base + UREG_I2], + regs); putname(filename); if (error == 0) current->ptrace &= ~PT_DTRACE; @@ -679,25 +690,25 @@ { long retval; - __asm__ __volatile("mov %4, %%g2\n\t" /* Set aside fn ptr... */ - "mov %5, %%g3\n\t" /* and arg. */ - "mov %1, %%g1\n\t" - "mov %2, %%o0\n\t" /* Clone flags. */ - "mov 0, %%o1\n\t" /* usp arg == 0 */ - "t 0x10\n\t" /* Linux/Sparc clone(). */ - "cmp %%o1, 0\n\t" - "be 1f\n\t" /* The parent, just return. */ - " nop\n\t" /* Delay slot. */ - "jmpl %%g2, %%o7\n\t" /* Call the function. */ - " mov %%g3, %%o0\n\t" /* Get back the arg in delay. */ - "mov %3, %%g1\n\t" - "t 0x10\n\t" /* Linux/Sparc exit(). */ - /* Notreached by child. */ - "1: mov %%o0, %0\n\t" : - "=r" (retval) : - "i" (__NR_clone), "r" (flags | CLONE_VM | CLONE_UNTRACED), - "i" (__NR_exit), "r" (fn), "r" (arg) : - "g1", "g2", "g3", "o0", "o1", "memory", "cc"); + __asm__ __volatile__("mov %4, %%g2\n\t" /* Set aside fn ptr... */ + "mov %5, %%g3\n\t" /* and arg. */ + "mov %1, %%g1\n\t" + "mov %2, %%o0\n\t" /* Clone flags. */ + "mov 0, %%o1\n\t" /* usp arg == 0 */ + "t 0x10\n\t" /* Linux/Sparc clone(). */ + "cmp %%o1, 0\n\t" + "be 1f\n\t" /* The parent, just return. */ + " nop\n\t" /* Delay slot. */ + "jmpl %%g2, %%o7\n\t" /* Call the function. */ + " mov %%g3, %%o0\n\t" /* Get back the arg in delay. */ + "mov %3, %%g1\n\t" + "t 0x10\n\t" /* Linux/Sparc exit(). */ + /* Notreached by child. */ + "1: mov %%o0, %0\n\t" : + "=r" (retval) : + "i" (__NR_clone), "r" (flags | CLONE_VM | CLONE_UNTRACED), + "i" (__NR_exit), "r" (fn), "r" (arg) : + "g1", "g2", "g3", "o0", "o1", "memory", "cc"); return retval; } diff -urN linux-2.6.7-rc2/arch/sparc/kernel/ptrace.c linux-2.6.7-rc3/arch/sparc/kernel/ptrace.c --- linux-2.6.7-rc2/arch/sparc/kernel/ptrace.c 2004-05-09 19:33:21.000000000 -0700 +++ linux-2.6.7-rc3/arch/sparc/kernel/ptrace.c 2004-06-07 12:55:01.749570321 -0700 @@ -50,8 +50,10 @@ static void pt_succ_return_linux(struct pt_regs *regs, unsigned long value, long *addr) { - if(put_user(value, addr)) - return pt_error_return(regs, EFAULT); + if (put_user(value, (long __user *) addr)) { + pt_error_return(regs, EFAULT); + return; + } regs->u_regs[UREG_I0] = 0; regs->psr &= ~PSR_C; regs->pc = regs->npc; @@ -368,7 +370,7 @@ } case PTRACE_GETREGS: { - struct pt_regs *pregs = (struct pt_regs *) addr; + struct pt_regs __user *pregs = (struct pt_regs __user *) addr; struct pt_regs *cregs = child->thread.kregs; int rval; @@ -391,7 +393,7 @@ } case PTRACE_SETREGS: { - struct pt_regs *pregs = (struct pt_regs *) addr; + struct pt_regs __user *pregs = (struct pt_regs __user *) addr; struct pt_regs *cregs = child->thread.kregs; unsigned long psr, pc, npc, y; int i; @@ -433,7 +435,8 @@ unsigned long *insnaddr; unsigned long insn; } fpq[16]; - } *fps = (struct fps *) addr; + }; + struct fps __user *fps = (struct fps __user *) addr; int i; i = verify_area(VERIFY_WRITE, fps, sizeof(struct fps)); @@ -467,7 +470,8 @@ unsigned long *insnaddr; unsigned long insn; } fpq[16]; - } *fps = (struct fps *) addr; + }; + struct fps __user *fps = (struct fps __user *) addr; int i; i = verify_area(VERIFY_READ, fps, sizeof(struct fps)); @@ -489,7 +493,8 @@ case PTRACE_READTEXT: case PTRACE_READDATA: { - int res = ptrace_readdata(child, addr, (void *) addr2, data); + int res = ptrace_readdata(child, addr, + (void __user *) addr2, data); if (res == data) { pt_succ_return(regs, 0); @@ -504,7 +509,8 @@ case PTRACE_WRITETEXT: case PTRACE_WRITEDATA: { - int res = ptrace_writedata(child, (void *) addr2, addr, data); + int res = ptrace_writedata(child, (void __user *) addr2, + addr, data); if (res == data) { pt_succ_return(regs, 0); diff -urN linux-2.6.7-rc2/arch/sparc/kernel/signal.c linux-2.6.7-rc3/arch/sparc/kernel/signal.c --- linux-2.6.7-rc2/arch/sparc/kernel/signal.c 2004-05-09 19:32:54.000000000 -0700 +++ linux-2.6.7-rc3/arch/sparc/kernel/signal.c 2004-06-07 12:55:01.750570362 -0700 @@ -234,7 +234,7 @@ if (verify_area(VERIFY_READ, sf, sizeof(*sf))) goto segv_and_exit; - if (((uint) sf) & 3) + if (((unsigned long) sf) & 3) goto segv_and_exit; err = __get_user(pc, &sf->info.si_regs.pc); @@ -289,8 +289,10 @@ synchronize_user_stack(); - if (current->thread.new_signal) - return do_new_sigreturn(regs); + if (current->thread.new_signal) { + do_new_sigreturn(regs); + return; + } scptr = (struct sigcontext __user *) regs->u_regs[UREG_I0]; @@ -347,6 +349,7 @@ struct rt_signal_frame __user *sf; unsigned int psr, pc, npc; __siginfo_fpu_t __user *fpu_save; + mm_segment_t old_fs; sigset_t set; stack_t st; int err; @@ -386,7 +389,10 @@ /* It is more difficult to avoid calling this function than to * call it and ignore errors. */ - do_sigaltstack(&st, NULL, (unsigned long)sf); + old_fs = get_fs(); + set_fs(KERNEL_DS); + do_sigaltstack((const stack_t __user *) &st, NULL, (unsigned long)sf); + set_fs(old_fs); sigdelsetmask(&set, ~_BLOCKABLE); spin_lock_irq(¤t->sighand->siglock); @@ -849,7 +855,7 @@ /* Arguments passed to signal handler */ if (regs->u_regs[14]){ - struct reg_window *rw = (struct reg_window __user *) + struct reg_window __user *rw = (struct reg_window __user *) regs->u_regs[14]; err |= __put_user(signr, &rw->ins[0]); @@ -860,8 +866,8 @@ goto sigsegv; regs->u_regs[UREG_I0] = signr; - regs->u_regs[UREG_I1] = (uint) si; - regs->u_regs[UREG_I2] = (uint) uc; + regs->u_regs[UREG_I1] = (unsigned long) si; + regs->u_regs[UREG_I2] = (unsigned long) uc; } return; @@ -932,6 +938,7 @@ { svr4_gregset_t __user *gr; unsigned long pc, npc, psr; + mm_segment_t old_fs; sigset_t set; svr4_sigset_t setv; int err; @@ -945,7 +952,7 @@ if (current_thread_info()->w_saved) goto sigsegv_and_return; - if (((uint) c) & 3) + if (((unsigned long) c) & 3) goto sigsegv_and_return; if (!__access_ok((unsigned long)c, sizeof(*c))) @@ -977,7 +984,11 @@ /* It is more difficult to avoid calling this function than to call it and ignore errors. */ - do_sigaltstack(&st, NULL, regs->u_regs[UREG_I6]); + old_fs = get_fs(); + set_fs(KERNEL_DS); + do_sigaltstack((const stack_t __user *) &st, NULL, + regs->u_regs[UREG_I6]); + set_fs(old_fs); set.sig[0] = setv.sigbits[0]; set.sig[1] = setv.sigbits[1]; diff -urN linux-2.6.7-rc2/arch/sparc/kernel/sunos_ioctl.c linux-2.6.7-rc3/arch/sparc/kernel/sunos_ioctl.c --- linux-2.6.7-rc2/arch/sparc/kernel/sunos_ioctl.c 2004-05-09 19:33:19.000000000 -0700 +++ linux-2.6.7-rc3/arch/sparc/kernel/sunos_ioctl.c 2004-06-07 12:55:01.750570362 -0700 @@ -41,18 +41,19 @@ goto out; /* First handle an easy compat. case for tty ldisc. */ - if(cmd == TIOCSETD) { - int *p, ntty = N_TTY, tmp; + if (cmd == TIOCSETD) { + int __user *p; + int ntty = N_TTY, tmp; mm_segment_t oldfs; - p = (int *) arg; + p = (int __user *) arg; ret = -EFAULT; - if(get_user(tmp, p)) + if (get_user(tmp, p)) goto out; - if(tmp == 2) { + if (tmp == 2) { oldfs = get_fs(); set_fs(KERNEL_DS); - ret = sys_ioctl(fd, cmd, (int) &ntty); + ret = sys_ioctl(fd, cmd, (unsigned long) &ntty); set_fs(oldfs); ret = (ret == -EINVAL ? -EOPNOTSUPP : ret); goto out; @@ -60,7 +61,7 @@ } /* Binary compatibility is good American knowhow fuckin' up. */ - if(cmd == TIOCNOTTY) { + if (cmd == TIOCNOTTY) { ret = sys_setsid(); goto out; } @@ -176,39 +177,39 @@ goto out; /* Non posix grp */ case _IOW('t', 118, int): { - int oldval, newval, *ptr; + int oldval, newval, __user *ptr; cmd = TIOCSPGRP; - ptr = (int *) arg; + ptr = (int __user *) arg; ret = -EFAULT; - if(get_user(oldval, ptr)) + if (get_user(oldval, ptr)) goto out; ret = sys_ioctl(fd, cmd, arg); __get_user(newval, ptr); - if(newval == -1) { + if (newval == -1) { __put_user(oldval, ptr); ret = -EIO; } - if(ret == -ENOTTY) + if (ret == -ENOTTY) ret = -EIO; goto out; } case _IOR('t', 119, int): { - int oldval, newval, *ptr; + int oldval, newval, __user *ptr; cmd = TIOCGPGRP; - ptr = (int *) arg; + ptr = (int __user *) arg; ret = -EFAULT; - if(get_user(oldval, ptr)) + if (get_user(oldval, ptr)) goto out; ret = sys_ioctl(fd, cmd, arg); __get_user(newval, ptr); - if(newval == -1) { + if (newval == -1) { __put_user(oldval, ptr); ret = -EIO; } - if(ret == -ENOTTY) + if (ret == -ENOTTY) ret = -EIO; goto out; } diff -urN linux-2.6.7-rc2/arch/sparc/kernel/sys_sparc.c linux-2.6.7-rc3/arch/sparc/kernel/sys_sparc.c --- linux-2.6.7-rc2/arch/sparc/kernel/sys_sparc.c 2004-05-09 19:32:28.000000000 -0700 +++ linux-2.6.7-rc3/arch/sparc/kernel/sys_sparc.c 2004-06-07 12:55:01.751570403 -0700 @@ -136,7 +136,8 @@ if (!ptr) goto out; err = -EFAULT; - if(get_user(fourth.__pad, (void __user **)ptr)) + if (get_user(fourth.__pad, + (void __user * __user *)ptr)) goto out; err = sys_semctl (first, second, third, fourth); goto out; @@ -165,7 +166,9 @@ goto out; } case 1: default: - err = sys_msgrcv (first, (struct msgbuf *) ptr, second, fifth, third); + err = sys_msgrcv (first, + (struct msgbuf __user *) ptr, + second, fifth, third); goto out; } case MSGGET: @@ -194,7 +197,8 @@ goto out; } case 1: /* iBCS2 emulator entry point */ - err = do_shmat (first, (char __user *) ptr, second, (ulong __user *) third); + err = do_shmat (first, (char __user *) ptr, + second, (ulong *) third); goto out; } case SHMDT: diff -urN linux-2.6.7-rc2/arch/sparc/kernel/sys_sunos.c linux-2.6.7-rc3/arch/sparc/kernel/sys_sunos.c --- linux-2.6.7-rc2/arch/sparc/kernel/sys_sunos.c 2004-05-09 19:32:28.000000000 -0700 +++ linux-2.6.7-rc3/arch/sparc/kernel/sys_sunos.c 2004-06-07 12:55:01.753570486 -0700 @@ -71,7 +71,7 @@ struct file * file = NULL; unsigned long retval, ret_type; - if(flags & MAP_NORESERVE) { + if (flags & MAP_NORESERVE) { static int cnt; if (cnt++ < 10) printk("%s: unimplemented SunOS MAP_NORESERVE mmap() flag\n", @@ -79,7 +79,7 @@ flags &= ~MAP_NORESERVE; } retval = -EBADF; - if(!(flags & MAP_ANONYMOUS)) { + if (!(flags & MAP_ANONYMOUS)) { if (fd >= SUNOS_NR_OPEN) goto out; file = fget(fd); @@ -93,8 +93,8 @@ * SunOS is so stupid some times... hmph! */ if (file) { - if(imajor(file->f_dentry->d_inode) == MEM_MAJOR && - iminor(file->f_dentry->d_inode) == 5) { + if (imajor(file->f_dentry->d_inode) == MEM_MAJOR && + iminor(file->f_dentry->d_inode) == 5) { flags |= MAP_ANONYMOUS; fput(file); file = 0; @@ -103,7 +103,7 @@ ret_type = flags & _MAP_NEW; flags &= ~_MAP_NEW; - if(!(flags & MAP_FIXED)) + if (!(flags & MAP_FIXED)) addr = 0; else { if (ARCH_SUN4C_SUN4 && @@ -122,7 +122,7 @@ down_write(¤t->mm->mmap_sem); retval = do_mmap(file, addr, len, prot, flags, off); up_write(¤t->mm->mmap_sem); - if(!ret_type) + if (!ret_type) retval = ((retval < PAGE_OFFSET) ? 0 : retval); out_putf: @@ -149,8 +149,8 @@ unsigned long newbrk, oldbrk; down_write(¤t->mm->mmap_sem); - if(ARCH_SUN4C_SUN4) { - if(brk >= 0x20000000 && brk < 0xe0000000) { + if (ARCH_SUN4C_SUN4) { + if (brk >= 0x20000000 && brk < 0xe0000000) { goto out; } } @@ -223,7 +223,7 @@ lock_kernel(); oldbrk = current->mm->brk; error = sunos_brk(((int) current->mm->brk) + increment); - if(!error) + if (!error) error = oldbrk; unlock_kernel(); return error; @@ -314,20 +314,20 @@ }; struct sunos_dirent_callback { - struct sunos_dirent *curr; - struct sunos_dirent *previous; + struct sunos_dirent __user *curr; + struct sunos_dirent __user *previous; int count; int error; }; -#define NAME_OFFSET(de) ((int) ((de)->d_name - (char *) (de))) +#define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de))) #define ROUND_UP(x) (((x)+sizeof(long)-1) & ~(sizeof(long)-1)) static int sunos_filldir(void * __buf, const char * name, int namlen, loff_t offset, ino_t ino, unsigned int d_type) { - struct sunos_dirent * dirent; - struct sunos_dirent_callback * buf = (struct sunos_dirent_callback *) __buf; + struct sunos_dirent __user *dirent; + struct sunos_dirent_callback * buf = __buf; int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1); buf->error = -EINVAL; /* only used if we fail.. */ @@ -343,16 +343,16 @@ put_user(reclen, &dirent->d_reclen); copy_to_user(dirent->d_name, name, namlen); put_user(0, dirent->d_name + namlen); - dirent = (void *)dirent + reclen; + dirent = (void __user *) dirent + reclen; buf->curr = dirent; buf->count -= reclen; return 0; } -asmlinkage int sunos_getdents(unsigned int fd, void * dirent, int cnt) +asmlinkage int sunos_getdents(unsigned int fd, void __user *dirent, int cnt) { struct file * file; - struct sunos_dirent * lastdirent; + struct sunos_dirent __user *lastdirent; struct sunos_dirent_callback buf; int error = -EBADF; @@ -367,7 +367,7 @@ if (cnt < (sizeof(struct sunos_dirent) + 255)) goto out_putf; - buf.curr = (struct sunos_dirent *) dirent; + buf.curr = (struct sunos_dirent __user *) dirent; buf.previous = NULL; buf.count = cnt; buf.error = 0; @@ -398,8 +398,8 @@ }; struct sunos_direntry_callback { - struct sunos_direntry *curr; - struct sunos_direntry *previous; + struct sunos_direntry __user *curr; + struct sunos_direntry __user *previous; int count; int error; }; @@ -407,8 +407,8 @@ static int sunos_filldirentry(void * __buf, const char * name, int namlen, loff_t offset, ino_t ino, unsigned int d_type) { - struct sunos_direntry * dirent; - struct sunos_direntry_callback * buf = (struct sunos_direntry_callback *) __buf; + struct sunos_direntry __user *dirent; + struct sunos_direntry_callback *buf = __buf; int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1); buf->error = -EINVAL; /* only used if we fail.. */ @@ -422,16 +422,17 @@ put_user(reclen, &dirent->d_reclen); copy_to_user(dirent->d_name, name, namlen); put_user(0, dirent->d_name + namlen); - dirent = (void *)dirent + reclen; + dirent = (void __user *) dirent + reclen; buf->curr = dirent; buf->count -= reclen; return 0; } -asmlinkage int sunos_getdirentries(unsigned int fd, void * dirent, int cnt, unsigned int *basep) +asmlinkage int sunos_getdirentries(unsigned int fd, void __user *dirent, + int cnt, unsigned int __user *basep) { struct file * file; - struct sunos_direntry * lastdirent; + struct sunos_direntry __user *lastdirent; struct sunos_direntry_callback buf; int error = -EBADF; @@ -443,10 +444,10 @@ goto out; error = -EINVAL; - if(cnt < (sizeof(struct sunos_direntry) + 255)) + if (cnt < (sizeof(struct sunos_direntry) + 255)) goto out_putf; - buf.curr = (struct sunos_direntry *) dirent; + buf.curr = (struct sunos_direntry __user *) dirent; buf.previous = NULL; buf.count = cnt; buf.error = 0; @@ -477,7 +478,7 @@ char mach[9]; }; -asmlinkage int sunos_uname(struct sunos_utsname *name) +asmlinkage int sunos_uname(struct sunos_utsname __user *name) { int ret; down_read(&uts_sem); @@ -556,7 +557,7 @@ return ret; } -asmlinkage int sunos_pathconf(char *path, int name) +asmlinkage int sunos_pathconf(char __user *path, int name) { int ret; @@ -566,7 +567,8 @@ /* SunOS mount system call emulation */ -asmlinkage int sunos_select(int width, fd_set *inp, fd_set *outp, fd_set *exp, struct timeval *tvp) +asmlinkage int sunos_select(int width, fd_set __user *inp, fd_set __user *outp, + fd_set __user *exp, struct timeval __user *tvp) { int ret; @@ -604,19 +606,19 @@ }; struct sunos_nfs_mount_args { - struct sockaddr_in *addr; /* file server address */ - struct nfs_fh *fh; /* File handle to be mounted */ + struct sockaddr_in __user *addr; /* file server address */ + struct nfs_fh __user *fh; /* File handle to be mounted */ int flags; /* flags */ int wsize; /* write size in bytes */ int rsize; /* read size in bytes */ int timeo; /* initial timeout in .1 secs */ int retrans; /* times to retry send */ - char *hostname; /* server's hostname */ + char __user *hostname; /* server's hostname */ int acregmin; /* attr cache file min secs */ int acregmax; /* attr cache file max secs */ int acdirmin; /* attr cache dir min secs */ int acdirmax; /* attr cache dir max secs */ - char *netname; /* server's netname */ + char __user *netname; /* server's netname */ }; @@ -680,7 +682,7 @@ return def_value; } -static int sunos_nfs_mount(char *dir_name, int linux_flags, void *data) +static int sunos_nfs_mount(char *dir_name, int linux_flags, void __user *data) { int server_fd, err; char *the_name, *mount_page; @@ -729,7 +731,7 @@ linux_nfs_mount.acdirmax = sunos_mount.acdirmax; the_name = getname(sunos_mount.hostname); - if(IS_ERR(the_name)) + if (IS_ERR(the_name)) return PTR_ERR(the_name); strlcpy(linux_nfs_mount.hostname, the_name, @@ -749,7 +751,7 @@ } asmlinkage int -sunos_mount(char *type, char *dir, int flags, void *data) +sunos_mount(char __user *type, char __user *dir, int flags, void __user *data) { int linux_flags = 0; int ret = -EINVAL; @@ -768,11 +770,11 @@ if (flags & (SMNT_GRPID|SMNT_NOSUB|SMNT_MULTI|SMNT_SYS5)) goto out; - if(flags & SMNT_REMOUNT) + if (flags & SMNT_REMOUNT) linux_flags |= MS_REMOUNT; - if(flags & SMNT_RDONLY) + if (flags & SMNT_RDONLY) linux_flags |= MS_RDONLY; - if(flags & SMNT_NOSUID) + if (flags & SMNT_NOSUID) linux_flags |= MS_NOSUID; dir_page = getname(dir); @@ -785,20 +787,20 @@ if (IS_ERR(type_page)) goto out1; - if(strcmp(type_page, "ext2") == 0) { + if (strcmp(type_page, "ext2") == 0) { dev_fname = getname(data); - } else if(strcmp(type_page, "iso9660") == 0) { + } else if (strcmp(type_page, "iso9660") == 0) { dev_fname = getname(data); - } else if(strcmp(type_page, "minix") == 0) { + } else if (strcmp(type_page, "minix") == 0) { dev_fname = getname(data); - } else if(strcmp(type_page, "nfs") == 0) { + } else if (strcmp(type_page, "nfs") == 0) { ret = sunos_nfs_mount (dir_page, flags, data); goto out2; - } else if(strcmp(type_page, "ufs") == 0) { + } else if (strcmp(type_page, "ufs") == 0) { printk("Warning: UFS filesystem mounts unsupported.\n"); ret = -ENODEV; goto out2; - } else if(strcmp(type_page, "proc")) { + } else if (strcmp(type_page, "proc")) { ret = -ENODEV; goto out2; } @@ -823,8 +825,8 @@ int ret; /* So stupid... */ - if((!pid || pid == current->pid) && - !pgid) { + if ((!pid || pid == current->pid) && + !pgid) { sys_setsid(); ret = 0; } else { @@ -834,7 +836,8 @@ } /* So stupid... */ -asmlinkage int sunos_wait4(pid_t pid, unsigned int *stat_addr, int options, struct rusage *ru) +asmlinkage int sunos_wait4(pid_t pid, unsigned int __user *stat_addr, + int options, struct rusage __user*ru) { int ret; @@ -861,7 +864,7 @@ return -1; } -extern asmlinkage unsigned long sunos_gethostid(void) +asmlinkage unsigned long sunos_gethostid(void) { unsigned long ret; @@ -882,7 +885,7 @@ #define _SC_SAVED_IDS 7 #define _SC_VERSION 8 -extern asmlinkage long sunos_sysconf (int name) +asmlinkage long sunos_sysconf (int name) { long ret; @@ -947,7 +950,8 @@ arg3=SETALL; break; } /* sys_semctl(): */ - arg4.__pad=ptr; /* value to modify semaphore to */ + /* value to modify semaphore to */ + arg4.__pad = (void __user *) ptr; ret = sys_semctl((int)arg1, (int)arg2, (int)arg3, arg4 ); break; case 1: @@ -956,7 +960,7 @@ break; case 2: /* sys_semop(): */ - ret = sys_semop((int)arg1, (struct sembuf *)arg2, (unsigned)arg3); + ret = sys_semop((int)arg1, (struct sembuf __user *)arg2, (unsigned)arg3); break; default: ret = -EINVAL; @@ -978,18 +982,18 @@ break; case 1: rval = sys_msgctl((int)arg1, (int)arg2, - (struct msqid_ds *)arg3); + (struct msqid_ds __user *)arg3); break; case 2: lock_kernel(); sp = (struct sparc_stackf *)current->thread.kregs->u_regs[UREG_FP]; arg5 = sp->xxargs[0]; unlock_kernel(); - rval = sys_msgrcv((int)arg1, (struct msgbuf *)arg2, + rval = sys_msgrcv((int)arg1, (struct msgbuf __user *)arg2, (size_t)arg3, (long)arg4, (int)arg5); break; case 3: - rval = sys_msgsnd((int)arg1, (struct msgbuf *)arg2, + rval = sys_msgsnd((int)arg1, (struct msgbuf __user *)arg2, (size_t)arg3, (int)arg4); break; default: @@ -1008,17 +1012,17 @@ switch(op) { case 0: /* do_shmat(): attach a shared memory area */ - rval = do_shmat((int)arg1,(char *)arg2,(int)arg3,&raddr); - if(!rval) + rval = do_shmat((int)arg1,(char __user *)arg2,(int)arg3,&raddr); + if (!rval) rval = (int) raddr; break; case 1: /* sys_shmctl(): modify shared memory area attr. */ - rval = sys_shmctl((int)arg1,(int)arg2,(struct shmid_ds *)arg3); + rval = sys_shmctl((int)arg1,(int)arg2,(struct shmid_ds __user *)arg3); break; case 2: /* sys_shmdt(): detach a shared memory area */ - rval = sys_shmdt((char *)arg1); + rval = sys_shmdt((char __user *)arg1); break; case 3: /* sys_shmget(): get a shared memory area */ @@ -1051,7 +1055,7 @@ return ret; } -asmlinkage int sunos_read(unsigned int fd,char *buf,int count) +asmlinkage int sunos_read(unsigned int fd, char __user *buf, int count) { int ret; @@ -1059,7 +1063,8 @@ return ret; } -asmlinkage int sunos_readv(unsigned long fd, const struct iovec * vector, long count) +asmlinkage int sunos_readv(unsigned long fd, const struct iovec __user *vector, + long count) { int ret; @@ -1067,7 +1072,7 @@ return ret; } -asmlinkage int sunos_write(unsigned int fd,char *buf,int count) +asmlinkage int sunos_write(unsigned int fd, char __user *buf, int count) { int ret; @@ -1075,7 +1080,8 @@ return ret; } -asmlinkage int sunos_writev(unsigned long fd, const struct iovec * vector, long count) +asmlinkage int sunos_writev(unsigned long fd, + const struct iovec __user *vector, long count) { int ret; @@ -1083,7 +1089,7 @@ return ret; } -asmlinkage int sunos_recv(int fd, void * ubuf, int size, unsigned flags) +asmlinkage int sunos_recv(int fd, void __user *ubuf, int size, unsigned flags) { int ret; @@ -1091,7 +1097,7 @@ return ret; } -asmlinkage int sunos_send(int fd, void * buff, int len, unsigned flags) +asmlinkage int sunos_send(int fd, void __user *buff, int len, unsigned flags) { int ret; @@ -1099,7 +1105,8 @@ return ret; } -asmlinkage int sunos_accept(int fd, struct sockaddr *sa, int *addrlen) +asmlinkage int sunos_accept(int fd, struct sockaddr __user *sa, + int __user *addrlen) { int ret; @@ -1115,13 +1122,13 @@ #define SUNOS_SV_INTERRUPT 2 asmlinkage int -sunos_sigaction(int sig, const struct old_sigaction *act, - struct old_sigaction *oact) +sunos_sigaction(int sig, const struct old_sigaction __user *act, + struct old_sigaction __user *oact) { struct k_sigaction new_ka, old_ka; int ret; - if(act) { + if (act) { old_sigset_t mask; if (verify_area(VERIFY_READ, act, sizeof(*act)) || @@ -1156,8 +1163,8 @@ } -asmlinkage int sunos_setsockopt(int fd, int level, int optname, char *optval, - int optlen) +asmlinkage int sunos_setsockopt(int fd, int level, int optname, + char __user *optval, int optlen) { int tr_opt = optname; int ret; @@ -1171,8 +1178,8 @@ return ret; } -asmlinkage int sunos_getsockopt(int fd, int level, int optname, char *optval, - int *optlen) +asmlinkage int sunos_getsockopt(int fd, int level, int optname, + char __user *optval, int __user *optlen) { int tr_opt = optname; int ret; diff -urN linux-2.6.7-rc2/arch/sparc/kernel/unaligned.c linux-2.6.7-rc3/arch/sparc/kernel/unaligned.c --- linux-2.6.7-rc2/arch/sparc/kernel/unaligned.c 2004-05-09 19:33:13.000000000 -0700 +++ linux-2.6.7-rc3/arch/sparc/kernel/unaligned.c 2004-06-07 12:55:01.753570486 -0700 @@ -109,14 +109,14 @@ static inline unsigned long safe_fetch_reg(unsigned int reg, struct pt_regs *regs) { - struct reg_window *win; + struct reg_window __user *win; unsigned long ret; - if(reg < 16) + if (reg < 16) return (!reg ? 0 : regs->u_regs[reg]); /* Ho hum, the slightly complicated case. */ - win = (struct reg_window *) regs->u_regs[UREG_FP]; + win = (struct reg_window __user *) regs->u_regs[UREG_FP]; if ((unsigned long)win & 3) return -1; @@ -431,29 +431,32 @@ int retval, check = (dir == load) ? VERIFY_READ : VERIFY_WRITE; int size = ((insn >> 19) & 3) == 3 ? 8 : 4; - if((regs->pc | regs->npc) & 3) + if ((regs->pc | regs->npc) & 3) return 0; /* Must verify_area() in all the necessary places. */ -#define WINREG_ADDR(regnum) ((void *)(((unsigned long *)regs->u_regs[UREG_FP])+(regnum))) +#define WINREG_ADDR(regnum) \ + ((void __user *)(((unsigned long *)regs->u_regs[UREG_FP])+(regnum))) + retval = 0; reg = (insn >> 25) & 0x1f; - if(reg >= 16) { + if (reg >= 16) { retval = verify_area(check, WINREG_ADDR(reg - 16), size); - if(retval) + if (retval) return retval; } reg = (insn >> 14) & 0x1f; - if(reg >= 16) { + if (reg >= 16) { retval = verify_area(check, WINREG_ADDR(reg - 16), size); - if(retval) + if (retval) return retval; } - if(!(insn & 0x2000)) { + if (!(insn & 0x2000)) { reg = (insn & 0x1f); - if(reg >= 16) { - retval = verify_area(check, WINREG_ADDR(reg - 16), size); - if(retval) + if (reg >= 16) { + retval = verify_area(check, WINREG_ADDR(reg - 16), + size); + if (retval) return retval; } } diff -urN linux-2.6.7-rc2/arch/sparc/kernel/windows.c linux-2.6.7-rc3/arch/sparc/kernel/windows.c --- linux-2.6.7-rc2/arch/sparc/kernel/windows.c 2004-05-09 19:32:37.000000000 -0700 +++ linux-2.6.7-rc3/arch/sparc/kernel/windows.c 2004-06-07 12:55:01.754570528 -0700 @@ -69,8 +69,8 @@ unsigned long sp = tp->rwbuf_stkptrs[window]; /* Ok, let it rip. */ - if(copy_to_user((char *) sp, &tp->reg_window[window], - sizeof(struct reg_window))) + if (copy_to_user((char __user *) sp, &tp->reg_window[window], + sizeof(struct reg_window))) continue; shift_window_buffer(window, tp->w_saved - 1, tp); @@ -117,8 +117,9 @@ for(window = 0; window < tp->w_saved; window++) { unsigned long sp = tp->rwbuf_stkptrs[window]; - if((sp & 7) || - copy_to_user((char *) sp, &tp->reg_window[window], sizeof(struct reg_window))) + if ((sp & 7) || + copy_to_user((char __user *) sp, &tp->reg_window[window], + sizeof(struct reg_window))) do_exit(SIGILL); } tp->w_saved = 0; diff -urN linux-2.6.7-rc2/arch/sparc/math-emu/math.c linux-2.6.7-rc3/arch/sparc/math-emu/math.c --- linux-2.6.7-rc2/arch/sparc/math-emu/math.c 2004-05-09 19:32:29.000000000 -0700 +++ linux-2.6.7-rc3/arch/sparc/math-emu/math.c 2004-06-07 12:55:01.754570528 -0700 @@ -175,7 +175,7 @@ #ifdef DEBUG_MATHEMU printk("precise trap at %08lx\n", regs->pc); #endif - if (!get_user(insn, (u32 *)regs->pc)) { + if (!get_user(insn, (u32 __user *) regs->pc)) { retcode = do_one_mathemu(insn, &fpt->thread.fsr, fpt->thread.float_regs); if (retcode) { /* in this case we need to fix up PC & nPC */ @@ -193,7 +193,7 @@ break; } /* Now empty the queue and clear the queue_not_empty flag */ - if(retcode) + if (retcode) fpt->thread.fsr &= ~(0x3000 | FSR_CEXC_MASK); else fpt->thread.fsr &= ~0x3000; @@ -219,18 +219,18 @@ would_trap = (fsr & ((long)eflag << FSR_TEM_SHIFT)) != 0UL; /* If trapping, we only want to signal one bit. */ - if(would_trap != 0) { + if (would_trap != 0) { eflag &= ((fsr & FSR_TEM_MASK) >> FSR_TEM_SHIFT); - if((eflag & (eflag - 1)) != 0) { - if(eflag & FP_EX_INVALID) + if ((eflag & (eflag - 1)) != 0) { + if (eflag & FP_EX_INVALID) eflag = FP_EX_INVALID; - else if(eflag & FP_EX_OVERFLOW) + else if (eflag & FP_EX_OVERFLOW) eflag = FP_EX_OVERFLOW; - else if(eflag & FP_EX_UNDERFLOW) + else if (eflag & FP_EX_UNDERFLOW) eflag = FP_EX_UNDERFLOW; - else if(eflag & FP_EX_DIVZERO) + else if (eflag & FP_EX_DIVZERO) eflag = FP_EX_DIVZERO; - else if(eflag & FP_EX_INEXACT) + else if (eflag & FP_EX_INEXACT) eflag = FP_EX_INEXACT; } } @@ -250,11 +250,11 @@ * CEXC just generated is OR'd into the * existing value of AEXC. */ - if(would_trap == 0) + if (would_trap == 0) fsr |= ((long)eflag << FSR_AEXC_SHIFT); /* If trapping, indicate fault trap type IEEE. */ - if(would_trap != 0) + if (would_trap != 0) fsr |= (1UL << 14); *pfsr = fsr; @@ -515,7 +515,7 @@ case 7: FP_PACK_QP (rd, QR); break; } } - if(_fex == 0) + if (_fex == 0) return 1; /* success! */ return record_exception(pfsr, _fex); } diff -urN linux-2.6.7-rc2/arch/sparc/mm/fault.c linux-2.6.7-rc3/arch/sparc/mm/fault.c --- linux-2.6.7-rc2/arch/sparc/mm/fault.c 2004-05-09 19:32:27.000000000 -0700 +++ linux-2.6.7-rc3/arch/sparc/mm/fault.c 2004-06-07 12:55:01.755570569 -0700 @@ -412,10 +412,10 @@ address = regs->pc; } else if (!write && !(regs->psr & PSR_PS)) { - unsigned int insn, *ip; + unsigned int insn, __user *ip; - ip = (unsigned int *)regs->pc; - if (! get_user(insn, ip)) { + ip = (unsigned int __user *)regs->pc; + if (!get_user(insn, ip)) { if ((insn & 0xc1680000) == 0xc0680000) write = 1; } diff -urN linux-2.6.7-rc2/arch/sparc64/Makefile linux-2.6.7-rc3/arch/sparc64/Makefile --- linux-2.6.7-rc2/arch/sparc64/Makefile 2004-05-09 19:33:21.000000000 -0700 +++ linux-2.6.7-rc3/arch/sparc64/Makefile 2004-06-07 12:55:01.756570610 -0700 @@ -8,6 +8,8 @@ # Copyright (C) 1998 Jakub Jelinek (jj@ultra.linux.cz) # +CHECK := $(CHECK) -D__sparc__=1 -D__sparc_v9__=1 + AFLAGS_vmlinux.lds.o += -Usparc CC := $(shell if $(CC) -m64 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo $(CC); else echo sparc64-linux-gcc; fi ) diff -urN linux-2.6.7-rc2/arch/sparc64/defconfig linux-2.6.7-rc3/arch/sparc64/defconfig --- linux-2.6.7-rc2/arch/sparc64/defconfig 2004-06-07 12:54:48.751031969 -0700 +++ linux-2.6.7-rc3/arch/sparc64/defconfig 2004-06-07 12:55:01.757570652 -0700 @@ -1133,6 +1133,7 @@ CONFIG_SENSORS_LM83=m CONFIG_SENSORS_LM85=m CONFIG_SENSORS_LM90=m +CONFIG_SENSORS_MAX1619=m CONFIG_SENSORS_VIA686A=m CONFIG_SENSORS_W83781D=m CONFIG_SENSORS_W83L785TS=m @@ -1255,6 +1256,7 @@ CONFIG_SMB_FS=m # CONFIG_SMB_NLS_DEFAULT is not set CONFIG_CIFS=m +# CONFIG_CIFS_STATS is not set CONFIG_NCP_FS=m # CONFIG_NCPFS_PACKET_SIGNING is not set # CONFIG_NCPFS_IOCTL_LOCKING is not set diff -urN linux-2.6.7-rc2/arch/sparc64/kernel/binfmt_aout32.c linux-2.6.7-rc3/arch/sparc64/kernel/binfmt_aout32.c --- linux-2.6.7-rc2/arch/sparc64/kernel/binfmt_aout32.c 2004-05-09 19:32:37.000000000 -0700 +++ linux-2.6.7-rc3/arch/sparc64/kernel/binfmt_aout32.c 2004-06-07 12:55:01.758570693 -0700 @@ -147,7 +147,6 @@ * memory and creates the pointer tables from them, and puts their * addresses on the "stack", returning the new stack pointer value. */ -#define A(__x) ((unsigned long)(__x)) static u32 *create_aout32_tables(char * p, struct linux_binprm * bprm) { @@ -171,7 +170,7 @@ current->mm->arg_start = (unsigned long) p; while (argc-->0) { char c; - put_user(((u32)A(p)),argv++); + put_user(((u32)(unsigned long)(p)),argv++); do { get_user(c,p++); } while (c); @@ -180,7 +179,7 @@ current->mm->arg_end = current->mm->env_start = (unsigned long) p; while (envc-->0) { char c; - put_user(((u32)A(p)),envp++); + put_user(((u32)(unsigned long)(p)),envp++); do { get_user(c,p++); } while (c); diff -urN linux-2.6.7-rc2/arch/sparc64/kernel/ebus.c linux-2.6.7-rc3/arch/sparc64/kernel/ebus.c --- linux-2.6.7-rc2/arch/sparc64/kernel/ebus.c 2004-05-09 19:32:27.000000000 -0700 +++ linux-2.6.7-rc3/arch/sparc64/kernel/ebus.c 2004-06-07 12:55:01.758570693 -0700 @@ -509,7 +509,7 @@ fill_ebus_child(node, ®s[0], child, child_regs_nonstandard(dev)); - while ((node = prom_getsibling(node))) { + while ((node = prom_getsibling(node)) != 0) { child->next = ebus_alloc(sizeof(struct linux_ebus_child)); child = child->next; @@ -611,7 +611,7 @@ dev->bus = ebus; fill_ebus_device(nd, dev); - while ((nd = prom_getsibling(nd))) { + while ((nd = prom_getsibling(nd)) != 0) { dev->next = ebus_alloc(sizeof(struct linux_ebus_device)); dev = dev->next; diff -urN linux-2.6.7-rc2/arch/sparc64/kernel/entry.S linux-2.6.7-rc3/arch/sparc64/kernel/entry.S --- linux-2.6.7-rc2/arch/sparc64/kernel/entry.S 2004-05-09 19:31:55.000000000 -0700 +++ linux-2.6.7-rc3/arch/sparc64/kernel/entry.S 2004-06-07 12:55:01.759570735 -0700 @@ -1697,12 +1697,12 @@ add %sp, PTREGS_OFF, %o0 srl %i0, 0, %o0 #endif - mov %i4, %o4 ! IEU1 + srl %i4, 0, %o4 ! IEU1 lduw [%l7 + %l4], %l7 ! Load srl %i1, 0, %o1 ! IEU0 Group ldx [%curptr + TI_FLAGS], %l0 ! Load - mov %i5, %o5 ! IEU1 + srl %i5, 0, %o5 ! IEU1 srl %i2, 0, %o2 ! IEU0 Group andcc %l0, _TIF_SYSCALL_TRACE, %g0 ! IEU0 Group bne,pn %icc, linux_syscall_trace32 ! CTI diff -urN linux-2.6.7-rc2/arch/sparc64/kernel/ioctl32.c linux-2.6.7-rc3/arch/sparc64/kernel/ioctl32.c --- linux-2.6.7-rc2/arch/sparc64/kernel/ioctl32.c 2004-06-07 12:54:48.752032010 -0700 +++ linux-2.6.7-rc3/arch/sparc64/kernel/ioctl32.c 2004-06-07 12:55:01.761570818 -0700 @@ -60,11 +60,11 @@ u32 r, g, b; mm_segment_t old_fs = get_fs(); - ret = get_user(f.index, &(((struct fbcmap32 *)arg)->index)); - ret |= __get_user(f.count, &(((struct fbcmap32 *)arg)->count)); - ret |= __get_user(r, &(((struct fbcmap32 *)arg)->red)); - ret |= __get_user(g, &(((struct fbcmap32 *)arg)->green)); - ret |= __get_user(b, &(((struct fbcmap32 *)arg)->blue)); + ret = get_user(f.index, &(((struct fbcmap32 __user *)arg)->index)); + ret |= __get_user(f.count, &(((struct fbcmap32 __user *)arg)->count)); + ret |= __get_user(r, &(((struct fbcmap32 __user *)arg)->red)); + ret |= __get_user(g, &(((struct fbcmap32 __user *)arg)->green)); + ret |= __get_user(b, &(((struct fbcmap32 __user *)arg)->blue)); if (ret) return -EFAULT; if ((f.index < 0) || (f.index > 255)) return -EINVAL; @@ -113,16 +113,21 @@ u32 m, i; mm_segment_t old_fs = get_fs(); - ret = copy_from_user (&f, (struct fbcursor32 *)arg, 2 * sizeof (short) + 2 * sizeof(struct fbcurpos)); - ret |= __get_user(f.size.x, &(((struct fbcursor32 *)arg)->size.x)); - ret |= __get_user(f.size.y, &(((struct fbcursor32 *)arg)->size.y)); - ret |= __get_user(f.cmap.index, &(((struct fbcursor32 *)arg)->cmap.index)); - ret |= __get_user(f.cmap.count, &(((struct fbcursor32 *)arg)->cmap.count)); - ret |= __get_user(r, &(((struct fbcursor32 *)arg)->cmap.red)); - ret |= __get_user(g, &(((struct fbcursor32 *)arg)->cmap.green)); - ret |= __get_user(b, &(((struct fbcursor32 *)arg)->cmap.blue)); - ret |= __get_user(m, &(((struct fbcursor32 *)arg)->mask)); - ret |= __get_user(i, &(((struct fbcursor32 *)arg)->image)); + ret = copy_from_user (&f, (struct fbcursor32 __user *) arg, + 2 * sizeof (short) + 2 * sizeof(struct fbcurpos)); + ret |= __get_user(f.size.x, + &(((struct fbcursor32 __user *)arg)->size.x)); + ret |= __get_user(f.size.y, + &(((struct fbcursor32 __user *)arg)->size.y)); + ret |= __get_user(f.cmap.index, + &(((struct fbcursor32 __user *)arg)->cmap.index)); + ret |= __get_user(f.cmap.count, + &(((struct fbcursor32 __user *)arg)->cmap.count)); + ret |= __get_user(r, &(((struct fbcursor32 __user *)arg)->cmap.red)); + ret |= __get_user(g, &(((struct fbcursor32 __user *)arg)->cmap.green)); + ret |= __get_user(b, &(((struct fbcursor32 __user *)arg)->cmap.blue)); + ret |= __get_user(m, &(((struct fbcursor32 __user *)arg)->mask)); + ret |= __get_user(i, &(((struct fbcursor32 __user *)arg)->image)); if (ret) return -EFAULT; if (f.set & FB_CUR_SETCMAP) { @@ -167,7 +172,7 @@ static int drm32_version(unsigned int fd, unsigned int cmd, unsigned long arg) { - drm32_version_t *uversion = (drm32_version_t *)arg; + drm32_version_t __user *uversion = (drm32_version_t __user *)arg; char __user *name_ptr, *date_ptr, *desc_ptr; u32 tmp1, tmp2, tmp3; drm_version_t kversion; @@ -245,7 +250,7 @@ static int drm32_getsetunique(unsigned int fd, unsigned int cmd, unsigned long arg) { - drm32_unique_t *uarg = (drm32_unique_t *)arg; + drm32_unique_t __user *uarg = (drm32_unique_t __user *)arg; drm_unique_t karg; mm_segment_t old_fs; char __user *uptr; @@ -309,7 +314,7 @@ static int drm32_addmap(unsigned int fd, unsigned int cmd, unsigned long arg) { - drm32_map_t *uarg = (drm32_map_t *) arg; + drm32_map_t __user *uarg = (drm32_map_t __user *) arg; drm_map_t karg; mm_segment_t old_fs; u32 tmp; @@ -324,7 +329,7 @@ if (ret) return -EFAULT; - karg.handle = A(tmp); + karg.handle = (void *) (unsigned long) tmp; old_fs = get_fs(); set_fs(KERNEL_DS); @@ -354,7 +359,7 @@ static int drm32_info_bufs(unsigned int fd, unsigned int cmd, unsigned long arg) { - drm32_buf_info_t *uarg = (drm32_buf_info_t *)arg; + drm32_buf_info_t __user *uarg = (drm32_buf_info_t __user *)arg; drm_buf_desc_t __user *ulist; drm_buf_info_t karg; mm_segment_t old_fs; @@ -400,7 +405,7 @@ static int drm32_free_bufs(unsigned int fd, unsigned int cmd, unsigned long arg) { - drm32_buf_free_t *uarg = (drm32_buf_free_t *)arg; + drm32_buf_free_t __user *uarg = (drm32_buf_free_t __user *)arg; drm_buf_free_t karg; mm_segment_t old_fs; int __user *ulist; @@ -448,7 +453,7 @@ static int drm32_map_bufs(unsigned int fd, unsigned int cmd, unsigned long arg) { - drm32_buf_map_t *uarg = (drm32_buf_map_t *)arg; + drm32_buf_map_t __user *uarg = (drm32_buf_map_t __user *)arg; drm32_buf_pub_t __user *ulist; drm_buf_map_t karg; mm_segment_t old_fs; @@ -460,7 +465,7 @@ get_user(tmp2, &uarg->list)) return -EFAULT; - karg.virtual = A(tmp1); + karg.virtual = (void *) (unsigned long) tmp1; ulist = A(tmp2); orig_count = karg.count; @@ -477,7 +482,7 @@ get_user(tmp1, &ulist[i].address)) goto out; - karg.list[i].address = A(tmp1); + karg.list[i].address = (void *) (unsigned long) tmp1; } old_fs = get_fs(); @@ -527,7 +532,7 @@ */ static int drm32_dma(unsigned int fd, unsigned int cmd, unsigned long arg) { - drm32_dma_t *uarg = (drm32_dma_t *) arg; + drm32_dma_t __user *uarg = (drm32_dma_t __user *) arg; int __user *u_si, *u_ss, *u_ri, *u_rs; drm_dma_t karg; mm_segment_t old_fs; @@ -637,7 +642,7 @@ static int drm32_res_ctx(unsigned int fd, unsigned int cmd, unsigned long arg) { - drm32_ctx_res_t *uarg = (drm32_ctx_res_t *) arg; + drm32_ctx_res_t __user *uarg = (drm32_ctx_res_t __user *) arg; drm_ctx_t __user *ulist; drm_ctx_res_t karg; mm_segment_t old_fs; diff -urN linux-2.6.7-rc2/arch/sparc64/kernel/irq.c linux-2.6.7-rc3/arch/sparc64/kernel/irq.c --- linux-2.6.7-rc2/arch/sparc64/kernel/irq.c 2004-05-09 19:33:20.000000000 -0700 +++ linux-2.6.7-rc3/arch/sparc64/kernel/irq.c 2004-06-07 12:55:01.762570859 -0700 @@ -1164,7 +1164,7 @@ #define HEX_DIGITS 16 -static unsigned int parse_hex_value (const char *buffer, +static unsigned int parse_hex_value (const char __user *buffer, unsigned long count, unsigned long *ret) { unsigned char hexnum [HEX_DIGITS]; @@ -1233,7 +1233,7 @@ */ } -static int irq_affinity_write_proc (struct file *file, const char *buffer, +static int irq_affinity_write_proc (struct file *file, const char __user *buffer, unsigned long count, void *data) { int irq = (long) data, full_count = count, err; diff -urN linux-2.6.7-rc2/arch/sparc64/kernel/module.c linux-2.6.7-rc3/arch/sparc64/kernel/module.c --- linux-2.6.7-rc2/arch/sparc64/kernel/module.c 2004-05-09 19:32:52.000000000 -0700 +++ linux-2.6.7-rc3/arch/sparc64/kernel/module.c 2004-06-07 12:55:01.762570859 -0700 @@ -31,7 +31,7 @@ return; } - for (p = &modvmlist ; (tmp = *p) ; p = &tmp->next) { + for (p = &modvmlist; (tmp = *p) != NULL; p = &tmp->next) { if (tmp->addr == addr) { *p = tmp->next; goto found; @@ -66,7 +66,7 @@ return NULL; addr = (void *) MODULES_VADDR; - for (p = &modvmlist; (tmp = *p) ; p = &tmp->next) { + for (p = &modvmlist; (tmp = *p) != NULL; p = &tmp->next) { if (size + (unsigned long) addr < (unsigned long) tmp->addr) break; addr = (void *) (tmp->size + (unsigned long) tmp->addr); diff -urN linux-2.6.7-rc2/arch/sparc64/kernel/pci_psycho.c linux-2.6.7-rc3/arch/sparc64/kernel/pci_psycho.c --- linux-2.6.7-rc2/arch/sparc64/kernel/pci_psycho.c 2004-05-09 19:32:39.000000000 -0700 +++ linux-2.6.7-rc3/arch/sparc64/kernel/pci_psycho.c 2004-06-07 12:55:01.764570942 -0700 @@ -42,29 +42,29 @@ /* Misc. PSYCHO PCI controller register offsets and definitions. */ #define PSYCHO_CONTROL 0x0010UL -#define PSYCHO_CONTROL_IMPL 0xf000000000000000 /* Implementation of this PSYCHO*/ -#define PSYCHO_CONTROL_VER 0x0f00000000000000 /* Version of this PSYCHO */ -#define PSYCHO_CONTROL_MID 0x00f8000000000000 /* UPA Module ID of PSYCHO */ -#define PSYCHO_CONTROL_IGN 0x0007c00000000000 /* Interrupt Group Number */ -#define PSYCHO_CONTROL_RESV 0x00003ffffffffff0 /* Reserved */ -#define PSYCHO_CONTROL_APCKEN 0x0000000000000008 /* Address Parity Check Enable */ -#define PSYCHO_CONTROL_APERR 0x0000000000000004 /* Incoming System Addr Parerr */ -#define PSYCHO_CONTROL_IAP 0x0000000000000002 /* Invert UPA Parity */ -#define PSYCHO_CONTROL_MODE 0x0000000000000001 /* PSYCHO clock mode */ +#define PSYCHO_CONTROL_IMPL 0xf000000000000000UL /* Implementation of this PSYCHO*/ +#define PSYCHO_CONTROL_VER 0x0f00000000000000UL /* Version of this PSYCHO */ +#define PSYCHO_CONTROL_MID 0x00f8000000000000UL /* UPA Module ID of PSYCHO */ +#define PSYCHO_CONTROL_IGN 0x0007c00000000000UL /* Interrupt Group Number */ +#define PSYCHO_CONTROL_RESV 0x00003ffffffffff0UL /* Reserved */ +#define PSYCHO_CONTROL_APCKEN 0x0000000000000008UL /* Address Parity Check Enable */ +#define PSYCHO_CONTROL_APERR 0x0000000000000004UL /* Incoming System Addr Parerr */ +#define PSYCHO_CONTROL_IAP 0x0000000000000002UL /* Invert UPA Parity */ +#define PSYCHO_CONTROL_MODE 0x0000000000000001UL /* PSYCHO clock mode */ #define PSYCHO_PCIA_CTRL 0x2000UL #define PSYCHO_PCIB_CTRL 0x4000UL -#define PSYCHO_PCICTRL_RESV1 0xfffffff000000000 /* Reserved */ -#define PSYCHO_PCICTRL_SBH_ERR 0x0000000800000000 /* Streaming byte hole error */ -#define PSYCHO_PCICTRL_SERR 0x0000000400000000 /* SERR signal asserted */ -#define PSYCHO_PCICTRL_SPEED 0x0000000200000000 /* PCI speed (1 is U2P clock) */ -#define PSYCHO_PCICTRL_RESV2 0x00000001ffc00000 /* Reserved */ -#define PSYCHO_PCICTRL_ARB_PARK 0x0000000000200000 /* PCI arbitration parking */ -#define PSYCHO_PCICTRL_RESV3 0x00000000001ff800 /* Reserved */ -#define PSYCHO_PCICTRL_SBH_INT 0x0000000000000400 /* Streaming byte hole int enab */ -#define PSYCHO_PCICTRL_WEN 0x0000000000000200 /* Power Mgmt Wake Enable */ -#define PSYCHO_PCICTRL_EEN 0x0000000000000100 /* PCI Error Interrupt Enable */ -#define PSYCHO_PCICTRL_RESV4 0x00000000000000c0 /* Reserved */ -#define PSYCHO_PCICTRL_AEN 0x000000000000003f /* PCI DVMA Arbitration Enable */ +#define PSYCHO_PCICTRL_RESV1 0xfffffff000000000UL /* Reserved */ +#define PSYCHO_PCICTRL_SBH_ERR 0x0000000800000000UL /* Streaming byte hole error */ +#define PSYCHO_PCICTRL_SERR 0x0000000400000000UL /* SERR signal asserted */ +#define PSYCHO_PCICTRL_SPEED 0x0000000200000000UL /* PCI speed (1 is U2P clock) */ +#define PSYCHO_PCICTRL_RESV2 0x00000001ffc00000UL /* Reserved */ +#define PSYCHO_PCICTRL_ARB_PARK 0x0000000000200000UL /* PCI arbitration parking */ +#define PSYCHO_PCICTRL_RESV3 0x00000000001ff800UL /* Reserved */ +#define PSYCHO_PCICTRL_SBH_INT 0x0000000000000400UL /* Streaming byte hole int enab */ +#define PSYCHO_PCICTRL_WEN 0x0000000000000200UL /* Power Mgmt Wake Enable */ +#define PSYCHO_PCICTRL_EEN 0x0000000000000100UL /* PCI Error Interrupt Enable */ +#define PSYCHO_PCICTRL_RESV4 0x00000000000000c0UL /* Reserved */ +#define PSYCHO_PCICTRL_AEN 0x000000000000003fUL /* PCI DVMA Arbitration Enable */ /* U2P Programmer's Manual, page 13-55, configuration space * address format: @@ -403,11 +403,11 @@ */ #define PSYCHO_STRBUF_CONTROL_A 0x2800UL #define PSYCHO_STRBUF_CONTROL_B 0x4800UL -#define PSYCHO_STRBUF_CTRL_LPTR 0x00000000000000f0 /* LRU Lock Pointer */ -#define PSYCHO_STRBUF_CTRL_LENAB 0x0000000000000008 /* LRU Lock Enable */ -#define PSYCHO_STRBUF_CTRL_RRDIS 0x0000000000000004 /* Rerun Disable */ -#define PSYCHO_STRBUF_CTRL_DENAB 0x0000000000000002 /* Diagnostic Mode Enable */ -#define PSYCHO_STRBUF_CTRL_ENAB 0x0000000000000001 /* Streaming Buffer Enable */ +#define PSYCHO_STRBUF_CTRL_LPTR 0x00000000000000f0UL /* LRU Lock Pointer */ +#define PSYCHO_STRBUF_CTRL_LENAB 0x0000000000000008UL /* LRU Lock Enable */ +#define PSYCHO_STRBUF_CTRL_RRDIS 0x0000000000000004UL /* Rerun Disable */ +#define PSYCHO_STRBUF_CTRL_DENAB 0x0000000000000002UL /* Diagnostic Mode Enable */ +#define PSYCHO_STRBUF_CTRL_ENAB 0x0000000000000001UL /* Streaming Buffer Enable */ #define PSYCHO_STRBUF_FLUSH_A 0x2808UL #define PSYCHO_STRBUF_FLUSH_B 0x4808UL #define PSYCHO_STRBUF_FSYNC_A 0x2810UL @@ -416,22 +416,22 @@ #define PSYCHO_STC_DATA_B 0xc000UL #define PSYCHO_STC_ERR_A 0xb400UL #define PSYCHO_STC_ERR_B 0xc400UL -#define PSYCHO_STCERR_WRITE 0x0000000000000002 /* Write Error */ -#define PSYCHO_STCERR_READ 0x0000000000000001 /* Read Error */ +#define PSYCHO_STCERR_WRITE 0x0000000000000002UL /* Write Error */ +#define PSYCHO_STCERR_READ 0x0000000000000001UL /* Read Error */ #define PSYCHO_STC_TAG_A 0xb800UL #define PSYCHO_STC_TAG_B 0xc800UL -#define PSYCHO_STCTAG_PPN 0x0fffffff00000000 /* Physical Page Number */ -#define PSYCHO_STCTAG_VPN 0x00000000ffffe000 /* Virtual Page Number */ -#define PSYCHO_STCTAG_VALID 0x0000000000000002 /* Valid */ -#define PSYCHO_STCTAG_WRITE 0x0000000000000001 /* Writable */ +#define PSYCHO_STCTAG_PPN 0x0fffffff00000000UL /* Physical Page Number */ +#define PSYCHO_STCTAG_VPN 0x00000000ffffe000UL /* Virtual Page Number */ +#define PSYCHO_STCTAG_VALID 0x0000000000000002UL /* Valid */ +#define PSYCHO_STCTAG_WRITE 0x0000000000000001UL /* Writable */ #define PSYCHO_STC_LINE_A 0xb900UL #define PSYCHO_STC_LINE_B 0xc900UL -#define PSYCHO_STCLINE_LINDX 0x0000000001e00000 /* LRU Index */ -#define PSYCHO_STCLINE_SPTR 0x00000000001f8000 /* Dirty Data Start Pointer */ -#define PSYCHO_STCLINE_LADDR 0x0000000000007f00 /* Line Address */ -#define PSYCHO_STCLINE_EPTR 0x00000000000000fc /* Dirty Data End Pointer */ -#define PSYCHO_STCLINE_VALID 0x0000000000000002 /* Valid */ -#define PSYCHO_STCLINE_FOFN 0x0000000000000001 /* Fetch Outstanding / Flush Necessary */ +#define PSYCHO_STCLINE_LINDX 0x0000000001e00000UL /* LRU Index */ +#define PSYCHO_STCLINE_SPTR 0x00000000001f8000UL /* Dirty Data Start Pointer */ +#define PSYCHO_STCLINE_LADDR 0x0000000000007f00UL /* Line Address */ +#define PSYCHO_STCLINE_EPTR 0x00000000000000fcUL /* Dirty Data End Pointer */ +#define PSYCHO_STCLINE_VALID 0x0000000000000002UL /* Valid */ +#define PSYCHO_STCLINE_FOFN 0x0000000000000001UL /* Fetch Outstanding / Flush Necessary */ static spinlock_t stc_buf_lock = SPIN_LOCK_UNLOCKED; static unsigned long stc_error_buf[128]; @@ -555,24 +555,24 @@ * interrogate the IOMMU state to see if it is the cause. */ #define PSYCHO_IOMMU_CONTROL 0x0200UL -#define PSYCHO_IOMMU_CTRL_RESV 0xfffffffff9000000 /* Reserved */ -#define PSYCHO_IOMMU_CTRL_XLTESTAT 0x0000000006000000 /* Translation Error Status */ -#define PSYCHO_IOMMU_CTRL_XLTEERR 0x0000000001000000 /* Translation Error encountered */ -#define PSYCHO_IOMMU_CTRL_LCKEN 0x0000000000800000 /* Enable translation locking */ -#define PSYCHO_IOMMU_CTRL_LCKPTR 0x0000000000780000 /* Translation lock pointer */ -#define PSYCHO_IOMMU_CTRL_TSBSZ 0x0000000000070000 /* TSB Size */ -#define PSYCHO_IOMMU_TSBSZ_1K 0x0000000000000000 /* TSB Table 1024 8-byte entries */ -#define PSYCHO_IOMMU_TSBSZ_2K 0x0000000000010000 /* TSB Table 2048 8-byte entries */ -#define PSYCHO_IOMMU_TSBSZ_4K 0x0000000000020000 /* TSB Table 4096 8-byte entries */ -#define PSYCHO_IOMMU_TSBSZ_8K 0x0000000000030000 /* TSB Table 8192 8-byte entries */ -#define PSYCHO_IOMMU_TSBSZ_16K 0x0000000000040000 /* TSB Table 16k 8-byte entries */ -#define PSYCHO_IOMMU_TSBSZ_32K 0x0000000000050000 /* TSB Table 32k 8-byte entries */ -#define PSYCHO_IOMMU_TSBSZ_64K 0x0000000000060000 /* TSB Table 64k 8-byte entries */ -#define PSYCHO_IOMMU_TSBSZ_128K 0x0000000000070000 /* TSB Table 128k 8-byte entries */ -#define PSYCHO_IOMMU_CTRL_RESV2 0x000000000000fff8 /* Reserved */ -#define PSYCHO_IOMMU_CTRL_TBWSZ 0x0000000000000004 /* Assumed page size, 0=8k 1=64k */ -#define PSYCHO_IOMMU_CTRL_DENAB 0x0000000000000002 /* Diagnostic mode enable */ -#define PSYCHO_IOMMU_CTRL_ENAB 0x0000000000000001 /* IOMMU Enable */ +#define PSYCHO_IOMMU_CTRL_RESV 0xfffffffff9000000UL /* Reserved */ +#define PSYCHO_IOMMU_CTRL_XLTESTAT 0x0000000006000000UL /* Translation Error Status */ +#define PSYCHO_IOMMU_CTRL_XLTEERR 0x0000000001000000UL /* Translation Error encountered */ +#define PSYCHO_IOMMU_CTRL_LCKEN 0x0000000000800000UL /* Enable translation locking */ +#define PSYCHO_IOMMU_CTRL_LCKPTR 0x0000000000780000UL /* Translation lock pointer */ +#define PSYCHO_IOMMU_CTRL_TSBSZ 0x0000000000070000UL /* TSB Size */ +#define PSYCHO_IOMMU_TSBSZ_1K 0x0000000000000000UL /* TSB Table 1024 8-byte entries */ +#define PSYCHO_IOMMU_TSBSZ_2K 0x0000000000010000UL /* TSB Table 2048 8-byte entries */ +#define PSYCHO_IOMMU_TSBSZ_4K 0x0000000000020000UL /* TSB Table 4096 8-byte entries */ +#define PSYCHO_IOMMU_TSBSZ_8K 0x0000000000030000UL /* TSB Table 8192 8-byte entries */ +#define PSYCHO_IOMMU_TSBSZ_16K 0x0000000000040000UL /* TSB Table 16k 8-byte entries */ +#define PSYCHO_IOMMU_TSBSZ_32K 0x0000000000050000UL /* TSB Table 32k 8-byte entries */ +#define PSYCHO_IOMMU_TSBSZ_64K 0x0000000000060000UL /* TSB Table 64k 8-byte entries */ +#define PSYCHO_IOMMU_TSBSZ_128K 0x0000000000070000UL /* TSB Table 128k 8-byte entries */ +#define PSYCHO_IOMMU_CTRL_RESV2 0x000000000000fff8UL /* Reserved */ +#define PSYCHO_IOMMU_CTRL_TBWSZ 0x0000000000000004UL /* Assumed page size, 0=8k 1=64k */ +#define PSYCHO_IOMMU_CTRL_DENAB 0x0000000000000002UL /* Diagnostic mode enable */ +#define PSYCHO_IOMMU_CTRL_ENAB 0x0000000000000001UL /* IOMMU Enable */ #define PSYCHO_IOMMU_TSBBASE 0x0208UL #define PSYCHO_IOMMU_FLUSH 0x0210UL #define PSYCHO_IOMMU_TAG 0xa580UL @@ -698,18 +698,18 @@ * relating to UPA interface transactions. */ #define PSYCHO_UE_AFSR 0x0030UL -#define PSYCHO_UEAFSR_PPIO 0x8000000000000000 /* Primary PIO is cause */ -#define PSYCHO_UEAFSR_PDRD 0x4000000000000000 /* Primary DVMA read is cause */ -#define PSYCHO_UEAFSR_PDWR 0x2000000000000000 /* Primary DVMA write is cause */ -#define PSYCHO_UEAFSR_SPIO 0x1000000000000000 /* Secondary PIO is cause */ -#define PSYCHO_UEAFSR_SDRD 0x0800000000000000 /* Secondary DVMA read is cause */ -#define PSYCHO_UEAFSR_SDWR 0x0400000000000000 /* Secondary DVMA write is cause*/ -#define PSYCHO_UEAFSR_RESV1 0x03ff000000000000 /* Reserved */ -#define PSYCHO_UEAFSR_BMSK 0x0000ffff00000000 /* Bytemask of failed transfer */ -#define PSYCHO_UEAFSR_DOFF 0x00000000e0000000 /* Doubleword Offset */ -#define PSYCHO_UEAFSR_MID 0x000000001f000000 /* UPA MID causing the fault */ -#define PSYCHO_UEAFSR_BLK 0x0000000000800000 /* Trans was block operation */ -#define PSYCHO_UEAFSR_RESV2 0x00000000007fffff /* Reserved */ +#define PSYCHO_UEAFSR_PPIO 0x8000000000000000UL /* Primary PIO is cause */ +#define PSYCHO_UEAFSR_PDRD 0x4000000000000000UL /* Primary DVMA read is cause */ +#define PSYCHO_UEAFSR_PDWR 0x2000000000000000UL /* Primary DVMA write is cause */ +#define PSYCHO_UEAFSR_SPIO 0x1000000000000000UL /* Secondary PIO is cause */ +#define PSYCHO_UEAFSR_SDRD 0x0800000000000000UL /* Secondary DVMA read is cause */ +#define PSYCHO_UEAFSR_SDWR 0x0400000000000000UL /* Secondary DVMA write is cause*/ +#define PSYCHO_UEAFSR_RESV1 0x03ff000000000000UL /* Reserved */ +#define PSYCHO_UEAFSR_BMSK 0x0000ffff00000000UL /* Bytemask of failed transfer */ +#define PSYCHO_UEAFSR_DOFF 0x00000000e0000000UL /* Doubleword Offset */ +#define PSYCHO_UEAFSR_MID 0x000000001f000000UL /* UPA MID causing the fault */ +#define PSYCHO_UEAFSR_BLK 0x0000000000800000UL /* Trans was block operation */ +#define PSYCHO_UEAFSR_RESV2 0x00000000007fffffUL /* Reserved */ #define PSYCHO_UE_AFAR 0x0038UL static irqreturn_t psycho_ue_intr(int irq, void *dev_id, struct pt_regs *regs) @@ -774,19 +774,19 @@ /* Correctable Errors. */ #define PSYCHO_CE_AFSR 0x0040UL -#define PSYCHO_CEAFSR_PPIO 0x8000000000000000 /* Primary PIO is cause */ -#define PSYCHO_CEAFSR_PDRD 0x4000000000000000 /* Primary DVMA read is cause */ -#define PSYCHO_CEAFSR_PDWR 0x2000000000000000 /* Primary DVMA write is cause */ -#define PSYCHO_CEAFSR_SPIO 0x1000000000000000 /* Secondary PIO is cause */ -#define PSYCHO_CEAFSR_SDRD 0x0800000000000000 /* Secondary DVMA read is cause */ -#define PSYCHO_CEAFSR_SDWR 0x0400000000000000 /* Secondary DVMA write is cause*/ -#define PSYCHO_CEAFSR_RESV1 0x0300000000000000 /* Reserved */ -#define PSYCHO_CEAFSR_ESYND 0x00ff000000000000 /* Syndrome Bits */ -#define PSYCHO_CEAFSR_BMSK 0x0000ffff00000000 /* Bytemask of failed transfer */ -#define PSYCHO_CEAFSR_DOFF 0x00000000e0000000 /* Double Offset */ -#define PSYCHO_CEAFSR_MID 0x000000001f000000 /* UPA MID causing the fault */ -#define PSYCHO_CEAFSR_BLK 0x0000000000800000 /* Trans was block operation */ -#define PSYCHO_CEAFSR_RESV2 0x00000000007fffff /* Reserved */ +#define PSYCHO_CEAFSR_PPIO 0x8000000000000000UL /* Primary PIO is cause */ +#define PSYCHO_CEAFSR_PDRD 0x4000000000000000UL /* Primary DVMA read is cause */ +#define PSYCHO_CEAFSR_PDWR 0x2000000000000000UL /* Primary DVMA write is cause */ +#define PSYCHO_CEAFSR_SPIO 0x1000000000000000UL /* Secondary PIO is cause */ +#define PSYCHO_CEAFSR_SDRD 0x0800000000000000UL /* Secondary DVMA read is cause */ +#define PSYCHO_CEAFSR_SDWR 0x0400000000000000UL /* Secondary DVMA write is cause*/ +#define PSYCHO_CEAFSR_RESV1 0x0300000000000000UL /* Reserved */ +#define PSYCHO_CEAFSR_ESYND 0x00ff000000000000UL /* Syndrome Bits */ +#define PSYCHO_CEAFSR_BMSK 0x0000ffff00000000UL /* Bytemask of failed transfer */ +#define PSYCHO_CEAFSR_DOFF 0x00000000e0000000UL /* Double Offset */ +#define PSYCHO_CEAFSR_MID 0x000000001f000000UL /* UPA MID causing the fault */ +#define PSYCHO_CEAFSR_BLK 0x0000000000800000UL /* Trans was block operation */ +#define PSYCHO_CEAFSR_RESV2 0x00000000007fffffUL /* Reserved */ #define PSYCHO_CE_AFAR 0x0040UL static irqreturn_t psycho_ce_intr(int irq, void *dev_id, struct pt_regs *regs) @@ -857,20 +857,20 @@ */ #define PSYCHO_PCI_AFSR_A 0x2010UL #define PSYCHO_PCI_AFSR_B 0x4010UL -#define PSYCHO_PCIAFSR_PMA 0x8000000000000000 /* Primary Master Abort Error */ -#define PSYCHO_PCIAFSR_PTA 0x4000000000000000 /* Primary Target Abort Error */ -#define PSYCHO_PCIAFSR_PRTRY 0x2000000000000000 /* Primary Excessive Retries */ -#define PSYCHO_PCIAFSR_PPERR 0x1000000000000000 /* Primary Parity Error */ -#define PSYCHO_PCIAFSR_SMA 0x0800000000000000 /* Secondary Master Abort Error */ -#define PSYCHO_PCIAFSR_STA 0x0400000000000000 /* Secondary Target Abort Error */ -#define PSYCHO_PCIAFSR_SRTRY 0x0200000000000000 /* Secondary Excessive Retries */ -#define PSYCHO_PCIAFSR_SPERR 0x0100000000000000 /* Secondary Parity Error */ -#define PSYCHO_PCIAFSR_RESV1 0x00ff000000000000 /* Reserved */ -#define PSYCHO_PCIAFSR_BMSK 0x0000ffff00000000 /* Bytemask of failed transfer */ -#define PSYCHO_PCIAFSR_BLK 0x0000000080000000 /* Trans was block operation */ -#define PSYCHO_PCIAFSR_RESV2 0x0000000040000000 /* Reserved */ -#define PSYCHO_PCIAFSR_MID 0x000000003e000000 /* MID causing the error */ -#define PSYCHO_PCIAFSR_RESV3 0x0000000001ffffff /* Reserved */ +#define PSYCHO_PCIAFSR_PMA 0x8000000000000000UL /* Primary Master Abort Error */ +#define PSYCHO_PCIAFSR_PTA 0x4000000000000000UL /* Primary Target Abort Error */ +#define PSYCHO_PCIAFSR_PRTRY 0x2000000000000000UL /* Primary Excessive Retries */ +#define PSYCHO_PCIAFSR_PPERR 0x1000000000000000UL /* Primary Parity Error */ +#define PSYCHO_PCIAFSR_SMA 0x0800000000000000UL /* Secondary Master Abort Error */ +#define PSYCHO_PCIAFSR_STA 0x0400000000000000UL /* Secondary Target Abort Error */ +#define PSYCHO_PCIAFSR_SRTRY 0x0200000000000000UL /* Secondary Excessive Retries */ +#define PSYCHO_PCIAFSR_SPERR 0x0100000000000000UL /* Secondary Parity Error */ +#define PSYCHO_PCIAFSR_RESV1 0x00ff000000000000UL /* Reserved */ +#define PSYCHO_PCIAFSR_BMSK 0x0000ffff00000000UL /* Bytemask of failed transfer */ +#define PSYCHO_PCIAFSR_BLK 0x0000000080000000UL /* Trans was block operation */ +#define PSYCHO_PCIAFSR_RESV2 0x0000000040000000UL /* Reserved */ +#define PSYCHO_PCIAFSR_MID 0x000000003e000000UL /* MID causing the error */ +#define PSYCHO_PCIAFSR_RESV3 0x0000000001ffffffUL /* Reserved */ #define PSYCHO_PCI_AFAR_A 0x2018UL #define PSYCHO_PCI_AFAR_B 0x4018UL @@ -1017,9 +1017,9 @@ /* XXX What about PowerFail/PowerManagement??? -DaveM */ #define PSYCHO_ECC_CTRL 0x0020 -#define PSYCHO_ECCCTRL_EE 0x8000000000000000 /* Enable ECC Checking */ -#define PSYCHO_ECCCTRL_UE 0x4000000000000000 /* Enable UE Interrupts */ -#define PSYCHO_ECCCTRL_CE 0x2000000000000000 /* Enable CE INterrupts */ +#define PSYCHO_ECCCTRL_EE 0x8000000000000000UL /* Enable ECC Checking */ +#define PSYCHO_ECCCTRL_UE 0x4000000000000000UL /* Enable UE Interrupts */ +#define PSYCHO_ECCCTRL_CE 0x2000000000000000UL /* Enable CE INterrupts */ #define PSYCHO_UE_INO 0x2e #define PSYCHO_CE_INO 0x2f #define PSYCHO_PCIERR_A_INO 0x30 @@ -1282,14 +1282,14 @@ #define PSYCHO_IRQ_RETRY 0x1a00UL #define PSYCHO_PCIA_DIAG 0x2020UL #define PSYCHO_PCIB_DIAG 0x4020UL -#define PSYCHO_PCIDIAG_RESV 0xffffffffffffff80 /* Reserved */ -#define PSYCHO_PCIDIAG_DRETRY 0x0000000000000040 /* Disable retry limit */ -#define PSYCHO_PCIDIAG_DISYNC 0x0000000000000020 /* Disable DMA wr / irq sync */ -#define PSYCHO_PCIDIAG_DDWSYNC 0x0000000000000010 /* Disable DMA wr / PIO rd sync */ -#define PSYCHO_PCIDIAG_IDDPAR 0x0000000000000008 /* Invert DMA data parity */ -#define PSYCHO_PCIDIAG_IPDPAR 0x0000000000000004 /* Invert PIO data parity */ -#define PSYCHO_PCIDIAG_IPAPAR 0x0000000000000002 /* Invert PIO address parity */ -#define PSYCHO_PCIDIAG_LPBACK 0x0000000000000001 /* Enable loopback mode */ +#define PSYCHO_PCIDIAG_RESV 0xffffffffffffff80UL /* Reserved */ +#define PSYCHO_PCIDIAG_DRETRY 0x0000000000000040UL /* Disable retry limit */ +#define PSYCHO_PCIDIAG_DISYNC 0x0000000000000020UL /* Disable DMA wr / irq sync */ +#define PSYCHO_PCIDIAG_DDWSYNC 0x0000000000000010UL /* Disable DMA wr / PIO rd sync */ +#define PSYCHO_PCIDIAG_IDDPAR 0x0000000000000008UL /* Invert DMA data parity */ +#define PSYCHO_PCIDIAG_IPDPAR 0x0000000000000004UL /* Invert PIO data parity */ +#define PSYCHO_PCIDIAG_IPAPAR 0x0000000000000002UL /* Invert PIO address parity */ +#define PSYCHO_PCIDIAG_LPBACK 0x0000000000000001UL /* Enable loopback mode */ static void psycho_controller_hwinit(struct pci_controller_info *p) { diff -urN linux-2.6.7-rc2/arch/sparc64/kernel/pci_schizo.c linux-2.6.7-rc3/arch/sparc64/kernel/pci_schizo.c --- linux-2.6.7-rc2/arch/sparc64/kernel/pci_schizo.c 2004-05-09 19:32:53.000000000 -0700 +++ linux-2.6.7-rc3/arch/sparc64/kernel/pci_schizo.c 2004-06-07 12:55:01.766571025 -0700 @@ -56,24 +56,24 @@ #define SCHIZO_STRBUF_CTRL_ENAB 0x0000000000000001UL /* Streaming Buffer Enable */ /* IOMMU control register. */ -#define SCHIZO_IOMMU_CTRL_RESV 0xfffffffff9000000 /* Reserved */ -#define SCHIZO_IOMMU_CTRL_XLTESTAT 0x0000000006000000 /* Translation Error Status */ -#define SCHIZO_IOMMU_CTRL_XLTEERR 0x0000000001000000 /* Translation Error encountered */ -#define SCHIZO_IOMMU_CTRL_LCKEN 0x0000000000800000 /* Enable translation locking */ -#define SCHIZO_IOMMU_CTRL_LCKPTR 0x0000000000780000 /* Translation lock pointer */ -#define SCHIZO_IOMMU_CTRL_TSBSZ 0x0000000000070000 /* TSB Size */ -#define SCHIZO_IOMMU_TSBSZ_1K 0x0000000000000000 /* TSB Table 1024 8-byte entries */ -#define SCHIZO_IOMMU_TSBSZ_2K 0x0000000000010000 /* TSB Table 2048 8-byte entries */ -#define SCHIZO_IOMMU_TSBSZ_4K 0x0000000000020000 /* TSB Table 4096 8-byte entries */ -#define SCHIZO_IOMMU_TSBSZ_8K 0x0000000000030000 /* TSB Table 8192 8-byte entries */ -#define SCHIZO_IOMMU_TSBSZ_16K 0x0000000000040000 /* TSB Table 16k 8-byte entries */ -#define SCHIZO_IOMMU_TSBSZ_32K 0x0000000000050000 /* TSB Table 32k 8-byte entries */ -#define SCHIZO_IOMMU_TSBSZ_64K 0x0000000000060000 /* TSB Table 64k 8-byte entries */ -#define SCHIZO_IOMMU_TSBSZ_128K 0x0000000000070000 /* TSB Table 128k 8-byte entries */ -#define SCHIZO_IOMMU_CTRL_RESV2 0x000000000000fff8 /* Reserved */ -#define SCHIZO_IOMMU_CTRL_TBWSZ 0x0000000000000004 /* Assumed page size, 0=8k 1=64k */ -#define SCHIZO_IOMMU_CTRL_DENAB 0x0000000000000002 /* Diagnostic mode enable */ -#define SCHIZO_IOMMU_CTRL_ENAB 0x0000000000000001 /* IOMMU Enable */ +#define SCHIZO_IOMMU_CTRL_RESV 0xfffffffff9000000UL /* Reserved */ +#define SCHIZO_IOMMU_CTRL_XLTESTAT 0x0000000006000000UL /* Translation Error Status */ +#define SCHIZO_IOMMU_CTRL_XLTEERR 0x0000000001000000UL /* Translation Error encountered */ +#define SCHIZO_IOMMU_CTRL_LCKEN 0x0000000000800000UL /* Enable translation locking */ +#define SCHIZO_IOMMU_CTRL_LCKPTR 0x0000000000780000UL /* Translation lock pointer */ +#define SCHIZO_IOMMU_CTRL_TSBSZ 0x0000000000070000UL /* TSB Size */ +#define SCHIZO_IOMMU_TSBSZ_1K 0x0000000000000000UL /* TSB Table 1024 8-byte entries */ +#define SCHIZO_IOMMU_TSBSZ_2K 0x0000000000010000UL /* TSB Table 2048 8-byte entries */ +#define SCHIZO_IOMMU_TSBSZ_4K 0x0000000000020000UL /* TSB Table 4096 8-byte entries */ +#define SCHIZO_IOMMU_TSBSZ_8K 0x0000000000030000UL /* TSB Table 8192 8-byte entries */ +#define SCHIZO_IOMMU_TSBSZ_16K 0x0000000000040000UL /* TSB Table 16k 8-byte entries */ +#define SCHIZO_IOMMU_TSBSZ_32K 0x0000000000050000UL /* TSB Table 32k 8-byte entries */ +#define SCHIZO_IOMMU_TSBSZ_64K 0x0000000000060000UL /* TSB Table 64k 8-byte entries */ +#define SCHIZO_IOMMU_TSBSZ_128K 0x0000000000070000UL /* TSB Table 128k 8-byte entries */ +#define SCHIZO_IOMMU_CTRL_RESV2 0x000000000000fff8UL /* Reserved */ +#define SCHIZO_IOMMU_CTRL_TBWSZ 0x0000000000000004UL /* Assumed page size, 0=8k 1=64k */ +#define SCHIZO_IOMMU_CTRL_DENAB 0x0000000000000002UL /* Diagnostic mode enable */ +#define SCHIZO_IOMMU_CTRL_ENAB 0x0000000000000001UL /* IOMMU Enable */ /* Schizo config space address format is nearly identical to * that of PSYCHO: @@ -1111,9 +1111,9 @@ /* Nearly identical to PSYCHO equivalents... */ #define SCHIZO_ECC_CTRL 0x10020UL -#define SCHIZO_ECCCTRL_EE 0x8000000000000000 /* Enable ECC Checking */ -#define SCHIZO_ECCCTRL_UE 0x4000000000000000 /* Enable UE Interrupts */ -#define SCHIZO_ECCCTRL_CE 0x2000000000000000 /* Enable CE INterrupts */ +#define SCHIZO_ECCCTRL_EE 0x8000000000000000UL /* Enable ECC Checking */ +#define SCHIZO_ECCCTRL_UE 0x4000000000000000UL /* Enable UE Interrupts */ +#define SCHIZO_ECCCTRL_CE 0x2000000000000000UL /* Enable CE INterrupts */ #define SCHIZO_SAFARI_ERRCTRL 0x10008UL #define SCHIZO_SAFERRCTRL_EN 0x8000000000000000UL diff -urN linux-2.6.7-rc2/arch/sparc64/kernel/process.c linux-2.6.7-rc3/arch/sparc64/kernel/process.c --- linux-2.6.7-rc2/arch/sparc64/kernel/process.c 2004-06-07 12:54:48.753032051 -0700 +++ linux-2.6.7-rc3/arch/sparc64/kernel/process.c 2004-06-07 12:55:01.767571066 -0700 @@ -160,39 +160,43 @@ static void show_regwindow32(struct pt_regs *regs) { - struct reg_window32 *rw; + struct reg_window32 __user *rw; struct reg_window32 r_w; mm_segment_t old_fs; __asm__ __volatile__ ("flushw"); - rw = (struct reg_window32 *)((long)(unsigned)regs->u_regs[14]); + rw = (struct reg_window32 __user *)((long)(unsigned)regs->u_regs[14]); old_fs = get_fs(); set_fs (USER_DS); if (copy_from_user (&r_w, rw, sizeof(r_w))) { set_fs (old_fs); return; } - rw = &r_w; + set_fs (old_fs); printk("l0: %08x l1: %08x l2: %08x l3: %08x " "l4: %08x l5: %08x l6: %08x l7: %08x\n", - rw->locals[0], rw->locals[1], rw->locals[2], rw->locals[3], - rw->locals[4], rw->locals[5], rw->locals[6], rw->locals[7]); + r_w.locals[0], r_w.locals[1], r_w.locals[2], r_w.locals[3], + r_w.locals[4], r_w.locals[5], r_w.locals[6], r_w.locals[7]); printk("i0: %08x i1: %08x i2: %08x i3: %08x " "i4: %08x i5: %08x i6: %08x i7: %08x\n", - rw->ins[0], rw->ins[1], rw->ins[2], rw->ins[3], - rw->ins[4], rw->ins[5], rw->ins[6], rw->ins[7]); + r_w.ins[0], r_w.ins[1], r_w.ins[2], r_w.ins[3], + r_w.ins[4], r_w.ins[5], r_w.ins[6], r_w.ins[7]); } static void show_regwindow(struct pt_regs *regs) { - struct reg_window *rw; + struct reg_window __user *rw; + struct reg_window *rwk; struct reg_window r_w; mm_segment_t old_fs; if ((regs->tstate & TSTATE_PRIV) || !(test_thread_flag(TIF_32BIT))) { __asm__ __volatile__ ("flushw"); - rw = (struct reg_window *)(regs->u_regs[14] + STACK_BIAS); + rw = (struct reg_window __user *) + (regs->u_regs[14] + STACK_BIAS); + rwk = (struct reg_window *) + (regs->u_regs[14] + STACK_BIAS); if (!(regs->tstate & TSTATE_PRIV)) { old_fs = get_fs(); set_fs (USER_DS); @@ -200,7 +204,7 @@ set_fs (old_fs); return; } - rw = &r_w; + rwk = &r_w; set_fs (old_fs); } } else { @@ -208,15 +212,15 @@ return; } printk("l0: %016lx l1: %016lx l2: %016lx l3: %016lx\n", - rw->locals[0], rw->locals[1], rw->locals[2], rw->locals[3]); + rwk->locals[0], rwk->locals[1], rwk->locals[2], rwk->locals[3]); printk("l4: %016lx l5: %016lx l6: %016lx l7: %016lx\n", - rw->locals[4], rw->locals[5], rw->locals[6], rw->locals[7]); + rwk->locals[4], rwk->locals[5], rwk->locals[6], rwk->locals[7]); printk("i0: %016lx i1: %016lx i2: %016lx i3: %016lx\n", - rw->ins[0], rw->ins[1], rw->ins[2], rw->ins[3]); + rwk->ins[0], rwk->ins[1], rwk->ins[2], rwk->ins[3]); printk("i4: %016lx i5: %016lx i6: %016lx i7: %016lx\n", - rw->ins[4], rw->ins[5], rw->ins[6], rw->ins[7]); + rwk->ins[4], rwk->ins[5], rwk->ins[6], rwk->ins[7]); if (regs->tstate & TSTATE_PRIV) - print_symbol("I7: <%s>\n", rw->ins[7]); + print_symbol("I7: <%s>\n", rwk->ins[7]); } void show_stackframe(struct sparc_stackf *sf) @@ -471,10 +475,10 @@ if (!(test_thread_flag(TIF_32BIT))) { csp += STACK_BIAS; psp += STACK_BIAS; - __get_user(fp, &(((struct reg_window *)psp)->ins[6])); + __get_user(fp, &(((struct reg_window __user *)psp)->ins[6])); fp += STACK_BIAS; } else - __get_user(fp, &(((struct reg_window32 *)psp)->ins[6])); + __get_user(fp, &(((struct reg_window32 __user *)psp)->ins[6])); /* Now 8-byte align the stack as this is mandatory in the * Sparc ABI due to how register windows work. This hides @@ -487,11 +491,12 @@ if (copy_in_user((void __user *) rval, (void __user *) psp, distance)) rval = 0; else if (test_thread_flag(TIF_32BIT)) { - if (put_user(((u32)csp), &(((struct reg_window32 *)rval)->ins[6]))) + if (put_user(((u32)csp), + &(((struct reg_window32 __user *)rval)->ins[6]))) rval = 0; } else { if (put_user(((u64)csp - STACK_BIAS), - &(((struct reg_window *)rval)->ins[6]))) + &(((struct reg_window __user *)rval)->ins[6]))) rval = 0; else rval = rval - STACK_BIAS; @@ -533,7 +538,7 @@ unsigned long sp = (t->rwbuf_stkptrs[window] + bias); struct reg_window *rwin = &t->reg_window[window]; - if (!copy_to_user((char *)sp, rwin, winsize)) { + if (!copy_to_user((char __user *)sp, rwin, winsize)) { shift_window_buffer(window, get_thread_wsaved() - 1, t); set_thread_wsaved(get_thread_wsaved() - 1); } @@ -562,7 +567,7 @@ unsigned long sp = (t->rwbuf_stkptrs[window] + bias); struct reg_window *rwin = &t->reg_window[window]; - if (copy_to_user((char *)sp, rwin, winsize)) + if (copy_to_user((char __user *)sp, rwin, winsize)) goto barf; } while (window--); } @@ -574,26 +579,26 @@ do_exit(SIGILL); } -asmlinkage int sparc_do_fork(unsigned long clone_flags, - unsigned long stack_start, - struct pt_regs *regs, - unsigned long stack_size) +asmlinkage long sparc_do_fork(unsigned long clone_flags, + unsigned long stack_start, + struct pt_regs *regs, + unsigned long stack_size) { - unsigned long parent_tid_ptr, child_tid_ptr; + int __user *parent_tid_ptr, *child_tid_ptr; clone_flags &= ~CLONE_IDLETASK; - parent_tid_ptr = regs->u_regs[UREG_I2]; - child_tid_ptr = regs->u_regs[UREG_I4]; if (test_thread_flag(TIF_32BIT)) { - parent_tid_ptr &= 0xffffffff; - child_tid_ptr &= 0xffffffff; + parent_tid_ptr = compat_ptr(regs->u_regs[UREG_I2]); + child_tid_ptr = compat_ptr(regs->u_regs[UREG_I4]); + } else { + parent_tid_ptr = (int __user *) regs->u_regs[UREG_I2]; + child_tid_ptr = (int __user *) regs->u_regs[UREG_I4]; } return do_fork(clone_flags, stack_start, regs, stack_size, - (int *) parent_tid_ptr, - (int *) child_tid_ptr); + parent_tid_ptr, child_tid_ptr); } /* Copy a Sparc thread. The fork() return value conventions @@ -694,24 +699,24 @@ * So we stash 'fn' and 'arg' into global registers which * will not be modified by the parent. */ - __asm__ __volatile("mov %4, %%g2\n\t" /* Save FN into global */ - "mov %5, %%g3\n\t" /* Save ARG into global */ - "mov %1, %%g1\n\t" /* Clone syscall nr. */ - "mov %2, %%o0\n\t" /* Clone flags. */ - "mov 0, %%o1\n\t" /* usp arg == 0 */ - "t 0x6d\n\t" /* Linux/Sparc clone(). */ - "brz,a,pn %%o1, 1f\n\t" /* Parent, just return. */ - " mov %%o0, %0\n\t" - "jmpl %%g2, %%o7\n\t" /* Call the function. */ - " mov %%g3, %%o0\n\t" /* Set arg in delay. */ - "mov %3, %%g1\n\t" - "t 0x6d\n\t" /* Linux/Sparc exit(). */ - /* Notreached by child. */ - "1:" : - "=r" (retval) : - "i" (__NR_clone), "r" (flags | CLONE_VM | CLONE_UNTRACED), - "i" (__NR_exit), "r" (fn), "r" (arg) : - "g1", "g2", "g3", "o0", "o1", "memory", "cc"); + __asm__ __volatile__("mov %4, %%g2\n\t" /* Save FN into global */ + "mov %5, %%g3\n\t" /* Save ARG into global */ + "mov %1, %%g1\n\t" /* Clone syscall nr. */ + "mov %2, %%o0\n\t" /* Clone flags. */ + "mov 0, %%o1\n\t" /* usp arg == 0 */ + "t 0x6d\n\t" /* Linux/Sparc clone(). */ + "brz,a,pn %%o1, 1f\n\t" /* Parent, just return. */ + " mov %%o0, %0\n\t" + "jmpl %%g2, %%o7\n\t" /* Call the function. */ + " mov %%g3, %%o0\n\t" /* Set arg in delay. */ + "mov %3, %%g1\n\t" + "t 0x6d\n\t" /* Linux/Sparc exit(). */ + /* Notreached by child. */ + "1:" : + "=r" (retval) : + "i" (__NR_clone), "r" (flags | CLONE_VM | CLONE_UNTRACED), + "i" (__NR_exit), "r" (fn), "r" (arg) : + "g1", "g2", "g3", "o0", "o1", "memory", "cc"); return retval; } @@ -806,12 +811,15 @@ if (regs->u_regs[UREG_G1] == 0) base = 1; - filename = getname((char *)regs->u_regs[base + UREG_I0]); + filename = getname((char __user *)regs->u_regs[base + UREG_I0]); error = PTR_ERR(filename); if (IS_ERR(filename)) goto out; - error = do_execve(filename, (char **) regs->u_regs[base + UREG_I1], - (char **) regs->u_regs[base + UREG_I2], regs); + error = do_execve(filename, + (char __user * __user *) + regs->u_regs[base + UREG_I1], + (char __user * __user *) + regs->u_regs[base + UREG_I2], regs); putname(filename); if (!error) { fprs_write(0); diff -urN linux-2.6.7-rc2/arch/sparc64/kernel/ptrace.c linux-2.6.7-rc3/arch/sparc64/kernel/ptrace.c --- linux-2.6.7-rc2/arch/sparc64/kernel/ptrace.c 2004-05-09 19:33:21.000000000 -0700 +++ linux-2.6.7-rc3/arch/sparc64/kernel/ptrace.c 2004-06-07 12:55:01.768571108 -0700 @@ -53,11 +53,15 @@ pt_succ_return_linux(struct pt_regs *regs, unsigned long value, long *addr) { if (test_thread_flag(TIF_32BIT)) { - if (put_user(value, (unsigned int *)addr)) - return pt_error_return(regs, EFAULT); + if (put_user(value, (unsigned int __user *) addr)) { + pt_error_return(regs, EFAULT); + return; + } } else { - if (put_user(value, addr)) - return pt_error_return(regs, EFAULT); + if (put_user(value, (long __user *) addr)) { + pt_error_return(regs, EFAULT); + return; + } } regs->u_regs[UREG_I0] = 0; regs->tstate &= ~(TSTATE_ICARRY | TSTATE_XCARRY); @@ -253,7 +257,8 @@ } case PTRACE_GETREGS: { - struct pt_regs32 *pregs = (struct pt_regs32 *) addr; + struct pt_regs32 __user *pregs = + (struct pt_regs32 __user *) addr; struct pt_regs *cregs = child->thread_info->kregs; int rval; @@ -277,7 +282,7 @@ } case PTRACE_GETREGS64: { - struct pt_regs *pregs = (struct pt_regs *) addr; + struct pt_regs __user *pregs = (struct pt_regs __user *) addr; struct pt_regs *cregs = child->thread_info->kregs; unsigned long tpc = cregs->tpc; int rval; @@ -304,7 +309,8 @@ } case PTRACE_SETREGS: { - struct pt_regs32 *pregs = (struct pt_regs32 *) addr; + struct pt_regs32 __user *pregs = + (struct pt_regs32 __user *) addr; struct pt_regs *cregs = child->thread_info->kregs; unsigned int psr, pc, npc, y; int i; @@ -337,7 +343,7 @@ } case PTRACE_SETREGS64: { - struct pt_regs *pregs = (struct pt_regs *) addr; + struct pt_regs __user *pregs = (struct pt_regs __user *) addr; struct pt_regs *cregs = child->thread_info->kregs; unsigned long tstate, tpc, tnpc, y; int i; @@ -385,7 +391,8 @@ unsigned int insnaddr; unsigned int insn; } fpq[16]; - } *fps = (struct fps *) addr; + }; + struct fps __user *fps = (struct fps __user *) addr; unsigned long *fpregs = child->thread_info->fpregs; if (copy_to_user(&fps->regs[0], fpregs, @@ -406,7 +413,8 @@ struct fps { unsigned int regs[64]; unsigned long fsr; - } *fps = (struct fps *) addr; + }; + struct fps __user *fps = (struct fps __user *) addr; unsigned long *fpregs = child->thread_info->fpregs; if (copy_to_user(&fps->regs[0], fpregs, @@ -430,7 +438,8 @@ unsigned int insnaddr; unsigned int insn; } fpq[16]; - } *fps = (struct fps *) addr; + }; + struct fps __user *fps = (struct fps __user *) addr; unsigned long *fpregs = child->thread_info->fpregs; unsigned fsr; @@ -453,7 +462,8 @@ struct fps { unsigned int regs[64]; unsigned long fsr; - } *fps = (struct fps *) addr; + }; + struct fps __user *fps = (struct fps __user *) addr; unsigned long *fpregs = child->thread_info->fpregs; if (copy_from_user(fpregs, &fps->regs[0], @@ -472,7 +482,7 @@ case PTRACE_READTEXT: case PTRACE_READDATA: { int res = ptrace_readdata(child, addr, - (void *)addr2, data); + (char __user *)addr2, data); if (res == data) { pt_succ_return(regs, 0); goto flush_and_out; @@ -485,7 +495,7 @@ case PTRACE_WRITETEXT: case PTRACE_WRITEDATA: { - int res = ptrace_writedata(child, (void *) addr2, + int res = ptrace_writedata(child, (char __user *) addr2, addr, data); if (res == data) { pt_succ_return(regs, 0); diff -urN linux-2.6.7-rc2/arch/sparc64/kernel/sbus.c linux-2.6.7-rc3/arch/sparc64/kernel/sbus.c --- linux-2.6.7-rc2/arch/sparc64/kernel/sbus.c 2004-05-09 19:33:21.000000000 -0700 +++ linux-2.6.7-rc3/arch/sparc64/kernel/sbus.c 2004-06-07 12:55:01.769571149 -0700 @@ -810,17 +810,17 @@ /* Error interrupt handling. */ #define SYSIO_UE_AFSR 0x0030UL #define SYSIO_UE_AFAR 0x0038UL -#define SYSIO_UEAFSR_PPIO 0x8000000000000000 /* Primary PIO is cause */ -#define SYSIO_UEAFSR_PDRD 0x4000000000000000 /* Primary DVMA read is cause */ -#define SYSIO_UEAFSR_PDWR 0x2000000000000000 /* Primary DVMA write is cause */ -#define SYSIO_UEAFSR_SPIO 0x1000000000000000 /* Secondary PIO is cause */ -#define SYSIO_UEAFSR_SDRD 0x0800000000000000 /* Secondary DVMA read is cause */ -#define SYSIO_UEAFSR_SDWR 0x0400000000000000 /* Secondary DVMA write is cause*/ -#define SYSIO_UEAFSR_RESV1 0x03ff000000000000 /* Reserved */ -#define SYSIO_UEAFSR_DOFF 0x0000e00000000000 /* Doubleword Offset */ -#define SYSIO_UEAFSR_SIZE 0x00001c0000000000 /* Bad transfer size is 2**SIZE */ -#define SYSIO_UEAFSR_MID 0x000003e000000000 /* UPA MID causing the fault */ -#define SYSIO_UEAFSR_RESV2 0x0000001fffffffff /* Reserved */ +#define SYSIO_UEAFSR_PPIO 0x8000000000000000UL /* Primary PIO cause */ +#define SYSIO_UEAFSR_PDRD 0x4000000000000000UL /* Primary DVMA read cause */ +#define SYSIO_UEAFSR_PDWR 0x2000000000000000UL /* Primary DVMA write cause */ +#define SYSIO_UEAFSR_SPIO 0x1000000000000000UL /* Secondary PIO is cause */ +#define SYSIO_UEAFSR_SDRD 0x0800000000000000UL /* Secondary DVMA read cause */ +#define SYSIO_UEAFSR_SDWR 0x0400000000000000UL /* Secondary DVMA write cause*/ +#define SYSIO_UEAFSR_RESV1 0x03ff000000000000UL /* Reserved */ +#define SYSIO_UEAFSR_DOFF 0x0000e00000000000UL /* Doubleword Offset */ +#define SYSIO_UEAFSR_SIZE 0x00001c0000000000UL /* Bad transfer size 2^SIZE */ +#define SYSIO_UEAFSR_MID 0x000003e000000000UL /* UPA MID causing the fault */ +#define SYSIO_UEAFSR_RESV2 0x0000001fffffffffUL /* Reserved */ static irqreturn_t sysio_ue_handler(int irq, void *dev_id, struct pt_regs *regs) { struct sbus_bus *sbus = dev_id; @@ -881,18 +881,18 @@ #define SYSIO_CE_AFSR 0x0040UL #define SYSIO_CE_AFAR 0x0048UL -#define SYSIO_CEAFSR_PPIO 0x8000000000000000 /* Primary PIO is cause */ -#define SYSIO_CEAFSR_PDRD 0x4000000000000000 /* Primary DVMA read is cause */ -#define SYSIO_CEAFSR_PDWR 0x2000000000000000 /* Primary DVMA write is cause */ -#define SYSIO_CEAFSR_SPIO 0x1000000000000000 /* Secondary PIO is cause */ -#define SYSIO_CEAFSR_SDRD 0x0800000000000000 /* Secondary DVMA read is cause */ -#define SYSIO_CEAFSR_SDWR 0x0400000000000000 /* Secondary DVMA write is cause*/ -#define SYSIO_CEAFSR_RESV1 0x0300000000000000 /* Reserved */ -#define SYSIO_CEAFSR_ESYND 0x00ff000000000000 /* Syndrome Bits */ -#define SYSIO_CEAFSR_DOFF 0x0000e00000000000 /* Double Offset */ -#define SYSIO_CEAFSR_SIZE 0x00001c0000000000 /* Bad transfer size is 2**SIZE */ -#define SYSIO_CEAFSR_MID 0x000003e000000000 /* UPA MID causing the fault */ -#define SYSIO_CEAFSR_RESV2 0x0000001fffffffff /* Reserved */ +#define SYSIO_CEAFSR_PPIO 0x8000000000000000UL /* Primary PIO cause */ +#define SYSIO_CEAFSR_PDRD 0x4000000000000000UL /* Primary DVMA read cause */ +#define SYSIO_CEAFSR_PDWR 0x2000000000000000UL /* Primary DVMA write cause */ +#define SYSIO_CEAFSR_SPIO 0x1000000000000000UL /* Secondary PIO cause */ +#define SYSIO_CEAFSR_SDRD 0x0800000000000000UL /* Secondary DVMA read cause */ +#define SYSIO_CEAFSR_SDWR 0x0400000000000000UL /* Secondary DVMA write cause*/ +#define SYSIO_CEAFSR_RESV1 0x0300000000000000UL /* Reserved */ +#define SYSIO_CEAFSR_ESYND 0x00ff000000000000UL /* Syndrome Bits */ +#define SYSIO_CEAFSR_DOFF 0x0000e00000000000UL /* Double Offset */ +#define SYSIO_CEAFSR_SIZE 0x00001c0000000000UL /* Bad transfer size 2^SIZE */ +#define SYSIO_CEAFSR_MID 0x000003e000000000UL /* UPA MID causing the fault */ +#define SYSIO_CEAFSR_RESV2 0x0000001fffffffffUL /* Reserved */ static irqreturn_t sysio_ce_handler(int irq, void *dev_id, struct pt_regs *regs) { struct sbus_bus *sbus = dev_id; @@ -958,18 +958,18 @@ #define SYSIO_SBUS_AFSR 0x2010UL #define SYSIO_SBUS_AFAR 0x2018UL -#define SYSIO_SBAFSR_PLE 0x8000000000000000 /* Primary Late PIO Error */ -#define SYSIO_SBAFSR_PTO 0x4000000000000000 /* Primary SBUS Timeout */ -#define SYSIO_SBAFSR_PBERR 0x2000000000000000 /* Primary SBUS Error ACK */ -#define SYSIO_SBAFSR_SLE 0x1000000000000000 /* Secondary Late PIO Error */ -#define SYSIO_SBAFSR_STO 0x0800000000000000 /* Secondary SBUS Timeout */ -#define SYSIO_SBAFSR_SBERR 0x0400000000000000 /* Secondary SBUS Error ACK */ -#define SYSIO_SBAFSR_RESV1 0x03ff000000000000 /* Reserved */ -#define SYSIO_SBAFSR_RD 0x0000800000000000 /* Primary was late PIO read */ -#define SYSIO_SBAFSR_RESV2 0x0000600000000000 /* Reserved */ -#define SYSIO_SBAFSR_SIZE 0x00001c0000000000 /* Size of transfer */ -#define SYSIO_SBAFSR_MID 0x000003e000000000 /* MID causing the error */ -#define SYSIO_SBAFSR_RESV3 0x0000001fffffffff /* Reserved */ +#define SYSIO_SBAFSR_PLE 0x8000000000000000UL /* Primary Late PIO Error */ +#define SYSIO_SBAFSR_PTO 0x4000000000000000UL /* Primary SBUS Timeout */ +#define SYSIO_SBAFSR_PBERR 0x2000000000000000UL /* Primary SBUS Error ACK */ +#define SYSIO_SBAFSR_SLE 0x1000000000000000UL /* Secondary Late PIO Error */ +#define SYSIO_SBAFSR_STO 0x0800000000000000UL /* Secondary SBUS Timeout */ +#define SYSIO_SBAFSR_SBERR 0x0400000000000000UL /* Secondary SBUS Error ACK */ +#define SYSIO_SBAFSR_RESV1 0x03ff000000000000UL /* Reserved */ +#define SYSIO_SBAFSR_RD 0x0000800000000000UL /* Primary was late PIO read */ +#define SYSIO_SBAFSR_RESV2 0x0000600000000000UL /* Reserved */ +#define SYSIO_SBAFSR_SIZE 0x00001c0000000000UL /* Size of transfer */ +#define SYSIO_SBAFSR_MID 0x000003e000000000UL /* MID causing the error */ +#define SYSIO_SBAFSR_RESV3 0x0000001fffffffffUL /* Reserved */ static irqreturn_t sysio_sbus_error_handler(int irq, void *dev_id, struct pt_regs *regs) { struct sbus_bus *sbus = dev_id; @@ -1030,9 +1030,9 @@ } #define ECC_CONTROL 0x0020UL -#define SYSIO_ECNTRL_ECCEN 0x8000000000000000 /* Enable ECC Checking */ -#define SYSIO_ECNTRL_UEEN 0x4000000000000000 /* Enable UE Interrupts */ -#define SYSIO_ECNTRL_CEEN 0x2000000000000000 /* Enable CE Interrupts */ +#define SYSIO_ECNTRL_ECCEN 0x8000000000000000UL /* Enable ECC Checking */ +#define SYSIO_ECNTRL_UEEN 0x4000000000000000UL /* Enable UE Interrupts */ +#define SYSIO_ECNTRL_CEEN 0x2000000000000000UL /* Enable CE Interrupts */ #define SYSIO_UE_INO 0x34 #define SYSIO_CE_INO 0x35 diff -urN linux-2.6.7-rc2/arch/sparc64/kernel/setup.c linux-2.6.7-rc3/arch/sparc64/kernel/setup.c --- linux-2.6.7-rc2/arch/sparc64/kernel/setup.c 2004-05-09 19:32:27.000000000 -0700 +++ linux-2.6.7-rc3/arch/sparc64/kernel/setup.c 2004-06-07 12:55:01.770571190 -0700 @@ -293,7 +293,7 @@ unsigned long tte; tte = args[3]; - prom_printf("%lx ", (tte & 0x07FC000000000000) >> 50); + prom_printf("%lx ", (tte & 0x07FC000000000000UL) >> 50); args[2] = 2; args[args[1] + 3] = 0; diff -urN linux-2.6.7-rc2/arch/sparc64/kernel/signal.c linux-2.6.7-rc3/arch/sparc64/kernel/signal.c --- linux-2.6.7-rc2/arch/sparc64/kernel/signal.c 2004-05-09 19:32:38.000000000 -0700 +++ linux-2.6.7-rc3/arch/sparc64/kernel/signal.c 2004-06-07 12:55:01.770571190 -0700 @@ -42,7 +42,8 @@ /* {set, get}context() needed for 64-bit SparcLinux userland. */ asmlinkage void sparc64_set_context(struct pt_regs *regs) { - struct ucontext *ucp = (struct ucontext __user *) regs->u_regs[UREG_I0]; + struct ucontext __user *ucp = (struct ucontext __user *) + regs->u_regs[UREG_I0]; mc_gregset_t __user *grp; unsigned long pc, npc, tstate; unsigned long fp, i7; @@ -139,7 +140,8 @@ asmlinkage void sparc64_get_context(struct pt_regs *regs) { - struct ucontext *ucp = (struct ucontext __user *) regs->u_regs[UREG_I0]; + struct ucontext __user *ucp = (struct ucontext __user *) + regs->u_regs[UREG_I0]; mc_gregset_t __user *grp; mcontext_t __user *mcp; unsigned long fp, i7; @@ -427,7 +429,7 @@ call it and ignore errors. */ old_fs = get_fs(); set_fs(KERNEL_DS); - do_sigaltstack(&st, NULL, (unsigned long)sf); + do_sigaltstack((const stack_t __user *) &st, NULL, (unsigned long)sf); set_fs(old_fs); sigdelsetmask(&set, ~_BLOCKABLE); diff -urN linux-2.6.7-rc2/arch/sparc64/kernel/signal32.c linux-2.6.7-rc3/arch/sparc64/kernel/signal32.c --- linux-2.6.7-rc2/arch/sparc64/kernel/signal32.c 2004-05-09 19:31:56.000000000 -0700 +++ linux-2.6.7-rc3/arch/sparc64/kernel/signal32.c 2004-06-07 12:55:01.771571232 -0700 @@ -345,8 +345,10 @@ current_thread_info()->restart_block.fn = do_no_restart_syscall; synchronize_user_stack(); - if (test_thread_flag(TIF_NEWSIGNALS)) - return do_new_sigreturn32(regs); + if (test_thread_flag(TIF_NEWSIGNALS)) { + do_new_sigreturn32(regs); + return; + } scptr = (struct sigcontext32 __user *) (regs->u_regs[UREG_I0] & 0x00000000ffffffffUL); @@ -469,7 +471,7 @@ call it and ignore errors. */ old_fs = get_fs(); set_fs(KERNEL_DS); - do_sigaltstack(&st, NULL, (unsigned long)sf); + do_sigaltstack((stack_t __user *) &st, NULL, (unsigned long)sf); set_fs(old_fs); switch (_NSIG_WORDS) { @@ -1039,7 +1041,7 @@ call it and ignore errors. */ old_fs = get_fs(); set_fs(KERNEL_DS); - do_sigaltstack(&st, NULL, regs->u_regs[UREG_I6]); + do_sigaltstack((stack_t __user *) &st, NULL, regs->u_regs[UREG_I6]); set_fs(old_fs); sigdelsetmask(&set, ~_BLOCKABLE); @@ -1347,7 +1349,7 @@ return ret; } -asmlinkage int do_sys32_sigaltstack(u32 ussa, u32 uossa, unsigned long sp) +asmlinkage long do_sys32_sigaltstack(u32 ussa, u32 uossa, unsigned long sp) { stack_t uss, uoss; u32 u_ss_sp = 0; @@ -1361,7 +1363,8 @@ uss.ss_sp = (void *) (long) u_ss_sp; old_fs = get_fs(); set_fs(KERNEL_DS); - ret = do_sigaltstack(ussa ? &uss : NULL, uossa ? &uoss : NULL, sp); + ret = do_sigaltstack(ussa ? (stack_t __user *) &uss : NULL, + uossa ? (stack_t __user *) &uoss : NULL, sp); set_fs(old_fs); if (!ret && uossa && (put_user((long)uoss.ss_sp, &((stack_t32 __user *)(long)uossa)->ss_sp) || __put_user(uoss.ss_flags, &((stack_t32 __user *)(long)uossa)->ss_flags) || diff -urN linux-2.6.7-rc2/arch/sparc64/kernel/sunos_ioctl32.c linux-2.6.7-rc3/arch/sparc64/kernel/sunos_ioctl32.c --- linux-2.6.7-rc2/arch/sparc64/kernel/sunos_ioctl32.c 2004-05-09 19:33:20.000000000 -0700 +++ linux-2.6.7-rc3/arch/sparc64/kernel/sunos_ioctl32.c 2004-06-07 12:55:01.773571315 -0700 @@ -26,15 +26,6 @@ #include #include -/* Use this to get at 32-bit user passed pointers. */ -#define A(__x) \ -({ unsigned long __ret; \ - __asm__ ("srl %0, 0, %0" \ - : "=r" (__ret) \ - : "0" (__x)); \ - __ret; \ -}) - #define SUNOS_NR_OPEN 256 struct rtentry32 { @@ -104,10 +95,11 @@ if(cmd == TIOCSETD) { mm_segment_t old_fs = get_fs(); - int *p, ntty = N_TTY; + int __user *p; + int ntty = N_TTY; int tmp; - p = (int *)A(arg); + p = (int __user *) (unsigned long) arg; ret = -EFAULT; if(get_user(tmp, p)) goto out; @@ -237,10 +229,10 @@ /* Non posix grp */ case _IOW('t', 118, int): { - int oldval, newval, *ptr; + int oldval, newval, __user *ptr; cmd = TIOCSPGRP; - ptr = (int *) A(arg); + ptr = (int __user *) (unsigned long) arg; ret = -EFAULT; if(get_user(oldval, ptr)) goto out; @@ -256,10 +248,10 @@ } case _IOR('t', 119, int): { - int oldval, newval, *ptr; + int oldval, newval, __user *ptr; cmd = TIOCGPGRP; - ptr = (int *) A(arg); + ptr = (int __user *) (unsigned long) arg; ret = -EFAULT; if(get_user(oldval, ptr)) goto out; diff -urN linux-2.6.7-rc2/arch/sparc64/kernel/sys32.S linux-2.6.7-rc3/arch/sparc64/kernel/sys32.S --- linux-2.6.7-rc2/arch/sparc64/kernel/sys32.S 2004-06-07 12:54:48.755032134 -0700 +++ linux-2.6.7-rc3/arch/sparc64/kernel/sys32.S 2004-06-07 12:55:01.774571356 -0700 @@ -13,85 +13,135 @@ .text - .align 32 - .globl sys32_mmap -sys32_mmap: - srl %o4, 0, %o4 - sethi %hi(sys_mmap), %g1 - jmpl %g1 + %lo(sys_mmap), %g0 - srl %o5, 0, %o5 - - .align 32 - .globl sys32_lseek - .globl sys32_chmod, sys32_mknod -sys32_lseek: - sra %o1, 0, %o1 - sethi %hi(sys_lseek), %g1 - jmpl %g1 + %lo(sys_lseek), %g0 - nop -sys32_chmod: - sethi %hi(0xffff), %g2 - sethi %hi(sys_chmod), %g1 - orcc %g2, %lo(0xffff), %g2 - jmpl %g1 + %lo(sys_chmod), %g0 - and %o1, %g2, %o1 -sys32_mknod: - sethi %hi(0xffff), %g2 - sethi %hi(sys_mknod), %g1 - orcc %g2, %lo(0xffff), %g2 - jmpl %g1 + %lo(sys_mknod), %g0 - and %o2, %g2, %o2 +#define SIGN1(STUB,SYSCALL,REG1) \ + .align 32; \ + .globl STUB; \ +STUB: sethi %hi(SYSCALL), %g1; \ + jmpl %g1 + %lo(SYSCALL), %g0; \ + sra REG1, 0, REG1 + +#define SIGN2(STUB,SYSCALL,REG1,REG2) \ + .align 32; \ + .globl STUB; \ +STUB: sethi %hi(SYSCALL), %g1; \ + sra REG1, 0, REG1; \ + jmpl %g1 + %lo(SYSCALL), %g0; \ + sra REG2, 0, REG2 + +#define SIGN3(STUB,SYSCALL,REG1,REG2,REG3) \ + .align 32; \ + .globl STUB; \ +STUB: sra REG1, 0, REG1; \ + sethi %hi(SYSCALL), %g1; \ + sra REG2, 0, REG2; \ + jmpl %g1 + %lo(SYSCALL), %g0; \ + sra REG3, 0, REG3 + +#define SIGN4(STUB,SYSCALL,REG1,REG2,REG3,REG4) \ + .align 32; \ + .globl STUB; \ +STUB: sra REG1, 0, REG1; \ + sethi %hi(SYSCALL), %g1; \ + sra REG2, 0, REG2; \ + sra REG3, 0, REG3; \ + jmpl %g1 + %lo(SYSCALL), %g0; \ + sra REG4, 0, REG4 + +SIGN1(sys32_exit, sparc_exit, %o0) +SIGN1(sys32_exit_group, sys_exit_group, %o0) +SIGN1(sys32_wait4, compat_sys_wait4, %o2) +SIGN1(sys32_creat, sys_creat, %o1) +SIGN1(sys32_mknod, sys_mknod, %o1) +SIGN1(sys32_perfctr, sys_perfctr, %o0) +SIGN1(sys32_umount, sys_umount, %o1) +SIGN1(sys32_signal, sys_signal, %o0) +SIGN1(sys32_access, sys_access, %o1) +SIGN1(sys32_msync, sys_msync, %o2) +SIGN2(sys32_reboot, sys_reboot, %o0, %o1) +SIGN1(sys32_setitimer, compat_sys_setitimer, %o0) +SIGN1(sys32_getitimer, compat_sys_getitimer, %o0) +SIGN1(sys32_sethostname, sys_sethostname, %o1) +SIGN1(sys32_swapon, sys_swapon, %o1) +SIGN1(sys32_sigaction, compat_sys_sigaction, %o0) +SIGN1(sys32_rt_sigaction, compat_sys_rt_sigaction, %o0) +SIGN1(sys32_sigprocmask, compat_sys_sigprocmask, %o0) +SIGN1(sys32_rt_sigprocmask, compat_sys_rt_sigprocmask, %o0) +SIGN2(sys32_rt_sigqueueinfo, compat_sys_rt_sigqueueinfo, %o0, %o1) +SIGN1(sys32_getrusage, compat_sys_getrusage, %o0) +SIGN1(sys32_setxattr, sys_setxattr, %o4) +SIGN1(sys32_lsetxattr, sys_lsetxattr, %o4) +SIGN1(sys32_fsetxattr, sys_fsetxattr, %o4) +SIGN1(sys32_fgetxattr, sys_fgetxattr, %o0) +SIGN1(sys32_flistxattr, sys_flistxattr, %o0) +SIGN1(sys32_fremovexattr, sys_fremovexattr, %o0) +SIGN2(sys32_tkill, sys_tkill, %o0, %o1) +SIGN1(sys32_epoll_create, sys_epoll_create, %o0) +SIGN3(sys32_epoll_ctl, sys_epoll_ctl, %o0, %o1, %o2) +SIGN3(sys32_epoll_wait, sys_epoll_wait, %o0, %o2, %o3) +SIGN1(sys32_readahead, compat_sys_readahead, %o0) +SIGN2(sys32_fadvise64, compat_sys_fadvise64, %o0, %o4) +SIGN2(sys32_fadvise64_64, compat_sys_fadvise64_64, %o0, %o5) +SIGN2(sys32_bdflush, sys_bdflush, %o0, %o1) +SIGN1(sys32_mlockall, sys_mlockall, %o0) +SIGN1(sys32_nfsservctl, compat_sys_nfsservctl, %o0) +SIGN1(sys32_clock_settime, compat_clock_settime, %o1) +SIGN1(sys32_clock_nanosleep, compat_clock_nanosleep, %o1) +SIGN1(sys32_timer_settime, compat_timer_settime, %o1) +SIGN1(sys32_io_submit, compat_sys_io_submit, %o1) +SIGN1(sys32_mq_open, compat_sys_mq_open, %o1) +SIGN1(sys32_select, compat_sys_select, %o0) +SIGN1(sys32_mkdir, sys_mkdir, %o1) +SIGN3(sys32_futex, compat_sys_futex, %o1, %o2, %o5) +SIGN1(sys32_sysfs, compat_sys_sysfs, %o0) +SIGN3(sys32_ipc, compat_sys_ipc, %o1, %o2, %o3) +SIGN2(sys32_sendfile, compat_sys_sendfile, %o0, %o1) +SIGN2(sys32_sendfile64, compat_sys_sendfile64, %o0, %o1) +SIGN1(sys32_prctl, sys_prctl, %o0) +SIGN1(sys32_sched_rr_get_interval, compat_sys_sched_rr_get_interval, %o0) +SIGN2(sys32_waitpid, sys_waitpid, %o0, %o2) +SIGN1(sys32_getgroups, sys_getgroups, %o0) +SIGN1(sys32_getpgid, sys_getpgid, %o0) +SIGN2(sys32_getpriority, sys_getpriority, %o0, %o1) +SIGN1(sys32_getsid, sys_getsid, %o0) +SIGN2(sys32_kill, sys_kill, %o0, %o1) +SIGN1(sys32_nice, sys_nice, %o0) +SIGN1(sys32_lseek, sys_lseek, %o1) +SIGN2(sys32_open, sparc32_open, %o1, %o2) +SIGN1(sys32_readlink, sys_readlink, %o2) +SIGN1(sys32_sched_get_priority_max, sys_sched_get_priority_max, %o0) +SIGN1(sys32_sched_get_priority_min, sys_sched_get_priority_min, %o0) +SIGN1(sys32_sched_getparam, sys_sched_getparam, %o0) +SIGN1(sys32_sched_getscheduler, sys_sched_getscheduler, %o0) +SIGN1(sys32_sched_setparam, sys_sched_setparam, %o0) +SIGN2(sys32_sched_setscheduler, sys_sched_setscheduler, %o0, %o1) +SIGN1(sys32_getdomainname, sys_getdomainname, %o1) +SIGN1(sys32_setdomainname, sys_setdomainname, %o1) +SIGN1(sys32_setgroups, sys_setgroups, %o0) +SIGN2(sys32_setpgid, sys_setpgid, %o0, %o1) +SIGN3(sys32_setpriority, sys_setpriority, %o0, %o1, %o2) +SIGN1(sys32_ssetmask, sys_ssetmask, %o0) +SIGN2(sys32_syslog, sys_syslog, %o0, %o1) +SIGN1(sys32_umask, sys_umask, %o0) +SIGN3(sys32_tgkill, sys_tgkill, %o0, %o1, %o2) +SIGN1(sys32_sendto, sys_sendto, %o0) +SIGN1(sys32_recvfrom, sys_recvfrom, %o0) +SIGN3(sys32_socket, sys_socket, %o0, %o1, %o2) +SIGN2(sys32_connect, sys_connect, %o0, %o2) +SIGN2(sys32_bind, sys_bind, %o0, %o2) +SIGN2(sys32_listen, sys_listen, %o0, %o1) +SIGN1(sys32_recvmsg, compat_sys_recvmsg, %o0) +SIGN1(sys32_sendmsg, compat_sys_sendmsg, %o0) +SIGN2(sys32_shutdown, sys_shutdown, %o0, %o1) +SIGN3(sys32_socketpair, sys_socketpair, %o0, %o1, %o2) +SIGN1(sys32_getpeername, sys_getpeername, %o0) +SIGN1(sys32_getsockname, sys_getsockname, %o0) - .align 32 - .globl sys32_sendto, sys32_recvfrom -sys32_sendto: - sethi %hi(sys_sendto), %g1 - jmpl %g1 + %lo(sys_sendto), %g0 - srl %o4, 0, %o4 -sys32_recvfrom: - srl %o4, 0, %o4 - sethi %hi(sys_recvfrom), %g1 - jmpl %g1 + %lo(sys_recvfrom), %g0 - srl %o5, 0, %o5 - - .globl sys32_bdflush -sys32_bdflush: - sethi %hi(sys_bdflush), %g1 - jmpl %g1 + %lo(sys_bdflush), %g0 - sra %o1, 0, %o1 - - .align 32 .globl sys32_mmap2 sys32_mmap2: - srl %o4, 0, %o4 sethi %hi(sys_mmap), %g1 - srl %o5, 0, %o5 jmpl %g1 + %lo(sys_mmap), %g0 sllx %o5, 12, %o5 - .globl sys32_mq_timedsend -sys32_mq_timedsend: - sethi %hi(compat_sys_mq_timedsend), %g1 - jmpl %g1 + %lo(compat_sys_mq_timedsend), %g0 - srl %o4, 0, %o4 - .globl sys32_mq_timedreceive -sys32_mq_timedreceive: - sethi %hi(compat_sys_mq_timedreceive), %g1 - jmpl %g1 + %lo(compat_sys_mq_timedreceive), %g0 - srl %o4, 0, %o4 - - .globl sys32_select -sys32_select: - sethi %hi(compat_sys_select), %g1 - jmpl %g1 + %lo(compat_sys_select), %g0 - srl %o4, 0, %o4 - - .globl sys32_futex -sys32_futex: - sethi %hi(compat_sys_futex), %g1 - jmpl %g1 + %lo(compat_sys_futex), %g0 - srl %o4, 0, %o4 - .align 32 .globl sys32_socketcall sys32_socketcall: /* %o0=call, %o1=args */ @@ -199,23 +249,23 @@ lduwa [%o1 + 0x4] %asi, %o1 nop nop -do_sys_sendto: /* sys32_sendto(int, u32, compat_size_t, unsigned int, u32, int) */ +do_sys_sendto: /* sys_sendto(int, u32, compat_size_t, unsigned int, u32, int) */ ldswa [%o1 + 0x0] %asi, %o0 - sethi %hi(sys32_sendto), %g1 + sethi %hi(sys_sendto), %g1 lduwa [%o1 + 0x8] %asi, %o2 lduwa [%o1 + 0xc] %asi, %o3 lduwa [%o1 + 0x10] %asi, %o4 ldswa [%o1 + 0x14] %asi, %o5 - jmpl %g1 + %lo(sys32_sendto), %g0 + jmpl %g1 + %lo(sys_sendto), %g0 lduwa [%o1 + 0x4] %asi, %o1 -do_sys_recvfrom: /* sys32_recvfrom(int, u32, compat_size_t, unsigned int, u32, u32) */ +do_sys_recvfrom: /* sys_recvfrom(int, u32, compat_size_t, unsigned int, u32, u32) */ ldswa [%o1 + 0x0] %asi, %o0 - sethi %hi(sys32_recvfrom), %g1 + sethi %hi(sys_recvfrom), %g1 lduwa [%o1 + 0x8] %asi, %o2 lduwa [%o1 + 0xc] %asi, %o3 lduwa [%o1 + 0x10] %asi, %o4 lduwa [%o1 + 0x14] %asi, %o5 - jmpl %g1 + %lo(sys32_recvfrom), %g0 + jmpl %g1 + %lo(sys_recvfrom), %g0 lduwa [%o1 + 0x4] %asi, %o1 do_sys_shutdown: /* sys_shutdown(int, int) */ ldswa [%o1 + 0x0] %asi, %o0 diff -urN linux-2.6.7-rc2/arch/sparc64/kernel/sys_sparc.c linux-2.6.7-rc3/arch/sparc64/kernel/sys_sparc.c --- linux-2.6.7-rc2/arch/sparc64/kernel/sys_sparc.c 2004-05-09 19:32:38.000000000 -0700 +++ linux-2.6.7-rc3/arch/sparc64/kernel/sys_sparc.c 2004-06-07 12:55:01.775571397 -0700 @@ -179,7 +179,7 @@ * sys_pipe() is the normal C calling standard for creating * a pipe. It's not the way unix traditionally does this, though. */ -asmlinkage int sparc_pipe(struct pt_regs *regs) +asmlinkage long sparc_pipe(struct pt_regs *regs) { int fd[2]; int error; @@ -199,22 +199,22 @@ * This is really horribly ugly. */ -asmlinkage int sys_ipc (unsigned call, int first, int second, unsigned long third, void *ptr, long fifth) +asmlinkage long sys_ipc(unsigned int call, int first, int second, unsigned long third, void __user *ptr, long fifth) { int err; /* No need for backward compatibility. We can start fresh... */ - - if (call <= SEMCTL) + if (call <= SEMCTL) { switch (call) { case SEMOP: - err = sys_semtimedop (first, (struct sembuf *)ptr, second, NULL); + err = sys_semtimedop(first, ptr, second, NULL); goto out; case SEMTIMEDOP: - err = sys_semtimedop (first, (struct sembuf *)ptr, second, (const struct timespec *) fifth); + err = sys_semtimedop(first, ptr, second, + (const struct timespec __user *) fifth); goto out; case SEMGET: - err = sys_semget (first, second, (int)third); + err = sys_semget(first, second, (int)third); goto out; case SEMCTL: { union semun fourth; @@ -222,79 +222,87 @@ if (!ptr) goto out; err = -EFAULT; - if(get_user(fourth.__pad, (void **)ptr)) + if (get_user(fourth.__pad, + (void __user * __user *) ptr)) goto out; - err = sys_semctl (first, second | IPC_64, (int)third, fourth); + err = sys_semctl(first, second | IPC_64, + (int)third, fourth); goto out; - } + } default: err = -ENOSYS; goto out; - } - if (call <= MSGCTL) + }; + } + if (call <= MSGCTL) { switch (call) { case MSGSND: - err = sys_msgsnd (first, (struct msgbuf *) ptr, - second, (int)third); + err = sys_msgsnd(first, ptr, second, (int)third); goto out; case MSGRCV: - err = sys_msgrcv (first, (struct msgbuf *) ptr, second, fifth, (int)third); + err = sys_msgrcv(first, ptr, second, fifth, + (int)third); goto out; case MSGGET: - err = sys_msgget ((key_t) first, second); + err = sys_msgget((key_t) first, second); goto out; case MSGCTL: - err = sys_msgctl (first, second | IPC_64, (struct msqid_ds *) ptr); + err = sys_msgctl(first, second | IPC_64, ptr); goto out; default: err = -ENOSYS; goto out; - } - if (call <= SHMCTL) + }; + } + if (call <= SHMCTL) { switch (call) { case SHMAT: { ulong raddr; - err = do_shmat (first, (char *) ptr, second, &raddr); + err = do_shmat(first, ptr, second, &raddr); if (!err) { - if (put_user(raddr, (ulong __user *) third)) + if (put_user(raddr, + (ulong __user *) third)) err = -EFAULT; } goto out; } case SHMDT: - err = sys_shmdt ((char *)ptr); + err = sys_shmdt(ptr); goto out; case SHMGET: - err = sys_shmget (first, second, (int)third); + err = sys_shmget(first, second, (int)third); goto out; case SHMCTL: - err = sys_shmctl (first, second | IPC_64, (struct shmid_ds *) ptr); + err = sys_shmctl(first, second | IPC_64, ptr); goto out; default: err = -ENOSYS; goto out; - } - else + }; + } else { err = -ENOSYS; + } out: return err; } -asmlinkage int sparc64_newuname(struct new_utsname __user *name) +asmlinkage long sparc64_newuname(struct new_utsname __user *name) { int ret = sys_newuname(name); if (current->personality == PER_LINUX32 && !ret) { - ret = copy_to_user(name->machine, "sparc\0\0", 8) ? -EFAULT : 0; + ret = (copy_to_user(name->machine, "sparc\0\0", 8) + ? -EFAULT : 0); } return ret; } -asmlinkage int sparc64_personality(unsigned long personality) +asmlinkage long sparc64_personality(unsigned long personality) { int ret; - if (current->personality == PER_LINUX32 && personality == PER_LINUX) + if (current->personality == PER_LINUX32 && + personality == PER_LINUX) personality = PER_LINUX32; ret = sys_personality(personality); if (ret == PER_LINUX32) @@ -408,8 +416,7 @@ } /* we come to here via sys_nis_syscall so it can setup the regs argument */ -asmlinkage unsigned long -c_sys_nis_syscall (struct pt_regs *regs) +asmlinkage unsigned long c_sys_nis_syscall(struct pt_regs *regs) { static int count; @@ -427,8 +434,7 @@ /* #define DEBUG_SPARC_BREAKPOINT */ -asmlinkage void -sparc_breakpoint (struct pt_regs *regs) +asmlinkage void sparc_breakpoint(struct pt_regs *regs) { siginfo_t info; @@ -452,7 +458,7 @@ extern void check_pending(int signum); -asmlinkage int sys_getdomainname(char __user *name, int len) +asmlinkage long sys_getdomainname(char __user *name, int len) { int nlen; int err = -EFAULT; @@ -473,7 +479,7 @@ return err; } -asmlinkage int solaris_syscall(struct pt_regs *regs) +asmlinkage long solaris_syscall(struct pt_regs *regs) { static int count; @@ -493,7 +499,7 @@ } #ifndef CONFIG_SUNOS_EMUL -asmlinkage int sunos_syscall(struct pt_regs *regs) +asmlinkage long sunos_syscall(struct pt_regs *regs) { static int count; @@ -511,11 +517,11 @@ } #endif -asmlinkage int sys_utrap_install(utrap_entry_t type, - utrap_handler_t new_p, - utrap_handler_t new_d, - utrap_handler_t __user *old_p, - utrap_handler_t __user *old_d) +asmlinkage long sys_utrap_install(utrap_entry_t type, + utrap_handler_t new_p, + utrap_handler_t new_d, + utrap_handler_t __user *old_p, + utrap_handler_t __user *old_d) { if (type < UT_INSTRUCTION_EXCEPTION || type > UT_TRAP_INSTRUCTION_31) return -EINVAL; @@ -582,12 +588,11 @@ return 0; } -asmlinkage long -sys_rt_sigaction(int sig, - const struct sigaction __user *act, - struct sigaction __user *oact, - void __user *restorer, - size_t sigsetsize) +asmlinkage long sys_rt_sigaction(int sig, + const struct sigaction __user *act, + struct sigaction __user *oact, + void __user *restorer, + size_t sigsetsize) { struct k_sigaction new_ka, old_ka; int ret; @@ -615,8 +620,7 @@ /* Invoked by rtrap code to update performance counters in * user space. */ -asmlinkage void -update_perfctrs(void) +asmlinkage void update_perfctrs(void) { unsigned long pic, tmp; @@ -628,16 +632,15 @@ reset_pic(); } -asmlinkage int -sys_perfctr(int opcode, unsigned long arg0, unsigned long arg1, unsigned long arg2) +asmlinkage long sys_perfctr(int opcode, unsigned long arg0, unsigned long arg1, unsigned long arg2) { int err = 0; switch(opcode) { case PERFCTR_ON: current_thread_info()->pcr_reg = arg2; - current_thread_info()->user_cntd0 = (u64 *) arg0; - current_thread_info()->user_cntd1 = (u64 *) arg1; + current_thread_info()->user_cntd0 = (u64 __user *) arg0; + current_thread_info()->user_cntd1 = (u64 __user *) arg1; current_thread_info()->kernel_cntd0 = current_thread_info()->kernel_cntd1 = 0; write_pcr(arg2); @@ -684,7 +687,8 @@ break; case PERFCTR_SETPCR: { - u64 *user_pcr = (u64 *)arg0; + u64 __user *user_pcr = (u64 __user *)arg0; + if (!test_thread_flag(TIF_PERFCTR)) { err = -EINVAL; break; @@ -698,7 +702,8 @@ } case PERFCTR_GETPCR: { - u64 *user_pcr = (u64 *)arg0; + u64 __user *user_pcr = (u64 __user *)arg0; + if (!test_thread_flag(TIF_PERFCTR)) { err = -EINVAL; break; diff -urN linux-2.6.7-rc2/arch/sparc64/kernel/sys_sparc32.c linux-2.6.7-rc3/arch/sparc64/kernel/sys_sparc32.c --- linux-2.6.7-rc2/arch/sparc64/kernel/sys_sparc32.c 2004-06-07 12:54:48.757032217 -0700 +++ linux-2.6.7-rc3/arch/sparc64/kernel/sys_sparc32.c 2004-06-07 12:55:01.780571605 -0700 @@ -62,37 +62,12 @@ #include #include -/* Use this to get at 32-bit user passed pointers. */ -/* Things to consider: the low-level assembly stub does - srl x, 0, x for first four arguments, so if you have - pointer to something in the first four arguments, just - declare it as a pointer, not u32. On the other side, - arguments from 5th onwards should be declared as u32 - for pointers, and need AA() around each usage. - A() macro should be used for places where you e.g. - have some internal variable u32 and just want to get - rid of a compiler warning. AA() has to be used in - places where you want to convert a function argument - to 32bit pointer or when you e.g. access pt_regs - structure and want to consider 32bit registers only. - -jj - */ -#define A(__x) ((unsigned long)(__x)) -#define AA(__x) \ -({ unsigned long __ret; \ - __asm__ ("srl %0, 0, %0" \ - : "=r" (__ret) \ - : "0" (__x)); \ - __ret; \ -}) - - -asmlinkage long sys32_chown16(const char * filename, u16 user, u16 group) +asmlinkage long sys32_chown16(const char __user * filename, u16 user, u16 group) { return sys_chown(filename, low2highuid(user), low2highgid(group)); } -asmlinkage long sys32_lchown16(const char * filename, u16 user, u16 group) +asmlinkage long sys32_lchown16(const char __user * filename, u16 user, u16 group) { return sys_lchown(filename, low2highuid(user), low2highgid(group)); } @@ -128,7 +103,7 @@ low2highuid(suid)); } -asmlinkage long sys32_getresuid16(u16 *ruid, u16 *euid, u16 *suid) +asmlinkage long sys32_getresuid16(u16 __user *ruid, u16 __user *euid, u16 __user *suid) { int retval; @@ -145,7 +120,7 @@ low2highgid(sgid)); } -asmlinkage long sys32_getresgid16(u16 *rgid, u16 *egid, u16 *sgid) +asmlinkage long sys32_getresgid16(u16 __user *rgid, u16 __user *egid, u16 __user *sgid) { int retval; @@ -166,7 +141,7 @@ return sys_setfsgid((gid_t)gid); } -static int groups16_to_user(u16 *grouplist, struct group_info *group_info) +static int groups16_to_user(u16 __user *grouplist, struct group_info *group_info) { int i; u16 group; @@ -180,7 +155,7 @@ return 0; } -static int groups16_from_user(struct group_info *group_info, u16 *grouplist) +static int groups16_from_user(struct group_info *group_info, u16 __user *grouplist) { int i; u16 group; @@ -194,7 +169,7 @@ return 0; } -asmlinkage long sys32_getgroups16(int gidsetsize, u16 *grouplist) +asmlinkage long sys32_getgroups16(int gidsetsize, u16 __user *grouplist) { int i; @@ -218,7 +193,7 @@ return i; } -asmlinkage long sys32_setgroups16(int gidsetsize, u16 *grouplist) +asmlinkage long sys32_setgroups16(int gidsetsize, u16 __user *grouplist) { struct group_info *group_info; int retval; @@ -265,14 +240,14 @@ /* 32-bit timeval and related flotsam. */ -static long get_tv32(struct timeval *o, struct compat_timeval *i) +static long get_tv32(struct timeval *o, struct compat_timeval __user *i) { return (!access_ok(VERIFY_READ, tv32, sizeof(*tv32)) || (__get_user(o->tv_sec, &i->tv_sec) | __get_user(o->tv_usec, &i->tv_usec))); } -static inline long put_tv32(struct compat_timeval *o, struct timeval *i) +static inline long put_tv32(struct compat_timeval __user *o, struct timeval *i) { return (!access_ok(VERIFY_WRITE, o, sizeof(*o)) || (__put_user(i->tv_sec, &o->tv_sec) | @@ -281,8 +256,7 @@ struct msgbuf32 { s32 mtype; char mtext[1]; }; -struct ipc_perm32 -{ +struct ipc_perm32 { key_t key; compat_uid_t uid; compat_gid_t gid; @@ -383,21 +357,22 @@ * This is really horribly ugly. */ #define IPCOP_MASK(__x) (1UL << ((__x)&~IPC_64)) -static int do_sys32_semctl(int first, int second, int third, void *uptr) +static int do_sys32_semctl(int first, int second, int third, + compat_uptr_t __user *uptr) { union semun fourth; - u32 pad; + compat_uptr_t pad; int err = -EINVAL; if (!uptr) goto out; err = -EFAULT; - if (get_user (pad, (u32 *)uptr)) + if (get_user(pad, uptr)) goto out; if ((third & ~IPC_64) == SETVAL) fourth.val = (int)pad; else - fourth.__pad = (void *)A(pad); + fourth.__pad = compat_ptr(pad); if (IPCOP_MASK (third) & (IPCOP_MASK (IPC_INFO) | IPCOP_MASK (SEM_INFO) | IPCOP_MASK (GETVAL) | IPCOP_MASK (GETPID) | IPCOP_MASK (GETNCNT) | IPCOP_MASK (GETZCNT) | @@ -405,7 +380,7 @@ err = sys_semctl (first, second, third, fourth); } else if (third & IPC_64) { struct semid64_ds s; - struct semid64_ds32 *usp = (struct semid64_ds32 *)A(pad); + struct semid64_ds32 __user *usp = compat_ptr(pad); mm_segment_t old_fs; int need_back_translation; @@ -415,13 +390,13 @@ err |= __get_user (s.sem_perm.mode, &usp->sem_perm.mode); if (err) goto out; - fourth.__pad = &s; + fourth.__pad = (void __user *) &s; } need_back_translation = (IPCOP_MASK (third) & (IPCOP_MASK (SEM_STAT) | IPCOP_MASK (IPC_STAT))) != 0; if (need_back_translation) - fourth.__pad = &s; + fourth.__pad = (void __user *) &s; old_fs = get_fs (); set_fs (KERNEL_DS); err = sys_semctl (first, second, third, fourth); @@ -433,7 +408,7 @@ } } else { struct semid_ds s; - struct semid_ds32 *usp = (struct semid_ds32 *)A(pad); + struct semid_ds32 __user *usp = compat_ptr(pad); mm_segment_t old_fs; int need_back_translation; @@ -443,13 +418,13 @@ err |= __get_user (s.sem_perm.mode, &usp->sem_perm.mode); if (err) goto out; - fourth.__pad = &s; + fourth.__pad = (void __user *) &s; } need_back_translation = (IPCOP_MASK (third) & (IPCOP_MASK (SEM_STAT) | IPCOP_MASK (IPC_STAT))) != 0; if (need_back_translation) - fourth.__pad = &s; + fourth.__pad = (void __user *) &s; old_fs = get_fs (); set_fs (KERNEL_DS); err = sys_semctl (first, second, third, fourth); @@ -472,13 +447,15 @@ return err; } -static int do_sys32_msgsnd (int first, int second, int third, void *uptr) +static int do_sys32_msgsnd(int first, int second, int third, + void __user *uptr) { - struct msgbuf *p = kmalloc (second + sizeof (struct msgbuf), GFP_USER); - struct msgbuf32 *up = (struct msgbuf32 *)uptr; + struct msgbuf32 __user *up = uptr; + struct msgbuf *p; mm_segment_t old_fs; int err; + p = kmalloc(second + sizeof (struct msgbuf), GFP_USER); if (!p) return -ENOMEM; err = -EFAULT; @@ -487,45 +464,48 @@ goto out; old_fs = get_fs (); set_fs (KERNEL_DS); - err = sys_msgsnd (first, p, second, third); + err = sys_msgsnd (first, (struct msgbuf __user *) p, + second, third); set_fs (old_fs); out: kfree (p); return err; } -static int do_sys32_msgrcv (int first, int second, int msgtyp, int third, - int version, void *uptr) +static int do_sys32_msgrcv(int first, int second, int msgtyp, int third, + int version, void __user *uptr) { - struct msgbuf32 *up; + struct msgbuf32 __user *up; struct msgbuf *p; mm_segment_t old_fs; int err; if (!version) { - struct ipc_kludge *uipck = (struct ipc_kludge *)uptr; + struct ipc_kludge __user *uipck = uptr; struct ipc_kludge ipck; err = -EINVAL; if (!uptr) goto out; err = -EFAULT; - if (copy_from_user (&ipck, uipck, sizeof (struct ipc_kludge))) + if (copy_from_user (&ipck, uipck, + sizeof (struct ipc_kludge))) goto out; - uptr = (void *)A(ipck.msgp); + uptr = compat_ptr(ipck.msgp); msgtyp = ipck.msgtyp; } err = -ENOMEM; - p = kmalloc (second + sizeof (struct msgbuf), GFP_USER); + p = kmalloc(second + sizeof (struct msgbuf), GFP_USER); if (!p) goto out; old_fs = get_fs (); set_fs (KERNEL_DS); - err = sys_msgrcv (first, p, second, msgtyp, third); + err = sys_msgrcv (first, (struct msgbuf __user *) p, second, + msgtyp, third); set_fs (old_fs); if (err < 0) goto free_then_out; - up = (struct msgbuf32 *)uptr; + up = uptr; if (put_user (p->mtype, &up->mtype) || __copy_to_user (&up->mtext, p->mtext, err)) err = -EFAULT; @@ -535,37 +515,46 @@ return err; } -static int do_sys32_msgctl (int first, int second, void *uptr) +static int do_sys32_msgctl(int first, int second, void __user *uptr) { int err; if (IPCOP_MASK (second) & (IPCOP_MASK (IPC_INFO) | IPCOP_MASK (MSG_INFO) | IPCOP_MASK (IPC_RMID))) { - err = sys_msgctl (first, second, (struct msqid_ds *)uptr); + err = sys_msgctl (first, second, uptr); } else if (second & IPC_64) { struct msqid64_ds m; - struct msqid64_ds32 *up = (struct msqid64_ds32 *)uptr; + struct msqid64_ds32 __user *up = uptr; mm_segment_t old_fs; if (second == (IPC_SET|IPC_64)) { - err = get_user (m.msg_perm.uid, &up->msg_perm.uid); - err |= __get_user (m.msg_perm.gid, &up->msg_perm.gid); - err |= __get_user (m.msg_perm.mode, &up->msg_perm.mode); - err |= __get_user (m.msg_qbytes, &up->msg_qbytes); + err = get_user (m.msg_perm.uid, + &up->msg_perm.uid); + err |= __get_user (m.msg_perm.gid, + &up->msg_perm.gid); + err |= __get_user (m.msg_perm.mode, + &up->msg_perm.mode); + err |= __get_user (m.msg_qbytes, + &up->msg_qbytes); if (err) goto out; } old_fs = get_fs (); set_fs (KERNEL_DS); - err = sys_msgctl (first, second, (struct msqid_ds *)&m); + err = sys_msgctl(first, second, + (struct msqid_ds __user *)&m); set_fs (old_fs); if (IPCOP_MASK (second) & (IPCOP_MASK (MSG_STAT) | IPCOP_MASK (IPC_STAT))) { - int err2 = copy_to_user(&up->msg_perm, &m.msg_perm, sizeof(struct ipc64_perm) + 3*sizeof(time_t)); - err2 |= __put_user (m.msg_cbytes, &up->msg_cbytes); + int err2 = copy_to_user(&up->msg_perm, + &m.msg_perm, + (sizeof(struct ipc64_perm) + 3*sizeof(time_t))); + err2 |= __put_user (m.msg_cbytes, + &up->msg_cbytes); err2 |= __put_user (m.msg_qnum, &up->msg_qnum); - err2 |= __put_user (m.msg_qbytes, &up->msg_qbytes); + err2 |= __put_user (m.msg_qbytes, + &up->msg_qbytes); err2 |= __put_user (m.msg_lspid, &up->msg_lspid); err2 |= __put_user (m.msg_lrpid, &up->msg_lrpid); if (err2) @@ -573,38 +562,52 @@ } } else { struct msqid_ds m; - struct msqid_ds32 *up = (struct msqid_ds32 *)uptr; + struct msqid_ds32 __user *up = uptr; mm_segment_t old_fs; if (second == IPC_SET) { - err = get_user (m.msg_perm.uid, &up->msg_perm.uid); - err |= __get_user (m.msg_perm.gid, &up->msg_perm.gid); - err |= __get_user (m.msg_perm.mode, &up->msg_perm.mode); - err |= __get_user (m.msg_qbytes, &up->msg_qbytes); + err = get_user(m.msg_perm.uid, + &up->msg_perm.uid); + err |= __get_user(m.msg_perm.gid, + &up->msg_perm.gid); + err |= __get_user(m.msg_perm.mode, + &up->msg_perm.mode); + err |= __get_user(m.msg_qbytes, + &up->msg_qbytes); if (err) goto out; } old_fs = get_fs (); set_fs (KERNEL_DS); - err = sys_msgctl (first, second, &m); + err = sys_msgctl(first, second, + (struct msqid_ds __user *) &m); set_fs (old_fs); if (IPCOP_MASK (second) & (IPCOP_MASK (MSG_STAT) | IPCOP_MASK (IPC_STAT))) { - int err2 = put_user (m.msg_perm.key, &up->msg_perm.key); - err2 |= __put_user (high2lowuid(m.msg_perm.uid), &up->msg_perm.uid); - err2 |= __put_user (high2lowgid(m.msg_perm.gid), &up->msg_perm.gid); - err2 |= __put_user (high2lowuid(m.msg_perm.cuid), &up->msg_perm.cuid); - err2 |= __put_user (high2lowgid(m.msg_perm.cgid), &up->msg_perm.cgid); - err2 |= __put_user (m.msg_perm.mode, &up->msg_perm.mode); - err2 |= __put_user (m.msg_perm.seq, &up->msg_perm.seq); - err2 |= __put_user (m.msg_stime, &up->msg_stime); - err2 |= __put_user (m.msg_rtime, &up->msg_rtime); - err2 |= __put_user (m.msg_ctime, &up->msg_ctime); - err2 |= __put_user (m.msg_cbytes, &up->msg_cbytes); - err2 |= __put_user (m.msg_qnum, &up->msg_qnum); - err2 |= __put_user (m.msg_qbytes, &up->msg_qbytes); - err2 |= __put_user (m.msg_lspid, &up->msg_lspid); - err2 |= __put_user (m.msg_lrpid, &up->msg_lrpid); + int err2 = put_user(m.msg_perm.key, + &up->msg_perm.key); + err2 |= __put_user(high2lowuid(m.msg_perm.uid), + &up->msg_perm.uid); + err2 |= __put_user(high2lowgid(m.msg_perm.gid), + &up->msg_perm.gid); + err2 |= __put_user(high2lowuid(m.msg_perm.cuid), + &up->msg_perm.cuid); + err2 |= __put_user(high2lowgid(m.msg_perm.cgid), + &up->msg_perm.cgid); + err2 |= __put_user(m.msg_perm.mode, + &up->msg_perm.mode); + err2 |= __put_user(m.msg_perm.seq, + &up->msg_perm.seq); + err2 |= __put_user(m.msg_stime, &up->msg_stime); + err2 |= __put_user(m.msg_rtime, &up->msg_rtime); + err2 |= __put_user(m.msg_ctime, &up->msg_ctime); + err2 |= __put_user(m.msg_cbytes, + &up->msg_cbytes); + err2 |= __put_user(m.msg_qnum, &up->msg_qnum); + err2 |= __put_user(m.msg_qbytes, + &up->msg_qbytes); + err2 |= __put_user(m.msg_lspid, &up->msg_lspid); + err2 |= __put_user(m.msg_lrpid, &up->msg_lrpid); if (err2) err = -EFAULT; } @@ -614,10 +617,10 @@ return err; } -static int do_sys32_shmat (int first, int second, int third, int version, void *uptr) +static int do_sys32_shmat (int first, int second, int third, int version, void __user *uptr) { unsigned long raddr; - u32 *uaddr = (u32 *)A((u32)third); + u32 __user *uaddr = compat_ptr((compat_uptr_t)third); int err = -EINVAL; if (version == 1) @@ -630,63 +633,75 @@ return err; } -static int do_sys32_shmctl (int first, int second, void *uptr) +static int do_sys32_shmctl(int first, int second, void __user *uptr) { int err; if (IPCOP_MASK (second) & - (IPCOP_MASK (IPC_INFO) | IPCOP_MASK (SHM_LOCK) | IPCOP_MASK (SHM_UNLOCK) | - IPCOP_MASK (IPC_RMID))) { - if (second == (IPC_INFO|IPC_64)) - second = IPC_INFO; /* So that we don't have to translate it */ - err = sys_shmctl (first, second, (struct shmid_ds *)uptr); + (IPCOP_MASK (IPC_INFO) | IPCOP_MASK (SHM_LOCK) | + IPCOP_MASK (SHM_UNLOCK) | IPCOP_MASK (IPC_RMID))) { + if (second == (IPC_INFO|IPC_64)) { + /* So that we don't have to translate it */ + second = IPC_INFO; + } + err = sys_shmctl(first, second, uptr); } else if ((second & IPC_64) && second != (SHM_INFO|IPC_64)) { struct shmid64_ds s; - struct shmid64_ds32 *up = (struct shmid64_ds32 *)uptr; + struct shmid64_ds32 __user *up = uptr; mm_segment_t old_fs; if (second == (IPC_SET|IPC_64)) { - err = get_user (s.shm_perm.uid, &up->shm_perm.uid); - err |= __get_user (s.shm_perm.gid, &up->shm_perm.gid); - err |= __get_user (s.shm_perm.mode, &up->shm_perm.mode); + err = get_user(s.shm_perm.uid, + &up->shm_perm.uid); + err |= __get_user(s.shm_perm.gid, + &up->shm_perm.gid); + err |= __get_user(s.shm_perm.mode, + &up->shm_perm.mode); if (err) goto out; } - old_fs = get_fs (); - set_fs (KERNEL_DS); - err = sys_shmctl (first, second, (struct shmid_ds *)&s); - set_fs (old_fs); + old_fs = get_fs(); + set_fs(KERNEL_DS); + err = sys_shmctl(first, second, + (struct shmid_ds __user *)&s); + set_fs(old_fs); if (err < 0) goto out; /* Mask it even in this case so it becomes a CSE. */ if (IPCOP_MASK (second) & (IPCOP_MASK (SHM_STAT) | IPCOP_MASK (IPC_STAT))) { - int err2 = copy_to_user (&up->shm_perm, &s.shm_perm, sizeof(struct ipc64_perm) + 3*sizeof(time_t)); - err2 |= __put_user (s.shm_segsz, &up->shm_segsz); - err2 |= __put_user (s.shm_nattch, &up->shm_nattch); - err2 |= __put_user (s.shm_cpid, &up->shm_cpid); - err2 |= __put_user (s.shm_lpid, &up->shm_lpid); + int err2 = copy_to_user(&up->shm_perm, + &s.shm_perm, + sizeof(struct ipc64_perm) + 3*sizeof(time_t)); + err2 |= __put_user(s.shm_segsz, &up->shm_segsz); + err2 |= __put_user(s.shm_nattch,&up->shm_nattch); + err2 |= __put_user(s.shm_cpid, &up->shm_cpid); + err2 |= __put_user(s.shm_lpid, &up->shm_lpid); if (err2) err = -EFAULT; } } else { struct shmid_ds s; - struct shmid_ds32 *up = (struct shmid_ds32 *)uptr; + struct shmid_ds32 __user *up = uptr; mm_segment_t old_fs; second &= ~IPC_64; if (second == IPC_SET) { - err = get_user (s.shm_perm.uid, &up->shm_perm.uid); - err |= __get_user (s.shm_perm.gid, &up->shm_perm.gid); - err |= __get_user (s.shm_perm.mode, &up->shm_perm.mode); + err = get_user(s.shm_perm.uid, + &up->shm_perm.uid); + err |= __get_user(s.shm_perm.gid, + &up->shm_perm.gid); + err |= __get_user(s.shm_perm.mode, + &up->shm_perm.mode); if (err) goto out; } - old_fs = get_fs (); - set_fs (KERNEL_DS); - err = sys_shmctl (first, second, &s); - set_fs (old_fs); + old_fs = get_fs(); + set_fs(KERNEL_DS); + err = sys_shmctl(first, second, + (struct shmid_ds __user *) &s); + set_fs(old_fs); if (err < 0) goto out; @@ -696,32 +711,46 @@ int used_ids; u32 shm_tot, shm_rss, shm_swp; u32 swap_attempts, swap_successes; - } *uip = (struct shm_info32 *)uptr; - struct shm_info *kp = (struct shm_info *)&s; - int err2 = put_user (kp->used_ids, &uip->used_ids); - err2 |= __put_user (kp->shm_tot, &uip->shm_tot); - err2 |= __put_user (kp->shm_rss, &uip->shm_rss); - err2 |= __put_user (kp->shm_swp, &uip->shm_swp); - err2 |= __put_user (kp->swap_attempts, &uip->swap_attempts); - err2 |= __put_user (kp->swap_successes, &uip->swap_successes); + }; + struct shm_info32 __user *uip = uptr; + struct shm_info *kp = (struct shm_info *) &s; + int err2 = put_user(kp->used_ids, + &uip->used_ids); + err2 |= __put_user(kp->shm_tot, &uip->shm_tot); + err2 |= __put_user(kp->shm_rss, &uip->shm_rss); + err2 |= __put_user(kp->shm_swp, &uip->shm_swp); + err2 |= __put_user(kp->swap_attempts, + &uip->swap_attempts); + err2 |= __put_user(kp->swap_successes, + &uip->swap_successes); if (err2) err = -EFAULT; } else if (IPCOP_MASK (second) & - (IPCOP_MASK (SHM_STAT) | IPCOP_MASK (IPC_STAT))) { - int err2 = put_user (s.shm_perm.key, &up->shm_perm.key); - err2 |= __put_user (high2lowuid(s.shm_perm.uid), &up->shm_perm.uid); - err2 |= __put_user (high2lowuid(s.shm_perm.gid), &up->shm_perm.gid); - err2 |= __put_user (high2lowuid(s.shm_perm.cuid), &up->shm_perm.cuid); - err2 |= __put_user (high2lowuid(s.shm_perm.cgid), &up->shm_perm.cgid); - err2 |= __put_user (s.shm_perm.mode, &up->shm_perm.mode); - err2 |= __put_user (s.shm_perm.seq, &up->shm_perm.seq); - err2 |= __put_user (s.shm_atime, &up->shm_atime); - err2 |= __put_user (s.shm_dtime, &up->shm_dtime); - err2 |= __put_user (s.shm_ctime, &up->shm_ctime); - err2 |= __put_user (s.shm_segsz, &up->shm_segsz); - err2 |= __put_user (s.shm_nattch, &up->shm_nattch); - err2 |= __put_user (s.shm_cpid, &up->shm_cpid); - err2 |= __put_user (s.shm_lpid, &up->shm_lpid); + (IPCOP_MASK (SHM_STAT) | + IPCOP_MASK (IPC_STAT))) { + int err2; + + err2 = put_user(s.shm_perm.key, + &up->shm_perm.key); + err2 |= __put_user(high2lowuid(s.shm_perm.uid), + &up->shm_perm.uid); + err2 |= __put_user(high2lowuid(s.shm_perm.gid), + &up->shm_perm.gid); + err2 |= __put_user(high2lowuid(s.shm_perm.cuid), + &up->shm_perm.cuid); + err2 |= __put_user(high2lowuid(s.shm_perm.cgid), + &up->shm_perm.cgid); + err2 |= __put_user(s.shm_perm.mode, + &up->shm_perm.mode); + err2 |= __put_user(s.shm_perm.seq, + &up->shm_perm.seq); + err2 |= __put_user(s.shm_atime, &up->shm_atime); + err2 |= __put_user(s.shm_dtime, &up->shm_dtime); + err2 |= __put_user(s.shm_ctime, &up->shm_ctime); + err2 |= __put_user(s.shm_segsz, &up->shm_segsz); + err2 |= __put_user(s.shm_nattch,&up->shm_nattch); + err2 |= __put_user(s.shm_cpid, &up->shm_cpid); + err2 |= __put_user(s.shm_lpid, &up->shm_lpid); if (err2) err = -EFAULT; } @@ -730,12 +759,14 @@ return err; } -static int sys32_semtimedop(int semid, struct sembuf *tsems, int nsems, - const struct compat_timespec *timeout32) +static int sys32_semtimedop(int semid, struct sembuf __user *tsems, + int nsems, + const struct compat_timespec __user *timeout32) { struct compat_timespec t32; - struct timespec *t64 = compat_alloc_user_space(sizeof(*t64)); + struct timespec __user *t64; + t64 = compat_alloc_user_space(sizeof(*t64)); if (copy_from_user(&t32, timeout32, sizeof(t32))) return -EFAULT; @@ -746,77 +777,81 @@ return sys_semtimedop(semid, tsems, nsems, t64); } -asmlinkage int sys32_ipc (u32 call, int first, int second, int third, u32 ptr, u32 fifth) +asmlinkage long compat_sys_ipc(u32 call, int first, int second, int third, compat_uptr_t __ptr, u32 fifth) { int version, err; + void __user *ptr = compat_ptr(__ptr); version = call >> 16; /* hack for backward compatibility */ call &= 0xffff; - if (call <= SEMCTL) + if (call <= SEMCTL) { switch (call) { case SEMOP: - /* struct sembuf is the same on 32 and 64bit :)) */ - err = sys_semtimedop (first, (struct sembuf *)AA(ptr), second, NULL); + /* struct sembuf is the same on 32 and 64 :)) */ + err = sys_semtimedop (first, ptr, second, NULL); goto out; case SEMTIMEDOP: - err = sys32_semtimedop (first, (struct sembuf *)AA(ptr), second, (const struct compat_timespec *) AA(fifth)); + err = sys32_semtimedop(first, ptr, second, + compat_ptr(fifth)); case SEMGET: - err = sys_semget (first, second, third); + err = sys_semget(first, second, third); goto out; case SEMCTL: - err = do_sys32_semctl (first, second, third, (void *)AA(ptr)); + err = do_sys32_semctl(first, second, third, ptr); goto out; default: err = -ENOSYS; goto out; }; - if (call <= MSGCTL) + } + if (call <= MSGCTL) { switch (call) { case MSGSND: - err = do_sys32_msgsnd (first, second, third, (void *)AA(ptr)); + err = do_sys32_msgsnd(first, second, third, ptr); goto out; case MSGRCV: - err = do_sys32_msgrcv (first, second, fifth, third, - version, (void *)AA(ptr)); + err = do_sys32_msgrcv(first, second, fifth, + third, version, ptr); goto out; case MSGGET: - err = sys_msgget ((key_t) first, second); + err = sys_msgget((key_t) first, second); goto out; case MSGCTL: - err = do_sys32_msgctl (first, second, (void *)AA(ptr)); + err = do_sys32_msgctl(first, second, ptr); goto out; default: err = -ENOSYS; goto out; - } - if (call <= SHMCTL) + }; + } + if (call <= SHMCTL) { switch (call) { case SHMAT: - err = do_sys32_shmat (first, second, third, - version, (void *)AA(ptr)); + err = do_sys32_shmat(first, second, third, + version, ptr); goto out; case SHMDT: - err = sys_shmdt ((char *)AA(ptr)); + err = sys_shmdt(ptr); goto out; case SHMGET: - err = sys_shmget (first, second, third); + err = sys_shmget(first, second, third); goto out; case SHMCTL: - err = do_sys32_shmctl (first, second, (void *)AA(ptr)); + err = do_sys32_shmctl(first, second, ptr); goto out; default: err = -ENOSYS; goto out; - } - + }; + } err = -ENOSYS; out: return err; } -asmlinkage int sys32_truncate64(const char * path, unsigned long high, unsigned long low) +asmlinkage long sys32_truncate64(const char __user * path, unsigned long high, unsigned long low) { if ((int)high < 0) return -EINVAL; @@ -824,7 +859,7 @@ return sys_truncate(path, (high << 32) | low); } -asmlinkage int sys32_ftruncate64(unsigned int fd, unsigned long high, unsigned long low) +asmlinkage long sys32_ftruncate64(unsigned int fd, unsigned long high, unsigned long low) { if ((int)high < 0) return -EINVAL; @@ -834,7 +869,7 @@ /* readdir & getdents */ -#define NAME_OFFSET(de) ((int) ((de)->d_name - (char *) (de))) +#define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de))) #define ROUND_UP(x) (((x)+sizeof(u32)-1) & ~(sizeof(u32)-1)) struct old_linux_dirent32 { @@ -845,7 +880,7 @@ }; struct readdir_callback32 { - struct old_linux_dirent32 * dirent; + struct old_linux_dirent32 __user * dirent; int count; }; @@ -853,7 +888,7 @@ loff_t offset, ino_t ino, unsigned int d_type) { struct readdir_callback32 * buf = (struct readdir_callback32 *) __buf; - struct old_linux_dirent32 * dirent; + struct old_linux_dirent32 __user * dirent; if (buf->count) return -EINVAL; @@ -867,7 +902,7 @@ return 0; } -asmlinkage int old32_readdir(unsigned int fd, struct old_linux_dirent32 *dirent, unsigned int count) +asmlinkage long old32_readdir(unsigned int fd, struct old_linux_dirent32 __user *dirent, unsigned int count) { int error = -EBADF; struct file * file; @@ -899,8 +934,8 @@ }; struct getdents_callback32 { - struct linux_dirent32 * current_dir; - struct linux_dirent32 * previous; + struct linux_dirent32 __user *current_dir; + struct linux_dirent32 __user *previous; int count; int error; }; @@ -908,7 +943,7 @@ static int filldir(void * __buf, const char * name, int namlen, loff_t offset, ino_t ino, unsigned int d_type) { - struct linux_dirent32 * dirent; + struct linux_dirent32 __user * dirent; struct getdents_callback32 * buf = (struct getdents_callback32 *) __buf; int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 2); @@ -924,17 +959,17 @@ put_user(reclen, &dirent->d_reclen); copy_to_user(dirent->d_name, name, namlen); put_user(0, dirent->d_name + namlen); - put_user(d_type, (char *) dirent + reclen - 1); - dirent = (void *) dirent + reclen; + put_user(d_type, (char __user *) dirent + reclen - 1); + dirent = (void __user *) dirent + reclen; buf->current_dir = dirent; buf->count -= reclen; return 0; } -asmlinkage int sys32_getdents(unsigned int fd, struct linux_dirent32 *dirent, unsigned int count) +asmlinkage long sys32_getdents(unsigned int fd, struct linux_dirent32 __user *dirent, unsigned int count) { struct file * file; - struct linux_dirent32 * lastdirent; + struct linux_dirent32 __user *lastdirent; struct getdents_callback32 buf; int error = -EBADF; @@ -952,7 +987,7 @@ goto out_putf; lastdirent = buf.previous; error = buf.error; - if(lastdirent) { + if (lastdirent) { put_user(file->f_pos, &lastdirent->d_off); error = count - buf.count; } @@ -964,7 +999,7 @@ /* end of readdir & getdents */ -int cp_compat_stat(struct kstat *stat, struct compat_stat *statbuf) +int cp_compat_stat(struct kstat *stat, struct compat_stat __user *statbuf) { int err; @@ -994,7 +1029,7 @@ return err; } -asmlinkage int sys32_sysfs(int option, u32 arg1, u32 arg2) +asmlinkage long compat_sys_sysfs(int option, u32 arg1, u32 arg2) { return sys_sysfs(option, arg1, arg2); } @@ -1016,7 +1051,7 @@ char _f[20-2*sizeof(int)-sizeof(int)]; }; -asmlinkage int sys32_sysinfo(struct sysinfo32 *info) +asmlinkage long sys32_sysinfo(struct sysinfo32 __user *info) { struct sysinfo s; int ret, err; @@ -1024,7 +1059,7 @@ mm_segment_t old_fs = get_fs (); set_fs(KERNEL_DS); - ret = sys_sysinfo(&s); + ret = sys_sysinfo((struct sysinfo __user *) &s); set_fs(old_fs); /* Check to see if any memory value is too large for 32-bit and * scale down if needed. @@ -1063,21 +1098,24 @@ return ret; } -asmlinkage int sys32_sched_rr_get_interval(compat_pid_t pid, struct compat_timespec *interval) +asmlinkage long compat_sys_sched_rr_get_interval(compat_pid_t pid, struct compat_timespec __user *interval) { struct timespec t; int ret; mm_segment_t old_fs = get_fs (); set_fs (KERNEL_DS); - ret = sys_sched_rr_get_interval(pid, &t); + ret = sys_sched_rr_get_interval(pid, (struct timespec __user *) &t); set_fs (old_fs); if (put_compat_timespec(&t, interval)) return -EFAULT; return ret; } -asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t *set, compat_sigset_t *oset, compat_size_t sigsetsize) +asmlinkage long compat_sys_rt_sigprocmask(int how, + compat_sigset_t __user *set, + compat_sigset_t __user *oset, + compat_size_t sigsetsize) { sigset_t s; compat_sigset_t s32; @@ -1095,7 +1133,10 @@ } } set_fs (KERNEL_DS); - ret = sys_rt_sigprocmask(how, set ? &s : NULL, oset ? &s : NULL, sigsetsize); + ret = sys_rt_sigprocmask(how, + set ? (sigset_t __user *) &s : NULL, + oset ? (sigset_t __user *) &s : NULL, + sigsetsize); set_fs (old_fs); if (ret) return ret; if (oset) { @@ -1111,7 +1152,8 @@ return 0; } -asmlinkage int sys32_rt_sigpending(compat_sigset_t *set, compat_size_t sigsetsize) +asmlinkage long sys32_rt_sigpending(compat_sigset_t __user *set, + compat_size_t sigsetsize) { sigset_t s; compat_sigset_t s32; @@ -1119,7 +1161,7 @@ mm_segment_t old_fs = get_fs(); set_fs (KERNEL_DS); - ret = sys_rt_sigpending(&s, sigsetsize); + ret = sys_rt_sigpending((sigset_t __user *) &s, sigsetsize); set_fs (old_fs); if (!ret) { switch (_NSIG_WORDS) { @@ -1134,9 +1176,10 @@ return ret; } -asmlinkage int -sys32_rt_sigtimedwait(compat_sigset_t *uthese, siginfo_t32 *uinfo, - struct compat_timespec *uts, compat_size_t sigsetsize) +asmlinkage long sys32_rt_sigtimedwait(compat_sigset_t __user *uthese, + siginfo_t32 __user *uinfo, + struct compat_timespec __user *uts, + compat_size_t sigsetsize) { int ret, sig; sigset_t these; @@ -1218,8 +1261,8 @@ return ret; } -asmlinkage int -sys32_rt_sigqueueinfo(int pid, int sig, siginfo_t32 *uinfo) +asmlinkage long compat_sys_rt_sigqueueinfo(int pid, int sig, + siginfo_t32 __user *uinfo) { siginfo_t info; int ret; @@ -1229,12 +1272,13 @@ copy_from_user (info._sifields._pad, uinfo->_sifields._pad, SI_PAD_SIZE)) return -EFAULT; set_fs (KERNEL_DS); - ret = sys_rt_sigqueueinfo(pid, sig, &info); + ret = sys_rt_sigqueueinfo(pid, sig, (siginfo_t __user *) &info); set_fs (old_fs); return ret; } -asmlinkage int sys32_sigaction (int sig, struct old_sigaction32 *act, struct old_sigaction32 *oact) +asmlinkage long compat_sys_sigaction(int sig, struct old_sigaction32 __user *act, + struct old_sigaction32 __user *oact) { struct k_sigaction new_ka, old_ka; int ret; @@ -1272,9 +1316,11 @@ return ret; } -asmlinkage int -sys32_rt_sigaction(int sig, struct sigaction32 *act, struct sigaction32 *oact, - void *restorer, compat_size_t sigsetsize) +asmlinkage long compat_sys_rt_sigaction(int sig, + struct sigaction32 __user *act, + struct sigaction32 __user *oact, + void __user *restorer, + compat_size_t sigsetsize) { struct k_sigaction new_ka, old_ka; int ret; @@ -1333,27 +1379,29 @@ * sparc32_execve() executes a new program after the asm stub has set * things up for us. This should basically do what I want it to. */ -asmlinkage int sparc32_execve(struct pt_regs *regs) +asmlinkage long sparc32_execve(struct pt_regs *regs) { - int error, base = 0; - char *filename; + int error, base = 0; + char *filename; /* User register window flush is done by entry.S */ - /* Check for indirect call. */ - if((u32)regs->u_regs[UREG_G1] == 0) - base = 1; + /* Check for indirect call. */ + if ((u32)regs->u_regs[UREG_G1] == 0) + base = 1; - filename = getname((char *)AA(regs->u_regs[base + UREG_I0])); + filename = getname(compat_ptr(regs->u_regs[base + UREG_I0])); error = PTR_ERR(filename); - if(IS_ERR(filename)) - goto out; - error = compat_do_execve(filename, - compat_ptr((u32)regs->u_regs[base + UREG_I1]), - compat_ptr((u32)regs->u_regs[base + UREG_I2]), regs); - putname(filename); + if (IS_ERR(filename)) + goto out; + + error = compat_do_execve(filename, + compat_ptr(regs->u_regs[base + UREG_I1]), + compat_ptr(regs->u_regs[base + UREG_I2]), regs); + + putname(filename); - if(!error) { + if (!error) { fprs_write(0); current_thread_info()->xfsr[0] = 0; current_thread_info()->fpsaved[0] = 0; @@ -1361,31 +1409,32 @@ current->ptrace &= ~PT_DTRACE; } out: - return error; + return error; } #ifdef CONFIG_MODULES -asmlinkage int sys32_init_module(void *umod, u32 len, const char *uargs) +asmlinkage long sys32_init_module(void __user *umod, u32 len, + const char __user *uargs) { return sys_init_module(umod, len, uargs); } -asmlinkage int sys32_delete_module(const char *name_user, unsigned int flags) +asmlinkage long sys32_delete_module(const char __user *name_user, + unsigned int flags) { return sys_delete_module(name_user, flags); } #else /* CONFIG_MODULES */ -asmlinkage int -sys32_init_module(const char *name_user, struct module *mod_user) +asmlinkage long sys32_init_module(const char __user *name_user, + struct module __user *mod_user) { return -ENOSYS; } -asmlinkage int -sys32_delete_module(const char *name_user) +asmlinkage long sys32_delete_module(const char __user *name_user) { return -ENOSYS; } @@ -1397,7 +1446,8 @@ extern struct timezone sys_tz; -asmlinkage int sys32_gettimeofday(struct compat_timeval *tv, struct timezone *tz) +asmlinkage long sys32_gettimeofday(struct compat_timeval __user *tv, + struct timezone __user *tz) { if (tv) { struct timeval ktv; @@ -1412,7 +1462,7 @@ return 0; } -static inline long get_ts32(struct timespec *o, struct compat_timeval *i) +static inline long get_ts32(struct timespec *o, struct compat_timeval __user *i) { long usec; @@ -1426,7 +1476,8 @@ return 0; } -asmlinkage int sys32_settimeofday(struct compat_timeval *tv, struct timezone *tz) +asmlinkage long sys32_settimeofday(struct compat_timeval __user *tv, + struct timezone __user *tz) { struct timespec kts; struct timezone ktz; @@ -1443,7 +1494,8 @@ return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL); } -asmlinkage int sys32_utimes(char *filename, struct compat_timeval *tvs) +asmlinkage long sys32_utimes(char __user *filename, + struct compat_timeval __user *tvs) { struct timeval ktvs[2]; @@ -1457,72 +1509,61 @@ } /* These are here just in case some old sparc32 binary calls it. */ -asmlinkage int sys32_pause(void) +asmlinkage long sys32_pause(void) { current->state = TASK_INTERRUPTIBLE; schedule(); return -ERESTARTNOHAND; } -/* PCI config space poking. */ - -asmlinkage int sys32_pciconfig_read(u32 bus, u32 dfn, u32 off, u32 len, u32 ubuf) -{ - return sys_pciconfig_read((unsigned long) bus, - (unsigned long) dfn, - (unsigned long) off, - (unsigned long) len, - (unsigned char *)AA(ubuf)); -} - -asmlinkage int sys32_pciconfig_write(u32 bus, u32 dfn, u32 off, u32 len, u32 ubuf) +asmlinkage compat_ssize_t sys32_pread64(unsigned int fd, + char __user *ubuf, + compat_size_t count, + unsigned long poshi, + unsigned long poslo) { - return sys_pciconfig_write((unsigned long) bus, - (unsigned long) dfn, - (unsigned long) off, - (unsigned long) len, - (unsigned char *)AA(ubuf)); + return sys_pread64(fd, ubuf, count, (poshi << 32) | poslo); } -asmlinkage int sys32_prctl(int option, u32 arg2, u32 arg3, u32 arg4, u32 arg5) +asmlinkage compat_ssize_t sys32_pwrite64(unsigned int fd, + char __user *ubuf, + compat_size_t count, + unsigned long poshi, + unsigned long poslo) { - return sys_prctl(option, - (unsigned long) arg2, - (unsigned long) arg3, - (unsigned long) arg4, - (unsigned long) arg5); + return sys_pwrite64(fd, ubuf, count, (poshi << 32) | poslo); } - -asmlinkage compat_ssize_t sys32_pread64(unsigned int fd, char *ubuf, - compat_size_t count, u32 poshi, u32 poslo) -{ - return sys_pread64(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo)); -} - -asmlinkage compat_ssize_t sys32_pwrite64(unsigned int fd, char *ubuf, - compat_size_t count, u32 poshi, u32 poslo) -{ - return sys_pwrite64(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo)); -} - -asmlinkage compat_ssize_t sys32_readahead(int fd, u32 offhi, u32 offlo, s32 count) +asmlinkage long compat_sys_readahead(int fd, + unsigned long offhi, + unsigned long offlo, + compat_size_t count) { - return sys_readahead(fd, ((loff_t)AA(offhi) << 32) | AA(offlo), count); + return sys_readahead(fd, (offhi << 32) | offlo, count); } -long sys32_fadvise64(int fd, u32 offhi, u32 offlo, s32 len, int advice) +long compat_sys_fadvise64(int fd, + unsigned long offhi, + unsigned long offlo, + compat_size_t len, int advice) { - return sys_fadvise64_64(fd, ((loff_t)AA(offhi)<<32)|AA(offlo), len, advice); + return sys_fadvise64_64(fd, (offhi << 32) | offlo, len, advice); } -long sys32_fadvise64_64(int fd, u32 offhi, u32 offlo, u32 lenhi, u32 lenlo, int advice) +long compat_sys_fadvise64_64(int fd, + unsigned long offhi, unsigned long offlo, + unsigned long lenhi, unsigned long lenlo, + int advice) { - return sys_fadvise64_64(fd, ((loff_t)AA(offhi)<<32)|AA(offlo), - ((loff_t)AA(lenhi)<<32)|AA(lenlo), advice); + return sys_fadvise64_64(fd, + (offhi << 32) | offlo, + (lenhi << 32) | lenlo, + advice); } -asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t *offset, s32 count) +asmlinkage long compat_sys_sendfile(int out_fd, int in_fd, + compat_off_t __user *offset, + compat_size_t count) { mm_segment_t old_fs = get_fs(); int ret; @@ -1532,7 +1573,9 @@ return -EFAULT; set_fs(KERNEL_DS); - ret = sys_sendfile(out_fd, in_fd, offset ? &of : NULL, count); + ret = sys_sendfile(out_fd, in_fd, + offset ? (off_t __user *) &of : NULL, + count); set_fs(old_fs); if (offset && put_user(of, offset)) @@ -1541,7 +1584,9 @@ return ret; } -asmlinkage int sys32_sendfile64(int out_fd, int in_fd, compat_loff_t *offset, s32 count) +asmlinkage long compat_sys_sendfile64(int out_fd, int in_fd, + compat_loff_t __user *offset, + compat_size_t count) { mm_segment_t old_fs = get_fs(); int ret; @@ -1551,7 +1596,9 @@ return -EFAULT; set_fs(KERNEL_DS); - ret = sys_sendfile64(out_fd, in_fd, offset ? &lof : NULL, count); + ret = sys_sendfile64(out_fd, in_fd, + offset ? (loff_t __user *) &lof : NULL, + count); set_fs(old_fs); if (offset && put_user(lof, offset)) @@ -1577,57 +1624,57 @@ extern int do_adjtimex(struct timex *); -asmlinkage int sys32_adjtimex(struct timex32 *utp) +asmlinkage long sys32_adjtimex(struct timex32 __user *utp) { struct timex txc; int ret; memset(&txc, 0, sizeof(struct timex)); - if(get_user(txc.modes, &utp->modes) || - __get_user(txc.offset, &utp->offset) || - __get_user(txc.freq, &utp->freq) || - __get_user(txc.maxerror, &utp->maxerror) || - __get_user(txc.esterror, &utp->esterror) || - __get_user(txc.status, &utp->status) || - __get_user(txc.constant, &utp->constant) || - __get_user(txc.precision, &utp->precision) || - __get_user(txc.tolerance, &utp->tolerance) || - __get_user(txc.time.tv_sec, &utp->time.tv_sec) || - __get_user(txc.time.tv_usec, &utp->time.tv_usec) || - __get_user(txc.tick, &utp->tick) || - __get_user(txc.ppsfreq, &utp->ppsfreq) || - __get_user(txc.jitter, &utp->jitter) || - __get_user(txc.shift, &utp->shift) || - __get_user(txc.stabil, &utp->stabil) || - __get_user(txc.jitcnt, &utp->jitcnt) || - __get_user(txc.calcnt, &utp->calcnt) || - __get_user(txc.errcnt, &utp->errcnt) || - __get_user(txc.stbcnt, &utp->stbcnt)) + if (get_user(txc.modes, &utp->modes) || + __get_user(txc.offset, &utp->offset) || + __get_user(txc.freq, &utp->freq) || + __get_user(txc.maxerror, &utp->maxerror) || + __get_user(txc.esterror, &utp->esterror) || + __get_user(txc.status, &utp->status) || + __get_user(txc.constant, &utp->constant) || + __get_user(txc.precision, &utp->precision) || + __get_user(txc.tolerance, &utp->tolerance) || + __get_user(txc.time.tv_sec, &utp->time.tv_sec) || + __get_user(txc.time.tv_usec, &utp->time.tv_usec) || + __get_user(txc.tick, &utp->tick) || + __get_user(txc.ppsfreq, &utp->ppsfreq) || + __get_user(txc.jitter, &utp->jitter) || + __get_user(txc.shift, &utp->shift) || + __get_user(txc.stabil, &utp->stabil) || + __get_user(txc.jitcnt, &utp->jitcnt) || + __get_user(txc.calcnt, &utp->calcnt) || + __get_user(txc.errcnt, &utp->errcnt) || + __get_user(txc.stbcnt, &utp->stbcnt)) return -EFAULT; ret = do_adjtimex(&txc); - if(put_user(txc.modes, &utp->modes) || - __put_user(txc.offset, &utp->offset) || - __put_user(txc.freq, &utp->freq) || - __put_user(txc.maxerror, &utp->maxerror) || - __put_user(txc.esterror, &utp->esterror) || - __put_user(txc.status, &utp->status) || - __put_user(txc.constant, &utp->constant) || - __put_user(txc.precision, &utp->precision) || - __put_user(txc.tolerance, &utp->tolerance) || - __put_user(txc.time.tv_sec, &utp->time.tv_sec) || - __put_user(txc.time.tv_usec, &utp->time.tv_usec) || - __put_user(txc.tick, &utp->tick) || - __put_user(txc.ppsfreq, &utp->ppsfreq) || - __put_user(txc.jitter, &utp->jitter) || - __put_user(txc.shift, &utp->shift) || - __put_user(txc.stabil, &utp->stabil) || - __put_user(txc.jitcnt, &utp->jitcnt) || - __put_user(txc.calcnt, &utp->calcnt) || - __put_user(txc.errcnt, &utp->errcnt) || - __put_user(txc.stbcnt, &utp->stbcnt)) + if (put_user(txc.modes, &utp->modes) || + __put_user(txc.offset, &utp->offset) || + __put_user(txc.freq, &utp->freq) || + __put_user(txc.maxerror, &utp->maxerror) || + __put_user(txc.esterror, &utp->esterror) || + __put_user(txc.status, &utp->status) || + __put_user(txc.constant, &utp->constant) || + __put_user(txc.precision, &utp->precision) || + __put_user(txc.tolerance, &utp->tolerance) || + __put_user(txc.time.tv_sec, &utp->time.tv_sec) || + __put_user(txc.time.tv_usec, &utp->time.tv_usec) || + __put_user(txc.tick, &utp->tick) || + __put_user(txc.ppsfreq, &utp->ppsfreq) || + __put_user(txc.jitter, &utp->jitter) || + __put_user(txc.shift, &utp->shift) || + __put_user(txc.stabil, &utp->stabil) || + __put_user(txc.jitcnt, &utp->jitcnt) || + __put_user(txc.calcnt, &utp->calcnt) || + __put_user(txc.errcnt, &utp->errcnt) || + __put_user(txc.stbcnt, &utp->stbcnt)) ret = -EFAULT; return ret; @@ -1637,7 +1684,8 @@ * not force O_LARGEFILE on. */ -asmlinkage long sparc32_open(const char * filename, int flags, int mode) +asmlinkage long sparc32_open(const char __user *filename, + int flags, int mode) { char * tmp; int fd, error; @@ -1674,7 +1722,7 @@ { struct vm_area_struct *vma; unsigned long ret = -EINVAL; - unsigned long new_addr = AA(__new_addr); + unsigned long new_addr = __new_addr; if (old_len > 0xf0000000UL || new_len > 0xf0000000UL) goto out; @@ -1715,13 +1763,6 @@ return ret; } -asmlinkage int sys_setpriority32(u32 which, u32 who, u32 niceval) -{ - return sys_setpriority((int) which, - (int) who, - (int) niceval); -} - struct __sysctl_args32 { u32 name; int nlen; @@ -1732,15 +1773,15 @@ u32 __unused[4]; }; -asmlinkage long sys32_sysctl(struct __sysctl_args32 *args) +asmlinkage long sys32_sysctl(struct __sysctl_args32 __user *args) { #ifndef CONFIG_SYSCTL return -ENOSYS; #else struct __sysctl_args32 tmp; int error; - size_t oldlen, *oldlenp = NULL; - unsigned long addr = (((long)&args->__unused[0]) + 7) & ~7; + size_t oldlen, __user *oldlenp = NULL; + unsigned long addr = (((unsigned long)&args->__unused[0]) + 7UL) & ~7UL; if (copy_from_user(&tmp, args, sizeof(tmp))) return -EFAULT; @@ -1752,20 +1793,24 @@ basically copy the whole sysctl.c here, and glibc's __sysctl uses rw memory for the structure anyway. */ - if (get_user(oldlen, (u32 *)A(tmp.oldlenp)) || - put_user(oldlen, (size_t *)addr)) + if (get_user(oldlen, (u32 __user *)(unsigned long)tmp.oldlenp) || + put_user(oldlen, (size_t __user *)addr)) return -EFAULT; - oldlenp = (size_t *)addr; + oldlenp = (size_t __user *)addr; } lock_kernel(); - error = do_sysctl((int *)A(tmp.name), tmp.nlen, (void *)A(tmp.oldval), - oldlenp, (void *)A(tmp.newval), tmp.newlen); + error = do_sysctl((int __user *)(unsigned long) tmp.name, + tmp.nlen, + (void __user *)(unsigned long) tmp.oldval, + oldlenp, + (void __user *)(unsigned long) tmp.newval, + tmp.newlen); unlock_kernel(); if (oldlenp) { if (!error) { - if (get_user(oldlen, (size_t *)addr) || - put_user(oldlen, (u32 *)A(tmp.oldlenp))) + if (get_user(oldlen, (size_t __user *)addr) || + put_user(oldlen, (u32 __user *)(unsigned long) tmp.oldlenp)) error = -EFAULT; } copy_to_user(args->__unused, tmp.__unused, sizeof(tmp.__unused)); @@ -1774,18 +1819,22 @@ #endif } -long sys32_lookup_dcookie(u32 cookie_high, u32 cookie_low, char *buf, size_t len) +long sys32_lookup_dcookie(unsigned long cookie_high, + unsigned long cookie_low, + char __user *buf, size_t len) { - return sys_lookup_dcookie((u64)cookie_high << 32 | cookie_low, + return sys_lookup_dcookie((cookie_high << 32) | cookie_low, buf, len); } extern asmlinkage long -sys_timer_create(clockid_t which_clock, struct sigevent *timer_event_spec, - timer_t * created_timer_id); +sys_timer_create(clockid_t which_clock, + struct sigevent __user *timer_event_spec, + timer_t __user *created_timer_id); long -sys32_timer_create(u32 clock, struct sigevent32 *se32, timer_t *timer_id) +sys32_timer_create(u32 clock, struct sigevent32 __user *se32, + timer_t __user *timer_id) { struct sigevent se; mm_segment_t oldfs; @@ -1808,7 +1857,9 @@ oldfs = get_fs(); set_fs(KERNEL_DS); - err = sys_timer_create(clock, &se, &t); + err = sys_timer_create(clock, + (struct sigevent __user *) &se, + (timer_t __user *) &t); set_fs(oldfs); if (!err) diff -urN linux-2.6.7-rc2/arch/sparc64/kernel/sys_sunos32.c linux-2.6.7-rc3/arch/sparc64/kernel/sys_sunos32.c --- linux-2.6.7-rc2/arch/sparc64/kernel/sys_sunos32.c 2004-06-07 12:54:48.758032259 -0700 +++ linux-2.6.7-rc3/arch/sparc64/kernel/sys_sunos32.c 2004-06-07 12:55:01.782571687 -0700 @@ -59,15 +59,6 @@ #include #include -/* Use this to get at 32-bit user passed pointers. */ -#define A(__x) \ -({ unsigned long __ret; \ - __asm__ ("srl %0, 0, %0" \ - : "=r" (__ret) \ - : "0" (__x)); \ - __ret; \ -}) - #define SUNOS_NR_OPEN 256 asmlinkage u32 sunos_mmap(u32 addr, u32 len, u32 prot, u32 flags, u32 fd, u32 off) @@ -187,7 +178,7 @@ /* This should do it hopefully... */ oldbrk = (int)current->mm->brk; error = sunos_brk(((int) current->mm->brk) + increment); - if(!error) + if (!error) error = oldbrk; return error; } @@ -273,19 +264,19 @@ }; struct sunos_dirent_callback { - struct sunos_dirent *curr; - struct sunos_dirent *previous; + struct sunos_dirent __user *curr; + struct sunos_dirent __user *previous; int count; int error; }; -#define NAME_OFFSET(de) ((int) ((de)->d_name - (char *) (de))) +#define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de))) #define ROUND_UP(x) (((x)+sizeof(s32)-1) & ~(sizeof(s32)-1)) static int sunos_filldir(void * __buf, const char * name, int namlen, loff_t offset, ino_t ino, unsigned int d_type) { - struct sunos_dirent * dirent; + struct sunos_dirent __user *dirent; struct sunos_dirent_callback * buf = (struct sunos_dirent_callback *) __buf; int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1); @@ -302,32 +293,31 @@ put_user(reclen, &dirent->d_reclen); copy_to_user(dirent->d_name, name, namlen); put_user(0, dirent->d_name + namlen); - dirent = (void *) dirent + reclen; + dirent = (void __user *) dirent + reclen; buf->curr = dirent; buf->count -= reclen; return 0; } -asmlinkage int sunos_getdents(unsigned int fd, u32 u_dirent, int cnt) +asmlinkage int sunos_getdents(unsigned int fd, void __user *dirent, int cnt) { struct file * file; - struct sunos_dirent * lastdirent; + struct sunos_dirent __user *lastdirent; struct sunos_dirent_callback buf; int error = -EBADF; - void *dirent = (void *)A(u_dirent); - if(fd >= SUNOS_NR_OPEN) + if (fd >= SUNOS_NR_OPEN) goto out; file = fget(fd); - if(!file) + if (!file) goto out; error = -EINVAL; - if(cnt < (sizeof(struct sunos_dirent) + 255)) + if (cnt < (sizeof(struct sunos_dirent) + 255)) goto out_putf; - buf.curr = (struct sunos_dirent *) dirent; + buf.curr = (struct sunos_dirent __user *) dirent; buf.previous = NULL; buf.count = cnt; buf.error = 0; @@ -358,8 +348,8 @@ }; struct sunos_direntry_callback { - struct sunos_direntry *curr; - struct sunos_direntry *previous; + struct sunos_direntry __user *curr; + struct sunos_direntry __user *previous; int count; int error; }; @@ -367,8 +357,9 @@ static int sunos_filldirentry(void * __buf, const char * name, int namlen, loff_t offset, ino_t ino, unsigned int d_type) { - struct sunos_direntry * dirent; - struct sunos_direntry_callback * buf = (struct sunos_direntry_callback *) __buf; + struct sunos_direntry __user *dirent; + struct sunos_direntry_callback * buf = + (struct sunos_direntry_callback *) __buf; int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1); buf->error = -EINVAL; /* only used if we fail.. */ @@ -382,34 +373,34 @@ put_user(reclen, &dirent->d_reclen); copy_to_user(dirent->d_name, name, namlen); put_user(0, dirent->d_name + namlen); - dirent = (void *) dirent + reclen; + dirent = (void __user *) dirent + reclen; buf->curr = dirent; buf->count -= reclen; return 0; } -asmlinkage int sunos_getdirentries(unsigned int fd, u32 u_dirent, - int cnt, u32 u_basep) +asmlinkage int sunos_getdirentries(unsigned int fd, + void __user *dirent, + int cnt, + unsigned int __user *basep) { - void *dirent = (void *) A(u_dirent); - unsigned int *basep = (unsigned int *)A(u_basep); struct file * file; - struct sunos_direntry * lastdirent; + struct sunos_direntry __user *lastdirent; int error = -EBADF; struct sunos_direntry_callback buf; - if(fd >= SUNOS_NR_OPEN) + if (fd >= SUNOS_NR_OPEN) goto out; file = fget(fd); - if(!file) + if (!file) goto out; error = -EINVAL; - if(cnt < (sizeof(struct sunos_direntry) + 255)) + if (cnt < (sizeof(struct sunos_direntry) + 255)) goto out_putf; - buf.curr = (struct sunos_direntry *) dirent; + buf.curr = (struct sunos_direntry __user *) dirent; buf.previous = NULL; buf.count = cnt; buf.error = 0; @@ -440,17 +431,22 @@ char mach[9]; }; -asmlinkage int sunos_uname(struct sunos_utsname *name) +asmlinkage int sunos_uname(struct sunos_utsname __user *name) { int ret; down_read(&uts_sem); - ret = copy_to_user(&name->sname[0], &system_utsname.sysname[0], sizeof(name->sname) - 1); - ret |= copy_to_user(&name->nname[0], &system_utsname.nodename[0], sizeof(name->nname) - 1); + ret = copy_to_user(&name->sname[0], &system_utsname.sysname[0], + sizeof(name->sname) - 1); + ret |= copy_to_user(&name->nname[0], &system_utsname.nodename[0], + sizeof(name->nname) - 1); ret |= put_user('\0', &name->nname[8]); - ret |= copy_to_user(&name->rel[0], &system_utsname.release[0], sizeof(name->rel) - 1); - ret |= copy_to_user(&name->ver[0], &system_utsname.version[0], sizeof(name->ver) - 1); - ret |= copy_to_user(&name->mach[0], &system_utsname.machine[0], sizeof(name->mach) - 1); + ret |= copy_to_user(&name->rel[0], &system_utsname.release[0], + sizeof(name->rel) - 1); + ret |= copy_to_user(&name->ver[0], &system_utsname.version[0], + sizeof(name->ver) - 1); + ret |= copy_to_user(&name->mach[0], &system_utsname.machine[0], + sizeof(name->mach) - 1); up_read(&uts_sem); return (ret ? -EFAULT : 0); } @@ -536,7 +532,7 @@ ret = compat_sys_select(width, compat_ptr(inp), compat_ptr(outp), compat_ptr(exp), compat_ptr(tvp_x)); if (ret == -EINTR && tvp_x) { - struct compat_timeval *tvp = compat_ptr(tvp_x); + struct compat_timeval __user *tvp = compat_ptr(tvp_x); time_t sec, usec; __get_user(sec, &tvp->tv_sec); @@ -552,6 +548,10 @@ return; } +#if 0 /* This code doesn't translate user pointers correctly, + * disable for now. -DaveM + */ + /* XXXXXXXXXX SunOS mount/umount. XXXXXXXXXXX */ #define SMNT_RDONLY 1 #define SMNT_NOSUID 2 @@ -600,7 +600,7 @@ struct file *file; file = fget(fd); - if(!file) + if (!file) return 0; inode = file->f_dentry->d_inode; @@ -645,7 +645,7 @@ } /* XXXXXXXXXXXXXXXXXXXX */ -static int sunos_nfs_mount(char *dir_name, int linux_flags, void *data) +static int sunos_nfs_mount(char *dir_name, int linux_flags, void __user *data) { int server_fd, err; char *the_name, *mount_page; @@ -665,10 +665,10 @@ if (server_fd < 0) return -ENXIO; - if (copy_from_user(&linux_nfs_mount.addr,sunos_mount.addr, - sizeof(*sunos_mount.addr)) || - copy_from_user(&linux_nfs_mount.root,sunos_mount.fh, - sizeof(*sunos_mount.fh))) { + if (copy_from_user(&linux_nfs_mount.addr, sunos_mount.addr, + sizeof(*sunos_mount.addr)) || + copy_from_user(&linux_nfs_mount.root, sunos_mount.fh, + sizeof(*sunos_mount.fh))) { sys_close (server_fd); return -EFAULT; } @@ -694,7 +694,7 @@ linux_nfs_mount.acdirmax = sunos_mount.acdirmax; the_name = getname(sunos_mount.hostname); - if(IS_ERR(the_name)) + if (IS_ERR(the_name)) return PTR_ERR(the_name); strlcpy(linux_nfs_mount.hostname, the_name, @@ -733,11 +733,11 @@ if (flags & (SMNT_GRPID|SMNT_NOSUB|SMNT_MULTI|SMNT_SYS5)) goto out; - if(flags & SMNT_REMOUNT) + if (flags & SMNT_REMOUNT) linux_flags |= MS_REMOUNT; - if(flags & SMNT_RDONLY) + if (flags & SMNT_RDONLY) linux_flags |= MS_RDONLY; - if(flags & SMNT_NOSUID) + if (flags & SMNT_NOSUID) linux_flags |= MS_NOSUID; dir_page = getname(dir); @@ -750,20 +750,20 @@ if (IS_ERR(type_page)) goto out1; - if(strcmp(type_page, "ext2") == 0) { + if (strcmp(type_page, "ext2") == 0) { dev_fname = getname(data); - } else if(strcmp(type_page, "iso9660") == 0) { + } else if (strcmp(type_page, "iso9660") == 0) { dev_fname = getname(data); - } else if(strcmp(type_page, "minix") == 0) { + } else if (strcmp(type_page, "minix") == 0) { dev_fname = getname(data); - } else if(strcmp(type_page, "nfs") == 0) { + } else if (strcmp(type_page, "nfs") == 0) { ret = sunos_nfs_mount (dir_page, flags, data); goto out2; - } else if(strcmp(type_page, "ufs") == 0) { + } else if (strcmp(type_page, "ufs") == 0) { printk("Warning: UFS filesystem mounts unsupported.\n"); ret = -ENODEV; goto out2; - } else if(strcmp(type_page, "proc")) { + } else if (strcmp(type_page, "proc")) { ret = -ENODEV; goto out2; } @@ -782,15 +782,15 @@ out: return ret; } - +#endif asmlinkage int sunos_setpgrp(pid_t pid, pid_t pgid) { int ret; /* So stupid... */ - if((!pid || pid == current->pid) && - !pgid) { + if ((!pid || pid == current->pid) && + !pgid) { sys_setsid(); ret = 0; } else { @@ -800,16 +800,15 @@ } /* So stupid... */ -extern long compat_sys_wait4(compat_pid_t, compat_uint_t *, int, - struct compat_rusage *); +extern long compat_sys_wait4(compat_pid_t, compat_uint_t __user *, int, + struct compat_rusage __user *); -asmlinkage int sunos_wait4(compat_pid_t pid, u32 stat_addr, int options, u32 ru) +asmlinkage int sunos_wait4(compat_pid_t pid, compat_uint_t __user *stat_addr, int options, struct compat_rusage __user *ru) { int ret; ret = compat_sys_wait4((pid ? pid : ((compat_pid_t)-1)), - (compat_uint_t *)A(stat_addr), options, - (struct compat_rusage *)A(ru)); + stat_addr, options, ru); return ret; } @@ -825,7 +824,7 @@ return -1; } -extern asmlinkage u32 sunos_gethostid(void) +asmlinkage u32 sunos_gethostid(void) { u32 ret; @@ -844,7 +843,7 @@ #define _SC_SAVED_IDS 7 #define _SC_VERSION 8 -extern asmlinkage s32 sunos_sysconf (int name) +asmlinkage s32 sunos_sysconf (int name) { s32 ret; @@ -883,7 +882,7 @@ return ret; } -asmlinkage int sunos_semsys(int op, u32 arg1, u32 arg2, u32 arg3, u32 ptr) +asmlinkage int sunos_semsys(int op, u32 arg1, u32 arg2, u32 arg3, void __user *ptr) { union semun arg4; int ret; @@ -908,7 +907,8 @@ arg3=SETALL; break; } /* sys_semctl(): */ - arg4.__pad=(void *)A(ptr); /* value to modify semaphore to */ + /* value to modify semaphore to */ + arg4.__pad = ptr; ret = sys_semctl((int)arg1, (int)arg2, (int)arg3, arg4); break; case 1: @@ -917,7 +917,8 @@ break; case 2: /* sys_semop(): */ - ret = sys_semop((int)arg1, (struct sembuf *)A(arg2), (unsigned)arg3); + ret = sys_semop((int)arg1, (struct sembuf __user *)(unsigned long)arg2, + (unsigned int) arg3); break; default: ret = -EINVAL; @@ -959,65 +960,65 @@ compat_ipc_pid_t msg_lrpid; }; -static inline int sunos_msqid_get(struct msqid_ds32 *user, +static inline int sunos_msqid_get(struct msqid_ds32 __user *user, struct msqid_ds *kern) { - if(get_user(kern->msg_perm.key, &user->msg_perm.key) || - __get_user(kern->msg_perm.uid, &user->msg_perm.uid) || - __get_user(kern->msg_perm.gid, &user->msg_perm.gid) || - __get_user(kern->msg_perm.cuid, &user->msg_perm.cuid) || - __get_user(kern->msg_perm.cgid, &user->msg_perm.cgid) || - __get_user(kern->msg_stime, &user->msg_stime) || - __get_user(kern->msg_rtime, &user->msg_rtime) || - __get_user(kern->msg_ctime, &user->msg_ctime) || - __get_user(kern->msg_ctime, &user->msg_cbytes) || - __get_user(kern->msg_ctime, &user->msg_qnum) || - __get_user(kern->msg_ctime, &user->msg_qbytes) || - __get_user(kern->msg_ctime, &user->msg_lspid) || - __get_user(kern->msg_ctime, &user->msg_lrpid)) + if (get_user(kern->msg_perm.key, &user->msg_perm.key) || + __get_user(kern->msg_perm.uid, &user->msg_perm.uid) || + __get_user(kern->msg_perm.gid, &user->msg_perm.gid) || + __get_user(kern->msg_perm.cuid, &user->msg_perm.cuid) || + __get_user(kern->msg_perm.cgid, &user->msg_perm.cgid) || + __get_user(kern->msg_stime, &user->msg_stime) || + __get_user(kern->msg_rtime, &user->msg_rtime) || + __get_user(kern->msg_ctime, &user->msg_ctime) || + __get_user(kern->msg_ctime, &user->msg_cbytes) || + __get_user(kern->msg_ctime, &user->msg_qnum) || + __get_user(kern->msg_ctime, &user->msg_qbytes) || + __get_user(kern->msg_ctime, &user->msg_lspid) || + __get_user(kern->msg_ctime, &user->msg_lrpid)) return -EFAULT; return 0; } -static inline int sunos_msqid_put(struct msqid_ds32 *user, +static inline int sunos_msqid_put(struct msqid_ds32 __user *user, struct msqid_ds *kern) { - if(put_user(kern->msg_perm.key, &user->msg_perm.key) || - __put_user(kern->msg_perm.uid, &user->msg_perm.uid) || - __put_user(kern->msg_perm.gid, &user->msg_perm.gid) || - __put_user(kern->msg_perm.cuid, &user->msg_perm.cuid) || - __put_user(kern->msg_perm.cgid, &user->msg_perm.cgid) || - __put_user(kern->msg_stime, &user->msg_stime) || - __put_user(kern->msg_rtime, &user->msg_rtime) || - __put_user(kern->msg_ctime, &user->msg_ctime) || - __put_user(kern->msg_ctime, &user->msg_cbytes) || - __put_user(kern->msg_ctime, &user->msg_qnum) || - __put_user(kern->msg_ctime, &user->msg_qbytes) || - __put_user(kern->msg_ctime, &user->msg_lspid) || - __put_user(kern->msg_ctime, &user->msg_lrpid)) + if (put_user(kern->msg_perm.key, &user->msg_perm.key) || + __put_user(kern->msg_perm.uid, &user->msg_perm.uid) || + __put_user(kern->msg_perm.gid, &user->msg_perm.gid) || + __put_user(kern->msg_perm.cuid, &user->msg_perm.cuid) || + __put_user(kern->msg_perm.cgid, &user->msg_perm.cgid) || + __put_user(kern->msg_stime, &user->msg_stime) || + __put_user(kern->msg_rtime, &user->msg_rtime) || + __put_user(kern->msg_ctime, &user->msg_ctime) || + __put_user(kern->msg_ctime, &user->msg_cbytes) || + __put_user(kern->msg_ctime, &user->msg_qnum) || + __put_user(kern->msg_ctime, &user->msg_qbytes) || + __put_user(kern->msg_ctime, &user->msg_lspid) || + __put_user(kern->msg_ctime, &user->msg_lrpid)) return -EFAULT; return 0; } -static inline int sunos_msgbuf_get(struct msgbuf32 *user, struct msgbuf *kern, int len) +static inline int sunos_msgbuf_get(struct msgbuf32 __user *user, struct msgbuf *kern, int len) { - if(get_user(kern->mtype, &user->mtype) || - __copy_from_user(kern->mtext, &user->mtext, len)) + if (get_user(kern->mtype, &user->mtype) || + __copy_from_user(kern->mtext, &user->mtext, len)) return -EFAULT; return 0; } -static inline int sunos_msgbuf_put(struct msgbuf32 *user, struct msgbuf *kern, int len) +static inline int sunos_msgbuf_put(struct msgbuf32 __user *user, struct msgbuf *kern, int len) { - if(put_user(kern->mtype, &user->mtype) || - __copy_to_user(user->mtext, kern->mtext, len)) + if (put_user(kern->mtype, &user->mtype) || + __copy_to_user(user->mtext, kern->mtext, len)) return -EFAULT; return 0; } asmlinkage int sunos_msgsys(int op, u32 arg1, u32 arg2, u32 arg3, u32 arg4) { - struct sparc_stackf32 *sp; + struct sparc_stackf32 __user *sp; struct msqid_ds kds; struct msgbuf *kmbuf; mm_segment_t old_fs = get_fs(); @@ -1029,13 +1030,13 @@ rval = sys_msgget((key_t)arg1, (int)arg2); break; case 1: - if(!sunos_msqid_get((struct msqid_ds32 *)A(arg3), &kds)) { + if (!sunos_msqid_get((struct msqid_ds32 __user *)(unsigned long)arg3, &kds)) { set_fs(KERNEL_DS); rval = sys_msgctl((int)arg1, (int)arg2, - (struct msqid_ds *)A(arg3)); + (struct msqid_ds __user *)(unsigned long)arg3); set_fs(old_fs); - if(!rval) - rval = sunos_msqid_put((struct msqid_ds32 *)A(arg3), + if (!rval) + rval = sunos_msqid_put((struct msqid_ds32 __user *)(unsigned long)arg3, &kds); } else rval = -EFAULT; @@ -1044,21 +1045,22 @@ rval = -EFAULT; kmbuf = (struct msgbuf *)kmalloc(sizeof(struct msgbuf) + arg3, GFP_KERNEL); - if(!kmbuf) + if (!kmbuf) break; - sp = (struct sparc_stackf32 *) + sp = (struct sparc_stackf32 __user *) (current_thread_info()->kregs->u_regs[UREG_FP] & 0xffffffffUL); - if(get_user(arg5, &sp->xxargs[0])) { + if (get_user(arg5, &sp->xxargs[0])) { rval = -EFAULT; kfree(kmbuf); break; } set_fs(KERNEL_DS); - rval = sys_msgrcv((int)arg1, kmbuf, (size_t)arg3, + rval = sys_msgrcv((int)arg1, (struct msgbuf __user *) kmbuf, + (size_t)arg3, (long)arg4, (int)arg5); set_fs(old_fs); - if(!rval) - rval = sunos_msgbuf_put((struct msgbuf32 *)A(arg2), + if (!rval) + rval = sunos_msgbuf_put((struct msgbuf32 __user *)(unsigned long)arg2, kmbuf, arg3); kfree(kmbuf); break; @@ -1066,11 +1068,12 @@ rval = -EFAULT; kmbuf = (struct msgbuf *)kmalloc(sizeof(struct msgbuf) + arg3, GFP_KERNEL); - if(!kmbuf || sunos_msgbuf_get((struct msgbuf32 *)A(arg2), - kmbuf, arg3)) + if (!kmbuf || sunos_msgbuf_get((struct msgbuf32 __user *)(unsigned long)arg2, + kmbuf, arg3)) break; set_fs(KERNEL_DS); - rval = sys_msgsnd((int)arg1, kmbuf, (size_t)arg3, (int)arg4); + rval = sys_msgsnd((int)arg1, (struct msgbuf __user *) kmbuf, + (size_t)arg3, (int)arg4); set_fs(old_fs); kfree(kmbuf); break; @@ -1092,40 +1095,40 @@ unsigned short shm_nattch; }; -static inline int sunos_shmid_get(struct shmid_ds32 *user, +static inline int sunos_shmid_get(struct shmid_ds32 __user *user, struct shmid_ds *kern) { - if(get_user(kern->shm_perm.key, &user->shm_perm.key) || - __get_user(kern->shm_perm.uid, &user->shm_perm.uid) || - __get_user(kern->shm_perm.gid, &user->shm_perm.gid) || - __get_user(kern->shm_perm.cuid, &user->shm_perm.cuid) || - __get_user(kern->shm_perm.cgid, &user->shm_perm.cgid) || - __get_user(kern->shm_segsz, &user->shm_segsz) || - __get_user(kern->shm_atime, &user->shm_atime) || - __get_user(kern->shm_dtime, &user->shm_dtime) || - __get_user(kern->shm_ctime, &user->shm_ctime) || - __get_user(kern->shm_cpid, &user->shm_cpid) || - __get_user(kern->shm_lpid, &user->shm_lpid) || - __get_user(kern->shm_nattch, &user->shm_nattch)) + if (get_user(kern->shm_perm.key, &user->shm_perm.key) || + __get_user(kern->shm_perm.uid, &user->shm_perm.uid) || + __get_user(kern->shm_perm.gid, &user->shm_perm.gid) || + __get_user(kern->shm_perm.cuid, &user->shm_perm.cuid) || + __get_user(kern->shm_perm.cgid, &user->shm_perm.cgid) || + __get_user(kern->shm_segsz, &user->shm_segsz) || + __get_user(kern->shm_atime, &user->shm_atime) || + __get_user(kern->shm_dtime, &user->shm_dtime) || + __get_user(kern->shm_ctime, &user->shm_ctime) || + __get_user(kern->shm_cpid, &user->shm_cpid) || + __get_user(kern->shm_lpid, &user->shm_lpid) || + __get_user(kern->shm_nattch, &user->shm_nattch)) return -EFAULT; return 0; } -static inline int sunos_shmid_put(struct shmid_ds32 *user, +static inline int sunos_shmid_put(struct shmid_ds32 __user *user, struct shmid_ds *kern) { - if(put_user(kern->shm_perm.key, &user->shm_perm.key) || - __put_user(kern->shm_perm.uid, &user->shm_perm.uid) || - __put_user(kern->shm_perm.gid, &user->shm_perm.gid) || - __put_user(kern->shm_perm.cuid, &user->shm_perm.cuid) || - __put_user(kern->shm_perm.cgid, &user->shm_perm.cgid) || - __put_user(kern->shm_segsz, &user->shm_segsz) || - __put_user(kern->shm_atime, &user->shm_atime) || - __put_user(kern->shm_dtime, &user->shm_dtime) || - __put_user(kern->shm_ctime, &user->shm_ctime) || - __put_user(kern->shm_cpid, &user->shm_cpid) || - __put_user(kern->shm_lpid, &user->shm_lpid) || - __put_user(kern->shm_nattch, &user->shm_nattch)) + if (put_user(kern->shm_perm.key, &user->shm_perm.key) || + __put_user(kern->shm_perm.uid, &user->shm_perm.uid) || + __put_user(kern->shm_perm.gid, &user->shm_perm.gid) || + __put_user(kern->shm_perm.cuid, &user->shm_perm.cuid) || + __put_user(kern->shm_perm.cgid, &user->shm_perm.cgid) || + __put_user(kern->shm_segsz, &user->shm_segsz) || + __put_user(kern->shm_atime, &user->shm_atime) || + __put_user(kern->shm_dtime, &user->shm_dtime) || + __put_user(kern->shm_ctime, &user->shm_ctime) || + __put_user(kern->shm_cpid, &user->shm_cpid) || + __put_user(kern->shm_lpid, &user->shm_lpid) || + __put_user(kern->shm_nattch, &user->shm_nattch)) return -EFAULT; return 0; } @@ -1140,25 +1143,26 @@ switch(op) { case 0: /* do_shmat(): attach a shared memory area */ - rval = do_shmat((int)arg1,(char *)A(arg2),(int)arg3,&raddr); - if(!rval) + rval = do_shmat((int)arg1,(char __user *)(unsigned long)arg2,(int)arg3,&raddr); + if (!rval) rval = (int) raddr; break; case 1: /* sys_shmctl(): modify shared memory area attr. */ - if(!sunos_shmid_get((struct shmid_ds32 *)A(arg3), &ksds)) { + if (!sunos_shmid_get((struct shmid_ds32 __user *)(unsigned long)arg3, &ksds)) { set_fs(KERNEL_DS); - rval = sys_shmctl((int)arg1,(int)arg2, &ksds); + rval = sys_shmctl((int) arg1,(int) arg2, + (struct shmid_ds __user *) &ksds); set_fs(old_fs); - if(!rval) - rval = sunos_shmid_put((struct shmid_ds32 *)A(arg3), + if (!rval) + rval = sunos_shmid_put((struct shmid_ds32 __user *)(unsigned long)arg3, &ksds); } else rval = -EFAULT; break; case 2: /* sys_shmdt(): detach a shared memory area */ - rval = sys_shmdt((char *)A(arg1)); + rval = sys_shmdt((char __user *)(unsigned long)arg1); break; case 3: /* sys_shmget(): get a shared memory area */ @@ -1200,61 +1204,60 @@ return ret; } -asmlinkage int sunos_read(unsigned int fd, u32 buf, u32 count) +asmlinkage int sunos_read(unsigned int fd, char __user *buf, u32 count) { int ret; - ret = check_nonblock(sys_read(fd, (char *)A(buf), count), fd); + ret = check_nonblock(sys_read(fd, buf, count), fd); return ret; } -asmlinkage int sunos_readv(u32 fd, u32 vector, s32 count) +asmlinkage int sunos_readv(u32 fd, void __user *vector, s32 count) { int ret; - ret = check_nonblock(compat_sys_readv(fd, (void*)A(vector), count), fd); + ret = check_nonblock(compat_sys_readv(fd, vector, count), fd); return ret; } -asmlinkage int sunos_write(unsigned int fd, u32 buf, u32 count) +asmlinkage int sunos_write(unsigned int fd, char __user *buf, u32 count) { int ret; - ret = check_nonblock(sys_write(fd, (char *)A(buf), count), fd); + ret = check_nonblock(sys_write(fd, buf, count), fd); return ret; } -asmlinkage int sunos_writev(u32 fd, u32 vector, s32 count) +asmlinkage int sunos_writev(u32 fd, void __user *vector, s32 count) { int ret; - ret = check_nonblock(compat_sys_writev(fd, (void*)A(vector), count), fd); + ret = check_nonblock(compat_sys_writev(fd, vector, count), fd); return ret; } -asmlinkage int sunos_recv(int fd, u32 ubuf, int size, unsigned flags) +asmlinkage int sunos_recv(u32 __fd, void __user *ubuf, int size, unsigned flags) { - int ret; + int ret, fd = (int) __fd; - ret = check_nonblock(sys_recv(fd, (void *)A(ubuf), size, flags), fd); + ret = check_nonblock(sys_recv(fd, ubuf, size, flags), fd); return ret; } -asmlinkage int sunos_send(int fd, u32 buff, int len, unsigned flags) +asmlinkage int sunos_send(u32 __fd, void __user *buff, int len, unsigned flags) { - int ret; + int ret, fd = (int) __fd; - ret = check_nonblock(sys_send(fd, (void *)A(buff), len, flags), fd); + ret = check_nonblock(sys_send(fd, buff, len, flags), fd); return ret; } -asmlinkage int sunos_accept(int fd, u32 sa, u32 addrlen) +asmlinkage int sunos_accept(u32 __fd, struct sockaddr __user *sa, int __user *addrlen) { - int ret; + int ret, fd = (int) __fd; while (1) { - ret = check_nonblock(sys_accept(fd, (struct sockaddr *)A(sa), - (int *)A(addrlen)), fd); + ret = check_nonblock(sys_accept(fd, sa, addrlen), fd); if (ret != -ENETUNREACH && ret != -EHOSTUNREACH) break; } @@ -1263,7 +1266,9 @@ #define SUNOS_SV_INTERRUPT 2 -asmlinkage int sunos_sigaction (int sig, u32 act, u32 oact) +asmlinkage int sunos_sigaction (int sig, + struct old_sigaction32 __user *act, + struct old_sigaction32 __user *oact) { struct k_sigaction new_ka, old_ka; int ret; @@ -1272,11 +1277,11 @@ compat_old_sigset_t mask; u32 u_handler; - if (get_user(u_handler, &((struct old_sigaction32 *)A(act))->sa_handler) || - __get_user(new_ka.sa.sa_flags, &((struct old_sigaction32 *)A(act))->sa_flags)) + if (get_user(u_handler, &act->sa_handler) || + __get_user(new_ka.sa.sa_flags, &act->sa_flags)) return -EFAULT; new_ka.sa.sa_handler = (void *) (long) u_handler; - __get_user(mask, &((struct old_sigaction32 *)A(act))->sa_mask); + __get_user(mask, &act->sa_mask); new_ka.sa.sa_restorer = NULL; new_ka.ka_restorer = NULL; siginitset(&new_ka.sa.sa_mask, mask); @@ -1287,18 +1292,22 @@ if (!ret && oact) { old_ka.sa.sa_flags ^= SUNOS_SV_INTERRUPT; - if (put_user((long)old_ka.sa.sa_handler, &((struct old_sigaction32 *)A(oact))->sa_handler) || - __put_user(old_ka.sa.sa_flags, &((struct old_sigaction32 *)A(oact))->sa_flags)) + if (put_user((long)old_ka.sa.sa_handler, &oact->sa_handler) || + __put_user(old_ka.sa.sa_flags, &oact->sa_flags)) return -EFAULT; - __put_user(old_ka.sa.sa_mask.sig[0], &((struct old_sigaction32 *)A(oact))->sa_mask); + __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask); } return ret; } -asmlinkage int sunos_setsockopt(int fd, int level, int optname, u32 optval, - int optlen) +asmlinkage int sunos_setsockopt(u32 __fd, u32 __level, u32 __optname, + char __user *optval, u32 __optlen) { + int fd = (int) __fd; + int level = (int) __level; + int optname = (int) __optname; + int optlen = (int) __optlen; int tr_opt = optname; int ret; @@ -1307,13 +1316,17 @@ if (tr_opt >=2 && tr_opt <= 6) tr_opt += 30; } - ret = sys_setsockopt(fd, level, tr_opt, (char *)A(optval), optlen); + ret = sys_setsockopt(fd, level, tr_opt, + optval, optlen); return ret; } -asmlinkage int sunos_getsockopt(int fd, int level, int optname, - u32 optval, u32 optlen) +asmlinkage int sunos_getsockopt(u32 __fd, u32 __level, u32 __optname, + char __user *optval, int __user *optlen) { + int fd = (int) __fd; + int level = (int) __level; + int optname = (int) __optname; int tr_opt = optname; int ret; @@ -1322,6 +1335,7 @@ if (tr_opt >=2 && tr_opt <= 6) tr_opt += 30; } - ret = compat_sys_getsockopt(fd, level, tr_opt, (void*)(unsigned long)optval, (void*)(unsigned long)optlen); + ret = compat_sys_getsockopt(fd, level, tr_opt, + optval, optlen); return ret; } diff -urN linux-2.6.7-rc2/arch/sparc64/kernel/systbls.S linux-2.6.7-rc3/arch/sparc64/kernel/systbls.S --- linux-2.6.7-rc2/arch/sparc64/kernel/systbls.S 2004-06-07 12:54:48.758032259 -0700 +++ linux-2.6.7-rc3/arch/sparc64/kernel/systbls.S 2004-06-07 12:55:01.783571729 -0700 @@ -19,62 +19,62 @@ .globl sys_call_table32 sys_call_table32: -/*0*/ .word sys_restart_syscall, sparc_exit, sys_fork, sys_read, sys_write -/*5*/ .word sparc32_open, sys_close, compat_sys_wait4, sys_creat, sys_link +/*0*/ .word sys_restart_syscall, sys32_exit, sys_fork, sys_read, sys_write +/*5*/ .word sys32_open, sys_close, sys32_wait4, sys32_creat, sys_link /*10*/ .word sys_unlink, sunos_execv, sys_chdir, sys32_chown16, sys32_mknod -/*15*/ .word sys32_chmod, sys32_lchown16, sparc_brk, sys_perfctr, sys32_lseek +/*15*/ .word sys_chmod, sys32_lchown16, sparc_brk, sys32_perfctr, sys32_lseek /*20*/ .word sys_getpid, sys_capget, sys_capset, sys32_setuid16, sys32_getuid16 /*25*/ .word sys_time, sys_ptrace, sys_alarm, sys32_sigaltstack, sys32_pause -/*30*/ .word compat_sys_utime, sys_lchown, sys_fchown, sys_access, sys_nice - .word sys_chown, sys_sync, sys_kill, compat_sys_newstat, sys32_sendfile +/*30*/ .word compat_sys_utime, sys_lchown, sys_fchown, sys32_access, sys32_nice + .word sys_chown, sys_sync, sys32_kill, compat_sys_newstat, sys32_sendfile /*40*/ .word compat_sys_newlstat, sys_dup, sys_pipe, compat_sys_times, sys_getuid - .word sys_umount, sys32_setgid16, sys32_getgid16, sys_signal, sys32_geteuid16 + .word sys32_umount, sys32_setgid16, sys32_getgid16, sys32_signal, sys32_geteuid16 /*50*/ .word sys32_getegid16, sys_acct, sys_nis_syscall, sys_getgid, compat_sys_ioctl - .word sys_reboot, sys32_mmap2, sys_symlink, sys_readlink, sys32_execve -/*60*/ .word sys_umask, sys_chroot, compat_sys_newfstat, sys_fstat64, sys_getpagesize - .word sys_msync, sys_vfork, sys32_pread64, sys32_pwrite64, sys_geteuid -/*70*/ .word sys_getegid, sys32_mmap, sys_setreuid, sys_munmap, sys_mprotect + .word sys32_reboot, sys32_mmap2, sys_symlink, sys32_readlink, sys32_execve +/*60*/ .word sys32_umask, sys_chroot, compat_sys_newfstat, sys_fstat64, sys_getpagesize + .word sys32_msync, sys_vfork, sys32_pread64, sys32_pwrite64, sys_geteuid +/*70*/ .word sys_getegid, sys_mmap, sys_setreuid, sys_munmap, sys_mprotect .word sys_madvise, sys_vhangup, sys32_truncate64, sys_mincore, sys32_getgroups16 -/*80*/ .word sys32_setgroups16, sys_getpgrp, sys_setgroups, compat_sys_setitimer, sys32_ftruncate64 - .word sys_swapon, compat_sys_getitimer, sys_setuid, sys_sethostname, sys_setgid +/*80*/ .word sys32_setgroups16, sys_getpgrp, sys32_setgroups, sys32_setitimer, sys32_ftruncate64 + .word sys32_swapon, sys32_getitimer, sys_setuid, sys32_sethostname, sys_setgid /*90*/ .word sys_dup2, sys_setfsuid, compat_sys_fcntl, sys32_select, sys_setfsgid - .word sys_fsync, sys_setpriority32, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall -/*100*/ .word sys_getpriority, sys32_rt_sigreturn, sys32_rt_sigaction, sys32_rt_sigprocmask, sys32_rt_sigpending + .word sys_fsync, sys32_setpriority, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall +/*100*/ .word sys32_getpriority, sys32_rt_sigreturn, sys32_rt_sigaction, sys32_rt_sigprocmask, sys32_rt_sigpending .word sys32_rt_sigtimedwait, sys32_rt_sigqueueinfo, sys32_rt_sigsuspend, sys_setresuid, sys_getresuid /*110*/ .word sys_setresgid, sys_getresgid, sys_setregid, sys_nis_syscall, sys_nis_syscall - .word sys_getgroups, sys32_gettimeofday, compat_sys_getrusage, sys_nis_syscall, sys_getcwd + .word sys32_getgroups, sys32_gettimeofday, sys32_getrusage, sys_nis_syscall, sys_getcwd /*120*/ .word compat_sys_readv, compat_sys_writev, sys32_settimeofday, sys32_fchown16, sys_fchmod .word sys_nis_syscall, sys32_setreuid16, sys32_setregid16, sys_rename, sys_truncate /*130*/ .word sys_ftruncate, sys_flock, sys_lstat64, sys_nis_syscall, sys_nis_syscall - .word sys_nis_syscall, sys_mkdir, sys_rmdir, sys32_utimes, sys_stat64 + .word sys_nis_syscall, sys32_mkdir, sys_rmdir, sys32_utimes, sys_stat64 /*140*/ .word sys32_sendfile64, sys_nis_syscall, sys32_futex, sys_gettid, compat_sys_getrlimit - .word compat_sys_setrlimit, sys_pivot_root, sys32_prctl, sys32_pciconfig_read, sys32_pciconfig_write + .word compat_sys_setrlimit, sys_pivot_root, sys32_prctl, sys_pciconfig_read, sys_pciconfig_write /*150*/ .word sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_poll, sys_getdents64 .word compat_sys_fcntl64, sys_ni_syscall, compat_sys_statfs, compat_sys_fstatfs, sys_oldumount -/*160*/ .word compat_sys_sched_setaffinity, compat_sys_sched_getaffinity, sys_getdomainname, sys_setdomainname, sys_nis_syscall - .word sys_quotactl, sys_set_tid_address, compat_sys_mount, sys_ustat, sys_setxattr -/*170*/ .word sys_lsetxattr, sys_fsetxattr, sys_getxattr, sys_lgetxattr, sys32_getdents - .word sys_setsid, sys_fchdir, sys_fgetxattr, sys_listxattr, sys_llistxattr -/*180*/ .word sys_flistxattr, sys_removexattr, sys_lremovexattr, compat_sys_sigpending, sys_ni_syscall - .word sys_setpgid, sys_fremovexattr, sys_tkill, sys_exit_group, sparc64_newuname -/*190*/ .word sys32_init_module, sparc64_personality, sys_remap_file_pages, sys_epoll_create, sys_epoll_ctl - .word sys_epoll_wait, sys_nis_syscall, sys_getppid, sys32_sigaction, sys_sgetmask -/*200*/ .word sys_ssetmask, sys_sigsuspend, compat_sys_newlstat, sys_uselib, old32_readdir - .word sys32_readahead, sys32_socketcall, sys_syslog, sys32_lookup_dcookie, sys32_fadvise64 -/*210*/ .word sys32_fadvise64_64, sys_tgkill, sys_waitpid, sys_swapoff, sys32_sysinfo +/*160*/ .word compat_sys_sched_setaffinity, compat_sys_sched_getaffinity, sys32_getdomainname, sys32_setdomainname, sys_nis_syscall + .word sys_quotactl, sys_set_tid_address, compat_sys_mount, sys_ustat, sys32_setxattr +/*170*/ .word sys32_lsetxattr, sys32_fsetxattr, sys_getxattr, sys_lgetxattr, sys32_getdents + .word sys_setsid, sys_fchdir, sys32_fgetxattr, sys_listxattr, sys_llistxattr +/*180*/ .word sys32_flistxattr, sys_removexattr, sys_lremovexattr, compat_sys_sigpending, sys_ni_syscall + .word sys32_setpgid, sys32_fremovexattr, sys32_tkill, sys32_exit_group, sparc64_newuname +/*190*/ .word sys32_init_module, sparc64_personality, sys_remap_file_pages, sys32_epoll_create, sys32_epoll_ctl + .word sys32_epoll_wait, sys_nis_syscall, sys_getppid, sys32_sigaction, sys_sgetmask +/*200*/ .word sys32_ssetmask, sys_sigsuspend, compat_sys_newlstat, sys_uselib, old32_readdir + .word sys32_readahead, sys32_socketcall, sys32_syslog, sys32_lookup_dcookie, sys32_fadvise64 +/*210*/ .word sys32_fadvise64_64, sys32_tgkill, sys32_waitpid, sys_swapoff, sys32_sysinfo .word sys32_ipc, sys32_sigreturn, sys_clone, sys_nis_syscall, sys32_adjtimex -/*220*/ .word compat_sys_sigprocmask, sys_ni_syscall, sys32_delete_module, sys_ni_syscall, sys_getpgid +/*220*/ .word sys32_sigprocmask, sys_ni_syscall, sys32_delete_module, sys_ni_syscall, sys32_getpgid .word sys32_bdflush, sys32_sysfs, sys_nis_syscall, sys32_setfsuid16, sys32_setfsgid16 /*230*/ .word sys32_select, sys_time, sys_nis_syscall, sys_stime, compat_statfs64 - .word compat_fstatfs64, sys_llseek, sys_mlock, sys_munlock, sys_mlockall -/*240*/ .word sys_munlockall, sys_sched_setparam, sys_sched_getparam, sys_sched_setscheduler, sys_sched_getscheduler - .word sys_sched_yield, sys_sched_get_priority_max, sys_sched_get_priority_min, sys32_sched_rr_get_interval, compat_sys_nanosleep -/*250*/ .word sys32_mremap, sys32_sysctl, sys_getsid, sys_fdatasync, compat_sys_nfsservctl - .word sys_ni_syscall, compat_clock_settime, compat_clock_gettime, compat_clock_getres, compat_clock_nanosleep -/*260*/ .word compat_sys_sched_getaffinity, compat_sys_sched_setaffinity, compat_timer_settime, compat_timer_gettime, sys_timer_getoverrun + .word compat_fstatfs64, sys_llseek, sys_mlock, sys_munlock, sys32_mlockall +/*240*/ .word sys_munlockall, sys32_sched_setparam, sys32_sched_getparam, sys32_sched_setscheduler, sys32_sched_getscheduler + .word sys_sched_yield, sys32_sched_get_priority_max, sys32_sched_get_priority_min, sys32_sched_rr_get_interval, compat_sys_nanosleep +/*250*/ .word sys32_mremap, sys32_sysctl, sys32_getsid, sys_fdatasync, sys32_nfsservctl + .word sys_ni_syscall, sys32_clock_settime, compat_clock_gettime, compat_clock_getres, sys32_clock_nanosleep +/*260*/ .word compat_sys_sched_getaffinity, compat_sys_sched_setaffinity, sys32_timer_settime, compat_timer_gettime, sys_timer_getoverrun .word sys_timer_delete, sys32_timer_create, sys_ni_syscall, compat_sys_io_setup, sys_io_destroy -/*270*/ .word compat_sys_io_submit, sys_io_cancel, compat_sys_io_getevents, compat_sys_mq_open, sys_mq_unlink - .word sys32_mq_timedsend, sys32_mq_timedreceive, compat_sys_mq_notify, compat_sys_mq_getsetattr, sys_ni_syscall +/*270*/ .word sys32_io_submit, sys_io_cancel, compat_sys_io_getevents, sys32_mq_open, sys_mq_unlink + .word sys_mq_timedsend, sys_mq_timedreceive, compat_sys_mq_notify, compat_sys_mq_getsetattr, sys_ni_syscall /*280*/ .word sys_ni_syscall, sys_ni_syscall, sys_ni_syscall /* Now the 64-bit native Linux syscall table. */ @@ -148,12 +148,12 @@ .align 4 .globl sunos_sys_table sunos_sys_table: -/*0*/ .word sunos_indir, sparc_exit, sys_fork +/*0*/ .word sunos_indir, sys32_exit, sys_fork .word sunos_read, sunos_write, sunos_open .word sys_close, sunos_wait4, sys_creat .word sys_link, sys_unlink, sunos_execv .word sys_chdir, sunos_nosys, sys32_mknod - .word sys32_chmod, sys32_lchown16, sunos_brk + .word sys_chmod, sys32_lchown16, sunos_brk .word sunos_nosys, sys32_lseek, sunos_getpid .word sunos_nosys, sunos_nosys, sunos_nosys .word sunos_getuid, sunos_nosys, sys_ptrace @@ -180,32 +180,32 @@ .word compat_sys_getitimer, sys_gethostname, sys_sethostname .word sunos_getdtablesize, sys_dup2, sunos_nop .word compat_sys_fcntl, sunos_select, sunos_nop - .word sys_fsync, sys_setpriority32, sys_socket - .word sys_connect, sunos_accept + .word sys_fsync, sys32_setpriority, sys32_socket + .word sys32_connect, sunos_accept /*100*/ .word sys_getpriority, sunos_send, sunos_recv - .word sunos_nosys, sys_bind, sunos_setsockopt - .word sys_listen, sunos_nosys, sunos_sigaction + .word sunos_nosys, sys32_bind, sunos_setsockopt + .word sys32_listen, sunos_nosys, sunos_sigaction .word sunos_sigblock, sunos_sigsetmask, sys_sigpause - .word sys32_sigstack, compat_sys_recvmsg, compat_sys_sendmsg + .word sys32_sigstack, sys32_recvmsg, sys32_sendmsg .word sunos_nosys, sys32_gettimeofday, compat_sys_getrusage .word sunos_getsockopt, sunos_nosys, sunos_readv .word sunos_writev, sys32_settimeofday, sys32_fchown16 .word sys_fchmod, sys32_recvfrom, sys32_setreuid16 .word sys32_setregid16, sys_rename, sys_truncate .word sys_ftruncate, sys_flock, sunos_nosys - .word sys32_sendto, sys_shutdown, sys_socketpair + .word sys32_sendto, sys32_shutdown, sys32_socketpair .word sys_mkdir, sys_rmdir, sys32_utimes - .word sys32_sigreturn, sunos_nosys, sys_getpeername + .word sys32_sigreturn, sunos_nosys, sys32_getpeername .word sunos_gethostid, sunos_nosys, compat_sys_getrlimit .word compat_sys_setrlimit, sunos_killpg, sunos_nosys .word sunos_nosys, sunos_nosys -/*150*/ .word sys_getsockname, sunos_nosys, sunos_nosys +/*150*/ .word sys32_getsockname, sunos_nosys, sunos_nosys .word sys_poll, sunos_nosys, sunos_nosys .word sunos_getdirentries, compat_sys_statfs, compat_sys_fstatfs .word sys_oldumount, sunos_nosys, sunos_nosys .word sys_getdomainname, sys_setdomainname .word sunos_nosys, sys_quotactl, sunos_nosys - .word sunos_mount, sys_ustat, sunos_semsys + .word sunos_nosys, sys_ustat, sunos_semsys .word sunos_nosys, sunos_shmsys, sunos_audit .word sunos_nosys, sunos_getdents, sys_setsid .word sys_fchdir, sunos_nosys, sunos_nosys diff -urN linux-2.6.7-rc2/arch/sparc64/kernel/traps.c linux-2.6.7-rc3/arch/sparc64/kernel/traps.c --- linux-2.6.7-rc2/arch/sparc64/kernel/traps.c 2004-05-09 19:33:21.000000000 -0700 +++ linux-2.6.7-rc3/arch/sparc64/kernel/traps.c 2004-06-07 12:55:01.785571812 -0700 @@ -1708,7 +1708,7 @@ printk("\n"); } -void user_instruction_dump (unsigned int *pc) +static void user_instruction_dump (unsigned int __user *pc) { int i; unsigned int buf[9]; @@ -1813,7 +1813,7 @@ regs->tpc &= 0xffffffff; regs->tnpc &= 0xffffffff; } - user_instruction_dump ((unsigned int *) regs->tpc); + user_instruction_dump ((unsigned int __user *) regs->tpc); } #ifdef CONFIG_SMP smp_report_regs(); @@ -1838,7 +1838,7 @@ die_if_kernel("Kernel illegal instruction", regs); if (test_thread_flag(TIF_32BIT)) pc = (u32)pc; - if (get_user(insn, (u32 *)pc) != -EFAULT) { + if (get_user(insn, (u32 __user *) pc) != -EFAULT) { if ((insn & 0xc1ffc000) == 0x81700000) /* POPC */ { if (handle_popc(insn, regs)) return; @@ -1862,9 +1862,12 @@ if (regs->tstate & TSTATE_PRIV) { extern void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn, - unsigned long sfar, unsigned long sfsr); + unsigned long sfar, + unsigned long sfsr); - return kernel_unaligned_trap(regs, *((unsigned int *)regs->tpc), sfar, sfsr); + kernel_unaligned_trap(regs, *((unsigned int *)regs->tpc), + sfar, sfsr); + return; } info.si_signo = SIGBUS; info.si_errno = 0; diff -urN linux-2.6.7-rc2/arch/sparc64/kernel/unaligned.c linux-2.6.7-rc3/arch/sparc64/kernel/unaligned.c --- linux-2.6.7-rc2/arch/sparc64/kernel/unaligned.c 2004-06-07 12:54:48.760032341 -0700 +++ linux-2.6.7-rc3/arch/sparc64/kernel/unaligned.c 2004-06-07 12:55:01.786571853 -0700 @@ -128,12 +128,12 @@ win = (struct reg_window *)(regs->u_regs[UREG_FP] + STACK_BIAS); value = win->locals[reg - 16]; } else if (test_thread_flag(TIF_32BIT)) { - struct reg_window32 *win32; - win32 = (struct reg_window32 *)((unsigned long)((u32)regs->u_regs[UREG_FP])); + struct reg_window32 __user *win32; + win32 = (struct reg_window32 __user *)((unsigned long)((u32)regs->u_regs[UREG_FP])); get_user(value, &win32->locals[reg - 16]); } else { - struct reg_window *win; - win = (struct reg_window *)(regs->u_regs[UREG_FP] + STACK_BIAS); + struct reg_window __user *win; + win = (struct reg_window __user *)(regs->u_regs[UREG_FP] + STACK_BIAS); get_user(value, &win->locals[reg - 16]); } return value; @@ -477,12 +477,12 @@ regs->u_regs[rd] = ret; } else { if (test_thread_flag(TIF_32BIT)) { - struct reg_window32 *win32; - win32 = (struct reg_window32 *)((unsigned long)((u32)regs->u_regs[UREG_FP])); + struct reg_window32 __user *win32; + win32 = (struct reg_window32 __user *)((unsigned long)((u32)regs->u_regs[UREG_FP])); put_user(ret, &win32->locals[rd - 16]); } else { - struct reg_window *win; - win = (struct reg_window *)(regs->u_regs[UREG_FP] + STACK_BIAS); + struct reg_window __user *win; + win = (struct reg_window __user *)(regs->u_regs[UREG_FP] + STACK_BIAS); put_user(ret, &win->locals[rd - 16]); } } @@ -540,10 +540,10 @@ data_access_exception(regs, 0, addr); return 1; } - if (put_user (first >> 32, (u32 *)addr) || - __put_user ((u32)first, (u32 *)(addr + 4)) || - __put_user (second >> 32, (u32 *)(addr + 8)) || - __put_user ((u32)second, (u32 *)(addr + 12))) { + if (put_user (first >> 32, (u32 __user *)addr) || + __put_user ((u32)first, (u32 __user *)(addr + 4)) || + __put_user (second >> 32, (u32 __user *)(addr + 8)) || + __put_user ((u32)second, (u32 __user *)(addr + 12))) { data_access_exception(regs, 0, addr); return 1; } @@ -568,10 +568,10 @@ for (i = 0; i < size; i++) data[i] = 0; - err = get_user (data[0], (u32 *)addr); + err = get_user (data[0], (u32 __user *) addr); if (!err) { for (i = 1; i < size; i++) - err |= __get_user (data[i], (u32 *)(addr + 4*i)); + err |= __get_user (data[i], (u32 __user *)(addr + 4*i)); } if (err && !(asi & 0x2 /* NF */)) { data_access_exception(regs, 0, addr); @@ -620,13 +620,13 @@ if ((insn & 0x780000) == 0x180000) reg[1] = 0; } else if (test_thread_flag(TIF_32BIT)) { - put_user(0, (int *)reg); + put_user(0, (int __user *) reg); if ((insn & 0x780000) == 0x180000) - put_user(0, ((int *)reg) + 1); + put_user(0, ((int __user *) reg) + 1); } else { - put_user(0, reg); + put_user(0, (unsigned long __user *) reg); if ((insn & 0x780000) == 0x180000) - put_user(0, reg + 1); + put_user(0, (unsigned long __user *) reg + 1); } advance(regs); } @@ -646,13 +646,13 @@ die_if_kernel("lddfmna from kernel", regs); if (test_thread_flag(TIF_32BIT)) pc = (u32)pc; - if (get_user(insn, (u32 *)pc) != -EFAULT) { + if (get_user(insn, (u32 __user *) pc) != -EFAULT) { asi = sfsr >> 16; if ((asi > ASI_SNFL) || (asi < ASI_P)) goto daex; - if (get_user(first, (u32 *)sfar) || - get_user(second, (u32 *)(sfar + 4))) { + if (get_user(first, (u32 __user *)sfar) || + get_user(second, (u32 __user *)(sfar + 4))) { if (asi & 0x2) /* NF */ { first = 0; second = 0; } else @@ -698,7 +698,7 @@ die_if_kernel("stdfmna from kernel", regs); if (test_thread_flag(TIF_32BIT)) pc = (u32)pc; - if (get_user(insn, (u32 *)pc) != -EFAULT) { + if (get_user(insn, (u32 __user *) pc) != -EFAULT) { freg = ((insn >> 25) & 0x1e) | ((insn >> 20) & 0x20); asi = sfsr >> 16; value = 0; @@ -717,8 +717,8 @@ value = __swab64p(&value); break; default: goto daex; } - if (put_user (value >> 32, (u32 *)sfar) || - __put_user ((u32)value, (u32 *)(sfar + 4))) + if (put_user (value >> 32, (u32 __user *) sfar) || + __put_user ((u32)value, (u32 __user *)(sfar + 4))) goto daex; } else { daex: data_access_exception(regs, sfsr, sfar); diff -urN linux-2.6.7-rc2/arch/sparc64/math-emu/math.c linux-2.6.7-rc3/arch/sparc64/math-emu/math.c --- linux-2.6.7-rc2/arch/sparc64/math-emu/math.c 2004-05-09 19:32:39.000000000 -0700 +++ linux-2.6.7-rc3/arch/sparc64/math-emu/math.c 2004-06-07 12:55:01.788571936 -0700 @@ -185,7 +185,7 @@ die_if_kernel("unfinished/unimplemented FPop from kernel", regs); if (test_thread_flag(TIF_32BIT)) pc = (u32)pc; - if (get_user(insn, (u32 *)pc) != -EFAULT) { + if (get_user(insn, (u32 __user *) pc) != -EFAULT) { if ((insn & 0xc1f80000) == 0x81a00000) /* FPOP1 */ { switch ((insn >> 5) & 0x1ff) { /* QUAD - ftt == 3 */ @@ -298,14 +298,14 @@ else if (freg < 16) XR = regs->u_regs[freg]; else if (test_thread_flag(TIF_32BIT)) { - struct reg_window32 *win32; + struct reg_window32 __user *win32; flushw_user (); - win32 = (struct reg_window32 *)((unsigned long)((u32)regs->u_regs[UREG_FP])); + win32 = (struct reg_window32 __user *)((unsigned long)((u32)regs->u_regs[UREG_FP])); get_user(XR, &win32->locals[freg - 16]); } else { - struct reg_window *win; + struct reg_window __user *win; flushw_user (); - win = (struct reg_window *)(regs->u_regs[UREG_FP] + STACK_BIAS); + win = (struct reg_window __user *)(regs->u_regs[UREG_FP] + STACK_BIAS); get_user(XR, &win->locals[freg - 16]); } IR = 0; diff -urN linux-2.6.7-rc2/arch/sparc64/math-emu/sfp-util.h linux-2.6.7-rc3/arch/sparc64/math-emu/sfp-util.h --- linux-2.6.7-rc2/arch/sparc64/math-emu/sfp-util.h 2004-05-09 19:33:19.000000000 -0700 +++ linux-2.6.7-rc3/arch/sparc64/math-emu/sfp-util.h 2004-06-07 12:55:01.788571936 -0700 @@ -11,106 +11,106 @@ #include #include -#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ - __asm__ ("addcc %4,%5,%1\n\ - add %2,%3,%0\n\ - bcs,a,pn %%xcc, 1f\n\ - add %0, 1, %0\n\ - 1:" \ - : "=r" ((UDItype)(sh)), \ - "=&r" ((UDItype)(sl)) \ - : "r" ((UDItype)(ah)), \ - "r" ((UDItype)(bh)), \ - "r" ((UDItype)(al)), \ - "r" ((UDItype)(bl)) \ +#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ + __asm__ ("addcc %4,%5,%1\n\t" \ + "add %2,%3,%0\n\t" \ + "bcs,a,pn %%xcc, 1f\n\t" \ + "add %0, 1, %0\n" \ + "1:" \ + : "=r" ((UDItype)(sh)), \ + "=&r" ((UDItype)(sl)) \ + : "r" ((UDItype)(ah)), \ + "r" ((UDItype)(bh)), \ + "r" ((UDItype)(al)), \ + "r" ((UDItype)(bl)) \ : "cc") -#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ - __asm__ ("subcc %4,%5,%1\n\ - sub %2,%3,%0\n\ - bcs,a,pn %%xcc, 1f\n\ - sub %0, 1, %0\n\ - 1:" \ - : "=r" ((UDItype)(sh)), \ - "=&r" ((UDItype)(sl)) \ - : "r" ((UDItype)(ah)), \ - "r" ((UDItype)(bh)), \ - "r" ((UDItype)(al)), \ - "r" ((UDItype)(bl)) \ +#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ + __asm__ ("subcc %4,%5,%1\n\t" \ + "sub %2,%3,%0\n\t" \ + "bcs,a,pn %%xcc, 1f\n\t" \ + "sub %0, 1, %0\n" \ + "1:" \ + : "=r" ((UDItype)(sh)), \ + "=&r" ((UDItype)(sl)) \ + : "r" ((UDItype)(ah)), \ + "r" ((UDItype)(bh)), \ + "r" ((UDItype)(al)), \ + "r" ((UDItype)(bl)) \ : "cc") -#define umul_ppmm(wh, wl, u, v) \ - do { \ - UDItype tmp1, tmp2, tmp3, tmp4; \ - __asm__ __volatile__ ( \ - "srl %7,0,%3\n\ - mulx %3,%6,%1\n\ - srlx %6,32,%2\n\ - mulx %2,%3,%4\n\ - sllx %4,32,%5\n\ - srl %6,0,%3\n\ - sub %1,%5,%5\n\ - srlx %5,32,%5\n\ - addcc %4,%5,%4\n\ - srlx %7,32,%5\n\ - mulx %3,%5,%3\n\ - mulx %2,%5,%5\n\ - sethi %%hi(0x80000000),%2\n\ - addcc %4,%3,%4\n\ - srlx %4,32,%4\n\ - add %2,%2,%2\n\ - movcc %%xcc,%%g0,%2\n\ - addcc %5,%4,%5\n\ - sllx %3,32,%3\n\ - add %1,%3,%1\n\ - add %5,%2,%0" \ - : "=r" ((UDItype)(wh)), \ - "=&r" ((UDItype)(wl)), \ - "=&r" (tmp1), "=&r" (tmp2), "=&r" (tmp3), "=&r" (tmp4) \ - : "r" ((UDItype)(u)), \ - "r" ((UDItype)(v)) \ - : "cc"); \ +#define umul_ppmm(wh, wl, u, v) \ + do { \ + UDItype tmp1, tmp2, tmp3, tmp4; \ + __asm__ __volatile__ ( \ + "srl %7,0,%3\n\t" \ + "mulx %3,%6,%1\n\t" \ + "srlx %6,32,%2\n\t" \ + "mulx %2,%3,%4\n\t" \ + "sllx %4,32,%5\n\t" \ + "srl %6,0,%3\n\t" \ + "sub %1,%5,%5\n\t" \ + "srlx %5,32,%5\n\t" \ + "addcc %4,%5,%4\n\t" \ + "srlx %7,32,%5\n\t" \ + "mulx %3,%5,%3\n\t" \ + "mulx %2,%5,%5\n\t" \ + "sethi %%hi(0x80000000),%2\n\t" \ + "addcc %4,%3,%4\n\t" \ + "srlx %4,32,%4\n\t" \ + "add %2,%2,%2\n\t" \ + "movcc %%xcc,%%g0,%2\n\t" \ + "addcc %5,%4,%5\n\t" \ + "sllx %3,32,%3\n\t" \ + "add %1,%3,%1\n\t" \ + "add %5,%2,%0" \ + : "=r" ((UDItype)(wh)), \ + "=&r" ((UDItype)(wl)), \ + "=&r" (tmp1), "=&r" (tmp2), "=&r" (tmp3), "=&r" (tmp4) \ + : "r" ((UDItype)(u)), \ + "r" ((UDItype)(v)) \ + : "cc"); \ } while (0) -#define udiv_qrnnd(q, r, n1, n0, d) \ - do { \ - UWtype __d1, __d0, __q1, __q0, __r1, __r0, __m; \ - __d1 = (d >> 32); \ - __d0 = (USItype)d; \ - \ - __r1 = (n1) % __d1; \ - __q1 = (n1) / __d1; \ - __m = (UWtype) __q1 * __d0; \ - __r1 = (__r1 << 32) | (n0 >> 32); \ - if (__r1 < __m) \ - { \ - __q1--, __r1 += (d); \ - if (__r1 >= (d)) /* i.e. we didn't get carry when adding to __r1 */ \ - if (__r1 < __m) \ - __q1--, __r1 += (d); \ - } \ - __r1 -= __m; \ - \ - __r0 = __r1 % __d1; \ - __q0 = __r1 / __d1; \ - __m = (UWtype) __q0 * __d0; \ - __r0 = (__r0 << 32) | ((USItype)n0); \ - if (__r0 < __m) \ - { \ - __q0--, __r0 += (d); \ - if (__r0 >= (d)) \ - if (__r0 < __m) \ - __q0--, __r0 += (d); \ - } \ - __r0 -= __m; \ - \ - (q) = (UWtype) (__q1 << 32) | __q0; \ - (r) = __r0; \ +#define udiv_qrnnd(q, r, n1, n0, d) \ + do { \ + UWtype __d1, __d0, __q1, __q0, __r1, __r0, __m; \ + __d1 = (d >> 32); \ + __d0 = (USItype)d; \ + \ + __r1 = (n1) % __d1; \ + __q1 = (n1) / __d1; \ + __m = (UWtype) __q1 * __d0; \ + __r1 = (__r1 << 32) | (n0 >> 32); \ + if (__r1 < __m) \ + { \ + __q1--, __r1 += (d); \ + if (__r1 >= (d)) /* i.e. we didn't get carry when adding to __r1 */ \ + if (__r1 < __m) \ + __q1--, __r1 += (d); \ + } \ + __r1 -= __m; \ + \ + __r0 = __r1 % __d1; \ + __q0 = __r1 / __d1; \ + __m = (UWtype) __q0 * __d0; \ + __r0 = (__r0 << 32) | ((USItype)n0); \ + if (__r0 < __m) \ + { \ + __q0--, __r0 += (d); \ + if (__r0 >= (d)) \ + if (__r0 < __m) \ + __q0--, __r0 += (d); \ + } \ + __r0 -= __m; \ + \ + (q) = (UWtype) (__q1 << 32) | __q0; \ + (r) = __r0; \ } while (0) #define UDIV_NEEDS_NORMALIZATION 1 -#define abort() \ +#define abort() \ return 0 #ifdef __BIG_ENDIAN diff -urN linux-2.6.7-rc2/arch/x86_64/defconfig linux-2.6.7-rc3/arch/x86_64/defconfig --- linux-2.6.7-rc2/arch/x86_64/defconfig 2004-06-07 12:54:48.768032673 -0700 +++ linux-2.6.7-rc3/arch/x86_64/defconfig 2004-06-07 12:55:01.795572226 -0700 @@ -34,6 +34,7 @@ CONFIG_IKCONFIG_PROC=y # CONFIG_EMBEDDED is not set CONFIG_KALLSYMS=y +CONFIG_KALLSYMS_ALL=y CONFIG_FUTEX=y CONFIG_EPOLL=y CONFIG_IOSCHED_NOOP=y @@ -234,6 +235,7 @@ # CONFIG_BLK_DEV_SLC90E66 is not set # CONFIG_BLK_DEV_TRM290 is not set # CONFIG_BLK_DEV_VIA82CXXX is not set +# CONFIG_IDE_ARM is not set CONFIG_BLK_DEV_IDEDMA=y # CONFIG_IDEDMA_IVB is not set CONFIG_IDEDMA_AUTO=y @@ -258,7 +260,6 @@ # Some SCSI devices (e.g. CD jukebox) support multiple LUNs # # CONFIG_SCSI_MULTI_LUN is not set -# CONFIG_SCSI_REPORT_LUNS is not set # CONFIG_SCSI_CONSTANTS is not set # CONFIG_SCSI_LOGGING is not set @@ -789,7 +790,6 @@ # Firmware Drivers # # CONFIG_EDD is not set -# CONFIG_SMBIOS is not set # # File systems diff -urN linux-2.6.7-rc2/arch/x86_64/ia32/fpu32.c linux-2.6.7-rc3/arch/x86_64/ia32/fpu32.c --- linux-2.6.7-rc2/arch/x86_64/ia32/fpu32.c 2004-05-09 19:31:58.000000000 -0700 +++ linux-2.6.7-rc3/arch/x86_64/ia32/fpu32.c 2004-06-07 12:55:01.796572267 -0700 @@ -72,15 +72,15 @@ static inline int convert_fxsr_from_user(struct i387_fxsave_struct *fxsave, - struct _fpstate_ia32 *buf) + struct _fpstate_ia32 __user *buf) { struct _fpxreg *to; - struct _fpreg *from; + struct _fpreg __user *from; int i; u32 v; int err = 0; -#define G(num,val) err |= __get_user(val, num + (u32 *)buf) +#define G(num,val) err |= __get_user(val, num + (u32 __user *)buf) G(0, fxsave->cwd); G(1, fxsave->swd); G(2, fxsave->twd); @@ -104,12 +104,12 @@ } -static inline int convert_fxsr_to_user(struct _fpstate_ia32 *buf, +static inline int convert_fxsr_to_user(struct _fpstate_ia32 __user *buf, struct i387_fxsave_struct *fxsave, struct pt_regs *regs, struct task_struct *tsk) { - struct _fpreg *to; + struct _fpreg __user *to; struct _fpxreg *from; int i; u16 cs,ds; @@ -125,7 +125,7 @@ cs = regs->cs; } -#define P(num,val) err |= __put_user(val, num + (u32 *)buf) +#define P(num,val) err |= __put_user(val, num + (u32 __user *)buf) P(0, (u32)fxsave->cwd | 0xffff0000); P(1, (u32)fxsave->swd | 0xffff0000); P(2, twd_fxsr_to_i387(fxsave)); @@ -147,7 +147,7 @@ return 0; } -int restore_i387_ia32(struct task_struct *tsk, struct _fpstate_ia32 *buf, int fsave) +int restore_i387_ia32(struct task_struct *tsk, struct _fpstate_ia32 __user *buf, int fsave) { clear_fpu(tsk); if (!fsave) { @@ -162,7 +162,7 @@ } int save_i387_ia32(struct task_struct *tsk, - struct _fpstate_ia32 *buf, + struct _fpstate_ia32 __user *buf, struct pt_regs *regs, int fsave) { diff -urN linux-2.6.7-rc2/arch/x86_64/ia32/ia32_ioctl.c linux-2.6.7-rc3/arch/x86_64/ia32/ia32_ioctl.c --- linux-2.6.7-rc2/arch/x86_64/ia32/ia32_ioctl.c 2004-05-09 19:32:37.000000000 -0700 +++ linux-2.6.7-rc3/arch/x86_64/ia32/ia32_ioctl.c 2004-06-07 12:55:01.796572267 -0700 @@ -21,7 +21,7 @@ #ifndef TIOCGDEV #define TIOCGDEV _IOR('T',0x32, unsigned int) #endif -static int tiocgdev(unsigned fd, unsigned cmd, unsigned int *ptr) +static int tiocgdev(unsigned fd, unsigned cmd, unsigned int __user *ptr) { struct file *file = fget(fd); @@ -54,7 +54,7 @@ ret = sys_ioctl(fd, RTC_IRQP_READ, (unsigned long)&val); set_fs(oldfs); if (!ret) - ret = put_user(val, (unsigned int*) arg); + ret = put_user(val, (unsigned int __user *) arg); return ret; case RTC_IRQP_SET32: @@ -66,7 +66,7 @@ ret = sys_ioctl(fd, RTC_EPOCH_READ, (unsigned long) &val); set_fs(oldfs); if (!ret) - ret = put_user(val, (unsigned int*) arg); + ret = put_user(val, (unsigned int __user *) arg); return ret; case RTC_EPOCH_SET32: @@ -113,7 +113,7 @@ struct mtrr_gentry g; struct mtrr_sentry s; int get = 0, err = 0; - struct mtrr_gentry32 *g32 = (struct mtrr_gentry32 *)arg; + struct mtrr_gentry32 __user *g32 = (struct mtrr_gentry32 __user *)arg; mm_segment_t oldfs = get_fs(); switch (cmd) { @@ -139,7 +139,7 @@ arg = (unsigned long)&g; } else { - struct mtrr_sentry32 *s32 = (struct mtrr_sentry32 *)arg; + struct mtrr_sentry32 __user *s32 = (struct mtrr_sentry32 __user *)arg; err = get_user(s.base, &s32->base); err |= get_user(s.size, &s32->size); err |= get_user(s.type, &s32->type); diff -urN linux-2.6.7-rc2/arch/x86_64/ia32/ia32_signal.c linux-2.6.7-rc3/arch/x86_64/ia32/ia32_signal.c --- linux-2.6.7-rc2/arch/x86_64/ia32/ia32_signal.c 2004-06-07 12:54:48.769032714 -0700 +++ linux-2.6.7-rc3/arch/x86_64/ia32/ia32_signal.c 2004-06-07 12:55:01.797572309 -0700 @@ -42,7 +42,7 @@ #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) asmlinkage int do_signal(struct pt_regs *regs, sigset_t *oldset); -void signal_fault(struct pt_regs *regs, void *frame, char *where); +void signal_fault(struct pt_regs *regs, void __user *frame, char *where); int ia32_copy_siginfo_to_user(siginfo_t32 __user *to, siginfo_t *from) { @@ -136,8 +136,9 @@ } asmlinkage long -sys32_sigaltstack(const stack_ia32_t *uss_ptr, stack_ia32_t *uoss_ptr, - struct pt_regs regs) +sys32_sigaltstack(const stack_ia32_t __user *uss_ptr, + stack_ia32_t __user *uoss_ptr, + struct pt_regs regs) { stack_t uss,uoss; int ret; @@ -193,7 +194,7 @@ }; static int -ia32_restore_sigcontext(struct pt_regs *regs, struct sigcontext_ia32 *sc, unsigned int *peax) +ia32_restore_sigcontext(struct pt_regs *regs, struct sigcontext_ia32 __user *sc, unsigned int *peax) { unsigned int err = 0; @@ -252,9 +253,9 @@ { u32 tmp; - struct _fpstate_ia32 * buf; + struct _fpstate_ia32 __user * buf; err |= __get_user(tmp, &sc->fpstate); - buf = (struct _fpstate_ia32 *) (u64)tmp; + buf = compat_ptr(tmp); if (buf) { if (verify_area(VERIFY_READ, buf, sizeof(*buf))) goto badframe; @@ -275,7 +276,7 @@ asmlinkage long sys32_sigreturn(struct pt_regs regs) { - struct sigframe *frame = (struct sigframe *)(regs.rsp - 8); + struct sigframe __user *frame = (struct sigframe __user *)(regs.rsp-8); sigset_t set; unsigned int eax; @@ -304,9 +305,8 @@ asmlinkage long sys32_rt_sigreturn(struct pt_regs regs) { - struct rt_sigframe *frame = (struct rt_sigframe *)(regs.rsp - 4); + struct rt_sigframe __user *frame = (struct rt_sigframe __user *)(regs.rsp - 4); sigset_t set; - stack_t st; unsigned int eax; if (verify_area(VERIFY_READ, frame, sizeof(*frame))) @@ -338,20 +338,20 @@ */ static int -ia32_setup_sigcontext(struct sigcontext_ia32 *sc, struct _fpstate_ia32 *fpstate, +ia32_setup_sigcontext(struct sigcontext_ia32 __user *sc, struct _fpstate_ia32 __user *fpstate, struct pt_regs *regs, unsigned int mask) { int tmp, err = 0; tmp = 0; __asm__("movl %%gs,%0" : "=r"(tmp): "0"(tmp)); - err |= __put_user(tmp, (unsigned int *)&sc->gs); + err |= __put_user(tmp, (unsigned int __user *)&sc->gs); __asm__("movl %%fs,%0" : "=r"(tmp): "0"(tmp)); - err |= __put_user(tmp, (unsigned int *)&sc->fs); + err |= __put_user(tmp, (unsigned int __user *)&sc->fs); __asm__("movl %%ds,%0" : "=r"(tmp): "0"(tmp)); - err |= __put_user(tmp, (unsigned int *)&sc->ds); + err |= __put_user(tmp, (unsigned int __user *)&sc->ds); __asm__("movl %%es,%0" : "=r"(tmp): "0"(tmp)); - err |= __put_user(tmp, (unsigned int *)&sc->es); + err |= __put_user(tmp, (unsigned int __user *)&sc->es); err |= __put_user((u32)regs->rdi, &sc->edi); err |= __put_user((u32)regs->rsi, &sc->esi); @@ -388,7 +388,7 @@ /* * Determine which stack to use.. */ -static void * +static void __user * get_sigframe(struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size) { unsigned long rsp; @@ -409,13 +409,13 @@ rsp = (unsigned long) ka->sa.sa_restorer; } - return (void *)((rsp - frame_size) & -8UL); + return (void __user *)((rsp - frame_size) & -8UL); } void ia32_setup_frame(int sig, struct k_sigaction *ka, compat_sigset_t *set, struct pt_regs * regs) { - struct sigframe *frame; + struct sigframe __user *frame; int err = 0; frame = get_sigframe(ka, regs, sizeof(*frame)); @@ -502,7 +502,7 @@ void ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, compat_sigset_t *set, struct pt_regs * regs) { - struct rt_sigframe *frame; + struct rt_sigframe __user *frame; int err = 0; frame = get_sigframe(ka, regs, sizeof(*frame)); diff -urN linux-2.6.7-rc2/arch/x86_64/ia32/ia32entry.S linux-2.6.7-rc3/arch/x86_64/ia32/ia32entry.S --- linux-2.6.7-rc2/arch/x86_64/ia32/ia32entry.S 2004-06-07 12:54:48.769032714 -0700 +++ linux-2.6.7-rc3/arch/x86_64/ia32/ia32entry.S 2004-06-07 12:55:01.798572350 -0700 @@ -322,7 +322,7 @@ .quad sys_mknod .quad sys_chmod /* 15 */ .quad sys_lchown16 - .quad ni_syscall /* old break syscall holder */ + .quad quiet_ni_syscall /* old break syscall holder */ .quad sys_stat .quad sys32_lseek .quad sys_getpid /* 20 */ @@ -336,11 +336,11 @@ .quad sys_fstat /* (old)fstat */ .quad sys_pause .quad compat_sys_utime /* 30 */ - .quad ni_syscall /* old stty syscall holder */ - .quad ni_syscall /* old gtty syscall holder */ + .quad quiet_ni_syscall /* old stty syscall holder */ + .quad quiet_ni_syscall /* old gtty syscall holder */ .quad sys_access .quad sys_nice - .quad ni_syscall /* 35 */ /* old ftime syscall holder */ + .quad quiet_ni_syscall /* 35 */ /* old ftime syscall holder */ .quad sys_sync .quad sys32_kill .quad sys_rename @@ -349,7 +349,7 @@ .quad sys_dup .quad sys32_pipe .quad compat_sys_times - .quad ni_syscall /* old prof syscall holder */ + .quad quiet_ni_syscall /* old prof syscall holder */ .quad sys_brk /* 45 */ .quad sys_setgid16 .quad sys_getgid16 @@ -358,12 +358,12 @@ .quad sys_getegid16 /* 50 */ .quad sys_acct .quad sys_umount /* new_umount */ - .quad ni_syscall /* old lock syscall holder */ + .quad quiet_ni_syscall /* old lock syscall holder */ .quad compat_sys_ioctl .quad compat_sys_fcntl64 /* 55 */ - .quad ni_syscall /* old mpx syscall holder */ + .quad quiet_ni_syscall /* old mpx syscall holder */ .quad sys_setpgid - .quad ni_syscall /* old ulimit syscall holder */ + .quad quiet_ni_syscall /* old ulimit syscall holder */ .quad sys32_olduname .quad sys_umask /* 60 */ .quad sys_chroot @@ -403,7 +403,7 @@ .quad sys_fchown16 /* 95 */ .quad sys_getpriority .quad sys_setpriority - .quad ni_syscall /* old profil syscall holder */ + .quad quiet_ni_syscall /* old profil syscall holder */ .quad compat_sys_statfs .quad compat_sys_fstatfs /* 100 */ .quad sys_ioperm @@ -417,7 +417,7 @@ .quad sys32_uname .quad stub32_iopl /* 110 */ .quad sys_vhangup - .quad ni_syscall /* old "idle" system call */ + .quad quiet_ni_syscall /* old "idle" system call */ .quad sys32_vm86_warning /* vm86old */ .quad compat_sys_wait4 .quad sys_swapoff /* 115 */ @@ -442,7 +442,7 @@ .quad quiet_ni_syscall /* bdflush */ .quad sys_sysfs /* 135 */ .quad sys_personality - .quad ni_syscall /* for afs_syscall */ + .quad quiet_ni_syscall /* for afs_syscall */ .quad sys_setfsuid16 .quad sys_setfsgid16 .quad sys_llseek /* 140 */ @@ -493,8 +493,8 @@ .quad sys_capset .quad stub32_sigaltstack .quad sys32_sendfile - .quad ni_syscall /* streams1 */ - .quad ni_syscall /* streams2 */ + .quad quiet_ni_syscall /* streams1 */ + .quad quiet_ni_syscall /* streams2 */ .quad stub32_vfork /* 190 */ .quad compat_sys_getrlimit .quad sys32_mmap2 @@ -543,51 +543,52 @@ .quad sys_removexattr /* 235 */ .quad sys_lremovexattr .quad sys_fremovexattr - .quad sys_tkill /* 238 */ + .quad sys_tkill .quad sys_sendfile64 .quad compat_sys_futex /* 240 */ - .quad compat_sys_sched_setaffinity - .quad compat_sys_sched_getaffinity + .quad compat_sys_sched_setaffinity + .quad compat_sys_sched_getaffinity .quad sys32_set_thread_area .quad sys32_get_thread_area - .quad sys32_io_setup + .quad sys32_io_setup /* 245 */ .quad sys_io_destroy .quad sys32_io_getevents .quad sys32_io_submit .quad sys_io_cancel - .quad sys_fadvise64 - .quad quiet_ni_syscall /* free_huge_pages */ - .quad sys_exit_group /* exit_group */ + .quad sys_fadvise64 /* 250 */ + .quad quiet_ni_syscall /* free_huge_pages */ + .quad sys_exit_group .quad sys_lookup_dcookie .quad sys_epoll_create - .quad sys_epoll_ctl + .quad sys_epoll_ctl /* 255 */ .quad sys_epoll_wait .quad sys_remap_file_pages .quad sys_set_tid_address .quad sys32_timer_create - .quad compat_timer_settime + .quad compat_timer_settime /* 260 */ .quad compat_timer_gettime .quad sys_timer_getoverrun .quad sys_timer_delete .quad compat_clock_settime - .quad compat_clock_gettime + .quad compat_clock_gettime /* 265 */ .quad compat_clock_getres .quad compat_clock_nanosleep - .quad compat_statfs64 /* statfs64 */ - .quad compat_fstatfs64 /* fstatfs64 */ - .quad sys_tgkill + .quad compat_statfs64 + .quad compat_fstatfs64 + .quad sys_tgkill /* 270 */ .quad compat_sys_utimes .quad sys32_fadvise64_64 - .quad sys_ni_syscall /* sys_vserver */ - .quad sys_ni_syscall /* sys_mbind */ - .quad sys_ni_syscall /* 275 sys_get_mempolicy */ - .quad sys_ni_syscall /* sys_set_mempolicy */ + .quad quiet_ni_syscall /* sys_vserver */ + .quad sys_mbind + .quad compat_get_mempolicy /* 275 */ + .quad sys_set_mempolicy .quad compat_sys_mq_open .quad sys_mq_unlink .quad compat_sys_mq_timedsend .quad compat_sys_mq_timedreceive /* 280 */ .quad compat_sys_mq_notify .quad compat_sys_mq_getsetattr + .quad quiet_ni_syscall /* reserved for kexec */ /* don't forget to change IA32_NR_syscalls */ ia32_syscall_end: .rept IA32_NR_syscalls-(ia32_syscall_end-ia32_sys_call_table)/8 diff -urN linux-2.6.7-rc2/arch/x86_64/ia32/ptrace32.c linux-2.6.7-rc3/arch/x86_64/ia32/ptrace32.c --- linux-2.6.7-rc2/arch/x86_64/ia32/ptrace32.c 2004-06-07 12:54:48.770032756 -0700 +++ linux-2.6.7-rc3/arch/x86_64/ia32/ptrace32.c 2004-06-07 12:55:01.799572392 -0700 @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -228,6 +229,7 @@ { struct task_struct *child; struct pt_regs *childregs; + void __user *datap = compat_ptr(data); int ret; __u32 val; @@ -264,7 +266,7 @@ if (access_process_vm(child, addr, &val, sizeof(u32), 0)!=sizeof(u32)) ret = -EIO; else - ret = put_user(val, (unsigned int *)(u64)data); + ret = put_user(val, (unsigned int __user *)datap); break; case PTRACE_POKEDATA: @@ -277,7 +279,7 @@ case PTRACE_PEEKUSR: ret = getreg32(child, addr, &val); if (ret == 0) - ret = put_user(val, (__u32 *)(unsigned long) data); + ret = put_user(val, (__u32 __user *)datap); break; case PTRACE_POKEUSR: @@ -286,15 +288,15 @@ case PTRACE_GETREGS: { /* Get all gp regs from the child. */ int i; - if (!access_ok(VERIFY_WRITE, (unsigned *)(unsigned long)data, 16*4)) { + if (!access_ok(VERIFY_WRITE, datap, 16*4)) { ret = -EIO; break; } ret = 0; for ( i = 0; i <= 16*4 ; i += sizeof(__u32) ) { getreg32(child, i, &val); - ret |= __put_user(val,(u32 *) (unsigned long) data); - data += sizeof(u32); + ret |= __put_user(val,(u32 __user *)datap); + datap += sizeof(u32); } break; } @@ -302,40 +304,40 @@ case PTRACE_SETREGS: { /* Set all gp regs in the child. */ unsigned long tmp; int i; - if (!access_ok(VERIFY_READ, (unsigned *)(unsigned long)data, 16*4)) { + if (!access_ok(VERIFY_READ, datap, 16*4)) { ret = -EIO; break; } ret = 0; for ( i = 0; i <= 16*4; i += sizeof(u32) ) { - ret |= __get_user(tmp, (u32 *) (unsigned long) data); + ret |= __get_user(tmp, (u32 __user *)datap); putreg32(child, i, tmp); - data += sizeof(u32); + datap += sizeof(u32); } break; } case PTRACE_GETFPREGS: ret = -EIO; - if (!access_ok(VERIFY_READ, (void *)(u64)data, + if (!access_ok(VERIFY_READ, compat_ptr(data), sizeof(struct user_i387_struct))) break; - save_i387_ia32(child, (void *)(u64)data, childregs, 1); + save_i387_ia32(child, datap, childregs, 1); ret = 0; break; case PTRACE_SETFPREGS: ret = -EIO; - if (!access_ok(VERIFY_WRITE, (void *)(u64)data, + if (!access_ok(VERIFY_WRITE, datap, sizeof(struct user_i387_struct))) break; ret = 0; /* don't check EFAULT to be bug-to-bug compatible to i386 */ - restore_i387_ia32(child, (void *)(u64)data, 1); + restore_i387_ia32(child, datap, 1); break; case PTRACE_GETFPXREGS: { - struct user32_fxsr_struct *u = (void *)(u64)data; + struct user32_fxsr_struct __user *u = datap; init_fpu(child); ret = -EIO; if (!access_ok(VERIFY_WRITE, u, sizeof(*u))) @@ -348,7 +350,7 @@ break; } case PTRACE_SETFPXREGS: { - struct user32_fxsr_struct *u = (void *)(u64)data; + struct user32_fxsr_struct __user *u = datap; unlazy_fpu(child); ret = -EIO; if (!access_ok(VERIFY_READ, u, sizeof(*u))) diff -urN linux-2.6.7-rc2/arch/x86_64/ia32/sys_ia32.c linux-2.6.7-rc3/arch/x86_64/ia32/sys_ia32.c --- linux-2.6.7-rc2/arch/x86_64/ia32/sys_ia32.c 2004-06-07 12:54:48.771032797 -0700 +++ linux-2.6.7-rc3/arch/x86_64/ia32/sys_ia32.c 2004-06-07 12:55:01.801572474 -0700 @@ -76,9 +76,9 @@ #define A(__x) ((unsigned long)(__x)) #define AA(__x) ((unsigned long)(__x)) #define ROUND_UP(x,a) ((__typeof__(x))(((unsigned long)(x) + ((a) - 1)) & ~((a) - 1))) -#define NAME_OFFSET(de) ((int) ((de)->d_name - (char *) (de))) +#define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de))) -int cp_compat_stat(struct kstat *kbuf, struct compat_stat *ubuf) +int cp_compat_stat(struct kstat *kbuf, struct compat_stat __user *ubuf) { typeof(ubuf->st_uid) uid = 0; typeof(ubuf->st_gid) gid = 0; @@ -110,7 +110,7 @@ } asmlinkage long -sys32_truncate64(char * filename, unsigned long offset_low, unsigned long offset_high) +sys32_truncate64(char __user * filename, unsigned long offset_low, unsigned long offset_high) { return sys_truncate(filename, ((loff_t) offset_high << 32) | offset_low); } @@ -125,7 +125,7 @@ support for 64bit inode numbers. */ static int -cp_stat64(struct stat64 *ubuf, struct kstat *stat) +cp_stat64(struct stat64 __user *ubuf, struct kstat *stat) { typeof(ubuf->st_uid) uid = 0; typeof(ubuf->st_gid) gid = 0; @@ -154,7 +154,7 @@ } asmlinkage long -sys32_stat64(char * filename, struct stat64 *statbuf) +sys32_stat64(char __user * filename, struct stat64 __user *statbuf) { struct kstat stat; int ret = vfs_stat(filename, &stat); @@ -164,7 +164,7 @@ } asmlinkage long -sys32_lstat64(char * filename, struct stat64 *statbuf) +sys32_lstat64(char __user * filename, struct stat64 __user *statbuf) { struct kstat stat; int ret = vfs_lstat(filename, &stat); @@ -174,7 +174,7 @@ } asmlinkage long -sys32_fstat64(unsigned int fd, struct stat64 *statbuf) +sys32_fstat64(unsigned int fd, struct stat64 __user *statbuf) { struct kstat stat; int ret = vfs_fstat(fd, &stat); @@ -199,7 +199,7 @@ }; asmlinkage long -sys32_mmap(struct mmap_arg_struct *arg) +sys32_mmap(struct mmap_arg_struct __user *arg) { struct mmap_arg_struct a; struct file *file = NULL; @@ -241,7 +241,7 @@ } asmlinkage long -sys32_pipe(int *fd) +sys32_pipe(int __user *fd) { int retval; int fds[2]; @@ -256,8 +256,8 @@ } asmlinkage long -sys32_rt_sigaction(int sig, struct sigaction32 *act, - struct sigaction32 *oact, unsigned int sigsetsize) +sys32_rt_sigaction(int sig, struct sigaction32 __user *act, + struct sigaction32 __user *oact, unsigned int sigsetsize) { struct k_sigaction new_ka, old_ka; int ret; @@ -321,7 +321,7 @@ } asmlinkage long -sys32_sigaction (int sig, struct old_sigaction32 *act, struct old_sigaction32 *oact) +sys32_sigaction (int sig, struct old_sigaction32 __user *act, struct old_sigaction32 __user *oact) { struct k_sigaction new_ka, old_ka; int ret; @@ -395,7 +395,7 @@ } static inline long -get_tv32(struct timeval *o, struct compat_timeval *i) +get_tv32(struct timeval *o, struct compat_timeval __user *i) { int err = -EFAULT; if (access_ok(VERIFY_READ, i, sizeof(*i))) { @@ -406,7 +406,7 @@ } static inline long -put_tv32(struct compat_timeval *o, struct timeval *i) +put_tv32(struct compat_timeval __user *o, struct timeval *i) { int err = -EFAULT; if (access_ok(VERIFY_WRITE, o, sizeof(*o))) { @@ -442,7 +442,7 @@ extern struct timezone sys_tz; asmlinkage long -sys32_gettimeofday(struct compat_timeval *tv, struct timezone *tz) +sys32_gettimeofday(struct compat_timeval __user *tv, struct timezone __user *tz) { if (tv) { struct timeval ktv; @@ -458,7 +458,7 @@ } asmlinkage long -sys32_settimeofday(struct compat_timeval *tv, struct timezone *tz) +sys32_settimeofday(struct compat_timeval __user *tv, struct timezone __user *tz) { struct timeval ktv; struct timespec kts; @@ -493,14 +493,14 @@ }; struct getdents32_callback { - struct linux32_dirent * current_dir; - struct linux32_dirent * previous; + struct linux32_dirent __user * current_dir; + struct linux32_dirent __user * previous; int count; int error; }; struct readdir32_callback { - struct old_linux32_dirent * dirent; + struct old_linux32_dirent __user * dirent; int count; }; @@ -508,7 +508,7 @@ filldir32 (void *__buf, const char *name, int namlen, loff_t offset, ino_t ino, unsigned int d_type) { - struct linux32_dirent * dirent; + struct linux32_dirent __user * dirent; struct getdents32_callback * buf = (struct getdents32_callback *) __buf; int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 2, 4); @@ -524,18 +524,18 @@ put_user(reclen, &dirent->d_reclen); copy_to_user(dirent->d_name, name, namlen); put_user(0, dirent->d_name + namlen); - put_user(d_type, (char *)dirent + reclen - 1); - dirent = ((void *)dirent) + reclen; + put_user(d_type, (char __user *)dirent + reclen - 1); + dirent = ((void __user *)dirent) + reclen; buf->current_dir = dirent; buf->count -= reclen; return 0; } asmlinkage long -sys32_getdents (unsigned int fd, void * dirent, unsigned int count) +sys32_getdents (unsigned int fd, void __user * dirent, unsigned int count) { struct file * file; - struct linux32_dirent * lastdirent; + struct linux32_dirent __user * lastdirent; struct getdents32_callback buf; int error; @@ -544,7 +544,7 @@ if (!file) goto out; - buf.current_dir = (struct linux32_dirent *) dirent; + buf.current_dir = (struct linux32_dirent __user *) dirent; buf.previous = NULL; buf.count = count; buf.error = 0; @@ -569,7 +569,7 @@ fillonedir32 (void * __buf, const char * name, int namlen, loff_t offset, ino_t ino, unsigned d_type) { struct readdir32_callback * buf = (struct readdir32_callback *) __buf; - struct old_linux32_dirent * dirent; + struct old_linux32_dirent __user * dirent; if (buf->count) return -EINVAL; @@ -584,7 +584,7 @@ } asmlinkage long -sys32_oldreaddir (unsigned int fd, void * dirent, unsigned int count) +sys32_oldreaddir (unsigned int fd, void __user * dirent, unsigned int count) { int error; struct file * file; @@ -615,7 +615,7 @@ }; asmlinkage long -sys32_old_select(struct sel_arg_struct *arg) +sys32_old_select(struct sel_arg_struct __user *arg) { struct sel_arg_struct a; @@ -630,7 +630,7 @@ * sys_gettimeofday(). x86-64 did this but i386 Linux did not * so we have to implement this system call here. */ -asmlinkage long sys32_time(int * tloc) +asmlinkage long sys32_time(int __user * tloc) { int i; struct timeval tv; @@ -693,7 +693,7 @@ }; asmlinkage long -sys32_sysinfo(struct sysinfo32 *info) +sys32_sysinfo(struct sysinfo32 __user *info) { struct sysinfo s; int ret; @@ -742,7 +742,7 @@ } asmlinkage long -sys32_sched_rr_get_interval(compat_pid_t pid, struct compat_timespec *interval) +sys32_sched_rr_get_interval(compat_pid_t pid, struct compat_timespec __user *interval) { struct timespec t; int ret; @@ -782,8 +782,8 @@ asmlinkage long -sys32_rt_sigtimedwait(compat_sigset_t *uthese, siginfo_t32 *uinfo, - struct compat_timespec *uts, compat_size_t sigsetsize) +sys32_rt_sigtimedwait(compat_sigset_t __user *uthese, siginfo_t32 __user *uinfo, + struct compat_timespec __user *uts, compat_size_t sigsetsize) { sigset_t s; compat_sigset_t s32; @@ -820,7 +820,7 @@ } asmlinkage long -sys32_rt_sigqueueinfo(int pid, int sig, siginfo_t32 *uinfo) +sys32_rt_sigqueueinfo(int pid, int sig, siginfo_t32 __user *uinfo) { siginfo_t info; int ret; @@ -856,7 +856,7 @@ asmlinkage long -sys32_sysctl(struct sysctl_ia32 *args32) +sys32_sysctl(struct sysctl_ia32 __user *args32) { #ifndef CONFIG_SYSCTL return -ENOSYS; @@ -906,14 +906,14 @@ /* warning: next two assume little endian */ asmlinkage long -sys32_pread(unsigned int fd, char *ubuf, u32 count, u32 poslo, u32 poshi) +sys32_pread(unsigned int fd, char __user *ubuf, u32 count, u32 poslo, u32 poshi) { return sys_pread64(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo)); } asmlinkage long -sys32_pwrite(unsigned int fd, char *ubuf, u32 count, u32 poslo, u32 poshi) +sys32_pwrite(unsigned int fd, char __user *ubuf, u32 count, u32 poslo, u32 poshi) { return sys_pwrite64(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo)); @@ -934,7 +934,7 @@ } asmlinkage long -sys32_sendfile(int out_fd, int in_fd, compat_off_t *offset, s32 count) +sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset, s32 count) { mm_segment_t old_fs = get_fs(); int ret; @@ -971,7 +971,7 @@ extern int do_adjtimex(struct timex *); asmlinkage long -sys32_adjtimex(struct timex32 *utp) +sys32_adjtimex(struct timex32 __user *utp) { struct timex txc; int ret; @@ -1056,7 +1056,7 @@ return error; } -asmlinkage long sys32_olduname(struct oldold_utsname * name) +asmlinkage long sys32_olduname(struct oldold_utsname __user * name) { int error; @@ -1090,7 +1090,7 @@ return error; } -long sys32_uname(struct old_utsname * name) +long sys32_uname(struct old_utsname __user * name) { int err; if (!name) @@ -1124,7 +1124,7 @@ return ret; } -asmlinkage long sys32_execve(char *name, compat_uptr_t __user *argv, +asmlinkage long sys32_execve(char __user *name, compat_uptr_t __user *argv, compat_uptr_t __user *envp, struct pt_regs regs) { long error; @@ -1143,8 +1143,8 @@ asmlinkage long sys32_clone(unsigned int clone_flags, unsigned int newsp, struct pt_regs regs) { - void *parent_tid = (void *)regs.rdx; - void *child_tid = (void *)regs.rdi; + void __user *parent_tid = (void __user *)regs.rdx; + void __user *child_tid = (void __user *)regs.rdi; if (!newsp) newsp = regs.rsp; return do_fork(clone_flags & ~CLONE_IDLETASK, newsp, ®s, 0, @@ -1166,7 +1166,7 @@ } -long sys32_io_setup(unsigned nr_reqs, u32 *ctx32p) +long sys32_io_setup(unsigned nr_reqs, u32 __user *ctx32p) { long ret; aio_context_t ctx64; @@ -1181,7 +1181,7 @@ } asmlinkage long sys32_io_submit(aio_context_t ctx_id, int nr, - compat_uptr_t *iocbpp) + compat_uptr_t __user *iocbpp) { struct kioctx *ctx; long ret = 0; @@ -1201,7 +1201,8 @@ for (i=0; i 32bit use arch_prctl() */ -int do_set_thread_area(struct thread_struct *t, struct user_desc *u_info) +int do_set_thread_area(struct thread_struct *t, struct user_desc __user *u_info) { struct user_desc info; struct n_desc_struct *desc; @@ -75,7 +75,7 @@ return 0; } -asmlinkage long sys32_set_thread_area(struct user_desc *u_info) +asmlinkage long sys32_set_thread_area(struct user_desc __user *u_info) { return do_set_thread_area(¤t->thread, u_info); } @@ -102,7 +102,7 @@ #define GET_USEABLE(desc) (((desc)->b >> 20) & 1) #define GET_LONGMODE(desc) (((desc)->b >> 21) & 1) -int do_get_thread_area(struct thread_struct *t, struct user_desc *u_info) +int do_get_thread_area(struct thread_struct *t, struct user_desc __user *u_info) { struct user_desc info; struct n_desc_struct *desc; @@ -132,7 +132,7 @@ return 0; } -asmlinkage long sys32_get_thread_area(struct user_desc *u_info) +asmlinkage long sys32_get_thread_area(struct user_desc __user *u_info) { return do_get_thread_area(¤t->thread, u_info); } @@ -141,10 +141,11 @@ int ia32_child_tls(struct task_struct *p, struct pt_regs *childregs) { struct n_desc_struct *desc; - struct user_desc info, *cp; + struct user_desc info; + struct user_desc __user *cp; int idx; - cp = (void *)childregs->rsi; + cp = (void __user *)childregs->rsi; if (copy_from_user(&info, cp, sizeof(info))) return -EFAULT; if (LDT_empty(&info)) diff -urN linux-2.6.7-rc2/arch/x86_64/kernel/Makefile-HEAD linux-2.6.7-rc3/arch/x86_64/kernel/Makefile-HEAD --- linux-2.6.7-rc2/arch/x86_64/kernel/Makefile-HEAD 1969-12-31 16:00:00.000000000 -0800 +++ linux-2.6.7-rc3/arch/x86_64/kernel/Makefile-HEAD 2004-06-07 12:55:01.803572557 -0700 @@ -0,0 +1,38 @@ +# +# Makefile for the linux kernel. +# + +extra-y := head.o head64.o init_task.o vmlinux.lds.s +EXTRA_AFLAGS := -traditional +obj-y := process.o semaphore.o signal.o entry.o traps.o irq.o \ + ptrace.o i8259.o ioport.o ldt.o setup.o time.o sys_x86_64.o \ + x8664_ksyms.o i387.o syscall.o vsyscall.o \ + setup64.o bootflag.o e820.o reboot.o warmreboot.o +obj-y += mce.o + +obj-$(CONFIG_MTRR) += ../../i386/kernel/cpu/mtrr/ +obj-$(CONFIG_ACPI_BOOT) += acpi/ +obj-$(CONFIG_X86_MSR) += msr.o +obj-$(CONFIG_MICROCODE) += microcode.o +obj-$(CONFIG_X86_CPUID) += cpuid.o +obj-$(CONFIG_SMP) += smp.o smpboot.o trampoline.o +obj-$(CONFIG_X86_LOCAL_APIC) += apic.o nmi.o +obj-$(CONFIG_X86_IO_APIC) += io_apic.o mpparse.o +obj-$(CONFIG_PM) += suspend.o +obj-$(CONFIG_SOFTWARE_SUSPEND) += suspend_asm.o +obj-$(CONFIG_CPU_FREQ) += cpufreq/ +obj-$(CONFIG_EARLY_PRINTK) += early_printk.o +obj-$(CONFIG_GART_IOMMU) += pci-gart.o aperture.o +obj-$(CONFIG_DUMMY_IOMMU) += pci-nommu.o pci-dma.o +obj-$(CONFIG_SWIOTLB) += swiotlb.o +obj-$(CONFIG_SCHED_SMT) += domain.o + +obj-$(CONFIG_MODULES) += module.o + +obj-y += topology.o + +bootflag-y += ../../i386/kernel/bootflag.o +cpuid-$(subst m,y,$(CONFIG_X86_CPUID)) += ../../i386/kernel/cpuid.o +topology-y += ../../i386/mach-default/topology.o +swiotlb-$(CONFIG_SWIOTLB) += ../../ia64/lib/swiotlb.o +microcode-$(subst m,y,$(CONFIG_MICROCODE)) += ../../i386/kernel/microcode.o diff -urN linux-2.6.7-rc2/arch/x86_64/kernel/acpi/sleep.c linux-2.6.7-rc3/arch/x86_64/kernel/acpi/sleep.c --- linux-2.6.7-rc2/arch/x86_64/kernel/acpi/sleep.c 2004-05-09 19:32:00.000000000 -0700 +++ linux-2.6.7-rc3/arch/x86_64/kernel/acpi/sleep.c 2004-06-07 12:55:01.803572557 -0700 @@ -114,7 +114,6 @@ acpi_wakeup_address = (unsigned long)alloc_bootmem_low(PAGE_SIZE); if ((&wakeup_end - &wakeup_start) > PAGE_SIZE) printk(KERN_CRIT "ACPI: Wakeup code way too big, will crash on attempt to suspend\n"); - printk(KERN_DEBUG "ACPI: have wakeup address 0x%8.8lx\n", acpi_wakeup_address); } static int __init acpi_sleep_setup(char *str) diff -urN linux-2.6.7-rc2/arch/x86_64/kernel/head64.c linux-2.6.7-rc3/arch/x86_64/kernel/head64.c --- linux-2.6.7-rc2/arch/x86_64/kernel/head64.c 2004-05-09 19:32:28.000000000 -0700 +++ linux-2.6.7-rc3/arch/x86_64/kernel/head64.c 2004-06-07 12:55:01.804572599 -0700 @@ -73,6 +73,8 @@ boot_cpu_data.x86_mask = eax & 0xf; } +extern char _end[]; + void __init x86_64_start_kernel(char * real_mode_data) { char *s; @@ -80,6 +82,9 @@ clear_bss(); pda_init(0); copy_bootdata(real_mode_data); +#ifdef CONFIG_SMP + cpu_set(0, cpu_online_map); +#endif /* default console: */ if (!strstr(saved_command_line, "console=")) strcat(saved_command_line, " console=tty0"); @@ -95,6 +100,10 @@ if (strstr(saved_command_line, "disableapic")) disable_apic = 1; #endif + /* You need early console to see that */ + if (__pa_symbol(&_end) >= KERNEL_TEXT_SIZE) + panic("Kernel too big for kernel mapping\n"); + setup_boot_cpu_data(); start_kernel(); } diff -urN linux-2.6.7-rc2/arch/x86_64/kernel/i387.c linux-2.6.7-rc3/arch/x86_64/kernel/i387.c --- linux-2.6.7-rc2/arch/x86_64/kernel/i387.c 2004-05-09 19:32:26.000000000 -0700 +++ linux-2.6.7-rc3/arch/x86_64/kernel/i387.c 2004-06-07 12:55:01.804572599 -0700 @@ -77,7 +77,7 @@ * Signal frame handlers. */ -int save_i387(struct _fpstate *buf) +int save_i387(struct _fpstate __user *buf) { struct task_struct *tsk = current; int err = 0; @@ -95,7 +95,7 @@ return 0; tsk->used_math = 0; /* trigger finit */ if (tsk->thread_info->status & TS_USEDFPU) { - err = save_i387_checking((struct i387_fxsave_struct *)buf); + err = save_i387_checking((struct i387_fxsave_struct __user *)buf); if (err) return err; stts(); } else { @@ -110,14 +110,14 @@ * ptrace request handlers. */ -int get_fpregs(struct user_i387_struct *buf, struct task_struct *tsk) +int get_fpregs(struct user_i387_struct __user *buf, struct task_struct *tsk) { init_fpu(tsk); - return __copy_to_user((void *)buf, &tsk->thread.i387.fxsave, + return __copy_to_user(buf, &tsk->thread.i387.fxsave, sizeof(struct user_i387_struct)) ? -EFAULT : 0; } -int set_fpregs(struct task_struct *tsk, struct user_i387_struct *buf) +int set_fpregs(struct task_struct *tsk, struct user_i387_struct __user *buf) { if (__copy_from_user(&tsk->thread.i387.fxsave, buf, sizeof(struct user_i387_struct))) diff -urN linux-2.6.7-rc2/arch/x86_64/kernel/ldt.c linux-2.6.7-rc3/arch/x86_64/kernel/ldt.c --- linux-2.6.7-rc2/arch/x86_64/kernel/ldt.c 2004-05-09 19:33:20.000000000 -0700 +++ linux-2.6.7-rc3/arch/x86_64/kernel/ldt.c 2004-06-07 12:55:01.806572681 -0700 @@ -125,7 +125,7 @@ } } -static int read_ldt(void * ptr, unsigned long bytecount) +static int read_ldt(void __user * ptr, unsigned long bytecount) { int err; unsigned long size; @@ -153,7 +153,7 @@ return bytecount; } -static int read_default_ldt(void * ptr, unsigned long bytecount) +static int read_default_ldt(void __user * ptr, unsigned long bytecount) { /* Arbitrary number */ /* x86-64 default LDT is all zeros */ @@ -164,7 +164,7 @@ return bytecount; } -static int write_ldt(void * ptr, unsigned long bytecount, int oldmode) +static int write_ldt(void __user * ptr, unsigned long bytecount, int oldmode) { struct task_struct *me = current; struct mm_struct * mm = me->mm; @@ -225,7 +225,7 @@ return error; } -asmlinkage int sys_modify_ldt(int func, void *ptr, unsigned long bytecount) +asmlinkage int sys_modify_ldt(int func, void __user *ptr, unsigned long bytecount) { int ret = -ENOSYS; diff -urN linux-2.6.7-rc2/arch/x86_64/kernel/mce.c linux-2.6.7-rc3/arch/x86_64/kernel/mce.c --- linux-2.6.7-rc2/arch/x86_64/kernel/mce.c 2004-06-07 12:54:48.774032921 -0700 +++ linux-2.6.7-rc3/arch/x86_64/kernel/mce.c 2004-06-07 12:55:01.807572723 -0700 @@ -26,7 +26,7 @@ static int mce_disabled __initdata; /* 0: always panic, 1: panic if deadlock possible, 2: try to avoid panic */ -static int tolerant = 2; +static int tolerant = 1; static int banks; static unsigned long bank[NR_BANKS] = { [0 ... NR_BANKS-1] = ~0UL }; @@ -96,7 +96,8 @@ int i; oops_begin(); for (i = 0; i < MCE_LOG_LEN; i++) { - if (mcelog.entry[i].tsc < start) + unsigned long tsc = mcelog.entry[i].tsc; + if (time_before(tsc, start)) continue; print_mce(&mcelog.entry[i]); if (mcelog.entry[i].tsc == backup->tsc) @@ -120,8 +121,8 @@ void do_machine_check(struct pt_regs * regs, long error_code) { - struct mce m; - int nowayout = 0; + struct mce m, panicm; + int nowayout = (tolerant < 1); int kill_it = 0; u64 mcestart; int i; @@ -149,12 +150,23 @@ for (i = 0; i < banks; i++) { if (!bank[i]) continue; + + /* Did this bank cause the exception? */ + /* XXX: check more flags */ + if ((m.status & MCI_STATUS_PCC)) { + panicm = m; + } else { + m.rip = 0; + m.cs = 0; + } + + m.misc = 0; + m.addr = 0; rdmsrl(MSR_IA32_MC0_STATUS + i*4, m.status); if ((m.status & MCI_STATUS_VAL) == 0) continue; - nowayout |= (tolerant < 1); nowayout |= !!(m.status & (MCI_STATUS_OVER|MCI_STATUS_PCC)); kill_it |= !!(m.status & MCI_STATUS_UC); m.bank = i; @@ -176,7 +188,10 @@ if (nowayout) mce_panic("Machine check", &m, mcestart); if (kill_it) { - int user_space = (m.rip && (m.cs & 3)); + int user_space = 0; + + if (m.mcgstatus & MCG_STATUS_RIPV) + user_space = m.rip && (m.cs & 3); /* When the machine was in user space and the CPU didn't get confused it's normally not necessary to panic, unless you @@ -187,7 +202,7 @@ it is best to just halt the machine. */ if ((!user_space && (panic_on_oops || tolerant < 2)) || (unsigned)current->pid <= 1) - mce_panic("Uncorrected machine check", &m, mcestart); + mce_panic("Uncorrected machine check", &panicm, mcestart); /* do_exit takes an awful lot of locks and has as slight risk of deadlocking. If you don't want that don't set tolerant >= 2 */ @@ -207,7 +222,7 @@ * Periodic polling timer for "silent" machine check errors. */ -static int check_interval = 3600; /* one hour */ +static int check_interval = 5 * 60; /* 5 minutes */ static void mcheck_timer(void *data); static DECLARE_WORK(mcheck_work, mcheck_timer, NULL); diff -urN linux-2.6.7-rc2/arch/x86_64/kernel/mpparse.c linux-2.6.7-rc3/arch/x86_64/kernel/mpparse.c --- linux-2.6.7-rc2/arch/x86_64/kernel/mpparse.c 2004-06-07 12:54:48.775032963 -0700 +++ linux-2.6.7-rc3/arch/x86_64/kernel/mpparse.c 2004-06-07 12:55:01.807572723 -0700 @@ -575,6 +575,7 @@ extern void __bad_mpf_size(void); unsigned int *bp = phys_to_virt(base); struct intel_mp_floating *mpf; + static int printed __initdata; Dprintk("Scan SMP from %p for %ld bytes.\n", bp,length); if (sizeof(*mpf) != 16) @@ -598,7 +599,10 @@ bp += 4; length -= 16; } - printk(KERN_INFO "No mptable found.\n"); + if (!printed) { + printk(KERN_INFO "No mptable found.\n"); + printed = 1; + } return 0; } diff -urN linux-2.6.7-rc2/arch/x86_64/kernel/msr.c linux-2.6.7-rc3/arch/x86_64/kernel/msr.c --- linux-2.6.7-rc2/arch/x86_64/kernel/msr.c 2004-06-07 12:54:48.775032963 -0700 +++ linux-2.6.7-rc3/arch/x86_64/kernel/msr.c 2004-06-07 12:55:01.808572764 -0700 @@ -241,7 +241,7 @@ int cpu = iminor(file->f_dentry->d_inode); struct cpuinfo_x86 *c = &(cpu_data)[cpu]; - if (!cpu_online(cpu)) + if (cpu >= NR_CPUS || !cpu_online(cpu)) return -ENXIO; /* No such CPU */ if ( !cpu_has(c, X86_FEATURE_MSR) ) return -EIO; /* MSR not supported */ diff -urN linux-2.6.7-rc2/arch/x86_64/kernel/process.c linux-2.6.7-rc3/arch/x86_64/kernel/process.c --- linux-2.6.7-rc2/arch/x86_64/kernel/process.c 2004-06-07 12:54:48.776033004 -0700 +++ linux-2.6.7-rc3/arch/x86_64/kernel/process.c 2004-06-07 12:55:01.809572806 -0700 @@ -521,7 +521,8 @@ * sys_execve() executes a new program. */ asmlinkage -long sys_execve(char *name, char **argv,char **envp, struct pt_regs regs) +long sys_execve(char __user *name, char __user * __user *argv, + char __user * __user *envp, struct pt_regs regs) { long error; char * filename; @@ -550,7 +551,7 @@ return do_fork(SIGCHLD, regs.rsp, ®s, 0, NULL, NULL); } -asmlinkage long sys_clone(unsigned long clone_flags, unsigned long newsp, void *parent_tid, void *child_tid, struct pt_regs regs) +asmlinkage long sys_clone(unsigned long clone_flags, unsigned long newsp, void __user *parent_tid, void __user *child_tid, struct pt_regs regs) { if (!newsp) newsp = regs.rsp; @@ -664,7 +665,7 @@ rdmsrl(MSR_FS_BASE, base); } else base = task->thread.fs; - ret = put_user(base, (unsigned long *)addr); + ret = put_user(base, (unsigned long __user *)addr); break; } case ARCH_GET_GS: { @@ -675,7 +676,7 @@ rdmsrl(MSR_KERNEL_GS_BASE, base); } else base = task->thread.gs; - ret = put_user(base, (unsigned long *)addr); + ret = put_user(base, (unsigned long __user *)addr); break; } diff -urN linux-2.6.7-rc2/arch/x86_64/kernel/ptrace.c linux-2.6.7-rc3/arch/x86_64/kernel/ptrace.c --- linux-2.6.7-rc2/arch/x86_64/kernel/ptrace.c 2004-05-09 19:32:27.000000000 -0700 +++ linux-2.6.7-rc3/arch/x86_64/kernel/ptrace.c 2004-06-07 12:55:01.810572847 -0700 @@ -232,7 +232,7 @@ ret = -EIO; if (copied != sizeof(tmp)) break; - ret = put_user(tmp,(unsigned long *) data); + ret = put_user(tmp,(unsigned long __user *) data); break; } @@ -271,7 +271,7 @@ tmp = 0; break; } - ret = put_user(tmp,(unsigned long *) data); + ret = put_user(tmp,(unsigned long __user *) data); break; } @@ -360,19 +360,20 @@ don't use it against 64bit processes, use PTRACE_ARCH_PRCTL instead. */ case PTRACE_SET_THREAD_AREA: { + struct user_desc __user *p; int old; - get_user(old, &((struct user_desc *)data)->entry_number); - put_user(addr, &((struct user_desc *)data)->entry_number); - ret = do_set_thread_area(&child->thread, - (struct user_desc *)data); - put_user(old, &((struct user_desc *)data)->entry_number); + p = (struct user_desc __user *)data; + get_user(old, &p->entry_number); + put_user(addr, &p->entry_number); + ret = do_set_thread_area(&child->thread, p); + put_user(old, &p->entry_number); break; case PTRACE_GET_THREAD_AREA: - get_user(old, &((struct user_desc *)data)->entry_number); - put_user(addr, &((struct user_desc *)data)->entry_number); - ret = do_get_thread_area(&child->thread, - (struct user_desc *)data); - put_user(old, &((struct user_desc *)data)->entry_number); + p = (struct user_desc __user *)data; + get_user(old, &p->entry_number); + put_user(addr, &p->entry_number); + ret = do_get_thread_area(&child->thread, p); + put_user(old, &p->entry_number); break; } #endif @@ -428,12 +429,12 @@ break; case PTRACE_GETREGS: { /* Get all gp regs from the child. */ - if (!access_ok(VERIFY_WRITE, (unsigned *)data, FRAME_SIZE)) { + if (!access_ok(VERIFY_WRITE, (unsigned __user *)data, FRAME_SIZE)) { ret = -EIO; break; } for (ui = 0; ui < sizeof(struct user_regs_struct); ui += sizeof(long)) { - __put_user(getreg(child, ui),(unsigned long *) data); + __put_user(getreg(child, ui),(unsigned long __user *) data); data += sizeof(long); } ret = 0; @@ -442,12 +443,12 @@ case PTRACE_SETREGS: { /* Set all gp regs in the child. */ unsigned long tmp; - if (!access_ok(VERIFY_READ, (unsigned *)data, FRAME_SIZE)) { + if (!access_ok(VERIFY_READ, (unsigned __user *)data, FRAME_SIZE)) { ret = -EIO; break; } for (ui = 0; ui < sizeof(struct user_regs_struct); ui += sizeof(long)) { - __get_user(tmp, (unsigned long *) data); + __get_user(tmp, (unsigned long __user *) data); putreg(child, ui, tmp); data += sizeof(long); } @@ -456,23 +457,23 @@ } case PTRACE_GETFPREGS: { /* Get the child extended FPU state. */ - if (!access_ok(VERIFY_WRITE, (unsigned *)data, + if (!access_ok(VERIFY_WRITE, (unsigned __user *)data, sizeof(struct user_i387_struct))) { ret = -EIO; break; } - ret = get_fpregs((struct user_i387_struct *)data, child); + ret = get_fpregs((struct user_i387_struct __user *)data, child); break; } case PTRACE_SETFPREGS: { /* Set the child extended FPU state. */ - if (!access_ok(VERIFY_READ, (unsigned *)data, + if (!access_ok(VERIFY_READ, (unsigned __user *)data, sizeof(struct user_i387_struct))) { ret = -EIO; break; } child->used_math = 1; - ret = set_fpregs(child, (struct user_i387_struct *)data); + ret = set_fpregs(child, (struct user_i387_struct __user *)data); break; } diff -urN linux-2.6.7-rc2/arch/x86_64/kernel/setup.c linux-2.6.7-rc3/arch/x86_64/kernel/setup.c --- linux-2.6.7-rc2/arch/x86_64/kernel/setup.c 2004-06-07 12:54:48.778033087 -0700 +++ linux-2.6.7-rc3/arch/x86_64/kernel/setup.c 2004-06-07 12:55:01.811572889 -0700 @@ -253,6 +253,8 @@ /* acpi=ht just means: do ACPI MADT parsing at bootup, but don't enable the full ACPI interpreter */ if (!memcmp(from, "acpi=ht", 7)) { + /* if (!acpi_force) */ + disable_acpi(); acpi_ht = 1; } else if (!memcmp(from, "pci=noacpi", 10)) @@ -535,8 +537,7 @@ * the bootmem allocator) but before get_smp_config (to allow parsing * of MADT). */ - if (!acpi_disabled) - acpi_boot_init(); + acpi_boot_init(); #endif #ifdef CONFIG_X86_LOCAL_APIC /* @@ -909,7 +910,7 @@ c->x86_model += ((tfms >> 16) & 0xF) << 4; } if (c->x86_capability[0] & (1<<19)) - c->x86_clflush_size = ((misc >> 8) & 0xff) * 8; + c->x86_clflush_size = ((misc >> 8) & 0xff) * 8; } else { /* Have CPUID level 0 only - unheard of */ c->x86 = 4; @@ -967,7 +968,7 @@ display_cacheinfo(c); break; } - + select_idle_routine(c); detect_ht(c); diff -urN linux-2.6.7-rc2/arch/x86_64/kernel/setup64.c linux-2.6.7-rc3/arch/x86_64/kernel/setup64.c --- linux-2.6.7-rc2/arch/x86_64/kernel/setup64.c 2004-05-09 19:32:26.000000000 -0700 +++ linux-2.6.7-rc3/arch/x86_64/kernel/setup64.c 2004-06-07 12:55:01.811572889 -0700 @@ -39,7 +39,7 @@ extern struct desc_ptr cpu_gdt_descr[]; struct desc_ptr idt_descr = { 256 * 16, (unsigned long) idt_table }; -char boot_cpu_stack[IRQSTACKSIZE] __cacheline_aligned; +char boot_cpu_stack[IRQSTACKSIZE] __attribute__((section(".bss.page_aligned"))); unsigned long __supported_pte_mask = ~0UL; static int do_not_nx __initdata = 0; @@ -190,7 +190,8 @@ pda->irqstackptr += IRQSTACKSIZE-64; } -char boot_exception_stacks[N_EXCEPTION_STACKS * EXCEPTION_STKSZ]; +char boot_exception_stacks[N_EXCEPTION_STACKS * EXCEPTION_STKSZ] +__attribute__((section(".bss.page_aligned"))); void __init syscall_init(void) { diff -urN linux-2.6.7-rc2/arch/x86_64/kernel/signal.c linux-2.6.7-rc3/arch/x86_64/kernel/signal.c --- linux-2.6.7-rc2/arch/x86_64/kernel/signal.c 2004-06-07 12:54:48.778033087 -0700 +++ linux-2.6.7-rc3/arch/x86_64/kernel/signal.c 2004-06-07 12:55:01.812572930 -0700 @@ -40,7 +40,7 @@ sigset_t *set, struct pt_regs * regs); asmlinkage long -sys_rt_sigsuspend(sigset_t *unewset, size_t sigsetsize, struct pt_regs regs) +sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize, struct pt_regs regs) { sigset_t saveset, newset; @@ -57,7 +57,7 @@ current->blocked = newset; recalc_sigpending(); spin_unlock_irq(¤t->sighand->siglock); -#if DEBUG_SIG +#ifdef DEBUG_SIG printk("rt_sigsuspend savset(%lx) newset(%lx) regs(%p) rip(%lx)\n", saveset, newset, ®s, regs.rip); #endif @@ -71,7 +71,7 @@ } asmlinkage long -sys_sigaltstack(const stack_t *uss, stack_t *uoss, struct pt_regs regs) +sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, struct pt_regs regs) { return do_sigaltstack(uss, uoss, regs.rsp); } @@ -89,7 +89,7 @@ }; static int -restore_sigcontext(struct pt_regs *regs, struct sigcontext *sc, unsigned long *prax) +restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, unsigned long *prax) { unsigned int err = 0; @@ -117,7 +117,7 @@ } { - struct _fpstate * buf; + struct _fpstate __user * buf; err |= __get_user(buf, &sc->fpstate); if (buf) { @@ -136,10 +136,11 @@ asmlinkage long sys_rt_sigreturn(struct pt_regs regs) { - struct rt_sigframe *frame = (struct rt_sigframe *)(regs.rsp - 8); + struct rt_sigframe __user *frame; sigset_t set; long eax; + frame = (struct rt_sigframe __user *)(regs.rsp - 8); if (verify_area(VERIFY_READ, frame, sizeof(*frame))) { goto badframe; } @@ -157,7 +158,7 @@ goto badframe; } -#if DEBUG_SIG +#ifdef DEBUG_SIG printk("%d sigreturn rip:%lx rsp:%lx frame:%p rax:%lx\n",current->pid,regs.rip,regs.rsp,frame,eax); #endif @@ -176,7 +177,7 @@ */ static inline int -setup_sigcontext(struct sigcontext *sc, struct pt_regs *regs, unsigned long mask, struct task_struct *me) +setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs, unsigned long mask, struct task_struct *me) { int err = 0; @@ -213,7 +214,7 @@ * Determine which stack to use.. */ -static void * +static void __user * get_stack(struct k_sigaction *ka, struct pt_regs *regs, unsigned long size) { unsigned long rsp; @@ -228,20 +229,20 @@ rsp = current->sas_ss_sp + current->sas_ss_size; } - return (void *)round_down(rsp - size, 16); + return (void __user *)round_down(rsp - size, 16); } static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, sigset_t *set, struct pt_regs * regs) { - struct rt_sigframe *frame; - struct _fpstate *fp = NULL; + struct rt_sigframe __user *frame; + struct _fpstate __user *fp = NULL; int err = 0; struct task_struct *me = current; if (me->used_math) { fp = get_stack(ka, regs, sizeof(struct _fpstate)); - frame = (void *)round_down((u64)fp - sizeof(struct rt_sigframe), 16) - 8; + frame = (void __user *)round_down((u64)fp - sizeof(struct rt_sigframe), 16) - 8; if (!access_ok(VERIFY_WRITE, fp, sizeof(struct _fpstate))) { goto give_sigsegv; @@ -294,7 +295,7 @@ goto give_sigsegv; } -#if DEBUG_SIG +#ifdef DEBUG_SIG printk("%d old rip %lx old rsp %lx old rax %lx\n", current->pid,regs->rip,regs->rsp,regs->rax); #endif @@ -319,7 +320,7 @@ set_fs(USER_DS); regs->eflags &= ~TF_MASK; -#if DEBUG_SIG +#ifdef DEBUG_SIG printk("SIG deliver (%s:%d): sp=%p pc=%p ra=%p\n", current->comm, current->pid, frame, regs->rip, frame->pretcode); #endif @@ -342,7 +343,7 @@ { struct k_sigaction *ka = ¤t->sighand->action[sig-1]; -#if DEBUG_SIG +#ifdef DEBUG_SIG printk("handle_signal pid:%d sig:%lu rip:%lx rsp:%lx regs=%p\n", current->pid, sig, regs->rip, regs->rsp, regs); #endif @@ -454,7 +455,7 @@ void do_notify_resume(struct pt_regs *regs, sigset_t *oldset, __u32 thread_info_flags) { -#if DEBUG_SIG +#ifdef DEBUG_SIG printk("do_notify_resume flags:%x rip:%lx rsp:%lx caller:%lx pending:%lx\n", thread_info_flags, regs->rip, regs->rsp, __builtin_return_address(0),signal_pending(current)); #endif @@ -470,7 +471,7 @@ do_signal(regs,oldset); } -void signal_fault(struct pt_regs *regs, void *frame, char *where) +void signal_fault(struct pt_regs *regs, void __user *frame, char *where) { struct task_struct *me = current; if (exception_trace) diff -urN linux-2.6.7-rc2/arch/x86_64/kernel/smpboot.c linux-2.6.7-rc3/arch/x86_64/kernel/smpboot.c --- linux-2.6.7-rc2/arch/x86_64/kernel/smpboot.c 2004-06-07 12:54:48.779033128 -0700 +++ linux-2.6.7-rc3/arch/x86_64/kernel/smpboot.c 2004-06-07 12:55:01.813572971 -0700 @@ -895,15 +895,17 @@ cpu_set(i, cpu_sibling_map[cpu]); } } - } else { + } else { siblings++; cpu_set(cpu, cpu_sibling_map[cpu]); } - if (siblings != smp_num_siblings) - printk(KERN_WARNING - "WARNING: %d siblings found for CPU%d, should be %d\n", + if (siblings != smp_num_siblings) { + printk(KERN_WARNING + "WARNING: %d siblings found for CPU%d, should be %d\n", siblings, cpu, smp_num_siblings); + smp_num_siblings = siblings; + } } Dprintk("Boot done.\n"); diff -urN linux-2.6.7-rc2/arch/x86_64/kernel/sys_x86_64.c linux-2.6.7-rc3/arch/x86_64/kernel/sys_x86_64.c --- linux-2.6.7-rc2/arch/x86_64/kernel/sys_x86_64.c 2004-05-09 19:32:52.000000000 -0700 +++ linux-2.6.7-rc3/arch/x86_64/kernel/sys_x86_64.c 2004-06-07 12:55:01.814573013 -0700 @@ -25,7 +25,7 @@ * sys_pipe() is the normal C calling standard for creating * a pipe. It's not the way Unix traditionally does this, though. */ -asmlinkage long sys_pipe(int *fildes) +asmlinkage long sys_pipe(int __user *fildes) { int fd[2]; int error; @@ -142,7 +142,7 @@ } } -asmlinkage long sys_uname(struct new_utsname * name) +asmlinkage long sys_uname(struct new_utsname __user * name) { int err; down_read(&uts_sem); @@ -153,13 +153,13 @@ return err ? -EFAULT : 0; } -asmlinkage long wrap_sys_shmat(int shmid, char *shmaddr, int shmflg) +asmlinkage long wrap_sys_shmat(int shmid, char __user *shmaddr, int shmflg) { unsigned long raddr; return do_shmat(shmid,shmaddr,shmflg,&raddr) ?: (long)raddr; } -asmlinkage long sys_time64(long * tloc) +asmlinkage long sys_time64(long __user * tloc) { struct timeval now; int i; diff -urN linux-2.6.7-rc2/arch/x86_64/kernel/traps.c linux-2.6.7-rc3/arch/x86_64/kernel/traps.c --- linux-2.6.7-rc2/arch/x86_64/kernel/traps.c 2004-06-07 12:54:48.780033170 -0700 +++ linux-2.6.7-rc3/arch/x86_64/kernel/traps.c 2004-06-07 12:55:01.815573054 -0700 @@ -302,7 +302,7 @@ if (__get_user(tmp, f.filename)) f.filename = "unmapped filename"; printk("----------- [cut here ] --------- [please bite here ] ---------\n"); - printk("Kernel BUG at %.50s:%d\n", f.filename, f.line); + printk(KERN_ALERT "Kernel BUG at %.50s:%d\n", f.filename, f.line); } void out_of_line_bug(void) @@ -356,7 +356,7 @@ notify_die(DIE_OOPS, (char *)str, regs, err, 255, SIGSEGV); show_registers(regs); /* Executive summary in case the oops scrolled away */ - printk("RIP "); + printk(KERN_ALERT "RIP "); printk_address(regs->rip); printk(" RSP <%016lx>\n", regs->rsp); } diff -urN linux-2.6.7-rc2/arch/x86_64/kernel/vmlinux.lds.S linux-2.6.7-rc3/arch/x86_64/kernel/vmlinux.lds.S --- linux-2.6.7-rc2/arch/x86_64/kernel/vmlinux.lds.S 2004-05-09 19:31:59.000000000 -0700 +++ linux-2.6.7-rc3/arch/x86_64/kernel/vmlinux.lds.S 2004-06-07 12:55:01.815573054 -0700 @@ -39,6 +39,7 @@ __bss_start = .; /* BSS */ .bss : { + *(.bss.page_aligned) *(.bss) } __bss_end = .; @@ -75,8 +76,8 @@ . = ALIGN(8192); /* init_task */ .data.init_task : { *(.data.init_task) } - . = ALIGN(4096); - .data.boot_pgt : { *(.data.boot_pgt) } + . = ALIGN(4096); + .data.page_aligned : { *(.data.page_aligned) } . = ALIGN(4096); /* Init code and data */ __init_begin = .; diff -urN linux-2.6.7-rc2/arch/x86_64/kernel/x8664_ksyms.c linux-2.6.7-rc3/arch/x86_64/kernel/x8664_ksyms.c --- linux-2.6.7-rc2/arch/x86_64/kernel/x8664_ksyms.c 2004-06-07 12:54:48.781033211 -0700 +++ linux-2.6.7-rc3/arch/x86_64/kernel/x8664_ksyms.c 2004-06-07 12:55:01.816573096 -0700 @@ -219,6 +219,3 @@ #endif EXPORT_SYMBOL(sys_ioctl); - -EXPORT_SYMBOL(memcpy_toio); -EXPORT_SYMBOL(memcpy_fromio); diff -urN linux-2.6.7-rc2/arch/x86_64/lib/Makefile linux-2.6.7-rc3/arch/x86_64/lib/Makefile --- linux-2.6.7-rc2/arch/x86_64/lib/Makefile 2004-05-09 19:32:01.000000000 -0700 +++ linux-2.6.7-rc3/arch/x86_64/lib/Makefile 2004-06-07 12:55:01.816573096 -0700 @@ -4,9 +4,11 @@ CFLAGS_csum-partial.o := -funroll-loops +obj-y := io.o + lib-y := csum-partial.o csum-copy.o csum-wrappers.o delay.o \ usercopy.o getuser.o putuser.o \ - thunk.o io.o clear_page.o copy_page.o bitstr.o + thunk.o clear_page.o copy_page.o bitstr.o lib-y += memcpy.o memmove.o memset.o copy_user.o lib-$(CONFIG_HAVE_DEC_LOCK) += dec_and_lock.o diff -urN linux-2.6.7-rc2/arch/x86_64/lib/csum-wrappers.c linux-2.6.7-rc3/arch/x86_64/lib/csum-wrappers.c --- linux-2.6.7-rc2/arch/x86_64/lib/csum-wrappers.c 2004-05-09 19:31:58.000000000 -0700 +++ linux-2.6.7-rc3/arch/x86_64/lib/csum-wrappers.c 2004-06-07 12:55:01.816573096 -0700 @@ -19,7 +19,7 @@ * src and dst are best aligned to 64bits. */ unsigned int -csum_partial_copy_from_user(const char *src, char *dst, +csum_partial_copy_from_user(const char __user *src, char *dst, int len, unsigned int isum, int *errp) { *errp = 0; @@ -33,7 +33,7 @@ if (unlikely((unsigned long)src & 6)) { while (((unsigned long)src & 6) && len >= 2) { __u16 val16; - *errp = __get_user(val16, (__u16 *)src); + *errp = __get_user(val16, (__u16 __user *)src); if (*errp) return isum; *(__u16 *)dst = val16; @@ -43,7 +43,7 @@ len -= 2; } } - isum = csum_partial_copy_generic(src,dst,len,isum,errp,NULL); + isum = csum_partial_copy_generic((void *)src,dst,len,isum,errp,NULL); if (likely(*errp == 0)) return isum; } @@ -66,7 +66,7 @@ * src and dst are best aligned to 64bits. */ unsigned int -csum_partial_copy_to_user(const char *src, char *dst, +csum_partial_copy_to_user(const char *src, char __user *dst, int len, unsigned int isum, int *errp) { if (unlikely(!access_ok(VERIFY_WRITE, dst, len))) { @@ -78,7 +78,7 @@ while (((unsigned long)dst & 6) && len >= 2) { __u16 val16 = *(__u16 *)src; isum = add32_with_carry(isum, val16); - *errp = __put_user(val16, (__u16 *)dst); + *errp = __put_user(val16, (__u16 __user *)dst); if (*errp) return isum; src += 2; @@ -88,7 +88,7 @@ } *errp = 0; - return csum_partial_copy_generic(src,dst,len,isum,NULL,errp); + return csum_partial_copy_generic(src, (void *)dst,len,isum,NULL,errp); } EXPORT_SYMBOL(csum_partial_copy_to_user); diff -urN linux-2.6.7-rc2/arch/x86_64/lib/io.c linux-2.6.7-rc3/arch/x86_64/lib/io.c --- linux-2.6.7-rc2/arch/x86_64/lib/io.c 2004-05-09 19:31:59.000000000 -0700 +++ linux-2.6.7-rc3/arch/x86_64/lib/io.c 2004-06-07 12:55:01.816573096 -0700 @@ -2,12 +2,14 @@ #include #include -void *memcpy_toio(void *dst,const void*src,unsigned len) +void *__memcpy_toio(unsigned long dst,const void*src,unsigned len) { - return __inline_memcpy(dst,src,len); + return __inline_memcpy((void *) dst,src,len); } +EXPORT_SYMBOL(__memcpy_toio); -void *memcpy_fromio(void *dst,const void*src,unsigned len) +void *__memcpy_fromio(void *dst,unsigned long src,unsigned len) { - return __inline_memcpy(dst,src,len); + return __inline_memcpy(dst,(const void *) src,len); } +EXPORT_SYMBOL(__memcpy_fromio); diff -urN linux-2.6.7-rc2/arch/x86_64/lib/usercopy.c linux-2.6.7-rc3/arch/x86_64/lib/usercopy.c --- linux-2.6.7-rc2/arch/x86_64/lib/usercopy.c 2004-05-09 19:31:59.000000000 -0700 +++ linux-2.6.7-rc3/arch/x86_64/lib/usercopy.c 2004-06-07 12:55:01.817573137 -0700 @@ -40,7 +40,7 @@ } while (0) long -__strncpy_from_user(char *dst, const char *src, long count) +__strncpy_from_user(char *dst, const char __user *src, long count) { long res; __do_strncpy_from_user(dst, src, count, res); @@ -48,7 +48,7 @@ } long -strncpy_from_user(char *dst, const char *src, long count) +strncpy_from_user(char *dst, const char __user *src, long count) { long res = -EFAULT; if (access_ok(VERIFY_READ, src, 1)) @@ -60,7 +60,7 @@ * Zero Userspace */ -unsigned long __clear_user(void *addr, unsigned long size) +unsigned long __clear_user(void __user *addr, unsigned long size) { long __d0; /* no memory constraint because it doesn't change any memory gcc knows @@ -94,7 +94,7 @@ } -unsigned long clear_user(void *to, unsigned long n) +unsigned long clear_user(void __user *to, unsigned long n) { if (access_ok(VERIFY_WRITE, to, n)) return __clear_user(to, n); @@ -107,7 +107,7 @@ * Return 0 on exception, a value greater than N if too long */ -long strnlen_user(const char *s, long n) +long strnlen_user(const char __user *s, long n) { long res = 0; char c; @@ -127,7 +127,7 @@ } } -long strlen_user(const char *s) +long strlen_user(const char __user *s) { long res = 0; char c; @@ -142,10 +142,10 @@ } } -unsigned long copy_in_user(void *to, const void *from, unsigned len) +unsigned long copy_in_user(void __user *to, const void __user *from, unsigned len) { if (access_ok(VERIFY_WRITE, to, len) && access_ok(VERIFY_READ, from, len)) { - return copy_user_generic(to, from, len); + return copy_user_generic((void *)to, (void *)from, len); } return len; } diff -urN linux-2.6.7-rc2/arch/x86_64/mm/fault.c linux-2.6.7-rc3/arch/x86_64/mm/fault.c --- linux-2.6.7-rc2/arch/x86_64/mm/fault.c 2004-05-09 19:31:58.000000000 -0700 +++ linux-2.6.7-rc3/arch/x86_64/mm/fault.c 2004-06-07 12:55:01.817573137 -0700 @@ -423,8 +423,9 @@ printk(KERN_ALERT "Unable to handle kernel NULL pointer dereference"); else printk(KERN_ALERT "Unable to handle kernel paging request"); - printk(" at %016lx RIP: \n",address); + printk(" at %016lx RIP: \n" KERN_ALERT,address); printk_address(regs->rip); + printk("\n"); dump_pagetable(address); __die("Oops", regs, error_code); /* Executive summary in case the body of the oops scrolled away */ diff -urN linux-2.6.7-rc2/arch/x86_64/mm/init.c linux-2.6.7-rc3/arch/x86_64/mm/init.c --- linux-2.6.7-rc2/arch/x86_64/mm/init.c 2004-05-09 19:32:02.000000000 -0700 +++ linux-2.6.7-rc3/arch/x86_64/mm/init.c 2004-06-07 12:55:01.818573178 -0700 @@ -512,9 +512,7 @@ /* Should check here against the e820 map to avoid double free */ #ifdef CONFIG_DISCONTIGMEM int nid = phys_to_nid(phys); - if (phys < HIGH_MEMORY && nid) - panic("reserve of %lx at node %d", phys, nid); - reserve_bootmem_node(NODE_DATA(nid), phys, len); + reserve_bootmem_node(NODE_DATA(nid), phys, len); #else reserve_bootmem(phys, len); #endif diff -urN linux-2.6.7-rc2/arch/x86_64/mm/numa.c linux-2.6.7-rc3/arch/x86_64/mm/numa.c --- linux-2.6.7-rc2/arch/x86_64/mm/numa.c 2004-05-09 19:33:13.000000000 -0700 +++ linux-2.6.7-rc3/arch/x86_64/mm/numa.c 2004-06-07 12:55:01.818573178 -0700 @@ -124,7 +124,7 @@ start_pfn = node_start_pfn(nodeid); end_pfn = node_end_pfn(nodeid); - printk(KERN_INFO "setting up node %d %lx-%lx\n", nodeid, start_pfn, end_pfn); + Dprintk(KERN_INFO "setting up node %d %lx-%lx\n", nodeid, start_pfn, end_pfn); /* All nodes > 0 have a zero length zone DMA */ dma_end_pfn = __pa(MAX_DMA_ADDRESS) >> PAGE_SHIFT; diff -urN linux-2.6.7-rc2/arch/x86_64/mm/pageattr.c linux-2.6.7-rc3/arch/x86_64/mm/pageattr.c --- linux-2.6.7-rc2/arch/x86_64/mm/pageattr.c 2004-06-07 12:54:48.782033253 -0700 +++ linux-2.6.7-rc3/arch/x86_64/mm/pageattr.c 2004-06-07 12:55:01.819573220 -0700 @@ -96,8 +96,7 @@ * No more special protections in this 2/4MB area - revert to a * large page again. */ -static void revert_page(struct page *kpte_page, unsigned long address, - pgprot_t ref_prot) +static void revert_page(unsigned long address, pgprot_t ref_prot) { pgd_t *pgd; pmd_t *pmd; @@ -145,7 +144,7 @@ if (page_count(kpte_page) == 1) { save_page(address, kpte_page); - revert_page(kpte_page, address, ref_prot); + revert_page(address, ref_prot); } return 0; } @@ -176,7 +175,8 @@ break; /* Handle kernel mapping too which aliases part of the * lowmem */ - if (page_to_phys(page) < KERNEL_TEXT_SIZE) { + /* Disabled right now. Fixme */ + if (0 && page_to_phys(page) < KERNEL_TEXT_SIZE) { unsigned long addr2; addr2 = __START_KERNEL_map + page_to_phys(page); err = __change_page_attr(addr2, page, prot, diff -urN linux-2.6.7-rc2/drivers/acpi/asus_acpi.c linux-2.6.7-rc3/drivers/acpi/asus_acpi.c --- linux-2.6.7-rc2/drivers/acpi/asus_acpi.c 2004-06-07 12:54:48.835035448 -0700 +++ linux-2.6.7-rc3/drivers/acpi/asus_acpi.c 2004-06-07 12:55:01.933577942 -0700 @@ -40,6 +40,7 @@ #include #include #include +#include #define ASUS_ACPI_VERSION "0.28" @@ -480,16 +481,31 @@ return (hotk->status & ledmask) ? 1 : 0; } +static int parse_arg(const char __user *buf, unsigned long count, int *val) +{ + char s[32]; + if (!count) + return 0; + if (count > 31) + return -EINVAL; + if (copy_from_user(s, buf, count)) + return -EFAULT; + s[count] = 0; + if (sscanf(s, "%i", val) != 1) + return -EINVAL; + return count; +} /* FIXME: kill extraneous args so it can be called independently */ static int -write_led(const char *buffer, unsigned long count, struct asus_hotk *hotk, +write_led(const char __user *buffer, unsigned long count, struct asus_hotk *hotk, char *ledname, int ledmask, int invert) { int value; int led_out = 0; - if (sscanf(buffer, "%i", &value) == 1) + count = parse_arg(buffer, count, &value); + if (count > 0) led_out = value ? 1 : 0; hotk->status = @@ -518,7 +534,7 @@ static int -proc_write_mled(struct file *file, const char *buffer, +proc_write_mled(struct file *file, const char __user *buffer, unsigned long count, void *data) { struct asus_hotk *hotk = (struct asus_hotk *) data; @@ -537,7 +553,7 @@ } static int -proc_write_wled(struct file *file, const char *buffer, +proc_write_wled(struct file *file, const char __user *buffer, unsigned long count, void *data) { struct asus_hotk *hotk = (struct asus_hotk *) data; @@ -556,7 +572,7 @@ } static int -proc_write_tled(struct file *file, const char *buffer, +proc_write_tled(struct file *file, const char __user *buffer, unsigned long count, void *data) { struct asus_hotk *hotk = (struct asus_hotk *) data; @@ -640,13 +656,14 @@ static int -proc_write_lcd(struct file *file, const char *buffer, +proc_write_lcd(struct file *file, const char __user *buffer, unsigned long count, void *data) { int value; struct asus_hotk *hotk = (struct asus_hotk *) data; - if (sscanf(buffer, "%i", &value) == 1) + count = parse_arg(buffer, count, &value); + if (count > 0) set_lcd_state(hotk, value); return count; } @@ -707,17 +724,18 @@ } static int -proc_write_brn(struct file *file, const char *buffer, +proc_write_brn(struct file *file, const char __user *buffer, unsigned long count, void *data) { int value; struct asus_hotk *hotk = (struct asus_hotk *) data; - if (sscanf(buffer, "%d", &value) == 1) { + count = parse_arg(buffer, count, &value); + if (count > 0) { value = (0 < value) ? ((15 < value) ? 15 : value) : 0; /* 0 <= value <= 15 */ set_brightness(value, hotk); - } else { + } else if (count < 0) { printk(KERN_WARNING "Asus ACPI: Error reading user input\n"); } @@ -756,17 +774,17 @@ * simultaneously, so be warned. See the acpi4asus README for more info. */ static int -proc_write_disp(struct file *file, const char *buffer, +proc_write_disp(struct file *file, const char __user *buffer, unsigned long count, void *data) { int value; struct asus_hotk *hotk = (struct asus_hotk *) data; - if (sscanf(buffer, "%d", &value) == 1) + count = parse_arg(buffer, count, &value); + if (count > 0) set_display(value, hotk); - else { + else if (count < 0) printk(KERN_WARNING "Asus ACPI: Error reading user input\n"); - } return count; } @@ -774,7 +792,7 @@ typedef int (proc_readfunc)(char *page, char **start, off_t off, int count, int *eof, void *data); -typedef int (proc_writefunc)(struct file *file, const char *buffer, +typedef int (proc_writefunc)(struct file *file, const char __user *buffer, unsigned long count, void *data); static int diff -urN linux-2.6.7-rc2/drivers/atm/ambassador.c linux-2.6.7-rc3/drivers/atm/ambassador.c --- linux-2.6.7-rc2/drivers/atm/ambassador.c 2004-05-09 19:32:00.000000000 -0700 +++ linux-2.6.7-rc3/drivers/atm/ambassador.c 2004-06-07 12:55:02.074583782 -0700 @@ -1706,105 +1706,108 @@ } /********** basic loader commands and error handling **********/ +// centisecond timeouts - guessing away here +static unsigned int command_timeouts [] = { + [host_memory_test] = 15, + [read_adapter_memory] = 2, + [write_adapter_memory] = 2, + [adapter_start] = 50, + [get_version_number] = 10, + [interrupt_host] = 1, + [flash_erase_sector] = 1, + [adap_download_block] = 1, + [adap_erase_flash] = 1, + [adap_run_in_iram] = 1, + [adap_end_download] = 1 +}; + + +unsigned int command_successes [] = { + [host_memory_test] = COMMAND_PASSED_TEST, + [read_adapter_memory] = COMMAND_READ_DATA_OK, + [write_adapter_memory] = COMMAND_WRITE_DATA_OK, + [adapter_start] = COMMAND_COMPLETE, + [get_version_number] = COMMAND_COMPLETE, + [interrupt_host] = COMMAND_COMPLETE, + [flash_erase_sector] = COMMAND_COMPLETE, + [adap_download_block] = COMMAND_COMPLETE, + [adap_erase_flash] = COMMAND_COMPLETE, + [adap_run_in_iram] = COMMAND_COMPLETE, + [adap_end_download] = COMMAND_COMPLETE +}; + +static int decode_loader_result (loader_command cmd, u32 result) +{ + int res; + const char *msg; + + if (result == command_successes[cmd]) + return 0; + + switch (result) { + case BAD_COMMAND: + res = -EINVAL; + msg = "bad command"; + break; + case COMMAND_IN_PROGRESS: + res = -ETIMEDOUT; + msg = "command in progress"; + break; + case COMMAND_PASSED_TEST: + res = 0; + msg = "command passed test"; + break; + case COMMAND_FAILED_TEST: + res = -EIO; + msg = "command failed test"; + break; + case COMMAND_READ_DATA_OK: + res = 0; + msg = "command read data ok"; + break; + case COMMAND_READ_BAD_ADDRESS: + res = -EINVAL; + msg = "command read bad address"; + break; + case COMMAND_WRITE_DATA_OK: + res = 0; + msg = "command write data ok"; + break; + case COMMAND_WRITE_BAD_ADDRESS: + res = -EINVAL; + msg = "command write bad address"; + break; + case COMMAND_WRITE_FLASH_FAILURE: + res = -EIO; + msg = "command write flash failure"; + break; + case COMMAND_COMPLETE: + res = 0; + msg = "command complete"; + break; + case COMMAND_FLASH_ERASE_FAILURE: + res = -EIO; + msg = "command flash erase failure"; + break; + case COMMAND_WRITE_BAD_DATA: + res = -EINVAL; + msg = "command write bad data"; + break; + default: + res = -EINVAL; + msg = "unknown error"; + PRINTD (DBG_LOAD|DBG_ERR, + "decode_loader_result got %d=%x !", + result, result); + break; + } + + PRINTK (KERN_ERR, "%s", msg); + return res; +} static int __init do_loader_command (volatile loader_block * lb, const amb_dev * dev, loader_command cmd) { - // centisecond timeouts - guessing away here - unsigned int command_timeouts [] = { - [host_memory_test] = 15, - [read_adapter_memory] = 2, - [write_adapter_memory] = 2, - [adapter_start] = 50, - [get_version_number] = 10, - [interrupt_host] = 1, - [flash_erase_sector] = 1, - [adap_download_block] = 1, - [adap_erase_flash] = 1, - [adap_run_in_iram] = 1, - [adap_end_download] = 1 - }; - - unsigned int command_successes [] = { - [host_memory_test] = COMMAND_PASSED_TEST, - [read_adapter_memory] = COMMAND_READ_DATA_OK, - [write_adapter_memory] = COMMAND_WRITE_DATA_OK, - [adapter_start] = COMMAND_COMPLETE, - [get_version_number] = COMMAND_COMPLETE, - [interrupt_host] = COMMAND_COMPLETE, - [flash_erase_sector] = COMMAND_COMPLETE, - [adap_download_block] = COMMAND_COMPLETE, - [adap_erase_flash] = COMMAND_COMPLETE, - [adap_run_in_iram] = COMMAND_COMPLETE, - [adap_end_download] = COMMAND_COMPLETE - }; - - int decode_loader_result (loader_command cmd, u32 result) { - int res; - const char * msg; - - if (result == command_successes[cmd]) - return 0; - - switch (result) { - case BAD_COMMAND: - res = -EINVAL; - msg = "bad command"; - break; - case COMMAND_IN_PROGRESS: - res = -ETIMEDOUT; - msg = "command in progress"; - break; - case COMMAND_PASSED_TEST: - res = 0; - msg = "command passed test"; - break; - case COMMAND_FAILED_TEST: - res = -EIO; - msg = "command failed test"; - break; - case COMMAND_READ_DATA_OK: - res = 0; - msg = "command read data ok"; - break; - case COMMAND_READ_BAD_ADDRESS: - res = -EINVAL; - msg = "command read bad address"; - break; - case COMMAND_WRITE_DATA_OK: - res = 0; - msg = "command write data ok"; - break; - case COMMAND_WRITE_BAD_ADDRESS: - res = -EINVAL; - msg = "command write bad address"; - break; - case COMMAND_WRITE_FLASH_FAILURE: - res = -EIO; - msg = "command write flash failure"; - break; - case COMMAND_COMPLETE: - res = 0; - msg = "command complete"; - break; - case COMMAND_FLASH_ERASE_FAILURE: - res = -EIO; - msg = "command flash erase failure"; - break; - case COMMAND_WRITE_BAD_DATA: - res = -EINVAL; - msg = "command write bad data"; - break; - default: - res = -EINVAL; - msg = "unknown error"; - PRINTD (DBG_LOAD|DBG_ERR, "decode_loader_result got %d=%x !", - result, result); - break; - } - - PRINTK (KERN_ERR, "%s", msg); - return res; - } unsigned long timeout; @@ -1930,6 +1933,11 @@ /********** reset card **********/ +static inline void sf (const char * msg) +{ + PRINTK (KERN_ERR, "self-test failed: %s", msg); +} + static int amb_reset (amb_dev * dev, int diags) { u32 word; @@ -1974,9 +1982,6 @@ // XXX double check byte-order word = rd_mem (dev, offsetof(amb_mem, mb.loader.result)); if (word & SELF_TEST_FAILURE) { - void sf (const char * msg) { - PRINTK (KERN_ERR, "self-test failed: %s", msg); - } if (word & GPINT_TST_FAILURE) sf ("interrupt"); if (word & SUNI_DATA_PATTERN_FAILURE) @@ -2044,31 +2049,31 @@ } /********** give adapter parameters **********/ + +static inline u32 bus_addr(void * addr) { + return cpu_to_be32 (virt_to_bus (addr)); +} static int __init amb_talk (amb_dev * dev) { adap_talk_block a; unsigned char pool; unsigned long timeout; - u32 x (void * addr) { - return cpu_to_be32 (virt_to_bus (addr)); - } - PRINTD (DBG_FLOW, "amb_talk %p", dev); - a.command_start = x (dev->cq.ptrs.start); - a.command_end = x (dev->cq.ptrs.limit); - a.tx_start = x (dev->txq.in.start); - a.tx_end = x (dev->txq.in.limit); - a.txcom_start = x (dev->txq.out.start); - a.txcom_end = x (dev->txq.out.limit); + a.command_start = bus_addr (dev->cq.ptrs.start); + a.command_end = bus_addr (dev->cq.ptrs.limit); + a.tx_start = bus_addr (dev->txq.in.start); + a.tx_end = bus_addr (dev->txq.in.limit); + a.txcom_start = bus_addr (dev->txq.out.start); + a.txcom_end = bus_addr (dev->txq.out.limit); for (pool = 0; pool < NUM_RX_POOLS; ++pool) { // the other "a" items are set up by the adapter - a.rec_struct[pool].buffer_start = x (dev->rxq[pool].in.start); - a.rec_struct[pool].buffer_end = x (dev->rxq[pool].in.limit); - a.rec_struct[pool].rx_start = x (dev->rxq[pool].out.start); - a.rec_struct[pool].rx_end = x (dev->rxq[pool].out.limit); + a.rec_struct[pool].buffer_start = bus_addr (dev->rxq[pool].in.start); + a.rec_struct[pool].buffer_end = bus_addr (dev->rxq[pool].in.limit); + a.rec_struct[pool].rx_start = bus_addr (dev->rxq[pool].out.start); + a.rec_struct[pool].rx_end = bus_addr (dev->rxq[pool].out.limit); a.rec_struct[pool].buffer_size = cpu_to_be32 (dev->rxq[pool].buffer_size); } @@ -2111,15 +2116,10 @@ minor = be32_to_cpu (cmd.args.version.minor); PRINTK (KERN_INFO, "microcode version is %u.%u", major, minor); } - -// get end station address -static void __init amb_esi (amb_dev * dev, u8 * esi) { - u32 lower4; - u16 upper2; - command cmd; - // swap bits within byte to get Ethernet ordering - u8 bit_swap (u8 byte) { +// swap bits within byte to get Ethernet ordering +u8 bit_swap (u8 byte) +{ const u8 swap[] = { 0x0, 0x8, 0x4, 0xc, 0x2, 0xa, 0x6, 0xe, @@ -2127,7 +2127,13 @@ 0x3, 0xb, 0x7, 0xf }; return ((swap[byte & 0xf]<<4) | swap[byte>>4]); - } +} + +// get end station address +static void __init amb_esi (amb_dev * dev, u8 * esi) { + u32 lower4; + u16 upper2; + command cmd; cmd.request = cpu_to_be32 (SRB_GET_BIA); while (command_do (dev, &cmd)) { @@ -2155,29 +2161,31 @@ return; } + +static void fixup_plx_window (amb_dev *dev, loader_block *lb) +{ + // fix up the PLX-mapped window base address to match the block + unsigned long blb; + u32 mapreg; + blb = virt_to_bus(lb); + // the kernel stack had better not ever cross a 1Gb boundary! + mapreg = rd_plain (dev, offsetof(amb_mem, stuff[10])); + mapreg &= ~onegigmask; + mapreg |= blb & onegigmask; + wr_plain (dev, offsetof(amb_mem, stuff[10]), mapreg); + return; +} -static int __init amb_init (amb_dev * dev) { +static int __init amb_init (amb_dev * dev) +{ loader_block lb; - void fixup_plx_window (void) { - // fix up the PLX-mapped window base address to match the block - unsigned long blb; - u32 mapreg; - blb = virt_to_bus (&lb); - // the kernel stack had better not ever cross a 1Gb boundary! - mapreg = rd_plain (dev, offsetof(amb_mem, stuff[10])); - mapreg &= ~onegigmask; - mapreg |= blb & onegigmask; - wr_plain (dev, offsetof(amb_mem, stuff[10]), mapreg); - return; - } - u32 version; if (amb_reset (dev, 1)) { PRINTK (KERN_ERR, "card reset failed!"); } else { - fixup_plx_window (); + fixup_plx_window (dev, &lb); if (get_loader_version (&lb, dev, &version)) { PRINTK (KERN_INFO, "failed to get loader version"); @@ -2210,28 +2218,17 @@ return -1; } -static int __init amb_probe (void) { - struct pci_dev * pci_dev; - int devs; - - void __init do_pci_device (void) { - amb_dev * dev; - - // read resources from PCI configuration space - u8 irq = pci_dev->irq; - u32 * membase = bus_to_virt (pci_resource_start (pci_dev, 0)); - u32 iobase = pci_resource_start (pci_dev, 1); - - void setup_dev (void) { +static void setup_dev(amb_dev *dev, struct pci_dev *pci_dev) +{ unsigned char pool; memset (dev, 0, sizeof(amb_dev)); // set up known dev items straight away dev->pci_dev = pci_dev; - dev->iobase = iobase; - dev->irq = irq; - dev->membase = membase; + dev->iobase = pci_resource_start (pci_dev, 1); + dev->irq = pci_dev->irq; + dev->membase = bus_to_virt(pci_resource_start(pci_dev, 0)); // flags (currently only dead) dev->flags = 0; @@ -2258,16 +2255,17 @@ spin_lock_init (&dev->txq.lock); for (pool = 0; pool < NUM_RX_POOLS; ++pool) spin_lock_init (&dev->rxq[pool].lock); - } - - void setup_pci_dev (void) { +} + +static void setup_pci_dev(struct pci_dev *pci_dev) +{ unsigned char lat; /* XXX check return value */ - pci_enable_device (pci_dev); + pci_enable_device(pci_dev); // enable bus master accesses - pci_set_master (pci_dev); + pci_set_master(pci_dev); // frobnicate latency (upwards, usually) pci_read_config_byte (pci_dev, PCI_LATENCY_TIMER, &lat); @@ -2280,79 +2278,92 @@ "increasing", lat, MIN_PCI_LATENCY); pci_write_config_byte (pci_dev, PCI_LATENCY_TIMER, MIN_PCI_LATENCY); } - } - - PRINTD (DBG_INFO, "found Madge ATM adapter (amb) at" - " IO %x, IRQ %u, MEM %p", iobase, irq, membase); - - // check IO region - if (!request_region (iobase, AMB_EXTENT, DEV_LABEL)) { - PRINTK (KERN_ERR, "IO range already in use!"); - return; - } - - dev = kmalloc (sizeof(amb_dev), GFP_KERNEL); - if (!dev) { - // perhaps we should be nice: deregister all adapters and abort? - PRINTK (KERN_ERR, "out of memory!"); - release_region (iobase, AMB_EXTENT); - return; - } - - setup_dev(); - - if (amb_init (dev)) { - PRINTK (KERN_ERR, "adapter initialisation failure"); - } else { - - setup_pci_dev(); - - // grab (but share) IRQ and install handler - if (request_irq (irq, interrupt_handler, SA_SHIRQ, DEV_LABEL, dev)) { - PRINTK (KERN_ERR, "request IRQ failed!"); - // free_irq is at "endif" - } else { - +} + +static int __init do_pci_device(struct pci_dev *pci_dev) +{ + amb_dev * dev; + int err; + + // read resources from PCI configuration space + u8 irq = pci_dev->irq; + u32 * membase = bus_to_virt (pci_resource_start (pci_dev, 0)); + u32 iobase = pci_resource_start (pci_dev, 1); + + PRINTD (DBG_INFO, "found Madge ATM adapter (amb) at" + " IO %x, IRQ %u, MEM %p", iobase, irq, membase); + + // check IO region + if (!request_region (iobase, AMB_EXTENT, DEV_LABEL)) { + PRINTK (KERN_ERR, "IO range already in use!"); + return -EBUSY; + } + + dev = kmalloc (sizeof(amb_dev), GFP_KERNEL); + if (!dev) { + PRINTK (KERN_ERR, "out of memory!"); + err = -ENOMEM; + goto out; + } + + setup_dev(dev, pci_dev); + + if (amb_init (dev)) { + PRINTK (KERN_ERR, "adapter initialisation failure"); + err = -EINVAL; + goto out1; + } + + setup_pci_dev(pci_dev); + + // grab (but share) IRQ and install handler + if (request_irq (irq, interrupt_handler, SA_SHIRQ, DEV_LABEL, dev)) { + PRINTK (KERN_ERR, "request IRQ failed!"); + err = -EBUSY; + goto out2; + } + dev->atm_dev = atm_dev_register (DEV_LABEL, &amb_ops, -1, NULL); if (!dev->atm_dev) { - PRINTD (DBG_ERR, "failed to register Madge ATM adapter"); - } else { - - PRINTD (DBG_INFO, "registered Madge ATM adapter (no. %d) (%p) at %p", - dev->atm_dev->number, dev, dev->atm_dev); - dev->atm_dev->dev_data = (void *) dev; - - // register our address - amb_esi (dev, dev->atm_dev->esi); - - // 0 bits for vpi, 10 bits for vci - dev->atm_dev->ci_range.vpi_bits = NUM_VPI_BITS; - dev->atm_dev->ci_range.vci_bits = NUM_VCI_BITS; - - // update count and linked list - ++devs; - dev->prev = amb_devs; - amb_devs = dev; - - // enable host interrupts - interrupts_on (dev); - - // success - return; - - // not currently reached - atm_dev_deregister (dev->atm_dev); - } /* atm_dev_register */ - + PRINTD (DBG_ERR, "failed to register Madge ATM adapter"); + err = -EINVAL; + goto out3; + } + + PRINTD (DBG_INFO, "registered Madge ATM adapter (no. %d) (%p) at %p", + dev->atm_dev->number, dev, dev->atm_dev); + dev->atm_dev->dev_data = (void *) dev; + + // register our address + amb_esi (dev, dev->atm_dev->esi); + + // 0 bits for vpi, 10 bits for vci + dev->atm_dev->ci_range.vpi_bits = NUM_VPI_BITS; + dev->atm_dev->ci_range.vci_bits = NUM_VCI_BITS; + + // update linked list + dev->prev = amb_devs; + amb_devs = dev; + + // enable host interrupts + interrupts_on (dev); + + return 0; + +out3: free_irq (irq, dev); - } /* request_irq */ - - amb_reset (dev, 0); - } /* amb_init */ - - kfree (dev); - release_region (iobase, AMB_EXTENT); - } /* kmalloc, end-of-fn */ +out2: + amb_reset (dev, 0); +out1: + kfree (dev); +out: + release_region (iobase, AMB_EXTENT); + return err; +} + +static int __init amb_probe (void) { + struct pci_dev * pci_dev; + int devs; PRINTD (DBG_FLOW, "amb_probe"); @@ -2360,8 +2371,11 @@ pci_dev = NULL; while ((pci_dev = pci_find_device (PCI_VENDOR_ID_MADGE, PCI_DEVICE_ID_MADGE_AMBASSADOR, pci_dev) - )) - do_pci_device(); + )) { + if (do_pci_device(pci_dev) == 0) + devs++; + } + pci_dev = NULL; while ((pci_dev = pci_find_device diff -urN linux-2.6.7-rc2/drivers/atm/atmtcp.c linux-2.6.7-rc3/drivers/atm/atmtcp.c --- linux-2.6.7-rc2/drivers/atm/atmtcp.c 2004-05-09 19:32:52.000000000 -0700 +++ linux-2.6.7-rc3/drivers/atm/atmtcp.c 2004-06-07 12:55:02.145586723 -0700 @@ -152,7 +152,7 @@ } -static int atmtcp_v_ioctl(struct atm_dev *dev,unsigned int cmd,void *arg) +static int atmtcp_v_ioctl(struct atm_dev *dev,unsigned int cmd,void __user *arg) { struct atm_cirange ci; struct atm_vcc *vcc; @@ -161,7 +161,7 @@ int i; if (cmd != ATM_SETCIRANGE) return -ENOIOCTLCMD; - if (copy_from_user(&ci,(void *) arg,sizeof(ci))) return -EFAULT; + if (copy_from_user(&ci, arg,sizeof(ci))) return -EFAULT; if (ci.vpi_bits == ATM_CI_MAX) ci.vpi_bits = MAX_VPI_BITS; if (ci.vci_bits == ATM_CI_MAX) ci.vci_bits = MAX_VCI_BITS; if (ci.vpi_bits > MAX_VPI_BITS || ci.vpi_bits < 0 || diff -urN linux-2.6.7-rc2/drivers/atm/eni.c linux-2.6.7-rc3/drivers/atm/eni.c --- linux-2.6.7-rc2/drivers/atm/eni.c 2004-05-09 19:32:25.000000000 -0700 +++ linux-2.6.7-rc3/drivers/atm/eni.c 2004-06-07 12:55:02.480600598 -0700 @@ -1968,7 +1968,7 @@ } -static int eni_ioctl(struct atm_dev *dev,unsigned int cmd,void *arg) +static int eni_ioctl(struct atm_dev *dev,unsigned int cmd,void __user *arg) { struct eni_dev *eni_dev = ENI_DEV(dev); @@ -1983,7 +1983,7 @@ struct eni_multipliers mult; if (!capable(CAP_NET_ADMIN)) return -EPERM; - if (copy_from_user(&mult,(void *) arg, + if (copy_from_user(&mult, arg, sizeof(struct eni_multipliers))) return -EFAULT; if ((mult.tx && mult.tx <= 100) || (mult.rx &&mult.rx <= 100) || @@ -1996,7 +1996,7 @@ if (cmd == ATM_SETCIRANGE) { struct atm_cirange ci; - if (copy_from_user(&ci,(void *) arg,sizeof(struct atm_cirange))) + if (copy_from_user(&ci, arg,sizeof(struct atm_cirange))) return -EFAULT; if ((ci.vpi_bits == 0 || ci.vpi_bits == ATM_CI_MAX) && (ci.vci_bits == NR_VCI_LD || ci.vpi_bits == ATM_CI_MAX)) @@ -2009,14 +2009,14 @@ static int eni_getsockopt(struct atm_vcc *vcc,int level,int optname, - void *optval,int optlen) + void __user *optval,int optlen) { return -EINVAL; } static int eni_setsockopt(struct atm_vcc *vcc,int level,int optname, - void *optval,int optlen) + void __user *optval,int optlen) { return -EINVAL; } diff -urN linux-2.6.7-rc2/drivers/atm/firestream.c linux-2.6.7-rc3/drivers/atm/firestream.c --- linux-2.6.7-rc2/drivers/atm/firestream.c 2004-05-09 19:32:01.000000000 -0700 +++ linux-2.6.7-rc3/drivers/atm/firestream.c 2004-06-07 12:55:02.558603829 -0700 @@ -1220,7 +1220,7 @@ /* Some function placeholders for functions we don't yet support. */ #if 0 -static int fs_ioctl(struct atm_dev *dev,unsigned int cmd,void *arg) +static int fs_ioctl(struct atm_dev *dev,unsigned int cmd,void __user *arg) { func_enter (); func_exit (); @@ -1229,7 +1229,7 @@ static int fs_getsockopt(struct atm_vcc *vcc,int level,int optname, - void *optval,int optlen) + void __user *optval,int optlen) { func_enter (); func_exit (); @@ -1238,7 +1238,7 @@ static int fs_setsockopt(struct atm_vcc *vcc,int level,int optname, - void *optval,int optlen) + void __user *optval,int optlen) { func_enter (); func_exit (); diff -urN linux-2.6.7-rc2/drivers/atm/fore200e.c linux-2.6.7-rc3/drivers/atm/fore200e.c --- linux-2.6.7-rc2/drivers/atm/fore200e.c 2004-06-07 12:54:48.847035945 -0700 +++ linux-2.6.7-rc3/drivers/atm/fore200e.c 2004-06-07 12:55:02.665608260 -0700 @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -682,7 +683,7 @@ opcode.opcode = OPCODE_GET_PROM; opcode.pad = 0; - prom_dma = fore200e->bus->dma_map(fore200e, prom, sizeof(struct prom_data), FORE200E_DMA_FROMDEVICE); + prom_dma = fore200e->bus->dma_map(fore200e, prom, sizeof(struct prom_data), DMA_FROM_DEVICE); fore200e->bus->write(prom_dma, &entry->cp_entry->cmd.prom_block.prom_haddr); @@ -694,7 +695,7 @@ *entry->status = STATUS_FREE; - fore200e->bus->dma_unmap(fore200e, prom_dma, sizeof(struct prom_data), FORE200E_DMA_FROMDEVICE); + fore200e->bus->dma_unmap(fore200e, prom_dma, sizeof(struct prom_data), DMA_FROM_DEVICE); if (ok == 0) { printk(FORE200E "unable to get PROM data from device %s\n", fore200e->name); @@ -1003,7 +1004,7 @@ /* remove DMA mapping */ fore200e->bus->dma_unmap(fore200e, entry->tpd->tsd[ 0 ].buffer, entry->tpd->tsd[ 0 ].length, - FORE200E_DMA_TODEVICE); + DMA_TO_DEVICE); vc_map = entry->vc_map; @@ -1228,12 +1229,12 @@ buffer = FORE200E_HDL2BUF(rpd->rsd[ i ].handle); /* Make device DMA transfer visible to CPU. */ - fore200e->bus->dma_sync_for_cpu(fore200e, buffer->data.dma_addr, rpd->rsd[ i ].length, FORE200E_DMA_FROMDEVICE); + fore200e->bus->dma_sync_for_cpu(fore200e, buffer->data.dma_addr, rpd->rsd[ i ].length, DMA_FROM_DEVICE); memcpy(skb_put(skb, rpd->rsd[ i ].length), buffer->data.align_addr, rpd->rsd[ i ].length); /* Now let the device get at it again. */ - fore200e->bus->dma_sync_for_device(fore200e, buffer->data.dma_addr, rpd->rsd[ i ].length, FORE200E_DMA_FROMDEVICE); + fore200e->bus->dma_sync_for_device(fore200e, buffer->data.dma_addr, rpd->rsd[ i ].length, DMA_FROM_DEVICE); } DPRINTK(3, "rx skb: len = %d, truesize = %d\n", skb->len, skb->truesize); @@ -1807,7 +1808,7 @@ entry->data = tx_copy ? data : NULL; tpd = entry->tpd; - tpd->tsd[ 0 ].buffer = fore200e->bus->dma_map(fore200e, data, tx_len, FORE200E_DMA_TODEVICE); + tpd->tsd[ 0 ].buffer = fore200e->bus->dma_map(fore200e, data, tx_len, DMA_TO_DEVICE); tpd->tsd[ 0 ].length = tx_len; FORE200E_NEXT_ENTRY(txq->head, QUEUE_SIZE_TX); @@ -1881,7 +1882,7 @@ } stats_dma_addr = fore200e->bus->dma_map(fore200e, fore200e->stats, - sizeof(struct stats), FORE200E_DMA_FROMDEVICE); + sizeof(struct stats), DMA_FROM_DEVICE); FORE200E_NEXT_ENTRY(cmdq->head, QUEUE_SIZE_CMD); @@ -1898,7 +1899,7 @@ *entry->status = STATUS_FREE; - fore200e->bus->dma_unmap(fore200e, stats_dma_addr, sizeof(struct stats), FORE200E_DMA_FROMDEVICE); + fore200e->bus->dma_unmap(fore200e, stats_dma_addr, sizeof(struct stats), DMA_FROM_DEVICE); if (ok == 0) { printk(FORE200E "unable to get statistics from device %s\n", fore200e->name); @@ -1910,7 +1911,7 @@ static int -fore200e_getsockopt(struct atm_vcc* vcc, int level, int optname, void* optval, int optlen) +fore200e_getsockopt(struct atm_vcc* vcc, int level, int optname, void __user *optval, int optlen) { /* struct fore200e* fore200e = FORE200E_DEV(vcc->dev); */ @@ -1922,7 +1923,7 @@ static int -fore200e_setsockopt(struct atm_vcc* vcc, int level, int optname, void* optval, int optlen) +fore200e_setsockopt(struct atm_vcc* vcc, int level, int optname, void __user *optval, int optlen) { /* struct fore200e* fore200e = FORE200E_DEV(vcc->dev); */ @@ -1943,7 +1944,7 @@ int ok; u32 oc3_regs_dma_addr; - oc3_regs_dma_addr = fore200e->bus->dma_map(fore200e, regs, sizeof(struct oc3_regs), FORE200E_DMA_FROMDEVICE); + oc3_regs_dma_addr = fore200e->bus->dma_map(fore200e, regs, sizeof(struct oc3_regs), DMA_FROM_DEVICE); FORE200E_NEXT_ENTRY(cmdq->head, QUEUE_SIZE_CMD); @@ -1962,7 +1963,7 @@ *entry->status = STATUS_FREE; - fore200e->bus->dma_unmap(fore200e, oc3_regs_dma_addr, sizeof(struct oc3_regs), FORE200E_DMA_FROMDEVICE); + fore200e->bus->dma_unmap(fore200e, oc3_regs_dma_addr, sizeof(struct oc3_regs), DMA_FROM_DEVICE); if (ok == 0) { printk(FORE200E "unable to get OC-3 regs of device %s\n", fore200e->name); @@ -2058,7 +2059,7 @@ static int -fore200e_fetch_stats(struct fore200e* fore200e, struct sonet_stats* arg) +fore200e_fetch_stats(struct fore200e* fore200e, struct sonet_stats __user *arg) { struct sonet_stats tmp; @@ -2087,7 +2088,7 @@ static int -fore200e_ioctl(struct atm_dev* dev, unsigned int cmd, void* arg) +fore200e_ioctl(struct atm_dev* dev, unsigned int cmd, void __user * arg) { struct fore200e* fore200e = FORE200E_DEV(dev); @@ -2096,19 +2097,19 @@ switch (cmd) { case SONET_GETSTAT: - return fore200e_fetch_stats(fore200e, (struct sonet_stats*)arg); + return fore200e_fetch_stats(fore200e, (struct sonet_stats __user *)arg); case SONET_GETDIAG: - return put_user(0, (int*)arg) ? -EFAULT : 0; + return put_user(0, (int __user *)arg) ? -EFAULT : 0; case ATM_SETLOOP: return fore200e_setloop(fore200e, (int)(unsigned long)arg); case ATM_GETLOOP: - return put_user(fore200e->loop_mode, (int*)arg) ? -EFAULT : 0; + return put_user(fore200e->loop_mode, (int __user *)arg) ? -EFAULT : 0; case ATM_QUERYLOOP: - return put_user(ATM_LM_LOC_PHY | ATM_LM_RMT_PHY, (int*)arg) ? -EFAULT : 0; + return put_user(ATM_LM_LOC_PHY | ATM_LM_RMT_PHY, (int __user *)arg) ? -EFAULT : 0; } return -ENOSYS; /* not implemented */ @@ -2257,7 +2258,7 @@ /* allocate the receive buffer body */ if (fore200e_chunk_alloc(fore200e, &buffer[ i ].data, size, fore200e->bus->buffer_alignment, - FORE200E_DMA_FROMDEVICE) < 0) { + DMA_FROM_DEVICE) < 0) { while (i > 0) fore200e_chunk_free(fore200e, &buffer[ --i ].data); diff -urN linux-2.6.7-rc2/drivers/atm/fore200e.h linux-2.6.7-rc3/drivers/atm/fore200e.h --- linux-2.6.7-rc2/drivers/atm/fore200e.h 2004-05-09 19:32:37.000000000 -0700 +++ linux-2.6.7-rc3/drivers/atm/fore200e.h 2004-06-07 12:55:02.712610207 -0700 @@ -556,7 +556,7 @@ typedef struct host_cmdq_entry { struct cp_cmdq_entry* cp_entry; /* addr of cp resident cmd queue entry */ - enum status* status; /* addr of host resident status */ + enum status *status; /* addr of host resident status */ } host_cmdq_entry_t; @@ -668,7 +668,7 @@ typedef struct init_block { enum opcode opcode; /* initialize command */ - enum status status; /* related status word */ + enum status status; /* related status word */ u32 receive_threshold; /* not used */ u32 num_connect; /* ATM connections */ u32 cmd_queue_len; /* length of command queue */ @@ -827,36 +827,6 @@ int (*proc_read)(struct fore200e*, char*); } fore200e_bus_t; - -#if defined(CONFIG_ATM_FORE200E_SBA) -# if defined(CONFIG_ATM_FORE200E_PCA) -# if (PCI_DMA_BIDIRECTIONAL == SBUS_DMA_BIDIRECTIONAL) && \ - (PCI_DMA_TODEVICE == SBUS_DMA_TODEVICE) && \ - (PCI_DMA_FROMDEVICE == SBUS_DMA_FROMDEVICE) -# define FORE200E_DMA_BIDIRECTIONAL PCI_DMA_BIDIRECTIONAL -# define FORE200E_DMA_TODEVICE PCI_DMA_TODEVICE -# define FORE200E_DMA_FROMDEVICE PCI_DMA_FROMDEVICE -# else - /* in that case, we'll need to add an extra indirection, e.g. - fore200e->bus->dma_direction[ fore200e_dma_direction ] */ -# error PCI and SBUS DMA direction flags have different values! -# endif -# else -# define FORE200E_DMA_BIDIRECTIONAL SBUS_DMA_BIDIRECTIONAL -# define FORE200E_DMA_TODEVICE SBUS_DMA_TODEVICE -# define FORE200E_DMA_FROMDEVICE SBUS_DMA_FROMDEVICE -# endif -#else -# ifndef CONFIG_ATM_FORE200E_PCA -# warning compiling the fore200e driver without any hardware support enabled! -# include -# endif -# define FORE200E_DMA_BIDIRECTIONAL PCI_DMA_BIDIRECTIONAL -# define FORE200E_DMA_TODEVICE PCI_DMA_TODEVICE -# define FORE200E_DMA_FROMDEVICE PCI_DMA_FROMDEVICE -#endif - - /* vc mapping */ typedef struct fore200e_vc_map { diff -urN linux-2.6.7-rc2/drivers/atm/he.c linux-2.6.7-rc3/drivers/atm/he.c --- linux-2.6.7-rc2/drivers/atm/he.c 2004-05-09 19:32:01.000000000 -0700 +++ linux-2.6.7-rc3/drivers/atm/he.c 2004-06-07 12:55:02.715610331 -0700 @@ -134,7 +134,7 @@ static int he_open(struct atm_vcc *vcc); static void he_close(struct atm_vcc *vcc); static int he_send(struct atm_vcc *vcc, struct sk_buff *skb); -static int he_ioctl(struct atm_dev *dev, unsigned int cmd, void *arg); +static int he_ioctl(struct atm_dev *dev, unsigned int cmd, void __user *arg); static irqreturn_t he_irq_handler(int irq, void *dev_id, struct pt_regs *regs); static void he_tasklet(unsigned long data); static int he_proc_read(struct atm_dev *dev,loff_t *pos,char *page); @@ -2809,7 +2809,7 @@ } static int -he_ioctl(struct atm_dev *atm_dev, unsigned int cmd, void *arg) +he_ioctl(struct atm_dev *atm_dev, unsigned int cmd, void __user *arg) { unsigned long flags; struct he_dev *he_dev = HE_DEV(atm_dev); @@ -2821,8 +2821,8 @@ if (!capable(CAP_NET_ADMIN)) return -EPERM; - if (copy_from_user(®, (struct he_ioctl_reg *) arg, - sizeof(struct he_ioctl_reg))) + if (copy_from_user(®, arg, + sizeof(struct he_ioctl_reg))) return -EFAULT; spin_lock_irqsave(&he_dev->global_lock, flags); @@ -2848,7 +2848,7 @@ } spin_unlock_irqrestore(&he_dev->global_lock, flags); if (err == 0) - if (copy_to_user((struct he_ioctl_reg *) arg, ®, + if (copy_to_user(arg, ®, sizeof(struct he_ioctl_reg))) return -EFAULT; break; diff -urN linux-2.6.7-rc2/drivers/atm/horizon.c linux-2.6.7-rc3/drivers/atm/horizon.c --- linux-2.6.7-rc2/drivers/atm/horizon.c 2004-05-09 19:31:57.000000000 -0700 +++ linux-2.6.7-rc3/drivers/atm/horizon.c 2004-06-07 12:55:02.779612982 -0700 @@ -597,126 +597,112 @@ // p ranges from 1 to a power of 2 #define CR_MAXPEXP 4 - + static int make_rate (const hrz_dev * dev, u32 c, rounding r, - u16 * bits, unsigned int * actual) { - - // note: rounding the rate down means rounding 'p' up - - const unsigned long br = test_bit(ultra, &dev->flags) ? BR_ULT : BR_HRZ; - - u32 div = CR_MIND; - u32 pre; - - // local fn to build the timer bits - int set_cr (void) { - // paranoia - if (div > CR_MAXD || (!pre) || pre > 1<flags) ? BR_ULT : BR_HRZ; - // br_exp and br_man are used to avoid overflowing (c*maxp*2^d) in - // the tests below. We could think harder about exact possibilities - // of failure... - - unsigned long br_man = br; - unsigned int br_exp = 0; - - PRINTD (DBG_QOS|DBG_FLOW, "make_rate b=%lu, c=%u, %s", br, c, - (r == round_up) ? "up" : (r == round_down) ? "down" : "nearest"); - - // avoid div by zero - if (!c) { - PRINTD (DBG_QOS|DBG_ERR, "zero rate is not allowed!"); - return -EINVAL; - } + u32 div = CR_MIND; + u32 pre; - while (br_exp < CR_MAXPEXP + CR_MIND && (br_man % 2 == 0)) { - br_man = br_man >> 1; - ++br_exp; - } - // (br >>br_exp) <> 1; + ++br_exp; + } + // (br >>br_exp) < CR_MAXD || (!pre) || pre > 1<> 1; - CLOCK_IT(); + CLOCK_IT(dev, ctrl); if (rd_regl (dev, CONTROL_0_REG) & SEEPROM_DO) res |= (1 << (data_bits-1)); } ctrl &= ~(SEEPROM_SK | SEEPROM_CS); - WRITE_IT_WAIT(); + WRITE_IT_WAIT(dev, ctrl); return res; } diff -urN linux-2.6.7-rc2/drivers/atm/idt77105.c linux-2.6.7-rc3/drivers/atm/idt77105.c --- linux-2.6.7-rc2/drivers/atm/idt77105.c 2004-05-09 19:32:39.000000000 -0700 +++ linux-2.6.7-rc3/drivers/atm/idt77105.c 2004-06-07 12:55:02.779612982 -0700 @@ -141,7 +141,7 @@ } -static int fetch_stats(struct atm_dev *dev,struct idt77105_stats *arg,int zero) +static int fetch_stats(struct atm_dev *dev,struct idt77105_stats __user *arg,int zero) { unsigned long flags; struct idt77105_stats stats; @@ -188,7 +188,7 @@ } -static int idt77105_ioctl(struct atm_dev *dev,unsigned int cmd,void *arg) +static int idt77105_ioctl(struct atm_dev *dev,unsigned int cmd,void __user *arg) { printk(KERN_NOTICE "%s(%d) idt77105_ioctl() called\n",dev->type,dev->number); switch (cmd) { @@ -196,16 +196,15 @@ if (!capable(CAP_NET_ADMIN)) return -EPERM; /* fall through */ case IDT77105_GETSTAT: - return fetch_stats(dev,(struct idt77105_stats *) arg, - cmd == IDT77105_GETSTATZ); + return fetch_stats(dev, arg, cmd == IDT77105_GETSTATZ); case ATM_SETLOOP: return set_loopback(dev,(int) (long) arg); case ATM_GETLOOP: - return put_user(PRIV(dev)->loop_mode,(int *) arg) ? + return put_user(PRIV(dev)->loop_mode,(int __user *)arg) ? -EFAULT : 0; case ATM_QUERYLOOP: return put_user(ATM_LM_LOC_ATM | ATM_LM_RMT_ATM, - (int *) arg) ? -EFAULT : 0; + (int __user *) arg) ? -EFAULT : 0; default: return -ENOIOCTLCMD; } diff -urN linux-2.6.7-rc2/drivers/atm/iphase.c linux-2.6.7-rc3/drivers/atm/iphase.c --- linux-2.6.7-rc2/drivers/atm/iphase.c 2004-05-09 19:33:20.000000000 -0700 +++ linux-2.6.7-rc3/drivers/atm/iphase.c 2004-06-07 12:55:02.858616254 -0700 @@ -2738,12 +2738,12 @@ return 0; } -static int ia_ioctl(struct atm_dev *dev, unsigned int cmd, void *arg) +static int ia_ioctl(struct atm_dev *dev, unsigned int cmd, void __user *arg) { IA_CMDBUF ia_cmds; IADEV *iadev; int i, board; - u16 *tmps; + u16 __user *tmps; IF_EVENT(printk(">ia_ioctl\n");) if (cmd != IA_CMD) { if (!dev->phy->ioctl) return -EINVAL; @@ -2766,7 +2766,7 @@ break; case MEMDUMP_SEGREG: if (!capable(CAP_NET_ADMIN)) return -EPERM; - tmps = (u16 *)ia_cmds.buf; + tmps = (u16 __user *)ia_cmds.buf; for(i=0; i<0x80; i+=2, tmps++) if(put_user((u16)(readl(iadev->seg_reg+i) & 0xffff), tmps)) return -EFAULT; ia_cmds.status = 0; @@ -2774,7 +2774,7 @@ break; case MEMDUMP_REASSREG: if (!capable(CAP_NET_ADMIN)) return -EPERM; - tmps = (u16 *)ia_cmds.buf; + tmps = (u16 __user *)ia_cmds.buf; for(i=0; i<0x80; i+=2, tmps++) if(put_user((u16)(readl(iadev->reass_reg+i) & 0xffff), tmps)) return -EFAULT; ia_cmds.status = 0; @@ -2874,14 +2874,14 @@ } static int ia_getsockopt(struct atm_vcc *vcc, int level, int optname, - void *optval, int optlen) + void __user *optval, int optlen) { IF_EVENT(printk(">ia_getsockopt\n");) return -EINVAL; } static int ia_setsockopt(struct atm_vcc *vcc, int level, int optname, - void *optval, int optlen) + void __user *optval, int optlen) { IF_EVENT(printk(">ia_setsockopt\n");) return -EINVAL; diff -urN linux-2.6.7-rc2/drivers/atm/iphase.h linux-2.6.7-rc3/drivers/atm/iphase.h --- linux-2.6.7-rc2/drivers/atm/iphase.h 2004-05-09 19:32:23.000000000 -0700 +++ linux-2.6.7-rc3/drivers/atm/iphase.h 2004-06-07 12:55:02.861616379 -0700 @@ -141,7 +141,7 @@ int len; u32 maddr; int status; - void *buf; + void __user *buf; } IA_CMDBUF, *PIA_CMDBUF; /* cmds */ diff -urN linux-2.6.7-rc2/drivers/atm/lanai.c linux-2.6.7-rc3/drivers/atm/lanai.c --- linux-2.6.7-rc2/drivers/atm/lanai.c 2004-05-09 19:32:26.000000000 -0700 +++ linux-2.6.7-rc3/drivers/atm/lanai.c 2004-06-07 12:55:02.916618657 -0700 @@ -2435,7 +2435,7 @@ #if 0 /* ioctl operations for card */ /* NOTE: these are all DEBUGGING ONLY currently */ -static int lanai_ioctl(struct atm_dev *atmdev, unsigned int cmd, void *arg) +static int lanai_ioctl(struct atm_dev *atmdev, unsigned int cmd, void __user *arg) { int result = 0; struct lanai_dev *lanai = (struct lanai_dev *) atmdev->dev_data; diff -urN linux-2.6.7-rc2/drivers/atm/nicstar.c linux-2.6.7-rc3/drivers/atm/nicstar.c --- linux-2.6.7-rc2/drivers/atm/nicstar.c 2004-05-09 19:32:24.000000000 -0700 +++ linux-2.6.7-rc3/drivers/atm/nicstar.c 2004-06-07 12:55:02.919618781 -0700 @@ -239,7 +239,7 @@ static void dequeue_sm_buf(ns_dev *card, struct sk_buff *sb); static void dequeue_lg_buf(ns_dev *card, struct sk_buff *lb); static int ns_proc_read(struct atm_dev *dev, loff_t *pos, char *page); -static int ns_ioctl(struct atm_dev *dev, unsigned int cmd, void *arg); +static int ns_ioctl(struct atm_dev *dev, unsigned int cmd, void __user *arg); static void which_list(ns_dev *card, struct sk_buff *skb); static void ns_poll(unsigned long arg); static int ns_parse_mac(char *mac, unsigned char *esi); @@ -2765,7 +2765,7 @@ -static int ns_ioctl(struct atm_dev *dev, unsigned int cmd, void *arg) +static int ns_ioctl(struct atm_dev *dev, unsigned int cmd, void __user *arg) { ns_dev *card; pool_levels pl; @@ -2776,7 +2776,7 @@ switch (cmd) { case NS_GETPSTAT: - if (get_user(pl.buftype, &((pool_levels *) arg)->buftype)) + if (get_user(pl.buftype, &((pool_levels __user *) arg)->buftype)) return -EFAULT; switch (pl.buftype) { @@ -2812,7 +2812,7 @@ return -ENOIOCTLCMD; } - if (!copy_to_user((pool_levels *) arg, &pl, sizeof(pl))) + if (!copy_to_user((pool_levels __user *) arg, &pl, sizeof(pl))) return (sizeof(pl)); else return -EFAULT; @@ -2820,7 +2820,7 @@ case NS_SETBUFLEV: if (!capable(CAP_NET_ADMIN)) return -EPERM; - if (copy_from_user(&pl, (pool_levels *) arg, sizeof(pl))) + if (copy_from_user(&pl, (pool_levels __user *) arg, sizeof(pl))) return -EFAULT; if (pl.level.min >= pl.level.init || pl.level.init >= pl.level.max) return -EINVAL; diff -urN linux-2.6.7-rc2/drivers/atm/suni.c linux-2.6.7-rc3/drivers/atm/suni.c --- linux-2.6.7-rc2/drivers/atm/suni.c 2004-05-09 19:33:13.000000000 -0700 +++ linux-2.6.7-rc3/drivers/atm/suni.c 2004-06-07 12:55:02.921618864 -0700 @@ -95,7 +95,7 @@ #undef ADD_LIMITED -static int fetch_stats(struct atm_dev *dev,struct sonet_stats *arg,int zero) +static int fetch_stats(struct atm_dev *dev,struct sonet_stats __user *arg,int zero) { struct sonet_stats tmp; int error = 0; @@ -115,11 +115,11 @@ } -static int change_diag(struct atm_dev *dev,void *arg,int set) +static int change_diag(struct atm_dev *dev,void __user *arg,int set) { int todo; - if (get_user(todo,(int *) arg)) return -EFAULT; + if (get_user(todo,(int __user *)arg)) return -EFAULT; HANDLE_FLAG(SONET_INS_SBIP,TSOP_DIAG,SUNI_TSOP_DIAG_DBIP8); HANDLE_FLAG(SONET_INS_LBIP,TLOP_DIAG,SUNI_TLOP_DIAG_DBIP); HANDLE_FLAG(SONET_INS_PBIP,TPOP_CD,SUNI_TPOP_DIAG_DB3); @@ -128,14 +128,14 @@ HANDLE_FLAG(SONET_INS_PAIS,TPOP_CD,SUNI_TPOP_DIAG_PAIS); HANDLE_FLAG(SONET_INS_LOS,TSOP_DIAG,SUNI_TSOP_DIAG_DLOS); HANDLE_FLAG(SONET_INS_HCS,TACP_CS,SUNI_TACP_CS_DHCS); - return put_user(todo,(int *) arg) ? -EFAULT : 0; + return put_user(todo,(int __user *)arg) ? -EFAULT : 0; } #undef HANDLE_FLAG -static int get_diag(struct atm_dev *dev,void *arg) +static int get_diag(struct atm_dev *dev,void __user *arg) { int set; @@ -148,7 +148,7 @@ if (GET(TPOP_CD) & SUNI_TPOP_DIAG_PAIS) set |= SONET_INS_PAIS; if (GET(TSOP_DIAG) & SUNI_TSOP_DIAG_DLOS) set |= SONET_INS_LOS; if (GET(TACP_CS) & SUNI_TACP_CS_DHCS) set |= SONET_INS_HCS; - return put_user(set,(int *) arg) ? -EFAULT : 0; + return put_user(set,(int __user *)arg) ? -EFAULT : 0; } @@ -175,13 +175,12 @@ } -static int suni_ioctl(struct atm_dev *dev,unsigned int cmd,void *arg) +static int suni_ioctl(struct atm_dev *dev,unsigned int cmd,void __user *arg) { switch (cmd) { case SONET_GETSTATZ: case SONET_GETSTAT: - return fetch_stats(dev,(struct sonet_stats *) arg, - cmd == SONET_GETSTATZ); + return fetch_stats(dev, arg, cmd == SONET_GETSTATZ); case SONET_SETDIAG: return change_diag(dev,arg,1); case SONET_CLRDIAG: @@ -192,18 +191,18 @@ if (arg != SONET_FRAME_SONET) return -EINVAL; return 0; case SONET_GETFRAMING: - return put_user(SONET_FRAME_SONET,(int *) arg) ? + return put_user(SONET_FRAME_SONET,(int __user *)arg) ? -EFAULT : 0; case SONET_GETFRSENSE: return -EINVAL; case ATM_SETLOOP: return set_loopback(dev,(int) (long) arg); case ATM_GETLOOP: - return put_user(PRIV(dev)->loop_mode,(int *) arg) ? + return put_user(PRIV(dev)->loop_mode,(int __user *)arg) ? -EFAULT : 0; case ATM_QUERYLOOP: return put_user(ATM_LM_LOC_PHY | ATM_LM_RMT_PHY, - (int *) arg) ? -EFAULT : 0; + (int __user *) arg) ? -EFAULT : 0; default: return -ENOIOCTLCMD; } diff -urN linux-2.6.7-rc2/drivers/atm/uPD98402.c linux-2.6.7-rc3/drivers/atm/uPD98402.c --- linux-2.6.7-rc2/drivers/atm/uPD98402.c 2004-05-09 19:32:28.000000000 -0700 +++ linux-2.6.7-rc3/drivers/atm/uPD98402.c 2004-06-07 12:55:02.922618905 -0700 @@ -37,7 +37,7 @@ #define GET(reg) dev->ops->phy_get(dev,uPD98402_##reg) -static int fetch_stats(struct atm_dev *dev,struct sonet_stats *arg,int zero) +static int fetch_stats(struct atm_dev *dev,struct sonet_stats __user *arg,int zero) { struct sonet_stats tmp; int error = 0; @@ -83,7 +83,7 @@ } -static int get_sense(struct atm_dev *dev,u8 *arg) +static int get_sense(struct atm_dev *dev,u8 __user *arg) { unsigned long flags; unsigned char s[3]; @@ -132,29 +132,28 @@ } -static int uPD98402_ioctl(struct atm_dev *dev,unsigned int cmd,void *arg) +static int uPD98402_ioctl(struct atm_dev *dev,unsigned int cmd,void __user *arg) { switch (cmd) { case SONET_GETSTATZ: case SONET_GETSTAT: - return fetch_stats(dev,(struct sonet_stats *) arg, - cmd == SONET_GETSTATZ); + return fetch_stats(dev,arg, cmd == SONET_GETSTATZ); case SONET_SETFRAMING: return set_framing(dev,(int) (long) arg); case SONET_GETFRAMING: - return put_user(PRIV(dev)->framing,(int *) arg) ? + return put_user(PRIV(dev)->framing,(int __user *)arg) ? -EFAULT : 0; case SONET_GETFRSENSE: return get_sense(dev,arg); case ATM_SETLOOP: return set_loopback(dev,(int) (long) arg); case ATM_GETLOOP: - return put_user(PRIV(dev)->loop_mode,(int *) arg) ? + return put_user(PRIV(dev)->loop_mode,(int __user *)arg) ? -EFAULT : 0; case ATM_QUERYLOOP: return put_user(ATM_LM_LOC_PHY | ATM_LM_LOC_ATM | - ATM_LM_RMT_PHY,(int *) arg) ? -EFAULT : 0; + ATM_LM_RMT_PHY,(int __user *)arg) ? -EFAULT : 0; default: return -ENOIOCTLCMD; } diff -urN linux-2.6.7-rc2/drivers/atm/zatm.c linux-2.6.7-rc3/drivers/atm/zatm.c --- linux-2.6.7-rc2/drivers/atm/zatm.c 2004-05-09 19:32:26.000000000 -0700 +++ linux-2.6.7-rc3/drivers/atm/zatm.c 2004-06-07 12:55:02.923618947 -0700 @@ -1429,7 +1429,7 @@ } -static int zatm_ioctl(struct atm_dev *dev,unsigned int cmd,void *arg) +static int zatm_ioctl(struct atm_dev *dev,unsigned int cmd,void __user *arg) { struct zatm_dev *zatm_dev; unsigned long flags; @@ -1445,7 +1445,7 @@ int pool; if (get_user(pool, - &((struct zatm_pool_req *) arg)->pool_num)) + &((struct zatm_pool_req __user *) arg)->pool_num)) return -EFAULT; if (pool < 0 || pool > ZATM_LAST_POOL) return -EINVAL; @@ -1457,7 +1457,7 @@ } spin_unlock_irqrestore(&zatm_dev->lock, flags); return copy_to_user( - &((struct zatm_pool_req *) arg)->info, + &((struct zatm_pool_req __user *) arg)->info, &info,sizeof(info)) ? -EFAULT : 0; } case ZATM_SETPOOL: @@ -1467,12 +1467,12 @@ if (!capable(CAP_NET_ADMIN)) return -EPERM; if (get_user(pool, - &((struct zatm_pool_req *) arg)->pool_num)) + &((struct zatm_pool_req __user *) arg)->pool_num)) return -EFAULT; if (pool < 0 || pool > ZATM_LAST_POOL) return -EINVAL; if (copy_from_user(&info, - &((struct zatm_pool_req *) arg)->info, + &((struct zatm_pool_req __user *) arg)->info, sizeof(info))) return -EFAULT; if (!info.low_water) info.low_water = zatm_dev-> @@ -1504,14 +1504,14 @@ static int zatm_getsockopt(struct atm_vcc *vcc,int level,int optname, - void *optval,int optlen) + void __user *optval,int optlen) { return -EINVAL; } static int zatm_setsockopt(struct atm_vcc *vcc,int level,int optname, - void *optval,int optlen) + void __user *optval,int optlen) { return -EINVAL; } diff -urN linux-2.6.7-rc2/drivers/base/node.c linux-2.6.7-rc3/drivers/base/node.c --- linux-2.6.7-rc2/drivers/base/node.c 2004-06-07 12:54:48.849036027 -0700 +++ linux-2.6.7-rc3/drivers/base/node.c 2004-06-07 12:55:02.925619029 -0700 @@ -21,9 +21,10 @@ cpumask_t mask = node_dev->cpumap; int len; - /* FIXME - someone should pass us a buffer size (count) or - * use seq_file or something to avoid buffer overrun risk. */ - len = cpumask_scnprintf(buf, 99 /* XXX FIXME */, mask); + /* 2004/06/03: buf currently PAGE_SIZE, need > 1 char per 4 bits. */ + BUILD_BUG_ON(NR_CPUS/4 > PAGE_SIZE/2); + + len = cpumask_scnprintf(buf, PAGE_SIZE-1, mask); len += sprintf(buf + len, "\n"); return len; } diff -urN linux-2.6.7-rc2/drivers/block/DAC960.c linux-2.6.7-rc3/drivers/block/DAC960.c --- linux-2.6.7-rc2/drivers/block/DAC960.c 2004-05-09 19:33:10.000000000 -0700 +++ linux-2.6.7-rc3/drivers/block/DAC960.c 2004-06-07 12:55:03.174629343 -0700 @@ -97,7 +97,8 @@ struct gendisk *disk = inode->i_bdev->bd_disk; DAC960_Controller_T *p = disk->queue->queuedata; int drive_nr = (long)disk->private_data; - struct hd_geometry g, *loc = (struct hd_geometry *)arg; + struct hd_geometry g; + struct hd_geometry __user *loc = (struct hd_geometry __user *)arg; if (cmd != HDIO_GETGEO || !loc) return -EINVAL; @@ -6455,7 +6456,8 @@ DAC960_ProcWriteUserCommand implements writing /proc/rd/cN/user_command. */ -static int DAC960_ProcWriteUserCommand(struct file *file, const char *Buffer, +static int DAC960_ProcWriteUserCommand(struct file *file, + const char __user *Buffer, unsigned long Count, void *Data) { DAC960_Controller_T *Controller = (DAC960_Controller_T *) Data; @@ -6543,8 +6545,8 @@ return DAC960_ControllerCount; case DAC960_IOCTL_GET_CONTROLLER_INFO: { - DAC960_ControllerInfo_T *UserSpaceControllerInfo = - (DAC960_ControllerInfo_T *) Argument; + DAC960_ControllerInfo_T __user *UserSpaceControllerInfo = + (DAC960_ControllerInfo_T __user *) Argument; DAC960_ControllerInfo_T ControllerInfo; DAC960_Controller_T *Controller; int ControllerNumber; @@ -6574,8 +6576,8 @@ } case DAC960_IOCTL_V1_EXECUTE_COMMAND: { - DAC960_V1_UserCommand_T *UserSpaceUserCommand = - (DAC960_V1_UserCommand_T *) Argument; + DAC960_V1_UserCommand_T __user *UserSpaceUserCommand = + (DAC960_V1_UserCommand_T __user *) Argument; DAC960_V1_UserCommand_T UserCommand; DAC960_Controller_T *Controller; DAC960_Command_T *Command = NULL; @@ -6734,8 +6736,8 @@ } case DAC960_IOCTL_V2_EXECUTE_COMMAND: { - DAC960_V2_UserCommand_T *UserSpaceUserCommand = - (DAC960_V2_UserCommand_T *) Argument; + DAC960_V2_UserCommand_T __user *UserSpaceUserCommand = + (DAC960_V2_UserCommand_T __user *) Argument; DAC960_V2_UserCommand_T UserCommand; DAC960_Controller_T *Controller; DAC960_Command_T *Command = NULL; @@ -6888,8 +6890,8 @@ } case DAC960_IOCTL_V2_GET_HEALTH_STATUS: { - DAC960_V2_GetHealthStatus_T *UserSpaceGetHealthStatus = - (DAC960_V2_GetHealthStatus_T *) Argument; + DAC960_V2_GetHealthStatus_T __user *UserSpaceGetHealthStatus = + (DAC960_V2_GetHealthStatus_T __user *) Argument; DAC960_V2_GetHealthStatus_T GetHealthStatus; DAC960_V2_HealthStatusBuffer_T HealthStatusBuffer; DAC960_Controller_T *Controller; diff -urN linux-2.6.7-rc2/drivers/block/DAC960.h linux-2.6.7-rc3/drivers/block/DAC960.h --- linux-2.6.7-rc2/drivers/block/DAC960.h 2004-05-09 19:33:10.000000000 -0700 +++ linux-2.6.7-rc3/drivers/block/DAC960.h 2004-06-07 12:55:03.274633485 -0700 @@ -1914,8 +1914,8 @@ unsigned char ControllerNumber; DAC960_V1_CommandMailbox_T CommandMailbox; int DataTransferLength; - void *DataTransferBuffer; - DAC960_V1_DCDB_T *DCDB; + void __user *DataTransferBuffer; + DAC960_V1_DCDB_T __user *DCDB; } DAC960_V1_UserCommand_T; @@ -1948,8 +1948,8 @@ DAC960_V2_CommandMailbox_T CommandMailbox; int DataTransferLength; int RequestSenseLength; - void *DataTransferBuffer; - void *RequestSenseBuffer; + void __user *DataTransferBuffer; + void __user *RequestSenseBuffer; } DAC960_V2_UserCommand_T; @@ -1980,7 +1980,7 @@ typedef struct DAC960_V2_GetHealthStatus { unsigned char ControllerNumber; - DAC960_V2_HealthStatusBuffer_T *HealthStatusBuffer; + DAC960_V2_HealthStatusBuffer_T __user *HealthStatusBuffer; } DAC960_V2_GetHealthStatus_T; diff -urN linux-2.6.7-rc2/drivers/block/carmel.c linux-2.6.7-rc3/drivers/block/carmel.c --- linux-2.6.7-rc2/drivers/block/carmel.c 2004-06-07 12:54:48.853036193 -0700 +++ linux-2.6.7-rc3/drivers/block/carmel.c 2004-06-07 12:55:03.358636964 -0700 @@ -413,7 +413,7 @@ static int carm_bdev_ioctl(struct inode *ino, struct file *fil, unsigned int cmd, unsigned long arg) { - void __user *usermem = (void *) arg; + void __user *usermem = (void __user *) arg; struct carm_port *port = ino->i_bdev->bd_disk->private_data; struct hd_geometry geom; diff -urN linux-2.6.7-rc2/drivers/block/cciss.c linux-2.6.7-rc3/drivers/block/cciss.c --- linux-2.6.7-rc2/drivers/block/cciss.c 2004-05-09 19:33:20.000000000 -0700 +++ linux-2.6.7-rc3/drivers/block/cciss.c 2004-06-07 12:55:03.445640568 -0700 @@ -135,7 +135,6 @@ static void cciss_getgeometry(int cntl_num); -static inline void addQ(CommandList_struct **Qptr, CommandList_struct *c); static void start_io( ctlr_info_t *h); static int sendcmd( __u8 cmd, int ctlr, void *buff, size_t size, unsigned int use_unit_num, unsigned int log_unit, __u8 page_code, @@ -157,6 +156,36 @@ .revalidate_disk= cciss_revalidate, }; +/* + * Enqueuing and dequeuing functions for cmdlists. + */ +static inline void addQ(CommandList_struct **Qptr, CommandList_struct *c) +{ + if (*Qptr == NULL) { + *Qptr = c; + c->next = c->prev = c; + } else { + c->prev = (*Qptr)->prev; + c->next = (*Qptr); + (*Qptr)->prev->next = c; + (*Qptr)->prev = c; + } +} + +static inline CommandList_struct *removeQ(CommandList_struct **Qptr, + CommandList_struct *c) +{ + if (c && c->next != c) { + if (*Qptr == c) *Qptr = c->next; + c->prev->next = c->next; + c->next->prev = c->prev; + } else { + *Qptr = NULL; + } + return c; +} +#ifdef CONFIG_PROC_FS + #include "cciss_scsi.c" /* For SCSI tape support */ /* @@ -167,7 +196,6 @@ #define RAID_UNKNOWN 6 static const char *raid_label[] = {"0","4","1(0+1)","5","5+1","ADG", "UNKNOWN"}; -#ifdef CONFIG_PROC_FS static struct proc_dir_entry *proc_cciss; @@ -257,7 +285,7 @@ } static int -cciss_proc_write(struct file *file, const char *buffer, +cciss_proc_write(struct file *file, const char __user *buffer, unsigned long count, void *data) { unsigned char cmd[80]; @@ -462,6 +490,7 @@ ctlr_info_t *host = get_host(disk); drive_info_struct *drv = get_drv(disk); int ctlr = host->ctlr; + void __user *argp = (void __user *)arg; #ifdef CCISS_DEBUG printk(KERN_DEBUG "cciss_ioctl: Called with cmd=%x %lx\n", cmd, arg); @@ -478,8 +507,7 @@ } else return -ENXIO; driver_geo.start= get_start_sect(inode->i_bdev); - if (copy_to_user((void *) arg, &driver_geo, - sizeof( struct hd_geometry))) + if (copy_to_user(argp, &driver_geo, sizeof(struct hd_geometry))) return -EFAULT; return(0); } @@ -492,7 +520,7 @@ pciinfo.bus = host->pdev->bus->number; pciinfo.dev_fn = host->pdev->devfn; pciinfo.board_id = host->board_id; - if (copy_to_user((void *) arg, &pciinfo, sizeof( cciss_pci_info_struct ))) + if (copy_to_user(argp, &pciinfo, sizeof( cciss_pci_info_struct ))) return -EFAULT; return(0); } @@ -502,7 +530,7 @@ if (!arg) return -EINVAL; intinfo.delay = readl(&host->cfgtable->HostWrite.CoalIntDelay); intinfo.count = readl(&host->cfgtable->HostWrite.CoalIntCount); - if (copy_to_user((void *) arg, &intinfo, sizeof( cciss_coalint_struct ))) + if (copy_to_user(argp, &intinfo, sizeof( cciss_coalint_struct ))) return -EFAULT; return(0); } @@ -514,7 +542,7 @@ if (!arg) return -EINVAL; if (!capable(CAP_SYS_ADMIN)) return -EPERM; - if (copy_from_user(&intinfo, (void *) arg, sizeof( cciss_coalint_struct))) + if (copy_from_user(&intinfo, argp, sizeof( cciss_coalint_struct))) return -EFAULT; if ( (intinfo.delay == 0 ) && (intinfo.count == 0)) @@ -550,7 +578,7 @@ if (!arg) return -EINVAL; for(i=0;i<16;i++) NodeName[i] = readb(&host->cfgtable->ServerName[i]); - if (copy_to_user((void *) arg, NodeName, sizeof( NodeName_type))) + if (copy_to_user(argp, NodeName, sizeof( NodeName_type))) return -EFAULT; return(0); } @@ -563,7 +591,7 @@ if (!arg) return -EINVAL; if (!capable(CAP_SYS_ADMIN)) return -EPERM; - if (copy_from_user(NodeName, (void *) arg, sizeof( NodeName_type))) + if (copy_from_user(NodeName, argp, sizeof( NodeName_type))) return -EFAULT; spin_lock_irqsave(CCISS_LOCK(ctlr), flags); @@ -593,7 +621,7 @@ if (!arg) return -EINVAL; heartbeat = readl(&host->cfgtable->HeartBeat); - if (copy_to_user((void *) arg, &heartbeat, sizeof( Heartbeat_type))) + if (copy_to_user(argp, &heartbeat, sizeof( Heartbeat_type))) return -EFAULT; return(0); } @@ -603,7 +631,7 @@ if (!arg) return -EINVAL; BusTypes = readl(&host->cfgtable->BusTypes); - if (copy_to_user((void *) arg, &BusTypes, sizeof( BusTypes_type) )) + if (copy_to_user(argp, &BusTypes, sizeof( BusTypes_type) )) return -EFAULT; return(0); } @@ -614,7 +642,7 @@ if (!arg) return -EINVAL; memcpy(firmware, host->firm_ver, 4); - if (copy_to_user((void *) arg, firmware, sizeof( FirmwareVer_type))) + if (copy_to_user(argp, firmware, sizeof( FirmwareVer_type))) return -EFAULT; return(0); } @@ -624,7 +652,7 @@ if (!arg) return -EINVAL; - if (copy_to_user((void *) arg, &DriverVer, sizeof( DriverVer_type) )) + if (copy_to_user(argp, &DriverVer, sizeof( DriverVer_type) )) return -EFAULT; return(0); } @@ -648,7 +676,7 @@ if (disk->part[i]->nr_sects != 0) luninfo.num_parts++; } - if (copy_to_user((void *) arg, &luninfo, + if (copy_to_user(argp, &luninfo, sizeof(LogvolInfo_struct))) return -EFAULT; return(0); @@ -672,7 +700,7 @@ if (!capable(CAP_SYS_RAWIO)) return -EPERM; - if (copy_from_user(&iocommand, (void *) arg, sizeof( IOCTL_Command_struct) )) + if (copy_from_user(&iocommand, argp, sizeof( IOCTL_Command_struct) )) return -EFAULT; if((iocommand.buf_size < 1) && (iocommand.Request.Type.Direction != XFER_NONE)) @@ -753,7 +781,7 @@ /* Copy the error information out */ iocommand.error_info = *(c->err_info); - if ( copy_to_user((void *) arg, &iocommand, sizeof( IOCTL_Command_struct) ) ) + if ( copy_to_user(argp, &iocommand, sizeof( IOCTL_Command_struct) ) ) { kfree(buff); cmd_free(host, c, 0); @@ -787,7 +815,7 @@ DECLARE_COMPLETION(wait); __u32 left; __u32 sz; - BYTE *data_ptr; + BYTE __user *data_ptr; if (!arg) return -EINVAL; @@ -799,7 +827,7 @@ status = -ENOMEM; goto cleanup1; } - if (copy_from_user(ioc, (void *) arg, sizeof(*ioc))) { + if (copy_from_user(ioc, argp, sizeof(*ioc))) { status = -EFAULT; goto cleanup1; } @@ -831,7 +859,7 @@ goto cleanup1; } left = ioc->buf_size; - data_ptr = (BYTE *) ioc->buf; + data_ptr = ioc->buf; while (left) { sz = (left > ioc->malloc_size) ? ioc->malloc_size : left; buff_size[sg_used] = sz; @@ -896,14 +924,14 @@ } /* Copy the error information out */ ioc->error_info = *(c->err_info); - if (copy_to_user((void *) arg, ioc, sizeof(*ioc))) { + if (copy_to_user(argp, ioc, sizeof(*ioc))) { cmd_free(host, c, 0); status = -EFAULT; goto cleanup1; } if (ioc->Request.Type.Direction == XFER_READ) { /* Copy the data out of the buffer we created */ - BYTE *ptr = (BYTE *) ioc->buf; + BYTE __user *ptr = ioc->buf; for(i=0; i< sg_used; i++) { if (copy_to_user(ptr, buff[i], buff_size[i])) { cmd_free(host, c, 0); @@ -1685,35 +1713,6 @@ return (ulong) (page_remapped ? (page_remapped + page_offs) : 0UL); } -/* - * Enqueuing and dequeuing functions for cmdlists. - */ -static inline void addQ(CommandList_struct **Qptr, CommandList_struct *c) -{ - if (*Qptr == NULL) { - *Qptr = c; - c->next = c->prev = c; - } else { - c->prev = (*Qptr)->prev; - c->next = (*Qptr); - (*Qptr)->prev->next = c; - (*Qptr)->prev = c; - } -} - -static inline CommandList_struct *removeQ(CommandList_struct **Qptr, - CommandList_struct *c) -{ - if (c && c->next != c) { - if (*Qptr == c) *Qptr = c->next; - c->prev->next = c->next; - c->next->prev = c->prev; - } else { - *Qptr = NULL; - } - return c; -} - /* * Takes jobs of the Q and sends them to the hardware, then puts it on * the Q to wait for completion. diff -urN linux-2.6.7-rc2/drivers/block/cpqarray.c linux-2.6.7-rc3/drivers/block/cpqarray.c --- linux-2.6.7-rc2/drivers/block/cpqarray.c 2004-06-07 12:54:48.854036235 -0700 +++ linux-2.6.7-rc3/drivers/block/cpqarray.c 2004-06-07 12:55:03.446640609 -0700 @@ -418,7 +418,8 @@ } hba[i]->access.set_intr_mask(hba[i], 0); if (request_irq(hba[i]->intr, do_ida_intr, - SA_INTERRUPT|SA_SHIRQ, hba[i]->devname, hba[i])) + SA_INTERRUPT|SA_SHIRQ|SA_SAMPLE_RANDOM, + hba[i]->devname, hba[i])) { printk(KERN_ERR "cpqarray: Unable to get irq %d for %s\n", hba[i]->intr, hba[i]->devname); @@ -1156,8 +1157,8 @@ ctlr_info_t *host = get_host(inode->i_bdev->bd_disk); int error; int diskinfo[4]; - struct hd_geometry *geo = (struct hd_geometry *)arg; - ida_ioctl_t *io = (ida_ioctl_t*)arg; + struct hd_geometry __user *geo = (struct hd_geometry __user *)arg; + ida_ioctl_t __user *io = (ida_ioctl_t __user *)arg; ida_ioctl_t *my_io; switch(cmd) { @@ -1201,7 +1202,7 @@ return error; case IDAGETCTLRSIG: if (!arg) return -EINVAL; - put_user(host->ctlr_sig, (int*)arg); + put_user(host->ctlr_sig, (int __user *)arg); return 0; case IDAREVALIDATEVOLS: if (iminor(inode) != 0) @@ -1209,7 +1210,7 @@ return revalidate_allvol(host); case IDADRIVERVERSION: if (!arg) return -EINVAL; - put_user(DRIVER_VERSION, (unsigned long*)arg); + put_user(DRIVER_VERSION, (unsigned long __user *)arg); return 0; case IDAGETPCIINFO: { @@ -1220,7 +1221,7 @@ pciinfo.bus = host->pci_dev->bus->number; pciinfo.dev_fn = host->pci_dev->devfn; pciinfo.board_id = host->board_id; - if(copy_to_user((void *) arg, &pciinfo, + if(copy_to_user((void __user *) arg, &pciinfo, sizeof( ida_pci_info_struct))) return -EFAULT; return(0); @@ -1271,7 +1272,7 @@ cmd_free(h, c, 0); return(error); } - if (copy_from_user(p, (void*)io->sg[0].addr, io->sg[0].size)) { + if (copy_from_user(p, io->sg[0].addr, io->sg[0].size)) { kfree(p); cmd_free(h, c, 0); return -EFAULT; @@ -1312,7 +1313,7 @@ cmd_free(h, c, 0); return(error); } - if (copy_from_user(p, (void*)io->sg[0].addr, io->sg[0].size)) { + if (copy_from_user(p, io->sg[0].addr, io->sg[0].size)) { kfree(p); cmd_free(h, c, 0); return -EFAULT; @@ -1353,7 +1354,7 @@ case DIAG_PASS_THRU: case SENSE_CONTROLLER_PERFORMANCE: case READ_FLASH_ROM: - if (copy_to_user((void*)io->sg[0].addr, p, io->sg[0].size)) { + if (copy_to_user(io->sg[0].addr, p, io->sg[0].size)) { kfree(p); return -EFAULT; } diff -urN linux-2.6.7-rc2/drivers/block/floppy.c linux-2.6.7-rc3/drivers/block/floppy.c --- linux-2.6.7-rc2/drivers/block/floppy.c 2004-06-07 12:54:48.858036400 -0700 +++ linux-2.6.7-rc3/drivers/block/floppy.c 2004-06-07 12:55:03.450640775 -0700 @@ -4238,7 +4238,7 @@ } disks[dr]->major = FLOPPY_MAJOR; - disks[dr]->first_minor = TOMINOR(i); + disks[dr]->first_minor = TOMINOR(dr); disks[dr]->fops = &floppy_fops; sprintf(disks[dr]->disk_name, "fd%d", dr); diff -urN linux-2.6.7-rc2/drivers/block/ida_ioctl.h linux-2.6.7-rc3/drivers/block/ida_ioctl.h --- linux-2.6.7-rc2/drivers/block/ida_ioctl.h 2004-05-09 19:32:30.000000000 -0700 +++ linux-2.6.7-rc3/drivers/block/ida_ioctl.h 2004-06-07 12:55:03.527643964 -0700 @@ -57,7 +57,7 @@ /* currently, sg_cnt is assumed to be 1: only the 0th element of sg is used */ struct { - void *addr; + void __user *addr; size_t size; } sg[SG_MAX]; int sg_cnt; diff -urN linux-2.6.7-rc2/drivers/block/loop.c linux-2.6.7-rc3/drivers/block/loop.c --- linux-2.6.7-rc2/drivers/block/loop.c 2004-06-07 12:54:48.866036732 -0700 +++ linux-2.6.7-rc3/drivers/block/loop.c 2004-06-07 12:55:03.531644130 -0700 @@ -308,7 +308,9 @@ page->index); desc->error = -EINVAL; } - + + flush_dcache_page(p->page); + desc->count = count - size; desc->written += size; p->offset += size; diff -urN linux-2.6.7-rc2/drivers/block/paride/pf.c linux-2.6.7-rc3/drivers/block/paride/pf.c --- linux-2.6.7-rc2/drivers/block/paride/pf.c 2004-05-09 19:32:53.000000000 -0700 +++ linux-2.6.7-rc3/drivers/block/paride/pf.c 2004-06-07 12:55:03.570645745 -0700 @@ -337,7 +337,7 @@ static int pf_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { struct pf_unit *pf = inode->i_bdev->bd_disk->private_data; - struct hd_geometry *geo = (struct hd_geometry *) arg; + struct hd_geometry __user *geo = (struct hd_geometry __user *) arg; struct hd_geometry g; sector_t capacity; diff -urN linux-2.6.7-rc2/drivers/block/paride/pg.c linux-2.6.7-rc3/drivers/block/paride/pg.c --- linux-2.6.7-rc2/drivers/block/paride/pg.c 2004-06-07 12:54:48.868036814 -0700 +++ linux-2.6.7-rc3/drivers/block/paride/pg.c 2004-06-07 12:55:03.578646076 -0700 @@ -212,9 +212,9 @@ static int pg_open(struct inode *inode, struct file *file); static int pg_release(struct inode *inode, struct file *file); -static ssize_t pg_read(struct file *filp, char *buf, +static ssize_t pg_read(struct file *filp, char __user *buf, size_t count, loff_t * ppos); -static ssize_t pg_write(struct file *filp, const char *buf, +static ssize_t pg_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos); static int pg_detect(void); @@ -571,7 +571,7 @@ return 0; } -static ssize_t pg_write(struct file *filp, const char *buf, size_t count, loff_t *ppos) +static ssize_t pg_write(struct file *filp, const char __user *buf, size_t count, loff_t *ppos) { struct pg *dev = filp->private_data; struct pg_write_hdr hdr; @@ -582,7 +582,7 @@ if (count < hs) return -EINVAL; - if (copy_from_user((char *) &hdr, buf, hs)) + if (copy_from_user(&hdr, buf, hs)) return -EFAULT; if (hdr.magic != PG_MAGIC) @@ -619,7 +619,7 @@ return count; } -static ssize_t pg_read(struct file *filp, char *buf, size_t count, loff_t *ppos) +static ssize_t pg_read(struct file *filp, char __user *buf, size_t count, loff_t *ppos) { struct pg *dev = filp->private_data; struct pg_read_hdr hdr; @@ -651,7 +651,7 @@ hdr.duration = (jiffies - dev->start + HZ / 2) / HZ; hdr.scsi = dev->status & 0x0f; - if (copy_to_user(buf, (char *) &hdr, hs)) + if (copy_to_user(buf, &hdr, hs)) return -EFAULT; if (copy > 0) if (copy_to_user(buf + hs, dev->bufptr, copy)) diff -urN linux-2.6.7-rc2/drivers/block/paride/pt.c linux-2.6.7-rc3/drivers/block/paride/pt.c --- linux-2.6.7-rc2/drivers/block/paride/pt.c 2004-06-07 12:54:48.869036856 -0700 +++ linux-2.6.7-rc3/drivers/block/paride/pt.c 2004-06-07 12:55:03.579646118 -0700 @@ -212,9 +212,9 @@ static int pt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg); static int pt_release(struct inode *inode, struct file *file); -static ssize_t pt_read(struct file *filp, char *buf, +static ssize_t pt_read(struct file *filp, char __user *buf, size_t count, loff_t * ppos); -static ssize_t pt_write(struct file *filp, const char *buf, +static ssize_t pt_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos); static int pt_detect(void); @@ -710,12 +710,12 @@ unsigned int cmd, unsigned long arg) { struct pt_unit *tape = file->private_data; + struct mtop __user *p = (void __user *)arg; struct mtop mtop; switch (cmd) { case MTIOCTOP: - if (copy_from_user((char *) &mtop, (char *) arg, - sizeof (struct mtop))) + if (copy_from_user(&mtop, p, sizeof(struct mtop))) return -EFAULT; switch (mtop.mt_op) { @@ -764,7 +764,7 @@ } -static ssize_t pt_read(struct file *filp, char *buf, size_t count, loff_t * ppos) +static ssize_t pt_read(struct file *filp, char __user *buf, size_t count, loff_t * ppos) { struct pt_unit *tape = filp->private_data; struct pi_adapter *pi = tape->pi; @@ -861,7 +861,7 @@ } -static ssize_t pt_write(struct file *filp, const char *buf, size_t count, loff_t * ppos) +static ssize_t pt_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos) { struct pt_unit *tape = filp->private_data; struct pi_adapter *pi = tape->pi; diff -urN linux-2.6.7-rc2/drivers/block/ps2esdi.c linux-2.6.7-rc3/drivers/block/ps2esdi.c --- linux-2.6.7-rc2/drivers/block/ps2esdi.c 2004-06-07 12:54:48.869036856 -0700 +++ linux-2.6.7-rc3/drivers/block/ps2esdi.c 2004-06-07 12:55:03.636648479 -0700 @@ -1063,17 +1063,17 @@ struct file *file, u_int cmd, u_long arg) { struct ps2esdi_i_struct *p = inode->i_bdev->bd_disk->private_data; - struct ps2esdi_geometry *geometry = (struct ps2esdi_geometry *) arg; - int err; + struct ps2esdi_geometry geom; if (cmd != HDIO_GETGEO) return -EINVAL; - if ((err = verify_area(VERIFY_WRITE, geometry, sizeof(*geometry)))) - return (err); - put_user(p->head, (char *) &geometry->heads); - put_user(p->sect, (char *) &geometry->sectors); - put_user(p->cyl, (short *) &geometry->cylinders); - put_user(get_start_sect(inode->i_bdev), (long *) &geometry->start); + memset(&geom, 0, sizeof(geom)); + geom.heads = p->head; + geom.sectors = p->sect; + geom.cylinders = p->cyl; + geom.start = get_start_sect(inode->i_bdev); + if (copy_to_user((void __user *)arg, &geom, sizeof(geom))) + return -EFAULT; return 0; } diff -urN linux-2.6.7-rc2/drivers/block/umem.c linux-2.6.7-rc3/drivers/block/umem.c --- linux-2.6.7-rc2/drivers/block/umem.c 2004-06-07 12:54:48.873037021 -0700 +++ linux-2.6.7-rc3/drivers/block/umem.c 2004-06-07 12:55:03.641648686 -0700 @@ -833,7 +833,7 @@ geo.start = get_start_sect(i->i_bdev); geo.cylinders = size / (geo.heads * geo.sectors); - if (copy_to_user((void *) arg, &geo, sizeof(geo))) + if (copy_to_user((void __user *) arg, &geo, sizeof(geo))) return -EFAULT; return 0; } diff -urN linux-2.6.7-rc2/drivers/block/xd.c linux-2.6.7-rc3/drivers/block/xd.c --- linux-2.6.7-rc2/drivers/block/xd.c 2004-05-09 19:33:13.000000000 -0700 +++ linux-2.6.7-rc3/drivers/block/xd.c 2004-06-07 12:55:03.643648769 -0700 @@ -330,12 +330,12 @@ case HDIO_GETGEO: { struct hd_geometry g; - struct hd_geometry *geometry = (struct hd_geometry *) arg; + struct hd_geometry __user *geom= (void __user *)arg; g.heads = p->heads; g.sectors = p->sectors; g.cylinders = p->cylinders; g.start = get_start_sect(inode->i_bdev); - return copy_to_user(geometry, &g, sizeof g) ? -EFAULT : 0; + return copy_to_user(geom, &g, sizeof(g)) ? -EFAULT : 0; } case HDIO_SET_DMA: if (!capable(CAP_SYS_ADMIN)) return -EACCES; @@ -354,9 +354,9 @@ } return 0; case HDIO_GET_DMA: - return put_user(!nodma, (long *) arg); + return put_user(!nodma, (long __user *) arg); case HDIO_GET_MULTCOUNT: - return put_user(xd_maxsectors, (long *) arg); + return put_user(xd_maxsectors, (long __user *) arg); default: return -EINVAL; } diff -urN linux-2.6.7-rc2/drivers/bluetooth/hci_ldisc.c linux-2.6.7-rc3/drivers/bluetooth/hci_ldisc.c --- linux-2.6.7-rc2/drivers/bluetooth/hci_ldisc.c 2004-06-07 12:54:48.876037146 -0700 +++ linux-2.6.7-rc3/drivers/bluetooth/hci_ldisc.c 2004-06-07 12:55:03.782654526 -0700 @@ -498,11 +498,11 @@ /* * We don't provide read/write/poll interface for user space. */ -static ssize_t hci_uart_tty_read(struct tty_struct *tty, struct file *file, unsigned char *buf, size_t nr) +static ssize_t hci_uart_tty_read(struct tty_struct *tty, struct file *file, unsigned char __user *buf, size_t nr) { return 0; } -static ssize_t hci_uart_tty_write(struct tty_struct *tty, struct file *file, const unsigned char *data, size_t count) +static ssize_t hci_uart_tty_write(struct tty_struct *tty, struct file *file, const unsigned char __user *data, size_t count) { return 0; } diff -urN linux-2.6.7-rc2/drivers/bluetooth/hci_usb.c linux-2.6.7-rc3/drivers/bluetooth/hci_usb.c --- linux-2.6.7-rc2/drivers/bluetooth/hci_usb.c 2004-06-07 12:54:48.877037187 -0700 +++ linux-2.6.7-rc3/drivers/bluetooth/hci_usb.c 2004-06-07 12:55:03.829656473 -0700 @@ -29,9 +29,7 @@ * Copyright (c) 2000 Greg Kroah-Hartman * Copyright (c) 2000 Mark Douglas Corner * - * $Id: hci_usb.c,v 1.8 2002/07/18 17:23:09 maxk Exp $ */ -#define VERSION "2.5" #include #include @@ -57,9 +55,9 @@ #ifndef CONFIG_BT_HCIUSB_DEBUG #undef BT_DBG -#define BT_DBG( A... ) +#define BT_DBG(D...) #undef BT_DMP -#define BT_DMP( A... ) +#define BT_DMP(D...) #endif #ifndef CONFIG_BT_HCIUSB_ZERO_PACKET @@ -67,6 +65,8 @@ #define URB_ZERO_PACKET 0 #endif +#define VERSION "2.6" + static struct usb_driver hci_usb_driver; static struct usb_device_id bluetooth_ids[] = { @@ -100,7 +100,10 @@ /* Digianswer device */ { USB_DEVICE(0x08fd, 0x0001), .driver_info = HCI_DIGIANSWER }, - { } /* Terminating entry */ + /* RTX Telecom based adapter with buggy SCO support */ + { USB_DEVICE(0x0400, 0x0807), .driver_info = HCI_BROKEN_ISOC }, + + { } /* Terminating entry */ }; struct _urb *_urb_alloc(int isoc, int gfp) @@ -393,7 +396,7 @@ { struct hci_usb *husb = (struct hci_usb *) hdev->driver_data; unsigned long flags; - + if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags)) return 0; @@ -402,7 +405,7 @@ /* Synchronize with completion handlers */ write_lock_irqsave(&husb->completion_lock, flags); write_unlock_irqrestore(&husb->completion_lock, flags); - + hci_usb_unlink_urbs(husb); hci_usb_flush(hdev); return 0; @@ -414,7 +417,7 @@ int err; BT_DBG("%s urb %p type %d", husb->hdev->name, urb, _urb->type); - + _urb_queue_tail(__pending_q(husb, _urb->type), _urb); err = usb_submit_urb(urb, GFP_ATOMIC); if (err) { @@ -551,7 +554,7 @@ skb_queue_head(q, skb); } #endif - + /* Process ACL queue */ q = __transmit_q(husb, HCI_ACLDATA_PKT); while (atomic_read(__pending_tx(husb, HCI_ACLDATA_PKT)) < HCI_MAX_BULK_TX && @@ -656,7 +659,7 @@ if (count >= HCI_SCO_HDR_SIZE) { struct hci_sco_hdr *h = data; len = HCI_SCO_HDR_SIZE + h->dlen; - } else + } else return -EILSEQ; break; #endif @@ -702,7 +705,7 @@ struct _urb *_urb = container_of(urb, struct _urb, urb); struct hci_usb *husb = (void *) urb->context; struct hci_dev *hdev = husb->hdev; - int err, count = urb->actual_length; + int err, count = urb->actual_length; BT_DBG("%s urb %p type %d status %d count %d flags %x", hdev->name, urb, _urb->type, urb->status, count, urb->transfer_flags); @@ -743,7 +746,7 @@ resubmit: urb->dev = husb->udev; - err = usb_submit_urb(urb, GFP_ATOMIC); + err = usb_submit_urb(urb, GFP_ATOMIC); BT_DBG("%s urb %p type %d resubmit status %d", hdev->name, urb, _urb->type, err); @@ -779,7 +782,7 @@ _urb_queue_tail(__completed_q(husb, _urb->type), _urb); hci_usb_tx_wakeup(husb); - + read_unlock(&husb->completion_lock); } @@ -819,9 +822,8 @@ if (intf->cur_altsetting->desc.bInterfaceNumber > 0) return -ENODEV; - - /* Find endpoints that we need */ + /* Find endpoints that we need */ uif = intf->cur_altsetting; for (e = 0; e < uif->desc.bNumEndpoints; e++) { ep = &uif->endpoint[e]; @@ -862,16 +864,17 @@ husb->ctrl_req = HCI_DIGI_REQ; else husb->ctrl_req = HCI_CTRL_REQ; - - /* Find isochronous endpoints that we can use */ + /* Find isochronous endpoints that we can use */ size = 0; isoc_iface = NULL; isoc_alts = 0; isoc_ifnum = 1; #ifdef CONFIG_BT_HCIUSB_SCO - isoc_iface = usb_ifnum_to_if(udev, isoc_ifnum); + if (!(id->driver_info & HCI_BROKEN_ISOC)) + isoc_iface = usb_ifnum_to_if(udev, isoc_ifnum); + if (isoc_iface) { int a; struct usb_host_endpoint *isoc_out_ep = NULL; @@ -917,10 +920,10 @@ } } #endif - + husb->completion_lock = RW_LOCK_UNLOCKED; - for (i = 0; i < 4; i++) { + for (i = 0; i < 4; i++) { skb_queue_head_init(&husb->transmit_q[i]); _urb_queue_init(&husb->pending_q[i]); _urb_queue_init(&husb->completed_q[i]); @@ -939,10 +942,10 @@ hdev->driver_data = husb; SET_HCIDEV_DEV(hdev, &intf->dev); - hdev->open = hci_usb_open; - hdev->close = hci_usb_close; - hdev->flush = hci_usb_flush; - hdev->send = hci_usb_send_frame; + hdev->open = hci_usb_open; + hdev->close = hci_usb_close; + hdev->flush = hci_usb_flush; + hdev->send = hci_usb_send_frame; hdev->destruct = hci_usb_destruct; hdev->owner = THIS_MODULE; @@ -993,11 +996,11 @@ } static struct usb_driver hci_usb_driver = { - .owner = THIS_MODULE, - .name = "hci_usb", - .probe = hci_usb_probe, - .disconnect = hci_usb_disconnect, - .id_table = bluetooth_ids, + .owner = THIS_MODULE, + .name = "hci_usb", + .probe = hci_usb_probe, + .disconnect = hci_usb_disconnect, + .id_table = bluetooth_ids, }; static int __init hci_usb_init(void) diff -urN linux-2.6.7-rc2/drivers/bluetooth/hci_usb.h linux-2.6.7-rc3/drivers/bluetooth/hci_usb.h --- linux-2.6.7-rc2/drivers/bluetooth/hci_usb.h 2004-05-09 19:33:13.000000000 -0700 +++ linux-2.6.7-rc3/drivers/bluetooth/hci_usb.h 2004-06-07 12:55:03.830656514 -0700 @@ -23,33 +23,28 @@ SOFTWARE IS DISCLAIMED. */ -/* - * $Id: hci_usb.h,v 1.2 2002/03/18 19:10:04 maxk Exp $ - */ - -#ifdef __KERNEL__ - /* Class, SubClass, and Protocol codes that describe a Bluetooth device */ -#define HCI_DEV_CLASS 0xe0 /* Wireless class */ -#define HCI_DEV_SUBCLASS 0x01 /* RF subclass */ -#define HCI_DEV_PROTOCOL 0x01 /* Bluetooth programming protocol */ - -#define HCI_CTRL_REQ 0x20 -#define HCI_DIGI_REQ 0x40 +#define HCI_DEV_CLASS 0xe0 /* Wireless class */ +#define HCI_DEV_SUBCLASS 0x01 /* RF subclass */ +#define HCI_DEV_PROTOCOL 0x01 /* Bluetooth programming protocol */ + +#define HCI_CTRL_REQ 0x20 +#define HCI_DIGI_REQ 0x40 + +#define HCI_IGNORE 0x01 +#define HCI_RESET 0x02 +#define HCI_DIGIANSWER 0x04 +#define HCI_BROKEN_ISOC 0x08 -#define HCI_IGNORE 0x01 -#define HCI_RESET 0x02 -#define HCI_DIGIANSWER 0x04 +#define HCI_MAX_IFACE_NUM 3 -#define HCI_MAX_IFACE_NUM 3 - -#define HCI_MAX_BULK_TX 4 -#define HCI_MAX_BULK_RX 1 +#define HCI_MAX_BULK_TX 4 +#define HCI_MAX_BULK_RX 1 #define HCI_MAX_ISOC_RX 2 #define HCI_MAX_ISOC_TX 2 -#define HCI_MAX_ISOC_FRAMES 10 +#define HCI_MAX_ISOC_FRAMES 10 struct _urb_queue { struct list_head head; @@ -79,16 +74,16 @@ static inline void _urb_queue_head(struct _urb_queue *q, struct _urb *_urb) { - unsigned long flags; - spin_lock_irqsave(&q->lock, flags); + unsigned long flags; + spin_lock_irqsave(&q->lock, flags); list_add(&_urb->list, &q->head); _urb->queue = q; spin_unlock_irqrestore(&q->lock, flags); } static inline void _urb_queue_tail(struct _urb_queue *q, struct _urb *_urb) { - unsigned long flags; - spin_lock_irqsave(&q->lock, flags); + unsigned long flags; + spin_lock_irqsave(&q->lock, flags); list_add_tail(&_urb->list, &q->head); _urb->queue = q; spin_unlock_irqrestore(&q->lock, flags); } @@ -96,9 +91,9 @@ static inline void _urb_unlink(struct _urb *_urb) { struct _urb_queue *q = _urb->queue; - unsigned long flags; + unsigned long flags; if (q) { - spin_lock_irqsave(&q->lock, flags); + spin_lock_irqsave(&q->lock, flags); list_del(&_urb->list); _urb->queue = NULL; spin_unlock_irqrestore(&q->lock, flags); } @@ -106,41 +101,33 @@ struct _urb *_urb_dequeue(struct _urb_queue *q); -#ifndef container_of -#define container_of(ptr, type, member) ({ \ - const typeof( ((type *)0)->member ) *__mptr = (ptr); \ - (type *)( (char *)__mptr - offsetof(type,member) );}) -#endif - struct hci_usb { struct hci_dev *hdev; unsigned long state; - struct usb_device *udev; + struct usb_device *udev; struct usb_host_endpoint *bulk_in_ep; struct usb_host_endpoint *bulk_out_ep; struct usb_host_endpoint *intr_in_ep; - struct usb_interface *isoc_iface; + struct usb_interface *isoc_iface; struct usb_host_endpoint *isoc_out_ep; struct usb_host_endpoint *isoc_in_ep; __u8 ctrl_req; struct sk_buff_head transmit_q[4]; - struct sk_buff *reassembly[4]; // Reassembly buffers + struct sk_buff *reassembly[4]; /* Reassembly buffers */ rwlock_t completion_lock; - atomic_t pending_tx[4]; // Number of pending requests - struct _urb_queue pending_q[4]; // Pending requests - struct _urb_queue completed_q[4]; // Completed requests + atomic_t pending_tx[4]; /* Number of pending requests */ + struct _urb_queue pending_q[4]; /* Pending requests */ + struct _urb_queue completed_q[4]; /* Completed requests */ }; /* States */ #define HCI_USB_TX_PROCESS 1 #define HCI_USB_TX_WAKEUP 2 - -#endif /* __KERNEL__ */ diff -urN linux-2.6.7-rc2/drivers/bluetooth/hci_vhci.c linux-2.6.7-rc3/drivers/bluetooth/hci_vhci.c --- linux-2.6.7-rc2/drivers/bluetooth/hci_vhci.c 2004-05-09 19:33:20.000000000 -0700 +++ linux-2.6.7-rc3/drivers/bluetooth/hci_vhci.c 2004-06-07 12:55:03.831656555 -0700 @@ -127,7 +127,7 @@ } /* Get packet from user space buffer(already verified) */ -static inline ssize_t hci_vhci_get_user(struct hci_vhci_struct *hci_vhci, const char *buf, size_t count) +static inline ssize_t hci_vhci_get_user(struct hci_vhci_struct *hci_vhci, const char __user *buf, size_t count) { struct sk_buff *skb; @@ -152,7 +152,7 @@ } /* Write */ -static ssize_t hci_vhci_chr_write(struct file * file, const char * buf, +static ssize_t hci_vhci_chr_write(struct file * file, const char __user * buf, size_t count, loff_t *pos) { struct hci_vhci_struct *hci_vhci = (struct hci_vhci_struct *) file->private_data; @@ -165,10 +165,11 @@ /* Put packet to user space buffer(already verified) */ static inline ssize_t hci_vhci_put_user(struct hci_vhci_struct *hci_vhci, - struct sk_buff *skb, char *buf, int count) + struct sk_buff *skb, char __user *buf, + int count) { int len = count, total = 0; - char *ptr = buf; + char __user *ptr = buf; len = min_t(unsigned int, skb->len, len); if (copy_to_user(ptr, skb->data, len)) @@ -194,7 +195,7 @@ } /* Read */ -static ssize_t hci_vhci_chr_read(struct file * file, char * buf, size_t count, loff_t *pos) +static ssize_t hci_vhci_chr_read(struct file * file, char __user * buf, size_t count, loff_t *pos) { struct hci_vhci_struct *hci_vhci = (struct hci_vhci_struct *) file->private_data; DECLARE_WAITQUEUE(wait, current); diff -urN linux-2.6.7-rc2/drivers/cdrom/aztcd.c linux-2.6.7-rc3/drivers/cdrom/aztcd.c --- linux-2.6.7-rc2/drivers/cdrom/aztcd.c 2004-06-07 12:54:48.878037229 -0700 +++ linux-2.6.7-rc3/drivers/cdrom/aztcd.c 2004-06-07 12:55:03.975662520 -0700 @@ -873,7 +873,7 @@ /* Read the table of contents header, i.e. no. of tracks and start of first * track */ -static int aztGetDiskInfo() +static int aztGetDiskInfo(void) { int limit; unsigned char test; @@ -1167,6 +1167,7 @@ struct azt_Toc *tocPtr; struct cdrom_subchnl subchnl; struct cdrom_volctrl volctrl; + void __user *argp = (void __user *)arg; #ifdef AZT_DEBUG printk("aztcd: starting aztcd_ioctl - Command:%x Time: %li\n", @@ -1230,8 +1231,7 @@ #ifdef AZT_DEBUG printk("aztcd ioctl MULTISESSION\n"); #endif - if (copy_from_user - (&ms, (void *) arg, + if (copy_from_user(&ms, argp, sizeof(struct cdrom_multisession))) return -EFAULT; if (ms.addr_format == CDROM_MSF) { @@ -1248,8 +1248,7 @@ else return -EINVAL; ms.xa_flag = DiskInfo.xa; - if (copy_to_user - ((void *) arg, &ms, + if (copy_to_user(argp, &ms, sizeof(struct cdrom_multisession))) return -EFAULT; #ifdef AZT_DEBUG @@ -1272,7 +1271,7 @@ return 0; } case CDROMPLAYTRKIND: /* Play a track. This currently ignores index. */ - if (copy_from_user(&ti, (void *) arg, sizeof ti)) + if (copy_from_user(&ti, argp, sizeof ti)) return -EFAULT; if (ti.cdti_trk0 < DiskInfo.first || ti.cdti_trk0 > DiskInfo.last @@ -1303,7 +1302,7 @@ aztAudioStatus = CDROM_AUDIO_NO_STATUS; } */ - if (copy_from_user(&msf, (void *) arg, sizeof msf)) + if (copy_from_user(&msf, argp, sizeof msf)) return -EFAULT; /* convert to bcd */ azt_bin2bcd(&msf.cdmsf_min0); @@ -1335,11 +1334,11 @@ case CDROMREADTOCHDR: /* Read the table of contents header */ tocHdr.cdth_trk0 = DiskInfo.first; tocHdr.cdth_trk1 = DiskInfo.last; - if (copy_to_user((void *) arg, &tocHdr, sizeof tocHdr)) + if (copy_to_user(argp, &tocHdr, sizeof tocHdr)) return -EFAULT; break; case CDROMREADTOCENTRY: /* Read an entry in the table of contents */ - if (copy_from_user(&entry, (void *) arg, sizeof entry)) + if (copy_from_user(&entry, argp, sizeof entry)) return -EFAULT; if ((!aztTocUpToDate) || aztDiskChanged) aztUpdateToc(); @@ -1365,12 +1364,12 @@ } else { return -EINVAL; } - if (copy_to_user((void *) arg, &entry, sizeof entry)) + if (copy_to_user(argp, &entry, sizeof entry)) return -EFAULT; break; case CDROMSUBCHNL: /* Get subchannel info */ if (copy_from_user - (&subchnl, (void *) arg, sizeof(struct cdrom_subchnl))) + (&subchnl, argp, sizeof(struct cdrom_subchnl))) return -EFAULT; if (aztGetQChannelInfo(&qInfo) < 0) { #ifdef AZT_DEBUG @@ -1405,16 +1404,14 @@ subchnl.cdsc_reladdr.msf.frame = azt_bcd2bin(qInfo.trackTime.frame); } - if (copy_to_user - ((void *) arg, &subchnl, sizeof(struct cdrom_subchnl))) + if (copy_to_user(argp, &subchnl, sizeof(struct cdrom_subchnl))) return -EFAULT; break; case CDROMVOLCTRL: /* Volume control * With my Aztech CD268-01A volume control does not work, I can only turn the channels on (any value !=0) or off (value==0). Maybe it works better with your drive */ - if (copy_from_user - (&volctrl, (char *) arg, sizeof(volctrl))) + if (copy_from_user(&volctrl, argp, sizeof(volctrl))) return -EFAULT; azt_Play.start.min = 0x21; azt_Play.start.sec = 0x84; @@ -1457,7 +1454,7 @@ case CDROMREADCOOKED: /*read data in mode 1 (2048 Bytes) */ case CDROMREADRAW: /*read data in mode 2 (2336 Bytes) */ { - if (copy_from_user(&msf, (void *) arg, sizeof msf)) + if (copy_from_user(&msf, argp, sizeof msf)) return -EFAULT; /* convert to bcd */ azt_bin2bcd(&msf.cdmsf_min0); @@ -1476,16 +1473,11 @@ if (DiskInfo.xa) { return -1; /*XA Disks can't be read raw */ } else { - if (sendAztCmd - (ACMD_PLAY_READ_RAW, - &azt_Play)) + if (sendAztCmd(ACMD_PLAY_READ_RAW, &azt_Play)) return -1; DTEN_LOW; - insb(DATA_PORT, buf, - CD_FRAMESIZE_RAW); - if (copy_to_user - ((void *) arg, &buf, - CD_FRAMESIZE_RAW)) + insb(DATA_PORT, buf, CD_FRAMESIZE_RAW); + if (copy_to_user(argp, &buf, CD_FRAMESIZE_RAW)) return -EFAULT; } } else @@ -1494,14 +1486,13 @@ return -1; DTEN_LOW; insb(DATA_PORT, buf, CD_FRAMESIZE); - if (copy_to_user - ((void *) arg, &buf, CD_FRAMESIZE)) + if (copy_to_user(argp, &buf, CD_FRAMESIZE)) return -EFAULT; } } break; case CDROMSEEK: /*seek msf address */ - if (copy_from_user(&msf, (void *) arg, sizeof msf)) + if (copy_from_user(&msf, argp, sizeof msf)) return -EFAULT; /* convert to bcd */ azt_bin2bcd(&msf.cdmsf_min0); diff -urN linux-2.6.7-rc2/drivers/cdrom/cdrom.c linux-2.6.7-rc3/drivers/cdrom/cdrom.c --- linux-2.6.7-rc2/drivers/cdrom/cdrom.c 2004-06-07 12:54:48.881037353 -0700 +++ linux-2.6.7-rc3/drivers/cdrom/cdrom.c 2004-06-07 12:55:04.080666869 -0700 @@ -651,7 +651,6 @@ { struct packet_command cgc; char buffer[24]; - struct feature_header *fh; int ret; init_cdrom_command(&cgc, buffer, sizeof(buffer), CGC_DATA_READ); @@ -664,14 +663,7 @@ if ((ret = cdi->ops->generic_packet(cdi, &cgc))) return ret; - fh = (struct feature_header *)&buffer[0]; - if (be32_to_cpu(fh->data_len) >= (sizeof(struct feature_header)+ - sizeof(struct rwrt_feature_desc))) - memcpy(rfd, &buffer[sizeof(struct feature_header)], - sizeof (*rfd)); - else - memset(rfd, 0, sizeof(*rfd)); - + memcpy(rfd, &buffer[sizeof(struct feature_header)], sizeof (*rfd)); return 0; } diff -urN linux-2.6.7-rc2/drivers/cdrom/cdu31a.c linux-2.6.7-rc3/drivers/cdrom/cdu31a.c --- linux-2.6.7-rc2/drivers/cdrom/cdu31a.c 2004-05-09 19:32:53.000000000 -0700 +++ linux-2.6.7-rc3/drivers/cdrom/cdu31a.c 2004-06-07 12:55:04.172670679 -0700 @@ -2595,11 +2595,10 @@ retval = -EIO; goto exit_read_audio; } - } else if (copy_to_user((char *)(ra->buf + + } else if (copy_to_user(ra->buf + (CD_FRAMESIZE_RAW - * cframe)), - (char *) - readahead_buffer, + * cframe), + readahead_buffer, CD_FRAMESIZE_RAW)) { retval = -EFAULT; goto exit_read_audio; @@ -2612,8 +2611,7 @@ retval = -EIO; goto exit_read_audio; } - } else if (copy_to_user((char *)(ra->buf + (CD_FRAMESIZE_RAW * - cframe)), + } else if (copy_to_user(ra->buf + (CD_FRAMESIZE_RAW * cframe), (char *)readahead_buffer, CD_FRAMESIZE_RAW)) { retval = -EFAULT; @@ -2945,6 +2943,7 @@ static int scd_dev_ioctl(struct cdrom_device_info *cdi, unsigned int cmd, unsigned long arg) { + void __user *argp = (void __user *)arg; int i; switch (cmd) { @@ -2959,7 +2958,7 @@ return -EIO; } - if (copy_from_user(&ra, (char *) arg, sizeof(ra))) + if (copy_from_user(&ra, argp, sizeof(ra))) return -EFAULT; if (ra.nframes == 0) { diff -urN linux-2.6.7-rc2/drivers/cdrom/optcd.c linux-2.6.7-rc3/drivers/cdrom/optcd.c --- linux-2.6.7-rc2/drivers/cdrom/optcd.c 2004-05-09 19:32:26.000000000 -0700 +++ linux-2.6.7-rc3/drivers/cdrom/optcd.c 2004-06-07 12:55:04.257674200 -0700 @@ -1440,12 +1440,12 @@ } -static int cdromplaymsf(unsigned long arg) +static int cdromplaymsf(void __user *arg) { int status; struct cdrom_msf msf; - if (copy_from_user(&msf, (void *) arg, sizeof msf)) + if (copy_from_user(&msf, arg, sizeof msf)) return -EFAULT; bin2bcd(&msf); @@ -1461,13 +1461,13 @@ } -static int cdromplaytrkind(unsigned long arg) +static int cdromplaytrkind(void __user *arg) { int status; struct cdrom_ti ti; struct cdrom_msf msf; - if (copy_from_user(&ti, (void *) arg, sizeof ti)) + if (copy_from_user(&ti, arg, sizeof ti)) return -EFAULT; if (ti.cdti_trk0 < disk_info.first @@ -1505,23 +1505,23 @@ } -static int cdromreadtochdr(unsigned long arg) +static int cdromreadtochdr(void __user *arg) { struct cdrom_tochdr tochdr; tochdr.cdth_trk0 = disk_info.first; tochdr.cdth_trk1 = disk_info.last; - return copy_to_user((void *)arg, &tochdr, sizeof tochdr) ? -EFAULT : 0; + return copy_to_user(arg, &tochdr, sizeof tochdr) ? -EFAULT : 0; } -static int cdromreadtocentry(unsigned long arg) +static int cdromreadtocentry(void __user *arg) { struct cdrom_tocentry entry; struct cdrom_subchnl *tocptr; - if (copy_from_user(&entry, (void *) arg, sizeof entry)) + if (copy_from_user(&entry, arg, sizeof entry)) return -EFAULT; if (entry.cdte_track == CDROM_LEADOUT) @@ -1544,17 +1544,17 @@ else if (entry.cdte_format != CDROM_MSF) return -EINVAL; - return copy_to_user((void *)arg, &entry, sizeof entry) ? -EFAULT : 0; + return copy_to_user(arg, &entry, sizeof entry) ? -EFAULT : 0; } -static int cdromvolctrl(unsigned long arg) +static int cdromvolctrl(void __user *arg) { int status; struct cdrom_volctrl volctrl; struct cdrom_msf msf; - if (copy_from_user(&volctrl, (char *) arg, sizeof volctrl)) + if (copy_from_user(&volctrl, arg, sizeof volctrl)) return -EFAULT; msf.cdmsf_min0 = 0x10; @@ -1573,12 +1573,12 @@ } -static int cdromsubchnl(unsigned long arg) +static int cdromsubchnl(void __user *arg) { int status; struct cdrom_subchnl subchnl; - if (copy_from_user(&subchnl, (void *) arg, sizeof subchnl)) + if (copy_from_user(&subchnl, arg, sizeof subchnl)) return -EFAULT; if (subchnl.cdsc_format != CDROM_LBA @@ -1591,7 +1591,7 @@ return -EIO; } - if (copy_to_user((void *)arg, &subchnl, sizeof subchnl)) + if (copy_to_user(arg, &subchnl, sizeof subchnl)) return -EFAULT; return 0; } @@ -1600,12 +1600,12 @@ static struct gendisk *optcd_disk; -static int cdromread(unsigned long arg, int blocksize, int cmd) +static int cdromread(void __user *arg, int blocksize, int cmd) { int status; struct cdrom_msf msf; - if (copy_from_user(&msf, (void *) arg, sizeof msf)) + if (copy_from_user(&msf, arg, sizeof msf)) return -EFAULT; bin2bcd(&msf); @@ -1621,19 +1621,19 @@ fetch_data(optcd_disk->private_data, blocksize); - if (copy_to_user((void *)arg, optcd_disk->private_data, blocksize)) + if (copy_to_user(arg, optcd_disk->private_data, blocksize)) return -EFAULT; return 0; } -static int cdromseek(unsigned long arg) +static int cdromseek(void __user *arg) { int status; struct cdrom_msf msf; - if (copy_from_user(&msf, (void *)arg, sizeof msf)) + if (copy_from_user(&msf, arg, sizeof msf)) return -EFAULT; bin2bcd(&msf); @@ -1648,11 +1648,11 @@ #ifdef MULTISESSION -static int cdrommultisession(unsigned long arg) +static int cdrommultisession(void __user *arg) { struct cdrom_multisession ms; - if (copy_from_user(&ms, (void*) arg, sizeof ms)) + if (copy_from_user(&ms, arg, sizeof ms)) return -EFAULT; ms.addr.msf.minute = disk_info.last_session.minute; @@ -1667,7 +1667,7 @@ ms.xa_flag = disk_info.xa; - if (copy_to_user((void *)arg, &ms, sizeof(struct cdrom_multisession))) + if (copy_to_user(arg, &ms, sizeof(struct cdrom_multisession))) return -EFAULT; #if DEBUG_MULTIS @@ -1717,6 +1717,7 @@ unsigned int cmd, unsigned long arg) { int status, err, retval = 0; + void __user *argp = (void __user *)arg; DEBUG((DEBUG_VFS, "starting opt_ioctl")); @@ -1767,10 +1768,10 @@ switch (cmd) { case CDROMPAUSE: retval = cdrompause(); break; case CDROMRESUME: retval = cdromresume(); break; - case CDROMPLAYMSF: retval = cdromplaymsf(arg); break; - case CDROMPLAYTRKIND: retval = cdromplaytrkind(arg); break; - case CDROMREADTOCHDR: retval = cdromreadtochdr(arg); break; - case CDROMREADTOCENTRY: retval = cdromreadtocentry(arg); break; + case CDROMPLAYMSF: retval = cdromplaymsf(argp); break; + case CDROMPLAYTRKIND: retval = cdromplaytrkind(argp); break; + case CDROMREADTOCHDR: retval = cdromreadtochdr(argp); break; + case CDROMREADTOCENTRY: retval = cdromreadtocentry(argp); break; case CDROMSTOP: err = exec_cmd(COMSTOP); if (err < 0) { @@ -1799,8 +1800,8 @@ } break; - case CDROMVOLCTRL: retval = cdromvolctrl(arg); break; - case CDROMSUBCHNL: retval = cdromsubchnl(arg); break; + case CDROMVOLCTRL: retval = cdromvolctrl(argp); break; + case CDROMSUBCHNL: retval = cdromsubchnl(argp); break; /* The drive detects the mode and automatically delivers the correct 2048 bytes, so we don't need these IOCTLs */ @@ -1814,7 +1815,7 @@ break; #ifdef MULTISESSION - case CDROMMULTISESSION: retval = cdrommultisession(arg); break; + case CDROMMULTISESSION: retval = cdrommultisession(argp); break; #endif case CDROM_GET_MCN: retval = -EINVAL; break; /* not implemented */ @@ -1822,16 +1823,16 @@ case CDROMREADRAW: /* this drive delivers 2340 bytes in raw mode */ - retval = cdromread(arg, CD_FRAMESIZE_RAW1, COMREADRAW); + retval = cdromread(argp, CD_FRAMESIZE_RAW1, COMREADRAW); break; case CDROMREADCOOKED: - retval = cdromread(arg, CD_FRAMESIZE, COMREAD); + retval = cdromread(argp, CD_FRAMESIZE, COMREAD); break; case CDROMREADALL: - retval = cdromread(arg, CD_FRAMESIZE_RAWER, COMREADALL); + retval = cdromread(argp, CD_FRAMESIZE_RAWER, COMREADALL); break; - case CDROMSEEK: retval = cdromseek(arg); break; + case CDROMSEEK: retval = cdromseek(argp); break; case CDROMPLAYBLK: retval = -EINVAL; break; /* not implemented */ case CDROMCLOSETRAY: break; /* The action was taken earlier */ default: retval = -EINVAL; diff -urN linux-2.6.7-rc2/drivers/cdrom/sjcd.c linux-2.6.7-rc3/drivers/cdrom/sjcd.c --- linux-2.6.7-rc2/drivers/cdrom/sjcd.c 2004-05-09 19:32:53.000000000 -0700 +++ linux-2.6.7-rc3/drivers/cdrom/sjcd.c 2004-06-07 12:55:04.261674366 -0700 @@ -716,13 +716,11 @@ static int sjcd_ioctl(struct inode *ip, struct file *fp, unsigned int cmd, unsigned long arg) { + void __user *argp = (void __user *)arg; #if defined( SJCD_TRACE ) printk("SJCD:ioctl\n"); #endif - if (ip == NULL) - return (-EINVAL); - sjcd_get_status(); if (!sjcd_status_valid) return (-EIO); @@ -795,7 +793,7 @@ #if defined( SJCD_TRACE ) printk("SJCD: ioctl: playtrkind\n"); #endif - if (!copy_from_user(&ti, (void *) arg, sizeof(ti))) { + if (!copy_from_user(&ti, argp, sizeof(ti))) { s = 0; if (ti.cdti_trk0 < sjcd_first_track_no) return (-EINVAL); @@ -833,7 +831,7 @@ printk("SJCD: ioctl: playmsf\n"); #endif if ((s = - verify_area(VERIFY_READ, (void *) arg, + verify_area(VERIFY_READ, argp, sizeof(sjcd_msf))) == 0) { if (sjcd_audio_status == CDROM_AUDIO_PLAY) { sjcd_send_cmd(SCMD_PAUSE); @@ -842,7 +840,7 @@ CDROM_AUDIO_NO_STATUS; } - if (copy_from_user(&sjcd_msf, (void *) arg, + if (copy_from_user(&sjcd_msf, argp, sizeof(sjcd_msf))) return (-EFAULT); @@ -877,7 +875,7 @@ #endif toc_header.cdth_trk0 = sjcd_first_track_no; toc_header.cdth_trk1 = sjcd_last_track_no; - if (copy_to_user((void *)arg, &toc_header, + if (copy_to_user(argp, &toc_header, sizeof(toc_header))) return -EFAULT; return 0; @@ -890,11 +888,11 @@ printk("SJCD: ioctl: readtocentry\n"); #endif if ((s = - verify_area(VERIFY_WRITE, (void *) arg, + verify_area(VERIFY_WRITE, argp, sizeof(toc_entry))) == 0) { struct sjcd_hw_disk_info *tp; - if (copy_from_user(&toc_entry, (void *) arg, + if (copy_from_user(&toc_entry, argp, sizeof(toc_entry))) return (-EFAULT); if (toc_entry.cdte_track == CDROM_LEADOUT) @@ -931,7 +929,7 @@ default: return (-EINVAL); } - if (copy_to_user((void *) arg, &toc_entry, + if (copy_to_user(argp, &toc_entry, sizeof(toc_entry))) s = -EFAULT; } @@ -945,11 +943,11 @@ printk("SJCD: ioctl: subchnl\n"); #endif if ((s = - verify_area(VERIFY_WRITE, (void *) arg, + verify_area(VERIFY_WRITE, argp, sizeof(subchnl))) == 0) { struct sjcd_hw_qinfo q_info; - if (copy_from_user(&subchnl, (void *) arg, + if (copy_from_user(&subchnl, argp, sizeof(subchnl))) return (-EFAULT); @@ -990,7 +988,7 @@ default: return (-EINVAL); } - if (copy_to_user((void *) arg, &subchnl, + if (copy_to_user(argp, &subchnl, sizeof(subchnl))) s = -EFAULT; } @@ -1004,11 +1002,11 @@ printk("SJCD: ioctl: volctrl\n"); #endif if ((s = - verify_area(VERIFY_READ, (void *) arg, + verify_area(VERIFY_READ, argp, sizeof(vol_ctrl))) == 0) { unsigned char dummy[4]; - if (copy_from_user(&vol_ctrl, (void *) arg, + if (copy_from_user(&vol_ctrl, argp, sizeof(vol_ctrl))) return (-EFAULT); sjcd_send_4_cmd(SCMD_SET_VOLUME, @@ -1038,8 +1036,7 @@ #if defined( SJCD_TRACE ) printk("SJCD: ioctl: statistic\n"); #endif - if (copy_to_user((void *)arg, &statistic, - sizeof(statistic))) + if (copy_to_user(argp, &statistic, sizeof(statistic))) return -EFAULT; return 0; } diff -urN linux-2.6.7-rc2/drivers/cdrom/sonycd535.c linux-2.6.7-rc3/drivers/cdrom/sonycd535.c --- linux-2.6.7-rc2/drivers/cdrom/sonycd535.c 2004-05-09 19:32:27.000000000 -0700 +++ linux-2.6.7-rc3/drivers/cdrom/sonycd535.c 2004-06-07 12:55:04.264674490 -0700 @@ -997,7 +997,7 @@ * (not BCD), so all the conversions are done. */ static int -sony_get_subchnl_info(long arg) +sony_get_subchnl_info(void __user *arg) { struct cdrom_subchnl schi; @@ -1009,7 +1009,7 @@ if (!sony_toc_read) { return -EIO; } - if (copy_from_user(&schi, (char *)arg, sizeof schi)) + if (copy_from_user(&schi, arg, sizeof schi)) return -EFAULT; switch (sony_audio_status) { @@ -1025,7 +1025,7 @@ case CDROM_AUDIO_NO_STATUS: schi.cdsc_audiostatus = sony_audio_status; - if (copy_to_user((char *)arg, &schi, sizeof schi)) + if (copy_to_user(arg, &schi, sizeof schi)) return -EFAULT; return 0; break; @@ -1053,7 +1053,7 @@ schi.cdsc_absaddr.lba = msf_to_log(last_sony_subcode->abs_msf); schi.cdsc_reladdr.lba = msf_to_log(last_sony_subcode->rel_msf); } - return copy_to_user((char *)arg, &schi, sizeof schi) ? -EFAULT : 0; + return copy_to_user(arg, &schi, sizeof schi) ? -EFAULT : 0; } @@ -1070,6 +1070,7 @@ Byte cmd_buff[10], params[10]; int i; int dsc_status; + void __user *argp = (void __user *)arg; if (check_drive_status() != 0) return -EIO; @@ -1152,7 +1153,7 @@ break; case CDROMPLAYMSF: /* Play starting at the given MSF address. */ - if (copy_from_user(params, (void *)arg, 6)) + if (copy_from_user(params, argp, 6)) return -EFAULT; spin_up_drive(status); set_drive_mode(SONY535_AUDIO_DRIVE_MODE, status); @@ -1184,13 +1185,12 @@ case CDROMREADTOCHDR: /* Read the table of contents header */ { - struct cdrom_tochdr *hdr; + struct cdrom_tochdr __user *hdr = argp; struct cdrom_tochdr loc_hdr; sony_get_toc(); if (!sony_toc_read) return -EIO; - hdr = (struct cdrom_tochdr *)arg; loc_hdr.cdth_trk0 = bcd_to_int(sony_toc->first_track_num); loc_hdr.cdth_trk1 = bcd_to_int(sony_toc->last_track_num); if (copy_to_user(hdr, &loc_hdr, sizeof *hdr)) @@ -1201,7 +1201,7 @@ case CDROMREADTOCENTRY: /* Read a given table of contents entry */ { - struct cdrom_tocentry *entry; + struct cdrom_tocentry __user *entry = argp; struct cdrom_tocentry loc_entry; int track_idx; Byte *msf_val = NULL; @@ -1210,7 +1210,6 @@ if (!sony_toc_read) { return -EIO; } - entry = (struct cdrom_tocentry *)arg; if (copy_from_user(&loc_entry, entry, sizeof loc_entry)) return -EFAULT; @@ -1252,7 +1251,7 @@ if (!sony_toc_read) return -EIO; - if (copy_from_user(&ti, (char *)arg, sizeof ti)) + if (copy_from_user(&ti, argp, sizeof ti)) return -EFAULT; if ((ti.cdti_trk0 < sony_toc->first_track_num) || (sony_toc->last_track_num < ti.cdti_trk0) @@ -1314,14 +1313,13 @@ } case CDROMSUBCHNL: /* Get subchannel info */ - return sony_get_subchnl_info(arg); + return sony_get_subchnl_info(argp); case CDROMVOLCTRL: /* Volume control. What volume does this change, anyway? */ { struct cdrom_volctrl volctrl; - if (copy_from_user(&volctrl, (char *)arg, - sizeof volctrl)) + if (copy_from_user(&volctrl, argp, sizeof volctrl)) return -EFAULT; cmd_buff[0] = SONY535_SET_VOLUME; cmd_buff[1] = volctrl.channel0; diff -urN linux-2.6.7-rc2/drivers/char/agp/amd-k7-agp.c linux-2.6.7-rc3/drivers/char/agp/amd-k7-agp.c --- linux-2.6.7-rc2/drivers/char/agp/amd-k7-agp.c 2004-05-09 19:33:21.000000000 -0700 +++ linux-2.6.7-rc3/drivers/char/agp/amd-k7-agp.c 2004-06-07 12:55:04.266674573 -0700 @@ -20,6 +20,8 @@ #define AMD_TLBFLUSH 0x0c /* In mmio region (32-bit register) */ #define AMD_CACHEENTRY 0x10 /* In mmio region (32-bit register) */ +static struct pci_device_id agp_amdk7_pci_table[]; + struct amd_page_map { unsigned long *real; unsigned long *remapped; @@ -41,7 +43,7 @@ SetPageReserved(virt_to_page(page_map->real)); global_cache_flush(); - page_map->remapped = ioremap_nocache(virt_to_phys(page_map->real), + page_map->remapped = ioremap_nocache(virt_to_phys(page_map->real), PAGE_SIZE); if (page_map->remapped == NULL) { ClearPageReserved(virt_to_page(page_map->real)); @@ -90,7 +92,7 @@ int retval = 0; int i; - tables = kmalloc((nr_tables + 1) * sizeof(struct amd_page_map *), + tables = kmalloc((nr_tables + 1) * sizeof(struct amd_page_map *), GFP_KERNEL); if (tables == NULL) return -ENOMEM; @@ -124,7 +126,7 @@ #define GET_PAGE_DIR_OFF(addr) (addr >> 22) #define GET_PAGE_DIR_IDX(addr) (GET_PAGE_DIR_OFF(addr) - \ GET_PAGE_DIR_OFF(agp_bridge->gart_bus_addr)) -#define GET_GATT_OFF(addr) ((addr & 0x003ff000) >> 12) +#define GET_GATT_OFF(addr) ((addr & 0x003ff000) >> 12) #define GET_GATT(addr) (amd_irongate_private.gatt_pages[\ GET_PAGE_DIR_IDX(addr)]->remapped) @@ -174,7 +176,7 @@ static int amd_free_gatt_table(void) { struct amd_page_map page_dir; - + page_dir.real = (unsigned long *)agp_bridge->gatt_table_real; page_dir.remapped = (unsigned long *)agp_bridge->gatt_table; @@ -224,9 +226,9 @@ /* Write the Sync register */ pci_write_config_byte(agp_bridge->dev, AMD_MODECNTL, 0x80); - - /* Set indexing mode */ - pci_write_config_byte(agp_bridge->dev, AMD_MODECNTL2, 0x00); + + /* Set indexing mode */ + pci_write_config_byte(agp_bridge->dev, AMD_MODECNTL2, 0x00); /* Write the enable register */ enable_reg = INREG16(amd_irongate_private.registers, AMD_GARTENABLE); @@ -394,7 +396,6 @@ static int __devinit agp_amdk7_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { - struct agp_device_ids *devs = amd_agp_device_ids; struct agp_bridge_data *bridge; u8 cap_ptr; int j; @@ -403,19 +404,10 @@ if (!cap_ptr) return -ENODEV; - for (j = 0; devs[j].chipset_name; j++) { - if (pdev->device == devs[j].device_id) { - printk (KERN_INFO PFX "Detected AMD %s chipset\n", - devs[j].chipset_name); - goto found; - } - } - - printk(KERN_ERR PFX "Unsupported AMD chipset (device id: %04x)\n", - pdev->device); - return -ENODEV; + j = ent - agp_amdk7_pci_table; + printk(KERN_INFO PFX "Detected AMD %s chipset\n", + amd_agp_device_ids[j].chipset_name); -found: bridge = agp_alloc_bridge(); if (!bridge) return -ENOMEM; @@ -442,12 +434,29 @@ agp_put_bridge(bridge); } +/* must be the same order as name table above */ static struct pci_device_id agp_amdk7_pci_table[] = { { .class = (PCI_CLASS_BRIDGE_HOST << 8), .class_mask = ~0, .vendor = PCI_VENDOR_ID_AMD, - .device = PCI_ANY_ID, + .device = PCI_DEVICE_ID_AMD_FE_GATE_7006, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + }, + { + .class = (PCI_CLASS_BRIDGE_HOST << 8), + .class_mask = ~0, + .vendor = PCI_VENDOR_ID_AMD, + .device = PCI_DEVICE_ID_AMD_FE_GATE_700E, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + }, + { + .class = (PCI_CLASS_BRIDGE_HOST << 8), + .class_mask = ~0, + .vendor = PCI_VENDOR_ID_AMD, + .device = PCI_DEVICE_ID_AMD_FE_GATE_700C, .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, }, diff -urN linux-2.6.7-rc2/drivers/char/agp/amd64-agp.c linux-2.6.7-rc3/drivers/char/agp/amd64-agp.c --- linux-2.6.7-rc2/drivers/char/agp/amd64-agp.c 2004-05-09 19:32:53.000000000 -0700 +++ linux-2.6.7-rc3/drivers/char/agp/amd64-agp.c 2004-06-07 12:55:04.267674614 -0700 @@ -1,7 +1,7 @@ -/* +/* * Copyright 2001-2003 SuSE Labs. * Distributed under the GNU public license, v2. - * + * * This is a GART driver for the AMD Opteron/Athlon64 on-CPU northbridge. * It also includes support for the AMD 8151 AGP bridge, * although it doesn't actually do much, as all the real @@ -194,7 +194,7 @@ /* keep CPU's coherent. */ flush_amd64_tlb (hammer); - + return aper_base; } @@ -261,53 +261,53 @@ /* Some basic sanity checks for the aperture. */ static int __devinit aperture_valid(u64 aper, u32 size) -{ +{ u32 pfn, c; - if (aper == 0) { + if (aper == 0) { printk(KERN_ERR PFX "No aperture\n"); - return 0; + return 0; } if (size < 32*1024*1024) { printk(KERN_ERR PFX "Aperture too small (%d MB)\n", size>>20); return 0; } - if (aper + size > 0xffffffff) { - printk(KERN_ERR PFX "Aperture out of bounds\n"); + if (aper + size > 0xffffffff) { + printk(KERN_ERR PFX "Aperture out of bounds\n"); return 0; - } + } pfn = aper >> PAGE_SHIFT; - for (c = 0; c < size/PAGE_SIZE; c++) { + for (c = 0; c < size/PAGE_SIZE; c++) { if (!pfn_valid(pfn + c)) break; - if (!PageReserved(pfn_to_page(pfn + c))) { + if (!PageReserved(pfn_to_page(pfn + c))) { printk(KERN_ERR PFX "Aperture pointing to RAM\n"); return 0; } } /* Request the Aperture. This catches cases when someone else - already put a mapping in there - happens with some very broken BIOS + already put a mapping in there - happens with some very broken BIOS - Maybe better to use pci_assign_resource/pci_enable_device instead trusting - the bridges? */ + Maybe better to use pci_assign_resource/pci_enable_device instead + trusting the bridges? */ if (!aperture_resource && !(aperture_resource = request_mem_region(aper, size, "aperture"))) { - printk(KERN_ERR PFX "Aperture conflicts with PCI mapping.\n"); + printk(KERN_ERR PFX "Aperture conflicts with PCI mapping.\n"); return 0; } return 1; -} +} -/* +/* * W*s centric BIOS sometimes only set up the aperture in the AGP - * bridge, not the northbridge. On AMD64 this is handled early + * bridge, not the northbridge. On AMD64 this is handled early * in aperture.c, but when GART_IOMMU is not enabled or we run - * on a 32bit kernel this needs to be redone. + * on a 32bit kernel this needs to be redone. * Unfortunately it is impossible to fix the aperture here because it's too late * to allocate that much memory. But at least error out cleanly instead of * crashing. - */ -static __devinit int fix_northbridge(struct pci_dev *nb, struct pci_dev *agp, + */ +static __devinit int fix_northbridge(struct pci_dev *nb, struct pci_dev *agp, u16 cap) { u32 aper_low, aper_hi; @@ -316,38 +316,38 @@ u32 nb_order, nb_base; u16 apsize; - pci_read_config_dword(nb, 0x90, &nb_order); + pci_read_config_dword(nb, 0x90, &nb_order); nb_order = (nb_order >> 1) & 7; - pci_read_config_dword(nb, 0x94, &nb_base); - nb_aper = nb_base << 25; - if (aperture_valid(nb_aper, (32*1024*1024)<> 25); + return -1; + + pci_write_config_dword(nb, 0x90, order << 1); + pci_write_config_dword(nb, 0x94, aper >> 25); return 0; -} +} static __devinit int cache_nbs (struct pci_dev *pdev, u32 cap_ptr) { @@ -355,19 +355,19 @@ int i = 0; /* cache pci_devs of northbridges. */ - while ((loop_dev = pci_find_device(PCI_VENDOR_ID_AMD, 0x1103, loop_dev)) + while ((loop_dev = pci_find_device(PCI_VENDOR_ID_AMD, 0x1103, loop_dev)) != NULL) { - if (i == MAX_HAMMER_GARTS) { + if (i == MAX_HAMMER_GARTS) { printk(KERN_ERR PFX "Too many northbridges for AGP\n"); return -1; } - if (fix_northbridge(loop_dev, pdev, cap_ptr) < 0) { + if (fix_northbridge(loop_dev, pdev, cap_ptr) < 0) { printk(KERN_ERR PFX "No usable aperture found.\n"); -#ifdef __x86_64__ +#ifdef __x86_64__ /* should port this to i386 */ printk(KERN_ERR PFX "Consider rebooting with iommu=memaper=2 to get a good aperture.\n"); -#endif - return -1; +#endif + return -1; } hammers[i++] = loop_dev; } @@ -377,8 +377,7 @@ /* Handle AMD 8151 quirks */ static void __devinit amd8151_init(struct pci_dev *pdev, struct agp_bridge_data *bridge) - -{ +{ char *revstring; u8 rev_id; @@ -417,12 +416,12 @@ /* Handle shadow device of the Nvidia NForce3 */ /* CHECK-ME original 2.4 version set up some IORRs. Check if that is needed. */ -static int __devinit nforce3_agp_init(struct pci_dev *pdev) -{ +static int __devinit nforce3_agp_init(struct pci_dev *pdev) +{ u32 tmp, apbase, apbar, aplimit; - struct pci_dev *dev1; + struct pci_dev *dev1; int i; - unsigned size = amd64_fetch_size(); + unsigned size = amd64_fetch_size(); printk(KERN_INFO PFX "Setting up Nforce3 AGP.\n"); @@ -432,17 +431,17 @@ "nForce3 chipset, but could not find " "the secondary device.\n"); return -ENODEV; - } + } - for (i = 0; i < ARRAY_SIZE(nforce3_sizes); i++) + for (i = 0; i < ARRAY_SIZE(nforce3_sizes); i++) if (nforce3_sizes[i].size == size) - break; + break; if (i == ARRAY_SIZE(nforce3_sizes)) { - printk(KERN_INFO PFX "No NForce3 size found for %d\n", size); - return -ENODEV; + printk(KERN_INFO PFX "No NForce3 size found for %d\n", size); + return -ENODEV; } - + pci_read_config_dword(dev1, NVIDIA_X86_64_1_APSIZE, &tmp); tmp &= ~(0xf); tmp |= nforce3_sizes[i].size_value; @@ -491,8 +490,7 @@ pdev->device == PCI_DEVICE_ID_AMD_8151_0) { amd8151_init(pdev, bridge); } else { - printk(KERN_INFO PFX "Detected AGP bridge %x\n", - pdev->devfn); + printk(KERN_INFO PFX "Detected AGP bridge %x\n", pdev->devfn); } bridge->driver = &amd_8151_driver; @@ -507,10 +505,10 @@ return -ENODEV; } - if (pdev->vendor == PCI_VENDOR_ID_NVIDIA) { + if (pdev->vendor == PCI_VENDOR_ID_NVIDIA) { int ret = nforce3_agp_init(pdev); - if (ret) { - agp_put_bridge(bridge); + if (ret) { + agp_put_bridge(bridge); return ret; } } @@ -523,8 +521,8 @@ { struct agp_bridge_data *bridge = pci_get_drvdata(pdev); - release_mem_region(virt_to_phys(bridge->gatt_table_real), - amd64_aperture_sizes[bridge->aperture_size_idx].size); + release_mem_region(virt_to_phys(bridge->gatt_table_real), + amd64_aperture_sizes[bridge->aperture_size_idx].size); agp_remove_bridge(bridge); agp_put_bridge(bridge); } @@ -581,6 +579,15 @@ .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, }, + /* SIS 755 */ + { + .class = (PCI_CLASS_BRIDGE_HOST << 8), + .class_mask = ~0, + .vendor = PCI_VENDOR_ID_SI, + .device = PCI_DEVICE_ID_SI_755, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + }, { } }; @@ -600,15 +607,15 @@ int err = 0; if (agp_off) return -EINVAL; - if (pci_module_init(&agp_amd64_pci_driver) > 0) { + if (pci_module_init(&agp_amd64_pci_driver) > 0) { struct pci_dev *dev; - if (!agp_try_unsupported && !agp_try_unsupported_boot) { + if (!agp_try_unsupported && !agp_try_unsupported_boot) { printk(KERN_INFO PFX "No supported AGP bridge found.\n"); -#ifdef MODULE +#ifdef MODULE printk(KERN_INFO PFX "You can try agp_try_unsupported=1\n"); #else printk(KERN_INFO PFX "You can boot with agp=try_unsupported\n"); -#endif +#endif return -ENODEV; } @@ -622,12 +629,12 @@ while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev))) { if (!pci_find_capability(dev, PCI_CAP_ID_AGP)) continue; - /* Only one bridge supported right now */ + /* Only one bridge supported right now */ if (agp_amd64_probe(dev, NULL) == 0) { err = 0; break; - } - } + } + } } return err; } diff -urN linux-2.6.7-rc2/drivers/char/agp/ati-agp.c linux-2.6.7-rc3/drivers/char/agp/ati-agp.c --- linux-2.6.7-rc2/drivers/char/agp/ati-agp.c 2004-05-09 19:32:54.000000000 -0700 +++ linux-2.6.7-rc3/drivers/char/agp/ati-agp.c 2004-06-07 12:55:04.267674614 -0700 @@ -131,6 +131,7 @@ i--; } kfree (tables); + tables = NULL; retval = -ENOMEM; break; } diff -urN linux-2.6.7-rc2/drivers/char/agp/backend.c linux-2.6.7-rc3/drivers/char/agp/backend.c --- linux-2.6.7-rc2/drivers/char/agp/backend.c 2004-05-09 19:32:53.000000000 -0700 +++ linux-2.6.7-rc3/drivers/char/agp/backend.c 2004-06-07 12:55:04.268674656 -0700 @@ -238,11 +238,14 @@ } EXPORT_SYMBOL(agp_put_bridge); - + int agp_add_bridge(struct agp_bridge_data *bridge) { int error; + if (agp_off) + return -ENODEV; + if (!bridge->dev) { printk (KERN_DEBUG PFX "Erk, registering with no pci_dev!\n"); return -EINVAL; @@ -308,9 +311,9 @@ static int __init agp_init(void) { - if (!agp_off) - printk(KERN_INFO "Linux agpgart interface v%d.%d (c) Dave Jones\n", - AGPGART_VERSION_MAJOR, AGPGART_VERSION_MINOR); + if (!agp_off) + printk(KERN_INFO "Linux agpgart interface v%d.%d (c) Dave Jones\n", + AGPGART_VERSION_MAJOR, AGPGART_VERSION_MINOR); return 0; } @@ -325,7 +328,7 @@ agp_off = 1; if (!strcmp(s,"try_unsupported")) agp_try_unsupported_boot = 1; - return 1; + return 1; } __setup("agp=", agp_setup); #endif diff -urN linux-2.6.7-rc2/drivers/char/agp/intel-agp.c linux-2.6.7-rc3/drivers/char/agp/intel-agp.c --- linux-2.6.7-rc2/drivers/char/agp/intel-agp.c 2004-05-09 19:32:36.000000000 -0700 +++ linux-2.6.7-rc3/drivers/char/agp/intel-agp.c 2004-06-07 12:55:04.269674697 -0700 @@ -1233,7 +1233,7 @@ name); return 0; } - + intel_i810_private.i810_dev = i810_dev; return 1; } @@ -1382,8 +1382,10 @@ name = "E7205"; break; default: - printk(KERN_ERR PFX "Unsupported Intel chipset (device id: %04x)\n", + if (cap_ptr) + printk(KERN_WARNING PFX "Unsupported Intel chipset (device id: %04x)\n", pdev->device); + agp_put_bridge(bridge); return -ENODEV; }; @@ -1406,7 +1408,8 @@ if (!r->start && r->end) { if(pci_assign_resource(pdev, 0)) { printk(KERN_ERR PFX "could not assign resource 0\n"); - return (-ENODEV); + agp_put_bridge(bridge); + return -ENODEV; } } @@ -1417,7 +1420,8 @@ */ if (pci_enable_device(pdev)) { printk(KERN_ERR PFX "Unable to Enable PCI device\n"); - return (-ENODEV); + agp_put_bridge(bridge); + return -ENODEV; } /* Fill in the mode register */ @@ -1442,14 +1446,11 @@ agp_put_bridge(bridge); } -static int agp_intel_suspend(struct pci_dev *dev, u32 state) -{ - return 0; -} - static int agp_intel_resume(struct pci_dev *pdev) { struct agp_bridge_data *bridge = pci_get_drvdata(pdev); + + pci_restore_state(pdev, pdev->saved_config_space); if (bridge->driver == &intel_generic_driver) intel_configure(); @@ -1462,14 +1463,36 @@ } static struct pci_device_id agp_intel_pci_table[] = { - { - .class = (PCI_CLASS_BRIDGE_HOST << 8), - .class_mask = ~0, - .vendor = PCI_VENDOR_ID_INTEL, - .device = PCI_ANY_ID, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - }, +#define ID(x) \ + { \ + .class = (PCI_CLASS_BRIDGE_HOST << 8), \ + .class_mask = ~0, \ + .vendor = PCI_VENDOR_ID_INTEL, \ + .device = x, \ + .subvendor = PCI_ANY_ID, \ + .subdevice = PCI_ANY_ID, \ + } + ID(PCI_DEVICE_ID_INTEL_82443LX_0), + ID(PCI_DEVICE_ID_INTEL_82443BX_0), + ID(PCI_DEVICE_ID_INTEL_82443GX_0), + ID(PCI_DEVICE_ID_INTEL_82810_MC1), + ID(PCI_DEVICE_ID_INTEL_82810_MC3), + ID(PCI_DEVICE_ID_INTEL_82810E_MC), + ID(PCI_DEVICE_ID_INTEL_82815_MC), + ID(PCI_DEVICE_ID_INTEL_82820_HB), + ID(PCI_DEVICE_ID_INTEL_82820_UP_HB), + ID(PCI_DEVICE_ID_INTEL_82830_HB), + ID(PCI_DEVICE_ID_INTEL_82840_HB), + ID(PCI_DEVICE_ID_INTEL_82845_HB), + ID(PCI_DEVICE_ID_INTEL_82845G_HB), + ID(PCI_DEVICE_ID_INTEL_82850_HB), + ID(PCI_DEVICE_ID_INTEL_82855PM_HB), + ID(PCI_DEVICE_ID_INTEL_82855GM_HB), + ID(PCI_DEVICE_ID_INTEL_82860_HB), + ID(PCI_DEVICE_ID_INTEL_82865_HB), + ID(PCI_DEVICE_ID_INTEL_82875_HB), + ID(PCI_DEVICE_ID_INTEL_7505_0), + ID(PCI_DEVICE_ID_INTEL_7205_0), { } }; @@ -1480,7 +1503,6 @@ .id_table = agp_intel_pci_table, .probe = agp_intel_probe, .remove = agp_intel_remove, - .suspend = agp_intel_suspend, .resume = agp_intel_resume, }; diff -urN linux-2.6.7-rc2/drivers/char/agp/intel-mch-agp.c linux-2.6.7-rc3/drivers/char/agp/intel-mch-agp.c --- linux-2.6.7-rc2/drivers/char/agp/intel-mch-agp.c 2004-05-09 19:32:00.000000000 -0700 +++ linux-2.6.7-rc3/drivers/char/agp/intel-mch-agp.c 2004-06-07 12:55:04.269674697 -0700 @@ -491,10 +491,9 @@ char *name = "(unknown)"; u8 cap_ptr = 0; - if (!boot_cpu_has(X86_FEATURE_LM)) - return -ENODEV; - cap_ptr = pci_find_capability(pdev, PCI_CAP_ID_AGP); + if (!cap_ptr) + return -ENODEV; bridge = agp_alloc_bridge(); if (!bridge) @@ -570,14 +569,11 @@ agp_put_bridge(bridge); } -static int agp_intelmch_suspend(struct pci_dev *dev, u32 state) -{ - return 0; -} - static int agp_intelmch_resume(struct pci_dev *pdev) { struct agp_bridge_data *bridge = pci_get_drvdata(pdev); + + pci_restore_state(pdev, pdev->saved_config_space); if (bridge->driver == &intel_845_driver) intel_845_configure(); @@ -590,7 +586,15 @@ .class = (PCI_CLASS_BRIDGE_HOST << 8), .class_mask = ~0, .vendor = PCI_VENDOR_ID_INTEL, - .device = PCI_ANY_ID, + .device = PCI_DEVICE_ID_INTEL_82865_HB, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + }, + { + .class = (PCI_CLASS_BRIDGE_HOST << 8), + .class_mask = ~0, + .vendor = PCI_VENDOR_ID_INTEL, + .device = PCI_DEVICE_ID_INTEL_82875_HB, .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, }, @@ -604,7 +608,6 @@ .id_table = agp_intelmch_pci_table, .probe = agp_intelmch_probe, .remove = agp_intelmch_remove, - .suspend = agp_intelmch_suspend, .resume = agp_intelmch_resume, }; diff -urN linux-2.6.7-rc2/drivers/char/agp/nvidia-agp.c linux-2.6.7-rc3/drivers/char/agp/nvidia-agp.c --- linux-2.6.7-rc2/drivers/char/agp/nvidia-agp.c 2004-05-09 19:32:02.000000000 -0700 +++ linux-2.6.7-rc3/drivers/char/agp/nvidia-agp.c 2004-06-07 12:55:04.270674739 -0700 @@ -380,7 +380,15 @@ .class = (PCI_CLASS_BRIDGE_HOST << 8), .class_mask = ~0, .vendor = PCI_VENDOR_ID_NVIDIA, - .device = PCI_ANY_ID, + .device = PCI_DEVICE_ID_NVIDIA_NFORCE, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + }, + { + .class = (PCI_CLASS_BRIDGE_HOST << 8), + .class_mask = ~0, + .vendor = PCI_VENDOR_ID_NVIDIA, + .device = PCI_DEVICE_ID_NVIDIA_NFORCE2, .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, }, diff -urN linux-2.6.7-rc2/drivers/char/agp/sis-agp.c linux-2.6.7-rc3/drivers/char/agp/sis-agp.c --- linux-2.6.7-rc2/drivers/char/agp/sis-agp.c 2004-05-09 19:31:59.000000000 -0700 +++ linux-2.6.7-rc3/drivers/char/agp/sis-agp.c 2004-06-07 12:55:04.270674739 -0700 @@ -13,6 +13,8 @@ #define SIS_TLBCNTRL 0x97 #define SIS_TLBFLUSH 0x98 +static int __devinitdata agp_sis_force_delay = 0; +static int __devinitdata agp_sis_agp_spec = -1; static int sis_fetch_size(void) { @@ -67,7 +69,7 @@ (previous_size->size_value & ~(0x03))); } -static void sis_648_enable(u32 mode) +static void sis_delayed_enable(u32 mode) { struct pci_dev *device = NULL; u32 command; @@ -94,13 +96,12 @@ pci_write_config_dword(device, agp + PCI_AGP_COMMAND, command); /* - * Weird: on 648(fx) and 746(fx) chipsets any rate change in the target + * Weird: on some sis chipsets any rate change in the target * command register triggers a 5ms screwup during which the master * cannot be configured */ - if (device->device == PCI_DEVICE_ID_SI_648 || - device->device == PCI_DEVICE_ID_SI_746) { - printk(KERN_INFO PFX "SiS chipset with AGP problems detected. Giving bridge time to recover.\n"); + if (device->device == agp_bridge->dev->device) { + printk(KERN_INFO PFX "SiS delay workaround: giving bridge time to recover.\n"); set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout (1+(HZ*10)/1000); } @@ -223,28 +224,35 @@ }; +// chipsets that require the 'delay hack' +static int sis_broken_chipsets[] __devinitdata = { + PCI_DEVICE_ID_SI_648, + PCI_DEVICE_ID_SI_746, + 0 // terminator +}; + static void __devinit sis_get_driver(struct agp_bridge_data *bridge) { - if (bridge->dev->device == PCI_DEVICE_ID_SI_648) { - sis_driver.agp_enable=sis_648_enable; - if (agp_bridge->major_version == 3) { - sis_driver.aperture_sizes = agp3_generic_sizes; - sis_driver.size_type = U16_APER_SIZE; - sis_driver.num_aperture_sizes = AGP_GENERIC_SIZES_ENTRIES; - sis_driver.configure = agp3_generic_configure; - sis_driver.fetch_size = agp3_generic_fetch_size; - sis_driver.cleanup = agp3_generic_cleanup; - sis_driver.tlb_flush = agp3_generic_tlbflush; - } - } + int i; - if (bridge->dev->device == PCI_DEVICE_ID_SI_746) { - /* - * We don't know enough about the 746 to enable it properly. - * Though we do know that it needs the 'delay' hack to settle - * after changing modes. - */ - sis_driver.agp_enable=sis_648_enable; + for(i=0; sis_broken_chipsets[i]!=0; ++i) + if(bridge->dev->device==sis_broken_chipsets[i]) + break; + + if(sis_broken_chipsets[i] || agp_sis_force_delay) + sis_driver.agp_enable=sis_delayed_enable; + + // sis chipsets that indicate less than agp3.5 + // are not actually fully agp3 compliant + if ((agp_bridge->major_version == 3 && agp_bridge->minor_version >= 5 + && agp_sis_agp_spec!=0) || agp_sis_agp_spec==1) { + sis_driver.aperture_sizes = agp3_generic_sizes; + sis_driver.size_type = U16_APER_SIZE; + sis_driver.num_aperture_sizes = AGP_GENERIC_SIZES_ENTRIES; + sis_driver.configure = agp3_generic_configure; + sis_driver.fetch_size = agp3_generic_fetch_size; + sis_driver.cleanup = agp3_generic_cleanup; + sis_driver.tlb_flush = agp3_generic_tlbflush; } } @@ -335,4 +343,8 @@ module_init(agp_sis_init); module_exit(agp_sis_cleanup); +MODULE_PARM(agp_sis_force_delay,"i"); +MODULE_PARM_DESC(agp_sis_force_delay,"forces sis delay hack"); +MODULE_PARM(agp_sis_agp_spec,"i"); +MODULE_PARM_DESC(agp_sis_agp_spec,"0=force sis init, 1=force generic agp3 init, default: autodetect"); MODULE_LICENSE("GPL and additional rights"); diff -urN linux-2.6.7-rc2/drivers/char/agp/sworks-agp.c linux-2.6.7-rc3/drivers/char/agp/sworks-agp.c --- linux-2.6.7-rc2/drivers/char/agp/sworks-agp.c 2004-05-09 19:32:28.000000000 -0700 +++ linux-2.6.7-rc3/drivers/char/agp/sworks-agp.c 2004-06-07 12:55:04.271674780 -0700 @@ -248,26 +248,13 @@ */ static void serverworks_tlbflush(struct agp_memory *temp) { - unsigned long end; - - OUTREG8(serverworks_private.registers, SVWRKS_POSTFLUSH, 0x01); - end = jiffies + 3*HZ; - while(INREG8(serverworks_private.registers, - SVWRKS_POSTFLUSH) == 0x01) { - if((signed)(end - jiffies) <= 0) { - printk(KERN_ERR PFX "Posted write buffer flush took more" - "then 3 seconds\n"); - } - } - OUTREG32(serverworks_private.registers, SVWRKS_DIRFLUSH, 0x00000001); - end = jiffies + 3*HZ; - while(INREG32(serverworks_private.registers, - SVWRKS_DIRFLUSH) == 0x00000001) { - if((signed)(end - jiffies) <= 0) { - printk(KERN_ERR PFX "TLB flush took more" - "then 3 seconds\n"); - } - } + OUTREG8(serverworks_private.registers, SVWRKS_POSTFLUSH, 1); + while(INREG8(serverworks_private.registers, SVWRKS_POSTFLUSH) == 1) + cpu_relax(); + + OUTREG32(serverworks_private.registers, SVWRKS_DIRFLUSH, 1); + while(INREG32(serverworks_private.registers, SVWRKS_DIRFLUSH) == 1) + cpu_relax(); } static int serverworks_configure(void) diff -urN linux-2.6.7-rc2/drivers/char/agp/via-agp.c linux-2.6.7-rc3/drivers/char/agp/via-agp.c --- linux-2.6.7-rc2/drivers/char/agp/via-agp.c 2004-05-09 19:33:13.000000000 -0700 +++ linux-2.6.7-rc3/drivers/char/agp/via-agp.c 2004-06-07 12:55:04.271674780 -0700 @@ -9,6 +9,8 @@ #include #include "agp.h" +static struct pci_device_id agp_via_pci_table[]; + #define VIA_GARTCTRL 0x80 #define VIA_APSIZE 0x84 #define VIA_ATTBASE 0x88 @@ -378,20 +380,9 @@ if (!cap_ptr) return -ENODEV; - /* probe for known chipsets */ - for (j = 0; devs[j].chipset_name; j++) { - if (pdev->device == devs[j].device_id) { - printk (KERN_INFO PFX "Detected VIA %s chipset\n", - devs[j].chipset_name); - goto found; - } - } - - printk(KERN_ERR PFX "Unsupported VIA chipset (device id: %04x)\n", - pdev->device); - return -ENODEV; + j = ent - agp_via_pci_table; + printk (KERN_INFO PFX "Detected VIA %s chipset\n", devs[j].chipset_name); -found: bridge = agp_alloc_bridge(); if (!bridge) return -ENOMEM; @@ -432,15 +423,40 @@ agp_put_bridge(bridge); } +/* must be the same order as name table above */ static struct pci_device_id agp_via_pci_table[] = { - { - .class = (PCI_CLASS_BRIDGE_HOST << 8), - .class_mask = ~0, - .vendor = PCI_VENDOR_ID_VIA, - .device = PCI_ANY_ID, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - }, +#define ID(x) \ + { \ + .class = (PCI_CLASS_BRIDGE_HOST << 8), \ + .class_mask = ~0, \ + .vendor = PCI_VENDOR_ID_VIA, \ + .device = x, \ + .subvendor = PCI_ANY_ID, \ + .subdevice = PCI_ANY_ID, \ + } + ID(PCI_DEVICE_ID_VIA_82C598_0), + ID(PCI_DEVICE_ID_VIA_8501_0), + ID(PCI_DEVICE_ID_VIA_8601_0), + ID(PCI_DEVICE_ID_VIA_82C691_0), + ID(PCI_DEVICE_ID_VIA_8371_0), + ID(PCI_DEVICE_ID_VIA_8633_0), + ID(PCI_DEVICE_ID_VIA_XN266), + ID(PCI_DEVICE_ID_VIA_8361), + ID(PCI_DEVICE_ID_VIA_8363_0), + ID(PCI_DEVICE_ID_VIA_8753_0), + ID(PCI_DEVICE_ID_VIA_8367_0), + ID(PCI_DEVICE_ID_VIA_8653_0), + ID(PCI_DEVICE_ID_VIA_XM266), + ID(PCI_DEVICE_ID_VIA_862X_0), + ID(PCI_DEVICE_ID_VIA_8377_0), + ID(PCI_DEVICE_ID_VIA_8605_0), + ID(PCI_DEVICE_ID_VIA_8703_51_0), + ID(PCI_DEVICE_ID_VIA_8754C_0), + ID(PCI_DEVICE_ID_VIA_8763_0), + ID(PCI_DEVICE_ID_VIA_8378_0), + ID(PCI_DEVICE_ID_VIA_PT880), + ID(PCI_DEVICE_ID_VIA_8783_0), + ID(PCI_DEVICE_ID_VIA_PX8X0_0), { } }; diff -urN linux-2.6.7-rc2/drivers/char/consolemap.c linux-2.6.7-rc3/drivers/char/consolemap.c --- linux-2.6.7-rc2/drivers/char/consolemap.c 2004-06-07 12:54:48.883037436 -0700 +++ linux-2.6.7-rc3/drivers/char/consolemap.c 2004-06-07 12:55:04.272674821 -0700 @@ -257,12 +257,12 @@ * 0xf000-0xf0ff "transparent" Unicodes) whereas the "new" variants set * Unicodes explicitly. */ -int con_set_trans_old(unsigned char * arg) +int con_set_trans_old(unsigned char __user * arg) { int i; unsigned short *p = translations[USER_MAP]; - i = verify_area(VERIFY_READ, (void *)arg, E_TABSZ); + i = verify_area(VERIFY_READ, arg, E_TABSZ); if (i) return i; @@ -276,12 +276,12 @@ return 0; } -int con_get_trans_old(unsigned char * arg) +int con_get_trans_old(unsigned char __user * arg) { int i, ch; unsigned short *p = translations[USER_MAP]; - i = verify_area(VERIFY_WRITE, (void *)arg, E_TABSZ); + i = verify_area(VERIFY_WRITE, arg, E_TABSZ); if (i) return i; @@ -293,13 +293,12 @@ return 0; } -int con_set_trans_new(ushort * arg) +int con_set_trans_new(ushort __user * arg) { int i; unsigned short *p = translations[USER_MAP]; - i = verify_area(VERIFY_READ, (void *)arg, - E_TABSZ*sizeof(unsigned short)); + i = verify_area(VERIFY_READ, arg, E_TABSZ*sizeof(unsigned short)); if (i) return i; @@ -313,13 +312,12 @@ return 0; } -int con_get_trans_new(ushort * arg) +int con_get_trans_new(ushort __user * arg) { int i; unsigned short *p = translations[USER_MAP]; - i = verify_area(VERIFY_WRITE, (void *)arg, - E_TABSZ*sizeof(unsigned short)); + i = verify_area(VERIFY_WRITE, arg, E_TABSZ*sizeof(unsigned short)); if (i) return i; @@ -470,7 +468,7 @@ } int -con_set_unimap(int con, ushort ct, struct unipair *list) +con_set_unimap(int con, ushort ct, struct unipair __user *list) { int err = 0, err1, i; struct uni_pagedir *p, *q; @@ -598,7 +596,7 @@ } int -con_get_unimap(int con, ushort ct, ushort *uct, struct unipair *list) +con_get_unimap(int con, ushort ct, ushort __user *uct, struct unipair __user *list) { int i, j, k, ect; u16 **p1, *p2; diff -urN linux-2.6.7-rc2/drivers/char/drm/drm_agpsupport.h linux-2.6.7-rc3/drivers/char/drm/drm_agpsupport.h --- linux-2.6.7-rc2/drivers/char/drm/drm_agpsupport.h 2004-06-07 12:54:48.890037726 -0700 +++ linux-2.6.7-rc3/drivers/char/drm/drm_agpsupport.h 2004-06-07 12:55:04.279675111 -0700 @@ -109,8 +109,6 @@ return -EBUSY; if (!drm_agp->acquire) return -EINVAL; - if ( dev->agp->cant_use_aperture ) - return -EINVAL; if ((retcode = drm_agp->acquire())) return retcode; dev->agp->acquired = 1; diff -urN linux-2.6.7-rc2/drivers/char/drm/r128_state.c linux-2.6.7-rc3/drivers/char/drm/r128_state.c --- linux-2.6.7-rc2/drivers/char/drm/r128_state.c 2004-06-07 12:54:48.909038512 -0700 +++ linux-2.6.7-rc3/drivers/char/drm/r128_state.c 2004-06-07 12:55:04.298675898 -0700 @@ -916,7 +916,7 @@ count = depth->n; if (count > 4096 || count <= 0) - return -EMSGSIZE; + return DRM_ERR(EMSGSIZE); if ( DRM_COPY_FROM_USER( &x, depth->x, sizeof(x) ) ) { return DRM_ERR(EFAULT); @@ -1012,7 +1012,7 @@ count = depth->n; if (count > 4096 || count <= 0) - return -EMSGSIZE; + return DRM_ERR(EMSGSIZE); xbuf_size = count * sizeof(*x); ybuf_size = count * sizeof(*y); @@ -1131,7 +1131,7 @@ count = depth->n; if (count > 4096 || count <= 0) - return -EMSGSIZE; + return DRM_ERR(EMSGSIZE); if ( DRM_COPY_FROM_USER( &x, depth->x, sizeof(x) ) ) { return DRM_ERR(EFAULT); @@ -1176,7 +1176,7 @@ count = depth->n; if (count > 4096 || count <= 0) - return -EMSGSIZE; + return DRM_ERR(EMSGSIZE); if ( count > dev_priv->depth_pitch ) { count = dev_priv->depth_pitch; diff -urN linux-2.6.7-rc2/drivers/char/drm/radeon.h linux-2.6.7-rc3/drivers/char/drm/radeon.h --- linux-2.6.7-rc2/drivers/char/drm/radeon.h 2004-06-07 12:54:48.910038554 -0700 +++ linux-2.6.7-rc3/drivers/char/drm/radeon.h 2004-06-07 12:55:04.298675898 -0700 @@ -51,7 +51,7 @@ #define DRIVER_DATE "20020828" #define DRIVER_MAJOR 1 -#define DRIVER_MINOR 10 +#define DRIVER_MINOR 11 #define DRIVER_PATCHLEVEL 0 /* Interface history: @@ -84,6 +84,8 @@ * 1.10- Add SETPARAM ioctl; first parameter to set is FB_LOCATION, which * clients use to tell the DRM where they think the framebuffer is * located in the card's address space + * 1.11- Add packet R200_EMIT_RB3D_BLENDCOLOR to support GL_EXT_blend_color + * and GL_EXT_blend_[func|equation]_separate on r200 */ #define DRIVER_IOCTLS \ [DRM_IOCTL_NR(DRM_IOCTL_DMA)] = { radeon_cp_buffers, 1, 0 }, \ diff -urN linux-2.6.7-rc2/drivers/char/drm/radeon_drm.h linux-2.6.7-rc3/drivers/char/drm/radeon_drm.h --- linux-2.6.7-rc2/drivers/char/drm/radeon_drm.h 2004-06-07 12:54:48.912038637 -0700 +++ linux-2.6.7-rc3/drivers/char/drm/radeon_drm.h 2004-06-07 12:55:04.300675981 -0700 @@ -144,7 +144,8 @@ #define RADEON_EMIT_PP_TEX_SIZE_0 73 #define RADEON_EMIT_PP_TEX_SIZE_1 74 #define RADEON_EMIT_PP_TEX_SIZE_2 75 -#define RADEON_MAX_STATE_PACKETS 76 +#define R200_EMIT_RB3D_BLENDCOLOR 76 +#define RADEON_MAX_STATE_PACKETS 77 /* Commands understood by cmd_buffer ioctl. More can be added but diff -urN linux-2.6.7-rc2/drivers/char/drm/radeon_drv.h linux-2.6.7-rc3/drivers/char/drm/radeon_drv.h --- linux-2.6.7-rc2/drivers/char/drm/radeon_drv.h 2004-06-07 12:54:48.913038678 -0700 +++ linux-2.6.7-rc3/drivers/char/drm/radeon_drv.h 2004-06-07 12:55:04.301676023 -0700 @@ -690,6 +690,7 @@ #define R200_SE_VTX_FMT_1 0x208c #define R200_RE_CNTL 0x1c50 +#define R200_RB3D_BLENDCOLOR 0x3218 /* Constants */ #define RADEON_MAX_USEC_TIMEOUT 100000 /* 100 ms */ diff -urN linux-2.6.7-rc2/drivers/char/drm/radeon_mem.c linux-2.6.7-rc3/drivers/char/drm/radeon_mem.c --- linux-2.6.7-rc2/drivers/char/drm/radeon_mem.c 2004-05-09 19:33:13.000000000 -0700 +++ linux-2.6.7-rc3/drivers/char/drm/radeon_mem.c 2004-06-07 12:55:04.302676064 -0700 @@ -137,12 +137,12 @@ struct mem_block *blocks = DRM_MALLOC(sizeof(*blocks)); if (!blocks) - return -ENOMEM; + return DRM_ERR(ENOMEM); *heap = DRM_MALLOC(sizeof(**heap)); if (!*heap) { DRM_FREE( blocks, sizeof(*blocks) ); - return -ENOMEM; + return DRM_ERR(ENOMEM); } blocks->start = start; diff -urN linux-2.6.7-rc2/drivers/char/drm/radeon_state.c linux-2.6.7-rc3/drivers/char/drm/radeon_state.c --- linux-2.6.7-rc2/drivers/char/drm/radeon_state.c 2004-06-07 12:54:48.915038761 -0700 +++ linux-2.6.7-rc3/drivers/char/drm/radeon_state.c 2004-06-07 12:55:04.304676147 -0700 @@ -201,6 +201,7 @@ case RADEON_EMIT_PP_TEX_SIZE_0: case RADEON_EMIT_PP_TEX_SIZE_1: case RADEON_EMIT_PP_TEX_SIZE_2: + case R200_EMIT_RB3D_BLENDCOLOR: /* These packets don't contain memory offsets */ break; @@ -563,6 +564,7 @@ { RADEON_PP_TEX_SIZE_0, 2, "RADEON_PP_TEX_SIZE_0" }, { RADEON_PP_TEX_SIZE_1, 2, "RADEON_PP_TEX_SIZE_1" }, { RADEON_PP_TEX_SIZE_2, 2, "RADEON_PP_TEX_SIZE_1" }, + { R200_RB3D_BLENDCOLOR, 3, "R200_RB3D_BLENDCOLOR" }, }; diff -urN linux-2.6.7-rc2/drivers/char/i8k.c linux-2.6.7-rc3/drivers/char/i8k.c --- linux-2.6.7-rc2/drivers/char/i8k.c 2004-05-09 19:32:26.000000000 -0700 +++ linux-2.6.7-rc3/drivers/char/i8k.c 2004-06-07 12:55:04.312676478 -0700 @@ -79,7 +79,7 @@ MODULE_PARM_DESC(restricted, "Allow fan control if SYS_ADMIN capability set"); MODULE_PARM_DESC(power_status, "Report power status in /proc/i8k"); -static ssize_t i8k_read(struct file *, char *, size_t, loff_t *); +static ssize_t i8k_read(struct file *, char __user *, size_t, loff_t *); static int i8k_ioctl(struct inode *, struct file *, unsigned int, unsigned long); @@ -330,10 +330,10 @@ int val; int speed; unsigned char buff[16]; + int __user *argp = (int __user *)arg; - if (!arg) { + if (!argp) return -EINVAL; - } switch (cmd) { case I8K_BIOS_VERSION: @@ -358,14 +358,14 @@ break; case I8K_GET_SPEED: - if (copy_from_user(&val, (int *)arg, sizeof(int))) { + if (copy_from_user(&val, argp, sizeof(int))) { return -EFAULT; } val = i8k_get_fan_speed(val); break; case I8K_GET_FAN: - if (copy_from_user(&val, (int *)arg, sizeof(int))) { + if (copy_from_user(&val, argp, sizeof(int))) { return -EFAULT; } val = i8k_get_fan_status(val); @@ -375,10 +375,10 @@ if (restricted && !capable(CAP_SYS_ADMIN)) { return -EPERM; } - if (copy_from_user(&val, (int *)arg, sizeof(int))) { + if (copy_from_user(&val, argp, sizeof(int))) { return -EFAULT; } - if (copy_from_user(&speed, (int *)arg+1, sizeof(int))) { + if (copy_from_user(&speed, argp+1, sizeof(int))) { return -EFAULT; } val = i8k_set_fan(val, speed); @@ -394,17 +394,17 @@ switch (cmd) { case I8K_BIOS_VERSION: - if (copy_to_user((int *)arg, &val, 4)) { + if (copy_to_user(argp, &val, 4)) { return -EFAULT; } break; case I8K_MACHINE_ID: - if (copy_to_user((int *)arg, buff, 16)) { + if (copy_to_user(argp, buff, 16)) { return -EFAULT; } break; default: - if (copy_to_user((int *)arg, &val, sizeof(int))) { + if (copy_to_user(argp, &val, sizeof(int))) { return -EFAULT; } break; @@ -462,7 +462,7 @@ return n; } -static ssize_t i8k_read(struct file *f, char *buffer, size_t len, loff_t *fpos) +static ssize_t i8k_read(struct file *f, char __user *buffer, size_t len, loff_t *fpos) { int n; char info[128]; diff -urN linux-2.6.7-rc2/drivers/char/ipmi/ipmi_msghandler.c linux-2.6.7-rc3/drivers/char/ipmi/ipmi_msghandler.c --- linux-2.6.7-rc2/drivers/char/ipmi/ipmi_msghandler.c 2004-05-09 19:32:38.000000000 -0700 +++ linux-2.6.7-rc3/drivers/char/ipmi/ipmi_msghandler.c 2004-06-07 12:55:04.317676685 -0700 @@ -123,6 +123,12 @@ unsigned char protocol; }; +struct ipmi_proc_entry +{ + char *name; + struct ipmi_proc_entry *next; +}; + #define IPMI_IPMB_NUM_SEQ 64 #define IPMI_MAX_CHANNELS 8 struct ipmi_smi @@ -149,6 +155,11 @@ struct ipmi_smi_handlers *handlers; void *send_info; + /* A list of proc entries for this interface. This does not + need a lock, only one thread creates it and only one thread + destroys it. */ + struct ipmi_proc_entry *proc_entries; + /* A table of sequence numbers for this interface. We use the sequence numbers for IPMB messages that go out of the interface to match them up with their responses. A routine @@ -1515,18 +1526,36 @@ read_proc_t *read_proc, write_proc_t *write_proc, void *data, struct module *owner) { - struct proc_dir_entry *file; - int rv = 0; + struct proc_dir_entry *file; + int rv = 0; + struct ipmi_proc_entry *entry; + + /* Create a list element. */ + entry = kmalloc(sizeof(*entry), GFP_KERNEL); + if (!entry) + return -ENOMEM; + entry->name = kmalloc(strlen(name)+1, GFP_KERNEL); + if (!entry->name) { + kfree(entry); + return -ENOMEM; + } + strcpy(entry->name, name); file = create_proc_entry(name, 0, smi->proc_dir); - if (!file) + if (!file) { + kfree(entry->name); + kfree(entry); rv = -ENOMEM; - else { + } else { file->nlink = 1; file->data = data; file->read_proc = read_proc; file->write_proc = write_proc; file->owner = owner; + + /* Stick it on the list. */ + entry->next = smi->proc_entries; + smi->proc_entries = entry; } return rv; @@ -1562,6 +1591,21 @@ return rv; } +static void remove_proc_entries(ipmi_smi_t smi) +{ + struct ipmi_proc_entry *entry; + + while (smi->proc_entries) { + entry = smi->proc_entries; + smi->proc_entries = entry->next; + + remove_proc_entry(entry->name, smi->proc_dir); + kfree(entry->name); + kfree(entry); + } + remove_proc_entry(smi->proc_dir_name, proc_ipmi_root); +} + static int send_channel_info_cmd(ipmi_smi_t intf, int chan) { @@ -1749,8 +1793,7 @@ if (rv) { if (new_intf->proc_dir) - remove_proc_entry(new_intf->proc_dir_name, - proc_ipmi_root); + remove_proc_entries(new_intf); kfree(new_intf); } @@ -1806,8 +1849,7 @@ { for (i=0; iproc_dir_name, - proc_ipmi_root); + remove_proc_entries(intf); spin_lock_irqsave(&interfaces_lock, flags); ipmi_interfaces[i] = NULL; clean_up_interface_data(intf); diff -urN linux-2.6.7-rc2/drivers/char/ipmi/ipmi_si_intf.c linux-2.6.7-rc3/drivers/char/ipmi/ipmi_si_intf.c --- linux-2.6.7-rc2/drivers/char/ipmi/ipmi_si_intf.c 2004-05-09 19:32:01.000000000 -0700 +++ linux-2.6.7-rc3/drivers/char/ipmi/ipmi_si_intf.c 2004-06-07 12:55:04.318676727 -0700 @@ -905,10 +905,10 @@ " has an interrupt. Otherwise, set it to zero or leave" " it blank."); - -#if defined(CONFIG_ACPI_INTERPETER) || defined(CONFIG_X86) || defined(CONFIG_PCI) #define IPMI_MEM_ADDR_SPACE 1 #define IPMI_IO_ADDR_SPACE 2 + +#if defined(CONFIG_ACPI_INTERPETER) || defined(CONFIG_X86) || defined(CONFIG_PCI) static int is_new_interface(int intf, u8 addr_space, unsigned long base_addr) { int i; diff -urN linux-2.6.7-rc2/drivers/char/lp.c linux-2.6.7-rc3/drivers/char/lp.c --- linux-2.6.7-rc2/drivers/char/lp.c 2004-05-09 19:31:58.000000000 -0700 +++ linux-2.6.7-rc3/drivers/char/lp.c 2004-06-07 12:55:04.319676768 -0700 @@ -291,7 +291,7 @@ return error; } -static ssize_t lp_write(struct file * file, const char * buf, +static ssize_t lp_write(struct file * file, const char __user * buf, size_t count, loff_t *ppos) { unsigned int minor = iminor(file->f_dentry->d_inode); @@ -407,7 +407,7 @@ #ifdef CONFIG_PARPORT_1284 /* Status readback conforming to ieee1284 */ -static ssize_t lp_read(struct file * file, char * buf, +static ssize_t lp_read(struct file * file, char __user * buf, size_t count, loff_t *ppos) { unsigned int minor=iminor(file->f_dentry->d_inode); @@ -560,6 +560,7 @@ unsigned int minor = iminor(inode); int status; int retval = 0; + void __user *argp = (void __user *)arg; #ifdef LP_DEBUG printk(KERN_DEBUG "lp%d ioctl, cmd: 0x%x, arg: 0x%lx\n", minor, cmd, arg); @@ -603,7 +604,7 @@ return -EINVAL; break; case LPGETIRQ: - if (copy_to_user((int *) arg, &LP_IRQ(minor), + if (copy_to_user(argp, &LP_IRQ(minor), sizeof(int))) return -EFAULT; break; @@ -612,7 +613,7 @@ status = r_str(minor); lp_release_parport (&lp_table[minor]); - if (copy_to_user((int *) arg, &status, sizeof(int))) + if (copy_to_user(argp, &status, sizeof(int))) return -EFAULT; break; case LPRESET: @@ -620,7 +621,7 @@ break; #ifdef LP_STATS case LPGETSTATS: - if (copy_to_user((int *) arg, &LP_STAT(minor), + if (copy_to_user(argp, &LP_STAT(minor), sizeof(struct lp_stats))) return -EFAULT; if (capable(CAP_SYS_ADMIN)) @@ -630,13 +631,12 @@ #endif case LPGETFLAGS: status = LP_F(minor); - if (copy_to_user((int *) arg, &status, sizeof(int))) + if (copy_to_user(argp, &status, sizeof(int))) return -EFAULT; break; case LPSETTIMEOUT: - if (copy_from_user (&par_timeout, - (struct timeval *) arg, + if (copy_from_user (&par_timeout, argp, sizeof (struct timeval))) { return -EFAULT; } diff -urN linux-2.6.7-rc2/drivers/char/n_tty.c linux-2.6.7-rc3/drivers/char/n_tty.c --- linux-2.6.7-rc2/drivers/char/n_tty.c 2004-05-09 19:31:58.000000000 -0700 +++ linux-2.6.7-rc3/drivers/char/n_tty.c 2004-06-07 12:55:04.323676934 -0700 @@ -249,7 +249,7 @@ * things. */ static ssize_t opost_block(struct tty_struct * tty, - const unsigned char * inbuf, unsigned int nr) + const unsigned char __user * inbuf, unsigned int nr) { char buf[80]; int space; @@ -946,7 +946,7 @@ * the buffer to head pointer. */ static inline int copy_from_read_buf(struct tty_struct *tty, - unsigned char **b, + unsigned char __user **b, size_t *nr) { @@ -976,9 +976,9 @@ extern ssize_t redirected_tty_write(struct file *,const char *,size_t,loff_t *); static ssize_t read_chan(struct tty_struct *tty, struct file *file, - unsigned char *buf, size_t nr) + unsigned char __user *buf, size_t nr) { - unsigned char *b = buf; + unsigned char __user *b = buf; DECLARE_WAITQUEUE(wait, current); int c; int minimum, time; @@ -1183,9 +1183,9 @@ } static ssize_t write_chan(struct tty_struct * tty, struct file * file, - const unsigned char * buf, size_t nr) + const unsigned char __user * buf, size_t nr) { - const unsigned char *b = buf; + const unsigned char __user *b = buf; DECLARE_WAITQUEUE(wait, current); int c; ssize_t retval = 0; diff -urN linux-2.6.7-rc2/drivers/char/nvram.c linux-2.6.7-rc3/drivers/char/nvram.c --- linux-2.6.7-rc2/drivers/char/nvram.c 2004-05-09 19:32:28.000000000 -0700 +++ linux-2.6.7-rc3/drivers/char/nvram.c 2004-06-07 12:55:04.323676934 -0700 @@ -250,7 +250,7 @@ } static ssize_t -nvram_read(struct file *file, char *buf, size_t count, loff_t *ppos) +nvram_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) { unsigned char contents[NVRAM_BYTES]; unsigned i = *ppos; @@ -279,7 +279,7 @@ } static ssize_t -nvram_write(struct file *file, const char *buf, size_t count, loff_t *ppos) +nvram_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { unsigned char contents[NVRAM_BYTES]; unsigned i = *ppos; diff -urN linux-2.6.7-rc2/drivers/char/pcmcia/synclink_cs.c linux-2.6.7-rc3/drivers/char/pcmcia/synclink_cs.c --- linux-2.6.7-rc2/drivers/char/pcmcia/synclink_cs.c 2004-05-09 19:32:27.000000000 -0700 +++ linux-2.6.7-rc3/drivers/char/pcmcia/synclink_cs.c 2004-06-07 12:55:04.326677058 -0700 @@ -1,7 +1,7 @@ /* * linux/drivers/char/pcmcia/synclink_cs.c * - * $Id: synclink_cs.c,v 4.21 2004/03/08 15:29:23 paulkf Exp $ + * $Id: synclink_cs.c,v 4.22 2004/06/01 20:27:46 paulkf Exp $ * * Device driver for Microgate SyncLink PC Card * multiprotocol serial adapter. @@ -438,15 +438,15 @@ static int tiocmget(struct tty_struct *tty, struct file *file); static int tiocmset(struct tty_struct *tty, struct file *file, unsigned int set, unsigned int clear); -static int get_stats(MGSLPC_INFO *info, struct mgsl_icount *user_icount); -static int get_params(MGSLPC_INFO *info, MGSL_PARAMS *user_params); -static int set_params(MGSLPC_INFO *info, MGSL_PARAMS *new_params); -static int get_txidle(MGSLPC_INFO *info, int*idle_mode); +static int get_stats(MGSLPC_INFO *info, struct mgsl_icount __user *user_icount); +static int get_params(MGSLPC_INFO *info, MGSL_PARAMS __user *user_params); +static int set_params(MGSLPC_INFO *info, MGSL_PARAMS __user *new_params); +static int get_txidle(MGSLPC_INFO *info, int __user *idle_mode); static int set_txidle(MGSLPC_INFO *info, int idle_mode); static int set_txenable(MGSLPC_INFO *info, int enable); static int tx_abort(MGSLPC_INFO *info); static int set_rxenable(MGSLPC_INFO *info, int enable); -static int wait_events(MGSLPC_INFO *info, int *mask); +static int wait_events(MGSLPC_INFO *info, int __user *mask); #define jiffies_from_ms(a) ((((a) * HZ)/1000)+1) @@ -489,7 +489,7 @@ MODULE_LICENSE("GPL"); static char *driver_name = "SyncLink PC Card driver"; -static char *driver_version = "$Revision: 4.21 $"; +static char *driver_version = "$Revision: 4.22 $"; static struct tty_driver *serial_driver; @@ -521,8 +521,10 @@ * (gdb) to get the .text address for the add-symbol-file command. * This allows remote debugging of dynamically loadable modules. */ -static void* mgslpc_get_text_ptr(void); -static void* mgslpc_get_text_ptr() {return mgslpc_get_text_ptr;} +static void* mgslpc_get_text_ptr(void) +{ + return mgslpc_get_text_ptr; +} static dev_link_t *mgslpc_attach(void) { @@ -1955,7 +1957,7 @@ /* get the current serial statistics */ -static int get_stats(MGSLPC_INFO * info, struct mgsl_icount *user_icount) +static int get_stats(MGSLPC_INFO * info, struct mgsl_icount __user *user_icount) { int err; if (debug_level >= DEBUG_LEVEL_INFO) @@ -1968,7 +1970,7 @@ /* get the current serial parameters */ -static int get_params(MGSLPC_INFO * info, MGSL_PARAMS *user_params) +static int get_params(MGSLPC_INFO * info, MGSL_PARAMS __user *user_params) { int err; if (debug_level >= DEBUG_LEVEL_INFO) @@ -1988,7 +1990,7 @@ * * Returns: 0 if success, otherwise error code */ -static int set_params(MGSLPC_INFO * info, MGSL_PARAMS *new_params) +static int set_params(MGSLPC_INFO * info, MGSL_PARAMS __user *new_params) { unsigned long flags; MGSL_PARAMS tmp_params; @@ -2014,7 +2016,7 @@ return 0; } -static int get_txidle(MGSLPC_INFO * info, int*idle_mode) +static int get_txidle(MGSLPC_INFO * info, int __user *idle_mode) { int err; if (debug_level >= DEBUG_LEVEL_INFO) @@ -2037,7 +2039,7 @@ return 0; } -static int get_interface(MGSLPC_INFO * info, int*if_mode) +static int get_interface(MGSLPC_INFO * info, int __user *if_mode) { int err; if (debug_level >= DEBUG_LEVEL_INFO) @@ -2136,7 +2138,7 @@ * of events triggerred, * otherwise error code */ -static int wait_events(MGSLPC_INFO * info, int * mask_ptr) +static int wait_events(MGSLPC_INFO * info, int __user *mask_ptr) { unsigned long flags; int s; @@ -2409,20 +2411,21 @@ { int error; struct mgsl_icount cnow; /* kernel counter temps */ - struct serial_icounter_struct *p_cuser; /* user space */ + struct serial_icounter_struct __user *p_cuser; /* user space */ + void __user *argp = (void __user *)arg; unsigned long flags; switch (cmd) { case MGSL_IOCGPARAMS: - return get_params(info,(MGSL_PARAMS *)arg); + return get_params(info, argp); case MGSL_IOCSPARAMS: - return set_params(info,(MGSL_PARAMS *)arg); + return set_params(info, argp); case MGSL_IOCGTXIDLE: - return get_txidle(info,(int*)arg); + return get_txidle(info, argp); case MGSL_IOCSTXIDLE: - return set_txidle(info,(int)arg); + return set_txidle(info, (int)arg); case MGSL_IOCGIF: - return get_interface(info,(int*)arg); + return get_interface(info, argp); case MGSL_IOCSIF: return set_interface(info,(int)arg); case MGSL_IOCTXENABLE: @@ -2432,16 +2435,16 @@ case MGSL_IOCTXABORT: return tx_abort(info); case MGSL_IOCGSTATS: - return get_stats(info,(struct mgsl_icount*)arg); + return get_stats(info, argp); case MGSL_IOCWAITEVENT: - return wait_events(info,(int*)arg); + return wait_events(info, argp); case TIOCMIWAIT: return modem_input_wait(info,(int)arg); case TIOCGICOUNT: spin_lock_irqsave(&info->lock,flags); cnow = info->icount; spin_unlock_irqrestore(&info->lock,flags); - p_cuser = (struct serial_icounter_struct *) arg; + p_cuser = argp; PUT_USER(error,cnow.cts, &p_cuser->cts); if (error) return error; PUT_USER(error,cnow.dsr, &p_cuser->dsr); @@ -3130,9 +3133,35 @@ .tiocmset = tiocmset, }; +static void synclink_cs_cleanup(void) +{ + int rc; + + printk("Unloading %s: version %s\n", driver_name, driver_version); + + while(mgslpc_device_list) + mgslpc_remove_device(mgslpc_device_list); + + if (serial_driver) { + if ((rc = tty_unregister_driver(serial_driver))) + printk("%s(%d) failed to unregister tty driver err=%d\n", + __FILE__,__LINE__,rc); + put_tty_driver(serial_driver); + } + + pcmcia_unregister_driver(&mgslpc_driver); + + /* XXX: this really needs to move into generic code.. */ + while (dev_list != NULL) { + if (dev_list->state & DEV_CONFIG) + mgslpc_release((u_long)dev_list); + mgslpc_detach(dev_list); + } +} + static int __init synclink_cs_init(void) { - int error; + int rc; if (break_on_load) { mgslpc_get_text_ptr(); @@ -3141,14 +3170,13 @@ printk("%s %s\n", driver_name, driver_version); - serial_driver = alloc_tty_driver(MAX_DEVICE_COUNT); - if (!serial_driver) - return -ENOMEM; + if ((rc = pcmcia_register_driver(&mgslpc_driver)) < 0) + return rc; - error = pcmcia_register_driver(&mgslpc_driver); - if (error) { - put_tty_driver(serial_driver); - return error; + serial_driver = alloc_tty_driver(MAX_DEVICE_COUNT); + if (!serial_driver) { + rc = -ENOMEM; + goto error; } /* Initialize the tty_driver structure */ @@ -3166,39 +3194,28 @@ serial_driver->flags = TTY_DRIVER_REAL_RAW; tty_set_operations(serial_driver, &mgslpc_ops); - if (tty_register_driver(serial_driver) < 0) + if ((rc = tty_register_driver(serial_driver)) < 0) { printk("%s(%d):Couldn't register serial driver\n", __FILE__,__LINE__); + put_tty_driver(serial_driver); + serial_driver = NULL; + goto error; + } printk("%s %s, tty major#%d\n", driver_name, driver_version, serial_driver->major); return 0; + +error: + synclink_cs_cleanup(); + return rc; } static void __exit synclink_cs_exit(void) { - int rc; - - printk("Unloading %s: version %s\n", driver_name, driver_version); - - while(mgslpc_device_list) - mgslpc_remove_device(mgslpc_device_list); - - if ((rc = tty_unregister_driver(serial_driver))) - printk("%s(%d) failed to unregister tty driver err=%d\n", - __FILE__,__LINE__,rc); - put_tty_driver(serial_driver); - - pcmcia_unregister_driver(&mgslpc_driver); - - /* XXX: this really needs to move into generic code.. */ - while (dev_list != NULL) { - if (dev_list->state & DEV_CONFIG) - mgslpc_release((u_long)dev_list); - mgslpc_detach(dev_list); - } + synclink_cs_cleanup(); } module_init(synclink_cs_init); diff -urN linux-2.6.7-rc2/drivers/char/ppdev.c linux-2.6.7-rc3/drivers/char/ppdev.c --- linux-2.6.7-rc2/drivers/char/ppdev.c 2004-06-07 12:54:48.928039299 -0700 +++ linux-2.6.7-rc3/drivers/char/ppdev.c 2004-06-07 12:55:04.328677141 -0700 @@ -103,7 +103,7 @@ port->ops->enable_irq (port); } -static ssize_t pp_read (struct file * file, char * buf, size_t count, +static ssize_t pp_read (struct file * file, char __user * buf, size_t count, loff_t * ppos) { unsigned int minor = iminor(file->f_dentry->d_inode); @@ -186,8 +186,8 @@ return bytes_read; } -static ssize_t pp_write (struct file * file, const char * buf, size_t count, - loff_t * ppos) +static ssize_t pp_write (struct file * file, const char __user * buf, + size_t count, loff_t * ppos) { unsigned int minor = iminor(file->f_dentry->d_inode); struct pp_struct *pp = file->private_data; @@ -335,6 +335,7 @@ unsigned int minor = iminor(inode); struct pp_struct *pp = file->private_data; struct parport * port; + void __user *argp = (void __user *)arg; /* First handle the cases that don't take arguments. */ switch (cmd) { @@ -396,7 +397,7 @@ case PPSETMODE: { int mode; - if (copy_from_user (&mode, (int *) arg, sizeof (mode))) + if (copy_from_user (&mode, argp, sizeof (mode))) return -EFAULT; /* FIXME: validate mode */ pp->state.mode = mode; @@ -418,7 +419,7 @@ } else { mode = pp->state.mode; } - if (copy_to_user ((int *)arg, &mode, sizeof (mode))) { + if (copy_to_user (argp, &mode, sizeof (mode))) { return -EFAULT; } return 0; @@ -426,7 +427,7 @@ case PPSETPHASE: { int phase; - if (copy_from_user (&phase, (int *) arg, sizeof (phase))) { + if (copy_from_user (&phase, argp, sizeof (phase))) { return -EFAULT; } /* FIXME: validate phase */ @@ -447,7 +448,7 @@ } else { phase = pp->state.phase; } - if (copy_to_user ((int *)arg, &phase, sizeof (phase))) { + if (copy_to_user (argp, &phase, sizeof (phase))) { return -EFAULT; } return 0; @@ -461,7 +462,7 @@ return -ENODEV; modes = port->modes; - if (copy_to_user ((unsigned int *)arg, &modes, sizeof (modes))) { + if (copy_to_user (argp, &modes, sizeof (modes))) { return -EFAULT; } return 0; @@ -470,7 +471,7 @@ { int uflags; - if (copy_from_user (&uflags, (int *)arg, sizeof (uflags))) { + if (copy_from_user (&uflags, argp, sizeof (uflags))) { return -EFAULT; } pp->flags &= ~PP_FLAGMASK; @@ -482,7 +483,7 @@ int uflags; uflags = pp->flags & PP_FLAGMASK; - if (copy_to_user ((int *)arg, &uflags, sizeof (uflags))) { + if (copy_to_user (argp, &uflags, sizeof (uflags))) { return -EFAULT; } return 0; @@ -509,17 +510,17 @@ case PPRSTATUS: reg = parport_read_status (port); - if (copy_to_user ((unsigned char *) arg, ®, sizeof (reg))) + if (copy_to_user (argp, ®, sizeof (reg))) return -EFAULT; return 0; case PPRDATA: reg = parport_read_data (port); - if (copy_to_user ((unsigned char *) arg, ®, sizeof (reg))) + if (copy_to_user (argp, ®, sizeof (reg))) return -EFAULT; return 0; case PPRCONTROL: reg = parport_read_control (port); - if (copy_to_user ((unsigned char *) arg, ®, sizeof (reg))) + if (copy_to_user (argp, ®, sizeof (reg))) return -EFAULT; return 0; case PPYIELD: @@ -538,29 +539,29 @@ return 0; case PPWCONTROL: - if (copy_from_user (®, (unsigned char *) arg, sizeof (reg))) + if (copy_from_user (®, argp, sizeof (reg))) return -EFAULT; parport_write_control (port, reg); return 0; case PPWDATA: - if (copy_from_user (®, (unsigned char *) arg, sizeof (reg))) + if (copy_from_user (®, argp, sizeof (reg))) return -EFAULT; parport_write_data (port, reg); return 0; case PPFCONTROL: - if (copy_from_user (&mask, (unsigned char *) arg, + if (copy_from_user (&mask, argp, sizeof (mask))) return -EFAULT; - if (copy_from_user (®, 1 + (unsigned char *) arg, + if (copy_from_user (®, 1 + (unsigned char __user *) arg, sizeof (reg))) return -EFAULT; parport_frob_control (port, mask, reg); return 0; case PPDATADIR: - if (copy_from_user (&mode, (int *) arg, sizeof (mode))) + if (copy_from_user (&mode, argp, sizeof (mode))) return -EFAULT; if (mode) port->ops->data_reverse (port); @@ -569,7 +570,7 @@ return 0; case PPNEGOT: - if (copy_from_user (&mode, (int *) arg, sizeof (mode))) + if (copy_from_user (&mode, argp, sizeof (mode))) return -EFAULT; switch ((ret = parport_negotiate (port, mode))) { case 0: break; @@ -584,8 +585,7 @@ return ret; case PPWCTLONIRQ: - if (copy_from_user (®, (unsigned char *) arg, - sizeof (reg))) + if (copy_from_user (®, argp, sizeof (reg))) return -EFAULT; /* Remember what to set the control lines to, for next @@ -596,14 +596,13 @@ case PPCLRIRQ: ret = atomic_read (&pp->irqc); - if (copy_to_user ((int *) arg, &ret, sizeof (ret))) + if (copy_to_user (argp, &ret, sizeof (ret))) return -EFAULT; atomic_sub (ret, &pp->irqc); return 0; case PPSETTIME: - if (copy_from_user (&par_timeout, (struct timeval *)arg, - sizeof(struct timeval))) { + if (copy_from_user (&par_timeout, argp, sizeof(struct timeval))) { return -EFAULT; } /* Convert to jiffies, place in pp->pdev->timeout */ @@ -622,10 +621,8 @@ to_jiffies = pp->pdev->timeout; par_timeout.tv_sec = to_jiffies / HZ; par_timeout.tv_usec = (to_jiffies % (long)HZ) * (1000000/HZ); - if (copy_to_user ((struct timeval *)arg, &par_timeout, - sizeof(struct timeval))) { + if (copy_to_user (argp, &par_timeout, sizeof(struct timeval))) return -EFAULT; - } return 0; default: diff -urN linux-2.6.7-rc2/drivers/char/scx200_gpio.c linux-2.6.7-rc3/drivers/char/scx200_gpio.c --- linux-2.6.7-rc2/drivers/char/scx200_gpio.c 2004-05-09 19:31:58.000000000 -0700 +++ linux-2.6.7-rc3/drivers/char/scx200_gpio.c 2004-06-07 12:55:04.332677307 -0700 @@ -26,7 +26,7 @@ MODULE_PARM(major, "i"); MODULE_PARM_DESC(major, "Major device number"); -static ssize_t scx200_gpio_write(struct file *file, const char *data, +static ssize_t scx200_gpio_write(struct file *file, const char __user *data, size_t len, loff_t *ppos) { unsigned m = iminor(file->f_dentry->d_inode); @@ -77,7 +77,7 @@ return len; } -static ssize_t scx200_gpio_read(struct file *file, char *buf, +static ssize_t scx200_gpio_read(struct file *file, char __user *buf, size_t len, loff_t *ppos) { unsigned m = iminor(file->f_dentry->d_inode); diff -urN linux-2.6.7-rc2/drivers/char/selection.c linux-2.6.7-rc3/drivers/char/selection.c --- linux-2.6.7-rc2/drivers/char/selection.c 2004-05-09 19:33:20.000000000 -0700 +++ linux-2.6.7-rc3/drivers/char/selection.c 2004-06-07 12:55:04.333677348 -0700 @@ -3,10 +3,10 @@ * * This module exports the functions: * - * 'int set_selection(const unsigned long arg)' + * 'int set_selection(struct tiocl_selection __user *, struct tty_struct *)' * 'void clear_selection(void)' - * 'int paste_selection(struct tty_struct *tty)' - * 'int sel_loadlut(const unsigned long arg)' + * 'int paste_selection(struct tty_struct *)' + * 'int sel_loadlut(char __user *)' * * Now that /dev/vcs exists, most of this can disappear again. */ @@ -95,9 +95,9 @@ } /* set inwordLut contents. Invoked by ioctl(). */ -int sel_loadlut(const unsigned long arg) +int sel_loadlut(char __user *p) { - return copy_from_user(inwordLut, (u32 *)(arg+4), 32) ? -EFAULT : 0; + return copy_from_user(inwordLut, (u32 __user *)(p+4), 32) ? -EFAULT : 0; } /* does screen address p correspond to character at LH/RH edge of screen? */ @@ -113,7 +113,7 @@ } /* set the current selection. Invoked by ioctl() or by kernel code. */ -int set_selection(const struct tiocl_selection *sel, struct tty_struct *tty, int user) +int set_selection(const struct tiocl_selection __user *sel, struct tty_struct *tty) { int sel_mode, new_sel_start, new_sel_end, spc; char *bp, *obp; @@ -124,21 +124,13 @@ { unsigned short xs, ys, xe, ye; - if (user) { - if (verify_area(VERIFY_READ, sel, sizeof(*sel))) - return -EFAULT; - __get_user(xs, &sel->xs); - __get_user(ys, &sel->ys); - __get_user(xe, &sel->xe); - __get_user(ye, &sel->ye); - __get_user(sel_mode, &sel->sel_mode); - } else { - xs = sel->xs; /* set selection from kernel */ - ys = sel->ys; - xe = sel->xe; - ye = sel->ye; - sel_mode = sel->sel_mode; - } + if (verify_area(VERIFY_READ, sel, sizeof(*sel))) + return -EFAULT; + __get_user(xs, &sel->xs); + __get_user(ys, &sel->ys); + __get_user(xe, &sel->xe); + __get_user(ye, &sel->ye); + __get_user(sel_mode, &sel->sel_mode); xs--; ys--; xe--; ye--; xs = limit(xs, video_num_columns - 1); ys = limit(ys, video_num_lines - 1); diff -urN linux-2.6.7-rc2/drivers/char/sonypi.c linux-2.6.7-rc3/drivers/char/sonypi.c --- linux-2.6.7-rc2/drivers/char/sonypi.c 2004-05-09 19:32:54.000000000 -0700 +++ linux-2.6.7-rc3/drivers/char/sonypi.c 2004-06-07 12:55:04.340677638 -0700 @@ -461,8 +461,9 @@ return 0; } -static ssize_t sonypi_misc_read(struct file * file, char * buf, - size_t count, loff_t *pos) { +static ssize_t sonypi_misc_read(struct file * file, char __user * buf, + size_t count, loff_t *pos) +{ DECLARE_WAITQUEUE(wait, current); ssize_t i = count; unsigned char c; @@ -504,6 +505,7 @@ static int sonypi_misc_ioctl(struct inode *ip, struct file *fp, unsigned int cmd, unsigned long arg) { int ret = 0; + void __user *argp = (void __user *)arg; u8 val8; u16 val16; @@ -514,11 +516,11 @@ ret = -EIO; break; } - if (copy_to_user((u8 *)arg, &val8, sizeof(val8))) + if (copy_to_user(argp, &val8, sizeof(val8))) ret = -EFAULT; break; case SONYPI_IOCSBRT: - if (copy_from_user(&val8, (u8 *)arg, sizeof(val8))) { + if (copy_from_user(&val8, argp, sizeof(val8))) { ret = -EFAULT; break; } @@ -530,7 +532,7 @@ ret = -EIO; break; } - if (copy_to_user((u16 *)arg, &val16, sizeof(val16))) + if (copy_to_user(argp, &val16, sizeof(val16))) ret = -EFAULT; break; case SONYPI_IOCGBAT1REM: @@ -538,7 +540,7 @@ ret = -EIO; break; } - if (copy_to_user((u16 *)arg, &val16, sizeof(val16))) + if (copy_to_user(argp, &val16, sizeof(val16))) ret = -EFAULT; break; case SONYPI_IOCGBAT2CAP: @@ -546,7 +548,7 @@ ret = -EIO; break; } - if (copy_to_user((u16 *)arg, &val16, sizeof(val16))) + if (copy_to_user(argp, &val16, sizeof(val16))) ret = -EFAULT; break; case SONYPI_IOCGBAT2REM: @@ -554,7 +556,7 @@ ret = -EIO; break; } - if (copy_to_user((u16 *)arg, &val16, sizeof(val16))) + if (copy_to_user(argp, &val16, sizeof(val16))) ret = -EFAULT; break; case SONYPI_IOCGBATFLAGS: @@ -563,16 +565,16 @@ break; } val8 &= 0x07; - if (copy_to_user((u8 *)arg, &val8, sizeof(val8))) + if (copy_to_user(argp, &val8, sizeof(val8))) ret = -EFAULT; break; case SONYPI_IOCGBLUE: val8 = sonypi_device.bluetooth_power; - if (copy_to_user((u8 *)arg, &val8, sizeof(val8))) + if (copy_to_user(argp, &val8, sizeof(val8))) ret = -EFAULT; break; case SONYPI_IOCSBLUE: - if (copy_from_user(&val8, (u8 *)arg, sizeof(val8))) { + if (copy_from_user(&val8, argp, sizeof(val8))) { ret = -EFAULT; break; } diff -urN linux-2.6.7-rc2/drivers/char/synclink.c linux-2.6.7-rc3/drivers/char/synclink.c --- linux-2.6.7-rc2/drivers/char/synclink.c 2004-05-09 19:32:28.000000000 -0700 +++ linux-2.6.7-rc3/drivers/char/synclink.c 2004-06-07 12:55:04.346677886 -0700 @@ -1,7 +1,7 @@ /* * linux/drivers/char/synclink.c * - * $Id: synclink.c,v 4.21 2004/03/08 15:29:22 paulkf Exp $ + * $Id: synclink.c,v 4.24 2004/06/03 14:50:09 paulkf Exp $ * * Device driver for Microgate SyncLink ISA and PCI * high speed multiprotocol serial adapters. @@ -782,7 +782,6 @@ void mgsl_release_resources(struct mgsl_struct *info); void mgsl_add_device(struct mgsl_struct *info); struct mgsl_struct* mgsl_allocate_device(void); -int mgsl_enum_isa_devices(void); /* * DMA buffer manupulation functions. @@ -853,19 +852,22 @@ static int tiocmset(struct tty_struct *tty, struct file *file, unsigned int set, unsigned int clear); static int mgsl_get_stats(struct mgsl_struct * info, struct mgsl_icount - *user_icount); -static int mgsl_get_params(struct mgsl_struct * info, MGSL_PARAMS *user_params); -static int mgsl_set_params(struct mgsl_struct * info, MGSL_PARAMS *new_params); -static int mgsl_get_txidle(struct mgsl_struct * info, int*idle_mode); + __user *user_icount); +static int mgsl_get_params(struct mgsl_struct * info, MGSL_PARAMS __user *user_params); +static int mgsl_set_params(struct mgsl_struct * info, MGSL_PARAMS __user *new_params); +static int mgsl_get_txidle(struct mgsl_struct * info, int __user *idle_mode); static int mgsl_set_txidle(struct mgsl_struct * info, int idle_mode); static int mgsl_txenable(struct mgsl_struct * info, int enable); static int mgsl_txabort(struct mgsl_struct * info); static int mgsl_rxenable(struct mgsl_struct * info, int enable); -static int mgsl_wait_event(struct mgsl_struct * info, int * mask); +static int mgsl_wait_event(struct mgsl_struct * info, int __user *mask); static int mgsl_loopmode_send_done( struct mgsl_struct * info ); #define jiffies_from_ms(a) ((((a) * HZ)/1000)+1) +/* set non-zero on successful registration with PCI subsystem */ +static int pci_registered; + /* * Global linked list of SyncLink devices */ @@ -909,7 +911,7 @@ MODULE_PARM(txholdbufs,"1-" __MODULE_STRING(MAX_TOTAL_DEVICES) "i"); static char *driver_name = "SyncLink serial driver"; -static char *driver_version = "$Revision: 4.21 $"; +static char *driver_version = "$Revision: 4.24 $"; static int synclink_init_one (struct pci_dev *dev, const struct pci_device_id *ent); @@ -950,8 +952,10 @@ * (gdb) to get the .text address for the add-symbol-file command. * This allows remote debugging of dynamically loadable modules. */ -void* mgsl_get_text_ptr(void); -void* mgsl_get_text_ptr() {return mgsl_get_text_ptr;} +void* mgsl_get_text_ptr(void) +{ + return mgsl_get_text_ptr; +} /* * tmp_buf is used as a temporary buffer by mgsl_write. We need to @@ -2521,7 +2525,7 @@ * * Return Value: 0 if success, otherwise error code */ -static int mgsl_get_stats(struct mgsl_struct * info, struct mgsl_icount *user_icount) +static int mgsl_get_stats(struct mgsl_struct * info, struct mgsl_icount __user *user_icount) { int err; @@ -2550,7 +2554,7 @@ * * Return Value: 0 if success, otherwise error code */ -static int mgsl_get_params(struct mgsl_struct * info, MGSL_PARAMS *user_params) +static int mgsl_get_params(struct mgsl_struct * info, MGSL_PARAMS __user *user_params) { int err; if (debug_level >= DEBUG_LEVEL_INFO) @@ -2580,7 +2584,7 @@ * * Return Value: 0 if success, otherwise error code */ -static int mgsl_set_params(struct mgsl_struct * info, MGSL_PARAMS *new_params) +static int mgsl_set_params(struct mgsl_struct * info, MGSL_PARAMS __user *new_params) { unsigned long flags; MGSL_PARAMS tmp_params; @@ -2616,7 +2620,7 @@ * * Return Value: 0 if success, otherwise error code */ -static int mgsl_get_txidle(struct mgsl_struct * info, int*idle_mode) +static int mgsl_get_txidle(struct mgsl_struct * info, int __user *idle_mode) { int err; @@ -2763,7 +2767,7 @@ * of events triggerred, * otherwise error code */ -static int mgsl_wait_event(struct mgsl_struct * info, int * mask_ptr) +static int mgsl_wait_event(struct mgsl_struct * info, int __user * mask_ptr) { unsigned long flags; int s; @@ -3051,16 +3055,17 @@ { int error; struct mgsl_icount cnow; /* kernel counter temps */ - struct serial_icounter_struct *p_cuser; /* user space */ + void __user *argp = (void __user *)arg; + struct serial_icounter_struct __user *p_cuser; /* user space */ unsigned long flags; switch (cmd) { case MGSL_IOCGPARAMS: - return mgsl_get_params(info,(MGSL_PARAMS *)arg); + return mgsl_get_params(info, argp); case MGSL_IOCSPARAMS: - return mgsl_set_params(info,(MGSL_PARAMS *)arg); + return mgsl_set_params(info, argp); case MGSL_IOCGTXIDLE: - return mgsl_get_txidle(info,(int*)arg); + return mgsl_get_txidle(info, argp); case MGSL_IOCSTXIDLE: return mgsl_set_txidle(info,(int)arg); case MGSL_IOCTXENABLE: @@ -3070,9 +3075,9 @@ case MGSL_IOCTXABORT: return mgsl_txabort(info); case MGSL_IOCGSTATS: - return mgsl_get_stats(info,(struct mgsl_icount*)arg); + return mgsl_get_stats(info, argp); case MGSL_IOCWAITEVENT: - return mgsl_wait_event(info,(int*)arg); + return mgsl_wait_event(info, argp); case MGSL_IOCLOOPTXDONE: return mgsl_loopmode_send_done(info); /* Wait for modem input (DCD,RI,DSR,CTS) change @@ -3091,7 +3096,7 @@ spin_lock_irqsave(&info->irq_spinlock,flags); cnow = info->icount; spin_unlock_irqrestore(&info->irq_spinlock,flags); - p_cuser = (struct serial_icounter_struct *) arg; + p_cuser = argp; PUT_USER(error,cnow.cts, &p_cuser->cts); if (error) return error; PUT_USER(error,cnow.dsr, &p_cuser->dsr); @@ -4425,7 +4430,7 @@ * Arguments: none * Return Value: pointer to mgsl_struct if success, otherwise NULL */ -struct mgsl_struct* mgsl_allocate_device() +struct mgsl_struct* mgsl_allocate_device(void) { struct mgsl_struct *info; @@ -4484,10 +4489,11 @@ /* * perform tty device initialization */ -int mgsl_init_tty(void); -int mgsl_init_tty() +static int mgsl_init_tty(void) { - serial_driver = alloc_tty_driver(mgsl_device_count); + int rc; + + serial_driver = alloc_tty_driver(128); if (!serial_driver) return -ENOMEM; @@ -4503,9 +4509,13 @@ B9600 | CS8 | CREAD | HUPCL | CLOCAL; serial_driver->flags = TTY_DRIVER_REAL_RAW; tty_set_operations(serial_driver, &mgsl_ops); - if (tty_register_driver(serial_driver) < 0) + if ((rc = tty_register_driver(serial_driver)) < 0) { printk("%s(%d):Couldn't register serial driver\n", __FILE__,__LINE__); + put_tty_driver(serial_driver); + serial_driver = NULL; + return rc; + } printk("%s %s, tty major#%d\n", driver_name, driver_version, @@ -4515,7 +4525,7 @@ /* enumerate user specified ISA adapters */ -int mgsl_enum_isa_devices() +static void mgsl_enum_isa_devices(void) { struct mgsl_struct *info; int i; @@ -4546,51 +4556,9 @@ mgsl_add_device( info ); } - - return 0; } -/* mgsl_init() - * - * Driver initialization entry point. - * - * Arguments: None - * Return Value: 0 if success, otherwise error code - */ -int __init mgsl_init(void) -{ - int rc; - - printk("%s %s\n", driver_name, driver_version); - - mgsl_enum_isa_devices(); - pci_register_driver(&synclink_pci_driver); - - if ( !mgsl_device_list ) { - printk("%s(%d):No SyncLink devices found.\n",__FILE__,__LINE__); - return -ENODEV; - } - if ((rc = mgsl_init_tty())) - return rc; - - return 0; -} - -static int __init synclink_init(void) -{ -/* Uncomment this to kernel debug module. - * mgsl_get_text_ptr() leaves the .text address in eax - * which can be used with add-symbol-file with gdb. - */ - if (break_on_load) { - mgsl_get_text_ptr(); - BREAKPOINT(); - } - - return mgsl_init(); -} - -static void __exit synclink_exit(void) +static void synclink_cleanup(void) { int rc; struct mgsl_struct *info; @@ -4598,11 +4566,13 @@ printk("Unloading %s: %s\n", driver_name, driver_version); - if ((rc = tty_unregister_driver(serial_driver))) - printk("%s(%d) failed to unregister tty driver err=%d\n", - __FILE__,__LINE__,rc); + if (serial_driver) { + if ((rc = tty_unregister_driver(serial_driver))) + printk("%s(%d) failed to unregister tty driver err=%d\n", + __FILE__,__LINE__,rc); + put_tty_driver(serial_driver); + } - put_tty_driver(serial_driver); info = mgsl_device_list; while(info) { #ifdef CONFIG_SYNCLINK_SYNCPPP @@ -4620,7 +4590,40 @@ tmp_buf = NULL; } - pci_unregister_driver(&synclink_pci_driver); + if (pci_registered) + pci_unregister_driver(&synclink_pci_driver); +} + +static int __init synclink_init(void) +{ + int rc; + + if (break_on_load) { + mgsl_get_text_ptr(); + BREAKPOINT(); + } + + printk("%s %s\n", driver_name, driver_version); + + mgsl_enum_isa_devices(); + if ((rc = pci_register_driver(&synclink_pci_driver)) < 0) + printk("%s:failed to register PCI driver, error=%d\n",__FILE__,rc); + else + pci_registered = 1; + + if ((rc = mgsl_init_tty()) < 0) + goto error; + + return 0; + +error: + synclink_cleanup(); + return rc; +} + +static void __exit synclink_exit(void) +{ + synclink_cleanup(); } module_init(synclink_init); diff -urN linux-2.6.7-rc2/drivers/char/synclinkmp.c linux-2.6.7-rc3/drivers/char/synclinkmp.c --- linux-2.6.7-rc2/drivers/char/synclinkmp.c 2004-05-09 19:32:21.000000000 -0700 +++ linux-2.6.7-rc3/drivers/char/synclinkmp.c 2004-06-07 12:55:04.350678052 -0700 @@ -1,5 +1,5 @@ /* - * $Id: synclinkmp.c,v 4.19 2004/03/08 15:29:23 paulkf Exp $ + * $Id: synclinkmp.c,v 4.22 2004/06/03 14:50:10 paulkf Exp $ * * Device driver for Microgate SyncLink Multiport * high speed multiprotocol serial adapter. @@ -494,7 +494,7 @@ MODULE_PARM(dosyncppp,"1-" __MODULE_STRING(MAX_DEVICES) "i"); static char *driver_name = "SyncLink MultiPort driver"; -static char *driver_version = "$Revision: 4.19 $"; +static char *driver_version = "$Revision: 4.22 $"; static int synclinkmp_init_one(struct pci_dev *dev,const struct pci_device_id *ent); static void synclinkmp_remove_one(struct pci_dev *dev); @@ -3781,56 +3781,7 @@ .tiocmset = tiocmset, }; -/* Driver initialization entry point. - */ - -static int __init synclinkmp_init(void) -{ - if (break_on_load) { - synclinkmp_get_text_ptr(); - BREAKPOINT(); - } - - printk("%s %s\n", driver_name, driver_version); - - synclinkmp_adapter_count = -1; - pci_register_driver(&synclinkmp_pci_driver); - - if ( !synclinkmp_device_list ) { - printk("%s(%d):No SyncLink devices found.\n",__FILE__,__LINE__); - return -ENODEV; - } - - serial_driver = alloc_tty_driver(synclinkmp_device_count); - if (!serial_driver) - return -ENOMEM; - - /* Initialize the tty_driver structure */ - - serial_driver->owner = THIS_MODULE; - serial_driver->driver_name = "synclinkmp"; - serial_driver->name = "ttySLM"; - serial_driver->major = ttymajor; - serial_driver->minor_start = 64; - serial_driver->type = TTY_DRIVER_TYPE_SERIAL; - serial_driver->subtype = SERIAL_TYPE_NORMAL; - serial_driver->init_termios = tty_std_termios; - serial_driver->init_termios.c_cflag = - B9600 | CS8 | CREAD | HUPCL | CLOCAL; - serial_driver->flags = TTY_DRIVER_REAL_RAW; - tty_set_operations(serial_driver, &ops); - if (tty_register_driver(serial_driver) < 0) - printk("%s(%d):Couldn't register serial driver\n", - __FILE__,__LINE__); - - printk("%s %s, tty major#%d\n", - driver_name, driver_version, - serial_driver->major); - - return 0; -} - -static void __exit synclinkmp_exit(void) +static void synclinkmp_cleanup(void) { unsigned long flags; int rc; @@ -3839,10 +3790,12 @@ printk("Unloading %s %s\n", driver_name, driver_version); - if ((rc = tty_unregister_driver(serial_driver))) - printk("%s(%d) failed to unregister tty driver err=%d\n", - __FILE__,__LINE__,rc); - put_tty_driver(serial_driver); + if (serial_driver) { + if ((rc = tty_unregister_driver(serial_driver))) + printk("%s(%d) failed to unregister tty driver err=%d\n", + __FILE__,__LINE__,rc); + put_tty_driver(serial_driver); + } info = synclinkmp_device_list; while(info) { @@ -3882,6 +3835,69 @@ pci_unregister_driver(&synclinkmp_pci_driver); } +/* Driver initialization entry point. + */ + +static int __init synclinkmp_init(void) +{ + int rc; + + if (break_on_load) { + synclinkmp_get_text_ptr(); + BREAKPOINT(); + } + + printk("%s %s\n", driver_name, driver_version); + + if ((rc = pci_register_driver(&synclinkmp_pci_driver)) < 0) { + printk("%s:failed to register PCI driver, error=%d\n",__FILE__,rc); + return rc; + } + + serial_driver = alloc_tty_driver(128); + if (!serial_driver) { + rc = -ENOMEM; + goto error; + } + + /* Initialize the tty_driver structure */ + + serial_driver->owner = THIS_MODULE; + serial_driver->driver_name = "synclinkmp"; + serial_driver->name = "ttySLM"; + serial_driver->major = ttymajor; + serial_driver->minor_start = 64; + serial_driver->type = TTY_DRIVER_TYPE_SERIAL; + serial_driver->subtype = SERIAL_TYPE_NORMAL; + serial_driver->init_termios = tty_std_termios; + serial_driver->init_termios.c_cflag = + B9600 | CS8 | CREAD | HUPCL | CLOCAL; + serial_driver->flags = TTY_DRIVER_REAL_RAW; + tty_set_operations(serial_driver, &ops); + if ((rc = tty_register_driver(serial_driver)) < 0) { + printk("%s(%d):Couldn't register serial driver\n", + __FILE__,__LINE__); + put_tty_driver(serial_driver); + serial_driver = NULL; + goto error; + } + + printk("%s %s, tty major#%d\n", + driver_name, driver_version, + serial_driver->major); + + return 0; + +error: + synclinkmp_cleanup(); + return rc; +} + +static void __exit synclinkmp_exit(void) +{ + synclinkmp_cleanup(); +} + module_init(synclinkmp_init); module_exit(synclinkmp_exit); diff -urN linux-2.6.7-rc2/drivers/char/toshiba.c linux-2.6.7-rc3/drivers/char/toshiba.c --- linux-2.6.7-rc2/drivers/char/toshiba.c 2004-05-09 19:33:20.000000000 -0700 +++ linux-2.6.7-rc3/drivers/char/toshiba.c 2004-06-07 12:55:04.351678094 -0700 @@ -251,13 +251,14 @@ unsigned long arg) { SMMRegisters regs; + SMMRegisters __user *argp = (SMMRegisters __user *)arg; unsigned short ax,bx; int err; - if (!arg) + if (!argp) return -EINVAL; - if (copy_from_user(®s, (SMMRegisters *) arg, sizeof(SMMRegisters))) + if (copy_from_user(®s, argp, sizeof(SMMRegisters))) return -EFAULT; switch (cmd) { @@ -281,7 +282,7 @@ return -EINVAL; } - if (copy_to_user((SMMRegisters *) arg, ®s, sizeof(SMMRegisters))) + if (copy_to_user(argp, ®s, sizeof(SMMRegisters))) return -EFAULT; return (err==0) ? 0:-EINVAL; diff -urN linux-2.6.7-rc2/drivers/char/tpqic02.c linux-2.6.7-rc3/drivers/char/tpqic02.c --- linux-2.6.7-rc2/drivers/char/tpqic02.c 2004-05-09 19:32:36.000000000 -0700 +++ linux-2.6.7-rc3/drivers/char/tpqic02.c 2004-06-07 12:55:04.353678176 -0700 @@ -1727,7 +1727,7 @@ * request would return the EOF flag for the previous file. */ -static ssize_t qic02_tape_read(struct file *filp, char *buf, size_t count, loff_t * ppos) +static ssize_t qic02_tape_read(struct file *filp, char __user *buf, size_t count, loff_t * ppos) { int type = iminor(filp->f_dentry->d_inode); unsigned short flags = filp->f_flags; @@ -1905,7 +1905,7 @@ * tape device again. The driver will detect an exception status in (No Cartridge) * and force a rewind. After that tar may continue writing. */ -static ssize_t qic02_tape_write(struct file *filp, const char *buf, size_t count, loff_t * ppos) +static ssize_t qic02_tape_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos) { int type = iminor(filp->f_dentry->d_inode); unsigned short flags = filp->f_flags; @@ -2400,6 +2400,7 @@ struct mtop operation; unsigned char blk_addr[6]; struct mtpos ioctl_tell; + void __user *argp = (void __user *)ioarg; if (TP_DIAGS(current_type)) @@ -2416,7 +2417,7 @@ if (c == _IOC_NR(MTIOCGETCONFIG)) { CHECK_IOC_SIZE(mtconfiginfo); - if (copy_to_user((char *) ioarg, (char *) &qic02_tape_dynconf, sizeof(qic02_tape_dynconf))) + if (copy_to_user(argp, &qic02_tape_dynconf, sizeof(qic02_tape_dynconf))) return -EFAULT; return 0; } else if (c == _IOC_NR(MTIOCSETCONFIG)) { @@ -2438,7 +2439,7 @@ qic02_release_resources(); /* and go zombie */ /* copy struct from user space to kernel space */ - if (copy_from_user((char *) &qic02_tape_dynconf, (char *) ioarg, sizeof(qic02_tape_dynconf))) + if (copy_from_user(&qic02_tape_dynconf, argp, sizeof(qic02_tape_dynconf))) return -EFAULT; return update_ifc_masks(qic02_tape_dynconf.ifc_type); @@ -2452,7 +2453,7 @@ CHECK_IOC_SIZE(mtop); /* copy mtop struct from user space to kernel space */ - if (copy_from_user((char *) &operation, (char *) ioarg, sizeof(operation))) + if (copy_from_user(&operation, argp, sizeof(operation))) return -EFAULT; /* ---note: mt_count is signed, negative seeks must be @@ -2507,7 +2508,7 @@ */ /* copy results to user space */ - if (copy_to_user((char *) ioarg, (char *) &ioctl_status, sizeof(ioctl_status))) + if (copy_to_user(argp, &ioctl_status, sizeof(ioctl_status))) return -EFAULT; return 0; } else if (TP_HAVE_TELL && (c == _IOC_NR(MTIOCPOS))) { @@ -2527,7 +2528,7 @@ ioctl_tell.mt_blkno = (blk_addr[3] << 16) | (blk_addr[4] << 8) | blk_addr[5]; /* copy results to user space */ - if (copy_to_user((char *) ioarg, (char *) &ioctl_tell, sizeof(ioctl_tell))) + if (copy_to_user(argp, &ioctl_tell, sizeof(ioctl_tell))) return -EFAULT; return 0; @@ -2536,7 +2537,7 @@ } /* qic02_tape_ioctl */ -static ssize_t qic02_do_tape_read(struct file *filp, char *buf, size_t count, loff_t * ppos) +static ssize_t qic02_do_tape_read(struct file *filp, char __user *buf, size_t count, loff_t * ppos) { int err; @@ -2547,7 +2548,7 @@ return err; } -static ssize_t qic02_do_tape_write(struct file *filp, const char *buf, size_t count, loff_t * ppos) +static ssize_t qic02_do_tape_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos) { int err; diff -urN linux-2.6.7-rc2/drivers/char/tty_io.c linux-2.6.7-rc3/drivers/char/tty_io.c --- linux-2.6.7-rc2/drivers/char/tty_io.c 2004-06-07 12:54:48.942039879 -0700 +++ linux-2.6.7-rc3/drivers/char/tty_io.c 2004-06-07 12:55:04.355678259 -0700 @@ -134,9 +134,9 @@ static void initialize_tty_struct(struct tty_struct *tty); -static ssize_t tty_read(struct file *, char *, size_t, loff_t *); -static ssize_t tty_write(struct file *, const char *, size_t, loff_t *); -ssize_t redirected_tty_write(struct file *, const char *, size_t, loff_t *); +static ssize_t tty_read(struct file *, char __user *, size_t, loff_t *); +static ssize_t tty_write(struct file *, const char __user *, size_t, loff_t *); +ssize_t redirected_tty_write(struct file *, const char __user *, size_t, loff_t *); static unsigned int tty_poll(struct file *, poll_table *); static int tty_open(struct inode *, struct file *); static int tty_release(struct inode *, struct file *); @@ -339,7 +339,7 @@ EXPORT_SYMBOL(tty_check_change); -static ssize_t hung_up_tty_read(struct file * file, char * buf, +static ssize_t hung_up_tty_read(struct file * file, char __user * buf, size_t count, loff_t *ppos) { /* Can't seek (pread) on ttys. */ @@ -348,7 +348,7 @@ return 0; } -static ssize_t hung_up_tty_write(struct file * file, const char * buf, +static ssize_t hung_up_tty_write(struct file * file, const char __user * buf, size_t count, loff_t *ppos) { /* Can't seek (pwrite) on ttys. */ @@ -638,7 +638,7 @@ EXPORT_SYMBOL(start_tty); -static ssize_t tty_read(struct file * file, char * buf, size_t count, +static ssize_t tty_read(struct file * file, char __user * buf, size_t count, loff_t *ppos) { int i; @@ -672,10 +672,10 @@ * denial-of-service type attacks */ static inline ssize_t do_tty_write( - ssize_t (*write)(struct tty_struct *, struct file *, const unsigned char *, size_t), + ssize_t (*write)(struct tty_struct *, struct file *, const unsigned char __user *, size_t), struct tty_struct *tty, struct file *file, - const unsigned char *buf, + const unsigned char __user *buf, size_t count) { ssize_t ret = 0, written = 0; @@ -717,7 +717,7 @@ } -static ssize_t tty_write(struct file * file, const char * buf, size_t count, +static ssize_t tty_write(struct file * file, const char __user * buf, size_t count, loff_t *ppos) { struct tty_struct * tty; @@ -735,10 +735,10 @@ if (!tty->ldisc.write) return -EIO; return do_tty_write(tty->ldisc.write, tty, file, - (const unsigned char *)buf, count); + (const unsigned char __user *)buf, count); } -ssize_t redirected_tty_write(struct file * file, const char * buf, size_t count, +ssize_t redirected_tty_write(struct file * file, const char __user * buf, size_t count, loff_t *ppos) { struct file *p = NULL; @@ -1490,19 +1490,19 @@ return 0; } -static int tiocsti(struct tty_struct *tty, char * arg) +static int tiocsti(struct tty_struct *tty, char __user *p) { char ch, mbz = 0; if ((current->signal->tty != tty) && !capable(CAP_SYS_ADMIN)) return -EPERM; - if (get_user(ch, arg)) + if (get_user(ch, p)) return -EFAULT; tty->ldisc.receive_buf(tty, &ch, &mbz, 1); return 0; } -static int tiocgwinsz(struct tty_struct *tty, struct winsize * arg) +static int tiocgwinsz(struct tty_struct *tty, struct winsize __user * arg) { if (copy_to_user(arg, &tty->winsize, sizeof(*arg))) return -EFAULT; @@ -1510,7 +1510,7 @@ } static int tiocswinsz(struct tty_struct *tty, struct tty_struct *real_tty, - struct winsize * arg) + struct winsize __user * arg) { struct winsize tmp_ws; @@ -1565,11 +1565,11 @@ } -static int fionbio(struct file *file, int *arg) +static int fionbio(struct file *file, int __user *p) { int nonblock; - if (get_user(nonblock, arg)) + if (get_user(nonblock, p)) return -EFAULT; if (nonblock) @@ -1620,7 +1620,7 @@ return 0; } -static int tiocgpgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t *arg) +static int tiocgpgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t __user *p) { /* * (tty == real_tty) is a cheap way of @@ -1628,10 +1628,10 @@ */ if (tty == real_tty && current->signal->tty != real_tty) return -ENOTTY; - return put_user(real_tty->pgrp, arg); + return put_user(real_tty->pgrp, p); } -static int tiocspgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t *arg) +static int tiocspgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t __user *p) { pid_t pgrp; int retval = tty_check_change(real_tty); @@ -1644,7 +1644,7 @@ (current->signal->tty != real_tty) || (real_tty->session != current->signal->session)) return -ENOTTY; - if (get_user(pgrp, (pid_t *) arg)) + if (get_user(pgrp, p)) return -EFAULT; if (pgrp < 0) return -EINVAL; @@ -1654,7 +1654,7 @@ return 0; } -static int tiocgsid(struct tty_struct *tty, struct tty_struct *real_tty, pid_t *arg) +static int tiocgsid(struct tty_struct *tty, struct tty_struct *real_tty, pid_t __user *p) { /* * (tty == real_tty) is a cheap way of @@ -1664,14 +1664,14 @@ return -ENOTTY; if (real_tty->session <= 0) return -ENOTTY; - return put_user(real_tty->session, arg); + return put_user(real_tty->session, p); } -static int tiocsetd(struct tty_struct *tty, int *arg) +static int tiocsetd(struct tty_struct *tty, int __user *p) { int ldisc; - if (get_user(ldisc, arg)) + if (get_user(ldisc, p)) return -EFAULT; return tty_set_ldisc(tty, ldisc); } @@ -1690,7 +1690,7 @@ } static int -tty_tiocmget(struct tty_struct *tty, struct file *file, unsigned long arg) +tty_tiocmget(struct tty_struct *tty, struct file *file, int __user *p) { int retval = -EINVAL; @@ -1698,21 +1698,21 @@ retval = tty->driver->tiocmget(tty, file); if (retval >= 0) - retval = put_user(retval, (int *)arg); + retval = put_user(retval, p); } return retval; } static int tty_tiocmset(struct tty_struct *tty, struct file *file, unsigned int cmd, - unsigned long arg) + unsigned __user *p) { int retval = -EINVAL; if (tty->driver->tiocmset) { unsigned int set, clear, val; - retval = get_user(val, (unsigned int *)arg); + retval = get_user(val, p); if (retval) return retval; @@ -1745,6 +1745,7 @@ unsigned int cmd, unsigned long arg) { struct tty_struct *tty, *real_tty; + void __user *p = (void __user *)arg; int retval; tty = (struct tty_struct *)file->private_data; @@ -1802,15 +1803,15 @@ switch (cmd) { case TIOCSTI: - return tiocsti(tty, (char *)arg); + return tiocsti(tty, p); case TIOCGWINSZ: - return tiocgwinsz(tty, (struct winsize *) arg); + return tiocgwinsz(tty, p); case TIOCSWINSZ: - return tiocswinsz(tty, real_tty, (struct winsize *) arg); + return tiocswinsz(tty, real_tty, p); case TIOCCONS: return real_tty!=tty ? -EINVAL : tioccons(file); case FIONBIO: - return fionbio(file, (int *) arg); + return fionbio(file, p); case TIOCEXCL: set_bit(TTY_EXCLUSIVE, &tty->flags); return 0; @@ -1829,15 +1830,15 @@ case TIOCSCTTY: return tiocsctty(tty, arg); case TIOCGPGRP: - return tiocgpgrp(tty, real_tty, (pid_t *) arg); + return tiocgpgrp(tty, real_tty, p); case TIOCSPGRP: - return tiocspgrp(tty, real_tty, (pid_t *) arg); + return tiocspgrp(tty, real_tty, p); case TIOCGSID: - return tiocgsid(tty, real_tty, (pid_t *) arg); + return tiocgsid(tty, real_tty, p); case TIOCGETD: - return put_user(tty->ldisc.num, (int *) arg); + return put_user(tty->ldisc.num, (int __user *)p); case TIOCSETD: - return tiocsetd(tty, (int *) arg); + return tiocsetd(tty, p); #ifdef CONFIG_VT case TIOCLINUX: return tioclinux(tty, arg); @@ -1865,12 +1866,12 @@ return send_break(tty, arg ? arg*(HZ/10) : HZ/4); case TIOCMGET: - return tty_tiocmget(tty, file, arg); + return tty_tiocmget(tty, file, p); case TIOCMSET: case TIOCMBIC: case TIOCMBIS: - return tty_tiocmset(tty, file, cmd, arg); + return tty_tiocmset(tty, file, cmd, p); } if (tty->driver->ioctl) { int retval = (tty->driver->ioctl)(tty, file, cmd, arg); diff -urN linux-2.6.7-rc2/drivers/char/tty_ioctl.c linux-2.6.7-rc3/drivers/char/tty_ioctl.c --- linux-2.6.7-rc2/drivers/char/tty_ioctl.c 2004-05-09 19:33:21.000000000 -0700 +++ linux-2.6.7-rc3/drivers/char/tty_ioctl.c 2004-06-07 12:55:04.356678301 -0700 @@ -140,7 +140,7 @@ (*tty->ldisc.set_termios)(tty, &old_termios); } -static int set_termios(struct tty_struct * tty, unsigned long arg, int opt) +static int set_termios(struct tty_struct * tty, void __user *arg, int opt) { struct termios tmp_termios; int retval = tty_check_change(tty); @@ -151,11 +151,11 @@ if (opt & TERMIOS_TERMIO) { memcpy(&tmp_termios, tty->termios, sizeof(struct termios)); if (user_termio_to_kernel_termios(&tmp_termios, - (struct termio *) arg)) + (struct termio __user *)arg)) return -EFAULT; } else { if (user_termios_to_kernel_termios(&tmp_termios, - (struct termios *) arg)) + (struct termios __user *)arg)) return -EFAULT; } @@ -172,7 +172,7 @@ return 0; } -static int get_termio(struct tty_struct * tty, struct termio * termio) +static int get_termio(struct tty_struct * tty, struct termio __user * termio) { if (kernel_termios_to_user_termio(termio, tty->termios)) return -EFAULT; @@ -222,7 +222,7 @@ return flags; } -static int get_sgttyb(struct tty_struct * tty, struct sgttyb * sgttyb) +static int get_sgttyb(struct tty_struct * tty, struct sgttyb __user * sgttyb) { struct sgttyb tmp; @@ -260,7 +260,7 @@ } } -static int set_sgttyb(struct tty_struct * tty, struct sgttyb * sgttyb) +static int set_sgttyb(struct tty_struct * tty, struct sgttyb __user * sgttyb) { int retval; struct sgttyb tmp; @@ -281,7 +281,7 @@ #endif #ifdef TIOCGETC -static int get_tchars(struct tty_struct * tty, struct tchars * tchars) +static int get_tchars(struct tty_struct * tty, struct tchars __user * tchars) { struct tchars tmp; @@ -294,7 +294,7 @@ return copy_to_user(tchars, &tmp, sizeof(tmp)) ? -EFAULT : 0; } -static int set_tchars(struct tty_struct * tty, struct tchars * tchars) +static int set_tchars(struct tty_struct * tty, struct tchars __user * tchars) { struct tchars tmp; @@ -311,7 +311,7 @@ #endif #ifdef TIOCGLTC -static int get_ltchars(struct tty_struct * tty, struct ltchars * ltchars) +static int get_ltchars(struct tty_struct * tty, struct ltchars __user * ltchars) { struct ltchars tmp; @@ -324,7 +324,7 @@ return copy_to_user(ltchars, &tmp, sizeof(tmp)) ? -EFAULT : 0; } -static int set_ltchars(struct tty_struct * tty, struct ltchars * ltchars) +static int set_ltchars(struct tty_struct * tty, struct ltchars __user * ltchars) { struct ltchars tmp; @@ -363,6 +363,7 @@ unsigned int cmd, unsigned long arg) { struct tty_struct * real_tty; + void __user *p = (void __user *)arg; int retval; if (tty->driver->type == TTY_DRIVER_TYPE_PTY && @@ -374,41 +375,41 @@ switch (cmd) { #ifdef TIOCGETP case TIOCGETP: - return get_sgttyb(real_tty, (struct sgttyb *) arg); + return get_sgttyb(real_tty, (struct sgttyb __user *) arg); case TIOCSETP: case TIOCSETN: - return set_sgttyb(real_tty, (struct sgttyb *) arg); + return set_sgttyb(real_tty, (struct sgttyb __user *) arg); #endif #ifdef TIOCGETC case TIOCGETC: - return get_tchars(real_tty, (struct tchars *) arg); + return get_tchars(real_tty, p); case TIOCSETC: - return set_tchars(real_tty, (struct tchars *) arg); + return set_tchars(real_tty, p); #endif #ifdef TIOCGLTC case TIOCGLTC: - return get_ltchars(real_tty, (struct ltchars *) arg); + return get_ltchars(real_tty, p); case TIOCSLTC: - return set_ltchars(real_tty, (struct ltchars *) arg); + return set_ltchars(real_tty, p); #endif case TCGETS: - if (kernel_termios_to_user_termios((struct termios *)arg, real_tty->termios)) + if (kernel_termios_to_user_termios((struct termios __user *)arg, real_tty->termios)) return -EFAULT; return 0; case TCSETSF: - return set_termios(real_tty, arg, TERMIOS_FLUSH | TERMIOS_WAIT); + return set_termios(real_tty, p, TERMIOS_FLUSH | TERMIOS_WAIT); case TCSETSW: - return set_termios(real_tty, arg, TERMIOS_WAIT); + return set_termios(real_tty, p, TERMIOS_WAIT); case TCSETS: - return set_termios(real_tty, arg, 0); + return set_termios(real_tty, p, 0); case TCGETA: - return get_termio(real_tty,(struct termio *) arg); + return get_termio(real_tty, p); case TCSETAF: - return set_termios(real_tty, arg, TERMIOS_FLUSH | TERMIOS_WAIT | TERMIOS_TERMIO); + return set_termios(real_tty, p, TERMIOS_FLUSH | TERMIOS_WAIT | TERMIOS_TERMIO); case TCSETAW: - return set_termios(real_tty, arg, TERMIOS_WAIT | TERMIOS_TERMIO); + return set_termios(real_tty, p, TERMIOS_WAIT | TERMIOS_TERMIO); case TCSETA: - return set_termios(real_tty, arg, TERMIOS_TERMIO); + return set_termios(real_tty, p, TERMIOS_TERMIO); case TCXONC: retval = tty_check_change(tty); if (retval) @@ -462,21 +463,21 @@ case TIOCOUTQ: return put_user(tty->driver->chars_in_buffer ? tty->driver->chars_in_buffer(tty) : 0, - (int *) arg); + (int __user *) arg); case TIOCINQ: retval = tty->read_cnt; if (L_ICANON(tty)) retval = inq_canon(tty); - return put_user(retval, (unsigned int *) arg); + return put_user(retval, (unsigned int __user *) arg); case TIOCGLCKTRMIOS: - if (kernel_termios_to_user_termios((struct termios *)arg, real_tty->termios_locked)) + if (kernel_termios_to_user_termios((struct termios __user *)arg, real_tty->termios_locked)) return -EFAULT; return 0; case TIOCSLCKTRMIOS: if (!capable(CAP_SYS_ADMIN)) return -EPERM; - if (user_termios_to_kernel_termios(real_tty->termios_locked, (struct termios *) arg)) + if (user_termios_to_kernel_termios(real_tty->termios_locked, (struct termios __user *) arg)) return -EFAULT; return 0; @@ -487,7 +488,7 @@ if (tty->driver->type != TTY_DRIVER_TYPE_PTY || tty->driver->subtype != PTY_TYPE_MASTER) return -ENOTTY; - if (get_user(pktmode, (int *) arg)) + if (get_user(pktmode, (int __user *) arg)) return -EFAULT; if (pktmode) { if (!tty->packet) { @@ -499,9 +500,9 @@ return 0; } case TIOCGSOFTCAR: - return put_user(C_CLOCAL(tty) ? 1 : 0, (int *) arg); + return put_user(C_CLOCAL(tty) ? 1 : 0, (int __user *)arg); case TIOCSSOFTCAR: - if (get_user(arg, (unsigned int *) arg)) + if (get_user(arg, (unsigned int __user *) arg)) return -EFAULT; tty->termios->c_cflag = ((tty->termios->c_cflag & ~CLOCAL) | diff -urN linux-2.6.7-rc2/drivers/char/vt.c linux-2.6.7-rc3/drivers/char/vt.c --- linux-2.6.7-rc2/drivers/char/vt.c 2004-06-07 12:54:48.944039962 -0700 +++ linux-2.6.7-rc3/drivers/char/vt.c 2004-06-07 12:55:04.359678425 -0700 @@ -152,7 +152,7 @@ static void save_cur(int currcons); static void reset_terminal(int currcons, int do_clear); static void con_flush_chars(struct tty_struct *tty); -static void set_vesa_blanking(unsigned long arg); +static void set_vesa_blanking(char __user *p); static void set_cursor(int currcons); static void hide_cursor(int currcons); static void console_callback(void *ignored); @@ -2274,6 +2274,7 @@ int tioclinux(struct tty_struct *tty, unsigned long arg) { char type, data; + char __user *p = (char __user *)arg; int lines; int ret; @@ -2281,14 +2282,14 @@ return -EINVAL; if (current->signal->tty != tty && !capable(CAP_SYS_ADMIN)) return -EPERM; - if (get_user(type, (char *)arg)) + if (get_user(type, p)) return -EFAULT; ret = 0; switch (type) { case TIOCL_SETSEL: acquire_console_sem(); - ret = set_selection((struct tiocl_selection *)((char *)arg+1), tty, 1); + ret = set_selection((struct tiocl_selection __user *)(p+1), tty); release_console_sem(); break; case TIOCL_PASTESEL: @@ -2298,7 +2299,7 @@ unblank_screen(); break; case TIOCL_SELLOADLUT: - ret = sel_loadlut(arg); + ret = sel_loadlut(p); break; case TIOCL_GETSHIFTSTATE: @@ -2309,20 +2310,20 @@ * related to the kernel should not use this. */ data = shift_state; - ret = __put_user(data, (char *) arg); + ret = __put_user(data, p); break; case TIOCL_GETMOUSEREPORTING: data = mouse_reporting(); - ret = __put_user(data, (char *) arg); + ret = __put_user(data, p); break; case TIOCL_SETVESABLANK: - set_vesa_blanking(arg); + set_vesa_blanking(p); break; case TIOCL_SETKMSGREDIRECT: if (!capable(CAP_SYS_ADMIN)) { ret = -EPERM; } else { - if (get_user(data, (char *)arg+1)) + if (get_user(data, p+1)) ret = -EFAULT; else kmsg_redirect = data; @@ -2332,7 +2333,7 @@ ret = fg_console; break; case TIOCL_SCROLLCONSOLE: - if (get_user(lines, (s32 *)((char *)arg+4))) { + if (get_user(lines, (s32 __user *)(p+4))) { ret = -EFAULT; } else { scrollfront(lines); @@ -2757,11 +2758,10 @@ * Screen blanking */ -static void set_vesa_blanking(unsigned long arg) +static void set_vesa_blanking(char __user *p) { - char *argp = (char *)arg + 1; unsigned int mode; - get_user(mode, argp); + get_user(mode, p + 1); vesa_blank_mode = (mode < 4) ? mode : 0; } @@ -2937,7 +2937,7 @@ sw->con_set_palette(vc_cons[currcons].d, color_table); } -static int set_get_cmap(unsigned char *arg, int set) +static int set_get_cmap(unsigned char __user *arg, int set) { int i, j, k; @@ -2972,7 +2972,7 @@ * map, 3 bytes per colour, 16 colours, range from 0 to 255. */ -int con_set_cmap(unsigned char *arg) +int con_set_cmap(unsigned char __user *arg) { int rc; @@ -2983,7 +2983,7 @@ return rc; } -int con_get_cmap(unsigned char *arg) +int con_get_cmap(unsigned char __user *arg) { int rc; @@ -3037,7 +3037,8 @@ goto quit; if (!op->height) { /* Need to guess font height [compat] */ int h, i; - u8 *charmap = op->data, tmp; + u8 __user *charmap = op->data; + u8 tmp; /* If from KDFONTOP ioctl, don't allow things which can be done in userland, so that we can get rid of this soon */ diff -urN linux-2.6.7-rc2/drivers/char/vt_ioctl.c linux-2.6.7-rc3/drivers/char/vt_ioctl.c --- linux-2.6.7-rc2/drivers/char/vt_ioctl.c 2004-06-07 12:54:48.945040003 -0700 +++ linux-2.6.7-rc3/drivers/char/vt_ioctl.c 2004-06-07 12:55:04.360678466 -0700 @@ -75,7 +75,7 @@ #define s (tmp.kb_table) #define v (tmp.kb_value) static inline int -do_kdsk_ioctl(int cmd, struct kbentry *user_kbe, int perm, struct kbd_struct *kbd) +do_kdsk_ioctl(int cmd, struct kbentry __user *user_kbe, int perm, struct kbd_struct *kbd) { struct kbentry tmp; ushort *key_map, val, ov; @@ -160,7 +160,7 @@ #undef v static inline int -do_kbkeycode_ioctl(int cmd, struct kbkeycode *user_kbkc, int perm) +do_kbkeycode_ioctl(int cmd, struct kbkeycode __user *user_kbkc, int perm) { struct kbkeycode tmp; int kc = 0; @@ -183,11 +183,12 @@ } static inline int -do_kdgkb_ioctl(int cmd, struct kbsentry *user_kdgkb, int perm) +do_kdgkb_ioctl(int cmd, struct kbsentry __user *user_kdgkb, int perm) { struct kbsentry *kbs; char *p; u_char *q; + u_char __user *up; int sz; int delta; char *first_free, *fj, *fnw; @@ -212,15 +213,15 @@ case KDGKBSENT: sz = sizeof(kbs->kb_string) - 1; /* sz should have been a struct member */ - q = user_kdgkb->kb_string; + up = user_kdgkb->kb_string; p = func_table[i]; if(p) for ( ; *p && sz; p++, sz--) - if (put_user(*p, q++)) { + if (put_user(*p, up++)) { ret = -EFAULT; goto reterr; } - if (put_user('\0', q)) { + if (put_user('\0', up)) { ret = -EFAULT; goto reterr; } @@ -292,7 +293,7 @@ } static inline int -do_fontx_ioctl(int cmd, struct consolefontdesc *user_cfd, int perm, struct console_font_op *op) +do_fontx_ioctl(int cmd, struct consolefontdesc __user *user_cfd, int perm, struct console_font_op *op) { struct consolefontdesc cfdarg; int i; @@ -332,7 +333,7 @@ } static inline int -do_unimap_ioctl(int cmd, struct unimapdesc *user_ud, int perm, unsigned int console) +do_unimap_ioctl(int cmd, struct unimapdesc __user *user_ud, int perm, unsigned int console) { struct unimapdesc tmp; int i = 0; @@ -370,6 +371,7 @@ struct kbd_struct * kbd; unsigned int console; unsigned char ucval; + void __user *up = (void __user *)arg; int i, perm; console = vt->vc_num; @@ -453,14 +455,12 @@ if (!capable(CAP_SYS_TTY_CONFIG)) return -EPERM; - if (copy_from_user(&kbrep, (void *)arg, - sizeof(struct kbd_repeat))) + if (copy_from_user(&kbrep, up, sizeof(struct kbd_repeat))) return -EFAULT; err = kbd_rate(&kbrep); if (err) return err; - if (copy_to_user((void *)arg, &kbrep, - sizeof(struct kbd_repeat))) + if (copy_to_user(up, &kbrep, sizeof(struct kbd_repeat))) return -EFAULT; return 0; } @@ -565,25 +565,25 @@ case KDGKBMETA: ucval = (vc_kbd_mode(kbd, VC_META) ? K_ESCPREFIX : K_METABIT); setint: - return put_user(ucval, (int *)arg); + return put_user(ucval, (int __user *)arg); case KDGETKEYCODE: case KDSETKEYCODE: if(!capable(CAP_SYS_TTY_CONFIG)) perm=0; - return do_kbkeycode_ioctl(cmd, (struct kbkeycode *)arg, perm); + return do_kbkeycode_ioctl(cmd, up, perm); case KDGKBENT: case KDSKBENT: - return do_kdsk_ioctl(cmd, (struct kbentry *)arg, perm, kbd); + return do_kdsk_ioctl(cmd, up, perm, kbd); case KDGKBSENT: case KDSKBSENT: - return do_kdgkb_ioctl(cmd, (struct kbsentry *)arg, perm); + return do_kdgkb_ioctl(cmd, up, perm); case KDGKBDIACR: { - struct kbdiacrs *a = (struct kbdiacrs *)arg; + struct kbdiacrs __user *a = up; if (put_user(accent_table_size, &a->kb_cnt)) return -EFAULT; @@ -594,7 +594,7 @@ case KDSKBDIACR: { - struct kbdiacrs *a = (struct kbdiacrs *)arg; + struct kbdiacrs __user *a = up; unsigned int ct; if (!perm) @@ -630,7 +630,7 @@ case KDGETLED: ucval = getledstate(); setchar: - return put_user(ucval, (char*)arg); + return put_user(ucval, (char __user *)arg); case KDSETLED: if (!perm) @@ -663,7 +663,7 @@ if (!perm) return -EPERM; - if (copy_from_user(&tmp, (void*)arg, sizeof(struct vt_mode))) + if (copy_from_user(&tmp, up, sizeof(struct vt_mode))) return -EFAULT; if (tmp.mode != VT_AUTO && tmp.mode != VT_PROCESS) return -EINVAL; @@ -687,7 +687,7 @@ memcpy(&tmp, &vt_cons[console]->vt_mode, sizeof(struct vt_mode)); release_console_sem(); - rc = copy_to_user((void*)arg, &tmp, sizeof(struct vt_mode)); + rc = copy_to_user(up, &tmp, sizeof(struct vt_mode)); return rc ? -EFAULT : 0; } @@ -698,7 +698,7 @@ */ case VT_GETSTATE: { - struct vt_stat *vtstat = (struct vt_stat *)arg; + struct vt_stat __user *vtstat = up; unsigned short state, mask; if (put_user(fg_console + 1, &vtstat->v_active)) @@ -844,7 +844,7 @@ case VT_RESIZE: { - struct vt_sizes *vtsizes = (struct vt_sizes *) arg; + struct vt_sizes __user *vtsizes = up; ushort ll,cc; if (!perm) return -EPERM; @@ -861,11 +861,11 @@ case VT_RESIZEX: { - struct vt_consize *vtconsize = (struct vt_consize *) arg; + struct vt_consize __user *vtconsize = up; ushort ll,cc,vlin,clin,vcol,ccol; if (!perm) return -EPERM; - if (verify_area(VERIFY_READ, (void *)vtconsize, + if (verify_area(VERIFY_READ, vtconsize, sizeof(struct vt_consize))) return -EFAULT; __get_user(ll, &vtconsize->v_rows); @@ -932,14 +932,14 @@ case PIO_CMAP: if (!perm) return -EPERM; - return con_set_cmap((char *)arg); + return con_set_cmap(up); case GIO_CMAP: - return con_get_cmap((char *)arg); + return con_get_cmap(up); case PIO_FONTX: case GIO_FONTX: - return do_fontx_ioctl(cmd, (struct consolefontdesc *)arg, perm, &op); + return do_fontx_ioctl(cmd, up, perm, &op); case PIO_FONTRESET: { @@ -963,13 +963,13 @@ } case KDFONTOP: { - if (copy_from_user(&op, (void *) arg, sizeof(op))) + if (copy_from_user(&op, up, sizeof(op))) return -EFAULT; if (!perm && op.op != KD_FONT_OP_GET) return -EPERM; i = con_font_op(console, &op); if (i) return i; - if (copy_to_user((void *) arg, &op, sizeof(op))) + if (copy_to_user(up, &op, sizeof(op))) return -EFAULT; return 0; } @@ -977,24 +977,24 @@ case PIO_SCRNMAP: if (!perm) return -EPERM; - return con_set_trans_old((unsigned char *)arg); + return con_set_trans_old(up); case GIO_SCRNMAP: - return con_get_trans_old((unsigned char *)arg); + return con_get_trans_old(up); case PIO_UNISCRNMAP: if (!perm) return -EPERM; - return con_set_trans_new((unsigned short *)arg); + return con_set_trans_new(up); case GIO_UNISCRNMAP: - return con_get_trans_new((unsigned short *)arg); + return con_get_trans_new(up); case PIO_UNIMAPCLR: { struct unimapinit ui; if (!perm) return -EPERM; - i = copy_from_user(&ui, (void *)arg, sizeof(struct unimapinit)); + i = copy_from_user(&ui, up, sizeof(struct unimapinit)); if (i) return -EFAULT; con_clear_unimap(console, &ui); return 0; @@ -1002,7 +1002,7 @@ case PIO_UNIMAP: case GIO_UNIMAP: - return do_unimap_ioctl(cmd, (struct unimapdesc *)arg, perm, console); + return do_unimap_ioctl(cmd, up, perm, console); case VT_LOCKSWITCH: if (!capable(CAP_SYS_TTY_CONFIG)) diff -urN linux-2.6.7-rc2/drivers/char/watchdog/pcwd.c linux-2.6.7-rc3/drivers/char/watchdog/pcwd.c --- linux-2.6.7-rc2/drivers/char/watchdog/pcwd.c 2004-05-09 19:32:00.000000000 -0700 +++ linux-2.6.7-rc3/drivers/char/watchdog/pcwd.c 2004-06-07 12:55:04.363678591 -0700 @@ -404,6 +404,7 @@ int status; int temperature; int new_heartbeat; + int __user *argp = (int __user *)arg; static struct watchdog_info ident = { .options = WDIOF_OVERHEAT | WDIOF_CARDRESET | @@ -419,27 +420,27 @@ return -ENOIOCTLCMD; case WDIOC_GETSUPPORT: - if(copy_to_user((void*)arg, &ident, sizeof(ident))) + if(copy_to_user(argp, &ident, sizeof(ident))) return -EFAULT; return 0; case WDIOC_GETSTATUS: pcwd_get_status(&status); - return put_user(status, (int *) arg); + return put_user(status, argp); case WDIOC_GETBOOTSTATUS: - return put_user(initial_status, (int *) arg); + return put_user(initial_status, argp); case WDIOC_GETTEMP: if (pcwd_get_temperature(&temperature)) return -EFAULT; - return put_user(temperature, (int *) arg); + return put_user(temperature, argp); case WDIOC_SETOPTIONS: if (revision == PCWD_REVISION_C) { - if(copy_from_user(&rv, (int*) arg, sizeof(int))) + if(copy_from_user(&rv, argp, sizeof(int))) return -EFAULT; if (rv & WDIOS_DISABLECARD) @@ -464,7 +465,7 @@ return 0; case WDIOC_SETTIMEOUT: - if (get_user(new_heartbeat, (int *) arg)) + if (get_user(new_heartbeat, argp)) return -EFAULT; if (pcwd_set_heartbeat(new_heartbeat)) @@ -474,13 +475,13 @@ /* Fall */ case WDIOC_GETTIMEOUT: - return put_user(heartbeat, (int *)arg); + return put_user(heartbeat, argp); } return 0; } -static ssize_t pcwd_write(struct file *file, const char *buf, size_t len, +static ssize_t pcwd_write(struct file *file, const char __user *buf, size_t len, loff_t *ppos) { /* Can't seek (pwrite) on this device */ @@ -541,7 +542,7 @@ * /dev/temperature handling */ -static ssize_t pcwd_temp_read(struct file *file, char *buf, size_t count, +static ssize_t pcwd_temp_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) { int temperature; diff -urN linux-2.6.7-rc2/drivers/char/watchdog/scx200_wdt.c linux-2.6.7-rc3/drivers/char/watchdog/scx200_wdt.c --- linux-2.6.7-rc2/drivers/char/watchdog/scx200_wdt.c 2004-06-07 12:54:48.949040169 -0700 +++ linux-2.6.7-rc3/drivers/char/watchdog/scx200_wdt.c 2004-06-07 12:55:04.365678673 -0700 @@ -221,10 +221,16 @@ printk(KERN_DEBUG NAME ": NatSemi SCx200 Watchdog Driver\n"); - /* First check that this really is a NatSemi SCx200 CPU */ + /* + * First check that this really is a NatSemi SCx200 CPU or a Geode + * SC1100 processor + */ if ((pci_find_device(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_SCx200_BRIDGE, - NULL)) == NULL) + NULL)) == NULL + && (pci_find_device(PCI_VENDOR_ID_NS, + PCI_DEVICE_ID_NS_SC1100_BRIDGE, + NULL)) == NULL) return -ENODEV; /* More sanity checks, verify that the configuration block is there */ diff -urN linux-2.6.7-rc2/drivers/char/watchdog/w83627hf_wdt.c linux-2.6.7-rc3/drivers/char/watchdog/w83627hf_wdt.c --- linux-2.6.7-rc2/drivers/char/watchdog/w83627hf_wdt.c 2004-06-07 12:54:48.950040211 -0700 +++ linux-2.6.7-rc3/drivers/char/watchdog/w83627hf_wdt.c 2004-06-07 12:55:04.366678715 -0700 @@ -72,7 +72,7 @@ #define WDT_EFDR (WDT_EFIR+1) /* Extended Function Data Register */ static void -wdt_ctrl(int timeout) +w83627hf_select_wd_register(void) { outb_p(0x87, WDT_EFER); /* Enter extended function mode */ outb_p(0x87, WDT_EFER); /* Again according to manual */ @@ -81,23 +81,64 @@ outb_p(0x08, WDT_EFDR); /* select logical device 8 (GPIO2) */ outb_p(0x30, WDT_EFER); /* select CR30 */ outb_p(0x01, WDT_EFDR); /* set bit 0 to activate GPIO2 */ +} + +static void +w83627hf_unselect_wd_register(void) +{ + outb_p(0xAA, WDT_EFER); /* Leave extended function mode */ +} + +/* tyan motherboards seem to set F5 to 0x4C ? + * So explicitly init to appropriate value. */ +static void +w83627hf_init(void) +{ + unsigned char t; + + w83627hf_select_wd_register(); + + outb_p(0xF5, WDT_EFER); /* Select CRF5 */ + t=inb_p(WDT_EFDR); /* read CRF5 */ + t&=~0x0C; /* set second mode & disable keyboard turning off watchdog */ + outb_p(t, WDT_EFDR); /* Write back to CRF5 */ + + w83627hf_unselect_wd_register(); +} + +static void +wdt_ctrl(int timeout) +{ + w83627hf_select_wd_register(); outb_p(0xF6, WDT_EFER); /* Select CRF6 */ outb_p(timeout, WDT_EFDR); /* Write Timeout counter to CRF6 */ - outb_p(0xAA, WDT_EFER); /* Leave extended function mode */ + w83627hf_unselect_wd_register(); } -static void +static int wdt_ping(void) { wdt_ctrl(timeout); + return 0; } -static void +static int wdt_disable(void) { wdt_ctrl(0); + return 0; +} + +static int +wdt_set_heartbeat(int t) +{ + if ((t < 1) || (t > 63)) + return -EINVAL; + + timeout = t; + return 0; } static ssize_t @@ -134,7 +175,7 @@ static struct watchdog_info ident = { .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE, .firmware_version = 1, - .identity = "Advantech WDT", + .identity = "W83627HF WDT", }; switch (cmd) { @@ -154,9 +195,8 @@ case WDIOC_SETTIMEOUT: if (get_user(new_timeout, (int *)arg)) return -EFAULT; - if ((new_timeout < 1) || (new_timeout > 63)) + if (wdt_set_heartbeat(new_timeout)) return -EINVAL; - timeout = new_timeout; wdt_ping(); /* Fall */ @@ -211,8 +251,8 @@ printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n"); wdt_ping(); } - clear_bit(0, &wdt_is_open); expect_close = 0; + clear_bit(0, &wdt_is_open); return 0; } @@ -266,10 +306,10 @@ printk(KERN_INFO "WDT driver for the Winbond(TM) W83627HF Super I/O chip initialising.\n"); - if (timeout < 1 || timeout > 63) { - timeout = WATCHDOG_TIMEOUT; - printk (KERN_INFO PFX "timeout value must be 1<=x<=63, using %d\n", - timeout); + if (wdt_set_heartbeat(timeout)) { + wdt_set_heartbeat(WATCHDOG_TIMEOUT); + printk (KERN_INFO PFX "timeout value must be 1<=timeout<=63, using %d\n", + WATCHDOG_TIMEOUT); } if (!request_region(wdt_io, 1, WATCHDOG_NAME)) { @@ -279,6 +319,8 @@ goto out; } + w83627hf_init(); + ret = register_reboot_notifier(&wdt_notifier); if (ret != 0) { printk (KERN_ERR PFX "cannot register reboot notifier (err=%d)\n", diff -urN linux-2.6.7-rc2/drivers/cpufreq/cpufreq_userspace.c linux-2.6.7-rc3/drivers/cpufreq/cpufreq_userspace.c --- linux-2.6.7-rc2/drivers/cpufreq/cpufreq_userspace.c 2004-06-07 12:54:48.952040293 -0700 +++ linux-2.6.7-rc3/drivers/cpufreq/cpufreq_userspace.c 2004-06-07 12:55:04.382679378 -0700 @@ -206,7 +206,7 @@ if (oldlen != sizeof(unsigned int)) return -EINVAL; - if (put_user(cpufreq_get(cpu), (unsigned int *)oldval) || + if (put_user(cpufreq_get(cpu), (unsigned int __user *)oldval) || put_user(sizeof(unsigned int), oldlenp)) return -EFAULT; } @@ -216,7 +216,7 @@ if (newlen != sizeof(unsigned int)) return -EINVAL; - if (get_user(freq, (unsigned int *)newval)) + if (get_user(freq, (unsigned int __user *)newval)) return -EFAULT; cpufreq_set(freq, cpu); diff -urN linux-2.6.7-rc2/drivers/cpufreq/proc_intf.c linux-2.6.7-rc3/drivers/cpufreq/proc_intf.c --- linux-2.6.7-rc2/drivers/cpufreq/proc_intf.c 2004-05-09 19:32:01.000000000 -0700 +++ linux-2.6.7-rc3/drivers/cpufreq/proc_intf.c 2004-06-07 12:55:04.383679419 -0700 @@ -164,7 +164,7 @@ */ static int cpufreq_proc_write ( struct file *file, - const char *buffer, + const char __user *buffer, unsigned long count, void *data) { diff -urN linux-2.6.7-rc2/drivers/fc4/fc.c linux-2.6.7-rc3/drivers/fc4/fc.c --- linux-2.6.7-rc2/drivers/fc4/fc.c 2004-05-09 19:32:38.000000000 -0700 +++ linux-2.6.7-rc3/drivers/fc4/fc.c 2004-06-07 12:55:04.384679460 -0700 @@ -59,8 +59,6 @@ #define dma_unmap_single(d,h,s,dir) sbus_unmap_single(d,h,s,dir) #define dma_map_sg(d,s,n,dir) sbus_map_sg(d,s,n,dir) #define dma_unmap_sg(d,s,n,dir) sbus_unmap_sg(d,s,n,dir) -#define scsi_to_fc_dma_dir(dir) scsi_to_sbus_dma_dir(dir) -#define FC_DMA_BIDIRECTIONAL SBUS_DMA_BIDIRECTIONAL #else #define dma_alloc_consistent(d,s,p) pci_alloc_consistent(d,s,p) #define dma_free_consistent(d,s,v,h) pci_free_consistent(d,s,v,h) @@ -68,8 +66,6 @@ #define dma_unmap_single(d,h,s,dir) pci_unmap_single(d,h,s,dir) #define dma_map_sg(d,s,n,dir) pci_map_sg(d,s,n,dir) #define dma_unmap_sg(d,s,n,dir) pci_unmap_sg(d,s,n,dir) -#define scsi_to_fc_dma_dir(dir) scsi_to_pci_dma_dir(dir) -#define FC_DMA_BIDIRECTIONAL PCI_DMA_BIDIRECTIONAL #endif #define FCP_CMND(SCpnt) ((fcp_cmnd *)&(SCpnt->SCp)) @@ -167,7 +163,7 @@ fcmd = l->fcmds + i; plogi = l->logi + 3 * i; dma_unmap_single (fc->dev, fcmd->cmd, 3 * sizeof(logi), - FC_DMA_BIDIRECTIONAL); + DMA_BIDIRECTIONAL); plogi->code = LS_PLOGI; memcpy (&plogi->nport_wwn, &fc->wwn_nport, sizeof(fc_wwn)); memcpy (&plogi->node_wwn, &fc->wwn_node, sizeof(fc_wwn)); @@ -188,7 +184,7 @@ } #endif fcmd->cmd = dma_map_single (fc->dev, plogi, 3 * sizeof(logi), - FC_DMA_BIDIRECTIONAL); + DMA_BIDIRECTIONAL); fcmd->rsp = fcmd->cmd + 2 * sizeof(logi); if (fc->hw_enque (fc, fcmd)) printk ("FC: Cannot enque PLOGI packet on %s\n", fc->name); @@ -212,7 +208,7 @@ case FC_STATUS_OK: plogi = l->logi + 3 * i; dma_unmap_single (fc->dev, l->fcmds[i].cmd, 3 * sizeof(logi), - FC_DMA_BIDIRECTIONAL); + DMA_BIDIRECTIONAL); if (!fc->wwn_dest.lo && !fc->wwn_dest.hi) { memcpy (&fc->wwn_dest, &plogi[1].node_wwn, sizeof(fc_wwn)); FCD(("Dest WWN %08x%08x\n", *(u32 *)&fc->wwn_dest, fc->wwn_dest.lo)) @@ -231,7 +227,7 @@ case FC_STATUS_ERR_OFFLINE: fc->state = FC_STATE_OFFLINE; dma_unmap_single (fc->dev, l->fcmds[i].cmd, 3 * sizeof(logi), - FC_DMA_BIDIRECTIONAL); + DMA_BIDIRECTIONAL); printk ("%s: FC is offline\n", fc->name); if (atomic_dec_and_test (&l->todo)) up(&l->sem); @@ -256,7 +252,7 @@ switch (status) { case FC_STATUS_OK: /* Ok, let's have a fun on a loop */ dma_unmap_single (fc->dev, l->fcmds[i].cmd, 3 * sizeof(logi), - FC_DMA_BIDIRECTIONAL); + DMA_BIDIRECTIONAL); p = (fc_al_posmap *)(l->logi + 3 * i); #ifdef FCDEBUG { @@ -306,7 +302,7 @@ FCD(("SID %d DID %d\n", fc->sid, fc->did)) fcmd = l->fcmds + i; dma_unmap_single(fc->dev, fcmd->cmd, 3 * sizeof(logi), - FC_DMA_BIDIRECTIONAL); + DMA_BIDIRECTIONAL); fch = &fcmd->fch; memset(l->logi + 3 * i, 0, 3 * sizeof(logi)); FILL_FCHDR_RCTL_DID(fch, R_CTL_ELS_REQ, FS_FABRIC_F_PORT); @@ -317,7 +313,7 @@ fch->param = 0; l->logi [3 * i].code = LS_FLOGI; fcmd->cmd = dma_map_single (fc->dev, l->logi + 3 * i, 3 * sizeof(logi), - FC_DMA_BIDIRECTIONAL); + DMA_BIDIRECTIONAL); fcmd->rsp = fcmd->cmd + sizeof(logi); fcmd->cmdlen = sizeof(logi); fcmd->rsplen = sizeof(logi); @@ -434,11 +430,12 @@ if (fcmd->data) { if (SCpnt->use_sg) - dma_unmap_sg(fc->dev, (struct scatterlist *)SCpnt->buffer, SCpnt->use_sg, - scsi_to_fc_dma_dir(SCpnt->sc_data_direction)); + dma_unmap_sg(fc->dev, (struct scatterlist *)SCpnt->buffer, + SCpnt->use_sg, + SCpnt->sc_data_direction); else dma_unmap_single(fc->dev, fcmd->data, SCpnt->request_bufflen, - scsi_to_fc_dma_dir(SCpnt->sc_data_direction)); + SCpnt->sc_data_direction); } break; default: @@ -579,7 +576,7 @@ fc->ls = (void *)l; /* Assumes sizeof(fc_al_posmap) < 3 * sizeof(logi), which is true */ fcmd->cmd = dma_map_single (fc->dev, l->logi + 3 * i, 3 * sizeof(logi), - FC_DMA_BIDIRECTIONAL); + DMA_BIDIRECTIONAL); fcmd->proto = PROTO_REPORT_AL_MAP; fcmd->token = i; fcmd->fc = fc; @@ -598,7 +595,7 @@ } else { fc->state = FC_STATE_OFFLINE; enable_irq(fc->irq); - dma_unmap_single (fc->dev, l->fcmds[i].cmd, 3 * sizeof(logi), FC_DMA_BIDIRECTIONAL); + dma_unmap_single (fc->dev, l->fcmds[i].cmd, 3 * sizeof(logi), DMA_BIDIRECTIONAL); if (atomic_dec_and_test (&l->todo)) goto all_done; } @@ -615,7 +612,7 @@ FCD(("SID %d DID %d\n", fc->sid, fc->did)) fcmd = l->fcmds + i; - dma_unmap_single(fc->dev, fcmd->cmd, 3 * sizeof(logi), FC_DMA_BIDIRECTIONAL); + dma_unmap_single(fc->dev, fcmd->cmd, 3 * sizeof(logi), DMA_BIDIRECTIONAL); fch = &fcmd->fch; FILL_FCHDR_RCTL_DID(fch, R_CTL_ELS_REQ, FS_FABRIC_F_PORT); FILL_FCHDR_SID(fch, 0); @@ -624,7 +621,7 @@ FILL_FCHDR_OXRX(fch, 0xffff, 0xffff); fch->param = 0; l->logi [3 * i].code = LS_FLOGI; - fcmd->cmd = dma_map_single (fc->dev, l->logi + 3 * i, 3 * sizeof(logi), FC_DMA_BIDIRECTIONAL); + fcmd->cmd = dma_map_single (fc->dev, l->logi + 3 * i, 3 * sizeof(logi), DMA_BIDIRECTIONAL); fcmd->rsp = fcmd->cmd + sizeof(logi); fcmd->cmdlen = sizeof(logi); fcmd->rsplen = sizeof(logi); @@ -652,7 +649,7 @@ switch (fc->state) { case FC_STATE_ONLINE: break; case FC_STATE_OFFLINE: break; - default: dma_unmap_single (fc->dev, l->fcmds[i].cmd, 3 * sizeof(logi), FC_DMA_BIDIRECTIONAL); + default: dma_unmap_single (fc->dev, l->fcmds[i].cmd, 3 * sizeof(logi), DMA_BIDIRECTIONAL); break; } } @@ -821,14 +818,14 @@ cmd->fcp_data_len = SCpnt->request_bufflen; fcmd->data = dma_map_single (fc->dev, (char *)SCpnt->request_buffer, SCpnt->request_bufflen, - scsi_to_fc_dma_dir(SCpnt->sc_data_direction)); + SCpnt->sc_data_direction); } else { struct scatterlist *sg = (struct scatterlist *)SCpnt->buffer; int nents; FCD(("XXX: Use_sg %d %d\n", SCpnt->use_sg, sg->length)) nents = dma_map_sg (fc->dev, sg, SCpnt->use_sg, - scsi_to_fc_dma_dir(SCpnt->sc_data_direction)); + SCpnt->sc_data_direction); if (nents > 1) printk ("%s: SG for nents %d (use_sg %d) not handled yet\n", fc->name, nents, SCpnt->use_sg); fcmd->data = sg_dma_address(sg); cmd->fcp_data_len = sg_dma_len(sg); @@ -1065,7 +1062,7 @@ FILL_FCHDR_SEQ_DF_SEQ(fch, 0, 0, 0); FILL_FCHDR_OXRX(fch, 0xffff, 0xffff); fch->param = 0; - fcmd->cmd = dma_map_single (fc->dev, data, 2 * len, FC_DMA_BIDIRECTIONAL); + fcmd->cmd = dma_map_single (fc->dev, data, 2 * len, DMA_BIDIRECTIONAL); fcmd->rsp = fcmd->cmd + len; fcmd->cmdlen = len; fcmd->rsplen = len; @@ -1100,7 +1097,7 @@ clear_bit(fcmd->token, fc->scsi_bitmap); fc->scsi_free++; - dma_unmap_single (fc->dev, fcmd->cmd, 2 * len, FC_DMA_BIDIRECTIONAL); + dma_unmap_single (fc->dev, fcmd->cmd, 2 * len, DMA_BIDIRECTIONAL); return l.status; } diff -urN linux-2.6.7-rc2/drivers/firmware/edd.c linux-2.6.7-rc3/drivers/firmware/edd.c --- linux-2.6.7-rc2/drivers/firmware/edd.c 2004-06-07 12:54:48.953040335 -0700 +++ linux-2.6.7-rc3/drivers/firmware/edd.c 2004-06-07 12:55:04.386679543 -0700 @@ -320,7 +320,7 @@ } static ssize_t -edd_show_legacy_cylinders(struct edd_device *edev, char *buf) +edd_show_legacy_max_cylinder(struct edd_device *edev, char *buf) { struct edd_info *info; char *p = buf; @@ -330,12 +330,12 @@ if (!info || !buf) return -EINVAL; - p += snprintf(p, left, "0x%x\n", info->legacy_cylinders); + p += snprintf(p, left, "%u\n", info->legacy_max_cylinder); return (p - buf); } static ssize_t -edd_show_legacy_heads(struct edd_device *edev, char *buf) +edd_show_legacy_max_head(struct edd_device *edev, char *buf) { struct edd_info *info; char *p = buf; @@ -345,12 +345,12 @@ if (!info || !buf) return -EINVAL; - p += snprintf(p, left, "0x%x\n", info->legacy_heads); + p += snprintf(p, left, "%u\n", info->legacy_max_head); return (p - buf); } static ssize_t -edd_show_legacy_sectors(struct edd_device *edev, char *buf) +edd_show_legacy_sectors_per_track(struct edd_device *edev, char *buf) { struct edd_info *info; char *p = buf; @@ -360,7 +360,7 @@ if (!info || !buf) return -EINVAL; - p += snprintf(p, left, "0x%x\n", info->legacy_sectors); + p += snprintf(p, left, "%u\n", info->legacy_sectors_per_track); return (p - buf); } @@ -375,7 +375,7 @@ if (!info || !buf) return -EINVAL; - p += scnprintf(p, left, "0x%x\n", info->params.num_default_cylinders); + p += scnprintf(p, left, "%u\n", info->params.num_default_cylinders); return (p - buf); } @@ -390,7 +390,7 @@ if (!info || !buf) return -EINVAL; - p += scnprintf(p, left, "0x%x\n", info->params.num_default_heads); + p += scnprintf(p, left, "%u\n", info->params.num_default_heads); return (p - buf); } @@ -405,7 +405,7 @@ if (!info || !buf) return -EINVAL; - p += scnprintf(p, left, "0x%x\n", info->params.sectors_per_track); + p += scnprintf(p, left, "%u\n", info->params.sectors_per_track); return (p - buf); } @@ -420,7 +420,7 @@ if (!info || !buf) return -EINVAL; - p += scnprintf(p, left, "0x%llx\n", info->params.number_of_sectors); + p += scnprintf(p, left, "%llu\n", info->params.number_of_sectors); return (p - buf); } @@ -436,7 +436,7 @@ */ static int -edd_has_legacy_cylinders(struct edd_device *edev) +edd_has_legacy_max_cylinder(struct edd_device *edev) { struct edd_info *info; if (!edev) @@ -444,11 +444,11 @@ info = edd_dev_get_info(edev); if (!info) return -EINVAL; - return info->legacy_cylinders > 0; + return info->legacy_max_cylinder > 0; } static int -edd_has_legacy_heads(struct edd_device *edev) +edd_has_legacy_max_head(struct edd_device *edev) { struct edd_info *info; if (!edev) @@ -456,11 +456,11 @@ info = edd_dev_get_info(edev); if (!info) return -EINVAL; - return info->legacy_heads > 0; + return info->legacy_max_head > 0; } static int -edd_has_legacy_sectors(struct edd_device *edev) +edd_has_legacy_sectors_per_track(struct edd_device *edev) { struct edd_info *info; if (!edev) @@ -468,7 +468,7 @@ info = edd_dev_get_info(edev); if (!info) return -EINVAL; - return info->legacy_sectors > 0; + return info->legacy_sectors_per_track > 0; } static int @@ -555,12 +555,14 @@ static EDD_DEVICE_ATTR(extensions, 0444, edd_show_extensions, NULL); static EDD_DEVICE_ATTR(info_flags, 0444, edd_show_info_flags, NULL); static EDD_DEVICE_ATTR(sectors, 0444, edd_show_sectors, NULL); -static EDD_DEVICE_ATTR(legacy_cylinders, 0444, edd_show_legacy_cylinders, - edd_has_legacy_cylinders); -static EDD_DEVICE_ATTR(legacy_heads, 0444, edd_show_legacy_heads, - edd_has_legacy_heads); -static EDD_DEVICE_ATTR(legacy_sectors, 0444, edd_show_legacy_sectors, - edd_has_legacy_sectors); +static EDD_DEVICE_ATTR(legacy_max_cylinder, 0444, + edd_show_legacy_max_cylinder, + edd_has_legacy_max_cylinder); +static EDD_DEVICE_ATTR(legacy_max_head, 0444, edd_show_legacy_max_head, + edd_has_legacy_max_head); +static EDD_DEVICE_ATTR(legacy_sectors_per_track, 0444, + edd_show_legacy_sectors_per_track, + edd_has_legacy_sectors_per_track); static EDD_DEVICE_ATTR(default_cylinders, 0444, edd_show_default_cylinders, edd_has_default_cylinders); static EDD_DEVICE_ATTR(default_heads, 0444, edd_show_default_heads, @@ -587,9 +589,9 @@ /* These attributes are conditional and only added for some devices. */ static struct edd_attribute * edd_attrs[] = { - &edd_attr_legacy_cylinders, - &edd_attr_legacy_heads, - &edd_attr_legacy_sectors, + &edd_attr_legacy_max_cylinder, + &edd_attr_legacy_max_head, + &edd_attr_legacy_sectors_per_track, &edd_attr_default_cylinders, &edd_attr_default_heads, &edd_attr_default_sectors_per_track, diff -urN linux-2.6.7-rc2/drivers/i2c/busses/scx200_acb.c linux-2.6.7-rc3/drivers/i2c/busses/scx200_acb.c --- linux-2.6.7-rc2/drivers/i2c/busses/scx200_acb.c 2004-06-07 12:54:48.968040956 -0700 +++ linux-2.6.7-rc3/drivers/i2c/busses/scx200_acb.c 2004-06-07 12:55:04.400680123 -0700 @@ -43,7 +43,7 @@ MODULE_LICENSE("GPL"); #define MAX_DEVICES 4 -static int base[MAX_DEVICES] = { 0x840 }; +static int base[MAX_DEVICES] = { 0x820, 0x840 }; MODULE_PARM(base, "1-4i"); MODULE_PARM_DESC(base, "Base addresses for the ACCESS.bus controllers"); @@ -510,7 +510,10 @@ /* Verify that this really is a SCx200 processor */ if (pci_find_device(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_SCx200_BRIDGE, - NULL) == NULL) + NULL) == NULL + && pci_find_device(PCI_VENDOR_ID_NS, + PCI_DEVICE_ID_NS_SC1100_BRIDGE, + NULL) == NULL) return -ENODEV; rc = -ENXIO; diff -urN linux-2.6.7-rc2/drivers/ide/Kconfig linux-2.6.7-rc3/drivers/ide/Kconfig --- linux-2.6.7-rc2/drivers/ide/Kconfig 2004-06-07 12:54:48.982041536 -0700 +++ linux-2.6.7-rc3/drivers/ide/Kconfig 2004-06-07 12:55:04.447682070 -0700 @@ -157,20 +157,6 @@ If in doubt, say N. -config IDEDISK_STROKE - bool "Auto-Geometry Resizing support" - depends on BLK_DEV_IDEDISK - help - Should you have a system w/ an AWARD Bios and your drives are larger - than 32GB and it will not boot, one is required to perform a few OEM - operations first. The option is called "STROKE" because it allows - one to "soft clip" the drive to work around a barrier limit. For - Maxtor drives it is called "jumpon.exe". Please search Maxtor's - web-site for "JUMPON.EXE". IBM has a similar tool at: - . - - If you are unsure, say N here. - config BLK_DEV_IDECS tristate "PCMCIA IDE support" depends on PCMCIA @@ -387,8 +373,8 @@ If in doubt, say N. config BLK_DEV_GENERIC - bool "Generic PCI IDE Chipset Support" - depends on PCI && BLK_DEV_IDEPCI + tristate "Generic PCI IDE Chipset Support" + depends on BLK_DEV_IDEPCI config BLK_DEV_OPTI621 tristate "OPTi 82C621 chipset enhanced support (EXPERIMENTAL)" @@ -438,48 +424,6 @@ if BLK_DEV_IDEDMA_PCI -# TCQ is disabled for now -config BLK_DEV_IDE_TCQ - bool "ATA tagged command queueing (EXPERIMENTAL)" - depends on EXPERIMENTAL && n - help - Support for tagged command queueing on ATA disk drives. This enables - the IDE layer to have multiple in-flight requests on hardware that - supports it. For now this includes the IBM Deskstar series drives, - such as the 22GXP, 75GXP, 40GV, 60GXP, and 120GXP (ie any Deskstar made - in the last couple of years), and at least some of the Western - Digital drives in the Expert series (by nature of really being IBM - drives). - - If you have such a drive, say Y here. - -config BLK_DEV_IDE_TCQ_DEFAULT - bool "TCQ on by default" - depends on BLK_DEV_IDE_TCQ - ---help--- - Enable tagged command queueing unconditionally on drives that report - support for it. Regardless of the chosen value here, tagging can be - controlled at run time: - - echo "using_tcq:32" > /proc/ide/hdX/settings - - where any value between 1-32 selects chosen queue depth and enables - TCQ, and 0 disables it. hdparm version 4.7 an above also support - TCQ manipulations. - - Generally say Y here. - -config BLK_DEV_IDE_TCQ_DEPTH - int "Default queue depth" - depends on BLK_DEV_IDE_TCQ - default "8" - help - Maximum size of commands to enable per-drive. Any value between 1 - and 32 is valid, with 32 being the maxium that the hardware supports. - - You probably just want the default of 32 here. If you enter an invalid - number, the default value will be used. - config BLK_DEV_IDEDMA_FORCED bool "Force enable legacy 2.0.X HOSTS to use DMA" help diff -urN linux-2.6.7-rc2/drivers/ide/ide-disk.c linux-2.6.7-rc3/drivers/ide/ide-disk.c --- linux-2.6.7-rc2/drivers/ide/ide-disk.c 2004-06-07 12:54:48.987041743 -0700 +++ linux-2.6.7-rc3/drivers/ide/ide-disk.c 2004-06-07 12:55:04.585687786 -0700 @@ -45,6 +45,8 @@ #undef REALLY_SLOW_IO /* most systems can safely undef this */ +//#define DEBUG + #include #include #include @@ -118,20 +120,6 @@ return 0; /* lba_capacity value may be bad */ } -static int idedisk_start_tag(ide_drive_t *drive, struct request *rq) -{ - unsigned long flags; - int ret = 1; - - spin_lock_irqsave(&ide_lock, flags); - - if (ata_pending_commands(drive) < drive->queue_depth) - ret = blk_queue_start_tag(drive->queue, rq); - - spin_unlock_irqrestore(&ide_lock, flags); - return ret; -} - #ifndef CONFIG_IDE_TASKFILE_IO /* @@ -365,18 +353,12 @@ if (drive->addressing == 1) { task_ioreg_t tasklets[10]; - if (blk_rq_tagged(rq)) { - tasklets[0] = nsectors.b.low; - tasklets[1] = nsectors.b.high; - tasklets[2] = rq->tag << 3; - tasklets[3] = 0; - } else { - tasklets[0] = 0; - tasklets[1] = 0; - tasklets[2] = nsectors.b.low; - tasklets[3] = nsectors.b.high; - } + pr_debug("%s: LBA=0x%012llx\n", drive->name, block); + tasklets[0] = 0; + tasklets[1] = 0; + tasklets[2] = nsectors.b.low; + tasklets[3] = nsectors.b.high; tasklets[4] = (task_ioreg_t) block; tasklets[5] = (task_ioreg_t) (block>>8); tasklets[6] = (task_ioreg_t) (block>>16); @@ -389,14 +371,6 @@ tasklets[9] = (task_ioreg_t)((u64)block >> 40); } #ifdef DEBUG - printk("%s: %sing: LBAsect=%lu, sectors=%ld, " - "buffer=0x%08lx, LBAsect=0x%012lx\n", - drive->name, - rq_data_dir(rq)==READ?"read":"writ", - block, - rq->nr_sectors, - (unsigned long) rq->buffer, - block); printk("%s: 0x%02x%02x 0x%02x%02x%02x%02x%02x%02x\n", drive->name, tasklets[3], tasklets[2], tasklets[9], tasklets[8], tasklets[7], @@ -415,22 +389,8 @@ hwif->OUTB(tasklets[6], IDE_HCYL_REG); hwif->OUTB(0x00|drive->select.all,IDE_SELECT_REG); } else { -#ifdef DEBUG - printk("%s: %sing: LBAsect=%llu, sectors=%ld, " - "buffer=0x%08lx\n", - drive->name, - rq_data_dir(rq)==READ?"read":"writ", - (unsigned long long)block, rq->nr_sectors, - (unsigned long) rq->buffer); -#endif - if (blk_rq_tagged(rq)) { - hwif->OUTB(nsectors.b.low, IDE_FEATURE_REG); - hwif->OUTB(rq->tag << 3, IDE_NSECTOR_REG); - } else { - hwif->OUTB(0x00, IDE_FEATURE_REG); - hwif->OUTB(nsectors.b.low, IDE_NSECTOR_REG); - } - + hwif->OUTB(0x00, IDE_FEATURE_REG); + hwif->OUTB(nsectors.b.low, IDE_NSECTOR_REG); hwif->OUTB(block, IDE_SECTOR_REG); hwif->OUTB(block>>=8, IDE_LCYL_REG); hwif->OUTB(block>>=8, IDE_HCYL_REG); @@ -444,29 +404,16 @@ head = track % drive->head; cyl = track / drive->head; - if (blk_rq_tagged(rq)) { - hwif->OUTB(nsectors.b.low, IDE_FEATURE_REG); - hwif->OUTB(rq->tag << 3, IDE_NSECTOR_REG); - } else { - hwif->OUTB(0x00, IDE_FEATURE_REG); - hwif->OUTB(nsectors.b.low, IDE_NSECTOR_REG); - } + pr_debug("%s: CHS=%u/%u/%u\n", drive->name, cyl, head, sect); + hwif->OUTB(0x00, IDE_FEATURE_REG); + hwif->OUTB(nsectors.b.low, IDE_NSECTOR_REG); hwif->OUTB(cyl, IDE_LCYL_REG); hwif->OUTB(cyl>>8, IDE_HCYL_REG); hwif->OUTB(head|drive->select.all,IDE_SELECT_REG); -#ifdef DEBUG - printk("%s: %sing: CHS=%d/%d/%d, sectors=%ld, buffer=0x%08lx\n", - drive->name, rq_data_dir(rq)==READ?"read":"writ", cyl, - head, sect, rq->nr_sectors, (unsigned long) rq->buffer); -#endif } if (rq_data_dir(rq) == READ) { -#ifdef CONFIG_BLK_DEV_IDE_TCQ - if (blk_rq_tagged(rq)) - return __ide_dma_queued_read(drive); -#endif if (drive->using_dma && !hwif->ide_dma_read(drive)) return ide_started; @@ -477,10 +424,7 @@ return ide_started; } else { ide_startstop_t startstop; -#ifdef CONFIG_BLK_DEV_IDE_TCQ - if (blk_rq_tagged(rq)) - return __ide_dma_queued_write(drive); -#endif + if (drive->using_dma && !(HWIF(drive)->ide_dma_write(drive))) return ide_started; @@ -550,8 +494,6 @@ if (cmd == READ) { task->command_type = IDE_DRIVE_TASK_IN; - if (drive->using_tcq) - return lba48 ? WIN_READDMA_QUEUED_EXT : WIN_READDMA_QUEUED; if (drive->using_dma) return lba48 ? WIN_READDMA_EXT : WIN_READDMA; if (drive->mult_count) { @@ -562,8 +504,6 @@ return lba48 ? WIN_READ_EXT : WIN_READ; } else { task->command_type = IDE_DRIVE_TASK_RAW_WRITE; - if (drive->using_tcq) - return lba48 ? WIN_WRITEDMA_QUEUED_EXT : WIN_WRITEDMA_QUEUED; if (drive->using_dma) return lba48 ? WIN_WRITEDMA_EXT : WIN_WRITEDMA; if (drive->mult_count) { @@ -589,23 +529,13 @@ nsectors.all = (u16) rq->nr_sectors; -#ifdef DEBUG - printk("%s: %sing: ", drive->name, (rq_data_dir(rq)==READ) ? "read" : "writ"); - printk("CHS=%d/%d/%d, ", cyl, head, sect); - printk("sectors=%ld, ", rq->nr_sectors); - printk("buffer=0x%08lx\n", (unsigned long) rq->buffer); -#endif + pr_debug("%s: CHS=%u/%u/%u\n", drive->name, cyl, head, sect); memset(&args, 0, sizeof(ide_task_t)); sectors = (rq->nr_sectors == 256) ? 0x00 : rq->nr_sectors; - if (blk_rq_tagged(rq)) { - args.tfRegister[IDE_FEATURE_OFFSET] = sectors; - args.tfRegister[IDE_NSECTOR_OFFSET] = rq->tag << 3; - } else - args.tfRegister[IDE_NSECTOR_OFFSET] = sectors; - + args.tfRegister[IDE_NSECTOR_OFFSET] = sectors; args.tfRegister[IDE_SECTOR_OFFSET] = sect; args.tfRegister[IDE_LCYL_OFFSET] = cyl; args.tfRegister[IDE_HCYL_OFFSET] = (cyl>>8); @@ -625,23 +555,11 @@ nsectors.all = (u16) rq->nr_sectors; -#ifdef DEBUG - printk("%s: %sing: ", drive->name, (rq_data_dir(rq)==READ) ? "read" : "writ"); - printk("LBAsect=%lld, ", block); - printk("sectors=%ld, ", rq->nr_sectors); - printk("buffer=0x%08lx\n", (unsigned long) rq->buffer); -#endif - memset(&args, 0, sizeof(ide_task_t)); sectors = (rq->nr_sectors == 256) ? 0x00 : rq->nr_sectors; - if (blk_rq_tagged(rq)) { - args.tfRegister[IDE_FEATURE_OFFSET] = sectors; - args.tfRegister[IDE_NSECTOR_OFFSET] = rq->tag << 3; - } else - args.tfRegister[IDE_NSECTOR_OFFSET] = sectors; - + args.tfRegister[IDE_NSECTOR_OFFSET] = sectors; args.tfRegister[IDE_SECTOR_OFFSET] = block; args.tfRegister[IDE_LCYL_OFFSET] = (block>>=8); args.tfRegister[IDE_HCYL_OFFSET] = (block>>=8); @@ -667,27 +585,12 @@ nsectors.all = (u16) rq->nr_sectors; -#ifdef DEBUG - printk("%s: %sing: ", drive->name, (rq_data_dir(rq)==READ) ? "read" : "writ"); - printk("LBAsect=%lld, ", block); - printk("sectors=%ld, ", rq->nr_sectors); - printk("buffer=0x%08lx\n", (unsigned long) rq->buffer); -#endif - memset(&args, 0, sizeof(ide_task_t)); sectors = (rq->nr_sectors == 65536) ? 0 : rq->nr_sectors; - if (blk_rq_tagged(rq)) { - args.tfRegister[IDE_FEATURE_OFFSET] = sectors; - args.tfRegister[IDE_NSECTOR_OFFSET] = rq->tag << 3; - args.hobRegister[IDE_FEATURE_OFFSET] = sectors >> 8; - args.hobRegister[IDE_NSECTOR_OFFSET] = 0; - } else { - args.tfRegister[IDE_NSECTOR_OFFSET] = sectors; - args.hobRegister[IDE_NSECTOR_OFFSET] = sectors >> 8; - } - + args.tfRegister[IDE_NSECTOR_OFFSET] = sectors; + args.hobRegister[IDE_NSECTOR_OFFSET] = sectors >> 8; args.tfRegister[IDE_SECTOR_OFFSET] = block; /* low lba */ args.tfRegister[IDE_LCYL_OFFSET] = (block>>=8); /* mid lba */ args.tfRegister[IDE_HCYL_OFFSET] = (block>>=8); /* hi lba */ @@ -717,12 +620,9 @@ return ide_stopped; } - if (drive->using_tcq && idedisk_start_tag(drive, rq)) { - if (!ata_pending_commands(drive)) - BUG(); - - return ide_started; - } + pr_debug("%s: %sing: block=%llu, sectors=%lu, buffer=0x%08lx\n", + drive->name, rq_data_dir(rq) == READ ? "read" : "writ", + block, rq->nr_sectors, (unsigned long)rq->buffer); if (hwif->rw_disk) return hwif->rw_disk(drive, rq, block); @@ -811,7 +711,6 @@ ide_hwif_t *hwif; struct request *rq; u8 err; - int i = (drive->mult_count ? drive->mult_count : 1) * SECTOR_WORDS; err = idedisk_dump_status(drive, msg, stat); @@ -851,22 +750,8 @@ rq->errors |= ERROR_RECAL; } } - if ((stat & DRQ_STAT) && rq_data_dir(rq) == READ) { - /* - * try_to_flush_leftover_data() is invoked in response to - * a drive unexpectedly having its DRQ_STAT bit set. As - * an alternative to resetting the drive, this routine - * tries to clear the condition by read a sector's worth - * of data from the drive. Of course, this may not help - * if the drive is *waiting* for data from *us*. - */ - while (i > 0) { - u32 buffer[16]; - unsigned int wcount = (i > 16) ? 16 : i; - i -= wcount; - taskfile_input_data(drive, buffer, wcount); - } - } + if ((stat & DRQ_STAT) && rq_data_dir(rq) == READ) + try_to_flush_leftover_data(drive); if (hwif->INB(IDE_STATUS_REG) & (BUSY_STAT|DRQ_STAT)) { /* force an abort */ hwif->OUTB(WIN_IDLEIMMEDIATE,IDE_COMMAND_REG); @@ -963,7 +848,6 @@ return addr; } -#ifdef CONFIG_IDEDISK_STROKE /* * Sets maximum virtual LBA address of the drive. * Returns new maximum virtual LBA address (> 0) or 0 on failure. @@ -1032,8 +916,6 @@ return addr_set; } -#endif /* CONFIG_IDEDISK_STROKE */ - static unsigned long long sectors_to_MB(unsigned long long n) { n <<= 9; /* make it bytes */ @@ -1080,7 +962,10 @@ drive->name, capacity, sectors_to_MB(capacity), set_max, sectors_to_MB(set_max)); -#ifdef CONFIG_IDEDISK_STROKE + + if (!drive->stroke) + return; + if (lba48) set_max = idedisk_set_max_address_ext(drive, set_max); else @@ -1090,7 +975,6 @@ printk(KERN_INFO "%s: Host Protected Area disabled.\n", drive->name); } -#endif } /* @@ -1403,34 +1287,6 @@ return 0; } -#ifdef CONFIG_BLK_DEV_IDE_TCQ -static int set_using_tcq(ide_drive_t *drive, int arg) -{ - int ret; - - if (!drive->driver) - return -EPERM; - if (arg == drive->queue_depth && drive->using_tcq) - return 0; - - /* - * set depth, but check also id for max supported depth - */ - drive->queue_depth = arg ? arg : 1; - if (drive->id) { - if (drive->queue_depth > drive->id->queue_depth + 1) - drive->queue_depth = drive->id->queue_depth + 1; - } - - if (arg) - ret = __ide_dma_queued_on(drive); - else - ret = __ide_dma_queued_off(drive); - - return ret ? -EIO : 0; -} -#endif - /* * drive->addressing: * 0: 28-bit @@ -1466,9 +1322,6 @@ ide_add_setting(drive, "acoustic", SETTING_RW, HDIO_GET_ACOUSTIC, HDIO_SET_ACOUSTIC, TYPE_BYTE, 0, 254, 1, 1, &drive->acoustic, set_acoustic); ide_add_setting(drive, "failures", SETTING_RW, -1, -1, TYPE_INT, 0, 65535, 1, 1, &drive->failures, NULL); ide_add_setting(drive, "max_failures", SETTING_RW, -1, -1, TYPE_INT, 0, 65535, 1, 1, &drive->max_failures, NULL); -#ifdef CONFIG_BLK_DEV_IDE_TCQ - ide_add_setting(drive, "using_tcq", SETTING_RW, HDIO_GET_QDMA, HDIO_SET_QDMA, TYPE_BYTE, 0, IDE_MAX_TAG, 1, 1, &drive->using_tcq, set_using_tcq); -#endif } /* @@ -1679,11 +1532,6 @@ drive->wcache = 1; write_cache(drive, 1); - -#ifdef CONFIG_BLK_DEV_IDE_TCQ_DEFAULT - if (drive->using_dma) - __ide_dma_queued_on(drive); -#endif } static void ide_cacheflush_p(ide_drive_t *drive) @@ -1713,7 +1561,22 @@ { ide_drive_t *drive = container_of(dev, ide_drive_t, gendev); +#ifdef CONFIG_ALPHA + /* On Alpha, halt(8) doesn't actually turn the machine off, + it puts you into the sort of firmware monitor. Typically, + it's used to boot another kernel image, so it's not much + different from reboot(8). Therefore, we don't need to + spin down the disk in this case, especially since Alpha + firmware doesn't handle disks in standby mode properly. + On the other hand, it's reasonably safe to turn the power + off when the shutdown process reaches the firmware prompt, + as the firmware initialization takes rather long time - + at least 10 seconds, which should be sufficient for + the disk to expire its write cache. */ + if (system_state != SYSTEM_POWER_OFF) { +#else if (system_state == SYSTEM_RESTART) { +#endif ide_cacheflush_p(drive); return; } diff -urN linux-2.6.7-rc2/drivers/ide/ide-dma.c linux-2.6.7-rc3/drivers/ide/ide-dma.c --- linux-2.6.7-rc2/drivers/ide/ide-dma.c 2004-05-09 19:32:37.000000000 -0700 +++ linux-2.6.7-rc3/drivers/ide/ide-dma.c 2004-06-07 12:55:04.598688324 -0700 @@ -513,9 +513,7 @@ if (HWIF(drive)->ide_dma_host_off(drive)) return 1; -#ifdef CONFIG_BLK_DEV_IDE_TCQ - __ide_dma_queued_off(drive); -#endif + return 0; } diff -urN linux-2.6.7-rc2/drivers/ide/ide-floppy.c linux-2.6.7-rc3/drivers/ide/ide-floppy.c --- linux-2.6.7-rc2/drivers/ide/ide-floppy.c 2004-05-09 19:32:37.000000000 -0700 +++ linux-2.6.7-rc3/drivers/ide/ide-floppy.c 2004-06-07 12:55:04.600688407 -0700 @@ -1482,7 +1482,7 @@ ** */ -static int idefloppy_get_format_capacities(ide_drive_t *drive, int *arg) +static int idefloppy_get_format_capacities(ide_drive_t *drive, int __user *arg) { idefloppy_pc_t pc; idefloppy_capacity_header_t *header; @@ -1490,7 +1490,7 @@ int i, descriptors, blocks, length; int u_array_size; int u_index; - int *argp; + int __user *argp; if (get_user(u_array_size, arg)) return (-EFAULT); @@ -1558,7 +1558,7 @@ ** 0x01 - verify media after format. */ -static int idefloppy_begin_format(ide_drive_t *drive, int *arg) +static int idefloppy_begin_format(ide_drive_t *drive, int __user *arg) { int blocks; int length; @@ -1591,7 +1591,7 @@ ** the dsc bit, and return either 0 or 65536. */ -static int idefloppy_get_format_progress(ide_drive_t *drive, int *arg) +static int idefloppy_get_format_progress(ide_drive_t *drive, int __user *arg) { idefloppy_floppy_t *floppy = drive->driver_data; idefloppy_pc_t pc; @@ -1945,6 +1945,7 @@ struct block_device *bdev = inode->i_bdev; ide_drive_t *drive = bdev->bd_disk->private_data; idefloppy_floppy_t *floppy = drive->driver_data; + void __user *argp = (void __user *)arg; int err = generic_ide_ioctl(bdev, cmd, arg); int prevent = (arg) ? 1 : 0; idefloppy_pc_t pc; @@ -1972,7 +1973,7 @@ case IDEFLOPPY_IOCTL_FORMAT_SUPPORTED: return 0; case IDEFLOPPY_IOCTL_FORMAT_GET_CAPACITY: - return idefloppy_get_format_capacities(drive, (int *)arg); + return idefloppy_get_format_capacities(drive, argp); case IDEFLOPPY_IOCTL_FORMAT_START: if (!(file->f_mode & 2)) @@ -1988,7 +1989,7 @@ set_bit(IDEFLOPPY_FORMAT_IN_PROGRESS, &floppy->flags); - err = idefloppy_begin_format(drive, (int *)arg); + err = idefloppy_begin_format(drive, argp); if (err) clear_bit(IDEFLOPPY_FORMAT_IN_PROGRESS, &floppy->flags); return err; @@ -1999,7 +2000,7 @@ ** format progress reporting. */ case IDEFLOPPY_IOCTL_FORMAT_GET_PROGRESS: - return idefloppy_get_format_progress(drive, (int *)arg); + return idefloppy_get_format_progress(drive, argp); } return -EINVAL; } diff -urN linux-2.6.7-rc2/drivers/ide/ide-io.c linux-2.6.7-rc3/drivers/ide/ide-io.c --- linux-2.6.7-rc2/drivers/ide/ide-io.c 2004-06-07 12:54:48.987041743 -0700 +++ linux-2.6.7-rc3/drivers/ide/ide-io.c 2004-06-07 12:55:04.626689484 -0700 @@ -97,10 +97,7 @@ if (!end_that_request_first(rq, uptodate, nr_sectors)) { add_disk_randomness(rq->rq_disk); - if (!blk_rq_tagged(rq)) - blkdev_dequeue_request(rq); - else - blk_queue_end_tag(drive->queue, rq); + blkdev_dequeue_request(rq); HWGROUP(drive)->rq = NULL; end_that_request_last(rq); ret = 0; @@ -855,18 +852,7 @@ drive->sleep = 0; drive->service_start = jiffies; -queue_next: - if (!ata_can_queue(drive)) { - if (!ata_pending_commands(drive)) - hwgroup->busy = 0; - - break; - } - if (blk_queue_plugged(drive->queue)) { - if (drive->using_tcq) - break; - printk(KERN_ERR "ide: huh? queue was plugged!\n"); break; } @@ -877,7 +863,7 @@ */ rq = elv_next_request(drive->queue); if (!rq) { - hwgroup->busy = !!ata_pending_commands(drive); + hwgroup->busy = 0; break; } @@ -900,9 +886,6 @@ break; } - if (!rq->bio && ata_pending_commands(drive)) - break; - hwgroup->rq = rq; /* @@ -922,8 +905,6 @@ spin_lock_irq(&ide_lock); if (hwif->irq != masked_irq) enable_irq(hwif->irq); - if (startstop == ide_released) - goto queue_next; if (startstop == ide_stopped) hwgroup->busy = 0; } diff -urN linux-2.6.7-rc2/drivers/ide/ide-probe.c linux-2.6.7-rc3/drivers/ide/ide-probe.c --- linux-2.6.7-rc2/drivers/ide/ide-probe.c 2004-06-07 12:54:48.989041826 -0700 +++ linux-2.6.7-rc3/drivers/ide/ide-probe.c 2004-06-07 12:55:04.651690519 -0700 @@ -241,17 +241,6 @@ drive->media = ide_disk; printk("%s DISK drive\n", (drive->is_flash) ? "CFA" : "ATA" ); QUIRK_LIST(drive); - - /* Initialize queue depth settings */ - drive->queue_depth = 1; -#ifdef CONFIG_BLK_DEV_IDE_TCQ_DEPTH - drive->queue_depth = CONFIG_BLK_DEV_IDE_TCQ_DEPTH; -#else - drive->queue_depth = drive->id->queue_depth + 1; -#endif - if (drive->queue_depth < 1 || drive->queue_depth > IDE_MAX_TAG) - drive->queue_depth = IDE_MAX_TAG; - return; err_misc: @@ -646,8 +635,6 @@ device_register(&hwif->gendev); } -//EXPORT_SYMBOL(hwif_register); - #ifdef CONFIG_PPC static int wait_hwif_ready(ide_hwif_t *hwif) { @@ -690,7 +677,7 @@ * This routine only knows how to look for drive units 0 and 1 * on an interface, so any setting of MAX_DRIVES > 2 won't work here. */ -void probe_hwif (ide_hwif_t *hwif) +static void probe_hwif(ide_hwif_t *hwif) { unsigned int unit; unsigned long flags; @@ -800,18 +787,12 @@ for (unit = 0; unit < MAX_DRIVES; ++unit) { ide_drive_t *drive = &hwif->drives[unit]; - int enable_dma = 1; if (drive->present) { if (hwif->tuneproc != NULL && drive->autotune == IDE_TUNE_AUTO) /* auto-tune PIO mode */ hwif->tuneproc(drive, 255); - -#ifdef CONFIG_IDEDMA_ONLYDISK - if (drive->media != ide_disk) - enable_dma = 0; -#endif /* * MAJOR HACK BARF :-/ * @@ -831,16 +812,16 @@ * PARANOIA!!! */ hwif->ide_dma_off_quietly(drive); - if (enable_dma) +#ifdef CONFIG_IDEDMA_ONLYDISK + if (drive->media == ide_disk) +#endif hwif->ide_dma_check(drive); } } } } -EXPORT_SYMBOL(probe_hwif); - -int hwif_init (ide_hwif_t *hwif); +static int hwif_init(ide_hwif_t *hwif); int probe_hwif_init (ide_hwif_t *hwif) { probe_hwif(hwif); @@ -875,7 +856,7 @@ * * This routine detects and reports such situations, but does not fix them. */ -void save_match (ide_hwif_t *hwif, ide_hwif_t *new, ide_hwif_t **match) +static void save_match(ide_hwif_t *hwif, ide_hwif_t *new, ide_hwif_t **match) { ide_hwif_t *m = *match; @@ -888,7 +869,6 @@ if (!m || m->irq != hwif->irq) /* don't undo a prior perfect match */ *match = new; } -EXPORT_SYMBOL(save_match); #endif /* MAX_HWIFS > 1 */ /* @@ -1235,9 +1215,7 @@ THIS_MODULE, ata_probe, ata_lock, hwif); } -EXPORT_SYMBOL(init_gendisk); - -int hwif_init (ide_hwif_t *hwif) +static int hwif_init(ide_hwif_t *hwif) { int old_irq, unit; @@ -1305,8 +1283,6 @@ return 0; } -EXPORT_SYMBOL(hwif_init); - int ideprobe_init (void) { unsigned int index; diff -urN linux-2.6.7-rc2/drivers/ide/ide-proc.c linux-2.6.7-rc3/drivers/ide/ide-proc.c --- linux-2.6.7-rc2/drivers/ide/ide-proc.c 2004-06-07 12:54:48.991041909 -0700 +++ linux-2.6.7-rc3/drivers/ide/ide-proc.c 2004-06-07 12:55:04.653690602 -0700 @@ -280,7 +280,7 @@ goto out1; } -int proc_ide_read_config +static int proc_ide_read_config (char *page, char **start, off_t off, int count, int *eof, void *data) { char *out = page; @@ -317,8 +317,6 @@ PROC_IDE_READ_RETURN(page,start,off,count,eof,len); } -EXPORT_SYMBOL(proc_ide_read_config); - static int proc_ide_read_imodel (char *page, char **start, off_t off, int count, int *eof, void *data) { @@ -352,9 +350,7 @@ PROC_IDE_READ_RETURN(page,start,off,count,eof,len); } -EXPORT_SYMBOL(proc_ide_read_imodel); - -int proc_ide_read_mate +static int proc_ide_read_mate (char *page, char **start, off_t off, int count, int *eof, void *data) { ide_hwif_t *hwif = (ide_hwif_t *) data; @@ -367,9 +363,7 @@ PROC_IDE_READ_RETURN(page,start,off,count,eof,len); } -EXPORT_SYMBOL(proc_ide_read_mate); - -int proc_ide_read_channel +static int proc_ide_read_channel (char *page, char **start, off_t off, int count, int *eof, void *data) { ide_hwif_t *hwif = (ide_hwif_t *) data; @@ -381,9 +375,7 @@ PROC_IDE_READ_RETURN(page,start,off,count,eof,len); } -EXPORT_SYMBOL(proc_ide_read_channel); - -int proc_ide_read_identify +static int proc_ide_read_identify (char *page, char **start, off_t off, int count, int *eof, void *data) { ide_drive_t *drive = (ide_drive_t *)data; @@ -425,9 +417,7 @@ PROC_IDE_READ_RETURN(page,start,off,count,eof,len); } -EXPORT_SYMBOL(proc_ide_read_identify); - -int proc_ide_read_settings +static int proc_ide_read_settings (char *page, char **start, off_t off, int count, int *eof, void *data) { ide_drive_t *drive = (ide_drive_t *) data; @@ -459,12 +449,10 @@ PROC_IDE_READ_RETURN(page,start,off,count,eof,len); } -EXPORT_SYMBOL(proc_ide_read_settings); - #define MAX_LEN 30 -int proc_ide_write_settings(struct file *file, const char __user *buffer, - unsigned long count, void *data) +static int proc_ide_write_settings(struct file *file, const char __user *buffer, + unsigned long count, void *data) { ide_drive_t *drive = (ide_drive_t *) data; char name[MAX_LEN + 1]; @@ -555,8 +543,6 @@ return -EINVAL; } -EXPORT_SYMBOL(proc_ide_write_settings); - int proc_ide_read_capacity (char *page, char **start, off_t off, int count, int *eof, void *data) { @@ -568,8 +554,6 @@ PROC_IDE_READ_RETURN(page,start,off,count,eof,len); } -EXPORT_SYMBOL(proc_ide_read_capacity); - int proc_ide_read_geometry (char *page, char **start, off_t off, int count, int *eof, void *data) { @@ -588,7 +572,7 @@ EXPORT_SYMBOL(proc_ide_read_geometry); -int proc_ide_read_dmodel +static int proc_ide_read_dmodel (char *page, char **start, off_t off, int count, int *eof, void *data) { ide_drive_t *drive = (ide_drive_t *) data; @@ -600,9 +584,7 @@ PROC_IDE_READ_RETURN(page,start,off,count,eof,len); } -EXPORT_SYMBOL(proc_ide_read_dmodel); - -int proc_ide_read_driver +static int proc_ide_read_driver (char *page, char **start, off_t off, int count, int *eof, void *data) { ide_drive_t *drive = (ide_drive_t *) data; @@ -614,9 +596,7 @@ PROC_IDE_READ_RETURN(page,start,off,count,eof,len); } -EXPORT_SYMBOL(proc_ide_read_driver); - -int proc_ide_write_driver +static int proc_ide_write_driver (struct file *file, const char __user *buffer, unsigned long count, void *data) { ide_drive_t *drive = (ide_drive_t *) data; @@ -634,9 +614,7 @@ return count; } -EXPORT_SYMBOL(proc_ide_write_driver); - -int proc_ide_read_media +static int proc_ide_read_media (char *page, char **start, off_t off, int count, int *eof, void *data) { ide_drive_t *drive = (ide_drive_t *) data; @@ -660,8 +638,6 @@ PROC_IDE_READ_RETURN(page,start,off,count,eof,len); } -EXPORT_SYMBOL(proc_ide_read_media); - static ide_proc_entry_t generic_drive_entries[] = { { "driver", S_IFREG|S_IRUGO, proc_ide_read_driver, proc_ide_write_driver }, { "identify", S_IFREG|S_IRUSR, proc_ide_read_identify, NULL }, @@ -688,8 +664,6 @@ } } -EXPORT_SYMBOL(ide_add_proc_entries); - void ide_remove_proc_entries(struct proc_dir_entry *dir, ide_proc_entry_t *p) { if (!dir || !p) @@ -700,9 +674,7 @@ } } -EXPORT_SYMBOL(ide_remove_proc_entries); - -void create_proc_ide_drives(ide_hwif_t *hwif) +static void create_proc_ide_drives(ide_hwif_t *hwif) { int d; struct proc_dir_entry *ent; @@ -726,9 +698,7 @@ } } -EXPORT_SYMBOL(create_proc_ide_drives); - -void destroy_proc_ide_device(ide_hwif_t *hwif, ide_drive_t *drive) +static void destroy_proc_ide_device(ide_hwif_t *hwif, ide_drive_t *drive) { ide_driver_t *driver = drive->driver; @@ -741,8 +711,6 @@ } } -EXPORT_SYMBOL(destroy_proc_ide_device); - void destroy_proc_ide_drives(ide_hwif_t *hwif) { int d; @@ -754,8 +722,6 @@ } } -EXPORT_SYMBOL(destroy_proc_ide_drives); - static ide_proc_entry_t hwif_entries[] = { { "channel", S_IFREG|S_IRUGO, proc_ide_read_channel, NULL }, { "config", S_IFREG|S_IRUGO|S_IWUSR,proc_ide_read_config, proc_ide_write_config }, @@ -843,13 +809,9 @@ entry->proc_fops = &ide_drivers_operations; } -EXPORT_SYMBOL(proc_ide_create); - void proc_ide_destroy(void) { remove_proc_entry("ide/drivers", proc_ide_root); destroy_proc_ide_interfaces(); remove_proc_entry("ide", 0); } - -EXPORT_SYMBOL(proc_ide_destroy); diff -urN linux-2.6.7-rc2/drivers/ide/ide-taskfile.c linux-2.6.7-rc3/drivers/ide/ide-taskfile.c --- linux-2.6.7-rc2/drivers/ide/ide-taskfile.c 2004-06-07 12:54:48.992041950 -0700 +++ linux-2.6.7-rc3/drivers/ide/ide-taskfile.c 2004-06-07 12:55:04.702692632 -0700 @@ -201,14 +201,6 @@ if (!hwif->ide_dma_read(drive)) return ide_started; break; -#ifdef CONFIG_BLK_DEV_IDE_TCQ - case WIN_READDMA_QUEUED: - case WIN_READDMA_QUEUED_EXT: - return __ide_dma_queued_read(drive); - case WIN_WRITEDMA_QUEUED: - case WIN_WRITEDMA_QUEUED_EXT: - return __ide_dma_queued_write(drive); -#endif default: if (task->handler == NULL) return ide_stopped; @@ -350,27 +342,6 @@ return ide_started; } } -#if 0 - - /* - * Holding point for a brain dump of a thought :-/ - */ - - if (!OK_STAT(stat,DRIVE_READY,drive->bad_wstat)) { - DTF("%s: READ attempting to recover last " \ - "sector counter status=0x%02x\n", - drive->name, stat); - rq->current_nr_sectors++; - return DRIVER(drive)->error(drive, "task_in_intr", stat); - } - if (!rq->current_nr_sectors) - if (!DRIVER(drive)->end_request(drive, 1, 0)) - return ide_stopped; - - if (--rq->current_nr_sectors <= 0) - if (!DRIVER(drive)->end_request(drive, 1, 0)) - return ide_stopped; -#endif pBuf = task_map_rq(rq, &flags); DTF("Read: %p, rq->current_nr_sectors: %d, stat: %02x\n", @@ -547,13 +518,6 @@ ide_task_t *args = rq->special; ide_startstop_t startstop; -#if 0 - /* - * assign private copy for multi-write - */ - memcpy(&HWGROUP(drive)->wrq, rq, sizeof(struct request)); -#endif - if (ide_wait_stat(&startstop, drive, DATA_READY, drive->bad_wstat, WAIT_DRQ)) { printk(KERN_ERR "%s: no DRQ after issuing %s\n", diff -urN linux-2.6.7-rc2/drivers/ide/ide-tcq.c linux-2.6.7-rc3/drivers/ide/ide-tcq.c --- linux-2.6.7-rc2/drivers/ide/ide-tcq.c 2004-05-09 19:33:21.000000000 -0700 +++ linux-2.6.7-rc3/drivers/ide/ide-tcq.c 1969-12-31 16:00:00.000000000 -0800 @@ -1,808 +0,0 @@ -/* - * Copyright (C) 2001, 2002 Jens Axboe - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * 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 - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * Support for the DMA queued protocol, which enables ATA disk drives to - * use tagged command queueing. - */ -#include -#include -#include -#include -#include - -#include -#include - -/* - * warning: it will be _very_ verbose if defined - */ -#undef IDE_TCQ_DEBUG - -#ifdef IDE_TCQ_DEBUG -#define TCQ_PRINTK printk -#else -#define TCQ_PRINTK(x...) -#endif - -/* - * use nIEN or not - */ -#undef IDE_TCQ_NIEN - -/* - * we are leaving the SERVICE interrupt alone, IBM drives have it - * on per default and it can't be turned off. Doesn't matter, this - * is the sane config. - */ -#undef IDE_TCQ_FIDDLE_SI - -/* - * bad drive blacklist, for drives that raport tcq capability but don't - * work reliably with the default config. initially from freebsd table. - */ -struct ide_tcq_blacklist { - char *model; - char works; - unsigned int max_sectors; -}; - -static struct ide_tcq_blacklist ide_tcq_blacklist[] = { - { - .model = "IBM-DTTA", - .works = 1, - .max_sectors = 128, - }, - { - .model = "IBM-DJNA", - .works = 0, - }, - { - .model = "WDC AC", - .works = 0, - }, - { - .model = NULL, - }, -}; - -ide_startstop_t ide_dmaq_intr(ide_drive_t *drive); -ide_startstop_t ide_service(ide_drive_t *drive); - -static struct ide_tcq_blacklist *ide_find_drive_blacklist(ide_drive_t *drive) -{ - struct ide_tcq_blacklist *itb; - int i = 0; - - do { - itb = &ide_tcq_blacklist[i]; - - if (!itb->model) - break; - - if (!strncmp(drive->id->model, itb->model, strlen(itb->model))) - return itb; - - i++; - } while (1); - - return NULL; -} - -static inline void drive_ctl_nien(ide_drive_t *drive, int set) -{ -#ifdef IDE_TCQ_NIEN - if (IDE_CONTROL_REG) { - int mask = set ? 0x02 : 0x00; - - hwif->OUTB(drive->ctl | mask, IDE_CONTROL_REG); - } -#endif -} - -static ide_startstop_t ide_tcq_nop_handler(ide_drive_t *drive) -{ - ide_task_t *args = HWGROUP(drive)->rq->special; - ide_hwif_t *hwif = HWIF(drive); - int auto_poll_check = 0; - u8 stat, err; - - if (args->tfRegister[IDE_FEATURE_OFFSET] & 0x01) - auto_poll_check = 1; - - local_irq_enable(); - - stat = hwif->INB(IDE_STATUS_REG); - err = hwif->INB(IDE_ERROR_REG); - ide_end_drive_cmd(drive, stat, err); - - /* - * do taskfile and check ABRT bit -- intelligent adapters will not - * pass NOP with sub-code 0x01 to device, so the command will not - * fail there - */ - if (auto_poll_check) { - if (!(args->tfRegister[IDE_FEATURE_OFFSET] & ABRT_ERR)) { - HWIF(drive)->auto_poll = 1; - printk("%s: NOP Auto-poll enabled\n",HWIF(drive)->name); - } - } - - kfree(args); - return ide_stopped; -} - -/* - * if we encounter _any_ error doing I/O to one of the tags, we must - * invalidate the pending queue. clear the software busy queue and requeue - * on the request queue for restart. issue a WIN_NOP to clear hardware queue - */ -static void ide_tcq_invalidate_queue(ide_drive_t *drive) -{ - ide_hwgroup_t *hwgroup = HWGROUP(drive); - request_queue_t *q = drive->queue; - struct request *rq; - unsigned long flags; - - printk("%s: invalidating tag queue (%d commands)\n", drive->name, ata_pending_commands(drive)); - - /* - * first kill timer and block queue - */ - spin_lock_irqsave(&ide_lock, flags); - - del_timer(&hwgroup->timer); - - if (HWIF(drive)->dma) - HWIF(drive)->ide_dma_end(drive); - - blk_queue_invalidate_tags(q); - - drive->using_tcq = 0; - drive->queue_depth = 1; - hwgroup->busy = 0; - hwgroup->handler = NULL; - - spin_unlock_irqrestore(&ide_lock, flags); - - /* - * now kill hardware queue with a NOP - */ - rq = &hwgroup->wrq; - ide_init_drive_cmd(rq); - rq->buffer = hwgroup->cmd_buf; - memset(rq->buffer, 0, sizeof(hwgroup->cmd_buf)); - rq->buffer[0] = WIN_NOP; - ide_do_drive_cmd(drive, rq, ide_preempt); -} - -void ide_tcq_intr_timeout(unsigned long data) -{ - ide_drive_t *drive = (ide_drive_t *) data; - ide_hwgroup_t *hwgroup = HWGROUP(drive); - ide_hwif_t *hwif = HWIF(drive); - unsigned long flags; - - printk(KERN_ERR "ide_tcq_intr_timeout: timeout waiting for %s interrupt\n", hwgroup->rq ? "completion" : "service"); - - spin_lock_irqsave(&ide_lock, flags); - - if (!hwgroup->busy) - printk(KERN_ERR "ide_tcq_intr_timeout: hwgroup not busy\n"); - if (hwgroup->handler == NULL) - printk(KERN_ERR "ide_tcq_intr_timeout: missing isr!\n"); - - hwgroup->busy = 1; - spin_unlock_irqrestore(&ide_lock, flags); - - /* - * if pending commands, try service before giving up - */ - if (ata_pending_commands(drive)) { - u8 stat = hwif->INB(IDE_STATUS_REG); - - if ((stat & SRV_STAT) && (ide_service(drive) == ide_started)) - return; - } - - if (drive) - ide_tcq_invalidate_queue(drive); -} - -void __ide_tcq_set_intr(ide_hwgroup_t *hwgroup, ide_handler_t *handler) -{ - /* - * always just bump the timer for now, the timeout handling will - * have to be changed to be per-command - */ - hwgroup->timer.function = ide_tcq_intr_timeout; - hwgroup->timer.data = (unsigned long) hwgroup->drive; - mod_timer(&hwgroup->timer, jiffies + 5 * HZ); - - hwgroup->handler = handler; -} - -void ide_tcq_set_intr(ide_hwgroup_t *hwgroup, ide_handler_t *handler) -{ - unsigned long flags; - - spin_lock_irqsave(&ide_lock, flags); - __ide_tcq_set_intr(hwgroup, handler); - spin_unlock_irqrestore(&ide_lock, flags); -} - -/* - * wait 400ns, then poll for busy_mask to clear from alt status - */ -#define IDE_TCQ_WAIT (10000) -int ide_tcq_wait_altstat(ide_drive_t *drive, byte *stat, byte busy_mask) -{ - ide_hwif_t *hwif = HWIF(drive); - int i = 0; - - udelay(1); - - do { - *stat = hwif->INB(IDE_ALTSTATUS_REG); - - if (!(*stat & busy_mask)) - break; - - if (unlikely(i++ > IDE_TCQ_WAIT)) - return 1; - - udelay(10); - } while (1); - - return 0; -} - -/* - * issue SERVICE command to drive -- drive must have been selected first, - * and it must have reported a need for service (status has SRV_STAT set) - * - * Also, nIEN must be set as not to need protection against ide_dmaq_intr - */ -ide_startstop_t ide_service(ide_drive_t *drive) -{ - ide_hwif_t *hwif = HWIF(drive); - unsigned long flags; - struct request *rq; - byte feat, stat; - int tag; - - TCQ_PRINTK("%s: started service\n", drive->name); - - /* - * could be called with IDE_DMA in-progress from invalidate - * handler, refuse to do anything - */ - if (hwif->dma) - return ide_stopped; - - /* - * need to select the right drive first... - */ - if (drive != HWGROUP(drive)->drive) { - SELECT_DRIVE(drive); - udelay(10); - } - - drive_ctl_nien(drive, 1); - - /* - * send SERVICE, wait 400ns, wait for BUSY_STAT to clear - */ - hwif->OUTB(WIN_QUEUED_SERVICE, IDE_COMMAND_REG); - - if (ide_tcq_wait_altstat(drive, &stat, BUSY_STAT)) { - printk(KERN_ERR "ide_service: BUSY clear took too long\n"); - ide_dump_status(drive, "ide_service", stat); - ide_tcq_invalidate_queue(drive); - return ide_stopped; - } - - drive_ctl_nien(drive, 0); - - /* - * FIXME, invalidate queue - */ - if (stat & ERR_STAT) { - ide_dump_status(drive, "ide_service", stat); - ide_tcq_invalidate_queue(drive); - return ide_stopped; - } - - /* - * should not happen, a buggy device could introduce loop - */ - feat = hwif->INB(IDE_NSECTOR_REG); - if (feat & REL) { - HWGROUP(drive)->rq = NULL; - printk(KERN_ERR "%s: release in service\n", drive->name); - return ide_stopped; - } - - tag = feat >> 3; - - TCQ_PRINTK("ide_service: stat %x, feat %x\n", stat, feat); - - spin_lock_irqsave(&ide_lock, flags); - - if ((rq = blk_queue_find_tag(drive->queue, tag))) { - HWGROUP(drive)->rq = rq; - - /* - * we'll start a dma read or write, device will trigger - * interrupt to indicate end of transfer, release is not - * allowed - */ - TCQ_PRINTK("ide_service: starting command, stat=%x\n", stat); - spin_unlock_irqrestore(&ide_lock, flags); - return __ide_dma_queued_start(drive); - } - - printk(KERN_ERR "ide_service: missing request for tag %d\n", tag); - spin_unlock_irqrestore(&ide_lock, flags); - return ide_stopped; -} - -ide_startstop_t ide_check_service(ide_drive_t *drive) -{ - ide_hwif_t *hwif = HWIF(drive); - byte stat; - - TCQ_PRINTK("%s: ide_check_service\n", drive->name); - - if (!ata_pending_commands(drive)) - return ide_stopped; - - stat = hwif->INB(IDE_STATUS_REG); - if (stat & SRV_STAT) - return ide_service(drive); - - /* - * we have pending commands, wait for interrupt - */ - TCQ_PRINTK("%s: wait for service interrupt\n", drive->name); - ide_tcq_set_intr(HWGROUP(drive), ide_dmaq_intr); - return ide_started; -} - -ide_startstop_t ide_dmaq_complete(ide_drive_t *drive, struct request *rq, byte stat) -{ - byte dma_stat; - - /* - * transfer was in progress, stop DMA engine - */ - dma_stat = HWIF(drive)->ide_dma_end(drive); - - /* - * must be end of I/O, check status and complete as necessary - */ - if (unlikely(!OK_STAT(stat, READY_STAT, drive->bad_wstat | DRQ_STAT))) { - printk(KERN_ERR "ide_dmaq_intr: %s: error status %x\n",drive->name,stat); - ide_dump_status(drive, "ide_dmaq_complete", stat); - ide_tcq_invalidate_queue(drive); - return ide_stopped; - } - - if (dma_stat) - printk(KERN_WARNING "%s: bad DMA status (dma_stat=%x)\n", drive->name, dma_stat); - - TCQ_PRINTK("ide_dmaq_complete: ending %p, tag %d\n", rq, rq->tag); - ide_end_request(drive, 1, rq->nr_sectors); - - /* - * we completed this command, check if we can service a new command - */ - return ide_check_service(drive); -} - -/* - * intr handler for queued dma operations. this can be entered for two - * reasons: - * - * 1) device has completed dma transfer - * 2) service request to start a command - * - * if the drive has an active tag, we first complete that request before - * processing any pending SERVICE. - */ -ide_startstop_t ide_dmaq_intr(ide_drive_t *drive) -{ - struct request *rq = HWGROUP(drive)->rq; - ide_hwif_t *hwif = HWIF(drive); - byte stat = hwif->INB(IDE_STATUS_REG); - - TCQ_PRINTK("ide_dmaq_intr: stat=%x\n", stat); - - /* - * if a command completion interrupt is pending, do that first and - * check service afterwards - */ - if (rq) { - TCQ_PRINTK("ide_dmaq_intr: completion\n"); - return ide_dmaq_complete(drive, rq, stat); - } - - /* - * service interrupt - */ - if (stat & SRV_STAT) { - TCQ_PRINTK("ide_dmaq_intr: SERV (stat=%x)\n", stat); - return ide_service(drive); - } - - printk("ide_dmaq_intr: stat=%x, not expected\n", stat); - return ide_check_service(drive); -} - -/* - * check if the ata adapter this drive is attached to supports the - * NOP auto-poll for multiple tcq enabled drives on one channel - */ -static int ide_tcq_check_autopoll(ide_drive_t *drive) -{ - ide_task_t *args; - int i, drives; - - /* - * only need to probe if both drives on a channel support tcq - */ - for (i = 0, drives = 0; i < MAX_DRIVES; i++) - if (HWIF(drive)->drives[i].present && drive->media == ide_disk) - drives++; - - if (drives <= 1) - return 0; - - /* - * what a mess... - */ - args = kmalloc(sizeof(*args), GFP_ATOMIC); - if (!args) - return 1; - - memset(args, 0, sizeof(*args)); - - args->tfRegister[IDE_FEATURE_OFFSET] = 0x01; - args->tfRegister[IDE_COMMAND_OFFSET] = WIN_NOP; - args->command_type = IDE_DRIVE_TASK_NO_DATA; - args->handler = ide_tcq_nop_handler; - return ide_raw_taskfile(drive, args, NULL); -} - -/* - * configure the drive for tcq - */ -static int ide_tcq_configure(ide_drive_t *drive) -{ - int tcq_mask = 1 << 1 | 1 << 14; - int tcq_bits = tcq_mask | 1 << 15; - ide_task_t *args; - - /* - * bit 14 and 1 must be set in word 83 of the device id to indicate - * support for dma queued protocol, and bit 15 must be cleared - */ - if ((drive->id->command_set_2 & tcq_bits) ^ tcq_mask) { - printk(KERN_INFO "%s: TCQ not supported\n", drive->name); - return -EIO; - } - - args = kmalloc(sizeof(*args), GFP_ATOMIC); - if (!args) - return -ENOMEM; - - memset(args, 0, sizeof(ide_task_t)); - args->tfRegister[IDE_COMMAND_OFFSET] = WIN_SETFEATURES; - args->tfRegister[IDE_FEATURE_OFFSET] = SETFEATURES_EN_WCACHE; - args->command_type = IDE_DRIVE_TASK_NO_DATA; - args->handler = &task_no_data_intr; - - if (ide_raw_taskfile(drive, args, NULL)) { - printk(KERN_WARNING "%s: failed to enable write cache\n", drive->name); - goto err; - } - - /* - * disable RELease interrupt, it's quicker to poll this after - * having sent the command opcode - */ - memset(args, 0, sizeof(ide_task_t)); - args->tfRegister[IDE_COMMAND_OFFSET] = WIN_SETFEATURES; - args->tfRegister[IDE_FEATURE_OFFSET] = SETFEATURES_DIS_RI; - args->command_type = IDE_DRIVE_TASK_NO_DATA; - args->handler = &task_no_data_intr; - - if (ide_raw_taskfile(drive, args, NULL)) { - printk(KERN_ERR "%s: disabling release interrupt fail\n", drive->name); - goto err; - } - -#ifdef IDE_TCQ_FIDDLE_SI - /* - * enable SERVICE interrupt - */ - memset(args, 0, sizeof(ide_task_t)); - args->tfRegister[IDE_COMMAND_OFFSET] = WIN_SETFEATURES; - args->tfRegister[IDE_FEATURE_OFFSET] = SETFEATURES_EN_SI; - args->command_type = IDE_DRIVE_TASK_NO_DATA; - args->handler = &task_no_data_intr; - - if (ide_raw_taskfile(drive, args, NULL)) { - printk(KERN_ERR "%s: enabling service interrupt fail\n", drive->name); - goto err; - } -#endif - - kfree(args); - return 0; -err: - kfree(args); - return -EIO; -} - -/* - * for now assume that command list is always as big as we need and don't - * attempt to shrink it on tcq disable - */ -static int ide_enable_queued(ide_drive_t *drive, int on) -{ - struct ide_tcq_blacklist *itb; - int depth = drive->using_tcq ? drive->queue_depth : 0; - - /* - * disable or adjust queue depth - */ - if (!on) { - if (drive->using_tcq) - printk(KERN_INFO "%s: TCQ disabled\n", drive->name); - - drive->using_tcq = 0; - return 0; - } - - if (ide_tcq_configure(drive)) { - drive->using_tcq = 0; - return 1; - } - - /* - * some drives need limited transfer size in tcq - */ - itb = ide_find_drive_blacklist(drive); - if (itb && itb->max_sectors) { - if (itb->max_sectors > HWIF(drive)->rqsize) - itb->max_sectors = HWIF(drive)->rqsize; - - blk_queue_max_sectors(drive->queue, itb->max_sectors); - } - - /* - * enable block tagging - */ - if (!blk_queue_tagged(drive->queue)) - blk_queue_init_tags(drive->queue, IDE_MAX_TAG, NULL); - - /* - * check auto-poll support - */ - ide_tcq_check_autopoll(drive); - - if (depth != drive->queue_depth) - printk(KERN_INFO "%s: tagged command queueing enabled, command queue depth %d\n", drive->name, drive->queue_depth); - - drive->using_tcq = 1; - return 0; -} - -int ide_tcq_wait_dataphase(ide_drive_t *drive) -{ - ide_hwif_t *hwif = HWIF(drive); - byte stat; - int i; - - do { - stat = hwif->INB(IDE_STATUS_REG); - if (!(stat & BUSY_STAT)) - break; - - udelay(10); - } while (1); - - if (OK_STAT(stat, READY_STAT | DRQ_STAT, drive->bad_wstat)) - return 0; - - i = 0; - udelay(1); - do { - stat = hwif->INB(IDE_STATUS_REG); - - if (OK_STAT(stat, READY_STAT | DRQ_STAT, drive->bad_wstat)) - break; - - ++i; - if (unlikely(i >= IDE_TCQ_WAIT)) - return 1; - - udelay(10); - } while (1); - - return 0; -} - -static int ide_tcq_check_blacklist(ide_drive_t *drive) -{ - struct ide_tcq_blacklist *itb = ide_find_drive_blacklist(drive); - - if (!itb) - return 0; - - return !itb->works; -} - -int __ide_dma_queued_on(ide_drive_t *drive) -{ - ide_hwif_t *hwif = HWIF(drive); - - if (drive->media != ide_disk) - return 1; - if (!drive->using_dma) - return 1; - if (hwif->chipset == ide_pdc4030) - return 1; - if (ide_tcq_check_blacklist(drive)) { - printk(KERN_WARNING "%s: tcq forbidden by blacklist\n", - drive->name); - return 1; - } - if (hwif->drives[0].present && hwif->drives[1].present) { - printk(KERN_WARNING "%s: only one drive on a channel supported" - " for tcq\n", drive->name); - return 1; - } - if (ata_pending_commands(drive)) { - printk(KERN_WARNING "ide-tcq; can't toggle tcq feature on " - "busy drive\n"); - return 1; - } - - return ide_enable_queued(drive, 1); -} - -int __ide_dma_queued_off(ide_drive_t *drive) -{ - if (drive->media != ide_disk) - return 1; - if (ata_pending_commands(drive)) { - printk("ide-tcq; can't toggle tcq feature on busy drive\n"); - return 1; - } - - return ide_enable_queued(drive, 0); -} - -static ide_startstop_t ide_dma_queued_rw(ide_drive_t *drive, u8 command) -{ - ide_hwif_t *hwif = HWIF(drive); - unsigned long flags; - byte stat, feat; - - TCQ_PRINTK("%s: starting tag\n", drive->name); - - /* - * set nIEN, tag start operation will enable again when - * it is safe - */ - drive_ctl_nien(drive, 1); - - TCQ_PRINTK("%s: sending cmd=%x\n", drive->name, command); - hwif->OUTB(command, IDE_COMMAND_REG); - - if (ide_tcq_wait_altstat(drive, &stat, BUSY_STAT)) { - printk("%s: alt stat timeout\n", drive->name); - goto err; - } - - drive_ctl_nien(drive, 0); - - if (stat & ERR_STAT) - goto err; - - /* - * bus not released, start dma - */ - feat = hwif->INB(IDE_NSECTOR_REG); - if (!(feat & REL)) { - TCQ_PRINTK("IMMED in queued_start, feat=%x\n", feat); - return __ide_dma_queued_start(drive); - } - - /* - * drive released the bus, clear active request and check for service - */ - spin_lock_irqsave(&ide_lock, flags); - HWGROUP(drive)->rq = NULL; - __ide_tcq_set_intr(HWGROUP(drive), ide_dmaq_intr); - spin_unlock_irqrestore(&ide_lock, flags); - - TCQ_PRINTK("REL in queued_start\n"); - - stat = hwif->INB(IDE_STATUS_REG); - if (stat & SRV_STAT) - return ide_service(drive); - - return ide_released; -err: - ide_dump_status(drive, "rw_queued", stat); - ide_tcq_invalidate_queue(drive); - return ide_stopped; -} - -ide_startstop_t __ide_dma_queued_read(ide_drive_t *drive) -{ - u8 command = WIN_READDMA_QUEUED; - - if (drive->addressing == 1) - command = WIN_READDMA_QUEUED_EXT; - - return ide_dma_queued_rw(drive, command); -} - -ide_startstop_t __ide_dma_queued_write(ide_drive_t *drive) -{ - u8 command = WIN_WRITEDMA_QUEUED; - - if (drive->addressing == 1) - command = WIN_WRITEDMA_QUEUED_EXT; - - return ide_dma_queued_rw(drive, command); -} - -ide_startstop_t __ide_dma_queued_start(ide_drive_t *drive) -{ - ide_hwgroup_t *hwgroup = HWGROUP(drive); - struct request *rq = hwgroup->rq; - ide_hwif_t *hwif = HWIF(drive); - unsigned int reading = 0; - - TCQ_PRINTK("ide_dma: setting up queued tag=%d\n", rq->tag); - - if (!hwgroup->busy) - printk(KERN_ERR "queued_rw: hwgroup not busy\n"); - - if (ide_tcq_wait_dataphase(drive)) { - printk(KERN_WARNING "timeout waiting for data phase\n"); - return ide_stopped; - } - - if (rq_data_dir(rq) == READ) - reading = 1 << 3; - - if (ide_start_dma(hwif, drive, reading)) - return ide_stopped; - - ide_tcq_set_intr(hwgroup, ide_dmaq_intr); - - if (!hwif->ide_dma_begin(drive)) - return ide_started; - - return ide_stopped; -} diff -urN linux-2.6.7-rc2/drivers/ide/ide.c linux-2.6.7-rc3/drivers/ide/ide.c --- linux-2.6.7-rc2/drivers/ide/ide.c 2004-06-07 12:54:48.994042033 -0700 +++ linux-2.6.7-rc3/drivers/ide/ide.c 2004-06-07 12:55:04.753694744 -0700 @@ -188,7 +188,6 @@ #endif EXPORT_SYMBOL(noautodma); -EXPORT_SYMBOL(ide_bus_type); /* * This is declared extern in ide.h, for access by other IDE modules: @@ -554,8 +553,6 @@ return -EBUSY; } -EXPORT_SYMBOL(ide_hwif_request_regions); - /** * ide_hwif_release_regions - free IDE resources * @@ -584,8 +581,6 @@ release_region(hwif->io_ports[i], 1); } -EXPORT_SYMBOL(ide_hwif_release_regions); - /* restore hwif to a sane state */ static void ide_hwif_restore(ide_hwif_t *hwif, ide_hwif_t *tmp_hwif) { @@ -936,8 +931,6 @@ */ } -EXPORT_SYMBOL(ide_setup_ports); - /* * Register an IDE interface, specifying exactly the registers etc * Set init=1 iff calling before probes have taken place. @@ -998,7 +991,6 @@ */ DECLARE_MUTEX(ide_setting_sem); -EXPORT_SYMBOL(ide_setting_sem); /** * ide_add_setting - add an ide setting option @@ -1092,26 +1084,6 @@ } /** - * ide_remove_setting - remove an ide setting option - * @drive: drive to use - * @name: setting name - * - * Removes the setting named from the device if it is present. - * The function takes the settings_lock to protect against - * parallel changes. This function must not be called from IRQ - * context. - */ - -void ide_remove_setting (ide_drive_t *drive, char *name) -{ - down(&ide_setting_sem); - __ide_remove_setting(drive, name); - up(&ide_setting_sem); -} - -EXPORT_SYMBOL(ide_remove_setting); - -/** * ide_find_setting_by_ioctl - find a drive specific ioctl * @drive: drive to scan * @cmd: ioctl command to handle @@ -1292,8 +1264,6 @@ return 0; } -EXPORT_SYMBOL(ide_write_setting); - static int set_io_32bit(ide_drive_t *drive, int arg) { drive->io_32bit = arg; @@ -1421,8 +1391,6 @@ return 1; } -EXPORT_SYMBOL(ide_replace_subdriver); - int ata_attach(ide_drive_t *drive) { struct list_head *p; @@ -1447,8 +1415,6 @@ return 1; } -EXPORT_SYMBOL(ata_attach); - static int generic_ide_suspend(struct device *dev, u32 state) { ide_drive_t *drive = dev->driver_data; @@ -1806,7 +1772,7 @@ if (s[0] == 'h' && s[1] == 'd' && s[2] >= 'a' && s[2] <= max_drive) { const char *hd_words[] = { "none", "noprobe", "nowerr", "cdrom", "serialize", - "autotune", "noautotune", "minus8", "swapdata", "bswap", + "autotune", "noautotune", "stroke", "swapdata", "bswap", "minus11", "remap", "remap63", "scsi", NULL }; unit = s[2] - 'a'; hw = unit / MAX_DRIVES; @@ -1840,6 +1806,9 @@ case -7: /* "noautotune" */ drive->autotune = IDE_TUNE_NOAUTO; goto done; + case -8: /* stroke */ + drive->stroke = 1; + goto done; case -9: /* "swapdata" */ case -10: /* "bswap" */ drive->bswap = 1; diff -urN linux-2.6.7-rc2/drivers/ide/legacy/pdc4030.c linux-2.6.7-rc3/drivers/ide/legacy/pdc4030.c --- linux-2.6.7-rc2/drivers/ide/legacy/pdc4030.c 2004-06-07 12:54:48.995042074 -0700 +++ linux-2.6.7-rc3/drivers/ide/legacy/pdc4030.c 2004-06-07 12:55:04.789696235 -0700 @@ -756,12 +756,6 @@ BUG_ON(rq->nr_sectors > 127); -#ifdef DEBUG - printk(KERN_DEBUG "%s: %sing: LBAsect=%lu, sectors=%lu\n", - drive->name, rq_data_dir(rq) ? "writ" : "read", - block, rq->nr_sectors); -#endif - #ifndef CONFIG_IDE_TASKFILE_IO if (IDE_CONTROL_REG) hwif->OUTB(drive->ctl, IDE_CONTROL_REG); diff -urN linux-2.6.7-rc2/drivers/ide/pci/aec62xx.c linux-2.6.7-rc3/drivers/ide/pci/aec62xx.c --- linux-2.6.7-rc2/drivers/ide/pci/aec62xx.c 2004-05-09 19:33:13.000000000 -0700 +++ linux-2.6.7-rc3/drivers/ide/pci/aec62xx.c 2004-06-07 12:55:04.830697933 -0700 @@ -525,8 +525,6 @@ { ide_pci_device_t *d = &aec62xx_chipsets[id->driver_data]; - if (dev->device != d->device) - BUG(); d->init_setup(dev, d); return 0; } diff -urN linux-2.6.7-rc2/drivers/ide/pci/aec62xx.h linux-2.6.7-rc3/drivers/ide/pci/aec62xx.h --- linux-2.6.7-rc2/drivers/ide/pci/aec62xx.h 2004-06-07 12:54:48.996042116 -0700 +++ linux-2.6.7-rc3/drivers/ide/pci/aec62xx.h 2004-06-07 12:55:04.881700046 -0700 @@ -78,8 +78,6 @@ static ide_pci_device_t aec62xx_chipsets[] __devinitdata = { { /* 0 */ - .vendor = PCI_VENDOR_ID_ARTOP, - .device = PCI_DEVICE_ID_ARTOP_ATP850UF, .name = "AEC6210", .init_setup = init_setup_aec62xx, .init_chipset = init_chipset_aec62xx, @@ -90,8 +88,6 @@ .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, .bootable = OFF_BOARD, },{ /* 1 */ - .vendor = PCI_VENDOR_ID_ARTOP, - .device = PCI_DEVICE_ID_ARTOP_ATP860, .name = "AEC6260", .init_setup = init_setup_aec62xx, .init_chipset = init_chipset_aec62xx, @@ -101,8 +97,6 @@ .autodma = NOAUTODMA, .bootable = OFF_BOARD, },{ /* 2 */ - .vendor = PCI_VENDOR_ID_ARTOP, - .device = PCI_DEVICE_ID_ARTOP_ATP860R, .name = "AEC6260R", .init_setup = init_setup_aec62xx, .init_chipset = init_chipset_aec62xx, @@ -113,8 +107,6 @@ .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, .bootable = NEVER_BOARD, },{ /* 3 */ - .vendor = PCI_VENDOR_ID_ARTOP, - .device = PCI_DEVICE_ID_ARTOP_ATP865, .name = "AEC6X80", .init_setup = init_setup_aec6x80, .init_chipset = init_chipset_aec62xx, @@ -124,8 +116,6 @@ .autodma = AUTODMA, .bootable = OFF_BOARD, },{ /* 4 */ - .vendor = PCI_VENDOR_ID_ARTOP, - .device = PCI_DEVICE_ID_ARTOP_ATP865R, .name = "AEC6X80R", .init_setup = init_setup_aec6x80, .init_chipset = init_chipset_aec62xx, diff -urN linux-2.6.7-rc2/drivers/ide/pci/alim15x3.h linux-2.6.7-rc3/drivers/ide/pci/alim15x3.h --- linux-2.6.7-rc2/drivers/ide/pci/alim15x3.h 2004-06-07 12:54:48.996042116 -0700 +++ linux-2.6.7-rc3/drivers/ide/pci/alim15x3.h 2004-06-07 12:55:04.884700170 -0700 @@ -14,8 +14,6 @@ static ide_pci_device_t ali15x3_chipsets[] __devinitdata = { { /* 0 */ - .vendor = PCI_VENDOR_ID_AL, - .device = PCI_DEVICE_ID_AL_M5229, .name = "ALI15X3", .init_chipset = init_chipset_ali15x3, .init_hwif = init_hwif_ali15x3, diff -urN linux-2.6.7-rc2/drivers/ide/pci/amd74xx.c linux-2.6.7-rc3/drivers/ide/pci/amd74xx.c --- linux-2.6.7-rc2/drivers/ide/pci/amd74xx.c 2004-05-09 19:33:21.000000000 -0700 +++ linux-2.6.7-rc3/drivers/ide/pci/amd74xx.c 2004-06-07 12:55:04.929702034 -0700 @@ -1,7 +1,8 @@ /* * Version 2.13 * - * AMD 755/756/766/8111 and nVidia nForce/2/2s/3/3s IDE driver for Linux. + * AMD 755/756/766/8111 and nVidia nForce/2/2s/3/3s/CK804/MCP04 + * IDE driver for Linux. * * Copyright (c) 2000-2002 Vojtech Pavlik * @@ -26,7 +27,8 @@ #include #include "ide-timing.h" -#include "amd74xx.h" + +#define DISPLAY_AMD_TIMINGS #define AMD_IDE_ENABLE (0x00 + amd_config->base) #define AMD_IDE_CONFIG (0x01 + amd_config->base) @@ -68,6 +70,12 @@ { PCI_DEVICE_ID_NVIDIA_NFORCE3S_IDE, 0x50, AMD_UDMA_133 }, { PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA, 0x50, AMD_UDMA_133 }, { PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA2, 0x50, AMD_UDMA_133 }, + { PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_IDE, 0x50, AMD_UDMA_133 }, + { PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_SATA, 0x50, AMD_UDMA_133 }, + { PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_SATA2, 0x50, AMD_UDMA_133 }, + { PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_IDE, 0x50, AMD_UDMA_133 }, + { PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA, 0x50, AMD_UDMA_133 }, + { PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA2, 0x50, AMD_UDMA_133 }, { 0 } }; @@ -441,11 +449,55 @@ hwif->drives[1].autodma = hwif->autodma; } +#define DECLARE_AMD_DEV(name_str) \ + { \ + .name = name_str, \ + .init_chipset = init_chipset_amd74xx, \ + .init_hwif = init_hwif_amd74xx, \ + .channels = 2, \ + .autodma = AUTODMA, \ + .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, \ + .bootable = ON_BOARD, \ + } + +#define DECLARE_NV_DEV(name_str) \ + { \ + .name = name_str, \ + .init_chipset = init_chipset_amd74xx, \ + .init_hwif = init_hwif_amd74xx, \ + .channels = 2, \ + .autodma = AUTODMA, \ + .enablebits = {{0x50,0x02,0x02}, {0x50,0x01,0x01}}, \ + .bootable = ON_BOARD, \ + } + +static ide_pci_device_t amd74xx_chipsets[] __devinitdata = { + /* 0 */ DECLARE_AMD_DEV("AMD7401"), + /* 1 */ DECLARE_AMD_DEV("AMD7409"), + /* 2 */ DECLARE_AMD_DEV("AMD7411"), + /* 3 */ DECLARE_AMD_DEV("AMD7441"), + /* 4 */ DECLARE_AMD_DEV("AMD8111"), + + /* 5 */ DECLARE_NV_DEV("NFORCE"), + /* 6 */ DECLARE_NV_DEV("NFORCE2"), + /* 7 */ DECLARE_NV_DEV("NFORCE2-U400R"), + /* 8 */ DECLARE_NV_DEV("NFORCE2-U400R-SATA"), + /* 9 */ DECLARE_NV_DEV("NFORCE3-150"), + /* 10 */ DECLARE_NV_DEV("NFORCE3-250"), + /* 11 */ DECLARE_NV_DEV("NFORCE3-250-SATA"), + /* 12 */ DECLARE_NV_DEV("NFORCE3-250-SATA2"), + /* 13 */ DECLARE_NV_DEV("NFORCE-CK804"), + /* 14 */ DECLARE_NV_DEV("NFORCE-CK804-SATA"), + /* 15 */ DECLARE_NV_DEV("NFORCE-CK804-SATA2"), + /* 16 */ DECLARE_NV_DEV("NFORCE-MCP04"), + /* 17 */ DECLARE_NV_DEV("NFORCE-MCP04-SATA"), + /* 18 */ DECLARE_NV_DEV("NFORCE-MCP04-SATA2") +}; + static int __devinit amd74xx_probe(struct pci_dev *dev, const struct pci_device_id *id) { amd_chipset = amd74xx_chipsets + id->driver_data; amd_config = amd_ide_chips + id->driver_data; - if (dev->device != amd_chipset->device) BUG(); if (dev->device != amd_config->id) BUG(); ide_setup_pci_device(dev, amd_chipset); return 0; @@ -465,6 +517,12 @@ { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3S_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 10 }, { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 11 }, { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 12 }, + { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 13 }, + { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_SATA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 14 }, + { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_SATA2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 15 }, + { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 16 }, + { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 17 }, + { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 18 }, { 0, }, }; MODULE_DEVICE_TABLE(pci, amd74xx_pci_tbl); diff -urN linux-2.6.7-rc2/drivers/ide/pci/amd74xx.h linux-2.6.7-rc3/drivers/ide/pci/amd74xx.h --- linux-2.6.7-rc2/drivers/ide/pci/amd74xx.h 2004-06-07 12:54:48.996042116 -0700 +++ linux-2.6.7-rc3/drivers/ide/pci/amd74xx.h 1969-12-31 16:00:00.000000000 -0800 @@ -1,155 +0,0 @@ -#ifndef AMD74XX_H -#define AMD74XX_H - -#include -#include -#include - -#define DISPLAY_AMD_TIMINGS - -static unsigned int init_chipset_amd74xx(struct pci_dev *, const char *); -static void init_hwif_amd74xx(ide_hwif_t *); - -static ide_pci_device_t amd74xx_chipsets[] __devinitdata = { - { /* 0 */ - .vendor = PCI_VENDOR_ID_AMD, - .device = PCI_DEVICE_ID_AMD_COBRA_7401, - .name = "AMD7401", - .init_chipset = init_chipset_amd74xx, - .init_hwif = init_hwif_amd74xx, - .channels = 2, - .autodma = AUTODMA, - .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, - .bootable = ON_BOARD, - },{ /* 1 */ - .vendor = PCI_VENDOR_ID_AMD, - .device = PCI_DEVICE_ID_AMD_VIPER_7409, - .name = "AMD7409", - .init_chipset = init_chipset_amd74xx, - .init_hwif = init_hwif_amd74xx, - .channels = 2, - .autodma = AUTODMA, - .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, - .bootable = ON_BOARD, - },{ /* 2 */ - .vendor = PCI_VENDOR_ID_AMD, - .device = PCI_DEVICE_ID_AMD_VIPER_7411, - .name = "AMD7411", - .init_chipset = init_chipset_amd74xx, - .init_hwif = init_hwif_amd74xx, - .channels = 2, - .autodma = AUTODMA, - .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, - .bootable = ON_BOARD, - },{ /* 3 */ - .vendor = PCI_VENDOR_ID_AMD, - .device = PCI_DEVICE_ID_AMD_OPUS_7441, - .name = "AMD7441", - .init_chipset = init_chipset_amd74xx, - .init_hwif = init_hwif_amd74xx, - .channels = 2, - .autodma = AUTODMA, - .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, - .bootable = ON_BOARD, - },{ /* 4 */ - .vendor = PCI_VENDOR_ID_AMD, - .device = PCI_DEVICE_ID_AMD_8111_IDE, - .name = "AMD8111", - .init_chipset = init_chipset_amd74xx, - .init_hwif = init_hwif_amd74xx, - .autodma = AUTODMA, - .channels = 2, - .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, - .bootable = ON_BOARD, - }, - { /* 5 */ - .vendor = PCI_VENDOR_ID_NVIDIA, - .device = PCI_DEVICE_ID_NVIDIA_NFORCE_IDE, - .name = "NFORCE", - .init_chipset = init_chipset_amd74xx, - .init_hwif = init_hwif_amd74xx, - .channels = 2, - .autodma = AUTODMA, - .enablebits = {{0x50,0x02,0x02}, {0x50,0x01,0x01}}, - .bootable = ON_BOARD, - }, - { /* 6 */ - .vendor = PCI_VENDOR_ID_NVIDIA, - .device = PCI_DEVICE_ID_NVIDIA_NFORCE2_IDE, - .name = "NFORCE2", - .init_chipset = init_chipset_amd74xx, - .init_hwif = init_hwif_amd74xx, - .channels = 2, - .autodma = AUTODMA, - .enablebits = {{0x50,0x02,0x02}, {0x50,0x01,0x01}}, - .bootable = ON_BOARD, - }, - { /* 7 */ - .vendor = PCI_VENDOR_ID_NVIDIA, - .device = PCI_DEVICE_ID_NVIDIA_NFORCE2S_IDE, - .name = "NFORCE2S", - .init_chipset = init_chipset_amd74xx, - .init_hwif = init_hwif_amd74xx, - .channels = 2, - .autodma = AUTODMA, - .enablebits = {{0x50,0x02,0x02}, {0x50,0x01,0x01}}, - .bootable = ON_BOARD, - }, - { /* 8 */ - .vendor = PCI_VENDOR_ID_NVIDIA, - .device = PCI_DEVICE_ID_NVIDIA_NFORCE2S_SATA, - .name = "NFORCE2S-SATA", - .init_chipset = init_chipset_amd74xx, - .init_hwif = init_hwif_amd74xx, - .channels = 2, - .autodma = AUTODMA, - .enablebits = {{0x50,0x02,0x02}, {0x50,0x01,0x01}}, - .bootable = ON_BOARD, - }, - { /* 9 */ - .vendor = PCI_VENDOR_ID_NVIDIA, - .device = PCI_DEVICE_ID_NVIDIA_NFORCE3_IDE, - .name = "NFORCE3", - .init_chipset = init_chipset_amd74xx, - .init_hwif = init_hwif_amd74xx, - .channels = 2, - .autodma = AUTODMA, - .enablebits = {{0x50,0x02,0x02}, {0x50,0x01,0x01}}, - .bootable = ON_BOARD, - }, - { /* 10 */ - .vendor = PCI_VENDOR_ID_NVIDIA, - .device = PCI_DEVICE_ID_NVIDIA_NFORCE3S_IDE, - .name = "NFORCE3S", - .init_chipset = init_chipset_amd74xx, - .init_hwif = init_hwif_amd74xx, - .channels = 2, - .autodma = AUTODMA, - .enablebits = {{0x50,0x02,0x02}, {0x50,0x01,0x01}}, - .bootable = ON_BOARD, - }, - { /* 11 */ - .vendor = PCI_VENDOR_ID_NVIDIA, - .device = PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA, - .name = "NFORCE3S-SATA", - .init_chipset = init_chipset_amd74xx, - .init_hwif = init_hwif_amd74xx, - .channels = 2, - .autodma = AUTODMA, - .enablebits = {{0x50,0x02,0x02}, {0x50,0x01,0x01}}, - .bootable = ON_BOARD, - }, - { /* 12 */ - .vendor = PCI_VENDOR_ID_NVIDIA, - .device = PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA2, - .name = "NFORCE3S-SATA2", - .init_chipset = init_chipset_amd74xx, - .init_hwif = init_hwif_amd74xx, - .channels = 2, - .autodma = AUTODMA, - .enablebits = {{0x50,0x02,0x02}, {0x50,0x01,0x01}}, - .bootable = ON_BOARD, - } -}; - -#endif /* AMD74XX_H */ diff -urN linux-2.6.7-rc2/drivers/ide/pci/atiixp.c linux-2.6.7-rc3/drivers/ide/pci/atiixp.c --- linux-2.6.7-rc2/drivers/ide/pci/atiixp.c 2004-05-09 19:32:29.000000000 -0700 +++ linux-2.6.7-rc3/drivers/ide/pci/atiixp.c 2004-06-07 12:55:04.965703525 -0700 @@ -458,8 +458,6 @@ static ide_pci_device_t atiixp_pci_info[] __devinitdata = { { /* 0 */ - .vendor = PCI_VENDOR_ID_ATI, - .device = PCI_DEVICE_ID_ATI_IXP_IDE, .name = "ATIIXP", .init_chipset = init_chipset_atiixp, .init_hwif = init_hwif_atiixp, @@ -481,11 +479,7 @@ static int __devinit atiixp_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_pci_device_t *d = &atiixp_pci_info[id->driver_data]; - - if (dev->device != d->device) - BUG(); - ide_setup_pci_device(dev, d); + ide_setup_pci_device(dev, &atiixp_pci_info[id->driver_data]); return 0; } diff -urN linux-2.6.7-rc2/drivers/ide/pci/cmd64x.c linux-2.6.7-rc3/drivers/ide/pci/cmd64x.c --- linux-2.6.7-rc2/drivers/ide/pci/cmd64x.c 2004-05-09 19:33:19.000000000 -0700 +++ linux-2.6.7-rc3/drivers/ide/pci/cmd64x.c 2004-06-07 12:55:04.974703898 -0700 @@ -746,10 +746,7 @@ static int __devinit cmd64x_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_pci_device_t *d = &cmd64x_chipsets[id->driver_data]; - if (dev->device != d->device) - BUG(); - ide_setup_pci_device(dev, d); + ide_setup_pci_device(dev, &cmd64x_chipsets[id->driver_data]); return 0; } diff -urN linux-2.6.7-rc2/drivers/ide/pci/cmd64x.h linux-2.6.7-rc3/drivers/ide/pci/cmd64x.h --- linux-2.6.7-rc2/drivers/ide/pci/cmd64x.h 2004-06-07 12:54:49.000042281 -0700 +++ linux-2.6.7-rc3/drivers/ide/pci/cmd64x.h 2004-06-07 12:55:04.975703939 -0700 @@ -65,8 +65,6 @@ static ide_pci_device_t cmd64x_chipsets[] __devinitdata = { { /* 0 */ - .vendor = PCI_VENDOR_ID_CMD, - .device = PCI_DEVICE_ID_CMD_643, .name = "CMD643", .init_chipset = init_chipset_cmd64x, .init_hwif = init_hwif_cmd64x, @@ -74,8 +72,6 @@ .autodma = AUTODMA, .bootable = ON_BOARD, },{ /* 1 */ - .vendor = PCI_VENDOR_ID_CMD, - .device = PCI_DEVICE_ID_CMD_646, .name = "CMD646", .init_chipset = init_chipset_cmd64x, .init_hwif = init_hwif_cmd64x, @@ -84,8 +80,6 @@ .enablebits = {{0x00,0x00,0x00}, {0x51,0x80,0x80}}, .bootable = ON_BOARD, },{ /* 2 */ - .vendor = PCI_VENDOR_ID_CMD, - .device = PCI_DEVICE_ID_CMD_648, .name = "CMD648", .init_chipset = init_chipset_cmd64x, .init_hwif = init_hwif_cmd64x, @@ -93,8 +87,6 @@ .autodma = AUTODMA, .bootable = ON_BOARD, },{ - .vendor = PCI_VENDOR_ID_CMD, - .device = PCI_DEVICE_ID_CMD_649, .name = "CMD649", .init_chipset = init_chipset_cmd64x, .init_hwif = init_hwif_cmd64x, diff -urN linux-2.6.7-rc2/drivers/ide/pci/cs5520.h linux-2.6.7-rc3/drivers/ide/pci/cs5520.h --- linux-2.6.7-rc2/drivers/ide/pci/cs5520.h 2004-06-07 12:54:49.000042281 -0700 +++ linux-2.6.7-rc3/drivers/ide/pci/cs5520.h 2004-06-07 12:55:05.007705265 -0700 @@ -13,28 +13,24 @@ static ide_pci_device_t cyrix_chipsets[] __devinitdata = { { - .vendor = PCI_VENDOR_ID_CYRIX, - .device = PCI_DEVICE_ID_CYRIX_5510, .name = "Cyrix 5510", .init_chipset = init_chipset_cs5520, .init_setup_dma = cs5520_init_setup_dma, .init_hwif = init_hwif_cs5520, - .isa_ports = 1, .channels = 2, .autodma = AUTODMA, .bootable = ON_BOARD, + .flags = IDEPCI_FLAG_ISA_PORTS, }, { - .vendor = PCI_VENDOR_ID_CYRIX, - .device = PCI_DEVICE_ID_CYRIX_5520, .name = "Cyrix 5520", .init_chipset = init_chipset_cs5520, .init_setup_dma = cs5520_init_setup_dma, .init_hwif = init_hwif_cs5520, - .isa_ports = 1, .channels = 2, .autodma = AUTODMA, .bootable = ON_BOARD, + .flags = IDEPCI_FLAG_ISA_PORTS, } }; diff -urN linux-2.6.7-rc2/drivers/ide/pci/cs5530.c linux-2.6.7-rc3/drivers/ide/pci/cs5530.c --- linux-2.6.7-rc2/drivers/ide/pci/cs5530.c 2004-05-09 19:32:27.000000000 -0700 +++ linux-2.6.7-rc3/drivers/ide/pci/cs5530.c 2004-06-07 12:55:05.020705803 -0700 @@ -406,10 +406,7 @@ static int __devinit cs5530_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_pci_device_t *d = &cs5530_chipsets[id->driver_data]; - if (dev->device != d->device) - BUG(); - ide_setup_pci_device(dev, d); + ide_setup_pci_device(dev, &cs5530_chipsets[id->driver_data]); return 0; } diff -urN linux-2.6.7-rc2/drivers/ide/pci/cs5530.h linux-2.6.7-rc3/drivers/ide/pci/cs5530.h --- linux-2.6.7-rc2/drivers/ide/pci/cs5530.h 2004-06-07 12:54:49.000042281 -0700 +++ linux-2.6.7-rc3/drivers/ide/pci/cs5530.h 2004-06-07 12:55:05.020705803 -0700 @@ -12,14 +12,13 @@ static ide_pci_device_t cs5530_chipsets[] __devinitdata = { { /* 0 */ - .vendor = PCI_VENDOR_ID_CYRIX, - .device = PCI_DEVICE_ID_CYRIX_5530_IDE, .name = "CS5530", .init_chipset = init_chipset_cs5530, .init_hwif = init_hwif_cs5530, .channels = 2, .autodma = AUTODMA, .bootable = ON_BOARD, + .flags = IDEPCI_FLAG_FORCE_MASTER, } }; diff -urN linux-2.6.7-rc2/drivers/ide/pci/cy82c693.h linux-2.6.7-rc3/drivers/ide/pci/cy82c693.h --- linux-2.6.7-rc2/drivers/ide/pci/cy82c693.h 2004-06-07 12:54:49.001042323 -0700 +++ linux-2.6.7-rc3/drivers/ide/pci/cy82c693.h 2004-06-07 12:55:05.021705845 -0700 @@ -70,8 +70,6 @@ static ide_pci_device_t cy82c693_chipsets[] __devinitdata = { { /* 0 */ - .vendor = PCI_VENDOR_ID_CONTAQ, - .device = PCI_DEVICE_ID_CONTAQ_82C693, .name = "CY82C693", .init_chipset = init_chipset_cy82c693, .init_iops = init_iops_cy82c693, diff -urN linux-2.6.7-rc2/drivers/ide/pci/generic.c linux-2.6.7-rc3/drivers/ide/pci/generic.c --- linux-2.6.7-rc2/drivers/ide/pci/generic.c 2004-05-09 19:32:37.000000000 -0700 +++ linux-2.6.7-rc3/drivers/ide/pci/generic.c 2004-06-07 12:55:05.066707708 -0700 @@ -77,8 +77,6 @@ if ((dev->class >> 8) == PCI_CLASS_STORAGE_IDE) { ide_pci_device_t *unknown = unknown_chipset; -// unknown->vendor = dev->vendor; -// unknown->device = dev->device; init_setup_unknown(dev, unknown); return 1; } @@ -99,15 +97,13 @@ ide_pci_device_t *d = &generic_chipsets[id->driver_data]; u16 command; - if (dev->device != d->device) - BUG(); - if ((d->vendor == PCI_VENDOR_ID_UMC) && - (d->device == PCI_DEVICE_ID_UMC_UM8886A) && + if (dev->vendor == PCI_VENDOR_ID_UMC && + dev->device == PCI_DEVICE_ID_UMC_UM8886A && (!(PCI_FUNC(dev->devfn) & 1))) return 1; /* UM8886A/BF pair */ - if ((d->vendor == PCI_VENDOR_ID_OPTI) && - (d->device == PCI_DEVICE_ID_OPTI_82C558) && + if (dev->vendor == PCI_VENDOR_ID_OPTI && + dev->device == PCI_DEVICE_ID_OPTI_82C558 && (!(PCI_FUNC(dev->devfn) & 1))) return 1; diff -urN linux-2.6.7-rc2/drivers/ide/pci/generic.h linux-2.6.7-rc3/drivers/ide/pci/generic.h --- linux-2.6.7-rc2/drivers/ide/pci/generic.h 2004-06-07 12:54:49.001042323 -0700 +++ linux-2.6.7-rc3/drivers/ide/pci/generic.h 2004-06-07 12:55:05.080708288 -0700 @@ -10,8 +10,6 @@ static ide_pci_device_t generic_chipsets[] __devinitdata = { { /* 0 */ - .vendor = PCI_VENDOR_ID_NS, - .device = PCI_DEVICE_ID_NS_87410, .name = "NS87410", .init_chipset = init_chipset_generic, .init_hwif = init_hwif_generic, @@ -20,8 +18,6 @@ .enablebits = {{0x43,0x08,0x08}, {0x47,0x08,0x08}}, .bootable = ON_BOARD, },{ /* 1 */ - .vendor = PCI_VENDOR_ID_PCTECH, - .device = PCI_DEVICE_ID_PCTECH_SAMURAI_IDE, .name = "SAMURAI", .init_chipset = init_chipset_generic, .init_hwif = init_hwif_generic, @@ -29,8 +25,6 @@ .autodma = AUTODMA, .bootable = ON_BOARD, },{ /* 2 */ - .vendor = PCI_VENDOR_ID_HOLTEK, - .device = PCI_DEVICE_ID_HOLTEK_6565, .name = "HT6565", .init_chipset = init_chipset_generic, .init_hwif = init_hwif_generic, @@ -38,8 +32,6 @@ .autodma = AUTODMA, .bootable = ON_BOARD, },{ /* 3 */ - .vendor = PCI_VENDOR_ID_UMC, - .device = PCI_DEVICE_ID_UMC_UM8673F, .name = "UM8673F", .init_chipset = init_chipset_generic, .init_hwif = init_hwif_generic, @@ -47,8 +39,6 @@ .autodma = NODMA, .bootable = ON_BOARD, },{ /* 4 */ - .vendor = PCI_VENDOR_ID_UMC, - .device = PCI_DEVICE_ID_UMC_UM8886A, .name = "UM8886A", .init_chipset = init_chipset_generic, .init_hwif = init_hwif_generic, @@ -56,8 +46,6 @@ .autodma = NODMA, .bootable = ON_BOARD, },{ /* 5 */ - .vendor = PCI_VENDOR_ID_UMC, - .device = PCI_DEVICE_ID_UMC_UM8886BF, .name = "UM8886BF", .init_chipset = init_chipset_generic, .init_hwif = init_hwif_generic, @@ -65,8 +53,6 @@ .autodma = NODMA, .bootable = ON_BOARD, },{ /* 6 */ - .vendor = PCI_VENDOR_ID_HINT, - .device = PCI_DEVICE_ID_HINT_VXPROII_IDE, .name = "HINT_IDE", .init_chipset = init_chipset_generic, .init_hwif = init_hwif_generic, @@ -74,8 +60,6 @@ .autodma = AUTODMA, .bootable = ON_BOARD, },{ /* 7 */ - .vendor = PCI_VENDOR_ID_VIA, - .device = PCI_DEVICE_ID_VIA_82C561, .name = "VIA_IDE", .init_chipset = init_chipset_generic, .init_hwif = init_hwif_generic, @@ -83,8 +67,6 @@ .autodma = NOAUTODMA, .bootable = ON_BOARD, },{ /* 8 */ - .vendor = PCI_VENDOR_ID_OPTI, - .device = PCI_DEVICE_ID_OPTI_82C558, .name = "OPTI621V", .init_chipset = init_chipset_generic, .init_hwif = init_hwif_generic, @@ -92,8 +74,6 @@ .autodma = NOAUTODMA, .bootable = ON_BOARD, },{ /* 9 */ - .vendor = PCI_VENDOR_ID_VIA, - .device = PCI_DEVICE_ID_VIA_8237_SATA, .name = "VIA8237SATA", .init_chipset = init_chipset_generic, .init_hwif = init_hwif_generic, @@ -101,8 +81,6 @@ .autodma = AUTODMA, .bootable = OFF_BOARD, },{ /* 10 */ - .vendor = PCI_VENDOR_ID_TOSHIBA, - .device = PCI_DEVICE_ID_TOSHIBA_PICCOLO, .name = "Piccolo0102", .init_chipset = init_chipset_generic, .init_hwif = init_hwif_generic, @@ -110,8 +88,6 @@ .autodma = NOAUTODMA, .bootable = ON_BOARD, },{ /* 11 */ - .vendor = PCI_VENDOR_ID_TOSHIBA, - .device = PCI_DEVICE_ID_TOSHIBA_PICCOLO_1, .name = "Piccolo0103", .init_chipset = init_chipset_generic, .init_hwif = init_hwif_generic, @@ -119,8 +95,6 @@ .autodma = NOAUTODMA, .bootable = ON_BOARD, },{ /* 12 */ - .vendor = PCI_VENDOR_ID_TOSHIBA, - .device = PCI_DEVICE_ID_TOSHIBA_PICCOLO_2, .name = "Piccolo0105", .init_chipset = init_chipset_generic, .init_hwif = init_hwif_generic, @@ -133,8 +107,6 @@ #if 0 static ide_pci_device_t unknown_chipset[] __devinitdata = { { /* 0 */ - .vendor = 0, - .device = 0, .name = "PCI_IDE", .init_chipset = init_chipset_generic, .init_hwif = init_hwif_generic, diff -urN linux-2.6.7-rc2/drivers/ide/pci/hpt34x.h linux-2.6.7-rc3/drivers/ide/pci/hpt34x.h --- linux-2.6.7-rc2/drivers/ide/pci/hpt34x.h 2004-06-07 12:54:49.001042323 -0700 +++ linux-2.6.7-rc3/drivers/ide/pci/hpt34x.h 2004-06-07 12:55:05.081708330 -0700 @@ -18,8 +18,6 @@ static ide_pci_device_t hpt34x_chipsets[] __devinitdata = { { /* 0 */ - .vendor = PCI_VENDOR_ID_TTI, - .device = PCI_DEVICE_ID_TTI_HPT343, .name = "HPT34X", .init_chipset = init_chipset_hpt34x, .init_hwif = init_hwif_hpt34x, diff -urN linux-2.6.7-rc2/drivers/ide/pci/hpt366.c linux-2.6.7-rc3/drivers/ide/pci/hpt366.c --- linux-2.6.7-rc2/drivers/ide/pci/hpt366.c 2004-05-09 19:32:38.000000000 -0700 +++ linux-2.6.7-rc3/drivers/ide/pci/hpt366.c 2004-06-07 12:55:05.096708951 -0700 @@ -1241,8 +1241,6 @@ { ide_pci_device_t *d = &hpt366_chipsets[id->driver_data]; - if (dev->device != d->device) - BUG(); d->init_setup(dev, d); return 0; } diff -urN linux-2.6.7-rc2/drivers/ide/pci/hpt366.h linux-2.6.7-rc3/drivers/ide/pci/hpt366.h --- linux-2.6.7-rc2/drivers/ide/pci/hpt366.h 2004-06-07 12:54:49.002042364 -0700 +++ linux-2.6.7-rc3/drivers/ide/pci/hpt366.h 2004-06-07 12:55:05.098709034 -0700 @@ -425,8 +425,6 @@ static ide_pci_device_t hpt366_chipsets[] __devinitdata = { { /* 0 */ - .vendor = PCI_VENDOR_ID_TTI, - .device = PCI_DEVICE_ID_TTI_HPT366, .name = "HPT366", .init_setup = init_setup_hpt366, .init_chipset = init_chipset_hpt366, @@ -437,8 +435,6 @@ .bootable = OFF_BOARD, .extra = 240 },{ /* 1 */ - .vendor = PCI_VENDOR_ID_TTI, - .device = PCI_DEVICE_ID_TTI_HPT372, .name = "HPT372A", .init_setup = init_setup_hpt37x, .init_chipset = init_chipset_hpt366, @@ -448,8 +444,6 @@ .autodma = AUTODMA, .bootable = OFF_BOARD, },{ /* 2 */ - .vendor = PCI_VENDOR_ID_TTI, - .device = PCI_DEVICE_ID_TTI_HPT302, .name = "HPT302", .init_setup = init_setup_hpt37x, .init_chipset = init_chipset_hpt366, @@ -459,8 +453,6 @@ .autodma = AUTODMA, .bootable = OFF_BOARD, },{ /* 3 */ - .vendor = PCI_VENDOR_ID_TTI, - .device = PCI_DEVICE_ID_TTI_HPT371, .name = "HPT371", .init_setup = init_setup_hpt37x, .init_chipset = init_chipset_hpt366, @@ -470,8 +462,6 @@ .autodma = AUTODMA, .bootable = OFF_BOARD, },{ /* 4 */ - .vendor = PCI_VENDOR_ID_TTI, - .device = PCI_DEVICE_ID_TTI_HPT374, .name = "HPT374", .init_setup = init_setup_hpt374, .init_chipset = init_chipset_hpt366, diff -urN linux-2.6.7-rc2/drivers/ide/pci/it8172.c linux-2.6.7-rc3/drivers/ide/pci/it8172.c --- linux-2.6.7-rc2/drivers/ide/pci/it8172.c 2004-05-09 19:33:12.000000000 -0700 +++ linux-2.6.7-rc3/drivers/ide/pci/it8172.c 2004-06-07 12:55:05.098709034 -0700 @@ -288,11 +288,10 @@ static int __devinit it8172_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_pci_device_t *d = &it8172_chipsets[id->driver_data]; if ((!(PCI_FUNC(dev->devfn) & 1) || (!((dev->class >> 8) == PCI_CLASS_STORAGE_IDE)))) return 1; /* IT8172 is more than only a IDE controller */ - ide_setup_pci_device(dev, d); + ide_setup_pci_device(dev, &it8172_chipsets[id->driver_data]); return 0; } diff -urN linux-2.6.7-rc2/drivers/ide/pci/it8172.h linux-2.6.7-rc3/drivers/ide/pci/it8172.h --- linux-2.6.7-rc2/drivers/ide/pci/it8172.h 2004-06-07 12:54:49.002042364 -0700 +++ linux-2.6.7-rc3/drivers/ide/pci/it8172.h 2004-06-07 12:55:05.098709034 -0700 @@ -20,8 +20,6 @@ static ide_pci_device_t it8172_chipsets[] __devinitdata = { { /* 0 */ - .vendor = PCI_VENDOR_ID_ITE, - .device = PCI_DEVICE_ID_ITE_IT8172G, .name = "IT8172G", .init_setup = init_setup_it8172, .init_chipset = init_chipset_it8172, diff -urN linux-2.6.7-rc2/drivers/ide/pci/ns87415.c linux-2.6.7-rc3/drivers/ide/pci/ns87415.c --- linux-2.6.7-rc2/drivers/ide/pci/ns87415.c 2004-05-09 19:32:29.000000000 -0700 +++ linux-2.6.7-rc3/drivers/ide/pci/ns87415.c 2004-06-07 12:55:05.099709075 -0700 @@ -219,10 +219,7 @@ static int __devinit ns87415_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_pci_device_t *d = &ns87415_chipsets[id->driver_data]; - if (dev->device != d->device) - BUG(); - ide_setup_pci_device(dev, d); + ide_setup_pci_device(dev, &ns87415_chipsets[id->driver_data]); return 0; } diff -urN linux-2.6.7-rc2/drivers/ide/pci/ns87415.h linux-2.6.7-rc3/drivers/ide/pci/ns87415.h --- linux-2.6.7-rc2/drivers/ide/pci/ns87415.h 2004-06-07 12:54:49.002042364 -0700 +++ linux-2.6.7-rc3/drivers/ide/pci/ns87415.h 2004-06-07 12:55:05.099709075 -0700 @@ -9,8 +9,6 @@ static ide_pci_device_t ns87415_chipsets[] __devinitdata = { { /* 0 */ - .vendor = PCI_VENDOR_ID_NS, - .device = PCI_DEVICE_ID_NS_87415, .name = "NS87415", .init_hwif = init_hwif_ns87415, .channels = 2, diff -urN linux-2.6.7-rc2/drivers/ide/pci/opti621.c linux-2.6.7-rc3/drivers/ide/pci/opti621.c --- linux-2.6.7-rc2/drivers/ide/pci/opti621.c 2004-05-09 19:32:28.000000000 -0700 +++ linux-2.6.7-rc3/drivers/ide/pci/opti621.c 2004-06-07 12:55:05.100709117 -0700 @@ -355,10 +355,7 @@ static int __devinit opti621_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_pci_device_t *d = &opti621_chipsets[id->driver_data]; - if (dev->device != d->device) - BUG(); - ide_setup_pci_device(dev, d); + ide_setup_pci_device(dev, &opti621_chipsets[id->driver_data]); return 0; } diff -urN linux-2.6.7-rc2/drivers/ide/pci/opti621.h linux-2.6.7-rc3/drivers/ide/pci/opti621.h --- linux-2.6.7-rc2/drivers/ide/pci/opti621.h 2004-06-07 12:54:49.003042406 -0700 +++ linux-2.6.7-rc3/drivers/ide/pci/opti621.h 2004-06-07 12:55:05.101709158 -0700 @@ -10,8 +10,6 @@ static ide_pci_device_t opti621_chipsets[] __devinitdata = { { /* 0 */ - .vendor = PCI_VENDOR_ID_OPTI, - .device = PCI_DEVICE_ID_OPTI_82C621, .name = "OPTI621", .init_setup = init_setup_opti621, .init_hwif = init_hwif_opti621, @@ -20,8 +18,6 @@ .enablebits = {{0x45,0x80,0x00}, {0x40,0x08,0x00}}, .bootable = ON_BOARD, },{ /* 1 */ - .vendor = PCI_VENDOR_ID_OPTI, - .device = PCI_DEVICE_ID_OPTI_82C825, .name = "OPTI621X", .init_setup = init_setup_opti621, .init_hwif = init_hwif_opti621, diff -urN linux-2.6.7-rc2/drivers/ide/pci/pdc202xx_new.c linux-2.6.7-rc3/drivers/ide/pci/pdc202xx_new.c --- linux-2.6.7-rc2/drivers/ide/pci/pdc202xx_new.c 2004-05-09 19:32:54.000000000 -0700 +++ linux-2.6.7-rc3/drivers/ide/pci/pdc202xx_new.c 2004-06-07 12:55:05.101709158 -0700 @@ -514,8 +514,6 @@ { ide_pci_device_t *d = &pdcnew_chipsets[id->driver_data]; - if (dev->device != d->device) - BUG(); d->init_setup(dev, d); return 0; } diff -urN linux-2.6.7-rc2/drivers/ide/pci/pdc202xx_new.h linux-2.6.7-rc3/drivers/ide/pci/pdc202xx_new.h --- linux-2.6.7-rc2/drivers/ide/pci/pdc202xx_new.h 2004-06-07 12:54:49.003042406 -0700 +++ linux-2.6.7-rc3/drivers/ide/pci/pdc202xx_new.h 2004-06-07 12:55:05.101709158 -0700 @@ -53,8 +53,6 @@ static ide_pci_device_t pdcnew_chipsets[] __devinitdata = { { /* 0 */ - .vendor = PCI_VENDOR_ID_PROMISE, - .device = PCI_DEVICE_ID_PROMISE_20268, .name = "PDC20268", .init_setup = init_setup_pdcnew, .init_chipset = init_chipset_pdcnew, @@ -63,8 +61,6 @@ .autodma = AUTODMA, .bootable = OFF_BOARD, },{ /* 1 */ - .vendor = PCI_VENDOR_ID_PROMISE, - .device = PCI_DEVICE_ID_PROMISE_20269, .name = "PDC20269", .init_setup = init_setup_pdcnew, .init_chipset = init_chipset_pdcnew, @@ -73,8 +69,6 @@ .autodma = AUTODMA, .bootable = OFF_BOARD, },{ /* 2 */ - .vendor = PCI_VENDOR_ID_PROMISE, - .device = PCI_DEVICE_ID_PROMISE_20270, .name = "PDC20270", .init_setup = init_setup_pdc20270, .init_chipset = init_chipset_pdcnew, @@ -86,8 +80,6 @@ #endif .bootable = OFF_BOARD, },{ /* 3 */ - .vendor = PCI_VENDOR_ID_PROMISE, - .device = PCI_DEVICE_ID_PROMISE_20271, .name = "PDC20271", .init_setup = init_setup_pdcnew, .init_chipset = init_chipset_pdcnew, @@ -96,8 +88,6 @@ .autodma = AUTODMA, .bootable = OFF_BOARD, },{ /* 4 */ - .vendor = PCI_VENDOR_ID_PROMISE, - .device = PCI_DEVICE_ID_PROMISE_20275, .name = "PDC20275", .init_setup = init_setup_pdcnew, .init_chipset = init_chipset_pdcnew, @@ -106,8 +96,6 @@ .autodma = AUTODMA, .bootable = OFF_BOARD, },{ /* 5 */ - .vendor = PCI_VENDOR_ID_PROMISE, - .device = PCI_DEVICE_ID_PROMISE_20276, .name = "PDC20276", .init_setup = init_setup_pdc20276, .init_chipset = init_chipset_pdcnew, @@ -119,8 +107,6 @@ #endif .bootable = OFF_BOARD, },{ /* 6 */ - .vendor = PCI_VENDOR_ID_PROMISE, - .device = PCI_DEVICE_ID_PROMISE_20277, .name = "PDC20277", .init_setup = init_setup_pdcnew, .init_chipset = init_chipset_pdcnew, diff -urN linux-2.6.7-rc2/drivers/ide/pci/pdc202xx_old.c linux-2.6.7-rc3/drivers/ide/pci/pdc202xx_old.c --- linux-2.6.7-rc2/drivers/ide/pci/pdc202xx_old.c 2004-05-09 19:33:20.000000000 -0700 +++ linux-2.6.7-rc3/drivers/ide/pci/pdc202xx_old.c 2004-06-07 12:55:05.102709200 -0700 @@ -884,8 +884,6 @@ { ide_pci_device_t *d = &pdc202xx_chipsets[id->driver_data]; - if (dev->device != d->device) - BUG(); d->init_setup(dev, d); return 0; } diff -urN linux-2.6.7-rc2/drivers/ide/pci/pdc202xx_old.h linux-2.6.7-rc3/drivers/ide/pci/pdc202xx_old.h --- linux-2.6.7-rc2/drivers/ide/pci/pdc202xx_old.h 2004-06-07 12:54:49.004042447 -0700 +++ linux-2.6.7-rc3/drivers/ide/pci/pdc202xx_old.h 2004-06-07 12:55:05.103709241 -0700 @@ -180,8 +180,6 @@ static ide_pci_device_t pdc202xx_chipsets[] __devinitdata = { { /* 0 */ - .vendor = PCI_VENDOR_ID_PROMISE, - .device = PCI_DEVICE_ID_PROMISE_20246, .name = "PDC20246", .init_setup = init_setup_pdc202ata4, .init_chipset = init_chipset_pdc202xx, @@ -195,8 +193,6 @@ .bootable = OFF_BOARD, .extra = 16, },{ /* 1 */ - .vendor = PCI_VENDOR_ID_PROMISE, - .device = PCI_DEVICE_ID_PROMISE_20262, .name = "PDC20262", .init_setup = init_setup_pdc202ata4, .init_chipset = init_chipset_pdc202xx, @@ -209,9 +205,8 @@ #endif .bootable = OFF_BOARD, .extra = 48, + .flags = IDEPCI_FLAG_FORCE_PDC, },{ /* 2 */ - .vendor = PCI_VENDOR_ID_PROMISE, - .device = PCI_DEVICE_ID_PROMISE_20263, .name = "PDC20263", .init_setup = init_setup_pdc202ata4, .init_chipset = init_chipset_pdc202xx, @@ -225,8 +220,6 @@ .bootable = OFF_BOARD, .extra = 48, },{ /* 3 */ - .vendor = PCI_VENDOR_ID_PROMISE, - .device = PCI_DEVICE_ID_PROMISE_20265, .name = "PDC20265", .init_setup = init_setup_pdc20265, .init_chipset = init_chipset_pdc202xx, @@ -239,9 +232,8 @@ #endif .bootable = OFF_BOARD, .extra = 48, + .flags = IDEPCI_FLAG_FORCE_PDC, },{ /* 4 */ - .vendor = PCI_VENDOR_ID_PROMISE, - .device = PCI_DEVICE_ID_PROMISE_20267, .name = "PDC20267", .init_setup = init_setup_pdc202xx, .init_chipset = init_chipset_pdc202xx, diff -urN linux-2.6.7-rc2/drivers/ide/pci/piix.c linux-2.6.7-rc3/drivers/ide/pci/piix.c --- linux-2.6.7-rc2/drivers/ide/pci/piix.c 2004-06-07 12:54:49.004042447 -0700 +++ linux-2.6.7-rc3/drivers/ide/pci/piix.c 2004-06-07 12:55:05.103709241 -0700 @@ -49,9 +49,9 @@ * pci_read_config_word(HWIF(drive)->pci_dev, 0x40, ®40); * pci_read_config_word(HWIF(drive)->pci_dev, 0x42, ®42); * pci_read_config_word(HWIF(drive)->pci_dev, 0x44, ®44); - * pci_read_config_word(HWIF(drive)->pci_dev, 0x48, ®48); + * pci_read_config_byte(HWIF(drive)->pci_dev, 0x48, ®48); * pci_read_config_word(HWIF(drive)->pci_dev, 0x4a, ®4a); - * pci_read_config_word(HWIF(drive)->pci_dev, 0x54, ®54); + * pci_read_config_byte(HWIF(drive)->pci_dev, 0x54, ®54); * * Documentation * Publically available from Intel web site. Errata documentation @@ -432,15 +432,14 @@ int w_flag = 0x10 << drive->dn; int u_speed = 0; int sitre; - u16 reg4042, reg44, reg48, reg4a, reg54; - u8 reg55; + u16 reg4042, reg4a; + u8 reg48, reg54, reg55; pci_read_config_word(dev, maslave, ®4042); sitre = (reg4042 & 0x4000) ? 1 : 0; - pci_read_config_word(dev, 0x44, ®44); - pci_read_config_word(dev, 0x48, ®48); + pci_read_config_byte(dev, 0x48, ®48); pci_read_config_word(dev, 0x4a, ®4a); - pci_read_config_word(dev, 0x54, ®54); + pci_read_config_byte(dev, 0x54, ®54); pci_read_config_byte(dev, 0x55, ®55); switch(speed) { @@ -462,30 +461,26 @@ if (speed >= XFER_UDMA_0) { if (!(reg48 & u_flag)) - pci_write_config_word(dev, 0x48, reg48|u_flag); + pci_write_config_byte(dev, 0x48, reg48 | u_flag); if (speed == XFER_UDMA_5) { pci_write_config_byte(dev, 0x55, (u8) reg55|w_flag); } else { pci_write_config_byte(dev, 0x55, (u8) reg55 & ~w_flag); } - if (!(reg4a & u_speed)) { - pci_write_config_word(dev, 0x4a, reg4a & ~a_speed); - pci_write_config_word(dev, 0x4a, reg4a|u_speed); - } + if ((reg4a & a_speed) != u_speed) + pci_write_config_word(dev, 0x4a, (reg4a & ~a_speed) | u_speed); if (speed > XFER_UDMA_2) { - if (!(reg54 & v_flag)) { - pci_write_config_word(dev, 0x54, reg54|v_flag); - } - } else { - pci_write_config_word(dev, 0x54, reg54 & ~v_flag); - } + if (!(reg54 & v_flag)) + pci_write_config_byte(dev, 0x54, reg54 | v_flag); + } else + pci_write_config_byte(dev, 0x54, reg54 & ~v_flag); } else { if (reg48 & u_flag) - pci_write_config_word(dev, 0x48, reg48 & ~u_flag); + pci_write_config_byte(dev, 0x48, reg48 & ~u_flag); if (reg4a & a_speed) pci_write_config_word(dev, 0x4a, reg4a & ~a_speed); if (reg54 & v_flag) - pci_write_config_word(dev, 0x54, reg54 & ~v_flag); + pci_write_config_byte(dev, 0x54, reg54 & ~v_flag); if (reg55 & w_flag) pci_write_config_byte(dev, 0x55, (u8) reg55 & ~w_flag); } @@ -744,8 +739,6 @@ { ide_pci_device_t *d = &piix_pci_info[id->driver_data]; - if (dev->device != d->device) - BUG(); d->init_setup(dev, d); return 0; } diff -urN linux-2.6.7-rc2/drivers/ide/pci/piix.h linux-2.6.7-rc3/drivers/ide/pci/piix.h --- linux-2.6.7-rc2/drivers/ide/pci/piix.h 2004-06-07 12:54:49.005042489 -0700 +++ linux-2.6.7-rc3/drivers/ide/pci/piix.h 2004-06-07 12:55:05.104709282 -0700 @@ -13,10 +13,8 @@ static unsigned int __devinit init_chipset_piix(struct pci_dev *, const char *); static void init_hwif_piix(ide_hwif_t *); -#define DECLARE_PIIX_DEV(pci_id, name_str) \ +#define DECLARE_PIIX_DEV(name_str) \ { \ - .vendor = PCI_VENDOR_ID_INTEL, \ - .device = pci_id, \ .name = name_str, \ .init_setup = init_setup_piix, \ .init_chipset = init_chipset_piix, \ @@ -33,12 +31,10 @@ */ static ide_pci_device_t piix_pci_info[] __devinitdata = { - /* 0 */ DECLARE_PIIX_DEV(PCI_DEVICE_ID_INTEL_82371FB_0, "PIIXa"), - /* 1 */ DECLARE_PIIX_DEV(PCI_DEVICE_ID_INTEL_82371FB_1, "PIIXb"), + /* 0 */ DECLARE_PIIX_DEV("PIIXa"), + /* 1 */ DECLARE_PIIX_DEV("PIIXb"), { /* 2 */ - .vendor = PCI_VENDOR_ID_INTEL, - .device = PCI_DEVICE_ID_INTEL_82371MX, .name = "MPIIX", .init_setup = init_setup_piix, .init_hwif = init_hwif_piix, @@ -48,24 +44,24 @@ .bootable = ON_BOARD, }, - /* 3 */ DECLARE_PIIX_DEV(PCI_DEVICE_ID_INTEL_82371SB_1, "PIIX3"), - /* 4 */ DECLARE_PIIX_DEV(PCI_DEVICE_ID_INTEL_82371AB, "PIIX4"), - /* 5 */ DECLARE_PIIX_DEV(PCI_DEVICE_ID_INTEL_82801AB_1, "ICH0"), - /* 6 */ DECLARE_PIIX_DEV(PCI_DEVICE_ID_INTEL_82443MX_1, "PIIX4"), - /* 7 */ DECLARE_PIIX_DEV(PCI_DEVICE_ID_INTEL_82801AA_1, "ICH"), - /* 8 */ DECLARE_PIIX_DEV(PCI_DEVICE_ID_INTEL_82372FB_1, "PIIX4"), - /* 9 */ DECLARE_PIIX_DEV(PCI_DEVICE_ID_INTEL_82451NX, "PIIX4"), - /* 10 */ DECLARE_PIIX_DEV(PCI_DEVICE_ID_INTEL_82801BA_9, "ICH2"), - /* 11 */ DECLARE_PIIX_DEV(PCI_DEVICE_ID_INTEL_82801BA_8, "ICH2M"), - /* 12 */ DECLARE_PIIX_DEV(PCI_DEVICE_ID_INTEL_82801CA_10, "ICH3M"), - /* 13 */ DECLARE_PIIX_DEV(PCI_DEVICE_ID_INTEL_82801CA_11, "ICH3"), - /* 14 */ DECLARE_PIIX_DEV(PCI_DEVICE_ID_INTEL_82801DB_11, "ICH4"), - /* 15 */ DECLARE_PIIX_DEV(PCI_DEVICE_ID_INTEL_82801EB_11, "ICH5"), - /* 16 */ DECLARE_PIIX_DEV(PCI_DEVICE_ID_INTEL_82801E_11, "C-ICH"), - /* 17 */ DECLARE_PIIX_DEV(PCI_DEVICE_ID_INTEL_82801DB_10, "ICH4"), - /* 18 */ DECLARE_PIIX_DEV(PCI_DEVICE_ID_INTEL_82801EB_1, "ICH5-SATA"), - /* 19 */ DECLARE_PIIX_DEV(PCI_DEVICE_ID_INTEL_ESB_2, "ICH5"), - /* 20 */ DECLARE_PIIX_DEV(PCI_DEVICE_ID_INTEL_ICH6_19, "ICH6") + /* 3 */ DECLARE_PIIX_DEV("PIIX3"), + /* 4 */ DECLARE_PIIX_DEV("PIIX4"), + /* 5 */ DECLARE_PIIX_DEV("ICH0"), + /* 6 */ DECLARE_PIIX_DEV("PIIX4"), + /* 7 */ DECLARE_PIIX_DEV("ICH"), + /* 8 */ DECLARE_PIIX_DEV("PIIX4"), + /* 9 */ DECLARE_PIIX_DEV("PIIX4"), + /* 10 */ DECLARE_PIIX_DEV("ICH2"), + /* 11 */ DECLARE_PIIX_DEV("ICH2M"), + /* 12 */ DECLARE_PIIX_DEV("ICH3M"), + /* 13 */ DECLARE_PIIX_DEV("ICH3"), + /* 14 */ DECLARE_PIIX_DEV("ICH4"), + /* 15 */ DECLARE_PIIX_DEV("ICH5"), + /* 16 */ DECLARE_PIIX_DEV("C-ICH"), + /* 17 */ DECLARE_PIIX_DEV("ICH4"), + /* 18 */ DECLARE_PIIX_DEV("ICH5-SATA"), + /* 19 */ DECLARE_PIIX_DEV("ICH5"), + /* 20 */ DECLARE_PIIX_DEV("ICH6") }; #endif /* PIIX_H */ diff -urN linux-2.6.7-rc2/drivers/ide/pci/rz1000.c linux-2.6.7-rc3/drivers/ide/pci/rz1000.c --- linux-2.6.7-rc2/drivers/ide/pci/rz1000.c 2004-05-09 19:32:27.000000000 -0700 +++ linux-2.6.7-rc3/drivers/ide/pci/rz1000.c 2004-06-07 12:55:05.104709282 -0700 @@ -56,10 +56,7 @@ static int __devinit rz1000_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_pci_device_t *d = &rz1000_chipsets[id->driver_data]; - if (dev->device != d->device) - BUG(); - ide_setup_pci_device(dev, d); + ide_setup_pci_device(dev, &rz1000_chipsets[id->driver_data]); return 0; } diff -urN linux-2.6.7-rc2/drivers/ide/pci/rz1000.h linux-2.6.7-rc3/drivers/ide/pci/rz1000.h --- linux-2.6.7-rc2/drivers/ide/pci/rz1000.h 2004-06-07 12:54:49.005042489 -0700 +++ linux-2.6.7-rc3/drivers/ide/pci/rz1000.h 2004-06-07 12:55:05.104709282 -0700 @@ -8,17 +8,13 @@ static void init_hwif_rz1000(ide_hwif_t *); static ide_pci_device_t rz1000_chipsets[] __devinitdata = { -{ - .vendor = PCI_VENDOR_ID_PCTECH, - .device = PCI_DEVICE_ID_PCTECH_RZ1000, + { .name = "RZ1000", .init_hwif = init_hwif_rz1000, .channels = 2, .autodma = NODMA, .bootable = ON_BOARD, },{ - .vendor = PCI_VENDOR_ID_PCTECH, - .device = PCI_DEVICE_ID_PCTECH_RZ1001, .name = "RZ1001", .init_hwif = init_hwif_rz1000, .channels = 2, diff -urN linux-2.6.7-rc2/drivers/ide/pci/sc1200.c linux-2.6.7-rc3/drivers/ide/pci/sc1200.c --- linux-2.6.7-rc2/drivers/ide/pci/sc1200.c 2004-05-09 19:32:39.000000000 -0700 +++ linux-2.6.7-rc3/drivers/ide/pci/sc1200.c 2004-06-07 12:55:05.105709324 -0700 @@ -547,10 +547,7 @@ static int __devinit sc1200_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_pci_device_t *d = &sc1200_chipsets[id->driver_data]; - if (dev->device != d->device) - BUG(); - ide_setup_pci_device(dev, d); + ide_setup_pci_device(dev, &sc1200_chipsets[id->driver_data]); return 0; } diff -urN linux-2.6.7-rc2/drivers/ide/pci/sc1200.h linux-2.6.7-rc3/drivers/ide/pci/sc1200.h --- linux-2.6.7-rc2/drivers/ide/pci/sc1200.h 2004-06-07 12:54:49.005042489 -0700 +++ linux-2.6.7-rc3/drivers/ide/pci/sc1200.h 2004-06-07 12:55:05.105709324 -0700 @@ -12,8 +12,6 @@ static ide_pci_device_t sc1200_chipsets[] __devinitdata = { { /* 0 */ - .vendor = PCI_VENDOR_ID_NS, - .device = PCI_DEVICE_ID_NS_SCx200_IDE, .name = "SC1200", .init_chipset = init_chipset_sc1200, .init_hwif = init_hwif_sc1200, diff -urN linux-2.6.7-rc2/drivers/ide/pci/serverworks.c linux-2.6.7-rc3/drivers/ide/pci/serverworks.c --- linux-2.6.7-rc2/drivers/ide/pci/serverworks.c 2004-05-09 19:31:59.000000000 -0700 +++ linux-2.6.7-rc3/drivers/ide/pci/serverworks.c 2004-06-07 12:55:05.106709365 -0700 @@ -777,8 +777,8 @@ d->autodma = AUTODMA; #endif - d->channels = (((d->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE) || - (d->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2)) && + d->channels = ((dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE || + dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2) && (!(PCI_FUNC(dev->devfn) & 1))) ? 1 : 2; ide_setup_pci_device(dev, d); @@ -798,8 +798,6 @@ { ide_pci_device_t *d = &serverworks_chipsets[id->driver_data]; - if (dev->device != d->device) - BUG(); d->init_setup(dev, d); return 0; } diff -urN linux-2.6.7-rc2/drivers/ide/pci/serverworks.h linux-2.6.7-rc3/drivers/ide/pci/serverworks.h --- linux-2.6.7-rc2/drivers/ide/pci/serverworks.h 2004-06-07 12:54:49.006042530 -0700 +++ linux-2.6.7-rc3/drivers/ide/pci/serverworks.h 2004-06-07 12:55:05.106709365 -0700 @@ -31,8 +31,6 @@ static ide_pci_device_t serverworks_chipsets[] __devinitdata = { { /* 0 */ - .vendor = PCI_VENDOR_ID_SERVERWORKS, - .device = PCI_DEVICE_ID_SERVERWORKS_OSB4IDE, .name = "SvrWks OSB4", .init_setup = init_setup_svwks, .init_chipset = init_chipset_svwks, @@ -41,8 +39,6 @@ .autodma = AUTODMA, .bootable = ON_BOARD, },{ /* 1 */ - .vendor = PCI_VENDOR_ID_SERVERWORKS, - .device = PCI_DEVICE_ID_SERVERWORKS_CSB5IDE, .name = "SvrWks CSB5", .init_setup = init_setup_svwks, .init_chipset = init_chipset_svwks, @@ -52,8 +48,6 @@ .autodma = AUTODMA, .bootable = ON_BOARD, },{ /* 2 */ - .vendor = PCI_VENDOR_ID_SERVERWORKS, - .device = PCI_DEVICE_ID_SERVERWORKS_CSB6IDE, .name = "SvrWks CSB6", .init_setup = init_setup_csb6, .init_chipset = init_chipset_svwks, @@ -63,8 +57,6 @@ .autodma = AUTODMA, .bootable = ON_BOARD, },{ /* 3 */ - .vendor = PCI_VENDOR_ID_SERVERWORKS, - .device = PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2, .name = "SvrWks CSB6", .init_setup = init_setup_csb6, .init_chipset = init_chipset_svwks, diff -urN linux-2.6.7-rc2/drivers/ide/pci/sgiioc4.c linux-2.6.7-rc3/drivers/ide/pci/sgiioc4.c --- linux-2.6.7-rc2/drivers/ide/pci/sgiioc4.c 2004-05-09 19:32:37.000000000 -0700 +++ linux-2.6.7-rc3/drivers/ide/pci/sgiioc4.c 2004-06-07 12:55:05.107709407 -0700 @@ -757,8 +757,6 @@ static ide_pci_device_t sgiioc4_chipsets[] __devinitdata = { { /* Channel 0 */ - .vendor = PCI_VENDOR_ID_SGI, - .device = PCI_DEVICE_ID_SGI_IOC4, .name = "SGIIOC4", .init_hwif = ide_init_sgiioc4, .init_dma = ide_dma_sgiioc4, @@ -772,16 +770,7 @@ static int __devinit sgiioc4_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_pci_device_t *d = &sgiioc4_chipsets[id->driver_data]; - if (dev->device != d->device) { - printk(KERN_ERR "Error in %s(dev 0x%p | id 0x%p )\n", - __FUNCTION__, (void *) dev, (void *) id); - BUG(); - } - - if (pci_init_sgiioc4(dev, d)) - return 0; - + pci_init_sgiioc4(dev, &sgiioc4_chipsets[id->driver_data]); return 0; } diff -urN linux-2.6.7-rc2/drivers/ide/pci/siimage.c linux-2.6.7-rc3/drivers/ide/pci/siimage.c --- linux-2.6.7-rc2/drivers/ide/pci/siimage.c 2004-05-09 19:32:28.000000000 -0700 +++ linux-2.6.7-rc3/drivers/ide/pci/siimage.c 2004-06-07 12:55:05.108709448 -0700 @@ -21,7 +21,6 @@ * if neccessary */ -#include #include #include #include @@ -34,15 +33,6 @@ #include "siimage.h" -#if defined(DISPLAY_SIIMAGE_TIMINGS) && defined(CONFIG_PROC_FS) -#include - -static u8 siimage_proc = 0; -#define SIIMAGE_MAX_DEVS 16 -static struct pci_dev *siimage_devs[SIIMAGE_MAX_DEVS]; -static int n_siimage_devs; -#endif /* defined(DISPLAY_SIIMAGE_TIMINGS) && defined(CONFIG_PROC_FS) */ - /** * pdev_is_sata - check if device is SATA * @pdev: PCI device to check @@ -121,67 +111,6 @@ return base; } -#if defined(DISPLAY_SIIMAGE_TIMINGS) && defined(CONFIG_PROC_FS) -/** - * print_siimage_get_info - print minimal proc information - * @buf: buffer to write into (kernel space) - * @dev: PCI device we are describing - * @index: Controller number - * - * Print the basic information for the state of the CMD680/SI3112 - * channel. We don't actually dump a lot of information out for - * this controller although we could expand it if we needed. - */ - -static char *print_siimage_get_info (char *buf, struct pci_dev *dev, int index) -{ - char *p = buf; - u8 mmio = (pci_get_drvdata(dev) != NULL) ? 1 : 0; - unsigned long bmdma = pci_resource_start(dev, 4); - - if(mmio) - bmdma = pci_resource_start(dev, 5); - - p += sprintf(p, "\nController: %d\n", index); - p += sprintf(p, "SiI%x Chipset.\n", dev->device); - if (mmio) - p += sprintf(p, "MMIO Base 0x%lx\n", bmdma); - p += sprintf(p, "%s-DMA Base 0x%lx\n", (mmio)?"MMIO":"BM", bmdma); - p += sprintf(p, "%s-DMA Base 0x%lx\n", (mmio)?"MMIO":"BM", bmdma+8); - return (char *)p; -} - -/** - * siimage_get_info - proc callback - * @buffer: kernel buffer to complete - * @addr: written with base of data to return - * offset: seek offset - * count: bytes to fill in - * - * Called when the user reads data from the virtual file for this - * controller from /proc - */ - -static int siimage_get_info (char *buffer, char **addr, off_t offset, int count) -{ - char *p = buffer; - int len; - u16 i; - - p += sprintf(p, "\n"); - for (i = 0; i < n_siimage_devs; i++) { - struct pci_dev *dev = siimage_devs[i]; - p = print_siimage_get_info(p, dev, i); - } - /* p - buffer must be less than 4k! */ - len = (p - buffer) - offset; - *addr = buffer + offset; - - return len > count ? count : len; -} - -#endif /* defined(DISPLAY_SIIMAGE_TIMINGS) && defined(CONFIG_PROC_FS) */ - /** * siimage_ratemask - Compute available modes * @drive: IDE drive @@ -779,15 +708,6 @@ case 0x00: printk("== 100\n"); break; } } - -#if defined(DISPLAY_SIIMAGE_TIMINGS) && defined(CONFIG_PROC_FS) - siimage_devs[n_siimage_devs++] = dev; - - if (!siimage_proc) { - siimage_proc = 1; - ide_pci_create_host_proc("siimage", siimage_get_info); - } -#endif /* DISPLAY_SIIMAGE_TIMINGS && CONFIG_PROC_FS */ } /** @@ -1183,10 +1103,7 @@ static int __devinit siimage_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_pci_device_t *d = &siimage_chipsets[id->driver_data]; - if (dev->device != d->device) - BUG(); - ide_setup_pci_device(dev, d); + ide_setup_pci_device(dev, &siimage_chipsets[id->driver_data]); return 0; } diff -urN linux-2.6.7-rc2/drivers/ide/pci/siimage.h linux-2.6.7-rc3/drivers/ide/pci/siimage.h --- linux-2.6.7-rc2/drivers/ide/pci/siimage.h 2004-06-07 12:54:49.006042530 -0700 +++ linux-2.6.7-rc3/drivers/ide/pci/siimage.h 2004-06-07 12:55:05.108709448 -0700 @@ -1,14 +1,11 @@ #ifndef SIIMAGE_H #define SIIMAGE_H -#include #include #include #include -#define DISPLAY_SIIMAGE_TIMINGS - #undef SIIMAGE_VIRTUAL_DMAPIO #undef SIIMAGE_BUFFERED_TASKFILE #undef SIIMAGE_LARGE_DMA @@ -27,8 +24,6 @@ static ide_pci_device_t siimage_chipsets[] __devinitdata = { { /* 0 */ - .vendor = PCI_VENDOR_ID_CMD, - .device = PCI_DEVICE_ID_SII_680, .name = "SiI680", .init_chipset = init_chipset_siimage, .init_iops = init_iops_siimage, @@ -37,8 +32,6 @@ .autodma = AUTODMA, .bootable = ON_BOARD, },{ /* 1 */ - .vendor = PCI_VENDOR_ID_CMD, - .device = PCI_DEVICE_ID_SII_3112, .name = "SiI3112 Serial ATA", .init_chipset = init_chipset_siimage, .init_iops = init_iops_siimage, @@ -47,8 +40,6 @@ .autodma = AUTODMA, .bootable = ON_BOARD, },{ /* 2 */ - .vendor = PCI_VENDOR_ID_CMD, - .device = PCI_DEVICE_ID_SII_1210SA, .name = "Adaptec AAR-1210SA", .init_chipset = init_chipset_siimage, .init_iops = init_iops_siimage, diff -urN linux-2.6.7-rc2/drivers/ide/pci/sis5513.c linux-2.6.7-rc3/drivers/ide/pci/sis5513.c --- linux-2.6.7-rc2/drivers/ide/pci/sis5513.c 2004-05-09 19:32:37.000000000 -0700 +++ linux-2.6.7-rc3/drivers/ide/pci/sis5513.c 2004-06-07 12:55:05.109709490 -0700 @@ -946,10 +946,7 @@ static int __devinit sis5513_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_pci_device_t *d = &sis5513_chipsets[id->driver_data]; - if (dev->device != d->device) - BUG(); - ide_setup_pci_device(dev, d); + ide_setup_pci_device(dev, &sis5513_chipsets[id->driver_data]); return 0; } diff -urN linux-2.6.7-rc2/drivers/ide/pci/sis5513.h linux-2.6.7-rc3/drivers/ide/pci/sis5513.h --- linux-2.6.7-rc2/drivers/ide/pci/sis5513.h 2004-06-07 12:54:49.006042530 -0700 +++ linux-2.6.7-rc3/drivers/ide/pci/sis5513.h 2004-06-07 12:55:05.109709490 -0700 @@ -12,8 +12,6 @@ static ide_pci_device_t sis5513_chipsets[] __devinitdata = { { /* 0 */ - .vendor = PCI_VENDOR_ID_SI, - .device = PCI_DEVICE_ID_SI_5513, .name = "SIS5513", .init_chipset = init_chipset_sis5513, .init_hwif = init_hwif_sis5513, diff -urN linux-2.6.7-rc2/drivers/ide/pci/sl82c105.c linux-2.6.7-rc3/drivers/ide/pci/sl82c105.c --- linux-2.6.7-rc2/drivers/ide/pci/sl82c105.c 2004-05-09 19:32:27.000000000 -0700 +++ linux-2.6.7-rc3/drivers/ide/pci/sl82c105.c 2004-06-07 12:55:05.109709490 -0700 @@ -483,10 +483,7 @@ static int __devinit sl82c105_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_pci_device_t *d = &sl82c105_chipsets[id->driver_data]; - if (dev->device != d->device) - BUG(); - ide_setup_pci_device(dev, d); + ide_setup_pci_device(dev, &sl82c105_chipsets[id->driver_data]); return 0; } diff -urN linux-2.6.7-rc2/drivers/ide/pci/sl82c105.h linux-2.6.7-rc3/drivers/ide/pci/sl82c105.h --- linux-2.6.7-rc2/drivers/ide/pci/sl82c105.h 2004-06-07 12:54:49.006042530 -0700 +++ linux-2.6.7-rc3/drivers/ide/pci/sl82c105.h 2004-06-07 12:55:05.110709531 -0700 @@ -11,8 +11,6 @@ static ide_pci_device_t sl82c105_chipsets[] __devinitdata = { { /* 0 */ - .vendor = PCI_VENDOR_ID_WINBOND, - .device = PCI_DEVICE_ID_WINBOND_82C105, .name = "W82C105", .init_chipset = init_chipset_sl82c105, .init_hwif = init_hwif_sl82c105, diff -urN linux-2.6.7-rc2/drivers/ide/pci/slc90e66.c linux-2.6.7-rc3/drivers/ide/pci/slc90e66.c --- linux-2.6.7-rc2/drivers/ide/pci/slc90e66.c 2004-05-09 19:33:10.000000000 -0700 +++ linux-2.6.7-rc3/drivers/ide/pci/slc90e66.c 2004-06-07 12:55:05.110709531 -0700 @@ -366,10 +366,7 @@ static int __devinit slc90e66_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_pci_device_t *d = &slc90e66_chipsets[id->driver_data]; - if (dev->device != d->device) - BUG(); - ide_setup_pci_device(dev, d); + ide_setup_pci_device(dev, &slc90e66_chipsets[id->driver_data]); return 0; } diff -urN linux-2.6.7-rc2/drivers/ide/pci/slc90e66.h linux-2.6.7-rc3/drivers/ide/pci/slc90e66.h --- linux-2.6.7-rc2/drivers/ide/pci/slc90e66.h 2004-06-07 12:54:49.007042571 -0700 +++ linux-2.6.7-rc3/drivers/ide/pci/slc90e66.h 2004-06-07 12:55:05.110709531 -0700 @@ -14,8 +14,6 @@ static ide_pci_device_t slc90e66_chipsets[] __devinitdata = { { /* 0 */ - .vendor = PCI_VENDOR_ID_EFAR, - .device = PCI_DEVICE_ID_EFAR_SLC90E66_1, .name = "SLC90E66", .init_chipset = init_chipset_slc90e66, .init_hwif = init_hwif_slc90e66, diff -urN linux-2.6.7-rc2/drivers/ide/pci/triflex.c linux-2.6.7-rc3/drivers/ide/pci/triflex.c --- linux-2.6.7-rc2/drivers/ide/pci/triflex.c 2004-05-09 19:32:27.000000000 -0700 +++ linux-2.6.7-rc3/drivers/ide/pci/triflex.c 2004-06-07 12:55:05.111709572 -0700 @@ -220,13 +220,9 @@ static int __devinit triflex_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_pci_device_t *d = &triflex_devices[id->driver_data]; - if (dev->device != d->device) - BUG(); - - ide_setup_pci_device(dev, d); + ide_setup_pci_device(dev, &triflex_devices[id->driver_data]); triflex_dev = dev; - + return 0; } diff -urN linux-2.6.7-rc2/drivers/ide/pci/triflex.h linux-2.6.7-rc3/drivers/ide/pci/triflex.h --- linux-2.6.7-rc2/drivers/ide/pci/triflex.h 2004-06-07 12:54:49.007042571 -0700 +++ linux-2.6.7-rc3/drivers/ide/pci/triflex.h 2004-06-07 12:55:05.111709572 -0700 @@ -17,8 +17,6 @@ static ide_pci_device_t triflex_devices[] __devinitdata = { { - .vendor = PCI_VENDOR_ID_COMPAQ, - .device = PCI_DEVICE_ID_COMPAQ_TRIFLEX_IDE, .name = "TRIFLEX", .init_chipset = init_chipset_triflex, .init_hwif = init_hwif_triflex, diff -urN linux-2.6.7-rc2/drivers/ide/pci/trm290.c linux-2.6.7-rc3/drivers/ide/pci/trm290.c --- linux-2.6.7-rc2/drivers/ide/pci/trm290.c 2004-05-09 19:32:26.000000000 -0700 +++ linux-2.6.7-rc3/drivers/ide/pci/trm290.c 2004-06-07 12:55:05.111709572 -0700 @@ -397,10 +397,7 @@ static int __devinit trm290_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_pci_device_t *d = &trm290_chipsets[id->driver_data]; - if (dev->device != d->device) - BUG(); - ide_setup_pci_device(dev, d); + ide_setup_pci_device(dev, &trm290_chipsets[id->driver_data]); return 0; } diff -urN linux-2.6.7-rc2/drivers/ide/pci/trm290.h linux-2.6.7-rc3/drivers/ide/pci/trm290.h --- linux-2.6.7-rc2/drivers/ide/pci/trm290.h 2004-06-07 12:54:49.007042571 -0700 +++ linux-2.6.7-rc3/drivers/ide/pci/trm290.h 2004-06-07 12:55:05.112709614 -0700 @@ -9,8 +9,6 @@ static ide_pci_device_t trm290_chipsets[] __devinitdata = { { /* 0 */ - .vendor = PCI_VENDOR_ID_TEKRAM, - .device = PCI_DEVICE_ID_TEKRAM_DC290, .name = "TRM290", .init_hwif = init_hwif_trm290, .channels = 2, diff -urN linux-2.6.7-rc2/drivers/ide/pci/via82cxxx.c linux-2.6.7-rc3/drivers/ide/pci/via82cxxx.c --- linux-2.6.7-rc2/drivers/ide/pci/via82cxxx.c 2004-05-09 19:31:57.000000000 -0700 +++ linux-2.6.7-rc3/drivers/ide/pci/via82cxxx.c 2004-06-07 12:55:05.117709821 -0700 @@ -609,16 +609,13 @@ static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_pci_device_t *d = &via82cxxx_chipsets[id->driver_data]; - if (dev->device != d->device) - BUG(); - ide_setup_pci_device(dev, d); + ide_setup_pci_device(dev, &via82cxxx_chipsets[id->driver_data]); return 0; } static struct pci_device_id via_pci_tbl[] = { { PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C576_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, - { PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1}, + { PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { 0, }, }; MODULE_DEVICE_TABLE(pci, via_pci_tbl); diff -urN linux-2.6.7-rc2/drivers/ide/pci/via82cxxx.h linux-2.6.7-rc3/drivers/ide/pci/via82cxxx.h --- linux-2.6.7-rc2/drivers/ide/pci/via82cxxx.h 2004-06-07 12:54:49.007042571 -0700 +++ linux-2.6.7-rc3/drivers/ide/pci/via82cxxx.h 2004-06-07 12:55:05.118709862 -0700 @@ -12,18 +12,6 @@ static ide_pci_device_t via82cxxx_chipsets[] __devinitdata = { { /* 0 */ - .vendor = PCI_VENDOR_ID_VIA, - .device = PCI_DEVICE_ID_VIA_82C576_1, - .name = "VP_IDE", - .init_chipset = init_chipset_via82cxxx, - .init_hwif = init_hwif_via82cxxx, - .channels = 2, - .autodma = NOAUTODMA, - .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, - .bootable = ON_BOARD, - },{ /* 1 */ - .vendor = PCI_VENDOR_ID_VIA, - .device = PCI_DEVICE_ID_VIA_82C586_1, .name = "VP_IDE", .init_chipset = init_chipset_via82cxxx, .init_hwif = init_hwif_via82cxxx, diff -urN linux-2.6.7-rc2/drivers/ide/setup-pci.c linux-2.6.7-rc3/drivers/ide/setup-pci.c --- linux-2.6.7-rc2/drivers/ide/setup-pci.c 2004-06-07 12:54:49.010042696 -0700 +++ linux-2.6.7-rc3/drivers/ide/setup-pci.c 2004-06-07 12:55:05.120709945 -0700 @@ -285,14 +285,8 @@ void ide_setup_pci_noise (struct pci_dev *dev, ide_pci_device_t *d) { - if ((d->vendor != dev->vendor) && (d->device != dev->device)) { - printk(KERN_INFO "%s: unknown IDE controller at PCI slot " - "%s, VID=%04x, DID=%04x\n", - d->name, pci_name(dev), dev->vendor, dev->device); - } else { - printk(KERN_INFO "%s: IDE controller at PCI slot %s\n", - d->name, pci_name(dev)); - } + printk(KERN_INFO "%s: IDE controller at PCI slot %s\n", + d->name, pci_name(dev)); } EXPORT_SYMBOL_GPL(ide_setup_pci_noise); @@ -422,8 +416,7 @@ unsigned long ctl = 0, base = 0; ide_hwif_t *hwif; - if(!d->isa_ports) - { + if ((d->flags & IDEPCI_FLAG_ISA_PORTS) == 0) { /* Possibly we should fail if these checks report true */ ide_pci_check_iomem(dev, d, 2*port); ide_pci_check_iomem(dev, d, 2*port+1); @@ -495,9 +488,7 @@ * Set up BM-DMA capability * (PnP BIOS should have done this) */ - if (!((d->device == PCI_DEVICE_ID_CYRIX_5530_IDE && d->vendor == PCI_VENDOR_ID_CYRIX) - ||(d->device == PCI_DEVICE_ID_NS_SCx200_IDE && d->vendor == PCI_VENDOR_ID_NS))) - { + if ((d->flags & IDEPCI_FLAG_FORCE_MASTER) == 0) { /* * default DMA off if we had to * configure it here @@ -613,9 +604,7 @@ * by the bios for raid purposes. * Skip the normal "is it enabled" test for those. */ - if (((d->vendor == PCI_VENDOR_ID_PROMISE) && - ((d->device == PCI_DEVICE_ID_PROMISE_20262) || - (d->device == PCI_DEVICE_ID_PROMISE_20265))) && + if ((d->flags & IDEPCI_FLAG_FORCE_PDC) && (secondpdc++==1) && (port==1)) goto controller_ok; diff -urN linux-2.6.7-rc2/drivers/ieee1394/eth1394.c linux-2.6.7-rc3/drivers/ieee1394/eth1394.c --- linux-2.6.7-rc2/drivers/ieee1394/eth1394.c 2004-05-09 19:32:52.000000000 -0700 +++ linux-2.6.7-rc3/drivers/ieee1394/eth1394.c 2004-06-07 12:55:05.283716697 -0700 @@ -191,7 +191,7 @@ static void ether1394_iso(struct hpsb_iso *iso); static int ether1394_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); -static int ether1394_ethtool_ioctl(struct net_device *dev, void *useraddr); +static int ether1394_ethtool_ioctl(struct net_device *dev, void __user *useraddr); static int ether1394_write(struct hpsb_host *host, int srcid, int destid, quadlet_t *data, u64 addr, size_t len, u16 flags); @@ -1770,7 +1770,7 @@ { switch(cmd) { case SIOCETHTOOL: - return ether1394_ethtool_ioctl(dev, (void *) ifr->ifr_data); + return ether1394_ethtool_ioctl(dev, ifr->ifr_data); case SIOCGMIIPHY: /* Get address of MII PHY in use. */ case SIOCGMIIREG: /* Read MII PHY register. */ @@ -1782,11 +1782,11 @@ return 0; } -static int ether1394_ethtool_ioctl(struct net_device *dev, void *useraddr) +static int ether1394_ethtool_ioctl(struct net_device *dev, void __user *useraddr) { u32 ethcmd; - if (get_user(ethcmd, (u32 *)useraddr)) + if (get_user(ethcmd, (u32 __user *)useraddr)) return -EFAULT; switch (ethcmd) { diff -urN linux-2.6.7-rc2/drivers/input/Kconfig linux-2.6.7-rc3/drivers/input/Kconfig --- linux-2.6.7-rc2/drivers/input/Kconfig 2004-05-09 19:32:00.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/Kconfig 2004-06-07 12:55:05.539727300 -0700 @@ -41,9 +41,16 @@ module will be called mousedev. config INPUT_MOUSEDEV_PSAUX - bool "Provide legacy /dev/psaux device" if EMBEDDED + bool "Provide legacy /dev/psaux device" default y depends on INPUT_MOUSEDEV + ---help--- + Say Y here if you want your mouse also be accessible as char device + 10:1 - /dev/psaux. The data available through /dev/psaux is exactly + the same as the data from /dev/input/mice. + + If unsure, say Y. + config INPUT_MOUSEDEV_SCREEN_X int "Horizontal screen resolution" diff -urN linux-2.6.7-rc2/drivers/input/evbug.c linux-2.6.7-rc3/drivers/input/evbug.c --- linux-2.6.7-rc2/drivers/input/evbug.c 2004-05-09 19:32:28.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/evbug.c 2004-06-07 12:55:05.540727341 -0700 @@ -11,18 +11,18 @@ /* * 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 + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * 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 * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * 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 , or by paper mail: * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic @@ -35,7 +35,7 @@ #include MODULE_AUTHOR("Vojtech Pavlik "); -MODULE_DESCRIPTION("Input driver event debug module"); +MODULE_DESCRIPTION("Input driver event debug module"); MODULE_LICENSE("GPL"); static char evbug_name[] = "evbug"; @@ -67,7 +67,7 @@ static void evbug_disconnect(struct input_handle *handle) { printk(KERN_DEBUG "evbug.c: Disconnected device: %s\n", handle->dev->phys); - + input_close_device(handle); kfree(handle); @@ -79,7 +79,7 @@ }; MODULE_DEVICE_TABLE(input, evbug_ids); - + static struct input_handler evbug_handler = { .event = evbug_event, .connect = evbug_connect, diff -urN linux-2.6.7-rc2/drivers/input/evdev.c linux-2.6.7-rc3/drivers/input/evdev.c --- linux-2.6.7-rc2/drivers/input/evdev.c 2004-06-07 12:54:49.017042986 -0700 +++ linux-2.6.7-rc3/drivers/input/evdev.c 2004-06-07 12:55:05.542727424 -0700 @@ -126,7 +126,7 @@ int i = iminor(inode) - EVDEV_MINOR_BASE; int accept_err; - if (i >= EVDEV_MINORS || !evdev_table[i]) + if (i >= EVDEV_MINORS || !evdev_table[i] || !evdev_table[i]->exist) return -ENODEV; if ((accept_err = input_accept_process(&(evdev_table[i]->handle), file))) @@ -175,7 +175,7 @@ return -EAGAIN; retval = wait_event_interruptible(list->evdev->wait, - list->head != list->tail && list->evdev->exist); + list->head != list->tail || (!list->evdev->exist)); if (retval) return retval; @@ -222,7 +222,7 @@ case EVIOCGID: return copy_to_user(p, &dev->id, sizeof(struct input_id)) ? -EFAULT : 0; - + case EVIOCGKEYCODE: if (get_user(t, ip)) return -EFAULT; if (t < 0 || t > dev->keycodemax || !dev->keycodesize) return -EINVAL; @@ -430,7 +430,7 @@ devfs_mk_cdev(MKDEV(INPUT_MAJOR, EVDEV_MINOR_BASE + minor), S_IFCHR|S_IRUGO|S_IWUSR, "input/event%d", minor); - class_simple_device_add(input_class, + class_simple_device_add(input_class, MKDEV(INPUT_MAJOR, EVDEV_MINOR_BASE + minor), dev->dev, "event%d", minor); diff -urN linux-2.6.7-rc2/drivers/input/gameport/cs461x.c linux-2.6.7-rc3/drivers/input/gameport/cs461x.c --- linux-2.6.7-rc2/drivers/input/gameport/cs461x.c 2004-05-09 19:31:59.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/gameport/cs461x.c 2004-06-07 12:55:05.547727631 -0700 @@ -1,8 +1,8 @@ /* - The all defines and part of code (such as cs461x_*) are - contributed from ALSA 0.5.8 sources. + The all defines and part of code (such as cs461x_*) are + contributed from ALSA 0.5.8 sources. See http://www.alsa-project.org/ for sources - + Tested on Linux 686 2.4.0-test9, ALSA 0.5.8a and CS4610 */ @@ -89,8 +89,8 @@ #define JSIO_BXOE 0x00000040 #define JSIO_BYOE 0x00000080 -/* - The card initialization code is obfuscated; the module cs461x +/* + The card initialization code is obfuscated; the module cs461x need to be loaded after ALSA modules initialized and something played on the CS 4610 chip (see sources for details of CS4610 initialization code from ALSA) @@ -112,7 +112,7 @@ #define BA1_DWORD_SIZE (13 * 1024 + 512) #define BA1_MEMORY_COUNT 3 -/* +/* Only one CS461x card is still suppoted; the code requires redesign to avoid this limitatuion. */ @@ -163,7 +163,7 @@ if(port){ gameport_unregister_port(port); kfree(port); - } + } if (ba0) iounmap(ba0); #ifdef CS461X_FULL_MAP if (ba1.name.data0) iounmap(ba1.name.data0); @@ -187,13 +187,13 @@ static int cs461x_gameport_cooked_read(struct gameport *gameport, int *axes, int *buttons) { unsigned js1, js2, jst; - + js1 = cs461x_peekBA0(BA0_JSC1); js2 = cs461x_peekBA0(BA0_JSC2); jst = cs461x_peekBA0(BA0_JSPT); - - *buttons = (~jst >> 4) & 0x0F; - + + *buttons = (~jst >> 4) & 0x0F; + axes[0] = ((js1 & JSC1_Y1V_MASK) >> JSC1_Y1V_SHIFT) & 0xFFFF; axes[1] = ((js1 & JSC1_X1V_MASK) >> JSC1_X1V_SHIFT) & 0xFFFF; axes[2] = ((js2 & JSC2_Y2V_MASK) >> JSC2_Y2V_SHIFT) & 0xFFFF; @@ -228,7 +228,7 @@ { int rc; struct gameport* port; - + rc = pci_enable_device(pdev); if (rc) { printk(KERN_ERR "cs461x: Cannot enable PCI gameport (bus %d, devfn %d) error=%d\n", @@ -240,7 +240,7 @@ #ifdef CS461X_FULL_MAP ba1_addr = pci_resource_start(pdev, 1); #endif - if (ba0_addr == 0 || ba0_addr == ~0 + if (ba0_addr == 0 || ba0_addr == ~0 #ifdef CS461X_FULL_MAP || ba1_addr == 0 || ba1_addr == ~0 #endif @@ -281,7 +281,7 @@ memset(port, 0, sizeof(struct gameport)); pci_set_drvdata(pdev, port); - + port->open = cs461x_gameport_open; port->trigger = cs461x_gameport_trigger; port->read = cs461x_gameport_read; @@ -310,7 +310,7 @@ { cs461x_free(pdev); } - + static struct pci_driver cs461x_pci_driver = { .name = "CS461x Gameport", .id_table = cs461x_pci_tbl, diff -urN linux-2.6.7-rc2/drivers/input/gameport/emu10k1-gp.c linux-2.6.7-rc3/drivers/input/gameport/emu10k1-gp.c --- linux-2.6.7-rc2/drivers/input/gameport/emu10k1-gp.c 2004-05-09 19:32:39.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/gameport/emu10k1-gp.c 2004-06-07 12:55:05.547727631 -0700 @@ -11,18 +11,18 @@ /* * 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 + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * 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 * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * 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 , or by paper mail: * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic @@ -48,7 +48,7 @@ int size; char phys[32]; }; - + static struct pci_device_id emu_tbl[] = { { 0x1102, 0x7002, PCI_ANY_ID, PCI_ANY_ID }, /* SB Live gameport */ { 0x1102, 0x7003, PCI_ANY_ID, PCI_ANY_ID }, /* Audigy gameport */ @@ -61,7 +61,7 @@ { int ioport, iolen; struct emu *emu; - + if (pci_enable_device(pdev)) return -EBUSY; diff -urN linux-2.6.7-rc2/drivers/input/gameport/fm801-gp.c linux-2.6.7-rc3/drivers/input/gameport/fm801-gp.c --- linux-2.6.7-rc2/drivers/input/gameport/fm801-gp.c 2004-05-09 19:32:38.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/gameport/fm801-gp.c 2004-06-07 12:55:05.547727631 -0700 @@ -111,7 +111,7 @@ pci_set_drvdata(pci, gp); - outb(0x60, gp->gameport.io + 0x0d); /* enable joystick 1 and 2 */ + outb(0x60, gp->gameport.io + 0x0d); /* enable joystick 1 and 2 */ gameport_register_port(&gp->gameport); diff -urN linux-2.6.7-rc2/drivers/input/gameport/gameport.c linux-2.6.7-rc3/drivers/input/gameport/gameport.c --- linux-2.6.7-rc2/drivers/input/gameport/gameport.c 2004-05-09 19:32:37.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/gameport/gameport.c 2004-06-07 12:55:05.547727631 -0700 @@ -168,7 +168,7 @@ return -1; gameport->dev = dev; - + return 0; } diff -urN linux-2.6.7-rc2/drivers/input/gameport/lightning.c linux-2.6.7-rc3/drivers/input/gameport/lightning.c --- linux-2.6.7-rc2/drivers/input/gameport/lightning.c 2004-05-09 19:32:27.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/gameport/lightning.c 2004-06-07 12:55:05.548727673 -0700 @@ -11,18 +11,18 @@ /* * 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 + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * 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 * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * 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 , or by paper mail: * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic @@ -106,7 +106,7 @@ result = 0; -fail: outb(L4_SELECT_ANALOG, L4_PORT); +fail: outb(L4_SELECT_ANALOG, L4_PORT); return result; } @@ -126,7 +126,7 @@ static int l4_getcal(int port, int *cal) { int i, result = -1; - + outb(L4_SELECT_ANALOG, L4_PORT); outb(L4_SELECT_DIGITAL + (port >> 2), L4_PORT); @@ -208,7 +208,7 @@ return 0; } - + static int __init l4_init(void) { int cal[4] = {255,255,255,255}; @@ -266,7 +266,7 @@ if (rev > 0x28) /* on 2.9+ the setcal command works correctly */ l4_setcal(l4->port, cal); - + gameport_register_port(gameport); } diff -urN linux-2.6.7-rc2/drivers/input/gameport/ns558.c linux-2.6.7-rc3/drivers/input/gameport/ns558.c --- linux-2.6.7-rc2/drivers/input/gameport/ns558.c 2004-06-07 12:54:49.017042986 -0700 +++ linux-2.6.7-rc3/drivers/input/gameport/ns558.c 2004-06-07 12:55:05.548727673 -0700 @@ -12,18 +12,18 @@ /* * 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 + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * 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 * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * 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 , or by paper mail: * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic @@ -59,7 +59,7 @@ char phys[32]; char name[32]; }; - + static LIST_HEAD(ns558_list); /* @@ -116,7 +116,7 @@ i = 0; goto out; } -/* +/* * And now find the number of mirrors of the port. */ @@ -292,7 +292,7 @@ release_region(port->gameport.io & ~(port->size - 1), port->size); kfree(port); break; - + default: break; } diff -urN linux-2.6.7-rc2/drivers/input/gameport/vortex.c linux-2.6.7-rc3/drivers/input/gameport/vortex.c --- linux-2.6.7-rc2/drivers/input/gameport/vortex.c 2004-06-07 12:54:49.018043027 -0700 +++ linux-2.6.7-rc3/drivers/input/gameport/vortex.c 2004-06-07 12:55:05.549727714 -0700 @@ -83,7 +83,7 @@ axes[i] = readw(vortex->io + VORTEX_AXD + i * sizeof(u32)); if (axes[i] == 0x1fff) axes[i] = -1; } - + return 0; } @@ -122,7 +122,7 @@ vortex->gameport.driver = vortex; vortex->gameport.fuzz = 64; - + vortex->gameport.read = vortex_read; vortex->gameport.trigger = vortex_trigger; vortex->gameport.cooked_read = vortex_cooked_read; @@ -145,7 +145,7 @@ vortex->io = vortex->base + id->driver_data; gameport_register_port(&vortex->gameport); - + printk(KERN_INFO "gameport at pci%s speed %d kHz\n", pci_name(dev), vortex->gameport.speed); diff -urN linux-2.6.7-rc2/drivers/input/input.c linux-2.6.7-rc3/drivers/input/input.c --- linux-2.6.7-rc2/drivers/input/input.c 2004-05-09 19:32:38.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/input.c 2004-06-07 12:55:05.550727756 -0700 @@ -106,7 +106,7 @@ } break; - + case EV_ABS: if (code > ABS_MAX || !test_bit(code, dev->absbit)) @@ -144,27 +144,27 @@ if (code > MSC_MAX || !test_bit(code, dev->mscbit)) return; - if (dev->event) dev->event(dev, type, code, value); - + if (dev->event) dev->event(dev, type, code, value); + break; case EV_LED: - + if (code > LED_MAX || !test_bit(code, dev->ledbit) || !!test_bit(code, dev->led) == value) return; change_bit(code, dev->led); - if (dev->event) dev->event(dev, type, code, value); - + if (dev->event) dev->event(dev, type, code, value); + break; case EV_SND: - + if (code > SND_MAX || !test_bit(code, dev->sndbit)) return; - if (dev->event) dev->event(dev, type, code, value); - + if (dev->event) dev->event(dev, type, code, value); + break; case EV_REP: @@ -181,7 +181,7 @@ break; } - if (type != EV_SYN) + if (type != EV_SYN) dev->sync = 0; if (dev->grab) @@ -282,11 +282,11 @@ if (id->flags & INPUT_DEVICE_ID_MATCH_VENDOR) if (id->id.vendor != dev->id.vendor) continue; - + if (id->flags & INPUT_DEVICE_ID_MATCH_PRODUCT) if (id->id.product != dev->id.product) continue; - + if (id->flags & INPUT_DEVICE_ID_MATCH_VERSION) if (id->id.version != dev->id.version) continue; @@ -351,11 +351,11 @@ } if (in_interrupt()) { printk(KERN_ERR "input.c: calling hotplug from interrupt\n"); - return; + return; } if (!current->fs->root) { printk(KERN_WARNING "input.c: calling hotplug without valid filesystem\n"); - return; + return; } if (!(envp = (char **) kmalloc(20 * sizeof(char *), GFP_KERNEL))) { printk(KERN_ERR "input.c: not enough memory allocating hotplug environment\n"); @@ -381,17 +381,17 @@ envp[i++] = scratch; scratch += sprintf(scratch, "PRODUCT=%x/%x/%x/%x", - dev->id.bustype, dev->id.vendor, dev->id.product, dev->id.version) + 1; - + dev->id.bustype, dev->id.vendor, dev->id.product, dev->id.version) + 1; + if (dev->name) { envp[i++] = scratch; - scratch += sprintf(scratch, "NAME=%s", dev->name) + 1; + scratch += sprintf(scratch, "NAME=%s", dev->name) + 1; } if (dev->phys) { envp[i++] = scratch; - scratch += sprintf(scratch, "PHYS=%s", dev->phys) + 1; - } + scratch += sprintf(scratch, "PHYS=%s", dev->phys) + 1; + } SPRINTF_BIT_A(evbit, "EV=", EV_MAX); SPRINTF_BIT_A2(keybit, "KEY=", KEY_MAX, EV_KEY); @@ -506,7 +506,7 @@ input_table[handler->minor >> 5] = handler; list_add_tail(&handler->node, &input_handler_list); - + list_for_each_entry(dev, &input_dev_list, node) if (!handler->blacklist || !input_match_device(handler->blacklist, dev)) if ((id = input_match_device(handler->id_table, dev))) diff -urN linux-2.6.7-rc2/drivers/input/joydev.c linux-2.6.7-rc3/drivers/input/joydev.c --- linux-2.6.7-rc2/drivers/input/joydev.c 2004-05-09 19:32:37.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/joydev.c 2004-06-07 12:55:05.570728584 -0700 @@ -1,12 +1,12 @@ /* * Joystick device driver for the input driver suite. * - * Copyright (c) 1999-2002 Vojtech Pavlik - * Copyright (c) 1999 Colin Van Dyke + * Copyright (c) 1999-2002 Vojtech Pavlik + * Copyright (c) 1999 Colin Van Dyke * * 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 + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. */ @@ -34,7 +34,7 @@ MODULE_LICENSE("GPL"); #define JOYDEV_MINOR_BASE 0 -#define JOYDEV_MINORS 16 +#define JOYDEV_MINORS 16 #define JOYDEV_BUFFER_SIZE 64 #define MSECS(t) (1000 * ((t) / HZ) + 1000 * ((t) % HZ) / HZ) @@ -115,7 +115,7 @@ default: return; - } + } event.time = MSECS(jiffies); @@ -449,10 +449,10 @@ } joydev_table[minor] = joydev; - + devfs_mk_cdev(MKDEV(INPUT_MAJOR, JOYDEV_MINOR_BASE + minor), S_IFCHR|S_IRUGO|S_IWUSR, "input/js%d", minor); - class_simple_device_add(input_class, + class_simple_device_add(input_class, MKDEV(INPUT_MAJOR, JOYDEV_MINOR_BASE + minor), dev->dev, "js%d", minor); @@ -466,7 +466,7 @@ joydev->exist = 0; if (joydev->open) - input_close_device(handle); + input_close_device(handle); else joydev_free(joydev); } diff -urN linux-2.6.7-rc2/drivers/input/joystick/Kconfig linux-2.6.7-rc3/drivers/input/joystick/Kconfig --- linux-2.6.7-rc2/drivers/input/joystick/Kconfig 2004-05-09 19:31:58.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/joystick/Kconfig 2004-06-07 12:55:05.632731152 -0700 @@ -22,7 +22,7 @@ supports many extensions, including joysticks with throttle control, with rudders, additional hats and buttons compatible with CH Flightstick Pro, ThrustMaster FCS, 6 and 8 button gamepads, or - Saitek Cyborg joysticks. + Saitek Cyborg joysticks. Please read the file which contains more information. @@ -35,7 +35,7 @@ depends on INPUT && INPUT_JOYSTICK && GAMEPORT help Say Y here if you have an FPGaming or MadCatz controller using the - A3D protocol over the PC gameport. + A3D protocol over the PC gameport. To compile this driver as a module, choose M here: the module will be called a3d. @@ -45,7 +45,7 @@ depends on INPUT && INPUT_JOYSTICK && GAMEPORT help Say Y here if you have a Logitech controller using the ADI - protocol over the PC gameport. + protocol over the PC gameport. To compile this driver as a module, choose M here: the module will be called adi. @@ -74,7 +74,7 @@ depends on INPUT && INPUT_JOYSTICK && GAMEPORT help Say Y here if you have a Gravis controller using the GrIP protocol - over the PC gameport. + over the PC gameport. To compile this driver as a module, choose M here: the module will be called grip. @@ -94,7 +94,7 @@ depends on INPUT && INPUT_JOYSTICK && GAMEPORT help Say Y here if you have a Guillemot joystick using a digital - protocol over the PC gameport. + protocol over the PC gameport. To compile this driver as a module, choose M here: the module will be called guillemot. @@ -124,7 +124,7 @@ depends on INPUT && INPUT_JOYSTICK && GAMEPORT help Say Y here if you have a ThrustMaster controller using the - DirectConnect (BSP) protocol over the PC gameport. + DirectConnect (BSP) protocol over the PC gameport. To compile this driver as a module, choose M here: the module will be called tmdc. @@ -137,7 +137,7 @@ select SERIO help Say Y here if you have a Logitech WingMan Warrior joystick connected - to your computer's serial port. + to your computer's serial port. To compile this driver as a module, choose M here: the module will be called warrior. @@ -253,7 +253,7 @@ help Say Y here if you want to dump data from your joystick into the system log for debugging purposes. Say N if you are making a production - configuration or aren't sure. + configuration or aren't sure. To compile this driver as a module, choose M here: the module will be called joydump. diff -urN linux-2.6.7-rc2/drivers/input/joystick/a3d.c linux-2.6.7-rc3/drivers/input/joystick/a3d.c --- linux-2.6.7-rc2/drivers/input/joystick/a3d.c 2004-05-09 19:31:58.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/joystick/a3d.c 2004-06-07 12:55:05.633731193 -0700 @@ -39,8 +39,8 @@ MODULE_DESCRIPTION("FP-Gaming Assasin 3D joystick driver"); MODULE_LICENSE("GPL"); -#define A3D_MAX_START 400 /* 400 us */ -#define A3D_MAX_STROBE 60 /* 40 us */ +#define A3D_MAX_START 400 /* 400 us */ +#define A3D_MAX_STROBE 60 /* 40 us */ #define A3D_DELAY_READ 3 /* 3 ms */ #define A3D_MAX_LENGTH 40 /* 40*3 bits */ #define A3D_REFRESH_TIME HZ/50 /* 20 ms */ @@ -125,7 +125,7 @@ input_report_rel(dev, REL_X, ((data[5] << 6) | (data[6] << 3) | data[ 7]) - ((data[5] & 4) << 7)); input_report_rel(dev, REL_Y, ((data[8] << 6) | (data[9] << 3) | data[10]) - ((data[8] & 4) << 7)); - + input_report_key(dev, BTN_RIGHT, data[2] & 1); input_report_key(dev, BTN_LEFT, data[3] & 2); input_report_key(dev, BTN_MIDDLE, data[3] & 4); @@ -201,7 +201,7 @@ int i; for (i = 0; i < 4; i++) axes[i] = (a3d->axes[i] < 254) ? a3d->axes[i] : -1; - *buttons = a3d->buttons; + *buttons = a3d->buttons; return 0; } @@ -216,7 +216,7 @@ if (mode != GAMEPORT_MODE_COOKED) return -1; if (!a3d->used++) - mod_timer(&a3d->timer, jiffies + A3D_REFRESH_TIME); + mod_timer(&a3d->timer, jiffies + A3D_REFRESH_TIME); return 0; } @@ -239,7 +239,7 @@ { struct a3d *a3d = dev->private; if (!a3d->used++) - mod_timer(&a3d->timer, jiffies + A3D_REFRESH_TIME); + mod_timer(&a3d->timer, jiffies + A3D_REFRESH_TIME); return 0; } @@ -340,7 +340,7 @@ a3d->adc.open = a3d_adc_open; a3d->adc.close = a3d_adc_close; a3d->adc.cooked_read = a3d_adc_cooked_read; - a3d->adc.fuzz = 1; + a3d->adc.fuzz = 1; a3d->adc.name = a3d_names[a3d->mode]; a3d->adc.phys = a3d->adcphys; diff -urN linux-2.6.7-rc2/drivers/input/joystick/adi.c linux-2.6.7-rc3/drivers/input/joystick/adi.c --- linux-2.6.7-rc2/drivers/input/joystick/adi.c 2004-06-07 12:54:49.018043027 -0700 +++ linux-2.6.7-rc3/drivers/input/joystick/adi.c 2004-06-07 12:55:05.677733016 -0700 @@ -11,18 +11,18 @@ /* * 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 + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * 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 * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * 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 , or by paper mail: * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic @@ -72,8 +72,8 @@ */ static char *adi_names[] = { "WingMan Extreme Digital", "ThunderPad Digital", "SideCar", "CyberMan 2", - "WingMan Interceptor", "WingMan Formula", "WingMan GamePad", - "WingMan Extreme Digital 3D", "WingMan GamePad Extreme", + "WingMan Interceptor", "WingMan Formula", "WingMan GamePad", + "WingMan Extreme Digital 3D", "WingMan GamePad Extreme", "WingMan GamePad USB", "Unknown Device %#x" }; static char adi_wmgpe_abs[] = { ABS_X, ABS_Y, ABS_HAT0X, ABS_HAT0Y }; @@ -178,7 +178,7 @@ /* * adi_move_bits() detects a possible 2-stream mode, and moves - * the bits accordingly. + * the bits accordingly. */ static void adi_move_bits(struct adi_port *port, int length) @@ -208,7 +208,7 @@ int i; if ((adi->idx += count) > adi->ret) return 0; for (i = 0; i < count; i++) - bits |= ((adi->data[adi->idx - i] >> 5) & 1) << i; + bits |= ((adi->data[adi->idx - i] >> 5) & 1) << i; return bits; } @@ -224,12 +224,12 @@ int i, t; if (adi->ret < adi->length || adi->id != (adi_get_bits(adi, 4) | (adi_get_bits(adi, 4) << 4))) - return -1; + return -1; - for (i = 0; i < adi->axes10; i++) + for (i = 0; i < adi->axes10; i++) input_report_abs(dev, *abs++, adi_get_bits(adi, 10)); - for (i = 0; i < adi->axes8; i++) + for (i = 0; i < adi->axes8; i++) input_report_abs(dev, *abs++, adi_get_bits(adi, 8)); for (i = 0; i < adi->buttons && i < 63; i++) { @@ -249,7 +249,7 @@ for (i = 63; i < adi->buttons; i++) input_report_key(dev, *key++, adi_get_bits(adi, 1)); - + input_sync(dev); return 0; @@ -294,7 +294,7 @@ { struct adi_port *port = dev->private; if (!port->used++) - mod_timer(&port->timer, jiffies + ADI_REFRESH_TIME); + mod_timer(&port->timer, jiffies + ADI_REFRESH_TIME); return 0; } @@ -334,7 +334,7 @@ return; if (adi->ret < (t = adi_get_bits(adi, 10))) { - printk(KERN_WARNING "adi: Short ID packet: reported: %d != read: %d\n", t, adi->ret); + printk(KERN_WARNING "adi: Short ID packet: reported: %d != read: %d\n", t, adi->ret); return; } @@ -498,7 +498,7 @@ adi_init_digital(gameport); adi_read_packet(port); - + if (port->adi[0].ret >= ADI_MIN_LEN_LENGTH) adi_move_bits(port, adi_get_bits(port->adi, 10)); diff -urN linux-2.6.7-rc2/drivers/input/joystick/amijoy.c linux-2.6.7-rc3/drivers/input/joystick/amijoy.c --- linux-2.6.7-rc2/drivers/input/joystick/amijoy.c 2004-05-09 19:32:52.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/joystick/amijoy.c 2004-06-07 12:55:05.728735128 -0700 @@ -46,7 +46,7 @@ MODULE_LICENSE("GPL"); static int amijoy[2] = { 0, 1 }; -static int amijoy_nargs; +static int amijoy_nargs; module_param_array_named(map, amijoy, uint, amijoy_nargs, 0); MODULE_PARM_DESC(map, "Map of attached joysticks in form of , (default is 0,1)"); diff -urN linux-2.6.7-rc2/drivers/input/joystick/analog.c linux-2.6.7-rc3/drivers/input/joystick/analog.c --- linux-2.6.7-rc2/drivers/input/joystick/analog.c 2004-06-07 12:54:49.019043068 -0700 +++ linux-2.6.7-rc3/drivers/input/joystick/analog.c 2004-06-07 12:55:05.804738276 -0700 @@ -11,18 +11,18 @@ /* * 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 + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * 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 * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * 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 , or by paper mail: * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic @@ -237,7 +237,7 @@ loopout = (ANALOG_LOOP_TIME * port->loop) / 1000; timeout = ANALOG_MAX_TIME * port->speed; - + local_irq_save(flags); gameport_trigger(gameport); GET_TIME(now); @@ -284,7 +284,7 @@ u = gameport_read(port->gameport); - if (!chf) { + if (!chf) { port->buttons = (~u >> 4) & 0xf; return 0; } @@ -333,7 +333,7 @@ } } - for (i = 0; i < 2; i++) + for (i = 0; i < 2; i++) if (port->analog[i].mask) analog_decode(port->analog + i, port->axes, port->initial, port->buttons); @@ -348,7 +348,7 @@ { struct analog_port *port = dev->private; if (!port->used++) - mod_timer(&port->timer, jiffies + ANALOG_REFRESH_TIME); + mod_timer(&port->timer, jiffies + ANALOG_REFRESH_TIME); return 0; } @@ -408,7 +408,7 @@ static void analog_name(struct analog *analog) { - sprintf(analog->name, "Analog %d-axis %d-button", + sprintf(analog->name, "Analog %d-axis %d-button", hweight8(analog->mask & ANALOG_AXES_STD), hweight8(analog->mask & ANALOG_BTNS_STD) + !!(analog->mask & ANALOG_BTNS_CHF) * 2 + hweight16(analog->mask & ANALOG_BTNS_GAMEPAD) + !!(analog->mask & ANALOG_HBTN_CHF) * 4); @@ -450,10 +450,10 @@ analog->dev.close = analog_close; analog->dev.private = port; analog->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); - + for (i = j = 0; i < 4; i++) if (analog->mask & (1 << i)) { - + t = analog_axes[j]; x = port->axes[i]; y = (port->axes[0] + port->axes[1]) >> 1; @@ -481,8 +481,8 @@ j++; } - for (i = j = 0; i < 3; i++) - if (analog->mask & analog_exts[i]) + for (i = j = 0; i < 3; i++) + if (analog->mask & analog_exts[i]) for (x = 0; x < 2; x++) { t = analog_hats[j++]; set_bit(t, analog->dev.absbit); @@ -517,7 +517,7 @@ else printk(" [%s timer, %d %sHz clock, %d ns res]\n", TIME_NAME, port->speed > 10000 ? (port->speed + 800) / 1000 : port->speed, - port->speed > 10000 ? "M" : "k", + port->speed > 10000 ? "M" : "k", port->speed > 10000 ? (port->loop * 1000) / (port->speed / 1000) : (port->loop * 1000000) / port->speed); } @@ -580,11 +580,11 @@ gameport_calibrate(port->gameport, port->axes, max); } - - for (i = 0; i < 4; i++) + + for (i = 0; i < 4; i++) port->initial[i] = port->axes[i]; - return -!(analog[0].mask || analog[1].mask); + return -!(analog[0].mask || analog[1].mask); } static int analog_init_port(struct gameport *gameport, struct gameport_dev *dev, struct analog_port *port) @@ -606,7 +606,7 @@ msleep(ANALOG_MAX_TIME); port->mask = (gameport_read(gameport) ^ t) & t & 0xf; port->fuzz = (port->speed * ANALOG_FUZZ_MAGIC) / port->loop / 1000 + ANALOG_FUZZ_BITS; - + for (i = 0; i < ANALOG_INIT_RETRIES; i++) { if (!analog_cooked_read(port)) break; msleep(ANALOG_MAX_TIME); @@ -617,11 +617,11 @@ msleep(ANALOG_MAX_TIME); t = gameport_time(gameport, ANALOG_MAX_TIME * 1000); gameport_trigger(gameport); - while ((gameport_read(port->gameport) & port->mask) && (u < t)) u++; + while ((gameport_read(port->gameport) & port->mask) && (u < t)) u++; udelay(ANALOG_SAITEK_DELAY); t = gameport_time(gameport, ANALOG_SAITEK_TIME); gameport_trigger(gameport); - while ((gameport_read(port->gameport) & port->mask) && (v < t)) v++; + while ((gameport_read(port->gameport) & port->mask) && (v < t)) v++; if (v < (u >> 1)) { /* FIXME - more than one port */ analog_options[0] |= /* FIXME - more than one port */ @@ -721,7 +721,7 @@ if (!strcmp(analog_types[j].name, js[i])) { analog_options[i] = analog_types[j].value; break; - } + } if (analog_types[j].name) continue; analog_options[i] = simple_strtoul(js[i], &end, 0); diff -urN linux-2.6.7-rc2/drivers/input/joystick/cobra.c linux-2.6.7-rc3/drivers/input/joystick/cobra.c --- linux-2.6.7-rc2/drivers/input/joystick/cobra.c 2004-05-09 19:32:37.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/joystick/cobra.c 2004-06-07 12:55:05.805738318 -0700 @@ -72,7 +72,7 @@ r[i] = buf[i] = 0; t[i] = COBRA_MAX_STROBE; } - + local_irq_save(flags); u = gameport_read(gameport); @@ -140,14 +140,14 @@ } - mod_timer(&cobra->timer, jiffies + COBRA_REFRESH_TIME); + mod_timer(&cobra->timer, jiffies + COBRA_REFRESH_TIME); } static int cobra_open(struct input_dev *dev) { struct cobra *cobra = dev->private; if (!cobra->used++) - mod_timer(&cobra->timer, jiffies + COBRA_REFRESH_TIME); + mod_timer(&cobra->timer, jiffies + COBRA_REFRESH_TIME); return 0; } @@ -180,7 +180,7 @@ cobra->exists = cobra_read_packet(gameport, data); - for (i = 0; i < 2; i++) + for (i = 0; i < 2; i++) if ((cobra->exists >> i) & data[i] & 1) { printk(KERN_WARNING "cobra.c: Device %d on %s has the Ext bit set. ID is: %d" " Contact vojtech@ucw.cz\n", i, gameport->phys, (data[i] >> 2) & 7); @@ -205,7 +205,7 @@ cobra->dev[i].id.vendor = GAMEPORT_ID_VENDOR_CREATIVE; cobra->dev[i].id.product = 0x0008; cobra->dev[i].id.version = 0x0100; - + cobra->dev[i].evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); cobra->dev[i].absbit[0] = BIT(ABS_X) | BIT(ABS_Y); diff -urN linux-2.6.7-rc2/drivers/input/joystick/db9.c linux-2.6.7-rc3/drivers/input/joystick/db9.c --- linux-2.6.7-rc2/drivers/input/joystick/db9.c 2004-05-09 19:32:26.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/joystick/db9.c 2004-06-07 12:55:05.806738359 -0700 @@ -14,14 +14,14 @@ /* * 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 + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * 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 * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -95,7 +95,7 @@ struct db9 { struct input_dev dev[DB9_MAX_DEVICES]; struct timer_list timer; - struct pardevice *pd; + struct pardevice *pd; int mode; int used; char phys[2][32]; @@ -188,7 +188,7 @@ } /* - * db9_saturn_read_packet() reads whole saturn packet at connector + * db9_saturn_read_packet() reads whole saturn packet at connector * and returns device identifier code. */ static unsigned char db9_saturn_read_packet(struct parport *port, unsigned char *data, int type, int powered) @@ -481,16 +481,16 @@ input_report_abs(dev, ABS_X, (data & DB9_RIGHT ? 0 : 1) - (data & DB9_LEFT ? 0 : 1)); input_report_abs(dev, ABS_Y, (data & DB9_DOWN ? 0 : 1) - (data & DB9_UP ? 0 : 1)); - parport_write_control(port, 0x0a); + parport_write_control(port, 0x0a); - for (i = 0; i < 7; i++) { + for (i = 0; i < 7; i++) { data = parport_read_data(port); - parport_write_control(port, 0x02); - parport_write_control(port, 0x0a); + parport_write_control(port, 0x02); + parport_write_control(port, 0x0a); input_report_key(dev, db9_cd32_btn[i], ~data & DB9_FIRE2); } - parport_write_control(port, 0x00); + parport_write_control(port, 0x00); break; } @@ -600,7 +600,7 @@ db9->dev[i].evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); for (j = 0; j < db9_buttons[db9->mode]; j++) - set_bit(db9_btn[db9->mode][j], db9->dev[i].keybit); + set_bit(db9_btn[db9->mode][j], db9->dev[i].keybit); for (j = 0; j < db9_num_axis[db9->mode]; j++) { set_bit(db9_abs[j], db9->dev[i].absbit); if (j < 2) { @@ -635,7 +635,7 @@ { int i, j; - for (i = 0; i < 3; i++) + for (i = 0; i < 3; i++) if (db9_base[i]) { for (j = 0; j < min(db9_max_pads[db9_base[i]->mode], DB9_MAX_DEVICES); j++) input_unregister_device(db9_base[i]->dev + j); diff -urN linux-2.6.7-rc2/drivers/input/joystick/gamecon.c linux-2.6.7-rc3/drivers/input/joystick/gamecon.c --- linux-2.6.7-rc2/drivers/input/joystick/gamecon.c 2004-05-09 19:33:21.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/joystick/gamecon.c 2004-06-07 12:55:05.807738400 -0700 @@ -15,14 +15,14 @@ /* * 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 + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * 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 * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -70,13 +70,13 @@ #define GC_NES4 3 #define GC_MULTI 4 #define GC_MULTI2 5 -#define GC_N64 6 +#define GC_N64 6 #define GC_PSX 7 #define GC_MAX 7 #define GC_REFRESH_TIME HZ/100 - + struct gc { struct pardevice *pd; struct input_dev dev[5]; @@ -104,7 +104,7 @@ #define GC_N64_DELAY 133 /* delay between transmit request, and response ready (us) */ #define GC_N64_REQUEST 0x1dd1111111ULL /* the request data command (encoded for 000000011) */ #define GC_N64_DWS 3 /* delay between write segments (required for sound playback because of ISA DMA) */ - /* GC_N64_DWS > 24 is known to fail */ + /* GC_N64_DWS > 24 is known to fail */ #define GC_N64_POWER_W 0xe2 /* power during write (transmit request) */ #define GC_N64_POWER_R 0xfd /* power during read */ #define GC_N64_OUT 0x1d /* output bits to the 4 pads */ @@ -113,8 +113,8 @@ /* than 123 us */ #define GC_N64_CLOCK 0x02 /* clock bits for read */ -/* - * gc_n64_read_packet() reads an N64 packet. +/* + * gc_n64_read_packet() reads an N64 packet. * Each pad uses one bit per byte. So all pads connected to this port are read in parallel. */ @@ -224,7 +224,7 @@ * http://www.dim.com/~mackys/psxmemcard/ps-eng2.txt * http://www.gamesx.com/controldata/psxcont/psxcont.htm * ftp://milano.usal.es/pablo/ - * + * */ #define GC_PSX_DELAY 25 /* 25 usec */ @@ -331,13 +331,13 @@ s = gc_status_bit[i]; if (s & gc->pads[GC_N64] & ~(data[8] | data[9])) { - + signed char axes[2]; axes[0] = axes[1] = 0; for (j = 0; j < 8; j++) { - if (data[23 - j] & s) axes[0] |= 1 << j; - if (data[31 - j] & s) axes[1] |= 1 << j; + if (data[23 - j] & s) axes[0] |= 1 << j; + if (data[31 - j] & s) axes[1] |= 1 << j; } input_report_abs(dev + i, ABS_X, axes[0]); @@ -588,7 +588,7 @@ break; case GC_PSX: - + psx = gc_psx_read_packet(gc, data); switch(psx) { @@ -629,7 +629,7 @@ } sprintf(gc->phys[i], "%s/input%d", gc->pd->port->name, i); - + gc->dev[i].name = gc_names[config[i + 1]]; gc->dev[i].phys = gc->phys[i]; gc->dev[i].id.bustype = BUS_PARPORT; @@ -646,7 +646,7 @@ return NULL; } - for (i = 0; i < 5; i++) + for (i = 0; i < 5; i++) if (gc->pads[0] & gc_status_bit[i]) { input_register_device(gc->dev + i); printk(KERN_INFO "input: %s on %s\n", gc->dev[i].name, gc->pd->port->name); @@ -675,7 +675,7 @@ if (gc_base[i]) { for (j = 0; j < 5; j++) if (gc_base[i]->pads[0] & gc_status_bit[j]) - input_unregister_device(gc_base[i]->dev + j); + input_unregister_device(gc_base[i]->dev + j); parport_unregister_device(gc_base[i]->pd); } } diff -urN linux-2.6.7-rc2/drivers/input/joystick/gf2k.c linux-2.6.7-rc3/drivers/input/joystick/gf2k.c --- linux-2.6.7-rc2/drivers/input/joystick/gf2k.c 2004-06-07 12:54:49.019043068 -0700 +++ linux-2.6.7-rc3/drivers/input/joystick/gf2k.c 2004-06-07 12:55:05.808738442 -0700 @@ -11,18 +11,18 @@ /* * 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 + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * 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 * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * 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 , or by paper mail: * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic @@ -223,7 +223,7 @@ { struct gf2k *gf2k = dev->private; if (!gf2k->used++) - mod_timer(&gf2k->timer, jiffies + GF2K_REFRESH); + mod_timer(&gf2k->timer, jiffies + GF2K_REFRESH); return 0; } @@ -324,7 +324,7 @@ for (i = 0; i < gf2k_axes[gf2k->id]; i++) { gf2k->dev.absmax[gf2k_abs[i]] = (i < 2) ? gf2k->dev.abs[gf2k_abs[i]] * 2 - 32 : - gf2k->dev.abs[gf2k_abs[0]] + gf2k->dev.abs[gf2k_abs[1]] - 32; + gf2k->dev.abs[gf2k_abs[0]] + gf2k->dev.abs[gf2k_abs[1]] - 32; gf2k->dev.absmin[gf2k_abs[i]] = 32; gf2k->dev.absfuzz[gf2k_abs[i]] = 8; gf2k->dev.absflat[gf2k_abs[i]] = (i < 2) ? 24 : 0; diff -urN linux-2.6.7-rc2/drivers/input/joystick/grip.c linux-2.6.7-rc3/drivers/input/joystick/grip.c --- linux-2.6.7-rc2/drivers/input/joystick/grip.c 2004-05-09 19:32:28.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/joystick/grip.c 2004-06-07 12:55:05.808738442 -0700 @@ -48,8 +48,8 @@ #define GRIP_STROBE_GPP 200 /* 200 us */ #define GRIP_LENGTH_XT 4 #define GRIP_STROBE_XT 64 /* 64 us */ -#define GRIP_MAX_CHUNKS_XT 10 -#define GRIP_MAX_BITS_XT 30 +#define GRIP_MAX_CHUNKS_XT 10 +#define GRIP_MAX_BITS_XT 30 #define GRIP_REFRESH_TIME HZ/50 /* 20 ms */ @@ -153,7 +153,7 @@ buf = (buf << 1) | (u >> 1); t = strobe; i++; - } else + } else if ((((u ^ v) & (v ^ w)) >> 1) & ~(u | v | w) & 1) { if (i == 20) { diff -urN linux-2.6.7-rc2/drivers/input/joystick/grip_mp.c linux-2.6.7-rc3/drivers/input/joystick/grip_mp.c --- linux-2.6.7-rc2/drivers/input/joystick/grip_mp.c 2004-05-09 19:33:20.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/joystick/grip_mp.c 2004-06-07 12:55:05.809738483 -0700 @@ -69,7 +69,7 @@ #define IO_MODE_FAST 0x0200 /* Used 3 data bits per gameport read */ #define IO_SLOT_CHANGE 0x0800 /* Multiport physical slot status changed */ #define IO_DONE 0x1000 /* Multiport is done sending packets */ -#define IO_RETRY 0x4000 /* Try again later to get packet */ +#define IO_RETRY 0x4000 /* Try again later to get packet */ #define IO_RESET 0x8000 /* Force multiport to resend all packets */ /* @@ -144,8 +144,8 @@ /* * Gets a 28-bit packet from the multiport. * - * After getting a packet successfully, commands encoded by sendcode may - * be sent to the multiport. + * After getting a packet successfully, commands encoded by sendcode may + * be sent to the multiport. * * The multiport clock value is reflected in gameport bit B4. * @@ -169,7 +169,7 @@ *packet = 0; raw_data = gameport_read(gameport); - if (raw_data & 1) + if (raw_data & 1) return IO_RETRY; for (i = 0; i < 64; i++) { @@ -183,11 +183,11 @@ if (raw_data & 0x31) return IO_RESET; - gameport_trigger(gameport); + gameport_trigger(gameport); if (!poll_until(0x10, 0, 308, gameport, &raw_data)) return IO_RESET; - } else + } else return IO_RETRY; /* Determine packet transfer mode and prepare for packet construction. */ @@ -195,7 +195,7 @@ if (raw_data & 0x20) { /* 3 data bits/read */ portvals |= raw_data >> 4; /* Compare B4-B7 before & after trigger */ - if (portvals != 0xb) + if (portvals != 0xb) return 0; data_mask = 7; bits_per_read = 3; @@ -221,7 +221,7 @@ return IO_RESET; } - if (raw_data) + if (raw_data) return IO_RESET; /* If 3 bits/read used, drop from 30 bits to 28. */ @@ -231,7 +231,7 @@ pkt = (pkt >> 2) | 0xf0000000; } - if (bit_parity(pkt) == 1) + if (bit_parity(pkt) == 1) return IO_RESET; /* Acknowledge packet receipt */ @@ -251,10 +251,10 @@ /* Return if we just wanted the packet or multiport wants to send more */ - *packet = pkt; + *packet = pkt; if ((sendflags == 0) || ((sendflags & IO_RETRY) && !(pkt & PACKET_MP_DONE))) return IO_GOT_PACKET; - + if (pkt & PACKET_MP_MORE) return IO_GOT_PACKET | IO_RETRY; @@ -277,7 +277,7 @@ if (!poll_until(0x30, 0, 193, gameport, &raw_data)) return IO_GOT_PACKET | IO_RESET; - if (raw_data & 1) + if (raw_data & 1) return IO_GOT_PACKET | IO_RESET; if (sendcode & 1) @@ -429,19 +429,19 @@ strange_code = joytype; } } - return flags; + return flags; } /* * Returns true if all multiport slot states appear valid. */ - + static int slots_valid(struct grip_mp *grip) { int flags, slot, invalid = 0, active = 0; flags = get_and_decode_packet(grip, 0); - if (!(flags & IO_GOT_PACKET)) + if (!(flags & IO_GOT_PACKET)) return 0; for (slot = 0; slot < 4; slot++) { @@ -463,7 +463,7 @@ * Returns whether the multiport was placed into digital mode and * able to communicate its state successfully. */ - + static int multiport_init(struct grip_mp *grip) { int dig_mode, initialized = 0, tries = 0; @@ -481,7 +481,7 @@ dbg("multiport_init(): unable to achieve digital mode.\n"); return 0; } - + /* Get packets, store multiport state, and check state's validity */ for (tries = 0; tries < 4096; tries++) { if ( slots_valid(grip) ) { @@ -520,9 +520,9 @@ } /* - * Get the multiport state. + * Get the multiport state. */ - + static void get_and_report_mp_state(struct grip_mp *grip) { int i, npkts, flags; @@ -538,7 +538,7 @@ break; } - for (i = 0; i < 4; i++) + for (i = 0; i < 4; i++) if (grip->dirty[i]) report_slot(grip, i); } @@ -546,7 +546,7 @@ /* * Called when a joystick device file is opened */ - + static int grip_open(struct input_dev *dev) { struct grip_mp *grip = dev->private; @@ -607,7 +607,7 @@ /* * Repeatedly polls the multiport and generates events. */ - + static void grip_timer(unsigned long private) { struct grip_mp *grip = (void*) private; diff -urN linux-2.6.7-rc2/drivers/input/joystick/guillemot.c linux-2.6.7-rc3/drivers/input/joystick/guillemot.c --- linux-2.6.7-rc2/drivers/input/joystick/guillemot.c 2004-05-09 19:32:27.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/joystick/guillemot.c 2004-06-07 12:55:05.810738525 -0700 @@ -45,7 +45,7 @@ #define GUILLEMOT_MAX_LENGTH 17 /* 17 bytes */ #define GUILLEMOT_REFRESH_TIME HZ/50 /* 20 ms */ -static short guillemot_abs_pad[] = +static short guillemot_abs_pad[] = { ABS_X, ABS_Y, ABS_THROTTLE, ABS_RUDDER, -1 }; static short guillemot_btn_pad[] = @@ -160,7 +160,7 @@ { struct guillemot *guillemot = dev->private; if (!guillemot->used++) - mod_timer(&guillemot->timer, jiffies + GUILLEMOT_REFRESH_TIME); + mod_timer(&guillemot->timer, jiffies + GUILLEMOT_REFRESH_TIME); return 0; } @@ -211,7 +211,7 @@ if (!guillemot_type[i].name) { printk(KERN_WARNING "guillemot.c: Unknown joystick on %s. [ %02x%02x:%04x, ver %d.%02d ]\n", gameport->phys, data[12], data[13], data[11], data[14], data[15]); - goto fail2; + goto fail2; } sprintf(guillemot->phys, "%s/input0", gameport->phys); @@ -237,7 +237,7 @@ guillemot->dev.absmax[t] = 255; } - if (guillemot->type->hat) + if (guillemot->type->hat) for (i = 0; i < 2; i++) { t = ABS_HAT0X + i; set_bit(t, guillemot->dev.absbit); diff -urN linux-2.6.7-rc2/drivers/input/joystick/iforce/Kconfig linux-2.6.7-rc3/drivers/input/joystick/iforce/Kconfig --- linux-2.6.7-rc2/drivers/input/joystick/iforce/Kconfig 2004-05-09 19:32:26.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/joystick/iforce/Kconfig 2004-06-07 12:55:05.810738525 -0700 @@ -17,7 +17,7 @@ depends on JOYSTICK_IFORCE && (JOYSTICK_IFORCE=m || USB=y) && USB help Say Y here if you have an I-Force joystick or steering wheel - connected to your USB port. + connected to your USB port. config JOYSTICK_IFORCE_232 bool "I-Force Serial joysticks and wheels" diff -urN linux-2.6.7-rc2/drivers/input/joystick/iforce/Makefile linux-2.6.7-rc3/drivers/input/joystick/iforce/Makefile --- linux-2.6.7-rc2/drivers/input/joystick/iforce/Makefile 2004-05-09 19:33:21.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/joystick/iforce/Makefile 2004-06-07 12:55:05.850740182 -0700 @@ -7,14 +7,14 @@ # Goal definition iforce-objs := iforce-ff.o iforce-main.o iforce-packets.o -obj-$(CONFIG_JOYSTICK_IFORCE) += iforce.o +obj-$(CONFIG_JOYSTICK_IFORCE) += iforce.o ifeq ($(CONFIG_JOYSTICK_IFORCE_232),y) - iforce-objs += iforce-serio.o + iforce-objs += iforce-serio.o endif ifeq ($(CONFIG_JOYSTICK_IFORCE_USB),y) - iforce-objs += iforce-usb.o + iforce-objs += iforce-usb.o endif EXTRA_CFLAGS = -Werror-implicit-function-declaration diff -urN linux-2.6.7-rc2/drivers/input/joystick/iforce/iforce-ff.c linux-2.6.7-rc3/drivers/input/joystick/iforce/iforce-ff.c --- linux-2.6.7-rc2/drivers/input/joystick/iforce/iforce-ff.c 2004-05-09 19:31:59.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/joystick/iforce/iforce-ff.c 2004-06-07 12:55:05.851740223 -0700 @@ -195,7 +195,7 @@ } /* - * Analyse the changes in an effect, and tell if we need to send an condition + * Analyse the changes in an effect, and tell if we need to send an condition * parameter packet */ static int need_condition_modifier(struct iforce* iforce, struct ff_effect* new) @@ -372,7 +372,7 @@ int core_err = 0; if (!is_update || need_period_modifier(iforce, effect)) { - param1_err = make_period_modifier(iforce, mod1_chunk, + param1_err = make_period_modifier(iforce, mod1_chunk, is_update, effect->u.periodic.magnitude, effect->u.periodic.offset, effect->u.periodic.period, effect->u.periodic.phase); diff -urN linux-2.6.7-rc2/drivers/input/joystick/iforce/iforce-main.c linux-2.6.7-rc3/drivers/input/joystick/iforce/iforce-main.c --- linux-2.6.7-rc2/drivers/input/joystick/iforce/iforce-main.c 2004-05-09 19:32:28.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/joystick/iforce/iforce-main.c 2004-06-07 12:55:05.852740264 -0700 @@ -166,7 +166,7 @@ else { /* We want to update an effect */ if (!CHECK_OWNERSHIP(effect->id, iforce)) return -EACCES; - + /* Parameter type cannot be updated */ if (effect->type != iforce->core_effects[effect->id].effect.type) return -EINVAL; @@ -273,7 +273,7 @@ if (test_bit(FF_CORE_IS_USED, iforce->core_effects[i].flags) && current->pid == iforce->core_effects[i].owner) { - + /* Stop effect */ input_report_ff(dev, i, 0); diff -urN linux-2.6.7-rc2/drivers/input/joystick/iforce/iforce-packets.c linux-2.6.7-rc3/drivers/input/joystick/iforce/iforce-packets.c --- linux-2.6.7-rc2/drivers/input/joystick/iforce/iforce-packets.c 2004-05-09 19:32:37.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/joystick/iforce/iforce-packets.c 2004-06-07 12:55:05.852740264 -0700 @@ -56,7 +56,7 @@ int empty; int head, tail; unsigned long flags; - + /* * Update head and tail of xmit buffer */ @@ -108,7 +108,7 @@ break; #endif #ifdef CONFIG_JOYSTICK_IFORCE_USB - case IFORCE_USB: + case IFORCE_USB: if (iforce->usbdev && empty && !test_and_set_bit(IFORCE_XMIT_RUNNING, iforce->xmit_flags)) { diff -urN linux-2.6.7-rc2/drivers/input/joystick/iforce/iforce-serio.c linux-2.6.7-rc3/drivers/input/joystick/iforce/iforce-serio.c --- linux-2.6.7-rc2/drivers/input/joystick/iforce/iforce-serio.c 2004-05-09 19:31:58.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/joystick/iforce/iforce-serio.c 2004-06-07 12:55:05.852740264 -0700 @@ -62,7 +62,7 @@ cs ^= iforce->xmit.buf[iforce->xmit.tail]; XMIT_INC(iforce->xmit.tail, 1); } - + serio_write(iforce->serio, cs); if (test_and_clear_bit(IFORCE_XMIT_AGAIN, iforce->xmit_flags)) diff -urN linux-2.6.7-rc2/drivers/input/joystick/iforce/iforce.h linux-2.6.7-rc3/drivers/input/joystick/iforce/iforce.h --- linux-2.6.7-rc2/drivers/input/joystick/iforce/iforce.h 2004-05-09 19:32:28.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/joystick/iforce/iforce.h 2004-06-07 12:55:05.853740306 -0700 @@ -141,7 +141,7 @@ struct circ_buf xmit; unsigned char xmit_data[XMIT_SIZE]; long xmit_flags[1]; - + /* Force Feedback */ wait_queue_head_t wait; struct resource device_memory; diff -urN linux-2.6.7-rc2/drivers/input/joystick/interact.c linux-2.6.7-rc3/drivers/input/joystick/interact.c --- linux-2.6.7-rc2/drivers/input/joystick/interact.c 2004-05-09 19:32:52.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/joystick/interact.c 2004-06-07 12:55:05.853740306 -0700 @@ -63,7 +63,7 @@ char phys[32]; }; -static short interact_abs_hhfx[] = +static short interact_abs_hhfx[] = { ABS_RX, ABS_RY, ABS_X, ABS_Y, ABS_HAT0X, ABS_HAT0Y, -1 }; static short interact_abs_pp8d[] = { ABS_X, ABS_Y, -1 }; @@ -166,7 +166,7 @@ case INTERACT_TYPE_PP8D: for (i = 0; i < 2; i++) - input_report_abs(dev, interact_abs_pp8d[i], + input_report_abs(dev, interact_abs_pp8d[i], ((data[0] >> ((i << 1) + 20)) & 1) - ((data[0] >> ((i << 1) + 21)) & 1)); for (i = 0; i < 8; i++) @@ -190,7 +190,7 @@ { struct interact *interact = dev->private; if (!interact->used++) - mod_timer(&interact->timer, jiffies + INTERACT_REFRESH_TIME); + mod_timer(&interact->timer, jiffies + INTERACT_REFRESH_TIME); return 0; } @@ -242,7 +242,7 @@ if (!interact_type[i].length) { printk(KERN_WARNING "interact.c: Unknown joystick on %s. [len %d d0 %08x d1 %08x i2 %08x]\n", gameport->phys, i, data[0], data[1], data[2]); - goto fail2; + goto fail2; } sprintf(interact->phys, "%s/input0", gameport->phys); diff -urN linux-2.6.7-rc2/drivers/input/joystick/joydump.c linux-2.6.7-rc3/drivers/input/joystick/joydump.c --- linux-2.6.7-rc2/drivers/input/joystick/joydump.c 2004-05-09 19:33:19.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/joystick/joydump.c 2004-06-07 12:55:05.853740306 -0700 @@ -12,18 +12,18 @@ /* * 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 + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * 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 * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * 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 , or by paper mail: * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic @@ -63,7 +63,7 @@ printk(KERN_INFO "joydump: | Raw mode not available - trying cooked. |\n"); if (gameport_open(gameport, dev, GAMEPORT_MODE_COOKED)) { - + printk(KERN_INFO "joydump: | Cooked not available either. Failing. |\n"); printk(KERN_INFO "joydump: `-------------------- END -------------------'\n"); return; diff -urN linux-2.6.7-rc2/drivers/input/joystick/magellan.c linux-2.6.7-rc3/drivers/input/joystick/magellan.c --- linux-2.6.7-rc2/drivers/input/joystick/magellan.c 2004-05-09 19:31:58.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/joystick/magellan.c 2004-06-07 12:55:05.854740347 -0700 @@ -11,18 +11,18 @@ /* * 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 + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * 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 * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * 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 , or by paper mail: * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic @@ -159,7 +159,7 @@ memset(magellan, 0, sizeof(struct magellan)); - magellan->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); + magellan->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); for (i = 0; i < 9; i++) set_bit(magellan_buttons[i], magellan->dev.keybit); @@ -181,7 +181,7 @@ magellan->dev.id.vendor = SERIO_MAGELLAN; magellan->dev.id.product = 0x0001; magellan->dev.id.version = 0x0100; - + serio->private = magellan; if (serio_open(serio, dev)) { diff -urN linux-2.6.7-rc2/drivers/input/joystick/sidewinder.c linux-2.6.7-rc3/drivers/input/joystick/sidewinder.c --- linux-2.6.7-rc2/drivers/input/joystick/sidewinder.c 2004-05-09 19:33:13.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/joystick/sidewinder.c 2004-06-07 12:55:05.854740347 -0700 @@ -11,18 +11,18 @@ /* * 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 + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * 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 * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * 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 , or by paper mail: * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic @@ -176,19 +176,19 @@ buf[i] = v >> 5; /* Store it */ i++; /* Advance index */ bitout = strobe; /* Extend timeout for next bit */ - } + } if (kick && (~v & u & 0x01)) { /* Falling edge on axis 0 */ sched = kick; /* Schedule second trigger */ kick = 0; /* Don't schedule next time on falling edge */ pending = 1; /* Mark schedule */ - } + } if (pending && sched < 0 && (i > -SW_END)) { /* Second trigger time */ gameport_trigger(gameport); /* Trigger */ bitout = start; /* Long bit timeout */ pending = 0; /* Unmark schedule */ - timeout = 0; /* Switch from global to bit timeouts */ + timeout = 0; /* Switch from global to bit timeouts */ } } @@ -482,14 +482,14 @@ sw_read_packet(sw->gameport, buf, SW_LENGTH, i); /* Read ID packet, this initializes the stick */ sw->fail = SW_FAIL; - + return -1; } static void sw_timer(unsigned long private) { struct sw *sw = (void *) private; - + sw->reads++; if (sw_read(sw)) sw->bads++; mod_timer(&sw->timer, jiffies + SW_REFRESH); @@ -653,7 +653,7 @@ case 60: sw->number++; case 45: /* Ambiguous packet length */ - if (j <= 40) { /* ID length less or eq 40 -> FSP */ + if (j <= 40) { /* ID length less or eq 40 -> FSP */ case 43: sw->type = SW_ID_FSP; break; diff -urN linux-2.6.7-rc2/drivers/input/joystick/spaceball.c linux-2.6.7-rc3/drivers/input/joystick/spaceball.c --- linux-2.6.7-rc2/drivers/input/joystick/spaceball.c 2004-05-09 19:31:59.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/joystick/spaceball.c 2004-06-07 12:55:05.855740389 -0700 @@ -15,18 +15,18 @@ /* * 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 + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * 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 * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * 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 , or by paper mail: * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic @@ -59,8 +59,8 @@ static int spaceball_axes[] = { ABS_X, ABS_Z, ABS_Y, ABS_RX, ABS_RZ, ABS_RY }; static char *spaceball_names[] = { - "?", "SpaceTec SpaceBall 1003", "SpaceTec SpaceBall 2003", "SpaceTec SpaceBall 2003B", - "SpaceTec SpaceBall 2003C", "SpaceTec SpaceBall 3003", "SpaceTec SpaceBall SpaceController", + "?", "SpaceTec SpaceBall 1003", "SpaceTec SpaceBall 2003", "SpaceTec SpaceBall 2003B", + "SpaceTec SpaceBall 2003C", "SpaceTec SpaceBall 3003", "SpaceTec SpaceBall SpaceController", "SpaceTec SpaceBall 3003C", "SpaceTec SpaceBall 4000FLX", "SpaceTec SpaceBall 4000FLX Lefty" }; /* @@ -96,7 +96,7 @@ case 'D': /* Ball data */ if (spaceball->idx != 15) return; for (i = 0; i < 6; i++) - input_report_abs(dev, spaceball_axes[i], + input_report_abs(dev, spaceball_axes[i], (__s16)((data[2 * i + 3] << 8) | data[2 * i + 2])); break; @@ -216,7 +216,7 @@ return; memset(spaceball, 0, sizeof(struct spaceball)); - spaceball->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); + spaceball->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); switch (id) { case SPACEBALL_4000FLX: @@ -224,7 +224,7 @@ spaceball->dev.keybit[LONG(BTN_0)] |= BIT(BTN_9); spaceball->dev.keybit[LONG(BTN_A)] |= BIT(BTN_A) | BIT(BTN_B) | BIT(BTN_C) | BIT(BTN_MODE); default: - spaceball->dev.keybit[LONG(BTN_0)] |= BIT(BTN_2) | BIT(BTN_3) | BIT(BTN_4) + spaceball->dev.keybit[LONG(BTN_0)] |= BIT(BTN_2) | BIT(BTN_3) | BIT(BTN_4) | BIT(BTN_5) | BIT(BTN_6) | BIT(BTN_7) | BIT(BTN_8); case SPACEBALL_3003C: spaceball->dev.keybit[LONG(BTN_0)] |= BIT(BTN_1) | BIT(BTN_8); @@ -251,7 +251,7 @@ spaceball->dev.id.vendor = SERIO_SPACEBALL; spaceball->dev.id.product = id; spaceball->dev.id.version = 0x0100; - + serio->private = spaceball; if (serio_open(serio, dev)) { diff -urN linux-2.6.7-rc2/drivers/input/joystick/spaceorb.c linux-2.6.7-rc3/drivers/input/joystick/spaceorb.c --- linux-2.6.7-rc2/drivers/input/joystick/spaceorb.c 2004-05-09 19:32:29.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/joystick/spaceorb.c 2004-06-07 12:55:05.855740389 -0700 @@ -2,7 +2,7 @@ * $Id: spaceorb.c,v 1.15 2002/01/22 20:29:19 vojtech Exp $ * * Copyright (c) 1999-2001 Vojtech Pavlik - * + * * Based on the work of: * David Thompson */ @@ -14,18 +14,18 @@ /* * 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 + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * 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 * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * 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 , or by paper mail: * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic @@ -67,7 +67,7 @@ static unsigned char spaceorb_xor[] = "SpaceWare"; static unsigned char *spaceorb_errors[] = { "EEPROM storing 0 failed", "Receive queue overflow", "Transmit queue timeout", - "Bad packet", "Power brown-out", "EEPROM checksum error", "Hardware fault" }; + "Bad packet", "Power brown-out", "EEPROM checksum error", "Hardware fault" }; /* * spaceorb_process_packet() decodes packets the driver receives from the @@ -99,7 +99,7 @@ case 'D': /* Ball + button data */ if (spaceorb->idx != 12) return; - for (i = 0; i < 9; i++) spaceorb->data[i+2] ^= spaceorb_xor[i]; + for (i = 0; i < 9; i++) spaceorb->data[i+2] ^= spaceorb_xor[i]; axes[0] = ( data[2] << 3) | (data[ 3] >> 4); axes[1] = ((data[3] & 0x0f) << 6) | (data[ 4] >> 1); axes[2] = ((data[4] & 0x01) << 9) | (data[ 5] << 2) | (data[4] >> 5); @@ -174,7 +174,7 @@ return; memset(spaceorb, 0, sizeof(struct spaceorb)); - spaceorb->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); + spaceorb->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); for (i = 0; i < 6; i++) set_bit(spaceorb_buttons[i], spaceorb->dev.keybit); @@ -198,7 +198,7 @@ spaceorb->dev.id.vendor = SERIO_SPACEORB; spaceorb->dev.id.product = 0x0001; spaceorb->dev.id.version = 0x0100; - + serio->private = spaceorb; if (serio_open(serio, dev)) { diff -urN linux-2.6.7-rc2/drivers/input/joystick/stinger.c linux-2.6.7-rc3/drivers/input/joystick/stinger.c --- linux-2.6.7-rc2/drivers/input/joystick/stinger.c 2004-05-09 19:31:58.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/joystick/stinger.c 2004-06-07 12:55:05.856740430 -0700 @@ -147,7 +147,7 @@ memset(stinger, 0, sizeof(struct stinger)); - stinger->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); + stinger->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); stinger->dev.keybit[LONG(BTN_A)] = BIT(BTN_A) | BIT(BTN_B) | BIT(BTN_C) | BIT(BTN_X) | \ BIT(BTN_Y) | BIT(BTN_Z) | BIT(BTN_TL) | BIT(BTN_TR) | \ BIT(BTN_START) | BIT(BTN_SELECT); @@ -164,8 +164,8 @@ stinger->dev.id.version = 0x0100; for (i = 0; i < 2; i++) { - stinger->dev.absmax[ABS_X+i] = 64; - stinger->dev.absmin[ABS_X+i] = -64; + stinger->dev.absmax[ABS_X+i] = 64; + stinger->dev.absmin[ABS_X+i] = -64; stinger->dev.absflat[ABS_X+i] = 4; } diff -urN linux-2.6.7-rc2/drivers/input/joystick/tmdc.c linux-2.6.7-rc3/drivers/input/joystick/tmdc.c --- linux-2.6.7-rc2/drivers/input/joystick/tmdc.c 2004-05-09 19:32:28.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/joystick/tmdc.c 2004-06-07 12:55:05.856740430 -0700 @@ -4,7 +4,7 @@ * Copyright (c) 1998-2001 Vojtech Pavlik * * Based on the work of: - * Trystan Larey-Williams + * Trystan Larey-Williams */ /* @@ -14,18 +14,18 @@ /* * 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 + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * 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 * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * 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 , or by paper mail: * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic @@ -58,7 +58,7 @@ #define TMDC_BYTE_REV 11 #define TMDC_BYTE_DEF 12 -#define TMDC_ABS 7 +#define TMDC_ABS 7 #define TMDC_ABS_HAT 4 #define TMDC_BTN 16 @@ -104,7 +104,7 @@ unsigned char btno[2][4]; int used; int reads; - int bads; + int bads; unsigned char exists; }; @@ -127,7 +127,7 @@ local_irq_save(flags); gameport_trigger(gameport); - + w = gameport_read(gameport) >> 4; do { @@ -148,7 +148,7 @@ } data[k][i[k]] |= (~v & 1) << (j[k]++ - 1); /* Data bit */ } - t[k]--; + t[k]--; } } while (t[0] > 0 || t[1] > 0); @@ -175,7 +175,7 @@ bad = 1; else - for (j = 0; j < 2; j++) + for (j = 0; j < 2; j++) if (r & (1 << j) & tmdc->exists) { if (data[j][TMDC_BYTE_ID] != tmdc->mode[j]) { @@ -227,7 +227,7 @@ { struct tmdc *tmdc = dev->private; if (!tmdc->used++) - mod_timer(&tmdc->timer, jiffies + TMDC_REFRESH_TIME); + mod_timer(&tmdc->timer, jiffies + TMDC_REFRESH_TIME); return 0; } @@ -356,7 +356,7 @@ struct tmdc *tmdc = gameport->private; int i; for (i = 0; i < 2; i++) - if (tmdc->exists & (1 << i)) + if (tmdc->exists & (1 << i)) input_unregister_device(tmdc->dev + i); gameport_close(gameport); kfree(tmdc); diff -urN linux-2.6.7-rc2/drivers/input/joystick/turbografx.c linux-2.6.7-rc3/drivers/input/joystick/turbografx.c --- linux-2.6.7-rc2/drivers/input/joystick/turbografx.c 2004-05-09 19:32:54.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/joystick/turbografx.c 2004-06-07 12:55:05.857740471 -0700 @@ -14,18 +14,18 @@ /* * 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 + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * 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 * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * 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 , or by paper mail: * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic @@ -65,7 +65,7 @@ #define TGFX_TRIGGER 0x08 #define TGFX_UP 0x10 -#define TGFX_DOWN 0x20 +#define TGFX_DOWN 0x20 #define TGFX_LEFT 0x40 #define TGFX_RIGHT 0x80 @@ -126,7 +126,7 @@ if (!tgfx->used++) { parport_claim(tgfx->pd); parport_write_control(tgfx->pd->port, 0x04); - mod_timer(&tgfx->timer, jiffies + TGFX_REFRESH_TIME); + mod_timer(&tgfx->timer, jiffies + TGFX_REFRESH_TIME); } return 0; } @@ -173,7 +173,7 @@ memset(tgfx, 0, sizeof(struct tgfx)); tgfx->pd = parport_register_device(pp, "turbografx", NULL, NULL, NULL, PARPORT_DEV_EXCL, NULL); - + parport_put_port(pp); if (!tgfx->pd) { @@ -210,7 +210,7 @@ tgfx->dev[i].absbit[0] = BIT(ABS_X) | BIT(ABS_Y); for (j = 0; j < config[i+1]; j++) - set_bit(tgfx_buttons[j], tgfx->dev[i].keybit); + set_bit(tgfx_buttons[j], tgfx->dev[i].keybit); tgfx->dev[i].absmin[ABS_X] = -1; tgfx->dev[i].absmax[ABS_X] = 1; tgfx->dev[i].absmin[ABS_Y] = -1; tgfx->dev[i].absmax[ABS_Y] = 1; @@ -225,7 +225,7 @@ kfree(tgfx); return NULL; } - + return tgfx; } @@ -245,7 +245,7 @@ { int i, j; - for (i = 0; i < 3; i++) + for (i = 0; i < 3; i++) if (tgfx_base[i]) { for (j = 0; j < 7; j++) if (tgfx_base[i]->sticks & (1 << j)) diff -urN linux-2.6.7-rc2/drivers/input/joystick/twidjoy.c linux-2.6.7-rc3/drivers/input/joystick/twidjoy.c --- linux-2.6.7-rc2/drivers/input/joystick/twidjoy.c 2004-05-09 19:32:00.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/joystick/twidjoy.c 2004-06-07 12:55:05.857740471 -0700 @@ -58,6 +58,9 @@ #include #include +MODULE_DESCRIPTION("Handykey Twiddler keyboard as a joystick driver"); +MODULE_LICENSE("GPL"); + /* * Constants. */ @@ -142,7 +145,7 @@ * packet processing routine. */ -static void twidjoy_interrupt(struct serio *serio, unsigned char data, unsigned int flags, struc pt_regs *regs) +static irqreturn_t twidjoy_interrupt(struct serio *serio, unsigned char data, unsigned int flags, struct pt_regs *regs) { struct twidjoy *twidjoy = serio->private; @@ -153,7 +156,7 @@ if ((data & 0x80) == 0) twidjoy->idx = 0; /* this byte starts a new packet */ else if (twidjoy->idx == 0) - return; /* wrong MSB -- ignore this byte */ + return IRQ_HANDLED; /* wrong MSB -- ignore this byte */ if (twidjoy->idx < TWIDJOY_MAX_LENGTH) twidjoy->data[twidjoy->idx++] = data; @@ -163,7 +166,7 @@ twidjoy->idx = 0; } - return; + return IRQ_HANDLED; } /* @@ -208,7 +211,7 @@ twidjoy->dev.id.product = 0x0001; twidjoy->dev.id.version = 0x0100; - twidjoy->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); + twidjoy->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); for (bp = twidjoy_buttons; bp->bitmask; bp++) { for (i = 0; i < bp->bitmask; i++) @@ -218,8 +221,8 @@ twidjoy->dev.absbit[0] = BIT(ABS_X) | BIT(ABS_Y); for (i = 0; i < 2; i++) { - twidjoy->dev.absmax[ABS_X+i] = 50; - twidjoy->dev.absmin[ABS_X+i] = -50; + twidjoy->dev.absmax[ABS_X+i] = 50; + twidjoy->dev.absmin[ABS_X+i] = -50; /* TODO: arndt 20010708: Are these values appropriate? */ twidjoy->dev.absfuzz[ABS_X+i] = 4; diff -urN linux-2.6.7-rc2/drivers/input/joystick/warrior.c linux-2.6.7-rc3/drivers/input/joystick/warrior.c --- linux-2.6.7-rc2/drivers/input/joystick/warrior.c 2004-05-09 19:32:53.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/joystick/warrior.c 2004-06-07 12:55:05.858740513 -0700 @@ -11,18 +11,18 @@ /* * This program is free warftware; 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 + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * 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 * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * 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 , or by paper mail: * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic @@ -44,7 +44,7 @@ */ #define WARRIOR_MAX_LENGTH 16 -static char warrior_lengths[] = { 0, 4, 12, 3, 4, 4, 0, 0 }; +static char warrior_lengths[] = { 0, 4, 12, 3, 4, 4, 0, 0 }; static char *warrior_name = "Logitech WingMan Warrior"; /* @@ -114,7 +114,7 @@ warrior->data[warrior->idx++] = data; if (warrior->idx == warrior->len) { - if (warrior->idx) warrior_process_packet(warrior, regs); + if (warrior->idx) warrior_process_packet(warrior, regs); warrior->idx = 0; warrior->len = 0; } @@ -152,7 +152,7 @@ memset(warrior, 0, sizeof(struct warrior)); - warrior->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REL) | BIT(EV_ABS); + warrior->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REL) | BIT(EV_ABS); warrior->dev.keybit[LONG(BTN_TRIGGER)] = BIT(BTN_TRIGGER) | BIT(BTN_THUMB) | BIT(BTN_TOP) | BIT(BTN_TOP2); warrior->dev.relbit[0] = BIT(REL_DIAL); warrior->dev.absbit[0] = BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_THROTTLE) | BIT(ABS_HAT0X) | BIT(ABS_HAT0Y); @@ -168,24 +168,24 @@ warrior->dev.id.version = 0x0100; for (i = 0; i < 2; i++) { - warrior->dev.absmax[ABS_X+i] = -64; - warrior->dev.absmin[ABS_X+i] = 64; - warrior->dev.absflat[ABS_X+i] = 8; + warrior->dev.absmax[ABS_X+i] = -64; + warrior->dev.absmin[ABS_X+i] = 64; + warrior->dev.absflat[ABS_X+i] = 8; } - warrior->dev.absmax[ABS_THROTTLE] = -112; - warrior->dev.absmin[ABS_THROTTLE] = 112; + warrior->dev.absmax[ABS_THROTTLE] = -112; + warrior->dev.absmin[ABS_THROTTLE] = 112; for (i = 0; i < 2; i++) { - warrior->dev.absmax[ABS_HAT0X+i] = -1; - warrior->dev.absmin[ABS_HAT0X+i] = 1; + warrior->dev.absmax[ABS_HAT0X+i] = -1; + warrior->dev.absmin[ABS_HAT0X+i] = 1; } warrior->dev.private = warrior; - + serio->private = warrior; - if (serio_open(serio, dev)) { + if (serio_open(serio, dev)) { kfree(warrior); return; } diff -urN linux-2.6.7-rc2/drivers/input/keyboard/98kbd.c linux-2.6.7-rc3/drivers/input/keyboard/98kbd.c --- linux-2.6.7-rc2/drivers/input/keyboard/98kbd.c 2004-05-09 19:32:28.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/keyboard/98kbd.c 2004-06-07 12:55:05.903742377 -0700 @@ -12,18 +12,18 @@ /* * 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 + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * 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 * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * + * */ #include @@ -43,7 +43,7 @@ #define KBD98_KEY 0x7f #define KBD98_RELEASE 0x80 -static unsigned char kbd98_keycode[256] = { +static unsigned char kbd98_keycode[256] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 43, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 41, 26, 28, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 27, 44, 45, 46, 47, 48, 49, 50, @@ -109,8 +109,8 @@ struct jis_kbd_conv jis[16]; }; -void kbd98_interrupt(struct serio *serio, unsigned char data, - unsigned int flags, struct pt_regs *regs) +irqreturn_t kbd98_interrupt(struct serio *serio, unsigned char data, + unsigned int flags, struct pt_regs *regs) { struct kbd98 *kbd98 = serio->private; unsigned char scancode, keycode; @@ -119,15 +119,15 @@ switch (data) { case KBD98_RET_ACK: kbd98->ack = 1; - return; + goto out; case KBD98_RET_NAK: kbd98->ack = -1; - return; + goto out; } if (kbd98->cmdcnt) { kbd98->cmdbuf[--kbd98->cmdcnt] = data; - return; + goto out; } scancode = data & KBD98_KEY; @@ -164,7 +164,7 @@ keycode = kbd98->jis[i].emul[kbd98->shift].keycode; if (keycode == KBD98_KEY_NULL) - return; + break; if (press) { kbd98->emul.scancode = scancode; @@ -187,27 +187,31 @@ } input_sync(&kbd98->dev); - return; + break; case KEY_CAPSLOCK: input_report_key(&kbd98->dev, keycode, 1); input_sync(&kbd98->dev); input_report_key(&kbd98->dev, keycode, 0); input_sync(&kbd98->dev); - return; + break; case KBD98_KEY_NULL: - return; + break; case 0: printk(KERN_WARNING "kbd98.c: Unknown key (scancode %#x) %s.\n", data & KBD98_KEY, data & KBD98_RELEASE ? "released" : "pressed"); - return; + break; default: input_report_key(&kbd98->dev, keycode, press); input_sync(&kbd98->dev); - } + break; + } + +out: + return IRQ_HANDLED; } /* @@ -243,7 +247,7 @@ int i; kbd98->cmdcnt = receive; - + if (command & 0xff) if (kbd98_sendbyte(kbd98, command & 0xff)) return (kbd98->cmdcnt = 0) - 1; @@ -258,7 +262,7 @@ for (i = 0; i < receive; i++) param[i] = kbd98->cmdbuf[(receive - 1) - i]; - if (kbd98->cmdcnt) + if (kbd98->cmdcnt) return (kbd98->cmdcnt = 0) - 1; return 0; @@ -318,7 +322,7 @@ memset(kbd98, 0, sizeof(struct kbd98)); kbd98->emul.scancode = KBD98_KEY_UNKNOWN; - + kbd98->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_LED) | BIT(EV_REP); kbd98->dev.ledbit[0] = BIT(LED_NUML) | BIT(LED_CAPSL) | BIT(LED_KANA); diff -urN linux-2.6.7-rc2/drivers/input/keyboard/Kconfig linux-2.6.7-rc3/drivers/input/keyboard/Kconfig --- linux-2.6.7-rc2/drivers/input/keyboard/Kconfig 2004-05-09 19:33:20.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/keyboard/Kconfig 2004-06-07 12:55:05.903742377 -0700 @@ -62,7 +62,7 @@ Say Y here if you want to use the old IBM PC/XT keyboard (or compatible) on your system. This is only possible with a parallel port keyboard adapter, you cannot connect it to the - keyboard port on a PC that runs Linux. + keyboard port on a PC that runs Linux. To compile this driver as a module, choose M here: the module will be called xtkbd. @@ -92,7 +92,7 @@ depends on AMIGA && INPUT && INPUT_KEYBOARD help Say Y here if you are running Linux on any AMIGA and have a keyboard - attached. + attached. To compile this driver as a module, choose M here: the module will be called amikbd. @@ -103,7 +103,7 @@ select SERIO help Say Y here if you want to use the NEC PC-9801/PC-9821 keyboard (or - compatible) on your system. + compatible) on your system. To compile this driver as a module, choose M here: the module will be called 98kbd. diff -urN linux-2.6.7-rc2/drivers/input/keyboard/atkbd.c linux-2.6.7-rc3/drivers/input/keyboard/atkbd.c --- linux-2.6.7-rc2/drivers/input/keyboard/atkbd.c 2004-05-09 19:33:13.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/keyboard/atkbd.c 2004-06-07 12:55:05.904742418 -0700 @@ -26,7 +26,6 @@ #include #include #include -#include MODULE_AUTHOR("Vojtech Pavlik "); MODULE_DESCRIPTION("AT and PS/2 keyboard driver"); @@ -173,22 +172,24 @@ unsigned char keycode[512]; struct input_dev dev; struct serio *serio; - struct timer_list timer; + char name[64]; char phys[32]; + unsigned short id; + unsigned char set; + unsigned int translated:1; + unsigned int extra:1; + unsigned int write:1; + unsigned char cmdbuf[4]; unsigned char cmdcnt; - unsigned char set; - unsigned char extra; - unsigned char release; - int lastkey; volatile signed char ack; unsigned char emul; - unsigned short id; - unsigned char write; - unsigned char translated; - unsigned char resend; - unsigned char bat_xl; + unsigned int resend:1; + unsigned int release:1; + unsigned int bat_xl:1; + unsigned int enabled:1; + unsigned int last; unsigned long time; }; @@ -248,6 +249,9 @@ goto out; } + if (!atkbd->enabled) + goto out; + if (atkbd->translated) { if (atkbd->emul || @@ -300,15 +304,20 @@ case ATKBD_KEY_NULL: break; case ATKBD_KEY_UNKNOWN: - printk(KERN_WARNING "atkbd.c: Unknown key %s (%s set %d, code %#x on %s).\n", - atkbd->release ? "released" : "pressed", - atkbd->translated ? "translated" : "raw", - atkbd->set, code, serio->phys); - if (atkbd->translated && atkbd->set == 2 && code == 0x7a) - printk(KERN_WARNING "atkbd.c: This is an XFree86 bug. It shouldn't access" - " hardware directly.\n"); - else - printk(KERN_WARNING "atkbd.c: Use 'setkeycodes %s%02x ' to make it known.\n", code & 0x80 ? "e0" : "", code & 0x7f); + if (data == ATKBD_RET_ACK || data == ATKBD_RET_NAK) { + printk(KERN_WARNING "atkbd.c: Spurious %s on %s. Some program, " + "like XFree86, might be trying access hardware directly.\n", + data == ATKBD_RET_ACK ? "ACK" : "NAK", serio->phys); + } else { + printk(KERN_WARNING "atkbd.c: Unknown key %s " + "(%s set %d, code %#x on %s).\n", + atkbd->release ? "released" : "pressed", + atkbd->translated ? "translated" : "raw", + atkbd->set, code, serio->phys); + printk(KERN_WARNING "atkbd.c: Use 'setkeycodes %s%02x ' " + "to make it known.\n", + code & 0x80 ? "e0" : "", code & 0x7f); + } break; case ATKBD_SCR_1: scroll = 1 - atkbd->release * 2; @@ -745,6 +754,8 @@ atkbd->id = 0xab00; } + atkbd->enabled = 1; + if (atkbd->extra) { atkbd->dev.ledbit[0] |= BIT(LED_COMPOSE) | BIT(LED_SUSPEND) | BIT(LED_SLEEP) | BIT(LED_MUTE) | BIT(LED_MISC); sprintf(atkbd->name, "AT Set 2 Extra keyboard"); @@ -809,12 +820,12 @@ param[0] = (test_bit(LED_SCROLLL, atkbd->dev.led) ? 1 : 0) | (test_bit(LED_NUML, atkbd->dev.led) ? 2 : 0) | (test_bit(LED_CAPSL, atkbd->dev.led) ? 4 : 0); - + if (atkbd_probe(atkbd)) return -1; if (atkbd->set != atkbd_set_3(atkbd)) return -1; - + atkbd_enable(atkbd); if (atkbd_command(atkbd, param, ATKBD_CMD_SETLEDS)) diff -urN linux-2.6.7-rc2/drivers/input/keyboard/maple_keyb.c linux-2.6.7-rc3/drivers/input/keyboard/maple_keyb.c --- linux-2.6.7-rc2/drivers/input/keyboard/maple_keyb.c 2004-05-09 19:32:27.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/keyboard/maple_keyb.c 2004-06-07 12:55:05.904742418 -0700 @@ -139,7 +139,7 @@ kbd->dev.name = dev->product_name; kbd->dev.id.bustype = BUS_MAPLE; - + input_register_device(&kbd->dev); maple_getcond_callback(dev, dc_kbd_callback, 1, MAPLE_FUNC_KEYBOARD); diff -urN linux-2.6.7-rc2/drivers/input/keyboard/sunkbd.c linux-2.6.7-rc3/drivers/input/keyboard/sunkbd.c --- linux-2.6.7-rc2/drivers/input/keyboard/sunkbd.c 2004-05-09 19:31:56.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/keyboard/sunkbd.c 2004-06-07 12:55:05.905742460 -0700 @@ -11,18 +11,18 @@ /* * 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 + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * 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 * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * 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 , or by paper mail: * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic @@ -148,7 +148,7 @@ case EV_LED: sunkbd->serio->write(sunkbd->serio, SUNKBD_CMD_SETLED); - sunkbd->serio->write(sunkbd->serio, + sunkbd->serio->write(sunkbd->serio, (!!test_bit(LED_CAPSL, dev->led) << 3) | (!!test_bit(LED_SCROLLL, dev->led) << 2) | (!!test_bit(LED_COMPOSE, dev->led) << 1) | !!test_bit(LED_NUML, dev->led)); return 0; @@ -160,7 +160,7 @@ case SND_CLICK: sunkbd->serio->write(sunkbd->serio, SUNKBD_CMD_NOCLICK - value); return 0; - + case SND_BELL: sunkbd->serio->write(sunkbd->serio, SUNKBD_CMD_BELLOFF - value); return 0; @@ -210,7 +210,7 @@ wait_event_interruptible_timeout(sunkbd->wait, sunkbd->reset >= 0, HZ); sunkbd->serio->write(sunkbd->serio, SUNKBD_CMD_SETLED); - sunkbd->serio->write(sunkbd->serio, + sunkbd->serio->write(sunkbd->serio, (!!test_bit(LED_CAPSL, sunkbd->dev.led) << 3) | (!!test_bit(LED_SCROLLL, sunkbd->dev.led) << 2) | (!!test_bit(LED_COMPOSE, sunkbd->dev.led) << 1) | !!test_bit(LED_NUML, sunkbd->dev.led)); sunkbd->serio->write(sunkbd->serio, SUNKBD_CMD_NOCLICK - !!test_bit(SND_CLICK, sunkbd->dev.snd)); @@ -231,7 +231,7 @@ if ((serio->type & SERIO_PROTO) && (serio->type & SERIO_PROTO) != SERIO_SUNKBD) return; - + if (!(sunkbd = kmalloc(sizeof(struct sunkbd), GFP_KERNEL))) return; diff -urN linux-2.6.7-rc2/drivers/input/keyboard/xtkbd.c linux-2.6.7-rc3/drivers/input/keyboard/xtkbd.c --- linux-2.6.7-rc2/drivers/input/keyboard/xtkbd.c 2004-05-09 19:32:37.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/keyboard/xtkbd.c 2004-06-07 12:55:05.905742460 -0700 @@ -11,18 +11,18 @@ /* * 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 + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * 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 * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * 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 , or by paper mail: * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic @@ -43,7 +43,7 @@ #define XTKBD_KEY 0x7f #define XTKBD_RELEASE 0x80 -static unsigned char xtkbd_keycode[256] = { +static unsigned char xtkbd_keycode[256] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, @@ -98,7 +98,7 @@ return; memset(xtkbd, 0, sizeof(struct xtkbd)); - + xtkbd->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REP); xtkbd->serio = serio; diff -urN linux-2.6.7-rc2/drivers/input/misc/98spkr.c linux-2.6.7-rc3/drivers/input/misc/98spkr.c --- linux-2.6.7-rc2/drivers/input/misc/98spkr.c 2004-06-07 12:54:49.019043068 -0700 +++ linux-2.6.7-rc3/drivers/input/misc/98spkr.c 2004-06-07 12:55:05.905742460 -0700 @@ -42,11 +42,11 @@ case SND_BELL: if (value) value = 1000; case SND_TONE: break; default: return -1; - } + } if (value > 20 && value < 32767) count = PIT_TICK_RATE / value; - + spin_lock_irqsave(&i8253_beep_lock, flags); if (count) { diff -urN linux-2.6.7-rc2/drivers/input/misc/pcspkr.c linux-2.6.7-rc3/drivers/input/misc/pcspkr.c --- linux-2.6.7-rc2/drivers/input/misc/pcspkr.c 2004-06-07 12:54:49.020043110 -0700 +++ linux-2.6.7-rc3/drivers/input/misc/pcspkr.c 2004-06-07 12:55:05.907742542 -0700 @@ -41,11 +41,11 @@ case SND_BELL: if (value) value = 1000; case SND_TONE: break; default: return -1; - } + } if (value > 20 && value < 32767) count = PIT_TICK_RATE / value; - + spin_lock_irqsave(&i8253_beep_lock, flags); if (count) { diff -urN linux-2.6.7-rc2/drivers/input/misc/sparcspkr.c linux-2.6.7-rc3/drivers/input/misc/sparcspkr.c --- linux-2.6.7-rc2/drivers/input/misc/sparcspkr.c 2004-05-09 19:33:20.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/misc/sparcspkr.c 2004-06-07 12:55:05.907742542 -0700 @@ -53,11 +53,11 @@ case SND_BELL: if (value) value = 1000; case SND_TONE: break; default: return -1; - } + } if (value > 20 && value < 32767) count = 1193182 / value; - + spin_lock_irqsave(&beep_lock, flags); /* EBUS speaker only has on/off state, the frequency does not @@ -108,11 +108,11 @@ case SND_BELL: if (value) value = 1000; case SND_TONE: break; default: return -1; - } + } if (value > 20 && value < 32767) count = 1193182 / value; - + spin_lock_irqsave(&beep_lock, flags); if (count) { diff -urN linux-2.6.7-rc2/drivers/input/misc/uinput.c linux-2.6.7-rc3/drivers/input/misc/uinput.c --- linux-2.6.7-rc2/drivers/input/misc/uinput.c 2004-05-09 19:33:13.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/misc/uinput.c 2004-06-07 12:55:05.908742584 -0700 @@ -18,7 +18,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Author: Aristeu Sergio Rozanski Filho - * + * * Changes/Revisions: * 0.1 20/06/2002 * - first public version @@ -68,7 +68,7 @@ static int uinput_dev_erase_effect(struct input_dev *dev, int effect_id) { return 0; -} +} static int uinput_create_device(struct uinput_device *udev) { @@ -123,7 +123,7 @@ memset(newinput, 0, sizeof(struct input_dev)); newdev->dev = newinput; - + file->private_data = newdev; return 0; @@ -137,16 +137,16 @@ { unsigned int cnt; int retval = 0; - + for (cnt = 0; cnt < ABS_MAX; cnt++) { - if (!test_bit(cnt, dev->absbit)) + if (!test_bit(cnt, dev->absbit)) continue; - + if (/*!dev->absmin[cnt] || !dev->absmax[cnt] || */ (dev->absmax[cnt] <= dev->absmin[cnt])) { - printk(KERN_DEBUG + printk(KERN_DEBUG "%s: invalid abs[%02x] min:%d max:%d\n", - UINPUT_NAME, cnt, + UINPUT_NAME, cnt, dev->absmin[cnt], dev->absmax[cnt]); retval = -EINVAL; break; @@ -154,7 +154,7 @@ if ((dev->absflat[cnt] < dev->absmin[cnt]) || (dev->absflat[cnt] > dev->absmax[cnt])) { - printk(KERN_DEBUG + printk(KERN_DEBUG "%s: absflat[%02x] out of range: %d " "(min:%d/max:%d)\n", UINPUT_NAME, cnt, dev->absflat[cnt], @@ -190,7 +190,7 @@ goto exit; } - if (NULL != dev->name) + if (NULL != dev->name) kfree(dev->name); size = strnlen(user_dev->name, UINPUT_MAX_NAME_SIZE) + 1; @@ -229,7 +229,7 @@ static ssize_t uinput_write(struct file *file, const char *buffer, size_t count, loff_t *ppos) { struct uinput_device *udev = file->private_data; - + if (test_bit(UIST_CREATED, &(udev->state))) { struct input_event ev; @@ -247,7 +247,7 @@ { struct uinput_device *udev = file->private_data; int retval = 0; - + if (!test_bit(UIST_CREATED, &(udev->state))) return -ENODEV; @@ -255,16 +255,16 @@ return -EAGAIN; retval = wait_event_interruptible(udev->waitq, - (udev->head != udev->tail) || + (udev->head != udev->tail) || !test_bit(UIST_CREATED, &(udev->state))); - + if (retval) return retval; if (!test_bit(UIST_CREATED, &(udev->state))) return -ENODEV; - while ((udev->head != udev->tail) && + while ((udev->head != udev->tail) && (retval + sizeof(struct input_event) <= count)) { if (copy_to_user(buffer + retval, &(udev->buff[udev->tail]), sizeof(struct input_event))) return -EFAULT; @@ -284,7 +284,7 @@ if (udev->head != udev->tail) return POLLIN | POLLRDNORM; - return 0; + return 0; } static int uinput_burn_device(struct uinput_device *udev) @@ -318,7 +318,7 @@ case UI_DEV_CREATE: retval = uinput_create_device(udev); break; - + case UI_DEV_DESTROY: retval = uinput_destroy_device(udev); break; @@ -330,7 +330,7 @@ } set_bit(arg, udev->dev->evbit); break; - + case UI_SET_KEYBIT: if (arg > KEY_MAX) { retval = -EINVAL; @@ -338,7 +338,7 @@ } set_bit(arg, udev->dev->keybit); break; - + case UI_SET_RELBIT: if (arg > REL_MAX) { retval = -EINVAL; @@ -346,7 +346,7 @@ } set_bit(arg, udev->dev->relbit); break; - + case UI_SET_ABSBIT: if (arg > ABS_MAX) { retval = -EINVAL; @@ -354,7 +354,7 @@ } set_bit(arg, udev->dev->absbit); break; - + case UI_SET_MSCBIT: if (arg > MSC_MAX) { retval = -EINVAL; @@ -362,7 +362,7 @@ } set_bit(arg, udev->dev->mscbit); break; - + case UI_SET_LEDBIT: if (arg > LED_MAX) { retval = -EINVAL; @@ -370,7 +370,7 @@ } set_bit(arg, udev->dev->ledbit); break; - + case UI_SET_SNDBIT: if (arg > SND_MAX) { retval = -EINVAL; @@ -378,7 +378,7 @@ } set_bit(arg, udev->dev->sndbit); break; - + case UI_SET_FFBIT: if (arg > FF_MAX) { retval = -EINVAL; @@ -386,7 +386,7 @@ } set_bit(arg, udev->dev->ffbit); break; - + default: retval = -EFAULT; } diff -urN linux-2.6.7-rc2/drivers/input/mouse/logips2pp.c linux-2.6.7-rc3/drivers/input/mouse/logips2pp.c --- linux-2.6.7-rc2/drivers/input/mouse/logips2pp.c 2004-05-09 19:32:52.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/mouse/logips2pp.c 2004-06-07 12:55:05.910742667 -0700 @@ -14,6 +14,25 @@ #include "psmouse.h" #include "logips2pp.h" +/* Logitech mouse types */ +#define PS2PP_KIND_WHEEL 1 +#define PS2PP_KIND_MX 2 +#define PS2PP_KIND_TP3 3 + +/* Logitech mouse features */ +#define PS2PP_WHEEL 0x01 +#define PS2PP_HWHEEL 0x02 +#define PS2PP_SIDE_BTN 0x04 +#define PS2PP_EXTRA_BTN 0x08 +#define PS2PP_TASK_BTN 0x10 +#define PS2PP_NAV_BTN 0x20 + +struct ps2pp_info { + const int model; + unsigned const int kind; + unsigned const int features; +}; + /* * Process a PS2++ or PS2T++ packet. */ @@ -63,7 +82,6 @@ packet[0] &= 0x0f; packet[1] = 0; packet[2] = 0; - } } @@ -76,18 +94,9 @@ static int ps2pp_cmd(struct psmouse *psmouse, unsigned char *param, unsigned char command) { - unsigned char d; - int i; - - if (psmouse_command(psmouse, NULL, PSMOUSE_CMD_SETSCALE11)) + if (psmouse_sliced_command(psmouse, command)) return -1; - for (i = 6; i >= 0; i -= 2) { - d = (command >> i) & 3; - if(psmouse_command(psmouse, &d, PSMOUSE_CMD_SETRES)) - return -1; - } - if (psmouse_command(psmouse, param, PSMOUSE_CMD_POLL)) return -1; @@ -99,7 +108,7 @@ * enabled if we do nothing to it. Of course I put this in because I want it * disabled :P * 1 - enabled (if previously disabled, also default) - * 0/2 - disabled + * 0/2 - disabled */ static void ps2pp_set_smartscroll(struct psmouse *psmouse) @@ -113,14 +122,11 @@ psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES); psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES); - if (psmouse_smartscroll == 1) - param[0] = 1; - else - if (psmouse_smartscroll > 2) - return; - - /* else leave param[0] == 0 to disable */ - psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES); + if (psmouse_smartscroll < 2) { + /* 0 - disabled, 1 - enabled */ + param[0] = psmouse_smartscroll; + psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES); + } } /* @@ -138,133 +144,167 @@ psmouse_command(psmouse, ¶m, PSMOUSE_CMD_SETRES); } +static struct ps2pp_info *get_model_info(unsigned char model) +{ + static struct ps2pp_info ps2pp_list[] = { + { 12, 0, PS2PP_SIDE_BTN}, + { 13, 0, 0 }, + { 40, 0, PS2PP_SIDE_BTN }, + { 41, 0, PS2PP_SIDE_BTN }, + { 42, 0, PS2PP_SIDE_BTN }, + { 43, 0, PS2PP_SIDE_BTN }, + { 50, 0, 0 }, + { 51, 0, 0 }, + { 52, PS2PP_KIND_WHEEL, PS2PP_SIDE_BTN | PS2PP_WHEEL }, + { 53, PS2PP_KIND_WHEEL, PS2PP_WHEEL }, + { 61, PS2PP_KIND_MX, + PS2PP_WHEEL | PS2PP_SIDE_BTN | PS2PP_TASK_BTN | + PS2PP_EXTRA_BTN | PS2PP_NAV_BTN }, /* MX700 */ + { 73, 0, PS2PP_SIDE_BTN }, + { 75, PS2PP_KIND_WHEEL, PS2PP_WHEEL }, + { 76, PS2PP_KIND_WHEEL, PS2PP_WHEEL }, + { 80, PS2PP_KIND_WHEEL, PS2PP_SIDE_BTN | PS2PP_WHEEL }, + { 81, PS2PP_KIND_WHEEL, PS2PP_WHEEL }, + { 83, PS2PP_KIND_WHEEL, PS2PP_WHEEL }, + { 88, PS2PP_KIND_WHEEL, PS2PP_WHEEL }, + { 96, 0, 0 }, + { 97, PS2PP_KIND_TP3, PS2PP_WHEEL | PS2PP_HWHEEL }, + { 100, PS2PP_KIND_MX, + PS2PP_WHEEL | PS2PP_SIDE_BTN | PS2PP_TASK_BTN | + PS2PP_EXTRA_BTN | PS2PP_NAV_BTN }, /* MX510 */ + { 112, PS2PP_KIND_MX, + PS2PP_WHEEL | PS2PP_SIDE_BTN | PS2PP_TASK_BTN | + PS2PP_EXTRA_BTN | PS2PP_NAV_BTN }, /* MX500 */ + { 114, PS2PP_KIND_MX, + PS2PP_WHEEL | PS2PP_SIDE_BTN | + PS2PP_TASK_BTN | PS2PP_EXTRA_BTN }, /* M310 */ + { } + }; + int i; + + for (i = 0; ps2pp_list[i].model; i++) + if (model == ps2pp_list[i].model) + return &ps2pp_list[i]; + return NULL; +} + /* - * Detect the exact model and features of a PS2++ or PS2T++ Logitech mouse or - * touchpad. + * Set up input device's properties based on the detected mouse model. */ -static int ps2pp_detect_model(struct psmouse *psmouse, unsigned char *param) +static void ps2pp_set_model_properties(struct psmouse *psmouse, struct ps2pp_info *model_info) { - int i; - static struct _logips2_list { - const int model; - unsigned const int features; - } logips2pp_list [] = { - { 12, PS2PP_4BTN}, - { 13, 0 }, - { 40, PS2PP_4BTN }, - { 41, PS2PP_4BTN }, - { 42, PS2PP_4BTN }, - { 43, PS2PP_4BTN }, - { 50, 0 }, - { 51, 0 }, - { 52, PS2PP_4BTN | PS2PP_WHEEL }, - { 53, PS2PP_WHEEL }, - { 61, PS2PP_WHEEL | PS2PP_MX }, /* MX700 */ - { 73, PS2PP_4BTN }, - { 75, PS2PP_WHEEL }, - { 76, PS2PP_WHEEL }, - { 80, PS2PP_4BTN | PS2PP_WHEEL }, - { 81, PS2PP_WHEEL }, - { 83, PS2PP_WHEEL }, - { 88, PS2PP_WHEEL }, - { 96, 0 }, - { 97, 0 }, - { 100 , PS2PP_WHEEL | PS2PP_MX }, /* MX510 */ - { 112 , PS2PP_WHEEL | PS2PP_MX }, /* MX500 */ - { 114 , PS2PP_WHEEL | PS2PP_MX | PS2PP_MX310 }, /* MX310 */ - { } - }; + if (model_info->features & PS2PP_SIDE_BTN) + set_bit(BTN_SIDE, psmouse->dev.keybit); - psmouse->vendor = "Logitech"; - psmouse->model = ((param[0] >> 4) & 0x07) | ((param[0] << 3) & 0x78); + if (model_info->features & PS2PP_EXTRA_BTN) + set_bit(BTN_EXTRA, psmouse->dev.keybit); - if (param[1] < 3) - clear_bit(BTN_MIDDLE, psmouse->dev.keybit); - if (param[1] < 2) - clear_bit(BTN_RIGHT, psmouse->dev.keybit); - - psmouse->type = PSMOUSE_PS2; - - for (i = 0; logips2pp_list[i].model; i++){ - if (logips2pp_list[i].model == psmouse->model){ - psmouse->type = PSMOUSE_PS2PP; - if (logips2pp_list[i].features & PS2PP_4BTN) - set_bit(BTN_SIDE, psmouse->dev.keybit); - - if (logips2pp_list[i].features & PS2PP_WHEEL){ - set_bit(REL_WHEEL, psmouse->dev.relbit); - psmouse->name = "Wheel Mouse"; - } - if (logips2pp_list[i].features & PS2PP_MX) { - set_bit(BTN_SIDE, psmouse->dev.keybit); - set_bit(BTN_EXTRA, psmouse->dev.keybit); - set_bit(BTN_TASK, psmouse->dev.keybit); - if (!(logips2pp_list[i].features & PS2PP_MX310)){ - set_bit(BTN_BACK, psmouse->dev.keybit); - set_bit(BTN_FORWARD, psmouse->dev.keybit); - } - psmouse->name = "MX Mouse"; - } + if (model_info->features & PS2PP_TASK_BTN) + set_bit(BTN_TASK, psmouse->dev.keybit); + + if (model_info->features & PS2PP_NAV_BTN) { + set_bit(BTN_FORWARD, psmouse->dev.keybit); + set_bit(BTN_BACK, psmouse->dev.keybit); + } + + if (model_info->features & PS2PP_WHEEL) + set_bit(REL_WHEEL, psmouse->dev.relbit); + + if (model_info->features & PS2PP_HWHEEL) + set_bit(REL_HWHEEL, psmouse->dev.relbit); + + switch (model_info->kind) { + case PS2PP_KIND_WHEEL: + psmouse->name = "Wheel Mouse"; + break; + + case PS2PP_KIND_MX: + psmouse->name = "MX Mouse"; + break; + + case PS2PP_KIND_TP3: + psmouse->name = "TouchPad 3"; break; - } } +} + + /* - * Do Logitech PS2++ / PS2T++ magic init. + * Logitech magic init. Detect whether the mouse is a Logitech one + * and its exact model and try turning on extended protocol for ones + * that support it. */ - if (psmouse->type == PSMOUSE_PS2PP) { - if (psmouse->model == 97) { /* TouchPad 3 */ +int ps2pp_init(struct psmouse *psmouse, int set_properties) +{ + unsigned char param[4]; + unsigned char protocol = PSMOUSE_PS2; + unsigned char model, buttons; + struct ps2pp_info *model_info; - set_bit(REL_WHEEL, psmouse->dev.relbit); - set_bit(REL_HWHEEL, psmouse->dev.relbit); + param[0] = 0; + psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES); + psmouse_command(psmouse, NULL, PSMOUSE_CMD_SETSCALE11); + psmouse_command(psmouse, NULL, PSMOUSE_CMD_SETSCALE11); + psmouse_command(psmouse, NULL, PSMOUSE_CMD_SETSCALE11); + param[1] = 0; + psmouse_command(psmouse, param, PSMOUSE_CMD_GETINFO); + + if (param[1] != 0) { + model = ((param[0] >> 4) & 0x07) | ((param[0] << 3) & 0x78); + buttons = param[1]; + model_info = get_model_info(model); + +/* + * Do Logitech PS2++ / PS2T++ magic init. + */ + if (model == 97) { /* Touch Pad 3 */ - param[0] = 0x11; param[1] = 0x04; param[2] = 0x68; /* Unprotect RAM */ + /* Unprotect RAM */ + param[0] = 0x11; param[1] = 0x04; param[2] = 0x68; psmouse_command(psmouse, param, 0x30d1); - param[0] = 0x11; param[1] = 0x05; param[2] = 0x0b; /* Enable features */ + /* Enable features */ + param[0] = 0x11; param[1] = 0x05; param[2] = 0x0b; psmouse_command(psmouse, param, 0x30d1); - param[0] = 0x11; param[1] = 0x09; param[2] = 0xc3; /* Enable PS2++ */ + /* Enable PS2++ */ + param[0] = 0x11; param[1] = 0x09; param[2] = 0xc3; psmouse_command(psmouse, param, 0x30d1); param[0] = 0; if (!psmouse_command(psmouse, param, 0x13d1) && - param[0] == 0x06 && param[1] == 0x00 && param[2] == 0x14) { - psmouse->name = "TouchPad 3"; - return PSMOUSE_PS2TPP; + param[0] == 0x06 && param[1] == 0x00 && param[2] == 0x14) { + protocol = PSMOUSE_PS2TPP; } - } else { + } else if (get_model_info(model) != NULL) { param[0] = param[1] = param[2] = 0; ps2pp_cmd(psmouse, param, 0x39); /* Magic knock */ ps2pp_cmd(psmouse, param, 0xDB); - if ((param[0] & 0x78) == 0x48 && (param[1] & 0xf3) == 0xc2 && - (param[2] & 3) == ((param[1] >> 2) & 3)) { - ps2pp_set_smartscroll(psmouse); - return PSMOUSE_PS2PP; + if ((param[0] & 0x78) == 0x48 && + (param[1] & 0xf3) == 0xc2 && + (param[2] & 0x03) == ((param[1] >> 2) & 3)) { + ps2pp_set_smartscroll(psmouse); + protocol = PSMOUSE_PS2PP; } } - } - return 0; -} - -/* - * Logitech magic init. - */ -int ps2pp_detect(struct psmouse *psmouse) -{ - unsigned char param[4]; + if (set_properties) { + psmouse->vendor = "Logitech"; + psmouse->model = model; + + if (buttons < 3) + clear_bit(BTN_MIDDLE, psmouse->dev.keybit); + if (buttons < 2) + clear_bit(BTN_RIGHT, psmouse->dev.keybit); - param[0] = 0; - psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES); - psmouse_command(psmouse, NULL, PSMOUSE_CMD_SETSCALE11); - psmouse_command(psmouse, NULL, PSMOUSE_CMD_SETSCALE11); - psmouse_command(psmouse, NULL, PSMOUSE_CMD_SETSCALE11); - param[1] = 0; - psmouse_command(psmouse, param, PSMOUSE_CMD_GETINFO); + if (model_info) + ps2pp_set_model_properties(psmouse, model_info); + } + } - return param[1] != 0 ? ps2pp_detect_model(psmouse, param) : 0; + return protocol; } diff -urN linux-2.6.7-rc2/drivers/input/mouse/logips2pp.h linux-2.6.7-rc3/drivers/input/mouse/logips2pp.h --- linux-2.6.7-rc2/drivers/input/mouse/logips2pp.h 2004-05-09 19:32:54.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/mouse/logips2pp.h 2004-06-07 12:55:05.910742667 -0700 @@ -11,13 +11,8 @@ #ifndef _LOGIPS2PP_H #define _LOGIPS2PP_H -#define PS2PP_4BTN 0x01 -#define PS2PP_WHEEL 0x02 -#define PS2PP_MX 0x04 -#define PS2PP_MX310 0x08 - -struct psmouse; void ps2pp_process_packet(struct psmouse *psmouse); void ps2pp_set_800dpi(struct psmouse *psmouse); -int ps2pp_detect(struct psmouse *psmouse); +int ps2pp_init(struct psmouse *psmouse, int set_properties); + #endif diff -urN linux-2.6.7-rc2/drivers/input/mouse/psmouse-base.c linux-2.6.7-rc3/drivers/input/mouse/psmouse-base.c --- linux-2.6.7-rc2/drivers/input/mouse/psmouse-base.c 2004-05-09 19:32:26.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/mouse/psmouse-base.c 2004-06-07 12:55:05.911742708 -0700 @@ -43,9 +43,9 @@ module_param_named(smartscroll, psmouse_smartscroll, bool, 0); MODULE_PARM_DESC(smartscroll, "Logitech Smartscroll autorepeat, 1 = enabled (default), 0 = disabled."); -unsigned int psmouse_resetafter; +static unsigned int psmouse_resetafter; module_param_named(resetafter, psmouse_resetafter, uint, 0); -MODULE_PARM_DESC(resetafter, "Reset Synaptics Touchpad after so many bad packets (0 = never)."); +MODULE_PARM_DESC(resetafter, "Reset device after so many bad packets (0 = never)."); __obsolete_setup("psmouse_noext"); __obsolete_setup("psmouse_resolution="); @@ -56,15 +56,22 @@ static char *psmouse_protocols[] = { "None", "PS/2", "PS2++", "PS2T++", "GenPS/2", "ImPS/2", "ImExPS/2", "SynPS/2"}; /* - * psmouse_process_packet() analyzes the PS/2 mouse packet contents and - * reports relevant events to the input module. + * psmouse_process_byte() analyzes the PS/2 data stream and reports + * relevant events to the input module once full packet has arrived. */ -static void psmouse_process_packet(struct psmouse *psmouse, struct pt_regs *regs) +static psmouse_ret_t psmouse_process_byte(struct psmouse *psmouse, struct pt_regs *regs) { struct input_dev *dev = &psmouse->dev; unsigned char *packet = psmouse->packet; + if (psmouse->pktcnt < 3 + (psmouse->type >= PSMOUSE_GENPS)) + return PSMOUSE_GOOD_DATA; + +/* + * Full packet accumulated, process it + */ + input_regs(dev, regs); /* @@ -112,6 +119,8 @@ input_report_rel(dev, REL_Y, packet[2] ? (int) ((packet[0] << 3) & 0x100) - (int) packet[2] : 0); input_sync(dev); + + return PSMOUSE_FULL_PACKET; } /* @@ -123,6 +132,7 @@ unsigned char data, unsigned int flags, struct pt_regs *regs) { struct psmouse *psmouse = serio->private; + psmouse_ret_t rc; if (psmouse->state == PSMOUSE_IGNORE) goto out; @@ -180,7 +190,7 @@ if (psmouse->pktcnt == 2) { if (psmouse->packet[1] == PSMOUSE_RET_ID) { psmouse->state = PSMOUSE_IGNORE; - serio_rescan(serio); + serio_reconnect(serio); goto out; } if (psmouse->type == PSMOUSE_SYNAPTICS) { @@ -193,19 +203,32 @@ } } - if (psmouse->type == PSMOUSE_SYNAPTICS) { - /* - * The synaptics driver has its own resync logic, - * so it needs to receive all bytes one at a time. - */ - synaptics_process_byte(psmouse, regs); - goto out; - } + rc = psmouse->protocol_handler(psmouse, regs); - if (psmouse->pktcnt == 3 + (psmouse->type >= PSMOUSE_GENPS)) { - psmouse_process_packet(psmouse, regs); - psmouse->pktcnt = 0; - goto out; + switch (rc) { + case PSMOUSE_BAD_DATA: + printk(KERN_WARNING "psmouse.c: %s at %s lost sync at byte %d\n", + psmouse->name, psmouse->phys, psmouse->pktcnt); + psmouse->pktcnt = 0; + + if (++psmouse->out_of_sync == psmouse_resetafter) { + psmouse->state = PSMOUSE_IGNORE; + printk(KERN_NOTICE "psmouse.c: issuing reconnect request\n"); + serio_reconnect(psmouse->serio); + } + break; + + case PSMOUSE_FULL_PACKET: + psmouse->pktcnt = 0; + if (psmouse->out_of_sync) { + psmouse->out_of_sync = 0; + printk(KERN_NOTICE "psmouse.c: %s at %s - driver resynched.\n", + psmouse->name, psmouse->phys); + } + break; + + case PSMOUSE_GOOD_DATA: + break; } out: return IRQ_HANDLED; @@ -289,6 +312,30 @@ /* + * psmouse_sliced_command() sends an extended PS/2 command to the mouse + * using sliced syntax, understood by advanced devices, such as Logitech + * or Synaptics touchpads. The command is encoded as: + * 0xE6 0xE8 rr 0xE8 ss 0xE8 tt 0xE8 uu where (rr*64)+(ss*16)+(tt*4)+uu + * is the command. + */ +int psmouse_sliced_command(struct psmouse *psmouse, unsigned char command) +{ + int i; + + if (psmouse_command(psmouse, NULL, PSMOUSE_CMD_SETSCALE11)) + return -1; + + for (i = 6; i >= 0; i -= 2) { + unsigned char d = (command >> i) & 3; + if (psmouse_command(psmouse, &d, PSMOUSE_CMD_SETRES)) + return -1; + } + + return 0; +} + + +/* * psmouse_reset() resets the mouse into power-on state. */ int psmouse_reset(struct psmouse *psmouse) @@ -363,31 +410,31 @@ * the mouse may have. */ -static int psmouse_extensions(struct psmouse *psmouse) +static int psmouse_extensions(struct psmouse *psmouse, + unsigned int max_proto, int set_properties) { int synaptics_hardware = 0; - psmouse->vendor = "Generic"; - psmouse->name = "Mouse"; - psmouse->model = 0; - /* * Try Synaptics TouchPad */ - if (psmouse_max_proto > PSMOUSE_PS2 && synaptics_detect(psmouse)) { + if (max_proto > PSMOUSE_PS2 && synaptics_detect(psmouse)) { synaptics_hardware = 1; - psmouse->vendor = "Synaptics"; - psmouse->name = "TouchPad"; - if (psmouse_max_proto > PSMOUSE_IMEX) { - if (synaptics_init(psmouse) == 0) + if (set_properties) { + psmouse->vendor = "Synaptics"; + psmouse->name = "TouchPad"; + } + + if (max_proto > PSMOUSE_IMEX) { + if (!set_properties || synaptics_init(psmouse) == 0) return PSMOUSE_SYNAPTICS; /* * Some Synaptics touchpads can emulate extended protocols (like IMPS/2). * Unfortunately Logitech/Genius probes confuse some firmware versions so * we'll have to skip them. */ - psmouse_max_proto = PSMOUSE_IMEX; + max_proto = PSMOUSE_IMEX; } /* * Make sure that touchpad is in relative mode, gestures (taps) are enabled @@ -395,35 +442,46 @@ synaptics_reset(psmouse); } - if (psmouse_max_proto > PSMOUSE_IMEX && genius_detect(psmouse)) { - set_bit(BTN_EXTRA, psmouse->dev.keybit); - set_bit(BTN_SIDE, psmouse->dev.keybit); - set_bit(REL_WHEEL, psmouse->dev.relbit); + if (max_proto > PSMOUSE_IMEX && genius_detect(psmouse)) { + + if (set_properties) { + set_bit(BTN_EXTRA, psmouse->dev.keybit); + set_bit(BTN_SIDE, psmouse->dev.keybit); + set_bit(REL_WHEEL, psmouse->dev.relbit); + psmouse->vendor = "Genius"; + psmouse->name = "Wheel Mouse"; + } - psmouse->vendor = "Genius"; - psmouse->name = "Wheel Mouse"; return PSMOUSE_GENPS; } - if (psmouse_max_proto > PSMOUSE_IMEX) { - int type = ps2pp_detect(psmouse); - if (type) + if (max_proto > PSMOUSE_IMEX) { + int type = ps2pp_init(psmouse, set_properties); + if (type > PSMOUSE_PS2) return type; } - if (psmouse_max_proto >= PSMOUSE_IMPS && intellimouse_detect(psmouse)) { - set_bit(REL_WHEEL, psmouse->dev.relbit); + if (max_proto >= PSMOUSE_IMEX && im_explorer_detect(psmouse)) { - if (psmouse_max_proto >= PSMOUSE_IMEX && - im_explorer_detect(psmouse)) { + if (set_properties) { + set_bit(REL_WHEEL, psmouse->dev.relbit); set_bit(BTN_SIDE, psmouse->dev.keybit); set_bit(BTN_EXTRA, psmouse->dev.keybit); + if (!psmouse->name) + psmouse->name = "Explorer Mouse"; + } + + return PSMOUSE_IMEX; + } + + if (max_proto >= PSMOUSE_IMPS && intellimouse_detect(psmouse)) { - psmouse->name = "Explorer Mouse"; - return PSMOUSE_IMEX; + if (set_properties) { + set_bit(REL_WHEEL, psmouse->dev.relbit); + if (!psmouse->name) + psmouse->name = "Wheel Mouse"; } - psmouse->name = "Wheel Mouse"; return PSMOUSE_IMPS; } @@ -473,12 +531,7 @@ if (psmouse_command(psmouse, NULL, PSMOUSE_CMD_RESET_DIS)) printk(KERN_WARNING "psmouse.c: Failed to reset mouse on %s\n", psmouse->serio->phys); -/* - * And here we try to determine if it has any extensions over the - * basic PS/2 3-button mouse. - */ - - return psmouse->type = psmouse_extensions(psmouse); + return 0; } /* @@ -616,7 +669,6 @@ psmouse->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REL); psmouse->dev.keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT); psmouse->dev.relbit[0] = BIT(REL_X) | BIT(REL_Y); - psmouse->state = PSMOUSE_CMD_MODE; psmouse->serio = serio; psmouse->dev.private = psmouse; @@ -628,13 +680,21 @@ return; } - if (psmouse_probe(psmouse) <= 0) { + if (psmouse_probe(psmouse) < 0) { serio_close(serio); kfree(psmouse); serio->private = NULL; return; } + psmouse->type = psmouse_extensions(psmouse, psmouse_max_proto, 1); + if (!psmouse->vendor) + psmouse->vendor = "Generic"; + if (!psmouse->name) + psmouse->name = "Mouse"; + if (!psmouse->protocol_handler) + psmouse->protocol_handler = psmouse_process_byte; + sprintf(psmouse->devname, "%s %s %s", psmouse_protocols[psmouse->type], psmouse->vendor, psmouse->name); sprintf(psmouse->phys, "%s/input0", @@ -668,27 +728,24 @@ { struct psmouse *psmouse = serio->private; struct serio_dev *dev = serio->dev; - int old_type; if (!dev || !psmouse) { printk(KERN_DEBUG "psmouse: reconnect request, but serio is disconnected, ignoring...\n"); return -1; } - old_type = psmouse->type; - psmouse->state = PSMOUSE_CMD_MODE; - psmouse->type = psmouse->acking = psmouse->cmdcnt = psmouse->pktcnt = 0; + psmouse->acking = psmouse->cmdcnt = psmouse->pktcnt = psmouse->out_of_sync = 0; if (psmouse->reconnect) { if (psmouse->reconnect(psmouse)) return -1; - } else if (psmouse_probe(psmouse) != old_type) + } else if (psmouse_probe(psmouse) < 0 || + psmouse->type != psmouse_extensions(psmouse, psmouse_max_proto, 0)) return -1; /* ok, the device type (and capabilities) match the old one, * we can continue using it, complete intialization */ - psmouse->type = old_type; psmouse_initialize(psmouse); if (psmouse->ptport) { diff -urN linux-2.6.7-rc2/drivers/input/mouse/psmouse.h linux-2.6.7-rc3/drivers/input/mouse/psmouse.h --- linux-2.6.7-rc2/drivers/input/mouse/psmouse.h 2004-05-09 19:33:19.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/mouse/psmouse.h 2004-06-07 12:55:05.912742750 -0700 @@ -22,6 +22,13 @@ #define PSMOUSE_ACTIVATED 1 #define PSMOUSE_IGNORE 2 +/* psmouse protocol handler return codes */ +typedef enum { + PSMOUSE_BAD_DATA, + PSMOUSE_GOOD_DATA, + PSMOUSE_FULL_PACKET +} psmouse_ret_t; + struct psmouse; struct psmouse_ptport { @@ -45,6 +52,7 @@ unsigned char type; unsigned char model; unsigned long last; + unsigned long out_of_sync; unsigned char state; char acking; volatile char ack; @@ -52,6 +60,7 @@ char devname[64]; char phys[32]; + psmouse_ret_t (*protocol_handler)(struct psmouse *psmouse, struct pt_regs *regs); int (*reconnect)(struct psmouse *psmouse); void (*disconnect)(struct psmouse *psmouse); }; @@ -65,10 +74,10 @@ #define PSMOUSE_SYNAPTICS 7 int psmouse_command(struct psmouse *psmouse, unsigned char *param, int command); +int psmouse_sliced_command(struct psmouse *psmouse, unsigned char command); int psmouse_reset(struct psmouse *psmouse); extern int psmouse_smartscroll; extern unsigned int psmouse_rate; -extern unsigned int psmouse_resetafter; #endif /* _PSMOUSE_H */ diff -urN linux-2.6.7-rc2/drivers/input/mouse/synaptics.c linux-2.6.7-rc3/drivers/input/mouse/synaptics.c --- linux-2.6.7-rc2/drivers/input/mouse/synaptics.c 2004-05-09 19:32:27.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/mouse/synaptics.c 2004-06-07 12:55:05.913742791 -0700 @@ -44,33 +44,11 @@ ****************************************************************************/ /* - * Use the Synaptics extended ps/2 syntax to write a special command byte. - * special command: 0xE8 rr 0xE8 ss 0xE8 tt 0xE8 uu where (rr*64)+(ss*16)+(tt*4)+uu - * is the command. A 0xF3 or 0xE9 must follow (see synaptics_send_cmd - * and synaptics_mode_cmd) - */ -static int synaptics_special_cmd(struct psmouse *psmouse, unsigned char command) -{ - int i; - - if (psmouse_command(psmouse, NULL, PSMOUSE_CMD_SETSCALE11)) - return -1; - - for (i = 6; i >= 0; i -= 2) { - unsigned char d = (command >> i) & 3; - if (psmouse_command(psmouse, &d, PSMOUSE_CMD_SETRES)) - return -1; - } - - return 0; -} - -/* * Send a command to the synpatics touchpad by special commands */ static int synaptics_send_cmd(struct psmouse *psmouse, unsigned char c, unsigned char *param) { - if (synaptics_special_cmd(psmouse, c)) + if (psmouse_sliced_command(psmouse, c)) return -1; if (psmouse_command(psmouse, param, PSMOUSE_CMD_GETINFO)) return -1; @@ -84,7 +62,7 @@ { unsigned char param[1]; - if (synaptics_special_cmd(psmouse, mode)) + if (psmouse_sliced_command(psmouse, mode)) return -1; param[0] = SYN_PS_SET_MODE2; if (psmouse_command(psmouse, param, PSMOUSE_CMD_SETRATE)) @@ -118,17 +96,31 @@ if (synaptics_send_cmd(psmouse, SYN_QUE_CAPABILITIES, cap)) return -1; - priv->capabilities = (cap[0]<<16) | (cap[1]<<8) | cap[2]; + priv->capabilities = (cap[0] << 16) | (cap[1] << 8) | cap[2]; priv->ext_cap = 0; if (!SYN_CAP_VALID(priv->capabilities)) return -1; - if (SYN_EXT_CAP_REQUESTS(priv->capabilities)) { + /* + * Unless capExtended is set the rest of the flags should be ignored + */ + if (!SYN_CAP_EXTENDED(priv->capabilities)) + priv->capabilities = 0; + + if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 1) { if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_CAPAB, cap)) { printk(KERN_ERR "Synaptics claims to have extended capabilities," " but I'm not able to read them."); - } else - priv->ext_cap = (cap[0]<<16) | (cap[1]<<8) | cap[2]; + } else { + priv->ext_cap = (cap[0] << 16) | (cap[1] << 8) | cap[2]; + + /* + * if nExtBtn is greater than 8 it should be considered + * invalid and treated as 0 + */ + if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) > 8) + priv->ext_cap &= 0xff0fff; + } } return 0; } @@ -167,11 +159,12 @@ if (SYN_CAP_EXTENDED(priv->capabilities)) { printk(KERN_INFO " Touchpad has extended capability bits\n"); - if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) && - SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) <= 8) + if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap)) printk(KERN_INFO " -> %d multi-buttons, i.e. besides standard buttons\n", (int)(SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap))); - else if (SYN_CAP_FOUR_BUTTON(priv->capabilities)) + if (SYN_CAP_MIDDLE_BUTTON(priv->capabilities)) + printk(KERN_INFO " -> middle button\n"); + if (SYN_CAP_FOUR_BUTTON(priv->capabilities)) printk(KERN_INFO " -> four buttons\n"); if (SYN_CAP_MULTIFINGER(priv->capabilities)) printk(KERN_INFO " -> multifinger detection\n"); @@ -219,21 +212,12 @@ /***************************************************************************** * Synaptics pass-through PS/2 port support ****************************************************************************/ -static int synaptics_pt_open(struct serio *port) -{ - return 0; -} - -static void synaptics_pt_close(struct serio *port) -{ -} - static int synaptics_pt_write(struct serio *port, unsigned char c) { struct psmouse *parent = port->driver; char rate_param = SYN_PS_CLIENT_CMD; /* indicates that we want pass-through port */ - if (synaptics_special_cmd(parent, c)) + if (psmouse_sliced_command(parent, c)) return -1; if (psmouse_command(parent, &rate_param, PSMOUSE_CMD_SETRATE)) return -1; @@ -289,166 +273,12 @@ port->serio.name = "Synaptics pass-through"; port->serio.phys = "synaptics-pt/serio0"; port->serio.write = synaptics_pt_write; - port->serio.open = synaptics_pt_open; - port->serio.close = synaptics_pt_close; port->serio.driver = psmouse; port->activate = synaptics_pt_activate; } /***************************************************************************** - * Driver initialization/cleanup functions - ****************************************************************************/ - -static inline void set_abs_params(struct input_dev *dev, int axis, int min, int max, int fuzz, int flat) -{ - dev->absmin[axis] = min; - dev->absmax[axis] = max; - dev->absfuzz[axis] = fuzz; - dev->absflat[axis] = flat; - - set_bit(axis, dev->absbit); -} - -static void set_input_params(struct input_dev *dev, struct synaptics_data *priv) -{ - set_bit(EV_ABS, dev->evbit); - set_abs_params(dev, ABS_X, XMIN_NOMINAL, XMAX_NOMINAL, 0, 0); - set_abs_params(dev, ABS_Y, YMIN_NOMINAL, YMAX_NOMINAL, 0, 0); - set_abs_params(dev, ABS_PRESSURE, 0, 255, 0, 0); - set_bit(ABS_TOOL_WIDTH, dev->absbit); - - set_bit(EV_KEY, dev->evbit); - set_bit(BTN_TOUCH, dev->keybit); - set_bit(BTN_TOOL_FINGER, dev->keybit); - set_bit(BTN_TOOL_DOUBLETAP, dev->keybit); - set_bit(BTN_TOOL_TRIPLETAP, dev->keybit); - - set_bit(BTN_LEFT, dev->keybit); - set_bit(BTN_RIGHT, dev->keybit); - set_bit(BTN_FORWARD, dev->keybit); - set_bit(BTN_BACK, dev->keybit); - if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap)) { - switch (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) & ~0x01) { - default: - /* - * if nExtBtn is greater than 8 it should be considered - * invalid and treated as 0 - */ - break; - case 8: - set_bit(BTN_7, dev->keybit); - set_bit(BTN_6, dev->keybit); - case 6: - set_bit(BTN_5, dev->keybit); - set_bit(BTN_4, dev->keybit); - case 4: - set_bit(BTN_3, dev->keybit); - set_bit(BTN_2, dev->keybit); - case 2: - set_bit(BTN_1, dev->keybit); - set_bit(BTN_0, dev->keybit); - break; - } - } - - clear_bit(EV_REL, dev->evbit); - clear_bit(REL_X, dev->relbit); - clear_bit(REL_Y, dev->relbit); -} - -void synaptics_reset(struct psmouse *psmouse) -{ - /* reset touchpad back to relative mode, gestures enabled */ - synaptics_mode_cmd(psmouse, 0); -} - -static void synaptics_disconnect(struct psmouse *psmouse) -{ - synaptics_reset(psmouse); - kfree(psmouse->private); -} - -static int synaptics_reconnect(struct psmouse *psmouse) -{ - struct synaptics_data *priv = psmouse->private; - struct synaptics_data old_priv = *priv; - - if (!synaptics_detect(psmouse)) - return -1; - - if (synaptics_query_hardware(psmouse)) { - printk(KERN_ERR "Unable to query Synaptics hardware.\n"); - return -1; - } - - if (old_priv.identity != priv->identity || - old_priv.model_id != priv->model_id || - old_priv.capabilities != priv->capabilities || - old_priv.ext_cap != priv->ext_cap) - return -1; - - if (synaptics_set_mode(psmouse, 0)) { - printk(KERN_ERR "Unable to initialize Synaptics hardware.\n"); - return -1; - } - - return 0; -} - -int synaptics_detect(struct psmouse *psmouse) -{ - unsigned char param[4]; - - param[0] = 0; - - psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES); - psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES); - psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES); - psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES); - psmouse_command(psmouse, param, PSMOUSE_CMD_GETINFO); - - return param[1] == 0x47; -} - -int synaptics_init(struct psmouse *psmouse) -{ - struct synaptics_data *priv; - - psmouse->private = priv = kmalloc(sizeof(struct synaptics_data), GFP_KERNEL); - if (!priv) - return -1; - memset(priv, 0, sizeof(struct synaptics_data)); - - if (synaptics_query_hardware(psmouse)) { - printk(KERN_ERR "Unable to query Synaptics hardware.\n"); - goto init_fail; - } - - if (synaptics_set_mode(psmouse, 0)) { - printk(KERN_ERR "Unable to initialize Synaptics hardware.\n"); - goto init_fail; - } - - priv->pkt_type = SYN_MODEL_NEWABS(priv->model_id) ? SYN_NEWABS : SYN_OLDABS; - - if (SYN_CAP_EXTENDED(priv->capabilities) && SYN_CAP_PASS_THROUGH(priv->capabilities)) - synaptics_pt_create(psmouse); - - print_ident(priv); - set_input_params(&psmouse->dev, priv); - - psmouse->disconnect = synaptics_disconnect; - psmouse->reconnect = synaptics_reconnect; - - return 0; - - init_fail: - kfree(priv); - return -1; -} - -/***************************************************************************** * Functions to interpret the absolute mode packets ****************************************************************************/ @@ -471,17 +301,17 @@ hw->left = (buf[0] & 0x01) ? 1 : 0; hw->right = (buf[0] & 0x02) ? 1 : 0; - if (SYN_CAP_EXTENDED(priv->capabilities) && - (SYN_CAP_FOUR_BUTTON(priv->capabilities))) { - hw->up = ((buf[3] & 0x01)) ? 1 : 0; - if (hw->left) - hw->up = !hw->up; - hw->down = ((buf[3] & 0x02)) ? 1 : 0; - if (hw->right) - hw->down = !hw->down; + + if (SYN_CAP_MIDDLE_BUTTON(priv->capabilities)) + hw->middle = ((buf[0] ^ buf[3]) & 0x01) ? 1 : 0; + + if (SYN_CAP_FOUR_BUTTON(priv->capabilities)) { + hw->up = ((buf[0] ^ buf[3]) & 0x01) ? 1 : 0; + hw->down = ((buf[0] ^ buf[3]) & 0x02) ? 1 : 0; } + if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) && - ((buf[3] & 2) ? !hw->right : hw->right)) { + ((buf[0] ^ buf[3]) & 0x02)) { switch (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) & ~0x01) { default: /* @@ -490,17 +320,17 @@ */ break; case 8: - hw->b7 = ((buf[5] & 0x08)) ? 1 : 0; - hw->b6 = ((buf[4] & 0x08)) ? 1 : 0; + hw->ext_buttons |= ((buf[5] & 0x08)) ? 0x80 : 0; + hw->ext_buttons |= ((buf[4] & 0x08)) ? 0x40 : 0; case 6: - hw->b5 = ((buf[5] & 0x04)) ? 1 : 0; - hw->b4 = ((buf[4] & 0x04)) ? 1 : 0; + hw->ext_buttons |= ((buf[5] & 0x04)) ? 0x20 : 0; + hw->ext_buttons |= ((buf[4] & 0x04)) ? 0x10 : 0; case 4: - hw->b3 = ((buf[5] & 0x02)) ? 1 : 0; - hw->b2 = ((buf[4] & 0x02)) ? 1 : 0; + hw->ext_buttons |= ((buf[5] & 0x02)) ? 0x08 : 0; + hw->ext_buttons |= ((buf[4] & 0x02)) ? 0x04 : 0; case 2: - hw->b1 = ((buf[5] & 0x01)) ? 1 : 0; - hw->b0 = ((buf[4] & 0x01)) ? 1 : 0; + hw->ext_buttons |= ((buf[5] & 0x01)) ? 0x02 : 0; + hw->ext_buttons |= ((buf[4] & 0x01)) ? 0x01 : 0; } } } else { @@ -525,6 +355,7 @@ struct synaptics_hw_state hw; int num_fingers; int finger_width; + int i; synaptics_parse_hw_state(psmouse->packet, priv, &hw); @@ -570,32 +401,20 @@ input_report_key(dev, BTN_TOOL_DOUBLETAP, num_fingers == 2); input_report_key(dev, BTN_TOOL_TRIPLETAP, num_fingers == 3); - input_report_key(dev, BTN_LEFT, hw.left); - input_report_key(dev, BTN_RIGHT, hw.right); - input_report_key(dev, BTN_FORWARD, hw.up); - input_report_key(dev, BTN_BACK, hw.down); - if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap)) - switch(SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) & ~0x01) { - default: - /* - * if nExtBtn is greater than 8 it should be considered - * invalid and treated as 0 - */ - break; - case 8: - input_report_key(dev, BTN_7, hw.b7); - input_report_key(dev, BTN_6, hw.b6); - case 6: - input_report_key(dev, BTN_5, hw.b5); - input_report_key(dev, BTN_4, hw.b4); - case 4: - input_report_key(dev, BTN_3, hw.b3); - input_report_key(dev, BTN_2, hw.b2); - case 2: - input_report_key(dev, BTN_1, hw.b1); - input_report_key(dev, BTN_0, hw.b0); - break; - } + input_report_key(dev, BTN_LEFT, hw.left); + input_report_key(dev, BTN_RIGHT, hw.right); + + if (SYN_CAP_MIDDLE_BUTTON(priv->capabilities)) + input_report_key(dev, BTN_MIDDLE, hw.middle); + + if (SYN_CAP_FOUR_BUTTON(priv->capabilities)) { + input_report_key(dev, BTN_FORWARD, hw.up); + input_report_key(dev, BTN_BACK, hw.down); + } + + for (i = 0; i < SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap); i++) + input_report_key(dev, BTN_0 + i, hw.ext_buttons & (1 << i)); + input_sync(dev); } @@ -607,6 +426,9 @@ static unsigned char oldabs_mask[] = { 0xC0, 0x60, 0x00, 0xC0, 0x60 }; static unsigned char oldabs_rslt[] = { 0xC0, 0x00, 0x00, 0x80, 0x00 }; + if (idx < 0 || idx > 4) + return 0; + switch (pkt_type) { case SYN_NEWABS: case SYN_NEWABS_RELAXED: @@ -637,7 +459,7 @@ return SYN_NEWABS_STRICT; } -void synaptics_process_byte(struct psmouse *psmouse, struct pt_regs *regs) +static psmouse_ret_t synaptics_process_byte(struct psmouse *psmouse, struct pt_regs *regs) { struct input_dev *dev = &psmouse->dev; struct synaptics_data *priv = psmouse->private; @@ -645,11 +467,6 @@ input_regs(dev, regs); if (psmouse->pktcnt >= 6) { /* Full packet received */ - if (priv->out_of_sync) { - priv->out_of_sync = 0; - printk(KERN_NOTICE "Synaptics driver resynced.\n"); - } - if (unlikely(priv->pkt_type == SYN_NEWABS)) priv->pkt_type = synaptics_detect_pkt_type(psmouse); @@ -657,16 +474,142 @@ synaptics_pass_pt_packet(&psmouse->ptport->serio, psmouse->packet); else synaptics_process_packet(psmouse); - psmouse->pktcnt = 0; - } else if (psmouse->pktcnt && - !synaptics_validate_byte(psmouse->packet, psmouse->pktcnt - 1, priv->pkt_type)) { - printk(KERN_WARNING "Synaptics driver lost sync at byte %d\n", psmouse->pktcnt); - psmouse->pktcnt = 0; - if (++priv->out_of_sync == psmouse_resetafter) { - psmouse->state = PSMOUSE_IGNORE; - printk(KERN_NOTICE "synaptics: issuing reconnect request\n"); - serio_reconnect(psmouse->serio); - } + return PSMOUSE_FULL_PACKET; + } + + return synaptics_validate_byte(psmouse->packet, psmouse->pktcnt - 1, priv->pkt_type) ? + PSMOUSE_GOOD_DATA : PSMOUSE_BAD_DATA; +} + +/***************************************************************************** + * Driver initialization/cleanup functions + ****************************************************************************/ +static void set_input_params(struct input_dev *dev, struct synaptics_data *priv) +{ + int i; + + set_bit(EV_ABS, dev->evbit); + input_set_abs_params(dev, ABS_X, XMIN_NOMINAL, XMAX_NOMINAL, 0, 0); + input_set_abs_params(dev, ABS_Y, YMIN_NOMINAL, YMAX_NOMINAL, 0, 0); + input_set_abs_params(dev, ABS_PRESSURE, 0, 255, 0, 0); + set_bit(ABS_TOOL_WIDTH, dev->absbit); + + set_bit(EV_KEY, dev->evbit); + set_bit(BTN_TOUCH, dev->keybit); + set_bit(BTN_TOOL_FINGER, dev->keybit); + set_bit(BTN_TOOL_DOUBLETAP, dev->keybit); + set_bit(BTN_TOOL_TRIPLETAP, dev->keybit); + + set_bit(BTN_LEFT, dev->keybit); + set_bit(BTN_RIGHT, dev->keybit); + + if (SYN_CAP_MIDDLE_BUTTON(priv->capabilities)) + set_bit(BTN_MIDDLE, dev->keybit); + + if (SYN_CAP_FOUR_BUTTON(priv->capabilities)) { + set_bit(BTN_FORWARD, dev->keybit); + set_bit(BTN_BACK, dev->keybit); + } + + for (i = 0; i < SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap); i++) + set_bit(BTN_0 + i, dev->keybit); + + clear_bit(EV_REL, dev->evbit); + clear_bit(REL_X, dev->relbit); + clear_bit(REL_Y, dev->relbit); +} + +void synaptics_reset(struct psmouse *psmouse) +{ + /* reset touchpad back to relative mode, gestures enabled */ + synaptics_mode_cmd(psmouse, 0); +} + +static void synaptics_disconnect(struct psmouse *psmouse) +{ + synaptics_reset(psmouse); + kfree(psmouse->private); +} + +static int synaptics_reconnect(struct psmouse *psmouse) +{ + struct synaptics_data *priv = psmouse->private; + struct synaptics_data old_priv = *priv; + + if (!synaptics_detect(psmouse)) + return -1; + + if (synaptics_query_hardware(psmouse)) { + printk(KERN_ERR "Unable to query Synaptics hardware.\n"); + return -1; + } + + if (old_priv.identity != priv->identity || + old_priv.model_id != priv->model_id || + old_priv.capabilities != priv->capabilities || + old_priv.ext_cap != priv->ext_cap) + return -1; + + if (synaptics_set_mode(psmouse, 0)) { + printk(KERN_ERR "Unable to initialize Synaptics hardware.\n"); + return -1; + } + + return 0; +} + +int synaptics_detect(struct psmouse *psmouse) +{ + unsigned char param[4]; + + param[0] = 0; + + psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES); + psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES); + psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES); + psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES); + psmouse_command(psmouse, param, PSMOUSE_CMD_GETINFO); + + return param[1] == 0x47; +} + +int synaptics_init(struct psmouse *psmouse) +{ + struct synaptics_data *priv; + + psmouse->private = priv = kmalloc(sizeof(struct synaptics_data), GFP_KERNEL); + if (!priv) + return -1; + memset(priv, 0, sizeof(struct synaptics_data)); + + if (synaptics_query_hardware(psmouse)) { + printk(KERN_ERR "Unable to query Synaptics hardware.\n"); + goto init_fail; + } + + if (synaptics_set_mode(psmouse, 0)) { + printk(KERN_ERR "Unable to initialize Synaptics hardware.\n"); + goto init_fail; } + + priv->pkt_type = SYN_MODEL_NEWABS(priv->model_id) ? SYN_NEWABS : SYN_OLDABS; + + if (SYN_CAP_PASS_THROUGH(priv->capabilities)) + synaptics_pt_create(psmouse); + + print_ident(priv); + set_input_params(&psmouse->dev, priv); + + psmouse->protocol_handler = synaptics_process_byte; + psmouse->disconnect = synaptics_disconnect; + psmouse->reconnect = synaptics_reconnect; + + return 0; + + init_fail: + kfree(priv); + return -1; } + + diff -urN linux-2.6.7-rc2/drivers/input/mouse/synaptics.h linux-2.6.7-rc3/drivers/input/mouse/synaptics.h --- linux-2.6.7-rc2/drivers/input/mouse/synaptics.h 2004-05-09 19:32:29.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/mouse/synaptics.h 2004-06-07 12:55:05.914742832 -0700 @@ -9,7 +9,6 @@ #ifndef _SYNAPTICS_H #define _SYNAPTICS_H -extern void synaptics_process_byte(struct psmouse *psmouse, struct pt_regs *regs); extern int synaptics_detect(struct psmouse *psmouse); extern int synaptics_init(struct psmouse *psmouse); extern void synaptics_reset(struct psmouse *psmouse); @@ -44,13 +43,14 @@ /* synaptics capability bits */ #define SYN_CAP_EXTENDED(c) ((c) & (1 << 23)) +#define SYN_CAP_MIDDLE_BUTTON(c) ((c) & (1 << 18)) #define SYN_CAP_PASS_THROUGH(c) ((c) & (1 << 7)) #define SYN_CAP_SLEEP(c) ((c) & (1 << 4)) #define SYN_CAP_FOUR_BUTTON(c) ((c) & (1 << 3)) #define SYN_CAP_MULTIFINGER(c) ((c) & (1 << 1)) #define SYN_CAP_PALMDETECT(c) ((c) & (1 << 0)) #define SYN_CAP_VALID(c) ((((c) & 0x00ff00) >> 8) == 0x47) -#define SYN_EXT_CAP_REQUESTS(c) ((((c) & 0x700000) >> 20) == 1) +#define SYN_EXT_CAP_REQUESTS(c) (((c) & 0x700000) >> 20) #define SYN_CAP_MULTI_BUTTON_NO(ec) (((ec) & 0x00f000) >> 12) /* synaptics modes query bits */ @@ -86,18 +86,12 @@ int y; int z; int w; - int left; - int right; - int up; - int down; - int b0; - int b1; - int b2; - int b3; - int b4; - int b5; - int b6; - int b7; + unsigned int left:1; + unsigned int right:1; + unsigned int middle:1; + unsigned int up:1; + unsigned int down:1; + unsigned char ext_buttons; }; struct synaptics_data { @@ -108,7 +102,6 @@ unsigned long int identity; /* Identification */ /* Data for normal processing */ - unsigned int out_of_sync; /* # of packets out of sync */ int old_w; /* Previous w value */ unsigned char pkt_type; /* packet type - old, new, etc */ }; diff -urN linux-2.6.7-rc2/drivers/input/mousedev.c linux-2.6.7-rc3/drivers/input/mousedev.c --- linux-2.6.7-rc2/drivers/input/mousedev.c 2004-06-07 12:54:49.020043110 -0700 +++ linux-2.6.7-rc3/drivers/input/mousedev.c 2004-06-07 12:55:05.915742874 -0700 @@ -2,6 +2,7 @@ * Input driver to ExplorerPS/2 device driver module. * * Copyright (c) 1999-2002 Vojtech Pavlik + * Copyright (c) 2004 Dmitry Torokhov * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as published by @@ -47,15 +48,24 @@ module_param(yres, uint, 0); MODULE_PARM_DESC(yres, "Vertical screen resolution"); +struct mousedev_motion { + int dx, dy, dz; +}; + struct mousedev { int exist; int open; int minor; - int misc; char name[16]; wait_queue_head_t wait; struct list_head list; struct input_handle handle; + + struct mousedev_motion packet; + unsigned long buttons; + unsigned int pkt_count; + int old_x[4], old_y[4]; + unsigned int touch; }; struct mousedev_list { @@ -63,13 +73,10 @@ struct mousedev *mousedev; struct list_head node; int dx, dy, dz; - int old_x[4], old_y[4]; unsigned long buttons; signed char ps2[6]; unsigned char ready, buffer, bufsiz; unsigned char mode, imexseq, impsseq; - unsigned int pkt_count; - unsigned char touch; }; #define MOUSEDEV_SEQ_LEN 6 @@ -82,135 +89,157 @@ static struct mousedev *mousedev_table[MOUSEDEV_MINORS]; static struct mousedev mousedev_mix; -#define fx(i) (list->old_x[(list->pkt_count - (i)) & 03]) -#define fy(i) (list->old_y[(list->pkt_count - (i)) & 03]) +#define fx(i) (mousedev->old_x[(mousedev->pkt_count - (i)) & 03]) +#define fy(i) (mousedev->old_y[(mousedev->pkt_count - (i)) & 03]) -static void mousedev_abs_event(struct input_handle *handle, struct mousedev_list *list, unsigned int code, int value) +static void mousedev_touchpad_event(struct mousedev *mousedev, unsigned int code, int value) { - int size; - int touchpad; + if (mousedev->touch) { + switch (code) { + case ABS_X: + fx(0) = value; + if (mousedev->pkt_count >= 2) + mousedev->packet.dx = ((fx(0) - fx(1)) / 2 + (fx(1) - fx(2)) / 2) / 8; + break; - /* Ignore joysticks */ - if (test_bit(BTN_TRIGGER, handle->dev->keybit)) - return; + case ABS_Y: + fy(0) = value; + if (mousedev->pkt_count >= 2) + mousedev->packet.dy = -((fy(0) - fy(1)) / 2 + (fy(1) - fy(2)) / 2) / 8; + break; + } + } +} - touchpad = test_bit(BTN_TOOL_FINGER, handle->dev->keybit); +static void mousedev_abs_event(struct input_dev *dev, struct mousedev *mousedev, unsigned int code, int value) +{ + int size; switch (code) { case ABS_X: - if (touchpad) { - if (list->touch) { - fx(0) = value; - if (list->pkt_count >= 2) - list->dx = ((fx(0) - fx(1)) / 2 + (fx(1) - fx(2)) / 2) / 8; - } - } else { - size = handle->dev->absmax[ABS_X] - handle->dev->absmin[ABS_X]; - if (size == 0) size = xres; - list->dx += (value * xres - list->old_x[0]) / size; - list->old_x[0] += list->dx * size; - } + size = dev->absmax[ABS_X] - dev->absmin[ABS_X]; + if (size == 0) size = xres; + mousedev->packet.dx = (value * xres - mousedev->old_x[0]) / size; + mousedev->old_x[0] = mousedev->packet.dx * size; break; + case ABS_Y: - if (touchpad) { - if (list->touch) { - fy(0) = value; - if (list->pkt_count >= 2) - list->dy = -((fy(0) - fy(1)) / 2 + (fy(1) - fy(2)) / 2) / 8; - } - } else { - size = handle->dev->absmax[ABS_Y] - handle->dev->absmin[ABS_Y]; - if (size == 0) size = yres; - list->dy -= (value * yres - list->old_y[0]) / size; - list->old_y[0] -= list->dy * size; - } + size = dev->absmax[ABS_Y] - dev->absmin[ABS_Y]; + if (size == 0) size = yres; + mousedev->packet.dy = (value * yres - mousedev->old_y[0]) / size; + mousedev->old_y[0] = mousedev->packet.dy * size; break; } } -static void mousedev_event(struct input_handle *handle, unsigned int type, unsigned int code, int value) +static void mousedev_rel_event(struct mousedev *mousedev, unsigned int code, int value) +{ + switch (code) { + case REL_X: mousedev->packet.dx += value; break; + case REL_Y: mousedev->packet.dy -= value; break; + case REL_WHEEL: mousedev->packet.dz -= value; break; + } +} + +static void mousedev_key_event(struct mousedev *mousedev, unsigned int code, int value) +{ + int index; + + switch (code) { + case BTN_TOUCH: + case BTN_0: + case BTN_FORWARD: + case BTN_LEFT: index = 0; break; + case BTN_STYLUS: + case BTN_1: + case BTN_RIGHT: index = 1; break; + case BTN_2: + case BTN_STYLUS2: + case BTN_MIDDLE: index = 2; break; + case BTN_3: + case BTN_BACK: + case BTN_SIDE: index = 3; break; + case BTN_4: + case BTN_EXTRA: index = 4; break; + default: return; + } + + if (value) { + set_bit(index, &mousedev->buttons); + set_bit(index, &mousedev_mix.buttons); + } else { + clear_bit(index, &mousedev->buttons); + clear_bit(index, &mousedev_mix.buttons); + } +} + +static void mousedev_notify_readers(struct mousedev *mousedev, struct mousedev_motion *packet) { - struct mousedev *mousedevs[3] = { handle->private, &mousedev_mix, NULL }; - struct mousedev **mousedev = mousedevs; struct mousedev_list *list; - int index, wake; - while (*mousedev) { + list_for_each_entry(list, &mousedev->list, node) { + list->dx += packet->dx; + list->dy += packet->dy; + list->dz += packet->dz; + list->buttons = mousedev->buttons; + list->ready = 1; + kill_fasync(&list->fasync, SIGIO, POLL_IN); + } + + wake_up_interruptible(&mousedev->wait); +} + +static void mousedev_event(struct input_handle *handle, unsigned int type, unsigned int code, int value) +{ + struct mousedev *mousedev = handle->private; + + switch (type) { + case EV_ABS: + /* Ignore joysticks */ + if (test_bit(BTN_TRIGGER, handle->dev->keybit)) + return; + + if (test_bit(BTN_TOOL_FINGER, handle->dev->keybit)) + mousedev_touchpad_event(mousedev, code, value); + else + mousedev_abs_event(handle->dev, mousedev, code, value); - wake = 0; + break; - list_for_each_entry(list, &(*mousedev)->list, node) - switch (type) { - case EV_ABS: - mousedev_abs_event(handle, list, code, value); - break; - - case EV_REL: - switch (code) { - case REL_X: list->dx += value; break; - case REL_Y: list->dy -= value; break; - case REL_WHEEL: if (list->mode) list->dz -= value; break; - } - break; - - case EV_KEY: - if (code == BTN_TOUCH && test_bit(BTN_TOOL_FINGER, handle->dev->keybit)) { - /* Handle touchpad data */ - list->touch = value; - if (!list->touch) - list->pkt_count = 0; - break; - } - - switch (code) { - case BTN_TOUCH: - case BTN_0: - case BTN_FORWARD: - case BTN_LEFT: index = 0; break; - case BTN_4: - case BTN_EXTRA: if (list->mode == 2) { index = 4; break; } - case BTN_STYLUS: - case BTN_1: - case BTN_RIGHT: index = 1; break; - case BTN_3: - case BTN_BACK: - case BTN_SIDE: if (list->mode == 2) { index = 3; break; } - case BTN_2: - case BTN_STYLUS2: - case BTN_MIDDLE: index = 2; break; - default: return; - } - switch (value) { - case 0: clear_bit(index, &list->buttons); break; - case 1: set_bit(index, &list->buttons); break; - case 2: return; - } - break; - - case EV_SYN: - switch (code) { - case SYN_REPORT: - if (list->touch) { - list->pkt_count++; - /* Input system eats duplicate events, - * but we need all of them to do correct - * averaging so apply present one forward - */ - fx(0) = fx(1); - fy(0) = fy(1); - } - - list->ready = 1; - kill_fasync(&list->fasync, SIGIO, POLL_IN); - wake = 1; - break; - } + case EV_REL: + mousedev_rel_event(mousedev, code, value); + break; + + case EV_KEY: + if (value != 2) { + if (code == BTN_TOUCH && test_bit(BTN_TOOL_FINGER, handle->dev->keybit)) { + /* Handle touchpad data */ + mousedev->touch = value; + if (!mousedev->touch) + mousedev->pkt_count = 0; + } + else + mousedev_key_event(mousedev, code, value); } + break; - if (wake) - wake_up_interruptible(&((*mousedev)->wait)); + case EV_SYN: + if (code == SYN_REPORT) { + if (mousedev->touch) { + mousedev->pkt_count++; + /* Input system eats duplicate events, but we need all of them + * to do correct averaging so apply present one forward + */ + fx(0) = fx(1); + fy(0) = fy(1); + } + + mousedev_notify_readers(mousedev, &mousedev->packet); + mousedev_notify_readers(&mousedev_mix, &mousedev->packet); - mousedev++; + memset(&mousedev->packet, 0, sizeof(struct mousedev_motion)); + } + break; } } @@ -267,7 +296,7 @@ mousedev_free(list->mousedev); } } - + kfree(list); return 0; } @@ -301,11 +330,11 @@ if (list->mousedev->minor == MOUSEDEV_MIX) { list_for_each_entry(handle, &mousedev_handler.h_list, h_node) { mousedev = handle->private; - if (!mousedev->open && mousedev->exist) + if (!mousedev->open && mousedev->exist) input_open_device(handle); } - } else - if (!mousedev_mix.open && list->mousedev->exist) + } else + if (!mousedev_mix.open && list->mousedev->exist) input_open_device(&list->mousedev->handle); } @@ -326,8 +355,10 @@ list->dz -= list->ps2[off + 3]; list->ps2[off + 3] = (list->ps2[off + 3] & 0x0f) | ((list->buttons & 0x18) << 1); list->bufsiz++; + } else { + list->ps2[off] |= ((list->buttons & 0x10) >> 3) | ((list->buttons & 0x08) >> 1); } - + if (list->mode == 1) { list->ps2[off + 3] = (list->dz > 127 ? 127 : (list->dz < -127 ? -127 : list->dz)); list->dz -= list->ps2[off + 3]; @@ -391,9 +422,9 @@ list->impsseq = 0; list->imexseq = 0; list->mode = 0; - list->ps2[0] = 0xaa; - list->ps2[1] = 0x00; - list->bufsiz = 2; + list->ps2[1] = 0xaa; + list->ps2[2] = 0x00; + list->bufsiz = 3; break; } @@ -403,7 +434,7 @@ kill_fasync(&list->fasync, SIGIO, POLL_IN); wake_up_interruptible(&list->mousedev->wait); - + return count; } @@ -431,7 +462,7 @@ if (copy_to_user(buffer, list->ps2 + list->bufsiz - list->buffer - count, count)) return -EFAULT; - return count; + return count; } /* No kernel lock - fine */ @@ -487,7 +518,7 @@ devfs_mk_cdev(MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + minor), S_IFCHR|S_IRUGO|S_IWUSR, "input/mouse%d", minor); - class_simple_device_add(input_class, + class_simple_device_add(input_class, MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + minor), dev->dev, "mouse%d", minor); @@ -538,7 +569,7 @@ }; MODULE_DEVICE_TABLE(input, mousedev_ids); - + static struct input_handler mousedev_handler = { .event = mousedev_event, .connect = mousedev_connect, @@ -553,6 +584,7 @@ static struct miscdevice psaux_mouse = { PSMOUSE_MINOR, "psaux", &mousedev_fops }; +static int psaux_registered; #endif static int __init mousedev_init(void) @@ -572,7 +604,7 @@ NULL, "mice"); #ifdef CONFIG_INPUT_MOUSEDEV_PSAUX - if (!(mousedev_mix.misc = !misc_register(&psaux_mouse))) + if (!(psaux_registered = !misc_register(&psaux_mouse))) printk(KERN_WARNING "mice: could not misc_register the device\n"); #endif @@ -584,7 +616,7 @@ static void __exit mousedev_exit(void) { #ifdef CONFIG_INPUT_MOUSEDEV_PSAUX - if (mousedev_mix.misc) + if (psaux_registered) misc_deregister(&psaux_mouse); #endif devfs_remove("input/mice"); diff -urN linux-2.6.7-rc2/drivers/input/power.c linux-2.6.7-rc3/drivers/input/power.c --- linux-2.6.7-rc2/drivers/input/power.c 2004-05-09 19:32:54.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/power.c 2004-06-07 12:55:05.915742874 -0700 @@ -1,7 +1,7 @@ /* * $Id: power.c,v 1.10 2001/09/25 09:17:15 vojtech Exp $ * - * Copyright (c) 2001 "Crazy" James Simmons + * Copyright (c) 2001 "Crazy" James Simmons * * Input driver Power Management. * @@ -51,7 +51,7 @@ static DECLARE_WORK(suspend_button_task, suspend_button_task_handler, NULL); -static void power_event(struct input_handle *handle, unsigned int type, +static void power_event(struct input_handle *handle, unsigned int type, unsigned int code, int down) { struct input_dev *dev = handle->dev; @@ -73,7 +73,7 @@ case KEY_POWER: /* Hum power down the machine. */ break; - default: + default: return; } } else { @@ -83,9 +83,9 @@ /* This is risky. See pm.h for details. */ if (dev->state != PM_RESUME) dev->state = PM_RESUME; - else - dev->state = PM_SUSPEND; - pm_send(dev->pm_dev, dev->state, dev); + else + dev->state = PM_SUSPEND; + pm_send(dev->pm_dev, dev->state, dev); break; case KEY_POWER: /* Turn the input device off completely ? */ @@ -97,14 +97,14 @@ return; } -static struct input_handle *power_connect(struct input_handler *handler, - struct input_dev *dev, +static struct input_handle *power_connect(struct input_handler *handler, + struct input_dev *dev, struct input_device_id *id) { struct input_handle *handle; if (!test_bit(EV_KEY, dev->evbit) || !test_bit(EV_PWR, dev->evbit)) - return NULL; + return NULL; if (!test_bit(KEY_SUSPEND, dev->keybit) || (!test_bit(KEY_POWER, dev->keybit))) return NULL; @@ -133,21 +133,21 @@ .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_KEYBIT, .evbit = { BIT(EV_KEY) }, .keybit = { [LONG(KEY_SUSPEND)] = BIT(KEY_SUSPEND) } - }, + }, { .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_KEYBIT, .evbit = { BIT(EV_KEY) }, .keybit = { [LONG(KEY_POWER)] = BIT(KEY_POWER) } - }, + }, { .flags = INPUT_DEVICE_ID_MATCH_EVBIT, .evbit = { BIT(EV_PWR) }, - }, + }, { }, /* Terminating entry */ }; MODULE_DEVICE_TABLE(input, power_ids); - + static struct input_handler power_handler = { .event = power_event, .connect = power_connect, @@ -172,3 +172,4 @@ MODULE_AUTHOR("James Simmons "); MODULE_DESCRIPTION("Input Power Management driver"); +MODULE_LICENSE("GPL"); diff -urN linux-2.6.7-rc2/drivers/input/serio/98kbd-io.c linux-2.6.7-rc3/drivers/input/serio/98kbd-io.c --- linux-2.6.7-rc2/drivers/input/serio/98kbd-io.c 2004-05-09 19:31:58.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/serio/98kbd-io.c 2004-06-07 12:55:05.916742915 -0700 @@ -42,8 +42,8 @@ * Register numbers. */ -#define KBD98_COMMAND_REG 0x43 -#define KBD98_STATUS_REG 0x43 +#define KBD98_COMMAND_REG 0x43 +#define KBD98_STATUS_REG 0x43 #define KBD98_DATA_REG 0x41 spinlock_t kbd98io_lock = SPIN_LOCK_UNLOCKED; @@ -51,7 +51,7 @@ static struct serio kbd98_port; extern struct pt_regs *kbd_pt_regs; -static void kbd98io_interrupt(int irq, void *dev_id, struct pt_regs *regs); +static irqreturn_t kbd98io_interrupt(int irq, void *dev_id, struct pt_regs *regs); /* * kbd98_flush() flushes all data that may be in the keyboard buffers @@ -143,7 +143,7 @@ * to the upper layers. */ -static void kbd98io_interrupt(int irq, void *dev_id, struct pt_regs *regs) +static irqreturn_t kbd98io_interrupt(int irq, void *dev_id, struct pt_regs *regs) { unsigned long flags; unsigned char data; @@ -154,6 +154,7 @@ spin_unlock_irqrestore(&kbd98io_lock, flags); serio_interrupt(&kbd98_port, data, 0, regs); + return IRQ_HANDLED; } int __init kbd98io_init(void) diff -urN linux-2.6.7-rc2/drivers/input/serio/ct82c710.c linux-2.6.7-rc3/drivers/input/serio/ct82c710.c --- linux-2.6.7-rc2/drivers/input/serio/ct82c710.c 2004-05-09 19:31:59.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/serio/ct82c710.c 2004-06-07 12:55:05.917742957 -0700 @@ -11,18 +11,18 @@ /* * 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 + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * 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 * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * 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 , or by paper mail: * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic diff -urN linux-2.6.7-rc2/drivers/input/serio/gscps2.c linux-2.6.7-rc3/drivers/input/serio/gscps2.c --- linux-2.6.7-rc2/drivers/input/serio/gscps2.c 2004-05-09 19:33:21.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/serio/gscps2.c 2004-06-07 12:55:05.918742998 -0700 @@ -16,7 +16,7 @@ * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. - * + * * TODO: * - Dino testing (did HP ever shipped a machine on which this port * was usable/enabled ?) @@ -44,7 +44,7 @@ #define PFX "gscps2.c: " -/* +/* * Driver constants */ @@ -222,7 +222,7 @@ /** * gscps2_interrupt() - Interruption service routine * - * This function reads received PS/2 bytes and processes them on + * This function reads received PS/2 bytes and processes them on * all interfaces. * The problematic part here is, that the keyboard and mouse PS/2 port * share the same interrupt and it's not possible to send data if any @@ -240,9 +240,9 @@ unsigned long flags; spin_lock_irqsave(&ps2port->lock, flags); - while ( (ps2port->buffer[ps2port->append].str = + while ( (ps2port->buffer[ps2port->append].str = gscps2_readb_status(ps2port->addr)) & GSC_STAT_RBNE ) { - ps2port->buffer[ps2port->append].data = + ps2port->buffer[ps2port->append].data = gscps2_readb_input(ps2port->addr); ps2port->append = ((ps2port->append+1) & BUFFER_SIZE); } @@ -349,7 +349,7 @@ if (!dev->irq) return -ENODEV; - + /* Offset for DINO PS/2. Works with LASI even */ if (dev->id.sversion == 0x96) hpa += GSC_DINO_OFFSET; @@ -368,7 +368,7 @@ gscps2_reset(ps2port); ps2port->id = readb(ps2port->addr+GSC_ID) & 0x0f; snprintf(ps2port->name, sizeof(ps2port->name)-1, "%s %s", - gscps2_serio_port.name, + gscps2_serio_port.name, (ps2port->id == GSC_ID_KEYBOARD) ? "keyboard" : "mouse" ); memcpy(&ps2port->port, &gscps2_serio_port, sizeof(gscps2_serio_port)); @@ -401,9 +401,9 @@ ps2port->port.phys); serio_register_port(&ps2port->port); - + return 0; - + fail: free_irq(dev->irq, ps2port); @@ -430,7 +430,7 @@ list_del(&ps2port->node); iounmap(ps2port->addr); #if 0 - release_mem_region(dev->hpa, GSC_STATUS + 4); + release_mem_region(dev->hpa, GSC_STATUS + 4); #endif dev_set_drvdata(&dev->dev, NULL); kfree(ps2port); @@ -441,7 +441,7 @@ static struct parisc_device_id gscps2_device_tbl[] = { { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x00084 }, /* LASI PS/2 */ #ifdef DINO_TESTED - { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x00096 }, /* DINO PS/2 */ + { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x00096 }, /* DINO PS/2 */ #endif { 0, } /* 0 terminated list */ }; diff -urN linux-2.6.7-rc2/drivers/input/serio/i8042.c linux-2.6.7-rc3/drivers/input/serio/i8042.c --- linux-2.6.7-rc2/drivers/input/serio/i8042.c 2004-05-09 19:32:00.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/serio/i8042.c 2004-06-07 12:55:05.919743039 -0700 @@ -150,7 +150,7 @@ */ static int i8042_command(unsigned char *param, int command) -{ +{ unsigned long flags; int retval = 0, i = 0; @@ -161,7 +161,7 @@ dbg("%02x -> i8042 (command)", command & 0xff); i8042_write_command(command & 0xff); } - + if (!retval) for (i = 0; i < ((command >> 12) & 0xf); i++) { if ((retval = i8042_wait_write())) break; @@ -172,7 +172,7 @@ if (!retval) for (i = 0; i < ((command >> 8) & 0xf); i++) { if ((retval = i8042_wait_read())) break; - if (i8042_read_status() & I8042_STR_AUXDATA) + if (i8042_read_status() & I8042_STR_AUXDATA) param[i] = ~i8042_read_data(); else param[i] = i8042_read_data(); @@ -415,17 +415,17 @@ } else dfl = 0; dbg("%02x <- i8042 (interrupt, aux%d, %d%s%s)", - data, (str >> 6), irq, + data, (str >> 6), irq, dfl & SERIO_PARITY ? ", bad parity" : "", dfl & SERIO_TIMEOUT ? ", timeout" : ""); serio_interrupt(i8042_mux_port + ((str >> 6) & 3), data, dfl, regs); - + goto irq_ret; } dbg("%02x <- i8042 (interrupt, %s, %d%s%s)", - data, (str & I8042_STR_AUXDATA) ? "aux" : "kbd", irq, + data, (str & I8042_STR_AUXDATA) ? "aux" : "kbd", irq, dfl & SERIO_PARITY ? ", bad parity" : "", dfl & SERIO_TIMEOUT ? ", timeout" : ""); @@ -474,8 +474,17 @@ if (i8042_command(¶m, I8042_CMD_AUX_LOOP) || param != 0xa9) return -1; param = 0xa4; - if (i8042_command(¶m, I8042_CMD_AUX_LOOP) || param == 0x5b) + if (i8042_command(¶m, I8042_CMD_AUX_LOOP) || param == 0x5b) { + +/* + * Do another loop test with the 0x5a value. Doing anything else upsets + * Profusion/ServerWorks OSB4 chipsets. + */ + + param = 0x5a; + i8042_command(¶m, I8042_CMD_AUX_LOOP); return -1; + } if (mux_version) *mux_version = ~param; @@ -530,10 +539,10 @@ if (i8042_enable_mux_mode(values, &mux_version)) return -1; - + /* Workaround for broken chips which seem to support MUX, but in reality don't. */ - /* They all report version 12.10 */ - if (mux_version == 0xCA) + /* They all report version 10.12 */ + if (mux_version == 0xAC) return -1; printk(KERN_INFO "i8042.c: Detected active multiplexing controller, rev %d.%d.\n", @@ -598,7 +607,7 @@ /* * Bit assignment test - filters out PS/2 i8042's in AT mode */ - + if (i8042_command(¶m, I8042_CMD_AUX_DISABLE)) return -1; if (i8042_command(¶m, I8042_CMD_CTL_RCTR) || (~param & I8042_CTR_AUXDIS)) { @@ -609,7 +618,7 @@ if (i8042_command(¶m, I8042_CMD_AUX_ENABLE)) return -1; if (i8042_command(¶m, I8042_CMD_CTL_RCTR) || (param & I8042_CTR_AUXDIS)) - return -1; + return -1; /* * Disable the interface. @@ -639,7 +648,7 @@ if (i8042_command(&i8042_ctr, I8042_CMD_CTL_WCTR)) { printk(KERN_WARNING "i8042.c: Can't write CTR while registering.\n"); values->exists = 0; - return -1; + return -1; } printk(KERN_INFO "serio: i8042 %s port at %#lx,%#lx irq %d\n", @@ -868,7 +877,7 @@ static int i8042_notify_sys(struct notifier_block *this, unsigned long code, void *unused) { - if (code==SYS_DOWN || code==SYS_HALT) + if (code == SYS_DOWN || code == SYS_HALT) i8042_controller_cleanup(); return NOTIFY_DONE; } @@ -997,19 +1006,18 @@ sysdev_class_unregister(&kbc_sysclass); } - del_timer_sync(&i8042_timer); - i8042_controller_cleanup(); - + if (i8042_kbd_values.exists) serio_unregister_port(&i8042_kbd_port); if (i8042_aux_values.exists) serio_unregister_port(&i8042_aux_port); - + for (i = 0; i < 4; i++) if (i8042_mux_values[i].exists) serio_unregister_port(i8042_mux_port + i); + del_timer_sync(&i8042_timer); i8042_platform_exit(); } diff -urN linux-2.6.7-rc2/drivers/input/serio/parkbd.c linux-2.6.7-rc3/drivers/input/serio/parkbd.c --- linux-2.6.7-rc2/drivers/input/serio/parkbd.c 2004-05-09 19:31:59.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/serio/parkbd.c 2004-06-07 12:55:05.920743081 -0700 @@ -11,18 +11,18 @@ /* * 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 + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * 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 * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * 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 , or by paper mail: * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic @@ -86,20 +86,9 @@ return 0; } -static int parkbd_open(struct serio *port) -{ - return 0; -} - -static void parkbd_close(struct serio *port) -{ -} - static struct serio parkbd_port = { .write = parkbd_write, - .open = parkbd_open, - .close = parkbd_close, .name = parkbd_name, .phys = parkbd_phys, }; @@ -115,7 +104,7 @@ parkbd_writing = 0; parkbd_writelines(3); return; - } + } parkbd_writelines(((parkbd_buffer >> parkbd_counter++) & 1) | 2); @@ -131,7 +120,7 @@ if ((parkbd_counter == parkbd_mode + 10) || time_after(jiffies, parkbd_last + HZ/100)) { parkbd_counter = 0; parkbd_buffer = 0; - } + } parkbd_buffer |= (parkbd_readlines() >> 1) << parkbd_counter++; diff -urN linux-2.6.7-rc2/drivers/input/serio/q40kbd.c linux-2.6.7-rc3/drivers/input/serio/q40kbd.c --- linux-2.6.7-rc2/drivers/input/serio/q40kbd.c 2004-05-09 19:32:26.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/serio/q40kbd.c 2004-06-07 12:55:05.920743081 -0700 @@ -4,7 +4,7 @@ * Copyright (c) 2000-2001 Vojtech Pavlik * * Based on the work of: - * Richard Zidlicky + * Richard Zidlicky */ /* @@ -47,23 +47,12 @@ MODULE_DESCRIPTION("Q40 PS/2 keyboard controller driver"); MODULE_LICENSE("GPL"); - -static int q40kbd_open(struct serio *port) -{ - return 0; -} -static void q40kbd_close(struct serio *port) -{ -} - static struct serio q40kbd_port = { .type = SERIO_8042, .name = "Q40 kbd port", .phys = "Q40", .write = NULL, - .open = q40kbd_open, - .close = q40kbd_close, }; static irqreturn_t q40kbd_interrupt(int irq, void *dev_id, diff -urN linux-2.6.7-rc2/drivers/input/serio/rpckbd.c linux-2.6.7-rc3/drivers/input/serio/rpckbd.c --- linux-2.6.7-rc2/drivers/input/serio/rpckbd.c 2004-05-09 19:31:59.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/serio/rpckbd.c 2004-06-07 12:55:05.920743081 -0700 @@ -98,7 +98,7 @@ static void rpckbd_close(struct serio *port) { free_irq(IRQ_KEYBOARDRX, port); - free_irq(IRQ_KEYBOARDTX, port); + free_irq(IRQ_KEYBOARDTX, port); } static struct serio rpckbd_port = diff -urN linux-2.6.7-rc2/drivers/input/serio/serio.c linux-2.6.7-rc3/drivers/input/serio/serio.c --- linux-2.6.7-rc2/drivers/input/serio/serio.c 2004-05-09 19:31:59.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/serio/serio.c 2004-06-07 12:55:05.921743122 -0700 @@ -11,18 +11,18 @@ /* * 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 + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * 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 * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * 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 , or by paper mail: * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic @@ -108,7 +108,7 @@ struct serio_event *event; list_for_each_safe(node, next, &serio_event_list) { - event = container_of(node, struct serio_event, node); + event = container_of(node, struct serio_event, node); down(&serio_sem); if (event->serio == NULL) @@ -152,7 +152,7 @@ do { serio_handle_events(); - wait_event_interruptible(serio_wait, !list_empty(&serio_event_list)); + wait_event_interruptible(serio_wait, !list_empty(&serio_event_list)); if (current->flags & PF_FREEZE) refrigerator(PF_FREEZE); } while (!signal_pending(current)); @@ -293,7 +293,7 @@ int serio_open(struct serio *serio, struct serio_dev *dev) { serio->dev = dev; - if (serio->open(serio)) { + if (serio->open && serio->open(serio)) { serio->dev = NULL; return -1; } @@ -303,7 +303,8 @@ /* called from serio_dev->connect/disconnect methods under serio_sem */ void serio_close(struct serio *serio) { - serio->close(serio); + if (serio->close) + serio->close(serio); serio->dev = NULL; } diff -urN linux-2.6.7-rc2/drivers/input/serio/serport.c linux-2.6.7-rc3/drivers/input/serio/serport.c --- linux-2.6.7-rc2/drivers/input/serio/serport.c 2004-06-07 12:54:49.021043151 -0700 +++ linux-2.6.7-rc3/drivers/input/serio/serport.c 2004-06-07 12:55:05.921743122 -0700 @@ -48,11 +48,6 @@ return -(serport->tty->driver->write(serport->tty, 0, &data, 1) != 1); } -static int serport_serio_open(struct serio *serio) -{ - return 0; -} - static void serport_serio_close(struct serio *serio) { struct serport *serport = serio->driver; @@ -87,7 +82,6 @@ serport->serio.type = SERIO_RS232; serport->serio.write = serport_serio_write; - serport->serio.open = serport_serio_open; serport->serio.close = serport_serio_close; serport->serio.driver = serport; @@ -135,7 +129,7 @@ } /* - * serport_ldisc_read() just waits indefinitely if everything goes well. + * serport_ldisc_read() just waits indefinitely if everything goes well. * However, when the serio driver closes the serio port, it finishes, * returning 0 characters. */ @@ -165,7 +159,7 @@ static int serport_ldisc_ioctl(struct tty_struct * tty, struct file * file, unsigned int cmd, unsigned long arg) { struct serport *serport = (struct serport*) tty->disc_data; - + if (cmd == SPIOCSTYPE) return get_user(serport->serio.type, (unsigned long __user *) arg); diff -urN linux-2.6.7-rc2/drivers/input/touchscreen/gunze.c linux-2.6.7-rc3/drivers/input/touchscreen/gunze.c --- linux-2.6.7-rc2/drivers/input/touchscreen/gunze.c 2004-05-09 19:32:27.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/touchscreen/gunze.c 2004-06-07 12:55:05.922743164 -0700 @@ -124,12 +124,10 @@ memset(gunze, 0, sizeof(struct gunze)); init_input_dev(&gunze->dev); - gunze->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); - gunze->dev.absbit[0] = BIT(ABS_X) | BIT(ABS_Y); + gunze->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); gunze->dev.keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); - - gunze->dev.absmin[ABS_X] = 96; gunze->dev.absmin[ABS_Y] = 72; - gunze->dev.absmax[ABS_X] = 4000; gunze->dev.absmax[ABS_Y] = 3000; + input_set_abs_params(&gunze->dev, ABS_X, 96, 4000, 0, 0); + input_set_abs_params(&gunze->dev, ABS_Y, 72, 3000, 0, 0); gunze->serio = serio; serio->private = gunze; diff -urN linux-2.6.7-rc2/drivers/input/touchscreen/h3600_ts_input.c linux-2.6.7-rc3/drivers/input/touchscreen/h3600_ts_input.c --- linux-2.6.7-rc2/drivers/input/touchscreen/h3600_ts_input.c 2004-05-09 19:33:13.000000000 -0700 +++ linux-2.6.7-rc3/drivers/input/touchscreen/h3600_ts_input.c 2004-06-07 12:55:05.923743205 -0700 @@ -1,11 +1,11 @@ /* * $Id: h3600_ts_input.c,v 1.4 2002/01/23 06:39:37 jsimmons Exp $ * - * Copyright (c) 2001 "Crazy" James Simmons jsimmons@transvirtual.com + * Copyright (c) 2001 "Crazy" James Simmons jsimmons@transvirtual.com * - * Sponsored by Transvirtual Technology. - * - * Derived from the code in h3600_ts.[ch] by Charles Flynn + * Sponsored by Transvirtual Technology. + * + * Derived from the code in h3600_ts.[ch] by Charles Flynn */ /* @@ -45,6 +45,10 @@ #include #include +MODULE_AUTHOR("James Simmons "); +MODULE_DESCRIPTION("H3600 touchscreen driver"); +MODULE_LICENSE("GPL"); + /* * Definitions & global arrays. */ @@ -75,7 +79,7 @@ #define MAX_ID 14 #define H3600_MAX_LENGTH 16 -#define H3600_KEY 0xf +#define H3600_KEY 0xf #define H3600_SCANCODE_RECORD 1 /* 1 -> record button */ #define H3600_SCANCODE_CALENDAR 2 /* 2 -> calendar */ @@ -103,7 +107,7 @@ char phys[32]; }; -static void action_button_handler(int irq, void *dev_id, struct pt_regs *regs) +static irqreturn_t action_button_handler(int irq, void *dev_id, struct pt_regs *regs) { int down = (GPLR & GPIO_BITSY_ACTION_BUTTON) ? 0 : 1; struct input_dev *dev = (struct input_dev *) dev_id; @@ -111,21 +115,25 @@ input_regs(dev, regs); input_report_key(dev, KEY_ENTER, down); input_sync(dev); + + return IRQ_HANDLED; } -static void npower_button_handler(int irq, void *dev_id, struct pt_regs *regs) +static irqreturn_t npower_button_handler(int irq, void *dev_id, struct pt_regs *regs) { int down = (GPLR & GPIO_BITSY_NPOWER_BUTTON) ? 0 : 1; struct input_dev *dev = (struct input_dev *) dev_id; - /* - * This interrupt is only called when we release the key. So we have + /* + * This interrupt is only called when we release the key. So we have * to fake a key press. - */ + */ input_regs(dev, regs); input_report_key(dev, KEY_SUSPEND, 1); - input_report_key(dev, KEY_SUSPEND, down); + input_report_key(dev, KEY_SUSPEND, down); input_sync(dev); + + return IRQ_HANDLED; } #ifdef CONFIG_PM @@ -141,21 +149,21 @@ * h3600_flite_power: enables or disables power to frontlight, using last bright */ unsigned int h3600_flite_power(struct input_dev *dev, enum flite_pwr pwr) { - unsigned char brightness = ((pwr==FLITE_PWR_OFF) ? 0:flite_brightness); + unsigned char brightness = (pwr == FLITE_PWR_OFF) ? 0 : flite_brightness; struct h3600_dev *ts = dev->private; - /* Must be in this order */ + /* Must be in this order */ ts->serio->write(ts->serio, 1); ts->serio->write(ts->serio, pwr); - ts->serio->write(ts->serio, brightness); + ts->serio->write(ts->serio, brightness); return 0; } static int suspended = 0; -static int h3600ts_pm_callback(struct pm_dev *pm_dev, pm_request_t req, +static int h3600ts_pm_callback(struct pm_dev *pm_dev, pm_request_t req, void *data) { - struct input_dev *dev = (struct input_dev *) data; + struct input_dev *dev = (struct input_dev *) data; switch (req) { case PM_SUSPEND: /* enter D1-D3 */ @@ -183,7 +191,7 @@ /* * This function translates the native event packets to linux input event * packets. Some packets coming from serial are not touchscreen related. In - * this case we send them off to be processed elsewhere. + * this case we send them off to be processed elsewhere. */ static void h3600ts_process_packet(struct h3600_dev *ts, struct pt_regs *regs) { @@ -206,7 +214,7 @@ Note: This is true for non interrupt generated key events. */ case KEYBD_ID: - down = (ts->buf[0] & 0x80) ? 0 : 1; + down = (ts->buf[0] & 0x80) ? 0 : 1; switch (ts->buf[0] & 0x7f) { case H3600_SCANCODE_RECORD: @@ -218,7 +226,7 @@ case H3600_SCANCODE_CONTACTS: key = KEY_PROG2; break; - case H3600_SCANCODE_Q: + case H3600_SCANCODE_Q: key = KEY_Q; break; case H3600_SCANCODE_START: @@ -237,9 +245,9 @@ key = KEY_DOWN; break; default: - key = 0; - } - if (key) + key = 0; + } + if (key) input_report_key(dev, key, down); break; /* @@ -251,13 +259,13 @@ * byte 0 1 2 3 */ case TOUCHS_ID: - if (!touched) { + if (!touched) { input_report_key(dev, BTN_TOUCH, 1); touched = 1; - } + } if (ts->len) { - unsigned short x, y; + unsigned short x, y; x = ts->buf[0]; x <<= 8; x += ts->buf[1]; y = ts->buf[2]; y <<= 8; y += ts->buf[3]; @@ -267,7 +275,7 @@ } else { input_report_key(dev, BTN_TOUCH, 0); touched = 0; - } + } break; default: /* Send a non input event elsewhere */ @@ -280,7 +288,7 @@ /* * h3600ts_event() handles events from the input module. */ -static int h3600ts_event(struct input_dev *dev, unsigned int type, +static int h3600ts_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) { struct h3600_dev *ts = dev->private; @@ -290,7 +298,7 @@ // ts->serio->write(ts->serio, SOME_CMD); return 0; } - } + } return -1; } @@ -317,19 +325,19 @@ #define STATE_DATA 2 /* state where we decode data */ #define STATE_EOF 3 /* state where we decode checksum or EOF */ -static void h3600ts_interrupt(struct serio *serio, unsigned char data, - unsigned int flags) +static irqreturn_t h3600ts_interrupt(struct serio *serio, unsigned char data, + unsigned int flags, struct pt_regs *regs) { struct h3600_dev *ts = serio->private; /* - * We have a new frame coming in. + * We have a new frame coming in. */ switch (state) { case STATE_SOF: if (data == CHAR_SOF) - state = STATE_ID; - return; + state = STATE_ID; + break; case STATE_ID: ts->event = (data & 0xf0) >> 4; ts->len = (data & 0xf); @@ -339,23 +347,25 @@ break; } ts->chksum = data; - state=(ts->len > 0 ) ? STATE_DATA : STATE_EOF; + state = (ts->len > 0) ? STATE_DATA : STATE_EOF; break; case STATE_DATA: ts->chksum += data; ts->buf[ts->idx]= data; - if(++ts->idx == ts->len) + if(++ts->idx == ts->len) state = STATE_EOF; break; case STATE_EOF: state = STATE_SOF; - if (data == CHAR_EOF || data == ts->chksum ) - h3600ts_process_packet(ts); + if (data == CHAR_EOF || data == ts->chksum) + h3600ts_process_packet(ts, regs); break; default: printk("Error3\n"); break; } + + return IRQ_HANDLED; } /* @@ -378,11 +388,11 @@ init_input_dev(&ts->dev); /* Device specific stuff */ - set_GPIO_IRQ_edge( GPIO_BITSY_ACTION_BUTTON, GPIO_BOTH_EDGES ); - set_GPIO_IRQ_edge( GPIO_BITSY_NPOWER_BUTTON, GPIO_RISING_EDGE ); + set_GPIO_IRQ_edge(GPIO_BITSY_ACTION_BUTTON, GPIO_BOTH_EDGES); + set_GPIO_IRQ_edge(GPIO_BITSY_NPOWER_BUTTON, GPIO_RISING_EDGE); if (request_irq(IRQ_GPIO_BITSY_ACTION_BUTTON, action_button_handler, - SA_SHIRQ | SA_INTERRUPT | SA_SAMPLE_RANDOM, + SA_SHIRQ | SA_INTERRUPT | SA_SAMPLE_RANDOM, "h3600_action", &ts->dev)) { printk(KERN_ERR "h3600ts.c: Could not allocate Action Button IRQ!\n"); kfree(ts); @@ -390,24 +400,19 @@ } if (request_irq(IRQ_GPIO_BITSY_NPOWER_BUTTON, npower_button_handler, - SA_SHIRQ | SA_INTERRUPT | SA_SAMPLE_RANDOM, + SA_SHIRQ | SA_INTERRUPT | SA_SAMPLE_RANDOM, "h3600_suspend", &ts->dev)) { free_irq(IRQ_GPIO_BITSY_ACTION_BUTTON, &ts->dev); printk(KERN_ERR "h3600ts.c: Could not allocate Power Button IRQ!\n"); kfree(ts); return; } + /* Now we have things going we setup our input device */ ts->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS) | BIT(EV_LED) | BIT(EV_PWR); - ts->dev.absbit[0] = BIT(ABS_X) | BIT(ABS_Y); - ts->dev.ledbit[0] = BIT(LED_SLEEP); - - ts->dev.absmin[ABS_X] = 60; ts->dev.absmin[ABS_Y] = 35; - ts->dev.absmax[ABS_X] = 985; ts->dev.absmax[ABS_Y] = 1024; - ts->dev.absfuzz[ABS_X] = 0; ts->dev.absfuzz[ABS_Y] = 0; - - ts->serio = serio; - serio->private = ts; + ts->dev.ledbit[0] = BIT(LED_SLEEP); + input_set_abs_params(&ts->dev, ABS_X, 60, 985, 0, 0); + input_set_abs_params(&ts->dev, ABS_Y, 35, 1024, 0, 0); set_bit(KEY_RECORD, ts->dev.keybit); set_bit(KEY_Q, ts->dev.keybit); @@ -422,6 +427,9 @@ ts->dev.keybit[LONG(BTN_TOUCH)] |= BIT(BTN_TOUCH); ts->dev.keybit[LONG(KEY_SUSPEND)] |= BIT(KEY_SUSPEND); + ts->serio = serio; + serio->private = ts; + sprintf(ts->phys, "%s/input0", serio->phys); ts->dev.event = h3600ts_event; @@ -442,7 +450,7 @@ //h3600_flite_control(1, 25); /* default brightness */ #ifdef CONFIG_PM - ts->dev.pm_dev = pm_register(PM_ILLUMINATION_DEV, PM_SYS_LIGHT, + ts->dev.pm_dev = pm_register(PM_ILLUMINATION_DEV, PM_SYS_LIGHT, h3600ts_pm_callback); printk("registered pm callback\n"); #endif @@ -458,7 +466,7 @@ static void h3600ts_disconnect(struct serio *serio) { struct h3600_dev *ts = serio->private; - + free_irq(IRQ_GPIO_BITSY_ACTION_BUTTON, &ts->dev); free_irq(IRQ_GPIO_BITSY_NPOWER_BUTTON, &ts->dev); input_unregister_device(&ts->dev); diff -urN linux-2.6.7-rc2/drivers/md/dm-ioctl.c linux-2.6.7-rc3/drivers/md/dm-ioctl.c --- linux-2.6.7-rc2/drivers/md/dm-ioctl.c 2004-06-07 12:54:49.027043400 -0700 +++ linux-2.6.7-rc3/drivers/md/dm-ioctl.c 2004-06-07 12:55:06.234756087 -0700 @@ -417,9 +417,9 @@ return 0; } -static void list_version_get_needed(struct target_type *tt, void *param) +static void list_version_get_needed(struct target_type *tt, void *needed_param) { - int *needed = param; + size_t *needed = needed_param; *needed += strlen(tt->name); *needed += sizeof(tt->version); @@ -1133,7 +1133,7 @@ * As well as checking the version compatibility this always * copies the kernel interface version out. */ -static int check_version(unsigned int cmd, struct dm_ioctl *user) +static int check_version(unsigned int cmd, struct dm_ioctl __user *user) { uint32_t version[3]; int r = 0; @@ -1168,7 +1168,7 @@ vfree(param); } -static int copy_params(struct dm_ioctl *user, struct dm_ioctl **param) +static int copy_params(struct dm_ioctl __user *user, struct dm_ioctl **param) { struct dm_ioctl tmp, *dmi; @@ -1225,7 +1225,7 @@ int r = 0; unsigned int cmd; struct dm_ioctl *param; - struct dm_ioctl *user = (struct dm_ioctl *) u; + struct dm_ioctl __user *user = (struct dm_ioctl __user *) u; ioctl_fn fn = NULL; size_t param_size; diff -urN linux-2.6.7-rc2/drivers/md/md.c linux-2.6.7-rc3/drivers/md/md.c --- linux-2.6.7-rc2/drivers/md/md.c 2004-05-09 19:32:26.000000000 -0700 +++ linux-2.6.7-rc3/drivers/md/md.c 2004-06-07 12:55:06.264757329 -0700 @@ -1607,7 +1607,7 @@ spin_lock(&pers_lock); if (!pers[pnum] || !try_module_get(pers[pnum]->owner)) { spin_unlock(&pers_lock); - printk(KERN_ERR "md: personality %d is not loaded!\n", + printk(KERN_WARNING "md: personality %d is not loaded!\n", pnum); return -EINVAL; } @@ -1934,7 +1934,7 @@ } -static int get_version(void * arg) +static int get_version(void __user * arg) { mdu_version_t ver; @@ -1948,7 +1948,7 @@ return 0; } -static int get_array_info(mddev_t * mddev, void * arg) +static int get_array_info(mddev_t * mddev, void __user * arg) { mdu_array_info_t info; int nr,working,active,failed,spare; @@ -1998,7 +1998,7 @@ return 0; } -static int get_disk_info(mddev_t * mddev, void * arg) +static int get_disk_info(mddev_t * mddev, void __user * arg) { mdu_disk_info_t info; unsigned int nr; @@ -2251,7 +2251,12 @@ return -EINVAL; } - rdev->sb_offset = calc_dev_sboffset(rdev->bdev); + if (mddev->persistent) + rdev->sb_offset = calc_dev_sboffset(rdev->bdev); + else + rdev->sb_offset = + rdev->bdev->bd_inode->i_size >> BLOCK_SIZE_BITS; + size = calc_dev_size(rdev, mddev->chunk_size); rdev->size = size; @@ -2372,6 +2377,103 @@ return 0; } +/* + * update_array_info is used to change the configuration of an + * on-line array. + * The version, ctime,level,size,raid_disks,not_persistent, layout,chunk_size + * fields in the info are checked against the array. + * Any differences that cannot be handled will cause an error. + * Normally, only one change can be managed at a time. + */ +static int update_array_info(mddev_t *mddev, mdu_array_info_t *info) +{ + int rv = 0; + int cnt = 0; + + if (mddev->major_version != info->major_version || + mddev->minor_version != info->minor_version || +/* mddev->patch_version != info->patch_version || */ + mddev->ctime != info->ctime || + mddev->level != info->level || + mddev->layout != info->layout || + !mddev->persistent != info->not_persistent|| + mddev->chunk_size != info->chunk_size ) + return -EINVAL; + /* Check there is only one change */ + if (mddev->size != info->size) cnt++; + if (mddev->raid_disks != info->raid_disks) cnt++; + if (cnt == 0) return 0; + if (cnt > 1) return -EINVAL; + + if (mddev->size != info->size) { + mdk_rdev_t * rdev; + struct list_head *tmp; + if (mddev->pers->resize == NULL) + return -EINVAL; + /* The "size" is the amount of each device that is used. + * This can only make sense for arrays with redundancy. + * linear and raid0 always use whatever space is available + * We can only consider changing the size of no resync + * or reconstruction is happening, and if the new size + * is acceptable. It must fit before the sb_offset or, + * if that is sync_thread) + return -EBUSY; + ITERATE_RDEV(mddev,rdev,tmp) { + sector_t avail; + int fit = (info->size == 0); + if (rdev->sb_offset > rdev->data_offset) + avail = (rdev->sb_offset*2) - rdev->data_offset; + else + avail = get_capacity(rdev->bdev->bd_disk) + - rdev->data_offset; + if (fit && (info->size == 0 || info->size > avail/2)) + info->size = avail/2; + if (avail < ((sector_t)info->size << 1)) + return -ENOSPC; + } + rv = mddev->pers->resize(mddev, (sector_t)info->size *2); + if (!rv) { + struct block_device *bdev; + + bdev = bdget_disk(mddev->gendisk, 0); + if (bdev) { + down(&bdev->bd_inode->i_sem); + i_size_write(bdev->bd_inode, mddev->array_size << 10); + up(&bdev->bd_inode->i_sem); + bdput(bdev); + } + } + } + if (mddev->raid_disks != info->raid_disks) { + /* change the number of raid disks */ + if (mddev->pers->reshape == NULL) + return -EINVAL; + if (info->raid_disks <= 0 || + info->raid_disks >= mddev->max_disks) + return -EINVAL; + if (mddev->sync_thread) + return -EBUSY; + rv = mddev->pers->reshape(mddev, info->raid_disks); + if (!rv) { + struct block_device *bdev; + + bdev = bdget_disk(mddev->gendisk, 0); + if (bdev) { + down(&bdev->bd_inode->i_sem); + i_size_write(bdev->bd_inode, mddev->array_size << 10); + up(&bdev->bd_inode->i_sem); + bdput(bdev); + } + } + } + md_update_sb(mddev); + return rv; +} + static int set_disk_faulty(mddev_t *mddev, dev_t dev) { mdk_rdev_t *rdev; @@ -2389,7 +2491,8 @@ { char b[BDEVNAME_SIZE]; int err = 0; - struct hd_geometry *loc = (struct hd_geometry *) arg; + void __user *argp = (void __user *)arg; + struct hd_geometry __user *loc = argp; mddev_t *mddev = NULL; if (!capable(CAP_SYS_ADMIN)) @@ -2402,7 +2505,7 @@ switch (cmd) { case RAID_VERSION: - err = get_version((void *)arg); + err = get_version(argp); goto done; case PRINT_RAID_DEBUG: @@ -2463,33 +2566,41 @@ switch (cmd) { case SET_ARRAY_INFO: - - if (!list_empty(&mddev->disks)) { - printk(KERN_WARNING - "md: array %s already has disks!\n", - mdname(mddev)); - err = -EBUSY; - goto abort_unlock; - } - if (mddev->raid_disks) { - printk(KERN_WARNING - "md: array %s already initialised!\n", - mdname(mddev)); - err = -EBUSY; - goto abort_unlock; - } { mdu_array_info_t info; if (!arg) memset(&info, 0, sizeof(info)); - else if (copy_from_user(&info, (void*)arg, sizeof(info))) { + else if (copy_from_user(&info, argp, sizeof(info))) { err = -EFAULT; goto abort_unlock; } + if (mddev->pers) { + err = update_array_info(mddev, &info); + if (err) { + printk(KERN_WARNING "md: couldn't update" + " array info. %d\n", err); + goto abort_unlock; + } + goto done_unlock; + } + if (!list_empty(&mddev->disks)) { + printk(KERN_WARNING + "md: array %s already has disks!\n", + mdname(mddev)); + err = -EBUSY; + goto abort_unlock; + } + if (mddev->raid_disks) { + printk(KERN_WARNING + "md: array %s already initialised!\n", + mdname(mddev)); + err = -EBUSY; + goto abort_unlock; + } err = set_array_info(mddev, &info); if (err) { printk(KERN_WARNING "md: couldn't set" - " array info. %d\n", err); + " array info. %d\n", err); goto abort_unlock; } } @@ -2513,11 +2624,11 @@ switch (cmd) { case GET_ARRAY_INFO: - err = get_array_info(mddev, (void *)arg); + err = get_array_info(mddev, argp); goto done_unlock; case GET_DISK_INFO: - err = get_disk_info(mddev, (void *)arg); + err = get_disk_info(mddev, argp); goto done_unlock; case RESTART_ARRAY_RW: @@ -2543,18 +2654,18 @@ err = -EINVAL; goto abort_unlock; } - err = put_user (2, (char *) &loc->heads); + err = put_user (2, (char __user *) &loc->heads); if (err) goto abort_unlock; - err = put_user (4, (char *) &loc->sectors); + err = put_user (4, (char __user *) &loc->sectors); if (err) goto abort_unlock; err = put_user(get_capacity(mddev->gendisk)/8, - (short *) &loc->cylinders); + (short __user *) &loc->cylinders); if (err) goto abort_unlock; err = put_user (get_start_sect(inode->i_bdev), - (long *) &loc->start); + (long __user *) &loc->start); goto done_unlock; } @@ -2573,7 +2684,7 @@ case ADD_NEW_DISK: { mdu_disk_info_t info; - if (copy_from_user(&info, (void*)arg, sizeof(info))) + if (copy_from_user(&info, argp, sizeof(info))) err = -EFAULT; else err = add_new_disk(mddev, &info); @@ -3278,7 +3389,7 @@ j += sectors; if (j>1) mddev->curr_resync = j; - if (last_check + window > j) + if (last_check + window > j || j == max_sectors) continue; last_check = j; @@ -3444,8 +3555,8 @@ if (rdev->raid_disk >= 0 && rdev->faulty && atomic_read(&rdev->nr_pending)==0) { - mddev->pers->hot_remove_disk(mddev, rdev->raid_disk); - rdev->raid_disk = -1; + if (mddev->pers->hot_remove_disk(mddev, rdev->raid_disk)==0) + rdev->raid_disk = -1; } if (!rdev->faulty && rdev->raid_disk >= 0 && !rdev->in_sync) spares++; diff -urN linux-2.6.7-rc2/drivers/md/multipath.c linux-2.6.7-rc3/drivers/md/multipath.c --- linux-2.6.7-rc2/drivers/md/multipath.c 2004-06-07 12:54:49.030043524 -0700 +++ linux-2.6.7-rc3/drivers/md/multipath.c 2004-06-07 12:55:06.265757371 -0700 @@ -54,9 +54,8 @@ kfree(mpb); } -static int multipath_map (mddev_t *mddev, mdk_rdev_t **rdevp) +static int multipath_map (multipath_conf_t *conf) { - multipath_conf_t *conf = mddev_to_conf(mddev); int i, disks = conf->raid_disks; /* @@ -68,10 +67,9 @@ for (i = 0; i < disks; i++) { mdk_rdev_t *rdev = conf->multipaths[i].rdev; if (rdev && rdev->in_sync) { - *rdevp = rdev; atomic_inc(&rdev->nr_pending); spin_unlock_irq(&conf->device_lock); - return 0; + return i; } } spin_unlock_irq(&conf->device_lock); @@ -133,25 +131,7 @@ (unsigned long long)bio->bi_sector); multipath_reschedule_retry(mp_bh); } - atomic_dec(&rdev->nr_pending); - return 0; -} - -/* - * This routine returns the disk from which the requested read should - * be done. - */ - -static int multipath_read_balance (multipath_conf_t *conf) -{ - int disk; - - for (disk = 0; disk < conf->raid_disks; disk++) { - mdk_rdev_t *rdev = conf->multipaths[disk].rdev; - if (rdev && rdev->in_sync) - return disk; - } - BUG(); + rdev_dec_pending(rdev, conf->mddev); return 0; } @@ -204,14 +184,14 @@ disk_stat_inc(mddev->gendisk, reads); disk_stat_add(mddev->gendisk, read_sectors, bio_sectors(bio)); } - /* - * read balancing logic: - */ - spin_lock_irq(&conf->device_lock); - mp_bh->path = multipath_read_balance(conf); + + mp_bh->path = multipath_map(conf); + if (mp_bh->path < 0) { + bio_endio(bio, bio->bi_size, -EIO); + mempool_free(mp_bh, conf->pool); + return 0; + } multipath = conf->multipaths + mp_bh->path; - atomic_inc(&multipath->rdev->nr_pending); - spin_unlock_irq(&conf->device_lock); mp_bh->bio = *bio; mp_bh->bio.bi_bdev = multipath->rdev->bdev; @@ -375,7 +355,7 @@ struct multipath_bh *mp_bh; struct bio *bio; unsigned long flags; - mdk_rdev_t *rdev; + multipath_conf_t *conf = mddev_to_conf(mddev); md_check_recovery(mddev); for (;;) { @@ -391,8 +371,7 @@ bio = &mp_bh->bio; bio->bi_sector = mp_bh->master_bio->bi_sector; - rdev = NULL; - if (multipath_map (mddev, &rdev)<0) { + if ((mp_bh->path = multipath_map (conf))<0) { printk(KERN_ALERT "multipath: %s: unrecoverable IO read" " error for block %llu\n", bdevname(bio->bi_bdev,b), @@ -403,7 +382,7 @@ " to another IO path\n", bdevname(bio->bi_bdev,b), (unsigned long long)bio->bi_sector); - bio->bi_bdev = rdev->bdev; + bio->bi_bdev = conf->multipaths[mp_bh->path].rdev->bdev; generic_make_request(bio); } } diff -urN linux-2.6.7-rc2/drivers/md/raid1.c linux-2.6.7-rc3/drivers/md/raid1.c --- linux-2.6.7-rc2/drivers/md/raid1.c 2004-06-07 12:54:49.030043524 -0700 +++ linux-2.6.7-rc3/drivers/md/raid1.c 2004-06-07 12:55:06.266757412 -0700 @@ -42,16 +42,17 @@ static void * r1bio_pool_alloc(int gfp_flags, void *data) { - mddev_t *mddev = data; + struct pool_info *pi = data; r1bio_t *r1_bio; /* allocate a r1bio with room for raid_disks entries in the bios array */ - r1_bio = kmalloc(sizeof(r1bio_t) + sizeof(struct bio*)*mddev->raid_disks, + r1_bio = kmalloc(sizeof(r1bio_t) + sizeof(struct bio*)*pi->raid_disks, gfp_flags); if (r1_bio) - memset(r1_bio, 0, sizeof(*r1_bio) + sizeof(struct bio*)*mddev->raid_disks); + memset(r1_bio, 0, sizeof(*r1_bio) + + sizeof(struct bio*) * pi->raid_disks); else - unplug_slaves(mddev); + unplug_slaves(pi->mddev); return r1_bio; } @@ -69,22 +70,22 @@ static void * r1buf_pool_alloc(int gfp_flags, void *data) { - conf_t *conf = data; + struct pool_info *pi = data; struct page *page; r1bio_t *r1_bio; struct bio *bio; int i, j; - r1_bio = r1bio_pool_alloc(gfp_flags, conf->mddev); + r1_bio = r1bio_pool_alloc(gfp_flags, pi); if (!r1_bio) { - unplug_slaves(conf->mddev); + unplug_slaves(pi->mddev); return NULL; } /* * Allocate bios : 1 for reading, n-1 for writing */ - for (j = conf->raid_disks ; j-- ; ) { + for (j = pi->raid_disks ; j-- ; ) { bio = bio_alloc(gfp_flags, RESYNC_PAGES); if (!bio) goto out_free_bio; @@ -111,16 +112,16 @@ for ( ; i > 0 ; i--) __free_page(bio->bi_io_vec[i-1].bv_page); out_free_bio: - while ( ++j < conf->raid_disks ) + while ( ++j < pi->raid_disks ) bio_put(r1_bio->bios[j]); - r1bio_pool_free(r1_bio, conf->mddev); + r1bio_pool_free(r1_bio, data); return NULL; } static void r1buf_pool_free(void *__r1_bio, void *data) { + struct pool_info *pi = data; int i; - conf_t *conf = data; r1bio_t *r1bio = __r1_bio; struct bio *bio = r1bio->bios[0]; @@ -128,10 +129,10 @@ __free_page(bio->bi_io_vec[i].bv_page); bio->bi_io_vec[i].bv_page = NULL; } - for (i=0 ; i < conf->raid_disks; i++) + for (i=0 ; i < pi->raid_disks; i++) bio_put(r1bio->bios[i]); - r1bio_pool_free(r1bio, conf->mddev); + r1bio_pool_free(r1bio, data); } static void put_all_bios(conf_t *conf, r1bio_t *r1_bio) @@ -296,7 +297,7 @@ reschedule_retry(r1_bio); } - atomic_dec(&conf->mirrors[mirror].rdev->nr_pending); + rdev_dec_pending(conf->mirrors[mirror].rdev, conf->mddev); return 0; } @@ -343,7 +344,7 @@ raid_end_bio_io(r1_bio); } - atomic_dec(&conf->mirrors[mirror].rdev->nr_pending); + rdev_dec_pending(conf->mirrors[mirror].rdev, conf->mddev); return 0; } @@ -510,7 +511,7 @@ mirror_info_t *mirror; r1bio_t *r1_bio; struct bio *read_bio; - int i, disks = conf->raid_disks; + int i, disks; /* * Register the new request and wait if the reconstruction @@ -570,6 +571,7 @@ * inc refcount on their rdev. Record them by setting * bios[x] to bio */ + disks = conf->raid_disks; spin_lock_irq(&conf->device_lock); for (i = 0; i < disks; i++) { if (conf->mirrors[i].rdev && @@ -805,7 +807,7 @@ conf->mirrors[r1_bio->read_disk].rdev); else set_bit(R1BIO_Uptodate, &r1_bio->state); - atomic_dec(&conf->mirrors[r1_bio->read_disk].rdev->nr_pending); + rdev_dec_pending(conf->mirrors[r1_bio->read_disk].rdev, conf->mddev); reschedule_retry(r1_bio); return 0; } @@ -835,7 +837,7 @@ md_done_sync(mddev, r1_bio->sectors, uptodate); put_buf(r1_bio); } - atomic_dec(&conf->mirrors[mirror].rdev->nr_pending); + rdev_dec_pending(conf->mirrors[mirror].rdev, mddev); return 0; } @@ -953,7 +955,8 @@ buffs = RESYNC_WINDOW / RESYNC_BLOCK_SIZE; if (conf->r1buf_pool) BUG(); - conf->r1buf_pool = mempool_create(buffs, r1buf_pool_alloc, r1buf_pool_free, conf); + conf->r1buf_pool = mempool_create(buffs, r1buf_pool_alloc, r1buf_pool_free, + conf->poolinfo); if (!conf->r1buf_pool) return -ENOMEM; conf->next_resync = 0; @@ -979,6 +982,7 @@ sector_t max_sector, nr_sectors; int disk; int i; + int write_targets = 0; if (!conf->r1buf_pool) if (init_resync(conf)) @@ -1055,12 +1059,24 @@ sector_nr + RESYNC_SECTORS > mddev->recovery_cp)) { bio->bi_rw = WRITE; bio->bi_end_io = end_sync_write; + write_targets ++; } else continue; bio->bi_sector = sector_nr + conf->mirrors[i].rdev->data_offset; bio->bi_bdev = conf->mirrors[i].rdev->bdev; bio->bi_private = r1_bio; } + if (write_targets == 0) { + /* There is nowhere to write, so all non-sync + * drives must be failed - so we are finished + */ + int rv = max_sector - sector_nr; + md_done_sync(mddev, rv, 1); + put_buf(r1_bio); + atomic_dec(&conf->mirrors[disk].rdev->nr_pending); + return rv; + } + nr_sectors = 0; do { struct page *page; @@ -1123,28 +1139,28 @@ */ conf = kmalloc(sizeof(conf_t), GFP_KERNEL); mddev->private = conf; - if (!conf) { - printk(KERN_ERR "raid1: couldn't allocate memory for %s\n", - mdname(mddev)); - goto out; - } + if (!conf) + goto out_no_mem; + memset(conf, 0, sizeof(*conf)); conf->mirrors = kmalloc(sizeof(struct mirror_info)*mddev->raid_disks, GFP_KERNEL); - if (!conf->mirrors) { - printk(KERN_ERR "raid1: couldn't allocate memory for %s\n", - mdname(mddev)); - goto out_free_conf; - } + if (!conf->mirrors) + goto out_no_mem; + memset(conf->mirrors, 0, sizeof(struct mirror_info)*mddev->raid_disks); + conf->poolinfo = kmalloc(sizeof(*conf->poolinfo), GFP_KERNEL); + if (!conf->poolinfo) + goto out_no_mem; + conf->poolinfo->mddev = mddev; + conf->poolinfo->raid_disks = mddev->raid_disks; conf->r1bio_pool = mempool_create(NR_RAID1_BIOS, r1bio_pool_alloc, - r1bio_pool_free, mddev); - if (!conf->r1bio_pool) { - printk(KERN_ERR "raid1: couldn't allocate memory for %s\n", - mdname(mddev)); - goto out_free_conf; - } + r1bio_pool_free, + conf->poolinfo); + if (!conf->r1bio_pool) + goto out_no_mem; + mddev->queue->unplug_fn = raid1_unplug; @@ -1230,13 +1246,21 @@ return 0; +out_no_mem: + printk(KERN_ERR "raid1: couldn't allocate memory for %s\n", + mdname(mddev)); + out_free_conf: - if (conf->r1bio_pool) - mempool_destroy(conf->r1bio_pool); - if (conf->mirrors) - kfree(conf->mirrors); - kfree(conf); - mddev->private = NULL; + if (conf) { + if (conf->r1bio_pool) + mempool_destroy(conf->r1bio_pool); + if (conf->mirrors) + kfree(conf->mirrors); + if (conf->poolinfo) + kfree(conf->poolinfo); + kfree(conf); + mddev->private = NULL; + } out: return -EIO; } @@ -1251,11 +1275,108 @@ mempool_destroy(conf->r1bio_pool); if (conf->mirrors) kfree(conf->mirrors); + if (conf->poolinfo) + kfree(conf->poolinfo); kfree(conf); mddev->private = NULL; return 0; } +static int raid1_resize(mddev_t *mddev, sector_t sectors) +{ + /* no resync is happening, and there is enough space + * on all devices, so we can resize. + * We need to make sure resync covers any new space. + * If the array is shrinking we should possibly wait until + * any io in the removed space completes, but it hardly seems + * worth it. + */ + mddev->array_size = sectors>>1; + set_capacity(mddev->gendisk, mddev->array_size << 1); + mddev->changed = 1; + if (mddev->array_size > mddev->size && mddev->recovery_cp == MaxSector) { + mddev->recovery_cp = mddev->size << 1; + set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); + } + mddev->size = mddev->array_size; + return 0; +} + +static int raid1_reshape(mddev_t *mddev, int raid_disks) +{ + /* We need to: + * 1/ resize the r1bio_pool + * 2/ resize conf->mirrors + * + * We allocate a new r1bio_pool if we can. + * Then raise a device barrier and wait until all IO stops. + * Then resize conf->mirrors and swap in the new r1bio pool. + */ + mempool_t *newpool, *oldpool; + struct pool_info *newpoolinfo; + mirror_info_t *newmirrors; + conf_t *conf = mddev_to_conf(mddev); + + int d; + + for (d= raid_disks; d < conf->raid_disks; d++) + if (conf->mirrors[d].rdev) + return -EBUSY; + + newpoolinfo = kmalloc(sizeof(newpoolinfo), GFP_KERNEL); + if (!newpoolinfo) + return -ENOMEM; + newpoolinfo->mddev = mddev; + newpoolinfo->raid_disks = raid_disks; + + newpool = mempool_create(NR_RAID1_BIOS, r1bio_pool_alloc, + r1bio_pool_free, newpoolinfo); + if (!newpool) { + kfree(newpoolinfo); + return -ENOMEM; + } + newmirrors = kmalloc(sizeof(struct mirror_info) * raid_disks, GFP_KERNEL); + if (!newmirrors) { + kfree(newpoolinfo); + mempool_destroy(newpool); + return -ENOMEM; + } + memset(newmirrors, 0, sizeof(struct mirror_info)*raid_disks); + + spin_lock_irq(&conf->resync_lock); + conf->barrier++; + wait_event_lock_irq(conf->wait_idle, !conf->nr_pending, + conf->resync_lock, unplug_slaves(mddev)); + spin_unlock_irq(&conf->resync_lock); + + /* ok, everything is stopped */ + oldpool = conf->r1bio_pool; + conf->r1bio_pool = newpool; + for (d=0; d < raid_disks && d < conf->raid_disks; d++) + newmirrors[d] = conf->mirrors[d]; + kfree(conf->mirrors); + conf->mirrors = newmirrors; + kfree(conf->poolinfo); + conf->poolinfo = newpoolinfo; + + mddev->degraded += (raid_disks - conf->raid_disks); + conf->raid_disks = mddev->raid_disks = raid_disks; + + spin_lock_irq(&conf->resync_lock); + conf->barrier--; + spin_unlock_irq(&conf->resync_lock); + wake_up(&conf->wait_resume); + wake_up(&conf->wait_idle); + + + set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); + md_wakeup_thread(mddev->thread); + + mempool_destroy(oldpool); + return 0; +} + + static mdk_personality_t raid1_personality = { .name = "raid1", @@ -1269,6 +1390,8 @@ .hot_remove_disk= raid1_remove_disk, .spare_active = raid1_spare_active, .sync_request = sync_request, + .resize = raid1_resize, + .reshape = raid1_reshape, }; static int __init raid_init(void) diff -urN linux-2.6.7-rc2/drivers/md/raid5.c linux-2.6.7-rc3/drivers/md/raid5.c --- linux-2.6.7-rc2/drivers/md/raid5.c 2004-06-07 12:54:49.031043565 -0700 +++ linux-2.6.7-rc3/drivers/md/raid5.c 2004-06-07 12:55:06.325759856 -0700 @@ -395,7 +395,7 @@ md_error(conf->mddev, conf->disks[i].rdev); clear_bit(R5_UPTODATE, &sh->dev[i].flags); } - atomic_dec(&conf->disks[i].rdev->nr_pending); + rdev_dec_pending(conf->disks[i].rdev, conf->mddev); #if 0 /* must restore b_page before unlocking buffer... */ if (sh->bh_page[i] != bh->b_page) { @@ -438,7 +438,7 @@ if (!uptodate) md_error(conf->mddev, conf->disks[i].rdev); - atomic_dec(&conf->disks[i].rdev->nr_pending); + rdev_dec_pending(conf->disks[i].rdev, conf->mddev); clear_bit(R5_LOCKED, &sh->dev[i].flags); set_bit(STRIPE_HANDLE, &sh->state); @@ -1037,7 +1037,7 @@ * parity, or to satisfy requests * or to load a block that is being partially written. */ - if (to_read || non_overwrite || (syncing && (uptodate+failed < disks))) { + if (to_read || non_overwrite || (syncing && (uptodate < disks))) { for (i=disks; i--;) { dev = &sh->dev[i]; if (!test_bit(R5_LOCKED, &dev->flags) && !test_bit(R5_UPTODATE, &dev->flags) && @@ -1577,6 +1577,9 @@ conf->algorithm = mddev->layout; conf->max_nr_stripes = NR_STRIPES; + /* device size must be a multiple of chunk size */ + mddev->size &= ~(mddev->chunk_size/1024 -1); + if (!conf->chunk_size || conf->chunk_size % 4) { printk(KERN_ERR "raid5: invalid chunk size %d for %s\n", conf->chunk_size, mdname(mddev)); @@ -1828,6 +1831,27 @@ return found; } +static int raid5_resize(mddev_t *mddev, sector_t sectors) +{ + /* no resync is happening, and there is enough space + * on all devices, so we can resize. + * We need to make sure resync covers any new space. + * If the array is shrinking we should possibly wait until + * any io in the removed space completes, but it hardly seems + * worth it. + */ + sectors &= ~((sector_t)mddev->chunk_size/512 - 1); + mddev->array_size = (sectors * (mddev->raid_disks-1))>>1; + set_capacity(mddev->gendisk, mddev->array_size << 1); + mddev->changed = 1; + if (sectors/2 > mddev->size && mddev->recovery_cp == MaxSector) { + mddev->recovery_cp = mddev->size << 1; + set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); + } + mddev->size = sectors /2; + return 0; +} + static mdk_personality_t raid5_personality= { .name = "raid5", @@ -1841,6 +1865,7 @@ .hot_remove_disk= raid5_remove_disk, .spare_active = raid5_spare_active, .sync_request = sync_request, + .resize = raid5_resize, }; static int __init raid5_init (void) diff -urN linux-2.6.7-rc2/drivers/md/raid6main.c linux-2.6.7-rc3/drivers/md/raid6main.c --- linux-2.6.7-rc2/drivers/md/raid6main.c 2004-06-07 12:54:49.033043648 -0700 +++ linux-2.6.7-rc3/drivers/md/raid6main.c 2004-06-07 12:55:06.350760891 -0700 @@ -414,7 +414,7 @@ md_error(conf->mddev, conf->disks[i].rdev); clear_bit(R5_UPTODATE, &sh->dev[i].flags); } - atomic_dec(&conf->disks[i].rdev->nr_pending); + rdev_dec_pending(conf->disks[i].rdev, conf->mddev); #if 0 /* must restore b_page before unlocking buffer... */ if (sh->bh_page[i] != bh->b_page) { @@ -457,7 +457,7 @@ if (!uptodate) md_error(conf->mddev, conf->disks[i].rdev); - atomic_dec(&conf->disks[i].rdev->nr_pending); + rdev_dec_pending(conf->disks[i].rdev, conf->mddev); clear_bit(R5_LOCKED, &sh->dev[i].flags); set_bit(STRIPE_HANDLE, &sh->state); @@ -1741,6 +1741,9 @@ conf->algorithm = mddev->layout; conf->max_nr_stripes = NR_STRIPES; + /* device size must be a multiple of chunk size */ + mddev->size &= ~(mddev->chunk_size/1024 -1); + if (conf->raid_disks < 4) { printk(KERN_ERR "raid6: not enough configured devices for %s (%d, minimum 4)\n", mdname(mddev), conf->raid_disks); @@ -1997,6 +2000,27 @@ return found; } +static int raid6_resize(mddev_t *mddev, sector_t sectors) +{ + /* no resync is happening, and there is enough space + * on all devices, so we can resize. + * We need to make sure resync covers any new space. + * If the array is shrinking we should possibly wait until + * any io in the removed space completes, but it hardly seems + * worth it. + */ + sectors &= ~((sector_t)mddev->chunk_size/512 - 1); + mddev->array_size = (sectors * (mddev->raid_disks-2))>>1; + set_capacity(mddev->gendisk, mddev->array_size << 1); + mddev->changed = 1; + if (sectors/2 > mddev->size && mddev->recovery_cp == MaxSector) { + mddev->recovery_cp = mddev->size << 1; + set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); + } + mddev->size = sectors /2; + return 0; +} + static mdk_personality_t raid6_personality= { .name = "raid6", @@ -2010,6 +2034,7 @@ .hot_remove_disk= raid6_remove_disk, .spare_active = raid6_spare_active, .sync_request = sync_request, + .resize = raid6_resize, }; static int __init raid6_init (void) diff -urN linux-2.6.7-rc2/drivers/media/common/saa7146_fops.c linux-2.6.7-rc3/drivers/media/common/saa7146_fops.c --- linux-2.6.7-rc2/drivers/media/common/saa7146_fops.c 2004-05-09 19:32:37.000000000 -0700 +++ linux-2.6.7-rc3/drivers/media/common/saa7146_fops.c 2004-06-07 12:55:06.424763957 -0700 @@ -396,7 +396,7 @@ return 0; } -static ssize_t fops_read(struct file *file, char *data, size_t count, loff_t *ppos) +static ssize_t fops_read(struct file *file, char __user *data, size_t count, loff_t *ppos) { struct saa7146_fh *fh = file->private_data; diff -urN linux-2.6.7-rc2/drivers/mtd/chips/jedec_probe.c linux-2.6.7-rc3/drivers/mtd/chips/jedec_probe.c --- linux-2.6.7-rc2/drivers/mtd/chips/jedec_probe.c 2004-06-07 12:54:49.076045429 -0700 +++ linux-2.6.7-rc3/drivers/mtd/chips/jedec_probe.c 2004-06-07 12:55:07.106792205 -0700 @@ -108,6 +108,9 @@ #define M29W160DT 0x22C4 #define M29W160DB 0x2249 #define M29W040B 0x00E3 +#define M50FW040 0x002C +#define M50FW080 0x002D +#define M50FW016 0x002E /* SST */ #define SST29EE512 0x005d @@ -1233,6 +1236,45 @@ .regions = { ERASEINFO(0x10000,8), } + }, { + .mfr_id = MANUFACTURER_ST, + .dev_id = M50FW040, + .name = "ST M50FW040", + .uaddr = { + [0] = MTD_UADDR_UNNECESSARY, /* x8 */ + }, + .DevSize = SIZE_512KiB, + .CmdSet = P_ID_INTEL_EXT, + .NumEraseRegions= 1, + .regions = { + ERASEINFO(0x10000,8), + } + }, { + .mfr_id = MANUFACTURER_ST, + .dev_id = M50FW080, + .name = "ST M50FW080", + .uaddr = { + [0] = MTD_UADDR_UNNECESSARY, /* x8 */ + }, + .DevSize = SIZE_1MiB, + .CmdSet = P_ID_INTEL_EXT, + .NumEraseRegions= 1, + .regions = { + ERASEINFO(0x10000,16), + } + }, { + .mfr_id = MANUFACTURER_ST, + .dev_id = M50FW016, + .name = "ST M50FW016", + .uaddr = { + [0] = MTD_UADDR_UNNECESSARY, /* x8 */ + }, + .DevSize = SIZE_2MiB, + .CmdSet = P_ID_INTEL_EXT, + .NumEraseRegions= 1, + .regions = { + ERASEINFO(0x10000,32), + } }, { .mfr_id = MANUFACTURER_TOSHIBA, .dev_id = TC58FVT160, diff -urN linux-2.6.7-rc2/drivers/mtd/maps/lubbock-flash.c linux-2.6.7-rc3/drivers/mtd/maps/lubbock-flash.c --- linux-2.6.7-rc2/drivers/mtd/maps/lubbock-flash.c 2004-05-09 19:32:53.000000000 -0700 +++ linux-2.6.7-rc3/drivers/mtd/maps/lubbock-flash.c 2004-06-07 12:55:07.162794524 -0700 @@ -15,11 +15,12 @@ #include #include #include -#include #include #include #include +#include #include +#include #define ROM_ADDR 0x00000000 diff -urN linux-2.6.7-rc2/drivers/net/3c509.c linux-2.6.7-rc3/drivers/net/3c509.c --- linux-2.6.7-rc2/drivers/net/3c509.c 2004-05-09 19:31:59.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/3c509.c 2004-06-07 12:55:07.176795104 -0700 @@ -1315,7 +1315,7 @@ */ static int -netdev_ethtool_ioctl (struct net_device *dev, void *useraddr) +netdev_ethtool_ioctl (struct net_device *dev, void __user *useraddr) { u32 ethcmd; struct el3_private *lp = netdev_priv(dev); @@ -1323,7 +1323,7 @@ /* dev_ioctl() in ../../net/core/dev.c has already checked capable(CAP_NET_ADMIN), so don't bother with that here. */ - if (get_user(ethcmd, (u32 *)useraddr)) + if (get_user(ethcmd, (u32 __user *)useraddr)) return -EFAULT; switch (ethcmd) { @@ -1412,7 +1412,7 @@ switch (cmd) { case SIOCETHTOOL: - rc = netdev_ethtool_ioctl(dev, (void *) rq->ifr_data); + rc = netdev_ethtool_ioctl(dev, rq->ifr_data); break; default: diff -urN linux-2.6.7-rc2/drivers/net/3c59x.c linux-2.6.7-rc3/drivers/net/3c59x.c --- linux-2.6.7-rc2/drivers/net/3c59x.c 2004-05-09 19:31:55.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/3c59x.c 2004-06-07 12:55:07.178795187 -0700 @@ -2873,7 +2873,7 @@ { struct vortex_private *vp = netdev_priv(dev); long ioaddr = dev->base_addr; - struct mii_ioctl_data *data = (struct mii_ioctl_data *)&rq->ifr_data; + struct mii_ioctl_data *data = if_mii(rq); int phy = vp->phys[0] & 0x1f; int retval; diff -urN linux-2.6.7-rc2/drivers/net/8139cp.c linux-2.6.7-rc3/drivers/net/8139cp.c --- linux-2.6.7-rc2/drivers/net/8139cp.c 2004-05-09 19:32:29.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/8139cp.c 2004-06-07 12:55:07.179795229 -0700 @@ -1546,7 +1546,6 @@ static int cp_ioctl (struct net_device *dev, struct ifreq *rq, int cmd) { struct cp_private *cp = netdev_priv(dev); - struct mii_ioctl_data *mii = (struct mii_ioctl_data *) &rq->ifr_data; int rc; unsigned long flags; @@ -1554,7 +1553,7 @@ return -EINVAL; spin_lock_irqsave(&cp->lock, flags); - rc = generic_mii_ioctl(&cp->mii_if, mii, cmd, NULL); + rc = generic_mii_ioctl(&cp->mii_if, if_mii(rq), cmd, NULL); spin_unlock_irqrestore(&cp->lock, flags); return rc; } diff -urN linux-2.6.7-rc2/drivers/net/8139too.c linux-2.6.7-rc3/drivers/net/8139too.c --- linux-2.6.7-rc2/drivers/net/8139too.c 2004-06-07 12:54:49.080045595 -0700 +++ linux-2.6.7-rc3/drivers/net/8139too.c 2004-06-07 12:55:07.181795311 -0700 @@ -171,7 +171,7 @@ * Receive ring size * Warning: 64K ring has hardware issues and may lock up. */ -#if defined(CONFIG_SH_DREAMCAST) || defined(CONFIG_EMBEDDED) +#if defined(CONFIG_SH_DREAMCAST) #define RX_BUF_IDX 1 /* 16K ring */ #else #define RX_BUF_IDX 2 /* 32K ring */ @@ -2458,14 +2458,13 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { struct rtl8139_private *np = dev->priv; - struct mii_ioctl_data *data = (struct mii_ioctl_data *) & rq->ifr_data; int rc; if (!netif_running(dev)) return -EINVAL; spin_lock_irq(&np->lock); - rc = generic_mii_ioctl(&np->mii, data, cmd, NULL); + rc = generic_mii_ioctl(&np->mii, if_mii(rq), cmd, NULL); spin_unlock_irq(&np->lock); return rc; diff -urN linux-2.6.7-rc2/drivers/net/Kconfig linux-2.6.7-rc3/drivers/net/Kconfig --- linux-2.6.7-rc2/drivers/net/Kconfig 2004-06-07 12:54:49.082045678 -0700 +++ linux-2.6.7-rc3/drivers/net/Kconfig 2004-06-07 12:55:07.192795767 -0700 @@ -1874,25 +1874,12 @@ # Gigabit Ethernet # -menu "Gigabit Ethernet (1000/10000 Mbit)" +menu "Ethernet (1000 Mbit)" depends on NETDEVICES -config NET_GIGE - bool "Gigabit Ethernet (1000/10000 Mbit) controller support" - depends on NETDEVICES && NET_ETHERNET && (PCI || SBUS) - help - Gigabit ethernet. It's yummy and fast, fast, fast. - - Note that the answer to this question doesn't directly affect the - kernel: saying N will just cause the configurator to skip all - the questions about this class of network cards. If you say Y, you - will be asked for your specific card in the following questions. - - If you are unsure, say Y. - config ACENIC tristate "Alteon AceNIC/3Com 3C985/NetGear GA620 Gigabit support" - depends on PCI && NET_GIGE + depends on PCI ---help--- Say Y here if you have an Alteon AceNIC, 3Com 3C985(B), NetGear GA620, SGI Gigabit or Farallon PN9000-SX PCI Gigabit Ethernet @@ -1919,7 +1906,7 @@ config DL2K tristate "D-Link DL2000-based Gigabit Ethernet support" - depends on PCI && NET_GIGE + depends on PCI select CRC32 help This driver supports D-Link 2000-based gigabit ethernet cards, which @@ -1932,7 +1919,7 @@ config E1000 tristate "Intel(R) PRO/1000 Gigabit Ethernet support" - depends on PCI && NET_GIGE + depends on PCI ---help--- This driver supports Intel(R) PRO/1000 gigabit ethernet family of adapters, which includes: @@ -1979,7 +1966,7 @@ config MYRI_SBUS tristate "MyriCOM Gigabit Ethernet support" - depends on SBUS && NET_GIGE + depends on SBUS help This driver supports MyriCOM Sbus gigabit Ethernet cards. @@ -1988,7 +1975,7 @@ config NS83820 tristate "National Semiconduct DP83820 support" - depends on PCI && NET_GIGE + depends on PCI help This is a driver for the National Semiconductor DP83820 series of gigabit ethernet MACs. Cards using this chipset include @@ -1998,7 +1985,7 @@ config HAMACHI tristate "Packet Engines Hamachi GNIC-II support" - depends on PCI && NET_GIGE + depends on PCI select MII help If you have a Gigabit Ethernet card of this type, say Y and read @@ -2011,7 +1998,7 @@ config YELLOWFIN tristate "Packet Engines Yellowfin Gigabit-NIC support (EXPERIMENTAL)" - depends on PCI && EXPERIMENTAL && NET_GIGE + depends on PCI && EXPERIMENTAL select CRC32 ---help--- Say Y here if you have a Packet Engines G-NIC PCI Gigabit Ethernet @@ -2025,7 +2012,7 @@ config R8169 tristate "Realtek 8169 gigabit ethernet support" - depends on PCI && NET_GIGE + depends on PCI select CRC32 ---help--- Say Y here if you have a Realtek 8169 PCI Gigabit Ethernet adapter. @@ -2035,7 +2022,7 @@ config SK98LIN tristate "Marvell Yukon Chipset / SysKonnect SK-98xx Support" - depends on PCI && NET_GIGE + depends on PCI ---help--- Say Y here if you have a Marvell Yukon or SysKonnect SK-98xx/SK-95xx compliant Gigabit Ethernet Adapter. The following adapters are supported @@ -2114,16 +2101,25 @@ config TIGON3 tristate "Broadcom Tigon3 support" - depends on PCI && NET_GIGE + depends on PCI help This driver supports Broadcom Tigon3 based gigabit Ethernet cards. To compile this driver as a module, choose M here: the module will be called tg3. This is recommended. +endmenu + +# +# 10 Gigabit Ethernet +# + +menu "Ethernet (10000 Mbit)" + depends on NETDEVICES + config IXGB tristate "Intel(R) PRO/10GbE support" - depends on PCI && NET_GIGE + depends on PCI ---help--- This driver supports Intel(R) PRO/10GbE family of adapters, which includes: @@ -2155,7 +2151,7 @@ config S2IO tristate "S2IO 10Gbe XFrame NIC" - depends on PCI && NET_GIGE + depends on PCI ---help--- This driver supports the 10Gbe XFrame NIC of S2IO. For help regarding driver compilation, installation and diff -urN linux-2.6.7-rc2/drivers/net/amd8111e.c linux-2.6.7-rc3/drivers/net/amd8111e.c --- linux-2.6.7-rc2/drivers/net/amd8111e.c 2004-05-09 19:32:38.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/amd8111e.c 2004-06-07 12:55:07.208796430 -0700 @@ -1571,7 +1571,7 @@ This function handles all the ethtool ioctls. It gives driver info, gets/sets driver speed, gets memory mapped register values, forces auto negotiation, sets/gets WOL options for ethtool application. */ -static int amd8111e_ethtool_ioctl(struct net_device* dev, void* useraddr) +static int amd8111e_ethtool_ioctl(struct net_device* dev, void __user *useraddr) { struct amd8111e_priv *lp = netdev_priv(dev); struct pci_dev *pci_dev = lp->pci_dev; @@ -1694,7 +1694,7 @@ } static int amd8111e_ioctl(struct net_device * dev , struct ifreq *ifr, int cmd) { - struct mii_ioctl_data *data = (struct mii_ioctl_data *)&ifr->ifr_data; + struct mii_ioctl_data *data = if_mii(ifr); struct amd8111e_priv *lp = netdev_priv(dev); int err; u32 mii_regval; @@ -1704,7 +1704,7 @@ switch(cmd) { case SIOCETHTOOL: - return amd8111e_ethtool_ioctl(dev, (void *) ifr->ifr_data); + return amd8111e_ethtool_ioctl(dev, ifr->ifr_data); case SIOCGMIIPHY: data->phy_id = PHY_ID; diff -urN linux-2.6.7-rc2/drivers/net/appletalk/cops.c linux-2.6.7-rc3/drivers/net/appletalk/cops.c --- linux-2.6.7-rc2/drivers/net/appletalk/cops.c 2004-05-09 19:32:37.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/appletalk/cops.c 2004-06-07 12:55:07.209796471 -0700 @@ -524,7 +524,7 @@ static void cops_load (struct net_device *dev) { struct ifreq ifr; - struct ltfirmware *ltf= (struct ltfirmware *)&ifr.ifr_data; + struct ltfirmware *ltf= (struct ltfirmware *)&ifr.ifr_ifru; struct cops_local *lp = netdev_priv(dev); int ioaddr=dev->base_addr; int length, i = 0; diff -urN linux-2.6.7-rc2/drivers/net/appletalk/ipddp.c linux-2.6.7-rc3/drivers/net/appletalk/ipddp.c --- linux-2.6.7-rc2/drivers/net/appletalk/ipddp.c 2004-05-09 19:32:00.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/appletalk/ipddp.c 2004-06-07 12:55:07.209796471 -0700 @@ -259,7 +259,7 @@ static int ipddp_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) { - struct ipddp_route *rt = (struct ipddp_route *)ifr->ifr_data; + struct ipddp_route __user *rt = ifr->ifr_data; struct ipddp_route rcp; if(!capable(CAP_NET_ADMIN)) diff -urN linux-2.6.7-rc2/drivers/net/au1000_eth.c linux-2.6.7-rc3/drivers/net/au1000_eth.c --- linux-2.6.7-rc2/drivers/net/au1000_eth.c 2004-05-09 19:32:37.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/au1000_eth.c 2004-06-07 12:55:07.211796554 -0700 @@ -1269,7 +1269,7 @@ static int au1000_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { - u16 *data = (u16 *)&rq->ifr_data; + u16 *data = (u16 *)&rq->ifr_ifru; /* fixme */ switch(cmd) { diff -urN linux-2.6.7-rc2/drivers/net/b44.c linux-2.6.7-rc3/drivers/net/b44.c --- linux-2.6.7-rc2/drivers/net/b44.c 2004-06-07 12:54:49.093046133 -0700 +++ linux-2.6.7-rc3/drivers/net/b44.c 2004-06-07 12:55:07.217796803 -0700 @@ -1633,7 +1633,7 @@ static int b44_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) { - struct mii_ioctl_data __user *data = (struct mii_ioctl_data __user *)&ifr->ifr_data; + struct mii_ioctl_data *data = if_mii(ifr); struct b44 *bp = netdev_priv(dev); int err; diff -urN linux-2.6.7-rc2/drivers/net/bonding/bond_main.c linux-2.6.7-rc3/drivers/net/bonding/bond_main.c --- linux-2.6.7-rc2/drivers/net/bonding/bond_main.c 2004-05-09 19:33:20.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/bonding/bond_main.c 2004-06-07 12:55:07.246798004 -0700 @@ -1103,7 +1103,7 @@ /* Yes, the mii is overlaid on the ifreq.ifr_ifru */ strncpy(ifr.ifr_name, slave_dev->name, IFNAMSIZ); - mii = (struct mii_ioctl_data *)&ifr.ifr_data; + mii = if_mii(&ifr); if (IOCTL(slave_dev, &ifr, SIOCGMIIPHY) == 0) { mii->reg_num = MII_BMSR; if (IOCTL(slave_dev, &ifr, SIOCGMIIREG) == 0) { @@ -2357,10 +2357,10 @@ static int bond_ethtool_ioctl(struct net_device *bond_dev, struct ifreq *ifr) { struct ethtool_drvinfo info; - void *addr = ifr->ifr_data; + void __user *addr = ifr->ifr_data; uint32_t cmd; - if (get_user(cmd, (uint32_t *)addr)) { + if (get_user(cmd, (uint32_t __user *)addr)) { return -EFAULT; } @@ -3667,8 +3667,10 @@ static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd) { struct net_device *slave_dev = NULL; - struct ifbond *u_binfo = NULL, k_binfo; - struct ifslave *u_sinfo = NULL, k_sinfo; + struct ifbond k_binfo; + struct ifbond __user *u_binfo = NULL; + struct ifslave k_sinfo; + struct ifslave __user *u_sinfo = NULL; struct mii_ioctl_data *mii = NULL; int prev_abi_ver = orig_app_abi_ver; int res = 0; @@ -3680,7 +3682,7 @@ case SIOCETHTOOL: return bond_ethtool_ioctl(bond_dev, ifr); case SIOCGMIIPHY: - mii = (struct mii_ioctl_data *)&ifr->ifr_data; + mii = if_mii(ifr); if (!mii) { return -EINVAL; } @@ -3691,7 +3693,7 @@ * We do this again just in case we were called by SIOCGMIIREG * instead of SIOCGMIIPHY. */ - mii = (struct mii_ioctl_data *)&ifr->ifr_data; + mii = if_mii(ifr); if (!mii) { return -EINVAL; } @@ -3711,7 +3713,7 @@ return 0; case BOND_INFO_QUERY_OLD: case SIOCBONDINFOQUERY: - u_binfo = (struct ifbond *)ifr->ifr_data; + u_binfo = (struct ifbond __user *)ifr->ifr_data; if (copy_from_user(&k_binfo, u_binfo, sizeof(ifbond))) { return -EFAULT; @@ -3727,7 +3729,7 @@ return res; case BOND_SLAVE_INFO_QUERY_OLD: case SIOCBONDSLAVEINFOQUERY: - u_sinfo = (struct ifslave *)ifr->ifr_data; + u_sinfo = (struct ifslave __user *)ifr->ifr_data; if (copy_from_user(&k_sinfo, u_sinfo, sizeof(ifslave))) { return -EFAULT; diff -urN linux-2.6.7-rc2/drivers/net/depca.c linux-2.6.7-rc3/drivers/net/depca.c --- linux-2.6.7-rc2/drivers/net/depca.c 2004-05-09 19:32:37.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/depca.c 2004-06-07 12:55:07.248798087 -0700 @@ -1937,7 +1937,7 @@ static int depca_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { struct depca_private *lp = (struct depca_private *) dev->priv; - struct depca_ioctl *ioc = (struct depca_ioctl *) &rq->ifr_data; + struct depca_ioctl *ioc = (struct depca_ioctl *) &rq->ifr_ifru; int i, status = 0; u_long ioaddr = dev->base_addr; union { diff -urN linux-2.6.7-rc2/drivers/net/depca.h linux-2.6.7-rc3/drivers/net/depca.h --- linux-2.6.7-rc2/drivers/net/depca.h 2004-05-09 19:32:38.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/depca.h 2004-06-07 12:55:07.248798087 -0700 @@ -162,7 +162,7 @@ struct depca_ioctl { unsigned short cmd; /* Command to run */ unsigned short len; /* Length of the data buffer */ - unsigned char *data; /* Pointer to the data buffer */ + unsigned char __user *data; /* Pointer to the data buffer */ }; /* diff -urN linux-2.6.7-rc2/drivers/net/dl2k.c linux-2.6.7-rc3/drivers/net/dl2k.c --- linux-2.6.7-rc2/drivers/net/dl2k.c 2004-05-09 19:32:28.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/dl2k.c 2004-06-07 12:55:07.249798128 -0700 @@ -107,7 +107,7 @@ static void set_multicast (struct net_device *dev); static struct net_device_stats *get_stats (struct net_device *dev); static int clear_stats (struct net_device *dev); -static int rio_ethtool_ioctl (struct net_device *dev, void *useraddr); +static int rio_ethtool_ioctl (struct net_device *dev, void __user *useraddr); static int rio_ioctl (struct net_device *dev, struct ifreq *rq, int cmd); static int rio_close (struct net_device *dev); static int find_miiphy (struct net_device *dev); @@ -1195,7 +1195,7 @@ } static int -rio_ethtool_ioctl (struct net_device *dev, void *useraddr) +rio_ethtool_ioctl (struct net_device *dev, void __user *useraddr) { struct netdev_private *np = dev->priv; u32 ethcmd; @@ -1325,7 +1325,7 @@ { int phy_addr; struct netdev_private *np = dev->priv; - struct mii_data *miidata = (struct mii_data *) &rq->ifr_data; + struct mii_data *miidata = (struct mii_data *) &rq->ifr_ifru; struct netdev_desc *desc; int i; @@ -1333,7 +1333,7 @@ phy_addr = np->phy_addr; switch (cmd) { case SIOCETHTOOL: - return rio_ethtool_ioctl (dev, (void *) rq->ifr_data); + return rio_ethtool_ioctl(dev, rq->ifr_data); case SIOCDEVPRIVATE: break; diff -urN linux-2.6.7-rc2/drivers/net/e100.c linux-2.6.7-rc3/drivers/net/e100.c --- linux-2.6.7-rc2/drivers/net/e100.c 2004-06-07 12:54:49.096046257 -0700 +++ linux-2.6.7-rc3/drivers/net/e100.c 2004-06-07 12:55:07.252798252 -0700 @@ -2075,9 +2075,8 @@ static int e100_do_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) { struct nic *nic = netdev_priv(netdev); - struct mii_ioctl_data *mii = (struct mii_ioctl_data *)&ifr->ifr_data; - return generic_mii_ioctl(&nic->mii, mii, cmd, NULL); + return generic_mii_ioctl(&nic->mii, if_mii(ifr), cmd, NULL); } static int e100_alloc(struct nic *nic) diff -urN linux-2.6.7-rc2/drivers/net/e1000/e1000_ethtool.c linux-2.6.7-rc3/drivers/net/e1000/e1000_ethtool.c --- linux-2.6.7-rc2/drivers/net/e1000/e1000_ethtool.c 2004-06-07 12:54:49.099046382 -0700 +++ linux-2.6.7-rc3/drivers/net/e1000/e1000_ethtool.c 2004-06-07 12:55:07.255798376 -0700 @@ -297,30 +297,7 @@ return 0; } -static uint32_t -e1000_get_sg(struct net_device *netdev) -{ - return (netdev->features & NETIF_F_SG) != 0; -} - -static int -e1000_set_sg(struct net_device *netdev, uint32_t data) -{ - if (data) - netdev->features |= NETIF_F_SG; - else - netdev->features &= ~NETIF_F_SG; - - return 0; -} - #ifdef NETIF_F_TSO -static uint32_t -e1000_get_tso(struct net_device *netdev) -{ - return (netdev->features & NETIF_F_TSO) != 0; -} - static int e1000_set_tso(struct net_device *netdev, uint32_t data) { @@ -1577,12 +1554,6 @@ return 0; } -static uint32_t -e1000_get_link(struct net_device *netdev) -{ - return netif_carrier_ok(netdev); -} - static int e1000_get_stats_count(struct net_device *netdev) { @@ -1635,7 +1606,7 @@ .get_msglevel = e1000_get_msglevel, .set_msglevel = e1000_set_msglevel, .nway_reset = e1000_nway_reset, - .get_link = e1000_get_link, + .get_link = ethtool_op_get_link, .get_eeprom_len = e1000_get_eeprom_len, .get_eeprom = e1000_get_eeprom, .set_eeprom = e1000_set_eeprom, @@ -1647,10 +1618,10 @@ .set_rx_csum = e1000_set_rx_csum, .get_tx_csum = e1000_get_tx_csum, .set_tx_csum = e1000_set_tx_csum, - .get_sg = e1000_get_sg, - .set_sg = e1000_set_sg, + .get_sg = ethtool_op_get_sg, + .set_sg = ethtool_op_set_sg, #ifdef NETIF_F_TSO - .get_tso = e1000_get_tso, + .get_tso = ethtool_op_get_tso, .set_tso = e1000_set_tso, #endif .self_test_count = e1000_diag_test_count, diff -urN linux-2.6.7-rc2/drivers/net/e1000/e1000_main.c linux-2.6.7-rc3/drivers/net/e1000/e1000_main.c --- linux-2.6.7-rc2/drivers/net/e1000/e1000_main.c 2004-06-07 12:54:49.108046754 -0700 +++ linux-2.6.7-rc3/drivers/net/e1000/e1000_main.c 2004-06-07 12:55:07.263798708 -0700 @@ -2503,7 +2503,7 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) { struct e1000_adapter *adapter = netdev->priv; - struct mii_ioctl_data *data = (struct mii_ioctl_data *)&ifr->ifr_data; + struct mii_ioctl_data *data = if_mii(ifr); int retval; uint16_t mii_reg; uint16_t spddplx; diff -urN linux-2.6.7-rc2/drivers/net/eepro100.c linux-2.6.7-rc3/drivers/net/eepro100.c --- linux-2.6.7-rc2/drivers/net/eepro100.c 2004-06-07 12:54:49.111046879 -0700 +++ linux-2.6.7-rc3/drivers/net/eepro100.c 2004-06-07 12:55:07.267798873 -0700 @@ -2017,7 +2017,7 @@ return &sp->stats; } -static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr) +static int netdev_ethtool_ioctl(struct net_device *dev, void __user *useraddr) { u32 ethcmd; struct speedo_private *sp = netdev_priv(dev); @@ -2096,7 +2096,7 @@ static int speedo_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { struct speedo_private *sp = netdev_priv(dev); - struct mii_ioctl_data *data = (struct mii_ioctl_data *)&rq->ifr_data; + struct mii_ioctl_data *data = if_mii(rq); int phy = sp->phy[0] & 0x1f; int saved_acpi; int t; @@ -2129,7 +2129,7 @@ pci_set_power_state(sp->pdev, saved_acpi); return 0; case SIOCETHTOOL: - return netdev_ethtool_ioctl(dev, (void *) rq->ifr_data); + return netdev_ethtool_ioctl(dev, rq->ifr_data); default: return -EOPNOTSUPP; } diff -urN linux-2.6.7-rc2/drivers/net/epic100.c linux-2.6.7-rc3/drivers/net/epic100.c --- linux-2.6.7-rc2/drivers/net/epic100.c 2004-05-09 19:32:29.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/epic100.c 2004-06-07 12:55:07.268798915 -0700 @@ -1440,7 +1440,7 @@ { struct epic_private *np = dev->priv; long ioaddr = dev->base_addr; - struct mii_ioctl_data *data = (struct mii_ioctl_data *)&rq->ifr_data; + struct mii_ioctl_data *data = if_mii(rq); int rc; /* power-up, if interface is down */ diff -urN linux-2.6.7-rc2/drivers/net/eql.c linux-2.6.7-rc3/drivers/net/eql.c --- linux-2.6.7-rc2/drivers/net/eql.c 2004-05-09 19:33:19.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/eql.c 2004-06-07 12:55:07.269798956 -0700 @@ -255,14 +255,14 @@ return 0; } -static int eql_enslave(struct net_device *dev, slaving_request_t *srq); -static int eql_emancipate(struct net_device *dev, slaving_request_t *srq); +static int eql_enslave(struct net_device *dev, slaving_request_t __user *srq); +static int eql_emancipate(struct net_device *dev, slaving_request_t __user *srq); -static int eql_g_slave_cfg(struct net_device *dev, slave_config_t *sc); -static int eql_s_slave_cfg(struct net_device *dev, slave_config_t *sc); +static int eql_g_slave_cfg(struct net_device *dev, slave_config_t __user *sc); +static int eql_s_slave_cfg(struct net_device *dev, slave_config_t __user *sc); -static int eql_g_master_cfg(struct net_device *dev, master_config_t *mc); -static int eql_s_master_cfg(struct net_device *dev, master_config_t *mc); +static int eql_g_master_cfg(struct net_device *dev, master_config_t __user *mc); +static int eql_s_master_cfg(struct net_device *dev, master_config_t __user *mc); static int eql_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) { @@ -272,23 +272,17 @@ switch (cmd) { case EQL_ENSLAVE: - return eql_enslave(dev, - (slaving_request_t *) ifr->ifr_data); + return eql_enslave(dev, ifr->ifr_data); case EQL_EMANCIPATE: - return eql_emancipate(dev, - (slaving_request_t *) ifr->ifr_data); + return eql_emancipate(dev, ifr->ifr_data); case EQL_GETSLAVECFG: - return eql_g_slave_cfg(dev, - (slave_config_t *) ifr->ifr_data); + return eql_g_slave_cfg(dev, ifr->ifr_data); case EQL_SETSLAVECFG: - return eql_s_slave_cfg(dev, - (slave_config_t *) ifr->ifr_data); + return eql_s_slave_cfg(dev, ifr->ifr_data); case EQL_GETMASTRCFG: - return eql_g_master_cfg(dev, - (master_config_t *) ifr->ifr_data); + return eql_g_master_cfg(dev, ifr->ifr_data); case EQL_SETMASTRCFG: - return eql_s_master_cfg(dev, - (master_config_t *) ifr->ifr_data); + return eql_s_master_cfg(dev, ifr->ifr_data); default: return -EOPNOTSUPP; }; @@ -411,7 +405,7 @@ return -ENOSPC; } -static int eql_enslave(struct net_device *master_dev, slaving_request_t *srqp) +static int eql_enslave(struct net_device *master_dev, slaving_request_t __user *srqp) { struct net_device *slave_dev; slaving_request_t srq; @@ -457,7 +451,7 @@ return -EINVAL; } -static int eql_emancipate(struct net_device *master_dev, slaving_request_t *srqp) +static int eql_emancipate(struct net_device *master_dev, slaving_request_t __user *srqp) { equalizer_t *eql = master_dev->priv; struct net_device *slave_dev; @@ -489,7 +483,7 @@ return ret; } -static int eql_g_slave_cfg(struct net_device *dev, slave_config_t *scp) +static int eql_g_slave_cfg(struct net_device *dev, slave_config_t __user *scp) { equalizer_t *eql = dev->priv; slave_t *slave; @@ -522,7 +516,7 @@ return ret; } -static int eql_s_slave_cfg(struct net_device *dev, slave_config_t *scp) +static int eql_s_slave_cfg(struct net_device *dev, slave_config_t __user *scp) { slave_t *slave; equalizer_t *eql; @@ -553,7 +547,7 @@ return ret; } -static int eql_g_master_cfg(struct net_device *dev, master_config_t *mcp) +static int eql_g_master_cfg(struct net_device *dev, master_config_t __user *mcp) { equalizer_t *eql; master_config_t mc; @@ -569,7 +563,7 @@ return -EINVAL; } -static int eql_s_master_cfg(struct net_device *dev, master_config_t *mcp) +static int eql_s_master_cfg(struct net_device *dev, master_config_t __user *mcp) { equalizer_t *eql; master_config_t mc; diff -urN linux-2.6.7-rc2/drivers/net/ewrk3.c linux-2.6.7-rc3/drivers/net/ewrk3.c --- linux-2.6.7-rc2/drivers/net/ewrk3.c 2004-05-09 19:33:20.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/ewrk3.c 2004-06-07 12:55:07.270798998 -0700 @@ -1518,13 +1518,13 @@ return status; /* return the device name string */ } -static int ewrk3_ethtool_ioctl(struct net_device *dev, void *useraddr) +static int ewrk3_ethtool_ioctl(struct net_device *dev, void __user *useraddr) { struct ewrk3_private *lp = (struct ewrk3_private *) dev->priv; u_long iobase = dev->base_addr; u32 ethcmd; - if (get_user(ethcmd, (u32 *)useraddr)) + if (get_user(ethcmd, (u32 __user *)useraddr)) return -EFAULT; switch (ethcmd) { @@ -1707,7 +1707,7 @@ static int ewrk3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { struct ewrk3_private *lp = (struct ewrk3_private *) dev->priv; - struct ewrk3_ioctl *ioc = (struct ewrk3_ioctl *) &rq->ifr_data; + struct ewrk3_ioctl *ioc = (struct ewrk3_ioctl *) &rq->ifr_ifru; u_long iobase = dev->base_addr; int i, j, status = 0; u_char csr; @@ -1721,7 +1721,7 @@ /* ethtool IOCTLs are handled elsewhere */ if (cmd == SIOCETHTOOL) - return ewrk3_ethtool_ioctl(dev, (void *)rq->ifr_data); + return ewrk3_ethtool_ioctl(dev, rq->ifr_data); /* Other than ethtool, all we handle are private IOCTLs */ if (cmd != EWRK3IOCTL) diff -urN linux-2.6.7-rc2/drivers/net/ewrk3.h linux-2.6.7-rc3/drivers/net/ewrk3.h --- linux-2.6.7-rc2/drivers/net/ewrk3.h 2004-05-09 19:32:27.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/ewrk3.h 2004-06-07 12:55:07.270798998 -0700 @@ -296,7 +296,7 @@ struct ewrk3_ioctl { unsigned short cmd; /* Command to run */ unsigned short len; /* Length of the data buffer */ - unsigned char *data; /* Pointer to the data buffer */ + unsigned char __user *data; /* Pointer to the data buffer */ }; /* diff -urN linux-2.6.7-rc2/drivers/net/fealnx.c linux-2.6.7-rc3/drivers/net/fealnx.c --- linux-2.6.7-rc2/drivers/net/fealnx.c 2004-06-07 12:54:49.114047003 -0700 +++ linux-2.6.7-rc3/drivers/net/fealnx.c 2004-06-07 12:55:07.273799122 -0700 @@ -1923,14 +1923,13 @@ static int mii_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { struct netdev_private *np = dev->priv; - struct mii_ioctl_data *data = (struct mii_ioctl_data *) & rq->ifr_data; int rc; if (!netif_running(dev)) return -EINVAL; spin_lock_irq(&np->lock); - rc = generic_mii_ioctl(&np->mii, data, cmd, NULL); + rc = generic_mii_ioctl(&np->mii, if_mii(rq), cmd, NULL); spin_unlock_irq(&np->lock); return rc; diff -urN linux-2.6.7-rc2/drivers/net/forcedeth.c linux-2.6.7-rc3/drivers/net/forcedeth.c --- linux-2.6.7-rc2/drivers/net/forcedeth.c 2004-05-09 19:31:59.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/forcedeth.c 2004-06-07 12:55:07.274799163 -0700 @@ -556,7 +556,7 @@ return &np->stats; } -static int nv_ethtool_ioctl(struct net_device *dev, void *useraddr) +static int nv_ethtool_ioctl(struct net_device *dev, void __user *useraddr) { struct fe_priv *np = get_nvpriv(dev); u8 *base = get_hwbase(dev); @@ -634,7 +634,7 @@ { switch(cmd) { case SIOCETHTOOL: - return nv_ethtool_ioctl(dev, (void *) rq->ifr_data); + return nv_ethtool_ioctl(dev, rq->ifr_data); default: return -EOPNOTSUPP; diff -urN linux-2.6.7-rc2/drivers/net/hamachi.c linux-2.6.7-rc3/drivers/net/hamachi.c --- linux-2.6.7-rc2/drivers/net/hamachi.c 2004-05-09 19:33:21.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/hamachi.c 2004-06-07 12:55:07.277799288 -0700 @@ -1869,7 +1869,7 @@ } } -static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr) +static int netdev_ethtool_ioctl(struct net_device *dev, void __user *useraddr) { struct hamachi_private *np = dev->priv; u32 ethcmd; @@ -1937,17 +1937,17 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { struct hamachi_private *np = dev->priv; - struct mii_ioctl_data *data = (struct mii_ioctl_data *) & rq->ifr_data; + struct mii_ioctl_data *data = if_mii(rq); int rc; if (!netif_running(dev)) return -EINVAL; if (cmd == SIOCETHTOOL) - rc = netdev_ethtool_ioctl(dev, (void *) rq->ifr_data); + rc = netdev_ethtool_ioctl(dev, rq->ifr_data); else if (cmd == (SIOCDEVPRIVATE+3)) { /* set rx,tx intr params */ - u32 *d = (u32 *)&rq->ifr_data; + u32 *d = (u32 *)&rq->ifr_ifru; /* Should add this check here or an ordinary user can do nasty * things. -KDU * diff -urN linux-2.6.7-rc2/drivers/net/hamradio/baycom_epp.c linux-2.6.7-rc3/drivers/net/hamradio/baycom_epp.c --- linux-2.6.7-rc2/drivers/net/hamradio/baycom_epp.c 2004-05-09 19:33:21.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/hamradio/baycom_epp.c 2004-06-07 12:55:07.278799329 -0700 @@ -1166,8 +1166,6 @@ bc = netdev_priv(dev); if (cmd != SIOCDEVPRIVATE) return -ENOIOCTLCMD; - if (get_user(cmd, (int *)ifr->ifr_data)) - return -EFAULT; if (copy_from_user(&hi, ifr->ifr_data, sizeof(hi))) return -EFAULT; diff -urN linux-2.6.7-rc2/drivers/net/hamradio/baycom_par.c linux-2.6.7-rc3/drivers/net/hamradio/baycom_par.c --- linux-2.6.7-rc2/drivers/net/hamradio/baycom_par.c 2004-05-09 19:33:20.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/hamradio/baycom_par.c 2004-06-07 12:55:07.278799329 -0700 @@ -414,7 +414,6 @@ { struct baycom_state *bc; struct baycom_ioctl bi; - int cmd2; if (!dev || !dev->priv || ((struct baycom_state *)dev->priv)->hdrv.magic != HDLCDRV_MAGIC) { @@ -425,8 +424,6 @@ if (cmd != SIOCDEVPRIVATE) return -ENOIOCTLCMD; - if (get_user(cmd2, (int *)ifr->ifr_data)) - return -EFAULT; switch (hi->cmd) { default: break; diff -urN linux-2.6.7-rc2/drivers/net/hamradio/baycom_ser_fdx.c linux-2.6.7-rc3/drivers/net/hamradio/baycom_ser_fdx.c --- linux-2.6.7-rc2/drivers/net/hamradio/baycom_ser_fdx.c 2004-05-09 19:32:38.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/hamradio/baycom_ser_fdx.c 2004-06-07 12:55:07.279799371 -0700 @@ -529,7 +529,6 @@ { struct baycom_state *bc; struct baycom_ioctl bi; - int cmd2; if (!dev || !dev->priv || ((struct baycom_state *)dev->priv)->hdrv.magic != HDLCDRV_MAGIC) { @@ -540,8 +539,6 @@ if (cmd != SIOCDEVPRIVATE) return -ENOIOCTLCMD; - if (get_user(cmd2, (int *)ifr->ifr_data)) - return -EFAULT; switch (hi->cmd) { default: break; diff -urN linux-2.6.7-rc2/drivers/net/hamradio/baycom_ser_hdx.c linux-2.6.7-rc3/drivers/net/hamradio/baycom_ser_hdx.c --- linux-2.6.7-rc2/drivers/net/hamradio/baycom_ser_hdx.c 2004-05-09 19:31:59.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/hamradio/baycom_ser_hdx.c 2004-06-07 12:55:07.280799412 -0700 @@ -569,7 +569,6 @@ { struct baycom_state *bc; struct baycom_ioctl bi; - int cmd2; if (!dev || !dev->priv || ((struct baycom_state *)dev->priv)->hdrv.magic != HDLCDRV_MAGIC) { @@ -580,8 +579,6 @@ if (cmd != SIOCDEVPRIVATE) return -ENOIOCTLCMD; - if (get_user(cmd2, (int *)ifr->ifr_data)) - return -EFAULT; switch (hi->cmd) { default: break; diff -urN linux-2.6.7-rc2/drivers/net/hamradio/bpqether.c linux-2.6.7-rc3/drivers/net/hamradio/bpqether.c --- linux-2.6.7-rc2/drivers/net/hamradio/bpqether.c 2004-05-09 19:32:29.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/hamradio/bpqether.c 2004-06-07 12:55:07.280799412 -0700 @@ -331,7 +331,7 @@ */ static int bpq_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) { - struct bpq_ethaddr *ethaddr = (struct bpq_ethaddr *)ifr->ifr_data; + struct bpq_ethaddr __user *ethaddr = ifr->ifr_data; struct bpqdev *bpq = dev->priv; struct bpq_req req; diff -urN linux-2.6.7-rc2/drivers/net/hamradio/scc.c linux-2.6.7-rc3/drivers/net/hamradio/scc.c --- linux-2.6.7-rc2/drivers/net/hamradio/scc.c 2004-05-09 19:33:13.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/hamradio/scc.c 2004-06-07 12:55:07.282799495 -0700 @@ -1714,13 +1714,11 @@ struct scc_mem_config memcfg; struct scc_hw_config hwcfg; struct scc_calibrate cal; - struct scc_channel *scc; + struct scc_channel *scc = (struct scc_channel *) dev->priv; int chan; unsigned char device_name[IFNAMSIZ]; - void *arg; + void __user *arg = ifr->ifr_data; - scc = (struct scc_channel *) dev->priv; - arg = (void *) ifr->ifr_data; if (!Driver_Initialized) { diff -urN linux-2.6.7-rc2/drivers/net/ibm_emac/ibm_emac_core.c linux-2.6.7-rc3/drivers/net/ibm_emac/ibm_emac_core.c --- linux-2.6.7-rc2/drivers/net/ibm_emac/ibm_emac_core.c 2004-06-07 12:54:49.120047251 -0700 +++ linux-2.6.7-rc3/drivers/net/ibm_emac/ibm_emac_core.c 2004-06-07 12:55:07.286799660 -0700 @@ -1556,7 +1556,7 @@ static int emac_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { struct ocp_enet_private *fep = dev->priv; - uint *data = (uint *) & rq->ifr_data; + uint *data = (uint *) & rq->ifr_ifru; switch (cmd) { case SIOCGMIIPHY: diff -urN linux-2.6.7-rc2/drivers/net/ioc3-eth.c linux-2.6.7-rc3/drivers/net/ioc3-eth.c --- linux-2.6.7-rc2/drivers/net/ioc3-eth.c 2004-05-09 19:31:59.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/ioc3-eth.c 2004-06-07 12:55:07.293799950 -0700 @@ -1529,12 +1529,11 @@ static int ioc3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { - struct mii_ioctl_data *data = (struct mii_ioctl_data *) & rq->ifr_data; struct ioc3_private *ip = netdev_priv(dev); int rc; spin_lock_irq(&ip->ioc3_lock); - rc = generic_mii_ioctl(&ip->mii, data, cmd, NULL); + rc = generic_mii_ioctl(&ip->mii, if_mii(rq), cmd, NULL); spin_unlock_irq(&ip->ioc3_lock); return rc; diff -urN linux-2.6.7-rc2/drivers/net/iseries_veth.c linux-2.6.7-rc3/drivers/net/iseries_veth.c --- linux-2.6.7-rc2/drivers/net/iseries_veth.c 2004-06-07 12:54:49.134047831 -0700 +++ linux-2.6.7-rc3/drivers/net/iseries_veth.c 2004-06-07 12:55:07.302800323 -0700 @@ -461,6 +461,11 @@ if (cnx->msgs) for (i = 0; i < VETH_NUMBUFFERS; ++i) veth_recycle_msg(cnx, cnx->msgs + i); + spin_unlock_irq(&cnx->lock); + veth_flush_pending(cnx); + spin_lock_irq(&cnx->lock); + if (cnx->state & VETH_STATE_RESET) + goto restart; } if (cnx->state & VETH_STATE_SHUTDOWN) @@ -796,6 +801,48 @@ return -EOPNOTSUPP; } +static void veth_tx_timeout(struct net_device *dev) +{ + struct veth_port *port = (struct veth_port *)dev->priv; + struct net_device_stats *stats = &port->stats; + unsigned long flags; + int i; + + stats->tx_errors++; + + spin_lock_irqsave(&port->pending_gate, flags); + + printk(KERN_WARNING "%s: Tx timeout! Resetting lp connections: %08x\n", + dev->name, port->pending_lpmask); + + /* If we've timed out the queue must be stopped, which should + * only ever happen when there is a pending packet. */ + WARN_ON(! port->pending_lpmask); + + for (i = 0; i < HVMAXARCHITECTEDLPS; i++) { + struct veth_lpar_connection *cnx = veth_cnx[i]; + + if (! (port->pending_lpmask & (1<lock); + cnx->state |= VETH_STATE_RESET; + veth_kick_statemachine(cnx); + spin_unlock(&cnx->lock); + } + + spin_unlock_irqrestore(&port->pending_gate, flags); +} + struct net_device * __init veth_probe_one(int vlan) { struct net_device *dev; @@ -843,6 +890,9 @@ dev->set_multicast_list = veth_set_multicast_list; dev->do_ioctl = veth_ioctl; + dev->watchdog_timeo = 2 * (VETH_ACKTIMEOUT * HZ / 1000000); + dev->tx_timeout = veth_tx_timeout; + rc = register_netdev(dev); if (rc != 0) { veth_printk(KERN_ERR, @@ -938,19 +988,10 @@ int rc; for (i = 0; i < HVMAXARCHITECTEDLPS; i++) { - struct sk_buff *clone; - if ((lpmask & (1 << i)) == 0) continue; - clone = skb_clone(skb, GFP_ATOMIC); - if (! clone) { - veth_error("%s: skb_clone failed %p\n", - dev->name, skb); - continue; - } - - rc = veth_transmit_to_one(clone, i, dev); + rc = veth_transmit_to_one(skb_get(skb), i, dev); if (! rc) lpmask &= ~(1<lpar_map; } + spin_lock_irqsave(&port->pending_gate, flags); + lpmask = veth_transmit_to_many(skb, lpmask, dev); if (! lpmask) { dev_kfree_skb(skb); } else { - spin_lock_irqsave(&port->pending_gate, flags); if (port->pending_skb) { veth_error("%s: Tx while skb was pending!\n", dev->name); dev_kfree_skb(skb); - spin_unlock_irqrestore(&port->pending_gate, flags); + spin_unlock_irqrestore(&port->pending_gate, flags); return 1; } port->pending_skb = skb; port->pending_lpmask = lpmask; netif_stop_queue(dev); - - spin_unlock_irqrestore(&port->pending_gate, flags); } + spin_unlock_irqrestore(&port->pending_gate, flags); + return 0; } @@ -1058,7 +1100,7 @@ if (! port->pending_lpmask) { dev_kfree_skb_any(port->pending_skb); port->pending_skb = NULL; - netif_start_queue(dev); + netif_wake_queue(dev); } } spin_unlock_irqrestore(&port->pending_gate, flags); diff -urN linux-2.6.7-rc2/drivers/net/ixgb/ixgb_ethtool.c linux-2.6.7-rc3/drivers/net/ixgb/ixgb_ethtool.c --- linux-2.6.7-rc2/drivers/net/ixgb/ixgb_ethtool.c 2004-06-07 12:54:49.139048038 -0700 +++ linux-2.6.7-rc3/drivers/net/ixgb/ixgb_ethtool.c 2004-06-07 12:55:07.306800489 -0700 @@ -362,7 +362,7 @@ static int ixgb_ethtool_seeprom(struct ixgb_adapter *adapter, - struct ethtool_eeprom *eeprom, void *user_data) + struct ethtool_eeprom *eeprom, void __user *user_data) { struct ixgb_hw *hw = &adapter->hw; uint16_t eeprom_buff[256]; @@ -457,10 +457,10 @@ int ixgb_ethtool_ioctl(struct net_device *netdev, struct ifreq *ifr) { struct ixgb_adapter *adapter = netdev->priv; - void *addr = ifr->ifr_data; + void __user *addr = ifr->ifr_data; uint32_t cmd; - if (get_user(cmd, (uint32_t *) addr)) + if (get_user(cmd, (uint32_t __user *) addr)) return -EFAULT; switch (cmd) { diff -urN linux-2.6.7-rc2/drivers/net/ixgb/ixgb_main.c linux-2.6.7-rc3/drivers/net/ixgb/ixgb_main.c --- linux-2.6.7-rc2/drivers/net/ixgb/ixgb_main.c 2004-06-07 12:54:49.149048453 -0700 +++ linux-2.6.7-rc3/drivers/net/ixgb/ixgb_main.c 2004-06-07 12:55:07.317800944 -0700 @@ -1610,7 +1610,7 @@ */ atomic_inc(&adapter->irq_sem); - IXGB_WRITE_REG(&adapter->hw, IMC, ~0); + IXGB_WRITE_REG(hw, IMC, ~0); __netif_rx_schedule(netdev); } #else diff -urN linux-2.6.7-rc2/drivers/net/natsemi.c linux-2.6.7-rc3/drivers/net/natsemi.c --- linux-2.6.7-rc2/drivers/net/natsemi.c 2004-05-09 19:31:59.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/natsemi.c 2004-06-07 12:55:07.328801400 -0700 @@ -1961,12 +1961,12 @@ spin_unlock_irq(&np->lock); } -static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr) +static int netdev_ethtool_ioctl(struct net_device *dev, void __user *useraddr) { struct netdev_private *np = dev->priv; u32 cmd; - if (get_user(cmd, (u32 *)useraddr)) + if (get_user(cmd, (u32 __user *)useraddr)) return -EFAULT; switch (cmd) { @@ -2417,11 +2417,11 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { - struct mii_ioctl_data *data = (struct mii_ioctl_data *)&rq->ifr_data; + struct mii_ioctl_data *data = if_mii(rq); switch(cmd) { case SIOCETHTOOL: - return netdev_ethtool_ioctl(dev, (void *) rq->ifr_data); + return netdev_ethtool_ioctl(dev, rq->ifr_data); case SIOCGMIIPHY: /* Get address of MII PHY in use. */ case SIOCDEVPRIVATE: /* for binary compat, remove in 2.5 */ data->phy_id = 1; diff -urN linux-2.6.7-rc2/drivers/net/ns83820.c linux-2.6.7-rc3/drivers/net/ns83820.c --- linux-2.6.7-rc2/drivers/net/ns83820.c 2004-05-09 19:33:20.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/ns83820.c 2004-06-07 12:55:07.331801524 -0700 @@ -1190,7 +1190,7 @@ return &dev->stats; } -static int ns83820_ethtool_ioctl (struct ns83820 *dev, void *useraddr) +static int ns83820_ethtool_ioctl (struct ns83820 *dev, void __user *useraddr) { u32 ethcmd; @@ -1236,7 +1236,7 @@ switch(cmd) { case SIOCETHTOOL: - return ns83820_ethtool_ioctl(dev, (void *) rq->ifr_data); + return ns83820_ethtool_ioctl(dev, rq->ifr_data); default: return -EOPNOTSUPP; diff -urN linux-2.6.7-rc2/drivers/net/pci-skeleton.c linux-2.6.7-rc3/drivers/net/pci-skeleton.c --- linux-2.6.7-rc2/drivers/net/pci-skeleton.c 2004-05-09 19:31:59.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/pci-skeleton.c 2004-06-07 12:55:07.332801566 -0700 @@ -1778,7 +1778,7 @@ static int netdrv_ioctl (struct net_device *dev, struct ifreq *rq, int cmd) { struct netdrv_private *tp = dev->priv; - struct mii_ioctl_data *data = (struct mii_ioctl_data *) & rq->ifr_data; + struct mii_ioctl_data *data = if_mii(rq); unsigned long flags; int rc = 0; diff -urN linux-2.6.7-rc2/drivers/net/pcmcia/3c574_cs.c linux-2.6.7-rc3/drivers/net/pcmcia/3c574_cs.c --- linux-2.6.7-rc2/drivers/net/pcmcia/3c574_cs.c 2004-05-09 19:32:26.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/pcmcia/3c574_cs.c 2004-06-07 12:55:07.333801607 -0700 @@ -1196,7 +1196,7 @@ { struct el3_private *lp = netdev_priv(dev); ioaddr_t ioaddr = dev->base_addr; - u16 *data = (u16 *)&rq->ifr_data; + u16 *data = (u16 *)&rq->ifr_ifru; int phy = lp->phys & 0x1f; DEBUG(2, "%s: In ioct(%-.6s, %#4.4x) %4.4x %4.4x %4.4x %4.4x.\n", diff -urN linux-2.6.7-rc2/drivers/net/pcmcia/axnet_cs.c linux-2.6.7-rc3/drivers/net/pcmcia/axnet_cs.c --- linux-2.6.7-rc2/drivers/net/pcmcia/axnet_cs.c 2004-06-07 12:54:49.154048660 -0700 +++ linux-2.6.7-rc3/drivers/net/pcmcia/axnet_cs.c 2004-06-07 12:55:07.334801649 -0700 @@ -778,7 +778,7 @@ static int axnet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { axnet_dev_t *info = PRIV(dev); - u16 *data = (u16 *)&rq->ifr_data; + u16 *data = (u16 *)&rq->ifr_ifru; ioaddr_t mii_addr = dev->base_addr + AXNET_MII_EEP; switch (cmd) { case SIOCGMIIPHY: diff -urN linux-2.6.7-rc2/drivers/net/pcmcia/pcnet_cs.c linux-2.6.7-rc3/drivers/net/pcmcia/pcnet_cs.c --- linux-2.6.7-rc2/drivers/net/pcmcia/pcnet_cs.c 2004-05-09 19:33:13.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/pcmcia/pcnet_cs.c 2004-06-07 12:55:07.335801690 -0700 @@ -1281,7 +1281,7 @@ static int ei_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { pcnet_dev_t *info = PRIV(dev); - u16 *data = (u16 *)&rq->ifr_data; + u16 *data = (u16 *)&rq->ifr_ifru; ioaddr_t mii_addr = dev->base_addr + DLINK_GPIO; switch (cmd) { case SIOCGMIIPHY: diff -urN linux-2.6.7-rc2/drivers/net/pcmcia/smc91c92_cs.c linux-2.6.7-rc3/drivers/net/pcmcia/smc91c92_cs.c --- linux-2.6.7-rc2/drivers/net/pcmcia/smc91c92_cs.c 2004-05-09 19:32:53.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/pcmcia/smc91c92_cs.c 2004-06-07 12:55:07.336801731 -0700 @@ -2119,12 +2119,12 @@ return 0; } -static int smc_ethtool_ioctl (struct net_device *dev, void *useraddr) +static int smc_ethtool_ioctl (struct net_device *dev, void __user *useraddr) { u32 ethcmd; struct smc_private *smc = netdev_priv(dev); - if (get_user(ethcmd, (u32 *)useraddr)) + if (get_user(ethcmd, (u32 __user *)useraddr)) return -EFAULT; switch (ethcmd) { @@ -2221,7 +2221,7 @@ u_short saved_bank; ioaddr_t ioaddr = dev->base_addr; - mii = (struct mii_ioctl_data *) &rq->ifr_data; + mii = if_mii(rq); if (!netif_running(dev)) return -EINVAL; @@ -2229,7 +2229,7 @@ case SIOCETHTOOL: saved_bank = inw(ioaddr + BANK_SELECT); SMC_SELECT_BANK(3); - rc = smc_ethtool_ioctl(dev, (void *) rq->ifr_data); + rc = smc_ethtool_ioctl(dev, rq->ifr_data); SMC_SELECT_BANK(saved_bank); break; diff -urN linux-2.6.7-rc2/drivers/net/pcmcia/xirc2ps_cs.c linux-2.6.7-rc3/drivers/net/pcmcia/xirc2ps_cs.c --- linux-2.6.7-rc2/drivers/net/pcmcia/xirc2ps_cs.c 2004-05-09 19:32:28.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/pcmcia/xirc2ps_cs.c 2004-06-07 12:55:07.337801773 -0700 @@ -1681,7 +1681,7 @@ { local_info_t *local = netdev_priv(dev); ioaddr_t ioaddr = dev->base_addr; - u16 *data = (u16 *)&rq->ifr_data; + u16 *data = (u16 *)&rq->ifr_ifru; DEBUG(1, "%s: ioctl(%-.6s, %#04x) %04x %04x %04x %04x\n", dev->name, rq->ifr_ifrn.ifrn_name, cmd, diff -urN linux-2.6.7-rc2/drivers/net/pcnet32.c linux-2.6.7-rc3/drivers/net/pcnet32.c --- linux-2.6.7-rc2/drivers/net/pcnet32.c 2004-06-07 12:54:49.157048784 -0700 +++ linux-2.6.7-rc3/drivers/net/pcnet32.c 2004-06-07 12:55:07.340801897 -0700 @@ -2170,14 +2170,13 @@ static int pcnet32_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { struct pcnet32_private *lp = dev->priv; - struct mii_ioctl_data *data = (struct mii_ioctl_data *)&rq->ifr_data; int rc; unsigned long flags; /* SIOC[GS]MIIxxx ioctls */ if (lp->mii) { spin_lock_irqsave(&lp->lock, flags); - rc = generic_mii_ioctl(&lp->mii_if, data, cmd, NULL); + rc = generic_mii_ioctl(&lp->mii_if, if_mii(rq), cmd, NULL); spin_unlock_irqrestore(&lp->lock, flags); } else { rc = -EOPNOTSUPP; diff -urN linux-2.6.7-rc2/drivers/net/plip.c linux-2.6.7-rc3/drivers/net/plip.c --- linux-2.6.7-rc2/drivers/net/plip.c 2004-05-09 19:33:21.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/plip.c 2004-06-07 12:55:07.341801939 -0700 @@ -1217,7 +1217,10 @@ plip_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { struct net_local *nl = netdev_priv(dev); - struct plipconf *pc = (struct plipconf *) &rq->ifr_data; + struct plipconf *pc = (struct plipconf *) &rq->ifr_ifru; + + if (cmd != SIOCDEVPLIP) + return -EOPNOTSUPP; switch(pc->pcmd) { case PLIP_GET_TIMEOUT: diff -urN linux-2.6.7-rc2/drivers/net/ppp_async.c linux-2.6.7-rc3/drivers/net/ppp_async.c --- linux-2.6.7-rc2/drivers/net/ppp_async.c 2004-05-09 19:32:54.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/ppp_async.c 2004-06-07 12:55:07.342801980 -0700 @@ -205,10 +205,10 @@ { struct asyncppp *ap; - write_lock(&disc_data_lock); + write_lock_irq(&disc_data_lock); ap = tty->disc_data; tty->disc_data = 0; - write_unlock(&disc_data_lock); + write_unlock_irq(&disc_data_lock); if (ap == 0) return; diff -urN linux-2.6.7-rc2/drivers/net/ppp_synctty.c linux-2.6.7-rc3/drivers/net/ppp_synctty.c --- linux-2.6.7-rc2/drivers/net/ppp_synctty.c 2004-05-09 19:32:29.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/ppp_synctty.c 2004-06-07 12:55:07.342801980 -0700 @@ -251,10 +251,10 @@ { struct syncppp *ap; - write_lock(&disc_data_lock); + write_lock_irq(&disc_data_lock); ap = tty->disc_data; tty->disc_data = 0; - write_unlock(&disc_data_lock); + write_unlock_irq(&disc_data_lock); if (ap == 0) return; diff -urN linux-2.6.7-rc2/drivers/net/rrunner.c linux-2.6.7-rc3/drivers/net/rrunner.c --- linux-2.6.7-rc2/drivers/net/rrunner.c 2004-05-09 19:32:26.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/rrunner.c 2004-06-07 12:55:07.358802643 -0700 @@ -1715,7 +1715,7 @@ return error; case SIOCRRID: - return put_user(0x52523032, (int *)(&rq->ifr_data[0])); + return put_user(0x52523032, (int __user *)rq->ifr_data); default: return error; } diff -urN linux-2.6.7-rc2/drivers/net/s2io.c linux-2.6.7-rc3/drivers/net/s2io.c --- linux-2.6.7-rc2/drivers/net/s2io.c 2004-06-07 12:54:49.173049447 -0700 +++ linux-2.6.7-rc3/drivers/net/s2io.c 2004-06-07 12:55:07.361802767 -0700 @@ -99,45 +99,45 @@ }; static char ethtool_stats_keys[][ETH_GSTRING_LEN] = { - {"tmac_frms"}, - {"tmac_data_octets"}, - {"tmac_drop_frms"}, - {"tmac_mcst_frms"}, - {"tmac_bcst_frms"}, - {"tmac_pause_ctrl_frms"}, - {"tmac_any_err_frms"}, - {"tmac_vld_ip_octets"}, - {"tmac_vld_ip"}, - {"tmac_drop_ip"}, - {"tmac_icmp"}, - {"tmac_rst_tcp"}, - {"tmac_tcp"}, - {"tmac_udp"}, - {"rmac_vld_frms"}, - {"rmac_data_octets"}, - {"rmac_fcs_err_frms"}, - {"rmac_drop_frms"}, - {"rmac_vld_mcst_frms"}, - {"rmac_vld_bcst_frms"}, - {"rmac_in_rng_len_err_frms"}, - {"rmac_long_frms"}, - {"rmac_pause_ctrl_frms"}, - {"rmac_discarded_frms"}, - {"rmac_usized_frms"}, - {"rmac_osized_frms"}, - {"rmac_frag_frms"}, - {"rmac_jabber_frms"}, - {"rmac_ip"}, - {"rmac_ip_octets"}, - {"rmac_hdr_err_ip"}, - {"rmac_drop_ip"}, - {"rmac_icmp"}, - {"rmac_tcp"}, - {"rmac_udp"}, - {"rmac_err_drp_udp"}, - {"rmac_pause_cnt"}, - {"rmac_accepted_ip"}, - {"rmac_err_tcp"}, + "tmac_frms", + "tmac_data_octets", + "tmac_drop_frms", + "tmac_mcst_frms", + "tmac_bcst_frms", + "tmac_pause_ctrl_frms", + "tmac_any_err_frms", + "tmac_vld_ip_octets", + "tmac_vld_ip", + "tmac_drop_ip", + "tmac_icmp", + "tmac_rst_tcp", + "tmac_tcp", + "tmac_udp", + "rmac_vld_frms", + "rmac_data_octets", + "rmac_fcs_err_frms", + "rmac_drop_frms", + "rmac_vld_mcst_frms", + "rmac_vld_bcst_frms", + "rmac_in_rng_len_err_frms", + "rmac_long_frms", + "rmac_pause_ctrl_frms", + "rmac_discarded_frms", + "rmac_usized_frms", + "rmac_osized_frms", + "rmac_frag_frms", + "rmac_jabber_frms", + "rmac_ip", + "rmac_ip_octets", + "rmac_hdr_err_ip", + "rmac_drop_ip", + "rmac_icmp", + "rmac_tcp", + "rmac_udp", + "rmac_err_drp_udp", + "rmac_pause_cnt", + "rmac_accepted_ip", + "rmac_err_tcp", }; #define S2IO_STAT_LEN sizeof(ethtool_stats_keys)/ ETH_GSTRING_LEN @@ -238,7 +238,7 @@ name:"S2IO", id_table:s2io_tbl, probe:s2io_init_nic, - remove:s2io_rem_nic, + remove:__devexit_p(s2io_rem_nic), }; /* @@ -4355,7 +4355,7 @@ * and free up all resource held up by the device. This could be in response * to a Hot plug event or when the driver is to be removed from memory. */ -static void __exit s2io_rem_nic(struct pci_dev *pdev) +static void __devexit s2io_rem_nic(struct pci_dev *pdev) { struct net_device *dev = (struct net_device *) pci_get_drvdata(pdev); diff -urN linux-2.6.7-rc2/drivers/net/s2io.h linux-2.6.7-rc3/drivers/net/s2io.h --- linux-2.6.7-rc2/drivers/net/s2io.h 2004-05-09 19:32:27.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/s2io.h 2004-06-07 12:55:07.361802767 -0700 @@ -825,7 +825,7 @@ */ static int __devinit s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre); -static void __exit s2io_rem_nic(struct pci_dev *pdev); +static void __devexit s2io_rem_nic(struct pci_dev *pdev); static int initSharedMem(struct s2io_nic *sp); static void freeSharedMem(struct s2io_nic *sp); static int initNic(struct s2io_nic *nic); diff -urN linux-2.6.7-rc2/drivers/net/sb1000.c linux-2.6.7-rc3/drivers/net/sb1000.c --- linux-2.6.7-rc2/drivers/net/sb1000.c 2004-06-07 12:54:49.174049488 -0700 +++ linux-2.6.7-rc3/drivers/net/sb1000.c 2004-06-07 12:55:07.362802808 -0700 @@ -1031,14 +1031,14 @@ case SIOCGCMFREQUENCY: /* get frequency */ if ((status = sb1000_get_frequency(ioaddr, name, &frequency))) return status; - if(put_user(frequency, (int*) ifr->ifr_data)) + if(put_user(frequency, (int __user *) ifr->ifr_data)) return -EFAULT; break; case SIOCSCMFREQUENCY: /* set frequency */ if (!capable(CAP_NET_ADMIN)) return -EPERM; - if(get_user(frequency, (int*) ifr->ifr_data)) + if(get_user(frequency, (int __user *) ifr->ifr_data)) return -EFAULT; if ((status = sb1000_set_frequency(ioaddr, name, frequency))) return status; diff -urN linux-2.6.7-rc2/drivers/net/sb1250-mac.c linux-2.6.7-rc3/drivers/net/sb1250-mac.c --- linux-2.6.7-rc2/drivers/net/sb1250-mac.c 2004-05-09 19:33:19.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/sb1250-mac.c 2004-06-07 12:55:07.364802891 -0700 @@ -2721,7 +2721,7 @@ static int sbmac_mii_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { struct sbmac_softc *sc = netdev_priv(dev); - u16 *data = (u16 *)&rq->ifr_data; + u16 *data = (u16 *)&rq->ifr_ifru; unsigned long flags; int retval; diff -urN linux-2.6.7-rc2/drivers/net/shaper.c linux-2.6.7-rc3/drivers/net/shaper.c --- linux-2.6.7-rc2/drivers/net/shaper.c 2004-05-09 19:32:54.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/shaper.c 2004-06-07 12:55:07.364802891 -0700 @@ -579,7 +579,7 @@ static int shaper_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) { - struct shaperconf *ss= (struct shaperconf *)&ifr->ifr_data; + struct shaperconf *ss= (struct shaperconf *)&ifr->ifr_ifru; struct shaper *sh=dev->priv; if(ss->ss_cmd == SHAPER_SET_DEV || ss->ss_cmd == SHAPER_SET_SPEED) diff -urN linux-2.6.7-rc2/drivers/net/sis900.c linux-2.6.7-rc3/drivers/net/sis900.c --- linux-2.6.7-rc2/drivers/net/sis900.c 2004-06-07 12:54:49.175049529 -0700 +++ linux-2.6.7-rc3/drivers/net/sis900.c 2004-06-07 12:55:07.366802974 -0700 @@ -1893,7 +1893,7 @@ static int mii_ioctl(struct net_device *net_dev, struct ifreq *rq, int cmd) { struct sis900_private *sis_priv = net_dev->priv; - struct mii_ioctl_data *data = (struct mii_ioctl_data *)&rq->ifr_data; + struct mii_ioctl_data *data = if_mii(rq); switch(cmd) { case SIOCGMIIPHY: /* Get address of MII PHY in use. */ diff -urN linux-2.6.7-rc2/drivers/net/slip.c linux-2.6.7-rc3/drivers/net/slip.c --- linux-2.6.7-rc2/drivers/net/slip.c 2004-05-09 19:33:21.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/slip.c 2004-06-07 12:55:07.369803098 -0700 @@ -1138,6 +1138,7 @@ { struct slip *sl = (struct slip *) tty->disc_data; unsigned int tmp; + int __user *p = (int __user *)arg; /* First make sure we're connected. */ if (!sl || sl->magic != SLIP_MAGIC) { @@ -1147,17 +1148,17 @@ switch(cmd) { case SIOCGIFNAME: tmp = strlen(sl->dev->name) + 1; - if (copy_to_user((void *)arg, sl->dev->name, tmp)) + if (copy_to_user((void __user *)arg, sl->dev->name, tmp)) return -EFAULT; return 0; case SIOCGIFENCAP: - if (put_user(sl->mode, (int *)arg)) + if (put_user(sl->mode, p)) return -EFAULT; return 0; case SIOCSIFENCAP: - if (get_user(tmp,(int *)arg)) + if (get_user(tmp, p)) return -EFAULT; #ifndef SL_INCLUDE_CSLIP if (tmp & (SL_MODE_CSLIP|SL_MODE_ADAPTIVE)) { @@ -1185,7 +1186,7 @@ #ifdef CONFIG_SLIP_SMART /* VSV changes start here */ case SIOCSKEEPALIVE: - if (get_user(tmp,(int *)arg)) + if (get_user(tmp, p)) return -EFAULT; if (tmp > 255) /* max for unchar */ return -EINVAL; @@ -1205,12 +1206,12 @@ return 0; case SIOCGKEEPALIVE: - if (put_user(sl->keepalive, (int *)arg)) + if (put_user(sl->keepalive, p)) return -EFAULT; return 0; case SIOCSOUTFILL: - if (get_user(tmp,(int *)arg)) + if (get_user(tmp, p)) return -EFAULT; if (tmp > 255) /* max for unchar */ return -EINVAL; @@ -1229,7 +1230,7 @@ return 0; case SIOCGOUTFILL: - if (put_user(sl->outfill, (int *)arg)) + if (put_user(sl->outfill, p)) return -EFAULT; return 0; /* VSV changes end */ @@ -1254,6 +1255,7 @@ static int sl_ioctl(struct net_device *dev,struct ifreq *rq,int cmd) { struct slip *sl = (struct slip*)(dev->priv); + unsigned long *p = (unsigned long *)&rq->ifr_ifru; if (sl == NULL) /* Allocation failed ?? */ return -ENODEV; @@ -1268,11 +1270,11 @@ switch(cmd){ case SIOCSKEEPALIVE: /* max for unchar */ - if (((unsigned int)((unsigned long)rq->ifr_data)) > 255) { + if ((unsigned)*p > 255) { spin_unlock_bh(&sl->lock); return -EINVAL; } - sl->keepalive = (unchar) ((unsigned long)rq->ifr_data); + sl->keepalive = (unchar) *p; if (sl->keepalive != 0) { sl->keepalive_timer.expires=jiffies+sl->keepalive*HZ; mod_timer(&sl->keepalive_timer, jiffies+sl->keepalive*HZ); @@ -1283,15 +1285,15 @@ break; case SIOCGKEEPALIVE: - rq->ifr_data=(caddr_t)((unsigned long)sl->keepalive); + *p = sl->keepalive; break; case SIOCSOUTFILL: - if (((unsigned)((unsigned long)rq->ifr_data)) > 255) { /* max for unchar */ + if ((unsigned)*p > 255) { /* max for unchar */ spin_unlock_bh(&sl->lock); return -EINVAL; } - if ((sl->outfill = (unchar)((unsigned long) rq->ifr_data)) != 0){ + if ((sl->outfill = (unchar)*p) != 0){ mod_timer(&sl->outfill_timer, jiffies+sl->outfill*HZ); set_bit(SLF_OUTWAIT, &sl->flags); } else { @@ -1300,7 +1302,7 @@ break; case SIOCGOUTFILL: - rq->ifr_data=(caddr_t)((unsigned long)sl->outfill); + *p = sl->outfill; break; case SIOCSLEASE: @@ -1312,12 +1314,12 @@ return -EPERM; } sl->leased = 0; - if ((unsigned long)rq->ifr_data) + if (*p) sl->leased = 1; break; case SIOCGLEASE: - rq->ifr_data=(caddr_t)((unsigned long)sl->leased); + *p = sl->leased; }; spin_unlock_bh(&sl->lock); return 0; diff -urN linux-2.6.7-rc2/drivers/net/starfire.c linux-2.6.7-rc3/drivers/net/starfire.c --- linux-2.6.7-rc2/drivers/net/starfire.c 2004-05-09 19:32:26.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/starfire.c 2004-06-07 12:55:07.370803140 -0700 @@ -1997,7 +1997,7 @@ } -static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr) +static int netdev_ethtool_ioctl(struct net_device *dev, void __user *useraddr) { struct ethtool_cmd ecmd; struct netdev_private *np = dev->priv; @@ -2079,16 +2079,16 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { struct netdev_private *np = dev->priv; - struct mii_ioctl_data *data = (struct mii_ioctl_data *) & rq->ifr_data; int rc; if (!netif_running(dev)) return -EINVAL; if (cmd == SIOCETHTOOL) - rc = netdev_ethtool_ioctl(dev, (void *) rq->ifr_data); + rc = netdev_ethtool_ioctl(dev, rq->ifr_data); else { + struct mii_ioctl_data *data = if_mii(rq); spin_lock_irq(&np->lock); rc = generic_mii_ioctl(&np->mii_if, data, cmd, NULL); spin_unlock_irq(&np->lock); diff -urN linux-2.6.7-rc2/drivers/net/sundance.c linux-2.6.7-rc3/drivers/net/sundance.c --- linux-2.6.7-rc2/drivers/net/sundance.c 2004-05-09 19:32:39.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/sundance.c 2004-06-07 12:55:07.372803223 -0700 @@ -1576,7 +1576,7 @@ } -static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr) +static int netdev_ethtool_ioctl(struct net_device *dev, void __user *useraddr) { struct netdev_private *np = dev->priv; u32 ethcmd; @@ -1659,7 +1659,6 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { struct netdev_private *np = dev->priv; - struct mii_ioctl_data *data = (struct mii_ioctl_data *) & rq->ifr_data; int rc; int i; long ioaddr = dev->base_addr; @@ -1668,11 +1667,11 @@ return -EINVAL; if (cmd == SIOCETHTOOL) - rc = netdev_ethtool_ioctl(dev, (void *) rq->ifr_data); + rc = netdev_ethtool_ioctl(dev, rq->ifr_data); else { spin_lock_irq(&np->lock); - rc = generic_mii_ioctl(&np->mii_if, data, cmd, NULL); + rc = generic_mii_ioctl(&np->mii_if, if_mii(rq), cmd, NULL); spin_unlock_irq(&np->lock); } switch (cmd) { diff -urN linux-2.6.7-rc2/drivers/net/sungem.c linux-2.6.7-rc3/drivers/net/sungem.c --- linux-2.6.7-rc2/drivers/net/sungem.c 2004-05-09 19:33:20.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/sungem.c 2004-06-07 12:55:07.373803264 -0700 @@ -2510,7 +2510,7 @@ static int gem_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) { struct gem *gp = dev->priv; - struct mii_ioctl_data *data = (struct mii_ioctl_data *)&ifr->ifr_data; + struct mii_ioctl_data *data = if_mii(ifr); int rc = -EOPNOTSUPP; /* Hold the PM semaphore while doing ioctl's or we may collide diff -urN linux-2.6.7-rc2/drivers/net/tg3.c linux-2.6.7-rc3/drivers/net/tg3.c --- linux-2.6.7-rc2/drivers/net/tg3.c 2004-06-07 12:54:49.189050109 -0700 +++ linux-2.6.7-rc3/drivers/net/tg3.c 2004-06-07 12:55:07.385803761 -0700 @@ -6678,7 +6678,7 @@ static int tg3_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) { - struct mii_ioctl_data *data = (struct mii_ioctl_data *)&ifr->ifr_data; + struct mii_ioctl_data *data = if_mii(ifr); struct tg3 *tp = netdev_priv(dev); int err; diff -urN linux-2.6.7-rc2/drivers/net/tlan.c linux-2.6.7-rc3/drivers/net/tlan.c --- linux-2.6.7-rc2/drivers/net/tlan.c 2004-06-07 12:54:49.194050316 -0700 +++ linux-2.6.7-rc3/drivers/net/tlan.c 2004-06-07 12:55:07.390803968 -0700 @@ -984,7 +984,7 @@ static int TLan_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { TLanPrivateInfo *priv = dev->priv; - struct mii_ioctl_data *data = (struct mii_ioctl_data *)&rq->ifr_data; + struct mii_ioctl_data *data = if_mii(rq); u32 phy = priv->phy[priv->phyNum]; if (!priv->phyOnline) diff -urN linux-2.6.7-rc2/drivers/net/tulip/de4x5.c linux-2.6.7-rc3/drivers/net/tulip/de4x5.c --- linux-2.6.7-rc2/drivers/net/tulip/de4x5.c 2004-05-09 19:31:59.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/tulip/de4x5.c 2004-06-07 12:55:07.396804217 -0700 @@ -5535,7 +5535,7 @@ de4x5_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { struct de4x5_private *lp = netdev_priv(dev); - struct de4x5_ioctl *ioc = (struct de4x5_ioctl *) &rq->ifr_data; + struct de4x5_ioctl *ioc = (struct de4x5_ioctl *) &rq->ifr_ifru; u_long iobase = dev->base_addr; int i, j, status = 0; s32 omr; diff -urN linux-2.6.7-rc2/drivers/net/tulip/de4x5.h linux-2.6.7-rc3/drivers/net/tulip/de4x5.h --- linux-2.6.7-rc2/drivers/net/tulip/de4x5.h 2004-05-09 19:32:53.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/tulip/de4x5.h 2004-06-07 12:55:07.397804258 -0700 @@ -1005,7 +1005,7 @@ struct de4x5_ioctl { unsigned short cmd; /* Command to run */ unsigned short len; /* Length of the data buffer */ - unsigned char *data; /* Pointer to the data buffer */ + unsigned char __user *data; /* Pointer to the data buffer */ }; /* diff -urN linux-2.6.7-rc2/drivers/net/tulip/eeprom.c linux-2.6.7-rc3/drivers/net/tulip/eeprom.c --- linux-2.6.7-rc2/drivers/net/tulip/eeprom.c 2004-05-09 19:33:20.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/tulip/eeprom.c 2004-06-07 12:55:07.399804341 -0700 @@ -90,12 +90,8 @@ */ static void __devinit tulip_build_fake_mediatable(struct tulip_private *tp) { -#ifdef __hppa__ - unsigned char *ee_data = tp->eeprom; - - if (ee_data[0] == 0x3c && ee_data[1] == 0x10 && - (ee_data[2] == 0x63 || ee_data[2] == 0x61) && ee_data[3] == 0x10) { - +#ifdef CONFIG_GSC + if (tp->flags & NEEDS_FAKE_MEDIA_TABLE) { static unsigned char leafdata[] = { 0x01, /* phy number */ 0x02, /* gpr setup sequence length */ @@ -306,12 +302,12 @@ /* EEPROM_Ctrl bits. */ #define EE_SHIFT_CLK 0x02 /* EEPROM shift clock. */ -#define EE_CS 0x01 /* EEPROM chip select. */ +#define EE_CS 0x01 /* EEPROM chip select. */ #define EE_DATA_WRITE 0x04 /* Data from the Tulip to EEPROM. */ -#define EE_WRITE_0 0x01 -#define EE_WRITE_1 0x05 +#define EE_WRITE_0 0x01 +#define EE_WRITE_1 0x05 #define EE_DATA_READ 0x08 /* Data from the EEPROM chip. */ -#define EE_ENB (0x4800 | EE_CS) +#define EE_ENB (0x4800 | EE_CS) /* Delay between EEPROM clock transitions. Even at 33Mhz current PCI implementations don't overrun the EEPROM clock. @@ -322,11 +318,12 @@ #define EE_READ_CMD (6) /* Note: this routine returns extra data bits for size detection. */ -int __devinit tulip_read_eeprom(long ioaddr, int location, int addr_len) +int __devinit tulip_read_eeprom(struct net_device *dev, int location, int addr_len) { int i; unsigned retval = 0; - long ee_addr = ioaddr + CSR9; + struct tulip_private *tp = dev->priv; + long ee_addr = tp->base_addr + CSR9; int read_cmd = location | (EE_READ_CMD << addr_len); outl(EE_ENB & ~EE_CS, ee_addr); @@ -354,6 +351,6 @@ /* Terminate the EEPROM access. */ outl(EE_ENB & ~EE_CS, ee_addr); - return retval; + return (tp->flags & HAS_SWAPPED_SEEPROM) ? swab16(retval) : retval; } diff -urN linux-2.6.7-rc2/drivers/net/tulip/tulip.h linux-2.6.7-rc3/drivers/net/tulip/tulip.h --- linux-2.6.7-rc2/drivers/net/tulip/tulip.h 2004-05-09 19:33:20.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/tulip/tulip.h 2004-06-07 12:55:07.399804341 -0700 @@ -64,6 +64,8 @@ COMET_MAC_ADDR = 0x0800, HAS_PCI_MWI = 0x1000, HAS_PHY_IRQ = 0x2000, + HAS_SWAPPED_SEEPROM = 0x4000, + NEEDS_FAKE_MEDIA_TABLE = 0x8000, }; @@ -407,7 +409,7 @@ /* eeprom.c */ void tulip_parse_eeprom(struct net_device *dev); -int tulip_read_eeprom(long ioaddr, int location, int addr_len); +int tulip_read_eeprom(struct net_device *dev, int location, int addr_len); /* interrupt.c */ extern unsigned int tulip_max_interrupt_work; diff -urN linux-2.6.7-rc2/drivers/net/tulip/tulip_core.c linux-2.6.7-rc3/drivers/net/tulip/tulip_core.c --- linux-2.6.7-rc2/drivers/net/tulip/tulip_core.c 2004-06-07 12:54:49.199050523 -0700 +++ linux-2.6.7-rc3/drivers/net/tulip/tulip_core.c 2004-06-07 12:55:07.401804424 -0700 @@ -830,7 +830,7 @@ } -static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr) +static int netdev_ethtool_ioctl(struct net_device *dev, void __user *useraddr) { struct tulip_private *np = netdev_priv(dev); u32 ethcmd; @@ -859,14 +859,14 @@ { struct tulip_private *tp = netdev_priv(dev); long ioaddr = dev->base_addr; - struct mii_ioctl_data *data = (struct mii_ioctl_data *) & rq->ifr_data; + struct mii_ioctl_data *data = if_mii(rq); const unsigned int phy_idx = 0; int phy = tp->phys[phy_idx] & 0x1f; unsigned int regnum = data->reg_num; switch (cmd) { case SIOCETHTOOL: - return netdev_ethtool_ioctl(dev, (void *) rq->ifr_data); + return netdev_ethtool_ioctl(dev, rq->ifr_data); case SIOCGMIIPHY: /* Get address of MII PHY in use. */ if (tp->mii_cnt) @@ -1246,6 +1246,7 @@ long ioaddr; static int board_idx = -1; int chip_idx = ent->driver_data; + const char *chip_name = tulip_tbl[chip_idx].chip_name; unsigned int eeprom_missing = 0; unsigned int force_csr0 = 0; @@ -1414,6 +1415,23 @@ pci_set_master(pdev); +#ifdef CONFIG_GSC + if (pdev->subsystem_vendor == PCI_VENDOR_ID_HP) { + switch (pdev->subsystem_device) { + default: + break; + case 0x1061: + case 0x1062: + case 0x1063: + case 0x1098: + case 0x1099: + case 0x10EE: + tp->flags |= HAS_SWAPPED_SEEPROM | NEEDS_FAKE_MEDIA_TABLE; + chip_name = "GSC DS21140 Tulip"; + } + } +#endif + /* Clear the missed-packet counter. */ inl(ioaddr + CSR8); @@ -1442,11 +1460,13 @@ } else { /* A serial EEPROM interface, we read now and sort it out later. */ int sa_offset = 0; - int ee_addr_size = tulip_read_eeprom(ioaddr, 0xff, 8) & 0x40000 ? 8 : 6; + int ee_addr_size = tulip_read_eeprom(dev, 0xff, 8) & 0x40000 ? 8 : 6; - for (i = 0; i < sizeof(tp->eeprom)/2; i++) - ((u16 *)ee_data)[i] = - le16_to_cpu(tulip_read_eeprom(ioaddr, i, ee_addr_size)); + for (i = 0; i < sizeof(tp->eeprom); i+=2) { + u16 data = tulip_read_eeprom(dev, i/2, ee_addr_size); + ee_data[i] = data & 0xff; + ee_data[i + 1] = data >> 8; + } /* DEC now has a specification (see Notes) but early board makers just put the address in the first EEPROM locations. */ @@ -1489,25 +1509,26 @@ tp->flags &= ~HAS_MEDIA_TABLE; } #endif -#ifdef __hppa__ - /* 3x5 HSC (J3514A) has a broken srom */ - if(ee_data[0] == 0x61 && ee_data[1] == 0x10) { +#ifdef CONFIG_GSC + /* Check to see if we have a broken srom */ + if (ee_data[0] == 0x61 && ee_data[1] == 0x10) { /* pci_vendor_id and subsystem_id are swapped */ ee_data[0] = ee_data[2]; ee_data[1] = ee_data[3]; ee_data[2] = 0x61; ee_data[3] = 0x10; - /* srom need to be byte-swaped and shifted up 1 word. - * This shift needs to happen at the end of the MAC - * first because of the 2 byte overlap. + /* HSC-PCI boards need to be byte-swaped and shifted + * up 1 word. This shift needs to happen at the end + * of the MAC first because of the 2 byte overlap. */ - for(i = 4; i >= 0; i -= 2) { + for (i = 4; i >= 0; i -= 2) { ee_data[17 + i + 3] = ee_data[17 + i]; ee_data[16 + i + 5] = ee_data[16 + i]; } } #endif + for (i = 0; i < 6; i ++) { dev->dev_addr[i] = ee_data[i + sa_offset]; sum += ee_data[i + sa_offset]; @@ -1628,7 +1649,7 @@ goto err_out_free_ring; printk(KERN_INFO "%s: %s rev %d at %#3lx,", - dev->name, tulip_tbl[chip_idx].chip_name, chip_rev, ioaddr); + dev->name, chip_name, chip_rev, ioaddr); pci_set_drvdata(pdev, dev); if (eeprom_missing) diff -urN linux-2.6.7-rc2/drivers/net/tulip/winbond-840.c linux-2.6.7-rc3/drivers/net/tulip/winbond-840.c --- linux-2.6.7-rc2/drivers/net/tulip/winbond-840.c 2004-06-07 12:54:49.200050565 -0700 +++ linux-2.6.7-rc3/drivers/net/tulip/winbond-840.c 2004-06-07 12:55:07.402804465 -0700 @@ -1526,8 +1526,8 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { - struct mii_ioctl_data *data = (struct mii_ioctl_data *)&rq->ifr_data; - struct netdev_private *np = dev->priv; + struct mii_ioctl_data *data = if_mii(rq); + struct netdev_private *np = netdev_priv(dev); switch(cmd) { case SIOCGMIIPHY: /* Get address of MII PHY in use. */ diff -urN linux-2.6.7-rc2/drivers/net/tulip/xircom_tulip_cb.c linux-2.6.7-rc3/drivers/net/tulip/xircom_tulip_cb.c --- linux-2.6.7-rc2/drivers/net/tulip/xircom_tulip_cb.c 2004-05-09 19:32:01.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/tulip/xircom_tulip_cb.c 2004-06-07 12:55:07.403804507 -0700 @@ -1369,7 +1369,7 @@ } -static int xircom_ethtool_ioctl(struct net_device *dev, void *useraddr) +static int xircom_ethtool_ioctl(struct net_device *dev, void __user *useraddr) { struct ethtool_cmd ecmd; struct xircom_private *tp = dev->priv; @@ -1471,13 +1471,13 @@ static int xircom_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { struct xircom_private *tp = dev->priv; - u16 *data = (u16 *)&rq->ifr_data; + u16 *data = (u16 *)&rq->ifr_ifru; int phy = tp->phys[0] & 0x1f; unsigned long flags; switch(cmd) { case SIOCETHTOOL: - return xircom_ethtool_ioctl(dev, (void *) rq->ifr_data); + return xircom_ethtool_ioctl(dev, rq->ifr_data); /* Legacy mii-diag interface */ case SIOCGMIIPHY: /* Get address of MII PHY in use. */ diff -urN linux-2.6.7-rc2/drivers/net/tun.c linux-2.6.7-rc3/drivers/net/tun.c --- linux-2.6.7-rc2/drivers/net/tun.c 2004-05-09 19:32:29.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/tun.c 2004-06-07 12:55:07.403804507 -0700 @@ -129,8 +129,8 @@ dev->addr_len = 0; dev->mtu = 1500; - /* Type PPP seems most suitable */ - dev->type = ARPHRD_PPP; + /* Zero header length */ + dev->type = ARPHRD_NONE; dev->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST; dev->tx_queue_len = 10; break; @@ -241,10 +241,10 @@ } /* Write */ -static ssize_t tun_chr_write(struct file * file, const char * buf, +static ssize_t tun_chr_write(struct file * file, const char __user * buf, size_t count, loff_t *pos) { - struct iovec iv = { (void *) buf, count }; + struct iovec iv = { (void __user *) buf, count }; return tun_chr_writev(file, &iv, 1, pos); } @@ -333,7 +333,7 @@ } /* Read */ -static ssize_t tun_chr_read(struct file * file, char * buf, +static ssize_t tun_chr_read(struct file * file, char __user * buf, size_t count, loff_t *pos) { struct iovec iv = { buf, count }; @@ -462,7 +462,7 @@ struct ifreq ifr; int err; - if (copy_from_user(&ifr, (void *)arg, sizeof(ifr))) + if (copy_from_user(&ifr, (void __user *)arg, sizeof(ifr))) return -EFAULT; ifr.ifr_name[IFNAMSIZ-1] = '\0'; @@ -473,7 +473,7 @@ if (err) return err; - if (copy_to_user((void *)arg, &ifr, sizeof(ifr))) + if (copy_to_user((void __user *)arg, &ifr, sizeof(ifr))) return -EFAULT; return 0; } diff -urN linux-2.6.7-rc2/drivers/net/typhoon.c linux-2.6.7-rc3/drivers/net/typhoon.c --- linux-2.6.7-rc2/drivers/net/typhoon.c 2004-05-09 19:32:52.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/typhoon.c 2004-06-07 12:55:07.440806039 -0700 @@ -1162,7 +1162,7 @@ } static inline int -typhoon_ethtool_ioctl(struct net_device *dev, void *useraddr) +typhoon_ethtool_ioctl(struct net_device *dev, void __user *useraddr) { struct typhoon *tp = (struct typhoon *) dev->priv; u32 ethcmd; @@ -1237,7 +1237,7 @@ { switch (cmd) { case SIOCETHTOOL: - return typhoon_ethtool_ioctl(dev, (void *) ifr->ifr_data); + return typhoon_ethtool_ioctl(dev, ifr->ifr_data); default: break; } diff -urN linux-2.6.7-rc2/drivers/net/via-rhine.c linux-2.6.7-rc3/drivers/net/via-rhine.c --- linux-2.6.7-rc2/drivers/net/via-rhine.c 2004-06-07 12:54:49.205050772 -0700 +++ linux-2.6.7-rc3/drivers/net/via-rhine.c 2004-06-07 12:55:07.446806288 -0700 @@ -1875,14 +1875,13 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { struct rhine_private *rp = netdev_priv(dev); - struct mii_ioctl_data *data = (struct mii_ioctl_data *) & rq->ifr_data; int rc; if (!netif_running(dev)) return -EINVAL; spin_lock_irq(&rp->lock); - rc = generic_mii_ioctl(&rp->mii_if, data, cmd, NULL); + rc = generic_mii_ioctl(&rp->mii_if, if_mii(rq), cmd, NULL); spin_unlock_irq(&rp->lock); return rc; diff -urN linux-2.6.7-rc2/drivers/net/wan/Makefile linux-2.6.7-rc3/drivers/net/wan/Makefile --- linux-2.6.7-rc2/drivers/net/wan/Makefile 2004-06-07 12:54:49.206050813 -0700 +++ linux-2.6.7-rc3/drivers/net/wan/Makefile 2004-06-07 12:55:07.447806329 -0700 @@ -61,6 +61,9 @@ obj-$(CONFIG_WANXL) += wanxl.o obj-$(CONFIG_PCI200SYN) += pci200syn.o +clean-files := wanxlfw.inc +$(obj)/wanxl.o: $(obj)/wanxlfw.inc + ifeq ($(CONFIG_WANXL_BUILD_FIRMWARE),y) ifeq ($(ARCH),m68k) AS68K = $(AS) @@ -72,12 +75,12 @@ quiet_cmd_build_wanxlfw = BLD FW $@ cmd_build_wanxlfw = \ - $(CPP) -Wp,-MD,$(depfile) -Iinclude $(obj)/wanxlfw.S | $(AS68K) -m68360 -o $(obj)/wanxlfw.o; \ + $(CPP) -Wp,-MD,$(depfile) -I$(srctree)/include $< | $(AS68K) -m68360 -o $(obj)/wanxlfw.o; \ $(LD68K) --oformat binary -Ttext 0x1000 $(obj)/wanxlfw.o -o $(obj)/wanxlfw.bin; \ hexdump -ve '"\n" 16/1 "0x%02X,"' $(obj)/wanxlfw.bin | sed 's/0x ,//g;1s/^/static u8 firmware[]={/;$$s/,$$/\n};\n/' >$(obj)/wanxlfw.inc; \ rm -f $(obj)/wanxlfw.bin $(obj)/wanxlfw.o -$(obj)/wanxlfw.inc: $(obj)/wanxlfw.S +$(obj)/wanxlfw.inc: $(src)/wanxlfw.S $(call if_changed_dep,build_wanxlfw) targets += wanxlfw.inc endif diff -urN linux-2.6.7-rc2/drivers/net/wan/c101.c linux-2.6.7-rc3/drivers/net/wan/c101.c --- linux-2.6.7-rc2/drivers/net/wan/c101.c 2004-05-09 19:33:05.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/wan/c101.c 2004-06-07 12:55:07.447806329 -0700 @@ -379,8 +379,6 @@ return result; } - /* XXX: are we OK with having that done when card is already up? */ - sca_init_sync_port(card); /* Set up C101 memory */ hdlc_set_carrier(!(sca_in(MSCI1_OFFSET + ST3, card) & ST3_DCD), dev); diff -urN linux-2.6.7-rc2/drivers/net/wan/dlci.c linux-2.6.7-rc3/drivers/net/wan/dlci.c --- linux-2.6.7-rc2/drivers/net/wan/dlci.c 2004-05-09 19:32:37.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/wan/dlci.c 2004-06-07 12:55:07.478807613 -0700 @@ -229,7 +229,7 @@ return(ret); } -static int dlci_config(struct net_device *dev, struct dlci_conf *conf, int get) +static int dlci_config(struct net_device *dev, struct dlci_conf __user *conf, int get) { struct dlci_conf config; struct dlci_local *dlp; @@ -286,7 +286,7 @@ if (!*(short *)(dev->dev_addr)) return(-EINVAL); - return(dlci_config(dev, (struct dlci_conf *) ifr->ifr_data, cmd == DLCI_GET_CONF)); + return(dlci_config(dev, ifr->ifr_data, cmd == DLCI_GET_CONF)); break; default: @@ -454,7 +454,7 @@ return(err); } -static int dlci_ioctl(unsigned int cmd, void *arg) +static int dlci_ioctl(unsigned int cmd, void __user *arg) { struct dlci_add add; int err; diff -urN linux-2.6.7-rc2/drivers/net/wan/farsync.c linux-2.6.7-rc3/drivers/net/wan/farsync.c --- linux-2.6.7-rc2/drivers/net/wan/farsync.c 2004-06-07 12:54:49.245052429 -0700 +++ linux-2.6.7-rc3/drivers/net/wan/farsync.c 2004-06-07 12:55:07.487807986 -0700 @@ -21,9 +21,10 @@ #include #include #include -#include #include #include +#include +#include #include "farsync.h" diff -urN linux-2.6.7-rc2/drivers/net/wan/hd6457x.c linux-2.6.7-rc3/drivers/net/wan/hd6457x.c --- linux-2.6.7-rc2/drivers/net/wan/hd6457x.c 2004-05-09 19:32:02.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/wan/hd6457x.c 2004-06-07 12:55:07.489808069 -0700 @@ -610,7 +610,6 @@ card_t* card = port_to_card(port); /* reset channel */ - netif_stop_queue(dev); sca_out(CMD_RESET, get_msci(port) + CMD, port_to_card(port)); #ifdef __HD64570_H /* disable MSCI interrupts */ @@ -624,6 +623,7 @@ sca_outl(sca_inl(IER0, card) & (phy_node(port) ? 0x00FF00FF : 0xFF00FF00), IER0, card); #endif + netif_stop_queue(dev); } diff -urN linux-2.6.7-rc2/drivers/net/wan/hdlc_cisco.c linux-2.6.7-rc3/drivers/net/wan/hdlc_cisco.c --- linux-2.6.7-rc2/drivers/net/wan/hdlc_cisco.c 2004-05-09 19:32:27.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/wan/hdlc_cisco.c 2004-06-07 12:55:07.489808069 -0700 @@ -180,7 +180,8 @@ case CISCO_KEEPALIVE_REQ: hdlc->state.cisco.rxseq = ntohl(cisco_data->par1); - if (ntohl(cisco_data->par2)==hdlc->state.cisco.txseq) { + if (hdlc->state.cisco.request_sent && + ntohl(cisco_data->par2)==hdlc->state.cisco.txseq) { hdlc->state.cisco.last_poll = jiffies; if (!hdlc->state.cisco.up) { u32 sec, min, hrs, days; @@ -192,8 +193,9 @@ "uptime %ud%uh%um%us)\n", dev->name, days, hrs, min, sec); + netif_carrier_on(dev); + hdlc->state.cisco.up = 1; } - hdlc->state.cisco.up = 1; } dev_kfree_skb_any(skb); @@ -219,17 +221,18 @@ struct net_device *dev = (struct net_device *)arg; hdlc_device *hdlc = dev_to_hdlc(dev); - if (hdlc->state.cisco.up && jiffies - hdlc->state.cisco.last_poll >= - hdlc->state.cisco.settings.timeout * HZ) { + if (hdlc->state.cisco.up && + time_after(jiffies, hdlc->state.cisco.last_poll + + hdlc->state.cisco.settings.timeout * HZ)) { hdlc->state.cisco.up = 0; printk(KERN_INFO "%s: Link down\n", dev->name); - if (netif_carrier_ok(dev)) - netif_carrier_off(dev); + netif_carrier_off(dev); } cisco_keepalive_send(dev, CISCO_KEEPALIVE_REQ, ++hdlc->state.cisco.txseq, hdlc->state.cisco.rxseq); + hdlc->state.cisco.request_sent = 1; hdlc->state.cisco.timer.expires = jiffies + hdlc->state.cisco.settings.interval * HZ; hdlc->state.cisco.timer.function = cisco_timer; @@ -242,8 +245,8 @@ static void cisco_start(struct net_device *dev) { hdlc_device *hdlc = dev_to_hdlc(dev); - hdlc->state.cisco.last_poll = 0; hdlc->state.cisco.up = 0; + hdlc->state.cisco.request_sent = 0; hdlc->state.cisco.txseq = hdlc->state.cisco.rxseq = 0; init_timer(&hdlc->state.cisco.timer); @@ -257,9 +260,12 @@ static void cisco_stop(struct net_device *dev) { - del_timer_sync(&dev_to_hdlc(dev)->state.cisco.timer); + hdlc_device *hdlc = dev_to_hdlc(dev); + del_timer_sync(&hdlc->state.cisco.timer); if (netif_carrier_ok(dev)) netif_carrier_off(dev); + hdlc->state.cisco.up = 0; + hdlc->state.cisco.request_sent = 0; } diff -urN linux-2.6.7-rc2/drivers/net/wan/hdlc_fr.c linux-2.6.7-rc3/drivers/net/wan/hdlc_fr.c --- linux-2.6.7-rc2/drivers/net/wan/hdlc_fr.c 2004-05-09 19:33:13.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/wan/hdlc_fr.c 2004-06-07 12:55:07.490808110 -0700 @@ -584,8 +584,9 @@ u32 list; if (hdlc->state.fr.settings.dce) - reliable = (jiffies - hdlc->state.fr.last_poll < - hdlc->state.fr.settings.t392 * HZ); + reliable = hdlc->state.fr.request && + time_before(jiffies, hdlc->state.fr.last_poll + + hdlc->state.fr.settings.t392 * HZ); else { hdlc->state.fr.last_errors <<= 1; /* Shift the list */ if (hdlc->state.fr.request) { @@ -617,6 +618,7 @@ fr_lmi_send(dev, hdlc->state.fr.n391cnt == 0); + hdlc->state.fr.last_poll = jiffies; hdlc->state.fr.request = 1; hdlc->state.fr.timer.expires = jiffies + hdlc->state.fr.settings.t391 * HZ; @@ -689,6 +691,7 @@ dev->name, reptype); return 1; } + hdlc->state.fr.last_poll = jiffies; } error = 0; @@ -728,7 +731,12 @@ /* DTE */ - if (reptype != LMI_FULLREP || error) + hdlc->state.fr.request = 0; /* got response, no request pending */ + + if (error) + return 0; + + if (reptype != LMI_FULLREP) return 0; stat_len = 3; @@ -829,9 +837,6 @@ if (fr_lmi_recv(ndev, skb)) goto rx_error; else { - /* No request pending */ - hdlc->state.fr.request = 0; - hdlc->state.fr.last_poll = jiffies; dev_kfree_skb_any(skb); return NET_RX_SUCCESS; } @@ -946,9 +951,6 @@ printk(KERN_DEBUG "fr_start\n"); #endif if (hdlc->state.fr.settings.lmi != LMI_NONE) { - if (netif_carrier_ok(dev)) - netif_carrier_off(dev); - hdlc->state.fr.last_poll = 0; hdlc->state.fr.reliable = 0; hdlc->state.fr.dce_changed = 1; hdlc->state.fr.request = 0; diff -urN linux-2.6.7-rc2/drivers/net/wan/hdlc_generic.c linux-2.6.7-rc3/drivers/net/wan/hdlc_generic.c --- linux-2.6.7-rc2/drivers/net/wan/hdlc_generic.c 2004-05-09 19:32:00.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/wan/hdlc_generic.c 2004-06-07 12:55:07.491808152 -0700 @@ -15,6 +15,11 @@ * * X.25 * * Use sethdlc utility to set line parameters, protocol and PVCs + * + * How does it work: + * - proto.open(), close(), start(), stop() calls are serialized. + * The order is: open, [ start, stop ... ] close ... + * - proto.start() and stop() are called with spin_lock_irq held. */ #include @@ -33,7 +38,7 @@ #include -static const char* version = "HDLC support module revision 1.16"; +static const char* version = "HDLC support module revision 1.17"; #undef DEBUG_LINK @@ -69,51 +74,75 @@ +static void __hdlc_set_carrier_on(struct net_device *dev) +{ + hdlc_device *hdlc = dev_to_hdlc(dev); + if (hdlc->proto.start) + return hdlc->proto.start(dev); +#ifdef DEBUG_LINK + if (netif_carrier_ok(dev)) + printk(KERN_ERR "hdlc_set_carrier_on(): already on\n"); +#endif + netif_carrier_on(dev); +} + + + +static void __hdlc_set_carrier_off(struct net_device *dev) +{ + hdlc_device *hdlc = dev_to_hdlc(dev); + if (hdlc->proto.stop) + return hdlc->proto.stop(dev); + +#ifdef DEBUG_LINK + if (!netif_carrier_ok(dev)) + printk(KERN_ERR "hdlc_set_carrier_off(): already off\n"); +#endif + netif_carrier_off(dev); +} + + + void hdlc_set_carrier(int on, struct net_device *dev) { hdlc_device *hdlc = dev_to_hdlc(dev); + unsigned long flags; on = on ? 1 : 0; #ifdef DEBUG_LINK printk(KERN_DEBUG "hdlc_set_carrier %i\n", on); #endif - spin_lock_irq(&hdlc->state_lock); + spin_lock_irqsave(&hdlc->state_lock, flags); if (hdlc->carrier == on) goto carrier_exit; /* no change in DCD line level */ - printk(KERN_INFO "%s: carrier %s\n", dev->name, - on ? "ON" : "off"); +#ifdef DEBUG_LINK + printk(KERN_INFO "%s: carrier %s\n", dev->name, on ? "ON" : "off"); +#endif hdlc->carrier = on; if (!hdlc->open) goto carrier_exit; - if (hdlc->carrier) { - if (hdlc->proto.start) - hdlc->proto.start(dev); - else if (!netif_carrier_ok(dev)) - netif_carrier_on(dev); - - } else { /* no carrier */ - if (hdlc->proto.stop) - hdlc->proto.stop(dev); - else if (netif_carrier_ok(dev)) - netif_carrier_off(dev); - } + if (hdlc->carrier) + __hdlc_set_carrier_on(dev); + else + __hdlc_set_carrier_off(dev); - carrier_exit: - spin_unlock_irq(&hdlc->state_lock); +carrier_exit: + spin_unlock_irqrestore(&hdlc->state_lock, flags); } + /* Must be called by hardware driver when HDLC device is being opened */ int hdlc_open(struct net_device *dev) { hdlc_device *hdlc = dev_to_hdlc(dev); #ifdef DEBUG_LINK - printk(KERN_DEBUG "hdlc_open carrier %i open %i\n", + printk(KERN_DEBUG "hdlc_open() carrier %i open %i\n", hdlc->carrier, hdlc->open); #endif @@ -128,14 +157,8 @@ spin_lock_irq(&hdlc->state_lock); - if (hdlc->carrier) { - if (hdlc->proto.start) - hdlc->proto.start(dev); - else if (!netif_carrier_ok(dev)) - netif_carrier_on(dev); - - } else if (netif_carrier_ok(dev)) - netif_carrier_off(dev); + if (hdlc->carrier) + __hdlc_set_carrier_on(dev); hdlc->open = 1; @@ -150,15 +173,15 @@ { hdlc_device *hdlc = dev_to_hdlc(dev); #ifdef DEBUG_LINK - printk(KERN_DEBUG "hdlc_close carrier %i open %i\n", + printk(KERN_DEBUG "hdlc_close() carrier %i open %i\n", hdlc->carrier, hdlc->open); #endif spin_lock_irq(&hdlc->state_lock); hdlc->open = 0; - if (hdlc->carrier && hdlc->proto.stop) - hdlc->proto.stop(dev); + if (hdlc->carrier) + __hdlc_set_carrier_off(dev); spin_unlock_irq(&hdlc->state_lock); @@ -185,7 +208,7 @@ #endif #ifndef CONFIG_HDLC_FR -#define hdlc_fr_ioctl(dev, ifr) -ENOSYS +#define hdlc_fr_ioctl(dev, ifr) -ENOSYS #endif #ifndef CONFIG_HDLC_X25 @@ -257,25 +280,7 @@ int register_hdlc_device(struct net_device *dev) { - int result; - hdlc_device *hdlc = dev_to_hdlc(dev); - - dev->get_stats = hdlc_get_stats; - dev->change_mtu = hdlc_change_mtu; - dev->mtu = HDLC_MAX_MTU; - - dev->type = ARPHRD_RAWHDLC; - dev->hard_header_len = 16; - - dev->flags = IFF_POINTOPOINT | IFF_NOARP; - - hdlc->proto.id = -1; - hdlc->proto.detach = NULL; - hdlc->carrier = 1; - hdlc->open = 0; - spin_lock_init(&hdlc->state_lock); - - result = dev_alloc_name(dev, "hdlc%d"); + int result = dev_alloc_name(dev, "hdlc%d"); if (result < 0) return result; @@ -283,6 +288,9 @@ if (result != 0) return -EIO; + if (netif_carrier_ok(dev)) + netif_carrier_off(dev); /* no carrier until DCD goes up */ + return 0; } diff -urN linux-2.6.7-rc2/drivers/net/wan/pc300_drv.c linux-2.6.7-rc3/drivers/net/wan/pc300_drv.c --- linux-2.6.7-rc2/drivers/net/wan/pc300_drv.c 2004-05-09 19:33:20.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/wan/pc300_drv.c 2004-06-07 12:55:07.497808400 -0700 @@ -2542,7 +2542,7 @@ pc300conf_t conf_aux; pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; int ch = chan->channel; - void *arg = (void *) ifr->ifr_data; + void __user *arg = ifr->ifr_data; struct if_settings *settings = &ifr->ifr_settings; uclong scabase = card->hw.scabase; diff -urN linux-2.6.7-rc2/drivers/net/wan/sbni.c linux-2.6.7-rc3/drivers/net/wan/sbni.c --- linux-2.6.7-rc2/drivers/net/wan/sbni.c 2004-05-09 19:32:27.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/wan/sbni.c 2004-06-07 12:55:07.498808441 -0700 @@ -1342,7 +1342,7 @@ return -EPERM; spin_lock( &nl->lock ); - flags = *(struct sbni_flags*) &ifr->ifr_data; + flags = *(struct sbni_flags*) &ifr->ifr_ifru; if( flags.fixed_rxl ) nl->delta_rxl = 0, nl->cur_rxl_index = flags.rxl; diff -urN linux-2.6.7-rc2/drivers/net/wan/sdla.c linux-2.6.7-rc3/drivers/net/wan/sdla.c --- linux-2.6.7-rc2/drivers/net/wan/sdla.c 2004-05-09 19:33:21.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/wan/sdla.c 2004-06-07 12:55:07.499808483 -0700 @@ -1095,7 +1095,7 @@ return(0); } -static int sdla_config(struct net_device *dev, struct frad_conf *conf, int get) +static int sdla_config(struct net_device *dev, struct frad_conf __user *conf, int get) { struct frad_local *flp; struct conf_data data; @@ -1193,7 +1193,7 @@ return(0); } -static int sdla_xfer(struct net_device *dev, struct sdla_mem *info, int read) +static int sdla_xfer(struct net_device *dev, struct sdla_mem __user *info, int read) { struct sdla_mem mem; char *temp; @@ -1271,7 +1271,7 @@ { case FRAD_GET_CONF: case FRAD_SET_CONF: - return(sdla_config(dev, (struct frad_conf *)ifr->ifr_data, cmd == FRAD_GET_CONF)); + return(sdla_config(dev, ifr->ifr_data, cmd == FRAD_GET_CONF)); case SDLA_IDENTIFY: ifr->ifr_flags = flp->type; @@ -1306,7 +1306,7 @@ case SDLA_WRITEMEM: case SDLA_READMEM: - return(sdla_xfer(dev, (struct sdla_mem *)ifr->ifr_data, cmd == SDLA_READMEM)); + return(sdla_xfer(dev, ifr->ifr_data, cmd == SDLA_READMEM)); case SDLA_START: sdla_start(dev); diff -urN linux-2.6.7-rc2/drivers/net/wan/wanxl.c linux-2.6.7-rc3/drivers/net/wan/wanxl.c --- linux-2.6.7-rc2/drivers/net/wan/wanxl.c 2004-05-09 19:33:20.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/wan/wanxl.c 2004-06-07 12:55:07.500808524 -0700 @@ -418,8 +418,10 @@ timeout = jiffies + HZ; do - if (get_status(port)->open) + if (get_status(port)->open) { + netif_start_queue(dev); return 0; + } while (time_after(timeout, jiffies)); printk(KERN_ERR "%s: unable to open port\n", dev->name); @@ -450,6 +452,8 @@ if (get_status(port)->open) printk(KERN_ERR "%s: unable to close port\n", dev->name); + netif_stop_queue(dev); + for (i = 0; i < TX_BUFFERS; i++) { desc_t *desc = &get_status(port)->tx_descs[i]; diff -urN linux-2.6.7-rc2/drivers/net/wan/wanxlfw.inc linux-2.6.7-rc3/drivers/net/wan/wanxlfw.inc --- linux-2.6.7-rc2/drivers/net/wan/wanxlfw.inc 2004-05-09 19:32:29.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/wan/wanxlfw.inc 1969-12-31 16:00:00.000000000 -0800 @@ -1,158 +0,0 @@ -static u8 firmware[]={ -0x60,0x00,0x00,0x16,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0xB9,0x40,0x00,0x00,0x00,0x00,0x00, -0x10,0x14,0x42,0x80,0x4A,0xB0,0x09,0xB0,0x00,0x00,0x10,0x04,0x67,0x00,0x00,0x0E, -0x06,0xB0,0x40,0x00,0x00,0x00,0x09,0xB0,0x00,0x00,0x10,0x04,0x58,0x80,0x0C,0x80, -0x00,0x00,0x00,0x10,0x66,0x00,0xFF,0xDE,0x21,0xFC,0x00,0x00,0x16,0xBC,0x00,0x6C, -0x21,0xFC,0x00,0x00,0x17,0x5E,0x01,0x00,0x21,0xFC,0x00,0x00,0x16,0xDE,0x01,0x78, -0x21,0xFC,0x00,0x00,0x16,0xFE,0x01,0x74,0x21,0xFC,0x00,0x00,0x17,0x1E,0x01,0x70, -0x21,0xFC,0x00,0x00,0x17,0x3E,0x01,0x6C,0x21,0xFC,0x00,0x00,0x18,0x4C,0x02,0x00, -0x23,0xFC,0x78,0x00,0x00,0x00,0xFF,0xFC,0x15,0x48,0x33,0xFC,0x04,0x80,0xFF,0xFC, -0x10,0x26,0x33,0xFC,0x01,0x10,0xFF,0xFC,0x10,0x2A,0x23,0xFC,0x00,0xD4,0x9F,0x40, -0xFF,0xFC,0x15,0x40,0x23,0xFC,0x00,0x00,0x05,0x43,0xFF,0xF9,0x01,0x00,0x23,0xFC, -0x00,0x00,0x05,0x43,0xFF,0xF9,0x01,0x14,0x23,0xFC,0x00,0x00,0x00,0x00,0xFF,0xF9, -0x01,0x10,0x23,0xFC,0x00,0x00,0x00,0x08,0xFF,0xF9,0x01,0x24,0x23,0xFC,0x00,0x00, -0x01,0x01,0xFF,0xF9,0x01,0x28,0x00,0xB9,0x00,0x0F,0x03,0x00,0xFF,0xF9,0x00,0xE8, -0x23,0xFC,0x00,0x00,0x00,0x01,0xFF,0xF9,0x00,0xD4,0x61,0x00,0x06,0x74,0x33,0xFC, -0xFF,0xFF,0xFF,0xFC,0x15,0x52,0x42,0x79,0xFF,0xFC,0x15,0x50,0x42,0x79,0xFF,0xFC, -0x15,0x64,0x2E,0x3A,0x08,0x50,0x42,0xB9,0x00,0x00,0x19,0x54,0x4A,0x87,0x66,0x00, -0x00,0x0E,0x4E,0x72,0x22,0x00,0x46,0xFC,0x27,0x00,0x60,0x00,0xFF,0xE6,0x42,0x80, -0x42,0x86,0x08,0x07,0x00,0x04,0x67,0x00,0x00,0x0A,0x08,0x87,0x00,0x00,0x61,0x00, -0x02,0xA0,0x08,0x07,0x00,0x00,0x67,0x00,0x00,0x06,0x61,0x00,0x00,0x36,0x08,0x07, -0x00,0x08,0x67,0x00,0x00,0x06,0x61,0x00,0x02,0xB8,0x08,0x07,0x00,0x0C,0x67,0x00, -0x00,0x0A,0x61,0x00,0x04,0x94,0x61,0x00,0x03,0x60,0xE2,0x8F,0x58,0x80,0x0C,0x80, -0x00,0x00,0x00,0x10,0x66,0x00,0xFF,0xBC,0x23,0xC6,0xFF,0xF9,0x00,0xE4,0x60,0x00, -0xFF,0x92,0x20,0x70,0x09,0xB0,0x00,0x00,0x10,0x04,0x4A,0xA8,0x00,0x00,0x66,0x00, -0x02,0x4E,0x21,0x7C,0x00,0x00,0x00,0x01,0x00,0x00,0x42,0xB0,0x09,0xB0,0x00,0x00, -0x19,0x58,0x42,0xB0,0x09,0xB0,0x00,0x00,0x19,0x68,0x42,0xB0,0x09,0xB0,0x00,0x00, -0x19,0x78,0x42,0xB0,0x09,0xB0,0x00,0x00,0x19,0x88,0x22,0x39,0xFF,0xFC,0x16,0xEC, -0xC2,0xB0,0x09,0xB0,0x00,0x00,0x18,0xF2,0x0C,0xA8,0x00,0x00,0x00,0x04,0x00,0x18, -0x66,0x00,0x00,0x0E,0x82,0xB0,0x09,0xB0,0x00,0x00,0x18,0xE2,0x60,0x00,0x00,0x0A, -0x82,0xB0,0x09,0xB0,0x00,0x00,0x18,0xD2,0x23,0xC1,0xFF,0xFC,0x16,0xEC,0x00,0x70, -0x10,0x00,0x09,0xB0,0x00,0x00,0x19,0xAA,0x61,0x00,0x05,0x76,0x22,0x30,0x09,0xB0, -0x00,0x00,0x18,0x92,0x22,0x70,0x09,0xB0,0x00,0x00,0x18,0x72,0x74,0x08,0x26,0x3C, -0x18,0x00,0x00,0x00,0x0C,0xA8,0x00,0x00,0x00,0x01,0x00,0x10,0x67,0x00,0x00,0x06, -0x08,0xC3,0x00,0x1A,0x22,0xC3,0x22,0xC1,0x06,0x81,0x00,0x00,0x05,0xFC,0x51,0xCA, -0xFF,0xF4,0x08,0xC3,0x00,0x1D,0x22,0xC3,0x22,0xC1,0x74,0x1C,0x22,0xFC,0x90,0x00, -0x00,0x00,0x22,0xC1,0x06,0x81,0x00,0x00,0x05,0xFC,0x51,0xCA,0xFF,0xF0,0x22,0xFC, -0xB0,0x00,0x00,0x00,0x22,0xC1,0x22,0x70,0x09,0xB0,0x00,0x00,0x18,0x62,0x24,0x70, -0x09,0xB0,0x00,0x00,0x18,0x52,0x25,0x7C,0x00,0x00,0xFF,0xFF,0x00,0x10,0x25,0x7C, -0x00,0x00,0x00,0x00,0x00,0x14,0x22,0x30,0x09,0xB0,0x00,0x00,0x18,0x72,0x33,0x41, -0x00,0x02,0x06,0x81,0x00,0x00,0x00,0x50,0x33,0x41,0x00,0x00,0x13,0x7C,0x00,0x08, -0x00,0x04,0x13,0x7C,0x00,0x08,0x00,0x05,0x0C,0xA8,0x00,0x00,0x00,0x05,0x00,0x10, -0x66,0x00,0x00,0x2A,0x42,0x6A,0x00,0x08,0x23,0x7C,0x00,0x00,0xF0,0xB8,0x00,0x34, -0x23,0x7C,0x00,0x00,0xFF,0xFF,0x00,0x38,0x33,0x7C,0x05,0xFA,0x00,0x46,0x31,0xBC, -0x00,0x02,0x09,0xB0,0x00,0x00,0x19,0x9C,0x60,0x00,0x00,0xBC,0x0C,0xA8,0x00,0x00, -0x00,0x07,0x00,0x10,0x66,0x00,0x00,0x2C,0x35,0x7C,0x08,0x00,0x00,0x08,0x23,0x7C, -0xDE,0xBB,0x20,0xE3,0x00,0x34,0x23,0x7C,0xFF,0xFF,0xFF,0xFF,0x00,0x38,0x33,0x7C, -0x05,0xFC,0x00,0x46,0x31,0xBC,0x00,0x04,0x09,0xB0,0x00,0x00,0x19,0x9C,0x60,0x00, -0x00,0x86,0x0C,0xA8,0x00,0x00,0x00,0x04,0x00,0x10,0x66,0x00,0x00,0x26,0x42,0x6A, -0x00,0x08,0x23,0x7C,0x00,0x00,0xF0,0xB8,0x00,0x34,0x42,0xA9,0x00,0x38,0x33,0x7C, -0x05,0xFA,0x00,0x46,0x31,0xBC,0x00,0x02,0x09,0xB0,0x00,0x00,0x19,0x9C,0x60,0x00, -0x00,0x56,0x0C,0xA8,0x00,0x00,0x00,0x06,0x00,0x10,0x66,0x00,0x00,0x28,0x35,0x7C, -0x08,0x00,0x00,0x08,0x23,0x7C,0xDE,0xBB,0x20,0xE3,0x00,0x34,0x42,0xA9,0x00,0x38, -0x33,0x7C,0x05,0xFC,0x00,0x46,0x31,0xBC,0x00,0x04,0x09,0xB0,0x00,0x00,0x19,0x9C, -0x60,0x00,0x00,0x24,0x42,0x6A,0x00,0x08,0x23,0x7C,0x00,0x00,0xF0,0xB8,0x00,0x34, -0x23,0x7C,0x00,0x00,0xFF,0xFF,0x00,0x38,0x33,0x7C,0x05,0xF8,0x00,0x46,0x42,0x70, -0x09,0xB0,0x00,0x00,0x19,0x9C,0x25,0x7C,0x00,0x00,0x00,0x03,0x00,0x04,0x0C,0xA8, -0x00,0x00,0x00,0x02,0x00,0x14,0x66,0x00,0x00,0x0E,0x25,0x7C,0x10,0x04,0x09,0x00, -0x00,0x00,0x60,0x00,0x00,0x0A,0x25,0x7C,0x10,0x04,0x00,0x00,0x00,0x00,0x33,0x7C, -0x05,0xFC,0x00,0x06,0x22,0x00,0xE9,0x89,0x00,0x81,0x00,0x00,0x00,0x01,0x33,0xC1, -0xFF,0xFC,0x15,0xC0,0x08,0x39,0x00,0x00,0xFF,0xFC,0x15,0xC0,0x66,0x00,0xFF,0xF6, -0x35,0x7C,0x00,0x1F,0x00,0x14,0x00,0xAA,0x00,0x00,0x00,0x30,0x00,0x00,0x4E,0x75, -0x20,0x70,0x09,0xB0,0x00,0x00,0x18,0x52,0x42,0x68,0x00,0x14,0x02,0xA8,0xFF,0xFF, -0xFF,0xCF,0x00,0x00,0x02,0x70,0xEF,0xFF,0x09,0xB0,0x00,0x00,0x19,0xAA,0x61,0x00, -0x03,0x70,0x22,0x30,0x09,0xB0,0x00,0x00,0x10,0x04,0x42,0xB0,0x19,0x90,0x4E,0x75, -0x0C,0xB0,0x00,0x00,0x00,0x0A,0x09,0xB0,0x00,0x00,0x19,0x78,0x67,0x00,0x00,0xA8, -0x22,0x30,0x09,0xB0,0x00,0x00,0x19,0x68,0x24,0x01,0x4C,0x3C,0x20,0x00,0x00,0x00, -0x00,0x0C,0xD4,0xB0,0x09,0xB0,0x00,0x00,0x10,0x04,0x06,0x82,0x00,0x00,0x00,0x1C, -0x0C,0xB0,0x00,0x00,0x00,0x10,0x29,0x90,0x66,0x00,0x00,0x7C,0x20,0x70,0x29,0xA0, -0x00,0x04,0xE7,0x89,0xD2,0xB0,0x09,0xB0,0x00,0x00,0x18,0x72,0x22,0x70,0x19,0xA0, -0x00,0x04,0x24,0x30,0x29,0xA0,0x00,0x08,0x31,0x82,0x19,0xA0,0x00,0x02,0x56,0x82, -0x02,0x82,0xFF,0xFF,0xFF,0xFC,0x23,0xC8,0xFF,0xF9,0x01,0x04,0x23,0xC9,0xFF,0xF9, -0x01,0x08,0x23,0xC2,0xFF,0xF9,0x01,0x0C,0x23,0xFC,0x00,0x00,0x01,0x03,0xFF,0xF9, -0x01,0x28,0x61,0x00,0x01,0xF6,0x08,0xF0,0x00,0x1F,0x19,0x90,0x22,0x30,0x09,0xB0, -0x00,0x00,0x19,0x68,0x52,0x81,0x0C,0x81,0x00,0x00,0x00,0x0A,0x66,0x00,0x00,0x04, -0x42,0x81,0x21,0x81,0x09,0xB0,0x00,0x00,0x19,0x68,0x52,0xB0,0x09,0xB0,0x00,0x00, -0x19,0x78,0x60,0x00,0xFF,0x4C,0x4E,0x75,0x22,0x30,0x09,0xB0,0x00,0x00,0x19,0x88, -0xE7,0x89,0xD2,0xB0,0x09,0xB0,0x00,0x00,0x18,0x82,0x34,0x30,0x19,0x90,0x08,0x02, -0x00,0x0F,0x66,0x00,0x01,0x12,0x08,0x02,0x00,0x01,0x66,0x00,0x00,0xE6,0x4A,0x70, -0x09,0xB0,0x00,0x00,0x19,0x9C,0x66,0x00,0x00,0x06,0x08,0x82,0x00,0x02,0x02,0x42, -0x0C,0xBC,0x0C,0x42,0x0C,0x00,0x66,0x00,0x00,0xDC,0x42,0x83,0x36,0x30,0x19,0xA0, -0x00,0x02,0x96,0x70,0x09,0xB0,0x00,0x00,0x19,0x9C,0x0C,0x43,0x05,0xF8,0x6E,0x00, -0x00,0xC4,0x24,0x3A,0x04,0x84,0x4C,0x3C,0x20,0x00,0x00,0x00,0x00,0x0C,0xD4,0xBA, -0xFA,0xF4,0x0C,0xB0,0x00,0x00,0x00,0x00,0x29,0x90,0x66,0x00,0x00,0x96,0x21,0x83, -0x29,0xA0,0x00,0x08,0x20,0x70,0x19,0xA0,0x00,0x04,0x22,0x70,0x29,0xA0,0x00,0x04, -0x4A,0x89,0x67,0x00,0x00,0x2A,0x56,0x83,0x02,0x83,0xFF,0xFF,0xFF,0xFC,0x23,0xC8, -0xFF,0xF9,0x01,0x1C,0x23,0xC9,0xFF,0xF9,0x01,0x18,0x23,0xC3,0xFF,0xF9,0x01,0x20, -0x23,0xFC,0x00,0x00,0x03,0x01,0xFF,0xF9,0x01,0x28,0x61,0x00,0x01,0x2C,0x21,0xB0, -0x09,0xB0,0x00,0x00,0x18,0xC2,0x29,0x90,0x08,0xC6,0x00,0x04,0x24,0x3A,0x04,0x1A, -0x52,0x82,0x0C,0x82,0x00,0x00,0x00,0x28,0x66,0x00,0x00,0x04,0x42,0x82,0x23,0xC2, -0x00,0x00,0x19,0x98,0x02,0x70,0xF0,0x00,0x19,0x90,0x08,0xF0,0x00,0x1F,0x19,0x90, -0x22,0x30,0x09,0xB0,0x00,0x00,0x19,0x88,0x52,0x81,0x0C,0x81,0x00,0x00,0x00,0x1E, -0x66,0x00,0x00,0x04,0x42,0x81,0x21,0x81,0x09,0xB0,0x00,0x00,0x19,0x88,0x60,0x00, -0xFE,0xF8,0x24,0x30,0x09,0xB0,0x00,0x00,0x10,0x04,0x52,0xB0,0x29,0xA0,0x00,0x08, -0x60,0x00,0xFF,0xC2,0x24,0x30,0x09,0xB0,0x00,0x00,0x10,0x04,0x52,0xB0,0x29,0xA0, -0x00,0x0C,0x60,0x00,0xFF,0xB0,0x4E,0x75,0x4A,0xB0,0x09,0xB0,0x00,0x00,0x19,0x78, -0x67,0x00,0x00,0x86,0x22,0x30,0x09,0xB0,0x00,0x00,0x19,0x58,0x24,0x01,0xE7,0x89, -0xD2,0xB0,0x09,0xB0,0x00,0x00,0x18,0x72,0x36,0x30,0x19,0x90,0x08,0x03,0x00,0x0F, -0x66,0x00,0x00,0x66,0x8C,0xB0,0x09,0xB0,0x00,0x00,0x18,0xA2,0x53,0xB0,0x09,0xB0, -0x00,0x00,0x19,0x78,0x22,0x30,0x09,0xB0,0x00,0x00,0x19,0x58,0x52,0x81,0x0C,0x81, -0x00,0x00,0x00,0x0A,0x66,0x00,0x00,0x04,0x42,0x81,0x21,0x81,0x09,0xB0,0x00,0x00, -0x19,0x58,0x4C,0x3C,0x20,0x00,0x00,0x00,0x00,0x0C,0xD4,0xB0,0x09,0xB0,0x00,0x00, -0x10,0x04,0x06,0x82,0x00,0x00,0x00,0x1C,0x08,0x03,0x00,0x01,0x66,0x00,0x00,0x0E, -0x21,0xBC,0x00,0x00,0x00,0x20,0x29,0x90,0x60,0x00,0xFF,0x7E,0x21,0xBC,0x00,0x00, -0x00,0x30,0x29,0x90,0x60,0x00,0xFF,0x72,0x4E,0x75,0x2F,0x00,0x40,0xE7,0x20,0x39, -0xFF,0xF9,0x01,0x28,0x08,0x00,0x00,0x04,0x66,0x00,0x00,0x2C,0x4E,0x72,0x22,0x00, -0x46,0xFC,0x27,0x00,0x60,0x00,0xFF,0xE8,0x2F,0x00,0x40,0xE7,0x20,0x39,0xFF,0xF9, -0x01,0x28,0x08,0x00,0x00,0x0C,0x66,0x00,0x00,0x0E,0x4E,0x72,0x22,0x00,0x46,0xFC, -0x27,0x00,0x60,0x00,0xFF,0xE8,0x46,0xDF,0x20,0x1F,0x4E,0x75,0x2F,0x00,0x20,0x39, -0xFF,0xF9,0x00,0xE0,0x23,0xC0,0xFF,0xF9,0x00,0xE0,0x81,0xB9,0x00,0x00,0x19,0x54, -0x23,0xFC,0x00,0x00,0x09,0x09,0xFF,0xF9,0x01,0x28,0x20,0x1F,0x4E,0x73,0x00,0xB9, -0x00,0x00,0x00,0x00,0xFF,0xFC,0x16,0x10,0x00,0xB9,0x00,0x00,0x10,0x00,0x00,0x00, -0x19,0x54,0x23,0xFC,0x40,0x00,0x00,0x00,0xFF,0xFC,0x15,0x4C,0x4E,0x73,0x00,0xB9, -0x00,0x00,0x00,0x00,0xFF,0xFC,0x16,0x30,0x00,0xB9,0x00,0x00,0x20,0x00,0x00,0x00, -0x19,0x54,0x23,0xFC,0x20,0x00,0x00,0x00,0xFF,0xFC,0x15,0x4C,0x4E,0x73,0x00,0xB9, -0x00,0x00,0x00,0x00,0xFF,0xFC,0x16,0x50,0x00,0xB9,0x00,0x00,0x40,0x00,0x00,0x00, -0x19,0x54,0x23,0xFC,0x10,0x00,0x00,0x00,0xFF,0xFC,0x15,0x4C,0x4E,0x73,0x00,0xB9, -0x00,0x00,0x00,0x00,0xFF,0xFC,0x16,0x70,0x00,0xB9,0x00,0x00,0x80,0x00,0x00,0x00, -0x19,0x54,0x23,0xFC,0x08,0x00,0x00,0x00,0xFF,0xFC,0x15,0x4C,0x4E,0x73,0x4E,0x73, -0x2F,0x00,0x2F,0x01,0x2F,0x02,0x2F,0x08,0x2F,0x09,0x42,0x80,0x20,0x7C,0xFF,0xFB, -0x00,0x00,0x32,0x10,0x02,0x81,0x00,0x00,0x00,0xE7,0x0C,0x41,0x00,0x42,0x66,0x00, -0x00,0x0A,0x32,0x3C,0x0E,0x08,0x60,0x00,0x00,0x3E,0x0C,0x41,0x00,0x63,0x66,0x00, -0x00,0x0A,0x32,0x3C,0x04,0x08,0x60,0x00,0x00,0x2E,0x0C,0x41,0x00,0x84,0x66,0x00, -0x00,0x0A,0x32,0x3C,0x02,0x08,0x60,0x00,0x00,0x1E,0x0C,0x41,0x00,0xA5,0x66,0x00, -0x00,0x0A,0x32,0x3C,0x0D,0x08,0x60,0x00,0x00,0x0E,0x32,0x3C,0x00,0x08,0x34,0x3C, -0x80,0xE7,0x60,0x00,0x00,0x14,0x34,0x30,0x09,0xB0,0x00,0x00,0x19,0xAA,0x02,0x42, -0x30,0x00,0x82,0x42,0x34,0x3C,0x80,0xFF,0xB2,0x70,0x09,0xB0,0x00,0x00,0x19,0xAC, -0x67,0x00,0x00,0x0C,0x31,0x81,0x09,0xB0,0x00,0x00,0x19,0xAC,0x30,0x81,0x32,0x39, -0xFF,0xFC,0x15,0x66,0xC2,0x70,0x09,0xB0,0x00,0x00,0x19,0x02,0x67,0x00,0x00,0x0C, -0x32,0x10,0x02,0x41,0xFF,0xF7,0x60,0x00,0x00,0x08,0x32,0x10,0x00,0x41,0x00,0x08, -0xC2,0x42,0x22,0x70,0x09,0xB0,0x00,0x00,0x10,0x04,0xB2,0xA9,0x00,0x04,0x67,0x00, -0x00,0x12,0x23,0x41,0x00,0x04,0x23,0xF0,0x09,0xB0,0x00,0x00,0x18,0xB2,0xFF,0xF9, -0x00,0xE4,0x54,0x88,0x58,0x80,0x0C,0x80,0x00,0x00,0x00,0x10,0x66,0x00,0xFF,0x34, -0x22,0x5F,0x20,0x5F,0x24,0x1F,0x22,0x1F,0x20,0x1F,0x4E,0x75,0x61,0x00,0xFF,0x12, -0x4E,0x73,0xFF,0xFC,0x16,0x00,0xFF,0xFC,0x16,0x20,0xFF,0xFC,0x16,0x40,0xFF,0xFC, -0x16,0x60,0xFF,0xFC,0x0C,0x00,0xFF,0xFC,0x0D,0x00,0xFF,0xFC,0x0E,0x00,0xFF,0xFC, -0x0F,0x00,0xFF,0xFC,0x00,0x00,0xFF,0xFC,0x01,0x40,0xFF,0xFC,0x02,0x80,0xFF,0xFC, -0x03,0xC0,0xFF,0xFC,0x00,0x50,0xFF,0xFC,0x01,0x90,0xFF,0xFC,0x02,0xD0,0xFF,0xFC, -0x04,0x10,0x00,0x00,0x40,0x00,0x00,0x01,0x2F,0x60,0x00,0x02,0x1E,0xC0,0x00,0x03, -0x0E,0x20,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x04,0x00,0x00, -0x00,0x08,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x80,0x00,0x00, -0x01,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x11,0x00,0x00,0x00,0x12,0x00,0x00, -0x00,0x13,0x00,0x00,0x00,0x2C,0x00,0x00,0x3E,0x00,0x00,0x2C,0x00,0x00,0x3E,0x00, -0x00,0x00,0x00,0x00,0x00,0x2D,0x00,0x00,0x3F,0x00,0x00,0x2D,0x00,0x00,0x3F,0x00, -0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00, -0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x80,0x00,0x00,0x02,0x00,0x00,0x00,0x08,0x00, -0x77,0x61,0x6E,0x58,0x4C,0x20,0x66,0x69,0x72,0x6D,0x77,0x61,0x72,0x65,0x0A,0x43, -0x6F,0x70,0x79,0x72,0x69,0x67,0x68,0x74,0x20,0x28,0x43,0x29,0x20,0x32,0x30,0x30, -0x33,0x20,0x4B,0x72,0x7A,0x79,0x73,0x7A,0x74,0x6F,0x66,0x20,0x48,0x61,0x6C,0x61, -0x73,0x61,0x20,0x3C,0x6B,0x68,0x63,0x40,0x70,0x6D,0x2E,0x77,0x61,0x77,0x2E,0x70, -0x6C,0x3E,0x0A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 -}; diff -urN linux-2.6.7-rc2/drivers/net/wan/wanxlfw.inc_shipped linux-2.6.7-rc3/drivers/net/wan/wanxlfw.inc_shipped --- linux-2.6.7-rc2/drivers/net/wan/wanxlfw.inc_shipped 1969-12-31 16:00:00.000000000 -0800 +++ linux-2.6.7-rc3/drivers/net/wan/wanxlfw.inc_shipped 2004-06-07 12:55:07.503808649 -0700 @@ -0,0 +1,158 @@ +static u8 firmware[]={ +0x60,0x00,0x00,0x16,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0xB9,0x40,0x00,0x00,0x00,0x00,0x00, +0x10,0x14,0x42,0x80,0x4A,0xB0,0x09,0xB0,0x00,0x00,0x10,0x04,0x67,0x00,0x00,0x0E, +0x06,0xB0,0x40,0x00,0x00,0x00,0x09,0xB0,0x00,0x00,0x10,0x04,0x58,0x80,0x0C,0x80, +0x00,0x00,0x00,0x10,0x66,0x00,0xFF,0xDE,0x21,0xFC,0x00,0x00,0x16,0xBC,0x00,0x6C, +0x21,0xFC,0x00,0x00,0x17,0x5E,0x01,0x00,0x21,0xFC,0x00,0x00,0x16,0xDE,0x01,0x78, +0x21,0xFC,0x00,0x00,0x16,0xFE,0x01,0x74,0x21,0xFC,0x00,0x00,0x17,0x1E,0x01,0x70, +0x21,0xFC,0x00,0x00,0x17,0x3E,0x01,0x6C,0x21,0xFC,0x00,0x00,0x18,0x4C,0x02,0x00, +0x23,0xFC,0x78,0x00,0x00,0x00,0xFF,0xFC,0x15,0x48,0x33,0xFC,0x04,0x80,0xFF,0xFC, +0x10,0x26,0x33,0xFC,0x01,0x10,0xFF,0xFC,0x10,0x2A,0x23,0xFC,0x00,0xD4,0x9F,0x40, +0xFF,0xFC,0x15,0x40,0x23,0xFC,0x00,0x00,0x05,0x43,0xFF,0xF9,0x01,0x00,0x23,0xFC, +0x00,0x00,0x05,0x43,0xFF,0xF9,0x01,0x14,0x23,0xFC,0x00,0x00,0x00,0x00,0xFF,0xF9, +0x01,0x10,0x23,0xFC,0x00,0x00,0x00,0x08,0xFF,0xF9,0x01,0x24,0x23,0xFC,0x00,0x00, +0x01,0x01,0xFF,0xF9,0x01,0x28,0x00,0xB9,0x00,0x0F,0x03,0x00,0xFF,0xF9,0x00,0xE8, +0x23,0xFC,0x00,0x00,0x00,0x01,0xFF,0xF9,0x00,0xD4,0x61,0x00,0x06,0x74,0x33,0xFC, +0xFF,0xFF,0xFF,0xFC,0x15,0x52,0x42,0x79,0xFF,0xFC,0x15,0x50,0x42,0x79,0xFF,0xFC, +0x15,0x64,0x2E,0x3A,0x08,0x50,0x42,0xB9,0x00,0x00,0x19,0x54,0x4A,0x87,0x66,0x00, +0x00,0x0E,0x4E,0x72,0x22,0x00,0x46,0xFC,0x27,0x00,0x60,0x00,0xFF,0xE6,0x42,0x80, +0x42,0x86,0x08,0x07,0x00,0x04,0x67,0x00,0x00,0x0A,0x08,0x87,0x00,0x00,0x61,0x00, +0x02,0xA0,0x08,0x07,0x00,0x00,0x67,0x00,0x00,0x06,0x61,0x00,0x00,0x36,0x08,0x07, +0x00,0x08,0x67,0x00,0x00,0x06,0x61,0x00,0x02,0xB8,0x08,0x07,0x00,0x0C,0x67,0x00, +0x00,0x0A,0x61,0x00,0x04,0x94,0x61,0x00,0x03,0x60,0xE2,0x8F,0x58,0x80,0x0C,0x80, +0x00,0x00,0x00,0x10,0x66,0x00,0xFF,0xBC,0x23,0xC6,0xFF,0xF9,0x00,0xE4,0x60,0x00, +0xFF,0x92,0x20,0x70,0x09,0xB0,0x00,0x00,0x10,0x04,0x4A,0xA8,0x00,0x00,0x66,0x00, +0x02,0x4E,0x21,0x7C,0x00,0x00,0x00,0x01,0x00,0x00,0x42,0xB0,0x09,0xB0,0x00,0x00, +0x19,0x58,0x42,0xB0,0x09,0xB0,0x00,0x00,0x19,0x68,0x42,0xB0,0x09,0xB0,0x00,0x00, +0x19,0x78,0x42,0xB0,0x09,0xB0,0x00,0x00,0x19,0x88,0x22,0x39,0xFF,0xFC,0x16,0xEC, +0xC2,0xB0,0x09,0xB0,0x00,0x00,0x18,0xF2,0x0C,0xA8,0x00,0x00,0x00,0x04,0x00,0x18, +0x66,0x00,0x00,0x0E,0x82,0xB0,0x09,0xB0,0x00,0x00,0x18,0xE2,0x60,0x00,0x00,0x0A, +0x82,0xB0,0x09,0xB0,0x00,0x00,0x18,0xD2,0x23,0xC1,0xFF,0xFC,0x16,0xEC,0x00,0x70, +0x10,0x00,0x09,0xB0,0x00,0x00,0x19,0xAA,0x61,0x00,0x05,0x76,0x22,0x30,0x09,0xB0, +0x00,0x00,0x18,0x92,0x22,0x70,0x09,0xB0,0x00,0x00,0x18,0x72,0x74,0x08,0x26,0x3C, +0x18,0x00,0x00,0x00,0x0C,0xA8,0x00,0x00,0x00,0x01,0x00,0x10,0x67,0x00,0x00,0x06, +0x08,0xC3,0x00,0x1A,0x22,0xC3,0x22,0xC1,0x06,0x81,0x00,0x00,0x05,0xFC,0x51,0xCA, +0xFF,0xF4,0x08,0xC3,0x00,0x1D,0x22,0xC3,0x22,0xC1,0x74,0x1C,0x22,0xFC,0x90,0x00, +0x00,0x00,0x22,0xC1,0x06,0x81,0x00,0x00,0x05,0xFC,0x51,0xCA,0xFF,0xF0,0x22,0xFC, +0xB0,0x00,0x00,0x00,0x22,0xC1,0x22,0x70,0x09,0xB0,0x00,0x00,0x18,0x62,0x24,0x70, +0x09,0xB0,0x00,0x00,0x18,0x52,0x25,0x7C,0x00,0x00,0xFF,0xFF,0x00,0x10,0x25,0x7C, +0x00,0x00,0x00,0x00,0x00,0x14,0x22,0x30,0x09,0xB0,0x00,0x00,0x18,0x72,0x33,0x41, +0x00,0x02,0x06,0x81,0x00,0x00,0x00,0x50,0x33,0x41,0x00,0x00,0x13,0x7C,0x00,0x08, +0x00,0x04,0x13,0x7C,0x00,0x08,0x00,0x05,0x0C,0xA8,0x00,0x00,0x00,0x05,0x00,0x10, +0x66,0x00,0x00,0x2A,0x42,0x6A,0x00,0x08,0x23,0x7C,0x00,0x00,0xF0,0xB8,0x00,0x34, +0x23,0x7C,0x00,0x00,0xFF,0xFF,0x00,0x38,0x33,0x7C,0x05,0xFA,0x00,0x46,0x31,0xBC, +0x00,0x02,0x09,0xB0,0x00,0x00,0x19,0x9C,0x60,0x00,0x00,0xBC,0x0C,0xA8,0x00,0x00, +0x00,0x07,0x00,0x10,0x66,0x00,0x00,0x2C,0x35,0x7C,0x08,0x00,0x00,0x08,0x23,0x7C, +0xDE,0xBB,0x20,0xE3,0x00,0x34,0x23,0x7C,0xFF,0xFF,0xFF,0xFF,0x00,0x38,0x33,0x7C, +0x05,0xFC,0x00,0x46,0x31,0xBC,0x00,0x04,0x09,0xB0,0x00,0x00,0x19,0x9C,0x60,0x00, +0x00,0x86,0x0C,0xA8,0x00,0x00,0x00,0x04,0x00,0x10,0x66,0x00,0x00,0x26,0x42,0x6A, +0x00,0x08,0x23,0x7C,0x00,0x00,0xF0,0xB8,0x00,0x34,0x42,0xA9,0x00,0x38,0x33,0x7C, +0x05,0xFA,0x00,0x46,0x31,0xBC,0x00,0x02,0x09,0xB0,0x00,0x00,0x19,0x9C,0x60,0x00, +0x00,0x56,0x0C,0xA8,0x00,0x00,0x00,0x06,0x00,0x10,0x66,0x00,0x00,0x28,0x35,0x7C, +0x08,0x00,0x00,0x08,0x23,0x7C,0xDE,0xBB,0x20,0xE3,0x00,0x34,0x42,0xA9,0x00,0x38, +0x33,0x7C,0x05,0xFC,0x00,0x46,0x31,0xBC,0x00,0x04,0x09,0xB0,0x00,0x00,0x19,0x9C, +0x60,0x00,0x00,0x24,0x42,0x6A,0x00,0x08,0x23,0x7C,0x00,0x00,0xF0,0xB8,0x00,0x34, +0x23,0x7C,0x00,0x00,0xFF,0xFF,0x00,0x38,0x33,0x7C,0x05,0xF8,0x00,0x46,0x42,0x70, +0x09,0xB0,0x00,0x00,0x19,0x9C,0x25,0x7C,0x00,0x00,0x00,0x03,0x00,0x04,0x0C,0xA8, +0x00,0x00,0x00,0x02,0x00,0x14,0x66,0x00,0x00,0x0E,0x25,0x7C,0x10,0x04,0x09,0x00, +0x00,0x00,0x60,0x00,0x00,0x0A,0x25,0x7C,0x10,0x04,0x00,0x00,0x00,0x00,0x33,0x7C, +0x05,0xFC,0x00,0x06,0x22,0x00,0xE9,0x89,0x00,0x81,0x00,0x00,0x00,0x01,0x33,0xC1, +0xFF,0xFC,0x15,0xC0,0x08,0x39,0x00,0x00,0xFF,0xFC,0x15,0xC0,0x66,0x00,0xFF,0xF6, +0x35,0x7C,0x00,0x1F,0x00,0x14,0x00,0xAA,0x00,0x00,0x00,0x30,0x00,0x00,0x4E,0x75, +0x20,0x70,0x09,0xB0,0x00,0x00,0x18,0x52,0x42,0x68,0x00,0x14,0x02,0xA8,0xFF,0xFF, +0xFF,0xCF,0x00,0x00,0x02,0x70,0xEF,0xFF,0x09,0xB0,0x00,0x00,0x19,0xAA,0x61,0x00, +0x03,0x70,0x22,0x30,0x09,0xB0,0x00,0x00,0x10,0x04,0x42,0xB0,0x19,0x90,0x4E,0x75, +0x0C,0xB0,0x00,0x00,0x00,0x0A,0x09,0xB0,0x00,0x00,0x19,0x78,0x67,0x00,0x00,0xA8, +0x22,0x30,0x09,0xB0,0x00,0x00,0x19,0x68,0x24,0x01,0x4C,0x3C,0x20,0x00,0x00,0x00, +0x00,0x0C,0xD4,0xB0,0x09,0xB0,0x00,0x00,0x10,0x04,0x06,0x82,0x00,0x00,0x00,0x1C, +0x0C,0xB0,0x00,0x00,0x00,0x10,0x29,0x90,0x66,0x00,0x00,0x7C,0x20,0x70,0x29,0xA0, +0x00,0x04,0xE7,0x89,0xD2,0xB0,0x09,0xB0,0x00,0x00,0x18,0x72,0x22,0x70,0x19,0xA0, +0x00,0x04,0x24,0x30,0x29,0xA0,0x00,0x08,0x31,0x82,0x19,0xA0,0x00,0x02,0x56,0x82, +0x02,0x82,0xFF,0xFF,0xFF,0xFC,0x23,0xC8,0xFF,0xF9,0x01,0x04,0x23,0xC9,0xFF,0xF9, +0x01,0x08,0x23,0xC2,0xFF,0xF9,0x01,0x0C,0x23,0xFC,0x00,0x00,0x01,0x03,0xFF,0xF9, +0x01,0x28,0x61,0x00,0x01,0xF6,0x08,0xF0,0x00,0x1F,0x19,0x90,0x22,0x30,0x09,0xB0, +0x00,0x00,0x19,0x68,0x52,0x81,0x0C,0x81,0x00,0x00,0x00,0x0A,0x66,0x00,0x00,0x04, +0x42,0x81,0x21,0x81,0x09,0xB0,0x00,0x00,0x19,0x68,0x52,0xB0,0x09,0xB0,0x00,0x00, +0x19,0x78,0x60,0x00,0xFF,0x4C,0x4E,0x75,0x22,0x30,0x09,0xB0,0x00,0x00,0x19,0x88, +0xE7,0x89,0xD2,0xB0,0x09,0xB0,0x00,0x00,0x18,0x82,0x34,0x30,0x19,0x90,0x08,0x02, +0x00,0x0F,0x66,0x00,0x01,0x12,0x08,0x02,0x00,0x01,0x66,0x00,0x00,0xE6,0x4A,0x70, +0x09,0xB0,0x00,0x00,0x19,0x9C,0x66,0x00,0x00,0x06,0x08,0x82,0x00,0x02,0x02,0x42, +0x0C,0xBC,0x0C,0x42,0x0C,0x00,0x66,0x00,0x00,0xDC,0x42,0x83,0x36,0x30,0x19,0xA0, +0x00,0x02,0x96,0x70,0x09,0xB0,0x00,0x00,0x19,0x9C,0x0C,0x43,0x05,0xF8,0x6E,0x00, +0x00,0xC4,0x24,0x3A,0x04,0x84,0x4C,0x3C,0x20,0x00,0x00,0x00,0x00,0x0C,0xD4,0xBA, +0xFA,0xF4,0x0C,0xB0,0x00,0x00,0x00,0x00,0x29,0x90,0x66,0x00,0x00,0x96,0x21,0x83, +0x29,0xA0,0x00,0x08,0x20,0x70,0x19,0xA0,0x00,0x04,0x22,0x70,0x29,0xA0,0x00,0x04, +0x4A,0x89,0x67,0x00,0x00,0x2A,0x56,0x83,0x02,0x83,0xFF,0xFF,0xFF,0xFC,0x23,0xC8, +0xFF,0xF9,0x01,0x1C,0x23,0xC9,0xFF,0xF9,0x01,0x18,0x23,0xC3,0xFF,0xF9,0x01,0x20, +0x23,0xFC,0x00,0x00,0x03,0x01,0xFF,0xF9,0x01,0x28,0x61,0x00,0x01,0x2C,0x21,0xB0, +0x09,0xB0,0x00,0x00,0x18,0xC2,0x29,0x90,0x08,0xC6,0x00,0x04,0x24,0x3A,0x04,0x1A, +0x52,0x82,0x0C,0x82,0x00,0x00,0x00,0x28,0x66,0x00,0x00,0x04,0x42,0x82,0x23,0xC2, +0x00,0x00,0x19,0x98,0x02,0x70,0xF0,0x00,0x19,0x90,0x08,0xF0,0x00,0x1F,0x19,0x90, +0x22,0x30,0x09,0xB0,0x00,0x00,0x19,0x88,0x52,0x81,0x0C,0x81,0x00,0x00,0x00,0x1E, +0x66,0x00,0x00,0x04,0x42,0x81,0x21,0x81,0x09,0xB0,0x00,0x00,0x19,0x88,0x60,0x00, +0xFE,0xF8,0x24,0x30,0x09,0xB0,0x00,0x00,0x10,0x04,0x52,0xB0,0x29,0xA0,0x00,0x08, +0x60,0x00,0xFF,0xC2,0x24,0x30,0x09,0xB0,0x00,0x00,0x10,0x04,0x52,0xB0,0x29,0xA0, +0x00,0x0C,0x60,0x00,0xFF,0xB0,0x4E,0x75,0x4A,0xB0,0x09,0xB0,0x00,0x00,0x19,0x78, +0x67,0x00,0x00,0x86,0x22,0x30,0x09,0xB0,0x00,0x00,0x19,0x58,0x24,0x01,0xE7,0x89, +0xD2,0xB0,0x09,0xB0,0x00,0x00,0x18,0x72,0x36,0x30,0x19,0x90,0x08,0x03,0x00,0x0F, +0x66,0x00,0x00,0x66,0x8C,0xB0,0x09,0xB0,0x00,0x00,0x18,0xA2,0x53,0xB0,0x09,0xB0, +0x00,0x00,0x19,0x78,0x22,0x30,0x09,0xB0,0x00,0x00,0x19,0x58,0x52,0x81,0x0C,0x81, +0x00,0x00,0x00,0x0A,0x66,0x00,0x00,0x04,0x42,0x81,0x21,0x81,0x09,0xB0,0x00,0x00, +0x19,0x58,0x4C,0x3C,0x20,0x00,0x00,0x00,0x00,0x0C,0xD4,0xB0,0x09,0xB0,0x00,0x00, +0x10,0x04,0x06,0x82,0x00,0x00,0x00,0x1C,0x08,0x03,0x00,0x01,0x66,0x00,0x00,0x0E, +0x21,0xBC,0x00,0x00,0x00,0x20,0x29,0x90,0x60,0x00,0xFF,0x7E,0x21,0xBC,0x00,0x00, +0x00,0x30,0x29,0x90,0x60,0x00,0xFF,0x72,0x4E,0x75,0x2F,0x00,0x40,0xE7,0x20,0x39, +0xFF,0xF9,0x01,0x28,0x08,0x00,0x00,0x04,0x66,0x00,0x00,0x2C,0x4E,0x72,0x22,0x00, +0x46,0xFC,0x27,0x00,0x60,0x00,0xFF,0xE8,0x2F,0x00,0x40,0xE7,0x20,0x39,0xFF,0xF9, +0x01,0x28,0x08,0x00,0x00,0x0C,0x66,0x00,0x00,0x0E,0x4E,0x72,0x22,0x00,0x46,0xFC, +0x27,0x00,0x60,0x00,0xFF,0xE8,0x46,0xDF,0x20,0x1F,0x4E,0x75,0x2F,0x00,0x20,0x39, +0xFF,0xF9,0x00,0xE0,0x23,0xC0,0xFF,0xF9,0x00,0xE0,0x81,0xB9,0x00,0x00,0x19,0x54, +0x23,0xFC,0x00,0x00,0x09,0x09,0xFF,0xF9,0x01,0x28,0x20,0x1F,0x4E,0x73,0x00,0xB9, +0x00,0x00,0x00,0x00,0xFF,0xFC,0x16,0x10,0x00,0xB9,0x00,0x00,0x10,0x00,0x00,0x00, +0x19,0x54,0x23,0xFC,0x40,0x00,0x00,0x00,0xFF,0xFC,0x15,0x4C,0x4E,0x73,0x00,0xB9, +0x00,0x00,0x00,0x00,0xFF,0xFC,0x16,0x30,0x00,0xB9,0x00,0x00,0x20,0x00,0x00,0x00, +0x19,0x54,0x23,0xFC,0x20,0x00,0x00,0x00,0xFF,0xFC,0x15,0x4C,0x4E,0x73,0x00,0xB9, +0x00,0x00,0x00,0x00,0xFF,0xFC,0x16,0x50,0x00,0xB9,0x00,0x00,0x40,0x00,0x00,0x00, +0x19,0x54,0x23,0xFC,0x10,0x00,0x00,0x00,0xFF,0xFC,0x15,0x4C,0x4E,0x73,0x00,0xB9, +0x00,0x00,0x00,0x00,0xFF,0xFC,0x16,0x70,0x00,0xB9,0x00,0x00,0x80,0x00,0x00,0x00, +0x19,0x54,0x23,0xFC,0x08,0x00,0x00,0x00,0xFF,0xFC,0x15,0x4C,0x4E,0x73,0x4E,0x73, +0x2F,0x00,0x2F,0x01,0x2F,0x02,0x2F,0x08,0x2F,0x09,0x42,0x80,0x20,0x7C,0xFF,0xFB, +0x00,0x00,0x32,0x10,0x02,0x81,0x00,0x00,0x00,0xE7,0x0C,0x41,0x00,0x42,0x66,0x00, +0x00,0x0A,0x32,0x3C,0x0E,0x08,0x60,0x00,0x00,0x3E,0x0C,0x41,0x00,0x63,0x66,0x00, +0x00,0x0A,0x32,0x3C,0x04,0x08,0x60,0x00,0x00,0x2E,0x0C,0x41,0x00,0x84,0x66,0x00, +0x00,0x0A,0x32,0x3C,0x02,0x08,0x60,0x00,0x00,0x1E,0x0C,0x41,0x00,0xA5,0x66,0x00, +0x00,0x0A,0x32,0x3C,0x0D,0x08,0x60,0x00,0x00,0x0E,0x32,0x3C,0x00,0x08,0x34,0x3C, +0x80,0xE7,0x60,0x00,0x00,0x14,0x34,0x30,0x09,0xB0,0x00,0x00,0x19,0xAA,0x02,0x42, +0x30,0x00,0x82,0x42,0x34,0x3C,0x80,0xFF,0xB2,0x70,0x09,0xB0,0x00,0x00,0x19,0xAC, +0x67,0x00,0x00,0x0C,0x31,0x81,0x09,0xB0,0x00,0x00,0x19,0xAC,0x30,0x81,0x32,0x39, +0xFF,0xFC,0x15,0x66,0xC2,0x70,0x09,0xB0,0x00,0x00,0x19,0x02,0x67,0x00,0x00,0x0C, +0x32,0x10,0x02,0x41,0xFF,0xF7,0x60,0x00,0x00,0x08,0x32,0x10,0x00,0x41,0x00,0x08, +0xC2,0x42,0x22,0x70,0x09,0xB0,0x00,0x00,0x10,0x04,0xB2,0xA9,0x00,0x04,0x67,0x00, +0x00,0x12,0x23,0x41,0x00,0x04,0x23,0xF0,0x09,0xB0,0x00,0x00,0x18,0xB2,0xFF,0xF9, +0x00,0xE4,0x54,0x88,0x58,0x80,0x0C,0x80,0x00,0x00,0x00,0x10,0x66,0x00,0xFF,0x34, +0x22,0x5F,0x20,0x5F,0x24,0x1F,0x22,0x1F,0x20,0x1F,0x4E,0x75,0x61,0x00,0xFF,0x12, +0x4E,0x73,0xFF,0xFC,0x16,0x00,0xFF,0xFC,0x16,0x20,0xFF,0xFC,0x16,0x40,0xFF,0xFC, +0x16,0x60,0xFF,0xFC,0x0C,0x00,0xFF,0xFC,0x0D,0x00,0xFF,0xFC,0x0E,0x00,0xFF,0xFC, +0x0F,0x00,0xFF,0xFC,0x00,0x00,0xFF,0xFC,0x01,0x40,0xFF,0xFC,0x02,0x80,0xFF,0xFC, +0x03,0xC0,0xFF,0xFC,0x00,0x50,0xFF,0xFC,0x01,0x90,0xFF,0xFC,0x02,0xD0,0xFF,0xFC, +0x04,0x10,0x00,0x00,0x40,0x00,0x00,0x01,0x2F,0x60,0x00,0x02,0x1E,0xC0,0x00,0x03, +0x0E,0x20,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x04,0x00,0x00, +0x00,0x08,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x80,0x00,0x00, +0x01,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x11,0x00,0x00,0x00,0x12,0x00,0x00, +0x00,0x13,0x00,0x00,0x00,0x2C,0x00,0x00,0x3E,0x00,0x00,0x2C,0x00,0x00,0x3E,0x00, +0x00,0x00,0x00,0x00,0x00,0x2D,0x00,0x00,0x3F,0x00,0x00,0x2D,0x00,0x00,0x3F,0x00, +0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00, +0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x80,0x00,0x00,0x02,0x00,0x00,0x00,0x08,0x00, +0x77,0x61,0x6E,0x58,0x4C,0x20,0x66,0x69,0x72,0x6D,0x77,0x61,0x72,0x65,0x0A,0x43, +0x6F,0x70,0x79,0x72,0x69,0x67,0x68,0x74,0x20,0x28,0x43,0x29,0x20,0x32,0x30,0x30, +0x33,0x20,0x4B,0x72,0x7A,0x79,0x73,0x7A,0x74,0x6F,0x66,0x20,0x48,0x61,0x6C,0x61, +0x73,0x61,0x20,0x3C,0x6B,0x68,0x63,0x40,0x70,0x6D,0x2E,0x77,0x61,0x77,0x2E,0x70, +0x6C,0x3E,0x0A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 +}; diff -urN linux-2.6.7-rc2/drivers/net/wireless/airo.c linux-2.6.7-rc3/drivers/net/wireless/airo.c --- linux-2.6.7-rc2/drivers/net/wireless/airo.c 2004-06-07 12:54:49.257052926 -0700 +++ linux-2.6.7-rc3/drivers/net/wireless/airo.c 2004-06-07 12:55:07.508808856 -0700 @@ -897,7 +897,7 @@ unsigned short command; // What to do unsigned short len; // Len of data unsigned short ridnum; // rid number - unsigned char *data; // d-data + unsigned char __user *data; // d-data } aironet_ioctl; static char *swversion = "2.1"; @@ -4272,12 +4272,12 @@ */ static ssize_t proc_read( struct file *file, - char *buffer, + char __user *buffer, size_t len, loff_t *offset); static ssize_t proc_write( struct file *file, - const char *buffer, + const char __user *buffer, size_t len, loff_t *offset ); static int proc_close( struct inode *inode, struct file *file ); @@ -4482,23 +4482,26 @@ * to supply the data. */ static ssize_t proc_read( struct file *file, - char *buffer, + char __user *buffer, size_t len, loff_t *offset ) { - int i; - int pos; + loff_t pos = *offset; struct proc_data *priv = (struct proc_data*)file->private_data; - if( !priv->rbuffer ) return -EINVAL; + if (!priv->rbuffer) + return -EINVAL; - pos = *offset; - for( i = 0; i+pos < priv->readlen && i < len; i++ ) { - if (put_user( priv->rbuffer[i+pos], buffer+i )) - return -EFAULT; - } - *offset += i; - return i; + if (pos < 0) + return -EINVAL; + if (pos >= priv->readlen) + return 0; + if (len > priv->readlen - pos) + len = priv->readlen - pos; + if (copy_to_user(buffer, priv->rbuffer + pos, len)) + return -EFAULT; + *offset = pos + len; + return len; } /* @@ -4506,28 +4509,26 @@ * to supply the data. */ static ssize_t proc_write( struct file *file, - const char *buffer, + const char __user *buffer, size_t len, loff_t *offset ) { - int i; - int pos; + loff_t pos = *offset; struct proc_data *priv = (struct proc_data*)file->private_data; - if ( !priv->wbuffer ) { + if (!priv->wbuffer) return -EINVAL; - } - - pos = *offset; - for( i = 0; i + pos < priv->maxwritelen && - i < len; i++ ) { - if (get_user( priv->wbuffer[i+pos], buffer + i )) - return -EFAULT; - } - if ( i+pos > priv->writelen ) priv->writelen = i+file->f_pos; - *offset += i; - return i; + if (pos < 0) + return -EINVAL; + if (pos >= priv->maxwritelen) + return 0; + if (len > priv->maxwritelen - pos) + len = priv->maxwritelen - pos; + if (copy_from_user(priv->wbuffer + pos, buffer, len)) + return -EFAULT; + *offset = pos + len; + return len; } static int proc_status_open( struct inode *inode, struct file *file ) { diff -urN linux-2.6.7-rc2/drivers/net/wireless/prism54/isl_38xx.c linux-2.6.7-rc3/drivers/net/wireless/prism54/isl_38xx.c --- linux-2.6.7-rc2/drivers/net/wireless/prism54/isl_38xx.c 2004-05-09 19:32:36.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/wireless/prism54/isl_38xx.c 2004-06-07 12:55:07.511808980 -0700 @@ -1,4 +1,4 @@ -/* $Header: /var/lib/cvs/prism54-ng/ksrc/isl_38xx.c,v 1.22 2004/02/28 03:06:07 mcgrof Exp $ +/* * * Copyright (C) 2002 Intersil Americas Inc. * Copyright (C) 2003-2004 Luis R. Rodriguez _ diff -urN linux-2.6.7-rc2/drivers/net/wireless/prism54/isl_38xx.h linux-2.6.7-rc3/drivers/net/wireless/prism54/isl_38xx.h --- linux-2.6.7-rc2/drivers/net/wireless/prism54/isl_38xx.h 2004-05-09 19:33:22.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/wireless/prism54/isl_38xx.h 2004-06-07 12:55:07.511808980 -0700 @@ -1,4 +1,4 @@ -/* $Header: /var/lib/cvs/prism54-ng/ksrc/isl_38xx.h,v 1.22 2004/02/28 03:06:07 mcgrof Exp $ +/* * * Copyright (C) 2002 Intersil Americas Inc. * diff -urN linux-2.6.7-rc2/drivers/net/wireless/prism54/isl_ioctl.c linux-2.6.7-rc3/drivers/net/wireless/prism54/isl_ioctl.c --- linux-2.6.7-rc2/drivers/net/wireless/prism54/isl_ioctl.c 2004-05-09 19:32:27.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/wireless/prism54/isl_ioctl.c 2004-06-07 12:55:07.514809104 -0700 @@ -1,7 +1,7 @@ -/* $Header: /var/lib/cvs/prism54-ng/ksrc/isl_ioctl.c,v 1.140 2004/02/28 03:06:07 mcgrof Exp $ +/* * * Copyright (C) 2002 Intersil Americas Inc. - * (C) 2003 Aurelien Alleaume + * (C) 2003,2004 Aurelien Alleaume * (C) 2003 Herbert Valerio Riedel * (C) 2003 Luis R. Rodriguez * @@ -87,9 +87,9 @@ /* For now, just catch early the Repeater and Secondary modes here */ if (iw_mode == IW_MODE_REPEAT || iw_mode == IW_MODE_SECOND) { - printk(KERN_DEBUG "%s(): Sorry, Repeater mode and Secondary mode " - "are not yet supported by this driver.\n", - __FUNCTION__); + printk(KERN_DEBUG + "%s(): Sorry, Repeater mode and Secondary mode " + "are not yet supported by this driver.\n", __FUNCTION__); return -EINVAL; } @@ -143,8 +143,8 @@ { u32 t; struct obj_buffer psm_buffer = { - .size = cpu_to_le32(PSM_BUFFER_SIZE), - .addr = cpu_to_le32(priv->device_psm_buffer) + .size = PSM_BUFFER_SIZE, + .addr = priv->device_psm_buffer }; mgt_set(priv, DOT11_OID_CHANNEL, &init_channel); @@ -285,7 +285,7 @@ /* Commit in Monitor mode is not necessary, also setting essid * in Monitor mode does not make sense and isn't allowed for this * device's firmware */ - if(priv->iw_mode != IW_MODE_MONITOR) + if (priv->iw_mode != IW_MODE_MONITOR) return mgt_set_request(priv, DOT11_OID_SSID, 0, NULL); return 0; } @@ -327,34 +327,15 @@ { islpci_private *priv = netdev_priv(ndev); int rvalue; - u32 c = 0; + u32 c; - /* prepare the structure for the set object */ if (fwrq->m < 1000) - /* structure value contains a channel indication */ + /* we have a channel number */ c = fwrq->m; - else { - /* structure contains a frequency indication and fwrq->e = 1 */ - int f = fwrq->m / 100000; - - if (fwrq->e != 1) - return -EINVAL; - if ((f >= 2412) && (f <= 2484)) { - while ((c < 14) && (f != frequency_list_bg[c])) - c++; - if (c >= 14) - return -EINVAL; - } else if ((f >= (int) 5170) && (f <= (int) 5320)) { - while ((c < 12) && (f != frequency_list_a[c])) - c++; - if (c >= 12) - return -EINVAL; - } else - return -EINVAL; - c++; - } + else + c = (fwrq->e == 1) ? channel_of_freq(fwrq->m / 100000) : 0; - rvalue = mgt_set_request(priv, DOT11_OID_CHANNEL, 0, &c); + rvalue = c ? mgt_set_request(priv, DOT11_OID_CHANNEL, 0, &c) : -EINVAL; /* Call commit handler */ return (rvalue ? rvalue : -EINPROGRESS); @@ -410,7 +391,7 @@ mgt_commit(priv); priv->ndev->type = (priv->iw_mode == IW_MODE_MONITOR) - ? ARPHRD_IEEE80211 : ARPHRD_ETHER; + ? priv->monitor_type : ARPHRD_ETHER; up_write(&priv->mib_sem); return 0; @@ -531,20 +512,20 @@ mgt_get_request(priv, DOT11_OID_SUPPORTEDFREQUENCIES, 0, NULL, &r); freq = r.ptr; - range->num_channels = le16_to_cpu(freq->nr); - range->num_frequency = le16_to_cpu(freq->nr); + range->num_channels = freq->nr; + range->num_frequency = freq->nr; /* Frequencies are not listed in the right order. The reordering is probably * firmware dependant and thus should work for everyone. */ - m = min(IW_MAX_FREQUENCIES, (int) le16_to_cpu(freq->nr)); + m = min(IW_MAX_FREQUENCIES, (int) freq->nr); for (i = 0; i < m - 12; i++) { - range->freq[i].m = le16_to_cpu(freq->mhz[12 + i]); + range->freq[i].m = freq->mhz[12 + i]; range->freq[i].e = 6; range->freq[i].i = i + 1; } for (i = m - 12; i < m; i++) { - range->freq[i].m = le16_to_cpu(freq->mhz[i - m + 12]); + range->freq[i].m = freq->mhz[i - m + 12]; range->freq[i].e = 6; range->freq[i].i = i + 23; } @@ -655,7 +636,7 @@ #define CAP_CRYPT 0x10 /* Mode */ - cap = le16_to_cpu(bss->capinfo); + cap = bss->capinfo; iwe.u.mode = 0; if (cap & CAP_ESS) iwe.u.mode = IW_MODE_MASTER; @@ -747,7 +728,7 @@ bsslist = r.ptr; /* ok now, scan the list and translate its info */ - for (i = 0; i < min(IW_MAX_AP, (int) le32_to_cpu(bsslist->nr)); i++) + for (i = 0; i < min(IW_MAX_AP, (int) bsslist->nr); i++) current_ev = prism54_translate_bss(ndev, current_ev, extra + IW_SCAN_MAX_DATA, &(bsslist->bsslist[i]), @@ -869,25 +850,26 @@ return mgt_set_request(priv, DOT11_OID_PROFILES, 0, &profile); } - if((ret = mgt_get_request(priv, DOT11_OID_SUPPORTEDRATES, 0, NULL, &r))) + if ((ret = + mgt_get_request(priv, DOT11_OID_SUPPORTEDRATES, 0, NULL, &r))) return ret; rate = (u32) (vwrq->value / 500000); data = r.ptr; i = 0; - while(data[i]) { - if(rate && (data[i] == rate)) { + while (data[i]) { + if (rate && (data[i] == rate)) { break; } - if(vwrq->value == i) { + if (vwrq->value == i) { break; } data[i] |= 0x80; i++; } - if(!data[i]) { + if (!data[i]) { return -EINVAL; } @@ -931,12 +913,12 @@ union oid_res_t r; /* Get the current bit rate */ - if((rvalue = mgt_get_request(priv, GEN_OID_LINKSTATE, 0, NULL, &r))) + if ((rvalue = mgt_get_request(priv, GEN_OID_LINKSTATE, 0, NULL, &r))) return rvalue; vwrq->value = r.u * 500000; /* request the device for the enabled rates */ - if((rvalue = mgt_get_request(priv, DOT11_OID_RATES, 0, NULL, &r))) + if ((rvalue = mgt_get_request(priv, DOT11_OID_RATES, 0, NULL, &r))) return rvalue; data = r.ptr; vwrq->fixed = (data[0] != 0) && (data[1] == 0); @@ -1225,7 +1207,7 @@ rvalue = mgt_get_request(priv, OID_INL_OUTPUTPOWER, 0, NULL, &r); /* intersil firmware operates in 0.25 dBm (1/4 dBm) */ - vwrq->value = (s32)r.u / 4; + vwrq->value = (s32) r.u / 4; vwrq->fixed = 1; /* radio is not turned of * btw: how is possible to turn off only the radio @@ -1271,28 +1253,41 @@ } static int -prism54_set_beacon(struct net_device *ndev, struct iw_request_info *info, - __u32 * uwrq, char *extra) +prism54_get_oid(struct net_device *ndev, struct iw_request_info *info, + struct iw_point *dwrq, char *extra) { - int rvalue = mgt_set_request((islpci_private *) netdev_priv(ndev), - DOT11_OID_BEACONPERIOD, 0, uwrq); + union oid_res_t r; + int rvalue; + enum oid_num_t n = dwrq->flags; - return (rvalue ? rvalue : -EINPROGRESS); + rvalue = mgt_get_request((islpci_private *) ndev->priv, n, 0, NULL, &r); + dwrq->length = mgt_response_to_str(n, &r, extra); + if ((isl_oid[n].flags & OID_FLAG_TYPE) != OID_TYPE_U32) + kfree(r.ptr); + return rvalue; } static int -prism54_get_beacon(struct net_device *ndev, struct iw_request_info *info, +prism54_set_u32(struct net_device *ndev, struct iw_request_info *info, __u32 * uwrq, char *extra) { - union oid_res_t r; - int rvalue; + /* + u32 *i = (int *) extra; + int param = *i; + int u = *(i + 1); + */ + u32 oid = uwrq[0], u = uwrq[1]; - rvalue = - mgt_get_request((islpci_private *) netdev_priv(ndev), - DOT11_OID_BEACONPERIOD, 0, NULL, &r); - *uwrq = r.u; + return mgt_set_request((islpci_private *) ndev->priv, oid, 0, &u); +} - return rvalue; +static int +prism54_set_raw(struct net_device *ndev, struct iw_request_info *info, + struct iw_point *dwrq, char *extra) +{ + u32 oid = dwrq->flags; + + return mgt_set_request((islpci_private *) ndev->priv, oid, 0, extra); } void @@ -1511,8 +1506,9 @@ return -ENOMEM; /* Tell the card to kick every client */ - mlme->id = cpu_to_le16(0); - rvalue = mgt_set_request(netdev_priv(ndev), DOT11_OID_DISASSOCIATE, 0, mlme); + mlme->id = 0; + rvalue = + mgt_set_request(netdev_priv(ndev), DOT11_OID_DISASSOCIATE, 0, mlme); kfree(mlme); return rvalue; @@ -1535,8 +1531,9 @@ /* Tell the card to only kick the corresponding bastard */ memcpy(mlme->address, addr->sa_data, ETH_ALEN); - mlme->id = cpu_to_le16(-1); - rvalue = mgt_set_request(netdev_priv(ndev), DOT11_OID_DISASSOCIATE, 0, mlme); + mlme->id = -1; + rvalue = + mgt_set_request(netdev_priv(ndev), DOT11_OID_DISASSOCIATE, 0, mlme); kfree(mlme); @@ -1551,12 +1548,12 @@ { const u8 *a = mlme->address; int n = snprintf(dest, IW_CUSTOM_MAX, - "%s %s %2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X %s", + "%s %s %2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X %s (%2.2X)", str, - ((priv->iw_mode == IW_MODE_MASTER) ? "to" : "from"), + ((priv->iw_mode == IW_MODE_MASTER) ? "from" : "to"), a[0], a[1], a[2], a[3], a[4], a[5], (error ? (mlme->code ? " : REJECTED " : " : ACCEPTED ") - : "")); + : ""), mlme->code); BUG_ON(n > IW_CUSTOM_MAX); *length = n; } @@ -1598,14 +1595,15 @@ { islpci_private *priv = netdev_priv(ndev); - if (le32_to_cpu(bitrate)) { + if (bitrate) { if (priv->iw_mode == IW_MODE_INFRA) { union iwreq_data uwrq; prism54_get_wap(ndev, NULL, (struct sockaddr *) &uwrq, NULL); wireless_send_event(ndev, SIOCGIWAP, &uwrq, NULL); } else - send_simple_event(netdev_priv(ndev), "Link established"); + send_simple_event(netdev_priv(ndev), + "Link established"); } else send_simple_event(netdev_priv(ndev), "Link lost"); } @@ -1765,15 +1763,14 @@ static void handle_request(islpci_private *priv, struct obj_mlme *mlme, enum oid_num_t oid) { - if (((le16_to_cpu(mlme->state) == DOT11_STATE_AUTHING) || - (le16_to_cpu(mlme->state) == DOT11_STATE_ASSOCING)) + if (((mlme->state == DOT11_STATE_AUTHING) || + (mlme->state == DOT11_STATE_ASSOCING)) && mgt_mlme_answer(priv)) { /* Someone is requesting auth and we must respond. Just send back * the trap with error code set accordingly. */ - mlme->code = cpu_to_le16(prism54_mac_accept(&priv->acl, - mlme-> - address) ? 0 : 1); + mlme->code = prism54_mac_accept(&priv->acl, + mlme->address) ? 0 : 1; mgt_set_request(priv, oid, 0, mlme); } } @@ -1797,6 +1794,13 @@ * suited. We use the more flexible custom event facility. */ + /* I fear prism54_process_bss_data won't work with big endian data */ + if ((oid == DOT11_OID_BEACON) || (oid == DOT11_OID_PROBE)) + prism54_process_bss_data(priv, oid, mlme->address, + payload, len); + + mgt_le_to_cpu(isl_oid[oid].flags & OID_FLAG_TYPE, (void *) mlme); + switch (oid) { case GEN_OID_LINKSTATE: @@ -1831,8 +1835,6 @@ break; case DOT11_OID_BEACON: - prism54_process_bss_data(priv, oid, mlme->address, - payload, len); send_formatted_event(priv, "Received a beacon from an unkown AP", mlme, 0); @@ -1840,8 +1842,6 @@ case DOT11_OID_PROBE: /* we received a probe from a client. */ - prism54_process_bss_data(priv, oid, mlme->address, - payload, len); send_formatted_event(priv, "Received a probe from client", mlme, 0); break; @@ -1915,13 +1915,6 @@ } int -prism54_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd) -{ - /* should we really support this old stuff ? */ - return -EOPNOTSUPP; -} - -int prism54_set_wpa(struct net_device *ndev, struct iw_request_info *info, __u32 * uwrq, char *extra) { @@ -1951,8 +1944,30 @@ } int +prism54_set_prismhdr(struct net_device *ndev, struct iw_request_info *info, + __u32 * uwrq, char *extra) +{ + islpci_private *priv = netdev_priv(ndev); + priv->monitor_type = + (*uwrq ? ARPHRD_IEEE80211_PRISM : ARPHRD_IEEE80211); + if (priv->iw_mode == IW_MODE_MONITOR) + priv->ndev->type = priv->monitor_type; + + return 0; +} + +int +prism54_get_prismhdr(struct net_device *ndev, struct iw_request_info *info, + __u32 * uwrq, char *extra) +{ + islpci_private *priv = netdev_priv(ndev); + *uwrq = (priv->monitor_type == ARPHRD_IEEE80211_PRISM); + return 0; +} + +int prism54_set_maxframeburst(struct net_device *ndev, struct iw_request_info *info, - __u32 *uwrq, char *extra) + __u32 * uwrq, char *extra) { islpci_private *priv = netdev_priv(ndev); u32 max_burst; @@ -1965,7 +1980,7 @@ int prism54_get_maxframeburst(struct net_device *ndev, struct iw_request_info *info, - __u32 *uwrq, char *extra) + __u32 * uwrq, char *extra) { islpci_private *priv = netdev_priv(ndev); union oid_res_t r; @@ -1979,7 +1994,7 @@ int prism54_set_profile(struct net_device *ndev, struct iw_request_info *info, - __u32 *uwrq, char *extra) + __u32 * uwrq, char *extra) { islpci_private *priv = netdev_priv(ndev); u32 profile; @@ -1992,7 +2007,7 @@ int prism54_get_profile(struct net_device *ndev, struct iw_request_info *info, - __u32 *uwrq, char *extra) + __u32 * uwrq, char *extra) { islpci_private *priv = netdev_priv(ndev); union oid_res_t r; @@ -2005,8 +2020,8 @@ } int -prism54_oid(struct net_device *ndev, struct iw_request_info *info, - __u32 *uwrq, char *extra) +prism54_debug_oid(struct net_device *ndev, struct iw_request_info *info, + __u32 * uwrq, char *extra) { islpci_private *priv = netdev_priv(ndev); @@ -2017,7 +2032,7 @@ } int -prism54_get_oid(struct net_device *ndev, struct iw_request_info *info, +prism54_debug_get_oid(struct net_device *ndev, struct iw_request_info *info, struct iw_point *data, char *extra) { islpci_private *priv = netdev_priv(ndev); @@ -2028,11 +2043,15 @@ data->length = 0; if (islpci_get_state(priv) >= PRV_STATE_INIT) { - ret = islpci_mgt_transaction(priv->ndev, PIMFOR_OP_GET, priv->priv_oid, extra, 256, &response); + ret = + islpci_mgt_transaction(priv->ndev, PIMFOR_OP_GET, + priv->priv_oid, extra, 256, + &response); response_op = response->header->operation; printk("%s: ret: %i\n", ndev->name, ret); printk("%s: response_op: %i\n", ndev->name, response_op); - if (ret || !response || response->header->operation == PIMFOR_OP_ERROR) { + if (ret || !response + || response->header->operation == PIMFOR_OP_ERROR) { if (response) { islpci_mgt_release(response); } @@ -2051,21 +2070,26 @@ } int -prism54_set_oid(struct net_device *ndev, struct iw_request_info *info, +prism54_debug_set_oid(struct net_device *ndev, struct iw_request_info *info, struct iw_point *data, char *extra) { islpci_private *priv = netdev_priv(ndev); struct islpci_mgmtframe *response = NULL; int ret = 0, response_op = PIMFOR_OP_ERROR; - printk("%s: set_oid 0x%08X\tlen: %d\n", ndev->name, priv->priv_oid, data->length); + printk("%s: set_oid 0x%08X\tlen: %d\n", ndev->name, priv->priv_oid, + data->length); if (islpci_get_state(priv) >= PRV_STATE_INIT) { - ret = islpci_mgt_transaction(priv->ndev, PIMFOR_OP_SET, priv->priv_oid, extra, data->length, &response); + ret = + islpci_mgt_transaction(priv->ndev, PIMFOR_OP_SET, + priv->priv_oid, extra, data->length, + &response); printk("%s: ret: %i\n", ndev->name, ret); if (!ret) { response_op = response->header->operation; - printk("%s: response_op: %i\n", ndev->name, response_op); + printk("%s: response_op: %i\n", ndev->name, + response_op); islpci_mgt_release(response); } if (ret || response_op == PIMFOR_OP_ERROR) { @@ -2077,6 +2101,31 @@ return ret; } +static int +prism54_set_spy(struct net_device *ndev, + struct iw_request_info *info, + union iwreq_data *uwrq, char *extra) +{ + islpci_private *priv = netdev_priv(ndev); + u32 u, oid = OID_INL_CONFIG; + + down_write(&priv->mib_sem); + mgt_get(priv, OID_INL_CONFIG, &u); + + if ((uwrq->data.length == 0) && (priv->spy_data.spy_number > 0)) + /* disable spy */ + u &= ~INL_CONFIG_RXANNEX; + else if ((uwrq->data.length > 0) && (priv->spy_data.spy_number == 0)) + /* enable spy */ + u |= INL_CONFIG_RXANNEX; + + mgt_set(priv, OID_INL_CONFIG, &u); + mgt_commit_list(priv, &oid, 1); + up_write(&priv->mib_sem); + + return iw_handler_set_spy(ndev, info, uwrq, extra); +} + static const iw_handler prism54_handler[] = { (iw_handler) prism54_commit, /* SIOCSIWCOMMIT */ (iw_handler) prism54_get_name, /* SIOCGIWNAME */ @@ -2094,7 +2143,7 @@ (iw_handler) NULL, /* SIOCGIWPRIV */ (iw_handler) NULL, /* SIOCSIWSTATS */ (iw_handler) NULL, /* SIOCGIWSTATS */ - iw_handler_set_spy, /* SIOCSIWSPY */ + prism54_set_spy, /* SIOCSIWSPY */ iw_handler_get_spy, /* SIOCGIWSPY */ iw_handler_set_thrspy, /* SIOCSIWTHRSPY */ iw_handler_get_thrspy, /* SIOCGIWTHRSPY */ @@ -2129,33 +2178,50 @@ /* The low order bit identify a SET (0) or a GET (1) ioctl. */ #define PRISM54_RESET SIOCIWFIRSTPRIV -#define PRISM54_GET_BEACON SIOCIWFIRSTPRIV+1 -#define PRISM54_SET_BEACON SIOCIWFIRSTPRIV+2 -#define PRISM54_GET_POLICY SIOCIWFIRSTPRIV+3 -#define PRISM54_SET_POLICY SIOCIWFIRSTPRIV+4 -#define PRISM54_GET_MAC SIOCIWFIRSTPRIV+5 -#define PRISM54_ADD_MAC SIOCIWFIRSTPRIV+6 +#define PRISM54_GET_POLICY SIOCIWFIRSTPRIV+1 +#define PRISM54_SET_POLICY SIOCIWFIRSTPRIV+2 +#define PRISM54_GET_MAC SIOCIWFIRSTPRIV+3 +#define PRISM54_ADD_MAC SIOCIWFIRSTPRIV+4 -#define PRISM54_DEL_MAC SIOCIWFIRSTPRIV+8 +#define PRISM54_DEL_MAC SIOCIWFIRSTPRIV+6 -#define PRISM54_KICK_MAC SIOCIWFIRSTPRIV+10 +#define PRISM54_KICK_MAC SIOCIWFIRSTPRIV+8 -#define PRISM54_KICK_ALL SIOCIWFIRSTPRIV+12 +#define PRISM54_KICK_ALL SIOCIWFIRSTPRIV+10 -#define PRISM54_GET_WPA SIOCIWFIRSTPRIV+13 -#define PRISM54_SET_WPA SIOCIWFIRSTPRIV+14 +#define PRISM54_GET_WPA SIOCIWFIRSTPRIV+11 +#define PRISM54_SET_WPA SIOCIWFIRSTPRIV+12 + +#define PRISM54_DBG_OID SIOCIWFIRSTPRIV+14 +#define PRISM54_DBG_GET_OID SIOCIWFIRSTPRIV+15 +#define PRISM54_DBG_SET_OID SIOCIWFIRSTPRIV+16 -#define PRISM54_OID SIOCIWFIRSTPRIV+16 #define PRISM54_GET_OID SIOCIWFIRSTPRIV+17 -#define PRISM54_SET_OID SIOCIWFIRSTPRIV+18 +#define PRISM54_SET_OID_U32 SIOCIWFIRSTPRIV+18 +#define PRISM54_SET_OID_STR SIOCIWFIRSTPRIV+20 +#define PRISM54_SET_OID_ADDR SIOCIWFIRSTPRIV+22 + +#define PRISM54_GET_PRISMHDR SIOCIWFIRSTPRIV+23 +#define PRISM54_SET_PRISMHDR SIOCIWFIRSTPRIV+24 + +#define IWPRIV_SET_U32(n,x) { n, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_"x } +#define IWPRIV_SET_SSID(n,x) { n, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 1, 0, "set_"x } +#define IWPRIV_SET_ADDR(n,x) { n, IW_PRIV_TYPE_ADDR | IW_PRIV_SIZE_FIXED | 1, 0, "set_"x } +#define IWPRIV_GET(n,x) { n, 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | PRIV_STR_SIZE, "get_"x } + +#define IWPRIV_U32(n,x) IWPRIV_SET_U32(n,x), IWPRIV_GET(n,x) +#define IWPRIV_SSID(n,x) IWPRIV_SET_SSID(n,x), IWPRIV_GET(n,x) +#define IWPRIV_ADDR(n,x) IWPRIV_SET_ADDR(n,x), IWPRIV_GET(n,x) + +/* Note : limited to 128 private ioctls */ static const struct iw_priv_args prism54_private_args[] = { /*{ cmd, set_args, get_args, name } */ {PRISM54_RESET, 0, 0, "reset"}, - {PRISM54_GET_BEACON, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, - "getBeaconPeriod"}, - {PRISM54_SET_BEACON, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, - "setBeaconPeriod"}, + {PRISM54_GET_PRISMHDR, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, + "get_prismhdr"}, + {PRISM54_SET_PRISMHDR, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, + "set_prismhdr"}, {PRISM54_GET_POLICY, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "getPolicy"}, {PRISM54_SET_POLICY, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, @@ -2172,15 +2238,77 @@ "get_wpa"}, {PRISM54_SET_WPA, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_wpa"}, - {PRISM54_OID, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "oid"}, - {PRISM54_GET_OID, 0, IW_PRIV_TYPE_BYTE | 256, "get_oid"}, - {PRISM54_SET_OID, IW_PRIV_TYPE_BYTE | 256, 0, "set_oid"}, + {PRISM54_DBG_OID, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, + "dbg_oid"}, + {PRISM54_DBG_GET_OID, 0, IW_PRIV_TYPE_BYTE | 256, "dbg_get_oid"}, + {PRISM54_DBG_SET_OID, IW_PRIV_TYPE_BYTE | 256, 0, "dbg_get_oid"}, + /* --- sub-ioctls handlers --- */ + {PRISM54_GET_OID, + 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | PRIV_STR_SIZE, ""}, + {PRISM54_SET_OID_U32, + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, ""}, + {PRISM54_SET_OID_STR, + IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 1, 0, ""}, + {PRISM54_SET_OID_ADDR, + IW_PRIV_TYPE_ADDR | IW_PRIV_SIZE_FIXED | 1, 0, ""}, + /* --- sub-ioctls definitions --- */ + IWPRIV_ADDR(GEN_OID_MACADDRESS, "addr"), + IWPRIV_GET(GEN_OID_LINKSTATE, "linkstate"), + IWPRIV_U32(DOT11_OID_BSSTYPE, "bsstype"), + IWPRIV_ADDR(DOT11_OID_BSSID, "bssid"), + IWPRIV_U32(DOT11_OID_STATE, "state"), + IWPRIV_U32(DOT11_OID_AID, "aid"), + + IWPRIV_SSID(DOT11_OID_SSIDOVERRIDE, "ssidoverride"), + + IWPRIV_U32(DOT11_OID_MEDIUMLIMIT, "medlimit"), + IWPRIV_U32(DOT11_OID_BEACONPERIOD, "beacon"), + IWPRIV_U32(DOT11_OID_DTIMPERIOD, "dtimperiod"), + + IWPRIV_U32(DOT11_OID_AUTHENABLE, "authenable"), + IWPRIV_U32(DOT11_OID_PRIVACYINVOKED, "privinvok"), + IWPRIV_U32(DOT11_OID_EXUNENCRYPTED, "exunencrypt"), + + IWPRIV_U32(DOT11_OID_REKEYTHRESHOLD, "rekeythresh"), + + IWPRIV_U32(DOT11_OID_MAXTXLIFETIME, "maxtxlife"), + IWPRIV_U32(DOT11_OID_MAXRXLIFETIME, "maxrxlife"), + IWPRIV_U32(DOT11_OID_ALOFT_FIXEDRATE, "fixedrate"), + IWPRIV_U32(DOT11_OID_MAXFRAMEBURST, "frameburst"), + IWPRIV_U32(DOT11_OID_PSM, "psm"), + + IWPRIV_U32(DOT11_OID_BRIDGELOCAL, "bridge"), + IWPRIV_U32(DOT11_OID_CLIENTS, "clients"), + IWPRIV_U32(DOT11_OID_CLIENTSASSOCIATED, "clientassoc"), + IWPRIV_U32(DOT11_OID_DOT1XENABLE, "dot1xenable"), + IWPRIV_U32(DOT11_OID_ANTENNARX, "rxant"), + IWPRIV_U32(DOT11_OID_ANTENNATX, "txant"), + IWPRIV_U32(DOT11_OID_ANTENNADIVERSITY, "antdivers"), + IWPRIV_U32(DOT11_OID_EDTHRESHOLD, "edthresh"), + IWPRIV_U32(DOT11_OID_PREAMBLESETTINGS, "preamble"), + IWPRIV_GET(DOT11_OID_RATES, "rates"), + IWPRIV_U32(DOT11_OID_OUTPUTPOWER, ".11outpower"), + IWPRIV_GET(DOT11_OID_SUPPORTEDRATES, "supprates"), + IWPRIV_GET(DOT11_OID_SUPPORTEDFREQUENCIES, "suppfreq"), + + IWPRIV_U32(DOT11_OID_NOISEFLOOR, "noisefloor"), + IWPRIV_GET(DOT11_OID_FREQUENCYACTIVITY, "freqactivity"), + IWPRIV_U32(DOT11_OID_NONERPPROTECTION, "nonerpprotec"), + IWPRIV_U32(DOT11_OID_PROFILES, "profile"), + IWPRIV_GET(DOT11_OID_EXTENDEDRATES, "extrates"), + IWPRIV_U32(DOT11_OID_MLMEAUTOLEVEL, "mlmelevel"), + + IWPRIV_GET(DOT11_OID_BSSS, "bsss"), + IWPRIV_GET(DOT11_OID_BSSLIST, "bsslist"), + IWPRIV_U32(OID_INL_MODE, "mode"), + IWPRIV_U32(OID_INL_CONFIG, "config"), + IWPRIV_U32(OID_INL_DOT11D_CONFORMANCE, ".11dconform"), + IWPRIV_GET(OID_INL_PHYCAPABILITIES, "phycapa"), + IWPRIV_U32(OID_INL_OUTPUTPOWER, "outpower"), }; static const iw_handler prism54_private_handler[] = { (iw_handler) prism54_reset, - (iw_handler) prism54_get_beacon, - (iw_handler) prism54_set_beacon, (iw_handler) prism54_get_policy, (iw_handler) prism54_set_policy, (iw_handler) prism54_get_mac, @@ -2194,9 +2322,17 @@ (iw_handler) prism54_get_wpa, (iw_handler) prism54_set_wpa, (iw_handler) NULL, - (iw_handler) prism54_oid, + (iw_handler) prism54_debug_oid, + (iw_handler) prism54_debug_get_oid, + (iw_handler) prism54_debug_set_oid, (iw_handler) prism54_get_oid, - (iw_handler) prism54_set_oid, + (iw_handler) prism54_set_u32, + (iw_handler) NULL, + (iw_handler) prism54_set_raw, + (iw_handler) NULL, + (iw_handler) prism54_set_raw, + (iw_handler) prism54_get_prismhdr, + (iw_handler) prism54_set_prismhdr, }; const struct iw_handler_def prism54_handler_def = { @@ -2207,5 +2343,13 @@ .standard = (iw_handler *) prism54_handler, .private = (iw_handler *) prism54_private_handler, .private_args = (struct iw_priv_args *) prism54_private_args, + .spy_offset = offsetof(islpci_private, spy_data), }; +/* For ioctls that don't work with the new API */ + +int +prism54_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd) +{ + return -EOPNOTSUPP; +} diff -urN linux-2.6.7-rc2/drivers/net/wireless/prism54/isl_ioctl.h linux-2.6.7-rc3/drivers/net/wireless/prism54/isl_ioctl.h --- linux-2.6.7-rc2/drivers/net/wireless/prism54/isl_ioctl.h 2004-05-09 19:32:37.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/wireless/prism54/isl_ioctl.h 2004-06-07 12:55:07.514809104 -0700 @@ -1,4 +1,4 @@ -/* $Header: /var/lib/cvs/prism54-ng/ksrc/isl_ioctl.h,v 1.30 2004/01/30 16:24:00 ajfa Exp $ +/* * * Copyright (C) 2002 Intersil Americas Inc. * (C) 2003 Aurelien Alleaume diff -urN linux-2.6.7-rc2/drivers/net/wireless/prism54/isl_oid.h linux-2.6.7-rc3/drivers/net/wireless/prism54/isl_oid.h --- linux-2.6.7-rc2/drivers/net/wireless/prism54/isl_oid.h 2004-05-09 19:32:39.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/wireless/prism54/isl_oid.h 2004-06-07 12:55:07.514809104 -0700 @@ -1,8 +1,9 @@ /* - * $Id: isl_oid.h,v 1.3 2004/03/09 09:05:27 mcgrof Exp $ + * * * Copyright (C) 2003 Herbert Valerio Riedel * Copyright (C) 2004 Luis R. Rodriguez + * Copyright (C) 2004 Aurelien Alleaume * * 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 @@ -457,16 +458,29 @@ OID_NUM_LAST }; -/* We could add more flags. eg: in which mode are they allowed, ro, rw, ...*/ -#define OID_FLAG_CACHED 0x01 -#define OID_FLAG_U32 0x02 -#define OID_FLAG_MLMEEX 0x04 /* this type is special because of a variable - size field when sending. Not yet implemented (not used in driver). */ +#define OID_FLAG_CACHED 0x80 +#define OID_FLAG_TYPE 0x7f + +#define OID_TYPE_U32 0x01 +#define OID_TYPE_SSID 0x02 +#define OID_TYPE_KEY 0x03 +#define OID_TYPE_BUFFER 0x04 +#define OID_TYPE_BSS 0x05 +#define OID_TYPE_BSSLIST 0x06 +#define OID_TYPE_FREQUENCIES 0x07 +#define OID_TYPE_MLME 0x08 +#define OID_TYPE_MLMEEX 0x09 +#define OID_TYPE_ADDR 0x0A +#define OID_TYPE_RAW 0x0B + +/* OID_TYPE_MLMEEX is special because of a variable size field when sending. + * Not yet implemented (not used in driver anyway). + */ struct oid_t { enum oid_num_t oid; short range; /* to define a range of oid */ - short size; /* size of the associated data */ + short size; /* max size of the associated data */ char flags; }; @@ -478,6 +492,7 @@ #define IWMAX_BITRATES 20 #define IWMAX_BSS 24 #define IWMAX_FREQ 30 +#define PRIV_STR_SIZE 1024 #endif /* !defined(_ISL_OID_H) */ /* EOF */ diff -urN linux-2.6.7-rc2/drivers/net/wireless/prism54/islpci_dev.c linux-2.6.7-rc3/drivers/net/wireless/prism54/islpci_dev.c --- linux-2.6.7-rc2/drivers/net/wireless/prism54/islpci_dev.c 2004-05-09 19:31:58.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/wireless/prism54/islpci_dev.c 2004-06-07 12:55:07.515809146 -0700 @@ -1,4 +1,4 @@ -/* $Header: /var/lib/cvs/prism54-ng/ksrc/islpci_dev.c,v 1.68 2004/02/28 03:06:07 mcgrof Exp $ +/* * * Copyright (C) 2002 Intersil Americas Inc. * Copyright (C) 2003 Herbert Valerio Riedel @@ -715,9 +715,9 @@ priv = netdev_priv(ndev); priv->ndev = ndev; priv->pdev = pdev; - + priv->monitor_type = ARPHRD_IEEE80211; priv->ndev->type = (priv->iw_mode == IW_MODE_MONITOR) ? - ARPHRD_IEEE80211: ARPHRD_ETHER; + priv->monitor_type : ARPHRD_ETHER; /* save the start and end address of the PCI memory area */ ndev->mem_start = (unsigned long) priv->device_base; @@ -743,9 +743,11 @@ /* initialize workqueue's */ INIT_WORK(&priv->stats_work, (void (*)(void *)) prism54_update_stats, priv); - priv->stats_timestamp = 0; + INIT_WORK(&priv->reset_task, islpci_do_reset_and_wake, priv); + priv->reset_task_pending = 0; + /* allocate various memory areas */ if (islpci_alloc_memory(priv)) goto do_free_netdev; diff -urN linux-2.6.7-rc2/drivers/net/wireless/prism54/islpci_dev.h linux-2.6.7-rc3/drivers/net/wireless/prism54/islpci_dev.h --- linux-2.6.7-rc2/drivers/net/wireless/prism54/islpci_dev.h 2004-05-09 19:32:28.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/wireless/prism54/islpci_dev.h 2004-06-07 12:55:07.515809146 -0700 @@ -1,8 +1,9 @@ -/* $Header: /var/lib/cvs/prism54-ng/ksrc/islpci_dev.h,v 1.53 2004/02/28 03:06:07 mcgrof Exp $ +/* * * Copyright (C) 2002 Intersil Americas Inc. * Copyright (C) 2003 Herbert Valerio Riedel * Copyright (C) 2003 Luis R. Rodriguez + * Copyright (C) 2003 Aurelien Alleaume * * 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 @@ -25,6 +26,7 @@ #include #include #include +#include #include #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,41) @@ -110,6 +112,10 @@ struct iw_statistics local_iwstatistics; struct iw_statistics iwstatistics; + struct iw_spy_data spy_data; /* iwspy support */ + + int monitor_type; /* ARPHRD_IEEE80211 or ARPHRD_IEEE80211_PRISM */ + struct islpci_acl acl; /* PCI bus allocation & configuration members */ @@ -187,6 +193,9 @@ struct list_head bss_wpa_list; int num_bss_wpa; struct semaphore wpa_sem; + + struct work_struct reset_task; + int reset_task_pending; } islpci_private; static inline islpci_state_t diff -urN linux-2.6.7-rc2/drivers/net/wireless/prism54/islpci_eth.c linux-2.6.7-rc3/drivers/net/wireless/prism54/islpci_eth.c --- linux-2.6.7-rc2/drivers/net/wireless/prism54/islpci_eth.c 2004-05-09 19:32:00.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/wireless/prism54/islpci_eth.c 2004-06-07 12:55:07.516809187 -0700 @@ -1,7 +1,7 @@ -/* $Header: /var/lib/cvs/prism54-ng/ksrc/islpci_eth.c,v 1.27 2004/01/30 16:24:00 ajfa Exp $ +/* * * Copyright (C) 2002 Intersil Americas Inc. - * + * Copyright (C) 2004 Aurelien Alleaume * 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 @@ -24,10 +24,12 @@ #include #include #include +#include #include "isl_38xx.h" #include "islpci_eth.h" #include "islpci_mgt.h" +#include "oid_mgt.h" /****************************************************************************** Network Interface functions @@ -246,6 +248,69 @@ return err; } +static inline int +islpci_monitor_rx(islpci_private *priv, struct sk_buff **skb) +{ + /* The card reports full 802.11 packets but with a 20 bytes + * header and without the FCS. But there a is a bit that + * indicates if the packet is corrupted :-) */ + struct rfmon_header *hdr = (struct rfmon_header *) (*skb)->data; + if (hdr->flags & 0x01) + /* This one is bad. Drop it ! */ + return -1; + if (priv->ndev->type == ARPHRD_IEEE80211_PRISM) { + struct avs_80211_1_header *avs; + /* extract the relevant data from the header */ + u32 clock = hdr->clock; + u8 rate = hdr->rate; + u16 freq = be16_to_cpu(hdr->freq); + u8 rssi = hdr->rssi; + + skb_pull(*skb, sizeof (struct rfmon_header)); + + if (skb_headroom(*skb) < sizeof (struct avs_80211_1_header)) { + struct sk_buff *newskb = skb_copy_expand(*skb, + sizeof (struct + avs_80211_1_header), + 0, GFP_ATOMIC); + if (newskb) { + kfree_skb(*skb); + *skb = newskb; + } else + return -1; + /* This behavior is not very subtile... */ + } + + /* make room for the new header and fill it. */ + avs = + (struct avs_80211_1_header *) skb_push(*skb, + sizeof (struct + avs_80211_1_header)); + + avs->version = htonl(P80211CAPTURE_VERSION); + avs->length = htonl(sizeof (struct avs_80211_1_header)); + avs->mactime = __cpu_to_be64(clock); + avs->hosttime = __cpu_to_be64(jiffies); + avs->phytype = htonl(6); /*OFDM: 6 for (g), 8 for (a) */ + avs->channel = htonl(channel_of_freq(freq)); + avs->datarate = htonl(rate * 5); + avs->antenna = htonl(0); /*unknown */ + avs->priority = htonl(0); /*unknown */ + avs->ssi_type = htonl(2); /*2: dBm, 3: raw RSSI */ + avs->ssi_signal = htonl(rssi); + avs->ssi_noise = htonl(priv->local_iwstatistics.qual.noise); /*better than 'undefined', I assume */ + avs->preamble = htonl(0); /*unknown */ + avs->encoding = htonl(0); /*unknown */ + } else + skb_pull(*skb, sizeof (struct rfmon_header)); + + (*skb)->protocol = htons(ETH_P_802_2); + (*skb)->mac.raw = (*skb)->data; + (*skb)->pkt_type = PACKET_OTHERHOST; + + return 0; +} + int islpci_eth_receive(islpci_private *priv) { @@ -266,7 +331,8 @@ index = priv->free_data_rx % ISL38XX_CB_RX_QSIZE; size = le16_to_cpu(control_block->rx_data_low[index].size); skb = priv->data_low_rx[index]; - offset = ((unsigned long) le32_to_cpu(control_block->rx_data_low[index].address) - + offset = ((unsigned long) + le32_to_cpu(control_block->rx_data_low[index].address) - (unsigned long) skb->data) & 3; #if VERBOSE > SHOW_ERROR_MESSAGES @@ -314,29 +380,32 @@ /* do some additional sk_buff and network layer parameters */ skb->dev = ndev; - /* take care of monitor mode */ - if (priv->iw_mode == IW_MODE_MONITOR) { - /* The card reports full 802.11 packets but with a 20 bytes - * header and without the FCS. But there a is a bit that - * indicates if the packet is corrupted :-) */ - /* int i; */ - if (skb->data[8] & 0x01){ - /* This one is bad. Drop it !*/ - discard = 1; - /* printk("BAD\n");*/ + /* take care of monitor mode and spy monitoring. */ + if (priv->iw_mode == IW_MODE_MONITOR) + discard = islpci_monitor_rx(priv, &skb); + else { + if (skb->data[2 * ETH_ALEN] == 0) { + /* The packet has a rx_annex. Read it for spy monitoring, Then + * remove it, while keeping the 2 leading MAC addr. + */ + struct iw_quality wstats; + struct rx_annex_header *annex = + (struct rx_annex_header *) skb->data; + wstats.level = annex->rfmon.rssi; + /* The noise value can be a bit outdated if nobody's + * reading wireless stats... */ + wstats.noise = priv->local_iwstatistics.qual.noise; + wstats.qual = wstats.level - wstats.noise; + wstats.updated = 0x07; + /* Update spy records */ + wireless_spy_update(ndev, annex->addr2, &wstats); + + memcpy(skb->data + sizeof (struct rfmon_header), + skb->data, 2 * ETH_ALEN); + skb_pull(skb, sizeof (struct rfmon_header)); } - /* - for(i=0;i<50;i++) - printk("%2.2X:",skb->data[i]); - printk("\n"); - */ - skb_pull(skb, 20); - skb->protocol = htons(ETH_P_802_2); - skb->mac.raw = skb->data; - skb->pkt_type = PACKET_OTHERHOST; - } else skb->protocol = eth_type_trans(skb, ndev); - + } skb->ip_summed = CHECKSUM_NONE; priv->statistics.rx_packets++; priv->statistics.rx_bytes += size; @@ -351,8 +420,7 @@ if (discard) { dev_kfree_skb(skb); skb = NULL; - } - else + } else netif_rx(skb); /* increment the read index for the rx data low queue */ @@ -403,7 +471,7 @@ wmb(); /* increment the driver read pointer */ - add_le32p((u32 *) & control_block-> + add_le32p((u32 *) &control_block-> driver_curr_frag[ISL38XX_CB_RX_DATA_LQ], 1); } @@ -414,6 +482,15 @@ } void +islpci_do_reset_and_wake(void *data) +{ + islpci_private *priv = (islpci_private *) data; + islpci_reset(priv, 1); + netif_wake_queue(priv->ndev); + priv->reset_task_pending = 0; +} + +void islpci_eth_tx_timeout(struct net_device *ndev) { islpci_private *priv = netdev_priv(ndev); @@ -422,13 +499,11 @@ /* increment the transmit error counter */ statistics->tx_errors++; -#if 0 - /* don't do this here! we are not allowed to sleep since we are in interrupt context */ - if (islpci_reset(priv)) - printk(KERN_ERR "%s: error on TX timeout card reset!\n", - ndev->name); -#endif + if (!priv->reset_task_pending) { + priv->reset_task_pending = 1; + netif_stop_queue(ndev); + schedule_work(&priv->reset_task); + } - /* netif_wake_queue(ndev); */ return; } diff -urN linux-2.6.7-rc2/drivers/net/wireless/prism54/islpci_eth.h linux-2.6.7-rc3/drivers/net/wireless/prism54/islpci_eth.h --- linux-2.6.7-rc2/drivers/net/wireless/prism54/islpci_eth.h 2004-05-09 19:33:19.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/wireless/prism54/islpci_eth.h 2004-06-07 12:55:07.517809228 -0700 @@ -1,4 +1,4 @@ -/* $Header: /var/lib/cvs/prism54-ng/ksrc/islpci_eth.h,v 1.5 2004/01/12 22:16:32 jmaurer Exp $ +/* * * Copyright (C) 2002 Intersil Americas Inc. * @@ -23,9 +23,51 @@ #include "isl_38xx.h" #include "islpci_dev.h" +struct rfmon_header { + u16 unk0; /* = 0x0000 */ + u16 length; /* = 0x1400 */ + u32 clock; /* 1MHz clock */ + u8 flags; + u8 unk1; + u8 rate; + u8 unk2; + u16 freq; + u16 unk3; + u8 rssi; + u8 padding[3]; +} __attribute__ ((packed)); + +struct rx_annex_header { + u8 addr1[ETH_ALEN]; + u8 addr2[ETH_ALEN]; + struct rfmon_header rfmon; +} __attribute__ ((packed)); + +/* wlan-ng (and hopefully others) AVS header, version one. Fields in + * network byte order. */ +#define P80211CAPTURE_VERSION 0x80211001 + +struct avs_80211_1_header { + uint32_t version; + uint32_t length; + uint64_t mactime; + uint64_t hosttime; + uint32_t phytype; + uint32_t channel; + uint32_t datarate; + uint32_t antenna; + uint32_t priority; + uint32_t ssi_type; + int32_t ssi_signal; + int32_t ssi_noise; + uint32_t preamble; + uint32_t encoding; +}; + void islpci_eth_cleanup_transmit(islpci_private *, isl38xx_control_block *); int islpci_eth_transmit(struct sk_buff *, struct net_device *); int islpci_eth_receive(islpci_private *); void islpci_eth_tx_timeout(struct net_device *); +void islpci_do_reset_and_wake(void *data); #endif /* _ISL_GEN_H */ diff -urN linux-2.6.7-rc2/drivers/net/wireless/prism54/islpci_hotplug.c linux-2.6.7-rc3/drivers/net/wireless/prism54/islpci_hotplug.c --- linux-2.6.7-rc2/drivers/net/wireless/prism54/islpci_hotplug.c 2004-05-09 19:32:29.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/wireless/prism54/islpci_hotplug.c 2004-06-07 12:55:07.517809228 -0700 @@ -1,4 +1,4 @@ -/* $Header: /var/lib/cvs/prism54-ng/ksrc/islpci_hotplug.c,v 1.56 2004/02/26 23:33:02 mcgrof Exp $ +/* * * Copyright (C) 2002 Intersil Americas Inc. * Copyright (C) 2003 Herbert Valerio Riedel diff -urN linux-2.6.7-rc2/drivers/net/wireless/prism54/islpci_mgt.c linux-2.6.7-rc3/drivers/net/wireless/prism54/islpci_mgt.c --- linux-2.6.7-rc2/drivers/net/wireless/prism54/islpci_mgt.c 2004-05-09 19:32:53.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/wireless/prism54/islpci_mgt.c 2004-06-07 12:55:07.517809228 -0700 @@ -1,4 +1,4 @@ -/* $Header: /var/lib/cvs/prism54-ng/ksrc/islpci_mgt.c,v 1.40 2004/02/01 10:57:23 mcgrof Exp $ +/* * * Copyright (C) 2002 Intersil Americas Inc. * Copyright 2004 Jens Maurer diff -urN linux-2.6.7-rc2/drivers/net/wireless/prism54/islpci_mgt.h linux-2.6.7-rc3/drivers/net/wireless/prism54/islpci_mgt.h --- linux-2.6.7-rc2/drivers/net/wireless/prism54/islpci_mgt.h 2004-05-09 19:32:02.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/wireless/prism54/islpci_mgt.h 2004-06-07 12:55:07.518809270 -0700 @@ -1,4 +1,4 @@ -/* $Header: /var/lib/cvs/prism54-ng/ksrc/islpci_mgt.h,v 1.22 2004/01/30 16:24:00 ajfa Exp $ +/* * * Copyright (C) 2002 Intersil Americas Inc. * Copyright (C) 2003 Luis R. Rodriguez diff -urN linux-2.6.7-rc2/drivers/net/wireless/prism54/oid_mgt.c linux-2.6.7-rc3/drivers/net/wireless/prism54/oid_mgt.c --- linux-2.6.7-rc2/drivers/net/wireless/prism54/oid_mgt.c 2004-05-09 19:33:20.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/wireless/prism54/oid_mgt.c 2004-06-07 12:55:07.520809353 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003 Aurelien Alleaume + * Copyright (C) 2003,2004 Aurelien Alleaume * * 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 @@ -31,182 +31,210 @@ 5240, 5260, 5280, 5300, 5320 }; -#define OID_U32(x) {x, 0, sizeof(u32), OID_FLAG_U32} -#define OID_U32_C(x) {x, 0, sizeof(u32), OID_FLAG_U32 | OID_FLAG_CACHED} -#define OID_STRUCT(x,s) {x, 0, sizeof(s), 0} -#define OID_STRUCT_C(x,s) {x, 0, sizeof(s), OID_FLAG_CACHED} -#define OID_STRUCT_MLME(x){x, 0, sizeof(struct obj_mlme), 0} -#define OID_STRUCT_MLMEEX(x){x, 0, sizeof(struct obj_mlmeex), OID_FLAG_MLMEEX} +int +channel_of_freq(int f) +{ + int c = 0; + + if ((f >= 2412) && (f <= 2484)) { + while ((c < 14) && (f != frequency_list_bg[c])) + c++; + if (c >= 14) + return 0; + } else if ((f >= (int) 5170) && (f <= (int) 5320)) { + while ((c < 12) && (f != frequency_list_a[c])) + c++; + if (c >= 12) + return 0; + } else + return 0; + + return ++c; +} + +#define OID_STRUCT(name,oid,s,t) [name] = {oid, 0, sizeof(s), t} +#define OID_STRUCT_C(name,oid,s,t) OID_STRUCT(name,oid,s,t | OID_FLAG_CACHED) +#define OID_U32(name,oid) OID_STRUCT(name,oid,u32,OID_TYPE_U32) +#define OID_U32_C(name,oid) OID_STRUCT_C(name,oid,u32,OID_TYPE_U32) +#define OID_STRUCT_MLME(name,oid) OID_STRUCT(name,oid,struct obj_mlme,OID_TYPE_MLME) +#define OID_STRUCT_MLMEEX(name,oid) OID_STRUCT(name,oid,struct obj_mlmeex,OID_TYPE_MLMEEX) -#define OID_UNKNOWN(x) {x, 0, 0, 0} +#define OID_UNKNOWN(name,oid) OID_STRUCT(name,oid,0,0) struct oid_t isl_oid[] = { - [GEN_OID_MACADDRESS] = OID_STRUCT(0x00000000, u8[6]), - [GEN_OID_LINKSTATE] = OID_U32(0x00000001), - [GEN_OID_WATCHDOG] = OID_UNKNOWN(0x00000002), - [GEN_OID_MIBOP] = OID_UNKNOWN(0x00000003), - [GEN_OID_OPTIONS] = OID_UNKNOWN(0x00000004), - [GEN_OID_LEDCONFIG] = OID_UNKNOWN(0x00000005), + OID_STRUCT(GEN_OID_MACADDRESS, 0x00000000, u8[6], OID_TYPE_ADDR), + OID_U32(GEN_OID_LINKSTATE, 0x00000001), + OID_UNKNOWN(GEN_OID_WATCHDOG, 0x00000002), + OID_UNKNOWN(GEN_OID_MIBOP, 0x00000003), + OID_UNKNOWN(GEN_OID_OPTIONS, 0x00000004), + OID_UNKNOWN(GEN_OID_LEDCONFIG, 0x00000005), /* 802.11 */ - [DOT11_OID_BSSTYPE] = OID_U32_C(0x10000000), - [DOT11_OID_BSSID] = OID_STRUCT_C(0x10000001, u8[6]), - [DOT11_OID_SSID] = OID_STRUCT_C(0x10000002, struct obj_ssid), - [DOT11_OID_STATE] = OID_U32(0x10000003), - [DOT11_OID_AID] = OID_U32(0x10000004), - [DOT11_OID_COUNTRYSTRING] = OID_STRUCT(0x10000005, u8[4]), - [DOT11_OID_SSIDOVERRIDE] = OID_STRUCT_C(0x10000006, struct obj_ssid), - - [DOT11_OID_MEDIUMLIMIT] = OID_U32(0x11000000), - [DOT11_OID_BEACONPERIOD] = OID_U32_C(0x11000001), - [DOT11_OID_DTIMPERIOD] = OID_U32(0x11000002), - [DOT11_OID_ATIMWINDOW] = OID_U32(0x11000003), - [DOT11_OID_LISTENINTERVAL] = OID_U32(0x11000004), - [DOT11_OID_CFPPERIOD] = OID_U32(0x11000005), - [DOT11_OID_CFPDURATION] = OID_U32(0x11000006), - - [DOT11_OID_AUTHENABLE] = OID_U32_C(0x12000000), - [DOT11_OID_PRIVACYINVOKED] = OID_U32_C(0x12000001), - [DOT11_OID_EXUNENCRYPTED] = OID_U32_C(0x12000002), - [DOT11_OID_DEFKEYID] = OID_U32_C(0x12000003), - [DOT11_OID_DEFKEYX] = {0x12000004, 3, sizeof (struct obj_key), OID_FLAG_CACHED}, /* DOT11_OID_DEFKEY1,...DOT11_OID_DEFKEY4 */ - [DOT11_OID_STAKEY] = OID_UNKNOWN(0x12000008), - [DOT11_OID_REKEYTHRESHOLD] = OID_U32(0x12000009), - [DOT11_OID_STASC] = OID_UNKNOWN(0x1200000a), - - [DOT11_OID_PRIVTXREJECTED] = OID_U32(0x1a000000), - [DOT11_OID_PRIVRXPLAIN] = OID_U32(0x1a000001), - [DOT11_OID_PRIVRXFAILED] = OID_U32(0x1a000002), - [DOT11_OID_PRIVRXNOKEY] = OID_U32(0x1a000003), - - [DOT11_OID_RTSTHRESH] = OID_U32_C(0x13000000), - [DOT11_OID_FRAGTHRESH] = OID_U32_C(0x13000001), - [DOT11_OID_SHORTRETRIES] = OID_U32_C(0x13000002), - [DOT11_OID_LONGRETRIES] = OID_U32_C(0x13000003), - [DOT11_OID_MAXTXLIFETIME] = OID_U32_C(0x13000004), - [DOT11_OID_MAXRXLIFETIME] = OID_U32(0x13000005), - [DOT11_OID_AUTHRESPTIMEOUT] = OID_U32(0x13000006), - [DOT11_OID_ASSOCRESPTIMEOUT] = OID_U32(0x13000007), - - [DOT11_OID_ALOFT_TABLE] = OID_UNKNOWN(0x1d000000), - [DOT11_OID_ALOFT_CTRL_TABLE] = OID_UNKNOWN(0x1d000001), - [DOT11_OID_ALOFT_RETREAT] = OID_UNKNOWN(0x1d000002), - [DOT11_OID_ALOFT_PROGRESS] = OID_UNKNOWN(0x1d000003), - [DOT11_OID_ALOFT_FIXEDRATE] = OID_U32(0x1d000004), - [DOT11_OID_ALOFT_RSSIGRAPH] = OID_UNKNOWN(0x1d000005), - [DOT11_OID_ALOFT_CONFIG] = OID_UNKNOWN(0x1d000006), + OID_U32_C(DOT11_OID_BSSTYPE, 0x10000000), + OID_STRUCT_C(DOT11_OID_BSSID, 0x10000001, u8[6], OID_TYPE_SSID), + OID_STRUCT_C(DOT11_OID_SSID, 0x10000002, struct obj_ssid, + OID_TYPE_SSID), + OID_U32(DOT11_OID_STATE, 0x10000003), + OID_U32(DOT11_OID_AID, 0x10000004), + OID_STRUCT(DOT11_OID_COUNTRYSTRING, 0x10000005, u8[4], OID_TYPE_RAW), + OID_STRUCT_C(DOT11_OID_SSIDOVERRIDE, 0x10000006, struct obj_ssid, + OID_TYPE_SSID), + + OID_U32(DOT11_OID_MEDIUMLIMIT, 0x11000000), + OID_U32_C(DOT11_OID_BEACONPERIOD, 0x11000001), + OID_U32(DOT11_OID_DTIMPERIOD, 0x11000002), + OID_U32(DOT11_OID_ATIMWINDOW, 0x11000003), + OID_U32(DOT11_OID_LISTENINTERVAL, 0x11000004), + OID_U32(DOT11_OID_CFPPERIOD, 0x11000005), + OID_U32(DOT11_OID_CFPDURATION, 0x11000006), + + OID_U32_C(DOT11_OID_AUTHENABLE, 0x12000000), + OID_U32_C(DOT11_OID_PRIVACYINVOKED, 0x12000001), + OID_U32_C(DOT11_OID_EXUNENCRYPTED, 0x12000002), + OID_U32_C(DOT11_OID_DEFKEYID, 0x12000003), + [DOT11_OID_DEFKEYX] = {0x12000004, 3, sizeof (struct obj_key), + OID_FLAG_CACHED | OID_TYPE_KEY}, /* DOT11_OID_DEFKEY1,...DOT11_OID_DEFKEY4 */ + OID_UNKNOWN(DOT11_OID_STAKEY, 0x12000008), + OID_U32(DOT11_OID_REKEYTHRESHOLD, 0x12000009), + OID_UNKNOWN(DOT11_OID_STASC, 0x1200000a), + + OID_U32(DOT11_OID_PRIVTXREJECTED, 0x1a000000), + OID_U32(DOT11_OID_PRIVRXPLAIN, 0x1a000001), + OID_U32(DOT11_OID_PRIVRXFAILED, 0x1a000002), + OID_U32(DOT11_OID_PRIVRXNOKEY, 0x1a000003), + + OID_U32_C(DOT11_OID_RTSTHRESH, 0x13000000), + OID_U32_C(DOT11_OID_FRAGTHRESH, 0x13000001), + OID_U32_C(DOT11_OID_SHORTRETRIES, 0x13000002), + OID_U32_C(DOT11_OID_LONGRETRIES, 0x13000003), + OID_U32_C(DOT11_OID_MAXTXLIFETIME, 0x13000004), + OID_U32(DOT11_OID_MAXRXLIFETIME, 0x13000005), + OID_U32(DOT11_OID_AUTHRESPTIMEOUT, 0x13000006), + OID_U32(DOT11_OID_ASSOCRESPTIMEOUT, 0x13000007), + + OID_UNKNOWN(DOT11_OID_ALOFT_TABLE, 0x1d000000), + OID_UNKNOWN(DOT11_OID_ALOFT_CTRL_TABLE, 0x1d000001), + OID_UNKNOWN(DOT11_OID_ALOFT_RETREAT, 0x1d000002), + OID_UNKNOWN(DOT11_OID_ALOFT_PROGRESS, 0x1d000003), + OID_U32(DOT11_OID_ALOFT_FIXEDRATE, 0x1d000004), + OID_UNKNOWN(DOT11_OID_ALOFT_RSSIGRAPH, 0x1d000005), + OID_UNKNOWN(DOT11_OID_ALOFT_CONFIG, 0x1d000006), [DOT11_OID_VDCFX] = {0x1b000000, 7, 0, 0}, - [DOT11_OID_MAXFRAMEBURST] = OID_U32(0x1b000008), /* in microseconds */ + OID_U32(DOT11_OID_MAXFRAMEBURST, 0x1b000008), - [DOT11_OID_PSM] = OID_U32(0x14000000), - [DOT11_OID_CAMTIMEOUT] = OID_U32(0x14000001), - [DOT11_OID_RECEIVEDTIMS] = OID_U32(0x14000002), - [DOT11_OID_ROAMPREFERENCE] = OID_U32(0x14000003), - - [DOT11_OID_BRIDGELOCAL] = OID_U32(0x15000000), - [DOT11_OID_CLIENTS] = OID_U32(0x15000001), - [DOT11_OID_CLIENTSASSOCIATED] = OID_U32(0x15000002), + OID_U32(DOT11_OID_PSM, 0x14000000), + OID_U32(DOT11_OID_CAMTIMEOUT, 0x14000001), + OID_U32(DOT11_OID_RECEIVEDTIMS, 0x14000002), + OID_U32(DOT11_OID_ROAMPREFERENCE, 0x14000003), + + OID_U32(DOT11_OID_BRIDGELOCAL, 0x15000000), + OID_U32(DOT11_OID_CLIENTS, 0x15000001), + OID_U32(DOT11_OID_CLIENTSASSOCIATED, 0x15000002), [DOT11_OID_CLIENTX] = {0x15000003, 2006, 0, 0}, /* DOT11_OID_CLIENTX,...DOT11_OID_CLIENT2007 */ - [DOT11_OID_CLIENTFIND] = OID_STRUCT(0x150007DB, u8[6]), - [DOT11_OID_WDSLINKADD] = OID_STRUCT(0x150007DC, u8[6]), - [DOT11_OID_WDSLINKREMOVE] = OID_STRUCT(0x150007DD, u8[6]), - [DOT11_OID_EAPAUTHSTA] = OID_STRUCT(0x150007DE, u8[6]), - [DOT11_OID_EAPUNAUTHSTA] = OID_STRUCT(0x150007DF, u8[6]), - [DOT11_OID_DOT1XENABLE] = OID_U32_C(0x150007E0), - [DOT11_OID_MICFAILURE] = OID_UNKNOWN(0x150007E1), - [DOT11_OID_REKEYINDICATE] = OID_UNKNOWN(0x150007E2), - - [DOT11_OID_MPDUTXSUCCESSFUL] = OID_U32(0x16000000), - [DOT11_OID_MPDUTXONERETRY] = OID_U32(0x16000001), - [DOT11_OID_MPDUTXMULTIPLERETRIES] = OID_U32(0x16000002), - [DOT11_OID_MPDUTXFAILED] = OID_U32(0x16000003), - [DOT11_OID_MPDURXSUCCESSFUL] = OID_U32(0x16000004), - [DOT11_OID_MPDURXDUPS] = OID_U32(0x16000005), - [DOT11_OID_RTSSUCCESSFUL] = OID_U32(0x16000006), - [DOT11_OID_RTSFAILED] = OID_U32(0x16000007), - [DOT11_OID_ACKFAILED] = OID_U32(0x16000008), - [DOT11_OID_FRAMERECEIVES] = OID_U32(0x16000009), - [DOT11_OID_FRAMEERRORS] = OID_U32(0x1600000A), - [DOT11_OID_FRAMEABORTS] = OID_U32(0x1600000B), - [DOT11_OID_FRAMEABORTSPHY] = OID_U32(0x1600000C), - - [DOT11_OID_SLOTTIME] = OID_U32(0x17000000), - [DOT11_OID_CWMIN] = OID_U32(0x17000001), - [DOT11_OID_CWMAX] = OID_U32(0x17000002), - [DOT11_OID_ACKWINDOW] = OID_U32(0x17000003), - [DOT11_OID_ANTENNARX] = OID_U32(0x17000004), - [DOT11_OID_ANTENNATX] = OID_U32(0x17000005), - [DOT11_OID_ANTENNADIVERSITY] = OID_U32(0x17000006), - [DOT11_OID_CHANNEL] = OID_U32_C(0x17000007), - [DOT11_OID_EDTHRESHOLD] = OID_U32_C(0x17000008), - [DOT11_OID_PREAMBLESETTINGS] = OID_U32(0x17000009), - [DOT11_OID_RATES] = OID_STRUCT(0x1700000A, u8[IWMAX_BITRATES + 1]), - [DOT11_OID_CCAMODESUPPORTED] = OID_U32(0x1700000B), - [DOT11_OID_CCAMODE] = OID_U32(0x1700000C), - [DOT11_OID_RSSIVECTOR] = OID_U32(0x1700000D), - [DOT11_OID_OUTPUTPOWERTABLE] = OID_U32(0x1700000E), - [DOT11_OID_OUTPUTPOWER] = OID_U32_C(0x1700000F), - [DOT11_OID_SUPPORTEDRATES] = - OID_STRUCT(0x17000010, u8[IWMAX_BITRATES + 1]), - [DOT11_OID_FREQUENCY] = OID_U32_C(0x17000011), - [DOT11_OID_SUPPORTEDFREQUENCIES] = {0x17000012, 0, sizeof (struct - obj_frequencies) - + sizeof (u16) * IWMAX_FREQ, 0}, - - [DOT11_OID_NOISEFLOOR] = OID_U32(0x17000013), - [DOT11_OID_FREQUENCYACTIVITY] = - OID_STRUCT(0x17000014, u8[IWMAX_FREQ + 1]), - [DOT11_OID_IQCALIBRATIONTABLE] = OID_UNKNOWN(0x17000015), - [DOT11_OID_NONERPPROTECTION] = OID_U32(0x17000016), - [DOT11_OID_SLOTSETTINGS] = OID_U32(0x17000017), - [DOT11_OID_NONERPTIMEOUT] = OID_U32(0x17000018), - [DOT11_OID_PROFILES] = OID_U32(0x17000019), - [DOT11_OID_EXTENDEDRATES] = - OID_STRUCT(0x17000020, u8[IWMAX_BITRATES + 1]), - - [DOT11_OID_DEAUTHENTICATE] = OID_STRUCT_MLME(0x18000000), - [DOT11_OID_AUTHENTICATE] = OID_STRUCT_MLME(0x18000001), - [DOT11_OID_DISASSOCIATE] = OID_STRUCT_MLME(0x18000002), - [DOT11_OID_ASSOCIATE] = OID_STRUCT_MLME(0x18000003), - [DOT11_OID_SCAN] = OID_UNKNOWN(0x18000004), - [DOT11_OID_BEACON] = OID_STRUCT_MLMEEX(0x18000005), - [DOT11_OID_PROBE] = OID_STRUCT_MLMEEX(0x18000006), - [DOT11_OID_DEAUTHENTICATEEX] = OID_STRUCT_MLMEEX(0x18000007), - [DOT11_OID_AUTHENTICATEEX] = OID_STRUCT_MLMEEX(0x18000008), - [DOT11_OID_DISASSOCIATEEX] = OID_STRUCT_MLMEEX(0x18000009), - [DOT11_OID_ASSOCIATEEX] = OID_STRUCT_MLMEEX(0x1800000A), - [DOT11_OID_REASSOCIATE] = OID_STRUCT_MLMEEX(0x1800000B), - [DOT11_OID_REASSOCIATEEX] = OID_STRUCT_MLMEEX(0x1800000C), - - [DOT11_OID_NONERPSTATUS] = OID_U32(0x1E000000), - - [DOT11_OID_STATIMEOUT] = OID_U32(0x19000000), - [DOT11_OID_MLMEAUTOLEVEL] = OID_U32_C(0x19000001), - [DOT11_OID_BSSTIMEOUT] = OID_U32(0x19000002), - [DOT11_OID_ATTACHMENT] = OID_UNKNOWN(0x19000003), - [DOT11_OID_PSMBUFFER] = OID_STRUCT_C(0x19000004, struct obj_buffer), - - [DOT11_OID_BSSS] = OID_U32(0x1C000000), - [DOT11_OID_BSSX] = {0x1C000001, 63, sizeof (struct obj_bss), 0}, /*DOT11_OID_BSS1,...,DOT11_OID_BSS64 */ - [DOT11_OID_BSSFIND] = OID_STRUCT(0x1C000042, struct obj_bss), + OID_STRUCT(DOT11_OID_CLIENTFIND, 0x150007DB, u8[6], OID_TYPE_ADDR), + OID_STRUCT(DOT11_OID_WDSLINKADD, 0x150007DC, u8[6], OID_TYPE_ADDR), + OID_STRUCT(DOT11_OID_WDSLINKREMOVE, 0x150007DD, u8[6], OID_TYPE_ADDR), + OID_STRUCT(DOT11_OID_EAPAUTHSTA, 0x150007DE, u8[6], OID_TYPE_ADDR), + OID_STRUCT(DOT11_OID_EAPUNAUTHSTA, 0x150007DF, u8[6], OID_TYPE_ADDR), + OID_U32_C(DOT11_OID_DOT1XENABLE, 0x150007E0), + OID_UNKNOWN(DOT11_OID_MICFAILURE, 0x150007E1), + OID_UNKNOWN(DOT11_OID_REKEYINDICATE, 0x150007E2), + + OID_U32(DOT11_OID_MPDUTXSUCCESSFUL, 0x16000000), + OID_U32(DOT11_OID_MPDUTXONERETRY, 0x16000001), + OID_U32(DOT11_OID_MPDUTXMULTIPLERETRIES, 0x16000002), + OID_U32(DOT11_OID_MPDUTXFAILED, 0x16000003), + OID_U32(DOT11_OID_MPDURXSUCCESSFUL, 0x16000004), + OID_U32(DOT11_OID_MPDURXDUPS, 0x16000005), + OID_U32(DOT11_OID_RTSSUCCESSFUL, 0x16000006), + OID_U32(DOT11_OID_RTSFAILED, 0x16000007), + OID_U32(DOT11_OID_ACKFAILED, 0x16000008), + OID_U32(DOT11_OID_FRAMERECEIVES, 0x16000009), + OID_U32(DOT11_OID_FRAMEERRORS, 0x1600000A), + OID_U32(DOT11_OID_FRAMEABORTS, 0x1600000B), + OID_U32(DOT11_OID_FRAMEABORTSPHY, 0x1600000C), + + OID_U32(DOT11_OID_SLOTTIME, 0x17000000), + OID_U32(DOT11_OID_CWMIN, 0x17000001), + OID_U32(DOT11_OID_CWMAX, 0x17000002), + OID_U32(DOT11_OID_ACKWINDOW, 0x17000003), + OID_U32(DOT11_OID_ANTENNARX, 0x17000004), + OID_U32(DOT11_OID_ANTENNATX, 0x17000005), + OID_U32(DOT11_OID_ANTENNADIVERSITY, 0x17000006), + OID_U32_C(DOT11_OID_CHANNEL, 0x17000007), + OID_U32_C(DOT11_OID_EDTHRESHOLD, 0x17000008), + OID_U32(DOT11_OID_PREAMBLESETTINGS, 0x17000009), + OID_STRUCT(DOT11_OID_RATES, 0x1700000A, u8[IWMAX_BITRATES + 1], + OID_TYPE_RAW), + OID_U32(DOT11_OID_CCAMODESUPPORTED, 0x1700000B), + OID_U32(DOT11_OID_CCAMODE, 0x1700000C), + OID_UNKNOWN(DOT11_OID_RSSIVECTOR, 0x1700000D), + OID_UNKNOWN(DOT11_OID_OUTPUTPOWERTABLE, 0x1700000E), + OID_U32(DOT11_OID_OUTPUTPOWER, 0x1700000F), + OID_STRUCT(DOT11_OID_SUPPORTEDRATES, 0x17000010, + u8[IWMAX_BITRATES + 1], OID_TYPE_RAW), + OID_U32_C(DOT11_OID_FREQUENCY, 0x17000011), + [DOT11_OID_SUPPORTEDFREQUENCIES] = + {0x17000012, 0, sizeof (struct obj_frequencies) + + sizeof (u16) * IWMAX_FREQ, OID_TYPE_FREQUENCIES}, + + OID_U32(DOT11_OID_NOISEFLOOR, 0x17000013), + OID_STRUCT(DOT11_OID_FREQUENCYACTIVITY, 0x17000014, u8[IWMAX_FREQ + 1], + OID_TYPE_RAW), + OID_UNKNOWN(DOT11_OID_IQCALIBRATIONTABLE, 0x17000015), + OID_U32(DOT11_OID_NONERPPROTECTION, 0x17000016), + OID_U32(DOT11_OID_SLOTSETTINGS, 0x17000017), + OID_U32(DOT11_OID_NONERPTIMEOUT, 0x17000018), + OID_U32(DOT11_OID_PROFILES, 0x17000019), + OID_STRUCT(DOT11_OID_EXTENDEDRATES, 0x17000020, + u8[IWMAX_BITRATES + 1], OID_TYPE_RAW), + + OID_STRUCT_MLME(DOT11_OID_DEAUTHENTICATE, 0x18000000), + OID_STRUCT_MLME(DOT11_OID_AUTHENTICATE, 0x18000001), + OID_STRUCT_MLME(DOT11_OID_DISASSOCIATE, 0x18000002), + OID_STRUCT_MLME(DOT11_OID_ASSOCIATE, 0x18000003), + OID_UNKNOWN(DOT11_OID_SCAN, 0x18000004), + OID_STRUCT_MLMEEX(DOT11_OID_BEACON, 0x18000005), + OID_STRUCT_MLMEEX(DOT11_OID_PROBE, 0x18000006), + OID_STRUCT_MLMEEX(DOT11_OID_DEAUTHENTICATEEX, 0x18000007), + OID_STRUCT_MLMEEX(DOT11_OID_AUTHENTICATEEX, 0x18000008), + OID_STRUCT_MLMEEX(DOT11_OID_DISASSOCIATEEX, 0x18000009), + OID_STRUCT_MLMEEX(DOT11_OID_ASSOCIATEEX, 0x1800000A), + OID_STRUCT_MLMEEX(DOT11_OID_REASSOCIATE, 0x1800000B), + OID_STRUCT_MLMEEX(DOT11_OID_REASSOCIATEEX, 0x1800000C), + + OID_U32(DOT11_OID_NONERPSTATUS, 0x1E000000), + + OID_U32(DOT11_OID_STATIMEOUT, 0x19000000), + OID_U32_C(DOT11_OID_MLMEAUTOLEVEL, 0x19000001), + OID_U32(DOT11_OID_BSSTIMEOUT, 0x19000002), + OID_UNKNOWN(DOT11_OID_ATTACHMENT, 0x19000003), + OID_STRUCT_C(DOT11_OID_PSMBUFFER, 0x19000004, struct obj_buffer, + OID_TYPE_BUFFER), + + OID_U32(DOT11_OID_BSSS, 0x1C000000), + [DOT11_OID_BSSX] = {0x1C000001, 63, sizeof (struct obj_bss), + OID_TYPE_BSS}, /*DOT11_OID_BSS1,...,DOT11_OID_BSS64 */ + OID_STRUCT(DOT11_OID_BSSFIND, 0x1C000042, struct obj_bss, OID_TYPE_BSS), [DOT11_OID_BSSLIST] = {0x1C000043, 0, sizeof (struct obj_bsslist) + - sizeof (struct obj_bss[IWMAX_BSS]), 0}, + sizeof (struct obj_bss[IWMAX_BSS]), + OID_TYPE_BSSLIST}, - [OID_INL_TUNNEL] = OID_UNKNOWN(0xFF020000), - [OID_INL_MEMADDR] = OID_UNKNOWN(0xFF020001), - [OID_INL_MEMORY] = OID_UNKNOWN(0xFF020002), - [OID_INL_MODE] = OID_U32_C(0xFF020003), - [OID_INL_COMPONENT_NR] = OID_UNKNOWN(0xFF020004), - [OID_INL_VERSION] = OID_UNKNOWN(0xFF020005), - [OID_INL_INTERFACE_ID] = OID_UNKNOWN(0xFF020006), - [OID_INL_COMPONENT_ID] = OID_UNKNOWN(0xFF020007), - [OID_INL_CONFIG] = OID_U32_C(0xFF020008), - [OID_INL_DOT11D_CONFORMANCE] = OID_U32_C(0xFF02000C), - [OID_INL_PHYCAPABILITIES] = OID_U32(0xFF02000D), - [OID_INL_OUTPUTPOWER] = OID_U32_C(0xFF02000F), + OID_UNKNOWN(OID_INL_TUNNEL, 0xFF020000), + OID_UNKNOWN(OID_INL_MEMADDR, 0xFF020001), + OID_UNKNOWN(OID_INL_MEMORY, 0xFF020002), + OID_U32_C(OID_INL_MODE, 0xFF020003), + OID_UNKNOWN(OID_INL_COMPONENT_NR, 0xFF020004), + OID_UNKNOWN(OID_INL_VERSION, 0xFF020005), + OID_UNKNOWN(OID_INL_INTERFACE_ID, 0xFF020006), + OID_UNKNOWN(OID_INL_COMPONENT_ID, 0xFF020007), + OID_U32_C(OID_INL_CONFIG, 0xFF020008), + OID_U32_C(OID_INL_DOT11D_CONFORMANCE, 0xFF02000C), + OID_U32(OID_INL_PHYCAPABILITIES, 0xFF02000D), + OID_U32_C(OID_INL_OUTPUTPOWER, 0xFF02000F), }; @@ -257,6 +285,134 @@ priv->mib = NULL; } +void +mgt_le_to_cpu(int type, void *data) +{ + switch (type) { + case OID_TYPE_U32: + *(u32 *) data = le32_to_cpu(*(u32 *) data); + break; + case OID_TYPE_BUFFER:{ + struct obj_buffer *buff = data; + buff->size = le32_to_cpu(buff->size); + buff->addr = le32_to_cpu(buff->addr); + break; + } + case OID_TYPE_BSS:{ + struct obj_bss *bss = data; + bss->age = le16_to_cpu(bss->age); + bss->channel = le16_to_cpu(bss->channel); + bss->capinfo = le16_to_cpu(bss->capinfo); + bss->rates = le16_to_cpu(bss->rates); + bss->basic_rates = le16_to_cpu(bss->basic_rates); + break; + } + case OID_TYPE_BSSLIST:{ + struct obj_bsslist *list = data; + int i; + list->nr = le32_to_cpu(list->nr); + for (i = 0; i < list->nr; i++) + mgt_le_to_cpu(OID_TYPE_BSS, &list->bsslist[i]); + break; + } + case OID_TYPE_FREQUENCIES:{ + struct obj_frequencies *freq = data; + int i; + freq->nr = le16_to_cpu(freq->nr); + for (i = 0; i < freq->nr; i++) + freq->mhz[i] = le16_to_cpu(freq->mhz[i]); + break; + } + case OID_TYPE_MLME:{ + struct obj_mlme *mlme = data; + mlme->id = le16_to_cpu(mlme->id); + mlme->state = le16_to_cpu(mlme->state); + mlme->code = le16_to_cpu(mlme->code); + break; + } + case OID_TYPE_MLMEEX:{ + struct obj_mlmeex *mlme = data; + mlme->id = le16_to_cpu(mlme->id); + mlme->state = le16_to_cpu(mlme->state); + mlme->code = le16_to_cpu(mlme->code); + mlme->size = le16_to_cpu(mlme->size); + break; + } + case OID_TYPE_SSID: + case OID_TYPE_KEY: + case OID_TYPE_ADDR: + case OID_TYPE_RAW: + break; + default: + BUG(); + } +} + +static void +mgt_cpu_to_le(int type, void *data) +{ + switch (type) { + case OID_TYPE_U32: + *(u32 *) data = cpu_to_le32(*(u32 *) data); + break; + case OID_TYPE_BUFFER:{ + struct obj_buffer *buff = data; + buff->size = cpu_to_le32(buff->size); + buff->addr = cpu_to_le32(buff->addr); + break; + } + case OID_TYPE_BSS:{ + struct obj_bss *bss = data; + bss->age = cpu_to_le16(bss->age); + bss->channel = cpu_to_le16(bss->channel); + bss->capinfo = cpu_to_le16(bss->capinfo); + bss->rates = cpu_to_le16(bss->rates); + bss->basic_rates = cpu_to_le16(bss->basic_rates); + break; + } + case OID_TYPE_BSSLIST:{ + struct obj_bsslist *list = data; + int i; + list->nr = cpu_to_le32(list->nr); + for (i = 0; i < list->nr; i++) + mgt_cpu_to_le(OID_TYPE_BSS, &list->bsslist[i]); + break; + } + case OID_TYPE_FREQUENCIES:{ + struct obj_frequencies *freq = data; + int i; + freq->nr = cpu_to_le16(freq->nr); + for (i = 0; i < freq->nr; i++) + freq->mhz[i] = cpu_to_le16(freq->mhz[i]); + break; + } + case OID_TYPE_MLME:{ + struct obj_mlme *mlme = data; + mlme->id = cpu_to_le16(mlme->id); + mlme->state = cpu_to_le16(mlme->state); + mlme->code = cpu_to_le16(mlme->code); + break; + } + case OID_TYPE_MLMEEX:{ + struct obj_mlmeex *mlme = data; + mlme->id = cpu_to_le16(mlme->id); + mlme->state = cpu_to_le16(mlme->state); + mlme->code = cpu_to_le16(mlme->code); + mlme->size = cpu_to_le16(mlme->size); + break; + } + case OID_TYPE_SSID: + case OID_TYPE_KEY: + case OID_TYPE_ADDR: + case OID_TYPE_RAW: + break; + default: + BUG(); + } +} + +/* Note : data is modified during this function */ + int mgt_set_request(islpci_private *priv, enum oid_num_t n, int extra, void *data) { @@ -265,7 +421,7 @@ int response_op = PIMFOR_OP_ERROR; int dlen; void *cache, *_data = data; - u32 oid, u; + u32 oid; BUG_ON(OID_NUM_LAST <= n); BUG_ON(extra > isl_oid[n].range); @@ -279,13 +435,11 @@ cache += (cache ? extra * dlen : 0); oid = isl_oid[n].oid + extra; - if (data == NULL) + if (_data == NULL) /* we are requested to re-set a cached value */ _data = cache; - if ((isl_oid[n].flags & OID_FLAG_U32) && data) { - u = cpu_to_le32(*(u32 *) data); - _data = &u; - } + else + mgt_cpu_to_le(isl_oid[n].flags & OID_FLAG_TYPE, _data); /* If we are going to write to the cache, we don't want anyone to read * it -> acquire write lock. * Else we could acquire a read lock to be sure we don't bother the @@ -313,6 +467,10 @@ up_write(&priv->mib_sem); } + /* re-set given data to what it was */ + if (data) + mgt_le_to_cpu(isl_oid[n].flags & OID_FLAG_TYPE, data); + return ret; } @@ -326,7 +484,7 @@ struct islpci_mgmtframe *response = NULL; int dlen; - void *cache, *_res=NULL; + void *cache, *_res = NULL; u32 oid; BUG_ON(OID_NUM_LAST <= n); @@ -362,20 +520,19 @@ _res = cache; ret = 0; } - if (isl_oid[n].flags & OID_FLAG_U32) { - if (ret) - res->u = 0; - else - res->u = le32_to_cpu(*(u32 *) _res); - } else { + if ((isl_oid[n].flags & OID_FLAG_TYPE) == OID_TYPE_U32) + res->u = ret ? 0 : le32_to_cpu(*(u32 *) _res); + else { res->ptr = kmalloc(reslen, GFP_KERNEL); BUG_ON(res->ptr == NULL); if (ret) memset(res->ptr, 0, reslen); - else + else { memcpy(res->ptr, _res, reslen); + mgt_le_to_cpu(isl_oid[n].flags & OID_FLAG_TYPE, + res->ptr); + } } - if (cache) up_read(&priv->mib_sem); @@ -404,7 +561,7 @@ int j = 0; u32 oid = t->oid; BUG_ON(data == NULL); - while (j <= t->range){ + while (j <= t->range) { response = NULL; ret |= islpci_mgt_transaction(priv->ndev, PIMFOR_OP_SET, oid, data, t->size, @@ -431,13 +588,21 @@ BUG_ON(priv->mib[n] == NULL); memcpy(priv->mib[n], data, isl_oid[n].size); - if (isl_oid[n].flags & OID_FLAG_U32) - *(u32 *) priv->mib[n] = cpu_to_le32(*(u32 *) priv->mib[n]); + mgt_cpu_to_le(isl_oid[n].flags & OID_FLAG_TYPE, priv->mib[n]); } -/* Commits the cache. If something goes wrong, it restarts the device. Lock - * outside - */ +void +mgt_get(islpci_private *priv, enum oid_num_t n, void *res) +{ + BUG_ON(OID_NUM_LAST <= n); + BUG_ON(priv->mib[n] == NULL); + BUG_ON(res == NULL); + + memcpy(res, priv->mib[n], isl_oid[n].size); + mgt_le_to_cpu(isl_oid[n].flags & OID_FLAG_TYPE, res); +} + +/* Commits the cache. Lock outside. */ static enum oid_num_t commit_part1[] = { OID_INL_CONFIG, @@ -530,3 +695,102 @@ return 0; } + +int +mgt_response_to_str(enum oid_num_t n, union oid_res_t *r, char *str) +{ + switch (isl_oid[n].flags & OID_FLAG_TYPE) { + case OID_TYPE_U32: + return snprintf(str, PRIV_STR_SIZE, "%u\n", r->u); + break; + case OID_TYPE_BUFFER:{ + struct obj_buffer *buff = r->ptr; + return snprintf(str, PRIV_STR_SIZE, + "size=%u\naddr=0x%X\n", buff->size, + buff->addr); + } + break; + case OID_TYPE_BSS:{ + struct obj_bss *bss = r->ptr; + return snprintf(str, PRIV_STR_SIZE, + "age=%u\nchannel=%u\n\ + capinfo=0x%X\nrates=0x%X\nbasic_rates=0x%X\n", bss->age, bss->channel, bss->capinfo, bss->rates, bss->basic_rates); + } + break; + case OID_TYPE_BSSLIST:{ + struct obj_bsslist *list = r->ptr; + int i, k; + k = snprintf(str, PRIV_STR_SIZE, "nr=%u\n", list->nr); + for (i = 0; i < list->nr; i++) + k += snprintf(str + k, PRIV_STR_SIZE - k, + "bss[%u] : \nage=%u\nchannel=%u\ncapinfo=0x%X\nrates=0x%X\nbasic_rates=0x%X\n", + i, list->bsslist[i].age, + list->bsslist[i].channel, + list->bsslist[i].capinfo, + list->bsslist[i].rates, + list->bsslist[i].basic_rates); + return k; + } + break; + case OID_TYPE_FREQUENCIES:{ + struct obj_frequencies *freq = r->ptr; + int i, t; + printk("nr : %u\n", freq->nr); + t = snprintf(str, PRIV_STR_SIZE, "nr=%u\n", freq->nr); + for (i = 0; i < freq->nr; i++) + t += snprintf(str + t, PRIV_STR_SIZE - t, + "mhz[%u]=%u\n", i, freq->mhz[i]); + return t; + } + break; + case OID_TYPE_MLME:{ + struct obj_mlme *mlme = r->ptr; + return snprintf(str, PRIV_STR_SIZE, "id=0x%X\nstate=0x%X\n\ + code=0x%X\n", mlme->id, mlme->state, + mlme->code); + } + break; + case OID_TYPE_MLMEEX:{ + struct obj_mlmeex *mlme = r->ptr; + return snprintf(str, PRIV_STR_SIZE, "id=0x%X\nstate=0x%X\n\ + code=0x%X\nsize=0x%X\n", mlme->id, mlme->state, + mlme->code, mlme->size); + } + break; + case OID_TYPE_SSID:{ + struct obj_ssid *ssid = r->ptr; + return snprintf(str, PRIV_STR_SIZE, + "length=%u\noctets=%s\n", + ssid->length, ssid->octets); + } + break; + case OID_TYPE_KEY:{ + struct obj_key *key = r->ptr; + int t, i; + t = snprintf(str, PRIV_STR_SIZE, + "type=0x%X\nlength=0x%X\nkey=0x", + key->type, key->length); + for (i = 0; i < key->length; i++) + t += snprintf(str + t, PRIV_STR_SIZE - t, + "%02X:", key->key[i]); + t += snprintf(str + t, PRIV_STR_SIZE - t, "\n"); + return t; + } + break; + case OID_TYPE_RAW: + case OID_TYPE_ADDR:{ + unsigned char *buff = r->ptr; + int t, i; + t = snprintf(str, PRIV_STR_SIZE, "hex data="); + for (i = 0; i < isl_oid[n].size; i++) + t += snprintf(str + t, PRIV_STR_SIZE - t, + "%02X:", buff[i]); + t += snprintf(str + t, PRIV_STR_SIZE - t, "\n"); + return t; + } + break; + default: + BUG(); + } + return 0; +} diff -urN linux-2.6.7-rc2/drivers/net/wireless/prism54/oid_mgt.h linux-2.6.7-rc3/drivers/net/wireless/prism54/oid_mgt.h --- linux-2.6.7-rc2/drivers/net/wireless/prism54/oid_mgt.h 2004-05-09 19:33:20.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/wireless/prism54/oid_mgt.h 2004-06-07 12:55:07.520809353 -0700 @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2003 Aurelien Alleaume * * This program is free software; you can redistribute it and/or modify @@ -28,9 +28,12 @@ void mgt_clean(islpci_private *); +/* I don't know where to put these 3 */ extern const int frequency_list_bg[]; - extern const int frequency_list_a[]; +int channel_of_freq(int); + +void mgt_le_to_cpu(int, void *); int mgt_set_request(islpci_private *, enum oid_num_t, int, void *); @@ -41,11 +44,15 @@ void mgt_set(islpci_private *, enum oid_num_t, void *); +void mgt_get(islpci_private *, enum oid_num_t, void *); + void mgt_commit(islpci_private *); int mgt_mlme_answer(islpci_private *); enum oid_num_t mgt_oidtonum(u32 oid); +int mgt_response_to_str(enum oid_num_t, union oid_res_t *, char *); + #endif /* !defined(_OID_MGT_H) */ /* EOF */ diff -urN linux-2.6.7-rc2/drivers/net/wireless/wavelan_cs.c linux-2.6.7-rc3/drivers/net/wireless/wavelan_cs.c --- linux-2.6.7-rc2/drivers/net/wireless/wavelan_cs.c 2004-05-09 19:32:38.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/wireless/wavelan_cs.c 2004-06-07 12:55:07.523809477 -0700 @@ -1841,7 +1841,7 @@ #endif /* HISTOGRAM */ static inline int -wl_netdev_ethtool_ioctl(struct net_device *dev, void *useraddr) +wl_netdev_ethtool_ioctl(struct net_device *dev, void __user *useraddr) { u32 ethcmd; @@ -2764,7 +2764,7 @@ switch(cmd) { case SIOCETHTOOL: - ret = wl_netdev_ethtool_ioctl(dev, (void *) rq->ifr_data); + ret = wl_netdev_ethtool_ioctl(dev, rq->ifr_data); break; /* ------------------- OTHER IOCTL ------------------- */ diff -urN linux-2.6.7-rc2/drivers/net/wireless/wl3501_cs.c linux-2.6.7-rc3/drivers/net/wireless/wl3501_cs.c --- linux-2.6.7-rc2/drivers/net/wireless/wl3501_cs.c 2004-05-09 19:31:55.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/wireless/wl3501_cs.c 2004-06-07 12:55:07.524809518 -0700 @@ -1487,7 +1487,7 @@ return wstats; } -static inline int wl3501_ethtool_ioctl(struct net_device *dev, void *uaddr) +static inline int wl3501_ethtool_ioctl(struct net_device *dev, void __user *uaddr) { u32 ethcmd; int rc = -EFAULT; @@ -1532,7 +1532,7 @@ if (netif_device_present(dev)) { rc = -EOPNOTSUPP; if (cmd == SIOCETHTOOL) - rc = wl3501_ethtool_ioctl(dev, (void *)rq->ifr_data); + rc = wl3501_ethtool_ioctl(dev, rq->ifr_data); } return rc; } diff -urN linux-2.6.7-rc2/drivers/net/yellowfin.c linux-2.6.7-rc3/drivers/net/yellowfin.c --- linux-2.6.7-rc2/drivers/net/yellowfin.c 2004-05-09 19:32:28.000000000 -0700 +++ linux-2.6.7-rc3/drivers/net/yellowfin.c 2004-06-07 12:55:07.525809560 -0700 @@ -1405,7 +1405,7 @@ outw(cfg_value | 0x1000, ioaddr + Cnfg); } -static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr) +static int netdev_ethtool_ioctl(struct net_device *dev, void __user *useraddr) { struct yellowfin_private *np = dev->priv; u32 ethcmd; @@ -1433,11 +1433,11 @@ { struct yellowfin_private *np = dev->priv; long ioaddr = dev->base_addr; - struct mii_ioctl_data *data = (struct mii_ioctl_data *)&rq->ifr_data; + struct mii_ioctl_data *data = if_mii(rq); switch(cmd) { case SIOCETHTOOL: - return netdev_ethtool_ioctl(dev, (void *) rq->ifr_data); + return netdev_ethtool_ioctl(dev, rq->ifr_data); case SIOCGMIIPHY: /* Get address of MII PHY in use. */ data->phy_id = np->phys[0] & 0x1f; /* Fall Through */ diff -urN linux-2.6.7-rc2/drivers/pcmcia/ds.c linux-2.6.7-rc3/drivers/pcmcia/ds.c --- linux-2.6.7-rc2/drivers/pcmcia/ds.c 2004-05-09 19:33:10.000000000 -0700 +++ linux-2.6.7-rc3/drivers/pcmcia/ds.c 2004-06-07 12:55:07.891824720 -0700 @@ -797,7 +797,7 @@ /*====================================================================*/ -static ssize_t ds_read(struct file *file, char *buf, +static ssize_t ds_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) { struct pcmcia_bus_socket *s; @@ -819,14 +819,14 @@ ret = wait_event_interruptible(s->queue, !queue_empty(user)); if (ret == 0) - ret = put_user(get_queued_event(user), (int *)buf) ? -EFAULT : 4; + ret = put_user(get_queued_event(user), (int __user *)buf) ? -EFAULT : 4; return ret; } /* ds_read */ /*====================================================================*/ -static ssize_t ds_write(struct file *file, const char *buf, +static ssize_t ds_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { struct pcmcia_bus_socket *s; @@ -849,7 +849,7 @@ if (s->req_pending) { s->req_pending--; - get_user(s->req_result, (int *)buf); + get_user(s->req_result, (int __user *)buf); if ((s->req_result != 0) || (s->req_pending == 0)) wake_up_interruptible(&s->request); } else @@ -888,6 +888,7 @@ u_int cmd, u_long arg) { struct pcmcia_bus_socket *s; + void __user *uarg = (char __user *)arg; u_int size; int ret, err; ds_ioctl_arg_t buf; @@ -911,14 +912,14 @@ return -EPERM; if (cmd & IOC_IN) { - err = verify_area(VERIFY_READ, (char *)arg, size); + err = verify_area(VERIFY_READ, uarg, size); if (err) { ds_dbg(3, "ds_ioctl(): verify_read = %d\n", err); return err; } } if (cmd & IOC_OUT) { - err = verify_area(VERIFY_WRITE, (char *)arg, size); + err = verify_area(VERIFY_WRITE, uarg, size); if (err) { ds_dbg(3, "ds_ioctl(): verify_write = %d\n", err); return err; @@ -927,7 +928,7 @@ err = ret = 0; - if (cmd & IOC_IN) __copy_from_user((char *)&buf, (char *)arg, size); + if (cmd & IOC_IN) __copy_from_user((char *)&buf, uarg, size); switch (cmd) { case DS_ADJUST_RESOURCE_INFO: @@ -1042,7 +1043,7 @@ } } - if (cmd & IOC_OUT) __copy_to_user((char *)arg, (char *)&buf, size); + if (cmd & IOC_OUT) __copy_to_user(uarg, (char *)&buf, size); return err; } /* ds_ioctl */ diff -urN linux-2.6.7-rc2/drivers/pcmcia/pxa2xx_base.c linux-2.6.7-rc3/drivers/pcmcia/pxa2xx_base.c --- linux-2.6.7-rc2/drivers/pcmcia/pxa2xx_base.c 2004-06-07 12:54:49.335056156 -0700 +++ linux-2.6.7-rc3/drivers/pcmcia/pxa2xx_base.c 2004-06-07 12:55:07.924826086 -0700 @@ -22,7 +22,6 @@ #include #include #include -#include #include #include @@ -113,22 +112,58 @@ return 0; } -static int pxa2xx_pcmcia_set_mcxx(struct soc_pcmcia_socket *skt, unsigned int lclk) +static int pxa2xx_pcmcia_set_mcxx(struct soc_pcmcia_socket *skt, unsigned int clk) { + struct soc_pcmcia_timing timing; int sock = skt->nr; - pxa2xx_pcmcia_set_mcmem( sock, SOC_PCMCIA_5V_MEM_ACCESS, lclk ); - pxa2xx_pcmcia_set_mcatt( sock, SOC_PCMCIA_ATTR_MEM_ACCESS, lclk ); - pxa2xx_pcmcia_set_mcio( sock, SOC_PCMCIA_IO_ACCESS, lclk ); + soc_common_pcmcia_get_timing(skt, &timing); + + pxa2xx_pcmcia_set_mcmem(sock, timing.mem, clk); + pxa2xx_pcmcia_set_mcatt(sock, timing.attr, clk); + pxa2xx_pcmcia_set_mcio(sock, timing.io, clk); return 0; } static int pxa2xx_pcmcia_set_timing(struct soc_pcmcia_socket *skt) { - unsigned int lclk = get_lclk_frequency_10khz(); - return pxa2xx_pcmcia_set_mcxx(skt, lclk); + unsigned int clk = get_memclk_frequency_10khz(); + return pxa2xx_pcmcia_set_mcxx(skt, clk); +} + +#ifdef CONFIG_CPU_FREQ + +static int +pxa2xx_pcmcia_frequency_change(struct soc_pcmcia_socket *skt, + unsigned long val, + struct cpufreq_freqs *freqs) +{ +#warning "it's not clear if this is right since the core CPU (N) clock has no effect on the memory (L) clock" + switch (val) { + case CPUFREQ_PRECHANGE: + if (freqs->new > freqs->old) { + debug(skt, 2, "new frequency %u.%uMHz > %u.%uMHz, " + "pre-updating\n", + freqs->new / 1000, (freqs->new / 100) % 10, + freqs->old / 1000, (freqs->old / 100) % 10); + pxa2xx_pcmcia_set_mcxx(skt, freqs->new); + } + break; + + case CPUFREQ_POSTCHANGE: + if (freqs->new < freqs->old) { + debug(skt, 2, "new frequency %u.%uMHz < %u.%uMHz, " + "post-updating\n", + freqs->new / 1000, (freqs->new / 100) % 10, + freqs->old / 1000, (freqs->old / 100) % 10); + pxa2xx_pcmcia_set_mcxx(skt, freqs->new); + } + break; + } + return 0; } +#endif int pxa2xx_drv_pcmcia_probe(struct device *dev) { @@ -178,6 +213,9 @@ /* Provide our PXA2xx specific timing routines. */ ops->set_timing = pxa2xx_pcmcia_set_timing; +#ifdef CONFIG_CPU_FREQ + ops->frequency_change = pxa2xx_pcmcia_frequency_change; +#endif ret = soc_common_drv_pcmcia_probe(dev, ops, first, nr); @@ -224,106 +262,13 @@ .bus = &platform_bus_type, }; -#ifdef CONFIG_CPU_FREQ - -/* - * When pxa2xx_pcmcia_notifier() decides that a MC{IO,MEM,ATT} adjustment (due - * to a core clock frequency change) is needed, this routine establishes - * new values consistent with the clock speed `clock'. - */ -static void pxa2xx_pcmcia_update_mcxx(unsigned int clock) -{ - struct soc_pcmcia_socket *skt; - - down(&soc_sockets_lock); - list_for_each_entry(skt, &soc_sockets, node) { - pxa2xx_pcmcia_set_mcio(skt->nr, calc_speed(skt->spd_io, - MAX_IO_WIN, SOC_PCMCIA_IO_ACCESS), clock); - pxa2xx_pcmcia_set_mcmem(skt->nr, calc_speed(skt->spd_io, - MAX_IO_WIN, SOC_PCMCIA_3V_MEM_ACCESS), clock ); - pxa2xx_pcmcia_set_mcatt(skt->nr, calc_speed(skt->spd_io, - MAX_IO_WIN, SOC_PCMCIA_3V_MEM_ACCESS), clock ); - } - up(&soc_sockets_lock); -} - -/* - * When changing the processor L clock frequency, it is necessary - * to adjust the MCXX timings accordingly. We've recorded the timings - * requested by Card Services, so this is just a matter of finding - * out what our current speed is, and then recomputing the new MCXX - * values. - * - * Returns: 0 on success, -1 on error - */ -static int -pxa2xx_pcmcia_notifier(struct notifier_block *nb, unsigned long val, void *data) -{ - struct cpufreq_freqs *freqs = data; - -#warning "it's not clear if this is right since the core CPU (N) clock has no effect on the memory (L) clock" - switch (val) { - case CPUFREQ_PRECHANGE: - if (freqs->new > freqs->old) { - debug( 2, "new frequency %u.%uMHz > %u.%uMHz, " - "pre-updating\n", - freqs->new / 1000, (freqs->new / 100) % 10, - freqs->old / 1000, (freqs->old / 100) % 10); - pxa2xx_pcmcia_update_mcxx(freqs->new); - } - break; - - case CPUFREQ_POSTCHANGE: - if (freqs->new < freqs->old) { - debug( 2, "new frequency %u.%uMHz < %u.%uMHz, " - "post-updating\n", - freqs->new / 1000, (freqs->new / 100) % 10, - freqs->old / 1000, (freqs->old / 100) % 10); - pxa2xx_pcmcia_update_mcxx(freqs->new); - } - break; - } - - return 0; -} - -static struct notifier_block pxa2xx_pcmcia_notifier_block = { - .notifier_call = pxa2xx_pcmcia_notifier -}; - -static int __init pxa2xx_pcmcia_cpufreq_init(void) -{ - int ret; - - ret = cpufreq_register_notifier(&pxa2xx_pcmcia_notifier_block, - CPUFREQ_TRANSITION_NOTIFIER); - if (ret < 0) - printk(KERN_ERR "Unable to register CPU frequency change " - "notifier for PCMCIA (%d)\n", ret); - return ret; -} - -static void __exit pxa2xx_pcmcia_cpufreq_exit(void) -{ - cpufreq_unregister_notifier(&pxa2xx_pcmcia_notifier_block, CPUFREQ_TRANSITION_NOTIFIER); -} - -#else -#define pxa2xx_pcmcia_cpufreq_init() -#define pxa2xx_pcmcia_cpufreq_exit() -#endif - static int __init pxa2xx_pcmcia_init(void) { - int ret = driver_register(&pxa2xx_pcmcia_driver); - if (ret == 0) - pxa2xx_pcmcia_cpufreq_init(); - return ret; + return driver_register(&pxa2xx_pcmcia_driver); } static void __exit pxa2xx_pcmcia_exit(void) { - pxa2xx_pcmcia_cpufreq_exit(); driver_unregister(&pxa2xx_pcmcia_driver); } diff -urN linux-2.6.7-rc2/drivers/pcmcia/pxa2xx_lubbock.c linux-2.6.7-rc3/drivers/pcmcia/pxa2xx_lubbock.c --- linux-2.6.7-rc2/drivers/pcmcia/pxa2xx_lubbock.c 2004-06-07 12:54:49.336056198 -0700 +++ linux-2.6.7-rc3/drivers/pcmcia/pxa2xx_lubbock.c 2004-06-07 12:55:07.925826128 -0700 @@ -25,6 +25,7 @@ #include #include #include +#include #include "sa1111_generic.h" diff -urN linux-2.6.7-rc2/drivers/pcmcia/pxa2xx_mainstone.c linux-2.6.7-rc3/drivers/pcmcia/pxa2xx_mainstone.c --- linux-2.6.7-rc2/drivers/pcmcia/pxa2xx_mainstone.c 2004-06-07 12:54:49.336056198 -0700 +++ linux-2.6.7-rc3/drivers/pcmcia/pxa2xx_mainstone.c 2004-06-07 12:55:07.926826169 -0700 @@ -24,6 +24,8 @@ #include #include +#include + #include "soc_common.h" diff -urN linux-2.6.7-rc2/drivers/pcmcia/sa11xx_base.c linux-2.6.7-rc3/drivers/pcmcia/sa11xx_base.c --- linux-2.6.7-rc2/drivers/pcmcia/sa11xx_base.c 2004-06-07 12:54:49.348056695 -0700 +++ linux-2.6.7-rc3/drivers/pcmcia/sa11xx_base.c 2004-06-07 12:55:07.996829069 -0700 @@ -36,7 +36,6 @@ #include #include #include -#include #include #include @@ -69,21 +68,6 @@ return sa1100_pcmcia_mecr_bs(cmd_time, cpu_speed); } -static unsigned short -calc_speed(unsigned short *spds, int num, unsigned short dflt) -{ - unsigned short speed = 0; - int i; - - for (i = 0; i < num; i++) - if (speed < spds[i]) - speed = spds[i]; - if (speed == 0) - speed = dflt; - - return speed; -} - /* sa1100_pcmcia_set_mecr() * ^^^^^^^^^^^^^^^^^^^^^^^^ * @@ -95,19 +79,16 @@ static int sa1100_pcmcia_set_mecr(struct soc_pcmcia_socket *skt, unsigned int cpu_clock) { + struct soc_pcmcia_timing timing; u32 mecr, old_mecr; unsigned long flags; - unsigned short speed; unsigned int bs_io, bs_mem, bs_attr; - speed = calc_speed(skt->spd_io, MAX_IO_WIN, SOC_PCMCIA_IO_ACCESS); - bs_io = skt->ops->get_timing(skt, cpu_clock, speed); + soc_common_pcmcia_get_timing(skt, &timing); - speed = calc_speed(skt->spd_mem, MAX_WIN, SOC_PCMCIA_3V_MEM_ACCESS); - bs_mem = skt->ops->get_timing(skt, cpu_clock, speed); - - speed = calc_speed(skt->spd_attr, MAX_WIN, SOC_PCMCIA_3V_MEM_ACCESS); - bs_attr = skt->ops->get_timing(skt, cpu_clock, speed); + bs_io = skt->ops->get_timing(skt, cpu_clock, timing.io); + bs_mem = skt->ops->get_timing(skt, cpu_clock, timing.mem); + bs_attr = skt->ops->get_timing(skt, cpu_clock, timing.attr); local_irq_save(flags); @@ -129,6 +110,32 @@ return 0; } +#ifdef CONFIG_CPU_FREQ +static int +sa1100_pcmcia_frequency_change(struct soc_pcmcia_socket *skt, + unsigned long val, + struct cpufreq_freqs *freqs) +{ + switch (val) { + case CPUFREQ_PRECHANGE: + if (freqs->new > freqs->old) + sa1100_pcmcia_set_mecr(skt, freqs->new); + break; + + case CPUFREQ_POSTCHANGE: + if (freqs->new < freqs->old) + sa1100_pcmcia_set_mecr(skt, freqs->new); + break; + case CPUFREQ_RESUMECHANGE: + sa1100_pcmcia_set_mecr(skt, freqs->new); + break; + } + + return 0; +} + +#endif + static int sa1100_pcmcia_set_timing(struct soc_pcmcia_socket *skt) { @@ -138,20 +145,20 @@ static int sa1100_pcmcia_show_timing(struct soc_pcmcia_socket *skt, char *buf) { + struct soc_pcmcia_timing timing; unsigned int clock = cpufreq_get(0); unsigned long mecr = MECR; char *p = buf; - p+=sprintf(p, "I/O : %u (%u)\n", - calc_speed(skt->spd_io, MAX_IO_WIN, SOC_PCMCIA_IO_ACCESS), + soc_common_pcmcia_get_timing(skt, &timing); + + p+=sprintf(p, "I/O : %u (%u)\n", timing.io, sa1100_pcmcia_cmd_time(clock, MECR_BSIO_GET(mecr, skt->nr))); - p+=sprintf(p, "attribute: %u (%u)\n", - calc_speed(skt->spd_attr, MAX_WIN, SOC_PCMCIA_3V_MEM_ACCESS), + p+=sprintf(p, "attribute: %u (%u)\n", timing.attr, sa1100_pcmcia_cmd_time(clock, MECR_BSA_GET(mecr, skt->nr))); - p+=sprintf(p, "common : %u (%u)\n", - calc_speed(skt->spd_mem, MAX_WIN, SOC_PCMCIA_3V_MEM_ACCESS), + p+=sprintf(p, "common : %u (%u)\n", timing.mem, sa1100_pcmcia_cmd_time(clock, MECR_BSM_GET(mecr, skt->nr))); return p - buf; @@ -170,90 +177,23 @@ /* Provide our SA11x0 specific timing routines. */ ops->set_timing = sa1100_pcmcia_set_timing; ops->show_timing = sa1100_pcmcia_show_timing; +#ifdef CONFIG_CPU_FREQ + ops->frequency_change = sa1100_pcmcia_frequency_change; +#endif return soc_common_drv_pcmcia_probe(dev, ops, first, nr); } EXPORT_SYMBOL(sa11xx_drv_pcmcia_probe); -#ifdef CONFIG_CPU_FREQ - -/* sa1100_pcmcia_update_mecr() - * ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - * When sa1100_pcmcia_notifier() decides that a MECR adjustment (due - * to a core clock frequency change) is needed, this routine establishes - * new BS_xx values consistent with the clock speed `clock'. - */ -static void sa1100_pcmcia_update_mecr(unsigned int clock) -{ - struct soc_pcmcia_socket *skt; - - down(&soc_pcmcia_sockets_lock); - list_for_each_entry(skt, &soc_pcmcia_sockets, node) - sa1100_pcmcia_set_mecr(skt, clock); - up(&soc_pcmcia_sockets_lock); -} - -/* sa1100_pcmcia_notifier() - * ^^^^^^^^^^^^^^^^^^^^^^^^ - * When changing the processor core clock frequency, it is necessary - * to adjust the MECR timings accordingly. We've recorded the timings - * requested by Card Services, so this is just a matter of finding - * out what our current speed is, and then recomputing the new MECR - * values. - * - * Returns: 0 on success, -1 on error - */ -static int -sa1100_pcmcia_notifier(struct notifier_block *nb, unsigned long val, - void *data) -{ - struct cpufreq_freqs *freqs = data; - - switch (val) { - case CPUFREQ_PRECHANGE: - if (freqs->new > freqs->old) - sa1100_pcmcia_update_mecr(freqs->new); - break; - - case CPUFREQ_POSTCHANGE: - if (freqs->new < freqs->old) - sa1100_pcmcia_update_mecr(freqs->new); - break; - case CPUFREQ_RESUMECHANGE: - sa1100_pcmcia_update_mecr(freqs->new); - break; - } - - return 0; -} - -static struct notifier_block sa1100_pcmcia_notifier_block = { - .notifier_call = sa1100_pcmcia_notifier -}; - static int __init sa11xx_pcmcia_init(void) { - int ret; - - printk(KERN_INFO "SA11xx PCMCIA\n"); - - ret = cpufreq_register_notifier(&sa1100_pcmcia_notifier_block, - CPUFREQ_TRANSITION_NOTIFIER); - if (ret < 0) - printk(KERN_ERR "Unable to register CPU frequency change " - "notifier (%d)\n", ret); - - return ret; + return 0; } module_init(sa11xx_pcmcia_init); -static void __exit sa11xx_pcmcia_exit(void) -{ - cpufreq_unregister_notifier(&sa1100_pcmcia_notifier_block, CPUFREQ_TRANSITION_NOTIFIER); -} +static void __exit sa11xx_pcmcia_exit(void) {} module_exit(sa11xx_pcmcia_exit); -#endif MODULE_AUTHOR("John Dorsey "); MODULE_DESCRIPTION("Linux PCMCIA Card Services: SA-11xx core socket driver"); diff -urN linux-2.6.7-rc2/drivers/pcmcia/soc_common.c linux-2.6.7-rc3/drivers/pcmcia/soc_common.c --- linux-2.6.7-rc2/drivers/pcmcia/soc_common.c 2004-06-07 12:54:49.354056943 -0700 +++ linux-2.6.7-rc3/drivers/pcmcia/soc_common.c 2004-06-07 12:55:08.002829317 -0700 @@ -31,6 +31,7 @@ ======================================================================*/ +#include #include #include #include @@ -39,6 +40,7 @@ #include #include #include +#include #include #include @@ -68,6 +70,29 @@ #define to_soc_pcmcia_socket(x) container_of(x, struct soc_pcmcia_socket, socket) +static unsigned short +calc_speed(unsigned short *spds, int num, unsigned short dflt) +{ + unsigned short speed = 0; + int i; + + for (i = 0; i < num; i++) + if (speed < spds[i]) + speed = spds[i]; + if (speed == 0) + speed = dflt; + + return speed; +} + +void soc_common_pcmcia_get_timing(struct soc_pcmcia_socket *skt, struct soc_pcmcia_timing *timing) +{ + timing->io = calc_speed(skt->spd_io, MAX_IO_WIN, SOC_PCMCIA_IO_ACCESS); + timing->mem = calc_speed(skt->spd_mem, MAX_WIN, SOC_PCMCIA_3V_MEM_ACCESS); + timing->attr = calc_speed(skt->spd_attr, MAX_WIN, SOC_PCMCIA_3V_MEM_ACCESS); +} +EXPORT_SYMBOL(soc_common_pcmcia_get_timing); + static unsigned int soc_common_pcmcia_skt_state(struct soc_pcmcia_socket *skt) { struct pcmcia_state state; @@ -591,6 +616,49 @@ #define SKT_DEV_INFO_SIZE(n) \ (sizeof(struct skt_dev_info) + (n)*sizeof(struct soc_pcmcia_socket)) +#ifdef CONFIG_CPU_FREQ +static int +soc_pcmcia_notifier(struct notifier_block *nb, unsigned long val, void *data) +{ + struct soc_pcmcia_socket *skt; + struct cpufreq_freqs *freqs = data; + int ret = 0; + + down(&soc_pcmcia_sockets_lock); + list_for_each_entry(skt, &soc_pcmcia_sockets, node) + if ( skt->ops->frequency_change ) + ret += skt->ops->frequency_change(skt, val, freqs); + up(&soc_pcmcia_sockets_lock); + + return ret; +} + +static struct notifier_block soc_pcmcia_notifier_block = { + .notifier_call = soc_pcmcia_notifier +}; + +static int soc_pcmcia_cpufreq_register(void) +{ + int ret; + + ret = cpufreq_register_notifier(&soc_pcmcia_notifier_block, + CPUFREQ_TRANSITION_NOTIFIER); + if (ret < 0) + printk(KERN_ERR "Unable to register CPU frequency change " + "notifier for PCMCIA (%d)\n", ret); + return ret; +} + +static void soc_pcmcia_cpufreq_unregister(void) +{ + cpufreq_unregister_notifier(&soc_pcmcia_notifier_block, CPUFREQ_TRANSITION_NOTIFIER); +} + +#else +#define soc_pcmcia_cpufreq_register() +#define soc_pcmcia_cpufreq_unregister() +#endif + int soc_common_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, int first, int nr) { struct skt_dev_info *sinfo; @@ -669,6 +737,9 @@ goto out_err_5; } + if ( list_empty(&soc_pcmcia_sockets) ) + soc_pcmcia_cpufreq_register(); + list_add(&skt->node, &soc_pcmcia_sockets); /* @@ -766,6 +837,9 @@ release_resource(&skt->res_io); release_resource(&skt->res_skt); } + if ( list_empty(&soc_pcmcia_sockets) ) + soc_pcmcia_cpufreq_unregister(); + up(&soc_pcmcia_sockets_lock); kfree(sinfo); diff -urN linux-2.6.7-rc2/drivers/pcmcia/soc_common.h linux-2.6.7-rc3/drivers/pcmcia/soc_common.h --- linux-2.6.7-rc2/drivers/pcmcia/soc_common.h 2004-06-07 12:54:49.354056943 -0700 +++ linux-2.6.7-rc3/drivers/pcmcia/soc_common.h 2004-06-07 12:55:08.003829359 -0700 @@ -10,6 +10,7 @@ #define _ASM_ARCH_PCMCIA /* include the world */ +#include #include #include #include @@ -103,6 +104,13 @@ unsigned int (*get_timing)(struct soc_pcmcia_socket *, unsigned int, unsigned int); int (*set_timing)(struct soc_pcmcia_socket *); int (*show_timing)(struct soc_pcmcia_socket *, char *); + +#ifdef CONFIG_CPU_FREQ + /* + * CPUFREQ support. + */ + int (*frequency_change)(struct soc_pcmcia_socket *, unsigned long, struct cpufreq_freqs *); +#endif }; @@ -112,10 +120,17 @@ const char *str; }; +struct soc_pcmcia_timing { + unsigned short io; + unsigned short mem; + unsigned short attr; +}; + extern int soc_pcmcia_request_irqs(struct soc_pcmcia_socket *skt, struct pcmcia_irqs *irqs, int nr); extern void soc_pcmcia_free_irqs(struct soc_pcmcia_socket *skt, struct pcmcia_irqs *irqs, int nr); extern void soc_pcmcia_disable_irqs(struct soc_pcmcia_socket *skt, struct pcmcia_irqs *irqs, int nr); extern void soc_pcmcia_enable_irqs(struct soc_pcmcia_socket *skt, struct pcmcia_irqs *irqs, int nr); +extern void soc_common_pcmcia_get_timing(struct soc_pcmcia_socket *, struct soc_pcmcia_timing *); extern struct list_head soc_pcmcia_sockets; diff -urN linux-2.6.7-rc2/drivers/pnp/isapnp/proc.c linux-2.6.7-rc3/drivers/pnp/isapnp/proc.c --- linux-2.6.7-rc2/drivers/pnp/isapnp/proc.c 2004-05-09 19:32:28.000000000 -0700 +++ linux-2.6.7-rc3/drivers/pnp/isapnp/proc.c 2004-06-07 12:55:08.026830311 -0700 @@ -55,7 +55,7 @@ return (file->f_pos = new); } -static ssize_t isapnp_proc_bus_read(struct file *file, char *buf, size_t nbytes, loff_t *ppos) +static ssize_t isapnp_proc_bus_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) { struct inode *ino = file->f_dentry->d_inode; struct proc_dir_entry *dp = PDE(ino); diff -urN linux-2.6.7-rc2/drivers/pnp/pnpbios/Kconfig linux-2.6.7-rc3/drivers/pnp/pnpbios/Kconfig --- linux-2.6.7-rc2/drivers/pnp/pnpbios/Kconfig 2004-05-09 19:33:10.000000000 -0700 +++ linux-2.6.7-rc3/drivers/pnp/pnpbios/Kconfig 2004-06-07 12:55:08.030830477 -0700 @@ -3,7 +3,7 @@ # config PNPBIOS bool "Plug and Play BIOS support (EXPERIMENTAL)" - depends on PNP && EXPERIMENTAL + depends on PNP && X86 && EXPERIMENTAL ---help--- Linux uses the PNPBIOS as defined in "Plug and Play BIOS Specification Version 1.0A May 5, 1994" to autodetect built-in diff -urN linux-2.6.7-rc2/drivers/pnp/pnpbios/proc.c linux-2.6.7-rc3/drivers/pnp/pnpbios/proc.c --- linux-2.6.7-rc2/drivers/pnp/pnpbios/proc.c 2004-05-09 19:33:20.000000000 -0700 +++ linux-2.6.7-rc3/drivers/pnp/pnpbios/proc.c 2004-06-07 12:55:08.059831678 -0700 @@ -176,7 +176,7 @@ return len; } -static int proc_write_node(struct file *file, const char *buf, +static int proc_write_node(struct file *file, const char __user *buf, unsigned long count, void *data) { struct pnp_bios_node *node; diff -urN linux-2.6.7-rc2/drivers/s390/block/dasd.c linux-2.6.7-rc3/drivers/s390/block/dasd.c --- linux-2.6.7-rc2/drivers/s390/block/dasd.c 2004-06-07 12:54:49.358057109 -0700 +++ linux-2.6.7-rc3/drivers/s390/block/dasd.c 2004-06-07 12:55:08.061831761 -0700 @@ -7,7 +7,7 @@ * Bugreports.to..: * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999-2001 * - * $Revision: 1.141 $ + * $Revision: 1.142 $ */ #include @@ -37,6 +37,7 @@ * SECTION: exported variables of dasd.c */ debug_info_t *dasd_debug_area; +struct dasd_discipline *dasd_diag_discipline_pointer; MODULE_AUTHOR("Holger Smolinski "); MODULE_DESCRIPTION("Linux on S/390 DASD device driver," @@ -1990,6 +1991,8 @@ DBF_EVENT(DBF_EMERG, "%s", "debug area created"); + dasd_diag_discipline_pointer = NULL; + rc = devfs_mk_dir("dasd"); if (rc) goto failed; @@ -2022,6 +2025,7 @@ module_exit(dasd_exit); EXPORT_SYMBOL(dasd_debug_area); +EXPORT_SYMBOL(dasd_diag_discipline_pointer); EXPORT_SYMBOL(dasd_add_request_head); EXPORT_SYMBOL(dasd_add_request_tail); diff -urN linux-2.6.7-rc2/drivers/s390/block/dasd_diag.c linux-2.6.7-rc3/drivers/s390/block/dasd_diag.c --- linux-2.6.7-rc2/drivers/s390/block/dasd_diag.c 2004-05-09 19:31:58.000000000 -0700 +++ linux-2.6.7-rc3/drivers/s390/block/dasd_diag.c 2004-06-07 12:55:08.062831802 -0700 @@ -6,7 +6,7 @@ * Bugreports.to..: * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000 * - * $Revision: 1.34 $ + * $Revision: 1.36 $ */ #include @@ -35,6 +35,8 @@ MODULE_LICENSE("GPL"); +struct dasd_discipline dasd_diag_discipline; + struct dasd_diag_private { struct dasd_diag_characteristics rdc_data; struct dasd_diag_rw_io iob; @@ -292,7 +294,7 @@ mdsk_term_io(device); } if (bsize <= PAGE_SIZE && label[3] == bsize && - label[0] == 0xc3d4e2f1 && label[13] != 0) { + label[0] == 0xc3d4e2f1) { device->blocks = label[7]; device->bp_block = bsize; device->s2b_shift = 0; /* bits to shift 512 to get a block */ @@ -489,6 +491,7 @@ ctl_set_bit(0, 9); register_external_interrupt(0x2603, dasd_ext_handler); + dasd_diag_discipline_pointer = &dasd_diag_discipline; return 0; } @@ -503,6 +506,7 @@ } unregister_external_interrupt(0x2603, dasd_ext_handler); ctl_clear_bit(0, 9); + dasd_diag_discipline_pointer = NULL; } module_init(dasd_diag_init); diff -urN linux-2.6.7-rc2/drivers/s390/block/dasd_int.h linux-2.6.7-rc3/drivers/s390/block/dasd_int.h --- linux-2.6.7-rc2/drivers/s390/block/dasd_int.h 2004-05-09 19:32:54.000000000 -0700 +++ linux-2.6.7-rc3/drivers/s390/block/dasd_int.h 2004-06-07 12:55:08.064831885 -0700 @@ -6,7 +6,7 @@ * Bugreports.to..: * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000 * - * $Revision: 1.57 $ + * $Revision: 1.58 $ */ #ifndef DASD_INT_H @@ -260,12 +260,7 @@ int (*fill_info) (struct dasd_device *, struct dasd_information2_t *); }; -extern struct dasd_discipline dasd_diag_discipline; -#ifdef CONFIG_DASD_DIAG -#define dasd_diag_discipline_pointer (&dasd_diag_discipline) -#else -#define dasd_diag_discipline_pointer (0) -#endif +extern struct dasd_discipline *dasd_diag_discipline_pointer; struct dasd_device { /* Block device stuff. */ diff -urN linux-2.6.7-rc2/drivers/s390/block/dcssblk.c linux-2.6.7-rc3/drivers/s390/block/dcssblk.c --- linux-2.6.7-rc2/drivers/s390/block/dcssblk.c 2004-05-09 19:32:25.000000000 -0700 +++ linux-2.6.7-rc3/drivers/s390/block/dcssblk.c 2004-06-07 12:55:08.065831927 -0700 @@ -76,8 +76,7 @@ }; static struct list_head dcssblk_devices = LIST_HEAD_INIT(dcssblk_devices); -static rwlock_t dcssblk_devices_lock = RW_LOCK_UNLOCKED; - +static struct rw_semaphore dcssblk_devices_sem; /* * release function for segment device. @@ -92,8 +91,8 @@ /* * get a minor number. needs to be called with - * write_lock(&dcssblk_devices_lock) and the - * device needs to be enqueued before the lock is + * down_write(&dcssblk_devices_sem) and the + * device needs to be enqueued before the semaphore is * freed. */ static inline int @@ -121,7 +120,7 @@ /* * get the struct dcssblk_dev_info from dcssblk_devices * for the given name. - * read_lock(&dcssblk_devices_lock) must be held. + * down_read(&dcssblk_devices_sem) must be held. */ static struct dcssblk_dev_info * dcssblk_get_device_by_name(char *name) @@ -137,31 +136,6 @@ } /* - * register the device that represents a segment in sysfs, - * also add the attributes for the device - */ -static inline int -dcssblk_register_segment_device(struct device *dev) -{ - int rc; - - rc = device_register(dev); - if (rc) - return rc; - rc = device_create_file(dev, &dev_attr_shared); - if (rc) - goto unregister_dev; - rc = device_create_file(dev, &dev_attr_save); - if (rc) - goto unregister_dev; - return rc; - -unregister_dev: - device_unregister(dev); - return rc; -} - -/* * device attribute for switching shared/nonshared (exclusive) * operation (show + store) */ @@ -184,24 +158,24 @@ PRINT_WARN("Invalid value, must be 0 or 1\n"); return -EINVAL; } - write_lock(&dcssblk_devices_lock); + down_write(&dcssblk_devices_sem); dev_info = container_of(dev, struct dcssblk_dev_info, dev); if (atomic_read(&dev_info->use_count)) { PRINT_ERR("share: segment %s is busy!\n", dev_info->segment_name); - write_unlock(&dcssblk_devices_lock); + up_write(&dcssblk_devices_sem); return -EBUSY; } if ((inbuf[0] == '1') && (dev_info->is_shared == 1)) { PRINT_WARN("Segment %s already loaded in shared mode!\n", dev_info->segment_name); - write_unlock(&dcssblk_devices_lock); + up_write(&dcssblk_devices_sem); return count; } if ((inbuf[0] == '0') && (dev_info->is_shared == 0)) { PRINT_WARN("Segment %s already loaded in exclusive mode!\n", dev_info->segment_name); - write_unlock(&dcssblk_devices_lock); + up_write(&dcssblk_devices_sem); return count; } if (inbuf[0] == '1') { @@ -231,7 +205,7 @@ PRINT_INFO("Segment %s reloaded, exclusive (read-write) mode.\n", dev_info->segment_name); } else { - write_unlock(&dcssblk_devices_lock); + up_write(&dcssblk_devices_sem); PRINT_WARN("Invalid value, must be 0 or 1\n"); return -EINVAL; } @@ -262,14 +236,13 @@ dev_info->segment_name); rc = -EPERM; } - write_unlock(&dcssblk_devices_lock); + up_write(&dcssblk_devices_sem); goto out; removeseg: PRINT_ERR("Could not reload segment %s, removing it now!\n", dev_info->segment_name); list_del(&dev_info->lh); - write_unlock(&dcssblk_devices_lock); del_gendisk(dev_info->gd); blk_put_queue(dev_info->dcssblk_queue); @@ -277,6 +250,7 @@ put_disk(dev_info->gd); device_unregister(dev); put_device(dev); + up_write(&dcssblk_devices_sem); out: return rc; } @@ -308,7 +282,7 @@ } dev_info = container_of(dev, struct dcssblk_dev_info, dev); - write_lock(&dcssblk_devices_lock); + down_write(&dcssblk_devices_sem); if (inbuf[0] == '1') { if (atomic_read(&dev_info->use_count) == 0) { // device is idle => we save immediately @@ -332,11 +306,11 @@ dev_info->segment_name); } } else { - write_unlock(&dcssblk_devices_lock); + up_write(&dcssblk_devices_sem); PRINT_WARN("Invalid value, must be 0 or 1\n"); return -EINVAL; } - write_unlock(&dcssblk_devices_lock); + up_write(&dcssblk_devices_sem); return count; } @@ -375,9 +349,9 @@ /* * already loaded? */ - read_lock(&dcssblk_devices_lock); + down_read(&dcssblk_devices_sem); dev_info = dcssblk_get_device_by_name(local_buf); - read_unlock(&dcssblk_devices_lock); + up_read(&dcssblk_devices_sem); if (dev_info != NULL) { PRINT_WARN("Segment %s already loaded!\n", local_buf); rc = -EEXIST; @@ -433,10 +407,10 @@ /* * get minor, add to list */ - write_lock(&dcssblk_devices_lock); + down_write(&dcssblk_devices_sem); rc = dcssblk_assign_free_minor(dev_info); if (rc) { - write_unlock(&dcssblk_devices_lock); + up_write(&dcssblk_devices_sem); PRINT_ERR("No free minor number available! " "Unloading segment...\n"); goto unload_seg; @@ -444,22 +418,29 @@ sprintf(dev_info->gd->disk_name, "dcssblk%d", dev_info->gd->first_minor); list_add_tail(&dev_info->lh, &dcssblk_devices); + + if (!try_module_get(THIS_MODULE)) { + rc = -ENODEV; + goto list_del; + } /* * register the device */ - rc = dcssblk_register_segment_device(&dev_info->dev); + rc = device_register(&dev_info->dev); if (rc) { PRINT_ERR("Segment %s could not be registered RC=%d\n", local_buf, rc); + module_put(THIS_MODULE); goto list_del; } - - if (!try_module_get(THIS_MODULE)) { - rc = -ENODEV; - goto list_del; - } - get_device(&dev_info->dev); + rc = device_create_file(&dev_info->dev, &dev_attr_shared); + if (rc) + goto unregister_dev; + rc = device_create_file(&dev_info->dev, &dev_attr_save); + if (rc) + goto unregister_dev; + add_disk(dev_info->gd); blk_queue_make_request(dev_info->dcssblk_queue, dcssblk_make_request); @@ -476,13 +457,24 @@ break; } PRINT_DEBUG("Segment %s loaded successfully\n", local_buf); - write_unlock(&dcssblk_devices_lock); + up_write(&dcssblk_devices_sem); rc = count; goto out; +unregister_dev: + PRINT_ERR("device_create_file() failed!\n"); + list_del(&dev_info->lh); + blk_put_queue(dev_info->dcssblk_queue); + dev_info->gd->queue = NULL; + put_disk(dev_info->gd); + device_unregister(&dev_info->dev); + segment_unload(dev_info->segment_name); + put_device(&dev_info->dev); + up_write(&dcssblk_devices_sem); + goto out; list_del: list_del(&dev_info->lh); - write_unlock(&dcssblk_devices_lock); + up_write(&dcssblk_devices_sem); unload_seg: segment_unload(local_buf); dealloc_gendisk: @@ -526,22 +518,21 @@ goto out_buf; } - write_lock(&dcssblk_devices_lock); + down_write(&dcssblk_devices_sem); dev_info = dcssblk_get_device_by_name(local_buf); if (dev_info == NULL) { - write_unlock(&dcssblk_devices_lock); + up_write(&dcssblk_devices_sem); PRINT_WARN("Segment %s is not loaded!\n", local_buf); rc = -ENODEV; goto out_buf; } if (atomic_read(&dev_info->use_count) != 0) { - write_unlock(&dcssblk_devices_lock); + up_write(&dcssblk_devices_sem); PRINT_WARN("Segment %s is in use!\n", local_buf); rc = -EBUSY; goto out_buf; } list_del(&dev_info->lh); - write_unlock(&dcssblk_devices_lock); del_gendisk(dev_info->gd); blk_put_queue(dev_info->dcssblk_queue); @@ -552,6 +543,8 @@ PRINT_DEBUG("Segment %s unloaded successfully\n", dev_info->segment_name); put_device(&dev_info->dev); + up_write(&dcssblk_devices_sem); + rc = count; out_buf: kfree(local_buf); @@ -587,7 +580,7 @@ rc = -ENODEV; goto out; } - write_lock(&dcssblk_devices_lock); + down_write(&dcssblk_devices_sem); if (atomic_dec_and_test(&dev_info->use_count) && (dev_info->save_pending)) { PRINT_INFO("Segment %s became idle and is being saved now\n", @@ -595,7 +588,7 @@ segment_replace(dev_info->segment_name); dev_info->save_pending = 0; } - write_unlock(&dcssblk_devices_lock); + up_write(&dcssblk_devices_sem); rc = 0; out: return rc; @@ -616,7 +609,7 @@ dev_info = bio->bi_bdev->bd_disk->private_data; if (dev_info == NULL) goto fail; - if ((bio->bi_sector & 3) != 0 || (bio->bi_size & 4095) != 0) + if ((bio->bi_sector & 7) != 0 || (bio->bi_size & 4095) != 0) /* Request is not page-aligned. */ goto fail; if (((bio->bi_size >> 9) + bio->bi_sector) @@ -695,6 +688,7 @@ return rc; } dcssblk_major = rc; + init_rwsem(&dcssblk_devices_sem); PRINT_DEBUG("...finished!\n"); return 0; } diff -urN linux-2.6.7-rc2/drivers/s390/block/xpram.c linux-2.6.7-rc3/drivers/s390/block/xpram.c --- linux-2.6.7-rc2/drivers/s390/block/xpram.c 2004-05-09 19:32:54.000000000 -0700 +++ linux-2.6.7-rc3/drivers/s390/block/xpram.c 2004-06-07 12:55:08.065831927 -0700 @@ -290,7 +290,7 @@ unsigned long bytes; int i; - if ((bio->bi_sector & 3) != 0 || (bio->bi_size & 4095) != 0) + if ((bio->bi_sector & 7) != 0 || (bio->bi_size & 4095) != 0) /* Request is not page-aligned. */ goto fail; if ((bio->bi_size >> 12) > xdev->size) diff -urN linux-2.6.7-rc2/drivers/s390/cio/airq.c linux-2.6.7-rc3/drivers/s390/cio/airq.c --- linux-2.6.7-rc2/drivers/s390/cio/airq.c 2004-05-09 19:33:10.000000000 -0700 +++ linux-2.6.7-rc3/drivers/s390/cio/airq.c 2004-06-07 12:55:08.069832092 -0700 @@ -2,7 +2,7 @@ * drivers/s390/cio/airq.c * S/390 common I/O routines -- support for adapter interruptions * - * $Revision: 1.11 $ + * $Revision: 1.12 $ * * Copyright (C) 1999-2002 IBM Deutschland Entwicklung GmbH, * IBM Corporation @@ -14,11 +14,11 @@ #include #include #include +#include #include "cio_debug.h" #include "airq.h" -static spinlock_t adapter_lock = SPIN_LOCK_UNLOCKED; static adapter_int_handler_t adapter_handler; /* @@ -40,23 +40,17 @@ CIO_TRACE_EVENT (4, "rgaint"); - spin_lock (&adapter_lock); - if (handler == NULL) ret = -EINVAL; - else if (adapter_handler) - ret = -EBUSY; - else { - adapter_handler = handler; - ret = 0; - } - - spin_unlock (&adapter_lock); + else + ret = (cmpxchg(&adapter_handler, NULL, handler) ? -EBUSY : 0); + if (!ret) + synchronize_kernel(); sprintf (dbf_txt, "ret:%d", ret); CIO_TRACE_EVENT (4, dbf_txt); - return (ret); + return ret; } int @@ -67,38 +61,26 @@ CIO_TRACE_EVENT (4, "urgaint"); - spin_lock (&adapter_lock); - if (handler == NULL) ret = -EINVAL; - else if (handler != adapter_handler) - ret = -EINVAL; else { adapter_handler = NULL; + synchronize_kernel(); ret = 0; } - - spin_unlock (&adapter_lock); - sprintf (dbf_txt, "ret:%d", ret); CIO_TRACE_EVENT (4, dbf_txt); - return (ret); + return ret; } void do_adapter_IO (void) { - CIO_TRACE_EVENT (4, "doaio"); - - spin_lock (&adapter_lock); + CIO_TRACE_EVENT (6, "doaio"); if (adapter_handler) (*adapter_handler) (); - - spin_unlock (&adapter_lock); - - return; } EXPORT_SYMBOL (s390_register_adapter_interrupt); diff -urN linux-2.6.7-rc2/drivers/s390/cio/ccwgroup.c linux-2.6.7-rc3/drivers/s390/cio/ccwgroup.c --- linux-2.6.7-rc2/drivers/s390/cio/ccwgroup.c 2004-05-09 19:32:38.000000000 -0700 +++ linux-2.6.7-rc3/drivers/s390/cio/ccwgroup.c 2004-06-07 12:55:08.069832092 -0700 @@ -1,7 +1,7 @@ /* * drivers/s390/cio/ccwgroup.c * bus driver for ccwgroup - * $Revision: 1.27 $ + * $Revision: 1.28 $ * * Copyright (C) 2002 IBM Deutschland Entwicklung GmbH, * IBM Corporation @@ -179,12 +179,12 @@ || gdev->cdev[i]->id.driver_info != gdev->cdev[0]->id.driver_info) { rc = -EINVAL; - goto error; + goto free_dev; } /* Don't allow a device to belong to more than one group. */ if (gdev->cdev[i]->dev.driver_data) { rc = -EINVAL; - goto error; + goto free_dev; } } for (i = 0; i < argc; i++) @@ -207,8 +207,8 @@ rc = device_register(&gdev->dev); if (rc) - goto error; - + goto free_dev; + get_device(&gdev->dev); rc = device_create_file(&gdev->dev, &dev_attr_ungroup); if (rc) { @@ -217,20 +217,28 @@ } rc = __ccwgroup_create_symlinks(gdev); - if (!rc) + if (!rc) { + put_device(&gdev->dev); return 0; - + } device_remove_file(&gdev->dev, &dev_attr_ungroup); device_unregister(&gdev->dev); error: for (i = 0; i < argc; i++) if (gdev->cdev[i]) { put_device(&gdev->cdev[i]->dev); + gdev->cdev[i]->dev.driver_data = NULL; + } + put_device(&gdev->dev); + return rc; +free_dev: + for (i = 0; i < argc; i++) + if (gdev->cdev[i]) { + put_device(&gdev->cdev[i]->dev); if (del_drvdata) gdev->cdev[i]->dev.driver_data = NULL; } kfree(gdev); - return rc; } diff -urN linux-2.6.7-rc2/drivers/s390/cio/chsc.c linux-2.6.7-rc3/drivers/s390/cio/chsc.c --- linux-2.6.7-rc2/drivers/s390/cio/chsc.c 2004-05-09 19:32:38.000000000 -0700 +++ linux-2.6.7-rc3/drivers/s390/cio/chsc.c 2004-06-07 12:55:08.070832134 -0700 @@ -1,7 +1,7 @@ /* * drivers/s390/cio/chsc.c * S/390 common I/O routines -- channel subsystem call - * $Revision: 1.110 $ + * $Revision: 1.111 $ * * Copyright (C) 1999-2002 IBM Deutschland Entwicklung GmbH, * IBM Corporation @@ -62,11 +62,11 @@ int state; state = get_chp_status(chp); - if (state < 0) - new_channel_path(chp); - else + if (state < 0) { + need_rescan = 1; + queue_work(slow_path_wq, &slow_path_work); + } else WARN_ON(!state); - /* FIXME: should notify other subchannels here */ } /* FIXME: this is _always_ called for every subchannel. shouldn't we @@ -285,8 +285,10 @@ out_unreg: spin_unlock(&sch->lock); sch->lpm = 0; - /* We can't block here. */ - device_call_nopath_notify(sch); + if (css_enqueue_subchannel_slow(sch->irq)) { + css_clear_subchannel_slow_list(); + need_rescan = 1; + } return 0; } @@ -303,6 +305,9 @@ bus_for_each_dev(&css_bus_type, NULL, &chpid, s390_subchannel_remove_chpid); + + if (need_rescan || css_slow_subchannels_exist()) + queue_work(slow_path_wq, &slow_path_work); } static int @@ -737,10 +742,12 @@ * can successfully terminate, even using the * just varied off path. Then kill it. */ - if (!__check_for_io_and_kill(sch, chp) && !sch->lpm) - /* Get over with it now. */ - device_call_nopath_notify(sch); - else if (sch->driver && sch->driver->verify) + if (!__check_for_io_and_kill(sch, chp) && !sch->lpm) { + if (css_enqueue_subchannel_slow(sch->irq)) { + css_clear_subchannel_slow_list(); + need_rescan = 1; + } + } else if (sch->driver && sch->driver->verify) sch->driver->verify(&sch->dev); } break; @@ -773,11 +780,6 @@ return 0; } -extern void css_trigger_slow_path(void); -typedef void (*workfunc)(void *); -static DECLARE_WORK(varyonoff_work, (workfunc)css_trigger_slow_path, - NULL); - /* * Function: s390_vary_chpid * Varies the specified chpid online or offline @@ -813,7 +815,7 @@ s390_subchannel_vary_chpid_on : s390_subchannel_vary_chpid_off); if (!on) - return 0; + goto out; /* Scan for new devices on varied on path. */ for (irq = 0; irq < __MAX_SUBCHANNELS; irq++) { struct schib schib; @@ -835,8 +837,9 @@ need_rescan = 1; } } +out: if (need_rescan || css_slow_subchannels_exist()) - schedule_work(&varyonoff_work); + queue_work(slow_path_wq, &slow_path_work); return 0; } diff -urN linux-2.6.7-rc2/drivers/s390/cio/cio.c linux-2.6.7-rc3/drivers/s390/cio/cio.c --- linux-2.6.7-rc2/drivers/s390/cio/cio.c 2004-05-09 19:33:21.000000000 -0700 +++ linux-2.6.7-rc3/drivers/s390/cio/cio.c 2004-06-07 12:55:08.071832175 -0700 @@ -1,7 +1,7 @@ /* * drivers/s390/cio/cio.c * S/390 common I/O routines -- low level i/o calls - * $Revision: 1.121 $ + * $Revision: 1.123 $ * * Copyright (C) 1999-2002 IBM Deutschland Entwicklung GmbH, * IBM Corporation @@ -67,17 +67,17 @@ if (!cio_debug_msg_id) goto out_unregister; debug_register_view (cio_debug_msg_id, &debug_sprintf_view); - debug_set_level (cio_debug_msg_id, 6); + debug_set_level (cio_debug_msg_id, 2); cio_debug_trace_id = debug_register ("cio_trace", 4, 4, 8); if (!cio_debug_trace_id) goto out_unregister; debug_register_view (cio_debug_trace_id, &debug_hex_ascii_view); - debug_set_level (cio_debug_trace_id, 6); + debug_set_level (cio_debug_trace_id, 2); cio_debug_crw_id = debug_register ("cio_crw", 2, 4, 16*sizeof (long)); if (!cio_debug_crw_id) goto out_unregister; debug_register_view (cio_debug_crw_id, &debug_sprintf_view); - debug_set_level (cio_debug_crw_id, 6); + debug_set_level (cio_debug_crw_id, 2); pr_debug("debugging initialized\n"); return 0; diff -urN linux-2.6.7-rc2/drivers/s390/cio/css.c linux-2.6.7-rc3/drivers/s390/cio/css.c --- linux-2.6.7-rc2/drivers/s390/cio/css.c 2004-06-07 12:54:49.363057316 -0700 +++ linux-2.6.7-rc3/drivers/s390/cio/css.c 2004-06-07 12:55:08.071832175 -0700 @@ -1,7 +1,7 @@ /* * drivers/s390/cio/css.c * driver for channel subsystem - * $Revision: 1.74 $ + * $Revision: 1.77 $ * * Copyright (C) 2002 IBM Deutschland Entwicklung GmbH, * IBM Corporation @@ -166,10 +166,12 @@ if (sch && sch->schib.pmcw.dnv && (schib.pmcw.dev != sch->schib.pmcw.dev)) return CIO_REVALIDATE; + if (sch && !sch->lpm) + return CIO_NO_PATH; return CIO_OPER; } -static inline int +static int css_evaluate_subchannel(int irq, int slow) { int event, ret, disc; @@ -188,7 +190,11 @@ return -EAGAIN; /* Will be done on the slow path. */ } event = css_get_subchannel_status(sch, irq); + CIO_MSG_EVENT(4, "Evaluating schid %04x, event %d, %s, %s path.\n", + irq, event, sch?(disc?"disconnected":"normal"):"unknown", + slow?"slow":"fast"); switch (event) { + case CIO_NO_PATH: case CIO_GONE: if (!sch) { /* Never used this subchannel. Ignore. */ @@ -196,7 +202,8 @@ break; } if (sch->driver && sch->driver->notify && - sch->driver->notify(&sch->dev, CIO_GONE)) { + sch->driver->notify(&sch->dev, event)) { + cio_disable_subchannel(sch); device_set_disconnected(sch); ret = 0; break; @@ -205,6 +212,7 @@ * Unregister subchannel. * The device will be killed automatically. */ + cio_disable_subchannel(sch); device_unregister(&sch->dev); /* Reset intparm to zeroes. */ sch->schib.pmcw.intparm = 0; @@ -266,23 +274,44 @@ } } -static void -css_evaluate_slow_subchannel(unsigned long schid) -{ - css_evaluate_subchannel(schid, 1); -} +struct slow_subchannel { + struct list_head slow_list; + unsigned long schid; +}; -void +static LIST_HEAD(slow_subchannels_head); +static spinlock_t slow_subchannel_lock = SPIN_LOCK_UNLOCKED; + +static void css_trigger_slow_path(void) { + CIO_TRACE_EVENT(4, "slowpath"); + if (need_rescan) { need_rescan = 0; css_rescan_devices(); return; } - css_walk_subchannel_slow_list(css_evaluate_slow_subchannel); + + spin_lock_irq(&slow_subchannel_lock); + while (!list_empty(&slow_subchannels_head)) { + struct slow_subchannel *slow_sch = + list_entry(slow_subchannels_head.next, + struct slow_subchannel, slow_list); + + list_del_init(slow_subchannels_head.next); + spin_unlock_irq(&slow_subchannel_lock); + css_evaluate_subchannel(slow_sch->schid, 1); + spin_lock_irq(&slow_subchannel_lock); + kfree(slow_sch); + } + spin_unlock_irq(&slow_subchannel_lock); } +typedef void (*workfunc)(void *); +DECLARE_WORK(slow_path_work, (workfunc)css_trigger_slow_path, NULL); +struct workqueue_struct *slow_path_wq; + /* * Rescan for new devices. FIXME: This is slow. * This function is called when we have lost CRWs due to overflows and we have @@ -443,14 +472,6 @@ device_unregister(dev); } -struct slow_subchannel { - struct list_head slow_list; - unsigned long schid; -}; - -static LIST_HEAD(slow_subchannels_head); -static spinlock_t slow_subchannel_lock = SPIN_LOCK_UNLOCKED; - int css_enqueue_subchannel_slow(unsigned long schid) { @@ -484,25 +505,7 @@ spin_unlock_irqrestore(&slow_subchannel_lock, flags); } -void -css_walk_subchannel_slow_list(void (*fn)(unsigned long)) -{ - unsigned long flags; - spin_lock_irqsave(&slow_subchannel_lock, flags); - while (!list_empty(&slow_subchannels_head)) { - struct slow_subchannel *slow_sch = - list_entry(slow_subchannels_head.next, - struct slow_subchannel, slow_list); - - list_del_init(slow_subchannels_head.next); - spin_unlock_irqrestore(&slow_subchannel_lock, flags); - fn(slow_sch->schid); - spin_lock_irqsave(&slow_subchannel_lock, flags); - kfree(slow_sch); - } - spin_unlock_irqrestore(&slow_subchannel_lock, flags); -} int css_slow_subchannels_exist(void) diff -urN linux-2.6.7-rc2/drivers/s390/cio/css.h linux-2.6.7-rc3/drivers/s390/cio/css.h --- linux-2.6.7-rc2/drivers/s390/cio/css.h 2004-05-09 19:33:22.000000000 -0700 +++ linux-2.6.7-rc3/drivers/s390/cio/css.h 2004-06-07 12:55:08.072832217 -0700 @@ -136,7 +136,6 @@ /* Helper functions for vary on/off. */ void device_set_waiting(struct subchannel *); -void device_call_nopath_notify(struct subchannel *); /* Helper functions to build lists for the slow path. */ int css_enqueue_subchannel_slow(unsigned long schid); @@ -144,4 +143,7 @@ void css_clear_subchannel_slow_list(void); int css_slow_subchannels_exist(void); extern int need_rescan; + +extern struct workqueue_struct *slow_path_wq; +extern struct work_struct slow_path_work; #endif diff -urN linux-2.6.7-rc2/drivers/s390/cio/device.c linux-2.6.7-rc3/drivers/s390/cio/device.c --- linux-2.6.7-rc2/drivers/s390/cio/device.c 2004-06-07 12:54:49.364057357 -0700 +++ linux-2.6.7-rc3/drivers/s390/cio/device.c 2004-06-07 12:55:08.073832258 -0700 @@ -1,7 +1,7 @@ /* * drivers/s390/cio/device.c * bus driver for ccw devices - * $Revision: 1.117 $ + * $Revision: 1.119 $ * * Copyright (C) 2002 IBM Deutschland Entwicklung GmbH, * IBM Corporation @@ -159,6 +159,11 @@ ret = -ENOMEM; /* FIXME: better errno ? */ goto out_err; } + slow_path_wq = create_singlethread_workqueue("kslowcrw"); + if (!slow_path_wq) { + ret = -ENOMEM; /* FIXME: better errno ? */ + goto out_err; + } if ((ret = bus_register (&ccw_bus_type))) goto out_err; @@ -174,6 +179,8 @@ destroy_workqueue(ccw_device_work); if (ccw_device_notify_work) destroy_workqueue(ccw_device_notify_work); + if (slow_path_wq) + destroy_workqueue(slow_path_wq); return ret; } @@ -646,9 +653,7 @@ struct subchannel *sch; sch = to_subchannel(cdev->dev.parent); - /* Check if device is registered. */ - if (!list_empty(&sch->dev.node)) - device_unregister(&sch->dev); + device_unregister(&sch->dev); /* Reset intparm to zeroes. */ sch->schib.pmcw.intparm = 0; cio_modify(sch); @@ -677,7 +682,7 @@ sch = to_subchannel(cdev->dev.parent); INIT_WORK(&cdev->private->kick_work, ccw_device_call_sch_unregister, (void *) cdev); - queue_work(ccw_device_work, &cdev->private->kick_work); + queue_work(slow_path_wq, &cdev->private->kick_work); break; case DEV_STATE_BOXED: /* Device did not respond in time. */ diff -urN linux-2.6.7-rc2/drivers/s390/cio/device_fsm.c linux-2.6.7-rc3/drivers/s390/cio/device_fsm.c --- linux-2.6.7-rc2/drivers/s390/cio/device_fsm.c 2004-06-07 12:54:49.365057399 -0700 +++ linux-2.6.7-rc3/drivers/s390/cio/device_fsm.c 2004-06-07 12:55:08.074832299 -0700 @@ -459,20 +459,6 @@ } void -device_call_nopath_notify(struct subchannel *sch) -{ - struct ccw_device *cdev; - - if (!sch->dev.driver_data) - return; - cdev = sch->dev.driver_data; - PREPARE_WORK(&cdev->private->kick_work, - ccw_device_nopath_notify, (void *)cdev); - queue_work(ccw_device_notify_work, &cdev->private->kick_work); -} - - -void ccw_device_verify_done(struct ccw_device *cdev, int err) { cdev->private->flags.doverify = 0; diff -urN linux-2.6.7-rc2/drivers/s390/cio/requestirq.c linux-2.6.7-rc3/drivers/s390/cio/requestirq.c --- linux-2.6.7-rc2/drivers/s390/cio/requestirq.c 2004-05-09 19:32:54.000000000 -0700 +++ linux-2.6.7-rc3/drivers/s390/cio/requestirq.c 2004-06-07 12:55:08.074832299 -0700 @@ -1,7 +1,7 @@ /* * drivers/s390/cio/requestirq.c * S/390 common I/O routines -- enabling and disabling of devices - * $Revision: 1.45 $ + * $Revision: 1.46 $ * * Copyright (C) 1999-2002 IBM Deutschland Entwicklung GmbH, * IBM Corporation @@ -18,21 +18,6 @@ #include "css.h" -/* for compatiblity only... */ -int -request_irq (unsigned int irq, - void (*handler) (int, void *, struct pt_regs *), - unsigned long irqflags, const char *devname, void *dev_id) -{ - return -EINVAL; -} - -/* for compatiblity only... */ -void -free_irq (unsigned int irq, void *dev_id) -{ -} - struct pgid global_pgid; EXPORT_SYMBOL_GPL(global_pgid); diff -urN linux-2.6.7-rc2/drivers/s390/net/iucv.c linux-2.6.7-rc3/drivers/s390/net/iucv.c --- linux-2.6.7-rc2/drivers/s390/net/iucv.c 2004-06-07 12:54:49.367057482 -0700 +++ linux-2.6.7-rc3/drivers/s390/net/iucv.c 2004-06-07 12:55:08.076832382 -0700 @@ -1,5 +1,5 @@ /* - * $Id: iucv.c,v 1.32 2004/05/18 09:28:43 braunu Exp $ + * $Id: iucv.c,v 1.33 2004/05/24 10:19:18 braunu Exp $ * * IUCV network driver * @@ -29,7 +29,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * RELEASE-TAG: IUCV lowlevel driver $Revision: 1.32 $ + * RELEASE-TAG: IUCV lowlevel driver $Revision: 1.33 $ * */ @@ -352,7 +352,7 @@ static void iucv_banner(void) { - char vbuf[] = "$Revision: 1.32 $"; + char vbuf[] = "$Revision: 1.33 $"; char *version = vbuf; if ((version = strchr(version, ':'))) { @@ -2368,7 +2368,8 @@ iucv_debug(2, "found a matching handler"); break; - } + } else + h = NULL; } spin_unlock_irqrestore (&iucv_lock, flags); if (h) { diff -urN linux-2.6.7-rc2/drivers/s390/net/netiucv.c linux-2.6.7-rc3/drivers/s390/net/netiucv.c --- linux-2.6.7-rc2/drivers/s390/net/netiucv.c 2004-06-07 12:54:49.371057647 -0700 +++ linux-2.6.7-rc3/drivers/s390/net/netiucv.c 2004-06-07 12:55:08.080832548 -0700 @@ -1,5 +1,5 @@ /* - * $Id: netiucv.c,v 1.53 2004/05/07 14:29:37 mschwide Exp $ + * $Id: netiucv.c,v 1.54 2004/05/28 08:04:14 braunu Exp $ * * IUCV network driver * @@ -30,7 +30,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * RELEASE-TAG: IUCV network driver $Revision: 1.53 $ + * RELEASE-TAG: IUCV network driver $Revision: 1.54 $ * */ @@ -60,7 +60,6 @@ #include #include #include -#include #include "iucv.h" #include "fsm.h" @@ -167,10 +166,10 @@ } static __u8 iucv_host[8] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -//static __u8 iucvMagic[16] = { -// 0xF0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, -// 0xF0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 -//}; +static __u8 iucvMagic[16] = { + 0xF0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, + 0xF0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 +}; /** * This mask means the 16-byte IUCV "magic" and the origin userid must @@ -769,18 +768,10 @@ struct iucv_event *ev = (struct iucv_event *)arg; struct iucv_connection *conn = ev->conn; __u16 msglimit; - int rc, len; - __u8 iucvMagic[16] = { - 0xF0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, - 0xF0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 - }; + int rc; pr_debug("%s() called\n", __FUNCTION__); - len = (IFNAMSIZ < sizeof(conn->netdev->name)) ? - IFNAMSIZ : sizeof(conn->netdev->name); - memcpy(iucvMagic, conn->netdev->name, len); - ASCEBC (iucvMagic, len); if (conn->handle == 0) { conn->handle = iucv_register_program(iucvMagic, conn->userid, mask, @@ -1958,7 +1949,7 @@ static void netiucv_banner(void) { - char vbuf[] = "$Revision: 1.53 $"; + char vbuf[] = "$Revision: 1.54 $"; char *version = vbuf; if ((version = strchr(version, ':'))) { diff -urN linux-2.6.7-rc2/drivers/s390/net/qeth.h linux-2.6.7-rc3/drivers/s390/net/qeth.h --- linux-2.6.7-rc2/drivers/s390/net/qeth.h 2004-06-07 12:54:49.372057689 -0700 +++ linux-2.6.7-rc3/drivers/s390/net/qeth.h 2004-06-07 12:55:08.081832589 -0700 @@ -23,7 +23,7 @@ #include "qeth_mpc.h" -#define VERSION_QETH_H "$Revision: 1.108 $" +#define VERSION_QETH_H "$Revision: 1.109 $" #ifdef CONFIG_QETH_IPV6 #define QETH_VERSION_IPV6 ":IPv6" @@ -91,10 +91,14 @@ debug_event(qeth_dbf_##name,level,(void*)(addr),len); \ } while (0) -#define QETH_DBF_TEXT_(name,level,text...) \ - do { \ - sprintf(qeth_dbf_text_buf, text); \ - debug_text_event(qeth_dbf_##name,level,qeth_dbf_text_buf);\ +extern DEFINE_PER_CPU(char[256], qeth_dbf_txt_buf); + +#define QETH_DBF_TEXT_(name,level,text...) \ + do { \ + char* dbf_txt_buf = get_cpu_var(qeth_dbf_txt_buf); \ + sprintf(dbf_txt_buf, text); \ + debug_text_event(qeth_dbf_##name,level,dbf_txt_buf); \ + put_cpu_var(qeth_dbf_txt_buf); \ } while (0) #define QETH_DBF_SPRINTF(name,level,text...) \ diff -urN linux-2.6.7-rc2/drivers/s390/net/qeth_main.c linux-2.6.7-rc3/drivers/s390/net/qeth_main.c --- linux-2.6.7-rc2/drivers/s390/net/qeth_main.c 2004-06-07 12:54:49.379057979 -0700 +++ linux-2.6.7-rc3/drivers/s390/net/qeth_main.c 2004-06-07 12:55:08.088832879 -0700 @@ -1,6 +1,6 @@ /* * - * linux/drivers/s390/net/qeth_main.c ($Revision: 1.112 $) + * linux/drivers/s390/net/qeth_main.c ($Revision: 1.118 $) * * Linux on zSeries OSA Express and HiperSockets support * @@ -12,7 +12,7 @@ * Frank Pavlic (pavlic@de.ibm.com) and * Thomas Spatzier * - * $Revision: 1.112 $ $Date: 2004/05/19 09:28:21 $ + * $Revision: 1.118 $ $Date: 2004/06/02 06:34:52 $ * * 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 @@ -78,7 +78,7 @@ #include "qeth_mpc.h" #include "qeth_fs.h" -#define VERSION_QETH_C "$Revision: 1.112 $" +#define VERSION_QETH_C "$Revision: 1.118 $" static const char *version = "qeth S/390 OSA-Express driver"; /** @@ -91,7 +91,8 @@ static debug_info_t *qeth_dbf_trace = NULL; static debug_info_t *qeth_dbf_sense = NULL; static debug_info_t *qeth_dbf_qerr = NULL; -static char qeth_dbf_text_buf[255]; + +DEFINE_PER_CPU(char[256], qeth_dbf_txt_buf); /** * some more definitions and declarations @@ -4182,9 +4183,10 @@ } data_len = *((__u16*)QETH_IPA_PDU_LEN_PDU1(data)); if (cmd->data.setadapterparms.hdr.seq_no == 1) - data_len -= (__u16)((char*)&snmp->request - (char *)cmd); - else data_len -= (__u16)((char *)&snmp->data - (char *)cmd); + else + data_len -= (__u16)((char*)&snmp->request - (char *)cmd); + /* check if there is enough room in userspace */ if ((qinfo->udata_len - qinfo->udata_offset) < data_len) { QETH_DBF_TEXT_(trace, 4, "scer3%i", -ENOMEM); @@ -4193,15 +4195,17 @@ } QETH_DBF_TEXT_(trace, 4, "snore%i", cmd->data.setadapterparms.hdr.used_total); - QETH_DBF_TEXT_(trace, 4, "sseqn%i", cmd->data.setassparms.hdr.seq_no); + QETH_DBF_TEXT_(trace, 4, "sseqn%i", cmd->data.setadapterparms.hdr.seq_no); /*copy entries to user buffer*/ if (cmd->data.setadapterparms.hdr.seq_no == 1) { memcpy(qinfo->udata + qinfo->udata_offset, - (char *)snmp,offsetof(struct qeth_snmp_cmd,data)); + (char *)snmp, + data_len + offsetof(struct qeth_snmp_cmd,data)); qinfo->udata_offset += offsetof(struct qeth_snmp_cmd, data); + } else { + memcpy(qinfo->udata + qinfo->udata_offset, + (char *)&snmp->request, data_len); } - memcpy(qinfo->udata + qinfo->udata_offset, - (char *)&snmp->data, data_len); qinfo->udata_offset += data_len; /* check if all replies received ... */ QETH_DBF_TEXT_(trace, 4, "srtot%i", @@ -4212,7 +4216,6 @@ cmd->data.setadapterparms.hdr.used_total) return 1; return 0; - } static struct qeth_cmd_buffer * @@ -4280,7 +4283,6 @@ else copy_to_user(udata, qinfo.udata, qinfo.udata_len); - kfree(qinfo.udata); return rc; } @@ -4476,13 +4478,17 @@ rc = qeth_snmp_command(card, rq->ifr_ifru.ifru_data); break; case SIOC_QETH_GET_CARD_TYPE: + if ((card->info.type == QETH_CARD_TYPE_OSAE) && + !card->info.guestlan) + return 1; + return 0; break; case SIOCGMIIPHY: - mii_data = (struct mii_ioctl_data *) &rq->ifr_ifru.ifru_data; + mii_data = if_mii(rq); mii_data->phy_id = 0; break; case SIOCGMIIREG: - mii_data = (struct mii_ioctl_data *) &rq->ifr_ifru.ifru_data; + mii_data = if_mii(rq); if (mii_data->phy_id != 0) rc = -EINVAL; else @@ -4497,7 +4503,7 @@ rc = -EPERM; break; } - mii_data = (struct mii_ioctl_data *) &rq->ifr_ifru.ifru_data; + mii_data = if_mii(rq); if (mii_data->phy_id != 0) rc = -EINVAL; else diff -urN linux-2.6.7-rc2/drivers/s390/net/qeth_sys.c linux-2.6.7-rc3/drivers/s390/net/qeth_sys.c --- linux-2.6.7-rc2/drivers/s390/net/qeth_sys.c 2004-06-07 12:54:49.382058103 -0700 +++ linux-2.6.7-rc3/drivers/s390/net/qeth_sys.c 2004-06-07 12:55:08.091833004 -0700 @@ -1,6 +1,6 @@ /* * - * linux/drivers/s390/net/qeth_sys.c ($Revision: 1.30 $) + * linux/drivers/s390/net/qeth_sys.c ($Revision: 1.32 $) * * Linux on zSeries OSA Express and HiperSockets support * This file contains code related to sysfs. @@ -20,7 +20,7 @@ #include "qeth_mpc.h" #include "qeth_fs.h" -const char *VERSION_QETH_SYS_C = "$Revision: 1.30 $"; +const char *VERSION_QETH_SYS_C = "$Revision: 1.32 $"; /*****************************************************************************/ /* */ @@ -1447,14 +1447,16 @@ { int rc; int signum; - char *tmp; + char *tmp, *tmp2; tmp = strsep((char **) &buf, "\n"); - if (!strcmp(tmp, "unregister")){ - return qeth_notifier_unregister(current); + if (!strncmp(tmp, "unregister", 10)){ + if ((rc = qeth_notifier_unregister(current))) + return rc; + return count; } - signum = simple_strtoul(buf, &tmp, 10); + signum = simple_strtoul(tmp, &tmp2, 10); if ((signum < 0) || (signum > 32)){ PRINT_WARN("Signal number %d is out of range\n", signum); return -EINVAL; @@ -1465,7 +1467,7 @@ return count; } -static DRIVER_ATTR(notifier_register, 0644, 0, +static DRIVER_ATTR(notifier_register, 0200, 0, qeth_driver_notifier_register_store); int diff -urN linux-2.6.7-rc2/drivers/s390/s390mach.c linux-2.6.7-rc3/drivers/s390/s390mach.c --- linux-2.6.7-rc2/drivers/s390/s390mach.c 2004-05-09 19:33:21.000000000 -0700 +++ linux-2.6.7-rc3/drivers/s390/s390mach.c 2004-06-07 12:55:08.091833004 -0700 @@ -12,6 +12,7 @@ #include #include #include +#include #include @@ -21,13 +22,14 @@ // #define DBG(args,...) do {} while (0); static struct semaphore m_sem; -static struct semaphore s_sem; extern int css_process_crw(int); extern int chsc_process_crw(void); extern int chp_process_crw(int, int); extern void css_reiterate_subchannels(void); -extern void css_trigger_slow_path(void); + +extern struct workqueue_struct *slow_path_wq; +extern struct work_struct slow_path_work; static void s390_handle_damage(char *msg) @@ -39,21 +41,6 @@ disabled_wait((unsigned long) __builtin_return_address(0)); } -static int -s390_mchk_slow_path(void *param) -{ - struct semaphore *sem; - - sem = (struct semaphore *)param; - /* Set a nice name. */ - daemonize("kslowcrw"); -repeat: - down_interruptible(sem); - css_trigger_slow_path(); - goto repeat; - return 0; -} - /* * Retrieve CRWs and call function to handle event. * @@ -130,7 +117,7 @@ } } if (slow) - up(&s_sem); + queue_work(slow_path_wq, &slow_path_work); goto repeat; return 0; } @@ -202,7 +189,6 @@ machine_check_init(void) { init_MUTEX_LOCKED(&m_sem); - init_MUTEX_LOCKED( &s_sem ); ctl_clear_bit(14, 25); /* disable damage MCH */ ctl_set_bit(14, 26); /* enable degradation MCH */ ctl_set_bit(14, 27); /* enable system recovery MCH */ @@ -226,7 +212,6 @@ machine_check_crw_init (void) { kernel_thread(s390_collect_crw_info, &m_sem, CLONE_FS|CLONE_FILES); - kernel_thread(s390_mchk_slow_path, &s_sem, CLONE_FS|CLONE_FILES); ctl_set_bit(14, 28); /* enable channel report MCH */ return 0; } diff -urN linux-2.6.7-rc2/drivers/scsi/aha152x.c linux-2.6.7-rc3/drivers/scsi/aha152x.c --- linux-2.6.7-rc2/drivers/scsi/aha152x.c 2004-06-07 12:54:49.408059180 -0700 +++ linux-2.6.7-rc3/drivers/scsi/aha152x.c 2004-06-07 12:55:08.349843690 -0700 @@ -577,11 +577,11 @@ #define MSGO(i) (HOSTDATA(shpnt)->msgo[i]) #define MSGO_I (HOSTDATA(shpnt)->msgo_i) #define MSGOLEN (HOSTDATA(shpnt)->msgo_len) -#define ADDMSGO(x) (MSGOLEN<256 ? MSGO(MSGOLEN++)=x : aha152x_error(shpnt,"MSGO overflow")) +#define ADDMSGO(x) (MSGOLEN<256 ? (void)(MSGO(MSGOLEN++)=x) : aha152x_error(shpnt,"MSGO overflow")) #define MSGI(i) (HOSTDATA(shpnt)->msgi[i]) #define MSGILEN (HOSTDATA(shpnt)->msgi_len) -#define ADDMSGI(x) (MSGILEN<256 ? MSGI(MSGILEN++)=x : aha152x_error(shpnt,"MSGI overflow")) +#define ADDMSGI(x) (MSGILEN<256 ? (void)(MSGI(MSGILEN++)=x) : aha152x_error(shpnt,"MSGI overflow")) #define DATA_LEN (HOSTDATA(shpnt)->data_len) diff -urN linux-2.6.7-rc2/drivers/scsi/ata_piix.c linux-2.6.7-rc3/drivers/scsi/ata_piix.c --- linux-2.6.7-rc2/drivers/scsi/ata_piix.c 2004-06-07 12:54:49.426059925 -0700 +++ linux-2.6.7-rc3/drivers/scsi/ata_piix.c 2004-06-07 12:55:08.625855122 -0700 @@ -28,7 +28,7 @@ #include #include #include "scsi.h" -#include "hosts.h" +#include #include #define DRV_NAME "ata_piix" @@ -424,16 +424,15 @@ int w_flag = 0x10 << drive_dn; int u_speed = 0; int sitre; - u16 reg4042, reg44, reg48, reg4a, reg54; - u8 reg55; + u16 reg4042, reg4a; + u8 reg48, reg54, reg55; pci_read_config_word(dev, maslave, ®4042); DPRINTK("reg4042 = 0x%04x\n", reg4042); sitre = (reg4042 & 0x4000) ? 1 : 0; - pci_read_config_word(dev, 0x44, ®44); - pci_read_config_word(dev, 0x48, ®48); + pci_read_config_byte(dev, 0x48, ®48); pci_read_config_word(dev, 0x4a, ®4a); - pci_read_config_word(dev, 0x54, ®54); + pci_read_config_byte(dev, 0x54, ®54); pci_read_config_byte(dev, 0x55, ®55); switch(speed) { @@ -450,23 +449,19 @@ } if (!(reg48 & u_flag)) - pci_write_config_word(dev, 0x48, reg48|u_flag); + pci_write_config_byte(dev, 0x48, reg48 | u_flag); if (speed == XFER_UDMA_5) { pci_write_config_byte(dev, 0x55, (u8) reg55|w_flag); } else { pci_write_config_byte(dev, 0x55, (u8) reg55 & ~w_flag); } - if (!(reg4a & u_speed)) { - pci_write_config_word(dev, 0x4a, reg4a & ~a_speed); - pci_write_config_word(dev, 0x4a, reg4a|u_speed); - } + if ((reg4a & a_speed) != u_speed) + pci_write_config_word(dev, 0x4a, (reg4a & ~a_speed) | u_speed); if (speed > XFER_UDMA_2) { - if (!(reg54 & v_flag)) { - pci_write_config_word(dev, 0x54, reg54|v_flag); - } - } else { - pci_write_config_word(dev, 0x54, reg54 & ~v_flag); - } + if (!(reg54 & v_flag)) + pci_write_config_byte(dev, 0x54, reg54 | v_flag); + } else + pci_write_config_byte(dev, 0x54, reg54 & ~v_flag); } /* move to PCI layer, integrate w/ MSI stuff */ diff -urN linux-2.6.7-rc2/drivers/scsi/esp.c linux-2.6.7-rc3/drivers/scsi/esp.c --- linux-2.6.7-rc2/drivers/scsi/esp.c 2004-05-09 19:33:21.000000000 -0700 +++ linux-2.6.7-rc3/drivers/scsi/esp.c 2004-06-07 12:55:08.802862453 -0700 @@ -25,9 +25,8 @@ #include #include #include +#include -#include "scsi.h" -#include "hosts.h" #include "esp.h" #include @@ -38,13 +37,17 @@ #include #include #include - #ifndef __sparc_v9__ #include #include #endif -#include +#include +#include +#include +#include +#include +#include #define DEBUG_ESP /* #define DEBUG_ESP_HME */ @@ -366,7 +369,7 @@ } #ifdef DEBUG_STATE_MACHINE -static inline void esp_advance_phase(Scsi_Cmnd *s, int newphase) +static inline void esp_advance_phase(struct scsi_cmnd *s, int newphase) { ESPLOG(("<%s>", phase_string(newphase))); s->SCp.sent_command = s->SCp.phase; @@ -419,48 +422,48 @@ * Note that these are per-ESP queues, not global queues like * the aha152x driver uses. */ -static inline void append_SC(Scsi_Cmnd **SC, Scsi_Cmnd *new_SC) +static inline void append_SC(struct scsi_cmnd **SC, struct scsi_cmnd *new_SC) { - Scsi_Cmnd *end; + struct scsi_cmnd *end; new_SC->host_scribble = (unsigned char *) NULL; if (!*SC) *SC = new_SC; else { - for (end=*SC;end->host_scribble;end=(Scsi_Cmnd *)end->host_scribble) + for (end=*SC;end->host_scribble;end=(struct scsi_cmnd *)end->host_scribble) ; end->host_scribble = (unsigned char *) new_SC; } } -static inline void prepend_SC(Scsi_Cmnd **SC, Scsi_Cmnd *new_SC) +static inline void prepend_SC(struct scsi_cmnd **SC, struct scsi_cmnd *new_SC) { new_SC->host_scribble = (unsigned char *) *SC; *SC = new_SC; } -static inline Scsi_Cmnd *remove_first_SC(Scsi_Cmnd **SC) +static inline struct scsi_cmnd *remove_first_SC(struct scsi_cmnd **SC) { - Scsi_Cmnd *ptr; + struct scsi_cmnd *ptr; ptr = *SC; if (ptr) - *SC = (Scsi_Cmnd *) (*SC)->host_scribble; + *SC = (struct scsi_cmnd *) (*SC)->host_scribble; return ptr; } -static inline Scsi_Cmnd *remove_SC(Scsi_Cmnd **SC, int target, int lun) +static inline struct scsi_cmnd *remove_SC(struct scsi_cmnd **SC, int target, int lun) { - Scsi_Cmnd *ptr, *prev; + struct scsi_cmnd *ptr, *prev; for (ptr = *SC, prev = NULL; ptr && ((ptr->device->id != target) || (ptr->device->lun != lun)); - prev = ptr, ptr = (Scsi_Cmnd *) ptr->host_scribble) + prev = ptr, ptr = (struct scsi_cmnd *) ptr->host_scribble) ; if (ptr) { if (prev) prev->host_scribble=ptr->host_scribble; else - *SC=(Scsi_Cmnd *)ptr->host_scribble; + *SC=(struct scsi_cmnd *)ptr->host_scribble; } return ptr; } @@ -1062,7 +1065,7 @@ esp->prev_hme_dmacsr = 0xffffffff; } -static int __init detect_one_esp(Scsi_Host_Template *tpnt, struct sbus_dev *esp_dev, +static int __init detect_one_esp(struct scsi_host_template *tpnt, struct sbus_dev *esp_dev, struct sbus_dev *espdma, struct sbus_bus *sbus, int id, int hme) { @@ -1137,7 +1140,7 @@ #include -static int __init esp_detect(Scsi_Host_Template *tpnt) +static int __init esp_detect(struct scsi_host_template *tpnt) { static struct sbus_dev esp_dev; int esps_in_use = 0; @@ -1162,7 +1165,7 @@ #else /* !CONFIG_SUN4 */ -static int __init esp_detect(Scsi_Host_Template *tpnt) +static int __init esp_detect(struct scsi_host_template *tpnt) { struct sbus_bus *sbus; struct sbus_dev *esp_dev, *sbdev_iter; @@ -1428,7 +1431,7 @@ return esp_host_info(esp, buffer, offset, length); } -static void esp_get_dmabufs(struct esp *esp, Scsi_Cmnd *sp) +static void esp_get_dmabufs(struct esp *esp, struct scsi_cmnd *sp) { if (sp->use_sg == 0) { sp->SCp.this_residual = sp->request_bufflen; @@ -1437,7 +1440,7 @@ if (sp->request_bufflen) { sp->SCp.have_data_in = sbus_map_single(esp->sdev, sp->SCp.buffer, sp->SCp.this_residual, - scsi_to_sbus_dma_dir(sp->sc_data_direction)); + sp->sc_data_direction); sp->SCp.ptr = (char *) ((unsigned long)sp->SCp.have_data_in); } else { sp->SCp.ptr = NULL; @@ -1447,26 +1450,26 @@ sp->SCp.buffers_residual = sbus_map_sg(esp->sdev, sp->SCp.buffer, sp->use_sg, - scsi_to_sbus_dma_dir(sp->sc_data_direction)); + sp->sc_data_direction); sp->SCp.this_residual = sg_dma_len(sp->SCp.buffer); sp->SCp.ptr = (char *) ((unsigned long)sg_dma_address(sp->SCp.buffer)); } } -static void esp_release_dmabufs(struct esp *esp, Scsi_Cmnd *sp) +static void esp_release_dmabufs(struct esp *esp, struct scsi_cmnd *sp) { if (sp->use_sg) { sbus_unmap_sg(esp->sdev, sp->buffer, sp->use_sg, - scsi_to_sbus_dma_dir(sp->sc_data_direction)); + sp->sc_data_direction); } else if (sp->request_bufflen) { sbus_unmap_single(esp->sdev, sp->SCp.have_data_in, sp->request_bufflen, - scsi_to_sbus_dma_dir(sp->sc_data_direction)); + sp->sc_data_direction); } } -static void esp_restore_pointers(struct esp *esp, Scsi_Cmnd *sp) +static void esp_restore_pointers(struct esp *esp, struct scsi_cmnd *sp) { struct esp_pointers *ep = &esp->data_pointers[sp->device->id]; @@ -1476,7 +1479,7 @@ sp->SCp.buffers_residual = ep->saved_buffers_residual; } -static void esp_save_pointers(struct esp *esp, Scsi_Cmnd *sp) +static void esp_save_pointers(struct esp *esp, struct scsi_cmnd *sp) { struct esp_pointers *ep = &esp->data_pointers[sp->device->id]; @@ -1506,7 +1509,7 @@ * case where we could see an interrupt is where we have disconnected * commands active and they are trying to reselect us. */ -static inline void esp_check_cmd(struct esp *esp, Scsi_Cmnd *sp) +static inline void esp_check_cmd(struct esp *esp, struct scsi_cmnd *sp) { switch (sp->cmd_len) { case 6: @@ -1557,8 +1560,8 @@ static void esp_exec_cmd(struct esp *esp) { - Scsi_Cmnd *SCptr; - Scsi_Device *SDptr; + struct scsi_cmnd *SCptr; + struct scsi_device *SDptr; struct esp_device *esp_dev; volatile u8 *cmdp = esp->esp_command; u8 the_esp_command; @@ -1834,7 +1837,7 @@ } /* Queue a SCSI command delivered from the mid-level Linux SCSI code. */ -static int esp_queue(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *)) +static int esp_queue(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) { struct esp *esp; @@ -1871,7 +1874,7 @@ } /* Dump driver state. */ -static void esp_dump_cmd(Scsi_Cmnd *SCptr) +static void esp_dump_cmd(struct scsi_cmnd *SCptr) { ESPLOG(("[tgt<%02x> lun<%02x> " "pphase<%s> cphase<%s>]", @@ -1882,7 +1885,7 @@ static void esp_dump_state(struct esp *esp) { - Scsi_Cmnd *SCptr = esp->current_SC; + struct scsi_cmnd *SCptr = esp->current_SC; #ifdef DEBUG_ESP_CMDS int i; #endif @@ -1921,13 +1924,13 @@ ESPLOG(("esp%d: disconnected ", esp->esp_id)); while (SCptr) { esp_dump_cmd(SCptr); - SCptr = (Scsi_Cmnd *) SCptr->host_scribble; + SCptr = (struct scsi_cmnd *) SCptr->host_scribble; } ESPLOG(("\n")); } /* Abort a command. The host_lock is acquired by caller. */ -static int esp_abort(Scsi_Cmnd *SCptr) +static int esp_abort(struct scsi_cmnd *SCptr) { struct esp *esp = (struct esp *) SCptr->device->host->hostdata; int don; @@ -1957,14 +1960,14 @@ ESP_INTSOFF(esp->dregs); } if (esp->issue_SC) { - Scsi_Cmnd **prev, *this; + struct scsi_cmnd **prev, *this; for (prev = (&esp->issue_SC), this = esp->issue_SC; this != NULL; - prev = (Scsi_Cmnd **) &(this->host_scribble), - this = (Scsi_Cmnd *) this->host_scribble) { + prev = (struct scsi_cmnd **) &(this->host_scribble), + this = (struct scsi_cmnd *) this->host_scribble) { if (this == SCptr) { - *prev = (Scsi_Cmnd *) this->host_scribble; + *prev = (struct scsi_cmnd *) this->host_scribble; this->host_scribble = NULL; esp_release_dmabufs(esp, this); @@ -2010,7 +2013,7 @@ */ static int esp_finish_reset(struct esp *esp) { - Scsi_Cmnd *sp = esp->current_SC; + struct scsi_cmnd *sp = esp->current_SC; /* Clean up currently executing command, if any. */ if (sp != NULL) { @@ -2059,7 +2062,7 @@ * * The host_lock is acquired by caller. */ -static int esp_reset(Scsi_Cmnd *SCptr) +static int esp_reset(struct scsi_cmnd *SCptr) { struct esp *esp = (struct esp *) SCptr->device->host->hostdata; @@ -2077,7 +2080,7 @@ /* Internal ESP done function. */ static void esp_done(struct esp *esp, int error) { - Scsi_Cmnd *done_SC = esp->current_SC; + struct scsi_cmnd *done_SC = esp->current_SC; esp->current_SC = NULL; @@ -2168,7 +2171,7 @@ /* We try to avoid some interrupts by jumping ahead and see if the ESP * has gotten far enough yet. Hence the following. */ -static inline int skipahead1(struct esp *esp, Scsi_Cmnd *scp, +static inline int skipahead1(struct esp *esp, struct scsi_cmnd *scp, int prev_phase, int new_phase) { if (scp->SCp.sent_command != prev_phase) @@ -2202,7 +2205,7 @@ return do_intr_end; } -static inline int skipahead2(struct esp *esp, Scsi_Cmnd *scp, +static inline int skipahead2(struct esp *esp, struct scsi_cmnd *scp, int prev_phase1, int prev_phase2, int new_phase) { if (scp->SCp.sent_command != prev_phase1 && @@ -2318,7 +2321,7 @@ dma_invalidate(esp); } -static int dma_can_transfer(struct esp *esp, Scsi_Cmnd *sp) +static int dma_can_transfer(struct esp *esp, struct scsi_cmnd *sp) { __u32 base, end, sz; @@ -2379,7 +2382,7 @@ * tell the ESP to eat the extraneous byte so that we can proceed * to the next phase. */ -static int esp100_sync_hwbug(struct esp *esp, Scsi_Cmnd *sp, int fifocnt) +static int esp100_sync_hwbug(struct esp *esp, struct scsi_cmnd *sp, int fifocnt) { /* Do not touch this piece of code. */ if ((!(esp->erev == esp100)) || @@ -2479,7 +2482,7 @@ /* This puts the driver in a state where it can revitalize a command that * is being continued due to reselection. */ -static inline void esp_connect(struct esp *esp, Scsi_Cmnd *sp) +static inline void esp_connect(struct esp *esp, struct scsi_cmnd *sp) { struct esp_device *esp_dev = sp->device->hostdata; @@ -2502,7 +2505,7 @@ /* This will place the current working command back into the issue queue * if we are to receive a reselection amidst a selection attempt. */ -static inline void esp_reconnect(struct esp *esp, Scsi_Cmnd *sp) +static inline void esp_reconnect(struct esp *esp, struct scsi_cmnd *sp) { if (!esp->disconnected_SC) ESPLOG(("esp%d: Weird, being reselected but disconnected " @@ -2540,7 +2543,7 @@ return rval - fifo_count; } -static inline void advance_sg(Scsi_Cmnd *sp) +static inline void advance_sg(struct scsi_cmnd *sp) { ++sp->SCp.buffer; --sp->SCp.buffers_residual; @@ -2568,7 +2571,7 @@ */ static int esp_do_data(struct esp *esp) { - Scsi_Cmnd *SCptr = esp->current_SC; + struct scsi_cmnd *SCptr = esp->current_SC; int thisphase, hmuch; ESPDATA(("esp_do_data: ")); @@ -2619,7 +2622,7 @@ /* See how successful the data transfer was. */ static int esp_do_data_finale(struct esp *esp) { - Scsi_Cmnd *SCptr = esp->current_SC; + struct scsi_cmnd *SCptr = esp->current_SC; struct esp_device *esp_dev = SCptr->device->hostdata; int bogus_data = 0, bytes_sent = 0, fifocnt, ecount = 0; @@ -2800,7 +2803,7 @@ * a tape, we don't want to go into a loop re-negotiating * synchronous capabilities over and over. */ -static int esp_should_clear_sync(Scsi_Cmnd *sp) +static int esp_should_clear_sync(struct scsi_cmnd *sp) { u8 cmd1 = sp->cmnd[0]; u8 cmd2 = sp->data_cmnd[0]; @@ -2834,7 +2837,7 @@ */ static int esp_do_freebus(struct esp *esp) { - Scsi_Cmnd *SCptr = esp->current_SC; + struct scsi_cmnd *SCptr = esp->current_SC; struct esp_device *esp_dev = SCptr->device->hostdata; int rval; @@ -2905,7 +2908,7 @@ */ static int esp_bad_reconnect(struct esp *esp) { - Scsi_Cmnd *sp; + struct scsi_cmnd *sp; ESPLOG(("esp%d: Eieeee, reconnecting unknown command!\n", esp->esp_id)); @@ -2914,7 +2917,7 @@ ESPLOG(("esp%d: issue_SC[", esp->esp_id)); while (sp) { ESPLOG(("<%02x,%02x>", sp->device->id, sp->device->lun)); - sp = (Scsi_Cmnd *) sp->host_scribble; + sp = (struct scsi_cmnd *) sp->host_scribble; } ESPLOG(("]\n")); sp = esp->current_SC; @@ -2928,7 +2931,7 @@ ESPLOG(("esp%d: disconnected_SC[", esp->esp_id)); while (sp) { ESPLOG(("<%02x,%02x>", sp->device->id, sp->device->lun)); - sp = (Scsi_Cmnd *) sp->host_scribble; + sp = (struct scsi_cmnd *) sp->host_scribble; } ESPLOG(("]\n")); return do_reset_bus; @@ -2938,7 +2941,7 @@ static int esp_do_reconnect(struct esp *esp) { int lun, target; - Scsi_Cmnd *SCptr; + struct scsi_cmnd *SCptr; /* Check for all bogus conditions first. */ target = reconnect_target(esp); @@ -2988,7 +2991,7 @@ */ static int esp_do_status(struct esp *esp) { - Scsi_Cmnd *SCptr = esp->current_SC; + struct scsi_cmnd *SCptr = esp->current_SC; int intr, rval; rval = skipahead1(esp, SCptr, in_the_dark, in_status); @@ -3133,7 +3136,7 @@ static int esp_disconnect_amidst_phases(struct esp *esp) { - Scsi_Cmnd *sp = esp->current_SC; + struct scsi_cmnd *sp = esp->current_SC; struct esp_device *esp_dev = sp->device->hostdata; /* This means real problems if we see this @@ -3226,7 +3229,7 @@ /* First interrupt after exec'ing a cmd comes here. */ static int esp_select_complete(struct esp *esp) { - Scsi_Cmnd *SCptr = esp->current_SC; + struct scsi_cmnd *SCptr = esp->current_SC; struct esp_device *esp_dev = SCptr->device->hostdata; int cmd_bytes_sent, fcnt; @@ -3582,7 +3585,7 @@ * this because so many initiators cannot cope with this occurring. */ static int target_with_ants_in_pants(struct esp *esp, - Scsi_Cmnd *SCptr, + struct scsi_cmnd *SCptr, struct esp_device *esp_dev) { if (esp_dev->sync || SCptr->device->borken) { @@ -3641,7 +3644,7 @@ static int check_multibyte_msg(struct esp *esp) { - Scsi_Cmnd *SCptr = esp->current_SC; + struct scsi_cmnd *SCptr = esp->current_SC; struct esp_device *esp_dev = SCptr->device->hostdata; u8 regval = 0; int message_out = 0; @@ -3822,7 +3825,7 @@ static int esp_do_msgindone(struct esp *esp) { - Scsi_Cmnd *SCptr = esp->current_SC; + struct scsi_cmnd *SCptr = esp->current_SC; int message_out = 0, it = 0, rval; rval = skipahead1(esp, SCptr, in_msgin, in_msgindone); @@ -3904,7 +3907,7 @@ static int esp_do_cmdbegin(struct esp *esp) { - Scsi_Cmnd *SCptr = esp->current_SC; + struct scsi_cmnd *SCptr = esp->current_SC; esp_advance_phase(SCptr, in_cmdend); if (esp->erev == fashme) { @@ -4125,7 +4128,7 @@ /* This is the second tier in our dual-level SCSI state machine. */ static int esp_work_bus(struct esp *esp) { - Scsi_Cmnd *SCptr = esp->current_SC; + struct scsi_cmnd *SCptr = esp->current_SC; unsigned int phase; ESPBUS(("esp_work_bus: ")); @@ -4153,7 +4156,7 @@ /* Main interrupt handler for an esp adapter. */ static void esp_handle(struct esp *esp) { - Scsi_Cmnd *SCptr; + struct scsi_cmnd *SCptr; int what_next = do_intr_end; SCptr = esp->current_SC; @@ -4353,7 +4356,7 @@ return IRQ_HANDLED; } -static int esp_slave_alloc(Scsi_Device *SDptr) +static int esp_slave_alloc(struct scsi_device *SDptr) { struct esp_device *esp_dev = kmalloc(sizeof(struct esp_device), GFP_ATOMIC); @@ -4365,7 +4368,7 @@ return 0; } -static void esp_slave_destroy(Scsi_Device *SDptr) +static void esp_slave_destroy(struct scsi_device *SDptr) { struct esp *esp = (struct esp *) SDptr->host->hostdata; @@ -4374,7 +4377,7 @@ SDptr->hostdata = NULL; } -static Scsi_Host_Template driver_template = { +static struct scsi_host_template driver_template = { .proc_name = "esp", .proc_info = esp_proc_info, .name = "Sun ESP 100/100a/200", diff -urN linux-2.6.7-rc2/drivers/scsi/esp.h linux-2.6.7-rc3/drivers/scsi/esp.h --- linux-2.6.7-rc2/drivers/scsi/esp.h 2004-05-09 19:31:59.000000000 -0700 +++ linux-2.6.7-rc3/drivers/scsi/esp.h 2004-06-07 12:55:08.804862536 -0700 @@ -8,8 +8,6 @@ #ifndef _SPARC_ESP_H #define _SPARC_ESP_H -#include - /* For dvma controller register definitions. */ #include @@ -75,6 +73,8 @@ unsigned disconnect:1; }; +struct scsi_cmnd; + /* We get one of these for each ESP probed. */ struct esp { unsigned long eregs; /* ESP controller registers */ @@ -181,9 +181,9 @@ int bursts; /* Burst sizes our DVMA supports */ /* Our command queues, only one cmd lives in the current_SC queue. */ - Scsi_Cmnd *issue_SC; /* Commands to be issued */ - Scsi_Cmnd *current_SC; /* Who is currently working the bus */ - Scsi_Cmnd *disconnected_SC;/* Commands disconnected from the bus */ + struct scsi_cmnd *issue_SC; /* Commands to be issued */ + struct scsi_cmnd *current_SC; /* Who is currently working the bus */ + struct scsi_cmnd *disconnected_SC;/* Commands disconnected from the bus */ /* Message goo */ u8 cur_msgout[16]; diff -urN linux-2.6.7-rc2/drivers/scsi/gdth.c linux-2.6.7-rc3/drivers/scsi/gdth.c --- linux-2.6.7-rc2/drivers/scsi/gdth.c 2004-06-07 12:54:49.447060795 -0700 +++ linux-2.6.7-rc3/drivers/scsi/gdth.c 2004-06-07 12:55:08.885865891 -0700 @@ -3520,7 +3520,7 @@ GDTH_UNLOCK_HA(ha, flags); } -static void gdth_clear_events() +static void gdth_clear_events(void) { TRACE(("gdth_clear_events()")); @@ -5293,13 +5293,13 @@ return 0; } -static int ioc_event(unsigned long arg) +static int ioc_event(void __user *arg) { gdth_ioctl_event evt; gdth_ha_str *ha; ulong flags; - if (copy_from_user(&evt, (char *)arg, sizeof(gdth_ioctl_event)) || + if (copy_from_user(&evt, arg, sizeof(gdth_ioctl_event)) || evt.ionode >= gdth_ctr_count) return -EFAULT; ha = HADATA(gdth_ctr_tab[evt.ionode]); @@ -5324,19 +5324,19 @@ } else { gdth_readapp_event(ha, evt.erase, &evt.event); } - if (copy_to_user((char *)arg, &evt, sizeof(gdth_ioctl_event))) + if (copy_to_user(arg, &evt, sizeof(gdth_ioctl_event))) return -EFAULT; return 0; } -static int ioc_lockdrv(unsigned long arg) +static int ioc_lockdrv(void __user *arg) { gdth_ioctl_lockdrv ldrv; unchar i, j; ulong flags; gdth_ha_str *ha; - if (copy_from_user(&ldrv, (char *)arg, sizeof(gdth_ioctl_lockdrv)) || + if (copy_from_user(&ldrv, arg, sizeof(gdth_ioctl_lockdrv)) || ldrv.ionode >= gdth_ctr_count) return -EFAULT; ha = HADATA(gdth_ctr_tab[ldrv.ionode]); @@ -5362,7 +5362,7 @@ return 0; } -static int ioc_resetdrv(unsigned long arg, char *cmnd) +static int ioc_resetdrv(void __user *arg, char *cmnd) { gdth_ioctl_reset res; gdth_cmd_str cmd; @@ -5376,7 +5376,7 @@ Scsi_Cmnd scp; #endif - if (copy_from_user(&res, (char *)arg, sizeof(gdth_ioctl_reset)) || + if (copy_from_user(&res, arg, sizeof(gdth_ioctl_reset)) || res.ionode >= gdth_ctr_count || res.number >= MAX_HDRIVES) return -EFAULT; hanum = res.ionode; @@ -5418,12 +5418,12 @@ gdth_do_cmd(&scp, &cmd, cmnd, 30); res.status = (ushort)scp.SCp.Status; #endif - if (copy_to_user((char *)arg, &res, sizeof(gdth_ioctl_reset))) + if (copy_to_user(arg, &res, sizeof(gdth_ioctl_reset))) return -EFAULT; return 0; } -static int ioc_general(unsigned long arg, char *cmnd) +static int ioc_general(void __user *arg, char *cmnd) { gdth_ioctl_general gen; char *buf = NULL; @@ -5438,7 +5438,7 @@ Scsi_Cmnd scp; #endif - if (copy_from_user(&gen, (char *)arg, sizeof(gdth_ioctl_general)) || + if (copy_from_user(&gen, arg, sizeof(gdth_ioctl_general)) || gen.ionode >= gdth_ctr_count) return -EFAULT; hanum = gen.ionode; @@ -5447,7 +5447,7 @@ if (!(buf = gdth_ioctl_alloc(hanum, gen.data_len + gen.sense_len, FALSE, &paddr))) return -EFAULT; - if (copy_from_user(buf, (char *)arg + sizeof(gdth_ioctl_general), + if (copy_from_user(buf, arg + sizeof(gdth_ioctl_general), gen.data_len + gen.sense_len)) { gdth_ioctl_free(hanum, gen.data_len+gen.sense_len, buf, paddr); return -EFAULT; @@ -5559,12 +5559,12 @@ gen.info = scp.SCp.Message; #endif - if (copy_to_user((char *)arg + sizeof(gdth_ioctl_general), buf, + if (copy_to_user(arg + sizeof(gdth_ioctl_general), buf, gen.data_len + gen.sense_len)) { gdth_ioctl_free(hanum, gen.data_len+gen.sense_len, buf, paddr); return -EFAULT; } - if (copy_to_user((char *)arg, &gen, + if (copy_to_user(arg, &gen, sizeof(gdth_ioctl_general) - sizeof(gdth_cmd_str))) { gdth_ioctl_free(hanum, gen.data_len+gen.sense_len, buf, paddr); return -EFAULT; @@ -5573,7 +5573,7 @@ return 0; } -static int ioc_hdrlist(unsigned long arg, char *cmnd) +static int ioc_hdrlist(void __user *arg, char *cmnd) { gdth_ioctl_rescan rsc; gdth_cmd_str cmd; @@ -5588,7 +5588,7 @@ Scsi_Cmnd scp; #endif - if (copy_from_user(&rsc, (char *)arg, sizeof(gdth_ioctl_rescan)) || + if (copy_from_user(&rsc, arg, sizeof(gdth_ioctl_rescan)) || rsc.ionode >= gdth_ctr_count) return -EFAULT; hanum = rsc.ionode; @@ -5652,12 +5652,12 @@ scsi_release_command(scp); #endif - if (copy_to_user((char *)arg, &rsc, sizeof(gdth_ioctl_rescan))) + if (copy_to_user(arg, &rsc, sizeof(gdth_ioctl_rescan))) return -EFAULT; return 0; } -static int ioc_rescan(unsigned long arg, char *cmnd) +static int ioc_rescan(void __user *arg, char *cmnd) { gdth_ioctl_rescan rsc; gdth_cmd_str cmd; @@ -5674,7 +5674,7 @@ Scsi_Cmnd scp; #endif - if (copy_from_user(&rsc, (char *)arg, sizeof(gdth_ioctl_rescan)) || + if (copy_from_user(&rsc, arg, sizeof(gdth_ioctl_rescan)) || rsc.ionode >= gdth_ctr_count) return -EFAULT; hanum = rsc.ionode; @@ -5852,7 +5852,7 @@ scsi_release_command(scp); #endif - if (copy_to_user((char *)arg, &rsc, sizeof(gdth_ioctl_rescan))) + if (copy_to_user(arg, &rsc, sizeof(gdth_ioctl_rescan))) return -EFAULT; return 0; } @@ -5870,6 +5870,7 @@ #endif ulong flags; char cmnd[MAX_COMMAND_SIZE]; + void __user *argp = (void __user *)arg; memset(cmnd, 0xff, 12); @@ -5879,7 +5880,7 @@ case GDTIOCTL_CTRCNT: { int cnt = gdth_ctr_count; - if (put_user(cnt, (int *)arg)) + if (put_user(cnt, (int __user *)argp)) return -EFAULT; break; } @@ -5887,7 +5888,7 @@ case GDTIOCTL_DRVERS: { int ver = (GDTH_VERSION<<8) | GDTH_SUBVERSION; - if (put_user(ver, (int *)arg)) + if (put_user(ver, (int __user *)argp)) return -EFAULT; break; } @@ -5899,7 +5900,7 @@ osv.version = (unchar)(LINUX_VERSION_CODE >> 16); osv.subversion = (unchar)(LINUX_VERSION_CODE >> 8); osv.revision = (ushort)(LINUX_VERSION_CODE & 0xff); - if (copy_to_user((char *)arg, &osv, sizeof(gdth_ioctl_osvers))) + if (copy_to_user(argp, &osv, sizeof(gdth_ioctl_osvers))) return -EFAULT; break; } @@ -5908,7 +5909,7 @@ { gdth_ioctl_ctrtype ctrt; - if (copy_from_user(&ctrt, (char *)arg, sizeof(gdth_ioctl_ctrtype)) || + if (copy_from_user(&ctrt, argp, sizeof(gdth_ioctl_ctrtype)) || ctrt.ionode >= gdth_ctr_count) return -EFAULT; ha = HADATA(gdth_ctr_tab[ctrt.ionode]); @@ -5930,26 +5931,26 @@ } ctrt.info = ha->brd_phys; ctrt.oem_id = ha->oem_id; - if (copy_to_user((char *)arg, &ctrt, sizeof(gdth_ioctl_ctrtype))) + if (copy_to_user(argp, &ctrt, sizeof(gdth_ioctl_ctrtype))) return -EFAULT; break; } case GDTIOCTL_GENERAL: - return ioc_general(arg, cmnd); + return ioc_general(argp, cmnd); case GDTIOCTL_EVENT: - return ioc_event(arg); + return ioc_event(argp); case GDTIOCTL_LOCKDRV: - return ioc_lockdrv(arg); + return ioc_lockdrv(argp); case GDTIOCTL_LOCKCHN: { gdth_ioctl_lockchn lchn; unchar i, j; - if (copy_from_user(&lchn, (char *)arg, sizeof(gdth_ioctl_lockchn)) || + if (copy_from_user(&lchn, argp, sizeof(gdth_ioctl_lockchn)) || lchn.ionode >= gdth_ctr_count) return -EFAULT; ha = HADATA(gdth_ctr_tab[lchn.ionode]); @@ -5978,17 +5979,17 @@ } case GDTIOCTL_RESCAN: - return ioc_rescan(arg, cmnd); + return ioc_rescan(argp, cmnd); case GDTIOCTL_HDRLIST: - return ioc_hdrlist(arg, cmnd); + return ioc_hdrlist(argp, cmnd); case GDTIOCTL_RESET_BUS: { gdth_ioctl_reset res; int hanum, rval; - if (copy_from_user(&res, (char *)arg, sizeof(gdth_ioctl_reset)) || + if (copy_from_user(&res, argp, sizeof(gdth_ioctl_reset)) || res.ionode >= gdth_ctr_count) return -EFAULT; hanum = res.ionode; @@ -6025,13 +6026,13 @@ rval = gdth_eh_bus_reset(&scp); res.status = (rval == SUCCESS ? S_OK : S_GENERR); #endif - if (copy_to_user((char *)arg, &res, sizeof(gdth_ioctl_reset))) + if (copy_to_user(argp, &res, sizeof(gdth_ioctl_reset))) return -EFAULT; break; } case GDTIOCTL_RESET_DRV: - return ioc_resetdrv(arg, cmnd); + return ioc_resetdrv(argp, cmnd); default: break; diff -urN linux-2.6.7-rc2/drivers/scsi/libata-core.c linux-2.6.7-rc3/drivers/scsi/libata-core.c --- linux-2.6.7-rc2/drivers/scsi/libata-core.c 2004-06-07 12:54:49.476061996 -0700 +++ linux-2.6.7-rc3/drivers/scsi/libata-core.c 2004-06-07 12:55:09.430888465 -0700 @@ -39,7 +39,7 @@ #include #include #include "scsi.h" -#include "hosts.h" +#include #include #include #include diff -urN linux-2.6.7-rc2/drivers/scsi/libata-scsi.c linux-2.6.7-rc3/drivers/scsi/libata-scsi.c --- linux-2.6.7-rc2/drivers/scsi/libata-scsi.c 2004-06-07 12:54:49.477062037 -0700 +++ linux-2.6.7-rc3/drivers/scsi/libata-scsi.c 2004-06-07 12:55:09.433888590 -0700 @@ -27,7 +27,7 @@ #include #include #include "scsi.h" -#include "hosts.h" +#include #include #include "libata.h" @@ -1156,6 +1156,7 @@ switch(scsicmd[0]) { /* no-op's, complete with success */ + case SYNCHRONIZE_CACHE: /* FIXME: temporary */ case REZERO_UNIT: case SEEK_6: case SEEK_10: diff -urN linux-2.6.7-rc2/drivers/scsi/osst.c linux-2.6.7-rc3/drivers/scsi/osst.c --- linux-2.6.7-rc2/drivers/scsi/osst.c 2004-06-07 12:54:49.493062700 -0700 +++ linux-2.6.7-rc3/drivers/scsi/osst.c 2004-06-07 12:55:09.788903294 -0700 @@ -154,8 +154,8 @@ static OSST_buffer *new_tape_buffer(int, int, int); static int enlarge_buffer(OSST_buffer *, int); static void normalize_buffer(OSST_buffer *); -static int append_to_buffer(const char *, OSST_buffer *, int); -static int from_buffer(OSST_buffer *, char *, int); +static int append_to_buffer(const char __user *, OSST_buffer *, int); +static int from_buffer(OSST_buffer *, char __user *, int); static int osst_zero_buffer_tail(OSST_buffer *); static int osst_copy_to_buffer(OSST_buffer *, unsigned char *); static int osst_copy_from_buffer(OSST_buffer *, unsigned char *); @@ -3157,13 +3157,13 @@ /* Entry points to osst */ /* Write command */ -static ssize_t osst_write(struct file * filp, const char * buf, size_t count, loff_t *ppos) +static ssize_t osst_write(struct file * filp, const char __user * buf, size_t count, loff_t *ppos) { ssize_t total, retval = 0; ssize_t i, do_count, blks, transfer; int write_threshold; int doing_write = 0; - const char * b_point; + const char __user * b_point; Scsi_Request * SRpnt = NULL; ST_mode * STm; ST_partstat * STps; @@ -3486,7 +3486,7 @@ /* Read command */ -static ssize_t osst_read(struct file * filp, char * buf, size_t count, loff_t *ppos) +static ssize_t osst_read(struct file * filp, char __user * buf, size_t count, loff_t *ppos) { ssize_t total, retval = 0; ssize_t i, transfer; @@ -5189,7 +5189,7 @@ /* Move data from the user buffer to the tape buffer. Returns zero (success) or negative error code. */ -static int append_to_buffer(const char *ubp, OSST_buffer *st_bp, int do_count) +static int append_to_buffer(const char __user *ubp, OSST_buffer *st_bp, int do_count) { int i, cnt, res, offset; @@ -5222,7 +5222,7 @@ /* Move data from the tape buffer to the user buffer. Returns zero (success) or negative error code. */ -static int from_buffer(OSST_buffer *st_bp, char *ubp, int do_count) +static int from_buffer(OSST_buffer *st_bp, char __user *ubp, int do_count) { int i, cnt, res, offset; diff -urN linux-2.6.7-rc2/drivers/scsi/qlogicpti.c linux-2.6.7-rc3/drivers/scsi/qlogicpti.c --- linux-2.6.7-rc2/drivers/scsi/qlogicpti.c 2004-05-09 19:32:53.000000000 -0700 +++ linux-2.6.7-rc3/drivers/scsi/qlogicpti.c 2004-06-07 12:55:11.605978555 -0700 @@ -23,11 +23,10 @@ #include #include #include +#include #include -#include "scsi.h" -#include "hosts.h" #include "qlogicpti.h" #include @@ -39,7 +38,15 @@ #include #include -#include +#include +#include +#include +#include +#include +#include +#include + + #define MAX_TARGETS 16 #define MAX_LUNS 8 /* 32 for 1.31 F/W */ @@ -809,7 +816,7 @@ } /* Detect all PTI Qlogic ISP's in the machine. */ -static int __init qlogicpti_detect(Scsi_Host_Template *tpnt) +static int __init qlogicpti_detect(struct scsi_host_template *tpnt) { struct qlogicpti *qpti; struct Scsi_Host *qpti_host; @@ -878,7 +885,7 @@ qpti_get_bursts(qpti); qpti_get_clock(qpti); - /* Clear out Scsi_Cmnd array. */ + /* Clear out scsi_cmnd array. */ memset(qpti->cmd_slots, 0, sizeof(qpti->cmd_slots)); if (qpti_map_queues(qpti) < 0) @@ -997,7 +1004,7 @@ marker->rsvd = 0; } -static inline void cmd_frob(struct Command_Entry *cmd, Scsi_Cmnd *Cmnd, +static inline void cmd_frob(struct Command_Entry *cmd, struct scsi_cmnd *Cmnd, struct qlogicpti *qpti) { memset(cmd, 0, sizeof(struct Command_Entry)); @@ -1027,7 +1034,7 @@ } /* Do it to it baby. */ -static inline int load_cmd(Scsi_Cmnd *Cmnd, struct Command_Entry *cmd, +static inline int load_cmd(struct scsi_cmnd *Cmnd, struct Command_Entry *cmd, struct qlogicpti *qpti, u_int in_ptr, u_int out_ptr) { struct dataseg *ds; @@ -1038,7 +1045,7 @@ int sg_count; sg = (struct scatterlist *) Cmnd->buffer; - sg_count = sbus_map_sg(qpti->sdev, sg, Cmnd->use_sg, scsi_to_sbus_dma_dir(Cmnd->sc_data_direction)); + sg_count = sbus_map_sg(qpti->sdev, sg, Cmnd->use_sg, Cmnd->sc_data_direction); ds = cmd->dataseg; cmd->segment_cnt = sg_count; @@ -1081,7 +1088,7 @@ sbus_map_single(qpti->sdev, Cmnd->request_buffer, Cmnd->request_bufflen, - scsi_to_sbus_dma_dir(Cmnd->sc_data_direction)); + Cmnd->sc_data_direction); cmd->dataseg[0].d_base = (u32) ((unsigned long)Cmnd->SCp.ptr); cmd->dataseg[0].d_count = Cmnd->request_bufflen; @@ -1115,11 +1122,11 @@ /* * Until we scan the entire bus with inquiries, go throught this fella... */ -static void ourdone(Scsi_Cmnd *Cmnd) +static void ourdone(struct scsi_cmnd *Cmnd) { struct qlogicpti *qpti = (struct qlogicpti *) Cmnd->device->host->hostdata; int tgt = Cmnd->device->id; - void (*done) (Scsi_Cmnd *); + void (*done) (struct scsi_cmnd *); /* This grot added by DaveM, blame him for ugliness. * The issue is that in the 2.3.x driver we use the @@ -1127,7 +1134,7 @@ * completion linked list at interrupt service time, * so we have to store the done function pointer elsewhere. */ - done = (void (*)(Scsi_Cmnd *)) + done = (void (*)(struct scsi_cmnd *)) (((unsigned long) Cmnd->SCp.Message) #ifdef __sparc_v9__ | ((unsigned long) Cmnd->SCp.Status << 32UL) @@ -1164,10 +1171,10 @@ done(Cmnd); } -static int qlogicpti_queuecommand(Scsi_Cmnd *Cmnd, void (*done)(Scsi_Cmnd *)); +static int qlogicpti_queuecommand(struct scsi_cmnd *Cmnd, void (*done)(struct scsi_cmnd *)); -static int qlogicpti_queuecommand_slow(Scsi_Cmnd *Cmnd, - void (*done)(Scsi_Cmnd *)) +static int qlogicpti_queuecommand_slow(struct scsi_cmnd *Cmnd, + void (*done)(struct scsi_cmnd *)) { struct qlogicpti *qpti = (struct qlogicpti *) Cmnd->device->host->hostdata; @@ -1238,7 +1245,7 @@ * * "This code must fly." -davem */ -static int qlogicpti_queuecommand(Scsi_Cmnd *Cmnd, void (*done)(Scsi_Cmnd *)) +static int qlogicpti_queuecommand(struct scsi_cmnd *Cmnd, void (*done)(struct scsi_cmnd *)) { struct Scsi_Host *host = Cmnd->device->host; struct qlogicpti *qpti = (struct qlogicpti *) host->hostdata; @@ -1351,9 +1358,9 @@ return (sts->scsi_status & STATUS_MASK) | (host_status << 16); } -static Scsi_Cmnd *qlogicpti_intr_handler(struct qlogicpti *qpti) +static struct scsi_cmnd *qlogicpti_intr_handler(struct qlogicpti *qpti) { - Scsi_Cmnd *Cmnd, *done_queue = NULL; + struct scsi_cmnd *Cmnd, *done_queue = NULL; struct Status_Entry *sts; u_int in_ptr, out_ptr; @@ -1412,12 +1419,12 @@ sbus_unmap_sg(qpti->sdev, (struct scatterlist *)Cmnd->buffer, Cmnd->use_sg, - scsi_to_sbus_dma_dir(Cmnd->sc_data_direction)); + Cmnd->sc_data_direction); } else { sbus_unmap_single(qpti->sdev, (__u32)((unsigned long)Cmnd->SCp.ptr), Cmnd->request_bufflen, - scsi_to_sbus_dma_dir(Cmnd->sc_data_direction)); + Cmnd->sc_data_direction); } qpti->cmd_count[Cmnd->device->id]--; sbus_writew(out_ptr, qpti->qregs + MBOX5); @@ -1433,16 +1440,16 @@ { struct qlogicpti *qpti = dev_id; unsigned long flags; - Scsi_Cmnd *dq; + struct scsi_cmnd *dq; spin_lock_irqsave(qpti->qhost->host_lock, flags); dq = qlogicpti_intr_handler(qpti); if (dq != NULL) { do { - Scsi_Cmnd *next; + struct scsi_cmnd *next; - next = (Scsi_Cmnd *) dq->host_scribble; + next = (struct scsi_cmnd *) dq->host_scribble; dq->scsi_done(dq); dq = next; } while (dq != NULL); @@ -1452,7 +1459,7 @@ return IRQ_HANDLED; } -static int qlogicpti_abort(Scsi_Cmnd *Cmnd) +static int qlogicpti_abort(struct scsi_cmnd *Cmnd) { u_short param[6]; struct Scsi_Host *host = Cmnd->device->host; @@ -1489,7 +1496,7 @@ return return_status; } -static int qlogicpti_reset(Scsi_Cmnd *Cmnd) +static int qlogicpti_reset(struct scsi_cmnd *Cmnd) { u_short param[6]; struct Scsi_Host *host = Cmnd->device->host; @@ -1513,7 +1520,7 @@ return return_status; } -static Scsi_Host_Template driver_template = { +static struct scsi_host_template driver_template = { .detect = qlogicpti_detect, .release = qlogicpti_release, .info = qlogicpti_info, diff -urN linux-2.6.7-rc2/drivers/scsi/qlogicpti.h linux-2.6.7-rc3/drivers/scsi/qlogicpti.h --- linux-2.6.7-rc2/drivers/scsi/qlogicpti.h 2004-05-09 19:32:01.000000000 -0700 +++ linux-2.6.7-rc3/drivers/scsi/qlogicpti.h 2004-06-07 12:55:11.636979839 -0700 @@ -6,8 +6,6 @@ #ifndef _QLOGICPTI_H #define _QLOGICPTI_H -#include - /* Qlogic/SBUS controller registers. */ #define SBUS_CFG1 0x006UL #define SBUS_CTRL 0x008UL @@ -332,6 +330,8 @@ char __opaque[QUEUE_ENTRY_LEN]; }; +struct scsi_cmnd; + /* Software state for the driver. */ struct qlogicpti { /* These are the hot elements in the cache, so they come first. */ @@ -352,7 +352,7 @@ * Ex000 sparc64 machines with >4GB of ram we just keep track of the * scsi command pointers here. This is essentially what Matt Jacob does. -DaveM */ - Scsi_Cmnd *cmd_slots[QLOGICPTI_REQ_QUEUE_LEN + 1]; + struct scsi_cmnd *cmd_slots[QLOGICPTI_REQ_QUEUE_LEN + 1]; /* The rest of the elements are unimportant for performance. */ struct qlogicpti *next; diff -urN linux-2.6.7-rc2/drivers/scsi/sata_promise.c linux-2.6.7-rc3/drivers/scsi/sata_promise.c --- linux-2.6.7-rc2/drivers/scsi/sata_promise.c 2004-06-07 12:54:49.718072019 -0700 +++ linux-2.6.7-rc3/drivers/scsi/sata_promise.c 2004-06-07 12:55:11.640980005 -0700 @@ -34,7 +34,7 @@ #include #include #include "scsi.h" -#include "hosts.h" +#include #include #include #include "sata_promise.h" @@ -457,14 +457,14 @@ static void pdc_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf) { - if (tf->protocol == ATA_PROT_PIO) + if (tf->protocol != ATA_PROT_DMA) ata_tf_load_mmio(ap, tf); } static void pdc_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf) { - if (tf->protocol == ATA_PROT_PIO) + if (tf->protocol != ATA_PROT_DMA) ata_exec_command_mmio(ap, tf); } diff -urN linux-2.6.7-rc2/drivers/scsi/sata_sil.c linux-2.6.7-rc3/drivers/scsi/sata_sil.c --- linux-2.6.7-rc2/drivers/scsi/sata_sil.c 2004-06-07 12:54:49.720072102 -0700 +++ linux-2.6.7-rc3/drivers/scsi/sata_sil.c 2004-06-07 12:55:11.641980046 -0700 @@ -34,7 +34,7 @@ #include #include #include "scsi.h" -#include "hosts.h" +#include #include #define DRV_NAME "sata_sil" diff -urN linux-2.6.7-rc2/drivers/scsi/sata_sis.c linux-2.6.7-rc3/drivers/scsi/sata_sis.c --- linux-2.6.7-rc2/drivers/scsi/sata_sis.c 2004-06-07 12:54:49.720072102 -0700 +++ linux-2.6.7-rc3/drivers/scsi/sata_sis.c 2004-06-07 12:55:11.650980419 -0700 @@ -34,7 +34,7 @@ #include #include #include "scsi.h" -#include "hosts.h" +#include #include #define DRV_NAME "sata_sis" diff -urN linux-2.6.7-rc2/drivers/scsi/sata_svw.c linux-2.6.7-rc3/drivers/scsi/sata_svw.c --- linux-2.6.7-rc2/drivers/scsi/sata_svw.c 2004-06-07 12:54:49.720072102 -0700 +++ linux-2.6.7-rc3/drivers/scsi/sata_svw.c 2004-06-07 12:55:11.651980460 -0700 @@ -40,7 +40,7 @@ #include #include #include "scsi.h" -#include "hosts.h" +#include #include #ifdef CONFIG_PPC_OF diff -urN linux-2.6.7-rc2/drivers/scsi/sata_sx4.c linux-2.6.7-rc3/drivers/scsi/sata_sx4.c --- linux-2.6.7-rc2/drivers/scsi/sata_sx4.c 2004-06-07 12:54:49.723072226 -0700 +++ linux-2.6.7-rc3/drivers/scsi/sata_sx4.c 2004-06-07 12:55:11.653980543 -0700 @@ -34,7 +34,7 @@ #include #include #include "scsi.h" -#include "hosts.h" +#include #include #include #include "sata_promise.h" @@ -826,14 +826,14 @@ static void pdc_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf) { - if (tf->protocol == ATA_PROT_PIO) + if (tf->protocol != ATA_PROT_DMA) ata_tf_load_mmio(ap, tf); } static void pdc_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf) { - if (tf->protocol == ATA_PROT_PIO) + if (tf->protocol != ATA_PROT_DMA) ata_exec_command_mmio(ap, tf); } diff -urN linux-2.6.7-rc2/drivers/scsi/sata_via.c linux-2.6.7-rc3/drivers/scsi/sata_via.c --- linux-2.6.7-rc2/drivers/scsi/sata_via.c 2004-06-07 12:54:49.723072226 -0700 +++ linux-2.6.7-rc3/drivers/scsi/sata_via.c 2004-06-07 12:55:11.655980626 -0700 @@ -33,7 +33,7 @@ #include #include #include "scsi.h" -#include "hosts.h" +#include #include #include diff -urN linux-2.6.7-rc2/drivers/scsi/sata_vsc.c linux-2.6.7-rc3/drivers/scsi/sata_vsc.c --- linux-2.6.7-rc2/drivers/scsi/sata_vsc.c 2004-06-07 12:54:49.724072267 -0700 +++ linux-2.6.7-rc3/drivers/scsi/sata_vsc.c 2004-06-07 12:55:11.693982200 -0700 @@ -22,7 +22,7 @@ #include #include #include "scsi.h" -#include "hosts.h" +#include #include #define DRV_NAME "sata_vsc" diff -urN linux-2.6.7-rc2/drivers/scsi/scsi_debug.c linux-2.6.7-rc3/drivers/scsi/scsi_debug.c --- linux-2.6.7-rc2/drivers/scsi/scsi_debug.c 2004-05-09 19:32:51.000000000 -0700 +++ linux-2.6.7-rc3/drivers/scsi/scsi_debug.c 2004-06-07 12:55:11.774985555 -0700 @@ -1461,7 +1461,7 @@ DRIVER_ATTR(add_host, S_IRUGO | S_IWUSR, sdebug_add_host_show, sdebug_add_host_store) -static void do_create_driverfs_files() +static void do_create_driverfs_files(void) { driver_create_file(&sdebug_driverfs_driver, &driver_attr_delay); driver_create_file(&sdebug_driverfs_driver, &driver_attr_opts); @@ -1473,7 +1473,7 @@ driver_create_file(&sdebug_driverfs_driver, &driver_attr_add_host); } -static void do_remove_driverfs_files() +static void do_remove_driverfs_files(void) { driver_remove_file(&sdebug_driverfs_driver, &driver_attr_add_host); driver_remove_file(&sdebug_driverfs_driver, &driver_attr_scsi_level); @@ -1594,7 +1594,7 @@ kfree(sdbg_host); } -static int sdebug_add_adapter() +static int sdebug_add_adapter(void) { int k, devs_per_host; int error = 0; @@ -1657,7 +1657,7 @@ return error; } -static void sdebug_remove_adapter() +static void sdebug_remove_adapter(void) { struct sdebug_host_info * sdbg_host = NULL; diff -urN linux-2.6.7-rc2/drivers/scsi/st.c linux-2.6.7-rc3/drivers/scsi/st.c --- linux-2.6.7-rc2/drivers/scsi/st.c 2004-06-07 12:54:49.743073054 -0700 +++ linux-2.6.7-rc3/drivers/scsi/st.c 2004-06-07 12:55:12.254005395 -0700 @@ -176,8 +176,8 @@ static ST_buffer *new_tape_buffer(int, int, int); static int enlarge_buffer(ST_buffer *, int, int); static void normalize_buffer(ST_buffer *); -static int append_to_buffer(const char *, ST_buffer *, int); -static int from_buffer(ST_buffer *, char *, int); +static int append_to_buffer(const char __user *, ST_buffer *, int); +static int from_buffer(ST_buffer *, char __user *, int); static void move_buffer_data(ST_buffer *, int); static void buf_to_sg(ST_buffer *, unsigned int); @@ -1276,7 +1276,7 @@ } -static int setup_buffering(Scsi_Tape *STp, const char *buf, size_t count, int is_read) +static int setup_buffering(Scsi_Tape *STp, const char __user *buf, size_t count, int is_read) { int i, bufsize, retval = 0; ST_buffer *STbp = STp->buffer; @@ -1348,7 +1348,7 @@ /* Write command */ static ssize_t - st_write(struct file *filp, const char *buf, size_t count, loff_t * ppos) +st_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos) { ssize_t total; ssize_t i, do_count, blks, transfer; @@ -1356,7 +1356,7 @@ int undone, retry_eot = 0, scode; int async_write; unsigned char cmd[MAX_COMMAND_SIZE]; - const char *b_point; + const char __user *b_point; Scsi_Request *SRpnt = NULL; Scsi_Tape *STp = filp->private_data; ST_mode *STm; @@ -1817,7 +1817,7 @@ /* Read command */ static ssize_t - st_read(struct file *filp, char *buf, size_t count, loff_t * ppos) +st_read(struct file *filp, char __user *buf, size_t count, loff_t * ppos) { ssize_t total; ssize_t retval = 0; @@ -3527,7 +3527,7 @@ /* Move data from the user buffer to the tape buffer. Returns zero (success) or negative error code. */ -static int append_to_buffer(const char *ubp, ST_buffer * st_bp, int do_count) +static int append_to_buffer(const char __user *ubp, ST_buffer * st_bp, int do_count) { int i, cnt, res, offset; @@ -3558,7 +3558,7 @@ /* Move data from the tape buffer to the user buffer. Returns zero (success) or negative error code. */ -static int from_buffer(ST_buffer * st_bp, char *ubp, int do_count) +static int from_buffer(ST_buffer * st_bp, char __user *ubp, int do_count) { int i, cnt, res, offset; diff -urN linux-2.6.7-rc2/drivers/serial/s3c2410.c linux-2.6.7-rc3/drivers/serial/s3c2410.c --- linux-2.6.7-rc2/drivers/serial/s3c2410.c 2004-05-09 19:32:36.000000000 -0700 +++ linux-2.6.7-rc3/drivers/serial/s3c2410.c 2004-06-07 12:55:12.745025733 -0700 @@ -37,7 +37,7 @@ #define SERIAL_S3C2410_NAME "ttySAC" #define SERIAL_S3C2410_MAJOR 204 -#define SERIAL_S3C2410_MINOR 4 +#define SERIAL_S3C2410_MINOR 64 /* we can support 3 uarts, but not always use them */ diff -urN linux-2.6.7-rc2/drivers/serial/sunsab.c linux-2.6.7-rc3/drivers/serial/sunsab.c --- linux-2.6.7-rc2/drivers/serial/sunsab.c 2004-05-09 19:32:28.000000000 -0700 +++ linux-2.6.7-rc3/drivers/serial/sunsab.c 2004-06-07 12:55:12.831029295 -0700 @@ -97,9 +97,10 @@ udelay(1); } -static void receive_chars(struct uart_sunsab_port *up, - union sab82532_irq_status *stat, - struct pt_regs *regs) +static struct tty_struct * +receive_chars(struct uart_sunsab_port *up, + union sab82532_irq_status *stat, + struct pt_regs *regs) { struct tty_struct *tty = NULL; unsigned char buf[32]; @@ -126,7 +127,7 @@ if (stat->sreg.isr0 & SAB82532_ISR0_TIME) { sunsab_cec_wait(up); writeb(SAB82532_CMDR_RFRD, &up->regs->w.cmdr); - return; + return tty; } if (stat->sreg.isr0 & SAB82532_ISR0_RFO) @@ -153,7 +154,7 @@ if (unlikely(tty->flip.count >= TTY_FLIPBUF_SIZE)) { tty->flip.work.func((void *)tty); if (tty->flip.count >= TTY_FLIPBUF_SIZE) - return; // if TTY_DONT_FLIP is set + return tty; // if TTY_DONT_FLIP is set } *tty->flip.char_buf_ptr = ch; @@ -225,11 +226,10 @@ } } - if (tty) - tty_flip_buffer_push(tty); - if (saw_console_brk) sun_do_break(); + + return tty; } static void sunsab_stop_tx(struct uart_port *, unsigned int); @@ -311,6 +311,7 @@ static irqreturn_t sunsab_interrupt(int irq, void *dev_id, struct pt_regs *regs) { struct uart_sunsab_port *up = dev_id; + struct tty_struct *tty; union sab82532_irq_status status; unsigned long flags; @@ -322,10 +323,11 @@ if (readb(&up->regs->r.gis) & SAB82532_GIS_ISA1) status.sreg.isr1 = readb(&up->regs->r.isr1); + tty = NULL; if (status.stat) { if (status.sreg.isr0 & (SAB82532_ISR0_TCD | SAB82532_ISR0_TIME | SAB82532_ISR0_RFO | SAB82532_ISR0_RPF)) - receive_chars(up, &status, regs); + tty = receive_chars(up, &status, regs); if ((status.sreg.isr0 & SAB82532_ISR0_CDSC) || (status.sreg.isr1 & SAB82532_ISR1_CSC)) check_status(up, &status); @@ -335,6 +337,9 @@ spin_unlock(&up->port.lock); + if (tty) + tty_flip_buffer_push(tty); + up++; spin_lock(&up->port.lock); @@ -345,10 +350,11 @@ if (readb(&up->regs->r.gis) & SAB82532_GIS_ISB1) status.sreg.isr1 = readb(&up->regs->r.isr1); + tty = NULL; if (status.stat) { if (status.sreg.isr0 & (SAB82532_ISR0_TCD | SAB82532_ISR0_TIME | SAB82532_ISR0_RFO | SAB82532_ISR0_RPF)) - receive_chars(up, &status, regs); + tty = receive_chars(up, &status, regs); if ((status.sreg.isr0 & SAB82532_ISR0_CDSC) || (status.sreg.isr1 & (SAB82532_ISR1_BRK | SAB82532_ISR1_CSC))) check_status(up, &status); @@ -358,6 +364,9 @@ spin_unlock_irqrestore(&up->port.lock, flags); + if (tty) + tty_flip_buffer_push(tty); + return IRQ_HANDLED; } diff -urN linux-2.6.7-rc2/drivers/serial/sunsu.c linux-2.6.7-rc3/drivers/serial/sunsu.c --- linux-2.6.7-rc2/drivers/serial/sunsu.c 2004-05-09 19:32:02.000000000 -0700 +++ linux-2.6.7-rc3/drivers/serial/sunsu.c 2004-06-07 12:55:13.008036627 -0700 @@ -310,7 +310,7 @@ spin_unlock_irqrestore(&up->port.lock, flags); } -static _INLINE_ void +static _INLINE_ struct tty_struct * receive_chars(struct uart_sunsu_port *up, unsigned char *status, struct pt_regs *regs) { struct tty_struct *tty = up->port.info->tty; @@ -322,7 +322,7 @@ if (unlikely(tty->flip.count >= TTY_FLIPBUF_SIZE)) { tty->flip.work.func((void *)tty); if (tty->flip.count >= TTY_FLIPBUF_SIZE) - return; // if TTY_DONT_FLIP is set + return tty; // if TTY_DONT_FLIP is set } ch = serial_inp(up, UART_RX); *tty->flip.char_buf_ptr = ch; @@ -396,10 +396,11 @@ ignore_char: *status = serial_inp(up, UART_LSR); } while ((*status & UART_LSR_DR) && (max_count-- > 0)); - tty_flip_buffer_push(tty); if (saw_console_brk) sun_do_break(); + + return tty; } static _INLINE_ void transmit_chars(struct uart_sunsu_port *up) @@ -464,12 +465,23 @@ spin_lock_irqsave(&up->port.lock, flags); do { + struct tty_struct *tty; + status = serial_inp(up, UART_LSR); + tty = NULL; if (status & UART_LSR_DR) - receive_chars(up, &status, regs); + tty = receive_chars(up, &status, regs); check_modem_status(up); if (status & UART_LSR_THRE) transmit_chars(up); + + spin_unlock_irqrestore(&up->port.lock, flags); + + if (tty) + tty_flip_buffer_push(tty); + + spin_lock_irqsave(&up->port.lock, flags); + } while (!(serial_in(up, UART_IIR) & UART_IIR_NO_INT)); spin_unlock_irqrestore(&up->port.lock, flags); diff -urN linux-2.6.7-rc2/drivers/serial/sunzilog.c linux-2.6.7-rc3/drivers/serial/sunzilog.c --- linux-2.6.7-rc2/drivers/serial/sunzilog.c 2004-05-09 19:33:21.000000000 -0700 +++ linux-2.6.7-rc3/drivers/serial/sunzilog.c 2004-06-07 12:55:13.009036668 -0700 @@ -313,9 +313,10 @@ } } -static void sunzilog_receive_chars(struct uart_sunzilog_port *up, - struct zilog_channel *channel, - struct pt_regs *regs) +static struct tty_struct * +sunzilog_receive_chars(struct uart_sunzilog_port *up, + struct zilog_channel *channel, + struct pt_regs *regs) { struct tty_struct *tty; unsigned char ch, r1; @@ -414,8 +415,7 @@ } } - if (tty) - tty_flip_buffer_push(tty); + return tty; } static void sunzilog_status_handle(struct uart_sunzilog_port *up, @@ -550,19 +550,21 @@ while (up) { struct zilog_channel *channel = ZILOG_CHANNEL_FROM_PORT(&up->port); + struct tty_struct *tty; unsigned char r3; spin_lock(&up->port.lock); r3 = read_zsreg(channel, R3); /* Channel A */ + tty = NULL; if (r3 & (CHAEXT | CHATxIP | CHARxIP)) { sbus_writeb(RES_H_IUS, &channel->control); ZSDELAY(); ZS_WSYNC(channel); if (r3 & CHARxIP) - sunzilog_receive_chars(up, channel, regs); + tty = sunzilog_receive_chars(up, channel, regs); if (r3 & CHAEXT) sunzilog_status_handle(up, channel, regs); if (r3 & CHATxIP) @@ -570,18 +572,22 @@ } spin_unlock(&up->port.lock); + if (tty) + tty_flip_buffer_push(tty); + /* Channel B */ up = up->next; channel = ZILOG_CHANNEL_FROM_PORT(&up->port); spin_lock(&up->port.lock); + tty = NULL; if (r3 & (CHBEXT | CHBTxIP | CHBRxIP)) { sbus_writeb(RES_H_IUS, &channel->control); ZSDELAY(); ZS_WSYNC(channel); if (r3 & CHBRxIP) - sunzilog_receive_chars(up, channel, regs); + tty = sunzilog_receive_chars(up, channel, regs); if (r3 & CHBEXT) sunzilog_status_handle(up, channel, regs); if (r3 & CHBTxIP) @@ -589,6 +595,9 @@ } spin_unlock(&up->port.lock); + if (tty) + tty_flip_buffer_push(tty); + up = up->next; } diff -urN linux-2.6.7-rc2/drivers/usb/core/devio.c linux-2.6.7-rc3/drivers/usb/core/devio.c --- linux-2.6.7-rc2/drivers/usb/core/devio.c 2004-06-07 12:54:49.768074090 -0700 +++ linux-2.6.7-rc3/drivers/usb/core/devio.c 2004-06-07 12:55:13.267047355 -0700 @@ -862,7 +862,7 @@ isofrmlen = sizeof(struct usbdevfs_iso_packet_desc) * uurb.number_of_packets; if (!(isopkt = kmalloc(isofrmlen, GFP_KERNEL))) return -ENOMEM; - if (copy_from_user(isopkt, &((struct usbdevfs_urb *)arg)->iso_frame_desc, isofrmlen)) { + if (copy_from_user(isopkt, &((struct usbdevfs_urb __user *)arg)->iso_frame_desc, isofrmlen)) { kfree(isopkt); return -EFAULT; } @@ -1023,7 +1023,7 @@ free_async(as); if (ret) return ret; - if (put_user(addr, (void **)arg)) + if (put_user(addr, (void __user * __user *)arg)) return -EFAULT; return 0; } @@ -1045,7 +1045,7 @@ free_async(as); if (ret) return ret; - if (put_user(addr, (void **)arg)) + if (put_user(addr, (void __user * __user *)arg)) return -EFAULT; return 0; } @@ -1174,6 +1174,7 @@ { struct dev_state *ps = (struct dev_state *)file->private_data; struct usb_device *dev = ps->dev; + void __user *p = (void __user *)arg; int ret = -ENOTTY; if (!(file->f_mode & FMODE_WRITE)) @@ -1187,21 +1188,21 @@ switch (cmd) { case USBDEVFS_CONTROL: snoop(&dev->dev, "%s: CONTROL\n", __FUNCTION__); - ret = proc_control(ps, (void __user *)arg); + ret = proc_control(ps, p); if (ret >= 0) inode->i_mtime = CURRENT_TIME; break; case USBDEVFS_BULK: snoop(&dev->dev, "%s: BULK\n", __FUNCTION__); - ret = proc_bulk(ps, (void __user *)arg); + ret = proc_bulk(ps, p); if (ret >= 0) inode->i_mtime = CURRENT_TIME; break; case USBDEVFS_RESETEP: snoop(&dev->dev, "%s: RESETEP\n", __FUNCTION__); - ret = proc_resetep(ps, (void __user *)arg); + ret = proc_resetep(ps, p); if (ret >= 0) inode->i_mtime = CURRENT_TIME; break; @@ -1213,71 +1214,71 @@ case USBDEVFS_CLEAR_HALT: snoop(&dev->dev, "%s: CLEAR_HALT\n", __FUNCTION__); - ret = proc_clearhalt(ps, (void __user *)arg); + ret = proc_clearhalt(ps, p); if (ret >= 0) inode->i_mtime = CURRENT_TIME; break; case USBDEVFS_GETDRIVER: snoop(&dev->dev, "%s: GETDRIVER\n", __FUNCTION__); - ret = proc_getdriver(ps, (void __user *)arg); + ret = proc_getdriver(ps, p); break; case USBDEVFS_CONNECTINFO: snoop(&dev->dev, "%s: CONNECTINFO\n", __FUNCTION__); - ret = proc_connectinfo(ps, (void __user *)arg); + ret = proc_connectinfo(ps, p); break; case USBDEVFS_SETINTERFACE: snoop(&dev->dev, "%s: SETINTERFACE\n", __FUNCTION__); - ret = proc_setintf(ps, (void __user *)arg); + ret = proc_setintf(ps, p); break; case USBDEVFS_SETCONFIGURATION: snoop(&dev->dev, "%s: SETCONFIGURATION\n", __FUNCTION__); - ret = proc_setconfig(ps, (void __user *)arg); + ret = proc_setconfig(ps, p); break; case USBDEVFS_SUBMITURB: snoop(&dev->dev, "%s: SUBMITURB\n", __FUNCTION__); - ret = proc_submiturb(ps, (void __user *)arg); + ret = proc_submiturb(ps, p); if (ret >= 0) inode->i_mtime = CURRENT_TIME; break; case USBDEVFS_DISCARDURB: snoop(&dev->dev, "%s: DISCARDURB\n", __FUNCTION__); - ret = proc_unlinkurb(ps, (void __user *)arg); + ret = proc_unlinkurb(ps, p); break; case USBDEVFS_REAPURB: snoop(&dev->dev, "%s: REAPURB\n", __FUNCTION__); - ret = proc_reapurb(ps, (void __user *)arg); + ret = proc_reapurb(ps, p); break; case USBDEVFS_REAPURBNDELAY: snoop(&dev->dev, "%s: REAPURBDELAY\n", __FUNCTION__); - ret = proc_reapurbnonblock(ps, (void __user *)arg); + ret = proc_reapurbnonblock(ps, p); break; case USBDEVFS_DISCSIGNAL: snoop(&dev->dev, "%s: DISCSIGNAL\n", __FUNCTION__); - ret = proc_disconnectsignal(ps, (void __user *)arg); + ret = proc_disconnectsignal(ps, p); break; case USBDEVFS_CLAIMINTERFACE: snoop(&dev->dev, "%s: CLAIMINTERFACE\n", __FUNCTION__); - ret = proc_claiminterface(ps, (void __user *)arg); + ret = proc_claiminterface(ps, p); break; case USBDEVFS_RELEASEINTERFACE: snoop(&dev->dev, "%s: RELEASEINTERFACE\n", __FUNCTION__); - ret = proc_releaseinterface(ps, (void __user *)arg); + ret = proc_releaseinterface(ps, p); break; case USBDEVFS_IOCTL: snoop(&dev->dev, "%s: IOCTL\n", __FUNCTION__); - ret = proc_ioctl(ps, (void __user *) arg); + ret = proc_ioctl(ps, p); break; } up(&dev->serialize); diff -urN linux-2.6.7-rc2/drivers/usb/gadget/ether.c linux-2.6.7-rc3/drivers/usb/gadget/ether.c --- linux-2.6.7-rc2/drivers/usb/gadget/ether.c 2004-06-07 12:54:49.787074877 -0700 +++ linux-2.6.7-rc3/drivers/usb/gadget/ether.c 2004-06-07 12:55:13.490056592 -0700 @@ -1651,12 +1651,12 @@ return &((struct eth_dev *) net->priv)->stats; } -static int eth_ethtool_ioctl (struct net_device *net, void *useraddr) +static int eth_ethtool_ioctl (struct net_device *net, void __user *useraddr) { struct eth_dev *dev = (struct eth_dev *) net->priv; u32 cmd; - if (get_user (cmd, (u32 *)useraddr)) + if (get_user (cmd, (u32 __user *)useraddr)) return -EFAULT; switch (cmd) { @@ -1694,7 +1694,7 @@ { switch (cmd) { case SIOCETHTOOL: - return eth_ethtool_ioctl (net, (void *)rq->ifr_data); + return eth_ethtool_ioctl(net, rq->ifr_data); default: return -EOPNOTSUPP; } diff -urN linux-2.6.7-rc2/drivers/usb/misc/speedtch.c linux-2.6.7-rc3/drivers/usb/misc/speedtch.c --- linux-2.6.7-rc2/drivers/usb/misc/speedtch.c 2004-05-09 19:33:21.000000000 -0700 +++ linux-2.6.7-rc3/drivers/usb/misc/speedtch.c 2004-06-07 12:55:15.012119635 -0700 @@ -269,7 +269,7 @@ static void udsl_atm_dev_close (struct atm_dev *dev); static int udsl_atm_open (struct atm_vcc *vcc); static void udsl_atm_close (struct atm_vcc *vcc); -static int udsl_atm_ioctl (struct atm_dev *dev, unsigned int cmd, void *arg); +static int udsl_atm_ioctl (struct atm_dev *dev, unsigned int cmd, void __user *arg); static int udsl_atm_send (struct atm_vcc *vcc, struct sk_buff *skb); static int udsl_atm_proc_read (struct atm_dev *atm_dev, loff_t *pos, char *page); @@ -991,11 +991,11 @@ dbg ("udsl_atm_close successful"); } -static int udsl_atm_ioctl (struct atm_dev *dev, unsigned int cmd, void *arg) +static int udsl_atm_ioctl (struct atm_dev *dev, unsigned int cmd, void __user *arg) { switch (cmd) { case ATM_QUERYLOOP: - return put_user (ATM_LM_NONE, (int *) arg) ? -EFAULT : 0; + return put_user (ATM_LM_NONE, (int __user *)arg) ? -EFAULT : 0; default: return -ENOIOCTLCMD; } diff -urN linux-2.6.7-rc2/drivers/usb/net/catc.c linux-2.6.7-rc3/drivers/usb/net/catc.c --- linux-2.6.7-rc2/drivers/usb/net/catc.c 2004-05-09 19:32:29.000000000 -0700 +++ linux-2.6.7-rc3/drivers/usb/net/catc.c 2004-06-07 12:55:15.072122120 -0700 @@ -672,7 +672,7 @@ struct catc *catc = dev->priv; u32 cmd; - if (get_user(cmd, (u32 *)useraddr)) + if (get_user(cmd, (u32 __user *)useraddr)) return -EFAULT; switch (cmd) { @@ -726,7 +726,7 @@ { switch(cmd) { case SIOCETHTOOL: - return netdev_ethtool_ioctl(dev, (void __user *)rq->ifr_data); + return netdev_ethtool_ioctl(dev, rq->ifr_data); default: return -EOPNOTSUPP; } diff -urN linux-2.6.7-rc2/drivers/usb/net/kaweth.c linux-2.6.7-rc3/drivers/usb/net/kaweth.c --- linux-2.6.7-rc2/drivers/usb/net/kaweth.c 2004-06-07 12:54:49.889079101 -0700 +++ linux-2.6.7-rc3/drivers/usb/net/kaweth.c 2004-06-07 12:55:15.151125392 -0700 @@ -737,7 +737,7 @@ { switch (cmd) { case SIOCETHTOOL: - return netdev_ethtool_ioctl(net, (void __user *)rq->ifr_data); + return netdev_ethtool_ioctl(net, rq->ifr_data); } return -EOPNOTSUPP; } diff -urN linux-2.6.7-rc2/drivers/usb/net/pegasus.c linux-2.6.7-rc3/drivers/usb/net/pegasus.c --- linux-2.6.7-rc2/drivers/usb/net/pegasus.c 2004-06-07 12:54:49.890079143 -0700 +++ linux-2.6.7-rc3/drivers/usb/net/pegasus.c 2004-06-07 12:55:15.152125434 -0700 @@ -1030,7 +1030,7 @@ int cmd; pegasus = net->priv; - if (get_user(cmd, (int *) uaddr)) + if (get_user(cmd, (int __user *) uaddr)) return -EFAULT; switch (cmd) { case ETHTOOL_GDRVINFO:{ @@ -1107,13 +1107,13 @@ #endif static int pegasus_ioctl(struct net_device *net, struct ifreq *rq, int cmd) { - __u16 *data = (__u16 *) & rq->ifr_data; + __u16 *data = (__u16 *) & rq->ifr_ifru; pegasus_t *pegasus = net->priv; int res; switch (cmd) { case SIOCETHTOOL: - res = pegasus_ethtool_ioctl(net, (void __user *)rq->ifr_data); + res = pegasus_ethtool_ioctl(net, rq->ifr_data); break; case SIOCDEVPRIVATE: data[0] = pegasus->phy; diff -urN linux-2.6.7-rc2/drivers/usb/net/rtl8150.c linux-2.6.7-rc3/drivers/usb/net/rtl8150.c --- linux-2.6.7-rc2/drivers/usb/net/rtl8150.c 2004-06-07 12:54:49.891079184 -0700 +++ linux-2.6.7-rc3/drivers/usb/net/rtl8150.c 2004-06-07 12:55:15.154125516 -0700 @@ -776,13 +776,13 @@ return res; } -static int rtl8150_ethtool_ioctl(struct net_device *netdev, void *uaddr) +static int rtl8150_ethtool_ioctl(struct net_device *netdev, void __user *uaddr) { rtl8150_t *dev; int cmd; dev = netdev->priv; - if (get_user(cmd, (int *) uaddr)) + if (get_user(cmd, (int __user *) uaddr)) return -EFAULT; switch (cmd) { @@ -856,7 +856,7 @@ int res; dev = netdev->priv; - data = (u16 *) & rq->ifr_data; + data = (u16 *) & rq->ifr_ifru; res = 0; switch (cmd) { diff -urN linux-2.6.7-rc2/drivers/usb/net/usbnet.c linux-2.6.7-rc3/drivers/usb/net/usbnet.c --- linux-2.6.7-rc2/drivers/usb/net/usbnet.c 2004-06-07 12:54:49.893079267 -0700 +++ linux-2.6.7-rc3/drivers/usb/net/usbnet.c 2004-06-07 12:55:15.193127132 -0700 @@ -2668,9 +2668,7 @@ struct usbnet *dev = (struct usbnet *)net->priv; if (dev->mii.mdio_read != NULL && dev->mii.mdio_write != NULL) - return generic_mii_ioctl(&dev->mii, - (struct mii_ioctl_data *) &rq->ifr_data, - cmd, NULL); + return generic_mii_ioctl(&dev->mii, if_mii(rq), cmd, NULL); } #endif return -EOPNOTSUPP; diff -urN linux-2.6.7-rc2/drivers/video/aty/radeon_accel.c linux-2.6.7-rc3/drivers/video/aty/radeon_accel.c --- linux-2.6.7-rc2/drivers/video/aty/radeon_accel.c 2004-06-07 12:54:49.935081007 -0700 +++ linux-2.6.7-rc3/drivers/video/aty/radeon_accel.c 2004-06-07 12:55:16.180168015 -0700 @@ -13,7 +13,10 @@ rinfo->dp_gui_master_cntl /* contains, like GMC_DST_32BPP */ | GMC_BRUSH_SOLID_COLOR | ROP3_P); - OUTREG(DP_BRUSH_FRGD_CLR, region->color); + if (radeon_get_dstbpp(rinfo->depth) != DST_8BPP) + OUTREG(DP_BRUSH_FRGD_CLR, rinfo->pseudo_palette[region->color]); + else + OUTREG(DP_BRUSH_FRGD_CLR, region->color); OUTREG(DP_WRITE_MSK, 0xffffffff); OUTREG(DP_CNTL, (DST_X_LEFT_TO_RIGHT | DST_Y_TOP_TO_BOTTOM)); diff -urN linux-2.6.7-rc2/drivers/video/aty/radeon_pm.c linux-2.6.7-rc3/drivers/video/aty/radeon_pm.c --- linux-2.6.7-rc2/drivers/video/aty/radeon_pm.c 2004-05-09 19:32:53.000000000 -0700 +++ linux-2.6.7-rc3/drivers/video/aty/radeon_pm.c 2004-06-07 12:55:16.183168139 -0700 @@ -867,7 +867,7 @@ } /* Blank display and LCD */ - radeonfb_blank(VESA_POWERDOWN+1, info); + radeonfb_blank(VESA_POWERDOWN, info); /* Sleep */ rinfo->asleep = 1; diff -urN linux-2.6.7-rc2/drivers/video/pxafb.c linux-2.6.7-rc3/drivers/video/pxafb.c --- linux-2.6.7-rc2/drivers/video/pxafb.c 2004-06-07 12:54:49.964082208 -0700 +++ linux-2.6.7-rc3/drivers/video/pxafb.c 2004-06-07 12:55:16.211169299 -0700 @@ -432,7 +432,7 @@ * (DPC) bit? or perhaps set it based on the various clock * speeds */ - pcd = (unsigned long long)get_lclk_frequency_10khz() * (unsigned long long)pixclock; + pcd = (unsigned long long)get_lcdclk_frequency_10khz() * pixclock; pcd /= 100000000 * 2; /* no need for this, since we should subtract 1 anyway. they cancel */ /* pcd += 1; */ /* make up for integer math truncations */ diff -urN linux-2.6.7-rc2/drivers/video/riva/fbdev.c linux-2.6.7-rc3/drivers/video/riva/fbdev.c --- linux-2.6.7-rc2/drivers/video/riva/fbdev.c 2004-06-07 12:54:49.970082456 -0700 +++ linux-2.6.7-rc3/drivers/video/riva/fbdev.c 2004-06-07 12:55:16.216169506 -0700 @@ -1620,14 +1620,27 @@ struct riva_par *par = (struct riva_par *) info->par; struct device_node *dp; unsigned char *pedid = NULL; + unsigned char *disptype = NULL; + static char *propnames[] = { + "DFP,EDID", "LCD,EDID", "EDID", "EDID1", "EDID,B", "EDID,A", NULL }; + int i; dp = pci_device_to_OF_node(pd); - pedid = (unsigned char *)get_property(dp, "EDID,B", 0); - - if (pedid) { + for (; dp != NULL; dp = dp->child) { + disptype = (unsigned char *)get_property(dp, "display-type", NULL); + if (disptype == NULL) + continue; + if (strncmp(disptype, "LCD", 3) != 0) + continue; + for (i = 0; propnames[i] != NULL; ++i) { + pedid = (unsigned char *) + get_property(dp, propnames[i], NULL); + if (pedid != NULL) { par->EDID = pedid; return 1; - } else + } + } + } return 0; } #endif /* CONFIG_PPC_OF */ diff -urN linux-2.6.7-rc2/drivers/video/sbuslib.c linux-2.6.7-rc3/drivers/video/sbuslib.c --- linux-2.6.7-rc2/drivers/video/sbuslib.c 2004-05-09 19:32:27.000000000 -0700 +++ linux-2.6.7-rc3/drivers/video/sbuslib.c 2004-06-07 12:55:16.218169589 -0700 @@ -122,6 +122,7 @@ cmap.red = &red; cmap.green = &green; cmap.blue = &blue; + cmap.transp = NULL; for (i = 0; i < count; i++) { int err; diff -urN linux-2.6.7-rc2/drivers/video/vesafb.c linux-2.6.7-rc3/drivers/video/vesafb.c --- linux-2.6.7-rc2/drivers/video/vesafb.c 2004-06-07 12:54:49.974082622 -0700 +++ linux-2.6.7-rc3/drivers/video/vesafb.c 2004-06-07 12:55:16.221169713 -0700 @@ -207,7 +207,7 @@ mtrr=1; else if (! strcmp(this_opt, "nomtrr")) mtrr=0; - else if (! strcmp(this_opt, "vram")) + else if (! strncmp(this_opt, "vram:", 5)) vram = simple_strtoul(this_opt+5, NULL, 0); } return 0; diff -urN linux-2.6.7-rc2/fs/afs/file.c linux-2.6.7-rc3/fs/afs/file.c --- linux-2.6.7-rc2/fs/afs/file.c 2004-05-09 19:32:54.000000000 -0700 +++ linux-2.6.7-rc3/fs/afs/file.c 2004-06-07 12:55:16.227169962 -0700 @@ -31,8 +31,8 @@ static int afs_file_invalidatepage(struct page *page, unsigned long offset); static int afs_file_releasepage(struct page *page, int gfp_flags); -static ssize_t afs_file_write(struct file *file, const char *buf, size_t size, - loff_t *off); +static ssize_t afs_file_write(struct file *file, const char __user *buf, + size_t size, loff_t *off); struct inode_operations afs_file_inode_operations = { .getattr = afs_inode_getattr, @@ -61,8 +61,8 @@ /* * AFS file write */ -static ssize_t afs_file_write(struct file *file, const char *buf, size_t size, - loff_t *off) +static ssize_t afs_file_write(struct file *file, const char __user *buf, + size_t size, loff_t *off) { struct afs_vnode *vnode; diff -urN linux-2.6.7-rc2/fs/afs/proc.c linux-2.6.7-rc3/fs/afs/proc.c --- linux-2.6.7-rc2/fs/afs/proc.c 2004-05-09 19:32:26.000000000 -0700 +++ linux-2.6.7-rc3/fs/afs/proc.c 2004-06-07 12:55:16.227169962 -0700 @@ -27,7 +27,7 @@ static void *afs_proc_cells_next(struct seq_file *p, void *v, loff_t *pos); static void afs_proc_cells_stop(struct seq_file *p, void *v); static int afs_proc_cells_show(struct seq_file *m, void *v); -static ssize_t afs_proc_cells_write(struct file *file, const char *buf, +static ssize_t afs_proc_cells_write(struct file *file, const char __user *buf, size_t size, loff_t *_pos); static struct seq_operations afs_proc_cells_ops = { @@ -47,9 +47,10 @@ static int afs_proc_rootcell_open(struct inode *inode, struct file *file); static int afs_proc_rootcell_release(struct inode *inode, struct file *file); -static ssize_t afs_proc_rootcell_read(struct file *file, char *buf, +static ssize_t afs_proc_rootcell_read(struct file *file, char __user *buf, size_t size, loff_t *_pos); -static ssize_t afs_proc_rootcell_write(struct file *file, const char *buf, +static ssize_t afs_proc_rootcell_write(struct file *file, + const char __user *buf, size_t size, loff_t *_pos); static struct file_operations afs_proc_rootcell_fops = { @@ -278,7 +279,7 @@ * handle writes to /proc/fs/afs/cells * - to add cells: echo "add [:][:]" */ -static ssize_t afs_proc_cells_write(struct file *file, const char *buf, +static ssize_t afs_proc_cells_write(struct file *file, const char __user *buf, size_t size, loff_t *_pos) { char *kbuf, *name, *args; @@ -363,7 +364,7 @@ return 0; } -static ssize_t afs_proc_rootcell_read(struct file *file, char *buf, +static ssize_t afs_proc_rootcell_read(struct file *file, char __user *buf, size_t size, loff_t *_pos) { return 0; @@ -374,7 +375,8 @@ * handle writes to /proc/fs/afs/rootcell * - to initialize rootcell: echo "cell.name:192.168.231.14" */ -static ssize_t afs_proc_rootcell_write(struct file *file, const char *buf, +static ssize_t afs_proc_rootcell_write(struct file *file, + const char __user *buf, size_t size, loff_t *_pos) { char *kbuf, *s; diff -urN linux-2.6.7-rc2/fs/aio.c linux-2.6.7-rc3/fs/aio.c --- linux-2.6.7-rc2/fs/aio.c 2004-06-07 12:54:50.124088834 -0700 +++ linux-2.6.7-rc3/fs/aio.c 2004-06-07 12:55:16.228170003 -0700 @@ -394,7 +394,7 @@ req->ki_ctx = ctx; req->ki_cancel = NULL; req->ki_retry = NULL; - req->ki_user_obj = NULL; + req->ki_obj.user = NULL; /* Check if the completion queue has enough free space to * accept an event from this io. @@ -437,7 +437,7 @@ { req->ki_ctx = NULL; req->ki_filp = NULL; - req->ki_user_obj = NULL; + req->ki_obj.user = NULL; kmem_cache_free(kiocb_cachep, req); ctx->reqs_active--; @@ -538,19 +538,25 @@ static void use_mm(struct mm_struct *mm) { - struct mm_struct *active_mm = current->active_mm; + struct mm_struct *active_mm; + atomic_inc(&mm->mm_count); + task_lock(current); + active_mm = current->active_mm; current->mm = mm; if (mm != active_mm) { current->active_mm = mm; activate_mm(active_mm, mm); } + task_unlock(current); mmdrop(active_mm); } static void unuse_mm(struct mm_struct *mm) { + task_lock(current); current->mm = NULL; + task_unlock(current); /* active_mm is still 'mm' */ enter_lazy_tlb(mm, current); } @@ -599,7 +605,7 @@ * single context. */ if (is_sync_kiocb(iocb)) { kiocbSetKicked(iocb); - wake_up_process(iocb->ki_user_obj); + wake_up_process(iocb->ki_obj.tsk); return; } @@ -608,7 +614,7 @@ spin_lock_irqsave(&ctx->ctx_lock, flags); list_add_tail(&iocb->ki_run_list, &ctx->run_list); spin_unlock_irqrestore(&ctx->ctx_lock, flags); - schedule_work(&ctx->wq); + queue_work(aio_wq, &ctx->wq); } } @@ -647,7 +653,7 @@ spin_unlock_irq(&ctx->ctx_lock); } /* sync iocbs put the task here for us */ - wake_up_process(iocb->ki_user_obj); + wake_up_process(iocb->ki_obj.tsk); return ret; } @@ -667,13 +673,13 @@ event = aio_ring_event(info, tail, KM_IRQ0); tail = (tail + 1) % info->nr; - event->obj = (u64)(unsigned long)iocb->ki_user_obj; + event->obj = (u64)(unsigned long)iocb->ki_obj.user; event->data = iocb->ki_user_data; event->res = res; event->res2 = res2; dprintk("aio_complete: %p[%lu]: %p: %p %Lx %lx %lx\n", - ctx, tail, iocb, iocb->ki_user_obj, iocb->ki_user_data, + ctx, tail, iocb, iocb->ki_obj.user, iocb->ki_user_data, res, res2); /* after flagging the request as done, we @@ -771,19 +777,11 @@ static inline void set_timeout(long start_jiffies, struct timeout *to, const struct timespec *ts) { - unsigned long how_long; - - if (ts->tv_sec < 0 || (!ts->tv_sec && !ts->tv_nsec)) { + to->timer.expires = start_jiffies + timespec_to_jiffies(ts); + if (time_after(to->timer.expires, jiffies)) + add_timer(&to->timer); + else to->timed_out = 1; - return; - } - - how_long = ts->tv_sec * HZ; -#define HZ_NS (1000000000 / HZ) - how_long += (ts->tv_nsec + HZ_NS - 1) / HZ_NS; - - to->timer.expires = jiffies + how_long; - add_timer(&to->timer); } static inline void clear_timeout(struct timeout *to) @@ -956,6 +954,7 @@ ret = put_user(ioctx->user_id, ctxp); if (!ret) return 0; + get_ioctx(ioctx); io_destroy(ioctx); } @@ -1023,7 +1022,7 @@ goto out_put_req; } - req->ki_user_obj = user_iocb; + req->ki_obj.user = user_iocb; req->ki_user_data = iocb->aio_data; req->ki_pos = iocb->aio_offset; @@ -1149,7 +1148,7 @@ /* TODO: use a hash or array, this sucks. */ list_for_each(pos, &ctx->active_reqs) { struct kiocb *kiocb = list_kiocb(pos); - if (kiocb->ki_user_obj == iocb && kiocb->ki_key == key) + if (kiocb->ki_obj.user == iocb && kiocb->ki_key == key) return kiocb; } return NULL; @@ -1196,7 +1195,7 @@ struct io_event tmp; pr_debug("calling cancel\n"); memset(&tmp, 0, sizeof(tmp)); - tmp.obj = (u64)(unsigned long)kiocb->ki_user_obj; + tmp.obj = (u64)(unsigned long)kiocb->ki_obj.user; tmp.data = kiocb->ki_user_data; ret = cancel(kiocb, &tmp); if (!ret) { diff -urN linux-2.6.7-rc2/fs/binfmt_misc.c linux-2.6.7-rc3/fs/binfmt_misc.c --- linux-2.6.7-rc2/fs/binfmt_misc.c 2004-06-07 12:54:50.193091692 -0700 +++ linux-2.6.7-rc3/fs/binfmt_misc.c 2004-06-07 12:55:16.239170459 -0700 @@ -196,7 +196,7 @@ * ':name:type:offset:magic:mask:interpreter:' * where the ':' is the IFS, that can be chosen with the first char */ -static Node *create_entry(const char *buffer, size_t count) +static Node *create_entry(const char __user *buffer, size_t count) { Node *e; int memsize, err; @@ -319,7 +319,7 @@ * Set status of entry/binfmt_misc: * '1' enables, '0' disables and '-1' clears entry/binfmt_misc */ -static int parse_command(const char *buffer, size_t count) +static int parse_command(const char __user *buffer, size_t count) { char s[4]; @@ -424,7 +424,7 @@ /* / */ static ssize_t -bm_entry_read(struct file * file, char * buf, size_t nbytes, loff_t *ppos) +bm_entry_read(struct file * file, char __user * buf, size_t nbytes, loff_t *ppos) { Node *e = file->f_dentry->d_inode->u.generic_ip; loff_t pos = *ppos; @@ -456,7 +456,7 @@ return res; } -static ssize_t bm_entry_write(struct file *file, const char *buffer, +static ssize_t bm_entry_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { struct dentry *root; @@ -488,7 +488,7 @@ /* /register */ -static ssize_t bm_register_write(struct file *file, const char *buffer, +static ssize_t bm_register_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { Node *e; @@ -556,7 +556,7 @@ /* /status */ static ssize_t -bm_status_read(struct file * file, char * buf, size_t nbytes, loff_t *ppos) +bm_status_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) { char *s = enabled ? "enabled" : "disabled"; int len = strlen(s); @@ -574,7 +574,7 @@ return nbytes; } -static ssize_t bm_status_write(struct file * file, const char * buffer, +static ssize_t bm_status_write(struct file * file, const char __user * buffer, size_t count, loff_t *ppos) { int res = parse_command(buffer, count); diff -urN linux-2.6.7-rc2/fs/coda/file.c linux-2.6.7-rc3/fs/coda/file.c --- linux-2.6.7-rc2/fs/coda/file.c 2004-05-09 19:32:28.000000000 -0700 +++ linux-2.6.7-rc3/fs/coda/file.c 2004-06-07 12:55:16.451179240 -0700 @@ -29,7 +29,7 @@ int use_coda_close; static ssize_t -coda_file_read(struct file *coda_file, char *buf, size_t count, loff_t *ppos) +coda_file_read(struct file *coda_file, char __user *buf, size_t count, loff_t *ppos) { struct coda_file_info *cfi; struct file *host_file; @@ -45,7 +45,7 @@ } static ssize_t -coda_file_write(struct file *coda_file, const char *buf, size_t count, loff_t *ppos) +coda_file_write(struct file *coda_file, const char __user *buf, size_t count, loff_t *ppos) { struct inode *host_inode, *coda_inode = coda_file->f_dentry->d_inode; struct coda_file_info *cfi; diff -urN linux-2.6.7-rc2/fs/coda/pioctl.c linux-2.6.7-rc3/fs/coda/pioctl.c --- linux-2.6.7-rc2/fs/coda/pioctl.c 2004-05-09 19:32:53.000000000 -0700 +++ linux-2.6.7-rc3/fs/coda/pioctl.c 2004-06-07 12:55:16.452179281 -0700 @@ -58,7 +58,7 @@ struct coda_inode_info *cnp; /* get the Pioctl data arguments from user space */ - if (copy_from_user(&data, (int *)user_data, sizeof(data))) { + if (copy_from_user(&data, (void __user *)user_data, sizeof(data))) { return -EINVAL; } diff -urN linux-2.6.7-rc2/fs/coda/psdev.c linux-2.6.7-rc3/fs/coda/psdev.c --- linux-2.6.7-rc2/fs/coda/psdev.c 2004-05-09 19:32:52.000000000 -0700 +++ linux-2.6.7-rc3/fs/coda/psdev.c 2004-06-07 12:55:16.452179281 -0700 @@ -88,7 +88,7 @@ switch(cmd) { case CIOC_KERNEL_VERSION: data = CODA_KERNEL_VERSION; - return put_user(data, (int *) arg); + return put_user(data, (int __user *) arg); default: return -ENOTTY; } @@ -100,7 +100,7 @@ * Receive a message written by Venus to the psdev */ -static ssize_t coda_psdev_write(struct file *file, const char *buf, +static ssize_t coda_psdev_write(struct file *file, const char __user *buf, size_t nbytes, loff_t *off) { struct venus_comm *vcp = (struct venus_comm *) file->private_data; @@ -212,7 +212,7 @@ * Read a message from the kernel to Venus */ -static ssize_t coda_psdev_read(struct file * file, char * buf, +static ssize_t coda_psdev_read(struct file * file, char __user * buf, size_t nbytes, loff_t *off) { DECLARE_WAITQUEUE(wait, current); diff -urN linux-2.6.7-rc2/fs/coda/sysctl.c linux-2.6.7-rc3/fs/coda/sysctl.c --- linux-2.6.7-rc2/fs/coda/sysctl.c 2004-05-09 19:32:27.000000000 -0700 +++ linux-2.6.7-rc3/fs/coda/sysctl.c 2004-06-07 12:55:16.493180980 -0700 @@ -69,7 +69,7 @@ } int do_reset_coda_vfs_stats( ctl_table * table, int write, struct file * filp, - void * buffer, size_t * lenp ) + void __user * buffer, size_t * lenp ) { if ( write ) { reset_coda_vfs_stats(); @@ -83,7 +83,7 @@ } int do_reset_coda_cache_inv_stats( ctl_table * table, int write, - struct file * filp, void * buffer, + struct file * filp, void __user * buffer, size_t * lenp ) { if ( write ) { @@ -214,7 +214,7 @@ #define coda_proc_create(name,get_info) \ create_proc_info_entry(name, 0, proc_fs_coda, get_info) -void coda_sysctl_init() +void coda_sysctl_init(void) { reset_coda_vfs_stats(); reset_coda_cache_inv_stats(); @@ -234,7 +234,7 @@ #endif } -void coda_sysctl_clean() +void coda_sysctl_clean(void) { #ifdef CONFIG_SYSCTL diff -urN linux-2.6.7-rc2/fs/compat.c linux-2.6.7-rc3/fs/compat.c --- linux-2.6.7-rc2/fs/compat.c 2004-06-07 12:54:50.363098733 -0700 +++ linux-2.6.7-rc3/fs/compat.c 2004-06-07 12:55:16.496181104 -0700 @@ -614,7 +614,7 @@ } static inline long -copy_iocb(long nr, u32 __user *ptr32, u64 __user *ptr64) +copy_iocb(long nr, u32 __user *ptr32, struct iocb __user * __user *ptr64) { compat_uptr_t uptr; int i; @@ -622,7 +622,7 @@ for (i = 0; i < nr; ++i) { if (get_user(uptr, ptr32 + i)) return -EFAULT; - if (put_user((u64)compat_ptr(uptr), ptr64 + i)) + if (put_user(compat_ptr(uptr), ptr64 + i)) return -EFAULT; } return 0; @@ -643,7 +643,7 @@ nr = MAX_AIO_SUBMITS; iocb64 = compat_alloc_user_space(nr * sizeof(*iocb64)); - ret = copy_iocb(nr, iocb, (u64 __user *) iocb64); + ret = copy_iocb(nr, iocb, iocb64); if (!ret) ret = sys_io_submit(ctx_id, nr, iocb64); return ret; @@ -744,9 +744,9 @@ #define SMBFS_NAME "smbfs" #define NCPFS_NAME "ncpfs" -asmlinkage int compat_sys_mount(char __user * dev_name, char __user * dir_name, - char __user * type, unsigned long flags, - void __user * data) +asmlinkage long compat_sys_mount(char __user * dev_name, char __user * dir_name, + char __user * type, unsigned long flags, + void __user * data) { unsigned long type_page; unsigned long data_page; diff -urN linux-2.6.7-rc2/fs/compat_ioctl.c linux-2.6.7-rc3/fs/compat_ioctl.c --- linux-2.6.7-rc2/fs/compat_ioctl.c 2004-06-07 12:54:50.394100017 -0700 +++ linux-2.6.7-rc3/fs/compat_ioctl.c 2004-06-07 12:55:16.501181311 -0700 @@ -218,9 +218,14 @@ { u32 tmp; - if(get_user(tmp, &up->base)) + if (get_user(tmp, &up->base)) return -EFAULT; - kp->base = compat_ptr(tmp); + + /* This is actually a physical address stored + * as a void pointer. + */ + kp->base = (void *)(unsigned long) tmp; + __get_user(kp->height, &up->height); __get_user(kp->width, &up->width); __get_user(kp->depth, &up->depth); @@ -3107,7 +3112,8 @@ set_fs(old_fs); if (!err) - err = put_user(kuid, (unsigned int *)compat_ptr(arg)); + err = put_user(kuid, + (unsigned int __user *) compat_ptr(arg)); return err; } @@ -3187,7 +3193,8 @@ static int do_ncp_getprivatedata(unsigned int fd, unsigned int cmd, unsigned long arg) { struct ncp_privatedata_ioctl_32 n32, __user *p32 = compat_ptr(arg); - struct ncp_privatedata_ioctl *p = __user compat_alloc_user_space(sizeof(*p)); + struct ncp_privatedata_ioctl __user *p = + compat_alloc_user_space(sizeof(*p)); u32 len; int err; @@ -3209,8 +3216,10 @@ static int do_ncp_setprivatedata(unsigned int fd, unsigned int cmd, unsigned long arg) { - struct ncp_privatedata_ioctl_32 n32, *p32 = compat_ptr(arg); - struct ncp_privatedata_ioctl *p = compat_alloc_user_space(sizeof(*p)); + struct ncp_privatedata_ioctl_32 n32; + struct ncp_privatedata_ioctl_32 __user *p32 = compat_ptr(arg); + struct ncp_privatedata_ioctl __user *p = + compat_alloc_user_space(sizeof(*p)); if (copy_from_user(&n32, p32, sizeof(n32)) || put_user(n32.len, &p->len) || diff -urN linux-2.6.7-rc2/fs/devfs/base.c linux-2.6.7-rc3/fs/devfs/base.c --- linux-2.6.7-rc2/fs/devfs/base.c 2004-05-09 19:32:02.000000000 -0700 +++ linux-2.6.7-rc3/fs/devfs/base.c 2004-06-07 12:55:16.505181477 -0700 @@ -848,13 +848,13 @@ static devfs_handle_t _devfs_walk_path(struct devfs_entry *dir, const char *name, int namelen, int traverse_symlink); -static ssize_t devfsd_read(struct file *file, char *buf, size_t len, +static ssize_t devfsd_read(struct file *file, char __user *buf, size_t len, loff_t * ppos); static int devfsd_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg); static int devfsd_close(struct inode *inode, struct file *file); #ifdef CONFIG_DEVFS_DEBUG -static ssize_t stat_read(struct file *file, char *buf, size_t len, +static ssize_t stat_read(struct file *file, char __user *buf, size_t len, loff_t * ppos); static struct file_operations stat_fops = { .read = stat_read, @@ -2579,7 +2579,7 @@ /* File operations for devfsd follow */ -static ssize_t devfsd_read(struct file *file, char *buf, size_t len, +static ssize_t devfsd_read(struct file *file, char __user *buf, size_t len, loff_t * ppos) { int done = FALSE; @@ -2693,7 +2693,7 @@ switch (cmd) { case DEVFSDIOC_GET_PROTO_REV: ival = DEVFSD_PROTOCOL_REVISION_KERNEL; - if (copy_to_user((void *)arg, &ival, sizeof ival)) + if (copy_to_user((void __user *)arg, &ival, sizeof ival)) return -EFAULT; break; case DEVFSDIOC_SET_EVENT_MASK: @@ -2732,7 +2732,7 @@ /*break; */ #ifdef CONFIG_DEVFS_DEBUG case DEVFSDIOC_SET_DEBUG_MASK: - if (copy_from_user(&ival, (void *)arg, sizeof ival)) + if (copy_from_user(&ival, (void __user *)arg, sizeof ival)) return -EFAULT; devfs_debug = ival; break; @@ -2772,7 +2772,7 @@ } /* End Function devfsd_close */ #ifdef CONFIG_DEVFS_DEBUG -static ssize_t stat_read(struct file *file, char *buf, size_t len, +static ssize_t stat_read(struct file *file, char __user *buf, size_t len, loff_t * ppos) { ssize_t num; diff -urN linux-2.6.7-rc2/fs/direct-io.c linux-2.6.7-rc3/fs/direct-io.c --- linux-2.6.7-rc2/fs/direct-io.c 2004-05-09 19:32:38.000000000 -0700 +++ linux-2.6.7-rc3/fs/direct-io.c 2004-06-07 12:55:16.506181518 -0700 @@ -690,8 +690,11 @@ static void clean_blockdev_aliases(struct dio *dio) { unsigned i; + unsigned nblocks; - for (i = 0; i < dio->blocks_available; i++) { + nblocks = dio->map_bh.b_size >> dio->inode->i_blkbits; + + for (i = 0; i < nblocks; i++) { unmap_underlying_metadata(dio->map_bh.b_bdev, dio->map_bh.b_blocknr + i); } @@ -987,13 +990,6 @@ } } /* end iovec loop */ - if (ret == -ENOTBLK && rw == WRITE) { - /* - * The remaining part of the request will be - * be handled by buffered I/O when we return - */ - ret = 0; - } /* * There may be some unwritten disk at the end of a part-written * fs-block-sized block. Go zero that now. @@ -1060,24 +1056,29 @@ kfree(dio); } } else { + ssize_t transferred = 0; + finished_one_bio(dio); ret2 = dio_await_completion(dio); if (ret == 0) ret = ret2; if (ret == 0) ret = dio->page_errors; - if (ret == 0 && dio->result) { + if (dio->result) { loff_t i_size = i_size_read(inode); - ret = dio->result; + transferred = dio->result; /* * Adjust the return value if the read crossed a * non-block-aligned EOF. */ - if (rw == READ && (offset + ret > i_size)) - ret = i_size - offset; + if (rw == READ && (offset + transferred > i_size)) + transferred = i_size - offset; } - dio_complete(dio, offset, ret); + dio_complete(dio, offset, transferred); + if (ret == 0) + ret = transferred; + /* We could have also come here on an AIO file extend */ if (!is_sync_kiocb(iocb) && rw == WRITE && ret >= 0 && dio->result == dio->size) @@ -1088,6 +1089,13 @@ aio_complete(iocb, ret, 0); kfree(dio); } + if (ret == -ENOTBLK && rw == WRITE) { + /* + * The entire request will be be handled by buffered I/O + * when we return + */ + ret = 0; + } return ret; } diff -urN linux-2.6.7-rc2/fs/dquot.c linux-2.6.7-rc3/fs/dquot.c --- linux-2.6.7-rc2/fs/dquot.c 2004-06-07 12:54:50.452102419 -0700 +++ linux-2.6.7-rc3/fs/dquot.c 2004-06-07 12:55:16.508181601 -0700 @@ -306,7 +306,7 @@ int dquot_acquire(struct dquot *dquot) { - int ret = 0; + int ret = 0, ret2 = 0; struct quota_info *dqopt = sb_dqopt(dquot->dq_sb); down(&dquot->dq_lock); @@ -319,8 +319,15 @@ /* Instantiate dquot if needed */ if (!test_bit(DQ_ACTIVE_B, &dquot->dq_flags) && !dquot->dq_off) { ret = dqopt->ops[dquot->dq_type]->commit_dqblk(dquot); + /* Write the info if needed */ + if (info_dirty(&dqopt->info[dquot->dq_type])) + ret2 = dqopt->ops[dquot->dq_type]->write_file_info(dquot->dq_sb, dquot->dq_type); if (ret < 0) goto out_iolock; + if (ret2 < 0) { + ret = ret2; + goto out_iolock; + } } set_bit(DQ_ACTIVE_B, &dquot->dq_flags); out_iolock: @@ -334,7 +341,7 @@ */ int dquot_commit(struct dquot *dquot) { - int ret = 0; + int ret = 0, ret2 = 0; struct quota_info *dqopt = sb_dqopt(dquot->dq_sb); down(&dqopt->dqio_sem); @@ -346,12 +353,15 @@ spin_unlock(&dq_list_lock); /* Inactive dquot can be only if there was error during read/init * => we have better not writing it */ - if (test_bit(DQ_ACTIVE_B, &dquot->dq_flags)) + if (test_bit(DQ_ACTIVE_B, &dquot->dq_flags)) { ret = dqopt->ops[dquot->dq_type]->commit_dqblk(dquot); + if (info_dirty(&dqopt->info[dquot->dq_type])) + ret2 = dqopt->ops[dquot->dq_type]->write_file_info(dquot->dq_sb, dquot->dq_type); + if (ret >= 0) + ret = ret2; + } out_sem: up(&dqopt->dqio_sem); - if (info_dirty(&dqopt->info[dquot->dq_type])) - dquot->dq_sb->dq_op->write_info(dquot->dq_sb, dquot->dq_type); return ret; } @@ -360,7 +370,7 @@ */ int dquot_release(struct dquot *dquot) { - int ret = 0; + int ret = 0, ret2 = 0; struct quota_info *dqopt = sb_dqopt(dquot->dq_sb); down(&dquot->dq_lock); @@ -368,8 +378,14 @@ if (atomic_read(&dquot->dq_count) > 1) goto out_dqlock; down(&dqopt->dqio_sem); - if (dqopt->ops[dquot->dq_type]->release_dqblk) + if (dqopt->ops[dquot->dq_type]->release_dqblk) { ret = dqopt->ops[dquot->dq_type]->release_dqblk(dquot); + /* Write the info */ + if (info_dirty(&dqopt->info[dquot->dq_type])) + ret2 = dqopt->ops[dquot->dq_type]->write_file_info(dquot->dq_sb, dquot->dq_type); + if (ret >= 0) + ret = ret2; + } clear_bit(DQ_ACTIVE_B, &dquot->dq_flags); up(&dqopt->dqio_sem); out_dqlock: diff -urN linux-2.6.7-rc2/fs/exec.c linux-2.6.7-rc3/fs/exec.c --- linux-2.6.7-rc2/fs/exec.c 2004-06-07 12:54:50.455102543 -0700 +++ linux-2.6.7-rc3/fs/exec.c 2004-06-07 12:55:16.510181684 -0700 @@ -1074,14 +1074,14 @@ int retval; int i; - sched_balance_exec(); - file = open_exec(filename); retval = PTR_ERR(file); if (IS_ERR(file)) return retval; + sched_balance_exec(); + bprm.p = PAGE_SIZE*MAX_ARG_PAGES-sizeof(void *); memset(bprm.page, 0, MAX_ARG_PAGES*sizeof(bprm.page[0])); diff -urN linux-2.6.7-rc2/fs/ext3/ioctl.c linux-2.6.7-rc3/fs/ext3/ioctl.c --- linux-2.6.7-rc2/fs/ext3/ioctl.c 2004-05-09 19:32:28.000000000 -0700 +++ linux-2.6.7-rc3/fs/ext3/ioctl.c 2004-06-07 12:55:16.515181891 -0700 @@ -26,7 +26,7 @@ switch (cmd) { case EXT3_IOC_GETFLAGS: flags = ei->i_flags & EXT3_FL_USER_VISIBLE; - return put_user(flags, (int *) arg); + return put_user(flags, (int __user *) arg); case EXT3_IOC_SETFLAGS: { handle_t *handle = NULL; int err; @@ -40,7 +40,7 @@ if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER)) return -EACCES; - if (get_user(flags, (int *) arg)) + if (get_user(flags, (int __user *) arg)) return -EFAULT; if (!S_ISDIR(inode->i_mode)) @@ -100,7 +100,7 @@ } case EXT3_IOC_GETVERSION: case EXT3_IOC_GETVERSION_OLD: - return put_user(inode->i_generation, (int *) arg); + return put_user(inode->i_generation, (int __user *) arg); case EXT3_IOC_SETVERSION: case EXT3_IOC_SETVERSION_OLD: { handle_t *handle; @@ -112,7 +112,7 @@ return -EPERM; if (IS_RDONLY(inode)) return -EROFS; - if (get_user(generation, (int *) arg)) + if (get_user(generation, (int __user *) arg)) return -EFAULT; handle = ext3_journal_start(inode, 1); diff -urN linux-2.6.7-rc2/fs/ext3/namei.c linux-2.6.7-rc3/fs/ext3/namei.c --- linux-2.6.7-rc2/fs/ext3/namei.c 2004-06-07 12:54:50.527105526 -0700 +++ linux-2.6.7-rc3/fs/ext3/namei.c 2004-06-07 12:55:16.517181974 -0700 @@ -1962,8 +1962,6 @@ goto out_brelse; NEXT_ORPHAN(inode) = 0; err = ext3_mark_iloc_dirty(handle, inode, &iloc); - if (err) - goto out_brelse; out_err: ext3_std_error(inode->i_sb, err); @@ -2264,11 +2262,15 @@ /* * ok, that's it */ - retval = ext3_delete_entry(handle, old_dir, old_de, old_bh); - if (retval == -ENOENT) { - /* - * old_de could have moved out from under us. - */ + if (le32_to_cpu(old_de->inode) != old_inode->i_ino || + old_de->name_len != old_dentry->d_name.len || + strncmp(old_de->name, old_dentry->d_name.name, old_de->name_len) || + (retval = ext3_delete_entry(handle, old_dir, + old_de, old_bh)) == -ENOENT) { + /* old_de could have moved from under us during htree split, so + * make sure that we are deleting the right entry. We might + * also be pointing to a stale entry in the unused part of + * old_bh so just checking inum and the name isn't enough. */ struct buffer_head *old_bh2; struct ext3_dir_entry_2 *old_de2; diff -urN linux-2.6.7-rc2/fs/ext3/super.c linux-2.6.7-rc3/fs/ext3/super.c --- linux-2.6.7-rc2/fs/ext3/super.c 2004-06-07 12:54:50.543106188 -0700 +++ linux-2.6.7-rc3/fs/ext3/super.c 2004-06-07 12:55:16.518182015 -0700 @@ -1643,6 +1643,7 @@ if (!journal) { printk(KERN_ERR "EXT3-fs: Could not load journal inode\n"); iput(journal_inode); + return NULL; } journal->j_private = sb; ext3_init_journal_params(EXT3_SB(sb), journal); diff -urN linux-2.6.7-rc2/fs/fs-writeback.c linux-2.6.7-rc3/fs/fs-writeback.c --- linux-2.6.7-rc2/fs/fs-writeback.c 2004-06-07 12:54:50.608108880 -0700 +++ linux-2.6.7-rc3/fs/fs-writeback.c 2004-06-07 12:55:16.521182139 -0700 @@ -535,6 +535,9 @@ .sync_mode = WB_SYNC_ALL, }; + if (inode->i_mapping->backing_dev_info->memory_backed) + return; + spin_lock(&inode_lock); __writeback_single_inode(inode, &wbc); spin_unlock(&inode_lock); diff -urN linux-2.6.7-rc2/fs/hfsplus/ioctl.c linux-2.6.7-rc3/fs/hfsplus/ioctl.c --- linux-2.6.7-rc2/fs/hfsplus/ioctl.c 2004-05-09 19:32:26.000000000 -0700 +++ linux-2.6.7-rc3/fs/hfsplus/ioctl.c 2004-06-07 12:55:16.524182264 -0700 @@ -31,7 +31,7 @@ flags |= EXT2_FLAG_APPEND; /* EXT2_APPEND_FL */ if (HFSPLUS_I(inode).userflags & HFSPLUS_FLG_NODUMP) flags |= EXT2_FLAG_NODUMP; /* EXT2_NODUMP_FL */ - return put_user(flags, (int *)arg); + return put_user(flags, (int __user *)arg); case HFSPLUS_IOC_EXT2_SETFLAGS: { if (IS_RDONLY(inode)) return -EROFS; @@ -39,7 +39,7 @@ if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER)) return -EACCES; - if (get_user(flags, (int *)arg)) + if (get_user(flags, (int __user *)arg)) return -EFAULT; if (flags & (EXT2_FLAG_IMMUTABLE|EXT2_FLAG_APPEND) || diff -urN linux-2.6.7-rc2/fs/jffs/inode-v23.c linux-2.6.7-rc3/fs/jffs/inode-v23.c --- linux-2.6.7-rc2/fs/jffs/inode-v23.c 2004-05-09 19:32:39.000000000 -0700 +++ linux-2.6.7-rc3/fs/jffs/inode-v23.c 2004-06-07 12:55:16.673188435 -0700 @@ -1582,7 +1582,7 @@ struct jffs_fmcontrol *fmc = c->fmc; printk("Flash status -- "); if (!access_ok(VERIFY_WRITE, - (struct jffs_flash_status *)arg, + (struct jffs_flash_status __user *)arg, sizeof(struct jffs_flash_status))) { D(printk("jffs_ioctl(): Bad arg in " "JFFS_GET_STATUS ioctl!\n")); @@ -1598,7 +1598,7 @@ "begin: %d, end: %d\n", fst.size, fst.used, fst.dirty, fst.begin, fst.end); - if (copy_to_user((struct jffs_flash_status *)arg, + if (copy_to_user((struct jffs_flash_status __user *)arg, &fst, sizeof(struct jffs_flash_status))) { ret = -EFAULT; diff -urN linux-2.6.7-rc2/fs/ncpfs/file.c linux-2.6.7-rc3/fs/ncpfs/file.c --- linux-2.6.7-rc2/fs/ncpfs/file.c 2004-05-09 19:31:59.000000000 -0700 +++ linux-2.6.7-rc3/fs/ncpfs/file.c 2004-06-07 12:55:16.691189181 -0700 @@ -99,7 +99,7 @@ } static ssize_t -ncp_file_read(struct file *file, char *buf, size_t count, loff_t *ppos) +ncp_file_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) { struct dentry *dentry = file->f_dentry; struct inode *inode = dentry->d_inode; @@ -187,7 +187,7 @@ } static ssize_t -ncp_file_write(struct file *file, const char *buf, size_t count, loff_t *ppos) +ncp_file_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { struct dentry *dentry = file->f_dentry; struct inode *inode = dentry->d_inode; diff -urN linux-2.6.7-rc2/fs/ncpfs/ncplib_kernel.c linux-2.6.7-rc3/fs/ncpfs/ncplib_kernel.c --- linux-2.6.7-rc2/fs/ncpfs/ncplib_kernel.c 2004-05-09 19:32:29.000000000 -0700 +++ linux-2.6.7-rc3/fs/ncpfs/ncplib_kernel.c 2004-06-07 12:55:16.691189181 -0700 @@ -1002,7 +1002,7 @@ */ int ncp_read_bounce(struct ncp_server *server, const char *file_id, - __u32 offset, __u16 to_read, char *target, int *bytes_read, + __u32 offset, __u16 to_read, char __user *target, int *bytes_read, void* bounce, __u32 bufsize) { int result; diff -urN linux-2.6.7-rc2/fs/ncpfs/ncplib_kernel.h linux-2.6.7-rc3/fs/ncpfs/ncplib_kernel.h --- linux-2.6.7-rc2/fs/ncpfs/ncplib_kernel.h 2004-05-09 19:32:26.000000000 -0700 +++ linux-2.6.7-rc3/fs/ncpfs/ncplib_kernel.h 2004-06-07 12:55:16.692189222 -0700 @@ -56,7 +56,7 @@ return sizeof(struct ncp_reply_header) + 2 + 2 + size + 8; }; int ncp_read_bounce(struct ncp_server *, const char *, __u32, __u16, - char *, int *, void* bounce, __u32 bouncelen); + char __user *, int *, void* bounce, __u32 bouncelen); int ncp_read_kernel(struct ncp_server *, const char *, __u32, __u16, char *, int *); int ncp_write_kernel(struct ncp_server *, const char *, __u32, __u16, diff -urN linux-2.6.7-rc2/fs/nfs/direct.c linux-2.6.7-rc3/fs/nfs/direct.c --- linux-2.6.7-rc2/fs/nfs/direct.c 2004-06-07 12:54:51.077128305 -0700 +++ linux-2.6.7-rc3/fs/nfs/direct.c 2004-06-07 12:55:16.693189264 -0700 @@ -466,7 +466,7 @@ * cache. */ ssize_t -nfs_file_direct_read(struct kiocb *iocb, char *buf, size_t count, loff_t pos) +nfs_file_direct_read(struct kiocb *iocb, char __user *buf, size_t count, loff_t pos) { ssize_t retval = -EINVAL; loff_t *ppos = &iocb->ki_pos; @@ -475,7 +475,7 @@ struct address_space *mapping = file->f_mapping; struct inode *inode = mapping->host; struct iovec iov = { - .iov_base = buf, + .iov_base = (char *)buf, .iov_len = count, }; @@ -546,7 +546,7 @@ struct address_space *mapping = file->f_mapping; struct inode *inode = mapping->host; struct iovec iov = { - .iov_base = buf, + .iov_base = (char __user *)buf, .iov_len = count, }; diff -urN linux-2.6.7-rc2/fs/nfs/read.c linux-2.6.7-rc3/fs/nfs/read.c --- linux-2.6.7-rc2/fs/nfs/read.c 2004-06-07 12:54:51.119130045 -0700 +++ linux-2.6.7-rc3/fs/nfs/read.c 2004-06-07 12:55:16.699189512 -0700 @@ -103,22 +103,16 @@ if (!rdata) return -ENOMEM; - *rdata = (struct nfs_read_data) { - .flags = (IS_SWAPFILE(inode)? NFS_RPC_SWAPFLAGS : 0), - .cred = NULL, - .inode = inode, - .pages = LIST_HEAD_INIT(rdata->pages), - .args = { - .fh = NFS_FH(inode), - .lockowner = current->files, - .pages = &page, - .pgbase = 0UL, - .count = rsize, - }, - .res = { - .fattr = &rdata->fattr, - } - }; + memset(rdata, 0, sizeof(*rdata)); + rdata->flags = (IS_SWAPFILE(inode)? NFS_RPC_SWAPFLAGS : 0); + rdata->inode = inode; + INIT_LIST_HEAD(&rdata->pages); + rdata->args.fh = NFS_FH(inode); + rdata->args.lockowner = current->files; + rdata->args.pages = &page; + rdata->args.pgbase = 0UL; + rdata->args.count = rsize; + rdata->res.fattr = &rdata->fattr; dprintk("NFS: nfs_readpage_sync(%p)\n", page); diff -urN linux-2.6.7-rc2/fs/nfs/write.c linux-2.6.7-rc3/fs/nfs/write.c --- linux-2.6.7-rc2/fs/nfs/write.c 2004-06-07 12:54:51.120130086 -0700 +++ linux-2.6.7-rc3/fs/nfs/write.c 2004-06-07 12:55:16.700189554 -0700 @@ -185,23 +185,17 @@ if (!wdata) return -ENOMEM; - *wdata = (struct nfs_write_data) { - .flags = how, - .cred = NULL, - .inode = inode, - .args = { - .fh = NFS_FH(inode), - .lockowner = current->files, - .pages = &page, - .stable = NFS_FILE_SYNC, - .pgbase = offset, - .count = wsize, - }, - .res = { - .fattr = &wdata->fattr, - .verf = &wdata->verf, - }, - }; + memset(wdata, 0, sizeof(*wdata)); + wdata->flags = how; + wdata->inode = inode; + wdata->args.fh = NFS_FH(inode); + wdata->args.lockowner = current->files; + wdata->args.pages = &page; + wdata->args.stable = NFS_FILE_SYNC; + wdata->args.pgbase = offset; + wdata->args.count = wsize; + wdata->res.fattr = &wdata->fattr; + wdata->res.verf = &wdata->verf; dprintk("NFS: nfs_writepage_sync(%s/%Ld %d@%Ld)\n", inode->i_sb->s_id, diff -urN linux-2.6.7-rc2/fs/nfsd/nfs3proc.c linux-2.6.7-rc3/fs/nfsd/nfs3proc.c --- linux-2.6.7-rc2/fs/nfsd/nfs3proc.c 2004-05-09 19:32:28.000000000 -0700 +++ linux-2.6.7-rc3/fs/nfsd/nfs3proc.c 2004-06-07 12:55:16.701189595 -0700 @@ -436,7 +436,6 @@ resp->buflen = count; resp->common.err = nfs_ok; resp->buffer = argp->buffer; - resp->offset = NULL; resp->rqstp = rqstp; nfserr = nfsd_readdir(rqstp, &resp->fh, (loff_t*) &argp->cookie, &resp->common, nfs3svc_encode_entry); diff -urN linux-2.6.7-rc2/fs/nfsd/nfs3xdr.c linux-2.6.7-rc3/fs/nfsd/nfs3xdr.c --- linux-2.6.7-rc2/fs/nfsd/nfs3xdr.c 2004-06-07 12:54:51.124130252 -0700 +++ linux-2.6.7-rc3/fs/nfsd/nfs3xdr.c 2004-06-07 12:55:16.702189637 -0700 @@ -847,8 +847,18 @@ int elen; /* estimated entry length in words */ int num_entry_words = 0; /* actual number of words */ - if (cd->offset) - xdr_encode_hyper(cd->offset, (u64) offset); + if (cd->offset) { + u64 offset64 = offset; + + if (unlikely(cd->offset1)) { + /* we ended up with offset on a page boundary */ + *cd->offset = htonl(offset64 >> 32); + *cd->offset1 = htonl(offset64 & 0xffffffff); + cd->offset1 = NULL; + } else { + xdr_encode_hyper(cd->offset, (u64) offset); + } + } /* dprintk("encode_entry(%.*s @%ld%s)\n", @@ -929,17 +939,32 @@ /* update offset */ cd->offset = cd->buffer + (cd->offset - tmp); } else { + unsigned int offset_r = (cd->offset - tmp) << 2; + + /* update pointer to offset location. + * This is a 64bit quantity, so we need to + * deal with 3 cases: + * - entirely in first page + * - entirely in second page + * - 4 bytes in each page + */ + if (offset_r + 8 <= len1) { + cd->offset = p + (cd->offset - tmp); + } else if (offset_r >= len1) { + cd->offset -= len1 >> 2; + } else { + /* sitting on the fence */ + BUG_ON(offset_r != len1 - 4); + cd->offset = p + (cd->offset - tmp); + cd->offset1 = tmp; + } + len2 = (num_entry_words << 2) - len1; /* move from temp page to current and next pages */ memmove(p, tmp, len1); memmove(tmp, (caddr_t)tmp+len1, len2); - /* update offset */ - if (((cd->offset - tmp) << 2) < len1) - cd->offset = p + (cd->offset - tmp); - else - cd->offset -= len1 >> 2; p = tmp + (len2 >> 2); } } diff -urN linux-2.6.7-rc2/fs/nfsd/nfs4proc.c linux-2.6.7-rc3/fs/nfsd/nfs4proc.c --- linux-2.6.7-rc2/fs/nfsd/nfs4proc.c 2004-05-09 19:33:21.000000000 -0700 +++ linux-2.6.7-rc3/fs/nfsd/nfs4proc.c 2004-06-07 12:55:16.704189720 -0700 @@ -389,7 +389,7 @@ break; default: - BUG(); + status = nfserr_badtype; } if (!status) { diff -urN linux-2.6.7-rc2/fs/nfsd/nfs4state.c linux-2.6.7-rc3/fs/nfsd/nfs4state.c --- linux-2.6.7-rc2/fs/nfsd/nfs4state.c 2004-05-09 19:32:54.000000000 -0700 +++ linux-2.6.7-rc3/fs/nfsd/nfs4state.c 2004-06-07 12:55:16.705189761 -0700 @@ -495,15 +495,13 @@ gen_clid(new); gen_confirm(new); add_to_unconfirmed(new, strhashval); - } else if (!cmp_clid(&conf->cl_clientid, &unconf->cl_clientid) && - !cmp_verf(&conf->cl_confirm, &unconf->cl_confirm)) { + } else if (!cmp_verf(&conf->cl_confirm, &unconf->cl_confirm)) { /* * CASE3: * confirmed found (name, principal match) * confirmed verifier does not match input clverifier * * unconfirmed found (name match) - * confirmed->cl_clientid != unconfirmed->cl_clientid and * confirmed->cl_confirm != unconfirmed->cl_confirm * * remove unconfirmed. @@ -2334,28 +2332,27 @@ /* find the lockowner */ status = nfs_ok; - for (i=0; i < LOCK_HASH_SIZE; i++) { - list_for_each_entry(local, &lock_ownerstr_hashtbl[i], so_strhash) { - if(cmp_owner_str(local, owner, clid)) - break; - } - } - if (local) { - struct nfs4_stateid *stp; - - /* check for any locks held by any stateid associated with the - * (lock) stateowner */ - status = nfserr_locks_held; - list_for_each_entry(stp, &local->so_perfilestate, st_perfilestate) { - if(stp->st_vfs_set) { - if (check_for_locks(&stp->st_vfs_file, local)) - goto out; + for (i=0; i < LOCK_HASH_SIZE; i++) + list_for_each_entry(local, &lock_ownerstr_hashtbl[i], so_strhash) + if(cmp_owner_str(local, owner, clid)) { + struct nfs4_stateid *stp; + + /* check for any locks held by any stateid + * associated with the (lock) stateowner */ + status = nfserr_locks_held; + list_for_each_entry(stp, &local->so_perfilestate, + st_perfilestate) { + if(stp->st_vfs_set) { + if (check_for_locks(&stp->st_vfs_file, + local)) + goto out; + } + } + /* no locks held by (lock) stateowner */ + status = nfs_ok; + release_stateowner(local); + goto out; } - } - /* no locks held by (lock) stateowner */ - status = nfs_ok; - release_stateowner(local); - } out: nfs4_unlock_state(); return status; diff -urN linux-2.6.7-rc2/fs/nfsd/nfs4xdr.c linux-2.6.7-rc3/fs/nfsd/nfs4xdr.c --- linux-2.6.7-rc2/fs/nfsd/nfs4xdr.c 2004-06-07 12:54:51.126130334 -0700 +++ linux-2.6.7-rc3/fs/nfsd/nfs4xdr.c 2004-06-07 12:55:16.707189844 -0700 @@ -538,9 +538,8 @@ case NF4SOCK: case NF4FIFO: case NF4DIR: - break; default: - goto xdr_error; + break; } READ_BUF(4); @@ -1289,6 +1288,49 @@ NF4SOCK, NF4BAD, NF4LNK, NF4BAD, }; +static inline int +xdr_padding(int l) +{ + return 3 - ((l - 1) & 3); /* smallest i>=0 such that (l+i)%4 = 0 */ +} + +static int +nfsd4_encode_name(struct svc_rqst *rqstp, int group, uid_t id, + u32 **p, int *buflen) +{ + int status; + u32 len; + + if (*buflen < (XDR_QUADLEN(IDMAP_NAMESZ) << 2) + 4) + return nfserr_resource; + if (group) + status = nfsd_map_gid_to_name(rqstp, id, (u8 *)(*p + 1)); + else + status = nfsd_map_uid_to_name(rqstp, id, (u8 *)(*p + 1)); + if (status < 0) + return nfserrno(status); + len = (unsigned)status; + *(*p)++ = htonl(len); + memset((u8 *)*p + len, 0, xdr_padding(len)); + *p += XDR_QUADLEN(len); + *buflen -= (XDR_QUADLEN(len) << 2) + 4; + BUG_ON(*buflen < 0); + return 0; +} + +static inline int +nfsd4_encode_user(struct svc_rqst *rqstp, uid_t uid, u32 **p, int *buflen) +{ + return nfsd4_encode_name(rqstp, uid, 0, p, buflen); +} + +static inline int +nfsd4_encode_group(struct svc_rqst *rqstp, uid_t gid, u32 **p, int *buflen) +{ + return nfsd4_encode_name(rqstp, gid, 1, p, buflen); +} + + /* * Note: @fhp can be NULL; in this case, we might have to compose the filehandle * ourselves. @@ -1304,10 +1346,6 @@ u32 bmval0 = bmval[0]; u32 bmval1 = bmval[1]; struct kstat stat; - char owner[IDMAP_NAMESZ]; - u32 ownerlen = 0; - char group[IDMAP_NAMESZ]; - u32 grouplen = 0; struct svc_fh tempfh; struct kstatfs statfs; int buflen = *countp << 2; @@ -1338,23 +1376,6 @@ goto out; fhp = &tempfh; } - if (bmval1 & FATTR4_WORD1_OWNER) { - int temp = nfsd_map_uid_to_name(rqstp, stat.uid, owner); - if (temp < 0) { - status = temp; - goto out_nfserr; - } - ownerlen = (unsigned) temp; - } - if (bmval1 & FATTR4_WORD1_OWNER_GROUP) { - int temp = nfsd_map_gid_to_name(rqstp, stat.gid, group); - if (temp < 0) { - status = temp; - goto out_nfserr; - } - grouplen = (unsigned) temp; - } - if ((buflen -= 16) < 0) goto out_resource; @@ -1536,18 +1557,18 @@ WRITE32(stat.nlink); } if (bmval1 & FATTR4_WORD1_OWNER) { - buflen -= (XDR_QUADLEN(ownerlen) << 2) + 4; - if (buflen < 0) + status = nfsd4_encode_user(rqstp, stat.uid, &p, &buflen); + if (status == nfserr_resource) goto out_resource; - WRITE32(ownerlen); - WRITEMEM(owner, ownerlen); + if (status) + goto out; } if (bmval1 & FATTR4_WORD1_OWNER_GROUP) { - buflen -= (XDR_QUADLEN(grouplen) << 2) + 4; - if (buflen < 0) + status = nfsd4_encode_group(rqstp, stat.gid, &p, &buflen); + if (status == nfserr_resource) goto out_resource; - WRITE32(grouplen); - WRITEMEM(group, grouplen); + if (status) + goto out; } if (bmval1 & FATTR4_WORD1_RAWDEV) { if ((buflen -= 8) < 0) diff -urN linux-2.6.7-rc2/fs/nfsd/nfsfh.c linux-2.6.7-rc3/fs/nfsd/nfsfh.c --- linux-2.6.7-rc2/fs/nfsd/nfsfh.c 2004-06-07 12:54:51.128130417 -0700 +++ linux-2.6.7-rc3/fs/nfsd/nfsfh.c 2004-06-07 12:55:16.708189885 -0700 @@ -56,7 +56,7 @@ /* make sure parents give x permission to user */ int err; parent = dget_parent(tdentry); - err = permission(parent->d_inode, S_IXOTH, NULL); + err = permission(parent->d_inode, MAY_EXEC, NULL); if (err < 0) { dput(parent); break; diff -urN linux-2.6.7-rc2/fs/nfsd/vfs.c linux-2.6.7-rc3/fs/nfsd/vfs.c --- linux-2.6.7-rc2/fs/nfsd/vfs.c 2004-06-07 12:54:51.130130500 -0700 +++ linux-2.6.7-rc3/fs/nfsd/vfs.c 2004-06-07 12:55:16.709189927 -0700 @@ -567,7 +567,7 @@ static spinlock_t ra_lock = SPIN_LOCK_UNLOCKED; static inline struct raparms * -nfsd_get_raparms(dev_t dev, ino_t ino) +nfsd_get_raparms(dev_t dev, ino_t ino, struct address_space *mapping) { struct raparms *ra, **rap, **frap = NULL; int depth = 0; @@ -589,7 +589,7 @@ ra = *frap; ra->p_dev = dev; ra->p_ino = ino; - memset(&ra->p_ra, 0, sizeof(ra->p_ra)); + file_ra_state_init(&ra->p_ra, mapping); found: if (rap != &raparm_cache) { *rap = ra->p_next; @@ -661,7 +661,8 @@ #endif /* Get readahead parameters */ - ra = nfsd_get_raparms(inode->i_sb->s_dev, inode->i_ino); + ra = nfsd_get_raparms(inode->i_sb->s_dev, inode->i_ino, + inode->i_mapping->host->i_mapping); if (ra) file.f_ra = ra->p_ra; @@ -677,9 +678,12 @@ } /* Write back readahead params */ - if (ra) + if (ra) { + spin_lock(&ra_lock); ra->p_ra = file.f_ra; - + ra->p_count--; + spin_unlock(&ra_lock); + } if (err >= 0) { nfsdstats.io_read += err; *count = err; diff -urN linux-2.6.7-rc2/fs/ntfs/ChangeLog linux-2.6.7-rc3/fs/ntfs/ChangeLog --- linux-2.6.7-rc2/fs/ntfs/ChangeLog 2004-06-07 12:54:51.147131204 -0700 +++ linux-2.6.7-rc3/fs/ntfs/ChangeLog 2004-06-07 12:55:16.711190009 -0700 @@ -25,6 +25,22 @@ sufficient for synchronisation here. We then just need to make sure ntfs_readpage/writepage/truncate interoperate properly with us. +2.1.12 - Fix the second fix to the decompression engine and some cleanups. + + - Add a new address space operations struct, ntfs_mst_aops, for mst + protected attributes. This is because the default ntfs_aops do not + make sense with mst protected data and were they to write anything to + such an attribute they would cause data corruption so we provide + ntfs_mst_aops which does not have any write related operations set. + - Cleanup dirty ntfs inode handling (fs/ntfs/inode.[hc]) which also + includes an adapted ntfs_commit_inode() and an implementation of + ntfs_write_inode() which for now just cleans dirty inodes without + writing them (it does emit a warning that this is happening). + - Undo the second decompression engine fix (see 2.1.9 release ChangeLog + entry) as it was only fixing a theoretical bug but at the same time + it badly broke the handling of sparse and uncompressed compression + blocks. + 2.1.11 - Driver internal cleanups. - Only build logfile.o if building the driver with read-write support. diff -urN linux-2.6.7-rc2/fs/ntfs/Makefile linux-2.6.7-rc3/fs/ntfs/Makefile --- linux-2.6.7-rc2/fs/ntfs/Makefile 2004-06-07 12:54:51.155131536 -0700 +++ linux-2.6.7-rc3/fs/ntfs/Makefile 2004-06-07 12:55:16.711190009 -0700 @@ -5,7 +5,7 @@ ntfs-objs := aops.o attrib.o compress.o debug.o dir.o file.o inode.o mft.o \ mst.o namei.o super.o sysctl.o unistr.o upcase.o -EXTRA_CFLAGS = -DNTFS_VERSION=\"2.1.11\" +EXTRA_CFLAGS = -DNTFS_VERSION=\"2.1.12\" ifeq ($(CONFIG_NTFS_DEBUG),y) EXTRA_CFLAGS += -DDEBUG diff -urN linux-2.6.7-rc2/fs/ntfs/aops.c linux-2.6.7-rc3/fs/ntfs/aops.c --- linux-2.6.7-rc2/fs/ntfs/aops.c 2004-05-09 19:33:10.000000000 -0700 +++ linux-2.6.7-rc3/fs/ntfs/aops.c 2004-06-07 12:55:16.712190051 -0700 @@ -1788,3 +1788,12 @@ #endif }; +/** + * ntfs_mst_aops - general address space operations for mst protecteed inodes + * and attributes + */ +struct address_space_operations ntfs_mst_aops = { + .readpage = ntfs_readpage, /* Fill page with data. */ + .sync_page = block_sync_page, /* Currently, just unplugs the + disk request queue. */ +}; diff -urN linux-2.6.7-rc2/fs/ntfs/compress.c linux-2.6.7-rc3/fs/ntfs/compress.c --- linux-2.6.7-rc2/fs/ntfs/compress.c 2004-06-07 12:54:51.177132447 -0700 +++ linux-2.6.7-rc3/fs/ntfs/compress.c 2004-06-07 12:55:16.715190175 -0700 @@ -507,7 +507,7 @@ */ unsigned int nr_pages = (end_vcn - start_vcn) << vol->cluster_size_bits >> PAGE_CACHE_SHIFT; - unsigned int xpage, max_page, max_ofs, cur_page, cur_ofs, i; + unsigned int xpage, max_page, cur_page, cur_ofs, i; unsigned int cb_clusters, cb_max_ofs; int block, max_block, cb_max_page, bhs_size, nr_bhs, err = 0; struct page **pages; @@ -550,11 +550,8 @@ */ max_page = ((VFS_I(ni)->i_size + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT) - offset; - max_ofs = (VFS_I(ni)->i_size + PAGE_CACHE_SIZE - 1) & ~PAGE_CACHE_MASK; - if (nr_pages < max_page) { + if (nr_pages < max_page) max_page = nr_pages; - max_ofs = 0; - } for (i = 0; i < max_page; i++, offset++) { if (i != xpage) pages[i] = grab_cache_page_nowait(mapping, offset); @@ -722,14 +719,8 @@ cb_max_page >>= PAGE_CACHE_SHIFT; /* Catch end of file inside a compression block. */ - if (cb_max_page >= max_page) { - if (cb_max_page > max_page) { - cb_max_page = max_page; - cb_max_ofs = max_ofs; - } else if (cb_max_ofs > max_ofs) { - cb_max_ofs = max_ofs; - } - } + if (cb_max_page > max_page) + cb_max_page = max_page; if (vcn == start_vcn - cb_clusters) { /* Sparse cb, zero out page range overlapping the cb. */ @@ -897,7 +888,8 @@ if (page) { ntfs_error(vol->sb, "Still have pages left! " "Terminating them with extreme " - "prejudice."); + "prejudice. Inode 0x%lx, page index " + "0x%lx.", ni->mft_no, page->index); if (cur_page == xpage && !xpage_done) SetPageError(page); flush_dcache_page(page); diff -urN linux-2.6.7-rc2/fs/ntfs/dir.c linux-2.6.7-rc3/fs/ntfs/dir.c --- linux-2.6.7-rc2/fs/ntfs/dir.c 2004-06-07 12:54:51.181132612 -0700 +++ linux-2.6.7-rc3/fs/ntfs/dir.c 2004-06-07 12:55:16.717190258 -0700 @@ -1196,7 +1196,7 @@ ia_mapping = vdir->i_mapping; bmp_vi = ndir->itype.index.bmp_ino; if (unlikely(!bmp_vi)) { - ntfs_debug("Inode %lu, regetting index bitmap.", vdir->i_ino); + ntfs_debug("Inode 0x%lx, regetting index bitmap.", vdir->i_ino); bmp_vi = ntfs_attr_iget(vdir, AT_BITMAP, I30, 4); if (unlikely(IS_ERR(bmp_vi))) { ntfs_error(sb, "Failed to get bitmap attribute."); diff -urN linux-2.6.7-rc2/fs/ntfs/inode.c linux-2.6.7-rc3/fs/ntfs/inode.c --- linux-2.6.7-rc2/fs/ntfs/inode.c 2004-06-07 12:54:51.191133027 -0700 +++ linux-2.6.7-rc3/fs/ntfs/inode.c 2004-06-07 12:55:16.720190382 -0700 @@ -872,7 +872,7 @@ /* Setup the operations for this inode. */ vi->i_op = &ntfs_dir_inode_ops; vi->i_fop = &ntfs_dir_ops; - vi->i_mapping->a_ops = &ntfs_aops; + vi->i_mapping->a_ops = &ntfs_mst_aops; } else { /* It is a file. */ reinit_attr_search_ctx(ctx); @@ -1249,7 +1249,10 @@ /* Setup the operations for this attribute inode. */ vi->i_op = NULL; vi->i_fop = NULL; - vi->i_mapping->a_ops = &ntfs_aops; + if (NInoMstProtected(ni)) + vi->i_mapping->a_ops = &ntfs_mst_aops; + else + vi->i_mapping->a_ops = &ntfs_aops; if (!NInoCompressed(ni)) vi->i_blocks = ni->allocated_size >> 9; @@ -1339,7 +1342,7 @@ ni->name_len = 0; /* - * This sets up our little cheat allowing us to reuse the async io + * This sets up our little cheat allowing us to reuse the async read io * completion handler for directories. */ ni->itype.index.block_size = vol->mft_record_size; @@ -1703,18 +1706,6 @@ } /** - * ntfs_commit_inode - write out a dirty inode - * @ni: inode to write out - * - */ -int ntfs_commit_inode(ntfs_inode *ni) -{ - ntfs_debug("Entering for inode 0x%lx.", ni->mft_no); - NInoClearDirty(ni); - return 0; -} - -/** * ntfs_put_inode - handler for when the inode reference count is decremented * @vi: vfs inode * @@ -1742,34 +1733,6 @@ void __ntfs_clear_inode(ntfs_inode *ni) { - int err; - - ntfs_debug("Entering for inode 0x%lx.", ni->mft_no); - if (NInoDirty(ni)) { - err = ntfs_commit_inode(ni); - if (err) { - ntfs_error(ni->vol->sb, "Failed to commit dirty " - "inode synchronously."); - // FIXME: Do something!!! - } - } - /* Synchronize with ntfs_commit_inode(). */ - down(&ni->mrec_lock); - up(&ni->mrec_lock); - if (NInoDirty(ni)) { - ntfs_error(ni->vol->sb, "Failed to commit dirty inode " - "asynchronously."); - // FIXME: Do something!!! - } - /* No need to lock at this stage as no one else has a reference. */ - if (ni->nr_extents > 0) { - int i; - - // FIXME: Handle dirty case for each extent inode! - for (i = 0; i < ni->nr_extents; i++) - ntfs_clear_extent_inode(ni->ext.extent_ntfs_inos[i]); - kfree(ni->ext.extent_ntfs_inos); - } /* Free all alocated memory. */ down_write(&ni->run_list.lock); if (ni->run_list.rl) { @@ -1799,6 +1762,20 @@ void ntfs_clear_extent_inode(ntfs_inode *ni) { + ntfs_debug("Entering for inode 0x%lx.", ni->mft_no); + + BUG_ON(NInoAttr(ni)); + BUG_ON(ni->nr_extents != -1); + +#ifdef NTFS_RW + if (NInoDirty(ni)) { + if (!is_bad_inode(VFS_I(ni->ext.base_ntfs_ino))) + ntfs_error(ni->vol->sb, "Clearing dirty extent inode! " + "Losing data! This is a BUG!!!"); + // FIXME: Do something!!! + } +#endif /* NTFS_RW */ + __ntfs_clear_inode(ni); /* Bye, bye... */ @@ -1819,6 +1796,30 @@ { ntfs_inode *ni = NTFS_I(vi); +#ifdef NTFS_RW + if (NInoDirty(ni)) { + BOOL was_bad = (is_bad_inode(vi)); + + /* Committing the inode also commits all extent inodes. */ + ntfs_commit_inode(vi); + + if (!was_bad && (is_bad_inode(vi) || NInoDirty(ni))) { + ntfs_error(vi->i_sb, "Failed to commit dirty inode " + "0x%lx. Losing data!", vi->i_ino); + // FIXME: Do something!!! + } + } +#endif /* NTFS_RW */ + + /* No need to lock at this stage as no one else has a reference. */ + if (ni->nr_extents > 0) { + int i; + + for (i = 0; i < ni->nr_extents; i++) + ntfs_clear_extent_inode(ni->ext.extent_ntfs_inos[i]); + kfree(ni->ext.extent_ntfs_inos); + } + __ntfs_clear_inode(ni); if (NInoAttr(ni)) { @@ -1959,4 +1960,49 @@ return err; } -#endif +void ntfs_write_inode(struct inode *vi, int sync) +{ + ntfs_inode *ni = NTFS_I(vi); + + ntfs_debug("Entering for %sinode 0x%lx.", NInoAttr(ni) ? "attr " : "", + vi->i_ino); + + /* + * Dirty attribute inodes are written via their real inodes so just + * clean them here. + */ + if (NInoAttr(ni)) { + NInoClearDirty(ni); + return; + } + + /* Write this base mft record. */ + if (NInoDirty(ni)) { + ntfs_warning(vi->i_sb, "Cleaning dirty inode 0x%lx without " + "writing to disk as this is not yet " + "implemented.", vi->i_ino); + NInoClearDirty(ni); + } + + /* Write all attached extent mft records. */ + down(&ni->extent_lock); + if (ni->nr_extents > 0) { + int i; + ntfs_inode **extent_nis = ni->ext.extent_ntfs_inos; + + for (i = 0; i < ni->nr_extents; i++) { + ntfs_inode *tni = extent_nis[i]; + + if (NInoDirty(tni)) { + ntfs_warning(vi->i_sb, "Cleaning dirty extent " + "inode 0x%lx without writing " + "to disk as this is not yet " + "implemented.", tni->mft_no); + NInoClearDirty(tni); + } + } + } + up(&ni->extent_lock); +} + +#endif /* NTFS_RW */ diff -urN linux-2.6.7-rc2/fs/ntfs/inode.h linux-2.6.7-rc3/fs/ntfs/inode.h --- linux-2.6.7-rc2/fs/ntfs/inode.h 2004-06-07 12:54:51.192133068 -0700 +++ linux-2.6.7-rc3/fs/ntfs/inode.h 2004-06-07 12:55:16.720190382 -0700 @@ -281,6 +281,15 @@ extern int ntfs_setattr(struct dentry *dentry, struct iattr *attr); +extern void ntfs_write_inode(struct inode *vi, int sync); + +static inline void ntfs_commit_inode(struct inode *vi) +{ + if (!is_bad_inode(vi)) + ntfs_write_inode(vi, 1); + return; +} + #endif /* NTFS_RW */ #endif /* _LINUX_NTFS_INODE_H */ diff -urN linux-2.6.7-rc2/fs/ntfs/ntfs.h linux-2.6.7-rc3/fs/ntfs/ntfs.h --- linux-2.6.7-rc2/fs/ntfs/ntfs.h 2004-06-07 12:54:51.202133482 -0700 +++ linux-2.6.7-rc3/fs/ntfs/ntfs.h 2004-06-07 12:55:16.726190631 -0700 @@ -62,6 +62,7 @@ /* The various operations structs defined throughout the driver files. */ extern struct super_operations ntfs_sops; extern struct address_space_operations ntfs_aops; +extern struct address_space_operations ntfs_mst_aops; extern struct address_space_operations ntfs_mft_aops; extern struct file_operations ntfs_file_ops; diff -urN linux-2.6.7-rc2/fs/ntfs/super.c linux-2.6.7-rc3/fs/ntfs/super.c --- linux-2.6.7-rc2/fs/ntfs/super.c 2004-06-07 12:54:51.204133565 -0700 +++ linux-2.6.7-rc3/fs/ntfs/super.c 2004-06-07 12:55:16.728190714 -0700 @@ -763,7 +763,7 @@ /* The $MFTMirr, like the $MFT is multi sector transfer protected. */ NInoSetMstProtected(tmp_ni); /* - * Set up our little cheat allowing us to reuse the async io + * Set up our little cheat allowing us to reuse the async read io * completion handler for directories. */ tmp_ni->itype.index.block_size = vol->mft_record_size; @@ -1142,7 +1142,7 @@ #ifdef NTFS_RW /* Make sure that no unsupported volume flags are set. */ if (vol->vol_flags & VOLUME_MUST_MOUNT_RO_MASK) { - static const char *es1 = "Volume has unsupported flags set "; + static const char *es1 = "Volume has unsupported flags set"; static const char *es2 = ". Run chkdsk and mount in Windows."; /* If a read-write mount, convert it to a read-only mount. */ diff -urN linux-2.6.7-rc2/fs/partitions/msdos.c linux-2.6.7-rc3/fs/partitions/msdos.c --- linux-2.6.7-rc2/fs/partitions/msdos.c 2004-06-07 12:54:51.252135553 -0700 +++ linux-2.6.7-rc3/fs/partitions/msdos.c 2004-06-07 12:55:16.732190879 -0700 @@ -389,8 +389,23 @@ put_dev_sector(sect); return 0; } + + /* + * Now that the 55aa signature is present, this is probably + * either the boot sector of a FAT filesystem or a DOS-type + * partition table. Reject this in case the boot indicator + * is not 0 or 0x80. + */ p = (struct partition *) (data + 0x1be); + for (slot = 1; slot <= 4; slot++, p++) { + if (p->boot_ind != 0 && p->boot_ind != 0x80) { + put_dev_sector(sect); + return 0; + } + } + #ifdef CONFIG_EFI_PARTITION + p = (struct partition *) (data + 0x1be); for (slot = 1 ; slot <= 4 ; slot++, p++) { /* If this is an EFI GPT disk, msdos should ignore it. */ if (SYS_IND(p) == EFI_PMBR_OSTYPE_EFI_GPT) { @@ -398,8 +413,8 @@ return 0; } } - p = (struct partition *) (data + 0x1be); #endif + p = (struct partition *) (data + 0x1be); /* * Look for partitions in two passes: diff -urN linux-2.6.7-rc2/fs/proc/base.c linux-2.6.7-rc3/fs/proc/base.c --- linux-2.6.7-rc2/fs/proc/base.c 2004-06-07 12:54:51.256135719 -0700 +++ linux-2.6.7-rc3/fs/proc/base.c 2004-06-07 12:55:16.734190962 -0700 @@ -1162,7 +1162,7 @@ }; #ifdef CONFIG_SECURITY -static ssize_t proc_pid_attr_read(struct file * file, char * buf, +static ssize_t proc_pid_attr_read(struct file * file, char __user * buf, size_t count, loff_t *ppos) { struct inode * inode = file->f_dentry->d_inode; @@ -1199,7 +1199,7 @@ return count; } -static ssize_t proc_pid_attr_write(struct file * file, const char * buf, +static ssize_t proc_pid_attr_write(struct file * file, const char __user * buf, size_t count, loff_t *ppos) { struct inode * inode = file->f_dentry->d_inode; diff -urN linux-2.6.7-rc2/fs/quota_v1.c linux-2.6.7-rc3/fs/quota_v1.c --- linux-2.6.7-rc2/fs/quota_v1.c 2004-05-09 19:32:54.000000000 -0700 +++ linux-2.6.7-rc3/fs/quota_v1.c 2004-06-07 12:55:16.735191004 -0700 @@ -52,6 +52,8 @@ /* Now we are sure filp is valid */ offset = v1_dqoff(dquot->dq_id); + /* Set structure to 0s in case read fails/is after end of file */ + memset(&dqblk, 0, sizeof(struct v1_disk_dqblk)); fs = get_fs(); set_fs(KERNEL_DS); filp->f_op->read(filp, (char *)&dqblk, sizeof(struct v1_disk_dqblk), &offset); diff -urN linux-2.6.7-rc2/fs/reiserfs/file.c linux-2.6.7-rc3/fs/reiserfs/file.c --- linux-2.6.7-rc2/fs/reiserfs/file.c 2004-06-07 12:54:51.301137583 -0700 +++ linux-2.6.7-rc3/fs/reiserfs/file.c 2004-06-07 12:55:16.742191294 -0700 @@ -545,7 +545,7 @@ array to prepared pages */ - const char *buf /* Pointer to user-supplied + const char __user *buf /* Pointer to user-supplied data*/ ) { @@ -1062,7 +1062,7 @@ */ ssize_t reiserfs_file_write( struct file *file, /* the file we are going to write into */ - const char *buf, /* pointer to user supplied data + const char __user *buf, /* pointer to user supplied data (in userspace) */ size_t count, /* amount of bytes to write */ loff_t *ppos /* pointer to position in file that we start writing at. Should be updated to diff -urN linux-2.6.7-rc2/fs/reiserfs/ioctl.c linux-2.6.7-rc3/fs/reiserfs/ioctl.c --- linux-2.6.7-rc2/fs/reiserfs/ioctl.c 2004-05-09 19:32:28.000000000 -0700 +++ linux-2.6.7-rc3/fs/reiserfs/ioctl.c 2004-06-07 12:55:16.748191542 -0700 @@ -36,7 +36,7 @@ case REISERFS_IOC_GETFLAGS: flags = REISERFS_I(inode) -> i_attrs; i_attrs_to_sd_attrs( inode, ( __u16 * ) &flags ); - return put_user(flags, (int *) arg); + return put_user(flags, (int __user *) arg); case REISERFS_IOC_SETFLAGS: { if (IS_RDONLY(inode)) return -EROFS; @@ -44,7 +44,7 @@ if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER)) return -EPERM; - if (get_user(flags, (int *) arg)) + if (get_user(flags, (int __user *) arg)) return -EFAULT; if ( ( ( flags ^ REISERFS_I(inode) -> i_attrs) & ( REISERFS_IMMUTABLE_FL | REISERFS_APPEND_FL)) && @@ -66,13 +66,13 @@ return 0; } case REISERFS_IOC_GETVERSION: - return put_user(inode->i_generation, (int *) arg); + return put_user(inode->i_generation, (int __user *) arg); case REISERFS_IOC_SETVERSION: if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER)) return -EPERM; if (IS_RDONLY(inode)) return -EROFS; - if (get_user(inode->i_generation, (int *) arg)) + if (get_user(inode->i_generation, (int __user *) arg)) return -EFAULT; inode->i_ctime = CURRENT_TIME; mark_inode_dirty(inode); diff -urN linux-2.6.7-rc2/fs/smbfs/file.c linux-2.6.7-rc3/fs/smbfs/file.c --- linux-2.6.7-rc2/fs/smbfs/file.c 2004-05-09 19:33:19.000000000 -0700 +++ linux-2.6.7-rc3/fs/smbfs/file.c 2004-06-07 12:55:16.770192453 -0700 @@ -215,7 +215,7 @@ } static ssize_t -smb_file_read(struct file * file, char * buf, size_t count, loff_t *ppos) +smb_file_read(struct file * file, char __user * buf, size_t count, loff_t *ppos) { struct dentry * dentry = file->f_dentry; ssize_t status; @@ -318,7 +318,7 @@ * Write to a file (through the page cache). */ static ssize_t -smb_file_write(struct file *file, const char *buf, size_t count, loff_t *ppos) +smb_file_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { struct dentry * dentry = file->f_dentry; ssize_t result; diff -urN linux-2.6.7-rc2/fs/smbfs/ioctl.c linux-2.6.7-rc3/fs/smbfs/ioctl.c --- linux-2.6.7-rc2/fs/smbfs/ioctl.c 2004-05-09 19:31:59.000000000 -0700 +++ linux-2.6.7-rc3/fs/smbfs/ioctl.c 2004-06-07 12:55:16.770192453 -0700 @@ -35,11 +35,11 @@ uid_t uid32; case SMB_IOC_GETMOUNTUID: SET_UID(uid16, server->mnt->mounted_uid); - result = put_user(uid16, (uid16_t *) arg); + result = put_user(uid16, (uid16_t __user *) arg); break; case SMB_IOC_GETMOUNTUID32: SET_UID(uid32, server->mnt->mounted_uid); - result = put_user(uid32, (uid_t *) arg); + result = put_user(uid32, (uid_t __user *) arg); break; case SMB_IOC_NEWCONN: @@ -56,7 +56,7 @@ } result = -EFAULT; - if (!copy_from_user(&opt, (void *)arg, sizeof(opt))) + if (!copy_from_user(&opt, (void __user *)arg, sizeof(opt))) result = smb_newconn(server, &opt); break; default: diff -urN linux-2.6.7-rc2/fs/smbfs/smbiod.c linux-2.6.7-rc3/fs/smbfs/smbiod.c --- linux-2.6.7-rc2/fs/smbfs/smbiod.c 2004-05-09 19:32:52.000000000 -0700 +++ linux-2.6.7-rc3/fs/smbfs/smbiod.c 2004-06-07 12:55:16.770192453 -0700 @@ -54,7 +54,7 @@ /* * called when there's work for us to do */ -void smbiod_wake_up() +void smbiod_wake_up(void) { if (smbiod_state == SMBIOD_DEAD) return; diff -urN linux-2.6.7-rc2/fs/sysfs/file.c linux-2.6.7-rc3/fs/sysfs/file.c --- linux-2.6.7-rc2/fs/sysfs/file.c 2004-06-07 12:54:51.357139902 -0700 +++ linux-2.6.7-rc3/fs/sysfs/file.c 2004-06-07 12:55:16.773192578 -0700 @@ -89,6 +89,7 @@ return -ENOMEM; count = ops->show(kobj,attr,buffer->page); + BUG_ON(count > PAGE_SIZE); if (count >= 0) buffer->count = count; else diff -urN linux-2.6.7-rc2/fs/udf/file.c linux-2.6.7-rc3/fs/udf/file.c --- linux-2.6.7-rc2/fs/udf/file.c 2004-05-09 19:32:39.000000000 -0700 +++ linux-2.6.7-rc3/fs/udf/file.c 2004-06-07 12:55:16.774192619 -0700 @@ -109,7 +109,7 @@ .commit_write = udf_adinicb_commit_write, }; -static ssize_t udf_file_write(struct file * file, const char * buf, +static ssize_t udf_file_write(struct file * file, const char __user * buf, size_t count, loff_t *ppos) { ssize_t retval; @@ -204,26 +204,26 @@ switch (cmd) { case UDF_GETVOLIDENT: - return copy_to_user((char *)arg, + return copy_to_user((char __user *)arg, UDF_SB_VOLIDENT(inode->i_sb), 32) ? -EFAULT : 0; case UDF_RELOCATE_BLOCKS: { long old, new; if (!capable(CAP_SYS_ADMIN)) return -EACCES; - if (get_user(old, (long *)arg)) return -EFAULT; + if (get_user(old, (long __user *)arg)) return -EFAULT; if ((result = udf_relocate_blocks(inode->i_sb, old, &new)) == 0) - result = put_user(new, (long *)arg); + result = put_user(new, (long __user *)arg); return result; } case UDF_GETEASIZE: - result = put_user(UDF_I_LENEATTR(inode), (int *)arg); + result = put_user(UDF_I_LENEATTR(inode), (int __user *)arg); break; case UDF_GETEABLOCK: - result = copy_to_user((char *)arg, UDF_I_DATA(inode), + result = copy_to_user((char __user *)arg, UDF_I_DATA(inode), UDF_I_LENEATTR(inode)) ? -EFAULT : 0; break; } diff -urN linux-2.6.7-rc2/include/asm-alpha/checksum.h linux-2.6.7-rc3/include/asm-alpha/checksum.h --- linux-2.6.7-rc2/include/asm-alpha/checksum.h 2004-05-09 19:31:56.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-alpha/checksum.h 2004-06-07 12:55:17.151208235 -0700 @@ -43,7 +43,7 @@ * here even more important to align src and dst on a 32-bit (or even * better 64-bit) boundary */ -unsigned int csum_partial_copy_from_user(const char *src, char *dst, int len, unsigned int sum, int *errp); +unsigned int csum_partial_copy_from_user(const char __user *src, char *dst, int len, unsigned int sum, int *errp); unsigned int csum_partial_copy_nocheck(const char *src, char *dst, int len, unsigned int sum); diff -urN linux-2.6.7-rc2/include/asm-alpha/core_mcpcia.h linux-2.6.7-rc3/include/asm-alpha/core_mcpcia.h --- linux-2.6.7-rc2/include/asm-alpha/core_mcpcia.h 2004-05-09 19:33:21.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-alpha/core_mcpcia.h 2004-06-07 12:55:17.213210803 -0700 @@ -167,7 +167,7 @@ /* Hack! Only words for bus 0. */ -#if !MCPCIA_ONE_HAE_WINDOW +#ifndef MCPCIA_ONE_HAE_WINDOW #define MCPCIA_HAE_ADDRESS MCPCIA_HAE_MEM(4) #endif #define MCPCIA_IACK_SC _MCPCIA_IACK_SC(4) @@ -351,7 +351,7 @@ unsigned long hose = in_addr & ~0xffffffffUL; unsigned long result, work; -#if !MCPCIA_ONE_HAE_WINDOW +#ifndef MCPCIA_ONE_HAE_WINDOW unsigned long msb; msb = addr & ~MCPCIA_MEM_MASK; set_hae(msb); @@ -370,7 +370,7 @@ unsigned long hose = in_addr & ~0xffffffffUL; unsigned long result, work; -#if !MCPCIA_ONE_HAE_WINDOW +#ifndef MCPCIA_ONE_HAE_WINDOW unsigned long msb; msb = addr & ~MCPCIA_MEM_MASK; set_hae(msb); @@ -389,7 +389,7 @@ unsigned long hose = in_addr & ~0xffffffffUL; unsigned long w; -#if !MCPCIA_ONE_HAE_WINDOW +#ifndef MCPCIA_ONE_HAE_WINDOW unsigned long msb; msb = addr & ~MCPCIA_MEM_MASK; set_hae(msb); @@ -407,7 +407,7 @@ unsigned long hose = in_addr & ~0xffffffffUL; unsigned long w; -#if !MCPCIA_ONE_HAE_WINDOW +#ifndef MCPCIA_ONE_HAE_WINDOW unsigned long msb; msb = addr & ~MCPCIA_MEM_MASK; set_hae(msb); diff -urN linux-2.6.7-rc2/include/asm-alpha/core_polaris.h linux-2.6.7-rc3/include/asm-alpha/core_polaris.h --- linux-2.6.7-rc2/include/asm-alpha/core_polaris.h 2004-05-09 19:32:26.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-alpha/core_polaris.h 2004-06-07 12:55:17.213210803 -0700 @@ -18,13 +18,13 @@ */ /* Polaris memory regions */ -#define POLARIS_SPARSE_MEM_BASE (IDENT_ADDR + 0xf800000000) -#define POLARIS_DENSE_MEM_BASE (IDENT_ADDR + 0xf900000000) -#define POLARIS_SPARSE_IO_BASE (IDENT_ADDR + 0xf980000000) -#define POLARIS_SPARSE_CONFIG_BASE (IDENT_ADDR + 0xf9c0000000) -#define POLARIS_IACK_BASE (IDENT_ADDR + 0xf9f8000000) -#define POLARIS_DENSE_IO_BASE (IDENT_ADDR + 0xf9fc000000) -#define POLARIS_DENSE_CONFIG_BASE (IDENT_ADDR + 0xf9fe000000) +#define POLARIS_SPARSE_MEM_BASE (IDENT_ADDR + 0xf800000000UL) +#define POLARIS_DENSE_MEM_BASE (IDENT_ADDR + 0xf900000000UL) +#define POLARIS_SPARSE_IO_BASE (IDENT_ADDR + 0xf980000000UL) +#define POLARIS_SPARSE_CONFIG_BASE (IDENT_ADDR + 0xf9c0000000UL) +#define POLARIS_IACK_BASE (IDENT_ADDR + 0xf9f8000000UL) +#define POLARIS_DENSE_IO_BASE (IDENT_ADDR + 0xf9fc000000UL) +#define POLARIS_DENSE_CONFIG_BASE (IDENT_ADDR + 0xf9fe000000UL) #define POLARIS_IACK_SC POLARIS_IACK_BASE diff -urN linux-2.6.7-rc2/include/asm-alpha/floppy.h linux-2.6.7-rc3/include/asm-alpha/floppy.h --- linux-2.6.7-rc2/include/asm-alpha/floppy.h 2004-05-09 19:33:20.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-alpha/floppy.h 2004-06-07 12:55:17.236211756 -0700 @@ -108,10 +108,11 @@ * on that platform... ;-} */ -#define CROSS_64KB(a,s) \ -({ unsigned long __s64 = (unsigned long)(a); \ - unsigned long __e64 = __s64 + (unsigned long)(s) - 1; \ - (__s64 ^ __e64) & ~0xfffful; }) +static inline unsigned long CROSS_64KB(void *a, unsigned long s) +{ + unsigned long p = (unsigned long)a; + return ((p + s - 1) ^ p) & ~0xffffUL; +} #define EXTRA_FLOPPY_PARAMS diff -urN linux-2.6.7-rc2/include/asm-alpha/ide.h linux-2.6.7-rc3/include/asm-alpha/ide.h --- linux-2.6.7-rc2/include/asm-alpha/ide.h 2004-06-07 12:54:51.834159658 -0700 +++ linux-2.6.7-rc3/include/asm-alpha/ide.h 2004-06-07 12:55:17.236211756 -0700 @@ -19,6 +19,8 @@ #define MAX_HWIFS CONFIG_IDE_MAX_HWIFS #endif +#define IDE_ARCH_OBSOLETE_DEFAULTS + static inline int ide_default_irq(unsigned long base) { switch (base) { diff -urN linux-2.6.7-rc2/include/asm-alpha/io.h linux-2.6.7-rc3/include/asm-alpha/io.h --- linux-2.6.7-rc2/include/asm-alpha/io.h 2004-05-09 19:33:19.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-alpha/io.h 2004-06-07 12:55:17.237211797 -0700 @@ -9,9 +9,9 @@ * Virtual -> physical identity mapping starts at this offset */ #ifdef USE_48_BIT_KSEG -#define IDENT_ADDR 0xffff800000000000 +#define IDENT_ADDR 0xffff800000000000UL #else -#define IDENT_ADDR 0xfffffc0000000000 +#define IDENT_ADDR 0xfffffc0000000000UL #endif #ifdef __KERNEL__ diff -urN linux-2.6.7-rc2/include/asm-alpha/page.h linux-2.6.7-rc3/include/asm-alpha/page.h --- linux-2.6.7-rc2/include/asm-alpha/page.h 2004-05-09 19:33:10.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-alpha/page.h 2004-06-07 12:55:17.274213330 -0700 @@ -73,10 +73,13 @@ return order; } -#endif /* !__ASSEMBLY__ */ +#ifdef USE_48_BIT_KSEG +#define PAGE_OFFSET 0xffff800000000000UL +#else +#define PAGE_OFFSET 0xfffffc0000000000UL +#endif -/* to align the pointer to the (next) page boundary */ -#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK) +#else #ifdef USE_48_BIT_KSEG #define PAGE_OFFSET 0xffff800000000000 @@ -84,6 +87,11 @@ #define PAGE_OFFSET 0xfffffc0000000000 #endif +#endif /* !__ASSEMBLY__ */ + +/* to align the pointer to the (next) page boundary */ +#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK) + #define __pa(x) ((unsigned long) (x) - PAGE_OFFSET) #define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET)) #ifndef CONFIG_DISCONTIGMEM diff -urN linux-2.6.7-rc2/include/asm-alpha/pgtable.h linux-2.6.7-rc3/include/asm-alpha/pgtable.h --- linux-2.6.7-rc2/include/asm-alpha/pgtable.h 2004-06-07 12:54:51.835159699 -0700 +++ linux-2.6.7-rc3/include/asm-alpha/pgtable.h 2004-06-07 12:55:17.281213620 -0700 @@ -83,7 +83,7 @@ #define __DIRTY_BITS (_PAGE_DIRTY | _PAGE_KWE | _PAGE_UWE) #define __ACCESS_BITS (_PAGE_ACCESSED | _PAGE_KRE | _PAGE_URE) -#define _PFN_MASK 0xFFFFFFFF00000000 +#define _PFN_MASK 0xFFFFFFFF00000000UL #define _PAGE_TABLE (_PAGE_VALID | __DIRTY_BITS | __ACCESS_BITS) #define _PAGE_CHG_MASK (_PFN_MASK | __DIRTY_BITS | __ACCESS_BITS) diff -urN linux-2.6.7-rc2/include/asm-alpha/semaphore.h linux-2.6.7-rc3/include/asm-alpha/semaphore.h --- linux-2.6.7-rc2/include/asm-alpha/semaphore.h 2004-05-09 19:33:13.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-alpha/semaphore.h 2004-06-07 12:55:17.293214117 -0700 @@ -18,12 +18,12 @@ struct semaphore { atomic_t count; wait_queue_head_t wait; -#if WAITQUEUE_DEBUG +#ifdef WAITQUEUE_DEBUG long __magic; #endif }; -#if WAITQUEUE_DEBUG +#ifdef WAITQUEUE_DEBUG # define __SEM_DEBUG_INIT(name) , (long)&(name).__magic #else # define __SEM_DEBUG_INIT(name) @@ -53,7 +53,7 @@ atomic_set(&sem->count, val); init_waitqueue_head(&sem->wait); -#if WAITQUEUE_DEBUG +#ifdef WAITQUEUE_DEBUG sem->__magic = (long)&sem->__magic; #endif } @@ -142,7 +142,7 @@ __up_wakeup(sem); } -#if !WAITQUEUE_DEBUG && !defined(CONFIG_DEBUG_SEMAPHORE) +#if !defined(WAITQUEUE_DEBUG) && !defined(CONFIG_DEBUG_SEMAPHORE) extern inline void down(struct semaphore *sem) { __down(sem); diff -urN linux-2.6.7-rc2/include/asm-alpha/uaccess.h linux-2.6.7-rc3/include/asm-alpha/uaccess.h --- linux-2.6.7-rc2/include/asm-alpha/uaccess.h 2004-05-09 19:33:12.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-alpha/uaccess.h 2004-06-07 12:55:17.334215815 -0700 @@ -29,6 +29,14 @@ #define segment_eq(a,b) ((a).seg == (b).seg) +#ifdef __CHECKER__ +#define CHECK_UPTR(ptr) do { \ + __typeof__(*(ptr)) *__dummy_check_uptr = \ + (void __user *)&__dummy_check_uptr; \ +} while(0) +#else +#define CHECK_UPTR(ptr) +#endif /* * Is a address valid? This does a straightforward calculation rather @@ -43,10 +51,13 @@ #define __access_ok(addr,size,segment) \ (((segment).seg & (addr | size | (addr+size))) == 0) -#define access_ok(type,addr,size) \ - __access_ok(((unsigned long)(addr)),(size),get_fs()) +#define access_ok(type,addr,size) \ +({ \ + CHECK_UPTR(addr); \ + __access_ok(((unsigned long)(addr)),(size),get_fs()); \ +}) -extern inline int verify_area(int type, const void * addr, unsigned long size) +extern inline int verify_area(int type, const void __user * addr, unsigned long size) { return access_ok(type,addr,size) ? 0 : -EFAULT; } @@ -90,6 +101,7 @@ #define __get_user_nocheck(x,ptr,size) \ ({ \ long __gu_err = 0, __gu_val; \ + CHECK_UPTR(ptr); \ switch (size) { \ case 1: __get_user_8(ptr); break; \ case 2: __get_user_16(ptr); break; \ @@ -105,6 +117,7 @@ ({ \ long __gu_err = -EFAULT, __gu_val = 0; \ const __typeof__(*(ptr)) *__gu_addr = (ptr); \ + CHECK_UPTR(ptr); \ if (__access_ok((long)__gu_addr,size,segment)) { \ __gu_err = 0; \ switch (size) { \ @@ -204,6 +217,7 @@ #define __put_user_nocheck(x,ptr,size) \ ({ \ long __pu_err = 0; \ + CHECK_UPTR(ptr); \ switch (size) { \ case 1: __put_user_8(x,ptr); break; \ case 2: __put_user_16(x,ptr); break; \ @@ -218,6 +232,7 @@ ({ \ long __pu_err = -EFAULT; \ __typeof__(*(ptr)) *__pu_addr = (ptr); \ + CHECK_UPTR(ptr); \ if (__access_ok((long)__pu_addr,size,segment)) { \ __pu_err = 0; \ switch (size) { \ @@ -371,34 +386,42 @@ } extern inline long -__copy_tofrom_user(void *to, const void *from, long len, const void *validate) +__copy_tofrom_user(void *to, const void *from, long len, const void __user *validate) { if (__access_ok((long)validate, len, get_fs())) len = __copy_tofrom_user_nocheck(to, from, len); return len; } -#define __copy_to_user(to,from,n) __copy_tofrom_user_nocheck((to),(from),(n)) -#define __copy_from_user(to,from,n) __copy_tofrom_user_nocheck((to),(from),(n)) +#define __copy_to_user(to,from,n) \ +({ \ + CHECK_UPTR(to); \ + __copy_tofrom_user_nocheck((void *)(to),(from),(n)); \ +}) +#define __copy_from_user(to,from,n) \ +({ \ + CHECK_UPTR(from); \ + __copy_tofrom_user_nocheck((to),(void *)(from),(n)); \ +}) extern inline long -copy_to_user(void *to, const void *from, long n) +copy_to_user(void __user *to, const void *from, long n) { - return __copy_tofrom_user(to, from, n, to); + return __copy_tofrom_user((void *)to, from, n, to); } extern inline long -copy_from_user(void *to, const void *from, long n) +copy_from_user(void *to, const void __user *from, long n) { - return __copy_tofrom_user(to, from, n, from); + return __copy_tofrom_user(to, (void *)from, n, from); } extern void __do_clear_user(void); extern inline long -__clear_user(void *to, long len) +__clear_user(void __user *to, long len) { - register void * __cl_to __asm__("$6") = to; + register void __user * __cl_to __asm__("$6") = to; register long __cl_len __asm__("$0") = len; __asm__ __volatile__( __module_call(28, 2, __do_clear_user) @@ -410,7 +433,7 @@ } extern inline long -clear_user(void *to, long len) +clear_user(void __user *to, long len) { if (__access_ok((long)to, len, get_fs())) len = __clear_user(to, len); @@ -423,10 +446,10 @@ /* Returns: -EFAULT if exception before terminator, N if the entire buffer filled, else strlen. */ -extern long __strncpy_from_user(char *__to, const char *__from, long __to_len); +extern long __strncpy_from_user(char *__to, const char __user *__from, long __to_len); extern inline long -strncpy_from_user(char *to, const char *from, long n) +strncpy_from_user(char *to, const char __user *from, long n) { long ret = -EFAULT; if (__access_ok((long)from, 0, get_fs())) @@ -435,18 +458,18 @@ } /* Returns: 0 if bad, string length+1 (memory size) of string if ok */ -extern long __strlen_user(const char *); +extern long __strlen_user(const char __user *); -extern inline long strlen_user(const char *str) +extern inline long strlen_user(const char __user *str) { return access_ok(VERIFY_READ,str,0) ? __strlen_user(str) : 0; } /* Returns: 0 if exception before NUL or reaching the supplied limit (N), * a value greater than N if the limit would be exceeded, else strlen. */ -extern long __strnlen_user(const char *, long); +extern long __strnlen_user(const char __user *, long); -extern inline long strnlen_user(const char *str, long n) +extern inline long strnlen_user(const char __user *str, long n) { return access_ok(VERIFY_READ,str,0) ? __strnlen_user(str, n) : 0; } diff -urN linux-2.6.7-rc2/include/asm-arm/arch-pxa/hardware.h linux-2.6.7-rc3/include/asm-arm/arch-pxa/hardware.h --- linux-2.6.7-rc2/include/asm-arm/arch-pxa/hardware.h 2004-06-07 12:54:51.864160901 -0700 +++ linux-2.6.7-rc3/include/asm-arm/arch-pxa/hardware.h 2004-06-07 12:55:17.678230064 -0700 @@ -83,19 +83,11 @@ extern void pxa_gpio_mode( int gpio_mode ); /* - * return current lclk frequency in units of 10kHz + * return current memory and LCD clock frequency in units of 10kHz */ -extern unsigned int get_lclk_frequency_10khz(void); +extern unsigned int get_memclk_frequency_10khz(void); +extern unsigned int get_lcdclk_frequency_10khz(void); #endif - -/* - * Implementation specifics - */ - -#include "lubbock.h" -#include "mainstone.h" -#include "idp.h" - #endif /* _ASM_ARCH_HARDWARE_H */ diff -urN linux-2.6.7-rc2/include/asm-arm/cacheflush.h linux-2.6.7-rc3/include/asm-arm/cacheflush.h --- linux-2.6.7-rc2/include/asm-arm/cacheflush.h 2004-06-07 12:54:51.886161812 -0700 +++ linux-2.6.7-rc3/include/asm-arm/cacheflush.h 2004-06-07 12:55:17.839236733 -0700 @@ -291,17 +291,7 @@ * about to change to user space. This is the same method as used on SPARC64. * See update_mmu_cache for the user space part. */ -extern void __flush_dcache_page(struct page *); - -static inline void flush_dcache_page(struct page *page) -{ - struct address_space *mapping = page_mapping(page); - - if (mapping && !mapping_mapped(mapping)) - set_bit(PG_dcache_dirty, &page->flags); - else - __flush_dcache_page(page); -} +extern void flush_dcache_page(struct page *); #define flush_dcache_mmap_lock(mapping) \ spin_lock_irq(&(mapping)->tree_lock) diff -urN linux-2.6.7-rc2/include/asm-arm/ide.h linux-2.6.7-rc3/include/asm-arm/ide.h --- linux-2.6.7-rc2/include/asm-arm/ide.h 2004-06-07 12:54:51.886161812 -0700 +++ linux-2.6.7-rc3/include/asm-arm/ide.h 2004-06-07 12:55:17.879238390 -0700 @@ -21,13 +21,6 @@ # include /* obsolete + broken */ #endif -/* - * We always use the new IDE port registering, - * so these are fixed here. - */ -#define ide_default_io_base(i) (0) -#define ide_default_irq(b) (0) - #if !defined(CONFIG_ARCH_L7200) && !defined(CONFIG_ARCH_LH7A40X) # define IDE_ARCH_OBSOLETE_INIT # ifdef CONFIG_ARCH_CLPS7500 @@ -37,8 +30,6 @@ # endif #endif /* !ARCH_L7200 && !ARCH_LH7A40X */ -#define ide_init_default_irq(base) (0) - #define __ide_mm_insw(port,addr,len) readsw(port,addr,len) #define __ide_mm_insl(port,addr,len) readsl(port,addr,len) #define __ide_mm_outsw(port,addr,len) writesw(port,addr,len) diff -urN linux-2.6.7-rc2/include/asm-arm/pgtable.h linux-2.6.7-rc3/include/asm-arm/pgtable.h --- linux-2.6.7-rc2/include/asm-arm/pgtable.h 2004-06-07 12:54:51.887161853 -0700 +++ linux-2.6.7-rc3/include/asm-arm/pgtable.h 2004-06-07 12:55:17.880238431 -0700 @@ -312,6 +312,13 @@ flush_pmd_entry(pmdp); \ } while (0) +#define copy_pmd(pmdpd,pmdps) \ + do { \ + pmdpd[0] = pmdps[0]; \ + pmdpd[1] = pmdps[1]; \ + flush_pmd_entry(pmdpd); \ + } while (0) + #define pmd_clear(pmdp) \ do { \ pmdp[0] = __pmd(0); \ diff -urN linux-2.6.7-rc2/include/asm-arm/setup.h linux-2.6.7-rc3/include/asm-arm/setup.h --- linux-2.6.7-rc2/include/asm-arm/setup.h 2004-05-09 19:32:37.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-arm/setup.h 2004-06-07 12:55:17.919240047 -0700 @@ -196,7 +196,6 @@ struct meminfo { int nr_banks; - unsigned long end; struct { unsigned long start; unsigned long size; diff -urN linux-2.6.7-rc2/include/asm-arm26/ide.h linux-2.6.7-rc3/include/asm-arm26/ide.h --- linux-2.6.7-rc2/include/asm-arm26/ide.h 2004-06-07 12:54:51.903162516 -0700 +++ linux-2.6.7-rc3/include/asm-arm26/ide.h 2004-06-07 12:55:17.967242035 -0700 @@ -26,15 +26,6 @@ #define __ide_mm_outsw(port,addr,len) writesw(port,addr,len) #define __ide_mm_outsl(port,addr,len) writesl(port,addr,len) -#define ide_init_default_irq(base) (0) - -/* - * We always use the new IDE port registering, - * so these are fixed here. - */ -#define ide_default_io_base(i) (0) -#define ide_default_irq(b) (0) - #define IDE_ARCH_OBSOLETE_INIT #define ide_default_io_ctl(base) (0) diff -urN linux-2.6.7-rc2/include/asm-cris/arch-v10/cache.h linux-2.6.7-rc3/include/asm-cris/arch-v10/cache.h --- linux-2.6.7-rc2/include/asm-cris/arch-v10/cache.h 2004-05-09 19:32:54.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-cris/arch-v10/cache.h 2004-06-07 12:55:18.056245721 -0700 @@ -3,6 +3,7 @@ /* Etrax 100LX have 32-byte cache-lines. */ #define L1_CACHE_BYTES 32 +#define L1_CACHE_SHIFT 5 #define L1_CACHE_SHIFT_MAX 5 #endif /* _ASM_ARCH_CACHE_H */ diff -urN linux-2.6.7-rc2/include/asm-cris/arch-v10/irq.h linux-2.6.7-rc3/include/asm-cris/arch-v10/irq.h --- linux-2.6.7-rc2/include/asm-cris/arch-v10/irq.h 2004-05-09 19:31:59.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-cris/arch-v10/irq.h 2004-06-07 12:55:18.065246094 -0700 @@ -8,6 +8,11 @@ #include #define NR_IRQS 32 + +/* The first vector number used for IRQs in v10 is really 0x20 */ +/* but all the code and constants are offseted to make 0 the first */ +#define FIRST_IRQ 0 + #define SOME_IRQ_NBR IO_BITNR(R_VECT_MASK_RD, some) /* 0 ? */ #define NMI_IRQ_NBR IO_BITNR(R_VECT_MASK_RD, nmi) /* 1 */ #define TIMER0_IRQ_NBR IO_BITNR(R_VECT_MASK_RD, timer0) /* 2 */ diff -urN linux-2.6.7-rc2/include/asm-cris/arch-v10/offset.h linux-2.6.7-rc3/include/asm-cris/arch-v10/offset.h --- linux-2.6.7-rc2/include/asm-cris/arch-v10/offset.h 2004-05-09 19:32:00.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-cris/arch-v10/offset.h 2004-06-07 12:55:18.065246094 -0700 @@ -25,7 +25,7 @@ #define THREAD_usp 4 /* offsetof(struct thread_struct, usp) */ #define THREAD_dccr 8 /* offsetof(struct thread_struct, dccr) */ -#define TASK_pid 121 /* offsetof(struct task_struct, pid) */ +#define TASK_pid 133 /* offsetof(struct task_struct, pid) */ #define LCLONE_VM 256 /* CLONE_VM */ #define LCLONE_UNTRACED 8388608 /* CLONE_UNTRACED */ diff -urN linux-2.6.7-rc2/include/asm-cris/bitops.h linux-2.6.7-rc3/include/asm-cris/bitops.h --- linux-2.6.7-rc2/include/asm-cris/bitops.h 2004-05-09 19:33:20.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-cris/bitops.h 2004-06-07 12:55:18.098247461 -0700 @@ -296,6 +296,50 @@ } /** + * find_next_bit - find the first set bit in a memory region + * @addr: The address to base the search on + * @offset: The bitnumber to start searching at + * @size: The maximum size to search + */ +static __inline__ int find_next_bit(void *addr, int size, int offset) +{ + unsigned long *p = ((unsigned long *) addr) + (offset >> 5); + unsigned long result = offset & ~31UL; + unsigned long tmp; + + if (offset >= size) + return size; + size -= result; + offset &= 31UL; + if (offset) { + tmp = *(p++); + tmp &= (~0UL << offset); + if (size < 32) + goto found_first; + if (tmp) + goto found_middle; + size -= 32; + result += 32; + } + while (size & ~31UL) { + if ((tmp = *(p++))) + goto found_middle; + result += 32; + size -= 32; + } + if (!size) + return result; + tmp = *p; + +found_first: + tmp &= (~0UL >> (32 - size)); + if (tmp == 0UL) /* Are any bits set? */ + return result + size; /* Nope. */ +found_middle: + return result + __ffs(tmp); +} + +/** * find_first_zero_bit - find the first zero bit in a memory region * @addr: The address to start the search at * @size: The maximum size to search @@ -306,6 +350,8 @@ #define find_first_zero_bit(addr, size) \ find_next_zero_bit((addr), (size), 0) +#define find_first_bit(addr, size) \ + find_next_bit((addr), (size), 0) #define ext2_set_bit test_and_set_bit #define ext2_set_bit_atomic(l,n,a) test_and_set_bit(n,a) diff -urN linux-2.6.7-rc2/include/asm-cris/dma-mapping.h linux-2.6.7-rc3/include/asm-cris/dma-mapping.h --- linux-2.6.7-rc2/include/asm-cris/dma-mapping.h 2004-05-09 19:33:20.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-cris/dma-mapping.h 2004-06-07 12:55:18.099247503 -0700 @@ -1 +1,125 @@ -#include +#ifndef _ASM_CRIS_DMA_MAPPING_H +#define _ASM_CRIS_DMA_MAPPING_H + +#include "scatterlist.h" + +static inline int +dma_supported(struct device *dev, u64 mask) +{ + BUG(); + return 0; +} + +static inline int +dma_set_mask(struct device *dev, u64 dma_mask) +{ + BUG(); + return 1; +} + +static inline void * +dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, + int flag) +{ + BUG(); + return NULL; +} + +static inline void +dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, + dma_addr_t dma_handle) +{ + BUG(); +} + +static inline dma_addr_t +dma_map_single(struct device *dev, void *cpu_addr, size_t size, + enum dma_data_direction direction) +{ + BUG(); + return 0; +} + +static inline void +dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size, + enum dma_data_direction direction) +{ + BUG(); +} + +static inline dma_addr_t +dma_map_page(struct device *dev, struct page *page, + unsigned long offset, size_t size, + enum dma_data_direction direction) +{ + BUG(); + return 0; +} + +static inline void +dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size, + enum dma_data_direction direction) +{ + BUG(); +} + +static inline int +dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, + enum dma_data_direction direction) +{ + BUG(); + return 1; +} + +static inline void +dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries, + enum dma_data_direction direction) +{ + BUG(); +} + +static inline void +dma_sync_single(struct device *dev, dma_addr_t dma_handle, size_t size, + enum dma_data_direction direction) +{ + BUG(); +} + +static inline void +dma_sync_sg(struct device *dev, struct scatterlist *sg, int nelems, + enum dma_data_direction direction) +{ + BUG(); +} + +/* Now for the API extensions over the pci_ one */ + +#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) +#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) +#define dma_is_consistent(d) (1) + +static inline int +dma_get_cache_alignment(void) +{ + /* no easy way to get cache size on all processors, so return + * the maximum possible, to be safe */ + return (1 << L1_CACHE_SHIFT_MAX); +} + +static inline void +dma_sync_single_range(struct device *dev, dma_addr_t dma_handle, + unsigned long offset, size_t size, + enum dma_data_direction direction) +{ + BUG(); +} + +static inline void +dma_cache_sync(void *vaddr, size_t size, + enum dma_data_direction direction) +{ + BUG(); +} + +#endif + diff -urN linux-2.6.7-rc2/include/asm-cris/fasttimer.h linux-2.6.7-rc3/include/asm-cris/fasttimer.h --- linux-2.6.7-rc2/include/asm-cris/fasttimer.h 2004-05-09 19:32:52.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-cris/fasttimer.h 2004-06-07 12:55:18.102247627 -0700 @@ -1,4 +1,4 @@ -/* $Id: fasttimer.h,v 1.2 2002/12/11 13:03:43 starvik Exp $ +/* $Id: fasttimer.h,v 1.3 2004/05/14 10:19:19 starvik Exp $ * linux/include/asm-cris/fasttimer.h * * Fast timers for ETRAX100LX @@ -24,6 +24,8 @@ const char *name; }; +extern struct fast_timer *fast_timer_list; + void start_one_shot_timer(struct fast_timer *t, fast_timer_function_type *function, unsigned long data, diff -urN linux-2.6.7-rc2/include/asm-cris/io.h linux-2.6.7-rc3/include/asm-cris/io.h --- linux-2.6.7-rc2/include/asm-cris/io.h 2004-05-09 19:32:54.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-cris/io.h 2004-06-07 12:55:18.102247627 -0700 @@ -72,6 +72,8 @@ #define IO_SPACE_LIMIT 0xffff #define inb(x) (0) +#define inw(x) (0) +#define inl(x) (0) #define outb(x,y) #define outw(x,y) #define outl(x,y) diff -urN linux-2.6.7-rc2/include/asm-cris/ioctl.h linux-2.6.7-rc3/include/asm-cris/ioctl.h --- linux-2.6.7-rc2/include/asm-cris/ioctl.h 2004-05-09 19:32:28.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-cris/ioctl.h 2004-06-07 12:55:18.103247668 -0700 @@ -53,11 +53,18 @@ ((nr) << _IOC_NRSHIFT) | \ ((size) << _IOC_SIZESHIFT)) +/* provoke compile error for invalid uses of size argument */ +extern int __invalid_size_argument_for_IOC; +#define _IOC_TYPECHECK(t) \ + ((sizeof(t) == sizeof(t[1]) && \ + sizeof(t) < (1 << _IOC_SIZEBITS)) ? \ + sizeof(t) : __invalid_size_argument_for_IOC) + /* used to create numbers */ #define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) -#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) -#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size)) -#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size)) +#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),(_IOC_TYPECHECK(size))) +#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size))) +#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size))) /* used to decode ioctl numbers.. */ #define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) diff -urN linux-2.6.7-rc2/include/asm-cris/local.h linux-2.6.7-rc3/include/asm-cris/local.h --- linux-2.6.7-rc2/include/asm-cris/local.h 1969-12-31 16:00:00.000000000 -0800 +++ linux-2.6.7-rc3/include/asm-cris/local.h 2004-06-07 12:55:18.103247668 -0700 @@ -0,0 +1 @@ +#include diff -urN linux-2.6.7-rc2/include/asm-cris/page.h linux-2.6.7-rc3/include/asm-cris/page.h --- linux-2.6.7-rc2/include/asm-cris/page.h 2004-05-09 19:32:27.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-cris/page.h 2004-06-07 12:55:18.104247710 -0700 @@ -6,7 +6,11 @@ /* PAGE_SHIFT determines the page size */ #define PAGE_SHIFT 13 +#ifndef __ASSEMBLY__ #define PAGE_SIZE (1UL << PAGE_SHIFT) +#else +#define PAGE_SIZE (1 << PAGE_SHIFT) +#endif #define PAGE_MASK (~(PAGE_SIZE-1)) #ifdef __KERNEL__ @@ -20,10 +24,12 @@ /* * These are used to make use of C type-checking.. */ +#ifndef __ASSEMBLY__ typedef struct { unsigned long pte; } pte_t; typedef struct { unsigned long pmd; } pmd_t; typedef struct { unsigned long pgd; } pgd_t; typedef struct { unsigned long pgprot; } pgprot_t; +#endif #define pte_val(x) ((x).pte) #define pmd_val(x) ((x).pmd) @@ -51,7 +57,7 @@ #define virt_to_page(kaddr) (mem_map + (((unsigned long)(kaddr) - PAGE_OFFSET) >> PAGE_SHIFT)) #define VALID_PAGE(page) (((page) - mem_map) < max_mapnr) -#define virt_addr_valid(kaddr) pfn_valid((kaddr) >> PAGE_SHIFT) +#define virt_addr_valid(kaddr) pfn_valid((unsigned)(kaddr) >> PAGE_SHIFT) /* convert a page (based on mem_map and forward) to a physical address * do this by figuring out the virtual address and then use __pa @@ -72,8 +78,6 @@ BUG(); \ } while (0) -#endif /* __ASSEMBLY__ */ - /* Pure 2^n version of get_order */ static inline int get_order(unsigned long size) { @@ -87,6 +91,7 @@ } while (size); return order; } +#endif /* __ASSEMBLY__ */ #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) diff -urN linux-2.6.7-rc2/include/asm-cris/pci.h linux-2.6.7-rc3/include/asm-cris/pci.h --- linux-2.6.7-rc2/include/asm-cris/pci.h 2004-05-09 19:31:56.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-cris/pci.h 2004-06-07 12:55:18.104247710 -0700 @@ -1,9 +1,13 @@ #ifndef __ASM_CRIS_PCI_H #define __ASM_CRIS_PCI_H +#include +#include + /* ETRAX chips don't have a PCI bus. This file is just here because some stupid .c code * includes it even if CONFIG_PCI is not set. */ +#define PCI_DMA_BUS_IS_PHYS (1) #endif /* __ASM_CRIS_PCI_H */ diff -urN linux-2.6.7-rc2/include/asm-cris/pgtable.h linux-2.6.7-rc3/include/asm-cris/pgtable.h --- linux-2.6.7-rc2/include/asm-cris/pgtable.h 2004-06-07 12:54:51.942164131 -0700 +++ linux-2.6.7-rc3/include/asm-cris/pgtable.h 2004-06-07 12:55:18.105247751 -0700 @@ -5,9 +5,11 @@ #ifndef _CRIS_PGTABLE_H #define _CRIS_PGTABLE_H +#ifndef __ASSEMBLY__ #include #include #include +#endif #include /* @@ -21,8 +23,9 @@ * This file contains the functions and defines necessary to modify and use * the CRIS page table tree. */ - +#ifndef __ASSEMBLY__ extern void paging_init(void); +#endif /* Certain architectures need to do special things when pte's * within a page table are directly modified. Thus, the following @@ -72,8 +75,10 @@ #define FIRST_USER_PGD_NR 0 /* zero page used for uninitialized stuff */ +#ifndef __ASSEMBLY__ extern unsigned long empty_zero_page; #define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page)) +#endif /* number of bits that fit into a memory pointer */ #define BITS_PER_PTR (8*sizeof(unsigned long)) @@ -104,6 +109,8 @@ #define pmd_present(x) (pmd_val(x) & _PAGE_PRESENT) #define pmd_clear(xp) do { pmd_val(*(xp)) = 0; } while (0) +#ifndef __ASSEMBLY__ + /* * The "pgd_xxx()" functions here are trivial for a folded two-level * setup: the pgd is never bad, and a pmd always exists (as it's folded @@ -337,4 +344,5 @@ #define pte_to_pgoff(x) (pte_val(x) >> 6) #define pgoff_to_pte(x) __pte(((x) << 6) | _PAGE_FILE) +#endif /* __ASSEMBLY__ */ #endif /* _CRIS_PGTABLE_H */ diff -urN linux-2.6.7-rc2/include/asm-cris/ptrace.h linux-2.6.7-rc3/include/asm-cris/ptrace.h --- linux-2.6.7-rc2/include/asm-cris/ptrace.h 2004-05-09 19:32:39.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-cris/ptrace.h 2004-06-07 12:55:18.105247751 -0700 @@ -3,8 +3,10 @@ #include +#ifdef __KERNEL__ /* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */ #define PTRACE_GETREGS 12 #define PTRACE_SETREGS 13 +#endif #endif /* _CRIS_PTRACE_H */ diff -urN linux-2.6.7-rc2/include/asm-cris/rtc.h linux-2.6.7-rc3/include/asm-cris/rtc.h --- linux-2.6.7-rc2/include/asm-cris/rtc.h 2004-05-09 19:31:59.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-cris/rtc.h 2004-06-07 12:55:18.107247834 -0700 @@ -100,6 +100,8 @@ #define RTC_RD_TIME _IOR(RTC_MAGIC, 0x09, struct rtc_time) /* Read RTC time. */ #define RTC_SET_TIME _IOW(RTC_MAGIC, 0x0a, struct rtc_time) /* Set RTC time. */ #define RTC_SET_CHARGE _IOW(RTC_MAGIC, 0x0b, int) -#define RTC_MAX_IOCTL 0x0b +#define RTC_VLOW_RD _IOR(RTC_MAGIC, 0x11, int) /* Voltage Low detector */ +#define RTC_VLOW_SET _IO(RTC_MAGIC, 0x12) /* Clear voltage low information */ +#define RTC_MAX_IOCTL 0x12 #endif /* __RTC_H__ */ diff -urN linux-2.6.7-rc2/include/asm-cris/sections.h linux-2.6.7-rc3/include/asm-cris/sections.h --- linux-2.6.7-rc2/include/asm-cris/sections.h 1969-12-31 16:00:00.000000000 -0800 +++ linux-2.6.7-rc3/include/asm-cris/sections.h 2004-06-07 12:55:18.107247834 -0700 @@ -0,0 +1,7 @@ +#ifndef _CRIS_SECTIONS_H +#define _CRIS_SECTIONS_H + +/* nothing to see, move along */ +#include + +#endif diff -urN linux-2.6.7-rc2/include/asm-cris/semaphore-helper.h linux-2.6.7-rc3/include/asm-cris/semaphore-helper.h --- linux-2.6.7-rc2/include/asm-cris/semaphore-helper.h 2004-05-09 19:33:20.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-cris/semaphore-helper.h 2004-06-07 12:55:18.108247875 -0700 @@ -52,7 +52,7 @@ dec(&sem->waking); ret = 1; } else if (signal_pending(tsk)) { - count_inc(&sem->count); + inc(&sem->count); ret = -EINTR; } local_irq_restore(flags); @@ -67,7 +67,7 @@ local_save_flags(flags); local_irq_disable(); if (read(&sem->waking) <= 0) - count_inc(&sem->count); + inc(&sem->count); else { dec(&sem->waking); ret = 0; diff -urN linux-2.6.7-rc2/include/asm-cris/semaphore.h linux-2.6.7-rc3/include/asm-cris/semaphore.h --- linux-2.6.7-rc2/include/asm-cris/semaphore.h 2004-05-09 19:32:27.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-cris/semaphore.h 2004-06-07 12:55:18.108247875 -0700 @@ -21,7 +21,7 @@ int printk(const char *fmt, ...); struct semaphore { - int count; /* not atomic_t since we do the atomicity here already */ + atomic_t count; atomic_t waking; wait_queue_head_t wait; #if WAITQUEUE_DEBUG @@ -36,7 +36,7 @@ #endif #define __SEMAPHORE_INITIALIZER(name,count) \ - { count, ATOMIC_INIT(0), \ + { ATOMIC_INIT(count), ATOMIC_INIT(0), \ __WAIT_QUEUE_HEAD_INITIALIZER((name).wait) \ __SEM_DEBUG_INIT(name) } @@ -84,7 +84,7 @@ /* atomically decrement the semaphores count, and if its negative, we wait */ local_save_flags(flags); local_irq_disable(); - failed = --(sem->count) < 0; + failed = --(sem->count.counter) < 0; local_irq_restore(flags); if(failed) { __down(sem); @@ -110,7 +110,7 @@ /* atomically decrement the semaphores count, and if its negative, we wait */ local_save_flags(flags); local_irq_disable(); - failed = --(sem->count) < 0; + failed = --(sem->count.counter) < 0; local_irq_restore(flags); if(failed) failed = __down_interruptible(sem); @@ -128,7 +128,7 @@ local_save_flags(flags); local_irq_disable(); - failed = --(sem->count) < 0; + failed = --(sem->count.counter) < 0; local_irq_restore(flags); if(failed) failed = __down_trylock(sem); @@ -153,7 +153,7 @@ /* atomically increment the semaphores count, and if it was negative, we wake people */ local_save_flags(flags); local_irq_disable(); - wakeup = ++(sem->count) <= 0; + wakeup = ++(sem->count.counter) <= 0; local_irq_restore(flags); if(wakeup) { __up(sem); diff -urN linux-2.6.7-rc2/include/asm-cris/termbits.h linux-2.6.7-rc3/include/asm-cris/termbits.h --- linux-2.6.7-rc2/include/asm-cris/termbits.h 2004-05-09 19:32:01.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-cris/termbits.h 2004-06-07 12:55:18.117248248 -0700 @@ -154,7 +154,7 @@ #define B6250000 0010007 /* etrax 200 supports this as well */ #define B12500000 0010010 -#define CIBAUD 002003600000 /* input baud rate */ +#define CIBAUD 002003600000 /* input baud rate (used in v32) */ /* The values for CIBAUD bits are the same as the values for CBAUD and CBAUDEX * shifted left IBSHIFT bits. */ diff -urN linux-2.6.7-rc2/include/asm-cris/types.h linux-2.6.7-rc3/include/asm-cris/types.h --- linux-2.6.7-rc2/include/asm-cris/types.h 2004-06-07 12:54:51.951164504 -0700 +++ linux-2.6.7-rc3/include/asm-cris/types.h 2004-06-07 12:55:18.117248248 -0700 @@ -50,6 +50,7 @@ /* Dma addresses are 32-bits wide, just like our other addresses. */ typedef u32 dma_addr_t; +typedef u32 dma64_addr_t; typedef unsigned int kmem_bufctl_t; diff -urN linux-2.6.7-rc2/include/asm-cris/unistd.h linux-2.6.7-rc3/include/asm-cris/unistd.h --- linux-2.6.7-rc2/include/asm-cris/unistd.h 2004-06-07 12:54:51.971165332 -0700 +++ linux-2.6.7-rc3/include/asm-cris/unistd.h 2004-06-07 12:55:18.118248290 -0700 @@ -275,8 +275,21 @@ #define __NR_clock_nanosleep (__NR_timer_create+8) #define __NR_statfs64 268 #define __NR_fstatfs64 269 +#define __NR_tgkill 270 +#define __NR_utimes 271 +#define __NR_fadvise64_64 272 +#define __NR_vserver 273 +#define __NR_mbind 274 +#define __NR_get_mempolicy 275 +#define __NR_set_mempolicy 276 +#define __NR_mq_open 277 +#define __NR_mq_unlink (__NR_mq_open+1) +#define __NR_mq_timedsend (__NR_mq_open+2) +#define __NR_mq_timedreceive (__NR_mq_open+3) +#define __NR_mq_notify (__NR_mq_open+4) +#define __NR_mq_getsetattr (__NR_mq_open+5) -#define NR_syscalls 270 +#define NR_syscalls 283 #ifdef __KERNEL__ @@ -307,6 +320,7 @@ #include #include +#include /* * we need this inline - forking from kernel space will result diff -urN linux-2.6.7-rc2/include/asm-h8300/ide.h linux-2.6.7-rc3/include/asm-h8300/ide.h --- linux-2.6.7-rc2/include/asm-h8300/ide.h 2004-06-07 12:54:52.001166575 -0700 +++ linux-2.6.7-rc3/include/asm-h8300/ide.h 2004-06-07 12:55:18.542265852 -0700 @@ -16,11 +16,6 @@ #ifdef __KERNEL__ /****************************************************************************/ -#define ide_default_irq(base) (0) -#define ide_default_io_base(index) (0) - -#define ide_init_default_irq(base) (0) - #define MAX_HWIFS 1 #include diff -urN linux-2.6.7-rc2/include/asm-i386/bitops.h linux-2.6.7-rc3/include/asm-i386/bitops.h --- linux-2.6.7-rc2/include/asm-i386/bitops.h 2004-05-09 19:32:52.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-i386/bitops.h 2004-06-07 12:55:18.622269166 -0700 @@ -290,7 +290,7 @@ "shll $3,%%edi\n\t" "addl %%edi,%%edx" :"=d" (res), "=&c" (d0), "=&D" (d1), "=&a" (d2) - :"1" ((size + 31) >> 5), "2" (addr), "b" (addr)); + :"1" ((size + 31) >> 5), "2" (addr), "b" (addr) : "memory"); return res; } @@ -318,7 +318,7 @@ "shll $3,%%edi\n\t" "addl %%edi,%%eax" :"=a" (res), "=&c" (d0), "=&D" (d1) - :"1" ((size + 31) >> 5), "2" (addr), "b" (addr)); + :"1" ((size + 31) >> 5), "2" (addr), "b" (addr) : "memory"); return res; } diff -urN linux-2.6.7-rc2/include/asm-i386/cpu.h linux-2.6.7-rc3/include/asm-i386/cpu.h --- linux-2.6.7-rc2/include/asm-i386/cpu.h 2004-06-07 12:54:52.038168107 -0700 +++ linux-2.6.7-rc3/include/asm-i386/cpu.h 2004-06-07 12:55:18.623269208 -0700 @@ -18,10 +18,8 @@ #ifdef CONFIG_NUMA int node = cpu_to_node(num); - - if (!node_online(node)) - return 0; - parent = &node_devices[node].node; + if (node_online(node)) + parent = &node_devices[node].node; #endif /* CONFIG_NUMA */ return register_cpu(&cpu_devices[num].cpu, num, parent); diff -urN linux-2.6.7-rc2/include/asm-i386/floppy.h linux-2.6.7-rc3/include/asm-i386/floppy.h --- linux-2.6.7-rc2/include/asm-i386/floppy.h 2004-05-09 19:32:26.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-i386/floppy.h 2004-06-07 12:55:18.629269456 -0700 @@ -204,7 +204,7 @@ static void _fd_dma_mem_free(unsigned long addr, unsigned long size) { if((unsigned int) addr >= (unsigned int) high_memory) - return vfree((void *)addr); + vfree((void *)addr); else free_pages(addr, get_order(size)); } diff -urN linux-2.6.7-rc2/include/asm-i386/ide.h linux-2.6.7-rc3/include/asm-i386/ide.h --- linux-2.6.7-rc2/include/asm-i386/ide.h 2004-06-07 12:54:52.050168604 -0700 +++ linux-2.6.7-rc3/include/asm-i386/ide.h 2004-06-07 12:55:18.673271279 -0700 @@ -23,6 +23,8 @@ # endif #endif +#define IDE_ARCH_OBSOLETE_DEFAULTS + static __inline__ int ide_default_irq(unsigned long base) { switch (base) { diff -urN linux-2.6.7-rc2/include/asm-i386/uaccess.h linux-2.6.7-rc3/include/asm-i386/uaccess.h --- linux-2.6.7-rc2/include/asm-i386/uaccess.h 2004-05-09 19:32:01.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-i386/uaccess.h 2004-06-07 12:55:19.054287060 -0700 @@ -43,7 +43,7 @@ } ____cacheline_aligned_in_smp movsl_mask; #endif -#define __addr_ok(addr) ((unsigned long)(addr) < (current_thread_info()->addr_limit.seg)) +#define __addr_ok(addr) ((unsigned long __force)(addr) < (current_thread_info()->addr_limit.seg)) /* * Test whether a block of memory is a valid user space address. @@ -56,6 +56,7 @@ */ #define __range_ok(addr,size) ({ \ unsigned long flag,sum; \ + __chk_user_ptr(addr); \ asm("addl %3,%1 ; sbbl %0,%0; cmpl %1,%4; sbbl $0,%0" \ :"=&r" (flag), "=r" (sum) \ :"1" (addr),"g" ((int)(size)),"g" (current_thread_info()->addr_limit.seg)); \ @@ -170,6 +171,7 @@ */ #define get_user(x,ptr) \ ({ int __ret_gu,__val_gu; \ + __chk_user_ptr(ptr); \ switch(sizeof (*(ptr))) { \ case 1: __get_user_x(1,__ret_gu,__val_gu,ptr); break; \ case 2: __get_user_x(2,__ret_gu,__val_gu,ptr); break; \ @@ -288,6 +290,7 @@ #define __put_user_size(x,ptr,size,retval,errret) \ do { \ retval = 0; \ + __chk_user_ptr(ptr); \ switch (size) { \ case 1: __put_user_asm(x,ptr,retval,"b","b","iq",errret);break; \ case 2: __put_user_asm(x,ptr,retval,"w","w","ir",errret);break; \ @@ -346,6 +349,7 @@ #define __get_user_size(x,ptr,size,retval,errret) \ do { \ retval = 0; \ + __chk_user_ptr(ptr); \ switch (size) { \ case 1: __get_user_asm(x,ptr,retval,"b","b","=q",errret);break; \ case 2: __get_user_asm(x,ptr,retval,"w","w","=r",errret);break; \ @@ -403,13 +407,13 @@ switch (n) { case 1: - __put_user_size(*(u8 *)from, (u8 *)to, 1, ret, 1); + __put_user_size(*(u8 *)from, (u8 __user *)to, 1, ret, 1); return ret; case 2: - __put_user_size(*(u16 *)from, (u16 *)to, 2, ret, 2); + __put_user_size(*(u16 *)from, (u16 __user *)to, 2, ret, 2); return ret; case 4: - __put_user_size(*(u32 *)from, (u32 *)to, 4, ret, 4); + __put_user_size(*(u32 *)from, (u32 __user *)to, 4, ret, 4); return ret; } } diff -urN linux-2.6.7-rc2/include/asm-ia64/bitops.h linux-2.6.7-rc3/include/asm-ia64/bitops.h --- linux-2.6.7-rc2/include/asm-ia64/bitops.h 2004-05-09 19:33:19.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-ia64/bitops.h 2004-06-07 12:55:19.125290001 -0700 @@ -11,7 +11,7 @@ #include #include - +#include #include /** @@ -359,93 +359,21 @@ #endif /* __KERNEL__ */ -/* - * Find next zero bit in a bitmap reasonably efficiently.. - */ -static inline int -find_next_zero_bit (void *addr, unsigned long size, unsigned long offset) -{ - unsigned long *p = ((unsigned long *) addr) + (offset >> 6); - unsigned long result = offset & ~63UL; - unsigned long tmp; - - if (offset >= size) - return size; - size -= result; - offset &= 63UL; - if (offset) { - tmp = *(p++); - tmp |= ~0UL >> (64-offset); - if (size < 64) - goto found_first; - if (~tmp) - goto found_middle; - size -= 64; - result += 64; - } - while (size & ~63UL) { - if (~(tmp = *(p++))) - goto found_middle; - result += 64; - size -= 64; - } - if (!size) - return result; - tmp = *p; -found_first: - tmp |= ~0UL << size; - if (tmp == ~0UL) /* any bits zero? */ - return result + size; /* nope */ -found_middle: - return result + ffz(tmp); -} +extern int __find_next_zero_bit (void *addr, unsigned long size, + unsigned long offset); +extern int __find_next_bit(const void *addr, unsigned long size, + unsigned long offset); + +#define find_next_zero_bit(addr, size, offset) \ + __find_next_zero_bit((addr), (size), (offset)) +#define find_next_bit(addr, size, offset) \ + __find_next_bit((addr), (size), (offset)) /* * The optimizer actually does good code for this case.. */ #define find_first_zero_bit(addr, size) find_next_zero_bit((addr), (size), 0) -/* - * Find next bit in a bitmap reasonably efficiently.. - */ -static inline int -find_next_bit(const void *addr, unsigned long size, unsigned long offset) -{ - unsigned long *p = ((unsigned long *) addr) + (offset >> 6); - unsigned long result = offset & ~63UL; - unsigned long tmp; - - if (offset >= size) - return size; - size -= result; - offset &= 63UL; - if (offset) { - tmp = *(p++); - tmp &= ~0UL << offset; - if (size < 64) - goto found_first; - if (tmp) - goto found_middle; - size -= 64; - result += 64; - } - while (size & ~63UL) { - if ((tmp = *(p++))) - goto found_middle; - result += 64; - size -= 64; - } - if (!size) - return result; - tmp = *p; - found_first: - tmp &= ~0UL >> (64-size); - if (tmp == 0UL) /* Are any bits set? */ - return result + size; /* Nope. */ - found_middle: - return result + __ffs(tmp); -} - #define find_first_bit(addr, size) find_next_bit((addr), (size), 0) #ifdef __KERNEL__ diff -urN linux-2.6.7-rc2/include/asm-ia64/ide.h linux-2.6.7-rc3/include/asm-ia64/ide.h --- linux-2.6.7-rc2/include/asm-ia64/ide.h 2004-06-07 12:54:52.123171628 -0700 +++ linux-2.6.7-rc3/include/asm-ia64/ide.h 2004-06-07 12:55:19.133290333 -0700 @@ -25,6 +25,8 @@ # endif #endif +#define IDE_ARCH_OBSOLETE_DEFAULTS + static inline int ide_default_irq(unsigned long base) { switch (base) { diff -urN linux-2.6.7-rc2/include/asm-ia64/system.h linux-2.6.7-rc3/include/asm-ia64/system.h --- linux-2.6.7-rc2/include/asm-ia64/system.h 2004-06-07 12:54:52.128171835 -0700 +++ linux-2.6.7-rc3/include/asm-ia64/system.h 2004-06-07 12:55:19.238294682 -0700 @@ -239,7 +239,7 @@ * the latest fph state from another CPU. In other words: eager save, lazy restore. */ # define switch_to(prev,next,last) do { \ - if (ia64_psr(ia64_task_regs(prev))->mfh) { \ + if (ia64_psr(ia64_task_regs(prev))->mfh && ia64_is_local_fpu_owner(prev)) { \ ia64_psr(ia64_task_regs(prev))->mfh = 0; \ (prev)->thread.flags |= IA64_THREAD_FPH_VALID; \ __ia64_save_fpu((prev)->thread.fph); \ diff -urN linux-2.6.7-rc2/include/asm-ia64/unistd.h linux-2.6.7-rc3/include/asm-ia64/unistd.h --- linux-2.6.7-rc2/include/asm-ia64/unistd.h 2004-06-07 12:54:52.129171876 -0700 +++ linux-2.6.7-rc3/include/asm-ia64/unistd.h 2004-06-07 12:55:19.238294682 -0700 @@ -258,6 +258,7 @@ #define __NR_mq_notify 1266 #define __NR_mq_getsetattr 1267 #define __NR_kexec_load 1268 +#define __NR_vserver 1269 #ifdef __KERNEL__ diff -urN linux-2.6.7-rc2/include/asm-m68k/ide.h linux-2.6.7-rc3/include/asm-m68k/ide.h --- linux-2.6.7-rc2/include/asm-m68k/ide.h 2004-06-07 12:54:52.136172166 -0700 +++ linux-2.6.7-rc3/include/asm-m68k/ide.h 2004-06-07 12:55:19.571308475 -0700 @@ -50,32 +50,6 @@ #define MAX_HWIFS 4 /* same as the other archs */ #endif - -static __inline__ int ide_default_irq(unsigned long base) -{ - return 0; -} - -static __inline__ unsigned long ide_default_io_base(int index) -{ - return 0; -} - - -/* - * Set up a hw structure for a specified data port, control port and IRQ. - * This should follow whatever the default interface uses. - */ -static __inline__ void ide_init_hwif_ports(hw_regs_t *hw, - unsigned long data_port, - unsigned long ctrl_port, int *irq) -{ - if (data_port || ctrl_port) - printk("ide_init_hwif_ports: must not be called\n"); -} - -#define ide_init_default_irq(base) (0) - /* * Get rid of defs from io.h - ide has its private and conflicting versions * Since so far no single m68k platform uses ISA/PCI I/O space for IDE, we diff -urN linux-2.6.7-rc2/include/asm-mips/mach-generic/ide.h linux-2.6.7-rc3/include/asm-mips/mach-generic/ide.h --- linux-2.6.7-rc2/include/asm-mips/mach-generic/ide.h 2004-06-07 12:54:52.158173077 -0700 +++ linux-2.6.7-rc3/include/asm-mips/mach-generic/ide.h 2004-06-07 12:55:20.210334944 -0700 @@ -20,6 +20,8 @@ # endif #endif +#define IDE_ARCH_OBSOLETE_DEFAULTS + static inline int ide_default_irq(unsigned long base) { switch (base) { diff -urN linux-2.6.7-rc2/include/asm-parisc/ide.h linux-2.6.7-rc3/include/asm-parisc/ide.h --- linux-2.6.7-rc2/include/asm-parisc/ide.h 2004-06-07 12:54:52.167173450 -0700 +++ linux-2.6.7-rc3/include/asm-parisc/ide.h 2004-06-07 12:55:20.499346915 -0700 @@ -19,14 +19,9 @@ #define MAX_HWIFS 2 #endif -#define ide_default_irq(base) (0) -#define ide_default_io_base(index) (0) - #define IDE_ARCH_OBSOLETE_INIT #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ -#define ide_init_default_irq(base) (0) - #define ide_request_irq(irq,hand,flg,dev,id) request_irq((irq),(hand),(flg),(dev),(id)) #define ide_free_irq(irq,dev_id) free_irq((irq), (dev_id)) #define ide_check_region(from,extent) check_region((from), (extent)) diff -urN linux-2.6.7-rc2/include/asm-ppc/bug.h linux-2.6.7-rc3/include/asm-ppc/bug.h --- linux-2.6.7-rc2/include/asm-ppc/bug.h 2004-05-09 19:32:54.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-ppc/bug.h 2004-06-07 12:55:20.618351844 -0700 @@ -23,26 +23,30 @@ : : "i" (__LINE__), "i" (__FILE__), "i" (__FUNCTION__)); \ } while (0) -#define BUG_ON(x) do { \ - __asm__ __volatile__( \ - "1: twnei %0,0\n" \ - ".section __bug_table,\"a\"\n\t" \ - " .long 1b,%1,%2,%3\n" \ - ".previous" \ - : : "r" (x), "i" (__LINE__), "i" (__FILE__), \ - "i" (__FUNCTION__)); \ +#define BUG_ON(x) do { \ + if (!__builtin_constant_p(x) || (x)) { \ + __asm__ __volatile__( \ + "1: twnei %0,0\n" \ + ".section __bug_table,\"a\"\n\t" \ + " .long 1b,%1,%2,%3\n" \ + ".previous" \ + : : "r" (x), "i" (__LINE__), "i" (__FILE__), \ + "i" (__FUNCTION__)); \ + } \ } while (0) -#define PAGE_BUG(page) do { BUG(); } while (0) +#define PAGE_BUG(page) BUG() -#define WARN_ON(x) do { \ - __asm__ __volatile__( \ - "1: twnei %0,0\n" \ - ".section __bug_table,\"a\"\n\t" \ - " .long 1b,%1,%2,%3\n" \ - ".previous" \ - : : "r" (x), "i" (__LINE__ + BUG_WARNING_TRAP), \ - "i" (__FILE__), "i" (__FUNCTION__)); \ +#define WARN_ON(x) do { \ + if (!__builtin_constant_p(x) || (x)) { \ + __asm__ __volatile__( \ + "1: twnei %0,0\n" \ + ".section __bug_table,\"a\"\n\t" \ + " .long 1b,%1,%2,%3\n" \ + ".previous" \ + : : "r" (x), "i" (__LINE__ + BUG_WARNING_TRAP), \ + "i" (__FILE__), "i" (__FUNCTION__)); \ + } \ } while (0) #endif diff -urN linux-2.6.7-rc2/include/asm-ppc/hardirq.h linux-2.6.7-rc3/include/asm-ppc/hardirq.h --- linux-2.6.7-rc2/include/asm-ppc/hardirq.h 2004-05-09 19:31:57.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-ppc/hardirq.h 2004-06-07 12:55:20.653353294 -0700 @@ -83,11 +83,15 @@ #ifdef CONFIG_PREEMPT # define in_atomic() ((preempt_count() & ~PREEMPT_ACTIVE) != kernel_locked()) +# define preemptible() (preempt_count() == 0 && !irqs_disabled()) # define IRQ_EXIT_OFFSET (HARDIRQ_OFFSET-1) + #else # define in_atomic() (preempt_count() != 0) +# define preemptible() 0 # define IRQ_EXIT_OFFSET HARDIRQ_OFFSET #endif + #define irq_exit() \ do { \ preempt_count() -= IRQ_EXIT_OFFSET; \ diff -urN linux-2.6.7-rc2/include/asm-ppc/ide.h linux-2.6.7-rc3/include/asm-ppc/ide.h --- linux-2.6.7-rc2/include/asm-ppc/ide.h 2004-06-07 12:54:52.177173864 -0700 +++ linux-2.6.7-rc3/include/asm-ppc/ide.h 2004-06-07 12:55:20.694354992 -0700 @@ -43,6 +43,8 @@ #undef SUPPORT_SLOW_DATA_PORTS #define SUPPORT_SLOW_DATA_PORTS 0 +#define IDE_ARCH_OBSOLETE_DEFAULTS + static __inline__ int ide_default_irq(unsigned long base) { if (ppc_ide_md.default_irq) diff -urN linux-2.6.7-rc2/include/asm-ppc/pci.h linux-2.6.7-rc3/include/asm-ppc/pci.h --- linux-2.6.7-rc2/include/asm-ppc/pci.h 2004-06-07 12:54:52.180173989 -0700 +++ linux-2.6.7-rc3/include/asm-ppc/pci.h 2004-06-07 12:55:20.767358016 -0700 @@ -61,6 +61,14 @@ */ #define PCI_DMA_BUS_IS_PHYS (1) +/* pci_unmap_{page,single} is a nop so... */ +#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) +#define DECLARE_PCI_UNMAP_LEN(LEN_NAME) +#define pci_unmap_addr(PTR, ADDR_NAME) (0) +#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0) +#define pci_unmap_len(PTR, LEN_NAME) (0) +#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0) + /* * At present there are very few 32-bit PPC machines that can have * memory above the 4GB point, and we don't support that. diff -urN linux-2.6.7-rc2/include/asm-ppc/pgtable.h linux-2.6.7-rc3/include/asm-ppc/pgtable.h --- linux-2.6.7-rc2/include/asm-ppc/pgtable.h 2004-06-07 12:54:52.180173989 -0700 +++ linux-2.6.7-rc3/include/asm-ppc/pgtable.h 2004-06-07 12:55:20.780358555 -0700 @@ -555,8 +555,12 @@ (_PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_RW); pte_update(ptep, 0, bits); } + #define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \ - __ptep_set_access_flags(__ptep, __entry, __dirty) + do { \ + __ptep_set_access_flags(__ptep, __entry, __dirty); \ + flush_tlb_page_nohash(__vma, __address); \ + } while(0) /* * Macro to mark a page protection value as "uncacheable". diff -urN linux-2.6.7-rc2/include/asm-ppc/reg_booke.h linux-2.6.7-rc3/include/asm-ppc/reg_booke.h --- linux-2.6.7-rc2/include/asm-ppc/reg_booke.h 2004-06-07 12:54:52.182174071 -0700 +++ linux-2.6.7-rc3/include/asm-ppc/reg_booke.h 2004-06-07 12:55:20.802359466 -0700 @@ -11,19 +11,24 @@ #ifndef __ASSEMBLY__ /* Device Control Registers */ -#define mfdcr(rn) mfdcr_or_dflt(rn, 0) -#define mfdcr_or_dflt(rn,default_rval) \ - ({unsigned int rval; \ - if (rn == 0) \ - rval = default_rval; \ - else \ - asm volatile("mfdcr %0," __stringify(rn) : "=r" (rval)); \ +void __mtdcr(int reg, unsigned int val); +unsigned int __mfdcr(int reg); +#define mfdcr(rn) \ + ({unsigned int rval; \ + if (__builtin_constant_p(rn)) \ + asm volatile("mfdcr %0," __stringify(rn) \ + : "=r" (rval)); \ + else \ + rval = __mfdcr(rn); \ rval;}) -#define mtdcr(rn, v) \ -do { \ - if (rn != 0) \ - asm volatile("mtdcr " __stringify(rn) ",%0" : : "r" (v)); \ +#define mtdcr(rn, v) \ +do { \ + if (__builtin_constant_p(rn)) \ + asm volatile("mtdcr " __stringify(rn) ",%0" \ + : : "r" (v)); \ + else \ + __mtdcr(rn, v); \ } while (0) /* R/W of indirect DCRs make use of standard naming conventions for DCRs */ diff -urN linux-2.6.7-rc2/include/asm-ppc/spinlock.h linux-2.6.7-rc3/include/asm-ppc/spinlock.h --- linux-2.6.7-rc2/include/asm-ppc/spinlock.h 2004-06-07 12:54:52.185174196 -0700 +++ linux-2.6.7-rc3/include/asm-ppc/spinlock.h 2004-06-07 12:55:20.823360336 -0700 @@ -65,7 +65,6 @@ extern void _raw_spin_lock(spinlock_t *lock); extern void _raw_spin_unlock(spinlock_t *lock); extern int _raw_spin_trylock(spinlock_t *lock); -extern unsigned long __spin_trylock(volatile unsigned long *lock); #endif @@ -136,6 +135,26 @@ : "cr0", "memory"); } +static __inline__ int _raw_write_trylock(rwlock_t *rw) +{ + unsigned int tmp; + + __asm__ __volatile__( +"2: lwarx %0,0,%1 # write_trylock\n\ + cmpwi 0,%0,0\n\ + bne- 1f\n" + PPC405_ERR77(0,%1) +" stwcx. %2,0,%1\n\ + bne- 2b\n\ + isync\n\ +1:" + : "=&r"(tmp) + : "r"(&rw->lock), "r"(-1) + : "cr0", "memory"); + + return tmp == 0; +} + static __inline__ void _raw_write_lock(rwlock_t *rw) { unsigned int tmp; @@ -169,6 +188,7 @@ extern void _raw_read_unlock(rwlock_t *rw); extern void _raw_write_lock(rwlock_t *rw); extern void _raw_write_unlock(rwlock_t *rw); +extern int _raw_write_trylock(rwlock_t *rw); #endif diff -urN linux-2.6.7-rc2/include/asm-ppc/tlbflush.h linux-2.6.7-rc3/include/asm-ppc/tlbflush.h --- linux-2.6.7-rc2/include/asm-ppc/tlbflush.h 2004-05-09 19:32:01.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-ppc/tlbflush.h 2004-06-07 12:55:20.829360584 -0700 @@ -29,6 +29,9 @@ static inline void flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr) { _tlbie(vmaddr); } +static inline void flush_tlb_page_nohash(struct vm_area_struct *vma, + unsigned long vmaddr) + { _tlbie(vmaddr); } static inline void flush_tlb_range(struct vm_area_struct *vma, unsigned long start, unsigned long end) { __tlbia(); } @@ -44,6 +47,9 @@ static inline void flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr) { _tlbie(vmaddr); } +static inline void flush_tlb_page_nohash(struct vm_area_struct *vma, + unsigned long vmaddr) + { _tlbie(vmaddr); } static inline void flush_tlb_range(struct mm_struct *mm, unsigned long start, unsigned long end) { __tlbia(); } @@ -56,6 +62,7 @@ struct vm_area_struct; extern void flush_tlb_mm(struct mm_struct *mm); extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr); +extern void flush_tlb_page_nohash(struct vm_area_struct *vma, unsigned long addr); extern void flush_tlb_range(struct vm_area_struct *vma, unsigned long start, unsigned long end); extern void flush_tlb_kernel_range(unsigned long start, unsigned long end); diff -urN linux-2.6.7-rc2/include/asm-ppc64/cacheflush.h linux-2.6.7-rc3/include/asm-ppc64/cacheflush.h --- linux-2.6.7-rc2/include/asm-ppc64/cacheflush.h 2004-06-07 12:54:52.188174320 -0700 +++ linux-2.6.7-rc3/include/asm-ppc64/cacheflush.h 2004-06-07 12:55:20.904363691 -0700 @@ -40,7 +40,7 @@ static inline void flush_icache_range(unsigned long start, unsigned long stop) { - if (!(cur_cpu_spec->cpu_features & CPU_FTR_COHERENT_ICACHE)) + if (!(cur_cpu_spec->cpu_features & ASM_CONST(CPU_FTR_COHERENT_ICACHE))) __flush_icache_range(start, stop); } diff -urN linux-2.6.7-rc2/include/asm-ppc64/eeh.h linux-2.6.7-rc3/include/asm-ppc64/eeh.h --- linux-2.6.7-rc2/include/asm-ppc64/eeh.h 2004-06-07 12:54:52.189174361 -0700 +++ linux-2.6.7-rc3/include/asm-ppc64/eeh.h 2004-06-07 12:55:20.911363981 -0700 @@ -47,16 +47,16 @@ void __init pci_addr_cache_build(void); /** - * eeh_add_device - perform EEH initialization for the indicated pci device - * @dev: pci device for which to set up EEH + * eeh_add_device_early + * eeh_add_device_late * - * This routine can be used to perform EEH initialization for PCI - * devices that were added after system boot (e.g. hotplug, dlpar). - * Whether this actually enables EEH or not for this device depends - * on the type of the device, on earlier boot command-line - * arguments & etc. + * Perform eeh initialization for devices added after boot. + * Call eeh_add_device_early before doing any i/o to the + * device (including config space i/o). Call eeh_add_device_late + * to finish the eeh setup for this device. */ -void eeh_add_device(struct pci_dev *); +void eeh_add_device_early(struct device_node *); +void eeh_add_device_late(struct pci_dev *); /** * eeh_remove_device - undo EEH setup for the indicated pci device diff -urN linux-2.6.7-rc2/include/asm-ppc64/iSeries/HvCallSc.h linux-2.6.7-rc3/include/asm-ppc64/iSeries/HvCallSc.h --- linux-2.6.7-rc2/include/asm-ppc64/iSeries/HvCallSc.h 2004-05-09 19:32:01.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-ppc64/iSeries/HvCallSc.h 2004-06-07 12:55:20.915364147 -0700 @@ -21,14 +21,14 @@ #include -#define HvCallBase 0x8000000000000000 -#define HvCallCc 0x8001000000000000 -#define HvCallCfg 0x8002000000000000 -#define HvCallEvent 0x8003000000000000 -#define HvCallHpt 0x8004000000000000 -#define HvCallPci 0x8005000000000000 -#define HvCallSm 0x8007000000000000 -#define HvCallXm 0x8009000000000000 +#define HvCallBase 0x8000000000000000ul +#define HvCallCc 0x8001000000000000ul +#define HvCallCfg 0x8002000000000000ul +#define HvCallEvent 0x8003000000000000ul +#define HvCallHpt 0x8004000000000000ul +#define HvCallPci 0x8005000000000000ul +#define HvCallSm 0x8007000000000000ul +#define HvCallXm 0x8009000000000000ul u64 HvCall0( u64 ); u64 HvCall1( u64, u64 ); diff -urN linux-2.6.7-rc2/include/asm-ppc64/ide.h linux-2.6.7-rc3/include/asm-ppc64/ide.h --- linux-2.6.7-rc2/include/asm-ppc64/ide.h 2004-06-07 12:54:52.189174361 -0700 +++ linux-2.6.7-rc3/include/asm-ppc64/ide.h 2004-06-07 12:55:20.940365182 -0700 @@ -22,14 +22,9 @@ # define MAX_HWIFS 4 #endif -static inline int ide_default_irq(unsigned long base) { return 0; } -static inline unsigned long ide_default_io_base(int index) { return 0; } - #define IDE_ARCH_OBSOLETE_INIT #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ -#define ide_init_default_irq(base) (0) - #endif /* __KERNEL__ */ #endif /* __ASMPPC64_IDE_H */ diff -urN linux-2.6.7-rc2/include/asm-ppc64/mmu_context.h linux-2.6.7-rc3/include/asm-ppc64/mmu_context.h --- linux-2.6.7-rc2/include/asm-ppc64/mmu_context.h 2004-06-07 12:54:52.191174444 -0700 +++ linux-2.6.7-rc3/include/asm-ppc64/mmu_context.h 2004-06-07 12:55:21.023368620 -0700 @@ -172,8 +172,14 @@ * After we have set current->mm to a new value, this activates * the context for the new mm so we see the new mappings. */ -#define activate_mm(active_mm, mm) \ - switch_mm(active_mm, mm, current); +static inline void activate_mm(struct mm_struct *prev, struct mm_struct *next) +{ + unsigned long flags; + + local_irq_save(flags); + switch_mm(prev, next, current); + local_irq_restore(flags); +} #define VSID_RANDOMIZER 42470972311UL #define VSID_MASK 0xfffffffffUL diff -urN linux-2.6.7-rc2/include/asm-ppc64/naca.h linux-2.6.7-rc3/include/asm-ppc64/naca.h --- linux-2.6.7-rc2/include/asm-ppc64/naca.h 2004-05-09 19:32:36.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-ppc64/naca.h 2004-06-07 12:55:21.024368662 -0700 @@ -30,7 +30,7 @@ u64 log; /* Ptr to log buffer 0x30 */ u64 serialPortAddr; /* Phy addr of serial port 0x38 */ u64 interrupt_controller; /* Type of int controller 0x40 */ - u64 slb_size; /* SLB size in entries 0x48 */ + u64 unused1; /* was SLB size in entries 0x48 */ u64 pftSize; /* Log 2 of page table size 0x50 */ void *systemcfg; /* Pointer to systemcfg data 0x58 */ u32 dCacheL1LogLineSize; /* L1 d-cache line size Log2 0x60 */ diff -urN linux-2.6.7-rc2/include/asm-ppc64/page.h linux-2.6.7-rc3/include/asm-ppc64/page.h --- linux-2.6.7-rc2/include/asm-ppc64/page.h 2004-06-07 12:54:52.192174486 -0700 +++ linux-2.6.7-rc3/include/asm-ppc64/page.h 2004-06-07 12:55:21.033369034 -0700 @@ -15,7 +15,8 @@ #ifdef __ASSEMBLY__ #define ASM_CONST(x) x #else - #define ASM_CONST(x) x##UL + #define __ASM_CONST(x) x##UL + #define ASM_CONST(x) __ASM_CONST(x) #endif /* PAGE_SHIFT determines the page size */ diff -urN linux-2.6.7-rc2/include/asm-ppc64/pgtable.h linux-2.6.7-rc3/include/asm-ppc64/pgtable.h --- linux-2.6.7-rc2/include/asm-ppc64/pgtable.h 2004-06-07 12:54:52.193174527 -0700 +++ linux-2.6.7-rc3/include/asm-ppc64/pgtable.h 2004-06-07 12:55:21.079370940 -0700 @@ -47,7 +47,7 @@ /* * Define the address range of the vmalloc VM area. */ -#define VMALLOC_START (0xD000000000000000) +#define VMALLOC_START (0xD000000000000000ul) #define VMALLOC_END (VMALLOC_START + VALID_EA_BITS) /* @@ -56,8 +56,8 @@ */ #define IMALLOC_START (ioremap_bot) #define IMALLOC_VMADDR(x) ((unsigned long)(x)) -#define PHBS_IO_BASE (0xE000000000000000) /* Reserve 2 gigs for PHBs */ -#define IMALLOC_BASE (0xE000000080000000) +#define PHBS_IO_BASE (0xE000000000000000ul) /* Reserve 2 gigs for PHBs */ +#define IMALLOC_BASE (0xE000000080000000ul) #define IMALLOC_END (IMALLOC_BASE + VALID_EA_BITS) /* @@ -428,7 +428,10 @@ :"cc"); } #define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \ - __ptep_set_access_flags(__ptep, __entry, __dirty) + do { \ + __ptep_set_access_flags(__ptep, __entry, __dirty); \ + flush_tlb_page_nohash(__vma, __address); \ + } while(0) /* * Macro to mark a page protection value as "uncacheable". diff -urN linux-2.6.7-rc2/include/asm-ppc64/processor.h linux-2.6.7-rc3/include/asm-ppc64/processor.h --- linux-2.6.7-rc2/include/asm-ppc64/processor.h 2004-06-07 12:54:52.194174568 -0700 +++ linux-2.6.7-rc3/include/asm-ppc64/processor.h 2004-06-07 12:55:21.113372348 -0700 @@ -634,4 +634,10 @@ #endif /* ASSEMBLY */ +/* + * Number of entries in the SLB. If this ever changes we should handle + * it with a use a cpu feature fixup. + */ +#define SLB_NUM_ENTRIES 64 + #endif /* __ASM_PPC64_PROCESSOR_H */ diff -urN linux-2.6.7-rc2/include/asm-ppc64/tlbflush.h linux-2.6.7-rc3/include/asm-ppc64/tlbflush.h --- linux-2.6.7-rc2/include/asm-ppc64/tlbflush.h 2004-05-09 19:31:55.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-ppc64/tlbflush.h 2004-06-07 12:55:21.158374212 -0700 @@ -6,6 +6,7 @@ * * - flush_tlb_mm(mm) flushes the specified mm context TLB's * - flush_tlb_page(vma, vmaddr) flushes one page + * - flush_tlb_page_nohash(vma, vmaddr) flushes one page if SW loaded TLB * - flush_tlb_range(vma, start, end) flushes a range of pages * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages * - flush_tlb_pgtables(mm, start, end) flushes a range of page tables @@ -39,6 +40,7 @@ #define flush_tlb_mm(mm) flush_tlb_pending() #define flush_tlb_page(vma, addr) flush_tlb_pending() +#define flush_tlb_page_nohash(vma, addr) do { } while (0) #define flush_tlb_range(vma, start, end) \ do { (void)(start); flush_tlb_pending(); } while (0) #define flush_tlb_kernel_range(start, end) flush_tlb_pending() diff -urN linux-2.6.7-rc2/include/asm-ppc64/uaccess.h linux-2.6.7-rc3/include/asm-ppc64/uaccess.h --- linux-2.6.7-rc2/include/asm-ppc64/uaccess.h 2004-05-09 19:32:37.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-ppc64/uaccess.h 2004-06-07 12:55:21.192375621 -0700 @@ -54,7 +54,7 @@ (((segment).seg & (addr | size )) == 0) #define access_ok(type,addr,size) \ - __access_ok(((unsigned long)(addr)),(size),get_fs()) + __access_ok(((__force unsigned long)(addr)),(size),get_fs()) static inline int verify_area(int type, const void __user *addr, unsigned long size) { @@ -116,6 +116,7 @@ #define __put_user_nocheck(x,ptr,size) \ ({ \ long __pu_err; \ + __chk_user_ptr(ptr); \ __put_user_size((x),(ptr),(size),__pu_err,-EFAULT); \ __pu_err; \ }) @@ -123,7 +124,7 @@ #define __put_user_check(x,ptr,size) \ ({ \ long __pu_err = -EFAULT; \ - __typeof__(*(ptr)) *__pu_addr = (ptr); \ + void __user *__pu_addr = (ptr); \ if (access_ok(VERIFY_WRITE,__pu_addr,size)) \ __put_user_size((x),__pu_addr,(size),__pu_err,-EFAULT); \ __pu_err; \ @@ -187,6 +188,7 @@ do { \ might_sleep(); \ retval = 0; \ + __chk_user_ptr(ptr); \ switch (size) { \ case 1: __get_user_asm(x,ptr,retval,"lbz",errret); break; \ case 2: __get_user_asm(x,ptr,retval,"lhz",errret); break; \ diff -urN linux-2.6.7-rc2/include/asm-s390/atomic.h linux-2.6.7-rc3/include/asm-s390/atomic.h --- linux-2.6.7-rc2/include/asm-s390/atomic.h 2004-06-07 12:54:52.205175024 -0700 +++ linux-2.6.7-rc3/include/asm-s390/atomic.h 2004-06-07 12:55:21.236377443 -0700 @@ -145,7 +145,7 @@ } static __inline__ long long atomic64_inc_and_test(volatile atomic64_t * v) { - return __CSG_LOOP(v, 1, "agr") != 0; + return __CSG_LOOP(v, 1, "agr") == 0; } static __inline__ void atomic64_dec(volatile atomic64_t * v) { diff -urN linux-2.6.7-rc2/include/asm-s390/pgtable.h linux-2.6.7-rc3/include/asm-s390/pgtable.h --- linux-2.6.7-rc2/include/asm-s390/pgtable.h 2004-06-07 12:54:52.219175604 -0700 +++ linux-2.6.7-rc3/include/asm-s390/pgtable.h 2004-06-07 12:55:21.374383159 -0700 @@ -587,6 +587,9 @@ set_pte(ptep, entry); } +#define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \ + ptep_establish(__vma, __address, __ptep, __entry) + /* * Test and clear dirty bit in storage key. * We can't clear the changed bit atomically. This is a potential @@ -784,6 +787,7 @@ #define pgtable_cache_init() do { } while (0) #define __HAVE_ARCH_PTEP_ESTABLISH +#define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG #define __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY diff -urN linux-2.6.7-rc2/include/asm-s390/uaccess.h linux-2.6.7-rc3/include/asm-s390/uaccess.h --- linux-2.6.7-rc2/include/asm-s390/uaccess.h 2004-06-07 12:54:52.224175811 -0700 +++ linux-2.6.7-rc3/include/asm-s390/uaccess.h 2004-06-07 12:55:21.417384941 -0700 @@ -326,12 +326,12 @@ return n; } -extern long __copy_in_user_asm(const void *from, long n, void *to); +extern unsigned long __copy_in_user_asm(const void *from, long n, void *to); static inline unsigned long __copy_in_user(void __user *to, const void __user *from, unsigned long n) { - __copy_in_user_asm(from, n, to); + return __copy_in_user_asm(from, n, to); } static inline unsigned long diff -urN linux-2.6.7-rc2/include/asm-sh/ide.h linux-2.6.7-rc3/include/asm-sh/ide.h --- linux-2.6.7-rc2/include/asm-sh/ide.h 2004-06-07 12:54:52.349180988 -0700 +++ linux-2.6.7-rc3/include/asm-sh/ide.h 2004-06-07 12:55:21.483387674 -0700 @@ -22,6 +22,8 @@ #define MAX_HWIFS 2 #endif +#define IDE_ARCH_OBSOLETE_DEFAULTS + static inline int ide_default_irq_hp600(unsigned long base) { switch (base) { diff -urN linux-2.6.7-rc2/include/asm-sparc/hardirq.h linux-2.6.7-rc3/include/asm-sparc/hardirq.h --- linux-2.6.7-rc2/include/asm-sparc/hardirq.h 2004-05-09 19:33:22.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-sparc/hardirq.h 2004-06-07 12:55:21.514388958 -0700 @@ -57,15 +57,6 @@ #define HARDIRQ_OFFSET (1UL << HARDIRQ_SHIFT) /* - * The hardirq mask has to be large enough to have - * space for potentially all IRQ sources in the system - * nesting on a single CPU: - */ -#if (1 << HARDIRQ_BITS) < NR_IRQS -# error HARDIRQ_BITS is too low! -#endif - -/* * Are we doing bottom half or hardware interrupt processing? * Are we in a softirq context? Interrupt context? */ diff -urN linux-2.6.7-rc2/include/asm-sparc/ide.h linux-2.6.7-rc3/include/asm-sparc/ide.h --- linux-2.6.7-rc2/include/asm-sparc/ide.h 2004-06-07 12:54:52.438184674 -0700 +++ linux-2.6.7-rc3/include/asm-sparc/ide.h 2004-06-07 12:55:21.641394219 -0700 @@ -19,21 +19,9 @@ #undef MAX_HWIFS #define MAX_HWIFS 2 -static __inline__ int ide_default_irq(unsigned long base) -{ - return 0; -} - -static __inline__ unsigned long ide_default_io_base(int index) -{ - return 0; -} - #define IDE_ARCH_OBSOLETE_INIT #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ -#define ide_init_default_irq(base) (0) - #define __ide_insl(data_reg, buffer, wcount) \ __ide_insw(data_reg, buffer, (wcount)<<1) #define __ide_outsl(data_reg, buffer, wcount) \ diff -urN linux-2.6.7-rc2/include/asm-sparc/ipc.h linux-2.6.7-rc3/include/asm-sparc/ipc.h --- linux-2.6.7-rc2/include/asm-sparc/ipc.h 2004-05-09 19:32:00.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-sparc/ipc.h 2004-06-07 12:55:21.681395876 -0700 @@ -7,7 +7,7 @@ * See arch/sparc/kernel/sys_sparc.c for ugly details.. */ struct ipc_kludge { - struct msgbuf *msgp; + struct msgbuf __user *msgp; long msgtyp; }; diff -urN linux-2.6.7-rc2/include/asm-sparc/sbus.h linux-2.6.7-rc3/include/asm-sparc/sbus.h --- linux-2.6.7-rc2/include/asm-sparc/sbus.h 2004-05-09 19:32:02.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-sparc/sbus.h 2004-06-07 12:55:21.906405196 -0700 @@ -7,6 +7,7 @@ #ifndef _SPARC_SBUS_H #define _SPARC_SBUS_H +#include #include #include @@ -106,10 +107,10 @@ extern void *sbus_alloc_consistent(struct sbus_dev *, long, u32 *dma_addrp); extern void sbus_free_consistent(struct sbus_dev *, long, void *, u32); -#define SBUS_DMA_BIDIRECTIONAL 0 -#define SBUS_DMA_TODEVICE 1 -#define SBUS_DMA_FROMDEVICE 2 -#define SBUS_DMA_NONE 3 +#define SBUS_DMA_BIDIRECTIONAL DMA_BIDIRECTIONAL +#define SBUS_DMA_TODEVICE DMA_TO_DEVICE +#define SBUS_DMA_FROMDEVICE DMA_FROM_DEVICE +#define SBUS_DMA_NONE DMA_NONE /* All the rest use streaming mode mappings. */ extern dma_addr_t sbus_map_single(struct sbus_dev *, void *, size_t, int); diff -urN linux-2.6.7-rc2/include/asm-sparc/semaphore.h linux-2.6.7-rc3/include/asm-sparc/semaphore.h --- linux-2.6.7-rc2/include/asm-sparc/semaphore.h 2004-05-09 19:33:21.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-sparc/semaphore.h 2004-06-07 12:55:21.911405403 -0700 @@ -13,12 +13,12 @@ atomic24_t count; int sleepers; wait_queue_head_t wait; -#if WAITQUEUE_DEBUG +#ifdef WAITQUEUE_DEBUG long __magic; #endif }; -#if WAITQUEUE_DEBUG +#ifdef WAITQUEUE_DEBUG # define __SEM_DEBUG_INIT(name) \ , (long)&(name).__magic #else @@ -43,7 +43,7 @@ atomic24_set(&sem->count, val); sem->sleepers = 0; init_waitqueue_head(&sem->wait); -#if WAITQUEUE_DEBUG +#ifdef WAITQUEUE_DEBUG sem->__magic = (long)&sem->__magic; #endif } @@ -68,7 +68,7 @@ register volatile int *ptr asm("g1"); register int increment asm("g2"); -#if WAITQUEUE_DEBUG +#ifdef WAITQUEUE_DEBUG CHECK_MAGIC(sem->__magic); #endif might_sleep(); @@ -105,7 +105,7 @@ register volatile int *ptr asm("g1"); register int increment asm("g2"); -#if WAITQUEUE_DEBUG +#ifdef WAITQUEUE_DEBUG CHECK_MAGIC(sem->__magic); #endif might_sleep(); @@ -145,7 +145,7 @@ register volatile int *ptr asm("g1"); register int increment asm("g2"); -#if WAITQUEUE_DEBUG +#ifdef WAITQUEUE_DEBUG CHECK_MAGIC(sem->__magic); #endif @@ -184,7 +184,7 @@ register volatile int *ptr asm("g1"); register int increment asm("g2"); -#if WAITQUEUE_DEBUG +#ifdef WAITQUEUE_DEBUG CHECK_MAGIC(sem->__magic); #endif diff -urN linux-2.6.7-rc2/include/asm-sparc/signal.h linux-2.6.7-rc3/include/asm-sparc/signal.h --- linux-2.6.7-rc2/include/asm-sparc/signal.h 2004-05-09 19:32:39.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-sparc/signal.h 2004-06-07 12:55:21.911405403 -0700 @@ -199,7 +199,7 @@ #ifdef __KERNEL__ struct k_sigaction { struct __new_sigaction sa; - void *ka_restorer; + void __user *ka_restorer; }; #endif @@ -211,7 +211,7 @@ }; typedef struct sigaltstack { - void *ss_sp; + void __user *ss_sp; int ss_flags; size_t ss_size; } stack_t; diff -urN linux-2.6.7-rc2/include/asm-sparc/thread_info.h linux-2.6.7-rc3/include/asm-sparc/thread_info.h --- linux-2.6.7-rc2/include/asm-sparc/thread_info.h 2004-05-09 19:33:20.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-sparc/thread_info.h 2004-06-07 12:55:21.930406190 -0700 @@ -17,6 +17,7 @@ #include #include +#include /* * Low level task data. diff -urN linux-2.6.7-rc2/include/asm-sparc/uaccess.h linux-2.6.7-rc3/include/asm-sparc/uaccess.h --- linux-2.6.7-rc2/include/asm-sparc/uaccess.h 2004-05-09 19:33:19.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-sparc/uaccess.h 2004-06-07 12:55:21.954407184 -0700 @@ -94,10 +94,12 @@ */ #define put_user(x,ptr) ({ \ unsigned long __pu_addr = (unsigned long)(ptr); \ +__chk_user_ptr(ptr); \ __put_user_check((__typeof__(*(ptr)))(x),__pu_addr,sizeof(*(ptr))); }) #define get_user(x,ptr) ({ \ unsigned long __gu_addr = (unsigned long)(ptr); \ +__chk_user_ptr(ptr); \ __get_user_check((x),__gu_addr,sizeof(*(ptr)),__typeof__(*(ptr))); }) /* @@ -292,32 +294,32 @@ extern int __get_user_bad(void); -extern unsigned long __copy_user(void *to, const void *from, unsigned long size); +extern unsigned long __copy_user(void __user *to, const void __user *from, unsigned long size); static inline unsigned long copy_to_user(void __user *to, const void *from, unsigned long n) { if (n && __access_ok((unsigned long) to, n)) - return __copy_user((void *) to, from, n); + return __copy_user(to, (void __user *) from, n); else return n; } static inline unsigned long __copy_to_user(void __user *to, const void *from, unsigned long n) { - return __copy_user((void *)to, from, n); + return __copy_user(to, (void __user *) from, n); } static inline unsigned long copy_from_user(void *to, const void __user *from, unsigned long n) { if (n && __access_ok((unsigned long) from, n)) - return __copy_user(to, (void *) from, n); + return __copy_user((void __user *) to, from, n); else return n; } static inline unsigned long __copy_from_user(void *to, const void __user *from, unsigned long n) { - return __copy_user(to, (void *)from, n); + return __copy_user((void __user *) to, from, n); } static inline unsigned long __clear_user(void __user *addr, unsigned long size) diff -urN linux-2.6.7-rc2/include/asm-sparc64/chmctrl.h linux-2.6.7-rc3/include/asm-sparc64/chmctrl.h --- linux-2.6.7-rc2/include/asm-sparc64/chmctrl.h 2004-05-09 19:32:26.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-sparc64/chmctrl.h 2004-06-07 12:55:22.047411036 -0700 @@ -14,171 +14,171 @@ #define CHMCTRL_MACTRL 0x30 /* Memory Address Control */ /* Memory Timing Control I */ -#define TCTRL1_SDRAMCTL_DLY 0xf000000000000000 +#define TCTRL1_SDRAMCTL_DLY 0xf000000000000000UL #define TCTRL1_SDRAMCTL_DLY_SHIFT 60 -#define TCTRL1_SDRAMCLK_DLY 0x0e00000000000000 +#define TCTRL1_SDRAMCLK_DLY 0x0e00000000000000UL #define TCTRL1_SDRAMCLK_DLY_SHIFT 57 -#define TCTRL1_R 0x0100000000000000 +#define TCTRL1_R 0x0100000000000000UL #define TCTRL1_R_SHIFT 56 -#define TCTRL1_AUTORFR_CYCLE 0x00fe000000000000 +#define TCTRL1_AUTORFR_CYCLE 0x00fe000000000000UL #define TCTRL1_AUTORFR_CYCLE_SHIFT 49 -#define TCTRL1_RD_WAIT 0x0001f00000000000 +#define TCTRL1_RD_WAIT 0x0001f00000000000UL #define TCTRL1_RD_WAIT_SHIFT 44 -#define TCTRL1_PC_CYCLE 0x00000fc000000000 +#define TCTRL1_PC_CYCLE 0x00000fc000000000UL #define TCTRL1_PC_CYCLE_SHIFT 38 -#define TCTRL1_WR_MORE_RAS_PW 0x0000003f00000000 +#define TCTRL1_WR_MORE_RAS_PW 0x0000003f00000000UL #define TCTRL1_WR_MORE_RAS_PW_SHIFT 32 -#define TCTRL1_RD_MORE_RAW_PW 0x00000000fc000000 +#define TCTRL1_RD_MORE_RAW_PW 0x00000000fc000000UL #define TCTRL1_RD_MORE_RAS_PW_SHIFT 26 -#define TCTRL1_ACT_WR_DLY 0x0000000003f00000 +#define TCTRL1_ACT_WR_DLY 0x0000000003f00000UL #define TCTRL1_ACT_WR_DLY_SHIFT 20 -#define TCTRL1_ACT_RD_DLY 0x00000000000fc000 +#define TCTRL1_ACT_RD_DLY 0x00000000000fc000UL #define TCTRL1_ACT_RD_DLY_SHIFT 14 -#define TCTRL1_BANK_PRESENT 0x0000000000003000 +#define TCTRL1_BANK_PRESENT 0x0000000000003000UL #define TCTRL1_BANK_PRESENT_SHIFT 12 -#define TCTRL1_RFR_INT 0x0000000000000ff8 +#define TCTRL1_RFR_INT 0x0000000000000ff8UL #define TCTRL1_RFR_INT_SHIFT 3 -#define TCTRL1_SET_MODE_REG 0x0000000000000004 +#define TCTRL1_SET_MODE_REG 0x0000000000000004UL #define TCTRL1_SET_MODE_REG_SHIFT 2 -#define TCTRL1_RFR_ENABLE 0x0000000000000002 +#define TCTRL1_RFR_ENABLE 0x0000000000000002UL #define TCTRL1_RFR_ENABLE_SHIFT 1 -#define TCTRL1_PRECHG_ALL 0x0000000000000001 +#define TCTRL1_PRECHG_ALL 0x0000000000000001UL #define TCTRL1_PRECHG_ALL_SHIFT 0 /* Memory Timing Control II */ -#define TCTRL2_WR_MSEL_DLY 0xfc00000000000000 +#define TCTRL2_WR_MSEL_DLY 0xfc00000000000000UL #define TCTRL2_WR_MSEL_DLY_SHIFT 58 -#define TCTRL2_RD_MSEL_DLY 0x03f0000000000000 +#define TCTRL2_RD_MSEL_DLY 0x03f0000000000000UL #define TCTRL2_RD_MSEL_DLY_SHIFT 52 -#define TCTRL2_WRDATA_THLD 0x000c000000000000 +#define TCTRL2_WRDATA_THLD 0x000c000000000000UL #define TCTRL2_WRDATA_THLD_SHIFT 50 -#define TCTRL2_RDWR_RD_TI_DLY 0x0003f00000000000 +#define TCTRL2_RDWR_RD_TI_DLY 0x0003f00000000000UL #define TCTRL2_RDWR_RD_TI_DLY_SHIFT 44 -#define TCTRL2_AUTOPRECHG_ENBL 0x0000080000000000 +#define TCTRL2_AUTOPRECHG_ENBL 0x0000080000000000UL #define TCTRL2_AUTOPRECHG_ENBL_SHIFT 43 -#define TCTRL2_RDWR_PI_MORE_DLY 0x000007c000000000 +#define TCTRL2_RDWR_PI_MORE_DLY 0x000007c000000000UL #define TCTRL2_RDWR_PI_MORE_DLY_SHIFT 38 -#define TCTRL2_RDWR_1_DLY 0x0000003f00000000 +#define TCTRL2_RDWR_1_DLY 0x0000003f00000000UL #define TCTRL2_RDWR_1_DLY_SHIFT 32 -#define TCTRL2_WRWR_PI_MORE_DLY 0x00000000f8000000 +#define TCTRL2_WRWR_PI_MORE_DLY 0x00000000f8000000UL #define TCTRL2_WRWR_PI_MORE_DLY_SHIFT 27 -#define TCTRL2_WRWR_1_DLY 0x0000000007e00000 +#define TCTRL2_WRWR_1_DLY 0x0000000007e00000UL #define TCTRL2_WRWR_1_DLY_SHIFT 21 -#define TCTRL2_RDWR_RD_PI_MORE_DLY 0x00000000001f0000 +#define TCTRL2_RDWR_RD_PI_MORE_DLY 0x00000000001f0000UL #define TCTRL2_RDWR_RD_PI_MORE_DLY_SHIFT 16 -#define TCTRL2_R 0x0000000000008000 +#define TCTRL2_R 0x0000000000008000UL #define TCTRL2_R_SHIFT 15 -#define TCTRL2_SDRAM_MODE_REG_DATA 0x0000000000007fff +#define TCTRL2_SDRAM_MODE_REG_DATA 0x0000000000007fffUL #define TCTRL2_SDRAM_MODE_REG_DATA_SHIFT 0 /* Memory Timing Control III */ -#define TCTRL3_SDRAM_CTL_DLY 0xf000000000000000 +#define TCTRL3_SDRAM_CTL_DLY 0xf000000000000000UL #define TCTRL3_SDRAM_CTL_DLY_SHIFT 60 -#define TCTRL3_SDRAM_CLK_DLY 0x0e00000000000000 +#define TCTRL3_SDRAM_CLK_DLY 0x0e00000000000000UL #define TCTRL3_SDRAM_CLK_DLY_SHIFT 57 -#define TCTRL3_R 0x0100000000000000 +#define TCTRL3_R 0x0100000000000000UL #define TCTRL3_R_SHIFT 56 -#define TCTRL3_AUTO_RFR_CYCLE 0x00fe000000000000 +#define TCTRL3_AUTO_RFR_CYCLE 0x00fe000000000000UL #define TCTRL3_AUTO_RFR_CYCLE_SHIFT 49 -#define TCTRL3_RD_WAIT 0x0001f00000000000 +#define TCTRL3_RD_WAIT 0x0001f00000000000UL #define TCTRL3_RD_WAIT_SHIFT 44 -#define TCTRL3_PC_CYCLE 0x00000fc000000000 +#define TCTRL3_PC_CYCLE 0x00000fc000000000UL #define TCTRL3_PC_CYCLE_SHIFT 38 -#define TCTRL3_WR_MORE_RAW_PW 0x0000003f00000000 +#define TCTRL3_WR_MORE_RAW_PW 0x0000003f00000000UL #define TCTRL3_WR_MORE_RAW_PW_SHIFT 32 -#define TCTRL3_RD_MORE_RAW_PW 0x00000000fc000000 +#define TCTRL3_RD_MORE_RAW_PW 0x00000000fc000000UL #define TCTRL3_RD_MORE_RAW_PW_SHIFT 26 -#define TCTRL3_ACT_WR_DLY 0x0000000003f00000 +#define TCTRL3_ACT_WR_DLY 0x0000000003f00000UL #define TCTRL3_ACT_WR_DLY_SHIFT 20 -#define TCTRL3_ACT_RD_DLY 0x00000000000fc000 +#define TCTRL3_ACT_RD_DLY 0x00000000000fc000UL #define TCTRL3_ACT_RD_DLY_SHIFT 14 -#define TCTRL3_BANK_PRESENT 0x0000000000003000 +#define TCTRL3_BANK_PRESENT 0x0000000000003000UL #define TCTRL3_BANK_PRESENT_SHIFT 12 -#define TCTRL3_RFR_INT 0x0000000000000ff8 +#define TCTRL3_RFR_INT 0x0000000000000ff8UL #define TCTRL3_RFR_INT_SHIFT 3 -#define TCTRL3_SET_MODE_REG 0x0000000000000004 +#define TCTRL3_SET_MODE_REG 0x0000000000000004UL #define TCTRL3_SET_MODE_REG_SHIFT 2 -#define TCTRL3_RFR_ENABLE 0x0000000000000002 +#define TCTRL3_RFR_ENABLE 0x0000000000000002UL #define TCTRL3_RFR_ENABLE_SHIFT 1 -#define TCTRL3_PRECHG_ALL 0x0000000000000001 +#define TCTRL3_PRECHG_ALL 0x0000000000000001UL #define TCTRL3_PRECHG_ALL_SHIFT 0 /* Memory Timing Control IV */ -#define TCTRL4_WR_MSEL_DLY 0xfc00000000000000 +#define TCTRL4_WR_MSEL_DLY 0xfc00000000000000UL #define TCTRL4_WR_MSEL_DLY_SHIFT 58 -#define TCTRL4_RD_MSEL_DLY 0x03f0000000000000 +#define TCTRL4_RD_MSEL_DLY 0x03f0000000000000UL #define TCTRL4_RD_MSEL_DLY_SHIFT 52 -#define TCTRL4_WRDATA_THLD 0x000c000000000000 +#define TCTRL4_WRDATA_THLD 0x000c000000000000UL #define TCTRL4_WRDATA_THLD_SHIFT 50 -#define TCTRL4_RDWR_RD_RI_DLY 0x0003f00000000000 +#define TCTRL4_RDWR_RD_RI_DLY 0x0003f00000000000UL #define TCTRL4_RDWR_RD_RI_DLY_SHIFT 44 -#define TCTRL4_AUTO_PRECHG_ENBL 0x0000080000000000 +#define TCTRL4_AUTO_PRECHG_ENBL 0x0000080000000000UL #define TCTRL4_AUTO_PRECHG_ENBL_SHIFT 43 -#define TCTRL4_RD_WR_PI_MORE_DLY 0x000007c000000000 +#define TCTRL4_RD_WR_PI_MORE_DLY 0x000007c000000000UL #define TCTRL4_RD_WR_PI_MORE_DLY_SHIFT 38 -#define TCTRL4_RD_WR_TI_DLY 0x0000003f00000000 +#define TCTRL4_RD_WR_TI_DLY 0x0000003f00000000UL #define TCTRL4_RD_WR_TI_DLY_SHIFT 32 -#define TCTRL4_WR_WR_PI_MORE_DLY 0x00000000f8000000 +#define TCTRL4_WR_WR_PI_MORE_DLY 0x00000000f8000000UL #define TCTRL4_WR_WR_PI_MORE_DLY_SHIFT 27 -#define TCTRL4_WR_WR_TI_DLY 0x0000000007e00000 +#define TCTRL4_WR_WR_TI_DLY 0x0000000007e00000UL #define TCTRL4_WR_WR_TI_DLY_SHIFT 21 -#define TCTRL4_RDWR_RD_PI_MORE_DLY 0x00000000001f0000 +#define TCTRL4_RDWR_RD_PI_MORE_DLY 0x00000000001f000UL0 #define TCTRL4_RDWR_RD_PI_MORE_DLY_SHIFT 16 -#define TCTRL4_R 0x0000000000008000 +#define TCTRL4_R 0x0000000000008000UL #define TCTRL4_R_SHIFT 15 -#define TCTRL4_SDRAM_MODE_REG_DATA 0x0000000000007fff +#define TCTRL4_SDRAM_MODE_REG_DATA 0x0000000000007fffUL #define TCTRL4_SDRAM_MODE_REG_DATA_SHIFT 0 /* All 4 memory address decoding registers have the * same layout. */ -#define MEM_DECODE_VALID 0x8000000000000000 /* Valid */ +#define MEM_DECODE_VALID 0x8000000000000000UL /* Valid */ #define MEM_DECODE_VALID_SHIFT 63 -#define MEM_DECODE_UK 0x001ffe0000000000 /* Upper mask */ +#define MEM_DECODE_UK 0x001ffe0000000000UL /* Upper mask */ #define MEM_DECODE_UK_SHIFT 41 -#define MEM_DECODE_UM 0x0000001ffff00000 /* Upper match */ +#define MEM_DECODE_UM 0x0000001ffff00000UL /* Upper match */ #define MEM_DECODE_UM_SHIFT 20 -#define MEM_DECODE_LK 0x000000000003c000 /* Lower mask */ +#define MEM_DECODE_LK 0x000000000003c000UL /* Lower mask */ #define MEM_DECODE_LK_SHIFT 14 -#define MEM_DECODE_LM 0x0000000000000f00 /* Lower match */ +#define MEM_DECODE_LM 0x0000000000000f00UL /* Lower match */ #define MEM_DECODE_LM_SHIFT 8 -#define PA_UPPER_BITS 0x000007fffc000000 +#define PA_UPPER_BITS 0x000007fffc000000UL #define PA_UPPER_BITS_SHIFT 26 -#define PA_LOWER_BITS 0x00000000000003c0 +#define PA_LOWER_BITS 0x00000000000003c0UL #define PA_LOWER_BITS_SHIFT 6 -#define MACTRL_R0 0x8000000000000000 +#define MACTRL_R0 0x8000000000000000UL #define MACTRL_R0_SHIFT 63 -#define MACTRL_ADDR_LE_PW 0x7000000000000000 +#define MACTRL_ADDR_LE_PW 0x7000000000000000UL #define MACTRL_ADDR_LE_PW_SHIFT 60 -#define MACTRL_CMD_PW 0x0f00000000000000 +#define MACTRL_CMD_PW 0x0f00000000000000UL #define MACTRL_CMD_PW_SHIFT 56 -#define MACTRL_HALF_MODE_WR_MSEL_DLY 0x00fc000000000000 +#define MACTRL_HALF_MODE_WR_MSEL_DLY 0x00fc000000000000UL #define MACTRL_HALF_MODE_WR_MSEL_DLY_SHIFT 50 -#define MACTRL_HALF_MODE_RD_MSEL_DLY 0x0003f00000000000 +#define MACTRL_HALF_MODE_RD_MSEL_DLY 0x0003f00000000000UL #define MACTRL_HALF_MODE_RD_MSEL_DLY_SHIFT 44 -#define MACTRL_HALF_MODE_SDRAM_CTL_DLY 0x00000f0000000000 +#define MACTRL_HALF_MODE_SDRAM_CTL_DLY 0x00000f0000000000UL #define MACTRL_HALF_MODE_SDRAM_CTL_DLY_SHIFT 40 -#define MACTRL_HALF_MODE_SDRAM_CLK_DLY 0x000000e000000000 +#define MACTRL_HALF_MODE_SDRAM_CLK_DLY 0x000000e000000000UL #define MACTRL_HALF_MODE_SDRAM_CLK_DLY_SHIFT 37 -#define MACTRL_R1 0x0000001000000000 +#define MACTRL_R1 0x0000001000000000UL #define MACTRL_R1_SHIFT 36 -#define MACTRL_BANKSEL_N_ROWADDR_SIZE_B3 0x0000000f00000000 +#define MACTRL_BANKSEL_N_ROWADDR_SIZE_B3 0x0000000f00000000UL #define MACTRL_BANKSEL_N_ROWADDR_SIZE_B3_SHIFT 32 -#define MACTRL_ENC_INTLV_B3 0x00000000f8000000 +#define MACTRL_ENC_INTLV_B3 0x00000000f8000000UL #define MACTRL_ENC_INTLV_B3_SHIFT 27 -#define MACTRL_BANKSEL_N_ROWADDR_SIZE_B2 0x0000000007800000 +#define MACTRL_BANKSEL_N_ROWADDR_SIZE_B2 0x0000000007800000UL #define MACTRL_BANKSEL_N_ROWADDR_SIZE_B2_SHIFT 23 -#define MACTRL_ENC_INTLV_B2 0x00000000007c0000 +#define MACTRL_ENC_INTLV_B2 0x00000000007c0000UL #define MACTRL_ENC_INTLV_B2_SHIFT 18 -#define MACTRL_BANKSEL_N_ROWADDR_SIZE_B1 0x000000000003c000 +#define MACTRL_BANKSEL_N_ROWADDR_SIZE_B1 0x000000000003c000UL #define MACTRL_BANKSEL_N_ROWADDR_SIZE_B1_SHIFT 14 -#define MACTRL_ENC_INTLV_B1 0x0000000000003e00 +#define MACTRL_ENC_INTLV_B1 0x0000000000003e00UL #define MACTRL_ENC_INTLV_B1_SHIFT 9 -#define MACTRL_BANKSEL_N_ROWADDR_SIZE_B0 0x00000000000001e0 +#define MACTRL_BANKSEL_N_ROWADDR_SIZE_B0 0x00000000000001e0UL #define MACTRL_BANKSEL_N_ROWADDR_SIZE_B0_SHIFT 5 -#define MACTRL_ENC_INTLV_B0 0x000000000000001f +#define MACTRL_ENC_INTLV_B0 0x000000000000001fUL #define MACTRL_ENC_INTLV_B0_SHIFT 0 #endif /* _SPARC64_CHMCTRL_H */ diff -urN linux-2.6.7-rc2/include/asm-sparc64/compat.h linux-2.6.7-rc3/include/asm-sparc64/compat.h --- linux-2.6.7-rc2/include/asm-sparc64/compat.h 2004-05-09 19:32:52.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-sparc64/compat.h 2004-06-07 12:55:22.052411244 -0700 @@ -116,12 +116,12 @@ */ typedef u32 compat_uptr_t; -static inline void *compat_ptr(compat_uptr_t uptr) +static inline void __user *compat_ptr(compat_uptr_t uptr) { - return (void *)(unsigned long)uptr; + return (void __user *)(unsigned long)uptr; } -static __inline__ void *compat_alloc_user_space(long len) +static __inline__ void __user *compat_alloc_user_space(long len) { struct pt_regs *regs = current_thread_info()->kregs; unsigned long usp = regs->u_regs[UREG_I6]; @@ -129,7 +129,7 @@ if (!(test_thread_flag(TIF_32BIT))) usp += STACK_BIAS; - return (void *) (usp - len); + return (void __user *) (usp - len); } #endif /* _ASM_SPARC64_COMPAT_H */ diff -urN linux-2.6.7-rc2/include/asm-sparc64/const.h linux-2.6.7-rc3/include/asm-sparc64/const.h --- linux-2.6.7-rc2/include/asm-sparc64/const.h 1969-12-31 16:00:00.000000000 -0800 +++ linux-2.6.7-rc3/include/asm-sparc64/const.h 2004-06-07 12:55:22.052411244 -0700 @@ -0,0 +1,19 @@ +/* const.h: Macros for dealing with constants. */ + +#ifndef _SPARC64_CONST_H +#define _SPARC64_CONST_H + +/* Some constant macros are used in both assembler and + * C code. Therefore we cannot annotate them always with + * 'UL' and other type specificers unilaterally. We + * use the following macros to deal with this. + */ + +#ifdef __ASSEMBLY__ +#define _AC(X,Y) X +#else +#define _AC(X,Y) (X##Y) +#endif + + +#endif /* !(_SPARC64_CONST_H) */ diff -urN linux-2.6.7-rc2/include/asm-sparc64/hardirq.h linux-2.6.7-rc3/include/asm-sparc64/hardirq.h --- linux-2.6.7-rc2/include/asm-sparc64/hardirq.h 2004-05-09 19:32:54.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-sparc64/hardirq.h 2004-06-07 12:55:22.053411285 -0700 @@ -56,15 +56,6 @@ #define HARDIRQ_OFFSET (1UL << HARDIRQ_SHIFT) /* - * The hardirq mask has to be large enough to have - * space for potentially all IRQ sources in the system - * nesting on a single CPU: - */ -#if (1 << HARDIRQ_BITS) < NR_IRQS -# error HARDIRQ_BITS is too low! -#endif - -/* * Are we doing bottom half or hardware interrupt processing? * Are we in a softirq context? Interrupt context? */ diff -urN linux-2.6.7-rc2/include/asm-sparc64/ide.h linux-2.6.7-rc3/include/asm-sparc64/ide.h --- linux-2.6.7-rc2/include/asm-sparc64/ide.h 2004-06-07 12:54:52.498187159 -0700 +++ linux-2.6.7-rc3/include/asm-sparc64/ide.h 2004-06-07 12:55:22.053411285 -0700 @@ -24,21 +24,9 @@ # endif #endif -static __inline__ int ide_default_irq(unsigned long base) -{ - return 0; -} - -static __inline__ unsigned long ide_default_io_base(int index) -{ - return 0; -} - #define IDE_ARCH_OBSOLETE_INIT #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ -#define ide_init_default_irq(base) (0) - #define __ide_insl(data_reg, buffer, wcount) \ __ide_insw(data_reg, buffer, (wcount)<<1) #define __ide_outsl(data_reg, buffer, wcount) \ diff -urN linux-2.6.7-rc2/include/asm-sparc64/iommu.h linux-2.6.7-rc3/include/asm-sparc64/iommu.h --- linux-2.6.7-rc2/include/asm-sparc64/iommu.h 2004-05-09 19:32:26.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-sparc64/iommu.h 2004-06-07 12:55:22.075412196 -0700 @@ -7,13 +7,13 @@ #define _SPARC64_IOMMU_H /* The format of an iopte in the page tables. */ -#define IOPTE_VALID 0x8000000000000000 /* IOPTE is valid */ -#define IOPTE_64K 0x2000000000000000 /* IOPTE is for 64k page */ -#define IOPTE_STBUF 0x1000000000000000 /* DVMA can use streaming buffer */ -#define IOPTE_INTRA 0x0800000000000000 /* SBUS slot-->slot direct transfer */ -#define IOPTE_CONTEXT 0x07ff800000000000 /* Context number */ -#define IOPTE_PAGE 0x00007fffffffe000 /* Physical page number (PA[42:13]) */ -#define IOPTE_CACHE 0x0000000000000010 /* Cached (in UPA E-cache) */ -#define IOPTE_WRITE 0x0000000000000002 /* Writeable */ +#define IOPTE_VALID 0x8000000000000000UL /* IOPTE is valid */ +#define IOPTE_64K 0x2000000000000000UL /* IOPTE is for 64k page */ +#define IOPTE_STBUF 0x1000000000000000UL /* DVMA can use streaming buffer */ +#define IOPTE_INTRA 0x0800000000000000UL /* SBUS slot-->slot direct transfer*/ +#define IOPTE_CONTEXT 0x07ff800000000000UL /* Context number */ +#define IOPTE_PAGE 0x00007fffffffe000UL /* Physical page number (PA[42:13])*/ +#define IOPTE_CACHE 0x0000000000000010UL /* Cached (in UPA E-cache) */ +#define IOPTE_WRITE 0x0000000000000002UL /* Writeable */ #endif /* !(_SPARC_IOMMU_H) */ diff -urN linux-2.6.7-rc2/include/asm-sparc64/lsu.h linux-2.6.7-rc3/include/asm-sparc64/lsu.h --- linux-2.6.7-rc2/include/asm-sparc64/lsu.h 2004-05-09 19:32:01.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-sparc64/lsu.h 2004-06-07 12:55:22.075412196 -0700 @@ -2,17 +2,19 @@ #ifndef _SPARC64_LSU_H #define _SPARC64_LSU_H +#include + /* LSU Control Register */ -#define LSU_CONTROL_PM 0x000001fe00000000 /* Phys-watchpoint byte mask */ -#define LSU_CONTROL_VM 0x00000001fe000000 /* Virt-watchpoint byte mask */ -#define LSU_CONTROL_PR 0x0000000001000000 /* Phys-read watchpoint enable */ -#define LSU_CONTROL_PW 0x0000000000800000 /* Phys-write watchpoint enable */ -#define LSU_CONTROL_VR 0x0000000000400000 /* Virt-read watchpoint enable */ -#define LSU_CONTROL_VW 0x0000000000200000 /* Virt-write watchpoint enable */ -#define LSU_CONTROL_FM 0x00000000000ffff0 /* Parity mask enables. */ -#define LSU_CONTROL_DM 0x0000000000000008 /* Data MMU enable. */ -#define LSU_CONTROL_IM 0x0000000000000004 /* Instruction MMU enable. */ -#define LSU_CONTROL_DC 0x0000000000000002 /* Data cache enable. */ -#define LSU_CONTROL_IC 0x0000000000000001 /* Instruction cache enable. */ +#define LSU_CONTROL_PM _AC(0x000001fe00000000,UL) /* Phys-watchpoint byte mask*/ +#define LSU_CONTROL_VM _AC(0x00000001fe000000,UL) /* Virt-watchpoint byte mask*/ +#define LSU_CONTROL_PR _AC(0x0000000001000000,UL) /* Phys-rd watchpoint enable*/ +#define LSU_CONTROL_PW _AC(0x0000000000800000,UL) /* Phys-wr watchpoint enable*/ +#define LSU_CONTROL_VR _AC(0x0000000000400000,UL) /* Virt-rd watchpoint enable*/ +#define LSU_CONTROL_VW _AC(0x0000000000200000,UL) /* Virt-wr watchpoint enable*/ +#define LSU_CONTROL_FM _AC(0x00000000000ffff0,UL) /* Parity mask enables. */ +#define LSU_CONTROL_DM _AC(0x0000000000000008,UL) /* Data MMU enable. */ +#define LSU_CONTROL_IM _AC(0x0000000000000004,UL) /* Instruction MMU enable. */ +#define LSU_CONTROL_DC _AC(0x0000000000000002,UL) /* Data cache enable. */ +#define LSU_CONTROL_IC _AC(0x0000000000000001,UL) /* Instruction cache enable.*/ #endif /* !(_SPARC64_LSU_H) */ diff -urN linux-2.6.7-rc2/include/asm-sparc64/page.h linux-2.6.7-rc3/include/asm-sparc64/page.h --- linux-2.6.7-rc2/include/asm-sparc64/page.h 2004-05-09 19:32:28.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-sparc64/page.h 2004-06-07 12:55:22.078412321 -0700 @@ -4,18 +4,12 @@ #define _SPARC64_PAGE_H #include +#include #define PAGE_SHIFT 13 -#ifndef __ASSEMBLY__ -/* I have my suspicions... -DaveM */ -#define PAGE_SIZE (1UL << PAGE_SHIFT) -#else -#define PAGE_SIZE (1 << PAGE_SHIFT) -#endif - +#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT) #define PAGE_MASK (~(PAGE_SIZE-1)) - #ifdef __KERNEL__ #ifndef __ASSEMBLY__ @@ -99,13 +93,13 @@ #endif #ifdef CONFIG_HUGETLB_PAGE -#define HPAGE_SIZE ((1UL) << HPAGE_SHIFT) +#define HPAGE_SIZE (_AC(1,UL) << HPAGE_SHIFT) #define HPAGE_MASK (~(HPAGE_SIZE - 1UL)) #define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) #endif #define TASK_UNMAPPED_BASE (test_thread_flag(TIF_32BIT) ? \ - (0x0000000070000000UL) : (PAGE_OFFSET)) + (_AC(0x0000000070000000,UL)) : (PAGE_OFFSET)) #endif /* !(__ASSEMBLY__) */ @@ -115,7 +109,7 @@ /* We used to stick this into a hard-coded global register (%g4) * but that does not make sense anymore. */ -#define PAGE_OFFSET 0xFFFFF80000000000 +#define PAGE_OFFSET _AC(0xFFFFF80000000000,UL) #define __pa(x) ((unsigned long)(x) - PAGE_OFFSET) #define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET)) diff -urN linux-2.6.7-rc2/include/asm-sparc64/pci.h linux-2.6.7-rc3/include/asm-sparc64/pci.h --- linux-2.6.7-rc2/include/asm-sparc64/pci.h 2004-05-09 19:32:01.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-sparc64/pci.h 2004-06-07 12:55:22.128414392 -0700 @@ -168,7 +168,7 @@ * can drive enough of the 64 bits. */ #define PCI64_REQUIRED_MASK (~(dma64_addr_t)0) -#define PCI64_ADDR_BASE 0xfffc000000000000 +#define PCI64_ADDR_BASE 0xfffc000000000000UL /* Usage of the pci_dac_foo interfaces is only valid if this * test passes. diff -urN linux-2.6.7-rc2/include/asm-sparc64/pgtable.h linux-2.6.7-rc3/include/asm-sparc64/pgtable.h --- linux-2.6.7-rc2/include/asm-sparc64/pgtable.h 2004-06-07 12:54:52.519188029 -0700 +++ linux-2.6.7-rc3/include/asm-sparc64/pgtable.h 2004-06-07 12:55:22.129414433 -0700 @@ -18,6 +18,7 @@ #include #include #include +#include /* The kernel image occupies 0x4000000 to 0x1000000 (4MB --> 16MB). * The page copy blockops use 0x1000000 to 0x18000000 (16MB --> 24MB). @@ -26,14 +27,14 @@ * There is a single static kernel PMD which maps from 0x0 to address * 0x400000000. */ -#define TLBTEMP_BASE 0x0000000001000000 -#define MODULES_VADDR 0x0000000002000000 -#define MODULES_LEN 0x000000007e000000 -#define MODULES_END 0x0000000080000000 -#define VMALLOC_START 0x0000000140000000 -#define VMALLOC_END 0x0000000200000000 -#define LOW_OBP_ADDRESS 0x00000000f0000000 -#define HI_OBP_ADDRESS 0x0000000100000000 +#define TLBTEMP_BASE _AC(0x0000000001000000,UL) +#define MODULES_VADDR _AC(0x0000000002000000,UL) +#define MODULES_LEN _AC(0x000000007e000000,UL) +#define MODULES_END _AC(0x0000000080000000,UL) +#define VMALLOC_START _AC(0x0000000140000000,UL) +#define VMALLOC_END _AC(0x0000000200000000,UL) +#define LOW_OBP_ADDRESS _AC(0x00000000f0000000,UL) +#define HI_OBP_ADDRESS _AC(0x0000000100000000,UL) /* XXX All of this needs to be rethought so we can take advantage * XXX cheetah's full 64-bit virtual address space, ie. no more hole @@ -49,7 +50,9 @@ * long). Finally, the higher few bits determine pgde#. */ -/* PMD_SHIFT determines the size of the area a second-level page table can map */ +/* PMD_SHIFT determines the size of the area a second-level page + * table can map + */ #define PMD_SHIFT (PAGE_SHIFT + (PAGE_SHIFT-3)) #define PMD_SIZE (1UL << PMD_SHIFT) #define PMD_MASK (~(PMD_SIZE-1)) @@ -78,7 +81,8 @@ */ #define REAL_PTRS_PER_PMD (1UL << PMD_BITS) #define PTRS_PER_PMD ((const int)(test_thread_flag(TIF_32BIT) ? \ - (1UL << (32 - (PAGE_SHIFT-3) - PAGE_SHIFT)) : (REAL_PTRS_PER_PMD))) + (1UL << (32 - (PAGE_SHIFT-3) - PAGE_SHIFT)) : \ + (REAL_PTRS_PER_PMD))) /* * We cannot use the top address range because VPTE table lives there. This @@ -86,9 +90,9 @@ * vpte size, then aligns it to the number of bytes mapped by one pgde, and * thus calculates the number of pgdes needed. */ -#define PTRS_PER_PGD (((1UL << VA_BITS) - VPTE_SIZE + (1UL << (PAGE_SHIFT + \ - (PAGE_SHIFT-3) + PMD_BITS)) - 1) / (1UL << (PAGE_SHIFT + \ - (PAGE_SHIFT-3) + PMD_BITS))) +#define PTRS_PER_PGD (((1UL << VA_BITS) - VPTE_SIZE + (1UL << (PAGE_SHIFT + \ + (PAGE_SHIFT-3) + PMD_BITS)) - 1) / (1UL << (PAGE_SHIFT + \ + (PAGE_SHIFT-3) + PMD_BITS))) /* Kernel has a separate 44bit address space. */ #define USER_PTRS_PER_PGD ((const int)(test_thread_flag(TIF_32BIT)) ? \ @@ -102,33 +106,33 @@ #endif /* !(__ASSEMBLY__) */ /* Spitfire/Cheetah TTE bits. */ -#define _PAGE_VALID 0x8000000000000000 /* Valid TTE */ -#define _PAGE_R 0x8000000000000000 /* Used to keep ref bit up to date */ -#define _PAGE_SZ4MB 0x6000000000000000 /* 4MB Page */ -#define _PAGE_SZ512K 0x4000000000000000 /* 512K Page */ -#define _PAGE_SZ64K 0x2000000000000000 /* 64K Page */ -#define _PAGE_SZ8K 0x0000000000000000 /* 8K Page */ -#define _PAGE_NFO 0x1000000000000000 /* No Fault Only */ -#define _PAGE_IE 0x0800000000000000 /* Invert Endianness */ -#define _PAGE_SN 0x0000800000000000 /* (Cheetah) Snoop */ -#define _PAGE_PADDR_SF 0x000001FFFFFFE000 /* (Spitfire) Phys Address [40:13] */ -#define _PAGE_PADDR 0x000007FFFFFFE000 /* (Cheetah) Phys Address [42:13] */ -#define _PAGE_SOFT 0x0000000000001F80 /* Software bits */ -#define _PAGE_L 0x0000000000000040 /* Locked TTE */ -#define _PAGE_CP 0x0000000000000020 /* Cacheable in Physical Cache */ -#define _PAGE_CV 0x0000000000000010 /* Cacheable in Virtual Cache */ -#define _PAGE_E 0x0000000000000008 /* side-Effect */ -#define _PAGE_P 0x0000000000000004 /* Privileged Page */ -#define _PAGE_W 0x0000000000000002 /* Writable */ -#define _PAGE_G 0x0000000000000001 /* Global */ +#define _PAGE_VALID _AC(0x8000000000000000,UL) /* Valid TTE */ +#define _PAGE_R _AC(0x8000000000000000,UL) /* Keep ref bit up to date */ +#define _PAGE_SZ4MB _AC(0x6000000000000000,UL) /* 4MB Page */ +#define _PAGE_SZ512K _AC(0x4000000000000000,UL) /* 512K Page */ +#define _PAGE_SZ64K _AC(0x2000000000000000,UL) /* 64K Page */ +#define _PAGE_SZ8K _AC(0x0000000000000000,UL) /* 8K Page */ +#define _PAGE_NFO _AC(0x1000000000000000,UL) /* No Fault Only */ +#define _PAGE_IE _AC(0x0800000000000000,UL) /* Invert Endianness */ +#define _PAGE_SN _AC(0x0000800000000000,UL) /* (Cheetah) Snoop */ +#define _PAGE_PADDR_SF _AC(0x000001FFFFFFE000,UL) /* (Spitfire) paddr [40:13]*/ +#define _PAGE_PADDR _AC(0x000007FFFFFFE000,UL) /* (Cheetah) paddr [42:13] */ +#define _PAGE_SOFT _AC(0x0000000000001F80,UL) /* Software bits */ +#define _PAGE_L _AC(0x0000000000000040,UL) /* Locked TTE */ +#define _PAGE_CP _AC(0x0000000000000020,UL) /* Cacheable in P-Cache */ +#define _PAGE_CV _AC(0x0000000000000010,UL) /* Cacheable in V-Cache */ +#define _PAGE_E _AC(0x0000000000000008,UL) /* side-Effect */ +#define _PAGE_P _AC(0x0000000000000004,UL) /* Privileged Page */ +#define _PAGE_W _AC(0x0000000000000002,UL) /* Writable */ +#define _PAGE_G _AC(0x0000000000000001,UL) /* Global */ /* Here are the SpitFire software bits we use in the TTE's. */ -#define _PAGE_FILE 0x0000000000001000 /* Pagecache page */ -#define _PAGE_MODIFIED 0x0000000000000800 /* Modified Page (ie. dirty) */ -#define _PAGE_ACCESSED 0x0000000000000400 /* Accessed Page (ie. referenced) */ -#define _PAGE_READ 0x0000000000000200 /* Readable SW Bit */ -#define _PAGE_WRITE 0x0000000000000100 /* Writable SW Bit */ -#define _PAGE_PRESENT 0x0000000000000080 /* Present Page (ie. not swapped out) */ +#define _PAGE_FILE _AC(0x0000000000001000,UL) /* Pagecache page */ +#define _PAGE_MODIFIED _AC(0x0000000000000800,UL) /* Modified (dirty) */ +#define _PAGE_ACCESSED _AC(0x0000000000000400,UL) /* Accessed (ref'd) */ +#define _PAGE_READ _AC(0x0000000000000200,UL) /* Readable SW Bit */ +#define _PAGE_WRITE _AC(0x0000000000000100,UL) /* Writable SW Bit */ +#define _PAGE_PRESENT _AC(0x0000000000000080,UL) /* Present */ #if PAGE_SHIFT == 13 #define _PAGE_SZBITS _PAGE_SZ8K @@ -173,7 +177,8 @@ #define _PFN_MASK _PAGE_PADDR -#define pg_iobits (_PAGE_VALID | _PAGE_PRESENT | __DIRTY_BITS | __ACCESS_BITS | _PAGE_E) +#define pg_iobits (_PAGE_VALID | _PAGE_PRESENT | __DIRTY_BITS | \ + __ACCESS_BITS | _PAGE_E) #define __P000 PAGE_NONE #define __P001 PAGE_READONLY @@ -260,9 +265,12 @@ #define pte_dirty(pte) (pte_val(pte) & _PAGE_MODIFIED) #define pte_young(pte) (pte_val(pte) & _PAGE_ACCESSED) #define pte_wrprotect(pte) (__pte(pte_val(pte) & ~(_PAGE_WRITE|_PAGE_W))) -#define pte_rdprotect(pte) (__pte(((pte_val(pte)<<1UL)>>1UL) & ~_PAGE_READ)) -#define pte_mkclean(pte) (__pte(pte_val(pte) & ~(_PAGE_MODIFIED|_PAGE_W))) -#define pte_mkold(pte) (__pte(((pte_val(pte)<<1UL)>>1UL) & ~_PAGE_ACCESSED)) +#define pte_rdprotect(pte) \ + (__pte(((pte_val(pte)<<1UL)>>1UL) & ~_PAGE_READ)) +#define pte_mkclean(pte) \ + (__pte(pte_val(pte) & ~(_PAGE_MODIFIED|_PAGE_W))) +#define pte_mkold(pte) \ + (__pte(((pte_val(pte)<<1UL)>>1UL) & ~_PAGE_ACCESSED)) /* Permanent address of a page. */ #define __page_address(page) page_address(page) @@ -280,12 +288,14 @@ #define pgd_offset_k(address) pgd_offset(&init_mm, address) /* Find an entry in the second-level page table.. */ -#define pmd_offset(dir, address) ((pmd_t *) pgd_page(*(dir)) + \ - ((address >> PMD_SHIFT) & (REAL_PTRS_PER_PMD-1))) +#define pmd_offset(dir, address) \ + ((pmd_t *) pgd_page(*(dir)) + \ + ((address >> PMD_SHIFT) & (REAL_PTRS_PER_PMD-1))) /* Find an entry in the third-level page table.. */ -#define pte_index(dir, address) ((pte_t *) __pmd_page(*(dir)) + \ - ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))) +#define pte_index(dir, address) \ + ((pte_t *) __pmd_page(*(dir)) + \ + ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))) #define pte_offset_kernel pte_index #define pte_offset_map pte_index #define pte_offset_map_nested pte_index @@ -305,7 +315,8 @@ static inline pte_t mk_pte_io(unsigned long page, pgprot_t prot, int space) { pte_t pte; - pte_val(pte) = ((page) | pgprot_val(prot) | _PAGE_E) & ~(unsigned long)_PAGE_CACHE; + pte_val(pte) = (((page) | pgprot_val(prot) | _PAGE_E) & + ~(unsigned long)_PAGE_CACHE); pte_val(pte) |= (((unsigned long)space) << 32); return pte; } @@ -365,7 +376,8 @@ #define kern_addr_valid(addr) \ (test_bit(__pa((unsigned long)(addr))>>22, sparc64_valid_addr_bitmap)) -extern int io_remap_page_range(struct vm_area_struct *vma, unsigned long from, unsigned long offset, +extern int io_remap_page_range(struct vm_area_struct *vma, unsigned long from, + unsigned long offset, unsigned long size, pgprot_t prot, int space); #include @@ -376,7 +388,9 @@ /* We provide a special get_unmapped_area for framebuffer mmaps to try and use * the largest alignment possible such that larget PTEs can be used. */ -extern unsigned long get_fb_unmapped_area(struct file *filp, unsigned long, unsigned long, unsigned long, unsigned long); +extern unsigned long get_fb_unmapped_area(struct file *filp, unsigned long, + unsigned long, unsigned long, + unsigned long); #define HAVE_ARCH_FB_UNMAPPED_AREA /* diff -urN linux-2.6.7-rc2/include/asm-sparc64/pstate.h linux-2.6.7-rc3/include/asm-sparc64/pstate.h --- linux-2.6.7-rc2/include/asm-sparc64/pstate.h 2004-05-09 19:33:21.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-sparc64/pstate.h 2004-06-07 12:55:22.141414930 -0700 @@ -2,6 +2,8 @@ #ifndef _SPARC64_PSTATE_H #define _SPARC64_PSTATE_H +#include + /* The V9 PSTATE Register (with SpitFire extensions). * * ----------------------------------------------------------------------- @@ -9,20 +11,20 @@ * ----------------------------------------------------------------------- * 63 12 11 10 9 8 7 6 5 4 3 2 1 0 */ -#define PSTATE_IG 0x0000000000000800 /* Interrupt Globals. */ -#define PSTATE_MG 0x0000000000000400 /* MMU Globals. */ -#define PSTATE_CLE 0x0000000000000200 /* Current Little Endian. */ -#define PSTATE_TLE 0x0000000000000100 /* Trap Little Endian. */ -#define PSTATE_MM 0x00000000000000c0 /* Memory Model. */ -#define PSTATE_TSO 0x0000000000000000 /* MM: Total Store Order */ -#define PSTATE_PSO 0x0000000000000040 /* MM: Partial Store Order */ -#define PSTATE_RMO 0x0000000000000080 /* MM: Relaxed Memory Order */ -#define PSTATE_RED 0x0000000000000020 /* Reset Error Debug State. */ -#define PSTATE_PEF 0x0000000000000010 /* Floating Point Enable. */ -#define PSTATE_AM 0x0000000000000008 /* Address Mask. */ -#define PSTATE_PRIV 0x0000000000000004 /* Privilege. */ -#define PSTATE_IE 0x0000000000000002 /* Interrupt Enable. */ -#define PSTATE_AG 0x0000000000000001 /* Alternate Globals. */ +#define PSTATE_IG _AC(0x0000000000000800,UL) /* Interrupt Globals. */ +#define PSTATE_MG _AC(0x0000000000000400,UL) /* MMU Globals. */ +#define PSTATE_CLE _AC(0x0000000000000200,UL) /* Current Little Endian.*/ +#define PSTATE_TLE _AC(0x0000000000000100,UL) /* Trap Little Endian. */ +#define PSTATE_MM _AC(0x00000000000000c0,UL) /* Memory Model. */ +#define PSTATE_TSO _AC(0x0000000000000000,UL) /* MM: TotalStoreOrder */ +#define PSTATE_PSO _AC(0x0000000000000040,UL) /* MM: PartialStoreOrder */ +#define PSTATE_RMO _AC(0x0000000000000080,UL) /* MM: RelaxedMemoryOrder*/ +#define PSTATE_RED _AC(0x0000000000000020,UL) /* Reset Error Debug. */ +#define PSTATE_PEF _AC(0x0000000000000010,UL) /* Floating Point Enable.*/ +#define PSTATE_AM _AC(0x0000000000000008,UL) /* Address Mask. */ +#define PSTATE_PRIV _AC(0x0000000000000004,UL) /* Privilege. */ +#define PSTATE_IE _AC(0x0000000000000002,UL) /* Interrupt Enable. */ +#define PSTATE_AG _AC(0x0000000000000001,UL) /* Alternate Globals. */ /* The V9 TSTATE Register (with SpitFire and Linux extensions). * @@ -31,35 +33,35 @@ * --------------------------------------------------------------- * 63 40 39 32 31 24 23 20 19 8 7 5 4 0 */ -#define TSTATE_CCR 0x000000ff00000000 /* Condition Codes. */ -#define TSTATE_XCC 0x000000f000000000 /* Condition Codes. */ -#define TSTATE_XNEG 0x0000008000000000 /* %xcc Negative. */ -#define TSTATE_XZERO 0x0000004000000000 /* %xcc Zero. */ -#define TSTATE_XOVFL 0x0000002000000000 /* %xcc Overflow. */ -#define TSTATE_XCARRY 0x0000001000000000 /* %xcc Carry. */ -#define TSTATE_ICC 0x0000000f00000000 /* Condition Codes. */ -#define TSTATE_INEG 0x0000000800000000 /* %icc Negative. */ -#define TSTATE_IZERO 0x0000000400000000 /* %icc Zero. */ -#define TSTATE_IOVFL 0x0000000200000000 /* %icc Overflow. */ -#define TSTATE_ICARRY 0x0000000100000000 /* %icc Carry. */ -#define TSTATE_ASI 0x00000000ff000000 /* Address Space Identifier. */ -#define TSTATE_PIL 0x0000000000f00000 /* %pil (Linux traps set this) */ -#define TSTATE_PSTATE 0x00000000000fff00 /* PSTATE. */ -#define TSTATE_IG 0x0000000000080000 /* Interrupt Globals. */ -#define TSTATE_MG 0x0000000000040000 /* MMU Globals. */ -#define TSTATE_CLE 0x0000000000020000 /* Current Little Endian. */ -#define TSTATE_TLE 0x0000000000010000 /* Trap Little Endian. */ -#define TSTATE_MM 0x000000000000c000 /* Memory Model. */ -#define TSTATE_TSO 0x0000000000000000 /* MM: Total Store Order */ -#define TSTATE_PSO 0x0000000000004000 /* MM: Partial Store Order */ -#define TSTATE_RMO 0x0000000000008000 /* MM: Relaxed Memory Order */ -#define TSTATE_RED 0x0000000000002000 /* Reset Error Debug State. */ -#define TSTATE_PEF 0x0000000000001000 /* Floating Point Enable. */ -#define TSTATE_AM 0x0000000000000800 /* Address Mask. */ -#define TSTATE_PRIV 0x0000000000000400 /* Privilege. */ -#define TSTATE_IE 0x0000000000000200 /* Interrupt Enable. */ -#define TSTATE_AG 0x0000000000000100 /* Alternate Globals. */ -#define TSTATE_CWP 0x000000000000001f /* Current Window Pointer. */ +#define TSTATE_CCR _AC(0x000000ff00000000,UL) /* Condition Codes. */ +#define TSTATE_XCC _AC(0x000000f000000000,UL) /* Condition Codes. */ +#define TSTATE_XNEG _AC(0x0000008000000000,UL) /* %xcc Negative. */ +#define TSTATE_XZERO _AC(0x0000004000000000,UL) /* %xcc Zero. */ +#define TSTATE_XOVFL _AC(0x0000002000000000,UL) /* %xcc Overflow. */ +#define TSTATE_XCARRY _AC(0x0000001000000000,UL) /* %xcc Carry. */ +#define TSTATE_ICC _AC(0x0000000f00000000,UL) /* Condition Codes. */ +#define TSTATE_INEG _AC(0x0000000800000000,UL) /* %icc Negative. */ +#define TSTATE_IZERO _AC(0x0000000400000000,UL) /* %icc Zero. */ +#define TSTATE_IOVFL _AC(0x0000000200000000,UL) /* %icc Overflow. */ +#define TSTATE_ICARRY _AC(0x0000000100000000,UL) /* %icc Carry. */ +#define TSTATE_ASI _AC(0x00000000ff000000,UL) /* AddrSpace ID. */ +#define TSTATE_PIL _AC(0x0000000000f00000,UL) /* %pil (Linux traps)*/ +#define TSTATE_PSTATE _AC(0x00000000000fff00,UL) /* PSTATE. */ +#define TSTATE_IG _AC(0x0000000000080000,UL) /* Interrupt Globals.*/ +#define TSTATE_MG _AC(0x0000000000040000,UL) /* MMU Globals. */ +#define TSTATE_CLE _AC(0x0000000000020000,UL) /* CurrLittleEndian. */ +#define TSTATE_TLE _AC(0x0000000000010000,UL) /* TrapLittleEndian. */ +#define TSTATE_MM _AC(0x000000000000c000,UL) /* Memory Model. */ +#define TSTATE_TSO _AC(0x0000000000000000,UL) /* MM: TSO */ +#define TSTATE_PSO _AC(0x0000000000004000,UL) /* MM: PSO */ +#define TSTATE_RMO _AC(0x0000000000008000,UL) /* MM: RMO */ +#define TSTATE_RED _AC(0x0000000000002000,UL) /* Reset Error Debug.*/ +#define TSTATE_PEF _AC(0x0000000000001000,UL) /* FPU Enable. */ +#define TSTATE_AM _AC(0x0000000000000800,UL) /* Address Mask. */ +#define TSTATE_PRIV _AC(0x0000000000000400,UL) /* Privilege. */ +#define TSTATE_IE _AC(0x0000000000000200,UL) /* Interrupt Enable. */ +#define TSTATE_AG _AC(0x0000000000000100,UL) /* Alternate Globals.*/ +#define TSTATE_CWP _AC(0x000000000000001f,UL) /* Curr Win-Pointer. */ /* Floating-Point Registers State Register. * @@ -68,9 +70,9 @@ * -------------------------------- * 63 3 2 1 0 */ -#define FPRS_FEF 0x0000000000000004 /* Enable Floating Point. */ -#define FPRS_DU 0x0000000000000002 /* Dirty Upper. */ -#define FPRS_DL 0x0000000000000001 /* Dirty Lower. */ +#define FPRS_FEF _AC(0x0000000000000004,UL) /* FPU Enable. */ +#define FPRS_DU _AC(0x0000000000000002,UL) /* Dirty Upper. */ +#define FPRS_DL _AC(0x0000000000000001,UL) /* Dirty Lower. */ /* Version Register. * @@ -79,10 +81,10 @@ * ------------------------------------------------------ * 63 48 47 32 31 24 23 16 15 8 7 5 4 0 */ -#define VERS_MANUF 0xffff000000000000 /* Manufacturer. */ -#define VERS_IMPL 0x0000ffff00000000 /* Implementation. */ -#define VERS_MASK 0x00000000ff000000 /* Mask Set Revision. */ -#define VERS_MAXTL 0x000000000000ff00 /* Maximum Trap Level. */ -#define VERS_MAXWIN 0x000000000000001f /* Maximum Reg Window Index. */ +#define VERS_MANUF _AC(0xffff000000000000,UL) /* Manufacturer. */ +#define VERS_IMPL _AC(0x0000ffff00000000,UL) /* Implementation. */ +#define VERS_MASK _AC(0x00000000ff000000,UL) /* Mask Set Revision.*/ +#define VERS_MAXTL _AC(0x000000000000ff00,UL) /* Max Trap Level. */ +#define VERS_MAXWIN _AC(0x000000000000001f,UL) /* Max RegWindow Idx.*/ #endif /* !(_SPARC64_PSTATE_H) */ diff -urN linux-2.6.7-rc2/include/asm-sparc64/sbus.h linux-2.6.7-rc3/include/asm-sparc64/sbus.h --- linux-2.6.7-rc2/include/asm-sparc64/sbus.h 2004-05-09 19:32:02.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-sparc64/sbus.h 2004-06-07 12:55:22.167416007 -0700 @@ -7,6 +7,7 @@ #ifndef _SPARC64_SBUS_H #define _SPARC64_SBUS_H +#include #include #include @@ -99,10 +100,10 @@ extern void *sbus_alloc_consistent(struct sbus_dev *, size_t, dma_addr_t *dma_addrp); extern void sbus_free_consistent(struct sbus_dev *, size_t, void *, dma_addr_t); -#define SBUS_DMA_BIDIRECTIONAL 0 -#define SBUS_DMA_TODEVICE 1 -#define SBUS_DMA_FROMDEVICE 2 -#define SBUS_DMA_NONE 3 +#define SBUS_DMA_BIDIRECTIONAL DMA_BIDIRECTIONAL +#define SBUS_DMA_TODEVICE DMA_TO_DEVICE +#define SBUS_DMA_FROMDEVICE DMA_FROM_DEVICE +#define SBUS_DMA_NONE DMA_NONE /* All the rest use streaming mode mappings. */ extern dma_addr_t sbus_map_single(struct sbus_dev *, void *, size_t, int); diff -urN linux-2.6.7-rc2/include/asm-sparc64/siginfo.h linux-2.6.7-rc3/include/asm-sparc64/siginfo.h --- linux-2.6.7-rc2/include/asm-sparc64/siginfo.h 2004-05-09 19:32:54.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-sparc64/siginfo.h 2004-06-07 12:55:22.186416794 -0700 @@ -99,7 +99,7 @@ } _sigev_un; } sigevent_t32; -extern int copy_siginfo_to_user32(siginfo_t32 *to, siginfo_t *from); +extern int copy_siginfo_to_user32(siginfo_t32 __user *to, siginfo_t *from); #endif /* __KERNEL__ */ diff -urN linux-2.6.7-rc2/include/asm-sparc64/signal.h linux-2.6.7-rc3/include/asm-sparc64/signal.h --- linux-2.6.7-rc2/include/asm-sparc64/signal.h 2004-06-07 12:54:52.533188609 -0700 +++ linux-2.6.7-rc3/include/asm-sparc64/signal.h 2004-06-07 12:55:22.207417664 -0700 @@ -212,7 +212,7 @@ struct k_sigaction { struct __new_sigaction sa; - void *ka_restorer; + void __user *ka_restorer; }; #endif diff -urN linux-2.6.7-rc2/include/asm-sparc64/thread_info.h linux-2.6.7-rc3/include/asm-sparc64/thread_info.h --- linux-2.6.7-rc2/include/asm-sparc64/thread_info.h 2004-05-09 19:32:54.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-sparc64/thread_info.h 2004-06-07 12:55:22.208417705 -0700 @@ -56,7 +56,8 @@ unsigned long gsr[7]; unsigned long xfsr[7]; - __u64 *user_cntd0, *user_cntd1; + __u64 __user *user_cntd0; + __u64 __user *user_cntd1; __u64 kernel_cntd0, kernel_cntd1; __u64 pcr_reg; diff -urN linux-2.6.7-rc2/include/asm-sparc64/uaccess.h linux-2.6.7-rc3/include/asm-sparc64/uaccess.h --- linux-2.6.7-rc2/include/asm-sparc64/uaccess.h 2004-05-09 19:32:28.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-sparc64/uaccess.h 2004-06-07 12:55:22.210417788 -0700 @@ -101,10 +101,12 @@ */ #define put_user(x,ptr) ({ \ unsigned long __pu_addr = (unsigned long)(ptr); \ +__chk_user_ptr(ptr); \ __put_user_nocheck((__typeof__(*(ptr)))(x),__pu_addr,sizeof(*(ptr))); }) #define get_user(x,ptr) ({ \ unsigned long __gu_addr = (unsigned long)(ptr); \ +__chk_user_ptr(ptr); \ __get_user_nocheck((x),__gu_addr,sizeof(*(ptr)),__typeof__(*(ptr))); }) #define __put_user(x,ptr) put_user(x,ptr) @@ -163,7 +165,7 @@ ".previous\n\n\t" \ : "=r" (foo) : "r" (x), "r" (__m(addr))); \ else \ -__asm__ __volatile( \ +__asm__ __volatile__( \ "/* Put user asm ret, inline. */\n" \ "1:\t" "st"#size "a %1, [%2] %%asi\n\n\t" \ ".section .fixup,#alloc,#execinstr\n\t" \ @@ -263,12 +265,12 @@ #define copy_to_user __copy_to_user #define copy_in_user __copy_in_user -extern unsigned long __bzero_noasi(void *, unsigned long); +extern unsigned long __bzero_noasi(void __user *, unsigned long); static inline unsigned long __clear_user(void __user *addr, unsigned long size) { - return __bzero_noasi((void *) addr, size); + return __bzero_noasi(addr, size); } #define clear_user __clear_user diff -urN linux-2.6.7-rc2/include/asm-sparc64/unistd.h linux-2.6.7-rc3/include/asm-sparc64/unistd.h --- linux-2.6.7-rc2/include/asm-sparc64/unistd.h 2004-06-07 12:54:52.536188733 -0700 +++ linux-2.6.7-rc3/include/asm-sparc64/unistd.h 2004-06-07 12:55:22.211417830 -0700 @@ -446,7 +446,6 @@ static __inline__ _syscall3(int,execve,__const__ char *,file,char **,argv,char **,envp) static __inline__ _syscall3(int,open,__const__ char *,file,int,flag,int,mode) static __inline__ _syscall1(int,close,int,fd) -static __inline__ _syscall1(int,_exit,int,exitcode) static __inline__ _syscall3(pid_t,waitpid,pid_t,pid,int *,wait_stat,int,options) #include diff -urN linux-2.6.7-rc2/include/asm-x86_64/bitops.h linux-2.6.7-rc3/include/asm-x86_64/bitops.h --- linux-2.6.7-rc2/include/asm-x86_64/bitops.h 2004-06-07 12:54:52.699195484 -0700 +++ linux-2.6.7-rc3/include/asm-x86_64/bitops.h 2004-06-07 12:55:22.461428185 -0700 @@ -337,16 +337,15 @@ "repe; scasl\n\t" "jz 1f\n\t" "leaq -4(%%rdi),%%rdi\n\t" - "bsfq (%%rdi),%%rax\n" - "1:\tsubl %%ebx,%%edi\n\t" + "bsfl (%%rdi),%%eax\n" + "1:\tsubq %%rbx,%%rdi\n\t" "shll $3,%%edi\n\t" "addl %%edi,%%eax" :"=a" (res), "=&c" (d0), "=&D" (d1) - :"1" ((size + 31) >> 5), "2" (addr), "b" (addr)); + :"1" ((size + 31) >> 5), "2" (addr), "b" (addr) : "memory"); return res; } - /** * find_next_bit - find the first set bit in a memory region * @addr: The address to base the search on diff -urN linux-2.6.7-rc2/include/asm-x86_64/checksum.h linux-2.6.7-rc3/include/asm-x86_64/checksum.h --- linux-2.6.7-rc2/include/asm-x86_64/checksum.h 2004-05-09 19:32:54.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-x86_64/checksum.h 2004-06-07 12:55:22.500429801 -0700 @@ -139,9 +139,9 @@ int *src_err_ptr, int *dst_err_ptr); -extern unsigned int csum_partial_copy_from_user(const char *src, char *dst, +extern unsigned int csum_partial_copy_from_user(const char __user *src, char *dst, int len, unsigned int isum, int *errp); -extern unsigned int csum_partial_copy_to_user(const char *src, char *dst, +extern unsigned int csum_partial_copy_to_user(const char *src, char __user *dst, int len, unsigned int isum, int *errp); extern unsigned int csum_partial_copy_nocheck(const char *src, char *dst, int len, unsigned int sum); diff -urN linux-2.6.7-rc2/include/asm-x86_64/compat.h linux-2.6.7-rc3/include/asm-x86_64/compat.h --- linux-2.6.7-rc2/include/asm-x86_64/compat.h 2004-05-09 19:32:54.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-x86_64/compat.h 2004-06-07 12:55:22.500429801 -0700 @@ -186,15 +186,15 @@ */ typedef u32 compat_uptr_t; -static inline void *compat_ptr(compat_uptr_t uptr) +static inline void __user *compat_ptr(compat_uptr_t uptr) { - return (void *)(unsigned long)uptr; + return (void __user *)(unsigned long)uptr; } -static __inline__ void *compat_alloc_user_space(long len) +static __inline__ void __user *compat_alloc_user_space(long len) { struct pt_regs *regs = (void *)current->thread.rsp0 - sizeof(struct pt_regs); - return (void *)regs->rsp - len; + return (void __user *)regs->rsp - len; } #endif /* _ASM_X86_64_COMPAT_H */ diff -urN linux-2.6.7-rc2/include/asm-x86_64/desc.h linux-2.6.7-rc3/include/asm-x86_64/desc.h --- linux-2.6.7-rc2/include/asm-x86_64/desc.h 2004-05-09 19:33:22.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-x86_64/desc.h 2004-06-07 12:55:22.505430008 -0700 @@ -118,7 +118,6 @@ d.base1 = PTR_MIDDLE(tss) & 0xFF; d.type = type; d.p = 1; - d.g = 1; d.limit1 = (size >> 16) & 0xF; d.base2 = (PTR_MIDDLE(tss) >> 8) & 0xFF; d.base3 = PTR_HIGH(tss); @@ -135,7 +134,7 @@ static inline void set_ldt_desc(unsigned cpu, void *addr, int size) { set_tssldt_descriptor(&cpu_gdt_table[cpu][GDT_ENTRY_LDT], (unsigned long)addr, - DESC_LDT, size); + DESC_LDT, size * 8); } static inline void set_seg_base(unsigned cpu, int entry, void *base) diff -urN linux-2.6.7-rc2/include/asm-x86_64/floppy.h linux-2.6.7-rc3/include/asm-x86_64/floppy.h --- linux-2.6.7-rc2/include/asm-x86_64/floppy.h 2004-05-09 19:32:26.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-x86_64/floppy.h 2004-06-07 12:55:22.505430008 -0700 @@ -170,7 +170,7 @@ static void _fd_dma_mem_free(unsigned long addr, unsigned long size) { if((unsigned long) addr >= (unsigned long) high_memory) - return vfree((void *)addr); + vfree((void *)addr); else free_pages(addr, get_order(size)); } diff -urN linux-2.6.7-rc2/include/asm-x86_64/fpu32.h linux-2.6.7-rc3/include/asm-x86_64/fpu32.h --- linux-2.6.7-rc2/include/asm-x86_64/fpu32.h 2004-05-09 19:32:38.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-x86_64/fpu32.h 2004-06-07 12:55:22.549431830 -0700 @@ -3,8 +3,8 @@ struct _fpstate_ia32; -int restore_i387_ia32(struct task_struct *tsk, struct _fpstate_ia32 *buf, int fsave); -int save_i387_ia32(struct task_struct *tsk, struct _fpstate_ia32 *buf, +int restore_i387_ia32(struct task_struct *tsk, struct _fpstate_ia32 __user *buf, int fsave); +int save_i387_ia32(struct task_struct *tsk, struct _fpstate_ia32 __user *buf, struct pt_regs *regs, int fsave); #endif diff -urN linux-2.6.7-rc2/include/asm-x86_64/i387.h linux-2.6.7-rc3/include/asm-x86_64/i387.h --- linux-2.6.7-rc2/include/asm-x86_64/i387.h 2004-05-09 19:32:37.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-x86_64/i387.h 2004-06-07 12:55:22.553431996 -0700 @@ -23,7 +23,7 @@ extern unsigned int mxcsr_feature_mask; extern void mxcsr_feature_mask_init(void); extern void init_fpu(struct task_struct *child); -extern int save_i387(struct _fpstate *buf); +extern int save_i387(struct _fpstate __user *buf); static inline int need_signal_i387(struct task_struct *me) { @@ -57,10 +57,10 @@ /* * ptrace request handers... */ -extern int get_fpregs(struct user_i387_struct *buf, +extern int get_fpregs(struct user_i387_struct __user *buf, struct task_struct *tsk); extern int set_fpregs(struct task_struct *tsk, - struct user_i387_struct *buf); + struct user_i387_struct __user *buf); /* * i387 state interaction @@ -93,7 +93,7 @@ return err; } -static inline int save_i387_checking(struct i387_fxsave_struct *fx) +static inline int save_i387_checking(struct i387_fxsave_struct __user *fx) { int err; asm volatile("1: rex64 ; fxsave (%[fx])\n\t" @@ -136,7 +136,7 @@ /* * This restores directly out of user space. Exceptions are handled. */ -static inline int restore_i387(struct _fpstate *buf) +static inline int restore_i387(struct _fpstate __user *buf) { return restore_fpu_checking((struct i387_fxsave_struct *)buf); } diff -urN linux-2.6.7-rc2/include/asm-x86_64/ia32.h linux-2.6.7-rc3/include/asm-x86_64/ia32.h --- linux-2.6.7-rc2/include/asm-x86_64/ia32.h 2004-05-09 19:33:19.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-x86_64/ia32.h 2004-06-07 12:55:22.554432038 -0700 @@ -168,8 +168,8 @@ #ifdef __KERNEL__ struct user_desc; struct siginfo_t; -int do_get_thread_area(struct thread_struct *t, struct user_desc *u_info); -int do_set_thread_area(struct thread_struct *t, struct user_desc *u_info); +int do_get_thread_area(struct thread_struct *t, struct user_desc __user *info); +int do_set_thread_area(struct thread_struct *t, struct user_desc __user *info); int ia32_child_tls(struct task_struct *p, struct pt_regs *childregs); int ia32_copy_siginfo_from_user(siginfo_t *to, siginfo_t32 __user *from); int ia32_copy_siginfo_to_user(siginfo_t32 __user *to, siginfo_t *from); diff -urN linux-2.6.7-rc2/include/asm-x86_64/ia32_unistd.h linux-2.6.7-rc3/include/asm-x86_64/ia32_unistd.h --- linux-2.6.7-rc2/include/asm-x86_64/ia32_unistd.h 2004-05-09 19:32:52.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-x86_64/ia32_unistd.h 2004-06-07 12:55:22.555432079 -0700 @@ -288,7 +288,8 @@ #define __NR_ia32_mq_timedreceive (__NR_ia32_mq_open+3) #define __NR_ia32_mq_notify (__NR_ia32_mq_open+4) #define __NR_ia32_mq_getsetattr (__NR_ia32_mq_open+5) +#define __NR_ia32_kexec 283 -#define IA32_NR_syscalls 285 /* must be > than biggest syscall! */ +#define IA32_NR_syscalls 287 /* must be > than biggest syscall! */ #endif /* _ASM_X86_64_IA32_UNISTD_H_ */ diff -urN linux-2.6.7-rc2/include/asm-x86_64/ide.h linux-2.6.7-rc3/include/asm-x86_64/ide.h --- linux-2.6.7-rc2/include/asm-x86_64/ide.h 2004-06-07 12:54:52.699195484 -0700 +++ linux-2.6.7-rc3/include/asm-x86_64/ide.h 2004-06-07 12:55:22.555432079 -0700 @@ -1,67 +1 @@ -/* - * linux/include/asm-x86_64/ide.h - * - * Copyright (C) 1994-1996 Linus Torvalds & authors - */ - -/* - * This file contains the x86_64 architecture specific IDE code. - */ - -#ifndef __ASMx86_64_IDE_H -#define __ASMx86_64_IDE_H - -#ifdef __KERNEL__ - -#include - -#ifndef MAX_HWIFS -# ifdef CONFIG_BLK_DEV_IDEPCI -#define MAX_HWIFS 10 -# else -#define MAX_HWIFS 6 -# endif -#endif - -static __inline__ int ide_default_irq(unsigned long base) -{ - switch (base) { - case 0x1f0: return 14; - case 0x170: return 15; - case 0x1e8: return 11; - case 0x168: return 10; - case 0x1e0: return 8; - case 0x160: return 12; - default: - return 0; - } -} - -static __inline__ unsigned long ide_default_io_base(int index) -{ - switch (index) { - case 0: return 0x1f0; - case 1: return 0x170; - case 2: return 0x1e8; - case 3: return 0x168; - case 4: return 0x1e0; - case 5: return 0x160; - default: - return 0; - } -} - -#define IDE_ARCH_OBSOLETE_INIT -#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ - -#ifdef CONFIG_BLK_DEV_IDEPCI -#define ide_init_default_irq(base) (0) -#else -#define ide_init_default_irq(base) ide_default_irq(base) -#endif - -#include - -#endif /* __KERNEL__ */ - -#endif /* __ASMx86_64_IDE_H */ +#include diff -urN linux-2.6.7-rc2/include/asm-x86_64/io.h linux-2.6.7-rc3/include/asm-x86_64/io.h --- linux-2.6.7-rc2/include/asm-x86_64/io.h 2004-05-09 19:32:28.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-x86_64/io.h 2004-06-07 12:55:22.556432120 -0700 @@ -195,8 +195,13 @@ #define __raw_writel writel #define __raw_writeq writeq -void *memcpy_fromio(void*,const void*,unsigned); -void *memcpy_toio(void*,const void*,unsigned); +void *__memcpy_fromio(void*,unsigned long,unsigned); +void *__memcpy_toio(unsigned long,const void*,unsigned); + +#define memcpy_fromio(to,from,len) \ + __memcpy_fromio((to),(unsigned long)(from),(len)) +#define memcpy_toio(to,from,len) \ + __memcpy_toio((unsigned long)(to),(from),(len)) #define memset_io(a,b,c) memset((void *)(a),(b),(c)) /* diff -urN linux-2.6.7-rc2/include/asm-x86_64/msr.h linux-2.6.7-rc3/include/asm-x86_64/msr.h --- linux-2.6.7-rc2/include/asm-x86_64/msr.h 2004-05-09 19:33:19.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-x86_64/msr.h 2004-06-07 12:55:22.563432410 -0700 @@ -143,8 +143,8 @@ #define _EFER_NX 11 /* No execute enable */ #define EFER_SCE (1<<_EFER_SCE) -#define EFER_LME (1<> 1) & 0x3f) #define __swp_offset(x) ((x).val >> 8) diff -urN linux-2.6.7-rc2/include/asm-x86_64/processor.h linux-2.6.7-rc3/include/asm-x86_64/processor.h --- linux-2.6.7-rc2/include/asm-x86_64/processor.h 2004-06-07 12:54:52.701195567 -0700 +++ linux-2.6.7-rc3/include/asm-x86_64/processor.h 2004-06-07 12:55:22.579433073 -0700 @@ -166,7 +166,7 @@ /* * User space process size: 512GB - 1GB (default). */ -#define TASK_SIZE (0x0000007fc0000000) +#define TASK_SIZE (0x0000007fc0000000UL) /* This decides where the kernel will search for a free chunk of vm * space during mmap's. diff -urN linux-2.6.7-rc2/include/asm-x86_64/ptrace.h linux-2.6.7-rc3/include/asm-x86_64/ptrace.h --- linux-2.6.7-rc2/include/asm-x86_64/ptrace.h 2004-05-09 19:32:27.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-x86_64/ptrace.h 2004-06-07 12:55:22.580433115 -0700 @@ -83,7 +83,7 @@ #if defined(__KERNEL__) && !defined(__ASSEMBLY__) #define user_mode(regs) (!!((regs)->cs & 3)) #define instruction_pointer(regs) ((regs)->rip) -void signal_fault(struct pt_regs *regs, void *frame, char *where); +void signal_fault(struct pt_regs *regs, void __user *frame, char *where); enum { EF_CF = 0x00000001, diff -urN linux-2.6.7-rc2/include/asm-x86_64/semaphore.h linux-2.6.7-rc3/include/asm-x86_64/semaphore.h --- linux-2.6.7-rc2/include/asm-x86_64/semaphore.h 2004-05-09 19:31:56.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-x86_64/semaphore.h 2004-06-07 12:55:22.596433777 -0700 @@ -47,12 +47,12 @@ atomic_t count; int sleepers; wait_queue_head_t wait; -#if WAITQUEUE_DEBUG +#ifdef WAITQUEUE_DEBUG long __magic; #endif }; -#if WAITQUEUE_DEBUG +#ifdef WAITQUEUE_DEBUG # define __SEM_DEBUG_INIT(name) \ , (int)&(name).__magic #else @@ -83,7 +83,7 @@ atomic_set(&sem->count, val); sem->sleepers = 0; init_waitqueue_head(&sem->wait); -#if WAITQUEUE_DEBUG +#ifdef WAITQUEUE_DEBUG sem->__magic = (int)&sem->__magic; #endif } @@ -115,7 +115,7 @@ */ static inline void down(struct semaphore * sem) { -#if WAITQUEUE_DEBUG +#ifdef WAITQUEUE_DEBUG CHECK_MAGIC(sem->__magic); #endif might_sleep(); @@ -142,7 +142,7 @@ { int result; -#if WAITQUEUE_DEBUG +#ifdef WAITQUEUE_DEBUG CHECK_MAGIC(sem->__magic); #endif might_sleep(); @@ -171,7 +171,7 @@ { int result; -#if WAITQUEUE_DEBUG +#ifdef WAITQUEUE_DEBUG CHECK_MAGIC(sem->__magic); #endif @@ -199,7 +199,7 @@ */ static inline void up(struct semaphore * sem) { -#if WAITQUEUE_DEBUG +#ifdef WAITQUEUE_DEBUG CHECK_MAGIC(sem->__magic); #endif __asm__ __volatile__( diff -urN linux-2.6.7-rc2/include/asm-x86_64/sigcontext.h linux-2.6.7-rc3/include/asm-x86_64/sigcontext.h --- linux-2.6.7-rc2/include/asm-x86_64/sigcontext.h 2004-05-09 19:32:26.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-x86_64/sigcontext.h 2004-06-07 12:55:22.596433777 -0700 @@ -2,6 +2,7 @@ #define _ASM_X86_64_SIGCONTEXT_H #include +#include /* FXSAVE frame */ /* Note: reserved1/2 may someday contain valuable data. Always save/restore @@ -47,7 +48,7 @@ unsigned long trapno; unsigned long oldmask; unsigned long cr2; - struct _fpstate *fpstate; /* zero when no FPU context */ + struct _fpstate __user *fpstate; /* zero when no FPU context */ unsigned long reserved1[8]; }; diff -urN linux-2.6.7-rc2/include/asm-x86_64/uaccess.h linux-2.6.7-rc3/include/asm-x86_64/uaccess.h --- linux-2.6.7-rc2/include/asm-x86_64/uaccess.h 2004-05-09 19:32:26.000000000 -0700 +++ linux-2.6.7-rc3/include/asm-x86_64/uaccess.h 2004-06-07 12:55:22.598433860 -0700 @@ -24,7 +24,7 @@ #define MAKE_MM_SEG(s) ((mm_segment_t) { (s) }) -#define KERNEL_DS MAKE_MM_SEG(0xFFFFFFFFFFFFFFFF) +#define KERNEL_DS MAKE_MM_SEG(0xFFFFFFFFFFFFFFFFUL) #define USER_DS MAKE_MM_SEG(PAGE_OFFSET) #define get_ds() (KERNEL_DS) @@ -33,6 +33,16 @@ #define segment_eq(a,b) ((a).seg == (b).seg) +#ifdef __CHECKER__ +#define CHECK_UPTR(ptr) do { \ + __typeof__(*(ptr)) *__dummy_check_uptr = \ + (void __user *)&__dummy_check_uptr; \ +} while(0) +#else +#define CHECK_UPTR(ptr) +#endif + + #define __addr_ok(addr) (!((unsigned long)(addr) & (current_thread_info()->addr_limit.seg))) /* @@ -40,15 +50,16 @@ */ #define __range_not_ok(addr,size) ({ \ unsigned long flag,sum; \ + CHECK_UPTR(addr); \ asm("# range_ok\n\r" \ "addq %3,%1 ; sbbq %0,%0 ; cmpq %1,%4 ; sbbq $0,%0" \ :"=&r" (flag), "=r" (sum) \ :"1" (addr),"g" ((long)(size)),"g" (current_thread_info()->addr_limit.seg)); \ flag; }) -#define access_ok(type,addr,size) (__range_not_ok(addr,size) == 0) +#define access_ok(type, addr, size) (__range_not_ok(addr,size) == 0) -extern inline int verify_area(int type, const void * addr, unsigned long size) +extern inline int verify_area(int type, const void __user * addr, unsigned long size) { return access_ok(type,addr,size) ? 0 : -EFAULT; } @@ -103,6 +114,7 @@ #define get_user(x,ptr) \ ({ long __val_gu; \ int __ret_gu; \ + CHECK_UPTR(ptr); \ switch(sizeof (*(ptr))) { \ case 1: __get_user_x(1,__ret_gu,__val_gu,ptr); break; \ case 2: __get_user_x(2,__ret_gu,__val_gu,ptr); break; \ @@ -138,6 +150,7 @@ #define __put_user_nocheck(x,ptr,size) \ ({ \ int __pu_err; \ + CHECK_UPTR(ptr); \ __put_user_size((x),(ptr),(size),__pu_err); \ __pu_err; \ }) @@ -193,6 +206,7 @@ ({ \ int __gu_err; \ long __gu_val; \ + CHECK_UPTR(ptr); \ __get_user_size(__gu_val,(ptr),(size),__gu_err); \ (x) = (__typeof__(*(ptr)))__gu_val; \ __gu_err; \ @@ -235,15 +249,15 @@ /* Handles exceptions in both to and from, but doesn't do access_ok */ extern unsigned long copy_user_generic(void *to, const void *from, unsigned len); -extern unsigned long copy_to_user(void *to, const void *from, unsigned len); -extern unsigned long copy_from_user(void *to, const void *from, unsigned len); -extern unsigned long copy_in_user(void *to, const void *from, unsigned len); +extern unsigned long copy_to_user(void __user *to, const void *from, unsigned len); +extern unsigned long copy_from_user(void *to, const void __user *from, unsigned len); +extern unsigned long copy_in_user(void __user *to, const void __user *from, unsigned len); -static inline int __copy_from_user(void *dst, const void *src, unsigned size) +static inline int __copy_from_user(void *dst, const void __user *src, unsigned size) { int ret = 0; if (!__builtin_constant_p(size)) - return copy_user_generic(dst,src,size); + return copy_user_generic(dst,(void *)src,size); switch (size) { case 1:__get_user_asm(*(u8*)dst,(u8 *)src,ret,"b","b","=q",1); return ret; @@ -264,15 +278,15 @@ __get_user_asm(*(u64*)(8+(char*)dst),(u64*)(8+(char*)src),ret,"q","","=r",8); return ret; default: - return copy_user_generic(dst,src,size); + return copy_user_generic(dst,(void *)src,size); } } -static inline int __copy_to_user(void *dst, const void *src, unsigned size) +static inline int __copy_to_user(void __user *dst, const void *src, unsigned size) { int ret = 0; if (!__builtin_constant_p(size)) - return copy_user_generic(dst,src,size); + return copy_user_generic((void *)dst,src,size); switch (size) { case 1:__put_user_asm(*(u8*)src,(u8 *)dst,ret,"b","b","iq",1); return ret; @@ -295,16 +309,16 @@ __put_user_asm(1[(u64*)src],1+(u64*)dst,ret,"q","","ir",8); return ret; default: - return copy_user_generic(dst,src,size); + return copy_user_generic((void *)dst,src,size); } } -static inline int __copy_in_user(void *dst, const void *src, unsigned size) +static inline int __copy_in_user(void __user *dst, const void __user *src, unsigned size) { int ret = 0; if (!__builtin_constant_p(size)) - return copy_user_generic(dst,src,size); + return copy_user_generic((void *)dst,(void *)src,size); switch (size) { case 1: { u8 tmp; @@ -336,15 +350,15 @@ return ret; } default: - return copy_user_generic(dst,src,size); + return copy_user_generic((void *)dst,(void *)src,size); } } -long strncpy_from_user(char *dst, const char *src, long count); -long __strncpy_from_user(char *dst, const char *src, long count); -long strnlen_user(const char *str, long n); -long strlen_user(const char *str); -unsigned long clear_user(void *mem, unsigned long len); -unsigned long __clear_user(void *mem, unsigned long len); +long strncpy_from_user(char *dst, const char __user *src, long count); +long __strncpy_from_user(char *dst, const char __user *src, long count); +long strnlen_user(const char __user *str, long n); +long strlen_user(const char __user *str); +unsigned long clear_user(void __user *mem, unsigned long len); +unsigned long __clear_user(void __user *mem, unsigned long len); #endif /* __X86_64_UACCESS_H */ diff -urN linux-2.6.7-rc2/include/linux/aio.h linux-2.6.7-rc3/include/linux/aio.h --- linux-2.6.7-rc2/include/linux/aio.h 2004-06-07 12:54:52.705195733 -0700 +++ linux-2.6.7-rc3/include/linux/aio.h 2004-06-07 12:55:22.684437423 -0700 @@ -59,7 +59,10 @@ struct list_head ki_list; /* the aio core uses this * for cancellation */ - void __user *ki_user_obj; /* pointer to userland's iocb */ + union { + void __user *user; + struct task_struct *tsk; + } ki_obj; __u64 ki_user_data; /* user's data for completion */ loff_t ki_pos; @@ -76,7 +79,7 @@ (x)->ki_filp = (filp); \ (x)->ki_ctx = &tsk->active_mm->default_kioctx; \ (x)->ki_cancel = NULL; \ - (x)->ki_user_obj = tsk; \ + (x)->ki_obj.tsk = tsk; \ } while (0) #define AIO_RING_MAGIC 0xa10a10a1 diff -urN linux-2.6.7-rc2/include/linux/atm.h linux-2.6.7-rc3/include/linux/atm.h --- linux-2.6.7-rc2/include/linux/atm.h 2004-05-09 19:33:13.000000000 -0700 +++ linux-2.6.7-rc3/include/linux/atm.h 2004-06-07 12:55:22.735439535 -0700 @@ -232,7 +232,7 @@ struct atmif_sioc { int number; int length; - void *arg; + void __user *arg; }; typedef unsigned short atm_backend_t; diff -urN linux-2.6.7-rc2/include/linux/atmdev.h linux-2.6.7-rc3/include/linux/atmdev.h --- linux-2.6.7-rc2/include/linux/atmdev.h 2004-05-09 19:33:13.000000000 -0700 +++ linux-2.6.7-rc3/include/linux/atmdev.h 2004-06-07 12:55:22.817442932 -0700 @@ -351,11 +351,11 @@ void (*dev_close)(struct atm_dev *dev); int (*open)(struct atm_vcc *vcc); void (*close)(struct atm_vcc *vcc); - int (*ioctl)(struct atm_dev *dev,unsigned int cmd,void *arg); + int (*ioctl)(struct atm_dev *dev,unsigned int cmd,void __user *arg); int (*getsockopt)(struct atm_vcc *vcc,int level,int optname, - void *optval,int optlen); + void __user *optval,int optlen); int (*setsockopt)(struct atm_vcc *vcc,int level,int optname, - void *optval,int optlen); + void __user *optval,int optlen); int (*send)(struct atm_vcc *vcc,struct sk_buff *skb); int (*send_oam)(struct atm_vcc *vcc,void *cell,int flags); void (*phy_put)(struct atm_dev *dev,unsigned char value, @@ -368,7 +368,7 @@ struct atmphy_ops { int (*start)(struct atm_dev *dev); - int (*ioctl)(struct atm_dev *dev,unsigned int cmd,void *arg); + int (*ioctl)(struct atm_dev *dev,unsigned int cmd,void __user *arg); void (*interrupt)(struct atm_dev *dev); int (*stop)(struct atm_dev *dev); }; diff -urN linux-2.6.7-rc2/include/linux/cciss_ioctl.h linux-2.6.7-rc3/include/linux/cciss_ioctl.h --- linux-2.6.7-rc2/include/linux/cciss_ioctl.h 2004-05-09 19:32:29.000000000 -0700 +++ linux-2.6.7-rc3/include/linux/cciss_ioctl.h 2004-06-07 12:55:22.986449932 -0700 @@ -167,7 +167,7 @@ RequestBlock_struct Request; ErrorInfo_struct error_info; WORD buf_size; /* size in bytes of the buf */ - BYTE *buf; + BYTE __user *buf; } IOCTL_Command_struct; typedef struct _BIG_IOCTL_Command_struct { @@ -177,7 +177,7 @@ DWORD malloc_size; /* < MAX_KMALLOC_SIZE in cciss.c */ DWORD buf_size; /* size in bytes of the buf */ /* < malloc_size * MAXSGENTRIES */ - BYTE *buf; + BYTE __user *buf; } BIG_IOCTL_Command_struct; typedef struct _LogvolInfo_struct{ diff -urN linux-2.6.7-rc2/include/linux/cdrom.h linux-2.6.7-rc3/include/linux/cdrom.h --- linux-2.6.7-rc2/include/linux/cdrom.h 2004-06-07 12:54:52.708195857 -0700 +++ linux-2.6.7-rc3/include/linux/cdrom.h 2004-06-07 12:55:23.025451548 -0700 @@ -237,9 +237,9 @@ struct cdrom_read_audio { union cdrom_addr addr; /* frame address */ - __u8 addr_format; /* CDROM_LBA or CDROM_MSF */ + __u8 addr_format; /* CDROM_LBA or CDROM_MSF */ int nframes; /* number of 2352-byte-frames to read at once */ - __u8 *buf; /* frame buffer (size: nframes*2352 bytes) */ + __u8 __user *buf; /* frame buffer (size: nframes*2352 bytes) */ }; /* This struct is used with the CDROMMULTISESSION ioctl */ diff -urN linux-2.6.7-rc2/include/linux/coda.h linux-2.6.7-rc3/include/linux/coda.h --- linux-2.6.7-rc2/include/linux/coda.h 2004-05-09 19:32:29.000000000 -0700 +++ linux-2.6.7-rc3/include/linux/coda.h 2004-06-07 12:55:23.032451837 -0700 @@ -759,13 +759,14 @@ #define PIOCPARM_MASK 0x0000ffff struct ViceIoctl { - caddr_t in, out; /* Data to be transferred in, or out */ + void __user *in; /* Data to be transferred in */ + void __user *out; /* Data to be transferred out */ short in_size; /* Size of input buffer <= 2K */ short out_size; /* Maximum size of output buffer, <= 2K */ }; struct PioctlData { - const char *path; + const char __user *path; int follow; struct ViceIoctl vi; }; diff -urN linux-2.6.7-rc2/include/linux/coda_proc.h linux-2.6.7-rc3/include/linux/coda_proc.h --- linux-2.6.7-rc2/include/linux/coda_proc.h 2004-05-09 19:31:59.000000000 -0700 +++ linux-2.6.7-rc3/include/linux/coda_proc.h 2004-06-07 12:55:23.032451837 -0700 @@ -82,9 +82,9 @@ * data structure for /proc/sys/... files */ int do_reset_coda_vfs_stats( ctl_table * table, int write, struct file * filp, - void * buffer, size_t * lenp ); + void __user * buffer, size_t * lenp ); int do_reset_coda_cache_inv_stats( ctl_table * table, int write, - struct file * filp, void * buffer, + struct file * filp, void __user * buffer, size_t * lenp ); /* these functions are called to form the content of /proc/fs/coda/... files */ diff -urN linux-2.6.7-rc2/include/linux/compat_ioctl.h linux-2.6.7-rc3/include/linux/compat_ioctl.h --- linux-2.6.7-rc2/include/linux/compat_ioctl.h 2004-06-07 12:54:52.709195899 -0700 +++ linux-2.6.7-rc3/include/linux/compat_ioctl.h 2004-06-07 12:55:23.106454903 -0700 @@ -125,6 +125,7 @@ COMPATIBLE_IOCTL(RESTART_ARRAY_RW) /* DM */ COMPATIBLE_IOCTL(DM_VERSION_32) +COMPATIBLE_IOCTL(DM_REMOVE_ALL_32) COMPATIBLE_IOCTL(DM_LIST_DEVICES_32) COMPATIBLE_IOCTL(DM_DEV_CREATE_32) COMPATIBLE_IOCTL(DM_DEV_REMOVE_32) diff -urN linux-2.6.7-rc2/include/linux/compiler.h linux-2.6.7-rc3/include/linux/compiler.h --- linux-2.6.7-rc2/include/linux/compiler.h 2004-05-09 19:32:52.000000000 -0700 +++ linux-2.6.7-rc3/include/linux/compiler.h 2004-06-07 12:55:23.115455276 -0700 @@ -5,10 +5,14 @@ # define __user __attribute__((noderef, address_space(1))) # define __kernel /* default address space */ # define __safe __attribute__((safe)) +# define __force __attribute__((force)) +extern void __chk_user_ptr(void __user *); #else # define __user # define __kernel # define __safe +# define __force +# define __chk_user_ptr(x) (void)0 #endif #ifdef __KERNEL__ diff -urN linux-2.6.7-rc2/include/linux/cpu.h linux-2.6.7-rc3/include/linux/cpu.h --- linux-2.6.7-rc2/include/linux/cpu.h 2004-05-09 19:32:02.000000000 -0700 +++ linux-2.6.7-rc3/include/linux/cpu.h 2004-06-07 12:55:23.116455317 -0700 @@ -60,7 +60,8 @@ #define unlock_cpu_hotplug() up(&cpucontrol) #define lock_cpu_hotplug_interruptible() down_interruptible(&cpucontrol) #define hotcpu_notifier(fn, pri) { \ - static struct notifier_block fn##_nb = { fn, pri }; \ + static struct notifier_block fn##_nb = \ + { .notifier_call = fn, .priority = pri }; \ register_cpu_notifier(&fn##_nb); \ } int cpu_down(unsigned int cpu); diff -urN linux-2.6.7-rc2/include/linux/edd.h linux-2.6.7-rc3/include/linux/edd.h --- linux-2.6.7-rc2/include/linux/edd.h 2004-05-09 19:31:59.000000000 -0700 +++ linux-2.6.7-rc3/include/linux/edd.h 2004-06-07 12:55:23.209459169 -0700 @@ -166,9 +166,9 @@ u8 device; u8 version; u16 interface_support; - u16 legacy_cylinders; - u8 legacy_heads; - u8 legacy_sectors; + u16 legacy_max_cylinder; + u8 legacy_max_head; + u8 legacy_sectors_per_track; struct edd_device_params params; } __attribute__ ((packed)); diff -urN linux-2.6.7-rc2/include/linux/efi.h linux-2.6.7-rc3/include/linux/efi.h --- linux-2.6.7-rc2/include/linux/efi.h 2004-05-09 19:33:20.000000000 -0700 +++ linux-2.6.7-rc3/include/linux/efi.h 2004-06-07 12:55:23.252460950 -0700 @@ -370,11 +370,4 @@ u16 length; } __attribute ((packed)); -/* - * efi_dir is allocated in arch/ia64/kernel/efi.c. - */ -#ifdef CONFIG_PROC_FS -extern struct proc_dir_entry *efi_dir; -#endif - #endif /* _LINUX_EFI_H */ diff -urN linux-2.6.7-rc2/include/linux/fd.h linux-2.6.7-rc3/include/linux/fd.h --- linux-2.6.7-rc2/include/linux/fd.h 2004-05-09 19:33:13.000000000 -0700 +++ linux-2.6.7-rc3/include/linux/fd.h 2004-06-07 12:55:23.294462690 -0700 @@ -339,7 +339,7 @@ #define FD_RAW_FAILURE 0x10000 /* command sent to fdc, fdc returned error */ #define FD_RAW_HARDFAILURE 0x20000 /* fdc had to be reset, or timed out */ - void *data; + void __user *data; char *kernel_data; /* location of data buffer in the kernel */ struct floppy_raw_cmd *next; /* used for chaining of raw cmd's * within the kernel */ diff -urN linux-2.6.7-rc2/include/linux/futex.h linux-2.6.7-rc3/include/linux/futex.h --- linux-2.6.7-rc2/include/linux/futex.h 2004-05-09 19:32:52.000000000 -0700 +++ linux-2.6.7-rc3/include/linux/futex.h 2004-06-07 12:55:23.319463726 -0700 @@ -8,9 +8,10 @@ #define FUTEX_WAKE (1) #define FUTEX_FD (2) #define FUTEX_REQUEUE (3) - +#define FUTEX_CMP_REQUEUE (4) long do_futex(unsigned long uaddr, int op, int val, - unsigned long timeout, unsigned long uaddr2, int val2); + unsigned long timeout, unsigned long uaddr2, int val2, + int val3); #endif diff -urN linux-2.6.7-rc2/include/linux/hdlc.h linux-2.6.7-rc3/include/linux/hdlc.h --- linux-2.6.7-rc2/include/linux/hdlc.h 2004-05-09 19:33:21.000000000 -0700 +++ linux-2.6.7-rc3/include/linux/hdlc.h 2004-06-07 12:55:23.345464803 -0700 @@ -134,7 +134,7 @@ int dce_pvc_count; struct timer_list timer; - int last_poll; + unsigned long last_poll; int reliable; int dce_changed; int request; @@ -149,8 +149,9 @@ cisco_proto settings; struct timer_list timer; - int last_poll; + unsigned long last_poll; int up; + int request_sent; u32 txseq; /* TX sequence number */ u32 rxseq; /* RX sequence number */ }cisco; diff -urN linux-2.6.7-rc2/include/linux/hugetlb.h linux-2.6.7-rc3/include/linux/hugetlb.h --- linux-2.6.7-rc2/include/linux/hugetlb.h 2004-06-07 12:54:52.715196147 -0700 +++ linux-2.6.7-rc3/include/linux/hugetlb.h 2004-06-07 12:55:23.353465134 -0700 @@ -12,7 +12,7 @@ return vma->vm_flags & VM_HUGETLB; } -int hugetlb_sysctl_handler(struct ctl_table *, int, struct file *, void *, size_t *); +int hugetlb_sysctl_handler(struct ctl_table *, int, struct file *, void __user *, size_t *); int copy_hugetlb_page_range(struct mm_struct *, struct mm_struct *, struct vm_area_struct *); int follow_hugetlb_page(struct mm_struct *, struct vm_area_struct *, struct page **, struct vm_area_struct **, unsigned long *, int *, int); void zap_hugepage_range(struct vm_area_struct *, unsigned long, unsigned long); diff -urN linux-2.6.7-rc2/include/linux/ide.h linux-2.6.7-rc3/include/linux/ide.h --- linux-2.6.7-rc2/include/linux/ide.h 2004-06-07 12:54:52.718196271 -0700 +++ linux-2.6.7-rc3/include/linux/ide.h 2004-06-07 12:55:23.492470892 -0700 @@ -305,14 +305,17 @@ #include +/* needed on alpha, x86/x86_64, ia64, mips, ppc32 and sh */ +#ifndef IDE_ARCH_OBSOLETE_DEFAULTS +# define ide_default_io_base(index) (0) +# define ide_default_irq(base) (0) +# define ide_init_default_irq(base) (0) +#endif + /* * ide_init_hwif_ports() is OBSOLETE and will be removed in 2.7 series. * New ports shouldn't define IDE_ARCH_OBSOLETE_INIT in . - * - * m68k, m68knommu (broken) and i386-pc9800 (broken) - * still have their own versions. */ -#ifndef CONFIG_M68K #ifdef IDE_ARCH_OBSOLETE_INIT static inline void ide_init_hwif_ports(hw_regs_t *hw, unsigned long io_addr, @@ -335,9 +338,15 @@ #endif } #else -# define ide_init_hwif_ports(hw, io, ctl, irq) do {} while (0) +static inline void ide_init_hwif_ports(hw_regs_t *hw, + unsigned long io_addr, + unsigned long ctl_addr, + int *irq) +{ + if (io_addr || ctl_addr) + printk(KERN_WARNING "%s: must not be called\n", __FUNCTION__); +} #endif /* IDE_ARCH_OBSOLETE_INIT */ -#endif /* !M68K */ /* Currently only m68k, apus and m8xx need it */ #ifndef IDE_ARCH_ACK_INTR @@ -681,7 +690,6 @@ typedef enum { ide_stopped, /* no drive operation was started */ ide_started, /* a drive operation was started, handler was set */ - ide_released, /* as ide_started, but bus also released */ } ide_startstop_t; struct ide_driver_s; @@ -715,7 +723,6 @@ u8 keep_settings; /* restore settings after drive reset */ u8 autodma; /* device can safely use dma on host */ u8 using_dma; /* disk is using dma for read/write */ - u8 using_tcq; /* disk is using queueing */ u8 retry_pio; /* retrying dma capable host in pio */ u8 state; /* retry state */ u8 waiting_for_dma; /* dma currently in progress */ @@ -742,6 +749,7 @@ unsigned remap_0_to_1 : 1; /* 0=noremap, 1=remap 0->1 (for EZDrive) */ unsigned blocked : 1; /* 1=powermanagment told us not to do anything, so sleep nicely */ unsigned vdma : 1; /* 1=doing PIO over DMA 0=doing normal DMA */ + unsigned stroke : 1; /* from: hdx=stroke */ unsigned addressing; /* : 3; * 0=28-bit * 1=48-bit @@ -772,7 +780,6 @@ u8 sect; /* "real" sectors per track */ u8 bios_head; /* BIOS/fdisk/LILO number of heads */ u8 bios_sect; /* BIOS/fdisk/LILO sectors per track */ - u8 queue_depth; /* max queue depth */ unsigned int bios_cyl; /* BIOS/fdisk/LILO number of cyls */ unsigned int cyl; /* "real" number of cyls */ @@ -1086,7 +1093,6 @@ extern struct semaphore ide_setting_sem; extern int ide_add_setting(ide_drive_t *drive, const char *name, int rw, int read_ioctl, int write_ioctl, int data_type, int min, int max, int mul_factor, int div_factor, void *data, ide_procset_t *set); -extern void ide_remove_setting(ide_drive_t *drive, char *name); extern ide_settings_t *ide_find_setting_by_name(ide_drive_t *drive, char *name); extern int ide_read_setting(ide_drive_t *t, ide_settings_t *setting); extern int ide_write_setting(ide_drive_t *drive, ide_settings_t *setting, int val); @@ -1107,7 +1113,6 @@ extern void proc_ide_create(void); extern void proc_ide_destroy(void); -extern void destroy_proc_ide_device(ide_hwif_t *, ide_drive_t *); extern void destroy_proc_ide_drives(ide_hwif_t *); extern void create_proc_ide_interfaces(void); extern void ide_add_proc_entries(struct proc_dir_entry *, ide_proc_entry_t *, void *); @@ -1350,6 +1355,8 @@ */ extern void ide_end_drive_cmd(ide_drive_t *, u8, u8); +extern void try_to_flush_leftover_data(ide_drive_t *); + /* * Issue ATA command and wait for completion. * Use for implementing commands in kernel @@ -1552,9 +1559,15 @@ u8 val; /* value of masked reg when "enabled" */ } ide_pci_enablebit_t; +enum { + /* Uses ISA control ports not PCI ones. */ + IDEPCI_FLAG_ISA_PORTS = (1 << 0), + + IDEPCI_FLAG_FORCE_MASTER = (1 << 1), + IDEPCI_FLAG_FORCE_PDC = (1 << 2), +}; + typedef struct ide_pci_device_s { - u16 vendor; - u16 device; char *name; void (*init_setup)(struct pci_dev *, struct ide_pci_device_s *); void (*init_setup_dma)(struct pci_dev *, struct ide_pci_device_s *, ide_hwif_t *); @@ -1568,7 +1581,7 @@ u8 bootable; unsigned int extra; struct ide_pci_device_s *next; - u8 isa_ports; /* Uses ISA control ports not PCI ones */ + u8 flags; } ide_pci_device_t; extern void ide_setup_pci_device(struct pci_dev *, ide_pci_device_t *); @@ -1607,14 +1620,6 @@ extern int __ide_dma_timeout(ide_drive_t *); #endif /* CONFIG_BLK_DEV_IDEDMA_PCI */ -#ifdef CONFIG_BLK_DEV_IDE_TCQ -extern int __ide_dma_queued_on(ide_drive_t *drive); -extern int __ide_dma_queued_off(ide_drive_t *drive); -extern ide_startstop_t __ide_dma_queued_read(ide_drive_t *drive); -extern ide_startstop_t __ide_dma_queued_write(ide_drive_t *drive); -extern ide_startstop_t __ide_dma_queued_start(ide_drive_t *drive); -#endif - #else static inline int __ide_dma_off(ide_drive_t *drive) { return 0; } #endif /* CONFIG_BLK_DEV_IDEDMA */ @@ -1683,28 +1688,6 @@ #define local_irq_set(flags) do { local_save_flags((flags)); local_irq_enable(); } while (0) -#define IDE_MAX_TAG 32 -#ifdef CONFIG_BLK_DEV_IDE_TCQ -static inline int ata_pending_commands(ide_drive_t *drive) -{ - if (drive->using_tcq) - return blk_queue_tag_depth(drive->queue); - - return 0; -} - -static inline int ata_can_queue(ide_drive_t *drive) -{ - if (drive->using_tcq) - return blk_queue_tag_queue(drive->queue); - - return 1; -} -#else -#define ata_pending_commands(drive) (0) -#define ata_can_queue(drive) (1) -#endif - extern struct bus_type ide_bus_type; #endif /* _IDE_H */ diff -urN linux-2.6.7-rc2/include/linux/if.h linux-2.6.7-rc3/include/linux/if.h --- linux-2.6.7-rc2/include/linux/if.h 2004-06-07 12:54:52.719196313 -0700 +++ linux-2.6.7-rc3/include/linux/if.h 2004-06-07 12:55:23.528472383 -0700 @@ -147,7 +147,7 @@ struct ifmap ifru_map; char ifru_slave[IFNAMSIZ]; /* Just fits the size */ char ifru_newname[IFNAMSIZ]; - char __user * ifru_data; + void __user * ifru_data; struct if_settings ifru_settings; } ifr_ifru; }; @@ -182,8 +182,8 @@ int ifc_len; /* size of buffer */ union { - char * ifcu_buf; - struct ifreq *ifcu_req; + char __user *ifcu_buf; + struct ifreq __user *ifcu_req; } ifc_ifcu; }; #define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */ diff -urN linux-2.6.7-rc2/include/linux/if_arp.h linux-2.6.7-rc3/include/linux/if_arp.h --- linux-2.6.7-rc2/include/linux/if_arp.h 2004-05-09 19:33:13.000000000 -0700 +++ linux-2.6.7-rc3/include/linux/if_arp.h 2004-06-07 12:55:23.572474206 -0700 @@ -86,6 +86,7 @@ #define ARPHRD_IEEE80211_PRISM 802 /* IEEE 802.11 + Prism2 header */ #define ARPHRD_VOID 0xFFFF /* Void type, nothing is known */ +#define ARPHRD_NONE 0xFFFE /* zero header length */ /* ARP protocol opcodes. */ #define ARPOP_REQUEST 1 /* ARP request */ diff -urN linux-2.6.7-rc2/include/linux/if_bridge.h linux-2.6.7-rc3/include/linux/if_bridge.h --- linux-2.6.7-rc2/include/linux/if_bridge.h 2004-06-07 12:54:52.719196313 -0700 +++ linux-2.6.7-rc3/include/linux/if_bridge.h 2004-06-07 12:55:23.573474247 -0700 @@ -104,7 +104,7 @@ #include -extern void brioctl_set(int (*ioctl_hook)(unsigned int, unsigned long)); +extern void brioctl_set(int (*ioctl_hook)(unsigned int, void __user *)); extern int (*br_handle_frame_hook)(struct sk_buff *skb); extern int (*br_should_route_hook)(struct sk_buff **pskb); diff -urN linux-2.6.7-rc2/include/linux/if_frad.h linux-2.6.7-rc3/include/linux/if_frad.h --- linux-2.6.7-rc2/include/linux/if_frad.h 2004-05-09 19:31:58.000000000 -0700 +++ linux-2.6.7-rc3/include/linux/if_frad.h 2004-06-07 12:55:23.607475655 -0700 @@ -191,7 +191,7 @@ int buffer; /* current buffer for S508 firmware */ }; -extern void dlci_ioctl_set(int (*hook)(unsigned int, void *)); +extern void dlci_ioctl_set(int (*hook)(unsigned int, void __user *)); #endif /* __KERNEL__ */ diff -urN linux-2.6.7-rc2/include/linux/if_vlan.h linux-2.6.7-rc3/include/linux/if_vlan.h --- linux-2.6.7-rc2/include/linux/if_vlan.h 2004-05-09 19:32:02.000000000 -0700 +++ linux-2.6.7-rc3/include/linux/if_vlan.h 2004-06-07 12:55:23.607475655 -0700 @@ -55,7 +55,7 @@ #define VLAN_VID_MASK 0xfff /* found in socket.c */ -extern void vlan_ioctl_set(int (*hook)(unsigned long)); +extern void vlan_ioctl_set(int (*hook)(void __user *)); #define VLAN_NAME "vlan" diff -urN linux-2.6.7-rc2/include/linux/inetdevice.h linux-2.6.7-rc3/include/linux/inetdevice.h --- linux-2.6.7-rc2/include/linux/inetdevice.h 2004-05-09 19:32:53.000000000 -0700 +++ linux-2.6.7-rc3/include/linux/inetdevice.h 2004-06-07 12:55:23.651477478 -0700 @@ -96,7 +96,7 @@ extern struct net_device *ip_dev_find(u32 addr); extern int inet_addr_onlink(struct in_device *in_dev, u32 a, u32 b); -extern int devinet_ioctl(unsigned int cmd, void *); +extern int devinet_ioctl(unsigned int cmd, void __user *); extern void devinet_init(void); extern struct in_device *inetdev_init(struct net_device *dev); extern struct in_device *inetdev_by_index(int); diff -urN linux-2.6.7-rc2/include/linux/input.h linux-2.6.7-rc3/include/linux/input.h --- linux-2.6.7-rc2/include/linux/input.h 2004-05-09 19:32:29.000000000 -0700 +++ linux-2.6.7-rc3/include/linux/input.h 2004-06-07 12:55:23.832484976 -0700 @@ -655,7 +655,7 @@ struct ff_envelope envelope; /* Only used if waveform == FF_CUSTOM */ - __u32 custom_len; /* Number of samples */ + __u32 custom_len; /* Number of samples */ __s16 *custom_data; /* Buffer of samples */ /* Note: the data pointed by custom_data is copied by the driver. You can * therefore dispose of the memory after the upload/update */ @@ -749,8 +749,6 @@ #define INPUT_KEYCODE(dev, scancode) ((dev->keycodesize == 1) ? ((u8*)dev->keycode)[scancode] : \ ((dev->keycodesize == 2) ? ((u16*)dev->keycode)[scancode] : (((u32*)dev->keycode)[scancode]))) -#define init_input_dev(dev) do { INIT_LIST_HEAD(&((dev)->h_list)); INIT_LIST_HEAD(&((dev)->node)); } while (0) - #define SET_INPUT_KEYCODE(dev, scancode, val) \ ({ unsigned __old; \ switch (dev->keycodesize) { \ @@ -915,6 +913,12 @@ #define to_handle(n) container_of(n,struct input_handle,d_node) #define to_handle_h(n) container_of(n,struct input_handle,h_node) +static inline void init_input_dev(struct input_dev *dev) +{ + INIT_LIST_HEAD(&dev->h_list); + INIT_LIST_HEAD(&dev->node); +} + void input_register_device(struct input_dev *); void input_unregister_device(struct input_dev *); @@ -932,14 +936,51 @@ void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value); -#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) +static inline void input_report_key(struct input_dev *dev, unsigned int code, int value) +{ + input_event(dev, EV_KEY, code, !!value); +} + +static inline void input_report_rel(struct input_dev *dev, unsigned int code, int value) +{ + input_event(dev, EV_REL, code, value); +} + +static inline void input_report_abs(struct input_dev *dev, unsigned int code, int value) +{ + input_event(dev, EV_ABS, code, value); +} + +static inline void input_report_ff(struct input_dev *dev, unsigned int code, int value) +{ + input_event(dev, EV_FF, code, value); +} + +static inline void input_report_ff_status(struct input_dev *dev, unsigned int code, int value) +{ + input_event(dev, EV_FF_STATUS, code, value); +} + +static inline void input_regs(struct input_dev *dev, struct pt_regs *regs) +{ + dev->regs = regs; +} + +static inline void input_sync(struct input_dev *dev) +{ + input_event(dev, EV_SYN, SYN_REPORT, 0); + dev->regs = NULL; +} + +static inline void input_set_abs_params(struct input_dev *dev, int axis, int min, int max, int fuzz, int flat) +{ + dev->absmin[axis] = min; + dev->absmax[axis] = max; + dev->absfuzz[axis] = fuzz; + dev->absflat[axis] = flat; -#define input_regs(a,b) do { (a)->regs = (b); } while (0) -#define input_sync(a) do { input_event(a, EV_SYN, SYN_REPORT, 0); (a)->regs = NULL; } while (0) + dev->absbit[LONG(axis)] |= BIT(axis); +} extern struct class_simple *input_class; diff -urN linux-2.6.7-rc2/include/linux/kd.h linux-2.6.7-rc3/include/linux/kd.h --- linux-2.6.7-rc2/include/linux/kd.h 2004-05-09 19:33:12.000000000 -0700 +++ linux-2.6.7-rc3/include/linux/kd.h 2004-06-07 12:55:23.870486550 -0700 @@ -1,6 +1,7 @@ #ifndef _LINUX_KD_H #define _LINUX_KD_H #include +#include /* 0x4B is 'K', to avoid collision with termios and vt */ @@ -12,7 +13,7 @@ struct consolefontdesc { unsigned short charcount; /* characters in font (256 or 512) */ unsigned short charheight; /* scan lines per character (1-32) */ - char *chardata; /* font data in expanded form */ + char __user *chardata; /* font data in expanded form */ }; #define PIO_FONTRESET 0x4B6D /* reset to default font */ @@ -63,7 +64,7 @@ }; struct unimapdesc { unsigned short entry_ct; - struct unipair *entries; + struct unipair __user *entries; }; #define PIO_UNIMAP 0x4B67 /* put unicode-to-font mapping in kernel */ #define PIO_UNIMAPCLR 0x4B68 /* clear table, possibly advise hash algorithm */ diff -urN linux-2.6.7-rc2/include/linux/mca.h linux-2.6.7-rc3/include/linux/mca.h --- linux-2.6.7-rc2/include/linux/mca.h 2004-05-09 19:32:26.000000000 -0700 +++ linux-2.6.7-rc3/include/linux/mca.h 2004-06-07 12:55:23.906488041 -0700 @@ -144,7 +144,7 @@ { } -static inline void mca_set_adapter_procfn(int slot, MCA_ProcFn *fn, void* dev) +static inline void mca_set_adapter_procfn(int slot, MCA_ProcFn fn, void* dev) { } #endif diff -urN linux-2.6.7-rc2/include/linux/mii.h linux-2.6.7-rc3/include/linux/mii.h --- linux-2.6.7-rc2/include/linux/mii.h 2004-05-09 19:31:58.000000000 -0700 +++ linux-2.6.7-rc3/include/linux/mii.h 2004-06-07 12:55:23.912488289 -0700 @@ -9,6 +9,7 @@ #define __LINUX_MII_H__ #include +#include /* Generic MII registers. */ @@ -144,6 +145,12 @@ }; +static inline struct mii_ioctl_data *if_mii(struct ifreq *rq) +{ + return (struct mii_ioctl_data *) &rq->ifr_ifru; +} + + /** * mii_nway_result * @negotiated: value of MII ANAR and'd with ANLPAR diff -urN linux-2.6.7-rc2/include/linux/mroute.h linux-2.6.7-rc3/include/linux/mroute.h --- linux-2.6.7-rc2/include/linux/mroute.h 2004-06-07 12:54:52.725196561 -0700 +++ linux-2.6.7-rc3/include/linux/mroute.h 2004-06-07 12:55:23.962490361 -0700 @@ -130,7 +130,7 @@ extern int ip_mroute_setsockopt(struct sock *, int, char __user *, int); extern int ip_mroute_getsockopt(struct sock *, int, char __user *, int __user *); -extern int ipmr_ioctl(struct sock *sk, int cmd, unsigned long arg); +extern int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg); extern void ip_mr_init(void); diff -urN linux-2.6.7-rc2/include/linux/net.h linux-2.6.7-rc3/include/linux/net.h --- linux-2.6.7-rc2/include/linux/net.h 2004-05-09 19:32:28.000000000 -0700 +++ linux-2.6.7-rc3/include/linux/net.h 2004-06-07 12:55:23.967490568 -0700 @@ -217,9 +217,9 @@ SOCKCALL_WRAP(name, listen, (struct socket *sock, int len), (sock, len)) \ SOCKCALL_WRAP(name, shutdown, (struct socket *sock, int flags), (sock, flags)) \ SOCKCALL_WRAP(name, setsockopt, (struct socket *sock, int level, int optname, \ - char *optval, int optlen), (sock, level, optname, optval, optlen)) \ + char __user *optval, int optlen), (sock, level, optname, optval, optlen)) \ SOCKCALL_WRAP(name, getsockopt, (struct socket *sock, int level, int optname, \ - char *optval, int *optlen), (sock, level, optname, optval, optlen)) \ + char __user *optval, int __user *optlen), (sock, level, optname, optval, optlen)) \ SOCKCALL_WRAP(name, sendmsg, (struct kiocb *iocb, struct socket *sock, struct msghdr *m, size_t len), \ (iocb, sock, m, len)) \ SOCKCALL_WRAP(name, recvmsg, (struct kiocb *iocb, struct socket *sock, struct msghdr *m, size_t len, int flags), \ diff -urN linux-2.6.7-rc2/include/linux/netdevice.h linux-2.6.7-rc3/include/linux/netdevice.h --- linux-2.6.7-rc2/include/linux/netdevice.h 2004-06-07 12:54:52.726196603 -0700 +++ linux-2.6.7-rc3/include/linux/netdevice.h 2004-06-07 12:55:23.968490609 -0700 @@ -558,7 +558,7 @@ extern int netpoll_trap(void); #endif -typedef int gifconf_func_t(struct net_device * dev, char * bufptr, int len); +typedef int gifconf_func_t(struct net_device * dev, char __user * bufptr, int len); extern int register_gifconf(unsigned int family, gifconf_func_t * gifconf); static inline int unregister_gifconf(unsigned int family) { @@ -676,7 +676,7 @@ extern int netif_rx(struct sk_buff *skb); #define HAVE_NETIF_RECEIVE_SKB 1 extern int netif_receive_skb(struct sk_buff *skb); -extern int dev_ioctl(unsigned int cmd, void *); +extern int dev_ioctl(unsigned int cmd, void __user *); extern int dev_ethtool(struct ifreq *); extern unsigned dev_get_flags(const struct net_device *); extern int dev_change_flags(struct net_device *, unsigned); @@ -943,7 +943,7 @@ extern unsigned long netdev_fc_xoff; extern atomic_t netdev_dropping; extern int netdev_set_master(struct net_device *dev, struct net_device *master); -extern struct sk_buff * skb_checksum_help(struct sk_buff *skb); +extern int skb_checksum_help(struct sk_buff **pskb, int inward); #ifdef CONFIG_NET_FASTROUTE extern int netdev_fastroute; extern int netdev_fastroute_obstacles; diff -urN linux-2.6.7-rc2/include/linux/netfilter.h linux-2.6.7-rc3/include/linux/netfilter.h --- linux-2.6.7-rc2/include/linux/netfilter.h 2004-06-07 12:54:52.726196603 -0700 +++ linux-2.6.7-rc3/include/linux/netfilter.h 2004-06-07 12:55:23.968490609 -0700 @@ -171,6 +171,12 @@ struct nf_info *info, unsigned int verdict); +extern inline struct ipt_target * +ipt_find_target_lock(const char *name, int *error, struct semaphore *mutex); +extern inline struct ip6t_target * +ip6t_find_target_lock(const char *name, int *error, struct semaphore *mutex); +extern inline struct arpt_target * +arpt_find_target_lock(const char *name, int *error, struct semaphore *mutex); extern void (*ip_ct_attach)(struct sk_buff *, struct nf_ct_info *); #ifdef CONFIG_NETFILTER_DEBUG diff -urN linux-2.6.7-rc2/include/linux/netfilter_arp/arp_tables.h linux-2.6.7-rc3/include/linux/netfilter_arp/arp_tables.h --- linux-2.6.7-rc2/include/linux/netfilter_arp/arp_tables.h 2004-05-09 19:32:27.000000000 -0700 +++ linux-2.6.7-rc3/include/linux/netfilter_arp/arp_tables.h 2004-06-07 12:55:23.969490650 -0700 @@ -205,7 +205,7 @@ /* Number of counters (must be equal to current number of entries). */ unsigned int num_counters; /* The old entries' counters. */ - struct arpt_counters *counters; + struct arpt_counters __user *counters; /* The entries (hang off end: not really an array). */ struct arpt_entry entries[0]; diff -urN linux-2.6.7-rc2/include/linux/netfilter_arp.h linux-2.6.7-rc3/include/linux/netfilter_arp.h --- linux-2.6.7-rc2/include/linux/netfilter_arp.h 2004-05-09 19:32:00.000000000 -0700 +++ linux-2.6.7-rc3/include/linux/netfilter_arp.h 2004-06-07 12:55:23.969490650 -0700 @@ -17,4 +17,5 @@ #define NF_ARP_FORWARD 2 #define NF_ARP_NUMHOOKS 3 +static DECLARE_MUTEX(arpt_mutex); #endif /* __LINUX_ARP_NETFILTER_H */ diff -urN linux-2.6.7-rc2/include/linux/netfilter_ipv4/ip_tables.h linux-2.6.7-rc3/include/linux/netfilter_ipv4/ip_tables.h --- linux-2.6.7-rc2/include/linux/netfilter_ipv4/ip_tables.h 2004-05-09 19:32:37.000000000 -0700 +++ linux-2.6.7-rc3/include/linux/netfilter_ipv4/ip_tables.h 2004-06-07 12:55:24.008492266 -0700 @@ -252,7 +252,7 @@ /* Number of counters (must be equal to current number of entries). */ unsigned int num_counters; /* The old entries' counters. */ - struct ipt_counters *counters; + struct ipt_counters __user *counters; /* The entries (hang off end: not really an array). */ struct ipt_entry entries[0]; @@ -283,6 +283,8 @@ struct ipt_entry entrytable[0]; }; +extern struct semaphore ipt_mutex; + /* Standard return verdict, or do jump. */ #define IPT_STANDARD_TARGET "" /* Error verdict. */ @@ -334,6 +336,7 @@ /* * Main firewall chains definitions and global var's definitions. */ +static DECLARE_MUTEX(ipt_mutex); #ifdef __KERNEL__ #include @@ -406,6 +409,11 @@ struct module *me; }; +extern struct ipt_target * +ipt_find_target_lock(const char *name, int *error, struct semaphore *mutex); +extern struct arpt_target * +arpt_find_target_lock(const char *name, int *error, struct semaphore *mutex); + extern int ipt_register_target(struct ipt_target *target); extern void ipt_unregister_target(struct ipt_target *target); diff -urN linux-2.6.7-rc2/include/linux/netfilter_ipv6/ip6_tables.h linux-2.6.7-rc3/include/linux/netfilter_ipv6/ip6_tables.h --- linux-2.6.7-rc2/include/linux/netfilter_ipv6/ip6_tables.h 2004-05-09 19:33:20.000000000 -0700 +++ linux-2.6.7-rc3/include/linux/netfilter_ipv6/ip6_tables.h 2004-06-07 12:55:24.055494213 -0700 @@ -106,6 +106,8 @@ u_int64_t pcnt, bcnt; /* Packet and byte counters */ }; +static DECLARE_MUTEX(ip6t_mutex); + /* Values for "flag" field in struct ip6t_ip6 (general ip6 structure). */ #define IP6T_F_PROTO 0x01 /* Set if rule cares about upper protocols */ @@ -258,7 +260,7 @@ /* Number of counters (must be equal to current number of entries). */ unsigned int num_counters; /* The old entries' counters. */ - struct ip6t_counters *counters; + struct ip6t_counters __user *counters; /* The entries (hang off end: not really an array). */ struct ip6t_entry entries[0]; diff -urN linux-2.6.7-rc2/include/linux/nfs_fs.h linux-2.6.7-rc3/include/linux/nfs_fs.h --- linux-2.6.7-rc2/include/linux/nfs_fs.h 2004-06-07 12:54:52.726196603 -0700 +++ linux-2.6.7-rc3/include/linux/nfs_fs.h 2004-06-07 12:55:24.090495663 -0700 @@ -306,7 +306,7 @@ */ extern ssize_t nfs_direct_IO(int, struct kiocb *, const struct iovec *, loff_t, unsigned long); -extern ssize_t nfs_file_direct_read(struct kiocb *iocb, char *buf, +extern ssize_t nfs_file_direct_read(struct kiocb *iocb, char __user *buf, size_t count, loff_t pos); extern ssize_t nfs_file_direct_write(struct kiocb *iocb, const char __user *buf, size_t count, loff_t pos); diff -urN linux-2.6.7-rc2/include/linux/nfsd/export.h linux-2.6.7-rc3/include/linux/nfsd/export.h --- linux-2.6.7-rc2/include/linux/nfsd/export.h 2004-06-07 12:54:52.727196644 -0700 +++ linux-2.6.7-rc3/include/linux/nfsd/export.h 2004-06-07 12:55:24.095495870 -0700 @@ -124,8 +124,7 @@ int err; exp_get(exp); expkey_put(&ek->h, &svc_expkey_cache); - if (exp && - (err = cache_check(&svc_export_cache, &exp->h, reqp))) + if ((err = cache_check(&svc_export_cache, &exp->h, reqp))) exp = ERR_PTR(err); return exp; } else diff -urN linux-2.6.7-rc2/include/linux/nfsd/nfsd.h linux-2.6.7-rc3/include/linux/nfsd/nfsd.h --- linux-2.6.7-rc2/include/linux/nfsd/nfsd.h 2004-06-07 12:54:52.727196644 -0700 +++ linux-2.6.7-rc3/include/linux/nfsd/nfsd.h 2004-06-07 12:55:24.097495953 -0700 @@ -281,7 +281,7 @@ | FATTR4_WORD1_OWNER | FATTR4_WORD1_OWNER_GROUP | FATTR4_WORD1_RAWDEV \ | FATTR4_WORD1_SPACE_AVAIL | FATTR4_WORD1_SPACE_FREE | FATTR4_WORD1_SPACE_TOTAL \ | FATTR4_WORD1_SPACE_USED | FATTR4_WORD1_TIME_ACCESS | FATTR4_WORD1_TIME_ACCESS_SET \ - | FATTR4_WORD1_TIME_CREATE | FATTR4_WORD1_TIME_DELTA | FATTR4_WORD1_TIME_METADATA \ + | FATTR4_WORD1_TIME_DELTA | FATTR4_WORD1_TIME_METADATA \ | FATTR4_WORD1_TIME_MODIFY | FATTR4_WORD1_TIME_MODIFY_SET | FATTR4_WORD1_MOUNTED_ON_FILEID) /* These will return ERR_INVAL if specified in GETATTR or READDIR. */ diff -urN linux-2.6.7-rc2/include/linux/nfsd/xdr3.h linux-2.6.7-rc3/include/linux/nfsd/xdr3.h --- linux-2.6.7-rc2/include/linux/nfsd/xdr3.h 2004-05-09 19:32:27.000000000 -0700 +++ linux-2.6.7-rc3/include/linux/nfsd/xdr3.h 2004-06-07 12:55:24.097495953 -0700 @@ -170,6 +170,7 @@ u32 * buffer; int buflen; u32 * offset; + u32 * offset1; struct svc_rqst * rqstp; }; diff -urN linux-2.6.7-rc2/include/linux/pci_ids.h linux-2.6.7-rc3/include/linux/pci_ids.h --- linux-2.6.7-rc2/include/linux/pci_ids.h 2004-06-07 12:54:52.731196810 -0700 +++ linux-2.6.7-rc3/include/linux/pci_ids.h 2004-06-07 12:55:24.111496532 -0700 @@ -373,6 +373,7 @@ #define PCI_DEVICE_ID_NS_SCx200_AUDIO 0x0503 #define PCI_DEVICE_ID_NS_SCx200_VIDEO 0x0504 #define PCI_DEVICE_ID_NS_SCx200_XBUS 0x0505 +#define PCI_DEVICE_ID_NS_SC1100_BRIDGE 0x0510 #define PCI_DEVICE_ID_NS_87410 0xd001 #define PCI_VENDOR_ID_TSENG 0x100c @@ -1057,6 +1058,12 @@ #define PCI_DEVICE_ID_NVIDIA_UTNT2 0x0029 #define PCI_DEVICE_ID_NVIDIA_VTNT2 0x002C #define PCI_DEVICE_ID_NVIDIA_UVTNT2 0x002D +#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_IDE 0x0035 +#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA 0x0036 +#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA2 0x003e +#define PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_IDE 0x0053 +#define PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_SATA 0x0054 +#define PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_SATA2 0x0055 #define PCI_DEVICE_ID_NVIDIA_NFORCE2_IDE 0x0065 #define PCI_DEVICE_ID_NVIDIA_MCP2_AUDIO 0x006a #define PCI_DEVICE_ID_NVIDIA_NFORCE2S_IDE 0x0085 diff -urN linux-2.6.7-rc2/include/linux/raid/md_k.h linux-2.6.7-rc3/include/linux/raid/md_k.h --- linux-2.6.7-rc2/include/linux/raid/md_k.h 2004-05-09 19:31:59.000000000 -0700 +++ linux-2.6.7-rc3/include/linux/raid/md_k.h 2004-06-07 12:55:24.147498024 -0700 @@ -255,6 +255,14 @@ struct list_head all_mddevs; }; + +static inline void rdev_dec_pending(mdk_rdev_t *rdev, mddev_t *mddev) +{ + int faulty = rdev->faulty; + if (atomic_dec_and_test(&rdev->nr_pending) && faulty) + set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); +} + struct mdk_personality_s { char *name; @@ -271,6 +279,8 @@ int (*hot_remove_disk) (mddev_t *mddev, int number); int (*spare_active) (mddev_t *mddev); int (*sync_request)(mddev_t *mddev, sector_t sector_nr, int go_faster); + int (*resize) (mddev_t *mddev, sector_t sectors); + int (*reshape) (mddev_t *mddev, int raid_disks); }; diff -urN linux-2.6.7-rc2/include/linux/raid/raid1.h linux-2.6.7-rc3/include/linux/raid/raid1.h --- linux-2.6.7-rc2/include/linux/raid/raid1.h 2004-05-09 19:32:39.000000000 -0700 +++ linux-2.6.7-rc3/include/linux/raid/raid1.h 2004-06-07 12:55:24.148498065 -0700 @@ -10,6 +10,20 @@ sector_t head_position; }; +/* + * memory pools need a pointer to the mddev, so they can force an unplug + * when memory is tight, and a count of the number of drives that the + * pool was allocated for, so they know how much to allocate and free. + * mddev->raid_disks cannot be used, as it can change while a pool is active + * These two datums are stored in a kmalloced struct. + */ + +struct pool_info { + mddev_t *mddev; + int raid_disks; +}; + + typedef struct r1bio_s r1bio_t; struct r1_private_data_s { @@ -31,6 +45,8 @@ wait_queue_head_t wait_idle; wait_queue_head_t wait_resume; + struct pool_info *poolinfo; + mempool_t *r1bio_pool; mempool_t *r1buf_pool; }; diff -urN linux-2.6.7-rc2/include/linux/sdla.h linux-2.6.7-rc3/include/linux/sdla.h --- linux-2.6.7-rc2/include/linux/sdla.h 2004-05-09 19:33:21.000000000 -0700 +++ linux-2.6.7-rc3/include/linux/sdla.h 2004-06-07 12:55:24.279503491 -0700 @@ -58,7 +58,7 @@ struct sdla_mem { int addr; int len; - void *data; + void __user *data; }; #define SDLA_START (FRAD_LAST_IOCTL + 7) diff -urN linux-2.6.7-rc2/include/linux/selection.h linux-2.6.7-rc3/include/linux/selection.h --- linux-2.6.7-rc2/include/linux/selection.h 2004-05-09 19:32:39.000000000 -0700 +++ linux-2.6.7-rc3/include/linux/selection.h 2004-06-07 12:55:24.279503491 -0700 @@ -13,9 +13,9 @@ extern int sel_cons; extern void clear_selection(void); -extern int set_selection(const struct tiocl_selection *sel, struct tty_struct *tty, int user); +extern int set_selection(const struct tiocl_selection __user *sel, struct tty_struct *tty); extern int paste_selection(struct tty_struct *tty); -extern int sel_loadlut(const unsigned long arg); +extern int sel_loadlut(char __user *p); extern int mouse_reporting(void); extern void mouse_report(struct tty_struct * tty, int butt, int mrx, int mry); diff -urN linux-2.6.7-rc2/include/linux/skbuff.h linux-2.6.7-rc3/include/linux/skbuff.h --- linux-2.6.7-rc2/include/linux/skbuff.h 2004-05-09 19:32:39.000000000 -0700 +++ linux-2.6.7-rc3/include/linux/skbuff.h 2004-06-07 12:55:24.328505521 -0700 @@ -1014,13 +1014,13 @@ extern unsigned int datagram_poll(struct file *file, struct socket *sock, struct poll_table_struct *wait); extern int skb_copy_datagram(const struct sk_buff *from, - int offset, char *to, int size); + int offset, char __user *to, int size); extern int skb_copy_datagram_iovec(const struct sk_buff *from, int offset, struct iovec *to, int size); extern int skb_copy_and_csum_datagram(const struct sk_buff *skb, - int offset, u8 *to, int len, - unsigned int *csump); + int offset, u8 __user *to, + int len, unsigned int *csump); extern int skb_copy_and_csum_datagram_iovec(const struct sk_buff *skb, int hlen, diff -urN linux-2.6.7-rc2/include/linux/sunrpc/svcauth.h linux-2.6.7-rc3/include/linux/sunrpc/svcauth.h --- linux-2.6.7-rc2/include/linux/sunrpc/svcauth.h 2004-05-09 19:32:28.000000000 -0700 +++ linux-2.6.7-rc3/include/linux/sunrpc/svcauth.h 2004-06-07 12:55:24.353506557 -0700 @@ -87,6 +87,7 @@ */ struct auth_ops { char * name; + struct module *owner; int flavour; int (*accept)(struct svc_rqst *rq, u32 *authp); int (*release)(struct svc_rqst *rq); diff -urN linux-2.6.7-rc2/include/linux/syscalls.h linux-2.6.7-rc3/include/linux/syscalls.h --- linux-2.6.7-rc2/include/linux/syscalls.h 2004-06-07 12:54:52.745197390 -0700 +++ linux-2.6.7-rc3/include/linux/syscalls.h 2004-06-07 12:55:24.371507302 -0700 @@ -165,7 +165,8 @@ asmlinkage long sys_waitpid(pid_t pid, unsigned int __user *stat_addr, int options); asmlinkage long sys_set_tid_address(int __user *tidptr); asmlinkage long sys_futex(u32 __user *uaddr, int op, int val, - struct timespec __user *utime, u32 __user *uaddr2); + struct timespec __user *utime, u32 __user *uaddr2, + int val3); asmlinkage long sys_init_module(void __user *umod, unsigned long len, const char __user *uargs); diff -urN linux-2.6.7-rc2/include/linux/time.h linux-2.6.7-rc3/include/linux/time.h --- linux-2.6.7-rc2/include/linux/time.h 2004-06-07 12:54:52.747197472 -0700 +++ linux-2.6.7-rc3/include/linux/time.h 2004-06-07 12:55:24.506512894 -0700 @@ -184,7 +184,7 @@ * Avoid unnecessary multiplications/divisions in the * two most common HZ cases: */ -static inline unsigned int jiffies_to_msecs(unsigned long j) +static inline unsigned int jiffies_to_msecs(const unsigned long j) { #if HZ <= 1000 && !(1000 % HZ) return (1000 / HZ) * j; @@ -194,7 +194,7 @@ return (j * 1000) / HZ; #endif } -static inline unsigned long msecs_to_jiffies(unsigned int m) +static inline unsigned long msecs_to_jiffies(const unsigned int m) { #if HZ <= 1000 && !(1000 % HZ) return (m + (1000 / HZ) - 1) / (1000 / HZ); @@ -217,7 +217,7 @@ * value to a scaled second value. */ static __inline__ unsigned long -timespec_to_jiffies(struct timespec *value) +timespec_to_jiffies(const struct timespec *value) { unsigned long sec = value->tv_sec; long nsec = value->tv_nsec + TICK_NSEC - 1; @@ -233,7 +233,7 @@ } static __inline__ void -jiffies_to_timespec(unsigned long jiffies, struct timespec *value) +jiffies_to_timespec(const unsigned long jiffies, struct timespec *value) { /* * Convert jiffies to nanoseconds and separate with @@ -256,7 +256,7 @@ * instruction above the way it was done above. */ static __inline__ unsigned long -timeval_to_jiffies(struct timeval *value) +timeval_to_jiffies(const struct timeval *value) { unsigned long sec = value->tv_sec; long usec = value->tv_usec; @@ -271,7 +271,7 @@ } static __inline__ void -jiffies_to_timeval(unsigned long jiffies, struct timeval *value) +jiffies_to_timeval(const unsigned long jiffies, struct timeval *value) { /* * Convert jiffies to nanoseconds and separate with diff -urN linux-2.6.7-rc2/include/linux/timer.h linux-2.6.7-rc3/include/linux/timer.h --- linux-2.6.7-rc2/include/linux/timer.h 2004-06-07 12:54:52.747197472 -0700 +++ linux-2.6.7-rc3/include/linux/timer.h 2004-06-07 12:55:24.506512894 -0700 @@ -4,6 +4,7 @@ #include #include #include +#include struct tvec_t_base_s; diff -urN linux-2.6.7-rc2/include/linux/tty_driver.h linux-2.6.7-rc3/include/linux/tty_driver.h --- linux-2.6.7-rc2/include/linux/tty_driver.h 2004-05-09 19:32:52.000000000 -0700 +++ linux-2.6.7-rc3/include/linux/tty_driver.h 2004-06-07 12:55:24.507512936 -0700 @@ -145,7 +145,7 @@ void (*send_xchar)(struct tty_struct *tty, char ch); int (*read_proc)(char *page, char **start, off_t off, int count, int *eof, void *data); - int (*write_proc)(struct file *file, const char *buffer, + int (*write_proc)(struct file *file, const char __user *buffer, unsigned long count, void *data); int (*tiocmget)(struct tty_struct *tty, struct file *file); int (*tiocmset)(struct tty_struct *tty, struct file *file, @@ -207,7 +207,7 @@ void (*send_xchar)(struct tty_struct *tty, char ch); int (*read_proc)(char *page, char **start, off_t off, int count, int *eof, void *data); - int (*write_proc)(struct file *file, const char *buffer, + int (*write_proc)(struct file *file, const char __user *buffer, unsigned long count, void *data); int (*tiocmget)(struct tty_struct *tty, struct file *file); int (*tiocmset)(struct tty_struct *tty, struct file *file, diff -urN linux-2.6.7-rc2/include/linux/tty_ldisc.h linux-2.6.7-rc3/include/linux/tty_ldisc.h --- linux-2.6.7-rc2/include/linux/tty_ldisc.h 2004-05-09 19:33:21.000000000 -0700 +++ linux-2.6.7-rc3/include/linux/tty_ldisc.h 2004-06-07 12:55:24.508512977 -0700 @@ -114,9 +114,9 @@ void (*flush_buffer)(struct tty_struct *tty); ssize_t (*chars_in_buffer)(struct tty_struct *tty); ssize_t (*read)(struct tty_struct * tty, struct file * file, - unsigned char * buf, size_t nr); + unsigned char __user * buf, size_t nr); ssize_t (*write)(struct tty_struct * tty, struct file * file, - const unsigned char * buf, size_t nr); + const unsigned char __user * buf, size_t nr); int (*ioctl)(struct tty_struct * tty, struct file * file, unsigned int cmd, unsigned long arg); void (*set_termios)(struct tty_struct *tty, struct termios * old); diff -urN linux-2.6.7-rc2/include/linux/vt_kern.h linux-2.6.7-rc3/include/linux/vt_kern.h --- linux-2.6.7-rc2/include/linux/vt_kern.h 2004-05-09 19:33:13.000000000 -0700 +++ linux-2.6.7-rc3/include/linux/vt_kern.h 2004-06-07 12:55:24.521513516 -0700 @@ -49,8 +49,8 @@ void unblank_screen(void); void poke_blanked_console(void); int con_font_op(int currcons, struct console_font_op *op); -int con_set_cmap(unsigned char *cmap); -int con_get_cmap(unsigned char *cmap); +int con_set_cmap(unsigned char __user *cmap); +int con_get_cmap(unsigned char __user *cmap); void scrollback(int); void scrollfront(int); void update_region(int currcons, unsigned long start, int count); @@ -66,13 +66,13 @@ struct unimapinit; struct unipair; -int con_set_trans_old(unsigned char * table); -int con_get_trans_old(unsigned char * table); -int con_set_trans_new(unsigned short * table); -int con_get_trans_new(unsigned short * table); +int con_set_trans_old(unsigned char __user * table); +int con_get_trans_old(unsigned char __user * table); +int con_set_trans_new(unsigned short __user * table); +int con_get_trans_new(unsigned short __user * table); int con_clear_unimap(int currcons, struct unimapinit *ui); -int con_set_unimap(int currcons, ushort ct, struct unipair *list); -int con_get_unimap(int currcons, ushort ct, ushort *uct, struct unipair *list); +int con_set_unimap(int currcons, ushort ct, struct unipair __user *list); +int con_get_unimap(int currcons, ushort ct, ushort __user *uct, struct unipair __user *list); int con_set_default_unimap(int currcons); void con_free_unimap(int currcons); void con_protect_unimap(int currcons, int rdonly); diff -urN linux-2.6.7-rc2/include/linux/watchdog.h linux-2.6.7-rc3/include/linux/watchdog.h --- linux-2.6.7-rc2/include/linux/watchdog.h 2004-05-09 19:32:54.000000000 -0700 +++ linux-2.6.7-rc3/include/linux/watchdog.h 2004-06-07 12:55:24.563515256 -0700 @@ -10,6 +10,7 @@ #define _LINUX_WATCHDOG_H #include +#include #define WATCHDOG_IOCTL_BASE 'W' diff -urN linux-2.6.7-rc2/include/linux/wavefront.h linux-2.6.7-rc3/include/linux/wavefront.h --- linux-2.6.7-rc2/include/linux/wavefront.h 2004-05-09 19:32:28.000000000 -0700 +++ linux-2.6.7-rc3/include/linux/wavefront.h 2004-06-07 12:55:24.564515297 -0700 @@ -534,8 +534,8 @@ WF_{GET,SET}_CHANNEL above. */ - wavefront_any *hdrptr; /* user-space ptr to hdr bytes */ - UINT16 *dataptr; /* actual sample data */ + wavefront_any __user *hdrptr; /* user-space ptr to hdr bytes */ + UINT16 __user *dataptr; /* actual sample data */ wavefront_any hdr; /* kernel-space copy of hdr bytes */ } wavefront_patch_info; diff -urN linux-2.6.7-rc2/include/net/addrconf.h linux-2.6.7-rc3/include/net/addrconf.h --- linux-2.6.7-rc2/include/net/addrconf.h 2004-05-09 19:33:12.000000000 -0700 +++ linux-2.6.7-rc3/include/net/addrconf.h 2004-06-07 12:55:24.603516912 -0700 @@ -52,9 +52,9 @@ extern void addrconf_init(void); extern void addrconf_cleanup(void); -extern int addrconf_add_ifaddr(void *arg); -extern int addrconf_del_ifaddr(void *arg); -extern int addrconf_set_dstaddr(void *arg); +extern int addrconf_add_ifaddr(void __user *arg); +extern int addrconf_del_ifaddr(void __user *arg); +extern int addrconf_set_dstaddr(void __user *arg); extern int ipv6_chk_addr(struct in6_addr *addr, struct net_device *dev, diff -urN linux-2.6.7-rc2/include/net/arp.h linux-2.6.7-rc3/include/net/arp.h --- linux-2.6.7-rc2/include/net/arp.h 2004-05-09 19:32:25.000000000 -0700 +++ linux-2.6.7-rc3/include/net/arp.h 2004-06-07 12:55:24.603516912 -0700 @@ -13,7 +13,7 @@ extern int arp_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt); extern int arp_find(unsigned char *haddr, struct sk_buff *skb); -extern int arp_ioctl(unsigned int cmd, void *arg); +extern int arp_ioctl(unsigned int cmd, void __user *arg); extern void arp_send(int type, int ptype, u32 dest_ip, struct net_device *dev, u32 src_ip, unsigned char *dest_hw, unsigned char *src_hw, unsigned char *th); diff -urN linux-2.6.7-rc2/include/net/ax25.h linux-2.6.7-rc3/include/net/ax25.h --- linux-2.6.7-rc2/include/net/ax25.h 2004-05-09 19:32:53.000000000 -0700 +++ linux-2.6.7-rc3/include/net/ax25.h 2004-06-07 12:55:24.644518611 -0700 @@ -312,7 +312,7 @@ /* ax25_route.c */ extern void ax25_rt_device_down(struct net_device *); -extern int ax25_rt_ioctl(unsigned int, void *); +extern int ax25_rt_ioctl(unsigned int, void __user *); extern struct file_operations ax25_route_fops; extern int ax25_rt_autobind(ax25_cb *, ax25_address *); extern ax25_route *ax25_rt_find_route(ax25_route *, ax25_address *, diff -urN linux-2.6.7-rc2/include/net/bluetooth/bluetooth.h linux-2.6.7-rc3/include/net/bluetooth/bluetooth.h --- linux-2.6.7-rc2/include/net/bluetooth/bluetooth.h 2004-05-09 19:32:28.000000000 -0700 +++ linux-2.6.7-rc3/include/net/bluetooth/bluetooth.h 2004-06-07 12:55:24.651518901 -0700 @@ -22,10 +22,6 @@ SOFTWARE IS DISCLAIMED. */ -/* - * $Id: bluetooth.h,v 1.8 2002/04/17 17:37:20 maxk Exp $ - */ - #ifndef __BLUETOOTH_H #define __BLUETOOTH_H @@ -41,26 +37,27 @@ #endif /* Reserv for core and drivers use */ -#define BT_SKB_RESERVE 8 +#define BT_SKB_RESERVE 8 -#define BTPROTO_L2CAP 0 -#define BTPROTO_HCI 1 -#define BTPROTO_SCO 2 +#define BTPROTO_L2CAP 0 +#define BTPROTO_HCI 1 +#define BTPROTO_SCO 2 #define BTPROTO_RFCOMM 3 #define BTPROTO_BNEP 4 #define BTPROTO_CMTP 5 +#define BTPROTO_HIDP 6 -#define SOL_HCI 0 -#define SOL_L2CAP 6 -#define SOL_SCO 17 -#define SOL_RFCOMM 18 +#define SOL_HCI 0 +#define SOL_L2CAP 6 +#define SOL_SCO 17 +#define SOL_RFCOMM 18 #define BT_INFO(fmt, arg...) printk(KERN_INFO "Bluetooth: " fmt "\n" , ## arg) #define BT_DBG(fmt, arg...) printk(KERN_INFO "%s: " fmt "\n" , __FUNCTION__ , ## arg) #define BT_ERR(fmt, arg...) printk(KERN_ERR "%s: " fmt "\n" , __FUNCTION__ , ## arg) #ifdef HCI_DATA_DUMP -#define BT_DMP(buf, len) bt_dump(__FUNCTION__, buf, len) +#define BT_DMP(buf, len) bt_dump(__FUNCTION__, buf, len) #else #define BT_DMP(D...) #endif @@ -122,7 +119,7 @@ struct bt_sock_list { struct hlist_head head; - rwlock_t lock; + rwlock_t lock; }; int bt_sock_register(int proto, struct net_proto_family *ops); @@ -139,7 +136,7 @@ /* Skb helpers */ struct bt_skb_cb { - int incoming; + int incoming; }; #define bt_cb(skb) ((struct bt_skb_cb *)(skb->cb)) @@ -155,7 +152,7 @@ } static inline struct sk_buff *bt_skb_send_alloc(struct sock *sk, unsigned long len, - int nb, int *err) + int nb, int *err) { struct sk_buff *skb; @@ -178,6 +175,6 @@ void bt_dump(char *pref, __u8 *buf, int count); -int bt_err(__u16 code); +int bt_err(__u16 code); #endif /* __BLUETOOTH_H */ diff -urN linux-2.6.7-rc2/include/net/bluetooth/hci.h linux-2.6.7-rc3/include/net/bluetooth/hci.h --- linux-2.6.7-rc2/include/net/bluetooth/hci.h 2004-05-09 19:33:19.000000000 -0700 +++ linux-2.6.7-rc3/include/net/bluetooth/hci.h 2004-06-07 12:55:24.693520640 -0700 @@ -22,10 +22,6 @@ SOFTWARE IS DISCLAIMED. */ -/* - * $Id: hci.h,v 1.4 2002/04/18 22:26:15 maxk Exp $ - */ - #ifndef __HCI_H #define __HCI_H diff -urN linux-2.6.7-rc2/include/net/bluetooth/hci_core.h linux-2.6.7-rc3/include/net/bluetooth/hci_core.h --- linux-2.6.7-rc2/include/net/bluetooth/hci_core.h 2004-05-09 19:32:37.000000000 -0700 +++ linux-2.6.7-rc3/include/net/bluetooth/hci_core.h 2004-06-07 12:55:24.694520682 -0700 @@ -22,10 +22,6 @@ SOFTWARE IS DISCLAIMED. */ -/* - * $Id: hci_core.h,v 1.3 2002/04/17 18:55:21 maxk Exp $ - */ - #ifndef __HCI_CORE_H #define __HCI_CORE_H @@ -63,12 +59,12 @@ struct hci_dev { struct list_head list; spinlock_t lock; - atomic_t refcnt; + atomic_t refcnt; char name[8]; unsigned long flags; __u16 id; - __u8 type; + __u8 type; bdaddr_t bdaddr; __u8 features[8]; __u16 voice_setting; @@ -79,38 +75,38 @@ unsigned long quirks; - atomic_t cmd_cnt; - unsigned int acl_cnt; - unsigned int sco_cnt; + atomic_t cmd_cnt; + unsigned int acl_cnt; + unsigned int sco_cnt; unsigned int acl_mtu; - unsigned int sco_mtu; + unsigned int sco_mtu; unsigned int acl_pkts; unsigned int sco_pkts; - unsigned long cmd_last_tx; - unsigned long acl_last_tx; - unsigned long sco_last_tx; + unsigned long cmd_last_tx; + unsigned long acl_last_tx; + unsigned long sco_last_tx; - struct tasklet_struct cmd_task; + struct tasklet_struct cmd_task; struct tasklet_struct rx_task; - struct tasklet_struct tx_task; + struct tasklet_struct tx_task; struct sk_buff_head rx_q; - struct sk_buff_head raw_q; - struct sk_buff_head cmd_q; + struct sk_buff_head raw_q; + struct sk_buff_head cmd_q; - struct sk_buff *sent_cmd; + struct sk_buff *sent_cmd; struct semaphore req_lock; wait_queue_head_t req_wait_q; __u32 req_status; __u32 req_result; - struct inquiry_cache inq_cache; - struct hci_conn_hash conn_hash; + struct inquiry_cache inq_cache; + struct hci_conn_hash conn_hash; - struct hci_dev_stats stat; + struct hci_dev_stats stat; void *driver_data; void *core_data; @@ -118,12 +114,12 @@ atomic_t promisc; #ifdef CONFIG_PROC_FS - struct proc_dir_entry *proc; + struct proc_dir_entry *proc; #endif struct class_device class_dev; - struct module *owner; + struct module *owner; int (*open)(struct hci_dev *hdev); int (*close)(struct hci_dev *hdev); @@ -140,9 +136,9 @@ atomic_t refcnt; spinlock_t lock; - bdaddr_t dst; - __u16 handle; - __u16 state; + bdaddr_t dst; + __u16 handle; + __u16 state; __u8 type; __u8 out; __u32 link_mode; @@ -154,12 +150,12 @@ struct timer_list timer; - struct hci_dev *hdev; + struct hci_dev *hdev; void *l2cap_data; void *sco_data; void *priv; - struct hci_conn *link; + struct hci_conn *link; }; extern struct hci_proto *hci_proto[]; @@ -215,7 +211,7 @@ struct hci_conn_hash *h = &hdev->conn_hash; INIT_LIST_HEAD(&h->list); spin_lock_init(&h->lock); - h->num = 0; + h->num = 0; } static inline void hci_conn_hash_add(struct hci_dev *hdev, struct hci_conn *c) @@ -233,7 +229,7 @@ } static inline struct hci_conn *hci_conn_hash_lookup_handle(struct hci_dev *hdev, - __u16 handle) + __u16 handle) { struct hci_conn_hash *h = &hdev->conn_hash; struct list_head *p; @@ -244,7 +240,7 @@ if (c->handle == handle) return c; } - return NULL; + return NULL; } static inline struct hci_conn *hci_conn_hash_lookup_ba(struct hci_dev *hdev, @@ -259,7 +255,7 @@ if (c->type == type && !bacmp(&c->dst, ba)) return c; } - return NULL; + return NULL; } void hci_acl_connect(struct hci_conn *conn); @@ -362,12 +358,12 @@ int hci_dev_close(__u16 dev); int hci_dev_reset(__u16 dev); int hci_dev_reset_stat(__u16 dev); -int hci_dev_cmd(unsigned int cmd, unsigned long arg); -int hci_get_dev_list(unsigned long arg); -int hci_get_dev_info(unsigned long arg); -int hci_get_conn_list(unsigned long arg); -int hci_get_conn_info(struct hci_dev *hdev, unsigned long arg); -int hci_inquiry(unsigned long arg); +int hci_dev_cmd(unsigned int cmd, void __user *arg); +int hci_get_dev_list(void __user *arg); +int hci_get_dev_info(void __user *arg); +int hci_get_conn_list(void __user *arg); +int hci_get_conn_info(struct hci_dev *hdev, void __user *arg); +int hci_inquiry(void __user *arg); void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb); @@ -506,7 +502,7 @@ /* HCI info for socket */ #define hci_pi(sk) ((struct hci_pinfo *)sk->sk_protinfo) struct hci_pinfo { - struct hci_dev *hdev; + struct hci_dev *hdev; struct hci_filter filter; __u32 cmsg_mask; }; diff -urN linux-2.6.7-rc2/include/net/bluetooth/l2cap.h linux-2.6.7-rc3/include/net/bluetooth/l2cap.h --- linux-2.6.7-rc2/include/net/bluetooth/l2cap.h 2004-05-09 19:32:02.000000000 -0700 +++ linux-2.6.7-rc3/include/net/bluetooth/l2cap.h 2004-06-07 12:55:24.694520682 -0700 @@ -22,18 +22,14 @@ SOFTWARE IS DISCLAIMED. */ -/* - * $Id: l2cap.h,v 1.1.1.1 2002/03/08 21:03:15 maxk Exp $ - */ - #ifndef __L2CAP_H #define __L2CAP_H /* L2CAP defaults */ -#define L2CAP_DEFAULT_MTU 672 +#define L2CAP_DEFAULT_MTU 672 #define L2CAP_DEFAULT_FLUSH_TO 0xFFFF -#define L2CAP_CONN_TIMEOUT (HZ * 40) +#define L2CAP_CONN_TIMEOUT (HZ * 40) /* L2CAP socket address */ struct sockaddr_l2 { @@ -190,10 +186,10 @@ struct l2cap_conn { struct hci_conn *hcon; - bdaddr_t *dst; - bdaddr_t *src; + bdaddr_t *dst; + bdaddr_t *src; - unsigned int mtu; + unsigned int mtu; spinlock_t lock; @@ -227,9 +223,9 @@ __u16 sport; - struct l2cap_conn *conn; - struct sock *next_c; - struct sock *prev_c; + struct l2cap_conn *conn; + struct sock *next_c; + struct sock *prev_c; }; #define L2CAP_CONF_REQ_SENT 0x01 diff -urN linux-2.6.7-rc2/include/net/bluetooth/rfcomm.h linux-2.6.7-rc3/include/net/bluetooth/rfcomm.h --- linux-2.6.7-rc2/include/net/bluetooth/rfcomm.h 2004-05-09 19:33:12.000000000 -0700 +++ linux-2.6.7-rc3/include/net/bluetooth/rfcomm.h 2004-06-07 12:55:24.694520682 -0700 @@ -21,14 +21,6 @@ SOFTWARE IS DISCLAIMED. */ -/* - RPN support - Dirk Husemann -*/ - -/* - * $Id: rfcomm.h,v 1.29 2002/10/02 20:26:17 maxk Exp $ - */ - #ifndef __RFCOMM_H #define __RFCOMM_H @@ -356,7 +348,7 @@ struct rfcomm_dev_info dev_info[0]; }; -int rfcomm_dev_ioctl(struct sock *sk, unsigned int cmd, unsigned long arg); +int rfcomm_dev_ioctl(struct sock *sk, unsigned int cmd, void __user *arg); int rfcomm_init_ttys(void); void rfcomm_cleanup_ttys(void); diff -urN linux-2.6.7-rc2/include/net/bluetooth/sco.h linux-2.6.7-rc3/include/net/bluetooth/sco.h --- linux-2.6.7-rc2/include/net/bluetooth/sco.h 2004-05-09 19:32:02.000000000 -0700 +++ linux-2.6.7-rc3/include/net/bluetooth/sco.h 2004-06-07 12:55:24.695520723 -0700 @@ -22,19 +22,15 @@ SOFTWARE IS DISCLAIMED. */ -/* - * $Id: sco.h,v 1.1.1.1 2002/03/08 21:03:15 maxk Exp $ - */ - #ifndef __SCO_H #define __SCO_H /* SCO defaults */ -#define SCO_DEFAULT_MTU 500 +#define SCO_DEFAULT_MTU 500 #define SCO_DEFAULT_FLUSH_TO 0xFFFF -#define SCO_CONN_TIMEOUT (HZ * 40) -#define SCO_DISCONN_TIMEOUT (HZ * 2) +#define SCO_CONN_TIMEOUT (HZ * 40) +#define SCO_DISCONN_TIMEOUT (HZ * 2) #define SCO_CONN_IDLE_TIMEOUT (HZ * 60) /* SCO socket address */ diff -urN linux-2.6.7-rc2/include/net/checksum.h linux-2.6.7-rc3/include/net/checksum.h --- linux-2.6.7-rc2/include/net/checksum.h 2004-05-09 19:32:26.000000000 -0700 +++ linux-2.6.7-rc3/include/net/checksum.h 2004-06-07 12:55:24.695520723 -0700 @@ -95,7 +95,7 @@ #ifndef _HAVE_ARCH_COPY_AND_CSUM_FROM_USER static inline -unsigned int csum_and_copy_from_user (const char *src, char *dst, +unsigned int csum_and_copy_from_user (const char __user *src, char *dst, int len, int sum, int *err_ptr) { if (verify_area(VERIFY_READ, src, len) == 0) @@ -110,7 +110,7 @@ #ifndef HAVE_CSUM_COPY_USER static __inline__ unsigned int csum_and_copy_to_user -(const char *src, char *dst, int len, unsigned int sum, int *err_ptr) +(const char *src, char __user *dst, int len, unsigned int sum, int *err_ptr) { sum = csum_partial(src, len, sum); diff -urN linux-2.6.7-rc2/include/net/compat.h linux-2.6.7-rc3/include/net/compat.h --- linux-2.6.7-rc2/include/net/compat.h 2004-05-09 19:32:26.000000000 -0700 +++ linux-2.6.7-rc3/include/net/compat.h 2004-06-07 12:55:24.715521552 -0700 @@ -29,9 +29,9 @@ extern int get_compat_msghdr(struct msghdr *, struct compat_msghdr __user *); extern int verify_compat_iovec(struct msghdr *, struct iovec *, char *, int); -extern asmlinkage long compat_sys_sendmsg(int,struct compat_msghdr *,unsigned); -extern asmlinkage long compat_sys_recvmsg(int,struct compat_msghdr *,unsigned); -extern asmlinkage long compat_sys_getsockopt(int, int, int, char *, int *); +extern asmlinkage long compat_sys_sendmsg(int,struct compat_msghdr __user *,unsigned); +extern asmlinkage long compat_sys_recvmsg(int,struct compat_msghdr __user *,unsigned); +extern asmlinkage long compat_sys_getsockopt(int, int, int, char __user *, int __user *); extern int put_cmsg_compat(struct msghdr*, int, int, int, void *); extern int cmsghdr_from_user_compat_to_kern(struct msghdr *, unsigned char *, int); diff -urN linux-2.6.7-rc2/include/net/dn_dev.h linux-2.6.7-rc3/include/net/dn_dev.h --- linux-2.6.7-rc2/include/net/dn_dev.h 2004-05-09 19:31:58.000000000 -0700 +++ linux-2.6.7-rc3/include/net/dn_dev.h 2004-06-07 12:55:24.716521593 -0700 @@ -155,7 +155,7 @@ extern void dn_dev_init(void); extern void dn_dev_cleanup(void); -extern int dn_dev_ioctl(unsigned int cmd, void *arg); +extern int dn_dev_ioctl(unsigned int cmd, void __user *arg); extern void dn_dev_devices_off(void); extern void dn_dev_devices_on(void); diff -urN linux-2.6.7-rc2/include/net/dst.h linux-2.6.7-rc3/include/net/dst.h --- linux-2.6.7-rc2/include/net/dst.h 2004-05-09 19:33:20.000000000 -0700 +++ linux-2.6.7-rc3/include/net/dst.h 2004-06-07 12:55:24.734522339 -0700 @@ -67,7 +67,7 @@ struct xfrm_state *xfrm; int (*input)(struct sk_buff*); - int (*output)(struct sk_buff*); + int (*output)(struct sk_buff**); #ifdef CONFIG_NET_CLS_ROUTE __u32 tclassid; @@ -219,7 +219,7 @@ int err; for (;;) { - err = skb->dst->output(skb); + err = skb->dst->output(&skb); if (likely(err == 0)) return err; diff -urN linux-2.6.7-rc2/include/net/ip.h linux-2.6.7-rc3/include/net/ip.h --- linux-2.6.7-rc2/include/net/ip.h 2004-06-07 12:54:52.751197638 -0700 +++ linux-2.6.7-rc3/include/net/ip.h 2004-06-07 12:55:24.735522380 -0700 @@ -92,8 +92,8 @@ struct packet_type *pt); extern int ip_local_deliver(struct sk_buff *skb); extern int ip_mr_input(struct sk_buff *skb); -extern int ip_output(struct sk_buff *skb); -extern int ip_mc_output(struct sk_buff *skb); +extern int ip_output(struct sk_buff **pskb); +extern int ip_mc_output(struct sk_buff **pskb); extern int ip_fragment(struct sk_buff *skb, int (*out)(struct sk_buff*)); extern int ip_do_nat(struct sk_buff *skb); extern void ip_send_check(struct iphdr *ip); @@ -150,7 +150,7 @@ }; extern struct ipv4_config ipv4_config; -DECLARE_SNMP_STAT(struct ip_mib, ip_statistics); +DECLARE_SNMP_STAT(struct ipstats_mib, ip_statistics); #define IP_INC_STATS(field) SNMP_INC_STATS(ip_statistics, field) #define IP_INC_STATS_BH(field) SNMP_INC_STATS_BH(ip_statistics, field) #define IP_INC_STATS_USER(field) SNMP_INC_STATS_USER(ip_statistics, field) @@ -300,11 +300,11 @@ * fed into the routing cache should use these handlers. */ int ipv4_doint_and_flush(ctl_table *ctl, int write, - struct file* filp, void *buffer, + struct file* filp, void __user *buffer, size_t *lenp); -int ipv4_doint_and_flush_strategy(ctl_table *table, int *name, int nlen, - void *oldval, size_t *oldlenp, - void *newval, size_t newlen, +int ipv4_doint_and_flush_strategy(ctl_table *table, int __user *name, int nlen, + void __user *oldval, size_t __user *oldlenp, + void __user *newval, size_t newlen, void **context); #endif /* _IP_H */ diff -urN linux-2.6.7-rc2/include/net/ip6_fib.h linux-2.6.7-rc3/include/net/ip6_fib.h --- linux-2.6.7-rc2/include/net/ip6_fib.h 2004-05-09 19:32:54.000000000 -0700 +++ linux-2.6.7-rc3/include/net/ip6_fib.h 2004-06-07 12:55:24.735522380 -0700 @@ -57,6 +57,8 @@ struct rt6_info *next; } u; + struct inet6_dev *rt6i_idev; + #define rt6i_dev u.dst.dev #define rt6i_nexthop u.dst.neighbour #define rt6i_expires u.dst.expires diff -urN linux-2.6.7-rc2/include/net/ip6_route.h linux-2.6.7-rc3/include/net/ip6_route.h --- linux-2.6.7-rc2/include/net/ip6_route.h 2004-05-09 19:32:26.000000000 -0700 +++ linux-2.6.7-rc3/include/net/ip6_route.h 2004-06-07 12:55:24.736522422 -0700 @@ -35,7 +35,7 @@ extern void ip6_route_init(void); extern void ip6_route_cleanup(void); -extern int ipv6_route_ioctl(unsigned int cmd, void *arg); +extern int ipv6_route_ioctl(unsigned int cmd, void __user *arg); extern int ip6_route_add(struct in6_rtmsg *rtmsg, struct nlmsghdr *, @@ -65,7 +65,7 @@ extern struct dst_entry *ndisc_dst_alloc(struct net_device *dev, struct neighbour *neigh, struct in6_addr *addr, - int (*output)(struct sk_buff *)); + int (*output)(struct sk_buff **)); extern int ndisc_dst_gc(int *more); extern void fib6_force_start_gc(void); diff -urN linux-2.6.7-rc2/include/net/ipv6.h linux-2.6.7-rc3/include/net/ipv6.h --- linux-2.6.7-rc2/include/net/ipv6.h 2004-06-07 12:54:52.751197638 -0700 +++ linux-2.6.7-rc3/include/net/ipv6.h 2004-06-07 12:55:24.738522504 -0700 @@ -111,7 +111,7 @@ extern int sysctl_mld_max_msf; /* MIBs */ -DECLARE_SNMP_STAT(struct ipv6_mib, ipv6_statistics); +DECLARE_SNMP_STAT(struct ipstats_mib, ipv6_statistics); #define IP6_INC_STATS(field) SNMP_INC_STATS(ipv6_statistics, field) #define IP6_INC_STATS_BH(field) SNMP_INC_STATS_BH(ipv6_statistics, field) #define IP6_INC_STATS_USER(field) SNMP_INC_STATS_USER(ipv6_statistics, field) @@ -355,8 +355,8 @@ * skb processing functions */ -extern int ip6_output(struct sk_buff *skb); -extern int ip6_output2(struct sk_buff *skb); +extern int ip6_output(struct sk_buff **pskb); +extern int ip6_output2(struct sk_buff **pskb); extern int ip6_forward(struct sk_buff *skb); extern int ip6_input(struct sk_buff *skb); extern int ip6_mc_input(struct sk_buff *skb); diff -urN linux-2.6.7-rc2/include/net/netrom.h linux-2.6.7-rc3/include/net/netrom.h --- linux-2.6.7-rc2/include/net/netrom.h 2004-05-09 19:32:37.000000000 -0700 +++ linux-2.6.7-rc3/include/net/netrom.h 2004-06-07 12:55:24.745522794 -0700 @@ -206,7 +206,7 @@ extern void nr_rt_device_down(struct net_device *); extern struct net_device *nr_dev_first(void); extern struct net_device *nr_dev_get(ax25_address *); -extern int nr_rt_ioctl(unsigned int, void *); +extern int nr_rt_ioctl(unsigned int, void __user *); extern void nr_link_failed(ax25_cb *, int); extern int nr_route_frame(struct sk_buff *, ax25_cb *); extern struct file_operations nr_nodes_fops; diff -urN linux-2.6.7-rc2/include/net/rose.h linux-2.6.7-rc3/include/net/rose.h --- linux-2.6.7-rc2/include/net/rose.h 2004-05-09 19:32:01.000000000 -0700 +++ linux-2.6.7-rc3/include/net/rose.h 2004-06-07 12:55:24.746522836 -0700 @@ -207,7 +207,7 @@ extern struct rose_route *rose_route_free_lci(unsigned int, struct rose_neigh *); extern struct net_device *rose_ax25_dev_get(char *); extern struct rose_neigh *rose_get_neigh(rose_address *, unsigned char *, unsigned char *); -extern int rose_rt_ioctl(unsigned int, void *); +extern int rose_rt_ioctl(unsigned int, void __user *); extern void rose_link_failed(ax25_cb *, int); extern int rose_route_frame(struct sk_buff *, ax25_cb *); extern void rose_rt_free(void); diff -urN linux-2.6.7-rc2/include/net/route.h linux-2.6.7-rc3/include/net/route.h --- linux-2.6.7-rc2/include/net/route.h 2004-05-09 19:31:57.000000000 -0700 +++ linux-2.6.7-rc3/include/net/route.h 2004-06-07 12:55:24.746522836 -0700 @@ -55,6 +55,8 @@ struct rtable *rt_next; } u; + struct in_device *idev; + unsigned rt_flags; unsigned rt_type; diff -urN linux-2.6.7-rc2/include/net/sctp/command.h linux-2.6.7-rc3/include/net/sctp/command.h --- linux-2.6.7-rc2/include/net/sctp/command.h 2004-05-09 19:33:21.000000000 -0700 +++ linux-2.6.7-rc3/include/net/sctp/command.h 2004-06-07 12:55:24.765523623 -0700 @@ -93,6 +93,7 @@ SCTP_CMD_PROCESS_OPERR, /* Process an ERROR chunk. */ SCTP_CMD_REPORT_FWDTSN, /* Report new cumulative TSN Ack. */ SCTP_CMD_PROCESS_FWDTSN, /* Skips were reported, so process further. */ + SCTP_CMD_CLEAR_INIT_TAG, /* Clears association peer's inittag. */ SCTP_CMD_LAST } sctp_verb_t; diff -urN linux-2.6.7-rc2/include/net/sctp/sm.h linux-2.6.7-rc3/include/net/sctp/sm.h --- linux-2.6.7-rc2/include/net/sctp/sm.h 2004-05-09 19:32:29.000000000 -0700 +++ linux-2.6.7-rc3/include/net/sctp/sm.h 2004-06-07 12:55:24.781524286 -0700 @@ -440,6 +440,23 @@ BUG(); } +/* Check VTAG of the packet matches the sender's own tag. */ +static inline int +sctp_vtag_verify(const struct sctp_chunk *chunk, + const struct sctp_association *asoc) +{ + /* RFC 2960 Sec 8.5 When receiving an SCTP packet, the endpoint + * MUST ensure that the value in the Verification Tag field of + * the received SCTP packet matches its own Tag. If the received + * Verification Tag value does not match the receiver's own + * tag value, the receiver shall silently discard the packet... + */ + if (ntohl(chunk->sctp_hdr->vtag) == asoc->c.my_vtag) + return 1; + + return 0; +} + /* Check VTAG of the packet matches the sender's own tag OR its peer's * tag and the T bit is set in the Chunk Flags. */ diff -urN linux-2.6.7-rc2/include/net/sctp/structs.h linux-2.6.7-rc3/include/net/sctp/structs.h --- linux-2.6.7-rc2/include/net/sctp/structs.h 2004-05-09 19:33:21.000000000 -0700 +++ linux-2.6.7-rc3/include/net/sctp/structs.h 2004-06-07 12:55:24.800525073 -0700 @@ -437,13 +437,13 @@ int (*setsockopt) (struct sock *sk, int level, int optname, - char *optval, + char __user *optval, int optlen); int (*getsockopt) (struct sock *sk, int level, int optname, - char *optval, - int *optlen); + char __user *optval, + int __user *optlen); struct dst_entry *(*get_dst) (struct sctp_association *asoc, union sctp_addr *daddr, union sctp_addr *saddr); diff -urN linux-2.6.7-rc2/include/net/sctp/user.h linux-2.6.7-rc3/include/net/sctp/user.h --- linux-2.6.7-rc2/include/net/sctp/user.h 2004-05-09 19:31:58.000000000 -0700 +++ linux-2.6.7-rc3/include/net/sctp/user.h 2004-06-07 12:55:24.800525073 -0700 @@ -559,7 +559,7 @@ struct sctp_getaddrs { sctp_assoc_t assoc_id; int addr_num; - struct sockaddr *addrs; + struct sockaddr __user *addrs; }; /* These are bit fields for msghdr->msg_flags. See section 5.1. */ diff -urN linux-2.6.7-rc2/include/net/snmp.h linux-2.6.7-rc3/include/net/snmp.h --- linux-2.6.7-rc2/include/net/snmp.h 2004-05-09 19:32:28.000000000 -0700 +++ linux-2.6.7-rc3/include/net/snmp.h 2004-06-07 12:55:24.801525114 -0700 @@ -41,61 +41,52 @@ * cacheline machine it makes a *lot* of sense -AK */ - +struct snmp_item { + char *name; + int offset; +}; + +#define SNMP_ITEM(mib,entry,procname) { \ + .name = procname, \ + .offset = offsetof(mib, entry), \ +} + +#define SNMP_ITEM_SENTINEL { \ + .name = NULL, \ + .offset = 0, \ +} + /* * RFC 1213: MIB-II * RFC 2011 (updates 1213): SNMPv2-MIB-IP * RFC 2863: Interfaces Group MIB - */ -struct ip_mib -{ - unsigned long IpInReceives; - unsigned long IpInHdrErrors; - unsigned long IpInAddrErrors; - unsigned long IpForwDatagrams; - unsigned long IpInUnknownProtos; - unsigned long IpInDiscards; - unsigned long IpInDelivers; - unsigned long IpOutRequests; - unsigned long IpOutDiscards; - unsigned long IpOutNoRoutes; - unsigned long IpReasmTimeout; - unsigned long IpReasmReqds; - unsigned long IpReasmOKs; - unsigned long IpReasmFails; - unsigned long IpFragOKs; - unsigned long IpFragFails; - unsigned long IpFragCreates; - unsigned long __pad[0]; -}; - -/* * RFC 2465: IPv6 MIB: General Group + * draft-ietf-ipv6-rfc2011-update-10.txt: MIB for IP: IP Statistics Tables */ -struct ipv6_mib +struct ipstats_mib { - unsigned long Ip6InReceives; - unsigned long Ip6InHdrErrors; - unsigned long Ip6InTooBigErrors; - unsigned long Ip6InNoRoutes; - unsigned long Ip6InAddrErrors; - unsigned long Ip6InUnknownProtos; - unsigned long Ip6InTruncatedPkts; - unsigned long Ip6InDiscards; - unsigned long Ip6InDelivers; - unsigned long Ip6OutForwDatagrams; - unsigned long Ip6OutRequests; - unsigned long Ip6OutDiscards; - unsigned long Ip6OutNoRoutes; - unsigned long Ip6ReasmTimeout; - unsigned long Ip6ReasmReqds; - unsigned long Ip6ReasmOKs; - unsigned long Ip6ReasmFails; - unsigned long Ip6FragOKs; - unsigned long Ip6FragFails; - unsigned long Ip6FragCreates; - unsigned long Ip6InMcastPkts; - unsigned long Ip6OutMcastPkts; + unsigned long InReceives; + unsigned long InHdrErrors; + unsigned long InTooBigErrors; + unsigned long InNoRoutes; + unsigned long InAddrErrors; + unsigned long InUnknownProtos; + unsigned long InTruncatedPkts; + unsigned long InDiscards; + unsigned long InDelivers; + unsigned long OutForwDatagrams; + unsigned long OutRequests; + unsigned long OutDiscards; + unsigned long OutNoRoutes; + unsigned long ReasmTimeout; + unsigned long ReasmReqds; + unsigned long ReasmOKs; + unsigned long ReasmFails; + unsigned long FragOKs; + unsigned long FragFails; + unsigned long FragCreates; + unsigned long InMcastPkts; + unsigned long OutMcastPkts; unsigned long __pad[0]; }; diff -urN linux-2.6.7-rc2/include/net/sock.h linux-2.6.7-rc3/include/net/sock.h --- linux-2.6.7-rc2/include/net/sock.h 2004-06-07 12:54:52.758197928 -0700 +++ linux-2.6.7-rc3/include/net/sock.h 2004-06-07 12:55:24.802525156 -0700 @@ -1049,7 +1049,7 @@ } } -extern int sock_get_timestamp(struct sock *, struct timeval *); +extern int sock_get_timestamp(struct sock *, struct timeval __user *); /* * Enable debug/info messages diff -urN linux-2.6.7-rc2/include/net/tcp.h linux-2.6.7-rc3/include/net/tcp.h --- linux-2.6.7-rc2/include/net/tcp.h 2004-06-07 12:54:52.764198177 -0700 +++ linux-2.6.7-rc3/include/net/tcp.h 2004-06-07 12:55:24.803525197 -0700 @@ -970,6 +970,9 @@ extern const char timer_bug_msg[]; +/* tcp_diag.c */ +extern void tcp_get_info(struct sock *, struct tcp_info *); + /* Read 'sendfile()'-style from a TCP socket */ typedef int (*sk_read_actor_t)(read_descriptor_t *, struct sk_buff *, unsigned int, size_t); diff -urN linux-2.6.7-rc2/include/net/x25.h linux-2.6.7-rc3/include/net/x25.h --- linux-2.6.7-rc2/include/net/x25.h 2004-05-09 19:32:52.000000000 -0700 +++ linux-2.6.7-rc3/include/net/x25.h 2004-06-07 12:55:24.804525238 -0700 @@ -196,7 +196,7 @@ extern void x25_transmit_diagnostic(struct x25_neigh *, unsigned char); extern void x25_transmit_clear_request(struct x25_neigh *, unsigned int, unsigned char); extern void x25_transmit_link(struct sk_buff *, struct x25_neigh *); -extern int x25_subscr_ioctl(unsigned int, void *); +extern int x25_subscr_ioctl(unsigned int, void __user *); extern struct x25_neigh *x25_get_neigh(struct net_device *); extern void x25_link_free(void); @@ -221,7 +221,7 @@ extern struct x25_route *x25_get_route(struct x25_address *addr); extern struct net_device *x25_dev_get(char *); extern void x25_route_device_down(struct net_device *dev); -extern int x25_route_ioctl(unsigned int, void *); +extern int x25_route_ioctl(unsigned int, void __user *); extern void x25_route_free(void); static __inline__ void x25_route_hold(struct x25_route *rt) diff -urN linux-2.6.7-rc2/include/net/xfrm.h linux-2.6.7-rc3/include/net/xfrm.h --- linux-2.6.7-rc2/include/net/xfrm.h 2004-06-07 12:54:52.765198218 -0700 +++ linux-2.6.7-rc3/include/net/xfrm.h 2004-06-07 12:55:24.851527185 -0700 @@ -216,7 +216,7 @@ void (*destructor)(struct xfrm_state *); int (*input)(struct xfrm_state *, struct xfrm_decap_state *, struct sk_buff *skb); int (*post_input)(struct xfrm_state *, struct xfrm_decap_state *, struct sk_buff *skb); - int (*output)(struct sk_buff *skb); + int (*output)(struct sk_buff **pskb); /* Estimate maximal size of result of transformation of a dgram */ u32 (*get_max_size)(struct xfrm_state *, int size); }; diff -urN linux-2.6.7-rc2/include/sound/ainstr_gf1.h linux-2.6.7-rc3/include/sound/ainstr_gf1.h --- linux-2.6.7-rc2/include/sound/ainstr_gf1.h 2004-05-09 19:32:54.000000000 -0700 +++ linux-2.6.7-rc3/include/sound/ainstr_gf1.h 2004-06-07 12:55:25.093537210 -0700 @@ -209,9 +209,9 @@ void *private_data; int (*info)(void *private_data, gf1_info_t *info); int (*put_sample)(void *private_data, gf1_wave_t *wave, - char *data, long len, int atomic); + char __user *data, long len, int atomic); int (*get_sample)(void *private_data, gf1_wave_t *wave, - char *data, long len, int atomic); + char __user *data, long len, int atomic); int (*remove_sample)(void *private_data, gf1_wave_t *wave, int atomic); void (*notify)(void *private_data, snd_seq_kinstr_t *instr, int what); diff -urN linux-2.6.7-rc2/include/sound/ainstr_iw.h linux-2.6.7-rc3/include/sound/ainstr_iw.h --- linux-2.6.7-rc2/include/sound/ainstr_iw.h 2004-05-09 19:31:59.000000000 -0700 +++ linux-2.6.7-rc3/include/sound/ainstr_iw.h 2004-06-07 12:55:25.111537955 -0700 @@ -357,9 +357,9 @@ void *private_data; int (*info)(void *private_data, iwffff_info_t *info); int (*put_sample)(void *private_data, iwffff_wave_t *wave, - char *data, long len, int atomic); + char __user *data, long len, int atomic); int (*get_sample)(void *private_data, iwffff_wave_t *wave, - char *data, long len, int atomic); + char __user *data, long len, int atomic); int (*remove_sample)(void *private_data, iwffff_wave_t *wave, int atomic); void (*notify)(void *private_data, snd_seq_kinstr_t *instr, int what); diff -urN linux-2.6.7-rc2/include/sound/ainstr_simple.h linux-2.6.7-rc3/include/sound/ainstr_simple.h --- linux-2.6.7-rc2/include/sound/ainstr_simple.h 2004-05-09 19:33:13.000000000 -0700 +++ linux-2.6.7-rc3/include/sound/ainstr_simple.h 2004-06-07 12:55:25.132538825 -0700 @@ -140,9 +140,9 @@ void *private_data; int (*info)(void *private_data, simple_instrument_info_t *info); int (*put_sample)(void *private_data, simple_instrument_t *instr, - char *data, long len, int atomic); + char __user *data, long len, int atomic); int (*get_sample)(void *private_data, simple_instrument_t *instr, - char *data, long len, int atomic); + char __user *data, long len, int atomic); int (*remove_sample)(void *private_data, simple_instrument_t *instr, int atomic); void (*notify)(void *private_data, snd_seq_kinstr_t *instr, int what); diff -urN linux-2.6.7-rc2/include/sound/asound.h linux-2.6.7-rc3/include/sound/asound.h --- linux-2.6.7-rc2/include/sound/asound.h 2004-06-07 12:54:52.829200869 -0700 +++ linux-2.6.7-rc3/include/sound/asound.h 2004-06-07 12:55:25.141539198 -0700 @@ -135,7 +135,7 @@ struct sndrv_hwdep_dsp_image { unsigned int index; /* W: DSP index */ unsigned char name[64]; /* W: ID (e.g. file name) */ - unsigned char *image; /* W: binary image */ + unsigned char __user *image; /* W: binary image */ size_t length; /* W: size of image in bytes */ unsigned long driver_data; /* W: driver-specific data */ }; @@ -446,13 +446,13 @@ struct sndrv_xferi { sndrv_pcm_sframes_t result; - void *buf; + void __user *buf; sndrv_pcm_uframes_t frames; }; struct sndrv_xfern { sndrv_pcm_sframes_t result; - void **bufs; + void __user * __user *bufs; sndrv_pcm_uframes_t frames; }; @@ -776,7 +776,7 @@ unsigned int space; /* W: count of element IDs to get */ unsigned int used; /* R: count of element IDs set */ unsigned int count; /* R: count of all elements */ - struct sndrv_ctl_elem_id *pids; /* R: IDs */ + struct sndrv_ctl_elem_id __user *pids; /* R: IDs */ unsigned char reserved[50]; }; diff -urN linux-2.6.7-rc2/include/sound/core.h linux-2.6.7-rc3/include/sound/core.h --- linux-2.6.7-rc2/include/sound/core.h 2004-06-07 12:54:52.830200910 -0700 +++ linux-2.6.7-rc3/include/sound/core.h 2004-06-07 12:55:25.142539239 -0700 @@ -302,8 +302,8 @@ #endif void *snd_kcalloc(size_t size, int flags); char *snd_kmalloc_strdup(const char *string, int flags); -int copy_to_user_fromio(void *dst, unsigned long src, size_t count); -int copy_from_user_toio(unsigned long dst, const void *src, size_t count); +int copy_to_user_fromio(void __user *dst, unsigned long src, size_t count); +int copy_from_user_toio(unsigned long dst, const void __user *src, size_t count); /* init.c */ diff -urN linux-2.6.7-rc2/include/sound/emu10k1.h linux-2.6.7-rc3/include/sound/emu10k1.h --- linux-2.6.7-rc2/include/sound/emu10k1.h 2004-06-07 12:54:52.836201159 -0700 +++ linux-2.6.7-rc3/include/sound/emu10k1.h 2004-06-07 12:55:25.199541600 -0700 @@ -1317,14 +1317,14 @@ unsigned int gpr_map[0x100]; /* initializers */ unsigned int gpr_add_control_count; /* count of GPR controls to add/replace */ - emu10k1_fx8010_control_gpr_t *gpr_add_controls; /* GPR controls to add/replace */ + emu10k1_fx8010_control_gpr_t __user *gpr_add_controls; /* GPR controls to add/replace */ unsigned int gpr_del_control_count; /* count of GPR controls to remove */ - snd_ctl_elem_id_t *gpr_del_controls; /* IDs of GPR controls to remove */ + snd_ctl_elem_id_t __user *gpr_del_controls; /* IDs of GPR controls to remove */ unsigned int gpr_list_control_count; /* count of GPR controls to list */ unsigned int gpr_list_control_total; /* total count of GPR controls */ - emu10k1_fx8010_control_gpr_t *gpr_list_controls; /* listed GPR controls */ + emu10k1_fx8010_control_gpr_t __user *gpr_list_controls; /* listed GPR controls */ unsigned long tram_valid[0xa0/(sizeof(unsigned long)*8)]; /* bitmask of valid initializers */ unsigned int tram_data_map[0xa0]; /* data initializers */ diff -urN linux-2.6.7-rc2/include/sound/emux_synth.h linux-2.6.7-rc3/include/sound/emux_synth.h --- linux-2.6.7-rc2/include/sound/emux_synth.h 2004-05-09 19:33:09.000000000 -0700 +++ linux-2.6.7-rc3/include/sound/emux_synth.h 2004-06-07 12:55:25.200541642 -0700 @@ -60,7 +60,7 @@ void (*free_voice)(snd_emux_voice_t *vp); void (*reset)(snd_emux_t *emu, int ch); /* the first parameters are snd_emux_t */ - int (*sample_new)(snd_emux_t *emu, snd_sf_sample_t *sp, snd_util_memhdr_t *hdr, const void *data, long count); + int (*sample_new)(snd_emux_t *emu, snd_sf_sample_t *sp, snd_util_memhdr_t *hdr, const void __user *data, long count); int (*sample_free)(snd_emux_t *emu, snd_sf_sample_t *sp, snd_util_memhdr_t *hdr); void (*sample_reset)(snd_emux_t *emu); int (*load_fx)(snd_emux_t *emu, int type, int arg, const void __user *data, long count); diff -urN linux-2.6.7-rc2/include/sound/gus.h linux-2.6.7-rc3/include/sound/gus.h --- linux-2.6.7-rc2/include/sound/gus.h 2004-05-09 19:31:59.000000000 -0700 +++ linux-2.6.7-rc3/include/sound/gus.h 2004-06-07 12:55:25.200541642 -0700 @@ -684,9 +684,9 @@ #endif /* gus_dram.c */ -int snd_gus_dram_write(snd_gus_card_t *gus, char *ptr, +int snd_gus_dram_write(snd_gus_card_t *gus, char __user *ptr, unsigned int addr, unsigned int size); -int snd_gus_dram_read(snd_gus_card_t *gus, char *ptr, +int snd_gus_dram_read(snd_gus_card_t *gus, char __user *ptr, unsigned int addr, unsigned int size, int rom); #if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE) @@ -699,21 +699,21 @@ /* gus_instr.c */ int snd_gus_iwffff_put_sample(void *private_data, iwffff_wave_t *wave, - char *data, long len, int atomic); + char __user *data, long len, int atomic); int snd_gus_iwffff_get_sample(void *private_data, iwffff_wave_t *wave, - char *data, long len, int atomic); + char __user *data, long len, int atomic); int snd_gus_iwffff_remove_sample(void *private_data, iwffff_wave_t *wave, int atomic); int snd_gus_gf1_put_sample(void *private_data, gf1_wave_t *wave, - char *data, long len, int atomic); + char __user *data, long len, int atomic); int snd_gus_gf1_get_sample(void *private_data, gf1_wave_t *wave, - char *data, long len, int atomic); + char __user *data, long len, int atomic); int snd_gus_gf1_remove_sample(void *private_data, gf1_wave_t *wave, int atomic); int snd_gus_simple_put_sample(void *private_data, simple_instrument_t *instr, - char *data, long len, int atomic); + char __user *data, long len, int atomic); int snd_gus_simple_get_sample(void *private_data, simple_instrument_t *instr, - char *data, long len, int atomic); + char __user *data, long len, int atomic); int snd_gus_simple_remove_sample(void *private_data, simple_instrument_t *instr, int atomic); diff -urN linux-2.6.7-rc2/include/sound/hdsp.h linux-2.6.7-rc3/include/sound/hdsp.h --- linux-2.6.7-rc2/include/sound/hdsp.h 2004-05-09 19:33:19.000000000 -0700 +++ linux-2.6.7-rc3/include/sound/hdsp.h 2004-06-07 12:55:25.201541683 -0700 @@ -76,7 +76,7 @@ typedef struct _snd_hdsp_firmware hdsp_firmware_t; struct _snd_hdsp_firmware { - unsigned long *firmware_data; /* 24413 long words */ + unsigned long __user *firmware_data; /* 24413 long words */ }; #define SNDRV_HDSP_IOCTL_UPLOAD_FIRMWARE _IOW('H', 0x42, hdsp_firmware_t) diff -urN linux-2.6.7-rc2/include/sound/hwdep.h linux-2.6.7-rc3/include/sound/hwdep.h --- linux-2.6.7-rc2/include/sound/hwdep.h 2004-05-09 19:32:29.000000000 -0700 +++ linux-2.6.7-rc3/include/sound/hwdep.h 2004-06-07 12:55:25.201541683 -0700 @@ -32,8 +32,8 @@ typedef struct _snd_hwdep_ops { long long (*llseek) (snd_hwdep_t *hw, struct file * file, long long offset, int orig); - long (*read) (snd_hwdep_t * hw, char *buf, long count, loff_t *offset); - long (*write) (snd_hwdep_t * hw, const char *buf, long count, loff_t *offset); + long (*read) (snd_hwdep_t * hw, char __user *buf, long count, loff_t *offset); + long (*write) (snd_hwdep_t * hw, const char __user *buf, long count, loff_t *offset); int (*open) (snd_hwdep_t * hw, struct file * file); int (*release) (snd_hwdep_t * hw, struct file * file); unsigned int (*poll) (snd_hwdep_t * hw, struct file * file, poll_table * wait); diff -urN linux-2.6.7-rc2/include/sound/info.h linux-2.6.7-rc3/include/sound/info.h --- linux-2.6.7-rc2/include/sound/info.h 2004-05-09 19:33:05.000000000 -0700 +++ linux-2.6.7-rc3/include/sound/info.h 2004-06-07 12:55:25.202541725 -0700 @@ -54,9 +54,9 @@ int (*release) (snd_info_entry_t * entry, unsigned short mode, void *file_private_data); long (*read) (snd_info_entry_t *entry, void *file_private_data, - struct file * file, char *buf, long count); + struct file * file, char __user *buf, long count); long (*write) (snd_info_entry_t *entry, void *file_private_data, - struct file * file, const char *buf, long count); + struct file * file, const char __user *buf, long count); long long (*llseek) (snd_info_entry_t *entry, void *file_private_data, struct file * file, long long offset, int orig); unsigned int (*poll) (snd_info_entry_t *entry, void *file_private_data, diff -urN linux-2.6.7-rc2/include/sound/pcm.h linux-2.6.7-rc3/include/sound/pcm.h --- linux-2.6.7-rc2/include/sound/pcm.h 2004-05-09 19:32:29.000000000 -0700 +++ linux-2.6.7-rc3/include/sound/pcm.h 2004-06-07 12:55:25.203541766 -0700 @@ -95,7 +95,7 @@ int (*trigger)(snd_pcm_substream_t * substream, int cmd); snd_pcm_uframes_t (*pointer)(snd_pcm_substream_t * substream); int (*copy)(snd_pcm_substream_t *substream, int channel, snd_pcm_uframes_t pos, - void *buf, snd_pcm_uframes_t count); + void __user *buf, snd_pcm_uframes_t count); int (*silence)(snd_pcm_substream_t *substream, int channel, snd_pcm_uframes_t pos, snd_pcm_uframes_t count); struct page *(*page)(snd_pcm_substream_t *substream, unsigned long offset); @@ -479,7 +479,7 @@ extern rwlock_t snd_pcm_link_rwlock; int snd_pcm_info(snd_pcm_substream_t * substream, snd_pcm_info_t *info); -int snd_pcm_info_user(snd_pcm_substream_t * substream, snd_pcm_info_t *info); +int snd_pcm_info_user(snd_pcm_substream_t * substream, snd_pcm_info_t __user *info); int snd_pcm_status(snd_pcm_substream_t * substream, snd_pcm_status_t *status); int snd_pcm_prepare(snd_pcm_substream_t *substream); int snd_pcm_start(snd_pcm_substream_t *substream); @@ -881,13 +881,14 @@ void snd_pcm_tick_elapsed(snd_pcm_substream_t *substream); void snd_pcm_period_elapsed(snd_pcm_substream_t *substream); snd_pcm_sframes_t snd_pcm_lib_write(snd_pcm_substream_t *substream, - const void *buf, snd_pcm_uframes_t frames); + const void __user *buf, + snd_pcm_uframes_t frames); snd_pcm_sframes_t snd_pcm_lib_read(snd_pcm_substream_t *substream, - void *buf, snd_pcm_uframes_t frames); + void __user *buf, snd_pcm_uframes_t frames); snd_pcm_sframes_t snd_pcm_lib_writev(snd_pcm_substream_t *substream, - void **bufs, snd_pcm_uframes_t frames); + void __user **bufs, snd_pcm_uframes_t frames); snd_pcm_sframes_t snd_pcm_lib_readv(snd_pcm_substream_t *substream, - void **bufs, snd_pcm_uframes_t frames); + void __user **bufs, snd_pcm_uframes_t frames); int snd_pcm_limit_hw_rates(snd_pcm_runtime_t *runtime); diff -urN linux-2.6.7-rc2/include/sound/seq_instr.h linux-2.6.7-rc3/include/sound/seq_instr.h --- linux-2.6.7-rc2/include/sound/seq_instr.h 2004-05-09 19:32:53.000000000 -0700 +++ linux-2.6.7-rc3/include/sound/seq_instr.h 2004-06-07 12:55:25.204541807 -0700 @@ -79,9 +79,9 @@ char *instr_type; int (*info)(void *private_data, char *info_data, long len); int (*put)(void *private_data, snd_seq_kinstr_t *kinstr, - char *instr_data, long len, int atomic, int cmd); + char __user *instr_data, long len, int atomic, int cmd); int (*get)(void *private_data, snd_seq_kinstr_t *kinstr, - char *instr_data, long len, int atomic, int cmd); + char __user *instr_data, long len, int atomic, int cmd); int (*get_size)(void *private_data, snd_seq_kinstr_t *kinstr, long *size); int (*remove)(void *private_data, snd_seq_kinstr_t *kinstr, int atomic); void (*notify)(void *private_data, snd_seq_kinstr_t *kinstr, int what); diff -urN linux-2.6.7-rc2/include/sound/seq_kernel.h linux-2.6.7-rc3/include/sound/seq_kernel.h --- linux-2.6.7-rc2/include/sound/seq_kernel.h 2004-05-09 19:33:20.000000000 -0700 +++ linux-2.6.7-rc3/include/sound/seq_kernel.h 2004-06-07 12:55:25.204541807 -0700 @@ -158,7 +158,7 @@ extern int snd_seq_delete_kernel_client(int client); extern int snd_seq_kernel_client_enqueue(int client, snd_seq_event_t *ev, int atomic, int hop); extern int snd_seq_kernel_client_dispatch(int client, snd_seq_event_t *ev, int atomic, int hop); -extern int snd_seq_kernel_client_ctl(int client, unsigned int cmd, void __user *arg); +extern int snd_seq_kernel_client_ctl(int client, unsigned int cmd, void *arg); #define SNDRV_SEQ_EXT_MASK 0xc0000000 #define SNDRV_SEQ_EXT_USRPTR 0x80000000 diff -urN linux-2.6.7-rc2/include/sound/sscape_ioctl.h linux-2.6.7-rc3/include/sound/sscape_ioctl.h --- linux-2.6.7-rc2/include/sound/sscape_ioctl.h 2004-05-09 19:31:59.000000000 -0700 +++ linux-2.6.7-rc3/include/sound/sscape_ioctl.h 2004-06-07 12:55:25.204541807 -0700 @@ -12,7 +12,7 @@ struct sscape_microcode { - unsigned char *code; + unsigned char __user *code; }; #define SND_SSCAPE_LOAD_BOOTB _IOWR('P', 100, struct sscape_bootblock) diff -urN linux-2.6.7-rc2/include/sound/trident.h linux-2.6.7-rc3/include/sound/trident.h --- linux-2.6.7-rc2/include/sound/trident.h 2004-06-07 12:54:52.839201283 -0700 +++ linux-2.6.7-rc3/include/sound/trident.h 2004-06-07 12:55:25.206541890 -0700 @@ -479,6 +479,6 @@ snd_util_memblk_t *snd_trident_synth_alloc(trident_t *trident, unsigned int size); int snd_trident_synth_free(trident_t *trident, snd_util_memblk_t *blk); int snd_trident_synth_bzero(trident_t *trident, snd_util_memblk_t *blk, int offset, int size); -int snd_trident_synth_copy_from_user(trident_t *trident, snd_util_memblk_t *blk, int offset, const char *data, int size); +int snd_trident_synth_copy_from_user(trident_t *trident, snd_util_memblk_t *blk, int offset, const char __user *data, int size); #endif /* __SOUND_TRIDENT_H */ diff -urN linux-2.6.7-rc2/include/sound/vx_core.h linux-2.6.7-rc3/include/sound/vx_core.h --- linux-2.6.7-rc2/include/sound/vx_core.h 2004-05-09 19:31:59.000000000 -0700 +++ linux-2.6.7-rc3/include/sound/vx_core.h 2004-06-07 12:55:25.207541932 -0700 @@ -254,13 +254,13 @@ inline static void snd_vx_outb(vx_core_t *chip, int reg, unsigned char val) { snd_assert(chip->ops->out8, return); - return chip->ops->out8(chip, reg, val); + chip->ops->out8(chip, reg, val); } inline static void snd_vx_outl(vx_core_t *chip, int reg, unsigned int val) { snd_assert(chip->ops->out32, return); - return chip->ops->out32(chip, reg, val); + chip->ops->out32(chip, reg, val); } #define vx_inb(chip,reg) snd_vx_inb(chip, VX_##reg) diff -urN linux-2.6.7-rc2/include/sound/wavefront.h linux-2.6.7-rc3/include/sound/wavefront.h --- linux-2.6.7-rc2/include/sound/wavefront.h 2004-05-09 19:32:27.000000000 -0700 +++ linux-2.6.7-rc3/include/sound/wavefront.h 2004-06-07 12:55:25.208541973 -0700 @@ -554,8 +554,8 @@ WF_{GET,SET}_CHANNEL above. */ - wavefront_any *hdrptr; /* user-space ptr to hdr bytes */ - u16 *dataptr; /* actual sample data */ + wavefront_any __user *hdrptr; /* user-space ptr to hdr bytes */ + u16 __user *dataptr; /* actual sample data */ wavefront_any hdr; /* kernel-space copy of hdr bytes */ } wavefront_patch_info; diff -urN linux-2.6.7-rc2/init/Kconfig linux-2.6.7-rc3/init/Kconfig --- linux-2.6.7-rc2/init/Kconfig 2004-06-07 12:54:52.873202691 -0700 +++ linux-2.6.7-rc3/init/Kconfig 2004-06-07 12:55:25.341547482 -0700 @@ -92,7 +92,7 @@ config POSIX_MQUEUE bool "POSIX Message Queues" - depends on EXPERIMENTAL + depends on NET && EXPERIMENTAL ---help--- POSIX variant of message queues is a part of IPC. In POSIX message queues every message has a priority which decides about succession diff -urN linux-2.6.7-rc2/init/main.c linux-2.6.7-rc3/init/main.c --- linux-2.6.7-rc2/init/main.c 2004-06-07 12:54:52.879202940 -0700 +++ linux-2.6.7-rc3/init/main.c 2004-06-07 12:55:25.384549264 -0700 @@ -186,7 +186,7 @@ loops_per_jiffy = (1<<12); printk("Calibrating delay loop... "); - while (loops_per_jiffy <<= 1) { + while ((loops_per_jiffy <<= 1) != 0) { /* wait for "start of" clock tick */ ticks = jiffies; while (ticks == jiffies) @@ -632,7 +632,7 @@ * check if there is an early userspace init. If yes, let it do all * the work */ - if (sys_access("/init", 0) == 0) + if (sys_access((const char __user *) "/init", 0) == 0) execute_command = "/init"; else prepare_namespace(); @@ -646,7 +646,7 @@ unlock_kernel(); system_state = SYSTEM_RUNNING; - if (sys_open("/dev/console", O_RDWR, 0) < 0) + if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0) printk("Warning: unable to open an initial console.\n"); (void) sys_dup(0); diff -urN linux-2.6.7-rc2/kernel/compat.c linux-2.6.7-rc3/kernel/compat.c --- linux-2.6.7-rc2/kernel/compat.c 2004-06-07 12:54:52.932205135 -0700 +++ linux-2.6.7-rc3/kernel/compat.c 2004-06-07 12:55:25.530555311 -0700 @@ -182,7 +182,7 @@ mm_segment_t old_fs = get_fs(); set_fs(KERNEL_DS); - ret = sys_sigpending(&s); + ret = sys_sigpending((old_sigset_t __user *) &s); set_fs(old_fs); if (ret == 0) ret = put_user(s, set); @@ -200,7 +200,9 @@ return -EFAULT; old_fs = get_fs(); set_fs(KERNEL_DS); - ret = sys_sigprocmask(how, set ? &s : NULL, oset ? &s : NULL); + ret = sys_sigprocmask(how, + set ? (old_sigset_t __user *) &s : NULL, + oset ? (old_sigset_t __user *) &s : NULL); set_fs(old_fs); if (ret == 0) if (oset) @@ -210,7 +212,8 @@ #ifdef CONFIG_FUTEX asmlinkage long compat_sys_futex(u32 __user *uaddr, int op, int val, - struct compat_timespec __user *utime, u32 __user *uaddr2) + struct compat_timespec __user *utime, u32 __user *uaddr2, + int val3) { struct timespec t; unsigned long timeout = MAX_SCHEDULE_TIMEOUT; @@ -221,11 +224,11 @@ return -EFAULT; timeout = timespec_to_jiffies(&t) + 1; } - if (op == FUTEX_REQUEUE) - val2 = (int) (long) utime; + if (op >= FUTEX_REQUEUE) + val2 = (int) (unsigned long) utime; return do_futex((unsigned long)uaddr, op, val, timeout, - (unsigned long)uaddr2, val2); + (unsigned long)uaddr2, val2, val3); } #endif @@ -249,7 +252,7 @@ if (r.rlim_max == COMPAT_RLIM_INFINITY) r.rlim_max = RLIM_INFINITY; set_fs(KERNEL_DS); - ret = sys_setrlimit(resource, &r); + ret = sys_setrlimit(resource, (struct rlimit __user *) &r); set_fs(old_fs); return ret; } @@ -291,7 +294,7 @@ mm_segment_t old_fs = get_fs(); set_fs(KERNEL_DS); - ret = sys_getrlimit(resource, &r); + ret = sys_getrlimit(resource, (struct rlimit __user *) &r); set_fs(old_fs); if (!ret) { if (r.rlim_cur > COMPAT_RLIM_INFINITY) @@ -339,7 +342,7 @@ mm_segment_t old_fs = get_fs(); set_fs(KERNEL_DS); - ret = sys_getrusage(who, &r); + ret = sys_getrusage(who, (struct rusage __user *) &r); set_fs(old_fs); if (ret) @@ -364,7 +367,10 @@ mm_segment_t old_fs = get_fs(); set_fs (KERNEL_DS); - ret = sys_wait4(pid, stat_addr ? &status : NULL, options, &r); + ret = sys_wait4(pid, + (stat_addr ? + (unsigned int __user *) &status : NULL), + options, (struct rusage __user *) &r); set_fs (old_fs); if (ret > 0) { @@ -381,40 +387,40 @@ unsigned int len, compat_ulong_t __user *user_mask_ptr) { - unsigned long kernel_mask; + unsigned long kern_mask; mm_segment_t old_fs; int ret; - if (get_user(kernel_mask, user_mask_ptr)) + if (get_user(kern_mask, user_mask_ptr)) return -EFAULT; old_fs = get_fs(); set_fs(KERNEL_DS); ret = sys_sched_setaffinity(pid, - sizeof(kernel_mask), - &kernel_mask); + sizeof(kern_mask), + (unsigned long __user *) &kern_mask); set_fs(old_fs); return ret; } -asmlinkage int compat_sys_sched_getaffinity(compat_pid_t pid, unsigned int len, - compat_ulong_t __user *user_mask_ptr) +asmlinkage long compat_sys_sched_getaffinity(compat_pid_t pid, unsigned int len, + compat_ulong_t __user *user_mask_ptr) { - unsigned long kernel_mask; + unsigned long kern_mask; mm_segment_t old_fs; int ret; old_fs = get_fs(); set_fs(KERNEL_DS); ret = sys_sched_getaffinity(pid, - sizeof(kernel_mask), - &kernel_mask); + sizeof(kern_mask), + (unsigned long __user *) &kern_mask); set_fs(old_fs); if (ret > 0) { ret = sizeof(compat_ulong_t); - if (put_user(kernel_mask, user_mask_ptr)) + if (put_user(kern_mask, user_mask_ptr)) return -EFAULT; } @@ -453,7 +459,9 @@ return -EFAULT; oldfs = get_fs(); set_fs(KERNEL_DS); - err = sys_timer_settime(timer_id, flags, &newts, &oldts); + err = sys_timer_settime(timer_id, flags, + (struct itimerspec __user *) &newts, + (struct itimerspec __user *) &oldts); set_fs(oldfs); if (!err && old && put_compat_itimerspec(old, &oldts)) return -EFAULT; @@ -466,9 +474,11 @@ long err; mm_segment_t oldfs; struct itimerspec ts; + oldfs = get_fs(); set_fs(KERNEL_DS); - err = sys_timer_gettime(timer_id, &ts); + err = sys_timer_gettime(timer_id, + (struct itimerspec __user *) &ts); set_fs(oldfs); if (!err && put_compat_itimerspec(setting, &ts)) return -EFAULT; @@ -481,11 +491,13 @@ long err; mm_segment_t oldfs; struct timespec ts; + if (get_compat_timespec(&ts, tp)) return -EFAULT; oldfs = get_fs(); set_fs(KERNEL_DS); - err = sys_clock_settime(which_clock, &ts); + err = sys_clock_settime(which_clock, + (struct timespec __user *) &ts); set_fs(oldfs); return err; } @@ -496,9 +508,11 @@ long err; mm_segment_t oldfs; struct timespec ts; + oldfs = get_fs(); set_fs(KERNEL_DS); - err = sys_clock_gettime(which_clock, &ts); + err = sys_clock_gettime(which_clock, + (struct timespec __user *) &ts); set_fs(oldfs); if (!err && put_compat_timespec(&ts, tp)) return -EFAULT; @@ -511,9 +525,11 @@ long err; mm_segment_t oldfs; struct timespec ts; + oldfs = get_fs(); set_fs(KERNEL_DS); - err = sys_clock_getres(which_clock, &ts); + err = sys_clock_getres(which_clock, + (struct timespec __user *) &ts); set_fs(oldfs); if (!err && put_compat_timespec(&ts, tp)) return -EFAULT; @@ -527,11 +543,15 @@ long err; mm_segment_t oldfs; struct timespec in, out; + if (get_compat_timespec(&in, rqtp)) return -EFAULT; + oldfs = get_fs(); - set_fs(KERNEL_DS); - err = sys_clock_nanosleep(which_clock, flags, &in, &out); + set_fs(KERNEL_DS); + err = sys_clock_nanosleep(which_clock, flags, + (struct timespec __user *) &in, + (struct timespec __user *) &out); set_fs(oldfs); if ((err == -ERESTART_RESTARTBLOCK) && rmtp && put_compat_timespec(&out, rmtp)) diff -urN linux-2.6.7-rc2/kernel/exit.c linux-2.6.7-rc3/kernel/exit.c --- linux-2.6.7-rc2/kernel/exit.c 2004-06-07 12:54:52.935205259 -0700 +++ linux-2.6.7-rc3/kernel/exit.c 2004-06-07 12:55:25.555556347 -0700 @@ -737,6 +737,14 @@ tsk->flags |= PF_DEAD; /* + * Clear these here so that update_process_times() won't try to deliver + * itimer, profile or rlimit signals to this task while it is in late exit. + */ + tsk->it_virt_incr = 0; + tsk->it_prof_value = 0; + tsk->rlim[RLIMIT_CPU].rlim_cur = RLIM_INFINITY; + + /* * In the preemption case it must be impossible for the task * to get runnable again, so use "_raw_" unlock to keep * preempt_count elevated until we schedule(). diff -urN linux-2.6.7-rc2/kernel/fork.c linux-2.6.7-rc3/kernel/fork.c --- linux-2.6.7-rc2/kernel/fork.c 2004-06-07 12:54:52.945205673 -0700 +++ linux-2.6.7-rc3/kernel/fork.c 2004-06-07 12:55:25.576557217 -0700 @@ -516,7 +516,7 @@ * not set up a proper pointer then tough luck. */ put_user(0, tidptr); - sys_futex(tidptr, FUTEX_WAKE, 1, NULL, NULL); + sys_futex(tidptr, FUTEX_WAKE, 1, NULL, NULL, 0); } } diff -urN linux-2.6.7-rc2/kernel/futex.c linux-2.6.7-rc3/kernel/futex.c --- linux-2.6.7-rc2/kernel/futex.c 2004-06-07 12:54:52.945205673 -0700 +++ linux-2.6.7-rc3/kernel/futex.c 2004-06-07 12:55:25.577557258 -0700 @@ -38,6 +38,7 @@ #include #include #include +#include #define FUTEX_HASHBITS 8 @@ -96,6 +97,7 @@ */ struct futex_hash_bucket { spinlock_t lock; + unsigned int nqueued; struct list_head chain; }; @@ -318,13 +320,14 @@ * physical page. */ static int futex_requeue(unsigned long uaddr1, unsigned long uaddr2, - int nr_wake, int nr_requeue) + int nr_wake, int nr_requeue, int *valp) { union futex_key key1, key2; struct futex_hash_bucket *bh1, *bh2; struct list_head *head1; struct futex_q *this, *next; int ret, drop_count = 0; + unsigned int nqueued; down_read(¤t->mm->mmap_sem); @@ -338,12 +341,41 @@ bh1 = hash_futex(&key1); bh2 = hash_futex(&key2); + nqueued = bh1->nqueued; + if (likely(valp != NULL)) { + int curval; + + /* In order to avoid doing get_user while + holding bh1->lock and bh2->lock, nqueued + (monotonically increasing field) must be first + read, then *uaddr1 fetched from userland and + after acquiring lock nqueued field compared with + the stored value. The smp_mb () below + makes sure that bh1->nqueued is read from memory + before *uaddr1. */ + smp_mb(); + + if (get_user(curval, (int __user *)uaddr1) != 0) { + ret = -EFAULT; + goto out; + } + if (curval != *valp) { + ret = -EAGAIN; + goto out; + } + } + if (bh1 < bh2) spin_lock(&bh1->lock); spin_lock(&bh2->lock); if (bh1 > bh2) spin_lock(&bh1->lock); + if (unlikely(nqueued != bh1->nqueued && valp != NULL)) { + ret = -EAGAIN; + goto out_unlock; + } + head1 = &bh1->chain; list_for_each_entry_safe(this, next, head1, list) { if (!match_futex (&this->key, &key1)) @@ -365,6 +397,7 @@ } } +out_unlock: spin_unlock(&bh1->lock); if (bh1 != bh2) spin_unlock(&bh2->lock); @@ -398,6 +431,7 @@ q->lock_ptr = &bh->lock; spin_lock(&bh->lock); + bh->nqueued++; list_add_tail(&q->list, &bh->chain); spin_unlock(&bh->lock); } @@ -625,7 +659,7 @@ } long do_futex(unsigned long uaddr, int op, int val, unsigned long timeout, - unsigned long uaddr2, int val2) + unsigned long uaddr2, int val2, int val3) { int ret; @@ -641,7 +675,10 @@ ret = futex_fd(uaddr, val); break; case FUTEX_REQUEUE: - ret = futex_requeue(uaddr, uaddr2, val, val2); + ret = futex_requeue(uaddr, uaddr2, val, val2, NULL); + break; + case FUTEX_CMP_REQUEUE: + ret = futex_requeue(uaddr, uaddr2, val, val2, &val3); break; default: ret = -ENOSYS; @@ -651,7 +688,8 @@ asmlinkage long sys_futex(u32 __user *uaddr, int op, int val, - struct timespec __user *utime, u32 __user *uaddr2) + struct timespec __user *utime, u32 __user *uaddr2, + int val3) { struct timespec t; unsigned long timeout = MAX_SCHEDULE_TIMEOUT; @@ -665,11 +703,11 @@ /* * requeue parameter in 'utime' if op == FUTEX_REQUEUE. */ - if (op == FUTEX_REQUEUE) + if (op >= FUTEX_REQUEUE) val2 = (int) (long) utime; return do_futex((unsigned long)uaddr, op, val, timeout, - (unsigned long)uaddr2, val2); + (unsigned long)uaddr2, val2, val3); } static struct super_block * diff -urN linux-2.6.7-rc2/kernel/kmod.c linux-2.6.7-rc3/kernel/kmod.c --- linux-2.6.7-rc2/kernel/kmod.c 2004-06-07 12:54:52.947205756 -0700 +++ linux-2.6.7-rc3/kernel/kmod.c 2004-06-07 12:55:25.579557341 -0700 @@ -192,10 +192,20 @@ allow_signal(SIGCHLD); pid = kernel_thread(____call_usermodehelper, sub_info, SIGCHLD); - if (pid < 0) + if (pid < 0) { sub_info->retval = pid; - else - sys_wait4(pid, &sub_info->retval, 0, NULL); + } else { + /* + * Normally it is bogus to call wait4() from in-kernel because + * wait4() wants to write the exit code to a userspace address. + * But wait_for_helper() always runs as keventd, and put_user() + * to a kernel address works OK for kernel threads, due to their + * having an mm_segment_t which spans the entire address space. + * + * Thus the __user pointer cast is valid here. + */ + sys_wait4(pid, (int __user *) &sub_info->retval, 0, NULL); + } complete(sub_info->complete); return 0; diff -urN linux-2.6.7-rc2/kernel/kthread.c linux-2.6.7-rc3/kernel/kthread.c --- linux-2.6.7-rc2/kernel/kthread.c 2004-05-09 19:33:20.000000000 -0700 +++ linux-2.6.7-rc3/kernel/kthread.c 2004-06-07 12:55:25.579557341 -0700 @@ -11,6 +11,7 @@ #include #include #include +#include #include struct kthread_create_info @@ -41,7 +42,7 @@ { return (kthread_stop_info.k == current); } - +EXPORT_SYMBOL(kthread_should_stop); static void kthread_exit_files(void) { @@ -144,6 +145,7 @@ return create.result; } +EXPORT_SYMBOL(kthread_create); void kthread_bind(struct task_struct *k, unsigned int cpu) { @@ -153,6 +155,7 @@ set_task_cpu(k, cpu); k->cpus_allowed = cpumask_of_cpu(cpu); } +EXPORT_SYMBOL(kthread_bind); int kthread_stop(struct task_struct *k) { @@ -180,3 +183,4 @@ return ret; } +EXPORT_SYMBOL(kthread_stop); diff -urN linux-2.6.7-rc2/kernel/sched.c linux-2.6.7-rc3/kernel/sched.c --- linux-2.6.7-rc2/kernel/sched.c 2004-06-07 12:54:53.011208407 -0700 +++ linux-2.6.7-rc3/kernel/sched.c 2004-06-07 12:55:25.627559329 -0700 @@ -762,8 +762,16 @@ load = source_load(cpu); this_load = target_load(this_cpu); + /* + * If sync wakeup then subtract the (maximum possible) effect of + * the currently running task from the load of the current CPU: + */ + if (sync) + this_load -= SCHED_LOAD_SCALE; + /* Don't pull the task off an idle CPU to a busy one */ - if (load < SCHED_LOAD_SCALE/2 && this_load > SCHED_LOAD_SCALE/2) + if (load < SCHED_LOAD_SCALE && load + this_load > SCHED_LOAD_SCALE + && this_load > load) goto out_set_cpu; new_cpu = this_cpu; /* Wake to this CPU if we can */ @@ -1625,8 +1633,7 @@ return busiest; out_balanced: - if (busiest && (idle == NEWLY_IDLE || - (idle == IDLE && max_load > SCHED_LOAD_SCALE)) ) { + if (busiest && idle != NOT_IDLE && max_load > SCHED_LOAD_SCALE) { *imbalance = 1; return busiest; } @@ -1663,11 +1670,8 @@ * tasks if there is an imbalance. * * Called with this_rq unlocked. - * - * This function is marked noinline to work around a compiler - * bug with gcc 3.3.3-hammer on x86-64. */ -static int noinline load_balance(int this_cpu, runqueue_t *this_rq, +static int load_balance(int this_cpu, runqueue_t *this_rq, struct sched_domain *sd, enum idle_type idle) { struct sched_group *group; @@ -1684,6 +1688,11 @@ busiest = find_busiest_queue(group); if (!busiest) goto out_balanced; + /* + * This should be "impossible", but since load + * balancing is inherently racy and statistical, + * it could happen in theory. + */ if (unlikely(busiest == this_rq)) { WARN_ON(1); goto out_balanced; @@ -1847,6 +1856,15 @@ } rq = cpu_rq(push_cpu); + + /* + * This condition is "impossible", but since load + * balancing is inherently a bit racy and statistical, + * it can trigger.. Reported by Bjorn Helgaas on a + * 128-cpu setup. + */ + if (unlikely(busiest == rq)) + goto next_group; double_lock_balance(busiest, rq); move_tasks(rq, push_cpu, busiest, 1, sd, IDLE); spin_unlock(&rq->lock); diff -urN linux-2.6.7-rc2/kernel/signal.c linux-2.6.7-rc3/kernel/signal.c --- linux-2.6.7-rc2/kernel/signal.c 2004-06-07 12:54:53.013208490 -0700 +++ linux-2.6.7-rc3/kernel/signal.c 2004-06-07 12:55:25.673561235 -0700 @@ -2175,7 +2175,7 @@ } /** - * sys_tkill - send signal to one specific thread + * sys_tgkill - send signal to one specific thread * @tgid: the thread group ID of the thread * @pid: the PID of the thread * @sig: signal to be sent @@ -2475,6 +2475,7 @@ out: return error; } +#endif /* __ARCH_WANT_SYS_SIGPROCMASK */ #ifndef __sparc__ asmlinkage long @@ -2505,7 +2506,6 @@ return ret; } #endif /* __sparc__ */ -#endif #ifdef __ARCH_WANT_SYS_SGETMASK diff -urN linux-2.6.7-rc2/kernel/sys.c linux-2.6.7-rc3/kernel/sys.c --- linux-2.6.7-rc2/kernel/sys.c 2004-06-07 12:54:53.014208531 -0700 +++ linux-2.6.7-rc3/kernel/sys.c 2004-06-07 12:55:25.691561980 -0700 @@ -274,6 +274,7 @@ cond_syscall(sys_mbind) cond_syscall(sys_get_mempolicy) cond_syscall(sys_set_mempolicy) +cond_syscall(compat_get_mempolicy) /* arch-specific weak syscall entries */ cond_syscall(sys_pciconfig_read) diff -urN linux-2.6.7-rc2/mm/hugetlb.c linux-2.6.7-rc3/mm/hugetlb.c --- linux-2.6.7-rc2/mm/hugetlb.c 2004-05-09 19:32:52.000000000 -0700 +++ linux-2.6.7-rc3/mm/hugetlb.c 2004-06-07 12:55:25.953572833 -0700 @@ -57,6 +57,7 @@ BUG_ON(page_count(page)); INIT_LIST_HEAD(&page->lru); + page[1].mapping = NULL; spin_lock(&hugetlb_lock); enqueue_huge_page(page); @@ -181,7 +182,8 @@ #ifdef CONFIG_SYSCTL int hugetlb_sysctl_handler(struct ctl_table *table, int write, - struct file *file, void *buffer, size_t *length) + struct file *file, void __user *buffer, + size_t *length) { proc_doulongvec_minmax(table, write, file, buffer, length); max_huge_pages = set_max_huge_pages(max_huge_pages); diff -urN linux-2.6.7-rc2/mm/memory.c linux-2.6.7-rc3/mm/memory.c --- linux-2.6.7-rc2/mm/memory.c 2004-06-07 12:54:53.073210975 -0700 +++ linux-2.6.7-rc3/mm/memory.c 2004-06-07 12:55:26.059577224 -0700 @@ -637,15 +637,11 @@ if (pte_present(pte)) { if (write && !pte_write(pte)) goto out; - if (write && !pte_dirty(pte)) { - struct page *page = pte_page(pte); - if (!PageDirty(page)) - set_page_dirty(page); - } pfn = pte_pfn(pte); if (pfn_valid(pfn)) { - struct page *page = pfn_to_page(pfn); - + page = pfn_to_page(pfn); + if (write && !pte_dirty(pte) && !PageDirty(page)) + set_page_dirty(page); mark_page_accessed(page); return page; } diff -urN linux-2.6.7-rc2/mm/mmap.c linux-2.6.7-rc3/mm/mmap.c --- linux-2.6.7-rc2/mm/mmap.c 2004-06-07 12:54:53.079211223 -0700 +++ linux-2.6.7-rc3/mm/mmap.c 2004-06-07 12:55:26.074577845 -0700 @@ -293,10 +293,8 @@ struct vm_area_struct *prev, struct rb_node **rb_link, struct rb_node *rb_parent) { - vma_prio_tree_init(vma); __vma_link_list(mm, vma, prev, rb_parent); __vma_link_rb(mm, vma, rb_link, rb_parent); - __vma_link_file(vma); __anon_vma_link(vma); } @@ -312,7 +310,10 @@ if (mapping) spin_lock(&mapping->i_mmap_lock); anon_vma_lock(vma); + __vma_link(mm, vma, prev, rb_link, rb_parent); + __vma_link_file(vma); + anon_vma_unlock(vma); if (mapping) spin_unlock(&mapping->i_mmap_lock); @@ -323,9 +324,9 @@ } /* - * Insert vm structure into process list sorted by address and into the - * inode's i_mmap tree. The caller should hold mm->mmap_sem and - * ->f_mappping->i_mmap_lock if vm_file is non-NULL. + * Helper for vma_adjust in the split_vma insert case: + * insert vm structure into list and rbtree and anon_vma, + * but it has already been inserted into prio_tree earlier. */ static void __insert_vm_struct(struct mm_struct * mm, struct vm_area_struct * vma) @@ -337,9 +338,7 @@ if (__vma && __vma->vm_start < vma->vm_end) BUG(); __vma_link(mm, vma, prev, rb_link, rb_parent); - mark_mm_hugetlb(mm, vma); mm->map_count++; - validate_mm(mm); } static inline void @@ -373,20 +372,27 @@ if (next && !insert) { if (end >= next->vm_end) { + /* + * vma expands, overlapping all the next, and + * perhaps the one after too (mprotect case 6). + */ again: remove_next = 1 + (end > next->vm_end); end = next->vm_end; anon_vma = next->anon_vma; - } else if (end < vma->vm_end || end > next->vm_start) { + } else if (end > next->vm_start) { /* - * vma shrinks, and !insert tells it's not - * split_vma inserting another: so it must - * be mprotect shifting the boundary down. - * Or: * vma expands, overlapping part of the next: - * must be mprotect shifting the boundary up. + * mprotect case 5 shifting the boundary up. + */ + adjust_next = (end - next->vm_start) >> PAGE_SHIFT; + anon_vma = next->anon_vma; + } else if (end < vma->vm_end) { + /* + * vma shrinks, and !insert tells it's not + * split_vma inserting another: so it must be + * mprotect case 4 shifting the boundary down. */ - BUG_ON(vma->vm_end != next->vm_start); - adjust_next = end - next->vm_start; + adjust_next = - ((vma->vm_end - end) >> PAGE_SHIFT); anon_vma = next->anon_vma; } } @@ -396,6 +402,15 @@ if (!(vma->vm_flags & VM_NONLINEAR)) root = &mapping->i_mmap; spin_lock(&mapping->i_mmap_lock); + if (insert) { + /* + * Put into prio_tree now, so instantiated pages + * are visible to arm/parisc __flush_dcache_page + * throughout; but we cannot insert into address + * space until vma start or end is updated. + */ + __vma_link_file(insert); + } } /* @@ -418,8 +433,8 @@ vma->vm_end = end; vma->vm_pgoff = pgoff; if (adjust_next) { - next->vm_start += adjust_next; - next->vm_pgoff += adjust_next >> PAGE_SHIFT; + next->vm_start += adjust_next << PAGE_SHIFT; + next->vm_pgoff += adjust_next; } if (root) { @@ -1456,6 +1471,7 @@ /* most fields are the same, copy all, and then fixup */ *new = *vma; + vma_prio_tree_init(new); if (new_below) new->vm_end = addr; @@ -1768,6 +1784,7 @@ new_vma = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL); if (new_vma) { *new_vma = *vma; + vma_prio_tree_init(new_vma); pol = mpol_copy(vma_policy(vma)); if (IS_ERR(pol)) { kmem_cache_free(vm_area_cachep, new_vma); diff -urN linux-2.6.7-rc2/mm/msync.c linux-2.6.7-rc3/mm/msync.c --- linux-2.6.7-rc2/mm/msync.c 2004-05-09 19:32:28.000000000 -0700 +++ linux-2.6.7-rc3/mm/msync.c 2004-06-07 12:55:26.075577887 -0700 @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -106,6 +107,13 @@ dir = pgd_offset(vma->vm_mm, address); flush_cache_range(vma, address, end); + + /* For hugepages we can't go walking the page table normally, + * but that's ok, hugetlbfs is memory based, so we don't need + * to do anything more on an msync() */ + if (is_vm_hugetlb_page(vma)) + goto out; + if (address >= end) BUG(); do { @@ -118,7 +126,7 @@ * dirty bits. */ flush_tlb_range(vma, end - size, end); - + out: spin_unlock(&vma->vm_mm->page_table_lock); return error; diff -urN linux-2.6.7-rc2/mm/oom_kill.c linux-2.6.7-rc3/mm/oom_kill.c --- linux-2.6.7-rc2/mm/oom_kill.c 2004-05-09 19:32:37.000000000 -0700 +++ linux-2.6.7-rc3/mm/oom_kill.c 2004-06-07 12:55:26.128580082 -0700 @@ -245,7 +245,6 @@ * If it's been a long time since last failure, * we're not oom. */ - last = now; if (since > 5*HZ) goto reset; diff -urN linux-2.6.7-rc2/mm/rmap.c linux-2.6.7-rc3/mm/rmap.c --- linux-2.6.7-rc2/mm/rmap.c 2004-06-07 12:54:53.095211886 -0700 +++ linux-2.6.7-rc3/mm/rmap.c 2004-06-07 12:55:26.136580414 -0700 @@ -193,7 +193,7 @@ * repeatedly from either page_referenced_anon or page_referenced_file. */ static int page_referenced_one(struct page *page, - struct vm_area_struct *vma, unsigned int *mapcount, int *failed) + struct vm_area_struct *vma, unsigned int *mapcount) { struct mm_struct *mm = vma->vm_mm; unsigned long address; @@ -208,14 +208,8 @@ if (address == -EFAULT) goto out; - if (!spin_trylock(&mm->page_table_lock)) { - /* - * For debug we're currently warning if not all found, - * but in this case that's expected: suppress warning. - */ - (*failed)++; + if (!spin_trylock(&mm->page_table_lock)) goto out; - } pgd = pgd_offset(mm, address); if (!pgd_present(*pgd)) @@ -251,18 +245,14 @@ struct anon_vma *anon_vma = (struct anon_vma *) page->mapping; struct vm_area_struct *vma; int referenced = 0; - int failed = 0; spin_lock(&anon_vma->lock); BUG_ON(list_empty(&anon_vma->head)); list_for_each_entry(vma, &anon_vma->head, anon_vma_node) { - referenced += page_referenced_one(page, vma, - &mapcount, &failed); + referenced += page_referenced_one(page, vma, &mapcount); if (!mapcount) - goto out; + break; } - WARN_ON(!failed); -out: spin_unlock(&anon_vma->lock); return referenced; } @@ -289,7 +279,6 @@ struct vm_area_struct *vma = NULL; struct prio_tree_iter iter; int referenced = 0; - int failed = 0; if (!spin_trylock(&mapping->i_mmap_lock)) return 0; @@ -299,17 +288,13 @@ if ((vma->vm_flags & (VM_LOCKED|VM_MAYSHARE)) == (VM_LOCKED|VM_MAYSHARE)) { referenced++; - goto out; + break; } - referenced += page_referenced_one(page, vma, - &mapcount, &failed); + referenced += page_referenced_one(page, vma, &mapcount); if (!mapcount) - goto out; + break; } - if (list_empty(&mapping->i_mmap_nonlinear)) - WARN_ON(!failed); -out: spin_unlock(&mapping->i_mmap_lock); return referenced; } @@ -485,6 +470,23 @@ goto out_unmap; } + /* + * Don't pull an anonymous page out from under get_user_pages. + * GUP carefully breaks COW and raises page count (while holding + * page_table_lock, as we have here) to make sure that the page + * cannot be freed. If we unmap that page here, a user write + * access to the virtual address will bring back the page, but + * its raised count will (ironically) be taken to mean it's not + * an exclusive swap page, do_wp_page will replace it by a copy + * page, and the user never get to see the data GUP was holding + * the original page for. + */ + if (PageSwapCache(page) && + page_count(page) != page->mapcount + 2) { + ret = SWAP_FAIL; + goto out_unmap; + } + /* Nuke the page table entry. */ flush_cache_page(vma, address); pteval = ptep_clear_flush(vma, address, pte); diff -urN linux-2.6.7-rc2/mm/slab.c linux-2.6.7-rc3/mm/slab.c --- linux-2.6.7-rc2/mm/slab.c 2004-06-07 12:54:53.100212093 -0700 +++ linux-2.6.7-rc3/mm/slab.c 2004-06-07 12:55:26.140580579 -0700 @@ -477,10 +477,12 @@ EXPORT_SYMBOL(malloc_sizes); /* Must match cache_sizes above. Out of line to keep cache footprint low. */ -static struct cache_names { +struct cache_names { char *name; char *name_dma; -} cache_names[] = { +}; + +static struct cache_names __initdata cache_names[] = { #define CACHE(x) { .name = "size-" #x, .name_dma = "size-" #x "(DMA)" }, #include { 0, } diff -urN linux-2.6.7-rc2/mm/swap_state.c linux-2.6.7-rc3/mm/swap_state.c --- linux-2.6.7-rc2/mm/swap_state.c 2004-06-07 12:54:53.101212134 -0700 +++ linux-2.6.7-rc3/mm/swap_state.c 2004-06-07 12:55:26.141580621 -0700 @@ -6,7 +6,7 @@ * * Rewritten to use page cache, (C) 1998 Stephen Tweedie */ - +#include #include #include #include @@ -19,7 +19,8 @@ /* * swapper_space is a fiction, retained to simplify the path through - * vmscan's shrink_list. Only those fields initialized below are used. + * vmscan's shrink_list, to make sync_page look nicer, and to allow + * future use of radix_tree tags in the swap cache. */ static struct address_space_operations swap_aops = { .writepage = swap_writepage, @@ -36,8 +37,10 @@ .page_tree = RADIX_TREE_INIT(GFP_ATOMIC), .tree_lock = SPIN_LOCK_UNLOCKED, .a_ops = &swap_aops, + .i_mmap_nonlinear = LIST_HEAD_INIT(swapper_space.i_mmap_nonlinear), .backing_dev_info = &swap_backing_dev_info, }; +EXPORT_SYMBOL(swapper_space); #define INC_CACHE_INFO(x) do { swap_cache_info.x++; } while (0) diff -urN linux-2.6.7-rc2/mm/vmscan.c linux-2.6.7-rc3/mm/vmscan.c --- linux-2.6.7-rc2/mm/vmscan.c 2004-06-07 12:54:53.106212341 -0700 +++ linux-2.6.7-rc3/mm/vmscan.c 2004-06-07 12:55:26.145580786 -0700 @@ -813,8 +813,9 @@ struct zone *zone = zones[i]; int max_scan; - if (zone->free_pages < zone->pages_high) - zone->temp_priority = priority; + zone->temp_priority = priority; + if (zone->prev_priority > priority) + zone->prev_priority = priority; if (zone->all_unreclaimable && priority != DEF_PRIORITY) continue; /* Let kswapd poll it */ @@ -945,7 +946,7 @@ zone->temp_priority = DEF_PRIORITY; } - for (priority = DEF_PRIORITY; priority; priority--) { + for (priority = DEF_PRIORITY; priority >= 0; priority--) { int all_zones_ok = 1; int end_zone = 0; /* Inclusive. 0 = ZONE_DMA */ @@ -995,6 +996,8 @@ all_zones_ok = 0; } zone->temp_priority = priority; + if (zone->prev_priority > priority) + zone->prev_priority = priority; max_scan = (zone->nr_active + zone->nr_inactive) >> priority; reclaimed = shrink_zone(zone, max_scan, GFP_KERNEL, diff -urN linux-2.6.7-rc2/net/8021q/vlan.c linux-2.6.7-rc3/net/8021q/vlan.c --- linux-2.6.7-rc2/net/8021q/vlan.c 2004-05-09 19:33:13.000000000 -0700 +++ linux-2.6.7-rc3/net/8021q/vlan.c 2004-06-07 12:55:26.222583976 -0700 @@ -49,7 +49,7 @@ static char vlan_buggyright[] = "David S. Miller "; static int vlan_device_event(struct notifier_block *, unsigned long, void *); -static int vlan_ioctl_handler(unsigned long); +static int vlan_ioctl_handler(void __user *); static int unregister_vlan_dev(struct net_device *, unsigned short ); struct notifier_block vlan_notifier_block = { @@ -661,9 +661,9 @@ /* * VLAN IOCTL handler. * o execute requested action or pass command to the device driver - * arg is really a void* to a vlan_ioctl_args structure. + * arg is really a struct vlan_ioctl_args __user *. */ -static int vlan_ioctl_handler(unsigned long arg) +static int vlan_ioctl_handler(void __user *arg) { int err = 0; struct vlan_ioctl_args args; @@ -675,8 +675,7 @@ if (!capable(CAP_NET_ADMIN)) return -EPERM; - if (copy_from_user(&args, (void*)arg, - sizeof(struct vlan_ioctl_args))) + if (copy_from_user(&args, arg, sizeof(struct vlan_ioctl_args))) return -EFAULT; /* Null terminate this sucker, just in case. */ diff -urN linux-2.6.7-rc2/net/appletalk/ddp.c linux-2.6.7-rc3/net/appletalk/ddp.c --- linux-2.6.7-rc2/net/appletalk/ddp.c 2004-05-09 19:33:21.000000000 -0700 +++ linux-2.6.7-rc3/net/appletalk/ddp.c 2004-06-07 12:55:26.271586006 -0700 @@ -673,7 +673,7 @@ /* ioctl calls. Shouldn't even need touching */ /* Device configuration ioctl calls */ -static int atif_ioctl(int cmd, void *arg) +static int atif_ioctl(int cmd, void __user *arg) { static char aarp_mcast[6] = { 0x09, 0x00, 0x00, 0xFF, 0xFF, 0xFF }; struct ifreq atreq; @@ -892,7 +892,7 @@ } /* Routing ioctl() calls */ -static int atrtr_ioctl(unsigned int cmd, void *arg) +static int atrtr_ioctl(unsigned int cmd, void __user *arg) { struct rtentry rt; @@ -1567,7 +1567,7 @@ struct atalk_route *rt; int err; - if (flags & ~MSG_DONTWAIT) + if (flags & ~(MSG_DONTWAIT|MSG_CMSG_COMPAT)) return -EINVAL; if (len > DDP_MAXSZ) @@ -1769,6 +1769,7 @@ { int rc = -EINVAL; struct sock *sk = sock->sk; + void __user *argp = (void __user *)arg; switch (cmd) { /* Protocol layer */ @@ -1778,7 +1779,7 @@ if (amount < 0) amount = 0; - rc = put_user(amount, (int *)arg); + rc = put_user(amount, (int __user *)argp); break; } case TIOCINQ: { @@ -1791,18 +1792,18 @@ if (skb) amount = skb->len - sizeof(struct ddpehdr); - rc = put_user(amount, (int *)arg); + rc = put_user(amount, (int __user *)argp); break; } case SIOCGSTAMP: - rc = sock_get_timestamp(sk, (struct timeval *)arg); + rc = sock_get_timestamp(sk, argp); break; /* Routing */ case SIOCADDRT: case SIOCDELRT: rc = -EPERM; if (capable(CAP_NET_ADMIN)) - rc = atrtr_ioctl(cmd, (void *)arg); + rc = atrtr_ioctl(cmd, argp); break; /* Interface */ case SIOCGIFADDR: @@ -1813,7 +1814,7 @@ case SIOCSARP: /* proxy AARP */ case SIOCDARP: /* proxy AARP */ rtnl_lock(); - rc = atif_ioctl(cmd, (void *)arg); + rc = atif_ioctl(cmd, argp); rtnl_unlock(); break; /* Physical layer ioctl calls */ @@ -1829,7 +1830,7 @@ case SIOCGIFCOUNT: case SIOCGIFINDEX: case SIOCGIFNAME: - rc = dev_ioctl(cmd, (void *)arg); + rc = dev_ioctl(cmd, argp); break; } diff -urN linux-2.6.7-rc2/net/atm/addr.c linux-2.6.7-rc3/net/atm/addr.c --- linux-2.6.7-rc2/net/atm/addr.c 2004-05-09 19:31:59.000000000 -0700 +++ linux-2.6.7-rc3/net/atm/addr.c 2004-06-07 12:55:26.282586461 -0700 @@ -114,7 +114,7 @@ } -int atm_get_addr(struct atm_dev *dev,struct sockaddr_atmsvc *u_buf,int size) +int atm_get_addr(struct atm_dev *dev,struct sockaddr_atmsvc __user *buf,int size) { unsigned long flags; struct atm_dev_addr *walk; @@ -134,7 +134,7 @@ memcpy(tmp_bufp++, &walk->addr, sizeof(struct sockaddr_atmsvc)); spin_unlock_irqrestore(&dev->lock, flags); error = total > size ? -E2BIG : total; - if (copy_to_user(u_buf, tmp_buf, total < size ? total : size)) + if (copy_to_user(buf, tmp_buf, total < size ? total : size)) error = -EFAULT; kfree(tmp_buf); return error; diff -urN linux-2.6.7-rc2/net/atm/addr.h linux-2.6.7-rc3/net/atm/addr.h --- linux-2.6.7-rc2/net/atm/addr.h 2004-05-09 19:32:28.000000000 -0700 +++ linux-2.6.7-rc3/net/atm/addr.h 2004-06-07 12:55:26.319587994 -0700 @@ -13,6 +13,6 @@ void atm_reset_addr(struct atm_dev *dev); int atm_add_addr(struct atm_dev *dev,struct sockaddr_atmsvc *addr); int atm_del_addr(struct atm_dev *dev,struct sockaddr_atmsvc *addr); -int atm_get_addr(struct atm_dev *dev,struct sockaddr_atmsvc *u_buf,int size); +int atm_get_addr(struct atm_dev *dev,struct sockaddr_atmsvc __user *buf,int size); #endif diff -urN linux-2.6.7-rc2/net/atm/br2684.c linux-2.6.7-rc3/net/atm/br2684.c --- linux-2.6.7-rc2/net/atm/br2684.c 2004-05-09 19:33:22.000000000 -0700 +++ linux-2.6.7-rc3/net/atm/br2684.c 2004-06-07 12:55:26.367589982 -0700 @@ -342,12 +342,12 @@ #ifdef CONFIG_ATM_BR2684_IPFILTER /* this IOCTL is experimental. */ -static int br2684_setfilt(struct atm_vcc *atmvcc, unsigned long arg) +static int br2684_setfilt(struct atm_vcc *atmvcc, void __user *arg) { struct br2684_vcc *brvcc; struct br2684_filter_set fs; - if (copy_from_user(&fs, (void *) arg, sizeof fs)) + if (copy_from_user(&fs, arg, sizeof fs)) return -EFAULT; if (fs.ifspec.method != BR2684_FIND_BYNOTHING) { /* @@ -494,7 +494,7 @@ netif_rx(skb); } -static int br2684_regvcc(struct atm_vcc *atmvcc, unsigned long arg) +static int br2684_regvcc(struct atm_vcc *atmvcc, void __user *arg) { /* assign a vcc to a dev Note: we do not have explicit unassign, but look at _push() @@ -507,7 +507,7 @@ struct net_device *net_dev; struct atm_backend_br2684 be; - if (copy_from_user(&be, (void *) arg, sizeof be)) + if (copy_from_user(&be, arg, sizeof be)) return -EFAULT; brvcc = kmalloc(sizeof(struct br2684_vcc), GFP_KERNEL); if (!brvcc) @@ -593,7 +593,7 @@ INIT_LIST_HEAD(&brdev->brvccs); } -static int br2684_create(unsigned long arg) +static int br2684_create(void __user *arg) { int err; struct net_device *netdev; @@ -602,7 +602,7 @@ DPRINTK("br2684_create\n"); - if (copy_from_user(&ni, (void *) arg, sizeof ni)) { + if (copy_from_user(&ni, arg, sizeof ni)) { return -EFAULT; } if (ni.media != BR2684_MEDIA_ETHERNET || ni.mtu != 1500) { @@ -642,13 +642,14 @@ unsigned long arg) { struct atm_vcc *atmvcc = ATM_SD(sock); + void __user *argp = (void __user *)arg; int err; switch(cmd) { case ATM_SETBACKEND: case ATM_NEWBACKENDIF: { atm_backend_t b; - err = get_user(b, (atm_backend_t *) arg); + err = get_user(b, (atm_backend_t __user *) argp); if (err) return -EFAULT; if (b != ATM_BACKEND_BR2684) @@ -656,9 +657,9 @@ if (!capable(CAP_NET_ADMIN)) return -EPERM; if (cmd == ATM_SETBACKEND) - return br2684_regvcc(atmvcc, arg); + return br2684_regvcc(atmvcc, argp); else - return br2684_create(arg); + return br2684_create(argp); } #ifdef CONFIG_ATM_BR2684_IPFILTER case BR2684_SETFILT: @@ -666,7 +667,7 @@ return -ENOIOCTLCMD; if (!capable(CAP_NET_ADMIN)) return -EPERM; - err = br2684_setfilt(atmvcc, arg); + err = br2684_setfilt(atmvcc, argp); return err; #endif /* CONFIG_ATM_BR2684_IPFILTER */ } diff -urN linux-2.6.7-rc2/net/atm/common.c linux-2.6.7-rc3/net/atm/common.c --- linux-2.6.7-rc2/net/atm/common.c 2004-05-09 19:33:22.000000000 -0700 +++ linux-2.6.7-rc3/net/atm/common.c 2004-06-07 12:55:26.368590024 -0700 @@ -509,7 +509,7 @@ struct atm_vcc *vcc; struct sk_buff *skb; int eff,error; - const void *buff; + const void __user *buff; int size; lock_sock(sk); @@ -676,7 +676,7 @@ } int vcc_setsockopt(struct socket *sock, int level, int optname, - char *optval, int optlen) + char __user *optval, int optlen) { struct atm_vcc *vcc; unsigned long value; @@ -704,7 +704,7 @@ return 0; } case SO_SETCLP: - if (get_user(value,(unsigned long *) optval)) + if (get_user(value,(unsigned long __user *)optval)) return -EFAULT; if (value) vcc->atm_options |= ATM_ATMOPT_CLP; else vcc->atm_options &= ~ATM_ATMOPT_CLP; @@ -719,7 +719,7 @@ int vcc_getsockopt(struct socket *sock, int level, int optname, - char *optval, int *optlen) + char __user *optval, int __user *optlen) { struct atm_vcc *vcc; int len; @@ -738,7 +738,7 @@ -EFAULT : 0; case SO_SETCLP: return put_user(vcc->atm_options & ATM_ATMOPT_CLP ? 1 : - 0,(unsigned long *) optval) ? -EFAULT : 0; + 0,(unsigned long __user *)optval) ? -EFAULT : 0; case SO_ATMPVC: { struct sockaddr_atmpvc pvc; diff -urN linux-2.6.7-rc2/net/atm/common.h linux-2.6.7-rc3/net/atm/common.h --- linux-2.6.7-rc2/net/atm/common.h 2004-05-09 19:32:54.000000000 -0700 +++ linux-2.6.7-rc3/net/atm/common.h 2004-06-07 12:55:26.374590272 -0700 @@ -19,10 +19,10 @@ size_t total_len); unsigned int vcc_poll(struct file *file, struct socket *sock, poll_table *wait); int vcc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); -int vcc_setsockopt(struct socket *sock, int level, int optname, char *optval, - int optlen); -int vcc_getsockopt(struct socket *sock, int level, int optname, char *optval, - int *optlen); +int vcc_setsockopt(struct socket *sock, int level, int optname, + char __user *optval, int optlen); +int vcc_getsockopt(struct socket *sock, int level, int optname, + char __user *optval, int __user *optlen); void atm_shutdown_dev(struct atm_dev *dev); diff -urN linux-2.6.7-rc2/net/atm/ioctl.c linux-2.6.7-rc3/net/atm/ioctl.c --- linux-2.6.7-rc2/net/atm/ioctl.c 2004-05-09 19:33:13.000000000 -0700 +++ linux-2.6.7-rc3/net/atm/ioctl.c 2004-06-07 12:55:26.374590272 -0700 @@ -49,6 +49,7 @@ struct atm_vcc *vcc; int error; struct list_head * pos; + void __user *argp = (void __user *)arg; vcc = ATM_SD(sock); switch (cmd) { @@ -60,7 +61,7 @@ } error = put_user(vcc->sk->sk_sndbuf - atomic_read(&vcc->sk->sk_wmem_alloc), - (int *) arg) ? -EFAULT : 0; + (int __user *) argp) ? -EFAULT : 0; goto done; case SIOCINQ: { @@ -72,12 +73,11 @@ } skb = skb_peek(&vcc->sk->sk_receive_queue); error = put_user(skb ? skb->len : 0, - (int *) arg) ? -EFAULT : 0; + (int __user *)argp) ? -EFAULT : 0; goto done; } case SIOCGSTAMP: /* borrowed from IP */ - error = sock_get_timestamp(vcc->sk, (struct timeval *) - arg); + error = sock_get_timestamp(vcc->sk, argp); goto done; case ATM_SETSC: printk(KERN_WARNING "ATM_SETSC is obsolete\n"); @@ -131,7 +131,7 @@ if (error != -ENOIOCTLCMD) goto done; - error = atm_dev_ioctl(cmd, arg); + error = atm_dev_ioctl(cmd, argp); done: return error; diff -urN linux-2.6.7-rc2/net/atm/lec.c linux-2.6.7-rc3/net/atm/lec.c --- linux-2.6.7-rc2/net/atm/lec.c 2004-05-09 19:32:52.000000000 -0700 +++ linux-2.6.7-rc3/net/atm/lec.c 2004-06-07 12:55:26.390590935 -0700 @@ -774,7 +774,7 @@ } int -lec_vcc_attach(struct atm_vcc *vcc, void *arg) +lec_vcc_attach(struct atm_vcc *vcc, void __user *arg) { struct lec_vcc_priv *vpriv; int bytes_left; @@ -1161,7 +1161,7 @@ err = lec_mcast_attach(vcc, (int) arg); break; case ATMLEC_DATA: - err = lec_vcc_attach(vcc, (void *) arg); + err = lec_vcc_attach(vcc, (void __user *) arg); break; } diff -urN linux-2.6.7-rc2/net/atm/lec.h linux-2.6.7-rc3/net/atm/lec.h --- linux-2.6.7-rc2/net/atm/lec.h 2004-05-09 19:32:27.000000000 -0700 +++ linux-2.6.7-rc3/net/atm/lec.h 2004-06-07 12:55:26.412591846 -0700 @@ -148,7 +148,7 @@ #define LEC_VCC_PRIV(vcc) ((struct lec_vcc_priv *)((vcc)->user_back)) int lecd_attach(struct atm_vcc *vcc, int arg); -int lec_vcc_attach(struct atm_vcc *vcc, void *arg); +int lec_vcc_attach(struct atm_vcc *vcc, void __user *arg); int lec_mcast_attach(struct atm_vcc *vcc, int arg); struct net_device *get_dev_lec(int itf); int make_lec(struct atm_vcc *vcc); diff -urN linux-2.6.7-rc2/net/atm/mpc.c linux-2.6.7-rc3/net/atm/mpc.c --- linux-2.6.7-rc2/net/atm/mpc.c 2004-05-09 19:33:13.000000000 -0700 +++ linux-2.6.7-rc3/net/atm/mpc.c 2004-06-07 12:55:26.449593379 -0700 @@ -565,7 +565,7 @@ return retval; } -int atm_mpoa_vcc_attach(struct atm_vcc *vcc, long arg) +int atm_mpoa_vcc_attach(struct atm_vcc *vcc, void __user *arg) { int bytes_left; struct mpoa_client *mpc; @@ -574,7 +574,7 @@ uint32_t ipaddr; unsigned char *ip; - bytes_left = copy_from_user(&ioc_data, (void *)arg, sizeof(struct atmmpc_ioc)); + bytes_left = copy_from_user(&ioc_data, arg, sizeof(struct atmmpc_ioc)); if (bytes_left != 0) { printk("mpoa: mpc_vcc_attach: Short read (missed %d bytes) from userland\n", bytes_left); return -EFAULT; @@ -1366,7 +1366,7 @@ return; } -static void mpc_timer_refresh() +static void mpc_timer_refresh(void) { mpc_timer.expires = jiffies + (MPC_P2 * HZ); mpc_timer.data = mpc_timer.expires; @@ -1418,7 +1418,7 @@ sock->state = SS_CONNECTED; break; case ATMMPC_DATA: - err = atm_mpoa_vcc_attach(vcc, arg); + err = atm_mpoa_vcc_attach(vcc, (void __user *)arg); break; default: break; diff -urN linux-2.6.7-rc2/net/atm/mpc.h linux-2.6.7-rc3/net/atm/mpc.h --- linux-2.6.7-rc2/net/atm/mpc.h 2004-05-09 19:32:00.000000000 -0700 +++ linux-2.6.7-rc3/net/atm/mpc.h 2004-06-07 12:55:26.450593420 -0700 @@ -13,7 +13,7 @@ /* Functions for ioctl(ATMMPC_*) operations */ int atm_mpoa_mpoad_attach(struct atm_vcc *vcc, int arg); -int atm_mpoa_vcc_attach(struct atm_vcc *vcc, long arg); +int atm_mpoa_vcc_attach(struct atm_vcc *vcc, void __user *arg); struct mpoa_client { struct mpoa_client *next; diff -urN linux-2.6.7-rc2/net/atm/mpoa_proc.c linux-2.6.7-rc3/net/atm/mpoa_proc.c --- linux-2.6.7-rc2/net/atm/mpoa_proc.c 2004-05-09 19:33:12.000000000 -0700 +++ linux-2.6.7-rc3/net/atm/mpoa_proc.c 2004-06-07 12:55:26.450593420 -0700 @@ -30,10 +30,10 @@ extern struct mpoa_client *mpcs; extern struct proc_dir_entry *atm_proc_root; /* from proc.c. */ -static ssize_t proc_mpc_read(struct file *file, char *buff, +static ssize_t proc_mpc_read(struct file *file, char __user *buff, size_t count, loff_t *pos); -static ssize_t proc_mpc_write(struct file *file, const char *buff, +static ssize_t proc_mpc_write(struct file *file, const char __user *buff, size_t nbytes, loff_t *ppos); static int parse_qos(const char *buff, int len); @@ -99,7 +99,7 @@ /* * READING function - called when the /proc/atm/mpoa file is read from. */ -static ssize_t proc_mpc_read(struct file *file, char *buff, +static ssize_t proc_mpc_read(struct file *file, char __user *buff, size_t count, loff_t *pos){ unsigned long page = 0; unsigned char *temp; @@ -165,12 +165,12 @@ return length; } -static ssize_t proc_mpc_write(struct file *file, const char *buff, +static ssize_t proc_mpc_write(struct file *file, const char __user *buff, size_t nbytes, loff_t *ppos) { int incoming, error, retval; char *page, c; - const char *tmp; + const char __user *tmp; if (nbytes == 0) return 0; if (nbytes >= PAGE_SIZE) nbytes = PAGE_SIZE-1; diff -urN linux-2.6.7-rc2/net/atm/pppoatm.c linux-2.6.7-rc3/net/atm/pppoatm.c --- linux-2.6.7-rc2/net/atm/pppoatm.c 2004-05-09 19:32:53.000000000 -0700 +++ linux-2.6.7-rc3/net/atm/pppoatm.c 2004-06-07 12:55:26.451593462 -0700 @@ -257,10 +257,10 @@ { switch (cmd) { case PPPIOCGFLAGS: - return put_user(chan_to_pvcc(chan)->flags, (int *) arg) + return put_user(chan_to_pvcc(chan)->flags, (int __user *) arg) ? -EFAULT : 0; case PPPIOCSFLAGS: - return get_user(chan_to_pvcc(chan)->flags, (int *) arg) + return get_user(chan_to_pvcc(chan)->flags, (int __user *) arg) ? -EFAULT : 0; } return -ENOTTY; @@ -271,7 +271,7 @@ .ioctl = pppoatm_devppp_ioctl, }; -static int pppoatm_assign_vcc(struct atm_vcc *atmvcc, unsigned long arg) +static int pppoatm_assign_vcc(struct atm_vcc *atmvcc, void __user *arg) { struct atm_backend_ppp be; struct pppoatm_vcc *pvcc; @@ -281,7 +281,7 @@ * prototypical one used to initialize them */ static const DECLARE_TASKLET(tasklet_proto, pppoatm_wakeup_sender, 0); - if (copy_from_user(&be, (void *) arg, sizeof be)) + if (copy_from_user(&be, arg, sizeof be)) return -EFAULT; if (be.encaps != PPPOATM_ENCAPS_AUTODETECT && be.encaps != PPPOATM_ENCAPS_VC && be.encaps != PPPOATM_ENCAPS_LLC) @@ -319,26 +319,27 @@ unsigned long arg) { struct atm_vcc *atmvcc = ATM_SD(sock); + void __user *argp = (void __user *)arg; if (cmd != ATM_SETBACKEND && atmvcc->push != pppoatm_push) return -ENOIOCTLCMD; switch (cmd) { case ATM_SETBACKEND: { atm_backend_t b; - if (get_user(b, (atm_backend_t *) arg)) + if (get_user(b, (atm_backend_t __user *) argp)) return -EFAULT; if (b != ATM_BACKEND_PPP) return -ENOIOCTLCMD; if (!capable(CAP_NET_ADMIN)) return -EPERM; - return pppoatm_assign_vcc(atmvcc, arg); + return pppoatm_assign_vcc(atmvcc, argp); } case PPPIOCGCHAN: return put_user(ppp_channel_index(&atmvcc_to_pvcc(atmvcc)-> - chan), (int *) arg) ? -EFAULT : 0; + chan), (int __user *) argp) ? -EFAULT : 0; case PPPIOCGUNIT: return put_user(ppp_unit_number(&atmvcc_to_pvcc(atmvcc)-> - chan), (int *) arg) ? -EFAULT : 0; + chan), (int __user *) argp) ? -EFAULT : 0; } return -ENOIOCTLCMD; } diff -urN linux-2.6.7-rc2/net/atm/proc.c linux-2.6.7-rc3/net/atm/proc.c --- linux-2.6.7-rc2/net/atm/proc.c 2004-05-09 19:32:27.000000000 -0700 +++ linux-2.6.7-rc3/net/atm/proc.c 2004-06-07 12:55:26.451593462 -0700 @@ -31,7 +31,7 @@ #include "common.h" /* atm_proc_init prototype */ #include "signaling.h" /* to get sigd - ugly too */ -static ssize_t proc_dev_atm_read(struct file *file,char *buf,size_t count, +static ssize_t proc_dev_atm_read(struct file *file,char __user *buf,size_t count, loff_t *pos); static struct file_operations proc_atm_dev_ops = { @@ -384,8 +384,8 @@ .release = vcc_seq_release, }; -static ssize_t proc_dev_atm_read(struct file *file,char *buf,size_t count, - loff_t *pos) +static ssize_t proc_dev_atm_read(struct file *file, char __user *buf, + size_t count, loff_t *pos) { struct atm_dev *dev; unsigned long page; diff -urN linux-2.6.7-rc2/net/atm/resources.c linux-2.6.7-rc3/net/atm/resources.c --- linux-2.6.7-rc2/net/atm/resources.c 2004-05-09 19:33:20.000000000 -0700 +++ linux-2.6.7-rc3/net/atm/resources.c 2004-06-07 12:55:26.452593503 -0700 @@ -180,7 +180,7 @@ } -static int fetch_stats(struct atm_dev *dev, struct atm_dev_stats *arg, int zero) +static int fetch_stats(struct atm_dev *dev, struct atm_dev_stats __user *arg, int zero) { struct atm_dev_stats tmp; int error = 0; @@ -199,19 +199,20 @@ } -int atm_dev_ioctl(unsigned int cmd, unsigned long arg) +int atm_dev_ioctl(unsigned int cmd, void __user *arg) { - void *buf; + void __user *buf; int error, len, number, size = 0; struct atm_dev *dev; struct list_head *p; int *tmp_buf, *tmp_p; - + struct atm_iobuf __user *iobuf = arg; + struct atmif_sioc __user *sioc = arg; switch (cmd) { case ATM_GETNAMES: - if (get_user(buf, &((struct atm_iobuf *) arg)->buffer)) + if (get_user(buf, &iobuf->buffer)) return -EFAULT; - if (get_user(len, &((struct atm_iobuf *) arg)->length)) + if (get_user(len, &iobuf->length)) return -EFAULT; spin_lock(&atm_dev_lock); list_for_each(p, &atm_devs) @@ -232,7 +233,7 @@ } spin_unlock(&atm_dev_lock); error = ((copy_to_user(buf, tmp_buf, size)) || - put_user(size, &((struct atm_iobuf *) arg)->length)) + put_user(size, &iobuf->length)) ? -EFAULT : 0; kfree(tmp_buf); return error; @@ -240,11 +241,11 @@ break; } - if (get_user(buf, &((struct atmif_sioc *) arg)->arg)) + if (get_user(buf, &sioc->arg)) return -EFAULT; - if (get_user(len, &((struct atmif_sioc *) arg)->length)) + if (get_user(len, &sioc->length)) return -EFAULT; - if (get_user(number, &((struct atmif_sioc *) arg)->number)) + if (get_user(number, &sioc->number)) return -EFAULT; if (!(dev = atm_dev_lookup(number))) @@ -351,7 +352,7 @@ size = error; /* may return 0, but later on size == 0 means "don't write the length" */ - error = put_user(size, &((struct atmif_sioc *) arg)->length) + error = put_user(size, &sioc->length) ? -EFAULT : 0; goto done; case ATM_SETLOOP: @@ -385,7 +386,7 @@ } if (size) - error = put_user(size, &((struct atmif_sioc *) arg)->length) + error = put_user(size, &sioc->length) ? -EFAULT : 0; else error = 0; diff -urN linux-2.6.7-rc2/net/atm/resources.h linux-2.6.7-rc3/net/atm/resources.h --- linux-2.6.7-rc2/net/atm/resources.h 2004-05-09 19:33:13.000000000 -0700 +++ linux-2.6.7-rc3/net/atm/resources.h 2004-06-07 12:55:26.452593503 -0700 @@ -14,7 +14,7 @@ extern spinlock_t atm_dev_lock; -int atm_dev_ioctl(unsigned int cmd, unsigned long arg); +int atm_dev_ioctl(unsigned int cmd, void __user *arg); #ifdef CONFIG_PROC_FS diff -urN linux-2.6.7-rc2/net/ax25/af_ax25.c linux-2.6.7-rc3/net/ax25/af_ax25.c --- linux-2.6.7-rc2/net/ax25/af_ax25.c 2004-06-07 12:54:53.259218678 -0700 +++ linux-2.6.7-rc3/net/ax25/af_ax25.c 2004-06-07 12:55:26.562598060 -0700 @@ -336,7 +336,7 @@ * includes a KILL command to abort any connection. * VERY useful for debugging ;-) */ -static int ax25_ctl_ioctl(const unsigned int cmd, void *arg) +static int ax25_ctl_ioctl(const unsigned int cmd, void __user *arg) { struct ax25_ctl_struct ax25_ctl; ax25_digi digi; @@ -1413,9 +1413,8 @@ size_t size; int lv, err, addr_len = msg->msg_namelen; - if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR)) { + if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR|MSG_CMSG_COMPAT)) return -EINVAL; - } lock_sock(sk); ax25 = ax25_sk(sk); @@ -1669,6 +1668,7 @@ static int ax25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) { struct sock *sk = sock->sk; + void __user *argp = (void __user *)arg; int res = 0; lock_sock(sk); @@ -1678,7 +1678,7 @@ amount = sk->sk_sndbuf - atomic_read(&sk->sk_wmem_alloc); if (amount < 0) amount = 0; - res = put_user(amount, (int *)arg); + res = put_user(amount, (int __user *)argp); break; } @@ -1688,13 +1688,13 @@ /* These two are safe on a single CPU system as only user tasks fiddle here */ if ((skb = skb_peek(&sk->sk_receive_queue)) != NULL) amount = skb->len; - res = put_user(amount, (int *)arg); + res = put_user(amount, (int __user *)argp); break; } case SIOCGSTAMP: if (sk != NULL) { - res = sock_get_timestamp(sk, (struct timeval *)arg); + res = sock_get_timestamp(sk, argp); break; } res = -EINVAL; @@ -1704,7 +1704,7 @@ case SIOCAX25DELUID: /* Delete a uid from the uid/call map table */ case SIOCAX25GETUID: { struct sockaddr_ax25 sax25; - if (copy_from_user(&sax25, (void *)arg, sizeof(sax25))) { + if (copy_from_user(&sax25, argp, sizeof(sax25))) { res = -EFAULT; break; } @@ -1718,7 +1718,7 @@ res = -EPERM; break; } - if (get_user(amount, (long *)arg)) { + if (get_user(amount, (long __user *)argp)) { res = -EFAULT; break; } @@ -1738,7 +1738,7 @@ res = -EPERM; break; } - res = ax25_rt_ioctl(cmd, (void *)arg); + res = ax25_rt_ioctl(cmd, argp); break; case SIOCAX25CTLCON: @@ -1746,7 +1746,7 @@ res = -EPERM; break; } - res = ax25_ctl_ioctl(cmd, (void *)arg); + res = ax25_ctl_ioctl(cmd, argp); break; case SIOCAX25GETINFO: @@ -1783,12 +1783,12 @@ warned=1; } - if (copy_to_user((void *)arg, &ax25_info, sizeof(struct ax25_info_struct_deprecated))) { + if (copy_to_user(argp, &ax25_info, sizeof(struct ax25_info_struct_deprecated))) { res = -EFAULT; break; } } else { - if (copy_to_user((void *)arg, &ax25_info, sizeof(struct ax25_info_struct))) { + if (copy_to_user(argp, &ax25_info, sizeof(struct ax25_info_struct))) { res = -EINVAL; break; } @@ -1804,7 +1804,7 @@ res = -EPERM; break; } - if (copy_from_user(&ax25_fwd, (void *)arg, sizeof(ax25_fwd))) { + if (copy_from_user(&ax25_fwd, argp, sizeof(ax25_fwd))) { res = -EFAULT; break; } @@ -1826,7 +1826,7 @@ break; default: - res = dev_ioctl(cmd, (void *)arg); + res = dev_ioctl(cmd, argp); break; } release_sock(sk); diff -urN linux-2.6.7-rc2/net/ax25/ax25_route.c linux-2.6.7-rc3/net/ax25/ax25_route.c --- linux-2.6.7-rc2/net/ax25/ax25_route.c 2004-05-09 19:32:53.000000000 -0700 +++ linux-2.6.7-rc3/net/ax25/ax25_route.c 2004-06-07 12:55:26.563598101 -0700 @@ -253,7 +253,7 @@ return err; } -int ax25_rt_ioctl(unsigned int cmd, void *arg) +int ax25_rt_ioctl(unsigned int cmd, void __user *arg) { struct ax25_route_opt_struct rt_option; struct ax25_routes_struct route; diff -urN linux-2.6.7-rc2/net/bluetooth/Kconfig linux-2.6.7-rc3/net/bluetooth/Kconfig --- linux-2.6.7-rc2/net/bluetooth/Kconfig 2004-05-09 19:33:13.000000000 -0700 +++ linux-2.6.7-rc3/net/bluetooth/Kconfig 2004-06-07 12:55:26.567598267 -0700 @@ -14,22 +14,20 @@ Linux Bluetooth subsystem consist of several layers: Bluetooth Core (HCI device and connection manager, scheduler) - HCI Device drivers (interface to the hardware) - L2CAP Module (L2CAP protocol) - SCO Module (SCO links) - RFCOMM Module (RFCOMM protocol) - BNEP Module (BNEP protocol) - CMTP Module (CMTP protocol) + HCI Device drivers (Interface to the hardware) + SCO Module (SCO audio links) + L2CAP Module (Logical Link Control and Adaptation Protocol) + RFCOMM Module (RFCOMM Protocol) + BNEP Module (Bluetooth Network Encapsulation Protocol) + CMTP Module (CAPI Message Transport Protocol) - Say Y here to enable Linux Bluetooth support and to build Bluetooth Core - layer. + Say Y here to compile Bluetooth support into the kernel or say M to + compile it as module (bluetooth). To use Linux Bluetooth subsystem, you will need several user-space utilities like hciconfig and hcid. These utilities and updates to Bluetooth kernel modules are provided in the BlueZ packages. - For more information, see . - - If you want to compile Bluetooth Core as module (bluetooth) say M here. + For more information, see . config BT_L2CAP tristate "L2CAP protocol support" @@ -46,7 +44,7 @@ tristate "SCO links support" depends on BT help - SCO link provides voice transport over Bluetooth. SCO support is + SCO link provides voice transport over Bluetooth. SCO support is required for voice applications like Headset and Audio. Say Y here to compile SCO support into the kernel or say M to diff -urN linux-2.6.7-rc2/net/bluetooth/Makefile linux-2.6.7-rc3/net/bluetooth/Makefile --- linux-2.6.7-rc2/net/bluetooth/Makefile 2004-05-09 19:32:02.000000000 -0700 +++ linux-2.6.7-rc3/net/bluetooth/Makefile 2004-06-07 12:55:26.591599261 -0700 @@ -9,4 +9,4 @@ obj-$(CONFIG_BT_BNEP) += bnep/ obj-$(CONFIG_BT_CMTP) += cmtp/ -bluetooth-objs := af_bluetooth.o hci_core.o hci_conn.o hci_event.o hci_sock.o hci_sysfs.o lib.o syms.o +bluetooth-objs := af_bluetooth.o hci_core.o hci_conn.o hci_event.o hci_sock.o hci_sysfs.o lib.o diff -urN linux-2.6.7-rc2/net/bluetooth/af_bluetooth.c linux-2.6.7-rc3/net/bluetooth/af_bluetooth.c --- linux-2.6.7-rc2/net/bluetooth/af_bluetooth.c 2004-05-09 19:32:02.000000000 -0700 +++ linux-2.6.7-rc3/net/bluetooth/af_bluetooth.c 2004-06-07 12:55:26.612600131 -0700 @@ -22,12 +22,7 @@ SOFTWARE IS DISCLAIMED. */ -/* - * Bluetooth address family and sockets. - * - * $Id: af_bluetooth.c,v 1.3 2002/04/17 17:37:15 maxk Exp $ - */ -#define VERSION "2.4" +/* Bluetooth address family and sockets. */ #include #include @@ -53,13 +48,16 @@ #ifndef CONFIG_BT_SOCK_DEBUG #undef BT_DBG -#define BT_DBG( A... ) +#define BT_DBG(D...) #endif +#define VERSION "2.5" + struct proc_dir_entry *proc_bt; +EXPORT_SYMBOL(proc_bt); /* Bluetooth sockets */ -#define BT_MAX_PROTO 6 +#define BT_MAX_PROTO 7 static struct net_proto_family *bt_proto[BT_MAX_PROTO]; static kmem_cache_t *bt_sock_cache; @@ -75,6 +73,7 @@ bt_proto[proto] = ops; return 0; } +EXPORT_SYMBOL(bt_sock_register); int bt_sock_unregister(int proto) { @@ -87,6 +86,7 @@ bt_proto[proto] = NULL; return 0; } +EXPORT_SYMBOL(bt_sock_unregister); static int bt_sock_create(struct socket *sock, int proto) { @@ -116,7 +116,7 @@ sk = sk_alloc(PF_BLUETOOTH, prio, sizeof(struct bt_sock), bt_sock_cache); if (!sk) return NULL; - + if (pi_size) { pi = kmalloc(pi_size, prio); if (!pi) { @@ -129,13 +129,14 @@ sock_init_data(sock, sk); INIT_LIST_HEAD(&bt_sk(sk)->accept_q); - + sk->sk_zapped = 0; sk->sk_protocol = proto; sk->sk_state = BT_OPEN; return sk; } +EXPORT_SYMBOL(bt_sock_alloc); void bt_sock_link(struct bt_sock_list *l, struct sock *sk) { @@ -143,6 +144,7 @@ sk_add_node(sk, &l->head); write_unlock_bh(&l->lock); } +EXPORT_SYMBOL(bt_sock_link); void bt_sock_unlink(struct bt_sock_list *l, struct sock *sk) { @@ -150,6 +152,7 @@ sk_del_node_init(sk); write_unlock_bh(&l->lock); } +EXPORT_SYMBOL(bt_sock_unlink); void bt_accept_enqueue(struct sock *parent, struct sock *sk) { @@ -160,6 +163,7 @@ bt_sk(sk)->parent = parent; parent->sk_ack_backlog++; } +EXPORT_SYMBOL(bt_accept_enqueue); static void bt_accept_unlink(struct sock *sk) { @@ -175,19 +179,19 @@ { struct list_head *p, *n; struct sock *sk; - + BT_DBG("parent %p", parent); list_for_each_safe(p, n, &bt_sk(parent)->accept_q) { sk = (struct sock *) list_entry(p, struct bt_sock, accept_q); - + lock_sock(sk); if (sk->sk_state == BT_CLOSED) { release_sock(sk); bt_accept_unlink(sk); continue; } - + if (sk->sk_state == BT_CONNECTED || !newsock) { bt_accept_unlink(sk); if (newsock) @@ -199,6 +203,7 @@ } return NULL; } +EXPORT_SYMBOL(bt_accept_dequeue); int bt_sock_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t len, int flags) @@ -235,6 +240,7 @@ return err ? : copied; } +EXPORT_SYMBOL(bt_sock_recvmsg); static inline unsigned int bt_accept_poll(struct sock *parent) { @@ -287,6 +293,7 @@ return mask; } +EXPORT_SYMBOL(bt_sock_poll); int bt_sock_wait_state(struct sock *sk, int state, unsigned long timeo) { @@ -322,9 +329,10 @@ remove_wait_queue(sk->sk_sleep, &wait); return err; } +EXPORT_SYMBOL(bt_sock_wait_state); static struct net_proto_family bt_sock_family_ops = { - .owner = THIS_MODULE, + .owner = THIS_MODULE, .family = PF_BLUETOOTH, .create = bt_sock_create, }; @@ -342,7 +350,7 @@ proc_bt = proc_mkdir("bluetooth", NULL); if (proc_bt) proc_bt->owner = THIS_MODULE; - + /* Init socket cache */ bt_sock_cache = kmem_cache_create("bt_sock", sizeof(struct bt_sock), 0, @@ -352,7 +360,7 @@ BT_ERR("Socket cache creation failed"); return -ENOMEM; } - + sock_register(&bt_sock_family_ops); BT_INFO("HCI device and connection manager initialized"); diff -urN linux-2.6.7-rc2/net/bluetooth/bnep/Kconfig linux-2.6.7-rc3/net/bluetooth/bnep/Kconfig --- linux-2.6.7-rc2/net/bluetooth/bnep/Kconfig 2004-05-09 19:33:21.000000000 -0700 +++ linux-2.6.7-rc3/net/bluetooth/bnep/Kconfig 2004-06-07 12:55:26.620600462 -0700 @@ -4,12 +4,8 @@ select CRC32 help BNEP (Bluetooth Network Encapsulation Protocol) is Ethernet - emulation layer on top of Bluetooth. BNEP is required for Bluetooth - PAN (Personal Area Network). - - To use BNEP, you will need user-space utilities provided in the - BlueZ-PAN package. - For more information, see . + emulation layer on top of Bluetooth. BNEP is required for + Bluetooth PAN (Personal Area Network). Say Y here to compile BNEP support into the kernel or say M to compile it as module (bnep). diff -urN linux-2.6.7-rc2/net/bluetooth/bnep/sock.c linux-2.6.7-rc3/net/bluetooth/bnep/sock.c --- linux-2.6.7-rc2/net/bluetooth/bnep/sock.c 2004-05-09 19:33:22.000000000 -0700 +++ linux-2.6.7-rc3/net/bluetooth/bnep/sock.c 2004-06-07 12:55:26.621600504 -0700 @@ -77,6 +77,7 @@ struct bnep_conndel_req cd; struct bnep_conninfo ci; struct socket *nsock; + void __user *argp = (void __user *)arg; int err; BT_DBG("cmd %x arg %lx", cmd, arg); @@ -86,7 +87,7 @@ if (!capable(CAP_NET_ADMIN)) return -EACCES; - if (copy_from_user(&ca, (void *) arg, sizeof(ca))) + if (copy_from_user(&ca, argp, sizeof(ca))) return -EFAULT; nsock = sockfd_lookup(ca.sock, &err); @@ -100,7 +101,7 @@ err = bnep_add_connection(&ca, nsock); if (!err) { - if (copy_to_user((void *) arg, &ca, sizeof(ca))) + if (copy_to_user(argp, &ca, sizeof(ca))) err = -EFAULT; } else fput(nsock->file); @@ -111,30 +112,30 @@ if (!capable(CAP_NET_ADMIN)) return -EACCES; - if (copy_from_user(&cd, (void *) arg, sizeof(cd))) + if (copy_from_user(&cd, argp, sizeof(cd))) return -EFAULT; return bnep_del_connection(&cd); case BNEPGETCONNLIST: - if (copy_from_user(&cl, (void *) arg, sizeof(cl))) + if (copy_from_user(&cl, argp, sizeof(cl))) return -EFAULT; if (cl.cnum <= 0) return -EINVAL; err = bnep_get_connlist(&cl); - if (!err && copy_to_user((void *) arg, &cl, sizeof(cl))) + if (!err && copy_to_user(argp, &cl, sizeof(cl))) return -EFAULT; return err; case BNEPGETCONNINFO: - if (copy_from_user(&ci, (void *) arg, sizeof(ci))) + if (copy_from_user(&ci, argp, sizeof(ci))) return -EFAULT; err = bnep_get_conninfo(&ci); - if (!err && copy_to_user((void *) arg, &ci, sizeof(ci))) + if (!err && copy_to_user(argp, &ci, sizeof(ci))) return -EFAULT; return err; diff -urN linux-2.6.7-rc2/net/bluetooth/cmtp/Kconfig linux-2.6.7-rc3/net/bluetooth/cmtp/Kconfig --- linux-2.6.7-rc2/net/bluetooth/cmtp/Kconfig 2004-05-09 19:32:26.000000000 -0700 +++ linux-2.6.7-rc3/net/bluetooth/cmtp/Kconfig 2004-06-07 12:55:26.622600545 -0700 @@ -3,7 +3,7 @@ depends on BT && BT_L2CAP && ISDN_CAPI help CMTP (CAPI Message Transport Protocol) is a transport layer - for CAPI messages. CMTP is required for the Bluetooth Common + for CAPI messages. CMTP is required for the Bluetooth Common ISDN Access Profile. Say Y here to compile CMTP support into the kernel or say M to diff -urN linux-2.6.7-rc2/net/bluetooth/cmtp/cmtp.h linux-2.6.7-rc3/net/bluetooth/cmtp/cmtp.h --- linux-2.6.7-rc2/net/bluetooth/cmtp/cmtp.h 2004-05-09 19:32:52.000000000 -0700 +++ linux-2.6.7-rc3/net/bluetooth/cmtp/cmtp.h 2004-06-07 12:55:26.622600545 -0700 @@ -55,7 +55,7 @@ struct cmtp_connlist_req { __u32 cnum; - struct cmtp_conninfo *ci; + struct cmtp_conninfo __user *ci; }; int cmtp_add_connection(struct cmtp_connadd_req *req, struct socket *sock); diff -urN linux-2.6.7-rc2/net/bluetooth/cmtp/sock.c linux-2.6.7-rc3/net/bluetooth/cmtp/sock.c --- linux-2.6.7-rc2/net/bluetooth/cmtp/sock.c 2004-05-09 19:33:13.000000000 -0700 +++ linux-2.6.7-rc3/net/bluetooth/cmtp/sock.c 2004-06-07 12:55:26.638601208 -0700 @@ -71,6 +71,7 @@ struct cmtp_connlist_req cl; struct cmtp_conninfo ci; struct socket *nsock; + void __user *argp = (void __user *)arg; int err; BT_DBG("cmd %x arg %lx", cmd, arg); @@ -80,7 +81,7 @@ if (!capable(CAP_NET_ADMIN)) return -EACCES; - if (copy_from_user(&ca, (void *) arg, sizeof(ca))) + if (copy_from_user(&ca, argp, sizeof(ca))) return -EFAULT; nsock = sockfd_lookup(ca.sock, &err); @@ -94,7 +95,7 @@ err = cmtp_add_connection(&ca, nsock); if (!err) { - if (copy_to_user((void *) arg, &ca, sizeof(ca))) + if (copy_to_user(argp, &ca, sizeof(ca))) err = -EFAULT; } else fput(nsock->file); @@ -105,30 +106,30 @@ if (!capable(CAP_NET_ADMIN)) return -EACCES; - if (copy_from_user(&cd, (void *) arg, sizeof(cd))) + if (copy_from_user(&cd, argp, sizeof(cd))) return -EFAULT; return cmtp_del_connection(&cd); case CMTPGETCONNLIST: - if (copy_from_user(&cl, (void *) arg, sizeof(cl))) + if (copy_from_user(&cl, argp, sizeof(cl))) return -EFAULT; if (cl.cnum <= 0) return -EINVAL; err = cmtp_get_connlist(&cl); - if (!err && copy_to_user((void *) arg, &cl, sizeof(cl))) + if (!err && copy_to_user(argp, &cl, sizeof(cl))) return -EFAULT; return err; case CMTPGETCONNINFO: - if (copy_from_user(&ci, (void *) arg, sizeof(ci))) + if (copy_from_user(&ci, argp, sizeof(ci))) return -EFAULT; err = cmtp_get_conninfo(&ci); - if (!err && copy_to_user((void *) arg, &ci, sizeof(ci))) + if (!err && copy_to_user(argp, &ci, sizeof(ci))) return -EFAULT; return err; diff -urN linux-2.6.7-rc2/net/bluetooth/hci_conn.c linux-2.6.7-rc3/net/bluetooth/hci_conn.c --- linux-2.6.7-rc2/net/bluetooth/hci_conn.c 2004-05-09 19:33:21.000000000 -0700 +++ linux-2.6.7-rc3/net/bluetooth/hci_conn.c 2004-06-07 12:55:26.658602036 -0700 @@ -22,11 +22,7 @@ SOFTWARE IS DISCLAIMED. */ -/* - * HCI Connection handling. - * - * $Id: hci_conn.c,v 1.2 2002/04/17 17:37:16 maxk Exp $ - */ +/* Bluetooth HCI connection handling. */ #include #include @@ -54,7 +50,7 @@ #ifndef CONFIG_BT_HCI_CORE_DEBUG #undef BT_DBG -#define BT_DBG( A... ) +#define BT_DBG(D...) #endif void hci_acl_connect(struct hci_conn *conn) @@ -178,10 +174,10 @@ int hci_conn_del(struct hci_conn *conn) { - struct hci_dev *hdev = conn->hdev; + struct hci_dev *hdev = conn->hdev; BT_DBG("%s conn %p handle %d", hdev->name, conn, conn->handle); - + hci_conn_del_timer(conn); if (conn->type == SCO_LINK) { @@ -226,14 +222,14 @@ list_for_each(p, &hci_dev_list) { struct hci_dev *d = list_entry(p, struct hci_dev, list); - + if (!test_bit(HCI_UP, &d->flags)) continue; /* Simple routing: - * No source address - find interface with bdaddr != dst - * Source address - find interface with bdaddr == src - */ + * No source address - find interface with bdaddr != dst + * Source address - find interface with bdaddr == src + */ if (use_src) { if (!bacmp(&d->bdaddr, src)) { @@ -252,6 +248,7 @@ read_unlock_bh(&hci_dev_list_lock); return hdev; } +EXPORT_SYMBOL(hci_get_route); /* Create SCO or ACL connection. * Device _must_ be locked */ @@ -294,15 +291,16 @@ return acl; } } +EXPORT_SYMBOL(hci_connect); /* Authenticate remote device */ int hci_conn_auth(struct hci_conn *conn) { BT_DBG("conn %p", conn); - + if (conn->link_mode & HCI_LM_AUTH) return 1; - + if (!test_and_set_bit(HCI_CONN_AUTH_PEND, &conn->pend)) { struct hci_cp_auth_requested cp; cp.handle = __cpu_to_le16(conn->handle); @@ -310,15 +308,16 @@ } return 0; } +EXPORT_SYMBOL(hci_conn_auth); /* Enable encryption */ int hci_conn_encrypt(struct hci_conn *conn) { BT_DBG("conn %p", conn); - + if (conn->link_mode & HCI_LM_ENCRYPT) return 1; - + if (test_and_set_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend)) return 0; @@ -330,12 +329,13 @@ } return 0; } +EXPORT_SYMBOL(hci_conn_encrypt); /* Drop all connection on the device */ void hci_conn_hash_flush(struct hci_dev *hdev) { struct hci_conn_hash *h = &hdev->conn_hash; - struct list_head *p; + struct list_head *p; BT_DBG("hdev %s", hdev->name); @@ -353,7 +353,7 @@ } } -int hci_get_conn_list(unsigned long arg) +int hci_get_conn_list(void __user *arg) { struct hci_conn_list_req req, *cl; struct hci_conn_info *ci; @@ -361,7 +361,7 @@ struct list_head *p; int n = 0, size, err; - if (copy_from_user(&req, (void *) arg, sizeof(req))) + if (copy_from_user(&req, arg, sizeof(req))) return -EFAULT; if (!req.conn_num || req.conn_num > (PAGE_SIZE * 2) / sizeof(*ci)) @@ -401,20 +401,20 @@ hci_dev_put(hdev); - err = copy_to_user((void *) arg, cl, size); + err = copy_to_user(arg, cl, size); kfree(cl); return err ? -EFAULT : 0; } -int hci_get_conn_info(struct hci_dev *hdev, unsigned long arg) +int hci_get_conn_info(struct hci_dev *hdev, void __user *arg) { struct hci_conn_info_req req; struct hci_conn_info ci; struct hci_conn *conn; - char *ptr = (void *) arg + sizeof(req); + char __user *ptr = arg + sizeof(req); - if (copy_from_user(&req, (void *) arg, sizeof(req))) + if (copy_from_user(&req, arg, sizeof(req))) return -EFAULT; hci_dev_lock_bh(hdev); diff -urN linux-2.6.7-rc2/net/bluetooth/hci_core.c linux-2.6.7-rc3/net/bluetooth/hci_core.c --- linux-2.6.7-rc2/net/bluetooth/hci_core.c 2004-05-09 19:32:26.000000000 -0700 +++ linux-2.6.7-rc3/net/bluetooth/hci_core.c 2004-06-07 12:55:26.677602823 -0700 @@ -22,11 +22,7 @@ SOFTWARE IS DISCLAIMED. */ -/* - * Bluetooth HCI Core. - * - * $Id: hci_core.c,v 1.6 2002/04/17 17:37:16 maxk Exp $ - */ +/* Bluetooth HCI core. */ #include #include @@ -55,7 +51,7 @@ #ifndef CONFIG_BT_HCI_CORE_DEBUG #undef BT_DBG -#define BT_DBG( A... ) +#define BT_DBG(D...) #endif static void hci_cmd_task(unsigned long arg); @@ -288,6 +284,7 @@ read_unlock(&hci_dev_list_lock); return hdev; } +EXPORT_SYMBOL(hci_dev_get); /* ---- Inquiry support ---- */ void inquiry_cache_flush(struct hci_dev *hdev) @@ -369,15 +366,15 @@ hci_send_cmd(hdev, OGF_LINK_CTL, OCF_INQUIRY, sizeof(cp), &cp); } -int hci_inquiry(unsigned long arg) +int hci_inquiry(void __user *arg) { + __u8 __user *ptr = arg; struct hci_inquiry_req ir; struct hci_dev *hdev; int err = 0, do_inquiry = 0, max_rsp; long timeo; - __u8 *buf, *ptr; + __u8 *buf; - ptr = (void *) arg; if (copy_from_user(&ir, ptr, sizeof(ir))) return -EFAULT; @@ -416,7 +413,7 @@ if (!copy_to_user(ptr, &ir, sizeof(ir))) { ptr += sizeof(ir); - if (copy_to_user(ptr, buf, sizeof(struct inquiry_info) * + if (copy_to_user(ptr, buf, sizeof(struct inquiry_info) * ir.num_rsp)) err = -EFAULT; } else @@ -459,7 +456,7 @@ //__hci_request(hdev, hci_reset_req, 0, HZ); ret = __hci_request(hdev, hci_init_req, 0, HCI_INIT_TIMEOUT); - + clear_bit(HCI_INIT, &hdev->flags); } @@ -514,7 +511,7 @@ inquiry_cache_flush(hdev); hci_conn_hash_flush(hdev); hci_dev_unlock_bh(hdev); - + hci_notify(hdev, HCI_DEV_DOWN); if (hdev->flush) @@ -558,7 +555,7 @@ { struct hci_dev *hdev; int err; - + if (!(hdev = hci_dev_get(dev))) return -ENODEV; err = hci_dev_do_close(hdev); @@ -619,13 +616,13 @@ return ret; } -int hci_dev_cmd(unsigned int cmd, unsigned long arg) +int hci_dev_cmd(unsigned int cmd, void __user *arg) { struct hci_dev *hdev; struct hci_dev_req dr; int err = 0; - if (copy_from_user(&dr, (void *) arg, sizeof(dr))) + if (copy_from_user(&dr, arg, sizeof(dr))) return -EFAULT; if (!(hdev = hci_dev_get(dr.dev_id))) @@ -649,19 +646,19 @@ if (err) break; } - + err = hci_request(hdev, hci_encrypt_req, dr.dev_opt, HCI_INIT_TIMEOUT); break; - + case HCISETSCAN: err = hci_request(hdev, hci_scan_req, dr.dev_opt, HCI_INIT_TIMEOUT); break; - + case HCISETPTYPE: hdev->pkt_type = (__u16) dr.dev_opt; break; - + case HCISETLINKPOL: hdev->link_policy = (__u16) dr.dev_opt; break; @@ -683,12 +680,12 @@ default: err = -EINVAL; break; - } + } hci_dev_put(hdev); return err; } -int hci_get_dev_list(unsigned long arg) +int hci_get_dev_list(void __user *arg) { struct hci_dev_list_req *dl; struct hci_dev_req *dr; @@ -696,7 +693,7 @@ int n = 0, size, err; __u16 dev_num; - if (get_user(dev_num, (__u16 *) arg)) + if (get_user(dev_num, (__u16 __user *) arg)) return -EFAULT; if (!dev_num || dev_num > (PAGE_SIZE * 2) / sizeof(*dr)) @@ -723,19 +720,19 @@ dl->dev_num = n; size = sizeof(*dl) + n * sizeof(*dr); - err = copy_to_user((void *) arg, dl, size); + err = copy_to_user(arg, dl, size); kfree(dl); return err ? -EFAULT : 0; } -int hci_get_dev_info(unsigned long arg) +int hci_get_dev_info(void __user *arg) { struct hci_dev *hdev; struct hci_dev_info di; int err = 0; - if (copy_from_user(&di, (void *) arg, sizeof(di))) + if (copy_from_user(&di, arg, sizeof(di))) return -EFAULT; if (!(hdev = hci_dev_get(di.dev_id))) @@ -756,7 +753,7 @@ memcpy(&di.stat, &hdev->stat, sizeof(di.stat)); memcpy(&di.features, &hdev->features, sizeof(di.features)); - if (copy_to_user((void *) arg, &di, sizeof(di))) + if (copy_to_user(arg, &di, sizeof(di))) err = -EFAULT; hci_dev_put(hdev); @@ -779,6 +776,7 @@ return hdev; } +EXPORT_SYMBOL(hci_alloc_dev); /* Free HCI device */ void hci_free_dev(struct hci_dev *hdev) @@ -786,6 +784,7 @@ /* will free via class release */ class_device_put(&hdev->class_dev); } +EXPORT_SYMBOL(hci_free_dev); /* Register HCI device */ int hci_register_dev(struct hci_dev *hdev) @@ -802,7 +801,7 @@ /* Find first available device id */ list_for_each(p, &hci_dev_list) { - if (list_entry(p, struct hci_dev, list)->id != id) + if (list_entry(p, struct hci_dev, list)->id != id) break; head = p; id++; } @@ -813,7 +812,7 @@ atomic_set(&hdev->refcnt, 1); spin_lock_init(&hdev->lock); - + hdev->flags = 0; hdev->pkt_type = (HCI_DM1 | HCI_DH1 | HCI_HV1); hdev->link_mode = (HCI_LM_ACCEPT); @@ -836,7 +835,7 @@ memset(&hdev->stat, 0, sizeof(struct hci_dev_stats)); atomic_set(&hdev->promisc, 0); - + write_unlock_bh(&hci_dev_list_lock); hci_register_sysfs(hdev); @@ -845,6 +844,7 @@ return id; } +EXPORT_SYMBOL(hci_register_dev); /* Unregister HCI device */ int hci_unregister_dev(struct hci_dev *hdev) @@ -864,6 +864,7 @@ __hci_dev_put(hdev); return 0; } +EXPORT_SYMBOL(hci_unregister_dev); /* Suspend HCI device */ int hci_suspend_dev(struct hci_dev *hdev) @@ -871,13 +872,15 @@ hci_notify(hdev, HCI_DEV_SUSPEND); return 0; } +EXPORT_SYMBOL(hci_suspend_dev); /* Resume HCI device */ int hci_resume_dev(struct hci_dev *hdev) { hci_notify(hdev, HCI_DEV_RESUME); return 0; -} +} +EXPORT_SYMBOL(hci_resume_dev); /* ---- Interface to upper protocols ---- */ @@ -903,6 +906,7 @@ return err; } +EXPORT_SYMBOL(hci_register_proto); int hci_unregister_proto(struct hci_proto *hp) { @@ -924,6 +928,7 @@ return err; } +EXPORT_SYMBOL(hci_unregister_proto); static int hci_send_frame(struct sk_buff *skb) { @@ -938,7 +943,7 @@ if (atomic_read(&hdev->promisc)) { /* Time stamp */ - do_gettimeofday(&skb->stamp); + do_gettimeofday(&skb->stamp); hci_send_to_sock(hdev, skb); } @@ -980,6 +985,7 @@ return 0; } +EXPORT_SYMBOL(hci_send_cmd); /* Get data from the previously sent command */ void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 ogf, __u16 ocf) @@ -1026,7 +1032,7 @@ if (!(list = skb_shinfo(skb)->frag_list)) { /* Non fragmented */ BT_DBG("%s nonfrag skb %p len %d", hdev->name, skb, skb->len); - + skb_queue_tail(&conn->data_q, skb); } else { /* Fragmented */ @@ -1044,7 +1050,7 @@ skb->dev = (void *) hdev; skb->pkt_type = HCI_ACLDATA_PKT; hci_add_acl_hdr(skb, conn->handle, flags | ACL_CONT); - + BT_DBG("%s frag %p len %d", hdev->name, skb, skb->len); __skb_queue_tail(&conn->data_q, skb); @@ -1052,10 +1058,11 @@ spin_unlock_bh(&conn->data_q.lock); } - + hci_sched_tx(hdev); return 0; } +EXPORT_SYMBOL(hci_send_acl); /* Send SCO data */ int hci_send_sco(struct hci_conn *conn, struct sk_buff *skb) @@ -1082,6 +1089,7 @@ hci_sched_tx(hdev); return 0; } +EXPORT_SYMBOL(hci_send_sco); /* ---- HCI TX task (outgoing data) ---- */ @@ -1091,7 +1099,7 @@ struct hci_conn_hash *h = &hdev->conn_hash; struct hci_conn *conn = NULL; int num = 0, min = ~0; - struct list_head *p; + struct list_head *p; /* We don't have to lock device here. Connections are always * added and removed with TX task disabled. */ @@ -1124,7 +1132,7 @@ static inline void hci_acl_tx_to(struct hci_dev *hdev) { struct hci_conn_hash *h = &hdev->conn_hash; - struct list_head *p; + struct list_head *p; struct hci_conn *c; BT_ERR("%s ACL tx timeout", hdev->name); @@ -1265,7 +1273,7 @@ hci_dev_lock(hdev); conn = hci_conn_hash_lookup_handle(hdev, handle); hci_dev_unlock(hdev); - + if (conn) { register struct hci_proto *hp; @@ -1348,7 +1356,7 @@ BT_ERR("%s command tx timeout", hdev->name); atomic_set(&hdev->cmd_cnt, 1); } - + /* Send queued commands */ if (atomic_read(&hdev->cmd_cnt) && (skb = skb_dequeue(&hdev->cmd_q))) { if (hdev->sent_cmd) diff -urN linux-2.6.7-rc2/net/bluetooth/hci_event.c linux-2.6.7-rc3/net/bluetooth/hci_event.c --- linux-2.6.7-rc2/net/bluetooth/hci_event.c 2004-05-09 19:31:58.000000000 -0700 +++ linux-2.6.7-rc3/net/bluetooth/hci_event.c 2004-06-07 12:55:26.679602906 -0700 @@ -22,11 +22,7 @@ SOFTWARE IS DISCLAIMED. */ -/* - * HCI Events. - * - * $Id: hci_event.c,v 1.3 2002/04/17 17:37:16 maxk Exp $ - */ +/* Bluetooth HCI event handling. */ #include #include @@ -54,7 +50,7 @@ #ifndef CONFIG_BT_HCI_CORE_DEBUG #undef BT_DBG -#define BT_DBG( A... ) +#define BT_DBG(D...) #endif /* Handle HCI Event packets */ @@ -98,9 +94,9 @@ if (rd->status) break; - + hci_dev_lock(hdev); - + conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(rd->handle)); if (conn) { if (rd->role) @@ -355,7 +351,7 @@ return; hci_dev_lock(hdev); - + conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &cp->bdaddr); BT_DBG("%s status 0x%x bdaddr %s conn %p", hdev->name, @@ -572,7 +568,7 @@ BT_DBG("%s", hdev->name); hci_dev_lock(hdev); - + conn = hci_conn_hash_lookup_ba(hdev, ev->link_type, &ev->bdaddr); if (!conn) { hci_dev_unlock(hdev); @@ -585,7 +581,7 @@ if (test_bit(HCI_AUTH, &hdev->flags)) conn->link_mode |= HCI_LM_AUTH; - + if (test_bit(HCI_ENCRYPT, &hdev->flags)) conn->link_mode |= HCI_LM_ENCRYPT; @@ -643,7 +639,7 @@ return; hci_dev_lock(hdev); - + conn = hci_conn_hash_lookup_handle(hdev, handle); if (conn) { conn->state = BT_CLOSED; @@ -709,7 +705,7 @@ return; hci_dev_lock(hdev); - + conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); if (conn) { if (ev->role) @@ -731,7 +727,7 @@ BT_DBG("%s status %d", hdev->name, ev->status); hci_dev_lock(hdev); - + conn = hci_conn_hash_lookup_handle(hdev, handle); if (conn) { if (!ev->status) @@ -739,7 +735,7 @@ clear_bit(HCI_CONN_AUTH_PEND, &conn->pend); hci_proto_auth_cfm(conn, ev->status); - + if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend)) { if (!ev->status) { struct hci_cp_set_conn_encrypt cp; @@ -768,11 +764,11 @@ BT_DBG("%s status %d", hdev->name, ev->status); hci_dev_lock(hdev); - + conn = hci_conn_hash_lookup_handle(hdev, handle); if (conn) { if (!ev->status) { - if (ev->encrypt) + if (ev->encrypt) conn->link_mode |= HCI_LM_ENCRYPT; else conn->link_mode &= ~HCI_LM_ENCRYPT; @@ -840,7 +836,7 @@ case HCI_EV_CMD_STATUS: cs = (struct hci_ev_cmd_status *) skb->data; skb_pull(skb, sizeof(cs)); - + opcode = __le16_to_cpu(cs->opcode); ogf = hci_opcode_ogf(opcode); ocf = hci_opcode_ocf(opcode); @@ -928,15 +924,16 @@ return; hdr = (void *) skb_put(skb, HCI_EVENT_HDR_SIZE); - hdr->evt = HCI_EV_STACK_INTERNAL; + hdr->evt = HCI_EV_STACK_INTERNAL; hdr->plen = sizeof(*ev) + dlen; ev = (void *) skb_put(skb, sizeof(*ev) + dlen); ev->type = type; memcpy(ev->data, data, dlen); - + skb->pkt_type = HCI_EVENT_PKT; skb->dev = (void *) hdev; hci_send_to_sock(hdev, skb); kfree_skb(skb); } +EXPORT_SYMBOL(hci_si_event); diff -urN linux-2.6.7-rc2/net/bluetooth/hci_sock.c linux-2.6.7-rc3/net/bluetooth/hci_sock.c --- linux-2.6.7-rc2/net/bluetooth/hci_sock.c 2004-06-07 12:54:53.276219382 -0700 +++ linux-2.6.7-rc3/net/bluetooth/hci_sock.c 2004-06-07 12:55:26.680602948 -0700 @@ -22,11 +22,7 @@ SOFTWARE IS DISCLAIMED. */ -/* - * Bluetooth HCI socket layer. - * - * $Id: hci_sock.c,v 1.4 2002/04/18 22:26:14 maxk Exp $ - */ +/* Bluetooth HCI sockets. */ #include #include @@ -56,7 +52,7 @@ #ifndef CONFIG_BT_HCI_SOCK_DEBUG #undef BT_DBG -#define BT_DBG( A... ) +#define BT_DBG(D...) #endif /* ----- HCI socket interface ----- */ @@ -139,7 +135,6 @@ if (sock_queue_rcv_skb(sk, nskb)) kfree_skb(nskb); - } read_unlock(&hci_sk_list.lock); } @@ -191,7 +186,7 @@ return 0; case HCIGETCONNINFO: - return hci_get_conn_info(hdev, arg); + return hci_get_conn_info(hdev, (void __user *)arg); default: if (hdev->ioctl) @@ -203,19 +198,20 @@ static int hci_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) { struct sock *sk = sock->sk; + void __user *argp = (void __user *)arg; int err; BT_DBG("cmd %x arg %lx", cmd, arg); switch (cmd) { case HCIGETDEVLIST: - return hci_get_dev_list(arg); + return hci_get_dev_list(argp); case HCIGETDEVINFO: - return hci_get_dev_info(arg); + return hci_get_dev_info(argp); case HCIGETCONNLIST: - return hci_get_conn_list(arg); + return hci_get_conn_list(argp); case HCIDEVUP: if (!capable(CAP_NET_ADMIN)) @@ -247,10 +243,10 @@ case HCISETSCOMTU: if (!capable(CAP_NET_ADMIN)) return -EACCES; - return hci_dev_cmd(cmd, arg); + return hci_dev_cmd(cmd, argp); case HCIINQUIRY: - return hci_inquiry(arg); + return hci_inquiry(argp); default: lock_sock(sk); @@ -318,14 +314,14 @@ __u32 mask = hci_pi(sk)->cmsg_mask; if (mask & HCI_CMSG_DIR) - put_cmsg(msg, SOL_HCI, HCI_CMSG_DIR, sizeof(int), &bt_cb(skb)->incoming); + put_cmsg(msg, SOL_HCI, HCI_CMSG_DIR, sizeof(int), &bt_cb(skb)->incoming); if (mask & HCI_CMSG_TSTAMP) - put_cmsg(msg, SOL_HCI, HCI_CMSG_TSTAMP, sizeof(skb->stamp), &skb->stamp); + put_cmsg(msg, SOL_HCI, HCI_CMSG_TSTAMP, sizeof(skb->stamp), &skb->stamp); } static int hci_sock_recvmsg(struct kiocb *iocb, struct socket *sock, - struct msghdr *msg, size_t len, int flags) + struct msghdr *msg, size_t len, int flags) { int noblock = flags & MSG_DONTWAIT; struct sock *sk = sock->sk; @@ -355,7 +351,7 @@ err = skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copied); hci_sock_cmsg(sk, msg, skb); - + skb_free_datagram(sk, skb); return err ? : copied; @@ -406,7 +402,7 @@ if (((ogf > HCI_SFLT_MAX_OGF) || !hci_test_bit(ocf & HCI_FLT_OCF_BITS, &hci_sec_filter.ocf_mask[ogf])) && - !capable(CAP_NET_RAW)) { + !capable(CAP_NET_RAW)) { err = -EPERM; goto drop; } @@ -487,9 +483,9 @@ uf.event_mask[1] &= *((u32 *) hci_sec_filter.event_mask + 1); } - { + { struct hci_filter *f = &hci_pi(sk)->filter; - + f->type_mask = uf.type_mask; f->opcode = uf.opcode; *((u32 *) f->event_mask + 0) = uf.event_mask[0]; @@ -501,7 +497,7 @@ err = -ENOPROTOOPT; break; } - + release_sock(sk); return err; } @@ -539,7 +535,7 @@ case HCI_FILTER: { struct hci_filter *f = &hci_pi(sk)->filter; - + uf.type_mask = f->type_mask; uf.opcode = f->opcode; uf.event_mask[0] = *((u32 *) f->event_mask + 0); @@ -560,23 +556,23 @@ } struct proto_ops hci_sock_ops = { - .family = PF_BLUETOOTH, - .owner = THIS_MODULE, - .release = hci_sock_release, - .bind = hci_sock_bind, - .getname = hci_sock_getname, - .sendmsg = hci_sock_sendmsg, - .recvmsg = hci_sock_recvmsg, - .ioctl = hci_sock_ioctl, - .poll = datagram_poll, - .listen = sock_no_listen, - .shutdown = sock_no_shutdown, - .setsockopt = hci_sock_setsockopt, - .getsockopt = hci_sock_getsockopt, - .connect = sock_no_connect, - .socketpair = sock_no_socketpair, - .accept = sock_no_accept, - .mmap = sock_no_mmap + .family = PF_BLUETOOTH, + .owner = THIS_MODULE, + .release = hci_sock_release, + .bind = hci_sock_bind, + .getname = hci_sock_getname, + .sendmsg = hci_sock_sendmsg, + .recvmsg = hci_sock_recvmsg, + .ioctl = hci_sock_ioctl, + .poll = datagram_poll, + .listen = sock_no_listen, + .shutdown = sock_no_shutdown, + .setsockopt = hci_sock_setsockopt, + .getsockopt = hci_sock_getsockopt, + .connect = sock_no_connect, + .socketpair = sock_no_socketpair, + .accept = sock_no_accept, + .mmap = sock_no_mmap }; static int hci_sock_create(struct socket *sock, int protocol) @@ -597,7 +593,7 @@ sk_set_owner(sk, THIS_MODULE); sock->state = SS_UNCONNECTED; - sk->sk_state = BT_OPEN; + sk->sk_state = BT_OPEN; bt_sock_link(&hci_sk_list, sk); return 0; @@ -607,14 +603,14 @@ { struct hci_dev *hdev = (struct hci_dev *) ptr; struct hci_ev_si_device ev; - + BT_DBG("hdev %s event %ld", hdev->name, event); /* Send event to sockets */ ev.event = event; ev.dev_id = hdev->id; hci_si_event(NULL, HCI_EV_SI_DEVICE, sizeof(ev), &ev); - + if (event == HCI_DEV_UNREG) { struct sock *sk; struct hlist_node *node; @@ -640,9 +636,9 @@ } struct net_proto_family hci_sock_family_ops = { - .family = PF_BLUETOOTH, + .family = PF_BLUETOOTH, .owner = THIS_MODULE, - .create = hci_sock_create, + .create = hci_sock_create, }; struct notifier_block hci_sock_nblock = { diff -urN linux-2.6.7-rc2/net/bluetooth/hci_sysfs.c linux-2.6.7-rc3/net/bluetooth/hci_sysfs.c --- linux-2.6.7-rc2/net/bluetooth/hci_sysfs.c 2004-05-09 19:33:04.000000000 -0700 +++ linux-2.6.7-rc3/net/bluetooth/hci_sysfs.c 2004-06-07 12:55:26.681602989 -0700 @@ -1,3 +1,5 @@ +/* Bluetooth HCI driver model support. */ + #include #include #include @@ -7,7 +9,7 @@ #ifndef CONFIG_BT_HCI_CORE_DEBUG #undef BT_DBG -#define BT_DBG( A... ) +#define BT_DBG(D...) #endif static ssize_t show_name(struct class_device *cdev, char *buf) diff -urN linux-2.6.7-rc2/net/bluetooth/l2cap.c linux-2.6.7-rc3/net/bluetooth/l2cap.c --- linux-2.6.7-rc2/net/bluetooth/l2cap.c 2004-06-07 12:54:53.279219507 -0700 +++ linux-2.6.7-rc3/net/bluetooth/l2cap.c 2004-06-07 12:55:26.683603072 -0700 @@ -22,12 +22,7 @@ SOFTWARE IS DISCLAIMED. */ -/* - * Bluetooth L2CAP core and sockets. - * - * $Id: l2cap.c,v 1.15 2002/09/09 01:14:52 maxk Exp $ - */ -#define VERSION "2.1" +/* Bluetooth L2CAP core and sockets. */ #include #include @@ -59,9 +54,11 @@ #ifndef CONFIG_BT_L2CAP_DEBUG #undef BT_DBG -#define BT_DBG( A... ) +#define BT_DBG(D...) #endif +#define VERSION "2.2" + static struct proto_ops l2cap_sock_ops; struct bt_sock_list l2cap_sk_list = { @@ -135,11 +132,11 @@ hcon->l2cap_data = conn; conn->hcon = hcon; - + conn->mtu = hcon->hdev->acl_mtu; conn->src = &hcon->hdev->bdaddr; conn->dst = &hcon->dst; - + spin_lock_init(&conn->lock); conn->chan_list.lock = RW_LOCK_UNLOCKED; @@ -374,10 +371,10 @@ if (sock->type != SOCK_SEQPACKET && sock->type != SOCK_DGRAM && sock->type != SOCK_RAW) return -ESOCKTNOSUPPORT; - + if (sock->type == SOCK_RAW && !capable(CAP_NET_RAW)) return -EPERM; - + sock->ops = &l2cap_sock_ops; sk = l2cap_sock_alloc(sock, protocol, GFP_KERNEL); @@ -407,6 +404,7 @@ } write_lock_bh(&l2cap_sk_list.lock); + if (la->l2_psm && __l2cap_get_sock_by_addr(la->l2_psm, &la->l2_bdaddr)) { err = -EADDRINUSE; } else { @@ -416,6 +414,7 @@ l2cap_pi(sk)->sport = la->l2_psm; sk->sk_state = BT_BOUND; } + write_unlock_bh(&l2cap_sk_list.lock); done: @@ -428,8 +427,8 @@ bdaddr_t *src = &bt_sk(sk)->src; bdaddr_t *dst = &bt_sk(sk)->dst; struct l2cap_conn *conn; - struct hci_conn *hcon; - struct hci_dev *hdev; + struct hci_conn *hcon; + struct hci_dev *hdev; int err = 0; BT_DBG("%s -> %s psm 0x%2.2x", batostr(src), batostr(dst), l2cap_pi(sk)->psm); @@ -550,8 +549,25 @@ } if (!l2cap_pi(sk)->psm) { + bdaddr_t *src = &bt_sk(sk)->src; + u16 psm; + err = -EINVAL; - goto done; + + write_lock_bh(&l2cap_sk_list.lock); + + for (psm = 0x1001; psm < 0x1100; psm += 2) + if (!__l2cap_get_sock_by_addr(psm, src)) { + l2cap_pi(sk)->psm = htobs(psm); + l2cap_pi(sk)->sport = htobs(psm); + err = 0; + break; + } + + write_unlock_bh(&l2cap_sk_list.lock); + + if (err < 0) + goto done; } sk->sk_max_ack_backlog = backlog; @@ -834,7 +850,8 @@ BT_DBG("sock %p, sk %p", sock, sk); - if (!sk) return 0; + if (!sk) + return 0; lock_sock(sk); if (!sk->sk_shutdown) { @@ -856,7 +873,8 @@ BT_DBG("sock %p, sk %p", sock, sk); - if (!sk) return 0; + if (!sk) + return 0; err = l2cap_sock_shutdown(sock, 2); @@ -988,7 +1006,7 @@ sk->sk_state = BT_CLOSED; sk->sk_zapped = 1; - + if (err) sk->sk_err = err; @@ -1111,7 +1129,7 @@ len = L2CAP_HDR_SIZE + L2CAP_CMD_HDR_SIZE + dlen; count = min_t(unsigned int, conn->mtu, len); - + skb = bt_skb_alloc(count, GFP_ATOMIC); if (!skb) return NULL; @@ -1132,7 +1150,7 @@ } len -= skb->len; - + /* Continuation fragments (no L2CAP header) */ frag = &skb_shinfo(skb)->frag_list; while (len) { @@ -1141,12 +1159,12 @@ *frag = bt_skb_alloc(count, GFP_ATOMIC); if (!*frag) goto fail; - + memcpy(skb_put(*frag, count), data, count); len -= count; data += count; - + frag = &(*frag)->next; } @@ -1238,7 +1256,7 @@ case L2CAP_CONF_QOS: break; - + default: if (hint) break; @@ -1306,8 +1324,7 @@ int result = 0; /* Configure output options and let the other side know - * which ones we don't like. - */ + * which ones we don't like. */ if (pi->conf_mtu < pi->omtu) { l2cap_add_conf_opt(ptr, L2CAP_CONF_MTU, 2, pi->omtu); result = L2CAP_CONF_UNACCEPT; @@ -1533,13 +1550,11 @@ case L2CAP_CONF_UNACCEPT: if (++l2cap_pi(sk)->conf_retry < L2CAP_CONF_MAX_RETRIES) { char req[128]; - /* - It does not make sense to adjust L2CAP parameters - that are currently defined in the spec. We simply - resend config request that we sent earlier. It is - stupid :) but it helps qualification testing - which expects at least some response from us. - */ + /* It does not make sense to adjust L2CAP parameters + * that are currently defined in the spec. We simply + * resend config request that we sent earlier. It is + * stupid, but it helps qualification testing which + * expects at least some response from us. */ l2cap_send_req(conn, L2CAP_CONF_REQ, l2cap_build_conf_req(sk, req), req); goto done; @@ -1594,7 +1609,7 @@ l2cap_send_rsp(conn, cmd->ident, L2CAP_DISCONN_RSP, sizeof(rsp), &rsp); sk->sk_shutdown = SHUTDOWN_MASK; - + l2cap_chan_del(sk, ECONNRESET); bh_unlock_sock(sk); @@ -1723,11 +1738,11 @@ if (l2cap_pi(sk)->imtu < skb->len) goto drop; - /* If socket recv buffers overflows we drop data here - * which is *bad* because L2CAP has to be reliable. - * But we don't have any other choice. L2CAP doesn't - * provide flow control mechanism */ - + /* If socket recv buffers overflows we drop data here + * which is *bad* because L2CAP has to be reliable. + * But we don't have any other choice. L2CAP doesn't + * provide flow control mechanism */ + if (!sock_queue_rcv_skb(sk, skb)) goto done; @@ -1787,7 +1802,7 @@ skb_pull(skb, 2); l2cap_conless_channel(conn, psm, skb); break; - + default: l2cap_data_channel(conn, cid, skb); break; @@ -1839,7 +1854,7 @@ l2cap_conn_ready(conn); } else l2cap_conn_del(hcon, bt_err(status)); - + return 0; } @@ -1861,7 +1876,7 @@ struct l2cap_conn_rsp rsp; struct sock *sk; int result; - + if (!(conn = hcon->l2cap_data)) return 0; l = &conn->chan_list; @@ -1908,7 +1923,7 @@ struct l2cap_conn_rsp rsp; struct sock *sk; int result; - + if (!(conn = hcon->l2cap_data)) return 0; l = &conn->chan_list; @@ -2069,10 +2084,10 @@ } static struct seq_operations l2cap_seq_ops = { - .start = l2cap_seq_start, - .next = l2cap_seq_next, - .stop = l2cap_seq_stop, - .show = l2cap_seq_show + .start = l2cap_seq_start, + .next = l2cap_seq_next, + .stop = l2cap_seq_stop, + .show = l2cap_seq_show }; static int l2cap_seq_open(struct inode *inode, struct file *file) @@ -2081,76 +2096,76 @@ } static struct file_operations l2cap_seq_fops = { - .owner = THIS_MODULE, - .open = l2cap_seq_open, - .read = seq_read, - .llseek = seq_lseek, - .release = seq_release, + .owner = THIS_MODULE, + .open = l2cap_seq_open, + .read = seq_read, + .llseek = seq_lseek, + .release = seq_release, }; -static int __init l2cap_proc_init(void) +static int __init l2cap_proc_init(void) { - struct proc_dir_entry *p = create_proc_entry("l2cap", S_IRUGO, proc_bt); - if (!p) - return -ENOMEM; + struct proc_dir_entry *p = create_proc_entry("l2cap", S_IRUGO, proc_bt); + if (!p) + return -ENOMEM; p->owner = THIS_MODULE; - p->proc_fops = &l2cap_seq_fops; - return 0; + p->proc_fops = &l2cap_seq_fops; + return 0; } static void __exit l2cap_proc_cleanup(void) { - remove_proc_entry("l2cap", proc_bt); + remove_proc_entry("l2cap", proc_bt); } #else /* CONFIG_PROC_FS */ -static int __init l2cap_proc_init(void) +static int __init l2cap_proc_init(void) { - return 0; + return 0; } static void __exit l2cap_proc_cleanup(void) { - return; + return; } #endif /* CONFIG_PROC_FS */ static struct proto_ops l2cap_sock_ops = { - .family = PF_BLUETOOTH, - .owner = THIS_MODULE, - .release = l2cap_sock_release, - .bind = l2cap_sock_bind, - .connect = l2cap_sock_connect, - .listen = l2cap_sock_listen, - .accept = l2cap_sock_accept, - .getname = l2cap_sock_getname, - .sendmsg = l2cap_sock_sendmsg, - .recvmsg = bt_sock_recvmsg, - .poll = bt_sock_poll, - .mmap = sock_no_mmap, - .socketpair = sock_no_socketpair, - .ioctl = sock_no_ioctl, - .shutdown = l2cap_sock_shutdown, - .setsockopt = l2cap_sock_setsockopt, - .getsockopt = l2cap_sock_getsockopt + .family = PF_BLUETOOTH, + .owner = THIS_MODULE, + .release = l2cap_sock_release, + .bind = l2cap_sock_bind, + .connect = l2cap_sock_connect, + .listen = l2cap_sock_listen, + .accept = l2cap_sock_accept, + .getname = l2cap_sock_getname, + .sendmsg = l2cap_sock_sendmsg, + .recvmsg = bt_sock_recvmsg, + .poll = bt_sock_poll, + .mmap = sock_no_mmap, + .socketpair = sock_no_socketpair, + .ioctl = sock_no_ioctl, + .shutdown = l2cap_sock_shutdown, + .setsockopt = l2cap_sock_setsockopt, + .getsockopt = l2cap_sock_getsockopt }; static struct net_proto_family l2cap_sock_family_ops = { - .family = PF_BLUETOOTH, - .create = l2cap_sock_create, - .owner = THIS_MODULE, + .family = PF_BLUETOOTH, + .owner = THIS_MODULE, + .create = l2cap_sock_create, }; static struct hci_proto l2cap_hci_proto = { - .name = "L2CAP", - .id = HCI_PROTO_L2CAP, - .connect_ind = l2cap_connect_ind, - .connect_cfm = l2cap_connect_cfm, - .disconn_ind = l2cap_disconn_ind, - .auth_cfm = l2cap_auth_cfm, - .encrypt_cfm = l2cap_encrypt_cfm, - .recv_acldata = l2cap_recv_acldata + .name = "L2CAP", + .id = HCI_PROTO_L2CAP, + .connect_ind = l2cap_connect_ind, + .connect_cfm = l2cap_connect_cfm, + .disconn_ind = l2cap_disconn_ind, + .auth_cfm = l2cap_auth_cfm, + .encrypt_cfm = l2cap_encrypt_cfm, + .recv_acldata = l2cap_recv_acldata }; static int __init l2cap_init(void) @@ -2168,7 +2183,7 @@ } l2cap_proc_init(); - + BT_INFO("L2CAP ver %s", VERSION); BT_INFO("L2CAP socket layer initialized"); @@ -2189,9 +2204,9 @@ void l2cap_load(void) { - /* Dummy function to trigger automatic L2CAP module loading by - other modules that use L2CAP sockets but don not use any other - symbols from it. */ + /* Dummy function to trigger automatic L2CAP module loading by + * other modules that use L2CAP sockets but don not use any othe + * symbols from it. */ return; } EXPORT_SYMBOL(l2cap_load); diff -urN linux-2.6.7-rc2/net/bluetooth/lib.c linux-2.6.7-rc3/net/bluetooth/lib.c --- linux-2.6.7-rc2/net/bluetooth/lib.c 2004-05-09 19:31:59.000000000 -0700 +++ linux-2.6.7-rc3/net/bluetooth/lib.c 2004-06-07 12:55:26.684603113 -0700 @@ -22,11 +22,10 @@ SOFTWARE IS DISCLAIMED. */ -/* - * Bluetooth kernel library. - * - * $Id: lib.c,v 1.1 2002/03/08 21:06:59 maxk Exp $ - */ +/* Bluetooth kernel library. */ + +#include +#include #include #include @@ -58,6 +57,7 @@ if (line[0]) printk(KERN_INFO "%s:%s\n", pref, line); } +EXPORT_SYMBOL(bt_dump); void baswap(bdaddr_t *dst, bdaddr_t *src) { @@ -68,6 +68,7 @@ for (i = 0; i < 6; i++) d[i] = s[5 - i]; } +EXPORT_SYMBOL(baswap); char *batostr(bdaddr_t *ba) { @@ -76,11 +77,12 @@ i ^= 1; sprintf(str[i], "%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X", - ba->b[0], ba->b[1], ba->b[2], + ba->b[0], ba->b[1], ba->b[2], ba->b[3], ba->b[4], ba->b[5]); return str[i]; } +EXPORT_SYMBOL(batostr); /* Bluetooth error codes to Unix errno mapping */ int bt_err(__u16 code) @@ -173,3 +175,4 @@ return ENOSYS; } } +EXPORT_SYMBOL(bt_err); diff -urN linux-2.6.7-rc2/net/bluetooth/rfcomm/Kconfig linux-2.6.7-rc3/net/bluetooth/rfcomm/Kconfig --- linux-2.6.7-rc2/net/bluetooth/rfcomm/Kconfig 2004-05-09 19:32:37.000000000 -0700 +++ linux-2.6.7-rc3/net/bluetooth/rfcomm/Kconfig 2004-06-07 12:55:26.684603113 -0700 @@ -2,7 +2,7 @@ tristate "RFCOMM protocol support" depends on BT && BT_L2CAP help - RFCOMM provides connection oriented stream transport. RFCOMM + RFCOMM provides connection oriented stream transport. RFCOMM support is required for Dialup Networking, OBEX and other Bluetooth applications. diff -urN linux-2.6.7-rc2/net/bluetooth/rfcomm/core.c linux-2.6.7-rc3/net/bluetooth/rfcomm/core.c --- linux-2.6.7-rc2/net/bluetooth/rfcomm/core.c 2004-06-07 12:54:53.297220252 -0700 +++ linux-2.6.7-rc3/net/bluetooth/rfcomm/core.c 2004-06-07 12:55:26.685603155 -0700 @@ -50,7 +50,7 @@ #include #include -#define VERSION "1.2" +#define VERSION "1.3" #ifndef CONFIG_BT_RFCOMM_DEBUG #undef BT_DBG diff -urN linux-2.6.7-rc2/net/bluetooth/rfcomm/sock.c linux-2.6.7-rc3/net/bluetooth/rfcomm/sock.c --- linux-2.6.7-rc2/net/bluetooth/rfcomm/sock.c 2004-06-07 12:54:53.298220294 -0700 +++ linux-2.6.7-rc3/net/bluetooth/rfcomm/sock.c 2004-06-07 12:55:26.688603279 -0700 @@ -398,6 +398,27 @@ goto done; } + if (!rfcomm_pi(sk)->channel) { + bdaddr_t *src = &bt_sk(sk)->src; + u8 channel; + + err = -EINVAL; + + write_lock_bh(&rfcomm_sk_list.lock); + + for (channel = 1; channel < 31; channel++) + if (!__rfcomm_get_sock_by_addr(channel, src)) { + rfcomm_pi(sk)->channel = channel; + err = 0; + break; + } + + write_unlock_bh(&rfcomm_sk_list.lock); + + if (err < 0) + goto done; + } + sk->sk_max_ack_backlog = backlog; sk->sk_ack_backlog = 0; sk->sk_state = BT_LISTEN; @@ -686,7 +707,7 @@ lock_sock(sk); #ifdef CONFIG_BT_RFCOMM_TTY - err = rfcomm_dev_ioctl(sk, cmd, arg); + err = rfcomm_dev_ioctl(sk, cmd, (void __user *)arg); #else err = -EOPNOTSUPP; #endif diff -urN linux-2.6.7-rc2/net/bluetooth/rfcomm/tty.c linux-2.6.7-rc3/net/bluetooth/rfcomm/tty.c --- linux-2.6.7-rc2/net/bluetooth/rfcomm/tty.c 2004-05-09 19:32:37.000000000 -0700 +++ linux-2.6.7-rc3/net/bluetooth/rfcomm/tty.c 2004-06-07 12:55:26.689603321 -0700 @@ -302,13 +302,13 @@ #define NOCAP_FLAGS ((1 << RFCOMM_REUSE_DLC) | (1 << RFCOMM_RELEASE_ONHUP)) -static int rfcomm_create_dev(struct sock *sk, unsigned long arg) +static int rfcomm_create_dev(struct sock *sk, void __user *arg) { struct rfcomm_dev_req req; struct rfcomm_dlc *dlc; int id; - if (copy_from_user(&req, (void *) arg, sizeof(req))) + if (copy_from_user(&req, arg, sizeof(req))) return -EFAULT; BT_DBG("sk %p dev_id %id flags 0x%x", sk, req.dev_id, req.flags); @@ -344,12 +344,12 @@ return id; } -static int rfcomm_release_dev(unsigned long arg) +static int rfcomm_release_dev(void __user *arg) { struct rfcomm_dev_req req; struct rfcomm_dev *dev; - if (copy_from_user(&req, (void *) arg, sizeof(req))) + if (copy_from_user(&req, arg, sizeof(req))) return -EFAULT; BT_DBG("dev_id %id flags 0x%x", req.dev_id, req.flags); @@ -370,7 +370,7 @@ return 0; } -static int rfcomm_get_dev_list(unsigned long arg) +static int rfcomm_get_dev_list(void __user *arg) { struct rfcomm_dev_list_req *dl; struct rfcomm_dev_info *di; @@ -380,7 +380,7 @@ BT_DBG(""); - if (get_user(dev_num, (u16 *) arg)) + if (get_user(dev_num, (u16 __user *) arg)) return -EFAULT; if (!dev_num || dev_num > (PAGE_SIZE * 4) / sizeof(*di)) @@ -412,13 +412,13 @@ dl->dev_num = n; size = sizeof(*dl) + n * sizeof(*di); - err = copy_to_user((void *) arg, dl, size); + err = copy_to_user(arg, dl, size); kfree(dl); return err ? -EFAULT : 0; } -static int rfcomm_get_dev_info(unsigned long arg) +static int rfcomm_get_dev_info(void __user *arg) { struct rfcomm_dev *dev; struct rfcomm_dev_info di; @@ -426,7 +426,7 @@ BT_DBG(""); - if (copy_from_user(&di, (void *)arg, sizeof(di))) + if (copy_from_user(&di, arg, sizeof(di))) return -EFAULT; if (!(dev = rfcomm_dev_get(di.id))) @@ -438,16 +438,16 @@ bacpy(&di.src, &dev->src); bacpy(&di.dst, &dev->dst); - if (copy_to_user((void *)arg, &di, sizeof(di))) + if (copy_to_user(arg, &di, sizeof(di))) err = -EFAULT; rfcomm_dev_put(dev); return err; } -int rfcomm_dev_ioctl(struct sock *sk, unsigned int cmd, unsigned long arg) +int rfcomm_dev_ioctl(struct sock *sk, unsigned int cmd, void __user *arg) { - BT_DBG("cmd %d arg %ld", cmd, arg); + BT_DBG("cmd %d arg %p", cmd, arg); switch (cmd) { case RFCOMMCREATEDEV: diff -urN linux-2.6.7-rc2/net/bluetooth/sco.c linux-2.6.7-rc3/net/bluetooth/sco.c --- linux-2.6.7-rc2/net/bluetooth/sco.c 2004-06-07 12:54:53.299220335 -0700 +++ linux-2.6.7-rc3/net/bluetooth/sco.c 2004-06-07 12:55:26.690603362 -0700 @@ -22,12 +22,7 @@ SOFTWARE IS DISCLAIMED. */ -/* - * Bluetooth SCO sockets. - * - * $Id: sco.c,v 1.3 2002/04/17 17:37:16 maxk Exp $ - */ -#define VERSION "0.3" +/* Bluetooth SCO sockets. */ #include #include @@ -58,9 +53,11 @@ #ifndef CONFIG_BT_SCO_DEBUG #undef BT_DBG -#define BT_DBG( A... ) +#define BT_DBG(D...) #endif +#define VERSION "0.3" + static struct proto_ops sco_sock_ops; static struct bt_sock_list sco_sk_list = { @@ -137,7 +134,7 @@ conn->src = &hdev->bdaddr; conn->dst = &hcon->dst; - + if (hdev->sco_mtu > 0) conn->mtu = hdev->sco_mtu; else @@ -483,7 +480,7 @@ } write_lock_bh(&sco_sk_list.lock); - + if (bacmp(src, BDADDR_ANY) && __sco_get_sock_by_addr(src)) { err = -EADDRINUSE; } else { @@ -491,7 +488,7 @@ bacpy(&bt_sk(sk)->src, &sa->sco_bdaddr); sk->sk_state = BT_BOUND; } - + write_unlock_bh(&sco_sk_list.lock); done: @@ -694,7 +691,7 @@ err = -ENOTCONN; break; } - + opts.mtu = sco_pi(sk)->conn->mtu; BT_DBG("mtu %d", opts.mtu); @@ -737,7 +734,7 @@ if (!sk) return 0; - + sco_sock_close(sk); if (sock_flag(sk, SOCK_LINGER) && sk->sk_lingertime) { @@ -811,7 +808,7 @@ sk = sco_sock_alloc(NULL, BTPROTO_SCO, GFP_ATOMIC); if (!sk) { bh_unlock_sock(parent); - goto done; + goto done; } sco_sock_init(sk, parent); @@ -820,14 +817,14 @@ bacpy(&bt_sk(sk)->dst, conn->dst); hci_conn_hold(conn->hcon); - __sco_chan_add(conn, sk, parent); + __sco_chan_add(conn, sk, parent); - sk->sk_state = BT_CONNECTED; + sk->sk_state = BT_CONNECTED; /* Wake up parent */ parent->sk_data_ready(parent, 1); - - bh_unlock_sock(parent); + + bh_unlock_sock(parent); } done: @@ -858,7 +855,7 @@ sco_conn_ready(conn); } else sco_conn_del(hcon, bt_err(status)); - + return 0; } @@ -931,10 +928,10 @@ } static struct seq_operations sco_seq_ops = { - .start = sco_seq_start, - .next = sco_seq_next, - .stop = sco_seq_stop, - .show = sco_seq_show + .start = sco_seq_start, + .next = sco_seq_next, + .stop = sco_seq_stop, + .show = sco_seq_show }; static int sco_seq_open(struct inode *inode, struct file *file) @@ -943,74 +940,74 @@ } static struct file_operations sco_seq_fops = { - .owner = THIS_MODULE, - .open = sco_seq_open, - .read = seq_read, - .llseek = seq_lseek, - .release = seq_release, + .owner = THIS_MODULE, + .open = sco_seq_open, + .read = seq_read, + .llseek = seq_lseek, + .release = seq_release, }; -static int __init sco_proc_init(void) +static int __init sco_proc_init(void) { - struct proc_dir_entry *p = create_proc_entry("sco", S_IRUGO, proc_bt); - if (!p) - return -ENOMEM; + struct proc_dir_entry *p = create_proc_entry("sco", S_IRUGO, proc_bt); + if (!p) + return -ENOMEM; p->owner = THIS_MODULE; - p->proc_fops = &sco_seq_fops; - return 0; + p->proc_fops = &sco_seq_fops; + return 0; } static void __exit sco_proc_cleanup(void) { - remove_proc_entry("sco", proc_bt); + remove_proc_entry("sco", proc_bt); } #else /* CONFIG_PROC_FS */ -static int __init sco_proc_init(void) +static int __init sco_proc_init(void) { - return 0; + return 0; } static void __exit sco_proc_cleanup(void) { - return; + return; } #endif /* CONFIG_PROC_FS */ static struct proto_ops sco_sock_ops = { - .family = PF_BLUETOOTH, - .owner = THIS_MODULE, - .release = sco_sock_release, - .bind = sco_sock_bind, - .connect = sco_sock_connect, - .listen = sco_sock_listen, - .accept = sco_sock_accept, - .getname = sco_sock_getname, - .sendmsg = sco_sock_sendmsg, - .recvmsg = bt_sock_recvmsg, - .poll = bt_sock_poll, - .ioctl = sock_no_ioctl, - .mmap = sock_no_mmap, - .socketpair = sock_no_socketpair, - .shutdown = sock_no_shutdown, - .setsockopt = sco_sock_setsockopt, - .getsockopt = sco_sock_getsockopt + .family = PF_BLUETOOTH, + .owner = THIS_MODULE, + .release = sco_sock_release, + .bind = sco_sock_bind, + .connect = sco_sock_connect, + .listen = sco_sock_listen, + .accept = sco_sock_accept, + .getname = sco_sock_getname, + .sendmsg = sco_sock_sendmsg, + .recvmsg = bt_sock_recvmsg, + .poll = bt_sock_poll, + .ioctl = sock_no_ioctl, + .mmap = sock_no_mmap, + .socketpair = sock_no_socketpair, + .shutdown = sock_no_shutdown, + .setsockopt = sco_sock_setsockopt, + .getsockopt = sco_sock_getsockopt }; static struct net_proto_family sco_sock_family_ops = { - .family = PF_BLUETOOTH, - .create = sco_sock_create, - .owner = THIS_MODULE, + .family = PF_BLUETOOTH, + .owner = THIS_MODULE, + .create = sco_sock_create, }; static struct hci_proto sco_hci_proto = { - .name = "SCO", - .id = HCI_PROTO_SCO, - .connect_ind = sco_connect_ind, - .connect_cfm = sco_connect_cfm, - .disconn_ind = sco_disconn_ind, - .recv_scodata = sco_recv_scodata + .name = "SCO", + .id = HCI_PROTO_SCO, + .connect_ind = sco_connect_ind, + .connect_cfm = sco_connect_cfm, + .disconn_ind = sco_disconn_ind, + .recv_scodata = sco_recv_scodata }; static int __init sco_init(void) @@ -1028,7 +1025,7 @@ } sco_proc_init(); - + BT_INFO("SCO (Voice Link) ver %s", VERSION); BT_INFO("SCO socket layer initialized"); diff -urN linux-2.6.7-rc2/net/bluetooth/syms.c linux-2.6.7-rc3/net/bluetooth/syms.c --- linux-2.6.7-rc2/net/bluetooth/syms.c 2004-05-09 19:32:38.000000000 -0700 +++ linux-2.6.7-rc3/net/bluetooth/syms.c 1969-12-31 16:00:00.000000000 -0800 @@ -1,84 +0,0 @@ -/* - BlueZ - Bluetooth protocol stack for Linux - Copyright (C) 2000-2001 Qualcomm Incorporated - - Written 2000,2001 by Maxim Krasnyansky - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License version 2 as - published by the Free Software Foundation; - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. - IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY - CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - - ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, - COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS - SOFTWARE IS DISCLAIMED. -*/ - -/* - * Bluetooth symbols. - * - * $Id: syms.c,v 1.1 2002/03/08 21:06:59 maxk Exp $ - */ - -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include - -/* HCI Core */ -EXPORT_SYMBOL(hci_alloc_dev); -EXPORT_SYMBOL(hci_free_dev); -EXPORT_SYMBOL(hci_register_dev); -EXPORT_SYMBOL(hci_unregister_dev); -EXPORT_SYMBOL(hci_suspend_dev); -EXPORT_SYMBOL(hci_resume_dev); - -EXPORT_SYMBOL(hci_register_proto); -EXPORT_SYMBOL(hci_unregister_proto); - -EXPORT_SYMBOL(hci_get_route); -EXPORT_SYMBOL(hci_connect); -EXPORT_SYMBOL(hci_dev_get); -EXPORT_SYMBOL(hci_conn_auth); -EXPORT_SYMBOL(hci_conn_encrypt); - -EXPORT_SYMBOL(hci_send_acl); -EXPORT_SYMBOL(hci_send_sco); -EXPORT_SYMBOL(hci_send_cmd); -EXPORT_SYMBOL(hci_si_event); - -/* Bluetooth lib */ -EXPORT_SYMBOL(bt_dump); -EXPORT_SYMBOL(baswap); -EXPORT_SYMBOL(batostr); -EXPORT_SYMBOL(bt_err); - -/* Bluetooth sockets */ -EXPORT_SYMBOL(bt_sock_register); -EXPORT_SYMBOL(bt_sock_unregister); -EXPORT_SYMBOL(bt_sock_alloc); -EXPORT_SYMBOL(bt_sock_link); -EXPORT_SYMBOL(bt_sock_unlink); -EXPORT_SYMBOL(bt_sock_recvmsg); -EXPORT_SYMBOL(bt_sock_poll); -EXPORT_SYMBOL(bt_accept_enqueue); -EXPORT_SYMBOL(bt_accept_dequeue); -EXPORT_SYMBOL(bt_sock_wait_state); - -EXPORT_SYMBOL(proc_bt); diff -urN linux-2.6.7-rc2/net/bridge/br_ioctl.c linux-2.6.7-rc3/net/bridge/br_ioctl.c --- linux-2.6.7-rc2/net/bridge/br_ioctl.c 2004-06-07 12:54:53.324221370 -0700 +++ linux-2.6.7-rc3/net/bridge/br_ioctl.c 2004-06-07 12:55:26.737605309 -0700 @@ -143,7 +143,7 @@ b.gc_timer_value = br_timer_value(&br->gc_timer); rcu_read_unlock(); - if (copy_to_user((void *)args[1], &b, sizeof(b))) + if (copy_to_user((void __user *)args[1], &b, sizeof(b))) return -EFAULT; return 0; @@ -168,7 +168,7 @@ memset(indices, 0, num*sizeof(int)); get_port_ifindices(br, indices, num); - if (copy_to_user((void *)args[1], indices, num*sizeof(int))) + if (copy_to_user((void __user *)args[1], indices, num*sizeof(int))) num = -EFAULT; kfree(indices); return num; @@ -241,7 +241,7 @@ rcu_read_unlock(); - if (copy_to_user((void *)args[1], &p, sizeof(p))) + if (copy_to_user((void __user *)args[1], &p, sizeof(p))) return -EFAULT; return 0; @@ -308,11 +308,11 @@ return -EOPNOTSUPP; } -static int old_deviceless(unsigned long uarg) +static int old_deviceless(void __user *uarg) { unsigned long args[3]; - if (copy_from_user(args, (void *)uarg, sizeof(args))) + if (copy_from_user(args, uarg, sizeof(args))) return -EFAULT; switch (args[0]) { @@ -331,7 +331,7 @@ memset(indices, 0, args[2]*sizeof(int)); args[2] = get_bridge_ifindices(indices, args[2]); - ret = copy_to_user((void *)args[1], indices, args[2]*sizeof(int)) + ret = copy_to_user((void __user *)args[1], indices, args[2]*sizeof(int)) ? -EFAULT : args[2]; kfree(indices); @@ -346,7 +346,7 @@ if (!capable(CAP_NET_ADMIN)) return -EPERM; - if (copy_from_user(buf, (void *)args[1], IFNAMSIZ)) + if (copy_from_user(buf, (void __user *)args[1], IFNAMSIZ)) return -EFAULT; buf[IFNAMSIZ-1] = 0; @@ -361,7 +361,7 @@ return -EOPNOTSUPP; } -int br_ioctl_deviceless_stub(unsigned int cmd, unsigned long uarg) +int br_ioctl_deviceless_stub(unsigned int cmd, void __user *uarg) { switch (cmd) { case SIOCGIFBR: @@ -376,7 +376,7 @@ if (!capable(CAP_NET_ADMIN)) return -EPERM; - if (copy_from_user(buf, (void __user *) uarg, IFNAMSIZ)) + if (copy_from_user(buf, uarg, IFNAMSIZ)) return -EFAULT; buf[IFNAMSIZ-1] = 0; diff -urN linux-2.6.7-rc2/net/bridge/br_netfilter.c linux-2.6.7-rc3/net/bridge/br_netfilter.c --- linux-2.6.7-rc2/net/bridge/br_netfilter.c 2004-05-09 19:33:20.000000000 -0700 +++ linux-2.6.7-rc3/net/bridge/br_netfilter.c 2004-06-07 12:55:26.738605350 -0700 @@ -165,7 +165,7 @@ skb_pull(skb, VLAN_HLEN); skb->nh.raw += VLAN_HLEN; } - skb->dst->output(skb); + skb->dst->output(&skb); return 0; } @@ -800,7 +800,7 @@ #ifdef CONFIG_SYSCTL static int brnf_sysctl_call_tables(ctl_table *ctl, int write, struct file * filp, - void *buffer, size_t *lenp) + void __user *buffer, size_t *lenp) { int ret; diff -urN linux-2.6.7-rc2/net/bridge/br_private.h linux-2.6.7-rc3/net/bridge/br_private.h --- linux-2.6.7-rc2/net/bridge/br_private.h 2004-06-07 12:54:53.325221412 -0700 +++ linux-2.6.7-rc3/net/bridge/br_private.h 2004-06-07 12:55:26.749605806 -0700 @@ -175,7 +175,7 @@ /* br_ioctl.c */ extern int br_dev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); -extern int br_ioctl_deviceless_stub(unsigned int cmd, unsigned long arg); +extern int br_ioctl_deviceless_stub(unsigned int cmd, void __user *arg); /* br_netfilter.c */ extern int br_netfilter_init(void); diff -urN linux-2.6.7-rc2/net/compat.c linux-2.6.7-rc3/net/compat.c --- linux-2.6.7-rc2/net/compat.c 2004-05-09 19:32:51.000000000 -0700 +++ linux-2.6.7-rc3/net/compat.c 2004-06-07 12:55:26.827609037 -0700 @@ -29,7 +29,7 @@ #include static inline int iov_from_user_compat_to_kern(struct iovec *kiov, - struct compat_iovec *uiov32, + struct compat_iovec __user *uiov32, int niov) { int tot_len = 0; @@ -53,7 +53,7 @@ return tot_len; } -int get_compat_msghdr(struct msghdr *kmsg, struct compat_msghdr *umsg) +int get_compat_msghdr(struct msghdr *kmsg, struct compat_msghdr __user *umsg) { compat_uptr_t tmp1, tmp2, tmp3; @@ -98,7 +98,7 @@ } tot_len = iov_from_user_compat_to_kern(kern_iov, - (struct compat_iovec *)kern_msg->msg_iov, + (struct compat_iovec __user *)kern_msg->msg_iov, kern_msg->msg_iovlen); if(tot_len >= 0) kern_msg->msg_iov = kern_iov; @@ -112,7 +112,7 @@ #define CMSG_COMPAT_ALIGN(len) ALIGN((len), sizeof(s32)) #define CMSG_COMPAT_DATA(cmsg) \ - ((void *)((char *)(cmsg) + CMSG_COMPAT_ALIGN(sizeof(struct compat_cmsghdr)))) + ((void __user *)((char __user *)(cmsg) + CMSG_COMPAT_ALIGN(sizeof(struct compat_cmsghdr)))) #define CMSG_COMPAT_SPACE(len) \ (CMSG_COMPAT_ALIGN(sizeof(struct compat_cmsghdr)) + CMSG_COMPAT_ALIGN(len)) #define CMSG_COMPAT_LEN(len) \ @@ -120,20 +120,17 @@ #define CMSG_COMPAT_FIRSTHDR(msg) \ (((msg)->msg_controllen) >= sizeof(struct compat_cmsghdr) ? \ - (struct compat_cmsghdr *)((msg)->msg_control) : \ - (struct compat_cmsghdr *)NULL) + (struct compat_cmsghdr __user *)((msg)->msg_control) : \ + (struct compat_cmsghdr __user *)NULL) -static inline struct compat_cmsghdr *cmsg_compat_nxthdr(struct msghdr *msg, - struct compat_cmsghdr *cmsg, int cmsg_len) +static inline struct compat_cmsghdr __user *cmsg_compat_nxthdr(struct msghdr *msg, + struct compat_cmsghdr __user *cmsg, int cmsg_len) { - struct compat_cmsghdr *ptr; - - ptr = (struct compat_cmsghdr *)(((unsigned char *)cmsg) + - CMSG_COMPAT_ALIGN(cmsg_len)); - if ((unsigned long)((char *)(ptr + 1) - (char *)msg->msg_control) > + char __user *ptr = (char __user *)cmsg + CMSG_COMPAT_ALIGN(cmsg_len); + if ((unsigned long)(ptr + 1 - (char __user *)msg->msg_control) > msg->msg_controllen) return NULL; - return ptr; + return (struct compat_cmsghdr __user *)ptr; } /* There is a lot of hair here because the alignment rules (and @@ -143,7 +140,7 @@ int cmsghdr_from_user_compat_to_kern(struct msghdr *kmsg, unsigned char *stackbuf, int stackbuf_size) { - struct compat_cmsghdr *ucmsg; + struct compat_cmsghdr __user *ucmsg; struct cmsghdr *kcmsg, *kcmsg_base; compat_size_t ucmlen; __kernel_size_t kcmlen, tmp; @@ -159,7 +156,7 @@ if(CMSG_COMPAT_ALIGN(ucmlen) < CMSG_COMPAT_ALIGN(sizeof(struct compat_cmsghdr))) return -EINVAL; - if((unsigned long)(((char *)ucmsg - (char *)kmsg->msg_control) + if((unsigned long)(((char __user *)ucmsg - (char __user *)kmsg->msg_control) + ucmlen) > kmsg->msg_controllen) return -EINVAL; @@ -217,7 +214,7 @@ int put_cmsg_compat(struct msghdr *kmsg, int level, int type, int len, void *data) { struct compat_timeval ctv; - struct compat_cmsghdr *cm = (struct compat_cmsghdr *) kmsg->msg_control; + struct compat_cmsghdr __user *cm = (struct compat_cmsghdr __user *) kmsg->msg_control; struct compat_cmsghdr cmhdr; int cmlen; @@ -255,17 +252,17 @@ void scm_detach_fds_compat(struct msghdr *kmsg, struct scm_cookie *scm) { - struct compat_cmsghdr *cm = (struct compat_cmsghdr *) kmsg->msg_control; + struct compat_cmsghdr __user *cm = (struct compat_cmsghdr __user *) kmsg->msg_control; int fdmax = (kmsg->msg_controllen - sizeof(struct compat_cmsghdr)) / sizeof(int); int fdnum = scm->fp->count; struct file **fp = scm->fp->fp; - int *cmfptr; + int __user *cmfptr; int err = 0, i; if (fdnum < fdmax) fdmax = fdnum; - for (i = 0, cmfptr = (int *) CMSG_COMPAT_DATA(cm); i < fdmax; i++, cmfptr++) { + for (i = 0, cmfptr = (int __user *) CMSG_COMPAT_DATA(cm); i < fdmax; i++, cmfptr++) { int new_fd; err = get_unused_fd(); if (err < 0) @@ -322,10 +319,10 @@ }; static int do_netfilter_replace(int fd, int level, int optname, - char *optval, int optlen) + char __user *optval, int optlen) { - struct compat_ipt_replace *urepl = (struct compat_ipt_replace *)optval; - struct ipt_replace *repl_nat; + struct compat_ipt_replace __user *urepl; + struct ipt_replace __user *repl_nat; char name[IPT_TABLE_MAXNAMELEN]; u32 origsize, tmp32, num_counters; unsigned int repl_nat_size; @@ -333,6 +330,7 @@ int i; compat_uptr_t ucntrs; + urepl = (struct compat_ipt_replace __user *)optval; if (get_user(origsize, &urepl->size)) return -EFAULT; @@ -399,7 +397,7 @@ ret = sys_setsockopt(fd, level, optname, - (char *)repl_nat, repl_nat_size); + (char __user *)repl_nat, repl_nat_size); out: return ret; @@ -414,10 +412,10 @@ }; static int do_set_attach_filter(int fd, int level, int optname, - char *optval, int optlen) + char __user *optval, int optlen) { - struct compat_sock_fprog *fprog32 = (struct compat_sock_fprog *)optval; - struct sock_fprog *kfprog = compat_alloc_user_space(sizeof(struct sock_fprog)); + struct compat_sock_fprog __user *fprog32 = (struct compat_sock_fprog __user *)optval; + struct sock_fprog __user *kfprog = compat_alloc_user_space(sizeof(struct sock_fprog)); compat_uptr_t ptr; u16 len; @@ -429,13 +427,13 @@ __put_user(compat_ptr(ptr), &kfprog->filter)) return -EFAULT; - return sys_setsockopt(fd, level, optname, (char *)kfprog, + return sys_setsockopt(fd, level, optname, (char __user *)kfprog, sizeof(struct sock_fprog)); } -static int do_set_sock_timeout(int fd, int level, int optname, char *optval, int optlen) +static int do_set_sock_timeout(int fd, int level, int optname, char __user *optval, int optlen) { - struct compat_timeval *up = (struct compat_timeval *) optval; + struct compat_timeval __user *up = (struct compat_timeval __user *) optval; struct timeval ktime; mm_segment_t old_fs; int err; @@ -455,7 +453,7 @@ } asmlinkage long compat_sys_setsockopt(int fd, int level, int optname, - char *optval, int optlen) + char __user *optval, int optlen) { if (optname == IPT_SO_SET_REPLACE) return do_netfilter_replace(fd, level, optname, @@ -469,14 +467,15 @@ return sys_setsockopt(fd, level, optname, optval, optlen); } -static int do_get_sock_timeout(int fd, int level, int optname, char *optval, - int *optlen) +static int do_get_sock_timeout(int fd, int level, int optname, + char __user *optval, int __user *optlen) { - struct compat_timeval *up = (struct compat_timeval *) optval; + struct compat_timeval __user *up; struct timeval ktime; mm_segment_t old_fs; int len, err; + up = (struct compat_timeval __user *) optval; if (get_user(len, optlen)) return -EFAULT; if (len < sizeof(*up)) @@ -498,7 +497,7 @@ } asmlinkage long compat_sys_getsockopt(int fd, int level, int optname, - char *optval, int *optlen) + char __user *optval, int __user *optlen) { if (optname == SO_RCVTIMEO || optname == SO_SNDTIMEO) return do_get_sock_timeout(fd, level, optname, optval, optlen); @@ -512,17 +511,17 @@ AL(6),AL(2),AL(5),AL(5),AL(3),AL(3)}; #undef AL -asmlinkage long compat_sys_sendmsg(int fd, struct compat_msghdr *msg, unsigned flags) +asmlinkage long compat_sys_sendmsg(int fd, struct compat_msghdr __user *msg, unsigned flags) { - return sys_sendmsg(fd, (struct msghdr *)msg, flags | MSG_CMSG_COMPAT); + return sys_sendmsg(fd, (struct msghdr __user *)msg, flags | MSG_CMSG_COMPAT); } -asmlinkage long compat_sys_recvmsg(int fd, struct compat_msghdr *msg, unsigned int flags) +asmlinkage long compat_sys_recvmsg(int fd, struct compat_msghdr __user *msg, unsigned int flags) { - return sys_recvmsg(fd, (struct msghdr *)msg, flags | MSG_CMSG_COMPAT); + return sys_recvmsg(fd, (struct msghdr __user *)msg, flags | MSG_CMSG_COMPAT); } -asmlinkage long compat_sys_socketcall(int call, u32 *args) +asmlinkage long compat_sys_socketcall(int call, u32 __user *args) { int ret; u32 a[6]; diff -urN linux-2.6.7-rc2/net/core/datagram.c linux-2.6.7-rc3/net/core/datagram.c --- linux-2.6.7-rc2/net/core/datagram.c 2004-05-09 19:32:51.000000000 -0700 +++ linux-2.6.7-rc3/net/core/datagram.c 2004-06-07 12:55:26.847609865 -0700 @@ -202,7 +202,7 @@ /* * Copy a datagram to a linear buffer. */ -int skb_copy_datagram(const struct sk_buff *skb, int offset, char *to, int size) +int skb_copy_datagram(const struct sk_buff *skb, int offset, char __user *to, int size) { struct iovec iov = { .iov_base = to, @@ -297,7 +297,7 @@ } int skb_copy_and_csum_datagram(const struct sk_buff *skb, int offset, - u8 *to, int len, unsigned int *csump) + u8 __user *to, int len, unsigned int *csump) { int start = skb_headlen(skb); int pos = 0; diff -urN linux-2.6.7-rc2/net/core/dev.c linux-2.6.7-rc3/net/core/dev.c --- linux-2.6.7-rc2/net/core/dev.c 2004-06-07 12:54:53.344222199 -0700 +++ linux-2.6.7-rc3/net/core/dev.c 2004-06-07 12:55:26.885611439 -0700 @@ -1180,28 +1180,46 @@ rcu_read_unlock(); } -/* Calculate csum in the case, when packet is misrouted. - * If it failed by some reason, ignore and send skb with wrong - * checksum. +/* + * Invalidate hardware checksum when packet is to be mangled, and + * complete checksum manually on outgoing path. */ -struct sk_buff *skb_checksum_help(struct sk_buff *skb) +int skb_checksum_help(struct sk_buff **pskb, int inward) { unsigned int csum; - int offset = skb->h.raw - skb->data; + int ret = 0, offset = (*pskb)->h.raw - (*pskb)->data; + + if (inward) { + (*pskb)->ip_summed = CHECKSUM_NONE; + goto out; + } - if (offset > (int)skb->len) + if (skb_shared(*pskb) || skb_cloned(*pskb)) { + struct sk_buff *newskb = skb_copy(*pskb, GFP_ATOMIC); + if (!newskb) { + ret = -ENOMEM; + goto out; + } + if ((*pskb)->sk) + skb_set_owner_w(newskb, (*pskb)->sk); + kfree_skb(*pskb); + *pskb = newskb; + } + + if (offset > (int)(*pskb)->len) BUG(); - csum = skb_checksum(skb, offset, skb->len-offset, 0); + csum = skb_checksum(*pskb, offset, (*pskb)->len-offset, 0); - offset = skb->tail - skb->h.raw; + offset = (*pskb)->tail - (*pskb)->h.raw; if (offset <= 0) BUG(); - if (skb->csum + 2 > offset) + if ((*pskb)->csum + 2 > offset) BUG(); - *(u16*)(skb->h.raw + skb->csum) = csum_fold(csum); - skb->ip_summed = CHECKSUM_NONE; - return skb; + *(u16*)((*pskb)->h.raw + (*pskb)->csum) = csum_fold(csum); + (*pskb)->ip_summed = CHECKSUM_NONE; +out: + return ret; } #ifdef CONFIG_HIGHMEM @@ -1326,10 +1344,9 @@ if (skb->ip_summed == CHECKSUM_HW && (!(dev->features & (NETIF_F_HW_CSUM | NETIF_F_NO_CSUM)) && (!(dev->features & NETIF_F_IP_CSUM) || - skb->protocol != htons(ETH_P_IP)))) { - if ((skb = skb_checksum_help(skb)) == NULL) - goto out; - } + skb->protocol != htons(ETH_P_IP)))) + if (skb_checksum_help(&skb, 0)) + goto out_kfree_skb; /* Grab device queue */ spin_lock_bh(&dev->queue_lock); @@ -1958,7 +1975,7 @@ { struct ifconf ifc; struct net_device *dev; - char *pos; + char __user *pos; int len; int total; int i; diff -urN linux-2.6.7-rc2/net/core/dst.c linux-2.6.7-rc3/net/core/dst.c --- linux-2.6.7-rc2/net/core/dst.c 2004-05-09 19:32:39.000000000 -0700 +++ linux-2.6.7-rc3/net/core/dst.c 2004-06-07 12:55:26.886611481 -0700 @@ -100,15 +100,15 @@ spin_unlock(&dst_lock); } -static int dst_discard(struct sk_buff *skb) +static int dst_discard_in(struct sk_buff *skb) { kfree_skb(skb); return 0; } -static int dst_blackhole(struct sk_buff *skb) +static int dst_discard_out(struct sk_buff **pskb) { - kfree_skb(skb); + kfree_skb(*pskb); return 0; } @@ -128,8 +128,8 @@ dst->ops = ops; dst->lastuse = jiffies; dst->path = dst; - dst->input = dst_discard; - dst->output = dst_blackhole; + dst->input = dst_discard_in; + dst->output = dst_discard_out; #if RT_CACHE_DEBUG >= 2 atomic_inc(&dst_total); #endif @@ -143,8 +143,8 @@ protocol module is unloaded. */ if (dst->dev == NULL || !(dst->dev->flags&IFF_UP)) { - dst->input = dst_discard; - dst->output = dst_blackhole; + dst->input = dst_discard_in; + dst->output = dst_discard_out; } dst->obsolete = 2; } @@ -228,19 +228,19 @@ _race_ _condition_. */ if (event!=NETDEV_DOWN && - dst->output == dst_blackhole) { + dst->output == dst_discard_out) { dst->dev = &loopback_dev; dev_put(dev); dev_hold(&loopback_dev); - dst->output = dst_discard; + dst->output = dst_discard_out; if (dst->neighbour && dst->neighbour->dev == dev) { dst->neighbour->dev = &loopback_dev; dev_put(dev); dev_hold(&loopback_dev); } } else { - dst->input = dst_discard; - dst->output = dst_blackhole; + dst->input = dst_discard_in; + dst->output = dst_discard_out; } } } diff -urN linux-2.6.7-rc2/net/core/ethtool.c linux-2.6.7-rc3/net/core/ethtool.c --- linux-2.6.7-rc2/net/core/ethtool.c 2004-05-09 19:32:26.000000000 -0700 +++ linux-2.6.7-rc3/net/core/ethtool.c 2004-06-07 12:55:26.922612972 -0700 @@ -650,7 +650,7 @@ int dev_ethtool(struct ifreq *ifr) { struct net_device *dev = __dev_get_by_name(ifr->ifr_name); - void __user *useraddr = (void __user *) ifr->ifr_data; + void __user *useraddr = ifr->ifr_data; u32 ethcmd; /* diff -urN linux-2.6.7-rc2/net/core/iovec.c linux-2.6.7-rc3/net/core/iovec.c --- linux-2.6.7-rc2/net/core/iovec.c 2004-05-09 19:33:21.000000000 -0700 +++ linux-2.6.7-rc3/net/core/iovec.c 2004-06-07 12:55:26.926613138 -0700 @@ -157,7 +157,7 @@ } while (len > 0) { - u8 *base = iov->iov_base + offset; + u8 __user *base = iov->iov_base + offset; int copy = min_t(unsigned int, len, iov->iov_len - offset); offset = 0; @@ -192,7 +192,7 @@ } while (len > 0) { - u8 *base = iov->iov_base + offset; + u8 __user *base = iov->iov_base + offset; int copy = min_t(unsigned int, len, iov->iov_len - offset); offset = 0; diff -urN linux-2.6.7-rc2/net/core/netfilter.c linux-2.6.7-rc3/net/core/netfilter.c --- linux-2.6.7-rc2/net/core/netfilter.c 2004-06-07 12:54:53.346222282 -0700 +++ linux-2.6.7-rc3/net/core/netfilter.c 2004-06-07 12:55:27.002616286 -0700 @@ -504,14 +504,6 @@ unsigned int verdict; int ret = 0; - if (skb->ip_summed == CHECKSUM_HW) { - if (outdev == NULL) { - skb->ip_summed = CHECKSUM_NONE; - } else { - skb_checksum_help(skb); - } - } - /* We may already have this, but read-locks nest anyway */ rcu_read_lock(); diff -urN linux-2.6.7-rc2/net/core/netpoll.c linux-2.6.7-rc3/net/core/netpoll.c --- linux-2.6.7-rc2/net/core/netpoll.c 2004-05-09 19:33:20.000000000 -0700 +++ linux-2.6.7-rc3/net/core/netpoll.c 2004-06-07 12:55:27.002616286 -0700 @@ -623,7 +623,7 @@ np->dev = 0; } -int netpoll_trap() +int netpoll_trap(void) { return trapped; } diff -urN linux-2.6.7-rc2/net/core/pktgen.c linux-2.6.7-rc3/net/core/pktgen.c --- linux-2.6.7-rc2/net/core/pktgen.c 2004-05-09 19:32:53.000000000 -0700 +++ linux-2.6.7-rc3/net/core/pktgen.c 2004-06-07 12:55:27.087619807 -0700 @@ -870,7 +870,7 @@ return p - buf; } -static int count_trail_chars(const char *user_buffer, unsigned int maxlen) +static int count_trail_chars(const char __user *user_buffer, unsigned int maxlen) { int i; @@ -895,7 +895,7 @@ return i; } -static unsigned long num_arg(const char *user_buffer, unsigned long maxlen, +static unsigned long num_arg(const char __user *user_buffer, unsigned long maxlen, unsigned long *num) { int i = 0; @@ -916,7 +916,7 @@ return i; } -static int strn_len(const char *user_buffer, unsigned int maxlen) +static int strn_len(const char __user *user_buffer, unsigned int maxlen) { int i = 0; @@ -940,7 +940,7 @@ return i; } -static int proc_write(struct file *file, const char *user_buffer, +static int proc_write(struct file *file, const char __user *user_buffer, unsigned long count, void *data) { int i = 0, max, len; diff -urN linux-2.6.7-rc2/net/core/scm.c linux-2.6.7-rc3/net/core/scm.c --- linux-2.6.7-rc2/net/core/scm.c 2004-05-09 19:32:28.000000000 -0700 +++ linux-2.6.7-rc3/net/core/scm.c 2004-06-07 12:55:27.087619807 -0700 @@ -169,7 +169,7 @@ int put_cmsg(struct msghdr * msg, int level, int type, int len, void *data) { - struct cmsghdr *cm = (struct cmsghdr*)msg->msg_control; + struct cmsghdr __user *cm = (struct cmsghdr __user *)msg->msg_control; struct cmsghdr cmhdr; int cmlen = CMSG_LEN(len); int err; @@ -204,16 +204,18 @@ void scm_detach_fds(struct msghdr *msg, struct scm_cookie *scm) { - struct cmsghdr *cm = (struct cmsghdr*)msg->msg_control; + struct cmsghdr __user *cm = (struct cmsghdr __user*)msg->msg_control; int fdmax = 0; int fdnum = scm->fp->count; struct file **fp = scm->fp->fp; - int *cmfptr; + int __user *cmfptr; int err = 0, i; - if (MSG_CMSG_COMPAT & msg->msg_flags) - return scm_detach_fds_compat(msg, scm); + if (MSG_CMSG_COMPAT & msg->msg_flags) { + scm_detach_fds_compat(msg, scm); + return; + } if (msg->msg_controllen > sizeof(struct cmsghdr)) fdmax = ((msg->msg_controllen - sizeof(struct cmsghdr)) @@ -222,7 +224,7 @@ if (fdnum < fdmax) fdmax = fdnum; - for (i=0, cmfptr=(int*)CMSG_DATA(cm); i 0 there are consumers of rx skb time stamps */ atomic_t netstamp_needed = ATOMIC_INIT(0); -int sock_get_timestamp(struct sock *sk, struct timeval *userstamp) +int sock_get_timestamp(struct sock *sk, struct timeval __user *userstamp) { if (!sock_flag(sk, SOCK_TIMESTAMP)) sock_enable_timestamp(sk); diff -urN linux-2.6.7-rc2/net/decnet/af_decnet.c linux-2.6.7-rc3/net/decnet/af_decnet.c --- linux-2.6.7-rc2/net/decnet/af_decnet.c 2004-06-07 12:54:53.356222696 -0700 +++ linux-2.6.7-rc3/net/decnet/af_decnet.c 2004-06-07 12:55:27.146622251 -0700 @@ -1212,7 +1212,7 @@ { case SIOCGIFADDR: case SIOCSIFADDR: - return dn_dev_ioctl(cmd, (void *)arg); + return dn_dev_ioctl(cmd, (void __user *)arg); case SIOCATMARK: lock_sock(sk); @@ -1226,7 +1226,7 @@ amount = sk->sk_sndbuf - atomic_read(&sk->sk_wmem_alloc); if (amount < 0) amount = 0; - err = put_user(amount, (int *)arg); + err = put_user(amount, (int __user *)arg); break; case TIOCINQ: @@ -1244,11 +1244,11 @@ } } release_sock(sk); - err = put_user(amount, (int *)arg); + err = put_user(amount, (int __user *)arg); break; default: - err = dev_ioctl(cmd, (void *)arg); + err = dev_ioctl(cmd, (void __user *)arg); break; } @@ -1325,7 +1325,7 @@ return err; } -static int __dn_setsockopt(struct socket *sock, int level,int optname, char __user __user *optval, int optlen, int flags) +static int __dn_setsockopt(struct socket *sock, int level,int optname, char __user *optval, int optlen, int flags) { struct sock *sk = sock->sk; struct dn_scp *scp = DN_SK(sk); @@ -1905,7 +1905,7 @@ unsigned char fctype; long timeo = sock_sndtimeo(sk, flags & MSG_DONTWAIT); - if (flags & ~(MSG_TRYHARD|MSG_OOB|MSG_DONTWAIT|MSG_EOR|MSG_NOSIGNAL|MSG_MORE)) + if (flags & ~(MSG_TRYHARD|MSG_OOB|MSG_DONTWAIT|MSG_EOR|MSG_NOSIGNAL|MSG_MORE|MSG_CMSG_COMPAT)) return -EOPNOTSUPP; if (addr_len && (addr_len != sizeof(struct sockaddr_dn))) diff -urN linux-2.6.7-rc2/net/decnet/dn_dev.c linux-2.6.7-rc3/net/decnet/dn_dev.c --- linux-2.6.7-rc2/net/decnet/dn_dev.c 2004-05-09 19:32:27.000000000 -0700 +++ linux-2.6.7-rc3/net/decnet/dn_dev.c 2004-06-07 12:55:27.199624446 -0700 @@ -161,10 +161,10 @@ static int max_priority[] = { 127 }; /* From DECnet spec */ static int dn_forwarding_proc(ctl_table *, int, struct file *, - void *, size_t *); -static int dn_forwarding_sysctl(ctl_table *table, int *name, int nlen, - void *oldval, size_t *oldlenp, - void *newval, size_t newlen, + void __user *, size_t *); +static int dn_forwarding_sysctl(ctl_table *table, int __user *name, int nlen, + void __user *oldval, size_t __user *oldlenp, + void __user *newval, size_t newlen, void **context); static struct dn_dev_sysctl_table { @@ -362,7 +362,7 @@ static int dn_forwarding_proc(ctl_table *table, int write, struct file *filep, - void *buffer, size_t *lenp) + void __user *buffer, size_t *lenp) { #ifdef CONFIG_DECNET_ROUTER struct net_device *dev = table->extra1; @@ -404,9 +404,9 @@ #endif } -static int dn_forwarding_sysctl(ctl_table *table, int *name, int nlen, - void *oldval, size_t *oldlenp, - void *newval, size_t newlen, +static int dn_forwarding_sysctl(ctl_table *table, int __user *name, int nlen, + void __user *oldval, size_t __user *oldlenp, + void __user *newval, size_t newlen, void **context) { #ifdef CONFIG_DECNET_ROUTER @@ -423,7 +423,7 @@ if (newlen != sizeof(int)) return -EINVAL; - if (get_user(value, (int *)newval)) + if (get_user(value, (int __user *)newval)) return -EFAULT; if (value < 0) return -EINVAL; @@ -553,7 +553,7 @@ } -int dn_dev_ioctl(unsigned int cmd, void *arg) +int dn_dev_ioctl(unsigned int cmd, void __user *arg) { char buffer[DN_IFREQ_SIZE]; struct ifreq *ifr = (struct ifreq *)buffer; @@ -1294,35 +1294,43 @@ * it as a compile time option. Probably you should use the * rtnetlink interface instead. */ -int dnet_gifconf(struct net_device *dev, char *buf, int len) +int dnet_gifconf(struct net_device *dev, char __user *buf, int len) { struct dn_dev *dn_db = (struct dn_dev *)dev->dn_ptr; struct dn_ifaddr *ifa; - struct ifreq *ifr = (struct ifreq *)buf; + char buffer[DN_IFREQ_SIZE]; + struct ifreq *ifr = (struct ifreq *)buffer; + struct sockaddr_dn *addr = (struct sockaddr_dn *)&ifr->ifr_addr; int done = 0; if ((dn_db == NULL) || ((ifa = dn_db->ifa_list) == NULL)) return 0; for(; ifa; ifa = ifa->ifa_next) { - if (!ifr) { + if (!buf) { done += sizeof(DN_IFREQ_SIZE); continue; } if (len < DN_IFREQ_SIZE) return done; - memset(ifr, 0, DN_IFREQ_SIZE); + memset(buffer, 0, DN_IFREQ_SIZE); if (ifa->ifa_label) strcpy(ifr->ifr_name, ifa->ifa_label); else strcpy(ifr->ifr_name, dev->name); - (*(struct sockaddr_dn *) &ifr->ifr_addr).sdn_family = AF_DECnet; - (*(struct sockaddr_dn *) &ifr->ifr_addr).sdn_add.a_len = 2; - (*(dn_address *)(*(struct sockaddr_dn *) &ifr->ifr_addr).sdn_add.a_addr) = ifa->ifa_local; + addr->sdn_family = AF_DECnet; + addr->sdn_add.a_len = 2; + memcpy(addr->sdn_add.a_addr, &ifa->ifa_local, + sizeof(dn_address)); + + if (copy_to_user(buf, buffer, DN_IFREQ_SIZE)) { + done = -EFAULT; + break; + } - ifr = (struct ifreq *)((char *)ifr + DN_IFREQ_SIZE); + buf += DN_IFREQ_SIZE; len -= DN_IFREQ_SIZE; done += DN_IFREQ_SIZE; } diff -urN linux-2.6.7-rc2/net/decnet/dn_route.c linux-2.6.7-rc3/net/decnet/dn_route.c --- linux-2.6.7-rc2/net/decnet/dn_route.c 2004-05-09 19:33:20.000000000 -0700 +++ linux-2.6.7-rc3/net/decnet/dn_route.c 2004-06-07 12:55:27.278627719 -0700 @@ -684,8 +684,9 @@ return NET_RX_DROP; } -static int dn_output(struct sk_buff *skb) +static int dn_output(struct sk_buff **pskb) { + struct sk_buff *skb = *pskb; struct dst_entry *dst = skb->dst; struct dn_route *rt = (struct dn_route *)dst; struct net_device *dev = dst->dev; @@ -796,6 +797,11 @@ return NET_RX_BAD; } +static int dn_rt_bug_out(struct sk_buff **pskb) +{ + return dn_rt_bug(*pskb); +} + static int dn_rt_set_next_hop(struct dn_route *rt, struct dn_fib_res *res) { struct dn_fib_info *fi = res->fi; @@ -1387,7 +1393,7 @@ rt->u.dst.neighbour = neigh; rt->u.dst.dev = out_dev; rt->u.dst.lastuse = jiffies; - rt->u.dst.output = dn_rt_bug; + rt->u.dst.output = dn_rt_bug_out; switch(res.type) { case RTN_UNICAST: rt->u.dst.input = dn_forward; diff -urN linux-2.6.7-rc2/net/decnet/sysctl_net_decnet.c linux-2.6.7-rc3/net/decnet/sysctl_net_decnet.c --- linux-2.6.7-rc2/net/decnet/sysctl_net_decnet.c 2004-05-09 19:32:26.000000000 -0700 +++ linux-2.6.7-rc3/net/decnet/sysctl_net_decnet.c 2004-06-07 12:55:27.279627760 -0700 @@ -127,9 +127,9 @@ } -static int dn_node_address_strategy(ctl_table *table, int *name, int nlen, - void *oldval, size_t *oldlenp, - void *newval, size_t newlen, +static int dn_node_address_strategy(ctl_table *table, int __user *name, int nlen, + void __user *oldval, size_t __user *oldlenp, + void __user *newval, size_t newlen, void **context) { size_t len; @@ -141,14 +141,14 @@ if (len) { if (len != sizeof(unsigned short)) return -EINVAL; - if (put_user(decnet_address, (unsigned short *)oldval)) + if (put_user(decnet_address, (unsigned short __user *)oldval)) return -EFAULT; } } if (newval && newlen) { if (newlen != sizeof(unsigned short)) return -EINVAL; - if (get_user(addr, (unsigned short *)newval)) + if (get_user(addr, (unsigned short __user *)newval)) return -EFAULT; dn_dev_devices_off(); @@ -162,7 +162,7 @@ static int dn_node_address_handler(ctl_table *table, int write, struct file *filp, - void *buffer, size_t *lenp) + void __user *buffer, size_t *lenp) { char addr[DN_ASCBUF_LEN]; size_t len; @@ -212,9 +212,9 @@ } -static int dn_def_dev_strategy(ctl_table *table, int *name, int nlen, - void *oldval, size_t *oldlenp, - void *newval, size_t newlen, +static int dn_def_dev_strategy(ctl_table *table, int __user *name, int nlen, + void __user *oldval, size_t __user *oldlenp, + void __user *newval, size_t newlen, void **context) { size_t len; @@ -273,7 +273,7 @@ static int dn_def_dev_handler(ctl_table *table, int write, struct file * filp, - void *buffer, size_t *lenp) + void __user *buffer, size_t *lenp) { size_t len; struct net_device *dev; diff -urN linux-2.6.7-rc2/net/econet/af_econet.c linux-2.6.7-rc3/net/econet/af_econet.c --- linux-2.6.7-rc2/net/econet/af_econet.c 2004-05-09 19:32:37.000000000 -0700 +++ linux-2.6.7-rc3/net/econet/af_econet.c 2004-06-07 12:55:27.294628382 -0700 @@ -274,8 +274,8 @@ * Check the flags. */ - if (msg->msg_flags&~MSG_DONTWAIT) - return(-EINVAL); + if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_CMSG_COMPAT)) + return -EINVAL; /* * Get and verify the address. @@ -418,10 +418,18 @@ /* tack our header on the front of the iovec */ size = sizeof(struct aunhdr); + /* + * XXX: that is b0rken. We can't mix userland and kernel pointers + * in iovec, since on a lot of platforms copy_from_user() will + * *not* work with the kernel and userland ones at the same time, + * regardless of what we do with set_fs(). And we are talking about + * econet-over-ethernet here, so "it's only ARM anyway" doesn't + * apply. Any suggestions on fixing that code? -- AV + */ iov[0].iov_base = (void *)&ah; iov[0].iov_len = size; for (i = 0; i < msg->msg_iovlen; i++) { - void *base = msg->msg_iov[i].iov_base; + void __user *base = msg->msg_iov[i].iov_base; size_t len = msg->msg_iov[i].iov_len; /* Check it now since we switch to KERNEL_DS later. */ if ((err = verify_area(VERIFY_READ, base, len)) < 0) @@ -589,7 +597,7 @@ * Handle Econet specific ioctls */ -static int ec_dev_ioctl(struct socket *sock, unsigned int cmd, void *arg) +static int ec_dev_ioctl(struct socket *sock, unsigned int cmd, void __user *arg) { struct ifreq ifr; struct ec_device *edev; @@ -662,18 +670,19 @@ static int econet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) { struct sock *sk = sock->sk; + void __user *argp = (void __user *)arg; switch(cmd) { case SIOCGSTAMP: - return sock_get_timestamp(sk,(struct timeval *)arg); + return sock_get_timestamp(sk, argp); case SIOCSIFADDR: case SIOCGIFADDR: - return ec_dev_ioctl(sock, cmd, (void *)arg); + return ec_dev_ioctl(sock, cmd, argp); break; default: - return dev_ioctl(cmd,(void *) arg); + return dev_ioctl(cmd, argp); } /*NOTREACHED*/ return 0; diff -urN linux-2.6.7-rc2/net/ipv4/af_inet.c linux-2.6.7-rc3/net/ipv4/af_inet.c --- linux-2.6.7-rc2/net/ipv4/af_inet.c 2004-06-07 12:54:53.370223276 -0700 +++ linux-2.6.7-rc3/net/ipv4/af_inet.c 2004-06-07 12:55:27.352630784 -0700 @@ -843,7 +843,7 @@ switch (cmd) { case SIOCGSTAMP: - err = sock_get_timestamp(sk, (struct timeval *)arg); + err = sock_get_timestamp(sk, (struct timeval __user *)arg); break; case SIOCADDRT: case SIOCDELRT: @@ -853,7 +853,7 @@ case SIOCDARP: case SIOCGARP: case SIOCSARP: - err = arp_ioctl(cmd, (void *)arg); + err = arp_ioctl(cmd, (void __user *)arg); break; case SIOCGIFADDR: case SIOCSIFADDR: @@ -866,13 +866,13 @@ case SIOCSIFPFLAGS: case SIOCGIFPFLAGS: case SIOCSIFFLAGS: - err = devinet_ioctl(cmd, (void *)arg); + err = devinet_ioctl(cmd, (void __user *)arg); break; default: if (!sk->sk_prot->ioctl || (err = sk->sk_prot->ioctl(sk, cmd, arg)) == -ENOIOCTLCMD) - err = dev_ioctl(cmd, (void *)arg); + err = dev_ioctl(cmd, (void __user *)arg); break; } return err; @@ -1066,8 +1066,8 @@ { net_statistics[0] = alloc_percpu(struct linux_mib); net_statistics[1] = alloc_percpu(struct linux_mib); - ip_statistics[0] = alloc_percpu(struct ip_mib); - ip_statistics[1] = alloc_percpu(struct ip_mib); + ip_statistics[0] = alloc_percpu(struct ipstats_mib); + ip_statistics[1] = alloc_percpu(struct ipstats_mib); icmp_statistics[0] = alloc_percpu(struct icmp_mib); icmp_statistics[1] = alloc_percpu(struct icmp_mib); tcp_statistics[0] = alloc_percpu(struct tcp_mib); diff -urN linux-2.6.7-rc2/net/ipv4/ah4.c linux-2.6.7-rc3/net/ipv4/ah4.c --- linux-2.6.7-rc2/net/ipv4/ah4.c 2004-05-09 19:33:19.000000000 -0700 +++ linux-2.6.7-rc3/net/ipv4/ah4.c 2004-06-07 12:55:27.367631405 -0700 @@ -54,10 +54,10 @@ return 0; } -static int ah_output(struct sk_buff *skb) +static int ah_output(struct sk_buff **pskb) { int err; - struct dst_entry *dst = skb->dst; + struct dst_entry *dst = (*pskb)->dst; struct xfrm_state *x = dst->xfrm; struct iphdr *iph, *top_iph; struct ip_auth_hdr *ah; @@ -67,23 +67,24 @@ char buf[60]; } tmp_iph; - if (skb->ip_summed == CHECKSUM_HW && skb_checksum_help(skb) == NULL) { - err = -EINVAL; - goto error_nolock; + if ((*pskb)->ip_summed == CHECKSUM_HW) { + err = skb_checksum_help(pskb, 0); + if (err) + goto error_nolock; } spin_lock_bh(&x->lock); - err = xfrm_check_output(x, skb, AF_INET); + err = xfrm_check_output(x, *pskb, AF_INET); if (err) goto error; - iph = skb->nh.iph; + iph = (*pskb)->nh.iph; if (x->props.mode) { - top_iph = (struct iphdr*)skb_push(skb, x->props.header_len); + top_iph = (struct iphdr*)skb_push(*pskb, x->props.header_len); top_iph->ihl = 5; top_iph->version = 4; top_iph->tos = 0; - top_iph->tot_len = htons(skb->len); + top_iph->tot_len = htons((*pskb)->len); top_iph->frag_off = 0; if (!(iph->frag_off&htons(IP_DF))) __ip_select_ident(top_iph, dst, 0); @@ -95,12 +96,12 @@ ah = (struct ip_auth_hdr*)(top_iph+1); ah->nexthdr = IPPROTO_IPIP; } else { - memcpy(&tmp_iph, skb->data, iph->ihl*4); - top_iph = (struct iphdr*)skb_push(skb, x->props.header_len); + memcpy(&tmp_iph, (*pskb)->data, iph->ihl*4); + top_iph = (struct iphdr*)skb_push(*pskb, x->props.header_len); memcpy(top_iph, &tmp_iph, iph->ihl*4); iph = &tmp_iph.iph; top_iph->tos = 0; - top_iph->tot_len = htons(skb->len); + top_iph->tot_len = htons((*pskb)->len); top_iph->frag_off = 0; top_iph->ttl = 0; top_iph->protocol = IPPROTO_AH; @@ -120,14 +121,14 @@ ah->reserved = 0; ah->spi = x->id.spi; ah->seq_no = htonl(++x->replay.oseq); - ahp->icv(ahp, skb, ah->auth_data); + ahp->icv(ahp, *pskb, ah->auth_data); top_iph->tos = iph->tos; top_iph->ttl = iph->ttl; if (x->props.mode) { if (x->props.flags & XFRM_STATE_NOECN) IP_ECN_clear(top_iph); top_iph->frag_off = iph->frag_off&~htons(IP_MF|IP_OFFSET); - memset(&(IPCB(skb)->opt), 0, sizeof(struct ip_options)); + memset(&(IPCB(*pskb)->opt), 0, sizeof(struct ip_options)); } else { top_iph->frag_off = iph->frag_off; top_iph->daddr = iph->daddr; @@ -136,12 +137,12 @@ } ip_send_check(top_iph); - skb->nh.raw = skb->data; + (*pskb)->nh.raw = (*pskb)->data; - x->curlft.bytes += skb->len; + x->curlft.bytes += (*pskb)->len; x->curlft.packets++; spin_unlock_bh(&x->lock); - if ((skb->dst = dst_pop(dst)) == NULL) { + if (((*pskb)->dst = dst_pop(dst)) == NULL) { err = -EHOSTUNREACH; goto error_nolock; } @@ -150,7 +151,7 @@ error: spin_unlock_bh(&x->lock); error_nolock: - kfree_skb(skb); + kfree_skb(*pskb); return err; } diff -urN linux-2.6.7-rc2/net/ipv4/arp.c linux-2.6.7-rc3/net/ipv4/arp.c --- linux-2.6.7-rc2/net/ipv4/arp.c 2004-05-09 19:33:13.000000000 -0700 +++ linux-2.6.7-rc3/net/ipv4/arp.c 2004-06-07 12:55:27.370631530 -0700 @@ -1103,7 +1103,7 @@ * Handle an ARP layer I/O control request. */ -int arp_ioctl(unsigned int cmd, void *arg) +int arp_ioctl(unsigned int cmd, void __user *arg) { int err; struct arpreq r; diff -urN linux-2.6.7-rc2/net/ipv4/devinet.c linux-2.6.7-rc3/net/ipv4/devinet.c --- linux-2.6.7-rc2/net/ipv4/devinet.c 2004-05-09 19:32:26.000000000 -0700 +++ linux-2.6.7-rc3/net/ipv4/devinet.c 2004-06-07 12:55:27.460635258 -0700 @@ -489,7 +489,7 @@ } -int devinet_ioctl(unsigned int cmd, void *arg) +int devinet_ioctl(unsigned int cmd, void __user *arg) { struct ifreq ifr; struct sockaddr_in sin_orig; @@ -713,7 +713,7 @@ goto out; } -static int inet_gifconf(struct net_device *dev, char *buf, int len) +static int inet_gifconf(struct net_device *dev, char __user *buf, int len) { struct in_device *in_dev = __in_dev_get(dev); struct in_ifaddr *ifa; @@ -1136,7 +1136,7 @@ } static int devinet_sysctl_forward(ctl_table *ctl, int write, - struct file* filp, void *buffer, + struct file* filp, void __user *buffer, size_t *lenp) { int *valp = ctl->data; @@ -1154,7 +1154,7 @@ } int ipv4_doint_and_flush(ctl_table *ctl, int write, - struct file* filp, void *buffer, + struct file* filp, void __user *buffer, size_t *lenp) { int *valp = ctl->data; @@ -1167,9 +1167,9 @@ return ret; } -int ipv4_doint_and_flush_strategy(ctl_table *table, int *name, int nlen, - void *oldval, size_t *oldlenp, - void *newval, size_t newlen, +int ipv4_doint_and_flush_strategy(ctl_table *table, int __user *name, int nlen, + void __user *oldval, size_t __user *oldlenp, + void __user *newval, size_t newlen, void **context) { int *valp = table->data; @@ -1181,7 +1181,7 @@ if (newlen != sizeof(int)) return -EINVAL; - if (get_user(new, (int *)newval)) + if (get_user(new, (int __user *)newval)) return -EFAULT; if (new == *valp) diff -urN linux-2.6.7-rc2/net/ipv4/esp4.c linux-2.6.7-rc3/net/ipv4/esp4.c --- linux-2.6.7-rc2/net/ipv4/esp4.c 2004-05-09 19:32:39.000000000 -0700 +++ linux-2.6.7-rc3/net/ipv4/esp4.c 2004-06-07 12:55:27.509637287 -0700 @@ -20,10 +20,10 @@ __u8 proto; }; -int esp_output(struct sk_buff *skb) +int esp_output(struct sk_buff **pskb) { int err; - struct dst_entry *dst = skb->dst; + struct dst_entry *dst = (*pskb)->dst; struct xfrm_state *x = dst->xfrm; struct iphdr *iph, *top_iph; struct ip_esp_hdr *esph; @@ -42,28 +42,28 @@ char buf[60]; } tmp_iph; - /* First, if the skb is not checksummed, complete checksum. */ - if (skb->ip_summed == CHECKSUM_HW && skb_checksum_help(skb) == NULL) { - err = -EINVAL; - goto error_nolock; + if ((*pskb)->ip_summed == CHECKSUM_HW) { + err = skb_checksum_help(pskb, 0); + if (err) + goto error_nolock; } spin_lock_bh(&x->lock); - err = xfrm_check_output(x, skb, AF_INET); + err = xfrm_check_output(x, *pskb, AF_INET); if (err) goto error; err = -ENOMEM; /* Strip IP header in transport mode. Save it. */ if (!x->props.mode) { - iph = skb->nh.iph; + iph = (*pskb)->nh.iph; memcpy(&tmp_iph, iph, iph->ihl*4); - __skb_pull(skb, iph->ihl*4); + __skb_pull(*pskb, iph->ihl*4); } /* Now skb is pure payload to encrypt */ /* Round to block size */ - clen = skb->len; + clen = (*pskb)->len; esp = x->data; alen = esp->auth.icv_trunc_len; @@ -73,23 +73,23 @@ if (esp->conf.padlen) clen = (clen + esp->conf.padlen-1)&~(esp->conf.padlen-1); - if ((nfrags = skb_cow_data(skb, clen-skb->len+alen, &trailer)) < 0) + if ((nfrags = skb_cow_data(*pskb, clen-(*pskb)->len+alen, &trailer)) < 0) goto error; /* Fill padding... */ do { int i; - for (i=0; ilen - 2; i++) + for (i=0; ilen - 2; i++) *(u8*)(trailer->tail + i) = i+1; } while (0); - *(u8*)(trailer->tail + clen-skb->len - 2) = (clen - skb->len)-2; - pskb_put(skb, trailer, clen - skb->len); + *(u8*)(trailer->tail + clen-(*pskb)->len - 2) = (clen - (*pskb)->len)-2; + pskb_put(*pskb, trailer, clen - (*pskb)->len); encap = x->encap; - iph = skb->nh.iph; + iph = (*pskb)->nh.iph; if (x->props.mode) { - top_iph = (struct iphdr*)skb_push(skb, x->props.header_len); + top_iph = (struct iphdr*)skb_push(*pskb, x->props.header_len); esph = (struct ip_esp_hdr*)(top_iph+1); if (encap && encap->encap_type) { switch (encap->encap_type) { @@ -121,7 +121,7 @@ top_iph->tos = iph->tos; /* DS disclosed */ if (x->props.flags & XFRM_STATE_NOECN) IP_ECN_clear(top_iph); - top_iph->tot_len = htons(skb->len + alen); + top_iph->tot_len = htons((*pskb)->len + alen); top_iph->frag_off = iph->frag_off&htons(IP_DF); if (!(top_iph->frag_off)) ip_select_ident(top_iph, dst, 0); @@ -129,10 +129,10 @@ top_iph->check = 0; top_iph->saddr = x->props.saddr.a4; top_iph->daddr = x->id.daddr.a4; - memset(&(IPCB(skb)->opt), 0, sizeof(struct ip_options)); + memset(&(IPCB(*pskb)->opt), 0, sizeof(struct ip_options)); } else { - esph = (struct ip_esp_hdr*)skb_push(skb, x->props.header_len); - top_iph = (struct iphdr*)skb_push(skb, iph->ihl*4); + esph = (struct ip_esp_hdr*)skb_push(*pskb, x->props.header_len); + top_iph = (struct iphdr*)skb_push(*pskb, iph->ihl*4); memcpy(top_iph, &tmp_iph, iph->ihl*4); if (encap && encap->encap_type) { switch (encap->encap_type) { @@ -159,7 +159,7 @@ } else top_iph->protocol = IPPROTO_ESP; iph = &tmp_iph.iph; - top_iph->tot_len = htons(skb->len + alen); + top_iph->tot_len = htons((*pskb)->len + alen); top_iph->check = 0; top_iph->frag_off = iph->frag_off; *(u8*)(trailer->tail - 1) = iph->protocol; @@ -169,7 +169,7 @@ if (encap && uh) { uh->source = encap->encap_sport; uh->dest = encap->encap_dport; - uh->len = htons(skb->len + alen - sizeof(struct iphdr)); + uh->len = htons((*pskb)->len + alen - sizeof(struct iphdr)); uh->check = 0; } @@ -188,7 +188,7 @@ if (!sg) goto error; } - skb_to_sgvec(skb, sg, esph->enc_data+esp->conf.ivlen-skb->data, clen); + skb_to_sgvec(*pskb, sg, esph->enc_data+esp->conf.ivlen-(*pskb)->data, clen); crypto_cipher_encrypt(tfm, sg, sg, clen); if (unlikely(sg != sgbuf)) kfree(sg); @@ -200,19 +200,19 @@ } if (esp->auth.icv_full_len) { - esp->auth.icv(esp, skb, (u8*)esph-skb->data, + esp->auth.icv(esp, *pskb, (u8*)esph-(*pskb)->data, sizeof(struct ip_esp_hdr) + esp->conf.ivlen+clen, trailer->tail); - pskb_put(skb, trailer, alen); + pskb_put(*pskb, trailer, alen); } ip_send_check(top_iph); - skb->nh.raw = skb->data; + (*pskb)->nh.raw = (*pskb)->data; - x->curlft.bytes += skb->len; + x->curlft.bytes += (*pskb)->len; x->curlft.packets++; spin_unlock_bh(&x->lock); - if ((skb->dst = dst_pop(dst)) == NULL) { + if (((*pskb)->dst = dst_pop(dst)) == NULL) { err = -EHOSTUNREACH; goto error_nolock; } @@ -221,7 +221,7 @@ error: spin_unlock_bh(&x->lock); error_nolock: - kfree_skb(skb); + kfree_skb(*pskb); return err; } diff -urN linux-2.6.7-rc2/net/ipv4/ip_forward.c linux-2.6.7-rc3/net/ipv4/ip_forward.c --- linux-2.6.7-rc2/net/ipv4/ip_forward.c 2004-05-09 19:31:58.000000000 -0700 +++ linux-2.6.7-rc3/net/ipv4/ip_forward.c 2004-06-07 12:55:27.559639359 -0700 @@ -46,7 +46,7 @@ { struct ip_options * opt = &(IPCB(skb)->opt); - IP_INC_STATS_BH(IpForwDatagrams); + IP_INC_STATS_BH(OutForwDatagrams); if (unlikely(opt->optlen)) ip_forward_options(skb); diff -urN linux-2.6.7-rc2/net/ipv4/ip_fragment.c linux-2.6.7-rc3/net/ipv4/ip_fragment.c --- linux-2.6.7-rc2/net/ipv4/ip_fragment.c 2004-05-09 19:32:26.000000000 -0700 +++ linux-2.6.7-rc3/net/ipv4/ip_fragment.c 2004-06-07 12:55:27.587640518 -0700 @@ -263,7 +263,7 @@ spin_unlock(&qp->lock); ipq_put(qp); - IP_INC_STATS_BH(IpReasmFails); + IP_INC_STATS_BH(ReasmFails); } } @@ -281,8 +281,8 @@ ipq_kill(qp); - IP_INC_STATS_BH(IpReasmTimeout); - IP_INC_STATS_BH(IpReasmFails); + IP_INC_STATS_BH(ReasmTimeout); + IP_INC_STATS_BH(ReasmFails); if ((qp->last_in&FIRST_IN) && qp->fragments != NULL) { struct sk_buff *head = qp->fragments; @@ -609,7 +609,7 @@ iph = head->nh.iph; iph->frag_off = 0; iph->tot_len = htons(len); - IP_INC_STATS_BH(IpReasmOKs); + IP_INC_STATS_BH(ReasmOKs); qp->fragments = NULL; return head; @@ -625,7 +625,7 @@ "Oversized IP packet from %d.%d.%d.%d.\n", NIPQUAD(qp->saddr)); out_fail: - IP_INC_STATS_BH(IpReasmFails); + IP_INC_STATS_BH(ReasmFails); return NULL; } @@ -636,7 +636,7 @@ struct ipq *qp; struct net_device *dev; - IP_INC_STATS_BH(IpReasmReqds); + IP_INC_STATS_BH(ReasmReqds); /* Start by cleaning up the memory. */ if (atomic_read(&ip_frag_mem) > sysctl_ipfrag_high_thresh) @@ -661,7 +661,7 @@ return ret; } - IP_INC_STATS_BH(IpReasmFails); + IP_INC_STATS_BH(ReasmFails); kfree_skb(skb); return NULL; } diff -urN linux-2.6.7-rc2/net/ipv4/ip_input.c linux-2.6.7-rc3/net/ipv4/ip_input.c --- linux-2.6.7-rc2/net/ipv4/ip_input.c 2004-05-09 19:31:59.000000000 -0700 +++ linux-2.6.7-rc3/net/ipv4/ip_input.c 2004-06-07 12:55:27.601641098 -0700 @@ -150,7 +150,7 @@ * SNMP management statistics */ -DEFINE_SNMP_STAT(struct ip_mib, ip_statistics); +DEFINE_SNMP_STAT(struct ipstats_mib, ip_statistics); /* * Process Router Attention IP option @@ -249,16 +249,16 @@ protocol = -ret; goto resubmit; } - IP_INC_STATS_BH(IpInDelivers); + IP_INC_STATS_BH(InDelivers); } else { if (!raw_sk) { if (xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) { - IP_INC_STATS_BH(IpInUnknownProtos); + IP_INC_STATS_BH(InUnknownProtos); icmp_send(skb, ICMP_DEST_UNREACH, ICMP_PROT_UNREACH, 0); } } else - IP_INC_STATS_BH(IpInDelivers); + IP_INC_STATS_BH(InDelivers); kfree_skb(skb); } } @@ -324,7 +324,7 @@ */ if (skb_cow(skb, skb_headroom(skb))) { - IP_INC_STATS_BH(IpInDiscards); + IP_INC_STATS_BH(InDiscards); goto drop; } iph = skb->nh.iph; @@ -353,7 +353,7 @@ return dst_input(skb); inhdr_error: - IP_INC_STATS_BH(IpInHdrErrors); + IP_INC_STATS_BH(InHdrErrors); drop: kfree_skb(skb); return NET_RX_DROP; @@ -372,10 +372,10 @@ if (skb->pkt_type == PACKET_OTHERHOST) goto drop; - IP_INC_STATS_BH(IpInReceives); + IP_INC_STATS_BH(InReceives); if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) { - IP_INC_STATS_BH(IpInDiscards); + IP_INC_STATS_BH(InDiscards); goto out; } @@ -426,7 +426,7 @@ ip_rcv_finish); inhdr_error: - IP_INC_STATS_BH(IpInHdrErrors); + IP_INC_STATS_BH(InHdrErrors); drop: kfree_skb(skb); out: diff -urN linux-2.6.7-rc2/net/ipv4/ip_output.c linux-2.6.7-rc3/net/ipv4/ip_output.c --- linux-2.6.7-rc2/net/ipv4/ip_output.c 2004-06-07 12:54:53.378223607 -0700 +++ linux-2.6.7-rc3/net/ipv4/ip_output.c 2004-06-07 12:55:27.628642217 -0700 @@ -223,8 +223,9 @@ ip_finish_output2); } -int ip_mc_output(struct sk_buff *skb) +int ip_mc_output(struct sk_buff **pskb) { + struct sk_buff *skb = *pskb; struct sock *sk = skb->sk; struct rtable *rt = (struct rtable*)skb->dst; struct net_device *dev = rt->u.dst.dev; @@ -232,7 +233,7 @@ /* * If the indicated interface is up and running, send the packet. */ - IP_INC_STATS(IpOutRequests); + IP_INC_STATS(OutRequests); skb->dev = dev; skb->protocol = htons(ETH_P_IP); @@ -283,9 +284,11 @@ return ip_finish_output(skb); } -int ip_output(struct sk_buff *skb) +int ip_output(struct sk_buff **pskb) { - IP_INC_STATS(IpOutRequests); + struct sk_buff *skb = *pskb; + + IP_INC_STATS(OutRequests); if ((skb->len > dst_pmtu(skb->dst) || skb_shinfo(skb)->frag_list) && !skb_shinfo(skb)->tso_size) @@ -390,7 +393,7 @@ dst_output); no_route: - IP_INC_STATS(IpOutNoRoutes); + IP_INC_STATS(OutNoRoutes); kfree_skb(skb); return -EHOSTUNREACH; } @@ -547,7 +550,7 @@ } if (err == 0) { - IP_INC_STATS(IpFragOKs); + IP_INC_STATS(FragOKs); return 0; } @@ -556,7 +559,7 @@ kfree_skb(frag); frag = skb; } - IP_INC_STATS(IpFragFails); + IP_INC_STATS(FragFails); return err; } @@ -662,7 +665,7 @@ * Put this fragment into the sending queue. */ - IP_INC_STATS(IpFragCreates); + IP_INC_STATS(FragCreates); iph->tot_len = htons(len + hlen); @@ -673,12 +676,12 @@ goto fail; } kfree_skb(skb); - IP_INC_STATS(IpFragOKs); + IP_INC_STATS(FragOKs); return err; fail: kfree_skb(skb); - IP_INC_STATS(IpFragFails); + IP_INC_STATS(FragFails); return err; } @@ -975,7 +978,7 @@ error: inet->cork.length -= length; - IP_INC_STATS(IpOutDiscards); + IP_INC_STATS(OutDiscards); return err; } @@ -1088,7 +1091,7 @@ error: inet->cork.length -= size; - IP_INC_STATS(IpOutDiscards); + IP_INC_STATS(OutDiscards); return err; } @@ -1198,7 +1201,7 @@ return err; error: - IP_INC_STATS(IpOutDiscards); + IP_INC_STATS(OutDiscards); goto out; } diff -urN linux-2.6.7-rc2/net/ipv4/ipcomp.c linux-2.6.7-rc3/net/ipv4/ipcomp.c --- linux-2.6.7-rc2/net/ipv4/ipcomp.c 2004-05-09 19:33:13.000000000 -0700 +++ linux-2.6.7-rc3/net/ipv4/ipcomp.c 2004-06-07 12:55:27.630642300 -0700 @@ -143,10 +143,10 @@ skb->nh.raw = skb->data; } -static int ipcomp_output(struct sk_buff *skb) +static int ipcomp_output(struct sk_buff **pskb) { int err; - struct dst_entry *dst = skb->dst; + struct dst_entry *dst = (*pskb)->dst; struct xfrm_state *x = dst->xfrm; struct iphdr *iph, *top_iph; struct ip_comp_hdr *ipch; @@ -157,25 +157,26 @@ } tmp_iph; int hdr_len = 0; - if (skb->ip_summed == CHECKSUM_HW && skb_checksum_help(skb) == NULL) { - err = -EINVAL; - goto error_nolock; + if ((*pskb)->ip_summed == CHECKSUM_HW) { + err = skb_checksum_help(pskb, 0); + if (err) + goto error_nolock; } spin_lock_bh(&x->lock); - err = xfrm_check_output(x, skb, AF_INET); + err = xfrm_check_output(x, *pskb, AF_INET); if (err) goto error; /* Don't bother compressing */ if (!x->props.mode) { - iph = skb->nh.iph; + iph = (*pskb)->nh.iph; hdr_len = iph->ihl * 4; } - if ((skb->len - hdr_len) < ipcd->threshold) { + if (((*pskb)->len - hdr_len) < ipcd->threshold) { if (x->props.mode) { - ipcomp_tunnel_encap(x, skb); - iph = skb->nh.iph; + ipcomp_tunnel_encap(x, *pskb); + iph = (*pskb)->nh.iph; iph->protocol = IPPROTO_IPIP; ip_send_check(iph); } @@ -183,19 +184,19 @@ } if (x->props.mode) - ipcomp_tunnel_encap(x, skb); + ipcomp_tunnel_encap(x, *pskb); - if ((skb_is_nonlinear(skb) || skb_cloned(skb)) && - skb_linearize(skb, GFP_ATOMIC) != 0) { + if ((skb_is_nonlinear(*pskb) || skb_cloned(*pskb)) && + skb_linearize(*pskb, GFP_ATOMIC) != 0) { err = -ENOMEM; goto error; } - err = ipcomp_compress(x, skb); + err = ipcomp_compress(x, *pskb); if (err) { if (err == -EMSGSIZE) { if (x->props.mode) { - iph = skb->nh.iph; + iph = (*pskb)->nh.iph; iph->protocol = IPPROTO_IPIP; ip_send_check(iph); } @@ -205,14 +206,14 @@ } /* Install ipcomp header, convert into ipcomp datagram. */ - iph = skb->nh.iph; + iph = (*pskb)->nh.iph; memcpy(&tmp_iph, iph, iph->ihl * 4); - top_iph = (struct iphdr *)skb_push(skb, sizeof(struct ip_comp_hdr)); + top_iph = (struct iphdr *)skb_push(*pskb, sizeof(struct ip_comp_hdr)); memcpy(top_iph, &tmp_iph, iph->ihl * 4); iph = top_iph; if (x->props.mode && (x->props.flags & XFRM_STATE_NOECN)) IP_ECN_clear(iph); - iph->tot_len = htons(skb->len); + iph->tot_len = htons((*pskb)->len); iph->protocol = IPPROTO_COMP; iph->check = 0; ipch = (struct ip_comp_hdr *)((char *)iph + iph->ihl * 4); @@ -220,14 +221,14 @@ ipch->flags = 0; ipch->cpi = htons((u16 )ntohl(x->id.spi)); ip_send_check(iph); - skb->nh.raw = skb->data; + (*pskb)->nh.raw = (*pskb)->data; out_ok: - x->curlft.bytes += skb->len; + x->curlft.bytes += (*pskb)->len; x->curlft.packets++; spin_unlock_bh(&x->lock); - if ((skb->dst = dst_pop(dst)) == NULL) { + if (((*pskb)->dst = dst_pop(dst)) == NULL) { err = -EHOSTUNREACH; goto error_nolock; } @@ -238,7 +239,7 @@ error: spin_unlock_bh(&x->lock); error_nolock: - kfree_skb(skb); + kfree_skb(*pskb); goto out_exit; } @@ -339,6 +340,7 @@ struct ipcomp_data *ipcd = x->data; if (!ipcd) return; + xfrm_state_delete_tunnel(x); ipcomp_free_data(ipcd); kfree(ipcd); } diff -urN linux-2.6.7-rc2/net/ipv4/ipmr.c linux-2.6.7-rc3/net/ipv4/ipmr.c --- linux-2.6.7-rc2/net/ipv4/ipmr.c 2004-06-07 12:54:53.444226341 -0700 +++ linux-2.6.7-rc3/net/ipv4/ipmr.c 2004-06-07 12:55:27.709645572 -0700 @@ -1008,7 +1008,7 @@ * The IP multicast ioctl support routines. */ -int ipmr_ioctl(struct sock *sk, int cmd, unsigned long arg) +int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg) { struct sioc_sg_req sr; struct sioc_vif_req vr; @@ -1018,7 +1018,7 @@ switch(cmd) { case SIOCGETVIFCNT: - if (copy_from_user(&vr,(void *)arg,sizeof(vr))) + if (copy_from_user(&vr,arg,sizeof(vr))) return -EFAULT; if(vr.vifi>=maxvif) return -EINVAL; @@ -1031,14 +1031,14 @@ vr.obytes=vif->bytes_out; read_unlock(&mrt_lock); - if (copy_to_user((void *)arg,&vr,sizeof(vr))) + if (copy_to_user(arg,&vr,sizeof(vr))) return -EFAULT; return 0; } read_unlock(&mrt_lock); return -EADDRNOTAVAIL; case SIOCGETSGCNT: - if (copy_from_user(&sr,(void *)arg,sizeof(sr))) + if (copy_from_user(&sr,arg,sizeof(sr))) return -EFAULT; read_lock(&mrt_lock); @@ -1049,7 +1049,7 @@ sr.wrong_if = c->mfc_un.res.wrong_if; read_unlock(&mrt_lock); - if (copy_to_user((void *)arg,&sr,sizeof(sr))) + if (copy_to_user(arg,&sr,sizeof(sr))) return -EFAULT; return 0; } @@ -1115,7 +1115,7 @@ { struct ip_options * opt = &(IPCB(skb)->opt); - IP_INC_STATS_BH(IpForwDatagrams); + IP_INC_STATS_BH(OutForwDatagrams); if (unlikely(opt->optlen)) ip_forward_options(skb); @@ -1178,7 +1178,7 @@ to blackhole. */ - IP_INC_STATS_BH(IpFragFails); + IP_INC_STATS_BH(FragFails); ip_rt_put(rt); goto out_free; } diff -urN linux-2.6.7-rc2/net/ipv4/ipvs/ip_vs_core.c linux-2.6.7-rc3/net/ipv4/ipvs/ip_vs_core.c --- linux-2.6.7-rc2/net/ipv4/ipvs/ip_vs_core.c 2004-05-09 19:31:58.000000000 -0700 +++ linux-2.6.7-rc3/net/ipv4/ipvs/ip_vs_core.c 2004-06-07 12:55:27.757647560 -0700 @@ -735,6 +735,13 @@ if (skb->nfcache & NFC_IPVS_PROPERTY) return NF_ACCEPT; + if (skb->ip_summed == CHECKSUM_HW) { + if (skb_checksum_help(pskb, (out == NULL))) + return NF_DROP; + if (skb != *pskb) + skb = *pskb; + } + iph = skb->nh.iph; if (unlikely(iph->protocol == IPPROTO_ICMP)) { int related, verdict = ip_vs_out_icmp(pskb, &related); @@ -974,6 +981,13 @@ return NF_ACCEPT; } + if (skb->ip_summed == CHECKSUM_HW) { + if (skb_checksum_help(pskb, (out == NULL))) + return NF_DROP; + if (skb != *pskb) + skb = *pskb; + } + iph = skb->nh.iph; if (unlikely(iph->protocol == IPPROTO_ICMP)) { int related, verdict = ip_vs_in_icmp(pskb, &related); diff -urN linux-2.6.7-rc2/net/ipv4/ipvs/ip_vs_ctl.c linux-2.6.7-rc3/net/ipv4/ipvs/ip_vs_ctl.c --- linux-2.6.7-rc2/net/ipv4/ipvs/ip_vs_ctl.c 2004-06-07 12:54:53.466227252 -0700 +++ linux-2.6.7-rc3/net/ipv4/ipvs/ip_vs_ctl.c 2004-06-07 12:55:27.805649549 -0700 @@ -1347,7 +1347,7 @@ static int proc_do_defense_mode(ctl_table *table, int write, struct file * filp, - void *buffer, size_t *lenp) + void __user *buffer, size_t *lenp) { int *valp = table->data; int val = *valp; @@ -1370,7 +1370,7 @@ static int proc_do_sync_threshold(ctl_table *table, int write, struct file *filp, - void *buffer, size_t *lenp) + void __user *buffer, size_t *lenp) { int *valp = table->data; int val[2]; diff -urN linux-2.6.7-rc2/net/ipv4/netfilter/arp_tables.c linux-2.6.7-rc3/net/ipv4/netfilter/arp_tables.c --- linux-2.6.7-rc2/net/ipv4/netfilter/arp_tables.c 2004-06-07 12:54:53.474227583 -0700 +++ linux-2.6.7-rc3/net/ipv4/netfilter/arp_tables.c 2004-06-07 12:55:27.848651330 -0700 @@ -56,7 +56,6 @@ #endif #define SMP_ALIGN(x) (((x) + SMP_CACHE_BYTES-1) & ~(SMP_CACHE_BYTES-1)) -static DECLARE_MUTEX(arpt_mutex); #define ASSERT_READ_LOCK(x) ARP_NF_ASSERT(down_trylock(&arpt_mutex) != 0) #define ASSERT_WRITE_LOCK(x) ARP_NF_ASSERT(down_trylock(&arpt_mutex) != 0) @@ -388,12 +387,12 @@ } #endif -static inline struct arpt_table *find_table_lock(const char *name, int *error, struct semaphore *mutex) +static inline struct arpt_table *arpt_find_table_lock(const char *name, int *error, struct semaphore *mutex) { return find_inlist_lock(&arpt_tables, name, "arptable_", error, mutex); } -static inline struct arpt_target *find_target_lock(const char *name, int *error, struct semaphore *mutex) +struct arpt_target *arpt_find_target_lock(const char *name, int *error, struct semaphore *mutex) { return find_inlist_lock(&arpt_target, name, "arpt_", error, mutex); } @@ -543,7 +542,7 @@ } t = arpt_get_target(e); - target = find_target_lock(t->u.user.name, &ret, &arpt_mutex); + target = arpt_find_target_lock(t->u.user.name, &ret, &arpt_mutex); if (!target) { duprintf("check_entry: `%s' not found\n", t->u.user.name); goto out; @@ -843,7 +842,7 @@ int ret; struct arpt_table *t; - t = find_table_lock(entries->name, &ret, &arpt_mutex); + t = arpt_find_table_lock(entries->name, &ret, &arpt_mutex); if (t) { duprintf("t->private->number = %u\n", t->private->number); @@ -909,7 +908,7 @@ duprintf("arp_tables: Translated table\n"); - t = find_table_lock(tmp.name, &ret, &arpt_mutex); + t = arpt_find_table_lock(tmp.name, &ret, &arpt_mutex); if (!t) goto free_newinfo_counters_untrans; @@ -1002,7 +1001,7 @@ goto free; } - t = find_table_lock(tmp.name, &ret, &arpt_mutex); + t = arpt_find_table_lock(tmp.name, &ret, &arpt_mutex); if (!t) goto free; @@ -1075,7 +1074,7 @@ break; } name[ARPT_TABLE_MAXNAMELEN-1] = '\0'; - t = find_table_lock(name, &ret, &arpt_mutex); + t = arpt_find_table_lock(name, &ret, &arpt_mutex); if (t) { struct arpt_getinfo info; @@ -1323,6 +1322,7 @@ EXPORT_SYMBOL(arpt_register_table); EXPORT_SYMBOL(arpt_unregister_table); EXPORT_SYMBOL(arpt_do_table); +EXPORT_SYMBOL(arpt_find_target_lock); EXPORT_SYMBOL(arpt_register_target); EXPORT_SYMBOL(arpt_unregister_target); diff -urN linux-2.6.7-rc2/net/ipv4/netfilter/ip_conntrack_core.c linux-2.6.7-rc3/net/ipv4/netfilter/ip_conntrack_core.c --- linux-2.6.7-rc2/net/ipv4/netfilter/ip_conntrack_core.c 2004-06-07 12:54:53.543230441 -0700 +++ linux-2.6.7-rc3/net/ipv4/netfilter/ip_conntrack_core.c 2004-06-07 12:55:27.928654644 -0700 @@ -920,7 +920,7 @@ } struct ip_conntrack_expect * -ip_conntrack_expect_alloc() +ip_conntrack_expect_alloc(void) { struct ip_conntrack_expect *new; diff -urN linux-2.6.7-rc2/net/ipv4/netfilter/ip_fw_compat.c linux-2.6.7-rc3/net/ipv4/netfilter/ip_fw_compat.c --- linux-2.6.7-rc2/net/ipv4/netfilter/ip_fw_compat.c 2004-06-07 12:54:53.544230482 -0700 +++ linux-2.6.7-rc3/net/ipv4/netfilter/ip_fw_compat.c 2004-06-07 12:55:27.940655141 -0700 @@ -69,7 +69,8 @@ /* Assume worse case: any hook could change packet */ (*pskb)->nfcache |= NFC_UNKNOWN | NFC_ALTERED; if ((*pskb)->ip_summed == CHECKSUM_HW) - (*pskb)->ip_summed = CHECKSUM_NONE; + if (skb_checksum_help(pskb, (out == NULL))) + return NF_DROP; switch (hooknum) { case NF_IP_PRE_ROUTING: diff -urN linux-2.6.7-rc2/net/ipv4/netfilter/ip_nat_standalone.c linux-2.6.7-rc3/net/ipv4/netfilter/ip_nat_standalone.c --- linux-2.6.7-rc2/net/ipv4/netfilter/ip_nat_standalone.c 2004-05-09 19:33:12.000000000 -0700 +++ linux-2.6.7-rc3/net/ipv4/netfilter/ip_nat_standalone.c 2004-06-07 12:55:27.962656052 -0700 @@ -85,7 +85,8 @@ /* If we had a hardware checksum before, it's now invalid */ if ((*pskb)->ip_summed == CHECKSUM_HW) - (*pskb)->ip_summed = CHECKSUM_NONE; + if (skb_checksum_help(pskb, (out == NULL))) + return NF_DROP; ct = ip_conntrack_get(*pskb, &ctinfo); /* Can't track? It's not due to stress, or conntrack would diff -urN linux-2.6.7-rc2/net/ipv4/netfilter/ip_tables.c linux-2.6.7-rc3/net/ipv4/netfilter/ip_tables.c --- linux-2.6.7-rc2/net/ipv4/netfilter/ip_tables.c 2004-06-07 12:54:53.557231021 -0700 +++ linux-2.6.7-rc3/net/ipv4/netfilter/ip_tables.c 2004-06-07 12:55:27.995657419 -0700 @@ -61,9 +61,6 @@ #endif #define SMP_ALIGN(x) (((x) + SMP_CACHE_BYTES-1) & ~(SMP_CACHE_BYTES-1)) -/* Mutex protects lists (only traversed in user context). */ -static DECLARE_MUTEX(ipt_mutex); - /* Must have mutex */ #define ASSERT_READ_LOCK(x) IP_NF_ASSERT(down_trylock(&ipt_mutex) != 0) #define ASSERT_WRITE_LOCK(x) IP_NF_ASSERT(down_trylock(&ipt_mutex) != 0) @@ -418,7 +415,7 @@ { void *ret; -#if 0 +#if 0 duprintf("find_inlist: searching for `%s' in %s.\n", name, head == &ipt_target ? "ipt_target" : head == &ipt_match ? "ipt_match" @@ -461,7 +458,7 @@ #endif static inline struct ipt_table * -find_table_lock(const char *name, int *error, struct semaphore *mutex) +ipt_find_table_lock(const char *name, int *error, struct semaphore *mutex) { return find_inlist_lock(&ipt_tables, name, "iptable_", error, mutex); } @@ -472,8 +469,8 @@ return find_inlist_lock(&ipt_match, name, "ipt_", error, mutex); } -static inline struct ipt_target * -find_target_lock(const char *name, int *error, struct semaphore *mutex) +struct ipt_target * +ipt_find_target_lock(const char *name, int *error, struct semaphore *mutex) { return find_inlist_lock(&ipt_target, name, "ipt_", error, mutex); } @@ -688,7 +685,7 @@ goto cleanup_matches; t = ipt_get_target(e); - target = find_target_lock(t->u.user.name, &ret, &ipt_mutex); + target = ipt_find_target_lock(t->u.user.name, &ret, &ipt_mutex); if (!target) { duprintf("check_entry: `%s' not found\n", t->u.user.name); goto cleanup_matches; @@ -1025,7 +1022,7 @@ int ret; struct ipt_table *t; - t = find_table_lock(entries->name, &ret, &ipt_mutex); + t = ipt_find_table_lock(entries->name, &ret, &ipt_mutex); if (t) { duprintf("t->private->number = %u\n", t->private->number); @@ -1092,7 +1089,7 @@ duprintf("ip_tables: Translated table\n"); - t = find_table_lock(tmp.name, &ret, &ipt_mutex); + t = ipt_find_table_lock(tmp.name, &ret, &ipt_mutex); if (!t) goto free_newinfo_counters_untrans; @@ -1195,7 +1192,7 @@ goto free; } - t = find_table_lock(tmp.name, &ret, &ipt_mutex); + t = ipt_find_table_lock(tmp.name, &ret, &ipt_mutex); if (!t) goto free; @@ -1270,7 +1267,7 @@ break; } name[IPT_TABLE_MAXNAMELEN-1] = '\0'; - t = find_table_lock(name, &ret, &ipt_mutex); + t = ipt_find_table_lock(name, &ret, &ipt_mutex); if (t) { struct ipt_getinfo info; @@ -1855,6 +1852,7 @@ EXPORT_SYMBOL(ipt_do_table); EXPORT_SYMBOL(ipt_register_target); EXPORT_SYMBOL(ipt_unregister_target); +EXPORT_SYMBOL(ipt_find_target_lock); module_init(init); module_exit(fini); diff -urN linux-2.6.7-rc2/net/ipv4/netfilter/ipt_ECN.c linux-2.6.7-rc3/net/ipv4/netfilter/ipt_ECN.c --- linux-2.6.7-rc2/net/ipv4/netfilter/ipt_ECN.c 2004-05-09 19:33:21.000000000 -0700 +++ linux-2.6.7-rc3/net/ipv4/netfilter/ipt_ECN.c 2004-06-07 12:55:27.996657461 -0700 @@ -50,7 +50,7 @@ /* Return 0 if there was an error. */ static inline int -set_ect_tcp(struct sk_buff **pskb, const struct ipt_ECN_info *einfo) +set_ect_tcp(struct sk_buff **pskb, const struct ipt_ECN_info *einfo, int inward) { struct tcphdr tcph; u_int16_t diffs[2]; @@ -74,11 +74,15 @@ if (!skb_ip_make_writable(pskb, (*pskb)->nh.iph->ihl*4+sizeof(tcph))) return 0; - tcph.check = csum_fold(csum_partial((char *)diffs, - sizeof(diffs), - tcph.check^0xFFFF)); + if ((*pskb)->ip_summed != CHECKSUM_HW) + tcph.check = csum_fold(csum_partial((char *)diffs, + sizeof(diffs), + tcph.check^0xFFFF)); memcpy((*pskb)->data + (*pskb)->nh.iph->ihl*4, &tcph, sizeof(tcph)); + if ((*pskb)->ip_summed == CHECKSUM_HW) + if (skb_checksum_help(pskb, inward)) + return 0; (*pskb)->nfcache |= NFC_ALTERED; } return 1; @@ -100,7 +104,7 @@ if (einfo->operation & (IPT_ECN_OP_SET_ECE | IPT_ECN_OP_SET_CWR) && (*pskb)->nh.iph->protocol == IPPROTO_TCP) - if (!set_ect_tcp(pskb, einfo)) + if (!set_ect_tcp(pskb, einfo, (out == NULL))) return NF_DROP; return IPT_CONTINUE; diff -urN linux-2.6.7-rc2/net/ipv4/netfilter/ipt_TCPMSS.c linux-2.6.7-rc3/net/ipv4/netfilter/ipt_TCPMSS.c --- linux-2.6.7-rc2/net/ipv4/netfilter/ipt_TCPMSS.c 2004-05-09 19:32:37.000000000 -0700 +++ linux-2.6.7-rc3/net/ipv4/netfilter/ipt_TCPMSS.c 2004-06-07 12:55:27.997657502 -0700 @@ -186,8 +186,9 @@ newmss); retmodified: - /* If we had a hardware checksum before, it's now invalid */ - (*pskb)->ip_summed = CHECKSUM_NONE; + /* We never hw checksum SYN packets. */ + BUG_ON((*pskb)->ip_summed == CHECKSUM_HW); + (*pskb)->nfcache |= NFC_UNKNOWN | NFC_ALTERED; return IPT_CONTINUE; } diff -urN linux-2.6.7-rc2/net/ipv4/netfilter/ipt_recent.c linux-2.6.7-rc3/net/ipv4/netfilter/ipt_recent.c --- linux-2.6.7-rc2/net/ipv4/netfilter/ipt_recent.c 2004-05-09 19:32:00.000000000 -0700 +++ linux-2.6.7-rc3/net/ipv4/netfilter/ipt_recent.c 2004-06-07 12:55:28.002657709 -0700 @@ -175,7 +175,7 @@ * clear -- Flush table, remove all entries */ -static int ip_recent_ctrl(struct file *file, const char *input, unsigned long size, void *data) +static int ip_recent_ctrl(struct file *file, const char __user *input, unsigned long size, void *data) { static const u_int32_t max[4] = { 0xffffffff, 0xffffff, 0xffff, 0xff }; u_int32_t val; diff -urN linux-2.6.7-rc2/net/ipv4/proc.c linux-2.6.7-rc3/net/ipv4/proc.c --- linux-2.6.7-rc2/net/ipv4/proc.c 2004-05-09 19:31:58.000000000 -0700 +++ linux-2.6.7-rc3/net/ipv4/proc.c 2004-06-07 12:55:28.003657750 -0700 @@ -88,7 +88,7 @@ }; static unsigned long -fold_field(void *mib[], int nr) +__fold_field(void *mib[], int offt) { unsigned long res = 0; int i; @@ -98,14 +98,41 @@ continue; res += *((unsigned long *) (((void *) per_cpu_ptr(mib[0], i)) + - sizeof (unsigned long) * nr)); + offt)); res += *((unsigned long *) (((void *) per_cpu_ptr(mib[1], i)) + - sizeof (unsigned long) * nr)); + offt)); } return res; } +#define fold_field(_mib, _nr) __fold_field(_mib, (sizeof(unsigned long) * (_nr))) + +/* snmp items */ +static struct snmp_item snmp4_ipstats_list[] = { +#define __SNMP_GEN(x,y) SNMP_ITEM(struct ipstats_mib, x, y) +#define SNMP_GEN(x) __SNMP_GEN(x, #x) + SNMP_GEN(InReceives), + SNMP_GEN(InHdrErrors), + SNMP_GEN(InAddrErrors), + __SNMP_GEN(OutForwDatagrams,"ForwDatagrams"), /* for backward compatibility */ + SNMP_GEN(InUnknownProtos), + SNMP_GEN(InDiscards), + SNMP_GEN(InDelivers), + SNMP_GEN(OutRequests), + SNMP_GEN(OutDiscards), + SNMP_GEN(OutNoRoutes), + SNMP_GEN(ReasmTimeout), + SNMP_GEN(ReasmReqds), + SNMP_GEN(ReasmOKs), + SNMP_GEN(ReasmFails), + SNMP_GEN(FragOKs), + SNMP_GEN(FragFails), + SNMP_GEN(FragCreates), + SNMP_ITEM_SENTINEL +#undef SNMP_GEN +}; + /* * Called from the PROCfs module. This outputs /proc/net/snmp. */ @@ -113,17 +140,18 @@ { int i; - seq_printf(seq, "Ip: Forwarding DefaultTTL InReceives InHdrErrors " - "InAddrErrors ForwDatagrams InUnknownProtos " - "InDiscards InDelivers OutRequests OutDiscards " - "OutNoRoutes ReasmTimeout ReasmReqds ReasmOKs " - "ReasmFails FragOKs FragFails FragCreates\nIp: %d %d", + seq_printf(seq, "Ip: Forwarding DefaultTTL"); + + for (i = 0; snmp4_ipstats_list[i].name != NULL; i++) + seq_printf(seq, " %s", snmp4_ipstats_list[i].name); + + seq_printf(seq, "\nIp: %d %d", ipv4_devconf.forwarding ? 1 : 2, sysctl_ip_default_ttl); - for (i = 0; - i < offsetof(struct ip_mib, __pad) / sizeof(unsigned long); i++) + for (i = 0; snmp4_ipstats_list[i].name != NULL; i++) seq_printf(seq, " %lu", - fold_field((void **) ip_statistics, i)); + __fold_field((void **) ip_statistics, + snmp4_ipstats_list[i].offset)); seq_printf(seq, "\nIcmp: InMsgs InErrors InDestUnreachs InTimeExcds " "InParmProbs InSrcQuenchs InRedirects InEchos " diff -urN linux-2.6.7-rc2/net/ipv4/raw.c linux-2.6.7-rc3/net/ipv4/raw.c --- linux-2.6.7-rc2/net/ipv4/raw.c 2004-06-07 12:54:53.567231435 -0700 +++ linux-2.6.7-rc3/net/ipv4/raw.c 2004-06-07 12:55:28.045659490 -0700 @@ -319,7 +319,7 @@ err = -EFAULT; kfree_skb(skb); error: - IP_INC_STATS(IpOutDiscards); + IP_INC_STATS(OutDiscards); return err; } @@ -631,7 +631,7 @@ switch (cmd) { case SIOCOUTQ: { int amount = atomic_read(&sk->sk_wmem_alloc); - return put_user(amount, (int *)arg); + return put_user(amount, (int __user *)arg); } case SIOCINQ: { struct sk_buff *skb; @@ -642,12 +642,12 @@ if (skb != NULL) amount = skb->len; spin_unlock_irq(&sk->sk_receive_queue.lock); - return put_user(amount, (int *)arg); + return put_user(amount, (int __user *)arg); } default: #ifdef CONFIG_IP_MROUTE - return ipmr_ioctl(sk, cmd, arg); + return ipmr_ioctl(sk, cmd, (void __user *)arg); #else return -ENOIOCTLCMD; #endif diff -urN linux-2.6.7-rc2/net/ipv4/route.c linux-2.6.7-rc3/net/ipv4/route.c --- linux-2.6.7-rc2/net/ipv4/route.c 2004-05-09 19:33:21.000000000 -0700 +++ linux-2.6.7-rc3/net/ipv4/route.c 2004-06-07 12:55:28.047659573 -0700 @@ -1040,6 +1040,8 @@ rt->u.dst.child = NULL; if (rt->u.dst.dev) dev_hold(rt->u.dst.dev); + if (rt->idev) + in_dev_hold(rt->idev); rt->u.dst.obsolete = 0; rt->u.dst.lastuse = jiffies; rt->u.dst.path = &rt->u.dst; @@ -1321,11 +1323,17 @@ { struct rtable *rt = (struct rtable *) dst; struct inet_peer *peer = rt->peer; + struct in_device *idev = rt->idev; if (peer) { rt->peer = NULL; inet_putpeer(peer); } + + if (idev) { + rt->idev = NULL; + in_dev_put(idev); + } } static void ipv4_link_failure(struct sk_buff *skb) @@ -1339,8 +1347,10 @@ dst_set_expires(&rt->u.dst, 0); } -static int ip_rt_bug(struct sk_buff *skb) +static int ip_rt_bug(struct sk_buff **pskb) { + struct sk_buff *skb = *pskb; + printk(KERN_DEBUG "ip_rt_bug: %u.%u.%u.%u -> %u.%u.%u.%u, %s\n", NIPQUAD(skb->nh.iph->saddr), NIPQUAD(skb->nh.iph->daddr), skb->dev ? skb->dev->name : "?"); @@ -1486,6 +1496,7 @@ rth->fl.iif = dev->ifindex; rth->u.dst.dev = &loopback_dev; dev_hold(rth->u.dst.dev); + rth->idev = in_dev_get(rth->u.dst.dev); rth->fl.oif = 0; rth->rt_gateway = daddr; rth->rt_spec_dst= spec_dst; @@ -1695,6 +1706,7 @@ rth->fl.iif = dev->ifindex; rth->u.dst.dev = out_dev->dev; dev_hold(rth->u.dst.dev); + rth->idev = in_dev_get(rth->u.dst.dev); rth->fl.oif = 0; rth->rt_spec_dst= spec_dst; @@ -1774,6 +1786,7 @@ rth->fl.iif = dev->ifindex; rth->u.dst.dev = &loopback_dev; dev_hold(rth->u.dst.dev); + rth->idev = in_dev_get(rth->u.dst.dev); rth->rt_gateway = daddr; rth->rt_spec_dst= spec_dst; rth->u.dst.input= ip_local_deliver; @@ -2157,6 +2170,7 @@ rth->rt_iif = oldflp->oif ? : dev_out->ifindex; rth->u.dst.dev = dev_out; dev_hold(dev_out); + rth->idev = in_dev_get(dev_out); rth->rt_gateway = fl.fl4_dst; rth->rt_spec_dst= fl.fl4_src; @@ -2482,7 +2496,7 @@ static int flush_delay; static int ipv4_sysctl_rtcache_flush(ctl_table *ctl, int write, - struct file *filp, void *buffer, + struct file *filp, void __user *buffer, size_t *lenp) { if (write) { @@ -2494,15 +2508,19 @@ return -EINVAL; } -static int ipv4_sysctl_rtcache_flush_strategy(ctl_table *table, int *name, - int nlen, void *oldval, - size_t *oldlenp, void *newval, - size_t newlen, void **context) +static int ipv4_sysctl_rtcache_flush_strategy(ctl_table *table, + int __user *name, + int nlen, + void __user *oldval, + size_t __user *oldlenp, + void __user *newval, + size_t newlen, + void **context) { int delay; if (newlen != sizeof(int)) return -EINVAL; - if (get_user(delay, (int *)newval)) + if (get_user(delay, (int __user *)newval)) return -EFAULT; rt_cache_flush(delay); return 0; diff -urN linux-2.6.7-rc2/net/ipv4/sysctl_net_ipv4.c linux-2.6.7-rc3/net/ipv4/sysctl_net_ipv4.c --- linux-2.6.7-rc2/net/ipv4/sysctl_net_ipv4.c 2004-06-07 12:54:53.572231642 -0700 +++ linux-2.6.7-rc3/net/ipv4/sysctl_net_ipv4.c 2004-06-07 12:55:28.106662017 -0700 @@ -62,7 +62,7 @@ static int ipv4_sysctl_forward(ctl_table *ctl, int write, struct file * filp, - void *buffer, size_t *lenp) + void __user *buffer, size_t *lenp) { int val = ipv4_devconf.forwarding; int ret; @@ -75,9 +75,10 @@ return ret; } -static int ipv4_sysctl_forward_strategy(ctl_table *table, int *name, int nlen, - void *oldval, size_t *oldlenp, - void *newval, size_t newlen, +static int ipv4_sysctl_forward_strategy(ctl_table *table, + int __user *name, int nlen, + void __user *oldval, size_t __user *oldlenp, + void __user *newval, size_t newlen, void **context) { int *valp = table->data; @@ -89,7 +90,7 @@ if (newlen != sizeof(int)) return -EINVAL; - if (get_user(new, (int *)newval)) + if (get_user(new, (int __user *)newval)) return -EFAULT; if (new == *valp) diff -urN linux-2.6.7-rc2/net/ipv4/tcp.c linux-2.6.7-rc3/net/ipv4/tcp.c --- linux-2.6.7-rc2/net/ipv4/tcp.c 2004-06-07 12:54:53.584232139 -0700 +++ linux-2.6.7-rc3/net/ipv4/tcp.c 2004-06-07 12:55:28.122662680 -0700 @@ -530,7 +530,7 @@ return -ENOIOCTLCMD; }; - return put_user(answ, (int *)arg); + return put_user(answ, (int __user *)arg); } @@ -966,7 +966,7 @@ #define TCP_PAGE(sk) (inet_sk(sk)->sndmsg_page) #define TCP_OFF(sk) (inet_sk(sk)->sndmsg_off) -static inline int tcp_copy_to_page(struct sock *sk, char *from, +static inline int tcp_copy_to_page(struct sock *sk, char __user *from, struct sk_buff *skb, struct page *page, int off, int copy) { @@ -991,7 +991,7 @@ return 0; } -static inline int skb_add_data(struct sk_buff *skb, char *from, int copy) +static inline int skb_add_data(struct sk_buff *skb, char __user *from, int copy) { int err = 0; unsigned int csum; @@ -1065,7 +1065,7 @@ while (--iovlen >= 0) { int seglen = iov->iov_len; - unsigned char *from = iov->iov_base; + unsigned char __user *from = iov->iov_base; iov++; @@ -2498,56 +2498,11 @@ break; case TCP_INFO: { struct tcp_info info; - u32 now = tcp_time_stamp; if (get_user(len, optlen)) return -EFAULT; - info.tcpi_state = sk->sk_state; - info.tcpi_ca_state = tp->ca_state; - info.tcpi_retransmits = tp->retransmits; - info.tcpi_probes = tp->probes_out; - info.tcpi_backoff = tp->backoff; - info.tcpi_options = 0; - if (tp->tstamp_ok) - info.tcpi_options |= TCPI_OPT_TIMESTAMPS; - if (tp->sack_ok) - info.tcpi_options |= TCPI_OPT_SACK; - if (tp->wscale_ok) { - info.tcpi_options |= TCPI_OPT_WSCALE; - info.tcpi_snd_wscale = tp->snd_wscale; - info.tcpi_rcv_wscale = tp->rcv_wscale; - } else { - info.tcpi_snd_wscale = 0; - info.tcpi_rcv_wscale = 0; - } - if (tp->ecn_flags & TCP_ECN_OK) - info.tcpi_options |= TCPI_OPT_ECN; - info.tcpi_rto = (1000000 * tp->rto) / HZ; - info.tcpi_ato = (1000000 * tp->ack.ato) / HZ; - info.tcpi_snd_mss = tp->mss_cache_std; - info.tcpi_rcv_mss = tp->ack.rcv_mss; - - info.tcpi_unacked = tp->packets_out; - info.tcpi_sacked = tp->sacked_out; - info.tcpi_lost = tp->lost_out; - info.tcpi_retrans = tp->retrans_out; - info.tcpi_fackets = tp->fackets_out; - - info.tcpi_last_data_sent = ((now - tp->lsndtime) * 1000) / HZ; - info.tcpi_last_ack_sent = 0; - info.tcpi_last_data_recv = ((now - - tp->ack.lrcvtime) * 1000) / HZ; - info.tcpi_last_ack_recv = ((now - tp->rcv_tstamp) * 1000) / HZ; - - info.tcpi_pmtu = tp->pmtu_cookie; - info.tcpi_rcv_ssthresh = tp->rcv_ssthresh; - info.tcpi_rtt = ((1000000 * tp->srtt) / HZ) >> 3; - info.tcpi_rttvar = ((1000000 * tp->mdev) / HZ) >> 2; - info.tcpi_snd_ssthresh = tp->snd_ssthresh; - info.tcpi_snd_cwnd = tp->snd_cwnd; - info.tcpi_advmss = tp->advmss; - info.tcpi_reordering = tp->reordering; + tcp_get_info(sk, &info); len = min_t(unsigned int, len, sizeof(info)); if (put_user(len, optlen)) diff -urN linux-2.6.7-rc2/net/ipv4/tcp_diag.c linux-2.6.7-rc3/net/ipv4/tcp_diag.c --- linux-2.6.7-rc2/net/ipv4/tcp_diag.c 2004-05-09 19:31:58.000000000 -0700 +++ linux-2.6.7-rc3/net/ipv4/tcp_diag.c 2004-06-07 12:55:28.123662721 -0700 @@ -41,6 +41,58 @@ rta->rta_len = rtalen; \ RTA_DATA(rta); }) +/* Return information about state of tcp endpoint in API format. */ +void tcp_get_info(struct sock *sk, struct tcp_info *info) +{ + struct tcp_opt *tp = tcp_sk(sk); + u32 now = tcp_time_stamp; + + memset(info, 0, sizeof(*info)); + + info->tcpi_state = sk->sk_state; + info->tcpi_ca_state = tp->ca_state; + info->tcpi_retransmits = tp->retransmits; + info->tcpi_probes = tp->probes_out; + info->tcpi_backoff = tp->backoff; + + if (tp->tstamp_ok) + info->tcpi_options |= TCPI_OPT_TIMESTAMPS; + if (tp->sack_ok) + info->tcpi_options |= TCPI_OPT_SACK; + if (tp->wscale_ok) { + info->tcpi_options |= TCPI_OPT_WSCALE; + info->tcpi_snd_wscale = tp->snd_wscale; + info->tcpi_rcv_wscale = tp->rcv_wscale; + } + + if (tp->ecn_flags&TCP_ECN_OK) + info->tcpi_options |= TCPI_OPT_ECN; + + info->tcpi_rto = (1000000*tp->rto)/HZ; + info->tcpi_ato = (1000000*tp->ack.ato)/HZ; + info->tcpi_snd_mss = tp->mss_cache; + info->tcpi_rcv_mss = tp->ack.rcv_mss; + + info->tcpi_unacked = tp->packets_out; + info->tcpi_sacked = tp->sacked_out; + info->tcpi_lost = tp->lost_out; + info->tcpi_retrans = tp->retrans_out; + info->tcpi_fackets = tp->fackets_out; + + info->tcpi_last_data_sent = ((now - tp->lsndtime)*1000)/HZ; + info->tcpi_last_data_recv = ((now - tp->ack.lrcvtime)*1000)/HZ; + info->tcpi_last_ack_recv = ((now - tp->rcv_tstamp)*1000)/HZ; + + info->tcpi_pmtu = tp->pmtu_cookie; + info->tcpi_rcv_ssthresh = tp->rcv_ssthresh; + info->tcpi_rtt = ((1000000*tp->srtt)/HZ)>>3; + info->tcpi_rttvar = ((1000000*tp->mdev)/HZ)>>2; + info->tcpi_snd_ssthresh = tp->snd_ssthresh; + info->tcpi_snd_cwnd = tp->snd_cwnd; + info->tcpi_advmss = tp->advmss; + info->tcpi_reordering = tp->reordering; +} + static int tcpdiag_fill(struct sk_buff *skb, struct sock *sk, int ext, u32 pid, u32 seq) { @@ -150,55 +202,8 @@ minfo->tcpdiag_tmem = atomic_read(&sk->sk_wmem_alloc); } - if (info) { - u32 now = tcp_time_stamp; - - info->tcpi_state = sk->sk_state; - info->tcpi_ca_state = tp->ca_state; - info->tcpi_retransmits = tp->retransmits; - info->tcpi_probes = tp->probes_out; - info->tcpi_backoff = tp->backoff; - info->tcpi_options = 0; - if (tp->tstamp_ok) - info->tcpi_options |= TCPI_OPT_TIMESTAMPS; - if (tp->sack_ok) - info->tcpi_options |= TCPI_OPT_SACK; - if (tp->wscale_ok) { - info->tcpi_options |= TCPI_OPT_WSCALE; - info->tcpi_snd_wscale = tp->snd_wscale; - info->tcpi_rcv_wscale = tp->rcv_wscale; - } else { - info->tcpi_snd_wscale = 0; - info->tcpi_rcv_wscale = 0; - } - if (tp->ecn_flags&TCP_ECN_OK) - info->tcpi_options |= TCPI_OPT_ECN; - - info->tcpi_rto = (1000000*tp->rto)/HZ; - info->tcpi_ato = (1000000*tp->ack.ato)/HZ; - info->tcpi_snd_mss = tp->mss_cache; - info->tcpi_rcv_mss = tp->ack.rcv_mss; - - info->tcpi_unacked = tp->packets_out; - info->tcpi_sacked = tp->sacked_out; - info->tcpi_lost = tp->lost_out; - info->tcpi_retrans = tp->retrans_out; - info->tcpi_fackets = tp->fackets_out; - - info->tcpi_last_data_sent = ((now - tp->lsndtime)*1000)/HZ; - info->tcpi_last_ack_sent = 0; - info->tcpi_last_data_recv = ((now - tp->ack.lrcvtime)*1000)/HZ; - info->tcpi_last_ack_recv = ((now - tp->rcv_tstamp)*1000)/HZ; - - info->tcpi_pmtu = tp->pmtu_cookie; - info->tcpi_rcv_ssthresh = tp->rcv_ssthresh; - info->tcpi_rtt = ((1000000*tp->srtt)/HZ)>>3; - info->tcpi_rttvar = ((1000000*tp->mdev)/HZ)>>2; - info->tcpi_snd_ssthresh = tp->snd_ssthresh; - info->tcpi_snd_cwnd = tp->snd_cwnd; - info->tcpi_advmss = tp->advmss; - info->tcpi_reordering = tp->reordering; - } + if (info) + tcp_get_info(sk, info); if (vinfo) { vinfo->tcpv_enabled = tp->vegas.doing_vegas_now; diff -urN linux-2.6.7-rc2/net/ipv4/tcp_ipv4.c linux-2.6.7-rc3/net/ipv4/tcp_ipv4.c --- linux-2.6.7-rc2/net/ipv4/tcp_ipv4.c 2004-06-07 12:54:53.601232843 -0700 +++ linux-2.6.7-rc3/net/ipv4/tcp_ipv4.c 2004-06-07 12:55:28.170664668 -0700 @@ -1290,12 +1290,12 @@ .dport = req->rmt_port } } }; if (ip_route_output_flow(&rt, &fl, sk, 0)) { - IP_INC_STATS_BH(IpOutNoRoutes); + IP_INC_STATS_BH(OutNoRoutes); return NULL; } if (opt && opt->is_strictroute && rt->rt_dst != rt->rt_gateway) { ip_rt_put(rt); - IP_INC_STATS_BH(IpOutNoRoutes); + IP_INC_STATS_BH(OutNoRoutes); return NULL; } return &rt->u.dst; diff -urN linux-2.6.7-rc2/net/ipv4/udp.c linux-2.6.7-rc3/net/ipv4/udp.c --- linux-2.6.7-rc2/net/ipv4/udp.c 2004-06-07 12:54:53.603232926 -0700 +++ linux-2.6.7-rc3/net/ipv4/udp.c 2004-06-07 12:55:28.172664751 -0700 @@ -294,7 +294,7 @@ ipv6_only_sock(s) || (s->sk_bound_dev_if && s->sk_bound_dev_if != dif)) continue; - if (!ip_mc_sf_allow(sk, loc_addr, rmt_addr, dif)) + if (!ip_mc_sf_allow(s, loc_addr, rmt_addr, dif)) continue; goto found; } @@ -725,7 +725,7 @@ case SIOCOUTQ: { int amount = atomic_read(&sk->sk_wmem_alloc); - return put_user(amount, (int *)arg); + return put_user(amount, (int __user *)arg); } case SIOCINQ: @@ -745,7 +745,7 @@ amount = skb->len - sizeof(struct udphdr); } spin_unlock_irq(&sk->sk_receive_queue.lock); - return put_user(amount, (int *)arg); + return put_user(amount, (int __user *)arg); } default: diff -urN linux-2.6.7-rc2/net/ipv4/xfrm4_tunnel.c linux-2.6.7-rc3/net/ipv4/xfrm4_tunnel.c --- linux-2.6.7-rc2/net/ipv4/xfrm4_tunnel.c 2004-05-09 19:32:00.000000000 -0700 +++ linux-2.6.7-rc3/net/ipv4/xfrm4_tunnel.c 2004-06-07 12:55:28.173664792 -0700 @@ -33,8 +33,9 @@ return ret; } -static int ipip_output(struct sk_buff *skb) +static int ipip_output(struct sk_buff **pskb) { + struct sk_buff *skb = *pskb; struct dst_entry *dst = skb->dst; struct xfrm_state *x = dst->xfrm; struct iphdr *iph, *top_iph; diff -urN linux-2.6.7-rc2/net/ipv6/addrconf.c linux-2.6.7-rc3/net/ipv6/addrconf.c --- linux-2.6.7-rc2/net/ipv6/addrconf.c 2004-05-09 19:33:20.000000000 -0700 +++ linux-2.6.7-rc3/net/ipv6/addrconf.c 2004-06-07 12:55:28.214666491 -0700 @@ -1510,7 +1510,7 @@ * Special case for SIT interfaces where we create a new "virtual" * device. */ -int addrconf_set_dstaddr(void *arg) +int addrconf_set_dstaddr(void __user *arg) { struct in6_ifreq ireq; struct net_device *dev; @@ -1630,7 +1630,7 @@ } -int addrconf_add_ifaddr(void *arg) +int addrconf_add_ifaddr(void __user *arg) { struct in6_ifreq ireq; int err; @@ -1647,7 +1647,7 @@ return err; } -int addrconf_del_ifaddr(void *arg) +int addrconf_del_ifaddr(void __user *arg) { struct in6_ifreq ireq; int err; @@ -3003,7 +3003,7 @@ static int addrconf_sysctl_forward(ctl_table *ctl, int write, struct file * filp, - void *buffer, size_t *lenp) + void __user *buffer, size_t *lenp) { int *valp = ctl->data; int val = *valp; @@ -3031,9 +3031,10 @@ } static int addrconf_sysctl_forward_strategy(ctl_table *table, - int *name, int nlen, - void *oldval, size_t *oldlenp, - void *newval, size_t newlen, + int __user *name, int nlen, + void __user *oldval, + size_t __user *oldlenp, + void __user *newval, size_t newlen, void **context) { int *valp = table->data; @@ -3043,7 +3044,7 @@ return 0; if (newlen != sizeof(int)) return -EINVAL; - if (get_user(new, (int *)newval)) + if (get_user(new, (int __user *)newval)) return -EFAULT; if (new == *valp) return 0; diff -urN linux-2.6.7-rc2/net/ipv6/af_inet6.c linux-2.6.7-rc3/net/ipv6/af_inet6.c --- linux-2.6.7-rc2/net/ipv6/af_inet6.c 2004-06-07 12:54:53.614233382 -0700 +++ linux-2.6.7-rc3/net/ipv6/af_inet6.c 2004-06-07 12:55:28.293669763 -0700 @@ -474,23 +474,23 @@ switch(cmd) { case SIOCGSTAMP: - return sock_get_timestamp(sk, (struct timeval *)arg); + return sock_get_timestamp(sk, (struct timeval __user *)arg); case SIOCADDRT: case SIOCDELRT: - return(ipv6_route_ioctl(cmd,(void *)arg)); + return(ipv6_route_ioctl(cmd,(void __user *)arg)); case SIOCSIFADDR: - return addrconf_add_ifaddr((void *) arg); + return addrconf_add_ifaddr((void __user *) arg); case SIOCDIFADDR: - return addrconf_del_ifaddr((void *) arg); + return addrconf_del_ifaddr((void __user *) arg); case SIOCSIFDSTADDR: - return addrconf_set_dstaddr((void *) arg); + return addrconf_set_dstaddr((void __user *) arg); default: if (!sk->sk_prot->ioctl || (err = sk->sk_prot->ioctl(sk, cmd, arg)) == -ENOIOCTLCMD) - return(dev_ioctl(cmd,(void *) arg)); + return(dev_ioctl(cmd,(void __user *) arg)); return err; } /*NOTREACHED*/ @@ -667,14 +667,14 @@ static int __init init_ipv6_mibs(void) { - if (snmp6_mib_init((void **)ipv6_statistics, sizeof (struct ipv6_mib), - __alignof__(struct ipv6_mib)) < 0) + if (snmp6_mib_init((void **)ipv6_statistics, sizeof (struct ipstats_mib), + __alignof__(struct ipstats_mib)) < 0) goto err_ip_mib; if (snmp6_mib_init((void **)icmpv6_statistics, sizeof (struct icmpv6_mib), - __alignof__(struct ipv6_mib)) < 0) + __alignof__(struct icmpv6_mib)) < 0) goto err_icmp_mib; if (snmp6_mib_init((void **)udp_stats_in6, sizeof (struct udp_mib), - __alignof__(struct ipv6_mib)) < 0) + __alignof__(struct udp_mib)) < 0) goto err_udp_mib; return 0; diff -urN linux-2.6.7-rc2/net/ipv6/ah6.c linux-2.6.7-rc3/net/ipv6/ah6.c --- linux-2.6.7-rc2/net/ipv6/ah6.c 2004-06-07 12:54:53.625233837 -0700 +++ linux-2.6.7-rc3/net/ipv6/ah6.c 2004-06-07 12:55:28.315670675 -0700 @@ -144,11 +144,11 @@ return nexthdr; } -int ah6_output(struct sk_buff *skb) +int ah6_output(struct sk_buff **pskb) { int err; int hdr_len = sizeof(struct ipv6hdr); - struct dst_entry *dst = skb->dst; + struct dst_entry *dst = (*pskb)->dst; struct xfrm_state *x = dst->xfrm; struct ipv6hdr *iph = NULL; struct ip_auth_hdr *ah; @@ -156,54 +156,55 @@ u16 nh_offset = 0; u8 nexthdr; - if (skb->ip_summed == CHECKSUM_HW && skb_checksum_help(skb) == NULL) { - err = -EINVAL; - goto error_nolock; + if ((*pskb)->ip_summed == CHECKSUM_HW) { + err = skb_checksum_help(pskb, 0); + if (err) + goto error_nolock; } spin_lock_bh(&x->lock); - err = xfrm_check_output(x, skb, AF_INET6); + err = xfrm_check_output(x, *pskb, AF_INET6); if (err) goto error; if (x->props.mode) { - iph = skb->nh.ipv6h; - skb->nh.ipv6h = (struct ipv6hdr*)skb_push(skb, x->props.header_len); - skb->nh.ipv6h->version = 6; - skb->nh.ipv6h->payload_len = htons(skb->len - sizeof(struct ipv6hdr)); - skb->nh.ipv6h->nexthdr = IPPROTO_AH; - ipv6_addr_copy(&skb->nh.ipv6h->saddr, + iph = (*pskb)->nh.ipv6h; + (*pskb)->nh.ipv6h = (struct ipv6hdr*)skb_push(*pskb, x->props.header_len); + (*pskb)->nh.ipv6h->version = 6; + (*pskb)->nh.ipv6h->payload_len = htons((*pskb)->len - sizeof(struct ipv6hdr)); + (*pskb)->nh.ipv6h->nexthdr = IPPROTO_AH; + ipv6_addr_copy(&(*pskb)->nh.ipv6h->saddr, (struct in6_addr *) &x->props.saddr); - ipv6_addr_copy(&skb->nh.ipv6h->daddr, + ipv6_addr_copy(&(*pskb)->nh.ipv6h->daddr, (struct in6_addr *) &x->id.daddr); - ah = (struct ip_auth_hdr*)(skb->nh.ipv6h+1); + ah = (struct ip_auth_hdr*)((*pskb)->nh.ipv6h+1); ah->nexthdr = IPPROTO_IPV6; } else { - hdr_len = skb->h.raw - skb->nh.raw; + hdr_len = (*pskb)->h.raw - (*pskb)->nh.raw; iph = kmalloc(hdr_len, GFP_ATOMIC); if (!iph) { err = -ENOMEM; goto error; } - memcpy(iph, skb->data, hdr_len); - skb->nh.ipv6h = (struct ipv6hdr*)skb_push(skb, x->props.header_len); - memcpy(skb->nh.ipv6h, iph, hdr_len); - nexthdr = ipv6_clear_mutable_options(skb, &nh_offset, XFRM_POLICY_OUT); + memcpy(iph, (*pskb)->data, hdr_len); + (*pskb)->nh.ipv6h = (struct ipv6hdr*)skb_push(*pskb, x->props.header_len); + memcpy((*pskb)->nh.ipv6h, iph, hdr_len); + nexthdr = ipv6_clear_mutable_options(*pskb, &nh_offset, XFRM_POLICY_OUT); if (nexthdr == 0) goto error_free_iph; - skb->nh.raw[nh_offset] = IPPROTO_AH; - skb->nh.ipv6h->payload_len = htons(skb->len - sizeof(struct ipv6hdr)); - ah = (struct ip_auth_hdr*)(skb->nh.raw+hdr_len); - skb->h.raw = (unsigned char*) ah; + (*pskb)->nh.raw[nh_offset] = IPPROTO_AH; + (*pskb)->nh.ipv6h->payload_len = htons((*pskb)->len - sizeof(struct ipv6hdr)); + ah = (struct ip_auth_hdr*)((*pskb)->nh.raw+hdr_len); + (*pskb)->h.raw = (unsigned char*) ah; ah->nexthdr = nexthdr; } - skb->nh.ipv6h->priority = 0; - skb->nh.ipv6h->flow_lbl[0] = 0; - skb->nh.ipv6h->flow_lbl[1] = 0; - skb->nh.ipv6h->flow_lbl[2] = 0; - skb->nh.ipv6h->hop_limit = 0; + (*pskb)->nh.ipv6h->priority = 0; + (*pskb)->nh.ipv6h->flow_lbl[0] = 0; + (*pskb)->nh.ipv6h->flow_lbl[1] = 0; + (*pskb)->nh.ipv6h->flow_lbl[2] = 0; + (*pskb)->nh.ipv6h->hop_limit = 0; ahp = x->data; ah->hdrlen = (XFRM_ALIGN8(sizeof(struct ipv6_auth_hdr) + @@ -212,29 +213,29 @@ ah->reserved = 0; ah->spi = x->id.spi; ah->seq_no = htonl(++x->replay.oseq); - ahp->icv(ahp, skb, ah->auth_data); + ahp->icv(ahp, *pskb, ah->auth_data); if (x->props.mode) { - skb->nh.ipv6h->hop_limit = iph->hop_limit; - skb->nh.ipv6h->priority = iph->priority; - skb->nh.ipv6h->flow_lbl[0] = iph->flow_lbl[0]; - skb->nh.ipv6h->flow_lbl[1] = iph->flow_lbl[1]; - skb->nh.ipv6h->flow_lbl[2] = iph->flow_lbl[2]; + (*pskb)->nh.ipv6h->hop_limit = iph->hop_limit; + (*pskb)->nh.ipv6h->priority = iph->priority; + (*pskb)->nh.ipv6h->flow_lbl[0] = iph->flow_lbl[0]; + (*pskb)->nh.ipv6h->flow_lbl[1] = iph->flow_lbl[1]; + (*pskb)->nh.ipv6h->flow_lbl[2] = iph->flow_lbl[2]; if (x->props.flags & XFRM_STATE_NOECN) - IP6_ECN_clear(skb->nh.ipv6h); + IP6_ECN_clear((*pskb)->nh.ipv6h); } else { - memcpy(skb->nh.ipv6h, iph, hdr_len); - skb->nh.raw[nh_offset] = IPPROTO_AH; - skb->nh.ipv6h->payload_len = htons(skb->len - sizeof(struct ipv6hdr)); + memcpy((*pskb)->nh.ipv6h, iph, hdr_len); + (*pskb)->nh.raw[nh_offset] = IPPROTO_AH; + (*pskb)->nh.ipv6h->payload_len = htons((*pskb)->len - sizeof(struct ipv6hdr)); kfree (iph); } - skb->nh.raw = skb->data; + (*pskb)->nh.raw = (*pskb)->data; - x->curlft.bytes += skb->len; + x->curlft.bytes += (*pskb)->len; x->curlft.packets++; spin_unlock_bh(&x->lock); - if ((skb->dst = dst_pop(dst)) == NULL) { + if (((*pskb)->dst = dst_pop(dst)) == NULL) { err = -EHOSTUNREACH; goto error_nolock; } @@ -244,7 +245,7 @@ error: spin_unlock_bh(&x->lock); error_nolock: - kfree_skb(skb); + kfree_skb(*pskb); return err; } diff -urN linux-2.6.7-rc2/net/ipv6/esp6.c linux-2.6.7-rc3/net/ipv6/esp6.c --- linux-2.6.7-rc2/net/ipv6/esp6.c 2004-05-09 19:32:52.000000000 -0700 +++ linux-2.6.7-rc3/net/ipv6/esp6.c 2004-06-07 12:55:28.316670716 -0700 @@ -40,11 +40,11 @@ #define MAX_SG_ONSTACK 4 -int esp6_output(struct sk_buff *skb) +int esp6_output(struct sk_buff **pskb) { int err; int hdr_len = 0; - struct dst_entry *dst = skb->dst; + struct dst_entry *dst = (*pskb)->dst; struct xfrm_state *x = dst->xfrm; struct ipv6hdr *iph = NULL, *top_iph; struct ipv6_esp_hdr *esph; @@ -58,14 +58,14 @@ u8 *prevhdr; u8 nexthdr = 0; - /* First, if the skb is not checksummed, complete checksum. */ - if (skb->ip_summed == CHECKSUM_HW && skb_checksum_help(skb) == NULL) { - err = -EINVAL; - goto error_nolock; + if ((*pskb)->ip_summed == CHECKSUM_HW) { + err = skb_checksum_help(pskb, 0); + if (err) + goto error_nolock; } spin_lock_bh(&x->lock); - err = xfrm_check_output(x, skb, AF_INET6); + err = xfrm_check_output(x, *pskb, AF_INET6); if (err) goto error; err = -ENOMEM; @@ -73,7 +73,7 @@ /* Strip IP header in transport mode. Save it. */ if (!x->props.mode) { - hdr_len = ip6_find_1stfragopt(skb, &prevhdr); + hdr_len = ip6_find_1stfragopt(*pskb, &prevhdr); nexthdr = *prevhdr; *prevhdr = IPPROTO_ESP; iph = kmalloc(hdr_len, GFP_ATOMIC); @@ -81,14 +81,14 @@ err = -ENOMEM; goto error; } - memcpy(iph, skb->nh.raw, hdr_len); - __skb_pull(skb, hdr_len); + memcpy(iph, (*pskb)->nh.raw, hdr_len); + __skb_pull(*pskb, hdr_len); } /* Now skb is pure payload to encrypt */ /* Round to block size */ - clen = skb->len; + clen = (*pskb)->len; esp = x->data; alen = esp->auth.icv_trunc_len; @@ -98,7 +98,7 @@ if (esp->conf.padlen) clen = (clen + esp->conf.padlen-1)&~(esp->conf.padlen-1); - if ((nfrags = skb_cow_data(skb, clen-skb->len+alen, &trailer)) < 0) { + if ((nfrags = skb_cow_data(*pskb, clen-(*pskb)->len+alen, &trailer)) < 0) { if (!x->props.mode && iph) kfree(iph); goto error; } @@ -106,15 +106,15 @@ /* Fill padding... */ do { int i; - for (i=0; ilen - 2; i++) + for (i=0; ilen - 2; i++) *(u8*)(trailer->tail + i) = i+1; } while (0); - *(u8*)(trailer->tail + clen-skb->len - 2) = (clen - skb->len)-2; - pskb_put(skb, trailer, clen - skb->len); + *(u8*)(trailer->tail + clen-(*pskb)->len - 2) = (clen - (*pskb)->len)-2; + pskb_put(*pskb, trailer, clen - (*pskb)->len); if (x->props.mode) { - iph = skb->nh.ipv6h; - top_iph = (struct ipv6hdr*)skb_push(skb, x->props.header_len); + iph = (*pskb)->nh.ipv6h; + top_iph = (struct ipv6hdr*)skb_push(*pskb, x->props.header_len); esph = (struct ipv6_esp_hdr*)(top_iph+1); *(u8*)(trailer->tail - 1) = IPPROTO_IPV6; top_iph->version = 6; @@ -125,19 +125,19 @@ if (x->props.flags & XFRM_STATE_NOECN) IP6_ECN_clear(top_iph); top_iph->nexthdr = IPPROTO_ESP; - top_iph->payload_len = htons(skb->len + alen - sizeof(struct ipv6hdr)); + top_iph->payload_len = htons((*pskb)->len + alen - sizeof(struct ipv6hdr)); top_iph->hop_limit = iph->hop_limit; ipv6_addr_copy(&top_iph->saddr, (struct in6_addr *)&x->props.saddr); ipv6_addr_copy(&top_iph->daddr, (struct in6_addr *)&x->id.daddr); } else { - esph = (struct ipv6_esp_hdr*)skb_push(skb, x->props.header_len); - skb->h.raw = (unsigned char*)esph; - top_iph = (struct ipv6hdr*)skb_push(skb, hdr_len); + esph = (struct ipv6_esp_hdr*)skb_push(*pskb, x->props.header_len); + (*pskb)->h.raw = (unsigned char*)esph; + top_iph = (struct ipv6hdr*)skb_push(*pskb, hdr_len); memcpy(top_iph, iph, hdr_len); kfree(iph); - top_iph->payload_len = htons(skb->len + alen - sizeof(struct ipv6hdr)); + top_iph->payload_len = htons((*pskb)->len + alen - sizeof(struct ipv6hdr)); *(u8*)(trailer->tail - 1) = nexthdr; } @@ -156,7 +156,7 @@ if (!sg) goto error; } - skb_to_sgvec(skb, sg, esph->enc_data+esp->conf.ivlen-skb->data, clen); + skb_to_sgvec(*pskb, sg, esph->enc_data+esp->conf.ivlen-(*pskb)->data, clen); crypto_cipher_encrypt(tfm, sg, sg, clen); if (unlikely(sg != sgbuf)) kfree(sg); @@ -168,17 +168,17 @@ } if (esp->auth.icv_full_len) { - esp->auth.icv(esp, skb, (u8*)esph-skb->data, + esp->auth.icv(esp, *pskb, (u8*)esph-(*pskb)->data, sizeof(struct ipv6_esp_hdr) + esp->conf.ivlen+clen, trailer->tail); - pskb_put(skb, trailer, alen); + pskb_put(*pskb, trailer, alen); } - skb->nh.raw = skb->data; + (*pskb)->nh.raw = (*pskb)->data; - x->curlft.bytes += skb->len; + x->curlft.bytes += (*pskb)->len; x->curlft.packets++; spin_unlock_bh(&x->lock); - if ((skb->dst = dst_pop(dst)) == NULL) { + if (((*pskb)->dst = dst_pop(dst)) == NULL) { err = -EHOSTUNREACH; goto error_nolock; } @@ -187,7 +187,7 @@ error: spin_unlock_bh(&x->lock); error_nolock: - kfree_skb(skb); + kfree_skb(*pskb); return err; } diff -urN linux-2.6.7-rc2/net/ipv6/exthdrs.c linux-2.6.7-rc3/net/ipv6/exthdrs.c --- linux-2.6.7-rc2/net/ipv6/exthdrs.c 2004-05-09 19:31:59.000000000 -0700 +++ linux-2.6.7-rc3/net/ipv6/exthdrs.c 2004-06-07 12:55:28.359672497 -0700 @@ -159,7 +159,7 @@ if (!pskb_may_pull(skb, (skb->h.raw-skb->data)+8) || !pskb_may_pull(skb, (skb->h.raw-skb->data)+((skb->h.raw[1]+1)<<3))) { - IP6_INC_STATS_BH(Ip6InHdrErrors); + IP6_INC_STATS_BH(InHdrErrors); kfree_skb(skb); return -1; } @@ -172,7 +172,7 @@ return 1; } - IP6_INC_STATS_BH(Ip6InHdrErrors); + IP6_INC_STATS_BH(InHdrErrors); return -1; } @@ -227,7 +227,7 @@ if (!pskb_may_pull(skb, (skb->h.raw-skb->data)+8) || !pskb_may_pull(skb, (skb->h.raw-skb->data)+((skb->h.raw[1]+1)<<3))) { - IP6_INC_STATS_BH(Ip6InHdrErrors); + IP6_INC_STATS_BH(InHdrErrors); kfree_skb(skb); return -1; } @@ -236,7 +236,7 @@ if (ipv6_addr_is_multicast(&skb->nh.ipv6h->daddr) || skb->pkt_type != PACKET_HOST) { - IP6_INC_STATS_BH(Ip6InAddrErrors); + IP6_INC_STATS_BH(InAddrErrors); kfree_skb(skb); return -1; } @@ -252,13 +252,13 @@ } if (hdr->type != IPV6_SRCRT_TYPE_0) { - IP6_INC_STATS_BH(Ip6InHdrErrors); + IP6_INC_STATS_BH(InHdrErrors); icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, (&hdr->type) - skb->nh.raw); return -1; } if (hdr->hdrlen & 0x01) { - IP6_INC_STATS_BH(Ip6InHdrErrors); + IP6_INC_STATS_BH(InHdrErrors); icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, (&hdr->hdrlen) - skb->nh.raw); return -1; } @@ -271,7 +271,7 @@ n = hdr->hdrlen >> 1; if (hdr->segments_left > n) { - IP6_INC_STATS_BH(Ip6InHdrErrors); + IP6_INC_STATS_BH(InHdrErrors); icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, (&hdr->segments_left) - skb->nh.raw); return -1; } @@ -284,7 +284,7 @@ kfree_skb(skb); /* the copy is a forwarded packet */ if (skb2 == NULL) { - IP6_INC_STATS_BH(Ip6OutDiscards); + IP6_INC_STATS_BH(OutDiscards); return -1; } *skbp = skb = skb2; @@ -302,7 +302,7 @@ addr += i - 1; if (ipv6_addr_is_multicast(addr)) { - IP6_INC_STATS_BH(Ip6InAddrErrors); + IP6_INC_STATS_BH(InAddrErrors); kfree_skb(skb); return -1; } @@ -319,7 +319,7 @@ } if (skb->dst->dev->flags&IFF_LOOPBACK) { if (skb->nh.ipv6h->hop_limit <= 1) { - IP6_INC_STATS_BH(Ip6InHdrErrors); + IP6_INC_STATS_BH(InHdrErrors); icmpv6_send(skb, ICMPV6_TIME_EXCEED, ICMPV6_EXC_HOPLIMIT, 0, skb->dev); kfree_skb(skb); @@ -436,24 +436,24 @@ if (skb->nh.raw[optoff+1] != 4 || (optoff&3) != 2) { LIMIT_NETDEBUG( printk(KERN_DEBUG "ipv6_hop_jumbo: wrong jumbo opt length/alignment %d\n", skb->nh.raw[optoff+1])); - IP6_INC_STATS_BH(Ip6InHdrErrors); + IP6_INC_STATS_BH(InHdrErrors); goto drop; } pkt_len = ntohl(*(u32*)(skb->nh.raw+optoff+2)); if (pkt_len <= IPV6_MAXPLEN) { - IP6_INC_STATS_BH(Ip6InHdrErrors); + IP6_INC_STATS_BH(InHdrErrors); icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, optoff+2); return 0; } if (skb->nh.ipv6h->payload_len) { - IP6_INC_STATS_BH(Ip6InHdrErrors); + IP6_INC_STATS_BH(InHdrErrors); icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, optoff); return 0; } if (pkt_len > skb->len - sizeof(struct ipv6hdr)) { - IP6_INC_STATS_BH(Ip6InTruncatedPkts); + IP6_INC_STATS_BH(InTruncatedPkts); goto drop; } if (pkt_len + sizeof(struct ipv6hdr) < skb->len) { diff -urN linux-2.6.7-rc2/net/ipv6/icmp.c linux-2.6.7-rc3/net/ipv6/icmp.c --- linux-2.6.7-rc2/net/ipv6/icmp.c 2004-05-09 19:32:27.000000000 -0700 +++ linux-2.6.7-rc3/net/ipv6/icmp.c 2004-06-07 12:55:28.381673409 -0700 @@ -174,7 +174,7 @@ */ dst = ip6_route_output(sk, fl); if (dst->error) { - IP6_INC_STATS(Ip6OutNoRoutes); + IP6_INC_STATS(OutNoRoutes); } else if (dst->dev && (dst->dev->flags&IFF_LOOPBACK)) { res = 1; } else { diff -urN linux-2.6.7-rc2/net/ipv6/ip6_flowlabel.c linux-2.6.7-rc3/net/ipv6/ip6_flowlabel.c --- linux-2.6.7-rc2/net/ipv6/ip6_flowlabel.c 2004-06-07 12:54:53.629234003 -0700 +++ linux-2.6.7-rc3/net/ipv6/ip6_flowlabel.c 2004-06-07 12:55:28.407674486 -0700 @@ -692,14 +692,14 @@ #endif -void ip6_flowlabel_init() +void ip6_flowlabel_init(void) { #ifdef CONFIG_PROC_FS proc_net_fops_create("ip6_flowlabel", S_IRUGO, &ip6fl_seq_fops); #endif } -void ip6_flowlabel_cleanup() +void ip6_flowlabel_cleanup(void) { del_timer(&ip6_fl_gc_timer); #ifdef CONFIG_PROC_FS diff -urN linux-2.6.7-rc2/net/ipv6/ip6_input.c linux-2.6.7-rc3/net/ipv6/ip6_input.c --- linux-2.6.7-rc2/net/ipv6/ip6_input.c 2004-05-09 19:32:54.000000000 -0700 +++ linux-2.6.7-rc3/net/ipv6/ip6_input.c 2004-06-07 12:55:28.431675480 -0700 @@ -64,10 +64,10 @@ if (skb->pkt_type == PACKET_OTHERHOST) goto drop; - IP6_INC_STATS_BH(Ip6InReceives); + IP6_INC_STATS_BH(InReceives); if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) { - IP6_INC_STATS_BH(Ip6InDiscards); + IP6_INC_STATS_BH(InDiscards); goto out; } @@ -80,7 +80,7 @@ goto err; if (!pskb_may_pull(skb, sizeof(struct ipv6hdr))) { - IP6_INC_STATS_BH(Ip6InHdrErrors); + IP6_INC_STATS_BH(InHdrErrors); goto drop; } @@ -97,7 +97,7 @@ goto truncated; if (pkt_len + sizeof(struct ipv6hdr) < skb->len) { if (__pskb_trim(skb, pkt_len + sizeof(struct ipv6hdr))){ - IP6_INC_STATS_BH(Ip6InHdrErrors); + IP6_INC_STATS_BH(InHdrErrors); goto drop; } hdr = skb->nh.ipv6h; @@ -109,7 +109,7 @@ if (hdr->nexthdr == NEXTHDR_HOP) { skb->h.raw = (u8*)(hdr+1); if (ipv6_parse_hopopts(skb, offsetof(struct ipv6hdr, nexthdr)) < 0) { - IP6_INC_STATS_BH(Ip6InHdrErrors); + IP6_INC_STATS_BH(InHdrErrors); return 0; } hdr = skb->nh.ipv6h; @@ -117,9 +117,9 @@ return NF_HOOK(PF_INET6,NF_IP6_PRE_ROUTING, skb, dev, NULL, ip6_rcv_finish); truncated: - IP6_INC_STATS_BH(Ip6InTruncatedPkts); + IP6_INC_STATS_BH(InTruncatedPkts); err: - IP6_INC_STATS_BH(Ip6InHdrErrors); + IP6_INC_STATS_BH(InHdrErrors); drop: kfree_skb(skb); out: @@ -194,15 +194,15 @@ if (ret > 0) goto resubmit; else if (ret == 0) - IP6_INC_STATS_BH(Ip6InDelivers); + IP6_INC_STATS_BH(InDelivers); } else { if (!raw_sk) { if (xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb)) { - IP6_INC_STATS_BH(Ip6InUnknownProtos); + IP6_INC_STATS_BH(InUnknownProtos); icmpv6_param_prob(skb, ICMPV6_UNK_NEXTHDR, nhoff); } } else { - IP6_INC_STATS_BH(Ip6InDelivers); + IP6_INC_STATS_BH(InDelivers); kfree_skb(skb); } } @@ -210,7 +210,7 @@ return 0; discard: - IP6_INC_STATS_BH(Ip6InDiscards); + IP6_INC_STATS_BH(InDiscards); rcu_read_unlock(); kfree_skb(skb); return 0; @@ -227,7 +227,7 @@ struct ipv6hdr *hdr; int deliver; - IP6_INC_STATS_BH(Ip6InMcastPkts); + IP6_INC_STATS_BH(InMcastPkts); hdr = skb->nh.ipv6h; deliver = likely(!(skb->dev->flags & (IFF_PROMISC|IFF_ALLMULTI))) || diff -urN linux-2.6.7-rc2/net/ipv6/ip6_output.c linux-2.6.7-rc3/net/ipv6/ip6_output.c --- linux-2.6.7-rc2/net/ipv6/ip6_output.c 2004-05-09 19:31:59.000000000 -0700 +++ linux-2.6.7-rc3/net/ipv6/ip6_output.c 2004-06-07 12:55:28.444676018 -0700 @@ -55,7 +55,7 @@ #include #include -static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*)); +static int ip6_fragment(struct sk_buff **pskb, int (*output)(struct sk_buff**)); static __inline__ void ipv6_select_ident(struct sk_buff *skb, struct frag_hdr *fhdr) { @@ -87,7 +87,7 @@ } else if (dst->neighbour) return dst->neighbour->output(skb); - IP6_INC_STATS_BH(Ip6OutNoRoutes); + IP6_INC_STATS_BH(OutNoRoutes); kfree_skb(skb); return -EINVAL; @@ -107,8 +107,9 @@ } -int ip6_output2(struct sk_buff *skb) +int ip6_output2(struct sk_buff **pskb) { + struct sk_buff *skb = *pskb; struct dst_entry *dst = skb->dst; struct net_device *dev = dst->dev; @@ -132,24 +133,26 @@ ip6_dev_loopback_xmit); if (skb->nh.ipv6h->hop_limit == 0) { - IP6_INC_STATS(Ip6OutDiscards); + IP6_INC_STATS(OutDiscards); kfree_skb(skb); return 0; } } - IP6_INC_STATS(Ip6OutMcastPkts); + IP6_INC_STATS(OutMcastPkts); } return NF_HOOK(PF_INET6, NF_IP6_POST_ROUTING, skb,NULL, skb->dev,ip6_output_finish); } -int ip6_output(struct sk_buff *skb) +int ip6_output(struct sk_buff **pskb) { + struct sk_buff *skb = *pskb; + if ((skb->len > dst_pmtu(skb->dst) || skb_shinfo(skb)->frag_list)) - return ip6_fragment(skb, ip6_output2); + return ip6_fragment(pskb, ip6_output2); else - return ip6_output2(skb); + return ip6_output2(pskb); } #ifdef CONFIG_NETFILTER @@ -169,7 +172,7 @@ dst = ip6_route_output(skb->sk, &fl); if (dst->error) { - IP6_INC_STATS(Ip6OutNoRoutes); + IP6_INC_STATS(OutNoRoutes); LIMIT_NETDEBUG( printk(KERN_DEBUG "ip6_route_me_harder: No more route.\n")); dst_release(dst); @@ -228,7 +231,7 @@ kfree_skb(skb); skb = skb2; if (skb == NULL) { - IP6_INC_STATS(Ip6OutDiscards); + IP6_INC_STATS(OutDiscards); return -ENOBUFS; } if (sk) @@ -262,7 +265,7 @@ mtu = dst_pmtu(dst); if ((skb->len <= mtu) || ipfragok) { - IP6_INC_STATS(Ip6OutRequests); + IP6_INC_STATS(OutRequests); return NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, dst->dev, ip6_maybe_reroute); } @@ -270,7 +273,7 @@ printk(KERN_DEBUG "IPv6: sending pkt_too_big to self\n"); skb->dev = dst->dev; icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu, skb->dev); - IP6_INC_STATS(Ip6FragFails); + IP6_INC_STATS(FragFails); kfree_skb(skb); return -EMSGSIZE; } @@ -352,7 +355,7 @@ goto error; if (!xfrm6_policy_check(NULL, XFRM_POLICY_FWD, skb)) { - IP6_INC_STATS(Ip6InDiscards); + IP6_INC_STATS(InDiscards); goto drop; } @@ -391,7 +394,7 @@ } if (!xfrm6_route_forward(skb)) { - IP6_INC_STATS(Ip6InDiscards); + IP6_INC_STATS(InDiscards); goto drop; } @@ -429,14 +432,14 @@ /* Again, force OUTPUT device used as source address */ skb->dev = dst->dev; icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, dst_pmtu(dst), skb->dev); - IP6_INC_STATS_BH(Ip6InTooBigErrors); - IP6_INC_STATS_BH(Ip6FragFails); + IP6_INC_STATS_BH(InTooBigErrors); + IP6_INC_STATS_BH(FragFails); kfree_skb(skb); return -EMSGSIZE; } if (skb_cow(skb, dst->dev->hard_header_len)) { - IP6_INC_STATS(Ip6OutDiscards); + IP6_INC_STATS(OutDiscards); goto drop; } @@ -446,11 +449,11 @@ hdr->hop_limit--; - IP6_INC_STATS_BH(Ip6OutForwDatagrams); + IP6_INC_STATS_BH(OutForwDatagrams); return NF_HOOK(PF_INET6,NF_IP6_FORWARD, skb, skb->dev, dst->dev, ip6_forward_finish); error: - IP6_INC_STATS_BH(Ip6InAddrErrors); + IP6_INC_STATS_BH(InAddrErrors); drop: kfree_skb(skb); return -EINVAL; @@ -513,11 +516,11 @@ return offset; } -static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*)) +static int ip6_fragment(struct sk_buff **pskb, int (*output)(struct sk_buff**)) { struct net_device *dev; + struct sk_buff *frag, *skb = *pskb; struct rt6_info *rt = (struct rt6_info*)skb->dst; - struct sk_buff *frag; struct ipv6hdr *tmp_hdr; struct frag_hdr *fh; unsigned int mtu, hlen, left, len; @@ -563,7 +566,7 @@ tmp_hdr = kmalloc(hlen, GFP_ATOMIC); if (!tmp_hdr) { - IP6_INC_STATS(Ip6FragFails); + IP6_INC_STATS(FragFails); return -ENOMEM; } @@ -604,11 +607,13 @@ frag->nh.ipv6h->payload_len = htons(frag->len - sizeof(struct ipv6hdr)); ip6_copy_metadata(frag, skb); } - err = output(skb); - - if (err || !frag) + err = output(pskb); + if (err || !frag) { + if (unlikely(skb != *pskb)) + skb = *pskb; break; - + } + skb = frag; frag = skb->next; skb->next = NULL; @@ -618,7 +623,7 @@ kfree(tmp_hdr); if (err == 0) { - IP6_INC_STATS(Ip6FragOKs); + IP6_INC_STATS(FragOKs); return 0; } @@ -628,7 +633,7 @@ frag = skb; } - IP6_INC_STATS(Ip6FragFails); + IP6_INC_STATS(FragFails); return err; } @@ -661,7 +666,7 @@ if ((frag = alloc_skb(len+hlen+sizeof(struct frag_hdr)+LL_RESERVED_SPACE(rt->u.dst.dev), GFP_ATOMIC)) == NULL) { NETDEBUG(printk(KERN_INFO "IPv6: frag: no memory for new fragment!\n")); - IP6_INC_STATS(Ip6FragFails); + IP6_INC_STATS(FragFails); err = -ENOMEM; goto fail; } @@ -719,19 +724,19 @@ * Put this fragment into the sending queue. */ - IP6_INC_STATS(Ip6FragCreates); + IP6_INC_STATS(FragCreates); - err = output(frag); + err = output(&frag); if (err) goto fail; } kfree_skb(skb); - IP6_INC_STATS(Ip6FragOKs); + IP6_INC_STATS(FragOKs); return err; fail: kfree_skb(skb); - IP6_INC_STATS(Ip6FragFails); + IP6_INC_STATS(FragFails); return err; } @@ -1016,7 +1021,7 @@ return 0; error: inet->cork.length -= length; - IP6_INC_STATS(Ip6OutDiscards); + IP6_INC_STATS(OutDiscards); return err; } @@ -1076,7 +1081,7 @@ ipv6_addr_copy(&hdr->daddr, final_dst); skb->dst = dst_clone(&rt->u.dst); - IP6_INC_STATS(Ip6OutRequests); + IP6_INC_STATS(OutRequests); err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, skb->dst->dev, dst_output); if (err) { if (err > 0) @@ -1108,7 +1113,7 @@ struct sk_buff *skb; while ((skb = __skb_dequeue_tail(&sk->sk_write_queue)) != NULL) { - IP6_INC_STATS(Ip6OutDiscards); + IP6_INC_STATS(OutDiscards); kfree_skb(skb); } diff -urN linux-2.6.7-rc2/net/ipv6/ipcomp6.c linux-2.6.7-rc3/net/ipv6/ipcomp6.c --- linux-2.6.7-rc2/net/ipv6/ipcomp6.c 2004-05-09 19:32:37.000000000 -0700 +++ linux-2.6.7-rc3/net/ipv6/ipcomp6.c 2004-06-07 12:55:28.445676060 -0700 @@ -118,10 +118,10 @@ return err; } -static int ipcomp6_output(struct sk_buff *skb) +static int ipcomp6_output(struct sk_buff **pskb) { int err; - struct dst_entry *dst = skb->dst; + struct dst_entry *dst = (*pskb)->dst; struct xfrm_state *x = dst->xfrm; struct ipv6hdr *tmp_iph = NULL, *iph, *top_iph; int hdr_len = 0; @@ -132,54 +132,55 @@ int plen, dlen; u8 *start, *scratch = ipcd->scratch; - if (skb->ip_summed == CHECKSUM_HW && skb_checksum_help(skb) == NULL) { - err = -EINVAL; - goto error_nolock; + if ((*pskb)->ip_summed == CHECKSUM_HW) { + err = skb_checksum_help(pskb, 0); + if (err) + goto error_nolock; } spin_lock_bh(&x->lock); - err = xfrm_check_output(x, skb, AF_INET6); + err = xfrm_check_output(x, *pskb, AF_INET6); if (err) goto error; if (x->props.mode) { hdr_len = sizeof(struct ipv6hdr); nexthdr = IPPROTO_IPV6; - iph = skb->nh.ipv6h; - top_iph = (struct ipv6hdr *)skb_push(skb, sizeof(struct ipv6hdr)); + iph = (*pskb)->nh.ipv6h; + top_iph = (struct ipv6hdr *)skb_push(*pskb, sizeof(struct ipv6hdr)); top_iph->version = 6; top_iph->priority = iph->priority; top_iph->flow_lbl[0] = iph->flow_lbl[0]; top_iph->flow_lbl[1] = iph->flow_lbl[1]; top_iph->flow_lbl[2] = iph->flow_lbl[2]; top_iph->nexthdr = IPPROTO_IPV6; /* initial */ - top_iph->payload_len = htons(skb->len - sizeof(struct ipv6hdr)); + top_iph->payload_len = htons((*pskb)->len - sizeof(struct ipv6hdr)); top_iph->hop_limit = iph->hop_limit; memcpy(&top_iph->saddr, (struct in6_addr *)&x->props.saddr, sizeof(struct in6_addr)); memcpy(&top_iph->daddr, (struct in6_addr *)&x->id.daddr, sizeof(struct in6_addr)); - skb->nh.raw = skb->data; /* == top_iph */ - skb->h.raw = skb->nh.raw + hdr_len; + (*pskb)->nh.raw = (*pskb)->data; /* == top_iph */ + (*pskb)->h.raw = (*pskb)->nh.raw + hdr_len; } else { - hdr_len = ip6_find_1stfragopt(skb, &prevhdr); + hdr_len = ip6_find_1stfragopt(*pskb, &prevhdr); nexthdr = *prevhdr; } /* check whether datagram len is larger than threshold */ - if ((skb->len - hdr_len) < ipcd->threshold) { + if (((*pskb)->len - hdr_len) < ipcd->threshold) { goto out_ok; } - if ((skb_is_nonlinear(skb) || skb_cloned(skb)) && - skb_linearize(skb, GFP_ATOMIC) != 0) { + if ((skb_is_nonlinear(*pskb) || skb_cloned(*pskb)) && + skb_linearize(*pskb, GFP_ATOMIC) != 0) { err = -ENOMEM; goto error; } /* compression */ - plen = skb->len - hdr_len; + plen = (*pskb)->len - hdr_len; dlen = IPCOMP_SCRATCH_SIZE; - start = skb->data + hdr_len; + start = (*pskb)->data + hdr_len; err = crypto_comp_compress(ipcd->tfm, start, plen, scratch, &dlen); if (err) { @@ -189,7 +190,7 @@ goto out_ok; } memcpy(start, scratch, dlen); - pskb_trim(skb, hdr_len+dlen); + pskb_trim(*pskb, hdr_len+dlen); /* insert ipcomp header and replace datagram */ tmp_iph = kmalloc(hdr_len, GFP_ATOMIC); @@ -197,16 +198,16 @@ err = -ENOMEM; goto error; } - memcpy(tmp_iph, skb->nh.raw, hdr_len); - top_iph = (struct ipv6hdr*)skb_push(skb, sizeof(struct ipv6_comp_hdr)); + memcpy(tmp_iph, (*pskb)->nh.raw, hdr_len); + top_iph = (struct ipv6hdr*)skb_push(*pskb, sizeof(struct ipv6_comp_hdr)); memcpy(top_iph, tmp_iph, hdr_len); kfree(tmp_iph); if (x->props.mode && (x->props.flags & XFRM_STATE_NOECN)) IP6_ECN_clear(top_iph); - top_iph->payload_len = htons(skb->len - sizeof(struct ipv6hdr)); - skb->nh.raw = skb->data; /* top_iph */ - ip6_find_1stfragopt(skb, &prevhdr); + top_iph->payload_len = htons((*pskb)->len - sizeof(struct ipv6hdr)); + (*pskb)->nh.raw = (*pskb)->data; /* top_iph */ + ip6_find_1stfragopt(*pskb, &prevhdr); *prevhdr = IPPROTO_COMP; ipch = (struct ipv6_comp_hdr *)((unsigned char *)top_iph + hdr_len); @@ -214,13 +215,13 @@ ipch->flags = 0; ipch->cpi = htons((u16 )ntohl(x->id.spi)); - skb->h.raw = (unsigned char*)ipch; + (*pskb)->h.raw = (unsigned char*)ipch; out_ok: - x->curlft.bytes += skb->len; + x->curlft.bytes += (*pskb)->len; x->curlft.packets++; spin_unlock_bh(&x->lock); - if ((skb->dst = dst_pop(dst)) == NULL) { + if (((*pskb)->dst = dst_pop(dst)) == NULL) { err = -EHOSTUNREACH; goto error_nolock; } @@ -231,7 +232,7 @@ error: spin_unlock_bh(&x->lock); error_nolock: - kfree_skb(skb); + kfree_skb(*pskb); goto out_exit; } diff -urN linux-2.6.7-rc2/net/ipv6/ipv6_sockglue.c linux-2.6.7-rc3/net/ipv6/ipv6_sockglue.c --- linux-2.6.7-rc2/net/ipv6/ipv6_sockglue.c 2004-06-07 12:54:53.630234044 -0700 +++ linux-2.6.7-rc3/net/ipv6/ipv6_sockglue.c 2004-06-07 12:55:28.446676101 -0700 @@ -55,7 +55,7 @@ #include -DEFINE_SNMP_STAT(struct ipv6_mib, ipv6_statistics); +DEFINE_SNMP_STAT(struct ipstats_mib, ipv6_statistics); static struct packet_type ipv6_packet_type = { .type = __constant_htons(ETH_P_IPV6), diff -urN linux-2.6.7-rc2/net/ipv6/mcast.c linux-2.6.7-rc3/net/ipv6/mcast.c --- linux-2.6.7-rc2/net/ipv6/mcast.c 2004-06-07 12:54:53.644234624 -0700 +++ linux-2.6.7-rc3/net/ipv6/mcast.c 2004-06-07 12:55:28.457676557 -0700 @@ -1317,7 +1317,7 @@ struct inet6_dev *idev = in6_dev_get(skb->dev); int err; - IP6_INC_STATS(Ip6OutRequests); + IP6_INC_STATS(OutRequests); payload_len = skb->tail - (unsigned char *)skb->nh.ipv6h - sizeof(struct ipv6hdr); mldlen = skb->tail - skb->h.raw; @@ -1329,9 +1329,9 @@ dev_queue_xmit); if (!err) { ICMP6_INC_STATS(idev,Icmp6OutMsgs); - IP6_INC_STATS(Ip6OutMcastPkts); + IP6_INC_STATS(OutMcastPkts); } else - IP6_INC_STATS(Ip6OutDiscards); + IP6_INC_STATS(OutDiscards); if (likely(idev != NULL)) in6_dev_put(idev); @@ -1613,7 +1613,7 @@ IPV6_TLV_ROUTERALERT, 2, 0, 0, IPV6_TLV_PADN, 0 }; - IP6_INC_STATS(Ip6OutRequests); + IP6_INC_STATS(OutRequests); snd_addr = addr; if (type == ICMPV6_MGM_REDUCTION) { snd_addr = &all_routers; @@ -1627,7 +1627,7 @@ skb = sock_alloc_send_skb(sk, LL_RESERVED_SPACE(dev) + full_len, 1, &err); if (skb == NULL) { - IP6_INC_STATS(Ip6OutDiscards); + IP6_INC_STATS(OutDiscards); return; } @@ -1672,16 +1672,16 @@ else ICMP6_INC_STATS(idev, Icmp6OutGroupMembResponses); ICMP6_INC_STATS(idev, Icmp6OutMsgs); - IP6_INC_STATS(Ip6OutMcastPkts); + IP6_INC_STATS(OutMcastPkts); } else - IP6_INC_STATS(Ip6OutDiscards); + IP6_INC_STATS(OutDiscards); if (likely(idev != NULL)) in6_dev_put(idev); return; out: - IP6_INC_STATS(Ip6OutDiscards); + IP6_INC_STATS(OutDiscards); kfree_skb(skb); } diff -urN linux-2.6.7-rc2/net/ipv6/ndisc.c linux-2.6.7-rc3/net/ipv6/ndisc.c --- linux-2.6.7-rc2/net/ipv6/ndisc.c 2004-05-09 19:32:39.000000000 -0700 +++ linux-2.6.7-rc3/net/ipv6/ndisc.c 2004-06-07 12:55:28.468677012 -0700 @@ -452,7 +452,7 @@ skb->dst = dst; idev = in6_dev_get(dst->dev); - IP6_INC_STATS(Ip6OutRequests); + IP6_INC_STATS(OutRequests); err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, dst->dev, dst_output); if (!err) { ICMP6_INC_STATS(idev, Icmp6OutNeighborAdvertisements); @@ -536,7 +536,7 @@ /* send it! */ skb->dst = dst; idev = in6_dev_get(dst->dev); - IP6_INC_STATS(Ip6OutRequests); + IP6_INC_STATS(OutRequests); err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, dst->dev, dst_output); if (!err) { ICMP6_INC_STATS(idev, Icmp6OutNeighborSolicits); @@ -609,7 +609,7 @@ /* send it! */ skb->dst = dst; idev = in6_dev_get(dst->dev); - IP6_INC_STATS(Ip6OutRequests); + IP6_INC_STATS(OutRequests); err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, dst->dev, dst_output); if (!err) { ICMP6_INC_STATS(idev, Icmp6OutRouterSolicits); @@ -1335,7 +1335,7 @@ buff->dst = dst; idev = in6_dev_get(dst->dev); - IP6_INC_STATS(Ip6OutRequests); + IP6_INC_STATS(OutRequests); err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, buff, NULL, dst->dev, dst_output); if (!err) { ICMP6_INC_STATS(idev, Icmp6OutRedirects); diff -urN linux-2.6.7-rc2/net/ipv6/netfilter/ip6_tables.c linux-2.6.7-rc3/net/ipv6/netfilter/ip6_tables.c --- linux-2.6.7-rc2/net/ipv6/netfilter/ip6_tables.c 2004-06-07 12:54:53.646234707 -0700 +++ linux-2.6.7-rc3/net/ipv6/netfilter/ip6_tables.c 2004-06-07 12:55:28.471677137 -0700 @@ -66,8 +66,6 @@ #endif #define SMP_ALIGN(x) (((x) + SMP_CACHE_BYTES-1) & ~(SMP_CACHE_BYTES-1)) -/* Mutex protects lists (only traversed in user context). */ -static DECLARE_MUTEX(ip6t_mutex); /* Must have mutex */ #define ASSERT_READ_LOCK(x) IP_NF_ASSERT(down_trylock(&ip6t_mutex) != 0) @@ -544,7 +542,7 @@ #endif static inline struct ip6t_table * -find_table_lock(const char *name, int *error, struct semaphore *mutex) +ip6t_find_table_lock(const char *name, int *error, struct semaphore *mutex) { return find_inlist_lock(&ip6t_tables, name, "ip6table_", error, mutex); } @@ -555,8 +553,8 @@ return find_inlist_lock(&ip6t_match, name, "ip6t_", error, mutex); } -static inline struct ip6t_target * -find_target_lock(const char *name, int *error, struct semaphore *mutex) +struct ip6t_target * +ip6t_find_target_lock(const char *name, int *error, struct semaphore *mutex) { return find_inlist_lock(&ip6t_target, name, "ip6t_", error, mutex); } @@ -771,7 +769,7 @@ goto cleanup_matches; t = ip6t_get_target(e); - target = find_target_lock(t->u.user.name, &ret, &ip6t_mutex); + target = ip6t_find_target_lock(t->u.user.name, &ret, &ip6t_mutex); if (!target) { duprintf("check_entry: `%s' not found\n", t->u.user.name); goto cleanup_matches; @@ -1028,7 +1026,7 @@ static int copy_entries_to_user(unsigned int total_size, struct ip6t_table *table, - void *userptr) + void __user *userptr) { unsigned int off, num, countersize; struct ip6t_entry *e; @@ -1111,7 +1109,7 @@ int ret; struct ip6t_table *t; - t = find_table_lock(entries->name, &ret, &ip6t_mutex); + t = ip6t_find_table_lock(entries->name, &ret, &ip6t_mutex); if (t) { duprintf("t->private->number = %u\n", t->private->number); @@ -1174,7 +1172,7 @@ duprintf("ip_tables: Translated table\n"); - t = find_table_lock(tmp.name, &ret, &ip6t_mutex); + t = ip6t_find_table_lock(tmp.name, &ret, &ip6t_mutex); if (!t) goto free_newinfo_counters_untrans; @@ -1276,7 +1274,7 @@ goto free; } - t = find_table_lock(tmp.name, &ret, &ip6t_mutex); + t = ip6t_find_table_lock(tmp.name, &ret, &ip6t_mutex); if (!t) goto free; @@ -1351,7 +1349,7 @@ break; } name[IP6T_TABLE_MAXNAMELEN-1] = '\0'; - t = find_table_lock(name, &ret, &ip6t_mutex); + t = ip6t_find_table_lock(name, &ret, &ip6t_mutex); if (t) { struct ip6t_getinfo info; @@ -1964,6 +1962,7 @@ EXPORT_SYMBOL(ip6t_register_table); EXPORT_SYMBOL(ip6t_unregister_table); EXPORT_SYMBOL(ip6t_do_table); +EXPORT_SYMBOL(ip6t_find_target_lock); EXPORT_SYMBOL(ip6t_register_match); EXPORT_SYMBOL(ip6t_unregister_match); EXPORT_SYMBOL(ip6t_register_target); diff -urN linux-2.6.7-rc2/net/ipv6/proc.c linux-2.6.7-rc3/net/ipv6/proc.c --- linux-2.6.7-rc2/net/ipv6/proc.c 2004-05-09 19:32:28.000000000 -0700 +++ linux-2.6.7-rc3/net/ipv6/proc.c 2004-06-07 12:55:28.472677178 -0700 @@ -57,43 +57,36 @@ return 0; } -struct snmp6_item -{ - char *name; - int offset; -}; -#define SNMP6_SENTINEL { .name = NULL, .offset = 0 } - -static struct snmp6_item snmp6_ipv6_list[] = { +static struct snmp_item snmp6_ipstats_list[] = { /* ipv6 mib according to RFC 2465 */ -#define SNMP6_GEN(x) { .name = #x , .offset = offsetof(struct ipv6_mib, x) } - SNMP6_GEN(Ip6InReceives), - SNMP6_GEN(Ip6InHdrErrors), - SNMP6_GEN(Ip6InTooBigErrors), - SNMP6_GEN(Ip6InNoRoutes), - SNMP6_GEN(Ip6InAddrErrors), - SNMP6_GEN(Ip6InUnknownProtos), - SNMP6_GEN(Ip6InTruncatedPkts), - SNMP6_GEN(Ip6InDiscards), - SNMP6_GEN(Ip6InDelivers), - SNMP6_GEN(Ip6OutForwDatagrams), - SNMP6_GEN(Ip6OutRequests), - SNMP6_GEN(Ip6OutDiscards), - SNMP6_GEN(Ip6OutNoRoutes), - SNMP6_GEN(Ip6ReasmTimeout), - SNMP6_GEN(Ip6ReasmReqds), - SNMP6_GEN(Ip6ReasmOKs), - SNMP6_GEN(Ip6ReasmFails), - SNMP6_GEN(Ip6FragOKs), - SNMP6_GEN(Ip6FragFails), - SNMP6_GEN(Ip6FragCreates), - SNMP6_GEN(Ip6InMcastPkts), - SNMP6_GEN(Ip6OutMcastPkts), +#define SNMP6_GEN(x) SNMP_ITEM(struct ipstats_mib, x, "Ip6" #x) + SNMP6_GEN(InReceives), + SNMP6_GEN(InHdrErrors), + SNMP6_GEN(InTooBigErrors), + SNMP6_GEN(InNoRoutes), + SNMP6_GEN(InAddrErrors), + SNMP6_GEN(InUnknownProtos), + SNMP6_GEN(InTruncatedPkts), + SNMP6_GEN(InDiscards), + SNMP6_GEN(InDelivers), + SNMP6_GEN(OutForwDatagrams), + SNMP6_GEN(OutRequests), + SNMP6_GEN(OutDiscards), + SNMP6_GEN(OutNoRoutes), + SNMP6_GEN(ReasmTimeout), + SNMP6_GEN(ReasmReqds), + SNMP6_GEN(ReasmOKs), + SNMP6_GEN(ReasmFails), + SNMP6_GEN(FragOKs), + SNMP6_GEN(FragFails), + SNMP6_GEN(FragCreates), + SNMP6_GEN(InMcastPkts), + SNMP6_GEN(OutMcastPkts), #undef SNMP6_GEN - SNMP6_SENTINEL + SNMP_ITEM_SENTINEL }; -static struct snmp6_item snmp6_icmp6_list[] = { +static struct snmp_item snmp6_icmp6_list[] = { /* icmpv6 mib according to RFC 2466 Exceptions: {In|Out}AdminProhibs are removed, because I see @@ -104,7 +97,7 @@ OutRouterAdvertisements too. OutGroupMembQueries too. */ -#define SNMP6_GEN(x) { .name = #x , .offset = offsetof(struct icmpv6_mib, x) } +#define SNMP6_GEN(x) SNMP_ITEM(struct icmpv6_mib, x, #x) SNMP6_GEN(Icmp6InMsgs), SNMP6_GEN(Icmp6InErrors), SNMP6_GEN(Icmp6InDestUnreachs), @@ -134,17 +127,17 @@ SNMP6_GEN(Icmp6OutGroupMembResponses), SNMP6_GEN(Icmp6OutGroupMembReductions), #undef SNMP6_GEN - SNMP6_SENTINEL + SNMP_ITEM_SENTINEL }; -static struct snmp6_item snmp6_udp6_list[] = { -#define SNMP6_GEN(x) { .name = "Udp6" #x , .offset = offsetof(struct udp_mib, Udp##x) } +static struct snmp_item snmp6_udp6_list[] = { +#define SNMP6_GEN(x) SNMP_ITEM(struct udp_mib, Udp##x, "Udp6" #x) SNMP6_GEN(InDatagrams), SNMP6_GEN(NoPorts), SNMP6_GEN(InErrors), SNMP6_GEN(OutDatagrams), #undef SNMP6_GEN - SNMP6_SENTINEL + SNMP_ITEM_SENTINEL }; static unsigned long @@ -167,7 +160,7 @@ } static inline void -snmp6_seq_show_item(struct seq_file *seq, void **mib, struct snmp6_item *itemlist) +snmp6_seq_show_item(struct seq_file *seq, void **mib, struct snmp_item *itemlist) { int i; for (i=0; itemlist[i].name; i++) @@ -183,7 +176,7 @@ seq_printf(seq, "%-32s\t%u\n", "ifIndex", idev->dev->ifindex); snmp6_seq_show_item(seq, (void **)idev->stats.icmpv6, snmp6_icmp6_list); } else { - snmp6_seq_show_item(seq, (void **)ipv6_statistics, snmp6_ipv6_list); + snmp6_seq_show_item(seq, (void **)ipv6_statistics, snmp6_ipstats_list); snmp6_seq_show_item(seq, (void **)icmpv6_statistics, snmp6_icmp6_list); snmp6_seq_show_item(seq, (void **)udp_stats_in6, snmp6_udp6_list); } diff -urN linux-2.6.7-rc2/net/ipv6/raw.c linux-2.6.7-rc3/net/ipv6/raw.c --- linux-2.6.7-rc2/net/ipv6/raw.c 2004-06-07 12:54:53.648234790 -0700 +++ linux-2.6.7-rc3/net/ipv6/raw.c 2004-06-07 12:55:28.473677219 -0700 @@ -535,7 +535,7 @@ if (err) goto error_fault; - IP6_INC_STATS(Ip6OutRequests); + IP6_INC_STATS(OutRequests); err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, rt->u.dst.dev, dst_output); if (err > 0) @@ -549,7 +549,7 @@ err = -EFAULT; kfree_skb(skb); error: - IP6_INC_STATS(Ip6OutDiscards); + IP6_INC_STATS(OutDiscards); return err; } static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk, @@ -875,7 +875,7 @@ case SIOCOUTQ: { int amount = atomic_read(&sk->sk_wmem_alloc); - return put_user(amount, (int *)arg); + return put_user(amount, (int __user *)arg); } case SIOCINQ: { @@ -887,7 +887,7 @@ if (skb != NULL) amount = skb->tail - skb->h.raw; spin_unlock_irq(&sk->sk_receive_queue.lock); - return put_user(amount, (int *)arg); + return put_user(amount, (int __user *)arg); } default: diff -urN linux-2.6.7-rc2/net/ipv6/reassembly.c linux-2.6.7-rc3/net/ipv6/reassembly.c --- linux-2.6.7-rc2/net/ipv6/reassembly.c 2004-05-09 19:32:27.000000000 -0700 +++ linux-2.6.7-rc3/net/ipv6/reassembly.c 2004-06-07 12:55:28.474677261 -0700 @@ -284,7 +284,7 @@ spin_unlock(&fq->lock); fq_put(fq); - IP6_INC_STATS_BH(Ip6ReasmFails); + IP6_INC_STATS_BH(ReasmFails); } } @@ -299,8 +299,8 @@ fq_kill(fq); - IP6_INC_STATS_BH(Ip6ReasmTimeout); - IP6_INC_STATS_BH(Ip6ReasmFails); + IP6_INC_STATS_BH(ReasmTimeout); + IP6_INC_STATS_BH(ReasmFails); /* Send error only if the first segment arrived. */ if (fq->last_in&FIRST_IN && fq->fragments) { @@ -386,7 +386,7 @@ return ip6_frag_intern(hash, fq); oom: - IP6_INC_STATS_BH(Ip6ReasmFails); + IP6_INC_STATS_BH(ReasmFails); return NULL; } @@ -426,7 +426,7 @@ ((u8 *) (fhdr + 1) - (u8 *) (skb->nh.ipv6h + 1))); if ((unsigned int)end > IPV6_MAXPLEN) { - IP6_INC_STATS_BH(Ip6InHdrErrors); + IP6_INC_STATS_BH(InHdrErrors); icmpv6_param_prob(skb,ICMPV6_HDR_FIELD, (u8*)&fhdr->frag_off - skb->nh.raw); return; } @@ -453,7 +453,7 @@ /* RFC2460 says always send parameter problem in * this case. -DaveM */ - IP6_INC_STATS_BH(Ip6InHdrErrors); + IP6_INC_STATS_BH(InHdrErrors); icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, offsetof(struct ipv6hdr, payload_len)); return; @@ -572,7 +572,7 @@ return; err: - IP6_INC_STATS(Ip6ReasmFails); + IP6_INC_STATS(ReasmFails); kfree_skb(skb); } @@ -666,7 +666,7 @@ if (head->ip_summed == CHECKSUM_HW) head->csum = csum_partial(head->nh.raw, head->h.raw-head->nh.raw, head->csum); - IP6_INC_STATS_BH(Ip6ReasmOKs); + IP6_INC_STATS_BH(ReasmOKs); fq->fragments = NULL; *nhoffp = nhoff; return 1; @@ -679,7 +679,7 @@ if (net_ratelimit()) printk(KERN_DEBUG "ip6_frag_reasm: no memory for reassembly\n"); out_fail: - IP6_INC_STATS_BH(Ip6ReasmFails); + IP6_INC_STATS_BH(ReasmFails); return -1; } @@ -693,16 +693,16 @@ hdr = skb->nh.ipv6h; - IP6_INC_STATS_BH(Ip6ReasmReqds); + IP6_INC_STATS_BH(ReasmReqds); /* Jumbo payload inhibits frag. header */ if (hdr->payload_len==0) { - IP6_INC_STATS(Ip6InHdrErrors); + IP6_INC_STATS(InHdrErrors); icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, skb->h.raw-skb->nh.raw); return -1; } if (!pskb_may_pull(skb, (skb->h.raw-skb->data)+sizeof(struct frag_hdr))) { - IP6_INC_STATS(Ip6InHdrErrors); + IP6_INC_STATS(InHdrErrors); icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, skb->h.raw-skb->nh.raw); return -1; } @@ -713,7 +713,7 @@ if (!(fhdr->frag_off & htons(0xFFF9))) { /* It is not a fragmented frame */ skb->h.raw += sizeof(struct frag_hdr); - IP6_INC_STATS_BH(Ip6ReasmOKs); + IP6_INC_STATS_BH(ReasmOKs); *nhoffp = (u8*)fhdr - skb->nh.raw; return 1; @@ -738,7 +738,7 @@ return ret; } - IP6_INC_STATS_BH(Ip6ReasmFails); + IP6_INC_STATS_BH(ReasmFails); kfree_skb(skb); return -1; } diff -urN linux-2.6.7-rc2/net/ipv6/route.c linux-2.6.7-rc3/net/ipv6/route.c --- linux-2.6.7-rc2/net/ipv6/route.c 2004-06-07 12:54:53.649234831 -0700 +++ linux-2.6.7-rc3/net/ipv6/route.c 2004-06-07 12:55:28.475677302 -0700 @@ -83,9 +83,11 @@ static struct rt6_info * ip6_rt_copy(struct rt6_info *ort); static struct dst_entry *ip6_dst_check(struct dst_entry *dst, u32 cookie); static struct dst_entry *ip6_negative_advice(struct dst_entry *); +static void ip6_dst_destroy(struct dst_entry *); static int ip6_dst_gc(void); static int ip6_pkt_discard(struct sk_buff *skb); +static int ip6_pkt_discard_out(struct sk_buff **pskb); static void ip6_link_failure(struct sk_buff *skb); static void ip6_rt_update_pmtu(struct dst_entry *dst, u32 mtu); @@ -95,6 +97,7 @@ .gc = ip6_dst_gc, .gc_thresh = 1024, .check = ip6_dst_check, + .destroy = ip6_dst_destroy, .negative_advice = ip6_negative_advice, .link_failure = ip6_link_failure, .update_pmtu = ip6_rt_update_pmtu, @@ -111,7 +114,7 @@ .error = -ENETUNREACH, .metrics = { [RTAX_HOPLIMIT - 1] = 255, }, .input = ip6_pkt_discard, - .output = ip6_pkt_discard, + .output = ip6_pkt_discard_out, .ops = &ip6_dst_ops, .path = (struct dst_entry*)&ip6_null_entry, } @@ -134,7 +137,15 @@ /* allocate dst with ip6_dst_ops */ static __inline__ struct rt6_info *ip6_dst_alloc(void) { - return dst_alloc(&ip6_dst_ops); + return (struct rt6_info *)dst_alloc(&ip6_dst_ops); +} + +static void ip6_dst_destroy(struct dst_entry *dst) +{ + struct rt6_info *rt = (struct rt6_info *)dst; + if (rt->rt6i_idev != NULL) + in6_dev_put(rt->rt6i_idev); + } /* @@ -566,21 +577,21 @@ struct dst_entry *ndisc_dst_alloc(struct net_device *dev, struct neighbour *neigh, struct in6_addr *addr, - int (*output)(struct sk_buff *)) + int (*output)(struct sk_buff **)) { struct rt6_info *rt = ip6_dst_alloc(); if (unlikely(rt == NULL)) goto out; - if (dev) - dev_hold(dev); + dev_hold(dev); if (neigh) neigh_hold(neigh); else neigh = ndisc_get_neigh(dev, addr); rt->rt6i_dev = dev; + rt->rt6i_idev = in6_dev_get(dev); rt->rt6i_nexthop = neigh; rt->rt6i_expires = 0; rt->rt6i_flags = RTF_LOCAL; @@ -714,6 +725,12 @@ if (rtmsg->rtmsg_src_len) return -EINVAL; #endif + if (rtmsg->rtmsg_ifindex) { + dev = dev_get_by_index(rtmsg->rtmsg_ifindex); + if (!dev) + return -ENODEV; + } + if (rtmsg->rtmsg_metric == 0) rtmsg->rtmsg_metric = IP6_RT_PRIO_USER; @@ -739,13 +756,6 @@ rt->u.dst.output = ip6_output; - if (rtmsg->rtmsg_ifindex) { - dev = dev_get_by_index(rtmsg->rtmsg_ifindex); - err = -ENODEV; - if (dev == NULL) - goto out; - } - ipv6_addr_prefix(&rt->rt6i_dst.addr, &rtmsg->rtmsg_dst, rtmsg->rtmsg_dst_len); rt->rt6i_dst.plen = rtmsg->rtmsg_dst_len; @@ -769,7 +779,7 @@ dev_put(dev); dev = &loopback_dev; dev_hold(dev); - rt->u.dst.output = ip6_pkt_discard; + rt->u.dst.output = ip6_pkt_discard_out; rt->u.dst.input = ip6_pkt_discard; rt->u.dst.error = -ENETUNREACH; rt->rt6i_flags = RTF_REJECT|RTF_NONEXTHOP; @@ -872,6 +882,7 @@ if (!rt->u.dst.metrics[RTAX_ADVMSS-1]) rt->u.dst.metrics[RTAX_ADVMSS-1] = ipv6_advmss(dst_pmtu(&rt->u.dst)); rt->u.dst.dev = dev; + rt->rt6i_idev = in6_dev_get(dev); return rt6_ins(rt, nlh, _rtattr); out: @@ -1138,6 +1149,9 @@ rt->u.dst.dev = ort->u.dst.dev; if (rt->u.dst.dev) dev_hold(rt->u.dst.dev); + rt->rt6i_idev = ort->rt6i_idev; + if (rt->rt6i_idev) + in6_dev_hold(rt->rt6i_idev); rt->u.dst.lastuse = jiffies; rt->rt6i_expires = 0; @@ -1219,7 +1233,7 @@ read_unlock_bh(&rt6_lock); } -int ipv6_route_ioctl(unsigned int cmd, void *arg) +int ipv6_route_ioctl(unsigned int cmd, void __user *arg) { struct in6_rtmsg rtmsg; int err; @@ -1259,12 +1273,17 @@ int ip6_pkt_discard(struct sk_buff *skb) { - IP6_INC_STATS(Ip6OutNoRoutes); + IP6_INC_STATS(OutNoRoutes); icmpv6_send(skb, ICMPV6_DEST_UNREACH, ICMPV6_NOROUTE, 0, skb->dev); kfree_skb(skb); return 0; } +int ip6_pkt_discard_out(struct sk_buff **pskb) +{ + return ip6_pkt_discard(*pskb); +} + /* * Add address */ @@ -1282,6 +1301,7 @@ rt->u.dst.input = ip6_input; rt->u.dst.output = ip6_output; rt->rt6i_dev = &loopback_dev; + rt->rt6i_idev = in6_dev_get(&loopback_dev); rt->u.dst.metrics[RTAX_MTU-1] = ipv6_get_mtu(rt->rt6i_dev); rt->u.dst.metrics[RTAX_ADVMSS-1] = ipv6_advmss(dst_pmtu(&rt->u.dst)); rt->u.dst.metrics[RTAX_HOPLIMIT-1] = ipv6_get_hoplimit(rt->rt6i_dev); @@ -1886,7 +1906,7 @@ static int ipv6_sysctl_rtcache_flush(ctl_table *ctl, int write, struct file * filp, - void *buffer, size_t *lenp) + void __user *buffer, size_t *lenp) { if (write) { proc_dointvec(ctl, write, filp, buffer, lenp); diff -urN linux-2.6.7-rc2/net/ipx/af_ipx.c linux-2.6.7-rc3/net/ipx/af_ipx.c --- linux-2.6.7-rc2/net/ipx/af_ipx.c 2004-06-07 12:54:53.656235121 -0700 +++ linux-2.6.7-rc3/net/ipx/af_ipx.c 2004-06-07 12:55:28.531679622 -0700 @@ -90,7 +90,7 @@ struct iovec *iov, int len, int noblock); extern int ipxrtr_route_skb(struct sk_buff *skb); extern struct ipx_route *ipxrtr_lookup(__u32 net); -extern int ipxrtr_ioctl(unsigned int cmd, void *arg); +extern int ipxrtr_ioctl(unsigned int cmd, void __user *arg); #undef IPX_REFCNT_DEBUG #ifdef IPX_REFCNT_DEBUG @@ -114,7 +114,7 @@ ipx_primary_net = ipx_interfaces_head(); } -static int ipxcfg_get_config_data(struct ipx_config_data *arg) +static int ipxcfg_get_config_data(struct ipx_config_data __user *arg) { struct ipx_config_data vals; @@ -1141,7 +1141,7 @@ return intrfc; } -static int ipxitf_ioctl(unsigned int cmd, void *arg) +static int ipxitf_ioctl(unsigned int cmd, void __user *arg) { int rc = -EINVAL; struct ifreq ifr; @@ -1204,14 +1204,14 @@ } case SIOCAIPXITFCRT: rc = -EFAULT; - if (get_user(val, (unsigned char *) arg)) + if (get_user(val, (unsigned char __user *) arg)) break; rc = 0; ipxcfg_auto_create_interfaces = val; break; case SIOCAIPXPRISLT: rc = -EFAULT; - if (get_user(val, (unsigned char *) arg)) + if (get_user(val, (unsigned char __user *) arg)) break; rc = 0; ipxcfg_set_auto_select(val); @@ -1695,7 +1695,7 @@ /* Socket gets bound below anyway */ /* if (sk->sk_zapped) return -EIO; */ /* Socket not bound */ - if (flags & ~MSG_DONTWAIT) + if (flags & ~(MSG_DONTWAIT|MSG_CMSG_COMPAT)) goto out; /* Max possible packet size limited by 16 bit pktsize in header */ @@ -1823,13 +1823,14 @@ int rc = 0; long amount = 0; struct sock *sk = sock->sk; + void __user *argp = (void __user *)arg; switch (cmd) { case TIOCOUTQ: amount = sk->sk_sndbuf - atomic_read(&sk->sk_wmem_alloc); if (amount < 0) amount = 0; - rc = put_user(amount, (int *)arg); + rc = put_user(amount, (int __user *)argp); break; case TIOCINQ: { struct sk_buff *skb = skb_peek(&sk->sk_receive_queue); @@ -1837,14 +1838,14 @@ * user tasks fiddle here */ if (skb) amount = skb->len - sizeof(struct ipxhdr); - rc = put_user(amount, (int *)arg); + rc = put_user(amount, (int __user *)argp); break; } case SIOCADDRT: case SIOCDELRT: rc = -EPERM; if (capable(CAP_NET_ADMIN)) - rc = ipxrtr_ioctl(cmd, (void *)arg); + rc = ipxrtr_ioctl(cmd, argp); break; case SIOCSIFADDR: case SIOCAIPXITFCRT: @@ -1853,10 +1854,10 @@ if (!capable(CAP_NET_ADMIN)) break; case SIOCGIFADDR: - rc = ipxitf_ioctl(cmd, (void *)arg); + rc = ipxitf_ioctl(cmd, argp); break; case SIOCIPXCFGDATA: - rc = ipxcfg_get_config_data((void *)arg); + rc = ipxcfg_get_config_data(argp); break; case SIOCIPXNCPCONN: /* @@ -1867,12 +1868,12 @@ if (!capable(CAP_NET_ADMIN)) break; rc = get_user(ipx_sk(sk)->ipx_ncp_conn, - (const unsigned short *)(arg)); + (const unsigned short __user *)argp); break; case SIOCGSTAMP: rc = -EINVAL; if (sk) - rc = sock_get_timestamp(sk, (struct timeval *)arg); + rc = sock_get_timestamp(sk, argp); break; case SIOCGIFDSTADDR: case SIOCSIFDSTADDR: @@ -1883,7 +1884,7 @@ rc = -EINVAL; break; default: - rc = dev_ioctl(cmd,(void *) arg); + rc = dev_ioctl(cmd, argp); break; } diff -urN linux-2.6.7-rc2/net/ipx/ipx_route.c linux-2.6.7-rc3/net/ipx/ipx_route.c --- linux-2.6.7-rc2/net/ipx/ipx_route.c 2004-05-09 19:32:36.000000000 -0700 +++ linux-2.6.7-rc3/net/ipx/ipx_route.c 2004-06-07 12:55:28.531679622 -0700 @@ -256,7 +256,7 @@ /* * We use a normal struct rtentry for route handling */ -int ipxrtr_ioctl(unsigned int cmd, void *arg) +int ipxrtr_ioctl(unsigned int cmd, void __user *arg) { struct rtentry rt; /* Use these to behave like 'other' stacks */ struct sockaddr_ipx *sg, *st; diff -urN linux-2.6.7-rc2/net/irda/af_irda.c linux-2.6.7-rc3/net/irda/af_irda.c --- linux-2.6.7-rc2/net/irda/af_irda.c 2004-06-07 12:54:53.679236074 -0700 +++ linux-2.6.7-rc3/net/irda/af_irda.c 2004-06-07 12:55:28.593682190 -0700 @@ -1269,7 +1269,7 @@ IRDA_DEBUG(4, "%s(), len=%d\n", __FUNCTION__, len); /* Note : socket.c set MSG_EOR on SEQPACKET sockets */ - if (msg->msg_flags & ~(MSG_DONTWAIT | MSG_EOR)) + if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR|MSG_CMSG_COMPAT)) return -EINVAL; if (sk->sk_shutdown & SEND_SHUTDOWN) { @@ -1521,7 +1521,7 @@ IRDA_DEBUG(4, "%s(), len=%d\n", __FUNCTION__, len); - if (msg->msg_flags & ~MSG_DONTWAIT) + if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_CMSG_COMPAT)) return -EINVAL; if (sk->sk_shutdown & SEND_SHUTDOWN) { @@ -1593,7 +1593,7 @@ IRDA_DEBUG(4, "%s(), len=%d\n", __FUNCTION__, len); - if (msg->msg_flags & ~MSG_DONTWAIT) + if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_CMSG_COMPAT)) return -EINVAL; if (sk->sk_shutdown & SEND_SHUTDOWN) { @@ -1779,7 +1779,7 @@ amount = sk->sk_sndbuf - atomic_read(&sk->sk_wmem_alloc); if (amount < 0) amount = 0; - if (put_user(amount, (unsigned int *)arg)) + if (put_user(amount, (unsigned int __user *)arg)) return -EFAULT; return 0; } @@ -1790,14 +1790,14 @@ /* These two are safe on a single CPU system as only user tasks fiddle here */ if ((skb = skb_peek(&sk->sk_receive_queue)) != NULL) amount = skb->len; - if (put_user(amount, (unsigned int *)arg)) + if (put_user(amount, (unsigned int __user *)arg)) return -EFAULT; return 0; } case SIOCGSTAMP: if (sk != NULL) - return sock_get_timestamp(sk, (struct timeval *)arg); + return sock_get_timestamp(sk, (struct timeval __user *)arg); return -EINVAL; case SIOCGIFADDR: @@ -1813,7 +1813,7 @@ return -EINVAL; default: IRDA_DEBUG(1, "%s(), doing device ioctl!\n", __FUNCTION__); - return dev_ioctl(cmd, (void *) arg); + return dev_ioctl(cmd, (void __user *) arg); } /*NOTREACHED*/ diff -urN linux-2.6.7-rc2/net/irda/ircomm/ircomm_tty_ioctl.c linux-2.6.7-rc3/net/irda/ircomm/ircomm_tty_ioctl.c --- linux-2.6.7-rc2/net/irda/ircomm/ircomm_tty_ioctl.c 2004-05-09 19:31:58.000000000 -0700 +++ linux-2.6.7-rc3/net/irda/ircomm/ircomm_tty_ioctl.c 2004-06-07 12:55:28.629683682 -0700 @@ -260,7 +260,7 @@ * */ static int ircomm_tty_get_serial_info(struct ircomm_tty_cb *self, - struct serial_struct *retinfo) + struct serial_struct __user *retinfo) { struct serial_struct info; @@ -297,7 +297,7 @@ * */ static int ircomm_tty_set_serial_info(struct ircomm_tty_cb *self, - struct serial_struct *new_info) + struct serial_struct __user *new_info) { #if 0 struct serial_struct new_serial; @@ -388,10 +388,10 @@ switch (cmd) { case TIOCGSERIAL: - ret = ircomm_tty_get_serial_info(self, (struct serial_struct *) arg); + ret = ircomm_tty_get_serial_info(self, (struct serial_struct __user *) arg); break; case TIOCSSERIAL: - ret = ircomm_tty_set_serial_info(self, (struct serial_struct *) arg); + ret = ircomm_tty_set_serial_info(self, (struct serial_struct __user *) arg); break; case TIOCMIWAIT: IRDA_DEBUG(0, "(), TIOCMIWAIT, not impl!\n"); @@ -403,7 +403,7 @@ save_flags(flags); cli(); cnow = driver->icount; restore_flags(flags); - p_cuser = (struct serial_icounter_struct *) arg; + p_cuser = (struct serial_icounter_struct __user *) arg; if (put_user(cnow.cts, &p_cuser->cts) || put_user(cnow.dsr, &p_cuser->dsr) || put_user(cnow.rng, &p_cuser->rng) || diff -urN linux-2.6.7-rc2/net/irda/irlmp.c linux-2.6.7-rc3/net/irda/irlmp.c --- linux-2.6.7-rc2/net/irda/irlmp.c 2004-05-09 19:33:19.000000000 -0700 +++ linux-2.6.7-rc3/net/irda/irlmp.c 2004-06-07 12:55:28.693686333 -0700 @@ -804,7 +804,7 @@ * Note : separate from irlmp_do_discovery() so that we can handle * passive discovery properly. */ -void irlmp_do_expiry() +void irlmp_do_expiry(void) { struct lap_cb *lap; @@ -1078,7 +1078,7 @@ * Used by IrLAP to get the discovery info it needs when answering * discovery requests by other devices. */ -discovery_t *irlmp_get_discovery_response() +discovery_t *irlmp_get_discovery_response(void) { IRDA_DEBUG(4, "%s()\n", __FUNCTION__); diff -urN linux-2.6.7-rc2/net/irda/irnet/irnet_ppp.c linux-2.6.7-rc3/net/irda/irnet/irnet_ppp.c --- linux-2.6.7-rc2/net/irda/irnet/irnet_ppp.c 2004-05-09 19:32:54.000000000 -0700 +++ linux-2.6.7-rc3/net/irda/irnet/irnet_ppp.c 2004-06-07 12:55:28.711687078 -0700 @@ -35,7 +35,7 @@ */ static inline ssize_t irnet_ctrl_write(irnet_socket * ap, - const char * buf, + const char __user *buf, size_t count) { char command[IRNET_MAX_COMMAND]; @@ -254,7 +254,7 @@ static inline ssize_t irnet_ctrl_read(irnet_socket * ap, struct file * file, - char * buf, + char __user * buf, size_t count) { DECLARE_WAITQUEUE(wait, current); @@ -529,7 +529,7 @@ */ static ssize_t dev_irnet_write(struct file * file, - const char * buf, + const char __user *buf, size_t count, loff_t * ppos) { @@ -553,7 +553,7 @@ */ static ssize_t dev_irnet_read(struct file * file, - char * buf, + char __user * buf, size_t count, loff_t * ppos) { @@ -610,6 +610,7 @@ irnet_socket * ap = (struct irnet_socket *) file->private_data; int err; int val; + void __user *argp = (void __user *)arg; DENTER(FS_TRACE, "(file=0x%p, ap=0x%p, cmd=0x%X)\n", file, ap, cmd); @@ -626,7 +627,7 @@ { /* Set discipline (should be N_SYNC_PPP or N_TTY) */ case TIOCSETD: - if(get_user(val, (int *) arg)) + if(get_user(val, (int __user *)argp)) break; if((val == N_SYNC_PPP) || (val == N_PPP)) { @@ -665,7 +666,7 @@ case PPPIOCGCHAN: if(!ap->ppp_open) break; - if(put_user(ppp_channel_index(&ap->chan), (int *) arg)) + if(put_user(ppp_channel_index(&ap->chan), (int __user *)argp)) break; DEBUG(FS_INFO, "Query channel.\n"); err = 0; @@ -673,7 +674,7 @@ case PPPIOCGUNIT: if(!ap->ppp_open) break; - if(put_user(ppp_unit_number(&ap->chan), (int *) arg)) + if(put_user(ppp_unit_number(&ap->chan), (int __user *)argp)) break; DEBUG(FS_INFO, "Query unit number.\n"); err = 0; @@ -703,14 +704,14 @@ /* Get termios */ case TCGETS: DEBUG(FS_INFO, "Get termios.\n"); - if(kernel_termios_to_user_termios((struct termios *)arg, &ap->termios)) + if(kernel_termios_to_user_termios((struct termios __user *)argp, &ap->termios)) break; err = 0; break; /* Set termios */ case TCSETSF: DEBUG(FS_INFO, "Set termios.\n"); - if(user_termios_to_kernel_termios(&ap->termios, (struct termios *) arg)) + if(user_termios_to_kernel_termios(&ap->termios, (struct termios __user *)argp)) break; err = 0; break; @@ -743,7 +744,7 @@ case FIONREAD: DEBUG(FS_INFO, "FIONREAD\n"); val = 0; - if(put_user(val, (int *) arg)) + if(put_user(val, (int __user *)argp)) break; err = 0; break; @@ -950,6 +951,7 @@ int err; int val; u32 accm[8]; + void __user *argp = (void __user *)arg; DENTER(PPP_TRACE, "(channel=0x%p, ap=0x%p, cmd=0x%X)\n", chan, ap, cmd); @@ -963,12 +965,12 @@ /* PPP flags */ case PPPIOCGFLAGS: val = ap->flags | ap->rbits; - if(put_user(val, (int *) arg)) + if(put_user(val, (int __user *) argp)) break; err = 0; break; case PPPIOCSFLAGS: - if(get_user(val, (int *) arg)) + if(get_user(val, (int __user *) argp)) break; ap->flags = val & ~SC_RCV_BITS; ap->rbits = val & SC_RCV_BITS; @@ -977,32 +979,32 @@ /* Async map stuff - all dummy to please pppd */ case PPPIOCGASYNCMAP: - if(put_user(ap->xaccm[0], (u32 *) arg)) + if(put_user(ap->xaccm[0], (u32 __user *) argp)) break; err = 0; break; case PPPIOCSASYNCMAP: - if(get_user(ap->xaccm[0], (u32 *) arg)) + if(get_user(ap->xaccm[0], (u32 __user *) argp)) break; err = 0; break; case PPPIOCGRASYNCMAP: - if(put_user(ap->raccm, (u32 *) arg)) + if(put_user(ap->raccm, (u32 __user *) argp)) break; err = 0; break; case PPPIOCSRASYNCMAP: - if(get_user(ap->raccm, (u32 *) arg)) + if(get_user(ap->raccm, (u32 __user *) argp)) break; err = 0; break; case PPPIOCGXASYNCMAP: - if(copy_to_user((void *) arg, ap->xaccm, sizeof(ap->xaccm))) + if(copy_to_user(argp, ap->xaccm, sizeof(ap->xaccm))) break; err = 0; break; case PPPIOCSXASYNCMAP: - if(copy_from_user(accm, (void *) arg, sizeof(accm))) + if(copy_from_user(accm, argp, sizeof(accm))) break; accm[2] &= ~0x40000000U; /* can't escape 0x5e */ accm[3] |= 0x60000000U; /* must escape 0x7d, 0x7e */ @@ -1012,12 +1014,12 @@ /* Max PPP frame size */ case PPPIOCGMRU: - if(put_user(ap->mru, (int *) arg)) + if(put_user(ap->mru, (int __user *) argp)) break; err = 0; break; case PPPIOCSMRU: - if(get_user(val, (int *) arg)) + if(get_user(val, (int __user *) argp)) break; if(val < PPP_MRU) val = PPP_MRU; @@ -1097,7 +1099,7 @@ irnet_cleanup(void) { irda_irnet_cleanup(); - return ppp_irnet_cleanup(); + ppp_irnet_cleanup(); } /*------------------------------------------------------------------*/ diff -urN linux-2.6.7-rc2/net/irda/irnet/irnet_ppp.h linux-2.6.7-rc3/net/irda/irnet/irnet_ppp.h --- linux-2.6.7-rc2/net/irda/irnet/irnet_ppp.h 2004-05-09 19:32:54.000000000 -0700 +++ linux-2.6.7-rc3/net/irda/irnet/irnet_ppp.h 2004-06-07 12:55:28.711687078 -0700 @@ -66,11 +66,11 @@ struct file *); static ssize_t dev_irnet_write(struct file *, - const char *, + const char __user *, size_t, loff_t *), dev_irnet_read(struct file *, - char *, + char __user *, size_t, loff_t *); static unsigned int diff -urN linux-2.6.7-rc2/net/irda/irsysctl.c linux-2.6.7-rc3/net/irda/irsysctl.c --- linux-2.6.7-rc2/net/irda/irsysctl.c 2004-05-09 19:32:28.000000000 -0700 +++ linux-2.6.7-rc3/net/irda/irsysctl.c 2004-06-07 12:55:28.712687120 -0700 @@ -78,7 +78,7 @@ * us on that - Jean II */ static int do_devname(ctl_table *table, int write, struct file *filp, - void *buffer, size_t *lenp) + void __user *buffer, size_t *lenp) { int ret; diff -urN linux-2.6.7-rc2/net/key/af_key.c linux-2.6.7-rc3/net/key/af_key.c --- linux-2.6.7-rc2/net/key/af_key.c 2004-06-07 12:54:53.744238766 -0700 +++ linux-2.6.7-rc3/net/key/af_key.c 2004-06-07 12:55:28.748688611 -0700 @@ -2726,7 +2726,7 @@ int copied, err; err = -EINVAL; - if (flags & ~(MSG_PEEK|MSG_DONTWAIT|MSG_TRUNC)) + if (flags & ~(MSG_PEEK|MSG_DONTWAIT|MSG_TRUNC|MSG_CMSG_COMPAT)) goto out; msg->msg_namelen = 0; diff -urN linux-2.6.7-rc2/net/llc/af_llc.c linux-2.6.7-rc3/net/llc/af_llc.c --- linux-2.6.7-rc2/net/llc/af_llc.c 2004-06-07 12:54:53.746238849 -0700 +++ linux-2.6.7-rc3/net/llc/af_llc.c 2004-06-07 12:55:28.749688652 -0700 @@ -867,7 +867,7 @@ static int llc_ui_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) { - return dev_ioctl(cmd, (void *)arg); + return dev_ioctl(cmd, (void __user *)arg); } /** diff -urN linux-2.6.7-rc2/net/netlink/netlink_dev.c linux-2.6.7-rc3/net/netlink/netlink_dev.c --- linux-2.6.7-rc2/net/netlink/netlink_dev.c 2004-05-09 19:32:28.000000000 -0700 +++ linux-2.6.7-rc3/net/netlink/netlink_dev.c 2004-06-07 12:55:28.786690185 -0700 @@ -54,7 +54,7 @@ * Write a message to the kernel side of a communication link */ -static ssize_t netlink_write(struct file * file, const char * buf, +static ssize_t netlink_write(struct file * file, const char __user * buf, size_t count, loff_t *pos) { struct inode *inode = file->f_dentry->d_inode; @@ -62,7 +62,7 @@ struct msghdr msg; struct iovec iov; - iov.iov_base = (void*)buf; + iov.iov_base = (void __user*)buf; iov.iov_len = count; msg.msg_name=NULL; msg.msg_namelen=0; @@ -78,7 +78,7 @@ * Read a message from the kernel side of the communication link */ -static ssize_t netlink_read(struct file * file, char * buf, +static ssize_t netlink_read(struct file * file, char __user * buf, size_t count, loff_t *pos) { struct inode *inode = file->f_dentry->d_inode; diff -urN linux-2.6.7-rc2/net/netrom/af_netrom.c linux-2.6.7-rc3/net/netrom/af_netrom.c --- linux-2.6.7-rc2/net/netrom/af_netrom.c 2004-06-07 12:54:53.752239097 -0700 +++ linux-2.6.7-rc3/net/netrom/af_netrom.c 2004-06-07 12:55:28.832692090 -0700 @@ -1021,7 +1021,7 @@ unsigned char *asmptr; int size; - if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR)) + if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR|MSG_CMSG_COMPAT)) return -EINVAL; lock_sock(sk); @@ -1176,6 +1176,7 @@ static int nr_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) { struct sock *sk = sock->sk; + void __user *argp = (void __user *)arg; int ret; lock_sock(sk); @@ -1186,7 +1187,7 @@ if (amount < 0) amount = 0; release_sock(sk); - return put_user(amount, (int *)arg); + return put_user(amount, (int __user *)argp); } case TIOCINQ: { @@ -1196,13 +1197,13 @@ if ((skb = skb_peek(&sk->sk_receive_queue)) != NULL) amount = skb->len; release_sock(sk); - return put_user(amount, (int *)arg); + return put_user(amount, (int __user *)argp); } case SIOCGSTAMP: ret = -EINVAL; if (sk != NULL) - ret = sock_get_timestamp(sk, (struct timeval *)arg); + ret = sock_get_timestamp(sk, argp); release_sock(sk); return ret; @@ -1224,11 +1225,11 @@ case SIOCNRDECOBS: release_sock(sk); if (!capable(CAP_NET_ADMIN)) return -EPERM; - return nr_rt_ioctl(cmd, (void *)arg); + return nr_rt_ioctl(cmd, argp); default: release_sock(sk); - return dev_ioctl(cmd, (void *)arg); + return dev_ioctl(cmd, argp); } release_sock(sk); diff -urN linux-2.6.7-rc2/net/netrom/nr_route.c linux-2.6.7-rc3/net/netrom/nr_route.c --- linux-2.6.7-rc2/net/netrom/nr_route.c 2004-05-09 19:33:21.000000000 -0700 +++ linux-2.6.7-rc3/net/netrom/nr_route.c 2004-06-07 12:55:28.833692132 -0700 @@ -647,7 +647,7 @@ /* * Handle the ioctls that control the routing functions. */ -int nr_rt_ioctl(unsigned int cmd, void *arg) +int nr_rt_ioctl(unsigned int cmd, void __user *arg) { struct nr_route_struct nr_route; struct net_device *dev; diff -urN linux-2.6.7-rc2/net/packet/af_packet.c linux-2.6.7-rc3/net/packet/af_packet.c --- linux-2.6.7-rc2/net/packet/af_packet.c 2004-06-07 12:54:53.756239263 -0700 +++ linux-2.6.7-rc3/net/packet/af_packet.c 2004-06-07 12:55:28.858693167 -0700 @@ -1037,7 +1037,7 @@ int copied, err; err = -EINVAL; - if (flags & ~(MSG_PEEK|MSG_DONTWAIT|MSG_TRUNC)) + if (flags & ~(MSG_PEEK|MSG_DONTWAIT|MSG_TRUNC|MSG_CMSG_COMPAT)) goto out; #if 0 @@ -1450,7 +1450,7 @@ case SIOCOUTQ: { int amount = atomic_read(&sk->sk_wmem_alloc); - return put_user(amount, (int *)arg); + return put_user(amount, (int __user *)arg); } case SIOCINQ: { @@ -1462,10 +1462,10 @@ if (skb) amount = skb->len; spin_unlock_bh(&sk->sk_receive_queue.lock); - return put_user(amount, (int *)arg); + return put_user(amount, (int __user *)arg); } case SIOCGSTAMP: - return sock_get_timestamp(sk, (struct timeval *)arg); + return sock_get_timestamp(sk, (struct timeval __user *)arg); #ifdef CONFIG_INET case SIOCADDRT: @@ -1486,7 +1486,7 @@ #endif default: - return dev_ioctl(cmd, (void *)arg); + return dev_ioctl(cmd, (void __user *)arg); } return 0; } diff -urN linux-2.6.7-rc2/net/rose/af_rose.c linux-2.6.7-rc3/net/rose/af_rose.c --- linux-2.6.7-rc2/net/rose/af_rose.c 2004-06-07 12:54:53.759239387 -0700 +++ linux-2.6.7-rc3/net/rose/af_rose.c 2004-06-07 12:55:28.917695611 -0700 @@ -1021,7 +1021,7 @@ unsigned char *asmptr; int n, size, qbit = 0; - if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR)) + if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR|MSG_CMSG_COMPAT)) return -EINVAL; if (sk->sk_zapped) @@ -1249,6 +1249,7 @@ { struct sock *sk = sock->sk; rose_cb *rose = rose_sk(sk); + void __user *argp = (void __user *)arg; switch (cmd) { case TIOCOUTQ: { @@ -1256,7 +1257,7 @@ amount = sk->sk_sndbuf - atomic_read(&sk->sk_wmem_alloc); if (amount < 0) amount = 0; - return put_user(amount, (unsigned int *)arg); + return put_user(amount, (unsigned int __user *)argp); } case TIOCINQ: { @@ -1265,12 +1266,12 @@ /* These two are safe on a single CPU system as only user tasks fiddle here */ if ((skb = skb_peek(&sk->sk_receive_queue)) != NULL) amount = skb->len; - return put_user(amount, (unsigned int *)arg); + return put_user(amount, (unsigned int __user *)argp); } case SIOCGSTAMP: if (sk != NULL) - return sock_get_timestamp(sk, (struct timeval *)arg); + return sock_get_timestamp(sk, (struct timeval __user *)argp); return -EINVAL; case SIOCGIFADDR: @@ -1290,18 +1291,18 @@ case SIOCRSCLRRT: if (!capable(CAP_NET_ADMIN)) return -EPERM; - return rose_rt_ioctl(cmd, (void *)arg); + return rose_rt_ioctl(cmd, argp); case SIOCRSGCAUSE: { struct rose_cause_struct rose_cause; rose_cause.cause = rose->cause; rose_cause.diagnostic = rose->diagnostic; - return copy_to_user((void *)arg, &rose_cause, sizeof(struct rose_cause_struct)) ? -EFAULT : 0; + return copy_to_user(argp, &rose_cause, sizeof(struct rose_cause_struct)) ? -EFAULT : 0; } case SIOCRSSCAUSE: { struct rose_cause_struct rose_cause; - if (copy_from_user(&rose_cause, (void *)arg, sizeof(struct rose_cause_struct))) + if (copy_from_user(&rose_cause, argp, sizeof(struct rose_cause_struct))) return -EFAULT; rose->cause = rose_cause.cause; rose->diagnostic = rose_cause.diagnostic; @@ -1312,14 +1313,14 @@ if (!capable(CAP_NET_ADMIN)) return -EPERM; if (ax25cmp(&rose_callsign, &null_ax25_address) != 0) ax25_listen_release(&rose_callsign, NULL); - if (copy_from_user(&rose_callsign, (void *)arg, sizeof(ax25_address))) + if (copy_from_user(&rose_callsign, argp, sizeof(ax25_address))) return -EFAULT; if (ax25cmp(&rose_callsign, &null_ax25_address) != 0) ax25_listen_register(&rose_callsign, NULL); return 0; case SIOCRSGL2CALL: - return copy_to_user((void *)arg, &rose_callsign, sizeof(ax25_address)) ? -EFAULT : 0; + return copy_to_user(argp, &rose_callsign, sizeof(ax25_address)) ? -EFAULT : 0; case SIOCRSACCEPT: if (rose->state == ROSE_STATE_5) { @@ -1335,7 +1336,7 @@ return 0; default: - return dev_ioctl(cmd, (void *)arg); + return dev_ioctl(cmd, argp); } return 0; diff -urN linux-2.6.7-rc2/net/rose/rose_route.c linux-2.6.7-rc3/net/rose/rose_route.c --- linux-2.6.7-rc2/net/rose/rose_route.c 2004-05-09 19:33:20.000000000 -0700 +++ linux-2.6.7-rc3/net/rose/rose_route.c 2004-06-07 12:55:28.935696357 -0700 @@ -710,7 +710,7 @@ /* * Handle the ioctls that control the routing functions. */ -int rose_rt_ioctl(unsigned int cmd, void *arg) +int rose_rt_ioctl(unsigned int cmd, void __user *arg) { struct rose_route_struct rose_route; struct net_device *dev; diff -urN linux-2.6.7-rc2/net/sched/sch_delay.c linux-2.6.7-rc3/net/sched/sch_delay.c --- linux-2.6.7-rc2/net/sched/sch_delay.c 2004-05-09 19:32:00.000000000 -0700 +++ linux-2.6.7-rc3/net/sched/sch_delay.c 2004-06-07 12:55:28.979698180 -0700 @@ -165,6 +165,7 @@ return -ENOMEM; rta->rta_type = RTM_NEWQDISC; + rta->rta_len = RTA_LENGTH(sizeof(struct tc_fifo_qopt)); ((struct tc_fifo_qopt *)RTA_DATA(rta))->limit = limit; ret = q->ops->change(q, rta); kfree(rta); diff -urN linux-2.6.7-rc2/net/sctp/output.c linux-2.6.7-rc3/net/sctp/output.c --- linux-2.6.7-rc2/net/sctp/output.c 2004-05-09 19:32:20.000000000 -0700 +++ linux-2.6.7-rc3/net/sctp/output.c 2004-06-07 12:55:29.074702115 -0700 @@ -496,7 +496,7 @@ return err; no_route: kfree_skb(nskb); - IP_INC_STATS_BH(IpOutNoRoutes); + IP_INC_STATS_BH(OutNoRoutes); /* FIXME: Returning the 'err' will effect all the associations * associated with a socket, although only one of the paths of the diff -urN linux-2.6.7-rc2/net/sctp/sm_sideeffect.c linux-2.6.7-rc3/net/sctp/sm_sideeffect.c --- linux-2.6.7-rc2/net/sctp/sm_sideeffect.c 2004-05-09 19:32:53.000000000 -0700 +++ linux-2.6.7-rc3/net/sctp/sm_sideeffect.c 2004-06-07 12:55:29.076702198 -0700 @@ -429,6 +429,9 @@ sctp_add_cmd_sf(commands, SCTP_CMD_EVENT_ULP, SCTP_ULPEVENT(event)); + sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE, + SCTP_STATE(SCTP_STATE_CLOSED)); + /* SEND_FAILED sent later when cleaning up the association. */ asoc->outqueue.error = error; sctp_add_cmd_sf(commands, SCTP_CMD_DELETE_TCB, SCTP_NULL()); @@ -457,6 +460,10 @@ sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE, SCTP_STATE(SCTP_STATE_CLOSED)); + /* Set sk_err to ECONNRESET on a 1-1 style socket. */ + if (!sctp_style(asoc->base.sk, UDP)) + asoc->base.sk->sk_err = ECONNRESET; + /* SEND_FAILED sent later when cleaning up the association. */ asoc->outqueue.error = error; sctp_add_cmd_sf(commands, SCTP_CMD_DELETE_TCB, SCTP_NULL()); @@ -1272,6 +1279,9 @@ case SCTP_CMD_PROCESS_OPERR: sctp_cmd_process_operr(commands, asoc, chunk); break; + case SCTP_CMD_CLEAR_INIT_TAG: + asoc->peer.i.init_tag = 0; + break; default: printk(KERN_WARNING "Impossible command: %u, %p\n", cmd->verb, cmd->obj.ptr); diff -urN linux-2.6.7-rc2/net/sctp/sm_statefuns.c linux-2.6.7-rc3/net/sctp/sm_statefuns.c --- linux-2.6.7-rc2/net/sctp/sm_statefuns.c 2004-05-09 19:31:59.000000000 -0700 +++ linux-2.6.7-rc3/net/sctp/sm_statefuns.c 2004-06-07 12:55:29.106703440 -0700 @@ -171,7 +171,7 @@ * Verification Tag field to Tag_A, and also provide its own * Verification Tag (Tag_Z) in the Initiate Tag field. * - * Verification Tag: No checking. + * Verification Tag: Must be 0. * * Inputs * (endpoint, asoc, chunk) @@ -219,6 +219,12 @@ (sk->sk_ack_backlog >= sk->sk_max_ack_backlog))) return sctp_sf_tabort_8_4_8(ep, asoc, type, arg, commands); + /* 3.1 A packet containing an INIT chunk MUST have a zero Verification + * Tag. + */ + if (chunk->sctp_hdr->vtag != 0) + return sctp_sf_tabort_8_4_8(ep, asoc, type, arg, commands); + /* Verify the INIT chunk before processing it. */ err_chunk = NULL; if (!sctp_verify_init(asoc, chunk->chunk_hdr->type, @@ -377,6 +383,9 @@ if (!chunk->singleton) return SCTP_DISPOSITION_VIOLATION; + if (!sctp_vtag_verify(chunk, asoc)) + return sctp_sf_pdiscard(ep, asoc, type, arg, commands); + /* Grab the INIT header. */ chunk->subh.init_hdr = (sctp_inithdr_t *) chunk->skb->data; @@ -659,8 +668,12 @@ const sctp_subtype_t type, void *arg, sctp_cmd_seq_t *commands) { + struct sctp_chunk *chunk = arg; struct sctp_ulpevent *ev; + if (!sctp_vtag_verify(chunk, asoc)) + return sctp_sf_pdiscard(ep, asoc, type, arg, commands); + /* RFC 2960 5.1 Normal Establishment of an Association * * E) Upon reception of the COOKIE ACK, endpoint "A" will move @@ -807,13 +820,7 @@ struct sctp_chunk *reply; size_t paylen = 0; - /* 8.5 When receiving an SCTP packet, the endpoint MUST ensure - * that the value in the Verification Tag field of the - * received SCTP packet matches its own Tag. If the received - * Verification Tag value does not match the receiver's own - * tag value, the receiver shall silently discard the packet... - */ - if (ntohl(chunk->sctp_hdr->vtag) != asoc->c.my_vtag) + if (!sctp_vtag_verify(chunk, asoc)) return sctp_sf_pdiscard(ep, asoc, type, arg, commands); /* 8.3 The receiver of the HEARTBEAT should immediately @@ -876,11 +883,7 @@ sctp_sender_hb_info_t *hbinfo; unsigned long max_interval; - /* 8.5 When receiving an SCTP packet, the endpoint MUST ensure - * that the value in the Verification Tag field of the - * received SCTP packet matches its own Tag. ... - */ - if (ntohl(chunk->sctp_hdr->vtag) != asoc->c.my_vtag) + if (!sctp_vtag_verify(chunk, asoc)) return sctp_sf_pdiscard(ep, asoc, type, arg, commands); hbinfo = (sctp_sender_hb_info_t *) chunk->skb->data; @@ -1130,6 +1133,12 @@ if (!chunk->singleton) return SCTP_DISPOSITION_VIOLATION; + /* 3.1 A packet containing an INIT chunk MUST have a zero Verification + * Tag. + */ + if (chunk->sctp_hdr->vtag != 0) + return sctp_sf_tabort_8_4_8(ep, asoc, type, arg, commands); + /* Grab the INIT header. */ chunk->subh.init_hdr = (sctp_inithdr_t *) chunk->skb->data; @@ -1386,6 +1395,8 @@ sctp_init_chunk_t *peer_init; struct sctp_ulpevent *ev; struct sctp_chunk *repl; + struct sctp_chunk *err; + sctp_disposition_t disposition; /* new_asoc is a brand-new association, so these are not yet * side effects--it is safe to run them here. @@ -1405,6 +1416,29 @@ return SCTP_DISPOSITION_CONSUME; } + /* If the endpoint is in the SHUTDOWN-ACK-SENT state and recognizes + * the peer has restarted (Action A), it MUST NOT setup a new + * association but instead resend the SHUTDOWN ACK and send an ERROR + * chunk with a "Cookie Received while Shutting Down" error cause to + * its peer. + */ + if (sctp_state(asoc, SHUTDOWN_ACK_SENT)) { + disposition = sctp_sf_do_9_2_reshutack(ep, asoc, + SCTP_ST_CHUNK(chunk->chunk_hdr->type), + chunk, commands); + if (SCTP_DISPOSITION_NOMEM == disposition) + goto nomem; + + err = sctp_make_op_error(asoc, chunk, + SCTP_ERROR_COOKIE_IN_SHUTDOWN, + NULL, 0); + if (err) + sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, + SCTP_CHUNK(err)); + + return SCTP_DISPOSITION_CONSUME; + } + /* For now, fail any unsent/unacked data. Consider the optional * choice of resending of this data. */ @@ -1883,6 +1917,9 @@ sctp_addto_chunk(reply, sizeof(bht), &bht); + /* Clear peer's init_tag cached in assoc as we are sending a new INIT */ + sctp_add_cmd_sf(commands, SCTP_CMD_CLEAR_INIT_TAG, SCTP_NULL()); + /* Cast away the const modifier, as we want to just * rerun it through as a sideffect. */ @@ -2071,13 +2108,7 @@ skb_pull(chunk->skb, sizeof(sctp_shutdownhdr_t)); chunk->subh.shutdown_hdr = sdh; - /* 8.5 When receiving an SCTP packet, the endpoint MUST ensure - * that the value in the Verification Tag field of the - * received SCTP packet matches its own Tag. If the received - * Verification Tag value does not match the receiver's own - * tag value, the receiver shall silently discard the packet... - */ - if (ntohl(chunk->sctp_hdr->vtag) != asoc->c.my_vtag) + if (!sctp_vtag_verify(chunk, asoc)) return sctp_sf_pdiscard(ep, asoc, type, arg, commands); /* Upon the reception of the SHUTDOWN, the peer endpoint shall @@ -2190,13 +2221,7 @@ sctp_cwrhdr_t *cwr; struct sctp_chunk *chunk = arg; - /* 8.5 When receiving an SCTP packet, the endpoint MUST ensure - * that the value in the Verification Tag field of the - * received SCTP packet matches its own Tag. If the received - * Verification Tag value does not match the receiver's own - * tag value, the receiver shall silently discard the packet... - */ - if (ntohl(chunk->sctp_hdr->vtag) != asoc->c.my_vtag) + if (!sctp_vtag_verify(chunk, asoc)) return sctp_sf_pdiscard(ep, asoc, type, arg, commands); cwr = (sctp_cwrhdr_t *) chunk->skb->data; @@ -2246,13 +2271,7 @@ sctp_ecnehdr_t *ecne; struct sctp_chunk *chunk = arg; - /* 8.5 When receiving an SCTP packet, the endpoint MUST ensure - * that the value in the Verification Tag field of the - * received SCTP packet matches its own Tag. If the received - * Verification Tag value does not match the receiver's own - * tag value, the receiver shall silently discard the packet... - */ - if (ntohl(chunk->sctp_hdr->vtag) != asoc->c.my_vtag) + if (!sctp_vtag_verify(chunk, asoc)) return sctp_sf_pdiscard(ep, asoc, type, arg, commands); ecne = (sctp_ecnehdr_t *) chunk->skb->data; @@ -2309,13 +2328,7 @@ int tmp; __u32 tsn; - /* RFC 2960 8.5 Verification Tag - * - * When receiving an SCTP packet, the endpoint MUST ensure - * that the value in the Verification Tag field of the - * received SCTP packet matches its own Tag. - */ - if (ntohl(chunk->sctp_hdr->vtag) != asoc->c.my_vtag) { + if (!sctp_vtag_verify(chunk, asoc)) { sctp_add_cmd_sf(commands, SCTP_CMD_REPORT_BAD_TAG, SCTP_NULL()); return sctp_sf_pdiscard(ep, asoc, type, arg, commands); @@ -2569,13 +2582,7 @@ int tmp; __u32 tsn; - /* RFC 2960 8.5 Verification Tag - * - * When receiving an SCTP packet, the endpoint MUST ensure - * that the value in the Verification Tag field of the - * received SCTP packet matches its own Tag. - */ - if (ntohl(chunk->sctp_hdr->vtag) != asoc->c.my_vtag) { + if (!sctp_vtag_verify(chunk, asoc)) { sctp_add_cmd_sf(commands, SCTP_CMD_REPORT_BAD_TAG, SCTP_NULL()); return sctp_sf_pdiscard(ep, asoc, type, arg, commands); @@ -2745,11 +2752,7 @@ sctp_sackhdr_t *sackh; __u32 ctsn; - /* 8.5 When receiving an SCTP packet, the endpoint MUST ensure - * that the value in the Verification Tag field of the - * received SCTP packet matches its own Tag. ... - */ - if (ntohl(chunk->sctp_hdr->vtag) != asoc->c.my_vtag) + if (!sctp_vtag_verify(chunk, asoc)) return sctp_sf_pdiscard(ep, asoc, type, arg, commands); /* Pull the SACK chunk from the data buffer */ @@ -2895,6 +2898,9 @@ struct sctp_chunk *reply; struct sctp_ulpevent *ev; + if (!sctp_vtag_verify(chunk, asoc)) + return sctp_sf_pdiscard(ep, asoc, type, arg, commands); + /* 10.2 H) SHUTDOWN COMPLETE notification * * When SCTP completes the shutdown procedures (section 9.2) this @@ -3229,13 +3235,7 @@ __u16 len; __u32 tsn; - /* RFC 2960 8.5 Verification Tag - * - * When receiving an SCTP packet, the endpoint MUST ensure - * that the value in the Verification Tag field of the - * received SCTP packet matches its own Tag. - */ - if (ntohl(chunk->sctp_hdr->vtag) != asoc->c.my_vtag) { + if (!sctp_vtag_verify(chunk, asoc)) { sctp_add_cmd_sf(commands, SCTP_CMD_REPORT_BAD_TAG, SCTP_NULL()); return sctp_sf_pdiscard(ep, asoc, type, arg, commands); @@ -3293,13 +3293,7 @@ __u16 len; __u32 tsn; - /* RFC 2960 8.5 Verification Tag - * - * When receiving an SCTP packet, the endpoint MUST ensure - * that the value in the Verification Tag field of the - * received SCTP packet matches its own Tag. - */ - if (ntohl(chunk->sctp_hdr->vtag) != asoc->c.my_vtag) { + if (!sctp_vtag_verify(chunk, asoc)) { sctp_add_cmd_sf(commands, SCTP_CMD_REPORT_BAD_TAG, SCTP_NULL()); return sctp_sf_pdiscard(ep, asoc, type, arg, commands); @@ -3376,13 +3370,7 @@ SCTP_DEBUG_PRINTK("Processing the unknown chunk id %d.\n", type.chunk); - /* 8.5 When receiving an SCTP packet, the endpoint MUST ensure - * that the value in the Verification Tag field of the - * received SCTP packet matches its own Tag. If the received - * Verification Tag value does not match the receiver's own - * tag value, the receiver shall silently discard the packet. - */ - if (ntohl(unk_chunk->sctp_hdr->vtag) != asoc->c.my_vtag) + if (!sctp_vtag_verify(unk_chunk, asoc)) return sctp_sf_pdiscard(ep, asoc, type, arg, commands); switch (type.chunk & SCTP_CID_ACTION_MASK) { diff -urN linux-2.6.7-rc2/net/sctp/socket.c linux-2.6.7-rc3/net/sctp/socket.c --- linux-2.6.7-rc2/net/sctp/socket.c 2004-06-07 12:54:53.884244564 -0700 +++ linux-2.6.7-rc3/net/sctp/socket.c 2004-06-07 12:55:29.161705719 -0700 @@ -1164,6 +1164,11 @@ if (!asoc) { SCTP_DEBUG_PRINTK("There is no association yet.\n"); + if (sinfo_flags & (MSG_EOF | MSG_ABORT)) { + err = -EINVAL; + goto out_unlock; + } + /* Check for invalid stream against the stream counts, * either the default or the user specified stream counts. */ @@ -2799,7 +2804,7 @@ if (len != sizeof(struct sctp_paddrparams)) return -EINVAL; - if (copy_from_user(¶ms, optval, *optlen)) /* XXXXXX */ + if (copy_from_user(¶ms, optval, len)) return -EFAULT; trans = sctp_addr_id2transport(sk, ¶ms.spp_address, @@ -2969,7 +2974,7 @@ int cnt = 0; struct sctp_getaddrs getaddrs; struct sctp_sockaddr_entry *from; - void *to; + void __user *to; union sctp_addr temp; struct sctp_opt *sp = sctp_sk(sk); int addrlen; @@ -2996,7 +3001,7 @@ bp = &asoc->base.bind_addr; } - to = (void *)getaddrs.addrs; + to = getaddrs.addrs; list_for_each(pos, &bp->address_list) { from = list_entry(pos, struct sctp_sockaddr_entry, @@ -4388,7 +4393,11 @@ return err; do_error: - err = -ECONNREFUSED; + if (asoc->counters[SCTP_COUNTER_INIT_ERROR] + 1 >= + asoc->max_init_attempts) + err = -ETIMEDOUT; + else + err = -ECONNREFUSED; goto out; do_interrupted: diff -urN linux-2.6.7-rc2/net/sctp/sysctl.c linux-2.6.7-rc3/net/sctp/sysctl.c --- linux-2.6.7-rc2/net/sctp/sysctl.c 2004-05-09 19:32:28.000000000 -0700 +++ linux-2.6.7-rc3/net/sctp/sysctl.c 2004-06-07 12:55:29.163705802 -0700 @@ -232,7 +232,7 @@ return -EINVAL; } if (put_user((*(int *)(table->data) * 1000) / HZ, - (int *)oldval) || + (int __user *)oldval) || (oldlenp && put_user(sizeof (int), oldlenp))) return -EFAULT; } @@ -242,7 +242,7 @@ if (newlen != sizeof (int)) return -EINVAL; - if (get_user(new, (int *)newval)) + if (get_user(new, (int __user *)newval)) return -EFAULT; *(int *)(table->data) = (new * HZ) / 1000; diff -urN linux-2.6.7-rc2/net/socket.c linux-2.6.7-rc3/net/socket.c --- linux-2.6.7-rc2/net/socket.c 2004-06-07 12:54:53.918245973 -0700 +++ linux-2.6.7-rc3/net/socket.c 2004-06-07 12:55:29.164705843 -0700 @@ -729,9 +729,9 @@ */ static DECLARE_MUTEX(br_ioctl_mutex); -static int (*br_ioctl_hook)(unsigned int cmd, unsigned long arg) = NULL; +static int (*br_ioctl_hook)(unsigned int cmd, void __user *arg) = NULL; -void brioctl_set(int (*hook)(unsigned int, unsigned long)) +void brioctl_set(int (*hook)(unsigned int, void __user *)) { down(&br_ioctl_mutex); br_ioctl_hook = hook; @@ -740,9 +740,9 @@ EXPORT_SYMBOL(brioctl_set); static DECLARE_MUTEX(vlan_ioctl_mutex); -static int (*vlan_ioctl_hook)(unsigned long arg); +static int (*vlan_ioctl_hook)(void __user *arg); -void vlan_ioctl_set(int (*hook)(unsigned long)) +void vlan_ioctl_set(int (*hook)(void __user *)) { down(&vlan_ioctl_mutex); vlan_ioctl_hook = hook; @@ -751,9 +751,9 @@ EXPORT_SYMBOL(vlan_ioctl_set); static DECLARE_MUTEX(dlci_ioctl_mutex); -static int (*dlci_ioctl_hook)(unsigned int, void *); +static int (*dlci_ioctl_hook)(unsigned int, void __user *); -void dlci_ioctl_set(int (*hook)(unsigned int, void *)) +void dlci_ioctl_set(int (*hook)(unsigned int, void __user *)) { down(&dlci_ioctl_mutex); dlci_ioctl_hook = hook; @@ -770,29 +770,30 @@ unsigned long arg) { struct socket *sock; + void __user *argp = (void __user *)arg; int pid, err; unlock_kernel(); sock = SOCKET_I(inode); if (cmd >= SIOCDEVPRIVATE && cmd <= (SIOCDEVPRIVATE + 15)) { - err = dev_ioctl(cmd, (void *)arg); + err = dev_ioctl(cmd, argp); } else #ifdef WIRELESS_EXT if (cmd >= SIOCIWFIRST && cmd <= SIOCIWLAST) { - err = dev_ioctl(cmd, (void *)arg); + err = dev_ioctl(cmd, argp); } else #endif /* WIRELESS_EXT */ switch (cmd) { case FIOSETOWN: case SIOCSPGRP: err = -EFAULT; - if (get_user(pid, (int *)arg)) + if (get_user(pid, (int __user *)argp)) break; err = f_setown(sock->file, pid, 1); break; case FIOGETOWN: case SIOCGPGRP: - err = put_user(sock->file->f_owner.pid, (int *)arg); + err = put_user(sock->file->f_owner.pid, (int __user *)argp); break; case SIOCGIFBR: case SIOCSIFBR: @@ -804,7 +805,7 @@ down(&br_ioctl_mutex); if (br_ioctl_hook) - err = br_ioctl_hook(cmd, arg); + err = br_ioctl_hook(cmd, argp); up(&br_ioctl_mutex); break; case SIOCGIFVLAN: @@ -815,13 +816,13 @@ down(&vlan_ioctl_mutex); if (vlan_ioctl_hook) - err = vlan_ioctl_hook(arg); + err = vlan_ioctl_hook(argp); up(&vlan_ioctl_mutex); break; case SIOCGIFDIVERT: case SIOCSIFDIVERT: /* Convert this to call through a hook */ - err = divert_ioctl(cmd, (struct divert_cf *)arg); + err = divert_ioctl(cmd, argp); break; case SIOCADDDLCI: case SIOCDELDLCI: @@ -831,7 +832,7 @@ if (dlci_ioctl_hook) { down(&dlci_ioctl_mutex); - err = dlci_ioctl_hook(cmd, (void *)arg); + err = dlci_ioctl_hook(cmd, argp); up(&dlci_ioctl_mutex); } break; diff -urN linux-2.6.7-rc2/net/sunrpc/auth_gss/auth_gss.c linux-2.6.7-rc3/net/sunrpc/auth_gss/auth_gss.c --- linux-2.6.7-rc2/net/sunrpc/auth_gss/auth_gss.c 2004-06-07 12:54:53.922246138 -0700 +++ linux-2.6.7-rc3/net/sunrpc/auth_gss/auth_gss.c 2004-06-07 12:55:29.242709074 -0700 @@ -493,7 +493,7 @@ spin_unlock(&gss_auth->lock); rpc_release_client(clnt); kfree(obj.data); - dprintk("RPC: gss_pipe_downcall returning length %u\n", mlen); + dprintk("RPC: gss_pipe_downcall returning length %Zu\n", mlen); return mlen; err: if (ctx) diff -urN linux-2.6.7-rc2/net/sunrpc/auth_gss/svcauth_gss.c linux-2.6.7-rc3/net/sunrpc/auth_gss/svcauth_gss.c --- linux-2.6.7-rc2/net/sunrpc/auth_gss/svcauth_gss.c 2004-06-07 12:54:53.929246428 -0700 +++ linux-2.6.7-rc3/net/sunrpc/auth_gss/svcauth_gss.c 2004-06-07 12:55:29.248709323 -0700 @@ -333,6 +333,7 @@ new->handle.data = tmp->handle.data; tmp->handle.data = NULL; new->mechctx = NULL; + new->cred.cr_group_info = NULL; } static inline void @@ -453,8 +454,11 @@ struct rsc rsci; struct rsc *found; - rsci.handle = *handle; + memset(&rsci, 0, sizeof(rsci)); + if (dup_to_netobj(&rsci.handle, handle->data, handle->len)) + return NULL; found = rsc_lookup(&rsci, 0); + rsc_free(&rsci); if (!found) return NULL; if (cache_check(&rsc_cache, &found->h, NULL)) @@ -1045,6 +1049,7 @@ struct auth_ops svcauthops_gss = { .name = "rpcsec_gss", + .owner = THIS_MODULE, .flavour = RPC_AUTH_GSS, .accept = svcauth_gss_accept, .release = svcauth_gss_release, @@ -1054,10 +1059,12 @@ int gss_svc_init(void) { - cache_register(&rsc_cache); - cache_register(&rsi_cache); - svc_auth_register(RPC_AUTH_GSS, &svcauthops_gss); - return 0; + int rv = svc_auth_register(RPC_AUTH_GSS, &svcauthops_gss); + if (rv == 0) { + cache_register(&rsc_cache); + cache_register(&rsi_cache); + } + return rv; } void @@ -1065,4 +1072,5 @@ { cache_unregister(&rsc_cache); cache_unregister(&rsi_cache); + svc_auth_unregister(RPC_AUTH_GSS); } diff -urN linux-2.6.7-rc2/net/sunrpc/cache.c linux-2.6.7-rc3/net/sunrpc/cache.c --- linux-2.6.7-rc2/net/sunrpc/cache.c 2004-06-07 12:54:53.930246470 -0700 +++ linux-2.6.7-rc3/net/sunrpc/cache.c 2004-06-07 12:55:29.279710607 -0700 @@ -575,7 +575,7 @@ }; static ssize_t -cache_read(struct file *filp, char *buf, size_t count, loff_t *ppos) +cache_read(struct file *filp, char __user *buf, size_t count, loff_t *ppos) { struct cache_reader *rp = filp->private_data; struct cache_request *rq; @@ -656,7 +656,7 @@ static char write_buf[8192]; /* protected by queue_io_sem */ static ssize_t -cache_write(struct file *filp, const char *buf, size_t count, +cache_write(struct file *filp, const char __user *buf, size_t count, loff_t *ppos) { int err; @@ -743,7 +743,7 @@ } spin_unlock(&queue_lock); - return put_user(len, (int *)arg); + return put_user(len, (int __user *)arg); } static int @@ -1166,7 +1166,7 @@ .release = content_release, }; -static ssize_t read_flush(struct file *file, char *buf, +static ssize_t read_flush(struct file *file, char __user *buf, size_t count, loff_t *ppos) { struct cache_detail *cd = PDE(file->f_dentry->d_inode)->data; @@ -1187,7 +1187,7 @@ return len; } -static ssize_t write_flush(struct file * file, const char * buf, +static ssize_t write_flush(struct file * file, const char __user * buf, size_t count, loff_t *ppos) { struct cache_detail *cd = PDE(file->f_dentry->d_inode)->data; diff -urN linux-2.6.7-rc2/net/sunrpc/rpc_pipe.c linux-2.6.7-rc3/net/sunrpc/rpc_pipe.c --- linux-2.6.7-rc2/net/sunrpc/rpc_pipe.c 2004-05-09 19:32:27.000000000 -0700 +++ linux-2.6.7-rc3/net/sunrpc/rpc_pipe.c 2004-06-07 12:55:29.314712057 -0700 @@ -270,7 +270,7 @@ msg = (struct rpc_pipe_msg *)filp->private_data; len += msg->len - msg->copied; } - return put_user(len, (int *)arg); + return put_user(len, (int __user *)arg); default: return -EINVAL; } diff -urN linux-2.6.7-rc2/net/sunrpc/svcauth.c linux-2.6.7-rc3/net/sunrpc/svcauth.c --- linux-2.6.7-rc2/net/sunrpc/svcauth.c 2004-05-09 19:33:09.000000000 -0700 +++ linux-2.6.7-rc3/net/sunrpc/svcauth.c 2004-06-07 12:55:29.325712512 -0700 @@ -11,6 +11,7 @@ #include #include +#include #include #include #include @@ -27,6 +28,7 @@ extern struct auth_ops svcauth_null; extern struct auth_ops svcauth_unix; +static spinlock_t authtab_lock = SPIN_LOCK_UNLOCKED; static struct auth_ops *authtab[RPC_AUTH_MAXFLAVOR] = { [0] = &svcauth_null, [1] = &svcauth_unix, @@ -43,10 +45,15 @@ flavor = ntohl(svc_getu32(&rqstp->rq_arg.head[0])); dprintk("svc: svc_authenticate (%d)\n", flavor); - if (flavor >= RPC_AUTH_MAXFLAVOR || !(aops = authtab[flavor])) { + + spin_lock(&authtab_lock); + if (flavor >= RPC_AUTH_MAXFLAVOR || !(aops = authtab[flavor]) + || !try_module_get(aops->owner)) { + spin_unlock(&authtab_lock); *authp = rpc_autherr_badcred; return SVC_DENIED; } + spin_unlock(&authtab_lock); rqstp->rq_authop = aops; return aops->accept(rqstp, authp); @@ -63,28 +70,35 @@ rqstp->rq_authop = NULL; - if (aops) + if (aops) { rv = aops->release(rqstp); - - /* FIXME should I count and release authops */ + module_put(aops->owner); + } return rv; } int svc_auth_register(rpc_authflavor_t flavor, struct auth_ops *aops) { - if (flavor >= RPC_AUTH_MAXFLAVOR || authtab[flavor]) - return -EINVAL; - authtab[flavor] = aops; - return 0; + int rv = -EINVAL; + spin_lock(&authtab_lock); + if (flavor < RPC_AUTH_MAXFLAVOR && authtab[flavor] == NULL) { + authtab[flavor] = aops; + rv = 0; + } + spin_unlock(&authtab_lock); + return rv; } void svc_auth_unregister(rpc_authflavor_t flavor) { + spin_lock(&authtab_lock); if (flavor < RPC_AUTH_MAXFLAVOR) authtab[flavor] = NULL; + spin_unlock(&authtab_lock); } +EXPORT_SYMBOL(svc_auth_unregister); /************************************************** * cache for domain name to auth_domain diff -urN linux-2.6.7-rc2/net/sunrpc/svcauth_unix.c linux-2.6.7-rc3/net/sunrpc/svcauth_unix.c --- linux-2.6.7-rc2/net/sunrpc/svcauth_unix.c 2004-05-09 19:32:52.000000000 -0700 +++ linux-2.6.7-rc3/net/sunrpc/svcauth_unix.c 2004-06-07 12:55:29.325712512 -0700 @@ -1,5 +1,6 @@ #include #include +#include #include #include #include @@ -411,6 +412,7 @@ struct auth_ops svcauth_null = { .name = "null", + .owner = THIS_MODULE, .flavour = RPC_AUTH_NULL, .accept = svcauth_null_accept, .release = svcauth_null_release, @@ -515,6 +517,7 @@ struct auth_ops svcauth_unix = { .name = "unix", + .owner = THIS_MODULE, .flavour = RPC_AUTH_UNIX, .accept = svcauth_unix_accept, .release = svcauth_unix_release, diff -urN linux-2.6.7-rc2/net/sunrpc/sysctl.c linux-2.6.7-rc3/net/sunrpc/sysctl.c --- linux-2.6.7-rc2/net/sunrpc/sysctl.c 2004-05-09 19:31:59.000000000 -0700 +++ linux-2.6.7-rc3/net/sunrpc/sysctl.c 2004-06-07 12:55:29.327712595 -0700 @@ -58,9 +58,10 @@ static int proc_dodebug(ctl_table *table, int write, struct file *file, - void *buffer, size_t *lenp) + void __user *buffer, size_t *lenp) { - char tmpbuf[20], *p, c; + char tmpbuf[20], c, *s; + char __user *p; unsigned int value; size_t left, len; @@ -74,7 +75,7 @@ if (write) { if (!access_ok(VERIFY_READ, buffer, left)) return -EFAULT; - p = (char *) buffer; + p = buffer; while (left && __get_user(c, p) >= 0 && isspace(c)) left--, p++; if (!left) @@ -86,12 +87,12 @@ return -EFAULT; tmpbuf[left] = '\0'; - for (p = tmpbuf, value = 0; '0' <= *p && *p <= '9'; p++, left--) - value = 10 * value + (*p - '0'); - if (*p && !isspace(*p)) + for (s = tmpbuf, value = 0; '0' <= *s && *s <= '9'; s++, left--) + value = 10 * value + (*s - '0'); + if (*s && !isspace(*s)) return -EINVAL; - while (left && isspace(*p)) - left--, p++; + while (left && isspace(*s)) + left--, s++; *(unsigned int *) table->data = value; /* Display the RPC tasks on writing to rpc_debug */ if (table->ctl_name == CTL_RPCDEBUG) { @@ -106,7 +107,7 @@ if (__copy_to_user(buffer, tmpbuf, len)) return -EFAULT; if ((left -= len) > 0) { - if (put_user('\n', (char *)buffer + len)) + if (put_user('\n', (char __user *)buffer + len)) return -EFAULT; left--; } diff -urN linux-2.6.7-rc2/net/unix/af_unix.c linux-2.6.7-rc3/net/unix/af_unix.c --- linux-2.6.7-rc2/net/unix/af_unix.c 2004-05-09 19:32:52.000000000 -0700 +++ linux-2.6.7-rc3/net/unix/af_unix.c 2004-06-07 12:55:29.330712719 -0700 @@ -1829,7 +1829,7 @@ { case SIOCOUTQ: amount = atomic_read(&sk->sk_wmem_alloc); - err = put_user(amount, (int *)arg); + err = put_user(amount, (int __user *)arg); break; case SIOCINQ: { @@ -1844,12 +1844,12 @@ if (skb) amount=skb->len; spin_unlock(&sk->sk_receive_queue.lock); - err = put_user(amount, (int *)arg); + err = put_user(amount, (int __user *)arg); break; } default: - err = dev_ioctl(cmd, (void *)arg); + err = dev_ioctl(cmd, (void __user *)arg); break; } return err; diff -urN linux-2.6.7-rc2/net/wanrouter/af_wanpipe.c linux-2.6.7-rc3/net/wanrouter/af_wanpipe.c --- linux-2.6.7-rc2/net/wanrouter/af_wanpipe.c 2004-05-09 19:33:20.000000000 -0700 +++ linux-2.6.7-rc3/net/wanrouter/af_wanpipe.c 2004-06-07 12:55:29.333712844 -0700 @@ -552,7 +552,7 @@ if (sk->sk_state != WANSOCK_CONNECTED) return -ENOTCONN; - if (msg->msg_flags&~MSG_DONTWAIT) + if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_CMSG_COMPAT)) return(-EINVAL); /* it was <=, now one can send @@ -1765,7 +1765,7 @@ switch(cmd) { case SIOCGSTAMP: - return sock_get_timestamp(sk, (struct timeval *)arg); + return sock_get_timestamp(sk, (struct timeval __user *)arg); case SIOC_WANPIPE_CHECK_TX: @@ -1832,7 +1832,7 @@ #endif default: - return dev_ioctl(cmd,(void *) arg); + return dev_ioctl(cmd,(void __user *) arg); } /*NOTREACHED*/ } diff -urN linux-2.6.7-rc2/net/wanrouter/wanmain.c linux-2.6.7-rc3/net/wanrouter/wanmain.c --- linux-2.6.7-rc2/net/wanrouter/wanmain.c 2004-05-09 19:32:53.000000000 -0700 +++ linux-2.6.7-rc3/net/wanrouter/wanmain.c 2004-06-07 12:55:29.350713548 -0700 @@ -128,13 +128,14 @@ */ static int wanrouter_device_setup(struct wan_device *wandev, - wandev_conf_t *u_conf); + wandev_conf_t __user *u_conf); static int wanrouter_device_stat(struct wan_device *wandev, - wandev_stat_t *u_stat); + wandev_stat_t __user *u_stat); static int wanrouter_device_shutdown(struct wan_device *wandev); static int wanrouter_device_new_if(struct wan_device *wandev, - wanif_conf_t *u_conf); -static int wanrouter_device_del_if(struct wan_device *wandev, char *u_name); + wanif_conf_t __user *u_conf); +static int wanrouter_device_del_if(struct wan_device *wandev, + char __user *u_name); /* * Miscellaneous @@ -410,6 +411,7 @@ int err = 0; struct proc_dir_entry *dent; struct wan_device *wandev; + void __user *data = (void __user *)arg; if (!capable(CAP_NET_ADMIN)) return -EPERM; @@ -427,7 +429,7 @@ switch (cmd) { case ROUTER_SETUP: - err = wanrouter_device_setup(wandev, (void*)arg); + err = wanrouter_device_setup(wandev, data); break; case ROUTER_DOWN: @@ -435,15 +437,15 @@ break; case ROUTER_STAT: - err = wanrouter_device_stat(wandev, (void*)arg); + err = wanrouter_device_stat(wandev, data); break; case ROUTER_IFNEW: - err = wanrouter_device_new_if(wandev, (void*)arg); + err = wanrouter_device_new_if(wandev, data); break; case ROUTER_IFDEL: - err = wanrouter_device_del_if(wandev, (void*)arg); + err = wanrouter_device_del_if(wandev, data); break; case ROUTER_IFSTAT: @@ -472,7 +474,7 @@ */ static int wanrouter_device_setup(struct wan_device *wandev, - wandev_conf_t *u_conf) + wandev_conf_t __user *u_conf) { void *data = NULL; wandev_conf_t *conf; @@ -583,7 +585,7 @@ */ static int wanrouter_device_stat(struct wan_device *wandev, - wandev_stat_t *u_stat) + wandev_stat_t __user *u_stat) { wandev_stat_t stat; @@ -614,7 +616,7 @@ */ static int wanrouter_device_new_if(struct wan_device *wandev, - wanif_conf_t *u_conf) + wanif_conf_t __user *u_conf) { wanif_conf_t *cnf; struct net_device *dev = NULL; @@ -740,7 +742,7 @@ * o copy configuration data to kernel address space */ -static int wanrouter_device_del_if(struct wan_device *wandev, char *u_name) +static int wanrouter_device_del_if(struct wan_device *wandev, char __user *u_name) { char name[WAN_IFNAME_SZ + 1]; int err = 0; diff -urN linux-2.6.7-rc2/net/x25/af_x25.c linux-2.6.7-rc3/net/x25/af_x25.c --- linux-2.6.7-rc2/net/x25/af_x25.c 2004-06-07 12:54:53.948247215 -0700 +++ linux-2.6.7-rc3/net/x25/af_x25.c 2004-06-07 12:55:29.363714086 -0700 @@ -922,7 +922,7 @@ size_t size; int qbit = 0, rc = -EINVAL; - if (msg->msg_flags & ~(MSG_DONTWAIT | MSG_OOB | MSG_EOR)) + if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_OOB|MSG_EOR|MSG_CMSG_COMPAT)) goto out; /* we currently don't support segmented records at the user interface */ @@ -1180,6 +1180,7 @@ { struct sock *sk = sock->sk; struct x25_opt *x25 = x25_sk(sk); + void __user *argp = (void __user *)arg; int rc; switch (cmd) { @@ -1188,7 +1189,7 @@ atomic_read(&sk->sk_wmem_alloc); if (amount < 0) amount = 0; - rc = put_user(amount, (unsigned int *)arg); + rc = put_user(amount, (unsigned int __user *)argp); break; } @@ -1201,7 +1202,7 @@ */ if ((skb = skb_peek(&sk->sk_receive_queue)) != NULL) amount = skb->len; - rc = put_user(amount, (unsigned int *)arg); + rc = put_user(amount, (unsigned int __user *)argp); break; } @@ -1209,7 +1210,7 @@ rc = -EINVAL; if (sk) rc = sock_get_timestamp(sk, - (struct timeval *)arg); + (struct timeval __user *)argp); break; case SIOCGIFADDR: case SIOCSIFADDR: @@ -1228,20 +1229,20 @@ rc = -EPERM; if (!capable(CAP_NET_ADMIN)) break; - rc = x25_route_ioctl(cmd, (void *)arg); + rc = x25_route_ioctl(cmd, argp); break; case SIOCX25GSUBSCRIP: - rc = x25_subscr_ioctl(cmd, (void *)arg); + rc = x25_subscr_ioctl(cmd, argp); break; case SIOCX25SSUBSCRIP: rc = -EPERM; if (!capable(CAP_NET_ADMIN)) break; - rc = x25_subscr_ioctl(cmd, (void *)arg); + rc = x25_subscr_ioctl(cmd, argp); break; case SIOCX25GFACILITIES: { struct x25_facilities fac = x25->facilities; - rc = copy_to_user((void *)arg, &fac, + rc = copy_to_user(argp, &fac, sizeof(fac)) ? -EFAULT : 0; break; } @@ -1249,7 +1250,7 @@ case SIOCX25SFACILITIES: { struct x25_facilities facilities; rc = -EFAULT; - if (copy_from_user(&facilities, (void *)arg, + if (copy_from_user(&facilities, argp, sizeof(facilities))) break; rc = -EINVAL; @@ -1277,7 +1278,7 @@ case SIOCX25GCALLUSERDATA: { struct x25_calluserdata cud = x25->calluserdata; - rc = copy_to_user((void *)arg, &cud, + rc = copy_to_user(argp, &cud, sizeof(cud)) ? -EFAULT : 0; break; } @@ -1286,7 +1287,7 @@ struct x25_calluserdata calluserdata; rc = -EFAULT; - if (copy_from_user(&calluserdata, (void *)arg, + if (copy_from_user(&calluserdata, argp, sizeof(calluserdata))) break; rc = -EINVAL; @@ -1300,13 +1301,13 @@ case SIOCX25GCAUSEDIAG: { struct x25_causediag causediag; causediag = x25->causediag; - rc = copy_to_user((void *)arg, &causediag, + rc = copy_to_user(argp, &causediag, sizeof(causediag)) ? -EFAULT : 0; break; } default: - rc = dev_ioctl(cmd, (void *)arg); + rc = dev_ioctl(cmd, argp); break; } diff -urN linux-2.6.7-rc2/net/x25/x25_link.c linux-2.6.7-rc3/net/x25/x25_link.c --- linux-2.6.7-rc2/net/x25/x25_link.c 2004-05-09 19:31:59.000000000 -0700 +++ linux-2.6.7-rc3/net/x25/x25_link.c 2004-06-07 12:55:29.364714128 -0700 @@ -374,7 +374,7 @@ /* * Handle the ioctls that control the subscription functions. */ -int x25_subscr_ioctl(unsigned int cmd, void *arg) +int x25_subscr_ioctl(unsigned int cmd, void __user *arg) { struct x25_subscrip_struct x25_subscr; struct x25_neigh *nb; diff -urN linux-2.6.7-rc2/net/x25/x25_route.c linux-2.6.7-rc3/net/x25/x25_route.c --- linux-2.6.7-rc2/net/x25/x25_route.c 2004-05-09 19:32:54.000000000 -0700 +++ linux-2.6.7-rc3/net/x25/x25_route.c 2004-06-07 12:55:29.365714169 -0700 @@ -174,7 +174,7 @@ /* * Handle the ioctls that control the routing functions. */ -int x25_route_ioctl(unsigned int cmd, void *arg) +int x25_route_ioctl(unsigned int cmd, void __user *arg) { struct x25_route_struct rt; struct net_device *dev; diff -urN linux-2.6.7-rc2/net/xfrm/xfrm_state.c linux-2.6.7-rc3/net/xfrm/xfrm_state.c --- linux-2.6.7-rc2/net/xfrm/xfrm_state.c 2004-06-07 12:54:53.953247422 -0700 +++ linux-2.6.7-rc3/net/xfrm/xfrm_state.c 2004-06-07 12:55:29.368714293 -0700 @@ -231,7 +231,6 @@ void xfrm_state_delete(struct xfrm_state *x) { - xfrm_state_delete_tunnel(x); spin_lock_bh(&x->lock); __xfrm_state_delete(x); spin_unlock_bh(&x->lock); diff -urN linux-2.6.7-rc2/scripts/checkstack.pl linux-2.6.7-rc3/scripts/checkstack.pl --- linux-2.6.7-rc2/scripts/checkstack.pl 2004-06-07 12:54:53.953247422 -0700 +++ linux-2.6.7-rc3/scripts/checkstack.pl 2004-06-07 12:55:29.369714335 -0700 @@ -36,7 +36,7 @@ $re = qr/.*sub.*sp, sp, #(([0-9]{2}|[3-9])[0-9]{2})/o; } elsif ($arch =~ /^i[3456]86$/) { #c0105234: 81 ec ac 05 00 00 sub $0x5ac,%esp - $re = qr/^.*sub \$(0x$x{3,5}),\%esp$/o; + $re = qr/^.*[as][du][db] \$(0x$x{1,8}),\%esp$/o; } elsif ($arch =~ /^ia64$/) { #e0000000044011fc: 01 0f fc 8c adds r12=-384,r12 $re = qr/.*adds.*r12=-(([0-9]{2}|[3-9])[0-9]{2}),r12/o; @@ -48,10 +48,10 @@ $re = qr/.*addiu.*sp,sp,-(([0-9]{2}|[3-9])[0-9]{2})/o; } elsif ($arch =~ /^ppc$/) { #c00029f4: 94 21 ff 30 stwu r1,-208(r1) - $re = qr/.*stwu.*r1,-($x{3,5})\(r1\)/o; + $re = qr/.*stwu.*r1,-($x{1,8})\(r1\)/o; } elsif ($arch =~ /^ppc64$/) { #XXX - $re = qr/.*stdu.*r1,-($x{3,5})\(r1\)/o; + $re = qr/.*stdu.*r1,-($x{1,8})\(r1\)/o; } elsif ($arch =~ /^s390x?$/) { # 11160: a7 fb ff 60 aghi %r15,-160 $re = qr/.*ag?hi.*\%r15,-(([0-9]{2}|[3-9])[0-9]{2})/o; @@ -79,6 +79,12 @@ my $size = $1; $size = hex($size) if ($size =~ /^0x/); + if ($size > 0x80000000) { + $size = - $size; + $size += 0x80000000; + $size += 0x80000000; + } + $line =~ m/^($xs*).*/; my $addr = $1; $addr =~ s/ /0/g; @@ -90,6 +96,7 @@ $intro .= ' '; $padlen -= 8; } + next if ($size < 100); $stack[@stack] = "$intro$size\n"; } } diff -urN linux-2.6.7-rc2/scripts/reference_discarded.pl linux-2.6.7-rc3/scripts/reference_discarded.pl --- linux-2.6.7-rc2/scripts/reference_discarded.pl 2004-06-07 12:54:53.978248458 -0700 +++ linux-2.6.7-rc3/scripts/reference_discarded.pl 2004-06-07 12:55:29.391715246 -0700 @@ -106,4 +106,4 @@ } # printf("Done\n"); -exit($errorcount); +exit(0); diff -urN linux-2.6.7-rc2/scripts/reference_init.pl linux-2.6.7-rc3/scripts/reference_init.pl --- linux-2.6.7-rc2/scripts/reference_init.pl 1969-12-31 16:00:00.000000000 -0800 +++ linux-2.6.7-rc3/scripts/reference_init.pl 2004-06-07 12:55:29.391715246 -0700 @@ -0,0 +1,102 @@ +#!/usr/bin/perl -w +# +# reference_init.pl (C) Keith Owens 2002 +# +# List references to vmlinux init sections from non-init sections. + +# Unfortunately I had to exclude references from read only data to .init +# sections, almost all of these are false positives, they are created by +# gcc. The downside of excluding rodata is that there really are some +# user references from rodata to init code, e.g. drivers/video/vgacon.c +# +# const struct consw vga_con = { +# con_startup: vgacon_startup, +# +# where vgacon_startup is __init. If you want to wade through the false +# positives, take out the check for rodata. + +use strict; +die($0 . " takes no arguments\n") if($#ARGV >= 0); + +my %object; +my $object; +my $line; +my $ignore; + +$| = 1; + +printf("Finding objects, "); +open(OBJDUMP_LIST, "find . -name '*.o' | xargs objdump -h |") || die "getting objdump list failed"; +while (defined($line = )) { + chomp($line); + if ($line =~ /:\s+file format/) { + ($object = $line) =~ s/:.*//; + $object{$object}->{'module'} = 0; + $object{$object}->{'size'} = 0; + $object{$object}->{'off'} = 0; + } + if ($line =~ /^\s*\d+\s+\.modinfo\s+/) { + $object{$object}->{'module'} = 1; + } + if ($line =~ /^\s*\d+\s+\.comment\s+/) { + ($object{$object}->{'size'}, $object{$object}->{'off'}) = (split(' ', $line))[2,5]; + } +} +close(OBJDUMP_LIST); +printf("%d objects, ", scalar keys(%object)); +$ignore = 0; +foreach $object (keys(%object)) { + if ($object{$object}->{'module'}) { + ++$ignore; + delete($object{$object}); + } +} +printf("ignoring %d module(s)\n", $ignore); + +# Ignore conglomerate objects, they have been built from multiple objects and we +# only care about the individual objects. If an object has more than one GCC: +# string in the comment section then it is conglomerate. This does not filter +# out conglomerates that consist of exactly one object, can't be helped. + +printf("Finding conglomerates, "); +$ignore = 0; +foreach $object (keys(%object)) { + if (exists($object{$object}->{'off'})) { + my ($off, $size, $comment, $l); + $off = hex($object{$object}->{'off'}); + $size = hex($object{$object}->{'size'}); + open(OBJECT, "<$object") || die "cannot read $object"; + seek(OBJECT, $off, 0) || die "seek to $off in $object failed"; + $l = read(OBJECT, $comment, $size); + die "read $size bytes from $object .comment failed" if ($l != $size); + close(OBJECT); + if ($comment =~ /GCC\:.*GCC\:/m) { + ++$ignore; + delete($object{$object}); + } + } +} +printf("ignoring %d conglomerate(s)\n", $ignore); + +printf("Scanning objects\n"); +foreach $object (sort(keys(%object))) { + my $from; + open(OBJDUMP, "objdump -r $object|") || die "cannot objdump -r $object"; + while (defined($line = )) { + chomp($line); + if ($line =~ /RELOCATION RECORDS FOR /) { + ($from = $line) =~ s/.*\[([^]]*).*/$1/; + } + if (($line =~ /\.init$/ || $line =~ /\.init\./) && + ($from !~ /\.init$/ && + $from !~ /\.init\./ && + $from !~ /\.stab$/ && + $from !~ /\.rodata$/ && + $from !~ /\.text\.lock$/ && + $from !~ /\.debug_/)) { + printf("Error: %s %s refers to %s\n", $object, $from, $line); + } + } + close(OBJDUMP); +} +printf("Done\n"); diff -urN linux-2.6.7-rc2/security/selinux/Kconfig linux-2.6.7-rc3/security/selinux/Kconfig --- linux-2.6.7-rc2/security/selinux/Kconfig 2004-05-09 19:32:00.000000000 -0700 +++ linux-2.6.7-rc3/security/selinux/Kconfig 2004-06-07 12:55:29.467718394 -0700 @@ -1,6 +1,6 @@ config SECURITY_SELINUX bool "NSA SELinux Support" - depends on SECURITY + depends on SECURITY && NET default n help This selects NSA Security-Enhanced Linux (SELinux). diff -urN linux-2.6.7-rc2/security/selinux/selinuxfs.c linux-2.6.7-rc3/security/selinux/selinuxfs.c --- linux-2.6.7-rc2/security/selinux/selinuxfs.c 2004-06-07 12:54:54.110253925 -0700 +++ linux-2.6.7-rc3/security/selinux/selinuxfs.c 2004-06-07 12:55:29.498719679 -0700 @@ -68,7 +68,7 @@ SEL_DISABLE /* disable SELinux until next reboot */ }; -static ssize_t sel_read_enforce(struct file *filp, char *buf, +static ssize_t sel_read_enforce(struct file *filp, char __user *buf, size_t count, loff_t *ppos) { char *page; @@ -105,7 +105,7 @@ } #ifdef CONFIG_SECURITY_SELINUX_DEVELOP -static ssize_t sel_write_enforce(struct file * file, const char * buf, +static ssize_t sel_write_enforce(struct file * file, const char __user * buf, size_t count, loff_t *ppos) { @@ -155,7 +155,7 @@ }; #ifdef CONFIG_SECURITY_SELINUX_DISABLE -static ssize_t sel_write_disable(struct file * file, const char * buf, +static ssize_t sel_write_disable(struct file * file, const char __user * buf, size_t count, loff_t *ppos) { @@ -201,7 +201,7 @@ .write = sel_write_disable, }; -static ssize_t sel_read_policyvers(struct file *filp, char *buf, +static ssize_t sel_read_policyvers(struct file *filp, char __user *buf, size_t count, loff_t *ppos) { char *page; @@ -244,7 +244,7 @@ /* declaration for sel_write_load */ static int sel_make_bools(void); -static ssize_t sel_read_mls(struct file *filp, char *buf, +static ssize_t sel_read_mls(struct file *filp, char __user *buf, size_t count, loff_t *ppos) { char *page; @@ -284,7 +284,7 @@ .read = sel_read_mls, }; -static ssize_t sel_write_load(struct file * file, const char * buf, +static ssize_t sel_write_load(struct file * file, const char __user * buf, size_t count, loff_t *ppos) { @@ -334,7 +334,7 @@ }; -static ssize_t sel_write_context(struct file * file, const char * buf, +static ssize_t sel_write_context(struct file * file, const char __user * buf, size_t count, loff_t *ppos) { @@ -406,7 +406,7 @@ * possibly a read which collects the result - which is stored in a * file-local buffer. */ -static ssize_t TA_write(struct file *file, const char *buf, size_t size, loff_t *pos) +static ssize_t TA_write(struct file *file, const char __user *buf, size_t size, loff_t *pos) { ino_t ino = file->f_dentry->d_inode->i_ino; struct argresp *ar; @@ -445,7 +445,7 @@ return rv; } -static ssize_t TA_read(struct file *file, char *buf, size_t size, loff_t *pos) +static ssize_t TA_read(struct file *file, char __user *buf, size_t size, loff_t *pos) { struct argresp *ar; ssize_t rv = 0; @@ -744,7 +744,7 @@ #define BOOL_INO_OFFSET 30 -static ssize_t sel_read_bool(struct file *filep, char *buf, +static ssize_t sel_read_bool(struct file *filep, char __user *buf, size_t count, loff_t *ppos) { char *page = NULL; @@ -806,7 +806,7 @@ return ret; } -static ssize_t sel_write_bool(struct file *filep, const char *buf, +static ssize_t sel_write_bool(struct file *filep, const char __user *buf, size_t count, loff_t *ppos) { char *page = NULL; @@ -865,7 +865,8 @@ .write = sel_write_bool, }; -static ssize_t sel_commit_bools_write(struct file *filep, const char *buf, +static ssize_t sel_commit_bools_write(struct file *filep, + const char __user *buf, size_t count, loff_t *ppos) { char *page = NULL; diff -urN linux-2.6.7-rc2/security/selinux/ss/mls.c linux-2.6.7-rc3/security/selinux/ss/mls.c --- linux-2.6.7-rc2/security/selinux/ss/mls.c 2004-05-09 19:32:28.000000000 -0700 +++ linux-2.6.7-rc3/security/selinux/ss/mls.c 2004-06-07 12:55:29.516720424 -0700 @@ -290,7 +290,7 @@ if (rc) goto out; } - *scontext = p; + *scontext = ++p; rc = 0; out: return rc; diff -urN linux-2.6.7-rc2/security/selinux/ss/services.c linux-2.6.7-rc3/security/selinux/ss/services.c --- linux-2.6.7-rc2/security/selinux/ss/services.c 2004-05-09 19:33:19.000000000 -0700 +++ linux-2.6.7-rc3/security/selinux/ss/services.c 2004-06-07 12:55:29.531721045 -0700 @@ -532,6 +532,11 @@ if (rc) goto out_unlock; + if ((p - scontext2) < scontext_len) { + rc = -EINVAL; + goto out_unlock; + } + /* Check the validity of the new context. */ if (!policydb_context_isvalid(&policydb, &context)) { rc = -EINVAL; diff -urN linux-2.6.7-rc2/sound/core/control.c linux-2.6.7-rc3/sound/core/control.c --- linux-2.6.7-rc2/sound/core/control.c 2004-06-07 12:54:54.167256286 -0700 +++ linux-2.6.7-rc3/sound/core/control.c 2004-06-07 12:55:29.585723282 -0700 @@ -512,7 +512,7 @@ } static int snd_ctl_card_info(snd_card_t * card, snd_ctl_file_t * ctl, - unsigned int cmd, unsigned long arg) + unsigned int cmd, void __user *arg) { snd_ctl_card_info_t info; @@ -526,12 +526,12 @@ strlcpy(info.mixername, card->mixername, sizeof(info.mixername)); strlcpy(info.components, card->components, sizeof(info.components)); up_read(&snd_ioctl_rwsem); - if (copy_to_user((void *) arg, &info, sizeof(snd_ctl_card_info_t))) + if (copy_to_user(arg, &info, sizeof(snd_ctl_card_info_t))) return -EFAULT; return 0; } -static int snd_ctl_elem_list(snd_card_t *card, snd_ctl_elem_list_t *_list) +static int snd_ctl_elem_list(snd_card_t *card, snd_ctl_elem_list_t __user *_list) { struct list_head *plist; snd_ctl_elem_list_t list; @@ -593,7 +593,7 @@ return 0; } -static int snd_ctl_elem_info(snd_ctl_file_t *ctl, snd_ctl_elem_info_t *_info) +static int snd_ctl_elem_info(snd_ctl_file_t *ctl, snd_ctl_elem_info_t __user *_info) { snd_card_t *card = ctl->card; snd_ctl_elem_info_t info; @@ -636,7 +636,7 @@ return result; } -static int snd_ctl_elem_read(snd_card_t *card, snd_ctl_elem_value_t *_control) +static int snd_ctl_elem_read(snd_card_t *card, snd_ctl_elem_value_t __user *_control) { snd_ctl_elem_value_t *control; snd_kcontrol_t *kctl; @@ -676,7 +676,7 @@ return result; } -static int snd_ctl_elem_write(snd_ctl_file_t *file, snd_ctl_elem_value_t *_control) +static int snd_ctl_elem_write(snd_ctl_file_t *file, snd_ctl_elem_value_t __user *_control) { snd_card_t *card = file->card; snd_ctl_elem_value_t *control; @@ -726,7 +726,7 @@ return result; } -static int snd_ctl_elem_lock(snd_ctl_file_t *file, snd_ctl_elem_id_t *_id) +static int snd_ctl_elem_lock(snd_ctl_file_t *file, snd_ctl_elem_id_t __user *_id) { snd_card_t *card = file->card; snd_ctl_elem_id_t id; @@ -754,7 +754,7 @@ return result; } -static int snd_ctl_elem_unlock(snd_ctl_file_t *file, snd_ctl_elem_id_t *_id) +static int snd_ctl_elem_unlock(snd_ctl_file_t *file, snd_ctl_elem_id_t __user *_id) { snd_card_t *card = file->card; snd_ctl_elem_id_t id; @@ -840,7 +840,7 @@ kfree(kcontrol->private_data); } -static int snd_ctl_elem_add(snd_ctl_file_t *file, snd_ctl_elem_info_t *_info, int replace) +static int snd_ctl_elem_add(snd_ctl_file_t *file, snd_ctl_elem_info_t __user *_info, int replace) { snd_card_t *card = file->card; snd_ctl_elem_info_t info; @@ -965,7 +965,7 @@ return 0; } -static int snd_ctl_elem_remove(snd_ctl_file_t *file, snd_ctl_elem_id_t *_id) +static int snd_ctl_elem_remove(snd_ctl_file_t *file, snd_ctl_elem_id_t __user *_id) { snd_ctl_elem_id_t id; @@ -974,7 +974,7 @@ return snd_ctl_remove_unlocked_id(file, &id); } -static int snd_ctl_subscribe_events(snd_ctl_file_t *file, int *ptr) +static int snd_ctl_subscribe_events(snd_ctl_file_t *file, int __user *ptr) { int subscribe; if (get_user(subscribe, ptr)) @@ -1029,6 +1029,8 @@ snd_card_t *card; struct list_head *list; snd_kctl_ioctl_t *p; + void __user *argp = (void __user *)arg; + int __user *ip = argp; int err; ctl = snd_magic_cast(snd_ctl_file_t, file->private_data, return -ENXIO); @@ -1036,31 +1038,31 @@ snd_assert(card != NULL, return -ENXIO); switch (cmd) { case SNDRV_CTL_IOCTL_PVERSION: - return put_user(SNDRV_CTL_VERSION, (int *)arg) ? -EFAULT : 0; + return put_user(SNDRV_CTL_VERSION, ip) ? -EFAULT : 0; case SNDRV_CTL_IOCTL_CARD_INFO: - return snd_ctl_card_info(card, ctl, cmd, arg); + return snd_ctl_card_info(card, ctl, cmd, argp); case SNDRV_CTL_IOCTL_ELEM_LIST: - return snd_ctl_elem_list(ctl->card, (snd_ctl_elem_list_t *) arg); + return snd_ctl_elem_list(ctl->card, argp); case SNDRV_CTL_IOCTL_ELEM_INFO: - return snd_ctl_elem_info(ctl, (snd_ctl_elem_info_t *) arg); + return snd_ctl_elem_info(ctl, argp); case SNDRV_CTL_IOCTL_ELEM_READ: - return snd_ctl_elem_read(ctl->card, (snd_ctl_elem_value_t *) arg); + return snd_ctl_elem_read(ctl->card, argp); case SNDRV_CTL_IOCTL_ELEM_WRITE: - return snd_ctl_elem_write(ctl, (snd_ctl_elem_value_t *) arg); + return snd_ctl_elem_write(ctl, argp); case SNDRV_CTL_IOCTL_ELEM_LOCK: - return snd_ctl_elem_lock(ctl, (snd_ctl_elem_id_t *) arg); + return snd_ctl_elem_lock(ctl, argp); case SNDRV_CTL_IOCTL_ELEM_UNLOCK: - return snd_ctl_elem_unlock(ctl, (snd_ctl_elem_id_t *) arg); + return snd_ctl_elem_unlock(ctl, argp); case SNDRV_CTL_IOCTL_ELEM_ADD: - return snd_ctl_elem_add(ctl, (snd_ctl_elem_info_t *) arg, 0); + return snd_ctl_elem_add(ctl, argp, 0); case SNDRV_CTL_IOCTL_ELEM_REPLACE: - return snd_ctl_elem_add(ctl, (snd_ctl_elem_info_t *) arg, 1); + return snd_ctl_elem_add(ctl, argp, 1); case SNDRV_CTL_IOCTL_ELEM_REMOVE: - return snd_ctl_elem_remove(ctl, (snd_ctl_elem_id_t *) arg); + return snd_ctl_elem_remove(ctl, argp); case SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS: - return snd_ctl_subscribe_events(ctl, (int *) arg); + return snd_ctl_subscribe_events(ctl, ip); case SNDRV_CTL_IOCTL_POWER: - if (get_user(err, (int *)arg)) + if (get_user(err, ip)) return -EFAULT; if (!capable(CAP_SYS_ADMIN)) return -EPERM; @@ -1075,9 +1077,9 @@ return err; case SNDRV_CTL_IOCTL_POWER_STATE: #ifdef CONFIG_PM - return put_user(card->power_state, (int *)arg) ? -EFAULT : 0; + return put_user(card->power_state, ip) ? -EFAULT : 0; #else - return put_user(SNDRV_CTL_POWER_D0, (int *)arg) ? -EFAULT : 0; + return put_user(SNDRV_CTL_POWER_D0, ip) ? -EFAULT : 0; #endif } down_read(&snd_ioctl_rwsem); @@ -1094,7 +1096,7 @@ return -ENOTTY; } -static ssize_t snd_ctl_read(struct file *file, char *buffer, size_t count, loff_t * offset) +static ssize_t snd_ctl_read(struct file *file, char __user *buffer, size_t count, loff_t * offset) { snd_ctl_file_t *ctl; int err = 0; diff -urN linux-2.6.7-rc2/sound/core/hwdep.c linux-2.6.7-rc3/sound/core/hwdep.c --- linux-2.6.7-rc2/sound/core/hwdep.c 2004-05-09 19:31:59.000000000 -0700 +++ linux-2.6.7-rc3/sound/core/hwdep.c 2004-06-07 12:55:29.612724401 -0700 @@ -55,7 +55,7 @@ return -ENXIO; } -static ssize_t snd_hwdep_read(struct file * file, char *buf, size_t count, loff_t *offset) +static ssize_t snd_hwdep_read(struct file * file, char __user *buf, size_t count, loff_t *offset) { snd_hwdep_t *hw = snd_magic_cast(snd_hwdep_t, file->private_data, return -ENXIO); if (hw->ops.read) @@ -63,7 +63,7 @@ return -ENXIO; } -static ssize_t snd_hwdep_write(struct file * file, const char *buf, size_t count, loff_t *offset) +static ssize_t snd_hwdep_write(struct file * file, const char __user *buf, size_t count, loff_t *offset) { snd_hwdep_t *hw = snd_magic_cast(snd_hwdep_t, file->private_data, return -ENXIO); if (hw->ops.write) @@ -179,7 +179,7 @@ return 0; } -static int snd_hwdep_info(snd_hwdep_t *hw, snd_hwdep_info_t *_info) +static int snd_hwdep_info(snd_hwdep_t *hw, snd_hwdep_info_t __user *_info) { snd_hwdep_info_t info; @@ -193,7 +193,7 @@ return 0; } -static int snd_hwdep_dsp_status(snd_hwdep_t *hw, snd_hwdep_dsp_status_t *_info) +static int snd_hwdep_dsp_status(snd_hwdep_t *hw, snd_hwdep_dsp_status_t __user *_info) { snd_hwdep_dsp_status_t info; int err; @@ -209,7 +209,7 @@ return 0; } -static int snd_hwdep_dsp_load(snd_hwdep_t *hw, snd_hwdep_dsp_image_t *_info) +static int snd_hwdep_dsp_load(snd_hwdep_t *hw, snd_hwdep_dsp_image_t __user *_info) { snd_hwdep_dsp_image_t info; int err; @@ -235,15 +235,16 @@ unsigned int cmd, unsigned long arg) { snd_hwdep_t *hw = snd_magic_cast(snd_hwdep_t, file->private_data, return -ENXIO); + void __user *argp = (void __user *)arg; switch (cmd) { case SNDRV_HWDEP_IOCTL_PVERSION: - return put_user(SNDRV_HWDEP_VERSION, (int *)arg); + return put_user(SNDRV_HWDEP_VERSION, (int __user *)argp); case SNDRV_HWDEP_IOCTL_INFO: - return snd_hwdep_info(hw, (snd_hwdep_info_t *)arg); + return snd_hwdep_info(hw, argp); case SNDRV_HWDEP_IOCTL_DSP_STATUS: - return snd_hwdep_dsp_status(hw, (snd_hwdep_dsp_status_t *)arg); + return snd_hwdep_dsp_status(hw, argp); case SNDRV_HWDEP_IOCTL_DSP_LOAD: - return snd_hwdep_dsp_load(hw, (snd_hwdep_dsp_image_t *)arg); + return snd_hwdep_dsp_load(hw, argp); } if (hw->ops.ioctl) return hw->ops.ioctl(hw, file, cmd, arg); @@ -269,7 +270,7 @@ { int device; - if (get_user(device, (int *)arg)) + if (get_user(device, (int __user *)arg)) return -EFAULT; device = device < 0 ? 0 : device + 1; while (device < SNDRV_MINOR_HWDEPS) { @@ -279,13 +280,13 @@ } if (device >= SNDRV_MINOR_HWDEPS) device = -1; - if (put_user(device, (int *)arg)) + if (put_user(device, (int __user *)arg)) return -EFAULT; return 0; } case SNDRV_CTL_IOCTL_HWDEP_INFO: { - snd_hwdep_info_t *info = (snd_hwdep_info_t *)arg; + snd_hwdep_info_t __user *info = (snd_hwdep_info_t __user *)arg; int device; snd_hwdep_t *hwdep; diff -urN linux-2.6.7-rc2/sound/core/info.c linux-2.6.7-rc3/sound/core/info.c --- linux-2.6.7-rc2/sound/core/info.c 2004-05-09 19:33:20.000000000 -0700 +++ linux-2.6.7-rc3/sound/core/info.c 2004-06-07 12:55:29.618724649 -0700 @@ -174,7 +174,7 @@ return ret; } -static ssize_t snd_info_entry_read(struct file *file, char *buffer, +static ssize_t snd_info_entry_read(struct file *file, char __user *buffer, size_t count, loff_t * offset) { snd_info_private_data_t *data; @@ -208,7 +208,7 @@ return size; } -static ssize_t snd_info_entry_write(struct file *file, const char *buffer, +static ssize_t snd_info_entry_write(struct file *file, const char __user *buffer, size_t count, loff_t * offset) { snd_info_private_data_t *data; diff -urN linux-2.6.7-rc2/sound/core/memory.c linux-2.6.7-rc3/sound/core/memory.c --- linux-2.6.7-rc2/sound/core/memory.c 2004-05-09 19:31:59.000000000 -0700 +++ linux-2.6.7-rc3/sound/core/memory.c 2004-06-07 12:55:29.633725271 -0700 @@ -307,7 +307,7 @@ * * Returns zero if successful, or non-zero on failure. */ -int copy_to_user_fromio(void *dst, unsigned long src, size_t count) +int copy_to_user_fromio(void __user *dst, unsigned long src, size_t count) { #if defined(__i386__) || defined(CONFIG_SPARC32) return copy_to_user(dst, (const void*)src, count) ? -EFAULT : 0; @@ -338,7 +338,7 @@ * * Returns zero if successful, or non-zero on failure. */ -int copy_from_user_toio(unsigned long dst, const void *src, size_t count) +int copy_from_user_toio(unsigned long dst, const void __user *src, size_t count) { #if defined(__i386__) || defined(CONFIG_SPARC32) return copy_from_user((void*)dst, src, count) ? -EFAULT : 0; diff -urN linux-2.6.7-rc2/sound/core/oss/mixer_oss.c linux-2.6.7-rc3/sound/core/oss/mixer_oss.c --- linux-2.6.7-rc2/sound/core/oss/mixer_oss.c 2004-05-09 19:32:52.000000000 -0700 +++ linux-2.6.7-rc3/sound/core/oss/mixer_oss.c 2004-06-07 12:55:29.658726306 -0700 @@ -81,7 +81,7 @@ } static int snd_mixer_oss_info(snd_mixer_oss_file_t *fmixer, - mixer_info *_info) + mixer_info __user *_info) { snd_card_t *card = fmixer->card; snd_mixer_oss_t *mixer = fmixer->mixer; @@ -97,7 +97,7 @@ } static int snd_mixer_oss_info_obsolete(snd_mixer_oss_file_t *fmixer, - _old_mixer_info *_info) + _old_mixer_info __user *_info) { snd_card_t *card = fmixer->card; snd_mixer_oss_t *mixer = fmixer->mixer; @@ -293,65 +293,67 @@ static int snd_mixer_oss_ioctl1(snd_mixer_oss_file_t *fmixer, unsigned int cmd, unsigned long arg) { + void __user *argp = (void __user *)arg; + int __user *p = argp; int tmp; snd_assert(fmixer != NULL, return -ENXIO); if (((cmd >> 8) & 0xff) == 'M') { switch (cmd) { case SOUND_MIXER_INFO: - return snd_mixer_oss_info(fmixer, (mixer_info *)arg); + return snd_mixer_oss_info(fmixer, argp); case SOUND_OLD_MIXER_INFO: - return snd_mixer_oss_info_obsolete(fmixer, (_old_mixer_info *)arg); + return snd_mixer_oss_info_obsolete(fmixer, argp); case SOUND_MIXER_WRITE_RECSRC: - if (get_user(tmp, (int *)arg)) + if (get_user(tmp, p)) return -EFAULT; tmp = snd_mixer_oss_set_recsrc(fmixer, tmp); if (tmp < 0) return tmp; - return put_user(tmp, (int *)arg); + return put_user(tmp, p); case OSS_GETVERSION: - return put_user(SNDRV_OSS_VERSION, (int *) arg); + return put_user(SNDRV_OSS_VERSION, p); case OSS_ALSAEMULVER: - return put_user(1, (int *) arg); + return put_user(1, p); case SOUND_MIXER_READ_DEVMASK: tmp = snd_mixer_oss_devmask(fmixer); if (tmp < 0) return tmp; - return put_user(tmp, (int *)arg); + return put_user(tmp, p); case SOUND_MIXER_READ_STEREODEVS: tmp = snd_mixer_oss_stereodevs(fmixer); if (tmp < 0) return tmp; - return put_user(tmp, (int *)arg); + return put_user(tmp, p); case SOUND_MIXER_READ_RECMASK: tmp = snd_mixer_oss_recmask(fmixer); if (tmp < 0) return tmp; - return put_user(tmp, (int *)arg); + return put_user(tmp, p); case SOUND_MIXER_READ_CAPS: tmp = snd_mixer_oss_caps(fmixer); if (tmp < 0) return tmp; - return put_user(tmp, (int *)arg); + return put_user(tmp, p); case SOUND_MIXER_READ_RECSRC: tmp = snd_mixer_oss_get_recsrc(fmixer); if (tmp < 0) return tmp; - return put_user(tmp, (int *)arg); + return put_user(tmp, p); } } if (cmd & SIOC_IN) { - if (get_user(tmp, (int *)arg)) + if (get_user(tmp, p)) return -EFAULT; tmp = snd_mixer_oss_set_volume(fmixer, cmd & 0xff, tmp); if (tmp < 0) return tmp; - return put_user(tmp, (int *)arg); + return put_user(tmp, p); } else if (cmd & SIOC_OUT) { tmp = snd_mixer_oss_get_volume(fmixer, cmd & 0xff); if (tmp < 0) return tmp; - return put_user(tmp, (int *)arg); + return put_user(tmp, p); } return -ENXIO; } diff -urN linux-2.6.7-rc2/sound/core/oss/pcm_oss.c linux-2.6.7-rc3/sound/core/oss/pcm_oss.c --- linux-2.6.7-rc2/sound/core/oss/pcm_oss.c 2004-06-07 12:54:54.197257528 -0700 +++ linux-2.6.7-rc3/sound/core/oss/pcm_oss.c 2004-06-07 12:55:29.682727300 -0700 @@ -806,7 +806,7 @@ return bytes; } -static ssize_t snd_pcm_oss_write1(snd_pcm_substream_t *substream, const char *buf, size_t bytes) +static ssize_t snd_pcm_oss_write1(snd_pcm_substream_t *substream, const char __user *buf, size_t bytes) { size_t xfer = 0; ssize_t tmp; @@ -883,7 +883,7 @@ return bytes; } -static ssize_t snd_pcm_oss_read1(snd_pcm_substream_t *substream, char *buf, size_t bytes) +static ssize_t snd_pcm_oss_read1(snd_pcm_substream_t *substream, char __user *buf, size_t bytes) { size_t xfer = 0; ssize_t tmp; @@ -1067,9 +1067,9 @@ snd_pcm_lib_write(substream, runtime->oss.buffer, size1); } } else if (runtime->access == SNDRV_PCM_ACCESS_RW_NONINTERLEAVED) { - void *buffers[runtime->channels]; + void __user *buffers[runtime->channels]; memset(buffers, 0, runtime->channels * sizeof(void *)); - snd_pcm_lib_writev(substream, (void **)buffers, size); + snd_pcm_lib_writev(substream, buffers, size); } } /* @@ -1468,7 +1468,7 @@ return snd_pcm_oss_bytes(substream, delay); } -static int snd_pcm_oss_get_ptr(snd_pcm_oss_file_t *pcm_oss_file, int stream, struct count_info * _info) +static int snd_pcm_oss_get_ptr(snd_pcm_oss_file_t *pcm_oss_file, int stream, struct count_info __user * _info) { snd_pcm_substream_t *substream; snd_pcm_runtime_t *runtime; @@ -1530,7 +1530,7 @@ return 0; } -static int snd_pcm_oss_get_space(snd_pcm_oss_file_t *pcm_oss_file, int stream, struct audio_buf_info *_info) +static int snd_pcm_oss_get_space(snd_pcm_oss_file_t *pcm_oss_file, int stream, struct audio_buf_info __user *_info) { snd_pcm_substream_t *substream; snd_pcm_runtime_t *runtime; @@ -1589,7 +1589,7 @@ return 0; } -static int snd_pcm_oss_get_mapbuf(snd_pcm_oss_file_t *pcm_oss_file, int stream, struct buffmem_desc * _info) +static int snd_pcm_oss_get_mapbuf(snd_pcm_oss_file_t *pcm_oss_file, int stream, struct buffmem_desc __user * _info) { // it won't be probably implemented // snd_printd("TODO: snd_pcm_oss_get_mapbuf\n"); @@ -1912,13 +1912,14 @@ unsigned int cmd, unsigned long arg) { snd_pcm_oss_file_t *pcm_oss_file; + int __user *p = (int __user *)arg; int res; pcm_oss_file = snd_magic_cast(snd_pcm_oss_file_t, file->private_data, return -ENXIO); if (cmd == OSS_GETVERSION) - return put_user(SNDRV_OSS_VERSION, (int *)arg); + return put_user(SNDRV_OSS_VERSION, p); if (cmd == OSS_ALSAEMULVER) - return put_user(1, (int *)arg); + return put_user(1, p); #if defined(CONFIG_SND_MIXER_OSS) || (defined(MODULE) && defined(CONFIG_SND_MIXER_OSS_MODULE)) if (((cmd >> 8) & 0xff) == 'M') { /* mixer ioctl - for OSS compatibility */ snd_pcm_substream_t *substream; @@ -1943,93 +1944,93 @@ case SNDCTL_DSP_SYNC: return snd_pcm_oss_sync(pcm_oss_file); case SNDCTL_DSP_SPEED: - if (get_user(res, (int *)arg)) + if (get_user(res, p)) return -EFAULT; if ((res = snd_pcm_oss_set_rate(pcm_oss_file, res))<0) return res; - return put_user(res, (int *)arg); + return put_user(res, p); case SOUND_PCM_READ_RATE: res = snd_pcm_oss_get_rate(pcm_oss_file); if (res < 0) return res; - return put_user(res, (int *)arg); + return put_user(res, p); case SNDCTL_DSP_STEREO: - if (get_user(res, (int *)arg)) + if (get_user(res, p)) return -EFAULT; res = res > 0 ? 2 : 1; if ((res = snd_pcm_oss_set_channels(pcm_oss_file, res)) < 0) return res; - return put_user(--res, (int *)arg); + return put_user(--res, p); case SNDCTL_DSP_GETBLKSIZE: res = snd_pcm_oss_get_block_size(pcm_oss_file); if (res < 0) return res; - return put_user(res, (int *)arg); + return put_user(res, p); case SNDCTL_DSP_SETFMT: - if (get_user(res, (int *)arg)) + if (get_user(res, p)) return -EFAULT; res = snd_pcm_oss_set_format(pcm_oss_file, res); if (res < 0) return res; - return put_user(res, (int *)arg); + return put_user(res, p); case SOUND_PCM_READ_BITS: res = snd_pcm_oss_get_format(pcm_oss_file); if (res < 0) return res; - return put_user(res, (int *)arg); + return put_user(res, p); case SNDCTL_DSP_CHANNELS: - if (get_user(res, (int *)arg)) + if (get_user(res, p)) return -EFAULT; res = snd_pcm_oss_set_channels(pcm_oss_file, res); if (res < 0) return res; - return put_user(res, (int *)arg); + return put_user(res, p); case SOUND_PCM_READ_CHANNELS: res = snd_pcm_oss_get_channels(pcm_oss_file); if (res < 0) return res; - return put_user(res, (int *)arg); + return put_user(res, p); case SOUND_PCM_WRITE_FILTER: case SOUND_PCM_READ_FILTER: return -EIO; case SNDCTL_DSP_POST: return snd_pcm_oss_post(pcm_oss_file); case SNDCTL_DSP_SUBDIVIDE: - if (get_user(res, (int *)arg)) + if (get_user(res, p)) return -EFAULT; res = snd_pcm_oss_set_subdivide(pcm_oss_file, res); if (res < 0) return res; - return put_user(res, (int *)arg); + return put_user(res, p); case SNDCTL_DSP_SETFRAGMENT: - if (get_user(res, (int *)arg)) + if (get_user(res, p)) return -EFAULT; return snd_pcm_oss_set_fragment(pcm_oss_file, res); case SNDCTL_DSP_GETFMTS: res = snd_pcm_oss_get_formats(pcm_oss_file); if (res < 0) return res; - return put_user(res, (int *)arg); + return put_user(res, p); case SNDCTL_DSP_GETOSPACE: case SNDCTL_DSP_GETISPACE: return snd_pcm_oss_get_space(pcm_oss_file, cmd == SNDCTL_DSP_GETISPACE ? SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK, - (struct audio_buf_info *) arg); + (struct audio_buf_info __user *) arg); case SNDCTL_DSP_NONBLOCK: return snd_pcm_oss_nonblock(file); case SNDCTL_DSP_GETCAPS: res = snd_pcm_oss_get_caps(pcm_oss_file); if (res < 0) return res; - return put_user(res, (int *)arg); + return put_user(res, p); case SNDCTL_DSP_GETTRIGGER: res = snd_pcm_oss_get_trigger(pcm_oss_file); if (res < 0) return res; - return put_user(res, (int *)arg); + return put_user(res, p); case SNDCTL_DSP_SETTRIGGER: - if (get_user(res, (int *)arg)) + if (get_user(res, p)) return -EFAULT; return snd_pcm_oss_set_trigger(pcm_oss_file, res); case SNDCTL_DSP_GETIPTR: @@ -2037,13 +2038,13 @@ return snd_pcm_oss_get_ptr(pcm_oss_file, cmd == SNDCTL_DSP_GETIPTR ? SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK, - (struct count_info *) arg); + (struct count_info __user *) arg); case SNDCTL_DSP_MAPINBUF: case SNDCTL_DSP_MAPOUTBUF: return snd_pcm_oss_get_mapbuf(pcm_oss_file, cmd == SNDCTL_DSP_MAPINBUF ? SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK, - (struct buffmem_desc *) arg); + (struct buffmem_desc __user *) arg); case SNDCTL_DSP_SETSYNCRO: /* stop DMA now.. */ return 0; @@ -2055,10 +2056,10 @@ res = snd_pcm_oss_get_odelay(pcm_oss_file); if (res < 0) { /* it's for sure, some broken apps don't check for error codes */ - put_user(0, (int *)arg); + put_user(0, p); return res; } - return put_user(res, (int *)arg); + return put_user(res, p); case SNDCTL_DSP_PROFILE: return 0; /* silently ignore */ default: @@ -2067,7 +2068,7 @@ return -EINVAL; } -static ssize_t snd_pcm_oss_read(struct file *file, char *buf, size_t count, loff_t *offset) +static ssize_t snd_pcm_oss_read(struct file *file, char __user *buf, size_t count, loff_t *offset) { snd_pcm_oss_file_t *pcm_oss_file; snd_pcm_substream_t *substream; @@ -2087,7 +2088,7 @@ #endif } -static ssize_t snd_pcm_oss_write(struct file *file, const char *buf, size_t count, loff_t *offset) +static ssize_t snd_pcm_oss_write(struct file *file, const char __user *buf, size_t count, loff_t *offset) { snd_pcm_oss_file_t *pcm_oss_file; snd_pcm_substream_t *substream; diff -urN linux-2.6.7-rc2/sound/core/pcm.c linux-2.6.7-rc3/sound/core/pcm.c --- linux-2.6.7-rc2/sound/core/pcm.c 2004-05-09 19:33:21.000000000 -0700 +++ linux-2.6.7-rc3/sound/core/pcm.c 2004-06-07 12:55:29.692727715 -0700 @@ -55,7 +55,7 @@ { int device; - if (get_user(device, (int *)arg)) + if (get_user(device, (int __user *)arg)) return -EFAULT; device = device < 0 ? 0 : device + 1; while (device < SNDRV_PCM_DEVICES) { @@ -65,18 +65,19 @@ } if (device == SNDRV_PCM_DEVICES) device = -1; - if (put_user(device, (int *)arg)) + if (put_user(device, (int __user *)arg)) return -EFAULT; return 0; } case SNDRV_CTL_IOCTL_PCM_INFO: { - snd_pcm_info_t *info = (snd_pcm_info_t *)arg; + snd_pcm_info_t __user *info; unsigned int device, subdevice; snd_pcm_stream_t stream; snd_pcm_t *pcm; snd_pcm_str_t *pstr; snd_pcm_substream_t *substream; + info = (snd_pcm_info_t __user *)arg; if (get_user(device, &info->device)) return -EFAULT; if (device >= SNDRV_PCM_DEVICES) @@ -106,7 +107,7 @@ { int val; - if (get_user(val, (int *)arg)) + if (get_user(val, (int __user *)arg)) return -EFAULT; control->prefer_pcm_subdevice = val; return 0; diff -urN linux-2.6.7-rc2/sound/core/pcm_lib.c linux-2.6.7-rc3/sound/core/pcm_lib.c --- linux-2.6.7-rc2/sound/core/pcm_lib.c 2004-05-09 19:32:28.000000000 -0700 +++ linux-2.6.7-rc3/sound/core/pcm_lib.c 2004-06-07 12:55:29.696727880 -0700 @@ -2049,12 +2049,12 @@ static int snd_pcm_lib_write_transfer(snd_pcm_substream_t *substream, unsigned int hwoff, - void *data, unsigned int off, + unsigned long data, unsigned int off, snd_pcm_uframes_t frames) { snd_pcm_runtime_t *runtime = substream->runtime; int err; - char *buf = (char *) data + frames_to_bytes(runtime, off); + char __user *buf = (char __user *) data + frames_to_bytes(runtime, off); if (substream->ops->copy) { if ((err = substream->ops->copy(substream, -1, hwoff, buf, frames)) < 0) return err; @@ -2068,10 +2068,12 @@ } typedef int (*transfer_f)(snd_pcm_substream_t *substream, unsigned int hwoff, - void *data, unsigned int off, snd_pcm_uframes_t size); + unsigned long data, unsigned int off, + snd_pcm_uframes_t size); static snd_pcm_sframes_t snd_pcm_lib_write1(snd_pcm_substream_t *substream, - const void *data, snd_pcm_uframes_t size, + unsigned long data, + snd_pcm_uframes_t size, int nonblock, transfer_f transfer) { @@ -2186,7 +2188,7 @@ appl_ptr = runtime->control->appl_ptr; appl_ofs = appl_ptr % runtime->buffer_size; snd_pcm_stream_unlock_irq(substream); - if ((err = transfer(substream, appl_ofs, (void *)data, offset, frames)) < 0) + if ((err = transfer(substream, appl_ofs, data, offset, frames)) < 0) goto _end; snd_pcm_stream_lock_irq(substream); switch (runtime->status->state) { @@ -2227,7 +2229,7 @@ return xfer > 0 ? (snd_pcm_sframes_t)xfer : err; } -snd_pcm_sframes_t snd_pcm_lib_write(snd_pcm_substream_t *substream, const void *buf, snd_pcm_uframes_t size) +snd_pcm_sframes_t snd_pcm_lib_write(snd_pcm_substream_t *substream, const void __user *buf, snd_pcm_uframes_t size) { snd_pcm_runtime_t *runtime; int nonblock; @@ -2256,18 +2258,18 @@ if (runtime->access != SNDRV_PCM_ACCESS_RW_INTERLEAVED && runtime->channels > 1) return -EINVAL; - return snd_pcm_lib_write1(substream, buf, size, nonblock, + return snd_pcm_lib_write1(substream, (unsigned long)buf, size, nonblock, snd_pcm_lib_write_transfer); } static int snd_pcm_lib_writev_transfer(snd_pcm_substream_t *substream, unsigned int hwoff, - void *data, unsigned int off, + unsigned long data, unsigned int off, snd_pcm_uframes_t frames) { snd_pcm_runtime_t *runtime = substream->runtime; int err; - void **bufs = data; + void __user **bufs = (void __user **)data; int channels = runtime->channels; int c; if (substream->ops->copy) { @@ -2277,7 +2279,7 @@ if ((err = substream->ops->silence(substream, c, hwoff, frames)) < 0) return err; } else { - char *buf = *bufs + samples_to_bytes(runtime, off); + char __user *buf = *bufs + samples_to_bytes(runtime, off); if ((err = substream->ops->copy(substream, c, hwoff, buf, frames)) < 0) return err; } @@ -2291,7 +2293,7 @@ if (*bufs == NULL) { snd_pcm_format_set_silence(runtime->format, hwbuf, frames); } else { - char *buf = *bufs + samples_to_bytes(runtime, off); + char __user *buf = *bufs + samples_to_bytes(runtime, off); if (copy_from_user(hwbuf, buf, samples_to_bytes(runtime, frames))) return -EFAULT; } @@ -2300,7 +2302,8 @@ return 0; } -snd_pcm_sframes_t snd_pcm_lib_writev(snd_pcm_substream_t *substream, void **bufs, +snd_pcm_sframes_t snd_pcm_lib_writev(snd_pcm_substream_t *substream, + void __user **bufs, snd_pcm_uframes_t frames) { snd_pcm_runtime_t *runtime; @@ -2329,18 +2332,18 @@ if (runtime->access != SNDRV_PCM_ACCESS_RW_NONINTERLEAVED) return -EINVAL; - return snd_pcm_lib_write1(substream, bufs, frames, nonblock, - snd_pcm_lib_writev_transfer); + return snd_pcm_lib_write1(substream, (unsigned long)bufs, frames, + nonblock, snd_pcm_lib_writev_transfer); } static int snd_pcm_lib_read_transfer(snd_pcm_substream_t *substream, unsigned int hwoff, - void *data, unsigned int off, + unsigned long data, unsigned int off, snd_pcm_uframes_t frames) { snd_pcm_runtime_t *runtime = substream->runtime; int err; - char *buf = (char *) data + frames_to_bytes(runtime, off); + char __user *buf = (char __user *) data + frames_to_bytes(runtime, off); if (substream->ops->copy) { if ((err = substream->ops->copy(substream, -1, hwoff, buf, frames)) < 0) return err; @@ -2353,7 +2356,10 @@ return 0; } -static snd_pcm_sframes_t snd_pcm_lib_read1(snd_pcm_substream_t *substream, void *data, snd_pcm_uframes_t size, int nonblock, +static snd_pcm_sframes_t snd_pcm_lib_read1(snd_pcm_substream_t *substream, + unsigned long data, + snd_pcm_uframes_t size, + int nonblock, transfer_f transfer) { snd_pcm_runtime_t *runtime = substream->runtime; @@ -2481,7 +2487,7 @@ appl_ptr = runtime->control->appl_ptr; appl_ofs = appl_ptr % runtime->buffer_size; snd_pcm_stream_unlock_irq(substream); - if ((err = transfer(substream, appl_ofs, (void *)data, offset, frames)) < 0) + if ((err = transfer(substream, appl_ofs, data, offset, frames)) < 0) goto _end; snd_pcm_stream_lock_irq(substream); switch (runtime->status->state) { @@ -2516,7 +2522,7 @@ return xfer > 0 ? (snd_pcm_sframes_t)xfer : err; } -snd_pcm_sframes_t snd_pcm_lib_read(snd_pcm_substream_t *substream, void *buf, snd_pcm_uframes_t size) +snd_pcm_sframes_t snd_pcm_lib_read(snd_pcm_substream_t *substream, void __user *buf, snd_pcm_uframes_t size) { snd_pcm_runtime_t *runtime; int nonblock; @@ -2543,22 +2549,22 @@ #endif if (runtime->access != SNDRV_PCM_ACCESS_RW_INTERLEAVED) return -EINVAL; - return snd_pcm_lib_read1(substream, buf, size, nonblock, snd_pcm_lib_read_transfer); + return snd_pcm_lib_read1(substream, (unsigned long)buf, size, nonblock, snd_pcm_lib_read_transfer); } static int snd_pcm_lib_readv_transfer(snd_pcm_substream_t *substream, unsigned int hwoff, - void *data, unsigned int off, + unsigned long data, unsigned int off, snd_pcm_uframes_t frames) { snd_pcm_runtime_t *runtime = substream->runtime; int err; - void **bufs = data; + void __user **bufs = (void __user **)data; int channels = runtime->channels; int c; if (substream->ops->copy) { for (c = 0; c < channels; ++c, ++bufs) { - char *buf; + char __user *buf; if (*bufs == NULL) continue; buf = *bufs + samples_to_bytes(runtime, off); @@ -2569,7 +2575,8 @@ snd_pcm_uframes_t dma_csize = runtime->dma_bytes / channels; snd_assert(runtime->dma_area, return -EFAULT); for (c = 0; c < channels; ++c, ++bufs) { - char *hwbuf, *buf; + char *hwbuf; + char __user *buf; if (*bufs == NULL) continue; @@ -2582,7 +2589,8 @@ return 0; } -snd_pcm_sframes_t snd_pcm_lib_readv(snd_pcm_substream_t *substream, void **bufs, +snd_pcm_sframes_t snd_pcm_lib_readv(snd_pcm_substream_t *substream, + void __user **bufs, snd_pcm_uframes_t frames) { snd_pcm_runtime_t *runtime; @@ -2611,7 +2619,7 @@ if (runtime->access != SNDRV_PCM_ACCESS_RW_NONINTERLEAVED) return -EINVAL; - return snd_pcm_lib_read1(substream, bufs, frames, nonblock, snd_pcm_lib_readv_transfer); + return snd_pcm_lib_read1(substream, (unsigned long)bufs, frames, nonblock, snd_pcm_lib_readv_transfer); } /* diff -urN linux-2.6.7-rc2/sound/core/pcm_native.c linux-2.6.7-rc3/sound/core/pcm_native.c --- linux-2.6.7-rc2/sound/core/pcm_native.c 2004-06-07 12:54:54.219258439 -0700 +++ linux-2.6.7-rc3/sound/core/pcm_native.c 2004-06-07 12:55:29.717728750 -0700 @@ -56,8 +56,8 @@ #define SNDRV_PCM_IOCTL_HW_REFINE_OLD _IOWR('A', 0x10, struct sndrv_pcm_hw_params_old) #define SNDRV_PCM_IOCTL_HW_PARAMS_OLD _IOWR('A', 0x11, struct sndrv_pcm_hw_params_old) -static int snd_pcm_hw_refine_old_user(snd_pcm_substream_t * substream, struct sndrv_pcm_hw_params_old * _oparams); -static int snd_pcm_hw_params_old_user(snd_pcm_substream_t * substream, struct sndrv_pcm_hw_params_old * _oparams); +static int snd_pcm_hw_refine_old_user(snd_pcm_substream_t * substream, struct sndrv_pcm_hw_params_old __user * _oparams); +static int snd_pcm_hw_params_old_user(snd_pcm_substream_t * substream, struct sndrv_pcm_hw_params_old __user * _oparams); /* * @@ -108,7 +108,7 @@ return 0; } -int snd_pcm_info_user(snd_pcm_substream_t * substream, snd_pcm_info_t * _info) +int snd_pcm_info_user(snd_pcm_substream_t * substream, snd_pcm_info_t __user * _info) { snd_pcm_info_t info; int err = snd_pcm_info(substream, &info); @@ -302,7 +302,7 @@ return 0; } -static int snd_pcm_hw_refine_user(snd_pcm_substream_t * substream, snd_pcm_hw_params_t * _params) +static int snd_pcm_hw_refine_user(snd_pcm_substream_t * substream, snd_pcm_hw_params_t __user * _params) { snd_pcm_hw_params_t params; int err; @@ -406,7 +406,7 @@ return err; } -static int snd_pcm_hw_params_user(snd_pcm_substream_t * substream, snd_pcm_hw_params_t * _params) +static int snd_pcm_hw_params_user(snd_pcm_substream_t * substream, snd_pcm_hw_params_t __user * _params) { snd_pcm_hw_params_t params; int err; @@ -494,7 +494,7 @@ return 0; } -static int snd_pcm_sw_params_user(snd_pcm_substream_t * substream, snd_pcm_sw_params_t * _params) +static int snd_pcm_sw_params_user(snd_pcm_substream_t * substream, snd_pcm_sw_params_t __user * _params) { snd_pcm_sw_params_t params; int err; @@ -550,7 +550,7 @@ return 0; } -static int snd_pcm_status_user(snd_pcm_substream_t * substream, snd_pcm_status_t * _status) +static int snd_pcm_status_user(snd_pcm_substream_t * substream, snd_pcm_status_t __user * _status) { snd_pcm_status_t status; snd_pcm_runtime_t *runtime; @@ -567,7 +567,7 @@ return 0; } -static int snd_pcm_channel_info(snd_pcm_substream_t * substream, snd_pcm_channel_info_t * _info) +static int snd_pcm_channel_info(snd_pcm_substream_t * substream, snd_pcm_channel_info_t __user * _info) { snd_pcm_channel_info_t info; snd_pcm_runtime_t *runtime; @@ -2297,7 +2297,7 @@ return err; } -static int snd_pcm_delay(snd_pcm_substream_t *substream, snd_pcm_sframes_t *res) +static int snd_pcm_delay(snd_pcm_substream_t *substream, snd_pcm_sframes_t __user *res) { snd_pcm_runtime_t *runtime = substream->runtime; int err; @@ -2335,7 +2335,7 @@ return err; } -static int snd_pcm_sync_ptr(snd_pcm_substream_t *substream, struct sndrv_pcm_sync_ptr *_sync_ptr) +static int snd_pcm_sync_ptr(snd_pcm_substream_t *substream, struct sndrv_pcm_sync_ptr __user *_sync_ptr) { snd_pcm_runtime_t *runtime = substream->runtime; struct sndrv_pcm_sync_ptr sync_ptr; @@ -2344,7 +2344,7 @@ int err; memset(&sync_ptr, 0, sizeof(sync_ptr)); - if (get_user(sync_ptr.flags, (unsigned int *) &(_sync_ptr->flags))) + if (get_user(sync_ptr.flags, (unsigned __user *)&(_sync_ptr->flags))) return -EFAULT; if (copy_from_user(&sync_ptr.c.control, &(_sync_ptr->c.control), sizeof(struct sndrv_pcm_mmap_control))) return -EFAULT; @@ -2375,40 +2375,40 @@ } static int snd_pcm_playback_ioctl1(snd_pcm_substream_t *substream, - unsigned int cmd, void *arg); + unsigned int cmd, void __user *arg); static int snd_pcm_capture_ioctl1(snd_pcm_substream_t *substream, - unsigned int cmd, void *arg); + unsigned int cmd, void __user *arg); static int snd_pcm_common_ioctl1(snd_pcm_substream_t *substream, - unsigned int cmd, void *arg) + unsigned int cmd, void __user *arg) { snd_assert(substream != NULL, return -ENXIO); switch (cmd) { case SNDRV_PCM_IOCTL_PVERSION: - return put_user(SNDRV_PCM_VERSION, (int *)arg) ? -EFAULT : 0; + return put_user(SNDRV_PCM_VERSION, (int __user *)arg) ? -EFAULT : 0; case SNDRV_PCM_IOCTL_INFO: - return snd_pcm_info_user(substream, (snd_pcm_info_t *) arg); + return snd_pcm_info_user(substream, arg); case SNDRV_PCM_IOCTL_TSTAMP: { int xarg; - if (get_user(xarg, (int *) arg)) + if (get_user(xarg, (int __user *)arg)) return -EFAULT; substream->runtime->tstamp_timespec = xarg ? 1 : 0; return 0; } case SNDRV_PCM_IOCTL_HW_REFINE: - return snd_pcm_hw_refine_user(substream, (snd_pcm_hw_params_t *) arg); + return snd_pcm_hw_refine_user(substream, arg); case SNDRV_PCM_IOCTL_HW_PARAMS: - return snd_pcm_hw_params_user(substream, (snd_pcm_hw_params_t *) arg); + return snd_pcm_hw_params_user(substream, arg); case SNDRV_PCM_IOCTL_HW_FREE: return snd_pcm_hw_free(substream); case SNDRV_PCM_IOCTL_SW_PARAMS: - return snd_pcm_sw_params_user(substream, (snd_pcm_sw_params_t *) arg); + return snd_pcm_sw_params_user(substream, arg); case SNDRV_PCM_IOCTL_STATUS: - return snd_pcm_status_user(substream, (snd_pcm_status_t *) arg); + return snd_pcm_status_user(substream, arg); case SNDRV_PCM_IOCTL_CHANNEL_INFO: - return snd_pcm_channel_info(substream, (snd_pcm_channel_info_t *) arg); + return snd_pcm_channel_info(substream, arg); case SNDRV_PCM_IOCTL_PREPARE: return snd_pcm_prepare(substream); case SNDRV_PCM_IOCTL_RESET: @@ -2416,7 +2416,7 @@ case SNDRV_PCM_IOCTL_START: return snd_pcm_action_lock_irq(&snd_pcm_action_start, substream, 0, 0); case SNDRV_PCM_IOCTL_LINK: - return snd_pcm_link(substream, (long) arg); + return snd_pcm_link(substream, (int)(unsigned long) arg); case SNDRV_PCM_IOCTL_UNLINK: return snd_pcm_unlink(substream); case SNDRV_PCM_IOCTL_RESUME: @@ -2426,27 +2426,28 @@ case SNDRV_PCM_IOCTL_HWSYNC: return snd_pcm_hwsync(substream); case SNDRV_PCM_IOCTL_DELAY: - return snd_pcm_delay(substream, (snd_pcm_sframes_t *) arg); + return snd_pcm_delay(substream, arg); case SNDRV_PCM_IOCTL_SYNC_PTR: - return snd_pcm_sync_ptr(substream, (struct sndrv_pcm_sync_ptr *) arg); + return snd_pcm_sync_ptr(substream, arg); case SNDRV_PCM_IOCTL_HW_REFINE_OLD: - return snd_pcm_hw_refine_old_user(substream, (struct sndrv_pcm_hw_params_old *) arg); + return snd_pcm_hw_refine_old_user(substream, arg); case SNDRV_PCM_IOCTL_HW_PARAMS_OLD: - return snd_pcm_hw_params_old_user(substream, (struct sndrv_pcm_hw_params_old *) arg); + return snd_pcm_hw_params_old_user(substream, arg); } snd_printd("unknown ioctl = 0x%x\n", cmd); return -ENOTTY; } static int snd_pcm_playback_ioctl1(snd_pcm_substream_t *substream, - unsigned int cmd, void *arg) + unsigned int cmd, void __user *arg) { snd_assert(substream != NULL, return -ENXIO); snd_assert(substream->stream == SNDRV_PCM_STREAM_PLAYBACK, return -EINVAL); switch (cmd) { case SNDRV_PCM_IOCTL_WRITEI_FRAMES: { - snd_xferi_t xferi, *_xferi = arg; + snd_xferi_t xferi; + snd_xferi_t __user *_xferi = arg; snd_pcm_runtime_t *runtime = substream->runtime; snd_pcm_sframes_t result; if (runtime->status->state == SNDRV_PCM_STATE_OPEN) @@ -2461,9 +2462,10 @@ } case SNDRV_PCM_IOCTL_WRITEN_FRAMES: { - snd_xfern_t xfern, *_xfern = arg; + snd_xfern_t xfern; + snd_xfern_t __user *_xfern = arg; snd_pcm_runtime_t *runtime = substream->runtime; - void *bufs; + void __user **bufs; snd_pcm_sframes_t result; if (runtime->status->state == SNDRV_PCM_STATE_OPEN) return -EBADFD; @@ -2487,7 +2489,8 @@ } case SNDRV_PCM_IOCTL_REWIND: { - snd_pcm_uframes_t frames, *_frames = arg; + snd_pcm_uframes_t frames; + snd_pcm_uframes_t __user *_frames = arg; snd_pcm_sframes_t result; if (get_user(frames, _frames)) return -EFAULT; @@ -2499,7 +2502,8 @@ } case SNDRV_PCM_IOCTL_FORWARD: { - snd_pcm_uframes_t frames, *_frames = arg; + snd_pcm_uframes_t frames; + snd_pcm_uframes_t __user *_frames = arg; snd_pcm_sframes_t result; if (get_user(frames, _frames)) return -EFAULT; @@ -2513,7 +2517,7 @@ { int res; snd_pcm_stream_lock_irq(substream); - res = snd_pcm_pause(substream, (long) arg); + res = snd_pcm_pause(substream, (int)(unsigned long)arg); snd_pcm_stream_unlock_irq(substream); return res; } @@ -2526,14 +2530,15 @@ } static int snd_pcm_capture_ioctl1(snd_pcm_substream_t *substream, - unsigned int cmd, void *arg) + unsigned int cmd, void __user *arg) { snd_assert(substream != NULL, return -ENXIO); snd_assert(substream->stream == SNDRV_PCM_STREAM_CAPTURE, return -EINVAL); switch (cmd) { case SNDRV_PCM_IOCTL_READI_FRAMES: { - snd_xferi_t xferi, *_xferi = arg; + snd_xferi_t xferi; + snd_xferi_t __user *_xferi = arg; snd_pcm_runtime_t *runtime = substream->runtime; snd_pcm_sframes_t result; if (runtime->status->state == SNDRV_PCM_STATE_OPEN) @@ -2548,7 +2553,8 @@ } case SNDRV_PCM_IOCTL_READN_FRAMES: { - snd_xfern_t xfern, *_xfern = arg; + snd_xfern_t xfern; + snd_xfern_t __user *_xfern = arg; snd_pcm_runtime_t *runtime = substream->runtime; void *bufs; snd_pcm_sframes_t result; @@ -2574,7 +2580,8 @@ } case SNDRV_PCM_IOCTL_REWIND: { - snd_pcm_uframes_t frames, *_frames = arg; + snd_pcm_uframes_t frames; + snd_pcm_uframes_t __user *_frames = arg; snd_pcm_sframes_t result; if (get_user(frames, _frames)) return -EFAULT; @@ -2586,7 +2593,8 @@ } case SNDRV_PCM_IOCTL_FORWARD: { - snd_pcm_uframes_t frames, *_frames = arg; + snd_pcm_uframes_t frames; + snd_pcm_uframes_t __user *_frames = arg; snd_pcm_sframes_t result; if (get_user(frames, _frames)) return -EFAULT; @@ -2614,7 +2622,7 @@ if (((cmd >> 8) & 0xff) != 'A') return -ENOTTY; - return snd_pcm_playback_ioctl1(pcm_file->substream, cmd, (void *) arg); + return snd_pcm_playback_ioctl1(pcm_file->substream, cmd, (void __user *)arg); } static int snd_pcm_capture_ioctl(struct inode *inode, struct file *file, @@ -2627,7 +2635,7 @@ if (((cmd >> 8) & 0xff) != 'A') return -ENOTTY; - return snd_pcm_capture_ioctl1(pcm_file->substream, cmd, (void *) arg); + return snd_pcm_capture_ioctl1(pcm_file->substream, cmd, (void __user *)arg); } int snd_pcm_kernel_playback_ioctl(snd_pcm_substream_t *substream, @@ -2667,7 +2675,7 @@ } } -static ssize_t snd_pcm_read(struct file *file, char *buf, size_t count, loff_t * offset) +static ssize_t snd_pcm_read(struct file *file, char __user *buf, size_t count, loff_t * offset) { snd_pcm_file_t *pcm_file; snd_pcm_substream_t *substream; @@ -2689,7 +2697,7 @@ return result; } -static ssize_t snd_pcm_write(struct file *file, const char *buf, size_t count, loff_t * offset) +static ssize_t snd_pcm_write(struct file *file, const char __user *buf, size_t count, loff_t * offset) { snd_pcm_file_t *pcm_file; snd_pcm_substream_t *substream; @@ -2725,7 +2733,7 @@ snd_pcm_runtime_t *runtime; snd_pcm_sframes_t result; unsigned long i; - void **bufs; + void __user **bufs; snd_pcm_uframes_t frames; pcm_file = snd_magic_cast(snd_pcm_file_t, file->private_data, return -ENXIO); @@ -2759,7 +2767,7 @@ snd_pcm_runtime_t *runtime; snd_pcm_sframes_t result; unsigned long i; - void **bufs; + void __user **bufs; snd_pcm_uframes_t frames; pcm_file = snd_magic_cast(snd_pcm_file_t, file->private_data, result = -ENXIO; goto end); @@ -3123,7 +3131,7 @@ oparams->fifo_size = params->fifo_size; } -static int snd_pcm_hw_refine_old_user(snd_pcm_substream_t * substream, struct sndrv_pcm_hw_params_old * _oparams) +static int snd_pcm_hw_refine_old_user(snd_pcm_substream_t * substream, struct sndrv_pcm_hw_params_old __user * _oparams) { snd_pcm_hw_params_t params; struct sndrv_pcm_hw_params_old oparams; @@ -3138,7 +3146,7 @@ return err; } -static int snd_pcm_hw_params_old_user(snd_pcm_substream_t * substream, struct sndrv_pcm_hw_params_old * _oparams) +static int snd_pcm_hw_params_old_user(snd_pcm_substream_t * substream, struct sndrv_pcm_hw_params_old __user * _oparams) { snd_pcm_hw_params_t params; struct sndrv_pcm_hw_params_old oparams; diff -urN linux-2.6.7-rc2/sound/core/rawmidi.c linux-2.6.7-rc3/sound/core/rawmidi.c --- linux-2.6.7-rc2/sound/core/rawmidi.c 2004-06-07 12:54:54.220258481 -0700 +++ linux-2.6.7-rc3/sound/core/rawmidi.c 2004-06-07 12:55:29.719728833 -0700 @@ -543,7 +543,7 @@ return 0; } -static int snd_rawmidi_info_user(snd_rawmidi_substream_t *substream, snd_rawmidi_info_t * _info) +static int snd_rawmidi_info_user(snd_rawmidi_substream_t *substream, snd_rawmidi_info_t __user * _info) { snd_rawmidi_info_t info; int err; @@ -579,7 +579,7 @@ } static int snd_rawmidi_info_select_user(snd_card_t *card, - snd_rawmidi_info_t *_info) + snd_rawmidi_info_t __user *_info) { int err; snd_rawmidi_info_t info; @@ -679,17 +679,18 @@ unsigned int cmd, unsigned long arg) { snd_rawmidi_file_t *rfile; + void __user *argp = (void __user *)arg; rfile = snd_magic_cast(snd_rawmidi_file_t, file->private_data, return -ENXIO); if (((cmd >> 8) & 0xff) != 'W') return -ENOTTY; switch (cmd) { case SNDRV_RAWMIDI_IOCTL_PVERSION: - return put_user(SNDRV_RAWMIDI_VERSION, (int *)arg) ? -EFAULT : 0; + return put_user(SNDRV_RAWMIDI_VERSION, (int __user *)argp) ? -EFAULT : 0; case SNDRV_RAWMIDI_IOCTL_INFO: { snd_rawmidi_stream_t stream; - snd_rawmidi_info_t *info = (snd_rawmidi_info_t *) arg; + snd_rawmidi_info_t __user *info = argp; if (get_user(stream, &info->stream)) return -EFAULT; switch (stream) { @@ -704,7 +705,7 @@ case SNDRV_RAWMIDI_IOCTL_PARAMS: { snd_rawmidi_params_t params; - if (copy_from_user(¶ms, (snd_rawmidi_params_t *) arg, sizeof(snd_rawmidi_params_t))) + if (copy_from_user(¶ms, argp, sizeof(snd_rawmidi_params_t))) return -EFAULT; switch (params.stream) { case SNDRV_RAWMIDI_STREAM_OUTPUT: @@ -723,7 +724,7 @@ { int err = 0; snd_rawmidi_status_t status; - if (copy_from_user(&status, (snd_rawmidi_status_t *) arg, sizeof(snd_rawmidi_status_t))) + if (copy_from_user(&status, argp, sizeof(snd_rawmidi_status_t))) return -EFAULT; switch (status.stream) { case SNDRV_RAWMIDI_STREAM_OUTPUT: @@ -741,14 +742,14 @@ } if (err < 0) return err; - if (copy_to_user((snd_rawmidi_status_t *) arg, &status, sizeof(snd_rawmidi_status_t))) + if (copy_to_user(argp, &status, sizeof(snd_rawmidi_status_t))) return -EFAULT; return 0; } case SNDRV_RAWMIDI_IOCTL_DROP: { int val; - if (get_user(val, (long *) arg)) + if (get_user(val, (long __user *) argp)) return -EFAULT; switch (val) { case SNDRV_RAWMIDI_STREAM_OUTPUT: @@ -762,7 +763,7 @@ case SNDRV_RAWMIDI_IOCTL_DRAIN: { int val; - if (get_user(val, (long *) arg)) + if (get_user(val, (long __user *) argp)) return -EFAULT; switch (val) { case SNDRV_RAWMIDI_STREAM_OUTPUT: @@ -788,6 +789,7 @@ int snd_rawmidi_control_ioctl(snd_card_t * card, snd_ctl_file_t * control, unsigned int cmd, unsigned long arg) { + void __user *argp = (void __user *)arg; unsigned int tmp; tmp = card->number * SNDRV_RAWMIDI_DEVICES; @@ -796,7 +798,7 @@ { int device; - if (get_user(device, (int *)arg)) + if (get_user(device, (int __user *)argp)) return -EFAULT; device = device < 0 ? 0 : device + 1; while (device < SNDRV_RAWMIDI_DEVICES) { @@ -806,7 +808,7 @@ } if (device == SNDRV_RAWMIDI_DEVICES) device = -1; - if (put_user(device, (int *)arg)) + if (put_user(device, (int __user *)argp)) return -EFAULT; return 0; } @@ -814,13 +816,13 @@ { int val; - if (get_user(val, (int *)arg)) + if (get_user(val, (int __user *)argp)) return -EFAULT; control->prefer_rawmidi_subdevice = val; return 0; } case SNDRV_CTL_IOCTL_RAWMIDI_INFO: - return snd_rawmidi_info_select_user(card, (snd_rawmidi_info_t *)arg); + return snd_rawmidi_info_select_user(card, argp); } return -ENOIOCTLCMD; } @@ -934,7 +936,7 @@ return snd_rawmidi_kernel_read1(substream, buf, count, 1); } -static ssize_t snd_rawmidi_read(struct file *file, char *buf, size_t count, loff_t *offset) +static ssize_t snd_rawmidi_read(struct file *file, char __user *buf, size_t count, loff_t *offset) { long result; int count1; @@ -1166,7 +1168,7 @@ return snd_rawmidi_kernel_write1(substream, buf, count, 1); } -static ssize_t snd_rawmidi_write(struct file *file, const char *buf, size_t count, loff_t *offset) +static ssize_t snd_rawmidi_write(struct file *file, const char __user *buf, size_t count, loff_t *offset) { long result, timeout; int count1; diff -urN linux-2.6.7-rc2/sound/core/seq/instr/ainstr_fm.c linux-2.6.7-rc3/sound/core/seq/instr/ainstr_fm.c --- linux-2.6.7-rc2/sound/core/seq/instr/ainstr_fm.c 2004-05-09 19:32:29.000000000 -0700 +++ linux-2.6.7-rc3/sound/core/seq/instr/ainstr_fm.c 2004-06-07 12:55:29.747729993 -0700 @@ -35,7 +35,7 @@ char *snd_seq_fm_id = SNDRV_SEQ_INSTR_ID_OPL2_3; static int snd_seq_fm_put(void *private_data, snd_seq_kinstr_t *instr, - char *instr_data, long len, int atomic, int cmd) + char __user *instr_data, long len, int atomic, int cmd) { fm_instrument_t *ip; fm_xinstrument_t ix; @@ -77,7 +77,8 @@ } static int snd_seq_fm_get(void *private_data, snd_seq_kinstr_t *instr, - char *instr_data, long len, int atomic, int cmd) + char __user *instr_data, long len, int atomic, + int cmd) { fm_instrument_t *ip; fm_xinstrument_t ix; diff -urN linux-2.6.7-rc2/sound/core/seq/instr/ainstr_gf1.c linux-2.6.7-rc3/sound/core/seq/instr/ainstr_gf1.c --- linux-2.6.7-rc2/sound/core/seq/instr/ainstr_gf1.c 2004-05-09 19:32:54.000000000 -0700 +++ linux-2.6.7-rc3/sound/core/seq/instr/ainstr_gf1.c 2004-06-07 12:55:29.749730076 -0700 @@ -48,7 +48,7 @@ static int snd_seq_gf1_copy_wave_from_stream(snd_gf1_ops_t *ops, gf1_instrument_t *ip, - char **data, + char __user **data, long *len, int atomic) { @@ -141,7 +141,8 @@ } static int snd_seq_gf1_put(void *private_data, snd_seq_kinstr_t *instr, - char *instr_data, long len, int atomic, int cmd) + char __user *instr_data, long len, int atomic, + int cmd) { snd_gf1_ops_t *ops = (snd_gf1_ops_t *)private_data; gf1_instrument_t *ip; @@ -192,7 +193,7 @@ static int snd_seq_gf1_copy_wave_to_stream(snd_gf1_ops_t *ops, gf1_instrument_t *ip, - char **data, + char __user **data, long *len, int atomic) { @@ -253,7 +254,8 @@ } static int snd_seq_gf1_get(void *private_data, snd_seq_kinstr_t *instr, - char *instr_data, long len, int atomic, int cmd) + char __user *instr_data, long len, int atomic, + int cmd) { snd_gf1_ops_t *ops = (snd_gf1_ops_t *)private_data; gf1_instrument_t *ip; diff -urN linux-2.6.7-rc2/sound/core/seq/instr/ainstr_iw.c linux-2.6.7-rc3/sound/core/seq/instr/ainstr_iw.c --- linux-2.6.7-rc2/sound/core/seq/instr/ainstr_iw.c 2004-05-09 19:32:37.000000000 -0700 +++ linux-2.6.7-rc3/sound/core/seq/instr/ainstr_iw.c 2004-06-07 12:55:29.749730076 -0700 @@ -60,7 +60,7 @@ iwffff_layer_t *lp, iwffff_env_t *ep, iwffff_xenv_t *ex, - char **data, + char __user **data, long *len, int gfp_mask) { @@ -126,7 +126,7 @@ static int snd_seq_iwffff_copy_wave_from_stream(snd_iwffff_ops_t *ops, iwffff_layer_t *lp, - char **data, + char __user **data, long *len, int atomic) { @@ -230,7 +230,8 @@ } static int snd_seq_iwffff_put(void *private_data, snd_seq_kinstr_t *instr, - char *instr_data, long len, int atomic, int cmd) + char __user *instr_data, long len, int atomic, + int cmd) { snd_iwffff_ops_t *ops = (snd_iwffff_ops_t *)private_data; iwffff_instrument_t *ip; @@ -350,7 +351,7 @@ iwffff_layer_t *lp, iwffff_xenv_t *ex, iwffff_env_t *ep, - char **data, + char __user **data, long *len) { iwffff_env_record_t *rp; @@ -395,7 +396,7 @@ static int snd_seq_iwffff_copy_wave_to_stream(snd_iwffff_ops_t *ops, iwffff_layer_t *lp, - char **data, + char __user **data, long *len, int atomic) { @@ -449,14 +450,14 @@ } static int snd_seq_iwffff_get(void *private_data, snd_seq_kinstr_t *instr, - char *instr_data, long len, int atomic, int cmd) + char __user *instr_data, long len, int atomic, int cmd) { snd_iwffff_ops_t *ops = (snd_iwffff_ops_t *)private_data; iwffff_instrument_t *ip; iwffff_xinstrument_t ix; iwffff_layer_t *lp; iwffff_xlayer_t lx; - char *layer_instr_data; + char __user *layer_instr_data; int err; if (cmd != SNDRV_SEQ_INSTR_GET_CMD_FULL) diff -urN linux-2.6.7-rc2/sound/core/seq/instr/ainstr_simple.c linux-2.6.7-rc3/sound/core/seq/instr/ainstr_simple.c --- linux-2.6.7-rc2/sound/core/seq/instr/ainstr_simple.c 2004-05-09 19:33:10.000000000 -0700 +++ linux-2.6.7-rc3/sound/core/seq/instr/ainstr_simple.c 2004-06-07 12:55:29.750730117 -0700 @@ -55,7 +55,8 @@ } static int snd_seq_simple_put(void *private_data, snd_seq_kinstr_t *instr, - char *instr_data, long len, int atomic, int cmd) + char __user *instr_data, long len, + int atomic, int cmd) { snd_simple_ops_t *ops = (snd_simple_ops_t *)private_data; simple_instrument_t *ip; @@ -103,7 +104,8 @@ } static int snd_seq_simple_get(void *private_data, snd_seq_kinstr_t *instr, - char *instr_data, long len, int atomic, int cmd) + char __user *instr_data, long len, + int atomic, int cmd) { snd_simple_ops_t *ops = (snd_simple_ops_t *)private_data; simple_instrument_t *ip; diff -urN linux-2.6.7-rc2/sound/core/seq/oss/seq_oss.c linux-2.6.7-rc3/sound/core/seq/oss/seq_oss.c --- linux-2.6.7-rc2/sound/core/seq/oss/seq_oss.c 2004-06-07 12:54:54.242259392 -0700 +++ linux-2.6.7-rc3/sound/core/seq/oss/seq_oss.c 2004-06-07 12:55:29.752730200 -0700 @@ -57,8 +57,8 @@ static int odev_open(struct inode *inode, struct file *file); static int odev_release(struct inode *inode, struct file *file); -static ssize_t odev_read(struct file *file, char *buf, size_t count, loff_t *offset); -static ssize_t odev_write(struct file *file, const char *buf, size_t count, loff_t *offset); +static ssize_t odev_read(struct file *file, char __user *buf, size_t count, loff_t *offset); +static ssize_t odev_write(struct file *file, const char __user *buf, size_t count, loff_t *offset); static int odev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg); static unsigned int odev_poll(struct file *file, poll_table * wait); #ifdef CONFIG_PROC_FS @@ -155,7 +155,7 @@ } static ssize_t -odev_read(struct file *file, char *buf, size_t count, loff_t *offset) +odev_read(struct file *file, char __user *buf, size_t count, loff_t *offset) { seq_oss_devinfo_t *dp; dp = file->private_data; @@ -165,7 +165,7 @@ static ssize_t -odev_write(struct file *file, const char *buf, size_t count, loff_t *offset) +odev_write(struct file *file, const char __user *buf, size_t count, loff_t *offset) { seq_oss_devinfo_t *dp; dp = file->private_data; diff -urN linux-2.6.7-rc2/sound/core/seq/oss/seq_oss_ioctl.c linux-2.6.7-rc3/sound/core/seq/oss/seq_oss_ioctl.c --- linux-2.6.7-rc2/sound/core/seq/oss/seq_oss_ioctl.c 2004-05-09 19:31:59.000000000 -0700 +++ linux-2.6.7-rc3/sound/core/seq/oss/seq_oss_ioctl.c 2004-06-07 12:55:29.753730242 -0700 @@ -36,6 +36,7 @@ struct midi_info minf; unsigned char ev[8]; void __user *arg = (void __user *)carg; + int __user *p = arg; snd_seq_event_t tmpev; switch (cmd) { @@ -72,7 +73,7 @@ case SNDCTL_SEQ_TESTMIDI: debug_printk(("test midi\n")); - if (get_user(dev, (int *)arg)) + if (get_user(dev, p)) return -EFAULT; return snd_seq_oss_midi_open(dp, dev, dp->file_mode); @@ -80,42 +81,42 @@ debug_printk(("get in count\n")); if (dp->readq == NULL || ! is_read_mode(dp->file_mode)) return 0; - return put_user(dp->readq->qlen, (int *)arg) ? -EFAULT : 0; + return put_user(dp->readq->qlen, p) ? -EFAULT : 0; case SNDCTL_SEQ_GETOUTCOUNT: debug_printk(("get out count\n")); if (! is_write_mode(dp->file_mode) || dp->writeq == NULL) return 0; - return put_user(snd_seq_oss_writeq_get_free_size(dp->writeq), (int *)arg) ? -EFAULT : 0; + return put_user(snd_seq_oss_writeq_get_free_size(dp->writeq), p) ? -EFAULT : 0; case SNDCTL_SEQ_GETTIME: debug_printk(("get time\n")); - return put_user(snd_seq_oss_timer_cur_tick(dp->timer), (int *)arg) ? -EFAULT : 0; + return put_user(snd_seq_oss_timer_cur_tick(dp->timer), p) ? -EFAULT : 0; case SNDCTL_SEQ_RESETSAMPLES: debug_printk(("reset samples\n")); - if (get_user(dev, (int *)arg)) + if (get_user(dev, p)) return -EFAULT; return snd_seq_oss_synth_ioctl(dp, dev, cmd, carg); case SNDCTL_SEQ_NRSYNTHS: debug_printk(("nr synths\n")); - return put_user(dp->max_synthdev, (int *)arg) ? -EFAULT : 0; + return put_user(dp->max_synthdev, p) ? -EFAULT : 0; case SNDCTL_SEQ_NRMIDIS: debug_printk(("nr midis\n")); - return put_user(dp->max_mididev, (int *)arg) ? -EFAULT : 0; + return put_user(dp->max_mididev, p) ? -EFAULT : 0; case SNDCTL_SYNTH_MEMAVL: debug_printk(("mem avail\n")); - if (get_user(dev, (int *)arg)) + if (get_user(dev, p)) return -EFAULT; val = snd_seq_oss_synth_ioctl(dp, dev, cmd, carg); - return put_user(val, (int *)arg) ? -EFAULT : 0; + return put_user(val, p) ? -EFAULT : 0; case SNDCTL_FM_4OP_ENABLE: debug_printk(("4op\n")); - if (get_user(dev, (int *)arg)) + if (get_user(dev, p)) return -EFAULT; snd_seq_oss_synth_ioctl(dp, dev, cmd, carg); return 0; @@ -157,7 +158,7 @@ debug_printk(("threshold\n")); if (! is_write_mode(dp->file_mode)) return 0; - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val < 1) val = 1; @@ -170,14 +171,14 @@ debug_printk(("pretime\n")); if (dp->readq == NULL || !is_read_mode(dp->file_mode)) return 0; - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val <= 0) val = -1; else val = (HZ * val) / 10; dp->readq->pre_event_timeout = val; - return put_user(val, (int *)arg) ? -EFAULT : 0; + return put_user(val, p) ? -EFAULT : 0; default: debug_printk(("others\n")); diff -urN linux-2.6.7-rc2/sound/core/seq/seq_clientmgr.c linux-2.6.7-rc3/sound/core/seq/seq_clientmgr.c --- linux-2.6.7-rc2/sound/core/seq/seq_clientmgr.c 2004-05-09 19:32:01.000000000 -0700 +++ linux-2.6.7-rc3/sound/core/seq/seq_clientmgr.c 2004-06-07 12:55:29.757730407 -0700 @@ -2154,17 +2154,17 @@ switch (cmd) { case SNDRV_SEQ_IOCTL_PVERSION: /* return sequencer version number */ - return put_user(SNDRV_SEQ_VERSION, (int *)arg) ? -EFAULT : 0; + return put_user(SNDRV_SEQ_VERSION, (int __user *)arg) ? -EFAULT : 0; case SNDRV_SEQ_IOCTL_CLIENT_ID: /* return the id of this client */ - return put_user(client->number, (int *)arg) ? -EFAULT : 0; + return put_user(client->number, (int __user *)arg) ? -EFAULT : 0; } if (! arg) return -EFAULT; for (p = ioctl_tables; p->cmd; p++) { if (p->cmd == cmd) - return p->func(client, (void __user *) arg); + return p->func(client, arg); } snd_printd("seq unknown ioctl() 0x%x (type='%c', number=0x%2x)\n", cmd, _IOC_TYPE(cmd), _IOC_NR(cmd)); @@ -2348,7 +2348,7 @@ * exported, called by kernel clients to perform same functions as with * userland ioctl() */ -int snd_seq_kernel_client_ctl(int clientid, unsigned int cmd, void __user *arg) +int snd_seq_kernel_client_ctl(int clientid, unsigned int cmd, void *arg) { client_t *client; mm_segment_t fs; diff -urN linux-2.6.7-rc2/sound/core/seq/seq_memory.c linux-2.6.7-rc3/sound/core/seq/seq_memory.c --- linux-2.6.7-rc2/sound/core/seq/seq_memory.c 2004-05-09 19:32:00.000000000 -0700 +++ linux-2.6.7-rc3/sound/core/seq/seq_memory.c 2004-06-07 12:55:29.758730449 -0700 @@ -90,7 +90,7 @@ if (event->data.ext.len & SNDRV_SEQ_EXT_USRPTR) { char buf[32]; - char *curptr = event->data.ext.ptr; + char __user *curptr = event->data.ext.ptr; while (len > 0) { int size = sizeof(buf); if (len < size) diff -urN linux-2.6.7-rc2/sound/core/timer.c linux-2.6.7-rc3/sound/core/timer.c --- linux-2.6.7-rc2/sound/core/timer.c 2004-06-07 12:54:54.258260055 -0700 +++ linux-2.6.7-rc3/sound/core/timer.c 2004-06-07 12:55:29.774731111 -0700 @@ -1253,7 +1253,7 @@ id->subdevice = timer->tmr_subdevice; } -static int snd_timer_user_next_device(snd_timer_id_t *_tid) +static int snd_timer_user_next_device(snd_timer_id_t __user *_tid) { snd_timer_id_t id; snd_timer_t *timer; @@ -1344,7 +1344,7 @@ return 0; } -static int snd_timer_user_ginfo(struct file *file, snd_timer_ginfo_t *_ginfo) +static int snd_timer_user_ginfo(struct file *file, snd_timer_ginfo_t __user *_ginfo) { snd_timer_ginfo_t ginfo; snd_timer_id_t tid; @@ -1382,7 +1382,7 @@ return err; } -static int snd_timer_user_gparams(struct file *file, snd_timer_gparams_t *_gparams) +static int snd_timer_user_gparams(struct file *file, snd_timer_gparams_t __user *_gparams) { snd_timer_gparams_t gparams; snd_timer_t *t; @@ -1408,7 +1408,7 @@ return err; } -static int snd_timer_user_gstatus(struct file *file, snd_timer_gstatus_t *_gstatus) +static int snd_timer_user_gstatus(struct file *file, snd_timer_gstatus_t __user *_gstatus) { snd_timer_gstatus_t gstatus; snd_timer_id_t tid; @@ -1437,12 +1437,12 @@ err = -ENODEV; } up(®ister_mutex); - if (err >= 0 && copy_from_user(_gstatus, &gstatus, sizeof(gstatus))) + if (err >= 0 && copy_to_user(_gstatus, &gstatus, sizeof(gstatus))) err = -EFAULT; return err; } -static int snd_timer_user_tselect(struct file *file, snd_timer_select_t *_tselect) +static int snd_timer_user_tselect(struct file *file, snd_timer_select_t __user *_tselect) { snd_timer_user_t *tu; snd_timer_select_t tselect; @@ -1489,7 +1489,7 @@ return 0; } -static int snd_timer_user_info(struct file *file, snd_timer_info_t *_info) +static int snd_timer_user_info(struct file *file, snd_timer_info_t __user *_info) { snd_timer_user_t *tu; snd_timer_info_t info; @@ -1511,7 +1511,7 @@ return 0; } -static int snd_timer_user_params(struct file *file, snd_timer_params_t *_params) +static int snd_timer_user_params(struct file *file, snd_timer_params_t __user *_params) { snd_timer_user_t *tu; snd_timer_params_t params; @@ -1603,7 +1603,7 @@ return err; } -static int snd_timer_user_status(struct file *file, snd_timer_status_t *_status) +static int snd_timer_user_status(struct file *file, snd_timer_status_t __user *_status) { snd_timer_user_t *tu; snd_timer_status_t status; @@ -1661,38 +1661,40 @@ unsigned int cmd, unsigned long arg) { snd_timer_user_t *tu; + void __user *argp = (void __user *)arg; + int __user *p = argp; tu = snd_magic_cast(snd_timer_user_t, file->private_data, return -ENXIO); switch (cmd) { case SNDRV_TIMER_IOCTL_PVERSION: - return put_user(SNDRV_TIMER_VERSION, (int *)arg) ? -EFAULT : 0; + return put_user(SNDRV_TIMER_VERSION, p) ? -EFAULT : 0; case SNDRV_TIMER_IOCTL_NEXT_DEVICE: - return snd_timer_user_next_device((snd_timer_id_t *)arg); + return snd_timer_user_next_device(argp); case SNDRV_TIMER_IOCTL_TREAD: { int xarg; if (tu->timeri) /* too late */ return -EBUSY; - if (get_user(xarg, (int *) arg)) + if (get_user(xarg, p)) return -EFAULT; tu->tread = xarg ? 1 : 0; return 0; } case SNDRV_TIMER_IOCTL_GINFO: - return snd_timer_user_ginfo(file, (snd_timer_ginfo_t *)arg); + return snd_timer_user_ginfo(file, argp); case SNDRV_TIMER_IOCTL_GPARAMS: - return snd_timer_user_gparams(file, (snd_timer_gparams_t *)arg); + return snd_timer_user_gparams(file, argp); case SNDRV_TIMER_IOCTL_GSTATUS: - return snd_timer_user_gstatus(file, (snd_timer_gstatus_t *)arg); + return snd_timer_user_gstatus(file, argp); case SNDRV_TIMER_IOCTL_SELECT: - return snd_timer_user_tselect(file, (snd_timer_select_t *)arg); + return snd_timer_user_tselect(file, argp); case SNDRV_TIMER_IOCTL_INFO: - return snd_timer_user_info(file, (snd_timer_info_t *)arg); + return snd_timer_user_info(file, argp); case SNDRV_TIMER_IOCTL_PARAMS: - return snd_timer_user_params(file, (snd_timer_params_t *)arg); + return snd_timer_user_params(file, argp); case SNDRV_TIMER_IOCTL_STATUS: - return snd_timer_user_status(file, (snd_timer_status_t *)arg); + return snd_timer_user_status(file, argp); case SNDRV_TIMER_IOCTL_START: return snd_timer_user_start(file); case SNDRV_TIMER_IOCTL_STOP: @@ -1715,7 +1717,7 @@ return 0; } -static ssize_t snd_timer_user_read(struct file *file, char *buffer, size_t count, loff_t *offset) +static ssize_t snd_timer_user_read(struct file *file, char __user *buffer, size_t count, loff_t *offset) { snd_timer_user_t *tu; long result = 0, unit; diff -urN linux-2.6.7-rc2/sound/drivers/opl3/opl3_synth.c linux-2.6.7-rc3/sound/drivers/opl3/opl3_synth.c --- linux-2.6.7-rc2/sound/drivers/opl3/opl3_synth.c 2004-05-09 19:32:01.000000000 -0700 +++ linux-2.6.7-rc3/sound/drivers/opl3/opl3_synth.c 2004-06-07 12:55:29.845734052 -0700 @@ -94,6 +94,7 @@ unsigned int cmd, unsigned long arg) { opl3_t *opl3 = snd_magic_cast(opl3_t, hw->private_data, return -ENXIO); + void __user *argp = (void __user *)arg; snd_assert(opl3 != NULL, return -EINVAL); @@ -105,7 +106,7 @@ info.fm_mode = opl3->fm_mode; info.rhythm = opl3->rhythm; - if (copy_to_user((snd_dm_fm_info_t *) arg, &info, sizeof(snd_dm_fm_info_t))) + if (copy_to_user(argp, &info, sizeof(snd_dm_fm_info_t))) return -EFAULT; return 0; } @@ -123,7 +124,7 @@ #endif { snd_dm_fm_note_t note; - if (copy_from_user(¬e, (snd_dm_fm_note_t *) arg, sizeof(snd_dm_fm_note_t))) + if (copy_from_user(¬e, argp, sizeof(snd_dm_fm_note_t))) return -EFAULT; return snd_opl3_play_note(opl3, ¬e); } @@ -134,7 +135,7 @@ #endif { snd_dm_fm_voice_t voice; - if (copy_from_user(&voice, (snd_dm_fm_voice_t *) arg, sizeof(snd_dm_fm_voice_t))) + if (copy_from_user(&voice, argp, sizeof(snd_dm_fm_voice_t))) return -EFAULT; return snd_opl3_set_voice(opl3, &voice); } @@ -145,7 +146,7 @@ #endif { snd_dm_fm_params_t params; - if (copy_from_user(¶ms, (snd_dm_fm_params_t *) arg, sizeof(snd_dm_fm_params_t))) + if (copy_from_user(¶ms, argp, sizeof(snd_dm_fm_params_t))) return -EFAULT; return snd_opl3_set_params(opl3, ¶ms); } diff -urN linux-2.6.7-rc2/sound/drivers/opl4/opl4_proc.c linux-2.6.7-rc3/sound/drivers/opl4/opl4_proc.c --- linux-2.6.7-rc2/sound/drivers/opl4/opl4_proc.c 2004-05-09 19:33:20.000000000 -0700 +++ linux-2.6.7-rc3/sound/drivers/opl4/opl4_proc.c 2004-06-07 12:55:29.860734674 -0700 @@ -50,7 +50,7 @@ } static long snd_opl4_mem_proc_read(snd_info_entry_t *entry, void *file_private_data, - struct file *file, char *_buf, long count) + struct file *file, char __user *_buf, long count) { opl4_t *opl4 = snd_magic_cast(opl4_t, entry->private_data, return -ENXIO); long size; @@ -76,7 +76,7 @@ } static long snd_opl4_mem_proc_write(snd_info_entry_t *entry, void *file_private_data, - struct file *file, const char *_buf, long count) + struct file *file, const char __user *_buf, long count) { opl4_t *opl4 = snd_magic_cast(opl4_t, entry->private_data, return -ENXIO); long size; diff -urN linux-2.6.7-rc2/sound/isa/gus/gus_dram.c linux-2.6.7-rc3/sound/isa/gus/gus_dram.c --- linux-2.6.7-rc2/sound/isa/gus/gus_dram.c 2004-05-09 19:33:21.000000000 -0700 +++ linux-2.6.7-rc3/sound/isa/gus/gus_dram.c 2004-06-07 12:55:30.168747432 -0700 @@ -26,7 +26,7 @@ #include -static int snd_gus_dram_poke(snd_gus_card_t *gus, char *_buffer, +static int snd_gus_dram_poke(snd_gus_card_t *gus, char __user *_buffer, unsigned int address, unsigned int size) { unsigned long flags; @@ -57,13 +57,13 @@ } -int snd_gus_dram_write(snd_gus_card_t *gus, char *buffer, +int snd_gus_dram_write(snd_gus_card_t *gus, char __user *buffer, unsigned int address, unsigned int size) { return snd_gus_dram_poke(gus, buffer, address, size); } -static int snd_gus_dram_peek(snd_gus_card_t *gus, char *_buffer, +static int snd_gus_dram_peek(snd_gus_card_t *gus, char __user *_buffer, unsigned int address, unsigned int size, int rom) { @@ -95,7 +95,7 @@ return 0; } -int snd_gus_dram_read(snd_gus_card_t *gus, char *buffer, +int snd_gus_dram_read(snd_gus_card_t *gus, char __user *buffer, unsigned int address, unsigned int size, int rom) { diff -urN linux-2.6.7-rc2/sound/isa/gus/gus_instr.c linux-2.6.7-rc3/sound/isa/gus/gus_instr.c --- linux-2.6.7-rc2/sound/isa/gus/gus_instr.c 2004-05-09 19:33:22.000000000 -0700 +++ linux-2.6.7-rc3/sound/isa/gus/gus_instr.c 2004-06-07 12:55:30.169747474 -0700 @@ -29,7 +29,7 @@ */ int snd_gus_iwffff_put_sample(void *private_data, iwffff_wave_t *wave, - char *data, long len, int atomic) + char __user *data, long len, int atomic) { snd_gus_card_t *gus = snd_magic_cast(snd_gus_card_t, private_data, return -ENXIO); snd_gf1_mem_block_t *block; @@ -59,7 +59,7 @@ } int snd_gus_iwffff_get_sample(void *private_data, iwffff_wave_t *wave, - char *data, long len, int atomic) + char __user *data, long len, int atomic) { snd_gus_card_t *gus = snd_magic_cast(snd_gus_card_t, private_data, return -ENXIO); @@ -82,7 +82,7 @@ */ int snd_gus_gf1_put_sample(void *private_data, gf1_wave_t *wave, - char *data, long len, int atomic) + char __user *data, long len, int atomic) { snd_gus_card_t *gus = snd_magic_cast(snd_gus_card_t, private_data, return -ENXIO); snd_gf1_mem_block_t *block; @@ -110,7 +110,7 @@ } int snd_gus_gf1_get_sample(void *private_data, gf1_wave_t *wave, - char *data, long len, int atomic) + char __user *data, long len, int atomic) { snd_gus_card_t *gus = snd_magic_cast(snd_gus_card_t, private_data, return -ENXIO); @@ -130,7 +130,7 @@ */ int snd_gus_simple_put_sample(void *private_data, simple_instrument_t *instr, - char *data, long len, int atomic) + char __user *data, long len, int atomic) { snd_gus_card_t *gus = snd_magic_cast(snd_gus_card_t, private_data, return -ENXIO); snd_gf1_mem_block_t *block; @@ -157,7 +157,7 @@ } int snd_gus_simple_get_sample(void *private_data, simple_instrument_t *instr, - char *data, long len, int atomic) + char __user *data, long len, int atomic) { snd_gus_card_t *gus = snd_magic_cast(snd_gus_card_t, private_data, return -ENXIO); diff -urN linux-2.6.7-rc2/sound/isa/gus/gus_mem_proc.c linux-2.6.7-rc3/sound/isa/gus/gus_mem_proc.c --- linux-2.6.7-rc2/sound/isa/gus/gus_mem_proc.c 2004-05-09 19:32:53.000000000 -0700 +++ linux-2.6.7-rc3/sound/isa/gus/gus_mem_proc.c 2004-06-07 12:55:30.169747474 -0700 @@ -33,7 +33,7 @@ } gus_proc_private_t; static long snd_gf1_mem_proc_dump(snd_info_entry_t *entry, void *file_private_data, - struct file *file, char *buf, long count) + struct file *file, char __user *buf, long count) { long size; gus_proc_private_t *priv = snd_magic_cast(gus_proc_private_t, entry->private_data, return -ENXIO); diff -urN linux-2.6.7-rc2/sound/isa/gus/gus_pcm.c linux-2.6.7-rc3/sound/isa/gus/gus_pcm.c --- linux-2.6.7-rc2/sound/isa/gus/gus_pcm.c 2004-05-09 19:32:28.000000000 -0700 +++ linux-2.6.7-rc3/sound/isa/gus/gus_pcm.c 2004-06-07 12:55:30.197748634 -0700 @@ -346,7 +346,7 @@ static int snd_gf1_pcm_playback_copy(snd_pcm_substream_t *substream, int voice, snd_pcm_uframes_t pos, - void *src, + void __user *src, snd_pcm_uframes_t count) { snd_pcm_runtime_t *runtime = substream->runtime; diff -urN linux-2.6.7-rc2/sound/isa/sb/emu8000_patch.c linux-2.6.7-rc3/sound/isa/sb/emu8000_patch.c --- linux-2.6.7-rc2/sound/isa/sb/emu8000_patch.c 2004-06-07 12:54:54.440267593 -0700 +++ linux-2.6.7-rc3/sound/isa/sb/emu8000_patch.c 2004-06-07 12:55:30.515761806 -0700 @@ -87,14 +87,14 @@ unsigned short c; if (mode & SNDRV_SFNT_SAMPLE_8BITS) { unsigned char cc; - get_user(cc, (unsigned char*)buf + offset); + get_user(cc, (unsigned char __user *)buf + offset); c = cc << 8; /* convert 8bit -> 16bit */ } else { #ifdef SNDRV_LITTLE_ENDIAN - get_user(c, (unsigned short*)buf + offset); + get_user(c, (unsigned short __user *)buf + offset); #else unsigned short cc; - get_user(cc, (unsigned short*)buf + offset); + get_user(cc, (unsigned short __user *)buf + offset); c = swab16(cc); #endif } diff -urN linux-2.6.7-rc2/sound/isa/sb/emu8000_pcm.c linux-2.6.7-rc3/sound/isa/sb/emu8000_pcm.c --- linux-2.6.7-rc2/sound/isa/sb/emu8000_pcm.c 2004-05-09 19:33:21.000000000 -0700 +++ linux-2.6.7-rc3/sound/isa/sb/emu8000_pcm.c 2004-06-07 12:55:30.516761848 -0700 @@ -515,12 +515,12 @@ static int emu8k_pcm_copy(snd_pcm_substream_t *subs, int voice, snd_pcm_uframes_t pos, - void *src, + void __user *src, snd_pcm_uframes_t count) { emu8k_pcm_t *rec = subs->runtime->private_data; emu8000_t *emu = rec->emu; - unsigned short *buf = src; + unsigned short __user *buf = src; snd_emu8000_write_wait(emu, 1); EMU8000_SMALW_WRITE(emu, pos + rec->loop_start[0]); diff -urN linux-2.6.7-rc2/sound/isa/sb/sb16_csp.c linux-2.6.7-rc3/sound/isa/sb/sb16_csp.c --- linux-2.6.7-rc2/sound/isa/sb/sb16_csp.c 2004-05-09 19:33:21.000000000 -0700 +++ linux-2.6.7-rc3/sound/isa/sb/sb16_csp.c 2004-06-07 12:55:30.566763919 -0700 @@ -89,9 +89,9 @@ static int set_mode_register(sb_t *chip, unsigned char mode); static int get_version(sb_t *chip); -static int snd_sb_csp_riff_load(snd_sb_csp_t * p, snd_sb_csp_microcode_t * code); +static int snd_sb_csp_riff_load(snd_sb_csp_t * p, snd_sb_csp_microcode_t __user * code); static int snd_sb_csp_unload(snd_sb_csp_t * p); -static int snd_sb_csp_load(snd_sb_csp_t * p, const unsigned char *buf, int size, int load_flags); +static int snd_sb_csp_load_user(snd_sb_csp_t * p, const unsigned char __user *buf, int size, int load_flags); static int snd_sb_csp_autoload(snd_sb_csp_t * p, int pcm_sfmt, int play_rec_mode); static int snd_sb_csp_check_version(snd_sb_csp_t * p); @@ -213,7 +213,7 @@ info.run_width = p->run_width; info.version = p->version; info.state = p->running; - if (copy_to_user((void *) arg, &info, sizeof(info))) + if (copy_to_user((void __user *)arg, &info, sizeof(info))) err = -EFAULT; else err = 0; @@ -222,7 +222,7 @@ /* load CSP microcode */ case SNDRV_SB_CSP_IOCTL_LOAD_CODE: err = (p->running & SNDRV_SB_CSP_ST_RUNNING ? - -EBUSY : snd_sb_csp_riff_load(p, (snd_sb_csp_microcode_t *) arg)); + -EBUSY : snd_sb_csp_riff_load(p, (snd_sb_csp_microcode_t __user *) arg)); break; case SNDRV_SB_CSP_IOCTL_UNLOAD_CODE: err = (p->running & SNDRV_SB_CSP_ST_RUNNING ? @@ -231,7 +231,7 @@ /* change CSP running state */ case SNDRV_SB_CSP_IOCTL_START: - if (copy_from_user(&start_info, (void *) arg, sizeof(start_info))) + if (copy_from_user(&start_info, (void __user *) arg, sizeof(start_info))) err = -EFAULT; else err = snd_sb_csp_start(p, start_info.sample_width, start_info.channels); @@ -297,11 +297,12 @@ * load microcode via ioctl: * code is user-space pointer */ -static int snd_sb_csp_riff_load(snd_sb_csp_t * p, snd_sb_csp_microcode_t * mcode) +static int snd_sb_csp_riff_load(snd_sb_csp_t * p, snd_sb_csp_microcode_t __user * mcode) { snd_sb_csp_mc_header_t info; - unsigned char *data_ptr, *data_end; + unsigned char __user *data_ptr; + unsigned char __user *data_end; unsigned short func_nr = 0; riff_header_t file_h, item_h, code_h; @@ -372,8 +373,8 @@ if (code_h.name != INIT_HEADER) break; data_ptr += sizeof(code_h); - err = snd_sb_csp_load(p, data_ptr, LE_INT(code_h.len), - SNDRV_SB_CSP_LOAD_INITBLOCK | SNDRV_SB_CSP_LOAD_FROMUSER); + err = snd_sb_csp_load_user(p, data_ptr, LE_INT(code_h.len), + SNDRV_SB_CSP_LOAD_INITBLOCK); if (err) return err; data_ptr += LE_INT(code_h.len); @@ -387,8 +388,8 @@ return -EINVAL; } data_ptr += sizeof(code_h); - err = snd_sb_csp_load(p, data_ptr, LE_INT(code_h.len), - SNDRV_SB_CSP_LOAD_FROMUSER); + err = snd_sb_csp_load_user(p, data_ptr, + LE_INT(code_h.len), 0); if (err) return err; @@ -627,28 +628,10 @@ /* Send high byte */ snd_sbdsp_command(p->chip, (unsigned char)((size - 1) >> 8)); /* send microcode sequence */ - if (load_flags & SNDRV_SB_CSP_LOAD_FROMUSER) { - /* copy microcode from user space */ - unsigned char *kbuf, *_kbuf; - _kbuf = kbuf = kmalloc (size, GFP_KERNEL); - if (copy_from_user(kbuf, buf, size)) { - result = -EFAULT; - kfree (_kbuf); + /* load from kernel space */ + while (size--) { + if (!snd_sbdsp_command(p->chip, *buf++)) goto __fail; - } - while (size--) { - if (!snd_sbdsp_command(p->chip, *kbuf++)) { - kfree (_kbuf); - goto __fail; - } - } - kfree (_kbuf); - } else { - /* load from kernel space */ - while (size--) { - if (!snd_sbdsp_command(p->chip, *buf++)) - goto __fail; - } } if (snd_sbdsp_get_byte(p->chip)) goto __fail; @@ -692,6 +675,20 @@ spin_unlock_irqrestore(&p->chip->reg_lock, flags); return result; } + +static int snd_sb_csp_load_user(snd_sb_csp_t * p, const unsigned char __user *buf, int size, int load_flags) +{ + int err = -ENOMEM; + unsigned char *kbuf = kmalloc(size, GFP_KERNEL); + if (kbuf) { + if (copy_from_user(kbuf, buf, size)) + err = -EFAULT; + else + err = snd_sb_csp_load(p, kbuf, size, load_flags); + kfree(kbuf); + } + return err; +} #include "sb16_csp_codecs.h" diff -urN linux-2.6.7-rc2/sound/isa/sscape.c linux-2.6.7-rc3/sound/isa/sscape.c --- linux-2.6.7-rc2/sound/isa/sscape.c 2004-06-07 12:54:54.749280391 -0700 +++ linux-2.6.7-rc3/sound/isa/sscape.c 2004-06-07 12:55:30.569764043 -0700 @@ -455,7 +455,7 @@ * Upload a byte-stream into the SoundScape using DMA channel A. */ static int upload_dma_data(struct soundscape *s, - const unsigned char *data, + const unsigned char __user *data, size_t size) { unsigned long flags; @@ -569,7 +569,7 @@ * However, we have already verified its memory * addresses by the time we get here. */ -static int sscape_upload_bootblock(struct soundscape *sscape, struct sscape_bootblock *bb) +static int sscape_upload_bootblock(struct soundscape *sscape, struct sscape_bootblock __user *bb) { unsigned long flags; int data = 0; @@ -604,10 +604,10 @@ * SPACE, and save ourselves from copying it at all. */ static int sscape_upload_microcode(struct soundscape *sscape, - const struct sscape_microcode *mc) + const struct sscape_microcode __user *mc) { unsigned long flags; - char *code; + char __user *code; int err, ret; /* @@ -683,7 +683,7 @@ switch (cmd) { case SND_SSCAPE_LOAD_BOOTB: { - register struct sscape_bootblock *bb = (struct sscape_bootblock *) arg; + register struct sscape_bootblock __user *bb = (struct sscape_bootblock __user *) arg; /* * We are going to have to copy this data into a special @@ -705,7 +705,7 @@ case SND_SSCAPE_LOAD_MCODE: { - register const struct sscape_microcode *mc = (const struct sscape_microcode *) arg; + register const struct sscape_microcode __user *mc = (const struct sscape_microcode __user *) arg; err = sscape_upload_microcode(sscape, mc); } diff -urN linux-2.6.7-rc2/sound/isa/wavefront/wavefront_fx.c linux-2.6.7-rc3/sound/isa/wavefront/wavefront_fx.c --- linux-2.6.7-rc2/sound/isa/wavefront/wavefront_fx.c 2004-05-09 19:32:52.000000000 -0700 +++ linux-2.6.7-rc3/sound/isa/wavefront/wavefront_fx.c 2004-06-07 12:55:30.572764167 -0700 @@ -179,7 +179,7 @@ acard = card->private_data; dev = &acard->wavefront; - if (copy_from_user (&r, (unsigned char *) arg, sizeof (wavefront_fx_info))) + if (copy_from_user (&r, (void __user *)arg, sizeof (wavefront_fx_info))) return -EFAULT; switch (r.request) { @@ -201,7 +201,7 @@ return -EIO; } if (copy_from_user (page_data, - (unsigned char *) r.data[3], + (unsigned char __user *) r.data[3], r.data[2])) return -EFAULT; pd = page_data; diff -urN linux-2.6.7-rc2/sound/isa/wavefront/wavefront_synth.c linux-2.6.7-rc3/sound/isa/wavefront/wavefront_synth.c --- linux-2.6.7-rc2/sound/isa/wavefront/wavefront_synth.c 2004-06-07 12:54:54.805282710 -0700 +++ linux-2.6.7-rc3/sound/isa/wavefront/wavefront_synth.c 2004-06-07 12:55:30.574764250 -0700 @@ -861,7 +861,7 @@ static int wavefront_send_sample (snd_wavefront_t *dev, wavefront_patch_info *header, - u16 *dataptr, + u16 __user *dataptr, int data_is_unsigned) { @@ -876,7 +876,7 @@ u16 sample_short; u32 length; - u16 *data_end = 0; + u16 __user *data_end = 0; unsigned int i; const unsigned int max_blksize = 4096/2; unsigned int written; @@ -1355,7 +1355,7 @@ #endif static int -wavefront_load_patch (snd_wavefront_t *dev, const char *addr) +wavefront_load_patch (snd_wavefront_t *dev, const char __user *addr) { wavefront_patch_info header; @@ -1377,8 +1377,7 @@ switch (header.subkey) { case WF_ST_SAMPLE: /* sample or sample_header, based on patch->size */ - if (copy_from_user ((unsigned char *) &header.hdr.s, - (unsigned char *) header.hdrptr, + if (copy_from_user (&header.hdr.s, header.hdrptr, sizeof (wavefront_sample))) return -EFAULT; @@ -1386,8 +1385,7 @@ case WF_ST_MULTISAMPLE: - if (copy_from_user ((unsigned char *) &header.hdr.s, - (unsigned char *) header.hdrptr, + if (copy_from_user (&header.hdr.s, header.hdrptr, sizeof (wavefront_multisample))) return -EFAULT; @@ -1396,32 +1394,28 @@ case WF_ST_ALIAS: - if (copy_from_user ((unsigned char *) &header.hdr.a, - (unsigned char *) header.hdrptr, + if (copy_from_user (&header.hdr.a, header.hdrptr, sizeof (wavefront_alias))) return -EFAULT; return wavefront_send_alias (dev, &header); case WF_ST_DRUM: - if (copy_from_user ((unsigned char *) &header.hdr.d, - (unsigned char *) header.hdrptr, + if (copy_from_user (&header.hdr.d, header.hdrptr, sizeof (wavefront_drum))) return -EFAULT; return wavefront_send_drum (dev, &header); case WF_ST_PATCH: - if (copy_from_user ((unsigned char *) &header.hdr.p, - (unsigned char *) header.hdrptr, + if (copy_from_user (&header.hdr.p, header.hdrptr, sizeof (wavefront_patch))) return -EFAULT; return wavefront_send_patch (dev, &header); case WF_ST_PROGRAM: - if (copy_from_user ((unsigned char *) &header.hdr.pr, - (unsigned char *) header.hdrptr, + if (copy_from_user (&header.hdr.pr, header.hdrptr, sizeof (wavefront_program))) return -EFAULT; @@ -1627,6 +1621,7 @@ snd_wavefront_t *dev; snd_wavefront_card_t *acard; wavefront_control wc; + void __user *argp = (void __user *)arg; card = (snd_card_t *) hw->card; @@ -1639,18 +1634,18 @@ switch (cmd) { case WFCTL_LOAD_SPP: - if (wavefront_load_patch (dev, (char *) arg) != 0) { + if (wavefront_load_patch (dev, argp) != 0) { return -EIO; } break; case WFCTL_WFCMD: - if (copy_from_user (&wc, (void *) arg, sizeof (wc))) + if (copy_from_user (&wc, argp, sizeof (wc))) return -EFAULT; if (wavefront_synth_control (acard, &wc) < 0) { return -EIO; } - if (copy_to_user ((void *) arg, &wc, sizeof (wc))) + if (copy_to_user (argp, &wc, sizeof (wc))) return -EFAULT; break; diff -urN linux-2.6.7-rc2/sound/oss/ad1889.c linux-2.6.7-rc3/sound/oss/ad1889.c --- linux-2.6.7-rc2/sound/oss/ad1889.c 2004-05-09 19:32:27.000000000 -0700 +++ linux-2.6.7-rc3/sound/oss/ad1889.c 2004-06-07 12:55:30.785772991 -0700 @@ -437,13 +437,13 @@ /************************* /dev/dsp interfaces ************************* */ -static ssize_t ad1889_read(struct file *file, char *buffer, size_t count, +static ssize_t ad1889_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) { return 0; } -static ssize_t ad1889_write(struct file *file, const char *buffer, size_t count, +static ssize_t ad1889_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { ad1889_dev_t *dev = (ad1889_dev_t *)file->private_data; @@ -617,11 +617,12 @@ ad1889_dev_t *dev = (ad1889_dev_t *)file->private_data; struct dmabuf *dmabuf; audio_buf_info abinfo; + int __user *p = (int __user *)arg; switch (cmd) { case OSS_GETVERSION: - return put_user(SOUND_VERSION, (int *)arg); + return put_user(SOUND_VERSION, p); case SNDCTL_DSP_RESET: break; @@ -631,7 +632,7 @@ case SNDCTL_DSP_SPEED: /* set sampling rate */ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val > 5400 && val < 48000) { @@ -643,7 +644,7 @@ return 0; case SNDCTL_DSP_STEREO: /* undocumented? */ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (file->f_mode & FMODE_READ) { val = AD1889_READW(ad1889_dev, AD_DSWSMC); @@ -667,13 +668,13 @@ return 0; case SNDCTL_DSP_GETBLKSIZE: - return put_user(DMA_SIZE, (int *)arg); + return put_user(DMA_SIZE, p); case SNDCTL_DSP_GETFMTS: - return put_user(AFMT_S16_LE|AFMT_U8, (int *)arg); + return put_user(AFMT_S16_LE|AFMT_U8, p); case SNDCTL_DSP_SETFMT: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (file->f_mode & FMODE_READ) @@ -682,7 +683,7 @@ if (file->f_mode & FMODE_WRITE) ad1889_set_wav_fmt(dev, val); - return put_user(val, (int *)arg); + return put_user(val, p); case SNDCTL_DSP_CHANNELS: break; @@ -696,7 +697,7 @@ case SNDCTL_DSP_SETFRAGMENT: /* not supported; uses fixed fragment sizes */ - return put_user(DMA_SIZE, (int *)arg); + return put_user(DMA_SIZE, p); case SNDCTL_DSP_GETOSPACE: case SNDCTL_DSP_GETISPACE: @@ -709,13 +710,13 @@ abinfo.fragstotal = 1; abinfo.fragsize = DMA_SIZE; abinfo.bytes = DMA_SIZE; - return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; + return copy_to_user(p, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_NONBLOCK: file->f_flags |= O_NONBLOCK; return 0; case SNDCTL_DSP_GETCAPS: - return put_user(0, (int *)arg); + return put_user(0, p); case SNDCTL_DSP_GETTRIGGER: case SNDCTL_DSP_SETTRIGGER: @@ -732,7 +733,7 @@ break; case SOUND_PCM_READ_RATE: - return put_user(AD1889_READW(ad1889_dev, AD_DSWAS), (int *)arg); + return put_user(AD1889_READW(ad1889_dev, AD_DSWAS), p); case SOUND_PCM_READ_CHANNELS: case SOUND_PCM_READ_BITS: diff -urN linux-2.6.7-rc2/sound/oss/ali5455.c linux-2.6.7-rc3/sound/oss/ali5455.c --- linux-2.6.7-rc2/sound/oss/ali5455.c 2004-05-09 19:33:13.000000000 -0700 +++ linux-2.6.7-rc3/sound/oss/ali5455.c 2004-06-07 12:55:30.804773778 -0700 @@ -1579,7 +1579,7 @@ waiting to be copied to the user's buffer. It is filled by the dma machine and drained by this loop. */ -static ssize_t ali_read(struct file *file, char *buffer, +static ssize_t ali_read(struct file *file, char __user *buffer, size_t count, loff_t * ppos) { struct ali_state *state = (struct ali_state *) file->private_data; @@ -1721,7 +1721,7 @@ /* in this loop, dmabuf.count signifies the amount of data that is waiting to be dma to the soundcard. it is drained by the dma machine and filled by this loop. */ static ssize_t ali_write(struct file *file, - const char *buffer, size_t count, loff_t * ppos) + const char __user *buffer, size_t count, loff_t * ppos) { struct ali_state *state = (struct ali_state *) file->private_data; struct ali_card *card = state ? state->card : 0; @@ -1981,16 +1981,19 @@ unsigned int i_scr; int val = 0, ret; struct ac97_codec *codec = state->card->ac97_codec[0]; + void __user *argp = (void __user *)arg; + int __user *p = argp; + #ifdef DEBUG printk("ali_audio: ali_ioctl, arg=0x%x, cmd=", - arg ? *(int *) arg : 0); + arg ? *p : 0); #endif switch (cmd) { case OSS_GETVERSION: #ifdef DEBUG printk("OSS_GETVERSION\n"); #endif - return put_user(SOUND_VERSION, (int *) arg); + return put_user(SOUND_VERSION, p); case SNDCTL_DSP_RESET: #ifdef DEBUG printk("SNDCTL_DSP_RESET\n"); @@ -2058,7 +2061,7 @@ #ifdef DEBUG printk("SNDCTL_DSP_SPEED\n"); #endif - if (get_user(val, (int *) arg)) + if (get_user(val, p)) return -EFAULT; if (val >= 0) { if (file->f_mode & FMODE_WRITE) { @@ -2136,7 +2139,7 @@ spin_unlock_irqrestore(&state->card->lock, flags); } } - return put_user(dmabuf->rate, (int *) arg); + return put_user(dmabuf->rate, p); case SNDCTL_DSP_STEREO: /* set stereo or mono channel */ #ifdef DEBUG printk("SNDCTL_DSP_STEREO\n"); @@ -2153,7 +2156,7 @@ if (dmabuf->enable & CONTROLLER_SPDIFOUT_RUNNING) { stop_spdifout(state); } - return put_user(1, (int *) arg); + return put_user(1, p); case SNDCTL_DSP_GETBLKSIZE: if (file->f_mode & FMODE_WRITE) { if (codec_independent_spdif_locked > 0) { @@ -2177,22 +2180,22 @@ #ifdef DEBUG printk("SNDCTL_DSP_GETBLKSIZE %d\n", dmabuf->userfragsize); #endif - return put_user(dmabuf->userfragsize, (int *) arg); + return put_user(dmabuf->userfragsize, p); case SNDCTL_DSP_GETFMTS: /* Returns a mask of supported sample format */ #ifdef DEBUG printk("SNDCTL_DSP_GETFMTS\n"); #endif - return put_user(AFMT_S16_LE, (int *) arg); + return put_user(AFMT_S16_LE, p); case SNDCTL_DSP_SETFMT: /* Select sample format */ #ifdef DEBUG printk("SNDCTL_DSP_SETFMT\n"); #endif - return put_user(AFMT_S16_LE, (int *) arg); + return put_user(AFMT_S16_LE, p); case SNDCTL_DSP_CHANNELS: // add support 4,6 channel #ifdef DEBUG printk("SNDCTL_DSP_CHANNELS\n"); #endif - if (get_user(val, (int *) arg)) + if (get_user(val, p)) return -EFAULT; if (val > 0) { if (dmabuf->enable & DAC_RUNNING) { @@ -2208,7 +2211,7 @@ stop_adc(state); } } else { - return put_user(state->card->channels, (int *) arg); + return put_user(state->card->channels, p); } i_scr = inl(state->card->iobase + ALI_SCR); @@ -2243,7 +2246,7 @@ val = ret; break; } - return put_user(val, (int *) arg); + return put_user(val, p); case SNDCTL_DSP_POST: /* the user has sent all data and is notifying us */ /* we update the swptr to the end of the last sg segment then return */ #ifdef DEBUG @@ -2270,7 +2273,7 @@ case SNDCTL_DSP_SUBDIVIDE: if (dmabuf->subdivision) return -EINVAL; - if (get_user(val, (int *) arg)) + if (get_user(val, p)) return -EFAULT; if (val != 1 && val != 2 && val != 4) return -EINVAL; @@ -2281,7 +2284,7 @@ dmabuf->ready = 0; return 0; case SNDCTL_DSP_SETFRAGMENT: - if (get_user(val, (int *) arg)) + if (get_user(val, p)) return -EFAULT; dmabuf->ossfragsize = 1 << (val & 0xffff); dmabuf->ossmaxfrags = (val >> 16) & 0xffff; @@ -2360,7 +2363,7 @@ abinfo.bytes, abinfo.fragsize, abinfo.fragments, abinfo.fragstotal); #endif - return copy_to_user((void *) arg, &abinfo, + return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_GETOPTR: if (!(file->f_mode & FMODE_WRITE)) @@ -2408,7 +2411,7 @@ printk("SNDCTL_DSP_GETOPTR %d, %d, %d, %d\n", cinfo.bytes, cinfo.blocks, cinfo.ptr, dmabuf->count); #endif - return copy_to_user((void *) arg, &cinfo, sizeof(cinfo))? -EFAULT : 0; + return copy_to_user(argp, &cinfo, sizeof(cinfo))? -EFAULT : 0; case SNDCTL_DSP_GETISPACE: if (!(file->f_mode & FMODE_READ)) return -EINVAL; @@ -2425,7 +2428,7 @@ abinfo.bytes, abinfo.fragsize, abinfo.fragments, abinfo.fragstotal); #endif - return copy_to_user((void *) arg, &abinfo, + return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_GETIPTR: if (!(file->f_mode & FMODE_READ)) @@ -2447,7 +2450,7 @@ printk("SNDCTL_DSP_GETIPTR %d, %d, %d, %d\n", cinfo.bytes, cinfo.blocks, cinfo.ptr, dmabuf->count); #endif - return copy_to_user((void *) arg, &cinfo, sizeof(cinfo))? -EFAULT: 0; + return copy_to_user(argp, &cinfo, sizeof(cinfo))? -EFAULT: 0; case SNDCTL_DSP_NONBLOCK: #ifdef DEBUG printk("SNDCTL_DSP_NONBLOCK\n"); @@ -2459,15 +2462,15 @@ printk("SNDCTL_DSP_GETCAPS\n"); #endif return put_user(DSP_CAP_REALTIME | DSP_CAP_TRIGGER | - DSP_CAP_MMAP | DSP_CAP_BIND, (int *) arg); + DSP_CAP_MMAP | DSP_CAP_BIND, p); case SNDCTL_DSP_GETTRIGGER: val = 0; #ifdef DEBUG printk("SNDCTL_DSP_GETTRIGGER 0x%x\n", dmabuf->trigger); #endif - return put_user(dmabuf->trigger, (int *) arg); + return put_user(dmabuf->trigger, p); case SNDCTL_DSP_SETTRIGGER: - if (get_user(val, (int *) arg)) + if (get_user(val, p)) return -EFAULT; #if defined(DEBUG) || defined(DEBUG_MMAP) printk("SNDCTL_DSP_SETTRIGGER 0x%x\n", val); @@ -2586,27 +2589,27 @@ #ifdef DEBUG printk("SNDCTL_DSP_GETODELAY %d\n", dmabuf->count); #endif - return put_user(val, (int *) arg); + return put_user(val, p); case SOUND_PCM_READ_RATE: #ifdef DEBUG printk("SOUND_PCM_READ_RATE %d\n", dmabuf->rate); #endif - return put_user(dmabuf->rate, (int *) arg); + return put_user(dmabuf->rate, p); case SOUND_PCM_READ_CHANNELS: #ifdef DEBUG printk("SOUND_PCM_READ_CHANNELS\n"); #endif - return put_user(2, (int *) arg); + return put_user(2, p); case SOUND_PCM_READ_BITS: #ifdef DEBUG printk("SOUND_PCM_READ_BITS\n"); #endif - return put_user(AFMT_S16_LE, (int *) arg); + return put_user(AFMT_S16_LE, p); case SNDCTL_DSP_SETSPDIF: /* Set S/PDIF Control register */ #ifdef DEBUG printk("SNDCTL_DSP_SETSPDIF\n"); #endif - if (get_user(val, (int *) arg)) + if (get_user(val, p)) return -EFAULT; /* Check to make sure the codec supports S/PDIF transmitter */ if ((state->card->ac97_features & 4)) { @@ -2625,12 +2628,12 @@ else printk(KERN_WARNING "ali_audio: S/PDIF transmitter not avalible.\n"); #endif - return put_user(val, (int *) arg); + return put_user(val, p); case SNDCTL_DSP_GETSPDIF: /* Get S/PDIF Control register */ #ifdef DEBUG printk("SNDCTL_DSP_GETSPDIF\n"); #endif - if (get_user(val, (int *) arg)) + if (get_user(val, p)) return -EFAULT; /* Check to make sure the codec supports S/PDIF transmitter */ if (!(state->card->ac97_features & 4)) { @@ -2642,14 +2645,14 @@ val = ali_ac97_get(codec, AC97_SPDIF_CONTROL); } - return put_user(val, (int *) arg); + return put_user(val, p); //end add support spdif out //add support 4,6 channel case SNDCTL_DSP_GETCHANNELMASK: #ifdef DEBUG printk("SNDCTL_DSP_GETCHANNELMASK\n"); #endif - if (get_user(val, (int *) arg)) + if (get_user(val, p)) return -EFAULT; /* Based on AC'97 DAC support, not ICH hardware */ val = DSP_BIND_FRONT; @@ -2659,12 +2662,12 @@ val |= DSP_BIND_SURR; if (state->card->ac97_features & 0x0140) val |= DSP_BIND_CENTER_LFE; - return put_user(val, (int *) arg); + return put_user(val, p); case SNDCTL_DSP_BIND_CHANNEL: #ifdef DEBUG printk("SNDCTL_DSP_BIND_CHANNEL\n"); #endif - if (get_user(val, (int *) arg)) + if (get_user(val, p)) return -EFAULT; if (val == DSP_BIND_QUERY) { val = DSP_BIND_FRONT; /* Always report this as being enabled */ @@ -2749,7 +2752,7 @@ val &= ~DSP_BIND_CENTER_LFE; } } - return put_user(val, (int *) arg); + return put_user(val, p); case SNDCTL_DSP_MAPINBUF: case SNDCTL_DSP_MAPOUTBUF: case SNDCTL_DSP_SETSYNCRO: diff -urN linux-2.6.7-rc2/sound/oss/awe_wave.c linux-2.6.7-rc3/sound/oss/awe_wave.c --- linux-2.6.7-rc2/sound/oss/awe_wave.c 2004-06-07 12:54:55.023291739 -0700 +++ linux-2.6.7-rc3/sound/oss/awe_wave.c 2004-06-07 12:55:30.841775310 -0700 @@ -3344,10 +3344,10 @@ /* read from user buffer */ if (readbuf_flags & AWE_SAMPLE_8BITS) { unsigned char cc; - get_user(cc, (unsigned __user char*)(readbuf_addr + readbuf_offs + pos)); + get_user(cc, (unsigned char __user *)(readbuf_addr + readbuf_offs + pos)); c = (unsigned short)cc << 8; /* convert 8bit -> 16bit */ } else { - get_user(c, (unsigned __user short*)(readbuf_addr + readbuf_offs + pos * 2)); + get_user(c, (unsigned short __user *)(readbuf_addr + readbuf_offs + pos * 2)); } if (readbuf_flags & AWE_SAMPLE_UNSIGNED) c ^= 0x8000; /* unsigned -> signed */ diff -urN linux-2.6.7-rc2/sound/oss/btaudio.c linux-2.6.7-rc3/sound/oss/btaudio.c --- linux-2.6.7-rc2/sound/oss/btaudio.c 2004-05-09 19:32:26.000000000 -0700 +++ linux-2.6.7-rc3/sound/oss/btaudio.c 2004-06-07 12:55:30.874776677 -0700 @@ -327,6 +327,7 @@ { struct btaudio *bta = file->private_data; int ret,val=0,i=0; + void __user *argp = (void __user *)arg; if (cmd == SOUND_MIXER_INFO) { mixer_info info; @@ -334,7 +335,7 @@ strlcpy(info.id,"bt878",sizeof(info.id)); strlcpy(info.name,"Brooktree Bt878 audio",sizeof(info.name)); info.modify_counter = bta->mixcount; - if (copy_to_user((void *)arg, &info, sizeof(info))) + if (copy_to_user(argp, &info, sizeof(info))) return -EFAULT; return 0; } @@ -343,16 +344,16 @@ memset(&info,0,sizeof(info)); strlcpy(info.id,"bt878",sizeof(info.id)-1); strlcpy(info.name,"Brooktree Bt878 audio",sizeof(info.name)); - if (copy_to_user((void *)arg, &info, sizeof(info))) + if (copy_to_user(argp, &info, sizeof(info))) return -EFAULT; return 0; } if (cmd == OSS_GETVERSION) - return put_user(SOUND_VERSION, (int *)arg); + return put_user(SOUND_VERSION, (int __user *)argp); /* read */ if (_SIOC_DIR(cmd) & _SIOC_WRITE) - if (get_user(val, (int *)arg)) + if (get_user(val, (int __user *)argp)) return -EFAULT; switch (cmd) { @@ -421,7 +422,7 @@ default: return -EINVAL; } - if (put_user(ret, (int *)arg)) + if (put_user(ret, (int __user *)argp)) return -EFAULT; return 0; } @@ -503,7 +504,7 @@ return 0; } -static ssize_t btaudio_dsp_read(struct file *file, char *buffer, +static ssize_t btaudio_dsp_read(struct file *file, char __user *buffer, size_t swcount, loff_t *ppos) { struct btaudio *bta = file->private_data; @@ -554,7 +555,7 @@ } else if (!bta->analog) { /* stereo => mono (digital audio) */ __s16 *src = (__s16*)(bta->buf_cpu + bta->read_offset); - __s16 *dst = (__s16*)(buffer + ret); + __s16 __user *dst = (__s16 __user *)(buffer + ret); __s16 avg; int n = ndst>>1; if (0 != verify_area(VERIFY_WRITE,dst,ndst)) { @@ -565,13 +566,13 @@ for (; n; n--, dst++) { avg = (__s16)le16_to_cpu(*src) / 2; src++; avg += (__s16)le16_to_cpu(*src) / 2; src++; - __put_user(cpu_to_le16(avg),(__u16*)(dst)); + __put_user(cpu_to_le16(avg),dst); } } else if (8 == bta->bits) { /* copy + byte downsampling (audio A/D) */ __u8 *src = bta->buf_cpu + bta->read_offset; - __u8 *dst = buffer + ret; + __u8 __user *dst = buffer + ret; int n = ndst; if (0 != verify_area(VERIFY_WRITE,dst,ndst)) { if (0 == ret) @@ -579,12 +580,12 @@ break; } for (; n; n--, src += (1 << bta->sampleshift), dst++) - __put_user(*src,(__u8*)(dst)); + __put_user(*src, dst); } else { /* copy + word downsampling (audio A/D) */ __u16 *src = (__u16*)(bta->buf_cpu + bta->read_offset); - __u16 *dst = (__u16*)(buffer + ret); + __u16 __user *dst = (__u16 __user *)(buffer + ret); int n = ndst>>1; if (0 != verify_area(VERIFY_WRITE,dst,ndst)) { if (0 == ret) @@ -592,7 +593,7 @@ break; } for (; n; n--, src += (1 << bta->sampleshift), dst++) - __put_user(*src,(__u16*)(dst)); + __put_user(*src, dst); } ret += ndst; @@ -609,7 +610,7 @@ return ret; } -static ssize_t btaudio_dsp_write(struct file *file, const char *buffer, +static ssize_t btaudio_dsp_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { return -EINVAL; @@ -620,15 +621,17 @@ { struct btaudio *bta = file->private_data; int s, i, ret, val = 0; + void __user *argp = (void __user *)arg; + int __user *p = argp; switch (cmd) { case OSS_GETVERSION: - return put_user(SOUND_VERSION, (int *)arg); + return put_user(SOUND_VERSION, p); case SNDCTL_DSP_GETCAPS: return 0; case SNDCTL_DSP_SPEED: - if (get_user(val, (int*)arg)) + if (get_user(val, p)) return -EFAULT; if (bta->analog) { for (s = 0; s < 16; s++) @@ -656,14 +659,14 @@ /* fall through */ case SOUND_PCM_READ_RATE: if (bta->analog) { - return put_user(HWBASE_AD*4/bta->decimation>>bta->sampleshift, (int*)arg); + return put_user(HWBASE_AD*4/bta->decimation>>bta->sampleshift, p); } else { - return put_user(bta->rate, (int*)arg); + return put_user(bta->rate, p); } case SNDCTL_DSP_STEREO: if (!bta->analog) { - if (get_user(val, (int*)arg)) + if (get_user(val, p)) return -EFAULT; bta->channels = (val > 0) ? 2 : 1; bta->sampleshift = (bta->channels == 2) ? 0 : 1; @@ -681,11 +684,11 @@ "btaudio: stereo=0 channels=1\n"); } } - return put_user((bta->channels)-1, (int *)arg); + return put_user((bta->channels)-1, p); case SNDCTL_DSP_CHANNELS: if (!bta->analog) { - if (get_user(val, (int*)arg)) + if (get_user(val, p)) return -EFAULT; bta->channels = (val > 1) ? 2 : 1; bta->sampleshift = (bta->channels == 2) ? 0 : 1; @@ -696,16 +699,16 @@ } /* fall through */ case SOUND_PCM_READ_CHANNELS: - return put_user(bta->channels, (int *)arg); + return put_user(bta->channels, p); case SNDCTL_DSP_GETFMTS: /* Returns a mask */ if (bta->analog) - return put_user(AFMT_S16_LE|AFMT_S8, (int*)arg); + return put_user(AFMT_S16_LE|AFMT_S8, p); else - return put_user(AFMT_S16_LE, (int*)arg); + return put_user(AFMT_S16_LE, p); case SNDCTL_DSP_SETFMT: /* Selects ONE fmt*/ - if (get_user(val, (int*)arg)) + if (get_user(val, p)) return -EFAULT; if (val != AFMT_QUERY) { if (bta->analog) @@ -722,10 +725,10 @@ if (debug) printk(KERN_DEBUG "btaudio: fmt: bits=%d\n",bta->bits); return put_user((bta->bits==16) ? AFMT_S16_LE : AFMT_S8, - (int*)arg); + p); break; case SOUND_PCM_READ_BITS: - return put_user(bta->bits, (int*)arg); + return put_user(bta->bits, p); case SNDCTL_DSP_NONBLOCK: file->f_flags |= O_NONBLOCK; @@ -745,7 +748,7 @@ if (0 != (ret = make_risc(bta))) return ret; } - return put_user(bta->block_bytes>>bta->sampleshift,(int*)arg); + return put_user(bta->block_bytes>>bta->sampleshift,p); case SNDCTL_DSP_SYNC: /* NOP */ @@ -764,7 +767,7 @@ "returns %d/%d/%d/%d\n", info.fragsize, info.fragstotal, info.bytes, info.fragments); - if (copy_to_user((void *)arg, &info, sizeof(info))) + if (copy_to_user(argp, &info, sizeof(info))) return -EFAULT; return 0; } diff -urN linux-2.6.7-rc2/sound/oss/cmpci.c linux-2.6.7-rc3/sound/oss/cmpci.c --- linux-2.6.7-rc2/sound/oss/cmpci.c 2004-06-07 12:54:55.063293396 -0700 +++ linux-2.6.7-rc3/sound/oss/cmpci.c 2004-06-07 12:55:30.908778086 -0700 @@ -980,13 +980,13 @@ spin_unlock_irqrestore(&s->lock, flags); } -static int trans_ac3(struct cm_state *s, void *dest, const char *source, int size) +static int trans_ac3(struct cm_state *s, void *dest, const char __user *source, int size) { int i = size / 2; unsigned long data; unsigned short data16; unsigned long *dst = (unsigned long *) dest; - unsigned short *src = (unsigned short *)source; + unsigned short __user *src = (unsigned short __user *)source; int err; do { @@ -1639,6 +1639,8 @@ unsigned long flags; int i, val, j; unsigned char l, r, rl, rr; + void __user *argp = (void __user *)arg; + int __user *p = argp; VALIDATE_STATE(s); if (cmd == SOUND_MIXER_INFO) { @@ -1647,7 +1649,7 @@ strlcpy(info.id, "cmpci", sizeof(info.id)); strlcpy(info.name, "C-Media PCI", sizeof(info.name)); info.modify_counter = s->mix.modcnt; - if (copy_to_user((void *)arg, &info, sizeof(info))) + if (copy_to_user(argp, &info, sizeof(info))) return -EFAULT; return 0; } @@ -1656,50 +1658,50 @@ memset(&info, 0, sizeof(info)); strlcpy(info.id, "cmpci", sizeof(info.id)); strlcpy(info.name, "C-Media cmpci", sizeof(info.name)); - if (copy_to_user((void *)arg, &info, sizeof(info))) + if (copy_to_user(argp, &info, sizeof(info))) return -EFAULT; return 0; } if (cmd == OSS_GETVERSION) - return put_user(SOUND_VERSION, (int *)arg); + return put_user(SOUND_VERSION, p); if (_IOC_TYPE(cmd) != 'M' || _SIOC_SIZE(cmd) != sizeof(int)) return -EINVAL; if (_SIOC_DIR(cmd) == _SIOC_READ) { switch (_IOC_NR(cmd)) { case SOUND_MIXER_RECSRC: /* Arg contains a bit for each recording source */ val = mixer_recmask(s); - return put_user(val, (int *)arg); + return put_user(val, p); case SOUND_MIXER_OUTSRC: /* Arg contains a bit for each recording source */ val = mixer_outmask(s); - return put_user(val, (int *)arg); + return put_user(val, p); case SOUND_MIXER_DEVMASK: /* Arg contains a bit for each supported device */ for (val = i = 0; i < SOUND_MIXER_NRDEVICES; i++) if (mixtable[i].type) val |= 1 << i; - return put_user(val, (int *)arg); + return put_user(val, p); case SOUND_MIXER_RECMASK: /* Arg contains a bit for each supported recording source */ for (val = i = 0; i < SOUND_MIXER_NRDEVICES; i++) if (mixtable[i].rec) val |= 1 << i; - return put_user(val, (int *)arg); + return put_user(val, p); case SOUND_MIXER_OUTMASK: /* Arg contains a bit for each supported recording source */ for (val = i = 0; i < SOUND_MIXER_NRDEVICES; i++) if (mixtable[i].play) val |= 1 << i; - return put_user(val, (int *)arg); + return put_user(val, p); case SOUND_MIXER_STEREODEVS: /* Mixer channels supporting stereo */ for (val = i = 0; i < SOUND_MIXER_NRDEVICES; i++) if (mixtable[i].type && mixtable[i].type != MT_4MUTEMONO) val |= 1 << i; - return put_user(val, (int *)arg); + return put_user(val, p); case SOUND_MIXER_CAPS: - return put_user(0, (int *)arg); + return put_user(0, p); default: i = _IOC_NR(cmd); @@ -1707,7 +1709,7 @@ return -EINVAL; if (!volidx[i]) return -EINVAL; - return put_user(s->mix.vol[volidx[i]-1], (int *)arg); + return put_user(s->mix.vol[volidx[i]-1], p); } } if (_SIOC_DIR(cmd) != (_SIOC_READ|_SIOC_WRITE)) @@ -1715,7 +1717,7 @@ s->mix.modcnt++; switch (_IOC_NR(cmd)) { case SOUND_MIXER_RECSRC: /* Arg contains a bit for each recording source */ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; i = generic_hweight32(val); for (j = i = 0; i < SOUND_MIXER_NRDEVICES; i++) { @@ -1734,7 +1736,7 @@ return 0; case SOUND_MIXER_OUTSRC: /* Arg contains a bit for each recording source */ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; for (j = i = 0; i < SOUND_MIXER_NRDEVICES; i++) { if (!(val & (1 << i))) @@ -1754,7 +1756,7 @@ i = _IOC_NR(cmd); if (i >= SOUND_MIXER_NRDEVICES || !mixtable[i].type) return -EINVAL; - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; l = val & 0xff; r = (val >> 8) & 0xff; @@ -1829,7 +1831,7 @@ if (!volidx[i]) return -EINVAL; s->mix.vol[volidx[i]-1] = val; - return put_user(s->mix.vol[volidx[i]-1], (int *)arg); + return put_user(s->mix.vol[volidx[i]-1], p); } } @@ -1914,7 +1916,7 @@ /* --------------------------------------------------------------------- */ -static ssize_t cm_read(struct file *file, char *buffer, size_t count, loff_t *ppos) +static ssize_t cm_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) { struct cm_state *s = (struct cm_state *)file->private_data; DECLARE_WAITQUEUE(wait, current); @@ -1975,11 +1977,11 @@ } if (s->status & DO_BIGENDIAN_R) { int i, err; - unsigned char *src, *dst; + unsigned char *src; + char __user *dst = buffer; unsigned char data[2]; src = (unsigned char *) (s->dma_adc.rawbuf + swptr); - dst = (unsigned char *) buffer; // copy left/right sample at one time for (i = 0; i < cnt / 2; i++) { data[0] = src[1]; @@ -2016,7 +2018,7 @@ return ret; } -static ssize_t cm_write(struct file *file, const char *buffer, size_t count, loff_t *ppos) +static ssize_t cm_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { struct cm_state *s = (struct cm_state *)file->private_data; DECLARE_WAITQUEUE(wait, current); @@ -2116,10 +2118,10 @@ swptr = (swptr + 2 * cnt) % s->dma_dac.dmasize; } else if ((s->status & DO_DUAL_DAC) && (s->status & DO_BIGENDIAN_W)) { int i, err; - unsigned char *src, *dst0, *dst1; + const char __user *src = buffer; + unsigned char *dst0, *dst1; unsigned char data[8]; - src = (unsigned char *) buffer; dst0 = (unsigned char *) (s->dma_dac.rawbuf + swptr); dst1 = (unsigned char *) (s->dma_adc.rawbuf + swptr); // copy left/right sample at one time @@ -2170,9 +2172,9 @@ swptr = (swptr + cnt) % s->dma_dac.dmasize; } else if (s->status & DO_DUAL_DAC) { int i, err; - unsigned long *src, *dst0, *dst1; + unsigned long __user *src = (unsigned long __user *) buffer; + unsigned long *dst0, *dst1; - src = (unsigned long *) buffer; dst0 = (unsigned long *) (s->dma_dac.rawbuf + swptr); dst1 = (unsigned long *) (s->dma_adc.rawbuf + swptr); // copy left/right sample at one time @@ -2189,10 +2191,10 @@ swptr = (swptr + cnt) % s->dma_dac.dmasize; } else if (s->status & DO_BIGENDIAN_W) { int i, err; - unsigned char *src, *dst; + const char __user *src = buffer; + unsigned char *dst; unsigned char data[2]; - src = (unsigned char *) buffer; dst = (unsigned char *) (s->dma_dac.rawbuf + swptr); // swap hi/lo bytes for each sample for (i = 0; i < cnt / 2; i++) { @@ -2330,13 +2332,15 @@ count_info cinfo; int val, mapped, ret; unsigned char fmtm, fmtd; + void __user *argp = (void __user *)arg; + int __user *p = argp; VALIDATE_STATE(s); mapped = ((file->f_mode & FMODE_WRITE) && s->dma_dac.mapped) || ((file->f_mode & FMODE_READ) && s->dma_adc.mapped); switch (cmd) { case OSS_GETVERSION: - return put_user(SOUND_VERSION, (int *)arg); + return put_user(SOUND_VERSION, p); case SNDCTL_DSP_SYNC: if (file->f_mode & FMODE_WRITE) @@ -2347,7 +2351,7 @@ return 0; case SNDCTL_DSP_GETCAPS: - return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP | DSP_CAP_BIND, (int *)arg); + return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP | DSP_CAP_BIND, p); case SNDCTL_DSP_RESET: if (file->f_mode & FMODE_WRITE) { @@ -2365,7 +2369,7 @@ return 0; case SNDCTL_DSP_SPEED: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val >= 0) { if (file->f_mode & FMODE_READ) { @@ -2383,10 +2387,10 @@ set_dac_rate(s, val); } } - return put_user((file->f_mode & FMODE_READ) ? s->rateadc : s->ratedac, (int *)arg); + return put_user((file->f_mode & FMODE_READ) ? s->rateadc : s->ratedac, p); case SNDCTL_DSP_STEREO: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; fmtd = 0; fmtm = ~0; @@ -2417,7 +2421,7 @@ return 0; case SNDCTL_DSP_CHANNELS: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != 0) { fmtd = 0; @@ -2449,18 +2453,18 @@ if ((s->capability & CAN_MULTI_CH) && (file->f_mode & FMODE_WRITE)) { val = set_dac_channels(s, val); - return put_user(val, (int *)arg); + return put_user(val, p); } } return put_user((s->fmt & ((file->f_mode & FMODE_READ) ? (CM_CFMT_STEREO << CM_CFMT_ADCSHIFT) - : (CM_CFMT_STEREO << CM_CFMT_DACSHIFT))) ? 2 : 1, (int *)arg); + : (CM_CFMT_STEREO << CM_CFMT_DACSHIFT))) ? 2 : 1, p); case SNDCTL_DSP_GETFMTS: /* Returns a mask */ return put_user(AFMT_S16_BE|AFMT_S16_LE|AFMT_U8| - ((s->capability & CAN_AC3) ? AFMT_AC3 : 0), (int *)arg); + ((s->capability & CAN_AC3) ? AFMT_AC3 : 0), p); case SNDCTL_DSP_SETFMT: /* Selects ONE fmt*/ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != AFMT_QUERY) { fmtd = 0; @@ -2503,9 +2507,9 @@ } set_fmt(s, fmtm, fmtd); } - if (s->status & DO_AC3) return put_user(AFMT_AC3, (int *)arg); + if (s->status & DO_AC3) return put_user(AFMT_AC3, p); return put_user((s->fmt & ((file->f_mode & FMODE_READ) ? (CM_CFMT_16BIT << CM_CFMT_ADCSHIFT) - : (CM_CFMT_16BIT << CM_CFMT_DACSHIFT))) ? val : AFMT_U8, (int *)arg); + : (CM_CFMT_16BIT << CM_CFMT_DACSHIFT))) ? val : AFMT_U8, p); case SNDCTL_DSP_POST: return 0; @@ -2517,16 +2521,16 @@ (s->enable & ENDAC) && (s->enable & ENADC)) val |= PCM_ENABLE_OUTPUT; - return put_user(val, (int *)arg); + return put_user(val, p); } if (file->f_mode & FMODE_READ && s->enable & ENADC) val |= PCM_ENABLE_INPUT; if (file->f_mode & FMODE_WRITE && s->enable & ENDAC) val |= PCM_ENABLE_OUTPUT; - return put_user(val, (int *)arg); + return put_user(val, p); case SNDCTL_DSP_SETTRIGGER: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (file->f_mode & FMODE_READ) { if (val & PCM_ENABLE_INPUT) { @@ -2568,7 +2572,7 @@ abinfo.fragstotal = s->dma_dac.numfrag; abinfo.fragments = abinfo.bytes >> s->dma_dac.fragshift; spin_unlock_irqrestore(&s->lock, flags); - return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_GETISPACE: if (!(file->f_mode & FMODE_READ)) @@ -2582,7 +2586,7 @@ abinfo.fragstotal = s->dma_adc.numfrag; abinfo.fragments = abinfo.bytes >> s->dma_adc.fragshift; spin_unlock_irqrestore(&s->lock, flags); - return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_NONBLOCK: file->f_flags |= O_NONBLOCK; @@ -2595,7 +2599,7 @@ cm_update_ptr(s); val = s->dma_dac.count; spin_unlock_irqrestore(&s->lock, flags); - return put_user(val, (int *)arg); + return put_user(val, p); case SNDCTL_DSP_GETIPTR: if (!(file->f_mode & FMODE_READ)) @@ -2608,7 +2612,7 @@ if (s->dma_adc.mapped) s->dma_adc.count &= s->dma_adc.fragsize-1; spin_unlock_irqrestore(&s->lock, flags); - return copy_to_user((void *)arg, &cinfo, sizeof(cinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &cinfo, sizeof(cinfo)) ? -EFAULT : 0; case SNDCTL_DSP_GETOPTR: if (!(file->f_mode & FMODE_WRITE)) @@ -2625,7 +2629,7 @@ s->dma_adc.count &= s->dma_adc.fragsize-1; } spin_unlock_irqrestore(&s->lock, flags); - return copy_to_user((void *)arg, &cinfo, sizeof(cinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &cinfo, sizeof(cinfo)) ? -EFAULT : 0; case SNDCTL_DSP_GETBLKSIZE: if (file->f_mode & FMODE_WRITE) { @@ -2634,16 +2638,16 @@ if (s->status & DO_DUAL_DAC) { if ((val = prog_dmabuf(s, 1))) return val; - return put_user(2 * s->dma_dac.fragsize, (int *)arg); + return put_user(2 * s->dma_dac.fragsize, p); } - return put_user(s->dma_dac.fragsize, (int *)arg); + return put_user(s->dma_dac.fragsize, p); } if ((val = prog_dmabuf(s, 1))) return val; - return put_user(s->dma_adc.fragsize, (int *)arg); + return put_user(s->dma_adc.fragsize, p); case SNDCTL_DSP_SETFRAGMENT: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (file->f_mode & FMODE_READ) { s->dma_adc.ossfragshift = val & 0xffff; @@ -2675,7 +2679,7 @@ if ((file->f_mode & FMODE_READ && s->dma_adc.subdivision) || (file->f_mode & FMODE_WRITE && s->dma_dac.subdivision)) return -EINVAL; - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != 1 && val != 2 && val != 4) return -EINVAL; @@ -2689,22 +2693,22 @@ return 0; case SOUND_PCM_READ_RATE: - return put_user((file->f_mode & FMODE_READ) ? s->rateadc : s->ratedac, (int *)arg); + return put_user((file->f_mode & FMODE_READ) ? s->rateadc : s->ratedac, p); case SOUND_PCM_READ_CHANNELS: - return put_user((s->fmt & ((file->f_mode & FMODE_READ) ? (CM_CFMT_STEREO << CM_CFMT_ADCSHIFT) : (CM_CFMT_STEREO << CM_CFMT_DACSHIFT))) ? 2 : 1, (int *)arg); + return put_user((s->fmt & ((file->f_mode & FMODE_READ) ? (CM_CFMT_STEREO << CM_CFMT_ADCSHIFT) : (CM_CFMT_STEREO << CM_CFMT_DACSHIFT))) ? 2 : 1, p); case SOUND_PCM_READ_BITS: - return put_user((s->fmt & ((file->f_mode & FMODE_READ) ? (CM_CFMT_16BIT << CM_CFMT_ADCSHIFT) : (CM_CFMT_16BIT << CM_CFMT_DACSHIFT))) ? 16 : 8, (int *)arg); + return put_user((s->fmt & ((file->f_mode & FMODE_READ) ? (CM_CFMT_16BIT << CM_CFMT_ADCSHIFT) : (CM_CFMT_16BIT << CM_CFMT_DACSHIFT))) ? 16 : 8, p); case SOUND_PCM_READ_FILTER: - return put_user((file->f_mode & FMODE_READ) ? s->rateadc : s->ratedac, (int *)arg); + return put_user((file->f_mode & FMODE_READ) ? s->rateadc : s->ratedac, p); case SNDCTL_DSP_GETCHANNELMASK: - return put_user(DSP_BIND_FRONT|DSP_BIND_SURR|DSP_BIND_CENTER_LFE|DSP_BIND_SPDIF, (int *)arg); + return put_user(DSP_BIND_FRONT|DSP_BIND_SURR|DSP_BIND_CENTER_LFE|DSP_BIND_SPDIF, p); case SNDCTL_DSP_BIND_CHANNEL: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val == DSP_BIND_QUERY) { val = DSP_BIND_FRONT; @@ -2757,7 +2761,7 @@ } } } - return put_user(val, (int *)arg); + return put_user(val, p); case SOUND_PCM_WRITE_FILTER: case SNDCTL_DSP_MAPINBUF: @@ -2765,47 +2769,47 @@ case SNDCTL_DSP_SETSYNCRO: return -EINVAL; case SNDCTL_SPDIF_COPYRIGHT: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; set_spdif_copyright(s, val); return 0; case SNDCTL_SPDIF_LOOP: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; set_spdif_loop(s, val); return 0; case SNDCTL_SPDIF_MONITOR: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; set_spdif_monitor(s, val); return 0; case SNDCTL_SPDIF_LEVEL: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; set_spdifout_level(s, val); return 0; case SNDCTL_SPDIF_INV: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; set_spdifin_inverse(s, val); return 0; case SNDCTL_SPDIF_SEL2: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; set_spdifin_channel2(s, val); return 0; case SNDCTL_SPDIF_VALID: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; set_spdifin_valid(s, val); return 0; case SNDCTL_SPDIFOUT: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; set_spdifout(s, val ? s->ratedac : 0); return 0; case SNDCTL_SPDIFIN: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; set_spdifin(s, val ? s->rateadc : 0); return 0; diff -urN linux-2.6.7-rc2/sound/oss/cs4281/cs4281m.c linux-2.6.7-rc3/sound/oss/cs4281/cs4281m.c --- linux-2.6.7-rc2/sound/oss/cs4281/cs4281m.c 2004-05-09 19:33:21.000000000 -0700 +++ linux-2.6.7-rc3/sound/oss/cs4281/cs4281m.c 2004-06-07 12:55:30.962780323 -0700 @@ -1694,7 +1694,7 @@ #define DMABUF_MINORDER 1 // ==> min buffer size = 8K. -extern void dealloc_dmabuf(struct cs4281_state *s, struct dmabuf *db) +void dealloc_dmabuf(struct cs4281_state *s, struct dmabuf *db) { struct page *map, *mapend; @@ -2148,6 +2148,7 @@ SOUND_MASK_MIC, SOUND_MASK_CD, 0, SOUND_MASK_LINE1, SOUND_MASK_LINE, SOUND_MASK_VOLUME, 0, 0 }; + void __user *argp = (void __user *)arg; // Index of mixtable1[] member is Device ID // and must be <= SOUND_MIXER_NRDEVICES. @@ -2195,26 +2196,26 @@ case SOUND_MIXER_CS_GETDBGMASK: return put_user(cs_debugmask, - (unsigned long *) arg); + (unsigned long __user *) argp); case SOUND_MIXER_CS_GETDBGLEVEL: return put_user(cs_debuglevel, - (unsigned long *) arg); + (unsigned long __user *) argp); case SOUND_MIXER_CS_SETDBGMASK: - if (get_user(val, (unsigned long *) arg)) + if (get_user(val, (unsigned long __user *) argp)) return -EFAULT; cs_debugmask = val; return 0; case SOUND_MIXER_CS_SETDBGLEVEL: - if (get_user(val, (unsigned long *) arg)) + if (get_user(val, (unsigned long __user *) argp)) return -EFAULT; cs_debuglevel = val; return 0; #ifndef NOT_CS4281_PM case SOUND_MIXER_CS_APM: - if (get_user(val, (unsigned long *) arg)) + if (get_user(val, (unsigned long __user *) argp)) return -EFAULT; if(val == CS_IOCTL_CMD_SUSPEND) cs4281_suspend(s); @@ -2238,7 +2239,7 @@ if (cmd == SOUND_MIXER_PRIVATE1) { // enable/disable/query mixer preamp - if (get_user(val, (int *) arg)) + if (get_user(val, (int __user *) argp)) return -EFAULT; if (val != -1) { cs4281_read_ac97(s, BA0_AC97_MIC_VOLUME, &temp1); @@ -2247,11 +2248,11 @@ } cs4281_read_ac97(s, BA0_AC97_MIC_VOLUME, &temp1); val = (temp1 & 0x40) ? 1 : 0; - return put_user(val, (int *) arg); + return put_user(val, (int __user *) argp); } if (cmd == SOUND_MIXER_PRIVATE2) { // enable/disable/query spatializer - if (get_user(val, (int *) arg)) + if (get_user(val, (int __user *)argp)) return -EFAULT; if (val != -1) { temp1 = (val & 0x3f) >> 2; @@ -2262,14 +2263,14 @@ temp1 | 0x2000); } cs4281_read_ac97(s, BA0_AC97_3D_CONTROL, &temp1); - return put_user((temp1 << 2) | 3, (int *) arg); + return put_user((temp1 << 2) | 3, (int __user *)argp); } if (cmd == SOUND_MIXER_INFO) { mixer_info info; strlcpy(info.id, "CS4281", sizeof(info.id)); strlcpy(info.name, "Crystal CS4281", sizeof(info.name)); info.modify_counter = s->mix.modcnt; - if (copy_to_user((void *) arg, &info, sizeof(info))) + if (copy_to_user(argp, &info, sizeof(info))) return -EFAULT; return 0; } @@ -2277,12 +2278,12 @@ _old_mixer_info info; strlcpy(info.id, "CS4281", sizeof(info.id)); strlcpy(info.name, "Crystal CS4281", sizeof(info.name)); - if (copy_to_user((void *) arg, &info, sizeof(info))) + if (copy_to_user(argp, &info, sizeof(info))) return -EFAULT; return 0; } if (cmd == OSS_GETVERSION) - return put_user(SOUND_VERSION, (int *) arg); + return put_user(SOUND_VERSION, (int __user *) argp); if (_IOC_TYPE(cmd) != 'M' || _SIOC_SIZE(cmd) != sizeof(int)) return -EINVAL; @@ -2292,9 +2293,8 @@ if (_SIOC_DIR(cmd) == _SIOC_READ) { switch (_IOC_NR(cmd)) { case SOUND_MIXER_RECSRC: // Arg contains a bit for each recording source - cs4281_read_ac97(s, BA0_AC97_RECORD_SELECT, - &temp1); - return put_user(mixer_src[temp1 & 7], (int *) arg); + cs4281_read_ac97(s, BA0_AC97_RECORD_SELECT, &temp1); + return put_user(mixer_src[temp1&7], (int __user *)argp); case SOUND_MIXER_DEVMASK: // Arg contains a bit for each supported device return put_user(SOUND_MASK_PCM | SOUND_MASK_SYNTH | @@ -2302,29 +2302,29 @@ SOUND_MASK_LINE1 | SOUND_MASK_MIC | SOUND_MASK_VOLUME | SOUND_MASK_RECLEV | - SOUND_MASK_SPEAKER, (int *) arg); + SOUND_MASK_SPEAKER, (int __user *)argp); case SOUND_MIXER_RECMASK: // Arg contains a bit for each supported recording source return put_user(SOUND_MASK_LINE | SOUND_MASK_MIC | SOUND_MASK_CD | SOUND_MASK_VOLUME | - SOUND_MASK_LINE1, (int *) arg); + SOUND_MASK_LINE1, (int __user *) argp); case SOUND_MIXER_STEREODEVS: // Mixer channels supporting stereo return put_user(SOUND_MASK_PCM | SOUND_MASK_SYNTH | SOUND_MASK_CD | SOUND_MASK_LINE | SOUND_MASK_LINE1 | SOUND_MASK_MIC | SOUND_MASK_VOLUME | - SOUND_MASK_RECLEV, (int *) arg); + SOUND_MASK_RECLEV, (int __user *)argp); case SOUND_MIXER_CAPS: - return put_user(SOUND_CAP_EXCL_INPUT, (int *) arg); + return put_user(SOUND_CAP_EXCL_INPUT, (int __user *)argp); default: i = _IOC_NR(cmd); if (i >= SOUND_MIXER_NRDEVICES || !(vidx = mixtable1[i])) return -EINVAL; - return put_user(s->mix.vol[vidx - 1], (int *) arg); + return put_user(s->mix.vol[vidx - 1], (int __user *)argp); } } // If ioctl doesn't have both the SIOC_READ and @@ -2339,7 +2339,7 @@ switch (_IOC_NR(cmd)) { case SOUND_MIXER_RECSRC: // Arg contains a bit for each recording source - if (get_user(val, (int *) arg)) + if (get_user(val, (int __user *)argp)) return -EFAULT; i = hweight32(val); // i = # bits on in val. if (i != 1) // One & only 1 bit must be on. @@ -2356,7 +2356,7 @@ return 0; case SOUND_MIXER_VOLUME: - if (get_user(val, (int *) arg)) + if (get_user(val, (int __user *)argp)) return -EFAULT; l = val & 0xff; if (l > 100) @@ -2391,10 +2391,10 @@ #else s->mix.vol[8] = val; #endif - return put_user(s->mix.vol[8], (int *) arg); + return put_user(s->mix.vol[8], (int __user *)argp); case SOUND_MIXER_SPEAKER: - if (get_user(val, (int *) arg)) + if (get_user(val, (int __user *)argp)) return -EFAULT; l = val & 0xff; if (l > 100) @@ -2421,10 +2421,10 @@ #else s->mix.vol[6] = val; #endif - return put_user(s->mix.vol[6], (int *) arg); + return put_user(s->mix.vol[6], (int __user *)argp); case SOUND_MIXER_RECLEV: - if (get_user(val, (int *) arg)) + if (get_user(val, (int __user *)argp)) return -EFAULT; l = val & 0xff; if (l > 100) @@ -2447,10 +2447,10 @@ #else s->mix.vol[7] = val; #endif - return put_user(s->mix.vol[7], (int *) arg); + return put_user(s->mix.vol[7], (int __user *)argp); case SOUND_MIXER_MIC: - if (get_user(val, (int *) arg)) + if (get_user(val, (int __user *)argp)) return -EFAULT; l = val & 0xff; if (l > 100) @@ -2477,16 +2477,16 @@ #else s->mix.vol[5] = val; #endif - return put_user(s->mix.vol[5], (int *) arg); + return put_user(s->mix.vol[5], (int __user *)argp); case SOUND_MIXER_SYNTH: - if (get_user(val, (int *) arg)) + if (get_user(val, (int __user *)argp)) return -EFAULT; l = val & 0xff; if (l > 100) l = 100; - if (get_user(val, (int *) arg)) + if (get_user(val, (int __user *)argp)) return -EFAULT; r = (val >> 8) & 0xff; if (r > 100) @@ -2512,7 +2512,7 @@ #else s->mix.vol[4] = val; #endif - return put_user(s->mix.vol[4], (int *) arg); + return put_user(s->mix.vol[4], (int __user *)argp); default: @@ -2522,7 +2522,7 @@ i = _IOC_NR(cmd); if (i >= SOUND_MIXER_NRDEVICES || !(vidx = mixtable1[i])) return -EINVAL; - if (get_user(val, (int *) arg)) + if (get_user(val, (int __user *)argp)) return -EFAULT; l = val & 0xff; if (l > 100) @@ -2558,7 +2558,7 @@ "write ac97 mixreg[%d]=0x%x mix.vol[]=0x%x\n", vidx-1,temp1,s->mix.vol[vidx-1])); #endif - return put_user(s->mix.vol[vidx - 1], (int *) arg); + return put_user(s->mix.vol[vidx - 1], (int __user *)argp); } } @@ -2817,7 +2817,7 @@ // issues with 8 bit capture, so the driver always captures data in 16 bit // and then if the user requested 8 bit, converts from 16 to 8 bit. // -static unsigned cs_copy_to_user(struct cs4281_state *s, void *dest, +static unsigned cs_copy_to_user(struct cs4281_state *s, void __user *dest, unsigned *hwsrc, unsigned cnt, unsigned *copied) { @@ -2859,7 +2859,7 @@ // --------------------------------------------------------------------- -static ssize_t cs4281_read(struct file *file, char *buffer, size_t count, +static ssize_t cs4281_read(struct file *file, char __user *buffer, size_t count, loff_t * ppos) { struct cs4281_state *s = @@ -2975,7 +2975,7 @@ } -static ssize_t cs4281_write(struct file *file, const char *buffer, +static ssize_t cs4281_write(struct file *file, const char __user *buffer, size_t count, loff_t * ppos) { struct cs4281_state *s = @@ -3161,6 +3161,7 @@ audio_buf_info abinfo; count_info cinfo; int val, mapped, ret; + int __user *p = (int __user *)arg; CS_DBGOUT(CS_FUNCTION, 4, printk(KERN_INFO "cs4281: cs4281_ioctl(): file=%p cmd=0x%.8x\n", file, cmd)); @@ -3175,7 +3176,7 @@ CS_DBGOUT(CS_IOCTL | CS_PARMS, 4, printk(KERN_INFO "cs4281: cs4281_ioctl(): SOUND_VERSION=0x%.8x\n", SOUND_VERSION)); - return put_user(SOUND_VERSION, (int *) arg); + return put_user(SOUND_VERSION, p); case SNDCTL_DSP_SYNC: CS_DBGOUT(CS_IOCTL, 4, printk(KERN_INFO @@ -3192,7 +3193,7 @@ case SNDCTL_DSP_GETCAPS: return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, - (int *) arg); + p); case SNDCTL_DSP_RESET: CS_DBGOUT(CS_IOCTL, 4, printk(KERN_INFO @@ -3216,7 +3217,7 @@ return 0; case SNDCTL_DSP_SPEED: - if (get_user(val, (int *) arg)) + if (get_user(val, p)) return -EFAULT; CS_DBGOUT(CS_IOCTL | CS_PARMS, 4, printk(KERN_INFO "cs4281: cs4281_ioctl(): DSP_SPEED val=%d\n", val)); @@ -3257,10 +3258,10 @@ else if (file->f_mode & FMODE_READ) val = s->prop_adc.rate; - return put_user(val, (int *) arg); + return put_user(val, p); case SNDCTL_DSP_STEREO: - if (get_user(val, (int *) arg)) + if (get_user(val, p)) return -EFAULT; CS_DBGOUT(CS_IOCTL | CS_PARMS, 4, printk(KERN_INFO "cs4281: cs4281_ioctl(): DSP_STEREO val=%d\n", val)); @@ -3279,7 +3280,7 @@ return 0; case SNDCTL_DSP_CHANNELS: - if (get_user(val, (int *) arg)) + if (get_user(val, p)) return -EFAULT; CS_DBGOUT(CS_IOCTL | CS_PARMS, 4, printk(KERN_INFO "cs4281: cs4281_ioctl(): DSP_CHANNELS val=%d\n", @@ -3310,7 +3311,7 @@ else if (file->f_mode & FMODE_READ) val = s->prop_adc.channels; - return put_user(val, (int *) arg); + return put_user(val, p); case SNDCTL_DSP_GETFMTS: // Returns a mask CS_DBGOUT(CS_IOCTL | CS_PARMS, 4, printk(KERN_INFO @@ -3318,10 +3319,10 @@ AFMT_S16_LE | AFMT_U16_LE | AFMT_S8 | AFMT_U8)); return put_user(AFMT_S16_LE | AFMT_U16_LE | AFMT_S8 | - AFMT_U8, (int *) arg); + AFMT_U8, p); case SNDCTL_DSP_SETFMT: - if (get_user(val, (int *) arg)) + if (get_user(val, p)) return -EFAULT; CS_DBGOUT(CS_IOCTL | CS_PARMS, 4, printk(KERN_INFO "cs4281: cs4281_ioctl(): DSP_SETFMT val=0x%.8x\n", @@ -3358,7 +3359,7 @@ CS_DBGOUT(CS_IOCTL | CS_PARMS, 4, printk(KERN_INFO "cs4281: cs4281_ioctl(): DSP_SETFMT return val=0x%.8x\n", val)); - return put_user(val, (int *) arg); + return put_user(val, p); case SNDCTL_DSP_POST: CS_DBGOUT(CS_IOCTL, 4, printk(KERN_INFO @@ -3371,10 +3372,10 @@ val |= PCM_ENABLE_INPUT; if (file->f_mode & s->ena & FMODE_WRITE) val |= PCM_ENABLE_OUTPUT; - return put_user(val, (int *) arg); + return put_user(val, p); case SNDCTL_DSP_SETTRIGGER: - if (get_user(val, (int *) arg)) + if (get_user(val, p)) return -EFAULT; if (file->f_mode & FMODE_READ) { if (val & PCM_ENABLE_INPUT) { @@ -3416,7 +3417,7 @@ abinfo.fragsize,abinfo.bytes,abinfo.fragstotal, abinfo.fragments)); spin_unlock_irqrestore(&s->lock, flags); - return copy_to_user((void *) arg, &abinfo, + return copy_to_user(p, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_GETISPACE: @@ -3440,7 +3441,7 @@ abinfo.bytes >> s->dma_adc.fragshift; } spin_unlock_irqrestore(&s->lock, flags); - return copy_to_user((void *) arg, &abinfo, + return copy_to_user(p, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_NONBLOCK: @@ -3456,7 +3457,7 @@ cs4281_update_ptr(s,CS_FALSE); val = s->dma_dac.count; spin_unlock_irqrestore(&s->lock, flags); - return put_user(val, (int *) arg); + return put_user(val, p); case SNDCTL_DSP_GETIPTR: if (!(file->f_mode & FMODE_READ)) @@ -3489,7 +3490,7 @@ if (s->dma_adc.mapped) s->dma_adc.count &= s->dma_adc.fragsize - 1; spin_unlock_irqrestore(&s->lock, flags); - if (copy_to_user((void *) arg, &cinfo, sizeof(cinfo))) + if (copy_to_user(p, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; @@ -3515,7 +3516,7 @@ if (s->dma_dac.mapped) s->dma_dac.count &= s->dma_dac.fragsize - 1; spin_unlock_irqrestore(&s->lock, flags); - if (copy_to_user((void *) arg, &cinfo, sizeof(cinfo))) + if (copy_to_user(p, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; @@ -3523,18 +3524,17 @@ if (file->f_mode & FMODE_WRITE) { if ((val = prog_dmabuf_dac(s))) return val; - return put_user(s->dma_dac.fragsize, (int *) arg); + return put_user(s->dma_dac.fragsize, p); } if ((val = prog_dmabuf_adc(s))) return val; if (s->conversion) - return put_user(s->dma_adc.fragsize / 2, - (int *) arg); + return put_user(s->dma_adc.fragsize / 2, p); else - return put_user(s->dma_adc.fragsize, (int *) arg); + return put_user(s->dma_adc.fragsize, p); case SNDCTL_DSP_SETFRAGMENT: - if (get_user(val, (int *) arg)) + if (get_user(val, p)) return -EFAULT; return 0; // Say OK, but do nothing. @@ -3542,7 +3542,7 @@ if ((file->f_mode & FMODE_READ && s->dma_adc.subdivision) || (file->f_mode & FMODE_WRITE && s->dma_dac.subdivision)) return -EINVAL; - if (get_user(val, (int *) arg)) + if (get_user(val, p)) return -EFAULT; if (val != 1 && val != 2 && val != 4) return -EINVAL; @@ -3554,15 +3554,15 @@ case SOUND_PCM_READ_RATE: if (file->f_mode & FMODE_READ) - return put_user(s->prop_adc.rate, (int *) arg); + return put_user(s->prop_adc.rate, p); else if (file->f_mode & FMODE_WRITE) - return put_user(s->prop_dac.rate, (int *) arg); + return put_user(s->prop_dac.rate, p); case SOUND_PCM_READ_CHANNELS: if (file->f_mode & FMODE_READ) - return put_user(s->prop_adc.channels, (int *) arg); + return put_user(s->prop_adc.channels, p); else if (file->f_mode & FMODE_WRITE) - return put_user(s->prop_dac.channels, (int *) arg); + return put_user(s->prop_dac.channels, p); case SOUND_PCM_READ_BITS: if (file->f_mode & FMODE_READ) @@ -3570,13 +3570,13 @@ put_user( (s->prop_adc. fmt & (AFMT_S8 | AFMT_U8)) ? 8 : 16, - (int *) arg); + p); else if (file->f_mode & FMODE_WRITE) return put_user( (s->prop_dac. fmt & (AFMT_S8 | AFMT_U8)) ? 8 : 16, - (int *) arg); + p); case SOUND_PCM_WRITE_FILTER: case SNDCTL_DSP_SETSYNCRO: @@ -3831,7 +3831,7 @@ // --------------------------------------------------------------------- -static ssize_t cs4281_midi_read(struct file *file, char *buffer, +static ssize_t cs4281_midi_read(struct file *file, char __user *buffer, size_t count, loff_t * ppos) { struct cs4281_state *s = @@ -3879,7 +3879,7 @@ } -static ssize_t cs4281_midi_write(struct file *file, const char *buffer, +static ssize_t cs4281_midi_write(struct file *file, const char __user *buffer, size_t count, loff_t * ppos) { struct cs4281_state *s = diff -urN linux-2.6.7-rc2/sound/oss/cs46xx.c linux-2.6.7-rc3/sound/oss/cs46xx.c --- linux-2.6.7-rc2/sound/oss/cs46xx.c 2004-05-09 19:31:58.000000000 -0700 +++ linux-2.6.7-rc3/sound/oss/cs46xx.c 2004-06-07 12:55:31.009782270 -0700 @@ -1717,7 +1717,7 @@ /**********************************************************************/ -static ssize_t cs_midi_read(struct file *file, char *buffer, size_t count, loff_t *ppos) +static ssize_t cs_midi_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) { struct cs_card *card = (struct cs_card *)file->private_data; ssize_t ret; @@ -1762,7 +1762,7 @@ } -static ssize_t cs_midi_write(struct file *file, const char *buffer, size_t count, loff_t *ppos) +static ssize_t cs_midi_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { struct cs_card *card = (struct cs_card *)file->private_data; ssize_t ret; @@ -2037,7 +2037,7 @@ */ static unsigned cs_copy_to_user( struct cs_state *s, - void *dest, + void __user *dest, void *hwsrc, unsigned cnt, unsigned *copied) @@ -2046,8 +2046,8 @@ void *src = hwsrc; /* default to the standard destination buffer addr */ CS_DBGOUT(CS_FUNCTION, 6, printk(KERN_INFO - "cs_copy_to_user()+ fmt=0x%x cnt=%d dest=0x%.8x\n", - dmabuf->fmt,(unsigned)cnt,(unsigned)dest) ); + "cs_copy_to_user()+ fmt=0x%x cnt=%d dest=%p\n", + dmabuf->fmt,(unsigned)cnt,dest) ); if(cnt > dmabuf->dmasize) { @@ -2074,8 +2074,8 @@ if (copy_to_user(dest, src, cnt)) { CS_DBGOUT(CS_FUNCTION, 2, printk(KERN_ERR - "cs46xx: cs_copy_to_user()- fault dest=0x%x src=0x%x cnt=%d\n", - (unsigned)dest,(unsigned)src,cnt) ); + "cs46xx: cs_copy_to_user()- fault dest=%p src=%p cnt=%d\n", + dest,src,cnt) ); *copied = 0; return -EFAULT; } @@ -2087,7 +2087,7 @@ /* in this loop, dmabuf.count signifies the amount of data that is waiting to be copied to the user's buffer. it is filled by the dma machine and drained by this loop. */ -static ssize_t cs_read(struct file *file, char *buffer, size_t count, loff_t *ppos) +static ssize_t cs_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) { struct cs_card *card = (struct cs_card *) file->private_data; struct cs_state *state; @@ -2165,8 +2165,8 @@ CS_DBGOUT(CS_WAVE_READ, 2, printk(KERN_INFO "_read() copy_to cnt=%d count=%d ", cnt,count) ); CS_DBGOUT(CS_WAVE_READ, 8, printk(KERN_INFO - " .dmasize=%d .count=%d buffer=0x%.8x ret=%d\n", - dmabuf->dmasize,dmabuf->count,(unsigned)buffer,ret) ); + " .dmasize=%d .count=%d buffer=%p ret=%d\n", + dmabuf->dmasize,dmabuf->count,buffer,ret) ); if (cs_copy_to_user(state, buffer, (void *)((unsigned)dmabuf->rawbuf + swptr), cnt, &copied)) @@ -2196,7 +2196,7 @@ /* in this loop, dmabuf.count signifies the amount of data that is waiting to be dma to the soundcard. it is drained by the dma machine and filled by this loop. */ -static ssize_t cs_write(struct file *file, const char *buffer, size_t count, loff_t *ppos) +static ssize_t cs_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { struct cs_card *card = (struct cs_card *) file->private_data; struct cs_state *state; @@ -2486,6 +2486,8 @@ audio_buf_info abinfo; count_info cinfo; int val, valsave, mapped, ret; + void __user *argp = (void __user *)arg; + int __user *p = argp; state = (struct cs_state *)card->states[0]; if(state) @@ -2507,7 +2509,7 @@ switch (cmd) { case OSS_GETVERSION: - return put_user(SOUND_VERSION, (int *)arg); + return put_user(SOUND_VERSION, p); case SNDCTL_DSP_RESET: /* FIXME: spin_lock ? */ @@ -2550,7 +2552,7 @@ return 0; case SNDCTL_DSP_SPEED: /* set sample rate */ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val >= 0) { if (file->f_mode & FMODE_READ) { @@ -2582,12 +2584,12 @@ file->f_mode & FMODE_WRITE ? "DAC" : "", file->f_mode & FMODE_READ ? "ADC" : "", dmabuf->rate ) ); - return put_user(dmabuf->rate, (int *)arg); + return put_user(dmabuf->rate, p); } - return put_user(0, (int *)arg); + return put_user(0, p); case SNDCTL_DSP_STEREO: /* set stereo or mono channel */ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (file->f_mode & FMODE_WRITE) { state = (struct cs_state *)card->states[1]; @@ -2637,7 +2639,7 @@ dmabuf = &state->dmabuf; if ((val = prog_dmabuf(state))) return val; - return put_user(dmabuf->fragsize, (int *)arg); + return put_user(dmabuf->fragsize, p); } } if (file->f_mode & FMODE_READ) { @@ -2648,16 +2650,16 @@ if ((val = prog_dmabuf(state))) return val; return put_user(dmabuf->fragsize/dmabuf->divisor, - (int *)arg); + p); } } - return put_user(0, (int *)arg); + return put_user(0, p); case SNDCTL_DSP_GETFMTS: /* Returns a mask of supported sample format*/ - return put_user(AFMT_S16_LE | AFMT_U8, (int *)arg); + return put_user(AFMT_S16_LE | AFMT_U8, p); case SNDCTL_DSP_SETFMT: /* Select sample format */ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; CS_DBGOUT(CS_IOCTL | CS_PARMS, 4, printk( "cs46xx: cs_ioctl() DSP_SETFMT %s %s %s %s\n", @@ -2730,14 +2732,14 @@ if(dmabuf) { if(dmabuf->fmt & CS_FMT_16BIT) - return put_user(AFMT_S16_LE, (int *)arg); + return put_user(AFMT_S16_LE, p); else - return put_user(AFMT_U8, (int *)arg); + return put_user(AFMT_U8, p); } - return put_user(0, (int *)arg); + return put_user(0, p); case SNDCTL_DSP_CHANNELS: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != 0) { if (file->f_mode & FMODE_WRITE) { @@ -2776,7 +2778,7 @@ } } return put_user((dmabuf->fmt & CS_FMT_STEREO) ? 2 : 1, - (int *)arg); + p); case SNDCTL_DSP_POST: /* @@ -2793,7 +2795,7 @@ dmabuf = &state->dmabuf; if (dmabuf->subdivision) return -EINVAL; - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != 1 && val != 2) return -EINVAL; @@ -2807,7 +2809,7 @@ dmabuf = &state->dmabuf; if (dmabuf->subdivision) return -EINVAL; - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != 1 && val != 2) return -EINVAL; @@ -2817,7 +2819,7 @@ return 0; case SNDCTL_DSP_SETFRAGMENT: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (file->f_mode & FMODE_WRITE) { @@ -2861,7 +2863,7 @@ abinfo.fragments = abinfo.bytes >> dmabuf->fragshift; spin_unlock_irqrestore(&state->card->lock, flags); - return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; } return -ENODEV; @@ -2879,7 +2881,7 @@ abinfo.fragstotal = dmabuf->numfrag; abinfo.fragments = abinfo.bytes >> dmabuf->fragshift; spin_unlock_irqrestore(&state->card->lock, flags); - return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; } return -ENODEV; @@ -2889,7 +2891,7 @@ case SNDCTL_DSP_GETCAPS: return put_user(DSP_CAP_REALTIME|DSP_CAP_TRIGGER|DSP_CAP_MMAP, - (int *)arg); + p); case SNDCTL_DSP_GETTRIGGER: val = 0; @@ -2915,10 +2917,10 @@ } } CS_DBGOUT(CS_IOCTL, 2, printk("cs46xx: DSP_GETTRIGGER()- val=0x%x\n",val) ); - return put_user(val, (int *)arg); + return put_user(val, p); case SNDCTL_DSP_SETTRIGGER: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (file->f_mode & FMODE_READ) { state = (struct cs_state *)card->states[0]; @@ -2961,7 +2963,7 @@ cinfo.blocks = dmabuf->count/dmabuf->divisor >> dmabuf->fragshift; cinfo.ptr = dmabuf->hwptr/dmabuf->divisor; spin_unlock_irqrestore(&state->card->lock, flags); - if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) + if (copy_to_user(argp, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; } @@ -2996,7 +2998,7 @@ "cs46xx: GETOPTR bytes=%d blocks=%d ptr=%d\n", cinfo.bytes,cinfo.blocks,cinfo.ptr) ); spin_unlock_irqrestore(&state->card->lock, flags); - if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) + if (copy_to_user(argp, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; } @@ -3019,7 +3021,7 @@ } else val = 0; - return put_user(val, (int *)arg); + return put_user(val, p); case SOUND_PCM_READ_RATE: if(file->f_mode & FMODE_READ) @@ -3029,9 +3031,9 @@ if(state) { dmabuf = &state->dmabuf; - return put_user(dmabuf->rate, (int *)arg); + return put_user(dmabuf->rate, p); } - return put_user(0, (int *)arg); + return put_user(0, p); case SOUND_PCM_READ_CHANNELS: @@ -3043,9 +3045,9 @@ { dmabuf = &state->dmabuf; return put_user((dmabuf->fmt & CS_FMT_STEREO) ? 2 : 1, - (int *)arg); + p); } - return put_user(0, (int *)arg); + return put_user(0, p); case SOUND_PCM_READ_BITS: if(file->f_mode & FMODE_READ) @@ -3056,10 +3058,10 @@ { dmabuf = &state->dmabuf; return put_user((dmabuf->fmt & CS_FMT_16BIT) ? - AFMT_S16_LE : AFMT_U8, (int *)arg); + AFMT_S16_LE : AFMT_U8, p); } - return put_user(0, (int *)arg); + return put_user(0, p); case SNDCTL_DSP_MAPINBUF: case SNDCTL_DSP_MAPOUTBUF: @@ -4164,6 +4166,7 @@ struct ac97_codec *codec = (struct ac97_codec *)file->private_data; struct cs_card *card=NULL; struct list_head *entry; + unsigned long __user *p = (long __user *)arg; #if CSDEBUG_INTERFACE int val; @@ -4178,25 +4181,25 @@ { case SOUND_MIXER_CS_GETDBGMASK: - return put_user(cs_debugmask, (unsigned long *)arg); + return put_user(cs_debugmask, p); case SOUND_MIXER_CS_GETDBGLEVEL: - return put_user(cs_debuglevel, (unsigned long *)arg); + return put_user(cs_debuglevel, p); case SOUND_MIXER_CS_SETDBGMASK: - if (get_user(val, (unsigned long *)arg)) + if (get_user(val, p)) return -EFAULT; cs_debugmask = val; return 0; case SOUND_MIXER_CS_SETDBGLEVEL: - if (get_user(val, (unsigned long *)arg)) + if (get_user(val, p)) return -EFAULT; cs_debuglevel = val; return 0; case SOUND_MIXER_CS_APM: - if (get_user(val, (unsigned long *) arg)) + if (get_user(val, p)) return -EFAULT; if(val == CS_IOCTL_CMD_SUSPEND) { diff -urN linux-2.6.7-rc2/sound/oss/emu10k1/audio.c linux-2.6.7-rc3/sound/oss/emu10k1/audio.c --- linux-2.6.7-rc2/sound/oss/emu10k1/audio.c 2004-05-09 19:32:00.000000000 -0700 +++ linux-2.6.7-rc3/sound/oss/emu10k1/audio.c 2004-06-07 12:55:31.063784506 -0700 @@ -50,7 +50,7 @@ static void calculate_ifrag(struct wiinst *); /* Audio file operations */ -static ssize_t emu10k1_audio_read(struct file *file, char *buffer, size_t count, loff_t * ppos) +static ssize_t emu10k1_audio_read(struct file *file, char __user *buffer, size_t count, loff_t * ppos) { struct emu10k1_wavedevice *wave_dev = (struct emu10k1_wavedevice *) file->private_data; struct wiinst *wiinst = wave_dev->wiinst; @@ -112,7 +112,7 @@ || (bytestocopy >= count)) { bytestocopy = min_t(u32, bytestocopy, count); - emu10k1_wavein_xferdata(wiinst, (u8 *) buffer, &bytestocopy); + emu10k1_wavein_xferdata(wiinst, (u8 __user *)buffer, &bytestocopy); count -= bytestocopy; buffer += bytestocopy; @@ -137,7 +137,7 @@ return ret; } -static ssize_t emu10k1_audio_write(struct file *file, const char *buffer, size_t count, loff_t * ppos) +static ssize_t emu10k1_audio_write(struct file *file, const char __user *buffer, size_t count, loff_t * ppos) { struct emu10k1_wavedevice *wave_dev = (struct emu10k1_wavedevice *) file->private_data; struct woinst *woinst = wave_dev->woinst; @@ -212,7 +212,7 @@ bytestocopy = min_t(u32, bytestocopy, count); - emu10k1_waveout_xferdata(woinst, (u8 *) buffer, &bytestocopy); + emu10k1_waveout_xferdata(woinst, (u8 __user *) buffer, &bytestocopy); count -= bytestocopy; buffer += bytestocopy * woinst->num_voices; @@ -254,6 +254,7 @@ int val = 0; u32 bytestocopy; unsigned long flags; + int __user *p = (int __user *)arg; DPF(4, "emu10k1_audio_ioctl()\n"); @@ -266,7 +267,7 @@ switch (cmd) { case OSS_GETVERSION: DPF(2, "OSS_GETVERSION:\n"); - return put_user(SOUND_VERSION, (int *) arg); + return put_user(SOUND_VERSION, p); case SNDCTL_DSP_RESET: DPF(2, "SNDCTL_DSP_RESET:\n"); @@ -352,11 +353,11 @@ DPF(2, "SNDCTL_DSP_GETCAPS:\n"); return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP | - DSP_CAP_COPROC| DSP_CAP_MULTI, (int *) arg); + DSP_CAP_COPROC| DSP_CAP_MULTI, p); case SNDCTL_DSP_SPEED: DPF(2, "SNDCTL_DSP_SPEED:\n"); - if (get_user(val, (int *) arg)) + if (get_user(val, p)) return -EFAULT; DPD(2, "val is %d\n", val); @@ -402,21 +403,21 @@ DPD(2, "set playback sampling rate -> %d\n", val); } - return put_user(val, (int *) arg); + return put_user(val, p); } else { if (file->f_mode & FMODE_READ) val = wiinst->format.samplingrate; else if (file->f_mode & FMODE_WRITE) val = woinst->format.samplingrate; - return put_user(val, (int *) arg); + return put_user(val, p); } break; case SNDCTL_DSP_STEREO: DPF(2, "SNDCTL_DSP_STEREO:\n"); - if (get_user(val, (int *) arg)) + if (get_user(val, p)) return -EFAULT; DPD(2, " val is %d\n", val); @@ -460,14 +461,14 @@ DPD(2, "set playback stereo -> %d\n", val); } - return put_user(val, (int *) arg); + return put_user(val, p); break; case SNDCTL_DSP_CHANNELS: DPF(2, "SNDCTL_DSP_CHANNELS:\n"); - if (get_user(val, (int *) arg)) + if (get_user(val, p)) return -EFAULT; DPD(2, " val is %d\n", val); @@ -510,14 +511,14 @@ DPD(2, "set playback number of channels -> %d\n", val); } - return put_user(val, (int *) arg); + return put_user(val, p); } else { if (file->f_mode & FMODE_READ) val = wiinst->format.channels; else if (file->f_mode & FMODE_WRITE) val = woinst->format.channels; - return put_user(val, (int *) arg); + return put_user(val, p); } break; @@ -533,12 +534,12 @@ wave_dev->card->pt.enable_gpr_name) >= 0) val |= AFMT_AC3; } - return put_user(val, (int *) arg); + return put_user(val, p); case SNDCTL_DSP_SETFMT: /* Same as SNDCTL_DSP_SAMPLESIZE */ DPF(2, "SNDCTL_DSP_SETFMT:\n"); - if (get_user(val, (int *) arg)) + if (get_user(val, p)) return -EFAULT; DPD(2, " val is %d\n", val); @@ -582,14 +583,14 @@ DPD(2, "set playback format -> %d\n", val); } - return put_user(val, (int *) arg); + return put_user(val, p); } else { if (file->f_mode & FMODE_READ) val = wiinst->format.id; else if (file->f_mode & FMODE_WRITE) val = woinst->format.id; - return put_user(val, (int *) arg); + return put_user(val, p); } break; @@ -600,7 +601,7 @@ else if (file->f_mode & FMODE_WRITE) val = woinst->format.bitsperchannel; - return put_user(val, (int *) arg); + return put_user(val, p); case SOUND_PCM_READ_RATE: @@ -609,7 +610,7 @@ else if (file->f_mode & FMODE_WRITE) val = woinst->format.samplingrate; - return put_user(val, (int *) arg); + return put_user(val, p); case SOUND_PCM_READ_CHANNELS: @@ -618,7 +619,7 @@ else if (file->f_mode & FMODE_WRITE) val = woinst->format.channels; - return put_user(val, (int *) arg); + return put_user(val, p); case SOUND_PCM_WRITE_FILTER: DPF(2, "SOUND_PCM_WRITE_FILTER: not implemented\n"); @@ -641,12 +642,12 @@ if (file->f_mode & FMODE_READ && (wave_dev->enablebits & PCM_ENABLE_INPUT)) val |= PCM_ENABLE_INPUT; - return put_user(val, (int *) arg); + return put_user(val, p); case SNDCTL_DSP_SETTRIGGER: DPF(2, "SNDCTL_DSP_SETTRIGGER:\n"); - if (get_user(val, (int *) arg)) + if (get_user(val, p)) return -EFAULT; if (file->f_mode & FMODE_WRITE) { @@ -708,7 +709,7 @@ info.fragstotal = woinst->buffer.numfrags * woinst->num_voices; info.fragments = info.bytes / info.fragsize; - if (copy_to_user((int *) arg, &info, sizeof(info))) + if (copy_to_user(p, &info, sizeof(info))) return -EFAULT; } break; @@ -737,7 +738,7 @@ info.fragments = info.bytes / wiinst->buffer.fragment_size; info.fragsize = wiinst->buffer.fragment_size; - if (copy_to_user((int *) arg, &info, sizeof(info))) + if (copy_to_user(p, &info, sizeof(info))) return -EFAULT; } break; @@ -765,7 +766,7 @@ val *= woinst->num_voices; spin_unlock_irqrestore(&woinst->lock, flags); - return put_user(val, (int *) arg); + return put_user(val, p); case SNDCTL_DSP_GETIPTR: { @@ -795,7 +796,7 @@ spin_unlock_irqrestore(&wiinst->lock, flags); - if (copy_to_user((void *) arg, &cinfo, sizeof(cinfo))) + if (copy_to_user(p, &cinfo, sizeof(cinfo))) return -EFAULT; } break; @@ -841,7 +842,7 @@ spin_unlock_irqrestore(&woinst->lock, flags); - if (copy_to_user((void *) arg, &cinfo, sizeof(cinfo))) + if (copy_to_user(p, &cinfo, sizeof(cinfo))) return -EFAULT; } break; @@ -867,7 +868,7 @@ spin_unlock_irqrestore(&wiinst->lock, flags); } - return put_user(val, (int *) arg); + return put_user(val, p); break; @@ -892,7 +893,7 @@ case SNDCTL_DSP_SETFRAGMENT: DPF(2, "SNDCTL_DSP_SETFRAGMENT:\n"); - if (get_user(val, (int *) arg)) + if (get_user(val, p)) return -EFAULT; DPD(2, "val is %#x\n", val); @@ -930,7 +931,7 @@ if (!buf) return -ENOMEM; - if (copy_from_user(buf, (copr_buffer *) arg, sizeof(copr_buffer))) { + if (copy_from_user(buf, p, sizeof(copr_buffer))) { kfree (buf); return -EFAULT; } @@ -969,7 +970,7 @@ for (i = 0; i < buf->len; i++) ((u32 *) buf->data)[i] = sblive_readptr(wave_dev->card, buf->offs + i, buf->flags); - if (copy_to_user((copr_buffer *) arg, buf, sizeof(copr_buffer))) { + if (copy_to_user(p, buf, sizeof(copr_buffer))) { kfree(buf); return -EFAULT; } diff -urN linux-2.6.7-rc2/sound/oss/emu10k1/cardwi.c linux-2.6.7-rc3/sound/oss/emu10k1/cardwi.c --- linux-2.6.7-rc2/sound/oss/emu10k1/cardwi.c 2004-05-09 19:32:52.000000000 -0700 +++ linux-2.6.7-rc3/sound/oss/emu10k1/cardwi.c 2004-06-07 12:55:31.065784589 -0700 @@ -304,7 +304,7 @@ } } -static void copy_block(u8 *dst, u8 * src, u32 str, u32 len, u8 cov) +static void copy_block(u8 __user *dst, u8 * src, u32 str, u32 len, u8 cov) { if (cov == 1) __copy_to_user(dst, src + str, len); @@ -321,7 +321,7 @@ } } -void emu10k1_wavein_xferdata(struct wiinst *wiinst, u8 * data, u32 * size) +void emu10k1_wavein_xferdata(struct wiinst *wiinst, u8 __user *data, u32 * size) { struct wavein_buffer *buffer = &wiinst->buffer; u32 sizetocopy, sizetocopy_now, start; diff -urN linux-2.6.7-rc2/sound/oss/emu10k1/cardwi.h linux-2.6.7-rc3/sound/oss/emu10k1/cardwi.h --- linux-2.6.7-rc2/sound/oss/emu10k1/cardwi.h 2004-05-09 19:33:20.000000000 -0700 +++ linux-2.6.7-rc3/sound/oss/emu10k1/cardwi.h 2004-06-07 12:55:31.065784589 -0700 @@ -83,7 +83,7 @@ void emu10k1_wavein_start(struct emu10k1_wavedevice *); void emu10k1_wavein_stop(struct emu10k1_wavedevice *); void emu10k1_wavein_getxfersize(struct wiinst *, u32 *); -void emu10k1_wavein_xferdata(struct wiinst *, u8 *, u32 *); +void emu10k1_wavein_xferdata(struct wiinst *, u8 __user *, u32 *); int emu10k1_wavein_setformat(struct emu10k1_wavedevice *, struct wave_format *); void emu10k1_wavein_update(struct emu10k1_card *, struct wiinst *); diff -urN linux-2.6.7-rc2/sound/oss/emu10k1/cardwo.c linux-2.6.7-rc3/sound/oss/emu10k1/cardwo.c --- linux-2.6.7-rc2/sound/oss/emu10k1/cardwo.c 2004-05-09 19:33:13.000000000 -0700 +++ linux-2.6.7-rc3/sound/oss/emu10k1/cardwo.c 2004-06-07 12:55:31.066784631 -0700 @@ -417,7 +417,7 @@ * Notice that the voice buffer is actually a set of disjointed memory pages. * */ -static void copy_block(void **dst, u32 str, u8 *src, u32 len) +static void copy_block(void **dst, u32 str, u8 __user *src, u32 len) { unsigned int pg; unsigned int pgoff; @@ -451,7 +451,7 @@ * Notice that the voice buffer is actually a set of disjointed memory pages. * */ -static void copy_ilv_block(struct woinst *woinst, u32 str, u8 *src, u32 len) +static void copy_ilv_block(struct woinst *woinst, u32 str, u8 __user *src, u32 len) { unsigned int pg; unsigned int pgoff; @@ -524,7 +524,7 @@ * previously added to the buffer are overwritten. * */ -void emu10k1_waveout_xferdata(struct woinst *woinst, u8 *data, u32 *size) +void emu10k1_waveout_xferdata(struct woinst *woinst, u8 __user *data, u32 *size) { struct waveout_buffer *buffer = &woinst->buffer; struct voice_mem *mem = &woinst->voice[0].mem; diff -urN linux-2.6.7-rc2/sound/oss/emu10k1/cardwo.h linux-2.6.7-rc3/sound/oss/emu10k1/cardwo.h --- linux-2.6.7-rc2/sound/oss/emu10k1/cardwo.h 2004-05-09 19:32:54.000000000 -0700 +++ linux-2.6.7-rc3/sound/oss/emu10k1/cardwo.h 2004-06-07 12:55:31.066784631 -0700 @@ -82,7 +82,7 @@ void emu10k1_waveout_start(struct emu10k1_wavedevice *); void emu10k1_waveout_stop(struct emu10k1_wavedevice *); void emu10k1_waveout_getxfersize(struct woinst*, u32 *); -void emu10k1_waveout_xferdata(struct woinst*, u8*, u32 *); +void emu10k1_waveout_xferdata(struct woinst*, u8 __user *, u32 *); void emu10k1_waveout_fillsilence(struct woinst*); int emu10k1_waveout_setformat(struct emu10k1_wavedevice*, struct wave_format*); void emu10k1_waveout_update(struct woinst*); diff -urN linux-2.6.7-rc2/sound/oss/emu10k1/midi.c linux-2.6.7-rc3/sound/oss/emu10k1/midi.c --- linux-2.6.7-rc2/sound/oss/emu10k1/midi.c 2004-05-09 19:33:21.000000000 -0700 +++ linux-2.6.7-rc3/sound/oss/emu10k1/midi.c 2004-06-07 12:55:31.067784672 -0700 @@ -244,7 +244,7 @@ return 0; } -static ssize_t emu10k1_midi_read(struct file *file, char *buffer, size_t count, loff_t * pos) +static ssize_t emu10k1_midi_read(struct file *file, char __user *buffer, size_t count, loff_t * pos) { struct emu10k1_mididevice *midi_dev = (struct emu10k1_mididevice *) file->private_data; ssize_t ret = 0; @@ -319,7 +319,7 @@ return ret; } -static ssize_t emu10k1_midi_write(struct file *file, const char *buffer, size_t count, loff_t * pos) +static ssize_t emu10k1_midi_write(struct file *file, const char __user *buffer, size_t count, loff_t * pos) { struct emu10k1_mididevice *midi_dev = (struct emu10k1_mididevice *) file->private_data; struct midi_hdr *midihdr; diff -urN linux-2.6.7-rc2/sound/oss/emu10k1/mixer.c linux-2.6.7-rc3/sound/oss/emu10k1/mixer.c --- linux-2.6.7-rc2/sound/oss/emu10k1/mixer.c 2004-05-09 19:32:54.000000000 -0700 +++ linux-2.6.7-rc3/sound/oss/emu10k1/mixer.c 2004-06-07 12:55:31.068784714 -0700 @@ -188,6 +188,7 @@ u32 size, page; int addr, size_reg, i, ret; unsigned int id, ch; + void __user *argp = (void __user *)arg; switch (cmd) { @@ -197,7 +198,7 @@ if (ctl == NULL) return -ENOMEM; - if (copy_from_user(ctl, (void *) arg, sizeof(struct mixer_private_ioctl))) { + if (copy_from_user(ctl, argp, sizeof(struct mixer_private_ioctl))) { kfree(ctl); return -EFAULT; } @@ -228,7 +229,7 @@ case CMD_READFN0: ctl->val[2] = emu10k1_readfn0(card, ctl->val[0]); - if (copy_to_user((void *) arg, ctl, sizeof(struct mixer_private_ioctl))) + if (copy_to_user(argp, ctl, sizeof(struct mixer_private_ioctl))) ret = -EFAULT; break; @@ -244,7 +245,7 @@ ctl->val[2] = sblive_readptr(card, ctl->val[0], ctl->val[1]); - if (copy_to_user((void *) arg, ctl, sizeof(struct mixer_private_ioctl))) + if (copy_to_user(argp, ctl, sizeof(struct mixer_private_ioctl))) ret = -EFAULT; break; @@ -282,7 +283,7 @@ case CMD_GETRECSRC: ctl->val[0] = card->wavein.recsrc; ctl->val[1] = card->wavein.fxwc; - if (copy_to_user((void *) arg, ctl, sizeof(struct mixer_private_ioctl))) + if (copy_to_user(argp, ctl, sizeof(struct mixer_private_ioctl))) ret = -EFAULT; break; @@ -297,7 +298,7 @@ ctl->val[4] = card->waveout.send_routing[2]; ctl->val[5] = card->waveout.send_dcba[2]; - if (copy_to_user((void *) arg, ctl, sizeof(struct mixer_private_ioctl))) + if (copy_to_user(argp, ctl, sizeof(struct mixer_private_ioctl))) ret = -EFAULT; break; @@ -320,7 +321,7 @@ case CMD_GETPATCH: if (ctl->val[0] == 0) { - if (copy_to_user((void *) arg, &card->mgr.rpatch, sizeof(struct dsp_rpatch))) + if (copy_to_user(argp, &card->mgr.rpatch, sizeof(struct dsp_rpatch))) ret = -EFAULT; } else { if ((ctl->val[0] - 1) / PATCHES_PER_PAGE >= card->mgr.current_pages) { @@ -328,7 +329,7 @@ break; } - if (copy_to_user((void *) arg, PATCH(&card->mgr, ctl->val[0] - 1), sizeof(struct dsp_patch))) + if (copy_to_user(argp, PATCH(&card->mgr, ctl->val[0] - 1), sizeof(struct dsp_patch))) ret = -EFAULT; } @@ -342,7 +343,7 @@ break; } - if (copy_to_user((void *) arg, &card->mgr.gpr[id], sizeof(struct dsp_gpr))) + if (copy_to_user(argp, &card->mgr.gpr[id], sizeof(struct dsp_gpr))) ret = -EFAULT; break; @@ -351,7 +352,7 @@ addr = emu10k1_find_control_gpr(&card->mgr, (char *) ctl->val, &((char *) ctl->val)[PATCH_NAME_SIZE]); ctl->val[0] = sblive_readptr(card, addr, 0); - if (copy_to_user((void *) arg, ctl, sizeof(struct mixer_private_ioctl))) + if (copy_to_user(argp, ctl, sizeof(struct mixer_private_ioctl))) ret = -EFAULT; break; @@ -430,7 +431,7 @@ ctl->val[2] = card->mgr.ctrl_gpr[id][ch]; - if (copy_to_user((void *) arg, ctl, sizeof(struct mixer_private_ioctl))) + if (copy_to_user(argp, ctl, sizeof(struct mixer_private_ioctl))) ret = -EFAULT; break; @@ -496,7 +497,7 @@ if (card->is_audigy) ctl->val[4]=emu10k1_readfn0(card, 0x18); - if (copy_to_user((void *) arg, ctl, sizeof(struct mixer_private_ioctl))) + if (copy_to_user(argp, ctl, sizeof(struct mixer_private_ioctl))) ret = -EFAULT; break; @@ -517,7 +518,7 @@ case SOUND_MIXER_PRIVATE4: - if (copy_from_user(&size, (void *) arg, sizeof(size))) + if (copy_from_user(&size, argp, sizeof(size))) return -EFAULT; DPD(2, "External tram size %#x\n", size); @@ -581,7 +582,7 @@ card->ac97->modcnt++; - if (get_user(val, (int *)arg)) + if (get_user(val, (int __user *)arg)) return -EFAULT; /* cleanse input a little */ @@ -634,7 +635,7 @@ info.modify_counter = card->ac97->modcnt; - if (copy_to_user((void *)arg, &info, sizeof(info))) + if (copy_to_user((void __user *)arg, &info, sizeof(info))) return -EFAULT; return 0; diff -urN linux-2.6.7-rc2/sound/oss/emu10k1/passthrough.c linux-2.6.7-rc3/sound/oss/emu10k1/passthrough.c --- linux-2.6.7-rc2/sound/oss/emu10k1/passthrough.c 2004-05-09 19:32:29.000000000 -0700 +++ linux-2.6.7-rc3/sound/oss/emu10k1/passthrough.c 2004-06-07 12:55:31.069784755 -0700 @@ -131,7 +131,7 @@ return 0; } -ssize_t emu10k1_pt_write(struct file *file, const char *buffer, size_t count) +ssize_t emu10k1_pt_write(struct file *file, const char __user *buffer, size_t count) { struct emu10k1_wavedevice *wave_dev = (struct emu10k1_wavedevice *) file->private_data; struct emu10k1_card *card = wave_dev->card; @@ -177,10 +177,9 @@ blocks = (count-bytes_copied)/PT_BLOCKSIZE; blocks_copied = 0; while (blocks > 0) { - u16 *bufptr = (u16 *) buffer + (bytes_copied/2); + u16 __user *bufptr = (u16 __user *) buffer + (bytes_copied/2); copy_from_user(pt->buf, bufptr, PT_BLOCKSIZE); - bufptr = (u16 *) pt->buf; - r = pt_putblock(wave_dev, bufptr, nonblock); + r = pt_putblock(wave_dev, (u16 *)pt->buf, nonblock); if (r) { if (bytes_copied) return bytes_copied; diff -urN linux-2.6.7-rc2/sound/oss/emu10k1/passthrough.h linux-2.6.7-rc3/sound/oss/emu10k1/passthrough.h --- linux-2.6.7-rc2/sound/oss/emu10k1/passthrough.h 2004-05-09 19:32:37.000000000 -0700 +++ linux-2.6.7-rc3/sound/oss/emu10k1/passthrough.h 2004-06-07 12:55:31.070784796 -0700 @@ -90,7 +90,7 @@ #define USE_PT_METHOD2 (card->is_audigy) #define USE_PT_METHOD1 !USE_PT_METHOD2 -ssize_t emu10k1_pt_write(struct file *file, const char *buf, size_t count); +ssize_t emu10k1_pt_write(struct file *file, const char __user *buf, size_t count); int emu10k1_pt_setup(struct emu10k1_wavedevice *wave_dev); void emu10k1_pt_stop(struct emu10k1_card *card); diff -urN linux-2.6.7-rc2/sound/oss/es1370.c linux-2.6.7-rc3/sound/oss/es1370.c --- linux-2.6.7-rc2/sound/oss/es1370.c 2004-05-09 19:33:21.000000000 -0700 +++ linux-2.6.7-rc3/sound/oss/es1370.c 2004-06-07 12:55:31.090785625 -0700 @@ -845,21 +845,22 @@ unsigned long flags; int i, val; unsigned char l, r, rl, rr; + int __user *p = (int __user *)arg; VALIDATE_STATE(s); if (cmd == SOUND_MIXER_PRIVATE1) { /* enable/disable/query mixer preamp */ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != -1) { s->mix.micpreamp = !!val; wrcodec(s, 0x19, s->mix.micpreamp); } - return put_user(s->mix.micpreamp, (int *)arg); + return put_user(s->mix.micpreamp, p); } if (cmd == SOUND_MIXER_PRIVATE2) { /* enable/disable/query use of linein as second lineout */ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != -1) { spin_lock_irqsave(&s->lock, flags); @@ -870,11 +871,11 @@ outl(s->ctrl, s->io+ES1370_REG_CONTROL); spin_unlock_irqrestore(&s->lock, flags); } - return put_user((s->ctrl & CTRL_XCTL0) ? 1 : 0, (int *)arg); + return put_user((s->ctrl & CTRL_XCTL0) ? 1 : 0, p); } if (cmd == SOUND_MIXER_PRIVATE3) { /* enable/disable/query microphone impedance setting */ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != -1) { spin_lock_irqsave(&s->lock, flags); @@ -885,14 +886,14 @@ outl(s->ctrl, s->io+ES1370_REG_CONTROL); spin_unlock_irqrestore(&s->lock, flags); } - return put_user((s->ctrl & CTRL_XCTL1) ? 1 : 0, (int *)arg); + return put_user((s->ctrl & CTRL_XCTL1) ? 1 : 0, p); } if (cmd == SOUND_MIXER_INFO) { mixer_info info; strncpy(info.id, "ES1370", sizeof(info.id)); strncpy(info.name, "Ensoniq ES1370", sizeof(info.name)); info.modify_counter = s->mix.modcnt; - if (copy_to_user((void *)arg, &info, sizeof(info))) + if (copy_to_user((void __user *)arg, &info, sizeof(info))) return -EFAULT; return 0; } @@ -900,49 +901,49 @@ _old_mixer_info info; strncpy(info.id, "ES1370", sizeof(info.id)); strncpy(info.name, "Ensoniq ES1370", sizeof(info.name)); - if (copy_to_user((void *)arg, &info, sizeof(info))) + if (copy_to_user((void __user *)arg, &info, sizeof(info))) return -EFAULT; return 0; } if (cmd == OSS_GETVERSION) - return put_user(SOUND_VERSION, (int *)arg); + return put_user(SOUND_VERSION, p); if (_IOC_TYPE(cmd) != 'M' || _SIOC_SIZE(cmd) != sizeof(int)) return -EINVAL; if (_SIOC_DIR(cmd) == _SIOC_READ) { switch (_IOC_NR(cmd)) { case SOUND_MIXER_RECSRC: /* Arg contains a bit for each recording source */ - return put_user(s->mix.recsrc, (int *)arg); + return put_user(s->mix.recsrc, p); case SOUND_MIXER_DEVMASK: /* Arg contains a bit for each supported device */ val = SOUND_MASK_IMIX; for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) if (mixtable[i].avail) val |= 1 << i; - return put_user(val, (int *)arg); + return put_user(val, p); case SOUND_MIXER_RECMASK: /* Arg contains a bit for each supported recording source */ for (val = i = 0; i < SOUND_MIXER_NRDEVICES; i++) if (mixtable[i].recmask) val |= 1 << i; - return put_user(val, (int *)arg); + return put_user(val, p); case SOUND_MIXER_STEREODEVS: /* Mixer channels supporting stereo */ for (val = i = 0; i < SOUND_MIXER_NRDEVICES; i++) if (mixtable[i].stereo) val |= 1 << i; - return put_user(val, (int *)arg); + return put_user(val, p); case SOUND_MIXER_CAPS: - return put_user(0, (int *)arg); + return put_user(0, p); case SOUND_MIXER_IMIX: - return put_user(s->mix.imix, (int *)arg); + return put_user(s->mix.imix, p); default: i = _IOC_NR(cmd); if (i >= SOUND_MIXER_NRDEVICES || !mixtable[i].avail) return -EINVAL; - return put_user(s->mix.vol[mixtable[i].volidx], (int *)arg); + return put_user(s->mix.vol[mixtable[i].volidx], p); } } if (_SIOC_DIR(cmd) != (_SIOC_READ|_SIOC_WRITE)) @@ -951,13 +952,13 @@ switch (_IOC_NR(cmd)) { case SOUND_MIXER_IMIX: - if (get_user(s->mix.imix, (int *)arg)) + if (get_user(s->mix.imix, p)) return -EFAULT; set_recsrc(s, s->mix.recsrc); return 0; case SOUND_MIXER_RECSRC: /* Arg contains a bit for each recording source */ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; set_recsrc(s, val); return 0; @@ -966,7 +967,7 @@ i = _IOC_NR(cmd); if (i >= SOUND_MIXER_NRDEVICES || !mixtable[i].avail) return -EINVAL; - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; l = val & 0xff; if (l > 100) @@ -1015,7 +1016,7 @@ #else s->mix.vol[mixtable[i].volidx] = val; #endif - return put_user(s->mix.vol[mixtable[i].volidx], (int *)arg); + return put_user(s->mix.vol[mixtable[i].volidx], p); } } @@ -1136,7 +1137,7 @@ /* --------------------------------------------------------------------- */ -static ssize_t es1370_read(struct file *file, char *buffer, size_t count, loff_t *ppos) +static ssize_t es1370_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) { struct es1370_state *s = (struct es1370_state *)file->private_data; DECLARE_WAITQUEUE(wait, current); @@ -1214,7 +1215,7 @@ return ret; } -static ssize_t es1370_write(struct file *file, const char *buffer, size_t count, loff_t *ppos) +static ssize_t es1370_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { struct es1370_state *s = (struct es1370_state *)file->private_data; DECLARE_WAITQUEUE(wait, current); @@ -1386,13 +1387,15 @@ count_info cinfo; int count; int val, mapped, ret; + void __user *argp = (void __user *)arg; + int __user *p = argp; VALIDATE_STATE(s); mapped = ((file->f_mode & FMODE_WRITE) && s->dma_dac2.mapped) || ((file->f_mode & FMODE_READ) && s->dma_adc.mapped); switch (cmd) { case OSS_GETVERSION: - return put_user(SOUND_VERSION, (int *)arg); + return put_user(SOUND_VERSION, p); case SNDCTL_DSP_SYNC: if (file->f_mode & FMODE_WRITE) @@ -1403,7 +1406,7 @@ return 0; case SNDCTL_DSP_GETCAPS: - return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, (int *)arg); + return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, p); case SNDCTL_DSP_RESET: if (file->f_mode & FMODE_WRITE) { @@ -1419,7 +1422,7 @@ return 0; case SNDCTL_DSP_SPEED: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val >= 0) { if (s->open_mode & (~file->f_mode) & (FMODE_READ|FMODE_WRITE)) @@ -1436,10 +1439,10 @@ outl(s->ctrl, s->io+ES1370_REG_CONTROL); spin_unlock_irqrestore(&s->lock, flags); } - return put_user(DAC2_DIVTOSR((s->ctrl & CTRL_PCLKDIV) >> CTRL_SH_PCLKDIV), (int *)arg); + return put_user(DAC2_DIVTOSR((s->ctrl & CTRL_PCLKDIV) >> CTRL_SH_PCLKDIV), p); case SNDCTL_DSP_STEREO: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (file->f_mode & FMODE_READ) { stop_adc(s); @@ -1466,7 +1469,7 @@ return 0; case SNDCTL_DSP_CHANNELS: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != 0) { if (file->f_mode & FMODE_READ) { @@ -1492,13 +1495,13 @@ spin_unlock_irqrestore(&s->lock, flags); } } - return put_user((s->sctrl & ((file->f_mode & FMODE_READ) ? SCTRL_R1SMB : SCTRL_P2SMB)) ? 2 : 1, (int *)arg); + return put_user((s->sctrl & ((file->f_mode & FMODE_READ) ? SCTRL_R1SMB : SCTRL_P2SMB)) ? 2 : 1, p); case SNDCTL_DSP_GETFMTS: /* Returns a mask */ - return put_user(AFMT_S16_LE|AFMT_U8, (int *)arg); + return put_user(AFMT_S16_LE|AFMT_U8, p); case SNDCTL_DSP_SETFMT: /* Selects ONE fmt*/ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != AFMT_QUERY) { if (file->f_mode & FMODE_READ) { @@ -1525,7 +1528,7 @@ } } return put_user((s->sctrl & ((file->f_mode & FMODE_READ) ? SCTRL_R1SEB : SCTRL_P2SEB)) ? - AFMT_S16_LE : AFMT_U8, (int *)arg); + AFMT_S16_LE : AFMT_U8, p); case SNDCTL_DSP_POST: return 0; @@ -1536,10 +1539,10 @@ val |= PCM_ENABLE_INPUT; if (file->f_mode & FMODE_WRITE && s->ctrl & CTRL_DAC2_EN) val |= PCM_ENABLE_OUTPUT; - return put_user(val, (int *)arg); + return put_user(val, p); case SNDCTL_DSP_SETTRIGGER: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (file->f_mode & FMODE_READ) { if (val & PCM_ENABLE_INPUT) { @@ -1580,7 +1583,7 @@ abinfo.fragstotal = s->dma_dac2.numfrag; abinfo.fragments = abinfo.bytes >> s->dma_dac2.fragshift; spin_unlock_irqrestore(&s->lock, flags); - return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_GETISPACE: if (!(file->f_mode & FMODE_READ)) @@ -1597,7 +1600,7 @@ abinfo.fragstotal = s->dma_adc.numfrag; abinfo.fragments = abinfo.bytes >> s->dma_adc.fragshift; spin_unlock_irqrestore(&s->lock, flags); - return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_NONBLOCK: file->f_flags |= O_NONBLOCK; @@ -1614,7 +1617,7 @@ spin_unlock_irqrestore(&s->lock, flags); if (count < 0) count = 0; - return put_user(count, (int *)arg); + return put_user(count, p); case SNDCTL_DSP_GETIPTR: if (!(file->f_mode & FMODE_READ)) @@ -1632,7 +1635,7 @@ if (s->dma_adc.mapped) s->dma_adc.count &= s->dma_adc.fragsize-1; spin_unlock_irqrestore(&s->lock, flags); - if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) + if (copy_to_user(argp, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; @@ -1652,7 +1655,7 @@ if (s->dma_dac2.mapped) s->dma_dac2.count &= s->dma_dac2.fragsize-1; spin_unlock_irqrestore(&s->lock, flags); - if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) + if (copy_to_user(argp, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; @@ -1660,14 +1663,14 @@ if (file->f_mode & FMODE_WRITE) { if ((val = prog_dmabuf_dac2(s))) return val; - return put_user(s->dma_dac2.fragsize, (int *)arg); + return put_user(s->dma_dac2.fragsize, p); } if ((val = prog_dmabuf_adc(s))) return val; - return put_user(s->dma_adc.fragsize, (int *)arg); + return put_user(s->dma_adc.fragsize, p); case SNDCTL_DSP_SETFRAGMENT: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (file->f_mode & FMODE_READ) { s->dma_adc.ossfragshift = val & 0xffff; @@ -1695,7 +1698,7 @@ if ((file->f_mode & FMODE_READ && s->dma_adc.subdivision) || (file->f_mode & FMODE_WRITE && s->dma_dac2.subdivision)) return -EINVAL; - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != 1 && val != 2 && val != 4) return -EINVAL; @@ -1706,15 +1709,15 @@ return 0; case SOUND_PCM_READ_RATE: - return put_user(DAC2_DIVTOSR((s->ctrl & CTRL_PCLKDIV) >> CTRL_SH_PCLKDIV), (int *)arg); + return put_user(DAC2_DIVTOSR((s->ctrl & CTRL_PCLKDIV) >> CTRL_SH_PCLKDIV), p); case SOUND_PCM_READ_CHANNELS: return put_user((s->sctrl & ((file->f_mode & FMODE_READ) ? SCTRL_R1SMB : SCTRL_P2SMB)) ? - 2 : 1, (int *)arg); + 2 : 1, p); case SOUND_PCM_READ_BITS: return put_user((s->sctrl & ((file->f_mode & FMODE_READ) ? SCTRL_R1SEB : SCTRL_P2SEB)) ? - 16 : 8, (int *)arg); + 16 : 8, p); case SOUND_PCM_WRITE_FILTER: case SNDCTL_DSP_SETSYNCRO: @@ -1828,7 +1831,7 @@ /* --------------------------------------------------------------------- */ -static ssize_t es1370_write_dac(struct file *file, const char *buffer, size_t count, loff_t *ppos) +static ssize_t es1370_write_dac(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { struct es1370_state *s = (struct es1370_state *)file->private_data; DECLARE_WAITQUEUE(wait, current); @@ -1961,11 +1964,12 @@ int count; unsigned ctrl; int val, ret; + int __user *p = (int __user *)arg; VALIDATE_STATE(s); switch (cmd) { case OSS_GETVERSION: - return put_user(SOUND_VERSION, (int *)arg); + return put_user(SOUND_VERSION, p); case SNDCTL_DSP_SYNC: return drain_dac1(s, 0/*file->f_flags & O_NONBLOCK*/); @@ -1974,7 +1978,7 @@ return -EINVAL; case SNDCTL_DSP_GETCAPS: - return put_user(DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, (int *)arg); + return put_user(DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, p); case SNDCTL_DSP_RESET: stop_dac1(s); @@ -1983,7 +1987,7 @@ return 0; case SNDCTL_DSP_SPEED: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val >= 0) { stop_dac1(s); @@ -1996,10 +2000,10 @@ outl(s->ctrl, s->io+ES1370_REG_CONTROL); spin_unlock_irqrestore(&s->lock, flags); } - return put_user(dac1_samplerate[(s->ctrl & CTRL_WTSRSEL) >> CTRL_SH_WTSRSEL], (int *)arg); + return put_user(dac1_samplerate[(s->ctrl & CTRL_WTSRSEL) >> CTRL_SH_WTSRSEL], p); case SNDCTL_DSP_STEREO: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; stop_dac1(s); s->dma_dac1.ready = 0; @@ -2013,7 +2017,7 @@ return 0; case SNDCTL_DSP_CHANNELS: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != 0) { if (s->dma_dac1.mapped) @@ -2028,13 +2032,13 @@ outl(s->sctrl, s->io+ES1370_REG_SERIAL_CONTROL); spin_unlock_irqrestore(&s->lock, flags); } - return put_user((s->sctrl & SCTRL_P1SMB) ? 2 : 1, (int *)arg); + return put_user((s->sctrl & SCTRL_P1SMB) ? 2 : 1, p); case SNDCTL_DSP_GETFMTS: /* Returns a mask */ - return put_user(AFMT_S16_LE|AFMT_U8, (int *)arg); + return put_user(AFMT_S16_LE|AFMT_U8, p); case SNDCTL_DSP_SETFMT: /* Selects ONE fmt*/ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != AFMT_QUERY) { stop_dac1(s); @@ -2047,16 +2051,16 @@ outl(s->sctrl, s->io+ES1370_REG_SERIAL_CONTROL); spin_unlock_irqrestore(&s->lock, flags); } - return put_user((s->sctrl & SCTRL_P1SEB) ? AFMT_S16_LE : AFMT_U8, (int *)arg); + return put_user((s->sctrl & SCTRL_P1SEB) ? AFMT_S16_LE : AFMT_U8, p); case SNDCTL_DSP_POST: return 0; case SNDCTL_DSP_GETTRIGGER: - return put_user((s->ctrl & CTRL_DAC1_EN) ? PCM_ENABLE_OUTPUT : 0, (int *)arg); + return put_user((s->ctrl & CTRL_DAC1_EN) ? PCM_ENABLE_OUTPUT : 0, p); case SNDCTL_DSP_SETTRIGGER: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val & PCM_ENABLE_OUTPUT) { if (!s->dma_dac1.ready && (ret = prog_dmabuf_dac1(s))) @@ -2082,7 +2086,7 @@ abinfo.fragstotal = s->dma_dac1.numfrag; abinfo.fragments = abinfo.bytes >> s->dma_dac1.fragshift; spin_unlock_irqrestore(&s->lock, flags); - return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; + return copy_to_user((void __user *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_NONBLOCK: file->f_flags |= O_NONBLOCK; @@ -2097,7 +2101,7 @@ spin_unlock_irqrestore(&s->lock, flags); if (count < 0) count = 0; - return put_user(count, (int *)arg); + return put_user(count, p); case SNDCTL_DSP_GETOPTR: if (!s->dma_dac1.ready && (val = prog_dmabuf_dac1(s)) != 0) @@ -2113,17 +2117,17 @@ if (s->dma_dac1.mapped) s->dma_dac1.count &= s->dma_dac1.fragsize-1; spin_unlock_irqrestore(&s->lock, flags); - if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) + if (copy_to_user((void __user *)arg, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; case SNDCTL_DSP_GETBLKSIZE: if ((val = prog_dmabuf_dac1(s))) return val; - return put_user(s->dma_dac1.fragsize, (int *)arg); + return put_user(s->dma_dac1.fragsize, p); case SNDCTL_DSP_SETFRAGMENT: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; s->dma_dac1.ossfragshift = val & 0xffff; s->dma_dac1.ossmaxfrags = (val >> 16) & 0xffff; @@ -2138,7 +2142,7 @@ case SNDCTL_DSP_SUBDIVIDE: if (s->dma_dac1.subdivision) return -EINVAL; - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != 1 && val != 2 && val != 4) return -EINVAL; @@ -2146,13 +2150,13 @@ return 0; case SOUND_PCM_READ_RATE: - return put_user(dac1_samplerate[(s->ctrl & CTRL_WTSRSEL) >> CTRL_SH_WTSRSEL], (int *)arg); + return put_user(dac1_samplerate[(s->ctrl & CTRL_WTSRSEL) >> CTRL_SH_WTSRSEL], p); case SOUND_PCM_READ_CHANNELS: - return put_user((s->sctrl & SCTRL_P1SMB) ? 2 : 1, (int *)arg); + return put_user((s->sctrl & SCTRL_P1SMB) ? 2 : 1, p); case SOUND_PCM_READ_BITS: - return put_user((s->sctrl & SCTRL_P1SEB) ? 16 : 8, (int *)arg); + return put_user((s->sctrl & SCTRL_P1SEB) ? 16 : 8, p); case SOUND_PCM_WRITE_FILTER: case SNDCTL_DSP_SETSYNCRO: @@ -2251,7 +2255,7 @@ /* --------------------------------------------------------------------- */ -static ssize_t es1370_midi_read(struct file *file, char *buffer, size_t count, loff_t *ppos) +static ssize_t es1370_midi_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) { struct es1370_state *s = (struct es1370_state *)file->private_data; DECLARE_WAITQUEUE(wait, current); @@ -2314,7 +2318,7 @@ return ret; } -static ssize_t es1370_midi_write(struct file *file, const char *buffer, size_t count, loff_t *ppos) +static ssize_t es1370_midi_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { struct es1370_state *s = (struct es1370_state *)file->private_data; DECLARE_WAITQUEUE(wait, current); diff -urN linux-2.6.7-rc2/sound/oss/es1371.c linux-2.6.7-rc3/sound/oss/es1371.c --- linux-2.6.7-rc2/sound/oss/es1371.c 2004-05-09 19:33:05.000000000 -0700 +++ linux-2.6.7-rc3/sound/oss/es1371.c 2004-06-07 12:55:31.108786371 -0700 @@ -1170,7 +1170,7 @@ return 0; case SOUND_MIXER_WRITE_PCM: /* use SRC for PCM volume */ - if (get_user(val, (int *)arg)) + if (get_user(val, (int __user *)arg)) return -EFAULT; right = ((val >> 8) & 0xff); left = (val & 0xff); @@ -1186,7 +1186,7 @@ return 0; case SOUND_MIXER_READ_PCM: - return put_user(s->spdif_volume, (int *)arg); + return put_user(s->spdif_volume, (int __user *)arg); } return codec->mixer_ioctl(codec, cmd, arg); } @@ -1324,7 +1324,7 @@ /* --------------------------------------------------------------------- */ -static ssize_t es1371_read(struct file *file, char *buffer, size_t count, loff_t *ppos) +static ssize_t es1371_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) { struct es1371_state *s = (struct es1371_state *)file->private_data; DECLARE_WAITQUEUE(wait, current); @@ -1403,7 +1403,7 @@ return ret; } -static ssize_t es1371_write(struct file *file, const char *buffer, size_t count, loff_t *ppos) +static ssize_t es1371_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { struct es1371_state *s = (struct es1371_state *)file->private_data; DECLARE_WAITQUEUE(wait, current); @@ -1578,13 +1578,15 @@ count_info cinfo; int count; int val, mapped, ret; + void __user *argp = (void __user *)arg; + int __user *p = argp; VALIDATE_STATE(s); mapped = ((file->f_mode & FMODE_WRITE) && s->dma_dac2.mapped) || ((file->f_mode & FMODE_READ) && s->dma_adc.mapped); switch (cmd) { case OSS_GETVERSION: - return put_user(SOUND_VERSION, (int *)arg); + return put_user(SOUND_VERSION, p); case SNDCTL_DSP_SYNC: if (file->f_mode & FMODE_WRITE) @@ -1595,7 +1597,7 @@ return 0; case SNDCTL_DSP_GETCAPS: - return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, (int *)arg); + return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, p); case SNDCTL_DSP_RESET: if (file->f_mode & FMODE_WRITE) { @@ -1611,7 +1613,7 @@ return 0; case SNDCTL_DSP_SPEED: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val >= 0) { if (file->f_mode & FMODE_READ) { @@ -1625,10 +1627,10 @@ set_dac2_rate(s, val); } } - return put_user((file->f_mode & FMODE_READ) ? s->adcrate : s->dac2rate, (int *)arg); + return put_user((file->f_mode & FMODE_READ) ? s->adcrate : s->dac2rate, p); case SNDCTL_DSP_STEREO: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (file->f_mode & FMODE_READ) { stop_adc(s); @@ -1655,7 +1657,7 @@ return 0; case SNDCTL_DSP_CHANNELS: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != 0) { if (file->f_mode & FMODE_READ) { @@ -1681,13 +1683,13 @@ spin_unlock_irqrestore(&s->lock, flags); } } - return put_user((s->sctrl & ((file->f_mode & FMODE_READ) ? SCTRL_R1SMB : SCTRL_P2SMB)) ? 2 : 1, (int *)arg); + return put_user((s->sctrl & ((file->f_mode & FMODE_READ) ? SCTRL_R1SMB : SCTRL_P2SMB)) ? 2 : 1, p); case SNDCTL_DSP_GETFMTS: /* Returns a mask */ - return put_user(AFMT_S16_LE|AFMT_U8, (int *)arg); + return put_user(AFMT_S16_LE|AFMT_U8, p); case SNDCTL_DSP_SETFMT: /* Selects ONE fmt*/ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != AFMT_QUERY) { if (file->f_mode & FMODE_READ) { @@ -1714,7 +1716,7 @@ } } return put_user((s->sctrl & ((file->f_mode & FMODE_READ) ? SCTRL_R1SEB : SCTRL_P2SEB)) ? - AFMT_S16_LE : AFMT_U8, (int *)arg); + AFMT_S16_LE : AFMT_U8, p); case SNDCTL_DSP_POST: return 0; @@ -1725,10 +1727,10 @@ val |= PCM_ENABLE_INPUT; if (file->f_mode & FMODE_WRITE && s->ctrl & CTRL_DAC2_EN) val |= PCM_ENABLE_OUTPUT; - return put_user(val, (int *)arg); + return put_user(val, p); case SNDCTL_DSP_SETTRIGGER: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (file->f_mode & FMODE_READ) { if (val & PCM_ENABLE_INPUT) { @@ -1769,7 +1771,7 @@ abinfo.fragstotal = s->dma_dac2.numfrag; abinfo.fragments = abinfo.bytes >> s->dma_dac2.fragshift; spin_unlock_irqrestore(&s->lock, flags); - return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_GETISPACE: if (!(file->f_mode & FMODE_READ)) @@ -1786,7 +1788,7 @@ abinfo.fragstotal = s->dma_adc.numfrag; abinfo.fragments = abinfo.bytes >> s->dma_adc.fragshift; spin_unlock_irqrestore(&s->lock, flags); - return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_NONBLOCK: file->f_flags |= O_NONBLOCK; @@ -1803,7 +1805,7 @@ spin_unlock_irqrestore(&s->lock, flags); if (count < 0) count = 0; - return put_user(count, (int *)arg); + return put_user(count, p); case SNDCTL_DSP_GETIPTR: if (!(file->f_mode & FMODE_READ)) @@ -1821,7 +1823,7 @@ if (s->dma_adc.mapped) s->dma_adc.count &= s->dma_adc.fragsize-1; spin_unlock_irqrestore(&s->lock, flags); - if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) + if (copy_to_user(argp, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; @@ -1841,7 +1843,7 @@ if (s->dma_dac2.mapped) s->dma_dac2.count &= s->dma_dac2.fragsize-1; spin_unlock_irqrestore(&s->lock, flags); - if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) + if (copy_to_user(argp, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; @@ -1849,14 +1851,14 @@ if (file->f_mode & FMODE_WRITE) { if ((val = prog_dmabuf_dac2(s))) return val; - return put_user(s->dma_dac2.fragsize, (int *)arg); + return put_user(s->dma_dac2.fragsize, p); } if ((val = prog_dmabuf_adc(s))) return val; - return put_user(s->dma_adc.fragsize, (int *)arg); + return put_user(s->dma_adc.fragsize, p); case SNDCTL_DSP_SETFRAGMENT: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (file->f_mode & FMODE_READ) { s->dma_adc.ossfragshift = val & 0xffff; @@ -1884,7 +1886,7 @@ if ((file->f_mode & FMODE_READ && s->dma_adc.subdivision) || (file->f_mode & FMODE_WRITE && s->dma_dac2.subdivision)) return -EINVAL; - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != 1 && val != 2 && val != 4) return -EINVAL; @@ -1895,13 +1897,13 @@ return 0; case SOUND_PCM_READ_RATE: - return put_user((file->f_mode & FMODE_READ) ? s->adcrate : s->dac2rate, (int *)arg); + return put_user((file->f_mode & FMODE_READ) ? s->adcrate : s->dac2rate, p); case SOUND_PCM_READ_CHANNELS: - return put_user((s->sctrl & ((file->f_mode & FMODE_READ) ? SCTRL_R1SMB : SCTRL_P2SMB)) ? 2 : 1, (int *)arg); + return put_user((s->sctrl & ((file->f_mode & FMODE_READ) ? SCTRL_R1SMB : SCTRL_P2SMB)) ? 2 : 1, p); case SOUND_PCM_READ_BITS: - return put_user((s->sctrl & ((file->f_mode & FMODE_READ) ? SCTRL_R1SEB : SCTRL_P2SEB)) ? 16 : 8, (int *)arg); + return put_user((s->sctrl & ((file->f_mode & FMODE_READ) ? SCTRL_R1SEB : SCTRL_P2SEB)) ? 16 : 8, p); case SOUND_PCM_WRITE_FILTER: case SNDCTL_DSP_SETSYNCRO: @@ -2017,7 +2019,7 @@ /* --------------------------------------------------------------------- */ -static ssize_t es1371_write_dac(struct file *file, const char *buffer, size_t count, loff_t *ppos) +static ssize_t es1371_write_dac(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { struct es1371_state *s = (struct es1371_state *)file->private_data; DECLARE_WAITQUEUE(wait, current); @@ -2149,11 +2151,12 @@ count_info cinfo; int count; int val, ret; + int __user *p = (int __user *)arg; VALIDATE_STATE(s); switch (cmd) { case OSS_GETVERSION: - return put_user(SOUND_VERSION, (int *)arg); + return put_user(SOUND_VERSION, p); case SNDCTL_DSP_SYNC: return drain_dac1(s, 0/*file->f_flags & O_NONBLOCK*/); @@ -2162,7 +2165,7 @@ return -EINVAL; case SNDCTL_DSP_GETCAPS: - return put_user(DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, (int *)arg); + return put_user(DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, p); case SNDCTL_DSP_RESET: stop_dac1(s); @@ -2171,17 +2174,17 @@ return 0; case SNDCTL_DSP_SPEED: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val >= 0) { stop_dac1(s); s->dma_dac1.ready = 0; set_dac1_rate(s, val); } - return put_user(s->dac1rate, (int *)arg); + return put_user(s->dac1rate, p); case SNDCTL_DSP_STEREO: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; stop_dac1(s); s->dma_dac1.ready = 0; @@ -2195,7 +2198,7 @@ return 0; case SNDCTL_DSP_CHANNELS: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != 0) { stop_dac1(s); @@ -2208,13 +2211,13 @@ outl(s->sctrl, s->io+ES1371_REG_SERIAL_CONTROL); spin_unlock_irqrestore(&s->lock, flags); } - return put_user((s->sctrl & SCTRL_P1SMB) ? 2 : 1, (int *)arg); + return put_user((s->sctrl & SCTRL_P1SMB) ? 2 : 1, p); case SNDCTL_DSP_GETFMTS: /* Returns a mask */ - return put_user(AFMT_S16_LE|AFMT_U8, (int *)arg); + return put_user(AFMT_S16_LE|AFMT_U8, p); case SNDCTL_DSP_SETFMT: /* Selects ONE fmt*/ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != AFMT_QUERY) { stop_dac1(s); @@ -2227,16 +2230,16 @@ outl(s->sctrl, s->io+ES1371_REG_SERIAL_CONTROL); spin_unlock_irqrestore(&s->lock, flags); } - return put_user((s->sctrl & SCTRL_P1SEB) ? AFMT_S16_LE : AFMT_U8, (int *)arg); + return put_user((s->sctrl & SCTRL_P1SEB) ? AFMT_S16_LE : AFMT_U8, p); case SNDCTL_DSP_POST: return 0; case SNDCTL_DSP_GETTRIGGER: - return put_user((s->ctrl & CTRL_DAC1_EN) ? PCM_ENABLE_OUTPUT : 0, (int *)arg); + return put_user((s->ctrl & CTRL_DAC1_EN) ? PCM_ENABLE_OUTPUT : 0, p); case SNDCTL_DSP_SETTRIGGER: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val & PCM_ENABLE_OUTPUT) { if (!s->dma_dac1.ready && (ret = prog_dmabuf_dac1(s))) @@ -2262,7 +2265,7 @@ abinfo.fragstotal = s->dma_dac1.numfrag; abinfo.fragments = abinfo.bytes >> s->dma_dac1.fragshift; spin_unlock_irqrestore(&s->lock, flags); - return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; + return copy_to_user((void __user *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_NONBLOCK: file->f_flags |= O_NONBLOCK; @@ -2277,7 +2280,7 @@ spin_unlock_irqrestore(&s->lock, flags); if (count < 0) count = 0; - return put_user(count, (int *)arg); + return put_user(count, p); case SNDCTL_DSP_GETOPTR: if (!s->dma_dac1.ready && (val = prog_dmabuf_dac1(s)) != 0) @@ -2293,17 +2296,17 @@ if (s->dma_dac1.mapped) s->dma_dac1.count &= s->dma_dac1.fragsize-1; spin_unlock_irqrestore(&s->lock, flags); - if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) + if (copy_to_user((void __user *)arg, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; case SNDCTL_DSP_GETBLKSIZE: if ((val = prog_dmabuf_dac1(s))) return val; - return put_user(s->dma_dac1.fragsize, (int *)arg); + return put_user(s->dma_dac1.fragsize, p); case SNDCTL_DSP_SETFRAGMENT: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; s->dma_dac1.ossfragshift = val & 0xffff; s->dma_dac1.ossmaxfrags = (val >> 16) & 0xffff; @@ -2318,7 +2321,7 @@ case SNDCTL_DSP_SUBDIVIDE: if (s->dma_dac1.subdivision) return -EINVAL; - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != 1 && val != 2 && val != 4) return -EINVAL; @@ -2326,13 +2329,13 @@ return 0; case SOUND_PCM_READ_RATE: - return put_user(s->dac1rate, (int *)arg); + return put_user(s->dac1rate, p); case SOUND_PCM_READ_CHANNELS: - return put_user((s->sctrl & SCTRL_P1SMB) ? 2 : 1, (int *)arg); + return put_user((s->sctrl & SCTRL_P1SMB) ? 2 : 1, p); case SOUND_PCM_READ_BITS: - return put_user((s->sctrl & SCTRL_P1SEB) ? 16 : 8, (int *)arg); + return put_user((s->sctrl & SCTRL_P1SEB) ? 16 : 8, p); case SOUND_PCM_WRITE_FILTER: case SNDCTL_DSP_SETSYNCRO: @@ -2430,7 +2433,7 @@ /* --------------------------------------------------------------------- */ -static ssize_t es1371_midi_read(struct file *file, char *buffer, size_t count, loff_t *ppos) +static ssize_t es1371_midi_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) { struct es1371_state *s = (struct es1371_state *)file->private_data; DECLARE_WAITQUEUE(wait, current); @@ -2493,7 +2496,7 @@ return ret; } -static ssize_t es1371_midi_write(struct file *file, const char *buffer, size_t count, loff_t *ppos) +static ssize_t es1371_midi_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { struct es1371_state *s = (struct es1371_state *)file->private_data; DECLARE_WAITQUEUE(wait, current); diff -urN linux-2.6.7-rc2/sound/oss/esssolo1.c linux-2.6.7-rc3/sound/oss/esssolo1.c --- linux-2.6.7-rc2/sound/oss/esssolo1.c 2004-05-09 19:32:01.000000000 -0700 +++ linux-2.6.7-rc3/sound/oss/esssolo1.c 2004-06-07 12:55:31.111786495 -0700 @@ -694,37 +694,38 @@ }; unsigned char l, r, rl, rr, vidx; int i, val; + int __user *p = (int __user *)arg; VALIDATE_STATE(s); if (cmd == SOUND_MIXER_PRIVATE1) { /* enable/disable/query mixer preamp */ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != -1) { val = val ? 0xff : 0xf7; write_mixer(s, 0x7d, (read_mixer(s, 0x7d) | 0x08) & val); } val = (read_mixer(s, 0x7d) & 0x08) ? 1 : 0; - return put_user(val, (int *)arg); + return put_user(val, p); } if (cmd == SOUND_MIXER_PRIVATE2) { /* enable/disable/query spatializer */ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != -1) { val &= 0x3f; write_mixer(s, 0x52, val); write_mixer(s, 0x50, val ? 0x08 : 0); } - return put_user(read_mixer(s, 0x52), (int *)arg); + return put_user(read_mixer(s, 0x52), p); } if (cmd == SOUND_MIXER_INFO) { mixer_info info; strncpy(info.id, "Solo1", sizeof(info.id)); strncpy(info.name, "ESS Solo1", sizeof(info.name)); info.modify_counter = s->mix.modcnt; - if (copy_to_user((void *)arg, &info, sizeof(info))) + if (copy_to_user((void __user *)arg, &info, sizeof(info))) return -EFAULT; return 0; } @@ -732,41 +733,41 @@ _old_mixer_info info; strncpy(info.id, "Solo1", sizeof(info.id)); strncpy(info.name, "ESS Solo1", sizeof(info.name)); - if (copy_to_user((void *)arg, &info, sizeof(info))) + if (copy_to_user((void __user *)arg, &info, sizeof(info))) return -EFAULT; return 0; } if (cmd == OSS_GETVERSION) - return put_user(SOUND_VERSION, (int *)arg); + return put_user(SOUND_VERSION, p); if (_IOC_TYPE(cmd) != 'M' || _SIOC_SIZE(cmd) != sizeof(int)) return -EINVAL; if (_SIOC_DIR(cmd) == _SIOC_READ) { switch (_IOC_NR(cmd)) { case SOUND_MIXER_RECSRC: /* Arg contains a bit for each recording source */ - return put_user(mixer_src[read_mixer(s, 0x1c) & 7], (int *)arg); + return put_user(mixer_src[read_mixer(s, 0x1c) & 7], p); case SOUND_MIXER_DEVMASK: /* Arg contains a bit for each supported device */ return put_user(SOUND_MASK_PCM | SOUND_MASK_SYNTH | SOUND_MASK_CD | SOUND_MASK_LINE | SOUND_MASK_LINE1 | SOUND_MASK_MIC | SOUND_MASK_VOLUME | SOUND_MASK_LINE2 | SOUND_MASK_RECLEV | - SOUND_MASK_SPEAKER, (int *)arg); + SOUND_MASK_SPEAKER, p); case SOUND_MIXER_RECMASK: /* Arg contains a bit for each supported recording source */ - return put_user(SOUND_MASK_LINE | SOUND_MASK_MIC | SOUND_MASK_CD | SOUND_MASK_VOLUME, (int *)arg); + return put_user(SOUND_MASK_LINE | SOUND_MASK_MIC | SOUND_MASK_CD | SOUND_MASK_VOLUME, p); case SOUND_MIXER_STEREODEVS: /* Mixer channels supporting stereo */ return put_user(SOUND_MASK_PCM | SOUND_MASK_SYNTH | SOUND_MASK_CD | SOUND_MASK_LINE | SOUND_MASK_LINE1 | SOUND_MASK_MIC | - SOUND_MASK_VOLUME | SOUND_MASK_LINE2 | SOUND_MASK_RECLEV, (int *)arg); + SOUND_MASK_VOLUME | SOUND_MASK_LINE2 | SOUND_MASK_RECLEV, p); case SOUND_MIXER_CAPS: - return put_user(SOUND_CAP_EXCL_INPUT, (int *)arg); + return put_user(SOUND_CAP_EXCL_INPUT, p); default: i = _IOC_NR(cmd); if (i >= SOUND_MIXER_NRDEVICES || !(vidx = mixtable1[i])) return -EINVAL; - return put_user(s->mix.vol[vidx-1], (int *)arg); + return put_user(s->mix.vol[vidx-1], p); } } if (_SIOC_DIR(cmd) != (_SIOC_READ|_SIOC_WRITE)) @@ -788,7 +789,7 @@ 0xb4, read_ctrl(s, 0xb4)); } #endif - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; i = hweight32(val); if (i == 0) @@ -805,7 +806,7 @@ return 0; case SOUND_MIXER_VOLUME: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; l = val & 0xff; if (l > 100) @@ -834,10 +835,10 @@ #else s->mix.vol[9] = val; #endif - return put_user(s->mix.vol[9], (int *)arg); + return put_user(s->mix.vol[9], p); case SOUND_MIXER_SPEAKER: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; l = val & 0xff; if (l > 100) @@ -852,10 +853,10 @@ #else s->mix.vol[7] = val; #endif - return put_user(s->mix.vol[7], (int *)arg); + return put_user(s->mix.vol[7], p); case SOUND_MIXER_RECLEV: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; l = (val << 1) & 0x1fe; if (l > 200) @@ -877,13 +878,13 @@ #else s->mix.vol[8] = val; #endif - return put_user(s->mix.vol[8], (int *)arg); + return put_user(s->mix.vol[8], p); default: i = _IOC_NR(cmd); if (i >= SOUND_MIXER_NRDEVICES || !(vidx = mixtable1[i])) return -EINVAL; - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; l = (val << 1) & 0x1fe; if (l > 200) @@ -905,7 +906,7 @@ #else s->mix.vol[vidx-1] = val; #endif - return put_user(s->mix.vol[vidx-1], (int *)arg); + return put_user(s->mix.vol[vidx-1], p); } } @@ -999,7 +1000,7 @@ /* --------------------------------------------------------------------- */ -static ssize_t solo1_read(struct file *file, char *buffer, size_t count, loff_t *ppos) +static ssize_t solo1_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) { struct solo1_state *s = (struct solo1_state *)file->private_data; DECLARE_WAITQUEUE(wait, current); @@ -1095,7 +1096,7 @@ return ret; } -static ssize_t solo1_write(struct file *file, const char *buffer, size_t count, loff_t *ppos) +static ssize_t solo1_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { struct solo1_state *s = (struct solo1_state *)file->private_data; DECLARE_WAITQUEUE(wait, current); @@ -1263,13 +1264,15 @@ int val, mapped, ret, count; int div1, div2; unsigned rate1, rate2; + void __user *argp = (void __user *)arg; + int __user *p = argp; VALIDATE_STATE(s); mapped = ((file->f_mode & FMODE_WRITE) && s->dma_dac.mapped) || ((file->f_mode & FMODE_READ) && s->dma_adc.mapped); switch (cmd) { case OSS_GETVERSION: - return put_user(SOUND_VERSION, (int *)arg); + return put_user(SOUND_VERSION, p); case SNDCTL_DSP_SYNC: if (file->f_mode & FMODE_WRITE) @@ -1280,7 +1283,7 @@ return 0; case SNDCTL_DSP_GETCAPS: - return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, (int *)arg); + return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, p); case SNDCTL_DSP_RESET: if (file->f_mode & FMODE_WRITE) { @@ -1297,7 +1300,7 @@ return 0; case SNDCTL_DSP_SPEED: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val >= 0) { stop_adc(s); @@ -1322,10 +1325,10 @@ s->clkdiv = div1; prog_codec(s); } - return put_user(s->rate, (int *)arg); + return put_user(s->rate, p); case SNDCTL_DSP_STEREO: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; stop_adc(s); stop_dac(s); @@ -1336,7 +1339,7 @@ return 0; case SNDCTL_DSP_CHANNELS: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != 0) { stop_adc(s); @@ -1346,13 +1349,13 @@ s->channels = (val >= 2) ? 2 : 1; prog_codec(s); } - return put_user(s->channels, (int *)arg); + return put_user(s->channels, p); case SNDCTL_DSP_GETFMTS: /* Returns a mask */ - return put_user(AFMT_S16_LE|AFMT_U16_LE|AFMT_S8|AFMT_U8, (int *)arg); + return put_user(AFMT_S16_LE|AFMT_U16_LE|AFMT_S8|AFMT_U8, p); case SNDCTL_DSP_SETFMT: /* Selects ONE fmt*/ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != AFMT_QUERY) { stop_adc(s); @@ -1365,7 +1368,7 @@ s->fmt = val; prog_codec(s); } - return put_user(s->fmt, (int *)arg); + return put_user(s->fmt, p); case SNDCTL_DSP_POST: return 0; @@ -1376,10 +1379,10 @@ val |= PCM_ENABLE_INPUT; if (file->f_mode & s->ena & FMODE_WRITE) val |= PCM_ENABLE_OUTPUT; - return put_user(val, (int *)arg); + return put_user(val, p); case SNDCTL_DSP_SETTRIGGER: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (file->f_mode & FMODE_READ) { if (val & PCM_ENABLE_INPUT) { @@ -1422,7 +1425,7 @@ abinfo.fragstotal = s->dma_dac.numfrag; abinfo.fragments = abinfo.bytes >> s->dma_dac.fragshift; spin_unlock_irqrestore(&s->lock, flags); - return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_GETISPACE: if (!(file->f_mode & FMODE_READ)) @@ -1436,7 +1439,7 @@ abinfo.fragstotal = s->dma_adc.numfrag; abinfo.fragments = abinfo.bytes >> s->dma_adc.fragshift; spin_unlock_irqrestore(&s->lock, flags); - return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_NONBLOCK: file->f_flags |= O_NONBLOCK; @@ -1453,7 +1456,7 @@ spin_unlock_irqrestore(&s->lock, flags); if (count < 0) count = 0; - return put_user(count, (int *)arg); + return put_user(count, p); case SNDCTL_DSP_GETIPTR: if (!(file->f_mode & FMODE_READ)) @@ -1468,7 +1471,7 @@ if (s->dma_adc.mapped) s->dma_adc.count &= s->dma_adc.fragsize-1; spin_unlock_irqrestore(&s->lock, flags); - if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) + if (copy_to_user(argp, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; @@ -1494,7 +1497,7 @@ cinfo.bytes, cinfo.blocks, cinfo.ptr, s->dma_dac.buforder, s->dma_dac.numfrag, s->dma_dac.fragshift, s->dma_dac.swptr, s->dma_dac.count, s->dma_dac.fragsize, s->dma_dac.dmasize, s->dma_dac.fragsamples); #endif - if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) + if (copy_to_user(argp, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; @@ -1502,14 +1505,14 @@ if (file->f_mode & FMODE_WRITE) { if ((val = prog_dmabuf_dac(s))) return val; - return put_user(s->dma_dac.fragsize, (int *)arg); + return put_user(s->dma_dac.fragsize, p); } if ((val = prog_dmabuf_adc(s))) return val; - return put_user(s->dma_adc.fragsize, (int *)arg); + return put_user(s->dma_adc.fragsize, p); case SNDCTL_DSP_SETFRAGMENT: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (file->f_mode & FMODE_READ) { s->dma_adc.ossfragshift = val & 0xffff; @@ -1537,7 +1540,7 @@ if ((file->f_mode & FMODE_READ && s->dma_adc.subdivision) || (file->f_mode & FMODE_WRITE && s->dma_dac.subdivision)) return -EINVAL; - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != 1 && val != 2 && val != 4) return -EINVAL; @@ -1548,13 +1551,13 @@ return 0; case SOUND_PCM_READ_RATE: - return put_user(s->rate, (int *)arg); + return put_user(s->rate, p); case SOUND_PCM_READ_CHANNELS: - return put_user(s->channels, (int *)arg); + return put_user(s->channels, p); case SOUND_PCM_READ_BITS: - return put_user((s->fmt & (AFMT_S8|AFMT_U8)) ? 8 : 16, (int *)arg); + return put_user((s->fmt & (AFMT_S8|AFMT_U8)) ? 8 : 16, p); case SOUND_PCM_WRITE_FILTER: case SNDCTL_DSP_SETSYNCRO: @@ -1727,7 +1730,7 @@ /* --------------------------------------------------------------------- */ -static ssize_t solo1_midi_read(struct file *file, char *buffer, size_t count, loff_t *ppos) +static ssize_t solo1_midi_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) { struct solo1_state *s = (struct solo1_state *)file->private_data; DECLARE_WAITQUEUE(wait, current); @@ -1790,7 +1793,7 @@ return ret; } -static ssize_t solo1_midi_write(struct file *file, const char *buffer, size_t count, loff_t *ppos) +static ssize_t solo1_midi_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { struct solo1_state *s = (struct solo1_state *)file->private_data; DECLARE_WAITQUEUE(wait, current); @@ -2032,7 +2035,7 @@ return 0; case FM_IOCTL_PLAY_NOTE: - if (copy_from_user(&n, (void *)arg, sizeof(n))) + if (copy_from_user(&n, (void __user *)arg, sizeof(n))) return -EFAULT; if (n.voice >= 18) return -EINVAL; @@ -2050,7 +2053,7 @@ return 0; case FM_IOCTL_SET_VOICE: - if (copy_from_user(&v, (void *)arg, sizeof(v))) + if (copy_from_user(&v, (void __user *)arg, sizeof(v))) return -EFAULT; if (v.voice >= 18) return -EINVAL; @@ -2080,7 +2083,7 @@ return 0; case FM_IOCTL_SET_PARAMS: - if (copy_from_user(&p, (void *)arg, sizeof(p))) + if (copy_from_user(&p, (void __user *)arg, sizeof(p))) return -EFAULT; outb(0x08, s->sbbase); outb((p.kbd_split & 1) << 6, s->sbbase+1); diff -urN linux-2.6.7-rc2/sound/oss/forte.c linux-2.6.7-rc3/sound/oss/forte.c --- linux-2.6.7-rc2/sound/oss/forte.c 2004-05-09 19:32:28.000000000 -0700 +++ linux-2.6.7-rc3/sound/oss/forte.c 2004-06-07 12:55:31.115786660 -0700 @@ -849,6 +849,8 @@ struct forte_chip *chip; struct audio_buf_info abi; struct count_info cinfo; + void __user *argp = (void __user *)arg; + int __user *p = argp; chip = file->private_data; @@ -865,24 +867,24 @@ switch (cmd) { case OSS_GETVERSION: - return put_user (SOUND_VERSION, (int *) arg); + return put_user (SOUND_VERSION, p); case SNDCTL_DSP_GETCAPS: DPRINTK ("%s: GETCAPS\n", __FUNCTION__); ival = FORTE_CAPS; /* DUPLEX */ - return put_user (ival, (int *) arg); + return put_user (ival, p); case SNDCTL_DSP_GETFMTS: DPRINTK ("%s: GETFMTS\n", __FUNCTION__); ival = FORTE_FMTS; /* U8, 16LE */ - return put_user (ival, (int *) arg); + return put_user (ival, p); case SNDCTL_DSP_SETFMT: /* U8, 16LE */ DPRINTK ("%s: SETFMT\n", __FUNCTION__); - if (get_user (ival, (int *) arg)) + if (get_user (ival, p)) return -EFAULT; spin_lock_irq (&chip->lock); @@ -899,12 +901,12 @@ spin_unlock_irq (&chip->lock); - return put_user (rval, (int *) arg); + return put_user (rval, p); case SNDCTL_DSP_STEREO: /* 0 - mono, 1 - stereo */ DPRINTK ("%s: STEREO\n", __FUNCTION__); - if (get_user (ival, (int *) arg)) + if (get_user (ival, p)) return -EFAULT; spin_lock_irq (&chip->lock); @@ -921,12 +923,12 @@ spin_unlock_irq (&chip->lock); - return put_user (rval, (int *) arg); + return put_user (rval, p); case SNDCTL_DSP_CHANNELS: /* 1 - mono, 2 - stereo */ DPRINTK ("%s: CHANNELS\n", __FUNCTION__); - if (get_user (ival, (int *) arg)) + if (get_user (ival, p)) return -EFAULT; spin_lock_irq (&chip->lock); @@ -943,12 +945,12 @@ spin_unlock_irq (&chip->lock); - return put_user (rval, (int *) arg); + return put_user (rval, p); case SNDCTL_DSP_SPEED: DPRINTK ("%s: SPEED\n", __FUNCTION__); - if (get_user (ival, (int *) arg)) + if (get_user (ival, p)) return -EFAULT; spin_lock_irq (&chip->lock); @@ -965,7 +967,7 @@ spin_unlock_irq (&chip->lock); - return put_user(rval, (int*) arg); + return put_user(rval, p); case SNDCTL_DSP_GETBLKSIZE: DPRINTK ("%s: GETBLKSIZE\n", __FUNCTION__); @@ -980,7 +982,7 @@ spin_unlock_irq (&chip->lock); - return put_user (ival, (int *) arg); + return put_user (ival, p); case SNDCTL_DSP_RESET: DPRINTK ("%s: RESET\n", __FUNCTION__); @@ -1022,7 +1024,7 @@ case SNDCTL_DSP_SETFRAGMENT: DPRINTK ("%s: SETFRAGMENT\n", __FUNCTION__); - if (get_user (ival, (int *) arg)) + if (get_user (ival, p)) return -EFAULT; spin_lock_irq (&chip->lock); @@ -1041,7 +1043,7 @@ spin_unlock_irq (&chip->lock); - return put_user (ival, (int *) arg); + return put_user (ival, p); case SNDCTL_DSP_GETISPACE: DPRINTK ("%s: GETISPACE\n", __FUNCTION__); @@ -1065,7 +1067,7 @@ spin_unlock_irq (&chip->lock); - return copy_to_user ((void *) arg, &abi, sizeof (abi)) ? -EFAULT : 0; + return copy_to_user (argp, &abi, sizeof (abi)) ? -EFAULT : 0; case SNDCTL_DSP_GETIPTR: DPRINTK ("%s: GETIPTR\n", __FUNCTION__); @@ -1086,7 +1088,7 @@ spin_unlock_irq (&chip->lock); - return copy_to_user ((void *) arg, &cinfo, sizeof (cinfo)) ? -EFAULT : 0; + return copy_to_user (argp, &cinfo, sizeof (cinfo)) ? -EFAULT : 0; case SNDCTL_DSP_GETOSPACE: if (!wr) @@ -1114,7 +1116,7 @@ spin_unlock_irq (&chip->lock); - return copy_to_user ((void *) arg, &abi, sizeof (abi)) ? -EFAULT : 0; + return copy_to_user (argp, &abi, sizeof (abi)) ? -EFAULT : 0; case SNDCTL_DSP_GETOPTR: if (!wr) @@ -1133,7 +1135,7 @@ spin_unlock_irq (&chip->lock); - return copy_to_user ((void *) arg, &cinfo, sizeof (cinfo)) ? -EFAULT : 0; + return copy_to_user (argp, &cinfo, sizeof (cinfo)) ? -EFAULT : 0; case SNDCTL_DSP_GETODELAY: if (!wr) @@ -1157,7 +1159,7 @@ spin_unlock_irq (&chip->lock); - return put_user (ival, (int *) arg); + return put_user (ival, p); case SNDCTL_DSP_SETDUPLEX: DPRINTK ("%s: SETDUPLEX\n", __FUNCTION__); @@ -1167,11 +1169,11 @@ case SNDCTL_DSP_GETTRIGGER: DPRINTK ("%s: GETTRIGGER\n", __FUNCTION__); - return put_user (chip->trigger, (int *) arg); + return put_user (chip->trigger, p); case SNDCTL_DSP_SETTRIGGER: - if (get_user (ival, (int *) arg)) + if (get_user (ival, p)) return -EFAULT; DPRINTK ("%s: SETTRIGGER %d\n", __FUNCTION__, ival); @@ -1207,15 +1209,15 @@ case SOUND_PCM_READ_RATE: DPRINTK ("%s: PCM_READ_RATE\n", __FUNCTION__); - return put_user (chip->play.rate, (int *) arg); + return put_user (chip->play.rate, p); case SOUND_PCM_READ_CHANNELS: DPRINTK ("%s: PCM_READ_CHANNELS\n", __FUNCTION__); - return put_user (chip->play.stereo, (int *) arg); + return put_user (chip->play.stereo, p); case SOUND_PCM_READ_BITS: DPRINTK ("%s: PCM_READ_BITS\n", __FUNCTION__); - return put_user (chip->play.format, (int *) arg); + return put_user (chip->play.format, p); case SNDCTL_DSP_NONBLOCK: DPRINTK ("%s: DSP_NONBLOCK\n", __FUNCTION__); @@ -1223,7 +1225,7 @@ return 0; default: - DPRINTK ("Unsupported ioctl: %x (%p)\n", cmd, (void *) arg); + DPRINTK ("Unsupported ioctl: %x (%p)\n", cmd, argp); break; } @@ -1428,7 +1430,7 @@ */ static ssize_t -forte_dsp_write (struct file *file, const char *buffer, size_t bytes, +forte_dsp_write (struct file *file, const char __user *buffer, size_t bytes, loff_t *ppos) { struct forte_chip *chip; @@ -1536,7 +1538,7 @@ */ static ssize_t -forte_dsp_read (struct file *file, char *buffer, size_t bytes, +forte_dsp_read (struct file *file, char __user *buffer, size_t bytes, loff_t *ppos) { struct forte_chip *chip; diff -urN linux-2.6.7-rc2/sound/oss/i810_audio.c linux-2.6.7-rc3/sound/oss/i810_audio.c --- linux-2.6.7-rc2/sound/oss/i810_audio.c 2004-06-07 12:54:55.238300644 -0700 +++ linux-2.6.7-rc3/sound/oss/i810_audio.c 2004-06-07 12:55:31.244792004 -0700 @@ -1393,7 +1393,7 @@ waiting to be copied to the user's buffer. It is filled by the dma machine and drained by this loop. */ -static ssize_t i810_read(struct file *file, char *buffer, size_t count, loff_t *ppos) +static ssize_t i810_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) { struct i810_state *state = (struct i810_state *)file->private_data; struct i810_card *card=state ? state->card : 0; @@ -1533,7 +1533,7 @@ /* in this loop, dmabuf.count signifies the amount of data that is waiting to be dma to the soundcard. it is drained by the dma machine and filled by this loop. */ -static ssize_t i810_write(struct file *file, const char *buffer, size_t count, loff_t *ppos) +static ssize_t i810_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { struct i810_state *state = (struct i810_state *)file->private_data; struct i810_card *card=state ? state->card : 0; @@ -1755,9 +1755,11 @@ unsigned int i_glob_cnt; int val = 0, ret; struct ac97_codec *codec = state->card->ac97_codec[0]; + void __user *argp = (void __user *)arg; + int __user *p = argp; #ifdef DEBUG - printk("i810_audio: i810_ioctl, arg=0x%x, cmd=", arg ? *(int *)arg : 0); + printk("i810_audio: i810_ioctl, arg=0x%x, cmd=", arg ? *p : 0); #endif switch (cmd) @@ -1766,7 +1768,7 @@ #ifdef DEBUG printk("OSS_GETVERSION\n"); #endif - return put_user(SOUND_VERSION, (int *)arg); + return put_user(SOUND_VERSION, p); case SNDCTL_DSP_RESET: #ifdef DEBUG @@ -1813,7 +1815,7 @@ #ifdef DEBUG printk("SNDCTL_DSP_SPEED\n"); #endif - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val >= 0) { if (file->f_mode & FMODE_WRITE) { @@ -1851,7 +1853,7 @@ spin_unlock_irqrestore(&state->card->lock, flags); } } - return put_user(dmabuf->rate, (int *)arg); + return put_user(dmabuf->rate, p); case SNDCTL_DSP_STEREO: /* set stereo or mono channel */ #ifdef DEBUG @@ -1863,7 +1865,7 @@ if (dmabuf->enable & ADC_RUNNING) { stop_adc(state); } - return put_user(1, (int *)arg); + return put_user(1, p); case SNDCTL_DSP_GETBLKSIZE: if (file->f_mode & FMODE_WRITE) { @@ -1877,25 +1879,25 @@ #ifdef DEBUG printk("SNDCTL_DSP_GETBLKSIZE %d\n", dmabuf->userfragsize); #endif - return put_user(dmabuf->userfragsize, (int *)arg); + return put_user(dmabuf->userfragsize, p); case SNDCTL_DSP_GETFMTS: /* Returns a mask of supported sample format*/ #ifdef DEBUG printk("SNDCTL_DSP_GETFMTS\n"); #endif - return put_user(AFMT_S16_LE, (int *)arg); + return put_user(AFMT_S16_LE, p); case SNDCTL_DSP_SETFMT: /* Select sample format */ #ifdef DEBUG printk("SNDCTL_DSP_SETFMT\n"); #endif - return put_user(AFMT_S16_LE, (int *)arg); + return put_user(AFMT_S16_LE, p); case SNDCTL_DSP_CHANNELS: #ifdef DEBUG printk("SNDCTL_DSP_CHANNELS\n"); #endif - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val > 0) { @@ -1906,13 +1908,13 @@ stop_adc(state); } } else { - return put_user(state->card->channels, (int *)arg); + return put_user(state->card->channels, p); } /* ICH and ICH0 only support 2 channels */ if ( state->card->pci_id == PCI_DEVICE_ID_INTEL_82801AA_5 || state->card->pci_id == PCI_DEVICE_ID_INTEL_82801AB_5) - return put_user(2, (int *)arg); + return put_user(2, p); /* Multi-channel support was added with ICH2. Bits in */ /* Global Status and Global Control register are now */ @@ -1957,7 +1959,7 @@ break; } - return put_user(val, (int *)arg); + return put_user(val, p); case SNDCTL_DSP_POST: /* the user has sent all data and is notifying us */ /* we update the swptr to the end of the last sg segment then return */ @@ -1976,7 +1978,7 @@ case SNDCTL_DSP_SUBDIVIDE: if (dmabuf->subdivision) return -EINVAL; - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != 1 && val != 2 && val != 4) return -EINVAL; @@ -1988,7 +1990,7 @@ return 0; case SNDCTL_DSP_SETFRAGMENT: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; dmabuf->ossfragsize = 1<<(val & 0xffff); @@ -2061,7 +2063,7 @@ printk("SNDCTL_DSP_GETOSPACE %d, %d, %d, %d\n", abinfo.bytes, abinfo.fragsize, abinfo.fragments, abinfo.fragstotal); #endif - return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_GETOPTR: if (!(file->f_mode & FMODE_WRITE)) @@ -2083,7 +2085,7 @@ printk("SNDCTL_DSP_GETOPTR %d, %d, %d, %d\n", cinfo.bytes, cinfo.blocks, cinfo.ptr, dmabuf->count); #endif - return copy_to_user((void *)arg, &cinfo, sizeof(cinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &cinfo, sizeof(cinfo)) ? -EFAULT : 0; case SNDCTL_DSP_GETISPACE: if (!(file->f_mode & FMODE_READ)) @@ -2100,7 +2102,7 @@ printk("SNDCTL_DSP_GETISPACE %d, %d, %d, %d\n", abinfo.bytes, abinfo.fragsize, abinfo.fragments, abinfo.fragstotal); #endif - return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_GETIPTR: if (!(file->f_mode & FMODE_READ)) @@ -2122,7 +2124,7 @@ printk("SNDCTL_DSP_GETIPTR %d, %d, %d, %d\n", cinfo.bytes, cinfo.blocks, cinfo.ptr, dmabuf->count); #endif - return copy_to_user((void *)arg, &cinfo, sizeof(cinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &cinfo, sizeof(cinfo)) ? -EFAULT : 0; case SNDCTL_DSP_NONBLOCK: #ifdef DEBUG @@ -2136,17 +2138,17 @@ printk("SNDCTL_DSP_GETCAPS\n"); #endif return put_user(DSP_CAP_REALTIME|DSP_CAP_TRIGGER|DSP_CAP_MMAP|DSP_CAP_BIND, - (int *)arg); + p); case SNDCTL_DSP_GETTRIGGER: val = 0; #ifdef DEBUG printk("SNDCTL_DSP_GETTRIGGER 0x%x\n", dmabuf->trigger); #endif - return put_user(dmabuf->trigger, (int *)arg); + return put_user(dmabuf->trigger, p); case SNDCTL_DSP_SETTRIGGER: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; #if defined(DEBUG) || defined(DEBUG_MMAP) printk("SNDCTL_DSP_SETTRIGGER 0x%x\n", val); @@ -2223,31 +2225,31 @@ #ifdef DEBUG printk("SNDCTL_DSP_GETODELAY %d\n", dmabuf->count); #endif - return put_user(val, (int *)arg); + return put_user(val, p); case SOUND_PCM_READ_RATE: #ifdef DEBUG printk("SOUND_PCM_READ_RATE %d\n", dmabuf->rate); #endif - return put_user(dmabuf->rate, (int *)arg); + return put_user(dmabuf->rate, p); case SOUND_PCM_READ_CHANNELS: #ifdef DEBUG printk("SOUND_PCM_READ_CHANNELS\n"); #endif - return put_user(2, (int *)arg); + return put_user(2, p); case SOUND_PCM_READ_BITS: #ifdef DEBUG printk("SOUND_PCM_READ_BITS\n"); #endif - return put_user(AFMT_S16_LE, (int *)arg); + return put_user(AFMT_S16_LE, p); case SNDCTL_DSP_SETSPDIF: /* Set S/PDIF Control register */ #ifdef DEBUG printk("SNDCTL_DSP_SETSPDIF\n"); #endif - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; /* Check to make sure the codec supports S/PDIF transmitter */ @@ -2270,13 +2272,13 @@ else printk(KERN_WARNING "i810_audio: S/PDIF transmitter not avalible.\n"); #endif - return put_user(val, (int *)arg); + return put_user(val, p); case SNDCTL_DSP_GETSPDIF: /* Get S/PDIF Control register */ #ifdef DEBUG printk("SNDCTL_DSP_GETSPDIF\n"); #endif - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; /* Check to make sure the codec supports S/PDIF transmitter */ @@ -2289,14 +2291,14 @@ } else { val = i810_ac97_get(codec, AC97_SPDIF_CONTROL); } - //return put_user((val & 0xcfff), (int *)arg); - return put_user(val, (int *)arg); + //return put_user((val & 0xcfff), p); + return put_user(val, p); case SNDCTL_DSP_GETCHANNELMASK: #ifdef DEBUG printk("SNDCTL_DSP_GETCHANNELMASK\n"); #endif - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; /* Based on AC'97 DAC support, not ICH hardware */ @@ -2309,13 +2311,13 @@ if ( state->card->ac97_features & 0x0140 ) val |= DSP_BIND_CENTER_LFE; - return put_user(val, (int *)arg); + return put_user(val, p); case SNDCTL_DSP_BIND_CHANNEL: #ifdef DEBUG printk("SNDCTL_DSP_BIND_CHANNEL\n"); #endif - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if ( val == DSP_BIND_QUERY ) { val = DSP_BIND_FRONT; /* Always report this as being enabled */ @@ -2383,7 +2385,7 @@ val &= ~DSP_BIND_CENTER_LFE; } } - return put_user(val, (int *)arg); + return put_user(val, p); case SNDCTL_DSP_MAPINBUF: case SNDCTL_DSP_MAPOUTBUF: diff -urN linux-2.6.7-rc2/sound/oss/kahlua.c linux-2.6.7-rc3/sound/oss/kahlua.c --- linux-2.6.7-rc2/sound/oss/kahlua.c 2004-05-09 19:33:19.000000000 -0700 +++ linux-2.6.7-rc3/sound/oss/kahlua.c 2004-06-07 12:55:31.245792046 -0700 @@ -218,7 +218,7 @@ static void __devexit kahlua_cleanup_module(void) { - return pci_unregister_driver(&kahlua_driver); + pci_unregister_driver(&kahlua_driver); } diff -urN linux-2.6.7-rc2/sound/oss/maestro.c linux-2.6.7-rc3/sound/oss/maestro.c --- linux-2.6.7-rc2/sound/oss/maestro.c 2004-05-09 19:33:19.000000000 -0700 +++ linux-2.6.7-rc3/sound/oss/maestro.c 2004-06-07 12:55:31.250792253 -0700 @@ -2025,7 +2025,9 @@ static int mixer_ioctl(struct ess_card *card, unsigned int cmd, unsigned long arg) { int i, val=0; - unsigned long flags; + unsigned long flags; + void __user *argp = (void __user *)arg; + int __user *p = argp; VALIDATE_CARD(card); if (cmd == SOUND_MIXER_INFO) { @@ -2034,7 +2036,7 @@ strlcpy(info.id, card_names[card->card_type], sizeof(info.id)); strlcpy(info.name, card_names[card->card_type], sizeof(info.name)); info.modify_counter = card->mix.modcnt; - if (copy_to_user((void *)arg, &info, sizeof(info))) + if (copy_to_user(argp, &info, sizeof(info))) return -EFAULT; return 0; } @@ -2043,12 +2045,12 @@ memset(&info, 0, sizeof(info)); strlcpy(info.id, card_names[card->card_type], sizeof(info.id)); strlcpy(info.name, card_names[card->card_type], sizeof(info.name)); - if (copy_to_user((void *)arg, &info, sizeof(info))) + if (copy_to_user(argp, &info, sizeof(info))) return -EFAULT; return 0; } if (cmd == OSS_GETVERSION) - return put_user(SOUND_VERSION, (int *)arg); + return put_user(SOUND_VERSION, p); if (_IOC_TYPE(cmd) != 'M' || _IOC_SIZE(cmd) != sizeof(int)) return -EINVAL; @@ -2098,7 +2100,7 @@ break; } - return put_user(val,(int *)arg); + return put_user(val, p); } if (_IOC_DIR(cmd) != (_IOC_WRITE|_IOC_READ)) @@ -2106,7 +2108,7 @@ card->mix.modcnt++; - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; switch (_IOC_NR(cmd)) { @@ -2262,7 +2264,7 @@ to be copied to the user's buffer. it is filled by the interrupt handler and drained by this loop. */ static ssize_t -ess_read(struct file *file, char *buffer, size_t count, loff_t *ppos) +ess_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) { struct ess_state *s = (struct ess_state *)file->private_data; ssize_t ret; @@ -2361,7 +2363,7 @@ } static ssize_t -ess_write(struct file *file, const char *buffer, size_t count, loff_t *ppos) +ess_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { struct ess_state *s = (struct ess_state *)file->private_data; ssize_t ret; @@ -2539,6 +2541,8 @@ count_info cinfo; int val, mapped, ret; unsigned char fmtm, fmtd; + void __user *argp = (void __user *)arg; + int __user *p = argp; /* printk("maestro: ess_ioctl: cmd %d\n", cmd);*/ @@ -2547,7 +2551,7 @@ ((file->f_mode & FMODE_READ) && s->dma_adc.mapped); switch (cmd) { case OSS_GETVERSION: - return put_user(SOUND_VERSION, (int *)arg); + return put_user(SOUND_VERSION, p); case SNDCTL_DSP_SYNC: if (file->f_mode & FMODE_WRITE) @@ -2559,7 +2563,7 @@ return 0; case SNDCTL_DSP_GETCAPS: - return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, (int *)arg); + return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, p); case SNDCTL_DSP_RESET: if (file->f_mode & FMODE_WRITE) { @@ -2575,7 +2579,7 @@ return 0; case SNDCTL_DSP_SPEED: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val >= 0) { if (file->f_mode & FMODE_READ) { @@ -2589,10 +2593,10 @@ set_dac_rate(s, val); } } - return put_user((file->f_mode & FMODE_READ) ? s->rateadc : s->ratedac, (int *)arg); + return put_user((file->f_mode & FMODE_READ) ? s->rateadc : s->ratedac, p); case SNDCTL_DSP_STEREO: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; fmtd = 0; fmtm = ~0; @@ -2616,7 +2620,7 @@ return 0; case SNDCTL_DSP_CHANNELS: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != 0) { fmtd = 0; @@ -2640,13 +2644,13 @@ set_fmt(s, fmtm, fmtd); } return put_user((s->fmt & ((file->f_mode & FMODE_READ) ? (ESS_FMT_STEREO << ESS_ADC_SHIFT) - : (ESS_FMT_STEREO << ESS_DAC_SHIFT))) ? 2 : 1, (int *)arg); + : (ESS_FMT_STEREO << ESS_DAC_SHIFT))) ? 2 : 1, p); case SNDCTL_DSP_GETFMTS: /* Returns a mask */ - return put_user(AFMT_U8|AFMT_S16_LE, (int *)arg); + return put_user(AFMT_U8|AFMT_S16_LE, p); case SNDCTL_DSP_SETFMT: /* Selects ONE fmt*/ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != AFMT_QUERY) { fmtd = 0; @@ -2678,7 +2682,7 @@ : (ESS_FMT_16BIT << ESS_DAC_SHIFT))) ? AFMT_S16_LE : AFMT_U8, - (int *)arg); + p); case SNDCTL_DSP_POST: return 0; @@ -2689,10 +2693,10 @@ val |= PCM_ENABLE_INPUT; if ((file->f_mode & FMODE_WRITE) && (s->enable & DAC_RUNNING)) val |= PCM_ENABLE_OUTPUT; - return put_user(val, (int *)arg); + return put_user(val, p); case SNDCTL_DSP_SETTRIGGER: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (file->f_mode & FMODE_READ) { if (val & PCM_ENABLE_INPUT) { @@ -2724,7 +2728,7 @@ abinfo.fragstotal = s->dma_dac.numfrag; abinfo.fragments = abinfo.bytes >> s->dma_dac.fragshift; spin_unlock_irqrestore(&s->lock, flags); - return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_GETISPACE: if (!(file->f_mode & FMODE_READ)) @@ -2738,7 +2742,7 @@ abinfo.fragstotal = s->dma_adc.numfrag; abinfo.fragments = abinfo.bytes >> s->dma_adc.fragshift; spin_unlock_irqrestore(&s->lock, flags); - return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_NONBLOCK: file->f_flags |= O_NONBLOCK; @@ -2753,7 +2757,7 @@ ess_update_ptr(s); val = s->dma_dac.count; spin_unlock_irqrestore(&s->lock, flags); - return put_user(val, (int *)arg); + return put_user(val, p); case SNDCTL_DSP_GETIPTR: if (!(file->f_mode & FMODE_READ)) @@ -2768,7 +2772,7 @@ if (s->dma_adc.mapped) s->dma_adc.count &= s->dma_adc.fragsize-1; spin_unlock_irqrestore(&s->lock, flags); - if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) + if (copy_to_user(argp, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; @@ -2785,7 +2789,7 @@ if (s->dma_dac.mapped) s->dma_dac.count &= s->dma_dac.fragsize-1; spin_unlock_irqrestore(&s->lock, flags); - if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) + if (copy_to_user(argp, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; @@ -2793,14 +2797,14 @@ if (file->f_mode & FMODE_WRITE) { if ((val = prog_dmabuf(s, 0))) return val; - return put_user(s->dma_dac.fragsize, (int *)arg); + return put_user(s->dma_dac.fragsize, p); } if ((val = prog_dmabuf(s, 1))) return val; - return put_user(s->dma_adc.fragsize, (int *)arg); + return put_user(s->dma_adc.fragsize, p); case SNDCTL_DSP_SETFRAGMENT: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; M_printk("maestro: SETFRAGMENT: %0x\n",val); if (file->f_mode & FMODE_READ) { @@ -2829,7 +2833,7 @@ if ((file->f_mode & FMODE_READ && s->dma_adc.subdivision) || (file->f_mode & FMODE_WRITE && s->dma_dac.subdivision)) return -EINVAL; - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != 1 && val != 2 && val != 4) return -EINVAL; @@ -2840,15 +2844,15 @@ return 0; case SOUND_PCM_READ_RATE: - return put_user((file->f_mode & FMODE_READ) ? s->rateadc : s->ratedac, (int *)arg); + return put_user((file->f_mode & FMODE_READ) ? s->rateadc : s->ratedac, p); case SOUND_PCM_READ_CHANNELS: return put_user((s->fmt & ((file->f_mode & FMODE_READ) ? (ESS_FMT_STEREO << ESS_ADC_SHIFT) - : (ESS_FMT_STEREO << ESS_DAC_SHIFT))) ? 2 : 1, (int *)arg); + : (ESS_FMT_STEREO << ESS_DAC_SHIFT))) ? 2 : 1, p); case SOUND_PCM_READ_BITS: return put_user((s->fmt & ((file->f_mode & FMODE_READ) ? (ESS_FMT_16BIT << ESS_ADC_SHIFT) - : (ESS_FMT_16BIT << ESS_DAC_SHIFT))) ? 16 : 8, (int *)arg); + : (ESS_FMT_16BIT << ESS_DAC_SHIFT))) ? 16 : 8, p); case SOUND_PCM_WRITE_FILTER: case SNDCTL_DSP_SETSYNCRO: diff -urN linux-2.6.7-rc2/sound/oss/maestro3.c linux-2.6.7-rc3/sound/oss/maestro3.c --- linux-2.6.7-rc2/sound/oss/maestro3.c 2004-05-09 19:33:19.000000000 -0700 +++ linux-2.6.7-rc3/sound/oss/maestro3.c 2004-06-07 12:55:31.253792377 -0700 @@ -1324,7 +1324,7 @@ return 0; } -static ssize_t m3_read(struct file *file, char *buffer, size_t count, loff_t *ppos) +static ssize_t m3_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) { struct m3_state *s = (struct m3_state *)file->private_data; ssize_t ret; @@ -1405,7 +1405,7 @@ return ret; } -static ssize_t m3_write(struct file *file, const char *buffer, size_t count, loff_t *ppos) +static ssize_t m3_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { struct m3_state *s = (struct m3_state *)file->private_data; ssize_t ret; @@ -1584,6 +1584,8 @@ count_info cinfo; int val, mapped, ret; unsigned char fmtm, fmtd; + void __user *argp = (void __user *)arg; + int __user *p = argp; VALIDATE_STATE(s); @@ -1594,7 +1596,7 @@ switch (cmd) { case OSS_GETVERSION: - return put_user(SOUND_VERSION, (int *)arg); + return put_user(SOUND_VERSION, p); case SNDCTL_DSP_SYNC: if (file->f_mode & FMODE_WRITE) @@ -1606,7 +1608,7 @@ return 0; case SNDCTL_DSP_GETCAPS: - return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, (int *)arg); + return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, p); case SNDCTL_DSP_RESET: spin_lock_irqsave(&card->lock, flags); @@ -1624,7 +1626,7 @@ return 0; case SNDCTL_DSP_SPEED: - get_user_ret(val, (int *)arg, -EFAULT); + get_user_ret(val, p, -EFAULT); spin_lock_irqsave(&card->lock, flags); if (val >= 0) { if (file->f_mode & FMODE_READ) { @@ -1639,10 +1641,10 @@ } } spin_unlock_irqrestore(&card->lock, flags); - return put_user((file->f_mode & FMODE_READ) ? s->rateadc : s->ratedac, (int *)arg); + return put_user((file->f_mode & FMODE_READ) ? s->rateadc : s->ratedac, p); case SNDCTL_DSP_STEREO: - get_user_ret(val, (int *)arg, -EFAULT); + get_user_ret(val, p, -EFAULT); spin_lock_irqsave(&card->lock, flags); fmtd = 0; fmtm = ~0; @@ -1667,7 +1669,7 @@ return 0; case SNDCTL_DSP_CHANNELS: - get_user_ret(val, (int *)arg, -EFAULT); + get_user_ret(val, p, -EFAULT); spin_lock_irqsave(&card->lock, flags); if (val != 0) { fmtd = 0; @@ -1692,13 +1694,13 @@ } spin_unlock_irqrestore(&card->lock, flags); return put_user((s->fmt & ((file->f_mode & FMODE_READ) ? (ESS_FMT_STEREO << ESS_ADC_SHIFT) - : (ESS_FMT_STEREO << ESS_DAC_SHIFT))) ? 2 : 1, (int *)arg); + : (ESS_FMT_STEREO << ESS_DAC_SHIFT))) ? 2 : 1, p); case SNDCTL_DSP_GETFMTS: /* Returns a mask */ - return put_user(AFMT_U8|AFMT_S16_LE, (int *)arg); + return put_user(AFMT_U8|AFMT_S16_LE, p); case SNDCTL_DSP_SETFMT: /* Selects ONE fmt*/ - get_user_ret(val, (int *)arg, -EFAULT); + get_user_ret(val, p, -EFAULT); spin_lock_irqsave(&card->lock, flags); if (val != AFMT_QUERY) { fmtd = 0; @@ -1727,7 +1729,7 @@ : (ESS_FMT_16BIT << ESS_DAC_SHIFT))) ? AFMT_S16_LE : AFMT_U8, - (int *)arg); + p); case SNDCTL_DSP_POST: return 0; @@ -1738,10 +1740,10 @@ val |= PCM_ENABLE_INPUT; if ((file->f_mode & FMODE_WRITE) && (s->enable & DAC_RUNNING)) val |= PCM_ENABLE_OUTPUT; - return put_user(val, (int *)arg); + return put_user(val, p); case SNDCTL_DSP_SETTRIGGER: - get_user_ret(val, (int *)arg, -EFAULT); + get_user_ret(val, p, -EFAULT); if (file->f_mode & FMODE_READ) { if (val & PCM_ENABLE_INPUT) { if (!s->dma_adc.ready && (ret = prog_dmabuf(s, 1))) @@ -1772,7 +1774,7 @@ abinfo.fragstotal = s->dma_dac.numfrag; abinfo.fragments = abinfo.bytes >> s->dma_dac.fragshift; spin_unlock_irqrestore(&card->lock, flags); - return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_GETISPACE: if (!(file->f_mode & FMODE_READ)) @@ -1786,7 +1788,7 @@ abinfo.fragstotal = s->dma_adc.numfrag; abinfo.fragments = abinfo.bytes >> s->dma_adc.fragshift; spin_unlock_irqrestore(&card->lock, flags); - return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_NONBLOCK: file->f_flags |= O_NONBLOCK; @@ -1799,7 +1801,7 @@ m3_update_ptr(s); val = s->dma_dac.count; spin_unlock_irqrestore(&card->lock, flags); - return put_user(val, (int *)arg); + return put_user(val, p); case SNDCTL_DSP_GETIPTR: if (!(file->f_mode & FMODE_READ)) @@ -1812,7 +1814,7 @@ if (s->dma_adc.mapped) s->dma_adc.count &= s->dma_adc.fragsize-1; spin_unlock_irqrestore(&card->lock, flags); - if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) + if (copy_to_user(argp, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; @@ -1827,7 +1829,7 @@ if (s->dma_dac.mapped) s->dma_dac.count &= s->dma_dac.fragsize-1; spin_unlock_irqrestore(&card->lock, flags); - if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) + if (copy_to_user(argp, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; @@ -1835,14 +1837,14 @@ if (file->f_mode & FMODE_WRITE) { if ((val = prog_dmabuf(s, 0))) return val; - return put_user(s->dma_dac.fragsize, (int *)arg); + return put_user(s->dma_dac.fragsize, p); } if ((val = prog_dmabuf(s, 1))) return val; - return put_user(s->dma_adc.fragsize, (int *)arg); + return put_user(s->dma_adc.fragsize, p); case SNDCTL_DSP_SETFRAGMENT: - get_user_ret(val, (int *)arg, -EFAULT); + get_user_ret(val, p, -EFAULT); spin_lock_irqsave(&card->lock, flags); if (file->f_mode & FMODE_READ) { s->dma_adc.ossfragshift = val & 0xffff; @@ -1871,7 +1873,7 @@ if ((file->f_mode & FMODE_READ && s->dma_adc.subdivision) || (file->f_mode & FMODE_WRITE && s->dma_dac.subdivision)) return -EINVAL; - get_user_ret(val, (int *)arg, -EFAULT); + get_user_ret(val, p, -EFAULT); if (val != 1 && val != 2 && val != 4) return -EINVAL; if (file->f_mode & FMODE_READ) @@ -1881,15 +1883,15 @@ return 0; case SOUND_PCM_READ_RATE: - return put_user((file->f_mode & FMODE_READ) ? s->rateadc : s->ratedac, (int *)arg); + return put_user((file->f_mode & FMODE_READ) ? s->rateadc : s->ratedac, p); case SOUND_PCM_READ_CHANNELS: return put_user((s->fmt & ((file->f_mode & FMODE_READ) ? (ESS_FMT_STEREO << ESS_ADC_SHIFT) - : (ESS_FMT_STEREO << ESS_DAC_SHIFT))) ? 2 : 1, (int *)arg); + : (ESS_FMT_STEREO << ESS_DAC_SHIFT))) ? 2 : 1, p); case SOUND_PCM_READ_BITS: return put_user((s->fmt & ((file->f_mode & FMODE_READ) ? (ESS_FMT_16BIT << ESS_ADC_SHIFT) - : (ESS_FMT_16BIT << ESS_DAC_SHIFT))) ? 16 : 8, (int *)arg); + : (ESS_FMT_16BIT << ESS_DAC_SHIFT))) ? 16 : 8, p); case SOUND_PCM_WRITE_FILTER: case SNDCTL_DSP_SETSYNCRO: diff -urN linux-2.6.7-rc2/sound/oss/msnd.c linux-2.6.7-rc3/sound/oss/msnd.c --- linux-2.6.7-rc2/sound/oss/msnd.c 2004-06-07 12:54:55.277302260 -0700 +++ linux-2.6.7-rc3/sound/oss/msnd.c 2004-06-07 12:55:31.287793785 -0700 @@ -139,13 +139,10 @@ f->len = f->tail = f->head = 0; } -int msnd_fifo_write(msnd_fifo *f, const char *buf, size_t len, int user) +int msnd_fifo_write(msnd_fifo *f, const char *buf, size_t len) { int count = 0; - if (f->len == f->n) - return 0; - while ((count < len) && (f->len != f->n)) { int nwritten; @@ -161,11 +158,7 @@ nwritten = len - count; } - if (user) { - if (copy_from_user(f->data + f->tail, buf, nwritten)) - return -EFAULT; - } else - isa_memcpy_fromio(f->data + f->tail, (unsigned long) buf, nwritten); + isa_memcpy_fromio(f->data + f->tail, (unsigned long) buf, nwritten); count += nwritten; buf += nwritten; @@ -177,13 +170,10 @@ return count; } -int msnd_fifo_read(msnd_fifo *f, char *buf, size_t len, int user) +int msnd_fifo_read(msnd_fifo *f, char *buf, size_t len) { int count = 0; - if (f->len == 0) - return f->len; - while ((count < len) && (f->len > 0)) { int nread; @@ -199,11 +189,7 @@ nread = len - count; } - if (user) { - if (copy_to_user(buf, f->data + f->head, nread)) - return -EFAULT; - } else - isa_memcpy_toio((unsigned long) buf, f->data + f->head, nread); + isa_memcpy_toio((unsigned long) buf, f->data + f->head, nread); count += nread; buf += nread; diff -urN linux-2.6.7-rc2/sound/oss/msnd.h linux-2.6.7-rc3/sound/oss/msnd.h --- linux-2.6.7-rc2/sound/oss/msnd.h 2004-05-09 19:32:37.000000000 -0700 +++ linux-2.6.7-rc3/sound/oss/msnd.h 2004-06-07 12:55:31.288793827 -0700 @@ -266,8 +266,8 @@ void msnd_fifo_free(msnd_fifo *f); int msnd_fifo_alloc(msnd_fifo *f, size_t n); void msnd_fifo_make_empty(msnd_fifo *f); -int msnd_fifo_write(msnd_fifo *f, const char *buf, size_t len, int user); -int msnd_fifo_read(msnd_fifo *f, char *buf, size_t len, int user); +int msnd_fifo_write(msnd_fifo *f, const char *buf, size_t len); +int msnd_fifo_read(msnd_fifo *f, char *buf, size_t len); int msnd_wait_TXDE(multisound_dev_t *dev); int msnd_wait_HC0(multisound_dev_t *dev); diff -urN linux-2.6.7-rc2/sound/oss/msnd_pinnacle.c linux-2.6.7-rc3/sound/oss/msnd_pinnacle.c --- linux-2.6.7-rc2/sound/oss/msnd_pinnacle.c 2004-05-09 19:32:52.000000000 -0700 +++ linux-2.6.7-rc3/sound/oss/msnd_pinnacle.c 2004-06-07 12:55:31.299794282 -0700 @@ -212,6 +212,7 @@ LPDAQD lpDAQ, lpDARQ; audio_buf_info abinfo; unsigned long flags; + int __user *p = (int __user *)arg; lpDAQ = dev.base + DAPQ_DATA_BUFF; lpDARQ = dev.base + DARQ_DATA_BUFF; @@ -238,7 +239,7 @@ abinfo.fragstotal = dev.DAPF.n / abinfo.fragsize; abinfo.fragments = abinfo.bytes / abinfo.fragsize; spin_unlock_irqrestore(&dev.lock, flags); - return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; + return copy_to_user((void __user *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_GETISPACE: if (!(file->f_mode & FMODE_READ)) @@ -249,7 +250,7 @@ abinfo.fragstotal = dev.DARF.n / abinfo.fragsize; abinfo.fragments = abinfo.bytes / abinfo.fragsize; spin_unlock_irqrestore(&dev.lock, flags); - return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; + return copy_to_user((void __user *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_RESET: dev.nresets = 0; @@ -262,18 +263,18 @@ case SNDCTL_DSP_GETBLKSIZE: tmp = dsp_get_frag_size(); - if (put_user(tmp, (int *)arg)) + if (put_user(tmp, p)) return -EFAULT; return 0; case SNDCTL_DSP_GETFMTS: val = AFMT_S16_LE | AFMT_U8; - if (put_user(val, (int *)arg)) + if (put_user(val, p)) return -EFAULT; return 0; case SNDCTL_DSP_SETFMT: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (file->f_mode & FMODE_WRITE) @@ -285,7 +286,7 @@ ? dev.rec_sample_size : dsp_set_format(file, val); - if (put_user(data, (int *)arg)) + if (put_user(data, p)) return -EFAULT; return 0; @@ -299,12 +300,12 @@ case SNDCTL_DSP_GETCAPS: val = DSP_CAP_DUPLEX | DSP_CAP_BATCH; - if (put_user(val, (int *)arg)) + if (put_user(val, p)) return -EFAULT; return 0; case SNDCTL_DSP_SPEED: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val < 8000) @@ -326,13 +327,13 @@ if (file->f_mode & FMODE_READ) dev.rec_sample_rate = data; - if (put_user(data, (int *)arg)) + if (put_user(data, p)) return -EFAULT; return 0; case SNDCTL_DSP_CHANNELS: case SNDCTL_DSP_STEREO: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (cmd == SNDCTL_DSP_CHANNELS) { @@ -369,7 +370,7 @@ if (file->f_mode & FMODE_READ) dev.rec_channels = data; - if (put_user(val, (int *)arg)) + if (put_user(val, p)) return -EFAULT; return 0; } @@ -565,13 +566,13 @@ mixer_info info; set_mixer_info(); info.modify_counter = dev.mixer_mod_count; - if (copy_to_user((void *)arg, &info, sizeof(info))) + if (copy_to_user((void __user *)arg, &info, sizeof(info))) return -EFAULT; return 0; } else if (cmd == SOUND_OLD_MIXER_INFO) { _old_mixer_info info; set_mixer_info(); - if (copy_to_user((void *)arg, &info, sizeof(info))) + if (copy_to_user((void __user *)arg, &info, sizeof(info))) return -EFAULT; return 0; } else if (cmd == SOUND_MIXER_PRIVATE1) { @@ -584,19 +585,19 @@ if (_SIOC_DIR(cmd) & _SIOC_WRITE) { switch (cmd & 0xff) { case SOUND_MIXER_RECSRC: - if (get_user(val, (int *)arg)) + if (get_user(val, (int __user *)arg)) return -EFAULT; val = set_recsrc(val); break; default: - if (get_user(val, (int *)arg)) + if (get_user(val, (int __user *)arg)) return -EFAULT; val = mixer_set(cmd & 0xff, val); break; } ++dev.mixer_mod_count; - return put_user(val, (int *)arg); + return put_user(val, (int __user *)arg); } else { switch (cmd & 0xff) { case SOUND_MIXER_RECSRC: @@ -638,7 +639,7 @@ } } - return put_user(val, (int *)arg); + return put_user(val, (int __user *)arg); } return -EINVAL; @@ -650,7 +651,7 @@ if (cmd == OSS_GETVERSION) { int sound_version = SOUND_VERSION; - return put_user(sound_version, (int *)arg); + return put_user(sound_version, (int __user *)arg); } if (minor == dev.dsp_minor) @@ -809,7 +810,7 @@ static __inline__ int pack_DARQ_to_DARF(register int bank) { - register int size, n, timeout = 3; + register int size, timeout = 3; register WORD wTmp; LPDAQD DAQD; @@ -830,13 +831,10 @@ /* Read data from the head (unprotected bank 1 access okay since this is only called inside an interrupt) */ outb(HPBLKSEL_1, dev.io + HP_BLKS); - if ((n = msnd_fifo_write( + msnd_fifo_write( &dev.DARF, (char *)(dev.base + bank * DAR_BUFF_SIZE), - size, 0)) <= 0) { - outb(HPBLKSEL_0, dev.io + HP_BLKS); - return n; - } + size); outb(HPBLKSEL_0, dev.io + HP_BLKS); return 1; @@ -858,21 +856,16 @@ if (protect) { /* Critical section: protect fifo in non-interrupt */ spin_lock_irqsave(&dev.lock, flags); - if ((n = msnd_fifo_read( + n = msnd_fifo_read( &dev.DAPF, (char *)(dev.base + bank_num * DAP_BUFF_SIZE), - DAP_BUFF_SIZE, 0)) < 0) { - spin_unlock_irqrestore(&dev.lock, flags); - return n; - } + DAP_BUFF_SIZE); spin_unlock_irqrestore(&dev.lock, flags); } else { - if ((n = msnd_fifo_read( + n = msnd_fifo_read( &dev.DAPF, (char *)(dev.base + bank_num * DAP_BUFF_SIZE), - DAP_BUFF_SIZE, 0)) < 0) { - return n; - } + DAP_BUFF_SIZE); } if (!n) break; @@ -896,33 +889,46 @@ return nbanks; } -static int dsp_read(char *buf, size_t len) +static int dsp_read(char __user *buf, size_t len) { int count = len; + char *page = (char *)__get_free_page(PAGE_SIZE); + + if (!page) + return -ENOMEM; while (count > 0) { - int n; + int n, k; unsigned long flags; + k = PAGE_SIZE; + if (k > count) + k = count; + /* Critical section: protect fifo in non-interrupt */ spin_lock_irqsave(&dev.lock, flags); - if ((n = msnd_fifo_read(&dev.DARF, buf, count, 1)) < 0) { - printk(KERN_WARNING LOGNAME ": FIFO read error\n"); - spin_unlock_irqrestore(&dev.lock, flags); - return n; - } + n = msnd_fifo_read(&dev.DARF, page, k); spin_unlock_irqrestore(&dev.lock, flags); + if (copy_to_user(buf, page, n)) { + free_page((unsigned long)page); + return -EFAULT; + } buf += n; count -= n; + if (n == k && count) + continue; + if (!test_bit(F_READING, &dev.flags) && dev.mode & FMODE_READ) { dev.last_recbank = -1; if (chk_send_dsp_cmd(&dev, HDEX_RECORD_START) == 0) set_bit(F_READING, &dev.flags); } - if (dev.rec_ndelay) + if (dev.rec_ndelay) { + free_page((unsigned long)page); return count == len ? -EAGAIN : len - count; + } if (count > 0) { set_bit(F_READBLOCK, &dev.flags); @@ -931,41 +937,57 @@ get_rec_delay_jiffies(DAR_BUFF_SIZE))) clear_bit(F_READING, &dev.flags); clear_bit(F_READBLOCK, &dev.flags); - if (signal_pending(current)) + if (signal_pending(current)) { + free_page((unsigned long)page); return -EINTR; + } } } - + free_page((unsigned long)page); return len - count; } -static int dsp_write(const char *buf, size_t len) +static int dsp_write(const char __user *buf, size_t len) { int count = len; + char *page = (char *)__get_free_page(GFP_KERNEL); + + if (!page) + return -ENOMEM; while (count > 0) { - int n; + int n, k; unsigned long flags; + k = PAGE_SIZE; + if (k > count) + k = count; + + if (copy_from_user(page, buf, k)) { + free_page((unsigned long)page); + return -EFAULT; + } + /* Critical section: protect fifo in non-interrupt */ spin_lock_irqsave(&dev.lock, flags); - if ((n = msnd_fifo_write(&dev.DAPF, buf, count, 1)) < 0) { - printk(KERN_WARNING LOGNAME ": FIFO write error\n"); - spin_unlock_irqrestore(&dev.lock, flags); - return n; - } + n = msnd_fifo_write(&dev.DAPF, page, k); spin_unlock_irqrestore(&dev.lock, flags); buf += n; count -= n; + if (count && n == k) + continue; + if (!test_bit(F_WRITING, &dev.flags) && (dev.mode & FMODE_WRITE)) { dev.last_playbank = -1; if (pack_DAPF_to_DAPQ(1) > 0) set_bit(F_WRITING, &dev.flags); } - if (dev.play_ndelay) + if (dev.play_ndelay) { + free_page((unsigned long)page); return count == len ? -EAGAIN : len - count; + } if (count > 0) { set_bit(F_WRITEBLOCK, &dev.flags); @@ -973,15 +995,18 @@ &dev.writeblock, get_play_delay_jiffies(DAP_BUFF_SIZE)); clear_bit(F_WRITEBLOCK, &dev.flags); - if (signal_pending(current)) + if (signal_pending(current)) { + free_page((unsigned long)page); return -EINTR; + } } } + free_page((unsigned long)page); return len - count; } -static ssize_t dev_read(struct file *file, char *buf, size_t count, loff_t *off) +static ssize_t dev_read(struct file *file, char __user *buf, size_t count, loff_t *off) { int minor = iminor(file->f_dentry->d_inode); if (minor == dev.dsp_minor) @@ -990,7 +1015,7 @@ return -EINVAL; } -static ssize_t dev_write(struct file *file, const char *buf, size_t count, loff_t *off) +static ssize_t dev_write(struct file *file, const char __user *buf, size_t count, loff_t *off) { int minor = iminor(file->f_dentry->d_inode); if (minor == dev.dsp_minor) diff -urN linux-2.6.7-rc2/sound/oss/opl3.c linux-2.6.7-rc3/sound/oss/opl3.c --- linux-2.6.7-rc2/sound/oss/opl3.c 2004-06-07 12:54:55.303303337 -0700 +++ linux-2.6.7-rc3/sound/oss/opl3.c 2004-06-07 12:55:31.302794407 -0700 @@ -822,7 +822,7 @@ { } -static int opl3_load_patch(int dev, int format, const char *addr, +static int opl3_load_patch(int dev, int format, const char __user *addr, int offs, int count, int pmgr_flag) { struct sbi_instrument ins; @@ -833,7 +833,11 @@ return -EINVAL; } - if(copy_from_user(&((char *) &ins)[offs], &(addr)[offs], sizeof(ins) - offs)) + /* + * What the fuck is going on here? We leave junk in the beginning + * of ins and then check the field pretty close to that beginning? + */ + if(copy_from_user(&((char *) &ins)[offs], addr + offs, sizeof(ins) - offs)) return -EFAULT; if (ins.channel < 0 || ins.channel >= SBFM_MAXINSTR) diff -urN linux-2.6.7-rc2/sound/oss/rme96xx.c linux-2.6.7-rc3/sound/oss/rme96xx.c --- linux-2.6.7-rc2/sound/oss/rme96xx.c 2004-05-09 19:32:28.000000000 -0700 +++ linux-2.6.7-rc3/sound/oss/rme96xx.c 2004-06-07 12:55:31.322795235 -0700 @@ -661,13 +661,13 @@ } -inline int rme96xx_copyfromuser(struct dmabuf* dma,const char* buffer,int count,int hop) +inline int rme96xx_copyfromuser(struct dmabuf* dma,const char __user * buffer,int count,int hop) { int swptr = dma->writeptr; switch (dma->format) { case AFMT_S32_BLOCKED: { - char* buf = (char*)buffer; + char __user * buf = (char __user *)buffer; int cnt = count/dma->outchannels; int i; for (i=0;i < dma->outchannels;i++) { @@ -686,7 +686,7 @@ int i,j; int cnt = count/dma->outchannels; for (i=0;i < dma->outchannels + dma->mono;i++) { - short* sbuf = (short*)buffer + i*(!dma->mono); + short __user * sbuf = (short __user *)buffer + i*(!dma->mono); short* hwbuf =(short*) &dma->s->playbuf[(dma->outoffset + i)*RME96xx_DMA_MAX_SAMPLES]; hwbuf+=(swptr>>1); for (j=0;j<(cnt>>1);j++) { @@ -710,13 +710,13 @@ } /* The count argument is the number of bytes */ -inline int rme96xx_copytouser(struct dmabuf* dma,const char* buffer,int count,int hop) +inline int rme96xx_copytouser(struct dmabuf* dma,const char __user* buffer,int count,int hop) { int swptr = dma->readptr; switch (dma->format) { case AFMT_S32_BLOCKED: { - char* buf = (char*)buffer; + char __user * buf = (char __user *)buffer; int cnt = count/dma->inchannels; int i; @@ -736,7 +736,7 @@ int i,j; int cnt = count/dma->inchannels; for (i=0;i < dma->inchannels;i++) { - short* sbuf = (short*)buffer + i; + short __user * sbuf = (short __user *)buffer + i; short* hwbuf =(short*) &dma->s->recbuf[(dma->inoffset + i)*RME96xx_DMA_MAX_SAMPLES]; hwbuf+=(swptr>>1); for (j=0;j<(cnt>>1);j++) { @@ -1121,7 +1121,6 @@ static int rme96xx_ioctl(struct inode *in, struct file *file, unsigned int cmd, unsigned long arg) { - struct dmabuf * dma = (struct dmabuf *)file->private_data; rme96xx_info *s = dma->s; unsigned long flags; @@ -1129,6 +1128,8 @@ count_info cinfo; int count; int val = 0; + void __user *argp = (void __user *)arg; + int __user *p = argp; VALIDATE_STATE(s); @@ -1136,7 +1137,7 @@ switch (cmd) { case OSS_GETVERSION: - return put_user(SOUND_VERSION, (int *)arg); + return put_user(SOUND_VERSION, p); case SNDCTL_DSP_SYNC: #if 0 @@ -1149,14 +1150,14 @@ return 0; case SNDCTL_DSP_GETCAPS: - return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, (int *)arg); + return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, p); case SNDCTL_DSP_RESET: // rme96xx_clearbufs(dma); return 0; case SNDCTL_DSP_SPEED: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val >= 0) { /* generally it's not a problem if we change the speed @@ -1195,10 +1196,10 @@ spin_unlock_irqrestore(&s->lock, flags); } DBG(printk("speed set to %d\n",val)); - return put_user(val, (int *)arg); + return put_user(val, p); case SNDCTL_DSP_STEREO: /* this plays a mono file on two channels */ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (!val) { @@ -1216,7 +1217,7 @@ return 0; case SNDCTL_DSP_CHANNELS: /* remember to check for resonable offset/channel pairs here */ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (file->f_mode & FMODE_WRITE) { @@ -1236,14 +1237,14 @@ dma->mono=0; - return put_user(val, (int *)arg); + return put_user(val, p); case SNDCTL_DSP_GETFMTS: /* Returns a mask */ - return put_user(RME96xx_FMT, (int *)arg); + return put_user(RME96xx_FMT, p); case SNDCTL_DSP_SETFMT: /* Selects ONE fmt*/ DBG(printk("setting to format %x\n",val)); - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != AFMT_QUERY) { if (val & RME96xx_FMT) @@ -1257,7 +1258,7 @@ break; } } - return put_user(dma->format, (int *)arg); + return put_user(dma->format, p); case SNDCTL_DSP_POST: return 0; @@ -1270,10 +1271,10 @@ if (file->f_mode & FMODE_WRITE && s->ctrl & CTRL_DAC2_EN) val |= PCM_ENABLE_OUTPUT; #endif - return put_user(val, (int *)arg); + return put_user(val, p); case SNDCTL_DSP_SETTRIGGER: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; #if 0 if (file->f_mode & FMODE_READ) { @@ -1309,7 +1310,7 @@ abinfo.fragstotal = 2; abinfo.fragments = (count > s->fragsize); - return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_GETISPACE: if (!(file->f_mode & FMODE_READ)) @@ -1323,7 +1324,7 @@ abinfo.bytes = (count*dma->inchannels)>>dma->formatshift; abinfo.fragstotal = 2; abinfo.fragments = count > s->fragsize; - return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_NONBLOCK: file->f_flags |= O_NONBLOCK; @@ -1339,7 +1340,7 @@ if (count < 0) count += s->fragsize<<1; - return put_user(count, (int *)arg); + return put_user(count, p); /* check out how to use mmaped mode (can only be blocked !!!) */ @@ -1359,7 +1360,7 @@ dma->readptr &= s->fragsize<<1; spin_unlock_irqrestore(&s->lock,flags); - if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) + if (copy_to_user(argp, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; @@ -1378,14 +1379,14 @@ if (dma->mmapped) dma->writeptr &= s->fragsize<<1; spin_unlock_irqrestore(&s->lock,flags); - if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) + if (copy_to_user(argp, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; case SNDCTL_DSP_GETBLKSIZE: - return put_user(s->fragsize, (int *)arg); + return put_user(s->fragsize, p); case SNDCTL_DSP_SETFRAGMENT: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; val&=0xffff; val -= 7; @@ -1399,7 +1400,7 @@ if ((file->f_mode & FMODE_READ && s->dma_adc.subdivision) || (file->f_mode & FMODE_WRITE && s->dma_dac2.subdivision)) return -EINVAL; - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != 1 && val != 2 && val != 4) return -EINVAL; @@ -1413,10 +1414,10 @@ case SOUND_PCM_READ_RATE: /* HP20020201 */ s->rate = rme96xx_get_sample_rate_status(s); - return put_user(s->rate, (int *)arg); + return put_user(s->rate, p); case SOUND_PCM_READ_CHANNELS: - return put_user(dma->outchannels, (int *)arg); + return put_user(dma->outchannels, p); case SOUND_PCM_READ_BITS: switch (dma->format) { @@ -1427,7 +1428,7 @@ val = 16; break; } - return put_user(val, (int *)arg); + return put_user(val, p); case SOUND_PCM_WRITE_FILTER: case SNDCTL_DSP_SETSYNCRO: @@ -1529,7 +1530,7 @@ } -static ssize_t rme96xx_write(struct file *file, const char *buffer, size_t count, loff_t *ppos) +static ssize_t rme96xx_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { struct dmabuf *dma = (struct dmabuf *)file->private_data; ssize_t ret = 0; @@ -1597,7 +1598,7 @@ return ret; } -static ssize_t rme96xx_read(struct file *file, char *buffer, size_t count, loff_t *ppos) +static ssize_t rme96xx_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) { struct dmabuf *dma = (struct dmabuf *)file->private_data; ssize_t ret = 0; @@ -1793,6 +1794,8 @@ rme96xx_info *s = (rme96xx_info *)file->private_data; u32 status; int spdifrate; + void __user *argp = (void __user *)arg; + int __user *p = argp; status = readl(s->iobase + RME96xx_status_register); /* hack to convert rev 1.5 SPDIF rate to "crystalrate" format HP 20020201 */ @@ -1802,7 +1805,7 @@ VALIDATE_STATE(s); if (cmd == SOUND_MIXER_PRIVATE1) { rme_mixer mixer; - if (copy_from_user(&mixer,(void*)arg,sizeof(mixer))) + if (copy_from_user(&mixer,argp,sizeof(mixer))) return -EFAULT; mixer.devnr &= RME96xx_MASK_DEVS; @@ -1825,14 +1828,14 @@ mixer.o_offset = s->dma[mixer.devnr].outoffset; mixer.i_offset = s->dma[mixer.devnr].inoffset; - return copy_to_user((void *)arg, &mixer, sizeof(mixer)) ? -EFAULT : 0; + return copy_to_user(argp, &mixer, sizeof(mixer)) ? -EFAULT : 0; } if (cmd == SOUND_MIXER_PRIVATE2) { - return put_user(status, (int *)arg); + return put_user(status, p); } if (cmd == SOUND_MIXER_PRIVATE3) { u32 control; - if (copy_from_user(&control,(void*)arg,sizeof(control))) + if (copy_from_user(&control,argp,sizeof(control))) return -EFAULT; if (file->f_mode & FMODE_WRITE) { s->control_register &= ~RME96xx_mixer_allowed; @@ -1840,7 +1843,7 @@ writel(control,s->iobase + RME96xx_control_register); } - return put_user(s->control_register, (int *)arg); + return put_user(s->control_register, p); } return -1; } diff -urN linux-2.6.7-rc2/sound/oss/sb_audio.c linux-2.6.7-rc3/sound/oss/sb_audio.c --- linux-2.6.7-rc2/sound/oss/sb_audio.c 2004-05-09 19:33:13.000000000 -0700 +++ linux-2.6.7-rc3/sound/oss/sb_audio.c 2004-06-07 12:55:31.323795277 -0700 @@ -836,7 +836,7 @@ static void sb16_copy_from_user(int dev, char *localbuf, int localoffs, - const char *userbuf, int useroffs, + const char __user *userbuf, int useroffs, int max_in, int max_out, int *used, int *returned, int len) diff -urN linux-2.6.7-rc2/sound/oss/sb_common.c linux-2.6.7-rc3/sound/oss/sb_common.c --- linux-2.6.7-rc2/sound/oss/sb_common.c 2004-05-09 19:31:59.000000000 -0700 +++ linux-2.6.7-rc3/sound/oss/sb_common.c 2004-06-07 12:55:31.328795484 -0700 @@ -943,7 +943,10 @@ { unsigned long flags; - if (devc->model == MDL_ESS) return ess_setmixer (devc, port, value); + if (devc->model == MDL_ESS) { + ess_setmixer (devc, port, value); + return; + } spin_lock_irqsave(&devc->lock, flags); diff -urN linux-2.6.7-rc2/sound/oss/sonicvibes.c linux-2.6.7-rc3/sound/oss/sonicvibes.c --- linux-2.6.7-rc2/sound/oss/sonicvibes.c 2004-05-09 19:32:29.000000000 -0700 +++ linux-2.6.7-rc3/sound/oss/sonicvibes.c 2004-06-07 12:55:31.361796851 -0700 @@ -1042,6 +1042,7 @@ unsigned long flags; int i, val; unsigned char l, r, rl, rr; + int __user *p = (int __user *)arg; VALIDATE_STATE(s); if (cmd == SOUND_MIXER_INFO) { @@ -1050,7 +1051,7 @@ strlcpy(info.id, "SonicVibes", sizeof(info.id)); strlcpy(info.name, "S3 SonicVibes", sizeof(info.name)); info.modify_counter = s->mix.modcnt; - if (copy_to_user((void *)arg, &info, sizeof(info))) + if (copy_to_user((void __user *)arg, &info, sizeof(info))) return -EFAULT; return 0; } @@ -1059,14 +1060,14 @@ memset(&info, 0, sizeof(info)); strlcpy(info.id, "SonicVibes", sizeof(info.id)); strlcpy(info.name, "S3 SonicVibes", sizeof(info.name)); - if (copy_to_user((void *)arg, &info, sizeof(info))) + if (copy_to_user((void __user *)arg, &info, sizeof(info))) return -EFAULT; return 0; } if (cmd == OSS_GETVERSION) - return put_user(SOUND_VERSION, (int *)arg); + return put_user(SOUND_VERSION, p); if (cmd == SOUND_MIXER_PRIVATE1) { /* SRS settings */ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; spin_lock_irqsave(&s->lock, flags); if (val & 1) { @@ -1086,47 +1087,47 @@ r = rdindir(s, SV_CISRSCENTER); spin_unlock_irqrestore(&s->lock, flags); if (l & 0x80) - return put_user(0, (int *)arg); - return put_user(((4 - (l & 7)) << 2) | ((4 - (r & 7)) << 5) | 2, (int *)arg); + return put_user(0, p); + return put_user(((4 - (l & 7)) << 2) | ((4 - (r & 7)) << 5) | 2, p); } if (_IOC_TYPE(cmd) != 'M' || _SIOC_SIZE(cmd) != sizeof(int)) return -EINVAL; if (_SIOC_DIR(cmd) == _SIOC_READ) { switch (_IOC_NR(cmd)) { case SOUND_MIXER_RECSRC: /* Arg contains a bit for each recording source */ - return put_user(mixer_recmask(s), (int *)arg); + return put_user(mixer_recmask(s), p); case SOUND_MIXER_DEVMASK: /* Arg contains a bit for each supported device */ for (val = i = 0; i < SOUND_MIXER_NRDEVICES; i++) if (mixtable[i].type) val |= 1 << i; - return put_user(val, (int *)arg); + return put_user(val, p); case SOUND_MIXER_RECMASK: /* Arg contains a bit for each supported recording source */ for (val = i = 0; i < SOUND_MIXER_NRDEVICES; i++) if (mixtable[i].rec) val |= 1 << i; - return put_user(val, (int *)arg); + return put_user(val, p); case SOUND_MIXER_STEREODEVS: /* Mixer channels supporting stereo */ for (val = i = 0; i < SOUND_MIXER_NRDEVICES; i++) if (mixtable[i].type && mixtable[i].type != MT_4MUTEMONO) val |= 1 << i; - return put_user(val, (int *)arg); + return put_user(val, p); case SOUND_MIXER_CAPS: - return put_user(SOUND_CAP_EXCL_INPUT, (int *)arg); + return put_user(SOUND_CAP_EXCL_INPUT, p); default: i = _IOC_NR(cmd); if (i >= SOUND_MIXER_NRDEVICES || !mixtable[i].type) return -EINVAL; #ifdef OSS_DOCUMENTED_MIXER_SEMANTICS - return return_mixval(s, i, (int *)arg); + return return_mixval(s, i, p); #else /* OSS_DOCUMENTED_MIXER_SEMANTICS */ if (!volidx[i]) return -EINVAL; - return put_user(s->mix.vol[volidx[i]-1], (int *)arg); + return put_user(s->mix.vol[volidx[i]-1], p); #endif /* OSS_DOCUMENTED_MIXER_SEMANTICS */ } } @@ -1135,7 +1136,7 @@ s->mix.modcnt++; switch (_IOC_NR(cmd)) { case SOUND_MIXER_RECSRC: /* Arg contains a bit for each recording source */ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; i = hweight32(val); if (i == 0) @@ -1160,7 +1161,7 @@ i = _IOC_NR(cmd); if (i >= SOUND_MIXER_NRDEVICES || !mixtable[i].type) return -EINVAL; - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; l = val & 0xff; r = (val >> 8) & 0xff; @@ -1224,12 +1225,12 @@ } spin_unlock_irqrestore(&s->lock, flags); #ifdef OSS_DOCUMENTED_MIXER_SEMANTICS - return return_mixval(s, i, (int *)arg); + return return_mixval(s, i, p); #else /* OSS_DOCUMENTED_MIXER_SEMANTICS */ if (!volidx[i]) return -EINVAL; s->mix.vol[volidx[i]-1] = val; - return put_user(s->mix.vol[volidx[i]-1], (int *)arg); + return put_user(s->mix.vol[volidx[i]-1], p); #endif /* OSS_DOCUMENTED_MIXER_SEMANTICS */ } } @@ -1314,7 +1315,7 @@ /* --------------------------------------------------------------------- */ -static ssize_t sv_read(struct file *file, char *buffer, size_t count, loff_t *ppos) +static ssize_t sv_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) { struct sv_state *s = (struct sv_state *)file->private_data; DECLARE_WAITQUEUE(wait, current); @@ -1399,7 +1400,7 @@ return ret; } -static ssize_t sv_write(struct file *file, const char *buffer, size_t count, loff_t *ppos) +static ssize_t sv_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { struct sv_state *s = (struct sv_state *)file->private_data; DECLARE_WAITQUEUE(wait, current); @@ -1570,13 +1571,15 @@ int count; int val, mapped, ret; unsigned char fmtm, fmtd; + void __user *argp = (void __user *)arg; + int __user *p = argp; VALIDATE_STATE(s); mapped = ((file->f_mode & FMODE_WRITE) && s->dma_dac.mapped) || ((file->f_mode & FMODE_READ) && s->dma_adc.mapped); switch (cmd) { case OSS_GETVERSION: - return put_user(SOUND_VERSION, (int *)arg); + return put_user(SOUND_VERSION, p); case SNDCTL_DSP_SYNC: if (file->f_mode & FMODE_WRITE) @@ -1587,7 +1590,7 @@ return 0; case SNDCTL_DSP_GETCAPS: - return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, (int *)arg); + return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, p); case SNDCTL_DSP_RESET: if (file->f_mode & FMODE_WRITE) { @@ -1603,7 +1606,7 @@ return 0; case SNDCTL_DSP_SPEED: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val >= 0) { if (file->f_mode & FMODE_READ) { @@ -1617,10 +1620,10 @@ set_dac_rate(s, val); } } - return put_user((file->f_mode & FMODE_READ) ? s->rateadc : s->ratedac, (int *)arg); + return put_user((file->f_mode & FMODE_READ) ? s->rateadc : s->ratedac, p); case SNDCTL_DSP_STEREO: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; fmtd = 0; fmtm = ~0; @@ -1644,7 +1647,7 @@ return 0; case SNDCTL_DSP_CHANNELS: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != 0) { fmtd = 0; @@ -1668,13 +1671,13 @@ set_fmt(s, fmtm, fmtd); } return put_user((s->fmt & ((file->f_mode & FMODE_READ) ? (SV_CFMT_STEREO << SV_CFMT_CSHIFT) - : (SV_CFMT_STEREO << SV_CFMT_ASHIFT))) ? 2 : 1, (int *)arg); + : (SV_CFMT_STEREO << SV_CFMT_ASHIFT))) ? 2 : 1, p); case SNDCTL_DSP_GETFMTS: /* Returns a mask */ - return put_user(AFMT_S16_LE|AFMT_U8, (int *)arg); + return put_user(AFMT_S16_LE|AFMT_U8, p); case SNDCTL_DSP_SETFMT: /* Selects ONE fmt*/ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != AFMT_QUERY) { fmtd = 0; @@ -1698,7 +1701,7 @@ set_fmt(s, fmtm, fmtd); } return put_user((s->fmt & ((file->f_mode & FMODE_READ) ? (SV_CFMT_16BIT << SV_CFMT_CSHIFT) - : (SV_CFMT_16BIT << SV_CFMT_ASHIFT))) ? AFMT_S16_LE : AFMT_U8, (int *)arg); + : (SV_CFMT_16BIT << SV_CFMT_ASHIFT))) ? AFMT_S16_LE : AFMT_U8, p); case SNDCTL_DSP_POST: return 0; @@ -1709,10 +1712,10 @@ val |= PCM_ENABLE_INPUT; if (file->f_mode & FMODE_WRITE && s->enable & SV_CENABLE_PE) val |= PCM_ENABLE_OUTPUT; - return put_user(val, (int *)arg); + return put_user(val, p); case SNDCTL_DSP_SETTRIGGER: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (file->f_mode & FMODE_READ) { if (val & PCM_ENABLE_INPUT) { @@ -1753,7 +1756,7 @@ abinfo.fragstotal = s->dma_dac.numfrag; abinfo.fragments = abinfo.bytes >> s->dma_dac.fragshift; spin_unlock_irqrestore(&s->lock, flags); - return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_GETISPACE: if (!(file->f_mode & FMODE_READ)) @@ -1770,7 +1773,7 @@ abinfo.fragstotal = s->dma_adc.numfrag; abinfo.fragments = abinfo.bytes >> s->dma_adc.fragshift; spin_unlock_irqrestore(&s->lock, flags); - return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_NONBLOCK: file->f_flags |= O_NONBLOCK; @@ -1787,7 +1790,7 @@ spin_unlock_irqrestore(&s->lock, flags); if (count < 0) count = 0; - return put_user(count, (int *)arg); + return put_user(count, p); case SNDCTL_DSP_GETIPTR: if (!(file->f_mode & FMODE_READ)) @@ -1805,7 +1808,7 @@ if (s->dma_adc.mapped) s->dma_adc.count &= s->dma_adc.fragsize-1; spin_unlock_irqrestore(&s->lock, flags); - if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) + if (copy_to_user(argp, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; @@ -1825,7 +1828,7 @@ if (s->dma_dac.mapped) s->dma_dac.count &= s->dma_dac.fragsize-1; spin_unlock_irqrestore(&s->lock, flags); - if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) + if (copy_to_user(argp, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; @@ -1833,14 +1836,14 @@ if (file->f_mode & FMODE_WRITE) { if ((val = prog_dmabuf(s, 0))) return val; - return put_user(s->dma_dac.fragsize, (int *)arg); + return put_user(s->dma_dac.fragsize, p); } if ((val = prog_dmabuf(s, 1))) return val; - return put_user(s->dma_adc.fragsize, (int *)arg); + return put_user(s->dma_adc.fragsize, p); case SNDCTL_DSP_SETFRAGMENT: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (file->f_mode & FMODE_READ) { s->dma_adc.ossfragshift = val & 0xffff; @@ -1868,7 +1871,7 @@ if ((file->f_mode & FMODE_READ && s->dma_adc.subdivision) || (file->f_mode & FMODE_WRITE && s->dma_dac.subdivision)) return -EINVAL; - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != 1 && val != 2 && val != 4) return -EINVAL; @@ -1879,15 +1882,15 @@ return 0; case SOUND_PCM_READ_RATE: - return put_user((file->f_mode & FMODE_READ) ? s->rateadc : s->ratedac, (int *)arg); + return put_user((file->f_mode & FMODE_READ) ? s->rateadc : s->ratedac, p); case SOUND_PCM_READ_CHANNELS: return put_user((s->fmt & ((file->f_mode & FMODE_READ) ? (SV_CFMT_STEREO << SV_CFMT_CSHIFT) - : (SV_CFMT_STEREO << SV_CFMT_ASHIFT))) ? 2 : 1, (int *)arg); + : (SV_CFMT_STEREO << SV_CFMT_ASHIFT))) ? 2 : 1, p); case SOUND_PCM_READ_BITS: return put_user((s->fmt & ((file->f_mode & FMODE_READ) ? (SV_CFMT_16BIT << SV_CFMT_CSHIFT) - : (SV_CFMT_16BIT << SV_CFMT_ASHIFT))) ? 16 : 8, (int *)arg); + : (SV_CFMT_16BIT << SV_CFMT_ASHIFT))) ? 16 : 8, p); case SOUND_PCM_WRITE_FILTER: case SNDCTL_DSP_SETSYNCRO: @@ -1992,7 +1995,7 @@ /* --------------------------------------------------------------------- */ -static ssize_t sv_midi_read(struct file *file, char *buffer, size_t count, loff_t *ppos) +static ssize_t sv_midi_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) { struct sv_state *s = (struct sv_state *)file->private_data; DECLARE_WAITQUEUE(wait, current); @@ -2055,7 +2058,7 @@ return ret; } -static ssize_t sv_midi_write(struct file *file, const char *buffer, size_t count, loff_t *ppos) +static ssize_t sv_midi_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { struct sv_state *s = (struct sv_state *)file->private_data; DECLARE_WAITQUEUE(wait, current); @@ -2297,7 +2300,7 @@ return 0; case FM_IOCTL_PLAY_NOTE: - if (copy_from_user(&n, (void *)arg, sizeof(n))) + if (copy_from_user(&n, (void __user *)arg, sizeof(n))) return -EFAULT; if (n.voice >= 18) return -EINVAL; @@ -2315,7 +2318,7 @@ return 0; case FM_IOCTL_SET_VOICE: - if (copy_from_user(&v, (void *)arg, sizeof(v))) + if (copy_from_user(&v, (void __user *)arg, sizeof(v))) return -EFAULT; if (v.voice >= 18) return -EINVAL; @@ -2345,7 +2348,7 @@ return 0; case FM_IOCTL_SET_PARAMS: - if (copy_from_user(&p, (void *)arg, sizeof(p))) + if (copy_from_user(&p, (void *__user )arg, sizeof(p))) return -EFAULT; outb(0x08, s->iosynth); outb((p.kbd_split & 1) << 6, s->iosynth+1); diff -urN linux-2.6.7-rc2/sound/oss/trident.c linux-2.6.7-rc3/sound/oss/trident.c --- linux-2.6.7-rc2/sound/oss/trident.c 2004-06-07 12:54:55.360305697 -0700 +++ linux-2.6.7-rc3/sound/oss/trident.c 2004-06-07 12:55:31.392798135 -0700 @@ -497,7 +497,8 @@ static void ali_disable_spdif_in(struct trident_card *card); static void ali_disable_special_channel(struct trident_card *card, int ch); static void ali_setup_spdif_out(struct trident_card *card, int flag); -static int ali_write_5_1(struct trident_state *state, const char *buffer, +static int ali_write_5_1(struct trident_state *state, + const char __user *buffer, int cnt_for_multi_channel, unsigned int *copy_count, unsigned int *state_cnt); static int ali_allocate_other_states_resources(struct trident_state *state, @@ -1861,7 +1862,7 @@ /* to be copied to the user's buffer. it is filled by the dma machine and */ /* drained by this loop. */ static ssize_t -trident_read(struct file *file, char *buffer, size_t count, loff_t * ppos) +trident_read(struct file *file, char __user *buffer, size_t count, loff_t * ppos) { struct trident_state *state = (struct trident_state *)file->private_data; struct dmabuf *dmabuf = &state->dmabuf; @@ -1976,7 +1977,7 @@ the soundcard. it is drained by the dma machine and filled by this loop. */ static ssize_t -trident_write(struct file *file, const char *buffer, size_t count, loff_t * ppos) +trident_write(struct file *file, const char __user *buffer, size_t count, loff_t * ppos) { struct trident_state *state = (struct trident_state *)file->private_data; struct dmabuf *dmabuf = &state->dmabuf; @@ -2247,8 +2248,9 @@ audio_buf_info abinfo; count_info cinfo; int val, mapped, ret = 0; - struct trident_card *card = state->card; + void __user *argp = (void __user *)arg; + int __user *p = argp; VALIDATE_STATE(state); @@ -2256,11 +2258,11 @@ mapped = ((file->f_mode & (FMODE_WRITE | FMODE_READ)) && dmabuf->mapped); pr_debug("trident: trident_ioctl, command = %2d, arg = 0x%08x\n", - _IOC_NR(cmd), arg ? *(int *) arg : 0); + _IOC_NR(cmd), arg ? *p : 0); switch (cmd) { case OSS_GETVERSION: - ret = put_user(SOUND_VERSION, (int *) arg); + ret = put_user(SOUND_VERSION, p); break; case SNDCTL_DSP_RESET: @@ -2287,7 +2289,7 @@ break; case SNDCTL_DSP_SPEED: /* set smaple rate */ - if (get_user(val, (int *) arg)) { + if (get_user(val, p)) { ret = -EFAULT; break; } @@ -2307,11 +2309,11 @@ spin_unlock_irqrestore(&state->card->lock, flags); } } - ret = put_user(dmabuf->rate, (int *) arg); + ret = put_user(dmabuf->rate, p); break; case SNDCTL_DSP_STEREO: /* set stereo or mono channel */ - if (get_user(val, (int *) arg)) { + if (get_user(val, p)) { ret = -EFAULT; break; } @@ -2342,14 +2344,14 @@ if ((val = prog_dmabuf_playback(state))) ret = val; else - ret = put_user(dmabuf->fragsize, (int *) arg); + ret = put_user(dmabuf->fragsize, p); break; } if (file->f_mode & FMODE_READ) { if ((val = prog_dmabuf_record(state))) ret = val; else - ret = put_user(dmabuf->fragsize, (int *) arg); + ret = put_user(dmabuf->fragsize, p); break; } /* neither READ nor WRITE? is this even possible? */ @@ -2359,11 +2361,11 @@ case SNDCTL_DSP_GETFMTS: /* Returns a mask of supported sample format */ ret = put_user(AFMT_S16_LE | AFMT_U16_LE | AFMT_S8 | - AFMT_U8, (int *) arg); + AFMT_U8, p); break; case SNDCTL_DSP_SETFMT: /* Select sample format */ - if (get_user(val, (int *) arg)) { + if (get_user(val, p)) { ret = -EFAULT; break; } @@ -2390,11 +2392,11 @@ } unlock_set_fmt(state); ret = put_user((dmabuf->fmt & TRIDENT_FMT_16BIT) ? AFMT_S16_LE : - AFMT_U8, (int *) arg); + AFMT_U8, p); break; case SNDCTL_DSP_CHANNELS: - if (get_user(val, (int *) arg)) { + if (get_user(val, p)) { ret = -EFAULT; break; } @@ -2458,7 +2460,7 @@ } unlock_set_fmt(state); } - ret = put_user(val, (int *) arg); + ret = put_user(val, p); break; case SNDCTL_DSP_POST: @@ -2470,7 +2472,7 @@ ret = -EINVAL; break; } - if (get_user(val, (int *) arg)) { + if (get_user(val, p)) { ret = -EFAULT; break; } @@ -2482,7 +2484,7 @@ break; case SNDCTL_DSP_SETFRAGMENT: - if (get_user(val, (int *) arg)) { + if (get_user(val, p)) { ret = -EFAULT; break; } @@ -2514,7 +2516,7 @@ abinfo.fragstotal = dmabuf->numfrag; abinfo.fragments = abinfo.bytes >> dmabuf->fragshift; spin_unlock_irqrestore(&state->card->lock, flags); - ret = copy_to_user((void *) arg, &abinfo, sizeof (abinfo)) ? + ret = copy_to_user(argp, &abinfo, sizeof (abinfo)) ? -EFAULT : 0; break; @@ -2534,7 +2536,7 @@ abinfo.fragstotal = dmabuf->numfrag; abinfo.fragments = abinfo.bytes >> dmabuf->fragshift; spin_unlock_irqrestore(&state->card->lock, flags); - ret = copy_to_user((void *) arg, &abinfo, sizeof (abinfo)) ? + ret = copy_to_user(argp, &abinfo, sizeof (abinfo)) ? -EFAULT : 0; break; @@ -2544,7 +2546,7 @@ case SNDCTL_DSP_GETCAPS: ret = put_user(DSP_CAP_REALTIME | DSP_CAP_TRIGGER | - DSP_CAP_MMAP | DSP_CAP_BIND, (int *) arg); + DSP_CAP_MMAP | DSP_CAP_BIND, p); break; case SNDCTL_DSP_GETTRIGGER: @@ -2553,11 +2555,11 @@ val |= PCM_ENABLE_INPUT; if ((file->f_mode & FMODE_WRITE) && dmabuf->enable) val |= PCM_ENABLE_OUTPUT; - ret = put_user(val, (int *) arg); + ret = put_user(val, p); break; case SNDCTL_DSP_SETTRIGGER: - if (get_user(val, (int *) arg)) { + if (get_user(val, p)) { ret = -EFAULT; break; } @@ -2599,7 +2601,7 @@ if (dmabuf->mapped) dmabuf->count &= dmabuf->fragsize - 1; spin_unlock_irqrestore(&state->card->lock, flags); - ret = copy_to_user((void *) arg, &cinfo, sizeof (cinfo)) ? + ret = copy_to_user(argp, &cinfo, sizeof (cinfo)) ? -EFAULT : 0; break; @@ -2622,7 +2624,7 @@ if (dmabuf->mapped) dmabuf->count &= dmabuf->fragsize - 1; spin_unlock_irqrestore(&state->card->lock, flags); - ret = copy_to_user((void *) arg, &cinfo, sizeof (cinfo)) ? + ret = copy_to_user(argp, &cinfo, sizeof (cinfo)) ? -EFAULT : 0; break; @@ -2643,26 +2645,26 @@ trident_update_ptr(state); val = dmabuf->count; spin_unlock_irqrestore(&state->card->lock, flags); - ret = put_user(val, (int *) arg); + ret = put_user(val, p); break; case SOUND_PCM_READ_RATE: - ret = put_user(dmabuf->rate, (int *) arg); + ret = put_user(dmabuf->rate, p); break; case SOUND_PCM_READ_CHANNELS: ret = put_user((dmabuf->fmt & TRIDENT_FMT_STEREO) ? 2 : 1, - (int *) arg); + p); break; case SOUND_PCM_READ_BITS: ret = put_user((dmabuf->fmt & TRIDENT_FMT_16BIT) ? AFMT_S16_LE : - AFMT_U8, (int *) arg); + AFMT_U8, p); break; case SNDCTL_DSP_GETCHANNELMASK: ret = put_user(DSP_BIND_FRONT | DSP_BIND_SURR | - DSP_BIND_CENTER_LFE, (int *) arg); + DSP_BIND_CENTER_LFE, p); break; case SNDCTL_DSP_BIND_CHANNEL: @@ -2671,7 +2673,7 @@ break; } - if (get_user(val, (int *) arg)) { + if (get_user(val, p)) { ret = -EFAULT; break; } @@ -2688,7 +2690,7 @@ SRC_ENABLE); dmabuf->channel->attribute |= mask2attr[ffs(val)]; } - ret = put_user(val, (int *) arg); + ret = put_user(val, p); break; case SNDCTL_DSP_MAPINBUF: @@ -3878,14 +3880,14 @@ state DMA is protected by a spinlock. */ static int -ali_write_5_1(struct trident_state *state, const char *buf, +ali_write_5_1(struct trident_state *state, const char __user *buf, int cnt_for_multi_channel, unsigned int *copy_count, unsigned int *state_cnt) { struct dmabuf *dmabuf = &state->dmabuf; struct dmabuf *dmabuf_temp; - const char *buffer = buf; + const char __user *buffer = buf; unsigned swptr, other_dma_nums, sample_s; unsigned int i, loop; @@ -4018,7 +4020,7 @@ struct proc_dir_entry *res; static int -ali_write_proc(struct file *file, const char *buffer, unsigned long count, void *data) +ali_write_proc(struct file *file, const char __user *buffer, unsigned long count, void *data) { struct trident_card *card = (struct trident_card *) data; unsigned long flags; diff -urN linux-2.6.7-rc2/sound/oss/wavfront.c linux-2.6.7-rc3/sound/oss/wavfront.c --- linux-2.6.7-rc2/sound/oss/wavfront.c 2004-06-07 12:54:55.384306691 -0700 +++ linux-2.6.7-rc3/sound/oss/wavfront.c 2004-06-07 12:55:31.406798715 -0700 @@ -1011,7 +1011,7 @@ UINT16 sample_short; UINT32 length; - UINT16 *data_end = 0; + UINT16 __user *data_end = 0; unsigned int i; const int max_blksize = 4096/2; unsigned int written; @@ -1024,11 +1024,11 @@ int initial_skip = 0; DPRINT (WF_DEBUG_LOAD_PATCH, "sample %sdownload for slot %d, " - "type %d, %d bytes from 0x%x\n", + "type %d, %d bytes from %p\n", header->size ? "" : "header ", header->number, header->subkey, header->size, - (int) header->dataptr); + header->dataptr); if (header->number == WAVEFRONT_FIND_FREE_SAMPLE_SLOT) { int x; @@ -1688,8 +1688,7 @@ case WF_ST_MULTISAMPLE: - if (copy_from_user((unsigned char *) &header.hdr.s, - (unsigned char *) header.hdrptr, + if (copy_from_user(&header.hdr.s, header.hdrptr, sizeof(wavefront_multisample))) return -EFAULT; @@ -1698,32 +1697,28 @@ case WF_ST_ALIAS: - if (copy_from_user((unsigned char *) &header.hdr.a, - (unsigned char *) header.hdrptr, + if (copy_from_user(&header.hdr.a, header.hdrptr, sizeof (wavefront_alias))) return -EFAULT; return wavefront_send_alias (&header); case WF_ST_DRUM: - if (copy_from_user((unsigned char *) &header.hdr.d, - (unsigned char *) header.hdrptr, + if (copy_from_user(&header.hdr.d, header.hdrptr, sizeof (wavefront_drum))) return -EFAULT; return wavefront_send_drum (&header); case WF_ST_PATCH: - if (copy_from_user((unsigned char *) &header.hdr.p, - (unsigned char *) header.hdrptr, + if (copy_from_user(&header.hdr.p, header.hdrptr, sizeof (wavefront_patch))) return -EFAULT; return wavefront_send_patch (&header); case WF_ST_PROGRAM: - if (copy_from_user((unsigned char *) &header.hdr.pr, - (unsigned char *) header.hdrptr, + if (copy_from_user(&header.hdr.pr, header.hdrptr, sizeof (wavefront_program))) return -EFAULT; @@ -3002,7 +2997,7 @@ return -(EINVAL); } if (copy_from_user(page_data, - (unsigned char *)r->data[3], + (unsigned char __user *)r->data[3], r->data[2])) return -EFAULT; pd = page_data; diff -urN linux-2.6.7-rc2/sound/oss/ymfpci.c linux-2.6.7-rc3/sound/oss/ymfpci.c --- linux-2.6.7-rc2/sound/oss/ymfpci.c 2004-05-09 19:32:52.000000000 -0700 +++ linux-2.6.7-rc3/sound/oss/ymfpci.c 2004-06-07 12:55:31.411798922 -0700 @@ -1220,7 +1220,7 @@ * machine and drained by this loop. */ static ssize_t -ymf_read(struct file *file, char *buffer, size_t count, loff_t *ppos) +ymf_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) { struct ymf_state *state = (struct ymf_state *)file->private_data; struct ymf_dmabuf *dmabuf = &state->rpcm.dmabuf; @@ -1335,7 +1335,7 @@ } static ssize_t -ymf_write(struct file *file, const char *buffer, size_t count, loff_t *ppos) +ymf_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { struct ymf_state *state = (struct ymf_state *)file->private_data; struct ymf_dmabuf *dmabuf = &state->wpcm.dmabuf; @@ -1568,11 +1568,13 @@ count_info cinfo; int redzone; int val; + void __user *argp = (void __user *)arg; + int __user *p = argp; switch (cmd) { case OSS_GETVERSION: YMFDBGX("ymf_ioctl: cmd 0x%x(GETVER) arg 0x%lx\n", cmd, arg); - return put_user(SOUND_VERSION, (int *)arg); + return put_user(SOUND_VERSION, p); case SNDCTL_DSP_RESET: YMFDBGX("ymf_ioctl: cmd 0x%x(RESET)\n", cmd); @@ -1614,7 +1616,7 @@ return 0; case SNDCTL_DSP_SPEED: /* set smaple rate */ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; YMFDBGX("ymf_ioctl: cmd 0x%x(SPEED) sp %d\n", cmd, val); if (val >= 8000 && val <= 48000) { @@ -1637,7 +1639,7 @@ spin_unlock_irqrestore(&state->unit->reg_lock, flags); } } - return put_user(state->format.rate, (int *)arg); + return put_user(state->format.rate, p); /* * OSS manual does not mention SNDCTL_DSP_STEREO at all. @@ -1646,7 +1648,7 @@ * However, mpg123 calls it. I wonder, why Michael Hipp used it. */ case SNDCTL_DSP_STEREO: /* set stereo or mono channel */ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; YMFDBGX("ymf_ioctl: cmd 0x%x(STEREO) st %d\n", cmd, val); if (file->f_mode & FMODE_WRITE) { @@ -1676,23 +1678,23 @@ return val; val = state->wpcm.dmabuf.fragsize; YMFDBGX("ymf_ioctl: GETBLK w %d\n", val); - return put_user(val, (int *)arg); + return put_user(val, p); } if (file->f_mode & FMODE_READ) { if ((val = prog_dmabuf(state, 1))) return val; val = state->rpcm.dmabuf.fragsize; YMFDBGX("ymf_ioctl: GETBLK r %d\n", val); - return put_user(val, (int *)arg); + return put_user(val, p); } return -EINVAL; case SNDCTL_DSP_GETFMTS: /* Returns a mask of supported sample format*/ YMFDBGX("ymf_ioctl: cmd 0x%x(GETFMTS)\n", cmd); - return put_user(AFMT_S16_LE|AFMT_U8, (int *)arg); + return put_user(AFMT_S16_LE|AFMT_U8, p); case SNDCTL_DSP_SETFMT: /* Select sample format */ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; YMFDBGX("ymf_ioctl: cmd 0x%x(SETFMT) fmt %d\n", cmd, val); if (val == AFMT_S16_LE || val == AFMT_U8) { @@ -1715,10 +1717,10 @@ spin_unlock_irqrestore(&state->unit->reg_lock, flags); } } - return put_user(state->format.format, (int *)arg); + return put_user(state->format.format, p); case SNDCTL_DSP_CHANNELS: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; YMFDBGX("ymf_ioctl: cmd 0x%x(CHAN) ch %d\n", cmd, val); if (val != 0) { @@ -1745,7 +1747,7 @@ } } } - return put_user(state->format.voices, (int *)arg); + return put_user(state->format.voices, p); case SNDCTL_DSP_POST: YMFDBGX("ymf_ioctl: cmd 0x%x(POST)\n", cmd); @@ -1768,7 +1770,7 @@ return 0; case SNDCTL_DSP_SETFRAGMENT: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; YMFDBGX("ymf_ioctl: cmd 0x%x(SETFRAG) fr 0x%04x:%04x(%d:%d)\n", cmd, @@ -1799,7 +1801,7 @@ abinfo.fragstotal = dmabuf->numfrag; abinfo.fragments = abinfo.bytes >> dmabuf->fragshift; spin_unlock_irqrestore(&state->unit->reg_lock, flags); - return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_GETISPACE: YMFDBGX("ymf_ioctl: cmd 0x%x(GETISPACE)\n", cmd); @@ -1814,7 +1816,7 @@ abinfo.fragstotal = dmabuf->numfrag; abinfo.fragments = abinfo.bytes >> dmabuf->fragshift; spin_unlock_irqrestore(&state->unit->reg_lock, flags); - return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_NONBLOCK: YMFDBGX("ymf_ioctl: cmd 0x%x(NONBLOCK)\n", cmd); @@ -1824,8 +1826,8 @@ case SNDCTL_DSP_GETCAPS: YMFDBGX("ymf_ioctl: cmd 0x%x(GETCAPS)\n", cmd); /* return put_user(DSP_CAP_REALTIME|DSP_CAP_TRIGGER|DSP_CAP_MMAP, - (int *)arg); */ - return put_user(0, (int *)arg); + p); */ + return put_user(0, p); case SNDCTL_DSP_GETIPTR: YMFDBGX("ymf_ioctl: cmd 0x%x(GETIPTR)\n", cmd); @@ -1839,7 +1841,7 @@ spin_unlock_irqrestore(&state->unit->reg_lock, flags); YMFDBGX("ymf_ioctl: GETIPTR ptr %d bytes %d\n", cinfo.ptr, cinfo.bytes); - return copy_to_user((void *)arg, &cinfo, sizeof(cinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &cinfo, sizeof(cinfo)) ? -EFAULT : 0; case SNDCTL_DSP_GETOPTR: YMFDBGX("ymf_ioctl: cmd 0x%x(GETOPTR)\n", cmd); @@ -1853,7 +1855,7 @@ spin_unlock_irqrestore(&state->unit->reg_lock, flags); YMFDBGX("ymf_ioctl: GETOPTR ptr %d bytes %d\n", cinfo.ptr, cinfo.bytes); - return copy_to_user((void *)arg, &cinfo, sizeof(cinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &cinfo, sizeof(cinfo)) ? -EFAULT : 0; case SNDCTL_DSP_SETDUPLEX: YMFDBGX("ymf_ioctl: cmd 0x%x(SETDUPLEX)\n", cmd); @@ -1861,15 +1863,15 @@ case SOUND_PCM_READ_RATE: YMFDBGX("ymf_ioctl: cmd 0x%x(READ_RATE)\n", cmd); - return put_user(state->format.rate, (int *)arg); + return put_user(state->format.rate, p); case SOUND_PCM_READ_CHANNELS: YMFDBGX("ymf_ioctl: cmd 0x%x(READ_CH)\n", cmd); - return put_user(state->format.voices, (int *)arg); + return put_user(state->format.voices, p); case SOUND_PCM_READ_BITS: YMFDBGX("ymf_ioctl: cmd 0x%x(READ_BITS)\n", cmd); - return put_user(AFMT_S16_LE, (int *)arg); + return put_user(AFMT_S16_LE, p); case SNDCTL_DSP_MAPINBUF: case SNDCTL_DSP_MAPOUTBUF: diff -urN linux-2.6.7-rc2/sound/pci/cs4281.c linux-2.6.7-rc3/sound/pci/cs4281.c --- linux-2.6.7-rc2/sound/pci/cs4281.c 2004-06-07 12:54:55.588315141 -0700 +++ linux-2.6.7-rc3/sound/pci/cs4281.c 2004-06-07 12:55:31.734812302 -0700 @@ -1185,7 +1185,7 @@ } static long snd_cs4281_BA0_read(snd_info_entry_t *entry, void *file_private_data, - struct file *file, char *buf, long count) + struct file *file, char __user *buf, long count) { long size; cs4281_t *chip = snd_magic_cast(cs4281_t, entry->private_data, return -ENXIO); @@ -1202,7 +1202,7 @@ } static long snd_cs4281_BA1_read(snd_info_entry_t *entry, void *file_private_data, - struct file *file, char *buf, long count) + struct file *file, char __user *buf, long count) { long size; cs4281_t *chip = snd_magic_cast(cs4281_t, entry->private_data, return -ENXIO); diff -urN linux-2.6.7-rc2/sound/pci/cs46xx/cs46xx_lib.c linux-2.6.7-rc3/sound/pci/cs46xx/cs46xx_lib.c --- linux-2.6.7-rc2/sound/pci/cs46xx/cs46xx_lib.c 2004-06-07 12:54:55.596315472 -0700 +++ linux-2.6.7-rc3/sound/pci/cs46xx/cs46xx_lib.c 2004-06-07 12:55:31.877818225 -0700 @@ -2866,7 +2866,7 @@ */ static long snd_cs46xx_io_read(snd_info_entry_t *entry, void *file_private_data, - struct file *file, char *buf, long count) + struct file *file, char __user *buf, long count) { long size; snd_cs46xx_region_t *region = (snd_cs46xx_region_t *)entry->private_data; diff -urN linux-2.6.7-rc2/sound/pci/emu10k1/emufx.c linux-2.6.7-rc3/sound/pci/emu10k1/emufx.c --- linux-2.6.7-rc2/sound/pci/emu10k1/emufx.c 2004-06-07 12:54:55.654317874 -0700 +++ linux-2.6.7-rc3/sound/pci/emu10k1/emufx.c 2004-06-07 12:55:31.964821829 -0700 @@ -898,8 +898,10 @@ static int snd_emu10k1_verify_controls(emu10k1_t *emu, emu10k1_fx8010_code_t *icode) { unsigned int i; - snd_ctl_elem_id_t *_id, id; - emu10k1_fx8010_control_gpr_t *_gctl, gctl; + snd_ctl_elem_id_t __user *_id; + snd_ctl_elem_id_t id; + emu10k1_fx8010_control_gpr_t __user *_gctl; + emu10k1_fx8010_control_gpr_t gctl; for (i = 0, _id = icode->gpr_del_controls; i < icode->gpr_del_control_count; i++, _id++) { @@ -946,7 +948,8 @@ static void snd_emu10k1_add_controls(emu10k1_t *emu, emu10k1_fx8010_code_t *icode) { unsigned int i, j; - emu10k1_fx8010_control_gpr_t *_gctl, gctl; + emu10k1_fx8010_control_gpr_t __user *_gctl; + emu10k1_fx8010_control_gpr_t gctl; snd_emu10k1_fx8010_ctl_t *ctl, nctl; snd_kcontrol_new_t knew; snd_kcontrol_t *kctl; @@ -1012,7 +1015,8 @@ static void snd_emu10k1_del_controls(emu10k1_t *emu, emu10k1_fx8010_code_t *icode) { unsigned int i; - snd_ctl_elem_id_t *_id, id; + snd_ctl_elem_id_t id; + snd_ctl_elem_id_t __user *_id; snd_emu10k1_fx8010_ctl_t *ctl; snd_card_t *card = emu->card; @@ -1031,7 +1035,8 @@ { unsigned int i = 0, j; unsigned int total = 0; - emu10k1_fx8010_control_gpr_t *_gctl, gctl; + emu10k1_fx8010_control_gpr_t gctl; + emu10k1_fx8010_control_gpr_t __user *_gctl; snd_emu10k1_fx8010_ctl_t *ctl; snd_ctl_elem_id_t *id; struct list_head *list; @@ -2297,6 +2302,7 @@ emu10k1_fx8010_code_t *icode; emu10k1_fx8010_pcm_t *ipcm; unsigned int addr; + void __user *argp = (void __user *)arg; int res; switch (cmd) { @@ -2308,7 +2314,7 @@ kfree(info); return res; } - if (copy_to_user((void *)arg, info, sizeof(*info))) { + if (copy_to_user(argp, info, sizeof(*info))) { kfree(info); return -EFAULT; } @@ -2320,7 +2326,7 @@ icode = (emu10k1_fx8010_code_t *)kmalloc(sizeof(*icode), GFP_KERNEL); if (icode == NULL) return -ENOMEM; - if (copy_from_user(icode, (void *)arg, sizeof(*icode))) { + if (copy_from_user(icode, argp, sizeof(*icode))) { kfree(icode); return -EFAULT; } @@ -2331,12 +2337,12 @@ icode = (emu10k1_fx8010_code_t *)kmalloc(sizeof(*icode), GFP_KERNEL); if (icode == NULL) return -ENOMEM; - if (copy_from_user(icode, (void *)arg, sizeof(*icode))) { + if (copy_from_user(icode, argp, sizeof(*icode))) { kfree(icode); return -EFAULT; } res = snd_emu10k1_icode_peek(emu, icode); - if (res == 0 && copy_to_user((void *)arg, icode, sizeof(*icode))) { + if (res == 0 && copy_to_user(argp, icode, sizeof(*icode))) { kfree(icode); return -EFAULT; } @@ -2348,7 +2354,7 @@ ipcm = (emu10k1_fx8010_pcm_t *)kmalloc(sizeof(*ipcm), GFP_KERNEL); if (ipcm == NULL) return -ENOMEM; - if (copy_from_user(ipcm, (void *)arg, sizeof(*ipcm))) { + if (copy_from_user(ipcm, argp, sizeof(*ipcm))) { kfree(ipcm); return -EFAULT; } @@ -2361,12 +2367,12 @@ ipcm = (emu10k1_fx8010_pcm_t *)snd_kcalloc(sizeof(*ipcm), GFP_KERNEL); if (ipcm == NULL) return -ENOMEM; - if (copy_from_user(ipcm, (void *)arg, sizeof(*ipcm))) { + if (copy_from_user(ipcm, argp, sizeof(*ipcm))) { kfree(ipcm); return -EFAULT; } res = snd_emu10k1_ipcm_peek(emu, ipcm); - if (res == 0 && copy_to_user((void *)arg, ipcm, sizeof(*ipcm))) { + if (res == 0 && copy_to_user(argp, ipcm, sizeof(*ipcm))) { kfree(ipcm); return -EFAULT; } @@ -2377,7 +2383,7 @@ return -EINVAL; if (!capable(CAP_SYS_ADMIN)) return -EPERM; - if (get_user(addr, (unsigned int *)arg)) + if (get_user(addr, (unsigned int __user *)argp)) return -EFAULT; down(&emu->fx8010.lock); res = snd_emu10k1_fx8010_tram_setup(emu, addr); @@ -2415,7 +2421,7 @@ case SNDRV_EMU10K1_IOCTL_SINGLE_STEP: if (!capable(CAP_SYS_ADMIN)) return -EPERM; - if (get_user(addr, (unsigned int *)arg)) + if (get_user(addr, (unsigned int __user *)argp)) return -EFAULT; if (addr > 0x1ff) return -EINVAL; @@ -2434,7 +2440,7 @@ addr = snd_emu10k1_ptr_read(emu, A_DBG, 0); else addr = snd_emu10k1_ptr_read(emu, DBG, 0); - if (put_user(addr, (unsigned int *)arg)) + if (put_user(addr, (unsigned int __user *)argp)) return -EFAULT; return 0; } diff -urN linux-2.6.7-rc2/sound/pci/emu10k1/emuproc.c linux-2.6.7-rc3/sound/pci/emu10k1/emuproc.c --- linux-2.6.7-rc2/sound/pci/emu10k1/emuproc.c 2004-05-09 19:32:27.000000000 -0700 +++ linux-2.6.7-rc3/sound/pci/emu10k1/emuproc.c 2004-06-07 12:55:31.966821912 -0700 @@ -191,7 +191,7 @@ #define TOTAL_SIZE_CODE (0x200*8) static long snd_emu10k1_fx8010_read(snd_info_entry_t *entry, void *file_private_data, - struct file *file, char *buf, long count) + struct file *file, char __user *buf, long count) { long size; emu10k1_t *emu = snd_magic_cast(emu10k1_t, entry->private_data, return -ENXIO); diff -urN linux-2.6.7-rc2/sound/pci/es1938.c linux-2.6.7-rc3/sound/pci/es1938.c --- linux-2.6.7-rc2/sound/pci/es1938.c 2004-06-07 12:54:55.661318164 -0700 +++ linux-2.6.7-rc3/sound/pci/es1938.c 2004-06-07 12:55:31.989822865 -0700 @@ -822,7 +822,7 @@ static int snd_es1938_capture_copy(snd_pcm_substream_t *substream, int channel, snd_pcm_uframes_t pos, - void *dst, + void __user *dst, snd_pcm_uframes_t count) { snd_pcm_runtime_t *runtime = substream->runtime; @@ -836,7 +836,7 @@ } else { if (copy_to_user(dst, runtime->dma_area + pos + 1, count - 1)) return -EFAULT; - if (put_user(runtime->dma_area[0], ((unsigned char *)dst) + count - 1)) + if (put_user(runtime->dma_area[0], ((unsigned char __user *)dst) + count - 1)) return -EFAULT; } return 0; diff -urN linux-2.6.7-rc2/sound/pci/korg1212/korg1212.c linux-2.6.7-rc3/sound/pci/korg1212/korg1212.c --- linux-2.6.7-rc2/sound/pci/korg1212/korg1212.c 2004-06-07 12:54:55.713320318 -0700 +++ linux-2.6.7-rc3/sound/pci/korg1212/korg1212.c 2004-06-07 12:55:32.113828001 -0700 @@ -1328,7 +1328,7 @@ return 0; } -static int snd_korg1212_copy_to(korg1212_t *korg1212, void *dst, int pos, int count, int offset, int size) +static int snd_korg1212_copy_to(korg1212_t *korg1212, void __user *dst, int pos, int count, int offset, int size) { KorgAudioFrame * src = korg1212->recordDataBufsPtr[0].bufferData + pos; int i, rc; @@ -1346,7 +1346,7 @@ return -EFAULT; } #endif - rc = copy_to_user((void*) dst + offset, src, size); + rc = copy_to_user(dst + offset, src, size); if (rc) { #if K1212_DEBUG_LEVEL > 0 K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_copy_to USER EFAULT src=%p dst=%p iter=%d\n", src, dst, i); @@ -1360,7 +1360,7 @@ return 0; } -static int snd_korg1212_copy_from(korg1212_t *korg1212, void *src, int pos, int count, int offset, int size) +static int snd_korg1212_copy_from(korg1212_t *korg1212, void __user *src, int pos, int count, int offset, int size) { KorgAudioFrame * dst = korg1212->playDataBufsPtr[0].bufferData + pos; int i, rc; @@ -1671,7 +1671,7 @@ static int snd_korg1212_playback_copy(snd_pcm_substream_t *substream, int channel, /* not used (interleaved data) */ snd_pcm_uframes_t pos, - void *src, + void __user *src, snd_pcm_uframes_t count) { korg1212_t *korg1212 = _snd_pcm_substream_chip(substream); @@ -1701,7 +1701,7 @@ static int snd_korg1212_capture_copy(snd_pcm_substream_t *substream, int channel, /* not used (interleaved data) */ snd_pcm_uframes_t pos, - void *dst, + void __user *dst, snd_pcm_uframes_t count) { korg1212_t *korg1212 = _snd_pcm_substream_chip(substream); diff -urN linux-2.6.7-rc2/sound/pci/mixart/mixart.c linux-2.6.7-rc3/sound/pci/mixart/mixart.c --- linux-2.6.7-rc2/sound/pci/mixart/mixart.c 2004-06-07 12:54:55.831325205 -0700 +++ linux-2.6.7-rc3/sound/pci/mixart/mixart.c 2004-06-07 12:55:32.167830238 -0700 @@ -1154,7 +1154,7 @@ mixart_BA0 proc interface for BAR 0 - read callback */ static long snd_mixart_BA0_read(snd_info_entry_t *entry, void *file_private_data, - struct file *file, char *buf, long count) + struct file *file, char __user *buf, long count) { mixart_mgr_t *mgr = snd_magic_cast(mixart_mgr_t, entry->private_data, return -ENXIO); @@ -1173,7 +1173,7 @@ mixart_BA1 proc interface for BAR 1 - read callback */ static long snd_mixart_BA1_read(snd_info_entry_t *entry, void *file_private_data, - struct file *file, char *buf, long count) + struct file *file, char __user *buf, long count) { mixart_mgr_t *mgr = snd_magic_cast(mixart_mgr_t, entry->private_data, return -ENXIO); diff -urN linux-2.6.7-rc2/sound/pci/nm256/nm256.c linux-2.6.7-rc3/sound/pci/nm256/nm256.c --- linux-2.6.7-rc2/sound/pci/nm256/nm256.c 2004-06-07 12:54:55.835325371 -0700 +++ linux-2.6.7-rc3/sound/pci/nm256/nm256.c 2004-06-07 12:55:32.175830570 -0700 @@ -684,7 +684,7 @@ snd_nm256_playback_copy(snd_pcm_substream_t *substream, int channel, /* not used (interleaved data) */ snd_pcm_uframes_t pos, - void *src, + void __user *src, snd_pcm_uframes_t count) { snd_pcm_runtime_t *runtime = substream->runtime; diff -urN linux-2.6.7-rc2/sound/pci/rme32.c linux-2.6.7-rc3/sound/pci/rme32.c --- linux-2.6.7-rc2/sound/pci/rme32.c 2004-06-07 12:54:55.843325702 -0700 +++ linux-2.6.7-rc3/sound/pci/rme32.c 2004-06-07 12:55:32.191831233 -0700 @@ -298,7 +298,7 @@ static int snd_rme32_playback_copy(snd_pcm_substream_t * substream, int channel, /* not used (interleaved data) */ snd_pcm_uframes_t pos, - void *src, snd_pcm_uframes_t count) + void __user *src, snd_pcm_uframes_t count) { rme32_t *rme32 = _snd_pcm_substream_chip(substream); count <<= rme32->playback_frlog; @@ -311,7 +311,7 @@ static int snd_rme32_capture_copy(snd_pcm_substream_t * substream, int channel, /* not used (interleaved data) */ snd_pcm_uframes_t pos, - void *dst, snd_pcm_uframes_t count) + void __user *dst, snd_pcm_uframes_t count) { rme32_t *rme32 = _snd_pcm_substream_chip(substream); count <<= rme32->capture_frlog; diff -urN linux-2.6.7-rc2/sound/pci/rme96.c linux-2.6.7-rc3/sound/pci/rme96.c --- linux-2.6.7-rc2/sound/pci/rme96.c 2004-06-07 12:54:55.856326241 -0700 +++ linux-2.6.7-rc3/sound/pci/rme96.c 2004-06-07 12:55:32.202831688 -0700 @@ -361,7 +361,7 @@ snd_rme96_playback_copy(snd_pcm_substream_t *substream, int channel, /* not used (interleaved data) */ snd_pcm_uframes_t pos, - void *src, + void __user *src, snd_pcm_uframes_t count) { rme96_t *rme96 = _snd_pcm_substream_chip(substream); @@ -376,7 +376,7 @@ snd_rme96_capture_copy(snd_pcm_substream_t *substream, int channel, /* not used (interleaved data) */ snd_pcm_uframes_t pos, - void *dst, + void __user *dst, snd_pcm_uframes_t count) { rme96_t *rme96 = _snd_pcm_substream_chip(substream); diff -urN linux-2.6.7-rc2/sound/pci/rme9652/hdsp.c linux-2.6.7-rc3/sound/pci/rme9652/hdsp.c --- linux-2.6.7-rc2/sound/pci/rme9652/hdsp.c 2004-06-07 12:54:55.861326448 -0700 +++ linux-2.6.7-rc3/sound/pci/rme9652/hdsp.c 2004-06-07 12:55:32.238833179 -0700 @@ -1250,9 +1250,9 @@ { /* the hardware already does the relevant bit-mask with 0xff */ if (id) { - return hdsp_write(hdsp, HDSP_midiDataOut1, val); + hdsp_write(hdsp, HDSP_midiDataOut1, val); } else { - return hdsp_write(hdsp, HDSP_midiDataOut0, val); + hdsp_write(hdsp, HDSP_midiDataOut0, val); } } @@ -3834,7 +3834,7 @@ } static int snd_hdsp_playback_copy(snd_pcm_substream_t *substream, int channel, - snd_pcm_uframes_t pos, void *src, snd_pcm_uframes_t count) + snd_pcm_uframes_t pos, void __user *src, snd_pcm_uframes_t count) { hdsp_t *hdsp = _snd_pcm_substream_chip(substream); char *channel_buf; @@ -3849,7 +3849,7 @@ } static int snd_hdsp_capture_copy(snd_pcm_substream_t *substream, int channel, - snd_pcm_uframes_t pos, void *dst, snd_pcm_uframes_t count) + snd_pcm_uframes_t pos, void __user *dst, snd_pcm_uframes_t count) { hdsp_t *hdsp = _snd_pcm_substream_chip(substream); char *channel_buf; @@ -4531,10 +4531,11 @@ static int snd_hdsp_hwdep_ioctl(snd_hwdep_t *hw, struct file *file, unsigned int cmd, unsigned long arg) { hdsp_t *hdsp = (hdsp_t *)hw->private_data; + void __user *argp = (void __user *)arg; switch (cmd) { case SNDRV_HDSP_IOCTL_GET_PEAK_RMS: { - hdsp_peak_rms_t *peak_rms; + hdsp_peak_rms_t __user *peak_rms; int i; if (hdsp->io_type == H9652) { @@ -4542,38 +4543,38 @@ int doublespeed = 0; if (hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DoubleSpeedStatus) doublespeed = 1; - peak_rms = (hdsp_peak_rms_t *)arg; + peak_rms = (hdsp_peak_rms_t __user *)arg; for (i = 0; i < 26; ++i) { if (!(doublespeed && (i & 4))) { - if (copy_to_user_fromio((void *)peak_rms->input_peaks+i*4, hdsp->iobase+HDSP_9652_peakBase-i*4, 4) != 0) + if (copy_to_user_fromio((void __user *)peak_rms->input_peaks+i*4, hdsp->iobase+HDSP_9652_peakBase-i*4, 4) != 0) return -EFAULT; - if (copy_to_user_fromio((void *)peak_rms->playback_peaks+i*4, hdsp->iobase+HDSP_9652_peakBase-(doublespeed ? 14 : 26)*4-i*4, 4) != 0) + if (copy_to_user_fromio((void __user *)peak_rms->playback_peaks+i*4, hdsp->iobase+HDSP_9652_peakBase-(doublespeed ? 14 : 26)*4-i*4, 4) != 0) return -EFAULT; - if (copy_to_user_fromio((void *)peak_rms->output_peaks+i*4, hdsp->iobase+HDSP_9652_peakBase-2*(doublespeed ? 14 : 26)*4-i*4, 4) != 0) + if (copy_to_user_fromio((void __user *)peak_rms->output_peaks+i*4, hdsp->iobase+HDSP_9652_peakBase-2*(doublespeed ? 14 : 26)*4-i*4, 4) != 0) return -EFAULT; rms_low = *(u32 *)(hdsp->iobase+HDSP_9652_rmsBase+i*8) & 0xFFFFFF00; rms_high = *(u32 *)(hdsp->iobase+HDSP_9652_rmsBase+i*8+4) & 0xFFFFFF00; rms_high += (rms_low >> 24); rms_low <<= 8; - if (copy_to_user((void *)peak_rms->input_rms+i*8, &rms_low, 4) != 0) + if (copy_to_user((void __user *)peak_rms->input_rms+i*8, &rms_low, 4) != 0) return -EFAULT; - if (copy_to_user((void *)peak_rms->input_rms+i*8+4, &rms_high, 4) != 0) + if (copy_to_user((void __user *)peak_rms->input_rms+i*8+4, &rms_high, 4) != 0) return -EFAULT; rms_low = *(u32 *)(hdsp->iobase+HDSP_9652_rmsBase+(doublespeed ? 14 : 26)*8+i*8) & 0xFFFFFF00; rms_high = *(u32 *)(hdsp->iobase+HDSP_9652_rmsBase+(doublespeed ? 14 : 26)*8+i*8+4) & 0xFFFFFF00; rms_high += (rms_low >> 24); rms_low <<= 8; - if (copy_to_user((void *)peak_rms->playback_rms+i*8, &rms_low, 4) != 0) + if (copy_to_user((void __user *)peak_rms->playback_rms+i*8, &rms_low, 4) != 0) return -EFAULT; - if (copy_to_user((void *)peak_rms->playback_rms+i*8+4, &rms_high, 4) != 0) + if (copy_to_user((void __user *)peak_rms->playback_rms+i*8+4, &rms_high, 4) != 0) return -EFAULT; rms_low = *(u32 *)(hdsp->iobase+HDSP_9652_rmsBase+2*(doublespeed ? 14 : 26)*8+i*8) & 0xFFFFFF00; rms_high = *(u32 *)(hdsp->iobase+HDSP_9652_rmsBase+2*(doublespeed ? 14 : 26)*8+i*8+4) & 0xFFFFFF00; rms_high += (rms_low >> 24); rms_low <<= 8; - if (copy_to_user((void *)peak_rms->output_rms+i*8, &rms_low, 4) != 0) + if (copy_to_user((void __user *)peak_rms->output_rms+i*8, &rms_low, 4) != 0) return -EFAULT; - if (copy_to_user((void *)peak_rms->output_rms+i*8+4, &rms_high, 4) != 0) + if (copy_to_user((void __user *)peak_rms->output_rms+i*8+4, &rms_high, 4) != 0) return -EFAULT; } } @@ -4586,25 +4587,25 @@ if (hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DoubleSpeedStatus) doublespeed = 1; m = (hdsp_9632_meters_t *)(hdsp->iobase+HDSP_9632_metersBase); - peak_rms = (hdsp_peak_rms_t *)arg; + peak_rms = (hdsp_peak_rms_t __user *)arg; for (i = 0, j = 0; i < 16; ++i, ++j) { - if (copy_to_user((void *)peak_rms->input_peaks+i*4, &(m->input_peak[j]), 4) != 0) + if (copy_to_user((void __user *)peak_rms->input_peaks+i*4, &(m->input_peak[j]), 4) != 0) return -EFAULT; - if (copy_to_user((void *)peak_rms->playback_peaks+i*4, &(m->playback_peak[j]), 4) != 0) + if (copy_to_user((void __user *)peak_rms->playback_peaks+i*4, &(m->playback_peak[j]), 4) != 0) return -EFAULT; - if (copy_to_user((void *)peak_rms->output_peaks+i*4, &(m->output_peak[j]), 4) != 0) + if (copy_to_user((void __user *)peak_rms->output_peaks+i*4, &(m->output_peak[j]), 4) != 0) return -EFAULT; - if (copy_to_user((void *)peak_rms->input_rms+i*8, &(m->input_rms_low[j]), 4) != 0) + if (copy_to_user((void __user *)peak_rms->input_rms+i*8, &(m->input_rms_low[j]), 4) != 0) return -EFAULT; - if (copy_to_user((void *)peak_rms->playback_rms+i*8, &(m->playback_rms_low[j]), 4) != 0) + if (copy_to_user((void __user *)peak_rms->playback_rms+i*8, &(m->playback_rms_low[j]), 4) != 0) return -EFAULT; - if (copy_to_user((void *)peak_rms->output_rms+i*8, &(m->output_rms_low[j]), 4) != 0) + if (copy_to_user((void __user *)peak_rms->output_rms+i*8, &(m->output_rms_low[j]), 4) != 0) return -EFAULT; - if (copy_to_user((void *)peak_rms->input_rms+i*8+4, &(m->input_rms_high[j]), 4) != 0) + if (copy_to_user((void __user *)peak_rms->input_rms+i*8+4, &(m->input_rms_high[j]), 4) != 0) return -EFAULT; - if (copy_to_user((void *)peak_rms->playback_rms+i*8+4, &(m->playback_rms_high[j]), 4) != 0) + if (copy_to_user((void __user *)peak_rms->playback_rms+i*8+4, &(m->playback_rms_high[j]), 4) != 0) return -EFAULT; - if (copy_to_user((void *)peak_rms->output_rms+i*8+4, &(m->output_rms_high[j]), 4) != 0) + if (copy_to_user((void __user *)peak_rms->output_rms+i*8+4, &(m->output_rms_high[j]), 4) != 0) return -EFAULT; if (doublespeed && i == 3) i += 4; } @@ -4614,25 +4615,25 @@ snd_printk("firmware needs to be uploaded to the card.\n"); return -EINVAL; } - peak_rms = (hdsp_peak_rms_t *)arg; + peak_rms = (hdsp_peak_rms_t __user *)arg; for (i = 0; i < 26; ++i) { - if (copy_to_user((void *)peak_rms->playback_peaks+i*4, (void *)hdsp->iobase+HDSP_playbackPeakLevel+i*4, 4) != 0) + if (copy_to_user((void __user *)peak_rms->playback_peaks+i*4, (void *)hdsp->iobase+HDSP_playbackPeakLevel+i*4, 4) != 0) return -EFAULT; - if (copy_to_user((void *)peak_rms->input_peaks+i*4, (void *)hdsp->iobase+HDSP_inputPeakLevel+i*4, 4) != 0) + if (copy_to_user((void __user *)peak_rms->input_peaks+i*4, (void *)hdsp->iobase+HDSP_inputPeakLevel+i*4, 4) != 0) return -EFAULT; } for (i = 0; i < 26; ++i) { - if (copy_to_user((void *)peak_rms->playback_rms+i*8+4, (void *)hdsp->iobase+HDSP_playbackRmsLevel+i*8, 4) != 0) + if (copy_to_user((void __user *)peak_rms->playback_rms+i*8+4, (void *)hdsp->iobase+HDSP_playbackRmsLevel+i*8, 4) != 0) return -EFAULT; - if (copy_to_user((void *)peak_rms->playback_rms+i*8, (void *)hdsp->iobase+HDSP_playbackRmsLevel+i*8+4, 4) != 0) + if (copy_to_user((void __user *)peak_rms->playback_rms+i*8, (void *)hdsp->iobase+HDSP_playbackRmsLevel+i*8+4, 4) != 0) return -EFAULT; - if (copy_to_user((void *)peak_rms->input_rms+i*8+4, (void *)hdsp->iobase+HDSP_inputRmsLevel+i*8, 4) != 0) + if (copy_to_user((void __user *)peak_rms->input_rms+i*8+4, (void *)hdsp->iobase+HDSP_inputRmsLevel+i*8, 4) != 0) return -EFAULT; - if (copy_to_user((void *)peak_rms->input_rms+i*8, (void *)hdsp->iobase+HDSP_inputRmsLevel+i*8+4, 4) != 0) + if (copy_to_user((void __user *)peak_rms->input_rms+i*8, (void *)hdsp->iobase+HDSP_inputRmsLevel+i*8+4, 4) != 0) return -EFAULT; } for (i = 0; i < 28; ++i) { - if (copy_to_user((void *)peak_rms->output_peaks+i*4, (void *)hdsp->iobase+HDSP_outputPeakLevel+i*4, 4) != 0) + if (copy_to_user((void __user *)peak_rms->output_peaks+i*4, (void *)hdsp->iobase+HDSP_outputPeakLevel+i*4, 4) != 0) return -EFAULT; } break; @@ -4680,7 +4681,7 @@ info.analog_extension_board = (unsigned char)hdsp_aeb(hdsp); } spin_unlock_irqrestore(&hdsp->lock, flags); - if (copy_to_user((void *)arg, &info, sizeof(info))) + if (copy_to_user(argp, &info, sizeof(info))) return -EFAULT; break; } @@ -4690,7 +4691,7 @@ if (hdsp->io_type != H9632) return -EINVAL; h9632_aeb.aebi = hdsp->ss_in_channels - H9632_SS_CHANNELS; h9632_aeb.aebo = hdsp->ss_out_channels - H9632_SS_CHANNELS; - if (copy_to_user((void *)arg, &h9632_aeb, sizeof(h9632_aeb))) + if (copy_to_user(argp, &h9632_aeb, sizeof(h9632_aeb))) return -EFAULT; break; } @@ -4706,14 +4707,14 @@ } hdsp_version.io_type = hdsp->io_type; hdsp_version.firmware_rev = hdsp->firmware_rev; - if ((err = copy_to_user((void *)arg, &hdsp_version, sizeof(hdsp_version)))) { + if ((err = copy_to_user(argp, &hdsp_version, sizeof(hdsp_version)))) { return -EFAULT; } break; } case SNDRV_HDSP_IOCTL_UPLOAD_FIRMWARE: { - hdsp_firmware_t *firmware; - unsigned long *firmware_data; + hdsp_firmware_t __user *firmware; + unsigned long __user *firmware_data; int err; if (hdsp->io_type == H9652 || hdsp->io_type == H9632) return -EINVAL; @@ -4721,7 +4722,7 @@ if (hdsp->io_type == Undefined) return -EINVAL; snd_printk("initializing firmware upload\n"); - firmware = (hdsp_firmware_t *)arg; + firmware = (hdsp_firmware_t __user *)argp; if (get_user(firmware_data, &firmware->firmware_data)) { return -EFAULT; @@ -4754,9 +4755,7 @@ break; } case SNDRV_HDSP_IOCTL_GET_MIXER: { - hdsp_mixer_t *mixer; - - mixer = (hdsp_mixer_t *)arg; + hdsp_mixer_t __user *mixer = (hdsp_mixer_t __user *)argp; if (copy_to_user(mixer->matrix, hdsp->mixer_matrix, sizeof(unsigned short)*HDSP_MATRIX_MIXER_SIZE)) return -EFAULT; break; diff -urN linux-2.6.7-rc2/sound/pci/rme9652/rme9652.c linux-2.6.7-rc3/sound/pci/rme9652/rme9652.c --- linux-2.6.7-rc2/sound/pci/rme9652/rme9652.c 2004-06-07 12:54:55.864326572 -0700 +++ linux-2.6.7-rc3/sound/pci/rme9652/rme9652.c 2004-06-07 12:55:32.240833262 -0700 @@ -2011,7 +2011,7 @@ } static int snd_rme9652_playback_copy(snd_pcm_substream_t *substream, int channel, - snd_pcm_uframes_t pos, void *src, snd_pcm_uframes_t count) + snd_pcm_uframes_t pos, void __user *src, snd_pcm_uframes_t count) { rme9652_t *rme9652 = _snd_pcm_substream_chip(substream); char *channel_buf; @@ -2028,7 +2028,7 @@ } static int snd_rme9652_capture_copy(snd_pcm_substream_t *substream, int channel, - snd_pcm_uframes_t pos, void *dst, snd_pcm_uframes_t count) + snd_pcm_uframes_t pos, void __user *dst, snd_pcm_uframes_t count) { rme9652_t *rme9652 = _snd_pcm_substream_chip(substream); char *channel_buf; diff -urN linux-2.6.7-rc2/sound/pci/trident/trident_memory.c linux-2.6.7-rc3/sound/pci/trident/trident_memory.c --- linux-2.6.7-rc2/sound/pci/trident/trident_memory.c 2004-05-09 19:32:53.000000000 -0700 +++ linux-2.6.7-rc3/sound/pci/trident/trident_memory.c 2004-06-07 12:55:32.265834298 -0700 @@ -471,7 +471,7 @@ /* * copy_from_user(blk + offset, data, size) */ -int snd_trident_synth_copy_from_user(trident_t *trident, snd_util_memblk_t *blk, int offset, const char *data, int size) +int snd_trident_synth_copy_from_user(trident_t *trident, snd_util_memblk_t *blk, int offset, const char __user *data, int size) { int page, nextofs, end_offset, temp, temp1; diff -urN linux-2.6.7-rc2/sound/pci/trident/trident_synth.c linux-2.6.7-rc3/sound/pci/trident/trident_synth.c --- linux-2.6.7-rc2/sound/pci/trident/trident_synth.c 2004-05-09 19:32:28.000000000 -0700 +++ linux-2.6.7-rc3/sound/pci/trident/trident_synth.c 2004-06-07 12:55:32.266834339 -0700 @@ -504,7 +504,7 @@ */ static int snd_trident_simple_put_sample(void *private_data, simple_instrument_t * instr, - char *data, long len, int atomic) + char __user *data, long len, int atomic) { trident_t *trident = snd_magic_cast(trident_t, private_data, return -ENXIO); int size = instr->size; @@ -557,7 +557,7 @@ } static int snd_trident_simple_get_sample(void *private_data, simple_instrument_t * instr, - char *data, long len, int atomic) + char __user *data, long len, int atomic) { //trident_t *trident = snd_magic_cast(trident_t, private_data, return -ENXIO); int size = instr->size; diff -urN linux-2.6.7-rc2/sound/pci/vx222/vx222_ops.c linux-2.6.7-rc3/sound/pci/vx222/vx222_ops.c --- linux-2.6.7-rc2/sound/pci/vx222/vx222_ops.c 2004-05-09 19:31:57.000000000 -0700 +++ linux-2.6.7-rc3/sound/pci/vx222/vx222_ops.c 2004-06-07 12:55:32.270834505 -0700 @@ -357,7 +357,8 @@ { unsigned int i; unsigned int port; - unsigned char *image, data; + unsigned char data; + unsigned char __user *image; /* XILINX reset (wait at least 1 milisecond between reset on and off). */ vx_outl(chip, CNTRL, VX_CNTRL_REGISTER_VALUE | VX_XILINX_RESET_MASK); diff -urN linux-2.6.7-rc2/sound/pcmcia/vx/vxp_ops.c linux-2.6.7-rc3/sound/pcmcia/vx/vxp_ops.c --- linux-2.6.7-rc2/sound/pcmcia/vx/vxp_ops.c 2004-05-09 19:32:26.000000000 -0700 +++ linux-2.6.7-rc3/sound/pcmcia/vx/vxp_ops.c 2004-06-07 12:55:32.300835748 -0700 @@ -152,7 +152,8 @@ unsigned int i; int c; int regCSUER, regRUER; - unsigned char *image, data; + unsigned char __user *image; + unsigned char data; /* Switch to programmation mode */ chip->regDIALOG |= VXP_DLG_XILINX_REPROG_MASK; diff -urN linux-2.6.7-rc2/sound/synth/emux/soundfont.c linux-2.6.7-rc3/sound/synth/emux/soundfont.c --- linux-2.6.7-rc2/sound/synth/emux/soundfont.c 2004-05-09 19:32:54.000000000 -0700 +++ linux-2.6.7-rc3/sound/synth/emux/soundfont.c 2004-06-07 12:55:32.416840553 -0700 @@ -34,7 +34,7 @@ /* Prototypes for static functions */ -static int open_patch(snd_sf_list_t *sflist, const char *data, int count, int client); +static int open_patch(snd_sf_list_t *sflist, const char __user *data, int count, int client); static snd_soundfont_t *newsf(snd_sf_list_t *sflist, int type, char *name); static int is_identical_font(snd_soundfont_t *sf, int type, unsigned char *name); static int close_patch(snd_sf_list_t *sflist);