http://linux.bkbits.net/linux-2.5 petero2@telia.com[torvalds]|ChangeSet|20040926164953|06666 petero2 # This is a BitKeeper generated diff -Nru style patch. # # drivers/pci/hotplug/rpaphp_pci.c # 2004/09/13 17:23:15-07:00 anton@samba.org +1 -1 # ppc64: Fix real bugs uncovered by -Wno-uninitialized removal # # ChangeSet # 2004/09/26 09:49:53-07:00 petero2@telia.com # [PATCH] bttv: fix DMA setup bug in latest update # # This fixes the bug that made the card DMA lots of data to random memory # locations, causing lockups and instant reboots. # # The problem was that the yoffset variable got modified inside the loop, # but the logic in the switch statement was meant to work on the initial # value of the yoffset variable. # # (Bug fix extracted from # http://marc.theaimsgroup.com/?l=linux-kernel&m=109532814823565&w=2) # # Signed-off-by: Peter Osterlund # Signed-off-by: Linus Torvalds # # drivers/media/video/bttv-risc.c # 2004/09/25 23:42:24-07:00 petero2@telia.com +3 -2 # bttv: fix DMA setup bug in latest update # # ChangeSet # 2004/09/26 09:46:13-07:00 benh@kernel.crashing.org # [PATCH] ppc64: fix 32-bit SI_TIMER conversion fix # # Agh ! # # I had two patches, a broken one and a good one and ... of course I sent # the broken one, sorry :( # # This fixes the broken fix. # # Signed-off-by: Olaf Hering # Signed-off-by: Benjamin Herrenschmidt # Signed-off-by: Linus Torvalds # # arch/ppc64/kernel/signal32.c # 2004/09/26 09:44:13-07:00 benh@kernel.crashing.org +1 -1 # ppc64: fix 32-bit SI_TIMER conversion fix # # ChangeSet # 2004/09/25 18:56:01-07:00 rth@kanga.twiddle.home # [ALPHA] Regenerate defconfig. # # arch/alpha/defconfig # 2004/09/25 18:55:41-07:00 rth@kanga.twiddle.home +82 -58 # Regenerate. # # ChangeSet # 2004/09/25 18:54:32-07:00 rth@kanga.twiddle.home # [ALPHA] Turn off GENERIC_IOMAP. Arrange for iomap routines # to be linked unconditionally. # # include/asm-alpha/io.h # 2004/09/25 18:54:11-07:00 rth@kanga.twiddle.home +3 -2 # Update comment wrt extern inline. # # arch/alpha/lib/Makefile # 2004/09/25 18:54:11-07:00 rth@kanga.twiddle.home +0 -1 # Remove io.c from lib-y. # # arch/alpha/kernel/io.c # 2004/09/25 18:54:11-07:00 rth@kanga.twiddle.home +1 -2 # Tidy comments. # # arch/alpha/kernel/Makefile # 2004/09/25 18:54:11-07:00 rth@kanga.twiddle.home +1 -1 # Add io.c to obj-y. # # arch/alpha/Kconfig # 2004/09/25 18:54:11-07:00 rth@kanga.twiddle.home +1 -1 # Turn off GENERIC_IOMAP. # # ChangeSet # 2004/09/25 18:41:38-07:00 benh@kernel.crashing.org # [PATCH] ppc64: Fix 32 bits conversion of SI_TIMER signals # # The current 32 bits translation of the SI_TIMER is wrong on ppc64, causing # the tst-timer4 testcase of glibc to fail in 32 bits. This patch fixes it. # # Signed-off-by: Olaf Hering # Signed-off-by: Benjamin Herrenschmidt # Signed-off-by: Linus Torvalds # # include/asm-ppc64/ppc32.h # 2004/09/25 16:37:49-07:00 benh@kernel.crashing.org +4 -2 # ppc64: Fix 32 bits conversion of SI_TIMER signals # # arch/ppc64/kernel/signal32.c # 2004/09/25 16:37:48-07:00 benh@kernel.crashing.org +5 -1 # ppc64: Fix 32 bits conversion of SI_TIMER signals # # ChangeSet # 2004/09/25 18:35:17-07:00 willy@debian.org # [PATCH] fix posix_locks_deadlock() # # The "blocked_list" used for POSIX deadlock detection should only contain # POSIX locks, or posix_locks_deadlock() can get confused. # # As I've noted before (but never posted a patch), we should probably stop # checking for deadlock. POSIX says it's optional for an implementation # to check for deadlock, and since the change to match on tgid, we can # report a deadlock when none exists. # # [ Further explanation for Linus: POSIX locks and BSD locks don't block # each other, so checking that the blocker is a POSIX lock also implies # that the waiter is a POSIX lock. ] # # fs/locks.c # 2004/09/20 12:02:57-07:00 willy@debian.org +2 -1 # fix posix_locks_deadlock() # # arch/alpha/kernel/io.c # 2004/09/25 16:32:42-07:00 rth@kanga.twiddle.home +0 -0 # Rename: arch/alpha/lib/io.c -> arch/alpha/kernel/io.c # # ChangeSet # 2004/09/25 15:51:42-07:00 torvalds@ppc970.osdl.org # Make smbfs with UNIX extensions get file disk usage count right. # # We need to convert from bytes to blocks, and we also need to # handle the fact that old smbd's will round up the disk usage # bytecount to even multiples of 1MB, and gracefully fall back # on an estimate based on the file size instead in that case. # # Acked by Samuel Thibault who noted the problem in the first # place, and Jeremy Allison wrt smbd behavior. # # Signed-off-by: Linus Torvalds # # fs/smbfs/proc.c # 2004/09/25 15:51:36-07:00 torvalds@ppc970.osdl.org +15 -2 # Make smbfs with UNIX extensions get file disk usage count right. # # We need to convert from bytes to blocks, and we also need to # handle the fact that old smbd's will round up the disk usage # bytecount to even multiples of 1MB, and gracefully fall back # on an estimate based on the file size instead in that case. # # Acked by Samuel Thibault who noted the problem in the first # place, and Jeremy Allison wrt smbd behavior. # # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/25 14:12:19-07:00 rth@kanga.twiddle.home # [ALPHA] Fix bitops.h, kernel.h include loop. # # include/asm-alpha/bitops.h # 2004/09/25 14:11:58-07:00 rth@kanga.twiddle.home +0 -1 # Don't include . # # ChangeSet # 2004/09/25 00:33:08+01:00 rmk@flint.arm.linux.org.uk # [ARM] Fix circular include dependency in asm/system.h # # The recent addition of linux/bitops.h inside linux/kernel.h has # created a circular dependency: # # asm/system.h -> linux/kernel.h -> linux/bitops.h -> asm/bitops.h # -> asm/system.h # # which results in an unbuildable kernel. We appear not to need # linux/kernel.h in asm/system.h, but do need linux/linkage.h, so # make this the case. # # include/asm-arm/system.h # 2004/09/25 00:30:41+01:00 rmk@flint.arm.linux.org.uk +2 -3 # Fix circular dependency: # asm/system.h -> linux/kernel.h -> linux/bitops.h -> asm/bitops.h -> asm/system.h # # ChangeSet # 2004/09/24 14:30:24-07:00 kaber@coreworks.de # [NETFILTER]: Move ip_ct_log_invalid to ip_conntrack_core.c # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # net/ipv4/netfilter/ip_conntrack_standalone.c # 2004/09/24 14:30:06-07:00 kaber@coreworks.de +0 -2 # [NETFILTER]: Move ip_ct_log_invalid to ip_conntrack_core.c # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # net/ipv4/netfilter/ip_conntrack_core.c # 2004/09/24 14:30:06-07:00 kaber@coreworks.de +1 -0 # [NETFILTER]: Move ip_ct_log_invalid to ip_conntrack_core.c # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/24 14:16:00-07:00 davem@nuts.davemloft.net # Merge nuts.davemloft.net:/disk1/BK/nf-work-2.6 # into nuts.davemloft.net:/disk1/BK/nf-2.6 # # include/linux/skbuff.h # 2004/09/24 14:15:50-07:00 davem@nuts.davemloft.net +0 -0 # Auto merged # # ChangeSet # 2004/09/24 13:29:02-07:00 davem@nuts.davemloft.net # [SPARC64]: Start timer tick after interpolator is registered. # # Else we risk an OOPS. # # Signed-off-by: David S. Miller # # arch/sparc64/kernel/time.c # 2004/09/24 13:28:19-07:00 davem@nuts.davemloft.net +17 -6 # [SPARC64]: Start timer tick after interpolator is registered. # # ChangeSet # 2004/09/24 12:35:24-07:00 davem@nuts.davemloft.net # [SPARC64]: Update defconfig. # # arch/sparc64/defconfig # 2004/09/24 12:34:56-07:00 davem@nuts.davemloft.net +2 -2 # [SPARC64]: Update defconifg. # # ChangeSet # 2004/09/24 12:13:15-07:00 torvalds@ppc970.osdl.org # The generic iomap library needs to be linked unconditionally. # # Otherwise modules that get loaded dynamically will not be able # to resolve the iomap functions, if no built-in drivers caused # it to be linked in at compile-time. # # lib/Makefile # 2004/09/24 12:13:08-07:00 torvalds@ppc970.osdl.org +1 -1 # The generic iomap library needs to be linked unconditionally. # # Otherwise modules that get loaded dynamically will not be able # to resolve the iomap functions, if no built-in drivers caused # it to be linked in at compile-time. # # ChangeSet # 2004/09/24 11:30:12-07:00 torvalds@ppc970.osdl.org # ppc64: clean up generated files at "make clean" # # It missed the new vmlinux.strip file. # # arch/ppc64/boot/Makefile # 2004/09/24 11:30:05-07:00 torvalds@ppc970.osdl.org +1 -1 # ppc64: clean up generated files at "make clean" # # It missed the new vmlinux.strip file. # # ChangeSet # 2004/09/24 11:28:09-07:00 torvalds@ppc970.osdl.org # fb: add __iomem annotations to cfbimgblt # # drivers/video/cfbimgblt.c # 2004/09/24 11:28:02-07:00 torvalds@ppc970.osdl.org +16 -14 # fb: add __iomem annotations to cfbimgblt # # ChangeSet # 2004/09/24 09:47:32-07:00 janitor@sternwelten.at # [PATCH] compile fix 3c59x for eisa without pci # # # CONFIG_PCI is not set # CONFIG_EISA=y # # drivers/net/3c59x.c: In function `vortex_ioctl': # drivers/net/3c59x.c:2916: warning: dereferencing `void *' pointer # drivers/net/3c59x.c:2916: error: request for member `current_state' in something not a structure or union # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/net/3c59x.c # 2004/09/11 16:00:25-07:00 janitor@sternwelten.at +6 -0 # compile fix 3c59x for eisa without pci # # ChangeSet # 2004/09/24 09:47:20-07:00 clameter@sgi.com # [PATCH] mmtimer quietness # # Quiet mmtimer on non-SGI boxes (previously it printed "mmtimer: unable to # determine clock frequency"). # # Signed-off-by: Bjorn Helgaas # Signed-off-by: Christoph Lameter # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/char/mmtimer.c # 2004/09/24 01:29:53-07:00 clameter@sgi.com +3 -0 # mmtimer quietness # # ChangeSet # 2004/09/24 09:47:08-07:00 jdike@addtoit.com # [PATCH] uml: don't trash return value # # From: Doug Dumitru # # I have been fighting a buffering error when sending large amounts of data out # pty devices from UML. I have tried a couple of patches that did not really # fix the problem (and were rightly rejected by the group), but have finally # found the real bug. # # In /arch/um/drivers/line.c there is a function "buffer_data" that is # responsible for storing data into the lines ring buffer. The function is # "supposed" to return the number of characters actually buffered. # Unfortunately, in the case where the buffer wraps, the "len" variable is # decremented by "end" before it is used as the return parameter. # # Signed-off-by: Paolo 'Blaisorblade' Giarrusso # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/drivers/line.c # 2004/09/24 01:29:53-07:00 jdike@addtoit.com +2 -3 # uml: don't trash return value # # ChangeSet # 2004/09/24 09:46:56-07:00 jdike@addtoit.com # [PATCH] uml: print errno before resetting it # # Make sure we print ERRNO and not always -1. # # Signed-off-by: Paolo 'Blaisorblade' Giarrusso # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/drivers/ubd_kern.c # 2004/09/24 01:29:53-07:00 jdike@addtoit.com +1 -1 # uml: print errno before resetting it # # ChangeSet # 2004/09/24 09:46:44-07:00 jdike@addtoit.com # [PATCH] uml: fix fencepost errors in printks # # Simple corrections to some error messages, which list wrong limits for UBD # devices and such. # # Signed-off-by: Paolo 'Blaisorblade' Giarrusso # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/drivers/ubd_kern.c # 2004/09/24 01:30:28-07:00 jdike@addtoit.com +1 -1 # uml: fix fencepost errors in printks # # arch/um/drivers/line.c # 2004/09/24 01:30:28-07:00 jdike@addtoit.com +1 -1 # uml: fix fencepost errors in printks # # ChangeSet # 2004/09/24 09:46:32-07:00 jdike@addtoit.com # [PATCH] uml: error message improvement # # Output a nice error message for people who need mem > 256M but don't increase # on the host /proc/sys/vm/max_map_count, telling them to do so. # # Signed-off-by: Paolo 'Blaisorblade' Giarrusso # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/kernel/physmem.c # 2004/09/24 01:29:52-07:00 jdike@addtoit.com +6 -1 # uml: error message improvement # # ChangeSet # 2004/09/24 09:46:21-07:00 jdike@addtoit.com # [PATCH] uml: implement current_text_addr # # Signed-off-by: Paolo 'Blaisorblade' Giarrusso # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-um/processor-i386.h # 2004/09/24 01:29:52-07:00 jdike@addtoit.com +7 -0 # uml: implement current_text_addr # # include/asm-um/processor-generic.h # 2004/09/24 01:29:52-07:00 jdike@addtoit.com +0 -2 # uml: implement current_text_addr # # ChangeSet # 2004/09/24 09:46:09-07:00 jdike@addtoit.com # [PATCH] uml: linker script cleanup # # From: "D. Bahi" @ enterasys.com - remove an unneeded line from the dynamic # linker script. # # Signed-off-by: Paolo 'Blaisorblade' Giarrusso # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/kernel/dyn.lds.S # 2004/09/24 01:29:52-07:00 jdike@addtoit.com +0 -3 # uml: linker script cleanup # # ChangeSet # 2004/09/24 09:45:57-07:00 jdike@addtoit.com # [PATCH] uml: allow UML to load in the normal location # # This makes UML load at 0x8048000 rather than 0xa0000000 when CONFIG_MODE_SKAS # is on and CONFIG_MODE_TT is off. This will make it more valgrind-friendly, # and also allow much greater physical memory sizes without needing to use # highmem. # # Signed-off-by: Paolo 'Blaisorblade' Giarrusso # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/Makefile # 2004/09/24 01:29:52-07:00 jdike@addtoit.com +5 -1 # uml: allow UML to load in the normal location # # arch/um/Makefile-i386 # 2004/09/24 01:29:52-07:00 jdike@addtoit.com +6 -0 # uml: allow UML to load in the normal location # # ChangeSet # 2004/09/24 09:45:45-07:00 jdike@addtoit.com # [PATCH] uml: remove an unused header # # Signed-off-by: Paolo 'Blaisorblade' Giarrusso # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # BitKeeper/deleted/.del-mprot.h~269b24b7614dcf2e # 2004/09/24 09:45:38-07:00 jdike@addtoit.com +0 -0 # Delete: arch/um/kernel/mprot.h # # ChangeSet # 2004/09/24 09:45:33-07:00 jdike@addtoit.com # [PATCH] uml: free wrapper fixes # # __wrap_free is now careful about freeing to the same allocator that allocated # the buffer. # # Signed-off-by: Paolo 'Blaisorblade' Giarrusso # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/kernel/main.c # 2004/09/24 01:29:52-07:00 jdike@addtoit.com +10 -5 # uml: free wrapper fixes # # ChangeSet # 2004/09/24 09:45:21-07:00 jdike@addtoit.com # [PATCH] uml: small Makefile fixes # # Tidied up some whitespace in arch/um/Makefile. Added -DUM_FASTCALL to # Makefile-i386. make clean descends into util in order to get rid of the # binaries there. # # Signed-off-by: Paolo 'Blaisorblade' Giarrusso # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/kernel/Makefile # 2004/09/24 01:29:52-07:00 jdike@addtoit.com +5 -0 # uml: small Makefile fixes # # arch/um/Makefile # 2004/09/24 01:30:29-07:00 jdike@addtoit.com +1 -1 # uml: small Makefile fixes # # arch/um/Makefile-i386 # 2004/09/24 01:30:29-07:00 jdike@addtoit.com +5 -0 # uml: small Makefile fixes # # ChangeSet # 2004/09/24 09:45:09-07:00 jdike@addtoit.com # [PATCH] uml: move linker script # # arch/um/uml.lds.S has already been moved to arch/um/kernel. dyn.lds.S has just # been forgotten, so fix this. # # Signed-off-by: Paolo 'Blaisorblade' Giarrusso # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/kernel/dyn.lds.S # 2004/09/24 01:30:29-07:00 jdike@addtoit.com +0 -0 # uml: move linker script # # arch/um/kernel/Makefile # 2004/09/24 01:30:29-07:00 jdike@addtoit.com +1 -1 # uml: move linker script # # ChangeSet # 2004/09/24 09:44:47-07:00 shaohua.li@intel.com # [PATCH] preserve irqs in time_resume() # # Unconditionally enabling interrupts is upsetting the ACPI time resume code. # # Signed-off-by: Li Shaohua # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/i386/kernel/time.c # 2004/09/24 01:27:51-07:00 shaohua.li@intel.com +3 -2 # preserve irqs in time_resume() # # ChangeSet # 2004/09/24 09:44:35-07:00 gj@pointblue.com.pl # [PATCH] gcc-4.0 build fixes # # Fix various gcc-4.0 compilation errors. # # Signed-off-by: Grzegorz Jaskiewicz # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/net/3c507.c # 2004/09/24 01:28:15-07:00 gj@pointblue.com.pl +1 -1 # gcc-4.0 build fixes # # drivers/input/joystick/grip_mp.c # 2004/09/24 01:28:15-07:00 gj@pointblue.com.pl +2 -1 # gcc-4.0 build fixes # # ChangeSet # 2004/09/24 09:44:23-07:00 nathans@sgi.com # [PATCH] Fix generic direct IO code for XFS # # The following patch to the generic direct IO code fixes a problem we've # come across that affects the way XFS interacts with it. Between 2.6.5 and # 2.6.6 several changes to direct IO were made, in particular the # fallback-to-buffered path was introduced in that timeframe. # # Those changes split the locking done within direct-io.c into two cases - # generic filesystems and blkdev/XFS. There is no locking done for the # second case, and we also never set the create parameter to the get_blocks # call (via direct_io_worker ->do_direct_IO->get_more_blocks) for that case. # This meant that XFS was accidentally no longer being told when a direct IO # write was being performed, which in turn meant that XFS would (often - # depending on the inode's size and bmap) tell get_more_blocks that it was # mapping to a hole. It also means that currently all direct writes into XFS # are falling back to buffered writes. Further, skipping the i_alloc_sem # locking entirely is not correct for us, we are relying on that aspect of # the generic locking. # # The fallback behaviour from direct to buffered is "silent", so we didn't # actually pick up on these problems until just recently, unfortunately. # # The approach I've taken here is to split the blkdev/XFS case into two, and # corrected the new third case behaviour for the functionality XFS provides. # The generic behavior used by other filesystems remains unchanged, as does # direct IO to the block device, and XFS now becomes fully functional. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/linux/fs.h # 2004/09/24 01:27:51-07:00 nathans@sgi.com +18 -6 # Fix generic direct IO code for XFS # # fs/xfs/linux-2.6/xfs_aops.c # 2004/09/24 01:27:51-07:00 nathans@sgi.com +1 -1 # Fix generic direct IO code for XFS # # fs/direct-io.c # 2004/09/24 01:27:51-07:00 nathans@sgi.com +29 -19 # Fix generic direct IO code for XFS # # ChangeSet # 2004/09/24 09:44:11-07:00 takata@linux-m32r.org # [PATCH] m32r: support PTRACE_GETREGS and PTRACE_SETREGS # # Add PTRACE_GETREGS and PTRACE_SETREGS functions for the native debugging # support of the GNU Project Debugger, GDB. # # Signed-off-by: Hirokazu Takata # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/m32r/kernel/ptrace.c # 2004/09/24 01:27:51-07:00 takata@linux-m32r.org +320 -290 # m32r: support PTRACE_GETREGS and PTRACE_SETREGS # # ChangeSet # 2004/09/24 09:43:59-07:00 takata@linux-m32r.org # [PATCH] m32r: upgrade for recent kernel changes # # This patch is for upgrading m32r's code to the 2.6.9-rc1-mm5 source as well as # the other architectures. # # * arch/m32r/Makefile: Replace assigment to CHECK with assignment to CHECKFLAGS # # * arch/m32r/kernel/vmlinux.lds.S: # - out-of-line locks / m32r; Include LOCK_TEXT to .text section. # - Move param section out of init area, for export of built-in # module params # # * arch/m32r/mm/ioremap.c (__ioremap): # Add __iomem modifier to the return value type of __ioremap() # for much stricter type-checking. # # * include/asm-m32r/resource.h: # - rlimit-based mlocks for unprivileged users # - Increase per-user mlock limit default to 32k # # * include/asm-m32r/socket.h: # - [NET]: Move SOCK_foo types into linux/net.h # # * include/asm-m32r/unistd.h: # Add system calls; taken from asm-i386/unistd.h. # - [PATCH][2/6] perfctr-2.7.3 for 2.6.7-rc1-mm1: i386 (05/31/2004) # - [PATCH] Make key management use syscalls not prctls (09/06/2004) # # Signed-off-by: Hirokazu Takata # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-m32r/unistd.h # 2004/09/24 01:27:50-07:00 takata@linux-m32r.org +16 -4 # m32r: upgrade for recent kernel changes # # include/asm-m32r/socket.h # 2004/09/24 01:27:50-07:00 takata@linux-m32r.org +0 -20 # m32r: upgrade for recent kernel changes # # include/asm-m32r/resource.h # 2004/09/24 01:27:50-07:00 takata@linux-m32r.org +1 -1 # m32r: upgrade for recent kernel changes # # arch/m32r/mm/ioremap.c # 2004/09/24 01:27:50-07:00 takata@linux-m32r.org +5 -5 # m32r: upgrade for recent kernel changes # # arch/m32r/kernel/vmlinux.lds.S # 2004/09/24 01:27:50-07:00 takata@linux-m32r.org +1 -3 # m32r: upgrade for recent kernel changes # # arch/m32r/Makefile # 2004/09/24 01:27:50-07:00 takata@linux-m32r.org +1 -1 # m32r: upgrade for recent kernel changes # # ChangeSet # 2004/09/24 09:43:47-07:00 pbadari@us.ibm.com # [PATCH] dio fine alignment and pages in io # # Here is the fix for dio_new_bio() BUG() with fsx tests. The problem is, I # changed dio_pages_in_io calculation to be exactly the number of pages we # needed to map the user-buffer to do the IO. But with fine-grain alignment # (non fs-blocksize), we may need 2 more pages (ZERO_PAGE) to zero out first # and last block if needed. # # Here is the bug info. # # http://bugme.osdl.org/show_bug.cgi?id=3447 # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # fs/direct-io.c # 2004/09/24 01:30:30-07:00 pbadari@us.ibm.com +9 -1 # dio fine alignment and pages in io # # ChangeSet # 2004/09/24 09:37:50-07:00 benh@kernel.crashing.org # [PATCH] radeonfb: Fix newer PowerBook & warnings # # This fixes a few warnings in radeonfb and add proper PLL divider values # for Apple latest PowerBook Aliminium 17" so the display isn't "fuzzy" # (the LVDS interface needs special PLL values that the driver can't # calculate, on most x86, the BIOS tells us the values to use, on Apple # laptops, we have to hard code them for each model). # # Signed-off-by: Benjamin Herrenschmidt # Signed-off-by: Linus Torvalds # # drivers/video/aty/radeon_monitor.c # 2004/09/23 22:30:11-07:00 benh@kernel.crashing.org +14 -4 # radeonfb: Fix newer PowerBook & warnings # # drivers/video/aty/radeon_base.c # 2004/09/23 21:41:36-07:00 benh@kernel.crashing.org +1 -1 # radeonfb: Fix newer PowerBook & warnings # # ChangeSet # 2004/09/24 09:37:38-07:00 benh@kernel.crashing.org # [PATCH] ppc32: Fix warning in pmac battery code # # The battery calculation code in via-pmu triggers a few warnings (and # actually, one of them would lead to a real error if we ever get an # unrecognized type from the PMU). Fix this. # # Signed-off-by: Benjamin Herrenschmidt # Signed-off-by: Linus Torvalds # # drivers/macintosh/via-pmu.c # 2004/09/23 21:45:46-07:00 benh@kernel.crashing.org +3 -2 # ppc32: Fix warning in pmac battery code # # ChangeSet # 2004/09/24 09:37:26-07:00 benh@kernel.crashing.org # [PATCH] ppc32: ADB keycode conversion update # # This makes the ADB->Linux keycodes conversion table a lot more readable # (and thus easy to fix :) and adds conversion of the laptop Fn-enter # (keypad enter, also present on apple laptop keyboards on the bottom # right, left of the arrow keys) to "compose" (or menu key on modern PC # keyboard). # # Thanks to Frank Murphy for spotting this keycode # feature of MacOS (and apple docs) # # It also fixes a small possible race in the LED code # # Signed-off-by: Benjamin Herrenschmidt # Signed-off-by: Linus Torvalds # # drivers/macintosh/adbhid.c # 2004/09/23 21:44:53-07:00 benh@kernel.crashing.org +132 -12 # ppc32: ADB keycode conversion update # # ChangeSet # 2004/09/24 09:37:14-07:00 benh@kernel.crashing.org # [PATCH] ppc32/64: Fix warning in pmac ide # # This is a gcc error, but let's fix it anyway, it isn't a perf critical # codepath and warnings are ugly. # # Signed-off-by: Benjamin Herrenschmidt # Signed-off-by: Linus Torvalds # # drivers/ide/ppc/pmac.c # 2004/09/23 21:46:20-07:00 benh@kernel.crashing.org +1 -1 # ppc32/64: Fix warning in pmac ide # # ChangeSet # 2004/09/24 09:35:12-07:00 torvalds@ppc970.osdl.org # ppc: annotate pmac ide driver # # Another bunch of annoying warnings gone, and code cleaned up. # # drivers/ide/ppc/pmac.c # 2004/09/24 09:35:05-07:00 torvalds@ppc970.osdl.org +31 -35 # ppc: annotate pmac ide driver # # Another bunch of annoying warnings gone, and code cleaned up. # # ChangeSet # 2004/09/24 08:59:31-07:00 jbarnes@engr.sgi.com # [PATCH] disable sched domains debug code # # This disables the sched domains debug code, which has a tendency to # print out a *lot* of information. It's helpful for debugging, but a bit # overboard for general use. Also, if you have a high NR_CPUS value, it # tends to scare people and overflow the dmesg buffer. # # Signed-off-by: Nick Piggin # Signed-off-by: Jesse Barnes # Signed-off-by: Linus Torvalds # # kernel/sched.c # 2004/09/24 07:56:00-07:00 jbarnes@engr.sgi.com +1 -1 # disable sched domains debug code # # ChangeSet # 2004/09/24 16:58:01+01:00 aia21@cantab.net # NTFS: Fix a stupid bug where I forgot to actually do the attribute lookup # and then went and used the looked up attribute... Ooops. # # Signed-off-by: Anton Altaparmakov # # fs/ntfs/inode.c # 2004/09/24 16:57:52+01:00 aia21@cantab.net +19 -0 # Fix a stupid bug where I forgot to actually do the attribute lookup and # then went and used the looked up attribute... Ooops. # # ChangeSet # 2004/09/24 14:05:24+01:00 aia21@cantab.net # NTFS: 2.1.19 - Many cleanups, improvements, and a minor bug fix. # # - Fix bug found by the new sparse bitwise warnings where the default # upcase table was defined as a pointer to wchar_t rather than ntfschar # in fs/ntfs/ntfs.h and super.c. # # Signed-off-by: Anton Altaparmakov # # fs/ntfs/super.c # 2004/09/24 14:05:15+01:00 aia21@cantab.net +1 -1 # Fix bug found by the new sparse bitwise warnings where the default # upcase table was defined as a pointer to wchar_t rather than ntfschar # in fs/ntfs/ntfs.h and super.c. # # fs/ntfs/ntfs.h # 2004/09/24 14:05:15+01:00 aia21@cantab.net +1 -1 # Fix bug found by the new sparse bitwise warnings where the default # upcase table was defined as a pointer to wchar_t rather than ntfschar # in fs/ntfs/ntfs.h and super.c. # # fs/ntfs/Makefile # 2004/09/24 14:05:15+01:00 aia21@cantab.net +1 -1 # Update for 2.1.19 release. # # fs/ntfs/ChangeLog # 2004/09/24 14:05:14+01:00 aia21@cantab.net +4 -1 # Update # # Documentation/filesystems/ntfs.txt # 2004/09/24 14:05:14+01:00 aia21@cantab.net +5 -0 # Update for 2.1.19 release. # # ChangeSet # 2004/09/24 13:54:52+01:00 aia21@cantab.net # NTFS: Finish off sparse annotation. # # - Fix all the sparse bitwise warnings. Had to change all the enums # storing little endian values to #defines because we cannot set enums # to be little endian so we had lots of bitwise warnings from sparse. # # Signed-off-by: Anton Altaparmakov # # fs/ntfs/upcase.c # 2004/09/24 13:54:42+01:00 aia21@cantab.net +1 -2 # Remove trailing line. # # fs/ntfs/unistr.c # 2004/09/24 13:54:42+01:00 aia21@cantab.net +4 -4 # Fixes for sparse bitwise warnings. # # fs/ntfs/super.c # 2004/09/24 13:54:42+01:00 aia21@cantab.net +3 -2 # Fixes for sparse bitwise warnings. # # fs/ntfs/quota.c # 2004/09/24 13:54:42+01:00 aia21@cantab.net +1 -1 # Fixes for sparse bitwise warnings. # # fs/ntfs/mst.c # 2004/09/24 13:54:42+01:00 aia21@cantab.net +12 -11 # Fixes for sparse bitwise warnings. # # fs/ntfs/mft.c # 2004/09/24 13:54:42+01:00 aia21@cantab.net +5 -5 # Fixes for sparse bitwise warnings. # # fs/ntfs/logfile.h # 2004/09/24 13:54:41+01:00 aia21@cantab.net +1 -1 # Fixes for sparse bitwise warnings. # # fs/ntfs/layout.h # 2004/09/24 13:54:41+01:00 aia21@cantab.net +416 -433 # Fixes for sparse bitwise warnings. Had to change all the enums storing # little endian values to #defines because we cannot set enums to be little # endian so we had lots of bitwise warnings from sparse. # # fs/ntfs/inode.h # 2004/09/24 13:54:41+01:00 aia21@cantab.net +4 -4 # Fixes for sparse bitwise warnings. # # fs/ntfs/inode.c # 2004/09/24 13:54:41+01:00 aia21@cantab.net +2 -2 # Fixes for sparse bitwise warnings. # # fs/ntfs/compress.c # 2004/09/24 13:54:41+01:00 aia21@cantab.net +4 -4 # Fixes for sparse bitwise warnings. # # fs/ntfs/collate.h # 2004/09/24 13:54:41+01:00 aia21@cantab.net +7 -5 # Fixes for sparse bitwise warnings. # # fs/ntfs/collate.c # 2004/09/24 13:54:41+01:00 aia21@cantab.net +11 -9 # Fixes for sparse bitwise warnings. # # fs/ntfs/attrib.h # 2004/09/24 13:54:40+01:00 aia21@cantab.net +1 -1 # Fixes for sparse bitwise warnings. # # fs/ntfs/attrib.c # 2004/09/24 13:54:40+01:00 aia21@cantab.net +5 -4 # Fixes for sparse bitwise warnings. # # fs/ntfs/ChangeLog # 2004/09/24 13:54:40+01:00 aia21@cantab.net +3 -0 # Update # # ChangeSet # 2004/09/24 11:12:17+01:00 aia21@cantab.net # NTFS: Continuing sparse annotations: finish data types and header files. # # - Add leMFT_REF data type to fs/ntfs/layout.h. # - Update all NTFS header files with the new little endian data types. # Affected files are fs/ntfs/layout.h, logfile.h, and time.h. # - Do proper type casting when using ntfs_is_*_recordp() in # fs/ntfs/logfile.c, mft.c, and super.c. # # Signed-off-by: Anton Altaparmakov # # fs/ntfs/time.h # 2004/09/24 11:12:09+01:00 aia21@cantab.net +3 -3 # Update with new little endian data types. # # fs/ntfs/super.c # 2004/09/24 11:12:08+01:00 aia21@cantab.net +7 -5 # Do proper type casting when using ntfs_is_*_recordp(). # # fs/ntfs/mft.c # 2004/09/24 11:12:08+01:00 aia21@cantab.net +1 -1 # Do proper type casting when using ntfs_is_*_recordp(). # # fs/ntfs/logfile.h # 2004/09/24 11:12:08+01:00 aia21@cantab.net +33 -33 # Update with new little endian data types. # # fs/ntfs/logfile.c # 2004/09/24 11:12:08+01:00 aia21@cantab.net +4 -4 # Do proper type casting when using ntfs_is_*_recordp(). # # fs/ntfs/layout.h # 2004/09/24 11:12:08+01:00 aia21@cantab.net +190 -177 # Update with new little endian data types. # # fs/ntfs/ChangeLog # 2004/09/24 11:12:08+01:00 aia21@cantab.net +5 -0 # Update # # ChangeSet # 2004/09/24 10:02:18+01:00 aia21@cantab.net # NTFS: Begin of sparse annotations: new data types and endianness conversion. # # - Add le{16,32,64} as well as sle{16,32,64} data types to fs/ntfs/types.h. # - Change ntfschar to be le16 instead of u16 in fs/ntfs/types.h. # - Add le versions of VCN, LCN, and LSN called leVCN, leLCN, and leLSN, # respectively, to fs/ntfs/types.h. # - Update endianness conversion macros in fs/ntfs/endian.h to use the # new types as appropriate. # - Do proper type casting when using sle64_to_cpup() in fs/ntfs/dir.c # and index.c. # # Signed-off-by: Anton Altaparmakov # # fs/ntfs/types.h # 2004/09/24 10:02:08+01:00 aia21@cantab.net +13 -1 # - Add le{16,32,64} as well as sle{16,32,64} data types. # - Change ntfschar to be le16 instead of u16. # - Add le versions of VCN, LCN, and LSN called leVCN, leLCN, and leLSN. # # fs/ntfs/index.c # 2004/09/24 10:02:08+01:00 aia21@cantab.net +2 -2 # Do proper type casting when using sle64_to_cpup(). # # fs/ntfs/endian.h # 2004/09/24 10:02:08+01:00 aia21@cantab.net +62 -16 # Update endianness conversion macros to use the new little endian types # as appropriate. # # fs/ntfs/dir.c # 2004/09/24 10:02:08+01:00 aia21@cantab.net +3 -2 # Do proper type casting when using sle64_to_cpup(). # # fs/ntfs/ChangeLog # 2004/09/24 10:02:07+01:00 aia21@cantab.net +9 -0 # Update # # ChangeSet # 2004/09/23 18:24:13-07:00 benh@kernel.crashing.org # [PATCH] ppc32: Fix typo/bug in bus resource allocation # # The code re-allocating new bus resources in case of conflicts use a # function called probe_resource(), which has a typo (spotted by the # uninitialized variable use of gcc) causing it to potentially return # bogus results. This fixes it: # # Signed-off-by: Benjamin Herrenschmidt # Signed-off-by: Linus Torvalds # # arch/ppc/kernel/pci.c # 2004/09/23 18:08:49-07:00 benh@kernel.crashing.org +1 -1 # ppc32: Fix typo/bug in bus resource allocation # # ChangeSet # 2004/09/23 18:14:24-07:00 benh@kernel.crashing.org # [PATCH] ppc32: adapt prom_init to offb change # # The changes to prom_init/offb interaction introduced by the ppc64 # monster cleanup patch need a fix to ppc32 prom_init so that offb # works again. ppc32 prom_init() could use a lot more cleanup, but # let's do the minimal fix to make it work now. # # Signed-off-by: Benjamin Herrenschmidt # Signed-off-by: Linus Torvalds # # arch/ppc/syslib/prom_init.c # 2004/09/23 17:59:24-07:00 benh@kernel.crashing.org +20 -4 # ppc32: adapt prom_init to offb change # # ChangeSet # 2004/09/23 18:14:12-07:00 benh@kernel.crashing.org # [PATCH] ppc32: Fix use of uninitialized pointer in offb # # The recent ppc64 changes for offb introduced an uninitialized pointer # use for ppc32, here's the fix: # # Signed-off-by: Benjamin Herrenschmidt # Signed-off-by: Linus Torvalds # # drivers/video/offb.c # 2004/09/23 17:29:23-07:00 benh@kernel.crashing.org +1 -1 # ppc32: Fix use of uninitialized pointer in offb # # ChangeSet # 2004/09/23 18:14:00-07:00 benh@kernel.crashing.org # [PATCH] ppc32: Fix type/bug in pmac_feature.c # # A typo in pmac_feature.c can cause us to use a bogus node pointer when # iterating the i2c controllers during boot. Fortunately, it seems that # we always find the one we are looking for first, and thus never ended # up in an inifinite loop here, but let's fix it and fix the warning at # the same time. # # Signed-off-by: Benjamin Herrenschmidt # Signed-off-by: Linus Torvalds # # arch/ppc/platforms/pmac_feature.c # 2004/09/23 17:23:15-07:00 benh@kernel.crashing.org +1 -1 # ppc32: Fix type/bug in pmac_feature.c # # ChangeSet # 2004/09/23 18:13:48-07:00 benh@kernel.crashing.org # [PATCH] ppc32: Fix potentially uninitialized var in chrp_setup.c # # In chrp_setup.c, chrp_int_ack could be left uninitialized and passed # "as-is" to i8259_init() if the OF node for the 8259 wasn't found. I # don't know if that should happen, but the i8259 code can deal with # int_ack beeing 0, so let's be safe, initialize it, and remove a warning # at the same time. # # Signed-off-by: Benjamin Herrenschmidt # Signed-off-by: Linus Torvalds # # arch/ppc/platforms/chrp_setup.c # 2004/09/23 17:19:34-07:00 benh@kernel.crashing.org +1 -1 # ppc32: Fix potentially uninitialized var in chrp_setup.c # # ChangeSet # 2004/09/23 18:13:36-07:00 benh@kernel.crashing.org # [PATCH] ppc32: Fix bogus return value in pmac_cpufreq.c # # There's an obvious uninitialized return value in pmac_cpufreq, here's # a fix: # # Signed-off-by: Benjamin Herrenschmidt # Signed-off-by: Linus Torvalds # # arch/ppc/platforms/pmac_cpufreq.c # 2004/09/23 17:15:41-07:00 benh@kernel.crashing.org +1 -2 # ppc32: Fix bogus return value in pmac_cpufreq.c # # ChangeSet # 2004/09/23 18:13:24-07:00 benh@kernel.crashing.org # [PATCH] ppc32: Fix Apple Xserve G4 PCI probing # # When pci_assign_all_busses is set, the common code will re-assign all # the bus numbers, which we still need to do one various pmacs, at least # until XFree/XOrg understands PCI domains properly. However, this # process triggers a bug if during this renumbering, on a given segment, a # P2P bridge not yet renumbered has conflicting downstream bus range with # a P2P bridge just renumbered. The probing will just behave randomly and # either miss devices, show duplicates, or just lockup in some # circumstances. This is typically triggered on Apple Xserve G4s who have # at least 2 P2P bridges built-in on the same segment of the first PCI # (non-AGP) domain # # The "workaround" we use on pmac that was in my tree for a while but got # "lost" during the big merge a while ago is to offset the bus numbers # between domains by 16. This avoids the above collision scenario in all # practical cases. # # The long term solution of course is to stop renumbering and make sure # that all drivers are domain safe (there may be a couple issue remaining # in the code that matches PCI / OF devices on ppc32) and XFree/XOrg has # to be fixed. # # Signed-off-by: Benjamin Herrenschmidt # Signed-off-by: Linus Torvalds # # arch/ppc/platforms/pmac_pci.c # 2004/09/20 18:17:40-07:00 benh@kernel.crashing.org +9 -0 # ppc32: Fix Apple Xserve G4 PCI probing # # arch/ppc/kernel/pci.c # 2004/09/20 18:17:40-07:00 benh@kernel.crashing.org +2 -1 # ppc32: Fix Apple Xserve G4 PCI probing # # ChangeSet # 2004/09/23 23:14:45+00:00 tony.luck@intel.com # [IA64] When we exhaust the supply of records to read, clear the event status. # # Patch written by Ben Woodard. Sanity checked by Jesse Barnes. # # Signed-off-by: Tony Luck # # arch/ia64/kernel/salinfo.c # 2004/09/23 23:12:16+00:00 aegl@agluck-lia64.sc.intel.com +6 -1 # When we exhaust the supply of records to read, clear the event status. # # ChangeSet # 2004/09/23 16:09:54-07:00 benh@kernel.crashing.org # [PATCH] ppc64: monster cleanup # # This is the third & hopefully final version of the monster cleanup # patch. It does significant cleanups of the early boot code of the # ppc64 kernel, and begins the long process of cleaning up & splitting # properly the platform support. # # It completely reworks the interface between the early code that is # run in the firmware context (prom_init) and the rest of the kernel, # in such a way that will make kexec or static device-tree for embedded # people possible. The early init code can eventually be moved to a # separate link entity, it no longer touches any of the kernel globals, # everything is passed via a single blob of data in memory containing # a flattened version of the device-tree and a memory reserve map. # # While doing it, I also cut the ties between pSeries and Powermac. Now, # the kernel config provides a choice between legacy iSeries and # "multiplatform". The later is a set of various supported platform, # each of them beeing a boolean switch, currently defined beeing pSeries # and PowerMac. You can enable both or just one of them. CONFIG_PPC_PSERIES # is now specifically set for IBM pSeries support, you can build a PowerMac # kernel without pSeries support if you which. # The main goal here is to simplify addition of new platform types. # # Signed-off-by: Benjamin Herrenschmidt # Signed-off-by: Linus Torvalds # # include/asm-ppc64/plpar_wrappers.h # 2004/09/23 16:09:46-07:00 benh@kernel.crashing.org +109 -0 # # include/asm-ppc64/smp.h # 2004/09/15 04:53:31-07:00 benh@kernel.crashing.org +1 -0 # ppc64: monster cleanup # # include/asm-ppc64/rtas.h # 2004/09/21 22:42:53-07:00 benh@kernel.crashing.org +2 -1 # ppc64: monster cleanup # # include/asm-ppc64/prom.h # 2004/09/20 18:17:43-07:00 benh@kernel.crashing.org +40 -31 # ppc64: monster cleanup # # include/asm-ppc64/plpar_wrappers.h # 2004/09/23 16:09:46-07:00 benh@kernel.crashing.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-ppc64/plpar_wrappers.h # # include/asm-ppc64/pgtable.h # 2004/09/20 18:17:43-07:00 benh@kernel.crashing.org +9 -8 # ppc64: monster cleanup # # include/asm-ppc64/pci-bridge.h # 2004/09/21 01:15:00-07:00 benh@kernel.crashing.org +5 -2 # ppc64: monster cleanup # # include/asm-ppc64/machdep.h # 2004/09/20 23:07:38-07:00 benh@kernel.crashing.org +5 -3 # ppc64: monster cleanup # # include/asm-ppc64/lmb.h # 2004/09/16 21:35:46-07:00 benh@kernel.crashing.org +2 -6 # ppc64: monster cleanup # # include/asm-ppc64/iommu.h # 2004/09/20 18:17:43-07:00 benh@kernel.crashing.org +6 -3 # ppc64: monster cleanup # # include/asm-ppc64/eeh.h # 2004/09/23 00:36:24-07:00 benh@kernel.crashing.org +4 -0 # ppc64: monster cleanup # # include/asm-ppc64/btext.h # 2004/09/21 00:23:26-07:00 benh@kernel.crashing.org +8 -11 # ppc64: monster cleanup # # drivers/video/offb.c # 2004/09/23 00:36:23-07:00 benh@kernel.crashing.org +17 -10 # ppc64: monster cleanup # # arch/ppc64/xmon/xmon.c # 2004/09/21 00:22:34-07:00 benh@kernel.crashing.org +19 -21 # ppc64: monster cleanup # # arch/ppc64/oprofile/common.c # 2004/09/15 04:53:26-07:00 benh@kernel.crashing.org +1 -1 # ppc64: monster cleanup # # arch/ppc64/mm/hash_utils.c # 2004/09/22 02:56:17-07:00 benh@kernel.crashing.org +31 -11 # ppc64: monster cleanup # # arch/ppc64/mm/hash_native.c # 2004/09/21 21:40:30-07:00 benh@kernel.crashing.org +49 -43 # ppc64: monster cleanup # # arch/ppc64/mm/Makefile # 2004/09/20 18:17:40-07:00 benh@kernel.crashing.org +1 -0 # ppc64: monster cleanup # # arch/ppc64/kernel/udbg.c # 2004/09/21 00:22:33-07:00 benh@kernel.crashing.org +49 -7 # ppc64: monster cleanup # # arch/ppc64/kernel/time.c # 2004/09/21 22:42:50-07:00 benh@kernel.crashing.org +1 -1 # ppc64: monster cleanup # # arch/ppc64/kernel/sysfs.c # 2004/09/21 00:22:33-07:00 benh@kernel.crashing.org +39 -31 # ppc64: monster cleanup # # arch/ppc64/kernel/smp.c # 2004/09/22 02:56:17-07:00 benh@kernel.crashing.org +48 -7 # ppc64: monster cleanup # # arch/ppc64/kernel/setup.c # 2004/09/23 00:38:47-07:00 benh@kernel.crashing.org +407 -168 # ppc64: monster cleanup # # arch/ppc64/kernel/rtas.c # 2004/09/21 22:42:50-07:00 benh@kernel.crashing.org +76 -2 # ppc64: monster cleanup # # arch/ppc64/kernel/prom_init.c # 2004/09/23 16:09:45-07:00 benh@kernel.crashing.org +1718 -0 # # arch/ppc64/kernel/prom.c # 2004/09/22 02:56:16-07:00 benh@kernel.crashing.org +586 -1702 # ppc64: monster cleanup # # arch/ppc64/kernel/ppc_ksyms.c # 2004/09/15 04:53:26-07:00 benh@kernel.crashing.org +0 -1 # ppc64: monster cleanup # # arch/ppc64/kernel/pmac_setup.c # 2004/09/22 02:56:16-07:00 benh@kernel.crashing.org +129 -140 # ppc64: monster cleanup # # arch/ppc64/kernel/pmac_pci.c # 2004/09/21 00:22:33-07:00 benh@kernel.crashing.org +3 -0 # ppc64: monster cleanup # # arch/ppc64/kernel/pmac_iommu.c # 2004/09/21 00:22:33-07:00 benh@kernel.crashing.org +21 -5 # ppc64: monster cleanup # # arch/ppc64/kernel/pmac_feature.c # 2004/09/16 21:34:55-07:00 benh@kernel.crashing.org +2 -2 # ppc64: monster cleanup # # arch/ppc64/kernel/pmac.h # 2004/09/21 00:22:33-07:00 benh@kernel.crashing.org +2 -0 # ppc64: monster cleanup # # arch/ppc64/kernel/pci_iommu.c # 2004/09/20 18:17:40-07:00 benh@kernel.crashing.org +2 -2 # ppc64: monster cleanup # # arch/ppc64/kernel/pci.c # 2004/09/21 01:14:56-07:00 benh@kernel.crashing.org +330 -11 # ppc64: monster cleanup # # arch/ppc64/kernel/pSeries_setup.c # 2004/09/22 02:56:16-07:00 benh@kernel.crashing.org +213 -100 # ppc64: monster cleanup # # arch/ppc64/kernel/pSeries_pci.c # 2004/09/21 01:14:56-07:00 benh@kernel.crashing.org +35 -328 # ppc64: monster cleanup # # arch/ppc64/kernel/pSeries_lpar.c # 2004/09/21 21:40:30-07:00 benh@kernel.crashing.org +53 -291 # ppc64: monster cleanup # # arch/ppc64/kernel/pSeries_iommu.c # 2004/09/20 18:17:40-07:00 benh@kernel.crashing.org +175 -21 # ppc64: monster cleanup # # arch/ppc64/kernel/open_pic_u3.c # 2004/09/20 18:17:40-07:00 benh@kernel.crashing.org +1 -1 # ppc64: monster cleanup # # arch/ppc64/kernel/open_pic.c # 2004/09/20 18:17:40-07:00 benh@kernel.crashing.org +0 -5 # ppc64: monster cleanup # # arch/ppc64/kernel/nvram.c # 2004/09/21 00:22:33-07:00 benh@kernel.crashing.org +2 -0 # ppc64: monster cleanup # # arch/ppc64/kernel/misc.S # 2004/09/21 00:22:33-07:00 benh@kernel.crashing.org +105 -12 # ppc64: monster cleanup # # arch/ppc64/kernel/lmb.c # 2004/09/22 02:56:16-07:00 benh@kernel.crashing.org +45 -16 # ppc64: monster cleanup # # arch/ppc64/kernel/idle.c # 2004/09/22 02:56:16-07:00 benh@kernel.crashing.org +27 -14 # ppc64: monster cleanup # # arch/ppc64/kernel/iSeries_setup.h # 2004/09/22 02:56:16-07:00 benh@kernel.crashing.org +0 -4 # ppc64: monster cleanup # # arch/ppc64/kernel/iSeries_setup.c # 2004/09/22 23:32:29-07:00 benh@kernel.crashing.org +82 -37 # ppc64: monster cleanup # # arch/ppc64/kernel/iSeries_htab.c # 2004/09/21 00:22:33-07:00 benh@kernel.crashing.org +2 -0 # ppc64: monster cleanup # # arch/ppc64/kernel/head.S # 2004/09/22 23:32:29-07:00 benh@kernel.crashing.org +100 -53 # ppc64: monster cleanup # # arch/ppc64/kernel/entry.S # 2004/09/21 00:22:33-07:00 benh@kernel.crashing.org +7 -6 # ppc64: monster cleanup # # arch/ppc64/kernel/btext.c # 2004/09/21 00:22:33-07:00 benh@kernel.crashing.org +117 -112 # ppc64: monster cleanup # # arch/ppc64/kernel/asm-offsets.c # 2004/09/15 04:53:25-07:00 benh@kernel.crashing.org +0 -2 # ppc64: monster cleanup # # arch/ppc64/kernel/Makefile # 2004/09/20 18:17:40-07:00 benh@kernel.crashing.org +5 -4 # ppc64: monster cleanup # # arch/ppc64/configs/pSeries_defconfig # 2004/09/23 00:38:47-07:00 benh@kernel.crashing.org +17 -12 # ppc64: monster cleanup # # arch/ppc64/configs/g5_defconfig # 2004/09/23 00:38:47-07:00 benh@kernel.crashing.org +113 -73 # ppc64: monster cleanup # # arch/ppc64/boot/zImage.lds # 2004/09/16 21:34:55-07:00 benh@kernel.crashing.org +1 -11 # ppc64: monster cleanup # # arch/ppc64/boot/main.c # 2004/09/20 18:17:40-07:00 benh@kernel.crashing.org +66 -104 # ppc64: monster cleanup # # arch/ppc64/boot/Makefile # 2004/09/23 00:36:23-07:00 benh@kernel.crashing.org +15 -19 # ppc64: monster cleanup # # arch/ppc64/Kconfig # 2004/09/20 18:17:40-07:00 benh@kernel.crashing.org +18 -12 # ppc64: monster cleanup # # arch/ppc64/kernel/prom_init.c # 2004/09/23 16:09:45-07:00 benh@kernel.crashing.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/ppc64/kernel/prom_init.c # # BitKeeper/deleted/.del-bootx.h~747483e075b8fe07 # 2004/09/23 16:09:45-07:00 benh@kernel.crashing.org +0 -0 # Delete: include/asm-ppc64/bootx.h # # BitKeeper/deleted/.del-addSystemMap.c~8479be7e8239c05c # 2004/09/23 16:09:45-07:00 benh@kernel.crashing.org +0 -0 # Delete: arch/ppc64/boot/addSystemMap.c # # ChangeSet # 2004/09/23 14:52:33-07:00 kaber@coreworks.de # [NETFILTER]: add comment match # # 2.4 version by Brad Fisher # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # net/ipv4/netfilter/Makefile # 2004/09/23 14:52:06-07:00 kaber@coreworks.de +1 -6 # [NETFILTER]: add comment match # # 2.4 version by Brad Fisher # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # net/ipv4/netfilter/Kconfig # 2004/09/23 14:52:06-07:00 kaber@coreworks.de +10 -0 # [NETFILTER]: add comment match # # 2.4 version by Brad Fisher # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # net/ipv4/netfilter/ipt_comment.c # 2004/09/23 14:51:58-07:00 kaber@coreworks.de +59 -0 # [NETFILTER]: add comment match # # 2.4 version by Brad Fisher # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # net/ipv4/netfilter/ipt_comment.c # 2004/09/23 14:51:58-07:00 kaber@coreworks.de +0 -0 # BitKeeper file /disk1/BK/nf-2.6/net/ipv4/netfilter/ipt_comment.c # # include/linux/netfilter_ipv4/ipt_comment.h # 2004/09/23 14:51:57-07:00 kaber@coreworks.de +10 -0 # [NETFILTER]: add comment match # # 2.4 version by Brad Fisher # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # include/linux/netfilter_ipv4/ipt_comment.h # 2004/09/23 14:51:57-07:00 kaber@coreworks.de +0 -0 # BitKeeper file /disk1/BK/nf-2.6/include/linux/netfilter_ipv4/ipt_comment.h # # ChangeSet # 2004/09/23 14:50:37-07:00 kaber@coreworks.de # [NETFILTER]: Fix invalid return values in sctp_new # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # net/ipv4/netfilter/ip_conntrack_proto_sctp.c # 2004/09/23 14:50:19-07:00 kaber@coreworks.de +5 -5 # [NETFILTER]: Fix invalid return values in sctp_new # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/23 14:46:15-07:00 kaber@coreworks.de # [NETFILTER]: Fix two broken assertions # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # net/ipv4/netfilter/ip_nat_core.c # 2004/09/23 14:45:57-07:00 kaber@coreworks.de +2 -6 # [NETFILTER]: Fix two broken assertions # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # net/ipv4/netfilter/ip_conntrack_core.c # 2004/09/23 14:45:57-07:00 kaber@coreworks.de +1 -1 # [NETFILTER]: Fix two broken assertions # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/23 14:45:27-07:00 gandalf@wlug.westbo.se # [NETFILTER]: Cleanup ctstat # # This patch simply adds a macro to increase the statistics. # And it changes icmp_error to error in struct ip_conntrack_stat in order # to adopt to the tcp-windowtracking changes. # # Based on patch by Pablo Neira. # # Signed-off-by: Martin Josefsson # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # net/ipv4/netfilter/ip_conntrack_standalone.c # 2004/09/23 14:45:10-07:00 gandalf@wlug.westbo.se +1 -1 # [NETFILTER]: Cleanup ctstat # # This patch simply adds a macro to increase the statistics. # And it changes icmp_error to error in struct ip_conntrack_stat in order # to adopt to the tcp-windowtracking changes. # # Based on patch by Pablo Neira. # # Signed-off-by: Martin Josefsson # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # net/ipv4/netfilter/ip_conntrack_core.c # 2004/09/23 14:45:10-07:00 gandalf@wlug.westbo.se +16 -15 # [NETFILTER]: Cleanup ctstat # # This patch simply adds a macro to increase the statistics. # And it changes icmp_error to error in struct ip_conntrack_stat in order # to adopt to the tcp-windowtracking changes. # # Based on patch by Pablo Neira. # # Signed-off-by: Martin Josefsson # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # include/linux/netfilter_ipv4/ip_conntrack.h # 2004/09/23 14:45:10-07:00 gandalf@wlug.westbo.se +2 -1 # [NETFILTER]: Cleanup ctstat # # This patch simply adds a macro to increase the statistics. # And it changes icmp_error to error in struct ip_conntrack_stat in order # to adopt to the tcp-windowtracking changes. # # Based on patch by Pablo Neira. # # Signed-off-by: Martin Josefsson # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/23 14:42:59-07:00 kaber@coreworks.de # [NETFILTER]: Keep conntrack/nat protocols in array instead of linked list # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # net/ipv4/netfilter/ip_nat_standalone.c # 2004/09/23 14:42:34-07:00 kaber@coreworks.de +5 -10 # [NETFILTER]: Keep conntrack/nat protocols in array instead of linked list # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # net/ipv4/netfilter/ip_nat_proto_unknown.c # 2004/09/23 14:42:34-07:00 kaber@coreworks.de +2 -2 # [NETFILTER]: Keep conntrack/nat protocols in array instead of linked list # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # net/ipv4/netfilter/ip_nat_proto_udp.c # 2004/09/23 14:42:34-07:00 kaber@coreworks.de +1 -1 # [NETFILTER]: Keep conntrack/nat protocols in array instead of linked list # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # net/ipv4/netfilter/ip_nat_proto_tcp.c # 2004/09/23 14:42:34-07:00 kaber@coreworks.de +1 -1 # [NETFILTER]: Keep conntrack/nat protocols in array instead of linked list # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # net/ipv4/netfilter/ip_nat_proto_icmp.c # 2004/09/23 14:42:34-07:00 kaber@coreworks.de +1 -1 # [NETFILTER]: Keep conntrack/nat protocols in array instead of linked list # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # net/ipv4/netfilter/ip_nat_core.c # 2004/09/23 14:42:34-07:00 kaber@coreworks.de +11 -28 # [NETFILTER]: Keep conntrack/nat protocols in array instead of linked list # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # net/ipv4/netfilter/ip_conntrack_standalone.c # 2004/09/23 14:42:34-07:00 kaber@coreworks.de +8 -17 # [NETFILTER]: Keep conntrack/nat protocols in array instead of linked list # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # net/ipv4/netfilter/ip_conntrack_proto_sctp.c # 2004/09/23 14:42:34-07:00 kaber@coreworks.de +0 -1 # [NETFILTER]: Keep conntrack/nat protocols in array instead of linked list # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # net/ipv4/netfilter/ip_conntrack_core.c # 2004/09/23 14:42:34-07:00 kaber@coreworks.de +6 -35 # [NETFILTER]: Keep conntrack/nat protocols in array instead of linked list # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # include/linux/netfilter_ipv4/ip_nat_protocol.h # 2004/09/23 14:42:34-07:00 kaber@coreworks.de +14 -2 # [NETFILTER]: Keep conntrack/nat protocols in array instead of linked list # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # include/linux/netfilter_ipv4/ip_nat_core.h # 2004/09/23 14:42:34-07:00 kaber@coreworks.de +0 -6 # [NETFILTER]: Keep conntrack/nat protocols in array instead of linked list # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # include/linux/netfilter_ipv4/ip_conntrack_protocol.h # 2004/09/23 14:42:34-07:00 kaber@coreworks.de +9 -3 # [NETFILTER]: Keep conntrack/nat protocols in array instead of linked list # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # include/linux/netfilter_ipv4/ip_conntrack_core.h # 2004/09/23 14:42:34-07:00 kaber@coreworks.de +0 -4 # [NETFILTER]: Keep conntrack/nat protocols in array instead of linked list # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/23 14:40:42-07:00 kaber@coreworks.de # [NETFILTER]: Use u_int16_t for initialized/num_manips in struct ip_nat_info # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # include/linux/netfilter_ipv4/ip_nat.h # 2004/09/23 14:40:25-07:00 kaber@coreworks.de +2 -2 # [NETFILTER]: Use u_int16_t for initialized/num_manips in struct ip_nat_info # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/23 14:40:01-07:00 kaber@coreworks.de # [NETFILTER]: kill struct nf_ct_info, saves five pointers per conntrack # # The relationship of the skb to the conntrack is stored in a new field # in the skb. # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # net/ipv6/ip6_output.c # 2004/09/23 14:39:26-07:00 kaber@coreworks.de +1 -0 # [NETFILTER]: kill struct nf_ct_info, saves five pointers per conntrack # # The relationship of the skb to the conntrack is stored in a new field # in the skb. # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # net/ipv4/netfilter/ipt_state.c # 2004/09/23 14:39:26-07:00 kaber@coreworks.de +2 -2 # [NETFILTER]: kill struct nf_ct_info, saves five pointers per conntrack # # The relationship of the skb to the conntrack is stored in a new field # in the skb. # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # net/ipv4/netfilter/ipt_conntrack.c # 2004/09/23 14:39:26-07:00 kaber@coreworks.de +1 -1 # [NETFILTER]: kill struct nf_ct_info, saves five pointers per conntrack # # The relationship of the skb to the conntrack is stored in a new field # in the skb. # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # net/ipv4/netfilter/ipt_REJECT.c # 2004/09/23 14:39:26-07:00 kaber@coreworks.de +6 -6 # [NETFILTER]: kill struct nf_ct_info, saves five pointers per conntrack # # The relationship of the skb to the conntrack is stored in a new field # in the skb. # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # net/ipv4/netfilter/ipt_NOTRACK.c # 2004/09/23 14:39:26-07:00 kaber@coreworks.de +2 -1 # [NETFILTER]: kill struct nf_ct_info, saves five pointers per conntrack # # The relationship of the skb to the conntrack is stored in a new field # in the skb. # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # net/ipv4/netfilter/ip_fw_compat_masq.c # 2004/09/23 14:39:26-07:00 kaber@coreworks.de +3 -3 # [NETFILTER]: kill struct nf_ct_info, saves five pointers per conntrack # # The relationship of the skb to the conntrack is stored in a new field # in the skb. # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # net/ipv4/netfilter/ip_conntrack_proto_icmp.c # 2004/09/23 14:39:26-07:00 kaber@coreworks.de +2 -1 # [NETFILTER]: kill struct nf_ct_info, saves five pointers per conntrack # # The relationship of the skb to the conntrack is stored in a new field # in the skb. # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # net/ipv4/netfilter/ip_conntrack_core.c # 2004/09/23 14:39:26-07:00 kaber@coreworks.de +15 -47 # [NETFILTER]: kill struct nf_ct_info, saves five pointers per conntrack # # The relationship of the skb to the conntrack is stored in a new field # in the skb. # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # net/ipv4/ip_output.c # 2004/09/23 14:39:26-07:00 kaber@coreworks.de +1 -0 # [NETFILTER]: kill struct nf_ct_info, saves five pointers per conntrack # # The relationship of the skb to the conntrack is stored in a new field # in the skb. # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # net/core/skbuff.c # 2004/09/23 14:39:26-07:00 kaber@coreworks.de +2 -0 # [NETFILTER]: kill struct nf_ct_info, saves five pointers per conntrack # # The relationship of the skb to the conntrack is stored in a new field # in the skb. # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # net/core/netfilter.c # 2004/09/23 14:39:26-07:00 kaber@coreworks.de +1 -1 # [NETFILTER]: kill struct nf_ct_info, saves five pointers per conntrack # # The relationship of the skb to the conntrack is stored in a new field # in the skb. # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # include/linux/skbuff.h # 2004/09/23 14:39:26-07:00 kaber@coreworks.de +8 -10 # [NETFILTER]: kill struct nf_ct_info, saves five pointers per conntrack # # The relationship of the skb to the conntrack is stored in a new field # in the skb. # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # include/linux/netfilter_ipv4/ip_conntrack_core.h # 2004/09/23 14:39:26-07:00 kaber@coreworks.de +3 -3 # [NETFILTER]: kill struct nf_ct_info, saves five pointers per conntrack # # The relationship of the skb to the conntrack is stored in a new field # in the skb. # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # include/linux/netfilter_ipv4/ip_conntrack.h # 2004/09/23 14:39:26-07:00 kaber@coreworks.de +6 -7 # [NETFILTER]: kill struct nf_ct_info, saves five pointers per conntrack # # The relationship of the skb to the conntrack is stored in a new field # in the skb. # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # include/linux/netfilter.h # 2004/09/23 14:39:26-07:00 kaber@coreworks.de +1 -1 # [NETFILTER]: kill struct nf_ct_info, saves five pointers per conntrack # # The relationship of the skb to the conntrack is stored in a new field # in the skb. # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/23 14:37:59-07:00 kaber@coreworks.de # [NETFILTER]: kill struct ip_nat_hash, saves two pointers per conntrack # # The back-pointer is not needed when using list.h macros. # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # net/ipv4/netfilter/ip_nat_core.c # 2004/09/23 14:37:42-07:00 kaber@coreworks.de +27 -46 # [NETFILTER]: kill struct ip_nat_hash, saves two pointers per conntrack # # The back-pointer is not needed when using list.h macros. # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # include/linux/netfilter_ipv4/ip_nat.h # 2004/09/23 14:37:42-07:00 kaber@coreworks.de +1 -10 # [NETFILTER]: kill struct ip_nat_hash, saves two pointers per conntrack # # The back-pointer is not needed when using list.h macros. # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/23 14:36:22-07:00 rusty@rustcorp.com.au # [NETFILTER]: Shuffle conntrack structure for better cacheline behavior # # Every time we walk the conntrack hashtable list, we hit the same # cacheline that is dirtied by the use of the conntrack # entry. Shuffling these entries to the end should help this # (sizeof(struct ip_conntrack)) > cacheline size). # # Signed-off-by: Rusty Russell # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # include/linux/netfilter_ipv4/ip_conntrack.h # 2004/09/23 14:35:50-07:00 rusty@rustcorp.com.au +3 -3 # [NETFILTER]: Shuffle conntrack structure for better cacheline behavior # # Every time we walk the conntrack hashtable list, we hit the same # cacheline that is dirtied by the use of the conntrack # entry. Shuffling these entries to the end should help this # (sizeof(struct ip_conntrack)) > cacheline size). # # Signed-off-by: Rusty Russell # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/23 14:34:29-07:00 laforge@netfilter.org # [NETFILTER]: add sysctl to read out the number of current connections # # Apparently a lot of scripts use a construct like # cat /proc/net/ip_conntrack | wc -l # which has a negative impact on system performance due to all the locking # required. # # Signed-off-by: Harald Welte # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # net/ipv4/netfilter/ip_conntrack_standalone.c # 2004/09/23 14:34:12-07:00 laforge@netfilter.org +8 -0 # [NETFILTER]: add sysctl to read out the number of current connections # # Apparently a lot of scripts use a construct like # cat /proc/net/ip_conntrack | wc -l # which has a negative impact on system performance due to all the locking # required. # # Signed-off-by: Harald Welte # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # include/linux/sysctl.h # 2004/09/23 14:34:12-07:00 laforge@netfilter.org +1 -0 # [NETFILTER]: add sysctl to read out the number of current connections # # Apparently a lot of scripts use a construct like # cat /proc/net/ip_conntrack | wc -l # which has a negative impact on system performance due to all the locking # required. # # Signed-off-by: Harald Welte # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/23 14:33:20-07:00 rusty@rustcorp.com.au # [NETFILTER]: Don't try to do any random dropping since we now use jenkins hash # # Signed-off-by: Rusty Russell # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # net/ipv4/netfilter/ip_conntrack_core.c # 2004/09/23 14:32:50-07:00 rusty@rustcorp.com.au +4 -10 # [NETFILTER]: Don't try to do any random dropping since we now use jenkins hash # # Signed-off-by: Rusty Russell # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/23 13:20:02-07:00 herbert@gondor.apana.org.au # [IPV4]: Missing TOS checks after fib_find_alias # # It looks like some of the places where FIB_SCAN_TOS macros were used # have lost the tos check. This patch adds them back. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # net/ipv4/fib_hash.c # 2004/09/23 13:19:43-07:00 herbert@gondor.apana.org.au +5 -0 # [IPV4]: Missing TOS checks after fib_find_alias # # It looks like some of the places where FIB_SCAN_TOS macros were used # have lost the tos check. This patch adds them back. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/23 13:18:34-07:00 herbert@gondor.apana.org.au # [IPV4]: Fix thinko in fib_find_alias # # fib_find_alias is meant to return either an exact match or the # entry just before where it should be. Currently it returns the # entry after that. This patch fixes that. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # net/ipv4/fib_hash.c # 2004/09/23 13:18:16-07:00 herbert@gondor.apana.org.au +1 -1 # [IPV4]: Fix thinko in fib_find_alias # # fib_find_alias is meant to return either an exact match or the # entry just before where it should be. Currently it returns the # entry after that. This patch fixes that. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/23 13:17:16-07:00 herbert@gondor.apana.org.au # [IPV4]: Fix endless loop in fn_hash_delete. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # net/ipv4/fib_hash.c # 2004/09/23 13:16:58-07:00 herbert@gondor.apana.org.au +3 -1 # [IPV4]: Fix endless loop in fn_hash_delete. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/23 13:14:45-07:00 chas@cmf.nrl.navy.mil # [ATM]: [fore200e] fix warnings related to dma_addr_t # # Signed-off-by: David S. Miller # # drivers/atm/fore200e.h # 2004/09/23 13:14:27-07:00 chas@cmf.nrl.navy.mil +1 -1 # [ATM]: [fore200e] fix warnings related to dma_addr_t # # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/23 13:13:49-07:00 chas@cmf.nrl.navy.mil # [ATM]: [ambassador] remove warnings related to unused variables # # Signed-off-by: David S. Miller # # drivers/atm/ambassador.c # 2004/09/23 13:13:30-07:00 chas@cmf.nrl.navy.mil +2 -3 # [ATM]: [ambassador] remove warnings related to unused variables # # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/23 13:13:02-07:00 chas@cmf.nrl.navy.mil # [ATM]: [eni] fix __iomem related warnings # # Signed-off-by: David S. Miller # # drivers/atm/eni.h # 2004/09/23 13:12:44-07:00 chas@cmf.nrl.navy.mil +10 -10 # [ATM]: [eni] fix __iomem related warnings # # Signed-off-by: David S. Miller # # drivers/atm/eni.c # 2004/09/23 13:12:44-07:00 chas@cmf.nrl.navy.mil +39 -34 # [ATM]: [eni] fix __iomem related warnings # # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/23 13:12:08-07:00 chas@cmf.nrl.navy.mil # [ATM]: [lanai] get sleep interval right # # Signed-off-by: David S. Miller # # drivers/atm/lanai.c # 2004/09/23 13:11:50-07:00 chas@cmf.nrl.navy.mil +1 -1 # [ATM]: [lanai] get sleep interval right # # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/23 13:11:12-07:00 yoshfuji@linux-ipv6.org # [ARCNET]: Fix crash in 2.6.8.1 # # > I am trying to upgrade my labtop to 2.6.8.1. I have ArcNet COM20020 # > PCMCIA card. After editing /etc/pcmcia/config to make it know about the # > module, it finds the com20020 with no problems but as soon as I try to # > start the network device the ifconfig process crashes. # : # > I fixed it by changing # > lp->hw.open(dev); # > to # > if(lp->hw.open) { # > lp->hw.open(dev); # > } # # Signed-off-by: Hideaki YOSHIFUJI # Signed-off-by: David S. Miller # # drivers/net/arcnet/arcnet.c # 2004/09/23 13:10:54-07:00 yoshfuji@linux-ipv6.org +2 -1 # [ARCNET]: Fix crash in 2.6.8.1 # # > I am trying to upgrade my labtop to 2.6.8.1. I have ArcNet COM20020 # > PCMCIA card. After editing /etc/pcmcia/config to make it know about the # > module, it finds the com20020 with no problems but as soon as I try to # > start the network device the ifconfig process crashes. # : # > I fixed it by changing # > lp->hw.open(dev); # > to # > if(lp->hw.open) { # > lp->hw.open(dev); # > } # # Signed-off-by: Hideaki YOSHIFUJI # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/23 13:04:40-07:00 kaber@trash.net # [XFRM]: Fix unbalanced spin_unlock_bh in __xfrm_find_acq_byseq # # This patch fixes an unbalanced spin_unlock_bh in # __xfrm_find_acq_byseq left over from the larval # state SA fix. # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # net/xfrm/xfrm_state.c # 2004/09/23 13:04:21-07:00 kaber@trash.net +0 -1 # [XFRM]: Fix unbalanced spin_unlock_bh in __xfrm_find_acq_byseq # # This patch fixes an unbalanced spin_unlock_bh in # __xfrm_find_acq_byseq left over from the larval # state SA fix. # # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/23 13:03:09-07:00 Robert.Olsson@data.slu.se # [PKTGEN]: Update to 1.4 # # Stephen's patches. version change and hard_xmit printout removed. # And 2.7 is still a promise... # # Signed-off-by: Robert Olsson # Signed-off-by: Stephen Hemminger # Signed-off-by: David S. Miller # # net/core/pktgen.c # 2004/09/23 13:02:51-07:00 Robert.Olsson@data.slu.se +54 -47 # [PKTGEN]: Update to 1.4 # # Stephen's patches. version change and hard_xmit printout removed. # And 2.7 is still a promise... # # Signed-off-by: Robert Olsson # Signed-off-by: Stephen Hemminger # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/23 12:49:10-07:00 olh@suse.de # [NET]: Remove leading space in linux/skbuff.h # # Signed-off-by: David S. Miller # # include/linux/skbuff.h # 2004/09/23 12:48:39-07:00 olh@suse.de +1 -1 # [NET]: Remove leading space in linux/skbuff.h # # ChangeSet # 2004/09/23 12:47:33-07:00 herbert@gondor.apana.org.au # [IPV4]: Kill remnant of ip_nat_dumb # # This line in net/ipv4/Makefile was left behind when the rest of the # dumb NAT option was taken out. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # net/ipv4/Makefile # 2004/09/23 12:47:15-07:00 herbert@gondor.apana.org.au +0 -1 # [IPV4]: Kill remnant of ip_nat_dumb # # This line in net/ipv4/Makefile was left behind when the rest of the # dumb NAT option was taken out. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/23 12:46:09-07:00 herbert@gondor.apana.org.au # [IPV4]: Check PAGE_SIZE in fz_hash_alloc # # Here is a minor optimisation to fz_hash_alloc. The break-even point # should be based on PAGE_SIZE rather than the value of divisor. # # Signed-off-by: Herbert Xu # # net/ipv4/fib_hash.c # 2004/09/23 12:45:50-07:00 herbert@gondor.apana.org.au +5 -4 # [IPV4]: Check PAGE_SIZE in fz_hash_alloc # # Here is a minor optimisation to fz_hash_alloc. The break-even point # should be based on PAGE_SIZE rather than the value of divisor. # # Signed-off-by: Herbert Xu # # ChangeSet # 2004/09/23 12:44:30-07:00 herbert@gondor.apana.org.au # [NETFILTER]: Fix comment typo in ip_nat_helper. # # net/ipv4/netfilter/ip_nat_helper.c # 2004/09/23 12:44:12-07:00 herbert@gondor.apana.org.au +1 -1 # [NETFILTER]: Fix comment typo in ip_nat_helper. # # ChangeSet # 2004/09/23 21:30:04+02:00 bzolnier@trik.(none) # [ide] make sure we are looking at the low bits post error # # From: Brett Russ # # The following code needs to be added to ide_end_drive_cmd(), # since ide_error() calls ide_end_drive_cmd() after ide_dump_status() # has left the registers pointing at the high order part of the LBA. # Using the taskfile ioctl will then lead to hobRegister[] and # subsequently hob_ports[] being loaded with the wrong values. # # Signed-off-by: Bartlomiej Zolnierkiewicz # # drivers/ide/ide-io.c # 2004/09/23 21:29:34+02:00 bzolnier@trik.(none) +2 -0 # [ide] make sure we are looking at the low bits post error # # ChangeSet # 2004/09/23 08:08:58-07:00 rmk@arm.linux.org.uk # [PATCH] fix problematic flush_cache_page in kernel/ptrace.c # # At present, flush_cache_page() is used to handle the case where we # unmap a page or alter the page permissions on the target page with # one exception - access_process_vm(). Based upon the former, the # decision to implement this function is: # # do we need to flush the cache when we unmap or change # the mapping permissions? # # However, kernel/ptrace.c: access_process_vm() also includes into this: # # or we need to ensure cache coherency between the kernel # and user space mapping of this page. # # I argue that the use of flush_cache_page() here in the generic # code is wrong, and if an architecture wishes to use it for this # purpose, it should do so within it's architecture private # implementation of copy_to_user_page() and copy_from_user_page(). # # So this patch removes the flush_cache_page() from kernel/ptrace.c, # adding it to the arch-specific copy_{to,from}_user_page() where # flush_cache_page is non-empty. # # Signed-off-by: Linus Torvalds # # kernel/ptrace.c # 2004/09/17 06:39:19-07:00 rmk@arm.linux.org.uk +0 -2 # fix problematic flush_cache_page in kernel/ptrace.c # # include/asm-sparc64/cacheflush.h # 2004/09/17 07:58:35-07:00 rmk@arm.linux.org.uk +9 -2 # fix problematic flush_cache_page in kernel/ptrace.c # # include/asm-sparc/cacheflush.h # 2004/09/17 07:57:49-07:00 rmk@arm.linux.org.uk +8 -2 # fix problematic flush_cache_page in kernel/ptrace.c # # include/asm-sh64/cacheflush.h # 2004/09/17 07:31:42-07:00 rmk@arm.linux.org.uk +9 -5 # fix problematic flush_cache_page in kernel/ptrace.c # # include/asm-sh/cacheflush.h # 2004/09/17 07:29:45-07:00 rmk@arm.linux.org.uk +10 -4 # fix problematic flush_cache_page in kernel/ptrace.c # # include/asm-parisc/cacheflush.h # 2004/09/17 08:04:02-07:00 rmk@arm.linux.org.uk +9 -3 # fix problematic flush_cache_page in kernel/ptrace.c # # include/asm-m68k/cacheflush.h # 2004/09/17 07:15:21-07:00 rmk@arm.linux.org.uk +10 -2 # fix problematic flush_cache_page in kernel/ptrace.c # # include/asm-arm/cacheflush.h # 2004/09/17 07:15:48-07:00 rmk@arm.linux.org.uk +10 -4 # fix problematic flush_cache_page in kernel/ptrace.c # # Documentation/cachetlb.txt # 2004/09/17 06:50:31-07:00 rmk@arm.linux.org.uk +0 -4 # fix problematic flush_cache_page in kernel/ptrace.c # # ChangeSet # 2004/09/23 16:52:51+02:00 bzolnier@trik.(none) # [ide] amd74xx: don't probe for IRQs # # From: Nicholas Reilly # # I have a Shuttle SN41G2 and the secondary IDE channel alternates between # IRQ 15 (correct) and IRQ 7 (causing failures accessing the DVD+-RW which is # master, no slave and also messing with the parallel port if it is enabled) # on each boot. This is running ACPI and APIC on 2.6.5, 2.6.7 and 2.6.8. # dmesg, dmidecode and /proc/acpi/dsdt are all identical (apart from dmesg # printing of IRQ and errors it causes) regardless of whether it decides to # go on 7 or 15. It is now running the latest BIOS, earlier BIOS did the # same. # # bart: IRQ auto-detection sometimes fails and gets "screaming" IRQ # # Signed-off-by: Bartlomiej Zolnierkiewicz # # drivers/ide/pci/amd74xx.c # 2004/09/23 16:52:32+02:00 bzolnier@trik.(none) +3 -0 # [ide] amd74xx: don't probe for IRQs # # ChangeSet # 2004/09/23 11:25:46+01:00 aia21@cantab.net # NTFS: - Update ->truncate (fs/ntfs/inode.c::ntfs_truncate()) to check if the # inode size has changed and to only output an error if so. # - Rename fs/ntfs/attrib.h::attribute_value_length() to ntfs_attr_size(). # # Signed-off-by: Anton Altaparmakov # # fs/ntfs/inode.c # 2004/09/23 11:25:38+01:00 aia21@cantab.net +34 -8 # - Update ->truncate (fs/ntfs/inode.c::ntfs_truncate()) to check if the # inode size has changed and to only output an error if so. # - Rename fs/ntfs/attrib.h::attribute_value_length() to ntfs_attr_size(). # # fs/ntfs/attrib.h # 2004/09/23 11:25:38+01:00 aia21@cantab.net +1 -1 # Rename attribute_value_length() to ntfs_attr_size(). # # fs/ntfs/ChangeLog # 2004/09/23 11:25:38+01:00 aia21@cantab.net +3 -0 # Update # # ChangeSet # 2004/09/23 11:05:08+01:00 aia21@cantab.net # NTFS: Change '\0' and L'\0' to simply 0 as per advice from Linus Torvalds. # # Signed-off-by: Anton Altaparmakov # # fs/ntfs/unistr.c # 2004/09/23 11:04:59+01:00 aia21@cantab.net +2 -2 # Change '\0' and L'\0' to simply 0 as per advice from Linus Torvalds. # # fs/ntfs/super.c # 2004/09/23 11:04:59+01:00 aia21@cantab.net +1 -1 # Change '\0' and L'\0' to simply 0 as per advice from Linus Torvalds. # # fs/ntfs/inode.c # 2004/09/23 11:04:59+01:00 aia21@cantab.net +10 -4 # Change '\0' and L'\0' to simply 0 as per advice from Linus Torvalds. # # fs/ntfs/ChangeLog # 2004/09/23 11:04:59+01:00 aia21@cantab.net +1 -0 # Update # # ChangeSet # 2004/09/22 22:40:06-07:00 rth@kanga.twiddle.home # [ALPHA] Implement new ioread interface. # # include/asm-alpha/io_trivial.h # 2004/09/22 22:39:44-07:00 rth@kanga.twiddle.home +127 -0 # # include/asm-alpha/tlbflush.h # 2004/09/22 22:39:44-07:00 rth@kanga.twiddle.home +1 -0 # Include for inline undef. # # include/asm-alpha/spinlock.h # 2004/09/22 22:39:44-07:00 rth@kanga.twiddle.home +1 -1 # Fix memory matching constraint. # # include/asm-alpha/io_trivial.h # 2004/09/22 22:39:44-07:00 rth@kanga.twiddle.home +0 -0 # BitKeeper file /home/rth/work/linux/axp-2.6/include/asm-alpha/io_trivial.h # # include/asm-alpha/mmu_context.h # 2004/09/22 22:39:43-07:00 rth@kanga.twiddle.home +1 -0 # Include for inline undef. # # include/asm-alpha/machvec.h # 2004/09/22 22:39:43-07:00 rth@kanga.twiddle.home +9 -7 # Update for iomap interface. # # include/asm-alpha/jensen.h # 2004/09/22 22:39:43-07:00 rth@kanga.twiddle.home +40 -33 # Update for iomap interface. # # include/asm-alpha/io.h # 2004/09/22 22:39:43-07:00 rth@kanga.twiddle.home +346 -241 # Update for iomap interface. # # include/asm-alpha/core_wildfire.h # 2004/09/22 22:39:43-07:00 rth@kanga.twiddle.home +16 -133 # Update for iomap interface. # # include/asm-alpha/core_tsunami.h # 2004/09/22 22:39:43-07:00 rth@kanga.twiddle.home +16 -133 # Update for iomap interface. # # include/asm-alpha/core_titan.h # 2004/09/22 22:39:43-07:00 rth@kanga.twiddle.home +14 -130 # Update for iomap interface. # # include/asm-alpha/core_t2.h # 2004/09/22 22:39:43-07:00 rth@kanga.twiddle.home +49 -33 # Update for iomap interface. # # include/asm-alpha/core_polaris.h # 2004/09/22 22:39:43-07:00 rth@kanga.twiddle.home +15 -127 # Update for iomap interface. # # include/asm-alpha/core_mcpcia.h # 2004/09/22 22:39:43-07:00 rth@kanga.twiddle.home +82 -185 # Update for iomap interface. # # include/asm-alpha/core_marvel.h # 2004/09/22 22:39:43-07:00 rth@kanga.twiddle.home +21 -190 # Update for iomap interface. # # include/asm-alpha/core_lca.h # 2004/09/22 22:39:43-07:00 rth@kanga.twiddle.home +79 -124 # Update for iomap interface. # # include/asm-alpha/core_irongate.h # 2004/09/22 22:39:43-07:00 rth@kanga.twiddle.home +15 -115 # Update for iomap interface. # # include/asm-alpha/core_cia.h # 2004/09/22 22:39:43-07:00 rth@kanga.twiddle.home +82 -207 # Update for iomap interface. # # include/asm-alpha/core_apecs.h # 2004/09/22 22:39:43-07:00 rth@kanga.twiddle.home +81 -121 # Update for iomap interface. # # include/asm-alpha/compiler.h # 2004/09/22 22:39:43-07:00 rth@kanga.twiddle.home +10 -0 # Undef inline and friends. # # arch/alpha/lib/io.c # 2004/09/22 22:39:43-07:00 rth@kanga.twiddle.home +255 -223 # Update for iomap interface. # Do module exporting here. # # arch/alpha/kernel/sys_wildfire.c # 2004/09/22 22:39:43-07:00 rth@kanga.twiddle.home +0 -1 # Update for DO_FOO_BUS merge with DO_FOO_IO. # # arch/alpha/kernel/sys_titan.c # 2004/09/22 22:39:43-07:00 rth@kanga.twiddle.home +5 -7 # Update for DO_FOO_BUS merge with DO_FOO_IO. # Update SMP for cpumask_t. # # arch/alpha/kernel/sys_takara.c # 2004/09/22 22:39:43-07:00 rth@kanga.twiddle.home +0 -1 # Update for DO_FOO_BUS merge with DO_FOO_IO. # # arch/alpha/kernel/sys_sx164.c # 2004/09/22 22:39:43-07:00 rth@kanga.twiddle.home +0 -1 # Update for DO_FOO_BUS merge with DO_FOO_IO. # # arch/alpha/kernel/sys_sio.c # 2004/09/22 22:39:43-07:00 rth@kanga.twiddle.home +0 -5 # Update for DO_FOO_BUS merge with DO_FOO_IO. # # arch/alpha/kernel/sys_sable.c # 2004/09/22 22:39:43-07:00 rth@kanga.twiddle.home +0 -3 # Update for DO_FOO_BUS merge with DO_FOO_IO. # # arch/alpha/kernel/sys_rx164.c # 2004/09/22 22:39:43-07:00 rth@kanga.twiddle.home +0 -1 # Update for DO_FOO_BUS merge with DO_FOO_IO. # # arch/alpha/kernel/sys_ruffian.c # 2004/09/22 22:39:43-07:00 rth@kanga.twiddle.home +0 -1 # Update for DO_FOO_BUS merge with DO_FOO_IO. # # arch/alpha/kernel/sys_rawhide.c # 2004/09/22 22:39:43-07:00 rth@kanga.twiddle.home +0 -1 # Update for DO_FOO_BUS merge with DO_FOO_IO. # # arch/alpha/kernel/sys_noritake.c # 2004/09/22 22:39:43-07:00 rth@kanga.twiddle.home +0 -2 # Update for DO_FOO_BUS merge with DO_FOO_IO. # # arch/alpha/kernel/sys_nautilus.c # 2004/09/22 22:39:43-07:00 rth@kanga.twiddle.home +0 -1 # Update for DO_FOO_BUS merge with DO_FOO_IO. # # arch/alpha/kernel/sys_mikasa.c # 2004/09/22 22:39:43-07:00 rth@kanga.twiddle.home +0 -2 # Update for DO_FOO_BUS merge with DO_FOO_IO. # # arch/alpha/kernel/sys_miata.c # 2004/09/22 22:39:43-07:00 rth@kanga.twiddle.home +0 -1 # Update for DO_FOO_BUS merge with DO_FOO_IO. # # arch/alpha/kernel/sys_marvel.c # 2004/09/22 22:39:43-07:00 rth@kanga.twiddle.home +0 -1 # Update for DO_FOO_BUS merge with DO_FOO_IO. # # arch/alpha/kernel/sys_jensen.c # 2004/09/22 22:39:43-07:00 rth@kanga.twiddle.home +0 -3 # Update for DO_FOO_BUS merge with DO_FOO_IO. # # arch/alpha/kernel/sys_eiger.c # 2004/09/22 22:39:43-07:00 rth@kanga.twiddle.home +0 -1 # Update for DO_FOO_BUS merge with DO_FOO_IO. # # arch/alpha/kernel/sys_eb64p.c # 2004/09/22 22:39:43-07:00 rth@kanga.twiddle.home +0 -2 # Update for DO_FOO_BUS merge with DO_FOO_IO. # # arch/alpha/kernel/sys_dp264.c # 2004/09/22 22:39:43-07:00 rth@kanga.twiddle.home +0 -5 # Update for DO_FOO_BUS merge with DO_FOO_IO. # # arch/alpha/kernel/sys_cabriolet.c # 2004/09/22 22:39:43-07:00 rth@kanga.twiddle.home +0 -5 # Update for DO_FOO_BUS merge with DO_FOO_IO. # # arch/alpha/kernel/sys_alcor.c # 2004/09/22 22:39:43-07:00 rth@kanga.twiddle.home +2 -4 # Update for DO_FOO_BUS merge with DO_FOO_IO. # # arch/alpha/kernel/pci.c # 2004/09/22 22:39:43-07:00 rth@kanga.twiddle.home +34 -0 # Update for iomap interface. # # arch/alpha/kernel/pci-noop.c # 2004/09/22 22:39:42-07:00 rth@kanga.twiddle.home +12 -0 # Update for iomap interface. # # arch/alpha/kernel/machvec_impl.h # 2004/09/22 22:39:42-07:00 rth@kanga.twiddle.home +45 -56 # Update for iomap interface. # Merge BUS with IO_LITE. # Update for c99 designated initializer syntax. # # arch/alpha/kernel/err_titan.c # 2004/09/22 22:39:42-07:00 rth@kanga.twiddle.home +1 -1 # Suppress sparse warning with ul suffix. # # arch/alpha/kernel/core_titan.c # 2004/09/22 22:39:42-07:00 rth@kanga.twiddle.home +32 -18 # Update for iomap interface. # # arch/alpha/kernel/core_marvel.c # 2004/09/22 22:39:42-07:00 rth@kanga.twiddle.home +141 -86 # Update for iomap interface. # # arch/alpha/kernel/alpha_ksyms.c # 2004/09/22 22:39:42-07:00 rth@kanga.twiddle.home +0 -30 # Move io related exports to arch/alpha/lib/io.c. # # ChangeSet # 2004/09/22 18:32:59-07:00 benh@kernel.crashing.org # [PATCH] pmac: don't add °C suffix in sys for adt746x driver # # The adt746x driver currently adds a "°C" suffix to temperatures exposed via # sysfs, and I don't like that. First, we all agree that any other unit here # makes no sense (do we ? do we ? yes of course :) and I don't like having # anything but numbers in there, and finally it's more consistent with what # the g5 driver does. # # And finally, the _REAL_ reason is that this is not a low ASCII character # and so has nothing to do in the kernel sources or in /sys :) # # Unfortunately, generating a patch here is nasty because of that (my mailer # is rightfully complaining about the non-ASCII char on text import) so you # might have to apply by hand... # # Signed-off-by: Benjamin Herrenschmidt # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/macintosh/therm_adt746x.c # 2004/09/22 13:31:14-07:00 benh@kernel.crashing.org +4 -9 # pmac: don't add °C suffix in sys for adt746x driver # # ChangeSet # 2004/09/22 18:26:41-07:00 nacc@us.ibm.com # [PATCH] net/airport: replace schedule_timeout() with ssleep()/msleep() # # Signed-off-by: Nishanth Aravamudan # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/net/wireless/airport.c # 2004/09/22 13:35:24-07:00 nacc@us.ibm.com +7 -11 # net/airport: replace schedule_timeout() with ssleep()/msleep() # # ChangeSet # 2004/09/22 18:26:29-07:00 nico@cam.org # [PATCH] update MAINTAINERS/CREDITS # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # MAINTAINERS # 2004/09/22 13:35:24-07:00 nico@cam.org +11 -6 # update MAINTAINERS/CREDITS # # CREDITS # 2004/09/22 13:35:24-07:00 nico@cam.org +1 -0 # update MAINTAINERS/CREDITS # # ChangeSet # 2004/09/22 18:26:17-07:00 mingo@elte.hu # [PATCH] fix diskstats_show() accounting with PREEMPT # # There is another (minor) bug that the smp_processor_id() debugger # unearthed: diskstats_show() could do a disk_round_stats() -> # disk_stat_add() with preemption enabled - possibly resulting in losing # statistics updates. # # Signed-off-by: Ingo Molnar # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/block/genhd.c # 2004/09/22 13:35:24-07:00 mingo@elte.hu +4 -0 # fix diskstats_show() accounting with PREEMPT # # ChangeSet # 2004/09/22 18:26:05-07:00 linux@dominikbrodowski.de # [PATCH] powernow-k7: fix latency calculation # # fix ->cpuinfo.transition_latency for powernow-k7 # # Signed-off-by: Bruno Ducrot # Signed-off-by: Dominik Brodowski # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/i386/kernel/cpu/cpufreq/powernow-k7.c # 2004/09/22 13:34:58-07:00 linux@dominikbrodowski.de +1 -1 # powernow-k7: fix latency calculation # # ChangeSet # 2004/09/22 18:25:53-07:00 agk@redhat.com # [PATCH] device-mapper: mirror log sync optional # # From: Heinz Mauelshagen # # Make mirror log synchronization optional. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/md/dm-raid1.c # 2004/09/22 13:34:57-07:00 agk@redhat.com +6 -8 # device-mapper: mirror log sync optional # # drivers/md/dm-log.h # 2004/09/22 13:34:57-07:00 agk@redhat.com +6 -0 # device-mapper: mirror log sync optional # # drivers/md/dm-log.c # 2004/09/22 13:34:57-07:00 agk@redhat.com +96 -14 # device-mapper: mirror log sync optional # # ChangeSet # 2004/09/22 18:25:42-07:00 agk@redhat.com # [PATCH] device-mapper: rename emit macro # # Rename EMIT macro to DMEMIT and move to header file. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/md/dm.h # 2004/09/22 13:34:57-07:00 agk@redhat.com +3 -0 # device-mapper: rename emit macro # # drivers/md/dm-stripe.c # 2004/09/22 13:34:57-07:00 agk@redhat.com +3 -6 # device-mapper: rename emit macro # # drivers/md/dm-raid1.c # 2004/09/22 13:37:09-07:00 agk@redhat.com +10 -13 # device-mapper: rename emit macro # # ChangeSet # 2004/09/22 18:25:30-07:00 agk@redhat.com # [PATCH] device-mapper: fix minor number check # # Fix minor number allocation check: (1 << MINORBITS) is invalid. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/md/dm.c # 2004/09/22 13:34:57-07:00 agk@redhat.com +2 -2 # device-mapper: fix minor number check # # ChangeSet # 2004/09/22 18:25:18-07:00 werner@almesberger.net # [PATCH] round log buffer size to power of two # # If setting the printk log buffer (with the boot command line option # "log_buf_len") to a value that's not a power of two, the index calculations # go wrong and yield confusing results. # # This patch rounds the size to the next higher power of two. It'll yield # garbage for sizes > INT_MAX bytes. # # Signed-off-by: Werner Almesberger # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # kernel/printk.c # 2004/09/22 13:34:57-07:00 werner@almesberger.net +2 -0 # round log buffer size to power of two # # ChangeSet # 2004/09/22 18:25:06-07:00 torben.mathiasen@hp.com # [PATCH] devices.txt update # # - s/390 dasd moved to major 94. # # - s/390 VM/ESA moved to major 95. # # - INFTL moved to major 96. # # - Patch also adds Marvell MPSC low-density device to Minor 44 & 45 (Major # 204). This one was in my queue. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # Documentation/devices.txt # 2004/09/22 13:34:33-07:00 torben.mathiasen@hp.com +18 -16 # devices.txt update # # ChangeSet # 2004/09/22 18:24:54-07:00 schwidefsky@de.ibm.com # [PATCH] s390: qeth network driver # # From: Steffen Thoss # From: Ursula Braun-Krahl # # qeth network driver change: # - Change misleading message about hardware ip fragmentation. # - Include qeth_snmp_ureq_hdr structure in user copy in qeth_snmp_command. # # Signed-off-by: Martin Schwidefsky # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/s390/net/qeth_main.c # 2004/09/22 13:34:33-07:00 schwidefsky@de.ibm.com +9 -8 # s390: qeth network driver # # ChangeSet # 2004/09/22 18:24:42-07:00 schwidefsky@de.ibm.com # [PATCH] s390: dasd driver # # From: Horst Hummel # # dasd driver changes: # - Add control unit types 0x2107 and 0x1750. # # Signed-off-by: Martin Schwidefsky # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/s390/block/dasd_eckd.c # 2004/09/22 13:34:33-07:00 schwidefsky@de.ibm.com +13 -3 # s390: dasd driver # # ChangeSet # 2004/09/22 18:24:30-07:00 schwidefsky@de.ibm.com # [PATCH] s390: core changes # # s390 core changes: # - Replace invoke_softirq mechanism with own version of do_softirq. # - Move /proc/inteerrupts functions to re-added arch/s390/kernel/irq.c # - Add some includes to avoid compiler warnings. # - Remove unused #defines. # - Regenerate default configuration. # # Signed-off-by: Martin Schwidefsky # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-s390/hardirq.h # 2004/09/22 13:34:32-07:00 schwidefsky@de.ibm.com +2 -3 # s390: core changes # # drivers/s390/s390mach.h # 2004/09/22 13:34:32-07:00 schwidefsky@de.ibm.com +0 -4 # s390: core changes # # arch/s390/kernel/setup.c # 2004/09/22 13:34:32-07:00 schwidefsky@de.ibm.com +0 -46 # s390: core changes # # arch/s390/kernel/s390_ksyms.c # 2004/09/22 13:34:32-07:00 schwidefsky@de.ibm.com +0 -1 # s390: core changes # # arch/s390/kernel/s390_ext.c # 2004/09/22 13:34:32-07:00 schwidefsky@de.ibm.com +1 -0 # s390: core changes # # arch/s390/kernel/irq.c # 2004/09/22 13:34:32-07:00 schwidefsky@de.ibm.com +99 -0 # s390: core changes # # arch/s390/kernel/entry64.S # 2004/09/22 13:34:32-07:00 schwidefsky@de.ibm.com +0 -21 # s390: core changes # # arch/s390/kernel/entry.S # 2004/09/22 13:34:32-07:00 schwidefsky@de.ibm.com +0 -25 # s390: core changes # # arch/s390/kernel/Makefile # 2004/09/22 13:34:32-07:00 schwidefsky@de.ibm.com +1 -1 # s390: core changes # # arch/s390/defconfig # 2004/09/22 13:34:32-07:00 schwidefsky@de.ibm.com +6 -3 # s390: core changes # # arch/s390/kernel/irq.c # 2004/09/22 13:34:32-07:00 schwidefsky@de.ibm.com +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/s390/kernel/irq.c # # ChangeSet # 2004/09/22 18:24:18-07:00 juhl-lkml@dif.dk # [PATCH] check copy_from_user return value in act2000_isa_download # # Signed-off-by: Jesper Juhl # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/isdn/act2000/act2000_isa.c # 2004/09/22 13:34:09-07:00 juhl-lkml@dif.dk +4 -1 # check copy_from_user return value in act2000_isa_download # # ChangeSet # 2004/09/22 18:24:06-07:00 vda@port.imtp.ilyichevsk.odessa.ua # [PATCH] reduce stack consumption in load_elf_binary # # Stack usage is reduced from 268 to 120 bytes on i386. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # fs/binfmt_elf.c # 2004/09/22 13:34:05-07:00 vda@port.imtp.ilyichevsk.odessa.ua +44 -34 # reduce stack consumption in load_elf_binary # # ChangeSet # 2004/09/22 18:23:54-07:00 yuasa@hh.iij4u.or.jp # [PATCH] mips: fixed definition order of _sigchld # # This change had fixed definition order of _sigchld about MIPS. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-mips/siginfo.h # 2004/09/22 13:34:04-07:00 yuasa@hh.iij4u.or.jp +1 -1 # mips: fixed definition order of _sigchld # # ChangeSet # 2004/09/22 18:23:42-07:00 mikpe@csd.uu.se # [PATCH] Specialix RIO driver gcc-3.4 fixes # # This patch fixes gcc-3.4 cast-as-lvalue warnings in the 2.6.9-rc2 kernel's # Specialix RIO driver. This is a forward port of the fix I made for the 2.4 # kernel. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/char/rio/rio_linux.c # 2004/09/22 13:33:18-07:00 mikpe@csd.uu.se +3 -3 # Specialix RIO driver gcc-3.4 fixes # # ChangeSet # 2004/09/22 18:23:30-07:00 olh@suse.de # [PATCH] fix make O= for ppc64/boot # # make ARCH=ppc64 -j12 O=/dev/shm/R all fails, the linker script is not in # the output directory. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/ppc64/boot/Makefile # 2004/09/22 13:34:03-07:00 olh@suse.de +1 -1 # fix make O= for ppc64/boot # # ChangeSet # 2004/09/22 18:23:18-07:00 mikpe@csd.uu.se # [PATCH] WANPIPE/SDLA driver gcc-3.4 fixes # # This patch fixes gcc-3.4 cast-as-lvalue warnings in the 2.6.9-rc2 kernel's # WANPIPE/SDLA net drivers. This is a forward port of the fix I made for the # 2.4 kernel. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/net/wan/sdlamain.c # 2004/09/22 13:32:38-07:00 mikpe@csd.uu.se +1 -1 # WANPIPE/SDLA driver gcc-3.4 fixes # # drivers/net/wan/sdladrv.c # 2004/09/22 13:32:38-07:00 mikpe@csd.uu.se +3 -3 # WANPIPE/SDLA driver gcc-3.4 fixes # # drivers/net/wan/sdla_fr.c # 2004/09/22 13:32:38-07:00 mikpe@csd.uu.se +2 -2 # WANPIPE/SDLA driver gcc-3.4 fixes # # ChangeSet # 2004/09/22 18:23:06-07:00 jhe@us.ibm.com # [PATCH] compat_sys_fcntl64: fix for locking near end of file # # Here's a patch to fix a bug in compat_sys_fcntl64 in fs/compat.c. The bug # occurs with a 32 bit app that calls fcntl and checking for a lock near the # end of a file. # # struct flock sflp; # sflp.l_start = 2147483345; # sflp.l_len = 302; # /* 2147483345 + 302 == 2147483647 (this should not overflow 31 bits) */ # /* 2^31 == 2147483648 */ # fcntl_stat = fcntl(fd, F_GETLK, &sflp); # # The patch also contains a fix to handle l_len < 0 which is now defined in # POSIX 1003.1-2001 from the fcntl man page. # # Signed-off-by: John Engel # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # fs/compat.c # 2004/09/22 13:32:04-07:00 jhe@us.ibm.com +16 -2 # compat_sys_fcntl64: fix for locking near end of file # # ChangeSet # 2004/09/22 18:22:55-07:00 yuasa@hh.iij4u.or.jp # [PATCH] mips: fixed undeclared giu_cascade # # This change had fixed undeclared identifier in # arch/mips/vr41xx/common/giu.c # # Signed-off-by: Yoichi Yuasa # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/mips/vr41xx/common/giu.c # 2004/09/22 13:32:04-07:00 yuasa@hh.iij4u.or.jp +6 -1 # mips: fixed undeclared giu_cascade # # ChangeSet # 2004/09/22 18:22:43-07:00 yuasa@hh.iij4u.or.jp # [PATCH] mips: fixed initialization error # # This change had fixed initialization error in arch/mips/vr41xx/common/icu.c # # Signed-off-by: Yoichi Yuasa # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/mips/vr41xx/common/icu.c # 2004/09/22 13:32:04-07:00 yuasa@hh.iij4u.or.jp +6 -2 # mips: fixed initialization error # # ChangeSet # 2004/09/22 18:22:31-07:00 yuasa@hh.iij4u.or.jp # [PATCH] mips: fixed vr41xx serial # # UPF_RESOURCES isn't used now. # # Signed-off-by: Yoichi Yuasa # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/mips/vr41xx/common/serial.c # 2004/09/22 13:32:04-07:00 yuasa@hh.iij4u.or.jp +2 -2 # mips: fixed vr41xx serial # # ChangeSet # 2004/09/22 18:22:19-07:00 kaigai@ak.jp.nec.com # [PATCH] list_replace_rcu() in include/linux/list.h # # This attached patch adds list_replace_rcu() to include/linux/list.h for # atomic updating operations according to RCU-model. # # void list_replace_rcu(struct list_head *old, struct list_head *new) # # The 'old' element is detached from the linked list, and the 'new' element # is inserted to the same point of the linked list concurrently. # # This patch is necessary for the performance improvement of SELinux. # See, http://lkml.org/lkml/2004/8/16/54 # (Subject: RCU issue with SELinux) # http://lkml.org/lkml/2004/8/30/63 # (Subject: [PATCH]SELinux performance improvement by RCU) # # Signed-off-by: KaiGai, Kohei # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/linux/list.h # 2004/09/22 13:31:51-07:00 kaigai@ak.jp.nec.com +15 -0 # list_replace_rcu() in include/linux/list.h # # ChangeSet # 2004/09/22 18:22:07-07:00 jeffm@suse.com # [PATCH] Fix for default ACL handling on ReiserFS # # reiserfs_set_xattr() explicitly updates the ctime for the host inode. # # This works for direct setfacl/setfattr calls, but for the more common case # of an inherited default ACL, it breaks. The ACL is inherited in the middle # of the new inode creation, before the inode has been hashed. # # When mark_inode_dirty is called, one of the checks bails out if the inode # is unhashed -- but AFTER inode->i_state is updated, so the inode is marked # dirty but never placed on any dirty list. # # Since the inode is never placed on a dirty list, __sync_single_inode from # the writeback_inodes() path can never be called on it to clear the dirty # flags. Once the inode is hashed and mark_inode_dirty is called for it # again, it's too late -- it will bail early assuming (correctly) that the # inode is already marked dirty. This ultimately results in I/O stalls that # can't be resolved by the fs path, only be the memory allocation path that # uses pages directly. # # The attached patch makes the update of the ctime conditional on the inode # being hashed already. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # fs/reiserfs/xattr.c # 2004/09/22 13:30:51-07:00 jeffm@suse.com +8 -2 # Fix for default ACL handling on ReiserFS # # ChangeSet # 2004/09/22 18:21:55-07:00 ryan@spitfire.gotdns.org # [PATCH] implement roundup_pow_two() # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/linux/kernel.h # 2004/09/22 13:30:49-07:00 ryan@spitfire.gotdns.org +5 -0 # implement roundup_pow_two() # # ChangeSet # 2004/09/22 18:21:43-07:00 dev@sw.ru # [PATCH] Rearrangement of inode_lock in writeback_inodes() # # This patch reaaranges inode_lock taking in writeback_inodes(). It narrows # down use of inode_lock and removes unneccassary nesting of sb_lock and # inode_lock. Instead of holding inode_lock for all the time I moved it # around sync_sb_inodes() as it is in all other places. # # Signed-Off-By: Kirill Korotaev # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # fs/fs-writeback.c # 2004/09/22 13:29:17-07:00 dev@sw.ru +4 -3 # Rearrangement of inode_lock in writeback_inodes() # # ChangeSet # 2004/09/22 18:21:31-07:00 dev@sw.ru # [PATCH] Fix of race in writeback_inodes() # # This patch fixes race in writeback_inodes() described below: # # writeback_inodes() # { # .... # sb->s_count++; # spin_unlock(&sb_lock); # .... # spin_lock(&sb_lock); # if (__put_super(sb)) <<< X # goto restart; # } # } # # deactivate_super() # { # fs->kill_sb(s); # kill_block_super(sb) # generic_shutdown_super(sb) # spin_lock(&sb_lock); # list_del(&sb->s_list); <<< Y # spin_unlock(&sb_lock); # .... # put_super(s); # spin_lock(&sb_lock); # __put_super(sb); <<< Z # spin_unlock(&sb_lock); # } # # The problem with it is that writeback_inodes() supposes that if # __put_super() returns 0 then no super block was deleted from the list and # we can safely traverse sb list further. # # But as it is obvious from the deactivate_super() it's not actually true. # because at point Y we delete super block from the list and drop the lock. # We do __put_super() very much later... So we can find sb with poisoned # sb->s_list at point X and we won't be the last sb reference holders. The # last reference will be dropped in point Z. # # So in case of the following sequence of execution Y -> X -> Z we'll get an # oops after point X in writeback_inodes(). # # This patch introduces __put_super_and_need_restart() function which allows # safe traversing of sb list. I'll send a couple of patches later which # remove O(n^2) algos and using this function. # # Signed-Off-By: Kirill Korotaev # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/linux/fs.h # 2004/09/22 13:29:16-07:00 dev@sw.ru +1 -0 # Fix of race in writeback_inodes() # # fs/super.c # 2004/09/22 13:29:16-07:00 dev@sw.ru +24 -2 # Fix of race in writeback_inodes() # # fs/fs-writeback.c # 2004/09/22 13:37:12-07:00 dev@sw.ru +1 -1 # Fix of race in writeback_inodes() # # ChangeSet # 2004/09/22 18:21:19-07:00 anil.s.keshavamurthy@intel.com # [PATCH] Online CPU with maxcpus option panics # # I booted IA64 kernel with "maxcpus=" set to less than the total available # processors in the system. Then I tried to online the CPU which was offline # due to "maxcpus=" restirction. i.e when I tried to online the CPU which # never was online at boot crashed the system. # # Signed-off-by: Anil Keshavamurthy # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # kernel/fork.c # 2004/09/22 13:28:17-07:00 anil.s.keshavamurthy@intel.com +2 -2 # Online CPU with maxcpus option panics # # arch/ia64/kernel/smpboot.c # 2004/09/22 13:28:17-07:00 anil.s.keshavamurthy@intel.com +1 -1 # Online CPU with maxcpus option panics # # ChangeSet # 2004/09/22 18:21:08-07:00 sfr@canb.auug.org.au # [PATCH] ppc64 iSeries: allow ibmvscsic to initialise # # This patch supplies an device so that ibmvscsic will actually have its # probe routine called and so allow ti to actually initialise on (legacy) # iSeries machines. # # It also adds a device for the virtual console (for consistency only at the # moment). # # Signed-off-by: Stephen Rothwell # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/ppc64/kernel/vio.c # 2004/09/22 13:28:17-07:00 sfr@canb.auug.org.au +4 -0 # ppc64 iSeries: allow ibmvscsic to initialise # # ChangeSet # 2004/09/22 18:20:57-07:00 anton@samba.org # [PATCH] ppc64: User tasks must have a valid thread.regs # # There have been reports of problems running UP ppc64 kernels where the # kernel would die in the floating point save/restore code. # # It turns out kernel threads that call exec (and so become user tasks) do # not have a valid thread.regs. This means init (pid 1) does not, it also # means anything called out of exec_usermodehelper does not. Once that task # has forked (eg init), then the thread.regs in the new task is correctly # set. # # On UP do lazy save/restore of floating point regs. The SLES9 init is doing # floating point (the debian version of init appears not to). The lack of # thread.regs in init combined with the fact that it does floating point # leads to our lazy FP save/restore code blowing up. # # There were other places where this problem exhibited itself in weird and # interesting ways. If a task being exec'ed out of a kernel thread used more # than 1MB of stack, it would be terminated due to the checks in # arch/ppc64/mm/fault.c (looking for a valid thread.regs when extending the # stack). We had a test case using the tux webserver that was failing due to # this. # # Since we zero all registers in ELF_PLAT_INIT, I removed the extra memset # in start_thread32. # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/ppc64/kernel/sys_ppc32.c # 2004/09/22 13:28:17-07:00 anton@samba.org +18 -2 # ppc64: User tasks must have a valid thread.regs # # arch/ppc64/kernel/process.c # 2004/09/22 13:28:17-07:00 anton@samba.org +12 -1 # ppc64: User tasks must have a valid thread.regs # # ChangeSet # 2004/09/22 18:20:45-07:00 nacc@us.ibm.com # [PATCH] macintosh/therm_windtunnel: replace schedule_timeout() with msleep_interruptible() # # Use msleep_interruptible() instead of schedule_timeout() to guarantee the # task delays as expected. # # Signed-off-by: Nishanth Aravamudan # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/macintosh/therm_windtunnel.c # 2004/09/22 13:28:17-07:00 nacc@us.ibm.com +1 -2 # macintosh/therm_windtunnel: replace schedule_timeout() with msleep_interruptible() # # ChangeSet # 2004/09/22 18:20:34-07:00 nacc@us.ibm.com # [PATCH] macintosh/macserial: replace schedule_timeout() with msleep_interruptible() # # Use msleep_interruptible() instead of schedule_timeout() to guarantee the # task delays as expected. # # Signed-off-by: Nishanth Aravamudan # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/macintosh/macserial.c # 2004/09/22 13:28:16-07:00 nacc@us.ibm.com +2 -4 # macintosh/macserial: replace schedule_timeout() with msleep_interruptible() # # ChangeSet # 2004/09/22 18:20:22-07:00 afleming@freescale.com # [PATCH] ppc32: 85xx spurious interrupt bug # # The Spurious interrupt assignment for OpenPIC was the constant, # OPENPIC_VEC_SPURIOUS plus the offset passed in. Due to bugs in some # OpenPICs, the end value needed to be 255 on those systems. However, the # constant was then chosen to be 239, because offset on most systems is 16. # The 85xx has an offset of 64, however, and so this assignment caused # lock-ups during boot. The proposed solution is to declare # OPENPIC_VEC_SPURIOUS to be 255, and use that value directly, instead of # adding the offset to it. # # Signed-off-by: Tom Rini # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-ppc/open_pic.h # 2004/09/22 13:28:16-07:00 afleming@freescale.com +1 -1 # ppc32: 85xx spurious interrupt bug # # arch/ppc/syslib/open_pic.c # 2004/09/22 13:28:16-07:00 afleming@freescale.com +4 -4 # ppc32: 85xx spurious interrupt bug # # ChangeSet # 2004/09/22 18:20:10-07:00 adaplas@hotpop.com # [PATCH] fbdev: Arrange driver order in Makefile # # This patch arranges driver order in 'driver/video/Makefile' so it closely, # but not exactly, follows the previous order in 'drivers/video/fbmem.c'. # # Signed-off-by: Antonino Daplas # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/video/Makefile # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +61 -56 # fbdev: Arrange driver order in Makefile # # ChangeSet # 2004/09/22 18:19:58-07:00 adaplas@hotpop.com # [PATCH] fbdev: Initialize i810fb after agpgart # # This patch places 'video/i810/' after 'char/' in drivers/Makefile. This order # change makes it unnecessary for i810fb to explicitly call agp_intel_init(). # This is untested, as I don't have any i810 hardware anymore, but I believe it # will work. If it does, the ugly 'early initialization hack' in # drivers/char/agp/intel-agp.c:agp_intel_init() can be removed (haven't done it # yet). # # Signed-off-by: Antonino Daplas # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/video/i810/i810_main.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +0 -5 # fbdev: Initialize i810fb after agpgart # # drivers/video/Makefile # 2004/09/22 13:37:14-07:00 adaplas@hotpop.com +2 -3 # fbdev: Initialize i810fb after agpgart # # drivers/Makefile # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +4 -0 # fbdev: Initialize i810fb after agpgart # # ChangeSet # 2004/09/22 18:19:45-07:00 adaplas@hotpop.com # [PATCH] fbcon: fix fbcon's setup routine # # Fix fbcon's setup routine so usage is consistent with previous kernels. # Ie: video=ofonly and video=xxxfb:off should work. # # This is done by fb_get_options() returning a nonzero value if: # # - 'off' option is present # - 'ofonly' is present but driver name is not 'offb' # # All drivers will not proceed with their initialization if return value is # nonzero. # # Signed-off-by: Antonino Daplas # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/linux/fb.h # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +1 -1 # fbcon: fix fbcon's setup routine # # drivers/video/vga16fb.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +6 -2 # fbcon: fix fbcon's setup routine # # drivers/video/vfb.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +5 -1 # fbcon: fix fbcon's setup routine # # drivers/video/vesafb.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +4 -1 # fbcon: fix fbcon's setup routine # # drivers/video/valkyriefb.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +4 -1 # fbcon: fix fbcon's setup routine # # drivers/video/tx3912fb.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +4 -1 # fbcon: fix fbcon's setup routine # # drivers/video/tridentfb.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +5 -1 # fbcon: fix fbcon's setup routine # # drivers/video/tgafb.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +5 -1 # fbcon: fix fbcon's setup routine # # drivers/video/tdfxfb.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +6 -1 # fbcon: fix fbcon's setup routine # # drivers/video/tcx.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +3 -0 # fbcon: fix fbcon's setup routine # # drivers/video/stifb.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +5 -1 # fbcon: fix fbcon's setup routine # # drivers/video/sstfb.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +5 -1 # fbcon: fix fbcon's setup routine # # drivers/video/skeletonfb.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +5 -1 # fbcon: fix fbcon's setup routine # # drivers/video/sis/sis_main.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +5 -1 # fbcon: fix fbcon's setup routine # # drivers/video/sgivwfb.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +5 -1 # fbcon: fix fbcon's setup routine # # drivers/video/sa1100fb.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +3 -0 # fbcon: fix fbcon's setup routine # # drivers/video/riva/fbdev.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +5 -1 # fbcon: fix fbcon's setup routine # # drivers/video/radeonfb.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +5 -1 # fbcon: fix fbcon's setup routine # # drivers/video/q40fb.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +3 -0 # fbcon: fix fbcon's setup routine # # drivers/video/pxafb.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +5 -1 # fbcon: fix fbcon's setup routine # # drivers/video/pvr2fb.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +5 -1 # fbcon: fix fbcon's setup routine # # drivers/video/pmagb-b-fb.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +3 -0 # fbcon: fix fbcon's setup routine # # drivers/video/pmag-ba-fb.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +3 -0 # fbcon: fix fbcon's setup routine # # drivers/video/pm2fb.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +5 -1 # fbcon: fix fbcon's setup routine # # drivers/video/platinumfb.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +5 -1 # fbcon: fix fbcon's setup routine # # drivers/video/p9100.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +3 -0 # fbcon: fix fbcon's setup routine # # drivers/video/offb.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +5 -0 # fbcon: fix fbcon's setup routine # # drivers/video/neofb.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +5 -1 # fbcon: fix fbcon's setup routine # # drivers/video/maxinefb.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +3 -0 # fbcon: fix fbcon's setup routine # # drivers/video/matrox/matroxfb_crtc2.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +3 -0 # fbcon: fix fbcon's setup routine # # drivers/video/matrox/matroxfb_base.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +5 -1 # fbcon: fix fbcon's setup routine # # drivers/video/macfb.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +4 -1 # fbcon: fix fbcon's setup routine # # drivers/video/leo.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +3 -0 # fbcon: fix fbcon's setup routine # # drivers/video/kyro/fbdev.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +5 -1 # fbcon: fix fbcon's setup routine # # drivers/video/imsttfb.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +6 -1 # fbcon: fix fbcon's setup routine # # drivers/video/igafb.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +3 -0 # fbcon: fix fbcon's setup routine # # drivers/video/i810/i810_main.c # 2004/09/22 13:37:14-07:00 adaplas@hotpop.com +5 -1 # fbcon: fix fbcon's setup routine # # drivers/video/hpfb.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +3 -0 # fbcon: fix fbcon's setup routine # # drivers/video/hitfb.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +3 -0 # fbcon: fix fbcon's setup routine # # drivers/video/hgafb.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +3 -0 # fbcon: fix fbcon's setup routine # # drivers/video/gbefb.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +5 -1 # fbcon: fix fbcon's setup routine # # drivers/video/g364fb.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +3 -0 # fbcon: fix fbcon's setup routine # # drivers/video/fm2fb.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +5 -1 # fbcon: fix fbcon's setup routine # # drivers/video/ffb.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +3 -0 # fbcon: fix fbcon's setup routine # # drivers/video/fbmem.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +26 -18 # fbcon: fix fbcon's setup routine # # drivers/video/epson1355fb.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +3 -0 # fbcon: fix fbcon's setup routine # # drivers/video/dnfb.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +3 -0 # fbcon: fix fbcon's setup routine # # drivers/video/cyber2000fb.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +5 -1 # fbcon: fix fbcon's setup routine # # drivers/video/controlfb.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +4 -1 # fbcon: fix fbcon's setup routine # # drivers/video/clps711xfb.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +3 -0 # fbcon: fix fbcon's setup routine # # drivers/video/cirrusfb.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +5 -1 # fbcon: fix fbcon's setup routine # # drivers/video/chipsfb.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +3 -0 # fbcon: fix fbcon's setup routine # # drivers/video/cg6.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +3 -0 # fbcon: fix fbcon's setup routine # # drivers/video/cg3.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +3 -0 # fbcon: fix fbcon's setup routine # # drivers/video/cg14.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +3 -0 # fbcon: fix fbcon's setup routine # # drivers/video/bw2.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +3 -0 # fbcon: fix fbcon's setup routine # # drivers/video/aty/radeon_base.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +5 -1 # fbcon: fix fbcon's setup routine # # drivers/video/aty/atyfb_base.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +14 -8 # fbcon: fix fbcon's setup routine # # drivers/video/aty/aty128fb.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +10 -1 # fbcon: fix fbcon's setup routine # # drivers/video/asiliantfb.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +3 -0 # fbcon: fix fbcon's setup routine # # drivers/video/amifb.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +5 -1 # fbcon: fix fbcon's setup routine # # drivers/video/amba-clcd.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +2 -0 # fbcon: fix fbcon's setup routine # # drivers/video/acornfb.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +5 -1 # fbcon: fix fbcon's setup routine # # drivers/video/68328fb.c # 2004/09/22 13:28:16-07:00 adaplas@hotpop.com +5 -1 # fbcon: fix fbcon's setup routine # # ChangeSet # 2004/09/22 18:19:30-07:00 adaplas@hotpop.com # [PATCH] fbdev: Fix userland compile breakage # # From: Michal Januszewski # # "The latest changes introduced to the fb structs in linux/fb.h make # compilation of userspace programs break with: # # include/linux/fb.h:305: error: field `modelist' has incomplete type # # This is caused by struct list_head not being seen from userspace." # # This patch removes struct list_head modelist from struct fb_monspecs and # moves it to struct fb_info instead, and for now, enclosed struct # fb_monspecs by #ifdef __KERNEL__/#endif. # # Signed-off-by: Antonino Daplas # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/linux/fb.h # 2004/09/22 13:37:14-07:00 adaplas@hotpop.com +68 -69 # fbdev: Fix userland compile breakage # # drivers/video/riva/fbdev.c # 2004/09/22 13:37:14-07:00 adaplas@hotpop.com +3 -3 # fbdev: Fix userland compile breakage # # drivers/video/modedb.c # 2004/09/22 13:28:15-07:00 adaplas@hotpop.com +1 -1 # fbdev: Fix userland compile breakage # # drivers/video/fbmem.c # 2004/09/22 13:37:14-07:00 adaplas@hotpop.com +8 -8 # fbdev: Fix userland compile breakage # # drivers/video/console/fbcon.c # 2004/09/22 13:28:15-07:00 adaplas@hotpop.com +2 -2 # fbdev: Fix userland compile breakage # # ChangeSet # 2004/09/22 18:19:19-07:00 kraxel@bytesex.org # [PATCH] bttv bugfix # # This fixes a initialization order bug in bttv, also known as "dark red # image bug". # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/media/video/bttv-driver.c # 2004/09/22 13:28:15-07:00 kraxel@bytesex.org +5 -5 # bttv bugfix # # ChangeSet # 2004/09/22 18:19:07-07:00 shaohua.li@intel.com # [PATCH] idr: fix missing spin_unlock() # # Signed-off-by: Li Shaohua # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # lib/idr.c # 2004/09/22 13:24:47-07:00 shaohua.li@intel.com +3 -1 # idr: fix missing spin_unlock() # # ChangeSet # 2004/09/22 18:18:55-07:00 jbarnes@engr.sgi.com # [PATCH] mmtimer cleanups # # A few cleanups that probably should have been done a long time ago: # # o remove test program from mmtimer.h # o move name, desc., etc. #defines from mmtimer.h to mmtimer.c # o document what mmtimer.c is a little better # o some whitespace cleanups for linewrapping and such # # Signed-off-by: Jesse Barnes # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/linux/mmtimer.h # 2004/09/22 13:24:35-07:00 jbarnes@engr.sgi.com +2 -86 # mmtimer cleanups # # drivers/char/mmtimer.c # 2004/09/22 13:24:38-07:00 jbarnes@engr.sgi.com +36 -21 # mmtimer cleanups # # ChangeSet # 2004/09/22 18:18:43-07:00 kihara.seiji@lab.ntt.co.jp # [PATCH] ext3: journalled data fsync fix # # This optimisation data=journal isn't working right, because journalled-data # pages are not marked dirty when they are dirty against the journal. Hence # I_DIRTY_PAGES doesn't get set hence we can fail to sync the file under some # circumstances. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # fs/ext3/fsync.c # 2004/09/22 13:24:35-07:00 kihara.seiji@lab.ntt.co.jp +0 -4 # ext3: journalled data fsync fix # # ChangeSet # 2004/09/22 23:06:41+00:00 aegl@agluck-lia64.sc.intel.com # Merge agluck-lia64.sc.intel.com:/data/home/aegl/BK/work/alex # into agluck-lia64.sc.intel.com:/data/home/aegl/BK/linux-ia64-release-2.6.9 # # arch/ia64/pci/pci.c # 2004/09/22 23:06:36+00:00 aegl@agluck-lia64.sc.intel.com +0 -0 # Auto merged # # arch/ia64/mm/discontig.c # 2004/09/22 23:06:35+00:00 aegl@agluck-lia64.sc.intel.com +0 -0 # Auto merged # # arch/ia64/kernel/acpi.c # 2004/09/22 23:06:35+00:00 aegl@agluck-lia64.sc.intel.com +0 -0 # Auto merged # # ChangeSet # 2004/09/22 23:13:39+01:00 aia21@cantab.net # NTFS: Improve the previous transparent union removal. # # Signed-off-by: Anton Altaparmakov # # fs/ntfs/dir.c # 2004/09/22 23:12:20+01:00 aia21@cantab.net +7 -8 # Improve the previous transparent union removal. # # ChangeSet # 2004/09/22 20:07:55+01:00 aia21@cantab.net # NTFS: Get rid of the ugly transparent union in fs/ntfs/dir.c::ntfs_readdir() # and ntfs_filldir() as per suggestion from Al Viro. # # Signed-off-by: Anton Altaparmakov # # fs/ntfs/dir.c # 2004/09/22 20:06:29+01:00 aia21@cantab.net +14 -28 # Get rid of the ugly transparent union in fs/ntfs/dir.c::ntfs_readdir() # and ntfs_filldir() as per suggestion from Al Viro. # # fs/ntfs/ChangeLog # 2004/09/22 20:06:25+01:00 aia21@cantab.net +2 -0 # Update # # ChangeSet # 2004/09/22 19:00:05+02:00 bzolnier@trik.(none) # [ide] remove ide_hwif_t->sg_dma_active # # It is always equal to zero. # # Signed-off-by: Bartlomiej Zolnierkiewicz # # include/linux/ide.h # 2004/09/22 17:16:30+02:00 bzolnier@trik.(none) +0 -1 # [ide] remove ide_hwif_t->sg_dma_active # # drivers/ide/ppc/pmac.c # 2004/09/22 18:59:40+02:00 bzolnier@trik.(none) +0 -5 # [ide] remove ide_hwif_t->sg_dma_active # # drivers/ide/pci/sgiioc4.c # 2004/09/22 17:16:30+02:00 bzolnier@trik.(none) +0 -1 # [ide] remove ide_hwif_t->sg_dma_active # # drivers/ide/ide-dma.c # 2004/09/22 18:59:15+02:00 bzolnier@trik.(none) +0 -5 # [ide] remove ide_hwif_t->sg_dma_active # # drivers/ide/arm/icside.c # 2004/09/22 17:16:30+02:00 bzolnier@trik.(none) +0 -5 # [ide] remove ide_hwif_t->sg_dma_active # # ChangeSet # 2004/09/22 18:43:57+02:00 bzolnier@trik.(none) # [ide] hpt34x: remove dead /proc/ide/hpt34x code # # Signed-off-by: Bartlomiej Zolnierkiewicz # # drivers/ide/pci/hpt34x.h # 2004/09/22 17:16:59+02:00 bzolnier@trik.(none) +0 -2 # [ide] hpt34x: remove dead /proc/ide/hpt34x code # # drivers/ide/pci/hpt34x.c # 2004/09/22 17:16:59+02:00 bzolnier@trik.(none) +0 -68 # [ide] hpt34x: remove dead /proc/ide/hpt34x code # # ChangeSet # 2004/09/22 08:57:44-07:00 roland@topspin.com # [PATCH] ppc64: remove pSeries IO token translations # # Get rid of IO_TOKEN_TO_ADDR() and IO_ADDR_TO_TOKEN() for pSeries EEH; # the conversion to tokens is not needed now that we have __iomem # annotations to prevent drivers from dereferencing IO addresses. # # The IO tokens meant that the __raw_ IO accesses wouldn't have worked, # and removing the debugging vestiges simplifies the code noticeably. # # Signed-off-by: Roland Dreier # Signed-off-by: Linus Torvalds # # include/asm-ppc64/eeh.h # 2004/09/21 19:39:19-07:00 roland@topspin.com +17 -29 # ppc64: remove pSeries IO token translations # # arch/ppc64/mm/init.c # 2004/09/21 19:42:58-07:00 roland@topspin.com +3 -10 # ppc64: remove pSeries IO token translations # # arch/ppc64/kernel/eeh.c # 2004/09/22 00:14:25-07:00 roland@topspin.com +15 -62 # ppc64: remove pSeries IO token translations # # ChangeSet # 2004/09/22 08:33:58-07:00 viro@www.linux.org.uk # [PATCH] drivers/input annotations # # * vortex.c: trivial __iomem annotations # * serio_raw.c and tsdev.c: equally trivial __user ones. # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # drivers/input/tsdev.c # 2004/09/21 20:10:13-07:00 viro@www.linux.org.uk +2 -2 # drivers/input annotations # # drivers/input/serio/serio_raw.c # 2004/09/21 20:10:13-07:00 viro@www.linux.org.uk +2 -2 # drivers/input annotations # # drivers/input/gameport/vortex.c # 2004/09/21 20:10:13-07:00 viro@www.linux.org.uk +2 -2 # drivers/input annotations # # ChangeSet # 2004/09/22 08:33:46-07:00 viro@www.linux.org.uk # [PATCH] applicom iomem annotations # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # drivers/char/applicom.c # 2004/09/21 20:09:22-07:00 viro@www.linux.org.uk +14 -14 # applicom iomem annotations # # ChangeSet # 2004/09/22 08:33:34-07:00 viro@www.linux.org.uk # [PATCH] net2280 iomem annotations # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # drivers/usb/gadget/net2280.h # 2004/09/21 20:08:32-07:00 viro@www.linux.org.uk +11 -11 # net2280 iomem annotations # # drivers/usb/gadget/net2280.c # 2004/09/21 20:08:32-07:00 viro@www.linux.org.uk +18 -17 # net2280 iomem annotations # # ChangeSet # 2004/09/22 08:33:22-07:00 viro@www.linux.org.uk # [PATCH] rxrpc endianness annotations # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # net/rxrpc/transport.c # 2004/09/21 20:06:16-07:00 viro@www.linux.org.uk +6 -6 # rxrpc endianness annotations # # net/rxrpc/peer.c # 2004/09/21 20:06:16-07:00 viro@www.linux.org.uk +2 -2 # rxrpc endianness annotations # # net/rxrpc/main.c # 2004/09/21 20:06:16-07:00 viro@www.linux.org.uk +1 -1 # rxrpc endianness annotations # # net/rxrpc/connection.c # 2004/09/21 20:06:16-07:00 viro@www.linux.org.uk +19 -18 # rxrpc endianness annotations # # net/rxrpc/call.c # 2004/09/21 20:06:16-07:00 viro@www.linux.org.uk +5 -5 # rxrpc endianness annotations # # include/rxrpc/types.h # 2004/09/21 20:05:22-07:00 viro@www.linux.org.uk +2 -0 # rxrpc endianness annotations # # include/rxrpc/rxrpc.h # 2004/09/21 20:05:22-07:00 viro@www.linux.org.uk +1 -1 # rxrpc endianness annotations # # include/rxrpc/peer.h # 2004/09/21 20:05:22-07:00 viro@www.linux.org.uk +1 -1 # rxrpc endianness annotations # # include/rxrpc/packet.h # 2004/09/21 20:05:22-07:00 viro@www.linux.org.uk +13 -13 # rxrpc endianness annotations # # include/rxrpc/connection.h # 2004/09/21 20:05:22-07:00 viro@www.linux.org.uk +6 -6 # rxrpc endianness annotations # # include/rxrpc/call.h # 2004/09/21 20:05:22-07:00 viro@www.linux.org.uk +3 -3 # rxrpc endianness annotations # # ChangeSet # 2004/09/22 08:33:10-07:00 viro@www.linux.org.uk # [PATCH] afs endianness annotations # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # fs/afs/vlclient.c # 2004/09/21 20:04:26-07:00 viro@www.linux.org.uk +6 -5 # afs endianness annotations # # fs/afs/fsclient.c # 2004/09/21 20:04:26-07:00 viro@www.linux.org.uk +3 -3 # afs endianness annotations # # fs/afs/dir.c # 2004/09/21 20:04:26-07:00 viro@www.linux.org.uk +8 -8 # afs endianness annotations # # fs/afs/cmservice.c # 2004/09/21 20:04:26-07:00 viro@www.linux.org.uk +1 -1 # afs endianness annotations # # ChangeSet # 2004/09/22 08:32:58-07:00 viro@www.linux.org.uk # [PATCH] jbd endianness annotations # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # include/linux/jbd.h # 2004/09/21 19:58:34-07:00 viro@www.linux.org.uk +19 -19 # jbd endianness annotations # # fs/jbd/revoke.c # 2004/09/21 19:58:17-07:00 viro@www.linux.org.uk +6 -6 # jbd endianness annotations # # fs/jbd/recovery.c # 2004/09/21 19:58:14-07:00 viro@www.linux.org.uk +16 -16 # jbd endianness annotations # # fs/jbd/journal.c # 2004/09/21 19:58:08-07:00 viro@www.linux.org.uk +25 -25 # jbd endianness annotations # # fs/jbd/commit.c # 2004/09/21 19:58:03-07:00 viro@www.linux.org.uk +9 -9 # jbd endianness annotations # # ChangeSet # 2004/09/22 08:32:46-07:00 viro@www.linux.org.uk # [PATCH] efs endianness annotations # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # include/linux/efs_vh.h # 2004/09/21 19:56:46-07:00 viro@www.linux.org.uk +10 -10 # efs endianness annotations # # include/linux/efs_fs_sb.h # 2004/09/21 19:56:23-07:00 viro@www.linux.org.uk +26 -26 # efs endianness annotations # # include/linux/efs_fs_i.h # 2004/09/21 19:56:19-07:00 viro@www.linux.org.uk +12 -12 # efs endianness annotations # # include/linux/efs_dir.h # 2004/09/21 19:56:10-07:00 viro@www.linux.org.uk +2 -2 # efs endianness annotations # # fs/efs/super.c # 2004/09/21 19:57:20-07:00 viro@www.linux.org.uk +4 -3 # efs endianness annotations # # ChangeSet # 2004/09/22 08:32:34-07:00 viro@www.linux.org.uk # [PATCH] fat endianness annotations # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # include/linux/msdos_fs.h # 2004/09/21 19:55:41-07:00 viro@www.linux.org.uk +26 -27 # fat endianness annotations # # fs/vfat/namei.c # 2004/09/21 19:55:18-07:00 viro@www.linux.org.uk +4 -3 # fat endianness annotations # # fs/fat/misc.c # 2004/09/21 19:54:57-07:00 viro@www.linux.org.uk +3 -4 # fat endianness annotations # # fs/fat/inode.c # 2004/09/21 19:54:57-07:00 viro@www.linux.org.uk +3 -3 # fat endianness annotations # # fs/fat/dir.c # 2004/09/21 19:54:57-07:00 viro@www.linux.org.uk +1 -1 # fat endianness annotations # # fs/fat/cache.c # 2004/09/21 19:54:57-07:00 viro@www.linux.org.uk +4 -4 # fat endianness annotations # # ChangeSet # 2004/09/22 08:32:22-07:00 viro@www.linux.org.uk # [PATCH] ext3 endianness annotations and bugfixes # # * missing le32_to_cpu() in a bunch of printks # * on big-endian boxen ext3_error() failed to set EXT3_ERROR_FS in # ->s_state (cpu_to_le32() instead of cpu_to_le16()) # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # include/linux/ext3_fs_i.h # 2004/09/21 19:53:31-07:00 viro@www.linux.org.uk +1 -1 # ext3 endianness annotations and bugfixes # # include/linux/ext3_fs.h # 2004/09/21 19:53:28-07:00 viro@www.linux.org.uk +68 -68 # ext3 endianness annotations and bugfixes # # fs/ext3/xattr.h # 2004/09/21 19:54:22-07:00 viro@www.linux.org.uk +8 -8 # ext3 endianness annotations and bugfixes # # fs/ext3/xattr.c # 2004/09/21 19:54:22-07:00 viro@www.linux.org.uk +1 -1 # ext3 endianness annotations and bugfixes # # fs/ext3/super.c # 2004/09/21 19:54:22-07:00 viro@www.linux.org.uk +16 -15 # ext3 endianness annotations and bugfixes # # fs/ext3/namei.c # 2004/09/21 19:54:22-07:00 viro@www.linux.org.uk +17 -20 # ext3 endianness annotations and bugfixes # # fs/ext3/inode.c # 2004/09/21 19:54:22-07:00 viro@www.linux.org.uk +24 -22 # ext3 endianness annotations and bugfixes # # fs/ext3/ialloc.c # 2004/09/21 19:54:22-07:00 viro@www.linux.org.uk +2 -2 # ext3 endianness annotations and bugfixes # # fs/ext3/balloc.c # 2004/09/21 19:54:22-07:00 viro@www.linux.org.uk +2 -2 # ext3 endianness annotations and bugfixes # # fs/ext3/acl.h # 2004/09/21 19:54:22-07:00 viro@www.linux.org.uk +6 -6 # ext3 endianness annotations and bugfixes # # ChangeSet # 2004/09/22 08:32:10-07:00 viro@www.linux.org.uk # [PATCH] sysvfs endianness annotations and bugfixes # # missing fs32_to_cpu() for on-disk ->s_type. # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # include/linux/sysv_fs.h # 2004/09/21 19:53:02-07:00 viro@www.linux.org.uk +68 -63 # sysvfs endianness annotations and bugfixes # # fs/sysv/sysv.h # 2004/09/21 19:52:08-07:00 viro@www.linux.org.uk +38 -32 # sysvfs endianness annotations and bugfixes # # fs/sysv/super.c # 2004/09/21 19:52:05-07:00 viro@www.linux.org.uk +22 -14 # sysvfs endianness annotations and bugfixes # # fs/sysv/itree.c # 2004/09/21 19:52:01-07:00 viro@www.linux.org.uk +18 -18 # sysvfs endianness annotations and bugfixes # # fs/sysv/ialloc.c # 2004/09/21 19:51:57-07:00 viro@www.linux.org.uk +1 -1 # sysvfs endianness annotations and bugfixes # # fs/sysv/balloc.c # 2004/09/21 19:51:53-07:00 viro@www.linux.org.uk +16 -15 # sysvfs endianness annotations and bugfixes # # ChangeSet # 2004/09/22 08:31:58-07:00 axboe@suse.de # [PATCH] bio_unmap_user(): original bio passed in # # With the recent bio mapping changes, the caller must pass in the # original bio for unmapping again (and they do). So kill this dead code, # it could cause problems in situations where someone has used bi_private # for something else. # # Signed-off-by: Jens Axboe # Signed-off-by: Linus Torvalds # # fs/bio.c # 2004/09/13 06:27:28-07:00 axboe@suse.de +0 -12 # bio_unmap_user(): original bio passed in # # ChangeSet # 2004/09/22 16:31:09+01:00 aia21@cantab.net # NTFS: - Remove BKL use from ntfs_setattr() syncing up with the rest of the # kernel. # - Update ->setattr (fs/ntfs/inode.c::ntfs_setattr()) to refuse to # change the uid, gid, and mode of an inode as we do not support NTFS # ACLs yet. # # Signed-off-by: Anton Altaparmakov # # fs/ntfs/inode.c # 2004/09/22 16:31:01+01:00 aia21@cantab.net +34 -35 # - Update ->setattr (fs/ntfs/inode.c::ntfs_setattr()) to refuse to # change the uid, gid, and mode of an inode as we do not support NTFS # ACLs yet. # - Remove BKL use from ntfs_setattr() syncing up with the rest of the # kernel. # # fs/ntfs/Makefile # 2004/09/22 16:31:01+01:00 aia21@cantab.net +1 -1 # Start 2.1.19-WIP # # fs/ntfs/ChangeLog # 2004/09/22 16:31:01+01:00 aia21@cantab.net +8 -0 # Update # # ChangeSet # 2004/09/22 10:11:14+01:00 aia21@cantab.net # NTFS: 2.1.18 release # # - Minor cleanup of fs/ntfs/inode.c::ntfs_init_locked_inode(). # - Bump version number and update Documentation/filesystems/ntfs.txt # # Signed-off-by: Anton Altaparmakov # # fs/ntfs/inode.c # 2004/09/22 10:11:06+01:00 aia21@cantab.net +7 -3 # Minor cleanup of ntfs_init_locked_inode(). # # fs/ntfs/Makefile # 2004/09/22 10:11:06+01:00 aia21@cantab.net +1 -1 # Update for 2.1.18 release. # # fs/ntfs/ChangeLog # 2004/09/22 10:11:06+01:00 aia21@cantab.net +2 -1 # Update for 2.1.18 release. # # Documentation/filesystems/ntfs.txt # 2004/09/22 10:11:06+01:00 aia21@cantab.net +4 -0 # Update for 2.1.18 release. # # ChangeSet # 2004/09/21 16:53:11-07:00 viro@www.linux.org.uk # [PATCH] cifs: IPv4-related endianness annotations and bugfixes # # missing htons() in assigning .sin_port for reconnect # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:52:59-07:00 viro@www.linux.org.uk # [PATCH] cifs: assorted endianness bugfixes # # a) Flags2 left little-endian. SMBFLG2_... definitions switched to # cpu_to_le16(...), which kills the need of conversions in ->Flags2. # b) FILE_SYSTEM_UNIX_INFO (never used anywhere) is left little-endian; # when users appear, they can convert themselves. # c) bugfix: in CIFSSessSetup() we used SecurityBlobLength of response # without conversion. That would screw bigendian clients with servers that # give wcnt=4. # d) bugfix: in CIFSNTLMSSPNegotiateSessSetup() we use # SecurityBlob2->NegotiateFlags without conversion. Again, problem on # big-endian. # e) bugfix: SecurityBlob->MessageType is *not* host-endian. # f) bugfix: ->sendmsg() expects its last argument to be equal to sum # of iovec lengths, so the value passed to kernel_sendmsg()/sock_sendmsg() # would better be correct... # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:52:48-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate SESSION_SETUP_ANX # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:52:36-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate TCONX_{REQ,RESP} # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:52:24-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate smb_hdr # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:52:11-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate T2_F{FIRST,NEXT|_RSP_PARMS # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:52:02-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate FILE_SYSTEM_ATTRIBUTE_INFO # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:51:50-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate FILE_SYSTEM_DEVICE_INFO # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:51:38-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate FILE_DIRECTORY_INFO, clean up cifs_readdir() # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:51:26-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate stat-related structures # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:51:14-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate fea{,list}, endianness bugfix # # in CIFSSMSetEA() ->list_len got (__u32)cpu_to_le16() instead of cpu_to_le32(). # Broken on big-endian... # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:51:03-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate TRANSACT_CHANGE_NOTIFY_{REQ,RESP} # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:50:51-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate file_..._info # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:50:39-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate TRANSACTION2_QFSI_{REQ,RESP} # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:50:27-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate TRANSACTION2_GET_DFS_REFER_{REQ,RESP}, minor endianness bugfix # # missing le..._to_cpu() in debugging printk # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:50:16-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate TRANSACTION2_FNEXT_{REQ,RESP} # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:50:04-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate TRANSACTION2_FFIRST_{REQ,RESP}, typo fix in CIFSSMBFindSingle() # # in CIFSSMBFindSingle() pSMB->TotalParameterCount got wrong value due to typo. # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:49:52-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate TRANSACT_IOCTL_{REQ,RESP} # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:49:40-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate TRANSACTION2_QPI_{REQ,RESP} # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:49:28-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate NT_RENAME_{REQ,RESP} # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:49:16-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate TRANSACTION2_SPI_{REQ,RESP} # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:49:05-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate COPY_{REQ,RESP}, minor endianness bugfix # # missing le16_to_cpu() in debugging printk # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:48:50-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate TRANSACTION2_SFI_{REQ,RESP} # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:48:38-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate RENAME_{REQ,RESP} # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:48:26-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate LOCK_{REQ,RESP} # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:48:14-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate WRITE_{REQ,RESP} # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:48:02-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate READ_{REQ,RESP} # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:47:49-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate OPEN_{REQ,RESP}, endianness bugfix # # in assignment to OPEN_REQ ->SecurityFlags we did u8 = cpu_to_le32(v8), which # breaks on big-endian. # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:47:37-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate CREATE_DIRECTORY_{REQ,RESP} # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:47:25-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate DELETE_DIRECTORY_{REQ,RESP} # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:47:13-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate DELETE_FILE_{REQ,RESP} # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 16:47:01-07:00 viro@www.linux.org.uk # [PATCH] cifs: annotate NEGOTIATE_{REQ,RESP} # # Signed-off-by: Al Viro # Signed-off-by: Linus Torvalds # # ChangeSet # 2004/09/21 19:32:49-07:00 davem@nuts.davemloft.net # Cset exclude: pablo@eurodev.net|ChangeSet|20040828001121|29246 # # net/netlink/af_netlink.c # 2004/09/21 19:32:44-07:00 davem@nuts.davemloft.net +0 -0 # Exclude # # ChangeSet # 2004/09/21 19:19:42-07:00 yoshfuji@linux-ipv6.org # [NET]: Fix non-existent reference to tulip.txt # # Signed-off-by: Hideaki YOSHIFUJI # Signed-off-by: David S. Miller # # drivers/net/tulip/Kconfig # 2004/09/21 19:19:24-07:00 yoshfuji@linux-ipv6.org +1 -3 # [NET]: Fix non-existent reference to tulip.txt # # Signed-off-by: Hideaki YOSHIFUJI # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/21 19:17:02-07:00 tgraf@suug.ch # [NET]: Fix ifmap alignment issues over rtnetlink # # Introduces a fixed size variant of ifmap for rtnetlink. Fixes # issues with address size mismatch between kernel and userspace. # Obviously this will fail if userspace provides an address greater # than 32bit. # # Signed-off-by: Thomas Graf # SIgned-off-by: David S. Miller # # net/core/rtnetlink.c # 2004/09/21 19:16:43-07:00 tgraf@suug.ch +16 -5 # [NET]: Fix ifmap alignment issues over rtnetlink # # Introduces a fixed size variant of ifmap for rtnetlink. Fixes # issues with address size mismatch between kernel and userspace. # Obviously this will fail if userspace provides an address greater # than 32bit. # # Signed-off-by: Thomas Graf # SIgned-off-by: David S. Miller # # include/linux/rtnetlink.h # 2004/09/21 19:16:43-07:00 tgraf@suug.ch +11 -0 # [NET]: Fix ifmap alignment issues over rtnetlink # # Introduces a fixed size variant of ifmap for rtnetlink. Fixes # issues with address size mismatch between kernel and userspace. # Obviously this will fail if userspace provides an address greater # than 32bit. # # Signed-off-by: Thomas Graf # SIgned-off-by: David S. Miller # # ChangeSet # 2004/09/21 19:14:39-07:00 herbert@gondor.apana.org.au # [IPV4]: Fix some stray IP_ROUTE_TOS references. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # net/ipv4/Kconfig # 2004/09/21 19:14:21-07:00 herbert@gondor.apana.org.au +2 -6 # [IPV4]: Fix some stray IP_ROUTE_TOS references. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # fs/cifs/netmisc.c # 2004/09/17 18:48:50-07:00 viro@www.linux.org.uk +2 -2 # cifs: IPv4-related endianness annotations and bugfixes # # fs/cifs/misc.c # 2004/09/17 18:48:50-07:00 viro@www.linux.org.uk +7 -8 # cifs: IPv4-related endianness annotations and bugfixes # # fs/cifs/connect.c # 2004/09/17 18:48:50-07:00 viro@www.linux.org.uk +4 -4 # cifs: IPv4-related endianness annotations and bugfixes # # fs/cifs/transport.c # 2004/09/17 18:45:36-07:00 viro@www.linux.org.uk +12 -17 # cifs: assorted endianness bugfixes # # fs/cifs/ntlmssp.h # 2004/09/17 18:45:36-07:00 viro@www.linux.org.uk +4 -4 # cifs: assorted endianness bugfixes # # fs/cifs/misc.c # 2004/09/17 18:45:36-07:00 viro@www.linux.org.uk +2 -2 # cifs: assorted endianness bugfixes # # fs/cifs/connect.c # 2004/09/17 18:45:36-07:00 viro@www.linux.org.uk +6 -7 # cifs: assorted endianness bugfixes # # fs/cifs/cifssmb.c # 2004/09/17 18:45:36-07:00 viro@www.linux.org.uk +1 -7 # cifs: assorted endianness bugfixes # # fs/cifs/cifspdu.h # 2004/09/17 18:45:36-07:00 viro@www.linux.org.uk +10 -10 # cifs: assorted endianness bugfixes # # fs/cifs/cifsencrypt.c # 2004/09/17 18:45:36-07:00 viro@www.linux.org.uk +1 -1 # cifs: assorted endianness bugfixes # # fs/cifs/ntlmssp.h # 2004/09/17 18:45:36-07:00 viro@www.linux.org.uk +9 -9 # cifs: annotate SESSION_SETUP_ANX # # fs/cifs/connect.c # 2004/09/17 18:45:36-07:00 viro@www.linux.org.uk +102 -103 # cifs: annotate SESSION_SETUP_ANX # # fs/cifs/cifspdu.h # 2004/09/17 18:45:36-07:00 viro@www.linux.org.uk +26 -26 # cifs: annotate SESSION_SETUP_ANX # # fs/cifs/connect.c # 2004/09/17 18:45:35-07:00 viro@www.linux.org.uk +11 -10 # cifs: annotate TCONX_{REQ,RESP} # # fs/cifs/cifspdu.h # 2004/09/17 18:45:35-07:00 viro@www.linux.org.uk +7 -7 # cifs: annotate TCONX_{REQ,RESP} # # fs/cifs/transport.c # 2004/09/17 18:45:35-07:00 viro@www.linux.org.uk +0 -5 # cifs: annotate smb_hdr # # fs/cifs/netmisc.c # 2004/09/17 18:45:35-07:00 viro@www.linux.org.uk +4 -7 # cifs: annotate smb_hdr # # fs/cifs/misc.c # 2004/09/17 18:45:35-07:00 viro@www.linux.org.uk +2 -5 # cifs: annotate smb_hdr # # fs/cifs/connect.c # 2004/09/17 18:45:35-07:00 viro@www.linux.org.uk +1 -1 # cifs: annotate smb_hdr # # fs/cifs/cifssmb.c # 2004/09/17 18:45:35-07:00 viro@www.linux.org.uk +2 -6 # cifs: annotate smb_hdr # # fs/cifs/cifspdu.h # 2004/09/17 18:45:35-07:00 viro@www.linux.org.uk +5 -5 # cifs: annotate smb_hdr # # fs/cifs/cifsencrypt.c # 2004/09/17 18:45:35-07:00 viro@www.linux.org.uk +1 -3 # cifs: annotate smb_hdr # # fs/cifs/file.c # 2004/09/17 18:45:35-07:00 viro@www.linux.org.uk +12 -9 # cifs: annotate T2_F{FIRST,NEXT|_RSP_PARMS # # fs/cifs/cifssmb.c # 2004/09/17 18:45:35-07:00 viro@www.linux.org.uk +0 -9 # cifs: annotate T2_F{FIRST,NEXT|_RSP_PARMS # # fs/cifs/cifspdu.h # 2004/09/17 18:45:35-07:00 viro@www.linux.org.uk +8 -8 # cifs: annotate T2_F{FIRST,NEXT|_RSP_PARMS # # fs/cifs/cifssmb.c # 2004/09/17 18:45:34-07:00 viro@www.linux.org.uk +0 -5 # cifs: annotate FILE_SYSTEM_ATTRIBUTE_INFO # # fs/cifs/cifspdu.h # 2004/09/17 18:45:34-07:00 viro@www.linux.org.uk +3 -3 # cifs: annotate FILE_SYSTEM_ATTRIBUTE_INFO # # fs/cifs/cifs_debug.c # 2004/09/17 18:45:34-07:00 viro@www.linux.org.uk +3 -2 # cifs: annotate FILE_SYSTEM_ATTRIBUTE_INFO # # fs/cifs/cifssmb.c # 2004/09/17 18:45:34-07:00 viro@www.linux.org.uk +0 -4 # cifs: annotate FILE_SYSTEM_DEVICE_INFO # # fs/cifs/cifspdu.h # 2004/09/17 18:45:34-07:00 viro@www.linux.org.uk +2 -2 # cifs: annotate FILE_SYSTEM_DEVICE_INFO # # fs/cifs/cifs_debug.c # 2004/09/17 18:45:34-07:00 viro@www.linux.org.uk +6 -5 # cifs: annotate FILE_SYSTEM_DEVICE_INFO # # fs/cifs/file.c # 2004/09/17 18:45:34-07:00 viro@www.linux.org.uk +24 -29 # cifs: annotate FILE_DIRECTORY_INFO, clean up cifs_readdir() # # fs/cifs/cifspdu.h # 2004/09/17 18:45:34-07:00 viro@www.linux.org.uk +9 -9 # cifs: annotate FILE_DIRECTORY_INFO, clean up cifs_readdir() # # fs/cifs/inode.c # 2004/09/17 18:45:33-07:00 viro@www.linux.org.uk +20 -21 # cifs: annotate stat-related structures # # fs/cifs/file.c # 2004/09/17 18:45:33-07:00 viro@www.linux.org.uk +12 -12 # cifs: annotate stat-related structures # # fs/cifs/cifspdu.h # 2004/09/17 18:45:33-07:00 viro@www.linux.org.uk +46 -46 # cifs: annotate stat-related structures # # fs/cifs/cifssmb.c # 2004/09/17 18:45:33-07:00 viro@www.linux.org.uk +14 -16 # cifs: annotate fea{,list}, endianness bugfix # # fs/cifs/cifspdu.h # 2004/09/17 18:45:33-07:00 viro@www.linux.org.uk +2 -2 # cifs: annotate fea{,list}, endianness bugfix # # fs/cifs/cifssmb.c # 2004/09/17 18:45:33-07:00 viro@www.linux.org.uk +0 -1 # cifs: annotate TRANSACT_CHANGE_NOTIFY_{REQ,RESP} # # fs/cifs/cifspdu.h # 2004/09/17 18:45:33-07:00 viro@www.linux.org.uk +19 -19 # cifs: annotate TRANSACT_CHANGE_NOTIFY_{REQ,RESP} # # fs/cifs/cifspdu.h # 2004/09/17 18:45:32-07:00 viro@www.linux.org.uk +2 -2 # cifs: annotate file_..._info # # fs/cifs/cifssmb.c # 2004/09/17 18:45:32-07:00 viro@www.linux.org.uk +37 -33 # cifs: annotate TRANSACTION2_QFSI_{REQ,RESP} # # fs/cifs/cifspdu.h # 2004/09/17 18:45:32-07:00 viro@www.linux.org.uk +28 -28 # cifs: annotate TRANSACTION2_QFSI_{REQ,RESP} # # fs/cifs/cifssmb.c # 2004/09/17 18:45:32-07:00 viro@www.linux.org.uk +20 -18 # cifs: annotate TRANSACTION2_GET_DFS_REFER_{REQ,RESP}, minor endianness bugfix # # fs/cifs/cifspdu.h # 2004/09/17 18:45:32-07:00 viro@www.linux.org.uk +33 -33 # cifs: annotate TRANSACTION2_GET_DFS_REFER_{REQ,RESP}, minor endianness bugfix # # fs/cifs/cifssmb.c # 2004/09/17 18:45:32-07:00 viro@www.linux.org.uk +9 -7 # cifs: annotate TRANSACTION2_FNEXT_{REQ,RESP} # # fs/cifs/cifspdu.h # 2004/09/17 18:45:32-07:00 viro@www.linux.org.uk +23 -23 # cifs: annotate TRANSACTION2_FNEXT_{REQ,RESP} # # fs/cifs/cifssmb.c # 2004/09/17 18:45:31-07:00 viro@www.linux.org.uk +12 -10 # cifs: annotate TRANSACTION2_FFIRST_{REQ,RESP}, typo fix in CIFSSMBFindSingle() # # fs/cifs/cifspdu.h # 2004/09/17 18:45:31-07:00 viro@www.linux.org.uk +25 -25 # cifs: annotate TRANSACTION2_FFIRST_{REQ,RESP}, typo fix in CIFSSMBFindSingle() # # fs/cifs/cifspdu.h # 2004/09/17 18:45:31-07:00 viro@www.linux.org.uk +20 -20 # cifs: annotate TRANSACT_IOCTL_{REQ,RESP} # # fs/cifs/cifssmb.c # 2004/09/17 18:45:31-07:00 viro@www.linux.org.uk +56 -56 # cifs: annotate TRANSACTION2_QPI_{REQ,RESP} # # fs/cifs/cifspdu.h # 2004/09/17 18:45:31-07:00 viro@www.linux.org.uk +22 -22 # cifs: annotate TRANSACTION2_QPI_{REQ,RESP} # # fs/cifs/cifssmb.c # 2004/09/17 18:45:30-07:00 viro@www.linux.org.uk +4 -3 # cifs: annotate NT_RENAME_{REQ,RESP} # # fs/cifs/cifspdu.h # 2004/09/17 18:45:30-07:00 viro@www.linux.org.uk +4 -4 # cifs: annotate NT_RENAME_{REQ,RESP} # # fs/cifs/cifssmb.c # 2004/09/17 18:45:30-07:00 viro@www.linux.org.uk +89 -85 # cifs: annotate TRANSACTION2_SPI_{REQ,RESP} # # fs/cifs/cifspdu.h # 2004/09/17 18:45:30-07:00 viro@www.linux.org.uk +21 -21 # cifs: annotate TRANSACTION2_SPI_{REQ,RESP} # # fs/cifs/cifssmb.c # 2004/09/17 18:45:30-07:00 viro@www.linux.org.uk +6 -7 # cifs: annotate COPY_{REQ,RESP}, minor endianness bugfix # # fs/cifs/cifspdu.h # 2004/09/17 18:45:30-07:00 viro@www.linux.org.uk +4 -4 # cifs: annotate COPY_{REQ,RESP}, minor endianness bugfix # # fs/cifs/cifssmb.c # 2004/09/17 18:45:29-07:00 viro@www.linux.org.uk +28 -28 # cifs: annotate TRANSACTION2_SFI_{REQ,RESP} # # fs/cifs/cifspdu.h # 2004/09/17 18:45:29-07:00 viro@www.linux.org.uk +23 -23 # cifs: annotate TRANSACTION2_SFI_{REQ,RESP} # # fs/cifs/cifssmb.c # 2004/09/17 18:45:29-07:00 viro@www.linux.org.uk +4 -3 # cifs: annotate RENAME_{REQ,RESP} # # fs/cifs/cifspdu.h # 2004/09/17 18:45:29-07:00 viro@www.linux.org.uk +2 -2 # cifs: annotate RENAME_{REQ,RESP} # # fs/cifs/cifspdu.h # 2004/09/17 18:45:29-07:00 viro@www.linux.org.uk +12 -12 # cifs: annotate LOCK_{REQ,RESP} # # fs/cifs/cifssmb.c # 2004/09/17 18:45:28-07:00 viro@www.linux.org.uk +11 -10 # cifs: annotate WRITE_{REQ,RESP} # # fs/cifs/cifspdu.h # 2004/09/17 18:45:28-07:00 viro@www.linux.org.uk +13 -13 # cifs: annotate WRITE_{REQ,RESP} # # fs/cifs/cifssmb.c # 2004/09/17 18:45:28-07:00 viro@www.linux.org.uk +7 -7 # cifs: annotate READ_{REQ,RESP} # # fs/cifs/cifspdu.h # 2004/09/17 18:45:28-07:00 viro@www.linux.org.uk +15 -15 # cifs: annotate READ_{REQ,RESP} # # fs/cifs/cifssmb.c # 2004/09/17 18:45:28-07:00 viro@www.linux.org.uk +10 -10 # cifs: annotate OPEN_{REQ,RESP}, endianness bugfix # # fs/cifs/cifspdu.h # 2004/09/17 18:45:28-07:00 viro@www.linux.org.uk +23 -23 # cifs: annotate OPEN_{REQ,RESP}, endianness bugfix # # fs/cifs/cifssmb.c # 2004/09/17 18:45:28-07:00 viro@www.linux.org.uk +2 -3 # cifs: annotate CREATE_DIRECTORY_{REQ,RESP} # # fs/cifs/cifspdu.h # 2004/09/17 18:45:28-07:00 viro@www.linux.org.uk +1 -1 # cifs: annotate CREATE_DIRECTORY_{REQ,RESP} # # fs/cifs/cifssmb.c # 2004/09/17 18:45:27-07:00 viro@www.linux.org.uk +2 -3 # cifs: annotate DELETE_DIRECTORY_{REQ,RESP} # # fs/cifs/cifspdu.h # 2004/09/17 18:45:27-07:00 viro@www.linux.org.uk +1 -1 # cifs: annotate DELETE_DIRECTORY_{REQ,RESP} # # fs/cifs/cifssmb.c # 2004/09/17 18:45:27-07:00 viro@www.linux.org.uk +2 -3 # cifs: annotate DELETE_FILE_{REQ,RESP} # # fs/cifs/cifspdu.h # 2004/09/17 18:45:27-07:00 viro@www.linux.org.uk +2 -2 # cifs: annotate DELETE_FILE_{REQ,RESP} # # fs/cifs/cifssmb.c # 2004/09/17 18:45:27-07:00 viro@www.linux.org.uk +5 -4 # cifs: annotate NEGOTIATE_{REQ,RESP} # # fs/cifs/cifspdu.h # 2004/09/17 18:45:27-07:00 viro@www.linux.org.uk +11 -11 # cifs: annotate NEGOTIATE_{REQ,RESP} # # ChangeSet # 2004/09/21 16:37:09-07:00 davem@nuts.davemloft.net # [NET]: Add ethtool support to loopback driver. # # Signed-off-by: David S. Miller # # drivers/net/loopback.c # 2004/09/21 16:36:40-07:00 davem@nuts.davemloft.net +13 -0 # [NET]: Add ethtool support to loopback driver. # # ChangeSet # 2004/09/21 16:32:41-07:00 davem@nuts.davemloft.net # [IPV4]: Fix list traversal in fn_hash_insert(). # # Could create an endless loop during route # replace operations. # # Signed-off-by: David S. Miller # # net/ipv4/fib_hash.c # 2004/09/21 16:31:48-07:00 davem@nuts.davemloft.net +1 -1 # [IPV4]: Fix list traversal in fn_hash_insert(). # # ChangeSet # 2004/09/21 15:05:15-07:00 rth@kanga.twiddle.home # [ALPHA] Map readb_relaxed to __raw_readb, not plain readb. # # include/asm-alpha/io.h # 2004/09/21 15:04:54-07:00 rth@kanga.twiddle.home +4 -4 # Map readb_relaxed to __raw_readb, not plain readb. # # ChangeSet # 2004/09/21 15:01:24-07:00 rth@kanga.twiddle.home # [ALPHA] Update readb and friends for __iomem. # # include/asm-alpha/vga.h # 2004/09/21 15:01:03-07:00 rth@kanga.twiddle.home +9 -9 # Use __iomem with readw/writew. # # include/asm-alpha/spinlock.h # 2004/09/21 15:01:03-07:00 rth@kanga.twiddle.home +1 -1 # Fix signed one bit field. # # include/asm-alpha/machvec.h # 2004/09/21 15:01:03-07:00 rth@kanga.twiddle.home +10 -10 # Use __iomem for ioremap et al. # # include/asm-alpha/jensen.h # 2004/09/21 15:01:03-07:00 rth@kanga.twiddle.home +23 -15 # Use __iomem for ioremap et al. # # include/asm-alpha/io.h # 2004/09/21 15:01:03-07:00 rth@kanga.twiddle.home +132 -125 # Use __iomem for ioremap et al. # # include/asm-alpha/core_wildfire.h # 2004/09/21 15:01:03-07:00 rth@kanga.twiddle.home +32 -32 # Use __iomem for ioremap et al. # # include/asm-alpha/core_tsunami.h # 2004/09/21 15:01:03-07:00 rth@kanga.twiddle.home +35 -35 # Use __iomem for ioremap et al. # # include/asm-alpha/core_titan.h # 2004/09/21 15:01:03-07:00 rth@kanga.twiddle.home +38 -38 # Use __iomem for ioremap et al. # # include/asm-alpha/core_t2.h # 2004/09/21 15:01:03-07:00 rth@kanga.twiddle.home +34 -26 # Use __iomem for ioremap et al. # # include/asm-alpha/core_polaris.h # 2004/09/21 15:01:03-07:00 rth@kanga.twiddle.home +36 -36 # Use __iomem for ioremap et al. # # include/asm-alpha/core_mcpcia.h # 2004/09/21 15:01:03-07:00 rth@kanga.twiddle.home +42 -42 # Use __iomem for ioremap et al. # # include/asm-alpha/core_marvel.h # 2004/09/21 15:01:03-07:00 rth@kanga.twiddle.home +23 -55 # Use __iomem for ioremap et al. # # include/asm-alpha/core_lca.h # 2004/09/21 15:01:03-07:00 rth@kanga.twiddle.home +34 -30 # Use __iomem for ioremap et al. # # include/asm-alpha/core_irongate.h # 2004/09/21 15:01:03-07:00 rth@kanga.twiddle.home +35 -35 # Use __iomem for ioremap et al. # # include/asm-alpha/core_cia.h # 2004/09/21 15:01:02-07:00 rth@kanga.twiddle.home +66 -62 # Use __iomem for ioremap et al. # # include/asm-alpha/core_apecs.h # 2004/09/21 15:01:02-07:00 rth@kanga.twiddle.home +34 -30 # Use __iomem for ioremap et al. # # arch/alpha/lib/io.c # 2004/09/21 15:01:02-07:00 rth@kanga.twiddle.home +46 -41 # Use __iomem for ioremap et al. # # arch/alpha/kernel/core_irongate.c # 2004/09/21 15:01:02-07:00 rth@kanga.twiddle.home +11 -9 # Use __iomem for ioremap et al. # # arch/alpha/kernel/core_cia.c # 2004/09/21 15:01:02-07:00 rth@kanga.twiddle.home +2 -2 # Use __iomem. # # ChangeSet # 2004/09/21 14:59:49-07:00 chas@cmf.nrl.navy.mil # [ATM]: [he] Make code more readable with list_for_each_entry # # From Domen Puncer # # Signed-off-by: David S. Miller # # drivers/atm/he.c # 2004/09/21 14:59:32-07:00 chas@cmf.nrl.navy.mil +2 -3 # [ATM]: [he] Make code more readable with list_for_each_entry # # From Domen Puncer # # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/21 14:58:34-07:00 chas@cmf.nrl.navy.mil # [ATM]: [drivers] Use msleep() instead of schedule_timeout() # # From Nishanth Aravamudan # # Signed-off-by: David S. Miller # # drivers/atm/lanai.c # 2004/09/21 14:58:17-07:00 chas@cmf.nrl.navy.mil +1 -1 # [ATM]: [drivers] Use msleep() instead of schedule_timeout() # # From Nishanth Aravamudan # # Signed-off-by: David S. Miller # # drivers/atm/idt77252.c # 2004/09/21 14:58:16-07:00 chas@cmf.nrl.navy.mil +3 -3 # [ATM]: [drivers] Use msleep() instead of schedule_timeout() # # From Nishanth Aravamudan # # Signed-off-by: David S. Miller # # drivers/atm/he.c # 2004/09/21 14:58:16-07:00 chas@cmf.nrl.navy.mil +2 -3 # [ATM]: [drivers] Use msleep() instead of schedule_timeout() # # From Nishanth Aravamudan # # Signed-off-by: David S. Miller # # drivers/atm/firestream.c # 2004/09/21 14:58:16-07:00 chas@cmf.nrl.navy.mil +1 -2 # [ATM]: [drivers] Use msleep() instead of schedule_timeout() # # From Nishanth Aravamudan # # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/21 14:28:56-07:00 davem@nuts.davemloft.net # [ATM]: Use __iomem where appropriate. # # Signed-off-by: David S. Miller # # drivers/atm/nicstarmac.h # 2004/09/21 14:28:23-07:00 davem@nuts.davemloft.net +1 -1 # [ATM]: Use __iomem where appropriate. # # drivers/atm/nicstar.h # 2004/09/21 14:28:23-07:00 davem@nuts.davemloft.net +1 -1 # [ATM]: Use __iomem where appropriate. # # drivers/atm/lanai.c # 2004/09/21 14:28:23-07:00 davem@nuts.davemloft.net +1 -1 # [ATM]: Use __iomem where appropriate. # # drivers/atm/idt77252.h # 2004/09/21 14:28:23-07:00 davem@nuts.davemloft.net +2 -2 # [ATM]: Use __iomem where appropriate. # # drivers/atm/he.h # 2004/09/21 14:28:23-07:00 davem@nuts.davemloft.net +1 -1 # [ATM]: Use __iomem where appropriate. # # drivers/atm/firestream.h # 2004/09/21 14:28:23-07:00 davem@nuts.davemloft.net +1 -1 # [ATM]: Use __iomem where appropriate. # # ChangeSet # 2004/09/21 14:25:10-07:00 chas@cmd.nrl.navy.mil # [ATM]: [drivers] fix warnings related to readl/writel changes # # Signed-off-by: David S. Miller # # drivers/atm/nicstarmac.h # 2004/09/21 14:24:53-07:00 chas@cmd.nrl.navy.mil +1 -1 # [ATM]: [drivers] fix warnings related to readl/writel changes # # Signed-off-by: David S. Miller # # drivers/atm/nicstarmac.c # 2004/09/21 14:24:53-07:00 chas@cmd.nrl.navy.mil +1 -1 # [ATM]: [drivers] fix warnings related to readl/writel changes # # Signed-off-by: David S. Miller # # drivers/atm/nicstar.h # 2004/09/21 14:24:53-07:00 chas@cmd.nrl.navy.mil +1 -1 # [ATM]: [drivers] fix warnings related to readl/writel changes # # Signed-off-by: David S. Miller # # drivers/atm/nicstar.c # 2004/09/21 14:24:52-07:00 chas@cmd.nrl.navy.mil +3 -2 # [ATM]: [drivers] fix warnings related to readl/writel changes # # Signed-off-by: David S. Miller # # drivers/atm/lanai.c # 2004/09/21 14:24:52-07:00 chas@cmd.nrl.navy.mil +5 -5 # [ATM]: [drivers] fix warnings related to readl/writel changes # # Signed-off-by: David S. Miller # # drivers/atm/idt77252.h # 2004/09/21 14:24:52-07:00 chas@cmd.nrl.navy.mil +2 -2 # [ATM]: [drivers] fix warnings related to readl/writel changes # # Signed-off-by: David S. Miller # # drivers/atm/idt77252.c # 2004/09/21 14:24:52-07:00 chas@cmd.nrl.navy.mil +3 -4 # [ATM]: [drivers] fix warnings related to readl/writel changes # # Signed-off-by: David S. Miller # # drivers/atm/he.h # 2004/09/21 14:24:52-07:00 chas@cmd.nrl.navy.mil +1 -1 # [ATM]: [drivers] fix warnings related to readl/writel changes # # Signed-off-by: David S. Miller # # drivers/atm/he.c # 2004/09/21 14:24:52-07:00 chas@cmd.nrl.navy.mil +4 -3 # [ATM]: [drivers] fix warnings related to readl/writel changes # # Signed-off-by: David S. Miller # # drivers/atm/firestream.h # 2004/09/21 14:24:52-07:00 chas@cmd.nrl.navy.mil +1 -1 # [ATM]: [drivers] fix warnings related to readl/writel changes # # Signed-off-by: David S. Miller # # drivers/atm/firestream.c # 2004/09/21 14:24:52-07:00 chas@cmd.nrl.navy.mil +1 -1 # [ATM]: [drivers] fix warnings related to readl/writel changes # # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/21 22:09:57+01:00 aia21@cantab.net # NTFS: - Fix endianness bug in ntfs_external_attr_find(). # - Change ntfs_{external_,}attr_find() to return 0 on success, -ENOENT # if the attribute is not found, and -EIO on real error. In the case # of -ENOENT, the search context is updated to describe the attribute # before which the attribute being searched for would need to be # inserted if such an action were to be desired and in the case of # ntfs_external_attr_find() the search context is also updated to # indicate the attribute list entry before which the attribute list # entry of the attribute being searched for would need to be inserted # if such an action were to be desired. Also make ntfs_find_attr() # static and remove its prototype from attrib.h as it is not used # anywhere other than attrib.c. Update ntfs_attr_lookup() and all # callers of ntfs_{external,}attr_{find,lookup}() for the new return # values. # - Force use of ntfs_attr_find() in ntfs_attr_lookup() when searching # for the attribute list attribute itself. # # Signed-off-by: Anton Altaparmakov # # fs/ntfs/namei.c # 2004/09/21 21:59:21+01:00 aia21@cantab.net +15 -9 # Update for new ntfs_attr_lookup() return values. # # fs/ntfs/super.c # 2004/09/21 21:57:49+01:00 aia21@cantab.net +4 -5 # Update for new ntfs_attr_lookup() return values. # # fs/ntfs/index.c # 2004/09/21 21:57:39+01:00 aia21@cantab.net +11 -9 # Update for new ntfs_attr_lookup() return values. # # fs/ntfs/inode.c # 2004/09/21 21:56:11+01:00 aia21@cantab.net +97 -43 # Update for new ntfs_attr_lookup() return values. # # fs/ntfs/dir.c # 2004/09/21 21:55:46+01:00 aia21@cantab.net +21 -12 # Update for new ntfs_attr_lookup() return values. # # fs/ntfs/attrib.h # 2004/09/21 21:54:57+01:00 aia21@cantab.net +1 -5 # Update for new ntfs_attr_lookup() prototype. # Remove ntfs_attr_find() prototype as it is now static. # # fs/ntfs/attrib.c # 2004/09/21 21:53:15+01:00 aia21@cantab.net +163 -90 # - Change ntfs_{external_,}attr_find() to return 0 on success, -ENOENT # if the attribute is not found, and -EIO on real error. In the case # of -ENOENT, the search context is updated to describe the attribute # before which the attribute being searched for would need to be # inserted if such an action were to be desired and in the case of # ntfs_external_attr_find() the search context is also updated to # indicate the attribute list entry before which the attribute list # entry of the attribute being searched for would need to be inserted # if such an action were to be desired. Also make ntfs_find_attr() # static and remove its prototype from attrib.h as it is not used # anywhere other than attrib.c. Update ntfs_attr_lookup() and all # callers of ntfs_{external,}attr_{find,lookup}() for the new return # values. # # fs/ntfs/aops.c # 2004/09/21 21:52:34+01:00 aia21@cantab.net +9 -12 # Update for new ntfs_attr_lookup() return values. # # fs/ntfs/ChangeLog # 2004/09/21 21:52:27+01:00 aia21@cantab.net +16 -0 # Update # # ChangeSet # 2004/09/21 13:44:36-07:00 davem@nuts.davemloft.net # [SPARC64]: Update compat code for sys_waitid changes. # # Signed-off-by: David S. Miller # # arch/sparc64/kernel/sys_sparc32.c # 2004/09/21 13:44:19-07:00 davem@nuts.davemloft.net +12 -3 # [SPARC64]: Update compat code for sys_waitid changes. # # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/21 13:35:49-07:00 davem@nuts.davemloft.net # [IPV4]: Zap CONFIG_IP_ROUTE_TOS # # These facilities are now available by default. # The config option makes no sense because: # 1) It makes no change to the layout of any # data structure, therefore it has no impact # upon memory usage of the routing tables. # 2) It makes no significant change to code size, # only a handfull of lookup comparisons are # protected by the option. # 3) It is needed for full RFC1812 compliance anyways. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # net/ipv4/fib_rules.c # 2004/09/21 13:35:25-07:00 davem@nuts.davemloft.net +0 -2 # [IPV4]: Zap CONFIG_IP_ROUTE_TOS # # These facilities are now available by default. # The config option makes no sense because: # 1) It makes no change to the layout of any # data structure, therefore it has no impact # upon memory usage of the routing tables. # 2) It makes no significant change to code size, # only a handfull of lookup comparisons are # protected by the option. # 3) It is needed for full RFC1812 compliance anyways. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # net/ipv4/fib_hash.c # 2004/09/21 13:35:25-07:00 davem@nuts.davemloft.net +0 -10 # [IPV4]: Zap CONFIG_IP_ROUTE_TOS # # These facilities are now available by default. # The config option makes no sense because: # 1) It makes no change to the layout of any # data structure, therefore it has no impact # upon memory usage of the routing tables. # 2) It makes no significant change to code size, # only a handfull of lookup comparisons are # protected by the option. # 3) It is needed for full RFC1812 compliance anyways. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # net/ipv4/Kconfig # 2004/09/21 13:35:25-07:00 davem@nuts.davemloft.net +0 -10 # [IPV4]: Zap CONFIG_IP_ROUTE_TOS # # These facilities are now available by default. # The config option makes no sense because: # 1) It makes no change to the layout of any # data structure, therefore it has no impact # upon memory usage of the routing tables. # 2) It makes no significant change to code size, # only a handfull of lookup comparisons are # protected by the option. # 3) It is needed for full RFC1812 compliance anyways. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # arch/mips/configs/tb0229_defconfig # 2004/09/21 13:35:25-07:00 davem@nuts.davemloft.net +0 -1 # [IPV4]: Zap CONFIG_IP_ROUTE_TOS # # These facilities are now available by default. # The config option makes no sense because: # 1) It makes no change to the layout of any # data structure, therefore it has no impact # upon memory usage of the routing tables. # 2) It makes no significant change to code size, # only a handfull of lookup comparisons are # protected by the option. # 3) It is needed for full RFC1812 compliance anyways. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # arch/mips/configs/tb0226_defconfig # 2004/09/21 13:35:25-07:00 davem@nuts.davemloft.net +0 -1 # [IPV4]: Zap CONFIG_IP_ROUTE_TOS # # These facilities are now available by default. # The config option makes no sense because: # 1) It makes no change to the layout of any # data structure, therefore it has no impact # upon memory usage of the routing tables. # 2) It makes no significant change to code size, # only a handfull of lookup comparisons are # protected by the option. # 3) It is needed for full RFC1812 compliance anyways. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # arch/arm/configs/ixp4xx_defconfig # 2004/09/21 13:35:25-07:00 davem@nuts.davemloft.net +0 -1 # [IPV4]: Zap CONFIG_IP_ROUTE_TOS # # These facilities are now available by default. # The config option makes no sense because: # 1) It makes no change to the layout of any # data structure, therefore it has no impact # upon memory usage of the routing tables. # 2) It makes no significant change to code size, # only a handfull of lookup comparisons are # protected by the option. # 3) It is needed for full RFC1812 compliance anyways. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # arch/arm/configs/ebsa110_defconfig # 2004/09/21 13:35:25-07:00 davem@nuts.davemloft.net +0 -1 # [IPV4]: Zap CONFIG_IP_ROUTE_TOS # # These facilities are now available by default. # The config option makes no sense because: # 1) It makes no change to the layout of any # data structure, therefore it has no impact # upon memory usage of the routing tables. # 2) It makes no significant change to code size, # only a handfull of lookup comparisons are # protected by the option. # 3) It is needed for full RFC1812 compliance anyways. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/21 13:29:32-07:00 davem@nuts.davemloft.net # [IPV4]: Clean up fib_hash.c list handling. # # 1) Use linux/list.h facilities instead of by-hand # list implementation. # # 2) Use fib_alias structure, hung off of fib_node, # to represent routes which all have the same # destination prefix, yet have different TOS and # priority values. # # Signed-off-by: David S. Miller # # net/ipv4/fib_hash.c # 2004/09/21 13:29:03-07:00 davem@nuts.davemloft.net +435 -358 # [IPV4]: Clean up fib_hash.c list handling. # # 1) Use linux/list.h facilities instead of by-hand # list implementation. # # 2) Use fib_alias structure, hung off of fib_node, # to represent routes which all have the same # destination prefix, yet have different TOS and # priority values. # # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/21 19:47:47+00:00 jbarnes@sgi.com # [IA64] sn2_defconfig update take 2 # # Please apply this one instead. It turns on mmtimer and increases the number # of sg entries for the LSI driver. # # Signed-off-by: Jesse Barnes # Signed-off-by: Tony Luck # # arch/ia64/configs/sn2_defconfig # 2004/09/21 19:45:15+00:00 aegl@agluck-lia64.sc.intel.com +10 -7 # cleanup: turn on mmtimer, increase the number of sg entries for LSI driver # # ChangeSet # 2004/09/21 19:41:02+00:00 gordon.jin@intel.com # [IA64] ia32compat: Disable syscalls sys32_iopl() and sys32_ioperm() on ia64. # # Disable syscalls sys32_iopl() and sys32_ioperm() on ia64. # To emulate these 2 syscalls correctly, we need to guarantee uncached # memory attributes on ia64, which is difficult. The only user of this # interface that we know of is X. So we think it's better to disable it. # # Signed-off-by: Gordon Jin # Signed-off-by: Arun Sharma # Signed-off-by: Tony Luck # # arch/ia64/ia32/sys_ia32.c # 2004/09/21 19:39:33+00:00 aegl@agluck-lia64.sc.intel.com +0 -67 # Disable syscalls sys32_iopl() and sys32_ioperm() on ia64. # # arch/ia64/ia32/ia32_entry.S # 2004/09/21 19:39:32+00:00 aegl@agluck-lia64.sc.intel.com +2 -2 # Disable syscalls sys32_iopl() and sys32_ioperm() on ia64. # # ChangeSet # 2004/09/21 19:38:16+00:00 kevin.tian@intel.com # [IA64] ia32compat: Put signal restorer code on a gate page # # When userland doesn't specify sigaction->sa_restorer, we try to put # the restorer code on the stack. But this breaks ia32 binaries with # non-executable stacks. We now put the restorer code on a gate page. # # Signed-off-by: Kevin Tian # Signed-off-by: Arun Sharma # Signed-off-by: Tony Luck # # include/asm-ia64/ia32.h # 2004/09/21 19:36:02+00:00 aegl@agluck-lia64.sc.intel.com +1 -1 # Put signal restorer code on a gate page # # arch/ia64/mm/init.c # 2004/09/21 19:36:02+00:00 aegl@agluck-lia64.sc.intel.com +1 -1 # Put signal restorer code on a gate page # # arch/ia64/ia32/ia32priv.h # 2004/09/21 19:36:02+00:00 aegl@agluck-lia64.sc.intel.com +8 -3 # Put signal restorer code on a gate page # # arch/ia64/ia32/ia32_support.c # 2004/09/21 19:36:02+00:00 aegl@agluck-lia64.sc.intel.com +25 -3 # Put signal restorer code on a gate page # # arch/ia64/ia32/ia32_signal.c # 2004/09/21 19:36:02+00:00 aegl@agluck-lia64.sc.intel.com +22 -11 # Put signal restorer code on a gate page # # arch/ia64/ia32/binfmt_elf32.c # 2004/09/21 19:36:02+00:00 aegl@agluck-lia64.sc.intel.com +39 -0 # Put signal restorer code on a gate page # # ChangeSet # 2004/09/21 07:43:51-07:00 roland@redhat.com # [PATCH] x86-64: waitid fallout # # This patch updates the x86-64's compat code to handle the new argument # to waitid. # # Sorry for the oversight. # # include/linux/syscalls.h # 2004/09/20 12:55:29-07:00 roland@redhat.com +2 -1 # x86-64: waitid fallout # # arch/x86_64/ia32/sys_ia32.c # 2004/09/20 13:01:06-07:00 roland@redhat.com +9 -2 # x86-64: waitid fallout # # ChangeSet # 2004/09/21 07:40:31-07:00 rusty@au1.ibm.com # [PATCH] Warn that ipchains and ipfwadm are going away # # At the recent netfilter workshop in Erlangen, we was decided to remove # the backwards compatibility code for ipchains and ipfwadm. This will # allow significant cleanup of interfaces, since we had to have a # mid-level interface for the backwards compatibility layer to use. # # Start off with a warning for 2.6.9, so any remaining users have a chance # to migrate. Their firewall scripts might not check return values, and # they might get a nasty surprise when this goes away. # # net/ipv4/netfilter/ipfwadm_core.c # 2004/09/20 16:06:18-07:00 rusty@au1.ibm.com +2 -0 # Warn that ipchains and ipfwadm are going away # # net/ipv4/netfilter/ipchains_core.c # 2004/09/20 16:06:07-07:00 rusty@au1.ibm.com +2 -0 # Warn that ipchains and ipfwadm are going away # # ChangeSet # 2004/09/21 07:40:19-07:00 rusty@au1.ibm.com # [PATCH] Another ip_conntrack seq fix: ip_conntrack_expect # # /proc/net/ip_conntrack_expect was changed over to seq_file, but a \n # is missing. # # net/ipv4/netfilter/ip_conntrack_standalone.c # 2004/09/19 13:03:50-07:00 rusty@au1.ibm.com +3 -2 # Another ip_conntrack seq fix: ip_conntrack_expect # # ChangeSet # 2004/09/21 07:11:36-07:00 benh@kernel.crashing.org # [PATCH] ppc64: Fix __raw_* IO accessors # # Linus removed the "volatile" statement from the definition of the # __raw_* IO accessors on ppc64, which cause some real bad optisations to # happen in some fbdev's like matroxfb to happen (just imagine that # matroxfb loops reading an IO register waiting for a bit to change). # # The __raw_xxxx() functions still want ordered accesses (they avoid the # byteswap, though) # # Signed-off-by: Benjamin Herrenschmidt # # include/asm-ppc64/io.h # 2004/09/21 02:14:10-07:00 benh@kernel.crashing.org +8 -8 # ppc64: Fix __raw_* IO accessors # # ChangeSet # 2004/09/21 12:57:50+01:00 aia21@cantab.net # NTFS: Rename {{re,}init,get,put}_attr_search_ctx() to # ntfs_attr_{{re,}init,get,put}_search_ctx() as well as the type # attr_search_context to ntfs_attr_search_ctx. # # Signed-off-by: Anton Altaparmakov # # fs/ntfs/super.c # 2004/09/21 12:57:42+01:00 aia21@cantab.net +9 -9 # Rename {{re,}init,get,put}_attr_search_ctx() to # ntfs_attr_{{re,}init,get,put}_search_ctx() as well as the type # attr_search_context to ntfs_attr_search_ctx. # # fs/ntfs/namei.c # 2004/09/21 12:57:41+01:00 aia21@cantab.net +8 -8 # Rename {{re,}init,get,put}_attr_search_ctx() to # ntfs_attr_{{re,}init,get,put}_search_ctx() as well as the type # attr_search_context to ntfs_attr_search_ctx. # # fs/ntfs/inode.c # 2004/09/21 12:57:41+01:00 aia21@cantab.net +32 -32 # Rename {{re,}init,get,put}_attr_search_ctx() to # ntfs_attr_{{re,}init,get,put}_search_ctx() as well as the type # attr_search_context to ntfs_attr_search_ctx. # # fs/ntfs/index.h # 2004/09/21 12:57:41+01:00 aia21@cantab.net +1 -1 # Rename {{re,}init,get,put}_attr_search_ctx() to # ntfs_attr_{{re,}init,get,put}_search_ctx() as well as the type # attr_search_context to ntfs_attr_search_ctx. # # fs/ntfs/index.c # 2004/09/21 12:57:41+01:00 aia21@cantab.net +5 -5 # Rename {{re,}init,get,put}_attr_search_ctx() to # ntfs_attr_{{re,}init,get,put}_search_ctx() as well as the type # attr_search_context to ntfs_attr_search_ctx. # # fs/ntfs/dir.c # 2004/09/21 12:57:41+01:00 aia21@cantab.net +15 -15 # Rename {{re,}init,get,put}_attr_search_ctx() to # ntfs_attr_{{re,}init,get,put}_search_ctx() as well as the type # attr_search_context to ntfs_attr_search_ctx. # # fs/ntfs/attrib.h # 2004/09/21 12:57:41+01:00 aia21@cantab.net +7 -7 # Rename {{re,}init,get,put}_attr_search_ctx() to # ntfs_attr_{{re,}init,get,put}_search_ctx() as well as the type # attr_search_context to ntfs_attr_search_ctx. # # fs/ntfs/attrib.c # 2004/09/21 12:57:41+01:00 aia21@cantab.net +25 -26 # Rename {{re,}init,get,put}_attr_search_ctx() to # ntfs_attr_{{re,}init,get,put}_search_ctx() as well as the type # attr_search_context to ntfs_attr_search_ctx. # # fs/ntfs/aops.c # 2004/09/21 12:57:40+01:00 aia21@cantab.net +14 -14 # Rename {{re,}init,get,put}_attr_search_ctx() to # ntfs_attr_{{re,}init,get,put}_search_ctx() as well as the type # attr_search_context to ntfs_attr_search_ctx. # # fs/ntfs/ChangeLog # 2004/09/21 12:57:40+01:00 aia21@cantab.net +3 -0 # Update # # ChangeSet # 2004/09/21 12:30:02+01:00 aia21@cantab.net # NTFS: Rename {find,lookup}_attr() to ntfs_attr_{find,lookup}() as well as # find_external_attr() to ntfs_external_attr_find() to cleanup the # namespace a bit and to be more consistent with libntfs. # # Signed-off-by: Anton Altaparmakov # # fs/ntfs/super.c # 2004/09/21 12:29:53+01:00 aia21@cantab.net +4 -3 # Rename {find,lookup}_attr() to ntfs_attr_{find,lookup}() as well as # find_external_attr() to ntfs_external_attr_find() to cleanup the # namespace a bit and to be more consistent with libntfs. # # fs/ntfs/namei.c # 2004/09/21 12:29:53+01:00 aia21@cantab.net +4 -4 # Rename {find,lookup}_attr() to ntfs_attr_{find,lookup}() as well as # find_external_attr() to ntfs_external_attr_find() to cleanup the # namespace a bit and to be more consistent with libntfs. # # fs/ntfs/inode.c # 2004/09/21 12:29:53+01:00 aia21@cantab.net +21 -21 # Rename {find,lookup}_attr() to ntfs_attr_{find,lookup}() as well as # find_external_attr() to ntfs_external_attr_find() to cleanup the # namespace a bit and to be more consistent with libntfs. # # fs/ntfs/index.c # 2004/09/21 12:29:53+01:00 aia21@cantab.net +1 -1 # Rename {find,lookup}_attr() to ntfs_attr_{find,lookup}() as well as # find_external_attr() to ntfs_external_attr_find() to cleanup the # namespace a bit and to be more consistent with libntfs. # # fs/ntfs/dir.c # 2004/09/21 12:29:53+01:00 aia21@cantab.net +6 -6 # Rename {find,lookup}_attr() to ntfs_attr_{find,lookup}() as well as # find_external_attr() to ntfs_external_attr_find() to cleanup the # namespace a bit and to be more consistent with libntfs. # # fs/ntfs/attrib.h # 2004/09/21 12:29:52+01:00 aia21@cantab.net +3 -3 # Rename {find,lookup}_attr() to ntfs_attr_{find,lookup}() as well as # find_external_attr() to ntfs_external_attr_find() to cleanup the # namespace a bit and to be more consistent with libntfs. # # fs/ntfs/attrib.c # 2004/09/21 12:29:52+01:00 aia21@cantab.net +63 -58 # Rename {find,lookup}_attr() to ntfs_attr_{find,lookup}() as well as # find_external_attr() to ntfs_external_attr_find() to cleanup the # namespace a bit and to be more consistent with libntfs. # # fs/ntfs/aops.c # 2004/09/21 12:29:52+01:00 aia21@cantab.net +4 -4 # Rename {find,lookup}_attr() to ntfs_attr_{find,lookup}() as well as # find_external_attr() to ntfs_external_attr_find() to cleanup the # namespace a bit and to be more consistent with libntfs. # # fs/ntfs/ChangeLog # 2004/09/21 12:29:52+01:00 aia21@cantab.net +7 -0 # Update # # ChangeSet # 2004/09/21 02:02:23-07:00 rth@kanga.twiddle.home # [ALPHA] Add __user as necessary to fix sparse warnings. # # arch/alpha/mm/fault.c # 2004/09/21 02:02:03-07:00 rth@kanga.twiddle.home +1 -1 # Add __user as necessary to fix sparse warnings. # # arch/alpha/kernel/traps.c # 2004/09/21 02:02:03-07:00 rth@kanga.twiddle.home +1 -1 # Add __user as necessary to fix sparse warnings. # # arch/alpha/kernel/srmcons.c # 2004/09/21 02:02:03-07:00 rth@kanga.twiddle.home +1 -1 # Add __user as necessary to fix sparse warnings. # # arch/alpha/kernel/osf_sys.c # 2004/09/21 02:02:03-07:00 rth@kanga.twiddle.home +36 -35 # Add __user as necessary to fix sparse warnings. # # ChangeSet # 2004/09/21 01:42:23-07:00 rth@kanga.twiddle.home # [ALPHA] Fix signed one bit fields. # # include/asm-alpha/system.h # 2004/09/21 01:42:02-07:00 rth@kanga.twiddle.home +3 -3 # Fix signed one bit fields. # # ChangeSet # 2004/09/21 00:55:21-07:00 rth@kanga.twiddle.home # [ALPHA] Add compile-time assert concerning rt_sigframe layout. # # arch/alpha/kernel/signal.c # 2004/09/21 00:55:01-07:00 rth@kanga.twiddle.home +6 -0 # Add compile-time assert concerning rt_sigframe layout. # # ChangeSet # 2004/09/21 00:53:57-07:00 rth@kanga.twiddle.home # Correct prototypes for sys_wait4 and sys_waitpid. # # kernel/exit.c # 2004/09/21 00:53:37-07:00 rth@kanga.twiddle.home +3 -3 # Correct prototypes for sys_wait4 and sys_waitpid. # # include/linux/syscalls.h # 2004/09/21 00:53:37-07:00 rth@kanga.twiddle.home +2 -2 # Correct prototypes for sys_wait4 and sys_waitpid. # # ChangeSet # 2004/09/21 00:53:02-07:00 rth@kanga.twiddle.home # [ALPHA] Fix some compiler warnings from gcc 4. # # include/asm-alpha/unistd.h # 2004/09/21 00:52:41-07:00 rth@kanga.twiddle.home +1 -1 # Fix execve prototype. # # include/asm-alpha/tlbflush.h # 2004/09/21 00:52:41-07:00 rth@kanga.twiddle.home +1 -1 # Fix some signed/unsigned mismatches. # # arch/alpha/kernel/srmcons.c # 2004/09/21 00:52:41-07:00 rth@kanga.twiddle.home +6 -6 # Fix some signed/unsigned mismatches. # # arch/alpha/kernel/ptrace.c # 2004/09/21 00:52:41-07:00 rth@kanga.twiddle.home +10 -9 # Fix some signed/unsigned mismatches. # # arch/alpha/kernel/osf_sys.c # 2004/09/21 00:52:41-07:00 rth@kanga.twiddle.home +4 -4 # Use offsetof for NAME_OFFSET. # Fix some signed/unsigned mismatches. # # ChangeSet # 2004/09/20 13:46:20-07:00 davem@nuts.davemloft.net # [SPARC64]: Fix memset() in sunsu.c and sunzilog.c # # sizeof(ptr) --> sizeof(*ptr) # # Signed-off-by: David S. Miller # # drivers/serial/sunzilog.c # 2004/09/20 13:46:03-07:00 davem@nuts.davemloft.net +1 -2 # [SPARC64]: Fix memset() in sunsu.c and sunzilog.c # # sizeof(ptr) --> sizeof(*ptr) # # Signed-off-by: David S. Miller # # drivers/serial/sunsu.c # 2004/09/20 13:46:03-07:00 davem@nuts.davemloft.net +1 -1 # [SPARC64]: Fix memset() in sunsu.c and sunzilog.c # # sizeof(ptr) --> sizeof(*ptr) # # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/20 13:45:14-07:00 davem@nuts.davemloft.net # [SPARC64]: Improve kernel stack backtraces. # # In particular, handle init_task backtraces. # # Signed-off-by: David S. Miller # # arch/sparc64/kernel/traps.c # 2004/09/20 13:44:57-07:00 davem@nuts.davemloft.net +36 -8 # [SPARC64]: Improve kernel stack backtraces. # # In particular, handle init_task backtraces. # # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/20 21:11:41+01:00 rmk@flint.arm.linux.org.uk # [MMC] Ensure semaphores are initialised before use. Gah. # # drivers/mmc/mmc_queue.c # 2004/09/20 21:08:47+01:00 rmk@flint.arm.linux.org.uk +1 -0 # Ensure semaphores are initialised. # # ChangeSet # 2004/09/20 20:44:59+01:00 rmk@flint.arm.linux.org.uk # [MMC] PXAMCI: enable use of platform specific data. # # This allows platforms to hook in their card detection, power control # and power availability information. # # include/asm-arm/arch-pxa/mmc.h # 2004/09/20 20:42:31+01:00 rmk@flint.arm.linux.org.uk +19 -0 # # include/asm-arm/arch-pxa/mmc.h # 2004/09/20 20:42:31+01:00 rmk@flint.arm.linux.org.uk +0 -0 # BitKeeper file /usr/src/bk/linux-2.6-mmc/include/asm-arm/arch-pxa/mmc.h # # drivers/mmc/pxamci.c # 2004/09/20 20:42:30+01:00 rmk@flint.arm.linux.org.uk +23 -4 # Use platform specific data for initialisation/exit/power setting, etc. # # arch/arm/mach-pxa/generic.c # 2004/09/20 20:42:30+01:00 rmk@flint.arm.linux.org.uk +7 -0 # Add pxa_set_mci_info() to set PXA MMC interface platform specific # data. # # ChangeSet # 2004/09/20 11:47:58-07:00 torvalds@ppc970.osdl.org # ppc32: merge network card Kconfig duplication # # drivers/net/Kconfig # 2004/09/20 11:47:53-07:00 torvalds@ppc970.osdl.org +0 -2 # ppc32: merge network card Kconfig duplication # # ChangeSet # 2004/09/20 14:14:46-04:00 achirica@telefonica.net # [PATCH] Compatibility fixes for different card versions # # drivers/net/wireless/airo.c # 2004/09/15 14:46:09-04:00 achirica@telefonica.net +80 -59 # Compatibility fixes for different card versions # # ChangeSet # 2004/09/20 14:05:51-04:00 romieu@fr.zoreil.com # [PATCH] r8169: default on disabling PCIDAC # # Default to disabling PCI DAC as this option appears unsafe on amd64 # (original suggestion by Hans-Frieder Vogt ). # # The driver will typically report PCI System error when something goes # wrong. The relevant interrupt is not masked any more and the driver # can thus be disabled. # # Signed-off-by: Francois Romieu # # drivers/net/r8169.c # 2004/09/19 18:16:02-04:00 romieu@fr.zoreil.com +14 -2 # r8169: default on disabling PCIDAC # # ChangeSet # 2004/09/20 18:22:26+01:00 rmk@flint.arm.linux.org.uk # [ARM] Prevent state machine leakage in ARM APM emulation. # # Don't allow threads which are acking a suspend request to leave # the APM ioctl call. This prevents the state machine breaking. # # arch/arm/kernel/apm.c # 2004/09/20 18:19:32+01:00 rmk@flint.arm.linux.org.uk +10 -2 # Don't allow threads which are acking a suspend request to leave # the APM ioctl call. This prevents the state machine breaking. # # ChangeSet # 2004/09/20 21:39:18+10:00 airlied@starflyer.(none) # drm: drop __HAVE_COUNTER macros # # This removes all the __HAVE_COUNTER macro and replaces them with # the driver setting the values in its register_fns. # # Signed-off-by: Dave Airlie # # drivers/char/drm/sis.h # 2004/09/20 21:39:11+10:00 airlied@starflyer.(none) +0 -2 # drm: drop __HAVE_COUNTER macros # # This removes all the __HAVE_COUNTER macro and replaces them with # the driver setting the values in its register_fns. # # Signed-off-by: Dave Airlie # # drivers/char/drm/mga_dma.c # 2004/09/20 21:39:11+10:00 airlied@starflyer.(none) +5 -0 # drm: drop __HAVE_COUNTER macros # # This removes all the __HAVE_COUNTER macro and replaces them with # the driver setting the values in its register_fns. # # Signed-off-by: Dave Airlie # # drivers/char/drm/mga.h # 2004/09/20 21:39:11+10:00 airlied@starflyer.(none) +0 -5 # drm: drop __HAVE_COUNTER macros # # This removes all the __HAVE_COUNTER macro and replaces them with # the driver setting the values in its register_fns. # # Signed-off-by: Dave Airlie # # drivers/char/drm/i915_dma.c # 2004/09/20 21:39:11+10:00 airlied@starflyer.(none) +6 -0 # drm: drop __HAVE_COUNTER macros # # This removes all the __HAVE_COUNTER macro and replaces them with # the driver setting the values in its register_fns. # # Signed-off-by: Dave Airlie # # drivers/char/drm/i915.h # 2004/09/20 21:39:11+10:00 airlied@starflyer.(none) +0 -6 # drm: drop __HAVE_COUNTER macros # # This removes all the __HAVE_COUNTER macro and replaces them with # the driver setting the values in its register_fns. # # Signed-off-by: Dave Airlie # # drivers/char/drm/i830_dma.c # 2004/09/20 21:39:11+10:00 airlied@starflyer.(none) +5 -0 # drm: drop __HAVE_COUNTER macros # # This removes all the __HAVE_COUNTER macro and replaces them with # the driver setting the values in its register_fns. # # Signed-off-by: Dave Airlie # # drivers/char/drm/i830.h # 2004/09/20 21:39:11+10:00 airlied@starflyer.(none) +0 -6 # drm: drop __HAVE_COUNTER macros # # This removes all the __HAVE_COUNTER macro and replaces them with # the driver setting the values in its register_fns. # # Signed-off-by: Dave Airlie # # drivers/char/drm/i810_dma.c # 2004/09/20 21:39:11+10:00 airlied@starflyer.(none) +6 -0 # drm: drop __HAVE_COUNTER macros # # This removes all the __HAVE_COUNTER macro and replaces them with # the driver setting the values in its register_fns. # # Signed-off-by: Dave Airlie # # drivers/char/drm/i810.h # 2004/09/20 21:39:11+10:00 airlied@starflyer.(none) +0 -6 # drm: drop __HAVE_COUNTER macros # # This removes all the __HAVE_COUNTER macro and replaces them with # the driver setting the values in its register_fns. # # Signed-off-by: Dave Airlie # # drivers/char/drm/drm_drv.h # 2004/09/20 21:39:11+10:00 airlied@starflyer.(none) +10 -40 # drm: drop __HAVE_COUNTER macros # # This removes all the __HAVE_COUNTER macro and replaces them with # the driver setting the values in its register_fns. # # Signed-off-by: Dave Airlie # # ChangeSet # 2004/09/20 20:07:23+10:00 airlied@starflyer.(none) # drm: complete fix for drm_scatter.h # # Another issue from the macro conversion. # # Signed-off-by: Dave Airlie # # drivers/char/drm/drm_scatter.h # 2004/09/20 20:02:52+10:00 airlied@starflyer.(none) +1 -1 # drm: complete fix for drm_scatter.h # # Another issue from the macro conversion. # # Signed-off-by: Dave Airlie # # ChangeSet # 2004/09/20 10:21:45+01:00 rmk@flint.arm.linux.org.uk # [MMC] Ensure PXA MMC interrupts are disabled on chip. # # drivers/mmc/pxamci.c # 2004/09/20 10:18:10+01:00 rmk@flint.arm.linux.org.uk +1 -0 # Ensure PXA MMC interrupts are disabled on chip. # # ChangeSet # 2004/09/20 10:07:54+01:00 rmk@flint.arm.linux.org.uk # [MMC] Fix mmc_block suspend/resume handling (again). # # The previous change is not the whole story - the mmc queue # thread may be handling a request. We must wait for outstanding # requests to complete before allowing the suspend to proceed, # otherwise we may suffer loss of data. # # drivers/mmc/mmc_queue.c # 2004/09/20 10:01:42+01:00 rmk@flint.arm.linux.org.uk +55 -10 # Add suspend and resume handling from mmc_block. # Wait for mmcqd to sleep before allowing suspend to complete. # # drivers/mmc/mmc_queue.h # 2004/09/20 09:55:15+01:00 rmk@flint.arm.linux.org.uk +4 -1 # Add mmc_queue_suspend() and mmc_queue_resume() prototypes. # # drivers/mmc/mmc_block.c # 2004/09/20 09:54:15+01:00 rmk@flint.arm.linux.org.uk +2 -10 # Move suspend and resume handling into mmc_queue. # # ChangeSet # 2004/09/20 09:24:11+01:00 ntfs@flatcap.org # Merge flatcap.org:/home/flatcap/backup/bk/ntfs-2.6 # into flatcap.org:/home/flatcap/backup/bk/ntfs-2.6-devel # # fs/ntfs/super.c # 2004/09/20 09:24:06+01:00 ntfs@flatcap.org +0 -0 # Auto merged # # fs/ntfs/inode.c # 2004/09/20 09:24:06+01:00 ntfs@flatcap.org +0 -0 # Auto merged # # ChangeSet # 2004/09/19 18:56:22+01:00 rmk@flint.arm.linux.org.uk # [MMC] Fix suspend/resume buglet. # # Block wants the queue spinlock and interrupts disabled for # blk_stop_queue() and blk_start_queue(). # # drivers/mmc/mmc_block.c # 2004/09/19 18:53:20+01:00 rmk@flint.arm.linux.org.uk +8 -0 # block wants the spinlock and interrupts disabled for # blk_stop_queue() and blk_start_queue(). # # ChangeSet # 2004/09/18 12:17:07-07:00 torvalds@ppc970.osdl.org # usb: add host controller __iomem annotations # # drivers/usb/host/ohci.h # 2004/09/18 12:17:01-07:00 torvalds@ppc970.osdl.org +2 -2 # usb: add host controller __iomem annotations # # drivers/usb/host/ohci-hub.c # 2004/09/18 12:17:01-07:00 torvalds@ppc970.osdl.org +1 -1 # usb: add host controller __iomem annotations # # drivers/usb/host/ohci-hcd.c # 2004/09/18 12:17:01-07:00 torvalds@ppc970.osdl.org +1 -1 # usb: add host controller __iomem annotations # # drivers/usb/host/ohci-dbg.c # 2004/09/18 12:17:01-07:00 torvalds@ppc970.osdl.org +2 -2 # usb: add host controller __iomem annotations # # drivers/usb/host/ehci.h # 2004/09/18 12:17:01-07:00 torvalds@ppc970.osdl.org +2 -2 # usb: add host controller __iomem annotations # # drivers/usb/host/ehci-hcd.c # 2004/09/18 12:17:01-07:00 torvalds@ppc970.osdl.org +3 -3 # usb: add host controller __iomem annotations # # drivers/usb/core/hcd.h # 2004/09/18 12:17:01-07:00 torvalds@ppc970.osdl.org +1 -1 # usb: add host controller __iomem annotations # # drivers/usb/core/hcd-pci.c # 2004/09/18 12:17:01-07:00 torvalds@ppc970.osdl.org +2 -2 # usb: add host controller __iomem annotations # # ChangeSet # 2004/09/18 17:47:23+01:00 rmk@flint.arm.linux.org.uk # [MMC] Add v2.x and v3.x CID parsing. # # include/linux/mmc/card.h # 2004/09/18 17:44:28+01:00 rmk@flint.arm.linux.org.uk +4 -3 # Add OEM ID. # Make "year" an unsigned short. # Rename mmc_prot to mmca_vsn. # # drivers/mmc/mmc_sysfs.c # 2004/09/18 17:44:28+01:00 rmk@flint.arm.linux.org.uk +8 -5 # Manufacturer IDs are 3 bytes. # cid.year is now the real year value. # serial may be full 32-bits. # Add OEM id. # # drivers/mmc/mmc.c # 2004/09/18 17:44:28+01:00 rmk@flint.arm.linux.org.uk +86 -27 # Add macro to unstuff bits from CID/CSD. # Add v2.x and v3.x CID parsing. # # ChangeSet # 2004/09/18 09:35:55-07:00 nickpiggin@yahoo.com.au # [PATCH] fix missing unlock_page in mm/rmap.c # # A required unlock_page will be missed in a very rare (but possible) race # condition. Acked by Hugh, who says: # # It'll be hard to hit because of the additional page_mapped test above, # with truncate unmapping ptes from mms before it advances to removing # pages from cache; but nothing to prevent it happening. # # Signed-off-by: Nick Piggin # Signed-off-by: Hugh Dickins # Signed-off-by: Linus Torvalds # # mm/rmap.c # 2004/09/18 03:46:41-07:00 nickpiggin@yahoo.com.au +3 -2 # fix missing unlock_page in mm/rmap.c # # ChangeSet # 2004/09/18 16:32:07+01:00 rmk@flint.arm.linux.org.uk # [MMC] Clean up MMC card CID/CSD decoding, stage 1. # # Now that the raw CSD and CID information are available in mmc_card, # there's little point not passing the mmc_card structure into the # decode functions themselves. # # This will be necessary, since there's several different formats of # CID decode, and the format appears to depend on data in the CSD. # # If we are unable to decode the CID or CSD, we can mark the card bad # and refuse to bind it to any drivers. Users can then retrieve the # raw undecoded CID and CSD from sysfs for debugging purposes. # # include/linux/mmc/card.h # 2004/09/18 16:29:35+01:00 rmk@flint.arm.linux.org.uk +9 -3 # Add MMC_STATE_BAD. # Document MMC_STATE_xxx. # Add mmc_card_set_XXX() macros. # # drivers/mmc/mmc_sysfs.c # 2004/09/18 16:29:35+01:00 rmk@flint.arm.linux.org.uk +3 -2 # Don't allow "bad" cards to match with drivers. # # drivers/mmc/mmc.c # 2004/09/18 16:29:35+01:00 rmk@flint.arm.linux.org.uk +14 -9 # Use mmc_card_set_XXX macros. # Only pass mmc_card pointer into mmc_decode_XXX functions. # # ChangeSet # 2004/09/18 16:06:51+01:00 rmk@flint.arm.linux.org.uk # [MMC] Export raw MMC card CID and CSD registers via device model. # # drivers/mmc/mmc_sysfs.c # 2004/09/18 16:04:14+01:00 rmk@flint.arm.linux.org.uk +8 -2 # Export raw MMC card CID and CSD registers. # # ChangeSet # 2004/09/18 15:38:44+01:00 rmk@flint.arm.linux.org.uk # [MMC] Save MMC card raw CSD structure. # # include/linux/mmc/card.h # 2004/09/18 15:36:34+01:00 rmk@flint.arm.linux.org.uk +1 -0 # Add raw_csd. # # drivers/mmc/mmc.c # 2004/09/18 15:36:33+01:00 rmk@flint.arm.linux.org.uk +2 -0 # Save MMC raw CSD. # # ChangeSet # 2004/09/18 10:50:57+01:00 rmk@flint.arm.linux.org.uk # [MMC] Use raw CID rather than decoded CID # # Save the raw CID information, and use this to match cards # with their corresponding mmc_card structure. Different # protocol revisions have different CID formats. # # include/linux/mmc/card.h # 2004/09/18 10:47:27+01:00 rmk@flint.arm.linux.org.uk +1 -0 # Add raw_cid to save the cards raw CID information. # # drivers/mmc/mmc.c # 2004/09/18 10:46:47+01:00 rmk@flint.arm.linux.org.uk +9 -12 # Save the raw CID information, and use this to match # cards with their corresponding mmc_card structure. # # ChangeSet # 2004/09/17 23:20:35-07:00 herbert@gondor.apana.org.au # [IPV4]: Size fib_info_devhash[] correctly. # # There is a thinko in the allocation for the devindex hash. We're # only giving it 8 elements when it should be 1<<8 elements. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # net/ipv4/fib_semantics.c # 2004/09/17 23:20:17-07:00 herbert@gondor.apana.org.au +3 -2 # [IPV4]: Size fib_info_devhash[] correctly. # # There is a thinko in the allocation for the devindex hash. We're # only giving it 8 elements when it should be 1<<8 elements. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/17 23:17:16-07:00 davem@nuts.davemloft.net # [IPV4]: Fix BUG triggered in fib_sync_down() # # If you modload then unload a network device, # without creating any ipv4 routes, it is possible # for the laddr hash to be not allocated yet # in fib_semantics. # # Signed-off-by: David S. Miller # # net/ipv4/fib_semantics.c # 2004/09/17 23:16:44-07:00 davem@nuts.davemloft.net +1 -3 # [IPV4]: Fix BUG triggered in fib_sync_down() # # If you modload then unload a network device, # without creating any ipv4 routes, it is possible # for the laddr hash to be not allocated yet # in fib_semantics. # # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/17 15:17:53-07:00 davem@nuts.davemloft.net # [XFRM] make xfrm_lookup() fully af-independent. # # Simplified from 2 patches by Hideaki YOSHIFUJI # # # Signed-off-by: David S. Miller # # net/xfrm/xfrm_policy.c # 2004/09/17 15:16:56-07:00 davem@nuts.davemloft.net +6 -20 # [XFRM] make xfrm_lookup() fully af-independent. # # net/ipv4/route.c # 2004/09/17 15:16:56-07:00 davem@nuts.davemloft.net +13 -8 # [XFRM] make xfrm_lookup() fully af-independent. # # ChangeSet # 2004/09/17 14:27:00-07:00 torvalds@ppc970.osdl.org # fb: add __iomem annotations to cfbfillrect # # drivers/video/cfbfillrect.c # 2004/09/17 14:26:53-07:00 torvalds@ppc970.osdl.org +8 -8 # fb: add __iomem annotations to cfbfillrect # # ChangeSet # 2004/09/17 13:54:21-07:00 torvalds@ppc970.osdl.org # fb: add __iomem annotations to cfbcopyarea # # drivers/video/cfbcopyarea.c # 2004/09/17 13:54:15-07:00 torvalds@ppc970.osdl.org +7 -6 # fb: add __iomem annotations to cfbcopyarea # # ChangeSet # 2004/09/17 13:52:54-07:00 torvalds@ppc970.osdl.org # sym53c8xx_2: remove unnecessary IO pointer casts # # They just meant that the __iomem annotation couldn't shine # through. # # drivers/scsi/sym53c8xx_2/sym_glue.h # 2004/09/17 13:52:48-07:00 torvalds@ppc970.osdl.org +17 -17 # sym53c8xx_2: remove unnecessary IO pointer casts # # They just meant that the __iomem annotation couldn't shine # through. # # ChangeSet # 2004/09/17 13:36:24-07:00 torvalds@ppc970.osdl.org # Do __iomem annotations on VGA state handling # # include/video/vga.h # 2004/09/17 13:36:17-07:00 torvalds@ppc970.osdl.org +23 -23 # Do __iomem annotations on VGA state handling # # drivers/video/vgastate.c # 2004/09/17 13:36:17-07:00 torvalds@ppc970.osdl.org +6 -6 # Do __iomem annotations on VGA state handling # # ChangeSet # 2004/09/17 13:20:32-07:00 torvalds@ppc970.osdl.org # ppc64: Need to define HPAGE_SHIFT even when HUGETLB_PAGE not configured. # # Required for the recent removal of LARGE_PAGE_SHIFT. # # include/asm-ppc64/page.h # 2004/09/17 13:20:26-07:00 torvalds@ppc970.osdl.org +3 -2 # ppc64: Need to define HPAGE_SHIFT even when HUGETLB_PAGE not configured. # # Required for the recent removal of LARGE_PAGE_SHIFT. # # ChangeSet # 2004/09/17 13:00:30-07:00 trond.myklebust@fys.uio.no # [PATCH] __iomem fixups for atiixp soundcards # # Signed-off-by: Trond Myklebust # Signed-off-by: Linus Torvalds # # sound/pci/atiixp_modem.c # 2004/09/17 12:35:39-07:00 trond.myklebust@fys.uio.no +4 -4 # __iomem fixups for atiixp soundcards # # sound/pci/atiixp.c # 2004/09/17 12:36:56-07:00 trond.myklebust@fys.uio.no +4 -4 # __iomem fixups for atiixp soundcards # # ChangeSet # 2004/09/17 20:47:08+01:00 rmk@flint.arm.linux.org.uk # [ARM] i8042 is available on many footbridge hosts, not just ARCH_EBSA285 # # drivers/input/serio/Kconfig # 2004/09/17 20:44:36+01:00 rmk@flint.arm.linux.org.uk +1 -1 # i8042 is available on many footbridge hosts, not just ARCH_EBSA285 # # ChangeSet # 2004/09/17 12:31:05-07:00 torvalds@ppc970.osdl.org # remove i2o_core.c # # It is unused and obsolete. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # BitKeeper/deleted/.del-i2o_core.c~f0bce42e2ab89fa2 # 2004/09/17 12:30:26-07:00 torvalds@ppc970.osdl.org +0 -0 # Delete: drivers/message/i2o/i2o_core.c # # ChangeSet # 2004/09/17 12:17:54-07:00 wli@holomorphy.com # [PATCH] sparc32: vmalloc address fix # # Resolves the framebuffer errors on some older sparc32s (we triggered it on # a SparcStation 2). # # Signed-off-by: William Irwin # Signed-off-by: Tom 'spot' Callaway # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-sparc/vaddrs.h # 2004/09/17 00:08:17-07:00 wli@holomorphy.com +2 -2 # sparc32: vmalloc address fix # # ChangeSet # 2004/09/17 12:17:43-07:00 akpm@osdl.org # [PATCH] remove sh64 smplock.h # # It is unused and obsolete. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # BitKeeper/deleted/.del-smplock.h~91780a6b9e38c552 # 2004/09/17 12:17:36-07:00 akpm@osdl.org +0 -0 # Delete: include/asm-sh64/smplock.h # # ChangeSet # 2004/09/17 12:17:28-07:00 holt@sgi.com # [PATCH] Fix write() return values for reiserfs. # # This patch fixes the direct I/O return value for reiserfs writes to be # ssize_t instead of int. # # Signed-off-by: Robin Holt # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # fs/reiserfs/file.c # 2004/09/17 00:08:17-07:00 holt@sgi.com +2 -2 # Fix write() return values for reiserfs. # # ChangeSet # 2004/09/17 12:17:17-07:00 holt@sgi.com # [PATCH] Fix write() return values for tmpfs. # # This patch makes the return from the write() syscall actually an ssize_t # instead of an int. # # Signed-off-by: Robin Holt # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # mm/shmem.c # 2004/09/17 00:08:17-07:00 holt@sgi.com +1 -1 # Fix write() return values for tmpfs. # # ChangeSet # 2004/09/17 12:17:02-07:00 mingo@elte.hu # [PATCH] tune vmalloc size # # There are a few devices that use lots of ioremap space. vmalloc space is a # showstopper problem for them. # # this patch adds the vmalloc= boot parameter to override # __VMALLOC_RESERVE. The default is 128mb right now - e.g. vmalloc=256m # doubles the size. # # Signed-off-by: Ingo Molnar # Signed-off-by: Arjan van de Ven # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # mm/vmalloc.c # 2004/09/17 00:07:34-07:00 mingo@elte.hu +2 -0 # tune vmalloc size # # include/asm-i386/page.h # 2004/09/17 00:07:34-07:00 mingo@elte.hu +3 -3 # tune vmalloc size # # arch/i386/mm/init.c # 2004/09/17 00:07:34-07:00 mingo@elte.hu +2 -0 # tune vmalloc size # # arch/i386/kernel/setup.c # 2004/09/17 00:07:34-07:00 mingo@elte.hu +8 -0 # tune vmalloc size # # arch/i386/boot/setup.S # 2004/09/17 00:07:34-07:00 mingo@elte.hu +1 -1 # tune vmalloc size # # Documentation/kernel-parameters.txt # 2004/09/17 00:07:36-07:00 mingo@elte.hu +11 -0 # tune vmalloc size # # ChangeSet # 2004/09/17 12:16:50-07:00 akpm@osdl.org # [PATCH] bio_alloc() cleanup # # de-spaghettify this function. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # fs/bio.c # 2004/09/17 00:07:33-07:00 akpm@osdl.org +17 -21 # bio_alloc() cleanup # # ChangeSet # 2004/09/17 12:16:36-07:00 dsaxena@plexity.net # [PATCH] Add MTD map driver for Intel IXP2000 NPU # # The following patch adds the MTD map driver for Intel's IXP2000 NPU. The # driver is already in MTD CVS and I've gotten the OK from David to push it # upstream. # # Missing Kconfig bits from Lennert Buytenhek # # Signed-off-by: Deepak Saxena # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/mtd/maps/ixp2000.c # 2004/09/17 00:07:06-07:00 dsaxena@plexity.net +281 -0 # Add MTD map driver for Intel IXP2000 NPU # # drivers/mtd/maps/Makefile # 2004/09/17 00:07:07-07:00 dsaxena@plexity.net +1 -0 # Add MTD map driver for Intel IXP2000 NPU # # drivers/mtd/maps/Kconfig # 2004/09/17 00:07:11-07:00 dsaxena@plexity.net +9 -0 # Add MTD map driver for Intel IXP2000 NPU # # drivers/mtd/maps/ixp2000.c # 2004/09/17 00:07:06-07:00 dsaxena@plexity.net +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/drivers/mtd/maps/ixp2000.c # # ChangeSet # 2004/09/17 12:16:21-07:00 dsaxena@plexity.net # [PATCH] Update IXP4xx MTD driver from CVS MTD # # The following patch updates the IXP4xx MTD driver with a compile fix from # the CVS repository. David has given me the OK to push this upstream. # # Signed-off-by: Deepak Saxena # Signed-off-by: David Woodhouse # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/mtd/maps/ixp4xx.c # 2004/09/17 00:07:06-07:00 dsaxena@plexity.net +4 -2 # Update IXP4xx MTD driver from CVS MTD # # ChangeSet # 2004/09/17 12:16:07-07:00 dsaxena@plexity.net # [PATCH] Document ARM pci=firmware option # # Added a new pci= command line option specific to ARM systems in # -rc2 and it should be added to kernel-parameters.txt. # # Signed-off-by: Deepak Saxena # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # Documentation/kernel-parameters.txt # 2004/09/17 00:27:56-07:00 dsaxena@plexity.net +7 -0 # Document ARM pci=firmware option # # ChangeSet # 2004/09/17 12:15:53-07:00 clameter@sgi.com # [PATCH] time interpolators logic fix # # Report the resolution of the time source correctly for time interpolators # with a frequency over 1 Ghz. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # kernel/timer.c # 2004/09/17 00:07:06-07:00 clameter@sgi.com +4 -1 # time interpolators logic fix # # ChangeSet # 2004/09/17 12:15:40-07:00 yuasa@hh.iij4u.or.jp # [PATCH] mips: fixed do_signal in arch/mips/kernel/signal.c # # The change of get_signal_to_deliver() is followed. # # Signed-off-by: Yoichi Yuasa # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/mips/kernel/signal.c # 2004/09/17 00:07:06-07:00 yuasa@hh.iij4u.or.jp +4 -5 # mips: fixed do_signal in arch/mips/kernel/signal.c # # ChangeSet # 2004/09/17 12:15:26-07:00 killekulla@rdrz.de # [PATCH] ide: remove obsolete CONFIG_BLK_DEV_ADMA # # In drivers/ide/Kconfig there's a hidden config-item named BLK_DEV_ADMA. # Nowhere in the sources are any references to this item, so this option # simply is obsolete. # # This patch removes the according item from drivers/ide/Kconfig. # # Signed-off-by: Raphael Zimmerer # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/ide/Kconfig # 2004/09/17 00:07:05-07:00 killekulla@rdrz.de +0 -5 # ide: remove obsolete CONFIG_BLK_DEV_ADMA # # ChangeSet # 2004/09/17 12:15:12-07:00 jdike@addtoit.com # [PATCH] uml: update defconfig # # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/defconfig # 2004/09/17 00:07:05-07:00 jdike@addtoit.com +12 -4 # uml: update defconfig # # ChangeSet # 2004/09/17 12:14:58-07:00 jdike@addtoit.com # [PATCH] uml: code cleanup # # Here's another batch of "obviously harmless" changes: # comments # unsigned long -> __u32 changes for some data that needs to be 32 bits # cleanups # removal of an unused declaration # rearrangement of includes # # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/kernel/user_util.c # 2004/09/17 00:07:05-07:00 jdike@addtoit.com +1 -1 # uml: code cleanup # # arch/um/kernel/um_arch.c # 2004/09/17 00:07:05-07:00 jdike@addtoit.com +0 -1 # uml: code cleanup # # arch/um/kernel/uaccess_user.c # 2004/09/17 00:07:05-07:00 jdike@addtoit.com +1 -1 # uml: code cleanup # # arch/um/include/user_util.h # 2004/09/17 00:07:05-07:00 jdike@addtoit.com +0 -1 # uml: code cleanup # # arch/um/drivers/hostaudio_kern.c # 2004/09/17 00:07:05-07:00 jdike@addtoit.com +18 -29 # uml: code cleanup # # arch/um/drivers/cow_user.c # 2004/09/17 00:07:05-07:00 jdike@addtoit.com +2 -2 # uml: code cleanup # # arch/um/drivers/chan_kern.c # 2004/09/17 00:07:05-07:00 jdike@addtoit.com +2 -0 # uml: code cleanup # # ChangeSet # 2004/09/17 12:14:45-07:00 jdike@addtoit.com # [PATCH] uml: remove useless ioctls # # The UML block driver had some useless ioctls in it somehow. This gets rid of # them. # # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/drivers/ubd_kern.c # 2004/09/17 00:07:05-07:00 jdike@addtoit.com +0 -27 # uml: remove useless ioctls # # ChangeSet # 2004/09/17 12:14:33-07:00 jdike@addtoit.com # [PATCH] uml: network driver fixes # # This is from Gerd Knorr. It fixes a network hang caused by the host side of # an interface being full when the UML interface is brought up, preventing any # SIGIOs from happening. It also implements an ioctl needed for ethtool. # # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/drivers/net_kern.c # 2004/09/17 00:07:05-07:00 jdike@addtoit.com +33 -1 # uml: network driver fixes # # ChangeSet # 2004/09/17 12:14:19-07:00 jdike@addtoit.com # [PATCH] uml: mconsole fixes and cleanups # # This patch # makes a couple of functions static # tidies code a bit # sends a response on shutdown before the shutdown happens # # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/drivers/mconsole_kern.c # 2004/09/17 00:07:05-07:00 jdike@addtoit.com +8 -8 # uml: mconsole fixes and cleanups # # ChangeSet # 2004/09/17 12:14:08-07:00 jdike@addtoit.com # [PATCH] uml: more EINTR protection # # This adds retrying on EINTR to a couple more places. # # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/kernel/helper.c # 2004/09/17 00:07:05-07:00 jdike@addtoit.com +2 -2 # uml: more EINTR protection # # ChangeSet # 2004/09/17 12:13:53-07:00 jdike@addtoit.com # [PATCH] uml: get rid of the arch EXTRAVERSION # # I thought this was gone already. It was only intended for my own patch # numbering, and never intended for any other trees. # # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/Makefile # 2004/09/17 00:07:04-07:00 jdike@addtoit.com +0 -2 # uml: get rid of the arch EXTRAVERSION # # ChangeSet # 2004/09/17 12:13:41-07:00 jdike@addtoit.com # [PATCH] uml: clean up terminal state handling # # This patch cleans up UML's handling of terminal state with better error # handling, interface cleanup, and some code tidying. # # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/kernel/user_util.c # 2004/09/17 00:27:57-07:00 jdike@addtoit.com +4 -13 # uml: clean up terminal state handling # # arch/um/kernel/sigio_user.c # 2004/09/17 00:07:04-07:00 jdike@addtoit.com +2 -1 # uml: clean up terminal state handling # # arch/um/include/user_util.h # 2004/09/17 00:27:57-07:00 jdike@addtoit.com +3 -4 # uml: clean up terminal state handling # # arch/um/drivers/xterm.c # 2004/09/17 00:07:04-07:00 jdike@addtoit.com +13 -2 # uml: clean up terminal state handling # # arch/um/drivers/tty.c # 2004/09/17 00:07:04-07:00 jdike@addtoit.com +8 -3 # uml: clean up terminal state handling # # arch/um/drivers/pty.c # 2004/09/17 00:07:04-07:00 jdike@addtoit.com +17 -6 # uml: clean up terminal state handling # # arch/um/drivers/port_user.c # 2004/09/17 00:07:04-07:00 jdike@addtoit.com +8 -3 # uml: clean up terminal state handling # # arch/um/drivers/fd.c # 2004/09/17 00:07:04-07:00 jdike@addtoit.com +14 -3 # uml: clean up terminal state handling # # ChangeSet # 2004/09/17 12:13:30-07:00 jdike@addtoit.com # [PATCH] uml: restrict tlb flushing # # One of UML's tlb flushing routines was ignoring the address range passed in by # its callers. This patch fixes that. # # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/kernel/skas/tlb.c # 2004/09/17 00:07:04-07:00 jdike@addtoit.com +1 -1 # uml: restrict tlb flushing # # ChangeSet # 2004/09/17 12:13:18-07:00 jdike@addtoit.com # [PATCH] uml: export memmove # # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/os-Linux/user_syms.c # 2004/09/17 00:07:04-07:00 jdike@addtoit.com +2 -0 # uml: export memmove # # ChangeSet # 2004/09/17 12:13:02-07:00 jdike@addtoit.com # [PATCH] uml: comment UML's signal handling # # This adds a couple of comments so that people don't get confused into making # misguided fixes, and I don't get confused into applying them. # # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/kernel/signal_user.c # 2004/09/17 00:07:04-07:00 jdike@addtoit.com +11 -0 # uml: comment UML's signal handling # # ChangeSet # 2004/09/17 12:12:48-07:00 jdike@addtoit.com # [PATCH] uml: copy_user fixes # # This patch fixes some copy_user bugs: # # - kernelspace page faults that happen on behalf of a process are now # correctly handled # # - add copy_user treatment so a fault handler which looks at the faulting # instruction # # - added a note to do the same with the ldt stuff some day # # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/sys-i386/ldt.c # 2004/09/17 00:07:04-07:00 jdike@addtoit.com +2 -0 # uml: copy_user fixes # # arch/um/sys-i386/bugs.c # 2004/09/17 00:07:04-07:00 jdike@addtoit.com +4 -3 # uml: copy_user fixes # # arch/um/kernel/user_util.c # 2004/09/17 00:27:58-07:00 jdike@addtoit.com +16 -0 # uml: copy_user fixes # # arch/um/kernel/skas/uaccess.c # 2004/09/17 00:07:04-07:00 jdike@addtoit.com +44 -13 # uml: copy_user fixes # # arch/um/include/user_util.h # 2004/09/17 00:27:58-07:00 jdike@addtoit.com +1 -0 # uml: copy_user fixes # # ChangeSet # 2004/09/17 12:12:33-07:00 jdike@addtoit.com # [PATCH] uml: fix call to sys_clone # # This patch changes the calling convention of clone on i386 to match that of # the host by leaving the fourth argument unused. # # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/sys-i386/syscalls.c # 2004/09/17 00:07:04-07:00 jdike@addtoit.com +22 -0 # uml: fix call to sys_clone # # arch/um/kernel/syscall_kern.c # 2004/09/17 00:07:04-07:00 jdike@addtoit.com +0 -11 # uml: fix call to sys_clone # # ChangeSet # 2004/09/17 12:12:22-07:00 jdike@addtoit.com # [PATCH] uml: iomem fix # # This patch rounds up the size of a file used for iomem emulation up to the # nearest page. This makes mmap work much better on the last page of the # file. # # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/kernel/mem_user.c # 2004/09/17 00:07:03-07:00 jdike@addtoit.com +4 -2 # uml: iomem fix # # ChangeSet # 2004/09/17 12:12:07-07:00 jdike@addtoit.com # [PATCH] uml: eliminate signal order delivery dependency # # On 2.4 hosts signals are delivered in numeric order when there are multiple # pending at a given time. UML developed a subtle dependency on this # ordering, which broke on 2.6 hosts and the separate process and thread # signal queues. # # This patch eliminates that dependency. # # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/os-Linux/process.c # 2004/09/17 00:07:03-07:00 jdike@addtoit.com +0 -4 # uml: eliminate signal order delivery dependency # # arch/um/kernel/tt/trap_user.c # 2004/09/17 00:07:03-07:00 jdike@addtoit.com +0 -2 # uml: eliminate signal order delivery dependency # # arch/um/kernel/tt/process_kern.c # 2004/09/17 00:07:03-07:00 jdike@addtoit.com +17 -1 # uml: eliminate signal order delivery dependency # # arch/um/kernel/tt/exec_kern.c # 2004/09/17 00:07:03-07:00 jdike@addtoit.com +3 -0 # uml: eliminate signal order delivery dependency # # arch/um/kernel/process.c # 2004/09/17 00:07:03-07:00 jdike@addtoit.com +1 -1 # uml: eliminate signal order delivery dependency # # ChangeSet # 2004/09/17 12:11:55-07:00 jdike@addtoit.com # [PATCH] uml: let page faults always be delivered immediately # # This allows page faults to be delivered when they happen. Without this, it # can happen that a page fault will occur when SIGSEGV is disabled, and the # host will then just kill UML because it can't invoke the handler. # # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/kernel/tt/trap_user.c # 2004/09/17 00:27:59-07:00 jdike@addtoit.com +7 -0 # uml: let page faults always be delivered immediately # # arch/um/kernel/process.c # 2004/09/17 00:27:59-07:00 jdike@addtoit.com +1 -5 # uml: let page faults always be delivered immediately # # ChangeSet # 2004/09/17 12:11:41-07:00 jdike@addtoit.com # [PATCH] uml: cleaning up # # This patch is a whole lot of "obviously won't break anything" changes, # including # renaming the UML console functions more consistently # notes to myself # code movement # making some functions static # error path cleanup # printk fixes # # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/sys-i386/ptrace_user.c # 2004/09/17 00:07:03-07:00 jdike@addtoit.com +2 -1 # uml: cleaning up # # arch/um/os-Linux/process.c # 2004/09/17 00:27:59-07:00 jdike@addtoit.com +2 -2 # uml: cleaning up # # arch/um/os-Linux/file.c # 2004/09/17 00:07:03-07:00 jdike@addtoit.com +2 -1 # uml: cleaning up # # arch/um/kernel/user_util.c # 2004/09/17 00:27:59-07:00 jdike@addtoit.com +6 -6 # uml: cleaning up # # arch/um/kernel/umid.c # 2004/09/17 00:07:03-07:00 jdike@addtoit.com +6 -3 # uml: cleaning up # # arch/um/kernel/tt/tracer.c # 2004/09/17 00:07:03-07:00 jdike@addtoit.com +2 -1 # uml: cleaning up # # arch/um/kernel/tt/process_kern.c # 2004/09/17 00:27:59-07:00 jdike@addtoit.com +17 -0 # uml: cleaning up # # arch/um/kernel/skas/process_kern.c # 2004/09/17 00:07:03-07:00 jdike@addtoit.com +23 -0 # uml: cleaning up # # arch/um/kernel/skas/process.c # 2004/09/17 00:07:03-07:00 jdike@addtoit.com +0 -22 # uml: cleaning up # # arch/um/kernel/sigio_kern.c # 2004/09/17 00:07:03-07:00 jdike@addtoit.com +8 -4 # uml: cleaning up # # arch/um/kernel/process.c # 2004/09/17 00:27:59-07:00 jdike@addtoit.com +0 -10 # uml: cleaning up # # arch/um/drivers/xterm.c # 2004/09/17 00:27:58-07:00 jdike@addtoit.com +1 -0 # uml: cleaning up # # arch/um/drivers/stdio_console.c # 2004/09/17 00:07:03-07:00 jdike@addtoit.com +6 -6 # uml: cleaning up # # ChangeSet # 2004/09/17 12:11:29-07:00 jdike@addtoit.com # [PATCH] uml: convert the real-time clock to gettimeofday from rdtsc # # There are a whole bunch of reasons to use gettimeofday rather than rdtsc, # so this patch does just that. # # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/sys-i386/Makefile # 2004/09/17 00:07:03-07:00 jdike@addtoit.com +1 -1 # uml: convert the real-time clock to gettimeofday from rdtsc # # arch/um/os-Linux/time.c # 2004/09/17 12:11:22-07:00 jdike@addtoit.com +21 -0 # # arch/um/os-Linux/Makefile # 2004/09/17 00:07:03-07:00 jdike@addtoit.com +2 -2 # uml: convert the real-time clock to gettimeofday from rdtsc # # arch/um/kernel/time_kern.c # 2004/09/17 00:07:03-07:00 jdike@addtoit.com +16 -14 # uml: convert the real-time clock to gettimeofday from rdtsc # # arch/um/kernel/time.c # 2004/09/17 00:07:03-07:00 jdike@addtoit.com +0 -38 # uml: convert the real-time clock to gettimeofday from rdtsc # # arch/um/include/os.h # 2004/09/17 00:07:03-07:00 jdike@addtoit.com +1 -0 # uml: convert the real-time clock to gettimeofday from rdtsc # # arch/um/os-Linux/time.c # 2004/09/17 12:11:22-07:00 jdike@addtoit.com +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/um/os-Linux/time.c # # BitKeeper/deleted/.del-time.c~800319bd3e32c1aa # 2004/09/17 12:11:22-07:00 jdike@addtoit.com +0 -0 # Delete: arch/um/sys-i386/time.c # # ChangeSet # 2004/09/17 12:10:46-07:00 jdike@addtoit.com # [PATCH] uml: enable the timer *after* the timer handler # # Otherwise, we'll sometimes get timer interrupts that we can't handle. # # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/kernel/skas/process_kern.c # 2004/09/17 12:10:40-07:00 jdike@addtoit.com +1 -1 # uml: enable the timer *after* the timer handler # # ChangeSet # 2004/09/17 12:10:32-07:00 jdike@addtoit.com # [PATCH] uml: fix a signal race # # This patch saves and restores UML's idea of user mode across an interrupt. # Without this, an interrupt arriving at the wrong time can cause UML to lose # track of whether an interrupted handler is handing a userspace interrupt. # # From: Ingo Molnar # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/kernel/skas/trap_user.c # 2004/09/17 00:07:02-07:00 jdike@addtoit.com +3 -0 # uml: fix a signal race # # ChangeSet # 2004/09/17 12:10:21-07:00 jdike@addtoit.com # [PATCH] uml: finish the signals across a reboot fix # # Due to me not refreshing this patch earlier, the last reboot signals patch was # missing the actual fix. # # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/kernel/main.c # 2004/09/17 00:07:02-07:00 jdike@addtoit.com +14 -0 # uml: finish the signals across a reboot fix # # ChangeSet # 2004/09/17 12:10:06-07:00 jdike@addtoit.com # [PATCH] uml: finish conversion to sigjmp_buf/siglongjmp # # UML needs to use siglongjmp instead of longjmp everywhere. This patch fixes # the remaining longjmp/jmp_buf occurrences. # # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/kernel/uaccess_user.c # 2004/09/17 00:27:57-07:00 jdike@addtoit.com +1 -1 # uml: finish conversion to sigjmp_buf/siglongjmp # # arch/um/kernel/tt/uaccess_user.c # 2004/09/17 00:07:02-07:00 jdike@addtoit.com +1 -1 # uml: finish conversion to sigjmp_buf/siglongjmp # # arch/um/kernel/trap_user.c # 2004/09/17 00:07:02-07:00 jdike@addtoit.com +1 -1 # uml: finish conversion to sigjmp_buf/siglongjmp # # arch/um/kernel/skas/process.c # 2004/09/17 12:09:59-07:00 jdike@addtoit.com +7 -7 # uml: finish conversion to sigjmp_buf/siglongjmp # # arch/um/kernel/process.c # 2004/09/17 12:09:59-07:00 jdike@addtoit.com +1 -1 # uml: finish conversion to sigjmp_buf/siglongjmp # # ChangeSet # 2004/09/17 12:09:54-07:00 jdike@addtoit.com # [PATCH] uml: update handle_IRQ_event # # A small update to make UML's handle_IRQ_event look like the i386 version. # # Signed-off-by: Jeff Dike # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/kernel/irq.c # 2004/09/17 00:07:02-07:00 jdike@addtoit.com +3 -2 # uml: update handle_IRQ_event # # ChangeSet # 2004/09/17 12:09:41-07:00 jbarnes@engr.sgi.com # [PATCH] fix sysrq handling bug in sn_console.c # # Fix a stupid bug in the sysrq handling in sn_console.c. Instead of eating # all characters in the sysrq string (preventing them from getting to the tty # layer), only eat those following 'ESC' since that's a pretty important # character for various things. Please apply before 2.6.9 is released as the # console is very unfriendly to use without it. # # Signed-off-by: Jesse Barnes # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/serial/sn_console.c # 2004/09/17 00:07:02-07:00 jbarnes@engr.sgi.com +7 -4 # fix sysrq handling bug in sn_console.c # # ChangeSet # 2004/09/17 12:09:26-07:00 paulmck@us.ibm.com # [PATCH] Updates to RCU documentation # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # Documentation/RCU/rcu.txt # 2004/09/17 00:07:02-07:00 paulmck@us.ibm.com +22 -11 # Updates to RCU documentation # # Documentation/RCU/listRCU.txt # 2004/09/17 00:07:02-07:00 paulmck@us.ibm.com +9 -3 # Updates to RCU documentation # # Documentation/RCU/arrayRCU.txt # 2004/09/17 00:07:02-07:00 paulmck@us.ibm.com +141 -0 # Updates to RCU documentation # # Documentation/RCU/UP.txt # 2004/09/17 00:07:02-07:00 paulmck@us.ibm.com +2 -2 # Updates to RCU documentation # # Documentation/RCU/RTFP.txt # 2004/09/17 00:07:02-07:00 paulmck@us.ibm.com +36 -1 # Updates to RCU documentation # # Documentation/RCU/arrayRCU.txt # 2004/09/17 00:07:02-07:00 paulmck@us.ibm.com +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/Documentation/RCU/arrayRCU.txt # # ChangeSet # 2004/09/17 12:09:12-07:00 zwane@linuxpower.ca # [PATCH] Close race with preempt and modular pm_idle callbacks # # The following patch from Shaohua Li fixes a race with preempt enabled when # a module containing a pm_idle callback is unloaded. Cached values in local # variables need to be protected as RCU critical sections so that the # synchronize_kernel() call in the unload path waits for all processors. # There original bugzilla entry can be found at # # Shaohua, i had to make a small change (variable declaration after code in # code block) so that it compiles with geriatric compilers such as the ones # Andrew is attached to ;) # # http://bugzilla.kernel.org/show_bug.cgi?id=1716 # # Signed-off-by: Li Shaohua # Signed-off-by: Zwane Mwaikambo # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/acpi/processor.c # 2004/09/17 00:07:02-07:00 zwane@linuxpower.ca +5 -0 # Close race with preempt and modular pm_idle callbacks # # arch/x86_64/kernel/process.c # 2004/09/17 00:07:02-07:00 zwane@linuxpower.ca +13 -4 # Close race with preempt and modular pm_idle callbacks # # arch/ia64/kernel/process.c # 2004/09/17 00:07:02-07:00 zwane@linuxpower.ca +12 -4 # Close race with preempt and modular pm_idle callbacks # # arch/i386/kernel/process.c # 2004/09/17 00:07:02-07:00 zwane@linuxpower.ca +9 -1 # Close race with preempt and modular pm_idle callbacks # # arch/i386/kernel/apm.c # 2004/09/17 00:07:02-07:00 zwane@linuxpower.ca +8 -1 # Close race with preempt and modular pm_idle callbacks # # ChangeSet # 2004/09/17 12:08:57-07:00 clameter@sgi.com # [PATCH] device driver for the SGI system clock, mmtimer # # SGI has been using this driver under Linux since 2001 but it was # never included in the upstream kernel. SuSE did include the patch for mmtimer # in SLES 9. The driver has been widely used for applications on the Altix # platform. # # The timer hardware was designed around the multimedia timer specification by # Intel but to my knowledge only SGI has implemented that standard. The driver # was written by Jesse Barnes. # # The second revision has interrupt support removed and was somewhat simplified # by removing one include file. # # Signed-off-by: Christoph Lameter # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/linux/mmtimer.h # 2004/09/17 00:07:01-07:00 clameter@sgi.com +140 -0 # device driver for the SGI system clock, mmtimer # # include/linux/mmtimer.h # 2004/09/17 00:07:01-07:00 clameter@sgi.com +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/linux/mmtimer.h # # include/linux/miscdevice.h # 2004/09/17 00:07:01-07:00 clameter@sgi.com +1 -0 # device driver for the SGI system clock, mmtimer # # drivers/char/mmtimer.c # 2004/09/17 00:07:01-07:00 clameter@sgi.com +198 -0 # device driver for the SGI system clock, mmtimer # # drivers/char/Makefile # 2004/09/17 00:07:02-07:00 clameter@sgi.com +1 -0 # device driver for the SGI system clock, mmtimer # # drivers/char/Kconfig # 2004/09/17 00:07:01-07:00 clameter@sgi.com +8 -0 # device driver for the SGI system clock, mmtimer # # arch/ia64/sn/kernel/setup.c # 2004/09/17 00:07:01-07:00 clameter@sgi.com +2 -0 # device driver for the SGI system clock, mmtimer # # drivers/char/mmtimer.c # 2004/09/17 00:07:01-07:00 clameter@sgi.com +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/drivers/char/mmtimer.c # # ChangeSet # 2004/09/17 12:08:43-07:00 takata@linux-m32r.org # [PATCH] m32r: fix to build SMP kernel # # Here is a patch to fix compile errors to build SMP kernel for m32r. # # Signed-off-by: Hirokazu Takata # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/m32r/kernel/smpboot.c # 2004/09/17 00:07:01-07:00 takata@linux-m32r.org +2 -26 # m32r: fix to build SMP kernel # # arch/m32r/kernel/smp.c # 2004/09/17 00:07:01-07:00 takata@linux-m32r.org +15 -6 # m32r: fix to build SMP kernel # # ChangeSet # 2004/09/17 12:08:28-07:00 takata.hirokazu@renesas.com # [PATCH] m32r: upgrade include/asm-m32r/atomic.h # # Upgrade include/asm-m32r/atomic.h. # # * include/asm-m32r/atomic.h # # - Change atomic_add(), atomic_sub(), atomic_inc() and atomic_dec() from # function to macro. # # - Change not to use fixed woking register in atomic_clear_mask() and # atomic_set_mask(). # # - Update comments: "return" to "return it", and so on. # # Signed-off-by: Hirokazu Takata # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-m32r/atomic.h # 2004/09/17 00:07:01-07:00 takata.hirokazu@renesas.com +53 -127 # m32r: upgrade include/asm-m32r/atomic.h # # ChangeSet # 2004/09/17 12:08:15-07:00 takata@linux-m32r.org # [PATCH] m32r: slim arch/m32r/Kconfig # # Here is a patch to slim arch/m32r/Kconfig. Useless CONFIG_ options are # removed for m32r. # # Signed-off-by: Hirokazu Takata # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/m32r/Kconfig # 2004/09/17 00:07:01-07:00 takata@linux-m32r.org +2 -180 # m32r: slim arch/m32r/Kconfig # # ChangeSet # 2004/09/17 12:08:01-07:00 takata@linux-m32r.org # [PATCH] m32r: modify drivers/net/ne.c for m32r # # This patch updates drivers/net/ne.c and merges m32r support to it. # # - Add m32r support. # # Signed-off-by: Hayato Fujiwara # Signed-off-by: Hirokazu Takata # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/net/ne.c # 2004/09/17 00:07:01-07:00 takata@linux-m32r.org +29 -1 # m32r: modify drivers/net/ne.c for m32r # # drivers/net/Kconfig # 2004/09/17 00:07:01-07:00 takata@linux-m32r.org +1 -1 # m32r: modify drivers/net/ne.c for m32r # # drivers/net/8390.c # 2004/09/17 00:07:01-07:00 takata@linux-m32r.org +10 -0 # m32r: modify drivers/net/ne.c for m32r # # arch/m32r/kernel/setup_oaks32r.c # 2004/09/17 00:07:01-07:00 takata@linux-m32r.org +1 -1 # m32r: modify drivers/net/ne.c for m32r # # arch/m32r/kernel/setup_mappi.c # 2004/09/17 00:07:01-07:00 takata@linux-m32r.org +1 -1 # m32r: modify drivers/net/ne.c for m32r # # ChangeSet # 2004/09/17 12:07:47-07:00 takata@linux-m32r.org # [PATCH] m32r: modify drivers/net/smc91x.c for m32r # # This patch updates drivers/net/smc91x.c and merges m32r support to it. # # - Add m32r support. # # - Modify for SMP kernel. # # Signed-off-by: Hayato Fujiwara # Signed-off-by: Hirokazu Takata # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/net/smc91x.h # 2004/09/16 17:07:00-07:00 takata@linux-m32r.org +13 -0 # m32r: modify drivers/net/smc91x.c for m32r # # drivers/net/smc91x.c # 2004/09/16 17:07:00-07:00 takata@linux-m32r.org +19 -10 # m32r: modify drivers/net/smc91x.c for m32r # # drivers/net/Kconfig # 2004/09/17 00:28:02-07:00 takata@linux-m32r.org +1 -1 # m32r: modify drivers/net/smc91x.c for m32r # # arch/m32r/kernel/setup_opsput.c # 2004/09/16 17:07:00-07:00 takata@linux-m32r.org +32 -2 # m32r: modify drivers/net/smc91x.c for m32r # # arch/m32r/kernel/setup_mappi2.c # 2004/09/16 17:07:00-07:00 takata@linux-m32r.org +32 -2 # m32r: modify drivers/net/smc91x.c for m32r # # arch/m32r/kernel/setup_m32700ut.c # 2004/09/16 17:07:00-07:00 takata@linux-m32r.org +32 -2 # m32r: modify drivers/net/smc91x.c for m32r # # arch/m32r/kernel/io_mappi2.c # 2004/09/16 17:07:00-07:00 takata@linux-m32r.org +13 -10 # m32r: modify drivers/net/smc91x.c for m32r # # ChangeSet # 2004/09/17 12:07:32-07:00 takata@linux-m32r.org # [PATCH] m32r: remove network drivers # # Signed-off-by: Hayato Fujiwara # Signed-off-by: Hirokazu Takata # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/m32r/drivers/Makefile # 2004/09/16 17:07:00-07:00 takata@linux-m32r.org +0 -2 # m32r: remove network drivers # # arch/m32r/drivers/Kconfig # 2004/09/16 17:07:00-07:00 takata@linux-m32r.org +0 -8 # m32r: remove network drivers # # BitKeeper/deleted/.del-smc91111.readme.txt~3baef675d80c752a # 2004/09/17 12:07:26-07:00 takata@linux-m32r.org +0 -0 # Delete: arch/m32r/drivers/smc91111.readme.txt # # BitKeeper/deleted/.del-smc91111.h~dd904e77d0832d6f # 2004/09/17 12:07:25-07:00 takata@linux-m32r.org +0 -0 # Delete: arch/m32r/drivers/smc91111.h # # BitKeeper/deleted/.del-smc91111.c~bbd86edfa73a711f # 2004/09/17 12:07:25-07:00 takata@linux-m32r.org +0 -0 # Delete: arch/m32r/drivers/smc91111.c # # BitKeeper/deleted/.del-smc91111.copying~ff130d9d85afe5b4 # 2004/09/17 12:07:25-07:00 takata@linux-m32r.org +0 -0 # Delete: arch/m32r/drivers/smc91111.copying # # BitKeeper/deleted/.del-mappi_ne.c~60956c35ffc19393 # 2004/09/17 12:07:24-07:00 takata@linux-m32r.org +0 -0 # Delete: arch/m32r/drivers/mappi_ne.c # # BitKeeper/deleted/.del-8390.h~49ba18e09c7c1f97 # 2004/09/17 12:07:24-07:00 takata@linux-m32r.org +0 -0 # Delete: arch/m32r/drivers/8390.h # # BitKeeper/deleted/.del-8390.c~10decee4a025afd6 # 2004/09/17 12:07:24-07:00 takata@linux-m32r.org +0 -0 # Delete: arch/m32r/drivers/8390.c # # ChangeSet # 2004/09/17 12:07:16-07:00 takata@linux-m32r.org # [PATCH] m32r: modify IO routines for m32700ut CF access # # Here is a patch for M3T-M32700UT board. # # - Enable CF access through card-service if CONFIG_M32R_CFC is not defined. # # Signed-off-by: Hirokazu Takata # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/m32r/kernel/io_m32700ut.c # 2004/09/16 17:07:00-07:00 takata@linux-m32r.org +13 -13 # m32r: modify IO routines for m32700ut CF access # # ChangeSet # 2004/09/17 12:07:00-07:00 takata@linux-m32r.org # [PATCH] m32r: support a new bootloader "m32r-g00ff" # # - Support new bootloader "m32r-g00ff". m32r-g00ff is newly written by # NIIBE Yutaka and is released under GPL. # http://www.gniibe.org/software/m32r-g00ff-20040729.tar.gz # # - arch/m32r/kernel/setup.c (parse_mem_cmdline): Fix to remove unused # region at the end of memory. # # - include/asm-m32r/uaccess.h (__put_user_u64): Fix to remove warnings in # compilation time. # # NOTE: (for m32r users) # From this version, the bootloader-kernel interface has changed. # - Section order is changed and rearranged for the new bootloader. # - Kernel's entry address is also changed : 0x08001000 --> 0x08002000. # - Paramter-passing method from bootloader to kernel is revised. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-m32r/uaccess.h # 2004/09/16 17:07:00-07:00 takata@linux-m32r.org +8 -12 # m32r: support a new bootloader "m32r-g00ff" # # include/asm-m32r/types.h # 2004/09/16 17:07:00-07:00 takata@linux-m32r.org +9 -2 # m32r: support a new bootloader "m32r-g00ff" # # include/asm-m32r/ide.h # 2004/09/16 17:07:00-07:00 takata@linux-m32r.org +11 -0 # m32r: support a new bootloader "m32r-g00ff" # # arch/m32r/kernel/vmlinux.lds.S # 2004/09/16 17:07:00-07:00 takata@linux-m32r.org +4 -19 # m32r: support a new bootloader "m32r-g00ff" # # arch/m32r/kernel/traps.c # 2004/09/16 17:07:00-07:00 takata@linux-m32r.org +57 -110 # m32r: support a new bootloader "m32r-g00ff" # # arch/m32r/kernel/setup_m32700ut.c # 2004/09/17 00:28:03-07:00 takata@linux-m32r.org +0 -3 # m32r: support a new bootloader "m32r-g00ff" # # arch/m32r/kernel/setup.c # 2004/09/16 17:07:00-07:00 takata@linux-m32r.org +0 -11 # m32r: support a new bootloader "m32r-g00ff" # # arch/m32r/kernel/io_m32700ut.c # 2004/09/17 00:28:03-07:00 takata@linux-m32r.org +83 -5 # m32r: support a new bootloader "m32r-g00ff" # # arch/m32r/kernel/head.S # 2004/09/16 17:07:00-07:00 takata@linux-m32r.org +2 -1 # m32r: support a new bootloader "m32r-g00ff" # # arch/m32r/kernel/entry.S # 2004/09/16 17:07:00-07:00 takata@linux-m32r.org +5 -1 # m32r: support a new bootloader "m32r-g00ff" # # arch/m32r/boot/setup.S # 2004/09/16 17:07:00-07:00 takata@linux-m32r.org +13 -68 # m32r: support a new bootloader "m32r-g00ff" # # arch/m32r/boot/compressed/vmlinux.lds.S # 2004/09/16 17:07:00-07:00 takata@linux-m32r.org +1 -3 # m32r: support a new bootloader "m32r-g00ff" # # arch/m32r/boot/compressed/misc.c # 2004/09/16 17:07:00-07:00 takata@linux-m32r.org +3 -4 # m32r: support a new bootloader "m32r-g00ff" # # arch/m32r/boot/compressed/m32r_sio.c # 2004/09/16 17:07:00-07:00 takata@linux-m32r.org +4 -1 # m32r: support a new bootloader "m32r-g00ff" # # arch/m32r/boot/compressed/head.S # 2004/09/16 17:07:00-07:00 takata@linux-m32r.org +19 -106 # m32r: support a new bootloader "m32r-g00ff" # # arch/m32r/boot/compressed/Makefile # 2004/09/16 17:07:00-07:00 takata@linux-m32r.org +8 -7 # m32r: support a new bootloader "m32r-g00ff" # # arch/m32r/Makefile # 2004/09/16 17:07:00-07:00 takata@linux-m32r.org +18 -2 # m32r: support a new bootloader "m32r-g00ff" # # ChangeSet # 2004/09/17 12:06:46-07:00 takata@linux-m32r.org # [PATCH] m32r: upgrade to 2.6.8.1 kernel # # Here is a patch for 2.6.8.1 kernel of Renesas M32R processor. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-m32r/unistd.h # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +5 -13 # m32r: upgrade to 2.6.8.1 kernel # # include/asm-m32r/uaccess.h # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +1 -1 # m32r: upgrade to 2.6.8.1 kernel # # include/asm-m32r/smp.h # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +44 -3 # m32r: upgrade to 2.6.8.1 kernel # # include/asm-m32r/signal.h # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +11 -5 # m32r: upgrade to 2.6.8.1 kernel # # include/asm-m32r/setup.h # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +1 -1 # m32r: upgrade to 2.6.8.1 kernel # # include/asm-m32r/resource.h # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +6 -2 # m32r: upgrade to 2.6.8.1 kernel # # include/asm-m32r/fcntl.h # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +1 -0 # m32r: upgrade to 2.6.8.1 kernel # # include/asm-m32r/delay.h # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +7 -1 # m32r: upgrade to 2.6.8.1 kernel # # include/asm-m32r/checksum.h # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +3 -1 # m32r: upgrade to 2.6.8.1 kernel # # include/asm-m32r/bitops.h # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +12 -12 # m32r: upgrade to 2.6.8.1 kernel # # arch/m32r/opsput/defconfig.opsput # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +16 -6 # m32r: upgrade to 2.6.8.1 kernel # # arch/m32r/oaks32r/defconfig.nommu # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +14 -7 # m32r: upgrade to 2.6.8.1 kernel # # arch/m32r/mm/init.c # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +6 -6 # m32r: upgrade to 2.6.8.1 kernel # # arch/m32r/mm/fault.c # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +41 -22 # m32r: upgrade to 2.6.8.1 kernel # # arch/m32r/mappi/defconfig.up # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +33 -5 # m32r: upgrade to 2.6.8.1 kernel # # arch/m32r/mappi/defconfig.smp # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +33 -5 # m32r: upgrade to 2.6.8.1 kernel # # arch/m32r/mappi/defconfig.nommu # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +15 -8 # m32r: upgrade to 2.6.8.1 kernel # # arch/m32r/m32700ut/defconfig.m32700ut.up # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +20 -8 # m32r: upgrade to 2.6.8.1 kernel # # arch/m32r/m32700ut/defconfig.m32700ut.smp # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +19 -6 # m32r: upgrade to 2.6.8.1 kernel # # arch/m32r/lib/delay.c # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +6 -4 # m32r: upgrade to 2.6.8.1 kernel # # arch/m32r/kernel/traps.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +2 -2 # m32r: upgrade to 2.6.8.1 kernel # # arch/m32r/kernel/time.c # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +15 -15 # m32r: upgrade to 2.6.8.1 kernel # # arch/m32r/kernel/sys_m32r.c # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +1 -1 # m32r: upgrade to 2.6.8.1 kernel # # arch/m32r/kernel/smpboot.c # 2004/09/17 00:28:02-07:00 takata@linux-m32r.org +12 -13 # m32r: upgrade to 2.6.8.1 kernel # # arch/m32r/kernel/smp.c # 2004/09/17 00:28:02-07:00 takata@linux-m32r.org +55 -38 # m32r: upgrade to 2.6.8.1 kernel # # arch/m32r/kernel/setup.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +18 -8 # m32r: upgrade to 2.6.8.1 kernel # # arch/m32r/kernel/module.c # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +1 -1 # m32r: upgrade to 2.6.8.1 kernel # # arch/m32r/kernel/irq.c # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +2 -3 # m32r: upgrade to 2.6.8.1 kernel # # arch/m32r/kernel/init_task.c # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +1 -0 # m32r: upgrade to 2.6.8.1 kernel # # arch/m32r/drivers/smc91111.c # 2004/09/17 00:28:03-07:00 takata@linux-m32r.org +74 -76 # m32r: upgrade to 2.6.8.1 kernel # # arch/m32r/defconfig # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +20 -7 # m32r: upgrade to 2.6.8.1 kernel # # arch/m32r/Makefile # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +2 -0 # m32r: upgrade to 2.6.8.1 kernel # # BitKeeper/deleted/.del-init.h~7ac4c9a8775db665 # 2004/09/17 12:06:40-07:00 takata@linux-m32r.org +0 -0 # Delete: include/asm-m32r/init.h # # BitKeeper/deleted/.del-cpumask.h~3f1857f2ffec8708 # 2004/09/17 12:06:40-07:00 takata@linux-m32r.org +0 -0 # Delete: include/asm-m32r/cpumask.h # # ChangeSet # 2004/09/17 12:06:30-07:00 takata.hirokazu@renesas.com # [PATCH] m32r: add ELF machine code # # Here is a patch for m32r's ELF machine code. And also change from "Hitachi # H8/300" to "Renesas H8/300"(*). # # (*) The SuperH, M32R and H8* - now these are all Renesas's products. # # Signed-off-by: Hirokazu Takata # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/linux/elf.h # 2004/09/17 12:06:23-07:00 takata.hirokazu@renesas.com +6 -1 # m32r: add ELF machine code # # ChangeSet # 2004/09/17 12:06:18-07:00 takata@linux-m32r.org # [PATCH] m32r: modify sys_ipc() to remove useless iBCS2 support code # # The useless iBCS2 supporting code is removed. # # However, according to old_ syscalls, I would like to keep backward- # compatibility for a while, due to some old deb packages and # executables for m32r. # I'm struggling to rebuild and replace old packages to new ones. # http://debian.linux-m32r.org/ # # Signed-off-by: Hirokazu Takata # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/m32r/kernel/sys_m32r.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +10 -15 # m32r: modify sys_ipc() to remove useless iBCS2 support code # # ChangeSet # 2004/09/17 12:06:05-07:00 takata@linux-m32r.org # [PATCH] m32r: change from EXPORT_SYMBOL_NOVERS to EXPORT_SYMBOL # # arch/m32r/kernel/m32r_ksyms, EXPORT_SYMBOL_NOVERS is deprecated, use # EXPORT_SYMBOL. # # Signed-off-by: Hirokazu Takata # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/m32r/kernel/m32r_ksyms.c # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +54 -54 # m32r: change from EXPORT_SYMBOL_NOVERS to EXPORT_SYMBOL # # ChangeSet # 2004/09/17 12:05:50-07:00 takata@linux-m32r.org # [PATCH] atomic_inc_return for m32r # # * include/asm-m32r/atomic.h: # - Add atomic_inc_return(), atomic_dec_return(), atomic_add_return(), # atomic_sub_return() and atomic_clear_mask(). # # - Change atomic_sub_and_test(), atomic_inc_and_test() and # atomic_dec_and_test() from functions to macros. # # - Update comments, etc. # # Signed-off-by: Hirokazu Takata # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-m32r/atomic.h # 2004/09/17 00:28:02-07:00 takata@linux-m32r.org +103 -61 # atomic_inc_return for m32r # # ChangeSet # 2004/09/17 12:05:37-07:00 takata@linux-m32r.org # [PATCH] m32r: update headers to remove useless iBCS2 support code # # Here's a patch to update headers, elf.h and poll.h, to remove useless # iBCS2/SVR4 support code for m32r. # # Signed-off-by: Hirokazu Takata # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-m32r/poll.h # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +7 -5 # m32r: update headers to remove useless iBCS2 support code # # include/asm-m32r/elf.h # 2004/09/17 00:06:59-07:00 takata@linux-m32r.org +34 -39 # m32r: update headers to remove useless iBCS2 support code # # ChangeSet # 2004/09/17 12:05:21-07:00 takata@linux-m32r.org # [PATCH] m32r: update CF/PCMCIA drivers # # This patch updates m32r-specific CF/PCMCIA drivers and # fixes compile errors. # # Signed-off-by: Hirokazu Takata # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/m32r/drivers/m32r_pcc.c # 2004/09/17 00:06:58-07:00 takata@linux-m32r.org +14 -11 # m32r: update CF/PCMCIA drivers # # arch/m32r/drivers/m32r_cfc.c # 2004/09/17 00:06:58-07:00 takata@linux-m32r.org +7 -7 # m32r: update CF/PCMCIA drivers # # ChangeSet # 2004/09/17 12:05:08-07:00 takata@linux-m32r.org # [PATCH] m32r: update checksum functions # # This patch update checksum routines. # And EXPORT_SYMBOL() is moved from m32r_ksyms.c to csum_partial_copy.c. # # Signed-off-by: Hirokazu Takata # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-m32r/checksum.h # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +39 -91 # m32r: update checksum functions # # arch/m32r/lib/csum_partial_copy.c # 2004/09/17 00:06:58-07:00 takata@linux-m32r.org +10 -29 # m32r: update checksum functions # # arch/m32r/kernel/m32r_ksyms.c # 2004/09/17 00:28:05-07:00 takata@linux-m32r.org +0 -2 # m32r: update checksum functions # # ChangeSet # 2004/09/17 12:04:53-07:00 takata@linux-m32r.org # [PATCH] m32r: update uaccess.h # # This patch updates asm-m32r/uaccess.h. # # * include/asm-m32r/uaccess.h: # (__copy_to_user_inatomic): Added. # (__copy_from_user_inatomic): Added. # Update comments. # # Signed-off-by: Hirokazu Takata # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-m32r/uaccess.h # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +290 -59 # m32r: update uaccess.h # # ChangeSet # 2004/09/17 12:04:42-07:00 takata@linux-m32r.org # [PATCH] m32r: update to fix compile errors # # This patch updates code to fix compile errors, and so on. # # * arch/m32r/kernel/Makefile: # Change linker script's name from vmlinux.lds.s to vmlinux.lds. # # * arch/m32r/kernel/process.c (sys_clone): # Fix the first parameter of do_fork() call. # # * arch/m32r/kernel/signal.c: # (handle_signal): Add a new second argument, struct k_sigaction *ka. # (do_signal): Change get_signal_to_deliver() interface. # # * include/asm-m32r/hardirq.h: # Some declarations are moved to linux/hardirq.h. # # * include/asm-m32r/page.h: # Add devmem_is_allowed() macro. # # Signed-off-by: Hirokazu Takata # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-m32r/page.h # 2004/09/17 00:06:58-07:00 takata@linux-m32r.org +2 -2 # m32r: update to fix compile errors # # include/asm-m32r/hardirq.h # 2004/09/17 00:06:58-07:00 takata@linux-m32r.org +0 -18 # m32r: update to fix compile errors # # arch/m32r/kernel/signal.c # 2004/09/17 00:06:58-07:00 takata@linux-m32r.org +38 -30 # m32r: update to fix compile errors # # arch/m32r/kernel/process.c # 2004/09/17 00:06:58-07:00 takata@linux-m32r.org +2 -3 # m32r: update to fix compile errors # # arch/m32r/kernel/Makefile # 2004/09/17 00:06:58-07:00 takata@linux-m32r.org +1 -1 # m32r: update to fix compile errors # # ChangeSet # 2004/09/17 12:04:27-07:00 takata@linux-m32r.org # [PATCH] m32r: update zone_sizes_init() # # This patch upgrades zone_sizes_init() function. # This patch is required because free_area_init_node()'s interface # has been changed. # # * arch/m32r/mm/discontig.c (zone_sizes_init): # Change free_area_init_node() interface. # # * arch/m32r/mm/init.c: ditto. # # Signed-off-by: Hirokazu Takata # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/m32r/mm/init.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +1 -2 # m32r: update zone_sizes_init() # # arch/m32r/mm/discontig.c # 2004/09/17 00:06:58-07:00 takata@linux-m32r.org +1 -1 # m32r: update zone_sizes_init() # # ChangeSet # 2004/09/17 12:04:10-07:00 takata@linux-m32r.org # [PATCH] m32r: update for profiling # # This patch is for profiling support. # profile_tick() is used instead of m32r_do_profile(). # # * arch/m32r/kernel/smp.c # (smp_local_timer_interrupt): Change profile API, use profile_tick() # instead of m32r_do_profile(). # # * arch/m32r/kernel/time.c: ditto. # # * include/asm-m32r/hw_irq.h (m32r_do_profile): Removed. # # * include/asm-m32r/ptrace.h (profile_pc): Add profile_pc() macro. # # Signed-off-by: Hirokazu Takata # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-m32r/ptrace.h # 2004/09/17 00:06:58-07:00 takata@linux-m32r.org +8 -6 # m32r: update for profiling # # include/asm-m32r/hw_irq.h # 2004/09/17 00:06:58-07:00 takata@linux-m32r.org +1 -32 # m32r: update for profiling # # arch/m32r/kernel/time.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +2 -3 # m32r: update for profiling # # arch/m32r/kernel/smp.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +4 -6 # m32r: update for profiling # # ChangeSet # 2004/09/17 12:03:54-07:00 takata@linux-m32r.org # [PATCH] m32r architecture # # Add support for the m32r architecture # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-m32r/xor.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +8 -0 # m32r architecture # # include/asm-m32r/vga.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +22 -0 # m32r architecture # # include/asm-m32r/user.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +59 -0 # m32r architecture # # include/asm-m32r/unistd.h # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +488 -0 # m32r architecture # # include/asm-m32r/unaligned.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +25 -0 # m32r architecture # # include/asm-m32r/ucontext.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +14 -0 # m32r architecture # # include/asm-m32r/uaccess.h # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +525 -0 # m32r architecture # # include/asm-m32r/types.h # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +57 -0 # m32r architecture # # include/asm-m32r/topology.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +53 -0 # m32r architecture # # include/asm-m32r/tlbflush.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +102 -0 # m32r architecture # # include/asm-m32r/tlb.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +20 -0 # m32r architecture # # include/asm-m32r/timex.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +36 -0 # m32r architecture # # include/asm-m32r/thread_info.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +149 -0 # m32r architecture # # include/asm-m32r/termios.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +109 -0 # m32r architecture # # include/asm-m32r/termbits.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +175 -0 # m32r architecture # # include/asm-m32r/system.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +301 -0 # m32r architecture # # include/asm-m32r/syscall.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +11 -0 # m32r architecture # # include/asm-m32r/string.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +15 -0 # m32r architecture # # include/asm-m32r/statfs.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +6 -0 # m32r architecture # # include/asm-m32r/stat.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +91 -0 # m32r architecture # # include/asm-m32r/spinlock.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +371 -0 # m32r architecture # # include/asm-m32r/sockios.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +14 -0 # m32r architecture # # include/asm-m32r/socket.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +70 -0 # m32r architecture # # include/asm-m32r/smp.h # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +78 -0 # m32r architecture # # include/asm-m32r/signal.h # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +194 -0 # m32r architecture # # include/asm-m32r/siginfo.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +8 -0 # m32r architecture # # include/asm-m32r/sigcontext.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +50 -0 # m32r architecture # # include/asm-m32r/shmparam.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +8 -0 # m32r architecture # # include/asm-m32r/shmbuf.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +46 -0 # m32r architecture # # include/asm-m32r/setup.h # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +33 -0 # m32r architecture # # include/asm-m32r/serial.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +151 -0 # m32r architecture # # include/asm-m32r/xor.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/xor.h # # include/asm-m32r/vga.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/vga.h # # include/asm-m32r/user.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/user.h # # include/asm-m32r/unistd.h # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/unistd.h # # include/asm-m32r/unaligned.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/unaligned.h # # include/asm-m32r/ucontext.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/ucontext.h # # include/asm-m32r/uaccess.h # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/uaccess.h # # include/asm-m32r/types.h # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/types.h # # include/asm-m32r/topology.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/topology.h # # include/asm-m32r/tlbflush.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/tlbflush.h # # include/asm-m32r/tlb.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/tlb.h # # include/asm-m32r/timex.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/timex.h # # include/asm-m32r/thread_info.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/thread_info.h # # include/asm-m32r/termios.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/termios.h # # include/asm-m32r/termbits.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/termbits.h # # include/asm-m32r/system.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/system.h # # include/asm-m32r/syscall.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/syscall.h # # include/asm-m32r/string.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/string.h # # include/asm-m32r/statfs.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/statfs.h # # include/asm-m32r/stat.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/stat.h # # include/asm-m32r/spinlock.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/spinlock.h # # include/asm-m32r/sockios.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/sockios.h # # include/asm-m32r/socket.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/socket.h # # include/asm-m32r/smp.h # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/smp.h # # include/asm-m32r/signal.h # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/signal.h # # include/asm-m32r/siginfo.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/siginfo.h # # include/asm-m32r/sigcontext.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/sigcontext.h # # include/asm-m32r/shmparam.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/shmparam.h # # include/asm-m32r/shmbuf.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/shmbuf.h # # include/asm-m32r/setup.h # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/setup.h # # include/asm-m32r/serial.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/serial.h # # include/asm-m32r/sembuf.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +29 -0 # m32r architecture # # include/asm-m32r/semaphore.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +266 -0 # m32r architecture # # include/asm-m32r/segment.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +14 -0 # m32r architecture # # include/asm-m32r/sections.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +8 -0 # m32r architecture # # include/asm-m32r/scatterlist.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +18 -0 # m32r architecture # # include/asm-m32r/rtc.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +70 -0 # m32r architecture # # include/asm-m32r/resource.h # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +51 -0 # m32r architecture # # include/asm-m32r/ptrace.h # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +163 -0 # m32r architecture # # include/asm-m32r/processor.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +157 -0 # m32r architecture # # include/asm-m32r/posix_types.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +126 -0 # m32r architecture # # include/asm-m32r/poll.h # 2004/09/17 00:28:05-07:00 takata@linux-m32r.org +29 -0 # m32r architecture # # include/asm-m32r/pgtable.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +422 -0 # m32r architecture # # include/asm-m32r/pgtable-2level.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +77 -0 # m32r architecture # # include/asm-m32r/pgalloc.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +87 -0 # m32r architecture # # include/asm-m32r/percpu.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +6 -0 # m32r architecture # # include/asm-m32r/pci.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +10 -0 # m32r architecture # # include/asm-m32r/param.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +27 -0 # m32r architecture # # include/asm-m32r/page.h # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +112 -0 # m32r architecture # # include/asm-m32r/opsput/opsput_pld.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +259 -0 # m32r architecture # # include/asm-m32r/opsput/opsput_lcd.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +59 -0 # m32r architecture # # include/asm-m32r/opsput/opsput_lan.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +56 -0 # m32r architecture # # include/asm-m32r/numnodes.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +15 -0 # m32r architecture # # include/asm-m32r/namei.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +21 -0 # m32r architecture # # include/asm-m32r/msgbuf.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +35 -0 # m32r architecture # # include/asm-m32r/module.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +13 -0 # m32r architecture # # include/asm-m32r/mmzone.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +80 -0 # m32r architecture # # include/asm-m32r/mmu_context.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +169 -0 # m32r architecture # # include/asm-m32r/mmu.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +35 -0 # m32r architecture # # include/asm-m32r/mman.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +45 -0 # m32r architecture # # include/asm-m32r/mc146818rtc.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +32 -0 # m32r architecture # # include/asm-m32r/mappi2/mappi2_pld.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +151 -0 # m32r architecture # # include/asm-m32r/m32r_mp_fpga.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +313 -0 # m32r architecture # # include/asm-m32r/m32r.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +135 -0 # m32r architecture # # include/asm-m32r/m32700ut/m32700ut_pld.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +265 -0 # m32r architecture # # include/asm-m32r/m32700ut/m32700ut_lcd.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +59 -0 # m32r architecture # # include/asm-m32r/m32700ut/m32700ut_lan.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +107 -0 # m32r architecture # # include/asm-m32r/m32102peri.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +468 -0 # m32r architecture # # include/asm-m32r/m32102.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +265 -0 # m32r architecture # # include/asm-m32r/local.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +6 -0 # m32r architecture # # include/asm-m32r/linkage.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +7 -0 # m32r architecture # # include/asm-m32r/kmap_types.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +34 -0 # m32r architecture # # include/asm-m32r/irq.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +86 -0 # m32r architecture # # include/asm-m32r/ipcbuf.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +33 -0 # m32r architecture # # include/asm-m32r/ipc.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +35 -0 # m32r architecture # # include/asm-m32r/ioctls.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +88 -0 # m32r architecture # # include/asm-m32r/ioctl.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +78 -0 # m32r architecture # # include/asm-m32r/io.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +201 -0 # m32r architecture # # include/asm-m32r/init.h # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +1 -0 # m32r architecture # # include/asm-m32r/ide.h # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +71 -0 # m32r architecture # # include/asm-m32r/hw_irq.h # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +40 -0 # m32r architecture # # include/asm-m32r/hdreg.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +1 -0 # m32r architecture # # include/asm-m32r/hardirq.h # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +103 -0 # m32r architecture # # include/asm-m32r/flat.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +145 -0 # m32r architecture # # include/asm-m32r/fcntl.h # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +91 -0 # m32r architecture # # include/asm-m32r/errno.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +9 -0 # m32r architecture # # include/asm-m32r/elf.h # 2004/09/17 00:28:05-07:00 takata@linux-m32r.org +177 -0 # m32r architecture # # include/asm-m32r/dma.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +14 -0 # m32r architecture # # include/asm-m32r/dma-mapping.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +23 -0 # m32r architecture # # include/asm-m32r/div64.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +38 -0 # m32r architecture # # include/asm-m32r/delay.h # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +22 -0 # m32r architecture # # include/asm-m32r/current.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +18 -0 # m32r architecture # # include/asm-m32r/cpumask.h # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +7 -0 # m32r architecture # # include/asm-m32r/checksum.h # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +256 -0 # m32r architecture # # include/asm-m32r/cacheflush.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +68 -0 # m32r architecture # # include/asm-m32r/cachectl.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +26 -0 # m32r architecture # # include/asm-m32r/cache.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +12 -0 # m32r architecture # # include/asm-m32r/byteorder.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +19 -0 # m32r architecture # # include/asm-m32r/bugs.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +21 -0 # m32r architecture # # include/asm-m32r/bug.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +22 -0 # m32r architecture # # include/asm-m32r/bitops.h # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +712 -0 # m32r architecture # # include/asm-m32r/atomic.h # 2004/09/17 00:28:05-07:00 takata@linux-m32r.org +337 -0 # m32r architecture # # include/asm-m32r/assembler.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +212 -0 # m32r architecture # # include/asm-m32r/addrspace.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +58 -0 # m32r architecture # # include/asm-m32r/a.out.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +28 -0 # m32r architecture # # arch/m32r/opsput/dot.gdbinit # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +180 -0 # m32r architecture # # arch/m32r/opsput/defconfig.opsput # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +588 -0 # m32r architecture # # arch/m32r/oprofile/init.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +25 -0 # m32r architecture # # arch/m32r/oprofile/Makefile # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +9 -0 # m32r architecture # # arch/m32r/oprofile/Kconfig # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +23 -0 # m32r architecture # # arch/m32r/oaks32r/dot.gdbinit.nommu # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +155 -0 # m32r architecture # # arch/m32r/oaks32r/defconfig.nommu # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +514 -0 # m32r architecture # # arch/m32r/mm/page.S # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +82 -0 # m32r architecture # # arch/m32r/mm/mmu.S # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +350 -0 # m32r architecture # # arch/m32r/mm/ioremap.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +188 -0 # m32r architecture # # arch/m32r/mm/ioremap-nommu.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +51 -0 # m32r architecture # # arch/m32r/mm/init.c # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +251 -0 # m32r architecture # # arch/m32r/mm/fault.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +553 -0 # m32r architecture # # arch/m32r/mm/fault-nommu.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +164 -0 # m32r architecture # # arch/m32r/mm/extable.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +22 -0 # m32r architecture # # arch/m32r/mm/discontig.c # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +170 -0 # m32r architecture # # arch/m32r/mm/cache.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +68 -0 # m32r architecture # # arch/m32r/mm/Makefile # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +12 -0 # m32r architecture # # arch/m32r/mappi/dot.gdbinit # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +242 -0 # m32r architecture # # arch/m32r/mappi/dot.gdbinit.smp # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +344 -0 # m32r architecture # # arch/m32r/mappi/dot.gdbinit.nommu # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +245 -0 # m32r architecture # # arch/m32r/mappi/defconfig.up # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +614 -0 # m32r architecture # # arch/m32r/mappi/defconfig.smp # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +618 -0 # m32r architecture # # arch/m32r/mappi/defconfig.nommu # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +522 -0 # m32r architecture # # arch/m32r/m32700ut/m32r-flash.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +227 -0 # m32r architecture # # arch/m32r/m32700ut/dot.gdbinit_300MHz_32MB # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +249 -0 # m32r architecture # # arch/m32r/m32700ut/dot.gdbinit_200MHz_16MB # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +249 -0 # m32r architecture # # arch/m32r/m32700ut/defconfig.m32700ut.up # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +647 -0 # m32r architecture # # arch/m32r/m32700ut/defconfig.m32700ut.smp # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +649 -0 # m32r architecture # # arch/m32r/lib/usercopy.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +391 -0 # m32r architecture # # arch/m32r/lib/strlen.S # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +120 -0 # m32r architecture # # arch/m32r/lib/putuser.S # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +84 -0 # m32r architecture # # arch/m32r/lib/memset.S # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +178 -0 # m32r architecture # # arch/m32r/lib/memcpy.S # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +95 -0 # m32r architecture # # arch/m32r/lib/getuser.S # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +88 -0 # m32r architecture # # arch/m32r/lib/delay.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +124 -0 # m32r architecture # # arch/m32r/lib/csum_partial_copy.c # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +77 -0 # m32r architecture # # arch/m32r/lib/checksum.S # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +322 -0 # m32r architecture # # arch/m32r/lib/ashxdi3.S # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +297 -0 # m32r architecture # # arch/m32r/lib/Makefile # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +7 -0 # m32r architecture # # arch/m32r/kernel/vmlinux.lds.S # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +160 -0 # m32r architecture # # arch/m32r/kernel/traps.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +383 -0 # m32r architecture # # arch/m32r/kernel/time.c # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +318 -0 # m32r architecture # # arch/m32r/kernel/sys_m32r.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +281 -0 # m32r architecture # # arch/m32r/kernel/smpboot.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +660 -0 # m32r architecture # # arch/m32r/kernel/smp.c # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +940 -0 # m32r architecture # # arch/m32r/kernel/signal.c # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +620 -0 # m32r architecture # # arch/m32r/kernel/setup_usrv.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +260 -0 # m32r architecture # # arch/m32r/kernel/setup_opsput.c # 2004/09/17 00:28:03-07:00 takata@linux-m32r.org +454 -0 # m32r architecture # # arch/m32r/kernel/setup_oaks32r.c # 2004/09/17 00:28:02-07:00 takata@linux-m32r.org +147 -0 # m32r architecture # # arch/m32r/kernel/setup_mappi2.c # 2004/09/17 00:28:03-07:00 takata@linux-m32r.org +186 -0 # m32r architecture # # arch/m32r/kernel/setup_mappi.c # 2004/09/17 00:28:02-07:00 takata@linux-m32r.org +164 -0 # m32r architecture # # arch/m32r/kernel/setup_m32700ut.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +453 -0 # m32r architecture # # arch/m32r/kernel/setup.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +404 -0 # m32r architecture # # arch/m32r/kernel/semaphore.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +186 -0 # m32r architecture # # arch/m32r/kernel/ptrace.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +828 -0 # m32r architecture # # arch/m32r/kernel/process.c # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +357 -0 # m32r architecture # # arch/m32r/kernel/module.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +253 -0 # m32r architecture # # arch/m32r/kernel/m32r_ksyms.c # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +143 -0 # m32r architecture # # arch/m32r/kernel/irq.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +1019 -0 # m32r architecture # # arch/m32r/kernel/io_usrv.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +247 -0 # m32r architecture # # arch/m32r/kernel/io_opsput.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +377 -0 # m32r architecture # # arch/m32r/kernel/io_oaks32r.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +243 -0 # m32r architecture # # arch/m32r/kernel/io_mappi2.c # 2004/09/17 00:28:03-07:00 takata@linux-m32r.org +367 -0 # m32r architecture # # arch/m32r/kernel/io_mappi.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +368 -0 # m32r architecture # # arch/m32r/kernel/io_m32700ut.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +377 -0 # m32r architecture # # arch/m32r/kernel/io_m32102.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +277 -0 # m32r architecture # # arch/m32r/kernel/init_task.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +40 -0 # m32r architecture # # arch/m32r/kernel/head.S # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +286 -0 # m32r architecture # # arch/m32r/kernel/entry.S # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +993 -0 # m32r architecture # # arch/m32r/kernel/align.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +585 -0 # m32r architecture # # arch/m32r/kernel/Makefile # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +20 -0 # m32r architecture # # arch/m32r/drivers/smc91111.readme.txt # 2004/09/17 00:28:03-07:00 takata@linux-m32r.org +561 -0 # m32r architecture # # arch/m32r/drivers/smc91111.h # 2004/09/17 00:28:03-07:00 takata@linux-m32r.org +570 -0 # m32r architecture # # arch/m32r/drivers/smc91111.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +3896 -0 # m32r architecture # # arch/m32r/drivers/smc91111.copying # 2004/09/17 00:28:03-07:00 takata@linux-m32r.org +352 -0 # m32r architecture # # arch/m32r/drivers/mappi_ne.c # 2004/09/17 00:28:03-07:00 takata@linux-m32r.org +861 -0 # m32r architecture # # arch/m32r/drivers/m5drv.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +664 -0 # m32r architecture # # arch/m32r/drivers/m5.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +73 -0 # m32r architecture # # arch/m32r/drivers/m5.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +913 -0 # m32r architecture # # arch/m32r/drivers/m32r_pcc.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +70 -0 # m32r architecture # # arch/m32r/drivers/m32r_pcc.c # 2004/09/17 00:28:05-07:00 takata@linux-m32r.org +818 -0 # m32r architecture # # arch/m32r/drivers/m32r_cfc.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +85 -0 # m32r architecture # # arch/m32r/drivers/m32r_cfc.c # 2004/09/17 00:28:05-07:00 takata@linux-m32r.org +910 -0 # m32r architecture # # arch/m32r/drivers/m32r-pldsio.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +3067 -0 # m32r architecture # # arch/m32r/drivers/ds1302.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +432 -0 # m32r architecture # # arch/m32r/drivers/cs_internal.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +2 -0 # m32r architecture # # arch/m32r/drivers/Makefile # 2004/09/17 00:28:03-07:00 takata@linux-m32r.org +9 -0 # m32r architecture # # arch/m32r/drivers/Kconfig # 2004/09/17 00:28:03-07:00 takata@linux-m32r.org +42 -0 # m32r architecture # # arch/m32r/drivers/8390.h # 2004/09/17 00:28:03-07:00 takata@linux-m32r.org +1 -0 # m32r architecture # # arch/m32r/drivers/8390.c # 2004/09/17 00:28:03-07:00 takata@linux-m32r.org +1 -0 # m32r architecture # # arch/m32r/defconfig # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +622 -0 # m32r architecture # # arch/m32r/boot/setup.S # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +217 -0 # m32r architecture # # arch/m32r/boot/compressed/vmlinux.scr # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +9 -0 # m32r architecture # # arch/m32r/boot/compressed/vmlinux.lds.S # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +25 -0 # m32r architecture # # arch/m32r/boot/compressed/misc.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +224 -0 # m32r architecture # # arch/m32r/boot/compressed/m32r_sio.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +50 -0 # m32r architecture # # arch/m32r/boot/compressed/install.sh # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +57 -0 # m32r architecture # # arch/m32r/boot/compressed/head.S # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +202 -0 # m32r architecture # # arch/m32r/boot/compressed/Makefile # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +37 -0 # m32r architecture # # arch/m32r/boot/Makefile # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +19 -0 # m32r architecture # # arch/m32r/Makefile # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +38 -0 # m32r architecture # # arch/m32r/Kconfig # 2004/09/17 00:28:02-07:00 takata@linux-m32r.org +621 -0 # m32r architecture # # include/asm-m32r/sembuf.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/sembuf.h # # include/asm-m32r/semaphore.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/semaphore.h # # include/asm-m32r/segment.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/segment.h # # include/asm-m32r/sections.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/sections.h # # include/asm-m32r/scatterlist.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/scatterlist.h # # include/asm-m32r/rtc.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/rtc.h # # include/asm-m32r/resource.h # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/resource.h # # include/asm-m32r/ptrace.h # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/ptrace.h # # include/asm-m32r/processor.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/processor.h # # include/asm-m32r/posix_types.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/posix_types.h # # include/asm-m32r/poll.h # 2004/09/17 00:28:05-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/poll.h # # include/asm-m32r/pgtable.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/pgtable.h # # include/asm-m32r/pgtable-2level.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/pgtable-2level.h # # include/asm-m32r/pgalloc.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/pgalloc.h # # include/asm-m32r/percpu.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/percpu.h # # include/asm-m32r/pci.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/pci.h # # include/asm-m32r/param.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/param.h # # include/asm-m32r/page.h # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/page.h # # include/asm-m32r/opsput/opsput_pld.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/opsput/opsput_pld.h # # include/asm-m32r/opsput/opsput_lcd.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/opsput/opsput_lcd.h # # include/asm-m32r/opsput/opsput_lan.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/opsput/opsput_lan.h # # include/asm-m32r/numnodes.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/numnodes.h # # include/asm-m32r/namei.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/namei.h # # include/asm-m32r/msgbuf.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/msgbuf.h # # include/asm-m32r/module.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/module.h # # include/asm-m32r/mmzone.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/mmzone.h # # include/asm-m32r/mmu_context.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/mmu_context.h # # include/asm-m32r/mmu.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/mmu.h # # include/asm-m32r/mman.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/mman.h # # include/asm-m32r/mc146818rtc.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/mc146818rtc.h # # include/asm-m32r/mappi2/mappi2_pld.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/mappi2/mappi2_pld.h # # include/asm-m32r/m32r_mp_fpga.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/m32r_mp_fpga.h # # include/asm-m32r/m32r.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/m32r.h # # include/asm-m32r/m32700ut/m32700ut_pld.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/m32700ut/m32700ut_pld.h # # include/asm-m32r/m32700ut/m32700ut_lcd.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/m32700ut/m32700ut_lcd.h # # include/asm-m32r/m32700ut/m32700ut_lan.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/m32700ut/m32700ut_lan.h # # include/asm-m32r/m32102peri.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/m32102peri.h # # include/asm-m32r/m32102.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/m32102.h # # include/asm-m32r/local.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/local.h # # include/asm-m32r/linkage.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/linkage.h # # include/asm-m32r/kmap_types.h # 2004/09/17 00:06:57-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/kmap_types.h # # include/asm-m32r/irq.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/irq.h # # include/asm-m32r/ipcbuf.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/ipcbuf.h # # include/asm-m32r/ipc.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/ipc.h # # include/asm-m32r/ioctls.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/ioctls.h # # include/asm-m32r/ioctl.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/ioctl.h # # include/asm-m32r/io.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/io.h # # include/asm-m32r/init.h # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/init.h # # include/asm-m32r/ide.h # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/ide.h # # include/asm-m32r/hw_irq.h # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/hw_irq.h # # include/asm-m32r/hdreg.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/hdreg.h # # include/asm-m32r/hardirq.h # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/hardirq.h # # include/asm-m32r/flat.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/flat.h # # include/asm-m32r/fcntl.h # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/fcntl.h # # include/asm-m32r/errno.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/errno.h # # include/asm-m32r/elf.h # 2004/09/17 00:28:05-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/elf.h # # include/asm-m32r/dma.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/dma.h # # include/asm-m32r/dma-mapping.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/dma-mapping.h # # include/asm-m32r/div64.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/div64.h # # include/asm-m32r/delay.h # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/delay.h # # include/asm-m32r/current.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/current.h # # include/asm-m32r/cpumask.h # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/cpumask.h # # include/asm-m32r/checksum.h # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/checksum.h # # include/asm-m32r/cacheflush.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/cacheflush.h # # include/asm-m32r/cachectl.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/cachectl.h # # include/asm-m32r/cache.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/cache.h # # include/asm-m32r/byteorder.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/byteorder.h # # include/asm-m32r/bugs.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/bugs.h # # include/asm-m32r/bug.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/bug.h # # include/asm-m32r/bitops.h # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/bitops.h # # include/asm-m32r/atomic.h # 2004/09/17 00:28:05-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/atomic.h # # include/asm-m32r/assembler.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/assembler.h # # include/asm-m32r/addrspace.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/addrspace.h # # include/asm-m32r/a.out.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-m32r/a.out.h # # arch/m32r/opsput/dot.gdbinit # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/opsput/dot.gdbinit # # arch/m32r/opsput/defconfig.opsput # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/opsput/defconfig.opsput # # arch/m32r/oprofile/init.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/oprofile/init.c # # arch/m32r/oprofile/Makefile # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/oprofile/Makefile # # arch/m32r/oprofile/Kconfig # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/oprofile/Kconfig # # arch/m32r/oaks32r/dot.gdbinit.nommu # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/oaks32r/dot.gdbinit.nommu # # arch/m32r/oaks32r/defconfig.nommu # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/oaks32r/defconfig.nommu # # arch/m32r/mm/page.S # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/mm/page.S # # arch/m32r/mm/mmu.S # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/mm/mmu.S # # arch/m32r/mm/ioremap.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/mm/ioremap.c # # arch/m32r/mm/ioremap-nommu.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/mm/ioremap-nommu.c # # arch/m32r/mm/init.c # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/mm/init.c # # arch/m32r/mm/fault.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/mm/fault.c # # arch/m32r/mm/fault-nommu.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/mm/fault-nommu.c # # arch/m32r/mm/extable.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/mm/extable.c # # arch/m32r/mm/discontig.c # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/mm/discontig.c # # arch/m32r/mm/cache.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/mm/cache.c # # arch/m32r/mm/Makefile # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/mm/Makefile # # arch/m32r/mappi/dot.gdbinit # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/mappi/dot.gdbinit # # arch/m32r/mappi/dot.gdbinit.smp # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/mappi/dot.gdbinit.smp # # arch/m32r/mappi/dot.gdbinit.nommu # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/mappi/dot.gdbinit.nommu # # arch/m32r/mappi/defconfig.up # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/mappi/defconfig.up # # arch/m32r/mappi/defconfig.smp # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/mappi/defconfig.smp # # arch/m32r/mappi/defconfig.nommu # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/mappi/defconfig.nommu # # arch/m32r/m32700ut/m32r-flash.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/m32700ut/m32r-flash.c # # arch/m32r/m32700ut/dot.gdbinit_300MHz_32MB # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/m32700ut/dot.gdbinit_300MHz_32MB # # arch/m32r/m32700ut/dot.gdbinit_200MHz_16MB # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/m32700ut/dot.gdbinit_200MHz_16MB # # arch/m32r/m32700ut/defconfig.m32700ut.up # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/m32700ut/defconfig.m32700ut.up # # arch/m32r/m32700ut/defconfig.m32700ut.smp # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/m32700ut/defconfig.m32700ut.smp # # arch/m32r/lib/usercopy.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/lib/usercopy.c # # arch/m32r/lib/strlen.S # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/lib/strlen.S # # arch/m32r/lib/putuser.S # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/lib/putuser.S # # arch/m32r/lib/memset.S # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/lib/memset.S # # arch/m32r/lib/memcpy.S # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/lib/memcpy.S # # arch/m32r/lib/getuser.S # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/lib/getuser.S # # arch/m32r/lib/delay.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/lib/delay.c # # arch/m32r/lib/csum_partial_copy.c # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/lib/csum_partial_copy.c # # arch/m32r/lib/checksum.S # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/lib/checksum.S # # arch/m32r/lib/ashxdi3.S # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/lib/ashxdi3.S # # arch/m32r/lib/Makefile # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/lib/Makefile # # arch/m32r/kernel/vmlinux.lds.S # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/vmlinux.lds.S # # arch/m32r/kernel/traps.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/traps.c # # arch/m32r/kernel/time.c # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/time.c # # arch/m32r/kernel/sys_m32r.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/sys_m32r.c # # arch/m32r/kernel/smpboot.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/smpboot.c # # arch/m32r/kernel/smp.c # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/smp.c # # arch/m32r/kernel/signal.c # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/signal.c # # arch/m32r/kernel/setup_usrv.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/setup_usrv.c # # arch/m32r/kernel/setup_opsput.c # 2004/09/17 00:28:03-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/setup_opsput.c # # arch/m32r/kernel/setup_oaks32r.c # 2004/09/17 00:28:02-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/setup_oaks32r.c # # arch/m32r/kernel/setup_mappi2.c # 2004/09/17 00:28:03-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/setup_mappi2.c # # arch/m32r/kernel/setup_mappi.c # 2004/09/17 00:28:02-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/setup_mappi.c # # arch/m32r/kernel/setup_m32700ut.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/setup_m32700ut.c # # arch/m32r/kernel/setup.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/setup.c # # arch/m32r/kernel/semaphore.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/semaphore.c # # arch/m32r/kernel/ptrace.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/ptrace.c # # arch/m32r/kernel/process.c # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/process.c # # arch/m32r/kernel/module.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/module.c # # arch/m32r/kernel/m32r_ksyms.c # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/m32r_ksyms.c # # arch/m32r/kernel/irq.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/irq.c # # arch/m32r/kernel/io_usrv.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/io_usrv.c # # arch/m32r/kernel/io_opsput.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/io_opsput.c # # arch/m32r/kernel/io_oaks32r.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/io_oaks32r.c # # arch/m32r/kernel/io_mappi2.c # 2004/09/17 00:28:03-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/io_mappi2.c # # arch/m32r/kernel/io_mappi.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/io_mappi.c # # arch/m32r/kernel/io_m32700ut.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/io_m32700ut.c # # arch/m32r/kernel/io_m32102.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/io_m32102.c # # arch/m32r/kernel/init_task.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/init_task.c # # arch/m32r/kernel/head.S # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/head.S # # arch/m32r/kernel/entry.S # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/entry.S # # arch/m32r/kernel/align.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/align.c # # arch/m32r/kernel/Makefile # 2004/09/17 00:28:06-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/kernel/Makefile # # arch/m32r/drivers/smc91111.readme.txt # 2004/09/17 00:28:03-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/drivers/smc91111.readme.txt # # arch/m32r/drivers/smc91111.h # 2004/09/17 00:28:03-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/drivers/smc91111.h # # arch/m32r/drivers/smc91111.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/drivers/smc91111.c # # arch/m32r/drivers/smc91111.copying # 2004/09/17 00:28:03-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/drivers/smc91111.copying # # arch/m32r/drivers/mappi_ne.c # 2004/09/17 00:28:03-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/drivers/mappi_ne.c # # arch/m32r/drivers/m5drv.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/drivers/m5drv.c # # arch/m32r/drivers/m5.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/drivers/m5.h # # arch/m32r/drivers/m5.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/drivers/m5.c # # arch/m32r/drivers/m32r_pcc.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/drivers/m32r_pcc.h # # arch/m32r/drivers/m32r_pcc.c # 2004/09/17 00:28:05-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/drivers/m32r_pcc.c # # arch/m32r/drivers/m32r_cfc.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/drivers/m32r_cfc.h # # arch/m32r/drivers/m32r_cfc.c # 2004/09/17 00:28:05-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/drivers/m32r_cfc.c # # arch/m32r/drivers/m32r-pldsio.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/drivers/m32r-pldsio.c # # arch/m32r/drivers/ds1302.c # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/drivers/ds1302.c # # arch/m32r/drivers/cs_internal.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/drivers/cs_internal.h # # arch/m32r/drivers/Makefile # 2004/09/17 00:28:03-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/drivers/Makefile # # arch/m32r/drivers/Kconfig # 2004/09/17 00:28:03-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/drivers/Kconfig # # arch/m32r/drivers/8390.h # 2004/09/17 00:28:03-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/drivers/8390.h # # arch/m32r/drivers/8390.c # 2004/09/17 00:28:03-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/drivers/8390.c # # arch/m32r/defconfig # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/defconfig # # arch/m32r/boot/setup.S # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/boot/setup.S # # arch/m32r/boot/compressed/vmlinux.scr # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/boot/compressed/vmlinux.scr # # arch/m32r/boot/compressed/vmlinux.lds.S # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/boot/compressed/vmlinux.lds.S # # arch/m32r/boot/compressed/misc.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/boot/compressed/misc.c # # arch/m32r/boot/compressed/m32r_sio.c # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/boot/compressed/m32r_sio.c # # arch/m32r/boot/compressed/install.sh # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/boot/compressed/install.sh # # arch/m32r/boot/compressed/head.S # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/boot/compressed/head.S # # arch/m32r/boot/compressed/boot.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +59 -0 # m32r architecture # # arch/m32r/boot/compressed/Makefile # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/boot/compressed/Makefile # # arch/m32r/boot/Makefile # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/boot/Makefile # # arch/m32r/Makefile # 2004/09/17 00:28:04-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/Makefile # # arch/m32r/Kconfig # 2004/09/17 00:28:02-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/Kconfig # # arch/m32r/boot/compressed/boot.h # 2004/09/17 00:06:56-07:00 takata@linux-m32r.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/m32r/boot/compressed/boot.h # # ChangeSet # 2004/09/17 12:03:36-07:00 alan@redhat.com # [PATCH] serial-cs and unusable port size ranges # # A couple of GSM GPRS PCMCIA cards advertise 16 rather than 8 port sized # windows for their serial interface. This breaks our current pcmcia serial # driver which ignores any windows that are not 8 bytes. # # To avoid any regressions on other cards given this driver contains a # certain amount of "magic" the patch below looks for 8 byte windows first so # will not break existing supported cards (I hope ;)) # # Patch-by: Alan Cox # OSDL Developer Certiticate Of Origin included herein by reference # # Acked by Russell King # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/serial/serial_cs.c # 2004/09/17 00:06:56-07:00 alan@redhat.com +24 -21 # serial-cs and unusable port size ranges # # ChangeSet # 2004/09/17 12:03:20-07:00 saw@saw.sw.com.sg # [PATCH] fix for fsync ignoring writing errors # # Currently metadata writing errors are ignored and not returned from # sys_fsync on ext2 and ext3 filesystems. That is, at least ext2 and ext3. # # Both ext2 and ext3 resort to sync_inode() in their ->sync_inode method, # which in turn calls ->write_inode. ->write_inode method has void type, and # any IO errors happening inside are lost. # # Make ->write_inode return the error code? # # Signed-off-by: Andrey Savochkin # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/linux/ufs_fs.h # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +1 -1 # fix for fsync ignoring writing errors # # include/linux/reiserfs_fs.h # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +1 -1 # fix for fsync ignoring writing errors # # include/linux/msdos_fs.h # 2004/09/16 23:58:43-07:00 saw@saw.sw.com.sg +1 -1 # fix for fsync ignoring writing errors # # include/linux/fs.h # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +1 -1 # fix for fsync ignoring writing errors # # include/linux/ext3_fs.h # 2004/09/16 23:58:43-07:00 saw@saw.sw.com.sg +1 -1 # fix for fsync ignoring writing errors # # include/linux/affs_fs.h # 2004/09/16 23:58:43-07:00 saw@saw.sw.com.sg +1 -1 # fix for fsync ignoring writing errors # # fs/xfs/linux-2.6/xfs_super.c # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +3 -1 # fix for fsync ignoring writing errors # # fs/umsdos/inode.c # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +4 -2 # fix for fsync ignoring writing errors # # fs/ufs/inode.c # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +4 -2 # fix for fsync ignoring writing errors # # fs/udf/udfdecl.h # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +1 -1 # fix for fsync ignoring writing errors # # fs/udf/inode.c # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +4 -2 # fix for fsync ignoring writing errors # # fs/sysv/sysv.h # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +1 -1 # fix for fsync ignoring writing errors # # fs/sysv/inode.c # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +2 -1 # fix for fsync ignoring writing errors # # fs/reiserfs/inode.c # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +3 -2 # fix for fsync ignoring writing errors # # fs/qnx4/inode.c # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +5 -4 # fix for fsync ignoring writing errors # # fs/ntfs/super.c # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +1 -1 # fix for fsync ignoring writing errors # # fs/ntfs/inode.h # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +0 -1 # fix for fsync ignoring writing errors # # fs/ntfs/inode.c # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +0 -24 # fix for fsync ignoring writing errors # # fs/nfs/inode.c # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +7 -3 # fix for fsync ignoring writing errors # # fs/minix/inode.c # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +3 -2 # fix for fsync ignoring writing errors # # fs/jfs/super.c # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +1 -1 # fix for fsync ignoring writing errors # # fs/jfs/inode.c # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +6 -4 # fix for fsync ignoring writing errors # # fs/hfsplus/super.c # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +5 -4 # fix for fsync ignoring writing errors # # fs/hfsplus/inode.c # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +5 -4 # fix for fsync ignoring writing errors # # fs/hfsplus/hfsplus_fs.h # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +1 -1 # fix for fsync ignoring writing errors # # fs/hfs/inode.c # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +8 -7 # fix for fsync ignoring writing errors # # fs/hfs/hfs_fs.h # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +1 -1 # fix for fsync ignoring writing errors # # fs/fs-writeback.c # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +8 -4 # fix for fsync ignoring writing errors # # fs/fat/inode.c # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +4 -3 # fix for fsync ignoring writing errors # # fs/ext3/inode.c # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +5 -5 # fix for fsync ignoring writing errors # # fs/ext2/inode.c # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +2 -2 # fix for fsync ignoring writing errors # # fs/ext2/ext2.h # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +1 -1 # fix for fsync ignoring writing errors # # fs/bfs/inode.c # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +4 -3 # fix for fsync ignoring writing errors # # fs/affs/inode.c # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +4 -3 # fix for fsync ignoring writing errors # # fs/adfs/inode.c # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +4 -2 # fix for fsync ignoring writing errors # # fs/adfs/adfs.h # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +1 -1 # fix for fsync ignoring writing errors # # Documentation/filesystems/vfs.txt # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +1 -1 # fix for fsync ignoring writing errors # # Documentation/filesystems/Locking # 2004/09/16 23:58:42-07:00 saw@saw.sw.com.sg +1 -1 # fix for fsync ignoring writing errors # # ChangeSet # 2004/09/17 12:03:06-07:00 ak@muc.de # [PATCH] x86-64: copy ioperm bitmaps more efficiently at context switch # # Copy ioperm bitmaps more efficiently at context switch time. Only copy # upto the highest used port. # # Originally from Ingo Molnar # # Signed-off-by: Andi Kleen # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-x86_64/processor.h # 2004/09/16 23:58:42-07:00 ak@muc.de +1 -0 # x86-64: copy ioperm bitmaps more efficiently at context switch # # arch/x86_64/kernel/setup64.c # 2004/09/16 23:58:42-07:00 ak@muc.de +5 -3 # x86-64: copy ioperm bitmaps more efficiently at context switch # # arch/x86_64/kernel/process.c # 2004/09/17 00:28:01-07:00 ak@muc.de +25 -19 # x86-64: copy ioperm bitmaps more efficiently at context switch # # arch/x86_64/kernel/ioport.c # 2004/09/16 23:58:42-07:00 ak@muc.de +26 -8 # x86-64: copy ioperm bitmaps more efficiently at context switch # # ChangeSet # 2004/09/17 12:02:51-07:00 ak@muc.de # [PATCH] x86-64: turn tss into per cpu data # # Turn per cpu TSS into per cpu data. # # Signed-off-by: Andi Kleen # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-x86_64/processor.h # 2004/09/17 00:28:10-07:00 ak@muc.de +4 -3 # x86-64: turn tss into per cpu data # # arch/x86_64/kernel/traps.c # 2004/09/16 23:58:42-07:00 ak@muc.de +3 -2 # x86-64: turn tss into per cpu data # # arch/x86_64/kernel/suspend.c # 2004/09/16 23:58:42-07:00 ak@muc.de +1 -1 # x86-64: turn tss into per cpu data # # arch/x86_64/kernel/smpboot.c # 2004/09/16 23:58:42-07:00 ak@muc.de +1 -1 # x86-64: turn tss into per cpu data # # arch/x86_64/kernel/setup64.c # 2004/09/17 00:28:10-07:00 ak@muc.de +1 -1 # x86-64: turn tss into per cpu data # # arch/x86_64/kernel/process.c # 2004/09/17 00:28:10-07:00 ak@muc.de +2 -2 # x86-64: turn tss into per cpu data # # arch/x86_64/kernel/ioport.c # 2004/09/17 00:28:10-07:00 ak@muc.de +1 -1 # x86-64: turn tss into per cpu data # # arch/x86_64/kernel/init_task.c # 2004/09/16 23:58:42-07:00 ak@muc.de +1 -2 # x86-64: turn tss into per cpu data # # ChangeSet # 2004/09/17 12:02:38-07:00 ak@muc.de # [PATCH] x86-64, x86: don't pass CR2 on alignment faults # # Don't pass CR2 address on alignment faults. They report the address of the # last page fault, which is a information leak. # # Fix this for i386 and x86-64 by passing 0 instead. # # Pointed out by Zachary Amsden # # Signed-off-by: Andi Kleen # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/x86_64/kernel/traps.c # 2004/09/17 00:28:10-07:00 ak@muc.de +1 -1 # x86-64, x86: don't pass CR2 on alignment faults # # arch/i386/kernel/traps.c # 2004/09/16 23:58:41-07:00 ak@muc.de +1 -1 # x86-64, x86: don't pass CR2 on alignment faults # # ChangeSet # 2004/09/17 12:02:24-07:00 ak@muc.de # [PATCH] x86-64: add read implies exec macro # # Add read implies exec personality. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-x86_64/elf.h # 2004/09/16 23:58:41-07:00 ak@muc.de +7 -0 # x86-64: add read implies exec macro # # ChangeSet # 2004/09/17 12:02:13-07:00 ak@muc.de # [PATCH] x86-64: synchronize video.S with i386 # # Sync x86-64 video.S with i386 changes # # Signed-off-by: Andi Kleen # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/x86_64/boot/video.S # 2004/09/16 23:58:41-07:00 ak@muc.de +84 -2 # x86-64: synchronize video.S with i386 # # ChangeSet # 2004/09/17 12:01:58-07:00 ak@muc.de # [PATCH] x86-64: sibling map fix for clustered mode # # From: James Cleverdon # # The value that cpuinfo returns for command 1 in ebx is the physical APIC ID # latched when the system comes out of reset. # # Ordinarily, this is identical to the value in the local APIC's ID register, # because nearly all BIOSes accept the HW assigned value. # # Our systems, made up of individual building blocks, can't do that. Each # node boots as a separate system and is joined together by the BIOS. Thus, # the BIOS rewrites the local APIC ID register with a new value. # # Potomac and Nocona chips have a mechanism by which the BIOS writer can # change bits 7:5 to match the assigned cluster ID. Bits 2:0 come from the # thread ID. However, bits 4:3 are still those latched at reset. Oops! # # Summary: Large clustered systems can't use cpuid to derive the sibling # information. # # Fix: Use the local APIC ID. That's the value we use to online the CPUs, so # it had better be OK. For non-clustered systems, cpuid == local APIC, so # nothing but large boxes should be affected. # # Signed-off-by: Andi Kleen # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/x86_64/kernel/setup.c # 2004/09/16 23:58:41-07:00 ak@muc.de +1 -1 # x86-64: sibling map fix for clustered mode # # ChangeSet # 2004/09/17 12:01:45-07:00 ak@muc.de # [PATCH] x86-64: fix for mem= on NUMA systems # # Fix bug that caused oops with mem= on certain NUMA configurations # # Signed-off-by: Andi Kleen # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/x86_64/mm/k8topology.c # 2004/09/16 23:58:41-07:00 ak@muc.de +2 -2 # x86-64: fix for mem= on NUMA systems # # ChangeSet # 2004/09/17 12:01:30-07:00 ak@muc.de # [PATCH] x86-64: add might_sleeps to more *_user functions # # Add might_sleep to more *_user functions. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/x86_64/lib/usercopy.c # 2004/09/16 23:58:41-07:00 ak@muc.de +2 -0 # x86-64: add might_sleeps to more *_user functions # # arch/x86_64/lib/csum-wrappers.c # 2004/09/16 23:58:41-07:00 ak@muc.de +2 -0 # x86-64: add might_sleeps to more *_user functions # # ChangeSet # 2004/09/17 12:01:19-07:00 ak@muc.de # [PATCH] x86-64: print mce bank enable mask in hex # # Print mce bank enable mask in sysfs in hex # # Signed-off-by: Andi Kleen # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/x86_64/kernel/mce.c # 2004/09/16 23:58:41-07:00 ak@muc.de +1 -1 # x86-64: print mce bank enable mask in hex # # ChangeSet # 2004/09/17 12:01:06-07:00 ak@muc.de # [PATCH] x86-64: remove WARN_ON in smp_call_function # # Remove WARN_ON in smp_call_function. it breaks the machine check # handling and there is no good way to enable interrupts here. # # Call Trace:{smp_call_function+115} {smp_send_stop+25} # {panic+274} {do_machine_check+0} # {do_machine_check+1114} {machine_check+127} # {net_rx_action+215} {__do_softirq+83} # {do_softirq+53} {do_IRQ+317} # <{default_idle+0} {ret_from_intr+0} # {default_idle+32} {cpu_idle+26} # {start_kernel+502} {_sinittext+48 # # Signed-off-by: Andi Kleen # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/x86_64/kernel/smp.c # 2004/09/16 23:58:40-07:00 ak@muc.de +1 -3 # x86-64: remove WARN_ON in smp_call_function # # ChangeSet # 2004/09/17 12:00:51-07:00 ak@muc.de # [PATCH] x86-64: make machine check handler configurable # # Make the x86-64 machine check handler configurable when EMBEDDED # # Signed-off-by: Andi Kleen # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/x86_64/Kconfig # 2004/09/16 23:58:40-07:00 ak@muc.de +6 -1 # x86-64: make machine check handler configurable # # ChangeSet # 2004/09/17 12:00:40-07:00 ak@muc.de # [PATCH] x86-64: IO-APIC suspend/resume # # Do IO-APIC suspend/resume. # # Untested so far. # # Signed-off-by: Andi Kleen # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/x86_64/kernel/io_apic.c # 2004/09/16 23:58:40-07:00 ak@muc.de +93 -0 # x86-64: IO-APIC suspend/resume # # ChangeSet # 2004/09/17 12:00:27-07:00 ak@muc.de # [PATCH] x86-64: avoid panic when APIC ID cannot be set # # Don't panic when io apic id cannot be set. # # Signed-off-by: Andi Kleen # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/x86_64/kernel/io_apic.c # 2004/09/17 00:28:12-07:00 ak@muc.de +1 -1 # x86-64: avoid panic when APIC ID cannot be set # # ChangeSet # 2004/09/17 12:00:12-07:00 ak@muc.de # [PATCH] x86-64: avoid deadlock in page fault handler # # Avoid deadlock when kernel fault happens inside mmap sem. # # Signed-off-by: Andi Kleen # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/x86_64/mm/fault.c # 2004/09/16 23:58:40-07:00 ak@muc.de +21 -1 # x86-64: avoid deadlock in page fault handler # # ChangeSet # 2004/09/17 11:59:59-07:00 ak@muc.de # [PATCH] x86-64: update defconfig # # Update x86-64 defconfig # # Signed-off-by: Andi Kleen # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/x86_64/defconfig # 2004/09/16 23:58:40-07:00 ak@muc.de +46 -55 # x86-64: update defconfig # # ChangeSet # 2004/09/17 11:59:44-07:00 ak@muc.de # [PATCH] x86-64: add apic={verbose,quiet,debug} # # Ported from i386 # # Allow to quieten apic boot output on the command line using # apic={verbose,debug,quiet} # # Make it quiet by default # # Add extra #define for making apic print functions __init or not # __init (for easier debugging) # # Signed-off-by: Andi Kleen # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-x86_64/apic.h # 2004/09/16 23:58:40-07:00 ak@muc.de +21 -7 # x86-64: add apic={verbose,quiet,debug} # # arch/x86_64/kernel/io_apic.c # 2004/09/17 00:28:12-07:00 ak@muc.de +50 -40 # x86-64: add apic={verbose,quiet,debug} # # arch/x86_64/kernel/apic.c # 2004/09/16 23:58:40-07:00 ak@muc.de +38 -19 # x86-64: add apic={verbose,quiet,debug} # # ChangeSet # 2004/09/17 11:59:31-07:00 ak@muc.de # [PATCH] x86-64: make APIC errors KERN_DEBUG # # Make APIC errors KERN_DEBUG # # Signed-off-by: Andi Kleen # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/x86_64/kernel/i8259.c # 2004/09/16 23:58:40-07:00 ak@muc.de +1 -1 # x86-64: make APIC errors KERN_DEBUG # # arch/x86_64/kernel/apic.c # 2004/09/17 00:28:12-07:00 ak@muc.de +1 -1 # x86-64: make APIC errors KERN_DEBUG # # ChangeSet # 2004/09/17 11:59:15-07:00 ak@muc.de # [PATCH] x86-64: add atomic64_t # # Add an atomic64_t type to x86-64. # # Not used right now, but may be useful in the future, e.g. for rss together # with C.Lameter's page fault scalability patches. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-x86_64/atomic.h # 2004/09/16 23:58:39-07:00 ak@muc.de +160 -0 # x86-64: add atomic64_t # # ChangeSet # 2004/09/17 11:59:04-07:00 david@gibson.dropbear.id.au # [PATCH] ppc64: remove LARGE_PAGE_SHIFT constant # # For historical reasons, ppc64 has ended up with two #defines for the size # of a large (16M) page: LARGE_PAGE_SHIFT and HPAGE_SHIFT. This patch # removes LARGE_PAGE_SHIFT in favour of the more widely used HPAGE_SHIFT. # # Signed-off-by: David Gibson # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-ppc64/mmu.h # 2004/09/16 23:58:39-07:00 david@gibson.dropbear.id.au +0 -2 # ppc64: remove LARGE_PAGE_SHIFT constant # # arch/ppc64/mm/hugetlbpage.c # 2004/09/16 23:58:39-07:00 david@gibson.dropbear.id.au +1 -1 # ppc64: remove LARGE_PAGE_SHIFT constant # # arch/ppc64/mm/hash_utils.c # 2004/09/16 23:58:39-07:00 david@gibson.dropbear.id.au +2 -2 # ppc64: remove LARGE_PAGE_SHIFT constant # # arch/ppc64/kernel/pSeries_htab.c # 2004/09/16 23:58:39-07:00 david@gibson.dropbear.id.au +1 -1 # ppc64: remove LARGE_PAGE_SHIFT constant # # ChangeSet # 2004/09/17 11:58:49-07:00 anton@samba.org # [PATCH] ppc64: fix CONFIG_CMDLINE # # When I cleaned up our cmdline parsing, I missed a RELOC of CONFIG_CMDLINE # itself. Without it we copy something random into cmd_line, but only when # CONFIG_CMDLINE is enabled. # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/ppc64/kernel/prom.c # 2004/09/16 23:58:39-07:00 anton@samba.org +1 -1 # ppc64: fix CONFIG_CMDLINE # # ChangeSet # 2004/09/17 11:58:37-07:00 anton@samba.org # [PATCH] ppc64: disable some drivers broken on 64bit # # The mace, bmac and dmasound drivers use virt_to_bus and so will not work on # ppc64. Reflect this in the relevant Kconfig files. # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # sound/oss/dmasound/Kconfig # 2004/09/16 23:58:39-07:00 anton@samba.org +1 -1 # ppc64: disable some drivers broken on 64bit # # drivers/net/Kconfig # 2004/09/17 00:28:03-07:00 anton@samba.org +2 -2 # ppc64: disable some drivers broken on 64bit # # ChangeSet # 2004/09/17 11:58:23-07:00 anton@samba.org # [PATCH] ppc64: fix hotplug CPU when building a pseries+pmac kernel # # When a pseries+pmac kernel is built, the rtas stop-self token wasnt being # initialised. Since doing this will safely fail on pmac, remove the # !CONFIG_PPC_PMAC restriction # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/ppc64/kernel/setup.c # 2004/09/16 23:58:39-07:00 anton@samba.org +2 -2 # ppc64: fix hotplug CPU when building a pseries+pmac kernel # # ChangeSet # 2004/09/17 11:58:10-07:00 anton@samba.org # [PATCH] ppc64: don't use state == SYSTEM_BOOTING # # From: Nathan Lynch # # Fedora has a patch which introduces a new system state during boot. Change # system_state == SYSTEM_BOOTING to system_state < SYSTEM_RUNNING to match # it. # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/ppc64/kernel/smp.c # 2004/09/16 23:58:39-07:00 anton@samba.org +3 -3 # ppc64: don't use state == SYSTEM_BOOTING # # ChangeSet # 2004/09/17 11:57:55-07:00 anton@samba.org # [PATCH] ppc64: export probe_irq_mask # # yenta_socket wants probe_irq_mask, so export it. # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/ppc64/kernel/irq.c # 2004/09/16 23:58:39-07:00 anton@samba.org +2 -0 # ppc64: export probe_irq_mask # # ChangeSet # 2004/09/17 11:57:44-07:00 anton@samba.org # [PATCH] ppc64: Remove A() and AA() # # Remove the A() and AA() macros. Now we have compat_ptr we should be using # that. # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-ppc64/ppc32.h # 2004/09/16 23:58:38-07:00 anton@samba.org +0 -24 # ppc64: Remove A() and AA() # # arch/ppc64/kernel/sys_ppc32.c # 2004/09/16 23:58:38-07:00 anton@samba.org +8 -8 # ppc64: Remove A() and AA() # # arch/ppc64/kernel/signal.c # 2004/09/16 23:58:38-07:00 anton@samba.org +0 -1 # ppc64: Remove A() and AA() # # arch/ppc64/kernel/ioctl32.c # 2004/09/16 23:58:38-07:00 anton@samba.org +0 -2 # ppc64: Remove A() and AA() # # ChangeSet # 2004/09/17 11:57:28-07:00 benh@kernel.crashing.org # [PATCH] ppc64: Fix some bogus warnings & cleanup tlbie code path # # This patch fixes some warnings that popped up with the removal of # -Wno-uninitialized around the code doing tlbie's. # # Signed-off-by: Benjamin Herrenschmidt # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/ppc64/kernel/pSeries_lpar.c # 2004/09/16 23:58:38-07:00 benh@kernel.crashing.org +3 -2 # ppc64: Fix some bogus warnings & cleanup tlbie code path # # arch/ppc64/kernel/pSeries_htab.c # 2004/09/17 00:28:13-07:00 benh@kernel.crashing.org +14 -9 # ppc64: Fix some bogus warnings & cleanup tlbie code path # # ChangeSet # 2004/09/17 11:57:17-07:00 anton@samba.org # [PATCH] ppc64: clean up asm/mmu.h # # Remove some old definitions that arent relevant to us. # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-ppc64/mmu.h # 2004/09/17 00:28:13-07:00 anton@samba.org +0 -157 # ppc64: clean up asm/mmu.h # # ChangeSet # 2004/09/17 11:57:04-07:00 anton@samba.org # [PATCH] ppc64: iseries build fixes # # Fix one compile warning and one build warning on iseries. # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-ppc64/page.h # 2004/09/16 23:58:38-07:00 anton@samba.org +3 -3 # ppc64: iseries build fixes # # arch/ppc64/mm/init.c # 2004/09/16 23:58:38-07:00 anton@samba.org +2 -0 # ppc64: iseries build fixes # # ChangeSet # 2004/09/17 11:56:50-07:00 anton@samba.org # [PATCH] ppc64: replace mmu_context_queue with idr allocator # # Replace the mmu_context_queue structure with the idr allocator. The # mmu_context_queue allocation was quite large (~200kB) so on most machines # we will have a reduction in usage. # # We might put a single entry cache on the front of this so we are more # likely to reuse ppc64 MMU hashtable entries that are in the caches. # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-ppc64/mmu_context.h # 2004/09/16 23:58:38-07:00 anton@samba.org +5 -99 # ppc64: replace mmu_context_queue with idr allocator # # arch/ppc64/mm/init.c # 2004/09/17 00:28:14-07:00 anton@samba.org +54 -13 # ppc64: replace mmu_context_queue with idr allocator # # ChangeSet # 2004/09/17 11:56:38-07:00 anton@samba.org # [PATCH] ppc64: powersave_nap sysctl # # Implement powersave_nap sysctl, like ppc32. This allows us to disable the # nap function which is useful when profiling with oprofile (to get an # accurate count of idle time). # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/ppc64/kernel/setup.c # 2004/09/17 00:28:13-07:00 anton@samba.org +0 -2 # ppc64: powersave_nap sysctl # # arch/ppc64/kernel/idle.c # 2004/09/16 23:58:38-07:00 anton@samba.org +34 -0 # ppc64: powersave_nap sysctl # # ChangeSet # 2004/09/17 11:56:24-07:00 anton@samba.org # [PATCH] ppc64: force_sigsegv fixes # # Replace do_exit() in 64bit signal code with force_sig/force_sigsegv where # appropriate. # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/ppc64/kernel/signal.c # 2004/09/17 00:28:14-07:00 anton@samba.org +3 -2 # ppc64: force_sigsegv fixes # # ChangeSet # 2004/09/17 11:56:13-07:00 olh@suse.de # [PATCH] ppc32: open_pic2.c build fix # # arch/ppc/syslib/open_pic2.c: In function `init_openpic2_sysfs': # arch/ppc/syslib/open_pic2.c:694: error: `ENODEV' undeclared (first use in this function) # arch/ppc/syslib/open_pic2.c:694: error: (Each undeclared identifier is reported only once # arch/ppc/syslib/open_pic2.c:694: error: for each function it appears in.) # # possible fix below. # # Signed-off-by: Olaf Hering # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/ppc/syslib/open_pic2.c # 2004/09/16 23:58:37-07:00 olh@suse.de +1 -0 # ppc32: open_pic2.c build fix # # ChangeSet # 2004/09/17 11:55:59-07:00 trini@kernel.crashing.org # [PATCH] ppc32: Fix arch/ppc/boot/common/ns16550.c # # When started including this exposed one of the # fragilities of the code in arch/ppc/boot/, namely that it is tied to the # kernel headers for some information, yet not really the kernel. The # following starts us in the direction of being less tied to the kernel by # providing our own serial_state definition (all we care about is the ability # to grab information from SERIAL_PORT_DFNS). # # Signed-off-by: Tom Rini # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/ppc/boot/include/serial.h # 2004/09/16 23:58:37-07:00 trini@kernel.crashing.org +46 -0 # ppc32: Fix arch/ppc/boot/common/ns16550.c # # arch/ppc/boot/common/ns16550.c # 2004/09/16 23:58:37-07:00 trini@kernel.crashing.org +3 -3 # ppc32: Fix arch/ppc/boot/common/ns16550.c # # arch/ppc/boot/include/serial.h # 2004/09/16 23:58:37-07:00 trini@kernel.crashing.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/arch/ppc/boot/include/serial.h # # ChangeSet # 2004/09/17 11:55:43-07:00 roland@redhat.com # [PATCH] fix posix-timers leak # # Exec fails to clean up posix-timers. This manifests itself in two ways, one # worse than the other. In the single-threaded case, it just fails to clear out # the timers on exec. POSIX says that exec clears out the timers from # timer_create (though not the setitimer ones), so it's wrong that a lingering # timer could fire after exec and kill the process with a signal it's not # expecting. In the multi-threaded case, it not only leaves lingering timers, # but it leaks them entirely when it replaces signal_struct, so they will never # be freed by the process exiting after that exec. The new per-user # RLIMIT_SIGPENDING actually limits the damage here, because a UID will fill up # its quota with leaked timers and then never be able to use timer_create again # (that's what my test program does). But if you have many many untrusted UIDs, # this leak could be considered a DoS risk. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # fs/exec.c # 2004/09/16 23:58:37-07:00 roland@redhat.com +3 -1 # fix posix-timers leak # # ChangeSet # 2004/09/17 11:55:31-07:00 mingo@elte.hu # [PATCH] x86 TSS: io bitmap lazy updating # # This uses Davide's do_general_protection() fault based io-bitmap lazy update # code and combines it with the ioport-owner cache. # # Signed-off-by: Ingo Molnar # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-i386/processor.h # 2004/09/16 23:58:37-07:00 mingo@elte.hu +1 -0 # x86 TSS: io bitmap lazy updating # # arch/i386/kernel/traps.c # 2004/09/17 00:28:10-07:00 mingo@elte.hu +30 -0 # x86 TSS: io bitmap lazy updating # # arch/i386/kernel/process.c # 2004/09/17 00:28:01-07:00 mingo@elte.hu +8 -9 # x86 TSS: io bitmap lazy updating # # arch/i386/kernel/ioport.c # 2004/09/16 23:58:37-07:00 mingo@elte.hu +5 -5 # x86 TSS: io bitmap lazy updating # # ChangeSet # 2004/09/17 11:55:17-07:00 mingo@elte.hu # [PATCH] x86 TSS: io port caching # # There's one additional step we can do ontop of the ports-max code to get rid # of copying in X.org's case: cache the last task that set up the IO bitmap. # This means we can set the offset to invalid and keep the IO bitmap of that # task, and switch back to a valid offset (without any copying) when switching # back to that task. (or do a copy if there is another ioperm task we switch # to.) # # I've attached ioport-cache-2.6.8.1.patch that implements this. When # there's a single active ioperm() using task in the system then the # context-switch overhead is very low and constant: # # # ./ioperm-latency # default no ioperm: scheduling latency: 2478 cycles # turning on port 80 ioperm: scheduling latency: 2499 cycles # turning on port 65535 ioperm: scheduling latency: 2481 cycles # # This single-ioperm-user situation matches 99% of the actual ioperm() # usage scenarios and gets rid of any copying whatsoever - without relying # on any fault mechanism. I can see no advantage of the GPF approach over # this patch. # # Signed-off-by: Ingo Molnar # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-i386/processor.h # 2004/09/17 00:28:16-07:00 mingo@elte.hu +10 -3 # x86 TSS: io port caching # # arch/i386/kernel/process.c # 2004/09/17 00:28:16-07:00 mingo@elte.hu +39 -15 # x86 TSS: io port caching # # arch/i386/kernel/ioport.c # 2004/09/17 00:28:16-07:00 mingo@elte.hu +4 -1 # x86 TSS: io port caching # # ChangeSet # 2004/09/17 11:55:05-07:00 rsa@us.ibm.com # [PATCH] hvc_console fix to protect hvc_write against ldisc write after hvc_close # # Due to the tty ldisc code not stopping write operations against a driver # even after a tty has been closed I added a mechanism to hvc_console in my # previous patch to prevent this by nulling out the tty->driver_data in # hvc_close() but I forgot to check tty->driver_data in hvc_write(). Anton # Blanchard got several oops'es from hvc_write() accessing NULL as if it were # a pointer to an hvc_struct usually stored in tty->driver_data. # # So this patch checks tty->driver_data in hvc_write() before it is used. # Hopefully once Alan Cox's patch is checked in ldisc writes won't continue # to happen after tty closes. # # Anton Blanchard has tested this patch and is unable to reproduce the oops # with it applied. # # Changelog: # # drivers/char/hvc_console.c # # - Added comment to hvc_close() to explain the reason for NULLing # tty->driver_data. # # - Added check to hvc_write() to verify that tty->driver_data is valid # (NOT NULL) which would be the case if the write operation was invoked # after a tty close was initiated on the tty. # # Signed-off-by: Ryan S. Arnold # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/char/hvc_console.c # 2004/09/16 23:58:37-07:00 rsa@us.ibm.com +9 -0 # hvc_console fix to protect hvc_write against ldisc write after hvc_close # # ChangeSet # 2004/09/17 11:54:51-07:00 Markus.Lidel@shadowconnect.com # [PATCH] reduce ioremap memory size for Adaptec I2O controllers # # The I2O subsystem currently map all memory from the I2O controller for the # controller's in queue, even if it is not necessary. This is a problem, # because on some systems the size returned from pci_resource_len() could be # 128MB and only 1-4MB is needed. # # Changes: # # - only ioremap as much memory as the controller is actually using. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/message/i2o/pci.c # 2004/09/16 23:58:37-07:00 Markus.Lidel@shadowconnect.com +15 -0 # reduce ioremap memory size for Adaptec I2O controllers # # ChangeSet # 2004/09/17 11:11:23-07:00 david@gibson.dropbear.id.au # [IPV4]: Initialize newly allocated hash tables in fib_semantics.c # # When fib_create_info() allocates new hash tables, it neglects to # initialize them. This leads to an oops during boot on at least # machine I use. This patch addresses the problem. # # Signed-off-by: David Gibson # Signed-off-by: David S. Miller # # net/ipv4/fib_semantics.c # 2004/09/17 11:11:04-07:00 david@gibson.dropbear.id.au +5 -1 # [IPV4]: Initialize newly allocated hash tables in fib_semantics.c # # When fib_create_info() allocates new hash tables, it neglects to # initialize them. This leads to an oops during boot on at least # machine I use. This patch addresses the problem. # # Signed-off-by: David Gibson # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/17 12:07:11-04:00 akpm@osdl.org # [PATCH] fix driver name in eth1394 as returned by ETHTOOL_GDRVINFO # # From: Thierry Vignaud # # The GDRVINFO command of the ETHTOOL ioctl returns a bogus driver name. # # Signed-off-by: Andrew Morton # # drivers/ieee1394/eth1394.c # 2004/09/14 14:13:05-04:00 akpm@osdl.org +1 -1 # fix driver name in eth1394 as returned by ETHTOOL_GDRVINFO # # ChangeSet # 2004/09/17 07:54:01-07:00 trini@kernel.crashing.org # ppc32: The ISA PIC address for int-ack wasn't being picked out right # # Signed-off-by: Leigh Brown # Signed-off-by: Tom Rini # # arch/ppc/platforms/residual.c # 2004/09/17 07:53:38-07:00 trini@kernel.crashing.org +2 -2 # The ISA PIC address for acknowledging interrupts is actually # defined in residual data as a 32-bit system address, rather # than a 32-bit memory address. This is rather embarrasing, as # I don't think this function has done the right thing, ever. # # ChangeSet # 2004/09/17 07:51:37-07:00 trini@kernel.crashing.org # ppc32: Fix a problem with the FCC enet driver for CPM2 systems # # The Local Protect Bit needs to be set when entering full # duplex mode. # # Signed-off-by: Rune Torgersen # Signed-off-by: Tom Rini # # arch/ppc/8260_io/fcc_enet.c # 2004/09/17 07:51:14-07:00 trini@kernel.crashing.org +2 -2 # The Local Protect Bit is not set when enterring Full Duplex mode. # This causes the FCC to turn off the transmitter when packets are # received, and also causes NonOctet frame errors and CRC errors # (late collission) # # ChangeSet # 2004/09/16 18:23:10-07:00 davem@nuts.davemloft.net # [SPARC]: Kill dump_dma_regs, unused. # # Signed-off-by: David S. Miller # # drivers/sbus/dvma.c # 2004/09/16 18:22:39-07:00 davem@nuts.davemloft.net +0 -11 # [SPARC]: Kill dump_dma_regs, unused. # # ChangeSet # 2004/09/16 18:21:41-07:00 davem@nuts.davemloft.net # [SPARC64]: Missing ioremap() in parport support. # # Signed-off-by: David S. Miller # # include/asm-sparc64/parport.h # 2004/09/16 18:21:10-07:00 davem@nuts.davemloft.net +5 -1 # [SPARC64]: Missing ioremap() in parport support. # # ChangeSet # 2004/09/16 18:08:07-07:00 davem@nuts.davemloft.net # [SPARC64]: Fix I/O port args to string routines. # # Signed-off-by: David S. Miller # # arch/sparc64/lib/PeeCeeI.c # 2004/09/16 18:07:37-07:00 davem@nuts.davemloft.net +6 -6 # [SPARC64]: Fix I/O port args to string routines. # # ChangeSet # 2004/09/16 20:43:18-04:00 olh@suse.de # [PATCH] mark mace and bmac as ppc32 only # # mace and bmac are only used in "oldworld" PowerMacs. # Mark them as ppc32 only. # # drivers/net/Kconfig # 2004/09/06 09:27:26-04:00 olh@suse.de +2 -2 # mark mace and bmac as ppc32 only # # ChangeSet # 2004/09/16 17:25:12-07:00 davem@nuts.davemloft.net # [SPARC64]: Fix iomem warnings in qlogicpti driver. # # Signed-off-by: David S. Miller # # drivers/scsi/qlogicpti.h # 2004/09/16 17:24:41-07:00 davem@nuts.davemloft.net +2 -2 # [SPARC64]: Fix iomem warnings in qlogicpti driver. # # drivers/scsi/qlogicpti.c # 2004/09/16 17:24:41-07:00 davem@nuts.davemloft.net +1 -1 # [SPARC64]: Fix iomem warnings in qlogicpti driver. # # ChangeSet # 2004/09/16 17:21:15-07:00 davem@nuts.davemloft.net # [SPARC64]: Fix iomem warnings in esp scsi driver. # # Signed-off-by: David S. Miller # # drivers/scsi/esp.h # 2004/09/16 17:20:43-07:00 davem@nuts.davemloft.net +2 -2 # [SPARC64]: Fix iomem warnings in esp scsi driver. # # drivers/scsi/esp.c # 2004/09/16 17:20:43-07:00 davem@nuts.davemloft.net +0 -0 # [SPARC64]: Fix iomem warnings in esp scsi driver. # # ChangeSet # 2004/09/16 17:11:17-07:00 davem@nuts.davemloft.net # [B44]: Fix remaining iomem warnings. # # Signed-off-by: David S. Miller # # drivers/net/b44.h # 2004/09/16 17:10:44-07:00 davem@nuts.davemloft.net +1 -1 # [B44]: Fix remaining iomem warnings. # # drivers/net/b44.c # 2004/09/16 17:10:44-07:00 davem@nuts.davemloft.net +2 -2 # [B44]: Fix remaining iomem warnings. # # ChangeSet # 2004/09/16 17:08:09-07:00 davem@nuts.davemloft.net # [SPARC64]: Fix iomem warnings in flash driver. # # Signed-off-by: David S. Miller # # drivers/sbus/char/flash.c # 2004/09/16 17:07:39-07:00 davem@nuts.davemloft.net +2 -1 # [SPARC64]: Fix iomem warnings in flash driver. # # ChangeSet # 2004/09/16 17:05:52-07:00 davem@nuts.davemloft.net # [SPARC64]: Fix iomem warnings in cpwatchdog driver. # # Signed-off-by: David S. Miller # # drivers/sbus/char/cpwatchdog.c # 2004/09/16 17:05:24-07:00 davem@nuts.davemloft.net +35 -49 # [SPARC64]: Fix iomem warnings in cpwatchdog driver. # # ChangeSet # 2004/09/16 16:50:24-07:00 davem@nuts.davemloft.net # [SPARC64]: Fix iomem warnings in display7seg driver. # # drivers/sbus/char/display7seg.c # 2004/09/16 16:50:03-07:00 davem@nuts.davemloft.net +1 -1 # [SPARC64]: Fix iomem warnings in display7seg driver. # # ChangeSet # 2004/09/16 16:43:54-07:00 davem@nuts.davemloft.net # [SPARC64]: Fix iomem warnings in envctrl driver. # # Signed-off-by: David S. Miller # # drivers/sbus/char/envctrl.c # 2004/09/16 16:43:26-07:00 davem@nuts.davemloft.net +23 -42 # [SPARC64]: Fix iomem warnings in envctrl driver. # # ChangeSet # 2004/09/16 16:02:39-07:00 davem@nuts.davemloft.net # [TYPHOON]: Fix iomem warnings. # # Signed-off-by: David S. Miller # # drivers/net/typhoon.c # 2004/09/16 16:02:08-07:00 davem@nuts.davemloft.net +27 -26 # [TYPHOON]: Fix iomem warnings. # # ChangeSet # 2004/09/16 15:53:59-07:00 davem@nuts.davemloft.net # [MYRI_SBUS]: Fix iomem warnings. # # Signed-off-by: David S. Miller # # drivers/net/myri_sbus.h # 2004/09/16 15:53:28-07:00 davem@nuts.davemloft.net +8 -9 # [MYRI_SBUS]: Fix iomem warnings. # # drivers/net/myri_sbus.c # 2004/09/16 15:53:28-07:00 davem@nuts.davemloft.net +33 -34 # [MYRI_SBUS]: Fix iomem warnings. # # ChangeSet # 2004/09/16 15:42:01-07:00 davem@nuts.davemloft.net # [SUNBMAC]: Fix iomem warnings. # # Signed-off-by: David S. Miller # # drivers/net/sunbmac.h # 2004/09/16 15:41:29-07:00 davem@nuts.davemloft.net +4 -4 # [SUNBMAC]: Fix iomem warnings. # # drivers/net/sunbmac.c # 2004/09/16 15:41:29-07:00 davem@nuts.davemloft.net +20 -20 # [SUNBMAC]: Fix iomem warnings. # # ChangeSet # 2004/09/16 15:35:11-07:00 davem@nuts.davemloft.net # [SUNQE]: Fix iomem warnings. # # Signed-off-by: David S. Miller # # drivers/net/sunqe.h # 2004/09/16 15:34:41-07:00 davem@nuts.davemloft.net +3 -3 # [SUNQE]: Fix iomem warnings. # # drivers/net/sunqe.c # 2004/09/16 15:34:41-07:00 davem@nuts.davemloft.net +7 -7 # [SUNQE]: Fix iomem warnings. # # ChangeSet # 2004/09/16 15:31:27-07:00 davem@nuts.davemloft.net # [SUNLANCE]: Fix iomem warnings. # # Also clear all the bogus volatile usage out of # this driver. # # Signed-off-by: David S. Miller # # include/asm-sparc64/dma.h # 2004/09/16 15:30:47-07:00 davem@nuts.davemloft.net +1 -1 # [SUNLANCE]: Fix iomem warnings. # # drivers/net/sunlance.c # 2004/09/16 15:30:47-07:00 davem@nuts.davemloft.net +32 -32 # [SUNLANCE]: Fix iomem warnings. # # ChangeSet # 2004/09/16 22:25:43+00:00 markgw@sgi.com # [IA64] SGI Altix hardware performance monitoring API # # # The SGI Altix PROM supports a SAL call for performance monitoring and for # exporting NUMA topology. We need this in community kernels for diagnostic # and performance tools to use, especially on very large machines. # # This patch registers a dynamic misc device "sn_hwperf" that supports an # ioctl interface for reading/writing memory mapped registers on Altix # nodes and routers via the new SAL call. It also creates a read-only # procfs file "/proc/sgi_sn/sn_topology" to export NUMA topology and Altix # hardware inventory. # # > What tools are using this? # # Performance Co-Pilot http://oss.sgi.com/projects/pcp in particular, # pmshub, shubstats and linkstat. Numerous other users include anything # that needs knowledge of numa topology/interconnect in order to perform # well, e.g. mpt. BTW I have not exported any API functions .. at this # point I don't think we need any modules to call the API. # # Signed-off-by: Mark Goodwin # Signed-off-by: Tony Luck # # include/asm-ia64/sn/sn_sal.h # 2004/09/16 22:19:20+00:00 aegl@agluck-lia64.sc.intel.com +18 -0 # Add SGI h/w performance API # # arch/ia64/sn/kernel/sn2/sn_proc_fs.c # 2004/09/16 22:19:20+00:00 aegl@agluck-lia64.sc.intel.com +7 -0 # Add SGI h/w performance API # # arch/ia64/sn/kernel/sn2/Makefile # 2004/09/16 22:19:20+00:00 aegl@agluck-lia64.sc.intel.com +1 -1 # Add SGI h/w performance API # # include/asm-ia64/sn/sn2/sn_hwperf.h # 2004/09/16 22:18:29+00:00 aegl@agluck-lia64.sc.intel.com +218 -0 # Add SGI h/w performance API # # include/asm-ia64/sn/sn2/sn_hwperf.h # 2004/09/16 22:18:29+00:00 aegl@agluck-lia64.sc.intel.com +0 -0 # BitKeeper file /data/home/aegl/BK/work/sgi/include/asm-ia64/sn/sn2/sn_hwperf.h # # arch/ia64/sn/kernel/sn2/sn_hwperf.c # 2004/09/16 22:18:28+00:00 aegl@agluck-lia64.sc.intel.com +652 -0 # Add SGI h/w performance API # # arch/ia64/sn/kernel/sn2/sn_hwperf.c # 2004/09/16 22:18:28+00:00 aegl@agluck-lia64.sc.intel.com +0 -0 # BitKeeper file /data/home/aegl/BK/work/sgi/arch/ia64/sn/kernel/sn2/sn_hwperf.c # # ChangeSet # 2004/09/16 15:14:20-07:00 davem@nuts.davemloft.net # [SUNHME]: Fix iomem warnings. # # Signed-off-by: David S. Miller # # drivers/net/sunhme.h # 2004/09/16 15:13:50-07:00 davem@nuts.davemloft.net +7 -7 # [SUNHME]: Fix iomem warnings. # # drivers/net/sunhme.c # 2004/09/16 15:13:50-07:00 davem@nuts.davemloft.net +39 -38 # [SUNHME]: Fix iomem warnings. # # ChangeSet # 2004/09/16 15:05:36-07:00 davem@nuts.davemloft.net # [MPTFUSION]: Fix iomem warnings. # # Signed-off-by: David S. Miller # # drivers/message/fusion/mptbase.h # 2004/09/16 15:05:06-07:00 davem@nuts.davemloft.net +2 -2 # [MPTFUSION]: Fix iomem warnings. # # ChangeSet # 2004/09/16 15:02:22-07:00 davem@nuts.davemloft.net # [SPARC64]: Fix iomem warnings in i8042-sparcio.h # # Signed-off-by: David S. Miller # # drivers/input/serio/i8042-sparcio.h # 2004/09/16 15:01:53-07:00 davem@nuts.davemloft.net +4 -4 # [SPARC64]: Fix iomem warnings in i8042-sparcio.h # # ChangeSet # 2004/09/16 15:00:23-07:00 davem@nuts.davemloft.net # [SPARC64]: Fix iomem warnings in cs4231 sound driver. # # Signed-off-by: David S. Miller # # sound/sparc/cs4231.c # 2004/09/16 14:59:57-07:00 davem@nuts.davemloft.net +8 -8 # [SPARC64]: Fix iomem warnings in cs4231 sound driver. # # ChangeSet # 2004/09/16 14:58:10-07:00 davem@nuts.davemloft.net # [SPARC64]: Fix iomem warnings in amd7930 sound driver. # # Signed-off-by: David S. Miller # # sound/sparc/amd7930.c # 2004/09/16 14:57:41-07:00 davem@nuts.davemloft.net +1 -1 # [SPARC64]: Fix iomem warnings in amd7930 sound driver. # # ChangeSet # 2004/09/16 14:56:48-07:00 davem@nuts.davemloft.net # [SPARC64]: Make IDE ops take __iomem pointers. # # Signed-off-by: David S. Miller # # include/asm-sparc64/ide.h # 2004/09/16 14:56:16-07:00 davem@nuts.davemloft.net +4 -8 # [SPARC64]: Make IDE ops take __iomem pointers. # # ChangeSet # 2004/09/16 14:53:28-07:00 davem@nuts.davemloft.net # [FC4]: Fix iomem warnings in SOCAL driver. # # drivers/fc4/socal.h # 2004/09/16 14:53:06-07:00 davem@nuts.davemloft.net +3 -3 # [FC4]: Fix iomem warnings in SOCAL driver. # # drivers/fc4/socal.c # 2004/09/16 14:53:06-07:00 davem@nuts.davemloft.net +2 -2 # [FC4]: Fix iomem warnings in SOCAL driver. # # ChangeSet # 2004/09/16 14:51:08-07:00 davem@nuts.davemloft.net # [FC4]: Fix iomem warnings in SOC driver. # # drivers/fc4/soc.h # 2004/09/16 14:50:46-07:00 davem@nuts.davemloft.net +10 -10 # [FC4]: Fix iomem warnings in SOC driver. # # drivers/fc4/soc.c # 2004/09/16 14:50:46-07:00 davem@nuts.davemloft.net +0 -0 # [FC4]: Fix iomem warnings in SOC driver. # # ChangeSet # 2004/09/16 14:44:58-07:00 davem@nuts.davemloft.net # [SPARC64]: Update defconfig. # # arch/sparc64/defconfig # 2004/09/16 14:44:38-07:00 davem@nuts.davemloft.net +5 -2 # [SPARC64]: Update defconfig. # # ChangeSet # 2004/09/16 14:43:33-07:00 davem@nuts.davemloft.net # [SPARC64]: Add io{read,write}{8,16,32}_rep(). # # Signed-off-by: David S. Miller # # include/asm-sparc64/io.h # 2004/09/16 14:43:04-07:00 davem@nuts.davemloft.net +12 -6 # [SPARC64]: Add io{read,write}{8,16,32}_rep(). # # ChangeSet # 2004/09/16 20:26:04+00:00 aegl@agluck-lia64.sc.intel.com # Merge agluck-lia64.sc.intel.com:/data/home/aegl/BK/Linus # into agluck-lia64.sc.intel.com:/data/home/aegl/BK/linux-ia64-release-2.6.9 # # arch/ia64/Kconfig # 2004/09/16 20:25:58+00:00 aegl@agluck-lia64.sc.intel.com +0 -0 # Auto merged # # ChangeSet # 2004/09/16 13:19:01-07:00 bdschuym@pandora.be # [NETFILTER]: port physdev to ip6tables # # Signed-off-by: Bart De Schuymer # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # net/ipv6/netfilter/Makefile # 2004/09/16 13:18:28-07:00 bdschuym@pandora.be +1 -0 # [NETFILTER]: port physdev to ip6tables # # net/ipv6/netfilter/Kconfig # 2004/09/16 13:18:27-07:00 bdschuym@pandora.be +9 -0 # [NETFILTER]: port physdev to ip6tables # # net/ipv6/netfilter/ip6t_physdev.c # 2004/09/16 13:18:24-07:00 bdschuym@pandora.be +136 -0 # [NETFILTER]: port physdev to ip6tables # # net/ipv6/netfilter/ip6t_physdev.c # 2004/09/16 13:18:24-07:00 bdschuym@pandora.be +0 -0 # BitKeeper file /disk1/BK/net-2.6/net/ipv6/netfilter/ip6t_physdev.c # # include/linux/netfilter_ipv6/ip6t_physdev.h # 2004/09/16 13:18:23-07:00 bdschuym@pandora.be +24 -0 # [NETFILTER]: port physdev to ip6tables # # include/linux/netfilter_ipv6/ip6t_physdev.h # 2004/09/16 13:18:23-07:00 bdschuym@pandora.be +0 -0 # BitKeeper file /disk1/BK/net-2.6/include/linux/netfilter_ipv6/ip6t_physdev.h # # ChangeSet # 2004/09/16 13:13:12-07:00 tgraf@suug.ch # [PKT_SCHED]: Fix slab corruption in cbq_destroy # # Fixes slab corruption in cbq_destroy. cbq_destroy_filters and # qdisc_put_rtab(q->link.R_tab) are already called in cbq_destroy_class. # The latter lead to a slab corruption due to repeated freeing of # q->link.R_tab because q->link is part of q->classes. Problem introduced # in 1.21. # # Signed-off-by: Thomas Graf # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # net/sched/sch_cbq.c # 2004/09/16 13:12:54-07:00 tgraf@suug.ch +0 -6 # [PKT_SCHED]: Fix slab corruption in cbq_destroy # # Fixes slab corruption in cbq_destroy. cbq_destroy_filters and # qdisc_put_rtab(q->link.R_tab) are already called in cbq_destroy_class. # The latter lead to a slab corruption due to repeated freeing of # q->link.R_tab because q->link is part of q->classes. Problem introduced # in 1.21. # # Signed-off-by: Thomas Graf # Signed-off-by: Patrick McHardy # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/16 13:12:04-07:00 herbert@gondor.apana.org.au # [IPSEC]: Implement DSCP decapsulation # # This patch adds DSCP decapsulation for IPsec. This is enabled by # a per-state flag which is off by default. Leaving it off by default # maintains compatibility and is also good for performance reasons. # # I decided to not implement a toggle on the output path since not # encapsulating the DSCP can and should be done by netfilter. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # net/key/af_key.c # 2004/09/16 13:11:46-07:00 herbert@gondor.apana.org.au +4 -0 # [IPSEC]: Implement DSCP decapsulation # # This patch adds DSCP decapsulation for IPsec. This is enabled by # a per-state flag which is off by default. Leaving it off by default # maintains compatibility and is also good for performance reasons. # # I decided to not implement a toggle on the output path since not # encapsulating the DSCP can and should be done by netfilter. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # net/ipv6/xfrm6_input.c # 2004/09/16 13:11:46-07:00 herbert@gondor.apana.org.au +2 -0 # [IPSEC]: Implement DSCP decapsulation # # This patch adds DSCP decapsulation for IPsec. This is enabled by # a per-state flag which is off by default. Leaving it off by default # maintains compatibility and is also good for performance reasons. # # I decided to not implement a toggle on the output path since not # encapsulating the DSCP can and should be done by netfilter. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # net/ipv4/xfrm4_input.c # 2004/09/16 13:11:46-07:00 herbert@gondor.apana.org.au +2 -0 # [IPSEC]: Implement DSCP decapsulation # # This patch adds DSCP decapsulation for IPsec. This is enabled by # a per-state flag which is off by default. Leaving it off by default # maintains compatibility and is also good for performance reasons. # # I decided to not implement a toggle on the output path since not # encapsulating the DSCP can and should be done by netfilter. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # include/net/inet_ecn.h # 2004/09/16 13:11:46-07:00 herbert@gondor.apana.org.au +6 -0 # [IPSEC]: Implement DSCP decapsulation # # This patch adds DSCP decapsulation for IPsec. This is enabled by # a per-state flag which is off by default. Leaving it off by default # maintains compatibility and is also good for performance reasons. # # I decided to not implement a toggle on the output path since not # encapsulating the DSCP can and should be done by netfilter. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # include/linux/xfrm.h # 2004/09/16 13:11:46-07:00 herbert@gondor.apana.org.au +1 -0 # [IPSEC]: Implement DSCP decapsulation # # This patch adds DSCP decapsulation for IPsec. This is enabled by # a per-state flag which is off by default. Leaving it off by default # maintains compatibility and is also good for performance reasons. # # I decided to not implement a toggle on the output path since not # encapsulating the DSCP can and should be done by netfilter. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # include/linux/pfkeyv2.h # 2004/09/16 13:11:46-07:00 herbert@gondor.apana.org.au +1 -0 # [IPSEC]: Implement DSCP decapsulation # # This patch adds DSCP decapsulation for IPsec. This is enabled by # a per-state flag which is off by default. Leaving it off by default # maintains compatibility and is also good for performance reasons. # # I decided to not implement a toggle on the output path since not # encapsulating the DSCP can and should be done by netfilter. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/16 13:10:18-07:00 herbert@gondor.apana.org.au # [IPV6]: Kill ip6_get_dsfield # # This patch kills the duplicate implementation of ip6_get_dsfield in # inet_ecn.h. It now uses ipv6_get_dsfield from dsfield.h instead. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # net/sched/sch_red.c # 2004/09/16 13:10:00-07:00 herbert@gondor.apana.org.au +2 -1 # [IPV6]: Kill ip6_get_dsfield # # This patch kills the duplicate implementation of ip6_get_dsfield in # inet_ecn.h. It now uses ipv6_get_dsfield from dsfield.h instead. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # net/ipv6/xfrm6_input.c # 2004/09/16 13:10:00-07:00 herbert@gondor.apana.org.au +2 -1 # [IPV6]: Kill ip6_get_dsfield # # This patch kills the duplicate implementation of ip6_get_dsfield in # inet_ecn.h. It now uses ipv6_get_dsfield from dsfield.h instead. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # net/ipv6/tcp_ipv6.c # 2004/09/16 13:10:00-07:00 herbert@gondor.apana.org.au +2 -1 # [IPV6]: Kill ip6_get_dsfield # # This patch kills the duplicate implementation of ip6_get_dsfield in # inet_ecn.h. It now uses ipv6_get_dsfield from dsfield.h instead. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # net/ipv6/sit.c # 2004/09/16 13:10:00-07:00 herbert@gondor.apana.org.au +2 -1 # [IPV6]: Kill ip6_get_dsfield # # This patch kills the duplicate implementation of ip6_get_dsfield in # inet_ecn.h. It now uses ipv6_get_dsfield from dsfield.h instead. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # net/ipv4/ip_gre.c # 2004/09/16 13:10:00-07:00 herbert@gondor.apana.org.au +2 -1 # [IPV6]: Kill ip6_get_dsfield # # This patch kills the duplicate implementation of ip6_get_dsfield in # inet_ecn.h. It now uses ipv6_get_dsfield from dsfield.h instead. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # include/net/inet_ecn.h # 2004/09/16 13:10:00-07:00 herbert@gondor.apana.org.au +1 -3 # [IPV6]: Kill ip6_get_dsfield # # This patch kills the duplicate implementation of ip6_get_dsfield in # inet_ecn.h. It now uses ipv6_get_dsfield from dsfield.h instead. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/16 12:57:58-07:00 yoshfuji@linux-ipv6.org # [IPV6]: NDISC: ensure responding to NS without link-layer information # # When sending NA in response to NS, we may not know the # link-layer address for the destination of the NA # since unicast NS is not required to include its link-layer information. # In this case, we first need to resolve the link-layer address. # (RFC 2461 7.2.4) # # We now create neighbour entry for the destination # and link-layer information will be automatically solved # in the output path. # # Signed-off-by: Hideaki YOSHIFUJI # Signed-off-by: David S. Miller # # net/ipv6/ndisc.c # 2004/09/16 12:57:40-07:00 yoshfuji@linux-ipv6.org +2 -1 # [IPV6]: NDISC: ensure responding to NS without link-layer information # # When sending NA in response to NS, we may not know the # link-layer address for the destination of the NA # since unicast NS is not required to include its link-layer information. # In this case, we first need to resolve the link-layer address. # (RFC 2461 7.2.4) # # We now create neighbour entry for the destination # and link-layer information will be automatically solved # in the output path. # # Signed-off-by: Hideaki YOSHIFUJI # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/16 19:57:29+00:00 jbarnes@sgi.com # [IA64] Kconfig: Add help text for IA64_SGI_SN2 config option. # # Mark Goodwin suggested that we document our platform a bit. This patch adds # help text for the sn2 specific kernel option. # # Signed-off-by: Jesse Barnes # Signed-off-by: Tony Luck # # ChangeSet # 2004/09/16 12:56:49-07:00 eric.lemoine@gmail.com # [SUNGEM]: Add netpoll support. # # Signed-off-by: Eric Lemoine # Signed-off-by: David S. Miller # # drivers/net/sungem.c # 2004/09/16 12:56:28-07:00 eric.lemoine@gmail.com +16 -0 # [SUNGEM]: Add netpoll support. # # Signed-off-by: Eric Lemoine # Signed-off-by: David S. Miller # # arch/ia64/Kconfig # 2004/09/16 19:55:32+00:00 aegl@agluck-lia64.sc.intel.com +6 -0 # Add help text for IA64_SGI_SN2 config option. # # ChangeSet # 2004/09/16 12:11:21-07:00 vandrove@vc.cvut.cz # [PATCH] matroxfb update + sparse annotations # # This change switches matroxfb on x86 and x86_64 from dereferencing # pointers to {read,write}[bwl], as __pa() are gone from them, and so gcc # does not need an additional register for preserving address between # consecutive {read,write}[bwl]. # # Then it switches only supported architecture left (ppc/ppc64/arm) from # dereferencing pointers to __raw_{read,write}[bwl]. # # Third part is fixing sparse complaints: add __iomem here and there, and # switch one 1bit bitfield from int to unsigned int. # # After this there should be no sparse complaints in matroxfb. # # Signed-off-by: Petr Vandrovec # Signed-off-by: Linus Torvalds # # drivers/video/matrox/matroxfb_misc.c # 2004/09/16 06:33:22-07:00 vandrove@vc.cvut.cz +6 -6 # matroxfb update + sparse annotations # # drivers/video/matrox/matroxfb_crtc2.h # 2004/09/16 06:31:05-07:00 vandrove@vc.cvut.cz +1 -1 # matroxfb update + sparse annotations # # drivers/video/matrox/matroxfb_base.h # 2004/09/16 08:12:04-07:00 vandrove@vc.cvut.cz +12 -19 # matroxfb update + sparse annotations # # ChangeSet # 2004/09/16 19:11:00+00:00 kaos@sgi.com # [IA64] ar.k[56] have virtual addresses already, don't convert # # r.k[56] used to contain physical addresses but now contain virtual # addresses. There are code remnants which still believe that they are # physical and "convert" ar.k[56] to virtual. This breaks when current # is not in region 7 (e.g. the idle task on cpu 0). # # Signed-off-by: Keith Owens # Signed-off-by: Tony Luck # # include/asm-ia64/mca_asm.h # 2004/09/16 19:09:04+00:00 aegl@agluck-lia64.sc.intel.com +0 -3 # ar.k[56] have virtual addresses already # # arch/ia64/kernel/minstate.h # 2004/09/16 19:09:04+00:00 aegl@agluck-lia64.sc.intel.com +1 -3 # ar.k[56] have virtual addresses already # # ChangeSet # 2004/09/16 11:50:39-07:00 alex.williamson@hp.com # [PATCH] fix compat_do_execve stack usage # # Looks like a couple struct to pointer conversions were missed. # # Signed-off-by: Linus Torvalds # # fs/compat.c # 2004/09/16 11:19:26-07:00 alex.williamson@hp.com +2 -2 # fix compat_do_execve stack usage # # ChangeSet # 2004/09/16 07:13:57-07:00 rusty@rustcorp.com.au # [PATCH] Fix ip_nat_ftp registration when no ports= arg # # FTP NAT module doesn't register anything with no args. Oops. # # Signed-off-by: Rusty Russell # Signed-off-by: Linus Torvalds # # net/ipv4/netfilter/ip_nat_ftp.c # 2004/09/15 15:05:38-07:00 rusty@rustcorp.com.au +1 -1 # Fix ip_nat_ftp registration when no ports= arg # # ChangeSet # 2004/09/16 07:12:54-07:00 roland@redhat.com # [PATCH] back out siginfo_t.si_rusage from waitid changes # # As I explained in the waitid patches, I added the si_rusage field to # siginfo_t with the idea of having the siginfo_t waitid fills in contain all # the information that wait4 or any such call could ever tell you. Nowhere # in POSIX nor anywhere else specifies this field in siginfo_t. # # When Ulrich and I hashed out the system call interface we wanted, we looked # at siginfo_t and decided there was plenty of space to throw in si_rusage. # Well, it turns out we didn't check the 64-bit platforms. There struct # rusage is ridiculously large (lots of longs for things that are never in a # million years going to hit 2^32), and my changes bumped up the size of # siginfo_t. Changing that size is more trouble than it's worth. # # This patch reverts the changes to the siginfo_t structure types, # and no longer provides the rusage details in SIGCHLD signal data. # Instead, I added a fifth argument to the waitid system call to fill in rusage. # # waitid is the name of the POSIX function with four arguments. It might # make sense to rename the system call `waitsys' to follow SGI's system call # with the same arguments, or `wait5' in the mindless tradition. But, feh. # I just added the argument to sys_waitid, rather than worrying about # changing the name in all the tables (and choosing a new stupid name). # # Signed-off-by: Roland McGrath # Signed-off-by: Linus Torvalds # # kernel/signal.c # 2004/09/15 01:26:18-07:00 roland@redhat.com +0 -4 # back out siginfo_t.si_rusage from waitid changes # # kernel/exit.c # 2004/09/15 01:25:50-07:00 roland@redhat.com +10 -7 # back out siginfo_t.si_rusage from waitid changes # # include/asm-x86_64/ia32.h # 2004/09/15 11:38:24-07:00 roland@redhat.com +0 -1 # back out siginfo_t.si_rusage from waitid changes # # include/asm-ia64/siginfo.h # 2004/09/15 11:38:30-07:00 roland@redhat.com +0 -1 # back out siginfo_t.si_rusage from waitid changes # # include/asm-generic/siginfo.h # 2004/09/15 01:26:58-07:00 roland@redhat.com +0 -2 # back out siginfo_t.si_rusage from waitid changes # # arch/x86_64/ia32/ia32_signal.c # 2004/09/15 01:46:29-07:00 roland@redhat.com +0 -2 # back out siginfo_t.si_rusage from waitid changes # # arch/sparc64/kernel/signal32.c # 2004/09/15 11:38:55-07:00 roland@redhat.com +0 -3 # back out siginfo_t.si_rusage from waitid changes # # ChangeSet # 2004/09/16 23:28:42+10:00 airlied@starflyer.(none) # drm: actually __set_current_state is more correct # # Alan suggested using __set_current_state as being more correct for # the DRM so do that. # # Signed-off-by: Dave Airlie # # drivers/char/drm/i830_irq.c # 2004/09/16 23:28:35+10:00 airlied@starflyer.(none) +2 -2 # drm: actually __set_current_state is more correct # # Alan suggested using __set_current_state as being more correct for # the DRM so do that. # # Signed-off-by: Dave Airlie # # drivers/char/drm/drm_os_linux.h # 2004/09/16 23:28:35+10:00 airlied@starflyer.(none) +2 -2 # drm: actually __set_current_state is more correct # # Alan suggested using __set_current_state as being more correct for # the DRM so do that. # # Signed-off-by: Dave Airlie # # drivers/char/drm/drm_drv.h # 2004/09/16 23:28:35+10:00 airlied@starflyer.(none) +4 -4 # drm: actually __set_current_state is more correct # # Alan suggested using __set_current_state as being more correct for # the DRM so do that. # # Signed-off-by: Dave Airlie # # ChangeSet # 2004/09/16 21:15:38+10:00 airlied@starflyer.(none) # drm: use set_current_state instead of direct assignment # # Suggested-by: Nishanth Aravamudan # Approved-by: Dave Airlie # # drivers/char/drm/i830_irq.c # 2004/09/16 21:15:31+10:00 airlied@starflyer.(none) +2 -2 # drm: use set_current_state instead of direct assignment # # Suggested-by: Nishanth Aravamudan # Approved-by: Dave Airlie # # drivers/char/drm/drm_os_linux.h # 2004/09/16 21:15:31+10:00 airlied@starflyer.(none) +2 -2 # drm: use set_current_state instead of direct assignment # # Suggested-by: Nishanth Aravamudan # Approved-by: Dave Airlie # # drivers/char/drm/drm_drv.h # 2004/09/16 21:15:31+10:00 airlied@starflyer.(none) +4 -4 # drm: use set_current_state instead of direct assignment # # Suggested-by: Nishanth Aravamudan # Approved-by: Dave Airlie # # ChangeSet # 2004/09/16 21:09:37+10:00 airlied@starflyer.(none) # drm: add pci_enable_device # # Add pci_enable_device for any PCI device we want to use. # # From: Bjorn Helgaas # Approved-by: David Airlie # # drivers/char/drm/drm_drv.h # 2004/09/16 21:09:30+10:00 airlied@starflyer.(none) +3 -0 # drm: add pci_enable_device # # Add pci_enable_device for any PCI device we want to use. # # From: Bjorn Helgaas # Approved-by: David Airlie # # ChangeSet # 2004/09/16 11:33:15+01:00 aia21@cantab.net # NTFS: Fix a potential bug in fs/ntfs/mft.c::map_extent_mft_record() that # could occur in the future for when we start closing/freeing extent # inodes if we don't set base_ni->ext.extent_ntfs_inos to NULL after # we free it. # # Signed-off-by: Anton Altaparmakov # # fs/ntfs/mft.c # 2004/09/16 11:33:06+01:00 aia21@cantab.net +2 -1 # Fix a potential bug that could occur in the future for when we start # closing/freeing extent inodes if we don't set base_ni->ext.extent_ntfs_inos # to NULL after we free it. # # ChangeSet # 2004/09/16 19:57:18+10:00 airlied@starflyer.(none) # drm: fix bug introduced in the macro removal # # This caused issues with a PCI radeon card. # # From: Jon Smirl # Approved-by: Dave Airlie # # drivers/char/drm/drm_scatter.h # 2004/09/16 19:53:12+10:00 airlied@starflyer.(none) +1 -1 # drm: fix bug introduced in the macro removal # # This caused issues with a PCI radeon card. # # From: Jon Smirl # Approved-by: Dave Airlie # # ChangeSet # 2004/09/16 02:45:22-04:00 jgarzik@pobox.com # [libata] add hook, and export functions needed for sata2 drivers # # * add dev_select hook, and default/noop implementations # * export ata_dev_classify # * fix a couple bugs that cropped up when building with # ATA_VERBOSE_DEBUG # * export __sata_phy_reset, a variant that does not call # ata_bus_reset # # include/linux/libata.h # 2004/09/16 02:45:15-04:00 jgarzik@pobox.com +5 -0 # [libata] add hook, and export functions needed for sata2 drivers # # * add dev_select hook, and default/noop implementations # * export ata_dev_classify # * fix a couple bugs that cropped up when building with # ATA_VERBOSE_DEBUG # * export __sata_phy_reset, a variant that does not call # ata_bus_reset # # drivers/scsi/sata_vsc.c # 2004/09/16 02:45:15-04:00 jgarzik@pobox.com +1 -0 # [libata] add hook, and export functions needed for sata2 drivers # # * add dev_select hook, and default/noop implementations # * export ata_dev_classify # * fix a couple bugs that cropped up when building with # ATA_VERBOSE_DEBUG # * export __sata_phy_reset, a variant that does not call # ata_bus_reset # # drivers/scsi/sata_via.c # 2004/09/16 02:45:15-04:00 jgarzik@pobox.com +1 -0 # [libata] add hook, and export functions needed for sata2 drivers # # * add dev_select hook, and default/noop implementations # * export ata_dev_classify # * fix a couple bugs that cropped up when building with # ATA_VERBOSE_DEBUG # * export __sata_phy_reset, a variant that does not call # ata_bus_reset # # drivers/scsi/sata_sx4.c # 2004/09/16 02:45:15-04:00 jgarzik@pobox.com +2 -1 # [libata] add hook, and export functions needed for sata2 drivers # # * add dev_select hook, and default/noop implementations # * export ata_dev_classify # * fix a couple bugs that cropped up when building with # ATA_VERBOSE_DEBUG # * export __sata_phy_reset, a variant that does not call # ata_bus_reset # # drivers/scsi/sata_svw.c # 2004/09/16 02:45:15-04:00 jgarzik@pobox.com +1 -0 # [libata] add hook, and export functions needed for sata2 drivers # # * add dev_select hook, and default/noop implementations # * export ata_dev_classify # * fix a couple bugs that cropped up when building with # ATA_VERBOSE_DEBUG # * export __sata_phy_reset, a variant that does not call # ata_bus_reset # # drivers/scsi/sata_sis.c # 2004/09/16 02:45:15-04:00 jgarzik@pobox.com +1 -0 # [libata] add hook, and export functions needed for sata2 drivers # # * add dev_select hook, and default/noop implementations # * export ata_dev_classify # * fix a couple bugs that cropped up when building with # ATA_VERBOSE_DEBUG # * export __sata_phy_reset, a variant that does not call # ata_bus_reset # # drivers/scsi/sata_sil.c # 2004/09/16 02:45:15-04:00 jgarzik@pobox.com +1 -0 # [libata] add hook, and export functions needed for sata2 drivers # # * add dev_select hook, and default/noop implementations # * export ata_dev_classify # * fix a couple bugs that cropped up when building with # ATA_VERBOSE_DEBUG # * export __sata_phy_reset, a variant that does not call # ata_bus_reset # # drivers/scsi/sata_promise.c # 2004/09/16 02:45:15-04:00 jgarzik@pobox.com +1 -0 # [libata] add hook, and export functions needed for sata2 drivers # # * add dev_select hook, and default/noop implementations # * export ata_dev_classify # * fix a couple bugs that cropped up when building with # ATA_VERBOSE_DEBUG # * export __sata_phy_reset, a variant that does not call # ata_bus_reset # # drivers/scsi/sata_nv.c # 2004/09/16 02:45:15-04:00 jgarzik@pobox.com +1 -0 # [libata] add hook, and export functions needed for sata2 drivers # # * add dev_select hook, and default/noop implementations # * export ata_dev_classify # * fix a couple bugs that cropped up when building with # ATA_VERBOSE_DEBUG # * export __sata_phy_reset, a variant that does not call # ata_bus_reset # # drivers/scsi/libata-core.c # 2004/09/16 02:45:15-04:00 jgarzik@pobox.com +41 -21 # [libata] add hook, and export functions needed for sata2 drivers # # * add dev_select hook, and default/noop implementations # * export ata_dev_classify # * fix a couple bugs that cropped up when building with # ATA_VERBOSE_DEBUG # * export __sata_phy_reset, a variant that does not call # ata_bus_reset # # drivers/scsi/ata_piix.c # 2004/09/16 02:45:15-04:00 jgarzik@pobox.com +2 -0 # [libata] add hook, and export functions needed for sata2 drivers # # * add dev_select hook, and default/noop implementations # * export ata_dev_classify # * fix a couple bugs that cropped up when building with # ATA_VERBOSE_DEBUG # * export __sata_phy_reset, a variant that does not call # ata_bus_reset # # ChangeSet # 2004/09/15 23:02:18+00:00 jbarnes@sgi.com # [IA64-SGI]: fix `qw' might be used uninitialized warning # # The compiler has no way of knowing whether nentries will be greater than 0, so # it was generating a warning that qw might be used uninitialized. Fix it by # explicitly setting it to 0. Cc'ing Brian in case he has an internal version # he'd like to keep in sync. # # Signed-off-by: Jesse Barnes # Signed-off-by: Tony Luck # # arch/ia64/sn/kernel/sn2/prominfo_proc.c # 2004/09/15 22:58:59+00:00 aegl@agluck-lia64.sc.intel.com +1 -1 # fix `qw' might be used uninitialized # # ChangeSet # 2004/09/15 21:34:47+00:00 tony.luck@intel.com # [IA64] make INIT dump work again # # current can be in region 5, use 'tpa' to convert to physical # # Signed-off-by: Tony Luck # # arch/ia64/kernel/minstate.h # 2004/09/15 21:32:29+00:00 aegl@agluck-lia64.sc.intel.com +1 -1 # current can be in region 5, use 'tpa' to convert to physical # # ChangeSet # 2004/09/15 13:55:32-07:00 davem@nuts.davemloft.net # [IPV4]: More fib_hash cleanups. # # Kill fn_key_eq and fn_key_leq # # Signed-off-by: David S. Miller # # net/ipv4/fib_hash.c # 2004/09/15 13:54:54-07:00 davem@nuts.davemloft.net +10 -21 # [IPV4]: More fib_hash cleanups. # # ChangeSet # 2004/09/15 16:58:53-03:00 acme@conectiva.com.br # [SOCKET] make enum socket_type be arch overridable # # To cope with MIPS, that has SOCK_STREAM and SOCK_DGRAM values swapped # to deal with binary compat. # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: Ralf Baechle # Signed-off-by: David S. Miller # # include/linux/net.h # 2004/09/15 16:58:39-03:00 acme@conectiva.com.br +9 -1 # [SOCKET] make enum socket_type be arch overridable # # To cope with MIPS, that has SOCK_STREAM and SOCK_DGRAM values swapped # to deal with binary compat. # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: Ralf Baechle # Signed-off-by: David S. Miller # # include/asm-mips/socket.h # 2004/09/15 16:58:39-03:00 acme@conectiva.com.br +27 -0 # [SOCKET] make enum socket_type be arch overridable # # To cope with MIPS, that has SOCK_STREAM and SOCK_DGRAM values swapped # to deal with binary compat. # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: Ralf Baechle # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/15 10:20:55-07:00 davem@nuts.davemloft.net # [NETFILTER]: Fix tcp_find_option() bug properly. # # Signed-off-by: David S. Miller # # net/ipv4/netfilter/ip_tables.c # 2004/09/15 10:20:14-07:00 davem@nuts.davemloft.net +5 -2 # [NETFILTER]: Fix tcp_find_option() bug properly. # # ChangeSet # 2004/09/15 09:18:46-07:00 davem@nuts.davemloft.net # [IPV4]: Use hlist_for_each_entry_safe in fib_hash_move. # # Signed-off-by: David S. Miller # # net/ipv4/fib_semantics.c # 2004/09/15 09:18:16-07:00 davem@nuts.davemloft.net +4 -4 # [IPV4]: Use hlist_for_each_entry_safe in fib_hash_move. # # ChangeSet # 2004/09/15 09:16:19-07:00 davem@nuts.davemloft.net # [IPV4]: Basic cleanups in fib_hash.c # # 1) Kill special key, prefix, and hash index types. # They make the code less readable and maintainable. # 2) __inline__ --> inline # # Signed-off-by: David S. Miller # # net/ipv4/fib_hash.c # 2004/09/15 09:15:50-07:00 davem@nuts.davemloft.net +29 -51 # [IPV4]: Basic cleanups in fib_hash.c # # 1) Kill special key, prefix, and hash index types. # They make the code less readable and maintainable. # 2) __inline__ --> inline # # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/15 08:34:58-07:00 davem@nuts.davemloft.net # [NETFILTER]: Fix off-by-one test error in ip_tables.c # # Bug noticed by Ysauyuki Kozakai. # # Signed-off-by: David S. Miller # # net/ipv4/netfilter/ip_tables.c # 2004/09/15 08:34:17-07:00 davem@nuts.davemloft.net +1 -1 # [NETFILTER]: Fix off-by-one test error in ip_tables.c # # ChangeSet # 2004/09/15 08:18:16-07:00 eric.lemoine@gmail.com # [SUNGEM]: LLTX support # # Signed-off-by: Eric Lemoine # Signed-off-by: David S. Miller # # drivers/net/sungem.c # 2004/09/15 08:17:58-07:00 eric.lemoine@gmail.com +10 -4 # [SUNGEM]: LLTX support # # Signed-off-by: Eric Lemoine # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/15 08:16:44-07:00 eric.lemoine@gmail.com # [SUNGEM]: Add tx_lock # # Using tx_lock in SunGEM makes the driver logic in conformance # with tg3 and e1000, easing maintainance. # # Signed-off-by: Eric Lemoine # Signed-off-by: David S. Miller # # drivers/net/sungem.h # 2004/09/15 08:16:05-07:00 eric.lemoine@gmail.com +1 -0 # [SUNGEM]: Add tx_lock # # drivers/net/sungem.c # 2004/09/15 08:16:05-07:00 eric.lemoine@gmail.com +58 -17 # [SUNGEM]: Add tx_lock # # ChangeSet # 2004/09/15 07:39:07-07:00 trini@kernel.crashing.org # ppc32: Fix some warnings in rheap from newer compilers # # Signed-off-by: Pantelis Antoniou # Signed-off-by: Tom Rini # # arch/ppc/lib/rheap.c # 2004/09/15 07:38:56-07:00 trini@kernel.crashing.org +4 -4 # Warning fixes. # # ChangeSet # 2004/09/15 07:25:30-07:00 vda@port.imtp.ilyichevsk.odessa.ua # [PATCH] reduce [compat_]do_execve stack usage # # Allocating the 'struct linux_binprm' on the stack chews up too much # stackspace. # # Just kmalloc it instead. # # Signed-off-by: Linus Torvalds # # fs/exec.c # 2004/09/14 16:49:49-07:00 vda@port.imtp.ilyichevsk.odessa.ua +39 -37 # reduce [compat_]do_execve stack usage # # fs/compat.c # 2004/09/14 16:24:46-07:00 vda@port.imtp.ilyichevsk.odessa.ua +37 -37 # reduce [compat_]do_execve stack usage # # ChangeSet # 2004/09/15 05:17:25-07:00 rth@kanga.twiddle.home # [ALPHA] Implement _raw_write_trylock. # # include/asm-alpha/spinlock.h # 2004/09/15 05:17:05-07:00 rth@kanga.twiddle.home +23 -0 # Implement _raw_write_trylock. # # ChangeSet # 2004/09/15 05:16:14-07:00 rth@kanga.twiddle.home # [ALPHA] Minor updates for cpumask_t. # # arch/alpha/kernel/sys_titan.c # 2004/09/15 05:15:54-07:00 rth@kanga.twiddle.home +3 -3 # Update titan_cpu_set_irq_affinity for cpumask_t. # # ChangeSet # 2004/09/14 22:32:27-07:00 yoshfuji@linux-ipv6.org # [IPV6]: Missing xfrm_lookup() in icmpv6_{send,echo_reply}() # # net/ipv6/icmp.c was not converted in xfrm_lookup() extraction patch. # This patch converts it; adding the missing call to xfrm_lookup in # icmpv6_{send,echo_reply}(). # # Signed-off-by: Kazunori Miyazawa # Signed-off-by: Hideaki YOSHIFUJI # SIgned-off-by: David S. Miller # # net/ipv6/icmp.c # 2004/09/14 22:32:09-07:00 yoshfuji@linux-ipv6.org +5 -0 # [IPV6]: Missing xfrm_lookup() in icmpv6_{send,echo_reply}() # # net/ipv6/icmp.c was not converted in xfrm_lookup() extraction patch. # This patch converts it; adding the missing call to xfrm_lookup in # icmpv6_{send,echo_reply}(). # # Signed-off-by: Kazunori Miyazawa # Signed-off-by: Hideaki YOSHIFUJI # SIgned-off-by: David S. Miller # # ChangeSet # 2004/09/14 22:21:40-07:00 davem@nuts.davemloft.net # [CRYPTO]: Zero out tfm before freeing in crypto_free_tfm(). # # Based upon discussions with Ulrich Kuehn # (ukuehn@acm.org) # # Signed-off-by: James Morris # Signed-off-by: David S. Miller # # crypto/api.c # 2004/09/14 22:21:12-07:00 davem@nuts.davemloft.net +5 -1 # [CRYPTO]: Zero out tfm before freeing in crypto_free_tfm(). # # Based upon discussions with Ulrich Kuehn # (ukuehn@acm.org) # # Signed-off-by: James Morris # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/14 22:15:26-07:00 davem@nuts.davemloft.net # [TG3]: Update driver version and reldate. # # drivers/net/tg3.c # 2004/09/14 22:15:06-07:00 davem@nuts.davemloft.net +2 -2 # [TG3]: Update driver version and reldate. # # ChangeSet # 2004/09/14 22:10:26-07:00 davem@nuts.davemloft.net # [TG3]: Recognize all onboard Sun variants, not just 5704. # # Based upon a report from Matthias Merz. # # Signed-off-by: David S. Miller # # drivers/net/tg3.h # 2004/09/14 22:09:48-07:00 davem@nuts.davemloft.net +1 -1 # [TG3]: Recognize all onboard Sun variants, not just 5704. # # drivers/net/tg3.c # 2004/09/14 22:09:48-07:00 davem@nuts.davemloft.net +14 -20 # [TG3]: Recognize all onboard Sun variants, not just 5704. # # ChangeSet # 2004/09/14 22:06:01-07:00 michael.waychison@sun.com # [TG3]: Fix thinko in 5704 fibre hw autoneg code. # # Signed-off-by: Mike Waychison # Signed-off-by: David S. Miller # # drivers/net/tg3.c # 2004/09/14 22:05:42-07:00 michael.waychison@sun.com +1 -1 # [TG3]: Fix thinko in 5704 fibre hw autoneg code. # # Signed-off-by: Mike Waychison # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/14 22:03:10-07:00 davem@nuts.davemloft.net # [IPV4]: Make fib_semantics algorithms scale better. # # A singly linked list was previously used to # do fib_info object lookup for various actions # in the routing code. This does not scale very # well with many devices and even a moderate number # of routes. This was noted by Benjamin Lahaise. # # To fix all of this we use 3 hash tables, two of # which grow dynamically as the number fib_info # objects increases while the final one is fixes in # size. # # The statically sized table hashes on device index. # This is used for fib_sync_down, fib_sync_up, and # ip_fib_check_default. # # The first dynamically sized table is keyed on # protocol, prefsrc, and priority. This is used # by fib_create_info() to look for existing fib_info # objects matching the new one being constructed. # # The last dynamically sized table is keyed on # the preferred source of the route if it has one # specified. This is used by fib_sync_down when # a local address disappears. # # There are still some scalability problems for # Bens test case in fib_hash.c and I will try to # attack those next. # # Signed-off-by: David S. Miller # # net/ipv4/fib_semantics.c # 2004/09/14 22:02:13-07:00 davem@nuts.davemloft.net +241 -36 # [IPV4]: Make fib_semantics algorithms scale better. # # A singly linked list was previously used to # do fib_info object lookup for various actions # in the routing code. This does not scale very # well with many devices and even a moderate number # of routes. This was noted by Benjamin Lahaise. # # To fix all of this we use 3 hash tables, two of # which grow dynamically as the number fib_info # objects increases while the final one is fixes in # size. # # The statically sized table hashes on device index. # This is used for fib_sync_down, fib_sync_up, and # ip_fib_check_default. # # The first dynamically sized table is keyed on # protocol, prefsrc, and priority. This is used # by fib_create_info() to look for existing fib_info # objects matching the new one being constructed. # # The last dynamically sized table is keyed on # the preferred source of the route if it has one # specified. This is used by fib_sync_down when # a local address disappears. # # There are still some scalability problems for # Bens test case in fib_hash.c and I will try to # attack those next. # # Signed-off-by: David S. Miller # # include/net/ip_fib.h # 2004/09/14 22:02:13-07:00 davem@nuts.davemloft.net +12 -12 # [IPV4]: Make fib_semantics algorithms scale better. # # A singly linked list was previously used to # do fib_info object lookup for various actions # in the routing code. This does not scale very # well with many devices and even a moderate number # of routes. This was noted by Benjamin Lahaise. # # To fix all of this we use 3 hash tables, two of # which grow dynamically as the number fib_info # objects increases while the final one is fixes in # size. # # The statically sized table hashes on device index. # This is used for fib_sync_down, fib_sync_up, and # ip_fib_check_default. # # The first dynamically sized table is keyed on # protocol, prefsrc, and priority. This is used # by fib_create_info() to look for existing fib_info # objects matching the new one being constructed. # # The last dynamically sized table is keyed on # the preferred source of the route if it has one # specified. This is used by fib_sync_down when # a local address disappears. # # There are still some scalability problems for # Bens test case in fib_hash.c and I will try to # attack those next. # # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/14 21:23:34-07:00 herbert@gondor.apana.org.au # [NET]: Convert RTM+_* to enum. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # include/linux/rtnetlink.h # 2004/09/14 21:23:04-07:00 herbert@gondor.apana.org.au +83 -47 # [NET]: Convert RTM+_* to enum. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/14 22:25:41-04:00 ananth@broadcom.com # [libata sata_svw] race condition fix, new device support # # * address race condition WRT order of DMA-start and ATA command issue # (see code comment for more details) # # * Add support for Frodo 4/8 # # drivers/scsi/sata_svw.c # 2004/09/14 22:25:34-04:00 ananth@broadcom.com +70 -2 # [libata sata_svw] race condition fix, new device support # # * address race condition WRT order of DMA-start and ATA command issue # (see code comment for more details) # # * Add support for Frodo 4/8 # # ChangeSet # 2004/09/14 22:23:54-04:00 jgarzik@pobox.com # [libata] minor comment updates, preparing for iomap merge # # drivers/scsi/sata_nv.c # 2004/09/14 22:23:47-04:00 jgarzik@pobox.com +0 -2 # [libata] minor comment updates, preparing for iomap merge # # drivers/scsi/libata-core.c # 2004/09/14 22:23:47-04:00 jgarzik@pobox.com +13 -13 # [libata] minor comment updates, preparing for iomap merge # # ChangeSet # 2004/09/14 17:40:07-07:00 torvalds@ppc970.osdl.org # Fix up typo in ppc64 eeh ioport_map() code. # # Noticed by BenH, happily harmless (nothing that uses that # code has been committed yet, and PIO seems to be pretty much # unused on at least the Apple G5 machines: all the normal # hardware is set up purely for MMIO, to the point that I # couldn't even test this thing). # # arch/ppc64/kernel/eeh.c # 2004/09/14 17:40:01-07:00 torvalds@ppc970.osdl.org +1 -1 # Fix up typo in ppc64 eeh ioport_map() code. # # Noticed by BenH, happily harmless (nothing that uses that # code has been committed yet, and PIO seems to be pretty much # unused on at least the Apple G5 machines: all the normal # hardware is set up purely for MMIO, to the point that I # couldn't even test this thing). # # ChangeSet # 2004/09/14 16:28:53-07:00 torvalds@ppc970.osdl.org # Add support for "string" ioread/iowrite. # # Things like SATA use this for data transfer. # # Also export the iomap routines on ppc64. # # lib/iomap.c # 2004/09/14 16:28:47-07:00 torvalds@ppc970.osdl.org +85 -0 # Add support for "string" ioread/iowrite. # # Things like SATA use this for data transfer. # # include/asm-generic/iomap.h # 2004/09/14 16:28:47-07:00 torvalds@ppc970.osdl.org +19 -0 # Add support for "string" ioread/iowrite. # # Things like SATA use this for data transfer. # # arch/ppc64/kernel/eeh.c # 2004/09/14 16:28:47-07:00 torvalds@ppc970.osdl.org +54 -0 # Add support for "string" ioread/iowrite. # # Things like SATA use this for data transfer. # # ChangeSet # 2004/09/14 16:12:54-07:00 trini@kernel.crashing.org # ppc32: Don't make cmd_line be an emptry string # # As noted by Olaf Hering, CONFIG_CMDLINE didn't work on PMacs # as we made cmd_line be an empty string and then looked for the # cmdline in odd places. # # Signed-off-by: Tom Rini # # arch/ppc/kernel/setup.c # 2004/09/14 16:12:44-07:00 trini@kernel.crashing.org +0 -1 # Don't terminate the cmd_line again. It's alredy been zeroed # and may have already been set. # # ChangeSet # 2004/09/14 14:11:23-07:00 davem@nuts.davemloft.net # [IPV4]: Use list.h facilities for fib_info_list. # # Do not use a by-hand list implementation. # # Signed-off-by: David S. Miller # # net/ipv4/fib_semantics.c # 2004/09/14 14:10:47-07:00 davem@nuts.davemloft.net +4 -13 # [IPV4]: Use list.h facilities for fib_info_list. # # include/net/ip_fib.h # 2004/09/14 14:10:47-07:00 davem@nuts.davemloft.net +1 -2 # [IPV4]: Use list.h facilities for fib_info_list. # # ChangeSet # 2004/09/14 14:03:47-07:00 yoshfuji@linux-ipv6.org # [IPV6]: Do not export rt6_dflt_{pointer,lock}. # # Modify them using exported procedural interfaces instead. # # Signed-off-by: Hideaki YOSHIFUJI # Signed-off-by; David S. Miller # # net/ipv6/route.c # 2004/09/14 14:03:30-07:00 yoshfuji@linux-ipv6.org +12 -6 # [IPV6]: Do not export rt6_dflt_{pointer,lock}. # # Modify them using exported procedural interfaces instead. # # Signed-off-by: Hideaki YOSHIFUJI # Signed-off-by; David S. Miller # # net/ipv6/ip6_fib.c # 2004/09/14 14:03:30-07:00 yoshfuji@linux-ipv6.org +1 -7 # [IPV6]: Do not export rt6_dflt_{pointer,lock}. # # Modify them using exported procedural interfaces instead. # # Signed-off-by: Hideaki YOSHIFUJI # Signed-off-by; David S. Miller # # include/net/ip6_route.h # 2004/09/14 14:03:30-07:00 yoshfuji@linux-ipv6.org +2 -0 # [IPV6]: Do not export rt6_dflt_{pointer,lock}. # # Modify them using exported procedural interfaces instead. # # Signed-off-by: Hideaki YOSHIFUJI # Signed-off-by; David S. Miller # # ChangeSet # 2004/09/14 13:57:17-07:00 davem@nuts.davemloft.net # Merge bk://kernel.bkbits.net/acme/net-2.6 # into nuts.davemloft.net:/disk1/BK/net-2.6 # # net/ipv4/tcp_ipv4.c # 2004/09/14 13:57:07-07:00 davem@nuts.davemloft.net +0 -0 # Auto merged # # include/net/tcp.h # 2004/09/14 13:57:07-07:00 davem@nuts.davemloft.net +0 -0 # Auto merged # # ChangeSet # 2004/09/14 10:38:50-07:00 torvalds@ppc970.osdl.org # ppc64: first cut at new iomap interfaces. # # Only the EEH case (pSeries) handled for now. # # arch/ppc64/kernel/eeh.c # 2004/09/14 10:38:43-07:00 torvalds@ppc970.osdl.org +68 -0 # ppc64: first cut at new iomap interfaces. # # Only the EEH case (pSeries) handled for now. # # arch/ppc64/Kconfig # 2004/09/14 10:38:43-07:00 torvalds@ppc970.osdl.org +0 -4 # ppc64: first cut at new iomap interfaces. # # Only the EEH case (pSeries) handled for now. # # ChangeSet # 2004/09/14 09:36:53-07:00 torvalds@ppc970.osdl.org # Update shipped version of zconfig.tab.c to match bison/yacc file. # # scripts/kconfig/zconf.tab.c_shipped # 2004/09/14 09:36:46-07:00 torvalds@ppc970.osdl.org +2 -0 # Update shipped version of zconfig.tab.c to match bison/yacc file. # # ChangeSet # 2004/09/14 09:33:17-07:00 zippel@linux-m68k.org # [PATCH] properly fix double current_menu # # The two current_menu variables are really two separate variables, so keep # them separate. # # Signed-off-by: Roman Zippel # Signed-off-by: Linus Torvalds # # scripts/kconfig/zconf.y # 2004/09/14 06:46:41-07:00 zippel@linux-m68k.org +2 -0 # properly fix double current_menu # # scripts/kconfig/menu.c # 2004/09/14 06:46:42-07:00 zippel@linux-m68k.org +0 -1 # properly fix double current_menu # # scripts/kconfig/mconf.c # 2004/09/14 06:51:44-07:00 zippel@linux-m68k.org +1 -1 # properly fix double current_menu # # scripts/kconfig/lkc.h # 2004/09/14 06:44:58-07:00 zippel@linux-m68k.org +0 -3 # properly fix double current_menu # # ChangeSet # 2004/09/14 09:32:22-07:00 levon@movementarian.org # [PATCH] fix OProfile locking # # This makes OProgile use get_task_mm() as discussed. It also fixes up # Anton's previous patch. Zwane's soaked this patch all night w/o # problems. # # kernel/fork.c # 2004/09/13 13:39:03-07:00 levon@movementarian.org +2 -0 # fix OProfile locking # # drivers/oprofile/cpu_buffer.h # 2004/09/13 13:45:26-07:00 levon@movementarian.org +2 -2 # fix OProfile locking # # drivers/oprofile/cpu_buffer.c # 2004/09/13 13:45:29-07:00 levon@movementarian.org +6 -6 # fix OProfile locking # # drivers/oprofile/buffer_sync.c # 2004/09/13 13:50:51-07:00 levon@movementarian.org +11 -26 # fix OProfile locking # # ChangeSet # 2004/09/14 09:17:49-07:00 torvalds@ppc970.osdl.org # Fix up stupid last-minute edit of fork cleanup. # # I'm a retard. # # kernel/fork.c # 2004/09/14 09:17:43-07:00 torvalds@ppc970.osdl.org +1 -1 # Fix up stupid last-minute edit of fork cleanup. # # I'm a retard. # # ChangeSet # 2004/09/14 09:15:35-07:00 torvalds@ppc970.osdl.org # fivafb; Increase DDC/CI timeouts # # Nicolas Boichat reports that his monitor needs the slower # i2c bus timings. These values also match atyfb and the # original ones. # # drivers/video/riva/rivafb-i2c.c # 2004/09/14 09:15:29-07:00 torvalds@ppc970.osdl.org +2 -2 # fivafb; Increase DDC/CI timeouts # # Nicolas Boichat reports that his monitor needs the slower # i2c bus timings. These values also match atyfb and the # original ones. # # ChangeSet # 2004/09/14 09:04:35-07:00 torvalds@ppc970.osdl.org # Fix fork failure case. # # It would clear the segment registers in the parent, which # wasn't really intentional. Noticed by Andries Brouwer. # # # kernel/fork.c # 2004/09/14 09:04:28-07:00 torvalds@ppc970.osdl.org +1 -3 # Fix fork failure case. # # It would clear the segment registers in the parent, which # wasn't really intentional. Noticed by Andries Brouwer. # # ChangeSet # 2004/09/14 08:54:40-07:00 mingo@elte.hu # [PATCH] i386: elf_read_implies_exec() fixup # # The final ia64 related cleanup to elf_read_implies_exec() seems to have # broken it. The effect is that the READ_IMPLIES_EXEC flag is never set # for !pt_gnu_stack binaries! # # That's a bit more secure than we need to be, and might break some legacy # app that doesn't expect it. # # include/asm-i386/elf.h # 2004/09/13 17:00:00-07:00 mingo@elte.hu +1 -1 # i386: elf_read_implies_exec() fixup # # ChangeSet # 2004/09/14 08:38:02-07:00 ak@suse.de # [PATCH] Fix ABI in set_mempolicy() # # Fix ABI in set_mempolicy() that got broken by an earlier change. # # Add a check for very big input values and prevent excessive looping in the # kernel. # # Cc: Paul "nyer, nyer, your mother wears combat boots!" Jackson # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # mm/mempolicy.c # 2004/09/13 18:56:13-07:00 ak@suse.de +3 -0 # Fix ABI in set_mempolicy() # # ChangeSet # 2004/09/14 07:52:00-07:00 mpm@selenic.com # [PATCH] netpoll endian fixes # # Correct wrong ip header in netpoll_send_udp. # # Signed-off-by: Duncan Sands # Signed-off-by: Matt Mackall # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # net/core/netpoll.c # 2004/09/13 17:23:26-07:00 mpm@selenic.com +2 -2 # netpoll endian fixes # # ChangeSet # 2004/09/14 07:51:48-07:00 hch@lst.de # [PATCH] mark amiflop non-unloadable # # As it's using the obsolete MOD_{INC,DEC}_USE_COUNT it's implicitly locked # already, but let's remove them and make it explicit so these macros can go # away completely without breaking m68k compile. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/block/amiflop.c # 2004/09/13 17:23:25-07:00 hch@lst.de +2 -14 # mark amiflop non-unloadable # # ChangeSet # 2004/09/14 07:51:36-07:00 hch@lst.de # [PATCH] crept back in h8300 and sh64 # # went away in 2.5, but new ports keep adding instances again # and again. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # BitKeeper/deleted/.del-softirq.h~5870f0a8abafdf84 # 2004/09/14 07:51:30-07:00 hch@lst.de +0 -0 # Delete: include/asm-h8300/softirq.h # # BitKeeper/deleted/.del-softirq.h~2d71a252808115bb # 2004/09/14 07:51:30-07:00 hch@lst.de +0 -0 # Delete: include/asm-sh64/softirq.h # # ChangeSet # 2004/09/14 07:51:24-07:00 roland@frob.com # [PATCH] BSD disklabel: handle more than 8 partitions # # NetBSD allows 16 partitions, not just 8. This patch both ups the number, # and makes the recognition code tell you if the count in the disklabel # exceeds the number supported by the kernel. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/linux/genhd.h # 2004/09/13 17:23:25-07:00 roland@frob.com +1 -1 # BSD disklabel: handle more than 8 partitions # # fs/partitions/msdos.c # 2004/09/13 17:23:25-07:00 roland@frob.com +3 -0 # BSD disklabel: handle more than 8 partitions # # ChangeSet # 2004/09/14 07:51:13-07:00 hch@lst.de # [PATCH] small tweaks # # - I misspelled CONFIG_PREEMPT CONFIG_PREEPT as various people noticed. # But in fact that ifdef should just go, else we'll get drivers that # compile with CONFIG_PREEMPT but not without sooner or later. # # - remove unused hardirq_trylock and hardirq_endlock # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/linux/hardirq.h # 2004/09/13 17:23:24-07:00 hch@lst.de +0 -5 # small tweaks # # ChangeSet # 2004/09/14 07:51:00-07:00 jbarnes@engr.sgi.com # [PATCH] fix uninitialized warnings in mempolicy.c # # err may be used uninitialized in mempolicy.c in both compat_set_mempolicy # and compat_mbind. This patch fixes that by setting them both to 0. # # Signed-off-by: Jesse Barnes # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # mm/mempolicy.c # 2004/09/13 17:23:24-07:00 jbarnes@engr.sgi.com +2 -2 # fix uninitialized warnings in mempolicy.c # # ChangeSet # 2004/09/14 07:50:46-07:00 dsaxena@plexity.net # [PATCH] Add support for word-length UART registers # # UARTS on several Intel IXP2000 systems are connected in such a way that # they can only be addressed using full word accesses instead of bytes. # Following patch adds a UPIO_MEM32 io-type to identify these UARTs. # # Signed-off-by: Deepak Saxena # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/linux/serial_core.h # 2004/09/13 17:23:24-07:00 dsaxena@plexity.net +1 -0 # Add support for word-length UART registers # # drivers/serial/serial_core.c # 2004/09/13 17:23:24-07:00 dsaxena@plexity.net +1 -0 # Add support for word-length UART registers # # drivers/serial/8250.c # 2004/09/13 17:23:24-07:00 dsaxena@plexity.net +7 -0 # Add support for word-length UART registers # # ChangeSet # 2004/09/14 07:50:33-07:00 axboe@suse.de # [PATCH] block highmem flushes # # Add a couple of missing cache flushes to the bouncing code. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # mm/highmem.c # 2004/09/13 17:23:24-07:00 axboe@suse.de +2 -0 # block highmem flushes # # ChangeSet # 2004/09/14 07:50:21-07:00 blaisorblade_spam@yahoo.it # [PATCH] uml: remove CONFIG_UML_SMP # # Using CONFIG_UML_SMP and then making CONFIG_SMP = CONFIG_UML_SMP is useless # (there was a reason in 2.4, to have different help texts, but not now). # # Signed-off-by: Paolo 'Blaisorblade' Giarrusso # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/Kconfig # 2004/09/13 17:23:23-07:00 blaisorblade_spam@yahoo.it +2 -5 # uml: remove CONFIG_UML_SMP # # ChangeSet # 2004/09/14 07:50:09-07:00 blaisorblade_spam@yahoo.it # [PATCH] uml: smp build fix # # From: Sonny Rao # # Make the SMP code compile, at least, to make testing possible, and remove # its dependency on CONFIG_BROKEN. # # Signed-off-by: Paolo 'Blaisorblade' Giarrusso # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-um/spinlock.h # 2004/09/13 17:23:23-07:00 blaisorblade_spam@yahoo.it +6 -0 # uml: smp build fix # # include/asm-um/smp.h # 2004/09/13 17:23:23-07:00 blaisorblade_spam@yahoo.it +2 -0 # uml: smp build fix # # arch/um/kernel/smp.c # 2004/09/13 17:23:23-07:00 blaisorblade_spam@yahoo.it +7 -1 # uml: smp build fix # # include/asm-um/spinlock.h # 2004/09/13 17:23:23-07:00 blaisorblade_spam@yahoo.it +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-um/spinlock.h # # ChangeSet # 2004/09/14 07:49:54-07:00 blaisorblade_spam@yahoo.it # [PATCH] uml: remove commented old code in Kconfig # # Drop a config option which has disappeared from all archs. Btw, this # shouldn't be in the UML-specific part, but since we cannot include generic # Kconfigs to avoid problem with hardware-related configs, it's duplicated # for now. # # Signed-off-by: Paolo 'Blaisorblade' Giarrusso # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/Kconfig_char # 2004/09/13 17:23:23-07:00 blaisorblade_spam@yahoo.it +0 -5 # uml: remove commented old code in Kconfig # # ChangeSet # 2004/09/14 07:49:42-07:00 blaisorblade_spam@yahoo.it # [PATCH] uml: refer to CONFIG_USERMODE, not to CONFIG_UM # # Correct one Kconfig dependency, which should refer to CONFIG_USERMODE # rather than to CONFIG_UM. # # We should also figure out how to make the config process work better for # UML. We would like to make UML able to "source drivers/Kconfig" and have # the right drivers selectable (i.e. LVM, ramdisk, and so on) and the ones # for actual hardware excluded. I've been reading such a request even from # Jeff Dike at the last Kernel Summit, (in the lwn.net coverage) but without # any followup. # # Signed-off-by: Paolo 'Blaisorblade' Giarrusso # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/char/Kconfig # 2004/09/13 17:23:23-07:00 blaisorblade_spam@yahoo.it +1 -1 # uml: refer to CONFIG_USERMODE, not to CONFIG_UM # # ChangeSet # 2004/09/14 07:49:28-07:00 jdike@addtoit.com # [PATCH] uml: disable pending signals across a reboot # # On reboot, all signals and signal sources are disabled so that # late-arriving signals don't show up after the reboot exec, confusing the # new image, which is not expecting signals yet. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/os-Linux/file.c # 2004/09/13 17:23:23-07:00 jdike@addtoit.com +10 -0 # uml: disable pending signals across a reboot # # arch/um/kernel/time.c # 2004/09/13 17:23:23-07:00 jdike@addtoit.com +9 -0 # uml: disable pending signals across a reboot # # arch/um/kernel/irq_user.c # 2004/09/13 17:23:23-07:00 jdike@addtoit.com +14 -0 # uml: disable pending signals across a reboot # # arch/um/include/time_user.h # 2004/09/13 17:23:23-07:00 jdike@addtoit.com +1 -0 # uml: disable pending signals across a reboot # # arch/um/include/os.h # 2004/09/13 17:23:23-07:00 jdike@addtoit.com +1 -0 # uml: disable pending signals across a reboot # # arch/um/include/irq_user.h # 2004/09/13 17:23:23-07:00 jdike@addtoit.com +1 -0 # uml: disable pending signals across a reboot # # ChangeSet # 2004/09/14 07:49:16-07:00 jdike@addtoit.com # [PATCH] uml: fix binary layout assumption # # This patch calculates section boundaries differently so as to not get # tripped up by holes in the binary such as are introduced by exec-shield. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/kernel/um_arch.c # 2004/09/13 17:23:22-07:00 jdike@addtoit.com +11 -1 # uml: fix binary layout assumption # # arch/um/kernel/tt/process_kern.c # 2004/09/13 17:23:22-07:00 jdike@addtoit.com +1 -1 # uml: fix binary layout assumption # # ChangeSet # 2004/09/14 07:49:04-07:00 jdike@addtoit.com # [PATCH] uml: fix scheduler race # # This fixes a use-after-free bug in the context switching. A process going # out of context after exiting wakes up the next process and then kills # itself. The problem is that when it gets around to killing itself is up to # the host and can happen a long time later, including after the incoming # process has freed its stack, and that memory is possibly being used for # something else. # # The fix is to have the incoming process kill the exiting process just to # make sure it can't be running at the point that its stack is freed. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/kernel/tt/process_kern.c # 2004/09/13 17:23:22-07:00 jdike@addtoit.com +13 -1 # uml: fix scheduler race # # ChangeSet # 2004/09/14 07:48:53-07:00 jdike@addtoit.com # [PATCH] uml: eliminate useless thread field # # This patch eliminates use of task.thread.kernel_stack. It was unnecessary, # confusing, and was masking some kernel stack size assumptions. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-um/processor-generic.h # 2004/09/13 17:23:22-07:00 jdike@addtoit.com +0 -2 # uml: eliminate useless thread field # # arch/um/kernel/um_arch.c # 2004/09/13 17:23:22-07:00 jdike@addtoit.com +0 -3 # uml: eliminate useless thread field # # arch/um/kernel/tt/process_kern.c # 2004/09/13 17:23:22-07:00 jdike@addtoit.com +4 -5 # uml: eliminate useless thread field # # arch/um/kernel/tt/exec_kern.c # 2004/09/13 17:23:22-07:00 jdike@addtoit.com +1 -2 # uml: eliminate useless thread field # # arch/um/kernel/skas/process_kern.c # 2004/09/13 17:23:22-07:00 jdike@addtoit.com +2 -3 # uml: eliminate useless thread field # # arch/um/kernel/process_kern.c # 2004/09/13 17:23:22-07:00 jdike@addtoit.com +1 -4 # uml: eliminate useless thread field # # arch/um/kernel/process.c # 2004/09/13 17:23:22-07:00 jdike@addtoit.com +1 -1 # uml: eliminate useless thread field # # ChangeSet # 2004/09/14 07:48:40-07:00 jdike@addtoit.com # [PATCH] uml: remove ghash.h # # Remove dependency on ghash.h. Remvoe ghash.h, too. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/um/kernel/physmem.c # 2004/09/13 17:23:22-07:00 jdike@addtoit.com +48 -48 # uml: remove ghash.h # # BitKeeper/deleted/.del-ghash.h~17597075be73f07b # 2004/09/14 07:48:32-07:00 jdike@addtoit.com +0 -0 # Delete: include/linux/ghash.h # # ChangeSet # 2004/09/14 07:48:26-07:00 rsa@us.ibm.com # [PATCH] HVCS fix to replace yield with tty_wait_until_sent in hvcs_close # # Following the same advice you gave in a recent hvc_console patch I have # modified HVCS to remove a while() { yield(); } from hvcs_close() which may # cause problems where real time scheduling is concerned and replaced it with # tty_wait_until_sent() which uses a real wait queue and is the proper method # for blocking a tty operation while waiting for data to be sent. This patch # has been tested to verify that all the paths of code that were changed were # hit during the code run and performed as expected including hotplug remove # of hvcs adapters and hangup of ttys. # # - Replaced yield() in hvcs_close() with tty_wait_until_sent() to prevent # possible lockup with realtime scheduling. # # - Removed hvcs_final_close() and reordered cleanup operations to prevent # discarding of pending data during an hvcs_close() call. # # - Removed spinlock protection of hvcs_struct data members in # hvcs_write_room() and hvcs_chars_in_buffer() because they aren't needed. # # Signed-off-by: Ryan S. Arnold # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/char/hvcs.c # 2004/09/13 17:23:21-07:00 rsa@us.ibm.com +43 -64 # HVCS fix to replace yield with tty_wait_until_sent in hvcs_close # # ChangeSet # 2004/09/14 07:48:14-07:00 mingo@elte.hu # [PATCH] blk: max_sectors tunables # # Introduces two new /sys/block values: # # /sys/block/*/queue/max_hw_sectors_kb # /sys/block/*/queue/max_sectors_kb # # max_hw_sectors_kb is the maximum that the driver can handle and is # readonly. max_sectors_kb is the current max_sectors value and can be tuned # by root. PAGE_SIZE granularity is enforced. # # It's all locking-safe and all affected layered drivers have been updated as # well. The patch has been in testing for a couple of weeks already as part # of the voluntary-preempt patches and it works just fine - people use it to # reduce IDE IRQ handling latencies. # # Signed-off-by: Ingo Molnar # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/linux/blkdev.h # 2004/09/13 17:23:21-07:00 mingo@elte.hu +1 -0 # blk: max_sectors tunables # # drivers/md/raid1.c # 2004/09/13 17:23:21-07:00 mingo@elte.hu +2 -2 # blk: max_sectors tunables # # drivers/md/raid0.c # 2004/09/13 17:23:21-07:00 mingo@elte.hu +1 -1 # blk: max_sectors tunables # # drivers/md/multipath.c # 2004/09/13 17:23:21-07:00 mingo@elte.hu +2 -2 # blk: max_sectors tunables # # drivers/md/linear.c # 2004/09/13 17:23:21-07:00 mingo@elte.hu +1 -1 # blk: max_sectors tunables # # drivers/md/dm-table.c # 2004/09/13 17:23:21-07:00 mingo@elte.hu +1 -1 # blk: max_sectors tunables # # drivers/block/ll_rw_blk.c # 2004/09/13 17:23:21-07:00 mingo@elte.hu +66 -4 # blk: max_sectors tunables # # ChangeSet # 2004/09/14 07:48:01-07:00 ak@suse.de # [PATCH] Add prctl to modify current->comm # # This patch adds a prctl to modify current->comm as shown in /proc. This # feature was requested by KDE developers. In KDE most programs are started by # forking from a kdeinit program that already has the libraries loaded and some # other state. # # Problem is to give these forked programs the proper name. It already writes # the command line in the environment (as seen in ps), but top uses a different # field in /proc/pid/status that reports current->comm. And that was always # "kdeinit" instead of the real command name. So you ended up with lots of # kdeinits in your top listing, which was not very useful. # # This patch adds a new prctl PR_SET_NAME to allow a program to change its comm # field. # # I considered the potential security issues of a program obscuring itself with # this interface, but I don't think it matters much because a program can # already obscure itself when the admin uses ps instead of top. In case of a # KDE desktop calling everything kdeinit is much more obfuscation than the # alternative. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # kernel/sys.c # 2004/09/13 17:23:21-07:00 ak@suse.de +11 -0 # Add prctl to modify current->comm # # include/linux/prctl.h # 2004/09/13 17:23:21-07:00 ak@suse.de +2 -0 # Add prctl to modify current->comm # # ChangeSet # 2004/09/14 07:47:51-07:00 hch@lst.de # [PATCH] remove exports from audit code # # Tons of exports in the new audit code, but not a single module that # actually uses one of them. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # kernel/auditsc.c # 2004/09/13 17:23:21-07:00 hch@lst.de +1 -8 # remove exports from audit code # # kernel/audit.c # 2004/09/13 17:23:21-07:00 hch@lst.de +0 -13 # remove exports from audit code # # ChangeSet # 2004/09/14 07:47:38-07:00 hch@lst.de # [PATCH] mark dq_list_lock static # # Only used in dq_list_lock these days. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/linux/quota.h # 2004/09/13 17:23:20-07:00 hch@lst.de +0 -1 # mark dq_list_lock static # # fs/dquot.c # 2004/09/13 17:23:20-07:00 hch@lst.de +1 -2 # mark dq_list_lock static # # ChangeSet # 2004/09/14 07:47:27-07:00 hch@lst.de # [PATCH] mark md_interrupt_thread static # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/linux/raid/md.h # 2004/09/13 17:23:20-07:00 hch@lst.de +0 -1 # mark md_interrupt_thread static # # drivers/md/md.c # 2004/09/13 17:23:20-07:00 hch@lst.de +1 -2 # mark md_interrupt_thread static # # ChangeSet # 2004/09/14 07:47:15-07:00 hch@lst.de # [PATCH] make kmem_find_general_cachep static in slab.c # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # mm/slab.c # 2004/09/13 17:23:20-07:00 hch@lst.de +16 -18 # make kmem_find_general_cachep static in slab.c # # include/linux/slab.h # 2004/09/13 17:23:20-07:00 hch@lst.de +0 -1 # make kmem_find_general_cachep static in slab.c # # ChangeSet # 2004/09/14 07:47:02-07:00 juhl-lkml@dif.dk # [PATCH] __copy_to_user() check in cdrom_read_cdda_old() # # akpm: really, reads are supposed to return the number-of-bytes-read on faults, # or -EFAULT of no bytes were read. This patch returns either zero or -EFAULT, # ignoring any successfully transferred data. But the user interface (whcih is # an ioctl()) was never set up to do that. # # Signed-off-by: Jesper Juhl # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/cdrom/cdrom.c # 2004/09/13 17:23:20-07:00 juhl-lkml@dif.dk +10 -5 # __copy_to_user() check in cdrom_read_cdda_old() # # ChangeSet # 2004/09/14 07:46:50-07:00 anton@samba.org # [PATCH] Allocate correct amount of memory for pid hash # # We are now allocating twice as much memory as required. # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # kernel/pid.c # 2004/09/13 17:23:19-07:00 anton@samba.org +1 -1 # Allocate correct amount of memory for pid hash # # ChangeSet # 2004/09/14 07:46:38-07:00 hugh@veritas.com # [PATCH] shmem: Copyright file_setup trivia # # I _think_ shmem_file_setup is protected against negative loff_t size by the # TASK_SIZE in each arch, but prefer the security of an explicit test. Wipe # those parentheses off its return(file), and update our Copyright. # # Signed-off-by: Hugh Dickins # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # mm/shmem.c # 2004/09/13 17:23:19-07:00 hugh@veritas.com +4 -4 # shmem: Copyright file_setup trivia # # ChangeSet # 2004/09/14 07:46:25-07:00 hugh@veritas.com # [PATCH] shmem: rework majmin and ZERO_PAGE # # Very minor adjustments to shmem_getpage return path: I now prefer it to return # NULL and let do_shmem_file_read use ZERO_PAGE(0) in that case; and we don't # need a local majmin variable, do_no_page initializes *type to VM_FAULT_MINOR # already. # # Signed-off-by: Hugh Dickins # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # mm/shmem.c # 2004/09/13 17:23:18-07:00 hugh@veritas.com +12 -14 # shmem: rework majmin and ZERO_PAGE # # ChangeSet # 2004/09/14 07:46:13-07:00 hugh@veritas.com # [PATCH] shmem: avoid the shmem_inodes list # # If we're thinking about shmem scalability... isn't it silly that each shmem # object is added to the shmem_inodes list on creation, and removed on deletion, # yet the only use for that list is in swapoff (shmem_unuse)? # # Call it shmem_swaplist; shmem_writepage add inode to swaplist when first swap # allocated (usually never); shmem_delete_inode remove inode from the list after # truncating (if called before, inode could be re-added to it). # # Inode can remain on the swaplist after all its pages are swapped back in, just # be lazy about it; but if shmem_unuse finds swapped count now 0, save itself # time by then removing that inode from the swaplist. # # Signed-off-by: Hugh Dickins # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # mm/shmem.c # 2004/09/13 17:23:18-07:00 hugh@veritas.com +24 -19 # shmem: avoid the shmem_inodes list # # include/linux/shmem_fs.h # 2004/09/13 17:23:18-07:00 hugh@veritas.com +1 -1 # shmem: avoid the shmem_inodes list # # ChangeSet # 2004/09/14 07:46:01-07:00 hugh@veritas.com # [PATCH] shmem: no sbinfo for tmpfs mount? # # Some might want a tmpfs mount with the improved scalability afforded by # omitting shmem superblock accounting; or some might just want to test it in an # externally-visible tmpfs mount instance. # # Adopt the convention that mount option -o nr_blocks=0,nr_inodes=0 means # without resource limits, and hence no shmem_sb_info. Not recommended for # general use, but no worse than ramfs. # # Disallow remounting from unlimited to limited (no accounting has been done so # far, so no idea whether it's permissible), and from limited to unlimited # (because we'd need then to free the sbinfo, and visit each inode to reset its # i_blocks to 0: why bother?). # # Signed-off-by: Hugh Dickins # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # mm/shmem.c # 2004/09/13 17:23:18-07:00 hugh@veritas.com +41 -19 # shmem: no sbinfo for tmpfs mount? # # Documentation/filesystems/tmpfs.txt # 2004/09/13 17:23:18-07:00 hugh@veritas.com +6 -0 # shmem: no sbinfo for tmpfs mount? # # ChangeSet # 2004/09/14 07:45:49-07:00 hugh@veritas.com # [PATCH] shmem: no sbinfo for shm mount # # SGI investigations have shown a dramatic contrast in scalability between # anonymous memory and shmem objects. Processes building distinct shmem objects # in parallel hit heavy contention on shmem superblock stat_lock. Across 256 # cpus an intensive test runs 300 times slower than anonymous. # # Jack Steiner has observed that all the shmem superblock free_blocks and # free_inodes accounting is redundant in the case of the internal mount used for # SysV shared memory and for shared writable /dev/zero objects (the cases which # most concern them): it specifically declines to limit. # # Based upon Brent Casavant's SHMEM_NOSBINFO patch, this instead just removes # the shmem_sb_info structure from the internal kernel mount, testing where # necessary for null sbinfo pointer. shmem_set_size moved within CONFIG_TMPFS, # its arg named "sbinfo" as elsewhere. # # This brings shmem object scalability up to that of anonymous memory, in the # case where distinct processes are building (faulting to allocate) distinct # objects. It significantly improves parallel building of a shared shmem object # (that test runs 14 times faster across 256 cpus), but other issues remain in # that case: to be addressed in later patches. # # Signed-off-by: Hugh Dickins # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # mm/shmem.c # 2004/09/13 17:23:18-07:00 hugh@veritas.com +88 -76 # shmem: no sbinfo for shm mount # # ChangeSet # 2004/09/14 07:45:36-07:00 hugh@veritas.com # [PATCH] shmem: inodes and links need lowmem # # Keith Mannthey's Bugzilla #3268 drew attention to how tmpfs inodes and # dentries and long names and radix-tree nodes pin lowmem. Assuming about 1k of # lowmem per inode, we need to lower the default nr_inodes limit on machines # with significant highmem. # # Be conservative, but more generous than in the original patch to Keith: limit # to number of lowmem pages, which works out around 200,000 on i386. Easily # overridden by giving the nr_inodes= mount option: those who want to sail # closer to the rocks should be allowed to do so. # # Notice how tmpfs dentries cannot be reclaimed in the way that disk-based # dentries can: so even hard links need to be costed. They are cheaper than # inodes, but easier all round to charge the same. This way, the limit for hard # links is equally visible through "df -i": but expect occasional bugreports # that tmpfs links are being treated like this. # # Would have been simpler just to move the free_inodes accounting from # shmem_delete_inode to shmem_unlink; but that would lose the charge on unlinked # but open files. # # Signed-off-by: Hugh Dickins # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # mm/shmem.c # 2004/09/13 17:23:17-07:00 hugh@veritas.com +26 -2 # shmem: inodes and links need lowmem # # Documentation/filesystems/tmpfs.txt # 2004/09/13 17:23:17-07:00 hugh@veritas.com +4 -2 # shmem: inodes and links need lowmem # # ChangeSet # 2004/09/14 07:45:23-07:00 hugh@veritas.com # [PATCH] shmem: don't SLAB_HWCACHE_ALIGN # # Anton recently removed SLAB_HWCACHE_ALIGN from the fs inode caches, now do the # same for tmpfs inode cache: fits 9 per page where 7 before. # # Was saying SLAB_RECLAIM_ACCOUNT too, but that's wrong: tmpfs inodes are not # reclaimed under pressure; and hugetlbfs had copied that too. # # Rearrange shmem_inode_info fields so those most likely to be needed are most # likely to be in the same cacheline as the spinlock guarding them. # # Signed-off-by: Hugh Dickins # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # mm/shmem.c # 2004/09/13 17:23:17-07:00 hugh@veritas.com +1 -2 # shmem: don't SLAB_HWCACHE_ALIGN # # include/linux/shmem_fs.h # 2004/09/13 17:23:17-07:00 hugh@veritas.com +7 -7 # shmem: don't SLAB_HWCACHE_ALIGN # # fs/hugetlbfs/inode.c # 2004/09/13 17:23:17-07:00 hugh@veritas.com +1 -2 # shmem: don't SLAB_HWCACHE_ALIGN # # ChangeSet # 2004/09/14 07:45:11-07:00 castet.matthieu@free.fr # [PATCH] pnpbios parser bugfix # # this patch fix a pnpbios problem with independant # resource(http://bugzilla.kernel.org/show_bug.cgi?id=3295) : # the old code assume that they are given at the beggining (before any # SMALL_TAG_STARTDEP entry), but in some case there are found after # SMALL_TAG_ENDDEP entry. # # tag : 6 SMALL_TAG_STARTDEP # tag : 8 SMALL_TAG_PORT # tag : 6 SMALL_TAG_STARTDEP # tag : 8 SMALL_TAG_PORT # tag : 7 SMALL_TAG_ENDDEP # tag : 4 SMALL_TAG_IRQ <-- independant resource # tag : f SMALL_TAG_END # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/pnp/pnpbios/rsparser.c # 2004/09/13 17:23:17-07:00 castet.matthieu@free.fr +7 -2 # pnpbios parser bugfix # # ChangeSet # 2004/09/14 07:44:59-07:00 yuvalt@gmail.com # [PATCH] searching for parameters in 'make menuconfig' # # I added the ability to search for parameters in make menuconfig (find a # given parameter's location in the tree). # # You use '/' to invoke the feature. Regular expression searches are supported. # # Signed-off-by: Yuval Turgeman # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # scripts/lxdialog/menubox.c # 2004/09/13 17:23:16-07:00 yuvalt@gmail.com +9 -0 # searching for parameters in 'make menuconfig' # # scripts/kconfig/mconf.c # 2004/09/13 17:23:16-07:00 yuvalt@gmail.com +145 -16 # searching for parameters in 'make menuconfig' # # ChangeSet # 2004/09/14 07:44:46-07:00 benh@kernel.crashing.org # [PATCH] ppc32: pmac cpufreq for ibook 2 600 # # This patch adds support for the 750CX based ibook2 600Mhz to the cpufreq # powermac driver. # # Signed-off-by: Benjamin Herrenschmidt # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/ppc/platforms/pmac_cpufreq.c # 2004/09/13 17:23:16-07:00 benh@kernel.crashing.org +2 -5 # ppc32: pmac cpufreq for ibook 2 600 # # ChangeSet # 2004/09/14 07:44:34-07:00 anton@samba.org # [PATCH] ppc32: remove -Wno-uninitialized # # Remove -Wno-uninitialized on ppc32 too. Ive just found a number of real bugs # on ppc64 by doing the same. # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/ppc/Makefile # 2004/09/13 17:23:16-07:00 anton@samba.org +1 -1 # ppc32: remove -Wno-uninitialized # # ChangeSet # 2004/09/14 07:44:21-07:00 david@gibson.dropbear.id.au # [PATCH] ppc64: improved VSID allocation algorithm # # This patch has been tested both on SLB and segment table machines. This # new approach is far from the final word in VSID/context allocation, but # it's a noticeable improvement on the old method. # # Replace the VSID allocation algorithm. The new algorithm first generates a # 36-bit "proto-VSID" (with 0xfffffffff reserved). For kernel addresses this # is equal to the ESID (address >> 28), for user addresses it is: # # (context << 15) | (esid & 0x7fff) # # These are distinguishable from kernel proto-VSIDs because the top bit is # clear. Proto-VSIDs with the top two bits equal to 0b10 are reserved for # now. # # The proto-VSIDs are then scrambled into real VSIDs with the multiplicative # hash: # # VSID = (proto-VSID * VSID_MULTIPLIER) % VSID_MODULUS # where VSID_MULTIPLIER = 268435399 = 0xFFFFFC7 # VSID_MODULUS = 2^36-1 = 0xFFFFFFFFF # # This scramble is 1:1, because VSID_MULTIPLIER and VSID_MODULUS are co-prime # since VSID_MULTIPLIER is prime (the largest 28-bit prime, in fact). # # This scheme has a number of advantages over the old one: # # - We now have VSIDs for every kernel address (i.e. everything above # 0xC000000000000000), except the very top segment. That simplifies a # number of things. # # - We allow for 15 significant bits of ESID for user addresses with 20 # bits of context. i.e. 8T (43 bits) of address space for up to 1M # contexts, significantly more than the old method (although we will need # changes in the hash path and context allocation to take advantage of # this). # # - Because we use a real multiplicative hash function, we have better and # more robust hash scattering with this VSID algorithm (at least based on # some initial results). # # Because the MODULUS is 2^n-1 we can use a trick to compute it efficiently # without a divide or extra multiply. This makes the new algorithm barely # slower than the old one. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-ppc64/pgtable.h # 2004/09/13 17:23:16-07:00 david@gibson.dropbear.id.au +10 -4 # ppc64: improved VSID allocation algorithm # # include/asm-ppc64/page.h # 2004/09/13 17:23:16-07:00 david@gibson.dropbear.id.au +0 -11 # ppc64: improved VSID allocation algorithm # # include/asm-ppc64/mmu_context.h # 2004/09/13 17:23:16-07:00 david@gibson.dropbear.id.au +79 -38 # ppc64: improved VSID allocation algorithm # # include/asm-ppc64/mmu.h # 2004/09/13 17:23:16-07:00 david@gibson.dropbear.id.au +39 -6 # ppc64: improved VSID allocation algorithm # # arch/ppc64/mm/stab.c # 2004/09/13 17:23:16-07:00 david@gibson.dropbear.id.au +1 -5 # ppc64: improved VSID allocation algorithm # # arch/ppc64/mm/slb_low.S # 2004/09/13 17:23:16-07:00 david@gibson.dropbear.id.au +21 -32 # ppc64: improved VSID allocation algorithm # # arch/ppc64/mm/hash_utils.c # 2004/09/13 17:23:16-07:00 david@gibson.dropbear.id.au +5 -5 # ppc64: improved VSID allocation algorithm # # arch/ppc64/kernel/head.S # 2004/09/13 17:23:16-07:00 david@gibson.dropbear.id.au +8 -17 # ppc64: improved VSID allocation algorithm # # ChangeSet # 2004/09/14 07:44:08-07:00 anton@samba.org # [PATCH] hvc: uninitialised variable # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/char/hvc_console.c # 2004/09/13 17:23:15-07:00 anton@samba.org +1 -1 # hvc: uninitialised variable # # ChangeSet # 2004/09/14 07:43:55-07:00 anton@samba.org # [PATCH] ppc64: Fix spurious warnings uncovered by -Wno-uninitialized removal # # Here are fixes for some false positives. # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/macintosh/via-pmu.c # 2004/09/13 17:23:15-07:00 anton@samba.org +1 -1 # ppc64: Fix spurious warnings uncovered by -Wno-uninitialized removal # # drivers/char/hvsi.c # 2004/09/13 17:23:15-07:00 anton@samba.org +1 -1 # ppc64: Fix spurious warnings uncovered by -Wno-uninitialized removal # # arch/ppc64/xmon/xmon.c # 2004/09/13 17:23:15-07:00 anton@samba.org +1 -1 # ppc64: Fix spurious warnings uncovered by -Wno-uninitialized removal # # arch/ppc64/oprofile/op_model_rs64.c # 2004/09/13 17:23:15-07:00 anton@samba.org +2 -2 # ppc64: Fix spurious warnings uncovered by -Wno-uninitialized removal # # arch/ppc64/kernel/sysfs.c # 2004/09/13 17:23:15-07:00 anton@samba.org +7 -6 # ppc64: Fix spurious warnings uncovered by -Wno-uninitialized removal # # arch/ppc64/kernel/signal32.c # 2004/09/13 17:23:15-07:00 anton@samba.org +1 -1 # ppc64: Fix spurious warnings uncovered by -Wno-uninitialized removal # # arch/ppc64/kernel/signal.c # 2004/09/13 17:23:15-07:00 anton@samba.org +1 -1 # ppc64: Fix spurious warnings uncovered by -Wno-uninitialized removal # # arch/ppc64/kernel/setup.c # 2004/09/13 17:23:15-07:00 anton@samba.org +1 -1 # ppc64: Fix spurious warnings uncovered by -Wno-uninitialized removal # # arch/ppc64/kernel/rtasd.c # 2004/09/13 17:23:15-07:00 anton@samba.org +1 -1 # ppc64: Fix spurious warnings uncovered by -Wno-uninitialized removal # # arch/ppc64/kernel/pSeries_pci.c # 2004/09/13 17:23:15-07:00 anton@samba.org +1 -1 # ppc64: Fix spurious warnings uncovered by -Wno-uninitialized removal # # arch/ppc64/kernel/nvram.c # 2004/09/13 17:23:15-07:00 anton@samba.org +1 -1 # ppc64: Fix spurious warnings uncovered by -Wno-uninitialized removal # # arch/ppc64/kernel/iommu.c # 2004/09/13 17:23:15-07:00 anton@samba.org +1 -1 # ppc64: Fix spurious warnings uncovered by -Wno-uninitialized removal # # ChangeSet # 2004/09/14 07:43:43-07:00 anton@samba.org # [PATCH] ppc64: Fix real bugs uncovered by -Wno-uninitialized removal # # The removal of -Wno-uninitialized on ppc64 revealed a number of real # bugs. # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/pci/hotplug/rpaphp_core.c # 2004/09/13 17:23:15-07:00 anton@samba.org +1 -1 # ppc64: Fix real bugs uncovered by -Wno-uninitialized removal # # drivers/net/ibmveth.c # 2004/09/13 17:23:15-07:00 anton@samba.org +5 -2 # ppc64: Fix real bugs uncovered by -Wno-uninitialized removal # # drivers/char/hvcs.c # 2004/09/13 17:23:15-07:00 anton@samba.org +3 -3 # ppc64: Fix real bugs uncovered by -Wno-uninitialized removal # # arch/ppc64/kernel/iSeries_pci_reset.c # 2004/09/13 17:23:15-07:00 anton@samba.org +2 -1 # ppc64: Fix real bugs uncovered by -Wno-uninitialized removal # # ChangeSet # 2004/09/14 07:43:30-07:00 anton@samba.org # [PATCH] ppc64: remove -Wno-uninitialized # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/ppc64/Makefile # 2004/09/13 17:23:14-07:00 anton@samba.org +1 -2 # ppc64: remove -Wno-uninitialized # # ChangeSet # 2004/09/14 07:43:18-07:00 anton@samba.org # [PATCH] ppc64: clean up idle loop code # # Clean up our idle loop code: # # - Remove a bunch of useless includes and make most functions static # - There were places where we werent disabling interrupts before checking # need_resched then calling the hypervisor to sleep our thread. We might # race with an IPI and end up missing a reschedule. Disable interrupts # around these regions to make them safe. # - We forgot to turn off the polling flag when exiting the dedicated_idle # idle loop. This could have resulted in all manner problems as other # cpus would avoid sending IPIs to force reschedules. # - Add a missing check for cpu_is_offline in the shared cpu idle loop. # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/ppc64/kernel/idle.c # 2004/09/13 17:23:14-07:00 anton@samba.org +60 -64 # ppc64: clean up idle loop code # # ChangeSet # 2004/09/14 07:43:06-07:00 anton@samba.org # [PATCH] ppc64: enable POWER5 low power mode in idle loop # # Now that we understand (and have fixed) the problem with using low power mode # in the idle loop, lets enable it. It should save a fair amount of power. # # (The problem was that our exceptions were inheriting the low power mode and so # were executing at a fraction of the normal cpu issue rate. We fixed it by # always bumping our priority to medium at the start of every exception). # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/ppc64/kernel/idle.c # 2004/09/13 17:23:14-07:00 anton@samba.org +13 -9 # ppc64: enable POWER5 low power mode in idle loop # # ChangeSet # 2004/09/14 07:42:54-07:00 anton@samba.org # [PATCH] ppc64: restore smt-enabled=off kernel command line option # # Restore the smt-enabled=off kernel command line functionality: # # - Remove the SMT_DYNAMIC state now that smt_snooze_delay allows for the # same thing. # - Remove the early prom.c parsing for the option, put it into an # early_param instead. # - In setup_cpu_maps honour the smt-enabled setting # # Note to Nathan: In order to allow cpu hotplug add of secondary threads after # booting with smt-enabled=off, I had to initialise cpu_present_map to # cpu_online_map in smp_cpus_done. Im not sure how you want to handle this but # it seems our present map currently does not allow cpus to be added into the # partition that werent there at boot (but were in the possible map). # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # include/asm-ppc64/smp.h # 2004/09/13 17:23:14-07:00 anton@samba.org +2 -0 # ppc64: restore smt-enabled=off kernel command line option # # include/asm-ppc64/naca.h # 2004/09/13 17:23:14-07:00 anton@samba.org +0 -3 # ppc64: restore smt-enabled=off kernel command line option # # include/asm-ppc64/memory.h # 2004/09/13 17:23:14-07:00 anton@samba.org +0 -10 # ppc64: restore smt-enabled=off kernel command line option # # arch/ppc64/kernel/smp.c # 2004/09/13 17:23:14-07:00 anton@samba.org +10 -0 # ppc64: restore smt-enabled=off kernel command line option # # arch/ppc64/kernel/setup.c # 2004/09/13 17:23:14-07:00 anton@samba.org +55 -2 # ppc64: restore smt-enabled=off kernel command line option # # arch/ppc64/kernel/prom.c # 2004/09/13 17:23:14-07:00 anton@samba.org +3 -67 # ppc64: restore smt-enabled=off kernel command line option # # arch/ppc64/kernel/idle.c # 2004/09/13 17:23:14-07:00 anton@samba.org +1 -6 # ppc64: restore smt-enabled=off kernel command line option # # ChangeSet # 2004/09/14 07:42:41-07:00 anton@samba.org # [PATCH] ppc64: use early_param # # Make use of Rusty's early_param code. Its good stuff. # # We appear to be the first user :) # # Move vpa_init and idle_setup later in boot, we dont have to do them # right up front in setup_system. # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/ppc64/mm/numa.c # 2004/09/13 17:23:14-07:00 anton@samba.org +18 -4 # ppc64: use early_param # # arch/ppc64/kernel/setup.c # 2004/09/13 17:23:14-07:00 anton@samba.org +43 -47 # ppc64: use early_param # # ChangeSet # 2004/09/14 07:42:28-07:00 anton@samba.org # [PATCH] ppc64: remove EEH command line device matching code # # We have had reports of people attempting to disable EEH on POWER5 boxes. This # is not supported, and the device will most likely not respond to config space # reads/writes. Remove the IBM location matching code that was being used to # disable devices as well as the global option. # # We already have the ability to ignore EEH erros via the panic_on_oops sysctl # option, advanced users should make use of that instead. # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/ppc64/kernel/eeh.c # 2004/09/13 17:23:13-07:00 anton@samba.org +5 -160 # ppc64: remove EEH command line device matching code # # ChangeSet # 2004/09/14 07:42:16-07:00 anton@samba.org # [PATCH] ppc64: remove unused ppc64_calibrate_delay # # - Remove ppc64_calibrate_delay, no longer used # - Formatting fixups # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/ppc64/kernel/setup.c # 2004/09/13 17:23:13-07:00 anton@samba.org +5 -18 # ppc64: remove unused ppc64_calibrate_delay # # ChangeSet # 2004/09/14 07:42:04-07:00 anton@samba.org # [PATCH] ppc64: clean up kernel command line code # # Clean up some of our command line code: # # - We were copying the command line out of the device tree twice, but the # first time we forgot to add CONFIG_CMDLINE. Fix this and remove the # second copy. # - The command line birec code ran after we had done some command line # parsing in prom.c. This had the opportunity to really confuse the # user, with some options being parsed out of the device tree and the # other out of birecs. Luckily we could find no user of the command # line birecs, so remove them. # - remove duplicate printing of kernel command line; # - clean up iseries inits and create an iSeries_parse_cmdline. # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/ppc64/kernel/setup.c # 2004/09/13 17:23:13-07:00 anton@samba.org +5 -65 # ppc64: clean up kernel command line code # # arch/ppc64/kernel/prom.c # 2004/09/13 17:23:13-07:00 anton@samba.org +3 -0 # ppc64: clean up kernel command line code # # arch/ppc64/kernel/iSeries_setup.c # 2004/09/13 17:23:13-07:00 anton@samba.org +9 -10 # ppc64: clean up kernel command line code # # arch/ppc64/kernel/chrp_setup.c # 2004/09/13 17:23:13-07:00 anton@samba.org +0 -2 # ppc64: clean up kernel command line code # # ChangeSet # 2004/09/14 07:41:51-07:00 anton@samba.org # [PATCH] ppc64: use nm --synthetic where available # # On new toolchains we need to use nm --synthetic or we miss code symbols. Sam, # I'm not thrilled about this patch but Im not sure of an easier way. Any ideas? # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/ppc64/Makefile # 2004/09/13 17:23:13-07:00 anton@samba.org +6 -0 # ppc64: use nm --synthetic where available # # ChangeSet # 2004/09/14 07:41:39-07:00 anton@samba.org # [PATCH] ppc64: give the kernel an OPD section # # From: Alan Modra # # Give the kernel an OPD section, required for recent ppc64 toolchains. # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/ppc64/kernel/vmlinux.lds.S # 2004/09/13 17:23:12-07:00 anton@samba.org +4 -1 # ppc64: give the kernel an OPD section # # ChangeSet # 2004/09/14 07:41:27-07:00 anton@samba.org # [PATCH] ppc64: Enable NUMA API # # Plumb the NUMA API syscalls into ppc64. Also add some missing cond_syscalls # so we still link with NUMA API disabled. # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # kernel/sys.c # 2004/09/13 17:23:12-07:00 anton@samba.org +2 -0 # ppc64: Enable NUMA API # # include/asm-ppc64/unistd.h # 2004/09/13 17:23:12-07:00 anton@samba.org +3 -3 # ppc64: Enable NUMA API # # arch/ppc64/kernel/misc.S # 2004/09/13 17:23:12-07:00 anton@samba.org +6 -6 # ppc64: Enable NUMA API # # ChangeSet # 2004/09/14 07:41:15-07:00 anton@samba.org # [PATCH] ppc64: RTAS error logs can appear twice in dmesg # # I've started seeing rtas errors printed twice. Remove the second call to # printk_log_rtas. # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/ppc64/kernel/rtasd.c # 2004/09/13 17:23:12-07:00 anton@samba.org +5 -7 # ppc64: RTAS error logs can appear twice in dmesg # # ChangeSet # 2004/09/14 07:41:03-07:00 anton@samba.org # [PATCH] ppc64: remove SPINLINE config option # # After the spinlock rework, CONFIG_SPINLINE doesnt work and causes a compile # error. Remove it for now. # # Signed-off-by: Anton Blanchard # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/ppc64/lib/locks.c # 2004/09/13 17:23:12-07:00 anton@samba.org +0 -4 # ppc64: remove SPINLINE config option # # arch/ppc64/Kconfig.debug # 2004/09/13 17:23:12-07:00 anton@samba.org +0 -10 # ppc64: remove SPINLINE config option # # ChangeSet # 2004/09/14 07:40:51-07:00 willschm@us.ibm.com # [PATCH] ppc64: lparcfg whitespace and wordwrap cleanup. # # This patch is the result of running Lindent against # arch/ppc64/kernel/lparcfg.c. # # This cleans up an assortment of whitespace and wordwrap inconsistencies. # # Signed-off-by: Will Schmidt # Signed-off-by: Paul Mackerras # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/ppc64/kernel/lparcfg.c # 2004/09/13 17:23:12-07:00 willschm@us.ibm.com +99 -91 # ppc64: lparcfg whitespace and wordwrap cleanup. # # ChangeSet # 2004/09/14 07:40:39-07:00 willschm@us.ibm.com # [PATCH] ppc64: lparcfg fixes for processor counts # # This patch corrects how the lparcfg interface was presenting the number of # active and potential processors. (As reported in LTC bugzilla number 10889). # # - Correct output for partition_potential_processors and # system_active_processors. # - suppress pool related values in scenarios where they do not make # sense. (non-shared processor configurations) # - Display pool_capacity as a percentage, to match the behavior from # iSeries code. # # Signed-off-by: Will Schmidt # Signed-off-by: Paul Mackerras # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/ppc64/kernel/lparcfg.c # 2004/09/13 17:23:11-07:00 willschm@us.ibm.com +29 -23 # ppc64: lparcfg fixes for processor counts # # ChangeSet # 2004/09/14 07:40:27-07:00 davej@redhat.com # [PATCH] Pointer dereference before NULL check in ACPI thermal driver # # Again, found with coverity's checker. # # Signed-off-by: Dave Jones # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # drivers/acpi/thermal.c # 2004/09/13 17:23:11-07:00 davej@redhat.com +3 -1 # Pointer dereference before NULL check in ACPI thermal driver # # ChangeSet # 2004/09/14 07:40:15-07:00 jason.davis@unisys.com # [PATCH] ES7000 subarch update # # The patch below implements an algorithm to determine an unique GSI override # for mapping GSIs to IO-APIC pins correctly. GSI overrides are required in # order for ES7000 machines to function properly since IRQ to pin mappings # are NOT all one-to-one. This patch applies only to the Unisys specific # ES7000 machines and has been tested thoroughly on several models of the # ES7000 line. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # arch/i386/mach-es7000/es7000plat.c # 2004/09/13 17:23:11-07:00 jason.davis@unisys.com +64 -17 # ES7000 subarch update # # arch/i386/mach-es7000/es7000.h # 2004/09/13 17:23:11-07:00 jason.davis@unisys.com +7 -0 # ES7000 subarch update # # ChangeSet # 2004/09/14 07:40:03-07:00 nathanl@austin.ibm.com # [PATCH] fix schedstats null deref in sched_exec # # In sched_exec, schedstat_inc will dereference a null pointer if no domain # is found with the SD_BALANCE_EXEC flag set. This was exposed during # testing of the previous patches where cpus are temporarily attached to a # dummy domain without SD_BALANCE_EXEC set. # # Signed-off-by: Nathan Lynch # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # kernel/sched.c # 2004/09/13 17:23:11-07:00 nathanl@austin.ibm.com +1 -1 # fix schedstats null deref in sched_exec # # ChangeSet # 2004/09/14 14:30:26+01:00 aia21@cantab.net # NTFS: Fix scheduling latencies in ntfs_fill_super() by dropping the BKL # because the code itself is using the ntfs_lock semaphore which # provides safe locking. (Ingo Molnar) # # Signed-off-by: Ingo Molnar # Signed-off-by: Anton Altaparmakov # # fs/ntfs/super.c # 2004/09/14 14:30:16+01:00 aia21@cantab.net +5 -0 # Fix scheduling latencies in ntfs_fill_super() by dropping the BKL # because the code itself is using the ntfs_lock semaphore which # provides safe locking. (Ingo Molnar) # # fs/ntfs/ChangeLog # 2004/09/14 14:30:15+01:00 aia21@cantab.net +3 -0 # Update # # ChangeSet # 2004/09/14 03:03:26-07:00 rth@kanga.twiddle.home # [ALPHA] Add waitid. # # include/asm-alpha/unistd.h # 2004/09/14 03:03:06-07:00 rth@kanga.twiddle.home +2 -1 # Add waitid. # # arch/alpha/kernel/systbls.S # 2004/09/14 03:03:06-07:00 rth@kanga.twiddle.home +1 -0 # Add waitid. # # ChangeSet # 2004/09/14 03:02:28-07:00 rth@kanga.twiddle.home # [ALPHA] Arrange to return EINTR for sigsuspend on signal path. # # arch/alpha/kernel/signal.c # 2004/09/14 03:02:09-07:00 rth@kanga.twiddle.home +14 -4 # Arrange to return EINTR for sigsuspend on signal path. # # ChangeSet # 2004/09/14 02:39:33-07:00 rth@kanga.twiddle.home # [ALPHA] Use "long" on some internal bitops routines. # # include/asm-alpha/compiler.h # 2004/09/14 02:39:13-07:00 rth@kanga.twiddle.home +3 -3 # Use long versions of ctz, clz, popcount. # # include/asm-alpha/bitops.h # 2004/09/14 02:39:13-07:00 rth@kanga.twiddle.home +2 -2 # Use longs for floor/ceil_log2. # # ChangeSet # 2004/09/14 02:36:46-07:00 rth@kanga.twiddle.home # [ALPHA] Check set_fd_set return. # # arch/alpha/kernel/osf_sys.c # 2004/09/14 02:36:25-07:00 rth@kanga.twiddle.home +4 -3 # Check set_fd_set return. # # ChangeSet # 2004/09/14 09:54:04+01:00 nico@org.rmk.(none) # [ARM PATCH] 2094/1: don't lose the system timer after resuming from sleep on SA11x0 and # PXA2xx # # Patch from Nicolas Pitre # # Let's make sure OSCR doesn't end up to be restored with a value # past OSMR0 otherwise the system timer won't start ticking until # OSCR wraps around (aprox 17 min. # # Also set OSCR _after_ OIER is restored to avoid matching when # corresponding match interrupt is masked out. # # Signed-off-by: Nicolas Pitre # # arch/arm/mach-sa1100/pm.c # 2004/09/14 02:51:46+01:00 nico@org.rmk.(none) +4 -3 # [PATCH] 2094/1: don't lose the system timer after resuming from sleep on SA11x0 and # PXA2xx # # arch/arm/mach-pxa/pm.c # 2004/09/14 02:56:28+01:00 nico@org.rmk.(none) +4 -3 # [PATCH] 2094/1: don't lose the system timer after resuming from sleep on SA11x0 and # PXA2xx # # ChangeSet # 2004/09/13 22:13:59-07:00 davem@nuts.davemloft.net # [SPARC64]: __iomem annotations and iomap implementation. # # include/asm-sparc64/io.h # 2004/09/13 22:13:36-07:00 davem@nuts.davemloft.net +77 -67 # [SPARC64]: __iomem annotations and iomap implementation. # # include/asm-sparc64/ebus.h # 2004/09/13 22:13:36-07:00 davem@nuts.davemloft.net +1 -1 # [SPARC64]: __iomem annotations and iomap implementation. # # arch/sparc64/lib/Makefile # 2004/09/13 22:13:36-07:00 davem@nuts.davemloft.net +1 -1 # [SPARC64]: __iomem annotations and iomap implementation. # # arch/sparc64/kernel/power.c # 2004/09/13 22:13:36-07:00 davem@nuts.davemloft.net +4 -4 # [SPARC64]: __iomem annotations and iomap implementation. # # arch/sparc64/kernel/pci_schizo.c # 2004/09/13 22:13:36-07:00 davem@nuts.davemloft.net +2 -2 # [SPARC64]: __iomem annotations and iomap implementation. # # arch/sparc64/kernel/auxio.c # 2004/09/13 22:13:36-07:00 davem@nuts.davemloft.net +6 -5 # [SPARC64]: __iomem annotations and iomap implementation. # # arch/sparc64/lib/iomap.c # 2004/09/13 22:13:27-07:00 davem@nuts.davemloft.net +48 -0 # [SPARC64]: __iomem annotations and iomap implementation. # # arch/sparc64/lib/iomap.c # 2004/09/13 22:13:27-07:00 davem@nuts.davemloft.net +0 -0 # BitKeeper file /disk1/BK/sparc-2.6/arch/sparc64/lib/iomap.c # # ChangeSet # 2004/09/13 21:40:12-07:00 davem@nuts.davemloft.net # [TCP]: Fix logic error in packets_out accounting. # # Noticed by Herbert Xu. # # Signed-off-by: David S. Miller # # net/ipv4/tcp_output.c # 2004/09/13 21:39:17-07:00 davem@nuts.davemloft.net +1 -1 # [TCP]: Fix logic error in packets_out accounting. # # ChangeSet # 2004/09/13 23:31:50-04:00 jgarzik@pobox.com # [libata] consolidate legacy/native mode init code into helpers # # Eliminates duplicate code in sata_nv, sata_sis, and sata_via. # # include/linux/libata.h # 2004/09/13 23:31:43-04:00 jgarzik@pobox.com +4 -0 # [libata] consolidate legacy/native mode init code into helpers # # Eliminates duplicate code in sata_nv, sata_sis, and sata_via. # # drivers/scsi/sata_via.c # 2004/09/13 23:31:43-04:00 jgarzik@pobox.com +13 -28 # [libata] consolidate legacy/native mode init code into helpers # # Eliminates duplicate code in sata_nv, sata_sis, and sata_via. # # drivers/scsi/sata_sis.c # 2004/09/13 23:31:43-04:00 jgarzik@pobox.com +15 -31 # [libata] consolidate legacy/native mode init code into helpers # # Eliminates duplicate code in sata_nv, sata_sis, and sata_via. # # drivers/scsi/sata_nv.c # 2004/09/13 23:31:43-04:00 jgarzik@pobox.com +15 -35 # [libata] consolidate legacy/native mode init code into helpers # # Eliminates duplicate code in sata_nv, sata_sis, and sata_via. # # drivers/scsi/libata-core.c # 2004/09/13 23:31:43-04:00 jgarzik@pobox.com +104 -77 # [libata] consolidate legacy/native mode init code into helpers # # Eliminates duplicate code in sata_nv, sata_sis, and sata_via. # # ChangeSet # 2004/09/13 22:34:11-04:00 jgarzik@pobox.com # [libata] remove distinction between MMIO/PIO helper functions # # Prepare for use of new generic iomap API. # # include/linux/libata.h # 2004/09/13 22:34:03-04:00 jgarzik@pobox.com +6 -12 # [libata] remove distinction between MMIO/PIO helper functions # # Prepare for use of new generic iomap API. # # drivers/scsi/sata_vsc.c # 2004/09/13 22:34:03-04:00 jgarzik@pobox.com +4 -4 # [libata] remove distinction between MMIO/PIO helper functions # # Prepare for use of new generic iomap API. # # drivers/scsi/sata_via.c # 2004/09/13 22:34:03-04:00 jgarzik@pobox.com +6 -6 # [libata] remove distinction between MMIO/PIO helper functions # # Prepare for use of new generic iomap API. # # drivers/scsi/sata_sx4.c # 2004/09/13 22:34:03-04:00 jgarzik@pobox.com +4 -4 # [libata] remove distinction between MMIO/PIO helper functions # # Prepare for use of new generic iomap API. # # drivers/scsi/sata_svw.c # 2004/09/13 22:34:03-04:00 jgarzik@pobox.com +3 -3 # [libata] remove distinction between MMIO/PIO helper functions # # Prepare for use of new generic iomap API. # # drivers/scsi/sata_sis.c # 2004/09/13 22:34:03-04:00 jgarzik@pobox.com +6 -6 # [libata] remove distinction between MMIO/PIO helper functions # # Prepare for use of new generic iomap API. # # drivers/scsi/sata_sil.c # 2004/09/13 22:34:03-04:00 jgarzik@pobox.com +6 -6 # [libata] remove distinction between MMIO/PIO helper functions # # Prepare for use of new generic iomap API. # # drivers/scsi/sata_promise.c # 2004/09/13 22:34:03-04:00 jgarzik@pobox.com +4 -4 # [libata] remove distinction between MMIO/PIO helper functions # # Prepare for use of new generic iomap API. # # drivers/scsi/sata_nv.c # 2004/09/13 22:34:03-04:00 jgarzik@pobox.com +6 -6 # [libata] remove distinction between MMIO/PIO helper functions # # Prepare for use of new generic iomap API. # # drivers/scsi/libata-core.c # 2004/09/13 22:34:03-04:00 jgarzik@pobox.com +71 -30 # [libata] remove distinction between MMIO/PIO helper functions # # Prepare for use of new generic iomap API. # # drivers/scsi/ata_piix.c # 2004/09/13 22:34:03-04:00 jgarzik@pobox.com +12 -12 # [libata] remove distinction between MMIO/PIO helper functions # # Prepare for use of new generic iomap API. # # ChangeSet # 2004/09/13 22:14:43-04:00 jgarzik@pobox.com # [libata sata_nv] sync with 2.4 # # Driver should be using LIBATA_MAX_PRD not ATA_MAX_PRD, # due to iommu layer splitting. # # drivers/scsi/sata_nv.c # 2004/09/13 22:14:35-04:00 jgarzik@pobox.com +1 -1 # [libata sata_nv] sync with 2.4 # # Driver should be using LIBATA_MAX_PRD not ATA_MAX_PRD, # due to iommu layer splitting. # # ChangeSet # 2004/09/13 19:01:14-07:00 davem@nuts.davemloft.net # [IOMAP]: Make ioport_map() take unsigned long port argument. # # Signed-off-by: David S. Miller # # lib/iomap.c # 2004/09/13 19:00:43-07:00 davem@nuts.davemloft.net +4 -4 # [IOMAP]: Make ioport_map() take unsigned long port argument. # # include/asm-generic/iomap.h # 2004/09/13 19:00:43-07:00 davem@nuts.davemloft.net +1 -1 # [IOMAP]: Make ioport_map() take unsigned long port argument. # # ChangeSet # 2004/09/13 16:17:24-07:00 shemminger@osdl.org # [B44]: Fix b44 I/O mem space access warnings. # # B44 driver was using unsigned long as an io memory address. # Recent changes caused this to be a warning. This patch fixes that # and makes the readl/writel wrapper into inline's instead of macros # with magic variable side effect (yuck). # # Signed-off-by: David S. Miller # # drivers/net/b44.h # 2004/09/13 16:17:06-07:00 shemminger@osdl.org +1 -4 # [B44]: Fix b44 I/O mem space access warnings. # # B44 driver was using unsigned long as an io memory address. # Recent changes caused this to be a warning. This patch fixes that # and makes the readl/writel wrapper into inline's instead of macros # with magic variable side effect (yuck). # # Signed-off-by: David S. Miller # # drivers/net/b44.c # 2004/09/13 16:17:06-07:00 shemminger@osdl.org +103 -92 # [B44]: Fix b44 I/O mem space access warnings. # # B44 driver was using unsigned long as an io memory address. # Recent changes caused this to be a warning. This patch fixes that # and makes the readl/writel wrapper into inline's instead of macros # with magic variable side effect (yuck). # # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/13 16:08:46-07:00 martin.wilck@fujitsu-siemens.com # [TG3]: Fix pause handling, we had duplicate flags for the same thing. # # Signed-off-by: David S. Miller # # drivers/net/tg3.h # 2004/09/13 16:08:18-07:00 martin.wilck@fujitsu-siemens.com +0 -2 # [TG3]: Fix pause handling, we had duplicate flags for the same thing. # # Signed-off-by: David S. Miller # # drivers/net/tg3.c # 2004/09/13 16:08:17-07:00 martin.wilck@fujitsu-siemens.com +34 -27 # [TG3]: Fix pause handling, we had duplicate flags for the same thing. # # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/13 20:05:28-03:00 acme@conectiva.com.br # [NET] generalise per protocol slab cache handling # # With this patch we get two new slabcaches, for sctp socks, that previously # were being allocated on the default, that was tcp[6]_sock, i.e. wasting 288 # bytes per sock in the IPv4 case and 256 bytes for the IPv6 version, this is in # preparation for DCCP (or any other new protocol :) ). # # With this in place another nice side effect that is easier to achieve is to # get rid of struct sock sk->sk_slab, and instead use sk->sk_prot->slab, saving # sizeof(void *) on every struct sock instance, but this unfortunatly has to # wait for the conversion of all protocols that use per socket slabcaches to # use sk->sk_prot, AF_UNIX is the only one AFAIK, so I'll try to convert it to # use sk->sk_prot and then get rid of sk->sk_slab. # # As for the protocols that don't use per socket slabcaches its just a matter # of defaulting to sk_cachep at sk_free time if sk->sk_prot is NULL. # # [root@qemu ~]# modprobe sctp # [root@qemu ~]# grep _sock /proc/slabinfo # sctpv6_sock 9 9 864 9 2 : tunables 54 27 0 : # sctp_sock 0 0 736 5 1 : tunables 54 27 0 : # rawv6_sock 3 6 640 6 1 : tunables 54 27 0 : # udpv6_sock 0 0 608 6 1 : tunables 54 27 0 : # tcpv6_sock 1 7 1120 7 2 : tunables 24 12 0 : # unix_sock 6 10 384 10 1 : tunables 54 27 0 : # raw_sock 2 8 480 8 1 : tunables 54 27 0 : # udp_sock 0 0 512 7 1 : tunables 54 27 0 : # tcp_sock 0 0 1024 4 1 : tunables 54 27 0 : # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # net/sctp/socket.c # 2004/09/13 20:05:10-03:00 acme@conectiva.com.br +30 -0 # [NET] generalise per protocol slab cache handling # # With this patch we get two new slabcaches, for sctp socks, that previously # were being allocated on the default, that was tcp[6]_sock, i.e. wasting 288 # bytes per sock in the IPv4 case and 256 bytes for the IPv6 version, this is in # preparation for DCCP (or any other new protocol :) ). # # With this in place another nice side effect that is easier to achieve is to # get rid of struct sock sk->sk_slab, and instead use sk->sk_prot->slab, saving # sizeof(void *) on every struct sock instance, but this unfortunatly has to # wait for the conversion of all protocols that use per socket slabcaches to # use sk->sk_prot, AF_UNIX is the only one AFAIK, so I'll try to convert it to # use sk->sk_prot and then get rid of sk->sk_slab. # # As for the protocols that don't use per socket slabcaches its just a matter # of defaulting to sk_cachep at sk_free time if sk->sk_prot is NULL. # # [root@qemu ~]# modprobe sctp # [root@qemu ~]# grep _sock /proc/slabinfo # sctpv6_sock 9 9 864 9 2 : tunables 54 27 0 : # sctp_sock 0 0 736 5 1 : tunables 54 27 0 : # rawv6_sock 3 6 640 6 1 : tunables 54 27 0 : # udpv6_sock 0 0 608 6 1 : tunables 54 27 0 : # tcpv6_sock 1 7 1120 7 2 : tunables 24 12 0 : # unix_sock 6 10 384 10 1 : tunables 54 27 0 : # raw_sock 2 8 480 8 1 : tunables 54 27 0 : # udp_sock 0 0 512 7 1 : tunables 54 27 0 : # tcp_sock 0 0 1024 4 1 : tunables 54 27 0 : # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # net/sctp/protocol.c # 2004/09/13 20:05:09-03:00 acme@conectiva.com.br +18 -8 # [NET] generalise per protocol slab cache handling # # With this patch we get two new slabcaches, for sctp socks, that previously # were being allocated on the default, that was tcp[6]_sock, i.e. wasting 288 # bytes per sock in the IPv4 case and 256 bytes for the IPv6 version, this is in # preparation for DCCP (or any other new protocol :) ). # # With this in place another nice side effect that is easier to achieve is to # get rid of struct sock sk->sk_slab, and instead use sk->sk_prot->slab, saving # sizeof(void *) on every struct sock instance, but this unfortunatly has to # wait for the conversion of all protocols that use per socket slabcaches to # use sk->sk_prot, AF_UNIX is the only one AFAIK, so I'll try to convert it to # use sk->sk_prot and then get rid of sk->sk_slab. # # As for the protocols that don't use per socket slabcaches its just a matter # of defaulting to sk_cachep at sk_free time if sk->sk_prot is NULL. # # [root@qemu ~]# modprobe sctp # [root@qemu ~]# grep _sock /proc/slabinfo # sctpv6_sock 9 9 864 9 2 : tunables 54 27 0 : # sctp_sock 0 0 736 5 1 : tunables 54 27 0 : # rawv6_sock 3 6 640 6 1 : tunables 54 27 0 : # udpv6_sock 0 0 608 6 1 : tunables 54 27 0 : # tcpv6_sock 1 7 1120 7 2 : tunables 24 12 0 : # unix_sock 6 10 384 10 1 : tunables 54 27 0 : # raw_sock 2 8 480 8 1 : tunables 54 27 0 : # udp_sock 0 0 512 7 1 : tunables 54 27 0 : # tcp_sock 0 0 1024 4 1 : tunables 54 27 0 : # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # net/sctp/ipv6.c # 2004/09/13 20:05:09-03:00 acme@conectiva.com.br +17 -7 # [NET] generalise per protocol slab cache handling # # With this patch we get two new slabcaches, for sctp socks, that previously # were being allocated on the default, that was tcp[6]_sock, i.e. wasting 288 # bytes per sock in the IPv4 case and 256 bytes for the IPv6 version, this is in # preparation for DCCP (or any other new protocol :) ). # # With this in place another nice side effect that is easier to achieve is to # get rid of struct sock sk->sk_slab, and instead use sk->sk_prot->slab, saving # sizeof(void *) on every struct sock instance, but this unfortunatly has to # wait for the conversion of all protocols that use per socket slabcaches to # use sk->sk_prot, AF_UNIX is the only one AFAIK, so I'll try to convert it to # use sk->sk_prot and then get rid of sk->sk_slab. # # As for the protocols that don't use per socket slabcaches its just a matter # of defaulting to sk_cachep at sk_free time if sk->sk_prot is NULL. # # [root@qemu ~]# modprobe sctp # [root@qemu ~]# grep _sock /proc/slabinfo # sctpv6_sock 9 9 864 9 2 : tunables 54 27 0 : # sctp_sock 0 0 736 5 1 : tunables 54 27 0 : # rawv6_sock 3 6 640 6 1 : tunables 54 27 0 : # udpv6_sock 0 0 608 6 1 : tunables 54 27 0 : # tcpv6_sock 1 7 1120 7 2 : tunables 24 12 0 : # unix_sock 6 10 384 10 1 : tunables 54 27 0 : # raw_sock 2 8 480 8 1 : tunables 54 27 0 : # udp_sock 0 0 512 7 1 : tunables 54 27 0 : # tcp_sock 0 0 1024 4 1 : tunables 54 27 0 : # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # net/ipv6/udp.c # 2004/09/13 20:05:09-03:00 acme@conectiva.com.br +6 -0 # [NET] generalise per protocol slab cache handling # # With this patch we get two new slabcaches, for sctp socks, that previously # were being allocated on the default, that was tcp[6]_sock, i.e. wasting 288 # bytes per sock in the IPv4 case and 256 bytes for the IPv6 version, this is in # preparation for DCCP (or any other new protocol :) ). # # With this in place another nice side effect that is easier to achieve is to # get rid of struct sock sk->sk_slab, and instead use sk->sk_prot->slab, saving # sizeof(void *) on every struct sock instance, but this unfortunatly has to # wait for the conversion of all protocols that use per socket slabcaches to # use sk->sk_prot, AF_UNIX is the only one AFAIK, so I'll try to convert it to # use sk->sk_prot and then get rid of sk->sk_slab. # # As for the protocols that don't use per socket slabcaches its just a matter # of defaulting to sk_cachep at sk_free time if sk->sk_prot is NULL. # # [root@qemu ~]# modprobe sctp # [root@qemu ~]# grep _sock /proc/slabinfo # sctpv6_sock 9 9 864 9 2 : tunables 54 27 0 : # sctp_sock 0 0 736 5 1 : tunables 54 27 0 : # rawv6_sock 3 6 640 6 1 : tunables 54 27 0 : # udpv6_sock 0 0 608 6 1 : tunables 54 27 0 : # tcpv6_sock 1 7 1120 7 2 : tunables 24 12 0 : # unix_sock 6 10 384 10 1 : tunables 54 27 0 : # raw_sock 2 8 480 8 1 : tunables 54 27 0 : # udp_sock 0 0 512 7 1 : tunables 54 27 0 : # tcp_sock 0 0 1024 4 1 : tunables 54 27 0 : # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # net/ipv6/tcp_ipv6.c # 2004/09/13 20:05:09-03:00 acme@conectiva.com.br +6 -0 # [NET] generalise per protocol slab cache handling # # With this patch we get two new slabcaches, for sctp socks, that previously # were being allocated on the default, that was tcp[6]_sock, i.e. wasting 288 # bytes per sock in the IPv4 case and 256 bytes for the IPv6 version, this is in # preparation for DCCP (or any other new protocol :) ). # # With this in place another nice side effect that is easier to achieve is to # get rid of struct sock sk->sk_slab, and instead use sk->sk_prot->slab, saving # sizeof(void *) on every struct sock instance, but this unfortunatly has to # wait for the conversion of all protocols that use per socket slabcaches to # use sk->sk_prot, AF_UNIX is the only one AFAIK, so I'll try to convert it to # use sk->sk_prot and then get rid of sk->sk_slab. # # As for the protocols that don't use per socket slabcaches its just a matter # of defaulting to sk_cachep at sk_free time if sk->sk_prot is NULL. # # [root@qemu ~]# modprobe sctp # [root@qemu ~]# grep _sock /proc/slabinfo # sctpv6_sock 9 9 864 9 2 : tunables 54 27 0 : # sctp_sock 0 0 736 5 1 : tunables 54 27 0 : # rawv6_sock 3 6 640 6 1 : tunables 54 27 0 : # udpv6_sock 0 0 608 6 1 : tunables 54 27 0 : # tcpv6_sock 1 7 1120 7 2 : tunables 24 12 0 : # unix_sock 6 10 384 10 1 : tunables 54 27 0 : # raw_sock 2 8 480 8 1 : tunables 54 27 0 : # udp_sock 0 0 512 7 1 : tunables 54 27 0 : # tcp_sock 0 0 1024 4 1 : tunables 54 27 0 : # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # net/ipv6/raw.c # 2004/09/13 20:05:09-03:00 acme@conectiva.com.br +6 -0 # [NET] generalise per protocol slab cache handling # # With this patch we get two new slabcaches, for sctp socks, that previously # were being allocated on the default, that was tcp[6]_sock, i.e. wasting 288 # bytes per sock in the IPv4 case and 256 bytes for the IPv6 version, this is in # preparation for DCCP (or any other new protocol :) ). # # With this in place another nice side effect that is easier to achieve is to # get rid of struct sock sk->sk_slab, and instead use sk->sk_prot->slab, saving # sizeof(void *) on every struct sock instance, but this unfortunatly has to # wait for the conversion of all protocols that use per socket slabcaches to # use sk->sk_prot, AF_UNIX is the only one AFAIK, so I'll try to convert it to # use sk->sk_prot and then get rid of sk->sk_slab. # # As for the protocols that don't use per socket slabcaches its just a matter # of defaulting to sk_cachep at sk_free time if sk->sk_prot is NULL. # # [root@qemu ~]# modprobe sctp # [root@qemu ~]# grep _sock /proc/slabinfo # sctpv6_sock 9 9 864 9 2 : tunables 54 27 0 : # sctp_sock 0 0 736 5 1 : tunables 54 27 0 : # rawv6_sock 3 6 640 6 1 : tunables 54 27 0 : # udpv6_sock 0 0 608 6 1 : tunables 54 27 0 : # tcpv6_sock 1 7 1120 7 2 : tunables 24 12 0 : # unix_sock 6 10 384 10 1 : tunables 54 27 0 : # raw_sock 2 8 480 8 1 : tunables 54 27 0 : # udp_sock 0 0 512 7 1 : tunables 54 27 0 : # tcp_sock 0 0 1024 4 1 : tunables 54 27 0 : # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # net/ipv6/af_inet6.c # 2004/09/13 20:05:09-03:00 acme@conectiva.com.br +69 -86 # [NET] generalise per protocol slab cache handling # # With this patch we get two new slabcaches, for sctp socks, that previously # were being allocated on the default, that was tcp[6]_sock, i.e. wasting 288 # bytes per sock in the IPv4 case and 256 bytes for the IPv6 version, this is in # preparation for DCCP (or any other new protocol :) ). # # With this in place another nice side effect that is easier to achieve is to # get rid of struct sock sk->sk_slab, and instead use sk->sk_prot->slab, saving # sizeof(void *) on every struct sock instance, but this unfortunatly has to # wait for the conversion of all protocols that use per socket slabcaches to # use sk->sk_prot, AF_UNIX is the only one AFAIK, so I'll try to convert it to # use sk->sk_prot and then get rid of sk->sk_slab. # # As for the protocols that don't use per socket slabcaches its just a matter # of defaulting to sk_cachep at sk_free time if sk->sk_prot is NULL. # # [root@qemu ~]# modprobe sctp # [root@qemu ~]# grep _sock /proc/slabinfo # sctpv6_sock 9 9 864 9 2 : tunables 54 27 0 : # sctp_sock 0 0 736 5 1 : tunables 54 27 0 : # rawv6_sock 3 6 640 6 1 : tunables 54 27 0 : # udpv6_sock 0 0 608 6 1 : tunables 54 27 0 : # tcpv6_sock 1 7 1120 7 2 : tunables 24 12 0 : # unix_sock 6 10 384 10 1 : tunables 54 27 0 : # raw_sock 2 8 480 8 1 : tunables 54 27 0 : # udp_sock 0 0 512 7 1 : tunables 54 27 0 : # tcp_sock 0 0 1024 4 1 : tunables 54 27 0 : # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # net/ipv4/udp.c # 2004/09/13 20:05:09-03:00 acme@conectiva.com.br +1 -0 # [NET] generalise per protocol slab cache handling # # With this patch we get two new slabcaches, for sctp socks, that previously # were being allocated on the default, that was tcp[6]_sock, i.e. wasting 288 # bytes per sock in the IPv4 case and 256 bytes for the IPv6 version, this is in # preparation for DCCP (or any other new protocol :) ). # # With this in place another nice side effect that is easier to achieve is to # get rid of struct sock sk->sk_slab, and instead use sk->sk_prot->slab, saving # sizeof(void *) on every struct sock instance, but this unfortunatly has to # wait for the conversion of all protocols that use per socket slabcaches to # use sk->sk_prot, AF_UNIX is the only one AFAIK, so I'll try to convert it to # use sk->sk_prot and then get rid of sk->sk_slab. # # As for the protocols that don't use per socket slabcaches its just a matter # of defaulting to sk_cachep at sk_free time if sk->sk_prot is NULL. # # [root@qemu ~]# modprobe sctp # [root@qemu ~]# grep _sock /proc/slabinfo # sctpv6_sock 9 9 864 9 2 : tunables 54 27 0 : # sctp_sock 0 0 736 5 1 : tunables 54 27 0 : # rawv6_sock 3 6 640 6 1 : tunables 54 27 0 : # udpv6_sock 0 0 608 6 1 : tunables 54 27 0 : # tcpv6_sock 1 7 1120 7 2 : tunables 24 12 0 : # unix_sock 6 10 384 10 1 : tunables 54 27 0 : # raw_sock 2 8 480 8 1 : tunables 54 27 0 : # udp_sock 0 0 512 7 1 : tunables 54 27 0 : # tcp_sock 0 0 1024 4 1 : tunables 54 27 0 : # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # net/ipv4/tcp_minisocks.c # 2004/09/13 20:05:09-03:00 acme@conectiva.com.br +1 -1 # [NET] generalise per protocol slab cache handling # # With this patch we get two new slabcaches, for sctp socks, that previously # were being allocated on the default, that was tcp[6]_sock, i.e. wasting 288 # bytes per sock in the IPv4 case and 256 bytes for the IPv6 version, this is in # preparation for DCCP (or any other new protocol :) ). # # With this in place another nice side effect that is easier to achieve is to # get rid of struct sock sk->sk_slab, and instead use sk->sk_prot->slab, saving # sizeof(void *) on every struct sock instance, but this unfortunatly has to # wait for the conversion of all protocols that use per socket slabcaches to # use sk->sk_prot, AF_UNIX is the only one AFAIK, so I'll try to convert it to # use sk->sk_prot and then get rid of sk->sk_slab. # # As for the protocols that don't use per socket slabcaches its just a matter # of defaulting to sk_cachep at sk_free time if sk->sk_prot is NULL. # # [root@qemu ~]# modprobe sctp # [root@qemu ~]# grep _sock /proc/slabinfo # sctpv6_sock 9 9 864 9 2 : tunables 54 27 0 : # sctp_sock 0 0 736 5 1 : tunables 54 27 0 : # rawv6_sock 3 6 640 6 1 : tunables 54 27 0 : # udpv6_sock 0 0 608 6 1 : tunables 54 27 0 : # tcpv6_sock 1 7 1120 7 2 : tunables 24 12 0 : # unix_sock 6 10 384 10 1 : tunables 54 27 0 : # raw_sock 2 8 480 8 1 : tunables 54 27 0 : # udp_sock 0 0 512 7 1 : tunables 54 27 0 : # tcp_sock 0 0 1024 4 1 : tunables 54 27 0 : # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # net/ipv4/tcp_ipv4.c # 2004/09/13 20:05:09-03:00 acme@conectiva.com.br +1 -0 # [NET] generalise per protocol slab cache handling # # With this patch we get two new slabcaches, for sctp socks, that previously # were being allocated on the default, that was tcp[6]_sock, i.e. wasting 288 # bytes per sock in the IPv4 case and 256 bytes for the IPv6 version, this is in # preparation for DCCP (or any other new protocol :) ). # # With this in place another nice side effect that is easier to achieve is to # get rid of struct sock sk->sk_slab, and instead use sk->sk_prot->slab, saving # sizeof(void *) on every struct sock instance, but this unfortunatly has to # wait for the conversion of all protocols that use per socket slabcaches to # use sk->sk_prot, AF_UNIX is the only one AFAIK, so I'll try to convert it to # use sk->sk_prot and then get rid of sk->sk_slab. # # As for the protocols that don't use per socket slabcaches its just a matter # of defaulting to sk_cachep at sk_free time if sk->sk_prot is NULL. # # [root@qemu ~]# modprobe sctp # [root@qemu ~]# grep _sock /proc/slabinfo # sctpv6_sock 9 9 864 9 2 : tunables 54 27 0 : # sctp_sock 0 0 736 5 1 : tunables 54 27 0 : # rawv6_sock 3 6 640 6 1 : tunables 54 27 0 : # udpv6_sock 0 0 608 6 1 : tunables 54 27 0 : # tcpv6_sock 1 7 1120 7 2 : tunables 24 12 0 : # unix_sock 6 10 384 10 1 : tunables 54 27 0 : # raw_sock 2 8 480 8 1 : tunables 54 27 0 : # udp_sock 0 0 512 7 1 : tunables 54 27 0 : # tcp_sock 0 0 1024 4 1 : tunables 54 27 0 : # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # net/ipv4/raw.c # 2004/09/13 20:05:09-03:00 acme@conectiva.com.br +1 -0 # [NET] generalise per protocol slab cache handling # # With this patch we get two new slabcaches, for sctp socks, that previously # were being allocated on the default, that was tcp[6]_sock, i.e. wasting 288 # bytes per sock in the IPv4 case and 256 bytes for the IPv6 version, this is in # preparation for DCCP (or any other new protocol :) ). # # With this in place another nice side effect that is easier to achieve is to # get rid of struct sock sk->sk_slab, and instead use sk->sk_prot->slab, saving # sizeof(void *) on every struct sock instance, but this unfortunatly has to # wait for the conversion of all protocols that use per socket slabcaches to # use sk->sk_prot, AF_UNIX is the only one AFAIK, so I'll try to convert it to # use sk->sk_prot and then get rid of sk->sk_slab. # # As for the protocols that don't use per socket slabcaches its just a matter # of defaulting to sk_cachep at sk_free time if sk->sk_prot is NULL. # # [root@qemu ~]# modprobe sctp # [root@qemu ~]# grep _sock /proc/slabinfo # sctpv6_sock 9 9 864 9 2 : tunables 54 27 0 : # sctp_sock 0 0 736 5 1 : tunables 54 27 0 : # rawv6_sock 3 6 640 6 1 : tunables 54 27 0 : # udpv6_sock 0 0 608 6 1 : tunables 54 27 0 : # tcpv6_sock 1 7 1120 7 2 : tunables 24 12 0 : # unix_sock 6 10 384 10 1 : tunables 54 27 0 : # raw_sock 2 8 480 8 1 : tunables 54 27 0 : # udp_sock 0 0 512 7 1 : tunables 54 27 0 : # tcp_sock 0 0 1024 4 1 : tunables 54 27 0 : # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # net/ipv4/af_inet.c # 2004/09/13 20:05:09-03:00 acme@conectiva.com.br +53 -56 # [NET] generalise per protocol slab cache handling # # With this patch we get two new slabcaches, for sctp socks, that previously # were being allocated on the default, that was tcp[6]_sock, i.e. wasting 288 # bytes per sock in the IPv4 case and 256 bytes for the IPv6 version, this is in # preparation for DCCP (or any other new protocol :) ). # # With this in place another nice side effect that is easier to achieve is to # get rid of struct sock sk->sk_slab, and instead use sk->sk_prot->slab, saving # sizeof(void *) on every struct sock instance, but this unfortunatly has to # wait for the conversion of all protocols that use per socket slabcaches to # use sk->sk_prot, AF_UNIX is the only one AFAIK, so I'll try to convert it to # use sk->sk_prot and then get rid of sk->sk_slab. # # As for the protocols that don't use per socket slabcaches its just a matter # of defaulting to sk_cachep at sk_free time if sk->sk_prot is NULL. # # [root@qemu ~]# modprobe sctp # [root@qemu ~]# grep _sock /proc/slabinfo # sctpv6_sock 9 9 864 9 2 : tunables 54 27 0 : # sctp_sock 0 0 736 5 1 : tunables 54 27 0 : # rawv6_sock 3 6 640 6 1 : tunables 54 27 0 : # udpv6_sock 0 0 608 6 1 : tunables 54 27 0 : # tcpv6_sock 1 7 1120 7 2 : tunables 24 12 0 : # unix_sock 6 10 384 10 1 : tunables 54 27 0 : # raw_sock 2 8 480 8 1 : tunables 54 27 0 : # udp_sock 0 0 512 7 1 : tunables 54 27 0 : # tcp_sock 0 0 1024 4 1 : tunables 54 27 0 : # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # net/core/sock.c # 2004/09/13 20:05:09-03:00 acme@conectiva.com.br +21 -0 # [NET] generalise per protocol slab cache handling # # With this patch we get two new slabcaches, for sctp socks, that previously # were being allocated on the default, that was tcp[6]_sock, i.e. wasting 288 # bytes per sock in the IPv4 case and 256 bytes for the IPv6 version, this is in # preparation for DCCP (or any other new protocol :) ). # # With this in place another nice side effect that is easier to achieve is to # get rid of struct sock sk->sk_slab, and instead use sk->sk_prot->slab, saving # sizeof(void *) on every struct sock instance, but this unfortunatly has to # wait for the conversion of all protocols that use per socket slabcaches to # use sk->sk_prot, AF_UNIX is the only one AFAIK, so I'll try to convert it to # use sk->sk_prot and then get rid of sk->sk_slab. # # As for the protocols that don't use per socket slabcaches its just a matter # of defaulting to sk_cachep at sk_free time if sk->sk_prot is NULL. # # [root@qemu ~]# modprobe sctp # [root@qemu ~]# grep _sock /proc/slabinfo # sctpv6_sock 9 9 864 9 2 : tunables 54 27 0 : # sctp_sock 0 0 736 5 1 : tunables 54 27 0 : # rawv6_sock 3 6 640 6 1 : tunables 54 27 0 : # udpv6_sock 0 0 608 6 1 : tunables 54 27 0 : # tcpv6_sock 1 7 1120 7 2 : tunables 24 12 0 : # unix_sock 6 10 384 10 1 : tunables 54 27 0 : # raw_sock 2 8 480 8 1 : tunables 54 27 0 : # udp_sock 0 0 512 7 1 : tunables 54 27 0 : # tcp_sock 0 0 1024 4 1 : tunables 54 27 0 : # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # include/net/tcp.h # 2004/09/13 20:05:09-03:00 acme@conectiva.com.br +0 -3 # [NET] generalise per protocol slab cache handling # # With this patch we get two new slabcaches, for sctp socks, that previously # were being allocated on the default, that was tcp[6]_sock, i.e. wasting 288 # bytes per sock in the IPv4 case and 256 bytes for the IPv6 version, this is in # preparation for DCCP (or any other new protocol :) ). # # With this in place another nice side effect that is easier to achieve is to # get rid of struct sock sk->sk_slab, and instead use sk->sk_prot->slab, saving # sizeof(void *) on every struct sock instance, but this unfortunatly has to # wait for the conversion of all protocols that use per socket slabcaches to # use sk->sk_prot, AF_UNIX is the only one AFAIK, so I'll try to convert it to # use sk->sk_prot and then get rid of sk->sk_slab. # # As for the protocols that don't use per socket slabcaches its just a matter # of defaulting to sk_cachep at sk_free time if sk->sk_prot is NULL. # # [root@qemu ~]# modprobe sctp # [root@qemu ~]# grep _sock /proc/slabinfo # sctpv6_sock 9 9 864 9 2 : tunables 54 27 0 : # sctp_sock 0 0 736 5 1 : tunables 54 27 0 : # rawv6_sock 3 6 640 6 1 : tunables 54 27 0 : # udpv6_sock 0 0 608 6 1 : tunables 54 27 0 : # tcpv6_sock 1 7 1120 7 2 : tunables 24 12 0 : # unix_sock 6 10 384 10 1 : tunables 54 27 0 : # raw_sock 2 8 480 8 1 : tunables 54 27 0 : # udp_sock 0 0 512 7 1 : tunables 54 27 0 : # tcp_sock 0 0 1024 4 1 : tunables 54 27 0 : # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # include/net/sock.h # 2004/09/13 20:05:09-03:00 acme@conectiva.com.br +12 -0 # [NET] generalise per protocol slab cache handling # # With this patch we get two new slabcaches, for sctp socks, that previously # were being allocated on the default, that was tcp[6]_sock, i.e. wasting 288 # bytes per sock in the IPv4 case and 256 bytes for the IPv6 version, this is in # preparation for DCCP (or any other new protocol :) ). # # With this in place another nice side effect that is easier to achieve is to # get rid of struct sock sk->sk_slab, and instead use sk->sk_prot->slab, saving # sizeof(void *) on every struct sock instance, but this unfortunatly has to # wait for the conversion of all protocols that use per socket slabcaches to # use sk->sk_prot, AF_UNIX is the only one AFAIK, so I'll try to convert it to # use sk->sk_prot and then get rid of sk->sk_slab. # # As for the protocols that don't use per socket slabcaches its just a matter # of defaulting to sk_cachep at sk_free time if sk->sk_prot is NULL. # # [root@qemu ~]# modprobe sctp # [root@qemu ~]# grep _sock /proc/slabinfo # sctpv6_sock 9 9 864 9 2 : tunables 54 27 0 : # sctp_sock 0 0 736 5 1 : tunables 54 27 0 : # rawv6_sock 3 6 640 6 1 : tunables 54 27 0 : # udpv6_sock 0 0 608 6 1 : tunables 54 27 0 : # tcpv6_sock 1 7 1120 7 2 : tunables 24 12 0 : # unix_sock 6 10 384 10 1 : tunables 54 27 0 : # raw_sock 2 8 480 8 1 : tunables 54 27 0 : # udp_sock 0 0 512 7 1 : tunables 54 27 0 : # tcp_sock 0 0 1024 4 1 : tunables 54 27 0 : # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # include/net/sctp/sctp.h # 2004/09/13 20:05:09-03:00 acme@conectiva.com.br +1 -0 # [NET] generalise per protocol slab cache handling # # With this patch we get two new slabcaches, for sctp socks, that previously # were being allocated on the default, that was tcp[6]_sock, i.e. wasting 288 # bytes per sock in the IPv4 case and 256 bytes for the IPv6 version, this is in # preparation for DCCP (or any other new protocol :) ). # # With this in place another nice side effect that is easier to achieve is to # get rid of struct sock sk->sk_slab, and instead use sk->sk_prot->slab, saving # sizeof(void *) on every struct sock instance, but this unfortunatly has to # wait for the conversion of all protocols that use per socket slabcaches to # use sk->sk_prot, AF_UNIX is the only one AFAIK, so I'll try to convert it to # use sk->sk_prot and then get rid of sk->sk_slab. # # As for the protocols that don't use per socket slabcaches its just a matter # of defaulting to sk_cachep at sk_free time if sk->sk_prot is NULL. # # [root@qemu ~]# modprobe sctp # [root@qemu ~]# grep _sock /proc/slabinfo # sctpv6_sock 9 9 864 9 2 : tunables 54 27 0 : # sctp_sock 0 0 736 5 1 : tunables 54 27 0 : # rawv6_sock 3 6 640 6 1 : tunables 54 27 0 : # udpv6_sock 0 0 608 6 1 : tunables 54 27 0 : # tcpv6_sock 1 7 1120 7 2 : tunables 24 12 0 : # unix_sock 6 10 384 10 1 : tunables 54 27 0 : # raw_sock 2 8 480 8 1 : tunables 54 27 0 : # udp_sock 0 0 512 7 1 : tunables 54 27 0 : # tcp_sock 0 0 1024 4 1 : tunables 54 27 0 : # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # include/linux/ipv6.h # 2004/09/13 20:05:09-03:00 acme@conectiva.com.br +4 -0 # [NET] generalise per protocol slab cache handling # # With this patch we get two new slabcaches, for sctp socks, that previously # were being allocated on the default, that was tcp[6]_sock, i.e. wasting 288 # bytes per sock in the IPv4 case and 256 bytes for the IPv6 version, this is in # preparation for DCCP (or any other new protocol :) ). # # With this in place another nice side effect that is easier to achieve is to # get rid of struct sock sk->sk_slab, and instead use sk->sk_prot->slab, saving # sizeof(void *) on every struct sock instance, but this unfortunatly has to # wait for the conversion of all protocols that use per socket slabcaches to # use sk->sk_prot, AF_UNIX is the only one AFAIK, so I'll try to convert it to # use sk->sk_prot and then get rid of sk->sk_slab. # # As for the protocols that don't use per socket slabcaches its just a matter # of defaulting to sk_cachep at sk_free time if sk->sk_prot is NULL. # # [root@qemu ~]# modprobe sctp # [root@qemu ~]# grep _sock /proc/slabinfo # sctpv6_sock 9 9 864 9 2 : tunables 54 27 0 : # sctp_sock 0 0 736 5 1 : tunables 54 27 0 : # rawv6_sock 3 6 640 6 1 : tunables 54 27 0 : # udpv6_sock 0 0 608 6 1 : tunables 54 27 0 : # tcpv6_sock 1 7 1120 7 2 : tunables 24 12 0 : # unix_sock 6 10 384 10 1 : tunables 54 27 0 : # raw_sock 2 8 480 8 1 : tunables 54 27 0 : # udp_sock 0 0 512 7 1 : tunables 54 27 0 : # tcp_sock 0 0 1024 4 1 : tunables 54 27 0 : # # Signed-off-by: Arnaldo Carvalho de Melo # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/13 16:04:36-07:00 i@stingr.net # [IPV4]: Add wccp v1/v2 support to ip_gre.c # # Signed-off-by: David S. Miller # # net/ipv4/ip_gre.c # 2004/09/13 16:04:06-07:00 i@stingr.net +12 -1 # [IPV4]: Add wccp v1/v2 support to ip_gre.c # # include/linux/if_ether.h # 2004/09/13 16:04:06-07:00 i@stingr.net +2 -0 # [IPV4]: Add wccp v1/v2 support to ip_gre.c # # ChangeSet # 2004/09/13 23:52:16+01:00 ben-linux@org.rmk.(none) # [ARM PATCH] 2093/1: S3C2410 - remove un-necessary resource from NAND # # Patch from Ben Dooks # # Removed resource description left by copying error # # Thanks to Klaus Fetscher for pointing this out. # # Signed-off-by: Ben Dooks # # arch/arm/mach-s3c2410/devs.c # 2004/09/13 13:18:54+01:00 ben-linux@org.rmk.(none) +0 -6 # [PATCH] 2093/1: S3C2410 - remove un-necessary resource from NAND # # ChangeSet # 2004/09/13 23:47:50+01:00 ben-linux@org.rmk.(none) # [ARM PATCH] 2092/1: S3C2410 - gpio bugfix and additions # # Patch from Ben Dooks # # Fix inverted mask in s3c2410_gpio_setpin() function, # add s3c2410_modify_misccr() for shared register, and # add s3c2410_gpio_getpin() # # Signed-off-by: Ben Dooks # # include/asm-arm/arch-s3c2410/hardware.h # 2004/09/12 17:15:18+01:00 ben-linux@org.rmk.(none) +5 -0 # [PATCH] 2092/1: S3C2410 - gpio bugfix and additions # # arch/arm/mach-s3c2410/gpio.c # 2004/09/12 16:59:08+01:00 ben-linux@org.rmk.(none) +28 -1 # [PATCH] 2092/1: S3C2410 - gpio bugfix and additions # # ChangeSet # 2004/09/13 23:43:25+01:00 ben-linux@org.rmk.(none) # [ARM PATCH] 2091/1: S3C2410 - change id of s3c2410-ohci # # Patch from Ben Dooks # # Fix missed ID change on s3c2410-usb # # Signed-off-by: Ben DOoks # # ChangeSet # 2004/09/13 15:43:14-07:00 davem@nuts.davemloft.net # [TCP]: Just silently ignore ICMP Source Quench messages. # # Recommended by draft-gont-tcpm-icmp-attacks-01.txt # # Signed-off-by: David S. Miller # # net/ipv4/tcp_ipv4.c # 2004/09/13 15:42:33-07:00 davem@nuts.davemloft.net +1 -5 # [TCP]: Just silently ignore ICMP Source Quench messages. # # arch/arm/mach-s3c2410/devs.c # 2004/09/12 12:39:29+01:00 ben-linux@org.rmk.(none) +1 -1 # [PATCH] 2091/1: S3C2410 - change id of s3c2410-ohci # # ChangeSet # 2004/09/13 23:39:13+01:00 ben-linux@org.rmk.(none) # [ARM PATCH] 2090/2: S3C2410 - usb gadged (udc) include # # Patch from Ben Dooks # # Header file for USB gadget controller (udc) for the # Samsung S3C2410 SoC # # Signed-off-by: Herbert Poetzl # Signed-off-by: Ben Dooks # # include/asm-arm/arch-s3c2410/regs-udc.h # 2004/09/12 01:55:24+01:00 ben-linux@org.rmk.(none) +162 -0 # [PATCH] 2090/2: S3C2410 - usb gadged (udc) include # # include/asm-arm/arch-s3c2410/regs-udc.h # 2004/09/12 01:55:24+01:00 ben-linux@org.rmk.(none) +0 -0 # BitKeeper file /usr/src/bk/linux-2.6-rmk/include/asm-arm/arch-s3c2410/regs-udc.h # # ChangeSet # 2004/09/13 23:33:33+01:00 rmk@flint.arm.linux.org.uk # [ARM] Revive kapmd and provide apm_queue_event() # # Add kapmd thread to provide a process context to handle "APM" # events submitted via apm_queue_event(). # # Add apm_queue_event(), which can be called from hardware # interrupt handlers and the like, typically to fire off a # suspend. # # include/asm-arm/apm.h # 2004/09/13 23:30:04+01:00 rmk@flint.arm.linux.org.uk +5 -0 # Add apm_queue_event() prototype # # arch/arm/kernel/apm.c # 2004/09/13 23:29:42+01:00 rmk@flint.arm.linux.org.uk +79 -28 # Revive kapmd # # ChangeSet # 2004/09/13 23:28:34+01:00 rmk@flint.arm.linux.org.uk # [ARM] Update APM state definitions # # Move existing APM state definitions into struct apm_power_info, # and add further definitions describing other fields. # # include/asm-arm/apm.h # 2004/09/13 23:24:14+01:00 rmk@flint.arm.linux.org.uk +23 -19 # Move existing APM state definitions into struct apm_power_info, # and add further definitions describing other fields. # # ChangeSet # 2004/09/13 23:22:23+01:00 rmk@flint.arm.linux.org.uk # [ARM] Keep APM threads frozen # # Ensure threads waiting for suspend to occur in apm_ioctl are # not woken by the pm_suspend thread freezing - they're already # frozen. # # arch/arm/kernel/apm.c # 2004/09/13 23:19:11+01:00 rmk@flint.arm.linux.org.uk +22 -13 # Keep APM threads frozen # # ChangeSet # 2004/09/13 23:18:17+01:00 rmk@flint.arm.linux.org.uk # [ARM] No point having "nonblock" local variable - kill it. # # arch/arm/kernel/apm.c # 2004/09/13 23:14:58+01:00 rmk@flint.arm.linux.org.uk +2 -2 # No point having "nonblock" local variable - kill it. # # ChangeSet # 2004/09/13 23:13:03+01:00 rmk@flint.arm.linux.org.uk # [ARM] Convert suspend to a state machine. # # The original version had issues when two suspend events came # in at around the same time, causing APM to get confused: # threads became stuck in APM_IOC_SUSPEND and suspends_pending # incremented on each apm --suspend call. # # Now, we only add a suspend event to a users queue and increment # suspends_pending if the user isn't already in the middle of # handling a suspend event. # # ChangeSet # 2004/09/13 15:11:27-07:00 nico@cam.org # [PATCH] linux/dma-mapping.h needs linux/device.h # # It seems that most architectures already include linux/device.h in their # own asm/dma-mapping.h. Most but not all, and some drivers fail to # compile on those architectures that don't. Since everybody needs it # let's include device.h from one place only and fix compilation for # everybody. # # include/linux/dma-mapping.h # 2004/09/10 08:28:58-07:00 nico@cam.org +1 -0 # linux/dma-mapping.h needs linux/device.h # # include/asm-x86_64/dma-mapping.h # 2004/09/10 08:33:31-07:00 nico@cam.org +0 -1 # linux/dma-mapping.h needs linux/device.h # # include/asm-sparc/dma-mapping.h # 2004/09/10 08:30:54-07:00 nico@cam.org +0 -1 # linux/dma-mapping.h needs linux/device.h # # include/asm-sh64/dma-mapping.h # 2004/09/10 08:33:57-07:00 nico@cam.org +0 -1 # linux/dma-mapping.h needs linux/device.h # # include/asm-sh/dma-mapping.h # 2004/09/10 08:34:27-07:00 nico@cam.org +0 -1 # linux/dma-mapping.h needs linux/device.h # # include/asm-ppc64/dma-mapping.h # 2004/09/10 08:34:51-07:00 nico@cam.org +0 -1 # linux/dma-mapping.h needs linux/device.h # # include/asm-ppc/dma-mapping.h # 2004/09/10 08:35:12-07:00 nico@cam.org +0 -1 # linux/dma-mapping.h needs linux/device.h # # include/asm-mips/dma-mapping.h # 2004/09/10 08:35:32-07:00 nico@cam.org +0 -1 # linux/dma-mapping.h needs linux/device.h # # include/asm-ia64/dma-mapping.h # 2004/09/10 08:32:59-07:00 nico@cam.org +0 -1 # linux/dma-mapping.h needs linux/device.h # # include/asm-i386/dma-mapping.h # 2004/09/10 08:30:26-07:00 nico@cam.org +0 -1 # linux/dma-mapping.h needs linux/device.h # # arch/arm/kernel/apm.c # 2004/09/13 23:09:29+01:00 rmk@flint.arm.linux.org.uk +44 -29 # Convert suspend to a state machine. # # ChangeSet # 2004/09/13 23:04:59+01:00 rmk@flint.arm.linux.org.uk # [ARM] Remove APM standby support - it's unused. # # arch/arm/kernel/apm.c # 2004/09/13 23:01:58+01:00 rmk@flint.arm.linux.org.uk +3 -29 # Remove APM standby support - it's unused. # # ChangeSet # 2004/09/13 22:59:57+01:00 rmk@flint.arm.linux.org.uk # [ARM] APM: "Battery life" needs to be a signed integer. # # include/asm-arm/apm.h # 2004/09/13 22:54:57+01:00 rmk@flint.arm.linux.org.uk +1 -1 # "Battery life" needs to be a signed integer. # # arch/arm/kernel/apm.c # 2004/09/13 22:54:52+01:00 rmk@flint.arm.linux.org.uk +1 -1 # "Battery life" needs to be a signed integer. # # ChangeSet # 2004/09/13 22:52:50+01:00 rmk@flint.arm.linux.org.uk # [ARM] Convert APM user list lock to r/w sem # # Convert user_list_lock spinlock to a read/write semaphore; # the spinlock was affording us very little protection. # # arch/arm/kernel/apm.c # 2004/09/13 22:49:32+01:00 rmk@flint.arm.linux.org.uk +9 -9 # Convert user_list_lock spinlock to a read/write semaphore; # the spinlock was affording us very little protection. # # ChangeSet # 2004/09/13 22:43:47+01:00 rmk@flint.arm.linux.org.uk # [ARM] Abstract APM circular queue object. # # arch/arm/kernel/apm.c # 2004/09/13 22:39:18+01:00 rmk@flint.arm.linux.org.uk +33 -21 # Abstract APM circular queue object. # # ChangeSet # 2004/09/13 22:38:26+01:00 rmk@flint.arm.linux.org.uk # [ARM] Convert list_for_each()/list_entry() to list_for_each_entry() # # arch/arm/kernel/apm.c # 2004/09/13 22:35:58+01:00 rmk@flint.arm.linux.org.uk +4 -8 # Convert list_for_each()/list_entry() to list_for_each_entry() # # ChangeSet # 2004/09/13 22:34:49+01:00 rmk@flint.arm.linux.org.uk # [ARM] Remove the hh.org H3600 "example" code. # # arch/arm/kernel/apm.c # 2004/09/13 22:29:29+01:00 rmk@flint.arm.linux.org.uk +0 -13 # Remove the hh.org H3600 "example" code. # # ChangeSet # 2004/09/13 22:28:23+01:00 rmk@flint.arm.linux.org.uk # [ARM] Fix ARM APM emulation sparse errors # # arch/arm/kernel/apm.c:57:16: warning: dubious one-bit signed bitfield # arch/arm/kernel/apm.c:58:17: warning: dubious one-bit signed bitfield # arch/arm/kernel/apm.c:59:17: warning: dubious one-bit signed bitfield # arch/arm/kernel/apm.c:60:23: warning: dubious one-bit signed bitfield # # arch/arm/kernel/apm.c # 2004/09/13 22:25:13+01:00 rmk@flint.arm.linux.org.uk +4 -4 # Fix a few extra sparse errors # # ChangeSet # 2004/09/13 14:05:42-07:00 akpm@osdl.org # [PATCH] isofs buffer management fix # # There's a double-free in the isofs filesystem. # # Invalidate this pointer so it doesn't get freed twice. # # Signed-off-by: Andrew Morton # Signed-off-by: Linus Torvalds # # fs/isofs/rock.c # 2004/09/10 01:47:00-07:00 akpm@osdl.org +1 -1 # isofs buffer management fix # # ChangeSet # 2004/09/13 14:05:30-07:00 anton@samba.org # [PATCH] Backward compatibility for compat sched_getaffinity # # The follow patch special cases the NR_CPUS <= BITS_PER_COMPAT_LONG case. # Without this patch, a 32bit task would be required to have a 64bit # cpumask no matter what value of NR_CPUS are used. # # With this patch a compat long sized bitmask is allowed if NR_CPUS is # small enough to fit within it. # # Of course applications should be using the glibc wrappers that use an # opaque cpu_mask_t type, but there could be older applications using the # syscalls directly. # # Signed-off-by: Anton Blanchard # Signed-off-by: Linus Torvalds # # kernel/compat.c # 2004/09/09 05:59:05-07:00 anton@samba.org +7 -3 # Backward compatibility for compat sched_getaffinity # # ChangeSet # 2004/09/13 14:05:18-07:00 anton@samba.org # [PATCH] Clean up compat sched affinity syscalls # # Remove the set_fs hack in the compat affinity calls. Create # sched_getaffinity and sched_setaffinity helper functions that both the # native and compat affinity syscalls use. # # Also make the compat functions match what the native ones are doing now, # setaffinity calls succeed no matter what length the bitmask is, but # getaffinity calls must pass in bitmasks at least as long as the kernel # type. # # Signed-off-by: Anton Blanchard # Signed-off-by: Linus Torvalds # # kernel/sched.c # 2004/09/09 05:09:57-07:00 anton@samba.org +60 -42 # Clean up compat sched affinity syscalls # # kernel/compat.c # 2004/09/09 05:58:30-07:00 anton@samba.org +29 -67 # Clean up compat sched affinity syscalls # # include/linux/sched.h # 2004/09/09 05:09:57-07:00 anton@samba.org +3 -0 # Clean up compat sched affinity syscalls # # ChangeSet # 2004/09/13 13:47:41-07:00 torvalds@ppc970.osdl.org # Export new PCI iomem access interfaces to modules too. # # lib/iomap.c # 2004/09/13 13:47:35-07:00 torvalds@ppc970.osdl.org +11 -0 # Export new PCI iomem access interfaces to modules too. # # ChangeSet # 2004/09/13 13:03:56-07:00 herbert@gondor.apana.org.au # [IPV6]: Add option to copy DSCP in decap in ip6_tunnel. # # Here is a patch that allows the copying of the DSCP during decapsulation # for ip6_tunnel. I've made it a separate option from the one that # determines the copying during encapsulation since the DSCP processing # may be asymmetric. It also means that we preserve compatibility should # anyone be relying on the current behaviour. # # inet_ecn.h might appear to be an odd place for ipv6_copy_dscp, but # I couldn't put it in dsfield.h since I want to use ipv6_get_dsfield # in inet_ecn.h later on. The other alternative would be to define # INET_ECN_MASK in dsfield.h. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # net/ipv6/ip6_tunnel.c # 2004/09/13 13:03:39-07:00 herbert@gondor.apana.org.au +2 -0 # [IPV6]: Add option to copy DSCP in decap in ip6_tunnel. # # Here is a patch that allows the copying of the DSCP during decapsulation # for ip6_tunnel. I've made it a separate option from the one that # determines the copying during encapsulation since the DSCP processing # may be asymmetric. It also means that we preserve compatibility should # anyone be relying on the current behaviour. # # inet_ecn.h might appear to be an odd place for ipv6_copy_dscp, but # I couldn't put it in dsfield.h since I want to use ipv6_get_dsfield # in inet_ecn.h later on. The other alternative would be to define # INET_ECN_MASK in dsfield.h. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # include/net/inet_ecn.h # 2004/09/13 13:03:39-07:00 herbert@gondor.apana.org.au +7 -0 # [IPV6]: Add option to copy DSCP in decap in ip6_tunnel. # # Here is a patch that allows the copying of the DSCP during decapsulation # for ip6_tunnel. I've made it a separate option from the one that # determines the copying during encapsulation since the DSCP processing # may be asymmetric. It also means that we preserve compatibility should # anyone be relying on the current behaviour. # # inet_ecn.h might appear to be an odd place for ipv6_copy_dscp, but # I couldn't put it in dsfield.h since I want to use ipv6_get_dsfield # in inet_ecn.h later on. The other alternative would be to define # INET_ECN_MASK in dsfield.h. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # include/linux/ip6_tunnel.h # 2004/09/13 13:03:39-07:00 herbert@gondor.apana.org.au +2 -0 # [IPV6]: Add option to copy DSCP in decap in ip6_tunnel. # # Here is a patch that allows the copying of the DSCP during decapsulation # for ip6_tunnel. I've made it a separate option from the one that # determines the copying during encapsulation since the DSCP processing # may be asymmetric. It also means that we preserve compatibility should # anyone be relying on the current behaviour. # # inet_ecn.h might appear to be an odd place for ipv6_copy_dscp, but # I couldn't put it in dsfield.h since I want to use ipv6_get_dsfield # in inet_ecn.h later on. The other alternative would be to define # INET_ECN_MASK in dsfield.h. # # Signed-off-by: Herbert Xu # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/13 12:58:04-07:00 ak@muc.de # [NET]: Fix missing spin lock in lltx path. # # This fixes a silly missing spin lock in the relock path. For some # reason it seems to still work when you don't have spinlock debugging # enabled. # # Please apply. # # Thanks to Arjan's spinlock debug kernel for finding it. # # Signed-off-by: Andi Kleen # Signed-off-by: David S. Miller # # net/sched/sch_generic.c # 2004/09/13 12:57:46-07:00 ak@muc.de +3 -1 # [NET]: Fix missing spin lock in lltx path. # # This fixes a silly missing spin lock in the relock path. For some # reason it seems to still work when you don't have spinlock debugging # enabled. # # Please apply. # # Thanks to Arjan's spinlock debug kernel for finding it. # # Signed-off-by: Andi Kleen # Signed-off-by: David S. Miller # # ChangeSet # 2004/09/13 18:55:39+00:00 aegl@agluck-lia64.sc.intel.com # Merge agluck-lia64.sc.intel.com:/data/home/aegl/BK/work/stephane # into agluck-lia64.sc.intel.com:/data/home/aegl/BK/linux-ia64-release-2.6.9 # # arch/ia64/Makefile # 2004/09/13 18:55:33+00:00 aegl@agluck-lia64.sc.intel.com +0 -0 # Auto merged # # ChangeSet # 2004/09/13 18:48:29+00:00 eranian@hpl.hp.com # [IA64] Makefile: fix for the PTRACE_SYSCALL corruption bug # # Thanks to David for his help in tracking it down. # # compile the kernel with sibling call optimization # turned off. There is a problem with all functions # using the optimization and the asmlinkage attribute. # The compiler should not perform the optimization on # these functions because it cannot preserve the syscall # parameters in the callee. This caused SIGSEGV on programs # traced with PTRACE_SYSCALL, for instance. # # signed-off-by: stephane eranian # Signed-off-by: Tony Luck # # arch/ia64/Makefile # 2004/09/13 18:44:37+00:00 aegl@agluck-lia64.sc.intel.com +1 -1 # Turn off sibling call optimizations (avoid asmlinkage breakage). # # ChangeSet # 2004/09/13 11:32:00-07:00 torvalds@ppc970.osdl.org # Add skeleton "generic IO mapping" infrastructure. # # Jeff wants to use this to clean up SATA and some network drivers. # # lib/iomap.c # 2004/09/13 11:31:53-07:00 torvalds@ppc970.osdl.org +110 -0 # # include/asm-generic/iomap.h # 2004/09/13 11:31:53-07:00 torvalds@ppc970.osdl.org +44 -0 # # lib/iomap.c # 2004/09/13 11:31:53-07:00 torvalds@ppc970.osdl.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/lib/iomap.c # # lib/Makefile # 2004/09/13 11:31:53-07:00 torvalds@ppc970.osdl.org +1 -0 # Add skeleton "generic IO mapping" infrastructure. # # Jeff wants to use this to clean up SATA and some network drivers. # # include/asm-generic/iomap.h # 2004/09/13 11:31:53-07:00 torvalds@ppc970.osdl.org +0 -0 # BitKeeper file /home/torvalds/v2.6/linux/include/asm-generic/iomap.h # # include/asm-ppc64/io.h # 2004/09/13 11:31:52-07:00 torvalds@ppc970.osdl.org +2 -0 # Add skeleton "generic IO mapping" infrastructure. # # Jeff wants to use this to clean up SATA and some network drivers. # # include/asm-i386/io.h # 2004/09/13 11:31:52-07:00 torvalds@ppc970.osdl.org +2 -0 # Add skeleton "generic IO mapping" infrastructure. # # Jeff wants to use this to clean up SATA and some network drivers. # # arch/x86_64/Kconfig # 2004/09/13 11:31:52-07:00 torvalds@ppc970.osdl.org +4 -0 # Add skeleton "generic IO mapping" infrastructure. # # Jeff wants to use this to clean up SATA and some network drivers. # # arch/ppc64/Kconfig # 2004/09/13 11:31:52-07:00 torvalds@ppc970.osdl.org +4 -0 # Add skeleton "generic IO mapping" infrastructure. # # Jeff wants to use this to clean up SATA and some network drivers. # # arch/ppc/Kconfig # 2004/09/13 11:31:52-07:00 torvalds@ppc970.osdl.org +4 -0 # Add skeleton "generic IO mapping" infrastructure. # # Jeff wants to use this to clean up SATA and some network drivers. # # arch/ia64/Kconfig # 2004/09/13 11:31:52-07:00 torvalds@ppc970.osdl.org +4 -0 # Add skeleton "generic IO mapping" infrastructure. # # Jeff wants to use this to clean up SATA and some network drivers. # # arch/i386/Kconfig # 2004/09/13 11:31:52-07:00 torvalds@ppc970.osdl.org +4 -0 # Add skeleton "generic IO mapping" infrastructure. # # Jeff wants to use this to clean up SATA and some network drivers. # # arch/arm/Kconfig # 2004/09/13 11:31:52-07:00 torvalds@ppc970.osdl.org +4 -0 # Add skeleton "generic IO mapping" infrastructure. # # Jeff wants to use this to clean up SATA and some network drivers. # # arch/alpha/Kconfig # 2004/09/13 11:31:52-07:00 torvalds@ppc970.osdl.org +4 -0 # Add skeleton "generic IO mapping" infrastructure. # # Jeff wants to use this to clean up SATA and some network drivers. # # ChangeSet # 2004/09/13 09:41:04-07:00 bzolnier@elka.pw.edu.pl # [PATCH] ide: small cleanup for sis5513 # # Sigh, Thomas Gleixner pointed out that his # sis5518 fix didn't need forward porting. # # Signed-off-by: Bartlomiej Zolnierkiewicz # Signed-off-by: Linus Torvalds # # drivers/ide/pci/sis5513.c # 2004/09/13 05:53:51-07:00 bzolnier@elka.pw.edu.pl +10 -16 # ide: small cleanup for sis5513 # # ChangeSet # 2004/09/13 12:28:57+02:00 vojtech@suse.cz # Merge suse.cz:/data2/bk/linus into suse.cz:/data2/bk/input # # include/linux/hiddev.h # 2004/09/13 12:28:52+02:00 vojtech@suse.cz +0 -7 # Auto merged # # fs/compat_ioctl.c # 2004/09/13 12:28:52+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/usb/input/hiddev.c # 2004/09/13 12:28:52+02:00 vojtech@suse.cz +0 -6 # Auto merged # # drivers/input/serio/Kconfig # 2004/09/13 12:28:52+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/Makefile # 2004/09/13 12:28:52+02:00 vojtech@suse.cz +0 -0 # Auto merged # # MAINTAINERS # 2004/09/13 12:28:52+02:00 vojtech@suse.cz +0 -0 # Auto merged # # Documentation/kernel-parameters.txt # 2004/09/13 12:28:52+02:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2004/09/13 16:04:16+09:00 yoshfuji@linux-ipv6.org # [IPV6] purge routes via non-router neighbour but gateway. # # Signed-off-by: Hideaki YOSHIFUJI # # ChangeSet # 2004/09/13 16:02:20+09:00 yoshfuji@linux-ipv6.org # [IPV6] ensure to aging default routes. # # This patch is product of corraboration with Ville Nuorvala # . # # Signed-off-by: Hideaki YOSHIFUJi # # ChangeSet # 2004/09/13 15:59:11+09:00 yoshfuji@linux-ipv6.org # [IPV6] don't use expired default routes. # # Signed-off-by: Hideaki YOSHIFUJI # # ChangeSet # 2004/09/13 15:57:40+09:00 yoshfuji@linux-ipv6.org # [IPV6] NDISC: Fix message validation against Redirects. # # Signed-off-by: Hideaki YOSHIFUJI # # ChangeSet # 2004/09/13 15:56:55+09:00 yoshfuji@linux-ipv6.org # [NET] NEIGHBOUR: improve neighbour state machine. # # This centralizes neighbour state transition by timer into # neigh_timer_handler(), and kill neigh_sync(). # This improves timing accuracy of state transition. # # neigh_timer_handler() for each entry is now reponsible # for state transition of the entry, and # neigh_periodic_timer() is just for garbage collection. # # Signed-off-by: Hideaki YOSHIFUJI # # ChangeSet # 2004/09/13 15:56:10+09:00 yoshfuji@linux-ipv6.org # [IPV6] NDISC: update entry appropriately when receiving NS. # # Update neighbour entry appropriately by passing correct flags # when receiving NS. # # Signed-off-by: Hideaki YOSHIFUJI # # ChangeSet # 2004/09/13 15:54:32+09:00 yoshfuji@linux-ipv6.org # [NET] NEIGHBOUR: use time_after() and its friends. # # Signed-off-by: Hideaki YOSHIFUJI # # ChangeSet # 2004/09/13 15:54:11+09:00 yoshfuji@linux-ipv6.org # [IPV6] NDISC: update IsRouter flag appropriately. # # Update IsRouter (NTF_ROUTER) flag approrpriately. # Specifically, # - we should not update it blindly; if Override Flag is # unset and lladdr is differnt, we should NOT. # - we should set it when we have received RA. # - we should set it when we have received Redirect # whose target is off-link. # # Signed-off-by: Hideaki YOSHIFUJI # # ChangeSet # 2004/09/13 15:52:13+09:00 yoshfuji@linux-ipv6.org # [NET] NEIGHBOUR: merge two flags for neigh_update() into one. # # This is because SUSPECT_CONNECTED can be effective # only if OVERRIDE is unset, and used only if RETAIN_STATE is set. # # Signed-off-by: Hideaki YOSHIFUJI # # ChangeSet # 2004/09/13 15:51:20+09:00 yoshfuji@linux-ipv6.org # [IPV6] NDISC: keep original state if new state is STALE and lladdr is unchanged # # Signed-off-by: Hideaki YOSHIFUJI # # ChangeSet # 2004/09/13 15:50:56+09:00 yoshfuji@linux-ipv6.org # [IPV6] NDISC: suspect REACHABLE entry if new lladdr is different. # # When we receive NA without Override flag, if it comes with # different lladdr from one in our REACHABLE entry, # set the state to STALE. (RFC2461 7.2.5) # # Signed-off-by: Hideaki YOSHIFUJI # # ChangeSet # 2004/09/13 15:50:00+09:00 yoshfuji@linux-ipv6.org # [NET] NEIGHBOUR: save number of arguments for neigh_update() by flags. # # Signed-off-by: Hideaki YOSHIFUJI # # net/ipv6/ip6_fib.c # 2004/09/13 16:04:07+09:00 yoshfuji@linux-ipv6.org +5 -0 # [IPV6] purge routes via non-router neighbour but gateway. # # Signed-off-by: Hideaki YOSHIFUJI # # net/ipv6/route.c # 2004/09/13 16:02:09+09:00 yoshfuji@linux-ipv6.org +4 -4 # [IPV6] ensure to aging default routes. # # This patch is product of corraboration with Ville Nuorvala # . # # Signed-off-by: Hideaki YOSHIFUJi # # net/ipv6/ip6_fib.c # 2004/09/13 16:02:09+09:00 yoshfuji@linux-ipv6.org +7 -0 # [IPV6] ensure to aging default routes. # # This patch is product of corraboration with Ville Nuorvala # . # # Signed-off-by: Hideaki YOSHIFUJi # # net/ipv6/route.c # 2004/09/13 15:59:01+09:00 yoshfuji@linux-ipv6.org +4 -0 # [IPV6] don't use expired default routes. # # Signed-off-by: Hideaki YOSHIFUJI # # net/ipv6/route.c # 2004/09/13 15:57:29+09:00 yoshfuji@linux-ipv6.org +26 -18 # [IPV6] NDISC: Fix message validation against Redirects. # # Signed-off-by: Hideaki YOSHIFUJI # # net/ipv6/ndisc.c # 2004/09/13 15:57:29+09:00 yoshfuji@linux-ipv6.org +2 -15 # [IPV6] NDISC: Fix message validation against Redirects. # # Signed-off-by: Hideaki YOSHIFUJI # # include/net/ip6_route.h # 2004/09/13 15:57:29+09:00 yoshfuji@linux-ipv6.org +1 -0 # [IPV6] NDISC: Fix message validation against Redirects. # # Signed-off-by: Hideaki YOSHIFUJI # # net/core/neighbour.c # 2004/09/13 15:56:45+09:00 yoshfuji@linux-ipv6.org +74 -80 # [NET] NEIGHBOUR: improve neighbour state machine. # # This centralizes neighbour state transition by timer into # neigh_timer_handler(), and kill neigh_sync(). # This improves timing accuracy of state transition. # # neigh_timer_handler() for each entry is now reponsible # for state transition of the entry, and # neigh_periodic_timer() is just for garbage collection. # # Signed-off-by: Hideaki YOSHIFUJI # # include/net/neighbour.h # 2004/09/13 15:56:45+09:00 yoshfuji@linux-ipv6.org +1 -1 # [NET] NEIGHBOUR: improve neighbour state machine. # # This centralizes neighbour state transition by timer into # neigh_timer_handler(), and kill neigh_sync(). # This improves timing accuracy of state transition. # # neigh_timer_handler() for each entry is now reponsible # for state transition of the entry, and # neigh_periodic_timer() is just for garbage collection. # # Signed-off-by: Hideaki YOSHIFUJI # # net/ipv6/ndisc.c # 2004/09/13 15:55:59+09:00 yoshfuji@linux-ipv6.org +5 -2 # [IPV6] NDISC: update entry appropriately when receiving NS. # # Update neighbour entry appropriately by passing correct flags # when receiving NS. # # Signed-off-by: Hideaki YOSHIFUJI # # net/core/neighbour.c # 2004/09/13 15:54:22+09:00 yoshfuji@linux-ipv6.org +14 -15 # [NET] NEIGHBOUR: use time_after() and its friends. # # Signed-off-by: Hideaki YOSHIFUJI # # net/ipv6/ndisc.c # 2004/09/13 15:54:01+09:00 yoshfuji@linux-ipv6.org +22 -17 # [IPV6] NDISC: update IsRouter flag appropriately. # # Update IsRouter (NTF_ROUTER) flag approrpriately. # Specifically, # - we should not update it blindly; if Override Flag is # unset and lladdr is differnt, we should NOT. # - we should set it when we have received RA. # - we should set it when we have received Redirect # whose target is off-link. # # Signed-off-by: Hideaki YOSHIFUJI # # net/core/neighbour.c # 2004/09/13 15:54:01+09:00 yoshfuji@linux-ipv6.org +13 -0 # [IPV6] NDISC: update IsRouter flag appropriately. # # Update IsRouter (NTF_ROUTER) flag approrpriately. # Specifically, # - we should not update it blindly; if Override Flag is # unset and lladdr is differnt, we should NOT. # - we should set it when we have received RA. # - we should set it when we have received Redirect # whose target is off-link. # # Signed-off-by: Hideaki YOSHIFUJI # # include/net/neighbour.h # 2004/09/13 15:54:01+09:00 yoshfuji@linux-ipv6.org +2 -0 # [IPV6] NDISC: update IsRouter flag appropriately. # # Update IsRouter (NTF_ROUTER) flag approrpriately. # Specifically, # - we should not update it blindly; if Override Flag is # unset and lladdr is differnt, we should NOT. # - we should set it when we have received RA. # - we should set it when we have received Redirect # whose target is off-link. # # Signed-off-by: Hideaki YOSHIFUJI # # net/ipv6/ndisc.c # 2004/09/13 15:52:03+09:00 yoshfuji@linux-ipv6.org +3 -4 # [NET] NEIGHBOUR: merge two flags for neigh_update() into one. # # This is because SUSPECT_CONNECTED can be effective # only if OVERRIDE is unset, and used only if RETAIN_STATE is set. # # Signed-off-by: Hideaki YOSHIFUJI # # net/core/neighbour.c # 2004/09/13 15:52:03+09:00 yoshfuji@linux-ipv6.org +6 -5 # [NET] NEIGHBOUR: merge two flags for neigh_update() into one. # # This is because SUSPECT_CONNECTED can be effective # only if OVERRIDE is unset, and used only if RETAIN_STATE is set. # # Signed-off-by: Hideaki YOSHIFUJI # # include/net/neighbour.h # 2004/09/13 15:52:03+09:00 yoshfuji@linux-ipv6.org +1 -2 # [NET] NEIGHBOUR: merge two flags for neigh_update() into one. # # This is because SUSPECT_CONNECTED can be effective # only if OVERRIDE is unset, and used only if RETAIN_STATE is set. # # Signed-off-by: Hideaki YOSHIFUJI # # net/ipv6/ndisc.c # 2004/09/13 15:51:10+09:00 yoshfuji@linux-ipv6.org +7 -2 # [IPV6] NDISC: keep original state if new state is STALE and lladdr is unchanged # # Signed-off-by: Hideaki YOSHIFUJI # # net/core/neighbour.c # 2004/09/13 15:51:10+09:00 yoshfuji@linux-ipv6.org +5 -2 # [IPV6] NDISC: keep original state if new state is STALE and lladdr is unchanged # # Signed-off-by: Hideaki YOSHIFUJI # # include/net/neighbour.h # 2004/09/13 15:51:10+09:00 yoshfuji@linux-ipv6.org +1 -0 # [IPV6] NDISC: keep original state if new state is STALE and lladdr is unchanged # # Signed-off-by: Hideaki YOSHIFUJI # # net/ipv6/ndisc.c # 2004/09/13 15:50:46+09:00 yoshfuji@linux-ipv6.org +2 -1 # [IPV6] NDISC: suspect REACHABLE entry if new lladdr is different. # # When we receive NA without Override flag, if it comes with # different lladdr from one in our REACHABLE entry, # set the state to STALE. (RFC2461 7.2.5) # # Signed-off-by: Hideaki YOSHIFUJI # # net/core/neighbour.c # 2004/09/13 15:50:46+09:00 yoshfuji@linux-ipv6.org +20 -9 # [IPV6] NDISC: suspect REACHABLE entry if new lladdr is different. # # When we receive NA without Override flag, if it comes with # different lladdr from one in our REACHABLE entry, # set the state to STALE. (RFC2461 7.2.5) # # Signed-off-by: Hideaki YOSHIFUJI # # include/net/neighbour.h # 2004/09/13 15:50:46+09:00 yoshfuji@linux-ipv6.org +1 -0 # [IPV6] NDISC: suspect REACHABLE entry if new lladdr is different. # # When we receive NA without Override flag, if it comes with # different lladdr from one in our REACHABLE entry, # set the state to STALE. (RFC2461 7.2.5) # # Signed-off-by: Hideaki YOSHIFUJI # # net/ipv6/ndisc.c # 2004/09/13 15:49:50+09:00 yoshfuji@linux-ipv6.org +3 -3 # [NET] NEIGHBOUR: save number of arguments for neigh_update() by flags. # # Signed-off-by: Hideaki YOSHIFUJI # # net/ipv4/arp.c # 2004/09/13 15:49:50+09:00 yoshfuji@linux-ipv6.org +7 -3 # [NET] NEIGHBOUR: save number of arguments for neigh_update() by flags. # # Signed-off-by: Hideaki YOSHIFUJI # # net/core/neighbour.c # 2004/09/13 15:49:50+09:00 yoshfuji@linux-ipv6.org +15 -8 # [NET] NEIGHBOUR: save number of arguments for neigh_update() by flags. # # Signed-off-by: Hideaki YOSHIFUJI # # net/atm/clip.c # 2004/09/13 15:49:50+09:00 yoshfuji@linux-ipv6.org +4 -2 # [NET] NEIGHBOUR: save number of arguments for neigh_update() by flags. # # Signed-off-by: Hideaki YOSHIFUJI # # include/net/neighbour.h # 2004/09/13 15:49:50+09:00 yoshfuji@linux-ipv6.org +6 -1 # [NET] NEIGHBOUR: save number of arguments for neigh_update() by flags. # # Signed-off-by: Hideaki YOSHIFUJI # # ChangeSet # 2004/09/09 22:27:20+00:00 alex.williamson@hp.com # [IA64] iosapic.h, pci.c, iosapic.c, acpi.c: iosapic NUMA interrupt locality # # This patch associates IOSAPICs with NUMA nodes such that interrupts # gets assigned to a reasonably good default CPU. The patch does not # depend on the pxm_to_nid_map fixup, but results will be strange in some # configurations without it. This should work on any NUMA box that # exposes IOSAPICs with _MAT & _PXM methods, but it's only been tested on # an rx8620. There should be no change in behavior for boxes that don't # export both of these in ACPI namespace. # # Signed-off-by: Alex Williamson # Signed-off-by: Tony Luck # # include/asm-ia64/iosapic.h # 2004/09/09 22:25:26+00:00 aegl@agluck-lia64.sc.intel.com +3 -0 # iosapic NUMA interrupt locality # # arch/ia64/pci/pci.c # 2004/09/09 22:25:26+00:00 aegl@agluck-lia64.sc.intel.com +5 -0 # iosapic NUMA interrupt locality # # arch/ia64/kernel/iosapic.c # 2004/09/09 22:25:26+00:00 aegl@agluck-lia64.sc.intel.com +53 -2 # iosapic NUMA interrupt locality # # arch/ia64/kernel/acpi.c # 2004/09/09 22:25:25+00:00 aegl@agluck-lia64.sc.intel.com +67 -0 # iosapic NUMA interrupt locality # # ChangeSet # 2004/09/09 22:20:47+00:00 alex.williamson@hp.com # [IA64] sba_iommu.c: sba_iommu NUMA locality # # This patch adds NUMA locality info to sba_iommu, allowing coherent # DMA mappings to be allocated from the node nearest to the I/O. This # patch isn't dependent on the previous pxm_to_nid_map fixup, but may be # sub-optimal in some cases without it. Thanks # # Signed-off-by: Alex Williamson # Signed-off-by: Tony Luck # # arch/ia64/hp/common/sba_iommu.c # 2004/09/09 22:18:54+00:00 aegl@agluck-lia64.sc.intel.com +78 -2 # sba_iommu NUMA locality # # ChangeSet # 2004/09/09 22:14:48+00:00 alex.williamson@hp.com # [IA64] discontig.c: fixup pxm_to_nid_map # # I'd like to be able to use pxm_to_nid_map in several places to # discover proximity domain to node id associations. Unfortunately, after # reassign_cpu_only_nodes() plays with the node space, the pxm_to_nid_map # doesn't necessarily reflect reality. This fixes up the table so it's # still valid. Note that nid_to_pxm_map is still potentially broken, but # has a one-to-many problem if the above function combines several # proximity domains into a single node. Thanks to Bob Picco for the base # patch. # # Signed-off-by: Alex Williamson # Signed-off-by: Tony Luck # # arch/ia64/mm/discontig.c # 2004/09/09 22:12:53+00:00 aegl@agluck-lia64.sc.intel.com +24 -11 # fixup pxm_to_nid_map # # ChangeSet # 2004/09/09 21:50:47+00:00 jbarnes@sgi.com # [IA64-SGI]: disable non-display ROM resources # # This patch is needed to correctly support the new sysfs rom file. On sn2, we # only allocate PIO space for display option ROMs since PIO space is a # relatively scarce resource (we've seen exhaustion when running with several # qla cards in the same domain). And without this patch we won't zero out # non-display ROM resources which can lead to panics if anyone tries to use the # bogus addresses left over there from the generic PCI probing code. # # Signed-off-by: Jesse Barnes # Signed-off-by: Tony Luck # # arch/ia64/sn/io/machvec/pci_bus_cvlink.c # 2004/09/09 21:47:56+00:00 aegl@agluck-lia64.sc.intel.com +14 -1 # sn2: disable non-display ROM resources # # ChangeSet # 2004/09/09 21:45:01+00:00 markgw@sgi.com # [IA64-SGI] sn_proc_fs.c: convert to use seq_file API # # Signed-off-by: Mark Goodwin # Signed-off-by: Tony Luck # # arch/ia64/sn/kernel/sn2/sn_proc_fs.c # 2004/09/09 21:42:19+00:00 aegl@agluck-lia64.sc.intel.com +86 -99 # convert to use seq_file API # # ChangeSet # 2004/09/08 11:51:10+02:00 marcel@holtmann.org # [Bluetooth] Check checksums for BNEP # # The checking of the checksums is needed, because with certain Bluetooth # hardware there are failures which aren't caught otherwise. # # Signed-off-by: David Woodhouse # Signed-off-by: Marcel Holtmann # # net/bluetooth/bnep/core.c # 2004/09/08 11:48:06+02:00 marcel@holtmann.org +1 -1 # Check checksums for BNEP # # fs/ntfs/debug.c # 2004/09/06 10:56:54+01:00 aia21@cantab.net +1 -1 # Add parentheses after function name in ntfs_debug(). # # ChangeSet # 2004/09/04 12:52:38+02:00 marcel@holtmann.org # [Bluetooth] Don't send L2CAP reject command for bad responses # # If a L2CAP response is bad or not understood there is no need to send # a reject command. The right way is to ignore the response and let the # L2CAP timers trigger the further actions. # # Signed-off-by: Marcel Holtmann # # net/bluetooth/l2cap.c # 2004/09/04 12:51:17+02:00 marcel@holtmann.org +10 -9 # Don't send L2CAP reject command for bad responses # # ChangeSet # 2004/09/04 12:42:34+02:00 marcel@holtmann.org # [Bluetooth] Don't use ISOC transfers for Broadcom dongle # # The Broadcom dongles with HID proxy support don't work with SCO over # HCI and so there is no need to start the ISOC transfers. # # Signed-off-by: Marcel Holtmann # # drivers/bluetooth/hci_usb.c # 2004/09/04 12:39:45+02:00 marcel@holtmann.org +1 -1 # Don't use ISOC transfers for Broadcom dongle # # ChangeSet # 2004/08/31 10:12:45+01:00 aia21@cantab.net # Merge ssh://linux-ntfs@bkbits.net/ntfs-2.6-devel # into cantab.net:/home/src/ntfs-2.6-devel # # fs/ntfs/super.c # 2004/08/31 10:12:42+01:00 aia21@cantab.net +0 -0 # Auto merged # # ChangeSet # 2004/08/27 14:14:03+01:00 aia21@cantab.net # NTFS: Remove vol->nr_mft_records as it was pretty meaningless and optimize # the calculation of total/free inodes as used by statfs(). # # Signed-off-by: Anton Altaparmakov # # fs/ntfs/volume.h # 2004/08/27 14:13:55+01:00 aia21@cantab.net +0 -3 # Remove vol->nr_mft_records as it was pretty meaningless and optimize # the calculation of total/free inodes as used by statfs(). # # fs/ntfs/super.c # 2004/08/27 14:13:55+01:00 aia21@cantab.net +12 -9 # Remove vol->nr_mft_records as it was pretty meaningless and optimize # the calculation of total/free inodes as used by statfs(). # # fs/ntfs/inode.c # 2004/08/27 14:13:54+01:00 aia21@cantab.net +2 -6 # Remove vol->nr_mft_records as it was pretty meaningless and optimize # the calculation of total/free inodes as used by statfs(). # # fs/ntfs/Makefile # 2004/08/27 14:13:54+01:00 aia21@cantab.net +1 -1 # Update # # fs/ntfs/ChangeLog # 2004/08/27 14:13:54+01:00 aia21@cantab.net +5 -0 # Update # # ChangeSet # 2004/08/25 14:05:08+02:00 vojtech@suse.cz # Manual merge. # Signed-off-by: Vojtech Pavlik # # MAINTAINERS # 2004/08/25 14:05:03+02:00 vojtech@suse.cz +6 -6 # Manual merge. # Signed-off-by: Vojtech Pavlik # # include/linux/compat_ioctl.h # 2004/08/25 14:01:29+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/usb/input/hid-core.c # 2004/08/25 14:01:29+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/serio/gscps2.c # 2004/08/25 14:01:29+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/gameport/vortex.c # 2004/08/25 14:01:29+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/gameport/emu10k1-gp.c # 2004/08/25 14:01:29+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/Makefile # 2004/08/25 14:01:29+02:00 vojtech@suse.cz +0 -0 # Auto merged # # Documentation/kernel-parameters.txt # 2004/08/25 14:01:28+02:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2004/08/19 17:02:03+02:00 vojtech@suse.cz # input: Make sure the HID request queue survives report transfer failures gracefully. # # Signed-off-by: Vojtech Pavlik # Problem-spotted-by: Alan Stern # # drivers/usb/input/hid-core.c # 2004/08/19 17:01:56+02:00 vojtech@suse.cz +54 -41 # input: Make sure the HID request queue survives report transfer failures gracefully. # # ChangeSet # 2004/08/16 15:32:04+02:00 vojtech@suse.cz # Merge suse.cz:/data/bk/linus into suse.cz:/data/bk/input # # arch/i386/kernel/dmi_scan.c # 2004/08/16 15:32:01+02:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2004/08/16 15:16:23+02:00 vojtech@suse.cz # input: Update MAINTAINERS entries for Vojtech Pavlik. # # MAINTAINERS # 2004/08/16 15:16:16+02:00 vojtech@suse.cz +8 -9 # input: Update MAINTAINERS entries for Vojtech Pavlik. # # ChangeSet # 2004/08/12 14:56:02+02:00 rmk@arm.linux.org.uk # input: Update pcips2 driver # # Use pci_request_regions()/pci_release_regions() instead of # request_region()/release_region() # # Signed-off-by: Russell King # Signed-off-by: Vojtech Pavlik # # drivers/input/serio/pcips2.c # 2004/08/12 14:55:54+02:00 rmk@arm.linux.org.uk +6 -9 # Use pci_request_regions()/pci_release_regions() instead of # request_region()/release_region() # # Signed-off-by: Russell King # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2004/08/09 22:00:56+02:00 vojtech@suse.cz # Merge bkbits:input2 into suse.cz:/home/vojtech/bk/input # # fs/compat_ioctl.c # 2004/08/09 22:00:49+02:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2004/08/04 11:31:02+02:00 vojtech@suse.cz # Merge bkbits:input2 into suse.cz:/data/bk/input # # fs/compat_ioctl.c # 2004/08/04 11:30:58+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/usb/input/hid-core.c # 2004/08/04 11:30:58+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/Makefile # 2004/08/04 11:30:58+02:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2004/08/02 11:13:22+02:00 vojtech@suse.cz # input: Fix an i8042 access timing violation spotted by Alan Cox. # # drivers/input/serio/i8042.c # 2004/08/02 11:13:16+02:00 vojtech@suse.cz +1 -0 # input: Fix an i8042 access timing violation spotted by Alan Cox. # # ChangeSet # 2004/08/02 09:39:28+02:00 vojtech@suse.cz # Merge suse.cz:/data/bk/linus into suse.cz:/data/bk/input # # fs/compat_ioctl.c # 2004/08/02 09:39:24+02:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2004/07/30 19:11:34+02:00 vojtech@suse.cz # Merge suse.cz:/home/vojtech/bk/linus into suse.cz:/home/vojtech/bk/input # # fs/compat_ioctl.c # 2004/07/30 19:11:21+02:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2004/07/29 16:20:07-07:00 vojtech@kernel.bkbits.net # Merge 62.245.75.237:bk/input-linus # into kernel.bkbits.net:/home/vojtech/input # # fs/compat_ioctl.c # 2004/07/29 16:20:01-07:00 vojtech@kernel.bkbits.net +0 -0 # Auto merged # # drivers/usb/input/hid-core.c # 2004/07/29 16:20:01-07:00 vojtech@kernel.bkbits.net +0 -0 # Auto merged # # drivers/Makefile # 2004/07/29 16:20:01-07:00 vojtech@kernel.bkbits.net +0 -0 # Auto merged # # ChangeSet # 2004/07/29 16:14:29+02:00 vojtech@suse.cz # Merge bk://dtor.bkbits.net/input into suse.cz:/data/bk/input # # fs/compat_ioctl.c # 2004/07/29 16:14:26+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/usb/input/hid-core.c # 2004/07/29 16:14:25+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/Makefile # 2004/07/29 16:14:25+02:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2004/07/29 14:13:12+02:00 vojtech@suse.cz # input: Check the range for HIDIOC?USAGES num_values. # # Signed-off-by: Vojtech Pavlik # # drivers/usb/input/hiddev.c # 2004/07/29 14:13:05+02:00 vojtech@suse.cz +4 -7 # input: Check the range for HIDIOC?USAGES num_values. # # ChangeSet # 2004/07/29 13:42:55+02:00 vojtech@suse.cz # input: Fix a missing index in tmdc.c # # Signed-off-by: Vojtech Pavlik # # drivers/input/joystick/tmdc.c # 2004/07/29 13:42:48+02:00 vojtech@suse.cz +1 -1 # input: Fix a missing index in tmdc.c # # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2004/07/28 00:57:35-05:00 dtor_core@ameritech.net # Input: fix absolute device handling in mousedev that was broken # by recent change that tried to do better multiplexing. # Now every client will keep its own virtual cursor position # and both absolute and relative events will update it # # Signed-off-by: Dmitry Torokhov # # drivers/input/mousedev.c # 2004/07/28 00:57:20-05:00 dtor_core@ameritech.net +35 -8 # Fix absolute device handling - have every client keep its own # virtual position and have both absolute and relative events # update it # # ChangeSet # 2004/07/28 00:55:34-05:00 dtor_core@ameritech.net # Input: fix reader wakeup conditions in mousedev, joydev and tsdev # (we want readers to wake up when underlying device is gone # so they would get -ENODEV and close the device). # # Signed-off-by: Dmitry Torokhov # # drivers/input/tsdev.c # 2004/07/28 00:55:05-05:00 dtor_core@ameritech.net +5 -5 # Wake up readers when device is gone # # drivers/input/mousedev.c # 2004/07/28 00:55:05-05:00 dtor_core@ameritech.net +5 -1 # Wake up readers when device is gone # # drivers/input/joydev.c # 2004/07/28 00:55:05-05:00 dtor_core@ameritech.net +4 -2 # Wake up readers when device is gone # # ChangeSet # 2004/07/28 00:54:40-05:00 dtor_core@ameritech.net # Input: switch atkbd driver from busy-polling for command completion # to waiting for event # # Signed-off-by: Dmitry Torokhov # # drivers/input/keyboard/atkbd.c # 2004/07/28 00:54:23-05:00 dtor_core@ameritech.net +108 -31 # Switch from busy-polling for command completion to waiting for event # # ChangeSet # 2004/07/28 00:54:01-05:00 dtor_core@ameritech.net # Input: atkbd - harden ACK/NAK and command processing logic # # Signed-off-by: Dmitry Torokhov # # drivers/input/keyboard/atkbd.c # 2004/07/28 00:53:37-05:00 dtor_core@ameritech.net +38 -33 # Harden ACK/NAK and command processing logic # # ChangeSet # 2004/07/28 00:52:45-05:00 dtor_core@ameritech.net # Input: switch psmouse driver from busy-polling for command completion # to waiting for event # # Signed-off-by: Dmitry Torokhov # # drivers/input/mouse/psmouse.h # 2004/07/28 00:52:21-05:00 dtor_core@ameritech.net +3 -0 # Add wait queue to psmouse structure # # drivers/input/mouse/psmouse-base.c # 2004/07/28 00:52:21-05:00 dtor_core@ameritech.net +38 -33 # Switch from busy-polling for command completion to waiting for event # # ChangeSet # 2004/07/28 00:51:37-05:00 dtor_core@ameritech.net # Input: psmouse - harden command mode processing logic # # Signed-off-by: Dmitry Torokhov # # drivers/input/mouse/psmouse.h # 2004/07/28 00:51:21-05:00 dtor_core@ameritech.net +2 -2 # Change PSMOUSE_FLAG_ID to PSMOUSE_FLAG_WAITID # # drivers/input/mouse/psmouse-base.c # 2004/07/28 00:51:21-05:00 dtor_core@ameritech.net +52 -40 # Harden command mode processing logic # # ChangeSet # 2004/07/28 00:50:38-05:00 dtor_core@ameritech.net # Input: fix psmouse_sendbyte logic # - correctly return NAK when command times out on our side # - always reset ACK flag, even when serio_write fails # # Signed-off-by: Dmitry Torokhov # # drivers/input/mouse/psmouse-base.c # 2004/07/28 00:49:51-05:00 dtor_core@ameritech.net +8 -3 # Correctly handle timeout condition # # ChangeSet # 2004/07/27 14:46:36+02:00 olh@suse.de # input: Re-add PC Speaker support for PPC # # Signed-off-by: Olaf Hering # Signed-off-by: Vojtech Pavlik # # include/asm-ppc64/8253pit.h # 2004/07/27 14:46:29+02:00 olh@suse.de +10 -0 # # include/asm-ppc/8253pit.h # 2004/07/27 14:46:29+02:00 olh@suse.de +10 -0 # # include/asm-ppc64/8253pit.h # 2004/07/27 14:46:29+02:00 olh@suse.de +0 -0 # BitKeeper file /data/bk/input/include/asm-ppc64/8253pit.h # # include/asm-ppc/8253pit.h # 2004/07/27 14:46:29+02:00 olh@suse.de +0 -0 # BitKeeper file /data/bk/input/include/asm-ppc/8253pit.h # # drivers/input/misc/Kconfig # 2004/07/27 14:46:29+02:00 olh@suse.de +1 -1 # input: Re-add PC Speaker support for PPC # # ChangeSet # 2004/07/27 14:39:53+02:00 vojtech@suse.cz # Merge suse.cz:/data/bk/linus into suse.cz:/data/bk/input # # drivers/serial/sunsu.c # 2004/07/27 14:39:50+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/keyboard/sunkbd.c # 2004/07/27 14:39:50+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/joystick/analog.c # 2004/07/27 14:39:49+02:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2004/07/20 15:54:55+02:00 vojtech@suse.cz # Merge suse.cz:/home/vojtech/bk/linus into suse.cz:/home/vojtech/bk/input # # fs/compat_ioctl.c # 2004/07/20 15:54:38+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/usb/input/hid-core.c # 2004/07/20 15:54:38+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/Makefile # 2004/07/20 15:54:38+02:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2004/07/19 23:26:20-05:00 dtor_core@ameritech.net # Input: serio - switch to use driver_find, adjust reference count # # Signed-off-by: Dmitry Torokhov # # drivers/input/serio/serio.c # 2004/07/19 23:25:59-05:00 dtor_core@ameritech.net +2 -3 # Switch to use driver_find, adjust reference count # # ChangeSet # 2004/07/19 23:17:19-05:00 dtor_core@ameritech.net # Input: allow marking serio ports (in addition to serio drivers) # as manual bind only, export the flag through sysfs # # echo -n "manual" > /sys/bus/serio/devices/serio0/bind_mode # echo -n "auto" > /sys/bus/serio/drivers/serio_raw/bind_mode # # Signed-off-by: Dmitry Torokhov # # include/linux/serio.h # 2004/07/19 23:17:04-05:00 dtor_core@ameritech.net +3 -1 # Add manual_bind to serio port structure # # drivers/input/serio/serio.c # 2004/07/19 23:17:04-05:00 dtor_core@ameritech.net +60 -8 # Allow serio ports be marked as manual bind, export through sysfs # # ChangeSet # 2004/07/19 23:16:28-05:00 dtor_core@ameritech.net # Input: Switch to use bus' default device and driver attributes to # manage serio sysfs attributes # # Signed-off-by: Dmitry Torokhov # # drivers/input/serio/serio.c # 2004/07/19 23:16:14-05:00 dtor_core@ameritech.net +14 -6 # Switch to use bus' default device and driver attributes to # manage serio sysfs attributes # # ChangeSet # 2004/07/19 23:15:36-05:00 dtor_core@ameritech.net # Input: integrate ct82c710, maceps2, q40kbd and rpckbd with sysfs # as platform devices so their serio ports have proper parents # # Signed-off-by: Dmitry Torokhov # # drivers/input/serio/rpckbd.c # 2004/07/19 23:15:15-05:00 dtor_core@ameritech.net +15 -5 # Integrate with sysfs as a platform device # # drivers/input/serio/q40kbd.c # 2004/07/19 23:15:15-05:00 dtor_core@ameritech.net +14 -4 # Integrate with sysfs as a platform device # # drivers/input/serio/maceps2.c # 2004/07/19 23:15:15-05:00 dtor_core@ameritech.net +14 -5 # Integrate with sysfs as a platform device # # drivers/input/serio/ct82c710.c # 2004/07/19 23:15:15-05:00 dtor_core@ameritech.net +28 -22 # Integrate with sysfs as a platform device # # ChangeSet # 2004/07/19 23:14:44-05:00 dtor_core@ameritech.net # Input: make i8042 a platform device instead of system device so # its serio ports have proper parent # # Signed-off-by: Dmitry Torokhov # # drivers/input/serio/i8042.c # 2004/07/19 23:13:42-05:00 dtor_core@ameritech.net +34 -26 # Make i8042 a platform device instead of system device # # ChangeSet # 2004/07/19 22:48:22-05:00 dtor_core@ameritech.net # Input: drop __attribute__ ((packed)) from mousedev_emul # # Signed-off-by: Dmitry Torokhov # # drivers/input/mousedev.c # 2004/07/19 22:48:00-05:00 dtor_core@ameritech.net +1 -1 # Drop __attribute__ ((packed)) from mousedev_emul # # ChangeSet # 2004/07/19 22:44:37-05:00 dtor_core@ameritech.net # Input: rearrange activation/children probe sequence in psmouse so # reconnect on children ports works even after parent port is # fully activated: # - when connecting/reconnecting a port always activate it # - when connecting/reconnecting a pass-throgh port deactivate # parent first and activate it after connect is done # # Signed-off-by: Dmitry Torokhov # # drivers/input/mouse/psmouse.h # 2004/07/19 22:44:22-05:00 dtor_core@ameritech.net +1 -0 # PSMOUSE_CMD_DISABLE added # # drivers/input/mouse/psmouse-base.c # 2004/07/19 22:44:22-05:00 dtor_core@ameritech.net +37 -18 # Rearrange activation/children probe sequence so reconnect on children # ports works even after parent port is fully activated: # - when connecting/reconnecting a port always activate it # - when connecting/reconnecting a pass-throgh port deactivate parent # first and activate it after connect is done. # # ChangeSet # 2004/07/19 22:41:37-05:00 dtor_core@ameritech.net # Input: synaptics - do not try to process packets from slave device # as if they were coming form the touchpad itself if pass-through # port is disconnected, just pass them to serio core and it will # attempt to bind proper driver to the port # # Signed-off-by: Dmitry Torokhov # # drivers/input/mouse/synaptics.c # 2004/07/19 22:41:21-05:00 dtor_core@ameritech.net +12 -14 # Do not try to process packets from slave device as if they were coming # from touchpad itself if pass-through port is disconnected, just pass # them to serio core so it will try to bind a driver to the port # # ChangeSet # 2004/07/19 22:39:18-05:00 dtor_core@ameritech.net # Input: do not call protocol handler in psmouse unless mouse is # filly initialized - helps when USB Legacy emulation gets # in our way and starts generating junk data stream while # psmouse is detecting hardware # # Signed-off-by: Dmitry Torokhov # # drivers/input/mouse/psmouse.h # 2004/07/19 22:38:59-05:00 dtor_core@ameritech.net +8 -6 # Introduce new state - PSMOUSE_INITIALIZING, convert to enum # # drivers/input/mouse/psmouse-base.c # 2004/07/19 22:38:59-05:00 dtor_core@ameritech.net +10 -3 # Introduce new state - PSMOUSE_INITIALIZING, do not call protocol # handler until mouse is fully initialized # # ChangeSet # 2004/07/19 22:38:32-05:00 dtor_core@ameritech.net # Input: when changing psmouse state (activated, ignore) use srio_pause_rx/ # serio_continue_rx so it will not fight with the interrupt handler # # Signed-off-by: Dmitry Torokhov # # drivers/input/mouse/psmouse-base.c # 2004/07/19 22:38:17-05:00 dtor_core@ameritech.net +21 -11 # Use serio_pause_rx/serio_continue_rx when changing psmouse state # (activated, ignore) to ensure that the interrupt handler will not # interfere # # ChangeSet # 2004/07/19 22:37:24-05:00 dtor_core@ameritech.net # Input: add serio_pause_rx and serio_continue_rx so drivers can protect # their critical sections from port's interrupt handler # # Signed-off-by: Dmitry Torokhov # # include/linux/serio.h # 2004/07/19 22:37:06-05:00 dtor_core@ameritech.net +19 -2 # Add serio_pause_rx and serio_continue_rx # # drivers/input/serio/serio.c # 2004/07/19 22:37:06-05:00 dtor_core@ameritech.net +8 -10 # Use serio_pause_rx and serio_continue_rx to protect access to serio->drv # # ChangeSet # 2004/07/19 22:36:34-05:00 dtor_core@ameritech.net # Input: workaround for i8042 active multiplexing controllers losing # track of where data is coming from. Also sprinkled some # "likely"s in i8042 interrupt handler. # # Signed-off-by: Dmitry Torokhov # # drivers/input/serio/i8042.c # 2004/07/19 22:36:01-05:00 dtor_core@ameritech.net +42 -18 # Workaround for i8042 active multiplexing controllers losing track of # where data is coming from # # ChangeSet # 2004/07/19 22:35:13-05:00 dtor_core@ameritech.net # Input: rearrange code in sunzilog so it registers its serio ports # only after hardware was fully initialized and with interrupts # tuned back on, otherwise it deadlocks. # # Signed-off-by: Dmitry Torokhov # # drivers/serial/sunzilog.c # 2004/07/19 22:34:47-05:00 dtor_core@ameritech.net +13 -5 # Do not try to register serio ports with interrupts off # # ChangeSet # 2004/07/19 22:34:23-05:00 dtor_core@ameritech.net # Input: move input/serio closer to the top of drivers/Makefile so # serio_bus is available early # # Signed-off-by: Dmitry Torokhov # # drivers/Makefile # 2004/07/19 22:33:56-05:00 dtor_core@ameritech.net +3 -1 # Move input/serio higher so serio_bus is available early # # ChangeSet # 2004/07/19 22:25:07-05:00 dtor_core@ameritech.net # Merge bk://linux.bkbits.net/linux-2.5 # into ameritech.net:/usr/src/export/input # # fs/compat_ioctl.c # 2004/07/19 22:24:55-05:00 dtor_core@ameritech.net +0 -0 # Auto merged # # drivers/usb/input/hid-core.c # 2004/07/19 22:24:54-05:00 dtor_core@ameritech.net +0 -0 # Auto merged # # drivers/Makefile # 2004/07/19 22:24:54-05:00 dtor_core@ameritech.net +0 -0 # Auto merged # # ChangeSet # 2004/07/12 07:07:06+02:00 vojtech@suse.cz # Merge suse.cz:/home/vojtech/bk/linus into suse.cz:/home/vojtech/bk/input # # arch/i386/kernel/dmi_scan.c # 2004/07/12 07:06:58+02:00 vojtech@suse.cz +0 -0 # Auto merged # # Documentation/kernel-parameters.txt # 2004/07/12 07:06:58+02:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2004/07/07 22:02:01+02:00 vojtech@suse.cz # Merge bkbits:input into suse.cz:/home/vojtech/bk/input # # fs/compat_ioctl.c # 2004/07/07 22:01:51+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/usb/input/hiddev.c # 2004/07/07 22:01:51+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/usb/input/hid-tmff.c # 2004/07/07 22:01:51+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/serio/i8042-io.h # 2004/07/07 22:01:51+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/char/keyboard.c # 2004/07/07 22:01:51+02:00 vojtech@suse.cz +0 -0 # Auto merged # # arch/i386/kernel/dmi_scan.c # 2004/07/07 22:01:50+02:00 vojtech@suse.cz +0 -0 # Auto merged # # Documentation/kernel-parameters.txt # 2004/07/07 22:01:50+02:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2004/07/07 15:35:03+02:00 vojtech@suse.cz # Merge suse.cz:/data/bk/linus into suse.cz:/data/bk/input # # include/linux/compat_ioctl.h # 2004/07/07 15:34:58+02:00 vojtech@suse.cz +0 -0 # Auto merged # # fs/compat_ioctl.c # 2004/07/07 15:34:58+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/usb/input/hiddev.c # 2004/07/07 15:34:58+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/usb/input/hid-tmff.c # 2004/07/07 15:34:58+02:00 vojtech@suse.cz +0 -1 # Auto merged # # drivers/input/serio/i8042-io.h # 2004/07/07 15:34:58+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/char/keyboard.c # 2004/07/07 15:34:58+02:00 vojtech@suse.cz +0 -0 # Auto merged # # arch/i386/kernel/dmi_scan.c # 2004/07/07 15:34:58+02:00 vojtech@suse.cz +0 -0 # Auto merged # # Documentation/kernel-parameters.txt # 2004/07/07 15:34:58+02:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2004/07/06 10:15:07+02:00 vojtech@suse.cz # Merge suse.cz:/home/vojtech/bk/linus into suse.cz:/home/vojtech/bk/input # # fs/compat_ioctl.c # 2004/07/06 10:15:01+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/usb/input/hiddev.c # 2004/07/06 10:15:01+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/usb/input/hid-tmff.c # 2004/07/06 10:15:01+02:00 vojtech@suse.cz +0 -1 # Auto merged # # drivers/input/serio/i8042-io.h # 2004/07/06 10:15:01+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/char/keyboard.c # 2004/07/06 10:15:01+02:00 vojtech@suse.cz +0 -0 # Auto merged # # arch/i386/kernel/dmi_scan.c # 2004/07/06 10:15:01+02:00 vojtech@suse.cz +0 -0 # Auto merged # # Documentation/kernel-parameters.txt # 2004/07/06 10:15:01+02:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2004/07/05 13:38:52+02:00 akropel1@rochester.rr.com # This patch fixes another disconnect oops in hiddev. # # hid-core calls hiddev_disconnect() when the underlying device goes away # (hot unplug or system shutdown). Normally, hiddev_disconnect() will # clean up nicely and return to hid-core who then frees the hid structure. # However, if the corresponding hiddev node is open at disconnect time, # hiddev delays the majority of disconnect work until the device is closed # via hiddev_release(). hiddev_release() calls hiddev_cleanup() which # proceeds to dereference the hid struct which hid-core freed back when # the hardware was disconnected. Oops. # # To solve this, we change hiddev_disconnect() to deregister the hiddev # minor and invalidate its table entry immediately and delay only the # freeing of the hiddev structure itself. We're protected against future # operations on the fd since the major fops check hiddev->exists. # # There may still be an ordering of events that causes a problem but I can # no longer reproduce any manually. There are enough different subsystems # and object lifetimes interacting here that I may have screwed something # else up; review is certainly welcome. # # Signed-off-by: Adam Kropelin # Signed-off-by: Vojtech Pavlik # # drivers/usb/input/hiddev.c # 2004/07/05 13:38:41+02:00 akropel1@rochester.rr.com +6 -12 # This patch fixes another disconnect oops in hiddev. # # hid-core calls hiddev_disconnect() when the underlying device goes away # (hot unplug or system shutdown). Normally, hiddev_disconnect() will # clean up nicely and return to hid-core who then frees the hid structure. # However, if the corresponding hiddev node is open at disconnect time, # hiddev delays the majority of disconnect work until the device is closed # via hiddev_release(). hiddev_release() calls hiddev_cleanup() which # proceeds to dereference the hid struct which hid-core freed back when # the hardware was disconnected. Oops. # # To solve this, we change hiddev_disconnect() to deregister the hiddev # minor and invalidate its table entry immediately and delay only the # freeing of the hiddev structure itself. We're protected against future # operations on the fd since the major fops check hiddev->exists. # # There may still be an ordering of events that causes a problem but I can # no longer reproduce any manually. There are enough different subsystems # and object lifetimes interacting here that I may have screwed something # else up; review is certainly welcome. # # Signed-off-by: Adam Kropelin # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2004/06/29 12:56:34+02:00 vojtech@suse.cz # Merge # # drivers/input/serio/i8042.c # 2004/06/29 12:56:28+02:00 vojtech@suse.cz +0 -1 # SCCS merged # # ChangeSet # 2004/06/29 11:59:04+02:00 vojtech@suse.cz # input: Move Compaq ProLiant DMI handling (ServerWorks/OSB workaround) # to i8042.c. # # Signed-off-by: Vojtech Pavlik # # drivers/input/serio/i8042.c # 2004/06/29 11:58:54+02:00 vojtech@suse.cz +2 -10 # input: Move Compaq ProLiant DMI handling (ServerWorks/OSB workaround) # to i8042.c. # # Signed-off-by: Vojtech Pavlik # # drivers/input/serio/i8042-io.h # 2004/06/29 11:58:54+02:00 vojtech@suse.cz +31 -0 # input: Move Compaq ProLiant DMI handling (ServerWorks/OSB workaround) # to i8042.c. # # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2004/06/29 10:00:24+02:00 vojtech@suse.cz # Merge # # arch/i386/kernel/dmi_scan.c # 2004/06/29 10:00:18+02:00 vojtech@suse.cz +0 -20 # SCCS merged # # ChangeSet # 2004/06/29 09:48:40+02:00 vojtech@suse.cz # input: Fix Kconfig so that the joydump module can be compiled. # # Reported-by: Matthieu Castet # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2004/06/29 01:36:29-05:00 dtor_core@ameritech.net # Input: link serio ports to their parent devices in ambakmi, # gscps2, pcips2 and sa1111ps2 drivers # # Signed-off-by: Dmitry Torokhov # # drivers/input/serio/sa1111ps2.c # 2004/06/29 01:36:13-05:00 dtor_core@ameritech.net +1 -0 # Link serio port to its parent device # # drivers/input/serio/pcips2.c # 2004/06/29 01:36:13-05:00 dtor_core@ameritech.net +1 -0 # Link serio port to its parent device # # drivers/input/serio/gscps2.c # 2004/06/29 01:36:13-05:00 dtor_core@ameritech.net +1 -0 # Link serio port to its parent device # # drivers/input/serio/ambakmi.c # 2004/06/29 01:36:13-05:00 dtor_core@ameritech.net +1 -0 # Link serio port to its parent device # # ChangeSet # 2004/06/29 01:31:03-05:00 dtor_core@ameritech.net # Input: Add serio_raw driver that binds to serio ports and provides # unobstructed access to the underlying serio port via a char # device. The driver tries to register char device 10,1 # (/dev/psaux) first and if it fails goes for dynamically # allocated minor. To bind use sysfs interface: # # echo -n "serio_raw" > /sys/bus/serio/devices/serioX/driver # # Signed-off-by: Dmitry Torokhov # # drivers/input/serio/Makefile # 2004/06/29 01:30:37-05:00 dtor_core@ameritech.net +1 -0 # serio_raw driver added # # drivers/input/serio/Kconfig # 2004/06/29 01:30:37-05:00 dtor_core@ameritech.net +16 -0 # serio_raw driver added # # drivers/input/serio/serio_raw.c # 2004/06/29 01:30:37-05:00 dtor_core@ameritech.net +390 -0 # BitKeeper file /usr/src/dtor/drivers/input/serio/serio_raw.c # # drivers/input/serio/serio_raw.c # 2004/06/29 01:30:37-05:00 dtor_core@ameritech.net +0 -0 # BitKeeper file /usr/src/export/input/drivers/input/serio/serio_raw.c # # ChangeSet # 2004/06/29 01:30:19-05:00 dtor_core@ameritech.net # Input: allow marking some drivers (that don't do HW autodetection) # as manual bind only. Such drivers will only be bound to a # serio port if user requests it by echoing driver name into # port's sysfs driver attribute. # # Signed-off-by: Dmitry Torokhov # # include/linux/serio.h # 2004/06/29 01:30:01-05:00 dtor_core@ameritech.net +2 -0 # Allow marking some drivers for manual bind only # # drivers/input/serio/serio.c # 2004/06/29 01:30:01-05:00 dtor_core@ameritech.net +7 -2 # If a driver is marked for manual binding only bind it to a port # if user requested it # # ChangeSet # 2004/06/29 01:29:39-05:00 dtor_core@ameritech.net # Input: allow users manually rebind serio ports, like this: # echo -n "psmouse" > /sys/bus/serio/devices/serio0/driver # echo -n "atkbd" > /sys/bus/serio/devices/serio1/driver # echo -n "none" > /sys/bus/serio/devices/serio1/driver # echo -n "reconnect" > /sys/bus/serio/devices/serio1/driver # echo -n "rescan" > /sys/bus/serio/devices/serio1/driver # # Signed-off-by: Dmitry Torokhov # # drivers/input/serio/serio.c # 2004/06/29 01:29:17-05:00 dtor_core@ameritech.net +33 -1 # Manual driver rebinding/reconnecting # # ChangeSet # 2004/06/29 01:28:53-05:00 dtor_core@ameritech.net # Input: serio sysfs integration # # Signed-off-by: Dmitry Torokhov # # include/linux/serio.h # 2004/06/29 01:28:37-05:00 dtor_core@ameritech.net +8 -1 # Serio sysfs integration # # drivers/input/touchscreen/h3600_ts_input.c # 2004/06/29 01:28:37-05:00 dtor_core@ameritech.net +10 -4 # Serio sysfs integration # # drivers/input/touchscreen/gunze.c # 2004/06/29 01:28:37-05:00 dtor_core@ameritech.net +10 -4 # Serio sysfs integration # # drivers/input/serio/serio.c # 2004/06/29 01:28:37-05:00 dtor_core@ameritech.net +75 -10 # Serio sysfs integration # # drivers/input/mouse/vsxxxaa.c # 2004/06/29 01:28:37-05:00 dtor_core@ameritech.net +10 -4 # Serio sysfs integration # # drivers/input/mouse/sermouse.c # 2004/06/29 01:28:37-05:00 dtor_core@ameritech.net +10 -4 # Serio sysfs integration # # drivers/input/mouse/psmouse-base.c # 2004/06/29 01:28:37-05:00 dtor_core@ameritech.net +12 -6 # Serio sysfs integration # # drivers/input/keyboard/xtkbd.c # 2004/06/29 01:28:37-05:00 dtor_core@ameritech.net +10 -4 # Serio sysfs integration # # drivers/input/keyboard/sunkbd.c # 2004/06/29 01:28:37-05:00 dtor_core@ameritech.net +10 -4 # Serio sysfs integration # # drivers/input/keyboard/newtonkbd.c # 2004/06/29 01:28:37-05:00 dtor_core@ameritech.net +10 -4 # Serio sysfs integration # # drivers/input/keyboard/lkkbd.c # 2004/06/29 01:28:37-05:00 dtor_core@ameritech.net +10 -4 # Serio sysfs integration # # drivers/input/keyboard/atkbd.c # 2004/06/29 01:28:37-05:00 dtor_core@ameritech.net +12 -6 # Serio sysfs integration # # drivers/input/joystick/warrior.c # 2004/06/29 01:28:37-05:00 dtor_core@ameritech.net +10 -4 # Serio sysfs integration # # drivers/input/joystick/twidjoy.c # 2004/06/29 01:28:37-05:00 dtor_core@ameritech.net +7 -3 # Serio sysfs integration # # drivers/input/joystick/stinger.c # 2004/06/29 01:28:37-05:00 dtor_core@ameritech.net +10 -4 # Serio sysfs integration # # drivers/input/joystick/spaceorb.c # 2004/06/29 01:28:37-05:00 dtor_core@ameritech.net +10 -4 # Serio sysfs integration # # drivers/input/joystick/spaceball.c # 2004/06/29 01:28:37-05:00 dtor_core@ameritech.net +10 -4 # Serio sysfs integration # # drivers/input/joystick/magellan.c # 2004/06/29 01:28:37-05:00 dtor_core@ameritech.net +10 -4 # Serio sysfs integration # # drivers/input/joystick/iforce/iforce-serio.c # 2004/06/29 01:28:37-05:00 dtor_core@ameritech.net +8 -4 # Serio sysfs integration # # drivers/Makefile # 2004/06/29 01:28:37-05:00 dtor_core@ameritech.net +1 -1 # Move serio initialization ahead of input so serio bus will # be registered before drivers such as atkbd and psmouse will # try using it # # ChangeSet # 2004/06/29 01:28:21-05:00 dtor_core@ameritech.net # Input: allow serio drivers to create children ports and register these # ports for them in serio core to avoid having recursion in connect # methods. # # Signed-off-by: Dmitry Torokhov # # include/linux/serio.h # 2004/06/29 01:28:05-05:00 dtor_core@ameritech.net +2 -2 # Allow drivers to create children serio ports and register these # ports for them to avoid doing recursion # # drivers/input/serio/serio.c # 2004/06/29 01:28:05-05:00 dtor_core@ameritech.net +166 -49 # Allow drivers to create children serio ports and register these # ports for them to avoid doing recursion # # drivers/input/mouse/synaptics.c # 2004/06/29 01:28:05-05:00 dtor_core@ameritech.net +11 -16 # ptport is no more, serio port now has pointers both to parent and child # # drivers/input/mouse/psmouse.h # 2004/06/29 01:28:05-05:00 dtor_core@ameritech.net +4 -12 # Get rid of ptport as serio port now has pointers both to parent and child # # drivers/input/mouse/psmouse-base.c # 2004/06/29 01:28:05-05:00 dtor_core@ameritech.net +48 -27 # Do not recursively register passthrough ports, leave it to serio core # # ChangeSet # 2004/06/29 01:27:46-05:00 dtor_core@ameritech.net # Input: switch to dynamic (heap) serio port allocation in preparation # to sysfs integration. By having all data structures dynamically # allocated serio driver modules can be unloaded without waiting # for the last reference to the port to be dropped. # # Signed-off-by: Dmitry Torokhov # # include/linux/serio.h # 2004/06/29 01:27:30-05:00 dtor_core@ameritech.net +3 -2 # Have name and phys stored inside serio port structure instead of # being pointers # # drivers/serial/sunzilog.c # 2004/06/29 01:27:30-05:00 dtor_core@ameritech.net +37 -23 # Switch to dynamic (heap) serio port allocation # Unregister serio ports when unloading the module # # drivers/serial/sunsu.c # 2004/06/29 01:27:30-05:00 dtor_core@ameritech.net +46 -37 # Switch to dynamic (heap) serio port allocation # # drivers/input/serio/serport.c # 2004/06/29 01:27:30-05:00 dtor_core@ameritech.net +23 -22 # Switch to dynamic (heap) serio port allocation # # drivers/input/serio/serio.c # 2004/06/29 01:27:30-05:00 dtor_core@ameritech.net +1 -0 # Switch to dynamic (heap) serio port allocation # # drivers/input/serio/sa1111ps2.c # 2004/06/29 01:27:30-05:00 dtor_core@ameritech.net +19 -13 # Switch to dynamic (heap) serio port allocation # # drivers/input/serio/rpckbd.c # 2004/06/29 01:27:30-05:00 dtor_core@ameritech.net +29 -11 # Switch to dynamic (heap) serio port allocation # # drivers/input/serio/q40kbd.c # 2004/06/29 01:27:30-05:00 dtor_core@ameritech.net +79 -28 # Switch to dynamic (heap) serio port allocation # Add some locking # # drivers/input/serio/pcips2.c # 2004/06/29 01:27:30-05:00 dtor_core@ameritech.net +18 -12 # Switch to dynamic (heap) serio port allocation # # drivers/input/serio/parkbd.c # 2004/06/29 01:27:30-05:00 dtor_core@ameritech.net +30 -17 # Switch to dynamic (heap) serio port allocation # # drivers/input/serio/maceps2.c # 2004/06/29 01:27:30-05:00 dtor_core@ameritech.net +38 -31 # Switch to dynamic (heap) serio port allocation # # drivers/input/serio/i8042.h # 2004/06/29 01:27:30-05:00 dtor_core@ameritech.net +7 -0 # Switch to dynamic (heap) serio port allocation # # drivers/input/serio/i8042.c # 2004/06/29 01:27:30-05:00 dtor_core@ameritech.net +115 -93 # Switch to dynamic (heap) serio port allocation # # drivers/input/serio/gscps2.c # 2004/06/29 01:27:30-05:00 dtor_core@ameritech.net +34 -21 # Switch to dynamic (heap) serio port allocation # # drivers/input/serio/ct82c710.c # 2004/06/29 01:27:30-05:00 dtor_core@ameritech.net +35 -27 # Switch to dynamic (heap) serio port allocation # # drivers/input/serio/ambakmi.c # 2004/06/29 01:27:30-05:00 dtor_core@ameritech.net +20 -15 # Switch to dynamic (heap) serio port allocation # # drivers/input/mouse/synaptics.c # 2004/06/29 01:27:30-05:00 dtor_core@ameritech.net +20 -13 # Switch to dynamic (heap) serio port allocation # # drivers/input/mouse/psmouse.h # 2004/06/29 01:27:30-05:00 dtor_core@ameritech.net +2 -1 # Switch to dynamic (heap) serio port allocation # # drivers/input/mouse/psmouse-base.c # 2004/06/29 01:27:30-05:00 dtor_core@ameritech.net +6 -6 # Switch to dynamic (heap) serio port allocation # # ChangeSet # 2004/06/29 01:27:11-05:00 dtor_core@ameritech.net # Input: more renames in serio in preparations to sysfs integration # - serio_dev -> serio_driver # - serio_[un]register_device -> serio_[un]register_driver # # Signed-off-by: Dmitry Torokhov # # include/linux/serio.h # 2004/06/29 01:26:54-05:00 dtor_core@ameritech.net +11 -11 # Rename serio_dev to serio_driver # # drivers/input/touchscreen/h3600_ts_input.c # 2004/06/29 01:26:54-05:00 dtor_core@ameritech.net +5 -5 # Rename serio_dev to serio_driver # # drivers/input/touchscreen/gunze.c # 2004/06/29 01:26:54-05:00 dtor_core@ameritech.net +5 -5 # Rename serio_dev to serio_driver # # drivers/input/serio/serport.c # 2004/06/29 01:26:54-05:00 dtor_core@ameritech.net +1 -1 # Rename serio_dev to serio_driver # # drivers/input/serio/serio.c # 2004/06/29 01:26:54-05:00 dtor_core@ameritech.net +36 -36 # Rename serio_dev to serio_driver # # drivers/input/mouse/vsxxxaa.c # 2004/06/29 01:26:54-05:00 dtor_core@ameritech.net +5 -5 # Rename serio_dev to serio_driver # # drivers/input/mouse/synaptics.c # 2004/06/29 01:26:54-05:00 dtor_core@ameritech.net +1 -1 # Rename serio_dev to serio_driver # # drivers/input/mouse/sermouse.c # 2004/06/29 01:26:54-05:00 dtor_core@ameritech.net +5 -5 # Rename serio_dev to serio_driver # # drivers/input/mouse/psmouse-base.c # 2004/06/29 01:26:54-05:00 dtor_core@ameritech.net +7 -7 # Rename serio_dev to serio_driver # # drivers/input/keyboard/xtkbd.c # 2004/06/29 01:26:54-05:00 dtor_core@ameritech.net +5 -5 # Rename serio_dev to serio_driver # # drivers/input/keyboard/sunkbd.c # 2004/06/29 01:26:54-05:00 dtor_core@ameritech.net +5 -5 # Rename serio_dev to serio_driver # # drivers/input/keyboard/newtonkbd.c # 2004/06/29 01:26:54-05:00 dtor_core@ameritech.net +5 -5 # Rename serio_dev to serio_driver # # drivers/input/keyboard/lkkbd.c # 2004/06/29 01:26:54-05:00 dtor_core@ameritech.net +5 -5 # Rename serio_dev to serio_driver # # drivers/input/keyboard/atkbd.c # 2004/06/29 01:26:54-05:00 dtor_core@ameritech.net +7 -7 # Rename serio_dev to serio_driver # # drivers/input/joystick/warrior.c # 2004/06/29 01:26:54-05:00 dtor_core@ameritech.net +5 -5 # Rename serio_dev to serio_driver # # drivers/input/joystick/twidjoy.c # 2004/06/29 01:26:54-05:00 dtor_core@ameritech.net +5 -5 # Rename serio_dev to serio_driver # # drivers/input/joystick/stinger.c # 2004/06/29 01:26:54-05:00 dtor_core@ameritech.net +5 -5 # Rename serio_dev to serio_driver # # drivers/input/joystick/spaceorb.c # 2004/06/29 01:26:54-05:00 dtor_core@ameritech.net +5 -5 # Rename serio_dev to serio_driver # # drivers/input/joystick/spaceball.c # 2004/06/29 01:26:54-05:00 dtor_core@ameritech.net +5 -5 # Rename serio_dev to serio_driver # # drivers/input/joystick/magellan.c # 2004/06/29 01:26:54-05:00 dtor_core@ameritech.net +5 -5 # Rename serio_dev to serio_driver # # drivers/input/joystick/iforce/iforce.h # 2004/06/29 01:26:54-05:00 dtor_core@ameritech.net +1 -1 # Rename serio_dev to serio_driver # # drivers/input/joystick/iforce/iforce-serio.c # 2004/06/29 01:26:54-05:00 dtor_core@ameritech.net +3 -3 # Rename serio_dev to serio_driver # # drivers/input/joystick/iforce/iforce-main.c # 2004/06/29 01:26:54-05:00 dtor_core@ameritech.net +2 -2 # Rename serio_dev to serio_driver # # ChangeSet # 2004/06/29 01:26:36-05:00 dtor_core@ameritech.net # Input: rename serio->driver to serio->port_data in preparation # to sysfs integration # # Signed-off-by: Dmitry Torokhov # # include/linux/serio.h # 2004/06/29 01:26:17-05:00 dtor_core@ameritech.net +1 -1 # Rename serio->driver to serio->port_data # # drivers/serial/sunzilog.c # 2004/06/29 01:26:17-05:00 dtor_core@ameritech.net +4 -4 # Rename serio->driver to serio->port_data # # drivers/serial/sunsu.c # 2004/06/29 01:26:17-05:00 dtor_core@ameritech.net +4 -4 # Rename serio->driver to serio->port_data # # drivers/input/serio/serport.c # 2004/06/29 01:26:17-05:00 dtor_core@ameritech.net +3 -3 # Rename serio->driver to serio->port_data # # drivers/input/serio/sa1111ps2.c # 2004/06/29 01:26:17-05:00 dtor_core@ameritech.net +4 -4 # Rename serio->driver to serio->port_data # # drivers/input/serio/pcips2.c # 2004/06/29 01:26:17-05:00 dtor_core@ameritech.net +4 -4 # Rename serio->driver to serio->port_data # # drivers/input/serio/maceps2.c # 2004/06/29 01:26:17-05:00 dtor_core@ameritech.net +18 -18 # Rename serio->driver to serio->port_data # # drivers/input/serio/i8042.c # 2004/06/29 01:26:17-05:00 dtor_core@ameritech.net +7 -7 # Rename serio->driver to serio->port_data # # drivers/input/serio/gscps2.c # 2004/06/29 01:26:17-05:00 dtor_core@ameritech.net +4 -4 # Rename serio->driver to serio->port_data # # drivers/input/serio/ambakmi.c # 2004/06/29 01:26:17-05:00 dtor_core@ameritech.net +11 -11 # Rename serio->driver to serio->port_data # # drivers/input/mouse/synaptics.c # 2004/06/29 01:26:17-05:00 dtor_core@ameritech.net +2 -2 # Rename serio->driver to serio->port_data # # ChangeSet # 2004/06/29 01:25:59-05:00 dtor_core@ameritech.net # Input: make connect and disconnect methods mandatory for serio # drivers since that's where serio_{open|close} are called # from to actually bind driver to a port. # # Signed-off-by: Dmitry Torokhov # # drivers/input/serio/serio.c # 2004/06/29 01:25:35-05:00 dtor_core@ameritech.net +5 -6 # Connect and disconnect handlers are now mandatory # # drivers/input/joystick/Kconfig # 2004/06/27 10:25:16+02:00 vojtech@suse.cz +1 -1 # input: Fix Kconfig so that the joydump module can be compiled. # # Reported-by: Matthieu Castet # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2004/06/25 09:51:55+02:00 vojtech@suse.cz # Merge suse.cz:/data/bk/linus into suse.cz:/data/bk/input # # arch/i386/kernel/dmi_scan.c # 2004/06/25 09:51:51+02:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2004/06/24 17:55:29+02:00 vojtech@suse.cz # input: Fix Peter Nelson's e-mail address in gamecon.c # # Signed-off-by: Vojtech Pavlik # # drivers/input/joystick/gamecon.c # 2004/06/24 17:55:22+02:00 vojtech@suse.cz +1 -1 # input: Fix Peter Nelson's e-mail address in gamecon.c # # ChangeSet # 2004/06/24 15:44:37+02:00 cr7@os.inf.tu-dresden.de # input: Add CodeMercs IOWarrior to hid-core device blacklist. # # Signed-off-by: Vojtech Pavlik # # drivers/usb/input/hid-core.c # 2004/06/24 15:44:31+02:00 cr7@os.inf.tu-dresden.de +7 -2 # input: Add CodeMercs IOWarrior to hid-core device blacklist. # # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2004/06/24 15:39:08+02:00 vojtech@suse.cz # Merge suse.cz:/data/bk/linus into suse.cz:/data/bk/input # # include/linux/serio.h # 2004/06/24 15:39:04+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/usb/input/hiddev.c # 2004/06/24 15:39:04+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/tsdev.c # 2004/06/24 15:39:04+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/mouse/Kconfig # 2004/06/24 15:39:04+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/misc/uinput.c # 2004/06/24 15:39:04+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/keyboard/atkbd.c # 2004/06/24 15:39:04+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/char/keyboard.c # 2004/06/24 15:39:03+02:00 vojtech@suse.cz +0 -0 # Auto merged # # arch/i386/kernel/dmi_scan.c # 2004/06/24 15:39:03+02:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2004/06/23 22:19:54+02:00 James@superbug.demon.co.uk # input: Add Audigy LS PCI ID to emu10k1-gp.c # # Signed-off-by: Vojtech Pavlik # # drivers/input/gameport/emu10k1-gp.c # 2004/06/23 22:19:44+02:00 James@superbug.demon.co.uk +1 -0 # input: Add Audigy LS PCI ID to emu10k1-gp.c # # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2004/06/23 19:58:19+02:00 vojtech@suse.cz # input: Add Dell SB Live! PCI ID to the emu10k1-gp driver. # # Reported-by: Francisco Moraes # Signed-off-by: Vojtech Pavlik # # drivers/input/gameport/emu10k1-gp.c # 2004/06/23 19:58:09+02:00 vojtech@suse.cz +2 -0 # input: Add Dell SB Live! PCI ID to the emu10k1-gp driver. # # Reported-by: Francisco Moraes # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2004/06/23 08:06:20+02:00 vojtech@suse.cz # input: Fix array overflows in keyboard.c when KEY_MAX > keycode > NR_KEYS > 128. # # Signed-off-by: Vojtech Pavlik # # drivers/char/keyboard.c # 2004/06/23 08:06:11+02:00 vojtech@suse.cz +5 -2 # input: Fix array overflows in keyboard.c when KEY_MAX > keycode > NR_KEYS > 128. # # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2004/06/21 20:31:56+02:00 vojtech@suse.cz # input: when probing for ImExPS/2 mice, the ImPS/2 sequence needs # to be sent first, but the result should be ignored. # # Signed-off-by: Vojtech Pavlik # # drivers/input/mouse/psmouse-base.c # 2004/06/21 20:31:45+02:00 vojtech@suse.cz +2 -0 # input: when probing for ImExPS/2 mice, the ImPS/2 sequence needs # to be sent first, but the result should be ignored. # # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2004/06/21 08:35:20+02:00 pnelson@andrew.cmu.edu # input: Enhancements/fixes for PSX pad support: # # * Adds support for more than one controller. Previously more than # one controller was initialized and the docs said they worked, but # only one was actually read. # * Removes unnecessary detection on initialization. This allows the # module to be initialized without controllers plugged in (hot # swapping controllers works). This removes a warning if the user # has an unrecognized controller plugged in, but the only # unrecognized controller I have been able to find information about # online is the PSX mouse, which I've never actually seen. # * Adds a GC_DDR option value to have direction presses register as # buttons instead of axes. Allows the module to be used for Dance # Dance Revolution emulators like Stepmania. # * Adds psx_* to documentation. # # Signed-off-by: Vojtech Pavlik # # drivers/input/joystick/gamecon.c # 2004/06/21 08:35:10+02:00 pnelson@andrew.cmu.edu +101 -91 # input: Enhancements/fixes for PSX pad support: # * Adds support for more than one controller. Previ # ously more than # one controller was initialized and the docs said they worked, but # only one was actually read. # * Removes unnecessary detection on initialization. This allows the # module to be initialized without controllers plugged in (hot # swapping controllers works). This removes a warning if the user # has an unrecognized controller plugged in, but the only # unrecognized controller I have been able to find information about # online is the PSX mouse, which I've never actually seen. # * Adds a GC_DDR option value to have direction presses register as # buttons instead of axes. Allows the module to be used for Dance # Dance Revolution emulators like Stepmania. # * Adds psx_* to documentation. # # Signed-off-by: Vojtech Pavlik # # Documentation/input/joystick-parport.txt # 2004/06/21 08:35:10+02:00 pnelson@andrew.cmu.edu +11 -2 # input: Enhancements/fixes for PSX pad support: # * Adds support for more than one controller. Previ # ously more than # one controller was initialized and the docs said they worked, but # only one was actually read. # * Removes unnecessary detection on initialization. This allows the # module to be initialized without controllers plugged in (hot # swapping controllers works). This removes a warning if the user # has an unrecognized controller plugged in, but the only # unrecognized controller I have been able to find information about # online is the PSX mouse, which I've never actually seen. # * Adds a GC_DDR option value to have direction presses register as # buttons instead of axes. Allows the module to be used for Dance # Dance Revolution emulators like Stepmania. # * Adds psx_* to documentation. # # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2004/06/21 07:48:47+02:00 vojtech@suse.cz # input: Remove an extra dmi_noloop declaration in i8042.c # # Signed-off-by: Vojtech Pavlik # # drivers/input/serio/i8042.c # 2004/06/21 07:48:38+02:00 vojtech@suse.cz +2 -1 # input: Remove an extra dmi_noloop declaration in i8042.c # # ChangeSet # 2004/06/17 08:38:07+02:00 zinx@epicsol.org # input: Fix bad struct hidinput initialization in hid-tmff.c # # Signed-off-by: Vojtech Pavlik # # drivers/usb/input/hid-tmff.c # 2004/06/17 08:37:56+02:00 zinx@epicsol.org +1 -1 # input: Fix bad struct hidinput initialization in hid-tmff.c # # ChangeSet # 2004/06/12 13:55:01+02:00 vojtech@suse.cz # Input: rearrangements and cleanups in serio.c # # Signed-off-by: Vojtech Pavlik # # drivers/input/serio/serio.c # 2004/06/12 13:54:52+02:00 vojtech@suse.cz +102 -89 # Input: rearrangements and cleanups in serio.c # # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2004/06/11 23:04:12+02:00 vojtech@suse.cz # Merge bkbits:input into suse.cz:/home/vojtech/bk/input # # drivers/usb/input/mtouchusb.c # 2004/06/11 23:04:03+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/usb/input/hiddev.c # 2004/06/11 23:04:03+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/serio/serport.c # 2004/06/11 23:04:03+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/serio/i8042.c # 2004/06/11 23:04:03+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/joystick/gf2k.c # 2004/06/11 23:04:03+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/joystick/analog.c # 2004/06/11 23:04:03+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/joystick/adi.c # 2004/06/11 23:04:03+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/gameport/vortex.c # 2004/06/11 23:04:03+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/mousedev.c # 2004/06/11 23:04:02+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/gameport/ns558.c # 2004/06/11 23:04:02+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/evdev.c # 2004/06/11 23:04:02+02:00 vojtech@suse.cz +0 -0 # Auto merged # # arch/i386/kernel/dmi_scan.c # 2004/06/11 23:04:02+02:00 vojtech@suse.cz +0 -0 # Auto merged # # Documentation/usb/mtouchusb.txt # 2004/06/11 23:04:02+02:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2004/06/11 12:10:29+02:00 vojtech@suse.cz # Merge bkbits:input into suse.cz:/data/bk/input # # drivers/input/serio/i8042.c # 2004/06/11 12:10:25+02:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2004/06/09 07:33:13+02:00 vojtech@suse.cz # Merge suse.cz:/home/vojtech/bk/linus into suse.cz:/home/vojtech/bk/input # # drivers/usb/input/mtouchusb.c # 2004/06/09 07:33:09+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/usb/input/hiddev.c # 2004/06/09 07:33:09+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/serio/serport.c # 2004/06/09 07:33:09+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/serio/i8042.c # 2004/06/09 07:33:09+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/joystick/gf2k.c # 2004/06/09 07:33:09+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/joystick/analog.c # 2004/06/09 07:33:09+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/mousedev.c # 2004/06/09 07:33:08+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/joystick/adi.c # 2004/06/09 07:33:08+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/gameport/vortex.c # 2004/06/09 07:33:08+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/gameport/ns558.c # 2004/06/09 07:33:08+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/evdev.c # 2004/06/09 07:33:08+02:00 vojtech@suse.cz +0 -0 # Auto merged # # Documentation/usb/mtouchusb.txt # 2004/06/09 07:33:08+02:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2004/06/08 22:57:09+02:00 vojtech@suse.cz # Merge suse.cz:/home/vojtech/bk/linus into suse.cz:/home/vojtech/bk/input # # drivers/usb/input/mtouchusb.c # 2004/06/08 22:57:04+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/usb/input/hiddev.c # 2004/06/08 22:57:04+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/serio/serport.c # 2004/06/08 22:57:04+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/serio/i8042.c # 2004/06/08 22:57:04+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/mousedev.c # 2004/06/08 22:57:04+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/joystick/gf2k.c # 2004/06/08 22:57:04+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/joystick/analog.c # 2004/06/08 22:57:04+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/joystick/adi.c # 2004/06/08 22:57:04+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/gameport/vortex.c # 2004/06/08 22:57:04+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/gameport/ns558.c # 2004/06/08 22:57:04+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/evdev.c # 2004/06/08 22:57:04+02:00 vojtech@suse.cz +0 -0 # Auto merged # # Documentation/usb/mtouchusb.txt # 2004/06/08 22:57:04+02:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2004/06/07 11:46:31+02:00 vojtech@suse.cz # Merge bkbits:input into suse.cz:/home/vojtech/bk/input # # arch/i386/kernel/dmi_scan.c # 2004/06/07 11:46:27+02:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2004/06/07 11:41:45+02:00 vojtech@suse.cz # Merge bkbits:input into suse.cz:/home/vojtech/bk/input # # arch/i386/kernel/dmi_scan.c # 2004/06/07 11:41:40+02:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2004/06/06 20:13:56+02:00 vojtech@suse.cz # input: Remove OSB4/Profusion hack in i8042, as it's handled by # DMI blacklist now. # # Signed-off-by: Vojtech Pavlik # # drivers/input/serio/i8042.c # 2004/06/06 20:13:43+02:00 vojtech@suse.cz +1 -10 # input: Remove OSB4/Profusion hack in i8042, as it's handled by # DMI blacklist now. # # ChangeSet # 2004/06/06 19:15:17+02:00 vojtech@suse.cz # Merge bk://dtor.bkbits.net/input into suse.cz:/home/vojtech/bk/input # # drivers/input/serio/i8042.c # 2004/06/06 19:15:13+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/mousedev.c # 2004/06/06 19:15:13+02:00 vojtech@suse.cz +0 -0 # Auto merged # # Documentation/kernel-parameters.txt # 2004/06/06 19:15:13+02:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2004/06/06 11:37:05-05:00 dtor_core@ameritech.net # Input: mousedev - implement tapping for touchpads working in absolute # mode, such as Synaptics # # Signed-off-by: Dmitry Torokhov # # drivers/input/mousedev.c # 2004/06/06 11:36:50-05:00 dtor_core@ameritech.net +31 -7 # Implement tapping for touchpads working in absolute mode # # drivers/input/mouse/Kconfig # 2004/06/06 11:36:50-05:00 dtor_core@ameritech.net +0 -2 # Do not recommend proto=imps option for Synaptics since mousedev # now supports tapping # # Documentation/kernel-parameters.txt # 2004/06/06 11:36:50-05:00 dtor_core@ameritech.net +6 -0 # mousedev.tap_time option documented # # ChangeSet # 2004/06/06 11:34:24-05:00 dtor_core@ameritech.net # Input: mousedev - better handle button presses when under load # # Signed-off-by: Dmitry Torokhov # # drivers/input/mousedev.c # 2004/06/06 11:33:44-05:00 dtor_core@ameritech.net +104 -48 # Better handle button presses under load, cleanups # # ChangeSet # 2004/06/06 15:05:20+02:00 vojtech@suse.cz # Merge suse.cz:/home/vojtech/bk/linus into suse.cz:/home/vojtech/bk/input # # fs/compat_ioctl.c # 2004/06/06 15:05:15+02:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2004/06/06 11:56:42+02:00 zap@homelink.ru # input: # # From: Andrew Zabolotny # # - Implement the 'raw' touchscreen protocol for backward compatibility # (/dev/input/ts[0-7] now speaks the protocol of the old /dev/h3600_ts, and # the /dev/input/tsraw[0-7] speaks the protocol of the old /dev/h3600_tsraw # device). # # - Support the ioctls for setting the calibration parameters. The default # calibration matrix is computed from the xres,yres parameters (duplicate the # old behaviour), however this is not enough for a good translation from # touchscreen space to screen space. # # - Fixed a old bug in tsdev: on a pen motion event X1,Y1 -> X2,Y2 the driver # would output three events with coordinates: X1,Y1, X2,Y1, X2,Y2. This # happened not only with coordinates, but with pressure too. # # - Update James's email address # # - Remove mention of Transvirtual Technologies: they no longer exist. # # Signed-off-by: Vojtech Pavlik # # drivers/input/tsdev.c # 2004/06/06 11:56:33+02:00 zap@homelink.ru +186 -105 # input: # # From: Andrew Zabolotny # # - Implement the 'raw' touchscreen protocol for backward compatibility # (/dev/input/ts[0-7] now speaks the protocol of the old /dev/h3600_ts, and # the /dev/input/tsraw[0-7] speaks the protocol of the old /dev/h3600_tsraw # device). # # - Support the ioctls for setting the calibration parameters. The default # calibration matrix is computed from the xres,yres parameters (duplicate the # old behaviour), however this is not enough for a good translation from # touchscreen space to screen space. # # - Fixed a old bug in tsdev: on a pen motion event X1,Y1 -> X2,Y2 the driver # would output three events with coordinates: X1,Y1, X2,Y1, X2,Y2. This # happened not only with coordinates, but with pressure too. # # - Update James's email address # # - Remove mention of Transvirtual Technologies: they no longer exist. # # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2004/06/06 11:37:43+02:00 herbert@gondor.apana.org.au # input: Fix boundary checks for GUSAGE/SUSAGE in hiddev. # # Signed-off-by: Vojtech Pavlik # # drivers/usb/input/hiddev.c # 2004/06/06 11:37:34+02:00 herbert@gondor.apana.org.au +13 -7 # input: Fix boundary checks for GUSAGE/SUSAGE in hiddev. # # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2004/06/06 11:09:31+02:00 vojtech@suse.cz # input: Add a missing extern i8042_dmi_loop. # # Signed-off-by: Vojtech Pavlik # # drivers/input/serio/i8042.c # 2004/06/06 11:09:20+02:00 vojtech@suse.cz +1 -0 # input: Add a missing extern i8042_dmi_loop. # # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2004/06/06 11:08:20+02:00 vojtech@suse.cz # input: Make hardware rawmode optional for AT-keyboards, and check # for rawmode bits in keyboard.c # # Signed-off-by: Vojtech Pavlik # # include/linux/input.h # 2004/06/06 11:08:11+02:00 vojtech@suse.cz +1 -0 # input: Make hardware rawmode optional for AT-keyboards, and check # for rawmode bits in keyboard.c # # Signed-off-by: Vojtech Pavlik # # drivers/input/keyboard/atkbd.c # 2004/06/06 11:08:11+02:00 vojtech@suse.cz +14 -2 # input: Make hardware rawmode optional for AT-keyboards, and check # for rawmode bits in keyboard.c # # Signed-off-by: Vojtech Pavlik # # drivers/char/keyboard.c # 2004/06/06 11:08:11+02:00 vojtech@suse.cz +2 -1 # input: Make hardware rawmode optional for AT-keyboards, and check # for rawmode bits in keyboard.c # # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2004/06/05 11:39:52+02:00 vojtech@suse.cz # Merge suse.cz:/home/vojtech/bk/linus into suse.cz:/home/vojtech/bk/input # # include/linux/compat_ioctl.h # 2004/06/05 11:39:47+02:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2004/06/04 07:18:00+02:00 wli@holomorphy.com # input: Move CONFIG_USB_HIDDEV a little lower in hiddev.h, to fix # compilation breakage when it is not defined. # # Signed-off-by: Vojtech Pavlik # # include/linux/hiddev.h # 2004/06/04 07:17:48+02:00 wli@holomorphy.com +1 -1 # input: Move CONFIG_USB_HIDDEV a little lower in hiddev.h, to fix # compilation breakage when it is not defined. # # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2004/06/02 13:00:58-05:00 dtor_core@ameritech.net # Input: logips2pp - do not call get_model_info 2 times # # Signed-off-by: Dmitry Torokhov # # drivers/input/mouse/logips2pp.c # 2004/06/02 13:00:30-05:00 dtor_core@ameritech.net +1 -1 # Do not call get_model_info 2 times # # ChangeSet # 2004/06/02 12:56:24-05:00 dtor_core@ameritech.net # Cset exclude: dtor_core@ameritech.net|ChangeSet|20040510063935|25419 # # drivers/input/serio/i8042.c # 2004/06/02 12:56:02-05:00 dtor_core@ameritech.net +0 -0 # Exclude # # ChangeSet # 2004/06/02 16:30:53+02:00 vojtech@suse.cz # input: Add a missong dmi_noloop declaration in i8042.c # # Signed-off-by: Vojtech Pavlik # # drivers/input/serio/i8042.c # 2004/06/02 16:30:48+02:00 vojtech@suse.cz +1 -0 # input: Add a missong dmi_noloop declaration in i8042.c # # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2004/06/02 16:09:25+02:00 vojtech@suse.cz # input: More locking improvements (and a fix) for serio. This # merges both my and Dmitry's changes. # # Signed-off-by: Vojtech Pavlik # # drivers/input/serio/serio.c # 2004/06/02 16:09:19+02:00 vojtech@suse.cz +14 -12 # input: More locking improvements (and a fix) for serio. This # merges both my and Dmitry's changes. # # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2004/06/02 15:46:14+02:00 vojtech@suse.cz # input: Make atkbd.c's atkbd_command() function immune to keys being pressed # and scancodes coming from the keyboard while it's executing. # # Signed-off-by: Vojtech Pavlik # # drivers/input/keyboard/atkbd.c # 2004/06/02 15:46:08+02:00 vojtech@suse.cz +8 -12 # input: Make atkbd.c's atkbd_command() function immune to keys being pressed # and scancodes coming from the keyboard while it's executing. # # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2004/06/02 13:48:07+02:00 vojtech@suse.cz # Merge suse.cz:/data/bk/compaq into suse.cz:/data/bk/input # # drivers/input/serio/i8042.c # 2004/06/02 13:48:04+02:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2004/06/02 13:44:20+02:00 vojtech@suse.cz # input: Disable the AUX LoopBack command in i8042.c on Compaq ProLiant # 8-way Xeon ProFusion systems, as it causes crashes and reboots # on these machines. DMI data is used for determining if the # workaround should be enabled. # # Signed-off-by: Vojtech Pavlik # # drivers/input/serio/i8042.c # 2004/06/02 13:44:15+02:00 vojtech@suse.cz +13 -1 # input: Disable the AUX LoopBack command in i8042.c on Compaq ProLiant # 8-way Xeon ProFusion systems, as it causes crashes and reboots # on these machines. DMI data is used for determining if the # workaround should be enabled. # # arch/i386/kernel/dmi_scan.c # 2004/06/02 13:44:15+02:00 vojtech@suse.cz +31 -0 # input: Disable the AUX LoopBack command in i8042.c on Compaq ProLiant # 8-way Xeon ProFusion systems, as it causes crashes and reboots # on these machines. DMI data is used for determining if the # workaround should be enabled. # # ChangeSet # 2004/06/02 09:37:24+02:00 vojtech@suse.cz # input: Fixes in serio locking. We need per-serio lock for passthrough # ports, some locks were missing, and spin_lock_irq was wishful # thinking in serio_interrupt. There is no guarantee # that serio_interrupt won't be called twice at the same time. # # Signed-off-by: Vojtech Pavlik # # include/linux/serio.h # 2004/06/02 09:37:13+02:00 vojtech@suse.cz +3 -0 # input: Fixes in serio locking. We need per-serio lock for passthrough # ports, some locks were missing, and spin_lock_irq was wishful # thinking in serio_interrupt. There is no guarantee # that serio_interrupt won't be called twice at the same time. # # drivers/input/serio/serio.c # 2004/06/02 09:37:13+02:00 vojtech@suse.cz +29 -26 # input: Fixes in serio locking. We need per-serio lock for passthrough # ports, some locks were missing, and spin_lock_irq was wishful # thinking in serio_interrupt. There is no guarantee # that serio_interrupt won't be called twice at the same time. # # ChangeSet # 2004/05/31 16:25:29+02:00 vojtech@suse.cz # input: Use raw events generated by atkbd in keyboard.c to implement true # rawmode for PS/2 keyboards. # # Signed-off-by: Vojtech Pavlik # # drivers/char/keyboard.c # 2004/05/31 16:25:23+02:00 vojtech@suse.cz +19 -6 # input: Use raw events generated by atkbd in keyboard.c to implement true # rawmode for PS/2 keyboards. # # ChangeSet # 2004/05/31 15:49:05+02:00 vojtech@suse.cz # input: Add reporting of raw scancodes to atkbd.c # # Signed-off-by: Vojtech Pavlik # # include/linux/input.h # 2004/05/31 15:49:00+02:00 vojtech@suse.cz +1 -0 # input: Add reporting of raw scancodes to atkbd.c # # drivers/input/keyboard/atkbd.c # 2004/05/31 15:49:00+02:00 vojtech@suse.cz +5 -3 # input: Add reporting of raw scancodes to atkbd.c # # ChangeSet # 2004/05/31 15:11:41+02:00 vojtech@suse.cz # input: Explicit variable access rules for psmouse.c, using bitops. # # drivers/input/mouse/psmouse.h # 2004/05/31 15:11:35+02:00 vojtech@suse.cz +7 -2 # input: Explicit variable access rules for psmouse.c, using bitops. # # drivers/input/mouse/psmouse-base.c # 2004/05/31 15:11:35+02:00 vojtech@suse.cz +79 -50 # input: Explicit variable access rules for psmouse.c, using bitops. # # drivers/input/keyboard/atkbd.c # 2004/05/31 15:11:35+02:00 vojtech@suse.cz +1 -1 # input: Explicit variable access rules for psmouse.c, using bitops. # # ChangeSet # 2004/05/31 12:27:40+02:00 vojtech@suse.cz # input: Return 0 from uinput poll if device isn't yet created. # # Signed-off-by: Vojtech Pavlik # # drivers/input/misc/uinput.c # 2004/05/31 12:27:29+02:00 vojtech@suse.cz +1 -1 # input: Return 0 from uinput poll if device isn't yet created. # # ChangeSet # 2004/05/30 16:57:22+02:00 vojtech@suse.cz # input: Make atomicity and exclusive access to variables explicit # in atkbd.c, using bitops. # # Signed-off-by: Vojtech Pavlik # # drivers/input/keyboard/atkbd.c # 2004/05/30 16:54:58+02:00 vojtech@suse.cz +89 -44 # input: Make atomicity and exclusive access to variables explicit # in atkbd.c, using bitops. # # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2004/05/30 16:12:14+02:00 vojtech@suse.cz # Merge suse.cz:/home/vojtech/bk/linus into suse.cz:/home/vojtech/bk/input # # fs/compat_ioctl.c # 2004/05/30 16:12:09+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/serio/serport.c # 2004/05/30 16:12:09+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/mousedev.c # 2004/05/30 16:12:09+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/evdev.c # 2004/05/30 16:12:09+02:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2004/05/29 14:27:40+02:00 vojtech@suse.cz # Merge suse.cz:/home/vojtech/bk/linus into suse.cz:/home/vojtech/bk/input # # include/linux/compat_ioctl.h # 2004/05/29 14:27:35+02:00 vojtech@suse.cz +0 -0 # Auto merged # # fs/compat_ioctl.c # 2004/05/29 14:27:35+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/usb/input/mtouchusb.c # 2004/05/29 14:27:35+02:00 vojtech@suse.cz +0 -35 # Auto merged # # drivers/usb/input/hiddev.c # 2004/05/29 14:27:35+02:00 vojtech@suse.cz +0 -1 # Auto merged # # drivers/input/joystick/gf2k.c # 2004/05/29 14:27:35+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/joystick/analog.c # 2004/05/29 14:27:34+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/joystick/adi.c # 2004/05/29 14:27:34+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/gameport/vortex.c # 2004/05/29 14:27:34+02:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/input/gameport/ns558.c # 2004/05/29 14:27:34+02:00 vojtech@suse.cz +0 -0 # Auto merged # # Documentation/usb/mtouchusb.txt # 2004/05/29 14:27:34+02:00 vojtech@suse.cz +0 -42 # Auto merged # # ChangeSet # 2004/05/28 22:57:43+02:00 vojtech@suse.cz # input: Fix an oops in poll() on uinput. Thanks to Dmitry Torokhov # for suggesting the fix. # # drivers/input/misc/uinput.c # 2004/05/28 22:57:31+02:00 vojtech@suse.cz +3 -0 # input: Fix an oops in poll() on uinput. # # ChangeSet # 2004/05/28 18:24:08+02:00 vojtech@suse.cz # input: An attempt at fixing locking in i8042.c and serio.c # # include/linux/serio.h # 2004/05/28 18:24:02+02:00 vojtech@suse.cz +1 -1 # input: An attempt at fixing locking in i8042.c and serio.c # # drivers/input/serio/serio.c # 2004/05/28 18:24:02+02:00 vojtech@suse.cz +54 -10 # input: An attempt at fixing locking in i8042.c and serio.c # # drivers/input/serio/i8042.c # 2004/05/28 18:24:02+02:00 vojtech@suse.cz +4 -0 # input: An attempt at fixing locking in i8042.c and serio.c # # ChangeSet # 2004/05/28 16:19:29+02:00 vojtech@suse.cz # Cset exclude: dtor_core@ameritech.net|ChangeSet|20040510063935|25419 # # drivers/input/serio/i8042.c # 2004/05/28 16:19:20+02:00 vojtech@suse.cz +0 -0 # Exclude # # ChangeSet # 2004/05/19 00:13:58+02:00 akropel1@rochester.rr.com # input: Add 64-bit compatible ioctls for hiddev. # # include/linux/hiddev.h # 2004/05/19 00:13:45+02:00 akropel1@rochester.rr.com +7 -1 # input: Add 64-bit compatible ioctls for hiddev. # # include/linux/compat_ioctl.h # 2004/05/19 00:13:45+02:00 akropel1@rochester.rr.com +17 -0 # input: Add 64-bit compatible ioctls for hiddev. # # fs/compat_ioctl.c # 2004/05/19 00:13:45+02:00 akropel1@rochester.rr.com +2 -0 # input: Add 64-bit compatible ioctls for hiddev. # # drivers/usb/input/hiddev.c # 2004/05/19 00:13:45+02:00 akropel1@rochester.rr.com +1 -1 # input: Add 64-bit compatible ioctls for hiddev. # diff -Nru a/CREDITS b/CREDITS --- a/CREDITS 2004-09-26 10:25:57 -07:00 +++ b/CREDITS 2004-09-26 10:25:57 -07:00 @@ -2618,6 +2618,7 @@ E: nico@cam.org D: StrongARM SA1100 support integrator & hacker D: Xscale PXA architecture +D: unified SMC 91C9x/91C11x ethernet driver (smc91x) S: Montreal, Quebec, Canada N: Ken Pizzini diff -Nru a/Documentation/RCU/RTFP.txt b/Documentation/RCU/RTFP.txt --- a/Documentation/RCU/RTFP.txt 2004-09-26 10:25:57 -07:00 +++ b/Documentation/RCU/RTFP.txt 2004-09-26 10:25:57 -07:00 @@ -202,10 +202,33 @@ ,institution="US Patent and Trademark Office" ,address="Washington, DC" ,year="1995" -,number="US Patent 5,442,758" +,number="US Patent 5,442,758 (contributed under GPL)" ,month="August" } +@techreport{Slingwine97 +,author="John D. Slingwine and Paul E. McKenney" +,title="Method for maintaining data coherency using thread +activity summaries in a multicomputer system" +,institution="US Patent and Trademark Office" +,address="Washington, DC" +,year="1997" +,number="US Patent 5,608,893 (contributed under GPL)" +,month="March" +} + +@techreport{Slingwine98 +,author="John D. Slingwine and Paul E. McKenney" +,title="Apparatus and method for achieving reduced overhead +mutual exclusion and maintaining coherency in a multiprocessor +system utilizing execution history and thread monitoring" +,institution="US Patent and Trademark Office" +,address="Washington, DC" +,year="1998" +,number="US Patent 5,727,209 (contributed under GPL)" +,month="March" +} + @Conference{McKenney98 ,Author="Paul E. McKenney and John D. Slingwine" ,Title="Read-Copy Update: Using Execution History to Solve Concurrency @@ -227,6 +250,18 @@ ,Year="1999" ,pages="87-100" ,Address="New Orleans, LA" +} + +@techreport{Slingwine01 +,author="John D. Slingwine and Paul E. McKenney" +,title="Apparatus and method for achieving reduced overhead +mutual exclusion and maintaining coherency in a multiprocessor +system utilizing execution history and thread monitoring" +,institution="US Patent and Trademark Office" +,address="Washington, DC" +,year="2001" +,number="US Patent 5,219,690 (contributed under GPL)" +,month="April" } @Conference{McKenney01a diff -Nru a/Documentation/RCU/UP.txt b/Documentation/RCU/UP.txt --- a/Documentation/RCU/UP.txt 2004-09-26 10:25:56 -07:00 +++ b/Documentation/RCU/UP.txt 2004-09-26 10:25:56 -07:00 @@ -50,8 +50,8 @@ Summary -Permitting call_rcu() to immediatly invoke its arguments or permitting -synchronize_kernel() to immediatly return breaks RCU, even on a UP system. +Permitting call_rcu() to immediately invoke its arguments or permitting +synchronize_kernel() to immediately return breaks RCU, even on a UP system. So do not do it! Even on a UP system, the RCU infrastructure -must- respect grace periods. diff -Nru a/Documentation/RCU/arrayRCU.txt b/Documentation/RCU/arrayRCU.txt --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/Documentation/RCU/arrayRCU.txt 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,141 @@ +Using RCU to Protect Read-Mostly Arrays + + +Although RCU is more commonly used to protect linked lists, it can +also be used to protect arrays. Three situations are as follows: + +1. Hash Tables + +2. Static Arrays + +3. Resizeable Arrays + +Each of these situations are discussed below. + + +Situation 1: Hash Tables + +Hash tables are often implemented as an array, where each array entry +has a linked-list hash chain. Each hash chain can be protected by RCU +as described in the listRCU.txt document. This approach also applies +to other array-of-list situations, such as radix trees. + + +Situation 2: Static Arrays + +Static arrays, where the data (rather than a pointer to the data) is +located in each array element, and where the array is never resized, +have not been used with RCU. Rik van Riel recommends using seqlock in +this situation, which would also have minimal read-side overhead as long +as updates are rare. + +Quick Quiz: Why is it so important that updates be rare when + using seqlock? + + +Situation 3: Resizeable Arrays + +Use of RCU for resizeable arrays is demonstrated by the grow_ary() +function used by the System V IPC code. The array is used to map from +semaphore, message-queue, and shared-memory IDs to the data structure +that represents the corresponding IPC construct. The grow_ary() +function does not acquire any locks; instead its caller must hold the +ids->sem semaphore. + +The grow_ary() function, shown below, does some limit checks, allocates a +new ipc_id_ary, copies the old to the new portion of the new, initializes +the remainder of the new, updates the ids->entries pointer to point to +the new array, and invokes ipc_rcu_putref() to free up the old array. +Note that rcu_assign_pointer() is used to update the ids->entries pointer, +which includes any memory barriers required on whatever architecture +you are running on. + + static int grow_ary(struct ipc_ids* ids, int newsize) + { + struct ipc_id_ary* new; + struct ipc_id_ary* old; + int i; + int size = ids->entries->size; + + if(newsize > IPCMNI) + newsize = IPCMNI; + if(newsize <= size) + return newsize; + + new = ipc_rcu_alloc(sizeof(struct kern_ipc_perm *)*newsize + + sizeof(struct ipc_id_ary)); + if(new == NULL) + return size; + new->size = newsize; + memcpy(new->p, ids->entries->p, + sizeof(struct kern_ipc_perm *)*size + + sizeof(struct ipc_id_ary)); + for(i=size;ip[i] = NULL; + } + old = ids->entries; + + /* + * Use rcu_assign_pointer() to make sure the memcpyed + * contents of the new array are visible before the new + * array becomes visible. + */ + rcu_assign_pointer(ids->entries, new); + + ipc_rcu_putref(old); + return newsize; + } + +The ipc_rcu_putref() function decrements the array's reference count +and then, if the reference count has dropped to zero, uses call_rcu() +to free the array after a grace period has elapsed. + +The array is traversed by the ipc_lock() function. This function +indexes into the array under the protection of rcu_read_lock(), +using rcu_dereference() to pick up the pointer to the array so +that it may later safely be dereferenced -- memory barriers are +required on the Alpha CPU. Since the size of the array is stored +with the array itself, there can be no array-size mismatches, so +a simple check suffices. The pointer to the structure corresponding +to the desired IPC object is placed in "out", with NULL indicating +a non-existent entry. After acquiring "out->lock", the "out->deleted" +flag indicates whether the IPC object is in the process of being +deleted, and, if not, the pointer is returned. + + struct kern_ipc_perm* ipc_lock(struct ipc_ids* ids, int id) + { + struct kern_ipc_perm* out; + int lid = id % SEQ_MULTIPLIER; + struct ipc_id_ary* entries; + + rcu_read_lock(); + entries = rcu_dereference(ids->entries); + if(lid >= entries->size) { + rcu_read_unlock(); + return NULL; + } + out = entries->p[lid]; + if(out == NULL) { + rcu_read_unlock(); + return NULL; + } + spin_lock(&out->lock); + + /* ipc_rmid() may have already freed the ID while ipc_lock + * was spinning: here verify that the structure is still valid + */ + if (out->deleted) { + spin_unlock(&out->lock); + rcu_read_unlock(); + return NULL; + } + return out; + } + + +Answer to Quick Quiz: + + The reason that it is important that updates be rare when + using seqlock is that frequent updates can livelock readers. + One way to avoid this problem is to assign a seqlock for + each array entry rather than to the entire array. diff -Nru a/Documentation/RCU/listRCU.txt b/Documentation/RCU/listRCU.txt --- a/Documentation/RCU/listRCU.txt 2004-09-26 10:25:55 -07:00 +++ b/Documentation/RCU/listRCU.txt 2004-09-26 10:25:55 -07:00 @@ -18,8 +18,8 @@ Therefore, once the route has been computed, there is no need to hold the routing table static during transmission of the packet. After all, you can hold the routing table static all you want, but that won't keep -the external internet from changing, and it is the state of the external -internet that really matters. In addition, routing entries are typically +the external Internet from changing, and it is the state of the external +Internet that really matters. In addition, routing entries are typically added or deleted, rather than being modified in place. A straightforward example of this use of RCU may be found in the @@ -195,7 +195,7 @@ if (!audit_compare_rule(rule, &e->rule)) { ne = kmalloc(sizeof(*entry), GFP_ATOMIC); if (ne == NULL) - return _ENOMEM; + return -ENOMEM; audit_copy_rule(&ne->rule, &e->rule); ne->rule.action = newaction; ne->rule.file_count = newfield_count; @@ -255,6 +255,12 @@ rcu_read_unlock(); return AUDIT_BUILD_CONTEXT; } + +Note that this example assumes that entries are only added and deleted. +Additional mechanism is required to deal correctly with the +update-in-place performed by audit_upd_rule(). For one thing, +audit_upd_rule() would need additional memory barriers to ensure +that the list_add_rcu() was really executed before the list_del_rcu(). The audit_del_rule() function would need to set the "deleted" flag under the spinlock as follows: diff -Nru a/Documentation/RCU/rcu.txt b/Documentation/RCU/rcu.txt --- a/Documentation/RCU/rcu.txt 2004-09-26 10:25:55 -07:00 +++ b/Documentation/RCU/rcu.txt 2004-09-26 10:25:55 -07:00 @@ -1,20 +1,19 @@ RCU Concepts -The basic idea behind RCU is to split destructive operations into two -parts, one that makes anyone from seeing the data item being destroyed, -and one that actually carries out the destruction. A "grace period" -must elapse between the two parts, and this grace period must be long -enough that any readers accessing the item being deleted have since -dropped their references. For example, an RCU-protected deletion from a -linked list would first remove the item from the list, wait for a grace -period to elapse, then free the element. See the listRCU.txt file for -more information on using RCU with linked lists. +The basic idea behind RCU (read-copy update) is to split destructive +operations into two parts, one that prevents anyone from seeing the data +item being destroyed, and one that actually carries out the destruction. +A "grace period" must elapse between the two parts, and this grace period +must be long enough that any readers accessing the item being deleted have +since dropped their references. For example, an RCU-protected deletion +from a linked list would first remove the item from the list, wait for +a grace period to elapse, then free the element. See the listRCU.txt +file for more information on using RCU with linked lists. Frequently Asked Questions - o Why would anyone want to use RCU? The advantage of RCU's two-part approach is that RCU readers need @@ -25,7 +24,6 @@ in read-mostly situations. The fact that RCU readers need not acquire locks can also greatly simplify deadlock-avoidance code. - o How can the updater tell when a grace period has completed if the RCU readers give no indication when they are done? @@ -50,6 +48,19 @@ o What guidelines should I follow when writing code that uses RCU? See the checklist.txt file in this directory. + +o Why the name "RCU"? + + "RCU" stands for "read-copy update". The file listRCU.txt has + more information on where this name came from, search for + "read-copy update" to find it. + +o I hear that RCU is patented? What is with that? + + Yes, it is. There are several known patents related to RCU, + search for the string "Patent" in RTFP.txt to find them. + Of these, one was allowed to lapse by the assignee, and the + others have been contributed to the Linux kernel under GPL. o Where can I find more information on RCU? diff -Nru a/Documentation/cachetlb.txt b/Documentation/cachetlb.txt --- a/Documentation/cachetlb.txt 2004-09-26 10:25:56 -07:00 +++ b/Documentation/cachetlb.txt 2004-09-26 10:25:56 -07:00 @@ -354,10 +354,6 @@ of arbitrary user pages (f.e. for ptrace()) it will use these two routines. - The page has been kmap()'d, and flush_cache_page() has - just been called for the user mapping of this page (if - necessary). - Any necessary cache flushing or other coherency operations that need to occur should happen here. If the processor's instruction cache does not snoop cpu stores, it is very diff -Nru a/Documentation/devices.txt b/Documentation/devices.txt --- a/Documentation/devices.txt 2004-09-26 10:25:56 -07:00 +++ b/Documentation/devices.txt 2004-09-26 10:25:56 -07:00 @@ -1683,11 +1683,16 @@ 1 = /dev/dcxx1 Second capture card ... - 94 block Inverse NAND Flash Translation Layer - 0 = /dev/inftla First INFTL layer - 16 = /dev/inftlb Second INFTL layer + 94 block IBM S/390 DASD block storage + 0 = /dev/dasda First DASD device, major + 1 = /dev/dasda1 First DASD device, block 1 + 2 = /dev/dasda2 First DASD device, block 2 + 3 = /dev/dasda3 First DASD device, block 3 + 4 = /dev/dasdb Second DASD device, major + 5 = /dev/dasdb1 Second DASD device, block 1 + 6 = /dev/dasdb2 Second DASD device, block 2 + 7 = /dev/dasdb3 Second DASD device, block 3 ... - 240 = /dev/inftlp 16th INTFL layer 95 char IP filter 0 = /dev/ipl Filter control device/log file @@ -1696,15 +1701,9 @@ 3 = /dev/ipauth Authentication control device/log file ... - 95 block IBM S/390 DASD block storage - 0 = /dev/dasd0 First DASD device, major - 1 = /dev/dasd0a First DASD device, block 1 - 2 = /dev/dasd0b First DASD device, block 2 - 3 = /dev/dasd0c First DASD device, block 3 - 4 = /dev/dasd1 Second DASD device, major - 5 = /dev/dasd1a Second DASD device, block 1 - 6 = /dev/dasd1b Second DASD device, block 2 - 7 = /dev/dasd1c Second DASD device, block 3 + 95 block IBM S/390 VM/ESA minidisk + 0 = /dev/msd0 First VM/ESA minidisk + 1 = /dev/msd1 Second VM/ESA minidisk ... 96 char Parallel port ATAPI tape devices @@ -1715,10 +1714,11 @@ 129 = /dev/npt1 Second p.p. ATAPI tape, no rewind ... - 96 block IBM S/390 VM/ESA minidisk - 0 = /dev/msd0 First VM/ESA minidisk - 1 = /dev/msd1 Second VM/ESA minidisk + 96 block Inverse NAND Flash Translation Layer + 0 = /dev/inftla First INFTL layer + 16 = /dev/inftlb Second INFTL layer ... + 240 = /dev/inftlp 16th INTFL layer 97 char Parallel port generic ATAPI interface 0 = /dev/pg0 First parallel port ATAPI device @@ -2745,6 +2745,8 @@ 41 = /dev/ttySMX0 Motorola i.MX - port 0 42 = /dev/ttySMX1 Motorola i.MX - port 1 43 = /dev/ttySMX2 Motorola i.MX - port 2 + 44 = /dev/ttyMM0 Marvell MPSC - port 0 + 45 = /dev/ttyMM1 Marvell MPSC - port 1 205 char Low-density serial ports (alternate device) 0 = /dev/culu0 Callout device for ttyLU0 diff -Nru a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking --- a/Documentation/filesystems/Locking 2004-09-26 10:25:57 -07:00 +++ b/Documentation/filesystems/Locking 2004-09-26 10:25:57 -07:00 @@ -90,7 +90,7 @@ void (*destroy_inode)(struct inode *); void (*read_inode) (struct inode *); void (*dirty_inode) (struct inode *); - void (*write_inode) (struct inode *, int); + int (*write_inode) (struct inode *, int); void (*put_inode) (struct inode *); void (*drop_inode) (struct inode *); void (*delete_inode) (struct inode *); diff -Nru a/Documentation/filesystems/ntfs.txt b/Documentation/filesystems/ntfs.txt --- a/Documentation/filesystems/ntfs.txt 2004-09-26 10:25:56 -07:00 +++ b/Documentation/filesystems/ntfs.txt 2004-09-26 10:25:56 -07:00 @@ -277,6 +277,15 @@ Note, a technical ChangeLog aimed at kernel hackers is in fs/ntfs/ChangeLog. +2.1.19: + - Minor bugfix in handling of the default upcase table. + - Many internal cleanups and improvements. Many thanks to Linus + Torvalds and Al Viro for the help and advice with the sparse + annotations and cleanups. +2.1.18: + - Fix scheduling latencies at mount time. (Ingo Molnar) + - Fix endianness bug in a little traversed portion of the attribute + lookup code. 2.1.17: - Fix bugs in mount time error code paths. 2.1.16: diff -Nru a/Documentation/filesystems/tmpfs.txt b/Documentation/filesystems/tmpfs.txt --- a/Documentation/filesystems/tmpfs.txt 2004-09-26 10:25:55 -07:00 +++ b/Documentation/filesystems/tmpfs.txt 2004-09-26 10:25:55 -07:00 @@ -62,13 +62,21 @@ since the OOM handler will not be able to free that memory. nr_blocks: The same as size, but in blocks of PAGE_CACHE_SIZE. nr_inodes: The maximum number of inodes for this instance. The default - is half of the number of your physical RAM pages. + is half of the number of your physical RAM pages, or (on a + a machine with highmem) the number of lowmem RAM pages, + whichever is the lower. These parameters accept a suffix k, m or g for kilo, mega and giga and can be changed on remount. The size parameter also accepts a suffix % to limit this tmpfs instance to that percentage of your physical RAM: the default, when neither size nor nr_blocks is specified, is size=50% +If both nr_blocks (or size) and nr_inodes are set to 0, neither blocks +nor inodes will be limited in that instance. It is generally unwise to +mount with such options, since it allows any user with write access to +use up all the memory on the machine; but enhances the scalability of +that instance in a system with many cpus making intensive use of it. + To specify the initial root directory you can use the following mount options: @@ -89,4 +97,4 @@ Author: Christoph Rohland , 1.12.01 Updated: - Hugh Dickins , 01 April 2003 + Hugh Dickins , 01 September 2004 diff -Nru a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt --- a/Documentation/filesystems/vfs.txt 2004-09-26 10:25:56 -07:00 +++ b/Documentation/filesystems/vfs.txt 2004-09-26 10:25:56 -07:00 @@ -176,7 +176,7 @@ struct super_operations { void (*read_inode) (struct inode *); - void (*write_inode) (struct inode *, int); + int (*write_inode) (struct inode *, int); void (*put_inode) (struct inode *); void (*drop_inode) (struct inode *); void (*delete_inode) (struct inode *); diff -Nru a/Documentation/input/joystick-parport.txt b/Documentation/input/joystick-parport.txt --- a/Documentation/input/joystick-parport.txt 2004-09-26 10:25:57 -07:00 +++ b/Documentation/input/joystick-parport.txt 2004-09-26 10:25:57 -07:00 @@ -335,6 +335,7 @@ * Analog PSX Pad (red mode) * Analog PSX Pad (green mode) * PSX Rumble Pad + * PSX DDR Pad 2.4 Sega ~~~~~~~~ @@ -452,13 +453,21 @@ 5 | Multisystem 2-button joystick 6 | N64 pad 7 | Sony PSX controller + 8 | Sony PSX DDR controller - The exact type of the PSX controller type is autoprobed, so you must have -your controller plugged in before initializing. + The exact type of the PSX controller type is autoprobed when used so +hot swapping should work (but is not recomended). Should you want to use more than one of parallel ports at once, you can use gamecon.map2 and gamecon.map3 as additional command line parameters for two more parallel ports. + + There are two options specific to PSX driver portion. gamecon.psx_delay sets +the command delay when talking to the controllers. The default of 25 should +work but you can try lowering it for better performace. If your pads don't +respond try raising it untill they work. Setting the type to 8 allows the +driver to be used with Dance Dance Revolution or similar games. Arrow keys are +registered as key presses instead of X and Y axes. 3.2 db9.c ~~~~~~~~~ diff -Nru a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt --- a/Documentation/kernel-parameters.txt 2004-09-26 10:25:57 -07:00 +++ b/Documentation/kernel-parameters.txt 2004-09-26 10:25:57 -07:00 @@ -453,6 +453,11 @@ hd?= [HW] (E)IDE subsystem hd?lun= See Documentation/ide.txt. + highmem=nn[KMG] [KNL,BOOT] forces the highmem zone to have an exact + size of . This works even on boxes that have no + highmem otherwise. This also works to reduce highmem + size on bigger boxes. + hisax= [HW,ISDN] See Documentation/isdn/README.HiSax. @@ -669,6 +674,12 @@ mga= [HW,DRM] + mousedev.tap_time= + [MOUSE] Maximum time between finger touching and + leaving touchpad surface for touch to be considered + a tap and be reported as a left button click (for + touchpads working in absolute mode only). + Format: mousedev.xres= [MOUSE] Horizontal screen resolution, used for devices reporting absolute coordinates, such as tablets mousedev.yres= [MOUSE] Vertical screen resolution, used for devices @@ -879,6 +890,13 @@ noacpi [IA-32] Do not use ACPI for IRQ routing or for PCI scanning. + firmware [ARM] Do not re-enumerate the bus but + instead just use the configuration + from the bootloader. This is currently + used on IXP2000 systems where the + bus has to be configured a certain way + for adjunct CPUs. + pcmv= [HW,PCMCIA] BadgePAD 4 pd. [PARIDE] @@ -1279,6 +1297,12 @@ Use vga=ask for menu. This is actually a boot loader parameter; the value is passed to the kernel using a special protocol. + + vmalloc=nn[KMG] [KNL,BOOT] forces the vmalloc area to have an exact + size of . This can be used to increase the + minimum size (128MB on x86). It can also be used to + decrease the size and leave more room for directly + mapped kernel RAM. vmhalt= [KNL,S390] diff -Nru a/MAINTAINERS b/MAINTAINERS --- a/MAINTAINERS 2004-09-26 10:25:56 -07:00 +++ b/MAINTAINERS 2004-09-26 10:25:56 -07:00 @@ -1078,6 +1078,13 @@ L: linux-fbdev-devel@lists.sourceforge.net S: Maintained +INPUT (KEYBOARD, MOUSE, JOYSTICK) DRIVERS +P: Vojtech Pavlik +M: vojtech@suse.cz +L: linux-input@atrey.karlin.mff.cuni.cz +L: linux-joystick@atrey.karlin.mff.cuni.cz +S: Maintained + INTEL 810/815 FRAMEBUFFER DRIVER P: Antonino Daplas M: adaplas@pol.net @@ -1202,13 +1209,6 @@ W: http://oss.software.ibm.com/jfs/ S: Supported -JOYSTICK DRIVER -P: Vojtech Pavlik -M: vojtech@suse.cz -L: linux-joystick@atrey.karlin.mff.cuni.cz -W: http://www.suse.cz/development/joystick/ -S: Maintained - KCONFIG P: Roman Zippel M: zippel@linux-m68k.org @@ -1757,6 +1757,12 @@ W: http://www.pnd-pc.demon.co.uk/promise/ S: Maintained +PXA2xx SUPPORT +P: Nicolas Pitre +M: nico@cam.org +L: linux-arm-kernel@lists.arm.linux.org.uk +S: Maintained + QNX4 FILESYSTEM P: Anders Larsen M: al@alarsen.net @@ -1833,12 +1839,6 @@ W: http://www.mihu.de/linux/saa7146 S: Maintained -SA1100 SUPPORT -P: Nicolas Pitre -M: nico@cam.org -L: linux-arm@lists.arm.linux.org.uk -S: Maintained - SBPCD CDROM DRIVER P: Eberhard Moenkeberg M: emoenke@gwdg.de @@ -1957,6 +1957,11 @@ L: samba@samba.org S: Maintained +SMC91x ETHERNET DRIVER +P: Nicolas Pitre +M: nico@cam.org +S: Maintained + SNA NETWORK LAYER P: Jay Schulist M: jschlst@samba.org @@ -2220,12 +2225,11 @@ L: linux-usb-devel@lists.sourceforge.net S: Maintained -USB HID/HIDBP/INPUT DRIVERS +USB HID/HIDBP DRIVERS P: Vojtech Pavlik M: vojtech@suse.cz L: linux-usb-users@lists.sourceforge.net L: linux-usb-devel@lists.sourceforge.net -W: http://www.suse.cz/development/input/ S: Maintained USB HUB DRIVER diff -Nru a/arch/alpha/Kconfig b/arch/alpha/Kconfig --- a/arch/alpha/Kconfig 2004-09-26 10:25:58 -07:00 +++ b/arch/alpha/Kconfig 2004-09-26 10:25:58 -07:00 @@ -32,6 +32,10 @@ bool default y +config GENERIC_IOMAP + bool + default n + source "init/Kconfig" diff -Nru a/arch/alpha/defconfig b/arch/alpha/defconfig --- a/arch/alpha/defconfig 2004-09-26 10:25:56 -07:00 +++ b/arch/alpha/defconfig 2004-09-26 10:25:56 -07:00 @@ -1,38 +1,48 @@ # # Automatically generated make config: don't edit +# Linux kernel version: 2.6.9-rc2 +# Sat Sep 25 15:38:35 2004 # CONFIG_ALPHA=y CONFIG_64BIT=y CONFIG_MMU=y CONFIG_RWSEM_XCHGADD_ALGORITHM=y CONFIG_GENERIC_ISA_DMA=y +# CONFIG_GENERIC_IOMAP 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_LOCALVERSION="" CONFIG_SWAP=y CONFIG_SYSVIPC=y +CONFIG_POSIX_MQUEUE=y # CONFIG_BSD_PROCESS_ACCT 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 is not set CONFIG_KALLSYMS=y +CONFIG_KALLSYMS_ALL=y +# CONFIG_KALLSYMS_EXTRA_PASS 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 +CONFIG_SHMEM=y +# CONFIG_TINY_SHMEM is not set # # Loadable module support @@ -84,7 +94,6 @@ CONFIG_PCI_DOMAINS=y CONFIG_ALPHA_CORE_AGP=y CONFIG_ALPHA_BROKEN_IRQ_MASK=y -CONFIG_EARLY_PRINTK=y CONFIG_EISA=y # CONFIG_SMP is not set # CONFIG_DISCONTIGMEM is not set @@ -108,6 +117,8 @@ # # Generic Driver Options # +CONFIG_STANDALONE=y +CONFIG_PREVENT_FIRMWARE_BUILD=y # CONFIG_DEBUG_DRIVER is not set # @@ -130,7 +141,6 @@ # Protocols # CONFIG_ISAPNP=y -# CONFIG_PNPBIOS is not set # # Block devices @@ -144,7 +154,7 @@ CONFIG_BLK_DEV_LOOP=m # CONFIG_BLK_DEV_CRYPTOLOOP is not set # CONFIG_BLK_DEV_NBD is not set -# CONFIG_BLK_DEV_CARMEL is not set +# CONFIG_BLK_DEV_SX8 is not set # CONFIG_BLK_DEV_RAM is not set # @@ -157,9 +167,9 @@ # # Please see Documentation/ide.txt for help/info on IDE drives # +# CONFIG_BLK_DEV_IDE_SATA is not set CONFIG_BLK_DEV_IDEDISK=y CONFIG_IDEDISK_MULTI_MODE=y -# CONFIG_IDEDISK_STROKE is not set CONFIG_BLK_DEV_IDECD=y # CONFIG_BLK_DEV_IDETAPE is not set # CONFIG_BLK_DEV_IDEFLOPPY is not set @@ -181,7 +191,6 @@ # CONFIG_BLK_DEV_IDEDMA_FORCED is not set CONFIG_IDEDMA_PCI_AUTO=y # CONFIG_IDEDMA_ONLYDISK is not set -CONFIG_BLK_DEV_ADMA=y # CONFIG_BLK_DEV_AEC62XX is not set CONFIG_BLK_DEV_ALI15X3=y # CONFIG_WDC_ALI15X3 is not set @@ -203,6 +212,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_IDE_CHIPSETS is not set CONFIG_BLK_DEV_IDEDMA=y # CONFIG_IDEDMA_IVB is not set @@ -229,7 +239,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 @@ -243,6 +252,7 @@ # SCSI low-level drivers # # CONFIG_BLK_DEV_3W_XXXX_RAID is not set +# CONFIG_SCSI_3W_9XXX is not set # CONFIG_SCSI_7000FASST is not set # CONFIG_SCSI_ACARD is not set # CONFIG_SCSI_AHA1542 is not set @@ -252,18 +262,16 @@ CONFIG_AIC7XXX_CMDS_PER_DEVICE=253 CONFIG_AIC7XXX_RESET_DELAY_MS=5000 # CONFIG_AIC7XXX_PROBE_EISA_VL is not set -# CONFIG_AIC7XXX_BUILD_FIRMWARE is not set # CONFIG_AIC7XXX_DEBUG_ENABLE is not set CONFIG_AIC7XXX_DEBUG_MASK=0 CONFIG_AIC7XXX_REG_PRETTY_PRINT=y # CONFIG_SCSI_AIC7XXX_OLD is not set # CONFIG_SCSI_AIC79XX is not set -# CONFIG_SCSI_ADVANSYS is not set # CONFIG_SCSI_IN2000 is not set -# CONFIG_SCSI_MEGARAID is not set +# CONFIG_MEGARAID_NEWGEN is not set +# CONFIG_MEGARAID_LEGACY is not set # CONFIG_SCSI_SATA is not set # CONFIG_SCSI_BUSLOGIC is not set -# CONFIG_SCSI_CPQFCTS is not set # CONFIG_SCSI_DMX3191D is not set # CONFIG_SCSI_DTC3280 is not set # CONFIG_SCSI_EATA is not set @@ -276,6 +284,7 @@ # CONFIG_SCSI_INIA100 is not set # CONFIG_SCSI_NCR53C406A is not set # CONFIG_SCSI_SYM53C8XX_2 is not set +# CONFIG_SCSI_IPR is not set # CONFIG_SCSI_PAS16 is not set # CONFIG_SCSI_PSI240I is not set # CONFIG_SCSI_QLOGIC_FAS is not set @@ -320,6 +329,7 @@ # # I2O device support # +# CONFIG_I2O is not set # # Networking support @@ -342,19 +352,17 @@ # CONFIG_NET_IPGRE is not set # CONFIG_IP_MROUTE is not set # CONFIG_ARPD is not set -CONFIG_INET_ECN=y # CONFIG_SYN_COOKIES is not set CONFIG_INET_AH=m CONFIG_INET_ESP=m # CONFIG_INET_IPCOMP is not set +# CONFIG_INET_TUNNEL is not set # # IP: Virtual Server Configuration # # 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 @@ -362,6 +370,8 @@ # IP: Netfilter Configuration # CONFIG_IP_NF_CONNTRACK=m +# CONFIG_IP_NF_CT_ACCT is not set +# CONFIG_IP_NF_CT_PROTO_SCTP is not set CONFIG_IP_NF_FTP=m CONFIG_IP_NF_IRC=m # CONFIG_IP_NF_TFTP is not set @@ -386,8 +396,15 @@ # CONFIG_IP_NF_MATCH_STATE is not set # CONFIG_IP_NF_MATCH_CONNTRACK is not set # CONFIG_IP_NF_MATCH_OWNER is not set +# CONFIG_IP_NF_MATCH_ADDRTYPE is not set +# CONFIG_IP_NF_MATCH_REALM is not set +# CONFIG_IP_NF_MATCH_SCTP is not set +# CONFIG_IP_NF_MATCH_COMMENT is not set CONFIG_IP_NF_FILTER=m # CONFIG_IP_NF_TARGET_REJECT is not set +# CONFIG_IP_NF_TARGET_LOG is not set +# CONFIG_IP_NF_TARGET_ULOG is not set +# CONFIG_IP_NF_TARGET_TCPMSS is not set CONFIG_IP_NF_NAT=m CONFIG_IP_NF_NAT_NEEDED=y CONFIG_IP_NF_TARGET_MASQUERADE=m @@ -399,9 +416,7 @@ CONFIG_IP_NF_NAT_IRC=m CONFIG_IP_NF_NAT_FTP=m # CONFIG_IP_NF_MANGLE is not set -# CONFIG_IP_NF_TARGET_LOG is not set -# CONFIG_IP_NF_TARGET_ULOG is not set -# CONFIG_IP_NF_TARGET_TCPMSS is not set +# CONFIG_IP_NF_RAW is not set # CONFIG_IP_NF_ARPTABLES is not set CONFIG_IP_NF_COMPAT_IPCHAINS=y CONFIG_XFRM=y @@ -410,10 +425,11 @@ # # 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=m +# CONFIG_DECNET is not set # CONFIG_LLC2 is not set # CONFIG_IPX is not set # CONFIG_ATALK is not set @@ -428,17 +444,18 @@ # QoS and/or fair queueing # # CONFIG_NET_SCHED is not set +# CONFIG_NET_CLS_ROUTE 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=y - -# -# ARCnet devices -# -# CONFIG_ARCNET is not set CONFIG_DUMMY=m # CONFIG_BONDING is not set # CONFIG_EQUALIZER is not set @@ -447,6 +464,11 @@ # CONFIG_NET_SB1000 is not set # +# ARCnet devices +# +# CONFIG_ARCNET is not set + +# # Ethernet (10 or 100Mbit) # CONFIG_NET_ETHERNET=y @@ -506,6 +528,7 @@ # CONFIG_EPIC100 is not set # CONFIG_SUNDANCE is not set # CONFIG_VIA_RHINE is not set +# CONFIG_VIA_VELOCITY is not set # CONFIG_NET_POCKET is not set # @@ -518,7 +541,6 @@ # CONFIG_HAMACHI is not set CONFIG_YELLOWFIN=y # CONFIG_R8169 is not set -# CONFIG_SIS190 is not set # CONFIG_SK98LIN is not set # CONFIG_TIGON3 is not set @@ -526,45 +548,29 @@ # Ethernet (10000 Mbit) # # CONFIG_IXGB is not set -# CONFIG_FDDI is not set -# CONFIG_HIPPI is not set -# CONFIG_PPP is not set -# CONFIG_SLIP is not set - -# -# Wireless LAN (non-hamradio) -# -# CONFIG_NET_RADIO is not set +# CONFIG_S2IO is not set # # Token Ring devices # # CONFIG_TR is not set -# CONFIG_NET_FC is not set -# CONFIG_SHAPER is not set -# CONFIG_NETCONSOLE is not set - -# -# 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 is not set -# CONFIG_NET_POLL_CONTROLLER is not set +# CONFIG_WAN is not set +# CONFIG_FDDI is not set +# CONFIG_HIPPI is not set +# CONFIG_PPP is not set +# CONFIG_SLIP is not set +# CONFIG_NET_FC is not set +# CONFIG_SHAPER is not set +# CONFIG_NETCONSOLE is not set # # ISDN subsystem @@ -603,6 +609,7 @@ CONFIG_SERIO_SERPORT=y # CONFIG_SERIO_CT82C710 is not set # CONFIG_SERIO_PCIPS2 is not set +# CONFIG_SERIO_RAW is not set # # Input Device Drivers @@ -648,7 +655,6 @@ CONFIG_UNIX98_PTYS=y CONFIG_LEGACY_PTYS=y CONFIG_LEGACY_PTY_COUNT=256 -# CONFIG_QIC02_TAPE is not set # # IPMI @@ -678,6 +684,11 @@ # CONFIG_I2C is not set # +# Dallas's 1-wire bus +# +# CONFIG_W1 is not set + +# # Misc devices # @@ -728,6 +739,7 @@ CONFIG_REISERFS_FS=m # CONFIG_REISERFS_CHECK is not set # CONFIG_REISERFS_PROC_INFO is not set +# CONFIG_REISERFS_FS_XATTR is not set # CONFIG_JFS_FS is not set # CONFIG_XFS_FS is not set # CONFIG_MINIX_FS is not set @@ -750,6 +762,8 @@ CONFIG_FAT_FS=y CONFIG_MSDOS_FS=y CONFIG_VFAT_FS=y +CONFIG_FAT_DEFAULT_CODEPAGE=437 +CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" # CONFIG_NTFS_FS is not set # @@ -757,6 +771,7 @@ # 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 @@ -796,11 +811,11 @@ CONFIG_EXPORTFS=m CONFIG_SUNRPC=m # CONFIG_RPCSEC_GSS_KRB5 is not set +# CONFIG_RPCSEC_GSS_SPKM3 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_INTERMEZZO_FS is not set # CONFIG_AFS_FS is not set # @@ -838,6 +853,7 @@ # CONFIG_NLS_ISO8859_8 is not set # CONFIG_NLS_CODEPAGE_1250 is not set # CONFIG_NLS_CODEPAGE_1251 is not set +# CONFIG_NLS_ASCII is not set # CONFIG_NLS_ISO8859_1 is not set # CONFIG_NLS_ISO8859_2 is not set # CONFIG_NLS_ISO8859_3 is not set @@ -861,15 +877,16 @@ # # Kernel hacking # -CONFIG_ALPHA_LEGACY_START_ADDRESS=y CONFIG_DEBUG_KERNEL=y -CONFIG_MATHEMU=y -# CONFIG_DEBUG_SLAB is not set CONFIG_MAGIC_SYSRQ=y +# CONFIG_DEBUG_SLAB is not set # CONFIG_DEBUG_SPINLOCK is not set +CONFIG_DEBUG_INFO=y +CONFIG_EARLY_PRINTK=y # CONFIG_DEBUG_RWLOCK is not set # CONFIG_DEBUG_SEMAPHORE is not set -CONFIG_DEBUG_INFO=y +CONFIG_ALPHA_LEGACY_START_ADDRESS=y +CONFIG_MATHEMU=y # # Security options @@ -887,6 +904,7 @@ CONFIG_CRYPTO_SHA1=m # CONFIG_CRYPTO_SHA256 is not set # CONFIG_CRYPTO_SHA512 is not set +# CONFIG_CRYPTO_WHIRLPOOL is not set CONFIG_CRYPTO_DES=m # CONFIG_CRYPTO_BLOWFISH is not set # CONFIG_CRYPTO_TWOFISH is not set @@ -894,11 +912,17 @@ # CONFIG_CRYPTO_AES is not set # CONFIG_CRYPTO_CAST5 is not set # CONFIG_CRYPTO_CAST6 is not set +# CONFIG_CRYPTO_TEA is not set # CONFIG_CRYPTO_ARC4 is not set +# CONFIG_CRYPTO_KHAZAD is not set # CONFIG_CRYPTO_DEFLATE is not set +# CONFIG_CRYPTO_MICHAEL_MIC is not set +# CONFIG_CRYPTO_CRC32C is not set # CONFIG_CRYPTO_TEST is not set # # Library routines # +# CONFIG_CRC_CCITT is not set CONFIG_CRC32=y +# CONFIG_LIBCRC32C is not set diff -Nru a/arch/alpha/kernel/Makefile b/arch/alpha/kernel/Makefile --- a/arch/alpha/kernel/Makefile 2004-09-26 10:25:56 -07:00 +++ b/arch/alpha/kernel/Makefile 2004-09-26 10:25:56 -07:00 @@ -8,7 +8,7 @@ obj-y := entry.o traps.o process.o init_task.o osf_sys.o irq.o \ irq_alpha.o signal.o setup.o ptrace.o time.o semaphore.o \ - alpha_ksyms.o systbls.o err_common.o + alpha_ksyms.o systbls.o err_common.o io.o obj-$(CONFIG_VGA_HOSE) += console.o obj-$(CONFIG_SMP) += smp.o diff -Nru a/arch/alpha/kernel/alpha_ksyms.c b/arch/alpha/kernel/alpha_ksyms.c --- a/arch/alpha/kernel/alpha_ksyms.c 2004-09-26 10:25:55 -07:00 +++ b/arch/alpha/kernel/alpha_ksyms.c 2004-09-26 10:25:55 -07:00 @@ -68,36 +68,6 @@ #endif /* CONFIG_ALPHA_GENERIC */ /* platform dependent support */ -EXPORT_SYMBOL(_inb); -EXPORT_SYMBOL(_inw); -EXPORT_SYMBOL(_inl); -EXPORT_SYMBOL(_outb); -EXPORT_SYMBOL(_outw); -EXPORT_SYMBOL(_outl); -EXPORT_SYMBOL(_readb); -EXPORT_SYMBOL(_readw); -EXPORT_SYMBOL(_readl); -EXPORT_SYMBOL(_writeb); -EXPORT_SYMBOL(_writew); -EXPORT_SYMBOL(_writel); -EXPORT_SYMBOL(___raw_readb); -EXPORT_SYMBOL(___raw_readw); -EXPORT_SYMBOL(___raw_readl); -EXPORT_SYMBOL(___raw_readq); -EXPORT_SYMBOL(___raw_writeb); -EXPORT_SYMBOL(___raw_writew); -EXPORT_SYMBOL(___raw_writel); -EXPORT_SYMBOL(___raw_writeq); -EXPORT_SYMBOL(_memcpy_fromio); -EXPORT_SYMBOL(_memcpy_toio); -EXPORT_SYMBOL(_memset_c_io); -EXPORT_SYMBOL(scr_memcpyw); -EXPORT_SYMBOL(insb); -EXPORT_SYMBOL(insw); -EXPORT_SYMBOL(insl); -EXPORT_SYMBOL(outsb); -EXPORT_SYMBOL(outsw); -EXPORT_SYMBOL(outsl); EXPORT_SYMBOL(strcat); EXPORT_SYMBOL(strcmp); EXPORT_SYMBOL(strcpy); diff -Nru a/arch/alpha/kernel/core_cia.c b/arch/alpha/kernel/core_cia.c --- a/arch/alpha/kernel/core_cia.c 2004-09-26 10:25:56 -07:00 +++ b/arch/alpha/kernel/core_cia.c 2004-09-26 10:25:56 -07:00 @@ -282,7 +282,7 @@ cia_pci_tbi_try2(struct pci_controller *hose, dma_addr_t start, dma_addr_t end) { - unsigned long bus_addr; + void __iomem *bus_addr; int ctrl; /* Put the chip into PCI loopback mode. */ @@ -351,7 +351,7 @@ struct pci_iommu_arena *arena = pci_isa_hose->sg_isa; int ctrl, addr0, tag0, pte0, data0; int temp, use_tbia_try2 = 0; - unsigned long bus_addr; + void __iomem *bus_addr; /* pyxis -- tbia is broken */ if (pci_isa_hose->dense_io_base) diff -Nru a/arch/alpha/kernel/core_irongate.c b/arch/alpha/kernel/core_irongate.c --- a/arch/alpha/kernel/core_irongate.c 2004-09-26 10:25:57 -07:00 +++ b/arch/alpha/kernel/core_irongate.c 2004-09-26 10:25:57 -07:00 @@ -310,7 +310,7 @@ #define GET_GATT_OFF(addr) ((addr & 0x003ff000) >> 12) #define GET_GATT(addr) (gatt_pages[GET_PAGE_DIR_IDX(addr)]) -unsigned long +void __iomem * irongate_ioremap(unsigned long addr, unsigned long size) { struct vm_struct *area; @@ -320,7 +320,7 @@ unsigned long gart_bus_addr; if (!alpha_agpgart_size) - return addr + IRONGATE_MEM; + return (void __iomem *)(addr + IRONGATE_MEM); gart_bus_addr = (unsigned long)IRONGATE0->bar0 & PCI_BASE_ADDRESS_MEM_MASK; @@ -339,7 +339,7 @@ /* * Not found - assume legacy ioremap */ - return addr + IRONGATE_MEM; + return (void __iomem *)(addr + IRONGATE_MEM); } while(0); mmio_regs = (u32 *)(((unsigned long)IRONGATE0->bar1 & @@ -353,7 +353,7 @@ if (addr & ~PAGE_MASK) { printk("AGP ioremap failed... addr not page aligned (0x%lx)\n", addr); - return addr + IRONGATE_MEM; + return (void __iomem *)(addr + IRONGATE_MEM); } last = addr + size - 1; size = PAGE_ALIGN(last) - addr; @@ -378,7 +378,7 @@ * Map it */ area = get_vm_area(size, VM_IOREMAP); - if (!area) return (unsigned long)NULL; + if (!area) return NULL; for(baddr = addr, vaddr = (unsigned long)area->addr; baddr <= last; @@ -391,7 +391,7 @@ pte, PAGE_SIZE, 0)) { printk("AGP ioremap: FAILED to map...\n"); vfree(area->addr); - return (unsigned long)NULL; + return NULL; } } @@ -402,13 +402,15 @@ printk("irongate_ioremap(0x%lx, 0x%lx) returning 0x%lx\n", addr, size, vaddr); #endif - return vaddr; + return (void __iomem *)vaddr; } void -irongate_iounmap(unsigned long addr) +irongate_iounmap(volatile void __iomem *xaddr) { + unsigned long addr = (unsigned long) xaddr; if (((long)addr >> 41) == -2) return; /* kseg map, nothing to do */ - if (addr) return vfree((void *)(PAGE_MASK & addr)); + if (addr) + return vfree((void *)(PAGE_MASK & addr)); } diff -Nru a/arch/alpha/kernel/core_marvel.c b/arch/alpha/kernel/core_marvel.c --- a/arch/alpha/kernel/core_marvel.c 2004-09-26 10:25:55 -07:00 +++ b/arch/alpha/kernel/core_marvel.c 2004-09-26 10:25:55 -07:00 @@ -611,10 +611,83 @@ } + +/* + * RTC Support + */ +struct marvel_rtc_access_info { + unsigned long function; + unsigned long index; + unsigned long data; +}; + +static void +__marvel_access_rtc(void *info) +{ + struct marvel_rtc_access_info *rtc_access = info; + + register unsigned long __r0 __asm__("$0"); + register unsigned long __r16 __asm__("$16") = rtc_access->function; + register unsigned long __r17 __asm__("$17") = rtc_access->index; + register unsigned long __r18 __asm__("$18") = rtc_access->data; + + __asm__ __volatile__( + "call_pal %4 # cserve rtc" + : "=r"(__r16), "=r"(__r17), "=r"(__r18), "=r"(__r0) + : "i"(PAL_cserve), "0"(__r16), "1"(__r17), "2"(__r18) + : "$1", "$22", "$23", "$24", "$25"); + + rtc_access->data = __r0; +} + +static u8 +__marvel_rtc_io(u8 b, unsigned long addr, int write) +{ + static u8 index = 0; + + struct marvel_rtc_access_info rtc_access; + u8 ret = 0; + + switch(addr) { + case 0x70: /* RTC_PORT(0) */ + if (write) index = b; + ret = index; + break; + + case 0x71: /* RTC_PORT(1) */ + rtc_access.index = index; + rtc_access.data = BCD_TO_BIN(b); + rtc_access.function = 0x48 + !write; /* GET/PUT_TOY */ + +#ifdef CONFIG_SMP + if (smp_processor_id() != boot_cpuid) + smp_call_function_on_cpu(__marvel_access_rtc, + &rtc_access, 1, 1, + cpumask_of_cpu(boot_cpuid)); + else + __marvel_access_rtc(&rtc_access); +#else + __marvel_access_rtc(&rtc_access); +#endif + ret = BIN_TO_BCD(rtc_access.data); + break; + + default: + printk(KERN_WARNING "Illegal RTC port %lx\n", addr); + break; + } + + return ret; +} + + /* * IO map support. */ -unsigned long + +#define __marvel_is_mem_vga(a) (((a) >= 0xa0000) && ((a) <= 0xc0000)) + +void __iomem * marvel_ioremap(unsigned long addr, unsigned long size) { struct pci_controller *hose; @@ -633,8 +706,6 @@ } #endif - if (!marvel_is_ioaddr(addr)) return 0UL; - /* * Find the hose. */ @@ -643,7 +714,7 @@ break; } if (!hose) - return 0UL; + return NULL; /* * We have the hose - calculate the bus limits. @@ -655,15 +726,17 @@ * Is it direct-mapped? */ if ((baddr >= __direct_map_base) && - ((baddr + size - 1) < __direct_map_base + __direct_map_size)) - return IDENT_ADDR | (baddr - __direct_map_base); + ((baddr + size - 1) < __direct_map_base + __direct_map_size)) { + addr = IDENT_ADDR | (baddr - __direct_map_base); + return (void __iomem *) addr; + } /* * Check the scatter-gather arena. */ if (hose->sg_pci && baddr >= (unsigned long)hose->sg_pci->dma_base && - last < (unsigned long)hose->sg_pci->dma_base + hose->sg_pci->size){ + last < (unsigned long)hose->sg_pci->dma_base + hose->sg_pci->size) { /* * Adjust the limits (mappings must be page aligned) @@ -677,7 +750,9 @@ * Map it. */ area = get_vm_area(size, VM_IOREMAP); - if (!area) return (unsigned long)NULL; + if (!area) + return NULL; + ptes = hose->sg_pci->ptes; for (vaddr = (unsigned long)area->addr; baddr <= last; @@ -686,7 +761,7 @@ if (!(pfn & 1)) { printk("ioremap failed... pte not valid...\n"); vfree(area->addr); - return 0UL; + return NULL; } pfn >>= 1; /* make it a true pfn */ @@ -695,7 +770,7 @@ PAGE_SIZE, 0)) { printk("FAILED to map...\n"); vfree(area->addr); - return 0UL; + return NULL; } } @@ -703,101 +778,81 @@ vaddr = (unsigned long)area->addr + (addr & ~PAGE_MASK); - return vaddr; + return (void __iomem *) vaddr; } - /* - * Not found - assume legacy ioremap. - */ - return addr; + return NULL; } void -marvel_iounmap(unsigned long addr) +marvel_iounmap(volatile void __iomem *xaddr) { - if (((long)addr >> 41) == -2) - return; /* kseg map, nothing to do */ - if (addr) + unsigned long addr = (unsigned long) xaddr; + if (addr >= VMALLOC_START) vfree((void *)(PAGE_MASK & addr)); } -#ifndef CONFIG_ALPHA_GENERIC -EXPORT_SYMBOL(marvel_ioremap); -EXPORT_SYMBOL(marvel_iounmap); -#endif - - -/* - * RTC Support - */ -struct marvel_rtc_access_info { - unsigned long function; - unsigned long index; - unsigned long data; -}; - -static void -__marvel_access_rtc(void *info) +int +marvel_is_mmio(const volatile void __iomem *xaddr) { - struct marvel_rtc_access_info *rtc_access = info; + unsigned long addr = (unsigned long) xaddr; - register unsigned long __r0 __asm__("$0"); - register unsigned long __r16 __asm__("$16") = rtc_access->function; - register unsigned long __r17 __asm__("$17") = rtc_access->index; - register unsigned long __r18 __asm__("$18") = rtc_access->data; - - __asm__ __volatile__( - "call_pal %4 # cserve rtc" - : "=r"(__r16), "=r"(__r17), "=r"(__r18), "=r"(__r0) - : "i"(PAL_cserve), "0"(__r16), "1"(__r17), "2"(__r18) - : "$1", "$22", "$23", "$24", "$25"); - - rtc_access->data = __r0; + if (addr >= VMALLOC_START) + return 1; + else + return (addr & 0xFF000000UL) == 0; } -u8 -__marvel_rtc_io(int write, u8 b, unsigned long addr) -{ - struct marvel_rtc_access_info rtc_access = {0, }; - static u8 index = 0; - u8 ret = 0; +#define __marvel_is_port_vga(a) \ + (((a) >= 0x3b0) && ((a) < 0x3e0) && ((a) != 0x3b3) && ((a) != 0x3d3)) +#define __marvel_is_port_kbd(a) (((a) == 0x60) || ((a) == 0x64)) +#define __marvel_is_port_rtc(a) (((a) == 0x70) || ((a) == 0x71)) - switch(addr) { - case 0x70: /* RTC_PORT(0) */ - if (write) index = b; - ret = index; - break; - - case 0x71: /* RTC_PORT(1) */ - rtc_access.index = index; - rtc_access.data = BCD_TO_BIN(b); - rtc_access.function = 0x49; /* GET_TOY */ - if (write) rtc_access.function = 0x48; /* PUT_TOY */ - -#ifdef CONFIG_SMP - if (smp_processor_id() != boot_cpuid) - smp_call_function_on_cpu(__marvel_access_rtc, - &rtc_access, - 1, /* retry */ - 1, /* wait */ - 1UL << boot_cpuid); - else - __marvel_access_rtc(&rtc_access); -#else - __marvel_access_rtc(&rtc_access); +void __iomem *marvel_ioportmap (unsigned long addr) +{ + if (__marvel_is_port_rtc (addr) || __marvel_is_port_kbd(addr)) + ; +#ifdef CONFIG_VGA_HOSE + else if (__marvel_is_port_vga (addr) && pci_vga_hose) + addr += pci_vga_hose->io_space->start; #endif - ret = BIN_TO_BCD(rtc_access.data); - - break; + else + return NULL; + return (void __iomem *)addr; +} - default: - printk(KERN_WARNING "Illegal RTC port %lx\n", addr); - break; - } +unsigned int +marvel_ioread8(void __iomem *xaddr) +{ + unsigned long addr = (unsigned long) xaddr; + if (__marvel_is_port_kbd(addr)) + return 0; + else if (__marvel_is_port_rtc(addr)) + return __marvel_rtc_io(0, addr, 0); + else + return __kernel_ldbu(*(vucp)addr); +} - return ret; +void +marvel_iowrite8(u8 b, void __iomem *xaddr) +{ + unsigned long addr = (unsigned long) xaddr; + if (__marvel_is_port_kbd(addr)) + return; + else if (__marvel_is_port_rtc(addr)) + __marvel_rtc_io(b, addr, 1); + else + __kernel_stb(b, *(vucp)addr); } +#ifndef CONFIG_ALPHA_GENERIC +EXPORT_SYMBOL(marvel_ioremap); +EXPORT_SYMBOL(marvel_iounmap); +EXPORT_SYMBOL(marvel_is_mmio); +EXPORT_SYMBOL(marvel_ioportmap); +EXPORT_SYMBOL(marvel_ioread8); +EXPORT_SYMBOL(marvel_iowrite8); +#endif /* * NUMA Support diff -Nru a/arch/alpha/kernel/core_titan.c b/arch/alpha/kernel/core_titan.c --- a/arch/alpha/kernel/core_titan.c 2004-09-26 10:25:56 -07:00 +++ b/arch/alpha/kernel/core_titan.c 2004-09-26 10:25:56 -07:00 @@ -461,7 +461,8 @@ /* * IO map support. */ -unsigned long + +void __iomem * titan_ioremap(unsigned long addr, unsigned long size) { int h = (addr & TITAN_HOSE_MASK) >> TITAN_HOSE_SHIFT; @@ -487,15 +488,19 @@ * Find the hose. */ for (hose = hose_head; hose; hose = hose->next) - if (hose->index == h) break; - if (!hose) return (unsigned long)NULL; + if (hose->index == h) + break; + if (!hose) + return NULL; /* * Is it direct-mapped? */ if ((baddr >= __direct_map_base) && - ((baddr + size - 1) < __direct_map_base + __direct_map_size)) - return addr - __direct_map_base + TITAN_MEM_BIAS; + ((baddr + size - 1) < __direct_map_base + __direct_map_size)) { + vaddr = addr - __direct_map_base + TITAN_MEM_BIAS; + return (void __iomem *) vaddr; + } /* * Check the scatter-gather arena. @@ -516,7 +521,9 @@ * Map it */ area = get_vm_area(size, VM_IOREMAP); - if (!area) return (unsigned long)NULL; + if (!area) + return NULL; + ptes = hose->sg_pci->ptes; for (vaddr = (unsigned long)area->addr; baddr <= last; @@ -525,7 +532,7 @@ if (!(pfn & 1)) { printk("ioremap failed... pte not valid...\n"); vfree(area->addr); - return (unsigned long)NULL; + return NULL; } pfn >>= 1; /* make it a true pfn */ @@ -534,35 +541,42 @@ PAGE_SIZE, 0)) { printk("FAILED to map...\n"); vfree(area->addr); - return (unsigned long)NULL; + return NULL; } } flush_tlb_all(); vaddr = (unsigned long)area->addr + (addr & ~PAGE_MASK); - return vaddr; + return (void __iomem *) vaddr; } - /* - * Not found - assume legacy ioremap. - */ - return addr + TITAN_MEM_BIAS; - + return NULL; } void -titan_iounmap(unsigned long addr) +titan_iounmap(volatile void __iomem *xaddr) { - if (((long)addr >> 41) == -2) - return; /* kseg map, nothing to do */ - if (addr) + unsigned long addr = (unsigned long) xaddr; + if (addr >= VMALLOC_START) vfree((void *)(PAGE_MASK & addr)); } +int +titan_is_mmio(const volatile void __iomem *xaddr) +{ + unsigned long addr = (unsigned long) xaddr; + + if (addr >= VMALLOC_START) + return 1; + else + return (addr & 0x100000000UL) == 0; +} + #ifndef CONFIG_ALPHA_GENERIC EXPORT_SYMBOL(titan_ioremap); EXPORT_SYMBOL(titan_iounmap); +EXPORT_SYMBOL(titan_is_mmio); #endif /* diff -Nru a/arch/alpha/kernel/err_titan.c b/arch/alpha/kernel/err_titan.c --- a/arch/alpha/kernel/err_titan.c 2004-09-26 10:25:57 -07:00 +++ b/arch/alpha/kernel/err_titan.c 2004-09-26 10:25:57 -07:00 @@ -177,7 +177,7 @@ #define TITAN__PCHIP_PERROR__CMD__S (52) #define TITAN__PCHIP_PERROR__CMD__M (0x0f) #define TITAN__PCHIP_PERROR__ADDR__S (14) -#define TITAN__PCHIP_PERROR__ADDR__M (0x1ffffffff) +#define TITAN__PCHIP_PERROR__ADDR__M (0x1fffffffful) if (!(perror & TITAN__PCHIP_PERROR__ERRMASK)) return MCHK_DISPOSITION_UNKNOWN_ERROR; diff -Nru a/arch/alpha/kernel/io.c b/arch/alpha/kernel/io.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/alpha/kernel/io.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,630 @@ +/* + * Alpha IO and memory functions. + */ + +#include +#include +#include +#include +#include + +/* Out-of-line versions of the i/o routines that redirect into the + platform-specific version. Note that "platform-specific" may mean + "generic", which bumps through the machine vector. */ + +unsigned int +ioread8(void __iomem *addr) +{ + unsigned int ret = IO_CONCAT(__IO_PREFIX,ioread8)(addr); + mb(); + return ret; +} + +unsigned int ioread16(void __iomem *addr) +{ + unsigned int ret = IO_CONCAT(__IO_PREFIX,ioread16)(addr); + mb(); + return ret; +} + +unsigned int ioread32(void __iomem *addr) +{ + unsigned int ret = IO_CONCAT(__IO_PREFIX,ioread32)(addr); + mb(); + return ret; +} + +void iowrite8(u8 b, void __iomem *addr) +{ + IO_CONCAT(__IO_PREFIX,iowrite8)(b, addr); + mb(); +} + +void iowrite16(u16 b, void __iomem *addr) +{ + IO_CONCAT(__IO_PREFIX,iowrite16)(b, addr); + mb(); +} + +void iowrite32(u32 b, void __iomem *addr) +{ + IO_CONCAT(__IO_PREFIX,iowrite32)(b, addr); + mb(); +} + +EXPORT_SYMBOL(ioread8); +EXPORT_SYMBOL(ioread16); +EXPORT_SYMBOL(ioread32); +EXPORT_SYMBOL(iowrite8); +EXPORT_SYMBOL(iowrite16); +EXPORT_SYMBOL(iowrite32); + +u8 inb(unsigned long port) +{ + return ioread8(ioport_map(port, 1)); +} + +u16 inw(unsigned long port) +{ + return ioread16(ioport_map(port, 2)); +} + +u32 inl(unsigned long port) +{ + return ioread32(ioport_map(port, 4)); +} + +void outb(u8 b, unsigned long port) +{ + iowrite8(b, ioport_map(port, 1)); +} + +void outw(u16 b, unsigned long port) +{ + iowrite16(b, ioport_map(port, 2)); +} + +void outl(u32 b, unsigned long port) +{ + iowrite32(b, ioport_map(port, 4)); +} + +EXPORT_SYMBOL(inb); +EXPORT_SYMBOL(inw); +EXPORT_SYMBOL(inl); +EXPORT_SYMBOL(outb); +EXPORT_SYMBOL(outw); +EXPORT_SYMBOL(outl); + +u8 __raw_readb(const volatile void __iomem *addr) +{ + return IO_CONCAT(__IO_PREFIX,readb)(addr); +} + +u16 __raw_readw(const volatile void __iomem *addr) +{ + return IO_CONCAT(__IO_PREFIX,readw)(addr); +} + +u32 __raw_readl(const volatile void __iomem *addr) +{ + return IO_CONCAT(__IO_PREFIX,readl)(addr); +} + +u64 __raw_readq(const volatile void __iomem *addr) +{ + return IO_CONCAT(__IO_PREFIX,readq)(addr); +} + +void __raw_writeb(u8 b, volatile void __iomem *addr) +{ + IO_CONCAT(__IO_PREFIX,writeb)(b, addr); +} + +void __raw_writew(u16 b, volatile void __iomem *addr) +{ + IO_CONCAT(__IO_PREFIX,writew)(b, addr); +} + +void __raw_writel(u32 b, volatile void __iomem *addr) +{ + IO_CONCAT(__IO_PREFIX,writel)(b, addr); +} + +void __raw_writeq(u64 b, volatile void __iomem *addr) +{ + IO_CONCAT(__IO_PREFIX,writeq)(b, addr); +} + +EXPORT_SYMBOL(__raw_readb); +EXPORT_SYMBOL(__raw_readw); +EXPORT_SYMBOL(__raw_readl); +EXPORT_SYMBOL(__raw_readq); +EXPORT_SYMBOL(__raw_writeb); +EXPORT_SYMBOL(__raw_writew); +EXPORT_SYMBOL(__raw_writel); +EXPORT_SYMBOL(__raw_writeq); + +u8 readb(const volatile void __iomem *addr) +{ + u8 ret = __raw_readb(addr); + mb(); + return ret; +} + +u16 readw(const volatile void __iomem *addr) +{ + u16 ret = __raw_readw(addr); + mb(); + return ret; +} + +u32 readl(const volatile void __iomem *addr) +{ + u32 ret = __raw_readl(addr); + mb(); + return ret; +} + +u64 readq(const volatile void __iomem *addr) +{ + u64 ret = __raw_readq(addr); + mb(); + return ret; +} + +void writeb(u8 b, volatile void __iomem *addr) +{ + __raw_writeb(b, addr); + mb(); +} + +void writew(u16 b, volatile void __iomem *addr) +{ + __raw_writew(b, addr); + mb(); +} + +void writel(u32 b, volatile void __iomem *addr) +{ + __raw_writel(b, addr); + mb(); +} + +void writeq(u64 b, volatile void __iomem *addr) +{ + __raw_writeq(b, addr); + mb(); +} + +EXPORT_SYMBOL(readb); +EXPORT_SYMBOL(readw); +EXPORT_SYMBOL(readl); +EXPORT_SYMBOL(readq); +EXPORT_SYMBOL(writeb); +EXPORT_SYMBOL(writew); +EXPORT_SYMBOL(writel); +EXPORT_SYMBOL(writeq); + + +/* + * Read COUNT 8-bit bytes from port PORT into memory starting at SRC. + */ +void ioread8_rep(void __iomem *port, void *dst, unsigned long count) +{ + while ((unsigned long)dst & 0x3) { + if (!count) + return; + count--; + *(unsigned char *)dst = ioread8(port); + dst += 1; + } + + while (count >= 4) { + unsigned int w; + count -= 4; + w = ioread8(port); + w |= ioread8(port) << 8; + w |= ioread8(port) << 16; + w |= ioread8(port) << 24; + *(unsigned int *)dst = w; + dst += 4; + } + + while (count) { + --count; + *(unsigned char *)dst = ioread8(port); + dst += 1; + } +} + +void insb(unsigned long port, void *dst, unsigned long count) +{ + ioread8_rep(ioport_map(port, 1), dst, count); +} + +EXPORT_SYMBOL(ioread8_rep); +EXPORT_SYMBOL(insb); + +/* + * Read COUNT 16-bit words from port PORT into memory starting at + * SRC. SRC must be at least short aligned. This is used by the + * IDE driver to read disk sectors. Performance is important, but + * the interfaces seems to be slow: just using the inlined version + * of the inw() breaks things. + */ +void ioread16_rep(void __iomem *port, void *dst, unsigned long count) +{ + if (unlikely((unsigned long)dst & 0x3)) { + if (!count) + return; + BUG_ON((unsigned long)dst & 0x1); + count--; + *(unsigned short *)dst = ioread16(port); + dst += 2; + } + + while (count >= 2) { + unsigned int w; + count -= 2; + w = ioread16(port); + w |= ioread16(port) << 16; + *(unsigned int *)dst = w; + dst += 4; + } + + if (count) { + *(unsigned short*)dst = ioread16(port); + } +} + +void insw(unsigned long port, void *dst, unsigned long count) +{ + ioread16_rep(ioport_map(port, 2), dst, count); +} + +EXPORT_SYMBOL(ioread16_rep); +EXPORT_SYMBOL(insw); + + +/* + * Read COUNT 32-bit words from port PORT into memory starting at + * SRC. Now works with any alignment in SRC. Performance is important, + * but the interfaces seems to be slow: just using the inlined version + * of the inl() breaks things. + */ +void ioread32_rep(void __iomem *port, void *dst, unsigned long count) +{ + if (unlikely((unsigned long)dst & 0x3)) { + while (count--) { + struct S { int x __attribute__((packed)); }; + ((struct S *)dst)->x = ioread32(port); + dst += 4; + } + } else { + /* Buffer 32-bit aligned. */ + while (count--) { + *(unsigned int *)dst = ioread32(port); + dst += 4; + } + } +} + +void insl(unsigned long port, void *dst, unsigned long count) +{ + ioread32_rep(ioport_map(port, 4), dst, count); +} + +EXPORT_SYMBOL(ioread32_rep); +EXPORT_SYMBOL(insl); + + +/* + * Like insb but in the opposite direction. + * Don't worry as much about doing aligned memory transfers: + * doing byte reads the "slow" way isn't nearly as slow as + * doing byte writes the slow way (no r-m-w cycle). + */ +void iowrite8_rep(void __iomem *port, const void *xsrc, unsigned long count) +{ + const unsigned char *src = xsrc; + while (count--) + iowrite8(*src++, port); +} + +void outsb(unsigned long port, const void *src, unsigned long count) +{ + iowrite8_rep(ioport_map(port, 1), src, count); +} + +EXPORT_SYMBOL(iowrite8_rep); +EXPORT_SYMBOL(outsb); + + +/* + * Like insw but in the opposite direction. This is used by the IDE + * driver to write disk sectors. Performance is important, but the + * interfaces seems to be slow: just using the inlined version of the + * outw() breaks things. + */ +void iowrite16_rep(void __iomem *port, const void *src, unsigned long count) +{ + if (unlikely((unsigned long)src & 0x3)) { + if (!count) + return; + BUG_ON((unsigned long)src & 0x1); + iowrite16(*(unsigned short *)src, port); + src += 2; + --count; + } + + while (count >= 2) { + unsigned int w; + count -= 2; + w = *(unsigned int *)src; + src += 4; + iowrite16(w >> 0, port); + iowrite16(w >> 16, port); + } + + if (count) { + iowrite16(*(unsigned short *)src, port); + } +} + +void outsw(unsigned long port, const void *src, unsigned long count) +{ + iowrite16_rep(ioport_map(port, 2), src, count); +} + +EXPORT_SYMBOL(iowrite16_rep); +EXPORT_SYMBOL(outsw); + + +/* + * Like insl but in the opposite direction. This is used by the IDE + * driver to write disk sectors. Works with any alignment in SRC. + * Performance is important, but the interfaces seems to be slow: + * just using the inlined version of the outl() breaks things. + */ +void iowrite32_rep(void __iomem *port, const void *src, unsigned long count) +{ + if (unlikely((unsigned long)src & 0x3)) { + while (count--) { + struct S { int x __attribute__((packed)); }; + iowrite32(((struct S *)src)->x, port); + src += 4; + } + } else { + /* Buffer 32-bit aligned. */ + while (count--) { + iowrite32(*(unsigned int *)src, port); + src += 4; + } + } +} + +void outsl(unsigned long port, const void *src, unsigned long count) +{ + iowrite32_rep(ioport_map(port, 4), src, count); +} + +EXPORT_SYMBOL(iowrite32_rep); +EXPORT_SYMBOL(outsl); + + +/* + * Copy data from IO memory space to "real" memory space. + * This needs to be optimized. + */ +void memcpy_fromio(void *to, const volatile void __iomem *from, long count) +{ + /* Optimize co-aligned transfers. Everything else gets handled + a byte at a time. */ + + if (count >= 8 && ((u64)to & 7) == ((u64)from & 7)) { + count -= 8; + do { + *(u64 *)to = __raw_readq(from); + count -= 8; + to += 8; + from += 8; + } while (count >= 0); + count += 8; + } + + if (count >= 4 && ((u64)to & 3) == ((u64)from & 3)) { + count -= 4; + do { + *(u32 *)to = __raw_readl(from); + count -= 4; + to += 4; + from += 4; + } while (count >= 0); + count += 4; + } + + if (count >= 2 && ((u64)to & 1) == ((u64)from & 1)) { + count -= 2; + do { + *(u16 *)to = __raw_readw(from); + count -= 2; + to += 2; + from += 2; + } while (count >= 0); + count += 2; + } + + while (count > 0) { + *(u8 *) to = __raw_readb(from); + count--; + to++; + from++; + } + mb(); +} + +EXPORT_SYMBOL(memcpy_fromio); + + +/* + * Copy data from "real" memory space to IO memory space. + * This needs to be optimized. + */ +void memcpy_toio(volatile void __iomem *to, const void *from, long count) +{ + /* Optimize co-aligned transfers. Everything else gets handled + a byte at a time. */ + /* FIXME -- align FROM. */ + + if (count >= 8 && ((u64)to & 7) == ((u64)from & 7)) { + count -= 8; + do { + __raw_writeq(*(const u64 *)from, to); + count -= 8; + to += 8; + from += 8; + } while (count >= 0); + count += 8; + } + + if (count >= 4 && ((u64)to & 3) == ((u64)from & 3)) { + count -= 4; + do { + __raw_writel(*(const u32 *)from, to); + count -= 4; + to += 4; + from += 4; + } while (count >= 0); + count += 4; + } + + if (count >= 2 && ((u64)to & 1) == ((u64)from & 1)) { + count -= 2; + do { + __raw_writew(*(const u16 *)from, to); + count -= 2; + to += 2; + from += 2; + } while (count >= 0); + count += 2; + } + + while (count > 0) { + __raw_writeb(*(const u8 *) from, to); + count--; + to++; + from++; + } + mb(); +} + +EXPORT_SYMBOL(memcpy_toio); + + +/* + * "memset" on IO memory space. + */ +void _memset_c_io(volatile void __iomem *to, unsigned long c, long count) +{ + /* Handle any initial odd byte */ + if (count > 0 && ((u64)to & 1)) { + __raw_writeb(c, to); + to++; + count--; + } + + /* Handle any initial odd halfword */ + if (count >= 2 && ((u64)to & 2)) { + __raw_writew(c, to); + to += 2; + count -= 2; + } + + /* Handle any initial odd word */ + if (count >= 4 && ((u64)to & 4)) { + __raw_writel(c, to); + to += 4; + count -= 4; + } + + /* Handle all full-sized quadwords: we're aligned + (or have a small count) */ + count -= 8; + if (count >= 0) { + do { + __raw_writeq(c, to); + to += 8; + count -= 8; + } while (count >= 0); + } + count += 8; + + /* The tail is word-aligned if we still have count >= 4 */ + if (count >= 4) { + __raw_writel(c, to); + to += 4; + count -= 4; + } + + /* The tail is half-word aligned if we have count >= 2 */ + if (count >= 2) { + __raw_writew(c, to); + to += 2; + count -= 2; + } + + /* And finally, one last byte.. */ + if (count) { + __raw_writeb(c, to); + } + mb(); +} + +EXPORT_SYMBOL(_memset_c_io); + +/* A version of memcpy used by the vga console routines to move data around + arbitrarily between screen and main memory. */ + +void +scr_memcpyw(u16 *d, const u16 *s, unsigned int count) +{ + const u16 __iomem *ios = (const u16 __iomem *) s; + u16 __iomem *iod = (u16 __iomem *) d; + int s_isio = __is_ioaddr(s); + int d_isio = __is_ioaddr(d); + + if (s_isio) { + if (d_isio) { + /* FIXME: Should handle unaligned ops and + operation widening. */ + + count /= 2; + while (count--) { + u16 tmp = __raw_readw(ios++); + __raw_writew(tmp, iod++); + } + } + else + memcpy_fromio(d, ios, count); + } else { + if (d_isio) + memcpy_toio(iod, s, count); + else + memcpy(d, s, count); + } +} + +EXPORT_SYMBOL(scr_memcpyw); + +void __iomem *ioport_map(unsigned long port, unsigned int size) +{ + return IO_CONCAT(__IO_PREFIX,ioportmap) (port); +} + +void ioport_unmap(void __iomem *addr) +{ +} + +EXPORT_SYMBOL(ioport_map); +EXPORT_SYMBOL(ioport_unmap); diff -Nru a/arch/alpha/kernel/machvec_impl.h b/arch/alpha/kernel/machvec_impl.h --- a/arch/alpha/kernel/machvec_impl.h 2004-09-26 10:25:58 -07:00 +++ b/arch/alpha/kernel/machvec_impl.h 2004-09-26 10:25:58 -07:00 @@ -44,56 +44,60 @@ #define DO_DEFAULT_RTC rtc_port: 0x70 #define DO_EV4_MMU \ - max_asn: EV4_MAX_ASN, \ - mv_switch_mm: ev4_switch_mm, \ - mv_activate_mm: ev4_activate_mm, \ - mv_flush_tlb_current: ev4_flush_tlb_current, \ - mv_flush_tlb_current_page: ev4_flush_tlb_current_page + .max_asn = EV4_MAX_ASN, \ + .mv_switch_mm = ev4_switch_mm, \ + .mv_activate_mm = ev4_activate_mm, \ + .mv_flush_tlb_current = ev4_flush_tlb_current, \ + .mv_flush_tlb_current_page = ev4_flush_tlb_current_page #define DO_EV5_MMU \ - max_asn: EV5_MAX_ASN, \ - mv_switch_mm: ev5_switch_mm, \ - mv_activate_mm: ev5_activate_mm, \ - mv_flush_tlb_current: ev5_flush_tlb_current, \ - mv_flush_tlb_current_page: ev5_flush_tlb_current_page + .max_asn = EV5_MAX_ASN, \ + .mv_switch_mm = ev5_switch_mm, \ + .mv_activate_mm = ev5_activate_mm, \ + .mv_flush_tlb_current = ev5_flush_tlb_current, \ + .mv_flush_tlb_current_page = ev5_flush_tlb_current_page #define DO_EV6_MMU \ - max_asn: EV6_MAX_ASN, \ - mv_switch_mm: ev5_switch_mm, \ - mv_activate_mm: ev5_activate_mm, \ - mv_flush_tlb_current: ev5_flush_tlb_current, \ - mv_flush_tlb_current_page: ev5_flush_tlb_current_page + .max_asn = EV6_MAX_ASN, \ + .mv_switch_mm = ev5_switch_mm, \ + .mv_activate_mm = ev5_activate_mm, \ + .mv_flush_tlb_current = ev5_flush_tlb_current, \ + .mv_flush_tlb_current_page = ev5_flush_tlb_current_page #define DO_EV7_MMU \ - max_asn: EV6_MAX_ASN, \ - mv_switch_mm: ev5_switch_mm, \ - mv_activate_mm: ev5_activate_mm, \ - mv_flush_tlb_current: ev5_flush_tlb_current, \ - mv_flush_tlb_current_page: ev5_flush_tlb_current_page + .max_asn = EV6_MAX_ASN, \ + .mv_switch_mm = ev5_switch_mm, \ + .mv_activate_mm = ev5_activate_mm, \ + .mv_flush_tlb_current = ev5_flush_tlb_current, \ + .mv_flush_tlb_current_page = ev5_flush_tlb_current_page #define IO_LITE(UP,low) \ - hae_register: (unsigned long *) CAT(UP,_HAE_ADDRESS), \ - iack_sc: CAT(UP,_IACK_SC), \ - mv_inb: CAT(low,_inb), \ - mv_inw: CAT(low,_inw), \ - mv_inl: CAT(low,_inl), \ - mv_outb: CAT(low,_outb), \ - mv_outw: CAT(low,_outw), \ - mv_outl: CAT(low,_outl), \ - mv_readb: CAT(low,_readb), \ - mv_readw: CAT(low,_readw), \ - mv_readl: CAT(low,_readl), \ - mv_readq: CAT(low,_readq), \ - mv_writeb: CAT(low,_writeb), \ - mv_writew: CAT(low,_writew), \ - mv_writel: CAT(low,_writel), \ - mv_writeq: CAT(low,_writeq), \ - mv_ioremap: CAT(low,_ioremap), \ - mv_iounmap: CAT(low,_iounmap) \ + .hae_register = (unsigned long *) CAT(UP,_HAE_ADDRESS), \ + .iack_sc = CAT(UP,_IACK_SC), \ + .mv_ioread8 = CAT(low,_ioread8), \ + .mv_ioread16 = CAT(low,_ioread16), \ + .mv_ioread32 = CAT(low,_ioread32), \ + .mv_iowrite8 = CAT(low,_iowrite8), \ + .mv_iowrite16 = CAT(low,_iowrite16), \ + .mv_iowrite32 = CAT(low,_iowrite32), \ + .mv_readb = CAT(low,_readb), \ + .mv_readw = CAT(low,_readw), \ + .mv_readl = CAT(low,_readl), \ + .mv_readq = CAT(low,_readq), \ + .mv_writeb = CAT(low,_writeb), \ + .mv_writew = CAT(low,_writew), \ + .mv_writel = CAT(low,_writel), \ + .mv_writeq = CAT(low,_writeq), \ + .mv_ioportmap = CAT(low,_ioportmap), \ + .mv_ioremap = CAT(low,_ioremap), \ + .mv_iounmap = CAT(low,_iounmap), \ + .mv_is_ioaddr = CAT(low,_is_ioaddr), \ + .mv_is_mmio = CAT(low,_is_mmio) \ #define IO(UP,low) \ IO_LITE(UP,low), \ - pci_ops: &CAT(low,_pci_ops) + .pci_ops = &CAT(low,_pci_ops), \ + .mv_pci_tbi = CAT(low,_pci_tbi) #define DO_APECS_IO IO(APECS,apecs) #define DO_CIA_IO IO(CIA,cia) @@ -108,23 +112,8 @@ #define DO_WILDFIRE_IO IO(WILDFIRE,wildfire) #define DO_PYXIS_IO IO_LITE(CIA,cia_bwx), \ - pci_ops: &CAT(cia,_pci_ops) - -#define BUS(which) \ - mv_is_ioaddr: CAT(which,_is_ioaddr), \ - mv_pci_tbi: CAT(which,_pci_tbi) - -#define DO_APECS_BUS BUS(apecs) -#define DO_CIA_BUS BUS(cia) -#define DO_IRONGATE_BUS BUS(irongate) -#define DO_LCA_BUS BUS(lca) -#define DO_MARVEL_BUS BUS(marvel) -#define DO_MCPCIA_BUS BUS(mcpcia) -#define DO_POLARIS_BUS BUS(polaris) -#define DO_T2_BUS BUS(t2) -#define DO_TSUNAMI_BUS BUS(tsunami) -#define DO_TITAN_BUS BUS(titan) -#define DO_WILDFIRE_BUS BUS(wildfire) + .pci_ops = &cia_pci_ops, \ + .mv_pci_tbi = cia_pci_tbi /* * In a GENERIC kernel, we have lots of these vectors floating about, diff -Nru a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c --- a/arch/alpha/kernel/osf_sys.c 2004-09-26 10:25:55 -07:00 +++ b/arch/alpha/kernel/osf_sys.c 2004-09-26 10:25:55 -07:00 @@ -91,8 +91,8 @@ * 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 __user *) (de))) -#define ROUND_UP(x) (((x)+3) & ~3) +#define NAME_OFFSET offsetof (struct osf_dirent, d_name) +#define ROUND_UP(x) (((x)+3) & ~3) struct osf_dirent { unsigned int d_ino; @@ -114,7 +114,7 @@ { 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); + unsigned int reclen = ROUND_UP(NAME_OFFSET + namlen + 1); buf->error = -EINVAL; /* only used if we fail */ if (reclen > buf->count) @@ -989,7 +989,7 @@ fd_set_bits fds; char *bits; size_t size; - unsigned long timeout; + long timeout; int ret; timeout = MAX_SCHEDULE_TIMEOUT; @@ -1053,9 +1053,10 @@ ret = 0; } - set_fd_set(n, inp->fds_bits, fds.res_in); - set_fd_set(n, outp->fds_bits, fds.res_out); - set_fd_set(n, exp->fds_bits, fds.res_ex); + if (set_fd_set(n, inp->fds_bits, fds.res_in) || + set_fd_set(n, outp->fds_bits, fds.res_out) || + set_fd_set(n, exp->fds_bits, fds.res_ex)) + ret = -EFAULT; out: kfree(bits); @@ -1109,46 +1110,47 @@ return copy_to_user(ru, &r, sizeof(r)) ? -EFAULT : 0; } -asmlinkage int -osf_wait4(pid_t pid, int __user *ustatus, int options, struct rusage32 __user *ur) +asmlinkage long +osf_wait4(pid_t pid, int __user *ustatus, int options, + struct rusage32 __user *ur) { - if (!ur) { + struct rusage r; + long ret, err; + mm_segment_t old_fs; + + if (!ur) return sys_wait4(pid, ustatus, options, NULL); - } else { - struct rusage r; - int ret, status; - mm_segment_t old_fs = get_fs(); + + old_fs = get_fs(); - set_fs (KERNEL_DS); - ret = sys_wait4(pid, &status, options, &r); - set_fs (old_fs); + set_fs (KERNEL_DS); + ret = sys_wait4(pid, ustatus, options, (struct rusage __user *) &r); + set_fs (old_fs); - if (!access_ok(VERIFY_WRITE, ur, sizeof(*ur))) - return -EFAULT; - __put_user(r.ru_utime.tv_sec, &ur->ru_utime.tv_sec); - __put_user(r.ru_utime.tv_usec, &ur->ru_utime.tv_usec); - __put_user(r.ru_stime.tv_sec, &ur->ru_stime.tv_sec); - __put_user(r.ru_stime.tv_usec, &ur->ru_stime.tv_usec); - __put_user(r.ru_maxrss, &ur->ru_maxrss); - __put_user(r.ru_ixrss, &ur->ru_ixrss); - __put_user(r.ru_idrss, &ur->ru_idrss); - __put_user(r.ru_isrss, &ur->ru_isrss); - __put_user(r.ru_minflt, &ur->ru_minflt); - __put_user(r.ru_majflt, &ur->ru_majflt); - __put_user(r.ru_nswap, &ur->ru_nswap); - __put_user(r.ru_inblock, &ur->ru_inblock); - __put_user(r.ru_oublock, &ur->ru_oublock); - __put_user(r.ru_msgsnd, &ur->ru_msgsnd); - __put_user(r.ru_msgrcv, &ur->ru_msgrcv); - __put_user(r.ru_nsignals, &ur->ru_nsignals); - __put_user(r.ru_nvcsw, &ur->ru_nvcsw); - if (__put_user(r.ru_nivcsw, &ur->ru_nivcsw)) - return -EFAULT; + if (!access_ok(VERIFY_WRITE, ur, sizeof(*ur))) + return -EFAULT; - if (ustatus && put_user(status, ustatus)) - return -EFAULT; - return ret; - } + err = 0; + err |= __put_user(r.ru_utime.tv_sec, &ur->ru_utime.tv_sec); + err |= __put_user(r.ru_utime.tv_usec, &ur->ru_utime.tv_usec); + err |= __put_user(r.ru_stime.tv_sec, &ur->ru_stime.tv_sec); + err |= __put_user(r.ru_stime.tv_usec, &ur->ru_stime.tv_usec); + err |= __put_user(r.ru_maxrss, &ur->ru_maxrss); + err |= __put_user(r.ru_ixrss, &ur->ru_ixrss); + err |= __put_user(r.ru_idrss, &ur->ru_idrss); + err |= __put_user(r.ru_isrss, &ur->ru_isrss); + err |= __put_user(r.ru_minflt, &ur->ru_minflt); + err |= __put_user(r.ru_majflt, &ur->ru_majflt); + err |= __put_user(r.ru_nswap, &ur->ru_nswap); + err |= __put_user(r.ru_inblock, &ur->ru_inblock); + err |= __put_user(r.ru_oublock, &ur->ru_oublock); + err |= __put_user(r.ru_msgsnd, &ur->ru_msgsnd); + err |= __put_user(r.ru_msgrcv, &ur->ru_msgrcv); + err |= __put_user(r.ru_nsignals, &ur->ru_nsignals); + err |= __put_user(r.ru_nvcsw, &ur->ru_nvcsw); + err |= __put_user(r.ru_nivcsw, &ur->ru_nivcsw); + + return err ? err : ret; } /* diff -Nru a/arch/alpha/kernel/pci-noop.c b/arch/alpha/kernel/pci-noop.c --- a/arch/alpha/kernel/pci-noop.c 2004-09-26 10:25:56 -07:00 +++ b/arch/alpha/kernel/pci-noop.c 2004-09-26 10:25:56 -07:00 @@ -200,3 +200,15 @@ return 0; } + +void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) +{ + return NULL; +} + +void pci_iounmap(struct pci_dev *dev, void __iomem * addr) +{ +} + +EXPORT_SYMBOL(pci_iomap); +EXPORT_SYMBOL(pci_iounmap); diff -Nru a/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c --- a/arch/alpha/kernel/pci.c 2004-09-26 10:25:55 -07:00 +++ b/arch/alpha/kernel/pci.c 2004-09-26 10:25:55 -07:00 @@ -531,3 +531,37 @@ return -EOPNOTSUPP; } + +/* Create an __iomem token from a PCI BAR. Copied from lib/iomap.c with + no changes, since we don't want the other things in that object file. */ + +void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) +{ + unsigned long start = pci_resource_start(dev, bar); + unsigned long len = pci_resource_len(dev, bar); + unsigned long flags = pci_resource_flags(dev, bar); + + if (!len || !start) + return NULL; + if (maxlen && len > maxlen) + len = maxlen; + if (flags & IORESOURCE_IO) + return ioport_map(start, len); + if (flags & IORESOURCE_MEM) { + /* Not checking IORESOURCE_CACHEABLE because alpha does + not distinguish between ioremap and ioremap_nocache. */ + return ioremap(start, len); + } + return NULL; +} + +/* Destroy that token. Not copied from lib/iomap.c. */ + +void pci_iounmap(struct pci_dev *dev, void __iomem * addr) +{ + if (__is_mmio(addr)) + iounmap(addr); +} + +EXPORT_SYMBOL(pci_iomap); +EXPORT_SYMBOL(pci_iounmap); diff -Nru a/arch/alpha/kernel/ptrace.c b/arch/alpha/kernel/ptrace.c --- a/arch/alpha/kernel/ptrace.c 2004-09-26 10:25:57 -07:00 +++ b/arch/alpha/kernel/ptrace.c 2004-09-26 10:25:57 -07:00 @@ -91,15 +91,15 @@ PT_REG( pc) }; -static long zero; +static unsigned long zero; /* * Get address of register REGNO in task TASK. */ -static long * +static unsigned long * get_reg_addr(struct task_struct * task, unsigned long regno) { - long *addr; + unsigned long *addr; if (regno == 30) { addr = &task->thread_info->pcb.usp; @@ -109,7 +109,7 @@ zero = 0; addr = &zero; } else { - addr = (long *)((long)task->thread_info + regoff[regno]); + addr = (void *)task->thread_info + regoff[regno]; } return addr; } @@ -117,7 +117,7 @@ /* * Get contents of register REGNO in task TASK. */ -static long +static unsigned long get_reg(struct task_struct * task, unsigned long regno) { /* Special hack for fpcr -- combine hardware and software bits. */ @@ -135,7 +135,7 @@ * Write contents of register REGNO in task TASK. */ static int -put_reg(struct task_struct *task, unsigned long regno, long data) +put_reg(struct task_struct *task, unsigned long regno, unsigned long data) { if (regno == 63) { task->thread_info->ieee_state @@ -168,11 +168,11 @@ ptrace_set_bpt(struct task_struct * child) { int displ, i, res, reg_b, nsaved = 0; - u32 insn, op_code; + unsigned int insn, op_code; unsigned long pc; pc = get_reg(child, REG_PC); - res = read_int(child, pc, &insn); + res = read_int(child, pc, (int *) &insn); if (res < 0) return res; @@ -203,7 +203,8 @@ /* install breakpoints: */ for (i = 0; i < nsaved; ++i) { - res = read_int(child, child->thread_info->bpt_addr[i], &insn); + res = read_int(child, child->thread_info->bpt_addr[i], + (int *) &insn); if (res < 0) return res; child->thread_info->bpt_insn[i] = insn; diff -Nru a/arch/alpha/kernel/signal.c b/arch/alpha/kernel/signal.c --- a/arch/alpha/kernel/signal.c 2004-09-26 10:25:56 -07:00 +++ b/arch/alpha/kernel/signal.c 2004-09-26 10:25:56 -07:00 @@ -145,7 +145,7 @@ * Atomically swap in the new signal mask, and wait for a signal. */ asmlinkage int -do_sigsuspend(old_sigset_t mask, struct pt_regs *reg, struct switch_stack *sw) +do_sigsuspend(old_sigset_t mask, struct pt_regs *regs, struct switch_stack *sw) { sigset_t oldset; @@ -156,17 +156,22 @@ recalc_sigpending(); spin_unlock_irq(¤t->sighand->siglock); + /* Indicate EINTR on return from any possible signal handler, + which will not come back through here, but via sigreturn. */ + regs->r0 = EINTR; + regs->r19 = 1; + while (1) { current->state = TASK_INTERRUPTIBLE; schedule(); - if (do_signal(&oldset, reg, sw, 0, 0)) + if (do_signal(&oldset, regs, sw, 0, 0)) return -EINTR; } } asmlinkage int do_rt_sigsuspend(sigset_t __user *uset, size_t sigsetsize, - struct pt_regs *reg, struct switch_stack *sw) + struct pt_regs *regs, struct switch_stack *sw) { sigset_t oldset, set; @@ -183,10 +188,15 @@ recalc_sigpending(); spin_unlock_irq(¤t->sighand->siglock); + /* Indicate EINTR on return from any possible signal handler, + which will not come back through here, but via sigreturn. */ + regs->r0 = EINTR; + regs->r19 = 1; + while (1) { current->state = TASK_INTERRUPTIBLE; schedule(); - if (do_signal(&oldset, reg, sw, 0, 0)) + if (do_signal(&oldset, regs, sw, 0, 0)) return -EINTR; } } @@ -217,6 +227,12 @@ struct ucontext uc; unsigned int retcode[3]; }; + +/* If this changes, userland unwinders that Know Things about our signal + frame will break. Do not undertake lightly. It also implies an ABI + change wrt the size of siginfo_t, which may cause some pain. */ +extern char compile_time_assert + [offsetof(struct rt_sigframe, uc.uc_mcontext) == 176 ? 1 : -1]; #define INSN_MOV_R30_R16 0x47fe0410 #define INSN_LDI_R0 0x201f0000 diff -Nru a/arch/alpha/kernel/srmcons.c b/arch/alpha/kernel/srmcons.c --- a/arch/alpha/kernel/srmcons.c 2004-09-26 10:25:57 -07:00 +++ b/arch/alpha/kernel/srmcons.c 2004-09-26 10:25:57 -07:00 @@ -91,15 +91,15 @@ /* called with callback_lock held */ static int -srmcons_do_write(struct tty_struct *tty, const unsigned char *buf, int count) +srmcons_do_write(struct tty_struct *tty, const char *buf, int count) { - unsigned char *str_cr = "\r"; + static char str_cr[1] = "\r"; long c, remaining = count; srmcons_result result; - unsigned char *cur; + char *cur; int need_cr; - for (cur = (unsigned char *)buf; remaining > 0; ) { + for (cur = (char *)buf; remaining > 0; ) { need_cr = 0; /* * Break it up into reasonable size chunks to allow a chance @@ -138,7 +138,7 @@ unsigned long flags; if (from_user) { - unsigned char tmp[512]; + char tmp[512]; int ret = 0; size_t c; @@ -146,7 +146,7 @@ if (c > sizeof(tmp)) c = sizeof(tmp); - c -= copy_from_user(tmp, buf, c); + c -= copy_from_user(tmp, (const char __user *) buf, c); if (!c) { printk("%s: EFAULT (count %d)\n", @@ -167,7 +167,7 @@ } spin_lock_irqsave(&srmcons_callback_lock, flags); - srmcons_do_write(tty, buf, count); + srmcons_do_write(tty, (const char *) buf, count); spin_unlock_irqrestore(&srmcons_callback_lock, flags); return count; diff -Nru a/arch/alpha/kernel/sys_alcor.c b/arch/alpha/kernel/sys_alcor.c --- a/arch/alpha/kernel/sys_alcor.c 2004-09-26 10:25:57 -07:00 +++ b/arch/alpha/kernel/sys_alcor.c 2004-09-26 10:25:57 -07:00 @@ -274,7 +274,6 @@ DO_EV5_MMU, DO_DEFAULT_RTC, DO_CIA_IO, - DO_CIA_BUS, .machine_check = cia_machine_check, .max_isa_dma_address = ALPHA_ALCOR_MAX_ISA_DMA_ADDRESS, .min_io_address = EISA_DEFAULT_IO_BASE, @@ -292,7 +291,7 @@ .pci_swizzle = common_swizzle, .sys = { .cia = { - .gru_int_req_bits = ALCOR_GRU_INT_REQ_BITS + .gru_int_req_bits = ALCOR_GRU_INT_REQ_BITS }} }; ALIAS_MV(alcor) @@ -302,7 +301,6 @@ DO_EV5_MMU, DO_DEFAULT_RTC, DO_CIA_IO, - DO_CIA_BUS, .machine_check = cia_machine_check, .max_isa_dma_address = ALPHA_MAX_ISA_DMA_ADDRESS, .min_io_address = EISA_DEFAULT_IO_BASE, @@ -320,7 +318,7 @@ .pci_swizzle = common_swizzle, .sys = { .cia = { - .gru_int_req_bits = XLT_GRU_INT_REQ_BITS + .gru_int_req_bits = XLT_GRU_INT_REQ_BITS }} }; diff -Nru a/arch/alpha/kernel/sys_cabriolet.c b/arch/alpha/kernel/sys_cabriolet.c --- a/arch/alpha/kernel/sys_cabriolet.c 2004-09-26 10:25:55 -07:00 +++ b/arch/alpha/kernel/sys_cabriolet.c 2004-09-26 10:25:55 -07:00 @@ -327,7 +327,6 @@ DO_EV4_MMU, DO_DEFAULT_RTC, DO_APECS_IO, - DO_APECS_BUS, .machine_check = apecs_machine_check, .max_isa_dma_address = ALPHA_MAX_ISA_DMA_ADDRESS, .min_io_address = DEFAULT_IO_BASE, @@ -354,7 +353,6 @@ DO_EV5_MMU, DO_DEFAULT_RTC, DO_CIA_IO, - DO_CIA_BUS, .machine_check = cia_machine_check, .max_isa_dma_address = ALPHA_MAX_ISA_DMA_ADDRESS, .min_io_address = DEFAULT_IO_BASE, @@ -380,7 +378,6 @@ DO_EV4_MMU, DO_DEFAULT_RTC, DO_LCA_IO, - DO_LCA_BUS, .machine_check = lca_machine_check, .max_isa_dma_address = ALPHA_MAX_ISA_DMA_ADDRESS, .min_io_address = DEFAULT_IO_BASE, @@ -405,7 +402,6 @@ DO_EV5_MMU, DO_DEFAULT_RTC, DO_PYXIS_IO, - DO_CIA_BUS, .machine_check = cia_machine_check, .max_isa_dma_address = ALPHA_MAX_ISA_DMA_ADDRESS, .min_io_address = DEFAULT_IO_BASE, @@ -432,7 +428,6 @@ DO_EV5_MMU, DO_DEFAULT_RTC, DO_CIA_IO, - DO_CIA_BUS, .machine_check = cia_machine_check, .max_isa_dma_address = ALPHA_MAX_ISA_DMA_ADDRESS, .min_io_address = DEFAULT_IO_BASE, diff -Nru a/arch/alpha/kernel/sys_dp264.c b/arch/alpha/kernel/sys_dp264.c --- a/arch/alpha/kernel/sys_dp264.c 2004-09-26 10:25:55 -07:00 +++ b/arch/alpha/kernel/sys_dp264.c 2004-09-26 10:25:55 -07:00 @@ -569,7 +569,6 @@ DO_EV6_MMU, DO_DEFAULT_RTC, DO_TSUNAMI_IO, - DO_TSUNAMI_BUS, .machine_check = tsunami_machine_check, .max_isa_dma_address = ALPHA_MAX_ISA_DMA_ADDRESS, .min_io_address = DEFAULT_IO_BASE, @@ -594,7 +593,6 @@ DO_EV6_MMU, DO_DEFAULT_RTC, DO_TSUNAMI_IO, - DO_TSUNAMI_BUS, .machine_check = tsunami_machine_check, .max_isa_dma_address = ALPHA_MAX_ISA_DMA_ADDRESS, .min_io_address = DEFAULT_IO_BASE, @@ -618,7 +616,6 @@ DO_EV6_MMU, DO_DEFAULT_RTC, DO_TSUNAMI_IO, - DO_TSUNAMI_BUS, .machine_check = tsunami_machine_check, .max_isa_dma_address = ALPHA_MAX_ISA_DMA_ADDRESS, .min_io_address = DEFAULT_IO_BASE, @@ -642,7 +639,6 @@ DO_EV6_MMU, DO_DEFAULT_RTC, DO_TSUNAMI_IO, - DO_TSUNAMI_BUS, .machine_check = tsunami_machine_check, .max_isa_dma_address = ALPHA_MAX_ISA_DMA_ADDRESS, .min_io_address = DEFAULT_IO_BASE, @@ -671,7 +667,6 @@ DO_EV6_MMU, DO_DEFAULT_RTC, DO_TSUNAMI_IO, - DO_TSUNAMI_BUS, .machine_check = tsunami_machine_check, .max_isa_dma_address = ALPHA_MAX_ISA_DMA_ADDRESS, .min_io_address = DEFAULT_IO_BASE, diff -Nru a/arch/alpha/kernel/sys_eb64p.c b/arch/alpha/kernel/sys_eb64p.c --- a/arch/alpha/kernel/sys_eb64p.c 2004-09-26 10:25:58 -07:00 +++ b/arch/alpha/kernel/sys_eb64p.c 2004-09-26 10:25:58 -07:00 @@ -212,7 +212,6 @@ DO_EV4_MMU, DO_DEFAULT_RTC, DO_APECS_IO, - DO_APECS_BUS, .machine_check = apecs_machine_check, .max_isa_dma_address = ALPHA_MAX_ISA_DMA_ADDRESS, .min_io_address = DEFAULT_IO_BASE, @@ -238,7 +237,6 @@ DO_EV4_MMU, DO_DEFAULT_RTC, DO_LCA_IO, - DO_LCA_BUS, .machine_check = lca_machine_check, .max_isa_dma_address = ALPHA_MAX_ISA_DMA_ADDRESS, .min_io_address = DEFAULT_IO_BASE, diff -Nru a/arch/alpha/kernel/sys_eiger.c b/arch/alpha/kernel/sys_eiger.c --- a/arch/alpha/kernel/sys_eiger.c 2004-09-26 10:25:55 -07:00 +++ b/arch/alpha/kernel/sys_eiger.c 2004-09-26 10:25:55 -07:00 @@ -222,7 +222,6 @@ DO_EV6_MMU, DO_DEFAULT_RTC, DO_TSUNAMI_IO, - DO_TSUNAMI_BUS, .machine_check = tsunami_machine_check, .max_isa_dma_address = ALPHA_MAX_ISA_DMA_ADDRESS, .min_io_address = DEFAULT_IO_BASE, diff -Nru a/arch/alpha/kernel/sys_jensen.c b/arch/alpha/kernel/sys_jensen.c --- a/arch/alpha/kernel/sys_jensen.c 2004-09-26 10:25:56 -07:00 +++ b/arch/alpha/kernel/sys_jensen.c 2004-09-26 10:25:56 -07:00 @@ -249,8 +249,6 @@ printk(KERN_CRIT "Machine check\n"); } -#define jensen_pci_tbi ((void*)0) - /* * The System Vector @@ -260,7 +258,6 @@ .vector_name = "Jensen", DO_EV4_MMU, IO_LITE(JENSEN,jensen), - BUS(jensen), .machine_check = jensen_machine_check, .max_isa_dma_address = ALPHA_MAX_ISA_DMA_ADDRESS, .rtc_port = 0x170, diff -Nru a/arch/alpha/kernel/sys_marvel.c b/arch/alpha/kernel/sys_marvel.c --- a/arch/alpha/kernel/sys_marvel.c 2004-09-26 10:25:57 -07:00 +++ b/arch/alpha/kernel/sys_marvel.c 2004-09-26 10:25:57 -07:00 @@ -471,7 +471,6 @@ DO_EV7_MMU, DO_DEFAULT_RTC, DO_MARVEL_IO, - DO_MARVEL_BUS, .machine_check = marvel_machine_check, .max_isa_dma_address = ALPHA_MAX_ISA_DMA_ADDRESS, .min_io_address = DEFAULT_IO_BASE, diff -Nru a/arch/alpha/kernel/sys_miata.c b/arch/alpha/kernel/sys_miata.c --- a/arch/alpha/kernel/sys_miata.c 2004-09-26 10:25:56 -07:00 +++ b/arch/alpha/kernel/sys_miata.c 2004-09-26 10:25:56 -07:00 @@ -269,7 +269,6 @@ DO_EV5_MMU, DO_DEFAULT_RTC, DO_PYXIS_IO, - DO_CIA_BUS, .machine_check = cia_machine_check, .max_isa_dma_address = ALPHA_MAX_ISA_DMA_ADDRESS, .min_io_address = DEFAULT_IO_BASE, diff -Nru a/arch/alpha/kernel/sys_mikasa.c b/arch/alpha/kernel/sys_mikasa.c --- a/arch/alpha/kernel/sys_mikasa.c 2004-09-26 10:25:57 -07:00 +++ b/arch/alpha/kernel/sys_mikasa.c 2004-09-26 10:25:57 -07:00 @@ -221,7 +221,6 @@ DO_EV4_MMU, DO_DEFAULT_RTC, DO_APECS_IO, - DO_APECS_BUS, .machine_check = mikasa_apecs_machine_check, .max_isa_dma_address = ALPHA_MAX_ISA_DMA_ADDRESS, .min_io_address = DEFAULT_IO_BASE, @@ -246,7 +245,6 @@ DO_EV5_MMU, DO_DEFAULT_RTC, DO_CIA_IO, - DO_CIA_BUS, .machine_check = cia_machine_check, .max_isa_dma_address = ALPHA_MAX_ISA_DMA_ADDRESS, .min_io_address = DEFAULT_IO_BASE, diff -Nru a/arch/alpha/kernel/sys_nautilus.c b/arch/alpha/kernel/sys_nautilus.c --- a/arch/alpha/kernel/sys_nautilus.c 2004-09-26 10:25:56 -07:00 +++ b/arch/alpha/kernel/sys_nautilus.c 2004-09-26 10:25:56 -07:00 @@ -250,7 +250,6 @@ DO_EV6_MMU, DO_DEFAULT_RTC, DO_IRONGATE_IO, - DO_IRONGATE_BUS, .machine_check = nautilus_machine_check, .max_isa_dma_address = ALPHA_MAX_ISA_DMA_ADDRESS, .min_io_address = DEFAULT_IO_BASE, diff -Nru a/arch/alpha/kernel/sys_noritake.c b/arch/alpha/kernel/sys_noritake.c --- a/arch/alpha/kernel/sys_noritake.c 2004-09-26 10:25:55 -07:00 +++ b/arch/alpha/kernel/sys_noritake.c 2004-09-26 10:25:55 -07:00 @@ -303,7 +303,6 @@ DO_EV4_MMU, DO_DEFAULT_RTC, DO_APECS_IO, - DO_APECS_BUS, .machine_check = noritake_apecs_machine_check, .max_isa_dma_address = ALPHA_MAX_ISA_DMA_ADDRESS, .min_io_address = EISA_DEFAULT_IO_BASE, @@ -328,7 +327,6 @@ DO_EV5_MMU, DO_DEFAULT_RTC, DO_CIA_IO, - DO_CIA_BUS, .machine_check = cia_machine_check, .max_isa_dma_address = ALPHA_MAX_ISA_DMA_ADDRESS, .min_io_address = EISA_DEFAULT_IO_BASE, diff -Nru a/arch/alpha/kernel/sys_rawhide.c b/arch/alpha/kernel/sys_rawhide.c --- a/arch/alpha/kernel/sys_rawhide.c 2004-09-26 10:25:57 -07:00 +++ b/arch/alpha/kernel/sys_rawhide.c 2004-09-26 10:25:57 -07:00 @@ -250,7 +250,6 @@ DO_EV5_MMU, DO_DEFAULT_RTC, DO_MCPCIA_IO, - DO_MCPCIA_BUS, .machine_check = mcpcia_machine_check, .max_isa_dma_address = ALPHA_MAX_ISA_DMA_ADDRESS, .min_io_address = DEFAULT_IO_BASE, diff -Nru a/arch/alpha/kernel/sys_ruffian.c b/arch/alpha/kernel/sys_ruffian.c --- a/arch/alpha/kernel/sys_ruffian.c 2004-09-26 10:25:56 -07:00 +++ b/arch/alpha/kernel/sys_ruffian.c 2004-09-26 10:25:56 -07:00 @@ -220,7 +220,6 @@ DO_EV5_MMU, DO_DEFAULT_RTC, DO_PYXIS_IO, - DO_CIA_BUS, .machine_check = cia_machine_check, .max_isa_dma_address = ALPHA_RUFFIAN_MAX_ISA_DMA_ADDRESS, .min_io_address = DEFAULT_IO_BASE, diff -Nru a/arch/alpha/kernel/sys_rx164.c b/arch/alpha/kernel/sys_rx164.c --- a/arch/alpha/kernel/sys_rx164.c 2004-09-26 10:25:55 -07:00 +++ b/arch/alpha/kernel/sys_rx164.c 2004-09-26 10:25:55 -07:00 @@ -201,7 +201,6 @@ DO_EV5_MMU, DO_DEFAULT_RTC, DO_POLARIS_IO, - DO_POLARIS_BUS, .machine_check = polaris_machine_check, .max_isa_dma_address = ALPHA_MAX_ISA_DMA_ADDRESS, .min_io_address = DEFAULT_IO_BASE, diff -Nru a/arch/alpha/kernel/sys_sable.c b/arch/alpha/kernel/sys_sable.c --- a/arch/alpha/kernel/sys_sable.c 2004-09-26 10:25:55 -07:00 +++ b/arch/alpha/kernel/sys_sable.c 2004-09-26 10:25:55 -07:00 @@ -566,7 +566,6 @@ DO_EV4_MMU, DO_DEFAULT_RTC, DO_T2_IO, - DO_T2_BUS, .machine_check = t2_machine_check, .max_isa_dma_address = ALPHA_SABLE_MAX_ISA_DMA_ADDRESS, .min_io_address = EISA_DEFAULT_IO_BASE, @@ -599,7 +598,6 @@ DO_EV5_MMU, DO_DEFAULT_RTC, DO_T2_IO, - DO_T2_BUS, .machine_check = t2_machine_check, .max_isa_dma_address = ALPHA_SABLE_MAX_ISA_DMA_ADDRESS, .min_io_address = EISA_DEFAULT_IO_BASE, @@ -631,7 +629,6 @@ DO_EV4_MMU, DO_DEFAULT_RTC, DO_T2_IO, - DO_T2_BUS, .machine_check = t2_machine_check, .max_isa_dma_address = ALPHA_SABLE_MAX_ISA_DMA_ADDRESS, .min_io_address = EISA_DEFAULT_IO_BASE, diff -Nru a/arch/alpha/kernel/sys_sio.c b/arch/alpha/kernel/sys_sio.c --- a/arch/alpha/kernel/sys_sio.c 2004-09-26 10:25:55 -07:00 +++ b/arch/alpha/kernel/sys_sio.c 2004-09-26 10:25:55 -07:00 @@ -288,7 +288,6 @@ DO_EV4_MMU, DO_DEFAULT_RTC, DO_LCA_IO, - DO_LCA_BUS, .machine_check = lca_machine_check, .max_isa_dma_address = ALPHA_MAX_ISA_DMA_ADDRESS, .min_io_address = DEFAULT_IO_BASE, @@ -319,7 +318,6 @@ DO_EV4_MMU, DO_DEFAULT_RTC, DO_APECS_IO, - DO_APECS_BUS, .machine_check = apecs_machine_check, .max_isa_dma_address = ALPHA_MAX_ISA_DMA_ADDRESS, .min_io_address = DEFAULT_IO_BASE, @@ -349,7 +347,6 @@ DO_EV4_MMU, DO_DEFAULT_RTC, DO_LCA_IO, - DO_LCA_BUS, .machine_check = lca_machine_check, .max_isa_dma_address = ALPHA_MAX_ISA_DMA_ADDRESS, .min_io_address = DEFAULT_IO_BASE, @@ -388,7 +385,6 @@ DO_EV4_MMU, DO_DEFAULT_RTC, DO_LCA_IO, - DO_LCA_BUS, .machine_check = lca_machine_check, .max_isa_dma_address = ALPHA_MAX_ISA_DMA_ADDRESS, .min_io_address = DEFAULT_IO_BASE, @@ -418,7 +414,6 @@ DO_EV4_MMU, DO_DEFAULT_RTC, DO_APECS_IO, - BUS(apecs), .machine_check = apecs_machine_check, .max_isa_dma_address = ALPHA_XL_MAX_ISA_DMA_ADDRESS, .min_io_address = DEFAULT_IO_BASE, diff -Nru a/arch/alpha/kernel/sys_sx164.c b/arch/alpha/kernel/sys_sx164.c --- a/arch/alpha/kernel/sys_sx164.c 2004-09-26 10:25:56 -07:00 +++ b/arch/alpha/kernel/sys_sx164.c 2004-09-26 10:25:56 -07:00 @@ -158,7 +158,6 @@ DO_EV5_MMU, DO_DEFAULT_RTC, DO_PYXIS_IO, - DO_CIA_BUS, .machine_check = cia_machine_check, .max_isa_dma_address = ALPHA_MAX_ISA_DMA_ADDRESS, .min_io_address = DEFAULT_IO_BASE, diff -Nru a/arch/alpha/kernel/sys_takara.c b/arch/alpha/kernel/sys_takara.c --- a/arch/alpha/kernel/sys_takara.c 2004-09-26 10:25:58 -07:00 +++ b/arch/alpha/kernel/sys_takara.c 2004-09-26 10:25:58 -07:00 @@ -277,7 +277,6 @@ DO_EV5_MMU, DO_DEFAULT_RTC, DO_CIA_IO, - DO_CIA_BUS, .machine_check = cia_machine_check, .max_isa_dma_address = ALPHA_MAX_ISA_DMA_ADDRESS, .min_io_address = DEFAULT_IO_BASE, diff -Nru a/arch/alpha/kernel/sys_titan.c b/arch/alpha/kernel/sys_titan.c --- a/arch/alpha/kernel/sys_titan.c 2004-09-26 10:25:57 -07:00 +++ b/arch/alpha/kernel/sys_titan.c 2004-09-26 10:25:57 -07:00 @@ -66,7 +66,7 @@ register int bcpu = boot_cpuid; #ifdef CONFIG_SMP - register unsigned long cpm = cpu_present_mask; + cpumask_t cpm = cpu_present_mask; volatile unsigned long *dim0, *dim1, *dim2, *dim3; unsigned long mask0, mask1, mask2, mask3, dummy; @@ -85,10 +85,10 @@ dim1 = &cchip->dim1.csr; dim2 = &cchip->dim2.csr; dim3 = &cchip->dim3.csr; - if ((cpm & 1) == 0) dim0 = &dummy; - if ((cpm & 2) == 0) dim1 = &dummy; - if ((cpm & 4) == 0) dim2 = &dummy; - if ((cpm & 8) == 0) dim3 = &dummy; + if (!cpu_isset(0, cpm)) dim0 = &dummy; + if (!cpu_isset(1, cpm)) dim1 = &dummy; + if (!cpu_isset(2, cpm)) dim2 = &dummy; + if (!cpu_isset(3, cpm)) dim3 = &dummy; *dim0 = mask0; *dim1 = mask1; @@ -145,12 +145,12 @@ } static void -titan_cpu_set_irq_affinity(unsigned int irq, unsigned long affinity) +titan_cpu_set_irq_affinity(unsigned int irq, cpumask_t affinity) { int cpu; for (cpu = 0; cpu < 4; cpu++) { - if (affinity & (1UL << cpu)) + if (cpu_isset(cpu, affinity)) titan_cpu_irq_affinity[cpu] |= 1UL << irq; else titan_cpu_irq_affinity[cpu] &= ~(1UL << irq); @@ -159,7 +159,7 @@ } static void -titan_set_irq_affinity(unsigned int irq, unsigned long affinity) +titan_set_irq_affinity(unsigned int irq, cpumask_t affinity) { spin_lock(&titan_irq_lock); titan_cpu_set_irq_affinity(irq - 16, affinity); @@ -369,7 +369,6 @@ DO_EV6_MMU, DO_DEFAULT_RTC, DO_TITAN_IO, - DO_TITAN_BUS, .machine_check = titan_machine_check, .max_isa_dma_address = ALPHA_MAX_ISA_DMA_ADDRESS, .min_io_address = DEFAULT_IO_BASE, @@ -397,7 +396,6 @@ DO_EV6_MMU, DO_DEFAULT_RTC, DO_TITAN_IO, - DO_TITAN_BUS, .machine_check = privateer_machine_check, .max_isa_dma_address = ALPHA_MAX_ISA_DMA_ADDRESS, .min_io_address = DEFAULT_IO_BASE, diff -Nru a/arch/alpha/kernel/sys_wildfire.c b/arch/alpha/kernel/sys_wildfire.c --- a/arch/alpha/kernel/sys_wildfire.c 2004-09-26 10:25:56 -07:00 +++ b/arch/alpha/kernel/sys_wildfire.c 2004-09-26 10:25:56 -07:00 @@ -337,7 +337,6 @@ DO_EV6_MMU, DO_DEFAULT_RTC, DO_WILDFIRE_IO, - DO_WILDFIRE_BUS, .machine_check = wildfire_machine_check, .max_isa_dma_address = ALPHA_MAX_ISA_DMA_ADDRESS, .min_io_address = DEFAULT_IO_BASE, diff -Nru a/arch/alpha/kernel/systbls.S b/arch/alpha/kernel/systbls.S --- a/arch/alpha/kernel/systbls.S 2004-09-26 10:25:56 -07:00 +++ b/arch/alpha/kernel/systbls.S 2004-09-26 10:25:56 -07:00 @@ -457,6 +457,7 @@ .quad sys_mq_timedreceive /* 435 */ .quad sys_mq_notify .quad sys_mq_getsetattr + .quad sys_waitid .size sys_call_table, . - sys_call_table .type sys_call_table, @object diff -Nru a/arch/alpha/kernel/traps.c b/arch/alpha/kernel/traps.c --- a/arch/alpha/kernel/traps.c 2004-09-26 10:25:57 -07:00 +++ b/arch/alpha/kernel/traps.c 2004-09-26 10:25:57 -07:00 @@ -111,7 +111,7 @@ printk("Code:"); for (i = -6; i < 2; i++) { unsigned int insn; - if (__get_user(insn, pc+i)) + if (__get_user(insn, (unsigned int __user *)pc + i)) break; printk("%c%08x%c", i ? ' ' : '<', insn, i ? ' ' : '>'); } diff -Nru a/arch/alpha/lib/Makefile b/arch/alpha/lib/Makefile --- a/arch/alpha/lib/Makefile 2004-09-26 10:25:57 -07:00 +++ b/arch/alpha/lib/Makefile 2004-09-26 10:25:57 -07:00 @@ -17,7 +17,6 @@ $(ev6-y)memset.o \ $(ev6-y)memcpy.o \ memmove.o \ - io.o \ checksum.o \ csum_partial_copy.o \ $(ev67-y)strlen.o \ diff -Nru a/arch/alpha/lib/io.c b/arch/alpha/lib/io.c --- a/arch/alpha/lib/io.c 2004-09-26 10:25:58 -07:00 +++ /dev/null Wed Dec 31 16:00:00 196900 @@ -1,594 +0,0 @@ -/* - * Alpha IO and memory functions.. Just expand the inlines in the header - * files.. - */ - -#include -#include -#include - -#include - -u8 _inb(unsigned long addr) -{ - return __inb(addr); -} - -u16 _inw(unsigned long addr) -{ - return __inw(addr); -} - -u32 _inl(unsigned long addr) -{ - return __inl(addr); -} - - -void _outb(u8 b, unsigned long addr) -{ - __outb(b, addr); -} - -void _outw(u16 b, unsigned long addr) -{ - __outw(b, addr); -} - -void _outl(u32 b, unsigned long addr) -{ - __outl(b, addr); -} - -u8 ___raw_readb(unsigned long addr) -{ - return __readb(addr); -} - -u16 ___raw_readw(unsigned long addr) -{ - return __readw(addr); -} - -u32 ___raw_readl(unsigned long addr) -{ - return __readl(addr); -} - -u64 ___raw_readq(unsigned long addr) -{ - return __readq(addr); -} - -u8 _readb(unsigned long addr) -{ - unsigned long r = __readb(addr); - mb(); - return r; -} - -u16 _readw(unsigned long addr) -{ - unsigned long r = __readw(addr); - mb(); - return r; -} - -u32 _readl(unsigned long addr) -{ - unsigned long r = __readl(addr); - mb(); - return r; -} - -u64 _readq(unsigned long addr) -{ - unsigned long r = __readq(addr); - mb(); - return r; -} - -void ___raw_writeb(u8 b, unsigned long addr) -{ - __writeb(b, addr); -} - -void ___raw_writew(u16 b, unsigned long addr) -{ - __writew(b, addr); -} - -void ___raw_writel(u32 b, unsigned long addr) -{ - __writel(b, addr); -} - -void ___raw_writeq(u64 b, unsigned long addr) -{ - __writeq(b, addr); -} - -void _writeb(u8 b, unsigned long addr) -{ - __writeb(b, addr); - mb(); -} - -void _writew(u16 b, unsigned long addr) -{ - __writew(b, addr); - mb(); -} - -void _writel(u32 b, unsigned long addr) -{ - __writel(b, addr); - mb(); -} - -void _writeq(u64 b, unsigned long addr) -{ - __writeq(b, addr); - mb(); -} - -/* - * Read COUNT 8-bit bytes from port PORT into memory starting at - * SRC. - */ -void insb (unsigned long port, void *dst, unsigned long count) -{ - while (((unsigned long)dst) & 0x3) { - if (!count) - return; - count--; - *(unsigned char *) dst = inb(port); - dst += 1; - } - - while (count >= 4) { - unsigned int w; - count -= 4; - w = inb(port); - w |= inb(port) << 8; - w |= inb(port) << 16; - w |= inb(port) << 24; - *(unsigned int *) dst = w; - dst += 4; - } - - while (count) { - --count; - *(unsigned char *) dst = inb(port); - dst += 1; - } -} - - -/* - * Read COUNT 16-bit words from port PORT into memory starting at - * SRC. SRC must be at least short aligned. This is used by the - * IDE driver to read disk sectors. Performance is important, but - * the interfaces seems to be slow: just using the inlined version - * of the inw() breaks things. - */ -void insw (unsigned long port, void *dst, unsigned long count) -{ - if (((unsigned long)dst) & 0x3) { - if (((unsigned long)dst) & 0x1) { - panic("insw: memory not short aligned"); - } - if (!count) - return; - count--; - *(unsigned short *) dst = inw(port); - dst += 2; - } - - while (count >= 2) { - unsigned int w; - count -= 2; - w = inw(port); - w |= inw(port) << 16; - *(unsigned int *) dst = w; - dst += 4; - } - - if (count) { - *(unsigned short*) dst = inw(port); - } -} - - -/* - * Read COUNT 32-bit words from port PORT into memory starting at - * SRC. Now works with any alignment in SRC. Performance is important, - * but the interfaces seems to be slow: just using the inlined version - * of the inl() breaks things. - */ -void insl (unsigned long port, void *dst, unsigned long count) -{ - unsigned int l = 0, l2; - - if (!count) - return; - - switch (((unsigned long) dst) & 0x3) - { - case 0x00: /* Buffer 32-bit aligned */ - while (count--) - { - *(unsigned int *) dst = inl(port); - dst += 4; - } - break; - - /* Assuming little endian Alphas in cases 0x01 -- 0x03 ... */ - - case 0x02: /* Buffer 16-bit aligned */ - --count; - - l = inl(port); - *(unsigned short *) dst = l; - dst += 2; - - while (count--) - { - l2 = inl(port); - *(unsigned int *) dst = l >> 16 | l2 << 16; - dst += 4; - l = l2; - } - *(unsigned short *) dst = l >> 16; - break; - - case 0x01: /* Buffer 8-bit aligned */ - --count; - - l = inl(port); - *(unsigned char *) dst = l; - dst += 1; - *(unsigned short *) dst = l >> 8; - dst += 2; - while (count--) - { - l2 = inl(port); - *(unsigned int *) dst = l >> 24 | l2 << 8; - dst += 4; - l = l2; - } - *(unsigned char *) dst = l >> 24; - break; - - case 0x03: /* Buffer 8-bit aligned */ - --count; - - l = inl(port); - *(unsigned char *) dst = l; - dst += 1; - while (count--) - { - l2 = inl(port); - *(unsigned int *) dst = l << 24 | l2 >> 8; - dst += 4; - l = l2; - } - *(unsigned short *) dst = l >> 8; - dst += 2; - *(unsigned char *) dst = l >> 24; - break; - } -} - - -/* - * Like insb but in the opposite direction. - * Don't worry as much about doing aligned memory transfers: - * doing byte reads the "slow" way isn't nearly as slow as - * doing byte writes the slow way (no r-m-w cycle). - */ -void outsb(unsigned long port, const void * src, unsigned long count) -{ - while (count) { - count--; - outb(*(char *)src, port); - src += 1; - } -} - -/* - * Like insw but in the opposite direction. This is used by the IDE - * driver to write disk sectors. Performance is important, but the - * interfaces seems to be slow: just using the inlined version of the - * outw() breaks things. - */ -void outsw (unsigned long port, const void *src, unsigned long count) -{ - if (((unsigned long)src) & 0x3) { - if (((unsigned long)src) & 0x1) { - panic("outsw: memory not short aligned"); - } - outw(*(unsigned short*)src, port); - src += 2; - --count; - } - - while (count >= 2) { - unsigned int w; - count -= 2; - w = *(unsigned int *) src; - src += 4; - outw(w >> 0, port); - outw(w >> 16, port); - } - - if (count) { - outw(*(unsigned short *) src, port); - } -} - - -/* - * Like insl but in the opposite direction. This is used by the IDE - * driver to write disk sectors. Works with any alignment in SRC. - * Performance is important, but the interfaces seems to be slow: - * just using the inlined version of the outl() breaks things. - */ -void outsl (unsigned long port, const void *src, unsigned long count) -{ - unsigned int l = 0, l2; - - if (!count) - return; - - switch (((unsigned long) src) & 0x3) - { - case 0x00: /* Buffer 32-bit aligned */ - while (count--) - { - outl(*(unsigned int *) src, port); - src += 4; - } - break; - - case 0x02: /* Buffer 16-bit aligned */ - --count; - - l = *(unsigned short *) src << 16; - src += 2; - - while (count--) - { - l2 = *(unsigned int *) src; - src += 4; - outl (l >> 16 | l2 << 16, port); - l = l2; - } - l2 = *(unsigned short *) src; - outl (l >> 16 | l2 << 16, port); - break; - - case 0x01: /* Buffer 8-bit aligned */ - --count; - - l = *(unsigned char *) src << 8; - src += 1; - l |= *(unsigned short *) src << 16; - src += 2; - while (count--) - { - l2 = *(unsigned int *) src; - src += 4; - outl (l >> 8 | l2 << 24, port); - l = l2; - } - l2 = *(unsigned char *) src; - outl (l >> 8 | l2 << 24, port); - break; - - case 0x03: /* Buffer 8-bit aligned */ - --count; - - l = *(unsigned char *) src << 24; - src += 1; - while (count--) - { - l2 = *(unsigned int *) src; - src += 4; - outl (l >> 24 | l2 << 8, port); - l = l2; - } - l2 = *(unsigned short *) src; - src += 2; - l2 |= *(unsigned char *) src << 16; - outl (l >> 24 | l2 << 8, port); - break; - } -} - - -/* - * Copy data from IO memory space to "real" memory space. - * This needs to be optimized. - */ -void _memcpy_fromio(void * to, unsigned long from, long count) -{ - /* Optimize co-aligned transfers. Everything else gets handled - a byte at a time. */ - - if (count >= 8 && ((unsigned long)to & 7) == (from & 7)) { - count -= 8; - do { - *(u64 *)to = __raw_readq(from); - count -= 8; - to += 8; - from += 8; - } while (count >= 0); - count += 8; - } - - if (count >= 4 && ((unsigned long)to & 3) == (from & 3)) { - count -= 4; - do { - *(u32 *)to = __raw_readl(from); - count -= 4; - to += 4; - from += 4; - } while (count >= 0); - count += 4; - } - - if (count >= 2 && ((unsigned long)to & 1) == (from & 1)) { - count -= 2; - do { - *(u16 *)to = __raw_readw(from); - count -= 2; - to += 2; - from += 2; - } while (count >= 0); - count += 2; - } - - while (count > 0) { - *(u8 *) to = __raw_readb(from); - count--; - to++; - from++; - } -} - -/* - * Copy data from "real" memory space to IO memory space. - * This needs to be optimized. - */ -void _memcpy_toio(unsigned long to, const void * from, long count) -{ - /* Optimize co-aligned transfers. Everything else gets handled - a byte at a time. */ - /* FIXME -- align FROM. */ - - if (count >= 8 && (to & 7) == ((unsigned long)from & 7)) { - count -= 8; - do { - __raw_writeq(*(const u64 *)from, to); - count -= 8; - to += 8; - from += 8; - } while (count >= 0); - count += 8; - } - - if (count >= 4 && (to & 3) == ((unsigned long)from & 3)) { - count -= 4; - do { - __raw_writel(*(const u32 *)from, to); - count -= 4; - to += 4; - from += 4; - } while (count >= 0); - count += 4; - } - - if (count >= 2 && (to & 1) == ((unsigned long)from & 1)) { - count -= 2; - do { - __raw_writew(*(const u16 *)from, to); - count -= 2; - to += 2; - from += 2; - } while (count >= 0); - count += 2; - } - - while (count > 0) { - __raw_writeb(*(const u8 *) from, to); - count--; - to++; - from++; - } - mb(); -} - -/* - * "memset" on IO memory space. - */ -void _memset_c_io(unsigned long to, unsigned long c, long count) -{ - /* Handle any initial odd byte */ - if (count > 0 && (to & 1)) { - __raw_writeb(c, to); - to++; - count--; - } - - /* Handle any initial odd halfword */ - if (count >= 2 && (to & 2)) { - __raw_writew(c, to); - to += 2; - count -= 2; - } - - /* Handle any initial odd word */ - if (count >= 4 && (to & 4)) { - __raw_writel(c, to); - to += 4; - count -= 4; - } - - /* Handle all full-sized quadwords: we're aligned - (or have a small count) */ - count -= 8; - if (count >= 0) { - do { - __raw_writeq(c, to); - to += 8; - count -= 8; - } while (count >= 0); - } - count += 8; - - /* The tail is word-aligned if we still have count >= 4 */ - if (count >= 4) { - __raw_writel(c, to); - to += 4; - count -= 4; - } - - /* The tail is half-word aligned if we have count >= 2 */ - if (count >= 2) { - __raw_writew(c, to); - to += 2; - count -= 2; - } - - /* And finally, one last byte.. */ - if (count) { - __raw_writeb(c, to); - } - mb(); -} - -void -scr_memcpyw(u16 *d, const u16 *s, unsigned int count) -{ - if (! __is_ioaddr((unsigned long) s)) { - /* Source is memory. */ - if (! __is_ioaddr((unsigned long) d)) - memcpy(d, s, count); - else - memcpy_toio(d, s, count); - } else { - /* Source is screen. */ - if (! __is_ioaddr((unsigned long) d)) - memcpy_fromio(d, s, count); - else { - /* FIXME: Should handle unaligned ops and - operation widening. */ - count /= 2; - while (count--) { - u16 tmp = __raw_readw((unsigned long)(s++)); - __raw_writew(tmp, (unsigned long)(d++)); - } - } - } -} diff -Nru a/arch/alpha/mm/fault.c b/arch/alpha/mm/fault.c --- a/arch/alpha/mm/fault.c 2004-09-26 10:25:56 -07:00 +++ b/arch/alpha/mm/fault.c 2004-09-26 10:25:56 -07:00 @@ -98,7 +98,7 @@ by ignoring such an instruction. */ if (cause == 0) { unsigned int insn; - __get_user(insn, (unsigned int *)regs->pc); + __get_user(insn, (unsigned int __user *)regs->pc); if ((insn >> 21 & 0x1f) == 0x1f && /* ldq ldl ldt lds ldg ldf ldwu ldbu */ (1ul << (insn >> 26) & 0x30f00001400ul)) { diff -Nru a/arch/arm/Kconfig b/arch/arm/Kconfig --- a/arch/arm/Kconfig 2004-09-26 10:25:56 -07:00 +++ b/arch/arm/Kconfig 2004-09-26 10:25:56 -07:00 @@ -63,6 +63,10 @@ config GENERIC_ISA_DMA bool +config GENERIC_IOMAP + bool + default y + source "init/Kconfig" menu "System Type" diff -Nru a/arch/arm/configs/ebsa110_defconfig b/arch/arm/configs/ebsa110_defconfig --- a/arch/arm/configs/ebsa110_defconfig 2004-09-26 10:25:55 -07:00 +++ b/arch/arm/configs/ebsa110_defconfig 2004-09-26 10:25:55 -07:00 @@ -176,7 +176,6 @@ CONFIG_IP_ROUTE_FWMARK=y CONFIG_IP_ROUTE_NAT=y # CONFIG_IP_ROUTE_MULTIPATH is not set -# CONFIG_IP_ROUTE_TOS is not set CONFIG_IP_ROUTE_VERBOSE=y CONFIG_IP_PNP=y # CONFIG_IP_PNP_DHCP is not set diff -Nru a/arch/arm/configs/ixp4xx_defconfig b/arch/arm/configs/ixp4xx_defconfig --- a/arch/arm/configs/ixp4xx_defconfig 2004-09-26 10:25:55 -07:00 +++ b/arch/arm/configs/ixp4xx_defconfig 2004-09-26 10:25:55 -07:00 @@ -308,7 +308,6 @@ CONFIG_IP_ROUTE_FWMARK=y CONFIG_IP_ROUTE_NAT=y CONFIG_IP_ROUTE_MULTIPATH=y -CONFIG_IP_ROUTE_TOS=y CONFIG_IP_ROUTE_VERBOSE=y CONFIG_IP_PNP=y CONFIG_IP_PNP_DHCP=y diff -Nru a/arch/arm/kernel/apm.c b/arch/arm/kernel/apm.c --- a/arch/arm/kernel/apm.c 2004-09-26 10:25:57 -07:00 +++ b/arch/arm/kernel/apm.c 2004-09-26 10:25:57 -07:00 @@ -46,7 +46,13 @@ /* * Maximum number of events stored */ -#define APM_MAX_EVENTS 20 +#define APM_MAX_EVENTS 16 + +struct apm_queue { + unsigned int event_head; + unsigned int event_tail; + apm_event_t events[APM_MAX_EVENTS]; +}; /* * The per-file APM data @@ -54,27 +60,25 @@ struct apm_user { struct list_head list; - int suser: 1; - int writer: 1; - int reader: 1; - int suspend_wait: 1; - int suspend_result; + unsigned int suser: 1; + unsigned int writer: 1; + unsigned int reader: 1; - int suspends_pending; - int standbys_pending; - unsigned int suspends_read; - unsigned int standbys_read; + int suspend_result; + unsigned int suspend_state; +#define SUSPEND_NONE 0 /* no suspend pending */ +#define SUSPEND_PENDING 1 /* suspend pending read */ +#define SUSPEND_READ 2 /* suspend read, pending ack */ +#define SUSPEND_ACKED 3 /* suspend acked */ +#define SUSPEND_DONE 4 /* suspend completed */ - int event_head; - int event_tail; - apm_event_t events[APM_MAX_EVENTS]; + struct apm_queue queue; }; /* * Local variables */ static int suspends_pending; -static int standbys_pending; static int apm_disabled; static DECLARE_WAIT_QUEUE_HEAD(apm_waitqueue); @@ -83,14 +87,19 @@ /* * This is a list of everyone who has opened /dev/apm_bios */ -static spinlock_t user_list_lock = SPIN_LOCK_UNLOCKED; +static DECLARE_RWSEM(user_list_lock); static LIST_HEAD(apm_user_list); /* - * The kapmd info. + * kapmd info. kapmd provides us a process context to handle + * "APM" events within - specifically necessary if we're going + * to be suspending the system. */ -static struct task_struct *kapmd; +static DECLARE_WAIT_QUEUE_HEAD(kapmd_wait); static DECLARE_COMPLETION(kapmd_exit); +static spinlock_t kapmd_queue_lock = SPIN_LOCK_UNLOCKED; +static struct apm_queue kapmd_queue; + static const char driver_version[] = "1.13"; /* no spaces */ @@ -102,19 +111,6 @@ */ static void __apm_get_power_status(struct apm_power_info *info) { -#if 0 && defined(CONFIG_SA1100_H3600) && defined(CONFIG_TOUCHSCREEN_H3600) - extern int h3600_apm_get_power_status(u_char *, u_char *, u_char *, - u_char *, u_short *); - - if (machine_is_h3600()) { - int dx; - h3600_apm_get_power_status(&info->ac_line_status, - &info->battery_status, &info->battery_flag, - &info->battery_life, &dx); - info->time = dx & 0x7fff; - info->units = dx & 0x8000 ? 0 : 1; - } -#endif } /* @@ -123,65 +119,71 @@ void (*apm_get_power_status)(struct apm_power_info *) = __apm_get_power_status; EXPORT_SYMBOL(apm_get_power_status); -static int queue_empty(struct apm_user *as) + +/* + * APM event queue management. + */ +static inline int queue_empty(struct apm_queue *q) { - return as->event_head == as->event_tail; + return q->event_head == q->event_tail; } -static apm_event_t get_queued_event(struct apm_user *as) +static inline apm_event_t queue_get_event(struct apm_queue *q) { - as->event_tail = (as->event_tail + 1) % APM_MAX_EVENTS; - return as->events[as->event_tail]; + q->event_tail = (q->event_tail + 1) % APM_MAX_EVENTS; + return q->events[q->event_tail]; } -static void queue_event_one_user(struct apm_user *as, apm_event_t event) +static void queue_add_event(struct apm_queue *q, apm_event_t event) { - as->event_head = (as->event_head + 1) % APM_MAX_EVENTS; - if (as->event_head == as->event_tail) { + q->event_head = (q->event_head + 1) % APM_MAX_EVENTS; + if (q->event_head == q->event_tail) { static int notified; if (notified++ == 0) printk(KERN_ERR "apm: an event queue overflowed\n"); - as->event_tail = (as->event_tail + 1) % APM_MAX_EVENTS; + q->event_tail = (q->event_tail + 1) % APM_MAX_EVENTS; } - as->events[as->event_head] = event; - - if (!as->suser || !as->writer) - return; + q->events[q->event_head] = event; +} - switch (event) { - case APM_SYS_SUSPEND: - case APM_USER_SUSPEND: - as->suspends_pending++; - suspends_pending++; - break; +static void queue_event_one_user(struct apm_user *as, apm_event_t event) +{ + if (as->suser && as->writer) { + switch (event) { + case APM_SYS_SUSPEND: + case APM_USER_SUSPEND: + /* + * If this user already has a suspend pending, + * don't queue another one. + */ + if (as->suspend_state != SUSPEND_NONE) + return; - case APM_SYS_STANDBY: - case APM_USER_STANDBY: - as->standbys_pending++; - standbys_pending++; - break; + as->suspend_state = SUSPEND_PENDING; + suspends_pending++; + break; + } } + queue_add_event(&as->queue, event); } static void queue_event(apm_event_t event, struct apm_user *sender) { - struct list_head *l; - - spin_lock(&user_list_lock); - list_for_each(l, &apm_user_list) { - struct apm_user *as = list_entry(l, struct apm_user, list); + struct apm_user *as; + down_read(&user_list_lock); + list_for_each_entry(as, &apm_user_list, list) { if (as != sender && as->reader) queue_event_one_user(as, event); } - spin_unlock(&user_list_lock); + up_read(&user_list_lock); wake_up_interruptible(&apm_waitqueue); } -static int apm_suspend(void) +static void apm_suspend(void) { - struct list_head *l; + struct apm_user *as; int err = pm_suspend(PM_SUSPEND_MEM); /* @@ -193,52 +195,39 @@ /* * Finally, wake up anyone who is sleeping on the suspend. */ - spin_lock(&user_list_lock); - list_for_each(l, &apm_user_list) { - struct apm_user *as = list_entry(l, struct apm_user, list); - + down_read(&user_list_lock); + list_for_each_entry(as, &apm_user_list, list) { as->suspend_result = err; - as->suspend_wait = 0; + as->suspend_state = SUSPEND_DONE; } - spin_unlock(&user_list_lock); + up_read(&user_list_lock); - wake_up_interruptible(&apm_suspend_waitqueue); - return err; + wake_up(&apm_suspend_waitqueue); } static ssize_t apm_read(struct file *fp, char __user *buf, size_t count, loff_t *ppos) { struct apm_user *as = fp->private_data; apm_event_t event; - int i = count, ret = 0, nonblock = fp->f_flags & O_NONBLOCK; + int i = count, ret = 0; if (count < sizeof(apm_event_t)) return -EINVAL; - if (queue_empty(as) && nonblock) + if (queue_empty(&as->queue) && fp->f_flags & O_NONBLOCK) return -EAGAIN; - wait_event_interruptible(apm_waitqueue, !queue_empty(as)); + wait_event_interruptible(apm_waitqueue, !queue_empty(&as->queue)); - while ((i >= sizeof(event)) && !queue_empty(as)) { - event = get_queued_event(as); - printk(" apm_read: event=%d\n", event); + while ((i >= sizeof(event)) && !queue_empty(&as->queue)) { + event = queue_get_event(&as->queue); ret = -EFAULT; if (copy_to_user(buf, &event, sizeof(event))) break; - switch (event) { - case APM_SYS_SUSPEND: - case APM_USER_SUSPEND: - as->suspends_read++; - break; - - case APM_SYS_STANDBY: - case APM_USER_STANDBY: - as->standbys_read++; - break; - } + if (event == APM_SYS_SUSPEND || event == APM_USER_SUSPEND) + as->suspend_state = SUSPEND_READ; buf += sizeof(event); i -= sizeof(event); @@ -252,10 +241,10 @@ static unsigned int apm_poll(struct file *fp, poll_table * wait) { - struct apm_user * as = fp->private_data; + struct apm_user *as = fp->private_data; poll_wait(fp, &apm_waitqueue, wait); - return queue_empty(as) ? 0 : POLLIN | POLLRDNORM; + return queue_empty(&as->queue) ? 0 : POLLIN | POLLRDNORM; } /* @@ -272,43 +261,65 @@ apm_ioctl(struct inode * inode, struct file *filp, u_int cmd, u_long arg) { struct apm_user *as = filp->private_data; + unsigned long flags; int err = -EINVAL; if (!as->suser || !as->writer) return -EPERM; switch (cmd) { - case APM_IOC_STANDBY: - break; - case APM_IOC_SUSPEND: - /* - * If we read a suspend command from /dev/apm_bios, - * then the corresponding APM_IOC_SUSPEND ioctl is - * interpreted as an acknowledge. - */ - if (as->suspends_read > 0) { - as->suspends_read--; - as->suspends_pending--; + as->suspend_result = -EINTR; + + if (as->suspend_state == SUSPEND_READ) { + /* + * If we read a suspend command from /dev/apm_bios, + * then the corresponding APM_IOC_SUSPEND ioctl is + * interpreted as an acknowledge. + */ + as->suspend_state = SUSPEND_ACKED; suspends_pending--; } else { + /* + * Otherwise it is a request to suspend the system. + * Queue an event for all readers, and expect an + * acknowledge from all writers who haven't already + * acknowledged. + */ queue_event(APM_USER_SUSPEND, as); } /* - * If there are outstanding suspend requests for other - * people on /dev/apm_bios, we must sleep for them. - * Last one to bed turns the lights out. + * If there are no further acknowledges required, suspend + * the system. */ - if (suspends_pending > 0) { - as->suspend_wait = 1; - err = wait_event_interruptible(apm_suspend_waitqueue, - as->suspend_wait == 0); - if (err == 0) - err = as->suspend_result; - } else { - err = apm_suspend(); - } + if (suspends_pending == 0) + apm_suspend(); + + /* + * Wait for the suspend/resume to complete. If there are + * pending acknowledges, we wait here for them. + * + * Note that we need to ensure that the PM subsystem does + * not kick us out of the wait when it suspends the threads. + */ + flags = current->flags; + current->flags |= PF_NOFREEZE; + + /* + * Note: do not allow a thread which is acking the suspend + * to escape until the resume is complete. + */ + if (as->suspend_state == SUSPEND_ACKED) + wait_event(apm_suspend_waitqueue, + as->suspend_state == SUSPEND_DONE); + else + wait_event_interruptible(apm_suspend_waitqueue, + as->suspend_state == SUSPEND_DONE); + + current->flags = flags; + err = as->suspend_result; + as->suspend_state = SUSPEND_NONE; break; } @@ -320,24 +331,19 @@ struct apm_user *as = filp->private_data; filp->private_data = NULL; - spin_lock(&user_list_lock); + down_write(&user_list_lock); list_del(&as->list); - spin_unlock(&user_list_lock); + up_write(&user_list_lock); /* * We are now unhooked from the chain. As far as new * events are concerned, we no longer exist. However, we - * need to balance standbys_pending and suspends_pending, - * which means the possibility of sleeping. + * need to balance suspends_pending, which means the + * possibility of sleeping. */ - if (as->standbys_pending > 0) { - standbys_pending -= as->standbys_pending; -// if (standbys_pending <= 0) -// standby(); - } - if (as->suspends_pending > 0) { - suspends_pending -= as->suspends_pending; - if (suspends_pending <= 0) + if (as->suspend_state != SUSPEND_NONE) { + suspends_pending -= 1; + if (suspends_pending == 0) apm_suspend(); } @@ -364,9 +370,9 @@ as->writer = (filp->f_mode & FMODE_WRITE) == FMODE_WRITE; as->reader = (filp->f_mode & FMODE_READ) == FMODE_READ; - spin_lock(&user_list_lock); + down_write(&user_list_lock); list_add(&as->list, &apm_user_list); - spin_unlock(&user_list_lock); + up_write(&user_list_lock); filp->private_data = as; } @@ -438,7 +444,7 @@ info.ac_line_status = 0xff; info.battery_status = 0xff; info.battery_flag = 0xff; - info.battery_life = 255; + info.battery_life = -1; info.time = -1; info.units = -1; @@ -461,34 +467,53 @@ } #endif -#if 0 -static int kapmd(void *startup) +static int kapmd(void *arg) { - struct task_struct *tsk = current; + daemonize("kapmd"); + current->flags |= PF_NOFREEZE; - daemonize(); - strcpy(tsk->comm, "kapmd"); - kapmd = tsk; + do { + apm_event_t event; - spin_lock_irq(&tsk->sigmask_lock); - siginitsetinv(&tsk->blocked, sigmask(SIGQUIT)); - recalc_sigpending(tsk); - spin_unlock_irq(&tsk->sigmask_lock); + wait_event_interruptible(kapmd_wait, + !queue_empty(&kapmd_queue) || !pm_active); - complete((struct completion *)startup); + if (!pm_active) + break; - do { - set_task_state(tsk, TASK_INTERRUPTIBLE); - schedule(); - } while (!signal_pending(tsk)); + spin_lock_irq(&kapmd_queue_lock); + event = 0; + if (!queue_empty(&kapmd_queue)) + event = queue_get_event(&kapmd_queue); + spin_unlock_irq(&kapmd_queue_lock); + + switch (event) { + case 0: + break; + + case APM_LOW_BATTERY: + case APM_POWER_STATUS_CHANGE: + queue_event(event, NULL); + break; + + case APM_USER_SUSPEND: + case APM_SYS_SUSPEND: + queue_event(event, NULL); + if (suspends_pending == 0) + apm_suspend(); + break; + + case APM_CRITICAL_SUSPEND: + apm_suspend(); + break; + } + } while (1); complete_and_exit(&kapmd_exit, 0); } -#endif static int __init apm_init(void) { -// struct completion startup = COMPLETION_INITIALIZER(startup); int ret; if (apm_disabled) { @@ -501,22 +526,24 @@ return -EINVAL; } -// ret = kernel_thread(kapmd, &startup, CLONE_FS | CLONE_FILES); -// if (ret) -// return ret; -// wait_for_completion(&startup); - pm_active = 1; + ret = kernel_thread(kapmd, NULL, CLONE_KERNEL); + if (ret < 0) { + pm_active = 0; + return ret; + } + #ifdef CONFIG_PROC_FS create_proc_info_entry("apm", 0, NULL, apm_get_info); #endif ret = misc_register(&apm_device); if (ret != 0) { - pm_active = 0; remove_proc_entry("apm", NULL); - send_sig(SIGQUIT, kapmd, 1); + + pm_active = 0; + wake_up(&kapmd_wait); wait_for_completion(&kapmd_exit); } @@ -527,9 +554,10 @@ { misc_deregister(&apm_device); remove_proc_entry("apm", NULL); + pm_active = 0; -// send_sig(SIGQUIT, kapmd, 1); -// wait_for_completion(&kapmd_exit); + wake_up(&kapmd_wait); + wait_for_completion(&kapmd_exit); } module_init(apm_init); @@ -556,3 +584,27 @@ __setup("apm=", apm_setup); #endif + +/** + * apm_queue_event - queue an APM event for kapmd + * @event: APM event + * + * Queue an APM event for kapmd to process and ultimately take the + * appropriate action. Only a subset of events are handled: + * %APM_LOW_BATTERY + * %APM_POWER_STATUS_CHANGE + * %APM_USER_SUSPEND + * %APM_SYS_SUSPEND + * %APM_CRITICAL_SUSPEND + */ +void apm_queue_event(apm_event_t event) +{ + unsigned long flags; + + spin_lock_irqsave(&kapmd_queue_lock, flags); + queue_add_event(&kapmd_queue, event); + spin_unlock_irqrestore(&kapmd_queue_lock, flags); + + wake_up_interruptible(&kapmd_wait); +} +EXPORT_SYMBOL(apm_queue_event); diff -Nru a/arch/arm/mach-pxa/generic.c b/arch/arm/mach-pxa/generic.c --- a/arch/arm/mach-pxa/generic.c 2004-09-26 10:25:55 -07:00 +++ b/arch/arm/mach-pxa/generic.c 2004-09-26 10:25:55 -07:00 @@ -32,6 +32,7 @@ #include #include +#include #include "generic.h" @@ -127,6 +128,12 @@ .num_resources = ARRAY_SIZE(pxamci_resources), .resource = pxamci_resources, }; + +void __init pxa_set_mci_info(struct pxamci_platform_data *info) +{ + pxamci_device.dev.platform_data = info; +} +EXPORT_SYMBOL(pxa_set_mci_info); static struct pxa2xx_udc_mach_info pxa_udc_info; diff -Nru a/arch/arm/mach-pxa/pm.c b/arch/arm/mach-pxa/pm.c --- a/arch/arm/mach-pxa/pm.c 2004-09-26 10:25:56 -07:00 +++ b/arch/arm/mach-pxa/pm.c 2004-09-26 10:25:56 -07:00 @@ -45,7 +45,7 @@ */ enum { SLEEP_SAVE_START = 0, - SLEEP_SAVE_OSCR, SLEEP_SAVE_OIER, + SLEEP_SAVE_OIER, SLEEP_SAVE_OSMR0, SLEEP_SAVE_OSMR1, SLEEP_SAVE_OSMR2, SLEEP_SAVE_OSMR3, SLEEP_SAVE_GPLR0, SLEEP_SAVE_GPLR1, SLEEP_SAVE_GPLR2, @@ -78,7 +78,6 @@ delta = xtime.tv_sec - RCNR; /* save vital registers */ - SAVE(OSCR); SAVE(OSMR0); SAVE(OSMR1); SAVE(OSMR2); @@ -149,8 +148,10 @@ RESTORE(OSMR1); RESTORE(OSMR2); RESTORE(OSMR3); - RESTORE(OSCR); RESTORE(OIER); + + /* OSMR0 is the system timer: make sure OSCR is sufficiently behind */ + OSCR = OSMR0 - LATCH; RESTORE(CKEN); diff -Nru a/arch/arm/mach-s3c2410/devs.c b/arch/arm/mach-s3c2410/devs.c --- a/arch/arm/mach-s3c2410/devs.c 2004-09-26 10:25:55 -07:00 +++ b/arch/arm/mach-s3c2410/devs.c 2004-09-26 10:25:55 -07:00 @@ -53,7 +53,7 @@ struct platform_device s3c_device_usb = { .name = "s3c2410-ohci", - .id = 0, + .id = -1, .num_resources = ARRAY_SIZE(s3c_usb_resource), .resource = s3c_usb_resource, .dev = { @@ -102,13 +102,7 @@ .start = S3C2410_PA_NAND, .end = S3C2410_PA_NAND + S3C2410_SZ_NAND, .flags = IORESOURCE_MEM, - }, - [1] = { - .start = IRQ_S3CUART_RX0, - .end = IRQ_S3CUART_ERR0, - .flags = IORESOURCE_IRQ, } - }; struct platform_device s3c_device_nand = { diff -Nru a/arch/arm/mach-s3c2410/gpio.c b/arch/arm/mach-s3c2410/gpio.c --- a/arch/arm/mach-s3c2410/gpio.c 2004-09-26 10:25:57 -07:00 +++ b/arch/arm/mach-s3c2410/gpio.c 2004-09-26 10:25:57 -07:00 @@ -19,6 +19,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * + * Changelog + * 13-Sep-2004 BJD Implemented change of MISCCR + * 14-Sep-2004 BJD Added getpin call + * 14-Sep-2004 BJD Fixed bug in setpin() call */ @@ -90,9 +94,32 @@ local_irq_save(flags); dat = __raw_readl(base + 0x04); - dat &= 1 << offs; + dat &= ~(1 << offs); dat |= to << offs; __raw_writel(dat, base + 0x04); local_irq_restore(flags); +} + +unsigned int s3c2410_gpio_getpin(unsigned int pin) +{ + unsigned long base = S3C2410_GPIO_BASE(pin); + unsigned long offs = S3C2410_GPIO_OFFSET(pin); + + return __raw_readl(base + 0x04) & (1<< offs); +} + +unsigned int s3c2410_modify_misccr(unsigned int clear, unsigned int change) +{ + unsigned long flags; + unsigned long misccr; + + local_irq_save(flags); + misccr = __raw_readl(S3C2410_MISCCR); + misccr &= ~clear; + misccr ^= change; + __raw_writel(misccr, S3C2410_MISCCR); + local_irq_restore(flags); + + return misccr; } diff -Nru a/arch/arm/mach-sa1100/pm.c b/arch/arm/mach-sa1100/pm.c --- a/arch/arm/mach-sa1100/pm.c 2004-09-26 10:25:55 -07:00 +++ b/arch/arm/mach-sa1100/pm.c 2004-09-26 10:25:55 -07:00 @@ -44,7 +44,7 @@ */ enum { SLEEP_SAVE_SP = 0, - SLEEP_SAVE_OSCR, SLEEP_SAVE_OIER, + SLEEP_SAVE_OIER, SLEEP_SAVE_OSMR0, SLEEP_SAVE_OSMR1, SLEEP_SAVE_OSMR2, SLEEP_SAVE_OSMR3, SLEEP_SAVE_GPDR, SLEEP_SAVE_GAFR, @@ -69,7 +69,6 @@ gpio = GPLR; /* save vital registers */ - SAVE(OSCR); SAVE(OSMR0); SAVE(OSMR1); SAVE(OSMR2); @@ -131,8 +130,10 @@ RESTORE(OSMR1); RESTORE(OSMR2); RESTORE(OSMR3); - RESTORE(OSCR); RESTORE(OIER); + + /* OSMR0 is the system timer: make sure OSCR is sufficiently behind */ + OSCR = OSMR0 - LATCH; /* restore current time */ xtime.tv_sec = RCNR + delta; diff -Nru a/arch/i386/Kconfig b/arch/i386/Kconfig --- a/arch/i386/Kconfig 2004-09-26 10:25:55 -07:00 +++ b/arch/i386/Kconfig 2004-09-26 10:25:55 -07:00 @@ -29,6 +29,10 @@ bool default y +config GENERIC_IOMAP + bool + default y + source "init/Kconfig" menu "Processor type and features" diff -Nru a/arch/i386/boot/setup.S b/arch/i386/boot/setup.S --- a/arch/i386/boot/setup.S 2004-09-26 10:25:56 -07:00 +++ b/arch/i386/boot/setup.S 2004-09-26 10:25:56 -07:00 @@ -156,7 +156,7 @@ # can be located anywhere in # low memory 0x10000 or higher. -ramdisk_max: .long (MAXMEM-1) & 0x7fffffff +ramdisk_max: .long (-__PAGE_OFFSET-(512 << 20)-1) & 0x7fffffff # (Header version 0x0203 or later) # The highest safe address for # the contents of an initrd diff -Nru a/arch/i386/kernel/apm.c b/arch/i386/kernel/apm.c --- a/arch/i386/kernel/apm.c 2004-09-26 10:25:55 -07:00 +++ b/arch/i386/kernel/apm.c 2004-09-26 10:25:55 -07:00 @@ -2362,8 +2362,15 @@ { int error; - if (set_pm_idle) + if (set_pm_idle) { pm_idle = original_pm_idle; + /* + * We are about to unload the current idle thread pm callback + * (pm_idle), Wait for all processors to update cached/local + * copies of pm_idle before proceeding. + */ + synchronize_kernel(); + } if (((apm_info.bios.flags & APM_BIOS_DISENGAGED) == 0) && (apm_info.connection_version > 0x0100)) { error = apm_engage_power_management(APM_DEVICE_ALL, 0); diff -Nru a/arch/i386/kernel/cpu/cpufreq/powernow-k7.c b/arch/i386/kernel/cpu/cpufreq/powernow-k7.c --- a/arch/i386/kernel/cpu/cpufreq/powernow-k7.c 2004-09-26 10:25:55 -07:00 +++ b/arch/i386/kernel/cpu/cpufreq/powernow-k7.c 2004-09-26 10:25:55 -07:00 @@ -634,7 +634,7 @@ policy->governor = CPUFREQ_DEFAULT_GOVERNOR; - policy->cpuinfo.transition_latency = 20 * latency / fsb; + policy->cpuinfo.transition_latency = cpufreq_scale(2000000UL, fsb, latency); policy->cur = powernow_get(0); diff -Nru a/arch/i386/kernel/ioport.c b/arch/i386/kernel/ioport.c --- a/arch/i386/kernel/ioport.c 2004-09-26 10:25:56 -07:00 +++ b/arch/i386/kernel/ioport.c 2004-09-26 10:25:56 -07:00 @@ -56,7 +56,7 @@ */ asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int turn_on) { - unsigned int i, max_long, bytes, bytes_updated; + unsigned long i, max_long, bytes, bytes_updated; struct thread_struct * t = ¤t->thread; struct tss_struct * tss; unsigned long *bitmap; @@ -105,8 +105,11 @@ t->io_bitmap_max = bytes; - /* Update the TSS: */ - memcpy(tss->io_bitmap, t->io_bitmap_ptr, bytes_updated); + /* + * Sets the lazy trigger so that the next I/O operation will + * reload the correct bitmap. + */ + tss->io_bitmap_base = INVALID_IO_BITMAP_OFFSET_LAZY; put_cpu(); diff -Nru a/arch/i386/kernel/process.c b/arch/i386/kernel/process.c --- a/arch/i386/kernel/process.c 2004-09-26 10:25:55 -07:00 +++ b/arch/i386/kernel/process.c 2004-09-26 10:25:55 -07:00 @@ -142,13 +142,21 @@ /* endless idle loop with no priority at all */ while (1) { while (!need_resched()) { - void (*idle)(void) = pm_idle; + void (*idle)(void); + /* + * Mark this as an RCU critical section so that + * synchronize_kernel() in the unload path waits + * for our completion. + */ + rcu_read_lock(); + idle = pm_idle; if (!idle) idle = default_idle; irq_stat[smp_processor_id()].idle_timestamp = jiffies; idle(); + rcu_read_unlock(); } schedule(); } @@ -301,8 +309,11 @@ /* * Careful, clear this in the TSS too: */ - memset(tss->io_bitmap, 0xff, t->io_bitmap_max); + memset(tss->io_bitmap, 0xff, tss->io_bitmap_max); t->io_bitmap_max = 0; + tss->io_bitmap_owner = NULL; + tss->io_bitmap_max = 0; + tss->io_bitmap_base = INVALID_IO_BITMAP_OFFSET; put_cpu(); } } @@ -472,6 +483,37 @@ return 1; } +static inline void +handle_io_bitmap(struct thread_struct *next, struct tss_struct *tss) +{ + if (!next->io_bitmap_ptr) { + /* + * Disable the bitmap via an invalid offset. We still cache + * the previous bitmap owner and the IO bitmap contents: + */ + tss->io_bitmap_base = INVALID_IO_BITMAP_OFFSET; + return; + } + if (likely(next == tss->io_bitmap_owner)) { + /* + * Previous owner of the bitmap (hence the bitmap content) + * matches the next task, we dont have to do anything but + * to set a valid offset in the TSS: + */ + tss->io_bitmap_base = IO_BITMAP_OFFSET; + return; + } + /* + * Lazy TSS's I/O bitmap copy. We set an invalid offset here + * and we let the task to get a GPF in case an I/O instruction + * is performed. The handler of the GPF will verify that the + * faulting task has a valid I/O bitmap and, it true, does the + * real copy and restart the instruction. This will save us + * redundant copies when the currently switched task does not + * perform any I/O during its timeslice. + */ + tss->io_bitmap_base = INVALID_IO_BITMAP_OFFSET_LAZY; +} /* * This special macro can be used to load a debugging register */ @@ -556,20 +598,9 @@ loaddebug(next, 7); } - if (unlikely(prev->io_bitmap_ptr || next->io_bitmap_ptr)) { - if (next->io_bitmap_ptr) - /* - * Copy the relevant range of the IO bitmap. - * Normally this is 128 bytes or less: - */ - memcpy(tss->io_bitmap, next->io_bitmap_ptr, - max(prev->io_bitmap_max, next->io_bitmap_max)); - else - /* - * Clear any possible leftover bits: - */ - memset(tss->io_bitmap, 0xff, prev->io_bitmap_max); - } + if (unlikely(prev->io_bitmap_ptr || next->io_bitmap_ptr)) + handle_io_bitmap(next, tss); + return prev_p; } diff -Nru a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c --- a/arch/i386/kernel/setup.c 2004-09-26 10:25:56 -07:00 +++ b/arch/i386/kernel/setup.c 2004-09-26 10:25:56 -07:00 @@ -815,6 +815,14 @@ if (c == ' ' && !memcmp(from, "highmem=", 8)) highmem_pages = memparse(from+8, &from) >> PAGE_SHIFT; + /* + * vmalloc=size forces the vmalloc area to be exactly 'size' + * bytes. This can be used to increase (or decrease) the + * vmalloc area - the default is 128m. + */ + if (c == ' ' && !memcmp(from, "vmalloc=", 8)) + __VMALLOC_RESERVE = memparse(from+8, &from); + c = *(from++); if (!c) break; diff -Nru a/arch/i386/kernel/time.c b/arch/i386/kernel/time.c --- a/arch/i386/kernel/time.c 2004-09-26 10:25:56 -07:00 +++ b/arch/i386/kernel/time.c 2004-09-26 10:25:56 -07:00 @@ -333,11 +333,12 @@ static int time_resume(struct sys_device *dev) { + unsigned long flags; unsigned long sec = get_cmos_time() + clock_cmos_diff; - write_seqlock_irq(&xtime_lock); + write_seqlock_irqsave(&xtime_lock, flags); xtime.tv_sec = sec; xtime.tv_nsec = 0; - write_sequnlock_irq(&xtime_lock); + write_sequnlock_irqrestore(&xtime_lock, flags); return 0; } diff -Nru a/arch/i386/kernel/traps.c b/arch/i386/kernel/traps.c --- a/arch/i386/kernel/traps.c 2004-09-26 10:25:55 -07:00 +++ b/arch/i386/kernel/traps.c 2004-09-26 10:25:55 -07:00 @@ -475,10 +475,40 @@ DO_ERROR(10, SIGSEGV, "invalid TSS", invalid_TSS) DO_ERROR(11, SIGBUS, "segment not present", segment_not_present) DO_ERROR(12, SIGBUS, "stack segment", stack_segment) -DO_ERROR_INFO(17, SIGBUS, "alignment check", alignment_check, BUS_ADRALN, get_cr2()) +DO_ERROR_INFO(17, SIGBUS, "alignment check", alignment_check, BUS_ADRALN, 0) asmlinkage void do_general_protection(struct pt_regs * regs, long error_code) { + int cpu = get_cpu(); + struct tss_struct *tss = &per_cpu(init_tss, cpu); + struct thread_struct *thread = ¤t->thread; + + /* + * Perform the lazy TSS's I/O bitmap copy. If the TSS has an + * invalid offset set (the LAZY one) and the faulting thread has + * a valid I/O bitmap pointer, we copy the I/O bitmap in the TSS + * and we set the offset field correctly. Then we let the CPU to + * restart the faulting instruction. + */ + if (tss->io_bitmap_base == INVALID_IO_BITMAP_OFFSET_LAZY && + thread->io_bitmap_ptr) { + memcpy(tss->io_bitmap, thread->io_bitmap_ptr, + thread->io_bitmap_max); + /* + * If the previously set map was extending to higher ports + * than the current one, pad extra space with 0xff (no access). + */ + if (thread->io_bitmap_max < tss->io_bitmap_max) + memset((char *) tss->io_bitmap + + thread->io_bitmap_max, 0xff, + tss->io_bitmap_max - thread->io_bitmap_max); + tss->io_bitmap_max = thread->io_bitmap_max; + tss->io_bitmap_base = IO_BITMAP_OFFSET; + put_cpu(); + return; + } + put_cpu(); + if (regs->eflags & VM_MASK) goto gp_in_vm86; diff -Nru a/arch/i386/mach-es7000/es7000.h b/arch/i386/mach-es7000/es7000.h --- a/arch/i386/mach-es7000/es7000.h 2004-09-26 10:25:55 -07:00 +++ b/arch/i386/mach-es7000/es7000.h 2004-09-26 10:25:55 -07:00 @@ -104,6 +104,13 @@ #define MIP_SW_APIC 0x1020b #define MIP_FUNC(VALUE) (VALUE & 0xff) +#if defined(CONFIG_X86_IO_APIC) && (defined(CONFIG_ACPI_INTERPRETER) || defined(CONFIG_ACPI_BOOT)) +#define IOAPIC_GSI_BOUND(ioapic) ((ioapic+1) * (nr_ioapic_registers[ioapic]-1)) +#define MAX_GSI_MAPSIZE 32 +#endif + +extern unsigned long io_apic_irqs; + extern int parse_unisys_oem (char *oemptr, int oem_entries); extern int find_unisys_acpi_oem_table(unsigned long *oem_addr, int *length); extern int es7000_start_cpu(int cpu, unsigned long eip); diff -Nru a/arch/i386/mach-es7000/es7000plat.c b/arch/i386/mach-es7000/es7000plat.c --- a/arch/i386/mach-es7000/es7000plat.c 2004-09-26 10:25:57 -07:00 +++ b/arch/i386/mach-es7000/es7000plat.c 2004-09-26 10:25:57 -07:00 @@ -51,27 +51,74 @@ int mip_port; unsigned long mip_addr, host_addr; +#if defined(CONFIG_X86_IO_APIC) && (defined(CONFIG_ACPI_INTERPRETER) || defined(CONFIG_ACPI_BOOT)) +static unsigned long cycle_irqs = 0; +static unsigned long free_irqs = 0; +static int gsi_map[MAX_GSI_MAPSIZE] = { [0 ... MAX_GSI_MAPSIZE-1] = -1 }; + +/* + * GSI override for ES7000 platforms. + */ + +static int __init +es7000_gsi_override(int ioapic, int gsi) +{ + static int newgsi = 0; + + if (gsi_map[gsi] != -1) + gsi = gsi_map[gsi]; + else if (cycle_irqs ^ free_irqs) { + newgsi = find_next_bit(&cycle_irqs, IOAPIC_GSI_BOUND(0), newgsi); + __set_bit(newgsi, &free_irqs); + gsi_map[gsi] = newgsi; + gsi = newgsi; + newgsi++; + Dprintk("es7000_gsi_override: free_irqs = 0x%lx\n", free_irqs); + } + + return gsi; +} + static int __init es7000_rename_gsi(int ioapic, int gsi) { + static int initialized = 0; + int i; + + /* + * These should NEVER be true at this point but we'd rather be + * safe than sorry. + */ + if (acpi_disabled || acpi_pci_disabled || acpi_noirq) + return gsi; + if (ioapic) - return gsi; - else { - if (gsi == 0) - return 13; - if (gsi == 1) - return 16; - if (gsi == 4) - return 17; - if (gsi == 6) - return 18; - if (gsi == 7) - return 19; - if (gsi == 8) - return 20; - return gsi; - } + return gsi; + + if (!initialized) { + unsigned long tmp_irqs = 0; + + for (i = 0; i < nr_ioapic_registers[0]; i++) + __set_bit(mp_irqs[i].mpc_srcbusirq, &tmp_irqs); + + cycle_irqs = (~tmp_irqs & io_apic_irqs & ((1 << IOAPIC_GSI_BOUND(0)) - 1)); + + initialized = 1; + Dprintk("es7000_rename_gsi: cycle_irqs = 0x%lx\n", cycle_irqs); + } + + for (i = 0; i < nr_ioapic_registers[0]; i++) { + if (mp_irqs[i].mpc_srcbusirq == gsi) { + if (mp_irqs[i].mpc_dstirq == gsi) + return gsi; + else + return es7000_gsi_override(0, gsi); + } + } + + return gsi; } +#endif // (CONFIG_X86_IO_APIC) && (CONFIG_ACPI_INTERPRETER || CONFIG_ACPI_BOOT) /* * Parse the OEM Table @@ -193,7 +240,7 @@ } } } - printk("ES7000: did not find Unisys ACPI OEM table!\n"); + Dprintk("ES7000: did not find Unisys ACPI OEM table!\n"); return -1; } diff -Nru a/arch/i386/mm/init.c b/arch/i386/mm/init.c --- a/arch/i386/mm/init.c 2004-09-26 10:25:57 -07:00 +++ b/arch/i386/mm/init.c 2004-09-26 10:25:57 -07:00 @@ -40,6 +40,8 @@ #include #include +unsigned int __VMALLOC_RESERVE = 128 << 20; + DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); unsigned long highstart_pfn, highend_pfn; diff -Nru a/arch/ia64/Kconfig b/arch/ia64/Kconfig --- a/arch/ia64/Kconfig 2004-09-26 10:25:57 -07:00 +++ b/arch/ia64/Kconfig 2004-09-26 10:25:57 -07:00 @@ -38,6 +38,10 @@ bool default y +config GENERIC_IOMAP + bool + default y + choice prompt "System type" default IA64_GENERIC @@ -72,6 +76,12 @@ config IA64_SGI_SN2 bool "SGI-SN2" + help + Selecting this option will optimize the kernel for use on sn2 based + systems, but the resulting kernel binary will not run on other + types of ia64 systems. If you have an SGI Altix system, it's safe + to select this option. If in doubt, select ia64 generic support + instead. config IA64_HP_SIM bool "Ski-simulator" diff -Nru a/arch/ia64/Makefile b/arch/ia64/Makefile --- a/arch/ia64/Makefile 2004-09-26 10:25:55 -07:00 +++ b/arch/ia64/Makefile 2004-09-26 10:25:55 -07:00 @@ -20,7 +20,7 @@ EXTRA := cflags-y := -pipe $(EXTRA) -ffixed-r13 -mfixed-range=f12-f15,f32-f127 \ - -falign-functions=32 -frename-registers + -falign-functions=32 -frename-registers -fno-optimize-sibling-calls CFLAGS_KERNEL := -mconstant-gp GCC_VERSION := $(call cc-version) diff -Nru a/arch/ia64/configs/sn2_defconfig b/arch/ia64/configs/sn2_defconfig --- a/arch/ia64/configs/sn2_defconfig 2004-09-26 10:25:55 -07:00 +++ b/arch/ia64/configs/sn2_defconfig 2004-09-26 10:25:55 -07:00 @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit -# Linux kernel version: 2.6.9-rc1 -# Fri Aug 27 22:00:00 2004 +# Linux kernel version: 2.6.9-rc2 +# Fri Sep 17 13:58:32 2004 # # @@ -13,6 +13,7 @@ # # General setup # +CONFIG_LOCALVERSION="" CONFIG_SWAP=y CONFIG_SYSVIPC=y CONFIG_POSIX_MQUEUE=y @@ -33,6 +34,8 @@ CONFIG_IOSCHED_DEADLINE=y CONFIG_IOSCHED_CFQ=y # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set +CONFIG_SHMEM=y +# CONFIG_TINY_SHMEM is not set # # Loadable module support @@ -54,6 +57,7 @@ CONFIG_RWSEM_XCHGADD_ALGORITHM=y CONFIG_TIME_INTERPOLATION=y CONFIG_EFI=y +CONFIG_GENERIC_IOMAP=y # CONFIG_IA64_GENERIC is not set # CONFIG_IA64_DIG is not set # CONFIG_IA64_HP_ZX1 is not set @@ -210,7 +214,6 @@ # CONFIG_BLK_DEV_IDEDMA_FORCED is not set CONFIG_IDEDMA_PCI_AUTO=y # CONFIG_IDEDMA_ONLYDISK is not set -CONFIG_BLK_DEV_ADMA=y # CONFIG_BLK_DEV_AEC62XX is not set # CONFIG_BLK_DEV_ALI15X3 is not set # CONFIG_BLK_DEV_AMD74XX is not set @@ -277,7 +280,8 @@ # CONFIG_SCSI_AIC7XXX is not set # CONFIG_SCSI_AIC7XXX_OLD is not set # CONFIG_SCSI_AIC79XX is not set -# CONFIG_SCSI_MEGARAID is not set +# CONFIG_MEGARAID_NEWGEN is not set +# CONFIG_MEGARAID_LEGACY is not set CONFIG_SCSI_SATA=y # CONFIG_SCSI_SATA_SVW is not set # CONFIG_SCSI_ATA_PIIX is not set @@ -334,8 +338,7 @@ # Fusion MPT device support # CONFIG_FUSION=y -CONFIG_FUSION_MAX_SGE=40 -CONFIG_FUSION_ISENSE=m +CONFIG_FUSION_MAX_SGE=128 CONFIG_FUSION_CTL=m # @@ -550,7 +553,6 @@ CONFIG_UNIX98_PTYS=y CONFIG_LEGACY_PTYS=y CONFIG_LEGACY_PTY_COUNT=256 -# CONFIG_QIC02_TAPE is not set # # IPMI @@ -575,6 +577,7 @@ CONFIG_RAW_DRIVER=m # CONFIG_HPET is not set CONFIG_MAX_RAW_DEVS=256 +CONFIG_MMTIMER=y # # I2C support diff -Nru a/arch/ia64/hp/common/sba_iommu.c b/arch/ia64/hp/common/sba_iommu.c --- a/arch/ia64/hp/common/sba_iommu.c 2004-09-26 10:25:55 -07:00 +++ b/arch/ia64/hp/common/sba_iommu.c 2004-09-26 10:25:55 -07:00 @@ -203,6 +203,9 @@ /* clearing pdir to prevent races with allocations. */ unsigned int res_bitshift; /* from the RIGHT! */ unsigned int res_size; /* size of resource map in bytes */ +#ifdef CONFIG_NUMA + unsigned int node; /* node where this IOC lives */ +#endif #if DELAYED_RESOURCE_CNT > 0 spinlock_t saved_lock; /* may want to try to get this on a separate cacheline */ /* than res_lock for bigger systems. */ @@ -1057,7 +1060,24 @@ struct ioc *ioc; void *addr; + ioc = GET_IOC(dev); + ASSERT(ioc); + +#ifdef CONFIG_NUMA + { + struct page *page; + page = alloc_pages_node(ioc->node == MAX_NUMNODES ? + numa_node_id() : ioc->node, flags, + get_order(size)); + + if (unlikely(!page)) + return NULL; + + addr = page_address(page); + } +#else addr = (void *) __get_free_pages(flags, get_order(size)); +#endif if (unlikely(!addr)) return NULL; @@ -1081,8 +1101,6 @@ * If device can't bypass or bypass is disabled, pass the 32bit fake * device to map single to get an iova mapping. */ - ioc = GET_IOC(dev); - ASSERT(ioc); *dma_handle = sba_map_single(&ioc->sac_only_dev->dev, addr, size, 0); return addr; @@ -1799,6 +1817,10 @@ seq_printf(s, "Hewlett Packard %s IOC rev %d.%d\n", ioc->name, ((ioc->rev >> 4) & 0xF), (ioc->rev & 0xF)); +#ifdef CONFIG_NUMA + if (ioc->node != MAX_NUMNODES) + seq_printf(s, "NUMA node : %d\n", ioc->node); +#endif seq_printf(s, "IOVA size : %ld MB\n", ((ioc->pdir_size >> 3) * iovp_size)/(1024*1024)); seq_printf(s, "IOVA page size : %ld kb\n", iovp_size/1024); @@ -1899,6 +1921,58 @@ printk(KERN_WARNING "No IOC for PCI Bus %04x:%02x in ACPI\n", pci_domain_nr(bus), bus->number); } +#ifdef CONFIG_NUMA +static void __init +sba_map_ioc_to_node(struct ioc *ioc, acpi_handle handle) +{ + struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; + union acpi_object *obj; + acpi_handle phandle; + unsigned int node; + + ioc->node = MAX_NUMNODES; + + /* + * Check for a _PXM on this node first. We don't typically see + * one here, so we'll end up getting it from the parent. + */ + if (ACPI_FAILURE(acpi_evaluate_object(handle, "_PXM", NULL, &buffer))) { + if (ACPI_FAILURE(acpi_get_parent(handle, &phandle))) + return; + + /* Reset the acpi buffer */ + buffer.length = ACPI_ALLOCATE_BUFFER; + buffer.pointer = NULL; + + if (ACPI_FAILURE(acpi_evaluate_object(phandle, "_PXM", NULL, + &buffer))) + return; + } + + if (!buffer.length || !buffer.pointer) + return; + + obj = buffer.pointer; + + if (obj->type != ACPI_TYPE_INTEGER || + obj->integer.value >= MAX_PXM_DOMAINS) { + acpi_os_free(buffer.pointer); + return; + } + + node = pxm_to_nid_map[obj->integer.value]; + acpi_os_free(buffer.pointer); + + if (node >= MAX_NUMNODES || !node_online(node)) + return; + + ioc->node = node; + return; +} +#else +#define sba_map_ioc_to_node(ioc, handle) +#endif + static int __init acpi_sba_ioc_add(struct acpi_device *device) { @@ -1941,6 +2015,8 @@ if (!ioc) return 1; + /* setup NUMA node association */ + sba_map_ioc_to_node(ioc, device->handle); return 0; } diff -Nru a/arch/ia64/ia32/binfmt_elf32.c b/arch/ia64/ia32/binfmt_elf32.c --- a/arch/ia64/ia32/binfmt_elf32.c 2004-09-26 10:25:57 -07:00 +++ b/arch/ia64/ia32/binfmt_elf32.c 2004-09-26 10:25:57 -07:00 @@ -48,6 +48,7 @@ extern struct page *ia32_shared_page[]; extern unsigned long *ia32_gdt; +extern struct page *ia32_gate_page; struct page * ia32_install_shared_page (struct vm_area_struct *vma, unsigned long address, int *type) @@ -59,10 +60,25 @@ return pg; } +struct page * +ia32_install_gate_page (struct vm_area_struct *vma, unsigned long address, int *type) +{ + struct page *pg = ia32_gate_page; + get_page(pg); + if (type) + *type = VM_FAULT_MINOR; + return pg; +} + + static struct vm_operations_struct ia32_shared_page_vm_ops = { .nopage = ia32_install_shared_page }; +static struct vm_operations_struct ia32_gate_page_vm_ops = { + .nopage = ia32_install_gate_page +}; + void ia64_elf32_init (struct pt_regs *regs) { @@ -82,6 +98,29 @@ vma->vm_page_prot = PAGE_SHARED; vma->vm_flags = VM_READ|VM_MAYREAD|VM_RESERVED; vma->vm_ops = &ia32_shared_page_vm_ops; + down_write(¤t->mm->mmap_sem); + { + insert_vm_struct(current->mm, vma); + } + up_write(¤t->mm->mmap_sem); + } + + /* + * When user stack is not executable, push sigreturn code to stack makes + * segmentation fault raised when returning to kernel. So now sigreturn + * code is locked in specific gate page, which is pointed by pretcode + * when setup_frame_ia32 + */ + vma = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL); + if (vma) { + memset(vma, 0, sizeof(*vma)); + vma->vm_mm = current->mm; + vma->vm_start = IA32_GATE_OFFSET; + vma->vm_end = vma->vm_start + PAGE_SIZE; + vma->vm_page_prot = PAGE_COPY_EXEC; + vma->vm_flags = VM_READ | VM_MAYREAD | VM_EXEC + | VM_MAYEXEC | VM_RESERVED; + vma->vm_ops = &ia32_gate_page_vm_ops; down_write(¤t->mm->mmap_sem); { insert_vm_struct(current->mm, vma); diff -Nru a/arch/ia64/ia32/ia32_entry.S b/arch/ia64/ia32/ia32_entry.S --- a/arch/ia64/ia32/ia32_entry.S 2004-09-26 10:25:56 -07:00 +++ b/arch/ia64/ia32/ia32_entry.S 2004-09-26 10:25:56 -07:00 @@ -311,7 +311,7 @@ data8 sys_ni_syscall /* old profil syscall holder */ data8 compat_sys_statfs data8 compat_sys_fstatfs /* 100 */ - data8 sys32_ioperm + data8 sys_ni_syscall /* ioperm */ data8 compat_sys_socketcall data8 sys_syslog data8 compat_sys_setitimer @@ -320,7 +320,7 @@ data8 compat_sys_newlstat data8 compat_sys_newfstat data8 sys_ni_syscall - data8 sys32_iopl /* 110 */ + data8 sys_ni_syscall /* iopl */ /* 110 */ data8 sys_vhangup data8 sys_ni_syscall /* used to be sys_idle */ data8 sys_ni_syscall diff -Nru a/arch/ia64/ia32/ia32_signal.c b/arch/ia64/ia32/ia32_signal.c --- a/arch/ia64/ia32/ia32_signal.c 2004-09-26 10:25:55 -07:00 +++ b/arch/ia64/ia32/ia32_signal.c 2004-09-26 10:25:55 -07:00 @@ -853,14 +853,19 @@ unsigned int restorer = IA32_SA_RESTORER(ka); err |= __put_user(restorer, &frame->pretcode); } else { - err |= __put_user((long)frame->retcode, &frame->pretcode); - /* This is popl %eax ; movl $,%eax ; int $0x80 */ - err |= __put_user(0xb858, (short *)(frame->retcode+0)); - err |= __put_user(__IA32_NR_sigreturn & 0xffff, (short *)(frame->retcode+2)); - err |= __put_user(__IA32_NR_sigreturn >> 16, (short *)(frame->retcode+4)); - err |= __put_user(0x80cd, (short *)(frame->retcode+6)); + /* Pointing to restorer in ia32 gate page */ + err |= __put_user(IA32_GATE_OFFSET, &frame->pretcode); } + /* This is popl %eax ; movl $,%eax ; int $0x80 + * and there for historical reasons only. + * See arch/i386/kernel/signal.c + */ + + err |= __put_user(0xb858, (short *)(frame->retcode+0)); + err |= __put_user(__IA32_NR_sigreturn, (int *)(frame->retcode+2)); + err |= __put_user(0x80cd, (short *)(frame->retcode+6)); + if (err) goto give_sigsegv; @@ -922,12 +927,18 @@ unsigned int restorer = IA32_SA_RESTORER(ka); err |= __put_user(restorer, &frame->pretcode); } else { - err |= __put_user((long)frame->retcode, &frame->pretcode); - /* This is movl $,%eax ; int $0x80 */ - err |= __put_user(0xb8, (char *)(frame->retcode+0)); - err |= __put_user(__IA32_NR_rt_sigreturn, (int *)(frame->retcode+1)); - err |= __put_user(0x80cd, (short *)(frame->retcode+5)); + /* Pointing to rt_restorer in ia32 gate page */ + err |= __put_user(IA32_GATE_OFFSET + 8, &frame->pretcode); } + + /* This is movl $,%eax ; int $0x80 + * and there for historical reasons only. + * See arch/i386/kernel/signal.c + */ + + err |= __put_user(0xb8, (char *)(frame->retcode+0)); + err |= __put_user(__IA32_NR_rt_sigreturn, (int *)(frame->retcode+1)); + err |= __put_user(0x80cd, (short *)(frame->retcode+5)); if (err) goto give_sigsegv; diff -Nru a/arch/ia64/ia32/ia32_support.c b/arch/ia64/ia32/ia32_support.c --- a/arch/ia64/ia32/ia32_support.c 2004-09-26 10:25:55 -07:00 +++ b/arch/ia64/ia32/ia32_support.c 2004-09-26 10:25:55 -07:00 @@ -33,6 +33,7 @@ struct page *ia32_shared_page[NR_CPUS]; unsigned long *ia32_boot_gdt; unsigned long *cpu_gdt_table[NR_CPUS]; +struct page *ia32_gate_page; static unsigned long load_desc (u16 selector) @@ -158,7 +159,7 @@ /* * Setup IA32 GDT and TSS */ -void +static void ia32_boot_gdt_init (void) { unsigned long ldt_size; @@ -172,12 +173,12 @@ /* CS descriptor in IA-32 (scrambled) format */ ia32_boot_gdt[__USER_CS >> 3] - = IA32_SEG_DESCRIPTOR(0, (IA32_PAGE_OFFSET-1) >> IA32_PAGE_SHIFT, + = IA32_SEG_DESCRIPTOR(0, (IA32_GATE_END-1) >> IA32_PAGE_SHIFT, 0xb, 1, 3, 1, 1, 1, 1); /* DS descriptor in IA-32 (scrambled) format */ ia32_boot_gdt[__USER_DS >> 3] - = IA32_SEG_DESCRIPTOR(0, (IA32_PAGE_OFFSET-1) >> IA32_PAGE_SHIFT, + = IA32_SEG_DESCRIPTOR(0, (IA32_GATE_END-1) >> IA32_PAGE_SHIFT, 0x3, 1, 3, 1, 1, 1, 1); ldt_size = PAGE_ALIGN(IA32_LDT_ENTRIES*IA32_LDT_ENTRY_SIZE); @@ -185,6 +186,27 @@ 0xb, 0, 3, 1, 1, 1, 0); ia32_boot_gdt[LDT_ENTRY] = IA32_SEG_DESCRIPTOR(IA32_LDT_OFFSET, ldt_size - 1, 0x2, 0, 3, 1, 1, 1, 0); +} + +static void +ia32_gate_page_init(void) +{ + unsigned long *sr; + + ia32_gate_page = alloc_page(GFP_KERNEL); + sr = page_address(ia32_gate_page); + /* This is popl %eax ; movl $,%eax ; int $0x80 */ + *sr++ = 0xb858 | (__IA32_NR_sigreturn << 16) | (0x80cdUL << 48); + + /* This is movl $,%eax ; int $0x80 */ + *sr = 0xb8 | (__IA32_NR_rt_sigreturn << 8) | (0x80cdUL << 40); +} + +void +ia32_mem_init(void) +{ + ia32_boot_gdt_init(); + ia32_gate_page_init(); } /* diff -Nru a/arch/ia64/ia32/ia32priv.h b/arch/ia64/ia32/ia32priv.h --- a/arch/ia64/ia32/ia32priv.h 2004-09-26 10:25:57 -07:00 +++ b/arch/ia64/ia32/ia32priv.h 2004-09-26 10:25:57 -07:00 @@ -168,6 +168,9 @@ #define IA32_SA_HANDLER(ka) ((unsigned long) (ka)->sa.sa_handler & 0xffffffff) #define IA32_SA_RESTORER(ka) ((unsigned long) (ka)->sa.sa_handler >> 32) +#define __IA32_NR_sigreturn 119 +#define __IA32_NR_rt_sigreturn 173 + struct sigaction32 { unsigned int sa_handler; /* Really a pointer, but need to deal with 32 bits */ unsigned int sa_flags; @@ -324,14 +327,16 @@ #define IA32_PAGE_OFFSET 0xc0000000 #define IA32_STACK_TOP IA32_PAGE_OFFSET +#define IA32_GATE_OFFSET IA32_PAGE_OFFSET +#define IA32_GATE_END IA32_PAGE_OFFSET + PAGE_SIZE /* * The system segments (GDT, TSS, LDT) have to be mapped below 4GB so the IA-32 engine can * access them. */ -#define IA32_GDT_OFFSET (IA32_PAGE_OFFSET) -#define IA32_TSS_OFFSET (IA32_PAGE_OFFSET + PAGE_SIZE) -#define IA32_LDT_OFFSET (IA32_PAGE_OFFSET + 2*PAGE_SIZE) +#define IA32_GDT_OFFSET (IA32_PAGE_OFFSET + PAGE_SIZE) +#define IA32_TSS_OFFSET (IA32_PAGE_OFFSET + 2*PAGE_SIZE) +#define IA32_LDT_OFFSET (IA32_PAGE_OFFSET + 3*PAGE_SIZE) #define ELF_EXEC_PAGESIZE IA32_PAGE_SIZE diff -Nru a/arch/ia64/ia32/sys_ia32.c b/arch/ia64/ia32/sys_ia32.c --- a/arch/ia64/ia32/sys_ia32.c 2004-09-26 10:25:56 -07:00 +++ b/arch/ia64/ia32/sys_ia32.c 2004-09-26 10:25:56 -07:00 @@ -1913,73 +1913,6 @@ return ret; } -/* - * The IA64 maps 4 I/O ports for each 4K page - */ -#define IOLEN ((65536 / 4) * 4096) - -asmlinkage long -sys32_iopl (int level) -{ - extern unsigned long ia64_iobase; - int fd; - struct file * file; - unsigned int old; - unsigned long addr; - mm_segment_t old_fs = get_fs (); - - if (level != 3) - return(-EINVAL); - /* Trying to gain more privileges? */ - old = ia64_getreg(_IA64_REG_AR_EFLAG); - if ((unsigned int) level > ((old >> 12) & 3)) { - if (!capable(CAP_SYS_RAWIO)) - return -EPERM; - } - set_fs(KERNEL_DS); - fd = sys_open("/dev/mem", O_SYNC | O_RDWR, 0); - set_fs(old_fs); - if (fd < 0) - return fd; - file = fget(fd); - if (file == NULL) { - sys_close(fd); - return(-EFAULT); - } - - down_write(¤t->mm->mmap_sem); - addr = do_mmap_pgoff(file, IA32_IOBASE, - IOLEN, PROT_READ|PROT_WRITE, MAP_SHARED, - (ia64_iobase & ~PAGE_OFFSET) >> PAGE_SHIFT); - up_write(¤t->mm->mmap_sem); - - if (addr >= 0) { - old = (old & ~0x3000) | (level << 12); - ia64_setreg(_IA64_REG_AR_EFLAG, old); - } - - fput(file); - sys_close(fd); - return 0; -} - -asmlinkage long -sys32_ioperm (unsigned int from, unsigned int num, int on) -{ - - /* - * Since IA64 doesn't have permission bits we'd have to go to - * a lot of trouble to simulate them in software. There's - * no point, only trusted programs can make this call so we'll - * just turn it into an iopl call and let the process have - * access to all I/O ports. - * - * XXX proper ioperm() support should be emulated by - * manipulating the page protections... - */ - return sys32_iopl(3); -} - typedef struct { unsigned int ss_sp; unsigned int ss_flags; diff -Nru a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c --- a/arch/ia64/kernel/acpi.c 2004-09-26 10:25:56 -07:00 +++ b/arch/ia64/kernel/acpi.c 2004-09-26 10:25:56 -07:00 @@ -650,4 +650,71 @@ return 0; } +#ifdef CONFIG_NUMA +acpi_status __init +acpi_map_iosapic (acpi_handle handle, u32 depth, void *context, void **ret) +{ + struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; + union acpi_object *obj; + struct acpi_table_iosapic *iosapic; + unsigned int gsi_base; + int node; + + /* Only care about objects w/ a method that returns the MADT */ + if (ACPI_FAILURE(acpi_evaluate_object(handle, "_MAT", NULL, &buffer))) + return AE_OK; + + if (!buffer.length || !buffer.pointer) + return AE_OK; + + obj = buffer.pointer; + if (obj->type != ACPI_TYPE_BUFFER || + obj->buffer.length < sizeof(*iosapic)) { + acpi_os_free(buffer.pointer); + return AE_OK; + } + + iosapic = (struct acpi_table_iosapic *)obj->buffer.pointer; + + if (iosapic->header.type != ACPI_MADT_IOSAPIC) { + acpi_os_free(buffer.pointer); + return AE_OK; + } + + gsi_base = iosapic->global_irq_base; + + acpi_os_free(buffer.pointer); + buffer.length = ACPI_ALLOCATE_BUFFER; + buffer.pointer = NULL; + + /* + * OK, it's an IOSAPIC MADT entry, look for a _PXM method to tell + * us which node to associate this with. + */ + if (ACPI_FAILURE(acpi_evaluate_object(handle, "_PXM", NULL, &buffer))) + return AE_OK; + + if (!buffer.length || !buffer.pointer) + return AE_OK; + + obj = buffer.pointer; + + if (obj->type != ACPI_TYPE_INTEGER || + obj->integer.value >= MAX_PXM_DOMAINS) { + acpi_os_free(buffer.pointer); + return AE_OK; + } + + node = pxm_to_nid_map[obj->integer.value]; + acpi_os_free(buffer.pointer); + + if (node >= MAX_NUMNODES || !node_online(node) || + cpus_empty(node_to_cpumask(node))) + return AE_OK; + + /* We know a gsi to node mapping! */ + map_iosapic_to_node(gsi_base, node); + return AE_OK; +} +#endif /* CONFIG_NUMA */ #endif /* CONFIG_ACPI_BOOT */ diff -Nru a/arch/ia64/kernel/iosapic.c b/arch/ia64/kernel/iosapic.c --- a/arch/ia64/kernel/iosapic.c 2004-09-26 10:25:56 -07:00 +++ b/arch/ia64/kernel/iosapic.c 2004-09-26 10:25:56 -07:00 @@ -117,6 +117,9 @@ char *addr; /* base address of IOSAPIC */ unsigned int gsi_base; /* first GSI assigned to this IOSAPIC */ unsigned short num_rte; /* number of RTE in this IOSAPIC */ +#ifdef CONFIG_NUMA + unsigned short node; /* numa node association via pxm */ +#endif } iosapic_lists[NR_IOSAPICS]; static int num_iosapic; @@ -488,7 +491,7 @@ } static unsigned int -get_target_cpu (void) +get_target_cpu (unsigned int gsi, int vector) { #ifdef CONFIG_SMP static int cpu = -1; @@ -507,6 +510,34 @@ if (!cpu_online(smp_processor_id())) return hard_smp_processor_id(); +#ifdef CONFIG_NUMA + { + int num_cpus, cpu_index, iosapic_index, numa_cpu, i = 0; + cpumask_t cpu_mask; + + iosapic_index = find_iosapic(gsi); + if (iosapic_index < 0 || + iosapic_lists[iosapic_index].node == MAX_NUMNODES) + goto skip_numa_setup; + + cpu_mask = node_to_cpumask(iosapic_lists[iosapic_index].node); + + num_cpus = cpus_weight(cpu_mask); + + if (!num_cpus) + goto skip_numa_setup; + + /* Use vector assigment to distribute across cpus in node */ + cpu_index = vector % num_cpus; + + for (numa_cpu = first_cpu(cpu_mask) ; i < cpu_index ; i++) + numa_cpu = next_cpu(numa_cpu, cpu_mask); + + if (numa_cpu != NR_CPUS) + return cpu_physical_id(numa_cpu); + } +skip_numa_setup: +#endif /* * Otherwise, round-robin interrupt vectors across all the * processors. (It'd be nice if we could be smarter in the @@ -550,7 +581,7 @@ } vector = assign_irq_vector(AUTO_ASSIGN); - dest = get_target_cpu(); + dest = get_target_cpu(gsi, vector); register_intr(gsi, vector, IOSAPIC_LOWEST_PRIORITY, polarity, trigger); } @@ -680,6 +711,9 @@ iosapic_lists[num_iosapic].addr = addr; iosapic_lists[num_iosapic].gsi_base = gsi_base; iosapic_lists[num_iosapic].num_rte = num_rte; +#ifdef CONFIG_NUMA + iosapic_lists[num_iosapic].node = MAX_NUMNODES; +#endif num_iosapic++; if ((gsi_base == 0) && pcat_compat) { @@ -692,3 +726,20 @@ iosapic_override_isa_irq(isa_irq, isa_irq, IOSAPIC_POL_HIGH, IOSAPIC_EDGE); } } + +#ifdef CONFIG_NUMA +void __init +map_iosapic_to_node(unsigned int gsi_base, int node) +{ + int index; + + index = find_iosapic(gsi_base); + if (index < 0) { + printk(KERN_WARNING "%s: No IOSAPIC for GSI %u\n", + __FUNCTION__, gsi_base); + return; + } + iosapic_lists[index].node = node; + return; +} +#endif diff -Nru a/arch/ia64/kernel/minstate.h b/arch/ia64/kernel/minstate.h --- a/arch/ia64/kernel/minstate.h 2004-09-26 10:25:57 -07:00 +++ b/arch/ia64/kernel/minstate.h 2004-09-26 10:25:57 -07:00 @@ -54,8 +54,7 @@ (pUStk) mov ar.rsc=0x3; /* set eager mode, pl 0, little-endian, loadrs=0 */ \ #define MINSTATE_END_SAVE_MIN_PHYS \ - or r12=r12,r14; /* make sp a kernel virtual address */ \ - or r13=r13,r14; /* make `current' a kernel virtual address */ \ + dep r12=-1,r12,61,3; /* make sp a kernel virtual address */ \ ;; #ifdef MINSTATE_VIRT @@ -65,7 +64,7 @@ #endif #ifdef MINSTATE_PHYS -# define MINSTATE_GET_CURRENT(reg) mov reg=IA64_KR(CURRENT);; dep reg=0,reg,61,3 +# define MINSTATE_GET_CURRENT(reg) mov reg=IA64_KR(CURRENT);; tpa reg=reg # define MINSTATE_START_SAVE_MIN MINSTATE_START_SAVE_MIN_PHYS # define MINSTATE_END_SAVE_MIN MINSTATE_END_SAVE_MIN_PHYS #endif @@ -172,7 +171,6 @@ ;; \ .mem.offset 0,0; st8.spill [r16]=r15,16; \ .mem.offset 8,0; st8.spill [r17]=r14,16; \ - dep r14=-1,r0,61,3; \ ;; \ .mem.offset 0,0; st8.spill [r16]=r2,16; \ .mem.offset 8,0; st8.spill [r17]=r3,16; \ diff -Nru a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c --- a/arch/ia64/kernel/process.c 2004-09-26 10:25:56 -07:00 +++ b/arch/ia64/kernel/process.c 2004-09-26 10:25:56 -07:00 @@ -228,18 +228,26 @@ /* endless idle loop with no priority at all */ while (1) { - void (*idle)(void) = pm_idle; - if (!idle) - idle = default_idle; - #ifdef CONFIG_SMP if (!need_resched()) min_xtp(); #endif while (!need_resched()) { + void (*idle)(void); + if (mark_idle) (*mark_idle)(1); + /* + * Mark this as an RCU critical section so that + * synchronize_kernel() in the unload path waits + * for our completion. + */ + rcu_read_lock(); + idle = pm_idle; + if (!idle) + idle = default_idle; (*idle)(); + rcu_read_unlock(); } if (mark_idle) diff -Nru a/arch/ia64/kernel/salinfo.c b/arch/ia64/kernel/salinfo.c --- a/arch/ia64/kernel/salinfo.c 2004-09-26 10:25:57 -07:00 +++ b/arch/ia64/kernel/salinfo.c 2004-09-26 10:25:57 -07:00 @@ -417,7 +417,12 @@ if (!data->saved_num) call_on_cpu(cpu, salinfo_log_read_cpu, data); - data->state = data->log_size ? STATE_LOG_RECORD : STATE_NO_DATA; + if (!data->log_size) { + data->state = STATE_NO_DATA; + clear_bit(cpu, &data->cpu_event); + } else { + data->state = STATE_LOG_RECORD; + } } static ssize_t diff -Nru a/arch/ia64/kernel/smpboot.c b/arch/ia64/kernel/smpboot.c --- a/arch/ia64/kernel/smpboot.c 2004-09-26 10:25:55 -07:00 +++ b/arch/ia64/kernel/smpboot.c 2004-09-26 10:25:55 -07:00 @@ -356,7 +356,7 @@ return cpu_idle(); } -struct pt_regs * __init idle_regs(struct pt_regs *regs) +struct pt_regs * __devinit idle_regs(struct pt_regs *regs) { return NULL; } diff -Nru a/arch/ia64/mm/discontig.c b/arch/ia64/mm/discontig.c --- a/arch/ia64/mm/discontig.c 2004-09-26 10:25:57 -07:00 +++ b/arch/ia64/mm/discontig.c 2004-09-26 10:25:57 -07:00 @@ -53,11 +53,12 @@ static void __init reassign_cpu_only_nodes(void) { struct node_memblk_s *p; - int i, j, k, nnode, nid, cpu, cpunid; + int i, j, k, nnode, nid, cpu, cpunid, pxm; u8 cslit, slit; static DECLARE_BITMAP(nodes_with_mem, NR_NODES) __initdata; static u8 numa_slit_fix[MAX_NUMNODES * MAX_NUMNODES] __initdata; static int node_flip[NR_NODES] __initdata; + static int old_nid_map[NR_CPUS] __initdata; for (nnode = 0, p = &node_memblk[0]; p < &node_memblk[num_node_memblks]; p++) if (!test_bit(p->nid, (void *) nodes_with_mem)) { @@ -104,9 +105,14 @@ for (cpu = 0; cpu < NR_CPUS; cpu++) if (node_cpuid[cpu].nid == i) { - /* For nodes not being reassigned just fix the cpu's nid. */ + /* + * For nodes not being reassigned just + * fix the cpu's nid and reverse pxm map + */ if (cpunid < numnodes) { - node_cpuid[cpu].nid = cpunid; + pxm = nid_to_pxm_map[i]; + pxm_to_nid_map[pxm] = + node_cpuid[cpu].nid = cpunid; continue; } @@ -126,6 +132,8 @@ } } + /* save old nid map so we can update the pxm */ + old_nid_map[cpu] = node_cpuid[cpu].nid; node_cpuid[cpu].nid = k; } } @@ -134,14 +142,19 @@ * Fixup temporary nid values for CPU-only nodes. */ for (cpu = 0; cpu < NR_CPUS; cpu++) - if (node_cpuid[cpu].nid == (numnodes + numnodes)) - node_cpuid[cpu].nid = nnode - 1; - else - for (i = 0; i < nnode; i++) - if (node_flip[i] == (node_cpuid[cpu].nid - numnodes)) { - node_cpuid[cpu].nid = i; - break; - } + if (node_cpuid[cpu].nid == (numnodes + numnodes)) { + pxm = nid_to_pxm_map[old_nid_map[cpu]]; + pxm_to_nid_map[pxm] = node_cpuid[cpu].nid = nnode - 1; + } else { + for (i = 0; i < nnode; i++) { + if (node_flip[i] != (node_cpuid[cpu].nid - numnodes)) + continue; + + pxm = nid_to_pxm_map[old_nid_map[cpu]]; + pxm_to_nid_map[pxm] = node_cpuid[cpu].nid = i; + break; + } + } /* * Fix numa_slit by compressing from larger diff -Nru a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c --- a/arch/ia64/mm/init.c 2004-09-26 10:25:56 -07:00 +++ b/arch/ia64/mm/init.c 2004-09-26 10:25:56 -07:00 @@ -587,6 +587,6 @@ setup_gate(); #ifdef CONFIG_IA32_SUPPORT - ia32_boot_gdt_init(); + ia32_mem_init(); #endif } diff -Nru a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c --- a/arch/ia64/pci/pci.c 2004-09-26 10:25:56 -07:00 +++ b/arch/ia64/pci/pci.c 2004-09-26 10:25:56 -07:00 @@ -136,6 +136,11 @@ printk(KERN_INFO "PCI: Using ACPI for IRQ routing\n"); +#ifdef CONFIG_NUMA +extern acpi_status acpi_map_iosapic (acpi_handle, u32, void*, void**); + + acpi_get_devices(NULL, acpi_map_iosapic, NULL, NULL); +#endif /* * PCI IRQ routing is set up by pci_enable_device(), but we * also do it here in case there are still broken drivers that diff -Nru a/arch/ia64/sn/io/machvec/pci_bus_cvlink.c b/arch/ia64/sn/io/machvec/pci_bus_cvlink.c --- a/arch/ia64/sn/io/machvec/pci_bus_cvlink.c 2004-09-26 10:25:57 -07:00 +++ b/arch/ia64/sn/io/machvec/pci_bus_cvlink.c 2004-09-26 10:25:57 -07:00 @@ -357,7 +357,20 @@ if (dev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_MEM) cmd |= PCI_COMMAND_MEMORY; } - } + } else { + /* + * Remove other ROM resources since they don't have valid + * CPU addresses. + */ + size = dev->resource[PCI_ROM_RESOURCE].end - + dev->resource[PCI_ROM_RESOURCE].start; + + if (size) { + dev->resource[PCI_ROM_RESOURCE].start = 0; + dev->resource[PCI_ROM_RESOURCE].end = 0; + dev->resource[PCI_ROM_RESOURCE].flags = 0; + } + } /* * Update the Command Word on the Card. diff -Nru a/arch/ia64/sn/kernel/setup.c b/arch/ia64/sn/kernel/setup.c --- a/arch/ia64/sn/kernel/setup.c 2004-09-26 10:25:55 -07:00 +++ b/arch/ia64/sn/kernel/setup.c 2004-09-26 10:25:55 -07:00 @@ -64,6 +64,8 @@ unsigned long sn_rtc_cycles_per_second; +EXPORT_SYMBOL(sn_rtc_cycles_per_second); + partid_t sn_partid = -1; char sn_system_serial_number_string[128]; u64 sn_partition_serial_number; diff -Nru a/arch/ia64/sn/kernel/sn2/Makefile b/arch/ia64/sn/kernel/sn2/Makefile --- a/arch/ia64/sn/kernel/sn2/Makefile 2004-09-26 10:25:57 -07:00 +++ b/arch/ia64/sn/kernel/sn2/Makefile 2004-09-26 10:25:57 -07:00 @@ -10,4 +10,4 @@ # obj-y += cache.o io.o ptc_deadlock.o sn2_smp.o sn_proc_fs.o \ - prominfo_proc.o timer.o timer_interrupt.o + prominfo_proc.o timer.o timer_interrupt.o sn_hwperf.o diff -Nru a/arch/ia64/sn/kernel/sn2/prominfo_proc.c b/arch/ia64/sn/kernel/sn2/prominfo_proc.c --- a/arch/ia64/sn/kernel/sn2/prominfo_proc.c 2004-09-26 10:25:55 -07:00 +++ b/arch/ia64/sn/kernel/sn2/prominfo_proc.c 2004-09-26 10:25:55 -07:00 @@ -222,7 +222,7 @@ { int nentries; int fentry; - unsigned long qw; + unsigned long qw = 0; int len; nasid_t nasid = NASID_GET(fit); diff -Nru a/arch/ia64/sn/kernel/sn2/sn_hwperf.c b/arch/ia64/sn/kernel/sn2/sn_hwperf.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/ia64/sn/kernel/sn2/sn_hwperf.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,652 @@ +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 2004 Silicon Graphics, Inc. All rights reserved. + * + * SGI Altix topology and hardware performance monitoring API. + * Mark Goodwin . + * + * Creates /proc/sgi_sn/sn_topology (read-only) to export + * info about Altix nodes, routers, CPUs and NumaLink + * interconnection/topology. + * + * Also creates a dynamic misc device named "sn_hwperf" + * that supports an ioctl interface to call down into SAL + * to discover hw objects, topology and to read/write + * memory mapped registers, e.g. for performance monitoring. + * The "sn_hwperf" device is registered only after the procfs + * file is first opened, i.e. only if/when it's needed. + * + * This API is used by SGI Performance Co-Pilot and other + * tools, see http://oss.sgi.com/projects/pcp + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void *sn_hwperf_salheap = NULL; +static int sn_hwperf_obj_cnt = 0; +static nasid_t sn_hwperf_master_nasid = INVALID_NASID; +static int sn_hwperf_init(void); +static DECLARE_MUTEX(sn_hwperf_init_mutex); + +static int sn_hwperf_enum_objects(int *nobj, struct sn_hwperf_object_info **ret) +{ + int e; + u64 sz; + struct sn_hwperf_object_info *objbuf = NULL; + + if ((e = sn_hwperf_init()) < 0) { + printk("sn_hwperf_init failed: err %d\n", e); + goto out; + } + + sz = sn_hwperf_obj_cnt * sizeof(struct sn_hwperf_object_info); + if ((objbuf = (struct sn_hwperf_object_info *) vmalloc(sz)) == NULL) { + printk("sn_hwperf_enum_objects: vmalloc(%d) failed\n", (int)sz); + e = -ENOMEM; + goto out; + } + + e = ia64_sn_hwperf_op(sn_hwperf_master_nasid, SN_HWPERF_ENUM_OBJECTS, + 0, sz, (u64) objbuf, 0, 0, NULL); + if (e != SN_HWPERF_OP_OK) { + e = -EINVAL; + vfree(objbuf); + } + +out: + *nobj = sn_hwperf_obj_cnt; + *ret = objbuf; + return e; +} + +static int sn_hwperf_geoid_to_cnode(char *location) +{ + int cnode; + int mod, slot, slab; + int cmod, cslot, cslab; + + if (sscanf(location, "%03dc%02d#%d", &mod, &slot, &slab) != 3) + return -1; + for (cnode = 0; cnode < numnodes; cnode++) { + /* XXX: need a better way than this ... */ + if (sscanf(NODEPDA(cnode)->hwg_node_name, + "hw/module/%03dc%02d/slab/%d", &cmod, &cslot, &cslab) == 3) { + if (mod == cmod && slot == cslot && slab == cslab) + break; + } + } + + return cnode < numnodes ? cnode : -1; +} + +static int sn_hwperf_obj_to_cnode(struct sn_hwperf_object_info * obj) +{ + if (!obj->sn_hwp_this_part) + return -1; + return sn_hwperf_geoid_to_cnode(obj->location); +} + +static int sn_hwperf_generic_ordinal(struct sn_hwperf_object_info *obj, + struct sn_hwperf_object_info *objs) +{ + int ordinal; + struct sn_hwperf_object_info *p; + + for (ordinal=0, p=objs; p != obj; p++) { + if (SN_HWPERF_FOREIGN(p)) + continue; + if (p->location[3] == obj->location[3]) + ordinal++; + } + + return ordinal; +} + +#ifndef MODULE_IOBRICK +/* this will be available when ioif TIO support is added */ +#define MODULE_IOBRICK (MODULE_OPUSBRICK+1) +#endif + +static const char *sn_hwperf_get_brickname(struct sn_hwperf_object_info *obj, + struct sn_hwperf_object_info *objs, int *ordinal) +{ + int i; + const char *objtype = NULL; + + for (i=0; i < MAX_BRICK_TYPES; i++) { + if (brick_types[i] != obj->location[3]) + continue; + switch (i) { + case MODULE_CBRICK: + objtype = "node"; + *ordinal = sn_hwperf_obj_to_cnode(obj); /* cnodeid */ + break; + + case MODULE_RBRICK: + objtype = "router"; + *ordinal = sn_hwperf_generic_ordinal(obj, objs); + break; + + case MODULE_IOBRICK: + objtype = "ionode"; + *ordinal = sn_hwperf_generic_ordinal(obj, objs); + break; + } + break; + } + + if (i == MAX_BRICK_TYPES) { + objtype = "other"; + *ordinal = sn_hwperf_generic_ordinal(obj, objs); + } + + return objtype; +} + +static int sn_topology_show(struct seq_file *s, void *d) +{ + int sz; + int pt; + int e; + int i; + int j; + const char *brickname; + int ordinal; + cpumask_t cpumask; + char slice; + struct cpuinfo_ia64 *c; + struct sn_hwperf_port_info *ptdata; + struct sn_hwperf_object_info *p; + struct sn_hwperf_object_info *obj = d; /* this object */ + struct sn_hwperf_object_info *objs = s->private; /* all objects */ + + if (obj == objs) { + seq_printf(s, "# sn_topology version 1\n"); + seq_printf(s, "# objtype ordinal location partition" + " [attribute value [, ...]]\n"); + } + + if (SN_HWPERF_FOREIGN(obj)) { + /* private in another partition: not interesting */ + return 0; + } + + for (i = 0; obj->name[i]; i++) { + if (obj->name[i] == ' ') + obj->name[i] = '_'; + } + + brickname = sn_hwperf_get_brickname(obj, objs, &ordinal); + seq_printf(s, "%s %d %s %s asic %s", brickname, ordinal, obj->location, + obj->sn_hwp_this_part ? "local" : "shared", obj->name); + + if (obj->location[3] != 'c') + seq_putc(s, '\n'); + else { + seq_printf(s, ", nasid 0x%x", cnodeid_to_nasid(ordinal)); + for (i=0; i < numnodes; i++) { + seq_printf(s, i ? ":%d" : ", dist %d", + node_distance(ordinal, i)); + } + seq_putc(s, '\n'); + + /* + * CPUs on this node + */ + cpumask = node_to_cpumask(ordinal); + for_each_online_cpu(i) { + if (cpu_isset(i, cpumask)) { + slice = 'a' + cpuid_to_slice(i); + c = cpu_data(i); + seq_printf(s, "cpu %d %s%c local" + " freq %luMHz, arch ia64", + i, obj->location, slice, + c->proc_freq / 1000000); + for_each_online_cpu(j) { + seq_printf(s, j ? ":%d" : ", dist %d", + node_distance( + cpuid_to_cnodeid(i), + cpuid_to_cnodeid(j))); + } + seq_putc(s, '\n'); + } + } + } + + if (obj->ports) { + /* + * numalink ports + */ + sz = obj->ports * sizeof(struct sn_hwperf_port_info); + if ((ptdata = vmalloc(sz)) == NULL) + return -ENOMEM; + e = ia64_sn_hwperf_op(sn_hwperf_master_nasid, + SN_HWPERF_ENUM_PORTS, obj->id, sz, + (u64) ptdata, 0, 0, NULL); + if (e != SN_HWPERF_OP_OK) + return -EINVAL; + for (ordinal=0, p=objs; p != obj; p++) { + if (!SN_HWPERF_FOREIGN(p)) + ordinal += p->ports; + } + for (pt = 0; pt < obj->ports; pt++) { + for (p = objs, i = 0; i < sn_hwperf_obj_cnt; i++, p++) { + if (ptdata[pt].conn_id == p->id) { + break; + } + } + if (i >= sn_hwperf_obj_cnt) + continue; + seq_printf(s, "numalink %d %s-%d", + ordinal+pt, obj->location, ptdata[pt].port); + + if (obj->sn_hwp_this_part && p->sn_hwp_this_part) + /* both ends local to this partition */ + seq_puts(s, " local"); + else if (!obj->sn_hwp_this_part && !p->sn_hwp_this_part) + /* both ends of the link in foreign partiton */ + seq_puts(s, " foreign"); + else + /* link straddles a partition */ + seq_puts(s, " shared"); + + /* + * Unlikely, but strictly should query the LLP config + * registers because an NL4R can be configured to run + * NL3 protocol, even when not talking to an NL3 router. + * Ditto for node-node. + */ + seq_printf(s, " endpoint %s-%d, protocol %s\n", + p->location, ptdata[pt].conn_port, + strcmp(obj->name, "NL3Router") == 0 || + strcmp(p->name, "NL3Router") == 0 ? + "LLP3" : "LLP4"); + } + vfree(ptdata); + } + + return 0; +} + +static void *sn_topology_start(struct seq_file *s, loff_t * pos) +{ + struct sn_hwperf_object_info *objs = s->private; + + if (*pos < sn_hwperf_obj_cnt) + return (void *)(objs + *pos); + + return NULL; +} + +static void *sn_topology_next(struct seq_file *s, void *v, loff_t * pos) +{ + ++*pos; + return sn_topology_start(s, pos); +} + +static void sn_topology_stop(struct seq_file *m, void *v) +{ + return; +} + +/* + * /proc/sgi_sn/sn_topology, read-only using seq_file + */ +static struct seq_operations sn_topology_seq_ops = { + .start = sn_topology_start, + .next = sn_topology_next, + .stop = sn_topology_stop, + .show = sn_topology_show +}; + +struct sn_hwperf_op_info { + u64 op; + struct sn_hwperf_ioctl_args *a; + void *p; + int *v0; + int ret; +}; + +static void sn_hwperf_call_sal(void *info) +{ + struct sn_hwperf_op_info *op_info = info; + int r; + + r = ia64_sn_hwperf_op(sn_hwperf_master_nasid, op_info->op, + op_info->a->arg, op_info->a->sz, + (u64) op_info->p, 0, 0, op_info->v0); + op_info->ret = r; +} + +static int sn_hwperf_op_cpu(struct sn_hwperf_op_info *op_info) +{ + u32 cpu; + u32 use_ipi; + int r = 0; + cpumask_t save_allowed; + + cpu = (op_info->a->arg & SN_HWPERF_ARG_CPU_MASK) >> 32; + use_ipi = op_info->a->arg & SN_HWPERF_ARG_USE_IPI_MASK; + op_info->a->arg &= SN_HWPERF_ARG_OBJID_MASK; + + if (cpu != SN_HWPERF_ARG_ANY_CPU) { + if (cpu >= num_online_cpus() || !cpu_online(cpu)) { + r = -EINVAL; + goto out; + } + } + + if (cpu == SN_HWPERF_ARG_ANY_CPU || cpu == get_cpu()) { + /* don't care, or already on correct cpu */ + sn_hwperf_call_sal(op_info); + } + else { + if (use_ipi) { + /* use an interprocessor interrupt to call SAL */ + smp_call_function_single(cpu, sn_hwperf_call_sal, + op_info, 1, 1); + } + else { + /* migrate the task before calling SAL */ + save_allowed = current->cpus_allowed; + set_cpus_allowed(current, cpumask_of_cpu(cpu)); + sn_hwperf_call_sal(op_info); + set_cpus_allowed(current, save_allowed); + } + } + r = op_info->ret; + +out: + return r; +} + +/* + * ioctl for "sn_hwperf" misc device + */ +static int +sn_hwperf_ioctl(struct inode *in, struct file *fp, u32 op, u64 arg) +{ + struct sn_hwperf_ioctl_args a; + struct cpuinfo_ia64 *cdata; + struct sn_hwperf_object_info *objs; + struct sn_hwperf_object_info *cpuobj; + struct sn_hwperf_op_info op_info; + void *p = NULL; + int nobj; + char slice; + int node; + int r; + int v0; + int i; + int j; + + unlock_kernel(); + + /* only user requests are allowed here */ + if ((op & SN_HWPERF_OP_MASK) < 10) { + r = -EINVAL; + goto error; + } + r = copy_from_user(&a, (const void *)arg, + sizeof(struct sn_hwperf_ioctl_args)); + if (r != 0) { + r = -EFAULT; + goto error; + } + + /* + * Allocate memory to hold a kernel copy of the user buffer. The + * buffer contents are either copied in or out (or both) of user + * space depending on the flags encoded in the requested operation. + */ + if (a.ptr) { + p = vmalloc(a.sz); + if (!p) { + r = -ENOMEM; + goto error; + } + } + + if (op & SN_HWPERF_OP_MEM_COPYIN) { + r = copy_from_user(p, (const void *)a.ptr, a.sz); + if (r != 0) { + r = -EFAULT; + goto error; + } + } + + switch (op) { + case SN_HWPERF_GET_CPU_INFO: + if (a.sz == sizeof(u64)) { + /* special case to get size needed */ + *(u64 *) p = (u64) num_online_cpus() * + sizeof(struct sn_hwperf_object_info); + } else + if (a.sz < num_online_cpus() * sizeof(struct sn_hwperf_object_info)) { + r = -ENOMEM; + goto error; + } else + if ((r = sn_hwperf_enum_objects(&nobj, &objs)) == 0) { + memset(p, 0, a.sz); + for (i = 0; i < nobj; i++) { + node = sn_hwperf_obj_to_cnode(objs + i); + for_each_online_cpu(j) { + if (node != cpu_to_node(j)) + continue; + cpuobj = (struct sn_hwperf_object_info *) p + j; + slice = 'a' + cpuid_to_slice(j); + cdata = cpu_data(j); + cpuobj->id = j; + snprintf(cpuobj->name, + sizeof(cpuobj->name), + "CPU %luMHz %s", + cdata->proc_freq / 1000000, + cdata->vendor); + snprintf(cpuobj->location, + sizeof(cpuobj->location), + "%s%c", objs[i].location, + slice); + } + } + + vfree(objs); + } + break; + + case SN_HWPERF_GET_NODE_NASID: + if (a.sz != sizeof(u64) || + (node = a.arg) < 0 || node >= numnodes) { + r = -EINVAL; + goto error; + } + *(u64 *)p = (u64)cnodeid_to_nasid(node); + break; + + case SN_HWPERF_GET_OBJ_NODE: + if (a.sz != sizeof(u64) || a.arg < 0) { + r = -EINVAL; + goto error; + } + if ((r = sn_hwperf_enum_objects(&nobj, &objs)) == 0) { + if (a.arg >= nobj) { + r = -EINVAL; + vfree(objs); + goto error; + } + if (objs[(i = a.arg)].id != a.arg) { + for (i = 0; i < nobj; i++) { + if (objs[i].id == a.arg) + break; + } + } + if (i == nobj) { + r = -EINVAL; + vfree(objs); + goto error; + } + *(u64 *)p = (u64)sn_hwperf_obj_to_cnode(objs + i); + vfree(objs); + } + break; + + case SN_HWPERF_GET_MMRS: + case SN_HWPERF_SET_MMRS: + case SN_HWPERF_OBJECT_DISTANCE: + op_info.p = p; + op_info.a = &a; + op_info.v0 = &v0; + op_info.op = op; + r = sn_hwperf_op_cpu(&op_info); + break; + + default: + /* all other ops are a direct SAL call */ + r = ia64_sn_hwperf_op(sn_hwperf_master_nasid, op, + a.arg, a.sz, (u64) p, 0, 0, &v0); + a.v0 = v0; + break; + } + + if (op & SN_HWPERF_OP_MEM_COPYOUT) { + r = copy_to_user((void *)a.ptr, p, a.sz); + if (r != 0) { + r = -EFAULT; + goto error; + } + } + +error: + if (p) + vfree(p); + + lock_kernel(); + return r; +} + +static struct file_operations sn_hwperf_fops = { + .ioctl = sn_hwperf_ioctl, +}; + +static struct miscdevice sn_hwperf_dev = { + MISC_DYNAMIC_MINOR, + "sn_hwperf", + &sn_hwperf_fops +}; + +static int sn_hwperf_init(void) +{ + u64 v; + int salr; + int e = 0; + + /* single threaded, once-only initialization */ + down(&sn_hwperf_init_mutex); + if (sn_hwperf_salheap) { + up(&sn_hwperf_init_mutex); + return e; + } + + /* + * The PROM code needs a fixed reference node. For convenience the + * same node as the console I/O is used. + */ + sn_hwperf_master_nasid = (nasid_t) ia64_sn_get_console_nasid(); + + /* + * Request the needed size and install the PROM scratch area. + * The PROM keeps various tracking bits in this memory area. + */ + salr = ia64_sn_hwperf_op(sn_hwperf_master_nasid, + (u64) SN_HWPERF_GET_HEAPSIZE, 0, + (u64) sizeof(u64), (u64) &v, 0, 0, NULL); + if (salr != SN_HWPERF_OP_OK) { + e = -EINVAL; + goto out; + } + + if ((sn_hwperf_salheap = vmalloc(v)) == NULL) { + e = -ENOMEM; + goto out; + } + salr = ia64_sn_hwperf_op(sn_hwperf_master_nasid, + SN_HWPERF_INSTALL_HEAP, 0, v, + (u64) sn_hwperf_salheap, 0, 0, NULL); + if (salr != SN_HWPERF_OP_OK) { + e = -EINVAL; + goto out; + } + + salr = ia64_sn_hwperf_op(sn_hwperf_master_nasid, + SN_HWPERF_OBJECT_COUNT, 0, + sizeof(u64), (u64) &v, 0, 0, NULL); + if (salr != SN_HWPERF_OP_OK) { + e = -EINVAL; + goto out; + } + sn_hwperf_obj_cnt = (int)v; + +out: + if (e < 0 && sn_hwperf_salheap) { + vfree(sn_hwperf_salheap); + sn_hwperf_salheap = NULL; + sn_hwperf_obj_cnt = 0; + } + + if (!e) { + /* + * Register a dynamic misc device for ioctl. Platforms + * supporting hotplug will create /dev/sn_hwperf, else + * user can to look up the minor number in /proc/misc. + */ + if ((e = misc_register(&sn_hwperf_dev)) != 0) { + printk(KERN_ERR "sn_hwperf_init: misc register " + "for \"sn_hwperf\" failed, err %d\n", e); + } + } + + up(&sn_hwperf_init_mutex); + return e; +} + +int sn_topology_open(struct inode *inode, struct file *file) +{ + int e; + struct seq_file *seq; + struct sn_hwperf_object_info *objbuf; + int nobj; + + if ((e = sn_hwperf_enum_objects(&nobj, &objbuf)) == 0) { + e = seq_open(file, &sn_topology_seq_ops); + seq = file->private_data; + seq->private = objbuf; + } + + return e; +} + +int sn_topology_release(struct inode *inode, struct file *file) +{ + struct seq_file *seq = file->private_data; + + if (seq->private) + vfree(seq->private); + return seq_release(inode, file); +} diff -Nru a/arch/ia64/sn/kernel/sn2/sn_proc_fs.c b/arch/ia64/sn/kernel/sn2/sn_proc_fs.c --- a/arch/ia64/sn/kernel/sn2/sn_proc_fs.c 2004-09-26 10:25:57 -07:00 +++ b/arch/ia64/sn/kernel/sn2/sn_proc_fs.c 2004-09-26 10:25:57 -07:00 @@ -10,67 +10,41 @@ #ifdef CONFIG_PROC_FS #include +#include #include #include - -static int partition_id_read_proc(char *page, char **start, off_t off, - int count, int *eof, void *data) { - - return sprintf(page, "%d\n", sn_local_partid()); +static int partition_id_show(struct seq_file *s, void *p) +{ + seq_printf(s, "%d\n", sn_local_partid()); + return 0; } -static struct proc_dir_entry * sgi_proc_dir; - -void -register_sn_partition_id(void) { - struct proc_dir_entry *entry; - - if (!sgi_proc_dir) { - sgi_proc_dir = proc_mkdir("sgi_sn", 0); - } - entry = create_proc_entry("partition_id", 0444, sgi_proc_dir); - if (entry) { - entry->nlink = 1; - entry->data = 0; - entry->read_proc = partition_id_read_proc; - entry->write_proc = NULL; - } +static int partition_id_open(struct inode *inode, struct file *file) +{ + return single_open(file, partition_id_show, NULL); } -static int -system_serial_number_read_proc(char *page, char **start, off_t off, - int count, int *eof, void *data) { - return sprintf(page, "%s\n", sn_system_serial_number()); +static int system_serial_number_show(struct seq_file *s, void *p) +{ + seq_printf(s, "%s\n", sn_system_serial_number()); + return 0; } -static int -licenseID_read_proc(char *page, char **start, off_t off, - int count, int *eof, void *data) { - return sprintf(page, "0x%lx\n",sn_partition_serial_number_val()); +static int system_serial_number_open(struct inode *inode, struct file *file) +{ + return single_open(file, system_serial_number_show, NULL); } -void -register_sn_serial_numbers(void) { - struct proc_dir_entry *entry; +static int licenseID_show(struct seq_file *s, void *p) +{ + seq_printf(s, "0x%lx\n", sn_partition_serial_number_val()); + return 0; +} - if (!sgi_proc_dir) { - sgi_proc_dir = proc_mkdir("sgi_sn", 0); - } - entry = create_proc_entry("system_serial_number", 0444, sgi_proc_dir); - if (entry) { - entry->nlink = 1; - entry->data = 0; - entry->read_proc = system_serial_number_read_proc; - entry->write_proc = NULL; - } - entry = create_proc_entry("licenseID", 0444, sgi_proc_dir); - if (entry) { - entry->nlink = 1; - entry->data = 0; - entry->read_proc = licenseID_read_proc; - entry->write_proc = NULL; - } +static int licenseID_open(struct inode *inode, struct file *file) +{ + return single_open(file, licenseID_show, NULL); } /* @@ -81,70 +55,90 @@ */ int sn_force_interrupt_flag = 1; -static int -sn_force_interrupt_read_proc(char *page, char **start, off_t off, - int count, int *eof, void *data) { - if (sn_force_interrupt_flag) { - return sprintf(page, "Force interrupt is enabled\n"); - } - return sprintf(page, "Force interrupt is disabled\n"); +static int sn_force_interrupt_show(struct seq_file *s, void *p) +{ + seq_printf(s, "Force interrupt is %s\n", + sn_force_interrupt_flag ? "enabled" : "disabled"); + return 0; } -static int -sn_force_interrupt_write_proc(struct file *file, const char *buffer, - unsigned long count, void *data) +static ssize_t sn_force_interrupt_write_proc(struct file *file, + const __user char *buffer, size_t count, loff_t *data) { - if (*buffer == '0') { - sn_force_interrupt_flag = 0; - } else { - sn_force_interrupt_flag = 1; - } - return 1; + sn_force_interrupt_flag = (*buffer == '0') ? 0 : 1; + return count; } -void -register_sn_force_interrupt(void) { - struct proc_dir_entry *entry; +static int sn_force_interrupt_open(struct inode *inode, struct file *file) +{ + return single_open(file, sn_force_interrupt_show, NULL); +} - if (!sgi_proc_dir) { - sgi_proc_dir = proc_mkdir("sgi_sn", 0); - } - entry = create_proc_entry("sn_force_interrupt",0444, sgi_proc_dir); - if (entry) { - entry->nlink = 1; - entry->data = 0; - entry->read_proc = sn_force_interrupt_read_proc; - entry->write_proc = sn_force_interrupt_write_proc; - } +static int coherence_id_show(struct seq_file *s, void *p) +{ + seq_printf(s, "%d\n", cpuid_to_coherence_id(smp_processor_id())); + return 0; } -static int coherence_id_read_proc(char *page, char **start, off_t off, - int count, int *eof, void *data) { - return sprintf(page, "%d\n", cpuid_to_coherence_id(smp_processor_id())); +static int coherence_id_open(struct inode *inode, struct file *file) +{ + return single_open(file, coherence_id_show, NULL); } -void -register_sn_coherence_id(void) { - struct proc_dir_entry *entry; +static struct proc_dir_entry *sn_procfs_create_entry( + const char *name, struct proc_dir_entry *parent, + int (*openfunc)(struct inode *, struct file *), + int (*releasefunc)(struct inode *, struct file *)) +{ + struct proc_dir_entry *e = create_proc_entry(name, 0444, parent); - if (!sgi_proc_dir) { - sgi_proc_dir = proc_mkdir("sgi_sn", 0); - } - entry = create_proc_entry("coherence_id", 0444, sgi_proc_dir); - if (entry) { - entry->nlink = 1; - entry->data = 0; - entry->read_proc = coherence_id_read_proc; - entry->write_proc = NULL; + if (e) { + e->proc_fops = (struct file_operations *)kmalloc( + sizeof(struct file_operations), GFP_KERNEL); + if (e->proc_fops) { + memset(e->proc_fops, 0, sizeof(struct file_operations)); + e->proc_fops->open = openfunc; + e->proc_fops->read = seq_read; + e->proc_fops->llseek = seq_lseek; + e->proc_fops->release = releasefunc; + } } + + return e; } -void -register_sn_procfs(void) { - register_sn_partition_id(); - register_sn_serial_numbers(); - register_sn_force_interrupt(); - register_sn_coherence_id(); +/* /proc/sgi_sn/sn_topology uses seq_file, see sn_hwperf.c */ +extern int sn_topology_open(struct inode *, struct file *); +extern int sn_topology_release(struct inode *, struct file *); + +void register_sn_procfs(void) +{ + static struct proc_dir_entry *sgi_proc_dir = NULL; + struct proc_dir_entry *e; + + BUG_ON(sgi_proc_dir != NULL); + if (!(sgi_proc_dir = proc_mkdir("sgi_sn", 0))) + return; + + sn_procfs_create_entry("partition_id", sgi_proc_dir, + partition_id_open, single_release); + + sn_procfs_create_entry("system_serial_number", sgi_proc_dir, + system_serial_number_open, single_release); + + sn_procfs_create_entry("licenseID", sgi_proc_dir, + licenseID_open, single_release); + + e = sn_procfs_create_entry("sn_force_interrupt", sgi_proc_dir, + sn_force_interrupt_open, single_release); + if (e) + e->proc_fops->write = sn_force_interrupt_write_proc; + + sn_procfs_create_entry("coherence_id", sgi_proc_dir, + coherence_id_open, single_release); + + sn_procfs_create_entry("sn_topology", sgi_proc_dir, + sn_topology_open, sn_topology_release); } #endif /* CONFIG_PROC_FS */ diff -Nru a/arch/m32r/Kconfig b/arch/m32r/Kconfig --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/Kconfig 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,443 @@ +# +# For a description of the syntax of this configuration file, +# see Documentation/kbuild/kconfig-language.txt. +# + +mainmenu "Linux Kernel Configuration" + +config M32R + bool + default y + +config SBUS + bool + +config UID16 + bool + default y + +config GENERIC_ISA_DMA + bool + default y + +source "init/Kconfig" + + +menu "Processor type and features" + +choice + prompt "Platform Type" + default PLAT_MAPPI + +config PLAT_MAPPI + bool "Mappi-I" + help + The Mappi-I is an FPGA board for SOC (System-On-a-Chip) prototyping. + You can operate a Linux system on this board by using an M32R + softmacro core, which is a fully-synthesizable functional model + described in Verilog-HDL. + + The Mappi-I board was the first platform, which had been used + to port and develop a Linux system for the M32R processor. + Currently, the Mappi-II, an heir to the Mappi-I, is available. + +config PLAT_USRV + bool "uServer" + +config PLAT_M32700UT + bool "M32700UT" + help + The M3T-M32700UT is an evaluation board based on uT-Engine + specification. This board has an M32700 (Chaos) evaluation chip. + You can say Y for SMP, because the M32700 is a single chip + multiprocessor. + +config PLAT_OPSPUT + bool "OPSPUT" + help + The OPSPUT is an evaluation board based on uT-Engine + specification. This board has a OPSP-REP chip. + +config PLAT_OAKS32R + bool "OAKS32R" + help + The OAKS32R is a tiny, inexpensive evaluation board. + Please note that if you say Y here and choose chip "M32102", + say N for MMU and select a no-MMU version kernel, otherwise + a kernel with MMU support will not work, because the M32102 + is a microcontroller for embedded systems and it has no MMU. + +config PLAT_MAPPI2 + bool "Mappi-II(M3A-ZA36/M3A-ZA52)" + +endchoice + +choice + prompt "Processor family" + default CHIP_M32700 + +config CHIP_M32700 + bool "M32700 (Chaos)" + +config CHIP_M32102 + bool "M32102" + +config CHIP_VDEC2 + bool "VDEC2" + +config CHIP_OPSP + bool "OPSP" + +endchoice + +config MMU + bool "Support for memory management hardware" + depends on CHIP_M32700 || CHIP_VDEC2 || CHIP_OPSP + default y + +config TLB_ENTRIES + int "TLB Entries" + depends on CHIP_M32700 || CHIP_VDEC2 || CHIP_OPSP + default 32 if CHIP_M32700 || CHIP_OPSP + default 16 if CHIP_VDEC2 + + +config ISA_M32R + bool + depends on CHIP_M32102 + default y + +config ISA_M32R2 + bool + depends on CHIP_M32700 || CHIP_VDEC2 || CHIP_OPSP + default y + +config ISA_DSP_LEVEL2 + bool + depends on CHIP_M32700 || CHIP_OPSP + default y + +config ISA_DUAL_ISSUE + bool + depends on CHIP_M32700 || CHIP_OPSP + default y + +config BUS_CLOCK + int "Bus Clock [Hz] (integer)" + default "70000000" if PLAT_MAPPI + default "25000000" if PLAT_USRV + default "50000000" if PLAT_M32700UT + default "50000000" if PLAT_OPSPUT + default "33333333" if PLAT_OAKS32R + default "20000000" if PLAT_MAPPI2 + +config TIMER_DIVIDE + int "Timer divider (integer)" + default "128" + +config CPU_LITTLE_ENDIAN + bool "Generate little endian code" + default n + +config MEMORY_START + hex "Physical memory start address (hex)" + default "08000000" if PLAT_MAPPI || PLAT_MAPPI2 + default "08000000" if PLAT_USRV + default "08000000" if PLAT_M32700UT + default "08000000" if PLAT_OPSPUT + default "01000000" if PLAT_OAKS32R + +config MEMORY_SIZE + hex "Physical memory size (hex)" + default "04000000" if PLAT_MAPPI || PLAT_MAPPI2 + default "02000000" if PLAT_USRV + default "01000000" if PLAT_M32700UT + default "01000000" if PLAT_OPSPUT + default "00800000" if PLAT_OAKS32R + +config NOHIGHMEM + bool + default y + +config DISCONTIGMEM + bool "Internal RAM Support" + depends on CHIP_M32700 || CHIP_M32102 || CHIP_VDEC2 || CHIP_OPSP + default y + +config IRAM_START + hex "Internal memory start address (hex)" + default "00f00000" + depends on (CHIP_M32700 || CHIP_M32102 || CHIP_VDEC2 || CHIP_OPSP) && DISCONTIGMEM + +config IRAM_SIZE + hex "Internal memory size (hex)" + depends on (CHIP_M32700 || CHIP_M32102 || CHIP_VDEC2 || CHIP_OPSP) && DISCONTIGMEM + default "00080000" if CHIP_M32700 + default "00010000" if CHIP_M32102 || CHIP_OPSP + default "00008000" if CHIP_VDEC2 + +# +# Define implied options from the CPU selection here +# + +config RWSEM_GENERIC_SPINLOCK + bool + depends on M32R + default y + +config RWSEM_XCHGADD_ALGORITHM + bool + default n + +config PREEMPT + bool "Preemptible Kernel" + help + This option reduces the latency of the kernel when reacting to + real-time or interactive events by allowing a low priority process to + be preempted even if it is in kernel mode executing a system call. + This allows applications to run more reliably even when the system is + under load. + + Say Y here if you are building a kernel for a desktop, embedded + or real-time system. Say N if you are unsure. + +config HAVE_DEC_LOCK + bool + depends on (SMP || PREEMPT) + default n + +config SMP + bool "Symmetric multi-processing support" + ---help--- + This enables support for systems with more than one CPU. If you have + a system with only one CPU, like most personal computers, say N. If + you have a system with more than one CPU, say Y. + + If you say N here, the kernel will run on single and multiprocessor + machines, but will use only one CPU of a multiprocessor machine. If + you say Y here, the kernel will run on many, but not all, + singleprocessor machines. On a singleprocessor machine, the kernel + will run faster if you say N here. + + People using multiprocessor machines who say Y here should also say + Y to "Enhanced Real Time Clock Support", below. The "Advanced Power + Management" code will be disabled if you say Y here. + + See also the , + and the SMP-HOWTO available at + . + + If you don't know what to do here, say N. + +config CHIP_M32700_TS1 + bool "Workaround code for the M32700 TS1 chip's bug" + depends on (CHIP_M32700 && SMP) + default n + +config NR_CPUS + int "Maximum number of CPUs (2-32)" + range 2 32 + depends on SMP + default "2" + help + This allows you to specify the maximum number of CPUs which this + kernel will support. The maximum supported value is 32 and the + minimum value which makes sense is 2. + + This is purely to save memory - each supported CPU adds + approximately eight kilobytes to the kernel image. + +# Common NUMA Features +config NUMA + bool "Numa Memory Allocation Support" + depends on SMP + default n + +source "arch/m32r/drivers/Kconfig" + +# turning this on wastes a bunch of space. +# Summit needs it only when NUMA is on +config BOOT_IOREMAP + bool + depends on NUMA + default n + +endmenu + + +menu "Bus options (PCI, PCMCIA, EISA, MCA, ISA)" + +config PCI + bool "PCI support" + default n + help + Find out whether you have a PCI motherboard. PCI is the name of a + bus system, i.e. the way the CPU talks to the other stuff inside + your box. Other bus systems are ISA, EISA, MicroChannel (MCA) or + VESA. If you have PCI, say Y, otherwise N. + + The PCI-HOWTO, available from + , contains valuable + information about which PCI hardware does work under Linux and which + doesn't. + +choice + prompt "PCI access mode" + depends on PCI + default PCI_GOANY + +config PCI_GOBIOS + bool "BIOS" + ---help--- + On PCI systems, the BIOS can be used to detect the PCI devices and + determine their configuration. However, some old PCI motherboards + have BIOS bugs and may crash if this is done. Also, some embedded + PCI-based systems don't have any BIOS at all. Linux can also try to + detect the PCI hardware directly without using the BIOS. + + With this option, you can specify how Linux should detect the PCI + devices. If you choose "BIOS", the BIOS will be used, if you choose + "Direct", the BIOS won't be used, and if you choose "Any", the + kernel will try the direct access method and falls back to the BIOS + if that doesn't work. If unsure, go with the default, which is + "Any". + +config PCI_GODIRECT + bool "Direct" + +config PCI_GOANY + bool "Any" + +endchoice + +config PCI_BIOS + bool + depends on PCI && (PCI_GOBIOS || PCI_GOANY) + default y + +config PCI_DIRECT + bool + depends on PCI && (PCI_GODIRECT || PCI_GOANY) + default y + +source "drivers/pci/Kconfig" + +config ISA + bool "ISA support" + help + Find out whether you have ISA slots on your motherboard. ISA is the + name of a bus system, i.e. the way the CPU talks to the other stuff + inside your box. If you have ISA, say Y, otherwise N. + +source "drivers/pcmcia/Kconfig" + +source "drivers/pci/hotplug/Kconfig" + +endmenu + + +menu "Executable file formats" + +source "fs/Kconfig.binfmt" + +endmenu + +source "drivers/Kconfig" + +source "fs/Kconfig" + +source "arch/m32r/oprofile/Kconfig" + +menu "Kernel hacking" + +config DEBUG_KERNEL + bool "Kernel debugging" + help + Say Y here if you are developing drivers or trying to debug and + identify kernel problems. + +config DEBUG_STACKOVERFLOW + bool "Check for stack overflows" + depends on DEBUG_KERNEL + +config DEBUG_SLAB + bool "Debug memory allocations" + depends on DEBUG_KERNEL + help + Say Y here to have the kernel do limited verification on memory + allocation as well as poisoning memory on free to catch use of freed + memory. + +config DEBUG_IOVIRT + bool "Memory mapped I/O debugging" + depends on DEBUG_KERNEL + help + Say Y here to get warned whenever an attempt is made to do I/O on + obviously invalid addresses such as those generated when ioremap() + calls are forgotten. Memory mapped I/O will go through an extra + check to catch access to unmapped ISA addresses, an access method + that can still be used by old drivers that are being ported from + 2.0/2.2. + +config MAGIC_SYSRQ + bool "Magic SysRq key" + depends on DEBUG_KERNEL + help + If you say Y here, you will have some control over the system even + if the system crashes for example during kernel debugging (e.g., you + will be able to flush the buffer cache to disk, reboot the system + immediately or dump some status information). This is accomplished + by pressing various keys while holding SysRq (Alt+PrintScreen). It + also works on a serial console (on PC hardware at least), if you + send a BREAK and then within 5 seconds a command keypress. The + keys are documented in . Don't say Y + unless you really know what this hack does. + +config DEBUG_SPINLOCK + bool "Spinlock debugging" + depends on DEBUG_KERNEL + help + Say Y here and build SMP to catch missing spinlock initialization + and certain other kinds of spinlock errors commonly made. This is + best used in conjunction with the NMI watchdog so that spinlock + deadlocks are also debuggable. + +config DEBUG_PAGEALLOC + bool "Page alloc debugging" + depends on DEBUG_KERNEL + help + Unmap pages from the kernel linear mapping after free_pages(). + This results in a large slowdown, but helps to find certain types + of memory corruptions. + +config DEBUG_INFO + bool "Compile the kernel with debug info" + depends on DEBUG_KERNEL + 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 DEBUG_SPINLOCK_SLEEP + bool "Sleep-inside-spinlock checking" + help + If you say Y here, various routines which may sleep will become very + noisy if they are called with a spinlock held. + +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" + +source "crypto/Kconfig" + +source "lib/Kconfig" + diff -Nru a/arch/m32r/Makefile b/arch/m32r/Makefile --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/Makefile 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,56 @@ +# +# m32r/Makefile +# + +LDFLAGS := +OBJCOPYFLAGS := -O binary -R .note -R .comment -S +LDFLAGS_vmlinux := -e startup_32 +LDFLAGS_BLOB := --format binary --oformat elf32-m32r + +CFLAGS += -pipe -fno-schedule-insns +CFLAGS_KERNEL += -mmodel=medium +CFLAGS_MODULE += -mmodel=large + +ifdef CONFIG_CHIP_VDEC2 +cflags-$(CONFIG_ISA_M32R2) += -DNO_FPU -Wa,-bitinst +aflags-$(CONFIG_ISA_M32R2) += -DNO_FPU -Wa,-bitinst +else +cflags-$(CONFIG_ISA_M32R2) += -DNO_FPU -m32r2 +aflags-$(CONFIG_ISA_M32R2) += -DNO_FPU -m32r2 +endif + +cflags-$(CONFIG_ISA_M32R) += -DNO_FPU +aflags-$(CONFIG_ISA_M32R) += -DNO_FPU -Wa,-no-bitinst + +CFLAGS += $(cflags-y) +AFLAGS += $(aflags-y) + +CHECKFLAGS := $(CHECK) -D__m32r__=1 + +head-y := arch/m32r/kernel/head.o arch/m32r/kernel/init_task.o + +LIBGCC := $(shell $(CC) $(CFLAGS) -print-libgcc-file-name) + +libs-y += arch/m32r/lib/ $(LIBGCC) +core-y += arch/m32r/kernel/ \ + arch/m32r/mm/ \ + arch/m32r/boot/ + +drivers-y += arch/m32r/drivers/ +drivers-$(CONFIG_OPROFILE) += arch/m32r/oprofile/ + +boot := arch/m32r/boot + +.PHONY: zImage + +zImage: vmlinux + $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ + +compressed: zImage + +archclean: + $(Q)$(MAKE) $(clean)=$(boot) + +define archhelp + @echo ' zImage - Compressed kernel image (arch/m32r/boot/zImage)' +endef diff -Nru a/arch/m32r/boot/Makefile b/arch/m32r/boot/Makefile --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/boot/Makefile 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,19 @@ +# +# arch/m32r/boot/Makefile +# +# This file is subject to the terms and conditions of the GNU General Public +# License. See the file "COPYING" in the main directory of this archive +# for more details. + +targets := zImage +subdir- := compressed + +obj-y := setup.o + +$(obj)/zImage: $(obj)/compressed/vmlinux FORCE + $(call if_changed,objcopy) + @echo 'Kernel: $@ is ready' + +$(obj)/compressed/vmlinux: FORCE + $(Q)$(MAKE) $(build)=$(obj)/compressed $@ + diff -Nru a/arch/m32r/boot/compressed/Makefile b/arch/m32r/boot/compressed/Makefile --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/boot/compressed/Makefile 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,38 @@ +# +# linux/arch/sh/boot/compressed/Makefile +# +# create a compressed vmlinux image from the original vmlinux +# + +targets := vmlinux vmlinux.bin vmlinux.bin.gz head.o misc.o \ + m32r-sio.o piggy.o vmlinux.lds +EXTRA_AFLAGS := -traditional + +OBJECTS = $(obj)/head.o $(obj)/misc.o $(obj)/m32r_sio.o + +# +# IMAGE_OFFSET is the load offset of the compression loader +# +#IMAGE_OFFSET := $(shell printf "0x%08x" $$[$(CONFIG_MEMORY_START)+0x2000]) +#IMAGE_OFFSET := $(shell printf "0x%08x" $$[$(CONFIG_MEMORY_START)+0x00400000]) + +LDFLAGS_vmlinux := -T + +$(obj)/vmlinux: $(obj)/vmlinux.lds $(OBJECTS) $(obj)/piggy.o FORCE + $(call if_changed,ld) + @: + +$(obj)/vmlinux.bin: vmlinux FORCE + $(call if_changed,objcopy) + +$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE + $(call if_changed,gzip) + +$(obj)/vmlinux.lds: $(obj)/vmlinux.lds.S FORCE + $(CPP) $(EXTRA_AFLAGS) -C -P -I include $< >$@ + +LDFLAGS_piggy.o := -r --format binary --oformat elf32-m32r-linux -T +OBJCOPYFLAGS += -R .empty_zero_page + +$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.gz FORCE + $(call if_changed,ld) diff -Nru a/arch/m32r/boot/compressed/boot.h b/arch/m32r/boot/compressed/boot.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/boot/compressed/boot.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,59 @@ +/* + * 1. load vmlinuz + * + * CONFIG_MEMORY_START +-----------------------+ + * | vmlinuz | + * +-----------------------+ + * 2. decompressed + * + * CONFIG_MEMORY_START +-----------------------+ + * | vmlinuz | + * +-----------------------+ + * | | + * BOOT_RELOC_ADDR +-----------------------+ + * | | + * KERNEL_DECOMPRESS_ADDR +-----------------------+ + * | vmlinux | + * +-----------------------+ + * + * 3. relocate copy & jump code + * + * CONFIG_MEMORY_START +-----------------------+ + * | vmlinuz | + * +-----------------------+ + * | | + * BOOT_RELOC_ADDR +-----------------------+ + * | boot(copy&jump) | + * KERNEL_DECOMPRESS_ADDR +-----------------------+ + * | vmlinux | + * +-----------------------+ + * + * 4. relocate decompressed kernel + * + * CONFIG_MEMORY_START +-----------------------+ + * | vmlinux | + * +-----------------------+ + * | | + * BOOT_RELOC_ADDR +-----------------------+ + * | boot(copy&jump) | + * KERNEL_DECOMPRESS_ADDR +-----------------------+ + * | | + * +-----------------------+ + * + */ +#ifdef __ASSEMBLY__ +#define __val(x) x +#else +#define __val(x) (x) +#endif + +#define DECOMPRESS_OFFSET_BASE __val(0x00900000) +#define BOOT_RELOC_SIZE __val(0x00001000) + +#define KERNEL_EXEC_ADDR __val(CONFIG_MEMORY_START) +#define KERNEL_DECOMPRESS_ADDR __val(CONFIG_MEMORY_START + \ + DECOMPRESS_OFFSET_BASE + BOOT_RELOC_SIZE) +#define KERNEL_ENTRY __val(CONFIG_MEMORY_START + 0x1000) + +#define BOOT_EXEC_ADDR __val(CONFIG_MEMORY_START) +#define BOOT_RELOC_ADDR __val(CONFIG_MEMORY_START + DECOMPRESS_OFFSET_BASE) diff -Nru a/arch/m32r/boot/compressed/head.S b/arch/m32r/boot/compressed/head.S --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/boot/compressed/head.S 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,115 @@ +/* + * linux/arch/m32r/boot/compressed/head.S + * + * Copyright (c) 2001-2003 Hiroyuki Kondo, Hirokazu Takata, + * Hitoshi Yamamoto, Takeo Takahashi + * Copyright (c) 2004 Hirokazu Takata + */ + + .text +#include +#include +#include +#include +#include + + .global startup + __ALIGN +startup: + ldi r0, #0x0000 /* SPI, disable EI */ + mvtc r0, psw + +/* + * Clear BSS first so that there are no surprises... + */ +#ifdef CONFIG_ISA_DUAL_ISSUE + + LDIMM (r2, __bss_start) + LDIMM (r3, _end) + sub r3, r2 ; BSS size in bytes + ; R4 = BSS size in longwords (rounded down) + mv r4, r3 || ldi r1, #0 + srli r4, #4 || addi r2, #-4 + beqz r4, .Lendloop1 +.Lloop1: +#ifndef CONFIG_CHIP_M32310 + ; Touch memory for the no-write-allocating cache. + ld r0, @(4,r2) +#endif + st r1, @+r2 || addi r4, #-1 + st r1, @+r2 + st r1, @+r2 + st r1, @+r2 || cmpeq r1, r4 ; R4 = 0? + bnc .Lloop1 +.Lendloop1: + and3 r4, r3, #15 + addi r2, #4 + beqz r4, .Lendloop2 +.Lloop2: + stb r1, @r2 || addi r4, #-1 + addi r2, #1 + bnez r4, .Lloop2 +.Lendloop2: + +#else /* not CONFIG_ISA_DUAL_ISSUE */ + + LDIMM (r2, __bss_start) + LDIMM (r3, _end) + sub r3, r2 ; BSS size in bytes + mv r4, r3 + srli r4, #2 ; R4 = BSS size in longwords (rounded down) + ldi r1, #0 ; clear R1 for longwords store + addi r2, #-4 ; account for pre-inc store + beqz r4, .Lendloop1 ; any more to go? +.Lloop1: + st r1, @+r2 ; yep, zero out another longword + addi r4, #-1 ; decrement count + bnez r4, .Lloop1 ; go do some more +.Lendloop1: + and3 r4, r3, #3 ; get no. of remaining BSS bytes to clear + addi r2, #4 ; account for pre-inc store + beqz r4, .Lendloop2 ; any more to go? +.Lloop2: + stb r1, @r2 ; yep, zero out another byte + addi r2, #1 ; bump address + addi r4, #-1 ; decrement count + bnez r4, .Lloop2 ; go do some more +.Lendloop2: + +#endif /* not CONFIG_ISA_DUAL_ISSUE */ + + seth r0, #shigh(stack_start) + ld sp, @(r0, low(stack_start)) /* set stack point */ + +/* + * decompress the kernel + */ + bl decompress_kernel + +#if defined(CONFIG_CHIP_M32700) + /* Cache flush */ + ldi r0, -1 + ldi r1, 0xd0 ; invalidate i-cache, copy back d-cache + stb r1, @r0 +#else +#error "put your cache flush function, please" +#endif + seth r0, #high(CONFIG_MEMORY_START) + or3 r0, r0, #0x2000 + jmp r0 + + .balign 512 +fake_headers_as_bzImage: + .short 0 + .ascii "HdrS" + .short 0x0202 + .short 0 + .short 0 + .byte 0x00, 0x10 + .short 0 + .byte 0 + .byte 1 + .byte 0x00, 0x80 + .long 0 + .long 0 + diff -Nru a/arch/m32r/boot/compressed/install.sh b/arch/m32r/boot/compressed/install.sh --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/boot/compressed/install.sh 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,57 @@ +#!/bin/sh +# +# arch/sh/boot/install.sh +# +# This file is subject to the terms and conditions of the GNU General Public +# License. See the file "COPYING" in the main directory of this archive +# for more details. +# +# Copyright (C) 1995 by Linus Torvalds +# +# Adapted from code in arch/i386/boot/Makefile by H. Peter Anvin +# Adapted from code in arch/i386/boot/install.sh by Russell King +# Adapted from code in arch/arm/boot/install.sh by Stuart Menefy +# Adapted from code in arch/sh/boot/install.sh by Takeo Takahashi +# +# "make install" script for sh architecture +# +# Arguments: +# $1 - kernel version +# $2 - kernel image file +# $3 - kernel map file +# $4 - default install path (blank if root directory) +# + +# User may have a custom install script + +if [ -x /sbin/installkernel ]; then + exec /sbin/installkernel "$@" +fi + +if [ "$2" = "zImage" ]; then +# Compressed install + echo "Installing compressed kernel" + if [ -f $4/vmlinuz-$1 ]; then + mv $4/vmlinuz-$1 $4/vmlinuz.old + fi + + if [ -f $4/System.map-$1 ]; then + mv $4/System.map-$1 $4/System.old + fi + + cat $2 > $4/vmlinuz-$1 + cp $3 $4/System.map-$1 +else +# Normal install + echo "Installing normal kernel" + if [ -f $4/vmlinux-$1 ]; then + mv $4/vmlinux-$1 $4/vmlinux.old + fi + + if [ -f $4/System.map ]; then + mv $4/System.map $4/System.old + fi + + cat $2 > $4/vmlinux-$1 + cp $3 $4/System.map +fi diff -Nru a/arch/m32r/boot/compressed/m32r_sio.c b/arch/m32r/boot/compressed/m32r_sio.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/boot/compressed/m32r_sio.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,53 @@ +/* + * arch/m32r/boot/compressed/m32r_sio.c + * + * 2003-02-12: Takeo Takahashi + * + */ + +#include +#include +#include + +void putc(char c); + +int puts(const char *s) +{ + char c; + while ((c = *s++)) putc(c); + return 0; +} + +#if defined(CONFIG_PLAT_M32700UT_Alpha) || defined(CONFIG_PLAT_M32700UT) +#define USE_FPGA_MAP 0 + +#if USE_FPGA_MAP +/* + * fpga configuration program uses MMU, and define map as same as + * M32104 uT-Engine board. + */ +#define BOOT_SIO0STS (volatile unsigned short *)(0x02c00000 + 0x20006) +#define BOOT_SIO0TXB (volatile unsigned short *)(0x02c00000 + 0x2000c) +#else +#undef PLD_BASE +#define PLD_BASE 0xa4c00000 +#define BOOT_SIO0STS PLD_ESIO0STS +#define BOOT_SIO0TXB PLD_ESIO0TXB +#endif + +void putc(char c) +{ + + while ((*BOOT_SIO0STS & 0x3) != 0x3) ; + if (c == '\n') { + *BOOT_SIO0TXB = '\r'; + while ((*BOOT_SIO0STS & 0x3) != 0x3) ; + } + *BOOT_SIO0TXB = c; +} +#else +void putc(char c) +{ + /* do nothing */ +} +#endif diff -Nru a/arch/m32r/boot/compressed/misc.c b/arch/m32r/boot/compressed/misc.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/boot/compressed/misc.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,223 @@ +/* + * arch/m32r/boot/compressed/misc.c + * + * This is a collection of several routines from gzip-1.0.3 + * adapted for Linux. + * + * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994 + * + * Adapted for SH by Stuart Menefy, Aug 1999 + * + * Modified to use standard LinuxSH BIOS by Greg Banks 7Jul2000 + * + * 2003-02-12: Support M32R by Takeo Takahashi + * This is based on arch/sh/boot/compressed/misc.c. + */ + +#include +#include + +/* + * gzip declarations + */ + +#define OF(args) args +#define STATIC static + +#undef memset +#undef memcpy +#define memzero(s, n) memset ((s), 0, (n)) + +typedef unsigned char uch; +typedef unsigned short ush; +typedef unsigned long ulg; + +#define WSIZE 0x8000 /* Window size must be at least 32k, */ + /* and a power of two */ + +static uch *inbuf; /* input buffer */ +static uch window[WSIZE]; /* Sliding window buffer */ + +static unsigned insize; /* valid bytes in inbuf */ +static unsigned inptr; /* index of next byte to be processed in inbuf */ +static unsigned outcnt; /* bytes in output buffer */ + +/* gzip flag byte */ +#define ASCII_FLAG 0x01 /* bit 0 set: file probably ASCII text */ +#define CONTINUATION 0x02 /* bit 1 set: continuation of multi-part gzip file */ +#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */ +#define ORIG_NAME 0x08 /* bit 3 set: original file name present */ +#define COMMENT 0x10 /* bit 4 set: file comment present */ +#define ENCRYPTED 0x20 /* bit 5 set: file is encrypted */ +#define RESERVED 0xC0 /* bit 6,7: reserved */ + +#define get_byte() (inptr < insize ? inbuf[inptr++] : fill_inbuf()) + +/* Diagnostic functions */ +#ifdef DEBUG +# define Assert(cond,msg) {if(!(cond)) error(msg);} +# define Trace(x) fprintf x +# define Tracev(x) {if (verbose) fprintf x ;} +# define Tracevv(x) {if (verbose>1) fprintf x ;} +# define Tracec(c,x) {if (verbose && (c)) fprintf x ;} +# define Tracecv(c,x) {if (verbose>1 && (c)) fprintf x ;} +#else +# define Assert(cond,msg) +# define Trace(x) +# define Tracev(x) +# define Tracevv(x) +# define Tracec(c,x) +# define Tracecv(c,x) +#endif + +static int fill_inbuf(void); +static void flush_window(void); +static void error(char *m); +static void gzip_mark(void **); +static void gzip_release(void **); + +extern char input_data[]; +extern int input_len; + +static long bytes_out; +static uch *output_data; +static unsigned long output_ptr; + + +static void *malloc(int size); +static void free(void *where); +static void error(char *m); +static void gzip_mark(void **); +static void gzip_release(void **); + +extern int puts(const char *); + +extern int _text; /* Defined in vmlinux.lds.S */ +extern int _end; +static unsigned long free_mem_ptr; +static unsigned long free_mem_end_ptr; + +#define HEAP_SIZE 0x10000 + +#include "../../../../lib/inflate.c" + +static void *malloc(int size) +{ + void *p; + + if (size <0) error("Malloc error\n"); + if (free_mem_ptr == 0) error("Memory error\n"); + + free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */ + + p = (void *)free_mem_ptr; + free_mem_ptr += size; + + if (free_mem_ptr >= free_mem_end_ptr) + error("\nOut of memory\n"); + + return p; +} + +static void free(void *where) +{ /* Don't care */ +} + +static void gzip_mark(void **ptr) +{ + *ptr = (void *) free_mem_ptr; +} + +static void gzip_release(void **ptr) +{ + free_mem_ptr = (long) *ptr; +} + +void* memset(void* s, int c, size_t n) +{ + int i; + char *ss = (char*)s; + + for (i=0;i> 8); + } + crc = c; + bytes_out += (ulg)outcnt; + output_ptr += (ulg)outcnt; + outcnt = 0; +} + +static void error(char *x) +{ + puts("\n\n"); + puts(x); + puts("\n\n -- System halted"); + + while(1); /* Halt */ +} + +#define STACK_SIZE (4096) +long user_stack [STACK_SIZE]; +long* stack_start = &user_stack[STACK_SIZE]; + +/* return decompressed size */ +long decompress_kernel(void) +{ + insize = 0; + inptr = 0; + bytes_out = 0; + outcnt = 0; + output_data = 0; + output_ptr = CONFIG_MEMORY_START + 0x2000; + free_mem_ptr = (unsigned long)&_end; + free_mem_end_ptr = free_mem_ptr + HEAP_SIZE; + + makecrc(); + puts("Uncompressing Linux... "); + gunzip(); + puts("Ok, booting the kernel.\n"); + return bytes_out; +} diff -Nru a/arch/m32r/boot/compressed/vmlinux.lds.S b/arch/m32r/boot/compressed/vmlinux.lds.S --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/boot/compressed/vmlinux.lds.S 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,23 @@ +#include + +OUTPUT_ARCH(m32r) +ENTRY(startup) +SECTIONS +{ + . = CONFIG_MEMORY_START + 0x00400000; + + _text = .; + .text : { *(.text) } = 0 + .rodata : { *(.rodata) } + _etext = .; + + . = ALIGN(32) + (. & (32 - 1)); + .data : { *(.data) } + _edata = .; + + . = ALIGN(32 / 8); + __bss_start = .; + .bss : { *(.bss) } + . = ALIGN(32 / 8); + _end = . ; +} diff -Nru a/arch/m32r/boot/compressed/vmlinux.scr b/arch/m32r/boot/compressed/vmlinux.scr --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/boot/compressed/vmlinux.scr 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,9 @@ +SECTIONS +{ + .data : { + input_len = .; + LONG(input_data_end - input_data) input_data = .; + *(.data) + input_data_end = .; + } +} diff -Nru a/arch/m32r/boot/setup.S b/arch/m32r/boot/setup.S --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/boot/setup.S 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,162 @@ +/* + * linux/arch/m32r/boot/setup.S -- A setup code. + * + * Copyright (C) 2001, 2002 Hiroyuki Kondo, Hirokazu Takata, + * and Hitoshi Yamamoto + * + */ +/* $Id$ */ + +#include +#include +#include +#include + +#include +#include +#include +#include + +/* + * References to members of the boot_cpu_data structure. + */ + +#define CPU_PARAMS boot_cpu_data +#define M32R_MCICAR 0xfffffff0 +#define M32R_MCDCAR 0xfffffff4 +#define M32R_MCCR 0xfffffffc +#define M32R_BSCR0 0xffffffd2 + +;BSEL +#define BSEL0CR0 0x00ef5000 +#define BSEL0CR1 0x00ef5004 +#define BSEL1CR0 0x00ef5100 +#define BSEL1CR1 0x00ef5104 +#define BSEL0CR0_VAL 0x00000000 +#define BSEL0CR1_VAL 0x01200100 +#define BSEL1CR0_VAL 0x01018000 +#define BSEL1CR1_VAL 0x00200001 + +;SDRAMC +#define SDRAMC_SDRF0 0x00ef6000 +#define SDRAMC_SDRF1 0x00ef6004 +#define SDRAMC_SDIR0 0x00ef6008 +#define SDRAMC_SDIR1 0x00ef600c +#define SDRAMC_SD0ADR 0x00ef6020 +#define SDRAMC_SD0ER 0x00ef6024 +#define SDRAMC_SD0TR 0x00ef6028 +#define SDRAMC_SD0MOD 0x00ef602c +#define SDRAMC_SD1ADR 0x00ef6040 +#define SDRAMC_SD1ER 0x00ef6044 +#define SDRAMC_SD1TR 0x00ef6048 +#define SDRAMC_SD1MOD 0x00ef604c +#define SDRAM0 0x18000000 +#define SDRAM1 0x1c000000 + +/*------------------------------------------------------------------------ + * start up + */ + +/*------------------------------------------------------------------------ + * Kernel entry + */ + .section .boot, "ax" +ENTRY(boot) + +/* Set cache mode */ +#if defined(CONFIG_CHIP_XNUX2) + ldi r0, #-2 ;LDIMM (r0, M32R_MCCR) + ldi r1, #0x0101 ; cache on (with invalidation) +; ldi r1, #0x00 ; cache off + sth r1, @r0 +#elif defined(CONFIG_CHIP_M32700) || defined(CONFIG_CHIP_VDEC2) \ + || defined(CONFIG_CHIP_OPSP) + ldi r0, #-4 ;LDIMM (r0, M32R_MCCR) + ldi r1, #0x73 ; cache on (with invalidation) +; ldi r1, #0x00 ; cache off + st r1, @r0 +#else +#error unknown chip configuration +#endif + +#ifdef CONFIG_SMP + ;; if not BSP (CPU#0) goto AP_loop + seth r5, #shigh(M32R_CPUID_PORTL) + ld r5, @(low(M32R_CPUID_PORTL), r5) + bnez r5, AP_loop +#if !defined(CONFIG_PLAT_USRV) + ;; boot AP + ld24 r5, #0xeff2f8 ; IPICR7 + ldi r6, #0x2 ; IPI to CPU1 + st r6, @r5 +#endif +#endif + +/* + * Now, Jump to stext + * if with MMU, TLB on. + * if with no MMU, only jump. + */ + .global eit_vector +mmu_on: + LDIMM (r13, stext) +#ifdef CONFIG_MMU + bl init_tlb + LDIMM (r2, eit_vector) ; set EVB(cr5) + mvtc r2, cr5 + seth r0, #high(MMU_REG_BASE) ; Set MMU_REG_BASE higher + or3 r0, r0, #low(MMU_REG_BASE) ; Set MMU_REG_BASE lower + ldi r1, #0x01 + st r1, @(MATM_offset,r0) ; Set MATM (T bit ON) + ld r0, @(MATM_offset,r0) ; Check +#else + seth r0,#high(M32R_MCDCAR) + or3 r0,r0,#low(M32R_MCDCAR) + ld24 r1,#0x8080 + st r1,@r0 +#endif /* CONFIG_MMU */ + jmp r13 + nop + nop + +#ifdef CONFIG_SMP +/* + * AP wait loop + */ +ENTRY(AP_loop) + ;; disable interrupt + clrpsw #0x40 + ;; reset EVB + LDIMM (r4, _AP_RE) + seth r5, #high(__PAGE_OFFSET) + or3 r5, r5, #low(__PAGE_OFFSET) + not r5, r5 + and r4, r5 + mvtc r4, cr5 + ;; disable maskable interrupt + seth r4, #high(M32R_ICU_IMASK_PORTL) + or3 r4, r4, #low(M32R_ICU_IMASK_PORTL) + ldi r5, #0 + st r5, @r4 + ld r5, @r4 + ;; enable only IPI + setpsw #0x40 + ;; LOOOOOOOOOOOOOOP!!! + .fillinsn +2: + nop + nop + bra 2b + nop + nop + +#ifdef CONFIG_CHIP_M32700_TS1 + .global dcache_dummy + .balign 16, 0 +dcache_dummy: + .byte 16 +#endif /* CONFIG_CHIP_M32700_TS1 */ +#endif /* CONFIG_SMP */ + + .end + diff -Nru a/arch/m32r/defconfig b/arch/m32r/defconfig --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/defconfig 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,635 @@ +# +# Automatically generated make config: don't edit +# +CONFIG_M32R=y +CONFIG_UID16=y +CONFIG_GENERIC_ISA_DMA=y + +# +# Code maturity level options +# +CONFIG_EXPERIMENTAL=y +CONFIG_CLEAN_COMPILE=y +CONFIG_BROKEN_ON_SMP=y + +# +# General setup +# +CONFIG_SWAP=y +CONFIG_SYSVIPC=y +# CONFIG_POSIX_MQUEUE is not set +CONFIG_BSD_PROCESS_ACCT=y +# CONFIG_BSD_PROCESS_ACCT_V3 is not set +CONFIG_SYSCTL=y +# CONFIG_AUDIT is not set +CONFIG_LOG_BUF_SHIFT=14 +CONFIG_HOTPLUG=y +CONFIG_IKCONFIG=y +# CONFIG_IKCONFIG_PROC is not set +CONFIG_EMBEDDED=y +# CONFIG_KALLSYMS is not set +# CONFIG_FUTEX is not set +# CONFIG_EPOLL is not set +CONFIG_IOSCHED_NOOP=y +# CONFIG_IOSCHED_AS is not set +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 is not set +CONFIG_OBSOLETE_MODPARM=y +# CONFIG_MODVERSIONS is not set +CONFIG_KMOD=y + +# +# Processor type and features +# +# CONFIG_PLAT_MAPPI is not set +# CONFIG_PLAT_USRV is not set +CONFIG_PLAT_M32700UT=y +# CONFIG_PLAT_OPSPUT is not set +# CONFIG_PLAT_OAKS32R is not set +# CONFIG_PLAT_MAPPI2 is not set +CONFIG_CHIP_M32700=y +# CONFIG_CHIP_M32102 is not set +# CONFIG_CHIP_VDEC2 is not set +# CONFIG_CHIP_OPSP is not set +CONFIG_MMU=y +CONFIG_TLB_ENTRIES=32 +CONFIG_ISA_M32R2=y +CONFIG_ISA_DSP_LEVEL2=y +CONFIG_ISA_DUAL_ISSUE=y +CONFIG_BUS_CLOCK=50000000 +CONFIG_TIMER_DIVIDE=128 +# CONFIG_CPU_LITTLE_ENDIAN is not set +CONFIG_MEMORY_START=0x08000000 +CONFIG_MEMORY_SIZE=0x01000000 +CONFIG_NOHIGHMEM=y +# CONFIG_DISCONTIGMEM is not set +CONFIG_RWSEM_GENERIC_SPINLOCK=y +# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set +CONFIG_PREEMPT=y +# CONFIG_HAVE_DEC_LOCK is not set +# CONFIG_SMP is not set + +# +# M32R drivers +# +# CONFIG_M32RPCC is not set +CONFIG_M32R_CFC=y +CONFIG_M32700UT_CFC=y +CONFIG_CFC_NUM=1 +# CONFIG_MTD_M32R is not set +CONFIG_M32R_SMC91111=y +CONFIG_M32700UT_DS1302=y + +# +# Power management options (ACPI, APM) +# +# CONFIG_PM is not set + +# +# Bus options (PCI, PCMCIA, EISA, MCA, ISA) +# +# CONFIG_PCI is not set +# CONFIG_ISA is not set + +# +# PCMCIA/CardBus support +# +CONFIG_PCMCIA=y +# CONFIG_PCMCIA_DEBUG is not set +# CONFIG_TCIC is not set + +# +# PCI Hotplug Support +# + +# +# Executable file formats +# +CONFIG_BINFMT_ELF=y +# CONFIG_BINFMT_MISC is not set + +# +# Device Drivers +# + +# +# Generic Driver Options +# +CONFIG_STANDALONE=y +CONFIG_PREVENT_FIRMWARE_BUILD=y +# CONFIG_FW_LOADER 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_FD is not set +CONFIG_BLK_DEV_LOOP=y +# CONFIG_BLK_DEV_CRYPTOLOOP is not set +CONFIG_BLK_DEV_NBD=y +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=y +CONFIG_BLK_DEV_IDE=y + +# +# Please see Documentation/ide.txt for help/info on IDE drives +# +# CONFIG_BLK_DEV_IDE_SATA is not set +CONFIG_BLK_DEV_IDEDISK=y +# CONFIG_IDEDISK_MULTI_MODE is not set +CONFIG_BLK_DEV_IDECS=y +CONFIG_BLK_DEV_IDECD=m +# CONFIG_BLK_DEV_IDETAPE is not set +# CONFIG_BLK_DEV_IDEFLOPPY is not set +# CONFIG_BLK_DEV_IDESCSI is not set +# CONFIG_IDE_TASK_IOCTL is not set +# CONFIG_IDE_TASKFILE_IO is not set + +# +# IDE chipset support/bugfixes +# +CONFIG_IDE_GENERIC=y +# CONFIG_IDE_ARM is not set +# CONFIG_BLK_DEV_IDEDMA is not set +# CONFIG_IDEDMA_AUTO is not set +# CONFIG_BLK_DEV_HD is not set + +# +# SCSI device support +# +CONFIG_SCSI=m +CONFIG_SCSI_PROC_FS=y + +# +# SCSI support type (disk, tape, CD-ROM) +# +CONFIG_BLK_DEV_SD=m +# CONFIG_CHR_DEV_ST is not set +# CONFIG_CHR_DEV_OSST is not set +CONFIG_BLK_DEV_SR=m +# CONFIG_BLK_DEV_SR_VENDOR is not set +CONFIG_CHR_DEV_SG=m + +# +# Some SCSI devices (e.g. CD jukebox) support multiple LUNs +# +CONFIG_SCSI_MULTI_LUN=y +# CONFIG_SCSI_CONSTANTS is not set +# CONFIG_SCSI_LOGGING is not set + +# +# SCSI Transport Attributes +# +# CONFIG_SCSI_SPI_ATTRS is not set +# 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 + +# +# PCMCIA SCSI adapter support +# +# CONFIG_PCMCIA_AHA152X is not set +# CONFIG_PCMCIA_FDOMAIN is not set +# CONFIG_PCMCIA_NINJA_SCSI is not set +# CONFIG_PCMCIA_QLOGIC is not set +# CONFIG_PCMCIA_SYM53C500 is not set + +# +# Multi-device support (RAID and LVM) +# +# CONFIG_MD is not set + +# +# Fusion MPT device support +# + +# +# IEEE 1394 (FireWire) support +# + +# +# 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=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=y +CONFIG_IP_PNP_DHCP=y +# CONFIG_IP_PNP_BOOTP is not set +# CONFIG_IP_PNP_RARP is not set +# CONFIG_NET_IPIP is not set +# CONFIG_NET_IPGRE 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_HW_FLOWCONTROL is not set + +# +# QoS and/or fair queueing +# +# CONFIG_NET_SCHED is not set +# CONFIG_NET_CLS_ROUTE 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 is not set +# 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 is not set +# CONFIG_SERIAL_NONSTANDARD is not set + +# +# Serial drivers +# +# CONFIG_SERIAL_8250 is not set + +# +# Non-8250 serial port support +# +CONFIG_SERIAL_CORE=y +CONFIG_SERIAL_CORE_CONSOLE=y +# CONFIG_SERIAL_M32R_SIO is not set +CONFIG_SERIAL_M32R_PLDSIO=y +CONFIG_SERIAL_M32R_PLDSIO_CONSOLE=y +CONFIG_UNIX98_PTYS=y +CONFIG_LEGACY_PTYS=y +CONFIG_LEGACY_PTY_COUNT=256 +# CONFIG_QIC02_TAPE is not set + +# +# IPMI +# +# CONFIG_IPMI_HANDLER is not set + +# +# Watchdog Cards +# +# CONFIG_WATCHDOG is not set +# CONFIG_RTC is not set +# CONFIG_GEN_RTC is not set +# CONFIG_DTLK is not set +# CONFIG_R3964 is not set + +# +# Ftape, the floppy tape device driver +# +# CONFIG_AGP is not set +# CONFIG_DRM is not set + +# +# PCMCIA character devices +# +# CONFIG_SYNCLINK_CS is not set +# CONFIG_RAW_DRIVER is not set + +# +# I2C support +# +# CONFIG_I2C is not set + +# +# Dallas's 1-wire bus +# +# CONFIG_W1 is not set + +# +# Misc devices +# + +# +# Multimedia devices +# +CONFIG_VIDEO_DEV=y + +# +# Video For Linux +# + +# +# Video Adapters +# +# CONFIG_VIDEO_CPIA is not set +CONFIG_M32R_AR=y +CONFIG_M32R_AR_VGA=y + +# +# Radio Adapters +# +# CONFIG_RADIO_MAESTRO is not set + +# +# Digital Video Broadcasting Devices +# +# CONFIG_DVB is not set + +# +# Graphics support +# +# CONFIG_FB is not set + +# +# 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=m +CONFIG_EXT3_FS_XATTR=y +# CONFIG_EXT3_FS_POSIX_ACL is not set +# CONFIG_EXT3_FS_SECURITY is not set +CONFIG_JBD=m +CONFIG_JBD_DEBUG=y +CONFIG_FS_MBCACHE=y +CONFIG_REISERFS_FS=m +# CONFIG_REISERFS_CHECK is not set +# CONFIG_REISERFS_PROC_INFO is not set +# CONFIG_REISERFS_FS_XATTR 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=m +CONFIG_JOLIET=y +# CONFIG_ZISOFS is not set +CONFIG_UDF_FS=m +CONFIG_UDF_NLS=y + +# +# DOS/FAT/NT Filesystems +# +CONFIG_FAT_FS=m +CONFIG_MSDOS_FS=m +CONFIG_VFAT_FS=m +CONFIG_FAT_DEFAULT_CODEPAGE=437 +CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" +# CONFIG_NTFS_FS is not set + +# +# Pseudo filesystems +# +CONFIG_PROC_FS=y +CONFIG_PROC_KCORE=y +CONFIG_SYSFS=y +CONFIG_DEVFS_FS=y +CONFIG_DEVFS_MOUNT=y +# CONFIG_DEVFS_DEBUG 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_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=y +# CONFIG_NFS_V4 is not set +# CONFIG_NFS_DIRECTIO is not set +# CONFIG_NFSD is not set +CONFIG_ROOT_NFS=y +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_CODA_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=y +CONFIG_NLS_DEFAULT="iso8859-1" +# CONFIG_NLS_CODEPAGE_437 is not set +# CONFIG_NLS_CODEPAGE_737 is not set +# CONFIG_NLS_CODEPAGE_775 is not set +# CONFIG_NLS_CODEPAGE_850 is not set +# CONFIG_NLS_CODEPAGE_852 is not set +# CONFIG_NLS_CODEPAGE_855 is not set +# CONFIG_NLS_CODEPAGE_857 is not set +# CONFIG_NLS_CODEPAGE_860 is not set +# CONFIG_NLS_CODEPAGE_861 is not set +# CONFIG_NLS_CODEPAGE_862 is not set +# CONFIG_NLS_CODEPAGE_863 is not set +# CONFIG_NLS_CODEPAGE_864 is not set +# CONFIG_NLS_CODEPAGE_865 is not set +# CONFIG_NLS_CODEPAGE_866 is not set +# CONFIG_NLS_CODEPAGE_869 is not set +# CONFIG_NLS_CODEPAGE_936 is not set +# CONFIG_NLS_CODEPAGE_950 is not set +# CONFIG_NLS_CODEPAGE_932 is not set +# CONFIG_NLS_CODEPAGE_949 is not set +# CONFIG_NLS_CODEPAGE_874 is not set +# CONFIG_NLS_ISO8859_8 is not set +# CONFIG_NLS_CODEPAGE_1250 is not set +# CONFIG_NLS_CODEPAGE_1251 is not set +# CONFIG_NLS_ASCII is not set +# CONFIG_NLS_ISO8859_1 is not set +# CONFIG_NLS_ISO8859_2 is not set +# CONFIG_NLS_ISO8859_3 is not set +# CONFIG_NLS_ISO8859_4 is not set +# CONFIG_NLS_ISO8859_5 is not set +# CONFIG_NLS_ISO8859_6 is not set +# CONFIG_NLS_ISO8859_7 is not set +# CONFIG_NLS_ISO8859_9 is not set +# CONFIG_NLS_ISO8859_13 is not set +# CONFIG_NLS_ISO8859_14 is not set +# CONFIG_NLS_ISO8859_15 is not set +# CONFIG_NLS_KOI8_R is not set +# CONFIG_NLS_KOI8_U is not set +# CONFIG_NLS_UTF8 is not set + +# +# Profiling support +# +# CONFIG_PROFILING is not set + +# +# Kernel hacking +# +# CONFIG_DEBUG_KERNEL is not set +# CONFIG_DEBUG_SPINLOCK_SLEEP 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_CRC_CCITT is not set +CONFIG_CRC32=y +# CONFIG_LIBCRC32C is not set diff -Nru a/arch/m32r/drivers/Kconfig b/arch/m32r/drivers/Kconfig --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/drivers/Kconfig 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,34 @@ +# +# For a description of the syntax of this configuration file, +# see Documentation/kbuild/kconfig-language.txt. +# + +menu "M32R drivers" + +config M32RPCC + bool "M32R PCMCIA I/F" + depends on CHIP_M32700 + +config M32R_CFC + bool "CF I/F Controller" + depends on PLAT_USRV || PLAT_M32700UT || PLAT_MAPPI2 || PLAT_OPSPUT + +config M32700UT_CFC + bool + depends on M32R_CFC + default y + +config CFC_NUM + int "CF I/F number" + depends on PLAT_USRV || PLAT_M32700UT + default "1" if PLAT_USRV || PLAT_M32700UT || PLAT_MAPPI2 || PLAT_OPSPUT + +config MTD_M32R + bool "Flash device mapped on M32R" + depends on PLAT_USRV || PLAT_M32700UT || PLAT_MAPPI2 + +config M32700UT_DS1302 + bool "DS1302 Real Time Clock support" + depends on PLAT_M32700UT || PLAT_OPSPUT + +endmenu diff -Nru a/arch/m32r/drivers/Makefile b/arch/m32r/drivers/Makefile --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/drivers/Makefile 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,7 @@ +# +# Makefile for the Linux/M32R driver +# + +obj-$(CONFIG_M32RPCC) += m32r_pcc.o +obj-$(CONFIG_M32R_CFC) += m32r_cfc.o +obj-$(CONFIG_M32700UT_DS1302) += ds1302.o diff -Nru a/arch/m32r/drivers/cs_internal.h b/arch/m32r/drivers/cs_internal.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/drivers/cs_internal.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,2 @@ +#include "../../../drivers/pcmcia/cs_internal.h" + diff -Nru a/arch/m32r/drivers/ds1302.c b/arch/m32r/drivers/ds1302.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/drivers/ds1302.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,432 @@ +/*!*************************************************************************** +*! +*! FILE NAME : ds1302.c +*! +*! DESCRIPTION: Implements an interface for the DS1302 RTC through Etrax I/O +*! +*! Functions exported: ds1302_readreg, ds1302_writereg, ds1302_init, get_rtc_status +*! +*! $Log: ds1302.c,v $ +*! Revision 1.2 2003/10/29 08:42:58 fujiwara +*! Set PLD_RTCBAUR from bus clock +*! +*! Revision 1.12 2002/04/10 15:35:25 johana +*! Moved probe function closer to init function and marked it __init. +*! +*! Revision 1.11 2001/06/14 12:35:52 jonashg +*! The ATA hack is back. It is unfortunately the only way to set g27 to output. +*! +*! Revision 1.9 2001/06/14 10:00:14 jonashg +*! No need for tempudelay to be inline anymore (had to adjust the usec to +*! loops conversion because of this to make it slow enough to be a udelay). +*! +*! Revision 1.8 2001/06/14 08:06:32 jonashg +*! Made tempudelay delay usecs (well, just a tad more). +*! +*! Revision 1.7 2001/06/13 14:18:11 jonashg +*! Only allow processes with SYS_TIME capability to set time and charge. +*! +*! Revision 1.6 2001/06/12 15:22:07 jonashg +*! * Made init function __init. +*! * Parameter to out_byte() is unsigned char. +*! * The magic number 42 has got a name. +*! * Removed comment about /proc (nothing is exported there). +*! +*! Revision 1.5 2001/06/12 14:35:13 jonashg +*! Gave the module a name and added it to printk's. +*! +*! Revision 1.4 2001/05/31 14:53:40 jonashg +*! Made tempudelay() inline so that the watchdog doesn't reset (see +*! function comment). +*! +*! Revision 1.3 2001/03/26 16:03:06 bjornw +*! Needs linux/config.h +*! +*! Revision 1.2 2001/03/20 19:42:00 bjornw +*! Use the ETRAX prefix on the DS1302 options +*! +*! Revision 1.1 2001/03/20 09:13:50 magnusmn +*! Linux 2.4 port +*! +*! Revision 1.10 2000/07/05 15:38:23 bjornw +*! Dont update kernel time when a RTC_SET_TIME is done +*! +*! Revision 1.9 2000/03/02 15:42:59 macce +*! * Hack to make RTC work on all 2100/2400 +*! +*! Revision 1.8 2000/02/23 16:59:18 torbjore +*! added setup of R_GEN_CONFIG when RTC is connected to the generic port. +*! +*! Revision 1.7 2000/01/17 15:51:43 johana +*! Added RTC_SET_CHARGE ioctl to enable trickle charger. +*! +*! Revision 1.6 1999/10/27 13:19:47 bjornw +*! Added update_xtime_from_cmos which reads back the updated RTC into the kernel. +*! /dev/rtc calls it now. +*! +*! Revision 1.5 1999/10/27 12:39:37 bjornw +*! Disabled superuser check. Anyone can now set the time. +*! +*! Revision 1.4 1999/09/02 13:27:46 pkj +*! Added shadow for R_PORT_PB_CONFIG. +*! Renamed port_g_shadow to port_g_data_shadow. +*! +*! Revision 1.3 1999/09/02 08:28:06 pkj +*! Made it possible to select either port PB or the generic port for the RST +*! signal line to the DS1302 RTC. +*! Also make sure the RST bit is configured as output on Port PB (if used). +*! +*! Revision 1.2 1999/09/01 14:47:20 bjornw +*! Added support for /dev/rtc operations with ioctl RD_TIME and SET_TIME to read +*! and set the date. Register as major 121. +*! +*! Revision 1.1 1999/09/01 09:45:29 bjornw +*! Implemented a DS1302 RTC driver. +*! +*! +*! --------------------------------------------------------------------------- +*! +*! (C) Copyright 1999, 2000, 2001 Axis Communications AB, LUND, SWEDEN +*! +*! $Id: ds1302.c,v 1.2 2003/10/29 08:42:58 fujiwara Exp $ +*! +*!***************************************************************************/ + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#define RTC_MAJOR_NR 121 /* local major, change later */ + +static const char ds1302_name[] = "ds1302"; + +/* Send 8 bits. */ +static void +out_byte_rtc(unsigned int reg_addr, unsigned char x) +{ + //RST H + outw(0x0001,(unsigned long)PLD_RTCRSTODT); + //write data + outw(((x<<8)|(reg_addr&0xff)),(unsigned long)PLD_RTCWRDATA); + //WE + outw(0x0002,(unsigned long)PLD_RTCCR); + //wait + while(inw((unsigned long)PLD_RTCCR)); + + //RST L + outw(0x0000,(unsigned long)PLD_RTCRSTODT); + +} + +static unsigned char +in_byte_rtc(unsigned int reg_addr) +{ + unsigned char retval; + + //RST H + outw(0x0001,(unsigned long)PLD_RTCRSTODT); + //write data + outw((reg_addr&0xff),(unsigned long)PLD_RTCRDDATA); + //RE + outw(0x0001,(unsigned long)PLD_RTCCR); + //wait + while(inw((unsigned long)PLD_RTCCR)); + + //read data + retval=(inw((unsigned long)PLD_RTCRDDATA) & 0xff00)>>8; + + //RST L + outw(0x0000,(unsigned long)PLD_RTCRSTODT); + + return retval; +} + +/* Enable writing. */ + +static void +ds1302_wenable(void) +{ + out_byte_rtc(0x8e,0x00); +} + +/* Disable writing. */ + +static void +ds1302_wdisable(void) +{ + out_byte_rtc(0x8e,0x80); +} + + + +/* Read a byte from the selected register in the DS1302. */ + +unsigned char +ds1302_readreg(int reg) +{ + unsigned char x; + + x=in_byte_rtc((0x81 | (reg << 1))); /* read register */ + + return x; +} + +/* Write a byte to the selected register. */ + +void +ds1302_writereg(int reg, unsigned char val) +{ + ds1302_wenable(); + out_byte_rtc((0x80 | (reg << 1)),val); + ds1302_wdisable(); +} + +void +get_rtc_time(struct rtc_time *rtc_tm) +{ + unsigned long flags; + + local_irq_save(flags); + local_irq_disable(); + + rtc_tm->tm_sec = CMOS_READ(RTC_SECONDS); + rtc_tm->tm_min = CMOS_READ(RTC_MINUTES); + rtc_tm->tm_hour = CMOS_READ(RTC_HOURS); + rtc_tm->tm_mday = CMOS_READ(RTC_DAY_OF_MONTH); + rtc_tm->tm_mon = CMOS_READ(RTC_MONTH); + rtc_tm->tm_year = CMOS_READ(RTC_YEAR); + + local_irq_restore(flags); + + BCD_TO_BIN(rtc_tm->tm_sec); + BCD_TO_BIN(rtc_tm->tm_min); + BCD_TO_BIN(rtc_tm->tm_hour); + BCD_TO_BIN(rtc_tm->tm_mday); + BCD_TO_BIN(rtc_tm->tm_mon); + BCD_TO_BIN(rtc_tm->tm_year); + + /* + * Account for differences between how the RTC uses the values + * and how they are defined in a struct rtc_time; + */ + + if (rtc_tm->tm_year <= 69) + rtc_tm->tm_year += 100; + + rtc_tm->tm_mon--; +} + +static unsigned char days_in_mo[] = + {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; + +/* ioctl that supports RTC_RD_TIME and RTC_SET_TIME (read and set time/date). */ + +static int +rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd, + unsigned long arg) +{ + unsigned long flags; + + switch(cmd) { + case RTC_RD_TIME: /* read the time/date from RTC */ + { + struct rtc_time rtc_tm; + + memset(&rtc_tm, 0, sizeof (struct rtc_time)); + get_rtc_time(&rtc_tm); + if (copy_to_user((struct rtc_time*)arg, &rtc_tm, sizeof(struct rtc_time))) + return -EFAULT; + return 0; + } + + case RTC_SET_TIME: /* set the RTC */ + { + struct rtc_time rtc_tm; + unsigned char mon, day, hrs, min, sec, leap_yr; + unsigned int yrs; + + if (!capable(CAP_SYS_TIME)) + return -EPERM; + + if (copy_from_user(&rtc_tm, (struct rtc_time*)arg, sizeof(struct rtc_time))) + return -EFAULT; + + yrs = rtc_tm.tm_year + 1900; + mon = rtc_tm.tm_mon + 1; /* tm_mon starts at zero */ + day = rtc_tm.tm_mday; + hrs = rtc_tm.tm_hour; + min = rtc_tm.tm_min; + sec = rtc_tm.tm_sec; + + + if ((yrs < 1970) || (yrs > 2069)) + return -EINVAL; + + leap_yr = ((!(yrs % 4) && (yrs % 100)) || !(yrs % 400)); + + if ((mon > 12) || (day == 0)) + return -EINVAL; + + if (day > (days_in_mo[mon] + ((mon == 2) && leap_yr))) + return -EINVAL; + + if ((hrs >= 24) || (min >= 60) || (sec >= 60)) + return -EINVAL; + + if (yrs >= 2000) + yrs -= 2000; /* RTC (0, 1, ... 69) */ + else + yrs -= 1900; /* RTC (70, 71, ... 99) */ + + BIN_TO_BCD(sec); + BIN_TO_BCD(min); + BIN_TO_BCD(hrs); + BIN_TO_BCD(day); + BIN_TO_BCD(mon); + BIN_TO_BCD(yrs); + + local_irq_save(flags); + local_irq_disable(); + CMOS_WRITE(yrs, RTC_YEAR); + CMOS_WRITE(mon, RTC_MONTH); + CMOS_WRITE(day, RTC_DAY_OF_MONTH); + CMOS_WRITE(hrs, RTC_HOURS); + CMOS_WRITE(min, RTC_MINUTES); + CMOS_WRITE(sec, RTC_SECONDS); + local_irq_restore(flags); + + /* Notice that at this point, the RTC is updated but + * the kernel is still running with the old time. + * You need to set that separately with settimeofday + * or adjtimex. + */ + return 0; + } + + case RTC_SET_CHARGE: /* set the RTC TRICKLE CHARGE register */ + { + int tcs_val; + + if (!capable(CAP_SYS_TIME)) + return -EPERM; + + if(copy_from_user(&tcs_val, (int*)arg, sizeof(int))) + return -EFAULT; + + tcs_val = RTC_TCR_PATTERN | (tcs_val & 0x0F); + ds1302_writereg(RTC_TRICKLECHARGER, tcs_val); + return 0; + } + default: + return -EINVAL; + } +} + +int +get_rtc_status(char *buf) +{ + char *p; + struct rtc_time tm; + + p = buf; + + get_rtc_time(&tm); + + /* + * There is no way to tell if the luser has the RTC set for local + * 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; +} + + +/* The various file operations we support. */ + +static struct file_operations rtc_fops = { + .owner = THIS_MODULE, + .ioctl = rtc_ioctl, +}; + +/* Probe for the chip by writing something to its RAM and try reading it back. */ + +#define MAGIC_PATTERN 0x42 + +static int __init +ds1302_probe(void) +{ + int retval, res, baur; + + baur=(boot_cpu_data.bus_clock/(2*1000*1000)); + + printk("%s: Set PLD_RTCBAUR = %d\n", ds1302_name,baur); + + outw(0x0000,(unsigned long)PLD_RTCCR); + outw(0x0000,(unsigned long)PLD_RTCRSTODT); + outw(baur,(unsigned long)PLD_RTCBAUR); + + /* Try to talk to timekeeper. */ + + ds1302_wenable(); + /* write RAM byte 0 */ + /* write something magic */ + out_byte_rtc(0xc0,MAGIC_PATTERN); + + /* read RAM byte 0 */ + if((res = in_byte_rtc(0xc1)) == MAGIC_PATTERN) { + char buf[100]; + ds1302_wdisable(); + printk("%s: RTC found.\n", ds1302_name); + get_rtc_status(buf); + printk(buf); + retval = 1; + } else { + printk("%s: RTC not found.\n", ds1302_name); + retval = 0; + } + + return retval; +} + + +/* Just probe for the RTC and register the device to handle the ioctl needed. */ + +int __init +ds1302_init(void) +{ + if (!ds1302_probe()) { + return -1; + } + return 0; +} + +static int __init ds1302_register(void) +{ + ds1302_init(); + if (register_chrdev(RTC_MAJOR_NR, ds1302_name, &rtc_fops)) { + printk(KERN_INFO "%s: unable to get major %d for rtc\n", + ds1302_name, RTC_MAJOR_NR); + return -1; + } + return 0; +} + +module_init(ds1302_register); diff -Nru a/arch/m32r/drivers/m32r-pldsio.c b/arch/m32r/drivers/m32r-pldsio.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/drivers/m32r-pldsio.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,3067 @@ +/* $Id$ + * + * M32R onboard PLD serial module support. + * + * Much of the design and some of the code came from serial.c: + * Copyright (C) 1991, 1992 Linus Torvalds + * Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, + * 1998, 1999 Theodore Ts'o + * + * M32R work: + * Copyright 1996, 2001, Mitsubishi Electric Corporation + * Copyright (C) 2000,2001 by Hiro Kondo, Hiro Takata, and Hitoshi Yamamoto. + * + * 2002-12-25: Support M32700UT Platform by Takeo Takahashi + * Derived from dbg_console.c. + */ + +static char *serial_version = "kondo"; +static char *serial_revdate = "2002-09-11"; +static char *serial_name = "M32R Serial driver"; + +#define LOCAL_VERSTRING "" + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include /* serial_state */ +#include /* kmalloc */ + +#include +#include +#include +#include +#include + +extern struct console console_for_debug; + +static int psio_write(struct tty_struct *tty, int from_user, + const unsigned char *buf, int count); +static int psio_write_room(struct tty_struct *tty); +static int psio_chars_in_buffer(struct tty_struct *tty); + +static void dbg_console_write(struct console *, const char *, unsigned); +static kdev_t dbg_console_device(struct console *c); +//static void psio_interrupt_single(int, void *, struct pt_regs *); +void psio_interrupt_single(int, void *, struct pt_regs *); +static void psio_receive_chars(struct async_struct *, int *); + +static void psio_wait_until_sent(struct tty_struct *, int); +static void change_speed(struct async_struct *,struct termios *); +static void autoconfig(struct serial_state *); +static unsigned detect_uart_irq (struct serial_state *); + +static struct tty_driver psio_driver; +static int psio_refcount; + +#define RS_STROBE_TIME (10*HZ) +#define RS_ISR_PASS_LIMIT 256 + +/* number of characters left in xmit buffer before we ask for more */ +#define WAKEUP_CHARS 256 + +static struct async_struct *IRQ_ports[NR_IRQS]; +static int IRQ_timeout[NR_IRQS]; +#ifdef CONFIG_SERIAL_CONSOLE +static struct console cons; +static int lsr_break_flag; +#endif + +#define BAUDRATE 115200 /* Set Baudrate */ + +/* + * Here we define the default xmit fifo size used for each type of + * UART + */ +static struct serial_uart_config uart_config[] = { + { "unknown", 1, 0 }, + { "8250", 1, 0 }, + { "16450", 1, 0 }, + { "16550", 1, 0 }, + { "16550A", 16, UART_CLEAR_FIFO | UART_USE_FIFO }, + { "cirrus", 1, 0 }, /* usurped by cyclades.c */ + { "ST16650", 1, UART_CLEAR_FIFO | UART_STARTECH }, + { "ST16650V2", 32, UART_CLEAR_FIFO | UART_USE_FIFO | + UART_STARTECH }, + { "TI16750", 64, UART_CLEAR_FIFO | UART_USE_FIFO}, + { "Startech", 1, 0}, /* usurped by cyclades.c */ + { "16C950/954", 128, UART_CLEAR_FIFO | UART_USE_FIFO}, + { "ST16654", 64, UART_CLEAR_FIFO | UART_USE_FIFO | + UART_STARTECH }, + { "XR16850", 128, UART_CLEAR_FIFO | UART_USE_FIFO | + UART_STARTECH }, + { "RSA", 2048, UART_CLEAR_FIFO | UART_USE_FIFO }, + { "m32102", 1, 0 }, + { 0, 0} +}; + +static struct serial_state rs_table[RS_TABLE_SIZE] = { +/* UART CLK PORT IRQ FLAGS */ + { 0, BAUDRATE, ((int)PLD_ESIO0CR + NONCACHE_OFFSET), PLD_IRQ_SIO0_RCV, STD_COM_FLAGS }, +}; +#define NR_PORTS (sizeof(rs_table)/sizeof(struct serial_state)) + + +#define HIGH_BITS_OFFSET ((sizeof(long)-sizeof(int))*8) + +static DECLARE_TASK_QUEUE(tq_psio_serial); +static struct tty_struct *psio_table[NR_PORTS]; +static struct termios *psio_termios[NR_PORTS]; +static struct termios *psio_termios_locked[NR_PORTS]; + +#if defined(MODULE) && defined(SERIAL_DEBUG_MCOUNT) +#define DBG_CNT(s) printk("(%s): [%x] refc=%d, serc=%d, ttyc=%d -> %s\n", \ + kdevname(tty->device), (info->flags), serial_refcount,info->count,tty->count,s +) +#else +#define DBG_CNT(s) +#endif + + +static struct timer_list serial_timer; + +static unsigned char *tmp_buf; +#ifdef DECLARE_MUTEX +static DECLARE_MUTEX(tmp_buf_sem); +#else +static struct semaphore tmp_buf_sem = MUTEX; +#endif + +static int dbg_console_setup(struct console *console, char *options); + +#undef SIO0CR +#undef SIO0MOD0 +#undef SIO0MOD1 +#undef SIO0STS +#undef SIO0IMASK +#undef SIO0BAUR +#undef SIO0TXB +#undef SIO0RXB +#define SIO0CR PLD_ESIO0CR +#define SIO0MOD0 PLD_ESIO0MOD0 +#define SIO0MOD1 PLD_ESIO0MOD1 +#define SIO0STS PLD_ESIO0STS +#define SIO0IMASK PLD_ESIO0INTCR +#define SIO0BAUR PLD_ESIO0BAUR +#define SIO0TXB PLD_ESIO0TXB +#define SIO0RXB PLD_ESIO0RXB + +#define SIO_IMASK_TEMPIE (1UL<<1) /* b14: enable */ +#define SIO_IMASK_RXCEN (1UL<<2) /* b13: enable */ +#define SIO_IMASK_REIE (0UL) +#define SIO_SIO0STS_TEMP (1UL<<0) /* Transmitter Register Empty */ +#define SIO_SIO0STS_TXCP (1UL<<1) +#define SIO_SIO0STS_RXCP (1UL<<2) +#define SIO_SIO0STS_OERR (0UL) +#define SIO_SIO0STS_PERR (0UL) +#define SIO_SIO0STS_FERR (0UL) +#define SIO_SIO0MOD0_CTSS (1UL<<6) +#define SIO_SIO0MOD0_RTSS (1UL<<7) +#define SIO_NONE (0UL) + +#define UART_TX ((unsigned char *)SIO0TXB - (unsigned char *)SIO0CR) +#define UART_RX ((unsigned char *)SIO0RXB - (unsigned char *)SIO0CR) +#define UART_IER ((unsigned char *)SIO0IMASK - (unsigned char *)SIO0CR) +#define UART_IER_THRI SIO_IMASK_TEMPIE +#define UART_IER_MSI SIO_NONE +#define UART_IER_RLSI SIO_IMASK_RXCEN +#define UART_IER_RDI SIO_IMASK_REIE +#define UART_LSR ((unsigned char *)SIO0STS - (unsigned char *)SIO0CR) +#define UART_LSR_DR SIO_SIO0STS_RXCP +#define UART_LSR_THRE SIO_SIO0STS_TEMP +#define UART_LSR_TEMT SIO_SIO0STS_TXCP +#define UART_EMPTY (UART_LSR_TEMT | UART_LSR_THRE) +#define UART_LSR_BI SIO_NONE +#define UART_LSR_PE SIO_SIO0STS_PERR +#define UART_LSR_FE SIO_SIO0STS_FERR +#define UART_LSR_OE SIO_SIO0STS_OERR +#define UART_IIR ((unsigned char *)SIO0STS - (unsigned char *)SIO0CR) +#define UART_LCR ((unsigned char *)SIO0CR - (unsigned char *)SIO0CR) +#define UART_LCR_SBC SIO_NONE +#define UART_LCR_PARITY SIO_NONE +#define UART_LCR_EPAR SIO_NONE +#define UART_LCR_SPAR SIO_NONE +#define UART_MCR ((unsigned char *)SIO0MOD0 - (unsigned char *)SIO0CR) +#define UART_MCR_RTS SIO_SIO0MOD0_RTSS +#define UART_MCR_DTR SIO_NONE /* SIO_SIO0MOD0_CTSS */ +#define UART_MCR_LOOP SIO_NONE +#define UART_MCR_OUT1 SIO_NONE +#define UART_MCR_OUT2 SIO_NONE +#define UART_MSR ((unsigned char *)SIO0MOD0 - (unsigned char *)SIO0CR) +#define UART_MSR_DCD SIO_NONE +#define UART_MSR_RI SIO_NONE +#define UART_MSR_DSR SIO_NONE +#define UART_MSR_CTS SIO_NONE + +#define UART_BAUR ((unsigned char *)SIO0BAUR - (unsigned char *)SIO0CR) +#define UART_MOD0 ((unsigned char *)SIO0MOD0 - (unsigned char *)SIO0CR) +#define UART_MOD1 ((unsigned char *)SIO0MOD1 - (unsigned char *)SIO0CR) + +static inline unsigned int psio_in(struct async_struct *info,int offset) +{ + return *(volatile unsigned short *)(info->port + offset); +} +static inline void psio_out(struct async_struct *info,int offset,int value) +{ + *(volatile unsigned short *)(info->port + offset) = value; +} + +#define serial_in(info, offset) psio_in(info,(int)offset) +#define serial_out(info, offset, value) psio_out(info,(int)offset, value) +#define serial_inp(info, offset) psio_in(info,(int)offset) +#define serial_outp(info, offset, value) psio_out(info,(int)offset, value) + + +static inline int serial_paranoia_check(struct async_struct *info, + kdev_t device, const char *routine) +{ +#ifdef SERIAL_PARANOIA_CHECK + static const char *badmagic = + "Warning: bad magic number for serial struct (%s) in %s\n"; + static const char *badinfo = + "Warning: null async_struct for (%s) in %s\n"; + + if (!info) { + printk(badinfo, kdevname(device), routine); + return 1; + } + if (info->magic != SERIAL_MAGIC) { + printk(badmagic, kdevname(device), routine); + return 1; + } +#endif + return 0; +} + +/* + * ------------------------------------------------------------ + * psio_stop() and psio_start() + * + * This routines are called before setting or resetting tty->stopped. + * They enable or disable transmitter interrupts, as necessary. + * ------------------------------------------------------------ + */ +static void psio_stop(struct tty_struct *tty) +{ + struct async_struct *info = (struct async_struct *)tty->driver_data; + unsigned long flags; + + if (serial_paranoia_check(info, tty->device, "psio_stop")) + return; + + save_flags(flags); cli(); + if (info->IER & UART_IER_THRI) { + info->IER &= ~UART_IER_THRI; + serial_out(info, UART_IER, info->IER); + } + restore_flags(flags); + +} + +static void psio_start(struct tty_struct *tty) +{ + struct async_struct *info = (struct async_struct *)tty->driver_data; + unsigned long flags; + + if (serial_paranoia_check(info, tty->device, "psio_start")) + return; + + save_flags(flags); cli(); + if (info->xmit.head != info->xmit.tail + && info->xmit.buf + && !(info->IER & UART_IER_THRI)) { + info->IER |= UART_IER_THRI; + serial_out(info, UART_IER, info->IER); + serial_out(info, UART_TX, info->xmit.buf[info->xmit.tail]); + info->xmit.tail = (info->xmit.tail + 1) & (SERIAL_XMIT_SIZE-1); + info->state->icount.tx++; + } + restore_flags(flags); +} + + +/* + * This routine is used by the interrupt handler to schedule + * processing in the software interrupt portion of the driver. + */ +static inline void psio_sched_event(struct async_struct *info,int event) +{ + info->event |= 1 << event; + queue_task(&info->tqueue, &tq_psio_serial); + mark_bh(SERIAL_BH); +} + +static inline void psio_receive_chars(struct async_struct *info,int *status) +{ + struct tty_struct *tty = info->tty; + unsigned char ch; + struct async_icount *icount; + int max_count = 256; + + icount = &info->state->icount; + do { + if (tty->flip.count >= TTY_FLIPBUF_SIZE) { + tty->flip.tqueue.routine((void *) tty); + if (tty->flip.count >= TTY_FLIPBUF_SIZE) + return; // if TTY_DONT_FLIP is set + } + ch = serial_inp(info, UART_RX); + *tty->flip.char_buf_ptr = ch; + icount->rx++; + +#ifdef SERIAL_DEBUG_INTR + printk("DR%02x:%02x...", ch, *status); +#endif + *tty->flip.flag_buf_ptr = 0; + if (*status & (UART_LSR_BI | UART_LSR_PE | + UART_LSR_FE | UART_LSR_OE)) { + /* + * For statistics only + */ + if (*status & UART_LSR_BI) { + *status &= ~(UART_LSR_FE | UART_LSR_PE); + icount->brk++; + /* + * We do the SysRQ and SAK checking + * here because otherwise the break + * may get masked by ignore_status_mask + * or read_status_mask. + */ +#if defined(CONFIG_SERIAL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) + if (info->line == cons.index) { + if (!break_pressed) { + break_pressed = jiffies; + goto ignore_char; + } + break_pressed = 0; + } +#endif + if (info->flags & ASYNC_SAK) + do_SAK(tty); + } else if (*status & UART_LSR_PE) + icount->parity++; + else if (*status & UART_LSR_FE) + icount->frame++; + if (*status & UART_LSR_OE) + icount->overrun++; + + /* + * Mask off conditions which should be ignored. + */ + *status &= info->read_status_mask; + +#ifdef CONFIG_SERIAL_CONSOLE + if (info->line == cons.index) { + /* Recover the break flag from console xmit */ + *status |= lsr_break_flag; + lsr_break_flag = 0; + } +#endif + if (*status & (UART_LSR_BI)) { +#ifdef SERIAL_DEBUG_INTR + printk("handling break...."); +#endif + *tty->flip.flag_buf_ptr = TTY_BREAK; + } else if (*status & UART_LSR_PE) + *tty->flip.flag_buf_ptr = TTY_PARITY; + else if (*status & UART_LSR_FE) + *tty->flip.flag_buf_ptr = TTY_FRAME; + } +#if defined(CONFIG_SERIAL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) + if (break_pressed && info->line == cons.index) { + if (ch != 0 && + time_before(jiffies, break_pressed + HZ*5)) { + handle_sysrq(ch, regs, NULL, NULL); + break_pressed = 0; + goto ignore_char; + } + break_pressed = 0; + } +#endif + if ((*status & info->ignore_status_mask) == 0) { + tty->flip.flag_buf_ptr++; + tty->flip.char_buf_ptr++; + tty->flip.count++; + } +#if defined(CONFIG_SERIAL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) + ignore_char: +#endif + *status = serial_inp(info, UART_LSR); + } while ((*status & UART_LSR_DR) && (max_count-- > 0)); +#if (LINUX_VERSION_CODE > 131394) /* 2.1.66 */ + tty_flip_buffer_push(tty); +#else + queue_task_irq_off(&tty->flip.tqueue, &tq_timer); +#endif +} + +static void transmit_chars(struct async_struct *info, int *intr_done) +{ + int count; + + if (info->x_char) { + // for M32102 serial + // serial_outp(info, UART_TX, info->x_char); + info->state->icount.tx++; + info->x_char = 0; + if (intr_done) + *intr_done = 0; + while((serial_in(info,UART_LSR) & UART_LSR_TEMT) == 0); + return; + } + if (info->xmit.head == info->xmit.tail + || info->tty->stopped + || info->tty->hw_stopped) { + info->IER &= ~UART_IER_THRI; + serial_out(info, UART_IER, info->IER); + return; + } + count = info->xmit_fifo_size; + count = SERIAL_XMIT_SIZE-1; + do { + serial_out(info, UART_TX, info->xmit.buf[info->xmit.tail]); + info->xmit.tail = (info->xmit.tail + 1) & (SERIAL_XMIT_SIZE-1); + info->state->icount.tx++; + + if (info->xmit.head == info->xmit.tail) + break; + + while((serial_in(info,UART_LSR) & UART_LSR_THRE) == 0); + } while (--count > 0); + while((serial_in(info,UART_LSR) & UART_LSR_TEMT) == 0); + + if (CIRC_CNT(info->xmit.head, + info->xmit.tail, + SERIAL_XMIT_SIZE) < WAKEUP_CHARS) + psio_sched_event(info, RS_EVENT_WRITE_WAKEUP); + +#ifdef SERIAL_DEBUG_INTR + printk("THRE..."); +#endif + if (intr_done) + *intr_done = 0; + + if (info->xmit.head == info->xmit.tail) { + info->IER &= ~UART_IER_THRI; + serial_out(info, UART_IER, info->IER); + } +} + + +/* + +#ifdef CONFIG_SERIAL_SHARE_IRQ +static void rs_interrupt(int irq, void *dev_id, struct pt_regs * regs) +#endif +*/ + +static void sio_reset(struct async_struct *info) +{ + unsigned int dummy; + /* reset sio */ + /* read receive buffer */ + dummy = serial_inp(info, UART_RX); + dummy = serial_inp(info, UART_RX); + dummy = serial_inp(info, UART_LSR); + serial_outp(info, UART_LCR, 0x0300); /* RSCLR:1, TSCLR:1 */ + serial_outp(info, UART_LCR, 0x0003); /* RSEN:1, TXEN:1 */ +} + +static void sio_error(struct async_struct *info,int status) +{ + unsigned int dummy; + /* reset sio */ + printk("sio[%d] error[%04x]\n", info->line,status); + /* read receive buffer */ + dummy = serial_inp(info, UART_RX); + dummy = serial_inp(info, UART_RX); + dummy = serial_inp(info, UART_LSR); + serial_outp(info, UART_LCR, 0x0300); /* RSCLR:1, TSCLR:1 */ + serial_outp(info, UART_LCR, 0x0003); /* RSEN:1, TXEN:1 */ +} + +//static void psio_interrupt_single(int irq, void *dev_id, struct pt_regs * regs) +void psio_interrupt_single(int irq, void *dev_id, struct pt_regs * regs) +{ + int status; + // int pass_counter = 0; + struct async_struct * info; + +#ifdef CONFIG_SERIAL_MULTIPORT + int first_multi = 0; + struct rs_multiport_struct *multi; +#endif + +#ifdef SERIAL_DEBUG_INTR + printk("psio_interrupt_single(%d)...", irq); +#endif + + info = IRQ_ports[irq&(~1)]; + if (!info || !info->tty) + return; + +#ifdef CONFIG_SERIAL_MULTIPORT + multi = &rs_multiport[irq]; + if (multi->port_monitor) + first_multi = inb(multi->port_monitor); +#endif + + { + status = serial_inp(info, UART_LSR); +#ifdef SERIAL_DEBUG_INTR + printk("status = %x...", status); +#endif + if (status & UART_LSR_DR){ + psio_receive_chars(info, &status); + } + if ((serial_in(info,UART_LSR) & UART_EMPTY) != UART_EMPTY) + sio_error(info, status); + if (status & UART_LSR_THRE) + transmit_chars(info, 0); +#ifdef SERIAL_DEBUG_INTR + printk("IIR = %x...", serial_in(info, UART_IIR)); +#endif + } + + info->last_active = jiffies; +#ifdef CONFIG_SERIAL_MULTIPORT + if (multi->port_monitor) + printk("rs port monitor (single) irq %d: 0x%x, 0x%x\n", + info->state->irq, first_multi, + inb(multi->port_monitor)); +#endif +#ifdef SERIAL_DEBUG_INTR + printk("end.\n"); +#endif +} +#ifdef CONFIG_SERIAL_MULTIPORT +static void rs_interrupt_multi(int irq, void *dev_id, struct pt_regs * regs) +{} +#endif + +static void do_psio_serial_bh(void) +{ + run_task_queue(&tq_psio_serial); +} + +static void do_softint(void *private_) +{ + struct async_struct *info = (struct async_struct *) private_; + struct tty_struct *tty; + + tty = info->tty; + if (!tty) + return; + + if (test_and_clear_bit(RS_EVENT_WRITE_WAKEUP, &info->event)) { + if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && + tty->ldisc.write_wakeup) + (tty->ldisc.write_wakeup)(tty); + wake_up_interruptible(&tty->write_wait); +#ifdef SERIAL_HAVE_POLL_WAIT + wake_up_interruptible(&tty->poll_wait); +#endif + } +} + +static void psio_timer(void) +{ + static unsigned long last_strobe = 0; + struct async_struct *info; + unsigned int i; + unsigned long flags; + + if ((jiffies - last_strobe) >= RS_STROBE_TIME) { + for (i=0; i < NR_IRQS; i++) { + info = IRQ_ports[i]; + if (!info) + continue; + save_flags(flags); cli(); + psio_interrupt_single(i, NULL, NULL); + restore_flags(flags); + } + } + last_strobe = jiffies; + +#if 1 + mod_timer(&serial_timer, jiffies + 10); +#else + mod_timer(&serial_timer, jiffies + RS_STROBE_TIME); +#endif + + if (IRQ_ports[0]) { + save_flags(flags); cli(); +#ifdef CONFIG_SERIAL_SHARE_IRQ + psio_interrupt(0, NULL, NULL); +#else + psio_interrupt_single(0, NULL, NULL); +#endif + restore_flags(flags); + + mod_timer(&serial_timer, jiffies + IRQ_timeout[0]); + } +} + +/* + * --------------------------------------------------------------- + * Low level utility subroutines for the serial driver: routines to + * figure out the appropriate timeout for an interrupt chain, routines + * to initialize and startup a serial port, and routines to shutdown a + * serial port. Useful stuff like that. + * --------------------------------------------------------------- + */ + +/* + * This routine figures out the correct timeout for a particular IRQ. + * It uses the smallest timeout of all of the serial ports in a + * particular interrupt chain. Now only used for IRQ 0.... + */ +static void figure_IRQ_timeout(int irq) +{ + struct async_struct *info; + int timeout = 60*HZ; /* 60 seconds === a long time :-) */ + + info = IRQ_ports[irq]; + if (!info) { + IRQ_timeout[irq] = 60*HZ; + return; + } + while (info) { + if (info->timeout < timeout) + timeout = info->timeout; + info = info->next_port; + } + if (!irq) + timeout = timeout / 2; + IRQ_timeout[irq] = timeout ? timeout : 1; +} + +#ifdef CONFIG_SERIAL_RSA +/* Attempts to turn on the RSA FIFO. Returns zero on failure */ +static int enable_rsa(struct async_struct *info) {} + +/* Attempts to turn off the RSA FIFO. Returns zero on failure */ +static int disable_rsa(struct async_struct *info) { } +#endif /* CONFIG_SERIAL_RSA */ + +static int startup(struct async_struct * info) +{ + unsigned long flags; + int retval=0; + void (*handler)(int, void *, struct pt_regs *); + struct serial_state *state= info->state; + unsigned long page; +#ifdef CONFIG_SERIAL_MANY_PORTS + unsigned short ICP; +#endif + + page = get_zeroed_page(GFP_KERNEL); + if (!page) + return -ENOMEM; + + save_flags(flags); cli(); + + if (info->flags & ASYNC_INITIALIZED) { + free_page(page); + goto errout; + } + if (info->xmit.buf) + free_page(page); + else + info->xmit.buf = (unsigned char *) page; + +#ifdef SERIAL_DEBUG_OPEN + printk("starting up ttyD%d (irq %d)...", info->line, state->irq); +#endif + + /* + * Clear the FIFO buffers and disable them + * (they will be reenabled in change_speed()) + */ + + /* + * Clear the interrupt registers. + */ + sio_reset(info); + + /* + * Allocate the IRQ if necessary + */ + if (state->irq && (!IRQ_ports[state->irq] || + !IRQ_ports[state->irq]->next_port)) { + if (IRQ_ports[state->irq]) { +#ifdef CONFIG_SERIAL_SHARE_IRQ + free_irq(state->irq, &IRQ_ports[state->irq]); + free_irq(state->irq+1, &IRQ_ports[state->irq]); +#ifdef CONFIG_SERIAL_MULTIPORT + if (rs_multiport[state->irq].port1) + handler = rs_interrupt_multi; + else +#endif + handler = psio_interrupt; +#else + retval = -EBUSY; + goto errout; +#endif /* CONFIG_SERIAL_SHARE_IRQ */ + } else + handler = psio_interrupt_single; + + /* 020116 */ + retval = request_irq(state->irq, handler, SA_SHIRQ, + "serial_rx", &IRQ_ports[state->irq]); + retval = request_irq(state->irq+1, handler, SA_SHIRQ, + "serial_tx", &IRQ_ports[state->irq]); + if (retval) { + if (capable(CAP_SYS_ADMIN)) { + if (info->tty) + set_bit(TTY_IO_ERROR, + &info->tty->flags); + retval = 0; + } + goto errout; + } + } + + /* + * Insert serial port into IRQ chain. + */ + info->prev_port = 0; + info->next_port = IRQ_ports[state->irq]; + if (info->next_port) + info->next_port->prev_port = info; + IRQ_ports[state->irq] = info; + figure_IRQ_timeout(state->irq); + + /* + * Now, initialize the UART + */ + /* for m32r @020113 */ + sio_reset(info); + + info->MCR = 0; + if (info->tty->termios->c_cflag & CBAUD) + info->MCR = UART_MCR_DTR | UART_MCR_RTS; +#ifdef CONFIG_SERIAL_MANY_PORTS + if (info->flags & ASYNC_FOURPORT) { + if (state->irq == 0) + info->MCR |= UART_MCR_OUT1; + } else +#endif + { + if (state->irq != 0) + info->MCR |= UART_MCR_OUT2; + } + info->MCR |= ALPHA_KLUDGE_MCR; /* Don't ask */ + serial_outp(info, UART_MCR, info->MCR); + + /* + * Finally, enable interrupts + */ + info->IER = UART_IER_MSI | UART_IER_RLSI | UART_IER_RDI; + serial_outp(info, UART_IER, info->IER); /* enable interrupts */ + +#ifdef CONFIG_SERIAL_MANY_PORTS + if (info->flags & ASYNC_FOURPORT) { + /* Enable interrupts on the AST Fourport board */ + ICP = (info->port & 0xFE0) | 0x01F; + outb_p(0x80, ICP); + (void) inb_p(ICP); + } +#endif + + /* + * And clear the interrupt registers again for luck. + */ + (void)serial_inp(info, UART_LSR); + (void)serial_inp(info, UART_RX); + (void)serial_inp(info, UART_IIR); + (void)serial_inp(info, UART_MSR); + + if (info->tty) + clear_bit(TTY_IO_ERROR, &info->tty->flags); + info->xmit.head = info->xmit.tail = 0; + + /* + * Set up serial timers... + */ + mod_timer(&serial_timer, jiffies + 2*HZ/100); + + /* + * Set up the tty->alt_speed kludge + */ +#if (LINUX_VERSION_CODE >= 131394) /* Linux 2.1.66 */ + if (info->tty) { + if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) + info->tty->alt_speed = 57600; + if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) + info->tty->alt_speed = 115200; + if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI) + info->tty->alt_speed = 230400; + if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP) + info->tty->alt_speed = 460800; + } +#endif + + /* + * and set the speed of the serial port + */ + change_speed(info, 0); + + info->flags |= ASYNC_INITIALIZED; + restore_flags(flags); + return 0; + +errout: + restore_flags(flags); + return retval; +} + +/* + * This routine will shutdown a serial port; interrupts are disabled, and + * DTR is dropped if the hangup on close termio flag is on. + */ +static void shutdown(struct async_struct * info) +{ + unsigned long flags; + struct serial_state *state; + int retval; + + if (!(info->flags & ASYNC_INITIALIZED)) + return; + + state = info->state; + +#ifdef SERIAL_DEBUG_OPEN + printk("Shutting down serial port %d (irq %d)....", info->line, + state->irq); +#endif + + save_flags(flags); cli(); /* Disable interrupts */ + + /* + * clear delta_msr_wait queue to avoid mem leaks: we may free the irq + * here so the queue might never be waken up + */ + wake_up_interruptible(&info->delta_msr_wait); + + /* + * First unlink the serial port from the IRQ chain... + */ + if (info->next_port) + info->next_port->prev_port = info->prev_port; + if (info->prev_port) + info->prev_port->next_port = info->next_port; + else + IRQ_ports[state->irq] = info->next_port; + figure_IRQ_timeout(state->irq); + + /* + * Free the IRQ, if necessary + */ + if (state->irq && (!IRQ_ports[state->irq] || + !IRQ_ports[state->irq]->next_port)) { + if (IRQ_ports[state->irq]) { + /* 020116 */ + free_irq(state->irq+1, &IRQ_ports[state->irq]); + retval = request_irq(state->irq+1, psio_interrupt_single, + SA_SHIRQ, "serial_xx", + &IRQ_ports[state->irq]); + free_irq(state->irq, &IRQ_ports[state->irq]); + retval = request_irq(state->irq, psio_interrupt_single, + SA_SHIRQ, "serial", + &IRQ_ports[state->irq]); + + if (retval) + printk("serial shutdown: request_irq: error %d" + " Couldn't reacquire IRQ.\n", retval); + } else{ + free_irq(state->irq, &IRQ_ports[state->irq]); + /* 020116 */ + free_irq(state->irq+1, &IRQ_ports[state->irq]); + } + } + if (info->xmit.buf) { + unsigned long pg = (unsigned long) info->xmit.buf; + info->xmit.buf = 0; + free_page(pg); + } + + info->IER = 0; + serial_outp(info, UART_IER, 0x00); /* disable all intrs */ +#ifdef CONFIG_SERIAL_MANY_PORTS + if (info->flags & ASYNC_FOURPORT) { + /* reset interrupts on the AST Fourport board */ + (void) inb((info->port & 0xFE0) | 0x01F); + info->MCR |= UART_MCR_OUT1; + } else +#endif + if (!info->tty || (info->tty->termios->c_cflag & HUPCL)) + info->MCR &= ~(UART_MCR_DTR|UART_MCR_RTS); + serial_outp(info, UART_MCR, info->MCR); + +#ifdef CONFIG_SERIAL_RSA + /* + * Reset the RSA board back to 115kbps compat mode. + */ + if ((state->type == PORT_RSA) && + (state->baud_base == SERIAL_RSA_BAUD_BASE && + disable_rsa(info))) + state->baud_base = SERIAL_RSA_BAUD_BASE_LO; +#endif + + + (void)serial_in(info, UART_RX); /* read data port to reset things */ + + if (info->tty) + set_bit(TTY_IO_ERROR, &info->tty->flags); + + sio_reset(info); + + info->flags &= ~ASYNC_INITIALIZED; + restore_flags(flags); +} + +static void change_speed(struct async_struct *info,struct termios *old_termios) +{ + int quot = 0, baud_base, baud; + unsigned cflag, cval = 0; + int bits; + unsigned long flags; + unsigned mod0, mod1; + + if (!info->tty || !info->tty->termios) + return; + cflag = info->tty->termios->c_cflag; + if (!CONFIGURED_SERIAL_PORT(info)) + return; + + /* byte size and parity */ + switch (cflag & CSIZE) { + case CS5: mod1 = 0x05; bits = 7; break; + case CS6: mod1 = 0x06; bits = 8; break; + case CS7: mod1 = 0x07; bits = 9; break; + case CS8: mod1 = 0x08; bits = 10; break; + /* Never happens, but GCC is too dumb to figure it out */ + default: mod1 = 0x05; bits = 7; break; + } + mod1 <<= 8; + mod0 = 0; + if (cflag & CSTOPB) { + mod0 |= 0x03; + bits++; + } + if (cflag & PARENB) { + mod0 |= 0x10; + bits++; + } + if (!(cflag & PARODD)) { + mod0 |= 0x4; + } + mod0 = 0x80; /* Use RTS# output only */ + + serial_outp(info, UART_MOD0, mod0); /* */ + //serial_outp(info, UART_MOD1, mod1); + //mod1 = 0; + info->LCR = mod1; /* Save LCR */ + + /* Determine divisor based on baud rate */ + baud = tty_get_baud_rate(info->tty); + if (!baud) + baud = 9600; /* B0 transition handled in rs_set_termios */ +#ifdef CONFIG_SERIAL_RSA + if ((info->state->type == PORT_RSA) && + (info->state->baud_base != SERIAL_RSA_BAUD_BASE) && + enable_rsa(info)) + info->state->baud_base = SERIAL_RSA_BAUD_BASE; +#endif + baud_base = info->state->baud_base; + + if (baud == 38400 && + ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST)) + quot = info->state->custom_divisor; + else { + if (baud == 134) + /* Special case since 134 is really 134.5 */ + quot = (2*baud_base / 269); + else if (baud) + quot = baud_base / baud; + } + /* If the quotient is zero refuse the change */ + if (!quot && old_termios) { + info->tty->termios->c_cflag &= ~CBAUD; + info->tty->termios->c_cflag |= (old_termios->c_cflag & CBAUD); + baud = tty_get_baud_rate(info->tty); + if (!baud) + baud = 9600; + if (baud == 38400 && + ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST)) + quot = info->state->custom_divisor; + else { + if (baud == 134) + /* Special case since 134 is really 134.5 */ + quot = (2*baud_base / 269); + else if (baud) + quot = baud_base / baud ; + } + } + quot = baud_base / (baud*4) ; + /* As a last resort, if the quotient is zero, default to 9600 bps */ + if (!quot) + quot = baud_base / 9600; + /* + * Work around a bug in the Oxford Semiconductor 952 rev B + * chip which causes it to seriously miscalculate baud rates + * when DLL is 0. + */ + if (((quot & 0xFF) == 0) && (info->state->type == PORT_16C950) && + (info->state->revision == 0x5201)) + quot++; + + info->quot = quot; + info->timeout = ((info->xmit_fifo_size*HZ*bits*quot) / baud_base); + info->timeout += HZ/50; /* Add .02 seconds of slop */ + + /* CTS flow control flag and modem status interrupts */ + info->IER &= ~UART_IER_MSI; + if (info->flags & ASYNC_HARDPPS_CD) + info->IER |= UART_IER_MSI; + if (cflag & CRTSCTS) { + info->flags |= ASYNC_CTS_FLOW; + info->IER |= UART_IER_MSI; + } else + info->flags &= ~ASYNC_CTS_FLOW; + if (cflag & CLOCAL) + info->flags &= ~ASYNC_CHECK_CD; + else { + info->flags |= ASYNC_CHECK_CD; + info->IER |= UART_IER_MSI; + } + serial_out(info, UART_IER, info->IER); + + /* + * Set up parity check flag + */ +#define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK)) + + info->read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR; + if (I_INPCK(info->tty)) + info->read_status_mask |= UART_LSR_FE | UART_LSR_PE; + if (I_BRKINT(info->tty) || I_PARMRK(info->tty)) + info->read_status_mask |= UART_LSR_BI; + + /* + * Characters to ignore + */ + info->ignore_status_mask = 0; + if (I_IGNPAR(info->tty)) + info->ignore_status_mask |= UART_LSR_PE | UART_LSR_FE; + if (I_IGNBRK(info->tty)) { + info->ignore_status_mask |= UART_LSR_BI; + /* + * If we're ignore parity and break indicators, ignore + * overruns too. (For real raw support). + */ + if (I_IGNPAR(info->tty)) + info->ignore_status_mask |= UART_LSR_OE; + } + /* + * !!! ignore all characters if CREAD is not set + */ + if ((cflag & CREAD) == 0) + info->ignore_status_mask |= UART_LSR_DR; + cval = (baud_base / (baud * 4)) - 1; + + save_flags(flags); cli(); + serial_outp(info, UART_BAUR, cval ); /* set baurate reg */ + serial_outp(info, UART_LCR, 0x03); + restore_flags(flags); +} + +static void psio_put_char(struct tty_struct *tty, unsigned char ch) +{ + struct async_struct *info = (struct async_struct *)tty->driver_data; + unsigned long flags; + + if (serial_paranoia_check(info, tty->device, "psio_put_char")) + return; + + if (!tty || !info->xmit.buf) + return; + + save_flags(flags); cli(); + if (CIRC_SPACE(info->xmit.head, + info->xmit.tail, + SERIAL_XMIT_SIZE) == 0) { + restore_flags(flags); + return; + } + + info->xmit.buf[info->xmit.head] = ch; + info->xmit.head = (info->xmit.head + 1) & (SERIAL_XMIT_SIZE-1); + restore_flags(flags); +} + +static void psio_flush_chars(struct tty_struct *tty) +{ + struct async_struct *info = (struct async_struct *)tty->driver_data; + unsigned long flags; + + if (serial_paranoia_check(info, tty->device, "psio_flush_chars")) + return; + + if (info->xmit.head == info->xmit.tail + || tty->stopped + || tty->hw_stopped + || !info->xmit.buf) + return; + + save_flags(flags); cli(); + if (!(info->IER & UART_IER_THRI)) { + info->IER |= UART_IER_THRI; + serial_out(info, UART_IER, info->IER); + serial_out(info, UART_TX, info->xmit.buf[info->xmit.tail]); + info->xmit.tail = (info->xmit.tail + 1) & (SERIAL_XMIT_SIZE-1); + info->state->icount.tx++; + } + restore_flags(flags); + while((serial_in(info,UART_LSR) & UART_EMPTY) != UART_EMPTY); +} + +static int psio_write(struct tty_struct *tty, int from_user, + const unsigned char *buf, int count) +{ + int c, ret = 0; + struct async_struct *info = (struct async_struct *)tty->driver_data; + unsigned long flags; + + if (serial_paranoia_check(info, tty->device, "psio_write")) + return 0; + + if (!tty || !info->xmit.buf || !tmp_buf) + return 0; + + save_flags(flags); + if (from_user) { + down(&tmp_buf_sem); + while (1) { + int c1; + c = CIRC_SPACE_TO_END(info->xmit.head, + info->xmit.tail, + SERIAL_XMIT_SIZE); + if (count < c) + c = count; + if (c <= 0) + break; + + c -= copy_from_user(tmp_buf, buf, c); + if (!c) { + if (!ret) + ret = -EFAULT; + break; + } + cli(); + c1 = CIRC_SPACE_TO_END(info->xmit.head, + info->xmit.tail, + SERIAL_XMIT_SIZE); + if (c1 < c) + c = c1; + memcpy(info->xmit.buf + info->xmit.head, tmp_buf, c); + info->xmit.head = ((info->xmit.head + c) & + (SERIAL_XMIT_SIZE-1)); + restore_flags(flags); + buf += c; + count -= c; + ret += c; + } + up(&tmp_buf_sem); + } else { + cli(); + while (1) { + c = CIRC_SPACE_TO_END(info->xmit.head, + info->xmit.tail, + SERIAL_XMIT_SIZE); + if (count < c) + c = count; + if (c <= 0) { + break; + } + memcpy(info->xmit.buf + info->xmit.head, buf, c); + info->xmit.head = ((info->xmit.head + c) & + (SERIAL_XMIT_SIZE-1)); + buf += c; + count -= c; + ret += c; + } + restore_flags(flags); + } + save_flags(flags); cli(); + if (info->xmit.head != info->xmit.tail + && !tty->stopped + && !tty->hw_stopped + && !(info->IER & UART_IER_THRI)) { + info->IER |= UART_IER_THRI; + serial_out(info, UART_IER, info->IER); + serial_out(info, UART_TX, info->xmit.buf[info->xmit.tail]); + info->xmit.tail = (info->xmit.tail + 1) & (SERIAL_XMIT_SIZE-1); + info->state->icount.tx++; + } + restore_flags(flags); + while((serial_in(info,UART_LSR) & UART_EMPTY) != UART_EMPTY); + return ret; +} + +static int psio_write_room(struct tty_struct *tty) +{ + struct async_struct *info = (struct async_struct *)tty->driver_data; + + if (serial_paranoia_check(info, tty->device, "psio_write_room")) + return 0; + return CIRC_SPACE(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE); +} + +static int psio_chars_in_buffer(struct tty_struct *tty) +{ + struct async_struct *info = (struct async_struct *)tty->driver_data; + + if (serial_paranoia_check(info, tty->device, "psio_chars_in_buffer")) + return 0; + return CIRC_CNT(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE); +} + +static void psio_flush_buffer(struct tty_struct *tty) +{ + struct async_struct *info = (struct async_struct *)tty->driver_data; + unsigned long flags; + + if (serial_paranoia_check(info, tty->device, "psio_flush_buffer")) + return; + save_flags(flags); cli(); + info->xmit.head = info->xmit.tail = 0; + restore_flags(flags); + wake_up_interruptible(&tty->write_wait); +#ifdef SERIAL_HAVE_POLL_WAIT + wake_up_interruptible(&tty->poll_wait); +#endif + if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && + tty->ldisc.write_wakeup) + (tty->ldisc.write_wakeup)(tty); +} + +/* + * This function is used to send a high-priority XON/XOFF character to + * the device + */ +static void psio_send_xchar(struct tty_struct *tty, char ch) +{ + struct async_struct *info = (struct async_struct *)tty->driver_data; + + if (serial_paranoia_check(info, tty->device, "psio_send_char")) + return; + + info->x_char = ch; + if (ch) { + unsigned long flags; + save_flags(flags); cli(); + if (!(info->IER & UART_IER_THRI)) { + info->IER |= UART_IER_THRI; + serial_out(info, UART_IER, info->IER); + serial_out(info, UART_TX, info->x_char); + } + restore_flags(flags); + } +} + +/* + * ------------------------------------------------------------ + * rs_throttle() + * + * This routine is called by the upper-layer tty layer to signal that + * incoming characters should be throttled. + * ------------------------------------------------------------ + */ +static void psio_throttle(struct tty_struct * tty) +{ + struct async_struct *info = (struct async_struct *)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)); +#endif + + if (serial_paranoia_check(info, tty->device, "psio_throttle")) + return; + + if (I_IXOFF(tty)) + psio_send_xchar(tty, STOP_CHAR(tty)); + + if (tty->termios->c_cflag & CRTSCTS) + info->MCR &= ~UART_MCR_RTS; + + save_flags(flags); cli(); + serial_out(info, UART_MCR, info->MCR); + restore_flags(flags); +} + +static void psio_unthrottle(struct tty_struct * tty) +{ + struct async_struct *info = (struct async_struct *)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)); +#endif + + if (serial_paranoia_check(info, tty->device, "psio_unthrottle")) + return; + + if (I_IXOFF(tty)) { + if (info->x_char) info->x_char = 0; + } + if (tty->termios->c_cflag & CRTSCTS) + info->MCR |= UART_MCR_RTS; + save_flags(flags); cli(); + serial_out(info, UART_MCR, info->MCR); + restore_flags(flags); +} + +/* + * ------------------------------------------------------------ + * rs_ioctl() and friends + * ------------------------------------------------------------ + */ + +static int get_serial_info(struct async_struct * info, + struct serial_struct * retinfo) +{ + struct serial_struct tmp; + struct serial_state *state = info->state; + + if (!retinfo) + return -EFAULT; + memset(&tmp, 0, sizeof(tmp)); + tmp.type = state->type; + tmp.line = state->line; + tmp.port = state->port; + if (HIGH_BITS_OFFSET) + tmp.port_high = state->port >> HIGH_BITS_OFFSET; + else + tmp.port_high = 0; + tmp.irq = state->irq; + tmp.flags = state->flags; + tmp.xmit_fifo_size = state->xmit_fifo_size; + tmp.baud_base = state->baud_base; + tmp.close_delay = state->close_delay; + tmp.closing_wait = state->closing_wait; + tmp.custom_divisor = state->custom_divisor; + tmp.hub6 = state->hub6; + tmp.io_type = state->io_type; + if (copy_to_user(retinfo,&tmp,sizeof(*retinfo))) + return -EFAULT; + return 0; +} + +static int set_serial_info(struct async_struct * info, + struct serial_struct * new_info) +{ + struct serial_struct new_serial; + struct serial_state old_state, *state; + unsigned int i,change_irq,change_port; + int retval = 0; + unsigned long new_port; + + if (copy_from_user(&new_serial,new_info,sizeof(new_serial))) + return -EFAULT; + state = info->state; + old_state = *state; + + new_port = new_serial.port; + if (HIGH_BITS_OFFSET) + new_port += (unsigned long) new_serial.port_high << HIGH_BITS_OFFSET; + + change_irq = new_serial.irq != state->irq; + change_port = (new_port != ((int) state->port)) || + (new_serial.hub6 != state->hub6); + + if (!capable(CAP_SYS_ADMIN)) { + if (change_irq || change_port || + (new_serial.baud_base != state->baud_base) || + (new_serial.type != state->type) || + (new_serial.close_delay != state->close_delay) || + (new_serial.xmit_fifo_size != state->xmit_fifo_size) || + ((new_serial.flags & ~ASYNC_USR_MASK) != + (state->flags & ~ASYNC_USR_MASK))) + return -EPERM; + state->flags = ((state->flags & ~ASYNC_USR_MASK) | + (new_serial.flags & ASYNC_USR_MASK)); + info->flags = ((info->flags & ~ASYNC_USR_MASK) | + (new_serial.flags & ASYNC_USR_MASK)); + state->custom_divisor = new_serial.custom_divisor; + goto check_and_exit; + } + + new_serial.irq = irq_cannonicalize(new_serial.irq); + + if ((new_serial.irq >= NR_IRQS) || (new_serial.irq < 0) || + (new_serial.baud_base < 9600)|| (new_serial.type < PORT_UNKNOWN) || + (new_serial.type > PORT_MAX) || (new_serial.type == PORT_CIRRUS) || + (new_serial.type == PORT_STARTECH)) { + return -EINVAL; + } + + if ((new_serial.type != state->type) || + (new_serial.xmit_fifo_size <= 0)) + new_serial.xmit_fifo_size = + uart_config[new_serial.type].dfl_xmit_fifo_size; + + /* Make sure address is not already in use */ + if (new_serial.type) { + for (i = 0 ; i < NR_PORTS; i++) + if ((state != &rs_table[i]) && + (rs_table[i].port == new_port) && + rs_table[i].type) + return -EADDRINUSE; + } + + if ((change_port || change_irq) && (state->count > 1)) + return -EBUSY; + + /* + * OK, past this point, all the error checking has been done. + * At this point, we start making changes..... + */ + + state->baud_base = new_serial.baud_base; + state->flags = ((state->flags & ~ASYNC_FLAGS) | + (new_serial.flags & ASYNC_FLAGS)); + info->flags = ((state->flags & ~ASYNC_INTERNAL_FLAGS) | + (info->flags & ASYNC_INTERNAL_FLAGS)); + state->custom_divisor = new_serial.custom_divisor; + state->close_delay = new_serial.close_delay * HZ/100; + state->closing_wait = new_serial.closing_wait * HZ/100; +#if (LINUX_VERSION_CODE > 0x20100) + info->tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0; +#endif + info->xmit_fifo_size = state->xmit_fifo_size = + new_serial.xmit_fifo_size; + + if ((state->type != PORT_UNKNOWN) && state->port) { +#ifdef CONFIG_SERIAL_RSA + if (old_state.type == PORT_RSA) + release_region(state->port + UART_RSA_BASE, 16); + else +#endif + release_region(state->port,8); + } + state->type = new_serial.type; + if (change_port || change_irq) { + /* + * We need to shutdown the serial port at the old + * port/irq combination. + */ + shutdown(info); + state->irq = new_serial.irq; + info->port = state->port = new_port; + info->hub6 = state->hub6 = new_serial.hub6; + if (info->hub6) + info->io_type = state->io_type = SERIAL_IO_HUB6; + else if (info->io_type == SERIAL_IO_HUB6) + info->io_type = state->io_type = SERIAL_IO_PORT; + } + if ((state->type != PORT_UNKNOWN) && state->port) { +#ifdef CONFIG_SERIAL_RSA + if (state->type == PORT_RSA) + request_region(state->port + UART_RSA_BASE, + 16, "serial_rsa(set)"); + else +#endif + request_region(state->port,8,"serial(set)"); + } + + +check_and_exit: + if (!state->port || !state->type) + return 0; + if (info->flags & ASYNC_INITIALIZED) { + if (((old_state.flags & ASYNC_SPD_MASK) != + (state->flags & ASYNC_SPD_MASK)) || + (old_state.custom_divisor != state->custom_divisor)) { +#if (LINUX_VERSION_CODE >= 131394) /* Linux 2.1.66 */ + if ((state->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) + info->tty->alt_speed = 57600; + if ((state->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) + info->tty->alt_speed = 115200; + if ((state->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI) + info->tty->alt_speed = 230400; + if ((state->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP) + info->tty->alt_speed = 460800; +#endif + change_speed(info, 0); + } + } else + retval = startup(info); + return retval; +} + +/* + * get_lsr_info - get line status register info + * + * Purpose: Let user call ioctl() to get info when the UART physically + * is emptied. On bus types like RS485, the transmitter must + * release the bus after transmitting. This must be done when + * the transmit shift register is empty, not be done when the + * transmit holding register is empty. This functionality + * allows an RS485 driver to be written in user space. + */ +static int get_lsr_info(struct async_struct * info, unsigned int *value) +{ + unsigned char status; + unsigned int result; + unsigned long flags; + + save_flags(flags); cli(); + status = serial_in(info, UART_LSR); + restore_flags(flags); + result = ((status & UART_LSR_TEMT) ? TIOCSER_TEMT : 0); + + /* + * If we're about to load something into the transmit + * register, we'll pretend the transmitter isn't empty to + * avoid a race condition (depending on when the transmit + * interrupt happens). + */ + if (info->x_char || + ((CIRC_CNT(info->xmit.head, info->xmit.tail, + SERIAL_XMIT_SIZE) > 0) && + !info->tty->stopped && !info->tty->hw_stopped)) + result &= ~TIOCSER_TEMT; + + if (copy_to_user(value, &result, sizeof(int))) + return -EFAULT; + return 0; +} + + +static int get_modem_info(struct async_struct * info, unsigned int *value) +{ + unsigned char control, status; + unsigned int result; + unsigned long flags; + + control = info->MCR; + save_flags(flags); cli(); + status = serial_in(info, UART_MSR); + restore_flags(flags); + result = ((control & UART_MCR_RTS) ? TIOCM_RTS : 0) + | ((control & UART_MCR_DTR) ? TIOCM_DTR : 0) +#ifdef TIOCM_OUT1 + | ((control & UART_MCR_OUT1) ? TIOCM_OUT1 : 0) + | ((control & UART_MCR_OUT2) ? TIOCM_OUT2 : 0) +#endif + | ((status & UART_MSR_DCD) ? TIOCM_CAR : 0) + | ((status & UART_MSR_RI) ? TIOCM_RNG : 0) + | ((status & UART_MSR_DSR) ? TIOCM_DSR : 0) + | ((status & UART_MSR_CTS) ? TIOCM_CTS : 0); + + if (copy_to_user(value, &result, sizeof(int))) + return -EFAULT; + return 0; +} +static int set_modem_info(struct async_struct * info, unsigned int cmd, + unsigned int *value) +{ + unsigned int arg; + unsigned long flags; + + if (copy_from_user(&arg, value, sizeof(int))) + return -EFAULT; + + switch (cmd) { + case TIOCMBIS: + if (arg & TIOCM_RTS) + info->MCR |= UART_MCR_RTS; + if (arg & TIOCM_DTR) + info->MCR |= UART_MCR_DTR; +#ifdef TIOCM_OUT1 + if (arg & TIOCM_OUT1) + info->MCR |= UART_MCR_OUT1; + if (arg & TIOCM_OUT2) + info->MCR |= UART_MCR_OUT2; +#endif + if (arg & TIOCM_LOOP) + info->MCR |= UART_MCR_LOOP; + break; + case TIOCMBIC: + if (arg & TIOCM_RTS) + info->MCR &= ~UART_MCR_RTS; + if (arg & TIOCM_DTR) + info->MCR &= ~UART_MCR_DTR; +#ifdef TIOCM_OUT1 + if (arg & TIOCM_OUT1) + info->MCR &= ~UART_MCR_OUT1; + if (arg & TIOCM_OUT2) + info->MCR &= ~UART_MCR_OUT2; +#endif + if (arg & TIOCM_LOOP) + info->MCR &= ~UART_MCR_LOOP; + break; + case TIOCMSET: + info->MCR = ((info->MCR & ~(UART_MCR_RTS | +#ifdef TIOCM_OUT1 + UART_MCR_OUT1 | + UART_MCR_OUT2 | +#endif + UART_MCR_LOOP | + UART_MCR_DTR)) + | ((arg & TIOCM_RTS) ? UART_MCR_RTS : 0) +#ifdef TIOCM_OUT1 + | ((arg & TIOCM_OUT1) ? UART_MCR_OUT1 : 0) + | ((arg & TIOCM_OUT2) ? UART_MCR_OUT2 : 0) +#endif + | ((arg & TIOCM_LOOP) ? UART_MCR_LOOP : 0) + | ((arg & TIOCM_DTR) ? UART_MCR_DTR : 0)); + break; + default: + return -EINVAL; + } + save_flags(flags); cli(); + info->MCR |= ALPHA_KLUDGE_MCR; /* Don't ask */ + serial_out(info, UART_MCR, info->MCR); + restore_flags(flags); + return 0; +} + +static int do_autoconfig(struct async_struct * info) +{ + int irq, retval; + + if (!capable(CAP_SYS_ADMIN)) + return -EPERM; + + if (info->state->count > 1) + return -EBUSY; + + shutdown(info); + + autoconfig(info->state); + if ((info->state->flags & ASYNC_AUTO_IRQ) && + (info->state->port != 0 || info->state->iomem_base != 0) && + (info->state->type != PORT_UNKNOWN)) { + irq = detect_uart_irq(info->state); + if (irq > 0) + info->state->irq = irq; + } + + retval = startup(info); + if (retval) + return retval; + return 0; +} + +/* + * rs_break() --- routine which turns the break handling on or off + */ +#if (LINUX_VERSION_CODE < 131394) /* Linux 2.1.66 */ +static void send_break( struct async_struct * info, int duration) +{ + if (!CONFIGURED_SERIAL_PORT(info)) + return; + current->state = TASK_INTERRUPTIBLE; + current->timeout = jiffies + duration; + cli(); + info->LCR |= UART_LCR_SBC; + serial_out(info, UART_LCR, 0x3); + schedule(); + info->LCR &= ~UART_LCR_SBC; + serial_out(info, UART_LCR, 0x3); + sti(); +} +#else +static void psio_break(struct tty_struct *tty, int break_state) +{ + struct async_struct * info = (struct async_struct *)tty->driver_data; + unsigned long flags; + + if (serial_paranoia_check(info, tty->device, "rs_break")) + return; + + if (!CONFIGURED_SERIAL_PORT(info)) + return; + save_flags(flags); cli(); + if (break_state == -1) + info->LCR |= UART_LCR_SBC; + else + info->LCR &= ~UART_LCR_SBC; + restore_flags(flags); +} +#endif + +#ifdef CONFIG_SERIAL_MULTIPORT +static int get_multiport_struct(struct async_struct * info, + struct serial_multiport_struct *retinfo) +{ + struct serial_multiport_struct ret; + struct rs_multiport_struct *multi; + + multi = &rs_multiport[info->state->irq]; + + ret.port_monitor = multi->port_monitor; + + ret.port1 = multi->port1; + ret.mask1 = multi->mask1; + ret.match1 = multi->match1; + + ret.port2 = multi->port2; + ret.mask2 = multi->mask2; + ret.match2 = multi->match2; + + ret.port3 = multi->port3; + ret.mask3 = multi->mask3; + ret.match3 = multi->match3; + + ret.port4 = multi->port4; + ret.mask4 = multi->mask4; + ret.match4 = multi->match4; + + ret.irq = info->state->irq; + + if (copy_to_user(retinfo,&ret,sizeof(*retinfo))) + return -EFAULT; + return 0; +} + +static int set_multiport_struct(struct async_struct * info, + struct serial_multiport_struct *in_multi) +{ + struct serial_multiport_struct new_multi; + struct rs_multiport_struct *multi; + struct serial_state *state; + int was_multi, now_multi; + int retval; + void (*handler)(int, void *, struct pt_regs *); + + if (!capable(CAP_SYS_ADMIN)) + return -EPERM; + state = info->state; + + if (copy_from_user(&new_multi, in_multi, + sizeof(struct serial_multiport_struct))) + return -EFAULT; + + if (new_multi.irq != state->irq || state->irq == 0 || + !IRQ_ports[state->irq]) + return -EINVAL; + + multi = &rs_multiport[state->irq]; + was_multi = (multi->port1 != 0); + + multi->port_monitor = new_multi.port_monitor; + + if (multi->port1) + release_region(multi->port1,1); + multi->port1 = new_multi.port1; + multi->mask1 = new_multi.mask1; + multi->match1 = new_multi.match1; + if (multi->port1) + request_region(multi->port1,1,"serial(multiport1)"); + + if (multi->port2) + release_region(multi->port2,1); + multi->port2 = new_multi.port2; + multi->mask2 = new_multi.mask2; + multi->match2 = new_multi.match2; + if (multi->port2) + request_region(multi->port2,1,"serial(multiport2)"); + + if (multi->port3) + release_region(multi->port3,1); + multi->port3 = new_multi.port3; + multi->mask3 = new_multi.mask3; + multi->match3 = new_multi.match3; + if (multi->port3) + request_region(multi->port3,1,"serial(multiport3)"); + + if (multi->port4) + release_region(multi->port4,1); + multi->port4 = new_multi.port4; + multi->mask4 = new_multi.mask4; + multi->match4 = new_multi.match4; + if (multi->port4) + request_region(multi->port4,1,"serial(multiport4)"); + + now_multi = (multi->port1 != 0); + + if (IRQ_ports[state->irq]->next_port && + (was_multi != now_multi)) { + free_irq(state->irq, &IRQ_ports[state->irq]); + if (now_multi) + handler = rs_interrupt_multi; + else + handler = rs_interrupt; + + retval = request_irq(state->irq, handler, SA_SHIRQ, + "serial", &IRQ_ports[state->irq]); + if (retval) { + printk("Couldn't reallocate serial interrupt " + "driver!!\n"); + } + } + return 0; +} +#endif + +static int psio_ioctl(struct tty_struct *tty, struct file * file, + unsigned int cmd, unsigned long arg) +{ + struct async_struct * info = (struct async_struct *)tty->driver_data; + struct async_icount cprev, cnow; /* kernel counter temps */ + struct serial_icounter_struct icount; + unsigned long flags; +#if (LINUX_VERSION_CODE < 131394) /* Linux 2.1.66 */ + int retval, tmp; +#endif + + if (serial_paranoia_check(info, tty->device, "rs_ioctl")) + return -ENODEV; + + if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) && + (cmd != TIOCSERCONFIG) && (cmd != TIOCSERGSTRUCT) && + (cmd != TIOCMIWAIT) && (cmd != TIOCGICOUNT)) { + if (tty->flags & (1 << TTY_IO_ERROR)) + return -EIO; + } + + switch (cmd) { +#if (LINUX_VERSION_CODE < 131394) /* Linux 2.1.66 */ + case TCSBRK: /* SVID version: non-zero arg --> no break */ + retval = tty_check_change(tty); + if (retval) + return retval; + tty_wait_until_sent(tty, 0); + if (signal_pending(current)) + return -EINTR; + if (!arg) { + send_break(info, HZ/4); /* 1/4 second */ + if (signal_pending(current)) + return -EINTR; + } + return 0; + case TCSBRKP: /* support for POSIX tcsendbreak() */ + retval = tty_check_change(tty); + if (retval) + return retval; + tty_wait_until_sent(tty, 0); + if (signal_pending(current)) + return -EINTR; + send_break(info, arg ? arg*(HZ/10) : HZ/4); + if (signal_pending(current)) + return -EINTR; + return 0; + case TIOCGSOFTCAR: + tmp = C_CLOCAL(tty) ? 1 : 0; + if (copy_to_user((void *)arg, &tmp, sizeof(int))) + return -EFAULT; + return 0; + case TIOCSSOFTCAR: + if (copy_from_user(&tmp, (void *)arg, sizeof(int))) + return -EFAULT; + + tty->termios->c_cflag = + ((tty->termios->c_cflag & ~CLOCAL) | + (tmp ? CLOCAL : 0)); + return 0; +#endif + case TIOCMGET: + return get_modem_info(info, (unsigned int *) arg); + case TIOCMBIS: + case TIOCMBIC: + case TIOCMSET: + return set_modem_info(info, cmd, (unsigned int *) arg); + case TIOCGSERIAL: + return get_serial_info(info, + (struct serial_struct *) arg); + case TIOCSSERIAL: + return set_serial_info(info, + (struct serial_struct *) arg); + case TIOCSERCONFIG: + return do_autoconfig(info); + + case TIOCSERGETLSR: /* Get line status register */ + return get_lsr_info(info, (unsigned int *) arg); + + case TIOCSERGSTRUCT: + if (copy_to_user((struct async_struct *) arg, + info, sizeof(struct async_struct))) + return -EFAULT; + return 0; + +#ifdef CONFIG_SERIAL_MULTIPORT + case TIOCSERGETMULTI: + return get_multiport_struct(info, + (struct serial_multiport_struct *) arg); + case TIOCSERSETMULTI: + return set_multiport_struct(info, + (struct serial_multiport_struct *) arg); +#endif + + /* + * Wait for any of the 4 modem inputs (DCD,RI,DSR,CTS) to change + * - mask passed in arg for lines of interest + * (use |'ed TIOCM_RNG/DSR/CD/CTS for masking) + * Caller should use TIOCGICOUNT to see which one it was + */ + case TIOCMIWAIT: + save_flags(flags); cli(); + /* note the counters on entry */ + cprev = info->state->icount; + restore_flags(flags); + /* Force modem status interrupts on */ + info->IER |= UART_IER_MSI; + serial_out(info, UART_IER, info->IER); + while (1) { + interruptible_sleep_on(&info->delta_msr_wait); + /* see if a signal did it */ + if (signal_pending(current)) + return -ERESTARTSYS; + save_flags(flags); cli(); + cnow = info->state->icount; /* atomic copy */ + restore_flags(flags); + if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr && + cnow.dcd == cprev.dcd && cnow.cts == cprev.cts) + return -EIO; /* no change => error */ + if ( ((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) || + ((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) || + ((arg & TIOCM_CD) && (cnow.dcd != cprev.dcd)) || + ((arg & TIOCM_CTS) && (cnow.cts != cprev.cts)) ) { + return 0; + } + cprev = cnow; + } + /* NOTREACHED */ + + /* + * Get counter of input serial line interrupts (DCD,RI,DSR,CTS) + * Return: write counters to the user passed counter struct + * NB: both 1->0 and 0->1 transitions are counted except for + * RI where only 0->1 is counted. + */ + case TIOCGICOUNT: + save_flags(flags); cli(); + cnow = info->state->icount; + restore_flags(flags); + icount.cts = cnow.cts; + icount.dsr = cnow.dsr; + icount.rng = cnow.rng; + icount.dcd = cnow.dcd; + icount.rx = cnow.rx; + icount.tx = cnow.tx; + icount.frame = cnow.frame; + icount.overrun = cnow.overrun; + icount.parity = cnow.parity; + icount.brk = cnow.brk; + icount.buf_overrun = cnow.buf_overrun; + + if (copy_to_user((void *)arg, &icount, sizeof(icount))) + return -EFAULT; + return 0; + case TIOCSERGWILD: + case TIOCSERSWILD: + /* "setserial -W" is called in Debian boot */ + printk ("TIOCSER?WILD ioctl obsolete, ignored.\n"); + return 0; + + default: + return -ENOIOCTLCMD; + } + return 0; +} + +static void psio_set_termios(struct tty_struct *tty, struct termios *old_termios) +{ + struct async_struct *info = (struct async_struct *)tty->driver_data; + unsigned long flags; + unsigned int cflag = tty->termios->c_cflag; + + if ( (cflag == old_termios->c_cflag) + && ( RELEVANT_IFLAG(tty->termios->c_iflag) + == RELEVANT_IFLAG(old_termios->c_iflag))) + return; + + change_speed(info, old_termios); + + /* Handle transition to B0 status */ + if ((old_termios->c_cflag & CBAUD) && + !(cflag & CBAUD)) { + info->MCR &= ~(UART_MCR_DTR|UART_MCR_RTS); + save_flags(flags); cli(); + serial_out(info, UART_MCR, info->MCR); + restore_flags(flags); + } + + /* Handle transition away from B0 status */ + if (!(old_termios->c_cflag & CBAUD) && + (cflag & CBAUD)) { + info->MCR |= UART_MCR_DTR; + if (!(tty->termios->c_cflag & CRTSCTS) || + !test_bit(TTY_THROTTLED, &tty->flags)) { + info->MCR |= UART_MCR_RTS; + } + save_flags(flags); cli(); + serial_out(info, UART_MCR, info->MCR); + restore_flags(flags); + } + + /* Handle turning off CRTSCTS */ + if ((old_termios->c_cflag & CRTSCTS) && + !(tty->termios->c_cflag & CRTSCTS)) { + tty->hw_stopped = 0; + psio_start(tty); + } +} + +/* + * ----------------------------------------------------------- + * psio_close() + * + * This routine is called when the debug console port gets closed. + * First, we wait for the last remaining data to be sent. Then, we unlink + * its async structure from the interrupt chain if necessary, and we free + * that IRQ if nothing is left in the chain. + * ----------------------------------------------------------- + */ +static void psio_close(struct tty_struct *tty, struct file *filp) +{ + struct async_struct * info = (struct async_struct *)tty->driver_data; + struct serial_state *state; + unsigned long flags; + + if (!info || serial_paranoia_check(info, tty->device, "rs_close")) + return; + + state = info->state; + + save_flags(flags); cli(); + + if (tty_hung_up_p(filp)) { + DBG_CNT("before DEC-hung"); + MOD_DEC_USE_COUNT; + restore_flags(flags); + return; + } + +#ifdef SERIAL_DEBUG_OPEN + printk("psio_close ttyD%d, count = %d\n", info->line, state->count); +#endif + if ((tty->count == 1) && (state->count != 1)) { + /* + * Uh, oh. tty->count is 1, which means that the tty + * structure will be freed. state->count should always + * be one in these conditions. If it's greater than + * one, we've got real problems, since it means the + * serial port won't be shutdown. + */ + printk("rs_close: bad serial port count; tty->count is 1, " + "state->count is %d\n", state->count); + state->count = 1; + } + if (--state->count < 0) { + printk("psio_close: bad serial port count for ttyD%d: %d\n", + info->line, state->count); + state->count = 0; + } + if (state->count) { + DBG_CNT("before DEC-2"); + MOD_DEC_USE_COUNT; + restore_flags(flags); + return; + } + info->flags |= ASYNC_CLOSING; + restore_flags(flags); + /* + * Save the termios structure, since this port may have + * separate termios for callout and dialin. + */ + if (info->flags & ASYNC_NORMAL_ACTIVE) + info->state->normal_termios = *tty->termios; + if (info->flags & ASYNC_CALLOUT_ACTIVE) + info->state->callout_termios = *tty->termios; + /* + * Now we wait for the transmit buffer to clear; and we notify + * the line discipline to only process XON/XOFF characters. + */ + tty->closing = 1; + if (info->closing_wait != ASYNC_CLOSING_WAIT_NONE) + tty_wait_until_sent(tty, info->closing_wait); + /* + * At this point we stop accepting input. To do this, we + * disable the receive line status interrupts, and tell the + * interrupt driver to stop checking the data ready bit in the + * line status register. + */ + info->IER &= ~UART_IER_RLSI; + info->read_status_mask &= ~UART_LSR_DR; + if (info->flags & ASYNC_INITIALIZED) { + serial_out(info, UART_IER, info->IER); + /* + * Before we drop DTR, make sure the UART transmitter + * has completely drained; this is especially + * important if there is a transmit FIFO! + */ + psio_wait_until_sent(tty, info->timeout); + } + shutdown(info); + if (tty->driver.flush_buffer) + tty->driver.flush_buffer(tty); + if (tty->ldisc.flush_buffer) + tty->ldisc.flush_buffer(tty); + tty->closing = 0; + info->event = 0; + info->tty = 0; + if (info->blocked_open) { + if (info->close_delay) { + set_current_state(TASK_INTERRUPTIBLE); + schedule_timeout(info->close_delay); + } + wake_up_interruptible(&info->open_wait); + } + info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CALLOUT_ACTIVE| + ASYNC_CLOSING); + wake_up_interruptible(&info->close_wait); + MOD_DEC_USE_COUNT; +} + +/* + * rs_wait_until_sent() --- wait until the transmitter is empty + */ +static void psio_wait_until_sent(struct tty_struct *tty, int timeout) +{ + struct async_struct * info = (struct async_struct *)tty->driver_data; + unsigned long orig_jiffies, char_time; + int lsr; + + if (serial_paranoia_check(info, tty->device, "psio_wait_until_sent")) + return; + + if (info->state->type == PORT_UNKNOWN) + return; + + if (info->xmit_fifo_size == 0) + return; /* Just in case.... */ + + orig_jiffies = jiffies; + /* + * Set the check interval to be 1/5 of the estimated time to + * send a single character, and make it at least 1. The check + * interval should also be less than the timeout. + * + * Note: we have to use pretty tight timings here to satisfy + * the NIST-PCTS. + */ + char_time = (info->timeout - HZ/50) / info->xmit_fifo_size; + char_time = char_time / 5; + if (char_time == 0) + char_time = 1; + if (timeout && timeout < char_time) + char_time = timeout; + /* + * If the transmitter hasn't cleared in twice the approximate + * amount of time to send the entire FIFO, it probably won't + * ever clear. This assumes the UART isn't doing flow + * control, which is currently the case. Hence, if it ever + * takes longer than info->timeout, this is probably due to a + * UART bug of some kind. So, we clamp the timeout parameter at + * 2*info->timeout. + */ + if (!timeout || timeout > 2*info->timeout) + timeout = 2*info->timeout; +#ifdef SERIAL_DEBUG_RS_WAIT_UNTIL_SENT + printk("In rs_wait_until_sent(%d) check=%lu...", timeout, char_time); + printk("jiff=%lu...", jiffies); +#endif + while (!((lsr = serial_inp(info, UART_LSR)) & UART_LSR_TEMT)) { +#ifdef SERIAL_DEBUG_RS_WAIT_UNTIL_SENT + printk("lsr = %d (jiff=%lu)...", lsr, jiffies); +#endif + set_current_state(TASK_INTERRUPTIBLE); + schedule_timeout(char_time); + if (signal_pending(current)) + break; + if (timeout && time_after(jiffies, orig_jiffies + timeout)) + break; + } +#ifdef SERIAL_DEBUG_RS_WAIT_UNTIL_SENT + printk("lsr = %d (jiff=%lu)...done\n", lsr, jiffies); +#endif +} + +/* + * psio_hangup() --- called by tty_hangup() when a hangup is signaled. + */ +static void psio_hangup(struct tty_struct *tty) +{ + struct async_struct * info = (struct async_struct *)tty->driver_data; + struct serial_state *state = info->state; + + if (serial_paranoia_check(info, tty->device, "psio_hangup")) + return; + + state = info->state; + + psio_flush_buffer(tty); + if (info->flags & ASYNC_CLOSING) + return; + shutdown(info); + info->event = 0; + state->count = 0; + info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CALLOUT_ACTIVE); + info->tty = 0; + wake_up_interruptible(&info->open_wait); +} + + + +/* +static void rs_wait_until_sent(struct tty_struct *tty, int timeout) +static void rs_hangup(struct tty_struct *tty) +*/ + +/* + * ------------------------------------------------------------ + * psio_open() and friends + * ------------------------------------------------------------ + */ +#define SERIAL_DEBUG_OPEN +static int block_til_ready(struct tty_struct *tty, struct file * filp, + struct async_struct *info) +{ + DECLARE_WAITQUEUE(wait, current); + struct serial_state *state = info->state; + int retval; + int do_clocal = 0, extra_count = 0; + unsigned long flags; + + /* + * If the device is in the middle of being closed, then block + * until it's done, and then try again. + */ + if (tty_hung_up_p(filp) || + (info->flags & ASYNC_CLOSING)) { + if (info->flags & ASYNC_CLOSING) + interruptible_sleep_on(&info->close_wait); +#ifdef SERIAL_DO_RESTART + return ((info->flags & ASYNC_HUP_NOTIFY) ? + -EAGAIN : -ERESTARTSYS); +#else + return -EAGAIN; +#endif + } + + /* + * If this is a callout device, then just make sure the normal + * device isn't being used. + */ + if (tty->driver.subtype == SERIAL_TYPE_CALLOUT) { + if (info->flags & ASYNC_NORMAL_ACTIVE) + return -EBUSY; + if ((info->flags & ASYNC_CALLOUT_ACTIVE) && + (info->flags & ASYNC_SESSION_LOCKOUT) && + (info->session != current->session)) + return -EBUSY; + if ((info->flags & ASYNC_CALLOUT_ACTIVE) && + (info->flags & ASYNC_PGRP_LOCKOUT) && + (info->pgrp != current->pgrp)) + return -EBUSY; + info->flags |= ASYNC_CALLOUT_ACTIVE; + return 0; + } + +#if 1 /* ? 020906 */ +filp->f_flags |= O_NONBLOCK; +#endif /* ? 020906 */ + /* + * If non-blocking mode is set, or the port is not enabled, + * then make the check up front and then exit. + */ + if ((filp->f_flags & O_NONBLOCK) || + (tty->flags & (1 << TTY_IO_ERROR))) { + if (info->flags & ASYNC_CALLOUT_ACTIVE) + return -EBUSY; + info->flags |= ASYNC_NORMAL_ACTIVE; + return 0; + } + + if (info->flags & ASYNC_CALLOUT_ACTIVE) { + if (state->normal_termios.c_cflag & CLOCAL) + do_clocal = 1; + } else { + if (tty->termios->c_cflag & CLOCAL) + do_clocal = 1; + } + + /* + * Block waiting for the carrier detect and the line to become + * free (i.e., not in use by the callout). While we are in + * this loop, state->count is dropped by one, so that + * rs_close() knows when to free things. We restore it upon + * exit, either normal or abnormal. + */ + retval = 0; + add_wait_queue(&info->open_wait, &wait); +#ifdef SERIAL_DEBUG_OPEN + printk("block_til_ready before block: ttyD%d, count = %d\n", + state->line, state->count); +#endif + save_flags(flags); cli(); + if (!tty_hung_up_p(filp)) { + extra_count = 1; + state->count--; + } + restore_flags(flags); + info->blocked_open++; + while (1) { + save_flags(flags); cli(); + if (!(info->flags & ASYNC_CALLOUT_ACTIVE) && + (tty->termios->c_cflag & CBAUD)) + serial_out(info, UART_MCR, + serial_inp(info, UART_MCR) | + (UART_MCR_DTR | UART_MCR_RTS)); + restore_flags(flags); + set_current_state(TASK_INTERRUPTIBLE); + if (tty_hung_up_p(filp) || + !(info->flags & ASYNC_INITIALIZED)) { +#ifdef SERIAL_DO_RESTART + if (info->flags & ASYNC_HUP_NOTIFY) + retval = -EAGAIN; + else + retval = -ERESTARTSYS; +#else + retval = -EAGAIN; +#endif + break; + } + if (!(info->flags & ASYNC_CALLOUT_ACTIVE) && + !(info->flags & ASYNC_CLOSING) && + (do_clocal || (serial_in(info, UART_MSR) & + UART_MSR_DCD))) + break; + if (signal_pending(current)) { + retval = -ERESTARTSYS; + break; + } +#ifdef SERIAL_DEBUG_OPEN + printk("block_til_ready blocking: ttyD%d, count = %d\n", + info->line, state->count); +#endif + schedule(); + } + set_current_state(TASK_RUNNING); + remove_wait_queue(&info->open_wait, &wait); + if (extra_count) + state->count++; + info->blocked_open--; +#ifdef SERIAL_DEBUG_OPEN + printk("block_til_ready after blocking: ttyD%d, count = %d\n", + info->line, state->count); +#endif + if (retval) + return retval; + info->flags |= ASYNC_NORMAL_ACTIVE; + return 0; +} +#undef SERIAL_DEBUG_OPEN + + +static int get_async_struct(int line, struct async_struct **ret_info) +{ + struct async_struct *info; + struct serial_state *sstate; + + sstate = rs_table + line; + sstate->count++; + if (sstate->info) { + *ret_info = sstate->info; + return 0; + } + info = kmalloc(sizeof(struct async_struct), GFP_KERNEL); + if (!info) { + sstate->count--; + return -ENOMEM; + } + memset(info, 0, sizeof(struct async_struct)); + init_waitqueue_head(&info->open_wait); + init_waitqueue_head(&info->close_wait); + init_waitqueue_head(&info->delta_msr_wait); + info->magic = SERIAL_MAGIC; + info->port = sstate->port; + info->flags = sstate->flags; + info->io_type = sstate->io_type; + info->iomem_base = sstate->iomem_base; + info->iomem_reg_shift = sstate->iomem_reg_shift; + info->xmit_fifo_size = sstate->xmit_fifo_size=0; + info->line = line; + info->tqueue.routine = do_softint; + info->tqueue.data = info; + info->state = sstate; + + if (sstate->info) { + kfree(info); + + *ret_info = sstate->info; + return 0; + } + *ret_info = sstate->info = info; + return 0; +} + +/* + * ----------------------------------------------------------- + * psio_open() + * + * This routine is called whenever a debug console port is opened. It + * enables interrupts for a serial port, linking in its async structure into + * the IRQ chain. It also performs the serial-specific + * initialization for the tty structure. + * ----------------------------------------------------------- + */ +static int psio_open(struct tty_struct *tty, struct file *filp) +{ + struct async_struct *info; + int retval,line=0; + unsigned long page; + + MOD_INC_USE_COUNT; + line = MINOR(tty->device) - tty->driver.minor_start; + if ((line < 0) || (line >= NR_PORTS)) { + MOD_DEC_USE_COUNT; + return -ENODEV; + } + + retval = get_async_struct(line, &info); + if (retval) { + printk("psio_open ttyD%d fail...",line); + MOD_DEC_USE_COUNT; + return retval; + } + tty->driver_data = info; + info->tty = tty; + if (serial_paranoia_check(info, tty->device, "psio_open")) + return -ENODEV; + +#ifdef SERIAL_DEBUG_OPEN + printk("psio_open %s%d, count = %d\n", tty->driver.name, info->line, + info->state->count); +#endif + info->tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0; + + /* + * This relies on lock_kernel() stuff so wants tidying for 2.5 + */ + if (!tmp_buf) { + page = get_zeroed_page(GFP_KERNEL); + if (!page) + return -ENOMEM; + if (tmp_buf) + free_page(page); + else + tmp_buf = (unsigned char *) page; + } + /* + * If the port is the middle of closing, bail out now + */ + if (tty_hung_up_p(filp) || + (info->flags & ASYNC_CLOSING)) { + if (info->flags & ASYNC_CLOSING) + interruptible_sleep_on(&info->close_wait); +#ifdef SERIAL_DO_RESTART + return ((info->flags & ASYNC_HUP_NOTIFY) ? + -EAGAIN : -ERESTARTSYS); +#else + return -EAGAIN; +#endif + } + + /* + * Start up serial port + */ + retval=startup(info); + if (retval) + return retval; + + retval = block_til_ready(tty, filp, info); + if (retval) { +#ifdef SERIAL_DEBUG_OPEN + printk("psio_open returning after block_til_ready with %d\n", + retval); +#endif + return retval; + } + + if ((info->state->count == 1) && + (info->flags & ASYNC_SPLIT_TERMIOS)) { + if (tty->driver.subtype == SERIAL_TYPE_NORMAL) + *tty->termios = info->state->normal_termios; + else + *tty->termios = info->state->callout_termios; + change_speed(info, 0); + } +#ifdef CONFIG_SERIAL_CONSOLE + if (cons.cflag && cons.index == line) { + tty->termios->c_cflag = cons.cflag; + cons.cflag = 0; + change_speed(info, 0); + } +#endif + info->session = current->session; + info->pgrp = current->pgrp; + + return 0; +} + +/* + * /proc fs routines.... + */ +static inline int line_info(char *buf, struct serial_state *state) +{ + struct async_struct *info = state->info, scr_info; + char stat_buf[30], control, status; + int ret; + unsigned long flags; + + ret = sprintf(buf, "%d: uart:%s port:%lX irq:%d", + state->line, uart_config[state->type].name, + state->port, state->irq); + + if (!state->port || (state->type == PORT_UNKNOWN)) { + ret += sprintf(buf+ret, "\n"); + return ret; + } + + /* + * Figure out the current RS-232 lines + */ + if (!info) { + info = &scr_info; /* This is just for serial_{in,out} */ + + info->magic = SERIAL_MAGIC; + info->port = state->port; + info->flags = state->flags; + info->hub6 = state->hub6; + info->io_type = state->io_type; + info->iomem_base = state->iomem_base; + info->iomem_reg_shift = state->iomem_reg_shift; + info->quot = 0; + info->tty = 0; + } + save_flags(flags); cli(); + status = serial_in(info, UART_MSR); + control = info != &scr_info ? info->MCR : serial_in(info, UART_MCR); + restore_flags(flags); + + stat_buf[0] = 0; + stat_buf[1] = 0; + if (control & UART_MCR_RTS) + strcat(stat_buf, "|RTS"); + if (status & UART_MSR_CTS) + strcat(stat_buf, "|CTS"); + if (control & UART_MCR_DTR) + strcat(stat_buf, "|DTR"); + if (status & UART_MSR_DSR) + strcat(stat_buf, "|DSR"); + if (status & UART_MSR_DCD) + strcat(stat_buf, "|CD"); + if (status & UART_MSR_RI) + strcat(stat_buf, "|RI"); + + if (info->quot) { + ret += sprintf(buf+ret, " baud:%d", + state->baud_base / (16*info->quot)); + } + + ret += sprintf(buf+ret, " tx:%d rx:%d", + state->icount.tx, state->icount.rx); + + if (state->icount.frame) + ret += sprintf(buf+ret, " fe:%d", state->icount.frame); + + if (state->icount.parity) + ret += sprintf(buf+ret, " pe:%d", state->icount.parity); + + if (state->icount.brk) + ret += sprintf(buf+ret, " brk:%d", state->icount.brk); + + if (state->icount.overrun) + ret += sprintf(buf+ret, " oe:%d", state->icount.overrun); + + /* + * Last thing is the RS-232 status lines + */ + ret += sprintf(buf+ret, " %s\n", stat_buf+1); + return ret; +} + + + +int psio_read_proc(char *page, char **start, off_t off, int count, + int *eof, void *data) +{ + int i, len = 0, l; + off_t begin = 0; + + len += sprintf(page, "sioinfo:1.0 driver:%s%s revision:%s\n", + serial_version, LOCAL_VERSTRING, serial_revdate); + for (i = 0; i < NR_PORTS && len < 4000; i++) { + l = line_info(page + len, &rs_table[i]); + len += l; + if (len+begin > off+count) + goto done; + if (len+begin < off) { + begin += len; + len = 0; + } + } + *eof = 1; +done: + if (off >= len+begin) + return 0; + *start = page + (off-begin); + return ((count < begin+len-off) ? count : begin+len-off); +} + +static char serial_options[] __initdata = + " no serial options enabled\n"; + + +static inline void show_serial_version(void) +{ + printk(KERN_INFO "%s version %s%s (%s) with%s", serial_name, + serial_version, LOCAL_VERSTRING, serial_revdate, + serial_options); +} +static unsigned detect_uart_irq (struct serial_state * state) +{ + if(! state->irq) + printk(KERN_INFO "detect_uart_irq: Ohh irq = 0\n"); + + return state->irq; +} + +static void autoconfig(struct serial_state * state) +{ + struct async_struct *info, scr_info; + //unsigned long flags; + + state->type = PORT_UNKNOWN; + +#ifdef SERIAL_DEBUG_AUTOCONF + printk("Testing ttyD%d (0x%04lx, 0x%04x)...\n", state->line, + state->port, (unsigned) state->iomem_base); +#endif + + if (!CONFIGURED_SERIAL_PORT(state)) + return; + + info = &scr_info; /* This is just for serial_{in,out} */ + + info->magic = SERIAL_MAGIC; + info->state = state; + info->port = state->port; + info->flags = state->flags; + sio_reset(info); +} + +/* + * The debug console driver boot-time initialization code! + */ +/* 20020830 */ +int __init psio_init(void) +{ + int i; + struct serial_state * state; + + init_bh(SERIAL_BH, do_psio_serial_bh); + init_timer(&serial_timer); + serial_timer.function = (void *)psio_timer; +#if 1 + mod_timer(&serial_timer, jiffies + 10); +#else /* 1 */ + mod_timer(&serial_timer, jiffies + RS_STROBE_TIME); +#endif /* 1 */ + + for (i = 0; i < NR_IRQS; i++) { + IRQ_ports[i] = 0; + IRQ_timeout[i] = 0; + } + + /* + * Initialize the tty_driver structure + */ + memset(&psio_driver, 0, sizeof(struct tty_driver)); + psio_driver.magic = TTY_DRIVER_MAGIC; +#if (LINUX_VERSION_CODE > 0x20100) + psio_driver.driver_name = "serial_m32102"; +#endif +#if 1 + psio_driver.name = "ttyD"; +#else +#if (LINUX_VERSION_CODE > 0x2032D && defined(CONFIG_DEVFS_FS)) + psio_driver.name = "ttyd/%d"; +#else + psio_driver.name = "ttyD"; +#endif +#endif /* 1 */ + + psio_driver.major = TTY_MAJOR; + psio_driver.minor_start = 80; + psio_driver.name_base = 0; + psio_driver.num = NR_PORTS; + psio_driver.type = TTY_DRIVER_TYPE_SERIAL; + + psio_driver.subtype = SERIAL_TYPE_NORMAL; + psio_driver.init_termios = tty_std_termios; + psio_driver.init_termios.c_cflag = + B9600 | CS8 | CREAD | HUPCL | CLOCAL; + psio_driver.flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS; + psio_driver.refcount = &psio_refcount; + psio_driver.table = psio_table; + psio_driver.termios = psio_termios; + psio_driver.termios_locked = psio_termios_locked; + + psio_driver.open = psio_open; + psio_driver.close = psio_close; + psio_driver.write = psio_write; + psio_driver.put_char = psio_put_char; + psio_driver.flush_chars = psio_flush_chars; + psio_driver.write_room = psio_write_room; + psio_driver.chars_in_buffer = psio_chars_in_buffer; + psio_driver.flush_buffer = psio_flush_buffer; + psio_driver.ioctl = psio_ioctl; + psio_driver.throttle = psio_throttle; + psio_driver.unthrottle = psio_unthrottle; + psio_driver.set_termios = psio_set_termios; + psio_driver.stop = psio_stop; + psio_driver.start = psio_start; + psio_driver.hangup = psio_hangup; + +#if (LINUX_VERSION_CODE >= 131394) /* Linux 2.1.66 */ + psio_driver.break_ctl = psio_break; +#endif +#if (LINUX_VERSION_CODE >= 131343) + psio_driver.send_xchar = psio_send_xchar; + psio_driver.wait_until_sent = psio_wait_until_sent; + psio_driver.read_proc = psio_read_proc; +#endif + + if (tty_register_driver(&psio_driver)) + panic("Couldn't register debug console driver\n"); + + for (i = 0, state = rs_table; i < NR_PORTS; i++,state++) { + state->magic = SSTATE_MAGIC; + state->line = i; + state->type = 14; + state->custom_divisor = 0; + state->close_delay = 5*HZ/10; + state->closing_wait = 30*HZ; + state->callout_termios = psio_driver.init_termios; + state->normal_termios = psio_driver.init_termios; + state->icount.cts = state->icount.dsr = + state->icount.rng = state->icount.dcd = 0; + state->icount.rx = state->icount.tx = 0; + state->icount.frame = state->icount.parity = 0; + state->icount.overrun = state->icount.brk = 0; + state->irq = irq_cannonicalize(state->irq); + +#if 0 + if (check_region(state->port,8)) + continue; + if (state->flags & ASYNC_BOOT_AUTOCONF) + autoconfig(psio_table); +#endif + state->baud_base = boot_cpu_data.bus_clock; + printk(KERN_INFO "ttyD%d initialized.\n",i); + tty_register_devfs(&psio_driver, 0, + psio_driver.minor_start + state->line); + } + + return 0; +} + +/* 20020830 */ +static void __exit psio_fini(void) +{ + unsigned long flags; + // int e1, e2; + int e1; + // int i; + // struct async_struct *info; + + /* printk("Unloading %s: version %s\n", serial_name, serial_version); */ + del_timer_sync(&serial_timer); + save_flags(flags); cli(); + remove_bh(SERIAL_BH); + if ((e1 = tty_unregister_driver(&psio_driver))) + printk("psio_serial: failed to unregister serial driver (%d)\n",e1); + restore_flags(flags); + + if (tmp_buf) { + unsigned long pg = (unsigned long) tmp_buf; + tmp_buf = NULL; + free_page(pg); + } +} + +module_init(psio_init); +module_exit(psio_fini); +MODULE_DESCRIPTION("M32R/M32102 (dumb) serial driver"); +MODULE_AUTHOR("Hiroyuki Kondo , Takeo Takahashi "); +MODULE_LICENSE("GPL"); + + +/* + * ----------------------------------------------------------- + * Debug console driver + * ----------------------------------------------------------- + */ + +#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE) + +static struct async_struct async_dbgcons; + +/* + * Wait for transmitter & holding register to empty + */ +static inline void wait_for_xmitr(struct async_struct *info) +{ + unsigned int status, tmout = 1000000; + + do { + status = serial_in(info, UART_LSR); + + if (status & UART_LSR_BI) + lsr_break_flag = UART_LSR_BI; + + if (--tmout == 0) + break; + } while((status & BOTH_EMPTY) != BOTH_EMPTY); + + /* Wait for flow control if necessary */ + if (info->flags & ASYNC_CONS_FLOW) { + tmout = 1000000; + while (--tmout && + ((serial_in(info, UART_MSR) & UART_MSR_CTS) == 0)); + } +} +static void dbg_console_write(struct console *co, const char *s, + unsigned count) +{ + static struct async_struct *info = &async_dbgcons; + int ier; + unsigned i; + + /* + * First save the IER then disable the interrupts + */ + ier = serial_in(info, UART_IER); + serial_out(info, UART_IER, 0x00); + + /* + * Now, do each character + */ + for (i = 0; i < count; i++, s++) { + wait_for_xmitr(info); + + /* + * Send the character out. + * If a LF, also do CR... + */ + serial_out(info, UART_TX, *s); + if (*s == 10) { + wait_for_xmitr(info); + serial_out(info, UART_TX, 13); + } + } + + /* + * Finally, Wait for transmitter & holding register to empty + * and restore the IER + */ + wait_for_xmitr(info); + serial_out(info, UART_IER, ier); +} + +#if (LINUX_VERSION_CODE <= 132114) /* Linux 2.4.18 */ +/* + * Receive character from the serial port + */ +static int dbg_console_wait_key(struct console *console) +{ + static struct async_struct *info; + int ier, c; + + info = &async_dbgcons; + + /* + * First save the IER then disable the interrupts so + * that the real driver for the port does not get the + * character. + */ + ier = serial_in(info, UART_IER); + serial_out(info, UART_IER, 0x00); + + while ((serial_in(info, UART_LSR) & UART_LSR_DR) == 0); + c = serial_in(info, UART_RX); + + /* + * Restore the interrupts + */ + serial_out(info, UART_IER, ier); + + return c; +} +#endif + +static kdev_t dbg_console_device(struct console *c) +{ + return MKDEV(TTY_MAJOR, 80 + c->index); +} + + +static int __init dbg_console_setup(struct console *co, char *options) +{ + static struct async_struct *info; + struct serial_state *state; + int baud = BAUDRATE; + int baud_base= boot_cpu_data.bus_clock; + int bits = 8; + int parity = 'n'; + int doflow = 0; + unsigned int cflag = CREAD | HUPCL | CLOCAL | CRTSCTS; + int cval; + char *s; + + if (options) { + baud = simple_strtoul(options, NULL, 10); + s = options; + while(*s >= '0' && *s <= '9') + s++; + if (*s) parity = *s++; + if (*s) bits = *s++ - '0'; + if (*s) doflow = (*s++ == 'r'); + } + + co->flags |= CON_ENABLED; + + /* + * Now construct a cflag setting. + */ + switch(baud) { + case 1200: + cflag |= B1200; + break; + case 2400: + cflag |= B2400; + break; + case 4800: + cflag |= B4800; + break; + case 19200: + cflag |= B19200; + break; + case 38400: + cflag |= B38400; + break; + case 57600: + cflag |= B57600; + break; + case 115200: + cflag |= B115200; + break; + case 9600: + default: + cflag |= B9600; + baud = 9600; + break; + } + switch(bits) { + case 7: + cflag |= CS7; + break; + default: + case 8: + cflag |= CS8; + break; + } + switch(parity) { + case 'o': case 'O': + cflag |= PARODD; + break; + case 'e': case 'E': + cflag |= PARENB; + break; + } + co->cflag = cflag; + + state = rs_table + co->index; + if (doflow) + state->flags |= ASYNC_CONS_FLOW; + info = &async_dbgcons; + info->magic = SERIAL_MAGIC; + info->state = state; + info->port = state->port; + info->flags = state->flags; + info->io_type = state->io_type; + info->iomem_base = state->iomem_base; + info->iomem_reg_shift = state->iomem_reg_shift; + + cval = (baud_base / (baud * 4)) - 1; + + serial_outp(info, UART_LCR, 0x0300); /* init status */ + //serial_outp(info, UART_MOD1, 0x0800); /* 8bit */ + serial_outp(info, UART_MOD0, 0x80); /* cts/rts 1stop nonpari */ + //serial_outp(info, UART_MOD0, 0x180); /* rts 1stop nonpari */ + //serial_outp(info, UART_MOD0, 0xc0); /* cts/rts 1stop nonpari */ + + serial_outp(info, UART_BAUR, cval); /* set baurate reg */ + //serial_outp(info, UART_RBAUR, adj); /* set adj baurate reg */ + serial_outp(info, UART_IER, 0x00); /* intr mask */ + serial_outp(info, UART_LCR, 0x03); + + return 0; +} + +static struct console cons = { + name: "ttyD", + write: dbg_console_write, + device: dbg_console_device, +#if (LINUX_VERSION_CODE <= 132114) /* Linux 2.4.18 */ + wait_key: dbg_console_wait_key, +#endif + setup: dbg_console_setup, + flags: CON_PRINTBUFFER, + index: -1, +}; + + +/* + * Register console. + */ +void __init psio_console_init(void) +{ + register_console(&cons); +} + + diff -Nru a/arch/m32r/drivers/m32r_cfc.c b/arch/m32r/drivers/m32r_cfc.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/drivers/m32r_cfc.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,910 @@ +/* + * linux/arch/m32r/drivers/m32r_cfc.c + * + * Device driver for the CFC functionality of M32R. + * + * Copyright (c) 2001, 2002, 2003, 2004 + * Hiroyuki Kondo, Naoto Sugai, Hayato Fujiwara + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#undef MAX_IO_WIN /* FIXME */ +#define MAX_IO_WIN 1 +#undef MAX_WIN /* FIXME */ +#define MAX_WIN 1 + +#include "m32r_cfc.h" + +#if !defined(COFIG_PLAT_USRV) +#define PCMCIA_DEBUG 3 +#endif /* COFIG_PLAT_USRV */ + +#ifdef PCMCIA_DEBUG +int m32r_cfc_debug = PCMCIA_DEBUG; +module_param(m32r_cfc_debug, int, 0444); +#define DEBUG(n, args...) if (m32r_cfc_debug>(n)) printk(args) +#else +#define DEBUG(n, args...) do { } while (0) +#endif + +/* Poll status interval -- 0 means default to interrupt */ +static int poll_interval = 0; + +typedef enum pcc_space { as_none = 0, as_comm, as_attr, as_io } pcc_as_t; + +typedef struct pcc_socket { + u_short type, flags; + struct pcmcia_socket socket; + unsigned int number; + ioaddr_t ioaddr; + u_long mapaddr; + u_long base; /* PCC register base */ + u_char cs_irq1, cs_irq2, intr; + pccard_io_map io_map[MAX_IO_WIN]; + pccard_mem_map mem_map[MAX_WIN]; + u_char io_win; + u_char mem_win; + pcc_as_t current_space; + u_char last_iodbex; +#ifdef CHAOS_PCC_DEBUG + u_char last_iosize; +#endif +#ifdef CONFIG_PROC_FS + struct proc_dir_entry *proc; +#endif +} pcc_socket_t; + +static int pcc_sockets = 0; +static pcc_socket_t socket[M32R_MAX_PCC] = { + { 0, }, /* ... */ +}; + +#define ISA_LOCK(n, f) do { } while (0) +#define ISA_UNLOCK(n, f) do { } while (0) + +/*====================================================================*/ + +static unsigned int pcc_get(u_short, unsigned int); +static void pcc_set(u_short, unsigned int , unsigned int ); + +static spinlock_t pcc_lock = SPIN_LOCK_UNLOCKED; + +#if !defined(CONFIG_PLAT_USRV) +static __inline__ u_long pcc_port2addr(unsigned long port, int size) { + u_long addr = 0; + u_long odd; + + if (size == 1) { /* byte access */ + odd = (port&1) << 11; + port -= port & 1; + addr = CFC_IO_MAPBASE_BYTE - CFC_IOPORT_BASE + odd + port; + } else if (size == 2) + addr = CFC_IO_MAPBASE_WORD - CFC_IOPORT_BASE + port; + + return addr; +} +#else /* CONFIG_PLAT_USRV */ +static __inline__ u_long pcc_port2addr(unsigned long port, int size) { + u_long odd; + u_long addr = ((port - CFC_IOPORT_BASE) & 0xf000) << 8; + + if (size == 1) { /* byte access */ + odd = port & 1; + port -= odd; + odd <<= 11; + addr = (addr | CFC_IO_MAPBASE_BYTE) + odd + (port & 0xfff); + } else if (size == 2) /* word access */ + addr = (addr | CFC_IO_MAPBASE_WORD) + (port & 0xfff); + + return addr; +} +#endif /* CONFIG_PLAT_USRV */ + +void pcc_ioread_byte(int sock, unsigned long port, void *buf, size_t size, + size_t nmemb, int flag) +{ + u_long addr; + unsigned char *bp = (unsigned char *)buf; + unsigned long flags; + + DEBUG(3, "m32r_cfc: pcc_ioread_byte: sock=%d, port=%#lx, buf=%p, " + "size=%u, nmemb=%d, flag=%d\n", + sock, port, buf, size, nmemb, flag); + + addr = pcc_port2addr(port, 1); + if (!addr) { + printk("m32r_cfc:ioread_byte null port :%#lx\n",port); + return; + } + DEBUG(3, "m32r_cfc: pcc_ioread_byte: addr=%#lx\n", addr); + + spin_lock_irqsave(&pcc_lock, flags); + /* read Byte */ + while (nmemb--) + *bp++ = readb(addr); + spin_unlock_irqrestore(&pcc_lock, flags); +} + +void pcc_ioread_word(int sock, unsigned long port, void *buf, size_t size, + size_t nmemb, int flag) +{ + u_long addr; + unsigned short *bp = (unsigned short *)buf; + unsigned long flags; + + DEBUG(3, "m32r_cfc: pcc_ioread_word: sock=%d, port=%#lx, " + "buf=%p, size=%u, nmemb=%d, flag=%d\n", + sock, port, buf, size, nmemb, flag); + + if (size != 2) + printk("m32r_cfc: ioread_word :illigal size %u : %#lx\n", size, + port); + if (size == 9) + printk("m32r_cfc: ioread_word :insw \n"); + + addr = pcc_port2addr(port, 2); + if (!addr) { + printk("m32r_cfc:ioread_word null port :%#lx\n",port); + return; + } + DEBUG(3, "m32r_cfc: pcc_ioread_word: addr=%#lx\n", addr); + + spin_lock_irqsave(&pcc_lock, flags); + /* read Word */ + while (nmemb--) + *bp++ = readw(addr); + spin_unlock_irqrestore(&pcc_lock, flags); +} + +void pcc_iowrite_byte(int sock, unsigned long port, void *buf, size_t size, + size_t nmemb, int flag) +{ + u_long addr; + unsigned char *bp = (unsigned char *)buf; + unsigned long flags; + + DEBUG(3, "m32r_cfc: pcc_iowrite_byte: sock=%d, port=%#lx, " + "buf=%p, size=%u, nmemb=%d, flag=%d\n", + sock, port, buf, size, nmemb, flag); + + /* write Byte */ + addr = pcc_port2addr(port, 1); + if (!addr) { + printk("m32r_cfc:iowrite_byte null port:%#lx\n",port); + return; + } + DEBUG(3, "m32r_cfc: pcc_iowrite_byte: addr=%#lx\n", addr); + + spin_lock_irqsave(&pcc_lock, flags); + while (nmemb--) + writeb(*bp++, addr); + spin_unlock_irqrestore(&pcc_lock, flags); +} + +void pcc_iowrite_word(int sock, unsigned long port, void *buf, size_t size, + size_t nmemb, int flag) +{ + u_long addr; + unsigned short *bp = (unsigned short *)buf; + unsigned long flags; + + DEBUG(3, "m32r_cfc: pcc_iowrite_word: sock=%d, port=%#lx, " + "buf=%p, size=%u, nmemb=%d, flag=%d\n", + sock, port, buf, size, nmemb, flag); + + if(size != 2) + printk("m32r_cfc: iowrite_word :illigal size %u : %#lx\n", + size, port); + if(size == 9) + printk("m32r_cfc: iowrite_word :outsw \n"); + + addr = pcc_port2addr(port, 2); + if (!addr) { + printk("m32r_cfc:iowrite_word null addr :%#lx\n",port); + return; + } +#if 1 + if (addr & 1) { + printk("m32r_cfc:iowrite_word port addr (%#lx):%#lx\n", port, + addr); + return; + } +#endif + DEBUG(3, "m32r_cfc: pcc_iowrite_word: addr=%#lx\n", addr); + + spin_lock_irqsave(&pcc_lock, flags); + while (nmemb--) + writew(*bp++, addr); + spin_unlock_irqrestore(&pcc_lock, flags); +} + +/*====================================================================*/ + +#define IS_ALIVE 0x8000 + +typedef struct pcc_t { + char *name; + u_short flags; +} pcc_t; + +static pcc_t pcc[] = { +#if !defined(CONFIG_PLAT_USRV) + { "m32r_cfc", 0 }, { "", 0 }, +#else /* CONFIG_PLAT_USRV */ + { "m32r_cfc", 0 }, { "m32r_cfc", 0 }, { "m32r_cfc", 0 }, + { "m32r_cfc", 0 }, { "m32r_cfc", 0 }, { "", 0 }, +#endif /* CONFIG_PLAT_USRV */ +}; + +static irqreturn_t pcc_interrupt(int, void *, struct pt_regs *regs); + +/*====================================================================*/ + +static struct timer_list poll_timer; + +static unsigned int pcc_get(u_short sock, unsigned int reg) +{ + unsigned int val = inw(reg); + DEBUG(3, "m32r_cfc: pcc_get: reg(0x%08x)=0x%04x\n", reg, val); + return val; +} + + +static void pcc_set(u_short sock, unsigned int reg, unsigned int data) +{ + outw(data, reg); + DEBUG(3, "m32r_cfc: pcc_set: reg(0x%08x)=0x%04x\n", reg, data); +} + +/*====================================================================== + + See if a card is present, powered up, in IO mode, and already + bound to a (non PC Card) Linux driver. We leave these alone. + + We make an exception for cards that seem to be serial devices. + +======================================================================*/ + +static int __init is_alive(u_short sock) +{ + unsigned int stat; + + DEBUG(3, "m32r_cfc: is_alive:\n"); + + printk("CF: "); + stat = pcc_get(sock, (unsigned int)PLD_CFSTS); + if (!stat) + printk("No "); + printk("Card is detected at socket %d : stat = 0x%08x\n", sock, stat); + DEBUG(3, "m32r_cfc: is_alive: sock stat is 0x%04x\n", stat); + + return 0; +} + +static void add_pcc_socket(ulong base, int irq, ulong mapaddr, ioaddr_t ioaddr) +{ + pcc_socket_t *t = &socket[pcc_sockets]; + + DEBUG(3, "m32r_cfc: add_pcc_socket: base=%#lx, irq=%d, " + "mapaddr=%#lx, ioaddr=%08x\n", + base, irq, mapaddr, ioaddr); + + /* add sockets */ + t->ioaddr = ioaddr; + t->mapaddr = mapaddr; +#if !defined(CONFIG_PLAT_USRV) + t->base = 0; + t->flags = 0; + t->cs_irq1 = irq; // insert irq + t->cs_irq2 = irq + 1; // eject irq +#else /* CONFIG_PLAT_USRV */ + t->base = base; + t->flags = 0; + t->cs_irq1 = 0; // insert irq + t->cs_irq2 = 0; // eject irq +#endif /* CONFIG_PLAT_USRV */ + + if (is_alive(pcc_sockets)) + t->flags |= IS_ALIVE; + + /* add pcc */ +#if !defined(CONFIG_PLAT_USRV) + request_region((unsigned int)PLD_CFRSTCR, 0x20, "m32r_cfc"); +#else /* CONFIG_PLAT_USRV */ + { + unsigned int reg_base; + + reg_base = (unsigned int)PLD_CFRSTCR; + reg_base |= pcc_sockets << 8; + request_region(reg_base, 0x20, "m32r_cfc"); + } +#endif /* CONFIG_PLAT_USRV */ + printk(KERN_INFO " %s ", pcc[pcc_sockets].name); + printk("pcc at 0x%08lx\n", t->base); + + /* Update socket interrupt information, capabilities */ + t->socket.features |= (SS_CAP_PCCARD | SS_CAP_STATIC_MAP); + t->socket.map_size = M32R_PCC_MAPSIZE; + t->socket.io_offset = ioaddr; /* use for io access offset */ + t->socket.irq_mask = 0; +#if !defined(CONFIG_PLAT_USRV) + t->socket.pci_irq = PLD_IRQ_CFIREQ ; /* card interrupt */ +#else /* CONFIG_PLAT_USRV */ + t->socket.pci_irq = PLD_IRQ_CF0 + pcc_sockets; +#endif /* CONFIG_PLAT_USRV */ + +#ifndef CONFIG_PLAT_USRV + /* insert interrupt */ + request_irq(irq, pcc_interrupt, 0, "m32r_cfc", pcc_interrupt); + /* eject interrupt */ + request_irq(irq+1, pcc_interrupt, 0, "m32r_cfc", pcc_interrupt); + + DEBUG(3, "m32r_cfc: enable CFMSK, RDYSEL\n"); + pcc_set(pcc_sockets, (unsigned int)PLD_CFIMASK, 0x01); +#endif /* CONFIG_PLAT_USRV */ +#if defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_USRV) || defined(CONFIG_PLAT_OPSPUT) + pcc_set(pcc_sockets, (unsigned int)PLD_CFCR1, 0x0200); +#endif + pcc_sockets++; + + return; +} + + +/*====================================================================*/ + +static irqreturn_t pcc_interrupt(int irq, void *dev, struct pt_regs *regs) +{ + int i; + u_int events = 0; + int handled = 0; + + DEBUG(3, "m32r_cfc: pcc_interrupt: irq=%d, dev=%p, regs=%p\n", + irq, dev, regs); + for (i = 0; i < pcc_sockets; i++) { + if (socket[i].cs_irq1 != irq && socket[i].cs_irq2 != irq) + continue; + + handled = 1; + DEBUG(3, "m32r_cfc: pcc_interrupt: socket %d irq 0x%02x ", + i, irq); + events |= SS_DETECT; /* insert or eject */ + if (events) + pcmcia_parse_events(&socket[i].socket, events); + } + DEBUG(3, "m32r_cfc: pcc_interrupt: done\n"); + + return IRQ_RETVAL(handled); +} /* pcc_interrupt */ + +static void pcc_interrupt_wrapper(u_long data) +{ + DEBUG(3, "m32r_cfc: pcc_interrupt_wrapper:\n"); + pcc_interrupt(0, NULL, NULL); + init_timer(&poll_timer); + poll_timer.expires = jiffies + poll_interval; + add_timer(&poll_timer); +} + +/*====================================================================*/ + +static int _pcc_get_status(u_short sock, u_int *value) +{ + u_int status; + + DEBUG(3, "m32r_cfc: _pcc_get_status:\n"); + status = pcc_get(sock, (unsigned int)PLD_CFSTS); + *value = (status) ? SS_DETECT : 0; + DEBUG(3, "m32r_cfc: _pcc_get_status: status=0x%08x\n", status); + +#if defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_USRV) || defined(CONFIG_PLAT_OPSPUT) + if ( status ) { + /* enable CF power */ + status = inw((unsigned int)PLD_CPCR); + if (!(status & PLD_CPCR_CF)) { + DEBUG(3, "m32r_cfc: _pcc_get_status: " + "power on (CPCR=0x%08x)\n", status); + status |= PLD_CPCR_CF; + outw(status, (unsigned int)PLD_CPCR); + udelay(100); + } + *value |= SS_POWERON; + + pcc_set(sock, (unsigned int)PLD_CFBUFCR,0);/* enable buffer */ + udelay(100); + + *value |= SS_READY; /* always ready */ + *value |= SS_3VCARD; + } else { + /* disable CF power */ + status = inw((unsigned int)PLD_CPCR); + status &= ~PLD_CPCR_CF; + outw(status, (unsigned int)PLD_CPCR); + udelay(100); + DEBUG(3, "m32r_cfc: _pcc_get_status: " + "power off (CPCR=0x%08x)\n", status); + } +#elif defined(CONFIG_PLAT_MAPPI2) + if ( status ) { + status = pcc_get(sock, (unsigned int)PLD_CPCR); + if (status == 0) { /* power off */ + pcc_set(sock, (unsigned int)PLD_CPCR, 1); + pcc_set(sock, (unsigned int)PLD_CFBUFCR,0); /* force buffer off for ZA-36 */ + udelay(50); + } + status = pcc_get(sock, (unsigned int)PLD_CFBUFCR); + if (status != 0) { /* buffer off */ + pcc_set(sock, (unsigned int)PLD_CFBUFCR,0); + udelay(50); + pcc_set(sock, (unsigned int)PLD_CFRSTCR, 0x0101); + udelay(25); /* for IDE reset */ + pcc_set(sock, (unsigned int)PLD_CFRSTCR, 0x0100); + mdelay(2); /* for IDE reset */ + } else { + *value |= SS_POWERON; + *value |= SS_READY; + } + } +#else +#error no platform configuration +#endif + DEBUG(3, "m32r_cfc: _pcc_get_status: GetStatus(%d) = %#4.4x\n", + sock, *value); + return 0; +} /* _get_status */ + +/*====================================================================*/ + +static int _pcc_get_socket(u_short sock, socket_state_t *state) +{ +// pcc_socket_t *t = &socket[sock]; + +#if defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_USRV) || defined(CONFIG_PLAT_OPSPUT) + state->flags = 0; + state->csc_mask = SS_DETECT; /* ??? */ + state->csc_mask |= SS_READY; /* ??? */ + state->io_irq = 0; + state->Vcc = 33; /* 3.3V fixed */ + state->Vpp = 33; +#endif + DEBUG(3, "m32r_cfc: GetSocket(%d) = flags %#3.3x, Vcc %d, Vpp %d, " + "io_irq %d, csc_mask %#2.2x\n", sock, state->flags, + state->Vcc, state->Vpp, state->io_irq, state->csc_mask); + return 0; +} /* _get_socket */ + +/*====================================================================*/ + +static int _pcc_set_socket(u_short sock, socket_state_t *state) +{ +#if defined(CONFIG_PLAT_MAPPI2) + u_long reg = 0; +#endif + DEBUG(3, "m32r_cfc: SetSocket(%d, flags %#3.3x, Vcc %d, Vpp %d, " + "io_irq %d, csc_mask %#2.2x)\n", sock, state->flags, + state->Vcc, state->Vpp, state->io_irq, state->csc_mask); + +#if defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_USRV) || defined(CONFIG_PLAT_OPSPUT) + if (state->Vcc) { + if ((state->Vcc != 50) && (state->Vcc != 33)) + return -EINVAL; + /* accept 5V and 3.3V */ + } +#elif defined(CONFIG_PLAT_MAPPI2) + if (state->Vcc) { + /* + * 5V only + */ + if (state->Vcc == 50) { + reg |= PCCSIGCR_VEN; + } else { + return -EINVAL; + } + } +#endif + + if (state->flags & SS_RESET) { + DEBUG(3, ":RESET\n"); + pcc_set(sock,(unsigned int)PLD_CFRSTCR,0x101); + }else{ + pcc_set(sock,(unsigned int)PLD_CFRSTCR,0x100); + } + if (state->flags & SS_OUTPUT_ENA){ + DEBUG(3, ":OUTPUT_ENA\n"); + /* bit clear */ + pcc_set(sock,(unsigned int)PLD_CFBUFCR,0); + } else { + pcc_set(sock,(unsigned int)PLD_CFBUFCR,1); + } + +#ifdef PCMCIA_DEBUG + if(state->flags & SS_IOCARD){ + DEBUG(3, ":IOCARD"); + } + if (state->flags & SS_PWR_AUTO) { + DEBUG(3, ":PWR_AUTO"); + } + if (state->csc_mask & SS_DETECT) + DEBUG(3, ":csc-SS_DETECT"); + if (state->flags & SS_IOCARD) { + if (state->csc_mask & SS_STSCHG) + DEBUG(3, ":STSCHG"); + } else { + if (state->csc_mask & SS_BATDEAD) + DEBUG(3, ":BATDEAD"); + if (state->csc_mask & SS_BATWARN) + DEBUG(3, ":BATWARN"); + if (state->csc_mask & SS_READY) + DEBUG(3, ":READY"); + } + DEBUG(3, "\n"); +#endif + return 0; +} /* _set_socket */ + +/*====================================================================*/ + +static int _pcc_set_io_map(u_short sock, struct pccard_io_map *io) +{ + u_char map; + + DEBUG(3, "m32r_cfc: SetIOMap(%d, %d, %#2.2x, %d ns, " + "%#4.4x-%#4.4x)\n", sock, io->map, io->flags, + io->speed, io->start, io->stop); + map = io->map; + + return 0; +} /* _set_io_map */ + +/*====================================================================*/ + +static int _pcc_set_mem_map(u_short sock, struct pccard_mem_map *mem) +{ + + u_char map = mem->map; + u_long mode; + u_long addr; + pcc_socket_t *t = &socket[sock]; + + DEBUG(3, "m32r_cfc: SetMemMap(%d, %d, %#2.2x, %d ns, " + "%#5.5lx-%#5.5lx, %#5.5x)\n", sock, map, mem->flags, + mem->speed, mem->res->start, mem->res->end, mem->card_start); + + /* + * sanity check + */ + if ((map > MAX_WIN) || (mem->card_start > 0x3ffffff) || + (mem->res->start > mem->res->end)) { + return -EINVAL; + } + + /* + * de-activate + */ + if ((mem->flags & MAP_ACTIVE) == 0) { + t->current_space = as_none; + return 0; + } + + /* + * Disable first + */ +// pcc_set(sock, PCCR, 0); + + /* + * Set mode + */ + if (mem->flags & MAP_ATTRIB) { + mode = PCMOD_AS_ATTRIB | PCMOD_CBSZ; + t->current_space = as_attr; + } else { + mode = 0; /* common memory */ + t->current_space = as_comm; + } +// pcc_set(sock, PCMOD, mode); + + /* + * Set address + */ + addr = t->mapaddr + (mem->card_start & M32R_PCC_MAPMASK); +// pcc_set(sock, PCADR, addr); + + mem->res->start = addr + mem->card_start; + mem->res->end = mem->res->start + (M32R_PCC_MAPSIZE - 1); + + /* + * Set timing + */ +// pcc_set(sock, PCATCR, pcc_access_timing); + + /* + * Enable again + */ +// pcc_set(sock, PCCR, 1); + + return 0; + +} /* _set_mem_map */ + +#if 0 /* driver model ordering issue */ +/*====================================================================== + + Routines for accessing socket information and register dumps via + /proc/bus/pccard/... + +======================================================================*/ + +static ssize_t show_info(struct class_device *class_dev, char *buf) +{ + pcc_socket_t *s = container_of(class_dev, struct pcc_socket, + socket.dev); + + return sprintf(buf, "type: %s\nbase addr: 0x%08lx\n", + pcc[s->type].name, s->base); +} + +static ssize_t show_exca(struct class_device *class_dev, char *buf) +{ + /* FIXME */ + + return 0; +} + +static CLASS_DEVICE_ATTR(info, S_IRUGO, show_info, NULL); +static CLASS_DEVICE_ATTR(exca, S_IRUGO, show_exca, NULL); +#endif + +/*====================================================================*/ + +/* this is horribly ugly... proper locking needs to be done here at + * some time... */ +#define LOCKED(x) do { \ + int retval; \ + unsigned long flags; \ + spin_lock_irqsave(&pcc_lock, flags); \ + retval = x; \ + spin_unlock_irqrestore(&pcc_lock, flags); \ + return retval; \ +} while (0) + + +static int pcc_get_status(struct pcmcia_socket *s, u_int *value) +{ + unsigned int sock = container_of(s, struct pcc_socket, socket)->number; + + if (socket[sock].flags & IS_ALIVE) { + DEBUG(3, "m32r_cfc: pcc_get_status: sock(%d) -EINVAL\n", sock); + *value = 0; + return -EINVAL; + } + DEBUG(3, "m32r_cfc: pcc_get_status: sock(%d)\n", sock); + LOCKED(_pcc_get_status(sock, value)); +} + +static int pcc_get_socket(struct pcmcia_socket *s, socket_state_t *state) +{ + unsigned int sock = container_of(s, struct pcc_socket, socket)->number; + + if (socket[sock].flags & IS_ALIVE) { + DEBUG(3, "m32r_cfc: pcc_get_socket: sock(%d) -EINVAL\n", sock); + return -EINVAL; + } + DEBUG(3, "m32r_cfc: pcc_get_socket: sock(%d)\n", sock); + LOCKED(_pcc_get_socket(sock, state)); +} + +static int pcc_set_socket(struct pcmcia_socket *s, socket_state_t *state) +{ + unsigned int sock = container_of(s, struct pcc_socket, socket)->number; + + if (socket[sock].flags & IS_ALIVE) { + DEBUG(3, "m32r_cfc: pcc_set_socket: sock(%d) -EINVAL\n", sock); + return -EINVAL; + } + DEBUG(3, "m32r_cfc: pcc_set_socket: sock(%d)\n", sock); + LOCKED(_pcc_set_socket(sock, state)); +} + +static int pcc_set_io_map(struct pcmcia_socket *s, struct pccard_io_map *io) +{ + unsigned int sock = container_of(s, struct pcc_socket, socket)->number; + + if (socket[sock].flags & IS_ALIVE) { + DEBUG(3, "m32r_cfc: pcc_set_io_map: sock(%d) -EINVAL\n", sock); + return -EINVAL; + } + DEBUG(3, "m32r_cfc: pcc_set_io_map: sock(%d)\n", sock); + LOCKED(_pcc_set_io_map(sock, io)); +} + +static int pcc_set_mem_map(struct pcmcia_socket *s, struct pccard_mem_map *mem) +{ + unsigned int sock = container_of(s, struct pcc_socket, socket)->number; + + if (socket[sock].flags & IS_ALIVE) { + DEBUG(3, "m32r_cfc: pcc_set_mem_map: sock(%d) -EINVAL\n", sock); + return -EINVAL; + } + DEBUG(3, "m32r_cfc: pcc_set_mem_map: sock(%d)\n", sock); + LOCKED(_pcc_set_mem_map(sock, mem)); +} + +static int pcc_init(struct pcmcia_socket *s) +{ + DEBUG(3, "m32r_cfc: pcc_init()\n"); + return 0; +} + +static int pcc_suspend(struct pcmcia_socket *sock) +{ + DEBUG(3, "m32r_cfc: pcc_suspend()\n"); + return pcc_set_socket(sock, &dead_socket); +} + +static struct pccard_operations pcc_operations = { + .init = pcc_init, + .suspend = pcc_suspend, + .get_status = pcc_get_status, + .get_socket = pcc_get_socket, + .set_socket = pcc_set_socket, + .set_io_map = pcc_set_io_map, + .set_mem_map = pcc_set_mem_map, +}; + +/*====================================================================*/ + +static int m32rpcc_suspend(struct device *dev, u32 state, u32 level) +{ + int ret = 0; + if (level == SUSPEND_SAVE_STATE) + ret = pcmcia_socket_dev_suspend(dev, state); + return ret; +} + +static int m32rpcc_resume(struct device *dev, u32 level) +{ + int ret = 0; + if (level == RESUME_RESTORE_STATE) + ret = pcmcia_socket_dev_resume(dev); + return ret; +} + + +static struct device_driver pcc_driver = { + .name = "cfc", + .bus = &platform_bus_type, + .suspend = m32rpcc_suspend, + .resume = m32rpcc_resume, +}; + +static struct platform_device pcc_device = { + .name = "cfc", + .id = 0, +}; + +/*====================================================================*/ + +#define UT_CFC +static int __init init_m32r_pcc(void) +{ + int i, ret; + + ret = driver_register(&pcc_driver); + if (ret) + return ret; + + ret = platform_device_register(&pcc_device); + if (ret){ + driver_unregister(&pcc_driver); + return ret; + } + +#if defined(CONFIG_PLAT_MAPPI2) + pcc_set(0, (unsigned int)PLD_CFCR0, 0x0f0f); + pcc_set(0, (unsigned int)PLD_CFCR1, 0x0200); +#endif + + pcc_sockets = 0; + +#if !defined(CONFIG_PLAT_USRV) + add_pcc_socket(M32R_PCC0_BASE, PLD_IRQ_CFC_INSERT, CFC_ATTR_MAPBASE, + CFC_IOPORT_BASE); +#else /* CONFIG_PLAT_USRV */ + { + ulong base, mapaddr; + ioaddr_t ioaddr; + + for (i = 0 ; i < M32R_MAX_PCC ; i++) { + base = (ulong)PLD_CFRSTCR; + base = base | (i << 8); + ioaddr = (i + 1) << 12; + mapaddr = CFC_ATTR_MAPBASE | (i << 20); + add_pcc_socket(base, 0, mapaddr, ioaddr); + } + } +#endif /* CONFIG_PLAT_USRV */ + + if (pcc_sockets == 0) { + printk("socket is not found.\n"); + platform_device_unregister(&pcc_device); + driver_unregister(&pcc_driver); + return -ENODEV; + } + + /* Set up interrupt handler(s) */ + + for (i = 0 ; i < pcc_sockets ; i++) { + socket[i].socket.dev.dev = &pcc_device.dev; + socket[i].socket.ops = &pcc_operations; + socket[i].socket.owner = THIS_MODULE; + socket[i].number = i; + ret = pcmcia_register_socket(&socket[i].socket); + if (ret && i--) { + for (; i>= 0; i--) + pcmcia_unregister_socket(&socket[i].socket); + break; + } +#if 0 /* driver model ordering issue */ + class_device_create_file(&socket[i].socket.dev, + &class_device_attr_info); + class_device_create_file(&socket[i].socket.dev, + &class_device_attr_exca); +#endif + } + + /* Finally, schedule a polling interrupt */ + if (poll_interval != 0) { + poll_timer.function = pcc_interrupt_wrapper; + poll_timer.data = 0; + init_timer(&poll_timer); + poll_timer.expires = jiffies + poll_interval; + add_timer(&poll_timer); + } + + return 0; +} /* init_m32r_pcc */ + +static void __exit exit_m32r_pcc(void) +{ + int i; + + for (i = 0; i < pcc_sockets; i++) + pcmcia_unregister_socket(&socket[i].socket); + + platform_device_unregister(&pcc_device); + if (poll_interval != 0) + del_timer_sync(&poll_timer); + + driver_unregister(&pcc_driver); +} /* exit_m32r_pcc */ + +module_init(init_m32r_pcc); +module_exit(exit_m32r_pcc); +MODULE_LICENSE("Dual MPL/GPL"); +/*====================================================================*/ diff -Nru a/arch/m32r/drivers/m32r_cfc.h b/arch/m32r/drivers/m32r_cfc.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/drivers/m32r_cfc.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,85 @@ +/* + * $Id$ + * + * Copyright (C) 2001 by Hiroyuki Kondo + */ + +#if !defined(CONFIG_PLAT_USRV) +#define M32R_MAX_PCC 2 +#else /* CONFIG_PLAT_USRV */ +#define M32R_MAX_PCC CONFIG_CFC_NUM +#endif /* CONFIG_PLAT_USRV */ + +/* + * M32R PC Card Controler + */ +#define M32R_PCC0_BASE 0x00ef7000 +#define M32R_PCC1_BASE 0x00ef7020 + +/* + * Register offsets + */ +#define PCCR 0x00 +#define PCADR 0x04 +#define PCMOD 0x08 +#define PCIRC 0x0c +#define PCCSIGCR 0x10 +#define PCATCR 0x14 + +/* + * PCCR + */ +#define PCCR_PCEN (1UL<<(31-31)) + +/* + * PCIRC + */ +#define PCIRC_BWERR (1UL<<(31-7)) +#define PCIRC_CDIN1 (1UL<<(31-14)) +#define PCIRC_CDIN2 (1UL<<(31-15)) +#define PCIRC_BEIEN (1UL<<(31-23)) +#define PCIRC_CIIEN (1UL<<(31-30)) +#define PCIRC_COIEN (1UL<<(31-31)) + +/* + * PCCSIGCR + */ +#define PCCSIGCR_SEN (1UL<<(31-3)) +#define PCCSIGCR_VEN (1UL<<(31-7)) +#define PCCSIGCR_CRST (1UL<<(31-15)) +#define PCCSIGCR_COCR (1UL<<(31-31)) + +/* + * + */ +#define PCMOD_AS_ATTRIB (1UL<<(31-19)) +#define PCMOD_AS_IO (1UL<<(31-18)) + +#define PCMOD_CBSZ (1UL<<(31-23)) /* set for 8bit */ + +#define PCMOD_DBEX (1UL<<(31-31)) /* set for excahnge */ + +/* + * M32R PCC Map addr + */ + +#define M32R_PCC0_MAPBASE 0x14000000 +#define M32R_PCC1_MAPBASE 0x16000000 + +#define M32R_PCC_MAPMAX 0x02000000 + +#define M32R_PCC_MAPSIZE 0x00001000 /* XXX */ +#define M32R_PCC_MAPMASK (~(M32R_PCC_MAPMAX-1)) + +#define CFC_IOPORT_BASE 0x1000 + +#if !defined(CONFIG_PLAT_USRV) +#define CFC_ATTR_MAPBASE 0x0c014000 +#define CFC_IO_MAPBASE_BYTE 0xac012000 +#define CFC_IO_MAPBASE_WORD 0xac002000 +#else /* CONFIG_PLAT_USRV */ +#define CFC_ATTR_MAPBASE 0x04014000 +#define CFC_IO_MAPBASE_BYTE 0xa4012000 +#define CFC_IO_MAPBASE_WORD 0xa4002000 +#endif /* CONFIG_PLAT_USRV */ + diff -Nru a/arch/m32r/drivers/m32r_pcc.c b/arch/m32r/drivers/m32r_pcc.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/drivers/m32r_pcc.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,821 @@ +/* + * linux/arch/m32r/drivers/m32r_pcc.c + * + * Device driver for the PCMCIA functionality of M32R. + * + * Copyright (c) 2001, 2002, 2003, 2004 + * Hiroyuki Kondo, Naoto Sugai, Hayato Fujiwara + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +/* XXX: should be moved into asm/irq.h */ +#define PCC0_IRQ 24 +#define PCC1_IRQ 25 + +#define CHAOS_PCC_DEBUG +#ifdef CHAOS_PCC_DEBUG + static volatile u_short dummy_readbuf; +#endif + +#define PCC_DEBUG_DBEX + +#define PCMCIA_DEBUG 0 + +#include "m32r_pcc.h" + +#ifdef PCMCIA_DEBUG +int pc_debug = PCMCIA_DEBUG; +module_param(pc_debug, int, 0444); +#define DEBUG(n, args...) if (pc_debug>(n)) printk(args) +#else +#define DEBUG(n, args...) do { } while (0) +#endif + +/* Poll status interval -- 0 means default to interrupt */ +static int poll_interval = 0; + +typedef enum pcc_space { as_none = 0, as_comm, as_attr, as_io } pcc_as_t; + +typedef struct pcc_socket { + u_short type, flags; + struct pcmcia_socket socket; + unsigned int number; + ioaddr_t ioaddr; + u_long mapaddr; + u_long base; /* PCC register base */ + u_char cs_irq, intr; + pccard_io_map io_map[MAX_IO_WIN]; + pccard_mem_map mem_map[MAX_WIN]; + u_char io_win; + u_char mem_win; + pcc_as_t current_space; + u_char last_iodbex; +#ifdef CHAOS_PCC_DEBUG + u_char last_iosize; +#endif +#ifdef CONFIG_PROC_FS + struct proc_dir_entry *proc; +#endif +} pcc_socket_t; + +static int pcc_sockets = 0; +static pcc_socket_t socket[M32R_MAX_PCC] = { + { 0, }, /* ... */ +}; + +#define ISA_LOCK(n, f) do { } while (0) +#define ISA_UNLOCK(n, f) do { } while (0) + +/*====================================================================*/ + +static unsigned int pcc_get(u_short, unsigned int); +static void pcc_set(u_short, unsigned int , unsigned int ); + +static spinlock_t pcc_lock = SPIN_LOCK_UNLOCKED; + +void pcc_iorw(int sock, unsigned long port, void *buf, size_t size, size_t nmemb, int wr, int flag) +{ + u_long addr; + u_long flags; + int need_ex; +#ifdef PCC_DEBUG_DBEX + int _dbex; +#endif + pcc_socket_t *t = &socket[sock]; +#ifdef CHAOS_PCC_DEBUG + int map_changed = 0; +#endif + + /* Need lock ? */ + spin_lock_irqsave(&pcc_lock, flags); + + /* + * Check if need dbex + */ + need_ex = (size > 1 && flag == 0) ? PCMOD_DBEX : 0; +#ifdef PCC_DEBUG_DBEX + _dbex = need_ex; + need_ex = 0; +#endif + + /* + * calculate access address + */ + addr = t->mapaddr + port - t->ioaddr + KSEG1; /* XXX */ + + /* + * Check current mapping + */ + if (t->current_space != as_io || t->last_iodbex != need_ex) { + + u_long cbsz; + + /* + * Disable first + */ + pcc_set(sock, PCCR, 0); + + /* + * Set mode and io address + */ + cbsz = (t->flags & MAP_16BIT) ? 0 : PCMOD_CBSZ; + pcc_set(sock, PCMOD, PCMOD_AS_IO | cbsz | need_ex); + pcc_set(sock, PCADR, addr & 0x1ff00000); + + /* + * Enable and read it + */ + pcc_set(sock, PCCR, 1); + +#ifdef CHAOS_PCC_DEBUG +#if 0 + map_changed = (t->current_space == as_attr && size == 2); /* XXX */ +#else + map_changed = 1; +#endif +#endif + t->current_space = as_io; + } + + /* + * access to IO space + */ + if (size == 1) { + /* Byte */ + unsigned char *bp = (unsigned char *)buf; + +#ifdef CHAOS_DEBUG + if (map_changed) { + dummy_readbuf = readb(addr); + } +#endif + if (wr) { + /* write Byte */ + while (nmemb--) { + writeb(*bp++, addr); + } + } else { + /* read Byte */ + while (nmemb--) { + *bp++ = readb(addr); + } + } + } else { + /* Word */ + unsigned short *bp = (unsigned short *)buf; + +#ifdef CHAOS_PCC_DEBUG + if (map_changed) { + dummy_readbuf = readw(addr); + } +#endif + if (wr) { + /* write Word */ + while (nmemb--) { +#ifdef PCC_DEBUG_DBEX + if (_dbex) { + unsigned char *cp = (unsigned char *)bp; + unsigned short tmp; + tmp = cp[1] << 8 | cp[0]; + writew(tmp, addr); + bp++; + } else +#endif + writew(*bp++, addr); + } + } else { + /* read Word */ + while (nmemb--) { +#ifdef PCC_DEBUG_DBEX + if (_dbex) { + unsigned char *cp = (unsigned char *)bp; + unsigned short tmp; + tmp = readw(addr); + cp[0] = tmp & 0xff; + cp[1] = (tmp >> 8) & 0xff; + bp++; + } else +#endif + *bp++ = readw(addr); + } + } + } + +#if 1 + /* addr is no longer used */ + if ((addr = pcc_get(sock, PCIRC)) & PCIRC_BWERR) { + printk("m32r_pcc: BWERR detected : port 0x%04lx : iosize %dbit\n", + port, size * 8); + pcc_set(sock, PCIRC, addr); + } +#endif + /* + * save state + */ + t->last_iosize = size; + t->last_iodbex = need_ex; + + /* Need lock ? */ + + spin_unlock_irqrestore(&pcc_lock,flags); + + return; +} + +void pcc_ioread(int sock, unsigned long port, void *buf, size_t size, size_t nmemb, int flag) { + pcc_iorw(sock, port, buf, size, nmemb, 0, flag); +} + +void pcc_iowrite(int sock, unsigned long port, void *buf, size_t size, size_t nmemb, int flag) { + pcc_iorw(sock, port, buf, size, nmemb, 1, flag); +} + +/*====================================================================*/ + +#define IS_ALIVE 0x8000 + +typedef struct pcc_t { + char *name; + u_short flags; +} pcc_t; + +static pcc_t pcc[] = { + { "xnux2", 0 }, { "xnux2", 0 }, +}; + +static irqreturn_t pcc_interrupt(int, void *, struct pt_regs *); + +/*====================================================================*/ + +static struct timer_list poll_timer; + +static unsigned int pcc_get(u_short sock, unsigned int reg) +{ + return inl(socket[sock].base + reg); +} + + +static void pcc_set(u_short sock, unsigned int reg, unsigned int data) +{ + outl(data, socket[sock].base + reg); +} + +/*====================================================================== + + See if a card is present, powered up, in IO mode, and already + bound to a (non PC Card) Linux driver. We leave these alone. + + We make an exception for cards that seem to be serial devices. + +======================================================================*/ + +static int __init is_alive(u_short sock) +{ + unsigned int stat; + unsigned int f; + + stat = pcc_get(sock, PCIRC); + f = (stat & (PCIRC_CDIN1 | PCIRC_CDIN2)) >> 16; + if(!f){ + printk("m32r_pcc: No Card is detected at socket %d : stat = 0x%08x\n",stat,sock); + return 0; + } + if(f!=3) + printk("m32r_pcc: Insertion fail (%.8x) at socket %d\n",stat,sock); + else + printk("m32r_pcc: Card is Inserted at socket %d(%.8x)\n",sock,stat); + return 0; +} + +static void add_pcc_socket(ulong base, int irq, ulong mapaddr, ioaddr_t ioaddr) +{ + pcc_socket_t *t = &socket[pcc_sockets]; + + /* add sockets */ + t->ioaddr = ioaddr; + t->mapaddr = mapaddr; + t->base = base; +#ifdef CHAOS_PCC_DEBUG + t->flags = MAP_16BIT; +#else + t->flags = 0; +#endif + if (is_alive(pcc_sockets)) + t->flags |= IS_ALIVE; + + /* add pcc */ + if (t->base > 0) { + request_region(t->base, 0x20, "m32r-pcc"); + } + + printk(KERN_INFO " %s ", pcc[pcc_sockets].name); + printk("pcc at 0x%08lx\n", t->base); + + /* Update socket interrupt information, capabilities */ + t->socket.features |= (SS_CAP_PCCARD | SS_CAP_STATIC_MAP); + t->socket.map_size = M32R_PCC_MAPSIZE; + t->socket.io_offset = ioaddr; /* use for io access offset */ + t->socket.irq_mask = 0; + t->socket.pci_irq = 2 + pcc_sockets; /* XXX */ + + request_irq(irq, pcc_interrupt, 0, "m32r-pcc", pcc_interrupt); + + pcc_sockets++; + + return; +} + + +/*====================================================================*/ + +static irqreturn_t pcc_interrupt(int irq, void *dev, struct pt_regs *regs) +{ + int i, j, irc; + u_int events, active; + int handled = 0; + + DEBUG(4, "m32r: pcc_interrupt(%d)\n", irq); + + for (j = 0; j < 20; j++) { + active = 0; + for (i = 0; i < pcc_sockets; i++) { + if ((socket[i].cs_irq != irq) && + (socket[i].socket.pci_irq != irq)) + continue; + handled = 1; + irc = pcc_get(i, PCIRC); + irc >>=16; + DEBUG(2, "m32r-pcc:interrput: socket %d pcirc 0x%02x ", i, irc); + if (!irc) + continue; + + events = (irc) ? SS_DETECT : 0; + events |= (pcc_get(i,PCCR) & PCCR_PCEN) ? SS_READY : 0; + DEBUG(2, " event 0x%02x\n", events); + + if (events) + pcmcia_parse_events(&socket[i].socket, events); + + active |= events; + active = 0; + } + if (!active) break; + } + if (j == 20) + printk(KERN_NOTICE "m32r-pcc: infinite loop in interrupt handler\n"); + + DEBUG(4, "m32r-pcc: interrupt done\n"); + + return IRQ_RETVAL(handled); +} /* pcc_interrupt */ + +static void pcc_interrupt_wrapper(u_long data) +{ + pcc_interrupt(0, NULL, NULL); + init_timer(&poll_timer); + poll_timer.expires = jiffies + poll_interval; + add_timer(&poll_timer); +} + +/*====================================================================*/ + +static int _pcc_get_status(u_short sock, u_int *value) +{ + u_int status; + + status = pcc_get(sock,PCIRC); + *value = ((status & PCIRC_CDIN1) && (status & PCIRC_CDIN2)) + ? SS_DETECT : 0; + + status = pcc_get(sock,PCCR); + +#if 0 + *value |= (status & PCCR_PCEN) ? SS_READY : 0; +#else + *value |= SS_READY; /* XXX: always */ +#endif + + status = pcc_get(sock,PCCSIGCR); + *value |= (status & PCCSIGCR_VEN) ? SS_POWERON : 0; + + DEBUG(3, "m32r-pcc: GetStatus(%d) = %#4.4x\n", sock, *value); + return 0; +} /* _get_status */ + +/*====================================================================*/ + +static int _pcc_get_socket(u_short sock, socket_state_t *state) +{ + DEBUG(3, "m32r-pcc: GetSocket(%d) = flags %#3.3x, Vcc %d, Vpp %d, " + "io_irq %d, csc_mask %#2.2x\n", sock, state->flags, + state->Vcc, state->Vpp, state->io_irq, state->csc_mask); + return 0; +} /* _get_socket */ + +/*====================================================================*/ + +static int _pcc_set_socket(u_short sock, socket_state_t *state) +{ + u_long reg = 0; + + DEBUG(3, "m32r-pcc: SetSocket(%d, flags %#3.3x, Vcc %d, Vpp %d, " + "io_irq %d, csc_mask %#2.2x)", sock, state->flags, + state->Vcc, state->Vpp, state->io_irq, state->csc_mask); + + if (state->Vcc) { + /* + * 5V only + */ + if (state->Vcc == 50) { + reg |= PCCSIGCR_VEN; + } else { + return -EINVAL; + } + } + + if (state->flags & SS_RESET) { + DEBUG(3, ":RESET\n"); + reg |= PCCSIGCR_CRST; + } + if (state->flags & SS_OUTPUT_ENA){ + DEBUG(3, ":OUTPUT_ENA\n"); + /* bit clear */ + } else { + reg |= PCCSIGCR_SEN; + } + + pcc_set(sock,PCCSIGCR,reg); + +#ifdef PCMCIA_DEBUG + if(state->flags & SS_IOCARD){ + DEBUG(3, ":IOCARD"); + } + if (state->flags & SS_PWR_AUTO) { + DEBUG(3, ":PWR_AUTO"); + } + if (state->csc_mask & SS_DETECT) + DEBUG(3, ":csc-SS_DETECT"); + if (state->flags & SS_IOCARD) { + if (state->csc_mask & SS_STSCHG) + DEBUG(3, ":STSCHG"); + } else { + if (state->csc_mask & SS_BATDEAD) + DEBUG(3, ":BATDEAD"); + if (state->csc_mask & SS_BATWARN) + DEBUG(3, ":BATWARN"); + if (state->csc_mask & SS_READY) + DEBUG(3, ":READY"); + } + DEBUG(3, "\n"); +#endif + return 0; +} /* _set_socket */ + +/*====================================================================*/ + +static int _pcc_set_io_map(u_short sock, struct pccard_io_map *io) +{ + u_char map; + + DEBUG(3, "m32r-pcc: SetIOMap(%d, %d, %#2.2x, %d ns, " + "%#4.4x-%#4.4x)\n", sock, io->map, io->flags, + io->speed, io->start, io->stop); + map = io->map; + + return 0; +} /* _set_io_map */ + +/*====================================================================*/ + +static int _pcc_set_mem_map(u_short sock, struct pccard_mem_map *mem) +{ + + u_char map = mem->map; + u_long mode; + u_long addr; + pcc_socket_t *t = &socket[sock]; +#ifdef CHAOS_PCC_DEBUG +#if 0 + pcc_as_t last = t->current_space; +#endif +#endif + + DEBUG(3, "m32r-pcc: SetMemMap(%d, %d, %#2.2x, %d ns, " + "%#5.5lx-%#5.5lx, %#5.5x)\n", sock, map, mem->flags, + mem->speed, mem->res->start, mem->res->end, mem->card_start); + + /* + * sanity check + */ + if ((map > MAX_WIN) || (mem->card_start > 0x3ffffff) || + (mem->res->start > mem->res->end)) { + return -EINVAL; + } + + /* + * de-activate + */ + if ((mem->flags & MAP_ACTIVE) == 0) { + t->current_space = as_none; + return 0; + } + + /* + * Disable first + */ + pcc_set(sock, PCCR, 0); + + /* + * Set mode + */ + if (mem->flags & MAP_ATTRIB) { + mode = PCMOD_AS_ATTRIB | PCMOD_CBSZ; + t->current_space = as_attr; + } else { + mode = 0; /* common memory */ + t->current_space = as_comm; + } + pcc_set(sock, PCMOD, mode); + + /* + * Set address + */ + addr = t->mapaddr + (mem->card_start & M32R_PCC_MAPMASK); + pcc_set(sock, PCADR, addr); + + mem->res->start = addr + mem->card_start; + mem->res->end = mem->res->start + (M32R_PCC_MAPSIZE - 1); + + /* + * Enable again + */ + pcc_set(sock, PCCR, 1); + +#ifdef CHAOS_PCC_DEBUG +#if 0 + if (last != as_attr) { +#else + if (1) { +#endif + + dummy_readbuf = *(u_char *)(addr + KSEG1); + } +#endif + + return 0; + +} /* _set_mem_map */ + +#if 0 /* driver model ordering issue */ +/*====================================================================== + + Routines for accessing socket information and register dumps via + /proc/bus/pccard/... + +======================================================================*/ + +static ssize_t show_info(struct class_device *class_dev, char *buf) +{ + pcc_socket_t *s = container_of(class_dev, struct pcc_socket, + socket.dev); + + return sprintf(buf, "type: %s\nbase addr: 0x%08lx\n", + pcc[s->type].name, s->base); +} + +static ssize_t show_exca(struct class_device *class_dev, char *buf) +{ + /* FIXME */ + + return 0; +} + +static CLASS_DEVICE_ATTR(info, S_IRUGO, show_info, NULL); +static CLASS_DEVICE_ATTR(exca, S_IRUGO, show_exca, NULL); +#endif + +/*====================================================================*/ + +/* this is horribly ugly... proper locking needs to be done here at + * some time... */ +#define LOCKED(x) do { \ + int retval; \ + unsigned long flags; \ + spin_lock_irqsave(&pcc_lock, flags); \ + retval = x; \ + spin_unlock_irqrestore(&pcc_lock, flags); \ + return retval; \ +} while (0) + + +static int pcc_get_status(struct pcmcia_socket *s, u_int *value) +{ + unsigned int sock = container_of(s, struct pcc_socket, socket)->number; + + if (socket[sock].flags & IS_ALIVE) { + *value = 0; + return -EINVAL; + } + LOCKED(_pcc_get_status(sock, value)); +} + +static int pcc_get_socket(struct pcmcia_socket *s, socket_state_t *state) +{ + unsigned int sock = container_of(s, struct pcc_socket, socket)->number; + + if (socket[sock].flags & IS_ALIVE) + return -EINVAL; + LOCKED(_pcc_get_socket(sock, state)); +} + +static int pcc_set_socket(struct pcmcia_socket *s, socket_state_t *state) +{ + unsigned int sock = container_of(s, struct pcc_socket, socket)->number; + + if (socket[sock].flags & IS_ALIVE) + return -EINVAL; + + LOCKED(_pcc_set_socket(sock, state)); +} + +static int pcc_set_io_map(struct pcmcia_socket *s, struct pccard_io_map *io) +{ + unsigned int sock = container_of(s, struct pcc_socket, socket)->number; + + if (socket[sock].flags & IS_ALIVE) + return -EINVAL; + LOCKED(_pcc_set_io_map(sock, io)); +} + +static int pcc_set_mem_map(struct pcmcia_socket *s, struct pccard_mem_map *mem) +{ + unsigned int sock = container_of(s, struct pcc_socket, socket)->number; + + if (socket[sock].flags & IS_ALIVE) + return -EINVAL; + LOCKED(_pcc_set_mem_map(sock, mem)); +} + +static int pcc_init(struct pcmcia_socket *s) +{ + DEBUG(4, "m32r-pcc: init call\n"); + return 0; +} + +static int pcc_suspend(struct pcmcia_socket *sock) +{ + return pcc_set_socket(sock, &dead_socket); +} + +static struct pccard_operations pcc_operations = { + .init = pcc_init, + .suspend = pcc_suspend, + .get_status = pcc_get_status, + .get_socket = pcc_get_socket, + .set_socket = pcc_set_socket, + .set_io_map = pcc_set_io_map, + .set_mem_map = pcc_set_mem_map, +}; + +/*====================================================================*/ + +static int m32r_pcc_suspend(struct device *dev, u32 state, u32 level) +{ + int ret = 0; + if (level == SUSPEND_SAVE_STATE) + ret = pcmcia_socket_dev_suspend(dev, state); + return ret; +} + +static int m32r_pcc_resume(struct device *dev, u32 level) +{ + int ret = 0; + if (level == RESUME_RESTORE_STATE) + ret = pcmcia_socket_dev_resume(dev); + return ret; +} + + +static struct device_driver pcc_driver = { + .name = "pcc", + .bus = &platform_bus_type, + .suspend = m32r_pcc_suspend, + .resume = m32r_pcc_resume, +}; + +static struct platform_device pcc_device = { + .name = "pcc", + .id = 0, +}; + +/*====================================================================*/ + +static int __init init_m32r_pcc(void) +{ + int i, ret; + + ret = driver_register(&pcc_driver); + if (ret) + return ret; + + ret = platform_device_register(&pcc_device); + if (ret){ + driver_unregister(&pcc_driver); + return ret; + } + + printk(KERN_INFO "m32r PCC probe:\n"); + + pcc_sockets = 0; + + add_pcc_socket(M32R_PCC0_BASE, PCC0_IRQ, M32R_PCC0_MAPBASE, 0x1000); + +#ifdef CONFIG_M32RPCC_SLOT2 + add_pcc_socket(M32R_PCC1_BASE, PCC1_IRQ, M32R_PCC1_MAPBASE, 0x2000); +#endif + + if (pcc_sockets == 0) { + printk("socket is not found.\n"); + platform_device_unregister(&pcc_device); + driver_unregister(&pcc_driver); + return -ENODEV; + } + + /* Set up interrupt handler(s) */ + + for (i = 0 ; i < pcc_sockets ; i++) { + socket[i].socket.dev.dev = &pcc_device.dev; + socket[i].socket.ops = &pcc_operations; + socket[i].socket.owner = THIS_MODULE; + socket[i].number = i; + ret = pcmcia_register_socket(&socket[i].socket); + if (ret && i--) { + for (; i>= 0; i--) + pcmcia_unregister_socket(&socket[i].socket); + break; + } +#if 0 /* driver model ordering issue */ + class_device_create_file(&socket[i].socket.dev, + &class_device_attr_info); + class_device_create_file(&socket[i].socket.dev, + &class_device_attr_exca); +#endif + } + + /* Finally, schedule a polling interrupt */ + if (poll_interval != 0) { + poll_timer.function = pcc_interrupt_wrapper; + poll_timer.data = 0; + init_timer(&poll_timer); + poll_timer.expires = jiffies + poll_interval; + add_timer(&poll_timer); + } + + return 0; +} /* init_m32r_pcc */ + +static void __exit exit_m32r_pcc(void) +{ + int i; + + for (i = 0; i < pcc_sockets; i++) + pcmcia_unregister_socket(&socket[i].socket); + + platform_device_unregister(&pcc_device); + if (poll_interval != 0) + del_timer_sync(&poll_timer); + + driver_unregister(&pcc_driver); +} /* exit_m32r_pcc */ + +module_init(init_m32r_pcc); +module_exit(exit_m32r_pcc); +MODULE_LICENSE("Dual MPL/GPL"); +/*====================================================================*/ diff -Nru a/arch/m32r/drivers/m32r_pcc.h b/arch/m32r/drivers/m32r_pcc.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/drivers/m32r_pcc.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,70 @@ +/* + * $Id$ + * + * Copyright (C) 2001 by Hiroyuki Kondo + */ + + + +#define M32R_MAX_PCC 2 + +/* + * M32R PC Card Controler + */ +#define M32R_PCC0_BASE 0x00ef7000 +#define M32R_PCC1_BASE 0x00ef7020 + +/* + * Register offsets + */ +#define PCCR 0x00 +#define PCADR 0x04 +#define PCMOD 0x08 +#define PCIRC 0x0c +#define PCCSIGCR 0x10 +#define PCATCR 0x14 + +/* + * PCCR + */ +#define PCCR_PCEN (1UL<<(31-31)) + +/* + * PCIRC + */ +#define PCIRC_BWERR (1UL<<(31-7)) +#define PCIRC_CDIN1 (1UL<<(31-14)) +#define PCIRC_CDIN2 (1UL<<(31-15)) +#define PCIRC_BEIEN (1UL<<(31-23)) +#define PCIRC_CIIEN (1UL<<(31-30)) +#define PCIRC_COIEN (1UL<<(31-31)) + +/* + * PCCSIGCR + */ +#define PCCSIGCR_SEN (1UL<<(31-3)) +#define PCCSIGCR_VEN (1UL<<(31-7)) +#define PCCSIGCR_CRST (1UL<<(31-15)) +#define PCCSIGCR_COCR (1UL<<(31-31)) + +/* + * + */ +#define PCMOD_AS_ATTRIB (1UL<<(31-19)) +#define PCMOD_AS_IO (1UL<<(31-18)) + +#define PCMOD_CBSZ (1UL<<(31-23)) /* set for 8bit */ + +#define PCMOD_DBEX (1UL<<(31-31)) /* set for excahnge */ + +/* + * M32R PCC Map addr + */ +#define M32R_PCC0_MAPBASE 0x14000000 +#define M32R_PCC1_MAPBASE 0x16000000 + +#define M32R_PCC_MAPMAX 0x02000000 + +#define M32R_PCC_MAPSIZE 0x00001000 /* XXX */ +#define M32R_PCC_MAPMASK (~(M32R_PCC_MAPMAX-1)) + diff -Nru a/arch/m32r/drivers/m5.c b/arch/m32r/drivers/m5.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/drivers/m5.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,913 @@ +/* + * Flash Memory Driver for M32700UT-CPU + * + * [support chips] + * - M5M29GT320VP + * + * Copyright (C) 2003 Takeo Takahashi + * + * 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. + * + * 2003-02-01: Takeo Takahashi, support M5M29GT320VP page program. + * + */ + +#ifndef __KERNEL__ +# define __KERNEL__ +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "m5.h" + +static const char version[] = "M5 Flash Driver"; +static const char date[] = __DATE__; +static const char time[] = __TIME__; + +/* + * Special function + */ +#define M5_SUPPORT_PROBE 1 +#define M5_MAX_ERROR 5 + +/* + * flash memory start address: + */ +//#define M5_BASE_ADDR (0x00000000 + NONCACHE_OFFSET) +#define M5_BASE_ADDR (0x00000000 + PAGE_OFFSET) +#define M5_IDENT_ADDR (M5_BASE_ADDR + 0) + +/* + * This driver does not have a real partition block, but + * it can support simulation of partition in single chip. + */ +#define M5_PARTITIONS (3) +static int m5_len[M5_PARTITIONS] = { + 192 * 1024, /* 192kB: 0x00000000 - 0x0002ffff */ + 1088 * 1024, /* 1088kB: 0x00030000 - 0x0013ffff */ + 2816 * 1024 /* 2816kB: 0x00140000 - 0x003fffff */ +}; + +static int major = 240; +static int debug = 2; +static int led=0; +static int m5_addr[M5_PARTITIONS]; +static int m5_blk_size[M5_PARTITIONS]; +static int m5_blksize_size[M5_PARTITIONS]; +static int m5_hardsect_size[M5_PARTITIONS]; +static int m5_read_ahead = 1; +MODULE_PARM(major, "i"); +//MODULE_PARM_DESC(major, "major number"); +MODULE_PARM(debug, "i"); +//MODULE_PARM_DESC(debug, "debug flag"); +MODULE_PARM(led, "i"); +//MODULE_PARM_DESC(led, "LED2 support"); + +static devfs_handle_t devfs_handle = NULL; +#ifdef CONFIG_PROC_FS +static struct proc_dir_entry *proc_m5; +#endif + +#define MAJOR_NR major +#define DEVICE_NAME "m5" +#define DEVICE_NR(device) MINOR(device) +#define DEVICE_NO_RANDOM +#define DEVICE_OFF(device) +#define DEVICE_ON(device) +#define DEVICE_REQUEST m5_request +#include + +#define WAIT_TIME 10 /* 10 usec */ +#define WAIT_COUNT (50000/WAIT_TIME) /* 50ms = 10us*5000times */ + +#define SUCCESS 0 +#define FAILED (-1) + +/* + * definitions for cache + */ +static struct cache { + int blk; /* block number, -1:invalid */ + int status; /* cache status */ +#define B_CLEAN 0 +#define B_DIRTY 1 + m5_t *addr; /* block base address */ + m5_t cache[M5_BLOCK_SIZE64]; +} m5_cache; +#define M5_BLK_NOCACHED() (m5_cache.blk == -1) +#define M5_BLK_CACHED(blk) (m5_cache.blk == (blk)) +#define M5_STATE_DIRTY() (m5_cache.status == B_DIRTY) +#define M5_STATE_CLEAN() (m5_cache.status == B_CLEAN) +#define M5_MARK_DIRTY() (m5_cache.status = B_DIRTY) +#define M5_MARK_CLEAN() (m5_cache.status = B_CLEAN) +#define M5_MARK_NOCACHED() (m5_cache.blk = -1) +#define M5_MARK_CACHED(blk, addr) (m5_cache.blk = (blk), \ + m5_cache.addr = (addr)) +#define M5_CACHED_BLK m5_cache.blk +#define M5_CACHED_ADDR m5_cache.addr +#define M5_CACHED_BASE m5_cache.cache + +/* + * Prototype declarations + */ +static int m5_erase_blk(m5_t *reg); +static void m5_led_toggle(void); +static void m5_led_on(void); +static void m5_led_off(void); +static m5_t m5_in(m5_t *addr); +static void m5_out(m5_t val, m5_t *addr); +static int m5_probe(m5_t *addr); +static int m5_get_blk_num(m5_t *addr); +static int m5_get_blk_offset(int blk, m5_t *addr); +static int m5_get_blk_size(int blk); +static int m5_read_blk_cache(m5_t *addr); +static int m5_write_blk_cache(void); +static int m5_full_status_check(m5_t status, m5_t *reg); +static void m5_clear_status(m5_t *reg); +#if 0 +static int m5_status_check(m5_t *reg); +#endif +static int m5_wait_for_ready(m5_t *reg); +static int m5_write_page(m5_t *addr, const m5_t *buf); +static int m5_write(const m5_t *buf, int offset, int len); +static int m5_read_page(m5_t *buf, m5_t *addr); +static int m5_read(m5_t *buf, int offset, int len); +static int m5_erase_blk(m5_t *addr); +static void m5_request(request_queue_t *req); +static int m5_ioctl(struct inode *inode, struct file *fp, unsigned int cmd, unsigned long arg); +static int m5_open(struct inode *inode, struct file *fp); +static int m5_release(struct inode *inode, struct file *fp); +static int proc_m5_read(char *buf, char **start, off_t offset, int len, int *eof, void *unused); +static int __init m5_init(void); +static int __init m5_init_module(void); +static void __exit m5_cleanup_module(void); + +/* + * special function + */ +static inline void m5_led_toggle(void) +{ + unsigned short status; + if (!led) return; + status = inw((unsigned long)PLD_IOLEDCR); + if (status & PLD_IOLED_2_ON) + status &= ~PLD_IOLED_2_ON; + else + status |= PLD_IOLED_2_ON; + outw(status, (unsigned long)PLD_IOLEDCR); +} + +static inline void m5_led_on(void) +{ + unsigned short status; + if (!led) return; + status = inw((unsigned long)PLD_IOLEDCR); + status |= PLD_IOLED_2_ON; + outw(status, (unsigned long)PLD_IOLEDCR); +} + +static inline void m5_led_off(void) +{ + unsigned short status; + if (!led) return; + status = inw((unsigned long)PLD_IOLEDCR); + status &= ~PLD_IOLED_2_ON; + outw(status, (unsigned long)PLD_IOLEDCR); +} + +/* + * I/O function + */ +static inline m5_t m5_in(m5_t *addr) +{ + return *addr; +} + +static inline void m5_out(m5_t val, m5_t *addr) +{ + *addr = val; +} + +#if M5_SUPPORT_PROBE +/* + * int m5_probe() + * m5_t *addr: probed address + * int SUCCESS: supported device + * int FAILED: unsupported device + */ +static int m5_probe(m5_t *addr) +{ +#if 1 + /* + * FIXME: cannot read maker & device codes. + */ + m5_t val; + m5_out(M5_CMD_DEVICE_IDENT, addr); + val = m5_in((m5_t *)M5_IDENT_ADDR); + val &= 0xff; + if (val == M5_MAKER) + printk("m5: detected M5M29GT320VP\n"); + else + printk("m5: unknown maker(0x%02x)\n", val); + m5_out(M5_CMD_READ_ARRAY, addr); /* array mode */ + /* always success */ + return SUCCESS; +#else + + int result; + m5_t val; + unsigned char maker, device; + + result = SUCCESS; + m5_out(M5_CMD_DEVICE_IDENT, addr); + val = m5_in((m5_t *)M5_IDENT_ADDR); + maker = (val >> 16); + device = (val & 0xff); + if (maker != M5_MAKER) { + printk("m5: unknown maker(0x%02x)\n", maker); + // result = FAILED; + // ignore error + } + if (device != M5_M5M29GT320VP) { + printk("m5: unknown device(0x%02x)\n", device); + // result = FAILED; + // ignore error + } + if (result != FAILED) + printk("m5: detected M5M29GT320VP\n"); + m5_out(M5_CMD_READ_ARRAY, addr); + return result; +#endif +} +#endif /* M5_SUPPORT_PROBE */ + +/* + * int m5_get_blk_num() + * m5_t *addr: + * blk: OK, return block number + * -1: NG + */ +static int m5_get_blk_num(m5_t *addr) +{ + int blk; + + blk = (((int)addr & 0x0fff0000) >> 16); + if (blk > 0x3f) { + printk("m5: out of block address (0x%08x)\n", (int)addr); + return -1; + } + if (blk == 0x3f) + blk += (int)(((int)addr & 0x0000e000) >> 13); + if (blk > MAX_BLOCK_NUM) { + printk("m5: out of block address (addr=0x%08x, blk=%d)\n", + (int)addr, blk); + return -1; + } + return blk; +} + +/* + * m5_t *m5_get_blk_base() + * return block base address + */ +static inline m5_t *m5_get_blk_base(int blk, m5_t *addr) +{ + if (blk < 0x3f) return (m5_t *)((int)addr & 0xffff0000); + return (m5_t *)((int)addr & 0xffffe000); +} + +/* + * int m5_get_blk_offset() + * return offset of specified address in blk + */ +static inline int m5_get_blk_offset(int blk, m5_t *addr) +{ + if (blk < 0x3f) return ((int)addr & 0xffff); + return ((int)addr & 0x1fff); +} + +/* + * int m5_get_blk_size() + * return block size in byte + */ +static inline int m5_get_blk_size(int blk) +{ + if (blk >= 63) return M5_BLOCK_SIZE8; + return M5_BLOCK_SIZE64; +} + +/* + * cache operations + */ +static int m5_read_blk_cache(m5_t *addr) +{ + int blk; + int size; + int result; + + result = SUCCESS; + blk = m5_get_blk_num(addr); + if (blk < 0) return FAILED; + if (M5_BLK_CACHED(blk)) + return result; + if (M5_STATE_DIRTY()) { /* cached other block */ + result = m5_write_blk_cache(); + if (result != SUCCESS) return result; + } + /* ok, we can use cache */ + size = m5_get_blk_size(blk); + addr = m5_get_blk_base(blk, addr); + memcpy((void *)M5_CACHED_BASE, (void *)addr, size); + M5_MARK_CACHED(blk, addr); + M5_MARK_CLEAN(); + return result; +} + +static int m5_write_blk_cache(void) +{ + int size; + int pages; + int i; + m5_t *reg, *addr, *buf; + int result; + + result = SUCCESS; + + if (M5_BLK_NOCACHED()) + return result; + if (! M5_STATE_DIRTY()) + return result; + + /* we have to write cache */ + m5_led_on(); + size = m5_get_blk_size(M5_CACHED_BLK); + addr = M5_CACHED_ADDR; + buf = M5_CACHED_BASE; + reg = addr; + + result = m5_erase_blk(reg); + if (result != SUCCESS) return result; + + DEBUG(1, "m5: wrting addr=0x%08x, buf=0x%08x, size=%d\n",\ + (int)addr, (int)buf, size); + for (pages = 0; pages < (size/M5_PAGE_SIZE); pages++) { + m5_out(M5_CMD_PROGRAM_PAGE, reg); + for (i = 0; i < (M5_PAGE_SIZE/sizeof(m5_t)); i++) + *addr++ = *buf++; + if (m5_wait_for_ready(reg) != SUCCESS) + result = FAILED; + reg = addr; + } + m5_out(M5_CMD_READ_ARRAY, reg); /* array mode */ + if (result == SUCCESS) + M5_MARK_CLEAN(); + m5_led_off(); + return result; /* SUCCESS or FAILED */ +} + +/* + * int m5_full_status_check() + * m5_t status: status + * m5_t *reg: bank address + * SUCCESS: no error + * FAILED: error happen + */ +static inline int m5_full_status_check(m5_t status, m5_t *reg) +{ + if ((status & M5_STATUS_PROGRAM) && + (status & M5_STATUS_ERASE)) { + printk("m5: command sequence error (addr=0x%08x, sts=0x%02x).\n", + (int)reg, status); + return FAILED; + } + if(status & M5_STATUS_ERASE){ + printk("m5: erase error (addr=0x%08x, sts=0x%02x).\n", + (int)reg, status); + return FAILED; + } + if(status & M5_STATUS_PROGRAM){ + printk("m5: program write error (addr=0x%08x, sts=0x%02x).\n", + (int)reg, status); + return FAILED; + } + if(status & M5_STATUS_BLOCK){ + printk("m5: block write error (addr=0x%08x, sts=0x%02x).\n", + (int)reg, status); + return FAILED; + } + /* passed */ + return SUCCESS; +} + +/* + * void m5_clear_status() + * m5_t *reg: address of status register + */ +static inline void m5_clear_status(m5_t *reg) +{ + m5_out(M5_CMD_CLEAR_STATUS, reg); +} + +#if 0 +/* + * int m5_status_check() + * m5_t *reg: address of command register + * SUCCESS: ready now + * FAILED: error happen while waiting + */ +static int m5_status_check(m5_t *reg) +{ + m5_t status; + int result; + int n; + static int error_count = 0; + + m5_out(M5_CMD_READ_STATUS, reg); + for (n = WAIT_COUNT; n > 0; n--) { + status = m5_in(reg); + if (status & M5_STATUS_READY) + break; + udelay(WAIT_TIME); + } + if (n <= 0) { + if (error_count++ < M5_MAX_ERROR) + printk("m5: time out (sts=0x%02x).\n", status); + m5_clear_status(reg); + return FAILED; + } + result = m5_full_status_check(status, reg); + if (result != SUCCESS) { + m5_clear_status(reg); + return FAILED; + } + m5_clear_status(reg); + return SUCCESS; +} +#endif + +/* + * int m5_wait_for_ready() + * m5_t *reg: address of command register + * SUCCESS: ready now + * FAILED: error happen while waiting + */ +static int m5_wait_for_ready(m5_t *reg) +{ + m5_t status; + int result; + int n; + static int error_count = 0; + + for (n = WAIT_COUNT; n > 0; n--) { + status = m5_in(reg); + if (status & M5_STATUS_READY) + break; + udelay(WAIT_TIME); + } + if (n <= 0) { + if (error_count++ < M5_MAX_ERROR) + printk("m5: time out (sts=0x%02x).\n", status); + m5_clear_status(reg); + return FAILED; + } + result = m5_full_status_check(status, reg); + if (result != SUCCESS) { + m5_clear_status(reg); + return FAILED; + } + return SUCCESS; +} + +/* + * int m5_write_page(m5_t *addr, const m5_t *buf) + * m5_t *addr: sector address + * m5_t *buf: buffer address + * SUCCESS: ok + * FAILED: error + */ +static int m5_write_page(m5_t *addr, const m5_t *buf) +{ + int blk; + int offset; + + if (((int)addr % M5_PAGE_SIZE) != 0) + printk("m5: invalid sector addres (0x%08x)\n", (int)addr); + + if (m5_read_blk_cache(addr) != SUCCESS) + return FAILED; + if ((blk = m5_get_blk_num(addr)) < 0) + return FAILED; + offset = m5_get_blk_offset(blk, addr); + memcpy((void *)M5_CACHED_BASE + offset, (void *)buf, M5_PAGE_SIZE); + M5_MARK_DIRTY(); + return SUCCESS; +} + +/* + * int m5_write(const m5_t *buf, int offset, int len) + * m5_t *buf: write buffer address + * int offset: offset from flash base address + * int len: write length + * SUCCESS: ok + * FAILE: error + */ +static int m5_write(const m5_t *buf, int offset, int len) +{ + m5_t *addr; + int result; + + if (len % M5_PAGE_SIZE) { + printk("m5: invalid write size (%d).\n", len); + return FAILED; + } + addr = (m5_t *)(m5_addr[MINOR(CURRENT_DEV)] + offset); + + DEBUG(1, "m5: writing 0x%08x - 0x%08x\n", \ + (int)addr, (int)addr + len); + + for (; len > 0; len -= M5_PAGE_SIZE) { + result = m5_write_page(addr, buf); + if (result != SUCCESS) + return result; + addr = (m5_t *)((int)addr + M5_PAGE_SIZE); + buf = (m5_t *)((int)buf + M5_PAGE_SIZE); + } + return SUCCESS; +} + +/* + * int m5_read_page() + * m5_t *buf: read buffer address + * m5_t *addr: page address + * SUCCESS: ok + * FAILED: error + */ +static int m5_read_page(m5_t *buf, m5_t *addr) +{ + int blk; + int offset; + + if ((blk = m5_get_blk_num(addr)) < 0) + return FAILED; + if (M5_BLK_CACHED(blk)) { + offset = m5_get_blk_offset(blk, addr); + memcpy((void *)buf, (void *)M5_CACHED_BASE + offset, + M5_PAGE_SIZE); + } else { + /* read from flash memory directory */ + memcpy((void *)buf, (void *)addr, M5_PAGE_SIZE); + } + return SUCCESS; +} + +/* + * int m5_read() + * m5_t *buf: read buffer address + * int offset: offset from flash base address + * int len: read length + * SUCCESS: ok + * FAILED: error + */ +static int m5_read(m5_t *buf, int offset, int len) +{ + m5_t *addr; + + if (len % M5_PAGE_SIZE) { + printk("m5: invalid read size (%d).\n", len); + return FAILED; + } + + addr = (m5_t *)(m5_addr[MINOR(CURRENT_DEV)] + offset); + + DEBUG(1, "m5: reading 0x%08x - 0x%08x\n", \ + (int)addr, (int)addr + len); + + for (; len > 0; len -= M5_PAGE_SIZE) { + if (m5_read_page(buf, addr) != SUCCESS) + return FAILED; + buf = (m5_t *)((int)buf + M5_PAGE_SIZE); + addr = (m5_t *)((int)addr + M5_PAGE_SIZE); + } + return SUCCESS; +} + +/* + * int m5_erase_blk() + * m5_t *addr: + */ +static int m5_erase_blk(m5_t *addr) +{ + int result; + + DEBUG(1, "m5: erasing addr=0x%08x\n", (int)addr); + m5_out(M5_CMD_BLOCK_ERASE, addr); + m5_out(M5_CMD_CONFIRM, addr); + result = m5_wait_for_ready(addr); + return result; +} + +/* + * void m5_request() + * request_queue_t *req: I/O request + * end_request(0): error (-EIO) + * end_request(1): ok + */ +static void m5_request(request_queue_t *req) +{ + unsigned int minor; + int offset; + int len; + static int error_count = 0; + + sti(); + while (1) { + INIT_REQUEST; + minor = MINOR(CURRENT_DEV); + if (minor >= M5_PARTITIONS) { + printk( "m5: out of partition (%d)\n", minor ); + end_request(0); + continue; + } + offset = CURRENT->sector * m5_hardsect_size[minor]; + len = (CURRENT->current_nr_sectors * + m5_hardsect_size[minor]); + if ((offset + len) > m5_len[minor]) { + printk( "m5: out of sector (sector=%d, nr=%d)\n", + (int)(CURRENT->sector), + (int)(CURRENT->current_nr_sectors)); + end_request(0); + continue; + } + switch(CURRENT->cmd) { + case READ: + if (m5_read((m5_t *)CURRENT->buffer, + offset, len) != SUCCESS) + end_request(0); + else + end_request(1); + break; + case WRITE: + if (m5_write((m5_t *)(CURRENT->buffer), + offset, len) != SUCCESS) + end_request(0); + else + end_request(1); + break; + default: + if (error_count++ < M5_MAX_ERROR) { + printk("m5: invalid I/O request(%d)\n", + CURRENT->cmd); + } + end_request(0); + break; + } + } +} + +/* + * int m5_ioctl() + * struct inode *inode: + * struct file *file: + * unsigned int cmd: + * unsigned long arg: + */ +static int m5_ioctl(struct inode *inode, struct file *fp, unsigned int cmd, unsigned long arg) +{ + int size; + + DEBUG(2, "m5_ioctl()\n"); + switch (cmd) { + case BLKGETSIZE: + if (!arg) return -EINVAL; + size = (1024 * m5_blk_size[MINOR(inode->i_rdev)] / + m5_hardsect_size[MINOR(inode->i_rdev)]); + return put_user(size, (long __user *)arg); + case BLKFLSBUF: + if (!capable(CAP_SYS_ADMIN)) return -EACCES; + fsync_dev(inode->i_rdev); + invalidate_buffers(inode->i_rdev); + return 0; + case BLKRRPART: + return -EINVAL; + + case BLKRAGET: + case BLKRASET: + case BLKGETSIZE64: + case BLKROSET: + case BLKROGET: + case BLKSSZGET: + return blk_ioctl(inode->i_rdev, cmd, arg); + default: + printk( "m5: unsupported ioctl(0x%08x)\n", cmd); + return -EINVAL; + } + return 0; +} + +/* + * int m5_open() + * struct inode *inode: + * struct file *fp: + */ +static int m5_open(struct inode *inode, struct file *fp) +{ + if (DEVICE_NR(inode->i_rdev) >= M5_PARTITIONS) return -ENXIO; + MOD_INC_USE_COUNT; + return 0; +} + +/* + * int m5_release() + * struct inode *inode: + * struct file *fp: + */ +static int m5_release(struct inode *inode, struct file *fp) +{ + sync_dev(inode->i_rdev); + MOD_DEC_USE_COUNT; + return 0; +} + +#ifdef CONFIG_PROC_FS +/* + * int proc_m5_read() + * char *buf: + * char **start: + * off_t offset: + * int len: + * int *eof: + * void *unused: + */ +static int proc_m5_read(char *buf, char **start, off_t offset, int len, int *eof, void *unused) +{ + len = sprintf(buf, "partition: %d\n", M5_PARTITIONS); + return len; +} +#endif + +static struct block_device_operations m5_fops = { + open: m5_open, + release: m5_release, + ioctl: m5_ioctl, + /* check_media_change: */ + /* revalidate: */ + owner: THIS_MODULE, +}; + +/* + * int m5_init() + */ +static int __init m5_init(void) +{ + int i; + int result; + + result = -EIO; + + printk("%s (%s %s)\n", version, date, time); +#if M5_SUPPORT_PROBE + if (m5_probe((m5_t *)M5_BASE_ADDR) != SUCCESS) + return result; +#endif /* M5_SUPPORT_PROBE */ + + if (register_blkdev(major, DEVICE_NAME, &m5_fops) ) { + printk("m5: can not not get major %d", major); + return result; + } + + if (devfs_register_blkdev(major, DEVICE_NAME, &m5_fops) ) { + printk("m5: can not not get major %d", major); + goto fail_devfs; + } + devfs_handle = devfs_mk_dir(NULL, "m5", NULL); + devfs_register_series(devfs_handle, "%u", M5_PARTITIONS, + DEVFS_FL_DEFAULT, major, 0, + S_IFBLK | S_IRUSR | S_IWUSR, + &m5_fops, NULL); + + for (i = 0; i < M5_PARTITIONS; i++) { + if (i) { + m5_addr[i] = m5_addr[i-1] + m5_len[i-1]; + } else { + m5_addr[i] = M5_BASE_ADDR; + } + m5_blk_size[i] = m5_len[i]/1024; /* KB order */ + m5_blksize_size[i] = BLOCK_SIZE; /* 1024 byte */ + m5_hardsect_size[i] = BLOCK_SIZE/2; /* 512 byte */ + } + /* defined in ll_rw_blk.c */ + blk_size[major] = m5_blk_size; + blksize_size[major] = m5_blksize_size; + hardsect_size[major] = m5_hardsect_size; + read_ahead[major] = m5_read_ahead; + + blk_init_queue(BLK_DEFAULT_QUEUE(major), &m5_request); + + for (i = 0; i < M5_PARTITIONS; i++) + register_disk( NULL, MKDEV(major,i), 1, + &m5_fops, m5_len[i]>>9 ); + +#ifdef CONFIG_PROC_FS +#if 1 + proc_m5 = proc_mkdir("m5", proc_root_driver); + if (!proc_m5) { + printk(KERN_ERR "m5: unable to register driver/m5\n"); + goto fail_proc; + } + create_proc_read_entry("0", 0, proc_m5, proc_m5_read, 0); + create_proc_read_entry("1", 0, proc_m5, proc_m5_read, 0); + create_proc_read_entry("2", 0, proc_m5, proc_m5_read, 0); +#else + proc_m5 = create_proc_entry("driver/m5", 666, 0); + if (!proc_m5) { + printk(KERN_ERR "m5: unable to register driver/m5\n"); + goto fail_proc; + } + proc_m5->read_proc = proc_m5_read; +#endif +#endif + + printk("m5: Major=%d Partitions=%d\n", major,M5_PARTITIONS); + for (i = 0; i < M5_PARTITIONS; i++) { + printk(" %d: 0x%08x-0x%08x (all=%dKB,blk=%dB,sect=%dB,ahead=%d)\n", + i, m5_addr[i], + m5_addr[i] + m5_len[i], + m5_blk_size[i], + m5_blksize_size[i], + m5_hardsect_size[i], + m5_read_ahead); + } + + /* clear cache */ + M5_MARK_CLEAN(); + M5_MARK_NOCACHED(); + + m5_led_off(); + return 0; + +fail_proc: + devfs_unregister(devfs_handle); +fail_devfs: + unregister_blkdev(major, DEVICE_NAME); + return result; +} + +static int __init m5_init_module(void) +{ + return m5_init(); +} + +static void __exit m5_cleanup_module(void) +{ + int i; + + for (i = 0 ; i < M5_PARTITIONS; i++) { + fsync_dev(MKDEV(major, i)); /* flush buffer */ + destroy_buffers(MKDEV(major, i)); + } + m5_write_blk_cache(); /* flush m5 cache */ + devfs_unregister(devfs_handle); + unregister_blkdev(major, DEVICE_NAME); +#ifdef CONFIG_PROC_FS + remove_proc_entry("0", proc_m5); + remove_proc_entry("1", proc_m5); + remove_proc_entry("2", proc_m5); + remove_proc_entry("m5", proc_root_driver); +#endif + blk_cleanup_queue(BLK_DEFAULT_QUEUE(major)); + blk_size[major] = NULL; + blksize_size[major] = NULL; + hardsect_size[major] = NULL; + read_ahead[major] = 0; +} + +module_init(m5_init_module); +module_exit(m5_cleanup_module); + +MODULE_AUTHOR("Takeo Takahashi"); +MODULE_DESCRIPTION("M5 Flash Driver for M32700UT-CPU"); +MODULE_LICENSE("GPL"); +EXPORT_NO_SYMBOLS; + diff -Nru a/arch/m32r/drivers/m5.h b/arch/m32r/drivers/m5.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/drivers/m5.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,73 @@ +/* + * Flash Memory Driver for M32700UT-CPU + * + * Copyright 2003 (C) Takeo Takahashi + * + * 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. + * + * 2003-02-01: Takeo Takahashi, support M5M29GT320VP. + */ + +#include + +#ifdef __KERNEL__ +#undef DEBUG +/* debug routine: + * 0x00000001: print debug information + */ +# define DEBUG(n, args...) if ((n) & debug) \ + printk(KERN_DEBUG args) +#endif /* __KERNEL__ */ + +/* + * data type to access flash memory + */ +typedef volatile unsigned short m5_t; + +/* + * - Page program buffer size in byte + * - block size in byte + * - number of block + */ +#define M5_PAGE_SIZE (256) +#define M5_BLOCK_SIZE8 (8*1024) +#define M5_BLOCK_SIZE64 (64*1024) +#define MAX_BLOCK_NUM 70 + +/* + * Software commands + */ +#define M5_CMD_READ_ARRAY 0xff +#define M5_CMD_DEVICE_IDENT 0x90 +#define M5_CMD_READ_STATUS 0x70 +#define M5_CMD_CLEAR_STATUS 0x50 +#define M5_CMD_BLOCK_ERASE 0x20 +#define M5_CMD_CONFIRM 0xd0 +#define M5_CMD_PROGRAM_BYTE 0x40 +#define M5_CMD_PROGRAM_WORD M5_CMD_PROGRAM_BYTE +#define M5_CMD_PROGRAM_PAGE 0x41 +#define M5_CMD_SINGLE_LOAD_DATA 0x74 +#define M5_CMD_BUFF2FLASH 0x0e +#define M5_CMD_FLASH2BUFF 0xf1 +#define M5_CMD_CLEAR_BUFF 0x55 +#define M5_CMD_SUSPEND 0xb0 +#define M5_CMD_RESUME 0xd0 + +/* + * Status + */ +#define M5_STATUS_READY 0x80 /* 0:busy 1:ready */ +#define M5_STATUS_SUSPEND 0x40 /* 0:progress/complete 1:suspend */ +#define M5_STATUS_ERASE 0x20 /* 0:pass 1:error */ +#define M5_STATUS_PROGRAM 0x10 /* 0:pass 1:error */ +#define M5_STATUS_BLOCK 0x08 /* 0:pass 1:error */ + +/* + * Device Code + */ +#define M5_MAKER (0x1c) +#define M5_M5M29GT320VP (0x20) +#define M5_M5M29GB320VP (0x21) diff -Nru a/arch/m32r/drivers/m5drv.c b/arch/m32r/drivers/m5drv.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/drivers/m5drv.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,664 @@ +/* + * MTD chip driver for M5M29GT320VP + * + * Copyright (C) 2003 Takeo Takahashi + * + * 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. + * + * $Id$ + */ + +#ifndef __KERNEL__ +# define __KERNEL__ +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define M5DRV_DEBUG(n, args...) if ((n) & m5drv_debug) printk(KERN_DEBUG args) + +#undef UNLOCK_BEFORE_ERASE + +#define M5DRV_PAGE_SIZE (256) /* page program size */ +#define M5DRV_BLOCK_SIZE8 (8*1024) /* 8K block size in byte */ +#define M5DRV_BLOCK_SIZE64 (64*1024) /* 64K block size in byte */ +#define M5DRV_MAX_BLOCK_NUM 70 /* number of blocks */ +#define M5DRV_ERASE_REGION 2 /* 64KB and 8KB */ + +/* + * Software commands + */ +#define CMD_READ_ARRAY 0xff +#define CMD_DEVICE_IDENT 0x90 +#define CMD_READ_STATUS 0x70 +#define CMD_CLEAR_STATUS 0x50 +#define CMD_BLOCK_ERASE 0x20 +#define CMD_CONFIRM 0xd0 +#define CMD_PROGRAM_BYTE 0x40 +#define CMD_PROGRAM_WORD CMD_PROGRAM_BYTE +#define CMD_PROGRAM_PAGE 0x41 +#define CMD_SINGLE_LOAD_DATA 0x74 +#define CMD_BUFF2FLASH 0x0e +#define CMD_FLASH2BUFF 0xf1 +#define CMD_CLEAR_BUFF 0x55 +#define CMD_SUSPEND 0xb0 +#define CMD_RESUME 0xd0 +#define IDENT_OFFSET 0 /* indent command offset */ + +/* + * Status + */ +#define STATUS_READY 0x80 /* 0:busy 1:ready */ +#define STATUS_SUSPEND 0x40 /* 0:progress/complete 1:suspend */ +#define STATUS_ERASE 0x20 /* 0:pass 1:error */ +#define STATUS_PROGRAM 0x10 /* 0:pass 1:error */ +#define STATUS_BLOCK 0x08 /* 0:pass 1:error */ + +/* + * Device Code + */ +#define MAKER (0x1c) +#define M5M29GT320VP (0x20) +#define M5M29GB320VP (0x21) + +static const char version[] = "M5DRV Flash Driver"; +static const char date[] = __DATE__; +static const char time[] = __TIME__; +static int m5drv_debug = 0; +MODULE_PARM(m5drv_debug, "i"); + +struct m5drv_info { + struct flchip *chip; + int chipshift; + int numchips; + struct flchip chips[1]; + unsigned char buf[M5DRV_BLOCK_SIZE64]; +#define M5BUF (m5drv->buf) +}; + +struct mtd_info *m5drv_probe(struct map_info *map); +static int m5drv_probe_map(struct map_info *map, struct mtd_info *mtd); +static int m5drv_wait(struct map_info *map, struct flchip *chip, loff_t adr); +static void m5drv_release(struct flchip *chip); +static int m5drv_query_blksize(loff_t ofs); +static int m5drv_read(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); +static int m5drv_read_oneblock(struct map_info *map, loff_t from); +static int m5drv_write(struct mtd_info *mtd, loff_t adr, size_t len, size_t *retlen, const u_char *buf); +static int m5drv_write_oneblock(struct map_info *map, loff_t adr, size_t len, const u_char *buf); +static int m5drv_write_onepage(struct map_info *map, struct flchip *chip, unsigned long adr, const u_char *buf); +static int m5drv_erase(struct mtd_info *mtd, struct erase_info *instr); +static int m5drv_do_wait_for_ready(struct map_info *map, struct flchip *chip, unsigned long adr); +static int m5drv_erase_oneblock(struct map_info *map, struct flchip *chip, unsigned long adr); +static void m5drv_sync(struct mtd_info *mtd); +static int m5drv_suspend(struct mtd_info *mtd); +static void m5drv_resume(struct mtd_info *mtd); +static void m5drv_destroy(struct mtd_info *mtd); +#ifdef UNLOCK_BEFORE_ERASE +static void m5drv_unlock_oneblock(struct map_info *map, struct flchip *chip, unsigned long adr); +#endif + +static struct mtd_chip_driver m5drv_chipdrv = { + probe: m5drv_probe, + destroy: m5drv_destroy, + name: "m5drv", + module: THIS_MODULE +}; + +struct mtd_info *m5drv_probe(struct map_info *map) +{ + struct mtd_info *mtd = NULL; + struct m5drv_info *m5drv = NULL; + int width; + + mtd = kmalloc(sizeof(*mtd), GFP_KERNEL); + if (!mtd) { + printk("m5drv: can not allocate memory for mtd_info\n"); + return NULL; + } + + m5drv = kmalloc(sizeof(*m5drv), GFP_KERNEL); + if (!m5drv) { + printk("m5drv: can not allocate memory for m5drv_info\n"); + kfree(mtd); + return NULL; + } + + memset(mtd, 0, sizeof(*mtd)); + width = m5drv_probe_map(map, mtd); + if (!width) { + printk("m5drv: m5drv_probe_map error (width=%d)\n", width); + kfree(mtd); + kfree(m5drv); + return NULL; + } + mtd->priv = map; + mtd->type = MTD_OTHER; + mtd->erase = m5drv_erase; + mtd->read = m5drv_read; + mtd->write = m5drv_write; + mtd->sync = m5drv_sync; + mtd->suspend = m5drv_suspend; + mtd->resume = m5drv_resume; + mtd->flags = MTD_CAP_NORFLASH; /* ??? */ + mtd->name = map->name; + + memset(m5drv, 0, sizeof(*m5drv)); + m5drv->chipshift = 23; + m5drv->numchips = 1; + m5drv->chips[0].start = 0; + m5drv->chips[0].state = FL_READY; + m5drv->chips[0].mutex = &m5drv->chips[0]._spinlock; + m5drv->chips[0].word_write_time = 0; + init_waitqueue_head(&m5drv->chips[0].wq); + spin_lock_init(&m5drv->chips[0]._spinlock); + + map->fldrv = &m5drv_chipdrv; + map->fldrv_priv = m5drv; + + MOD_INC_USE_COUNT; + return mtd; +} + +static int m5drv_probe_map(struct map_info *map, struct mtd_info *mtd) +{ + u16 tmp; + u16 maker, device; + int width = 2; + struct mtd_erase_region_info *einfo; + + map->write16(map, CMD_READ_ARRAY, IDENT_OFFSET); + tmp = map->read16(map, IDENT_OFFSET); + map->write16(map, CMD_DEVICE_IDENT, IDENT_OFFSET); + maker = map->read16(map, IDENT_OFFSET); + maker &= 0xff; + if (maker == MAKER) { + /* FIXME: check device */ + device = maker >> 8; + printk("m5drv: detected M5M29GT320VP\n"); + einfo = kmalloc(sizeof(*einfo) * M5DRV_ERASE_REGION, GFP_KERNEL); + if (!einfo) { + printk("m5drv: cannot allocate memory for erase_region\n"); + return 0; + } + /* 64KB erase block (blk no# 0-62) */ + einfo[0].offset = 0; + einfo[0].erasesize = 0x8000 * width; + einfo[0].numblocks = (7 + 8 + 24 + 24); + /* 8KB erase block (blk no# 63-70) */ + einfo[1].offset = 0x3f0000; + einfo[1].erasesize = 0x1000 * width; + einfo[1].numblocks = (2 + 8); + mtd->numeraseregions = M5DRV_ERASE_REGION; + mtd->eraseregions = einfo; + mtd->size = 0x200000 * width; /* total 4MB */ + /* + * mtd->erasesize is used in parse_xxx_partitions. + * last erase block has a partition table. + */ + mtd->erasesize = 0x8000 * width; + return width; + } else if (map->read16(map, IDENT_OFFSET) == CMD_DEVICE_IDENT) { + printk("m5drv: looks like RAM\n"); + map->write16(map, tmp, IDENT_OFFSET); + } else { + printk("m5drv: can not detect flash memory (0x%04x)\n", maker); + } + map->write16(map, CMD_READ_ARRAY, IDENT_OFFSET); + return 0; +} + +static int m5drv_query_blksize(loff_t ofs) +{ + int blk; + + blk = ofs >> 16; + if (blk > 0x3f) { + printk("m5drv: out of block address (0x%08x)\n", (u32)ofs); + return M5DRV_BLOCK_SIZE64; + } + if (blk == 63) blk += ((ofs & 0x0000e000) >> 13); + if (blk > M5DRV_MAX_BLOCK_NUM) { + printk("m5drv: out of block address (0x%08x)\n", (u32)ofs); + return M5DRV_BLOCK_SIZE64; + } + return ((blk >= 63)? M5DRV_BLOCK_SIZE8:M5DRV_BLOCK_SIZE64); +} + +static int m5drv_wait(struct map_info *map, struct flchip *chip, loff_t adr) +{ + __u16 status; + unsigned long timeo; + DECLARE_WAITQUEUE(wait, current); + + timeo = jiffies + HZ; + adr &= ~1; /* align 2 */ + +retry: + spin_lock_bh(chip->mutex); + + switch (chip->state) { + case FL_READY: + map->write16(map, CMD_READ_STATUS, adr); + chip->state = FL_STATUS; + case FL_STATUS: + status = map->read16(map, adr); + if ((status & STATUS_READY) != STATUS_READY) { + udelay(100); + } + break; + default: + printk("m5drv: waiting for chip\n"); + if (time_after(jiffies, timeo)) { /* jiffies is after timeo */ + set_current_state(TASK_INTERRUPTIBLE); + add_wait_queue(&chip->wq, &wait); + spin_unlock_bh(chip->mutex); + schedule(); + remove_wait_queue(&chip->wq, &wait); + spin_lock_bh(chip->mutex); // by takeo + if (signal_pending(current)) { + printk("m5drv: canceled\n"); + map->write16(map, CMD_CLEAR_STATUS, adr); + map->write16(map, CMD_READ_ARRAY, adr); + chip->state = FL_READY; + return -EINTR; + } + } + timeo = jiffies + HZ; + goto retry; + } + map->write16(map, CMD_READ_ARRAY, adr); + chip->state = FL_READY; + return 0; +} + +static void m5drv_release(struct flchip *chip) +{ + M5DRV_DEBUG(1, "m5drv_release\n"); + wake_up(&chip->wq); + spin_unlock_bh(chip->mutex); +} + +static int m5drv_read(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf) +{ + struct map_info *map = mtd->priv; + struct m5drv_info *m5drv = map->fldrv_priv; + int chipnum; + int ret; + + *retlen = 0; + + chipnum = (from >> m5drv->chipshift); + if (chipnum >= m5drv->numchips) { + printk("m5drv: out of chip number (%d)\n", chipnum); + return -EIO; + } + + /* We don't support erase suspend */ + ret = m5drv_wait(map, &m5drv->chips[chipnum], from); + if (ret < 0) return ret; + + map->copy_from(map, buf, from, len); + + m5drv_release(&m5drv->chips[chipnum]); + *retlen = len; + return 0; +} + +static int m5drv_read_oneblock(struct map_info *map, loff_t from) +{ + struct m5drv_info *m5drv = map->fldrv_priv; + int ofs; + int ret; + int blksize; + int chipnum; + + M5DRV_DEBUG(1, "m5drv_read_oneblock(0x%08x)\n", (u32)from); + chipnum = (from >> m5drv->chipshift); + blksize = m5drv_query_blksize(from); + ofs = (from & ~(blksize - 1)); + + ret = m5drv_wait(map, &m5drv->chips[chipnum], from); + if (ret < 0) return ret; + + map->copy_from(map, M5BUF, ofs, blksize); + + m5drv_release(&m5drv->chips[chipnum]); + return 0; +} + +static int m5drv_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf) +{ + struct map_info *map = mtd->priv; + struct m5drv_info *m5drv = map->fldrv_priv; + int ret = 0; + int blksize; + int chipnum; + int thislen; + + M5DRV_DEBUG(1, "m5drv_write(to=0x%08x, len=%d, buf=0x%08x\n", (u32)to, (u32)len, (u32)buf); + *retlen = 0; + blksize = m5drv_query_blksize(to); + chipnum = (to >> m5drv->chipshift); + + /* + * we does not support byte/word program yet. + */ + for (thislen = len; thislen > 0; thislen -= blksize) { + thislen = ((thislen >= blksize)? blksize:thislen); + ret = m5drv_write_oneblock(map, to, thislen, buf); + if (ret < 0) return ret; + to += blksize; + buf += blksize; + *retlen += thislen; + } + return 0; +} + +static int m5drv_write_oneblock(struct map_info *map, loff_t adr, size_t len, const u_char *buf) +{ + struct m5drv_info *m5drv = map->fldrv_priv; + int ofs; + int blksize; + int ret; + int chipnum; + int i; + + M5DRV_DEBUG(1, "m5drv_write_oneblock(0x%08x, %d)\n", (u32)adr, (u32)len); + chipnum = (adr >> m5drv->chipshift); + ret = m5drv_read_oneblock(map, adr); + if (ret < 0) return ret; + blksize = m5drv_query_blksize(adr); + ofs = (adr & (blksize - 1)); + adr = adr & ~(blksize - 1); + memcpy(M5BUF + ofs, buf, len); /* copy to block buffer */ +#if 0 /* + * FIXME: erasing is unnecessary. + */ + ret = m5drv_erase_oneblock(map, &m5drv->chips[chipnum], adr); + if (ret < 0) return ret; +#endif + for (i = 0; i < len; i += M5DRV_PAGE_SIZE) { + ret = m5drv_write_onepage(map, &m5drv->chips[chipnum], adr, M5BUF+i); + if (ret < 0) return ret; + adr += M5DRV_PAGE_SIZE; + } + return 0; +} + +static int m5drv_write_onepage(struct map_info *map, struct flchip *chip, unsigned long adr, const u_char *buf) +{ + int ret; + int i; + u_short data; + long padr; /* page address */ + u_short status; + int chipnum; + struct m5drv_info *m5drv = map->fldrv_priv; + + M5DRV_DEBUG(1, "m5drv_write_onepage(0x%08x, 0x%08x)\n", (u32)adr, (u32)buf); + padr = adr; + padr &= ~1; /* align 2 */ + chipnum = (adr >> m5drv->chipshift); + + ret = m5drv_wait(map, chip, padr); + if (ret < 0) return ret; + + map->write16(map, CMD_PROGRAM_PAGE, padr); + chip->state = FL_WRITING; + for (i = 0; i < M5DRV_PAGE_SIZE; i += map->buswidth) { + data = ((*buf << 8)| *(buf + 1)); + /* + * FIXME: convert be->le ? + */ + map->write16(map, data, adr); + adr += map->buswidth; + buf += map->buswidth; + } + + ret = m5drv_do_wait_for_ready(map, chip, padr); + if (ret < 0) { + m5drv_release(&m5drv->chips[chipnum]); + return ret; + } + + status = map->read16(map, padr); + if ((status & STATUS_READY) != STATUS_READY) { + printk("m5drv: error page writing at addr=0x%08x status=0x%08x\n", + (u32)padr, (u32)status); + map->write16(map, CMD_CLEAR_STATUS, padr); + } + map->write16(map, CMD_READ_ARRAY, padr); + chip->state = FL_READY; + m5drv_release(&m5drv->chips[chipnum]); + return 0; +} + +static int m5drv_erase(struct mtd_info *mtd, struct erase_info *instr) +{ + struct map_info *map = mtd->priv; + struct m5drv_info *m5drv = map->fldrv_priv; + unsigned long adr,len; + int chipnum, ret=0; + int erasesize = 0; + int i; + + M5DRV_DEBUG(2, "m5drv_erase(0x%08x)\n", instr->addr); + chipnum = instr->addr >> m5drv->chipshift; + if (chipnum >= m5drv->numchips) { + printk("m5drv: out of chip number (%d)\n", chipnum); + return -EIO; + } + adr = instr->addr & ((1<chipshift)-1); + len = instr->len; + if (mtd->numeraseregions == 0) { + erasesize = mtd->erasesize; + } else if (mtd->numeraseregions == 1) { + erasesize = mtd->eraseregions->erasesize; + } else { + for (i = 0; i < (mtd->numeraseregions - 1); i++) { + if (adr < mtd->eraseregions[i+1].offset) { + erasesize = mtd->eraseregions[i].erasesize; + break; + } + } + if (i == (mtd->numeraseregions - 1)) { /* last region */ + erasesize = mtd->eraseregions[i].erasesize; + } + } + M5DRV_DEBUG(2, "erasesize=%d, len=%ld\n", erasesize, len); + if (erasesize == 0) return -EINVAL; + if(instr->addr & (erasesize - 1)) + return -EINVAL; + if(instr->len & (erasesize - 1)) + return -EINVAL; + if(instr->len + instr->addr > mtd->size) + return -EINVAL; + + while (len) { + ret = m5drv_erase_oneblock(map, &m5drv->chips[chipnum], adr); + if (ret < 0) return ret; + + adr += erasesize; + len -= erasesize; + if(adr >> m5drv->chipshift){ + adr = 0; + chipnum++; + if(chipnum >= m5drv->numchips) + break; + } + } + instr->state = MTD_ERASE_DONE; + if(instr->callback) { + M5DRV_DEBUG(1, "m5drv: call callback\n"); + instr->callback(instr); + } + return 0; +} + +static int m5drv_do_wait_for_ready(struct map_info *map, struct flchip *chip, unsigned long adr) +{ + int ret; + int timeo; + u_short status; + DECLARE_WAITQUEUE(wait, current); + + /* unnecessary CMD_READ_STATUS */ +/* + map->write16(map, CMD_READ_STATUS, adr); + status = map->read16(map, adr); +*/ + + timeo = jiffies + HZ; + + while (time_before(jiffies, timeo)) { +/* + map->write16(map, CMD_READ_STATUS, adr); +*/ + status = map->read16(map, adr); + if ((status & STATUS_READY) == STATUS_READY) { + M5DRV_DEBUG(1, "m5drv_wait_for_ready: ok, ready\n"); + /* + * FIXME: do full status check + */ + ret = 0; + goto out; + } + set_current_state(TASK_INTERRUPTIBLE); + add_wait_queue(&chip->wq, &wait); + + // enabled by takeo + spin_unlock_bh(chip->mutex); + + schedule_timeout(1); + schedule(); + remove_wait_queue(&chip->wq, &wait); + + // enabled by takeo + spin_lock_bh(chip->mutex); + + if (signal_pending(current)) { + ret = -EINTR; + goto out; + } + //timeo = jiffies + HZ; + } + ret = -ETIME; +out: + if (ret < 0) { + map->write16(map, CMD_CLEAR_STATUS, adr); + map->write16(map, CMD_READ_ARRAY, adr); + chip->state = FL_READY; + } + return ret; +} + +static int m5drv_erase_oneblock(struct map_info *map, struct flchip *chip, unsigned long adr) +{ + int ret; + u_short status; + struct m5drv_info *m5drv = map->fldrv_priv; + int chipnum; + + M5DRV_DEBUG(1, "m5drv_erase_oneblock()\n"); + +#ifdef UNLOCK_BEFORE_ERASE + m5drv_unlock_oneblock(map, chip, adr); +#endif + + chipnum = (adr >> m5drv->chipshift); + adr &= ~1; /* align 2 */ + + ret = m5drv_wait(map, chip, adr); + if (ret < 0) return ret; + + map->write16(map, CMD_BLOCK_ERASE, adr); + map->write16(map, CMD_CONFIRM, adr); + chip->state = FL_ERASING; + + ret = m5drv_do_wait_for_ready(map, chip, adr); + if(ret < 0) { + m5drv_release(&m5drv->chips[chipnum]); + return ret; + } + + status = map->read16(map, adr); + if ((status & STATUS_READY) == STATUS_READY) { + M5DRV_DEBUG(1, "m5drv: erase completed status=%04x\n", status); + map->write16(map, CMD_READ_ARRAY, adr); + chip->state = FL_READY; + m5drv_release(&m5drv->chips[chipnum]); + return 0; /* ok, erasing completed */ + } + + printk("m5drv: error erasing block at addr=%08lx status=%08x\n", + adr,status); + map->write16(map, CMD_READ_ARRAY, adr); /* cancel erasing */ + chip->state = FL_READY; + m5drv_release(&m5drv->chips[chipnum]); + return -EIO; +} + + +#ifdef UNLOCK_BEFORE_ERASE +/* + * we don't support unlock yet + */ +static void m5drv_unlock_oneblock(struct map_info *map, struct flchip *chip, unsigned long adr) +{ + M5DRV_DEBUG(1, "m5drv_unlock_oneblock\n"); +} +#endif + +static void m5drv_sync(struct mtd_info *mtd) +{ + M5DRV_DEBUG(1, "m5drv_sync()\n"); +} + +static int m5drv_suspend(struct mtd_info *mtd) +{ + M5DRV_DEBUG(1, "m5drv_suspend()\n"); + return -EINVAL; +} + +static void m5drv_resume(struct mtd_info *mtd) +{ + M5DRV_DEBUG(1, "m5drv_resume()\n"); +} + +static void m5drv_destroy(struct mtd_info *mtd) +{ + M5DRV_DEBUG(1, "m5drv_destroy()\n"); +} + +int __init m5drv_probe_init(void) +{ + printk("MTD chip driver\n"); + register_mtd_chip_driver(&m5drv_chipdrv); + return 0; +} + +static void __exit m5drv_probe_exit(void) +{ + M5DRV_DEBUG(1, "m5drv_probe_exit()\n"); + unregister_mtd_chip_driver(&m5drv_chipdrv); +} + +module_init(m5drv_probe_init); +module_exit(m5drv_probe_exit); + +MODULE_AUTHOR("Takeo Takahashi"); +MODULE_DESCRIPTION("MTD chip driver for M5M29GT320VP"); +MODULE_LICENSE("GPL"); +EXPORT_NO_SYMBOLS; diff -Nru a/arch/m32r/kernel/Makefile b/arch/m32r/kernel/Makefile --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/Makefile 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,20 @@ +# +# Makefile for the Linux/M32R kernel. +# + +extra-y := head.o init_task.o vmlinux.lds + +obj-y := process.o entry.o traps.o align.o irq.o setup.o time.o \ + m32r_ksyms.o sys_m32r.o semaphore.o signal.o ptrace.o + +obj-$(CONFIG_SMP) += smp.o smpboot.o +obj-$(CONFIG_PLAT_MAPPI) += setup_mappi.o io_mappi.o +obj-$(CONFIG_PLAT_MAPPI2) += setup_mappi2.o io_mappi2.o +obj-$(CONFIG_PLAT_USRV) += setup_usrv.o io_usrv.o +obj-$(CONFIG_PLAT_M32700UT) += setup_m32700ut.o io_m32700ut.o +obj-$(CONFIG_PLAT_OPSPUT) += setup_opsput.o io_opsput.o +obj-$(CONFIG_MODULES) += module.o +obj-$(CONFIG_PLAT_OAKS32R) += setup_oaks32r.o io_oaks32r.o + +EXTRA_AFLAGS := -traditional + diff -Nru a/arch/m32r/kernel/align.c b/arch/m32r/kernel/align.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/align.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,585 @@ +/* + * align.c - address exception handler for M32R + * + * Copyright (c) 2003 Hitoshi Yamamoto + */ + +#include +#include +#include + +static int get_reg(struct pt_regs *regs, int nr) +{ + int val; + + if (nr < 4) + val = *(unsigned long *)(®s->r0 + nr); + else if (nr < 7) + val = *(unsigned long *)(®s->r4 + (nr - 4)); + else if (nr < 13) + val = *(unsigned long *)(®s->r7 + (nr - 7)); + else + val = *(unsigned long *)(®s->fp + (nr - 13)); + + return val; +} + +static void set_reg(struct pt_regs *regs, int nr, int val) +{ + if (nr < 4) + *(unsigned long *)(®s->r0 + nr) = val; + else if (nr < 7) + *(unsigned long *)(®s->r4 + (nr - 4)) = val; + else if (nr < 13) + *(unsigned long *)(®s->r7 + (nr - 7)) = val; + else + *(unsigned long *)(®s->fp + (nr - 13)) = val; +} + +#define REG1(insn) (((insn) & 0x0f00) >> 8) +#define REG2(insn) ((insn) & 0x000f) +#define PSW_BC 0x100 + +/* O- instruction */ +#define ISA_LD1 0x20c0 /* ld Rdest, @Rsrc */ +#define ISA_LD2 0x20e0 /* ld Rdest, @Rsrc+ */ +#define ISA_LDH 0x20a0 /* ldh Rdest, @Rsrc */ +#define ISA_LDUH 0x20b0 /* lduh Rdest, @Rsrc */ +#define ISA_ST1 0x2040 /* st Rsrc1, @Rsrc2 */ +#define ISA_ST2 0x2060 /* st Rsrc1, @+Rsrc2 */ +#define ISA_ST3 0x2070 /* st Rsrc1, @-Rsrc2 */ +#define ISA_STH1 0x2020 /* sth Rsrc1, @Rsrc2 */ +#define ISA_STH2 0x2030 /* sth Rsrc1, @Rsrc2+ */ + +#ifdef CONFIG_ISA_DUAL_ISSUE + +/* OS instruction */ +#define ISA_ADD 0x00a0 /* add Rdest, Rsrc */ +#define ISA_ADDI 0x4000 /* addi Rdest, #imm8 */ +#define ISA_ADDX 0x0090 /* addx Rdest, Rsrc */ +#define ISA_AND 0x00c0 /* and Rdest, Rsrc */ +#define ISA_CMP 0x0040 /* cmp Rsrc1, Rsrc2 */ +#define ISA_CMPEQ 0x0060 /* cmpeq Rsrc1, Rsrc2 */ +#define ISA_CMPU 0x0050 /* cmpu Rsrc1, Rsrc2 */ +#define ISA_CMPZ 0x0070 /* cmpz Rsrc */ +#define ISA_LDI 0x6000 /* ldi Rdest, #imm8 */ +#define ISA_MV 0x1080 /* mv Rdest, Rsrc */ +#define ISA_NEG 0x0030 /* neg Rdest, Rsrc */ +#define ISA_NOP 0x7000 /* nop */ +#define ISA_NOT 0x00b0 /* not Rdest, Rsrc */ +#define ISA_OR 0x00e0 /* or Rdest, Rsrc */ +#define ISA_SUB 0x0020 /* sub Rdest, Rsrc */ +#define ISA_SUBX 0x0010 /* subx Rdest, Rsrc */ +#define ISA_XOR 0x00d0 /* xor Rdest, Rsrc */ + +/* -S instruction */ +#define ISA_MUL 0x1060 /* mul Rdest, Rsrc */ +#define ISA_MULLO_A0 0x3010 /* mullo Rsrc1, Rsrc2, A0 */ +#define ISA_MULLO_A1 0x3090 /* mullo Rsrc1, Rsrc2, A1 */ +#define ISA_MVFACMI_A0 0x50f2 /* mvfacmi Rdest, A0 */ +#define ISA_MVFACMI_A1 0x50f6 /* mvfacmi Rdest, A1 */ + +static int emu_addi(unsigned short insn, struct pt_regs *regs) +{ + char imm = (char)(insn & 0xff); + int dest = REG1(insn); + int val; + + val = get_reg(regs, dest); + val += imm; + set_reg(regs, dest, val); + + return 0; +} + +static int emu_ldi(unsigned short insn, struct pt_regs *regs) +{ + char imm = (char)(insn & 0xff); + + set_reg(regs, REG1(insn), (int)imm); + + return 0; +} + +static int emu_add(unsigned short insn, struct pt_regs *regs) +{ + int dest = REG1(insn); + int src = REG2(insn); + int val; + + val = get_reg(regs, dest); + val += get_reg(regs, src); + set_reg(regs, dest, val); + + return 0; +} + +static int emu_addx(unsigned short insn, struct pt_regs *regs) +{ + int dest = REG1(insn); + unsigned int val, tmp; + + val = regs->psw & PSW_BC ? 1 : 0; + tmp = get_reg(regs, dest); + val += tmp; + val += (unsigned int)get_reg(regs, REG2(insn)); + set_reg(regs, dest, val); + + /* C bit set */ + if (val < tmp) + regs->psw |= PSW_BC; + else + regs->psw &= ~(PSW_BC); + + return 0; +} + +static int emu_and(unsigned short insn, struct pt_regs *regs) +{ + int dest = REG1(insn); + int val; + + val = get_reg(regs, dest); + val &= get_reg(regs, REG2(insn)); + set_reg(regs, dest, val); + + return 0; +} + +static int emu_cmp(unsigned short insn, struct pt_regs *regs) +{ + if (get_reg(regs, REG1(insn)) < get_reg(regs, REG2(insn))) + regs->psw |= PSW_BC; + else + regs->psw &= ~(PSW_BC); + + return 0; +} + +static int emu_cmpeq(unsigned short insn, struct pt_regs *regs) +{ + if (get_reg(regs, REG1(insn)) == get_reg(regs, REG2(insn))) + regs->psw |= PSW_BC; + else + regs->psw &= ~(PSW_BC); + + return 0; +} + +static int emu_cmpu(unsigned short insn, struct pt_regs *regs) +{ + if ((unsigned int)get_reg(regs, REG1(insn)) + < (unsigned int)get_reg(regs, REG2(insn))) + regs->psw |= PSW_BC; + else + regs->psw &= ~(PSW_BC); + + return 0; +} + +static int emu_cmpz(unsigned short insn, struct pt_regs *regs) +{ + if (!get_reg(regs, REG2(insn))) + regs->psw |= PSW_BC; + else + regs->psw &= ~(PSW_BC); + + return 0; +} + +static int emu_mv(unsigned short insn, struct pt_regs *regs) +{ + int val; + + val = get_reg(regs, REG2(insn)); + set_reg(regs, REG1(insn), val); + + return 0; +} + +static int emu_neg(unsigned short insn, struct pt_regs *regs) +{ + int val; + + val = get_reg(regs, REG2(insn)); + set_reg(regs, REG1(insn), 0 - val); + + return 0; +} + +static int emu_not(unsigned short insn, struct pt_regs *regs) +{ + int val; + + val = get_reg(regs, REG2(insn)); + set_reg(regs, REG1(insn), ~val); + + return 0; +} + +static int emu_or(unsigned short insn, struct pt_regs *regs) +{ + int dest = REG1(insn); + int val; + + val = get_reg(regs, dest); + val |= get_reg(regs, REG2(insn)); + set_reg(regs, dest, val); + + return 0; +} + +static int emu_sub(unsigned short insn, struct pt_regs *regs) +{ + int dest = REG1(insn); + int val; + + val = get_reg(regs, dest); + val -= get_reg(regs, REG2(insn)); + set_reg(regs, dest, val); + + return 0; +} + +static int emu_subx(unsigned short insn, struct pt_regs *regs) +{ + int dest = REG1(insn); + unsigned int val, tmp; + + val = tmp = get_reg(regs, dest); + val -= (unsigned int)get_reg(regs, REG2(insn)); + val -= regs->psw & PSW_BC ? 1 : 0; + set_reg(regs, dest, val); + + /* C bit set */ + if (val > tmp) + regs->psw |= PSW_BC; + else + regs->psw &= ~(PSW_BC); + + return 0; +} + +static int emu_xor(unsigned short insn, struct pt_regs *regs) +{ + int dest = REG1(insn); + unsigned int val; + + val = (unsigned int)get_reg(regs, dest); + val ^= (unsigned int)get_reg(regs, REG2(insn)); + set_reg(regs, dest, val); + + return 0; +} + +static int emu_mul(unsigned short insn, struct pt_regs *regs) +{ + int dest = REG1(insn); + int reg1, reg2; + + reg1 = get_reg(regs, dest); + reg2 = get_reg(regs, REG2(insn)); + + __asm__ __volatile__ ( + "mul %0, %1; \n\t" + : "+r" (reg1) : "r" (reg2) + ); + + set_reg(regs, dest, reg1); + + return 0; +} + +static int emu_mullo_a0(unsigned short insn, struct pt_regs *regs) +{ + int reg1, reg2; + + reg1 = get_reg(regs, REG1(insn)); + reg2 = get_reg(regs, REG2(insn)); + + __asm__ __volatile__ ( + "mullo %0, %1, a0; \n\t" + "mvfachi %0, a0; \n\t" + "mvfaclo %1, a0; \n\t" + : "+r" (reg1), "+r" (reg2) + ); + + regs->acc0h = reg1; + regs->acc0l = reg2; + + return 0; +} + +static int emu_mullo_a1(unsigned short insn, struct pt_regs *regs) +{ + int reg1, reg2; + + reg1 = get_reg(regs, REG1(insn)); + reg2 = get_reg(regs, REG2(insn)); + + __asm__ __volatile__ ( + "mullo %0, %1, a0; \n\t" + "mvfachi %0, a0; \n\t" + "mvfaclo %1, a0; \n\t" + : "+r" (reg1), "+r" (reg2) + ); + + regs->acc1h = reg1; + regs->acc1l = reg2; + + return 0; +} + +static int emu_mvfacmi_a0(unsigned short insn, struct pt_regs *regs) +{ + unsigned long val; + + val = (regs->acc0h << 16) | (regs->acc0l >> 16); + set_reg(regs, REG1(insn), (int)val); + + return 0; +} + +static int emu_mvfacmi_a1(unsigned short insn, struct pt_regs *regs) +{ + unsigned long val; + + val = (regs->acc1h << 16) | (regs->acc1l >> 16); + set_reg(regs, REG1(insn), (int)val); + + return 0; +} + +static int emu_m32r2(unsigned short insn, struct pt_regs *regs) +{ + int res = -1; + + if ((insn & 0x7fff) == ISA_NOP) /* nop */ + return 0; + + switch(insn & 0x7000) { + case ISA_ADDI: /* addi Rdest, #imm8 */ + res = emu_addi(insn, regs); + break; + case ISA_LDI: /* ldi Rdest, #imm8 */ + res = emu_ldi(insn, regs); + break; + default: + break; + } + + if (!res) + return 0; + + switch(insn & 0x70f0) { + case ISA_ADD: /* add Rdest, Rsrc */ + res = emu_add(insn, regs); + break; + case ISA_ADDX: /* addx Rdest, Rsrc */ + res = emu_addx(insn, regs); + break; + case ISA_AND: /* and Rdest, Rsrc */ + res = emu_and(insn, regs); + break; + case ISA_CMP: /* cmp Rsrc1, Rsrc2 */ + res = emu_cmp(insn, regs); + break; + case ISA_CMPEQ: /* cmpeq Rsrc1, Rsrc2 */ + res = emu_cmpeq(insn, regs); + break; + case ISA_CMPU: /* cmpu Rsrc1, Rsrc2 */ + res = emu_cmpu(insn, regs); + break; + case ISA_CMPZ: /* cmpz Rsrc */ + res = emu_cmpz(insn, regs); + break; + case ISA_MV: /* mv Rdest, Rsrc */ + res = emu_mv(insn, regs); + break; + case ISA_NEG: /* neg Rdest, Rsrc */ + res = emu_neg(insn, regs); + break; + case ISA_NOT: /* not Rdest, Rsrc */ + res = emu_not(insn, regs); + break; + case ISA_OR: /* or Rdest, Rsrc */ + res = emu_or(insn, regs); + break; + case ISA_SUB: /* sub Rdest, Rsrc */ + res = emu_sub(insn, regs); + break; + case ISA_SUBX: /* subx Rdest, Rsrc */ + res = emu_subx(insn, regs); + break; + case ISA_XOR: /* xor Rdest, Rsrc */ + res = emu_xor(insn, regs); + break; + case ISA_MUL: /* mul Rdest, Rsrc */ + res = emu_mul(insn, regs); + break; + case ISA_MULLO_A0: /* mullo Rsrc1, Rsrc2 */ + res = emu_mullo_a0(insn, regs); + break; + case ISA_MULLO_A1: /* mullo Rsrc1, Rsrc2 */ + res = emu_mullo_a1(insn, regs); + break; + default: + break; + } + + if (!res) + return 0; + + switch(insn & 0x70ff) { + case ISA_MVFACMI_A0: /* mvfacmi Rdest */ + res = emu_mvfacmi_a0(insn, regs); + break; + case ISA_MVFACMI_A1: /* mvfacmi Rdest */ + res = emu_mvfacmi_a1(insn, regs); + break; + default: + break; + } + + return res; +} + +#endif /* CONFIG_ISA_DUAL_ISSUE */ + +/* + * ld : ?010 dest 1100 src + * 0010 dest 1110 src : ld Rdest, @Rsrc+ + * ldh : ?010 dest 1010 src + * lduh : ?010 dest 1011 src + * st : ?010 src1 0100 src2 + * 0010 src1 0110 src2 : st Rsrc1, @+Rsrc2 + * 0010 src1 0111 src2 : st Rsrc1, @-Rsrc2 + * sth : ?010 src1 0010 src2 + */ + +static int insn_check(unsigned long insn, struct pt_regs *regs, + unsigned char **ucp) +{ + int res = 0; + + /* + * 32bit insn + * ld Rdest, @(disp16, Rsrc) + * st Rdest, @(disp16, Rsrc) + */ + if (insn & 0x80000000) { /* 32bit insn */ + *ucp += (short)(insn & 0x0000ffff); + regs->bpc += 4; + } else { /* 16bit insn */ +#ifdef CONFIG_ISA_DUAL_ISSUE + /* parallel exec check */ + if (!(regs->bpc & 0x2) && insn & 0x8000) { + res = emu_m32r2((unsigned short)insn, regs); + regs->bpc += 4; + } else +#endif /* CONFIG_ISA_DUAL_ISSUE */ + regs->bpc += 2; + } + + return res; +} + +static int emu_ld(unsigned long insn32, struct pt_regs *regs) +{ + unsigned char *ucp; + unsigned long val; + unsigned short insn16; + int size, src; + + insn16 = insn32 >> 16; + src = REG2(insn16); + ucp = (unsigned char *)get_reg(regs, src); + + if (insn_check(insn32, regs, &ucp)) + return -1; + + size = insn16 & 0x0040 ? 4 : 2; + if (copy_from_user(&val, ucp, size)) + return -1; + + if (size == 2) + val >>= 16; + + /* ldh sign check */ + if ((insn16 & 0x00f0) == 0x00a0 && (val & 0x8000)) + val |= 0xffff0000; + + set_reg(regs, REG1(insn16), val); + + /* ld increment check */ + if ((insn16 & 0xf0f0) == ISA_LD2) /* ld Rdest, @Rsrc+ */ + set_reg(regs, src, (unsigned long)(ucp + 4)); + + return 0; +} + +static int emu_st(unsigned long insn32, struct pt_regs *regs) +{ + unsigned char *ucp; + unsigned long val; + unsigned short insn16; + int size, src2; + + insn16 = insn32 >> 16; + src2 = REG2(insn16); + + ucp = (unsigned char *)get_reg(regs, src2); + + if (insn_check(insn32, regs, &ucp)) + return -1; + + size = insn16 & 0x0040 ? 4 : 2; + val = get_reg(regs, REG1(insn16)); + if (size == 2) + val <<= 16; + + /* st inc/dec check */ + if ((insn16 & 0xf0e0) == 0x2060) { + if (insn16 & 0x0010) + ucp -= 4; + else + ucp += 4; + + set_reg(regs, src2, (unsigned long)ucp); + } + + if (copy_to_user(ucp, &val, size)) + return -1; + + /* sth inc check */ + if ((insn16 & 0xf0f0) == ISA_STH2) { + ucp += 2; + set_reg(regs, src2, (unsigned long)ucp); + } + + return 0; +} + +int handle_unaligned_access(unsigned long insn32, struct pt_regs *regs) +{ + unsigned short insn16; + int res; + + insn16 = insn32 >> 16; + + /* ld or st check */ + if ((insn16 & 0x7000) != 0x2000) + return -1; + + /* insn alignment check */ + if ((insn16 & 0x8000) && (regs->bpc & 3)) + return -1; + + if (insn16 & 0x0080) /* ld */ + res = emu_ld(insn32, regs); + else /* st */ + res = emu_st(insn32, regs); + + return res; +} + diff -Nru a/arch/m32r/kernel/entry.S b/arch/m32r/kernel/entry.S --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/entry.S 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,997 @@ +/* + * linux/arch/m32r/kernel/entry.S + * + * Copyright (c) 2001, 2002 Hirokazu Takata, Hitoshi Yamamoto, H. Kondo + * Copyright (c) 2003 Hitoshi Yamamoto + * + * Taken from i386 version. + * Copyright (C) 1991, 1992 Linus Torvalds + */ + +/* + * entry.S contains the system-call and fault low-level handling routines. + * This also contains the timer-interrupt handler, as well as all interrupts + * and faults that can result in a task-switch. + * + * NOTE: This code handles signal-recognition, which happens every time + * after a timer-interrupt and after each system call. + * + * Stack layout in 'ret_from_system_call': + * ptrace needs to have all regs on the stack. + * if the order here is changed, it needs to be + * updated in fork.c:copy_process, signal.c:do_signal, + * ptrace.c and ptrace.h + * + * M32Rx/M32R2 M32R + * @(sp) - r4 ditto + * @(0x04,sp) - r5 ditto + * @(0x08,sp) - r6 ditto + * @(0x0c,sp) - *pt_regs ditto + * @(0x10,sp) - r0 ditto + * @(0x14,sp) - r1 ditto + * @(0x18,sp) - r2 ditto + * @(0x1c,sp) - r3 ditto + * @(0x20,sp) - r7 ditto + * @(0x24,sp) - r8 ditto + * @(0x28,sp) - r9 ditto + * @(0x2c,sp) - r10 ditto + * @(0x30,sp) - r11 ditto + * @(0x34,sp) - r12 ditto + * @(0x38,sp) - syscall_nr ditto + * @(0x3c,sp) - acc0h @(0x3c,sp) - acch + * @(0x40,sp) - acc0l @(0x40,sp) - accl + * @(0x44,sp) - acc1h @(0x44,sp) - psw + * @(0x48,sp) - acc1l @(0x48,sp) - bpc + * @(0x4c,sp) - psw @(0x4c,sp) - bbpsw + * @(0x50,sp) - bpc @(0x50,sp) - bbpc + * @(0x54,sp) - bbpsw @(0x54,sp) - spu (cr3) + * @(0x58,sp) - bbpc @(0x58,sp) - fp (r13) + * @(0x5c,sp) - spu (cr3) @(0x5c,sp) - lr (r14) + * @(0x60,sp) - fp (r13) @(0x60,sp) - spi (cr12) + * @(0x64,sp) - lr (r14) @(0x64,sp) - orig_r0 + * @(0x68,sp) - spi (cr2) + * @(0x6c,sp) - orig_r0 + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if !defined(CONFIG_MMU) +#define sys_madvise sys_ni_syscall +#define sys_readahead sys_ni_syscall +#define sys_mprotect sys_ni_syscall +#define sys_msync sys_ni_syscall +#define sys_mlock sys_ni_syscall +#define sys_munlock sys_ni_syscall +#define sys_mlockall sys_ni_syscall +#define sys_munlockall sys_ni_syscall +#define sys_mremap sys_ni_syscall +#define sys_mincore sys_ni_syscall +#endif /* CONFIG_MMU */ + +#define R4(reg) @reg +#define R5(reg) @(0x04,reg) +#define R6(reg) @(0x08,reg) +#define PTREGS(reg) @(0x0C,reg) +#define R0(reg) @(0x10,reg) +#define R1(reg) @(0x14,reg) +#define R2(reg) @(0x18,reg) +#define R3(reg) @(0x1C,reg) +#define R7(reg) @(0x20,reg) +#define R8(reg) @(0x24,reg) +#define R9(reg) @(0x28,reg) +#define R10(reg) @(0x2C,reg) +#define R11(reg) @(0x30,reg) +#define R12(reg) @(0x34,reg) +#define SYSCALL_NR(reg) @(0x38,reg) +#if defined(CONFIG_ISA_M32R2) && defined(CONFIG_ISA_DSP_LEVEL2) +#define ACC0H(reg) @(0x3C,reg) +#define ACC0L(reg) @(0x40,reg) +#define ACC1H(reg) @(0x44,reg) +#define ACC1L(reg) @(0x48,reg) +#define PSW(reg) @(0x4C,reg) +#define BPC(reg) @(0x50,reg) +#define BBPSW(reg) @(0x54,reg) +#define BBPC(reg) @(0x58,reg) +#define SPU(reg) @(0x5C,reg) +#define FP(reg) @(0x60,reg) /* FP = R13 */ +#define LR(reg) @(0x64,reg) +#define SP(reg) @(0x68,reg) +#define ORIG_R0(reg) @(0x6C,reg) +#elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R) +#define ACCH(reg) @(0x3C,reg) +#define ACCL(reg) @(0x40,reg) +#define PSW(reg) @(0x44,reg) +#define BPC(reg) @(0x48,reg) +#define BBPSW(reg) @(0x4C,reg) +#define BBPC(reg) @(0x50,reg) +#define SPU(reg) @(0x54,reg) +#define FP(reg) @(0x58,reg) /* FP = R13 */ +#define LR(reg) @(0x5C,reg) +#define SP(reg) @(0x60,reg) +#define ORIG_R0(reg) @(0x64,reg) +#else +#error unknown isa configuration +#endif + +CF_MASK = 0x00000001 +TF_MASK = 0x00000100 +IF_MASK = 0x00000200 +DF_MASK = 0x00000400 +NT_MASK = 0x00004000 +VM_MASK = 0x00020000 + +#ifdef CONFIG_PREEMPT +#define preempt_stop(x) CLI(x) +#else +#define preempt_stop(x) +#define resume_kernel restore_all +#endif + +ENTRY(ret_from_fork) + ld r0, @sp+ + bl schedule_tail + GET_THREAD_INFO(r8) + bra syscall_exit + +/* + * Return to user mode is not as complex as all this looks, + * but we want the default path for a system call return to + * go as quickly as possible which is why some of this is + * less clear than it otherwise should be. + */ + + ; userspace resumption stub bypassing syscall exit tracing + ALIGN +ret_from_exception: + preempt_stop(r4) +ret_from_intr: + ld r4, PSW(sp) +#ifdef CONFIG_ISA_M32R2 + and3 r4, r4, #0x8800 ; check BSM and BPM bits +#else + and3 r4, r4, #0x8000 ; check BSM bit +#endif + beqz r4, resume_kernel +ENTRY(resume_userspace) + CLI(r4) ; make sure we don't miss an interrupt + ; setting need_resched or sigpending + ; between sampling and the iret + GET_THREAD_INFO(r8) + ld r9, @(TI_FLAGS, r8) + and3 r4, r9, #_TIF_WORK_MASK ; is there any work to be done on + ; int/exception return? + bnez r4, work_pending + bra restore_all + +#ifdef CONFIG_PREEMPT +ENTRY(resume_kernel) + GET_THREAD_INFO(r8) + ld r9, @(TI_PRE_COUNT, r8) ; non-zero preempt_count ? + bnez r9, restore_all +need_resched: + ld r9, @(TI_FLAGS, r8) ; need_resched set ? + and3 r4, r9, #_TIF_NEED_RESCHED + beqz r4, restore_all + ld r4, PSW(sp) ; interrupts off (exception path) ? + and3 r4, r4, #0x4000 + beqz r4, restore_all + LDIMM (r4, PREEMPT_ACTIVE) + st r4, @(TI_PRE_COUNT, r8) + STI(r4) + bl schedule + ldi r4, #0 + st r4, @(TI_PRE_COUNT, r8) + CLI(r4) + bra need_resched +#endif + + ; system call handler stub +ENTRY(system_call) + SWITCH_TO_KERNEL_STACK + SAVE_ALL + STI(r4) ; Enable interrupt + st sp, PTREGS(sp) ; implicit pt_regs parameter + cmpui r7, #NR_syscalls + bnc syscall_badsys + st r7, SYSCALL_NR(sp) ; syscall_nr + ; system call tracing in operation + GET_THREAD_INFO(r8) + ld r9, @(TI_FLAGS, r8) + and3 r4, r9, #_TIF_SYSCALL_TRACE + bnez r4, syscall_trace_entry +syscall_call: + slli r7, #2 ; table jump for the system call + LDIMM (r4, sys_call_table) + add r7, r4 + ld r7, @r7 + jl r7 ; execute system call + st r0, R0(sp) ; save the return value +syscall_exit: + CLI(r4) ; make sure we don't miss an interrupt + ; setting need_resched or sigpending + ; between sampling and the iret + ld r9, @(TI_FLAGS, r8) + and3 r4, r9, #_TIF_ALLWORK_MASK ; current->work + bnez r4, syscall_exit_work +restore_all: + RESTORE_ALL + + # perform work that needs to be done immediately before resumption + # r9 : frags + ALIGN +work_pending: + and3 r4, r9, #_TIF_NEED_RESCHED + beqz r4, work_notifysig +work_resched: + bl schedule + CLI(r4) ; make sure we don't miss an interrupt + ; setting need_resched or sigpending + ; between sampling and the iret + ld r9, @(TI_FLAGS, r8) + and3 r4, r9, #_TIF_WORK_MASK ; is there any work to be done other + ; than syscall tracing? + beqz r4, restore_all + and3 r4, r4, #_TIF_NEED_RESCHED + bnez r4, work_resched + +work_notifysig: ; deal with pending signals and + ; notify-resume requests + mv r0, sp ; arg1 : struct pt_regs *regs + ldi r1, #0 ; arg2 : sigset_t *oldset + mv r2, r9 ; arg3 : __u32 thread_info_flags + bl do_notify_resume + bra restore_all + + ; perform syscall exit tracing + ALIGN +syscall_trace_entry: + ldi r4, #-ENOSYS + st r4, R0(sp) + bl do_syscall_trace + ld r0, ORIG_R0(sp) + ld r1, R1(sp) + ld r2, R2(sp) + ld r3, R3(sp) + ld r4, R4(sp) + ld r5, R5(sp) + ld r6, R6(sp) + ld r7, SYSCALL_NR(sp) + cmpui r7, #NR_syscalls + bc syscall_call + bra syscall_exit + + ; perform syscall exit tracing + ALIGN +syscall_exit_work: + ld r9, @(TI_FLAGS, r8) + and3 r4, r9, #_TIF_SYSCALL_TRACE + beqz r4, work_pending + STI(r4) ; could let do_syscall_trace() call + ; schedule() instead + bl do_syscall_trace + bra resume_userspace + + ALIGN +syscall_fault: + SAVE_ALL + GET_THREAD_INFO(r8) + ldi r4, #-EFAULT + st r4, R0(sp) + bra resume_userspace + + ALIGN +syscall_badsys: + ldi r4, #-ENOSYS + st r4, R0(sp) + bra resume_userspace + + .global eit_vector + + .equ ei_vec_table, eit_vector + 0x0200 + +/* + * EI handler routine + */ +ENTRY(ei_handler) +#if defined(CONFIG_CHIP_M32700) + SWITCH_TO_KERNEL_STACK + ; WORKAROUND: force to clear SM bit and use the kernel stack (SPI). +#endif + SAVE_ALL + mv r1, sp ; arg1(regs) +#if defined(CONFIG_CHIP_VDEC2) || defined(CONFIG_CHIP_XNUX2) \ + || defined(CONFIG_CHIP_M32700) || defined(CONFIG_CHIP_M32102) \ + || defined(CONFIG_CHIP_OPSP) + +; GET_ICU_STATUS; + seth r0, #shigh(M32R_ICU_ISTS_ADDR) + ld r0, @(low(M32R_ICU_ISTS_ADDR),r0) + st r0, @-sp +#if defined(CONFIG_SMP) + /* + * If IRQ == 0 --> Nothing to do, Not write IMASK + * If IRQ == IPI --> Do IPI handler, Not write IMASK + * If IRQ != 0, IPI --> Do do_IRQ(), Write IMASK + */ + slli r0, #4 + srli r0, #24 ; r0(irq_num<<2) + ;; IRQ exist check +#if defined(CONFIG_CHIP_M32700) + /* WORKAROUND: IMASK bug M32700-TS1, TS2 chip. */ + beqz r0, 3f ; if (!irq_num) goto exit +#else + beqz r0, 1f ; if (!irq_num) goto exit +#endif /* WORKAROUND */ + ;; IPI check + cmpi r0, #(M32R_IRQ_IPI0<<2) ; ISN < IPI0 check + bc 2f + cmpi r0, #((M32R_IRQ_IPI7+1)<<2) ; ISN > IPI7 check + bnc 2f + LDIMM (r2, ei_vec_table) + add r2, r0 + ld r2, @r2 + beqz r2, 1f ; if (no IPI handler) goto exit + mv r0, r1 ; arg0(regs) + jl r2 + .fillinsn +1: + addi sp, #4 + bra ret_to_intr +#if defined(CONFIG_CHIP_M32700) + /* WORKAROUND: IMASK bug M32700-TS1, TS2 chip. */ + .fillinsn +3: + ld24 r14, #0x00070000 + seth r0, #shigh(M32R_ICU_IMASK_ADDR) + st r14, @(low(M32R_ICU_IMASK_ADDR), r0) + addi sp, #4 + bra ret_to_intr +#endif /* WORKAROUND */ + ;; do_IRQ + .fillinsn +2: + srli r0, #2 +#if defined(CONFIG_PLAT_USRV) + add3 r2, r0, #-(M32R_IRQ_INT1) ; INT1# interrupt + bnez r2, 9f + ; read ICU status register of PLD + seth r0, #high(PLD_ICUISTS) + or3 r0, r0, #low(PLD_ICUISTS) + lduh r0, @r0 + slli r0, #21 + srli r0, #27 ; ISN + addi r0, #(M32700UT_PLD_IRQ_BASE) + .fillinsn +9: +#elif defined(CONFIG_PLAT_M32700UT) + add3 r2, r0, #-(M32R_IRQ_INT1) ; INT1# interrupt + bnez r2, check_int0 + ; read ICU status register of PLD + seth r0, #high(PLD_ICUISTS) + or3 r0, r0, #low(PLD_ICUISTS) + lduh r0, @r0 + slli r0, #21 + srli r0, #27 ; ISN + addi r0, #(M32700UT_PLD_IRQ_BASE) + bra check_end + .fillinsn +check_int0: + add3 r2, r0, #-(M32R_IRQ_INT0) ; INT0# interrupt + bnez r2, check_int2 + ; read ICU status of LAN-board + seth r0, #high(M32700UT_LAN_ICUISTS) + or3 r0, r0, #low(M32700UT_LAN_ICUISTS) + lduh r0, @r0 + slli r0, #21 + srli r0, #27 ; ISN + add3 r0, r0, #(M32700UT_LAN_PLD_IRQ_BASE) + bra check_end + .fillinsn +check_int2: + add3 r2, r0, #-(M32R_IRQ_INT2) ; INT2# interrupt + bnez r2, check_end + ; read ICU status of LCD-board + seth r0, #high(M32700UT_LCD_ICUISTS) + or3 r0, r0, #low(M32700UT_LCD_ICUISTS) + lduh r0, @r0 + slli r0, #21 + srli r0, #27 ; ISN + add3 r0, r0, #(M32700UT_LCD_PLD_IRQ_BASE) + bra check_end + .fillinsn +check_end: +#elif defined(CONFIG_PLAT_OPSPUT) + add3 r2, r0, #-(M32R_IRQ_INT1) ; INT1# interrupt + bnez r2, check_int0 + ; read ICU status register of PLD + seth r0, #high(PLD_ICUISTS) + or3 r0, r0, #low(PLD_ICUISTS) + lduh r0, @r0 + slli r0, #21 + srli r0, #27 ; ISN + addi r0, #(OPSPUT_PLD_IRQ_BASE) + bra check_end + .fillinsn +check_int0: + add3 r2, r0, #-(M32R_IRQ_INT0) ; INT0# interrupt + bnez r2, check_int2 + ; read ICU status of LAN-board + seth r0, #high(OPSPUT_LAN_ICUISTS) + or3 r0, r0, #low(OPSPUT_LAN_ICUISTS) + lduh r0, @r0 + slli r0, #21 + srli r0, #27 ; ISN + add3 r0, r0, #(OPSPUT_LAN_PLD_IRQ_BASE) + bra check_end + .fillinsn +check_int2: + add3 r2, r0, #-(M32R_IRQ_INT2) ; INT2# interrupt + bnez r2, check_end + ; read ICU status of LCD-board + seth r0, #high(OPSPUT_LCD_ICUISTS) + or3 r0, r0, #low(OPSPUT_LCD_ICUISTS) + lduh r0, @r0 + slli r0, #21 + srli r0, #27 ; ISN + add3 r0, r0, #(OPSPUT_LCD_PLD_IRQ_BASE) + bra check_end + .fillinsn +check_end: +#endif /* CONFIG_PLAT_OPSPUT */ + bl do_IRQ ; r0(irq), r1(regs) +#else /* not CONFIG_SMP */ + srli r0, #22 ; r0(irq) +#if defined(CONFIG_PLAT_USRV) + add3 r2, r0, #-(M32R_IRQ_INT1) ; INT1# interrupt + bnez r2, 1f + ; read ICU status register of PLD + seth r0, #high(PLD_ICUISTS) + or3 r0, r0, #low(PLD_ICUISTS) + lduh r0, @r0 + slli r0, #21 + srli r0, #27 ; ISN + addi r0, #(M32700UT_PLD_IRQ_BASE) + .fillinsn +1: +#elif defined(CONFIG_PLAT_M32700UT) + add3 r2, r0, #-(M32R_IRQ_INT1) ; INT1# interrupt + bnez r2, check_int0 + ; read ICU status register of PLD + seth r0, #high(PLD_ICUISTS) + or3 r0, r0, #low(PLD_ICUISTS) + lduh r0, @r0 + slli r0, #21 + srli r0, #27 ; ISN + addi r0, #(M32700UT_PLD_IRQ_BASE) + bra check_end + .fillinsn +check_int0: + add3 r2, r0, #-(M32R_IRQ_INT0) ; INT0# interrupt + bnez r2, check_int2 + ; read ICU status of LAN-board + seth r0, #high(M32700UT_LAN_ICUISTS) + or3 r0, r0, #low(M32700UT_LAN_ICUISTS) + lduh r0, @r0 + slli r0, #21 + srli r0, #27 ; ISN + add3 r0, r0, #(M32700UT_LAN_PLD_IRQ_BASE) + bra check_end + .fillinsn +check_int2: + add3 r2, r0, #-(M32R_IRQ_INT2) ; INT2# interrupt + bnez r2, check_end + ; read ICU status of LCD-board + seth r0, #high(M32700UT_LCD_ICUISTS) + or3 r0, r0, #low(M32700UT_LCD_ICUISTS) + lduh r0, @r0 + slli r0, #21 + srli r0, #27 ; ISN + add3 r0, r0, #(M32700UT_LCD_PLD_IRQ_BASE) + bra check_end + .fillinsn +check_end: +#elif defined(CONFIG_PLAT_OPSPUT) + add3 r2, r0, #-(M32R_IRQ_INT1) ; INT1# interrupt + bnez r2, check_int0 + ; read ICU status register of PLD + seth r0, #high(PLD_ICUISTS) + or3 r0, r0, #low(PLD_ICUISTS) + lduh r0, @r0 + slli r0, #21 + srli r0, #27 ; ISN + addi r0, #(OPSPUT_PLD_IRQ_BASE) + bra check_end + .fillinsn +check_int0: + add3 r2, r0, #-(M32R_IRQ_INT0) ; INT0# interrupt + bnez r2, check_int2 + ; read ICU status of LAN-board + seth r0, #high(OPSPUT_LAN_ICUISTS) + or3 r0, r0, #low(OPSPUT_LAN_ICUISTS) + lduh r0, @r0 + slli r0, #21 + srli r0, #27 ; ISN + add3 r0, r0, #(OPSPUT_LAN_PLD_IRQ_BASE) + bra check_end + .fillinsn +check_int2: + add3 r2, r0, #-(M32R_IRQ_INT2) ; INT2# interrupt + bnez r2, check_end + ; read ICU status of LCD-board + seth r0, #high(OPSPUT_LCD_ICUISTS) + or3 r0, r0, #low(OPSPUT_LCD_ICUISTS) + lduh r0, @r0 + slli r0, #21 + srli r0, #27 ; ISN + add3 r0, r0, #(OPSPUT_LCD_PLD_IRQ_BASE) + bra check_end + .fillinsn +check_end: +#endif /* CONFIG_PLAT_OPSPUT */ + bl do_IRQ +#endif /* CONFIG_SMP */ + ld r14, @sp+ + seth r0, #shigh(M32R_ICU_IMASK_ADDR) + st r14, @(low(M32R_ICU_IMASK_ADDR),r0) +#else +#error no chip configuration +#endif +ret_to_intr: + bra ret_from_intr + +/* + * Default EIT handler + */ + ALIGN +int_msg: + .asciz "Unknown interrupt\n" + .byte 0 + +ENTRY(default_eit_handler) + push r0 + mvfc r0, psw + push r1 + push r2 + push r3 + push r0 + LDIMM (r0, __KERNEL_DS) + mv r0, r1 + mv r0, r2 + LDIMM (r0, int_msg) + bl printk + pop r0 + pop r3 + pop r2 + pop r1 + mvtc r0, psw + pop r0 +infinit: + bra infinit + +#ifdef CONFIG_MMU +/* + * Access Exception handler + */ +ENTRY(ace_handler) + SWITCH_TO_KERNEL_STACK + SAVE_ALL + + seth r2, #shigh(MMU_REG_BASE) /* Check status register */ + ld r4, @(low(MESTS_offset),r2) + st r4, @(low(MESTS_offset),r2) + srl3 r1, r4, #4 +#ifdef CONFIG_CHIP_M32700 + and3 r1, r1, #0x0000ffff + ; WORKAROUND: ignore TME bit for the M32700(TS1). +#endif /* CONFIG_CHIP_M32700 */ + beqz r1, inst +oprand: + ld r2, @(low(MDEVA_offset),r2) ; set address + srli r2, #12 + slli r2, #12 + srli r1, #1 + bra 1f +inst: + and3 r1, r4, #2 + srli r1, #1 + or3 r1, r1, #8 + mvfc r2, bpc ; set address + .fillinsn +1: + mvfc r3, psw + mv r0, sp + and3 r3, r3, 0x800 + srli r3, #9 + or r1, r3 + /* + * do_page_fault(): + * r0 : struct pt_regs *regs + * r1 : unsigned long error-code + * r2 : unsigned long address + * error-code: + * +------+------+------+------+ + * | bit3 | bit2 | bit1 | bit0 | + * +------+------+------+------+ + * bit 3 == 0:means data, 1:means instruction + * bit 2 == 0:means kernel, 1:means user-mode + * bit 1 == 0:means read, 1:means write + * bit 0 == 0:means no page found 1:means protection fault + * + */ + bl do_page_fault + bra ret_from_intr +#endif /* CONFIG_MMU */ + + +ENTRY(alignment_check) +/* void alignment_check(int error_code) */ + SWITCH_TO_KERNEL_STACK + SAVE_ALL + ldi r1, #0x30 ; error_code + mv r0, sp ; pt_regs + bl do_alignment_check +error_code: + bra ret_from_exception + +ENTRY(rie_handler) +/* void rie_handler(int error_code) */ + SWITCH_TO_KERNEL_STACK + SAVE_ALL + mvfc r0, bpc + ld r1, @r0 + seth r0, #0xa0f0 + st r1, @r0 + ldi r1, #0x20 ; error_code + mv r0, sp ; pt_regs + bl do_rie_handler + bra error_code + +ENTRY(pie_handler) +/* void pie_handler(int error_code) */ + SWITCH_TO_KERNEL_STACK + SAVE_ALL + ldi r1, #0 ; error_code ; FIXME + mv r0, sp ; pt_regs + bl do_pie_handler + bra error_code + +ENTRY(debug_trap) + .global withdraw_debug_trap + /* void debug_trap(void) */ + SWITCH_TO_KERNEL_STACK + SAVE_ALL + mv r0, sp ; pt_regs + bl withdraw_debug_trap + ldi r1, #0 ; error_code + mv r0, sp ; pt_regs + bl do_debug_trap + bra error_code + + +/* Cache flushing handler */ +ENTRY(cache_flushing_handler) + .global _flush_cache_all + /* void _flush_cache_all(void); */ + SWITCH_TO_KERNEL_STACK + push r0 + push r1 + push r2 + push r3 + push r4 + push r5 + push r6 + push r7 + push lr + bl _flush_cache_all + pop lr + pop r7 + pop r6 + pop r5 + pop r4 + pop r3 + pop r2 + pop r1 + pop r0 + rte + +.data +ENTRY(sys_call_table) + .long sys_restart_syscall /* 0 - old "setup()" system call*/ + .long sys_exit + .long sys_fork + .long sys_read + .long sys_write + .long sys_open /* 5 */ + .long sys_close + .long sys_waitpid + .long sys_creat + .long sys_link + .long sys_unlink /* 10 */ + .long sys_execve + .long sys_chdir + .long sys_time + .long sys_mknod + .long sys_chmod /* 15 */ + .long sys_lchown + .long sys_ni_syscall /* old break syscall holder */ + .long sys_stat + .long sys_lseek + .long sys_getpid /* 20 */ + .long sys_mount + .long sys_oldumount + .long sys_setuid + .long sys_getuid + .long sys_stime /* 25 */ + .long sys_ptrace + .long sys_alarm + .long sys_fstat + .long sys_pause + .long sys_utime /* 30 */ + .long sys_cacheflush /* for M32R */ /* old stty syscall holder */ + .long sys_cachectl /* for M32R */ /* old gtty syscall holder */ + .long sys_access + .long sys_nice + .long sys_ni_syscall /* 35 - old ftime syscall holder */ + .long sys_sync + .long sys_kill + .long sys_rename + .long sys_mkdir + .long sys_rmdir /* 40 */ + .long sys_dup + .long sys_pipe + .long sys_times + .long sys_ni_syscall /* old prof syscall holder */ + .long sys_brk /* 45 */ + .long sys_setgid + .long sys_getgid + .long sys_signal + .long sys_geteuid + .long sys_getegid /* 50 */ + .long sys_acct + .long sys_umount /* recycled never used phys() */ + .long sys_ni_syscall /* old lock syscall holder */ + .long sys_ioctl + .long sys_fcntl /* 55 */ + .long sys_ni_syscall /* old mpx syscall holder */ + .long sys_setpgid + .long sys_ni_syscall /* old ulimit syscall holder */ + .long sys_ni_syscall /* sys_olduname */ + .long sys_umask /* 60 */ + .long sys_chroot + .long sys_ustat + .long sys_dup2 + .long sys_getppid + .long sys_getpgrp /* 65 */ + .long sys_setsid + .long sys_sigaction + .long sys_sgetmask + .long sys_ssetmask + .long sys_setreuid /* 70 */ + .long sys_setregid + .long sys_sigsuspend + .long sys_sigpending + .long sys_sethostname + .long sys_setrlimit /* 75 */ + .long sys_getrlimit + .long sys_getrusage + .long sys_gettimeofday + .long sys_settimeofday + .long sys_getgroups /* 80 */ + .long sys_setgroups + .long sys_ni_syscall /* sys_oldselect */ + .long sys_symlink + .long sys_lstat + .long sys_readlink /* 85 */ + .long sys_uselib + .long sys_swapon + .long sys_reboot + .long old_readdir + .long old_mmap /* 90 */ + .long sys_munmap + .long sys_truncate + .long sys_ftruncate + .long sys_fchmod + .long sys_fchown /* 95 */ + .long sys_getpriority + .long sys_setpriority + .long sys_ni_syscall /* old profil syscall holder */ + .long sys_statfs + .long sys_fstatfs /* 100 */ + .long sys_ni_syscall /* ioperm */ + .long sys_socketcall + .long sys_syslog + .long sys_setitimer + .long sys_getitimer /* 105 */ + .long sys_newstat + .long sys_newlstat + .long sys_newfstat + .long sys_uname + .long sys_ni_syscall /* 110 - iopl */ + .long sys_vhangup + .long sys_ni_syscall /* for idle */ + .long sys_ni_syscall /* for vm86old */ + .long sys_wait4 + .long sys_swapoff /* 115 */ + .long sys_sysinfo + .long sys_ipc + .long sys_fsync + .long sys_sigreturn + .long sys_clone /* 120 */ + .long sys_setdomainname + .long sys_newuname + .long sys_ni_syscall /* sys_modify_ldt */ + .long sys_adjtimex + .long sys_mprotect /* 125 */ + .long sys_sigprocmask + .long sys_ni_syscall /* sys_create_module */ + .long sys_init_module + .long sys_delete_module + .long sys_ni_syscall /* 130 sys_get_kernel_syms */ + .long sys_quotactl + .long sys_getpgid + .long sys_fchdir + .long sys_bdflush + .long sys_sysfs /* 135 */ + .long sys_personality + .long sys_ni_syscall /* for afs_syscall */ + .long sys_setfsuid + .long sys_setfsgid + .long sys_llseek /* 140 */ + .long sys_getdents + .long sys_select + .long sys_flock + .long sys_msync + .long sys_readv /* 145 */ + .long sys_writev + .long sys_getsid + .long sys_fdatasync + .long sys_sysctl + .long sys_mlock /* 150 */ + .long sys_munlock + .long sys_mlockall + .long sys_munlockall + .long sys_sched_setparam + .long sys_sched_getparam /* 155 */ + .long sys_sched_setscheduler + .long sys_sched_getscheduler + .long sys_sched_yield + .long sys_sched_get_priority_max + .long sys_sched_get_priority_min /* 160 */ + .long sys_sched_rr_get_interval + .long sys_nanosleep + .long sys_mremap + .long sys_setresuid + .long sys_getresuid /* 165 */ + .long sys_tas /* vm86 */ + .long sys_ni_syscall /* sys_query_module */ + .long sys_poll + .long sys_nfsservctl + .long sys_setresgid /* 170 */ + .long sys_getresgid + .long sys_prctl + .long sys_rt_sigreturn + .long sys_rt_sigaction + .long sys_rt_sigprocmask /* 175 */ + .long sys_rt_sigpending + .long sys_rt_sigtimedwait + .long sys_rt_sigqueueinfo + .long sys_rt_sigsuspend + .long sys_pread64 /* 180 */ + .long sys_pwrite64 + .long sys_chown + .long sys_getcwd + .long sys_capget + .long sys_capset /* 185 */ + .long sys_sigaltstack + .long sys_sendfile + .long sys_ni_syscall /* streams1 */ + .long sys_ni_syscall /* streams2 */ + .long sys_vfork /* 190 */ + .long sys_getrlimit + .long sys_mmap2 + .long sys_truncate64 + .long sys_ftruncate64 + .long sys_stat64 /* 195 */ + .long sys_lstat64 + .long sys_fstat64 + .long sys_lchown + .long sys_getuid + .long sys_getgid /* 200 */ + .long sys_geteuid + .long sys_getegid + .long sys_setreuid + .long sys_setregid + .long sys_getgroups /* 205 */ + .long sys_setgroups + .long sys_fchown + .long sys_setresuid + .long sys_getresuid + .long sys_setresgid /* 210 */ + .long sys_getresgid + .long sys_chown + .long sys_setuid + .long sys_setgid + .long sys_setfsuid /* 215 */ + .long sys_setfsgid + .long sys_pivot_root + .long sys_mincore + .long sys_madvise + .long sys_getdents64 /* 220 */ + .long sys_fcntl64 + .long sys_ni_syscall /* reserved for TUX */ + .long sys_ni_syscall /* Reserved for Security */ + .long sys_gettid + .long sys_readahead /* 225 */ + .long sys_setxattr + .long sys_lsetxattr + .long sys_fsetxattr + .long sys_getxattr + .long sys_lgetxattr /* 230 */ + .long sys_fgetxattr + .long sys_listxattr + .long sys_llistxattr + .long sys_flistxattr + .long sys_removexattr /* 235 */ + .long sys_lremovexattr + .long sys_fremovexattr + .long sys_tkill + .long sys_sendfile64 + .long sys_futex /* 240 */ + .long sys_sched_setaffinity + .long sys_sched_getaffinity + .long sys_ni_syscall /* reserved for "set_thread_area" system call */ + .long sys_ni_syscall /* reserved for "get_thread_area" system call */ + .long sys_io_setup /* 245 */ + .long sys_io_destroy + .long sys_io_getevents + .long sys_io_submit + .long sys_io_cancel + .long sys_fadvise64 /* 250 */ + .long sys_ni_syscall + .long sys_exit_group + .long sys_lookup_dcookie + .long sys_epoll_create + .long sys_epoll_ctl /* 255 */ + .long sys_epoll_wait + .long sys_remap_file_pages + .long sys_set_tid_address + .long sys_timer_create + .long sys_timer_settime /* 260 */ + .long sys_timer_gettime + .long sys_timer_getoverrun + .long sys_timer_delete + .long sys_clock_settime + .long sys_clock_gettime /* 265 */ + .long sys_clock_getres + .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 /* Reserved for sys_vserver */ + .long sys_ni_syscall /* Reserved for sys_mbind */ + .long sys_ni_syscall /* Reserved for sys_get_mempolicy */ + .long sys_ni_syscall /* Reserved for 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 + .long sys_ni_syscall /* reserved for kexec */ + +syscall_table_size=(.-sys_call_table) + diff -Nru a/arch/m32r/kernel/head.S b/arch/m32r/kernel/head.S --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/head.S 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,287 @@ +/* + * linux/arch/m32r/kernel/head.S + * + * M32R startup code. + * + * Copyright (c) 2001, 2002 Hiroyuki Kondo, Hirokazu Takata, + * Hitoshi Yamamoto + */ + +/* $Id$ */ + +#include +__INIT +__INITDATA + + .text +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * References to members of the boot_cpu_data structure. + */ + .text + .global start_kernel + .global __bss_start + .global _end +ENTRY(stext) +ENTRY(_stext) +ENTRY(startup_32) + /* Setup up the stack pointer */ + LDIMM (r0, spi_stack_top) + LDIMM (r1, spu_stack_top) + mvtc r0, spi + mvtc r1, spu + + /* Initilalize PSW */ + ldi r0, #0x0000 /* use SPI, disable EI */ + mvtc r0, psw + + /* Set up the stack pointer */ + LDIMM (r0, stack_start) + ld r0, @r0 + mvtc r0, spi + +/* + * Clear BSS first so that there are no surprises... + */ +#ifdef CONFIG_ISA_DUAL_ISSUE + + LDIMM (r2, __bss_start) + LDIMM (r3, _end) + sub r3, r2 ; BSS size in bytes + ; R4 = BSS size in longwords (rounded down) + mv r4, r3 || ldi r1, #0 + srli r4, #4 || addi r2, #-4 + beqz r4, .Lendloop1 +.Lloop1: +#ifndef CONFIG_CHIP_M32310 + ; Touch memory for the no-write-allocating cache. + ld r0, @(4,r2) +#endif + st r1, @+r2 || addi r4, #-1 + st r1, @+r2 + st r1, @+r2 + st r1, @+r2 || cmpeq r1, r4 ; R4 = 0? + bnc .Lloop1 +.Lendloop1: + and3 r4, r3, #15 + addi r2, #4 + beqz r4, .Lendloop2 +.Lloop2: + stb r1, @r2 || addi r4, #-1 + addi r2, #1 + bnez r4, .Lloop2 +.Lendloop2: + +#else /* not CONFIG_ISA_DUAL_ISSUE */ + + LDIMM (r2, __bss_start) + LDIMM (r3, _end) + sub r3, r2 ; BSS size in bytes + mv r4, r3 + srli r4, #2 ; R4 = BSS size in longwords (rounded down) + ldi r1, #0 ; clear R1 for longwords store + addi r2, #-4 ; account for pre-inc store + beqz r4, .Lendloop1 ; any more to go? +.Lloop1: + st r1, @+r2 ; yep, zero out another longword + addi r4, #-1 ; decrement count + bnez r4, .Lloop1 ; go do some more +.Lendloop1: + and3 r4, r3, #3 ; get no. of remaining BSS bytes to clear + addi r2, #4 ; account for pre-inc store + beqz r4, .Lendloop2 ; any more to go? +.Lloop2: + stb r1, @r2 ; yep, zero out another byte + addi r2, #1 ; bump address + addi r4, #-1 ; decrement count + bnez r4, .Lloop2 ; go do some more +.Lendloop2: + +#endif /* not CONFIG_ISA_DUAL_ISSUE */ + +#if 0 /* M32R_FIXME */ +/* + * Copy data segment from ROM to RAM. + */ + .global ROM_D, TOP_DATA, END_DATA + + LDIMM (r1, ROM_D) + LDIMM (r2, TOP_DATA) + LDIMM (r3, END_DATA) + addi r2, #-4 + addi r3, #-4 +loop1: + ld r0, @r1+ + st r0, @+r2 + cmp r2, r3 + bc loop1 +#endif /* 0 */ + +/* Jump to kernel */ + LDIMM (r2, start_kernel) + jl r2 + .fillinsn +1: + bra 1b ; main should never return here, but + ; just in case, we know what happens. + +#ifdef CONFIG_SMP +/* + * AP startup routine + */ + .text + .global eit_vector +ENTRY(startup_AP) +;; setup EVB + LDIMM (r4, eit_vector) + mvtc r4, cr5 + +;; enable MMU + LDIMM (r2, init_tlb) + jl r2 + seth r4, #high(MATM) + or3 r4, r4, #low(MATM) + ldi r5, #0x01 + st r5, @r4 ; Set MATM Reg(T bit ON) + ld r6, @r4 ; MATM Check + LDIMM (r5, 1f) + jmp r5 ; enable MMU + nop + .fillinsn +1: +;; ISN check + ld r6, @r4 ; MATM Check + seth r4, #high(M32R_ICU_ISTS_ADDR) + or3 r4, r4, #low(M32R_ICU_ISTS_ADDR) + ld r5, @r4 ; Read ISTSi reg. + mv r6, r5 + slli r5, #13 ; PIML check + srli r5, #13 ; + seth r4, #high(M32R_ICU_IMASK_ADDR) + or3 r4, r4, #low(M32R_ICU_IMASK_ADDR) + st r5, @r4 ; Write IMASKi reg. + slli r6, #4 ; ISN check + srli r6, #26 ; + seth r4, #high(M32R_IRQ_IPI5) + or3 r4, r4, #low(M32R_IRQ_IPI5) + bne r4, r6, 2f ; if (ISN != CPU_BOOT_IPI) goto sleep; + +;; check cpu_bootout_map and set cpu_bootin_map + LDIMM (r4, cpu_bootout_map) + ld r4, @r4 + seth r5, #high(M32R_CPUID_PORTL) + or3 r5, r5, #low(M32R_CPUID_PORTL) + ld r5, @r5 + ldi r6, #1 + sll r6, r5 + and r4, r6 + beqz r4, 2f + LDIMM (r4, cpu_bootin_map) + ld r5, @r4 + or r5, r6 + st r6, @r4 + +;; clear PSW + ldi r4, #0 + mvtc r4, psw + +;; setup SPI + LDIMM (r4, stack_start) + ld r4, @r4 + mvtc r4, spi + +;; setup BPC (start_secondary) + LDIMM (r4, start_secondary) + mvtc r4, bpc + + rte ; goto startup_secondary + nop + nop + + .fillinsn +2: + ;; disable MMU + seth r4, #high(MATM) + or3 r4, r4, #low(MATM) + ldi r5, #0 + st r5, @r4 ; Set MATM Reg(T bit OFF) + ld r6, @r4 ; MATM Check + LDIMM (r4, 3f) + seth r5, #high(__PAGE_OFFSET) + or3 r5, r5, #low(__PAGE_OFFSET) + not r5, r5 + and r4, r5 + jmp r4 ; disable MMU + nop + .fillinsn +3: + ;; SLEEP and wait IPI + LDIMM (r4, AP_loop) + seth r5, #high(__PAGE_OFFSET) + or3 r5, r5, #low(__PAGE_OFFSET) + not r5, r5 + and r4, r5 + jmp r4 + nop + nop +#endif /* CONFIG_SMP */ + +ENTRY(stack_start) + .long init_thread_union+8192 + .long __KERNEL_DS + +/* + * This is initialized to create a identity-mapping at 0-4M (for bootup + * purposes) and another mapping of the 0-4M area at virtual address + * PAGE_OFFSET. + */ + .text + +#define MOUNT_ROOT_RDONLY 1 +#define RAMDISK_FLAGS 0 ; 1024KB +#define ORIG_ROOT_DEV 0x0100 ; /dev/ram0 (major:01, minor:00) +#define LOADER_TYPE 1 ; (??? - non-zero value seems + ; to be needed to boot from initrd) + +#define COMMAND_LINE "" + + .section .empty_zero_page, "aw" +ENTRY(empty_zero_page) + .long MOUNT_ROOT_RDONLY /* offset: +0x00 */ + .long RAMDISK_FLAGS + .long ORIG_ROOT_DEV + .long LOADER_TYPE + .long 0 /* INITRD_START */ /* +0x10 */ + .long 0 /* INITRD_SIZE */ + .long 0 /* CPU_CLOCK */ + .long 0 /* BUS_CLOCK */ + .long 0 /* TIMER_DIVIDE */ /* +0x20 */ + .balign 256,0 + .asciz COMMAND_LINE + .byte 0 + .balign 4096,0,4096 + +/*------------------------------------------------------------------------ + * Stack area + */ + .section .spi + ALIGN + .global spi_stack_top + .zero 1024 +spi_stack_top: + + .section .spu + ALIGN + .global spu_stack_top + .zero 1024 +spu_stack_top: + + .end diff -Nru a/arch/m32r/kernel/init_task.c b/arch/m32r/kernel/init_task.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/init_task.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,41 @@ +/* orig : i386 init_task.c */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +static struct fs_struct init_fs = INIT_FS; +static struct files_struct init_files = INIT_FILES; +static struct signal_struct init_signals = INIT_SIGNALS(init_signals); +static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); +struct mm_struct init_mm = INIT_MM(init_mm); + +EXPORT_SYMBOL(init_mm); + +/* + * Initial thread structure. + * + * We need to make sure that this is 8192-byte aligned due to the + * way process stacks are handled. This is done by having a special + * "init_task" linker map entry.. + */ +union thread_union init_thread_union + __attribute__((__section__(".data.init_task"))) = + { INIT_THREAD_INFO(init_task) }; + +/* + * Initial task structure. + * + * All other task structs will be allocated on slabs in fork.c + */ +struct task_struct init_task = INIT_TASK(init_task); + +EXPORT_SYMBOL(init_task); + diff -Nru a/arch/m32r/kernel/io_m32102.c b/arch/m32r/kernel/io_m32102.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/io_m32102.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,277 @@ +/* + * Mitsubishi M32R 32102 group + * Typical I/O routines. + * + * Copyright (c) 2001 Hitoshi Yamamoto + */ + +/* $Id$ */ + +#include +#include + +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32RPCC) +#include + +#define M32R_PCC_IOMAP_SIZE 0x1000 + +#define M32R_PCC_IOSTART0 0x1000 +#define M32R_PCC_IOEND0 (M32R_PCC_IOSTART0 + M32R_PCC_IOMAP_SIZE - 1) +#define M32R_PCC_IOSTART1 0x2000 +#define M32R_PCC_IOEND1 (M32R_PCC_IOSTART1 + M32R_PCC_IOMAP_SIZE - 1) + +extern void pcc_ioread(int, unsigned long, void *, size_t, size_t, int); +extern void pcc_iowrite(int, unsigned long, void *, size_t, size_t, int); +#endif /* CONFIG_PCMCIA && CONFIG_M32RPCC */ + + +/* + * Function prototypes + */ +unsigned char ne_inb(unsigned long); +void ne_outb(unsigned char, unsigned long); +void ne_insb(unsigned int, void *, unsigned long); +void ne_insw(unsigned int, void *, unsigned long); +void ne_outsb(unsigned int, const void *, unsigned long); +void ne_outsw(unsigned int, const void *, unsigned long); + +#define PORT2ADDR(port) m32102_port2addr(port) + +static __inline__ unsigned long +m32102_port2addr(unsigned long port) +{ + unsigned long ul; + ul = port + PAGE_OFFSET + 0x20000000; + return (ul); +} + +unsigned char +m32102_inb(unsigned long port) +{ +#ifdef CONFIG_PLAT_MAPPI + if(port >= 0x300 && port < 0x320) + return ne_inb(port); + else +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32RPCC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + unsigned char b; + pcc_ioread(0, port, &b, sizeof(b), 1, 0); + return b; + } else if (port >= M32R_PCC_IOSTART1 && port <= M32R_PCC_IOEND1) { + unsigned char b; + pcc_ioread(1, port, &b, sizeof(b), 1, 0); + return b; + } else +#endif +#endif /* CONFIG_PLAT_MAPPI */ + return *(unsigned char *)PORT2ADDR(port); +} + +unsigned short +m32102_inw(unsigned long port) +{ +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32RPCC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + unsigned short w; + pcc_ioread(0, port, &w, sizeof(w), 1, 0); + return w; + } else if (port >= M32R_PCC_IOSTART1 && port <= M32R_PCC_IOEND1) { + unsigned short w; + pcc_ioread(1, port, &w, sizeof(w), 1, 0); + return w; + } else +#endif + return *(unsigned short *)PORT2ADDR(port); +} + +unsigned long +m32102_inl(unsigned long port) +{ +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32RPCC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + unsigned long l; + pcc_ioread(0, port, &l, sizeof(l), 1, 0); + return l; + } else if (port >= M32R_PCC_IOSTART1 && port <= M32R_PCC_IOEND1) { + unsigned short l; + pcc_ioread(1, port, &l, sizeof(l), 1, 0); + return l; + } else +#endif + return *(unsigned long *)PORT2ADDR(port); +} + +void +m32102_outb(unsigned char b, unsigned long port) +{ +#ifdef CONFIG_PLAT_MAPPI + if(port >= 0x300 && port < 0x320) + ne_outb(b,port); + else +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32RPCC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite(0, port, &b, sizeof(b), 1, 0); + } else if (port >= M32R_PCC_IOSTART1 && port <= M32R_PCC_IOEND1) { + pcc_iowrite(1, port, &b, sizeof(b), 1, 0); + } else +#endif +#endif /* CONFIG_PLAT_MAPPI */ + *(unsigned volatile char *)PORT2ADDR(port) = b; +} + +void +m32102_outw(unsigned short w, unsigned long port) +{ +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32RPCC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite(0, port, &w, sizeof(w), 1, 0); + } else if (port >= M32R_PCC_IOSTART1 && port <= M32R_PCC_IOEND1) { + pcc_iowrite(1, port, &w, sizeof(w), 1, 0); + } else +#endif +*(unsigned volatile short *)PORT2ADDR(port) = w; +} + +void +m32102_outl(unsigned long l, unsigned long port) +{ +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32RPCC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite(0, port, &l, sizeof(l), 1, 0); + } else if (port >= M32R_PCC_IOSTART1 && port <= M32R_PCC_IOEND1) { + pcc_iowrite(1, port, &l, sizeof(l), 1, 0); + } else +#endif + *(unsigned volatile long *)PORT2ADDR(port) = l; +} + +void +m32102_insb(unsigned int port, void * addr, unsigned long count) +{ +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32RPCC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_ioread(0, port, (void *)addr, sizeof(unsigned char), count, 1); + } else if (port >= M32R_PCC_IOSTART1 && port <= M32R_PCC_IOEND1) { + pcc_ioread(1, port, (void *)addr, sizeof(unsigned char), count, 1); + } else +#endif + while(count--){ + *(unsigned char *)addr = *(unsigned volatile char *)PORT2ADDR(port); + addr+=1; + } +} + +void +m32102_insw(unsigned int port, void * addr, unsigned long count) +{ +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32RPCC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_ioread(0, port, (void *)addr, sizeof(unsigned short), count, 1); + } else if (port >= M32R_PCC_IOSTART1 && port <= M32R_PCC_IOEND1) { + pcc_ioread(1, port, (void *)addr, sizeof(unsigned short), count, 1); + } else +#endif +while(count--){ + *(unsigned short *)addr = *(unsigned volatile short *)PORT2ADDR(port); + addr+=2; + } +} + +void +m32102_outsb(unsigned int port, const void * addr, unsigned long count) +{ +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32RPCC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite(0, port, (void *)addr, sizeof(unsigned char), count, 1); + } else if (port >= M32R_PCC_IOSTART1 && port <= M32R_PCC_IOEND1) { + pcc_iowrite(1, port, (void *)addr, sizeof(unsigned char), count, 1); + } else +#endif +while(count--){ + *(unsigned volatile char *)PORT2ADDR(port) = *(unsigned char *)addr; + addr+=1; + } +} +void +m32102_outsw(unsigned int port, const void * addr, unsigned long count) +{ +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32RPCC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite(0, port, (void *)addr, sizeof(unsigned short), count, 1); + } else if (port >= M32R_PCC_IOSTART1 && port <= M32R_PCC_IOEND1) { + pcc_iowrite(1, port, (void *)addr, sizeof(unsigned short), count, 1); + } else +#endif +while(count--){ + *(unsigned volatile short *)PORT2ADDR(port) = *(unsigned short *)addr; + addr+=2; + } +} + +#ifdef CONFIG_PLAT_MAPPI +unsigned char +ne_inb(unsigned long port) +{ + unsigned short tmp; + port <<= 1; + port+= PAGE_OFFSET + 0x20000000 + 0x0c000000; + tmp = *(unsigned short *)port; + return (unsigned char)tmp; +} +void +ne_outb(unsigned char b, unsigned long port) +{ + port <<= 1; + port += PAGE_OFFSET + 0x20000000 + 0x0c000000; + *(unsigned volatile short *)port = (unsigned short)b; +} +void +ne_insb(unsigned int port, void * addr, unsigned long count) +{ + + unsigned short tmp; + port <<= 1; + port+= PAGE_OFFSET + 0x20000000 + 0x0c000000; + tmp = *(unsigned short *)port; + while(count--){ + *(unsigned char *)addr = *(unsigned volatile char *)port; + addr+=1; + } +} + +void +ne_insw(unsigned int port, void * addr, unsigned long count) { + unsigned short tmp; + port <<= 1; + port+= PAGE_OFFSET + 0x20000000 + 0x0c000000; + while(count--){ + tmp = *(unsigned volatile short *)port; + *(unsigned short *)addr = (tmp>>8) | (tmp <<8); + addr+=2; + } +} + +void +ne_outsb(unsigned int port, const void * addr, unsigned long count) +{ + port <<= 1; + port += PAGE_OFFSET + 0x20000000 + 0x0c000000; + while(count--){ + *(unsigned volatile short *)port = *(unsigned char *)addr; + addr+=1; + } +} +void +ne_outsw(unsigned int port, const void * addr, unsigned long count) +{ + unsigned short tmp; + port <<= 1; + port += PAGE_OFFSET + 0x20000000 + 0x0c000000; + while(count--){ + tmp = *(unsigned short *)addr; + *(unsigned volatile short *)port = (tmp>>8)|(tmp<<8); + addr+=2; + } +} + +#endif /* CONFIG_PLAT_MAPPI */ diff -Nru a/arch/m32r/kernel/io_m32700ut.c b/arch/m32r/kernel/io_m32700ut.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/io_m32700ut.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,455 @@ +/* + * linux/arch/m32r/kernel/io_mappi.c + * + * Typical I/O routines for M32700UT board. + * + * Copyright (c) 2001, 2002 Hiroyuki Kondo, Hirokazu Takata, + * Hitoshi Yamamoto, Takeo Takahashi + * + * 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. + * + */ + +#include +#include +#include +#include +#include + +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) +#include + +#define M32R_PCC_IOMAP_SIZE 0x1000 + +#define M32R_PCC_IOSTART0 0x1000 +#define M32R_PCC_IOEND0 (M32R_PCC_IOSTART0 + M32R_PCC_IOMAP_SIZE - 1) + +extern void pcc_ioread_byte(int, unsigned long, void *, size_t, size_t, int); +extern void pcc_ioread_word(int, unsigned long, void *, size_t, size_t, int); +extern void pcc_iowrite_byte(int, unsigned long, void *, size_t, size_t, int); +extern void pcc_iowrite_word(int, unsigned long, void *, size_t, size_t, int); +#endif /* CONFIG_PCMCIA && CONFIG_M32R_CFC */ + +#define PORT2ADDR(port) _port2addr(port) +#define PORT2ADDR_USB(port) _port2addr_usb(port) + +static __inline__ void *_port2addr(unsigned long port) +{ + return (void *)(port + NONCACHE_OFFSET); +} + +#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) +static __inline__ void *__port2addr_ata(unsigned long port) +{ + static int dummy_reg; + + switch (port) { + case 0x1f0: return (void *)0xac002000; + case 0x1f1: return (void *)0xac012800; + case 0x1f2: return (void *)0xac012002; + case 0x1f3: return (void *)0xac012802; + case 0x1f4: return (void *)0xac012004; + case 0x1f5: return (void *)0xac012804; + case 0x1f6: return (void *)0xac012006; + case 0x1f7: return (void *)0xac012806; + case 0x3f6: return (void *)0xac01200e; + default: return (void *)&dummy_reg; + } +} +#endif + +/* + * M32700UT-LAN is located in the extended bus space + * from 0x10000000 to 0x13ffffff on physical address. + * The base address of LAN controller(LAN91C111) is 0x300. + */ +#define LAN_IOSTART 0x300 +#define LAN_IOEND 0x320 +static __inline__ void *_port2addr_ne(unsigned long port) +{ + return (void *)(port + NONCACHE_OFFSET + 0x10000000); +} +static __inline__ void *_port2addr_usb(unsigned long port) +{ + return (void *)((port & 0x0f) + NONCACHE_OFFSET + 0x10303000); +} + +static __inline__ void delay(void) +{ + __asm__ __volatile__ ("push r0; \n\t pop r0;" : : :"memory"); +} + +/* + * NIC I/O function + */ + +#define PORT2ADDR_NE(port) _port2addr_ne(port) + +static __inline__ unsigned char _ne_inb(void *portp) +{ + return *(volatile unsigned char *)portp; +} + +static __inline__ unsigned short _ne_inw(void *portp) +{ + return (unsigned short)le16_to_cpu(*(volatile unsigned short *)portp); +} + +static __inline__ void _ne_insb(void *portp, void * addr, unsigned long count) +{ + unsigned char *buf = (unsigned char *)addr; + + while (count--) *buf++ = _ne_inb(portp); +} + +static __inline__ void _ne_outb(unsigned char b, void *portp) +{ + *(volatile unsigned char *)portp = b; +} + +static __inline__ void _ne_outw(unsigned short w, void *portp) +{ + *(volatile unsigned short *)portp = cpu_to_le16(w); +} + +unsigned char _inb(unsigned long port) +{ + if (port >= LAN_IOSTART && port < LAN_IOEND) + return _ne_inb(PORT2ADDR_NE(port)); + +#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) + else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { + return *(volatile unsigned char *)__port2addr_ata(port); + } +#endif +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + unsigned char b; + pcc_ioread_byte(0, port, &b, sizeof(b), 1, 0); + return b; + } else +#endif + + return *(volatile unsigned char *)PORT2ADDR(port); +} + +unsigned short _inw(unsigned long port) +{ + if (port >= LAN_IOSTART && port < LAN_IOEND) + return _ne_inw(PORT2ADDR_NE(port)); +#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) + else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { + return *(volatile unsigned short *)__port2addr_ata(port); + } +#endif +#if defined(CONFIG_USB) + else if(port >= 0x340 && port < 0x3a0) + return *(volatile unsigned short *)PORT2ADDR_USB(port); +#endif +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + unsigned short w; + pcc_ioread_word(0, port, &w, sizeof(w), 1, 0); + return w; + } else +#endif + return *(volatile unsigned short *)PORT2ADDR(port); +} + +unsigned long _inl(unsigned long port) +{ +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + unsigned long l; + pcc_ioread_word(0, port, &l, sizeof(l), 1, 0); + return l; + } else +#endif + return *(volatile unsigned long *)PORT2ADDR(port); +} + +unsigned char _inb_p(unsigned long port) +{ + unsigned char v; + + if (port >= LAN_IOSTART && port < LAN_IOEND) + v = _ne_inb(PORT2ADDR_NE(port)); + else +#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) + if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { + return *(volatile unsigned char *)__port2addr_ata(port); + } else +#endif +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + unsigned char b; + pcc_ioread_byte(0, port, &b, sizeof(b), 1, 0); + return b; + } else +#endif + v = *(volatile unsigned char *)PORT2ADDR(port); + + delay(); + return (v); +} + +unsigned short _inw_p(unsigned long port) +{ + unsigned short v; + + if (port >= LAN_IOSTART && port < LAN_IOEND) + v = _ne_inw(PORT2ADDR_NE(port)); + else +#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) + if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { + return *(volatile unsigned short *)__port2addr_ata(port); + } else +#endif +#if defined(CONFIG_USB) + if(port >= 0x340 && port < 0x3a0) + return *(volatile unsigned short *)PORT2ADDR_USB(port); + else +#endif +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + unsigned short w; + pcc_ioread_word(0, port, &w, sizeof(w), 1, 0); + return w; + } else +#endif + v = *(volatile unsigned short *)PORT2ADDR(port); + + delay(); + return (v); +} + +unsigned long _inl_p(unsigned long port) +{ + unsigned long v; + + v = *(volatile unsigned long *)PORT2ADDR(port); + delay(); + return (v); +} + +void _outb(unsigned char b, unsigned long port) +{ + if (port >= LAN_IOSTART && port < LAN_IOEND) + _ne_outb(b, PORT2ADDR_NE(port)); + else +#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) + if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { + *(volatile unsigned char *)__port2addr_ata(port) = b; + } else +#endif +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite_byte(0, port, &b, sizeof(b), 1, 0); + } else +#endif + *(volatile unsigned char *)PORT2ADDR(port) = b; +} + +void _outw(unsigned short w, unsigned long port) +{ + if (port >= LAN_IOSTART && port < LAN_IOEND) + _ne_outw(w, PORT2ADDR_NE(port)); + else +#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) + if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { + *(volatile unsigned short *)__port2addr_ata(port) = w; + } else +#endif +#if defined(CONFIG_USB) + if(port >= 0x340 && port < 0x3a0) + *(volatile unsigned short *)PORT2ADDR_USB(port) = w; + else +#endif +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite_word(0, port, &w, sizeof(w), 1, 0); + } else +#endif + *(volatile unsigned short *)PORT2ADDR(port) = w; +} + +void _outl(unsigned long l, unsigned long port) +{ +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite_word(0, port, &l, sizeof(l), 1, 0); + } else +#endif + *(volatile unsigned long *)PORT2ADDR(port) = l; +} + +void _outb_p(unsigned char b, unsigned long port) +{ + if (port >= LAN_IOSTART && port < LAN_IOEND) + _ne_outb(b, PORT2ADDR_NE(port)); + else +#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) + if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { + *(volatile unsigned char *)__port2addr_ata(port) = b; + } else +#endif +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite_byte(0, port, &b, sizeof(b), 1, 0); + } else +#endif + *(volatile unsigned char *)PORT2ADDR(port) = b; + + delay(); +} + +void _outw_p(unsigned short w, unsigned long port) +{ + if (port >= LAN_IOSTART && port < LAN_IOEND) + _ne_outw(w, PORT2ADDR_NE(port)); + else +#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) + if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { + *(volatile unsigned short *)__port2addr_ata(port) = w; + } else +#endif +#if defined(CONFIG_USB) + if(port >= 0x340 && port < 0x3a0) + *(volatile unsigned short *)PORT2ADDR_USB(port) = w; + else +#endif +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite_word(0, port, &w, sizeof(w), 1, 0); + } else +#endif + *(volatile unsigned short *)PORT2ADDR(port) = w; + + delay(); +} + +void _outl_p(unsigned long l, unsigned long port) +{ + *(volatile unsigned long *)PORT2ADDR(port) = l; + delay(); +} + +void _insb(unsigned int port, void * addr, unsigned long count) +{ + if (port >= LAN_IOSTART && port < LAN_IOEND) + _ne_insb(PORT2ADDR_NE(port), addr, count); +#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) + else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { + unsigned char *buf = addr; + unsigned char *portp = __port2addr_ata(port); + while(count--) *buf++ = *(volatile unsigned char *)portp; + } +#endif +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_ioread_byte(0, port, (void *)addr, sizeof(unsigned char), count, 1); + } +#endif + else { + unsigned char *buf = addr; + unsigned char *portp = PORT2ADDR(port); + while(count--) *buf++ = *(volatile unsigned char *)portp; + } +} + +void _insw(unsigned int port, void * addr, unsigned long count) +{ + unsigned short *buf = addr; + unsigned short *portp; + + if (port >= LAN_IOSTART && port < LAN_IOEND) { + /* + * This portion is only used by smc91111.c to read data + * from the DATA_REG. Do not swap the data. + */ + portp = PORT2ADDR_NE(port); + while (count--) *buf++ = *(volatile unsigned short *)portp; +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + } else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_ioread_word(9, port, (void *)addr, sizeof(unsigned short), count, 1); +#endif +#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) + } else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { + portp = __port2addr_ata(port); + while (count--) *buf++ = *(volatile unsigned short *)portp; +#endif + } else { + portp = PORT2ADDR(port); + while (count--) *buf++ = *(volatile unsigned short *)portp; + } +} + +void _insl(unsigned int port, void * addr, unsigned long count) +{ + unsigned long *buf = addr; + unsigned long *portp; + + portp = PORT2ADDR(port); + while (count--) *buf++ = *(volatile unsigned long *)portp; +} + +void _outsb(unsigned int port, const void * addr, unsigned long count) +{ + const unsigned char *buf = addr; + unsigned char *portp; + + if (port >= LAN_IOSTART && port < LAN_IOEND) { + portp = PORT2ADDR_NE(port); + while (count--) _ne_outb(*buf++, portp); +#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) + } else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { + portp = __port2addr_ata(port); + while(count--) *(volatile unsigned char *)portp = *buf++; +#endif +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + } else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite_byte(0, port, (void *)addr, sizeof(unsigned char), count, 1); +#endif + } else { + portp = PORT2ADDR(port); + while(count--) *(volatile unsigned char *)portp = *buf++; + } +} + +void _outsw(unsigned int port, const void * addr, unsigned long count) +{ + const unsigned short *buf = addr; + unsigned short *portp; + + if (port >= LAN_IOSTART && port < LAN_IOEND) { + /* + * This portion is only used by smc91111.c to write data + * into the DATA_REG. Do not swap the data. + */ + portp = PORT2ADDR_NE(port); + while(count--) *(volatile unsigned short *)portp = *buf++; +#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) + } else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { + portp = __port2addr_ata(port); + while(count--) *(volatile unsigned short *)portp = *buf++; +#endif +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + } else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite_word(9, port, (void *)addr, sizeof(unsigned short), count, 1); +#endif + } else { + portp = PORT2ADDR(port); + while(count--) *(volatile unsigned short *)portp = *buf++; + } +} + +void _outsl(unsigned int port, const void * addr, unsigned long count) +{ + const unsigned long *buf = addr; + unsigned char *portp; + + portp = PORT2ADDR(port); + while(count--) *(volatile unsigned long *)portp = *buf++; +} diff -Nru a/arch/m32r/kernel/io_mappi.c b/arch/m32r/kernel/io_mappi.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/io_mappi.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,368 @@ +/* + * linux/arch/m32r/kernel/io_mappi.c + * + * Typical I/O routines for Mappi board. + * + * Copyright (c) 2001, 2002 Hiroyuki Kondo, Hirokazu Takata, + * Hitoshi Yamamoto + */ + +/* $Id: io_mappi.c,v 1.9 2003/12/02 07:18:08 fujiwara Exp $ */ + +#include +#include +#include +#include +#include + +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32RPCC) +#include + +#define M32R_PCC_IOMAP_SIZE 0x1000 + +#define M32R_PCC_IOSTART0 0x1000 +#define M32R_PCC_IOEND0 (M32R_PCC_IOSTART0 + M32R_PCC_IOMAP_SIZE - 1) +#define M32R_PCC_IOSTART1 0x2000 +#define M32R_PCC_IOEND1 (M32R_PCC_IOSTART1 + M32R_PCC_IOMAP_SIZE - 1) + +extern void pcc_ioread(int, unsigned long, void *, size_t, size_t, int); +extern void pcc_iowrite(int, unsigned long, void *, size_t, size_t, int); +#endif /* CONFIG_PCMCIA && CONFIG_M32RPCC */ + +#define PORT2ADDR(port) _port2addr(port) + +static __inline__ void *_port2addr(unsigned long port) +{ + return (void *)(port + NONCACHE_OFFSET); +} + +static __inline__ void *_port2addr_ne(unsigned long port) +{ + return (void *)((port<<1) + NONCACHE_OFFSET + 0x0C000000); +} + +static __inline__ void delay(void) +{ + __asm__ __volatile__ ("push r0; \n\t pop r0;" : : :"memory"); +} + +/* + * NIC I/O function + */ + +#define PORT2ADDR_NE(port) _port2addr_ne(port) + +static __inline__ unsigned char _ne_inb(void *portp) +{ + return (unsigned char) *(volatile unsigned short *)portp; +} + +static __inline__ unsigned short _ne_inw(void *portp) +{ + unsigned short tmp; + + tmp = *(volatile unsigned short *)portp; + return le16_to_cpu(tmp); +} + +static __inline__ void _ne_outb(unsigned char b, void *portp) +{ + *(volatile unsigned short *)portp = (unsigned short)b; +} + +static __inline__ void _ne_outw(unsigned short w, void *portp) +{ + *(volatile unsigned short *)portp = cpu_to_le16(w); +} + +unsigned char _inb(unsigned long port) +{ + if (port >= 0x300 && port < 0x320) + return _ne_inb(PORT2ADDR_NE(port)); + else +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32RPCC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + unsigned char b; + pcc_ioread(0, port, &b, sizeof(b), 1, 0); + return b; + } else if (port >= M32R_PCC_IOSTART1 && port <= M32R_PCC_IOEND1) { + unsigned char b; + pcc_ioread(1, port, &b, sizeof(b), 1, 0); + return b; + } else +#endif + + return *(volatile unsigned char *)PORT2ADDR(port); +} + +unsigned short _inw(unsigned long port) +{ + if (port >= 0x300 && port < 0x320) + return _ne_inw(PORT2ADDR_NE(port)); + else +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32RPCC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + unsigned short w; + pcc_ioread(0, port, &w, sizeof(w), 1, 0); + return w; + } else if (port >= M32R_PCC_IOSTART1 && port <= M32R_PCC_IOEND1) { + unsigned short w; + pcc_ioread(1, port, &w, sizeof(w), 1, 0); + return w; + } else +#endif + return *(volatile unsigned short *)PORT2ADDR(port); +} + +unsigned long _inl(unsigned long port) +{ +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32RPCC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + unsigned long l; + pcc_ioread(0, port, &l, sizeof(l), 1, 0); + return l; + } else if (port >= M32R_PCC_IOSTART1 && port <= M32R_PCC_IOEND1) { + unsigned short l; + pcc_ioread(1, port, &l, sizeof(l), 1, 0); + return l; + } else +#endif + return *(volatile unsigned long *)PORT2ADDR(port); +} + +unsigned char _inb_p(unsigned long port) +{ + unsigned char v; + + if (port >= 0x300 && port < 0x320) + v = _ne_inb(PORT2ADDR_NE(port)); + else +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32RPCC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + unsigned char b; + pcc_ioread(0, port, &b, sizeof(b), 1, 0); + return b; + } else if (port >= M32R_PCC_IOSTART1 && port <= M32R_PCC_IOEND1) { + unsigned char b; + pcc_ioread(1, port, &b, sizeof(b), 1, 0); + return b; + } else +#endif + v = *(volatile unsigned char *)PORT2ADDR(port); + + delay(); + return (v); +} + +unsigned short _inw_p(unsigned long port) +{ + unsigned short v; + + if (port >= 0x300 && port < 0x320) + v = _ne_inw(PORT2ADDR_NE(port)); + else +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32RPCC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + unsigned short w; + pcc_ioread(0, port, &w, sizeof(w), 1, 0); + return w; + } else if (port >= M32R_PCC_IOSTART1 && port <= M32R_PCC_IOEND1) { + unsigned short w; + pcc_ioread(1, port, &w, sizeof(w), 1, 0); + return w; + } else +#endif + v = *(volatile unsigned short *)PORT2ADDR(port); + + delay(); + return (v); +} + +unsigned long _inl_p(unsigned long port) +{ + unsigned long v; + + v = *(volatile unsigned long *)PORT2ADDR(port); + delay(); + return (v); +} + +void _outb(unsigned char b, unsigned long port) +{ + if (port >= 0x300 && port < 0x320) + _ne_outb(b, PORT2ADDR_NE(port)); + else +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32RPCC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite(0, port, &b, sizeof(b), 1, 0); + } else if (port >= M32R_PCC_IOSTART1 && port <= M32R_PCC_IOEND1) { + pcc_iowrite(1, port, &b, sizeof(b), 1, 0); + } else +#endif + *(volatile unsigned char *)PORT2ADDR(port) = b; +} + +void _outw(unsigned short w, unsigned long port) +{ + if (port >= 0x300 && port < 0x320) + _ne_outw(w, PORT2ADDR_NE(port)); + else +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32RPCC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite(0, port, &w, sizeof(w), 1, 0); + } else if (port >= M32R_PCC_IOSTART1 && port <= M32R_PCC_IOEND1) { + pcc_iowrite(1, port, &w, sizeof(w), 1, 0); + } else +#endif + *(volatile unsigned short *)PORT2ADDR(port) = w; +} + +void _outl(unsigned long l, unsigned long port) +{ +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32RPCC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite(0, port, &l, sizeof(l), 1, 0); + } else if (port >= M32R_PCC_IOSTART1 && port <= M32R_PCC_IOEND1) { + pcc_iowrite(1, port, &l, sizeof(l), 1, 0); + } else +#endif + *(volatile unsigned long *)PORT2ADDR(port) = l; +} + +void _outb_p(unsigned char b, unsigned long port) +{ + if (port >= 0x300 && port < 0x320) + _ne_outb(b, PORT2ADDR_NE(port)); + else +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32RPCC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite(0, port, &b, sizeof(b), 1, 0); + } else if (port >= M32R_PCC_IOSTART1 && port <= M32R_PCC_IOEND1) { + pcc_iowrite(1, port, &b, sizeof(b), 1, 0); + } else +#endif + *(volatile unsigned char *)PORT2ADDR(port) = b; + + delay(); +} + +void _outw_p(unsigned short w, unsigned long port) +{ + if (port >= 0x300 && port < 0x320) + _ne_outw(w, PORT2ADDR_NE(port)); + else +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32RPCC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite(0, port, &w, sizeof(w), 1, 0); + } else if (port >= M32R_PCC_IOSTART1 && port <= M32R_PCC_IOEND1) { + pcc_iowrite(1, port, &w, sizeof(w), 1, 0); + } else +#endif + *(volatile unsigned short *)PORT2ADDR(port) = w; + + delay(); +} + +void _outl_p(unsigned long l, unsigned long port) +{ + *(volatile unsigned long *)PORT2ADDR(port) = l; + delay(); +} + +void _insb(unsigned int port, void * addr, unsigned long count) +{ + unsigned short *buf = addr; + unsigned short *portp; + + if (port >= 0x300 && port < 0x320){ + portp = PORT2ADDR_NE(port); + while(count--) *buf++ = *(volatile unsigned char *)portp; +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32RPCC) + } else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_ioread(0, port, (void *)addr, sizeof(unsigned char), count, 1); + } else if (port >= M32R_PCC_IOSTART1 && port <= M32R_PCC_IOEND1) { + pcc_ioread(1, port, (void *)addr, sizeof(unsigned char), count, 1); +#endif + } else { + portp = PORT2ADDR(port); + while(count--) *buf++ = *(volatile unsigned char *)portp; + } +} + +void _insw(unsigned int port, void * addr, unsigned long count) +{ + unsigned short *buf = addr; + unsigned short *portp; + + if (port >= 0x300 && port < 0x320) { + portp = PORT2ADDR_NE(port); + while (count--) *buf++ = _ne_inw(portp); +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32RPCC) + } else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_ioread(0, port, (void *)addr, sizeof(unsigned short), count, 1); + } else if (port >= M32R_PCC_IOSTART1 && port <= M32R_PCC_IOEND1) { + pcc_ioread(1, port, (void *)addr, sizeof(unsigned short), count, 1); +#endif + } else { + portp = PORT2ADDR(port); + while (count--) *buf++ = *(volatile unsigned short *)portp; + } +} + +void _insl(unsigned int port, void * addr, unsigned long count) +{ + unsigned long *buf = addr; + unsigned long *portp; + + portp = PORT2ADDR(port); + while (count--) *buf++ = *(volatile unsigned long *)portp; +} + +void _outsb(unsigned int port, const void * addr, unsigned long count) +{ + const unsigned char *buf = addr; + unsigned char *portp; + + if (port >= 0x300 && port < 0x320) { + portp = PORT2ADDR_NE(port); + while (count--) _ne_outb(*buf++, portp); +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32RPCC) + } else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite(0, port, (void *)addr, sizeof(unsigned char), count, 1); + } else if (port >= M32R_PCC_IOSTART1 && port <= M32R_PCC_IOEND1) { + pcc_iowrite(1, port, (void *)addr, sizeof(unsigned char), count, 1); +#endif + } else { + portp = PORT2ADDR(port); + while(count--) *(volatile unsigned char *)portp = *buf++; + } +} + +void _outsw(unsigned int port, const void * addr, unsigned long count) +{ + const unsigned short *buf = addr; + unsigned short *portp; + + if (port >= 0x300 && port < 0x320) { + portp = PORT2ADDR_NE(port); + while (count--) _ne_outw(*buf++, portp); +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32RPCC) + } else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite(0, port, (void *)addr, sizeof(unsigned short), count, 1); + } else if (port >= M32R_PCC_IOSTART1 && port <= M32R_PCC_IOEND1) { + pcc_iowrite(1, port, (void *)addr, sizeof(unsigned short), count, 1); +#endif + } else { + portp = PORT2ADDR(port); + while(count--) *(volatile unsigned short *)portp = *buf++; + } +} + +void _outsl(unsigned int port, const void * addr, unsigned long count) +{ + const unsigned long *buf = addr; + unsigned char *portp; + + portp = PORT2ADDR(port); + while(count--) *(volatile unsigned long *)portp = *buf++; +} diff -Nru a/arch/m32r/kernel/io_mappi2.c b/arch/m32r/kernel/io_mappi2.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/io_mappi2.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,370 @@ +/* + * linux/arch/m32r/kernel/io_mappi2.c + * + * Typical I/O routines for Mappi2 board. + * + * Copyright (c) 2001-2003 Hiroyuki Kondo, Hirokazu Takata, + * Hitoshi Yamamoto, Mamoru Sakugawa + */ + +/* $Id:$ */ + +#include +#include +#include +#include + +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) +#include + +#define M32R_PCC_IOMAP_SIZE 0x1000 + +#define M32R_PCC_IOSTART0 0x1000 +#define M32R_PCC_IOEND0 (M32R_PCC_IOSTART0 + M32R_PCC_IOMAP_SIZE - 1) + +extern void pcc_ioread_byte(int, unsigned long, void *, size_t, size_t, int); +extern void pcc_ioread_word(int, unsigned long, void *, size_t, size_t, int); +extern void pcc_iowrite_byte(int, unsigned long, void *, size_t, size_t, int); +extern void pcc_iowrite_word(int, unsigned long, void *, size_t, size_t, int); +#endif /* CONFIG_PCMCIA && CONFIG_MAPPI2_CFC */ + +#define PORT2ADDR(port) _port2addr(port) +#define PORT2ADDR_NE(port) _port2addr_ne(port) +#define PORT2ADDR_USB(port) _port2addr_usb(port) + +static __inline__ void *_port2addr(unsigned long port) +{ + return (void *)(port + NONCACHE_OFFSET); +} + +#define LAN_IOSTART 0x300 +#define LAN_IOEND 0x320 +#ifdef CONFIG_CHIP_OPSP +static __inline__ void *_port2addr_ne(unsigned long port) +{ + return (void *)(port + NONCACHE_OFFSET + 0x10000000); +} +#else +static __inline__ void *_port2addr_ne(unsigned long port) +{ + return (void *)(port + NONCACHE_OFFSET + 0x04000000); +} +#endif +static __inline__ void *_port2addr_usb(unsigned long port) +{ + return (void *)(port + NONCACHE_OFFSET + 0x14000000); +} +static __inline__ void delay(void) +{ + __asm__ __volatile__ ("push r0; \n\t pop r0;" : : :"memory"); +} + +/* + * NIC I/O function + */ + +static __inline__ unsigned char _ne_inb(void *portp) +{ + return (unsigned char) *(volatile unsigned char *)portp; +} + +static __inline__ unsigned short _ne_inw(void *portp) +{ +#if 1 /* byte swap */ + unsigned short tmp,tmp2; + tmp = *(volatile unsigned short *)portp; + tmp2 = (tmp>>8|tmp<<8); + return tmp2; +#else + return *(volatile unsigned short *)portp; +#endif +} + +static __inline__ void _ne_insb(void *portp, void * addr, unsigned long count) +{ + unsigned short tmp; + unsigned char *buf = addr; + + tmp = *(volatile unsigned char *)portp; + while (count--) *buf++ = *(volatile unsigned char *)portp; +} + +static __inline__ void _ne_outb(unsigned char b, void *portp) +{ + *(volatile unsigned char *)portp = (unsigned char)b; +} + +static __inline__ void _ne_outw(unsigned short w, void *portp) +{ + *(volatile unsigned short *)portp = (w>>8|w<<8); +} + +unsigned char _inb(unsigned long port) +{ + if (port >= LAN_IOSTART && port < LAN_IOEND) + return _ne_inb(PORT2ADDR_NE(port)); +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + unsigned char b; + pcc_ioread_byte(0, port, &b, sizeof(b), 1, 0); + return b; + } else +#endif + + return *(volatile unsigned char *)PORT2ADDR(port); +} + +unsigned short _inw(unsigned long port) +{ + if (port >= LAN_IOSTART && port < LAN_IOEND) + return _ne_inw(PORT2ADDR_NE(port)); +#if defined(CONFIG_USB) + else if (port >= 0x340 && port < 0x3a0) + return *(volatile unsigned short *)PORT2ADDR_USB(port); +#endif + +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + unsigned short w; + pcc_ioread_word(0, port, &w, sizeof(w), 1, 0); + return w; + } else +#endif + return *(volatile unsigned short *)PORT2ADDR(port); +} + +unsigned long _inl(unsigned long port) +{ +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + unsigned long l; + pcc_ioread_word(0, port, &l, sizeof(l), 1, 0); + return l; + } else +#endif + return *(volatile unsigned long *)PORT2ADDR(port); +} + +unsigned char _inb_p(unsigned long port) +{ + unsigned char v; + + if (port >= 0x300 && port < 0x320) + v = _ne_inb(PORT2ADDR_NE(port)); + else +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + unsigned char b; + pcc_ioread_byte(0, port, &b, sizeof(b), 1, 0); + return b; + } else +#endif + v = *(volatile unsigned char *)PORT2ADDR(port); + + delay(); + return (v); +} + +unsigned short _inw_p(unsigned long port) +{ + unsigned short v; + + if (port >= 0x300 && port < 0x320) + v = _ne_inw(PORT2ADDR_NE(port)); + else +#if defined(CONFIG_USB) + if (port >= 0x340 && port < 0x3a0) + v = *(volatile unsigned short *)PORT2ADDR_USB(port); + else +#endif +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + unsigned short w; + pcc_ioread_word(0, port, &w, sizeof(w), 1, 0); + return w; + } else +#endif + v = *(volatile unsigned short *)PORT2ADDR(port); + + delay(); + return (v); +} + +unsigned long _inl_p(unsigned long port) +{ + unsigned long v; + + v = *(volatile unsigned long *)PORT2ADDR(port); + delay(); + return (v); +} + +void _outb(unsigned char b, unsigned long port) +{ + if (port >= LAN_IOSTART && port < LAN_IOEND) + _ne_outb(b, PORT2ADDR_NE(port)); + else +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite_byte(0, port, &b, sizeof(b), 1, 0); + } else +#endif + *(volatile unsigned char *)PORT2ADDR(port) = b; +} + +void _outw(unsigned short w, unsigned long port) +{ + if (port >= LAN_IOSTART && port < LAN_IOEND) + _ne_outw(w, PORT2ADDR_NE(port)); + else +#if defined(CONFIG_USB) + if (port >= 0x340 && port < 0x3a0) + *(volatile unsigned short *)PORT2ADDR_USB(port) = w; + else +#endif +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite_word(0, port, &w, sizeof(w), 1, 0); + } else +#endif + *(volatile unsigned short *)PORT2ADDR(port) = w; +} + +void _outl(unsigned long l, unsigned long port) +{ +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite_word(0, port, &l, sizeof(l), 1, 0); + } else +#endif + *(volatile unsigned long *)PORT2ADDR(port) = l; +} + +void _outb_p(unsigned char b, unsigned long port) +{ + if (port >= LAN_IOSTART && port < LAN_IOEND) + _ne_outb(b, PORT2ADDR_NE(port)); + else +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite_byte(0, port, &b, sizeof(b), 1, 0); + } else +#endif + *(volatile unsigned char *)PORT2ADDR(port) = b; + + delay(); +} + +void _outw_p(unsigned short w, unsigned long port) +{ + if (port >= LAN_IOSTART && port < LAN_IOEND) + _ne_outw(w, PORT2ADDR_NE(port)); + else +#if defined(CONFIG_USB) + if (port >= 0x340 && port < 0x3a0) + *(volatile unsigned short *)PORT2ADDR_USB(port) = w; + else +#endif +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite_word(0, port, &w, sizeof(w), 1, 0); + } else +#endif + *(volatile unsigned short *)PORT2ADDR(port) = w; + + delay(); +} + +void _outl_p(unsigned long l, unsigned long port) +{ + *(volatile unsigned long *)PORT2ADDR(port) = l; + delay(); +} + +void _insb(unsigned int port, void * addr, unsigned long count) +{ + if (port >= LAN_IOSTART && port < LAN_IOEND) + _ne_insb(PORT2ADDR_NE(port), addr, count); +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_ioread_byte(0, port, (void *)addr, sizeof(unsigned char), count, 1); + } +#endif + else { + unsigned char *buf = addr; + unsigned char *portp = PORT2ADDR(port); + while(count--) *buf++ = *(volatile unsigned char *)portp; + } +} + +void _insw(unsigned int port, void * addr, unsigned long count) +{ + unsigned short *buf = addr; + unsigned short *portp; + + if (port >= LAN_IOSTART && port < LAN_IOEND) + portp = PORT2ADDR_NE(port); + while (count--) *buf++ = *(volatile unsigned short *)portp; +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + } else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_ioread_word(9, port, (void *)addr, sizeof(unsigned short), count, 1); +#endif + } else { + portp = PORT2ADDR(port); + while (count--) *buf++ = *(volatile unsigned short *)portp; + } +} + +void _insl(unsigned int port, void * addr, unsigned long count) +{ + unsigned long *buf = addr; + unsigned long *portp; + + portp = PORT2ADDR(port); + while (count--) *buf++ = *(volatile unsigned long *)portp; +} + +void _outsb(unsigned int port, const void * addr, unsigned long count) +{ + const unsigned char *buf = addr; + unsigned char *portp; + + if (port >= LAN_IOSTART && port < LAN_IOEND) + portp = PORT2ADDR_NE(port); + while (count--) _ne_outb(*buf++, portp); +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + } else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite_byte(0, port, (void *)addr, sizeof(unsigned char), count, 1); +#endif + } else { + portp = PORT2ADDR(port); + while(count--) *(volatile unsigned char *)portp = *buf++; + } +} + +void _outsw(unsigned int port, const void * addr, unsigned long count) +{ + const unsigned short *buf = addr; + unsigned short *portp; + + if (port >= LAN_IOSTART && port < LAN_IOEND) + portp = PORT2ADDR_NE(port); + while (count--) *(volatile unsigned short *)portp = *buf++; +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + } else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite_word(9, port, (void *)addr, sizeof(unsigned short), count, 1); +#endif + } else { + portp = PORT2ADDR(port); + while(count--) *(volatile unsigned short *)portp = *buf++; + } +} + +void _outsl(unsigned int port, const void * addr, unsigned long count) +{ + const unsigned long *buf = addr; + unsigned char *portp; + + portp = PORT2ADDR(port); + while(count--) *(volatile unsigned long *)portp = *buf++; +} diff -Nru a/arch/m32r/kernel/io_oaks32r.c b/arch/m32r/kernel/io_oaks32r.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/io_oaks32r.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,243 @@ +/* + * linux/arch/m32r/kernel/io_oaks32r.c + * + * Typical I/O routines for OAKS32R board. + * + * Copyright (c) 2001-2004 Hiroyuki Kondo, Hirokazu Takata, + * Hitoshi Yamamoto, Mamoru Sakugawa + */ + +/* $Id$ */ + +#include +#include +#include +#include + +#define PORT2ADDR(port) _port2addr(port) + +static __inline__ void *_port2addr(unsigned long port) +{ + return (void *)(port + NONCACHE_OFFSET); +} + +static __inline__ void *_port2addr_ne(unsigned long port) +{ + return (void *)((port<<1) + NONCACHE_OFFSET + 0x02000000); +} + +static __inline__ void delay(void) +{ + __asm__ __volatile__ ("push r0; \n\t pop r0;" : : :"memory"); +} + +/* + * NIC I/O function + */ + +#define PORT2ADDR_NE(port) _port2addr_ne(port) + +static __inline__ unsigned char _ne_inb(void *portp) +{ + return *(volatile unsigned char *)(portp+1); +} + +static __inline__ unsigned short _ne_inw(void *portp) +{ + unsigned short tmp; + + tmp = *(unsigned short *)(portp) & 0xff; + tmp |= *(unsigned short *)(portp+2) << 8; + return tmp; +} + +static __inline__ void _ne_insb(void *portp, void * addr, unsigned long count) +{ + unsigned char *buf = addr; + while (count--) *buf++ = *(volatile unsigned char *)(portp+1); +} + +static __inline__ void _ne_outb(unsigned char b, void *portp) +{ + *(volatile unsigned char *)(portp+1) = b; +} + +static __inline__ void _ne_outw(unsigned short w, void *portp) +{ + *(volatile unsigned short *)portp = (w >> 8); + *(volatile unsigned short *)(portp+2) = (w & 0xff); +} + +unsigned char _inb(unsigned long port) +{ + if (port >= 0x300 && port < 0x320) + return _ne_inb(PORT2ADDR_NE(port)); + + return *(volatile unsigned char *)PORT2ADDR(port); +} + +unsigned short _inw(unsigned long port) +{ + if (port >= 0x300 && port < 0x320) + return _ne_inw(PORT2ADDR_NE(port)); + + return *(volatile unsigned short *)PORT2ADDR(port); +} + +unsigned long _inl(unsigned long port) +{ + return *(volatile unsigned long *)PORT2ADDR(port); +} + +unsigned char _inb_p(unsigned long port) +{ + unsigned char v; + + if (port >= 0x300 && port < 0x320) + v = _ne_inb(PORT2ADDR_NE(port)); + else + v = *(volatile unsigned char *)PORT2ADDR(port); + + delay(); + return (v); +} + +unsigned short _inw_p(unsigned long port) +{ + unsigned short v; + + if (port >= 0x300 && port < 0x320) + v = _ne_inw(PORT2ADDR_NE(port)); + else + v = *(volatile unsigned short *)PORT2ADDR(port); + + delay(); + return (v); +} + +unsigned long _inl_p(unsigned long port) +{ + unsigned long v; + + v = *(volatile unsigned long *)PORT2ADDR(port); + delay(); + return (v); +} + +void _outb(unsigned char b, unsigned long port) +{ + if (port >= 0x300 && port < 0x320) + _ne_outb(b, PORT2ADDR_NE(port)); + else + *(volatile unsigned char *)PORT2ADDR(port) = b; +} + +void _outw(unsigned short w, unsigned long port) +{ + if (port >= 0x300 && port < 0x320) + _ne_outw(w, PORT2ADDR_NE(port)); + else + *(volatile unsigned short *)PORT2ADDR(port) = w; +} + +void _outl(unsigned long l, unsigned long port) +{ + *(volatile unsigned long *)PORT2ADDR(port) = l; +} + +void _outb_p(unsigned char b, unsigned long port) +{ + if (port >= 0x300 && port < 0x320) + _ne_outb(b, PORT2ADDR_NE(port)); + else + *(volatile unsigned char *)PORT2ADDR(port) = b; + + delay(); +} + +void _outw_p(unsigned short w, unsigned long port) +{ + if (port >= 0x300 && port < 0x320) + _ne_outw(w, PORT2ADDR_NE(port)); + else + *(volatile unsigned short *)PORT2ADDR(port) = w; + + delay(); +} + +void _outl_p(unsigned long l, unsigned long port) +{ + *(volatile unsigned long *)PORT2ADDR(port) = l; + delay(); +} + +void _insb(unsigned int port, void * addr, unsigned long count) +{ + if (port >= 0x300 && port < 0x320) + _ne_insb(PORT2ADDR_NE(port), addr, count); + else { + unsigned char *buf = addr; + unsigned char *portp = PORT2ADDR(port); + while(count--) *buf++ = *(volatile unsigned char *)portp; + } +} + +void _insw(unsigned int port, void * addr, unsigned long count) +{ + unsigned short *buf = addr; + unsigned short *portp; + + if (port >= 0x300 && port < 0x320) { + portp = PORT2ADDR_NE(port); + while (count--) *buf++ = _ne_inw(portp); + } else { + portp = PORT2ADDR(port); + while (count--) *buf++ = *(volatile unsigned short *)portp; + } +} + +void _insl(unsigned int port, void * addr, unsigned long count) +{ + unsigned long *buf = addr; + unsigned long *portp; + + portp = PORT2ADDR(port); + while (count--) *buf++ = *(volatile unsigned long *)portp; +} + +void _outsb(unsigned int port, const void * addr, unsigned long count) +{ + const unsigned char *buf = addr; + unsigned char *portp; + + if (port >= 0x300 && port < 0x320) { + portp = PORT2ADDR_NE(port); + while (count--) _ne_outb(*buf++, portp); + } else { + portp = PORT2ADDR(port); + while(count--) *(volatile unsigned char *)portp = *buf++; + } +} + +void _outsw(unsigned int port, const void * addr, unsigned long count) +{ + const unsigned short *buf = addr; + unsigned short *portp; + + if (port >= 0x300 && port < 0x320) { + portp = PORT2ADDR_NE(port); + while (count--) _ne_outw(*buf++, portp); + } else { + portp = PORT2ADDR(port); + while(count--) *(volatile unsigned short *)portp = *buf++; + } +} + +void _outsl(unsigned int port, const void * addr, unsigned long count) +{ + const unsigned long *buf = addr; + unsigned char *portp; + + portp = PORT2ADDR(port); + while(count--) *(volatile unsigned long *)portp = *buf++; +} diff -Nru a/arch/m32r/kernel/io_opsput.c b/arch/m32r/kernel/io_opsput.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/io_opsput.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,377 @@ +/* + * linux/arch/m32r/kernel/io_mappi.c + * + * Typical I/O routines for OPSPUT board. + * + * Copyright (c) 2001, 2002 Hiroyuki Kondo, Hirokazu Takata, + * Hitoshi Yamamoto, Takeo Takahashi + * + * 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. + * + */ + +#include +#include +#include +#include +#include + +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) +#include + +#define M32R_PCC_IOMAP_SIZE 0x1000 + +#define M32R_PCC_IOSTART0 0x1000 +#define M32R_PCC_IOEND0 (M32R_PCC_IOSTART0 + M32R_PCC_IOMAP_SIZE - 1) + +extern void pcc_ioread_byte(int, unsigned long, void *, size_t, size_t, int); +extern void pcc_ioread_word(int, unsigned long, void *, size_t, size_t, int); +extern void pcc_iowrite_byte(int, unsigned long, void *, size_t, size_t, int); +extern void pcc_iowrite_word(int, unsigned long, void *, size_t, size_t, int); +#endif /* CONFIG_PCMCIA && CONFIG_M32R_CFC */ + +#define PORT2ADDR(port) _port2addr(port) +#define PORT2ADDR_USB(port) _port2addr_usb(port) + +static __inline__ void *_port2addr(unsigned long port) +{ + return (void *)(port + NONCACHE_OFFSET); +} + +/* + * OPSPUT-LAN is located in the extended bus space + * from 0x10000000 to 0x13ffffff on physical address. + * The base address of LAN controller(LAN91C111) is 0x300. + */ +#define LAN_IOSTART 0x300 +#define LAN_IOEND 0x320 +static __inline__ void *_port2addr_ne(unsigned long port) +{ + return (void *)(port + NONCACHE_OFFSET + 0x10000000); +} +static __inline__ void *_port2addr_usb(unsigned long port) +{ + return (void *)((port & 0x0f) + NONCACHE_OFFSET + 0x10303000); +} + +static __inline__ void delay(void) +{ + __asm__ __volatile__ ("push r0; \n\t pop r0;" : : :"memory"); +} + +/* + * NIC I/O function + */ + +#define PORT2ADDR_NE(port) _port2addr_ne(port) + +static __inline__ unsigned char _ne_inb(void *portp) +{ + return *(volatile unsigned char *)portp; +} + +static __inline__ unsigned short _ne_inw(void *portp) +{ + return (unsigned short)le16_to_cpu(*(volatile unsigned short *)portp); +} + +static __inline__ void _ne_insb(void *portp, void * addr, unsigned long count) +{ + unsigned char *buf = (unsigned char *)addr; + + while (count--) *buf++ = _ne_inb(portp); +} + +static __inline__ void _ne_outb(unsigned char b, void *portp) +{ + *(volatile unsigned char *)portp = b; +} + +static __inline__ void _ne_outw(unsigned short w, void *portp) +{ + *(volatile unsigned short *)portp = cpu_to_le16(w); +} + +unsigned char _inb(unsigned long port) +{ + if (port >= LAN_IOSTART && port < LAN_IOEND) + return _ne_inb(PORT2ADDR_NE(port)); + +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + unsigned char b; + pcc_ioread_byte(0, port, &b, sizeof(b), 1, 0); + return b; + } else +#endif + + return *(volatile unsigned char *)PORT2ADDR(port); +} + +unsigned short _inw(unsigned long port) +{ + if (port >= LAN_IOSTART && port < LAN_IOEND) + return _ne_inw(PORT2ADDR_NE(port)); +#if defined(CONFIG_USB) + else if(port >= 0x340 && port < 0x3a0) + return *(volatile unsigned short *)PORT2ADDR_USB(port); +#endif + +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + unsigned short w; + pcc_ioread_word(0, port, &w, sizeof(w), 1, 0); + return w; + } else +#endif + return *(volatile unsigned short *)PORT2ADDR(port); +} + +unsigned long _inl(unsigned long port) +{ +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + unsigned long l; + pcc_ioread_word(0, port, &l, sizeof(l), 1, 0); + return l; + } else +#endif + return *(volatile unsigned long *)PORT2ADDR(port); +} + +unsigned char _inb_p(unsigned long port) +{ + unsigned char v; + + if (port >= LAN_IOSTART && port < LAN_IOEND) + v = _ne_inb(PORT2ADDR_NE(port)); + else +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + unsigned char b; + pcc_ioread_byte(0, port, &b, sizeof(b), 1, 0); + return b; + } else +#endif + v = *(volatile unsigned char *)PORT2ADDR(port); + + delay(); + return (v); +} + +unsigned short _inw_p(unsigned long port) +{ + unsigned short v; + + if (port >= LAN_IOSTART && port < LAN_IOEND) + v = _ne_inw(PORT2ADDR_NE(port)); + else +#if defined(CONFIG_USB) + if(port >= 0x340 && port < 0x3a0) + return *(volatile unsigned short *)PORT2ADDR_USB(port); + else +#endif + +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + unsigned short w; + pcc_ioread_word(0, port, &w, sizeof(w), 1, 0); + return w; + } else +#endif + v = *(volatile unsigned short *)PORT2ADDR(port); + + delay(); + return (v); +} + +unsigned long _inl_p(unsigned long port) +{ + unsigned long v; + + v = *(volatile unsigned long *)PORT2ADDR(port); + delay(); + return (v); +} + +void _outb(unsigned char b, unsigned long port) +{ + if (port >= LAN_IOSTART && port < LAN_IOEND) + _ne_outb(b, PORT2ADDR_NE(port)); + else +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite_byte(0, port, &b, sizeof(b), 1, 0); + } else +#endif + *(volatile unsigned char *)PORT2ADDR(port) = b; +} + +void _outw(unsigned short w, unsigned long port) +{ + if (port >= LAN_IOSTART && port < LAN_IOEND) + _ne_outw(w, PORT2ADDR_NE(port)); + else +#if defined(CONFIG_USB) + if(port >= 0x340 && port < 0x3a0) + *(volatile unsigned short *)PORT2ADDR_USB(port) = w; + else +#endif + +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite_word(0, port, &w, sizeof(w), 1, 0); + } else +#endif + *(volatile unsigned short *)PORT2ADDR(port) = w; +} + +void _outl(unsigned long l, unsigned long port) +{ +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite_word(0, port, &l, sizeof(l), 1, 0); + } else +#endif + *(volatile unsigned long *)PORT2ADDR(port) = l; +} + +void _outb_p(unsigned char b, unsigned long port) +{ + if (port >= LAN_IOSTART && port < LAN_IOEND) + _ne_outb(b, PORT2ADDR_NE(port)); + else +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite_byte(0, port, &b, sizeof(b), 1, 0); + } else +#endif + *(volatile unsigned char *)PORT2ADDR(port) = b; + + delay(); +} + +void _outw_p(unsigned short w, unsigned long port) +{ + if (port >= LAN_IOSTART && port < LAN_IOEND) + _ne_outw(w, PORT2ADDR_NE(port)); + else +#if defined(CONFIG_USB) + if(port >= 0x340 && port < 0x3a0) + *(volatile unsigned short *)PORT2ADDR_USB(port) = w; + else +#endif + +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite_word(0, port, &w, sizeof(w), 1, 0); + } else +#endif + *(volatile unsigned short *)PORT2ADDR(port) = w; + + delay(); +} + +void _outl_p(unsigned long l, unsigned long port) +{ + *(volatile unsigned long *)PORT2ADDR(port) = l; + delay(); +} + +void _insb(unsigned int port, void * addr, unsigned long count) +{ + if (port >= LAN_IOSTART && port < LAN_IOEND) + _ne_insb(PORT2ADDR_NE(port), addr, count); +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_ioread_byte(0, port, (void *)addr, sizeof(unsigned char), count, 1); + } +#endif + else { + unsigned char *buf = addr; + unsigned char *portp = PORT2ADDR(port); + while(count--) *buf++ = *(volatile unsigned char *)portp; + } +} + +void _insw(unsigned int port, void * addr, unsigned long count) +{ + unsigned short *buf = addr; + unsigned short *portp; + + if (port >= LAN_IOSTART && port < LAN_IOEND) { + /* + * This portion is only used by smc91111.c to read data + * from the DATA_REG. Do not swap the data. + */ + portp = PORT2ADDR_NE(port); + while (count--) *buf++ = *(volatile unsigned short *)portp; +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + } else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_ioread_word(9, port, (void *)addr, sizeof(unsigned short), count, 1); +#endif + } else { + portp = PORT2ADDR(port); + while (count--) *buf++ = *(volatile unsigned short *)portp; + } +} + +void _insl(unsigned int port, void * addr, unsigned long count) +{ + unsigned long *buf = addr; + unsigned long *portp; + + portp = PORT2ADDR(port); + while (count--) *buf++ = *(volatile unsigned long *)portp; +} + +void _outsb(unsigned int port, const void * addr, unsigned long count) +{ + const unsigned char *buf = addr; + unsigned char *portp; + + if (port >= LAN_IOSTART && port < LAN_IOEND) { + portp = PORT2ADDR_NE(port); + while (count--) _ne_outb(*buf++, portp); +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + } else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite_byte(0, port, (void *)addr, sizeof(unsigned char), count, 1); +#endif + } else { + portp = PORT2ADDR(port); + while(count--) *(volatile unsigned char *)portp = *buf++; + } +} + +void _outsw(unsigned int port, const void * addr, unsigned long count) +{ + const unsigned short *buf = addr; + unsigned short *portp; + + if (port >= LAN_IOSTART && port < LAN_IOEND) { + /* + * This portion is only used by smc91111.c to write data + * into the DATA_REG. Do not swap the data. + */ + portp = PORT2ADDR_NE(port); + while(count--) *(volatile unsigned short *)portp = *buf++; +#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) + } else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { + pcc_iowrite_word(9, port, (void *)addr, sizeof(unsigned short), count, 1); +#endif + } else { + portp = PORT2ADDR(port); + while(count--) *(volatile unsigned short *)portp = *buf++; + } +} + +void _outsl(unsigned int port, const void * addr, unsigned long count) +{ + const unsigned long *buf = addr; + unsigned char *portp; + + portp = PORT2ADDR(port); + while(count--) *(volatile unsigned long *)portp = *buf++; +} diff -Nru a/arch/m32r/kernel/io_usrv.c b/arch/m32r/kernel/io_usrv.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/io_usrv.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,247 @@ +/* + * linux/arch/m32r/kernel/io_usrv.c + * + * Typical I/O routines for uServer board. + * + * Copyright (c) 2001 - 2003 Hiroyuki Kondo, Hirokazu Takata, + * Hitoshi Yamamoto, Takeo Takahashi + * + * 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. + * + */ + +#include +#include +#include +#include + +#include +#include "../drivers/m32r_cfc.h" + +extern void pcc_ioread_byte(int, unsigned long, void *, size_t, size_t, int); +extern void pcc_ioread_word(int, unsigned long, void *, size_t, size_t, int); +extern void pcc_iowrite_byte(int, unsigned long, void *, size_t, size_t, int); +extern void pcc_iowrite_word(int, unsigned long, void *, size_t, size_t, int); +#define CFC_IOSTART CFC_IOPORT_BASE +#define CFC_IOEND (CFC_IOSTART + (M32R_PCC_MAPSIZE * M32R_MAX_PCC) - 1) + +#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE) +#define UART0_REGSTART 0x04c20000 +#define UART1_REGSTART 0x04c20100 +#define UART_IOMAP_SIZE 8 +#define UART0_IOSTART 0x3f8 +#define UART0_IOEND (UART0_IOSTART + UART_IOMAP_SIZE - 1) +#define UART1_IOSTART 0x2f8 +#define UART1_IOEND (UART1_IOSTART + UART_IOMAP_SIZE - 1) +#endif /* CONFIG_SERIAL_8250 || CONFIG_SERIAL_8250_MODULE */ + +#define PORT2ADDR(port) _port2addr(port) + +static __inline__ void *_port2addr(unsigned long port) +{ +#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE) + if (port >= UART0_IOSTART && port <= UART0_IOEND) + port = ((port - UART0_IOSTART) << 1) + UART0_REGSTART; + else if (port >= UART1_IOSTART && port <= UART1_IOEND) + port = ((port - UART1_IOSTART) << 1) + UART1_REGSTART; +#endif /* CONFIG_SERIAL_8250 || CONFIG_SERIAL_8250_MODULE */ + return (void *)(port + NONCACHE_OFFSET); +} + +static __inline__ void delay(void) +{ + __asm__ __volatile__ ("push r0; \n\t pop r0;" : : :"memory"); +} + +unsigned char _inb(unsigned long port) +{ + if (port >= CFC_IOSTART && port <= CFC_IOEND) { + unsigned char b; + pcc_ioread_byte(0, port, &b, sizeof(b), 1, 0); + return b; + } else + return *(volatile unsigned char *)PORT2ADDR(port); +} + +unsigned short _inw(unsigned long port) +{ + if (port >= CFC_IOSTART && port <= CFC_IOEND) { + unsigned short w; + pcc_ioread_word(0, port, &w, sizeof(w), 1, 0); + return w; + } else + return *(volatile unsigned short *)PORT2ADDR(port); +} + +unsigned long _inl(unsigned long port) +{ + if (port >= CFC_IOSTART && port <= CFC_IOEND) { + unsigned long l; + pcc_ioread_word(0, port, &l, sizeof(l), 1, 0); + return l; + } else + return *(volatile unsigned long *)PORT2ADDR(port); +} + +unsigned char _inb_p(unsigned long port) +{ + unsigned char b; + + if (port >= CFC_IOSTART && port <= CFC_IOEND) { + pcc_ioread_byte(0, port, &b, sizeof(b), 1, 0); + return b; + } else { + b = *(volatile unsigned char *)PORT2ADDR(port); + delay(); + return b; + } +} + +unsigned short _inw_p(unsigned long port) +{ + unsigned short w; + + if (port >= CFC_IOSTART && port <= CFC_IOEND) { + pcc_ioread_word(0, port, &w, sizeof(w), 1, 0); + return w; + } else { + w = *(volatile unsigned short *)PORT2ADDR(port); + delay(); + return w; + } +} + +unsigned long _inl_p(unsigned long port) +{ + unsigned long v; + + v = *(volatile unsigned long *)PORT2ADDR(port); + delay(); + + return v; +} + +void _outb(unsigned char b, unsigned long port) +{ + if (port >= CFC_IOSTART && port <= CFC_IOEND) + pcc_iowrite_byte(0, port, &b, sizeof(b), 1, 0); + else + *(volatile unsigned char *)PORT2ADDR(port) = b; +} + +void _outw(unsigned short w, unsigned long port) +{ + if (port >= CFC_IOSTART && port <= CFC_IOEND) + pcc_iowrite_word(0, port, &w, sizeof(w), 1, 0); + else + *(volatile unsigned short *)PORT2ADDR(port) = w; +} + +void _outl(unsigned long l, unsigned long port) +{ + if (port >= CFC_IOSTART && port <= CFC_IOEND) + pcc_iowrite_word(0, port, &l, sizeof(l), 1, 0); + else + *(volatile unsigned long *)PORT2ADDR(port) = l; +} + +void _outb_p(unsigned char b, unsigned long port) +{ + if (port >= CFC_IOSTART && port <= CFC_IOEND) + pcc_iowrite_byte(0, port, &b, sizeof(b), 1, 0); + else + *(volatile unsigned char *)PORT2ADDR(port) = b; + delay(); +} + +void _outw_p(unsigned short w, unsigned long port) +{ + if (port >= CFC_IOSTART && port <= CFC_IOEND) + pcc_iowrite_word(0, port, &w, sizeof(w), 1, 0); + else + *(volatile unsigned short *)PORT2ADDR(port) = w; + delay(); +} + +void _outl_p(unsigned long l, unsigned long port) +{ + *(volatile unsigned long *)PORT2ADDR(port) = l; + delay(); +} + +void _insb(unsigned int port, void * addr, unsigned long count) +{ + if (port >= CFC_IOSTART && port <= CFC_IOEND) + pcc_ioread_byte(0, port, addr, sizeof(unsigned char), count, 1); + else { + unsigned char *buf = addr; + unsigned char *portp = PORT2ADDR(port); + while(count--) *buf++ = *(volatile unsigned char *)portp; + } +} + +void _insw(unsigned int port, void * addr, unsigned long count) +{ + unsigned short *buf = addr; + unsigned short *portp; + + if (port >= CFC_IOSTART && port <= CFC_IOEND) + pcc_ioread_word(0, port, addr, sizeof(unsigned short), count, + 1); + else { + portp = PORT2ADDR(port); + while (count--) *buf++ = *(volatile unsigned short *)portp; + } +} + +void _insl(unsigned int port, void * addr, unsigned long count) +{ + unsigned long *buf = addr; + unsigned long *portp; + + portp = PORT2ADDR(port); + while (count--) + *buf++ = *(volatile unsigned long *)portp; +} + +void _outsb(unsigned int port, const void * addr, unsigned long count) +{ + const unsigned char *buf = addr; + unsigned char *portp; + + if (port >= CFC_IOSTART && port <= CFC_IOEND) + pcc_iowrite_byte(0, port, (void *)addr, sizeof(unsigned char), + count, 1); + else { + portp = PORT2ADDR(port); + while (count--) + *(volatile unsigned char *)portp = *buf++; + } +} + +void _outsw(unsigned int port, const void * addr, unsigned long count) +{ + const unsigned short *buf = addr; + unsigned short *portp; + + if (port >= CFC_IOSTART && port <= CFC_IOEND) + pcc_iowrite_word(0, port, (void *)addr, sizeof(unsigned short), + count, 1); + else { + portp = PORT2ADDR(port); + while (count--) + *(volatile unsigned short *)portp = *buf++; + } +} + +void _outsl(unsigned int port, const void * addr, unsigned long count) +{ + const unsigned long *buf = addr; + unsigned char *portp; + + portp = PORT2ADDR(port); + while (count--) + *(volatile unsigned long *)portp = *buf++; +} diff -Nru a/arch/m32r/kernel/irq.c b/arch/m32r/kernel/irq.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/irq.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,1018 @@ +/* + * linux/arch/m32r/kernel/irq.c + * + * Copyright (c) 2003, 2004 Hitoshi Yamamoto + * + * Taken from i386 2.6.4 version. + */ + +/* + * linux/arch/i386/kernel/irq.c + * + * Copyright (C) 1992, 1998 Linus Torvalds, Ingo Molnar + * + * This file contains the code used by various IRQ handling routines: + * asking for different IRQ's should be done through these routines + * instead of just grabbing them. Thus setups with different IRQ numbers + * shouldn't result in any weird surprises, and installing new handlers + * should be easier. + */ + +/* + * (mostly architecture independent, will move to kernel/irq.c in 2.5.) + * + * IRQs are in fact implemented a bit like signal handlers for the kernel. + * Naturally it's not a 1:1 relation, but there are similarities. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Linux has a controller-independent x86 interrupt architecture. + * every controller has a 'controller-template', that is used + * by the main code to do the right thing. Each driver-visible + * interrupt source is transparently wired to the apropriate + * controller. Thus drivers need not be aware of the + * interrupt-controller. + * + * Various interrupt controllers we handle: 8259 PIC, SMP IO-APIC, + * PIIX4's internal 8259 PIC and SGI's Visual Workstation Cobalt (IO-)APIC. + * (IO-APICs assumed to be messaging to Pentium local-APICs) + * + * the code is designed to be easily extended with new/different + * interrupt controllers, without having to do assembly magic. + */ + +/* + * Controller mappings for all interrupt sources: + */ +irq_desc_t irq_desc[NR_IRQS] __cacheline_aligned = { + [0 ... NR_IRQS-1] = { + .handler = &no_irq_type, + .lock = SPIN_LOCK_UNLOCKED + } +}; + +static void register_irq_proc (unsigned int irq); + +/* + * Special irq handlers. + */ + +irqreturn_t no_action(int cpl, void *dev_id, struct pt_regs *regs) +{ return IRQ_NONE; } + +/* + * Generic no controller code + */ + +static void enable_none(unsigned int irq) { } +static unsigned int startup_none(unsigned int irq) { return 0; } +static void disable_none(unsigned int irq) { } +static void ack_none(unsigned int irq) +{ +/* + * 'what should we do if we get a hw irq event on an illegal vector'. + * each architecture has to answer this themselves, it doesn't deserve + * a generic callback i think. + */ + printk("unexpected IRQ trap at vector %02x\n", irq); +} + +/* startup is the same as "enable", shutdown is same as "disable" */ +#define shutdown_none disable_none +#define end_none enable_none + +struct hw_interrupt_type no_irq_type = { + "none", + startup_none, + shutdown_none, + enable_none, + disable_none, + ack_none, + end_none +}; + +atomic_t irq_err_count; +atomic_t irq_mis_count; + +/* + * Generic, controller-independent functions: + */ + +int show_interrupts(struct seq_file *p, void *v) +{ + int i = *(loff_t *) v, j; + struct irqaction * action; + unsigned long flags; + + if (i == 0) { + seq_printf(p, " "); + for (j=0; jtypename); + seq_printf(p, " %s", action->name); + + for (action=action->next; action; action = action->next) + seq_printf(p, ", %s", action->name); + + seq_putc(p, '\n'); +skip: + spin_unlock_irqrestore(&irq_desc[i].lock, flags); + } else if (i == NR_IRQS) { + seq_printf(p, "ERR: %10u\n", atomic_read(&irq_err_count)); + seq_printf(p, "MIS: %10u\n", atomic_read(&irq_mis_count)); + } + return 0; +} + +#ifdef CONFIG_SMP +inline void synchronize_irq(unsigned int irq) +{ + while (irq_desc[irq].status & IRQ_INPROGRESS) + cpu_relax(); +} +#endif + +/* + * This should really return information about whether + * we should do bottom half handling etc. Right now we + * end up _always_ checking the bottom half, which is a + * waste of time and is not what some drivers would + * prefer. + */ +int handle_IRQ_event(unsigned int irq, + struct pt_regs *regs, struct irqaction *action) +{ + int status = 1; /* Force the "do bottom halves" bit */ + int retval = 0; + + if (!(action->flags & SA_INTERRUPT)) + local_irq_enable(); + + do { + status |= action->flags; + retval |= action->handler(irq, action->dev_id, regs); + action = action->next; + } while (action); + if (status & SA_SAMPLE_RANDOM) + add_interrupt_randomness(irq); + local_irq_disable(); + return retval; +} + +static void __report_bad_irq(int irq, irq_desc_t *desc, irqreturn_t action_ret) +{ + struct irqaction *action; + + if (action_ret != IRQ_HANDLED && action_ret != IRQ_NONE) { + printk(KERN_ERR "irq event %d: bogus return value %x\n", + irq, action_ret); + } else { + printk(KERN_ERR "irq %d: nobody cared!\n", irq); + } + dump_stack(); + printk(KERN_ERR "handlers:\n"); + action = desc->action; + do { + printk(KERN_ERR "[<%p>]", action->handler); + print_symbol(" (%s)", + (unsigned long)action->handler); + printk("\n"); + action = action->next; + } while (action); +} + +static void report_bad_irq(int irq, irq_desc_t *desc, irqreturn_t action_ret) +{ + static int count = 100; + + if (count) { + count--; + __report_bad_irq(irq, desc, action_ret); + } +} + +static int noirqdebug; + +static int __init noirqdebug_setup(char *str) +{ + noirqdebug = 1; + printk("IRQ lockup detection disabled\n"); + return 1; +} + +__setup("noirqdebug", noirqdebug_setup); + +/* + * If 99,900 of the previous 100,000 interrupts have not been handled then + * assume that the IRQ is stuck in some manner. Drop a diagnostic and try to + * turn the IRQ off. + * + * (The other 100-of-100,000 interrupts may have been a correctly-functioning + * device sharing an IRQ with the failing one) + * + * Called under desc->lock + */ +static void note_interrupt(int irq, irq_desc_t *desc, irqreturn_t action_ret) +{ + if (action_ret != IRQ_HANDLED) { + desc->irqs_unhandled++; + if (action_ret != IRQ_NONE) + report_bad_irq(irq, desc, action_ret); + } + + desc->irq_count++; + if (desc->irq_count < 100000) + return; + + desc->irq_count = 0; + if (desc->irqs_unhandled > 99900) { + /* + * The interrupt is stuck + */ + __report_bad_irq(irq, desc, action_ret); + /* + * Now kill the IRQ + */ + printk(KERN_EMERG "Disabling IRQ #%d\n", irq); + desc->status |= IRQ_DISABLED; + desc->handler->disable(irq); + } + desc->irqs_unhandled = 0; +} + +/* + * Generic enable/disable code: this just calls + * down into the PIC-specific version for the actual + * hardware disable after having gotten the irq + * controller lock. + */ + +/** + * disable_irq_nosync - disable an irq without waiting + * @irq: Interrupt to disable + * + * Disable the selected interrupt line. Disables and Enables are + * nested. + * Unlike disable_irq(), this function does not ensure existing + * instances of the IRQ handler have completed before returning. + * + * This function may be called from IRQ context. + */ + +inline void disable_irq_nosync(unsigned int irq) +{ + irq_desc_t *desc = irq_desc + irq; + unsigned long flags; + + spin_lock_irqsave(&desc->lock, flags); + if (!desc->depth++) { + desc->status |= IRQ_DISABLED; + desc->handler->disable(irq); + } + spin_unlock_irqrestore(&desc->lock, flags); +} + +/** + * disable_irq - disable an irq and wait for completion + * @irq: Interrupt to disable + * + * Disable the selected interrupt line. Enables and Disables are + * nested. + * This function waits for any pending IRQ handlers for this interrupt + * to complete before returning. If you use this function while + * holding a resource the IRQ handler may need you will deadlock. + * + * This function may be called - with care - from IRQ context. + */ + +void disable_irq(unsigned int irq) +{ + irq_desc_t *desc = irq_desc + irq; + disable_irq_nosync(irq); + if (desc->action) + synchronize_irq(irq); +} + +/** + * enable_irq - enable handling of an irq + * @irq: Interrupt to enable + * + * Undoes the effect of one call to disable_irq(). If this + * matches the last disable, processing of interrupts on this + * IRQ line is re-enabled. + * + * This function may be called from IRQ context. + */ + +void enable_irq(unsigned int irq) +{ + irq_desc_t *desc = irq_desc + irq; + unsigned long flags; + + spin_lock_irqsave(&desc->lock, flags); + switch (desc->depth) { + case 1: { + unsigned int status = desc->status & ~IRQ_DISABLED; + desc->status = status; + if ((status & (IRQ_PENDING | IRQ_REPLAY)) == IRQ_PENDING) { + desc->status = status | IRQ_REPLAY; + hw_resend_irq(desc->handler,irq); + } + desc->handler->enable(irq); + /* fall-through */ + } + default: + desc->depth--; + break; + case 0: + printk("enable_irq(%u) unbalanced from %p\n", irq, + __builtin_return_address(0)); + } + spin_unlock_irqrestore(&desc->lock, flags); +} + +/* + * do_IRQ handles all normal device IRQ's (the special + * SMP cross-CPU interrupts have their own specific + * handlers). + */ +asmlinkage unsigned int do_IRQ(int irq, struct pt_regs *regs) +{ + /* + * We ack quickly, we don't want the irq controller + * thinking we're snobs just because some other CPU has + * disabled global interrupts (we have already done the + * INT_ACK cycles, it's too late to try to pretend to the + * controller that we aren't taking the interrupt). + * + * 0 return value means that this irq is already being + * handled by some other CPU. (or is disabled) + */ + irq_desc_t *desc = irq_desc + irq; + struct irqaction * action; + unsigned int status; + + irq_enter(); + +#ifdef CONFIG_DEBUG_STACKOVERFLOW + /* FIXME M32R */ +#endif + kstat_this_cpu.irqs[irq]++; + spin_lock(&desc->lock); + desc->handler->ack(irq); + /* + REPLAY is when Linux resends an IRQ that was dropped earlier + WAITING is used by probe to mark irqs that are being tested + */ + status = desc->status & ~(IRQ_REPLAY | IRQ_WAITING); + status |= IRQ_PENDING; /* we _want_ to handle it */ + + /* + * If the IRQ is disabled for whatever reason, we cannot + * use the action we have. + */ + action = NULL; + if (likely(!(status & (IRQ_DISABLED | IRQ_INPROGRESS)))) { + action = desc->action; + status &= ~IRQ_PENDING; /* we commit to handling */ + status |= IRQ_INPROGRESS; /* we are handling it */ + } + desc->status = status; + + /* + * If there is no IRQ handler or it was disabled, exit early. + Since we set PENDING, if another processor is handling + a different instance of this same irq, the other processor + will take care of it. + */ + if (unlikely(!action)) + goto out; + + /* + * Edge triggered interrupts need to remember + * pending events. + * This applies to any hw interrupts that allow a second + * instance of the same irq to arrive while we are in do_IRQ + * or in the handler. But the code here only handles the _second_ + * instance of the irq, not the third or fourth. So it is mostly + * useful for irq hardware that does not mask cleanly in an + * SMP environment. + */ + for (;;) { + irqreturn_t action_ret; + + spin_unlock(&desc->lock); + action_ret = handle_IRQ_event(irq, regs, action); + spin_lock(&desc->lock); + if (!noirqdebug) + note_interrupt(irq, desc, action_ret); + if (likely(!(desc->status & IRQ_PENDING))) + break; + desc->status &= ~IRQ_PENDING; + } + desc->status &= ~IRQ_INPROGRESS; + +out: + /* + * The ->end() handler has to deal with interrupts which got + * disabled while the handler was running. + */ + desc->handler->end(irq); + spin_unlock(&desc->lock); + + irq_exit(); + +#if defined(CONFIG_SMP) + if (irq == M32R_IRQ_MFT2) + smp_send_timer(); +#endif /* CONFIG_SMP */ + + return 1; +} + +int can_request_irq(unsigned int irq, unsigned long irqflags) +{ + struct irqaction *action; + + if (irq >= NR_IRQS) + return 0; + action = irq_desc[irq].action; + if (action) { + if (irqflags & action->flags & SA_SHIRQ) + action = NULL; + } + return !action; +} + +/** + * request_irq - allocate an interrupt line + * @irq: Interrupt line to allocate + * @handler: Function to be called when the IRQ occurs + * @irqflags: Interrupt type flags + * @devname: An ascii name for the claiming device + * @dev_id: A cookie passed back to the handler function + * + * This call allocates interrupt resources and enables the + * interrupt line and IRQ handling. From the point this + * call is made your handler function may be invoked. Since + * your handler function must clear any interrupt the board + * raises, you must take care both to initialise your hardware + * and to set up the interrupt handler in the right order. + * + * Dev_id must be globally unique. Normally the address of the + * device data structure is used as the cookie. Since the handler + * receives this value it makes sense to use it. + * + * If your interrupt is shared you must pass a non NULL dev_id + * as this is required when freeing the interrupt. + * + * Flags: + * + * SA_SHIRQ Interrupt is shared + * + * SA_INTERRUPT Disable local interrupts while processing + * + * SA_SAMPLE_RANDOM The interrupt can be used for entropy + * + */ + +int request_irq(unsigned int irq, + irqreturn_t (*handler)(int, void *, struct pt_regs *), + unsigned long irqflags, + const char * devname, + void *dev_id) +{ + int retval; + struct irqaction * action; + +#if 1 + /* + * Sanity-check: shared interrupts should REALLY pass in + * a real dev-ID, otherwise we'll have trouble later trying + * to figure out which interrupt is which (messes up the + * interrupt freeing logic etc). + */ + if (irqflags & SA_SHIRQ) { + if (!dev_id) + printk("Bad boy: %s (at 0x%x) called us without a dev_id!\n", devname, (&irq)[-1]); + } +#endif + + if (irq >= NR_IRQS) + return -EINVAL; + if (!handler) + return -EINVAL; + + action = (struct irqaction *) + kmalloc(sizeof(struct irqaction), GFP_ATOMIC); + if (!action) + return -ENOMEM; + + action->handler = handler; + action->flags = irqflags; + cpus_clear(action->mask); + action->name = devname; + action->next = NULL; + action->dev_id = dev_id; + + retval = setup_irq(irq, action); + if (retval) + kfree(action); + return retval; +} + +EXPORT_SYMBOL(request_irq); + +/** + * free_irq - free an interrupt + * @irq: Interrupt line to free + * @dev_id: Device identity to free + * + * Remove an interrupt handler. The handler is removed and if the + * interrupt line is no longer in use by any driver it is disabled. + * On a shared IRQ the caller must ensure the interrupt is disabled + * on the card it drives before calling this function. The function + * does not return until any executing interrupts for this IRQ + * have completed. + * + * This function must not be called from interrupt context. + */ + +void free_irq(unsigned int irq, void *dev_id) +{ + irq_desc_t *desc; + struct irqaction **p; + unsigned long flags; + + if (irq >= NR_IRQS) + return; + + desc = irq_desc + irq; + spin_lock_irqsave(&desc->lock,flags); + p = &desc->action; + for (;;) { + struct irqaction * action = *p; + if (action) { + struct irqaction **pp = p; + p = &action->next; + if (action->dev_id != dev_id) + continue; + + /* Found it - now remove it from the list of entries */ + *pp = action->next; + if (!desc->action) { + desc->status |= IRQ_DISABLED; + desc->handler->shutdown(irq); + } + spin_unlock_irqrestore(&desc->lock,flags); + + /* Wait to make sure it's not being used on another CPU */ + synchronize_irq(irq); + kfree(action); + return; + } + printk("Trying to free free IRQ%d\n",irq); + spin_unlock_irqrestore(&desc->lock,flags); + return; + } +} + +EXPORT_SYMBOL(free_irq); + +/* + * IRQ autodetection code.. + * + * This depends on the fact that any interrupt that + * comes in on to an unassigned handler will get stuck + * with "IRQ_WAITING" cleared and the interrupt + * disabled. + */ + +static DECLARE_MUTEX(probe_sem); + +/** + * probe_irq_on - begin an interrupt autodetect + * + * Commence probing for an interrupt. The interrupts are scanned + * and a mask of potential interrupt lines is returned. + * + */ + +unsigned long probe_irq_on(void) +{ + unsigned int i; + irq_desc_t *desc; + unsigned long val; + unsigned long delay; + + down(&probe_sem); + /* + * something may have generated an irq long ago and we want to + * flush such a longstanding irq before considering it as spurious. + */ + for (i = NR_IRQS-1; i > 0; i--) { + desc = irq_desc + i; + + spin_lock_irq(&desc->lock); + if (!irq_desc[i].action) + irq_desc[i].handler->startup(i); + spin_unlock_irq(&desc->lock); + } + + /* Wait for longstanding interrupts to trigger. */ + for (delay = jiffies + HZ/50; time_after(delay, jiffies); ) + /* about 20ms delay */ barrier(); + + /* + * enable any unassigned irqs + * (we must startup again here because if a longstanding irq + * happened in the previous stage, it may have masked itself) + */ + for (i = NR_IRQS-1; i > 0; i--) { + desc = irq_desc + i; + + spin_lock_irq(&desc->lock); + if (!desc->action) { + desc->status |= IRQ_AUTODETECT | IRQ_WAITING; + if (desc->handler->startup(i)) + desc->status |= IRQ_PENDING; + } + spin_unlock_irq(&desc->lock); + } + + /* + * Wait for spurious interrupts to trigger + */ + for (delay = jiffies + HZ/10; time_after(delay, jiffies); ) + /* about 100ms delay */ barrier(); + + /* + * Now filter out any obviously spurious interrupts + */ + val = 0; + for (i = 0; i < NR_IRQS; i++) { + irq_desc_t *desc = irq_desc + i; + unsigned int status; + + spin_lock_irq(&desc->lock); + status = desc->status; + + if (status & IRQ_AUTODETECT) { + /* It triggered already - consider it spurious. */ + if (!(status & IRQ_WAITING)) { + desc->status = status & ~IRQ_AUTODETECT; + desc->handler->shutdown(i); + } else + if (i < 32) + val |= 1 << i; + } + spin_unlock_irq(&desc->lock); + } + + return val; +} + +EXPORT_SYMBOL(probe_irq_on); + +/* + * Return a mask of triggered interrupts (this + * can handle only legacy ISA interrupts). + */ + +/** + * probe_irq_mask - scan a bitmap of interrupt lines + * @val: mask of interrupts to consider + * + * Scan the ISA bus interrupt lines and return a bitmap of + * active interrupts. The interrupt probe logic state is then + * returned to its previous value. + * + * Note: we need to scan all the irq's even though we will + * only return ISA irq numbers - just so that we reset them + * all to a known state. + */ +unsigned int probe_irq_mask(unsigned long val) +{ + int i; + unsigned int mask; + + mask = 0; + for (i = 0; i < NR_IRQS; i++) { + irq_desc_t *desc = irq_desc + i; + unsigned int status; + + spin_lock_irq(&desc->lock); + status = desc->status; + + if (status & IRQ_AUTODETECT) { + if (i < 16 && !(status & IRQ_WAITING)) + mask |= 1 << i; + + desc->status = status & ~IRQ_AUTODETECT; + desc->handler->shutdown(i); + } + spin_unlock_irq(&desc->lock); + } + up(&probe_sem); + + return mask & val; +} + +/* + * Return the one interrupt that triggered (this can + * handle any interrupt source). + */ + +/** + * probe_irq_off - end an interrupt autodetect + * @val: mask of potential interrupts (unused) + * + * Scans the unused interrupt lines and returns the line which + * appears to have triggered the interrupt. If no interrupt was + * found then zero is returned. If more than one interrupt is + * found then minus the first candidate is returned to indicate + * their is doubt. + * + * The interrupt probe logic state is returned to its previous + * value. + * + * BUGS: When used in a module (which arguably shouldnt happen) + * nothing prevents two IRQ probe callers from overlapping. The + * results of this are non-optimal. + */ + +int probe_irq_off(unsigned long val) +{ + int i, irq_found, nr_irqs; + + nr_irqs = 0; + irq_found = 0; + for (i = 0; i < NR_IRQS; i++) { + irq_desc_t *desc = irq_desc + i; + unsigned int status; + + spin_lock_irq(&desc->lock); + status = desc->status; + + if (status & IRQ_AUTODETECT) { + if (!(status & IRQ_WAITING)) { + if (!nr_irqs) + irq_found = i; + nr_irqs++; + } + desc->status = status & ~IRQ_AUTODETECT; + desc->handler->shutdown(i); + } + spin_unlock_irq(&desc->lock); + } + up(&probe_sem); + + if (nr_irqs > 1) + irq_found = -irq_found; + return irq_found; +} + +EXPORT_SYMBOL(probe_irq_off); + +/* this was setup_x86_irq but it seems pretty generic */ +int setup_irq(unsigned int irq, struct irqaction * new) +{ + int shared = 0; + unsigned long flags; + struct irqaction *old, **p; + irq_desc_t *desc = irq_desc + irq; + + if (desc->handler == &no_irq_type) + return -ENOSYS; + /* + * Some drivers like serial.c use request_irq() heavily, + * so we have to be careful not to interfere with a + * running system. + */ + if (new->flags & SA_SAMPLE_RANDOM) { + /* + * This function might sleep, we want to call it first, + * outside of the atomic block. + * Yes, this might clear the entropy pool if the wrong + * driver is attempted to be loaded, without actually + * installing a new handler, but is this really a problem, + * only the sysadmin is able to do this. + */ + rand_initialize_irq(irq); + } + + /* + * The following block of code has to be executed atomically + */ + spin_lock_irqsave(&desc->lock,flags); + p = &desc->action; + if ((old = *p) != NULL) { + /* Can't share interrupts unless both agree to */ + if (!(old->flags & new->flags & SA_SHIRQ)) { + spin_unlock_irqrestore(&desc->lock,flags); + return -EBUSY; + } + + /* add new interrupt at end of irq queue */ + do { + p = &old->next; + old = *p; + } while (old); + shared = 1; + } + + *p = new; + + if (!shared) { + desc->depth = 0; + desc->status &= ~(IRQ_DISABLED | IRQ_AUTODETECT | IRQ_WAITING | IRQ_INPROGRESS); + desc->handler->startup(irq); + } + spin_unlock_irqrestore(&desc->lock,flags); + + register_irq_proc(irq); + return 0; +} + +static struct proc_dir_entry * root_irq_dir; +static struct proc_dir_entry * irq_dir [NR_IRQS]; + +#ifdef CONFIG_SMP + +static struct proc_dir_entry *smp_affinity_entry[NR_IRQS]; + +cpumask_t irq_affinity[NR_IRQS] = { [0 ... NR_IRQS-1] = CPU_MASK_ALL }; + +static int irq_affinity_read_proc(char *page, char **start, off_t off, + int count, int *eof, void *data) +{ + int len = cpumask_scnprintf(page, count, irq_affinity[(long)data]); + if (count - len < 2) + return -EINVAL; + len += sprintf(page + len, "\n"); + return len; +} + +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; + cpumask_t new_value, tmp; + + if (!irq_desc[irq].handler->set_affinity) + return -EIO; + + err = cpumask_parse(buffer, count, new_value); + if (err) + return err; + + /* + * Do not allow disabling IRQs completely - it's a too easy + * way to make the system unusable accidentally :-) At least + * one online CPU still has to be targeted. + */ + cpus_and(tmp, new_value, cpu_online_map); + if (cpus_empty(tmp)) + return -EINVAL; + + irq_affinity[irq] = new_value; + irq_desc[irq].handler->set_affinity(irq, + cpumask_of_cpu(first_cpu(new_value))); + + return full_count; +} + +#endif + +static int prof_cpu_mask_read_proc (char *page, char **start, off_t off, + int count, int *eof, void *data) +{ + int len = cpumask_scnprintf(page, count, *(cpumask_t *)data); + if (count - len < 2) + return -EINVAL; + len += sprintf(page + len, "\n"); + return len; +} + +static int prof_cpu_mask_write_proc (struct file *file, const char __user *buffer, + unsigned long count, void *data) +{ + cpumask_t *mask = (cpumask_t *)data; + unsigned long full_count = count, err; + cpumask_t new_value; + + err = cpumask_parse(buffer, count, new_value); + if (err) + return err; + + *mask = new_value; + return full_count; +} + +#define MAX_NAMELEN 10 + +static void register_irq_proc (unsigned int irq) +{ + char name [MAX_NAMELEN]; + + if (!root_irq_dir || (irq_desc[irq].handler == &no_irq_type) || + irq_dir[irq]) + return; + + memset(name, 0, MAX_NAMELEN); + sprintf(name, "%d", irq); + + /* create /proc/irq/1234 */ + irq_dir[irq] = proc_mkdir(name, root_irq_dir); + +#ifdef CONFIG_SMP + { + struct proc_dir_entry *entry; + + /* create /proc/irq/1234/smp_affinity */ + entry = create_proc_entry("smp_affinity", 0600, irq_dir[irq]); + + if (entry) { + entry->nlink = 1; + entry->data = (void *)(long)irq; + entry->read_proc = irq_affinity_read_proc; + entry->write_proc = irq_affinity_write_proc; + } + + smp_affinity_entry[irq] = entry; + } +#endif +} + +unsigned long prof_cpu_mask = -1; + +void init_irq_proc (void) +{ + struct proc_dir_entry *entry; + int i; + + /* create /proc/irq */ + root_irq_dir = proc_mkdir("irq", NULL); + + /* create /proc/irq/prof_cpu_mask */ + entry = create_proc_entry("prof_cpu_mask", 0600, root_irq_dir); + + if (!entry) + return; + + entry->nlink = 1; + entry->data = (void *)&prof_cpu_mask; + entry->read_proc = prof_cpu_mask_read_proc; + entry->write_proc = prof_cpu_mask_write_proc; + + /* + * Create entries for all existing IRQs. + */ + for (i = 0; i < NR_IRQS; i++) + register_irq_proc(i); +} + diff -Nru a/arch/m32r/kernel/m32r_ksyms.c b/arch/m32r/kernel/m32r_ksyms.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/m32r_ksyms.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,141 @@ +#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 *); + +#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_HD) || defined(CONFIG_BLK_DEV_IDE_MODULE) || defined(CONFIG_BLK_DEV_HD_MODULE) +extern struct drive_info_struct drive_info; +EXPORT_SYMBOL(drive_info); +#endif + +/* platform dependent support */ +EXPORT_SYMBOL(boot_cpu_data); +EXPORT_SYMBOL(dump_thread); +EXPORT_SYMBOL(dump_fpu); +EXPORT_SYMBOL(__ioremap); +EXPORT_SYMBOL(iounmap); +EXPORT_SYMBOL(enable_irq); +EXPORT_SYMBOL(disable_irq); +EXPORT_SYMBOL(disable_irq_nosync); +EXPORT_SYMBOL(kernel_thread); +EXPORT_SYMBOL(__down); +EXPORT_SYMBOL(__down_interruptible); +EXPORT_SYMBOL(__up); +EXPORT_SYMBOL(__down_trylock); + +/* Networking helper routines. */ +/* Delay loops */ +EXPORT_SYMBOL(__udelay); +EXPORT_SYMBOL(__delay); +EXPORT_SYMBOL(__const_udelay); + +EXPORT_SYMBOL(__get_user_1); +EXPORT_SYMBOL(__get_user_2); +EXPORT_SYMBOL(__get_user_4); + +EXPORT_SYMBOL(strpbrk); +EXPORT_SYMBOL(strstr); + +EXPORT_SYMBOL(strncpy_from_user); +EXPORT_SYMBOL(__strncpy_from_user); +EXPORT_SYMBOL(clear_user); +EXPORT_SYMBOL(__clear_user); +EXPORT_SYMBOL(__generic_copy_from_user); +EXPORT_SYMBOL(__generic_copy_to_user); +EXPORT_SYMBOL(strnlen_user); + +#ifdef CONFIG_SMP +#ifdef CONFIG_CHIP_M32700_TS1 +extern void *dcache_dummy; +EXPORT_SYMBOL(dcache_dummy); +#endif +EXPORT_SYMBOL(cpu_data); +EXPORT_SYMBOL(cpu_online_map); +EXPORT_SYMBOL(cpu_callout_map); + +/* Global SMP stuff */ +EXPORT_SYMBOL(synchronize_irq); +EXPORT_SYMBOL(smp_call_function); + +/* TLB flushing */ +EXPORT_SYMBOL(smp_flush_tlb_page); +EXPORT_SYMBOL_GPL(smp_flush_tlb_all); +#endif + +/* compiler generated symbol */ +extern void __ashldi3(void); +extern void __ashrdi3(void); +extern void __lshldi3(void); +extern void __lshrdi3(void); +extern void __muldi3(void); +EXPORT_SYMBOL(__ashldi3); +EXPORT_SYMBOL(__ashrdi3); +EXPORT_SYMBOL(__lshldi3); +EXPORT_SYMBOL(__lshrdi3); +EXPORT_SYMBOL(__muldi3); + +/* memory and string operations */ +EXPORT_SYMBOL(memchr); +EXPORT_SYMBOL(memcpy); +/* EXPORT_SYMBOL(memcpy_fromio); // not implement yet */ +/* EXPORT_SYMBOL(memcpy_toio); // not implement yet */ +EXPORT_SYMBOL(memset); +/* EXPORT_SYMBOL(memset_io); // not implement yet */ +EXPORT_SYMBOL(memmove); +EXPORT_SYMBOL(memcmp); +EXPORT_SYMBOL(memscan); +EXPORT_SYMBOL(copy_page); +EXPORT_SYMBOL(clear_page); + +EXPORT_SYMBOL(strcat); +EXPORT_SYMBOL(strchr); +EXPORT_SYMBOL(strcmp); +EXPORT_SYMBOL(strcpy); +EXPORT_SYMBOL(strlen); +EXPORT_SYMBOL(strncat); +EXPORT_SYMBOL(strncmp); +EXPORT_SYMBOL(strnlen); +EXPORT_SYMBOL(strncpy); + +EXPORT_SYMBOL(_inb); +EXPORT_SYMBOL(_inw); +EXPORT_SYMBOL(_inl); +EXPORT_SYMBOL(_outb); +EXPORT_SYMBOL(_outw); +EXPORT_SYMBOL(_outl); +EXPORT_SYMBOL(_inb_p); +EXPORT_SYMBOL(_inw_p); +EXPORT_SYMBOL(_inl_p); +EXPORT_SYMBOL(_outb_p); +EXPORT_SYMBOL(_outw_p); +EXPORT_SYMBOL(_outl_p); +EXPORT_SYMBOL(_insb); +EXPORT_SYMBOL(_insw); +EXPORT_SYMBOL(_insl); +EXPORT_SYMBOL(_outsb); +EXPORT_SYMBOL(_outsw); +EXPORT_SYMBOL(_outsl); +EXPORT_SYMBOL(_readb); +EXPORT_SYMBOL(_readw); +EXPORT_SYMBOL(_readl); +EXPORT_SYMBOL(_writeb); +EXPORT_SYMBOL(_writew); +EXPORT_SYMBOL(_writel); + diff -Nru a/arch/m32r/kernel/module.c b/arch/m32r/kernel/module.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/module.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,253 @@ +/* Kernel module help for M32R. + + 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. + + 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 +#include +#include +#include +#include +#include + +#if 0 +#define DEBUGP printk +#else +#define DEBUGP(fmt...) +#endif + +void *module_alloc(unsigned long size) +{ + if (size == 0) + return NULL; + return vmalloc_exec(size); +} + + +/* Free memory returned from module_alloc */ +void module_free(struct module *mod, void *module_region) +{ + vfree(module_region); + /* FIXME: If module_region == mod->init_region, trim exception + table entries. */ +} + +/* We don't need anything special. */ +int module_frob_arch_sections(Elf_Ehdr *hdr, + Elf_Shdr *sechdrs, + char *secstrings, + struct module *mod) +{ + return 0; +} + +#define COPY_UNALIGNED_WORD(sw, tw, align) \ +{ \ + void *__s = &(sw), *__t = &(tw); \ + unsigned short *__s2 = __s, *__t2 =__t; \ + unsigned char *__s1 = __s, *__t1 =__t; \ + switch ((align)) \ + { \ + case 0: \ + *(unsigned long *) __t = *(unsigned long *) __s; \ + break; \ + case 2: \ + *__t2++ = *__s2++; \ + *__t2 = *__s2; \ + break; \ + default: \ + *__t1++ = *__s1++; \ + *__t1++ = *__s1++; \ + *__t1++ = *__s1++; \ + *__t1 = *__s1; \ + break; \ + } \ +} + +#define COPY_UNALIGNED_HWORD(sw, tw, align) \ + { \ + void *__s = &(sw), *__t = &(tw); \ + unsigned short *__s2 = __s, *__t2 =__t; \ + unsigned char *__s1 = __s, *__t1 =__t; \ + switch ((align)) \ + { \ + case 0: \ + *__t2 = *__s2; \ + break; \ + default: \ + *__t1++ = *__s1++; \ + *__t1 = *__s1; \ + break; \ + } \ + } + +int apply_relocate_add(Elf32_Shdr *sechdrs, + const char *strtab, + unsigned int symindex, + unsigned int relsec, + struct module *me) +{ + unsigned int i; + Elf32_Rela *rel = (void *)sechdrs[relsec].sh_addr; + Elf32_Sym *sym; + Elf32_Addr relocation; + uint32_t *location; + uint32_t value; + unsigned short *hlocation; + unsigned short hvalue; + int svalue; + int align; + + DEBUGP("Applying relocate section %u to %u\n", relsec, + sechdrs[relsec].sh_info); + for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) { + /* This is where to make the change */ + location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr + + rel[i].r_offset; + /* This is the symbol it is referring to. Note that all + undefined symbols have been resolved. */ + sym = (Elf32_Sym *)sechdrs[symindex].sh_addr + + ELF32_R_SYM(rel[i].r_info); + relocation = sym->st_value + rel[i].r_addend; + align = (int)location & 3; + + switch (ELF32_R_TYPE(rel[i].r_info)) { + case R_M32R_32_RELA: + COPY_UNALIGNED_WORD (*location, value, align); + value += relocation; + COPY_UNALIGNED_WORD (value, *location, align); + break; + case R_M32R_HI16_ULO_RELA: + COPY_UNALIGNED_WORD (*location, value, align); + relocation = (relocation >>16) & 0xffff; + /* RELA must has 0 at relocation field. */ + value += relocation; + COPY_UNALIGNED_WORD (value, *location, align); + break; + case R_M32R_HI16_SLO_RELA: + COPY_UNALIGNED_WORD (*location, value, align); + if (relocation & 0x8000) relocation += 0x10000; + relocation = (relocation >>16) & 0xffff; + /* RELA must has 0 at relocation field. */ + value += relocation; + COPY_UNALIGNED_WORD (value, *location, align); + break; + case R_M32R_16_RELA: + hlocation = (unsigned short *)location; + relocation = relocation & 0xffff; + /* RELA must has 0 at relocation field. */ + hvalue = relocation; + COPY_UNALIGNED_WORD (hvalue, *hlocation, align); + break; + case R_M32R_SDA16_RELA: + case R_M32R_LO16_RELA: + COPY_UNALIGNED_WORD (*location, value, align); + relocation = relocation & 0xffff; + /* RELA must has 0 at relocation field. */ + value += relocation; + COPY_UNALIGNED_WORD (value, *location, align); + break; + case R_M32R_24_RELA: + COPY_UNALIGNED_WORD (*location, value, align); + relocation = relocation & 0xffffff; + /* RELA must has 0 at relocation field. */ + value += relocation; + COPY_UNALIGNED_WORD (value, *location, align); + break; + case R_M32R_18_PCREL_RELA: + relocation = (relocation - (Elf32_Addr) location); + if (relocation < -0x20000 || 0x1fffc < relocation) + { + printk(KERN_ERR "module %s: relocation overflow: %u\n", + me->name, relocation); + return -ENOEXEC; + } + COPY_UNALIGNED_WORD (*location, value, align); + if (value & 0xffff) + { + /* RELA must has 0 at relocation field. */ + printk(KERN_ERR "module %s: illegal relocation field: %u\n", + me->name, value); + return -ENOEXEC; + } + relocation = (relocation >> 2) & 0xffff; + value += relocation; + COPY_UNALIGNED_WORD (value, *location, align); + break; + case R_M32R_10_PCREL_RELA: + hlocation = (unsigned short *)location; + relocation = (relocation - (Elf32_Addr) location); + COPY_UNALIGNED_HWORD (*hlocation, hvalue, align); + svalue = (int)hvalue; + svalue = (signed char)svalue << 2; + relocation += svalue; + relocation = (relocation >> 2) & 0xff; + hvalue = hvalue & 0xff00; + hvalue += relocation; + COPY_UNALIGNED_HWORD (hvalue, *hlocation, align); + break; + case R_M32R_26_PCREL_RELA: + relocation = (relocation - (Elf32_Addr) location); + if (relocation < -0x2000000 || 0x1fffffc < relocation) + { + printk(KERN_ERR "module %s: relocation overflow: %u\n", + me->name, relocation); + return -ENOEXEC; + } + COPY_UNALIGNED_WORD (*location, value, align); + if (value & 0xffffff) + { + /* RELA must has 0 at relocation field. */ + printk(KERN_ERR "module %s: illegal relocation field: %u\n", + me->name, value); + return -ENOEXEC; + } + relocation = (relocation >> 2) & 0xffffff; + value += relocation; + COPY_UNALIGNED_WORD (value, *location, align); + break; + default: + printk(KERN_ERR "module %s: Unknown relocation: %u\n", + me->name, ELF32_R_TYPE(rel[i].r_info)); + return -ENOEXEC; + } + } + return 0; +} + +int apply_relocate(Elf32_Shdr *sechdrs, + const char *strtab, + unsigned int symindex, + unsigned int relsec, + struct module *me) +{ +#if 0 + printk(KERN_ERR "module %s: REL RELOCATION unsupported\n", + me->name); + return -ENOEXEC; +#endif + return 0; + +} + +int module_finalize(const Elf_Ehdr *hdr, + const Elf_Shdr *sechdrs, + struct module *me) +{ + return 0; +} + +void module_arch_cleanup(struct module *mod) +{ +} diff -Nru a/arch/m32r/kernel/process.c b/arch/m32r/kernel/process.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/process.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,356 @@ +/* + * linux/arch/m32r/kernel/process.c + * orig : sh + * + * Copyright (c) 2001, 2002 Hiroyuki Kondo, Hirokazu Takata, + * Hitoshi Yamamoto + * Taken from sh version. + * Copyright (C) 1995 Linus Torvalds + * SuperH version: Copyright (C) 1999, 2000 Niibe Yutaka & Kaz Kojima + */ + +#undef DEBUG_PROCESS +#ifdef DEBUG_PROCESS +#define DPRINTK(fmt, args...) printk("%s:%d:%s: " fmt, __FILE__, __LINE__, \ + __FUNCTION__, ##args) +#else +#define DPRINTK(fmt, args...) +#endif + +/* + * This file handles the architecture-dependent parts of process handling.. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +static int hlt_counter=0; + +/* + * Return saved PC of a blocked thread. + */ +unsigned long thread_saved_pc(struct task_struct *tsk) +{ + return tsk->thread.lr; +} + +/* + * Powermanagement idle function, if any.. + */ +void (*pm_idle)(void) = NULL; + +void disable_hlt(void) +{ + hlt_counter++; +} + +EXPORT_SYMBOL(disable_hlt); + +void enable_hlt(void) +{ + hlt_counter--; +} + +EXPORT_SYMBOL(enable_hlt); + +/* + * We use this is we don't have any better + * idle routine.. + */ +void default_idle(void) +{ + /* M32R_FIXME: Please use "cpu_sleep" mode. */ + cpu_relax(); +} + +/* + * On SMP it's slightly faster (but much more power-consuming!) + * to poll the ->work.need_resched flag instead of waiting for the + * cross-CPU IPI to arrive. Use this option with caution. + */ +static void poll_idle (void) +{ + /* M32R_FIXME */ + cpu_relax(); +} + +/* + * The idle thread. There's no useful work to be + * done, so just try to conserve power and have a + * low exit latency (ie sit in a loop waiting for + * somebody to say that they'd like to reschedule) + */ +void cpu_idle (void) +{ + /* endless idle loop with no priority at all */ + while (1) { + while (!need_resched()) { + void (*idle)(void) = pm_idle; + + if (!idle) + idle = default_idle; + + idle(); + } + schedule(); + } +} + +void machine_restart(char *__unused) +{ + printk("Please push reset button!\n"); + while (1) + cpu_relax(); +} + +EXPORT_SYMBOL(machine_restart); + +void machine_halt(void) +{ + printk("Please push reset button!\n"); + while (1) + cpu_relax(); +} + +EXPORT_SYMBOL(machine_halt); + +void machine_power_off(void) +{ + /* M32R_FIXME */ +} + +EXPORT_SYMBOL(machine_power_off); + +static int __init idle_setup (char *str) +{ + if (!strncmp(str, "poll", 4)) { + printk("using poll in idle threads.\n"); + pm_idle = poll_idle; + } else if (!strncmp(str, "sleep", 4)) { + printk("using sleep in idle threads.\n"); + pm_idle = default_idle; + } + + return 1; +} + +__setup("idle=", idle_setup); + +void show_regs(struct pt_regs * regs) +{ + printk("\n"); + printk("BPC[%08lx]:PSW[%08lx]:LR [%08lx]:FP [%08lx]\n", \ + regs->bpc, regs->psw, regs->lr, regs->fp); + printk("BBPC[%08lx]:BBPSW[%08lx]:SPU[%08lx]:SPI[%08lx]\n", \ + regs->bbpc, regs->bbpsw, regs->spu, regs->spi); + 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]\n", \ + regs->r12); + +#if defined(CONFIG_ISA_M32R2) && defined(CONFIG_ISA_DSP_LEVEL2) + printk("ACC0H[%08lx]:ACC0L[%08lx]\n", \ + regs->acc0h, regs->acc0l); + printk("ACC1H[%08lx]:ACC1L[%08lx]\n", \ + regs->acc1h, regs->acc1l); +#elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R) + printk("ACCH[%08lx]:ACCL[%08lx]\n", \ + regs->acch, regs->accl); +#else +#error unknown isa configuration +#endif +} + +/* + * Create a kernel thread + */ + +/* + * This is the mechanism for creating a new kernel thread. + * + * NOTE! Only a kernel-only process(ie the swapper or direct descendants + * who haven't done an "execve()") should use this: it will work within + * a system call from a "real" process, but the process memory space will + * not be free'd until both the parent and the child have exited. + */ +static void kernel_thread_helper(void *nouse, int (*fn)(void *), void *arg) +{ + fn(arg); + do_exit(-1); +} + +int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags) +{ + struct pt_regs regs; + + memset(®s, 0, sizeof (regs)); + regs.r1 = (unsigned long)fn; + regs.r2 = (unsigned long)arg; + + regs.bpc = (unsigned long)kernel_thread_helper; + + regs.psw = M32R_PSW_BIE; + + /* Ok, create the new process. */ + return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, ®s, 0, NULL, + NULL); +} + +/* + * Free current thread data structures etc.. + */ +void exit_thread(void) +{ + /* Nothing to do. */ + DPRINTK("pid = %d\n", current->pid); +} + +void flush_thread(void) +{ + DPRINTK("pid = %d\n", current->pid); + memset(¤t->thread.debug_trap, 0, sizeof(struct debug_trap)); +} + +void release_thread(struct task_struct *dead_task) +{ + /* do nothing */ + DPRINTK("pid = %d\n", dead_task->pid); +} + +/* Fill in the fpu structure for a core dump.. */ +int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu) +{ + return 0; /* Task didn't use the fpu at all. */ +} + +int copy_thread(int nr, unsigned long clone_flags, unsigned long spu, + unsigned long unused, struct task_struct *tsk, struct pt_regs *regs) +{ + struct pt_regs *childregs; + unsigned long sp = (unsigned long)tsk->thread_info + THREAD_SIZE; + extern void ret_from_fork(void); + + tsk->set_child_tid = tsk->clear_child_tid = NULL; + + /* Copy registers */ + sp -= sizeof (struct pt_regs); + childregs = (struct pt_regs *)sp; + *childregs = *regs; + + childregs->spu = spu; + childregs->r0 = 0; /* Child gets zero as return value */ + regs->r0 = tsk->pid; + tsk->thread.sp = (unsigned long)childregs; + tsk->thread.lr = (unsigned long)ret_from_fork; + + return 0; +} + +/* + * fill in the user structure for a core dump.. + */ +void dump_thread(struct pt_regs * regs, struct user * dump) +{ + /* M32R_FIXME */ +} + +/* + * Capture the user space registers if the task is not running (in user space) + */ +int dump_task_regs(struct task_struct *tsk, elf_gregset_t *regs) +{ + /* M32R_FIXME */ + return 1; +} + +asmlinkage int sys_fork(unsigned long r0, unsigned long r1, unsigned long r2, + unsigned long r3, unsigned long r4, unsigned long r5, unsigned long r6, + struct pt_regs regs) +{ +#ifdef CONFIG_MMU + return do_fork(SIGCHLD, regs.spu, ®s, 0, NULL, NULL); +#else + return -EINVAL; +#endif /* CONFIG_MMU */ +} + +asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp, + unsigned long r2, unsigned long r3, unsigned long r4, unsigned long r5, + unsigned long r6, struct pt_regs regs) +{ + if (!newsp) + newsp = regs.spu; + + return do_fork(clone_flags, newsp, ®s, 0, NULL, NULL); +} + +/* + * This is trivial, and on the face of it looks like it + * could equally well be done in user mode. + * + * Not so, for quite unobvious reasons - register pressure. + * In user mode vfork() cannot have a stack frame, and if + * done by calling the "clone()" system call directly, you + * do not have enough call-clobbered registers to hold all + * the information you need. + */ +asmlinkage int sys_vfork(unsigned long r0, unsigned long r1, unsigned long r2, + unsigned long r3, unsigned long r4, unsigned long r5, unsigned long r6, + struct pt_regs regs) +{ + return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, regs.spu, ®s, 0, + NULL, NULL); +} + +/* + * sys_execve() executes a new program. + */ +asmlinkage int sys_execve(char __user *ufilename, char __user * __user *uargv, char __user * __user *uenvp, + unsigned long r3, unsigned long r4, unsigned long r5, unsigned long r6, + struct pt_regs regs) +{ + int error; + char *filename; + + filename = getname(ufilename); + error = PTR_ERR(filename); + if (IS_ERR(filename)) + goto out; + + error = do_execve(filename, uargv, uenvp, ®s); + if (error == 0) + current->ptrace &= ~PT_DTRACE; + putname(filename); +out: + return error; +} + +/* + * These bracket the sleeping functions.. + */ +#define first_sched ((unsigned long) scheduling_functions_start_here) +#define last_sched ((unsigned long) scheduling_functions_end_here) + +unsigned long get_wchan(struct task_struct *p) +{ + /* M32R_FIXME */ + return (0); +} + diff -Nru a/arch/m32r/kernel/ptrace.c b/arch/m32r/kernel/ptrace.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/ptrace.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,858 @@ +/* + * linux/arch/m32r/kernel/ptrace.c + * + * Copyright (C) 2002 Hirokazu Takata, Takeo Takahashi + * Copyright (C) 2004 Hirokazu Takata + * + * Original x86 implementation: + * By Ross Biro 1/23/92 + * edited by Linus Torvalds + * + * Some code taken from sh version: + * Copyright (C) 1999, 2000 Kaz Kojima & Niibe Yutaka + * Some code taken from arm version: + * Copyright (C) 2000 Russell King + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +/* + * Get the address of the live pt_regs for the specified task. + * These are saved onto the top kernel stack when the process + * is not running. + * + * Note: if a user thread is execve'd from kernel space, the + * kernel stack will not be empty on entry to the kernel, so + * ptracing these tasks will fail. + */ +static inline struct pt_regs * +get_user_regs(struct task_struct *task) +{ + return (struct pt_regs *) + ((unsigned long)task->thread_info + THREAD_SIZE + - sizeof(struct pt_regs)); +} + +/* + * This routine will get a word off of the process kernel stack. + */ +static inline unsigned long int +get_stack_long(struct task_struct *task, int offset) +{ + unsigned long *stack; + + stack = (unsigned long *)get_user_regs(task); + + return stack[offset]; +} + +/* + * This routine will put a word on the process kernel stack. + */ +static inline int +put_stack_long(struct task_struct *task, int offset, unsigned long data) +{ + unsigned long *stack; + + stack = (unsigned long *)get_user_regs(task); + stack[offset] = data; + + return 0; +} + +static int reg_offset[] = { + PT_R0, PT_R1, PT_R2, PT_R3, PT_R4, PT_R5, PT_R6, PT_R7, + PT_R8, PT_R9, PT_R10, PT_R11, PT_R12, PT_FP, PT_LR, PT_SPU, +}; + +/* + * Read the word at offset "off" into the "struct user". We + * actually access the pt_regs stored on the kernel stack. + */ +static int ptrace_read_user(struct task_struct *tsk, unsigned long off, + unsigned long __user *data) +{ + unsigned long tmp; +#ifndef NO_FPU + struct user * dummy = NULL; +#endif + + if ((off & 3) || (off < 0) || (off > sizeof(struct user) - 3)) + return -EIO; + + off >>= 2; + switch (off) { + case PT_EVB: + __asm__ __volatile__ ( + "mvfc %0, cr5 \n\t" + : "=r" (tmp) + ); + break; + case PT_CBR: { + unsigned long psw; + psw = get_stack_long(tsk, PT_PSW); + tmp = ((psw >> 8) & 1); + } + break; + case PT_PSW: { + unsigned long psw, bbpsw; + psw = get_stack_long(tsk, PT_PSW); + bbpsw = get_stack_long(tsk, PT_BBPSW); + tmp = ((psw >> 8) & 0xff) | ((bbpsw & 0xff) << 8); + } + break; + case PT_PC: + tmp = get_stack_long(tsk, PT_BPC); + break; + case PT_BPC: + off = PT_BBPC; + /* fall through */ + default: + if (off < (sizeof(struct pt_regs) >> 2)) + tmp = get_stack_long(tsk, off); +#ifndef NO_FPU + else if (off >= (long)(&dummy->fpu >> 2) && + off < (long)(&dummy->u_fpvalid >> 2)) { + if (!tsk->used_math) { + if (off == (long)(&dummy->fpu.fpscr >> 2)) + tmp = FPSCR_INIT; + else + tmp = 0; + } else + tmp = ((long *)(&tsk->thread.fpu >> 2)) + [off - (long)&dummy->fpu]; + } else if (off == (long)(&dummy->u_fpvalid >> 2)) + tmp = tsk->used_math; +#endif /* not NO_FPU */ + else + tmp = 0; + } + + return put_user(tmp, data); +} + +static int ptrace_write_user(struct task_struct *tsk, unsigned long off, + unsigned long data) +{ + int ret = -EIO; +#ifndef NO_FPU + struct user * dummy = NULL; +#endif + + if ((off & 3) || off < 0 || + off > sizeof(struct user) - 3) + return -EIO; + + off >>= 2; + switch (off) { + case PT_EVB: + case PT_BPC: + case PT_SPI: + /* We don't allow to modify evb. */ + ret = 0; + break; + case PT_PSW: + case PT_CBR: { + /* We allow to modify only cbr in psw */ + unsigned long psw; + psw = get_stack_long(tsk, PT_PSW); + psw = (psw & ~0x100) | ((data & 1) << 8); + ret = put_stack_long(tsk, PT_PSW, psw); + } + break; + case PT_PC: + off = PT_BPC; + data &= ~1; + /* fall through */ + default: + if (off < (sizeof(struct pt_regs) >> 2)) + ret = put_stack_long(tsk, off, data); +#ifndef NO_FPU + else if (off >= (long)(&dummy->fpu >> 2) && + off < (long)(&dummy->u_fpvalid >> 2)) { + tsk->used_math = 1; + ((long *)&tsk->thread.fpu) + [off - (long)&dummy->fpu] = data; + ret = 0; + } else if (off == (long)(&dummy->u_fpvalid >> 2)) { + tsk->used_math = data ? 1 : 0; + ret = 0; + } +#endif /* not NO_FPU */ + break; + } + + return ret; +} + +/* + * Get all user integer registers. + */ +static int ptrace_getregs(struct task_struct *tsk, void __user *uregs) +{ + struct pt_regs *regs = get_user_regs(tsk); + + return copy_to_user(uregs, regs, sizeof(struct pt_regs)) ? -EFAULT : 0; +} + +/* + * Set all user integer registers. + */ +static int ptrace_setregs(struct task_struct *tsk, void __user *uregs) +{ + struct pt_regs newregs; + int ret; + + ret = -EFAULT; + if (copy_from_user(&newregs, uregs, sizeof(struct pt_regs)) == 0) { + struct pt_regs *regs = get_user_regs(tsk); + *regs = newregs; + ret = 0; + } + + return ret; +} + + +static inline int +check_condition_bit(struct task_struct *child) +{ + return (int)((get_stack_long(child, PT_PSW) >> 8) & 1); +} + +static int +check_condition_src(unsigned long op, unsigned long regno1, + unsigned long regno2, struct task_struct *child) +{ + unsigned long reg1, reg2; + + reg2 = get_stack_long(child, reg_offset[regno2]); + + switch (op) { + case 0x0: /* BEQ */ + reg1 = get_stack_long(child, reg_offset[regno1]); + return reg1 == reg2; + case 0x1: /* BNE */ + reg1 = get_stack_long(child, reg_offset[regno1]); + return reg1 != reg2; + case 0x8: /* BEQZ */ + return reg2 == 0; + case 0x9: /* BNEZ */ + return reg2 != 0; + case 0xa: /* BLTZ */ + return (int)reg2 < 0; + case 0xb: /* BGEZ */ + return (int)reg2 >= 0; + case 0xc: /* BLEZ */ + return (int)reg2 <= 0; + case 0xd: /* BGTZ */ + return (int)reg2 > 0; + default: + /* never reached */ + return 0; + } +} + +static void +compute_next_pc_for_16bit_insn(unsigned long insn, unsigned long pc, + unsigned long *next_pc, + struct task_struct *child) +{ + unsigned long op, op2, op3; + unsigned long disp; + unsigned long regno; + int parallel = 0; + + if (insn & 0x00008000) + parallel = 1; + if (pc & 3) + insn &= 0x7fff; /* right slot */ + else + insn >>= 16; /* left slot */ + + op = (insn >> 12) & 0xf; + op2 = (insn >> 8) & 0xf; + op3 = (insn >> 4) & 0xf; + + if (op == 0x7) { + switch (op2) { + case 0xd: /* BNC */ + case 0x9: /* BNCL */ + if (!check_condition_bit(child)) { + disp = (long)(insn << 24) >> 22; + *next_pc = (pc & ~0x3) + disp; + return; + } + break; + case 0x8: /* BCL */ + case 0xc: /* BC */ + if (check_condition_bit(child)) { + disp = (long)(insn << 24) >> 22; + *next_pc = (pc & ~0x3) + disp; + return; + } + break; + case 0xe: /* BL */ + case 0xf: /* BRA */ + disp = (long)(insn << 24) >> 22; + *next_pc = (pc & ~0x3) + disp; + return; + break; + } + } else if (op == 0x1) { + switch (op2) { + case 0x0: + if (op3 == 0xf) { /* TRAP */ +#if 1 + /* pass through */ +#else + /* kernel space is not allowed as next_pc */ + unsigned long evb; + unsigned long trapno; + trapno = insn & 0xf; + __asm__ __volatile__ ( + "mvfc %0, cr5\n" + :"=r"(evb) + : + ); + *next_pc = evb + (trapno << 2); + return; +#endif + } else if (op3 == 0xd) { /* RTE */ + *next_pc = get_stack_long(child, PT_BPC); + return; + } + break; + case 0xc: /* JC */ + if (op3 == 0xc && check_condition_bit(child)) { + regno = insn & 0xf; + *next_pc = get_stack_long(child, + reg_offset[regno]); + return; + } + break; + case 0xd: /* JNC */ + if (op3 == 0xc && !check_condition_bit(child)) { + regno = insn & 0xf; + *next_pc = get_stack_long(child, + reg_offset[regno]); + return; + } + break; + case 0xe: /* JL */ + case 0xf: /* JMP */ + if (op3 == 0xc) { /* JMP */ + regno = insn & 0xf; + *next_pc = get_stack_long(child, + reg_offset[regno]); + return; + } + break; + } + } + if (parallel) + *next_pc = pc + 4; + else + *next_pc = pc + 2; +} + +static void +compute_next_pc_for_32bit_insn(unsigned long insn, unsigned long pc, + unsigned long *next_pc, + struct task_struct *child) +{ + unsigned long op; + unsigned long op2; + unsigned long disp; + unsigned long regno1, regno2; + + op = (insn >> 28) & 0xf; + if (op == 0xf) { /* branch 24-bit relative */ + op2 = (insn >> 24) & 0xf; + switch (op2) { + case 0xd: /* BNC */ + case 0x9: /* BNCL */ + if (!check_condition_bit(child)) { + disp = (long)(insn << 8) >> 6; + *next_pc = (pc & ~0x3) + disp; + return; + } + break; + case 0x8: /* BCL */ + case 0xc: /* BC */ + if (check_condition_bit(child)) { + disp = (long)(insn << 8) >> 6; + *next_pc = (pc & ~0x3) + disp; + return; + } + break; + case 0xe: /* BL */ + case 0xf: /* BRA */ + disp = (long)(insn << 8) >> 6; + *next_pc = (pc & ~0x3) + disp; + return; + } + } else if (op == 0xb) { /* branch 16-bit relative */ + op2 = (insn >> 20) & 0xf; + switch (op2) { + case 0x0: /* BEQ */ + case 0x1: /* BNE */ + case 0x8: /* BEQZ */ + case 0x9: /* BNEZ */ + case 0xa: /* BLTZ */ + case 0xb: /* BGEZ */ + case 0xc: /* BLEZ */ + case 0xd: /* BGTZ */ + regno1 = ((insn >> 24) & 0xf); + regno2 = ((insn >> 16) & 0xf); + if (check_condition_src(op2, regno1, regno2, child)) { + disp = (long)(insn << 16) >> 14; + *next_pc = (pc & ~0x3) + disp; + return; + } + break; + } + } + *next_pc = pc + 4; +} + +static inline void +compute_next_pc(unsigned long insn, unsigned long pc, + unsigned long *next_pc, struct task_struct *child) +{ + if (insn & 0x80000000) + compute_next_pc_for_32bit_insn(insn, pc, next_pc, child); + else + compute_next_pc_for_16bit_insn(insn, pc, next_pc, child); +} + +static int +register_debug_trap(struct task_struct *child, unsigned long next_pc, + unsigned long next_insn, unsigned long *code) +{ + struct debug_trap *p = &child->thread.debug_trap; + unsigned long addr = next_pc & ~3; + + if (p->nr_trap != 0) { + printk("kernel BUG at %s %d: p->nr_trap = %d\n", + __FILE__, __LINE__, p->nr_trap); + return -1; + } + p->addr = addr; + p->insn = next_insn; + p->nr_trap++; + if (next_pc & 3) { + *code = (next_insn & 0xffff0000) | 0x10f1; + /* xxx --> TRAP1 */ + } else { + if ((next_insn & 0x80000000) || (next_insn & 0x8000)) { + *code = 0x10f17000; + /* TRAP1 --> NOP */ + } else { + *code = (next_insn & 0xffff) | 0x10f10000; + /* TRAP1 --> xxx */ + } + } + return 0; +} + +int withdraw_debug_trap_for_signal(struct task_struct *child) +{ + struct debug_trap *p = &child->thread.debug_trap; + int nr_trap = p->nr_trap; + + if (nr_trap) { + access_process_vm(child, p->addr, &p->insn, sizeof(p->insn), 1); + p->nr_trap = 0; + p->addr = 0; + p->insn = 0; + } + return nr_trap; +} + +static int +unregister_debug_trap(struct task_struct *child, unsigned long addr, + unsigned long *code) +{ + struct debug_trap *p = &child->thread.debug_trap; + + if (p->nr_trap != 1 || p->addr != addr) { + /* The trap may be requested from debugger. + * ptrace should do nothing in this case. + */ + return 0; + } + *code = p->insn; + p->insn = 0; + p->addr = 0; + p->nr_trap--; + return 1; +} + +static void +unregister_all_debug_traps(struct task_struct *child) +{ + struct debug_trap *p = &child->thread.debug_trap; + + if (p->nr_trap) { + access_process_vm(child, p->addr, &p->insn, sizeof(p->insn), 1); + p->addr = 0; + p->insn = 0; + p->nr_trap = 0; + } +} + +static inline void +invalidate_cache(void) +{ +#if defined(CONFIG_CHIP_M32700) || defined(CONFIG_CHIP_OPSP) + + _flush_cache_copyback_all(); + +#else /* ! CONFIG_CHIP_M32700 */ + + /* Invalidate cache */ + __asm__ __volatile__ ( + "ldi r0, #-1 \n\t" + "ldi r1, #0 \n\t" + "stb r1, @r0 ; cache off \n\t" + "; \n\t" + "ldi r0, #-2 \n\t" + "ldi r1, #1 \n\t" + "stb r1, @r0 ; cache invalidate \n\t" + ".fillinsn \n" + "0: \n\t" + "ldb r1, @r0 ; invalidate check \n\t" + "bnez r1, 0b \n\t" + "; \n\t" + "ldi r0, #-1 \n\t" + "ldi r1, #1 \n\t" + "stb r1, @r0 ; cache on \n\t" + : : : "r0", "r1", "memory" + ); + /* FIXME: copying-back d-cache and invalidating i-cache are needed. + */ +#endif /* CONFIG_CHIP_M32700 */ +} + +/* Embed a debug trap (TRAP1) code */ +static int +embed_debug_trap(struct task_struct *child, unsigned long next_pc) +{ + unsigned long next_insn, code; + unsigned long addr = next_pc & ~3; + + if (access_process_vm(child, addr, &next_insn, sizeof(next_insn), 0) + != sizeof(next_insn)) { + return -1; /* error */ + } + + /* Set a trap code. */ + if (register_debug_trap(child, next_pc, next_insn, &code)) { + return -1; /* error */ + } + if (access_process_vm(child, addr, &code, sizeof(code), 1) + != sizeof(code)) { + return -1; /* error */ + } + return 0; /* success */ +} + +void +embed_debug_trap_for_signal(struct task_struct *child) +{ + unsigned long next_pc; + unsigned long pc, insn; + int ret; + + pc = get_stack_long(child, PT_BPC); + ret = access_process_vm(child, pc&~3, &insn, sizeof(insn), 0); + if (ret != sizeof(insn)) { + printk("kernel BUG at %s %d: access_process_vm returns %d\n", + __FILE__, __LINE__, ret); + return; + } + compute_next_pc(insn, pc, &next_pc, child); + if (next_pc & 0x80000000) { + printk("kernel BUG at %s %d: next_pc = 0x%08x\n", + __FILE__, __LINE__, (int)next_pc); + return; + } + if (embed_debug_trap(child, next_pc)) { + printk("kernel BUG at %s %d: embed_debug_trap error\n", + __FILE__, __LINE__); + return; + } + invalidate_cache(); +} + +void +withdraw_debug_trap(struct pt_regs *regs) +{ + unsigned long addr; + unsigned long code; + + addr = (regs->bpc - 2) & ~3; + regs->bpc -= 2; + if (unregister_debug_trap(current, addr, &code)) { + access_process_vm(current, addr, &code, sizeof(code), 1); + invalidate_cache(); + } +} + +static void +init_debug_traps(struct task_struct *child) +{ + struct debug_trap *p = &child->thread.debug_trap; + p->nr_trap = 0; + p->addr = 0; + p->insn = 0; +} + + +/* + * Called by kernel/ptrace.c when detaching.. + * + * Make sure single step bits etc are not set. + */ +void ptrace_disable(struct task_struct *child) +{ + /* nothing to do.. */ +} + +static int +do_ptrace(long request, struct task_struct *child, long addr, long data) +{ + unsigned long tmp; + int ret; + + switch (request) { + /* + * read word at location "addr" in the child process. + */ + case PTRACE_PEEKTEXT: + case PTRACE_PEEKDATA: + ret = access_process_vm(child, addr, &tmp, sizeof(tmp), 0); + if (ret == sizeof(tmp)) + ret = put_user(tmp,(unsigned long __user *) data); + else + ret = -EIO; + break; + + /* + * read the word at location addr in the USER area. + */ + case PTRACE_PEEKUSR: + ret = ptrace_read_user(child, addr, + (unsigned long __user *)data); + break; + + /* + * write the word at location addr. + */ + case PTRACE_POKETEXT: + case PTRACE_POKEDATA: + ret = access_process_vm(child, addr, &data, sizeof(data), 1); + if (ret == sizeof(data)) { + ret = 0; + if (request == PTRACE_POKETEXT) { + invalidate_cache(); + } + } else { + ret = -EIO; + } + break; + + /* + * write the word at location addr in the USER area. + */ + case PTRACE_POKEUSR: + ret = ptrace_write_user(child, addr, data); + break; + + /* + * continue/restart and stop at next (return from) syscall + */ + case PTRACE_SYSCALL: + case PTRACE_CONT: + ret = -EIO; + if ((unsigned long) data > _NSIG) + break; + if (request == PTRACE_SYSCALL) + set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); + else + clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); + child->exit_code = data; + wake_up_process(child); + ret = 0; + break; + + /* + * make the child exit. Best I can do is send it a sigkill. + * perhaps it should be put in the status that it wants to + * exit. + */ + case PTRACE_KILL: { + ret = 0; + unregister_all_debug_traps(child); + invalidate_cache(); + if (child->state == TASK_ZOMBIE) /* already dead */ + break; + child->exit_code = SIGKILL; + wake_up_process(child); + break; + } + + /* + * execute single instruction. + */ + case PTRACE_SINGLESTEP: { + unsigned long next_pc; + unsigned long pc, insn; + + ret = -EIO; + if ((unsigned long) data > _NSIG) + break; + clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); + if ((child->ptrace & PT_DTRACE) == 0) { + /* Spurious delayed TF traps may occur */ + child->ptrace |= PT_DTRACE; + } + + /* Compute next pc. */ + pc = get_stack_long(child, PT_BPC); + + if (access_process_vm(child, pc&~3, &insn, sizeof(insn), 0) + != sizeof(insn)) + break; + + compute_next_pc(insn, pc, &next_pc, child); + if (next_pc & 0x80000000) + break; + + if (embed_debug_trap(child, next_pc)) + break; + + invalidate_cache(); + child->exit_code = data; + + /* give it a chance to run. */ + wake_up_process(child); + ret = 0; + break; + } + + /* + * detach a process that was attached. + */ + case PTRACE_DETACH: + ret = 0; + ret = ptrace_detach(child, data); + break; + + case PTRACE_GETREGS: + ret = ptrace_getregs(child, (void __user *)data); + break; + + case PTRACE_SETREGS: + ret = ptrace_setregs(child, (void __user *)data); + break; + + default: + ret = ptrace_request(child, request, addr, data); + break; + } + + return ret; +} + +asmlinkage int sys_ptrace(long request, long pid, long addr, long data) +{ + struct task_struct *child; + int ret; + + lock_kernel(); + ret = -EPERM; + if (request == PTRACE_TRACEME) { + /* are we already being traced? */ + if (current->ptrace & PT_PTRACED) + goto out; + /* set the ptrace bit in the process flags. */ + current->ptrace |= PT_PTRACED; + ret = 0; + goto out; + } + ret = -ESRCH; + read_lock(&tasklist_lock); + child = find_task_by_pid(pid); + if (child) + get_task_struct(child); + read_unlock(&tasklist_lock); + if (!child) + goto out; + + ret = -EPERM; + if (pid == 1) /* you may not mess with init */ + goto out; + + if (request == PTRACE_ATTACH) { + ret = ptrace_attach(child); + if (ret == 0) + init_debug_traps(child); + goto out_tsk; + } + + ret = ptrace_check_attach(child, request == PTRACE_KILL); + if (ret == 0) + ret = do_ptrace(request, child, addr, data); + +out_tsk: + put_task_struct(child); +out: + unlock_kernel(); + + return ret; +} + +/* notification of system call entry/exit + * - triggered by current->work.syscall_trace + */ +void do_syscall_trace(void) +{ + if (!test_thread_flag(TIF_SYSCALL_TRACE)) + return; + if (!(current->ptrace & PT_PTRACED)) + return; + /* the 0x80 provides a way for the tracing parent to distinguish + between a syscall stop and SIGTRAP delivery */ + ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) + ? 0x80 : 0)); + + /* + * this isn't the same as continuing with a signal, but it will do + * for normal use. strace only continues with a signal if the + * stopping signal is not SIGTRAP. -brl + */ + if (current->exit_code) { + send_sig(current->exit_code, current, 1); + current->exit_code = 0; + } +} + diff -Nru a/arch/m32r/kernel/semaphore.c b/arch/m32r/kernel/semaphore.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/semaphore.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,186 @@ +/* + * linux/arch/m32r/semaphore.c + * orig : i386 2.6.4 + * + * M32R semaphore implementation. + * + * Copyright (c) 2002 - 2004 Hitoshi Yamamoto + */ + +/* + * i386 semaphore implementation. + * + * (C) Copyright 1999 Linus Torvalds + * + * Portions Copyright 1999 Red Hat, Inc. + * + * 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. + * + * rw semaphores implemented November 1999 by Benjamin LaHaise + */ +#include +#include +#include +#include +#include + +/* + * Semaphores are implemented using a two-way counter: + * The "count" variable is decremented for each process + * that tries to acquire the semaphore, while the "sleeping" + * variable is a count of such acquires. + * + * Notably, the inline "up()" and "down()" functions can + * efficiently test if they need to do any extra work (up + * needs to do something only if count was negative before + * the increment operation. + * + * "sleeping" and the contention routine ordering is protected + * by the spinlock in the semaphore's waitqueue head. + * + * Note that these functions are only called when there is + * contention on the lock, and as such all this is the + * "non-critical" part of the whole semaphore business. The + * critical part is the inline stuff in + * where we want to avoid any extra jumps and calls. + */ + +/* + * Logic: + * - only on a boundary condition do we need to care. When we go + * from a negative count to a non-negative, we wake people up. + * - when we go from a non-negative count to a negative do we + * (a) synchronize with the "sleeper" count and (b) make sure + * that we're on the wakeup list before we synchronize so that + * we cannot lose wakeup events. + */ + +asmlinkage void __up(struct semaphore *sem) +{ + wake_up(&sem->wait); +} + +asmlinkage void __sched __down(struct semaphore * sem) +{ + struct task_struct *tsk = current; + DECLARE_WAITQUEUE(wait, tsk); + unsigned long flags; + + tsk->state = TASK_UNINTERRUPTIBLE; + spin_lock_irqsave(&sem->wait.lock, flags); + add_wait_queue_exclusive_locked(&sem->wait, &wait); + + sem->sleepers++; + for (;;) { + int sleepers = sem->sleepers; + + /* + * Add "everybody else" into it. They aren't + * playing, because we own the spinlock in + * the wait_queue_head. + */ + if (!atomic_add_negative(sleepers - 1, &sem->count)) { + sem->sleepers = 0; + break; + } + sem->sleepers = 1; /* us - see -1 above */ + spin_unlock_irqrestore(&sem->wait.lock, flags); + + schedule(); + + spin_lock_irqsave(&sem->wait.lock, flags); + tsk->state = TASK_UNINTERRUPTIBLE; + } + remove_wait_queue_locked(&sem->wait, &wait); + wake_up_locked(&sem->wait); + spin_unlock_irqrestore(&sem->wait.lock, flags); + tsk->state = TASK_RUNNING; +} + +asmlinkage int __sched __down_interruptible(struct semaphore * sem) +{ + int retval = 0; + struct task_struct *tsk = current; + DECLARE_WAITQUEUE(wait, tsk); + unsigned long flags; + + tsk->state = TASK_INTERRUPTIBLE; + spin_lock_irqsave(&sem->wait.lock, flags); + add_wait_queue_exclusive_locked(&sem->wait, &wait); + + sem->sleepers++; + for (;;) { + int sleepers = sem->sleepers; + + /* + * With signals pending, this turns into + * the trylock failure case - we won't be + * sleeping, and we* can't get the lock as + * it has contention. Just correct the count + * and exit. + */ + if (signal_pending(current)) { + retval = -EINTR; + sem->sleepers = 0; + atomic_add(sleepers, &sem->count); + break; + } + + /* + * Add "everybody else" into it. They aren't + * playing, because we own the spinlock in + * wait_queue_head. The "-1" is because we're + * still hoping to get the semaphore. + */ + if (!atomic_add_negative(sleepers - 1, &sem->count)) { + sem->sleepers = 0; + break; + } + sem->sleepers = 1; /* us - see -1 above */ + spin_unlock_irqrestore(&sem->wait.lock, flags); + + schedule(); + + spin_lock_irqsave(&sem->wait.lock, flags); + tsk->state = TASK_INTERRUPTIBLE; + } + remove_wait_queue_locked(&sem->wait, &wait); + wake_up_locked(&sem->wait); + spin_unlock_irqrestore(&sem->wait.lock, flags); + + tsk->state = TASK_RUNNING; + return retval; +} + +/* + * Trylock failed - make sure we correct for + * having decremented the count. + * + * We could have done the trylock with a + * single "cmpxchg" without failure cases, + * but then it wouldn't work on a 386. + */ +asmlinkage int __down_trylock(struct semaphore * sem) +{ + int sleepers; + unsigned long flags; + + spin_lock_irqsave(&sem->wait.lock, flags); + sleepers = sem->sleepers + 1; + sem->sleepers = 0; + + /* + * Add "everybody else" and us into it. They aren't + * playing, because we own the spinlock in the + * wait_queue_head. + */ + if (!atomic_add_negative(sleepers, &sem->count)) { + wake_up_locked(&sem->wait); + } + + spin_unlock_irqrestore(&sem->wait.lock, flags); + return 1; +} diff -Nru a/arch/m32r/kernel/setup.c b/arch/m32r/kernel/setup.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/setup.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,403 @@ +/* + * linux/arch/m32r/kernel/setup.c + * + * Setup routines for MITSUBISHI M32R + * + * Copyright (c) 2001, 2002 Hiroyuki Kondo, Hirokazu Takata, + * Hitoshi Yamamoto + */ + +/* $Id$ */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef CONFIG_MMU +extern void init_mmu(void); +#endif + +#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_HD) \ + || defined(CONFIG_BLK_DEV_IDE_MODULE) \ + || defined(CONFIG_BLK_DEV_HD_MODULE) +struct drive_info_struct { char dummy[32]; } drive_info; +#endif + +extern char _end[]; + +/* + * Machine setup.. + */ +struct cpuinfo_m32r boot_cpu_data; + +#ifdef CONFIG_BLK_DEV_RAM +extern int rd_doload; /* 1 = load ramdisk, 0 = don't load */ +extern int rd_prompt; /* 1 = prompt for ramdisk, 0 = don't prompt */ +extern int rd_image_start; /* starting block # of image */ +#endif + +#if defined(CONFIG_VGA_CONSOLE) +struct screen_info screen_info = { + .orig_video_lines = 25, + .orig_video_cols = 80, + .orig_video_mode = 0, + .orig_video_ega_bx = 0, + .orig_video_isVGA = 1, + .orig_video_points = 8 +}; +#endif + +extern int root_mountflags; + +static char command_line[COMMAND_LINE_SIZE]; + +static struct resource data_resource = { + .name = "Kernel data", + .start = 0, + .end = 0, + .flags = IORESOURCE_BUSY | IORESOURCE_MEM +}; + +static struct resource code_resource = { + .name = "Kernel code", + .start = 0, + .end = 0, + .flags = IORESOURCE_BUSY | IORESOURCE_MEM +}; + +unsigned long memory_start; +unsigned long memory_end; + +void __init setup_arch(char **); +int get_cpuinfo(char *); + +static __inline__ void parse_mem_cmdline(char ** cmdline_p) +{ + char c = ' '; + char *to = command_line; + char *from = COMMAND_LINE; + int len = 0; + int usermem = 0; + + /* Save unparsed command line copy for /proc/cmdline */ + memcpy(saved_command_line, COMMAND_LINE, COMMAND_LINE_SIZE); + saved_command_line[COMMAND_LINE_SIZE-1] = '\0'; + + memory_start = (unsigned long)CONFIG_MEMORY_START+PAGE_OFFSET; + memory_end = memory_start+(unsigned long)CONFIG_MEMORY_SIZE; + + for ( ; ; ) { + if (c == ' ' && !memcmp(from, "mem=", 4)) { + if (to != command_line) + to--; + + { + unsigned long mem_size; + + usermem = 1; + mem_size = memparse(from+4, &from); + memory_end = memory_start + mem_size; + } + } + c = *(from++); + if (!c) + break; + + if (COMMAND_LINE_SIZE <= ++len) + break; + + *(to++) = c; + } + *to = '\0'; + *cmdline_p = command_line; + if (usermem) + printk(KERN_INFO "user-defined physical RAM map:\n"); +} + +#ifndef CONFIG_DISCONTIGMEM +static unsigned long __init setup_memory(void) +{ + unsigned long start_pfn, max_low_pfn, bootmap_size; + + start_pfn = PFN_UP( __pa(_end) ); + max_low_pfn = PFN_DOWN( __pa(memory_end) ); + + /* + * Initialize the boot-time allocator (with low memory only): + */ + bootmap_size = init_bootmem_node(NODE_DATA(0), start_pfn, + CONFIG_MEMORY_START>>PAGE_SHIFT, max_low_pfn); + + /* + * Register fully available low RAM pages with the bootmem allocator. + */ + { + unsigned long curr_pfn; + unsigned long last_pfn; + unsigned long pages; + + /* + * We are rounding up the start address of usable memory: + */ + curr_pfn = PFN_UP(__pa(memory_start)); + + /* + * ... and at the end of the usable range downwards: + */ + last_pfn = PFN_DOWN(__pa(memory_end)); + + if (last_pfn > max_low_pfn) + last_pfn = max_low_pfn; + + pages = last_pfn - curr_pfn; + free_bootmem(PFN_PHYS(curr_pfn), PFN_PHYS(pages)); + } + + /* + * Reserve the kernel text and + * Reserve the bootmem bitmap. We do this in two steps (first step + * was init_bootmem()), because this catches the (definitely buggy) + * case of us accidentally initializing the bootmem allocator with + * an invalid RAM area. + */ + reserve_bootmem(CONFIG_MEMORY_START + PAGE_SIZE, + (PFN_PHYS(start_pfn) + bootmap_size + PAGE_SIZE - 1) + - CONFIG_MEMORY_START); + + /* + * reserve physical page 0 - it's a special BIOS page on many boxes, + * enabling clean reboots, SMP operation, laptop functions. + */ + reserve_bootmem(CONFIG_MEMORY_START, PAGE_SIZE); + + /* + * reserve memory hole + */ +#ifdef CONFIG_MEMHOLE + reserve_bootmem(CONFIG_MEMHOLE_START, CONFIG_MEMHOLE_SIZE); +#endif + +#ifdef CONFIG_BLK_DEV_INITRD + if (LOADER_TYPE && INITRD_START) { + if (INITRD_START + INITRD_SIZE <= (max_low_pfn << PAGE_SHIFT)) { + reserve_bootmem(INITRD_START, INITRD_SIZE); + initrd_start = INITRD_START ? + INITRD_START + PAGE_OFFSET : 0; + + initrd_end = initrd_start + INITRD_SIZE; + printk("initrd:start[%08lx],size[%08lx]\n", + initrd_start, INITRD_SIZE); + } else { + printk("initrd extends beyond end of memory " + "(0x%08lx > 0x%08lx)\ndisabling initrd\n", + INITRD_START + INITRD_SIZE, + max_low_pfn << PAGE_SHIFT); + + initrd_start = 0; + } + } +#endif + + return max_low_pfn; +} +#else /* CONFIG_DISCONTIGMEM */ +extern unsigned long setup_memory(void); +#endif /* CONFIG_DISCONTIGMEM */ + +#define M32R_PCC_PCATCR 0x00ef7014 /* will move to m32r.h */ + +void __init setup_arch(char **cmdline_p) +{ + ROOT_DEV = old_decode_dev(ORIG_ROOT_DEV); + + boot_cpu_data.cpu_clock = M32R_CPUCLK; + boot_cpu_data.bus_clock = M32R_BUSCLK; + boot_cpu_data.timer_divide = M32R_TIMER_DIVIDE; + +#ifdef CONFIG_BLK_DEV_RAM + rd_image_start = RAMDISK_FLAGS & RAMDISK_IMAGE_START_MASK; + rd_prompt = ((RAMDISK_FLAGS & RAMDISK_PROMPT_FLAG) != 0); + rd_doload = ((RAMDISK_FLAGS & RAMDISK_LOAD_FLAG) != 0); +#endif + + if (!MOUNT_ROOT_RDONLY) + root_mountflags &= ~MS_RDONLY; + +#ifdef CONFIG_VT +#if defined(CONFIG_VGA_CONSOLE) + conswitchp = &vga_con; +#elif defined(CONFIG_DUMMY_CONSOLE) + conswitchp = &dummy_con; +#endif +#endif + +#ifdef CONFIG_DISCONTIGMEM + numnodes = 2; +#endif /* CONFIG_DISCONTIGMEM */ + + init_mm.start_code = (unsigned long) _text; + init_mm.end_code = (unsigned long) _etext; + init_mm.end_data = (unsigned long) _edata; + init_mm.brk = (unsigned long) _end; + + code_resource.start = virt_to_phys(_text); + code_resource.end = virt_to_phys(_etext)-1; + data_resource.start = virt_to_phys(_etext); + data_resource.end = virt_to_phys(_edata)-1; + + parse_mem_cmdline(cmdline_p); + + setup_memory(); + + paging_init(); +} + +#ifdef CONFIG_PROC_FS +/* + * Get CPU information for use by the procfs. + */ +static int show_cpuinfo(struct seq_file *m, void *v) +{ + struct cpuinfo_m32r *c = v; + unsigned long cpu = c - cpu_data; + +#ifdef CONFIG_SMP + if (!cpu_online(cpu)) + return 0; +#endif /* CONFIG_SMP */ + + seq_printf(m, "processor\t: %ld\n", cpu); + +#ifdef CONFIG_CHIP_VDEC2 + seq_printf(m, "cpu family\t: VDEC2\n" + "cache size\t: Unknown\n"); +#elif CONFIG_CHIP_M32700 + seq_printf(m,"cpu family\t: M32700\n" + "cache size\t: I-8KB/D-8KB\n"); +#elif CONFIG_CHIP_M32102 + seq_printf(m,"cpu family\t: M32102\n" + "cache size\t: I-8KB\n"); +#elif CONFIG_CHIP_OPSP + seq_printf(m,"cpu family\t: OPSP\n" + "cache size\t: I-8KB/D-8KB\n"); +#elif CONFIG_CHIP_MP + seq_printf(m, "cpu family\t: M32R-MP\n" + "cache size\t: I-xxKB/D-xxKB\n"); +#else + seq_printf(m, "cpu family\t: Unknown\n"); +#endif + seq_printf(m, "bogomips\t: %lu.%02lu\n", + c->loops_per_jiffy/(500000/HZ), + (c->loops_per_jiffy/(5000/HZ)) % 100); +#ifdef CONFIG_PLAT_MAPPI + seq_printf(m, "Machine\t\t: Mappi Evaluation board\n"); +#elif CONFIG_PLAT_MAPPI2 + seq_printf(m, "Machine\t\t: Mappi-II Evaluation board\n"); +#elif CONFIG_PLAT_M32700UT + seq_printf(m, "Machine\t\t: M32700UT Evaluation board\n"); +#elif CONFIG_PLAT_OPSPUT + seq_printf(m, "Machine\t\t: OPSPUT Evaluation board\n"); +#elif CONFIG_PLAT_USRV + seq_printf(m, "Machine\t\t: uServer\n"); +#elif CONFIG_PLAT_OAKS32R + seq_printf(m, "Machine\t\t: OAKS32R\n"); +#else + seq_printf(m, "Machine\t\t: Unknown\n"); +#endif + +#define PRINT_CLOCK(name, value) \ + seq_printf(m, name " clock\t: %d.%02dMHz\n", \ + ((value) / 1000000), ((value) % 1000000)/10000) + + PRINT_CLOCK("CPU", (int)c->cpu_clock); + PRINT_CLOCK("Bus", (int)c->bus_clock); + + seq_printf(m, "\n"); + + return 0; +} + +static void *c_start(struct seq_file *m, loff_t *pos) +{ + return *pos < NR_CPUS ? cpu_data + *pos : NULL; +} + +static void *c_next(struct seq_file *m, void *v, loff_t *pos) +{ + ++*pos; + return c_start(m, pos); +} + +static void c_stop(struct seq_file *m, void *v) +{ +} + +struct seq_operations cpuinfo_op = { + start: c_start, + next: c_next, + stop: c_stop, + show: show_cpuinfo, +}; +#endif /* CONFIG_PROC_FS */ + +unsigned long cpu_initialized __initdata = 0; + +/* + * cpu_init() initializes state that is per-CPU. Some data is already + * initialized (naturally) in the bootstrap process. + * We reload them nevertheless, this function acts as a + * 'CPU state barrier', nothing should get across. + */ +#if defined(CONFIG_CHIP_VDEC2) || defined(CONFIG_CHIP_XNUX2) \ + || defined(CONFIG_CHIP_M32700) || defined(CONFIG_CHIP_M32102) \ + || defined(CONFIG_CHIP_OPSP) +void __init cpu_init (void) +{ + int cpu_id = smp_processor_id(); + + if (test_and_set_bit(cpu_id, &cpu_initialized)) { + printk(KERN_WARNING "CPU#%d already initialized!\n", cpu_id); + for ( ; ; ) + local_irq_enable(); + } + printk(KERN_INFO "Initializing CPU#%d\n", cpu_id); + + /* Set up and load the per-CPU TSS and LDT */ + atomic_inc(&init_mm.mm_count); + current->active_mm = &init_mm; + if (current->mm) + BUG(); + + /* Force FPU initialization */ + current_thread_info()->status = 0; + current->used_math = 0; + +#ifdef CONFIG_MMU + /* Set up MMU */ + init_mmu(); +#endif + + /* Set up ICUIMASK */ + outl(0x00070000, M32R_ICU_IMASK_PORTL); /* imask=111 */ +} +#endif /* defined(CONFIG_CHIP_VDEC2) ... */ + diff -Nru a/arch/m32r/kernel/setup_m32700ut.c b/arch/m32r/kernel/setup_m32700ut.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/setup_m32700ut.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,480 @@ +/* + * linux/arch/m32r/kernel/setup_m32700ut.c + * + * Setup routines for MITSUBISHI M32700UT Board + * + * Copyright (c) 2002 Hiroyuki Kondo, Hirokazu Takata, + * Hitoshi Yamamoto, Takeo Takahashi + * + * 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. + * + * $Id: setup_m32700ut.c,v 1.6 2003/11/27 10:18:49 takeo Exp $ + */ + +#include +#include +#include +#include +#include + +#include +#include +#include + +/* + * M32700 Interrupt Control Unit (Level 1) + */ +#define irq2port(x) (M32R_ICU_CR1_PORTL + ((x - 1) * sizeof(unsigned long))) + +#ifndef CONFIG_SMP +typedef struct { + unsigned long icucr; /* ICU Control Register */ +} icu_data_t; +#endif /* CONFIG_SMP */ + +static icu_data_t icu_data[M32700UT_NUM_CPU_IRQ]; + +static void disable_m32700ut_irq(unsigned int irq) +{ + unsigned long port, data; + + port = irq2port(irq); + data = icu_data[irq].icucr|M32R_ICUCR_ILEVEL7; + outl(data, port); +} + +static void enable_m32700ut_irq(unsigned int irq) +{ + unsigned long port, data; + + port = irq2port(irq); + data = icu_data[irq].icucr|M32R_ICUCR_IEN|M32R_ICUCR_ILEVEL6; + outl(data, port); +} + +static void mask_and_ack_m32700ut(unsigned int irq) +{ + disable_m32700ut_irq(irq); +} + +static void end_m32700ut_irq(unsigned int irq) +{ + enable_m32700ut_irq(irq); +} + +static unsigned int startup_m32700ut_irq(unsigned int irq) +{ + enable_m32700ut_irq(irq); + return (0); +} + +static void shutdown_m32700ut_irq(unsigned int irq) +{ + unsigned long port; + + port = irq2port(irq); + outl(M32R_ICUCR_ILEVEL7, port); +} + +static struct hw_interrupt_type m32700ut_irq_type = +{ + "M32700UT-IRQ", + startup_m32700ut_irq, + shutdown_m32700ut_irq, + enable_m32700ut_irq, + disable_m32700ut_irq, + mask_and_ack_m32700ut, + end_m32700ut_irq +}; + +/* + * Interrupt Control Unit of PLD on M32700UT (Level 2) + */ +#define irq2pldirq(x) ((x) - M32700UT_PLD_IRQ_BASE) +#define pldirq2port(x) (unsigned long)((int)PLD_ICUCR1 + \ + (((x) - 1) * sizeof(unsigned short))) + +typedef struct { + unsigned short icucr; /* ICU Control Register */ +} pld_icu_data_t; + +static pld_icu_data_t pld_icu_data[M32700UT_NUM_PLD_IRQ]; + +static void disable_m32700ut_pld_irq(unsigned int irq) +{ + unsigned long port, data; + unsigned int pldirq; + + pldirq = irq2pldirq(irq); +// disable_m32700ut_irq(M32R_IRQ_INT1); + port = pldirq2port(pldirq); + data = pld_icu_data[pldirq].icucr|PLD_ICUCR_ILEVEL7; + outw(data, port); +} + +static void enable_m32700ut_pld_irq(unsigned int irq) +{ + unsigned long port, data; + unsigned int pldirq; + + pldirq = irq2pldirq(irq); +// enable_m32700ut_irq(M32R_IRQ_INT1); + port = pldirq2port(pldirq); + data = pld_icu_data[pldirq].icucr|PLD_ICUCR_IEN|PLD_ICUCR_ILEVEL6; + outw(data, port); +} + +static void mask_and_ack_m32700ut_pld(unsigned int irq) +{ + disable_m32700ut_pld_irq(irq); +// mask_and_ack_m32700ut(M32R_IRQ_INT1); +} + +static void end_m32700ut_pld_irq(unsigned int irq) +{ + enable_m32700ut_pld_irq(irq); + end_m32700ut_irq(M32R_IRQ_INT1); +} + +static unsigned int startup_m32700ut_pld_irq(unsigned int irq) +{ + enable_m32700ut_pld_irq(irq); + return (0); +} + +static void shutdown_m32700ut_pld_irq(unsigned int irq) +{ + unsigned long port; + unsigned int pldirq; + + pldirq = irq2pldirq(irq); +// shutdown_m32700ut_irq(M32R_IRQ_INT1); + port = pldirq2port(pldirq); + outw(PLD_ICUCR_ILEVEL7, port); +} + +static struct hw_interrupt_type m32700ut_pld_irq_type = +{ + "M32700UT-PLD-IRQ", + startup_m32700ut_pld_irq, + shutdown_m32700ut_pld_irq, + enable_m32700ut_pld_irq, + disable_m32700ut_pld_irq, + mask_and_ack_m32700ut_pld, + end_m32700ut_pld_irq +}; + +/* + * Interrupt Control Unit of PLD on M32700UT-LAN (Level 2) + */ +#define irq2lanpldirq(x) ((x) - M32700UT_LAN_PLD_IRQ_BASE) +#define lanpldirq2port(x) (unsigned long)((int)M32700UT_LAN_ICUCR1 + \ + (((x) - 1) * sizeof(unsigned short))) + +static pld_icu_data_t lanpld_icu_data[M32700UT_NUM_LAN_PLD_IRQ]; + +static void disable_m32700ut_lanpld_irq(unsigned int irq) +{ + unsigned long port, data; + unsigned int pldirq; + + pldirq = irq2lanpldirq(irq); + port = lanpldirq2port(pldirq); + data = lanpld_icu_data[pldirq].icucr|PLD_ICUCR_ILEVEL7; + outw(data, port); +} + +static void enable_m32700ut_lanpld_irq(unsigned int irq) +{ + unsigned long port, data; + unsigned int pldirq; + + pldirq = irq2lanpldirq(irq); + port = lanpldirq2port(pldirq); + data = lanpld_icu_data[pldirq].icucr|PLD_ICUCR_IEN|PLD_ICUCR_ILEVEL6; + outw(data, port); +} + +static void mask_and_ack_m32700ut_lanpld(unsigned int irq) +{ + disable_m32700ut_lanpld_irq(irq); +} + +static void end_m32700ut_lanpld_irq(unsigned int irq) +{ + enable_m32700ut_lanpld_irq(irq); + end_m32700ut_irq(M32R_IRQ_INT0); +} + +static unsigned int startup_m32700ut_lanpld_irq(unsigned int irq) +{ + enable_m32700ut_lanpld_irq(irq); + return (0); +} + +static void shutdown_m32700ut_lanpld_irq(unsigned int irq) +{ + unsigned long port; + unsigned int pldirq; + + pldirq = irq2lanpldirq(irq); + port = lanpldirq2port(pldirq); + outw(PLD_ICUCR_ILEVEL7, port); +} + +static struct hw_interrupt_type m32700ut_lanpld_irq_type = +{ + "M32700UT-PLD-LAN-IRQ", + startup_m32700ut_lanpld_irq, + shutdown_m32700ut_lanpld_irq, + enable_m32700ut_lanpld_irq, + disable_m32700ut_lanpld_irq, + mask_and_ack_m32700ut_lanpld, + end_m32700ut_lanpld_irq +}; + +/* + * Interrupt Control Unit of PLD on M32700UT-LCD (Level 2) + */ +#define irq2lcdpldirq(x) ((x) - M32700UT_LCD_PLD_IRQ_BASE) +#define lcdpldirq2port(x) (unsigned long)((int)M32700UT_LCD_ICUCR1 + \ + (((x) - 1) * sizeof(unsigned short))) + +static pld_icu_data_t lcdpld_icu_data[M32700UT_NUM_LCD_PLD_IRQ]; + +static void disable_m32700ut_lcdpld_irq(unsigned int irq) +{ + unsigned long port, data; + unsigned int pldirq; + + pldirq = irq2lcdpldirq(irq); + port = lcdpldirq2port(pldirq); + data = lcdpld_icu_data[pldirq].icucr|PLD_ICUCR_ILEVEL7; + outw(data, port); +} + +static void enable_m32700ut_lcdpld_irq(unsigned int irq) +{ + unsigned long port, data; + unsigned int pldirq; + + pldirq = irq2lcdpldirq(irq); + port = lcdpldirq2port(pldirq); + data = lcdpld_icu_data[pldirq].icucr|PLD_ICUCR_IEN|PLD_ICUCR_ILEVEL6; + outw(data, port); +} + +static void mask_and_ack_m32700ut_lcdpld(unsigned int irq) +{ + disable_m32700ut_lcdpld_irq(irq); +} + +static void end_m32700ut_lcdpld_irq(unsigned int irq) +{ + enable_m32700ut_lcdpld_irq(irq); + end_m32700ut_irq(M32R_IRQ_INT2); +} + +static unsigned int startup_m32700ut_lcdpld_irq(unsigned int irq) +{ + enable_m32700ut_lcdpld_irq(irq); + return (0); +} + +static void shutdown_m32700ut_lcdpld_irq(unsigned int irq) +{ + unsigned long port; + unsigned int pldirq; + + pldirq = irq2lcdpldirq(irq); + port = lcdpldirq2port(pldirq); + outw(PLD_ICUCR_ILEVEL7, port); +} + +static struct hw_interrupt_type m32700ut_lcdpld_irq_type = +{ + "M32700UT-PLD-LCD-IRQ", + startup_m32700ut_lcdpld_irq, + shutdown_m32700ut_lcdpld_irq, + enable_m32700ut_lcdpld_irq, + disable_m32700ut_lcdpld_irq, + mask_and_ack_m32700ut_lcdpld, + end_m32700ut_lcdpld_irq +}; + +void __init init_IRQ(void) +{ +#if defined(CONFIG_SMC91X) + /* INT#0: LAN controller on M32700UT-LAN (SMC91C111)*/ + irq_desc[M32700UT_LAN_IRQ_LAN].status = IRQ_DISABLED; + irq_desc[M32700UT_LAN_IRQ_LAN].handler = &m32700ut_lanpld_irq_type; + irq_desc[M32700UT_LAN_IRQ_LAN].action = 0; + irq_desc[M32700UT_LAN_IRQ_LAN].depth = 1; /* disable nested irq */ + lanpld_icu_data[irq2lanpldirq(M32700UT_LAN_IRQ_LAN)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD02; /* "H" edge sense */ + disable_m32700ut_lanpld_irq(M32700UT_LAN_IRQ_LAN); +#endif /* CONFIG_SMC91X */ + + /* MFT2 : system timer */ + irq_desc[M32R_IRQ_MFT2].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_MFT2].handler = &m32700ut_irq_type; + irq_desc[M32R_IRQ_MFT2].action = 0; + irq_desc[M32R_IRQ_MFT2].depth = 1; + icu_data[M32R_IRQ_MFT2].icucr = M32R_ICUCR_IEN; + disable_m32700ut_irq(M32R_IRQ_MFT2); + + /* SIO0 : receive */ + irq_desc[M32R_IRQ_SIO0_R].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_SIO0_R].handler = &m32700ut_irq_type; + irq_desc[M32R_IRQ_SIO0_R].action = 0; + irq_desc[M32R_IRQ_SIO0_R].depth = 1; + icu_data[M32R_IRQ_SIO0_R].icucr = 0; + disable_m32700ut_irq(M32R_IRQ_SIO0_R); + + /* SIO0 : send */ + irq_desc[M32R_IRQ_SIO0_S].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_SIO0_S].handler = &m32700ut_irq_type; + irq_desc[M32R_IRQ_SIO0_S].action = 0; + irq_desc[M32R_IRQ_SIO0_S].depth = 1; + icu_data[M32R_IRQ_SIO0_S].icucr = 0; + disable_m32700ut_irq(M32R_IRQ_SIO0_S); + + /* SIO1 : receive */ + irq_desc[M32R_IRQ_SIO1_R].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_SIO1_R].handler = &m32700ut_irq_type; + irq_desc[M32R_IRQ_SIO1_R].action = 0; + irq_desc[M32R_IRQ_SIO1_R].depth = 1; + icu_data[M32R_IRQ_SIO1_R].icucr = 0; + disable_m32700ut_irq(M32R_IRQ_SIO1_R); + + /* SIO1 : send */ + irq_desc[M32R_IRQ_SIO1_S].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_SIO1_S].handler = &m32700ut_irq_type; + irq_desc[M32R_IRQ_SIO1_S].action = 0; + irq_desc[M32R_IRQ_SIO1_S].depth = 1; + icu_data[M32R_IRQ_SIO1_S].icucr = 0; + disable_m32700ut_irq(M32R_IRQ_SIO1_S); + + /* DMA1 : */ + irq_desc[M32R_IRQ_DMA1].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_DMA1].handler = &m32700ut_irq_type; + irq_desc[M32R_IRQ_DMA1].action = 0; + irq_desc[M32R_IRQ_DMA1].depth = 1; + icu_data[M32R_IRQ_DMA1].icucr = 0; + disable_m32700ut_irq(M32R_IRQ_DMA1); + +#ifdef CONFIG_SERIAL_M32R_PLDSIO + /* INT#1: SIO0 Receive on PLD */ + irq_desc[PLD_IRQ_SIO0_RCV].status = IRQ_DISABLED; + irq_desc[PLD_IRQ_SIO0_RCV].handler = &m32700ut_pld_irq_type; + irq_desc[PLD_IRQ_SIO0_RCV].action = 0; + irq_desc[PLD_IRQ_SIO0_RCV].depth = 1; /* disable nested irq */ + pld_icu_data[irq2pldirq(PLD_IRQ_SIO0_RCV)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD03; + disable_m32700ut_pld_irq(PLD_IRQ_SIO0_RCV); + + /* INT#1: SIO0 Send on PLD */ + irq_desc[PLD_IRQ_SIO0_SND].status = IRQ_DISABLED; + irq_desc[PLD_IRQ_SIO0_SND].handler = &m32700ut_pld_irq_type; + irq_desc[PLD_IRQ_SIO0_SND].action = 0; + irq_desc[PLD_IRQ_SIO0_SND].depth = 1; /* disable nested irq */ + pld_icu_data[irq2pldirq(PLD_IRQ_SIO0_SND)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD03; + disable_m32700ut_pld_irq(PLD_IRQ_SIO0_SND); +#endif /* CONFIG_SERIAL_M32R_PLDSIO */ + + /* INT#1: CFC IREQ on PLD */ + irq_desc[PLD_IRQ_CFIREQ].status = IRQ_DISABLED; + irq_desc[PLD_IRQ_CFIREQ].handler = &m32700ut_pld_irq_type; + irq_desc[PLD_IRQ_CFIREQ].action = 0; + irq_desc[PLD_IRQ_CFIREQ].depth = 1; /* disable nested irq */ + pld_icu_data[irq2pldirq(PLD_IRQ_CFIREQ)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD01; /* 'L' level sense */ + disable_m32700ut_pld_irq(PLD_IRQ_CFIREQ); + + /* INT#1: CFC Insert on PLD */ + irq_desc[PLD_IRQ_CFC_INSERT].status = IRQ_DISABLED; + irq_desc[PLD_IRQ_CFC_INSERT].handler = &m32700ut_pld_irq_type; + irq_desc[PLD_IRQ_CFC_INSERT].action = 0; + irq_desc[PLD_IRQ_CFC_INSERT].depth = 1; /* disable nested irq */ + pld_icu_data[irq2pldirq(PLD_IRQ_CFC_INSERT)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD00; /* 'L' edge sense */ + disable_m32700ut_pld_irq(PLD_IRQ_CFC_INSERT); + + /* INT#1: CFC Eject on PLD */ + irq_desc[PLD_IRQ_CFC_EJECT].status = IRQ_DISABLED; + irq_desc[PLD_IRQ_CFC_EJECT].handler = &m32700ut_pld_irq_type; + irq_desc[PLD_IRQ_CFC_EJECT].action = 0; + irq_desc[PLD_IRQ_CFC_EJECT].depth = 1; /* disable nested irq */ + pld_icu_data[irq2pldirq(PLD_IRQ_CFC_EJECT)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD02; /* 'H' edge sense */ + disable_m32700ut_pld_irq(PLD_IRQ_CFC_EJECT); + + /* + * INT0# is used for LAN, DIO + * We enable it here. + */ + icu_data[M32R_IRQ_INT0].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD11; + enable_m32700ut_irq(M32R_IRQ_INT0); + + /* + * INT1# is used for UART, MMC, CF Controller in FPGA. + * We enable it here. + */ + icu_data[M32R_IRQ_INT1].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD11; + enable_m32700ut_irq(M32R_IRQ_INT1); + +#if defined(CONFIG_USB) + outw(USBCR_OTGS, USBCR); /* USBCR: non-OTG */ + + irq_desc[M32700UT_LCD_IRQ_USB_INT1].status = IRQ_DISABLED; + irq_desc[M32700UT_LCD_IRQ_USB_INT1].handler = &m32700ut_lcdpld_irq_type; + irq_desc[M32700UT_LCD_IRQ_USB_INT1].action = 0; + irq_desc[M32700UT_LCD_IRQ_USB_INT1].depth = 1; + lcdpld_icu_data[irq2lcdpldirq(M32700UT_LCD_IRQ_USB_INT1)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD01; /* "L" level sense */ + disable_m32700ut_lcdpld_irq(M32700UT_LCD_IRQ_USB_INT1); +#endif + /* + * INT2# is used for BAT, USB, AUDIO + * We enable it here. + */ + icu_data[M32R_IRQ_INT2].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD01; + enable_m32700ut_irq(M32R_IRQ_INT2); + +//#if defined(CONFIG_M32R_AR_VGA) + /* + * INT3# is used for AR + */ + irq_desc[M32R_IRQ_INT3].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_INT3].handler = &m32700ut_irq_type; + irq_desc[M32R_IRQ_INT3].action = 0; + irq_desc[M32R_IRQ_INT3].depth = 1; + icu_data[M32R_IRQ_INT3].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10; + disable_m32700ut_irq(M32R_IRQ_INT3); +//#endif /* CONFIG_M32R_ARV */ +} + +#define LAN_IOSTART 0x300 +#define LAN_IOEND 0x320 +static struct resource smc91x_resources[] = { + [0] = { + .start = (LAN_IOSTART), + .end = (LAN_IOEND), + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = M32700UT_LAN_IRQ_LAN, + .end = M32700UT_LAN_IRQ_LAN, + .flags = IORESOURCE_IRQ, + } +}; + +static struct platform_device smc91x_device = { + .name = "smc91x", + .id = 0, + .num_resources = ARRAY_SIZE(smc91x_resources), + .resource = smc91x_resources, +}; + +static int __init platform_init(void) +{ + platform_device_register(&smc91x_device); + return 0; +} +arch_initcall(platform_init); diff -Nru a/arch/m32r/kernel/setup_mappi.c b/arch/m32r/kernel/setup_mappi.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/setup_mappi.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,164 @@ +/* + * linux/arch/m32r/kernel/setup_mappi.c + * + * Setup routines for MITSUBISHI MAPPI Board + * + * Copyright (c) 2001, 2002 Hiroyuki Kondo, Hirokazu Takata, + * Hitoshi Yamamoto + */ + +static char *rcsid = +"$Id$"; +static void use_rcsid(void) {rcsid = rcsid; use_rcsid();} + +#include +#include +#include +#include + +#include +#include +#include + +#define irq2port(x) (M32R_ICU_CR1_PORTL + ((x - 1) * sizeof(unsigned long))) + +#ifndef CONFIG_SMP +typedef struct { + unsigned long icucr; /* ICU Control Register */ +} icu_data_t; +#endif /* CONFIG_SMP */ + +icu_data_t icu_data[NR_IRQS]; + +static void disable_mappi_irq(unsigned int irq) +{ + unsigned long port, data; + + port = irq2port(irq); + data = icu_data[irq].icucr|M32R_ICUCR_ILEVEL7; + outl(data, port); +} + +static void enable_mappi_irq(unsigned int irq) +{ + unsigned long port, data; + + port = irq2port(irq); + data = icu_data[irq].icucr|M32R_ICUCR_IEN|M32R_ICUCR_ILEVEL6; + outl(data, port); +} + +static void mask_and_ack_mappi(unsigned int irq) +{ + disable_mappi_irq(irq); +} + +static void end_mappi_irq(unsigned int irq) +{ + enable_mappi_irq(irq); +} + +static unsigned int startup_mappi_irq(unsigned int irq) +{ + enable_mappi_irq(irq); + return (0); +} + +static void shutdown_mappi_irq(unsigned int irq) +{ + unsigned long port; + + port = irq2port(irq); + outl(M32R_ICUCR_ILEVEL7, port); +} + +static struct hw_interrupt_type mappi_irq_type = +{ + "MAPPI-IRQ", + startup_mappi_irq, + shutdown_mappi_irq, + enable_mappi_irq, + disable_mappi_irq, + mask_and_ack_mappi, + end_mappi_irq +}; + +void __init init_IRQ(void) +{ + static int once = 0; + + if (once) + return; + else + once++; + +#ifdef CONFIG_NE2000 + /* INT0 : LAN controller (RTL8019AS) */ + irq_desc[M32R_IRQ_INT0].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_INT0].handler = &mappi_irq_type; + irq_desc[M32R_IRQ_INT0].action = 0; + irq_desc[M32R_IRQ_INT0].depth = 1; + icu_data[M32R_IRQ_INT0].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10; + disable_mappi_irq(M32R_IRQ_INT0); +#endif /* CONFIG_M32R_NE2000 */ + + /* MFT2 : system timer */ + irq_desc[M32R_IRQ_MFT2].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_MFT2].handler = &mappi_irq_type; + irq_desc[M32R_IRQ_MFT2].action = 0; + irq_desc[M32R_IRQ_MFT2].depth = 1; + icu_data[M32R_IRQ_MFT2].icucr = M32R_ICUCR_IEN; + disable_mappi_irq(M32R_IRQ_MFT2); + +#ifdef CONFIG_SERIAL_M32R_SIO + /* SIO0_R : uart receive data */ + irq_desc[M32R_IRQ_SIO0_R].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_SIO0_R].handler = &mappi_irq_type; + irq_desc[M32R_IRQ_SIO0_R].action = 0; + irq_desc[M32R_IRQ_SIO0_R].depth = 1; + icu_data[M32R_IRQ_SIO0_R].icucr = 0; + disable_mappi_irq(M32R_IRQ_SIO0_R); + + /* SIO0_S : uart send data */ + irq_desc[M32R_IRQ_SIO0_S].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_SIO0_S].handler = &mappi_irq_type; + irq_desc[M32R_IRQ_SIO0_S].action = 0; + irq_desc[M32R_IRQ_SIO0_S].depth = 1; + icu_data[M32R_IRQ_SIO0_S].icucr = 0; + disable_mappi_irq(M32R_IRQ_SIO0_S); + + /* SIO1_R : uart receive data */ + irq_desc[M32R_IRQ_SIO1_R].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_SIO1_R].handler = &mappi_irq_type; + irq_desc[M32R_IRQ_SIO1_R].action = 0; + irq_desc[M32R_IRQ_SIO1_R].depth = 1; + icu_data[M32R_IRQ_SIO1_R].icucr = 0; + disable_mappi_irq(M32R_IRQ_SIO1_R); + + /* SIO1_S : uart send data */ + irq_desc[M32R_IRQ_SIO1_S].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_SIO1_S].handler = &mappi_irq_type; + irq_desc[M32R_IRQ_SIO1_S].action = 0; + irq_desc[M32R_IRQ_SIO1_S].depth = 1; + icu_data[M32R_IRQ_SIO1_S].icucr = 0; + disable_mappi_irq(M32R_IRQ_SIO1_S); +#endif /* CONFIG_SERIAL_M32R_SIO */ + +#if defined(CONFIG_M32RPCC) + /* INT1 : pccard0 interrupt */ + irq_desc[M32R_IRQ_INT1].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_INT1].handler = &mappi_irq_type; + irq_desc[M32R_IRQ_INT1].action = 0; + irq_desc[M32R_IRQ_INT1].depth = 1; + icu_data[M32R_IRQ_INT1].icucr = M32R_ICUCR_IEN | M32R_ICUCR_ISMOD00; + disable_mappi_irq(M32R_IRQ_INT1); + + /* INT2 : pccard1 interrupt */ + irq_desc[M32R_IRQ_INT2].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_INT2].handler = &mappi_irq_type; + irq_desc[M32R_IRQ_INT2].action = 0; + irq_desc[M32R_IRQ_INT2].depth = 1; + icu_data[M32R_IRQ_INT2].icucr = M32R_ICUCR_IEN | M32R_ICUCR_ISMOD00; + disable_mappi_irq(M32R_IRQ_INT2); +#endif /* CONFIG_M32RPCC */ +} diff -Nru a/arch/m32r/kernel/setup_mappi2.c b/arch/m32r/kernel/setup_mappi2.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/setup_mappi2.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,216 @@ +/* + * linux/arch/m32r/kernel/setup_mappi.c + * + * Setup routines for Renesas MAPPI-II(M3A-ZA36) Board + * + * Copyright (c) 2001, 2002 Hiroyuki Kondo, Hirokazu Takata, + * Hitoshi Yamamoto, Mamoru Sakugawa + */ + +static char *rcsid = +"$Id$"; +static void use_rcsid(void) {rcsid = rcsid; use_rcsid();} + +#include +#include +#include +#include +#include + +#include +#include +#include + +#define irq2port(x) (M32R_ICU_CR1_PORTL + ((x - 1) * sizeof(unsigned long))) + +#ifndef CONFIG_SMP +typedef struct { + unsigned long icucr; /* ICU Control Register */ +} icu_data_t; +#endif /* CONFIG_SMP */ + +icu_data_t icu_data[NR_IRQS]; + +static void disable_mappi2_irq(unsigned int irq) +{ + unsigned long port, data; + + if ((irq == 0) ||(irq >= NR_IRQS)) { + printk("bad irq 0x%08x\n", irq); + return; + } + port = irq2port(irq); + data = icu_data[irq].icucr|M32R_ICUCR_ILEVEL7; + outl(data, port); +} + +static void enable_mappi2_irq(unsigned int irq) +{ + unsigned long port, data; + + if ((irq == 0) ||(irq >= NR_IRQS)) { + printk("bad irq 0x%08x\n", irq); + return; + } + port = irq2port(irq); + data = icu_data[irq].icucr|M32R_ICUCR_IEN|M32R_ICUCR_ILEVEL6; + outl(data, port); +} + +static void mask_and_ack_mappi2(unsigned int irq) +{ + disable_mappi2_irq(irq); +} + +static void end_mappi2_irq(unsigned int irq) +{ + enable_mappi2_irq(irq); +} + +static unsigned int startup_mappi2_irq(unsigned int irq) +{ + enable_mappi2_irq(irq); + return (0); +} + +static void shutdown_mappi2_irq(unsigned int irq) +{ + unsigned long port; + + port = irq2port(irq); + outl(M32R_ICUCR_ILEVEL7, port); +} + +static struct hw_interrupt_type mappi2_irq_type = +{ + "MAPPI2-IRQ", + startup_mappi2_irq, + shutdown_mappi2_irq, + enable_mappi2_irq, + disable_mappi2_irq, + mask_and_ack_mappi2, + end_mappi2_irq +}; + +void __init init_IRQ(void) +{ +#if defined(CONFIG_SMC91X) + /* INT0 : LAN controller (SMC91111) */ + irq_desc[M32R_IRQ_INT0].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_INT0].handler = &mappi2_irq_type; + irq_desc[M32R_IRQ_INT0].action = 0; + irq_desc[M32R_IRQ_INT0].depth = 1; + icu_data[M32R_IRQ_INT0].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10; + disable_mappi2_irq(M32R_IRQ_INT0); +#endif /* CONFIG_SMC91X */ + + /* MFT2 : system timer */ + irq_desc[M32R_IRQ_MFT2].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_MFT2].handler = &mappi2_irq_type; + irq_desc[M32R_IRQ_MFT2].action = 0; + irq_desc[M32R_IRQ_MFT2].depth = 1; + icu_data[M32R_IRQ_MFT2].icucr = M32R_ICUCR_IEN; + disable_mappi2_irq(M32R_IRQ_MFT2); + +#ifdef CONFIG_SERIAL_M32R_SIO + /* SIO0_R : uart receive data */ + irq_desc[M32R_IRQ_SIO0_R].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_SIO0_R].handler = &mappi2_irq_type; + irq_desc[M32R_IRQ_SIO0_R].action = 0; + irq_desc[M32R_IRQ_SIO0_R].depth = 1; + icu_data[M32R_IRQ_SIO0_R].icucr = 0; + disable_mappi2_irq(M32R_IRQ_SIO0_R); + + /* SIO0_S : uart send data */ + irq_desc[M32R_IRQ_SIO0_S].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_SIO0_S].handler = &mappi2_irq_type; + irq_desc[M32R_IRQ_SIO0_S].action = 0; + irq_desc[M32R_IRQ_SIO0_S].depth = 1; + icu_data[M32R_IRQ_SIO0_S].icucr = 0; + disable_mappi2_irq(M32R_IRQ_SIO0_S); + /* SIO1_R : uart receive data */ + irq_desc[M32R_IRQ_SIO1_R].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_SIO1_R].handler = &mappi2_irq_type; + irq_desc[M32R_IRQ_SIO1_R].action = 0; + irq_desc[M32R_IRQ_SIO1_R].depth = 1; + icu_data[M32R_IRQ_SIO1_R].icucr = 0; + disable_mappi2_irq(M32R_IRQ_SIO1_R); + + /* SIO1_S : uart send data */ + irq_desc[M32R_IRQ_SIO1_S].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_SIO1_S].handler = &mappi2_irq_type; + irq_desc[M32R_IRQ_SIO1_S].action = 0; + irq_desc[M32R_IRQ_SIO1_S].depth = 1; + icu_data[M32R_IRQ_SIO1_S].icucr = 0; + disable_mappi2_irq(M32R_IRQ_SIO1_S); +#endif /* CONFIG_M32R_USE_DBG_CONSOLE */ + +#if defined(CONFIG_USB) + /* INT1 : USB Host controller interrupt */ + irq_desc[M32R_IRQ_INT1].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_INT1].handler = &mappi2_irq_type; + irq_desc[M32R_IRQ_INT1].action = 0; + irq_desc[M32R_IRQ_INT1].depth = 1; + icu_data[M32R_IRQ_INT1].icucr = M32R_ICUCR_ISMOD01; + disable_mappi2_irq(M32R_IRQ_INT1); +#endif /* CONFIG_USB */ + +#if defined(CONFIG_M32R_CFC) + /* ICUCR40: CFC IREQ */ + irq_desc[PLD_IRQ_CFIREQ].status = IRQ_DISABLED; + irq_desc[PLD_IRQ_CFIREQ].handler = &mappi2_irq_type; + irq_desc[PLD_IRQ_CFIREQ].action = 0; + irq_desc[PLD_IRQ_CFIREQ].depth = 1; /* disable nested irq */ +// icu_data[PLD_IRQ_CFIREQ].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD00; + icu_data[PLD_IRQ_CFIREQ].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD01; + disable_mappi2_irq(PLD_IRQ_CFIREQ); + + /* ICUCR41: CFC Insert */ + irq_desc[PLD_IRQ_CFC_INSERT].status = IRQ_DISABLED; + irq_desc[PLD_IRQ_CFC_INSERT].handler = &mappi2_irq_type; + irq_desc[PLD_IRQ_CFC_INSERT].action = 0; + irq_desc[PLD_IRQ_CFC_INSERT].depth = 1; /* disable nested irq */ + icu_data[PLD_IRQ_CFC_INSERT].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD00; +// icu_data[PLD_IRQ_CFC_INSERT].icucr = 0; + disable_mappi2_irq(PLD_IRQ_CFC_INSERT); + + /* ICUCR42: CFC Eject */ + irq_desc[PLD_IRQ_CFC_EJECT].status = IRQ_DISABLED; + irq_desc[PLD_IRQ_CFC_EJECT].handler = &mappi2_irq_type; + irq_desc[PLD_IRQ_CFC_EJECT].action = 0; + irq_desc[PLD_IRQ_CFC_EJECT].depth = 1; /* disable nested irq */ + icu_data[PLD_IRQ_CFC_EJECT].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10; +// icu_data[PLD_IRQ_CFC_EJECT].icucr = 0; + disable_mappi2_irq(PLD_IRQ_CFC_EJECT); + +#endif /* CONFIG_MAPPI2_CFC */ +} + +#define LAN_IOSTART 0x300 +#define LAN_IOEND 0x320 +static struct resource smc91x_resources[] = { + [0] = { + .start = (LAN_IOSTART), + .end = (LAN_IOEND), + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = M32R_IRQ_INT0, + .end = M32R_IRQ_INT0, + .flags = IORESOURCE_IRQ, + } +}; + +static struct platform_device smc91x_device = { + .name = "smc91x", + .id = 0, + .num_resources = ARRAY_SIZE(smc91x_resources), + .resource = smc91x_resources, +}; + +static int __init platform_init(void) +{ + platform_device_register(&smc91x_device); + return 0; +} +arch_initcall(platform_init); diff -Nru a/arch/m32r/kernel/setup_oaks32r.c b/arch/m32r/kernel/setup_oaks32r.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/setup_oaks32r.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,147 @@ +/* + * linux/arch/m32r/kernel/setup_oaks32r.c + * + * Setup routines for OAKS32R Board + * + * Copyright (c) 2002-2004 Hiroyuki Kondo, Hirokazu Takata, + * Hitoshi Yamamoto, Mamoru Sakugawa + */ + +static char *rcsid = +"$Id: setup_oaks32r.c,v 1.1 2004/03/31 05:06:18 sakugawa Exp $"; +static void use_rcsid(void) {rcsid = rcsid; use_rcsid();} + +#include +#include +#include +#include + +#include +#include +#include + +#define irq2port(x) (M32R_ICU_CR1_PORTL + ((x - 1) * sizeof(unsigned long))) + +#ifndef CONFIG_SMP +typedef struct { + unsigned long icucr; /* ICU Control Register */ +} icu_data_t; +#endif /* CONFIG_SMP */ + +icu_data_t icu_data[NR_IRQS]; + +static void disable_oaks32r_irq(unsigned int irq) +{ + unsigned long port, data; + + port = irq2port(irq); + data = icu_data[irq].icucr|M32R_ICUCR_ILEVEL7; + outl(data, port); +} + +static void enable_oaks32r_irq(unsigned int irq) +{ + unsigned long port, data; + + port = irq2port(irq); + data = icu_data[irq].icucr|M32R_ICUCR_IEN|M32R_ICUCR_ILEVEL6; + outl(data, port); +} + +static void mask_and_ack_mappi(unsigned int irq) +{ + disable_oaks32r_irq(irq); +} + +static void end_oaks32r_irq(unsigned int irq) +{ + enable_oaks32r_irq(irq); +} + +static unsigned int startup_oaks32r_irq(unsigned int irq) +{ + enable_oaks32r_irq(irq); + return (0); +} + +static void shutdown_oaks32r_irq(unsigned int irq) +{ + unsigned long port; + + port = irq2port(irq); + outl(M32R_ICUCR_ILEVEL7, port); +} + +static struct hw_interrupt_type oaks32r_irq_type = +{ + "OAKS32R-IRQ", + startup_oaks32r_irq, + shutdown_oaks32r_irq, + enable_oaks32r_irq, + disable_oaks32r_irq, + mask_and_ack_mappi, + end_oaks32r_irq +}; + +void __init init_IRQ(void) +{ + static int once = 0; + + if (once) + return; + else + once++; + +#ifdef CONFIG_NE2000 + /* INT3 : LAN controller (RTL8019AS) */ + irq_desc[M32R_IRQ_INT3].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_INT3].handler = &oaks32r_irq_type; + irq_desc[M32R_IRQ_INT3].action = 0; + irq_desc[M32R_IRQ_INT3].depth = 1; + icu_data[M32R_IRQ_INT3].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10; + disable_oaks32r_irq(M32R_IRQ_INT3); +#endif /* CONFIG_M32R_NE2000 */ + + /* MFT2 : system timer */ + irq_desc[M32R_IRQ_MFT2].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_MFT2].handler = &oaks32r_irq_type; + irq_desc[M32R_IRQ_MFT2].action = 0; + irq_desc[M32R_IRQ_MFT2].depth = 1; + icu_data[M32R_IRQ_MFT2].icucr = M32R_ICUCR_IEN; + disable_oaks32r_irq(M32R_IRQ_MFT2); + +#ifdef CONFIG_SERIAL_M32R_SIO + /* SIO0_R : uart receive data */ + irq_desc[M32R_IRQ_SIO0_R].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_SIO0_R].handler = &oaks32r_irq_type; + irq_desc[M32R_IRQ_SIO0_R].action = 0; + irq_desc[M32R_IRQ_SIO0_R].depth = 1; + icu_data[M32R_IRQ_SIO0_R].icucr = 0; + disable_oaks32r_irq(M32R_IRQ_SIO0_R); + + /* SIO0_S : uart send data */ + irq_desc[M32R_IRQ_SIO0_S].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_SIO0_S].handler = &oaks32r_irq_type; + irq_desc[M32R_IRQ_SIO0_S].action = 0; + irq_desc[M32R_IRQ_SIO0_S].depth = 1; + icu_data[M32R_IRQ_SIO0_S].icucr = 0; + disable_oaks32r_irq(M32R_IRQ_SIO0_S); + + /* SIO1_R : uart receive data */ + irq_desc[M32R_IRQ_SIO1_R].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_SIO1_R].handler = &oaks32r_irq_type; + irq_desc[M32R_IRQ_SIO1_R].action = 0; + irq_desc[M32R_IRQ_SIO1_R].depth = 1; + icu_data[M32R_IRQ_SIO1_R].icucr = 0; + disable_oaks32r_irq(M32R_IRQ_SIO1_R); + + /* SIO1_S : uart send data */ + irq_desc[M32R_IRQ_SIO1_S].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_SIO1_S].handler = &oaks32r_irq_type; + irq_desc[M32R_IRQ_SIO1_S].action = 0; + irq_desc[M32R_IRQ_SIO1_S].depth = 1; + icu_data[M32R_IRQ_SIO1_S].icucr = 0; + disable_oaks32r_irq(M32R_IRQ_SIO1_S); +#endif /* CONFIG_SERIAL_M32R_SIO */ + +} diff -Nru a/arch/m32r/kernel/setup_opsput.c b/arch/m32r/kernel/setup_opsput.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/setup_opsput.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,484 @@ +/* + * linux/arch/m32r/kernel/setup_opsput.c + * + * Setup routines for Renesas OPSPUT Board + * + * Copyright (c) 2002-2004 + * Hiroyuki Kondo, Hirokazu Takata, + * Hitoshi Yamamoto, Takeo Takahashi, Mamoru Sakugawa + * + * 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. + * + * $Id: setup_opsput.c,v 1.1 2004/07/27 06:54:20 sakugawa Exp $ + */ + +#include +#include +#include +#include +#include + +#include +#include +#include + +/* + * OPSP Interrupt Control Unit (Level 1) + */ +#define irq2port(x) (M32R_ICU_CR1_PORTL + ((x - 1) * sizeof(unsigned long))) + +#ifndef CONFIG_SMP +typedef struct { + unsigned long icucr; /* ICU Control Register */ +} icu_data_t; +#endif /* CONFIG_SMP */ + +static icu_data_t icu_data[OPSPUT_NUM_CPU_IRQ]; + +static void disable_opsput_irq(unsigned int irq) +{ + unsigned long port, data; + + port = irq2port(irq); + data = icu_data[irq].icucr|M32R_ICUCR_ILEVEL7; + outl(data, port); +} + +static void enable_opsput_irq(unsigned int irq) +{ + unsigned long port, data; + + port = irq2port(irq); + data = icu_data[irq].icucr|M32R_ICUCR_IEN|M32R_ICUCR_ILEVEL6; + outl(data, port); +} + +static void mask_and_ack_opsput(unsigned int irq) +{ + disable_opsput_irq(irq); +} + +static void end_opsput_irq(unsigned int irq) +{ + enable_opsput_irq(irq); +} + +static unsigned int startup_opsput_irq(unsigned int irq) +{ + enable_opsput_irq(irq); + return (0); +} + +static void shutdown_opsput_irq(unsigned int irq) +{ + unsigned long port; + + port = irq2port(irq); + outl(M32R_ICUCR_ILEVEL7, port); +} + +static struct hw_interrupt_type opsput_irq_type = +{ + "OPSPUT-IRQ", + startup_opsput_irq, + shutdown_opsput_irq, + enable_opsput_irq, + disable_opsput_irq, + mask_and_ack_opsput, + end_opsput_irq +}; + +/* + * Interrupt Control Unit of PLD on OPSPUT (Level 2) + */ +#define irq2pldirq(x) ((x) - OPSPUT_PLD_IRQ_BASE) +#define pldirq2port(x) (unsigned long)((int)PLD_ICUCR1 + \ + (((x) - 1) * sizeof(unsigned short))) + +typedef struct { + unsigned short icucr; /* ICU Control Register */ +} pld_icu_data_t; + +static pld_icu_data_t pld_icu_data[OPSPUT_NUM_PLD_IRQ]; + +static void disable_opsput_pld_irq(unsigned int irq) +{ + unsigned long port, data; + unsigned int pldirq; + + pldirq = irq2pldirq(irq); +// disable_opsput_irq(M32R_IRQ_INT1); + port = pldirq2port(pldirq); + data = pld_icu_data[pldirq].icucr|PLD_ICUCR_ILEVEL7; + outw(data, port); +} + +static void enable_opsput_pld_irq(unsigned int irq) +{ + unsigned long port, data; + unsigned int pldirq; + + pldirq = irq2pldirq(irq); +// enable_opsput_irq(M32R_IRQ_INT1); + port = pldirq2port(pldirq); + data = pld_icu_data[pldirq].icucr|PLD_ICUCR_IEN|PLD_ICUCR_ILEVEL6; + outw(data, port); +} + +static void mask_and_ack_opsput_pld(unsigned int irq) +{ + disable_opsput_pld_irq(irq); +// mask_and_ack_opsput(M32R_IRQ_INT1); +} + +static void end_opsput_pld_irq(unsigned int irq) +{ + enable_opsput_pld_irq(irq); + end_opsput_irq(M32R_IRQ_INT1); +} + +static unsigned int startup_opsput_pld_irq(unsigned int irq) +{ + enable_opsput_pld_irq(irq); + return (0); +} + +static void shutdown_opsput_pld_irq(unsigned int irq) +{ + unsigned long port; + unsigned int pldirq; + + pldirq = irq2pldirq(irq); +// shutdown_opsput_irq(M32R_IRQ_INT1); + port = pldirq2port(pldirq); + outw(PLD_ICUCR_ILEVEL7, port); +} + +static struct hw_interrupt_type opsput_pld_irq_type = +{ + "OPSPUT-PLD-IRQ", + startup_opsput_pld_irq, + shutdown_opsput_pld_irq, + enable_opsput_pld_irq, + disable_opsput_pld_irq, + mask_and_ack_opsput_pld, + end_opsput_pld_irq +}; + +/* + * Interrupt Control Unit of PLD on OPSPUT-LAN (Level 2) + */ +#define irq2lanpldirq(x) ((x) - OPSPUT_LAN_PLD_IRQ_BASE) +#define lanpldirq2port(x) (unsigned long)((int)OPSPUT_LAN_ICUCR1 + \ + (((x) - 1) * sizeof(unsigned short))) + +static pld_icu_data_t lanpld_icu_data[OPSPUT_NUM_LAN_PLD_IRQ]; + +static void disable_opsput_lanpld_irq(unsigned int irq) +{ + unsigned long port, data; + unsigned int pldirq; + + pldirq = irq2lanpldirq(irq); + port = lanpldirq2port(pldirq); + data = lanpld_icu_data[pldirq].icucr|PLD_ICUCR_ILEVEL7; + outw(data, port); +} + +static void enable_opsput_lanpld_irq(unsigned int irq) +{ + unsigned long port, data; + unsigned int pldirq; + + pldirq = irq2lanpldirq(irq); + port = lanpldirq2port(pldirq); + data = lanpld_icu_data[pldirq].icucr|PLD_ICUCR_IEN|PLD_ICUCR_ILEVEL6; + outw(data, port); +} + +static void mask_and_ack_opsput_lanpld(unsigned int irq) +{ + disable_opsput_lanpld_irq(irq); +} + +static void end_opsput_lanpld_irq(unsigned int irq) +{ + enable_opsput_lanpld_irq(irq); + end_opsput_irq(M32R_IRQ_INT0); +} + +static unsigned int startup_opsput_lanpld_irq(unsigned int irq) +{ + enable_opsput_lanpld_irq(irq); + return (0); +} + +static void shutdown_opsput_lanpld_irq(unsigned int irq) +{ + unsigned long port; + unsigned int pldirq; + + pldirq = irq2lanpldirq(irq); + port = lanpldirq2port(pldirq); + outw(PLD_ICUCR_ILEVEL7, port); +} + +static struct hw_interrupt_type opsput_lanpld_irq_type = +{ + "OPSPUT-PLD-LAN-IRQ", + startup_opsput_lanpld_irq, + shutdown_opsput_lanpld_irq, + enable_opsput_lanpld_irq, + disable_opsput_lanpld_irq, + mask_and_ack_opsput_lanpld, + end_opsput_lanpld_irq +}; + +/* + * Interrupt Control Unit of PLD on OPSPUT-LCD (Level 2) + */ +#define irq2lcdpldirq(x) ((x) - OPSPUT_LCD_PLD_IRQ_BASE) +#define lcdpldirq2port(x) (unsigned long)((int)OPSPUT_LCD_ICUCR1 + \ + (((x) - 1) * sizeof(unsigned short))) + +static pld_icu_data_t lcdpld_icu_data[OPSPUT_NUM_LCD_PLD_IRQ]; + +static void disable_opsput_lcdpld_irq(unsigned int irq) +{ + unsigned long port, data; + unsigned int pldirq; + + pldirq = irq2lcdpldirq(irq); + port = lcdpldirq2port(pldirq); + data = lcdpld_icu_data[pldirq].icucr|PLD_ICUCR_ILEVEL7; + outw(data, port); +} + +static void enable_opsput_lcdpld_irq(unsigned int irq) +{ + unsigned long port, data; + unsigned int pldirq; + + pldirq = irq2lcdpldirq(irq); + port = lcdpldirq2port(pldirq); + data = lcdpld_icu_data[pldirq].icucr|PLD_ICUCR_IEN|PLD_ICUCR_ILEVEL6; + outw(data, port); +} + +static void mask_and_ack_opsput_lcdpld(unsigned int irq) +{ + disable_opsput_lcdpld_irq(irq); +} + +static void end_opsput_lcdpld_irq(unsigned int irq) +{ + enable_opsput_lcdpld_irq(irq); + end_opsput_irq(M32R_IRQ_INT2); +} + +static unsigned int startup_opsput_lcdpld_irq(unsigned int irq) +{ + enable_opsput_lcdpld_irq(irq); + return (0); +} + +static void shutdown_opsput_lcdpld_irq(unsigned int irq) +{ + unsigned long port; + unsigned int pldirq; + + pldirq = irq2lcdpldirq(irq); + port = lcdpldirq2port(pldirq); + outw(PLD_ICUCR_ILEVEL7, port); +} + +static struct hw_interrupt_type opsput_lcdpld_irq_type = +{ + "OPSPUT-PLD-LCD-IRQ", + startup_opsput_lcdpld_irq, + shutdown_opsput_lcdpld_irq, + enable_opsput_lcdpld_irq, + disable_opsput_lcdpld_irq, + mask_and_ack_opsput_lcdpld, + end_opsput_lcdpld_irq +}; + +void __init init_IRQ(void) +{ +#if defined(CONFIG_SMC91X) + /* INT#0: LAN controller on OPSPUT-LAN (SMC91C111)*/ + irq_desc[OPSPUT_LAN_IRQ_LAN].status = IRQ_DISABLED; + irq_desc[OPSPUT_LAN_IRQ_LAN].handler = &opsput_lanpld_irq_type; + irq_desc[OPSPUT_LAN_IRQ_LAN].action = 0; + irq_desc[OPSPUT_LAN_IRQ_LAN].depth = 1; /* disable nested irq */ + lanpld_icu_data[irq2lanpldirq(OPSPUT_LAN_IRQ_LAN)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD02; /* "H" edge sense */ + disable_opsput_lanpld_irq(OPSPUT_LAN_IRQ_LAN); +#endif /* CONFIG_SMC91X */ + + /* MFT2 : system timer */ + irq_desc[M32R_IRQ_MFT2].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_MFT2].handler = &opsput_irq_type; + irq_desc[M32R_IRQ_MFT2].action = 0; + irq_desc[M32R_IRQ_MFT2].depth = 1; + icu_data[M32R_IRQ_MFT2].icucr = M32R_ICUCR_IEN; + disable_opsput_irq(M32R_IRQ_MFT2); + + /* SIO0 : receive */ + irq_desc[M32R_IRQ_SIO0_R].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_SIO0_R].handler = &opsput_irq_type; + irq_desc[M32R_IRQ_SIO0_R].action = 0; + irq_desc[M32R_IRQ_SIO0_R].depth = 1; + icu_data[M32R_IRQ_SIO0_R].icucr = 0; + disable_opsput_irq(M32R_IRQ_SIO0_R); + + /* SIO0 : send */ + irq_desc[M32R_IRQ_SIO0_S].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_SIO0_S].handler = &opsput_irq_type; + irq_desc[M32R_IRQ_SIO0_S].action = 0; + irq_desc[M32R_IRQ_SIO0_S].depth = 1; + icu_data[M32R_IRQ_SIO0_S].icucr = 0; + disable_opsput_irq(M32R_IRQ_SIO0_S); + + /* SIO1 : receive */ + irq_desc[M32R_IRQ_SIO1_R].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_SIO1_R].handler = &opsput_irq_type; + irq_desc[M32R_IRQ_SIO1_R].action = 0; + irq_desc[M32R_IRQ_SIO1_R].depth = 1; + icu_data[M32R_IRQ_SIO1_R].icucr = 0; + disable_opsput_irq(M32R_IRQ_SIO1_R); + + /* SIO1 : send */ + irq_desc[M32R_IRQ_SIO1_S].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_SIO1_S].handler = &opsput_irq_type; + irq_desc[M32R_IRQ_SIO1_S].action = 0; + irq_desc[M32R_IRQ_SIO1_S].depth = 1; + icu_data[M32R_IRQ_SIO1_S].icucr = 0; + disable_opsput_irq(M32R_IRQ_SIO1_S); + + /* DMA1 : */ + irq_desc[M32R_IRQ_DMA1].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_DMA1].handler = &opsput_irq_type; + irq_desc[M32R_IRQ_DMA1].action = 0; + irq_desc[M32R_IRQ_DMA1].depth = 1; + icu_data[M32R_IRQ_DMA1].icucr = 0; + disable_opsput_irq(M32R_IRQ_DMA1); + +#ifdef CONFIG_SERIAL_M32R_PLDSIO + /* INT#1: SIO0 Receive on PLD */ + irq_desc[PLD_IRQ_SIO0_RCV].status = IRQ_DISABLED; + irq_desc[PLD_IRQ_SIO0_RCV].handler = &opsput_pld_irq_type; + irq_desc[PLD_IRQ_SIO0_RCV].action = 0; + irq_desc[PLD_IRQ_SIO0_RCV].depth = 1; /* disable nested irq */ + pld_icu_data[irq2pldirq(PLD_IRQ_SIO0_RCV)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD03; + disable_opsput_pld_irq(PLD_IRQ_SIO0_RCV); + + /* INT#1: SIO0 Send on PLD */ + irq_desc[PLD_IRQ_SIO0_SND].status = IRQ_DISABLED; + irq_desc[PLD_IRQ_SIO0_SND].handler = &opsput_pld_irq_type; + irq_desc[PLD_IRQ_SIO0_SND].action = 0; + irq_desc[PLD_IRQ_SIO0_SND].depth = 1; /* disable nested irq */ + pld_icu_data[irq2pldirq(PLD_IRQ_SIO0_SND)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD03; + disable_opsput_pld_irq(PLD_IRQ_SIO0_SND); +#endif /* CONFIG_SERIAL_M32R_PLDSIO */ + +#if defined(CONFIG_M32R_CFC) + /* INT#1: CFC IREQ on PLD */ + irq_desc[PLD_IRQ_CFIREQ].status = IRQ_DISABLED; + irq_desc[PLD_IRQ_CFIREQ].handler = &opsput_pld_irq_type; + irq_desc[PLD_IRQ_CFIREQ].action = 0; + irq_desc[PLD_IRQ_CFIREQ].depth = 1; /* disable nested irq */ + pld_icu_data[irq2pldirq(PLD_IRQ_CFIREQ)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD01; /* 'L' level sense */ + disable_opsput_pld_irq(PLD_IRQ_CFIREQ); + + /* INT#1: CFC Insert on PLD */ + irq_desc[PLD_IRQ_CFC_INSERT].status = IRQ_DISABLED; + irq_desc[PLD_IRQ_CFC_INSERT].handler = &opsput_pld_irq_type; + irq_desc[PLD_IRQ_CFC_INSERT].action = 0; + irq_desc[PLD_IRQ_CFC_INSERT].depth = 1; /* disable nested irq */ + pld_icu_data[irq2pldirq(PLD_IRQ_CFC_INSERT)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD00; /* 'L' edge sense */ + disable_opsput_pld_irq(PLD_IRQ_CFC_INSERT); + + /* INT#1: CFC Eject on PLD */ + irq_desc[PLD_IRQ_CFC_EJECT].status = IRQ_DISABLED; + irq_desc[PLD_IRQ_CFC_EJECT].handler = &opsput_pld_irq_type; + irq_desc[PLD_IRQ_CFC_EJECT].action = 0; + irq_desc[PLD_IRQ_CFC_EJECT].depth = 1; /* disable nested irq */ + pld_icu_data[irq2pldirq(PLD_IRQ_CFC_EJECT)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD02; /* 'H' edge sense */ + disable_opsput_pld_irq(PLD_IRQ_CFC_EJECT); +#endif /* CONFIG_M32R_CFC */ + + + /* + * INT0# is used for LAN, DIO + * We enable it here. + */ + icu_data[M32R_IRQ_INT0].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD11; + enable_opsput_irq(M32R_IRQ_INT0); + + /* + * INT1# is used for UART, MMC, CF Controller in FPGA. + * We enable it here. + */ + icu_data[M32R_IRQ_INT1].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD11; + enable_opsput_irq(M32R_IRQ_INT1); + +#if defined(CONFIG_USB) + outw(USBCR_OTGS, USBCR); /* USBCR: non-OTG */ + + irq_desc[OPSPUT_LCD_IRQ_USB_INT1].status = IRQ_DISABLED; + irq_desc[OPSPUT_LCD_IRQ_USB_INT1].handler = &opsput_lcdpld_irq_type; + irq_desc[OPSPUT_LCD_IRQ_USB_INT1].action = 0; + irq_desc[OPSPUT_LCD_IRQ_USB_INT1].depth = 1; + lcdpld_icu_data[irq2lcdpldirq(OPSPUT_LCD_IRQ_USB_INT1)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD01; /* "L" level sense */ + disable_opsput_lcdpld_irq(OPSPUT_LCD_IRQ_USB_INT1); +#endif + /* + * INT2# is used for BAT, USB, AUDIO + * We enable it here. + */ + icu_data[M32R_IRQ_INT2].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD01; + enable_opsput_irq(M32R_IRQ_INT2); + +//#if defined(CONFIG_M32R_AR_VGA) + /* + * INT3# is used for AR + */ + irq_desc[M32R_IRQ_INT3].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_INT3].handler = &opsput_irq_type; + irq_desc[M32R_IRQ_INT3].action = 0; + irq_desc[M32R_IRQ_INT3].depth = 1; + icu_data[M32R_IRQ_INT3].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10; + disable_opsput_irq(M32R_IRQ_INT3); +//#endif /* CONFIG_M32R_ARV */ +} + +#define LAN_IOSTART 0x300 +#define LAN_IOEND 0x320 +static struct resource smc91x_resources[] = { + [0] = { + .start = (LAN_IOSTART), + .end = (LAN_IOEND), + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = OPSPUT_LAN_IRQ_LAN, + .end = OPSPUT_LAN_IRQ_LAN, + .flags = IORESOURCE_IRQ, + } +}; + +static struct platform_device smc91x_device = { + .name = "smc91x", + .id = 0, + .num_resources = ARRAY_SIZE(smc91x_resources), + .resource = smc91x_resources, +}; + +static int __init platform_init(void) +{ + platform_device_register(&smc91x_device); + return 0; +} +arch_initcall(platform_init); diff -Nru a/arch/m32r/kernel/setup_usrv.c b/arch/m32r/kernel/setup_usrv.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/setup_usrv.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,260 @@ +/* + * linux/arch/m32r/kernel/setup_usrv.c + * + * Setup routines for MITSUBISHI uServer + * + * Copyright (c) 2001, 2002, 2003 Hiroyuki Kondo, Hirokazu Takata, + * Hitoshi Yamamoto + */ + +static char *rcsid = +"$Id$"; +static void use_rcsid(void) {rcsid = rcsid; use_rcsid();} + +#include +#include +#include +#include + +#include +#include +#include + +#define irq2port(x) (M32R_ICU_CR1_PORTL + ((x - 1) * sizeof(unsigned long))) + +#if !defined(CONFIG_SMP) +typedef struct { + unsigned long icucr; /* ICU Control Register */ +} icu_data_t; +#endif /* CONFIG_SMP */ + +icu_data_t icu_data[M32700UT_NUM_CPU_IRQ]; + +static void disable_mappi_irq(unsigned int irq) +{ + unsigned long port, data; + + port = irq2port(irq); + data = icu_data[irq].icucr|M32R_ICUCR_ILEVEL7; + outl(data, port); +} + +static void enable_mappi_irq(unsigned int irq) +{ + unsigned long port, data; + + port = irq2port(irq); + data = icu_data[irq].icucr|M32R_ICUCR_IEN|M32R_ICUCR_ILEVEL6; + outl(data, port); +} + +static void mask_and_ack_mappi(unsigned int irq) +{ + disable_mappi_irq(irq); +} + +static void end_mappi_irq(unsigned int irq) +{ + enable_mappi_irq(irq); +} + +static unsigned int startup_mappi_irq(unsigned int irq) +{ + enable_mappi_irq(irq); + return 0; +} + +static void shutdown_mappi_irq(unsigned int irq) +{ + unsigned long port; + + port = irq2port(irq); + outl(M32R_ICUCR_ILEVEL7, port); +} + +static struct hw_interrupt_type mappi_irq_type = +{ + "M32700-IRQ", + startup_mappi_irq, + shutdown_mappi_irq, + enable_mappi_irq, + disable_mappi_irq, + mask_and_ack_mappi, + end_mappi_irq +}; + +/* + * Interrupt Control Unit of PLD on M32700UT (Level 2) + */ +#define irq2pldirq(x) ((x) - M32700UT_PLD_IRQ_BASE) +#define pldirq2port(x) (unsigned long)((int)PLD_ICUCR1 + \ + (((x) - 1) * sizeof(unsigned short))) + +typedef struct { + unsigned short icucr; /* ICU Control Register */ +} pld_icu_data_t; + +static pld_icu_data_t pld_icu_data[M32700UT_NUM_PLD_IRQ]; + +static void disable_m32700ut_pld_irq(unsigned int irq) +{ + unsigned long port, data; + unsigned int pldirq; + + pldirq = irq2pldirq(irq); + port = pldirq2port(pldirq); + data = pld_icu_data[pldirq].icucr|PLD_ICUCR_ILEVEL7; + outw(data, port); +} + +static void enable_m32700ut_pld_irq(unsigned int irq) +{ + unsigned long port, data; + unsigned int pldirq; + + pldirq = irq2pldirq(irq); + port = pldirq2port(pldirq); + data = pld_icu_data[pldirq].icucr|PLD_ICUCR_IEN|PLD_ICUCR_ILEVEL6; + outw(data, port); +} + +static void mask_and_ack_m32700ut_pld(unsigned int irq) +{ + disable_m32700ut_pld_irq(irq); +} + +static void end_m32700ut_pld_irq(unsigned int irq) +{ + enable_m32700ut_pld_irq(irq); + end_mappi_irq(M32R_IRQ_INT1); +} + +static unsigned int startup_m32700ut_pld_irq(unsigned int irq) +{ + enable_m32700ut_pld_irq(irq); + return 0; +} + +static void shutdown_m32700ut_pld_irq(unsigned int irq) +{ + unsigned long port; + unsigned int pldirq; + + pldirq = irq2pldirq(irq); + port = pldirq2port(pldirq); + outw(PLD_ICUCR_ILEVEL7, port); +} + +static struct hw_interrupt_type m32700ut_pld_irq_type = +{ + "USRV-PLD-IRQ", + startup_m32700ut_pld_irq, + shutdown_m32700ut_pld_irq, + enable_m32700ut_pld_irq, + disable_m32700ut_pld_irq, + mask_and_ack_m32700ut_pld, + end_m32700ut_pld_irq +}; + +void __init init_IRQ(void) +{ + static int once = 0; + int i; + + if (once) + return; + else + once++; + + /* MFT2 : system timer */ + irq_desc[M32R_IRQ_MFT2].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_MFT2].handler = &mappi_irq_type; + irq_desc[M32R_IRQ_MFT2].action = 0; + irq_desc[M32R_IRQ_MFT2].depth = 1; + icu_data[M32R_IRQ_MFT2].icucr = M32R_ICUCR_IEN; + disable_mappi_irq(M32R_IRQ_MFT2); + +#if defined(CONFIG_SERIAL_M32R_SIO) + /* SIO0_R : uart receive data */ + irq_desc[M32R_IRQ_SIO0_R].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_SIO0_R].handler = &mappi_irq_type; + irq_desc[M32R_IRQ_SIO0_R].action = 0; + irq_desc[M32R_IRQ_SIO0_R].depth = 1; + icu_data[M32R_IRQ_SIO0_R].icucr = 0; + disable_mappi_irq(M32R_IRQ_SIO0_R); + + /* SIO0_S : uart send data */ + irq_desc[M32R_IRQ_SIO0_S].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_SIO0_S].handler = &mappi_irq_type; + irq_desc[M32R_IRQ_SIO0_S].action = 0; + irq_desc[M32R_IRQ_SIO0_S].depth = 1; + icu_data[M32R_IRQ_SIO0_S].icucr = 0; + disable_mappi_irq(M32R_IRQ_SIO0_S); + + /* SIO1_R : uart receive data */ + irq_desc[M32R_IRQ_SIO1_R].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_SIO1_R].handler = &mappi_irq_type; + irq_desc[M32R_IRQ_SIO1_R].action = 0; + irq_desc[M32R_IRQ_SIO1_R].depth = 1; + icu_data[M32R_IRQ_SIO1_R].icucr = 0; + disable_mappi_irq(M32R_IRQ_SIO1_R); + + /* SIO1_S : uart send data */ + irq_desc[M32R_IRQ_SIO1_S].status = IRQ_DISABLED; + irq_desc[M32R_IRQ_SIO1_S].handler = &mappi_irq_type; + irq_desc[M32R_IRQ_SIO1_S].action = 0; + irq_desc[M32R_IRQ_SIO1_S].depth = 1; + icu_data[M32R_IRQ_SIO1_S].icucr = 0; + disable_mappi_irq(M32R_IRQ_SIO1_S); +#endif /* CONFIG_SERIAL_M32R_SIO */ + + /* INT#67-#71: CFC#0 IREQ on PLD */ + for (i = 0 ; i < CONFIG_CFC_NUM ; i++ ) { + irq_desc[PLD_IRQ_CF0 + i].status = IRQ_DISABLED; + irq_desc[PLD_IRQ_CF0 + i].handler = &m32700ut_pld_irq_type; + irq_desc[PLD_IRQ_CF0 + i].action = 0; + irq_desc[PLD_IRQ_CF0 + i].depth = 1; /* disable nested irq */ + pld_icu_data[irq2pldirq(PLD_IRQ_CF0 + i)].icucr + = PLD_ICUCR_ISMOD01; /* 'L' level sense */ + disable_m32700ut_pld_irq(PLD_IRQ_CF0 + i); + } + +#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE) + /* INT#76: 16552D#0 IREQ on PLD */ + irq_desc[PLD_IRQ_UART0].status = IRQ_DISABLED; + irq_desc[PLD_IRQ_UART0].handler = &m32700ut_pld_irq_type; + irq_desc[PLD_IRQ_UART0].action = 0; + irq_desc[PLD_IRQ_UART0].depth = 1; /* disable nested irq */ + pld_icu_data[irq2pldirq(PLD_IRQ_UART0)].icucr + = PLD_ICUCR_ISMOD03; /* 'H' level sense */ + disable_m32700ut_pld_irq(PLD_IRQ_UART0); + + /* INT#77: 16552D#1 IREQ on PLD */ + irq_desc[PLD_IRQ_UART1].status = IRQ_DISABLED; + irq_desc[PLD_IRQ_UART1].handler = &m32700ut_pld_irq_type; + irq_desc[PLD_IRQ_UART1].action = 0; + irq_desc[PLD_IRQ_UART1].depth = 1; /* disable nested irq */ + pld_icu_data[irq2pldirq(PLD_IRQ_UART1)].icucr + = PLD_ICUCR_ISMOD03; /* 'H' level sense */ + disable_m32700ut_pld_irq(PLD_IRQ_UART1); +#endif /* CONFIG_SERIAL_8250 || CONFIG_SERIAL_8250_MODULE */ + +#if defined(CONFIG_IDC_AK4524) || defined(CONFIG_IDC_AK4524_MODULE) + /* INT#80: AK4524 IREQ on PLD */ + irq_desc[PLD_IRQ_SNDINT].status = IRQ_DISABLED; + irq_desc[PLD_IRQ_SNDINT].handler = &m32700ut_pld_irq_type; + irq_desc[PLD_IRQ_SNDINT].action = 0; + irq_desc[PLD_IRQ_SNDINT].depth = 1; /* disable nested irq */ + pld_icu_data[irq2pldirq(PLD_IRQ_SNDINT)].icucr + = PLD_ICUCR_ISMOD01; /* 'L' level sense */ + disable_m32700ut_pld_irq(PLD_IRQ_SNDINT); +#endif /* CONFIG_IDC_AK4524 || CONFIG_IDC_AK4524_MODULE */ + + /* + * INT1# is used for UART, MMC, CF Controller in FPGA. + * We enable it here. + */ + icu_data[M32R_IRQ_INT1].icucr = M32R_ICUCR_ISMOD11; + enable_mappi_irq(M32R_IRQ_INT1); +} + diff -Nru a/arch/m32r/kernel/signal.c b/arch/m32r/kernel/signal.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/signal.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,628 @@ +/* + * linux/arch/m32r/kernel/signal.c + * + * Copyright (c) 2003 Hitoshi Yamamoto + * + * Taken from i386 version. + * Copyright (C) 1991, 1992 Linus Torvalds + * + * 1997-11-28 Modified for POSIX.1b signals by Richard Henderson + * 2000-06-20 Pentium III FXSR, SSE support by Gareth Hughes + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DEBUG_SIG 0 + +#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) + +int do_signal(struct pt_regs *, sigset_t *); + +/* + * Atomically swap in the new signal mask, and wait for a signal. + */ +asmlinkage int +sys_sigsuspend(old_sigset_t mask, unsigned long r1, + unsigned long r2, unsigned long r3, unsigned long r4, + unsigned long r5, unsigned long r6, struct pt_regs regs) +{ + sigset_t saveset; + + mask &= _BLOCKABLE; + spin_lock_irq(¤t->sighand->siglock); + saveset = current->blocked; + siginitset(¤t->blocked, mask); + recalc_sigpending(); + spin_unlock_irq(¤t->sighand->siglock); + + regs.r0 = -EINTR; + while (1) { + current->state = TASK_INTERRUPTIBLE; + schedule(); + if (do_signal(®s, &saveset)) + return regs.r0; + } +} + +asmlinkage int +sys_rt_sigsuspend(sigset_t *unewset, size_t sigsetsize, + unsigned long r2, unsigned long r3, unsigned long r4, + unsigned long r5, unsigned long r6, struct pt_regs regs) +{ + sigset_t saveset, newset; + + /* XXX: Don't preclude handling different sized sigset_t's. */ + if (sigsetsize != sizeof(sigset_t)) + return -EINVAL; + + if (copy_from_user(&newset, unewset, sizeof(newset))) + return -EFAULT; + sigdelsetmask(&newset, ~_BLOCKABLE); + + spin_lock_irq(¤t->sighand->siglock); + saveset = current->blocked; + current->blocked = newset; + recalc_sigpending(); + spin_unlock_irq(¤t->sighand->siglock); + + regs.r0 = -EINTR; + while (1) { + current->state = TASK_INTERRUPTIBLE; + schedule(); + if (do_signal(®s, &saveset)) + return regs.r0; + } +} + +asmlinkage int +sys_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) { + old_sigset_t mask; + if (verify_area(VERIFY_READ, act, sizeof(*act)) || + __get_user(new_ka.sa.sa_handler, &act->sa_handler) || + __get_user(new_ka.sa.sa_restorer, &act->sa_restorer)) + return -EFAULT; + __get_user(new_ka.sa.sa_flags, &act->sa_flags); + __get_user(mask, &act->sa_mask); + siginitset(&new_ka.sa.sa_mask, mask); + } + + ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL); + + if (!ret && oact) { + if (verify_area(VERIFY_WRITE, oact, sizeof(*oact)) || + __put_user(old_ka.sa.sa_handler, &oact->sa_handler) || + __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer)) + return -EFAULT; + __put_user(old_ka.sa.sa_flags, &oact->sa_flags); + __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask); + } + + return ret; +} + +asmlinkage int +sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, + unsigned long r2, unsigned long r3, unsigned long r4, + unsigned long r5, unsigned long r6, struct pt_regs regs) +{ + return do_sigaltstack(uss, uoss, regs.spu); +} + + +/* + * Do a signal return; undo the signal stack. + */ + +struct sigframe +{ +// char *pretcode; + int sig; + struct sigcontext sc; +// struct _fpstate fpstate; + unsigned long extramask[_NSIG_WORDS-1]; + char retcode[4]; +}; + +struct rt_sigframe +{ +// char *pretcode; + int sig; + struct siginfo *pinfo; + void *puc; + struct siginfo info; + struct ucontext uc; +// struct _fpstate fpstate; + char retcode[8]; +}; + +static int +restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, + int *r0_p) +{ + unsigned int err = 0; + + /* Always make any pending restarted system calls return -EINTR */ + current_thread_info()->restart_block.fn = do_no_restart_syscall; + +#define COPY(x) err |= __get_user(regs->x, &sc->sc_##x) + COPY(r4); + COPY(r5); + COPY(r6); + COPY(pt_regs); + /* COPY(r0); Skip r0 */ + COPY(r1); + COPY(r2); + COPY(r3); + COPY(r7); + COPY(r8); + COPY(r9); + COPY(r10); + COPY(r11); + COPY(r12); +#if defined(CONFIG_ISA_M32R2) && defined(CONFIG_ISA_DSP_LEVEL2) + COPY(acc0h); + COPY(acc0l); + COPY(acc1h); + COPY(acc1l); +#elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R) + COPY(acch); + COPY(accl); +#else +#error unknown isa configuration +#endif + COPY(psw); + COPY(bpc); + COPY(bbpsw); + COPY(bbpc); + COPY(spu); + COPY(fp); + COPY(lr); + COPY(spi); +#undef COPY + + regs->syscall_nr = -1; /* disable syscall checks */ + err |= __get_user(*r0_p, &sc->sc_r0); + + return err; +} + +asmlinkage int +sys_sigreturn(unsigned long r0, unsigned long r1, + unsigned long r2, unsigned long r3, unsigned long r4, + unsigned long r5, unsigned long r6, struct pt_regs regs) +{ + struct sigframe __user *frame = (struct sigframe __user *)regs.spu; + sigset_t set; + int result; + + if (verify_area(VERIFY_READ, frame, sizeof(*frame))) + goto badframe; + if (__get_user(set.sig[0], &frame->sc.oldmask) + || (_NSIG_WORDS > 1 + && __copy_from_user(&set.sig[1], &frame->extramask, + sizeof(frame->extramask)))) + goto badframe; + + sigdelsetmask(&set, ~_BLOCKABLE); + spin_lock_irq(¤t->sighand->siglock); + current->blocked = set; + recalc_sigpending(); + spin_unlock_irq(¤t->sighand->siglock); + + if (restore_sigcontext(®s, &frame->sc, &result)) + goto badframe; + return result; + +badframe: + force_sig(SIGSEGV, current); + return 0; +} + +asmlinkage int +sys_rt_sigreturn(unsigned long r0, unsigned long r1, + unsigned long r2, unsigned long r3, unsigned long r4, + unsigned long r5, unsigned long r6, struct pt_regs regs) +{ + struct rt_sigframe __user *frame = (struct rt_sigframe __user *)regs.spu; + sigset_t set; + stack_t st; + int result; + + if (verify_area(VERIFY_READ, frame, sizeof(*frame))) + goto badframe; + if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) + goto badframe; + + sigdelsetmask(&set, ~_BLOCKABLE); + spin_lock_irq(¤t->sighand->siglock); + current->blocked = set; + recalc_sigpending(); + spin_unlock_irq(¤t->sighand->siglock); + + if (restore_sigcontext(®s, &frame->uc.uc_mcontext, &result)) + goto badframe; + + if (__copy_from_user(&st, &frame->uc.uc_stack, sizeof(st))) + goto badframe; + /* It is more difficult to avoid calling this function than to + call it and ignore errors. */ + do_sigaltstack(&st, NULL, regs.spu); + + return result; + +badframe: + force_sig(SIGSEGV, current); + return 0; +} + +/* + * Set up a signal frame. + */ + +static int +setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs, + unsigned long mask) +{ + int err = 0; + +#define COPY(x) err |= __put_user(regs->x, &sc->sc_##x) + COPY(r4); + COPY(r5); + COPY(r6); + COPY(pt_regs); + COPY(r0); + COPY(r1); + COPY(r2); + COPY(r3); + COPY(r7); + COPY(r8); + COPY(r9); + COPY(r10); + COPY(r11); + COPY(r12); +#if defined(CONFIG_ISA_M32R2) && defined(CONFIG_ISA_DSP_LEVEL2) + COPY(acc0h); + COPY(acc0l); + COPY(acc1h); + COPY(acc1l); +#elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R) + COPY(acch); + COPY(accl); +#else +#error unknown isa configuration +#endif + COPY(psw); + COPY(bpc); + COPY(bbpsw); + COPY(bbpc); + COPY(spu); + COPY(fp); + COPY(lr); + COPY(spi); +#undef COPY + + err |= __put_user(mask, &sc->oldmask); + + return err; +} + +/* + * Determine which stack to use.. + */ +static inline void __user * +get_sigframe(struct k_sigaction *ka, unsigned long sp, size_t frame_size) +{ + /* This is the X/Open sanctioned signal stack switching. */ + if (ka->sa.sa_flags & SA_ONSTACK) { + if (sas_ss_flags(sp) == 0) + sp = current->sas_ss_sp + current->sas_ss_size; + } + + return (void __user *)((sp - frame_size) & -8ul); +} + +static void setup_frame(int sig, struct k_sigaction *ka, + sigset_t *set, struct pt_regs *regs) +{ + struct sigframe __user *frame; + int err = 0; + int signal; + + frame = get_sigframe(ka, regs->spu, sizeof(*frame)); + + if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) + goto give_sigsegv; + + signal = current_thread_info()->exec_domain + && current_thread_info()->exec_domain->signal_invmap + && sig < 32 + ? current_thread_info()->exec_domain->signal_invmap[sig] + : sig; + + err |= __put_user(signal, &frame->sig); + if (err) + goto give_sigsegv; + + err |= setup_sigcontext(&frame->sc, regs, set->sig[0]); + if (err) + goto give_sigsegv; + + if (_NSIG_WORDS > 1) { + err |= __copy_to_user(frame->extramask, &set->sig[1], + sizeof(frame->extramask)); + if (err) + goto give_sigsegv; + } + + if (ka->sa.sa_flags & SA_RESTORER) + regs->lr = (unsigned long)ka->sa.sa_restorer; + else { + /* This is : ldi r7, #__NR_sigreturn ; trap #2 */ + unsigned long code = 0x670010f2 | (__NR_sigreturn << 16); + + regs->lr = (unsigned long)frame->retcode; + err |= __put_user(code, (long __user *)(frame->retcode+0)); + if (err) + goto give_sigsegv; + flush_cache_sigtramp((unsigned long)frame->retcode); + } + + /* Set up registers for signal handler */ + regs->spu = (unsigned long)frame; + regs->r0 = signal; /* Arg for signal handler */ + regs->r1 = (unsigned long)&frame->sc; + regs->bpc = (unsigned long)ka->sa.sa_handler; + + set_fs(USER_DS); + +#if DEBUG_SIG + printk("SIG deliver (%s:%d): sp=%p pc=%p\n", + current->comm, current->pid, frame, regs->pc); +#endif + + return; + +give_sigsegv: + if (sig == SIGSEGV) + ka->sa.sa_handler = SIG_DFL; + force_sig(SIGSEGV, current); +} + +static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, + sigset_t *set, struct pt_regs *regs) +{ + struct rt_sigframe __user *frame; + int err = 0; + int signal; + + frame = get_sigframe(ka, regs->spu, sizeof(*frame)); + + if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) + goto give_sigsegv; + + signal = current_thread_info()->exec_domain + && current_thread_info()->exec_domain->signal_invmap + && sig < 32 + ? current_thread_info()->exec_domain->signal_invmap[sig] + : sig; + + err |= __put_user(signal, &frame->sig); + if (err) + goto give_sigsegv; + + err |= __put_user(&frame->info, &frame->pinfo); + err |= __put_user(&frame->uc, &frame->puc); + err |= copy_siginfo_to_user(&frame->info, info); + if (err) + goto give_sigsegv; + + /* Create the ucontext. */ + err |= __put_user(0, &frame->uc.uc_flags); + err |= __put_user(0, &frame->uc.uc_link); + err |= __put_user(current->sas_ss_sp, &frame->uc.uc_stack.ss_sp); + err |= __put_user(sas_ss_flags(regs->spu), + &frame->uc.uc_stack.ss_flags); + err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size); + err |= setup_sigcontext(&frame->uc.uc_mcontext, regs, set->sig[0]); + err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); + if (err) + goto give_sigsegv; + + /* Set up to return from userspace. */ + if (ka->sa.sa_flags & SA_RESTORER) + regs->lr = (unsigned long)ka->sa.sa_restorer; + else { + /* This is : ldi r7, #__NR_rt_sigreturn ; trap #2 */ + unsigned long code1 = 0x97f00000 | (__NR_rt_sigreturn); + unsigned long code2 = 0x10f2f000; + + regs->lr = (unsigned long)frame->retcode; + err |= __put_user(code1, (long __user *)(frame->retcode+0)); + err |= __put_user(code2, (long __user *)(frame->retcode+4)); + if (err) + goto give_sigsegv; + flush_cache_sigtramp((unsigned long)frame->retcode); + } + + /* Set up registers for signal handler */ + regs->spu = (unsigned long)frame; + regs->r0 = signal; /* Arg for signal handler */ + regs->r1 = (unsigned long)&frame->info; + regs->r2 = (unsigned long)&frame->uc; + regs->bpc = (unsigned long)ka->sa.sa_handler; + + set_fs(USER_DS); + +#if DEBUG_SIG + printk("SIG deliver (%s:%d): sp=%p pc=%p\n", + current->comm, current->pid, frame, regs->pc); +#endif + + return; + +give_sigsegv: + if (sig == SIGSEGV) + ka->sa.sa_handler = SIG_DFL; + force_sig(SIGSEGV, current); +} + +/* + * OK, we're invoking a handler + */ + +static void +handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, + sigset_t *oldset, struct pt_regs *regs) +{ + unsigned short inst; + + /* Are we from a system call? */ + if (regs->syscall_nr >= 0) { + /* If so, check system call restarting.. */ + switch (regs->r0) { + case -ERESTART_RESTARTBLOCK: + case -ERESTARTNOHAND: + regs->r0 = -EINTR; + break; + + case -ERESTARTSYS: + if (!(ka->sa.sa_flags & SA_RESTART)) { + regs->r0 = -EINTR; + break; + } + /* fallthrough */ + case -ERESTARTNOINTR: + regs->r0 = regs->orig_r0; + inst = *(unsigned short *)(regs->bpc - 2); + if ((inst & 0xfff0) == 0x10f0) /* trap ? */ + regs->bpc -= 2; + else + regs->bpc -= 4; + } + } + + /* Set up the stack frame */ + if (ka->sa.sa_flags & SA_SIGINFO) + setup_rt_frame(sig, ka, info, oldset, regs); + else + setup_frame(sig, ka, oldset, regs); + + if (ka->sa.sa_flags & SA_ONESHOT) + ka->sa.sa_handler = SIG_DFL; + + if (!(ka->sa.sa_flags & SA_NODEFER)) { + spin_lock_irq(¤t->sighand->siglock); + sigorsets(¤t->blocked,¤t->blocked,&ka->sa.sa_mask); + sigaddset(¤t->blocked,sig); + recalc_sigpending(); + spin_unlock_irq(¤t->sighand->siglock); + } +} + +/* + * Note that 'init' is a special process: it doesn't get signals it doesn't + * want to handle. Thus you cannot kill init even with a SIGKILL even by + * mistake. + */ +int do_signal(struct pt_regs *regs, sigset_t *oldset) +{ + siginfo_t info; + int signr; + struct k_sigaction ka; + unsigned short inst; + + /* + * We want the common case to go fast, which + * is why we may in certain cases get here from + * kernel mode. Just return without doing anything + * if so. + */ + if (!user_mode(regs)) + return 1; + + if (current->flags & PF_FREEZE) { + refrigerator(0); + goto no_signal; + } + + if (!oldset) + oldset = ¤t->blocked; + + signr = get_signal_to_deliver(&info, &ka, regs, NULL); + if (signr > 0) { + /* Reenable any watchpoints before delivering the + * signal to user space. The processor register will + * have been cleared if the watchpoint triggered + * inside the kernel. + */ + + /* Whee! Actually deliver the signal. */ + handle_signal(signr, &ka, &info, oldset, regs); + return 1; + } + + no_signal: + /* Did we come from a system call? */ + if (regs->syscall_nr >= 0) { + /* Restart the system call - no handlers present */ + if (regs->r0 == -ERESTARTNOHAND || + regs->r0 == -ERESTARTSYS || + regs->r0 == -ERESTARTNOINTR) { + regs->r0 = regs->orig_r0; + inst = *(unsigned short *)(regs->bpc - 2); + if ((inst & 0xfff0) == 0x10f0) /* trap ? */ + regs->bpc -= 2; + else + regs->bpc -= 4; + } + if (regs->r0 == -ERESTART_RESTARTBLOCK){ + regs->r0 = regs->orig_r0; + regs->r7 = __NR_restart_syscall; + inst = *(unsigned short *)(regs->bpc - 2); + if ((inst & 0xfff0) == 0x10f0) /* trap ? */ + regs->bpc -= 2; + else + regs->bpc -= 4; + } + } + return 0; +} + +/* + * notification of userspace execution resumption + * - triggered by current->work.notify_resume + */ +void do_notify_resume(struct pt_regs *regs, sigset_t *oldset, + __u32 thread_info_flags) +{ + /* Pending single-step? */ + if (thread_info_flags & _TIF_SINGLESTEP) + clear_thread_flag(TIF_SINGLESTEP); + + /* deal with pending signal delivery */ + if (thread_info_flags & _TIF_SIGPENDING) + do_signal(regs,oldset); + + clear_thread_flag(TIF_IRET); +} diff -Nru a/arch/m32r/kernel/smp.c b/arch/m32r/kernel/smp.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/smp.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,964 @@ +/* + * linux/arch/m32r/kernel/smp.c + * + * M32R SMP support routines. + * + * Copyright (c) 2001, 2002 Hitoshi Yamamoto + * + * Taken from i386 version. + * (c) 1995 Alan Cox, Building #3 + * (c) 1998-99, 2000 Ingo Molnar + * + * This code is released under the GNU General Public License version 2 or + * later. + */ + +#undef DEBUG_SMP + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ +/* Data structures and variables */ +/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ + +/* + * Structure and data for smp_call_function(). This is designed to minimise + * static memory requirements. It also looks cleaner. + */ +static spinlock_t call_lock = SPIN_LOCK_UNLOCKED; + +struct call_data_struct { + void (*func) (void *info); + void *info; + atomic_t started; + atomic_t finished; + int wait; +} __attribute__ ((__aligned__(SMP_CACHE_BYTES))); + +static struct call_data_struct *call_data; + +/* + * For flush_cache_all() + */ +static spinlock_t flushcache_lock = SPIN_LOCK_UNLOCKED; +static volatile unsigned long flushcache_cpumask = 0; + +/* + * For flush_tlb_others() + */ +static volatile cpumask_t flush_cpumask; +static struct mm_struct *flush_mm; +static struct vm_area_struct *flush_vma; +static volatile unsigned long flush_va; +static spinlock_t tlbstate_lock = SPIN_LOCK_UNLOCKED; +#define FLUSH_ALL 0xffffffff + +DECLARE_PER_CPU(int, prof_multiplier); +DECLARE_PER_CPU(int, prof_old_multiplier); +DECLARE_PER_CPU(int, prof_counter); + +extern spinlock_t ipi_lock[]; + +/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ +/* Function Prototypes */ +/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ + +void smp_send_reschedule(int); +void smp_reschedule_interrupt(void); + +void smp_flush_cache_all(void); +void smp_flush_cache_all_interrupt(void); + +void smp_flush_tlb_all(void); +static void flush_tlb_all_ipi(void *); + +void smp_flush_tlb_mm(struct mm_struct *); +void smp_flush_tlb_range(struct vm_area_struct *, unsigned long, \ + unsigned long); +void smp_flush_tlb_page(struct vm_area_struct *, unsigned long); +static void flush_tlb_others(cpumask_t, struct mm_struct *, + struct vm_area_struct *, unsigned long); +void smp_invalidate_interrupt(void); + +void smp_send_stop(void); +static void stop_this_cpu(void *); + +int smp_call_function(void (*) (void *), void *, int, int); +void smp_call_function_interrupt(void); + +void smp_send_timer(void); +void smp_ipi_timer_interrupt(struct pt_regs *); +void smp_local_timer_interrupt(struct pt_regs *); + +void send_IPI_allbutself(int, int); +static void send_IPI_mask(cpumask_t, int, int); +unsigned long send_IPI_mask_phys(cpumask_t, int, int); + +/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ +/* Rescheduling request Routines */ +/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ + +/*==========================================================================* + * Name: smp_send_reschedule + * + * Description: This routine requests other CPU to execute rescheduling. + * 1.Send 'RESCHEDULE_IPI' to other CPU. + * Request other CPU to execute 'smp_reschedule_interrupt()'. + * + * Born on Date: 2002.02.05 + * + * Arguments: cpu_id - Target CPU ID + * + * Returns: void (cannot fail) + * + * Modification log: + * Date Who Description + * ---------- --- -------------------------------------------------------- + * + *==========================================================================*/ +void smp_send_reschedule(int cpu_id) +{ + WARN_ON(cpu_is_offline(cpu_id)); + send_IPI_mask(cpumask_of_cpu(cpu_id), RESCHEDULE_IPI, 1); +} + +/*==========================================================================* + * Name: smp_reschedule_interrupt + * + * Description: This routine executes on CPU which received + * 'RESCHEDULE_IPI'. + * Rescheduling is processed at the exit of interrupt + * operation. + * + * Born on Date: 2002.02.05 + * + * Arguments: NONE + * + * Returns: void (cannot fail) + * + * Modification log: + * Date Who Description + * ---------- --- -------------------------------------------------------- + * + *==========================================================================*/ +void smp_reschedule_interrupt(void) +{ + /* nothing to do */ +} + +/*==========================================================================* + * Name: smp_flush_cache_all + * + * Description: This routine sends a 'INVALIDATE_CACHE_IPI' to all other + * CPUs in the system. + * + * Born on Date: 2003-05-28 + * + * Arguments: NONE + * + * Returns: void (cannot fail) + * + * Modification log: + * Date Who Description + * ---------- --- -------------------------------------------------------- + * + *==========================================================================*/ +void smp_flush_cache_all(void) +{ + cpumask_t cpumask; + unsigned long *mask; + + preempt_disable(); + cpumask = cpu_online_map; + cpu_clear(smp_processor_id(), cpumask); + spin_lock(&flushcache_lock); + mask=cpus_addr(cpumask); + atomic_set_mask(*mask, (atomic_t *)&flushcache_cpumask); + send_IPI_mask(cpumask, INVALIDATE_CACHE_IPI, 0); + _flush_cache_copyback_all(); + while (flushcache_cpumask) + mb(); + spin_unlock(&flushcache_lock); + preempt_enable(); +} + +void smp_flush_cache_all_interrupt(void) +{ + _flush_cache_copyback_all(); + clear_bit(smp_processor_id(), &flushcache_cpumask); +} + +/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ +/* TLB flush request Routins */ +/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ + +/*==========================================================================* + * Name: smp_flush_tlb_all + * + * Description: This routine flushes all processes TLBs. + * 1.Request other CPU to execute 'flush_tlb_all_ipi()'. + * 2.Execute 'do_flush_tlb_all_local()'. + * + * Born on Date: 2002.02.05 + * + * Arguments: NONE + * + * Returns: void (cannot fail) + * + * Modification log: + * Date Who Description + * ---------- --- -------------------------------------------------------- + * + *==========================================================================*/ +void smp_flush_tlb_all(void) +{ + unsigned long flags; + + preempt_disable(); + local_irq_save(flags); + __flush_tlb_all(); + local_irq_restore(flags); + smp_call_function(flush_tlb_all_ipi, 0, 1, 1); + preempt_enable(); +} + +/*==========================================================================* + * Name: flush_tlb_all_ipi + * + * Description: This routine flushes all local TLBs. + * 1.Execute 'do_flush_tlb_all_local()'. + * + * Born on Date: 2002.02.05 + * + * Arguments: *info - not used + * + * Returns: void (cannot fail) + * + * Modification log: + * Date Who Description + * ---------- --- -------------------------------------------------------- + * + *==========================================================================*/ +static void flush_tlb_all_ipi(void *info) +{ + __flush_tlb_all(); +} + +/*==========================================================================* + * Name: smp_flush_tlb_mm + * + * Description: This routine flushes the specified mm context TLB's. + * + * Born on Date: 2002.02.05 + * + * Arguments: *mm - a pointer to the mm struct for flush TLB + * + * Returns: void (cannot fail) + * + * Modification log: + * Date Who Description + * ---------- --- -------------------------------------------------------- + * + *==========================================================================*/ +void smp_flush_tlb_mm(struct mm_struct *mm) +{ + int cpu_id = smp_processor_id(); + cpumask_t cpu_mask; + unsigned long *mmc = &mm->context[cpu_id]; + unsigned long flags; + + preempt_disable(); + cpu_mask = mm->cpu_vm_mask; + cpu_clear(cpu_id, cpu_mask); + + if (*mmc != NO_CONTEXT) { + local_irq_save(flags); + *mmc = NO_CONTEXT; + if (mm == current->mm) + activate_context(mm); + else + cpu_clear(cpu_id, mm->cpu_vm_mask); + local_irq_restore(flags); + } + if (!cpus_empty(cpu_mask)) + flush_tlb_others(cpu_mask, mm, NULL, FLUSH_ALL); + + preempt_enable(); +} + +/*==========================================================================* + * Name: smp_flush_tlb_range + * + * Description: This routine flushes a range of pages. + * + * Born on Date: 2002.02.05 + * + * Arguments: *mm - a pointer to the mm struct for flush TLB + * start - not used + * end - not used + * + * Returns: void (cannot fail) + * + * Modification log: + * Date Who Description + * ---------- --- -------------------------------------------------------- + * + *==========================================================================*/ +void smp_flush_tlb_range(struct vm_area_struct *vma, unsigned long start, + unsigned long end) +{ + smp_flush_tlb_mm(vma->vm_mm); +} + +/*==========================================================================* + * Name: smp_flush_tlb_page + * + * Description: This routine flushes one page. + * + * Born on Date: 2002.02.05 + * + * Arguments: *vma - a pointer to the vma struct include va + * va - virtual address for flush TLB + * + * Returns: void (cannot fail) + * + * Modification log: + * Date Who Description + * ---------- --- -------------------------------------------------------- + * + *==========================================================================*/ +void smp_flush_tlb_page(struct vm_area_struct *vma, unsigned long va) +{ + struct mm_struct *mm = vma->vm_mm; + int cpu_id = smp_processor_id(); + cpumask_t cpu_mask; + unsigned long *mmc = &mm->context[cpu_id]; + unsigned long flags; + + preempt_disable(); + cpu_mask = mm->cpu_vm_mask; + cpu_clear(cpu_id, cpu_mask); + +#ifdef DEBUG_SMP + if (!mm) + BUG(); +#endif + + if (*mmc != NO_CONTEXT) { + local_irq_save(flags); + va &= PAGE_MASK; + va |= (*mmc & MMU_CONTEXT_ASID_MASK); + __flush_tlb_page(va); + local_irq_restore(flags); + } + if (!cpus_empty(cpu_mask)) + flush_tlb_others(cpu_mask, mm, vma, va); + + preempt_enable(); +} + +/*==========================================================================* + * Name: flush_tlb_others + * + * Description: This routine requests other CPU to execute flush TLB. + * 1.Setup parmeters. + * 2.Send 'INVALIDATE_TLB_IPI' to other CPU. + * Request other CPU to execute 'smp_invalidate_interrupt()'. + * 3.Wait for other CPUs operation finished. + * + * Born on Date: 2002.02.05 + * + * Arguments: cpumask - bitmap of target CPUs + * *mm - a pointer to the mm struct for flush TLB + * *vma - a pointer to the vma struct include va + * va - virtual address for flush TLB + * + * Returns: void (cannot fail) + * + * Modification log: + * Date Who Description + * ---------- --- -------------------------------------------------------- + * + *==========================================================================*/ +static void flush_tlb_others(cpumask_t cpumask, struct mm_struct *mm, + struct vm_area_struct *vma, unsigned long va) +{ + unsigned long *mask; +#ifdef DEBUG_SMP + unsigned long flags; + __save_flags(flags); + if (!(flags & 0x0040)) /* Interrupt Disable NONONO */ + BUG(); +#endif /* DEBUG_SMP */ + + /* + * A couple of (to be removed) sanity checks: + * + * - we do not send IPIs to not-yet booted CPUs. + * - current CPU must not be in mask + * - mask must exist :) + */ + BUG_ON(cpus_empty(cpumask)); + + BUG_ON(cpu_isset(smp_processor_id(), cpumask)); + BUG_ON(!mm); + + /* If a CPU which we ran on has gone down, OK. */ + cpus_and(cpumask, cpumask, cpu_online_map); + if (cpus_empty(cpumask)) + return; + + /* + * i'm not happy about this global shared spinlock in the + * MM hot path, but we'll see how contended it is. + * Temporarily this turns IRQs off, so that lockups are + * detected by the NMI watchdog. + */ + spin_lock(&tlbstate_lock); + + flush_mm = mm; + flush_vma = vma; + flush_va = va; + mask=cpus_addr(cpumask); + atomic_set_mask(*mask, (atomic_t *)&flush_cpumask); + + /* + * We have to send the IPI only to + * CPUs affected. + */ + send_IPI_mask(cpumask, INVALIDATE_TLB_IPI, 0); + + while (!cpus_empty(flush_cpumask)) + /* nothing. lockup detection does not belong here */ + mb(); + + flush_mm = NULL; + flush_vma = NULL; + flush_va = 0; + spin_unlock(&tlbstate_lock); +} + +/*==========================================================================* + * Name: smp_invalidate_interrupt + * + * Description: This routine executes on CPU which received + * 'INVALIDATE_TLB_IPI'. + * 1.Flush local TLB. + * 2.Report flush TLB process was finished. + * + * Born on Date: 2002.02.05 + * + * Arguments: NONE + * + * Returns: void (cannot fail) + * + * Modification log: + * Date Who Description + * ---------- --- -------------------------------------------------------- + * + *==========================================================================*/ +void smp_invalidate_interrupt(void) +{ + int cpu_id = smp_processor_id(); + unsigned long *mmc = &flush_mm->context[cpu_id]; + + if (!cpu_isset(cpu_id, flush_cpumask)) + return; + + if (flush_va == FLUSH_ALL) { + *mmc = NO_CONTEXT; + if (flush_mm == current->active_mm) + activate_context(flush_mm); + else + cpu_clear(cpu_id, flush_mm->cpu_vm_mask); + } else { + unsigned long va = flush_va; + + if (*mmc != NO_CONTEXT) { + va &= PAGE_MASK; + va |= (*mmc & MMU_CONTEXT_ASID_MASK); + __flush_tlb_page(va); + } + } + cpu_clear(cpu_id, flush_cpumask); +} + +/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ +/* Stop CPU request Routins */ +/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ + +/*==========================================================================* + * Name: smp_send_stop + * + * Description: This routine requests stop all CPUs. + * 1.Request other CPU to execute 'stop_this_cpu()'. + * + * Born on Date: 2002.02.05 + * + * Arguments: NONE + * + * Returns: void (cannot fail) + * + * Modification log: + * Date Who Description + * ---------- --- -------------------------------------------------------- + * + *==========================================================================*/ +void smp_send_stop(void) +{ + smp_call_function(stop_this_cpu, NULL, 1, 0); +} + +/*==========================================================================* + * Name: stop_this_cpu + * + * Description: This routine halt CPU. + * + * Born on Date: 2002.02.05 + * + * Arguments: NONE + * + * Returns: void (cannot fail) + * + * Modification log: + * Date Who Description + * ---------- --- -------------------------------------------------------- + * + *==========================================================================*/ +static void stop_this_cpu(void *dummy) +{ + int cpu_id = smp_processor_id(); + + /* + * Remove this CPU: + */ + cpu_clear(cpu_id, cpu_online_map); + + /* + * PSW IE = 1; + * IMASK = 0; + * goto SLEEP + */ + local_irq_disable(); + outl(0, M32R_ICU_IMASK_PORTL); + inl(M32R_ICU_IMASK_PORTL); /* dummy read */ + local_irq_enable(); + + for ( ; ; ); +} + +/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ +/* Call function Routins */ +/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ + +/*==========================================================================* + * Name: smp_call_function + * + * Description: This routine sends a 'CALL_FUNCTION_IPI' to all other CPUs + * in the system. + * + * Born on Date: 2002.02.05 + * + * Arguments: *func - The function to run. This must be fast and + * non-blocking. + * *info - An arbitrary pointer to pass to the function. + * nonatomic - currently unused. + * wait - If true, wait (atomically) until function has + * completed on other CPUs. + * + * Returns: 0 on success, else a negative status code. Does not return + * until remote CPUs are nearly ready to execute <> or + * are or have executed. + * + * Cautions: You must not call this function with disabled interrupts or + * from a hardware interrupt handler, you may call it from a + * bottom half handler. + * + * Modification log: + * Date Who Description + * ---------- --- -------------------------------------------------------- + * + *==========================================================================*/ +int smp_call_function(void (*func) (void *info), void *info, int nonatomic, + int wait) +{ + struct call_data_struct data; + int cpus; + +#ifdef DEBUG_SMP + unsigned long flags; + __save_flags(flags); + if (!(flags & 0x0040)) /* Interrupt Disable NONONO */ + BUG(); +#endif /* DEBUG_SMP */ + + /* Holding any lock stops cpus from going down. */ + spin_lock(&call_lock); + cpus = num_online_cpus() - 1; + + if (!cpus) { + spin_unlock(&call_lock); + return 0; + } + + /* Can deadlock when called with interrupts disabled */ + WARN_ON(irqs_disabled()); + + data.func = func; + data.info = info; + atomic_set(&data.started, 0); + data.wait = wait; + if (wait) + atomic_set(&data.finished, 0); + + call_data = &data; + mb(); + + /* Send a message to all other CPUs and wait for them to respond */ + send_IPI_allbutself(CALL_FUNCTION_IPI, 0); + + /* Wait for response */ + while (atomic_read(&data.started) != cpus) + barrier(); + + if (wait) + while (atomic_read(&data.finished) != cpus) + barrier(); + spin_unlock(&call_lock); + + return 0; +} + +/*==========================================================================* + * Name: smp_call_function_interrupt + * + * Description: This routine executes on CPU which received + * 'CALL_FUNCTION_IPI'. + * + * Born on Date: 2002.02.05 + * + * Arguments: NONE + * + * Returns: void (cannot fail) + * + * Modification log: + * Date Who Description + * ---------- --- -------------------------------------------------------- + * + *==========================================================================*/ +void smp_call_function_interrupt(void) +{ + void (*func) (void *info) = call_data->func; + void *info = call_data->info; + int wait = call_data->wait; + + /* + * Notify initiating CPU that I've grabbed the data and am + * about to execute the function + */ + mb(); + atomic_inc(&call_data->started); + /* + * At this point the info structure may be out of scope unless wait==1 + */ + irq_enter(); + (*func)(info); + irq_exit(); + + if (wait) { + mb(); + atomic_inc(&call_data->finished); + } +} + +/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ +/* Timer Routins */ +/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ + +/*==========================================================================* + * Name: smp_send_timer + * + * Description: This routine sends a 'LOCAL_TIMER_IPI' to all other CPUs + * in the system. + * + * Born on Date: 2002.02.05 + * + * Arguments: NONE + * + * Returns: void (cannot fail) + * + * Modification log: + * Date Who Description + * ---------- --- -------------------------------------------------------- + * + *==========================================================================*/ +void smp_send_timer(void) +{ + send_IPI_allbutself(LOCAL_TIMER_IPI, 1); +} + +/*==========================================================================* + * Name: smp_send_timer + * + * Description: This routine executes on CPU which received + * 'LOCAL_TIMER_IPI'. + * + * Born on Date: 2002.02.05 + * + * Arguments: *regs - a pointer to the saved regster info + * + * Returns: void (cannot fail) + * + * Modification log: + * Date Who Description + * ---------- --- -------------------------------------------------------- + * + *==========================================================================*/ +void smp_ipi_timer_interrupt(struct pt_regs *regs) +{ + irq_enter(); + smp_local_timer_interrupt(regs); + irq_exit(); +} + +/*==========================================================================* + * Name: smp_local_timer_interrupt + * + * Description: Local timer interrupt handler. It does both profiling and + * process statistics/rescheduling. + * We do profiling in every local tick, statistics/rescheduling + * happen only every 'profiling multiplier' ticks. The default + * multiplier is 1 and it can be changed by writing the new + * multiplier value into /proc/profile. + * + * Born on Date: 2002.02.05 + * + * Arguments: *regs - a pointer to the saved regster info + * + * Returns: void (cannot fail) + * + * Original: arch/i386/kernel/apic.c + * + * Modification log: + * Date Who Description + * ---------- --- -------------------------------------------------------- + * 2003-06-24 hy use per_cpu structure. + *==========================================================================*/ +void smp_local_timer_interrupt(struct pt_regs *regs) +{ + int user = user_mode(regs); + int cpu_id = smp_processor_id(); + + /* + * The profiling function is SMP safe. (nothing can mess + * around with "current", and the profiling counters are + * updated with atomic operations). This is especially + * useful with a profiling multiplier != 1 + */ + + profile_tick(CPU_PROFILING, regs); + + if (--per_cpu(prof_counter, cpu_id) <= 0) { + /* + * The multiplier may have changed since the last time we got + * to this point as a result of the user writing to + * /proc/profile. In this case we need to adjust the APIC + * timer accordingly. + * + * Interrupts are already masked off at this point. + */ + per_cpu(prof_counter, cpu_id) + = per_cpu(prof_multiplier, cpu_id); + if (per_cpu(prof_counter, cpu_id) + != per_cpu(prof_old_multiplier, cpu_id)) + { + per_cpu(prof_old_multiplier, cpu_id) + = per_cpu(prof_counter, cpu_id); + } + + update_process_times(user); + } +} + +/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ +/* Send IPI Routins */ +/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ + +/*==========================================================================* + * Name: send_IPI_allbutself + * + * Description: This routine sends a IPI to all other CPUs in the system. + * + * Born on Date: 2002.02.05 + * + * Arguments: ipi_num - Number of IPI + * try - 0 : Send IPI certainly. + * !0 : The following IPI is not sended when Target CPU + * has not received the before IPI. + * + * Returns: void (cannot fail) + * + * Modification log: + * Date Who Description + * ---------- --- -------------------------------------------------------- + * + *==========================================================================*/ +void send_IPI_allbutself(int ipi_num, int try) +{ + cpumask_t cpumask; + + cpumask = cpu_online_map; + cpu_clear(smp_processor_id(), cpumask); + + send_IPI_mask(cpumask, ipi_num, try); +} + +/*==========================================================================* + * Name: send_IPI_mask + * + * Description: This routine sends a IPI to CPUs in the system. + * + * Born on Date: 2002.02.05 + * + * Arguments: cpu_mask - Bitmap of target CPUs logical ID + * ipi_num - Number of IPI + * try - 0 : Send IPI certainly. + * !0 : The following IPI is not sended when Target CPU + * has not received the before IPI. + * + * Returns: void (cannot fail) + * + * Modification log: + * Date Who Description + * ---------- --- -------------------------------------------------------- + * + *==========================================================================*/ +static void send_IPI_mask(cpumask_t cpumask, int ipi_num, int try) +{ + cpumask_t physid_mask, tmp; + int cpu_id, phys_id; + int num_cpus = num_online_cpus(); + + if (num_cpus <= 1) /* NO MP */ + return; + + cpus_and(tmp, cpumask, cpu_online_map); + BUG_ON(!cpus_equal(cpumask, tmp)); + + physid_mask = CPU_MASK_NONE; + for_each_cpu_mask(cpu_id, cpumask){ + if ((phys_id = cpu_to_physid(cpu_id)) != -1) + cpu_set(phys_id, physid_mask); + } + + send_IPI_mask_phys(physid_mask, ipi_num, try); +} + +/*==========================================================================* + * Name: send_IPI_mask_phys + * + * Description: This routine sends a IPI to other CPUs in the system. + * + * Born on Date: 2002.02.05 + * + * Arguments: cpu_mask - Bitmap of target CPUs physical ID + * ipi_num - Number of IPI + * try - 0 : Send IPI certainly. + * !0 : The following IPI is not sended when Target CPU + * has not received the before IPI. + * + * Returns: IPICRi regster value. + * + * Modification log: + * Date Who Description + * ---------- --- -------------------------------------------------------- + * + *==========================================================================*/ +unsigned long send_IPI_mask_phys(cpumask_t physid_mask, int ipi_num, + int try) +{ + spinlock_t *ipilock; + unsigned long flags = 0; + volatile unsigned long *ipicr_addr; + unsigned long ipicr_val; + unsigned long my_physid_mask; + unsigned long mask = cpus_addr(physid_mask)[0]; + + + if (mask & ~physids_coerce(phys_cpu_present_map)) + BUG(); + if (ipi_num >= NR_IPIS) + BUG(); + + mask <<= IPI_SHIFT; + ipilock = &ipi_lock[ipi_num]; + ipicr_addr = (volatile unsigned long *)(M32R_ICU_IPICR_ADDR + + (ipi_num << 2)); + my_physid_mask = ~(1 << smp_processor_id()); + + /* + * lock ipi_lock[i] + * check IPICRi == 0 + * write IPICRi (send IPIi) + * unlock ipi_lock[i] + */ + __asm__ __volatile__ ( + ";; LOCK ipi_lock[i] \n\t" + ".fillinsn \n" + "1: \n\t" + "mvfc %1, psw \n\t" + "clrpsw #0x40 -> nop \n\t" + DCACHE_CLEAR("r4", "r5", "%2") + "lock r4, @%2 \n\t" + "addi r4, #-1 \n\t" + "unlock r4, @%2 \n\t" + "mvtc %1, psw \n\t" + "bnez r4, 2f \n\t" + LOCK_SECTION_START(".balign 4 \n\t") + ".fillinsn \n" + "2: \n\t" + "ld r4, @%2 \n\t" + "blez r4, 2b \n\t" + "bra 1b \n\t" + LOCK_SECTION_END + ";; CHECK IPICRi == 0 \n\t" + ".fillinsn \n" + "3: \n\t" + "ld %0, @%3 \n\t" + "and %0, %6 \n\t" + "beqz %0, 4f \n\t" + "bnez %5, 5f \n\t" + "bra 3b \n\t" + ";; WRITE IPICRi (send IPIi) \n\t" + ".fillinsn \n" + "4: \n\t" + "st %4, @%3 \n\t" + ";; UNLOCK ipi_lock[i] \n\t" + ".fillinsn \n" + "5: \n\t" + "ldi r4, #1 \n\t" + "st r4, @%2 \n\t" + : "=&r"(ipicr_val) + : "r"(flags), "r"(&ipilock->lock), "r"(ipicr_addr), + "r"(mask), "r"(try), "r"(my_physid_mask) + : "memory", "r4" +#ifdef CONFIG_CHIP_M32700_TS1 + , "r5" +#endif /* CONFIG_CHIP_M32700_TS1 */ + ); + + return ipicr_val; +} diff -Nru a/arch/m32r/kernel/smpboot.c b/arch/m32r/kernel/smpboot.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/smpboot.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,635 @@ +/* + * linux/arch/m32r/kernel/smpboot.c + * orig : i386 2.4.10 + * + * M32R SMP booting functions + * + * Copyright (c) 2001, 2002, 2003 Hitoshi Yamamoto + * + * Taken from i386 version. + * (c) 1995 Alan Cox, Building #3 + * (c) 1998, 1999, 2000 Ingo Molnar + * + * Much of the core SMP work is based on previous work by Thomas Radke, to + * whom a great many thanks are extended. + * + * Thanks to Intel for making available several different Pentium, + * Pentium Pro and Pentium-II/Xeon MP machines. + * Original development of Linux SMP code supported by Caldera. + * + * This code is released under the GNU General Public License version 2 or + * later. + * + * Fixes + * Felix Koop : NR_CPUS used properly + * Jose Renau : Handle single CPU case. + * Alan Cox : By repeated request + * 8) - Total BogoMIP report. + * Greg Wright : Fix for kernel stacks panic. + * Erich Boleyn : MP v1.4 and additional changes. + * Matthias Sattler : Changes for 2.1 kernel map. + * Michel Lespinasse : Changes for 2.1 kernel map. + * Michael Chastain : Change trampoline.S to gnu as. + * Alan Cox : Dumb bug: 'B' step PPro's are fine + * Ingo Molnar : Added APIC timers, based on code + * from Jose Renau + * Ingo Molnar : various cleanups and rewrites + * Tigran Aivazian : fixed "0.00 in /proc/uptime on SMP" bug. + * Maciej W. Rozycki : Bits for genuine 82489DX APICs + * Martin J. Bligh : Added support for multi-quad systems + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#define DEBUG_SMP +#ifdef DEBUG_SMP +#define Dprintk(x...) printk(x) +#else +#define Dprintk(x...) +#endif + +extern int cpu_idle(void); +extern cpumask_t cpu_initialized; + +/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ +/* Data structures and variables */ +/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ + +/* Processor that is doing the boot up */ +static unsigned int bsp_phys_id = -1; + +/* Bitmask of physically existing CPUs */ +physid_mask_t phys_cpu_present_map; + +/* Bitmask of currently online CPUs */ +cpumask_t cpu_online_map; + +cpumask_t cpu_bootout_map; +cpumask_t cpu_bootin_map; +cpumask_t cpu_callout_map; +static cpumask_t cpu_callin_map; + +/* Per CPU bogomips and other parameters */ +struct cpuinfo_m32r cpu_data[NR_CPUS] __cacheline_aligned; + +/* Set when the idlers are all forked */ +int smp_threads_ready; + +static int cpucount; +static cpumask_t smp_commenced_mask; + +extern struct { + void * spi; + unsigned short ss; +} stack_start; + +/* which physical physical ID maps to which logical CPU number */ +static volatile int physid_2_cpu[NR_CPUS]; + +/* which logical CPU number maps to which physical ID */ +volatile int cpu_2_physid[NR_CPUS]; + +DEFINE_PER_CPU(int, prof_multiplier) = 1; +DEFINE_PER_CPU(int, prof_old_multiplier) = 1; +DEFINE_PER_CPU(int, prof_counter) = 1; + +spinlock_t ipi_lock[NR_IPIS]; + +static unsigned int calibration_result; + +unsigned long cache_decay_ticks = HZ / 100; + +/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ +/* Function Prototypes */ +/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ + +void smp_prepare_boot_cpu(void); +void smp_prepare_cpus(unsigned int); +static void smp_tune_scheduling(void); +static void init_ipi_lock(void); +static void do_boot_cpu(int); +int __cpu_up(unsigned int); +void smp_cpus_done(unsigned int); + +int start_secondary(void *); +static void smp_callin(void); +static void smp_online(void); + +static void show_mp_info(int); +static void smp_store_cpu_info(int); +static void show_cpu_info(int); +int setup_profiling_timer(unsigned int); +static void init_cpu_to_physid(void); +static void map_cpu_to_physid(int, int); +static void unmap_cpu_to_physid(int, int); + +/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ +/* Boot up APs Routins : BSP */ +/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ +void __devinit smp_prepare_boot_cpu(void) +{ + bsp_phys_id = hard_smp_processor_id(); + physid_set(bsp_phys_id, phys_cpu_present_map); + cpu_set(0, cpu_online_map); /* BSP's cpu_id == 0 */ + cpu_set(0, cpu_callout_map); + cpu_set(0, cpu_callin_map); + + /* + * Initialize the logical to physical CPU number mapping + */ + init_cpu_to_physid(); + map_cpu_to_physid(0, bsp_phys_id); + current_thread_info()->cpu = 0; +} + +/*==========================================================================* + * Name: smp_prepare_cpus (old smp_boot_cpus) + * + * Description: This routine boot up APs. + * + * Born on Date: 2002.02.05 + * + * Arguments: NONE + * + * Returns: void (cannot fail) + * + * Modification log: + * Date Who Description + * ---------- --- -------------------------------------------------------- + * 2003-06-24 hy modify for linux-2.5.69 + * + *==========================================================================*/ +void __init smp_prepare_cpus(unsigned int max_cpus) +{ + int phys_id; + unsigned long nr_cpu; + + nr_cpu = inl(M32R_FPGA_NUM_OF_CPUS_PORTL); + if (nr_cpu > NR_CPUS) { + printk(KERN_INFO "NUM_OF_CPUS reg. value [%ld] > NR_CPU [%d]", + nr_cpu, NR_CPUS); + goto smp_done; + } + for (phys_id = 0 ; phys_id < nr_cpu ; phys_id++) + physid_set(phys_id, phys_cpu_present_map); + + show_mp_info(nr_cpu); + + init_ipi_lock(); + + /* + * Setup boot CPU information + */ + smp_store_cpu_info(0); /* Final full version of the data */ + smp_tune_scheduling(); + + /* + * If SMP should be disabled, then really disable it! + */ + if (!max_cpus) { + printk(KERN_INFO "SMP mode deactivated by commandline.\n"); + goto smp_done; + } + + /* + * Now scan the CPU present map and fire up the other CPUs. + */ + Dprintk("CPU present map : %lx\n", physids_coerce(phys_cpu_present_map)); + + for (phys_id = 0 ; phys_id < NR_CPUS ; phys_id++) { + /* + * Don't even attempt to start the boot CPU! + */ + if (phys_id == bsp_phys_id) + continue; + + if (!physid_isset(phys_id, phys_cpu_present_map)) + continue; + + if ((max_cpus >= 0) && (max_cpus <= cpucount + 1)) + continue; + + do_boot_cpu(phys_id); + + /* + * Make sure we unmap all failed CPUs + */ + if (physid_to_cpu(phys_id) == -1) { + physid_clear(phys_id, phys_cpu_present_map); + printk("phys CPU#%d not responding - " \ + "cannot use it.\n", phys_id); + } + } + +smp_done: + Dprintk("Boot done.\n"); +} + +static void __init smp_tune_scheduling(void) +{ + /* Nothing to do. */ +} + +/* + * init_ipi_lock : Initialize IPI locks. + */ +static void __init init_ipi_lock(void) +{ + int ipi; + + for (ipi = 0 ; ipi < NR_IPIS ; ipi++) + ipi_lock[ipi] = SPIN_LOCK_UNLOCKED; +} + +/*==========================================================================* + * Name: do_boot_cpu + * + * Description: This routine boot up one AP. + * + * Born on Date: 2002.02.05 + * + * Arguments: phys_id - Target CPU physical ID + * + * Returns: void (cannot fail) + * + * Modification log: + * Date Who Description + * ---------- --- -------------------------------------------------------- + * 2003-06-24 hy modify for linux-2.5.69 + * + *==========================================================================*/ +static void __init do_boot_cpu(int phys_id) +{ + struct task_struct *idle; + unsigned long send_status, boot_status; + int timeout, cpu_id; + + cpu_id = ++cpucount; + + /* + * We can't use kernel_thread since we must avoid to + * reschedule the child. + */ + idle = fork_idle(cpu_id); + if (IS_ERR(idle)) + panic("failed fork for CPU#%d.", cpu_id); + + idle->thread.lr = (unsigned long)start_secondary; + + map_cpu_to_physid(cpu_id, phys_id); + + /* So we see what's up */ + printk("Booting processor %d/%d\n", phys_id, cpu_id); + stack_start.spi = (void *)idle->thread.sp; + idle->thread_info->cpu = cpu_id; + + /* + * Send Startup IPI + * 1.IPI received by CPU#(phys_id). + * 2.CPU#(phys_id) enter startup_AP (arch/m32r/kernel/head.S) + * 3.CPU#(phys_id) enter start_secondary() + */ + send_status = 0; + boot_status = 0; + + cpu_set(phys_id, cpu_bootout_map); + + /* Send Startup IPI */ + send_IPI_mask_phys(cpumask_of_cpu(phys_id), CPU_BOOT_IPI, 0); + + Dprintk("Waiting for send to finish...\n"); + timeout = 0; + + /* Wait 100[ms] */ + do { + Dprintk("+"); + udelay(1000); + send_status = !cpu_isset(phys_id, cpu_bootin_map); + } while (send_status && (timeout++ < 100)); + + Dprintk("After Startup.\n"); + + if (!send_status) { + /* + * allow APs to start initializing. + */ + Dprintk("Before Callout %d.\n", cpu_id); + cpu_set(cpu_id, cpu_callout_map); + Dprintk("After Callout %d.\n", cpu_id); + + /* + * Wait 5s total for a response + */ + for (timeout = 0; timeout < 5000; timeout++) { + if (cpu_isset(cpu_id, cpu_callin_map)) + break; /* It has booted */ + udelay(1000); + } + + if (cpu_isset(cpu_id, cpu_callin_map)) { + /* number CPUs logically, starting from 1 (BSP is 0) */ + Dprintk("OK.\n"); + } else { + boot_status = 1; + printk("Not responding.\n"); + } + } else + printk("IPI never delivered???\n"); + + if (send_status || boot_status) { + unmap_cpu_to_physid(cpu_id, phys_id); + cpu_clear(cpu_id, cpu_callout_map); + cpu_clear(cpu_id, cpu_callin_map); + cpu_clear(cpu_id, cpu_initialized); + cpucount--; + } +} + +int __devinit __cpu_up(unsigned int cpu_id) +{ + int timeout; + + cpu_set(cpu_id, smp_commenced_mask); + + /* + * Wait 5s total for a response + */ + for (timeout = 0; timeout < 5000; timeout++) { + if (cpu_isset(cpu_id, cpu_online_map)) + break; + udelay(1000); + } + if (!cpu_isset(cpu_id, cpu_online_map)) + BUG(); + + return 0; +} + +void __init smp_cpus_done(unsigned int max_cpus) +{ + int cpu_id, timeout; + unsigned long bogosum = 0; + + for (timeout = 0; timeout < 5000; timeout++) { + if (cpus_equal(cpu_callin_map, cpu_online_map)) + break; + udelay(1000); + } + if (!cpus_equal(cpu_callin_map, cpu_online_map)) + BUG(); + + for (cpu_id = 0 ; cpu_id < num_online_cpus() ; cpu_id++) + show_cpu_info(cpu_id); + + /* + * Allow the user to impress friends. + */ + Dprintk("Before bogomips.\n"); + if (cpucount) { + for_each_cpu_mask(cpu_id, cpu_online_map) + bogosum += cpu_data[cpu_id].loops_per_jiffy; + + printk(KERN_INFO "Total of %d processors activated " \ + "(%lu.%02lu BogoMIPS).\n", cpucount + 1, + bogosum / (500000 / HZ), + (bogosum / (5000 / HZ)) % 100); + Dprintk("Before bogocount - setting activated=1.\n"); + } +} + +/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ +/* Activate a secondary processor Routins */ +/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ + +/*==========================================================================* + * Name: start_secondary + * + * Description: This routine activate a secondary processor. + * + * Born on Date: 2002.02.05 + * + * Arguments: *unused - currently unused. + * + * Returns: void (cannot fail) + * + * Modification log: + * Date Who Description + * ---------- --- -------------------------------------------------------- + * 2003-06-24 hy modify for linux-2.5.69 + * + *==========================================================================*/ +int __init start_secondary(void *unused) +{ + cpu_init(); + smp_callin(); + while (!cpu_isset(smp_processor_id(), smp_commenced_mask)) + rep_nop(); + + smp_online(); + + /* + * low-memory mappings have been cleared, flush them from + * the local TLBs too. + */ + local_flush_tlb_all(); + + return cpu_idle(); +} + +/*==========================================================================* + * Name: smp_callin + * + * Description: This routine activate a secondary processor. + * + * Born on Date: 2002.02.05 + * + * Arguments: NONE + * + * Returns: void (cannot fail) + * + * Modification log: + * Date Who Description + * ---------- --- -------------------------------------------------------- + * 2003-06-24 hy modify for linux-2.5.69 + * + *==========================================================================*/ +static void __init smp_callin(void) +{ + int phys_id = hard_smp_processor_id(); + int cpu_id = smp_processor_id(); + unsigned long timeout; + + if (cpu_isset(cpu_id, cpu_callin_map)) { + printk("huh, phys CPU#%d, CPU#%d already present??\n", + phys_id, cpu_id); + BUG(); + } + Dprintk("CPU#%d (phys ID: %d) waiting for CALLOUT\n", cpu_id, phys_id); + + /* Waiting 2s total for startup (udelay is not yet working) */ + timeout = jiffies + (2 * HZ); + while (time_before(jiffies, timeout)) { + /* Has the boot CPU finished it's STARTUP sequence ? */ + if (cpu_isset(cpu_id, cpu_callout_map)) + break; + rep_nop(); + } + + if (!time_before(jiffies, timeout)) { + printk("BUG: CPU#%d started up but did not get a callout!\n", + cpu_id); + BUG(); + } + + /* Allow the master to continue. */ + cpu_set(cpu_id, cpu_callin_map); +} + +static void __init smp_online(void) +{ + int cpu_id = smp_processor_id(); + + local_irq_enable(); + + /* Get our bogomips. */ + calibrate_delay(); + + /* Save our processor parameters */ + smp_store_cpu_info(cpu_id); + + cpu_set(cpu_id, cpu_online_map); +} + +/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ +/* Boot up CPUs common Routins */ +/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ +static void __init show_mp_info(int nr_cpu) +{ + int i; + char cpu_model0[17], cpu_model1[17], cpu_ver[9]; + + strncpy(cpu_model0, (char *)M32R_FPGA_CPU_NAME_ADDR, 16); + strncpy(cpu_model1, (char *)M32R_FPGA_MODEL_ID_ADDR, 16); + strncpy(cpu_ver, (char *)M32R_FPGA_VERSION_ADDR, 8); + + cpu_model0[16] = '\0'; + for (i = 15 ; i >= 0 ; i--) { + if (cpu_model0[i] != ' ') + break; + cpu_model0[i] = '\0'; + } + cpu_model1[16] = '\0'; + for (i = 15 ; i >= 0 ; i--) { + if (cpu_model1[i] != ' ') + break; + cpu_model1[i] = '\0'; + } + cpu_ver[8] = '\0'; + for (i = 7 ; i >= 0 ; i--) { + if (cpu_ver[i] != ' ') + break; + cpu_ver[i] = '\0'; + } + + printk(KERN_INFO "M32R-mp information\n"); + printk(KERN_INFO " On-chip CPUs : %d\n", nr_cpu); + printk(KERN_INFO " CPU model : %s/%s(%s)\n", cpu_model0, + cpu_model1, cpu_ver); +} + +/* + * The bootstrap kernel entry code has set these up. Save them for + * a given CPU + */ +static void __init smp_store_cpu_info(int cpu_id) +{ + struct cpuinfo_m32r *ci = cpu_data + cpu_id; + + *ci = boot_cpu_data; + ci->loops_per_jiffy = loops_per_jiffy; +} + +static void __init show_cpu_info(int cpu_id) +{ + struct cpuinfo_m32r *ci = &cpu_data[cpu_id]; + + printk("CPU#%d : ", cpu_id); + +#define PRINT_CLOCK(name, value) \ + printk(name " clock %d.%02dMHz", \ + ((value) / 1000000), ((value) % 1000000) / 10000) + + PRINT_CLOCK("CPU", (int)ci->cpu_clock); + PRINT_CLOCK(", Bus", (int)ci->bus_clock); + printk(", loops_per_jiffy[%ld]\n", ci->loops_per_jiffy); +} + +/* + * the frequency of the profiling timer can be changed + * by writing a multiplier value into /proc/profile. + */ +int setup_profiling_timer(unsigned int multiplier) +{ + int i; + + /* + * Sanity check. [at least 500 APIC cycles should be + * between APIC interrupts as a rule of thumb, to avoid + * irqs flooding us] + */ + if ( (!multiplier) || (calibration_result / multiplier < 500)) + return -EINVAL; + + /* + * Set the new multiplier for each CPU. CPUs don't start using the + * new values until the next timer interrupt in which they do process + * accounting. At that time they also adjust their APIC timers + * accordingly. + */ + for (i = 0; i < NR_CPUS; ++i) + per_cpu(prof_multiplier, i) = multiplier; + + return 0; +} + +/* Initialize all maps between cpu number and apicids */ +static void __init init_cpu_to_physid(void) +{ + int i; + + for (i = 0 ; i < NR_CPUS ; i++) { + cpu_2_physid[i] = -1; + physid_2_cpu[i] = -1; + } +} + +/* + * set up a mapping between cpu and apicid. Uses logical apicids for multiquad, + * else physical apic ids + */ +static void __init map_cpu_to_physid(int cpu_id, int phys_id) +{ + physid_2_cpu[phys_id] = cpu_id; + cpu_2_physid[cpu_id] = phys_id; +} + +/* + * undo a mapping between cpu and apicid. Uses logical apicids for multiquad, + * else physical apic ids + */ +static void __init unmap_cpu_to_physid(int cpu_id, int phys_id) +{ + physid_2_cpu[phys_id] = -1; + cpu_2_physid[cpu_id] = -1; +} + diff -Nru a/arch/m32r/kernel/sys_m32r.c b/arch/m32r/kernel/sys_m32r.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/sys_m32r.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,276 @@ +/* + * linux/arch/m32r/kernel/sys_m32r.c + * + * This file contains various random system calls that + * have a non-standard calling sequence on the Linux/M32R platform. + * + * Taken from i386 version. + */ + +/* $Id$ */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +/* + * sys_tas() - test-and-set + * linuxthreads testing version + */ +#ifndef CONFIG_SMP +asmlinkage int sys_tas(int *addr) +{ + int oldval; + unsigned long flags; + + if (!access_ok(VERIFY_WRITE, addr, sizeof (int))) + return -EFAULT; + local_irq_save(flags); + oldval = *addr; + *addr = 1; + local_irq_restore(flags); + return oldval; +} +#else /* CONFIG_SMP */ +#include + +static spinlock_t tas_lock = SPIN_LOCK_UNLOCKED; + +asmlinkage int sys_tas(int *addr) +{ + int oldval; + + if (!access_ok(VERIFY_WRITE, addr, sizeof (int))) + return -EFAULT; + + spin_lock(&tas_lock); + oldval = *addr; + *addr = 1; + spin_unlock(&tas_lock); + + return oldval; +} +#endif /* CONFIG_SMP */ + +/* + * sys_pipe() is the normal C calling standard for creating + * a pipe. It's not the way Unix traditionally does this, though. + */ +asmlinkage int +sys_pipe(unsigned long r0, unsigned long r1, unsigned long r2, + unsigned long r3, unsigned long r4, unsigned long r5, + unsigned long r6, struct pt_regs regs) +{ + int fd[2]; + int error; + + error = do_pipe(fd); + if (!error) { + if (copy_to_user((void *)r0, (void *)fd, 2*sizeof(int))) + error = -EFAULT; + } + return error; +} + +static inline long do_mmap2( + unsigned long addr, unsigned long len, + unsigned long prot, unsigned long flags, + int fd, unsigned long pgoff) +{ + int error = -EBADF; + struct file *file = NULL; + + flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); + if (!(flags & MAP_ANONYMOUS)) { + file = fget(fd); + if (!file) + goto out; + } + + down_write(¤t->mm->mmap_sem); + error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff); + up_write(¤t->mm->mmap_sem); + + if (file) + fput(file); +out: + return error; +} + +asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, + unsigned long prot, unsigned long flags, + unsigned long fd, unsigned long pgoff) +{ + return do_mmap2(addr, len, prot, flags, fd, pgoff); +} + +/* + * Perform the select(nd, in, out, ex, tv) and mmap() system + * calls. Linux/M32R didn't use to be able to handle more than + * 4 system call parameters, so these system calls used a memory + * block for parameter passing.. + */ + +struct mmap_arg_struct { + unsigned long addr; + unsigned long len; + unsigned long prot; + unsigned long flags; + unsigned long fd; + unsigned long offset; +}; + +asmlinkage int old_mmap(struct mmap_arg_struct *arg) +{ + struct mmap_arg_struct a; + int err = -EFAULT; + + if (copy_from_user(&a, arg, sizeof(a))) + goto out; + + err = -EINVAL; + if (a.offset & ~PAGE_MASK) + goto out; + err = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, + a.offset>>PAGE_SHIFT); +out: + return err; +} + +struct sel_arg_struct { + unsigned long n; + fd_set __user *inp, *outp, *exp; + struct timeval __user *tvp; +}; + +asmlinkage int old_select(struct sel_arg_struct __user *arg) +{ + struct sel_arg_struct a; + + if (copy_from_user(&a, arg, sizeof(a))) + return -EFAULT; + /* sys_select() does the appropriate kernel locking */ + return sys_select(a.n, a.inp, a.outp, a.exp, a.tvp); +} + +/* + * sys_ipc() is the de-multiplexer for the SysV IPC calls.. + * + * This is really horribly ugly. + */ +asmlinkage int sys_ipc(uint call, int first, int second, + int third, void __user *ptr, long fifth) +{ + int version, ret; + + version = call >> 16; /* hack for backward compatibility */ + call &= 0xffff; + + switch (call) { + case SEMOP: + return sys_semtimedop(first, (struct sembuf __user *)ptr, + second, NULL); + case SEMTIMEDOP: + return sys_semtimedop(first, (struct sembuf __user *)ptr, + second, (const struct timespec __user *)fifth); + case SEMGET: + return sys_semget (first, second, third); + case SEMCTL: { + union semun fourth; + if (!ptr) + return -EINVAL; + if (get_user(fourth.__pad, (void __user * __user *) ptr)) + return -EFAULT; + return sys_semctl (first, second, third, fourth); + } + + case MSGSND: + return sys_msgsnd (first, (struct msgbuf __user *) ptr, + second, third); + case MSGRCV: + switch (version) { + case 0: { + struct ipc_kludge tmp; + if (!ptr) + return -EINVAL; + + if (copy_from_user(&tmp, + (struct ipc_kludge __user *) ptr, + sizeof (tmp))) + return -EFAULT; + return sys_msgrcv (first, tmp.msgp, second, + tmp.msgtyp, third); + } + default: + return sys_msgrcv (first, + (struct msgbuf __user *) ptr, + second, fifth, third); + } + case MSGGET: + return sys_msgget ((key_t) first, second); + case MSGCTL: + return sys_msgctl (first, second, + (struct msqid_ds __user *) ptr); + case SHMAT: { + ulong raddr; + + if ((ret = verify_area(VERIFY_WRITE, (ulong __user *) third, + sizeof(ulong)))) + return ret; + ret = do_shmat (first, (char __user *) ptr, second, &raddr); + if (ret) + return ret; + return put_user (raddr, (ulong __user *) third); + } + case SHMDT: + return sys_shmdt ((char __user *)ptr); + case SHMGET: + return sys_shmget (first, second, third); + case SHMCTL: + return sys_shmctl (first, second, + (struct shmid_ds __user *) ptr); + default: + return -ENOSYS; + } +} + +asmlinkage int sys_uname(struct old_utsname * name) +{ + int err; + if (!name) + return -EFAULT; + down_read(&uts_sem); + err=copy_to_user(name, &system_utsname, sizeof (*name)); + up_read(&uts_sem); + return err?-EFAULT:0; +} + +asmlinkage int sys_cacheflush(void *addr, int bytes, int cache) +{ + /* This should flush more selectivly ... */ + _flush_cache_all(); + return 0; +} + +asmlinkage int sys_cachectl(char *addr, int nbytes, int op) +{ + /* Not implemented yet. */ + return -ENOSYS; +} + diff -Nru a/arch/m32r/kernel/time.c b/arch/m32r/kernel/time.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/time.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,317 @@ +/* + * linux/arch/m32r/kernel/time.c + * + * Copyright (c) 2001, 2002 Hiroyuki Kondo, Hirokazu Takata, + * Hitoshi Yamamoto + * Taken from i386 version. + * Copyright (C) 1991, 1992, 1995 Linus Torvalds + * Copyright (C) 1996, 1997, 1998 Ralf Baechle + * + * This file contains the time handling details for PC-style clocks as + * found in some MIPS systems. + * + * Some code taken from sh version. + * Copyright (C) 1999 Tetsuya Okada & Niibe Yutaka + * Copyright (C) 2000 Philipp Rumpf + */ + +#undef DEBUG_TIMER + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +#ifdef CONFIG_SMP +extern void send_IPI_allbutself(int, int); +extern void smp_local_timer_interrupt(struct pt_regs *); +#endif + +u64 jiffies_64 = INITIAL_JIFFIES; + +EXPORT_SYMBOL(jiffies_64); + +extern unsigned long wall_jiffies; +#define TICK_SIZE (tick_nsec / 1000) + +/* + * Change this if you have some constant time drift + */ + +/* This is for machines which generate the exact clock. */ +#define USECS_PER_JIFFY (1000000/HZ) + +static unsigned long latch; + +static unsigned long do_gettimeoffset(void) +{ + unsigned long elapsed_time = 0; /* [us] */ + +#if defined(CONFIG_CHIP_M32102) || defined(CONFIG_CHIP_XNUX2) \ + || defined(CONFIG_CHIP_VDEC2) || defined(CONFIG_CHIP_M32700) \ + || defined(CONFIG_CHIP_OPSP) +#ifndef CONFIG_SMP + + unsigned long count; + + /* timer count may underflow right here */ + count = inl(M32R_MFT2CUT_PORTL); + + if (inl(M32R_ICU_CR18_PORTL) & 0x00000100) /* underflow check */ + count = 0; + + count = (latch - count) * TICK_SIZE; + elapsed_time = (count + latch / 2) / latch; + /* NOTE: LATCH is equal to the "interval" value (= reload count). */ + +#else /* CONFIG_SMP */ + unsigned long count; + static unsigned long p_jiffies = -1; + static unsigned long p_count = 0; + + /* timer count may underflow right here */ + count = inl(M32R_MFT2CUT_PORTL); + + if (jiffies == p_jiffies && count > p_count) + count = 0; + + p_jiffies = jiffies; + p_count = count; + + count = (latch - count) * TICK_SIZE; + elapsed_time = (count + latch / 2) / latch; + /* NOTE: LATCH is equal to the "interval" value (= reload count). */ +#endif /* CONFIG_SMP */ +#elif defined(CONFIG_CHIP_M32310) +#warning do_gettimeoffse not implemented +#else +#error no chip configuration +#endif + + return elapsed_time; +} + +/* + * This version of gettimeofday has near microsecond resolution. + */ +void do_gettimeofday(struct timeval *tv) +{ + unsigned long seq; + unsigned long usec, sec; + unsigned long max_ntp_tick = tick_usec - tickadj; + + do { + unsigned long lost; + + seq = read_seqbegin(&xtime_lock); + + usec = do_gettimeoffset(); + lost = jiffies - wall_jiffies; + + /* + * 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 = min(usec, max_ntp_tick); + if (lost) + usec += lost * max_ntp_tick; + } else if (unlikely(lost)) + usec += lost * tick_usec; + + sec = xtime.tv_sec; + usec += (xtime.tv_nsec / 1000); + } while (read_seqretry(&xtime_lock, seq)); + + while (usec >= 1000000) { + usec -= 1000000; + sec++; + } + + tv->tv_sec = sec; + tv->tv_usec = usec; +} + +EXPORT_SYMBOL(do_gettimeofday); + +int do_settimeofday(struct timespec *tv) +{ + time_t wtm_sec, sec = tv->tv_sec; + long wtm_nsec, nsec = tv->tv_nsec; + + if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC) + return -EINVAL; + + 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! + */ + 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); + + time_adjust = 0; /* stop active adjtime() */ + time_status |= STA_UNSYNC; + time_maxerror = NTP_PHASE_LIMIT; + time_esterror = NTP_PHASE_LIMIT; + write_sequnlock_irq(&xtime_lock); + clock_was_set(); + + return 0; +} + +EXPORT_SYMBOL(do_settimeofday); + +/* + * In order to set the CMOS clock precisely, set_rtc_mmss has to be + * called 500 ms after the second nowtime has started, because when + * nowtime is written into the registers of the CMOS clock, it will + * jump to the next second precisely 500 ms later. Check the Motorola + * MC146818A or Dallas DS12887 data sheet for details. + * + * BUG: This routine does not handle hour overflow properly; it just + * sets the minutes. Usually you won't notice until after reboot! + */ +static __inline__ int set_rtc_mmss(unsigned long nowtime) +{ + return 0; +} + +/* last time the cmos clock got updated */ +static long last_rtc_update = 0; + +/* + * timer_interrupt() needs to keep up the real-time clock, + * as well as call the "do_timer()" routine every clocktick + */ +static __inline__ void do_timer_interrupt(int irq, void *dev_id, + struct pt_regs * regs) +{ + do_timer(regs); + + /* + * If we have an externally synchronized Linux clock, then update + * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be + * called as close as possible to 500 ms before the new second starts. + */ + if ((time_status & STA_UNSYNC) == 0 + && xtime.tv_sec > last_rtc_update + 660 + && (xtime.tv_nsec / 1000) >= 500000 - ((unsigned)TICK_SIZE) / 2 + && (xtime.tv_nsec / 1000) <= 500000 + ((unsigned)TICK_SIZE) / 2) + { + if (set_rtc_mmss(xtime.tv_sec) == 0) + last_rtc_update = xtime.tv_sec; + else /* do it again in 60 s */ + last_rtc_update = xtime.tv_sec - 600; + } + /* As we return to user mode fire off the other CPU schedulers.. + this is basically because we don't yet share IRQ's around. + This message is rigged to be safe on the 386 - basically it's + a hack, so don't look closely for now.. */ + +#ifdef CONFIG_SMP + smp_local_timer_interrupt(regs); +#endif +} + +irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) +{ + write_seqlock(&xtime_lock); + do_timer_interrupt(irq, NULL, regs); + write_sequnlock(&xtime_lock); + +#ifndef CONFIG_SMP + profile_tick(CPU_PROFILING, regs); +#endif + + return IRQ_HANDLED; +} + +struct irqaction irq0 = { timer_interrupt, SA_INTERRUPT, CPU_MASK_NONE, + "MFT2", NULL, NULL }; + +void __init time_init(void) +{ + unsigned int epoch, year, mon, day, hour, min, sec; + + sec = min = hour = day = mon = year = 0; + epoch = 0; + + year = 23; + mon = 4; + day = 17; + + /* Attempt to guess the epoch. This is the same heuristic as in rtc.c + so no stupid things will happen to timekeeping. Who knows, maybe + Ultrix also uses 1952 as epoch ... */ + if (year > 10 && year < 44) + epoch = 1980; + else if (year < 96) + epoch = 1952; + year += epoch; + + xtime.tv_sec = mktime(year, mon, day, hour, min, sec); + xtime.tv_nsec = (INITIAL_JIFFIES % HZ) * (NSEC_PER_SEC / HZ); + wall_to_monotonic.tv_sec = -xtime.tv_sec; + wall_to_monotonic.tv_nsec = -xtime.tv_nsec; + +#if defined(CONFIG_CHIP_M32102) || defined(CONFIG_CHIP_XNUX2) \ + || defined(CONFIG_CHIP_VDEC2) || defined(CONFIG_CHIP_M32700) \ + || defined(CONFIG_CHIP_OPSP) + + /* M32102 MFT setup */ + setup_irq(M32R_IRQ_MFT2, &irq0); + { + unsigned long bus_clock; + unsigned short divide; + + bus_clock = boot_cpu_data.bus_clock; + divide = boot_cpu_data.timer_divide; + latch = (bus_clock/divide + HZ / 2) / HZ; + + printk("Timer start : latch = %ld\n", latch); + + outl((M32R_MFTMOD_CC_MASK | M32R_MFTMOD_TCCR \ + |M32R_MFTMOD_CSSEL011), M32R_MFT2MOD_PORTL); + outl(latch, M32R_MFT2RLD_PORTL); + outl(latch, M32R_MFT2CUT_PORTL); + outl(0, M32R_MFT2CMPRLD_PORTL); + outl((M32R_MFTCR_MFT2MSK|M32R_MFTCR_MFT2EN), M32R_MFTCR_PORTL); + } + +#elif defined(CONFIG_CHIP_M32310) +#warning time_init not implemented +#else +#error no chip configuration +#endif +} + +/* + * Scheduler clock - returns current time in nanosec units. + */ +unsigned long long sched_clock(void) +{ + return (unsigned long long)jiffies * (1000000000 / HZ); +} + diff -Nru a/arch/m32r/kernel/traps.c b/arch/m32r/kernel/traps.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/traps.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,330 @@ +/* + * linux/arch/m32r/kernel/traps.c + * + * Copyright (C) 2001, 2002 Hirokazu Takata, Hiroyuki Kondo, + * Hitoshi Yamamoto + */ + +/* $Id$ */ + +/* + * 'traps.c' handles hardware traps and faults after we have saved some + * state in 'entry.S'. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include + +asmlinkage void alignment_check(void); +asmlinkage void ei_handler(void); +asmlinkage void rie_handler(void); +asmlinkage void debug_trap(void); +asmlinkage void cache_flushing_handler(void); + +#ifdef CONFIG_SMP +extern void smp_reschedule_interrupt(void); +extern void smp_invalidate_interrupt(void); +extern void smp_call_function_interrupt(void); +extern void smp_ipi_timer_interrupt(void); +extern void smp_flush_cache_all_interrupt(void); + +/* + * for Boot AP function + */ +asm ( + " .section .eit_vector4,\"ax\" \n" + " .global _AP_RE \n" + " .global startup_AP \n" + "_AP_RE: \n" + " .fill 32, 4, 0 \n" + "_AP_EI: bra startup_AP \n" + " .previous \n" +); +#endif /* CONFIG_SMP */ + +extern unsigned long eit_vector[]; +#define BRA_INSN(func, entry) \ + ((unsigned long)func - (unsigned long)eit_vector - entry*4)/4 \ + + 0xff000000UL + +void set_eit_vector_entries(void) +{ + extern void default_eit_handler(void); + extern void system_call(void); + extern void pie_handler(void); + extern void ace_handler(void); + extern void tme_handler(void); + extern void _flush_cache_copyback_all(void); + + eit_vector[0] = 0xd0c00001; /* seth r0, 0x01 */ + eit_vector[1] = BRA_INSN(default_eit_handler, 1); + eit_vector[4] = 0xd0c00010; /* seth r0, 0x10 */ + eit_vector[5] = BRA_INSN(default_eit_handler, 5); + eit_vector[8] = BRA_INSN(rie_handler, 8); + eit_vector[12] = BRA_INSN(alignment_check, 12); + eit_vector[16] = 0xff000000UL; + eit_vector[17] = BRA_INSN(debug_trap, 17); + eit_vector[18] = BRA_INSN(system_call, 18); + eit_vector[19] = 0xff000000UL; + eit_vector[20] = 0xff000000UL; + eit_vector[21] = 0xff000000UL; + eit_vector[22] = 0xff000000UL; + eit_vector[23] = 0xff000000UL; + eit_vector[24] = 0xff000000UL; + eit_vector[25] = 0xff000000UL; + eit_vector[26] = 0xff000000UL; + eit_vector[27] = 0xff000000UL; + eit_vector[28] = BRA_INSN(cache_flushing_handler, 28); + eit_vector[29] = 0xff000000UL; + eit_vector[30] = 0xff000000UL; + eit_vector[31] = 0xff000000UL; + eit_vector[32] = BRA_INSN(ei_handler, 32); + eit_vector[64] = BRA_INSN(pie_handler, 64); + eit_vector[68] = BRA_INSN(ace_handler, 68); + eit_vector[72] = BRA_INSN(tme_handler, 72); +#ifdef CONFIG_SMP + eit_vector[184] = (unsigned long)smp_reschedule_interrupt; + eit_vector[185] = (unsigned long)smp_invalidate_interrupt; + eit_vector[186] = (unsigned long)smp_call_function_interrupt; + eit_vector[187] = (unsigned long)smp_ipi_timer_interrupt; + eit_vector[188] = (unsigned long)smp_flush_cache_all_interrupt; + eit_vector[189] = 0; + eit_vector[190] = 0; + eit_vector[191] = 0; +#endif + _flush_cache_copyback_all(); +} + +void __init trap_init(void) +{ + set_eit_vector_entries(); + + /* + * Should be a barrier for any external CPU state. + */ + cpu_init(); +} + +int kstack_depth_to_print = 24; + +void show_trace(struct task_struct *task, unsigned long *stack) +{ + unsigned long addr; + + if (!stack) + stack = (unsigned long*)&stack; + + printk("Call Trace: "); + while (!kstack_end(stack)) { + addr = *stack++; + if (__kernel_text_address(addr)) { + printk("[<%08lx>] ", addr); + print_symbol("%s\n", addr); + } + } + printk("\n"); +} + +void show_stack(struct task_struct *task, unsigned long *sp) +{ + unsigned long *stack; + int i; + + /* + * debugging aid: "show_stack(NULL);" prints the + * back trace for this cpu. + */ + + if(sp==NULL) { + if (task) + sp = (unsigned long *)task->thread.sp; + else + sp=(unsigned long*)&sp; + } + + stack = sp; + for(i=0; i < kstack_depth_to_print; i++) { + if (kstack_end(stack)) + break; + if (i && ((i % 4) == 0)) + printk("\n "); + printk("%08lx ", *stack++); + } + printk("\n"); + show_trace(task, sp); +} + +void dump_stack(void) +{ + unsigned long stack; + + show_trace(current, &stack); +} + +EXPORT_SYMBOL(dump_stack); + +static void show_registers(struct pt_regs *regs) +{ + int i = 0; + int in_kernel = 1; + unsigned long sp; + + printk("CPU: %d\n", smp_processor_id()); + show_regs(regs); + + sp = (unsigned long) (1+regs); + if (user_mode(regs)) { + in_kernel = 0; + sp = regs->spu; + printk("SPU: %08lx\n", sp); + } else { + printk("SPI: %08lx\n", sp); + } + printk("Process %s (pid: %d, process nr: %d, stackpage=%08lx)", + current->comm, current->pid, 0xffff & i, 4096+(unsigned long)current); + + /* + * When in-kernel, we also print out the stack and code at the + * time of the fault.. + */ + if (in_kernel) { + printk("\nStack: "); + show_stack(current, (unsigned long*) sp); + + printk("\nCode: "); + if (regs->bpc < PAGE_OFFSET) + goto bad; + + for(i=0;i<20;i++) { + unsigned char c; + if (__get_user(c, &((unsigned char*)regs->bpc)[i])) { +bad: + printk(" Bad PC value."); + break; + } + printk("%02x ", c); + } + } + printk("\n"); +} + +spinlock_t die_lock = SPIN_LOCK_UNLOCKED; + +void die(const char * str, struct pt_regs * regs, long err) +{ + console_verbose(); + spin_lock_irq(&die_lock); + bust_spinlocks(1); + printk("%s: %04lx\n", str, err & 0xffff); + show_registers(regs); + bust_spinlocks(0); + spin_unlock_irq(&die_lock); + do_exit(SIGSEGV); +} + +static __inline__ void die_if_kernel(const char * str, + struct pt_regs * regs, long err) +{ + if (!user_mode(regs)) + die(str, regs, err); +} + +static __inline__ void do_trap(int trapnr, int signr, const char * str, + struct pt_regs * regs, long error_code, siginfo_t *info) +{ + if (user_mode(regs)) { + /* trap_signal */ + struct task_struct *tsk = current; + tsk->thread.error_code = error_code; + tsk->thread.trap_no = trapnr; + if (info) + force_sig_info(signr, info, tsk); + else + force_sig(signr, tsk); + return; + } else { + /* kernel_trap */ + if (!fixup_exception(regs)) + die(str, regs, error_code); + return; + } +} + +#define DO_ERROR(trapnr, signr, str, name) \ +asmlinkage void do_##name(struct pt_regs * regs, long error_code) \ +{ \ + do_trap(trapnr, signr, 0, regs, error_code, NULL); \ +} + +#define DO_ERROR_INFO(trapnr, signr, str, name, sicode, siaddr) \ +asmlinkage void do_##name(struct pt_regs * regs, long error_code) \ +{ \ + siginfo_t info; \ + info.si_signo = signr; \ + info.si_errno = 0; \ + info.si_code = sicode; \ + info.si_addr = (void __user *)siaddr; \ + do_trap(trapnr, signr, str, regs, error_code, &info); \ +} + +DO_ERROR( 1, SIGTRAP, "debug trap", debug_trap) +DO_ERROR_INFO(0x20, SIGILL, "reserved instruction ", rie_handler, ILL_ILLOPC, regs->bpc) +DO_ERROR_INFO(0x100, SIGILL, "privilege instruction", pie_handler, ILL_PRVOPC, regs->bpc) + +extern int handle_unaligned_access(unsigned long, struct pt_regs *); + +/* This code taken from arch/sh/kernel/traps.c */ +asmlinkage void do_alignment_check(struct pt_regs *regs, long error_code) +{ + mm_segment_t oldfs; + unsigned long insn; + int tmp; + + oldfs = get_fs(); + + if (user_mode(regs)) { + local_irq_enable(); + current->thread.error_code = error_code; + current->thread.trap_no = 0x17; + + set_fs(USER_DS); + if (copy_from_user(&insn, (void *)regs->bpc, 4)) { + set_fs(oldfs); + goto uspace_segv; + } + tmp = handle_unaligned_access(insn, regs); + set_fs(oldfs); + + if (!tmp) + return; + + uspace_segv: + printk(KERN_NOTICE "Killing process \"%s\" due to unaligned " + "access\n", current->comm); + force_sig(SIGSEGV, current); + } else { + set_fs(KERNEL_DS); + if (copy_from_user(&insn, (void *)regs->bpc, 4)) { + set_fs(oldfs); + die("insn faulting in do_address_error", regs, 0); + } + handle_unaligned_access(insn, regs); + set_fs(oldfs); + } +} + diff -Nru a/arch/m32r/kernel/vmlinux.lds.S b/arch/m32r/kernel/vmlinux.lds.S --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/kernel/vmlinux.lds.S 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,143 @@ +/* ld script to make M32R Linux kernel + */ + +#include +#include +#include +#include + +OUTPUT_ARCH(m32r) +ENTRY(startup_32) +#if defined(__LITTLE_ENDIAN__) + jiffies = jiffies_64; +#else + jiffies = jiffies_64 + 4; +#endif +SECTIONS +{ + . = CONFIG_MEMORY_START + __PAGE_OFFSET; + eit_vector = .; + + . = . + 0x1000; + .empty_zero_page : { *(.empty_zero_page) } = 0 + + /* read-only */ + _text = .; /* Text and read-only data */ + .boot : { *(.boot) } = 0 + .text : { + *(.text) + SCHED_TEXT + LOCK_TEXT + *(.fixup) + *(.gnu.warning) + } = 0x9090 +#ifdef CONFIG_SMP + . = ALIGN(65536); + .eit_vector4 : { *(.eit_vector4) } +#endif + _etext = .; /* End of text section */ + + . = ALIGN(16); /* Exception table */ + __start___ex_table = .; + __ex_table : { *(__ex_table) } + __stop___ex_table = .; + + RODATA + + /* writeable */ + .data : { /* Data */ + *(.spu) + *(.spi) + *(.data) + CONSTRUCTORS + } + + . = ALIGN(4096); + __nosave_begin = .; + .data_nosave : { *(.data.nosave) } + . = ALIGN(4096); + __nosave_end = .; + + . = ALIGN(4096); + .data.page_aligned : { *(.data.idt) } + + . = ALIGN(32); + .data.cacheline_aligned : { *(.data.cacheline_aligned) } + + _edata = .; /* End of data section */ + + . = ALIGN(8192); /* init_task */ + .data.init_task : { *(.data.init_task) } + + /* will be freed after init */ + . = ALIGN(4096); /* Init code and data */ + __init_begin = .; + .init.text : { + _sinittext = .; + *(.init.text) + _einittext = .; + } + .init.data : { *(.init.data) } + . = ALIGN(16); + __setup_start = .; + .init.setup : { *(.init.setup) } + __setup_end = .; + __initcall_start = .; + .initcall.init : { + *(.initcall1.init) + *(.initcall2.init) + *(.initcall3.init) + *(.initcall4.init) + *(.initcall5.init) + *(.initcall6.init) + *(.initcall7.init) + } + __initcall_end = .; + __con_initcall_start = .; + .con_initcall.init : { *(.con_initcall.init) } + __con_initcall_end = .; + SECURITY_INIT + . = ALIGN(4); + __alt_instructions = .; + .altinstructions : { *(.altinstructions) } + __alt_instructions_end = .; + .altinstr_replacement : { *(.altinstr_replacement) } + /* .exit.text is discard at runtime, not link time, to deal with references + from .altinstructions and .eh_frame */ + .exit.text : { *(.exit.text) } + .exit.data : { *(.exit.data) } + . = ALIGN(4096); + __initramfs_start = .; + .init.ramfs : { *(.init.ramfs) } + __initramfs_end = .; + . = ALIGN(32); + __per_cpu_start = .; + .data.percpu : { *(.data.percpu) } + __per_cpu_end = .; + . = ALIGN(4096); + __init_end = .; + /* freed after init ends here */ + + __bss_start = .; /* BSS */ + .bss : { *(.bss) } + . = ALIGN(4); + __bss_stop = .; + + _end = . ; + + /* Sections to be discarded */ + /DISCARD/ : { + *(.exit.text) + *(.exit.data) + *(.exitcall.exit) + } + + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } +} diff -Nru a/arch/m32r/lib/Makefile b/arch/m32r/lib/Makefile --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/lib/Makefile 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,7 @@ +# +# Makefile for M32R-specific library files.. +# + +lib-y := checksum.o ashxdi3.o memset.o memcpy.o getuser.o \ + putuser.o delay.o strlen.o usercopy.o csum_partial_copy.o + diff -Nru a/arch/m32r/lib/ashxdi3.S b/arch/m32r/lib/ashxdi3.S --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/lib/ashxdi3.S 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,297 @@ +/* + * linux/arch/m32r/lib/ashxdi3.S + * + * Copyright (C) 2001,2002 Hiroyuki Kondo, and Hirokazu Takata + * + */ +/* $Id$ */ + +#include + +; +; input (r0,r1) src +; input r2 shift val +; r3 scratch +; output (r0,r1) +; + +#ifdef CONFIG_ISA_DUAL_ISSUE + +#ifndef __LITTLE_ENDIAN__ + + .text + .align 4 + .globl __ashrdi3 +__ashrdi3: + cmpz r2 || ldi r3, #32 + jc r14 || cmpu r2, r3 + bc 1f + ; case 32 =< shift + mv r1, r0 || srai r0, #31 + addi r2, #-32 + sra r1, r2 + jmp r14 + .fillinsn +1: ; case shift <32 + mv r3, r0 || srl r1, r2 + sra r0, r2 || neg r2, r2 + sll r3, r2 + or r1, r3 || jmp r14 + + .align 4 + .globl __ashldi3 + .globl __lshldi3 +__ashldi3: +__lshldi3: + cmpz r2 || ldi r3, #32 + jc r14 || cmpu r2, r3 + bc 1f + ; case 32 =< shift + mv r0, r1 || addi r2, #-32 + sll r0, r2 || ldi r1, #0 + jmp r14 + .fillinsn +1: ; case shift <32 + mv r3, r1 || sll r0, r2 + sll r1, r2 || neg r2, r2 + srl r3, r2 + or r0, r3 || jmp r14 + + .align 4 + .globl __lshrdi3 +__lshrdi3: + cmpz r2 || ldi r3, #32 + jc r14 || cmpu r2, r3 + bc 1f + ; case 32 =< shift + mv r1, r0 || addi r2, #-32 + ldi r0, #0 || srl r1, r2 + jmp r14 + .fillinsn +1: ; case shift <32 + mv r3, r0 || srl r1, r2 + srl r0, r2 || neg r2, r2 + sll r3, r2 + or r1, r3 || jmp r14 + +#else /* LITTLE_ENDIAN */ + + .text + .align 4 + .globl __ashrdi3 +__ashrdi3: + cmpz r2 || ldi r3, #32 + jc r14 || cmpu r2, r3 + bc 1f + ; case 32 =< shift + mv r0, r1 || srai r1, #31 + addi r2, #-32 + sra r0, r2 + jmp r14 + .fillinsn +1: ; case shift <32 + mv r3, r1 || srl r0, r2 + sra r1, r2 || neg r2, r2 + sll r3, r2 + or r0, r3 || jmp r14 + + .align 4 + .globl __ashldi3 + .globl __lshldi3 +__ashldi3: +__lshldi3: + cmpz r2 || ldi r3, #32 + jc r14 || cmpu r2, r3 + bc 1f + ; case 32 =< shift + mv r1, r0 || addi r2, #-32 + sll r1, r2 || ldi r0, #0 + jmp r14 + .fillinsn +1: ; case shift <32 + mv r3, r0 || sll r1, r2 + sll r0, r2 || neg r2, r2 + srl r3, r2 + or r1, r3 || jmp r14 + + .align 4 + .globl __lshrdi3 +__lshrdi3: + cmpz r2 || ldi r3, #32 + jc r14 || cmpu r2, r3 + bc 1f + ; case 32 =< shift + mv r0, r1 || addi r2, #-32 + ldi r1, #0 || srl r0, r2 + jmp r14 + .fillinsn +1: ; case shift <32 + mv r3, r1 || srl r0, r2 + srl r1, r2 || neg r2, r2 + sll r3, r2 + or r0, r3 || jmp r14 + +#endif + +#else /* not CONFIG_ISA_DUAL_ISSUE */ + +#ifndef __LITTLE_ENDIAN__ + + .text + .align 4 + .globl __ashrdi3 +__ashrdi3: + beqz r2, 2f + cmpui r2, #32 + bc 1f + ; case 32 =< shift + mv r1, r0 + srai r0, #31 + addi r2, #-32 + sra r1, r2 + jmp r14 + .fillinsn +1: ; case shift <32 + mv r3, r0 + srl r1, r2 + sra r0, r2 + neg r2, r2 + sll r3, r2 + or r1, r3 + .fillinsn +2: + jmp r14 + + .align 4 + .globl __ashldi3 + .globl __lshldi3 +__ashldi3: +__lshldi3: + beqz r2, 2f + cmpui r2, #32 + bc 1f + ; case 32 =< shift + mv r0, r1 + addi r2, #-32 + sll r0, r2 + ldi r1, #0 + jmp r14 + .fillinsn +1: ; case shift <32 + mv r3, r1 + sll r0, r2 + sll r1, r2 + neg r2, r2 + srl r3, r2 + or r0, r3 + .fillinsn +2: + jmp r14 + + .align 4 + .globl __lshrdi3 +__lshrdi3: + beqz r2, 2f + cmpui r2, #32 + bc 1f + ; case 32 =< shift + mv r1, r0 + ldi r0, #0 + addi r2, #-32 + srl r1, r2 + jmp r14 + .fillinsn +1: ; case shift <32 + mv r3, r0 + srl r1, r2 + srl r0, r2 + neg r2, r2 + sll r3, r2 + or r1, r3 + .fillinsn +2: + jmp r14 + +#else + + .text + .align 4 + .globl __ashrdi3 +__ashrdi3: + beqz r2, 2f + cmpui r2, #32 + bc 1f + ; case 32 =< shift + mv r0, r1 + srai r1, #31 + addi r2, #-32 + sra r0, r2 + jmp r14 + .fillinsn +1: ; case shift <32 + mv r3, r1 + srl r0, r2 + sra r1, r2 + neg r2, r2 + sll r3, r2 + or r0, r3 + .fillinsn +2: + jmp r14 + + .align 4 + .globl __ashldi3 + .globl __lshldi3 +__ashldi3: +__lshldi3: + beqz r2, 2f + cmpui r2, #32 + bc 1f + ; case 32 =< shift + mv r1, r0 + addi r2, #-32 + sll r1, r2 + ldi r0, #0 + jmp r14 + .fillinsn +1: ; case shift <32 + mv r3, r0 + sll r1, r2 + sll r0, r2 + neg r2, r2 + srl r3, r2 + or r1, r3 + .fillinsn +2: + jmp r14 + + .align 4 + .globl __lshrdi3 +__lshrdi3: + beqz r2, 2f + cmpui r2, #32 + bc 1f + ; case 32 =< shift + mv r0, r1 + ldi r1, #0 + addi r2, #-32 + srl r0, r2 + jmp r14 + .fillinsn +1: ; case shift <32 + mv r3, r1 + srl r0, r2 + srl r1, r2 + neg r2, r2 + sll r3, r2 + or r0, r3 + .fillinsn +2: + jmp r14 + +#endif + +#endif /* not CONFIG_ISA_DUAL_ISSUE */ + + .end + diff -Nru a/arch/m32r/lib/checksum.S b/arch/m32r/lib/checksum.S --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/lib/checksum.S 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,322 @@ +/* + * INET An implementation of the TCP/IP protocol suite for the LINUX + * operating system. INET is implemented using the BSD Socket + * interface as the means of communication with the user level. + * + * IP/TCP/UDP checksumming routines + * + * Authors: Jorge Cwik, + * Arnt Gulbrandsen, + * Tom May, + * Pentium Pro/II routines: + * Alexander Kjeldaas + * Finn Arne Gangstad + * Lots of code moved from tcp.c and ip.c; see those files + * for more names. + * + * Changes: Ingo Molnar, converted csum_partial_copy() to 2.1 exception + * handling. + * Andi Kleen, add zeroing on error + * converted to pure assembler + * Hirokazu Takata,Hiroyuki Kondo rewrite for the m32r architecture. + * + * 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. + */ +/* $Id$ */ + + +#include +#include +#include +#include + +/* + * computes a partial checksum, e.g. for TCP/UDP fragments + */ + +/* +unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum) + */ + + +#ifdef CONFIG_ISA_DUAL_ISSUE + + /* + * Experiments with Ethernet and SLIP connections show that buff + * is aligned on either a 2-byte or 4-byte boundary. We get at + * least a twofold speedup on 486 and Pentium if it is 4-byte aligned. + * Fortunately, it is easy to convert 2-byte alignment to 4-byte + * alignment for the unrolled loop. + */ + + .text +ENTRY(csum_partial) + ; Function args + ; r0: unsigned char *buff + ; r1: int len + ; r2: unsigned int sum + + push r2 || ldi r2, #0 + and3 r7, r0, #1 ; Check alignment. + beqz r7, 1f ; Jump if alignment is ok. + ; 1-byte mis aligned + ldub r4, @r0 || addi r0, #1 + ; clear c-bit || Alignment uses up bytes. + cmp r0, r0 || addi r1, #-1 + ldi r3, #0 || addx r2, r4 + addx r2, r3 + .fillinsn +1: + and3 r4, r0, #2 ; Check alignment. + beqz r4, 2f ; Jump if alignment is ok. + ; clear c-bit || Alignment uses up two bytes. + cmp r0, r0 || addi r1, #-2 + bgtz r1, 1f ; Jump if we had at least two bytes. + bra 4f || addi r1, #2 + .fillinsn ; len(r1) was < 2. Deal with it. +1: + ; 2-byte aligned + lduh r4, @r0 || ldi r3, #0 + addx r2, r4 || addi r0, #2 + addx r2, r3 + .fillinsn +2: + ; 4-byte aligned + cmp r0, r0 ; clear c-bit + srl3 r6, r1, #5 + beqz r6, 2f + .fillinsn + +1: ld r3, @r0+ + ld r4, @r0+ ; +4 + ld r5, @r0+ ; +8 + ld r3, @r0+ || addx r2, r3 ; +12 + ld r4, @r0+ || addx r2, r4 ; +16 + ld r5, @r0+ || addx r2, r5 ; +20 + ld r3, @r0+ || addx r2, r3 ; +24 + ld r4, @r0+ || addx r2, r4 ; +28 + addx r2, r5 || addi r6, #-1 + addx r2, r3 + addx r2, r4 + bnez r6, 1b + + addx r2, r6 ; r6=0 + cmp r0, r0 ; This clears c-bit + .fillinsn +2: and3 r6, r1, #0x1c ; withdraw len + beqz r6, 4f + srli r6, #2 + .fillinsn + +3: ld r4, @r0+ || addi r6, #-1 + addx r2, r4 + bnez r6, 3b + + addx r2, r6 ; r6=0 + cmp r0, r0 ; This clears c-bit + .fillinsn +4: and3 r1, r1, #3 + beqz r1, 7f ; if len == 0 goto end + and3 r6, r1, #2 + beqz r6, 5f ; if len < 2 goto 5f(1byte) + lduh r4, @r0 || addi r0, #2 + addi r1, #-2 || slli r4, #16 + addx r2, r4 + beqz r1, 6f + .fillinsn +5: ldub r4, @r0 || ldi r1, #0 +#ifndef __LITTLE_ENDIAN__ + slli r4, #8 +#endif + addx r2, r4 + .fillinsn +6: addx r2, r1 + .fillinsn +7: + and3 r0, r2, #0xffff + srli r2, #16 + add r0, r2 + srl3 r2, r0, #16 + beqz r2, 1f + addi r0, #1 + and3 r0, r0, #0xffff + .fillinsn +1: + beqz r7, 1f ; swap the upper byte for the lower + and3 r2, r0, #0xff + srl3 r0, r0, #8 + slli r2, #8 + or r0, r2 + .fillinsn +1: + pop r2 || cmp r0, r0 + addx r0, r2 || ldi r2, #0 + addx r0, r2 + jmp r14 + +#else /* not CONFIG_ISA_DUAL_ISSUE */ + + /* + * Experiments with Ethernet and SLIP connections show that buff + * is aligned on either a 2-byte or 4-byte boundary. We get at + * least a twofold speedup on 486 and Pentium if it is 4-byte aligned. + * Fortunately, it is easy to convert 2-byte alignment to 4-byte + * alignment for the unrolled loop. + */ + + .text +ENTRY(csum_partial) + ; Function args + ; r0: unsigned char *buff + ; r1: int len + ; r2: unsigned int sum + + push r2 + ldi r2, #0 + and3 r7, r0, #1 ; Check alignment. + beqz r7, 1f ; Jump if alignment is ok. + ; 1-byte mis aligned + ldub r4, @r0 + addi r0, #1 + addi r1, #-1 ; Alignment uses up bytes. + cmp r0, r0 ; clear c-bit + ldi r3, #0 + addx r2, r4 + addx r2, r3 + .fillinsn +1: + and3 r4, r0, #2 ; Check alignment. + beqz r4, 2f ; Jump if alignment is ok. + addi r1, #-2 ; Alignment uses up two bytes. + cmp r0, r0 ; clear c-bit + bgtz r1, 1f ; Jump if we had at least two bytes. + addi r1, #2 ; len(r1) was < 2. Deal with it. + bra 4f + .fillinsn +1: + ; 2-byte aligned + lduh r4, @r0 + addi r0, #2 + ldi r3, #0 + addx r2, r4 + addx r2, r3 + .fillinsn +2: + ; 4-byte aligned + cmp r0, r0 ; clear c-bit + srl3 r6, r1, #5 + beqz r6, 2f + .fillinsn + +1: ld r3, @r0+ + ld r4, @r0+ ; +4 + ld r5, @r0+ ; +8 + addx r2, r3 + addx r2, r4 + addx r2, r5 + ld r3, @r0+ ; +12 + ld r4, @r0+ ; +16 + ld r5, @r0+ ; +20 + addx r2, r3 + addx r2, r4 + addx r2, r5 + ld r3, @r0+ ; +24 + ld r4, @r0+ ; +28 + addi r6, #-1 + addx r2, r3 + addx r2, r4 + bnez r6, 1b + addx r2, r6 ; r6=0 + cmp r0, r0 ; This clears c-bit + .fillinsn + +2: and3 r6, r1, #0x1c ; withdraw len + beqz r6, 4f + srli r6, #2 + .fillinsn + +3: ld r4, @r0+ + addi r6, #-1 + addx r2, r4 + bnez r6, 3b + addx r2, r6 ; r6=0 + cmp r0, r0 ; This clears c-bit + .fillinsn + +4: and3 r1, r1, #3 + beqz r1, 7f ; if len == 0 goto end + and3 r6, r1, #2 + beqz r6, 5f ; if len < 2 goto 5f(1byte) + + lduh r4, @r0 + addi r0, #2 + addi r1, #-2 + slli r4, #16 + addx r2, r4 + beqz r1, 6f + .fillinsn +5: ldub r4, @r0 +#ifndef __LITTLE_ENDIAN__ + slli r4, #8 +#endif + addx r2, r4 + .fillinsn +6: ldi r5, #0 + addx r2, r5 + .fillinsn +7: + and3 r0, r2, #0xffff + srli r2, #16 + add r0, r2 + srl3 r2, r0, #16 + beqz r2, 1f + addi r0, #1 + and3 r0, r0, #0xffff + .fillinsn +1: + beqz r7, 1f + mv r2, r0 + srl3 r0, r2, #8 + and3 r2, r2, #0xff + slli r2, #8 + or r0, r2 + .fillinsn +1: + pop r2 + cmp r0, r0 + addx r0, r2 + ldi r2, #0 + addx r0, r2 + jmp r14 + +#endif /* not CONFIG_ISA_DUAL_ISSUE */ + +/* +unsigned int csum_partial_copy_generic (const char *src, char *dst, + int len, int sum, int *src_err_ptr, int *dst_err_ptr) + */ + +/* + * Copy from ds while checksumming, otherwise like csum_partial + * + * The macros SRC and DST specify the type of access for the instruction. + * thus we can call a custom exception handler for all access types. + * + * FIXME: could someone double-check whether I haven't mixed up some SRC and + * DST definitions? It's damn hard to trigger all cases. I hope I got + * them all but there's no guarantee. + */ + +ENTRY(csum_partial_copy_generic) + nop + nop + nop + nop + jmp r14 + nop + nop + nop + diff -Nru a/arch/m32r/lib/csum_partial_copy.c b/arch/m32r/lib/csum_partial_copy.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/lib/csum_partial_copy.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,58 @@ +/* + * INET An implementation of the TCP/IP protocol suite for the LINUX + * operating system. INET is implemented using the BSD Socket + * interface as the means of communication with the user level. + * + * MIPS specific IP/TCP/UDP checksumming routines + * + * Authors: Ralf Baechle, + * Lots of code moved from tcp.c and ip.c; see those files + * for more names. + * + * 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 + +#include +#include +#include +#include + +/* + * Copy while checksumming, otherwise like csum_partial + */ +unsigned int csum_partial_copy_nocheck (const char *src, char *dst, + int len, unsigned int sum) +{ + sum = csum_partial(src, len, sum); + memcpy(dst, src, len); + + return sum; +} +EXPORT_SYMBOL(csum_partial_copy_nocheck); + +/* + * Copy from userspace and compute checksum. If we catch an exception + * then zero the rest of the buffer. + */ +unsigned int csum_partial_copy_from_user (const char __user *src, char *dst, + int len, unsigned int sum, + int *err_ptr) +{ + int missing; + + missing = copy_from_user(dst, src, len); + if (missing) { + memset(dst + len - missing, 0, missing); + *err_ptr = -EFAULT; + } + + return csum_partial(dst, len-missing, sum); +} +EXPORT_SYMBOL(csum_partial_copy_from_user); diff -Nru a/arch/m32r/lib/delay.c b/arch/m32r/lib/delay.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/lib/delay.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,126 @@ +/* + * linux/arch/m32r/lib/delay.c + * + * Copyright (c) 2002 Hitoshi Yamamoto, Hirokazu Takata + * Copyright (c) 2004 Hirokazu Takata + */ + +/* $Id$ */ + +#include +#include +#ifdef CONFIG_SMP +#include +#include +#include +#endif /* CONFIG_SMP */ +#include + +void __delay(unsigned long loops) +{ +#ifdef CONFIG_ISA_DUAL_ISSUE + __asm__ __volatile__ ( + "beqz %0, 2f \n\t" + "addi %0, #-1 \n\t" + + " .fillinsn \n\t" + "1: \n\t" + "cmpz %0 || addi %0, #-1 \n\t" + "bc 2f || cmpz %0 \n\t" + "bc 2f || addi %0, #-1 \n\t" + "cmpz %0 || addi %0, #-1 \n\t" + "bc 2f || cmpz %0 \n\t" + "bnc 1b || addi %0, #-1 \n\t" + " .fillinsn \n\t" + "2: \n\t" + : "+r" (loops) + : "r" (0) + : "cbit" + ); +#else + __asm__ __volatile__ ( + "beqz %0, 2f \n\t" + " .fillinsn \n\t" + "1: \n\t" + "addi %0, #-1 \n\t" + "blez %0, 2f \n\t" + "addi %0, #-1 \n\t" + "blez %0, 2f \n\t" + "addi %0, #-1 \n\t" + "blez %0, 2f \n\t" + "addi %0, #-1 \n\t" + "bgtz %0, 1b \n\t" + " .fillinsn \n\t" + "2:i \n\t" + : "+r" (loops) + : "r" (0) + ); +#endif +} + +void __const_udelay(unsigned long xloops) +{ +#if defined(CONFIG_ISA_M32R2) && defined(CONFIG_ISA_DSP_LEVEL2) + /* + * loops [1] = (xloops >> 32) [sec] * loops_per_jiffy [1/jiffy] + * * HZ [jiffy/sec] + * = (xloops >> 32) [sec] * (loops_per_jiffy * HZ) [1/sec] + * = (((xloops * loops_per_jiffy) >> 32) * HZ) [1] + * + * NOTE: + * - '[]' depicts variable's dimension in the above equation. + * - "rac" instruction rounds the accumulator in word size. + */ + __asm__ __volatile__ ( + "srli %0, #1 \n\t" + "mulwhi %0, %1 ; a0 \n\t" + "mulwu1 %0, %1 ; a1 \n\t" + "sadd ; a0 += (a1 >> 16) \n\t" + "rac a0, a0, #1 \n\t" + "mvfacmi %0, a0 \n\t" + : "+r" (xloops) + : "r" (current_cpu_data.loops_per_jiffy) + : "a0", "a1" + ); +#elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R) + /* + * u64 ull; + * ull = (u64)xloops * (u64)current_cpu_data.loops_per_jiffy; + * xloops = (ull >> 32); + */ + __asm__ __volatile__ ( + "and3 r4, %0, #0xffff \n\t" + "and3 r5, %1, #0xffff \n\t" + "mul r4, r5 \n\t" + "srl3 r6, %0, #16 \n\t" + "srli r4, #16 \n\t" + "mul r5, r6 \n\t" + "add r4, r5 \n\t" + "and3 r5, %0, #0xffff \n\t" + "srl3 r6, %1, #16 \n\t" + "mul r5, r6 \n\t" + "add r4, r5 \n\t" + "srl3 r5, %0, #16 \n\t" + "srli r4, #16 \n\t" + "mul r5, r6 \n\t" + "add r4, r5 \n\t" + "mv %0, r4 \n\t" + : "+r" (xloops) + : "r" (current_cpu_data.loops_per_jiffy) + : "r4", "r5", "r6" + ); +#else +#error unknown isa configuration +#endif + __delay(xloops * HZ); +} + +void __udelay(unsigned long usecs) +{ + __const_udelay(usecs * 0x000010c7); /* 2**32 / 1000000 (rounded up) */ +} + +void __ndelay(unsigned long nsecs) +{ + __const_udelay(nsecs * 0x00005); /* 2**32 / 1000000000 (rounded up) */ +} diff -Nru a/arch/m32r/lib/getuser.S b/arch/m32r/lib/getuser.S --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/lib/getuser.S 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,88 @@ +/* + * __get_user functions. + * + * (C) Copyright 2001 Hirokazu Takata + * + * These functions have a non-standard call interface + * to make them more efficient, especially as they + * return an error value in addition to the "real" + * return value. + */ + +#include + +/* + * __get_user_X + * + * Inputs: r0 contains the address + * + * Outputs: r0 is error code (0 or -EFAULT) + * r1 contains zero-extended value + * + * These functions should not modify any other registers, + * as they get called from within inline assembly. + */ + +#ifdef CONFIG_ISA_DUAL_ISSUE + + .text + .balign 4 + .globl __get_user_1 +__get_user_1: +1: ldub r1, @r0 || ldi r0, #0 + jmp r14 + + .balign 4 + .globl __get_user_2 +__get_user_2: +2: lduh r1, @r0 || ldi r0, #0 + jmp r14 + + .balign 4 + .globl __get_user_4 +__get_user_4: +3: ld r1, @r0 || ldi r0, #0 + jmp r14 + +bad_get_user: + ldi r1, #0 || ldi r0, #-14 + jmp r14 + +#else /* not CONFIG_ISA_DUAL_ISSUE */ + + .text + .balign 4 + .globl __get_user_1 +__get_user_1: +1: ldub r1, @r0 + ldi r0, #0 + jmp r14 + + .balign 4 + .globl __get_user_2 +__get_user_2: +2: lduh r1, @r0 + ldi r0, #0 + jmp r14 + + .balign 4 + .globl __get_user_4 +__get_user_4: +3: ld r1, @r0 + ldi r0, #0 + jmp r14 + +bad_get_user: + ldi r1, #0 + ldi r0, #-14 + jmp r14 + +#endif /* not CONFIG_ISA_DUAL_ISSUE */ + +.section __ex_table,"a" + .long 1b,bad_get_user + .long 2b,bad_get_user + .long 3b,bad_get_user +.previous + + .end diff -Nru a/arch/m32r/lib/memcpy.S b/arch/m32r/lib/memcpy.S --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/lib/memcpy.S 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,95 @@ +/* + * linux/arch/m32r/lib/memcpy.S + * + * Copyright (C) 2001 Hiroyuki Kondo, and Hirokazu Takata + * Copyright (C) 2004 Hirokazu Takata + * + * void *memcopy(void *dst, const void *src, int n); + * + * dst: r0 + * src: r1 + * n : r2 + */ +/* $Id$ */ + + + .text +#include +#include +#include + +#ifdef CONFIG_ISA_DUAL_ISSUE + + .text +ENTRY(memcpy) +memcopy: + mv r4, r0 || mv r7, r0 + or r7, r1 || cmpz r2 + jc r14 || cmpeq r0, r1 ; return if r2=0 + jc r14 ; return if r0=r1 + + and3 r7, r7, #3 + bnez r7, byte_copy + srl3 r3, r2, #2 + and3 r2, r2, #3 + beqz r3, byte_copy + addi r4, #-4 +word_copy: + ld r7, @r1+ || addi r3, #-1 + st r7, @+r4 || cmpz r2 + bnez r3, word_copy + addi r4, #4 || jc r14 ; return if r2=0 +#if defined(CONFIG_ISA_M32R2) +byte_copy: + ldb r7, @r1 || addi r1, #1 + addi r2, #-1 || stb r7, @r4+ + bnez r2, byte_copy +#elif defined(CONFIG_ISA_M32R) +byte_copy: + ldb r7, @r1 || addi r1, #1 + addi r2, #-1 || stb r7, @r4 + addi r4, #1 + bnez r2, byte_copy +#else +#error unknown isa configuration +#endif +end_memcopy: + jmp r14 + +#else /* not CONFIG_ISA_DUAL_ISSUE */ + + .text +ENTRY(memcpy) +memcopy: + mv r4, r0 + mv r7, r0 + or r7, r1 + beq r0, r1, end_memcopy + beqz r2, end_memcopy + + and3 r7, r7, #3 + bnez r7, byte_copy + srl3 r3, r2, #2 + and3 r2, r2, #3 + beqz r3, byte_copy + addi r4, #-4 +word_copy: + ld r7, @r1+ + addi r3, #-1 + st r7, @+r4 + bnez r3, word_copy + beqz r2, end_memcopy + addi r4, #4 +byte_copy: + ldb r7, @r1 + addi r1, #1 + addi r2, #-1 + stb r7, @r4 + addi r4, #1 + bnez r2, byte_copy +end_memcopy: + jmp r14 + +#endif /* not CONFIG_ISA_DUAL_ISSUE */ + + .end diff -Nru a/arch/m32r/lib/memset.S b/arch/m32r/lib/memset.S --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/lib/memset.S 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,178 @@ +/* + * linux/arch/m32r/lib/memset.S + * + * Copyright (C) 2001,2002 Hiroyuki Kondo, and Hirokazu Takata + * Copyright (C) 2004 Hirokazu Takata + * + * void *memset(void *dst, int val, int len); + * + * dst: r0 + * val: r1 + * len: r2 + * ret: r0 + * + */ +/* $Id$ */ + +#include + + .text + .global memset + +#ifdef CONFIG_ISA_DUAL_ISSUE + + .align 4 +memset: + mv r4, r0 || cmpz r2 + jc r14 + cmpui r2, #16 + bnc qword_align_check + cmpui r2, #4 + bc byte_set +word_align_check: /* len >= 4 */ + and3 r3, r4, #3 + beqz r3, word_set + addi r3, #-4 + neg r3, r3 /* r3 = -(r3 - 4) */ +align_word: + stb r1, @r4 || addi r4, #1 + addi r2, #-1 || addi r3, #-1 + bnez r3, align_word + cmpui r2, #4 + bc byte_set +word_set: + and3 r1, r1, #0x00ff /* r1: abababab <-- ??????ab */ + sll3 r3, r1, #8 + or r1, r3 || addi r4, #-4 + sll3 r3, r1, #16 + or r1, r3 || addi r2, #-4 +word_set_loop: + st r1, @+r4 || addi r2, #-4 + bgtz r2, word_set_loop + bnez r2, byte_set_wrap + st r1, @+r4 + jmp r14 + +qword_align_check: /* len >= 16 */ + and3 r3, r4, #15 + bnez r3, word_align_check +qword_set: + and3 r1, r1, #0x00ff /* r1: abababab <-- ??????ab */ + sll3 r3, r1, #8 + or r1, r3 || addi r4, #-4 + sll3 r3, r1, #16 + or r1, r3 || ldi r5, #16 +qword_set_loop: + ld r3, @(4,r4) /* cache line allocate */ + st r1, @+r4 || addi r2, #-16 + st r1, @+r4 || cmpu r2, r5 + st r1, @+r4 + st r1, @+r4 + bnc qword_set_loop || cmpz r2 + jc r14 +word_set_wrap: + cmpui r2, #4 + bc byte_set + addi r2, #-4 + bra word_set_loop + +byte_set_wrap: + addi r2, #4 + addi r4, #4 || cmpz r2 + jc r14 +#if defined(CONFIG_ISA_M32R2) +byte_set: + addi r2, #-1 || stb r1, @r4+ + bnez r2, byte_set +#elif defined(CONFIG_ISA_M32R) +byte_set: + addi r2, #-1 || stb r1, @r4 + addi r4, #1 + bnez r2, byte_set +#else +#error unknown isa configuration +#endif +end_memset: + jmp r14 + +#else /* not CONFIG_ISA_DUAL_ISSUE */ + + .align 4 +memset: + mv r4, r0 + beqz r2, end_memset + cmpui r2, #16 + bnc qword_align_check + cmpui r2, #4 + bc byte_set +word_align_check: /* len >= 4 */ + and3 r3, r4, #3 + beqz r3, word_set + addi r3, #-4 + neg r3, r3 /* r3 = -(r3 - 4) */ +align_word: + stb r1, @r4 + addi r4, #1 + addi r2, #-1 + addi r3, #-1 + bnez r3, align_word + cmpui r2, #4 + bc byte_set +word_set: + and3 r1, r1, #0x00ff /* r1: abababab <-- ??????ab */ + sll3 r3, r1, #8 + or r1, r3 + sll3 r3, r1, #16 + or r1, r3 + addi r2, #-4 + addi r4, #-4 +word_set_loop: + st r1, @+r4 + addi r2, #-4 + bgtz r2, word_set_loop + bnez r2, byte_set_wrap + st r1, @+r4 + jmp r14 + +qword_align_check: /* len >= 16 */ + and3 r3, r4, #15 + bnez r3, word_align_check +qword_set: + and3 r1, r1, #0x00ff /* r1: abababab <-- ??????ab */ + sll3 r3, r1, #8 + or r1, r3 + sll3 r3, r1, #16 + or r1, r3 + addi r4, #-4 +qword_set_loop: + ld r3, @(4,r4) /* cache line allocate */ + addi r2, #-16 + st r1, @+r4 + st r1, @+r4 + cmpui r2, #16 + st r1, @+r4 + st r1, @+r4 + bnc qword_set_loop + bnez r2, word_set_wrap + jmp r14 +word_set_wrap: + cmpui r2, #4 + bc byte_set + addi r2, #-4 + bra word_set_loop + +byte_set_wrap: + addi r2, #4 + addi r4, #4 + beqz r2, end_memset +byte_set: + addi r2, #-1 + stb r1, @r4 + addi r4, #1 + bnez r2, byte_set +end_memset: + jmp r14 + +#endif /* not CONFIG_ISA_DUAL_ISSUE */ + + .end diff -Nru a/arch/m32r/lib/putuser.S b/arch/m32r/lib/putuser.S --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/lib/putuser.S 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,84 @@ +/* + * __put_user functions. + * + * (C) Copyright 1998 Linus Torvalds + * (C) Copyright 2001 Hirokazu Takata + * + * These functions have a non-standard call interface + * to make them more efficient. + */ + +#include + +/* + * __put_user_X + * + * Inputs: r0 contains the address + * r1 contains the value + * + * Outputs: r0 is error code (0 or -EFAULT) + * r1 is corrupted (will contain "current_task"). + * + * These functions should not modify any other registers, + * as they get called from within inline assembly. + */ + +#ifdef CONFIG_ISA_DUAL_ISSUE + + .text + .balign 4 + .globl __put_user_1 +__put_user_1: +1: stb r1, @r0 || ldi r0, #0 + jmp r14 + + .balign 4 + .globl __put_user_2 +__put_user_2: +2: sth r1, @r0 || ldi r0, #0 + jmp r14 + + .balign 4 + .globl __put_user_4 +__put_user_4: +3: st r1, @r0 || ldi r0, #0 + jmp r14 + +bad_put_user: + ldi r0, #-14 || jmp r14 + +#else /* not CONFIG_ISA_DUAL_ISSUE */ + + .text + .balign 4 + .globl __put_user_1 +__put_user_1: +1: stb r1, @r0 + ldi r0, #0 + jmp r14 + + .balign 4 + .globl __put_user_2 +__put_user_2: +2: sth r1, @r0 + ldi r0, #0 + jmp r14 + + .balign 4 + .globl __put_user_4 +__put_user_4: +3: st r1, @r0 + ldi r0, #0 + jmp r14 + +bad_put_user: + ldi r0, #-14 + jmp r14 + +#endif /* not CONFIG_ISA_DUAL_ISSUE */ + +.section __ex_table,"a" + .long 1b,bad_put_user + .long 2b,bad_put_user + .long 3b,bad_put_user +.previous diff -Nru a/arch/m32r/lib/strlen.S b/arch/m32r/lib/strlen.S --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/lib/strlen.S 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,120 @@ +/* + * linux/arch/m32r/strlen.S -- strlen code. + * + * Copyright (C) 2001 Hirokazu Takata + * + * size_t strlen(const char *s); + * + */ +/* $Id$ */ + + +#include +#include +#include + +#ifdef CONFIG_ISA_DUAL_ISSUE + + .text +ENTRY(strlen) + mv r6, r0 || ldi r2, #0 + and3 r0, r0, #3 + bnez r0, strlen_byte +; +strlen_word: + ld r0, @r6+ +; + seth r5, #high(0x01010101) + or3 r5, r5, #low(0x01010101) + sll3 r7, r5, #7 +strlen_word_loop: + ld r1, @r6+ || not r4, r0 + sub r0, r5 || and r4, r7 + and r4, r0 + bnez r4, strlen_last_bytes + ld r0, @r6+ || not r4, r1 + sub r1, r5 || and r4, r7 + and r4, r1 || addi r2, #4 + bnez r4, strlen_last_bytes + addi r2, #4 || bra.s strlen_word_loop + + ; NOTE: If a null char. exists, return 0. + ; if ((x - 0x01010101) & ~x & 0x80808080) + ; return 0; +; +strlen_byte: + ldb r1, @r6 || addi r6, #1 + beqz r1, strlen_exit + addi r2, #1 || bra.s strlen_byte +; +strlen_last_bytes: + ldi r0, #4 || addi r6, #-8 +; +strlen_byte_loop: + ldb r1, @r6 || addi r6, #1 + addi r0, #-1 || cmpz r1 + bc.s strlen_exit || cmpz r0 + addi r2, #1 || bnc.s strlen_byte_loop +; +strlen_exit: + mv r0, r2 || jmp r14 + +#else /* not CONFIG_ISA_DUAL_ISSUE */ + + .text +ENTRY(strlen) + mv r6, r0 + ldi r2, #0 + and3 r0, r0, #3 + bnez r0, strlen_byte +; +strlen_word: + ld r0, @r6+ +; + seth r5, #high(0x01010101) + or3 r5, r5, #low(0x01010101) + sll3 r7, r5, #7 +strlen_word_loop: + ld r1, @r6+ + not r4, r0 ; NOTE: If a null char. exists, return 0. + sub r0, r5 ; if ((x - 0x01010101) & ~x & 0x80808080) + and r4, r7 ; return 0; + and r4, r0 + bnez r4, strlen_last_bytes + addi r2, #4 +; + ld r0, @r6+ + not r4, r1 ; NOTE: If a null char. exists, return 0. + sub r1, r5 ; if ((x - 0x01010101) & ~x & 0x80808080) + and r4, r7 ; return 0; + and r4, r1 + bnez r4, strlen_last_bytes + addi r2, #4 + bra strlen_word_loop +; +strlen_byte: + ldb r1, @r6 + addi r6, #1 + beqz r1, strlen_exit + addi r2, #1 + bra strlen_byte +; +strlen_last_bytes: + ldi r0, #4 + addi r6, #-8 +; +strlen_byte_loop: + ldb r1, @r6 + addi r6, #1 + addi r0, #-1 + beqz r1, strlen_exit + addi r2, #1 + bnez r0, strlen_byte_loop +; +strlen_exit: + mv r0, r2 + jmp r14 + +#endif /* not CONFIG_ISA_DUAL_ISSUE */ + + .end diff -Nru a/arch/m32r/lib/usercopy.c b/arch/m32r/lib/usercopy.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/lib/usercopy.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,391 @@ +/* + * User address space access functions. + * The non inlined parts of asm-m32r/uaccess.h are here. + * + * Copyright 1997 Andi Kleen + * Copyright 1997 Linus Torvalds + * Copyright 2001, 2002, 2004 Hirokazu Takata + */ +#include +#include +#include +#include +#include + +unsigned long +__generic_copy_to_user(void *to, const void *from, unsigned long n) +{ + prefetch(from); + if (access_ok(VERIFY_WRITE, to, n)) + __copy_user(to,from,n); + return n; +} + +unsigned long +__generic_copy_from_user(void *to, const void *from, unsigned long n) +{ + prefetchw(to); + if (access_ok(VERIFY_READ, from, n)) + __copy_user_zeroing(to,from,n); + else + memset(to, 0, n); + return n; +} + + +/* + * Copy a null terminated string from userspace. + */ + +#ifdef CONFIG_ISA_DUAL_ISSUE + +#define __do_strncpy_from_user(dst,src,count,res) \ +do { \ + int __d0, __d1, __d2; \ + __asm__ __volatile__( \ + " beqz %1, 2f\n" \ + " .fillinsn\n" \ + "0: ldb r14, @%3 || addi %3, #1\n" \ + " stb r14, @%4 || addi %4, #1\n" \ + " beqz r14, 1f\n" \ + " addi %1, #-1\n" \ + " bnez %1, 0b\n" \ + " .fillinsn\n" \ + "1: sub %0, %1\n" \ + " .fillinsn\n" \ + "2:\n" \ + ".section .fixup,\"ax\"\n" \ + " .balign 4\n" \ + "3: seth r14, #high(2b)\n" \ + " or3 r14, r14, #low(2b)\n" \ + " jmp r14 || ldi %0, #%5\n" \ + ".previous\n" \ + ".section __ex_table,\"a\"\n" \ + " .balign 4\n" \ + " .long 0b,3b\n" \ + ".previous" \ + : "=r"(res), "=r"(count), "=&r" (__d0), "=&r" (__d1), \ + "=&r" (__d2) \ + : "i"(-EFAULT), "0"(count), "1"(count), "3"(src), \ + "4"(dst) \ + : "r14", "cbit", "memory"); \ +} while (0) + +#else /* not CONFIG_ISA_DUAL_ISSUE */ + +#define __do_strncpy_from_user(dst,src,count,res) \ +do { \ + int __d0, __d1, __d2; \ + __asm__ __volatile__( \ + " beqz %1, 2f\n" \ + " .fillinsn\n" \ + "0: ldb r14, @%3\n" \ + " stb r14, @%4\n" \ + " addi %3, #1\n" \ + " addi %4, #1\n" \ + " beqz r14, 1f\n" \ + " addi %1, #-1\n" \ + " bnez %1, 0b\n" \ + " .fillinsn\n" \ + "1: sub %0, %1\n" \ + " .fillinsn\n" \ + "2:\n" \ + ".section .fixup,\"ax\"\n" \ + " .balign 4\n" \ + "3: ldi %0, #%5\n" \ + " seth r14, #high(2b)\n" \ + " or3 r14, r14, #low(2b)\n" \ + " jmp r14\n" \ + ".previous\n" \ + ".section __ex_table,\"a\"\n" \ + " .balign 4\n" \ + " .long 0b,3b\n" \ + ".previous" \ + : "=r"(res), "=r"(count), "=&r" (__d0), "=&r" (__d1), \ + "=&r" (__d2) \ + : "i"(-EFAULT), "0"(count), "1"(count), "3"(src), \ + "4"(dst) \ + : "r14", "cbit", "memory"); \ +} while (0) + +#endif /* CONFIG_ISA_DUAL_ISSUE */ + +long +__strncpy_from_user(char *dst, const char *src, long count) +{ + long res; + __do_strncpy_from_user(dst, src, count, res); + return res; +} + +long +strncpy_from_user(char *dst, const char *src, long count) +{ + long res = -EFAULT; + if (access_ok(VERIFY_READ, src, 1)) + __do_strncpy_from_user(dst, src, count, res); + return res; +} + + +/* + * Zero Userspace + */ + +#ifdef CONFIG_ISA_DUAL_ISSUE + +#define __do_clear_user(addr,size) \ +do { \ + int __dst, __c; \ + __asm__ __volatile__( \ + " beqz %1, 9f\n" \ + " and3 r14, %0, #3\n" \ + " bnez r14, 2f\n" \ + " and3 r14, %1, #3\n" \ + " bnez r14, 2f\n" \ + " and3 %1, %1, #3\n" \ + " beqz %2, 2f\n" \ + " addi %0, #-4\n" \ + " .fillinsn\n" \ + "0: ; word clear \n" \ + " st %6, @+%0 || addi %2, #-1\n" \ + " bnez %2, 0b\n" \ + " beqz %1, 9f\n" \ + " .fillinsn\n" \ + "2: ; byte clear \n" \ + " stb %6, @%0 || addi %1, #-1\n" \ + " addi %0, #1\n" \ + " bnez %1, 2b\n" \ + " .fillinsn\n" \ + "9:\n" \ + ".section .fixup,\"ax\"\n" \ + " .balign 4\n" \ + "4: slli %2, #2\n" \ + " seth r14, #high(9b)\n" \ + " or3 r14, r14, #low(9b)\n" \ + " jmp r14 || add %1, %2\n" \ + ".previous\n" \ + ".section __ex_table,\"a\"\n" \ + " .balign 4\n" \ + " .long 0b,4b\n" \ + " .long 2b,9b\n" \ + ".previous\n" \ + : "=&r"(__dst), "=&r"(size), "=&r"(__c) \ + : "0"(addr), "1"(size), "2"(size / 4), "r"(0) \ + : "r14", "cbit", "memory"); \ +} while (0) + +#else /* not CONFIG_ISA_DUAL_ISSUE */ + +#define __do_clear_user(addr,size) \ +do { \ + int __dst, __c; \ + __asm__ __volatile__( \ + " beqz %1, 9f\n" \ + " and3 r14, %0, #3\n" \ + " bnez r14, 2f\n" \ + " and3 r14, %1, #3\n" \ + " bnez r14, 2f\n" \ + " and3 %1, %1, #3\n" \ + " beqz %2, 2f\n" \ + " addi %0, #-4\n" \ + " .fillinsn\n" \ + "0: st %6, @+%0 ; word clear \n" \ + " addi %2, #-1\n" \ + " bnez %2, 0b\n" \ + " beqz %1, 9f\n" \ + " .fillinsn\n" \ + "2: stb %6, @%0 ; byte clear \n" \ + " addi %1, #-1\n" \ + " addi %0, #1\n" \ + " bnez %1, 2b\n" \ + " .fillinsn\n" \ + "9:\n" \ + ".section .fixup,\"ax\"\n" \ + " .balign 4\n" \ + "4: slli %2, #2\n" \ + " add %1, %2\n" \ + " seth r14, #high(9b)\n" \ + " or3 r14, r14, #low(9b)\n" \ + " jmp r14\n" \ + ".previous\n" \ + ".section __ex_table,\"a\"\n" \ + " .balign 4\n" \ + " .long 0b,4b\n" \ + " .long 2b,9b\n" \ + ".previous\n" \ + : "=&r"(__dst), "=&r"(size), "=&r"(__c) \ + : "0"(addr), "1"(size), "2"(size / 4), "r"(0) \ + : "r14", "cbit", "memory"); \ +} while (0) + +#endif /* not CONFIG_ISA_DUAL_ISSUE */ + +unsigned long +clear_user(void *to, unsigned long n) +{ + if (access_ok(VERIFY_WRITE, to, n)) + __do_clear_user(to, n); + return n; +} + +unsigned long +__clear_user(void *to, unsigned long n) +{ + __do_clear_user(to, n); + return n; +} + +/* + * Return the size of a string (including the ending 0) + * + * Return 0 on exception, a value greater than N if too long + */ + +#ifdef CONFIG_ISA_DUAL_ISSUE + +long strnlen_user(const char *s, long n) +{ + unsigned long mask = -__addr_ok(s); + unsigned long res; + + __asm__ __volatile__( + " and %0, %5 || mv r1, %1\n" + " beqz %0, strnlen_exit\n" + " and3 r0, %1, #3\n" + " bnez r0, strnlen_byte_loop\n" + " cmpui %0, #4\n" + " bc strnlen_byte_loop\n" + "strnlen_word_loop:\n" + "0: ld r0, @%1+\n" + " pcmpbz r0\n" + " bc strnlen_last_bytes_fixup\n" + " addi %0, #-4\n" + " beqz %0, strnlen_exit\n" + " bgtz %0, strnlen_word_loop\n" + "strnlen_last_bytes:\n" + " mv %0, %4\n" + "strnlen_last_bytes_fixup:\n" + " addi %1, #-4\n" + "strnlen_byte_loop:\n" + "1: ldb r0, @%1 || addi %0, #-1\n" + " beqz r0, strnlen_exit\n" + " addi %1, #1\n" + " bnez %0, strnlen_byte_loop\n" + "strnlen_exit:\n" + " sub %1, r1\n" + " add3 %0, %1, #1\n" + " .fillinsn\n" + "9:\n" + ".section .fixup,\"ax\"\n" + " .balign 4\n" + "4: addi %1, #-4\n" + " .fillinsn\n" + "5: seth r1, #high(9b)\n" + " or3 r1, r1, #low(9b)\n" + " jmp r1 || ldi %0, #0\n" + ".previous\n" + ".section __ex_table,\"a\"\n" + " .balign 4\n" + " .long 0b,4b\n" + " .long 1b,5b\n" + ".previous" + : "=&r" (res), "=r" (s) + : "0" (n), "1" (s), "r" (n & 3), "r" (mask), "r"(0x01010101) + : "r0", "r1", "cbit"); + + /* NOTE: strnlen_user() algorism: + * { + * char *p; + * for (p = s; n-- && *p != '\0'; ++p) + * ; + * return p - s + 1; + * } + */ + + /* NOTE: If a null char. exists, return 0. + * if ((x - 0x01010101) & ~x & 0x80808080)\n" + * return 0;\n" + */ + + return res & mask; +} + +#else /* not CONFIG_ISA_DUAL_ISSUE */ + +long strnlen_user(const char *s, long n) +{ + unsigned long mask = -__addr_ok(s); + unsigned long res; + + __asm__ __volatile__( + " and %0, %5\n" + " mv r1, %1\n" + " beqz %0, strnlen_exit\n" + " and3 r0, %1, #3\n" + " bnez r0, strnlen_byte_loop\n" + " cmpui %0, #4\n" + " bc strnlen_byte_loop\n" + " sll3 r3, %6, #7\n" + "strnlen_word_loop:\n" + "0: ld r0, @%1+\n" + " not r2, r0\n" + " sub r0, %6\n" + " and r2, r3\n" + " and r2, r0\n" + " bnez r2, strnlen_last_bytes_fixup\n" + " addi %0, #-4\n" + " beqz %0, strnlen_exit\n" + " bgtz %0, strnlen_word_loop\n" + "strnlen_last_bytes:\n" + " mv %0, %4\n" + "strnlen_last_bytes_fixup:\n" + " addi %1, #-4\n" + "strnlen_byte_loop:\n" + "1: ldb r0, @%1\n" + " addi %0, #-1\n" + " beqz r0, strnlen_exit\n" + " addi %1, #1\n" + " bnez %0, strnlen_byte_loop\n" + "strnlen_exit:\n" + " sub %1, r1\n" + " add3 %0, %1, #1\n" + " .fillinsn\n" + "9:\n" + ".section .fixup,\"ax\"\n" + " .balign 4\n" + "4: addi %1, #-4\n" + " .fillinsn\n" + "5: ldi %0, #0\n" + " seth r1, #high(9b)\n" + " or3 r1, r1, #low(9b)\n" + " jmp r1\n" + ".previous\n" + ".section __ex_table,\"a\"\n" + " .balign 4\n" + " .long 0b,4b\n" + " .long 1b,5b\n" + ".previous" + : "=&r" (res), "=r" (s) + : "0" (n), "1" (s), "r" (n & 3), "r" (mask), "r"(0x01010101) + : "r0", "r1", "r2", "r3", "cbit"); + + /* NOTE: strnlen_user() algorism: + * { + * char *p; + * for (p = s; n-- && *p != '\0'; ++p) + * ; + * return p - s + 1; + * } + */ + + /* NOTE: If a null char. exists, return 0. + * if ((x - 0x01010101) & ~x & 0x80808080)\n" + * return 0;\n" + */ + + return res & mask; +} + +#endif /* CONFIG_ISA_DUAL_ISSUE */ + diff -Nru a/arch/m32r/m32700ut/defconfig.m32700ut.smp b/arch/m32r/m32700ut/defconfig.m32700ut.smp --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/m32700ut/defconfig.m32700ut.smp 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,662 @@ +# +# Automatically generated make config: don't edit +# +CONFIG_M32R=y +CONFIG_UID16=y +CONFIG_GENERIC_ISA_DMA=y + +# +# Code maturity level options +# +CONFIG_EXPERIMENTAL=y +CONFIG_CLEAN_COMPILE=y + +# +# General setup +# +CONFIG_SWAP=y +CONFIG_SYSVIPC=y +# CONFIG_POSIX_MQUEUE is not set +CONFIG_BSD_PROCESS_ACCT=y +# CONFIG_BSD_PROCESS_ACCT_V3 is not set +CONFIG_SYSCTL=y +# CONFIG_AUDIT is not set +CONFIG_LOG_BUF_SHIFT=15 +CONFIG_HOTPLUG=y +CONFIG_IKCONFIG=y +# CONFIG_IKCONFIG_PROC is not set +CONFIG_EMBEDDED=y +# CONFIG_KALLSYMS is not set +# CONFIG_FUTEX is not set +# CONFIG_EPOLL is not set +CONFIG_IOSCHED_NOOP=y +# CONFIG_IOSCHED_AS is not set +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 is not set +CONFIG_OBSOLETE_MODPARM=y +# CONFIG_MODVERSIONS is not set +CONFIG_KMOD=y +CONFIG_STOP_MACHINE=y + +# +# Processor type and features +# +# CONFIG_PLAT_MAPPI is not set +# CONFIG_PLAT_USRV is not set +CONFIG_PLAT_M32700UT=y +# CONFIG_PLAT_OPSPUT is not set +# CONFIG_PLAT_OAKS32R is not set +# CONFIG_PLAT_MAPPI2 is not set +CONFIG_CHIP_M32700=y +# CONFIG_CHIP_M32102 is not set +# CONFIG_CHIP_VDEC2 is not set +# CONFIG_CHIP_OPSP is not set +CONFIG_MMU=y +CONFIG_TLB_ENTRIES=32 +CONFIG_ISA_M32R2=y +CONFIG_ISA_DSP_LEVEL2=y +CONFIG_ISA_DUAL_ISSUE=y +CONFIG_BUS_CLOCK=50000000 +CONFIG_TIMER_DIVIDE=128 +# CONFIG_CPU_LITTLE_ENDIAN is not set +CONFIG_MEMORY_START=0x08000000 +CONFIG_MEMORY_SIZE=0x01000000 +CONFIG_NOHIGHMEM=y +# CONFIG_DISCONTIGMEM is not set +CONFIG_RWSEM_GENERIC_SPINLOCK=y +# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set +CONFIG_PREEMPT=y +# CONFIG_HAVE_DEC_LOCK is not set +CONFIG_SMP=y +CONFIG_CHIP_M32700_TS1=y +CONFIG_NR_CPUS=2 +# CONFIG_NUMA is not set + +# +# M32R drivers +# +# CONFIG_M32RPCC is not set +CONFIG_M32R_CFC=y +CONFIG_M32700UT_CFC=y +CONFIG_CFC_NUM=1 +# CONFIG_MTD_M32R is not set +CONFIG_M32R_SMC91111=y +CONFIG_M32700UT_DS1302=y + +# +# Power management options (ACPI, APM) +# +# CONFIG_PM is not set + +# +# Bus options (PCI, PCMCIA, EISA, MCA, ISA) +# +# CONFIG_PCI is not set +# CONFIG_ISA is not set + +# +# PCMCIA/CardBus support +# +CONFIG_PCMCIA=y +# CONFIG_PCMCIA_DEBUG is not set +# CONFIG_TCIC is not set + +# +# PCI Hotplug Support +# + +# +# Executable file formats +# +CONFIG_BINFMT_ELF=y +# CONFIG_BINFMT_MISC is not set + +# +# Device Drivers +# + +# +# Generic Driver Options +# +CONFIG_STANDALONE=y +CONFIG_PREVENT_FIRMWARE_BUILD=y +# CONFIG_FW_LOADER 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_FD is not set +CONFIG_BLK_DEV_LOOP=y +# CONFIG_BLK_DEV_CRYPTOLOOP is not set +CONFIG_BLK_DEV_NBD=y +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=y +CONFIG_BLK_DEV_IDE=y + +# +# Please see Documentation/ide.txt for help/info on IDE drives +# +# CONFIG_BLK_DEV_IDE_SATA is not set +CONFIG_BLK_DEV_IDEDISK=y +# CONFIG_IDEDISK_MULTI_MODE is not set +CONFIG_BLK_DEV_IDECS=y +CONFIG_BLK_DEV_IDECD=m +# CONFIG_BLK_DEV_IDETAPE is not set +# CONFIG_BLK_DEV_IDEFLOPPY is not set +# CONFIG_BLK_DEV_IDESCSI is not set +# CONFIG_IDE_TASK_IOCTL is not set +# CONFIG_IDE_TASKFILE_IO is not set + +# +# IDE chipset support/bugfixes +# +CONFIG_IDE_GENERIC=y +# CONFIG_IDE_ARM is not set +# CONFIG_BLK_DEV_IDEDMA is not set +# CONFIG_IDEDMA_AUTO is not set +# CONFIG_BLK_DEV_HD is not set + +# +# SCSI device support +# +CONFIG_SCSI=m +CONFIG_SCSI_PROC_FS=y + +# +# SCSI support type (disk, tape, CD-ROM) +# +CONFIG_BLK_DEV_SD=m +# CONFIG_CHR_DEV_ST is not set +# CONFIG_CHR_DEV_OSST is not set +CONFIG_BLK_DEV_SR=m +# CONFIG_BLK_DEV_SR_VENDOR is not set +CONFIG_CHR_DEV_SG=m + +# +# Some SCSI devices (e.g. CD jukebox) support multiple LUNs +# +CONFIG_SCSI_MULTI_LUN=y +# CONFIG_SCSI_CONSTANTS is not set +# CONFIG_SCSI_LOGGING is not set + +# +# SCSI Transport Attributes +# +# CONFIG_SCSI_SPI_ATTRS is not set +# 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 + +# +# PCMCIA SCSI adapter support +# +# CONFIG_PCMCIA_AHA152X is not set +# CONFIG_PCMCIA_FDOMAIN is not set +# CONFIG_PCMCIA_NINJA_SCSI is not set +# CONFIG_PCMCIA_QLOGIC is not set +# CONFIG_PCMCIA_SYM53C500 is not set + +# +# Multi-device support (RAID and LVM) +# +# CONFIG_MD is not set + +# +# Fusion MPT device support +# + +# +# IEEE 1394 (FireWire) support +# + +# +# 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=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=y +CONFIG_IP_PNP_DHCP=y +# CONFIG_IP_PNP_BOOTP is not set +# CONFIG_IP_PNP_RARP is not set +# CONFIG_NET_IPIP is not set +# CONFIG_NET_IPGRE 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_HW_FLOWCONTROL is not set + +# +# QoS and/or fair queueing +# +# CONFIG_NET_SCHED is not set +# CONFIG_NET_CLS_ROUTE 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 is not set +# 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_SERIAL_CORE=y +CONFIG_SERIAL_CORE_CONSOLE=y +# CONFIG_SERIAL_M32R_SIO is not set +CONFIG_SERIAL_M32R_PLDSIO=y +CONFIG_SERIAL_M32R_PLDSIO_CONSOLE=y +CONFIG_UNIX98_PTYS=y +CONFIG_LEGACY_PTYS=y +CONFIG_LEGACY_PTY_COUNT=256 +# CONFIG_QIC02_TAPE is not set + +# +# IPMI +# +# CONFIG_IPMI_HANDLER is not set + +# +# Watchdog Cards +# +# CONFIG_WATCHDOG is not set +# CONFIG_RTC is not set +# CONFIG_GEN_RTC is not set +# CONFIG_DTLK is not set +# CONFIG_R3964 is not set + +# +# Ftape, the floppy tape device driver +# +# CONFIG_AGP is not set +# CONFIG_DRM is not set + +# +# PCMCIA character devices +# +# CONFIG_SYNCLINK_CS is not set +# CONFIG_RAW_DRIVER is not set + +# +# I2C support +# +# CONFIG_I2C is not set + +# +# Dallas's 1-wire bus +# +# CONFIG_W1 is not set + +# +# Misc devices +# + +# +# Multimedia devices +# +CONFIG_VIDEO_DEV=y + +# +# Video For Linux +# + +# +# Video Adapters +# +# CONFIG_VIDEO_CPIA is not set +CONFIG_M32R_AR=y +CONFIG_M32R_AR_VGA=y + +# +# Radio Adapters +# +# CONFIG_RADIO_MAESTRO is not set + +# +# Digital Video Broadcasting Devices +# +# CONFIG_DVB is not set + +# +# Graphics support +# +CONFIG_FB=y +CONFIG_FB_EPSON_S1D13806=y +# CONFIG_FB_VIRTUAL is not set + +# +# Console display driver support +# +# CONFIG_VGA_CONSOLE is not set +# CONFIG_MDA_CONSOLE is not set +CONFIG_DUMMY_CONSOLE=y +CONFIG_FRAMEBUFFER_CONSOLE=y +# CONFIG_FONTS is not set +CONFIG_FONT_8x8=y +CONFIG_FONT_8x16=y + +# +# Logo configuration +# +CONFIG_LOGO=y +CONFIG_LOGO_LINUX_MONO=y +CONFIG_LOGO_LINUX_VGA16=y +CONFIG_LOGO_LINUX_CLUT224=y +CONFIG_LOGO_M32R_CLUT224=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=m +CONFIG_EXT3_FS_XATTR=y +# CONFIG_EXT3_FS_POSIX_ACL is not set +# CONFIG_EXT3_FS_SECURITY is not set +CONFIG_JBD=m +CONFIG_JBD_DEBUG=y +CONFIG_FS_MBCACHE=y +CONFIG_REISERFS_FS=m +# CONFIG_REISERFS_CHECK is not set +# CONFIG_REISERFS_PROC_INFO is not set +# CONFIG_REISERFS_FS_XATTR 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=m +CONFIG_JOLIET=y +# CONFIG_ZISOFS is not set +CONFIG_UDF_FS=m +CONFIG_UDF_NLS=y + +# +# DOS/FAT/NT Filesystems +# +CONFIG_FAT_FS=m +CONFIG_MSDOS_FS=m +CONFIG_VFAT_FS=m +CONFIG_FAT_DEFAULT_CODEPAGE=437 +CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" +# CONFIG_NTFS_FS is not set + +# +# Pseudo filesystems +# +CONFIG_PROC_FS=y +CONFIG_PROC_KCORE=y +CONFIG_SYSFS=y +CONFIG_DEVFS_FS=y +CONFIG_DEVFS_MOUNT=y +# CONFIG_DEVFS_DEBUG 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_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=y +# CONFIG_NFS_V4 is not set +# CONFIG_NFS_DIRECTIO is not set +# CONFIG_NFSD is not set +CONFIG_ROOT_NFS=y +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_CODA_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=y +CONFIG_NLS_DEFAULT="iso8859-1" +# CONFIG_NLS_CODEPAGE_437 is not set +# CONFIG_NLS_CODEPAGE_737 is not set +# CONFIG_NLS_CODEPAGE_775 is not set +# CONFIG_NLS_CODEPAGE_850 is not set +# CONFIG_NLS_CODEPAGE_852 is not set +# CONFIG_NLS_CODEPAGE_855 is not set +# CONFIG_NLS_CODEPAGE_857 is not set +# CONFIG_NLS_CODEPAGE_860 is not set +# CONFIG_NLS_CODEPAGE_861 is not set +# CONFIG_NLS_CODEPAGE_862 is not set +# CONFIG_NLS_CODEPAGE_863 is not set +# CONFIG_NLS_CODEPAGE_864 is not set +# CONFIG_NLS_CODEPAGE_865 is not set +# CONFIG_NLS_CODEPAGE_866 is not set +# CONFIG_NLS_CODEPAGE_869 is not set +# CONFIG_NLS_CODEPAGE_936 is not set +# CONFIG_NLS_CODEPAGE_950 is not set +# CONFIG_NLS_CODEPAGE_932 is not set +# CONFIG_NLS_CODEPAGE_949 is not set +# CONFIG_NLS_CODEPAGE_874 is not set +# CONFIG_NLS_ISO8859_8 is not set +# CONFIG_NLS_CODEPAGE_1250 is not set +# CONFIG_NLS_CODEPAGE_1251 is not set +# CONFIG_NLS_ASCII is not set +# CONFIG_NLS_ISO8859_1 is not set +# CONFIG_NLS_ISO8859_2 is not set +# CONFIG_NLS_ISO8859_3 is not set +# CONFIG_NLS_ISO8859_4 is not set +# CONFIG_NLS_ISO8859_5 is not set +# CONFIG_NLS_ISO8859_6 is not set +# CONFIG_NLS_ISO8859_7 is not set +# CONFIG_NLS_ISO8859_9 is not set +# CONFIG_NLS_ISO8859_13 is not set +# CONFIG_NLS_ISO8859_14 is not set +# CONFIG_NLS_ISO8859_15 is not set +# CONFIG_NLS_KOI8_R is not set +# CONFIG_NLS_KOI8_U is not set +# CONFIG_NLS_UTF8 is not set + +# +# Profiling support +# +# CONFIG_PROFILING is not set + +# +# Kernel hacking +# +# CONFIG_DEBUG_KERNEL is not set +# CONFIG_DEBUG_SPINLOCK_SLEEP 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_CRC_CCITT is not set +CONFIG_CRC32=y +# CONFIG_LIBCRC32C is not set diff -Nru a/arch/m32r/m32700ut/defconfig.m32700ut.up b/arch/m32r/m32700ut/defconfig.m32700ut.up --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/m32700ut/defconfig.m32700ut.up 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,659 @@ +# +# Automatically generated make config: don't edit +# +CONFIG_M32R=y +CONFIG_UID16=y +CONFIG_GENERIC_ISA_DMA=y + +# +# Code maturity level options +# +CONFIG_EXPERIMENTAL=y +CONFIG_CLEAN_COMPILE=y +CONFIG_BROKEN_ON_SMP=y + +# +# General setup +# +CONFIG_SWAP=y +CONFIG_SYSVIPC=y +# CONFIG_POSIX_MQUEUE is not set +CONFIG_BSD_PROCESS_ACCT=y +# CONFIG_BSD_PROCESS_ACCT_V3 is not set +CONFIG_SYSCTL=y +# CONFIG_AUDIT is not set +CONFIG_LOG_BUF_SHIFT=14 +CONFIG_HOTPLUG=y +CONFIG_IKCONFIG=y +# CONFIG_IKCONFIG_PROC is not set +CONFIG_EMBEDDED=y +# CONFIG_KALLSYMS is not set +# CONFIG_FUTEX is not set +# CONFIG_EPOLL is not set +CONFIG_IOSCHED_NOOP=y +# CONFIG_IOSCHED_AS is not set +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 is not set +CONFIG_OBSOLETE_MODPARM=y +# CONFIG_MODVERSIONS is not set +CONFIG_KMOD=y + +# +# Processor type and features +# +# CONFIG_PLAT_MAPPI is not set +# CONFIG_PLAT_USRV is not set +CONFIG_PLAT_M32700UT=y +# CONFIG_PLAT_OPSPUT is not set +# CONFIG_PLAT_OAKS32R is not set +# CONFIG_PLAT_MAPPI2 is not set +CONFIG_CHIP_M32700=y +# CONFIG_CHIP_M32102 is not set +# CONFIG_CHIP_VDEC2 is not set +# CONFIG_CHIP_OPSP is not set +CONFIG_MMU=y +CONFIG_TLB_ENTRIES=32 +CONFIG_ISA_M32R2=y +CONFIG_ISA_DSP_LEVEL2=y +CONFIG_ISA_DUAL_ISSUE=y +CONFIG_BUS_CLOCK=50000000 +CONFIG_TIMER_DIVIDE=128 +# CONFIG_CPU_LITTLE_ENDIAN is not set +CONFIG_MEMORY_START=0x08000000 +CONFIG_MEMORY_SIZE=0x01000000 +CONFIG_NOHIGHMEM=y +# CONFIG_DISCONTIGMEM is not set +CONFIG_RWSEM_GENERIC_SPINLOCK=y +# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set +CONFIG_PREEMPT=y +# CONFIG_HAVE_DEC_LOCK is not set +# CONFIG_SMP is not set + +# +# M32R drivers +# +# CONFIG_M32RPCC is not set +CONFIG_M32R_CFC=y +CONFIG_M32700UT_CFC=y +CONFIG_CFC_NUM=1 +# CONFIG_MTD_M32R is not set +CONFIG_M32R_SMC91111=y +CONFIG_M32700UT_DS1302=y + +# +# Power management options (ACPI, APM) +# +# CONFIG_PM is not set + +# +# Bus options (PCI, PCMCIA, EISA, MCA, ISA) +# +# CONFIG_PCI is not set +# CONFIG_ISA is not set + +# +# PCMCIA/CardBus support +# +CONFIG_PCMCIA=y +# CONFIG_PCMCIA_DEBUG is not set +# CONFIG_TCIC is not set + +# +# PCI Hotplug Support +# + +# +# Executable file formats +# +CONFIG_BINFMT_ELF=y +# CONFIG_BINFMT_MISC is not set + +# +# Device Drivers +# + +# +# Generic Driver Options +# +CONFIG_STANDALONE=y +CONFIG_PREVENT_FIRMWARE_BUILD=y +# CONFIG_FW_LOADER 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_FD is not set +CONFIG_BLK_DEV_LOOP=y +# CONFIG_BLK_DEV_CRYPTOLOOP is not set +CONFIG_BLK_DEV_NBD=y +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=y +CONFIG_BLK_DEV_IDE=y + +# +# Please see Documentation/ide.txt for help/info on IDE drives +# +# CONFIG_BLK_DEV_IDE_SATA is not set +CONFIG_BLK_DEV_IDEDISK=y +# CONFIG_IDEDISK_MULTI_MODE is not set +CONFIG_BLK_DEV_IDECS=y +CONFIG_BLK_DEV_IDECD=m +# CONFIG_BLK_DEV_IDETAPE is not set +# CONFIG_BLK_DEV_IDEFLOPPY is not set +# CONFIG_BLK_DEV_IDESCSI is not set +# CONFIG_IDE_TASK_IOCTL is not set +# CONFIG_IDE_TASKFILE_IO is not set + +# +# IDE chipset support/bugfixes +# +CONFIG_IDE_GENERIC=y +# CONFIG_IDE_ARM is not set +# CONFIG_BLK_DEV_IDEDMA is not set +# CONFIG_IDEDMA_AUTO is not set +# CONFIG_BLK_DEV_HD is not set + +# +# SCSI device support +# +CONFIG_SCSI=m +CONFIG_SCSI_PROC_FS=y + +# +# SCSI support type (disk, tape, CD-ROM) +# +CONFIG_BLK_DEV_SD=m +# CONFIG_CHR_DEV_ST is not set +# CONFIG_CHR_DEV_OSST is not set +CONFIG_BLK_DEV_SR=m +# CONFIG_BLK_DEV_SR_VENDOR is not set +CONFIG_CHR_DEV_SG=m + +# +# Some SCSI devices (e.g. CD jukebox) support multiple LUNs +# +CONFIG_SCSI_MULTI_LUN=y +# CONFIG_SCSI_CONSTANTS is not set +# CONFIG_SCSI_LOGGING is not set + +# +# SCSI Transport Attributes +# +# CONFIG_SCSI_SPI_ATTRS is not set +# 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 + +# +# PCMCIA SCSI adapter support +# +# CONFIG_PCMCIA_AHA152X is not set +# CONFIG_PCMCIA_FDOMAIN is not set +# CONFIG_PCMCIA_NINJA_SCSI is not set +# CONFIG_PCMCIA_QLOGIC is not set +# CONFIG_PCMCIA_SYM53C500 is not set + +# +# Multi-device support (RAID and LVM) +# +# CONFIG_MD is not set + +# +# Fusion MPT device support +# + +# +# IEEE 1394 (FireWire) support +# + +# +# 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=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=y +CONFIG_IP_PNP_DHCP=y +# CONFIG_IP_PNP_BOOTP is not set +# CONFIG_IP_PNP_RARP is not set +# CONFIG_NET_IPIP is not set +# CONFIG_NET_IPGRE 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_HW_FLOWCONTROL is not set + +# +# QoS and/or fair queueing +# +# CONFIG_NET_SCHED is not set +# CONFIG_NET_CLS_ROUTE 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 is not set +# 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_SERIAL_CORE=y +CONFIG_SERIAL_CORE_CONSOLE=y +# CONFIG_SERIAL_M32R_SIO is not set +CONFIG_SERIAL_M32R_PLDSIO=y +CONFIG_SERIAL_M32R_PLDSIO_CONSOLE=y +CONFIG_UNIX98_PTYS=y +CONFIG_LEGACY_PTYS=y +CONFIG_LEGACY_PTY_COUNT=256 +# CONFIG_QIC02_TAPE is not set + +# +# IPMI +# +# CONFIG_IPMI_HANDLER is not set + +# +# Watchdog Cards +# +# CONFIG_WATCHDOG is not set +# CONFIG_RTC is not set +# CONFIG_GEN_RTC is not set +# CONFIG_DTLK is not set +# CONFIG_R3964 is not set + +# +# Ftape, the floppy tape device driver +# +# CONFIG_AGP is not set +# CONFIG_DRM is not set + +# +# PCMCIA character devices +# +# CONFIG_SYNCLINK_CS is not set +# CONFIG_RAW_DRIVER is not set + +# +# I2C support +# +# CONFIG_I2C is not set + +# +# Dallas's 1-wire bus +# +# CONFIG_W1 is not set + +# +# Misc devices +# + +# +# Multimedia devices +# +CONFIG_VIDEO_DEV=y + +# +# Video For Linux +# + +# +# Video Adapters +# +# CONFIG_VIDEO_CPIA is not set +CONFIG_M32R_AR=y +CONFIG_M32R_AR_VGA=y + +# +# Radio Adapters +# +# CONFIG_RADIO_MAESTRO is not set + +# +# Digital Video Broadcasting Devices +# +# CONFIG_DVB is not set + +# +# Graphics support +# +CONFIG_FB=y +CONFIG_FB_EPSON_S1D13806=y +# CONFIG_FB_VIRTUAL is not set + +# +# Console display driver support +# +# CONFIG_VGA_CONSOLE is not set +# CONFIG_MDA_CONSOLE is not set +CONFIG_DUMMY_CONSOLE=y +CONFIG_FRAMEBUFFER_CONSOLE=y +# CONFIG_FONTS is not set +CONFIG_FONT_8x8=y +CONFIG_FONT_8x16=y + +# +# Logo configuration +# +CONFIG_LOGO=y +CONFIG_LOGO_LINUX_MONO=y +CONFIG_LOGO_LINUX_VGA16=y +CONFIG_LOGO_LINUX_CLUT224=y +CONFIG_LOGO_M32R_CLUT224=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=m +CONFIG_EXT3_FS_XATTR=y +# CONFIG_EXT3_FS_POSIX_ACL is not set +# CONFIG_EXT3_FS_SECURITY is not set +CONFIG_JBD=m +CONFIG_JBD_DEBUG=y +CONFIG_FS_MBCACHE=y +CONFIG_REISERFS_FS=m +# CONFIG_REISERFS_CHECK is not set +# CONFIG_REISERFS_PROC_INFO is not set +# CONFIG_REISERFS_FS_XATTR 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=m +CONFIG_JOLIET=y +# CONFIG_ZISOFS is not set +CONFIG_UDF_FS=m +CONFIG_UDF_NLS=y + +# +# DOS/FAT/NT Filesystems +# +CONFIG_FAT_FS=m +CONFIG_MSDOS_FS=m +CONFIG_VFAT_FS=m +CONFIG_FAT_DEFAULT_CODEPAGE=437 +CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" +# CONFIG_NTFS_FS is not set + +# +# Pseudo filesystems +# +CONFIG_PROC_FS=y +CONFIG_PROC_KCORE=y +CONFIG_SYSFS=y +CONFIG_DEVFS_FS=y +CONFIG_DEVFS_MOUNT=y +# CONFIG_DEVFS_DEBUG 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_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=y +# CONFIG_NFS_V4 is not set +# CONFIG_NFS_DIRECTIO is not set +# CONFIG_NFSD is not set +CONFIG_ROOT_NFS=y +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_CODA_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=y +CONFIG_NLS_DEFAULT="iso8859-1" +# CONFIG_NLS_CODEPAGE_437 is not set +# CONFIG_NLS_CODEPAGE_737 is not set +# CONFIG_NLS_CODEPAGE_775 is not set +# CONFIG_NLS_CODEPAGE_850 is not set +# CONFIG_NLS_CODEPAGE_852 is not set +# CONFIG_NLS_CODEPAGE_855 is not set +# CONFIG_NLS_CODEPAGE_857 is not set +# CONFIG_NLS_CODEPAGE_860 is not set +# CONFIG_NLS_CODEPAGE_861 is not set +# CONFIG_NLS_CODEPAGE_862 is not set +# CONFIG_NLS_CODEPAGE_863 is not set +# CONFIG_NLS_CODEPAGE_864 is not set +# CONFIG_NLS_CODEPAGE_865 is not set +# CONFIG_NLS_CODEPAGE_866 is not set +# CONFIG_NLS_CODEPAGE_869 is not set +# CONFIG_NLS_CODEPAGE_936 is not set +# CONFIG_NLS_CODEPAGE_950 is not set +# CONFIG_NLS_CODEPAGE_932 is not set +# CONFIG_NLS_CODEPAGE_949 is not set +# CONFIG_NLS_CODEPAGE_874 is not set +# CONFIG_NLS_ISO8859_8 is not set +# CONFIG_NLS_CODEPAGE_1250 is not set +# CONFIG_NLS_CODEPAGE_1251 is not set +# CONFIG_NLS_ASCII is not set +# CONFIG_NLS_ISO8859_1 is not set +# CONFIG_NLS_ISO8859_2 is not set +# CONFIG_NLS_ISO8859_3 is not set +# CONFIG_NLS_ISO8859_4 is not set +# CONFIG_NLS_ISO8859_5 is not set +# CONFIG_NLS_ISO8859_6 is not set +# CONFIG_NLS_ISO8859_7 is not set +# CONFIG_NLS_ISO8859_9 is not set +# CONFIG_NLS_ISO8859_13 is not set +# CONFIG_NLS_ISO8859_14 is not set +# CONFIG_NLS_ISO8859_15 is not set +# CONFIG_NLS_KOI8_R is not set +# CONFIG_NLS_KOI8_U is not set +# CONFIG_NLS_UTF8 is not set + +# +# Profiling support +# +# CONFIG_PROFILING is not set + +# +# Kernel hacking +# +# CONFIG_DEBUG_KERNEL is not set +# CONFIG_DEBUG_SPINLOCK_SLEEP 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_CRC_CCITT is not set +CONFIG_CRC32=y +# CONFIG_LIBCRC32C is not set diff -Nru a/arch/m32r/m32700ut/dot.gdbinit_200MHz_16MB b/arch/m32r/m32700ut/dot.gdbinit_200MHz_16MB --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/m32700ut/dot.gdbinit_200MHz_16MB 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,249 @@ +# .gdbinit file +# $Id: dot.gdbinit_200MHz_16MB,v 1.1 2004/08/17 02:58:11 takata Exp $ +#----- +# NOTE: this file is generated by a script, "gen_gdbinit.pl". +# (Please type "gen_gdbinit.pl --help" and check the help message). +# $ Id: gen_gdbinit.pl,v 1.12 2004/07/26 09:56:10 takata Exp $ +#----- +# target platform: m32700ut + +# setting +set width 0d70 +set radix 0d16 + +debug_chaos + +# clk xin:cpu:bif:bus=25:200:50:50 +define clock_init + set *(unsigned long *)0x00ef4008 = 0x00000000 + set *(unsigned long *)0x00ef4004 = 0 + shell sleep 0.1 + # NOTE: Please change the master clock source from PLL-clock to Xin-clock + # and switch off PLL, before resetting the clock gear ratio. + + set *(unsigned long *)0x00ef4024 = 2 + set *(unsigned long *)0x00ef4020 = 2 + set *(unsigned long *)0x00ef4010 = 0 + set *(unsigned long *)0x00ef4014 = 0 + set *(unsigned long *)0x00ef4004 = 3 + shell sleep 0.1 + set *(unsigned long *)0x00ef4008 = 0x00000200 +end + +# Initialize SDRAM controller +define sdram_init + # SDIR0 + set *(unsigned long *)0x00ef6008 = 0x00000182 + # SDIR1 + set *(unsigned long *)0x00ef600c = 0x00000001 + # Initialize wait + shell sleep 0.1 + # Ch0-MOD + set *(unsigned long *)0x00ef602c = 0x00000020 + # Ch0-TR + set *(unsigned long *)0x00ef6028 = 0x00041302 + # Ch0-ADR (size:16MB) + set *(unsigned long *)0x00ef6020 = 0x08000002 + # AutoRef On + set *(unsigned long *)0x00ef6004 = 0x00010517 + # Access enable + set *(unsigned long *)0x00ef6024 = 0x00000001 +end +document sdram_init + SDRAM controller initialization + 0x08000000 - 0x08ffffff (16MB) +end + +# Initialize BSEL3 for UT-CFC +define cfc_init + set $sfrbase = 0xa0ef0000 +# too fast +# set *(unsigned long *)($sfrbase + 0x5300) = 0x0b0b8000 +# set *(unsigned long *)($sfrbase + 0x5304) = 0x00102204 +# set *(unsigned long *)($sfrbase + 0x5300) = 0x1f1f8000 +# set *(unsigned long *)($sfrbase + 0x5300) = 0x1f1f1fdf +# set *(unsigned long *)($sfrbase + 0x5304) = 0x0013220f +# set *(unsigned long *)($sfrbase + 0x5304) = 0x0013330f +end +document cfc_init + CF controller initialization +end + +# MMU enable +define mmu_enable + set $evb=0x88000000 + set *(unsigned long *)0xffff0024=1 +end + +# MMU disable +define mmu_disable + set $evb=0 + set *(unsigned long *)0xffff0024=0 +end + +# Show TLB entries +define show_tlb_entries + set $i = 0 + set $addr = $arg0 + set $nr_entries = $arg1 + use_mon_code + while ($i < $nr_entries) + set $tlb_tag = *(unsigned long*)$addr + set $tlb_data = *(unsigned long*)($addr + 4) + printf " [%2d] 0x%08lx : 0x%08lx - 0x%08lx\n", $i, $addr, $tlb_tag, $tlb_data + set $i = $i + 1 + set $addr = $addr + 8 + end + use_debug_dma +end +define itlb + set $itlb=0xfe000000 + show_tlb_entries $itlb 0d32 +end +define dtlb + set $dtlb=0xfe000800 + show_tlb_entries $dtlb 0d32 +end + +# Initialize TLB entries +define init_tlb_entries + set $i = 0 + set $addr = $arg0 + set $nr_entries = $arg1 + use_mon_code + while ($i < $nr_entries) + set *(unsigned long *)($addr + 0x4) = 0 + set $i = $i + 1 + set $addr = $addr + 8 + end + use_debug_dma +end +define tlb_init + set $itlb=0xfe000000 + init_tlb_entries $itlb 0d32 + set $dtlb=0xfe000800 + init_tlb_entries $dtlb 0d32 +end + +# Show current task structure +define show_current + set $current = $spi & 0xffffe000 + printf "$current=0x%08lX\n",$current + print *(struct task_struct *)$current +end + +# Show user assigned task structure +define show_task + set = $arg0 & 0xffffe000 + printf "$task=0x%08lX\n",$task + print *(struct task_struct *)$task +end +document show_task + Show user assigned task structure + arg0 : task structure address +end + +# Show M32R registers +define show_regs + printf " R0[0x%08lX] R1[0x%08lX] R2[0x%08lX] R3[0x%08lX]\n",$r0,$r1,$r2,$r3 + printf " R4[0x%08lX] R5[0x%08lX] R6[0x%08lX] R7[0x%08lX]\n",$r4,$r5,$r6,$r7 + printf " R8[0x%08lX] R9[0x%08lX] R10[0x%08lX] R11[0x%08lX]\n",$r8,$r9,$r10,$r11 + printf "R12[0x%08lX] FP[0x%08lX] LR[0x%08lX] SP[0x%08lX]\n",$r12,$fp,$lr,$sp + printf "PSW[0x%08lX] CBR[0x%08lX] SPI[0x%08lX] SPU[0x%08lX]\n",$psw,$cbr,$spi,$spu + printf "BPC[0x%08lX] PC[0x%08lX] ACCL[0x%08lX] ACCH[0x%08lX]\n",$bpc,$pc,$accl,$acch + printf "EVB[0x%08lX]\n",$evb +end + +# Setup all +define setup + use_mon_code + set *(unsigned int)0xfffffffc=0x60 + shell sleep 0.1 + clock_init + shell sleep 0.1 + # SDRAM: 16MB + set *(unsigned long *)0x00ef6020 = 0x08000002 + cfc_init + # USB + set *(unsigned short *)0xb0301000 = 0x100 + + set $evb=0x08000000 +end + +# Load modules +define load_modules + use_debug_dma + load +end + +# Set kernel parameters +define set_kernel_parameters + set $param = (void*)0x08002000 + # INITRD_START + set *(unsigned long *)($param + 0x0010) = 0x082a0000 + # INITRD_SIZE + set *(unsigned long *)($param + 0x0014) = 0x00000000 + # M32R_CPUCLK + set *(unsigned long *)($param + 0x0018) = 0d200000000 + # M32R_BUSCLK + set *(unsigned long *)($param + 0x001c) = 0d50000000 + + # M32R_TIMER_DIVIDE + set *(unsigned long *)($param + 0x0020) = 0d128 + + set {char[0x200]}($param + 0x100) = "console=ttyD0,115200n8x console=tty1 video=s1d13xxxfb:mode:240x320-16 root=/dev/nfsroot nfsroot=192.168.0.1:/project/m32r-linux/export/rootfs,rsize=1024,wsize=1024 nfsaddrs=192.168.0.101:192.168.0.1:192.168.0.1:255.255.255.0:mappi001 mem=16M \0" +end + +# Boot +define boot + set_kernel_parameters + set $fp = 0 + set $pc = 0x08001000 + set *(unsigned char *)0xffffffff = 0x03 + si + c +end + +# Set breakpoints +define set_breakpoints + b *0x08000030 +end + +# Restart +define restart + sdireset + sdireset + set $pc = 0 + b *0x04001000 + b *0x08001000 + b *0x08002000 + si + c + tlb_init + del + setup + load_modules + boot +end + +define si + stepi + x/i $pc + show_reg +end + +sdireset +sdireset +file vmlinux +target m32rsdi +set $pc = 0 +b *0x04001000 +b *0x08001000 +b *0x08002000 +c +tlb_init +del +setup +load_modules +boot + diff -Nru a/arch/m32r/m32700ut/dot.gdbinit_300MHz_32MB b/arch/m32r/m32700ut/dot.gdbinit_300MHz_32MB --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/m32700ut/dot.gdbinit_300MHz_32MB 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,249 @@ +# .gdbinit file +# $Id: dot.gdbinit_300MHz_32MB,v 1.1 2004/08/17 02:58:11 takata Exp $ +#----- +# NOTE: this file is generated by a script, "gen_gdbinit.pl". +# (Please type "gen_gdbinit.pl --help" and check the help message). +# $ Id: gen_gdbinit.pl,v 1.12 2004/07/26 09:56:10 takata Exp $ +#----- +# target platform: m32700ut + +# setting +set width 0d70 +set radix 0d16 + +debug_chaos + +# clk xin:cpu:bif:bus=25:300:75:75 +define clock_init + set *(unsigned long *)0x00ef4008 = 0x00000000 + set *(unsigned long *)0x00ef4004 = 0 + shell sleep 0.1 + # NOTE: Please change the master clock source from PLL-clock to Xin-clock + # and switch off PLL, before resetting the clock gear ratio. + + set *(unsigned long *)0x00ef4024 = 2 + set *(unsigned long *)0x00ef4020 = 2 + set *(unsigned long *)0x00ef4010 = 0 + set *(unsigned long *)0x00ef4014 = 0 + set *(unsigned long *)0x00ef4004 = 5 + shell sleep 0.1 + set *(unsigned long *)0x00ef4008 = 0x00000200 +end + +# Initialize SDRAM controller +define sdram_init + # SDIR0 + set *(unsigned long *)0x00ef6008 = 0x00000182 + # SDIR1 + set *(unsigned long *)0x00ef600c = 0x00000001 + # Initialize wait + shell sleep 0.1 + # Ch0-MOD + set *(unsigned long *)0x00ef602c = 0x00000020 + # Ch0-TR + set *(unsigned long *)0x00ef6028 = 0x00051502 + # Ch0-ADR (size:16MB) + set *(unsigned long *)0x00ef6020 = 0x08000002 + # AutoRef On + set *(unsigned long *)0x00ef6004 = 0x00010e24 + # Access enable + set *(unsigned long *)0x00ef6024 = 0x00000001 +end +document sdram_init + SDRAM controller initialization + 0x08000000 - 0x08ffffff (16MB) +end + +# Initialize BSEL3 for UT-CFC +define cfc_init + set $sfrbase = 0xa0ef0000 +# too fast +# set *(unsigned long *)($sfrbase + 0x5300) = 0x0b0b8000 +# set *(unsigned long *)($sfrbase + 0x5304) = 0x00102204 +# set *(unsigned long *)($sfrbase + 0x5300) = 0x1f1f8000 +# set *(unsigned long *)($sfrbase + 0x5300) = 0x1f1f1fdf +# set *(unsigned long *)($sfrbase + 0x5304) = 0x0013220f +# set *(unsigned long *)($sfrbase + 0x5304) = 0x0013330f +end +document cfc_init + CF controller initialization +end + +# MMU enable +define mmu_enable + set $evb=0x88000000 + set *(unsigned long *)0xffff0024=1 +end + +# MMU disable +define mmu_disable + set $evb=0 + set *(unsigned long *)0xffff0024=0 +end + +# Show TLB entries +define show_tlb_entries + set $i = 0 + set $addr = $arg0 + set $nr_entries = $arg1 + use_mon_code + while ($i < $nr_entries) + set $tlb_tag = *(unsigned long*)$addr + set $tlb_data = *(unsigned long*)($addr + 4) + printf " [%2d] 0x%08lx : 0x%08lx - 0x%08lx\n", $i, $addr, $tlb_tag, $tlb_data + set $i = $i + 1 + set $addr = $addr + 8 + end + use_debug_dma +end +define itlb + set $itlb=0xfe000000 + show_tlb_entries $itlb 0d32 +end +define dtlb + set $dtlb=0xfe000800 + show_tlb_entries $dtlb 0d32 +end + +# Initialize TLB entries +define init_tlb_entries + set $i = 0 + set $addr = $arg0 + set $nr_entries = $arg1 + use_mon_code + while ($i < $nr_entries) + set *(unsigned long *)($addr + 0x4) = 0 + set $i = $i + 1 + set $addr = $addr + 8 + end + use_debug_dma +end +define tlb_init + set $itlb=0xfe000000 + init_tlb_entries $itlb 0d32 + set $dtlb=0xfe000800 + init_tlb_entries $dtlb 0d32 +end + +# Show current task structure +define show_current + set $current = $spi & 0xffffe000 + printf "$current=0x%08lX\n",$current + print *(struct task_struct *)$current +end + +# Show user assigned task structure +define show_task + set = $arg0 & 0xffffe000 + printf "$task=0x%08lX\n",$task + print *(struct task_struct *)$task +end +document show_task + Show user assigned task structure + arg0 : task structure address +end + +# Show M32R registers +define show_regs + printf " R0[0x%08lX] R1[0x%08lX] R2[0x%08lX] R3[0x%08lX]\n",$r0,$r1,$r2,$r3 + printf " R4[0x%08lX] R5[0x%08lX] R6[0x%08lX] R7[0x%08lX]\n",$r4,$r5,$r6,$r7 + printf " R8[0x%08lX] R9[0x%08lX] R10[0x%08lX] R11[0x%08lX]\n",$r8,$r9,$r10,$r11 + printf "R12[0x%08lX] FP[0x%08lX] LR[0x%08lX] SP[0x%08lX]\n",$r12,$fp,$lr,$sp + printf "PSW[0x%08lX] CBR[0x%08lX] SPI[0x%08lX] SPU[0x%08lX]\n",$psw,$cbr,$spi,$spu + printf "BPC[0x%08lX] PC[0x%08lX] ACCL[0x%08lX] ACCH[0x%08lX]\n",$bpc,$pc,$accl,$acch + printf "EVB[0x%08lX]\n",$evb +end + +# Setup all +define setup + use_mon_code + set *(unsigned int)0xfffffffc=0x60 + shell sleep 0.1 + clock_init + shell sleep 0.1 + # SDRAM: 16MB + set *(unsigned long *)0x00ef6020 = 0x08000002 + cfc_init + # USB + set *(unsigned short *)0xb0301000 = 0x100 + + set $evb=0x08000000 +end + +# Load modules +define load_modules + use_debug_dma + load +end + +# Set kernel parameters +define set_kernel_parameters + set $param = (void*)0x08002000 + # INITRD_START + set *(unsigned long *)($param + 0x0010) = 0x082a0000 + # INITRD_SIZE + set *(unsigned long *)($param + 0x0014) = 0x00000000 + # M32R_CPUCLK + set *(unsigned long *)($param + 0x0018) = 0d300000000 + # M32R_BUSCLK + set *(unsigned long *)($param + 0x001c) = 0d75000000 + + # M32R_TIMER_DIVIDE + set *(unsigned long *)($param + 0x0020) = 0d128 + + set {char[0x200]}($param + 0x100) = "console=ttyD0,115200n8x console=tty1 video=s1d13xxxfb:mode:240x320-16 root=/dev/nfsroot nfsroot=192.168.0.1:/project/m32r-linux/export/rootfs,rsize=1024,wsize=1024 nfsaddrs=192.168.0.101:192.168.0.1:192.168.0.1:255.255.255.0:mappi001 mem=16M \0" +end + +# Boot +define boot + set_kernel_parameters + set $fp = 0 + set $pc = 0x08001000 + set *(unsigned char *)0xffffffff = 0x03 + si + c +end + +# Set breakpoints +define set_breakpoints + b *0x08000030 +end + +# Restart +define restart + sdireset + sdireset + set $pc = 0 + b *0x04001000 + b *0x08001000 + b *0x08002000 + si + c + tlb_init + del + setup + load_modules + boot +end + +define si + stepi + x/i $pc + show_reg +end + +sdireset +sdireset +file vmlinux +target m32rsdi +set $pc = 0 +b *0x04001000 +b *0x08001000 +b *0x08002000 +c +tlb_init +del +setup +load_modules +boot + diff -Nru a/arch/m32r/m32700ut/m32r-flash.c b/arch/m32r/m32700ut/m32r-flash.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/m32700ut/m32r-flash.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,227 @@ +/* + * Flash memory access on M32R based devices + * + * Copyright (C) 2003 Takeo Takahashi + * + * 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. + * + * $Id$ + */ + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +#define WINDOW_ADDR (0xa0000000) /* start of flash memory */ + +static __u8 m32r_read8(struct map_info *map, unsigned long ofs) +{ + return readb(map->map_priv_1 + ofs); +} + +static __u16 m32r_read16(struct map_info *map, unsigned long ofs) +{ + return readw(map->map_priv_1 + ofs); +} + +static __u32 m32r_read32(struct map_info *map, unsigned long ofs) +{ + return readl(map->map_priv_1 + ofs); +} + +static void m32r_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len) +{ + memcpy(to, (void *)(map->map_priv_1 + from), len); +} + +static void m32r_write8(struct map_info *map, __u8 d, unsigned long adr) +{ + writeb(d, map->map_priv_1 + adr); +} + +static void m32r_write16(struct map_info *map, __u16 d, unsigned long adr) +{ + writew(d, map->map_priv_1 + adr); +} + +static void m32r_write32(struct map_info *map, __u32 d, unsigned long adr) +{ + writel(d, map->map_priv_1 + adr); +} + +static void m32r_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len) +{ + memcpy((void *)(map->map_priv_1 + to), from, len); +} + +static struct map_info m32r_map = { + name: "M32R flash", + read8: m32r_read8, + read16: m32r_read16, + read32: m32r_read32, + copy_from: m32r_copy_from, + write8: m32r_write8, + write16: m32r_write16, + write32: m32r_write32, + copy_to: m32r_copy_to, + + map_priv_1: WINDOW_ADDR, + map_priv_2: -1, +}; + +#ifdef CONFIG_PLAT_M32700UT +#define M32700UT_FLASH_SIZE 0x00400000 +static struct mtd_partition m32700ut_partitions[] = { + { + name: "M32700UT boot firmware", + size: 0x30000, /* 192KB */ + offset: 0, + mask_flags: MTD_WRITEABLE, /* force read-only */ + }, { + name: "M32700UT kernel", + size: 0xd0000, /* 832KB */ + offset: MTDPART_OFS_APPEND, + }, { + name: "M32700UT root", + size: 0x2f0000, /* 3008KB */ + offset: MTDPART_OFS_APPEND, + }, { + name: "M32700UT params", + size: MTDPART_SIZ_FULL, /* 64KB */ + offset: MTDPART_OFS_APPEND, + } +}; +#endif + +extern int parse_redboot_partitions(struct mtd_info *master, struct mtd_partition **pparts); +extern int parse_bootldr_partitions(struct mtd_info *master, struct mtd_partition **pparts); + +static struct mtd_partition *parsed_parts; +static struct mtd_info *mymtd; + +int __init m32r_mtd_init(void) +{ + struct mtd_partition *parts; + int nb_parts = 0, ret; + int parsed_nr_parts = 0; + const char *part_type; + unsigned long base = -1UL; + + + /* Default flash buswidth */ + m32r_map.buswidth = 2; + + /* + * Static partition definition selection + */ + part_type = "static"; + +#ifdef CONFIG_PLAT_M32700UT + parts = m32700ut_partitions; + nb_parts = ARRAY_SIZE(m32700ut_partitions); + m32r_map.size = M32700UT_FLASH_SIZE; + m32r_map.buswidth = 2; +#endif + + /* + * For simple flash devices, use ioremap to map the flash. + */ + if (base != (unsigned long)-1) { + if (!request_mem_region(base, m32r_map.size, "flash")) + return -EBUSY; + m32r_map.map_priv_2 = base; + m32r_map.map_priv_1 = (unsigned long) + ioremap(base, m32r_map.size); + ret = -ENOMEM; + if (!m32r_map.map_priv_1) + goto out_err; + } + + /* + * Now let's probe for the actual flash. Do it here since + * specific machine settings might have been set above. + */ + printk(KERN_NOTICE "M32R flash: probing %d-bit flash bus\n", m32r_map.buswidth*8); + mymtd = do_map_probe("m5drv", &m32r_map); + ret = -ENXIO; + if (!mymtd) + goto out_err; + mymtd->module = THIS_MODULE; + + /* + * Dynamic partition selection stuff (might override the static ones) + */ +#ifdef CONFIG_MTD_REDBOOT_PARTS + if (parsed_nr_parts == 0) { + ret = parse_redboot_partitions(mymtd, &parsed_parts); + + if (ret > 0) { + part_type = "RedBoot"; + parsed_nr_parts = ret; + } + } +#endif +#ifdef CONFIG_MTD_BOOTLDR_PARTS + if (parsed_nr_parts == 0) { + ret = parse_bootldr_partitions(mymtd, &parsed_parts); + if (ret > 0) { + part_type = "Compaq bootldr"; + parsed_nr_parts = ret; + } + } +#endif + + if (parsed_nr_parts > 0) { + parts = parsed_parts; + nb_parts = parsed_nr_parts; + } + + if (nb_parts == 0) { + printk(KERN_NOTICE "M32R flash: no partition info available, registering whole flash at once\n"); + add_mtd_device(mymtd); + } else { + printk(KERN_NOTICE "Using %s partition definition\n", part_type); + add_mtd_partitions(mymtd, parts, nb_parts); + } + return 0; + + out_err: + if (m32r_map.map_priv_2 != -1) { + iounmap((void *)m32r_map.map_priv_1); + release_mem_region(m32r_map.map_priv_2, m32r_map.size); + } + return ret; +} + +static void __exit m32r_mtd_cleanup(void) +{ + if (mymtd) { + del_mtd_partitions(mymtd); + map_destroy(mymtd); + if (parsed_parts) + kfree(parsed_parts); + } + if (m32r_map.map_priv_2 != -1) { + iounmap((void *)m32r_map.map_priv_1); + release_mem_region(m32r_map.map_priv_2, m32r_map.size); + } +} + +module_init(m32r_mtd_init); +module_exit(m32r_mtd_cleanup); + +MODULE_AUTHOR("Takeo Takahashi"); +MODULE_DESCRIPTION("M32R Flash map driver"); +MODULE_LICENSE("GPL"); diff -Nru a/arch/m32r/mappi/defconfig.nommu b/arch/m32r/mappi/defconfig.nommu --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/mappi/defconfig.nommu 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,529 @@ +# +# Automatically generated make config: don't edit +# +CONFIG_M32R=y +CONFIG_UID16=y +CONFIG_GENERIC_ISA_DMA=y + +# +# Code maturity level options +# +CONFIG_EXPERIMENTAL=y +CONFIG_CLEAN_COMPILE=y +CONFIG_BROKEN_ON_SMP=y + +# +# General setup +# +# CONFIG_POSIX_MQUEUE is not set +CONFIG_BSD_PROCESS_ACCT=y +# CONFIG_BSD_PROCESS_ACCT_V3 is not set +CONFIG_SYSCTL=y +# CONFIG_AUDIT is not set +CONFIG_LOG_BUF_SHIFT=14 +CONFIG_HOTPLUG=y +CONFIG_IKCONFIG=y +# CONFIG_IKCONFIG_PROC is not set +CONFIG_EMBEDDED=y +# CONFIG_KALLSYMS is not set +# CONFIG_FUTEX is not set +# CONFIG_EPOLL is not set +CONFIG_IOSCHED_NOOP=y +# CONFIG_IOSCHED_AS is not set +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 is not set +CONFIG_OBSOLETE_MODPARM=y +# CONFIG_MODVERSIONS is not set +CONFIG_KMOD=y + +# +# Processor type and features +# +CONFIG_PLAT_MAPPI=y +# CONFIG_PLAT_USRV is not set +# CONFIG_PLAT_M32700UT is not set +# CONFIG_PLAT_OPSPUT is not set +# CONFIG_PLAT_OAKS32R is not set +# CONFIG_PLAT_MAPPI2 is not set +CONFIG_CHIP_M32700=y +# CONFIG_CHIP_M32102 is not set +# CONFIG_CHIP_VDEC2 is not set +# CONFIG_CHIP_OPSP is not set +# CONFIG_MMU is not set +CONFIG_TLB_ENTRIES=32 +CONFIG_ISA_M32R2=y +CONFIG_ISA_DSP_LEVEL2=y +CONFIG_ISA_DUAL_ISSUE=y +CONFIG_BUS_CLOCK=50000000 +CONFIG_TIMER_DIVIDE=128 +# CONFIG_CPU_LITTLE_ENDIAN is not set +CONFIG_MEMORY_START=0x00000000 +CONFIG_MEMORY_SIZE=0x00E00000 +CONFIG_NOHIGHMEM=y +# CONFIG_DISCONTIGMEM is not set +CONFIG_RWSEM_GENERIC_SPINLOCK=y +# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set +CONFIG_PREEMPT=y +# CONFIG_HAVE_DEC_LOCK is not set +# CONFIG_SMP is not set + +# +# M32R drivers +# +# CONFIG_M32RPCC is not set +CONFIG_M32R_NE2000=y + +# +# Power management options (ACPI, APM) +# +# CONFIG_PM is not set + +# +# Bus options (PCI, PCMCIA, EISA, MCA, ISA) +# +# CONFIG_PCI is not set +# CONFIG_ISA is not set + +# +# PCMCIA/CardBus support +# +# CONFIG_PCMCIA is not set + +# +# PCI Hotplug Support +# + +# +# Executable file formats +# +CONFIG_BINFMT_FLAT=y +# CONFIG_BINFMT_ZFLAT is not set +# CONFIG_BINFMT_SHARED_FLAT is not set +# CONFIG_BINFMT_MISC is not set + +# +# Device Drivers +# + +# +# Generic Driver Options +# +CONFIG_STANDALONE=y +CONFIG_PREVENT_FIRMWARE_BUILD=y +# CONFIG_FW_LOADER 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_FD is not set +CONFIG_BLK_DEV_LOOP=y +# CONFIG_BLK_DEV_CRYPTOLOOP is not set +CONFIG_BLK_DEV_NBD=y +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 is not set + +# +# Multi-device support (RAID and LVM) +# +# CONFIG_MD is not set + +# +# Fusion MPT device support +# + +# +# IEEE 1394 (FireWire) support +# + +# +# 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=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=y +CONFIG_IP_PNP_DHCP=y +# CONFIG_IP_PNP_BOOTP is not set +# CONFIG_IP_PNP_RARP is not set +# CONFIG_NET_IPIP is not set +# CONFIG_NET_IPGRE 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_HW_FLOWCONTROL is not set + +# +# QoS and/or fair queueing +# +# CONFIG_NET_SCHED is not set +# CONFIG_NET_CLS_ROUTE 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 is not set +# 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 is not set +# CONFIG_SERIAL_NONSTANDARD is not set + +# +# Serial drivers +# +# CONFIG_SERIAL_8250 is not set + +# +# Non-8250 serial port support +# +CONFIG_SERIAL_CORE=y +CONFIG_SERIAL_CORE_CONSOLE=y +CONFIG_SERIAL_M32R_SIO=y +CONFIG_SERIAL_M32R_SIO_CONSOLE=y +# CONFIG_SERIAL_M32R_PLDSIO is not set +CONFIG_UNIX98_PTYS=y +CONFIG_LEGACY_PTYS=y +CONFIG_LEGACY_PTY_COUNT=256 +# CONFIG_QIC02_TAPE is not set + +# +# IPMI +# +# CONFIG_IPMI_HANDLER is not set + +# +# Watchdog Cards +# +# CONFIG_WATCHDOG is not set +# CONFIG_RTC is not set +# CONFIG_GEN_RTC is not set +# CONFIG_DTLK is not set +# CONFIG_R3964 is not set + +# +# Ftape, the floppy tape device driver +# +# CONFIG_AGP is not set +# CONFIG_DRM is not set +# CONFIG_RAW_DRIVER is not set + +# +# I2C support +# +# CONFIG_I2C is not set + +# +# Dallas's 1-wire bus +# +# CONFIG_W1 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 + +# +# 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 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_MSDOS_FS is not set +# CONFIG_VFAT_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=y +CONFIG_DEVFS_MOUNT=y +# CONFIG_DEVFS_DEBUG is not set +CONFIG_DEVPTS_FS_XATTR=y +CONFIG_DEVPTS_FS_SECURITY=y +# CONFIG_TMPFS is not set +# CONFIG_HUGETLB_PAGE is not set +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=y +# CONFIG_NFS_V4 is not set +# CONFIG_NFS_DIRECTIO is not set +# CONFIG_NFSD is not set +CONFIG_ROOT_NFS=y +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_CODA_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=y +CONFIG_NLS_DEFAULT="iso8859-1" +# CONFIG_NLS_CODEPAGE_437 is not set +# CONFIG_NLS_CODEPAGE_737 is not set +# CONFIG_NLS_CODEPAGE_775 is not set +# CONFIG_NLS_CODEPAGE_850 is not set +# CONFIG_NLS_CODEPAGE_852 is not set +# CONFIG_NLS_CODEPAGE_855 is not set +# CONFIG_NLS_CODEPAGE_857 is not set +# CONFIG_NLS_CODEPAGE_860 is not set +# CONFIG_NLS_CODEPAGE_861 is not set +# CONFIG_NLS_CODEPAGE_862 is not set +# CONFIG_NLS_CODEPAGE_863 is not set +# CONFIG_NLS_CODEPAGE_864 is not set +# CONFIG_NLS_CODEPAGE_865 is not set +# CONFIG_NLS_CODEPAGE_866 is not set +# CONFIG_NLS_CODEPAGE_869 is not set +# CONFIG_NLS_CODEPAGE_936 is not set +# CONFIG_NLS_CODEPAGE_950 is not set +# CONFIG_NLS_CODEPAGE_932 is not set +# CONFIG_NLS_CODEPAGE_949 is not set +# CONFIG_NLS_CODEPAGE_874 is not set +# CONFIG_NLS_ISO8859_8 is not set +# CONFIG_NLS_CODEPAGE_1250 is not set +# CONFIG_NLS_CODEPAGE_1251 is not set +# CONFIG_NLS_ASCII is not set +# CONFIG_NLS_ISO8859_1 is not set +# CONFIG_NLS_ISO8859_2 is not set +# CONFIG_NLS_ISO8859_3 is not set +# CONFIG_NLS_ISO8859_4 is not set +# CONFIG_NLS_ISO8859_5 is not set +# CONFIG_NLS_ISO8859_6 is not set +# CONFIG_NLS_ISO8859_7 is not set +# CONFIG_NLS_ISO8859_9 is not set +# CONFIG_NLS_ISO8859_13 is not set +# CONFIG_NLS_ISO8859_14 is not set +# CONFIG_NLS_ISO8859_15 is not set +# CONFIG_NLS_KOI8_R is not set +# CONFIG_NLS_KOI8_U is not set +# CONFIG_NLS_UTF8 is not set + +# +# Profiling support +# +# CONFIG_PROFILING is not set + +# +# Kernel hacking +# +# CONFIG_DEBUG_KERNEL is not set +# CONFIG_DEBUG_SPINLOCK_SLEEP 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_CRC_CCITT is not set +CONFIG_CRC32=y +# CONFIG_LIBCRC32C is not set diff -Nru a/arch/m32r/mappi/defconfig.smp b/arch/m32r/mappi/defconfig.smp --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/mappi/defconfig.smp 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,646 @@ +# +# Automatically generated make config: don't edit +# +CONFIG_M32R=y +CONFIG_UID16=y +CONFIG_GENERIC_ISA_DMA=y + +# +# Code maturity level options +# +CONFIG_EXPERIMENTAL=y +# CONFIG_CLEAN_COMPILE 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=15 +CONFIG_HOTPLUG=y +CONFIG_IKCONFIG=y +CONFIG_IKCONFIG_PROC=y +CONFIG_EMBEDDED=y +# CONFIG_KALLSYMS is not set +# CONFIG_FUTEX is not set +# CONFIG_EPOLL is not set +CONFIG_IOSCHED_NOOP=y +# CONFIG_IOSCHED_AS is not set +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 is not set +CONFIG_OBSOLETE_MODPARM=y +# CONFIG_MODVERSIONS is not set +CONFIG_KMOD=y +CONFIG_STOP_MACHINE=y + +# +# Processor type and features +# +CONFIG_PLAT_MAPPI=y +# CONFIG_PLAT_USRV is not set +# CONFIG_PLAT_M32700UT is not set +# CONFIG_PLAT_OPSPUT is not set +# CONFIG_PLAT_OAKS32R is not set +# CONFIG_PLAT_MAPPI2 is not set +CONFIG_CHIP_M32700=y +# CONFIG_CHIP_M32102 is not set +# CONFIG_CHIP_VDEC2 is not set +# CONFIG_CHIP_OPSP is not set +CONFIG_MMU=y +CONFIG_TLB_ENTRIES=32 +CONFIG_ISA_M32R2=y +CONFIG_ISA_DSP_LEVEL2=y +CONFIG_ISA_DUAL_ISSUE=y +CONFIG_BUS_CLOCK=10000000 +CONFIG_TIMER_DIVIDE=128 +# CONFIG_CPU_LITTLE_ENDIAN is not set +CONFIG_MEMORY_START=0x08000000 +CONFIG_MEMORY_SIZE=0x04000000 +CONFIG_NOHIGHMEM=y +CONFIG_DISCONTIGMEM=y +CONFIG_IRAM_START=0x00f00000 +CONFIG_IRAM_SIZE=0x00080000 +CONFIG_RWSEM_GENERIC_SPINLOCK=y +# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set +CONFIG_PREEMPT=y +# CONFIG_HAVE_DEC_LOCK is not set +CONFIG_SMP=y +CONFIG_CHIP_M32700_TS1=y +CONFIG_NR_CPUS=2 +# CONFIG_NUMA is not set + +# +# M32R drivers +# +CONFIG_M32RPCC=y +CONFIG_M32R_NE2000=y + +# +# Power management options (ACPI, APM) +# +# CONFIG_PM is not set + +# +# Bus options (PCI, PCMCIA, EISA, MCA, ISA) +# +# CONFIG_PCI is not set +# CONFIG_ISA is not set + +# +# PCMCIA/CardBus support +# +CONFIG_PCMCIA=y +# CONFIG_PCMCIA_DEBUG is not set +# CONFIG_TCIC is not set + +# +# PCI Hotplug Support +# + +# +# Executable file formats +# +CONFIG_BINFMT_ELF=y +# CONFIG_BINFMT_MISC is not set + +# +# Device Drivers +# + +# +# Generic Driver Options +# +# CONFIG_STANDALONE is not set +CONFIG_PREVENT_FIRMWARE_BUILD=y +# CONFIG_FW_LOADER is not set + +# +# Memory Technology Devices (MTD) +# +CONFIG_MTD=y +# CONFIG_MTD_DEBUG is not set +CONFIG_MTD_PARTITIONS=y +# CONFIG_MTD_CONCAT is not set +CONFIG_MTD_REDBOOT_PARTS=y +# CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED is not set +# CONFIG_MTD_REDBOOT_PARTS_READONLY is not set +# CONFIG_MTD_CMDLINE_PARTS is not set + +# +# User Modules And Translation Layers +# +CONFIG_MTD_CHAR=y +CONFIG_MTD_BLOCK=y +# CONFIG_FTL is not set +# CONFIG_NFTL is not set +# CONFIG_INFTL is not set + +# +# RAM/ROM/Flash chip drivers +# +# CONFIG_MTD_CFI is not set +# CONFIG_MTD_JEDECPROBE is not set +CONFIG_MTD_MAP_BANK_WIDTH_1=y +CONFIG_MTD_MAP_BANK_WIDTH_2=y +CONFIG_MTD_MAP_BANK_WIDTH_4=y +# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set +# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set +# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set +CONFIG_MTD_CFI_I1=y +CONFIG_MTD_CFI_I2=y +# CONFIG_MTD_CFI_I4 is not set +# CONFIG_MTD_CFI_I8 is not set +# CONFIG_MTD_RAM is not set +# CONFIG_MTD_ROM is not set +# CONFIG_MTD_ABSENT is not set +# CONFIG_MTD_OBSOLETE_CHIPS is not set + +# +# Mapping drivers for chip access +# +# CONFIG_MTD_COMPLEX_MAPPINGS is not set + +# +# Self-contained MTD device drivers +# +# CONFIG_MTD_SLRAM is not set +# CONFIG_MTD_PHRAM is not set +# CONFIG_MTD_MTDRAM is not set +# CONFIG_MTD_BLKMTD is not set + +# +# Disk-On-Chip Device Drivers +# +# 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 +# +# CONFIG_PARPORT is not set + +# +# Plug and Play support +# + +# +# Block devices +# +# CONFIG_BLK_DEV_FD is not set +CONFIG_BLK_DEV_LOOP=y +# CONFIG_BLK_DEV_CRYPTOLOOP is not set +CONFIG_BLK_DEV_NBD=m +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_SIZE=4096 +CONFIG_BLK_DEV_INITRD=y + +# +# ATA/ATAPI/MFM/RLL support +# +CONFIG_IDE=m +CONFIG_BLK_DEV_IDE=m + +# +# Please see Documentation/ide.txt for help/info on IDE drives +# +# CONFIG_BLK_DEV_IDE_SATA is not set +CONFIG_BLK_DEV_IDEDISK=m +# CONFIG_IDEDISK_MULTI_MODE is not set +CONFIG_BLK_DEV_IDECS=m +CONFIG_BLK_DEV_IDECD=m +# CONFIG_BLK_DEV_IDETAPE is not set +# CONFIG_BLK_DEV_IDEFLOPPY is not set +# CONFIG_IDE_TASK_IOCTL is not set +# CONFIG_IDE_TASKFILE_IO is not set + +# +# IDE chipset support/bugfixes +# +CONFIG_IDE_GENERIC=m +# CONFIG_IDE_ARM is not set +# CONFIG_BLK_DEV_IDEDMA is not set +# CONFIG_IDEDMA_AUTO is not set +# CONFIG_BLK_DEV_HD is not set + +# +# SCSI device support +# +# CONFIG_SCSI 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 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=y +CONFIG_IP_PNP_DHCP=y +# CONFIG_IP_PNP_BOOTP is not set +# CONFIG_IP_PNP_RARP is not set +# CONFIG_NET_IPIP is not set +# CONFIG_NET_IPGRE 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_HW_FLOWCONTROL is not set + +# +# QoS and/or fair queueing +# +# CONFIG_NET_SCHED is not set +# CONFIG_NET_CLS_ROUTE 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 is not set +# 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 is not set +# CONFIG_SERIAL_NONSTANDARD is not set + +# +# Serial drivers +# +# CONFIG_SERIAL_8250 is not set + +# +# Non-8250 serial port support +# +CONFIG_SERIAL_CORE=y +CONFIG_SERIAL_CORE_CONSOLE=y +CONFIG_SERIAL_M32R_SIO=y +CONFIG_SERIAL_M32R_SIO_CONSOLE=y +# CONFIG_SERIAL_M32R_PLDSIO is not set +CONFIG_UNIX98_PTYS=y +CONFIG_LEGACY_PTYS=y +CONFIG_LEGACY_PTY_COUNT=256 +# CONFIG_QIC02_TAPE is not set + +# +# IPMI +# +# CONFIG_IPMI_HANDLER is not set + +# +# Watchdog Cards +# +# CONFIG_WATCHDOG is not set +# CONFIG_RTC is not set +# CONFIG_GEN_RTC is not set +# CONFIG_DTLK is not set +# CONFIG_R3964 is not set + +# +# Ftape, the floppy tape device driver +# +# CONFIG_AGP is not set +# CONFIG_DRM is not set + +# +# PCMCIA character devices +# +# CONFIG_SYNCLINK_CS is not set +# CONFIG_RAW_DRIVER is not set + +# +# I2C support +# +# CONFIG_I2C is not set + +# +# Dallas's 1-wire bus +# +# CONFIG_W1 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 + +# +# 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 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=y +# CONFIG_QUOTA is not set +# CONFIG_AUTOFS_FS is not set +# CONFIG_AUTOFS4_FS is not set + +# +# CD-ROM/DVD Filesystems +# +CONFIG_ISO9660_FS=y +# CONFIG_JOLIET is not set +# CONFIG_ZISOFS is not set +# CONFIG_UDF_FS is not set + +# +# DOS/FAT/NT Filesystems +# +CONFIG_FAT_FS=m +CONFIG_MSDOS_FS=m +CONFIG_VFAT_FS=m +CONFIG_FAT_DEFAULT_CODEPAGE=437 +CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" +# CONFIG_NTFS_FS is not set + +# +# Pseudo filesystems +# +CONFIG_PROC_FS=y +CONFIG_PROC_KCORE=y +CONFIG_SYSFS=y +CONFIG_DEVFS_FS=y +CONFIG_DEVFS_MOUNT=y +# CONFIG_DEVFS_DEBUG is not set +# CONFIG_DEVPTS_FS_XATTR is not set +CONFIG_TMPFS=y +# CONFIG_HUGETLBFS is not set +# CONFIG_HUGETLB_PAGE is not set +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_JFFS_FS=y +CONFIG_JFFS_FS_VERBOSE=0 +CONFIG_JFFS_PROC_FS=y +CONFIG_JFFS2_FS=y +CONFIG_JFFS2_FS_DEBUG=0 +# CONFIG_JFFS2_FS_NAND is not set +# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set +CONFIG_JFFS2_ZLIB=y +CONFIG_JFFS2_RTIME=y +# CONFIG_JFFS2_RUBIN 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=y +# CONFIG_NFS_V4 is not set +# CONFIG_NFS_DIRECTIO is not set +# CONFIG_NFSD is not set +CONFIG_ROOT_NFS=y +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_CODA_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=y +CONFIG_NLS_DEFAULT="iso8859-1" +# CONFIG_NLS_CODEPAGE_437 is not set +# CONFIG_NLS_CODEPAGE_737 is not set +# CONFIG_NLS_CODEPAGE_775 is not set +# CONFIG_NLS_CODEPAGE_850 is not set +# CONFIG_NLS_CODEPAGE_852 is not set +# CONFIG_NLS_CODEPAGE_855 is not set +# CONFIG_NLS_CODEPAGE_857 is not set +# CONFIG_NLS_CODEPAGE_860 is not set +# CONFIG_NLS_CODEPAGE_861 is not set +# CONFIG_NLS_CODEPAGE_862 is not set +# CONFIG_NLS_CODEPAGE_863 is not set +# CONFIG_NLS_CODEPAGE_864 is not set +# CONFIG_NLS_CODEPAGE_865 is not set +# CONFIG_NLS_CODEPAGE_866 is not set +# CONFIG_NLS_CODEPAGE_869 is not set +# CONFIG_NLS_CODEPAGE_936 is not set +# CONFIG_NLS_CODEPAGE_950 is not set +# CONFIG_NLS_CODEPAGE_932 is not set +# CONFIG_NLS_CODEPAGE_949 is not set +# CONFIG_NLS_CODEPAGE_874 is not set +# CONFIG_NLS_ISO8859_8 is not set +# CONFIG_NLS_CODEPAGE_1250 is not set +# CONFIG_NLS_CODEPAGE_1251 is not set +# CONFIG_NLS_ASCII is not set +# CONFIG_NLS_ISO8859_1 is not set +# CONFIG_NLS_ISO8859_2 is not set +# CONFIG_NLS_ISO8859_3 is not set +# CONFIG_NLS_ISO8859_4 is not set +# CONFIG_NLS_ISO8859_5 is not set +# CONFIG_NLS_ISO8859_6 is not set +# CONFIG_NLS_ISO8859_7 is not set +# CONFIG_NLS_ISO8859_9 is not set +# CONFIG_NLS_ISO8859_13 is not set +# CONFIG_NLS_ISO8859_14 is not set +# CONFIG_NLS_ISO8859_15 is not set +# CONFIG_NLS_KOI8_R is not set +# CONFIG_NLS_KOI8_U is not set +# CONFIG_NLS_UTF8 is not set + +# +# Profiling support +# +# CONFIG_PROFILING is not set + +# +# Kernel hacking +# +# CONFIG_DEBUG_KERNEL is not set +# CONFIG_DEBUG_SPINLOCK_SLEEP 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_CRC_CCITT is not set +CONFIG_CRC32=y +# CONFIG_LIBCRC32C is not set +CONFIG_ZLIB_INFLATE=y +CONFIG_ZLIB_DEFLATE=y diff -Nru a/arch/m32r/mappi/defconfig.up b/arch/m32r/mappi/defconfig.up --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/mappi/defconfig.up 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,642 @@ +# +# Automatically generated make config: don't edit +# +CONFIG_M32R=y +CONFIG_UID16=y +CONFIG_GENERIC_ISA_DMA=y + +# +# Code maturity level options +# +CONFIG_EXPERIMENTAL=y +# CONFIG_CLEAN_COMPILE 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=14 +CONFIG_HOTPLUG=y +CONFIG_IKCONFIG=y +CONFIG_IKCONFIG_PROC=y +CONFIG_EMBEDDED=y +# CONFIG_KALLSYMS is not set +# CONFIG_FUTEX is not set +# CONFIG_EPOLL is not set +CONFIG_IOSCHED_NOOP=y +# CONFIG_IOSCHED_AS is not set +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 is not set +CONFIG_OBSOLETE_MODPARM=y +# CONFIG_MODVERSIONS is not set +CONFIG_KMOD=y + +# +# Processor type and features +# +CONFIG_PLAT_MAPPI=y +# CONFIG_PLAT_USRV is not set +# CONFIG_PLAT_M32700UT is not set +# CONFIG_PLAT_OPSPUT is not set +# CONFIG_PLAT_OAKS32R is not set +# CONFIG_PLAT_MAPPI2 is not set +CONFIG_CHIP_M32700=y +# CONFIG_CHIP_M32102 is not set +# CONFIG_CHIP_VDEC2 is not set +# CONFIG_CHIP_OPSP is not set +CONFIG_MMU=y +CONFIG_TLB_ENTRIES=32 +CONFIG_ISA_M32R2=y +CONFIG_ISA_DSP_LEVEL2=y +CONFIG_ISA_DUAL_ISSUE=y +CONFIG_BUS_CLOCK=10000000 +CONFIG_TIMER_DIVIDE=128 +# CONFIG_CPU_LITTLE_ENDIAN is not set +CONFIG_MEMORY_START=0x08000000 +CONFIG_MEMORY_SIZE=0x04000000 +CONFIG_NOHIGHMEM=y +CONFIG_DISCONTIGMEM=y +CONFIG_IRAM_START=0x00f00000 +CONFIG_IRAM_SIZE=0x00080000 +CONFIG_RWSEM_GENERIC_SPINLOCK=y +# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set +CONFIG_PREEMPT=y +# CONFIG_HAVE_DEC_LOCK is not set +# CONFIG_SMP is not set + +# +# M32R drivers +# +CONFIG_M32RPCC=y +CONFIG_M32R_NE2000=y + +# +# Power management options (ACPI, APM) +# +# CONFIG_PM is not set + +# +# Bus options (PCI, PCMCIA, EISA, MCA, ISA) +# +# CONFIG_PCI is not set +# CONFIG_ISA is not set + +# +# PCMCIA/CardBus support +# +CONFIG_PCMCIA=y +# CONFIG_PCMCIA_DEBUG is not set +# CONFIG_TCIC is not set + +# +# PCI Hotplug Support +# + +# +# Executable file formats +# +CONFIG_BINFMT_ELF=y +# CONFIG_BINFMT_MISC is not set + +# +# Device Drivers +# + +# +# Generic Driver Options +# +# CONFIG_STANDALONE is not set +CONFIG_PREVENT_FIRMWARE_BUILD=y +# CONFIG_FW_LOADER is not set + +# +# Memory Technology Devices (MTD) +# +CONFIG_MTD=y +# CONFIG_MTD_DEBUG is not set +CONFIG_MTD_PARTITIONS=y +# CONFIG_MTD_CONCAT is not set +CONFIG_MTD_REDBOOT_PARTS=y +# CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED is not set +# CONFIG_MTD_REDBOOT_PARTS_READONLY is not set +# CONFIG_MTD_CMDLINE_PARTS is not set + +# +# User Modules And Translation Layers +# +CONFIG_MTD_CHAR=y +CONFIG_MTD_BLOCK=y +# CONFIG_FTL is not set +# CONFIG_NFTL is not set +# CONFIG_INFTL is not set + +# +# RAM/ROM/Flash chip drivers +# +# CONFIG_MTD_CFI is not set +# CONFIG_MTD_JEDECPROBE is not set +CONFIG_MTD_MAP_BANK_WIDTH_1=y +CONFIG_MTD_MAP_BANK_WIDTH_2=y +CONFIG_MTD_MAP_BANK_WIDTH_4=y +# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set +# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set +# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set +CONFIG_MTD_CFI_I1=y +CONFIG_MTD_CFI_I2=y +# CONFIG_MTD_CFI_I4 is not set +# CONFIG_MTD_CFI_I8 is not set +# CONFIG_MTD_RAM is not set +# CONFIG_MTD_ROM is not set +# CONFIG_MTD_ABSENT is not set +# CONFIG_MTD_OBSOLETE_CHIPS is not set + +# +# Mapping drivers for chip access +# +# CONFIG_MTD_COMPLEX_MAPPINGS is not set + +# +# Self-contained MTD device drivers +# +# CONFIG_MTD_SLRAM is not set +# CONFIG_MTD_PHRAM is not set +# CONFIG_MTD_MTDRAM is not set +# CONFIG_MTD_BLKMTD is not set + +# +# Disk-On-Chip Device Drivers +# +# 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 +# +# CONFIG_PARPORT is not set + +# +# Plug and Play support +# + +# +# Block devices +# +# CONFIG_BLK_DEV_FD is not set +CONFIG_BLK_DEV_LOOP=y +# CONFIG_BLK_DEV_CRYPTOLOOP is not set +CONFIG_BLK_DEV_NBD=m +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_SIZE=4096 +CONFIG_BLK_DEV_INITRD=y + +# +# ATA/ATAPI/MFM/RLL support +# +CONFIG_IDE=m +CONFIG_BLK_DEV_IDE=m + +# +# Please see Documentation/ide.txt for help/info on IDE drives +# +# CONFIG_BLK_DEV_IDE_SATA is not set +CONFIG_BLK_DEV_IDEDISK=m +# CONFIG_IDEDISK_MULTI_MODE is not set +CONFIG_BLK_DEV_IDECS=m +CONFIG_BLK_DEV_IDECD=m +# CONFIG_BLK_DEV_IDETAPE is not set +# CONFIG_BLK_DEV_IDEFLOPPY is not set +# CONFIG_IDE_TASK_IOCTL is not set +# CONFIG_IDE_TASKFILE_IO is not set + +# +# IDE chipset support/bugfixes +# +CONFIG_IDE_GENERIC=m +# CONFIG_IDE_ARM is not set +# CONFIG_BLK_DEV_IDEDMA is not set +# CONFIG_IDEDMA_AUTO is not set +# CONFIG_BLK_DEV_HD is not set + +# +# SCSI device support +# +# CONFIG_SCSI 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 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=y +CONFIG_IP_PNP_DHCP=y +# CONFIG_IP_PNP_BOOTP is not set +# CONFIG_IP_PNP_RARP is not set +# CONFIG_NET_IPIP is not set +# CONFIG_NET_IPGRE 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_HW_FLOWCONTROL is not set + +# +# QoS and/or fair queueing +# +# CONFIG_NET_SCHED is not set +# CONFIG_NET_CLS_ROUTE 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 is not set +# 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 is not set +# CONFIG_SERIAL_NONSTANDARD is not set + +# +# Serial drivers +# +# CONFIG_SERIAL_8250 is not set + +# +# Non-8250 serial port support +# +CONFIG_SERIAL_CORE=y +CONFIG_SERIAL_CORE_CONSOLE=y +CONFIG_SERIAL_M32R_SIO=y +CONFIG_SERIAL_M32R_SIO_CONSOLE=y +# CONFIG_SERIAL_M32R_PLDSIO is not set +CONFIG_UNIX98_PTYS=y +CONFIG_LEGACY_PTYS=y +CONFIG_LEGACY_PTY_COUNT=256 +# CONFIG_QIC02_TAPE is not set + +# +# IPMI +# +# CONFIG_IPMI_HANDLER is not set + +# +# Watchdog Cards +# +# CONFIG_WATCHDOG is not set +# CONFIG_RTC is not set +# CONFIG_GEN_RTC is not set +# CONFIG_DTLK is not set +# CONFIG_R3964 is not set + +# +# Ftape, the floppy tape device driver +# +# CONFIG_AGP is not set +# CONFIG_DRM is not set + +# +# PCMCIA character devices +# +# CONFIG_SYNCLINK_CS is not set +# CONFIG_RAW_DRIVER is not set + +# +# I2C support +# +# CONFIG_I2C is not set + +# +# Dallas's 1-wire bus +# +# CONFIG_W1 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 + +# +# 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 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=y +# CONFIG_QUOTA is not set +# CONFIG_AUTOFS_FS is not set +# CONFIG_AUTOFS4_FS is not set + +# +# CD-ROM/DVD Filesystems +# +CONFIG_ISO9660_FS=y +# CONFIG_JOLIET is not set +# CONFIG_ZISOFS is not set +# CONFIG_UDF_FS is not set + +# +# DOS/FAT/NT Filesystems +# +CONFIG_FAT_FS=m +CONFIG_MSDOS_FS=m +CONFIG_VFAT_FS=m +CONFIG_FAT_DEFAULT_CODEPAGE=437 +CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" +# CONFIG_NTFS_FS is not set + +# +# Pseudo filesystems +# +CONFIG_PROC_FS=y +CONFIG_PROC_KCORE=y +CONFIG_SYSFS=y +CONFIG_DEVFS_FS=y +CONFIG_DEVFS_MOUNT=y +# CONFIG_DEVFS_DEBUG is not set +# CONFIG_DEVPTS_FS_XATTR is not set +CONFIG_TMPFS=y +# CONFIG_HUGETLBFS is not set +# CONFIG_HUGETLB_PAGE is not set +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_JFFS_FS=y +CONFIG_JFFS_FS_VERBOSE=0 +CONFIG_JFFS_PROC_FS=y +CONFIG_JFFS2_FS=y +CONFIG_JFFS2_FS_DEBUG=0 +# CONFIG_JFFS2_FS_NAND is not set +# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set +CONFIG_JFFS2_ZLIB=y +CONFIG_JFFS2_RTIME=y +# CONFIG_JFFS2_RUBIN 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=y +# CONFIG_NFS_V4 is not set +# CONFIG_NFS_DIRECTIO is not set +# CONFIG_NFSD is not set +CONFIG_ROOT_NFS=y +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_CODA_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=y +CONFIG_NLS_DEFAULT="iso8859-1" +# CONFIG_NLS_CODEPAGE_437 is not set +# CONFIG_NLS_CODEPAGE_737 is not set +# CONFIG_NLS_CODEPAGE_775 is not set +# CONFIG_NLS_CODEPAGE_850 is not set +# CONFIG_NLS_CODEPAGE_852 is not set +# CONFIG_NLS_CODEPAGE_855 is not set +# CONFIG_NLS_CODEPAGE_857 is not set +# CONFIG_NLS_CODEPAGE_860 is not set +# CONFIG_NLS_CODEPAGE_861 is not set +# CONFIG_NLS_CODEPAGE_862 is not set +# CONFIG_NLS_CODEPAGE_863 is not set +# CONFIG_NLS_CODEPAGE_864 is not set +# CONFIG_NLS_CODEPAGE_865 is not set +# CONFIG_NLS_CODEPAGE_866 is not set +# CONFIG_NLS_CODEPAGE_869 is not set +# CONFIG_NLS_CODEPAGE_936 is not set +# CONFIG_NLS_CODEPAGE_950 is not set +# CONFIG_NLS_CODEPAGE_932 is not set +# CONFIG_NLS_CODEPAGE_949 is not set +# CONFIG_NLS_CODEPAGE_874 is not set +# CONFIG_NLS_ISO8859_8 is not set +# CONFIG_NLS_CODEPAGE_1250 is not set +# CONFIG_NLS_CODEPAGE_1251 is not set +# CONFIG_NLS_ASCII is not set +# CONFIG_NLS_ISO8859_1 is not set +# CONFIG_NLS_ISO8859_2 is not set +# CONFIG_NLS_ISO8859_3 is not set +# CONFIG_NLS_ISO8859_4 is not set +# CONFIG_NLS_ISO8859_5 is not set +# CONFIG_NLS_ISO8859_6 is not set +# CONFIG_NLS_ISO8859_7 is not set +# CONFIG_NLS_ISO8859_9 is not set +# CONFIG_NLS_ISO8859_13 is not set +# CONFIG_NLS_ISO8859_14 is not set +# CONFIG_NLS_ISO8859_15 is not set +# CONFIG_NLS_KOI8_R is not set +# CONFIG_NLS_KOI8_U is not set +# CONFIG_NLS_UTF8 is not set + +# +# Profiling support +# +# CONFIG_PROFILING is not set + +# +# Kernel hacking +# +# CONFIG_DEBUG_KERNEL is not set +# CONFIG_DEBUG_SPINLOCK_SLEEP 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_CRC_CCITT is not set +CONFIG_CRC32=y +# CONFIG_LIBCRC32C is not set +CONFIG_ZLIB_INFLATE=y +CONFIG_ZLIB_DEFLATE=y diff -Nru a/arch/m32r/mappi/dot.gdbinit b/arch/m32r/mappi/dot.gdbinit --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/mappi/dot.gdbinit 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,242 @@ +# .gdbinit file +# $Id$ +#----- +# NOTE: this file is generated by a script, "gen_gdbinit.pl". +# (Please type "gen_gdbinit.pl --help" and check the help message). +# $ Id: gen_gdbinit.pl,v 1.8 2004/02/27 07:08:32 takata Exp $ +#----- +# target platform: mappi + +# setting +set width 0d70 +set radix 0d16 +debug_chaos + +# clk xin:cpu:bif:bus=30:360:180:90 +define clock_init + set *(unsigned long *)0x00ef4024 = 2 + set *(unsigned long *)0x00ef4020 = 1 + set *(unsigned long *)0x00ef4010 = 0 + set *(unsigned long *)0x00ef4014 = 0 + set *(unsigned long *)0x00ef4004 = 5 + shell sleep 0.1 + set *(unsigned long *)0x00ef4008 = 0x00000200 +end + +# Initialize programmable ports +define port_init + set $sfrbase = 0x00ef0000 + set *(unsigned short *)0x00ef1060 = 0x5555 + set *(unsigned short *)0x00ef1062 = 0x5555 + set *(unsigned short *)0x00ef1064 = 0x5555 + set *(unsigned short *)0x00ef1066 = 0x5555 + set *(unsigned short *)0x00ef1068 = 0x5555 + set *(unsigned short *)0x00ef106a = 0x0000 + set *(unsigned short *)0x00ef106e = 0x5555 + set *(unsigned short *)0x00ef1070 = 0x5555 + # LED ON + set *(unsigned char *)($sfrbase + 0x1015) = 0xff + set *(unsigned char *)($sfrbase + 0x1085) = 0xff + shell sleep 0.1 + # LED OFF + set *(unsigned char *)($sfrbase + 0x1085) = 0x00 +end +document port_init + P5=LED(output), P6.b4=LAN_RESET(output) +end + +# Initialize SDRAM controller +define sdram_init + # SDIR0 + set *(unsigned long *)0x00ef6008 = 0x00000182 + # SDIR1 + set *(unsigned long *)0x00ef600c = 0x00000001 + # Initialize wait + shell sleep 0.1 + # Ch0-MOD + set *(unsigned long *)0x00ef602c = 0x00000020 + # Ch0-TR + set *(unsigned long *)0x00ef6028 = 0x00051502 + # Ch0-ADR (size:64MB) + set *(unsigned long *)0x00ef6020 = 0x08000004 + # AutoRef On + set *(unsigned long *)0x00ef6004 = 0x00010e2b + # Access enable + set *(unsigned long *)0x00ef6024 = 0x00000001 +end +document sdram_init + SDRAM controller initialization + 0x08000000 - 0x0bffffff (64MB) +end + +# Initialize LAN controller +define lanc_init + set $sfrbase = 0x00ef0000 + # Set BSEL3 (BSEL3 for the Chaos's bselc) + set *(unsigned long *)($sfrbase + 0x5300) = 0x0a0a8040 + set *(unsigned long *)($sfrbase + 0x5304) = 0x01120203 + set *(unsigned long *)($sfrbase + 0x5308) = 0x00000001 + # Reset (P5=LED,P6.b4=LAN_RESET) + set *(unsigned short *)($sfrbase + 0x106c) = 0x0000 + set *(unsigned char *)($sfrbase + 0x1016) = 0xff + set *(unsigned char *)($sfrbase + 0x1086) = 0xff + shell sleep 0.1 + # swivel: 0=normal, 4=reverse +# set *(unsigned char *)($sfrbase + 0x1086) = 0x00 + set *(unsigned char *)($sfrbase + 0x1086) = 0x04 + set *(unsigned long *)(0x0c000330) = 0xffffffff + # Set mac address + set $lanc = (void*)0x0c000300 + set *(unsigned long *)($lanc + 0x0000) = 0x00610010 + set *(unsigned long *)($lanc + 0x0004) = 0x00200030 + set *(unsigned long *)($lanc + 0x0008) = 0x00400050 + set *(unsigned long *)($lanc + 0x000c) = 0x00600007 +end +document lanc_init + LAN controller initialization + ex.) MAC address: 10 20 30 40 50 60 +end + +# LCD & CRT dual-head setting (8bpp) +define dispc_init + set $sfrbase = 0x00ef0000 + # BSEL4 Dispc + set *(unsigned long *)($sfrbase + 0x5400) = 0x0e0e8000 + set *(unsigned long *)($sfrbase + 0x5404) = 0x0012220a +end + +# MMU enable +define mmu_enable + set $evb=0x88000000 + set *(unsigned long *)0xffff0024=1 +end + +# MMU disable +define mmu_disable + set $evb=0 + set *(unsigned long *)0xffff0024=0 +end + +# Show TLB entries +define show_tlb_entries + set $i = 0 + set $addr = $arg0 + set $nr_entries = $arg1 + use_mon_code + while ($i < $nr_entries) + set $tlb_tag = *(unsigned long*)$addr + set $tlb_data = *(unsigned long*)($addr + 4) + printf " [%2d] 0x%08lx : 0x%08lx - 0x%08lx\n", $i, $addr, $tlb_tag, $tlb_data + set $i = $i + 1 + set $addr = $addr + 8 + end + use_debug_dma +end +define itlb + set $itlb=0xfe000000 + show_tlb_entries $itlb 0d32 +end +define dtlb + set $dtlb=0xfe000800 + show_tlb_entries $dtlb 0d32 +end + +# Show current task structure +define show_current + set $current = $spi & 0xffffe000 + printf "$current=0x%08lX\n",$current + print *(struct task_struct *)$current +end + +# Show user assigned task structure +define show_task + set = $arg0 & 0xffffe000 + printf "$task=0x%08lX\n",$task + print *(struct task_struct *)$task +end +document show_task + Show user assigned task structure + arg0 : task structure address +end + +# Show M32R registers +define show_regs + printf " R0[0x%08lX] R1[0x%08lX] R2[0x%08lX] R3[0x%08lX]\n",$r0,$r1,$r2,$r3 + printf " R4[0x%08lX] R5[0x%08lX] R6[0x%08lX] R7[0x%08lX]\n",$r4,$r5,$r6,$r7 + printf " R8[0x%08lX] R9[0x%08lX] R10[0x%08lX] R11[0x%08lX]\n",$r8,$r9,$r10,$r11 + printf "R12[0x%08lX] FP[0x%08lX] LR[0x%08lX] SP[0x%08lX]\n",$r12,$fp,$lr,$sp + printf "PSW[0x%08lX] CBR[0x%08lX] SPI[0x%08lX] SPU[0x%08lX]\n",$psw,$cbr,$spi,$spu + printf "BPC[0x%08lX] PC[0x%08lX] ACCL[0x%08lX] ACCH[0x%08lX]\n",$bpc,$pc,$accl,$acch + printf "EVB[0x%08lX]\n",$evb +end + +# Setup all +define setup + use_mon_code + set *(unsigned int)0xfffffffc=0x60 + shell sleep 0.1 + clock_init + shell sleep 0.1 + port_init + sdram_init + lanc_init + dispc_init + set $evb=0x08000000 +end + +# Load modules +define load_modules + use_debug_dma + load +end + +# Set kernel parameters +define set_kernel_parameters + set $param = (void*)0x08002000 + # INITRD_START + set *(unsigned long *)($param + 0x0010) = 0x082a0000 + # INITRD_SIZE + set *(unsigned long *)($param + 0x0014) = 0x00000000 + # M32R_CPUCLK + set *(unsigned long *)($param + 0x0018) = 0d360000000 + # M32R_BUSCLK + set *(unsigned long *)($param + 0x001c) = 0d90000000 + + # M32R_TIMER_DIVIDE + set *(unsigned long *)($param + 0x0020) = 0d128 + + set {char[0x200]}($param + 0x100) = "console=ttyD0,115200n8x root=/dev/nfsroot nfsroot=192.168.0.1:/project/m32r-linux/export/root.x nfsaddrs=192.168.0.101:192.168.0.1:192.168.0.1:255.255.255.0:mappi001 \0" +end + +# Boot +define boot + set_kernel_parameters + set $fp = 0 + set $pc=0x08001000 + si + c +end + +# Set breakpoints +define set_breakpoints + b *0x08000030 +end + +# Restart +define restart + sdireset + sdireset + setup + load_modules + boot +end + +sdireset +sdireset +file vmlinux +target m32rsdi +setup +#load_module +#set_breakpoints +#boot + diff -Nru a/arch/m32r/mappi/dot.gdbinit.nommu b/arch/m32r/mappi/dot.gdbinit.nommu --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/mappi/dot.gdbinit.nommu 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,245 @@ +# .gdbinit file +# $Id$ +#----- +# NOTE: this file is generated by a script, "gen_gdbinit.pl". +# (Please type "gen_gdbinit.pl --help" and check the help message). +# $ Id: gen_gdbinit.pl,v 1.5 2004/01/23 08:23:25 takata Exp $ +#----- +# target platform: mappi + +# setting +set width 0d70 +set radix 0d16 +debug_chaos + +# clk xin:cpu:bif:bus=25:200:50:50 +define clock_init + set *(unsigned long *)0x00ef4024 = 2 + set *(unsigned long *)0x00ef4020 = 2 + set *(unsigned long *)0x00ef4010 = 0 + set *(unsigned long *)0x00ef4014 = 0 + set *(unsigned long *)0x00ef4004 = 3 + shell sleep 0.1 + set *(unsigned long *)0x00ef4008 = 0x00000200 +end + +# Initialize programmable ports +define port_init + set $sfrbase = 0x00ef0000 + set *(unsigned short *)0x00ef1060 = 0x5555 + set *(unsigned short *)0x00ef1062 = 0x5555 + set *(unsigned short *)0x00ef1064 = 0x5555 + set *(unsigned short *)0x00ef1066 = 0x5555 + set *(unsigned short *)0x00ef1068 = 0x5555 + set *(unsigned short *)0x00ef106a = 0x0000 + set *(unsigned short *)0x00ef106e = 0x5555 + set *(unsigned short *)0x00ef1070 = 0x5555 + # LED ON + set *(unsigned char *)($sfrbase + 0x1015) = 0xff + set *(unsigned char *)($sfrbase + 0x1085) = 0xff + shell sleep 0.1 + # LED OFF + set *(unsigned char *)($sfrbase + 0x1085) = 0x00 +end +document port_init + P5=LED(output), P6.b4=LAN_RESET(output) +end + +# Initialize SDRAM controller +define sdram_init + # SDIR0 + set *(unsigned long *)0x00ef6008 = 0x00000182 + # SDIR1 + set *(unsigned long *)0x00ef600c = 0x00000001 + # Initialize wait + shell sleep 0.1 + # Ch0-MOD + set *(unsigned long *)0x00ef602c = 0x00000020 + # Ch0-TR + set *(unsigned long *)0x00ef6028 = 0x00051502 + # Ch0-ADR (size:64MB) + set *(unsigned long *)0x00ef6020 = 0x00000004 + # AutoRef On + set *(unsigned long *)0x00ef6004 = 0x00010f05 + # Access enable + set *(unsigned long *)0x00ef6024 = 0x00000001 +end +document sdram_init + SDRAM controller initialization + 0x08000000 - 0x0bffffff (64MB) +end + +# Initialize LAN controller +define lanc_init + set $sfrbase = 0x00ef0000 + # Set BSEL3 (BSEL3 for the Chaos's bselc) + set *(unsigned long *)($sfrbase + 0x5300) = 0x07078040 + set *(unsigned long *)($sfrbase + 0x5304) = 0x01110102 + set *(unsigned long *)($sfrbase + 0x5308) = 0x00000001 + # Reset (P5=LED,P6.b4=LAN_RESET) + set *(unsigned short *)($sfrbase + 0x106c) = 0x0000 + set *(unsigned char *)($sfrbase + 0x1016) = 0xff + set *(unsigned char *)($sfrbase + 0x1086) = 0xff + shell sleep 0.1 + # swivel: 0=normal, 4=reverse +# set *(unsigned char *)($sfrbase + 0x1086) = 0x00 + set *(unsigned char *)($sfrbase + 0x1086) = 0x04 + set *(unsigned long *)(0x0c000330) = 0xffffffff + # Set mac address + set $lanc = (void*)0x0c000300 + set *(unsigned long *)($lanc + 0x0000) = 0x00610010 + set *(unsigned long *)($lanc + 0x0004) = 0x00200030 + set *(unsigned long *)($lanc + 0x0008) = 0x00400050 + set *(unsigned long *)($lanc + 0x000c) = 0x00600007 +end +document lanc_init + LAN controller initialization + ex.) MAC address: 10 20 30 40 50 60 +end + +# LCD & CRT dual-head setting (8bpp) +define dispc_init + set $sfrbase = 0x00ef0000 + # BSEL4 Dispc + set *(unsigned long *)($sfrbase + 0x5400) = 0x06078000 + set *(unsigned long *)($sfrbase + 0x5404) = 0x00101101 +end + +# MMU enable +define mmu_enable + set $evb=0x88000000 + set *(unsigned long *)0xffff0024=1 +end + +# MMU disable +define mmu_disable + set $evb=0 + set *(unsigned long *)0xffff0024=0 +end + +# Show TLB entries +define show_tlb_entries + set $i = 0 + set $addr = $arg0 + set $nr_entries = $arg1 + use_mon_code + while ($i < $nr_entries) + set $tlb_tag = *(unsigned long*)$addr + set $tlb_data = *(unsigned long*)($addr + 4) + printf " [%2d] 0x%08lx : 0x%08lx - 0x%08lx\n", $i, $addr, $tlb_tag, $tlb_data + set $i = $i + 1 + set $addr = $addr + 8 + end + use_debug_dma +end +define itlb + set $itlb=0xfe000000 + show_tlb_entries $itlb 0d32 +end +define dtlb + set $dtlb=0xfe000800 + show_tlb_entries $dtlb 0d32 +end + +# Show current task structure +define show_current + set $current = $spi & 0xffffe000 + printf "$current=0x%08lX\n",$current + print *(struct task_struct *)$current +end + +# Show user assigned task structure +define show_task + set = $arg0 & 0xffffe000 + printf "$task=0x%08lX\n",$task + print *(struct task_struct *)$task +end +document show_task + Show user assigned task structure + arg0 : task structure address +end + +# Show M32R registers +define show_regs + printf " R0[0x%08lX] R1[0x%08lX] R2[0x%08lX] R3[0x%08lX]\n",$r0,$r1,$r2,$r3 + printf " R4[0x%08lX] R5[0x%08lX] R6[0x%08lX] R7[0x%08lX]\n",$r4,$r5,$r6,$r7 + printf " R8[0x%08lX] R9[0x%08lX] R10[0x%08lX] R11[0x%08lX]\n",$r8,$r9,$r10,$r11 + printf "R12[0x%08lX] FP[0x%08lX] LR[0x%08lX] SP[0x%08lX]\n",$r12,$fp,$lr,$sp + printf "PSW[0x%08lX] CBR[0x%08lX] SPI[0x%08lX] SPU[0x%08lX]\n",$psw,$cbr,$spi,$spu + printf "BPC[0x%08lX] PC[0x%08lX] ACCL[0x%08lX] ACCH[0x%08lX]\n",$bpc,$pc,$accl,$acch + printf "EVB[0x%08lX]\n",$evb +end + +# Setup all +define setup + use_mon_code + set *(unsigned int)0xfffffffc=0x60 + shell sleep 0.1 + clock_init + shell sleep 0.1 + port_init + sdram_init + lanc_init + dispc_init + set $evb=0x00000000 +end + +# Load modules +define load_modules + use_debug_dma + load +end + +# Set kernel parameters +define set_kernel_parameters + set $param = (void*)0x00002000 + # INITRD_START + #set *(unsigned long *)($param + 0x0010) = 0x082a0000 + # INITRD_SIZE + #set *(unsigned long *)($param + 0x0014) = 0x00000000 + # M32R_CPUCLK + set *(unsigned long *)($param + 0x0018) = 0d200000000 + # M32R_BUSCLK + set *(unsigned long *)($param + 0x001c) = 0d50000000 + + # M32R_TIMER_DIVIDE + set *(unsigned long *)($param + 0x0020) = 0d128 + + set {char[0x200]}($param + 0x100) = "console=ttyD0,115200n8x root=/dev/nfsroot nfsroot=192.168.0.1:/project/m32r-linux/export/root.bbox-httpd nfsaddrs=192.168.0.101:192.168.0.1:192.168.0.1:255.255.255.0:mappi001 \0" +end + +# Boot +define boot + set_kernel_parameters + set $fp = 0 + set $pc=0x00001000 + set *(long *)0xfffffff4=0x8080 +# b load_flat_binary +# set *(unsigned char *)0x08001003=0x63 +# set *(unsigned char *)0x08001003=0x02 + si +# c +end + +# Set breakpoints +define set_breakpoints + b *0x08000030 +end + +# Restart +define restart + sdireset + sdireset + setup + load_modules + boot +end + +sdireset +sdireset +file vmlinux +target m32rsdi +setup +load_modules +boot + diff -Nru a/arch/m32r/mappi/dot.gdbinit.smp b/arch/m32r/mappi/dot.gdbinit.smp --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/mappi/dot.gdbinit.smp 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,344 @@ +# .gdbinit file +# $Id$ + +# setting +set width 0d70 +set radix 0d16 +debug_chaos + +# clk xin:cpu:bif:bus=1:4:2:1 +define clock_init_on + set *(unsigned long *)0x00ef4024 = 2 + set *(unsigned long *)0x00ef4020 = 1 + set *(unsigned long *)0x00ef4010 = 0 + set *(unsigned long *)0x00ef4014 = 0 + set *(unsigned long *)0x00ef4004 = 0x1 + shell sleep 0.1 + set *(unsigned long *)0x00ef4008 = 0x0200 +# set *(unsigned long *)0x00ef4008 = 0x0201 +end + +# clk xin:cpu:bif:bus=1:4:1:1 +define clock_init_on_1411 + set *(unsigned long *)0x00ef4024 = 2 + set *(unsigned long *)0x00ef4020 = 2 + set *(unsigned long *)0x00ef4010 = 0 + set *(unsigned long *)0x00ef4014 = 0 + set *(unsigned long *)0x00ef4004 = 0x1 + shell sleep 0.1 + set *(unsigned long *)0x00ef4008 = 0x0200 +end + +# clk xin:cpu:bif:bus=1:4:2:1 +define clock_init_on_1421 + set *(unsigned long *)0x00ef4024 = 2 + set *(unsigned long *)0x00ef4020 = 1 + set *(unsigned long *)0x00ef4010 = 0 + set *(unsigned long *)0x00ef4014 = 0 + set *(unsigned long *)0x00ef4004 = 0x1 + shell sleep 0.1 + set *(unsigned long *)0x00ef4008 = 0x0200 +end + +# clk xin:cpu:bif:bus=1:8:2:1 +define clock_init_on_1821 + set *(unsigned long *)0x00ef4024 = 3 + set *(unsigned long *)0x00ef4020 = 2 + set *(unsigned long *)0x00ef4010 = 0 + set *(unsigned long *)0x00ef4014 = 0 + set *(unsigned long *)0x00ef4004 = 0x3 + shell sleep 0.1 + set *(unsigned long *)0x00ef4008 = 0x0200 +end + +# clk xin:cpu:bif:bus=1:8:4:1 +define clock_init_on_1841 + set *(unsigned long *)0x00ef4024 = 3 + set *(unsigned long *)0x00ef4020 = 1 + set *(unsigned long *)0x00ef4010 = 0 + set *(unsigned long *)0x00ef4014 = 0 + set *(unsigned long *)0x00ef4004 = 0x3 + shell sleep 0.1 + set *(unsigned long *)0x00ef4008 = 0x0200 +end + +# clk xin:cpu:bif:bus=1:16:8:1 +define clock_init_on_11681 + set *(unsigned long *)0x00ef4024 = 4 + set *(unsigned long *)0x00ef4020 = 2 + set *(unsigned long *)0x00ef4010 = 0 + set *(unsigned long *)0x00ef4014 = 0 + set *(unsigned long *)0x00ef4004 = 0x7 + shell sleep 0.1 + set *(unsigned long *)0x00ef4008 = 0x0200 +end + +# clk xin:cpu:bif:bus=1:1:1:1 +define clock_init_off + # CPU + set *(unsigned long *)0x00ef4010 = 0 + set *(unsigned long *)0x00ef4014 = 0 + # BIF + set *(unsigned long *)0x00ef4020 = 0 + # BUS + set *(unsigned long *)0x00ef4024 = 0 + # PLL + set *(unsigned long *)0x00ef4008 = 0x0000 +end + +# Initialize programmable ports +define port_init + set $sfrbase = 0x00ef0000 + set *(unsigned short *)0x00ef1060 = 0x5555 + set *(unsigned short *)0x00ef1062 = 0x5555 + set *(unsigned short *)0x00ef1064 = 0x5555 + set *(unsigned short *)0x00ef1066 = 0x5555 + set *(unsigned short *)0x00ef1068 = 0x5555 + set *(unsigned short *)0x00ef106a = 0x0000 + set *(unsigned short *)0x00ef106e = 0x5555 + set *(unsigned short *)0x00ef1070 = 0x5555 + # LED ON + set *(unsigned char *)($sfrbase + 0x1015) = 0xff + set *(unsigned char *)($sfrbase + 0x1085) = 0xff + shell sleep 0.1 + # LED OFF + set *(unsigned char *)($sfrbase + 0x1085) = 0x00 +end +document port_init + P5=LED(output), P6.b4=LAN_RESET(output) +end + +# Initialize SDRAM controller for Mappi +define sdram_init + # SDIR0 + set *(unsigned long *)0x00ef6008 = 0x00000182 + # SDIR1 + set *(unsigned long *)0x00ef600c = 0x00000001 + # Initialize wait + shell sleep 0.1 + # Ch0-MOD + set *(unsigned long *)0x00ef602c = 0x00000020 + # Ch0-TR + set *(unsigned long *)0x00ef6028 = 0x00010002 + # Ch0-ADR + set *(unsigned long *)0x00ef6020 = 0x08000004 + # AutoRef On + set *(unsigned long *)0x00ef6004 = 0x00010107 + # Access enable + set *(unsigned long *)0x00ef6024 = 0x00000001 +end +document sdram_init + Mappi SDRAM controller initialization + 0x08000000 - 0x0bffffff (64MB) +end + +# Initialize LAN controller for Mappi +define lanc_init + set $sfrbase = 0x00ef0000 + # Set BSEL3 (BSEL3 for the Chaos's bselc) +# set *(unsigned long *)($sfrbase + 0x5300) = 0x01018040 +# set *(unsigned long *)($sfrbase + 0x5304) = 0x01011101 + set *(unsigned long *)($sfrbase + 0x5300) = 0x04048000 + set *(unsigned long *)($sfrbase + 0x5304) = 0x01011103 + set *(unsigned long *)($sfrbase + 0x5308) = 0x00000001 + # Reset (P5=LED,P6.b4=LAN_RESET) + set *(unsigned short *)($sfrbase + 0x106c) = 0x0000 + set *(unsigned char *)($sfrbase + 0x1016) = 0xff + set *(unsigned char *)($sfrbase + 0x1086) = 0xff + shell sleep 0.1 +# set *(unsigned char *)($sfrbase + 0x1086) = 0x00 + set *(unsigned char *)($sfrbase + 0x1086) = 0x04 + set *(unsigned long *)(0x0c000330) = 0xffffffff + # Set mac address + set $lanc = (void*)0x0c000300 + set *(unsigned long *)($lanc + 0x0000) = 0x00610010 + set *(unsigned long *)($lanc + 0x0004) = 0x00200030 + set *(unsigned long *)($lanc + 0x0008) = 0x00400050 + set *(unsigned long *)($lanc + 0x000c) = 0x00600007 +end +document lanc_init + Mappi LAN controller initialization + ex.) MAC address: 10 20 30 40 50 60 +end + +# LCD & CRT dual-head setting (8bpp) +define dispc_init + set $sfrbase = 0x00ef0000 + # BSEL4 Dispc + # 20MHz +# set *(unsigned long *)($sfrbase + 0x5400) = 0x02028282 +# set *(unsigned long *)($sfrbase + 0x5404) = 0x00122202 + # 40MHz + set *(unsigned long *)($sfrbase + 0x5400) = 0x04048000 + set *(unsigned long *)($sfrbase + 0x5404) = 0x00101103 +end + +# MMU enable +define mmu_enable + set $evb=0x88000000 + set *(unsigned long *)0xffff0024=1 +end + +# MMU disable +define mmu_disable + set $evb=0 + set *(unsigned long *)0xffff0024=0 +end + +# Show TLB entries +define show_tlb_entries + set $i = 0 + set $addr = $arg0 + use_mon_code + while ($i < 0d32 ) + set $tlb_tag = *(unsigned long*)$addr + set $tlb_data = *(unsigned long*)($addr + 4) + printf " [%2d] 0x%08lx : 0x%08lx - 0x%08lx\n", $i, $addr, $tlb_tag, $tlb_data + set $i = $i + 1 + set $addr = $addr + 8 + end + use_debug_dma +end +define itlb + set $itlb=0xfe000000 + show_tlb_entries $itlb +end +define dtlb + set $dtlb=0xfe000800 + show_tlb_entries $dtlb +end + + +# Show current task structure +define show_current + set $current = $spi & 0xffffe000 + printf "$current=0x%08lX\n",$current + print *(struct task_struct *)$current +end + +# Show user assigned task structure +define show_task + set $task = $arg0 & 0xffffe000 + printf "$task=0x%08lX\n",$task + print *(struct task_struct *)$task +end +document show_task + Show user assigned task structure + arg0 : task structure address +end + +# Show M32R registers +define show_regs + printf " R0[0x%08lX] R1[0x%08lX] R2[0x%08lX] R3[0x%08lX]\n",$r0,$r1,$r2,$r3 + printf " R4[0x%08lX] R5[0x%08lX] R6[0x%08lX] R7[0x%08lX]\n",$r4,$r5,$r6,$r7 + printf " R8[0x%08lX] R9[0x%08lX] R10[0x%08lX] R11[0x%08lX]\n",$r8,$r9,$r10,$r11 + printf "R12[0x%08lX] FP[0x%08lX] LR[0x%08lX] SP[0x%08lX]\n",$r12,$fp,$lr,$fp + printf "PSW[0x%08lX] CBR[0x%08lX] SPI[0x%08lX] SPU[0x%08lX]\n",$psw,$cbr,$spi,$spu + printf "BPC[0x%08lX] PC[0x%08lX] ACCL[0x%08lX] ACCH[0x%08lX]\n",$bpc,$pc,$accl,$acch + printf "EVB[0x%08lX]\n",$evb +end + + +# Setup all +define setup + use_mon_code + set *(unsigned int)0xfffffffc=0x60 + shell sleep 0.1 +# clock_init_on_1411 + clock_init_on_1421 +# clock_init_on_1821 +# clock_init_on_1841 +# clock_init_on_11681 +# clock_init_off + shell sleep 0.1 + port_init + sdram_init + lanc_init + dispc_init + set $evb=0x08000000 +end + +# Load modules +define load_modules + use_debug_dma + load +# load ramdisk_082a0000.mot +# load romfs_082a0000.mot +# use_mon_code +end + +# Set kernel parameters +define set_kernel_parameters + set $param = (void*)0x08002000 + # INITRD_START +# set *(unsigned long *)($param + 0x0010) = 0x082a0000 + # INITRD_SIZE + set *(unsigned long *)($param + 0x0014) = 0x00000000 + # M32R_CPUCLK + set *(unsigned long *)($param + 0x0018) = 0d160000000 +# set *(unsigned long *)($param + 0x0018) = 0d80000000 +# set *(unsigned long *)($param + 0x0018) = 0d40000000 + # M32R_BUSCLK + set *(unsigned long *)($param + 0x001c) = 0d40000000 + + # M32R_TIMER_DIVIDE + set *(unsigned long *)($param + 0x0020) = 0d128 + + set {char[0x200]}($param + 0x100) = "console=tty1 console=ttyD0,115200n8x root=/dev/nfsroot nfsroot=192.168.0.1:/project/m32r-linux/export/root.x nfsaddrs=192.168.0.101:192.168.0.1:192.168.0.1:255.255.255.0:mappi001 \0" +# set {char[0x200]}($param + 0x100) = "console=tty1 root=/dev/nfsroot nfsroot=192.168.0.1:/project/m32r-linux/export/root.x nfsaddrs=192.168.0.101:192.168.0.1:192.168.0.1:255.255.255.0:mappi001 \0" +end + +# Boot +define boot + set_kernel_parameters + set $pc=0x08001000 + set *(unsigned char *)0x08001003=0x03 + si + c +end + +# Set breakpoints +define set_breakpoints + b *0x08000030 +end + +## Boot MP +define boot_mp + set_kernel_parameters + set *(unsigned long *)0x00f00000 = boot - 0x80000000 + set *(unsigned long *)0x00eff2f8 = 0x2 + x 0x00eff2f8 + + set $pc=0x08001000 + si + c +end +document boot_mp + Boot BSP +end + +## Boot UP +define boot_up + set_kernel_parameters + set $pc=0x08001000 + si + c +end +document boot_up + Boot BSP +end + +# Restart +define restart + sdireset + sdireset + setup + load_modules + boot_mp +end + +sdireset +sdireset +file vmlinux +target m32rsdi +setup diff -Nru a/arch/m32r/mm/Makefile b/arch/m32r/mm/Makefile --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/mm/Makefile 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,12 @@ +# +# Makefile for the Linux M32R-specific parts of the memory manager. +# + +ifdef CONFIG_MMU +obj-y := init.o fault.o mmu.o extable.o ioremap.o cache.o page.o +else +obj-y := init.o fault-nommu.o mmu.o extable.o ioremap-nommu.o cache.o page.o +endif + +obj-$(CONFIG_DISCONTIGMEM) += discontig.o + diff -Nru a/arch/m32r/mm/cache.c b/arch/m32r/mm/cache.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/mm/cache.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,68 @@ +/* + * linux/arch/m32r/mm/cache.c + * + * Copyright (C) 2002 Hirokazu Takata + */ + +/* $Id$ */ + +#include +#include + +#undef MCCR + +#if defined(CONFIG_CHIP_XNUX2) || defined(CONFIG_CHIP_M32700) || defined(CONFIG_CHIP_VDEC2) || defined(CONFIG_CHIP_OPSP) +/* Cache Control Register */ +#define MCCR ((volatile unsigned long*)0xfffffffc) +#define MCCR_CC (1UL << 7) /* Cache mode modify bit */ +#define MCCR_IIV (1UL << 6) /* I-cache invalidate */ +#define MCCR_DIV (1UL << 5) /* D-cache invalidate */ +#define MCCR_DCB (1UL << 4) /* D-cache copy back */ +#define MCCR_ICM (1UL << 1) /* I-cache mode [0:off,1:on] */ +#define MCCR_DCM (1UL << 0) /* D-cache mode [0:off,1:on] */ +#define MCCR_ICACHE_INV (MCCR_CC|MCCR_IIV) +#define MCCR_DCACHE_CB (MCCR_CC|MCCR_DCB) +#define MCCR_DCACHE_CBINV (MCCR_CC|MCCR_DIV|MCCR_DCB) +#define CHECK_MCCR(mccr) (mccr = *MCCR) +#elif defined(CONFIG_CHIP_M32102) +#define MCCR ((volatile unsigned long*)0xfffffffc) +#define MCCR_IIV (1UL << 8) /* I-cache invalidate */ +#define MCCR_ICACHE_INV MCCR_IIV +#endif /* CONFIG_CHIP_XNUX2 || CONFIG_CHIP_M32700 */ + +#ifndef MCCR +#error Unknown cache type. +#endif + + +/* Copy back and invalidate D-cache and invalidate I-cache all */ +void _flush_cache_all(void) +{ +#if defined(CONFIG_CHIP_M32102) + *MCCR = MCCR_ICACHE_INV; +#else + unsigned long mccr; + + /* Copyback and invalidate D-cache */ + /* Invalidate I-cache */ + *MCCR = MCCR_ICACHE_INV | MCCR_DCACHE_CBINV; + while ((mccr = *MCCR) & MCCR_IIV); /* loop while invalidating... */ +#endif +} + +/* Copy back D-cache and invalidate I-cache all */ +void _flush_cache_copyback_all(void) +{ +#if defined(CONFIG_CHIP_M32102) + *MCCR = MCCR_ICACHE_INV; +#else + unsigned long mccr; + + /* Copyback D-cache */ + /* Invalidate I-cache */ + *MCCR = MCCR_ICACHE_INV | MCCR_DCACHE_CB; + while ((mccr = *MCCR) & MCCR_IIV); /* loop while invalidating... */ + +#endif +} + diff -Nru a/arch/m32r/mm/discontig.c b/arch/m32r/mm/discontig.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/mm/discontig.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,170 @@ +/* + * linux/arch/m32r/mm/discontig.c + * + * Discontig memory support + * + * Copyright (c) 2003 Hitoshi Yamamoto + */ + +#include +#include +#include +#include +#include + +#include + +extern char _end[]; + +struct pglist_data *node_data[MAX_NUMNODES]; +static bootmem_data_t node_bdata[MAX_NUMNODES] __initdata; + +pg_data_t m32r_node_data[MAX_NUMNODES]; + +/* Memory profile */ +typedef struct { + unsigned long start_pfn; + unsigned long pages; + unsigned long holes; + unsigned long free_pfn; +} mem_prof_t; +static mem_prof_t mem_prof[MAX_NUMNODES]; + +static void __init mem_prof_init(void) +{ + unsigned long start_pfn, holes, free_pfn; + const unsigned long zone_alignment = 1UL << (MAX_ORDER - 1); + unsigned long ul; + mem_prof_t *mp; + + /* Node#0 SDRAM */ + mp = &mem_prof[0]; + mp->start_pfn = PFN_UP(CONFIG_MEMORY_START); + mp->pages = PFN_DOWN(CONFIG_MEMORY_SIZE); + mp->holes = 0; + mp->free_pfn = PFN_UP(__pa(_end)); + + /* Node#1 internal SRAM */ + mp = &mem_prof[1]; + start_pfn = free_pfn = PFN_UP(CONFIG_IRAM_START); + holes = 0; + if (start_pfn & (zone_alignment - 1)) { + ul = zone_alignment; + while (start_pfn >= ul) + ul += zone_alignment; + + start_pfn = ul - zone_alignment; + holes = free_pfn - start_pfn; + } + + mp->start_pfn = start_pfn; + mp->pages = PFN_DOWN(CONFIG_IRAM_SIZE) + holes; + mp->holes = holes; + mp->free_pfn = PFN_UP(CONFIG_IRAM_START); +} + +unsigned long __init setup_memory(void) +{ + unsigned long bootmap_size; + unsigned long min_pfn; + int nid; + mem_prof_t *mp; + + max_low_pfn = 0; + min_low_pfn = -1; + + mem_prof_init(); + + for (nid = 0 ; nid < numnodes ; nid++) { + mp = &mem_prof[nid]; + NODE_DATA(nid)=(pg_data_t *)&m32r_node_data[nid]; + NODE_DATA(nid)->bdata = &node_bdata[nid]; + min_pfn = mp->start_pfn; + max_pfn = mp->start_pfn + mp->pages; + bootmap_size = init_bootmem_node(NODE_DATA(nid), mp->free_pfn, + mp->start_pfn, max_pfn); + + free_bootmem_node(NODE_DATA(nid), PFN_PHYS(mp->start_pfn), + PFN_PHYS(mp->pages)); + + reserve_bootmem_node(NODE_DATA(nid), PFN_PHYS(mp->start_pfn), + PFN_PHYS(mp->free_pfn - mp->start_pfn) + bootmap_size); + + if (max_low_pfn < max_pfn) + max_low_pfn = max_pfn; + + if (min_low_pfn > min_pfn) + min_low_pfn = min_pfn; + } + +#ifdef CONFIG_BLK_DEV_INITRD + if (LOADER_TYPE && INITRD_START) { + if (INITRD_START + INITRD_SIZE <= PFN_PHYS(max_low_pfn)) { + reserve_bootmem_node(NODE_DATA(0), INITRD_START, + INITRD_SIZE); + initrd_start = INITRD_START ? + INITRD_START + PAGE_OFFSET : 0; + + initrd_end = initrd_start + INITRD_SIZE; + printk("initrd:start[%08lx],size[%08lx]\n", + initrd_start, INITRD_SIZE); + } else { + printk("initrd extends beyond end of memory " + "(0x%08lx > 0x%08lx)\ndisabling initrd\n", + INITRD_START + INITRD_SIZE, + PFN_PHYS(max_low_pfn)); + + initrd_start = 0; + } + } +#endif /* CONFIG_BLK_DEV_INITRD */ + + return max_low_pfn; +} + +#define START_PFN(nid) \ + (NODE_DATA(nid)->bdata->node_boot_start >> PAGE_SHIFT) +#define MAX_LOW_PFN(nid) (NODE_DATA(nid)->bdata->node_low_pfn) + +unsigned long __init zone_sizes_init(void) +{ + unsigned long zones_size[MAX_NR_ZONES], zholes_size[MAX_NR_ZONES]; + unsigned long low, start_pfn; + unsigned long holes = 0; + int nid, i; + mem_prof_t *mp; + + pgdat_list = NULL; + for (nid = numnodes - 1 ; nid >= 0 ; nid--) { + NODE_DATA(nid)->pgdat_next = pgdat_list; + pgdat_list = NODE_DATA(nid); + } + + for (nid = 0 ; nid < numnodes ; nid++) { + mp = &mem_prof[nid]; + for (i = 0 ; i < MAX_NR_ZONES ; i++) { + zones_size[i] = 0; + zholes_size[i] = 0; + } + start_pfn = START_PFN(nid); + low = MAX_LOW_PFN(nid); + zones_size[ZONE_DMA] = low - start_pfn; + zholes_size[ZONE_DMA] = mp->holes; + holes += zholes_size[ZONE_DMA]; + + free_area_init_node(nid, NODE_DATA(nid), zones_size, + start_pfn, zholes_size); + } + + /* + * For test + * Use all area of internal RAM. + * see __alloc_pages() + */ + NODE_DATA(1)->node_zones->pages_min = 0; + NODE_DATA(1)->node_zones->pages_low = 0; + NODE_DATA(1)->node_zones->pages_high = 0; + + return holes; +} + diff -Nru a/arch/m32r/mm/extable.c b/arch/m32r/mm/extable.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/mm/extable.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,22 @@ +/* + * linux/arch/i386/mm/extable.c + */ + +#include +#include +#include +#include + +int fixup_exception(struct pt_regs *regs) +{ + const struct exception_table_entry *fixup; + + fixup = search_exception_tables(regs->bpc); + if (fixup) { + regs->bpc = fixup->fixup; + return 1; + } + + return 0; +} + diff -Nru a/arch/m32r/mm/fault-nommu.c b/arch/m32r/mm/fault-nommu.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/mm/fault-nommu.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,164 @@ +/* + * linux/arch/m32r/mm/fault.c + * + * Copyright (c) 2001, 2002 Hitoshi Yamamoto, and H. Kondo + * + * Some code taken from i386 version. + * Copyright (C) 1995 Linus Torvalds + */ + +/* $Id: fault-nommu.c,v 1.1 2004/03/30 06:40:59 sakugawa Exp $ */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +extern void die(const char *, struct pt_regs *, long); + +#ifndef CONFIG_SMP +asmlinkage unsigned int tlb_entry_i_dat; +asmlinkage unsigned int tlb_entry_d_dat; +#define tlb_entry_i tlb_entry_i_dat +#define tlb_entry_d tlb_entry_d_dat +#else +unsigned int tlb_entry_i_dat[NR_CPUS]; +unsigned int tlb_entry_d_dat[NR_CPUS]; +#define tlb_entry_i tlb_entry_i_dat[smp_processor_id()] +#define tlb_entry_d tlb_entry_d_dat[smp_processor_id()] +#endif + +/* + * Unlock any spinlocks which will prevent us from getting the + * message out + */ +void bust_spinlocks(int yes) +{ + int loglevel_save = console_loglevel; + + if (yes) { + oops_in_progress = 1; + return; + } +#ifdef CONFIG_VT + unblank_screen(); +#endif + oops_in_progress = 0; + /* + * OK, the message is on the console. Now we call printk() + * without oops_in_progress set so that printk will give klogd + * a poke. Hold onto your hats... + */ + console_loglevel = 15; /* NMI oopser may have shut the console up */ + printk(" "); + console_loglevel = loglevel_save; +} + +void do_BUG(const char *file, int line) +{ + bust_spinlocks(1); + printk("kernel BUG at %s:%d!\n", file, line); +} + +/*======================================================================* + * do_page_fault() + *======================================================================* + * This routine handles page faults. It determines the address, + * and the problem, and then passes it off to one of the appropriate + * routines. + * + * ARGUMENT: + * regs : M32R SP reg. + * error_code : See below + * address : M32R MMU MDEVA reg. (Operand ACE) + * : M32R BPC reg. (Instruction ACE) + * + * error_code : + * bit 0 == 0 means no page found, 1 means protection fault + * bit 1 == 0 means read, 1 means write + * bit 2 == 0 means kernel, 1 means user-mode + *======================================================================*/ +asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long error_code, + unsigned long address) +{ + +/* + * Oops. The kernel tried to access some bad page. We'll have to + * terminate things with extreme prejudice. + */ + + bust_spinlocks(1); + + if (address < PAGE_SIZE) + printk(KERN_ALERT "Unable to handle kernel NULL pointer dereference"); + else + printk(KERN_ALERT "Unable to handle kernel paging request"); + printk(" at virtual address %08lx\n",address); + printk(" printing bpc:\n"); + printk(KERN_ALERT "bpc = %08lx\n", regs->bpc); + + die("Oops", regs, error_code); + bust_spinlocks(0); + do_exit(SIGKILL); +} + +/*======================================================================* + * update_mmu_cache() + *======================================================================*/ +void update_mmu_cache(struct vm_area_struct *vma, unsigned long addr, + pte_t pte) +{ + BUG(); +} + +/*======================================================================* + * flush_tlb_page() : flushes one page + *======================================================================*/ +void local_flush_tlb_page(struct vm_area_struct *vma, unsigned long page) +{ + BUG(); +} + +/*======================================================================* + * flush_tlb_range() : flushes a range of pages + *======================================================================*/ +void local_flush_tlb_range(struct vm_area_struct *vma, unsigned long start, + unsigned long end) +{ + BUG(); +} + +/*======================================================================* + * flush_tlb_mm() : flushes the specified mm context TLB's + *======================================================================*/ +void local_flush_tlb_mm(struct mm_struct *mm) +{ + BUG(); +} + +/*======================================================================* + * flush_tlb_all() : flushes all processes TLBs + *======================================================================*/ +void local_flush_tlb_all(void) +{ + BUG(); +} + diff -Nru a/arch/m32r/mm/fault.c b/arch/m32r/mm/fault.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/mm/fault.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,572 @@ +/* + * linux/arch/m32r/mm/fault.c + * + * Copyright (c) 2001, 2002 Hitoshi Yamamoto, and H. Kondo + * + * Some code taken from i386 version. + * Copyright (C) 1995 Linus Torvalds + */ + +/* $Id$ */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include /* For unblank_screen() */ +#include +#include + +#include +#include +#include +#include +#include +#include + +extern void die(const char *, struct pt_regs *, long); + +#ifndef CONFIG_SMP +asmlinkage unsigned int tlb_entry_i_dat; +asmlinkage unsigned int tlb_entry_d_dat; +#define tlb_entry_i tlb_entry_i_dat +#define tlb_entry_d tlb_entry_d_dat +#else +unsigned int tlb_entry_i_dat[NR_CPUS]; +unsigned int tlb_entry_d_dat[NR_CPUS]; +#define tlb_entry_i tlb_entry_i_dat[smp_processor_id()] +#define tlb_entry_d tlb_entry_d_dat[smp_processor_id()] +#endif + +extern void init_tlb(void); + +/* + * Unlock any spinlocks which will prevent us from getting the + * message out + */ +void bust_spinlocks(int yes) +{ + int loglevel_save = console_loglevel; + + if (yes) { + oops_in_progress = 1; + return; + } +#ifdef CONFIG_VT + unblank_screen(); +#endif + oops_in_progress = 0; + /* + * OK, the message is on the console. Now we call printk() + * without oops_in_progress set so that printk will give klogd + * a poke. Hold onto your hats... + */ + console_loglevel = 15; /* NMI oopser may have shut the console up */ + printk(" "); + console_loglevel = loglevel_save; +} + +/*======================================================================* + * do_page_fault() + *======================================================================* + * This routine handles page faults. It determines the address, + * and the problem, and then passes it off to one of the appropriate + * routines. + * + * ARGUMENT: + * regs : M32R SP reg. + * error_code : See below + * address : M32R MMU MDEVA reg. (Operand ACE) + * : M32R BPC reg. (Instruction ACE) + * + * error_code : + * bit 0 == 0 means no page found, 1 means protection fault + * bit 1 == 0 means read, 1 means write + * bit 2 == 0 means kernel, 1 means user-mode + * bit 3 == 0 means data, 1 means instruction + *======================================================================*/ +asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long error_code, + unsigned long address) +{ + struct task_struct *tsk; + struct mm_struct *mm; + struct vm_area_struct * vma; + unsigned long page, addr; + int write; + siginfo_t info; + + /* + * If BPSW IE bit enable --> set PSW IE bit + */ + if (regs->psw & M32R_PSW_BIE) + local_irq_enable(); + + tsk = current; + + info.si_code = SEGV_MAPERR; + + /* + * We fault-in kernel-space virtual memory on-demand. The + * 'reference' page table is init_mm.pgd. + * + * NOTE! We MUST NOT take any locks for this case. We may + * be in an interrupt or a critical region, and should + * only copy the information from the master page table, + * nothing more. + * + * This verifies that the fault happens in kernel space + * (error_code & 4) == 0, and that the fault was not a + * protection error (error_code & 1) == 0. + */ + if (address >= TASK_SIZE && !(error_code & 4)) + goto vmalloc_fault; + + mm = tsk->mm; + + /* + * If we're in an interrupt or have no user context or are running in an + * atomic region then we must not take the fault.. + */ + if (in_atomic() || !mm) + goto bad_area_nosemaphore; + + /* When running in the kernel we expect faults to occur only to + * addresses in user space. All other faults represent errors in the + * kernel and should generate an OOPS. Unfortunatly, in the case of an + * erroneous fault occuring in a code path which already holds mmap_sem + * we will deadlock attempting to validate the fault against the + * address space. Luckily the kernel only validly references user + * space from well defined areas of code, which are listed in the + * exceptions table. + * + * As the vast majority of faults will be valid we will only perform + * the source reference check when there is a possibilty of a deadlock. + * Attempt to lock the address space, if we cannot we then validate the + * source. If this is invalid we can skip the address space check, + * thus avoiding the deadlock. + */ + if (!down_read_trylock(&mm->mmap_sem)) { + if ((error_code & 4) == 0 && + !search_exception_tables(regs->psw)) + goto bad_area_nosemaphore; + down_read(&mm->mmap_sem); + } + + vma = find_vma(mm, address); + if (!vma) + goto bad_area; + if (vma->vm_start <= address) + goto good_area; + if (!(vma->vm_flags & VM_GROWSDOWN)) + goto bad_area; +#if 0 + if (error_code & 4) { + /* + * accessing the stack below "spu" is always a bug. + * The "+ 4" is there due to the push instruction + * doing pre-decrement on the stack and that + * doesn't show up until later.. + */ + if (address + 4 < regs->spu) + goto bad_area; + } +#endif + if (expand_stack(vma, address)) + goto bad_area; +/* + * Ok, we have a good vm_area for this memory access, so + * we can handle it.. + */ +good_area: + info.si_code = SEGV_ACCERR; + write = 0; + switch (error_code & 3) { + default: /* 3: write, present */ + /* fall through */ + case 2: /* write, not present */ + if (!(vma->vm_flags & VM_WRITE)) + goto bad_area; + write++; + break; + case 1: /* read, present */ + case 0: /* read, not present */ + if (!(vma->vm_flags & (VM_READ | VM_EXEC))) + goto bad_area; + } + +survive: + /* + * If for any reason at all we couldn't handle the fault, + * make sure we exit gracefully rather than endlessly redo + * the fault. + */ + addr = (address & PAGE_MASK) | (error_code & 8); + switch (handle_mm_fault(mm, vma, addr, write)) { + case VM_FAULT_MINOR: + tsk->min_flt++; + break; + case VM_FAULT_MAJOR: + tsk->maj_flt++; + break; + case VM_FAULT_SIGBUS: + goto do_sigbus; + case VM_FAULT_OOM: + goto out_of_memory; + default: + BUG(); + } + + up_read(&mm->mmap_sem); + return; + +/* + * Something tried to access memory that isn't in our memory map.. + * Fix it, but check if it's kernel or user first.. + */ +bad_area: + up_read(&mm->mmap_sem); + +bad_area_nosemaphore: + /* User mode accesses just cause a SIGSEGV */ + if (error_code & 4) { + tsk->thread.address = address; + tsk->thread.error_code = error_code | (address >= TASK_SIZE); + tsk->thread.trap_no = 14; + info.si_signo = SIGSEGV; + info.si_errno = 0; + /* info.si_code has been set above */ + info.si_addr = (void __user *)address; + force_sig_info(SIGSEGV, &info, tsk); + return; + } + +no_context: + /* Are we prepared to handle this kernel fault? */ + if (fixup_exception(regs)) + return; + +/* + * Oops. The kernel tried to access some bad page. We'll have to + * terminate things with extreme prejudice. + */ + + bust_spinlocks(1); + + if (address < PAGE_SIZE) + printk(KERN_ALERT "Unable to handle kernel NULL pointer dereference"); + else + printk(KERN_ALERT "Unable to handle kernel paging request"); + printk(" at virtual address %08lx\n",address); + printk(KERN_ALERT " printing bpc:\n"); + printk("%08lx\n", regs->bpc); + page = *(unsigned long *)MPTB; + page = ((unsigned long *) page)[address >> PGDIR_SHIFT]; + printk(KERN_ALERT "*pde = %08lx\n", page); + if (page & _PAGE_PRESENT) { + page &= PAGE_MASK; + address &= 0x003ff000; + page = ((unsigned long *) __va(page))[address >> PAGE_SHIFT]; + printk(KERN_ALERT "*pte = %08lx\n", page); + } + die("Oops", regs, error_code); + bust_spinlocks(0); + do_exit(SIGKILL); + +/* + * We ran out of memory, or some other thing happened to us that made + * us unable to handle the page fault gracefully. + */ +out_of_memory: + up_read(&mm->mmap_sem); + if (tsk->pid == 1) { + yield(); + down_read(&mm->mmap_sem); + goto survive; + } + printk("VM: killing process %s\n", tsk->comm); + if (error_code & 4) + do_exit(SIGKILL); + goto no_context; + +do_sigbus: + up_read(&mm->mmap_sem); + + /* Kernel mode? Handle exception or die */ + if (!(error_code & 4)) + goto no_context; + + tsk->thread.address = address; + tsk->thread.error_code = error_code; + tsk->thread.trap_no = 14; + info.si_signo = SIGBUS; + info.si_errno = 0; + info.si_code = BUS_ADRERR; + info.si_addr = (void __user *)address; + force_sig_info(SIGBUS, &info, tsk); + return; + +vmalloc_fault: + { + /* + * Synchronize this task's top level page-table + * with the 'reference' page table. + * + * Do _not_ use "tsk" here. We might be inside + * an interrupt in the middle of a task switch.. + */ + int offset = pgd_index(address); + pgd_t *pgd, *pgd_k; + pmd_t *pmd, *pmd_k; + pte_t *pte_k; + + pgd = (pgd_t *)*(unsigned long *)MPTB; + pgd = offset + (pgd_t *)pgd; + pgd_k = init_mm.pgd + offset; + + if (!pgd_present(*pgd_k)) + goto no_context; + + /* + * set_pgd(pgd, *pgd_k); here would be useless on PAE + * and redundant with the set_pmd() on non-PAE. + */ + + pmd = pmd_offset(pgd, address); + pmd_k = pmd_offset(pgd_k, address); + if (!pmd_present(*pmd_k)) + goto no_context; + set_pmd(pmd, *pmd_k); + + pte_k = pte_offset_kernel(pmd_k, address); + if (!pte_present(*pte_k)) + goto no_context; + + addr = (address & PAGE_MASK) | (error_code & 8); + update_mmu_cache(NULL, addr, *pte_k); + return; + } +} + +/*======================================================================* + * update_mmu_cache() + *======================================================================*/ +#define TLB_MASK (NR_TLB_ENTRIES - 1) +#define ITLB_END (unsigned long *)(ITLB_BASE + (NR_TLB_ENTRIES * 8)) +#define DTLB_END (unsigned long *)(DTLB_BASE + (NR_TLB_ENTRIES * 8)) +void update_mmu_cache(struct vm_area_struct *vma, unsigned long vaddr, + pte_t pte) +{ + unsigned long *entry1, *entry2; + unsigned long pte_data, flags; + unsigned int *entry_dat; + int inst = vaddr & 8; + int i; + + /* Ptrace may call this routine. */ + if (vma && current->active_mm != vma->vm_mm) + return; + + local_irq_save(flags); + + vaddr = (vaddr & PAGE_MASK) | get_asid(); + +#ifdef CONFIG_CHIP_OPSP + entry1 = (unsigned long *)ITLB_BASE; + for(i = 0 ; i < NR_TLB_ENTRIES; i++) { + if(*entry1++ == vaddr) { + pte_data = pte_val(pte); + set_tlb_data(entry1, pte_data); + break; + } + entry1++; + } + entry2 = (unsigned long *)DTLB_BASE; + for(i = 0 ; i < NR_TLB_ENTRIES ; i++) { + if(*entry2++ == vaddr) { + pte_data = pte_val(pte); + set_tlb_data(entry2, pte_data); + break; + } + entry2++; + } + local_irq_restore(flags); + return; +#else + pte_data = pte_val(pte); + + /* + * Update TLB entries + * entry1: ITLB entry address + * entry2: DTLB entry address + */ + __asm__ __volatile__ ( + "seth %0, #high(%4) \n\t" + "st %2, @(%5, %0) \n\t" + "ldi %1, #1 \n\t" + "st %1, @(%6, %0) \n\t" + "add3 r4, %0, %7 \n\t" + ".fillinsn \n" + "1: \n\t" + "ld %1, @(%6, %0) \n\t" + "bnez %1, 1b \n\t" + "ld %0, @r4+ \n\t" + "ld %1, @r4 \n\t" + "st %3, @+%0 \n\t" + "st %3, @+%1 \n\t" + : "=&r" (entry1), "=&r" (entry2) + : "r" (vaddr), "r" (pte_data), "i" (MMU_REG_BASE), + "i" (MSVA_offset), "i" (MTOP_offset), "i" (MIDXI_offset) + : "r4", "memory" + ); + + if ((!inst && entry2 >= DTLB_END) || (inst && entry1 >= ITLB_END)) + goto notfound; + +found: + local_irq_restore(flags); + + return; + + /* Valid entry not found */ +notfound: + /* + * Update ITLB or DTLB entry + * entry1: TLB entry address + * entry2: TLB base address + */ + if (!inst) { + entry2 = (unsigned long *)DTLB_BASE; + entry_dat = &tlb_entry_d; + } else { + entry2 = (unsigned long *)ITLB_BASE; + entry_dat = &tlb_entry_i; + } + entry1 = entry2 + (((*entry_dat - 1) & TLB_MASK) << 1); + + for (i = 0 ; i < NR_TLB_ENTRIES ; i++) { + if (!(entry1[1] & 2)) /* Valid bit check */ + break; + + if (entry1 != entry2) + entry1 -= 2; + else + entry1 += TLB_MASK << 1; + } + + if (i >= NR_TLB_ENTRIES) { /* Empty entry not found */ + entry1 = entry2 + (*entry_dat << 1); + *entry_dat = (*entry_dat + 1) & TLB_MASK; + } + *entry1++ = vaddr; /* Set TLB tag */ + set_tlb_data(entry1, pte_data); + + goto found; +#endif +} + +/*======================================================================* + * flush_tlb_page() : flushes one page + *======================================================================*/ +void local_flush_tlb_page(struct vm_area_struct *vma, unsigned long page) +{ + if (vma->vm_mm && mm_context(vma->vm_mm) != NO_CONTEXT) { + unsigned long flags; + + local_irq_save(flags); + page &= PAGE_MASK; + page |= (mm_context(vma->vm_mm) & MMU_CONTEXT_ASID_MASK); + __flush_tlb_page(page); + local_irq_restore(flags); + } +} + +/*======================================================================* + * flush_tlb_range() : flushes a range of pages + *======================================================================*/ +void local_flush_tlb_range(struct vm_area_struct *vma, unsigned long start, + unsigned long end) +{ + struct mm_struct *mm; + + mm = vma->vm_mm; + if (mm_context(mm) != NO_CONTEXT) { + unsigned long flags; + int size; + + local_irq_save(flags); + size = (end - start + (PAGE_SIZE - 1)) >> PAGE_SHIFT; + if (size > (NR_TLB_ENTRIES / 4)) { /* Too many TLB to flush */ + mm_context(mm) = NO_CONTEXT; + if (mm == current->mm) + activate_context(mm); + } else { + unsigned long asid; + + asid = mm_context(mm) & MMU_CONTEXT_ASID_MASK; + start &= PAGE_MASK; + end += (PAGE_SIZE - 1); + end &= PAGE_MASK; + + start |= asid; + end |= asid; + while (start < end) { + __flush_tlb_page(start); + start += PAGE_SIZE; + } + } + local_irq_restore(flags); + } +} + +/*======================================================================* + * flush_tlb_mm() : flushes the specified mm context TLB's + *======================================================================*/ +void local_flush_tlb_mm(struct mm_struct *mm) +{ + /* Invalidate all TLB of this process. */ + /* Instead of invalidating each TLB, we get new MMU context. */ + if (mm_context(mm) != NO_CONTEXT) { + unsigned long flags; + + local_irq_save(flags); + mm_context(mm) = NO_CONTEXT; + if (mm == current->mm) + activate_context(mm); + local_irq_restore(flags); + } +} + +/*======================================================================* + * flush_tlb_all() : flushes all processes TLBs + *======================================================================*/ +void local_flush_tlb_all(void) +{ + unsigned long flags; + + local_irq_save(flags); + __flush_tlb_all(); + local_irq_restore(flags); +} + +/*======================================================================* + * init_mmu() + *======================================================================*/ +void __init init_mmu(void) +{ + tlb_entry_i = 0; + tlb_entry_d = 0; + mmu_context_cache = MMU_CONTEXT_FIRST_VERSION; + set_asid(mmu_context_cache & MMU_CONTEXT_ASID_MASK); + *(volatile unsigned long *)MPTB = (unsigned long)swapper_pg_dir; +} diff -Nru a/arch/m32r/mm/init.c b/arch/m32r/mm/init.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/mm/init.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,250 @@ +/* + * linux/arch/m32r/mm/init.c + * + * Copyright (c) 2001, 2002 Hitoshi Yamamoto + * + * Some code taken from sh version. + * Copyright (C) 1999 Niibe Yutaka + * Based on linux/arch/i386/mm/init.c: + * Copyright (C) 1995 Linus Torvalds + */ + +/* $Id$ */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* References to section boundaries */ +extern char _text, _etext, _edata; +extern char __init_begin, __init_end; + +pgd_t swapper_pg_dir[1024]; + +DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); + +void show_mem(void) +{ + int total = 0, reserved = 0; + int shared = 0, cached = 0; + int highmem = 0; + struct page *page; + pg_data_t *pgdat; + unsigned long i; + + printk("Mem-info:\n"); + show_free_areas(); + printk("Free swap: %6ldkB\n",nr_swap_pages<<(PAGE_SHIFT-10)); + for_each_pgdat(pgdat) { + for (i = 0; i < pgdat->node_spanned_pages; ++i) { + page = pgdat->node_mem_map + i; + total++; + if (PageHighMem(page)) + highmem++; + if (PageReserved(page)) + reserved++; + else if (PageSwapCache(page)) + cached++; + else if (page_count(page)) + shared += page_count(page) - 1; + } + } + printk("%d pages of RAM\n", total); + printk("%d pages of HIGHMEM\n",highmem); + printk("%d reserved pages\n",reserved); + printk("%d pages shared\n",shared); + printk("%d pages swap cached\n",cached); +} + +/* + * Cache of MMU context last used. + */ +#ifndef CONFIG_SMP +unsigned long mmu_context_cache_dat; +#else +unsigned long mmu_context_cache_dat[NR_CPUS]; +#endif +static unsigned long hole_pages; + +/* + * function prototype + */ +void __init paging_init(void); +void __init mem_init(void); +void free_initmem(void); +#ifdef CONFIG_BLK_DEV_INITRD +void free_initrd_mem(unsigned long, unsigned long); +#endif + +/* It'd be good if these lines were in the standard header file. */ +#define START_PFN(nid) \ + (NODE_DATA(nid)->bdata->node_boot_start >> PAGE_SHIFT) +#define MAX_LOW_PFN(nid) (NODE_DATA(nid)->bdata->node_low_pfn) + +#ifndef CONFIG_DISCONTIGMEM +unsigned long __init zone_sizes_init(void) +{ + unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0}; + unsigned long max_dma; + unsigned long low; + unsigned long start_pfn; + +#ifdef CONFIG_MMU + start_pfn = START_PFN(0); + max_dma = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT; + low = MAX_LOW_PFN(0); + + if (low < max_dma){ + zones_size[ZONE_DMA] = low - start_pfn; + zones_size[ZONE_NORMAL] = 0; + } else { + zones_size[ZONE_DMA] = low - start_pfn; + zones_size[ZONE_NORMAL] = low - max_dma; + } +#else + zones_size[ZONE_DMA] = 0 >> PAGE_SHIFT; + zones_size[ZONE_NORMAL] = __MEMORY_SIZE >> PAGE_SHIFT; + start_pfn = __MEMORY_START >> PAGE_SHIFT; +#endif /* CONFIG_MMU */ + + free_area_init_node(0, NODE_DATA(0), zones_size, start_pfn, 0); + + mem_map = contig_page_data.node_mem_map; + + return 0; +} +#else /* CONFIG_DISCONTIGMEM */ +extern unsigned long zone_sizes_init(void); +#endif /* CONFIG_DISCONTIGMEM */ + +/*======================================================================* + * paging_init() : sets up the page tables + *======================================================================*/ +void __init paging_init(void) +{ +#ifdef CONFIG_MMU + int i; + pgd_t *pg_dir; + + /* We don't need kernel mapping as hardware support that. */ + pg_dir = swapper_pg_dir; + + for (i = 0 ; i < USER_PTRS_PER_PGD * 2 ; i++) + pgd_val(pg_dir[i]) = 0; +#endif /* CONFIG_MMU */ + hole_pages = zone_sizes_init(); +} + +int __init reservedpages_count(void) +{ + int reservedpages, nid, i; + + reservedpages = 0; + for (nid = 0 ; nid < numnodes ; nid++) + for (i = 0 ; i < MAX_LOW_PFN(nid) - START_PFN(nid) ; i++) + if (PageReserved(NODE_DATA(nid)->node_mem_map + i)) + reservedpages++; + + return reservedpages; +} + +/*======================================================================* + * mem_init() : + * orig : arch/sh/mm/init.c + *======================================================================*/ +void __init mem_init(void) +{ + int codesize, reservedpages, datasize, initsize; + int nid; +#ifndef CONFIG_MMU + extern unsigned long memory_end; +#endif + + num_physpages = 0; + for (nid = 0 ; nid < numnodes ; nid++) + num_physpages += MAX_LOW_PFN(nid) - START_PFN(nid) + 1; + + num_physpages -= hole_pages; + +#ifndef CONFIG_DISCONTIGMEM + max_mapnr = num_physpages; +#endif /* CONFIG_DISCONTIGMEM */ + +#ifdef CONFIG_MMU + high_memory = (void *)__va(PFN_PHYS(MAX_LOW_PFN(0))); +#else + high_memory = (void *)(memory_end & PAGE_MASK); +#endif /* CONFIG_MMU */ + + /* clear the zero-page */ + memset(empty_zero_page, 0, PAGE_SIZE); + + /* this will put all low memory onto the freelists */ + for (nid = 0 ; nid < numnodes ; nid++) + totalram_pages += free_all_bootmem_node(NODE_DATA(nid)); + + reservedpages = reservedpages_count() - hole_pages; + codesize = (unsigned long) &_etext - (unsigned long)&_text; + datasize = (unsigned long) &_edata - (unsigned long)&_etext; + initsize = (unsigned long) &__init_end - (unsigned long)&__init_begin; + + 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), + num_physpages << (PAGE_SHIFT-10), + codesize >> 10, + reservedpages << (PAGE_SHIFT-10), + datasize >> 10, + initsize >> 10); +} + +/*======================================================================* + * free_initmem() : + * orig : arch/sh/mm/init.c + *======================================================================*/ +void free_initmem(void) +{ + unsigned long addr; + + addr = (unsigned long)(&__init_begin); + for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) { + ClearPageReserved(virt_to_page(addr)); + set_page_count(virt_to_page(addr), 1); + free_page(addr); + totalram_pages++; + } + printk (KERN_INFO "Freeing unused kernel memory: %dk freed\n", \ + (int)(&__init_end - &__init_begin) >> 10); +} + +#ifdef CONFIG_BLK_DEV_INITRD +/*======================================================================* + * free_initrd_mem() : + * orig : arch/sh/mm/init.c + *======================================================================*/ +void free_initrd_mem(unsigned long start, unsigned long end) +{ + unsigned long p; + for (p = start; p < end; p += PAGE_SIZE) { + ClearPageReserved(virt_to_page(p)); + set_page_count(virt_to_page(p), 1); + free_page(p); + totalram_pages++; + } + printk (KERN_INFO "Freeing initrd memory: %ldk freed\n", (end - start) >> 10); +} +#endif + diff -Nru a/arch/m32r/mm/ioremap-nommu.c b/arch/m32r/mm/ioremap-nommu.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/mm/ioremap-nommu.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,51 @@ +/* + * linux/arch/m32r/mm/io_remap.c + * + * Copyright (c) 2001, 2002 Hiroyuki Kondo + * + * Taken from mips version. + * (C) Copyright 1995 1996 Linus Torvalds + * (C) Copyright 2001 Ralf Baechle + */ + +/* + * 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. + * + */ + +#include +#include +#include + +#include +#include +#include +#include +#include + + +/* + * Remap an arbitrary physical address space into the kernel virtual + * address space. Needed when the kernel wants to access high addresses + * directly. + * + * NOTE! We need to allow non-page-aligned mappings too: we will obviously + * have to convert them into an offset in a page-aligned mapping, but the + * caller shouldn't need to know that small detail. + */ + +#define IS_LOW512(addr) (!((unsigned long)(addr) & ~0x1fffffffUL)) + +void * __ioremap(unsigned long phys_addr, unsigned long size, unsigned long flags) +{ + return (void *)phys_addr; +} + +#define IS_KSEG1(addr) (((unsigned long)(addr) & ~0x1fffffffUL) == KSEG1) + +void iounmap(void *addr) +{ +} + diff -Nru a/arch/m32r/mm/ioremap.c b/arch/m32r/mm/ioremap.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/mm/ioremap.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,188 @@ +/* + * linux/arch/m32r/mm/io_remap.c + * + * Copyright (c) 2001, 2002 Hiroyuki Kondo + * + * Taken from mips version. + * (C) Copyright 1995 1996 Linus Torvalds + * (C) Copyright 2001 Ralf Baechle + */ + +/* + * 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. + * + */ + +#include +#include +#include + +#include +#include +#include +#include +#include + +static inline void remap_area_pte(pte_t * pte, unsigned long address, unsigned long size, + unsigned long phys_addr, unsigned long flags) +{ + unsigned long end; + unsigned long pfn; + pgprot_t pgprot = __pgprot(_PAGE_GLOBAL | _PAGE_PRESENT | _PAGE_READ + | _PAGE_WRITE | flags); + + address &= ~PMD_MASK; + end = address + size; + if (end > PMD_SIZE) + end = PMD_SIZE; + if (address >= end) + BUG(); + pfn = phys_addr >> PAGE_SHIFT; + do { + if (!pte_none(*pte)) { + printk("remap_area_pte: page already exists\n"); + BUG(); + } + set_pte(pte, pfn_pte(pfn, pgprot)); + address += PAGE_SIZE; + pfn++; + pte++; + } while (address && (address < end)); +} + +static inline int remap_area_pmd(pmd_t * pmd, unsigned long address, unsigned long size, + unsigned long phys_addr, unsigned long flags) +{ + unsigned long end; + + address &= ~PGDIR_MASK; + end = address + size; + if (end > PGDIR_SIZE) + end = PGDIR_SIZE; + phys_addr -= address; + if (address >= end) + BUG(); + do { + pte_t * pte = pte_alloc_kernel(&init_mm, pmd, address); + if (!pte) + return -ENOMEM; + remap_area_pte(pte, address, end - address, address + phys_addr, flags); + address = (address + PMD_SIZE) & PMD_MASK; + pmd++; + } while (address && (address < end)); + return 0; +} + +static int remap_area_pages(unsigned long address, unsigned long phys_addr, + unsigned long size, unsigned long flags) +{ + int error; + pgd_t * dir; + unsigned long end = address + size; + + phys_addr -= address; + dir = pgd_offset(&init_mm, address); + flush_cache_all(); + if (address >= end) + BUG(); + spin_lock(&init_mm.page_table_lock); + do { + pmd_t *pmd; + pmd = pmd_alloc(&init_mm, dir, address); + error = -ENOMEM; + if (!pmd) + break; + if (remap_area_pmd(pmd, address, end - address, + phys_addr + address, flags)) + break; + error = 0; + address = (address + PGDIR_SIZE) & PGDIR_MASK; + dir++; + } while (address && (address < end)); + spin_unlock(&init_mm.page_table_lock); + flush_tlb_all(); + return error; +} + +/* + * Generic mapping function (not visible outside): + */ + +/* + * Remap an arbitrary physical address space into the kernel virtual + * address space. Needed when the kernel wants to access high addresses + * directly. + * + * NOTE! We need to allow non-page-aligned mappings too: we will obviously + * have to convert them into an offset in a page-aligned mapping, but the + * caller shouldn't need to know that small detail. + */ + +#define IS_LOW512(addr) (!((unsigned long)(addr) & ~0x1fffffffUL)) + +void __iomem * __ioremap(unsigned long phys_addr, unsigned long size, unsigned long flags) +{ + void __iomem * addr; + struct vm_struct * area; + unsigned long offset, last_addr; + + /* Don't allow wraparound or zero size */ + last_addr = phys_addr + size - 1; + if (!size || last_addr < phys_addr) + return NULL; + + /* + * Map objects in the low 512mb of address space using KSEG1, otherwise + * map using page tables. + */ + if (IS_LOW512(phys_addr) && IS_LOW512(phys_addr + size - 1)) + return (void *) KSEG1ADDR(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; + } + + /* + * Mappings have to be page-aligned + */ + offset = phys_addr & ~PAGE_MASK; + phys_addr &= PAGE_MASK; + size = PAGE_ALIGN(last_addr + 1) - phys_addr; + + /* + * Ok, go for it.. + */ + area = get_vm_area(size, VM_IOREMAP); + if (!area) + return NULL; + area->phys_addr = phys_addr; + addr = (void __iomem *) area->addr; + if (remap_area_pages((unsigned long)addr, phys_addr, size, flags)) { + vunmap((void __force *) addr); + return NULL; + } + + return (void __iomem *) (offset + (char __iomem *)addr); +} + +#define IS_KSEG1(addr) (((unsigned long)(addr) & ~0x1fffffffUL) == KSEG1) + +void iounmap(void *addr) +{ + if (!IS_KSEG1(addr)) + vfree((void *) (PAGE_MASK & (unsigned long) addr)); +} + diff -Nru a/arch/m32r/mm/mmu.S b/arch/m32r/mm/mmu.S --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/mm/mmu.S 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,350 @@ +/* + * linux/arch/m32r/mm/mmu.S + * + * Copyright (C) 2001 by Hiroyuki Kondo + */ + +/* $Id: mmu.S,v 1.15 2004/03/16 02:56:27 takata Exp $ */ + +#include /* CONFIG_MMU */ +#include +#include +#include + + .text +#ifdef CONFIG_MMU + +#include +#include +#include +#include + +/* + * TLB Miss Exception handler + */ + .balign 16 +ENTRY(tme_handler) + .global tlb_entry_i_dat + .global tlb_entry_d_dat + + SWITCH_TO_KERNEL_STACK + +#if defined(CONFIG_ISA_M32R2) + st r0, @-sp + st r1, @-sp + st r2, @-sp + st r3, @-sp + + seth r3, #high(MMU_REG_BASE) + ld r1, @(MESTS_offset, r3) ; r1: status (MESTS reg.) + ld r0, @(MDEVP_offset, r3) ; r0: PFN + ASID (MDEVP reg.) + st r1, @(MESTS_offset, r3) ; clear status (MESTS reg.) + and3 r1, r1, #(MESTS_IT) + bnez r1, 1f ; instruction TLB miss? + +;; data TLB miss +;; input +;; r0: PFN + ASID (MDEVP reg.) +;; r1 - r3: free +;; output +;; r0: PFN + ASID +;; r1: TLB entry base address +;; r2: &tlb_entry_{i|d}_dat +;; r3: free + +#ifndef CONFIG_SMP + seth r2, #high(tlb_entry_d_dat) + or3 r2, r2, #low(tlb_entry_d_dat) +#else /* CONFIG_SMP */ + ldi r1, #-8192 + seth r2, #high(tlb_entry_d_dat) + or3 r2, r2, #low(tlb_entry_d_dat) + and r1, sp + ld r1, @(16, r1) ; current_thread_info->cpu + slli r1, #2 + add r2, r1 +#endif /* !CONFIG_SMP */ + seth r1, #high(DTLB_BASE) + or3 r1, r1, #low(DTLB_BASE) + bra 2f + + .balign 16 + .fillinsn +1: +;; instrucntion TLB miss +;; input +;; r0: MDEVP reg. (included ASID) +;; r1 - r3: free +;; output +;; r0: PFN + ASID +;; r1: TLB entry base address +;; r2: &tlb_entry_{i|d}_dat +;; r3: free + ldi r3, #-4096 + and3 r0, r0, #(MMU_CONTEXT_ASID_MASK) + mvfc r1, bpc + and r1, r3 + or r0, r1 ; r0: PFN + ASID +#ifndef CONFIG_SMP + seth r2, #high(tlb_entry_i_dat) + or3 r2, r2, #low(tlb_entry_i_dat) +#else /* CONFIG_SMP */ + ldi r1, #-8192 + seth r2, #high(tlb_entry_i_dat) + or3 r2, r2, #low(tlb_entry_i_dat) + and r1, sp + ld r1, @(16, r1) ; current_thread_info->cpu + slli r1, #2 + add r2, r1 +#endif /* !CONFIG_SMP */ + seth r1, #high(ITLB_BASE) + or3 r1, r1, #low(ITLB_BASE) + + .fillinsn +2: +;; select TLB entry +;; input +;; r0: PFN + ASID +;; r1: TLB entry base address +;; r2: &tlb_entry_{i|d}_dat +;; r3: free +;; output +;; r0: PFN + ASID +;; r1: TLB entry address +;; r2, r3: free +#ifdef CONFIG_ISA_DUAL_ISSUE + ld r3, @r2 || srli r1, #3 +#else + ld r3, @r2 + srli r1, #3 +#endif + add r1, r3 + ; tlb_entry_{d|i}_dat++; + addi r3, #1 + and3 r3, r3, #(NR_TLB_ENTRIES - 1) +#ifdef CONFIG_ISA_DUAL_ISSUE + st r3, @r2 || slli r1, #3 +#else + st r3, @r2 + slli r1, #3 +#endif + +;; load pte +;; input +;; r0: PFN + ASID +;; r1: TLB entry address +;; r2, r3: free +;; output +;; r0: PFN + ASID +;; r1: TLB entry address +;; r2: pte_data +;; r3: free + ; pgd = *(unsigned long *)MPTB; + ld24 r2, #(-MPTB - 1) + srl3 r3, r0, #22 +#ifdef CONFIG_ISA_DUAL_ISSUE + not r2, r2 || slli r3, #2 ; r3: pgd offset +#else + not r2, r2 + slli r3, #2 +#endif + ld r2, @r2 ; r2: pgd base addr (MPTB reg.) + or r3, r2 ; r3: pmd addr + + ; pmd = pmd_offset(pgd, address); + ld r3, @r3 ; r3: pmd data + ldi r2, #-4096 + beqz r3, 3f ; pmd_none(*pmd) ? + + ; pte = pte_offset(pmd, address); + and r2, r3 ; r2: pte base addr + srl3 r3, r0, #10 + and3 r3, r3, #0xffc ; r3: pte offset + or r3, r2 + seth r2, #0x8000 + or r3, r2 ; r3: pte addr + + ; pte_data = (unsigned long)pte_val(*pte); + ld r2, @r3 ; r2: pte data + or3 r2, r2, #2 ; _PAGE_PRESENT(=2) + + .fillinsn +5: +;; set tlb +;; input +;; r0: PFN + ASID +;; r1: TLB entry address +;; r2: pte_data +;; r3: free + st r0, @r1 ; set_tlb_tag(entry++, address); + st r2, @+r1 ; set_tlb_data(entry, pte_data); + + .fillinsn +6: + ld r3, @sp+ + ld r2, @sp+ + ld r1, @sp+ + ld r0, @sp+ + rte + + .fillinsn +3: +;; error +;; input +;; r0: PFN + ASID +;; r1: TLB entry address +;; r2, r3: free +;; output +;; r0: PFN + ASID +;; r1: TLB entry address +;; r2: pte_data +;; r3: free +#ifdef CONFIG_ISA_DUAL_ISSUE + bra 5b || ldi r2, #2 +#else + ldi r2, #2 ; r2: pte_data = 0 | _PAGE_PRESENT(=2) + bra 5b +#endif + +#elif defined (CONFIG_ISA_M32R) + + st sp, @-sp + st r0, @-sp + st r1, @-sp + st r2, @-sp + st r3, @-sp + st r4, @-sp + + seth r3, #high(MMU_REG_BASE) + ld r0, @(MDEVA_offset,r3) ; r0: address (MDEVA reg.) + mvfc r2, bpc ; r2: bpc + ld r1, @(MESTS_offset,r3) ; r1: status (MESTS reg.) + st r1, @(MESTS_offset,r3) ; clear status (MESTS reg.) + and3 r1, r1, #(MESTS_IT) + beqz r1, 1f ; data TLB miss? + +;; instrucntion TLB miss + mv r0, r2 ; address = bpc; + ; entry = (unsigned long *)ITLB_BASE+tlb_entry_i*2; + seth r3, #shigh(tlb_entry_i_dat) + ld r4, @(low(tlb_entry_i_dat),r3) + sll3 r2, r4, #3 + seth r1, #high(ITLB_BASE) + or3 r1, r1, #low(ITLB_BASE) + add r2, r1 ; r2: entry + addi r4, #1 ; tlb_entry_i++; + and3 r4, r4, #(NR_TLB_ENTRIES-1) + st r4, @(low(tlb_entry_i_dat),r3) + bra 2f + .fillinsn +1: +;; data TLB miss + ; entry = (unsigned long *)DTLB_BASE+tlb_entry_d*2; + seth r3, #shigh(tlb_entry_d_dat) + ld r4, @(low(tlb_entry_d_dat),r3) + sll3 r2, r4, #3 + seth r1, #high(DTLB_BASE) + or3 r1, r1, #low(DTLB_BASE) + add r2, r1 ; r2: entry + addi r4, #1 ; tlb_entry_d++; + and3 r4, r4, #(NR_TLB_ENTRIES-1) + st r4, @(low(tlb_entry_d_dat),r3) + .fillinsn +2: +;; load pte +; r0: address, r2: entry +; r1,r3,r4: (free) + ; pgd = *(unsigned long *)MPTB; + ld24 r1, #(-MPTB-1) + not r1, r1 + ld r1, @r1 + srl3 r4, r0, #22 + sll3 r3, r4, #2 + add r3, r1 ; r3: pgd + ; pmd = pmd_offset(pgd, address); + ld r1, @r3 ; r1: pmd + beqz r1, 3f ; pmd_none(*pmd) ? +; + and3 r1, r1, #0xeff + ldi r4, #611 ; _KERNPG_TABLE(=611) + beq r1, r4, 4f ; !pmd_bad(*pmd) ? + .fillinsn +3: + ldi r1, #0 ; r1: pte_data = 0 + bra 5f + .fillinsn +4: + ; pte = pte_offset(pmd, address); + ld r4, @r3 ; r4: pte + ldi r3, #-4096 + and r4, r3 + srl3 r3, r0, #10 + and3 r3, r3, #0xffc + add r4, r3 + seth r3, #0x8000 + add r4, r3 ; r4: pte + ; pte_data = (unsigned long)pte_val(*pte); + ld r1, @r4 ; r1: pte_data + .fillinsn + +;; set tlb +; r0: address, r1: pte_data, r2: entry +; r3,r4: (free) +5: + ldi r3, #-4096 ; set_tlb_tag(entry++, address); + and r3, r0 + seth r4, #shigh(MASID) + ld r4, @(low(MASID),r4) ; r4: MASID + and3 r4, r4, #(MMU_CONTEXT_ASID_MASK) + or r3, r4 + st r3, @r2 + or3 r4, r1, #2 ; _PAGE_PRESENT(=2) + st r4, @(4,r2) ; set_tlb_data(entry, pte_data); + + ld r4, @sp+ + ld r3, @sp+ + ld r2, @sp+ + ld r1, @sp+ + ld r0, @sp+ + ld sp, @sp+ + rte + +#else +#error unknown isa configuration +#endif + +ENTRY(init_tlb) +;; Set MMU Register + seth r0, #high(MMU_REG_BASE) ; Set MMU_REG_BASE higher + or3 r0, r0, #low(MMU_REG_BASE) ; Set MMU_REG_BASE lower + ldi r1, #0 + st r1, @(MPSZ_offset,r0) ; Set MPSZ Reg(Page size 4KB:0 16KB:1 64KB:2) + ldi r1, #0 + st r1, @(MASID_offset,r0) ; Set ASID Zero + +;; Set TLB + seth r0, #high(ITLB_BASE) ; Set ITLB_BASE higher + or3 r0, r0, #low(ITLB_BASE) ; Set ITLB_BASE lower + seth r1, #high(DTLB_BASE) ; Set DTLB_BASE higher + or3 r1, r1, #low(DTLB_BASE) ; Set DTLB_BASE lower + ldi r2, #0 + ldi r3, #NR_TLB_ENTRIES + addi r0, #-4 + addi r1, #-4 +clear_tlb: + st r2, @+r0 ; VPA <- 0 + st r2, @+r0 ; PPA <- 0 + st r2, @+r1 ; VPA <- 0 + st r2, @+r1 ; PPA <- 0 + addi r3, #-1 + bnez r3, clear_tlb +;; + jmp r14 + +ENTRY(m32r_itlb_entrys) +ENTRY(m32r_otlb_entrys) + +#endif /* CONFIG_MMU */ + +.end + diff -Nru a/arch/m32r/mm/page.S b/arch/m32r/mm/page.S --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/mm/page.S 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,82 @@ +/* + * linux/arch/m32r/mm/page.S + * + * Clear/Copy page with CPU + * + * Copyright (C) 2004 The Free Software Initiative of Japan + * + * Written by Niibe Yutaka + * + * 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. + * + */ + .text + .global copy_page + /* + * copy_page (to, from) + * + * PAGE_SIZE = 4096-byte + * Cache line = 16-byte + * 16 * 256 + */ + .align 4 +copy_page: + ldi r2, #255 + ld r3, @r0 /* cache line allocate */ + ld r4, @r1+ + ld r5, @r1+ + ld r6, @r1+ + ld r7, @r1+ + .fillinsn +0: + st r4, @r0 + st r5, @+r0 + st r6, @+r0 + st r7, @+r0 + ld r4, @r1+ + addi r0, #4 + ld r5, @r1+ + ld r6, @r1+ + ld r7, @r1+ + ld r3, @r0 /* cache line allocate */ + addi r2, #-1 + bnez r2, 0b + + st r4, @r0 + st r5, @+r0 + st r6, @+r0 + st r7, @+r0 + jmp r14 + + .text + .global clear_page + /* + * clear_page (to) + * + * PAGE_SIZE = 4096-byte + * Cache line = 16-byte + * 16 * 256 + */ + .align 4 +clear_page: + ldi r2, #255 + ldi r4, #0 + ld r3, @r0 /* cache line allocate */ + .fillinsn +0: + st r4, @r0 + st r4, @+r0 + st r4, @+r0 + st r4, @+r0 + addi r0, #4 + ld r3, @r0 /* cache line allocate */ + addi r2, #-1 + bnez r2, 0b + + st r4, @r0 + st r4, @+r0 + st r4, @+r0 + st r4, @+r0 + jmp r14 diff -Nru a/arch/m32r/oaks32r/defconfig.nommu b/arch/m32r/oaks32r/defconfig.nommu --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/oaks32r/defconfig.nommu 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,521 @@ +# +# Automatically generated make config: don't edit +# +CONFIG_M32R=y +CONFIG_UID16=y +CONFIG_GENERIC_ISA_DMA=y + +# +# Code maturity level options +# +CONFIG_EXPERIMENTAL=y +CONFIG_CLEAN_COMPILE=y +CONFIG_BROKEN_ON_SMP=y + +# +# General setup +# +# CONFIG_POSIX_MQUEUE is not set +CONFIG_BSD_PROCESS_ACCT=y +# CONFIG_BSD_PROCESS_ACCT_V3 is not set +CONFIG_SYSCTL=y +# CONFIG_AUDIT is not set +CONFIG_LOG_BUF_SHIFT=14 +CONFIG_HOTPLUG=y +# CONFIG_IKCONFIG is not set +CONFIG_EMBEDDED=y +# CONFIG_KALLSYMS is not set +# CONFIG_FUTEX is not set +# CONFIG_EPOLL is not set +CONFIG_IOSCHED_NOOP=y +# CONFIG_IOSCHED_AS is not set +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 is not set +CONFIG_OBSOLETE_MODPARM=y +# CONFIG_MODVERSIONS is not set +CONFIG_KMOD=y + +# +# Processor type and features +# +# CONFIG_PLAT_MAPPI is not set +# CONFIG_PLAT_USRV is not set +# CONFIG_PLAT_M32700UT is not set +# CONFIG_PLAT_OPSPUT is not set +CONFIG_PLAT_OAKS32R=y +# CONFIG_PLAT_MAPPI2 is not set +# CONFIG_CHIP_M32700 is not set +CONFIG_CHIP_M32102=y +# CONFIG_CHIP_VDEC2 is not set +# CONFIG_CHIP_OPSP is not set +CONFIG_ISA_M32R=y +CONFIG_BUS_CLOCK=33333333 +CONFIG_TIMER_DIVIDE=128 +# CONFIG_CPU_LITTLE_ENDIAN is not set +CONFIG_MEMORY_START=0x01000000 +CONFIG_MEMORY_SIZE=0x00800000 +CONFIG_NOHIGHMEM=y +# CONFIG_DISCONTIGMEM is not set +CONFIG_RWSEM_GENERIC_SPINLOCK=y +# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set +CONFIG_PREEMPT=y +# CONFIG_HAVE_DEC_LOCK is not set +# CONFIG_SMP is not set + +# +# M32R drivers +# +CONFIG_M32R_NE2000=y + +# +# Power management options (ACPI, APM) +# +# CONFIG_PM is not set + +# +# Bus options (PCI, PCMCIA, EISA, MCA, ISA) +# +# CONFIG_PCI is not set +# CONFIG_ISA is not set + +# +# PCMCIA/CardBus support +# +# CONFIG_PCMCIA is not set + +# +# PCI Hotplug Support +# + +# +# Executable file formats +# +CONFIG_BINFMT_FLAT=y +# CONFIG_BINFMT_ZFLAT is not set +# CONFIG_BINFMT_SHARED_FLAT is not set +# CONFIG_BINFMT_MISC is not set + +# +# Device Drivers +# + +# +# Generic Driver Options +# +CONFIG_STANDALONE=y +CONFIG_PREVENT_FIRMWARE_BUILD=y +# CONFIG_FW_LOADER 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_FD is not set +CONFIG_BLK_DEV_LOOP=y +# CONFIG_BLK_DEV_CRYPTOLOOP is not set +CONFIG_BLK_DEV_NBD=y +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 is not set + +# +# Multi-device support (RAID and LVM) +# +# CONFIG_MD is not set + +# +# Fusion MPT device support +# + +# +# IEEE 1394 (FireWire) support +# + +# +# 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=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=y +CONFIG_IP_PNP_DHCP=y +# CONFIG_IP_PNP_BOOTP is not set +# CONFIG_IP_PNP_RARP is not set +# CONFIG_NET_IPIP is not set +# CONFIG_NET_IPGRE 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_HW_FLOWCONTROL is not set + +# +# QoS and/or fair queueing +# +# CONFIG_NET_SCHED is not set +# CONFIG_NET_CLS_ROUTE 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 is not set +# 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 is not set +# CONFIG_SERIAL_NONSTANDARD is not set + +# +# Serial drivers +# +# CONFIG_SERIAL_8250 is not set + +# +# Non-8250 serial port support +# +CONFIG_SERIAL_CORE=y +CONFIG_SERIAL_CORE_CONSOLE=y +CONFIG_SERIAL_M32R_SIO=y +CONFIG_SERIAL_M32R_SIO_CONSOLE=y +# CONFIG_SERIAL_M32R_PLDSIO is not set +CONFIG_UNIX98_PTYS=y +CONFIG_LEGACY_PTYS=y +CONFIG_LEGACY_PTY_COUNT=256 +# CONFIG_QIC02_TAPE is not set + +# +# IPMI +# +# CONFIG_IPMI_HANDLER is not set + +# +# Watchdog Cards +# +# CONFIG_WATCHDOG is not set +# CONFIG_RTC is not set +# CONFIG_GEN_RTC is not set +# CONFIG_DTLK is not set +# CONFIG_R3964 is not set + +# +# Ftape, the floppy tape device driver +# +# CONFIG_AGP is not set +# CONFIG_DRM is not set +# CONFIG_RAW_DRIVER is not set + +# +# I2C support +# +# CONFIG_I2C is not set + +# +# Dallas's 1-wire bus +# +# CONFIG_W1 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 + +# +# 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 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_MSDOS_FS is not set +# CONFIG_VFAT_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=y +CONFIG_DEVPTS_FS_SECURITY=y +# CONFIG_TMPFS is not set +# CONFIG_HUGETLB_PAGE is not set +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=y +# CONFIG_NFS_V4 is not set +# CONFIG_NFS_DIRECTIO is not set +# CONFIG_NFSD is not set +CONFIG_ROOT_NFS=y +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_CODA_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=y +CONFIG_NLS_DEFAULT="iso8859-1" +# CONFIG_NLS_CODEPAGE_437 is not set +# CONFIG_NLS_CODEPAGE_737 is not set +# CONFIG_NLS_CODEPAGE_775 is not set +# CONFIG_NLS_CODEPAGE_850 is not set +# CONFIG_NLS_CODEPAGE_852 is not set +# CONFIG_NLS_CODEPAGE_855 is not set +# CONFIG_NLS_CODEPAGE_857 is not set +# CONFIG_NLS_CODEPAGE_860 is not set +# CONFIG_NLS_CODEPAGE_861 is not set +# CONFIG_NLS_CODEPAGE_862 is not set +# CONFIG_NLS_CODEPAGE_863 is not set +# CONFIG_NLS_CODEPAGE_864 is not set +# CONFIG_NLS_CODEPAGE_865 is not set +# CONFIG_NLS_CODEPAGE_866 is not set +# CONFIG_NLS_CODEPAGE_869 is not set +# CONFIG_NLS_CODEPAGE_936 is not set +# CONFIG_NLS_CODEPAGE_950 is not set +# CONFIG_NLS_CODEPAGE_932 is not set +# CONFIG_NLS_CODEPAGE_949 is not set +# CONFIG_NLS_CODEPAGE_874 is not set +# CONFIG_NLS_ISO8859_8 is not set +# CONFIG_NLS_CODEPAGE_1250 is not set +# CONFIG_NLS_CODEPAGE_1251 is not set +# CONFIG_NLS_ASCII is not set +# CONFIG_NLS_ISO8859_1 is not set +# CONFIG_NLS_ISO8859_2 is not set +# CONFIG_NLS_ISO8859_3 is not set +# CONFIG_NLS_ISO8859_4 is not set +# CONFIG_NLS_ISO8859_5 is not set +# CONFIG_NLS_ISO8859_6 is not set +# CONFIG_NLS_ISO8859_7 is not set +# CONFIG_NLS_ISO8859_9 is not set +# CONFIG_NLS_ISO8859_13 is not set +# CONFIG_NLS_ISO8859_14 is not set +# CONFIG_NLS_ISO8859_15 is not set +# CONFIG_NLS_KOI8_R is not set +# CONFIG_NLS_KOI8_U is not set +# CONFIG_NLS_UTF8 is not set + +# +# Profiling support +# +# CONFIG_PROFILING is not set + +# +# Kernel hacking +# +# CONFIG_DEBUG_KERNEL is not set +# CONFIG_DEBUG_SPINLOCK_SLEEP 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_CRC_CCITT is not set +CONFIG_CRC32=y +# CONFIG_LIBCRC32C is not set diff -Nru a/arch/m32r/oaks32r/dot.gdbinit.nommu b/arch/m32r/oaks32r/dot.gdbinit.nommu --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/oaks32r/dot.gdbinit.nommu 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,155 @@ +# .gdbinit file +# $Id: dot.gdbinit.oaks32r,v 1.2 2004/04/15 02:33:14 takata Exp $ +#----- +# NOTE: this file is generated by a script, "gen_gdbinit.pl". +# (Please type "gen_gdbinit.pl --help" and check the help message). +# $ Id: gen_gdbinit.pl,v 1.10 2004/04/15 02:10:45 takata Exp $ +#----- +# target platform: oaks32r + +# setting +set width 0d70 +set radix 0d16 + +# clk xin:cpu:bus=16:66:33 +define clock_init + set *(unsigned long *)0x00ef4008 = 1 + shell sleep 0.1 + set *(unsigned long *)0x00ef4000 = 0x00020100 +end + +# Initialize programmable ports +define port_init + set *(unsigned long *)0x00ef1000 = 0x1 + set *(unsigned long *)0x00ef1060 = 0x01400001 + set *(unsigned long *)0x00ef1064 = 0x00015555 + set *(unsigned long *)0x00ef1068 = 0x55555050 + set *(unsigned long *)0x00ef106c = 0x05150040 +end + +# Initialize SDRAM controller +define sdram_init + set *(unsigned long *)0x00ef6008 = 0x00000182 + set *(unsigned long *)0x00ef600c = 0x00000001 + shell sleep 0.1 + set *(unsigned long *)0x00ef602c = 0x00000010 + set *(unsigned long *)0x00ef6028 = 0x00000300 + set *(unsigned long *)0x00ef6048 = 0x00000001 + set *(unsigned long *)0x00ef6020 = 0x01000041 + set *(unsigned long *)0x00ef6004 = 0x00010117 + set *(unsigned long *)0x00ef6010 = 0x00000001 + set *(unsigned long *)0x00ef6024 = 0x00000001 +end +document sdram_init + SDRAM controller initialization + 0x01000000 - 0x017fffff (8MB) +end + +# Initialize LAN controller +define lanc_init + set *(unsigned long *)0x00ef5008 = 0x03031303 + #RST DRV (P64) + set *(unsigned char *)0x00ef1046 = 0x08 + set *(unsigned char *)0x00ef1026 = 0xff + set *(unsigned char *)0x00ef1026 = 0x00 + set *(unsigned short *)0x02000630 = 0xffff +end + +# Show current task structure +define show_current + set $current = $spi & 0xffffe000 + printf "$current=0x%08lX\n",$current + print *(struct task_struct *)$current +end + +# Show user assigned task structure +define show_task + set = $arg0 & 0xffffe000 + printf "$task=0x%08lX\n",$task + print *(struct task_struct *)$task +end +document show_task + Show user assigned task structure + arg0 : task structure address +end + +# Show M32R registers +define show_regs + printf " R0[0x%08lX] R1[0x%08lX] R2[0x%08lX] R3[0x%08lX]\n",$r0,$r1,$r2,$r3 + printf " R4[0x%08lX] R5[0x%08lX] R6[0x%08lX] R7[0x%08lX]\n",$r4,$r5,$r6,$r7 + printf " R8[0x%08lX] R9[0x%08lX] R10[0x%08lX] R11[0x%08lX]\n",$r8,$r9,$r10,$r11 + printf "R12[0x%08lX] FP[0x%08lX] LR[0x%08lX] SP[0x%08lX]\n",$r12,$fp,$lr,$sp + printf "PSW[0x%08lX] CBR[0x%08lX] SPI[0x%08lX] SPU[0x%08lX]\n",$psw,$cbr,$spi,$spu + printf "BPC[0x%08lX] PC[0x%08lX] ACCL[0x%08lX] ACCH[0x%08lX]\n",$bpc,$pc,$accl,$acch +end + +# Setup all +define setup + use_mon_code + set *(unsigned int)0xfffffffc=0x60 + shell sleep 0.1 + clock_init + shell sleep 0.1 + port_init + sdram_init + lanc_init +end + +# Load modules +define load_modules + use_debug_dma + load +end + +# Set kernel parameters +define set_kernel_parameters + set $param = (void*)0x01002000 + # INITRD_START + set *(unsigned long *)($param + 0x0010) = 0x00000000 + # INITRD_SIZE + set *(unsigned long *)($param + 0x0014) = 0x00000000 + # M32R_CPUCLK + set *(unsigned long *)($param + 0x0018) = 0d66666667 + # M32R_BUSCLK + set *(unsigned long *)($param + 0x001c) = 0d33333333 + + # M32R_TIMER_DIVIDE + set *(unsigned long *)($param + 0x0020) = 0d128 + +# set {char[0x200]}($param + 0x100) = "console=ttyD0,115200n8x root=/dev/nfsroot nfsroot=192.168.0.1:/project/m32r-linux/export/rootfs nfsaddrs=192.168.0.101:192.168.0.1:192.168.0.1:255.255.255.0:mappi001 \0" + set {char[0x200]}($param + 0x100) = "console=ttyD0,115200n8x root=/dev/nfsroot nfsroot=192.168.0.1:/project/m32r-linux/export/root.busybox.flat nfsaddrs=192.168.0.101:192.168.0.1:192.168.0.1:255.255.255.0:mappi001 \0" +end + +# Boot +define boot + set_kernel_parameters + set $fp = 0 + set $pc = 0x01001000 + si + c +end + +# Set breakpoints +define set_breakpoints + b *0x00000020 + b *0x00000030 +end + +# Restart +define restart + sdireset + sdireset + setup + load_modules + boot +end + +sdireset +sdireset +file vmlinux +target m32rsdi +setup +#load_modules +#set_breakpoints +#boot + diff -Nru a/arch/m32r/oprofile/Kconfig b/arch/m32r/oprofile/Kconfig --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/oprofile/Kconfig 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,23 @@ + +menu "Profiling support" + depends on EXPERIMENTAL + +config PROFILING + bool "Profiling support (EXPERIMENTAL)" + help + Say Y here to enable the extended profiling support mechanisms used + by profilers such as OProfile. + + +config OPROFILE + tristate "OProfile system profiling (EXPERIMENTAL)" + depends on PROFILING + help + OProfile is a profiling system capable of profiling the + whole system, include the kernel, kernel modules, libraries, + and applications. + + If unsure, say N. + +endmenu + diff -Nru a/arch/m32r/oprofile/Makefile b/arch/m32r/oprofile/Makefile --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/oprofile/Makefile 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,9 @@ +obj-$(CONFIG_OPROFILE) += oprofile.o + +DRIVER_OBJS := $(addprefix ../../../drivers/oprofile/, \ + oprof.o cpu_buffer.o buffer_sync.o \ + event_buffer.o oprofile_files.o \ + oprofilefs.o oprofile_stats.o \ + timer_int.o ) + +oprofile-y := $(DRIVER_OBJS) init.o diff -Nru a/arch/m32r/oprofile/init.c b/arch/m32r/oprofile/init.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/oprofile/init.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,25 @@ +/** + * @file init.c + * + * @remark Copyright 2002 OProfile authors + * @remark Read the file COPYING + * + * @author John Levon + */ + +#include +#include +#include +#include + +extern void timer_init(struct oprofile_operations ** ops); + +int __init oprofile_arch_init(struct oprofile_operations ** ops) +{ + return -ENODEV; +} + + +void oprofile_arch_exit(void) +{ +} diff -Nru a/arch/m32r/opsput/defconfig.opsput b/arch/m32r/opsput/defconfig.opsput --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/opsput/defconfig.opsput 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,598 @@ +# +# Automatically generated make config: don't edit +# +CONFIG_M32R=y +CONFIG_UID16=y +CONFIG_GENERIC_ISA_DMA=y + +# +# Code maturity level options +# +CONFIG_EXPERIMENTAL=y +CONFIG_CLEAN_COMPILE=y +CONFIG_BROKEN_ON_SMP=y + +# +# General setup +# +CONFIG_SWAP=y +CONFIG_SYSVIPC=y +# CONFIG_POSIX_MQUEUE is not set +CONFIG_BSD_PROCESS_ACCT=y +# CONFIG_BSD_PROCESS_ACCT_V3 is not set +CONFIG_SYSCTL=y +# CONFIG_AUDIT is not set +CONFIG_LOG_BUF_SHIFT=14 +CONFIG_HOTPLUG=y +CONFIG_IKCONFIG=y +# CONFIG_IKCONFIG_PROC is not set +CONFIG_EMBEDDED=y +# CONFIG_KALLSYMS is not set +# CONFIG_FUTEX is not set +# CONFIG_EPOLL is not set +CONFIG_IOSCHED_NOOP=y +# CONFIG_IOSCHED_AS is not set +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 is not set +CONFIG_OBSOLETE_MODPARM=y +# CONFIG_MODVERSIONS is not set +CONFIG_KMOD=y + +# +# Processor type and features +# +# CONFIG_PLAT_MAPPI is not set +# CONFIG_PLAT_USRV is not set +# CONFIG_PLAT_M32700UT is not set +CONFIG_PLAT_OPSPUT=y +# CONFIG_PLAT_OAKS32R is not set +# CONFIG_PLAT_MAPPI2 is not set +# CONFIG_CHIP_M32700 is not set +# CONFIG_CHIP_M32102 is not set +# CONFIG_CHIP_VDEC2 is not set +CONFIG_CHIP_OPSP=y +CONFIG_MMU=y +CONFIG_TLB_ENTRIES=32 +CONFIG_ISA_M32R2=y +CONFIG_ISA_DSP_LEVEL2=y +CONFIG_ISA_DUAL_ISSUE=y +CONFIG_BUS_CLOCK=50000000 +CONFIG_TIMER_DIVIDE=128 +# CONFIG_CPU_LITTLE_ENDIAN is not set +CONFIG_MEMORY_START=0x08000000 +CONFIG_MEMORY_SIZE=0x01000000 +CONFIG_NOHIGHMEM=y +# CONFIG_DISCONTIGMEM is not set +CONFIG_RWSEM_GENERIC_SPINLOCK=y +# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set +# CONFIG_PREEMPT is not set +# CONFIG_SMP is not set + +# +# M32R drivers +# +# CONFIG_M32R_CFC is not set +CONFIG_M32R_SMC91111=y +CONFIG_M32700UT_DS1302=y + +# +# Power management options (ACPI, APM) +# +# CONFIG_PM is not set + +# +# Bus options (PCI, PCMCIA, EISA, MCA, ISA) +# +# CONFIG_PCI is not set +# CONFIG_ISA is not set + +# +# PCMCIA/CardBus support +# +CONFIG_PCMCIA=y +# CONFIG_PCMCIA_DEBUG is not set +# CONFIG_TCIC is not set + +# +# PCI Hotplug Support +# + +# +# Executable file formats +# +CONFIG_BINFMT_ELF=y +# CONFIG_BINFMT_MISC is not set + +# +# Device Drivers +# + +# +# Generic Driver Options +# +CONFIG_STANDALONE=y +CONFIG_PREVENT_FIRMWARE_BUILD=y +# CONFIG_FW_LOADER is not set +# 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_FD is not set +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=m +CONFIG_SCSI_PROC_FS=y + +# +# SCSI support type (disk, tape, CD-ROM) +# +CONFIG_BLK_DEV_SD=m +# CONFIG_CHR_DEV_ST is not set +# CONFIG_CHR_DEV_OSST is not set +CONFIG_BLK_DEV_SR=m +# CONFIG_BLK_DEV_SR_VENDOR is not set +CONFIG_CHR_DEV_SG=m + +# +# Some SCSI devices (e.g. CD jukebox) support multiple LUNs +# +CONFIG_SCSI_MULTI_LUN=y +# CONFIG_SCSI_CONSTANTS is not set +# CONFIG_SCSI_LOGGING is not set + +# +# SCSI Transport Attributes +# +# CONFIG_SCSI_SPI_ATTRS is not set +# 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 + +# +# PCMCIA SCSI adapter support +# +# CONFIG_PCMCIA_AHA152X is not set +# CONFIG_PCMCIA_FDOMAIN is not set +# CONFIG_PCMCIA_NINJA_SCSI is not set +# CONFIG_PCMCIA_QLOGIC is not set +# CONFIG_PCMCIA_SYM53C500 is not set + +# +# Multi-device support (RAID and LVM) +# +# CONFIG_MD is not set + +# +# Fusion MPT device support +# + +# +# IEEE 1394 (FireWire) support +# + +# +# 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=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=y +CONFIG_IP_PNP_DHCP=y +# CONFIG_IP_PNP_BOOTP is not set +# CONFIG_IP_PNP_RARP is not set +# CONFIG_NET_IPIP is not set +# CONFIG_NET_IPGRE 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_HW_FLOWCONTROL is not set + +# +# QoS and/or fair queueing +# +# CONFIG_NET_SCHED is not set +# CONFIG_NET_CLS_ROUTE 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 is not set +# 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 is not set +# CONFIG_SERIAL_NONSTANDARD is not set + +# +# Serial drivers +# +# CONFIG_SERIAL_8250 is not set + +# +# Non-8250 serial port support +# +CONFIG_SERIAL_CORE=y +CONFIG_SERIAL_CORE_CONSOLE=y +# CONFIG_SERIAL_M32R_SIO is not set +CONFIG_SERIAL_M32R_PLDSIO=y +CONFIG_SERIAL_M32R_PLDSIO_CONSOLE=y +CONFIG_UNIX98_PTYS=y +CONFIG_LEGACY_PTYS=y +CONFIG_LEGACY_PTY_COUNT=256 +# CONFIG_QIC02_TAPE is not set + +# +# IPMI +# +# CONFIG_IPMI_HANDLER is not set + +# +# Watchdog Cards +# +# CONFIG_WATCHDOG is not set +# CONFIG_RTC is not set +# CONFIG_GEN_RTC is not set +# CONFIG_DTLK is not set +# CONFIG_R3964 is not set + +# +# Ftape, the floppy tape device driver +# +# CONFIG_AGP is not set +# CONFIG_DRM is not set + +# +# PCMCIA character devices +# +# CONFIG_SYNCLINK_CS is not set +# CONFIG_RAW_DRIVER is not set + +# +# I2C support +# +# CONFIG_I2C is not set + +# +# Dallas's 1-wire bus +# +# CONFIG_W1 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 + +# +# 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=m +CONFIG_EXT3_FS_XATTR=y +# CONFIG_EXT3_FS_POSIX_ACL is not set +# CONFIG_EXT3_FS_SECURITY is not set +CONFIG_JBD=m +CONFIG_JBD_DEBUG=y +CONFIG_FS_MBCACHE=y +CONFIG_REISERFS_FS=m +# CONFIG_REISERFS_CHECK is not set +# CONFIG_REISERFS_PROC_INFO is not set +# CONFIG_REISERFS_FS_XATTR 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=m +CONFIG_JOLIET=y +# CONFIG_ZISOFS is not set +CONFIG_UDF_FS=m +CONFIG_UDF_NLS=y + +# +# DOS/FAT/NT Filesystems +# +CONFIG_FAT_FS=m +CONFIG_MSDOS_FS=m +CONFIG_VFAT_FS=m +CONFIG_FAT_DEFAULT_CODEPAGE=437 +CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" +# CONFIG_NTFS_FS is not set + +# +# Pseudo filesystems +# +CONFIG_PROC_FS=y +CONFIG_PROC_KCORE=y +CONFIG_SYSFS=y +CONFIG_DEVFS_FS=y +CONFIG_DEVFS_MOUNT=y +# CONFIG_DEVFS_DEBUG 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_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=y +# CONFIG_NFS_V4 is not set +# CONFIG_NFS_DIRECTIO is not set +# CONFIG_NFSD is not set +CONFIG_ROOT_NFS=y +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_CODA_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=y +CONFIG_NLS_DEFAULT="iso8859-1" +# CONFIG_NLS_CODEPAGE_437 is not set +# CONFIG_NLS_CODEPAGE_737 is not set +# CONFIG_NLS_CODEPAGE_775 is not set +# CONFIG_NLS_CODEPAGE_850 is not set +# CONFIG_NLS_CODEPAGE_852 is not set +# CONFIG_NLS_CODEPAGE_855 is not set +# CONFIG_NLS_CODEPAGE_857 is not set +# CONFIG_NLS_CODEPAGE_860 is not set +# CONFIG_NLS_CODEPAGE_861 is not set +# CONFIG_NLS_CODEPAGE_862 is not set +# CONFIG_NLS_CODEPAGE_863 is not set +# CONFIG_NLS_CODEPAGE_864 is not set +# CONFIG_NLS_CODEPAGE_865 is not set +# CONFIG_NLS_CODEPAGE_866 is not set +# CONFIG_NLS_CODEPAGE_869 is not set +# CONFIG_NLS_CODEPAGE_936 is not set +# CONFIG_NLS_CODEPAGE_950 is not set +# CONFIG_NLS_CODEPAGE_932 is not set +# CONFIG_NLS_CODEPAGE_949 is not set +# CONFIG_NLS_CODEPAGE_874 is not set +# CONFIG_NLS_ISO8859_8 is not set +# CONFIG_NLS_CODEPAGE_1250 is not set +# CONFIG_NLS_CODEPAGE_1251 is not set +# CONFIG_NLS_ASCII is not set +# CONFIG_NLS_ISO8859_1 is not set +# CONFIG_NLS_ISO8859_2 is not set +# CONFIG_NLS_ISO8859_3 is not set +# CONFIG_NLS_ISO8859_4 is not set +# CONFIG_NLS_ISO8859_5 is not set +# CONFIG_NLS_ISO8859_6 is not set +# CONFIG_NLS_ISO8859_7 is not set +# CONFIG_NLS_ISO8859_9 is not set +# CONFIG_NLS_ISO8859_13 is not set +# CONFIG_NLS_ISO8859_14 is not set +# CONFIG_NLS_ISO8859_15 is not set +# CONFIG_NLS_KOI8_R is not set +# CONFIG_NLS_KOI8_U is not set +# CONFIG_NLS_UTF8 is not set + +# +# Profiling support +# +# CONFIG_PROFILING is not set + +# +# Kernel hacking +# +CONFIG_DEBUG_KERNEL=y +# CONFIG_DEBUG_STACKOVERFLOW is not set +# CONFIG_DEBUG_SLAB is not set +# CONFIG_DEBUG_IOVIRT is not set +# CONFIG_MAGIC_SYSRQ is not set +# CONFIG_DEBUG_SPINLOCK is not set +# CONFIG_DEBUG_PAGEALLOC is not set +CONFIG_DEBUG_INFO=y +# CONFIG_DEBUG_SPINLOCK_SLEEP 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_CRC_CCITT is not set +CONFIG_CRC32=y +# CONFIG_LIBCRC32C is not set diff -Nru a/arch/m32r/opsput/dot.gdbinit b/arch/m32r/opsput/dot.gdbinit --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/m32r/opsput/dot.gdbinit 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,180 @@ +# .gdbinit file +# $Id: dot.gdbinit,v 1.1 2004/07/27 06:54:20 sakugawa Exp $ + +# setting +set width 0d70 +set radix 0d16 +set height 0 +debug_chaos + +define tlb_init + set $tlbbase = 0xfe000000 + set *(unsigned long *)($tlbbase + 0x04) = 0x0 + set *(unsigned long *)($tlbbase + 0x0c) = 0x0 + set *(unsigned long *)($tlbbase + 0x14) = 0x0 + set *(unsigned long *)($tlbbase + 0x1c) = 0x0 + set *(unsigned long *)($tlbbase + 0x24) = 0x0 + set *(unsigned long *)($tlbbase + 0x2c) = 0x0 + set *(unsigned long *)($tlbbase + 0x34) = 0x0 + set *(unsigned long *)($tlbbase + 0x3c) = 0x0 + set *(unsigned long *)($tlbbase + 0x44) = 0x0 + set *(unsigned long *)($tlbbase + 0x4c) = 0x0 + set *(unsigned long *)($tlbbase + 0x54) = 0x0 + set *(unsigned long *)($tlbbase + 0x5c) = 0x0 + set *(unsigned long *)($tlbbase + 0x64) = 0x0 + set *(unsigned long *)($tlbbase + 0x6c) = 0x0 + set *(unsigned long *)($tlbbase + 0x74) = 0x0 + set *(unsigned long *)($tlbbase + 0x7c) = 0x0 + set *(unsigned long *)($tlbbase + 0x84) = 0x0 + set *(unsigned long *)($tlbbase + 0x8c) = 0x0 + set *(unsigned long *)($tlbbase + 0x94) = 0x0 + set *(unsigned long *)($tlbbase + 0x9c) = 0x0 + set *(unsigned long *)($tlbbase + 0xa4) = 0x0 + set *(unsigned long *)($tlbbase + 0xac) = 0x0 + set *(unsigned long *)($tlbbase + 0xb4) = 0x0 + set *(unsigned long *)($tlbbase + 0xbc) = 0x0 + set *(unsigned long *)($tlbbase + 0xc4) = 0x0 + set *(unsigned long *)($tlbbase + 0xcc) = 0x0 + set *(unsigned long *)($tlbbase + 0xd4) = 0x0 + set *(unsigned long *)($tlbbase + 0xdc) = 0x0 + set *(unsigned long *)($tlbbase + 0xe4) = 0x0 + set *(unsigned long *)($tlbbase + 0xec) = 0x0 + set *(unsigned long *)($tlbbase + 0xf4) = 0x0 + set *(unsigned long *)($tlbbase + 0xfc) = 0x0 + set $tlbbase = 0xfe000800 + set *(unsigned long *)($tlbbase + 0x04) = 0x0 + set *(unsigned long *)($tlbbase + 0x0c) = 0x0 + set *(unsigned long *)($tlbbase + 0x14) = 0x0 + set *(unsigned long *)($tlbbase + 0x1c) = 0x0 + set *(unsigned long *)($tlbbase + 0x24) = 0x0 + set *(unsigned long *)($tlbbase + 0x2c) = 0x0 + set *(unsigned long *)($tlbbase + 0x34) = 0x0 + set *(unsigned long *)($tlbbase + 0x3c) = 0x0 + set *(unsigned long *)($tlbbase + 0x44) = 0x0 + set *(unsigned long *)($tlbbase + 0x4c) = 0x0 + set *(unsigned long *)($tlbbase + 0x54) = 0x0 + set *(unsigned long *)($tlbbase + 0x5c) = 0x0 + set *(unsigned long *)($tlbbase + 0x64) = 0x0 + set *(unsigned long *)($tlbbase + 0x6c) = 0x0 + set *(unsigned long *)($tlbbase + 0x74) = 0x0 + set *(unsigned long *)($tlbbase + 0x7c) = 0x0 + set *(unsigned long *)($tlbbase + 0x84) = 0x0 + set *(unsigned long *)($tlbbase + 0x8c) = 0x0 + set *(unsigned long *)($tlbbase + 0x94) = 0x0 + set *(unsigned long *)($tlbbase + 0x9c) = 0x0 + set *(unsigned long *)($tlbbase + 0xa4) = 0x0 + set *(unsigned long *)($tlbbase + 0xac) = 0x0 + set *(unsigned long *)($tlbbase + 0xb4) = 0x0 + set *(unsigned long *)($tlbbase + 0xbc) = 0x0 + set *(unsigned long *)($tlbbase + 0xc4) = 0x0 + set *(unsigned long *)($tlbbase + 0xcc) = 0x0 + set *(unsigned long *)($tlbbase + 0xd4) = 0x0 + set *(unsigned long *)($tlbbase + 0xdc) = 0x0 + set *(unsigned long *)($tlbbase + 0xe4) = 0x0 + set *(unsigned long *)($tlbbase + 0xec) = 0x0 + set *(unsigned long *)($tlbbase + 0xf4) = 0x0 + set *(unsigned long *)($tlbbase + 0xfc) = 0x0 +end + +define load_modules + use_debug_dma + load +end + +# Set kernel parameters +define set_kernel_parameters + set $param = (void*)0x88002000 + # INITRD_START +# set *(unsigned long *)($param + 0x0010) = 0x08300000 + # INITRD_SIZE +# set *(unsigned long *)($param + 0x0014) = 0x00400000 + # M32R_CPUCLK + set *(unsigned long *)($param + 0x0018) = 0d200000000 + # M32R_BUSCLK + set *(unsigned long *)($param + 0x001c) = 0d50000000 +# set *(unsigned long *)($param + 0x001c) = 0d25000000 + + # M32R_TIMER_DIVIDE + set *(unsigned long *)($param + 0x0020) = 0d128 + + set {char[0x200]}($param + 0x100) = "console=ttyD0,115200n8x\ + root=/dev/nfsroot \ + nfsroot=192.168.0.1:/project/m32r-linux/export/root.2.6 \ + nfsaddrs=192.168.0.101:192.168.0.1:192.168.0.1:255.255.255.0:mappi001 \ + mem=16m \0" +end + +define boot + set_kernel_parameters + set $pc=0x88001000 + set $fp=0 + set $evb=0x88000000 + # I/D-Cache ON + +# IPI +# set *(long *)0x00eff2f8 = 0x2 + set $fp=0 +# set *(unsigned long *)0xa0ef4000 = 0x100 + si +end + +# Show TLB entries +define show_tlb_entries + set $i = 0 + set $addr = $arg0 + use_mon_code + while ($i < 0d32 ) + set $tlb_tag = *(unsigned long*)$addr + set $tlb_data = *(unsigned long*)($addr + 4) + printf " [%2d] 0x%08lx : 0x%08lx - 0x%08lx\n", $i, $addr, $tlb_tag, $tlb_data + set $i = $i + 1 + set $addr = $addr + 8 + end +# use_debug_dma +end +define itlb + set $itlb=0xfe000000 + show_tlb_entries $itlb +end +define dtlb + set $dtlb=0xfe000800 + show_tlb_entries $dtlb +end + +define show_regs + printf " R0[%08lx] R1[%08lx] R2[%08lx] R3[%08lx]\n",$r0,$r1,$r2,$r3 + printf " R4[%08lx] R5[%08lx] R6[%08lx] R7[%08lx]\n",$r4,$r5,$r6,$r7 + printf " R8[%08lx] R9[%08lx] R10[%08lx] R11[%08lx]\n",$r8,$r9,$r10,$r11 + printf "R12[%08lx] FP[%08lx] LR[%08lx] SP[%08lx]\n",$r12,$fp,$lr,$sp + printf "PSW[%08lx] CBR[%08lx] SPI[%08lx] SPU[%08lx]\n",$psw,$cbr,$spi,$spu + printf "BPC[%08lx] PC[%08lx] ACCL[%08lx] ACCH[%08lx]\n",$bpc,$pc,$accl,$acch + printf "EVB[%08lx]\n",$evb +end + +define setup + debug_chaos + set *(unsigned long *)0xa0ef6004 = 0x0001053f + set *(unsigned long *)0xa0ef6028 = 0x00031102 +# set *(unsigned long *)0xa0ef400c = 0x2 +end + +sdireset +sdireset +file vmlinux +target m32rsdi +set $pc=0x0 +b *0x30000 +c +setup +tlb_init +load_modules +#set *(long *)0xa0ef4000=0x101 +#set *(long *)0xa0ef400c=0x002 + +boot +#b tme_handler +b *0x88000020 + + + + diff -Nru a/arch/mips/configs/tb0226_defconfig b/arch/mips/configs/tb0226_defconfig --- a/arch/mips/configs/tb0226_defconfig 2004-09-26 10:25:56 -07:00 +++ b/arch/mips/configs/tb0226_defconfig 2004-09-26 10:25:56 -07:00 @@ -272,7 +272,6 @@ CONFIG_IP_MULTIPLE_TABLES=y CONFIG_IP_ROUTE_NAT=y CONFIG_IP_ROUTE_MULTIPATH=y -CONFIG_IP_ROUTE_TOS=y CONFIG_IP_ROUTE_VERBOSE=y CONFIG_IP_PNP=y # CONFIG_IP_PNP_DHCP is not set diff -Nru a/arch/mips/configs/tb0229_defconfig b/arch/mips/configs/tb0229_defconfig --- a/arch/mips/configs/tb0229_defconfig 2004-09-26 10:25:57 -07:00 +++ b/arch/mips/configs/tb0229_defconfig 2004-09-26 10:25:57 -07:00 @@ -229,7 +229,6 @@ CONFIG_IP_MULTIPLE_TABLES=y CONFIG_IP_ROUTE_NAT=y CONFIG_IP_ROUTE_MULTIPATH=y -CONFIG_IP_ROUTE_TOS=y CONFIG_IP_ROUTE_VERBOSE=y CONFIG_IP_PNP=y # CONFIG_IP_PNP_DHCP is not set diff -Nru a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c --- a/arch/mips/kernel/signal.c 2004-09-26 10:25:58 -07:00 +++ b/arch/mips/kernel/signal.c 2004-09-26 10:25:58 -07:00 @@ -480,10 +480,8 @@ struct pt_regs *regs, int signr, sigset_t *set, siginfo_t *info); static inline void handle_signal(unsigned long sig, siginfo_t *info, - sigset_t *oldset, struct pt_regs *regs) + struct k_sigaction *ka, sigset_t *oldset, struct pt_regs *regs) { - struct k_sigaction *ka = ¤t->sighand->action[sig-1]; - switch(regs->regs[0]) { case ERESTART_RESTARTBLOCK: case ERESTARTNOHAND: @@ -535,6 +533,7 @@ asmlinkage int do_signal(sigset_t *oldset, struct pt_regs *regs) { + struct k_sigaction ka; siginfo_t info; int signr; @@ -560,9 +559,9 @@ if (!oldset) oldset = ¤t->blocked; - signr = get_signal_to_deliver(&info, regs, NULL); + signr = get_signal_to_deliver(&info, &ka, regs, NULL); if (signr > 0) { - handle_signal(signr, &info, oldset, regs); + handle_signal(signr, &info, &ka, oldset, regs); return 1; } diff -Nru a/arch/mips/vr41xx/common/giu.c b/arch/mips/vr41xx/common/giu.c --- a/arch/mips/vr41xx/common/giu.c 2004-09-26 10:25:55 -07:00 +++ b/arch/mips/vr41xx/common/giu.c 2004-09-26 10:25:55 -07:00 @@ -63,6 +63,12 @@ static uint32_t giu_base; +static struct irqaction giu_cascade = { + .handler = no_action, + .mask = CPU_MASK_NONE, + .name = "cascade", +}; + #define read_giuint(offset) readw(giu_base + (offset)) #define write_giuint(val, offset) writew((val), giu_base + (offset)) @@ -303,7 +309,6 @@ }; static struct vr41xx_giuint_cascade giuint_cascade[GIUINT_NR_IRQS]; -static struct irqaction giu_cascade = {no_action, 0, CPU_MASK_NONE, "cascade", NULL, NULL}; static int no_irq_number(int irq) { diff -Nru a/arch/mips/vr41xx/common/icu.c b/arch/mips/vr41xx/common/icu.c --- a/arch/mips/vr41xx/common/icu.c 2004-09-26 10:25:55 -07:00 +++ b/arch/mips/vr41xx/common/icu.c 2004-09-26 10:25:55 -07:00 @@ -51,6 +51,12 @@ static uint32_t icu1_base; static uint32_t icu2_base; +static struct irqaction icu_cascade = { + .handler = no_action, + .mask = CPU_MASK_NONE, + .name = "cascade", +}; + static unsigned char sysint1_assign[16] = { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; static unsigned char sysint2_assign[16] = { @@ -673,8 +679,6 @@ early_initcall(vr41xx_icu_init); /*=======================================================================*/ - -static struct irqaction icu_cascade = {no_action, 0, 0, "cascade", NULL, NULL}; static inline void init_vr41xx_icu_irq(void) { diff -Nru a/arch/mips/vr41xx/common/serial.c b/arch/mips/vr41xx/common/serial.c --- a/arch/mips/vr41xx/common/serial.c 2004-09-26 10:25:56 -07:00 +++ b/arch/mips/vr41xx/common/serial.c 2004-09-26 10:25:56 -07:00 @@ -115,7 +115,7 @@ port.line = vr41xx_serial_ports; port.uartclk = SIU_BASE_BAUD * 16; port.irq = SIU_IRQ; - port.flags = UPF_RESOURCES | UPF_BOOT_AUTOCONF | UPF_SKIP_TEST; + port.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST; switch (current_cpu_data.cputype) { case CPU_VR4111: case CPU_VR4121: @@ -160,7 +160,7 @@ port.line = vr41xx_serial_ports; port.uartclk = DSIU_BASE_BAUD * 16; port.irq = DSIU_IRQ; - port.flags = UPF_RESOURCES | UPF_BOOT_AUTOCONF | UPF_SKIP_TEST; + port.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST; port.mapbase = DSIU_BASE; port.regshift = 0; port.iotype = UPIO_MEM; diff -Nru a/arch/ppc/8260_io/fcc_enet.c b/arch/ppc/8260_io/fcc_enet.c --- a/arch/ppc/8260_io/fcc_enet.c 2004-09-26 10:25:56 -07:00 +++ b/arch/ppc/8260_io/fcc_enet.c 2004-09-26 10:25:56 -07:00 @@ -1986,9 +1986,9 @@ fccp = fcp->fccp; if (duplex) - fccp->fcc_fpsmr |= FCC_PSMR_FDE; + fccp->fcc_fpsmr |= FCC_PSMR_FDE | FCC_PSMR_LPB; else - fccp->fcc_fpsmr &= ~FCC_PSMR_FDE; + fccp->fcc_fpsmr &= ~(FCC_PSMR_FDE | FCC_PSMR_LPB); /* Enable transmit/receive */ fccp->fcc_gfmr |= FCC_GFMR_ENR | FCC_GFMR_ENT; diff -Nru a/arch/ppc/Kconfig b/arch/ppc/Kconfig --- a/arch/ppc/Kconfig 2004-09-26 10:25:57 -07:00 +++ b/arch/ppc/Kconfig 2004-09-26 10:25:57 -07:00 @@ -35,6 +35,10 @@ bool default y +config GENERIC_IOMAP + bool + default y + source "init/Kconfig" menu "Processor" diff -Nru a/arch/ppc/Makefile b/arch/ppc/Makefile --- a/arch/ppc/Makefile 2004-09-26 10:25:55 -07:00 +++ b/arch/ppc/Makefile 2004-09-26 10:25:55 -07:00 @@ -24,7 +24,7 @@ CPPFLAGS += -Iarch/$(ARCH) AFLAGS += -Iarch/$(ARCH) CFLAGS += -Iarch/$(ARCH) -msoft-float -pipe \ - -ffixed-r2 -Wno-uninitialized -mmultiple + -ffixed-r2 -mmultiple CPP = $(CC) -E $(CFLAGS) CHECKFLAGS += -D__powerpc__=1 diff -Nru a/arch/ppc/boot/common/ns16550.c b/arch/ppc/boot/common/ns16550.c --- a/arch/ppc/boot/common/ns16550.c 2004-09-26 10:25:57 -07:00 +++ b/arch/ppc/boot/common/ns16550.c 2004-09-26 10:25:57 -07:00 @@ -5,14 +5,14 @@ #include #include #include -#include #include #include +#include "nonstdio.h" +#include "serial.h" + #define SERIAL_BAUD 9600 -extern void outb(int port, unsigned char val); -extern unsigned char inb(int port); extern unsigned long ISA_io; static struct serial_state rs_table[RS_TABLE_SIZE] = { diff -Nru a/arch/ppc/boot/include/serial.h b/arch/ppc/boot/include/serial.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/ppc/boot/include/serial.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,46 @@ +/* + * A really private header file for the (dumb) serial driver in arch/ppc/boot + * + * Shamelessly taken from include/linux/serialP.h: + * + * Copyright (C) 1997 by Theodore Ts'o. + * + * Redistribution of this file is permitted under the terms of the GNU + * Public License (GPL) + */ + +#ifndef _PPC_BOOT_SERIALP_H +#define _PPC_BOOT_SERIALP_H + +/* + * This is our internal structure for each serial port's state. + * + * Many fields are paralleled by the structure used by the serial_struct + * structure. + * + * Given that this is how SERIAL_PORT_DFNS are done, and that we need + * to use a few of their fields, we need to have our own copy of it. + */ +struct serial_state { + int magic; + int baud_base; + unsigned long port; + int irq; + int flags; + int hub6; + int type; + int line; + int revision; /* Chip revision (950) */ + int xmit_fifo_size; + int custom_divisor; + int count; + u8 *iomem_base; + u16 iomem_reg_shift; + unsigned short close_delay; + unsigned short closing_wait; /* time to wait before closing */ + unsigned long icount; + int io_type; + void *info; + void *dev; +}; +#endif /* _PPC_BOOT_SERIAL_H */ diff -Nru a/arch/ppc/kernel/pci.c b/arch/ppc/kernel/pci.c --- a/arch/ppc/kernel/pci.c 2004-09-26 10:25:56 -07:00 +++ b/arch/ppc/kernel/pci.c 2004-09-26 10:25:56 -07:00 @@ -33,6 +33,7 @@ unsigned long isa_io_base = 0; unsigned long isa_mem_base = 0; unsigned long pci_dram_offset = 0; +int pcibios_assign_bus_offset = 1; void pcibios_make_OF_bus_map(void); @@ -411,7 +412,7 @@ r = &dev->resource[i]; if (!r->flags || (r->flags & IORESOURCE_UNSET)) continue; - if (pci_find_parent_resource(bus->self, r) != pr) + if (pci_find_parent_resource(dev, r) != pr) continue; if (r->end >= res->start && res->end >= r->start) { *conflict = r; @@ -1263,7 +1264,7 @@ bus = pci_scan_bus(hose->first_busno, hose->ops, hose); hose->last_busno = bus->subordinate; if (pci_assign_all_busses || next_busno <= hose->last_busno) - next_busno = hose->last_busno+1; + next_busno = hose->last_busno + pcibios_assign_bus_offset; } pci_bus_count = next_busno; diff -Nru a/arch/ppc/kernel/setup.c b/arch/ppc/kernel/setup.c --- a/arch/ppc/kernel/setup.c 2004-09-26 10:25:57 -07:00 +++ b/arch/ppc/kernel/setup.c 2004-09-26 10:25:57 -07:00 @@ -418,7 +418,6 @@ * are used for initrd_start and initrd_size, * otherwise they contain 0xdeadbeef. */ - cmd_line[0] = 0; if (r3 >= 0x4000 && r3 < 0x800000 && r4 == 0) { strlcpy(cmd_line, (char *)r3 + KERNELBASE, sizeof(cmd_line)); diff -Nru a/arch/ppc/lib/rheap.c b/arch/ppc/lib/rheap.c --- a/arch/ppc/lib/rheap.c 2004-09-26 10:25:56 -07:00 +++ b/arch/ppc/lib/rheap.c 2004-09-26 10:25:56 -07:00 @@ -216,7 +216,7 @@ /* Grow the after block backwards */ if (before == NULL && after != NULL) { - (int8_t *) after->start -= size; + after->start = (int8_t *)after->start - size; after->size += size; return; } @@ -407,7 +407,7 @@ /* blk still in free list, with updated start and/or size */ if (bs == s || be == e) { if (bs == s) - (int8_t *) blk->start += size; + blk->start = (int8_t *)blk->start + size; blk->size -= size; } else { @@ -471,7 +471,7 @@ newblk->owner = owner; /* blk still in free list, with updated start, size */ - (int8_t *) blk->start += size; + blk->start = (int8_t *)blk->start + size; blk->size -= size; start = newblk->start; @@ -535,7 +535,7 @@ /* blk still in free list, with updated start and/or size */ if (bs == s || be == e) { if (bs == s) - (int8_t *) blk->start += size; + blk->start = (int8_t *)blk->start + size; blk->size -= size; } else { diff -Nru a/arch/ppc/platforms/chrp_setup.c b/arch/ppc/platforms/chrp_setup.c --- a/arch/ppc/platforms/chrp_setup.c 2004-09-26 10:25:57 -07:00 +++ b/arch/ppc/platforms/chrp_setup.c 2004-09-26 10:25:57 -07:00 @@ -375,7 +375,7 @@ { struct device_node *np; int i; - unsigned long chrp_int_ack; + unsigned long chrp_int_ack = 0; unsigned char init_senses[NR_IRQS - NUM_8259_INTERRUPTS]; #if defined(CONFIG_VT) && defined(CONFIG_INPUT_ADBHID) && defined(XMON) struct device_node *kbd; diff -Nru a/arch/ppc/platforms/pmac_cpufreq.c b/arch/ppc/platforms/pmac_cpufreq.c --- a/arch/ppc/platforms/pmac_cpufreq.c 2004-09-26 10:25:56 -07:00 +++ b/arch/ppc/platforms/pmac_cpufreq.c 2004-09-26 10:25:56 -07:00 @@ -301,7 +301,6 @@ static int __pmac do_set_cpu_speed(int speed_mode) { struct cpufreq_freqs freqs; - int rc; freqs.old = cur_freq; freqs.new = (speed_mode == PMAC_CPU_HIGH_SPEED) ? hi_freq : low_freq; @@ -315,7 +314,7 @@ cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); cur_freq = (speed_mode == PMAC_CPU_HIGH_SPEED) ? hi_freq : low_freq; - return rc; + return 0; } static int __pmac pmac_cpufreq_verify(struct cpufreq_policy *policy) @@ -498,7 +497,7 @@ * - Titanium PowerBook 800 (PMU based, 667Mhz & 800Mhz) * - Titanium PowerBook 400 (PMU based, 300Mhz & 400Mhz) * - Titanium PowerBook 500 (PMU based, 300Mhz & 500Mhz) - * - iBook2 500 (PMU based, 400Mhz & 500Mhz) + * - iBook2 500/600 (PMU based, 400Mhz & 500/600Mhz) * - iBook2 700 (CPU based, 400Mhz & 700Mhz, support low voltage) * - Recent MacRISC3 laptops * - iBook G4s and PowerBook G4s with 7447A CPUs @@ -533,11 +532,8 @@ machine_is_compatible("PowerBook3,5") || machine_is_compatible("MacRISC3")) { pmac_cpufreq_init_MacRISC3(cpunode); - /* Else check for iBook2 500 */ + /* Else check for iBook2 500/600 */ } else if (machine_is_compatible("PowerBook4,1")) { - /* We only know about 500Mhz model */ - if (cur_freq < 450000 || cur_freq > 550000) - goto out; hi_freq = cur_freq; low_freq = 400000; set_speed_proc = pmu_set_cpu_speed; diff -Nru a/arch/ppc/platforms/pmac_feature.c b/arch/ppc/platforms/pmac_feature.c --- a/arch/ppc/platforms/pmac_feature.c 2004-09-26 10:25:57 -07:00 +++ b/arch/ppc/platforms/pmac_feature.c 2004-09-26 10:25:57 -07:00 @@ -2665,7 +2665,7 @@ struct device_node *p = of_get_parent(ui2c); if (p && !strcmp(p->name, "uni-n")) break; - ui2c = of_find_node_by_type(np, "i2c"); + ui2c = of_find_node_by_type(ui2c, "i2c"); } if (ui2c == NULL) break; diff -Nru a/arch/ppc/platforms/pmac_pci.c b/arch/ppc/platforms/pmac_pci.c --- a/arch/ppc/platforms/pmac_pci.c 2004-09-26 10:25:56 -07:00 +++ b/arch/ppc/platforms/pmac_pci.c 2004-09-26 10:25:56 -07:00 @@ -50,6 +50,7 @@ #endif /* CONFIG_POWER4 */ extern u8 pci_cache_line_size; +extern int pcibios_assign_bus_offset; struct pci_dev *k2_skiplist[2]; @@ -565,6 +566,14 @@ init_p2pbridge(); fixup_nec_usb2(); + + /* We are still having some issues with the Xserve G4, enabling + * some offset between bus number and domains for now when we + * assign all busses should help for now + */ + if (pci_assign_all_busses) + pcibios_assign_bus_offset = 0x10; + #ifdef CONFIG_POWER4 /* There is something wrong with DMA on U3/HT. I haven't figured out * the details yet, but if I set the cache line size to 128 bytes like diff -Nru a/arch/ppc/platforms/residual.c b/arch/ppc/platforms/residual.c --- a/arch/ppc/platforms/residual.c 2004-09-26 10:25:55 -07:00 +++ b/arch/ppc/platforms/residual.c 2004-09-26 10:25:55 -07:00 @@ -935,8 +935,8 @@ goto unknown; #define p pkt->L4_Pack.L4_Data.L4_PPCPack - /* Must be 32-bit memory address */ - if (!((p.PPCData[0] == 2) && (p.PPCData[1] == 32))) + /* Must be 32-bit system address */ + if (!((p.PPCData[0] == 3) && (p.PPCData[1] == 32))) goto unknown; /* It doesn't seem to work where length != 1 (what can I say? :-/ ) */ diff -Nru a/arch/ppc/syslib/open_pic.c b/arch/ppc/syslib/open_pic.c --- a/arch/ppc/syslib/open_pic.c 2004-09-26 10:25:56 -07:00 +++ b/arch/ppc/syslib/open_pic.c 2004-09-26 10:25:56 -07:00 @@ -412,7 +412,7 @@ /* Initialize the spurious interrupt */ if (ppc_md.progress) ppc_md.progress("openpic: spurious",0x3bd); - openpic_set_spurious(OPENPIC_VEC_SPURIOUS+offset); + openpic_set_spurious(OPENPIC_VEC_SPURIOUS); openpic_disable_8259_pass_through(); #ifdef CONFIG_EPIC_SERIAL_MODE openpic_eicr_set_clk(7); /* Slowest value until we know better */ @@ -865,7 +865,7 @@ irq = cirq; openpic_eoi(); } - } else if (irq == OPENPIC_VEC_SPURIOUS + open_pic_irq_offset) + } else if (irq == OPENPIC_VEC_SPURIOUS) irq = -1; return irq; } @@ -988,9 +988,9 @@ /* OpenPIC sometimes seem to need some time to be fully back up... */ do { - openpic_set_spurious(OPENPIC_VEC_SPURIOUS+open_pic_irq_offset); + openpic_set_spurious(OPENPIC_VEC_SPURIOUS); } while(openpic_readfield(&OpenPIC->Global.Spurious_Vector, OPENPIC_VECTOR_MASK) - != (OPENPIC_VEC_SPURIOUS + open_pic_irq_offset)); + != OPENPIC_VEC_SPURIOUS); openpic_disable_8259_pass_through(); diff -Nru a/arch/ppc/syslib/open_pic2.c b/arch/ppc/syslib/open_pic2.c --- a/arch/ppc/syslib/open_pic2.c 2004-09-26 10:25:56 -07:00 +++ b/arch/ppc/syslib/open_pic2.c 2004-09-26 10:25:56 -07:00 @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include diff -Nru a/arch/ppc/syslib/prom_init.c b/arch/ppc/syslib/prom_init.c --- a/arch/ppc/syslib/prom_init.c 2004-09-26 10:25:57 -07:00 +++ b/arch/ppc/syslib/prom_init.c 2004-09-26 10:25:57 -07:00 @@ -115,11 +115,11 @@ ihandle prom_chosen __initdata; ihandle prom_stdout __initdata; -char *prom_display_paths[FB_MAX] __initdata; -phandle prom_display_nodes[FB_MAX] __initdata; -unsigned int prom_num_displays __initdata; -char *of_stdout_device __initdata; +static char *prom_display_paths[FB_MAX] __initdata; +static phandle prom_display_nodes[FB_MAX] __initdata; +static unsigned int prom_num_displays __initdata; static ihandle prom_disp_node __initdata; +char *of_stdout_device __initdata; unsigned int rtas_data; /* physical pointer */ unsigned int rtas_entry; /* physical pointer */ @@ -403,6 +403,7 @@ for (j=0; j&1 | grep -- '--synthetic' > /dev/null; then echo y; else echo n; fi) + +ifeq ($(new_nm),y) +NM := $(NM) --synthetic +endif + CHECKFLAGS += -m64 -D__powerpc__=1 LDFLAGS := -m elf64ppc LDFLAGS_vmlinux := -Bstatic -e $(KERNELLOAD) -Ttext $(KERNELLOAD) -CFLAGS += -msoft-float -pipe -Wno-uninitialized -mminimal-toc \ - -mtraceback=none +CFLAGS += -msoft-float -pipe -mminimal-toc -mtraceback=none ifeq ($(CONFIG_POWER4_ONLY),y) CFLAGS += $(call cc-option,-mcpu=power4) diff -Nru a/arch/ppc64/boot/Makefile b/arch/ppc64/boot/Makefile --- a/arch/ppc64/boot/Makefile 2004-09-26 10:25:57 -07:00 +++ b/arch/ppc64/boot/Makefile 2004-09-26 10:25:57 -07:00 @@ -29,8 +29,9 @@ BOOTAS := $(CROSS32_COMPILE)as BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional BOOTLD := $(CROSS32_COMPILE)ld -BOOTLFLAGS := -Ttext 0x00400000 -e _start -T $(obj)/zImage.lds +BOOTLFLAGS := -Ttext 0x00400000 -e _start -T $(srctree)/$(src)/zImage.lds BOOTOBJCOPY := $(CROSS32_COMPILE)objcopy +BOOTSTRIP := $(CROSS32_COMPILE)strip OBJCOPYFLAGS := contents,alloc,load,readonly,data src-boot := crt0.S string.S prom.c main.c zlib.c imagesize.c div64.S @@ -51,36 +52,31 @@ #----------------------------------------------------------- # ELF sections within the zImage bootloader/wrapper #----------------------------------------------------------- -required := vmlinux .config System.map +required := vmlinux.strip initrd := initrd obj-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.o, $(section))) src-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.c, $(section))) gz-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.gz, $(section))) -hostprogs-y := piggy addnote addSystemMap addRamDisk +hostprogs-y := piggy addnote addRamDisk targets += zImage zImage.initrd imagesize.c \ $(patsubst $(obj)/%,%, $(call obj-sec, $(required) $(initrd))) \ $(patsubst $(obj)/%,%, $(call src-sec, $(required) $(initrd))) \ $(patsubst $(obj)/%,%, $(call gz-sec, $(required) $(initrd))) \ - vmlinux.sm vmlinux.initrd vmlinux.sminitrd -extra-y := sysmap.o initrd.o - -quiet_cmd_sysmap = SYSMAP $@ - cmd_sysmap = $(obj)/addSystemMap System.map $< $@ -$(obj)/vmlinux.sm: vmlinux $(obj)/addSystemMap System.map FORCE - $(call if_changed,sysmap) + vmlinux.initrd +extra-y := initrd.o quiet_cmd_ramdisk = RAMDISK $@ - cmd_ramdisk = $(obj)/addRamDisk $(obj)/ramdisk.image.gz System.map $< $@ -$(obj)/vmlinux.initrd: vmlinux $(obj)/addRamDisk $(obj)/ramdisk.image.gz System.map FORCE - $(call if_changed,ramdisk) + cmd_ramdisk = $(obj)/addRamDisk $(obj)/ramdisk.image.gz $< $@ -$(obj)/vmlinux.sminitrd: $(obj)/vmlinux.sm $(obj)/addRamDisk $(obj)/ramdisk.image.gz FORCE - $(call if_changed,ramdisk) +quiet_cmd_stripvm = STRIP $@ + cmd_stripvm = $(BOOTSTRIP) -s $< -o $@ -$(obj)/sysmap.o: System.map $(obj)/piggyback FORCE - $(call if_changed,piggy) +vmlinux.strip: vmlinux FORCE + $(call if_changed,stripvm) +$(obj)/vmlinux.initrd: vmlinux.strip $(obj)/addRamDisk $(obj)/ramdisk.image.gz FORCE + $(call if_changed,ramdisk) addsection = $(BOOTOBJCOPY) $(1) \ --add-section=.kernel:$(strip $(patsubst $(obj)/kernel-%.o,%, $(1)))=$(patsubst %.o,%.gz, $(1)) \ @@ -113,9 +109,9 @@ $(obj)/zImage.initrd: $(call obj-sec, $(required) $(initrd)) $(obj-boot) $(obj)/addnote FORCE $(call if_changed,addnote) -$(obj)/imagesize.c: vmlinux +$(obj)/imagesize.c: vmlinux.strip @echo Generating $@ - ls -l vmlinux | \ + ls -l vmlinux.strip | \ awk '{printf "/* generated -- do not edit! */\n" \ "unsigned long vmlinux_filesize = %d;\n", $$5}' > $(obj)/imagesize.c $(CROSS_COMPILE)nm -n vmlinux | tail -n 1 | \ @@ -123,6 +119,6 @@ >> $(obj)/imagesize.c install: $(CONFIGURE) $(obj)/$(BOOTIMAGE) - sh -x $(src)/install.sh "$(KERNELRELEASE)" "$(obj)/$(BOOTIMAGE)" "$(TOPDIR)/System.map" "$(INSTALL_PATH)" + sh -x $(src)/install.sh "$(KERNELRELEASE)" "$(obj)/$(BOOTIMAGE)" "$(INSTALL_PATH)" -clean-files := $(patsubst $(obj)/%,%, $(obj-boot)) +clean-files := $(addprefix $(objtree)/, $(obj-boot) vmlinux.strip) diff -Nru a/arch/ppc64/boot/addSystemMap.c b/arch/ppc64/boot/addSystemMap.c --- a/arch/ppc64/boot/addSystemMap.c 2004-09-26 10:25:56 -07:00 +++ /dev/null Wed Dec 31 16:00:00 196900 @@ -1,248 +0,0 @@ -#include -#include -#include -#include -#include -#include - -void xlate( char * inb, char * trb, unsigned len ) -{ - unsigned i; - for ( i=0; i> 4; - char c2 = c & 0xf; - if ( c1 > 9 ) - c1 = c1 + 'A' - 10; - else - c1 = c1 + '0'; - if ( c2 > 9 ) - c2 = c2 + 'A' - 10; - else - c2 = c2 + '0'; - *trb++ = c1; - *trb++ = c2; - } - *trb = 0; -} - -#define ElfHeaderSize (64 * 1024) -#define ElfPages (ElfHeaderSize / 4096) - -void get4k( /*istream *inf*/FILE *file, char *buf ) -{ - unsigned j; - unsigned num = fread(buf, 1, 4096, file); - for ( j=num; j<4096; ++j ) - buf[j] = 0; -} - -void put4k( /*ostream *outf*/FILE *file, char *buf ) -{ - fwrite(buf, 1, 4096, file); -} - -int main(int argc, char **argv) -{ - char inbuf[4096]; - FILE *sysmap = NULL; - char* ptr_end = NULL; - FILE *inputVmlinux = NULL; - FILE *outputVmlinux = NULL; - long i = 0; - unsigned long sysmapFileLen = 0; - unsigned long sysmapLen = 0; - unsigned long roundR = 0; - unsigned long kernelLen = 0; - unsigned long actualKernelLen = 0; - unsigned long round = 0; - unsigned long roundedKernelLen = 0; - unsigned long sysmapStartOffs = 0; - unsigned long sysmapPages = 0; - unsigned long roundedKernelPages = 0; - long padPages = 0; - if ( argc < 2 ) - { - fprintf(stderr, "Name of System Map file missing.\n"); - exit(1); - } - - if ( argc < 3 ) - { - fprintf(stderr, "Name of vmlinux file missing.\n"); - exit(1); - } - - if ( argc < 4 ) - { - fprintf(stderr, "Name of vmlinux output file missing.\n"); - exit(1); - } - - sysmap = fopen(argv[1], "r"); - if ( ! sysmap ) - { - fprintf(stderr, "System Map file \"%s\" failed to open.\n", argv[1]); - exit(1); - } - inputVmlinux = fopen(argv[2], "r"); - if ( ! inputVmlinux ) - { - fprintf(stderr, "vmlinux file \"%s\" failed to open.\n", argv[2]); - exit(1); - } - outputVmlinux = fopen(argv[3], "w"); - if ( ! outputVmlinux ) - { - fprintf(stderr, "output vmlinux file \"%s\" failed to open.\n", argv[3]); - exit(1); - } - - - - fseek(inputVmlinux, 0, SEEK_END); - kernelLen = ftell(inputVmlinux); - fseek(inputVmlinux, 0, SEEK_SET); - printf("kernel file size = %ld\n", kernelLen); - if ( kernelLen == 0 ) - { - fprintf(stderr, "You must have a linux kernel specified as argv[2]\n"); - exit(1); - } - - - actualKernelLen = kernelLen - ElfHeaderSize; - - printf("actual kernel length (minus ELF header) = %ld/%lxx \n", actualKernelLen, actualKernelLen); - - round = actualKernelLen % 4096; - roundedKernelLen = actualKernelLen; - if ( round ) - roundedKernelLen += (4096 - round); - - printf("Kernel length rounded up to a 4k multiple = %ld/%lxx \n", roundedKernelLen, roundedKernelLen); - roundedKernelPages = roundedKernelLen / 4096; - printf("Kernel pages to copy = %ld/%lxx\n", roundedKernelPages, roundedKernelPages); - - - - /* Sysmap file */ - fseek(sysmap, 0, SEEK_END); - sysmapFileLen = ftell(sysmap); - fseek(sysmap, 0, SEEK_SET); - printf("%s file size = %ld\n", argv[1], sysmapFileLen); - - sysmapLen = sysmapFileLen; - - roundR = 4096 - (sysmapLen % 4096); - if (roundR) - { - printf("Rounding System Map file up to a multiple of 4096, adding %ld\n", roundR); - sysmapLen += roundR; - } - printf("Rounded System Map size is %ld\n", sysmapLen); - - /* Process the Sysmap file to determine the true end of the kernel */ - sysmapPages = sysmapLen / 4096; - printf("System map pages to copy = %ld\n", sysmapPages); - /* read the whole file line by line, expect that it doesn't fail */ - while ( fgets(inbuf, 4096, sysmap) ) ; - /* search for _end in the last page of the system map */ - ptr_end = strstr(inbuf, " _end"); - if (!ptr_end) - { - fprintf(stderr, "Unable to find _end in the sysmap file \n"); - fprintf(stderr, "inbuf: \n"); - fprintf(stderr, "%s \n", inbuf); - exit(1); - } - printf("Found _end in the last page of the sysmap - backing up 10 characters it looks like %s", ptr_end-10); - sysmapStartOffs = (unsigned int)strtol(ptr_end-10, NULL, 16); - /* calc how many pages we need to insert between the vmlinux and the start of the sysmap */ - padPages = sysmapStartOffs/4096 - roundedKernelPages; - - /* Check and see if the vmlinux is larger than _end in System.map */ - if (padPages < 0) - { /* vmlinux is larger than _end - adjust the offset to start the embedded system map */ - sysmapStartOffs = roundedKernelLen; - printf("vmlinux is larger than _end indicates it needs to be - sysmapStartOffs = %lx \n", sysmapStartOffs); - padPages = 0; - printf("will insert %lx pages between the vmlinux and the start of the sysmap \n", padPages); - } - else - { /* _end is larger than vmlinux - use the sysmapStartOffs we calculated from the system map */ - printf("vmlinux is smaller than _end indicates is needed - sysmapStartOffs = %lx \n", sysmapStartOffs); - printf("will insert %lx pages between the vmlinux and the start of the sysmap \n", padPages); - } - - - - - /* Copy 64K ELF header */ - for (i=0; i<(ElfPages); ++i) - { - get4k( inputVmlinux, inbuf ); - put4k( outputVmlinux, inbuf ); - } - - - /* Copy the vmlinux (as full pages). */ - fseek(inputVmlinux, ElfHeaderSize, SEEK_SET); - for ( i=0; i 0 ) { - sysmap.addr = (RAM_END - sysmap.size) & ~0xFFF; - claim(sysmap.addr, RAM_END - sysmap.addr, 0); - printf("initial ramdisk moving 0x%lx <- 0x%lx (%lx bytes)\n\r", - sysmap.addr, (unsigned long)_sysmap_start, sysmap.size); - memcpy((void *)sysmap.addr, (void *)_sysmap_start, sysmap.size); + /* + * Now we try to claim some memory for the kernel itself + * our "vmlinux_memsize" is the memory footprint in RAM, _HOWEVER_, what + * our Makefile stuffs in is an image containing all sort of junk including + * an ELF header. We need to do some calculations here to find the right + * size... In practice we add 1Mb, that is enough, but we should really + * consider fixing the Makefile to put a _raw_ kernel in there ! + */ + vmlinux_memsize += 0x100000; + printf("Allocating 0x%lx bytes for kernel ...\n\r", vmlinux_memsize); + vmlinux.addr = try_claim(vmlinux_memsize); + if (vmlinux.addr == 0) { + printf("Can't allocate memory for kernel image !\n\r"); + exit(); } -#endif + vmlinuz.addr = (unsigned long)_vmlinux_start; + vmlinuz.size = (unsigned long)(_vmlinux_end - _vmlinux_start); + vmlinux.size = PAGE_ALIGN(vmlinux_filesize); + vmlinux.memsize = vmlinux_memsize; + /* + * Now we try to claim memory for the initrd (and copy it there) + */ initrd.size = (unsigned long)(_initrd_end - _initrd_start); initrd.memsize = initrd.size; if ( initrd.size > 0 ) { - initrd.addr = (RAM_END - initrd.size) & ~0xFFF; - a1 = a2 = 0; - claim(initrd.addr, RAM_END - initrd.addr, 0); + printf("Allocating 0x%lx bytes for initrd ...\n\r", initrd.size); + initrd.addr = try_claim(initrd.size); + if (initrd.addr == 0) { + printf("Can't allocate memory for initial ramdisk !\n\r"); + exit(); + } + a1 = initrd.addr; + a2 = initrd.size; printf("initial ramdisk moving 0x%lx <- 0x%lx (%lx bytes)\n\r", initrd.addr, (unsigned long)_initrd_start, initrd.size); - memcpy((void *)initrd.addr, (void *)_initrd_start, initrd.size); + memmove((void *)initrd.addr, (void *)_initrd_start, initrd.size); + printf("initrd head: 0x%lx\n", *((u32 *)initrd.addr)); } - vmlinuz.addr = (unsigned long)_vmlinux_start; - vmlinuz.size = (unsigned long)(_vmlinux_end - _vmlinux_start); - vmlinux.addr = (unsigned long)(void *)-1; - vmlinux.size = PAGE_ALIGN(vmlinux_filesize); - vmlinux.memsize = vmlinux_memsize; - - claim_size = vmlinux.memsize /* PPPBBB: + fudge for bi_recs */; - for(claim_addr = PROG_START; - claim_addr <= PROG_START * 8; - claim_addr += 0x100000) { -#ifdef DEBUG - printf(" trying: 0x%08lx\n\r", claim_addr); -#endif - vmlinux.addr = (unsigned long)claim(claim_addr, claim_size, 0); - if ((void *)vmlinux.addr != (void *)-1) break; - } - if ((void *)vmlinux.addr == (void *)-1) { - printf("claim error, can't allocate kernel memory\n\r"); - exit(); - } - - /* PPPBBB: should kernel always be gziped? */ + /* Eventually gunzip the kernel */ if (*(unsigned short *)vmlinuz.addr == 0x1f8b) { + int len; avail_ram = scratch; begin_avail = avail_high = avail_ram; end_avail = scratch + sizeof(scratch); printf("gunzipping (0x%lx <- 0x%lx:0x%0lx)...", vmlinux.addr, vmlinuz.addr, vmlinuz.addr+vmlinuz.size); + len = vmlinuz.size; gunzip((void *)vmlinux.addr, vmlinux.size, - (unsigned char *)vmlinuz.addr, (int *)&vmlinuz.size); - printf("done %lu bytes\n\r", vmlinuz.size); - printf("%u bytes of heap consumed, max in use %u\n\r", + (unsigned char *)vmlinuz.addr, &len); + printf("done 0x%lx bytes\n\r", len); + printf("0x%x bytes of heap consumed, max in use 0x%\n\r", (unsigned)(avail_high - begin_avail), heap_max); } else { memmove((void *)vmlinux.addr,(void *)vmlinuz.addr,vmlinuz.size); @@ -192,7 +202,8 @@ flush_cache((void *)vmlinux.addr, vmlinux.memsize); - bi_recs = make_bi_recs(vmlinux.addr + vmlinux.memsize); + if (a1) + printf("initrd head: 0x%lx\n\r", *((u32 *)initrd.addr)); kernel_entry = (kernel_entry_t)vmlinux.addr; #ifdef DEBUG @@ -203,63 +214,14 @@ " prom = 0x%lx,\n\r" " bi_recs = 0x%lx,\n\r", (unsigned long)kernel_entry, a1, a2, - (unsigned long)prom, (unsigned long)bi_recs); + (unsigned long)prom, NULL); #endif - kernel_entry( a1, a2, prom, bi_recs ); + kernel_entry( a1, a2, prom, NULL ); printf("Error: Linux kernel returned to zImage bootloader!\n\r"); exit(); -} - -static struct bi_record * -make_bi_recs(unsigned long addr) -{ - struct bi_record *bi_recs; - struct bi_record *rec; - - bi_recs = rec = bi_rec_init(addr); - - rec = bi_rec_alloc(rec, 2); - rec->tag = BI_FIRST; - /* rec->data[0] = ...; # Written below before return */ - /* rec->data[1] = ...; # Written below before return */ - - rec = bi_rec_alloc_bytes(rec, strlen("chrpboot")+1); - rec->tag = BI_BOOTLOADER_ID; - sprintf( (char *)rec->data, "chrpboot"); - - rec = bi_rec_alloc(rec, 2); - rec->tag = BI_MACHTYPE; - rec->data[0] = PLATFORM_PSERIES; - rec->data[1] = 1; - - if ( initrd.size > 0 ) { - rec = bi_rec_alloc(rec, 2); - rec->tag = BI_INITRD; - rec->data[0] = initrd.addr; - rec->data[1] = initrd.size; - } - - if ( sysmap.size > 0 ) { - rec = bi_rec_alloc(rec, 2); - rec->tag = BI_SYSMAP; - rec->data[0] = (unsigned long)sysmap.addr; - rec->data[1] = (unsigned long)sysmap.size; - } - - rec = bi_rec_alloc(rec, 1); - rec->tag = BI_LAST; - rec->data[0] = (bi_rec_field)bi_recs; - - /* Save the _end_ address of the bi_rec's in the first bi_rec - * data field for easy access by the kernel. - */ - bi_recs->data[0] = (bi_rec_field)rec; - bi_recs->data[1] = (bi_rec_field)rec + rec->size - (bi_rec_field)bi_recs; - - return bi_recs; } struct memchunk { diff -Nru a/arch/ppc64/boot/zImage.lds b/arch/ppc64/boot/zImage.lds --- a/arch/ppc64/boot/zImage.lds 2004-09-26 10:25:55 -07:00 +++ b/arch/ppc64/boot/zImage.lds 2004-09-26 10:25:55 -07:00 @@ -61,18 +61,8 @@ . = ALIGN(4096); _vmlinux_start = .; - .kernel:vmlinux : { *(.kernel:vmlinux) } + .kernel:vmlinux.strip : { *(.kernel:vmlinux.strip) } _vmlinux_end = .; - - . = ALIGN(4096); - _dotconfig_start = .; - .kernel:.config : { *(.kernel:.config) } - _dotconfig_end = .; - - . = ALIGN(4096); - _sysmap_start = .; - .kernel:System.map : { *(.kernel:System.map) } - _sysmap_end = .; . = ALIGN(4096); _initrd_start = .; diff -Nru a/arch/ppc64/configs/g5_defconfig b/arch/ppc64/configs/g5_defconfig --- a/arch/ppc64/configs/g5_defconfig 2004-09-26 10:25:55 -07:00 +++ b/arch/ppc64/configs/g5_defconfig 2004-09-26 10:25:55 -07:00 @@ -1,5 +1,7 @@ # # Automatically generated make config: don't edit +# Linux kernel version: 2.6.9-rc2 +# Thu Sep 23 17:07:00 2004 # CONFIG_64BIT=y CONFIG_MMU=y @@ -16,11 +18,11 @@ # CONFIG_EXPERIMENTAL=y CONFIG_CLEAN_COMPILE=y -CONFIG_STANDALONE=y # # General setup # +CONFIG_LOCALVERSION="" CONFIG_SWAP=y CONFIG_SYSVIPC=y # CONFIG_POSIX_MQUEUE is not set @@ -32,6 +34,8 @@ # CONFIG_IKCONFIG is not set # CONFIG_EMBEDDED is not set CONFIG_KALLSYMS=y +# CONFIG_KALLSYMS_ALL is not set +# CONFIG_KALLSYMS_EXTRA_PASS is not set CONFIG_FUTEX=y CONFIG_EPOLL=y CONFIG_IOSCHED_NOOP=y @@ -39,6 +43,8 @@ CONFIG_IOSCHED_DEADLINE=y CONFIG_IOSCHED_CFQ=y # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set +CONFIG_SHMEM=y +# CONFIG_TINY_SHMEM is not set # # Loadable module support @@ -50,17 +56,19 @@ # CONFIG_MODVERSIONS is not set # CONFIG_KMOD is not set CONFIG_STOP_MACHINE=y +CONFIG_SYSVIPC_COMPAT=y # # Platform support # # CONFIG_PPC_ISERIES is not set -CONFIG_PPC_PSERIES=y +CONFIG_PPC_MULTIPLATFORM=y +# CONFIG_PPC_PSERIES is not set +CONFIG_PPC_PMAC=y CONFIG_PPC=y CONFIG_PPC64=y CONFIG_PPC_OF=y CONFIG_ALTIVEC=y -CONFIG_PPC_PMAC=y CONFIG_PMAC_DART=y CONFIG_PPC_PMAC64=y CONFIG_BOOTX_TEXT=y @@ -69,8 +77,8 @@ CONFIG_SMP=y CONFIG_IRQ_ALL_CPUS=y CONFIG_NR_CPUS=2 -# CONFIG_HMT is not set -# CONFIG_DISCONTIGMEM is not set +# CONFIG_SCHED_SMT is not set +# CONFIG_PREEMPT is not set # CONFIG_PPC_RTAS is not set # CONFIG_LPARCFG is not set @@ -104,6 +112,8 @@ # # Generic Driver Options # +CONFIG_STANDALONE=y +CONFIG_PREVENT_FIRMWARE_BUILD=y CONFIG_FW_LOADER=y # CONFIG_DEBUG_DRIVER is not set @@ -132,7 +142,8 @@ CONFIG_BLK_DEV_LOOP=y # CONFIG_BLK_DEV_CRYPTOLOOP is not set CONFIG_BLK_DEV_NBD=m -# CONFIG_BLK_DEV_CARMEL is not set +# CONFIG_BLK_DEV_SX8 is not set +# CONFIG_BLK_DEV_UB is not set CONFIG_BLK_DEV_RAM=y CONFIG_BLK_DEV_RAM_SIZE=8192 CONFIG_BLK_DEV_INITRD=y @@ -146,9 +157,9 @@ # # Please see Documentation/ide.txt for help/info on IDE drives # +# CONFIG_BLK_DEV_IDE_SATA is not set CONFIG_BLK_DEV_IDEDISK=y # CONFIG_IDEDISK_MULTI_MODE is not set -# CONFIG_IDEDISK_STROKE is not set CONFIG_BLK_DEV_IDECD=y CONFIG_BLK_DEV_IDETAPE=y CONFIG_BLK_DEV_IDEFLOPPY=y @@ -170,7 +181,6 @@ # CONFIG_BLK_DEV_IDEDMA_FORCED is not set CONFIG_IDEDMA_PCI_AUTO=y # CONFIG_IDEDMA_ONLYDISK is not set -CONFIG_BLK_DEV_ADMA=y # CONFIG_BLK_DEV_AEC62XX is not set # CONFIG_BLK_DEV_ALI15X3 is not set # CONFIG_BLK_DEV_AMD74XX is not set @@ -196,6 +206,7 @@ CONFIG_BLK_DEV_IDEDMA_PMAC=y # CONFIG_BLK_DEV_IDE_PMAC_BLINK is not set CONFIG_BLK_DEV_IDEDMA_PMAC_AUTO=y +# CONFIG_IDE_ARM is not set CONFIG_BLK_DEV_IDEDMA=y # CONFIG_IDEDMA_IVB is not set CONFIG_IDEDMA_AUTO=y @@ -221,7 +232,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 @@ -235,23 +245,25 @@ # SCSI low-level drivers # # CONFIG_BLK_DEV_3W_XXXX_RAID is not set +# CONFIG_SCSI_3W_9XXX is not set # CONFIG_SCSI_ACARD is not set # CONFIG_SCSI_AACRAID is not set # CONFIG_SCSI_AIC7XXX is not set # CONFIG_SCSI_AIC7XXX_OLD is not set # CONFIG_SCSI_AIC79XX is not set -# CONFIG_SCSI_ADVANSYS is not set -# CONFIG_SCSI_MEGARAID is not set +# CONFIG_MEGARAID_NEWGEN is not set +# CONFIG_MEGARAID_LEGACY is not set CONFIG_SCSI_SATA=y CONFIG_SCSI_SATA_SVW=y # CONFIG_SCSI_ATA_PIIX is not set +# CONFIG_SCSI_SATA_NV is not set # CONFIG_SCSI_SATA_PROMISE is not set +# CONFIG_SCSI_SATA_SX4 is not set # CONFIG_SCSI_SATA_SIL is not set # CONFIG_SCSI_SATA_SIS is not set # CONFIG_SCSI_SATA_VIA is not set # CONFIG_SCSI_SATA_VITESSE is not set # CONFIG_SCSI_BUSLOGIC is not set -# CONFIG_SCSI_CPQFCTS is not set # CONFIG_SCSI_DMX3191D is not set # CONFIG_SCSI_EATA is not set # CONFIG_SCSI_EATA_PIO is not set @@ -264,6 +276,7 @@ CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16 CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64 # CONFIG_SCSI_SYM53C8XX_IOMAPPED 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 @@ -277,7 +290,6 @@ # CONFIG_SCSI_DC395x is not set # CONFIG_SCSI_DC390T is not set # CONFIG_SCSI_DEBUG is not set -# CONFIG_SCSI_MESH is not set # CONFIG_SCSI_MAC53C94 is not set # @@ -288,11 +300,15 @@ CONFIG_MD_LINEAR=y CONFIG_MD_RAID0=y CONFIG_MD_RAID1=y +# CONFIG_MD_RAID10 is not set CONFIG_MD_RAID5=y # CONFIG_MD_RAID6 is not set # CONFIG_MD_MULTIPATH is not set CONFIG_BLK_DEV_DM=y # CONFIG_DM_CRYPT is not set +# CONFIG_DM_SNAPSHOT is not set +# CONFIG_DM_MIRROR is not set +# CONFIG_DM_ZERO is not set # # Fusion MPT device support @@ -332,6 +348,7 @@ # # I2O device support # +# CONFIG_I2O is not set # # Macintosh device drivers @@ -340,7 +357,6 @@ CONFIG_ADB_PMU=y # CONFIG_PMAC_PBOOK is not set # CONFIG_PMAC_BACKLIGHT is not set -# CONFIG_MAC_SERIAL is not set # CONFIG_INPUT_ADBHID is not set CONFIG_THERM_PM72=y @@ -369,14 +385,13 @@ CONFIG_INET_AH=m CONFIG_INET_ESP=m CONFIG_INET_IPCOMP=m +CONFIG_INET_TUNNEL=y # # IP: Virtual Server Configuration # # 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 @@ -384,6 +399,8 @@ # IP: Netfilter Configuration # CONFIG_IP_NF_CONNTRACK=y +# CONFIG_IP_NF_CT_ACCT is not set +# CONFIG_IP_NF_CT_PROTO_SCTP is not set # CONFIG_IP_NF_FTP is not set # CONFIG_IP_NF_IRC is not set # CONFIG_IP_NF_TFTP is not set @@ -408,8 +425,14 @@ CONFIG_IP_NF_MATCH_STATE=y CONFIG_IP_NF_MATCH_CONNTRACK=y CONFIG_IP_NF_MATCH_OWNER=y +# CONFIG_IP_NF_MATCH_ADDRTYPE is not set +# CONFIG_IP_NF_MATCH_REALM is not set +# CONFIG_IP_NF_MATCH_SCTP is not set CONFIG_IP_NF_FILTER=y CONFIG_IP_NF_TARGET_REJECT=y +CONFIG_IP_NF_TARGET_LOG=y +CONFIG_IP_NF_TARGET_ULOG=y +CONFIG_IP_NF_TARGET_TCPMSS=y CONFIG_IP_NF_NAT=y CONFIG_IP_NF_NAT_NEEDED=y CONFIG_IP_NF_TARGET_MASQUERADE=y @@ -424,9 +447,7 @@ CONFIG_IP_NF_TARGET_DSCP=y CONFIG_IP_NF_TARGET_MARK=y CONFIG_IP_NF_TARGET_CLASSIFY=y -CONFIG_IP_NF_TARGET_LOG=y -CONFIG_IP_NF_TARGET_ULOG=y -CONFIG_IP_NF_TARGET_TCPMSS=y +# CONFIG_IP_NF_RAW is not set CONFIG_IP_NF_ARPTABLES=y CONFIG_IP_NF_ARPFILTER=y CONFIG_IP_NF_ARP_MANGLE=y @@ -438,7 +459,9 @@ # # 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 @@ -454,30 +477,33 @@ # QoS and/or fair queueing # # CONFIG_NET_SCHED is not set +# CONFIG_NET_CLS_ROUTE 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=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) # CONFIG_NET_ETHERNET=y CONFIG_MII=y -# CONFIG_MACE is not set -# CONFIG_BMAC is not set -# CONFIG_OAKNET is not set # CONFIG_HAPPYMEAL is not set CONFIG_SUNGEM=y # CONFIG_NET_VENDOR_3COM is not set @@ -509,57 +535,38 @@ # # CONFIG_IXGB is not set # CONFIG_S2IO is not set -# CONFIG_FDDI is not set -# CONFIG_HIPPI is not set -# CONFIG_IBMVETH 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 # # Token Ring devices # CONFIG_TR=y CONFIG_IBMOL=y -# 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 is not set - -# -# 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 is not set -# CONFIG_NET_POLL_CONTROLLER is not set +# CONFIG_WAN 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 +# CONFIG_NET_FC is not set +# CONFIG_SHAPER is not set +# CONFIG_NETCONSOLE is not set # # ISDN subsystem @@ -598,6 +605,7 @@ # CONFIG_SERIO_SERPORT is not set # CONFIG_SERIO_CT82C710 is not set # CONFIG_SERIO_PCIPS2 is not set +# CONFIG_SERIO_RAW is not set # # Input Device Drivers @@ -636,8 +644,6 @@ CONFIG_UNIX98_PTYS=y CONFIG_LEGACY_PTYS=y CONFIG_LEGACY_PTY_COUNT=256 -CONFIG_HVC_CONSOLE=y -# CONFIG_QIC02_TAPE is not set # # IPMI @@ -673,6 +679,7 @@ # CONFIG_I2C_ALGOBIT=y # CONFIG_I2C_ALGOPCF is not set +# CONFIG_I2C_ALGOPCA is not set # # I2C Hardware Bus support @@ -697,23 +704,29 @@ # CONFIG_I2C_VIA is not set # CONFIG_I2C_VIAPRO is not set # CONFIG_I2C_VOODOO3 is not set +# CONFIG_I2C_PCA_ISA is not set # # Hardware Sensors Chip support # # CONFIG_I2C_SENSOR is not set # CONFIG_SENSORS_ADM1021 is not set +# CONFIG_SENSORS_ADM1025 is not set +# CONFIG_SENSORS_ADM1031 is not set # CONFIG_SENSORS_ASB100 is not set # CONFIG_SENSORS_DS1621 is not set # CONFIG_SENSORS_FSCHER is not set # CONFIG_SENSORS_GL518SM is not set # CONFIG_SENSORS_IT87 is not set # CONFIG_SENSORS_LM75 is not set +# CONFIG_SENSORS_LM77 is not set # CONFIG_SENSORS_LM78 is not set # CONFIG_SENSORS_LM80 is not set # CONFIG_SENSORS_LM83 is not set # CONFIG_SENSORS_LM85 is not set # CONFIG_SENSORS_LM90 is not set +# CONFIG_SENSORS_MAX1619 is not set +# CONFIG_SENSORS_SMSC47M1 is not set # CONFIG_SENSORS_VIA686A is not set # CONFIG_SENSORS_W83781D is not set # CONFIG_SENSORS_W83L785TS is not set @@ -725,12 +738,18 @@ # CONFIG_SENSORS_EEPROM is not set # CONFIG_SENSORS_PCF8574 is not set # CONFIG_SENSORS_PCF8591 is not set +# CONFIG_SENSORS_RTC8564 is not set # CONFIG_I2C_DEBUG_CORE is not set # CONFIG_I2C_DEBUG_ALGO is not set # CONFIG_I2C_DEBUG_BUS is not set # CONFIG_I2C_DEBUG_CHIP is not set # +# Dallas's 1-wire bus +# +# CONFIG_W1 is not set + +# # Misc devices # @@ -748,6 +767,8 @@ # Graphics support # CONFIG_FB=y +CONFIG_FB_MODE_HELPERS=y +# CONFIG_FB_CIRRUS is not set # CONFIG_FB_PM2 is not set # CONFIG_FB_CYBER2000 is not set CONFIG_FB_OF=y @@ -755,10 +776,12 @@ # CONFIG_FB_PLATINUM is not set # CONFIG_FB_VALKYRIE is not set # CONFIG_FB_CT65550 is not set +# CONFIG_FB_ASILIANT is not set # CONFIG_FB_IMSTT is not set -# CONFIG_FB_S3TRIO is not set # CONFIG_FB_VGA16 is not set CONFIG_FB_RIVA=y +# CONFIG_FB_RIVA_I2C is not set +# CONFIG_FB_RIVA_DEBUG is not set # CONFIG_FB_MATROX is not set # CONFIG_FB_RADEON_OLD is not set CONFIG_FB_RADEON=y @@ -778,10 +801,8 @@ # Console display driver support # # CONFIG_VGA_CONSOLE is not set -# CONFIG_MDA_CONSOLE is not set CONFIG_DUMMY_CONSOLE=y CONFIG_FRAMEBUFFER_CONSOLE=y -CONFIG_PCI_CONSOLE=y # CONFIG_FONTS is not set CONFIG_FONT_8x8=y CONFIG_FONT_8x16=y @@ -811,6 +832,7 @@ CONFIG_USB_DEVICEFS=y # CONFIG_USB_BANDWIDTH is not set # CONFIG_USB_DYNAMIC_MINORS is not set +# CONFIG_USB_OTG is not set # # USB Host Controller Drivers @@ -829,6 +851,7 @@ CONFIG_USB_PRINTER=y CONFIG_USB_STORAGE=y # CONFIG_USB_STORAGE_DEBUG is not set +# CONFIG_USB_STORAGE_RW_DETECT is not set CONFIG_USB_STORAGE_DATAFAB=y CONFIG_USB_STORAGE_FREECOM=y CONFIG_USB_STORAGE_ISD200=y @@ -853,6 +876,7 @@ # CONFIG_USB_KBTAB is not set # CONFIG_USB_POWERMATE is not set # CONFIG_USB_MTOUCH is not set +# CONFIG_USB_EGALAX is not set # CONFIG_USB_XPAD is not set # CONFIG_USB_ATI_REMOTE is not set @@ -959,6 +983,7 @@ # CONFIG_USB_LCD is not set # CONFIG_USB_LED is not set # CONFIG_USB_CYTHERM is not set +# CONFIG_USB_PHIDGETSERVO is not set # CONFIG_USB_TEST is not set # @@ -997,6 +1022,7 @@ # CONFIG_JOLIET is not set # CONFIG_ZISOFS is not set CONFIG_UDF_FS=m +CONFIG_UDF_NLS=y # # DOS/FAT/NT Filesystems @@ -1004,6 +1030,8 @@ CONFIG_FAT_FS=y CONFIG_MSDOS_FS=y CONFIG_VFAT_FS=y +CONFIG_FAT_DEFAULT_CODEPAGE=437 +CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" # CONFIG_NTFS_FS is not set # @@ -1054,11 +1082,14 @@ CONFIG_SUNRPC=y CONFIG_SUNRPC_GSS=y CONFIG_RPCSEC_GSS_KRB5=y +# CONFIG_RPCSEC_GSS_SPKM3 is not set # CONFIG_SMB_FS is not set CONFIG_CIFS=m +# CONFIG_CIFS_STATS is not set +# CONFIG_CIFS_XATTR is not set +# CONFIG_CIFS_POSIX is not set # CONFIG_NCP_FS is not set # CONFIG_CODA_FS is not set -# CONFIG_INTERMEZZO_FS is not set # CONFIG_AFS_FS is not set # @@ -1076,7 +1107,6 @@ # 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 @@ -1110,6 +1140,7 @@ # CONFIG_NLS_ISO8859_8 is not set # CONFIG_NLS_CODEPAGE_1250 is not set # CONFIG_NLS_CODEPAGE_1251 is not set +# CONFIG_NLS_ASCII is not set # CONFIG_NLS_ISO8859_1 is not set # CONFIG_NLS_ISO8859_2 is not set # CONFIG_NLS_ISO8859_3 is not set @@ -1135,13 +1166,16 @@ # Kernel hacking # CONFIG_DEBUG_KERNEL=y +CONFIG_MAGIC_SYSRQ=y +# CONFIG_DEBUG_SLAB is not set +# CONFIG_DEBUG_SPINLOCK_SLEEP is not set +# CONFIG_DEBUG_INFO is not set # CONFIG_DEBUG_STACKOVERFLOW is not set # CONFIG_DEBUG_STACK_USAGE is not set -# CONFIG_DEBUG_SLAB is not set -CONFIG_MAGIC_SYSRQ=y # CONFIG_DEBUGGER is not set # CONFIG_PPCDBG is not set -# CONFIG_DEBUG_INFO is not set +# CONFIG_IRQSTACKS is not set +# CONFIG_SCHEDSTATS is not set # # Security options @@ -1159,6 +1193,7 @@ CONFIG_CRYPTO_SHA1=m CONFIG_CRYPTO_SHA256=m CONFIG_CRYPTO_SHA512=m +# CONFIG_CRYPTO_WHIRLPOOL is not set CONFIG_CRYPTO_DES=y CONFIG_CRYPTO_BLOWFISH=m CONFIG_CRYPTO_TWOFISH=m @@ -1166,14 +1201,19 @@ CONFIG_CRYPTO_AES=m CONFIG_CRYPTO_CAST5=m CONFIG_CRYPTO_CAST6=m +# CONFIG_CRYPTO_TEA is not set CONFIG_CRYPTO_ARC4=m +# CONFIG_CRYPTO_KHAZAD is not set CONFIG_CRYPTO_DEFLATE=m CONFIG_CRYPTO_MICHAEL_MIC=m +# CONFIG_CRYPTO_CRC32C is not set CONFIG_CRYPTO_TEST=m # # Library routines # +CONFIG_CRC_CCITT=m CONFIG_CRC32=y +# CONFIG_LIBCRC32C is not set CONFIG_ZLIB_INFLATE=m CONFIG_ZLIB_DEFLATE=m diff -Nru a/arch/ppc64/configs/pSeries_defconfig b/arch/ppc64/configs/pSeries_defconfig --- a/arch/ppc64/configs/pSeries_defconfig 2004-09-26 10:25:57 -07:00 +++ b/arch/ppc64/configs/pSeries_defconfig 2004-09-26 10:25:57 -07:00 @@ -1,5 +1,7 @@ # # Automatically generated make config: don't edit +# Linux kernel version: 2.6.9-rc2 +# Thu Sep 23 16:45:05 2004 # CONFIG_64BIT=y CONFIG_MMU=y @@ -20,6 +22,7 @@ # # General setup # +CONFIG_LOCALVERSION="" CONFIG_SWAP=y CONFIG_SYSVIPC=y CONFIG_POSIX_MQUEUE=y @@ -61,12 +64,13 @@ # Platform support # # CONFIG_PPC_ISERIES is not set +CONFIG_PPC_MULTIPLATFORM=y CONFIG_PPC_PSERIES=y +# CONFIG_PPC_PMAC is not set CONFIG_PPC=y CONFIG_PPC64=y CONFIG_PPC_OF=y CONFIG_ALTIVEC=y -# CONFIG_PPC_PMAC is not set CONFIG_PPC_SPLPAR=y # CONFIG_BOOTX_TEXT is not set # CONFIG_POWER4_ONLY is not set @@ -189,7 +193,6 @@ # CONFIG_BLK_DEV_IDEDMA_FORCED is not set CONFIG_IDEDMA_PCI_AUTO=y # CONFIG_IDEDMA_ONLYDISK is not set -CONFIG_BLK_DEV_ADMA=y # CONFIG_BLK_DEV_AEC62XX is not set # CONFIG_BLK_DEV_ALI15X3 is not set CONFIG_BLK_DEV_AMD74XX=y @@ -365,6 +368,8 @@ # IP: Netfilter Configuration # CONFIG_IP_NF_CONNTRACK=m +# CONFIG_IP_NF_CT_ACCT is not set +CONFIG_IP_NF_CT_PROTO_SCTP=m CONFIG_IP_NF_FTP=m CONFIG_IP_NF_IRC=m CONFIG_IP_NF_TFTP=m @@ -389,8 +394,14 @@ CONFIG_IP_NF_MATCH_STATE=m CONFIG_IP_NF_MATCH_CONNTRACK=m CONFIG_IP_NF_MATCH_OWNER=m +CONFIG_IP_NF_MATCH_ADDRTYPE=m +CONFIG_IP_NF_MATCH_REALM=m +CONFIG_IP_NF_MATCH_SCTP=m CONFIG_IP_NF_FILTER=m CONFIG_IP_NF_TARGET_REJECT=m +CONFIG_IP_NF_TARGET_LOG=m +CONFIG_IP_NF_TARGET_ULOG=m +CONFIG_IP_NF_TARGET_TCPMSS=m CONFIG_IP_NF_NAT=m CONFIG_IP_NF_NAT_NEEDED=y CONFIG_IP_NF_TARGET_MASQUERADE=m @@ -409,21 +420,13 @@ CONFIG_IP_NF_TARGET_DSCP=m CONFIG_IP_NF_TARGET_MARK=m CONFIG_IP_NF_TARGET_CLASSIFY=m -CONFIG_IP_NF_TARGET_LOG=m -CONFIG_IP_NF_TARGET_ULOG=m -CONFIG_IP_NF_TARGET_TCPMSS=m +CONFIG_IP_NF_RAW=m +CONFIG_IP_NF_TARGET_NOTRACK=m CONFIG_IP_NF_ARPTABLES=m CONFIG_IP_NF_ARPFILTER=m CONFIG_IP_NF_ARP_MANGLE=m CONFIG_IP_NF_COMPAT_IPCHAINS=m CONFIG_IP_NF_COMPAT_IPFWADM=m -CONFIG_IP_NF_TARGET_NOTRACK=m -CONFIG_IP_NF_RAW=m -CONFIG_IP_NF_MATCH_ADDRTYPE=m -CONFIG_IP_NF_MATCH_REALM=m -# CONFIG_IP_NF_CT_ACCT is not set -CONFIG_IP_NF_MATCH_SCTP=m -CONFIG_IP_NF_CT_PROTO_SCTP=m CONFIG_XFRM=y CONFIG_XFRM_USER=m @@ -604,6 +607,7 @@ # CONFIG_SERIO_SERPORT is not set # CONFIG_SERIO_CT82C710 is not set # CONFIG_SERIO_PCIPS2 is not set +# CONFIG_SERIO_RAW is not set # # Input Device Drivers @@ -621,6 +625,7 @@ # CONFIG_INPUT_JOYSTICK is not set # CONFIG_INPUT_TOUCHSCREEN is not set CONFIG_INPUT_MISC=y +# CONFIG_INPUT_PCSPKR is not set # CONFIG_INPUT_UINPUT is not set # diff -Nru a/arch/ppc64/kernel/Makefile b/arch/ppc64/kernel/Makefile --- a/arch/ppc64/kernel/Makefile 2004-09-26 10:25:57 -07:00 +++ b/arch/ppc64/kernel/Makefile 2004-09-26 10:25:57 -07:00 @@ -17,7 +17,7 @@ pci-obj-$(CONFIG_PPC_ISERIES) += iSeries_pci.o iSeries_pci_reset.o \ iSeries_IoMmTable.o -pci-obj-$(CONFIG_PPC_PSERIES) += pci_dn.o pci_dma_direct.o +pci-obj-$(CONFIG_PPC_MULTIPLATFORM) += pci_dn.o pci_dma_direct.o obj-$(CONFIG_PCI) += pci.o pci_iommu.o $(pci-obj-y) @@ -28,10 +28,11 @@ mf.o HvLpEvent.o iSeries_proc.o iSeries_htab.o \ iSeries_iommu.o +obj-$(CONFIG_PPC_MULTIPLATFORM) += nvram.o open_pic.o i8259.o prom_init.o prom.o + obj-$(CONFIG_PPC_PSERIES) += pSeries_pci.o pSeries_lpar.o pSeries_hvCall.o \ - eeh.o nvram.o pSeries_nvram.o rtasd.o ras.o \ - open_pic.o xics.o pSeries_htab.o rtas.o \ - chrp_setup.o i8259.o prom.o pSeries_iommu.o + eeh.o pSeries_nvram.o rtasd.o ras.o \ + xics.o rtas.o pSeries_setup.o pSeries_iommu.o obj-$(CONFIG_PROC_FS) += proc_ppc64.o obj-$(CONFIG_RTAS_FLASH) += rtas_flash.o diff -Nru a/arch/ppc64/kernel/asm-offsets.c b/arch/ppc64/kernel/asm-offsets.c --- a/arch/ppc64/kernel/asm-offsets.c 2004-09-26 10:25:56 -07:00 +++ b/arch/ppc64/kernel/asm-offsets.c 2004-09-26 10:25:56 -07:00 @@ -33,7 +33,6 @@ #include #include #include -#include #include #include @@ -108,7 +107,6 @@ DEFINE(LPPACASRR1, offsetof(struct ItLpPaca, xSavedSrr1)); DEFINE(LPPACAANYINT, offsetof(struct ItLpPaca, xIntDword.xAnyInt)); DEFINE(LPPACADECRINT, offsetof(struct ItLpPaca, xIntDword.xFields.xDecrInt)); - DEFINE(PROMENTRY, offsetof(struct prom_t, entry)); /* RTAS */ DEFINE(RTASBASE, offsetof(struct rtas_t, base)); diff -Nru a/arch/ppc64/kernel/btext.c b/arch/ppc64/kernel/btext.c --- a/arch/ppc64/kernel/btext.c 2004-09-26 10:25:57 -07:00 +++ b/arch/ppc64/kernel/btext.c 2004-09-26 10:25:57 -07:00 @@ -10,7 +10,7 @@ #include #include -#include +#include #include #include #include @@ -36,6 +36,11 @@ static int g_max_loc_X; static int g_max_loc_Y; +static int dispDeviceRowBytes; +static int dispDeviceDepth; +static int dispDeviceRect[4]; +static unsigned char *dispDeviceBase, *logicalDisplayBase; + unsigned long disp_BAT[2] __initdata = {0, 0}; #define cmapsz (16*256) @@ -45,30 +50,6 @@ int boot_text_mapped; int force_printk_to_btext = 0; -boot_infos_t disp_bi; - -/* This function will enable the early boot text when doing OF booting. This - * way, xmon output should work too - */ -void __init btext_setup_display(int width, int height, int depth, int pitch, - unsigned long address) -{ - unsigned long offset = reloc_offset(); - boot_infos_t* bi = PTRRELOC(&disp_bi); - - RELOC(g_loc_X) = 0; - RELOC(g_loc_Y) = 0; - RELOC(g_max_loc_X) = width / 8; - RELOC(g_max_loc_Y) = height / 16; - bi->logicalDisplayBase = (unsigned char *)address; - bi->dispDeviceBase = (unsigned char *)address; - bi->dispDeviceRowBytes = pitch; - bi->dispDeviceDepth = depth; - bi->dispDeviceRect[0] = bi->dispDeviceRect[1] = 0; - bi->dispDeviceRect[2] = width; - bi->dispDeviceRect[3] = height; - RELOC(boot_text_mapped) = 1; -} /* Here's a small text engine to use during early boot * or for debugging purposes @@ -84,34 +65,84 @@ void map_boot_text(void) { unsigned long base, offset, size; - boot_infos_t *bi = &disp_bi; unsigned char *vbase; /* By default, we are no longer mapped */ boot_text_mapped = 0; - if (bi->dispDeviceBase == 0) + if (dispDeviceBase == 0) return; - base = ((unsigned long) bi->dispDeviceBase) & 0xFFFFF000UL; - offset = ((unsigned long) bi->dispDeviceBase) - base; - size = bi->dispDeviceRowBytes * bi->dispDeviceRect[3] + offset - + bi->dispDeviceRect[0]; + base = ((unsigned long) dispDeviceBase) & 0xFFFFF000UL; + offset = ((unsigned long) dispDeviceBase) - base; + size = dispDeviceRowBytes * dispDeviceRect[3] + offset + + dispDeviceRect[0]; vbase = __ioremap(base, size, _PAGE_NO_CACHE); if (vbase == 0) return; - bi->logicalDisplayBase = vbase + offset; + logicalDisplayBase = vbase + offset; boot_text_mapped = 1; } +int btext_initialize(struct device_node *np) +{ + unsigned int width, height, depth, pitch; + unsigned long address = 0; + u32 *prop; + + prop = (u32 *)get_property(np, "width", NULL); + if (prop == NULL) + return -EINVAL; + width = *prop; + prop = (u32 *)get_property(np, "height", NULL); + if (prop == NULL) + return -EINVAL; + height = *prop; + prop = (u32 *)get_property(np, "depth", NULL); + if (prop == NULL) + return -EINVAL; + depth = *prop; + pitch = width * ((depth + 7) / 8); + prop = (u32 *)get_property(np, "linebytes", NULL); + if (prop) + pitch = *prop; + if (pitch == 1) + pitch = 0x1000; + prop = (u32 *)get_property(np, "address", NULL); + if (prop) + address = *prop; + + /* FIXME: Add support for PCI reg properties */ + + if (address == 0) + return -EINVAL; + + g_loc_X = 0; + g_loc_Y = 0; + g_max_loc_X = width / 8; + g_max_loc_Y = height / 16; + logicalDisplayBase = (unsigned char *)address; + dispDeviceBase = (unsigned char *)address; + dispDeviceRowBytes = pitch; + dispDeviceDepth = depth; + dispDeviceRect[0] = dispDeviceRect[1] = 0; + dispDeviceRect[2] = width; + dispDeviceRect[3] = height; + + map_boot_text(); + + return 0; +} + + /* Calc the base address of a given point (x,y) */ -static unsigned char * calc_base(boot_infos_t *bi, int x, int y) +static unsigned char * calc_base(int x, int y) { unsigned char *base; - base = bi->logicalDisplayBase; + base = logicalDisplayBase; if (base == 0) - base = bi->dispDeviceBase; - base += (x + bi->dispDeviceRect[0]) * (bi->dispDeviceDepth >> 3); - base += (y + bi->dispDeviceRect[1]) * bi->dispDeviceRowBytes; + base = dispDeviceBase; + base += (x + dispDeviceRect[0]) * (dispDeviceDepth >> 3); + base += (y + dispDeviceRect[1]) * dispDeviceRowBytes; return base; } @@ -119,24 +150,22 @@ void btext_update_display(unsigned long phys, int width, int height, int depth, int pitch) { - boot_infos_t *bi = &disp_bi; - - if (bi->dispDeviceBase == 0) + if (dispDeviceBase == 0) return; /* check it's the same frame buffer (within 256MB) */ - if ((phys ^ (unsigned long)bi->dispDeviceBase) & 0xf0000000) + if ((phys ^ (unsigned long)dispDeviceBase) & 0xf0000000) return; - bi->dispDeviceBase = (__u8 *) phys; - bi->dispDeviceRect[0] = 0; - bi->dispDeviceRect[1] = 0; - bi->dispDeviceRect[2] = width; - bi->dispDeviceRect[3] = height; - bi->dispDeviceDepth = depth; - bi->dispDeviceRowBytes = pitch; + dispDeviceBase = (__u8 *) phys; + dispDeviceRect[0] = 0; + dispDeviceRect[1] = 0; + dispDeviceRect[2] = width; + dispDeviceRect[3] = height; + dispDeviceDepth = depth; + dispDeviceRowBytes = pitch; if (boot_text_mapped) { - iounmap(bi->logicalDisplayBase); + iounmap(logicalDisplayBase); boot_text_mapped = 0; } map_boot_text(); @@ -148,108 +177,101 @@ void btext_clearscreen(void) { - unsigned long offset = reloc_offset(); - boot_infos_t* bi = PTRRELOC(&disp_bi); - unsigned long *base = (unsigned long *)calc_base(bi, 0, 0); - unsigned long width = ((bi->dispDeviceRect[2] - bi->dispDeviceRect[0]) * - (bi->dispDeviceDepth >> 3)) >> 3; + unsigned long *base = (unsigned long *)calc_base(0, 0); + unsigned long width = ((dispDeviceRect[2] - dispDeviceRect[0]) * + (dispDeviceDepth >> 3)) >> 3; int i,j; - for (i=0; i<(bi->dispDeviceRect[3] - bi->dispDeviceRect[1]); i++) + for (i=0; i<(dispDeviceRect[3] - dispDeviceRect[1]); i++) { unsigned long *ptr = base; for(j=width; j; --j) *(ptr++) = 0; - base += (bi->dispDeviceRowBytes >> 3); + base += (dispDeviceRowBytes >> 3); } } #ifndef NO_SCROLL static void scrollscreen(void) { - unsigned long offset = reloc_offset(); - boot_infos_t* bi = PTRRELOC(&disp_bi); - unsigned long *src = (unsigned long *)calc_base(bi,0,16); - unsigned long *dst = (unsigned long *)calc_base(bi,0,0); - unsigned long width = ((bi->dispDeviceRect[2] - bi->dispDeviceRect[0]) * - (bi->dispDeviceDepth >> 3)) >> 3; + unsigned long *src = (unsigned long *)calc_base(0,16); + unsigned long *dst = (unsigned long *)calc_base(0,0); + unsigned long width = ((dispDeviceRect[2] - dispDeviceRect[0]) * + (dispDeviceDepth >> 3)) >> 3; int i,j; - for (i=0; i<(bi->dispDeviceRect[3] - bi->dispDeviceRect[1] - 16); i++) + for (i=0; i<(dispDeviceRect[3] - dispDeviceRect[1] - 16); i++) { unsigned long *src_ptr = src; unsigned long *dst_ptr = dst; for(j=width; j; --j) *(dst_ptr++) = *(src_ptr++); - src += (bi->dispDeviceRowBytes >> 3); - dst += (bi->dispDeviceRowBytes >> 3); + src += (dispDeviceRowBytes >> 3); + dst += (dispDeviceRowBytes >> 3); } for (i=0; i<16; i++) { unsigned long *dst_ptr = dst; for(j=width; j; --j) *(dst_ptr++) = 0; - dst += (bi->dispDeviceRowBytes >> 3); + dst += (dispDeviceRowBytes >> 3); } } #endif /* ndef NO_SCROLL */ void btext_drawchar(char c) { - unsigned long offset = reloc_offset(); int cline = 0; #ifdef NO_SCROLL int x; #endif - if (!RELOC(boot_text_mapped)) + if (!boot_text_mapped) return; switch (c) { case '\b': - if (RELOC(g_loc_X) > 0) - --RELOC(g_loc_X); + if (g_loc_X > 0) + --g_loc_X; break; case '\t': - RELOC(g_loc_X) = (RELOC(g_loc_X) & -8) + 8; + g_loc_X = (g_loc_X & -8) + 8; break; case '\r': - RELOC(g_loc_X) = 0; + g_loc_X = 0; break; case '\n': - RELOC(g_loc_X) = 0; - RELOC(g_loc_Y)++; + g_loc_X = 0; + g_loc_Y++; cline = 1; break; default: - draw_byte(c, RELOC(g_loc_X)++, RELOC(g_loc_Y)); + draw_byte(c, g_loc_X++, g_loc_Y); } - if (RELOC(g_loc_X) >= RELOC(g_max_loc_X)) { - RELOC(g_loc_X) = 0; - RELOC(g_loc_Y)++; + if (g_loc_X >= g_max_loc_X) { + g_loc_X = 0; + g_loc_Y++; cline = 1; } #ifndef NO_SCROLL - while (RELOC(g_loc_Y) >= RELOC(g_max_loc_Y)) { + while (g_loc_Y >= g_max_loc_Y) { scrollscreen(); - RELOC(g_loc_Y)--; + g_loc_Y--; } #else /* wrap around from bottom to top of screen so we don't waste time scrolling each line. -- paulus. */ - if (RELOC(g_loc_Y) >= RELOC(g_max_loc_Y)) - RELOC(g_loc_Y) = 0; + if (g_loc_Y >= g_max_loc_Y) + g_loc_Y = 0; if (cline) { - for (x = 0; x < RELOC(g_max_loc_X); ++x) - draw_byte(' ', x, RELOC(g_loc_Y)); + for (x = 0; x < g_max_loc_X; ++x) + draw_byte(' ', x, g_loc_Y); } #endif } void btext_drawstring(const char *c) { - unsigned long offset = reloc_offset(); - - if (!RELOC(boot_text_mapped)) + if (!boot_text_mapped) return; while (*c) btext_drawchar(*c++); @@ -257,10 +279,9 @@ void btext_drawhex(unsigned long v) { - unsigned long offset = reloc_offset(); - char *hex_table = RELOC("0123456789abcdef"); + char *hex_table = "0123456789abcdef"; - if (!RELOC(boot_text_mapped)) + if (!boot_text_mapped) return; btext_drawchar(hex_table[(v >> 60) & 0x0000000FUL]); btext_drawchar(hex_table[(v >> 56) & 0x0000000FUL]); @@ -283,14 +304,11 @@ static void draw_byte(unsigned char c, long locX, long locY) { - unsigned long offset = reloc_offset(); - boot_infos_t* bi = PTRRELOC(&disp_bi); - unsigned char *base = calc_base(bi, locX << 3, locY << 4); - unsigned char *font = PTRRELOC(&vga_font[((unsigned int)c) * 16]); - int rb = bi->dispDeviceRowBytes; + unsigned char *base = calc_base(locX << 3, locY << 4); + unsigned char *font = &vga_font[((unsigned int)c) * 16]; + int rb = dispDeviceRowBytes; -#if 0 - switch(bi->dispDeviceDepth) { + switch(dispDeviceDepth) { case 24: case 32: draw_byte_32(font, (unsigned int *)base, rb); @@ -303,17 +321,6 @@ draw_byte_8(font, (unsigned int *)base, rb); break; } -#else - if(bi->dispDeviceDepth == 24 || - bi->dispDeviceDepth == 32) { - draw_byte_32(font, (unsigned int *)base, rb); - } else if(bi->dispDeviceDepth == 15 || - bi->dispDeviceDepth == 16) { - draw_byte_16(font, (unsigned int *)base, rb); - } else if(bi->dispDeviceDepth == 8) { - draw_byte_8(font, (unsigned int *)base, rb); - } -#endif } static unsigned int expand_bits_8[16] = { @@ -369,8 +376,7 @@ int l, bits; int fg = 0xFFFFFFFFUL; int bg = 0x00000000UL; - unsigned long offset = reloc_offset(); - unsigned int *eb = PTRRELOC((int *)expand_bits_16); + unsigned int *eb = (int *)expand_bits_16; for (l = 0; l < 16; ++l) { @@ -388,8 +394,7 @@ int l, bits; int fg = 0x0F0F0F0FUL; int bg = 0x00000000UL; - unsigned long offset = reloc_offset(); - unsigned int *eb = PTRRELOC((int *)expand_bits_8); + unsigned int *eb = (int *)expand_bits_8; for (l = 0; l < 16; ++l) { diff -Nru a/arch/ppc64/kernel/chrp_setup.c b/arch/ppc64/kernel/chrp_setup.c --- a/arch/ppc64/kernel/chrp_setup.c 2004-09-26 10:25:55 -07:00 +++ /dev/null Wed Dec 31 16:00:00 196900 @@ -1,468 +0,0 @@ -/* - * linux/arch/ppc/kernel/setup.c - * - * Copyright (C) 1995 Linus Torvalds - * Adapted from 'alpha' version by Gary Thomas - * Modified by Cort Dougan (cort@cs.nmt.edu) - * Modified by PPC64 Team, IBM Corp - * - * 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. - */ - -/* - * bootup setup stuff.. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "i8259.h" -#include "open_pic.h" -#include -#include -#include - -void chrp_progress(char *, unsigned short); - -extern void pSeries_init_openpic(void); - -extern void find_and_init_phbs(void); -extern void pSeries_final_fixup(void); - -extern void pSeries_get_boot_time(struct rtc_time *rtc_time); -extern void pSeries_get_rtc_time(struct rtc_time *rtc_time); -extern int pSeries_set_rtc_time(struct rtc_time *rtc_time); -void pSeries_calibrate_decr(void); -void fwnmi_init(void); -extern void SystemReset_FWNMI(void), MachineCheck_FWNMI(void); /* from head.S */ -int fwnmi_active; /* TRUE if an FWNMI handler is present */ - -dev_t boot_dev; -unsigned long virtPython0Facilities = 0; // python0 facility area (memory mapped io) (64-bit format) VIRTUAL address. - -extern unsigned long loops_per_jiffy; - -extern unsigned long ppc_proc_freq; -extern unsigned long ppc_tb_freq; - -void chrp_get_cpuinfo(struct seq_file *m) -{ - struct device_node *root; - const char *model = ""; - - root = of_find_node_by_path("/"); - if (root) - model = get_property(root, "model", NULL); - seq_printf(m, "machine\t\t: CHRP %s\n", model); - of_node_put(root); -} - -#define I8042_DATA_REG 0x60 - -void __init chrp_request_regions(void) -{ - struct device_node *i8042; - - request_region(0x20,0x20,"pic1"); - request_region(0xa0,0x20,"pic2"); - request_region(0x00,0x20,"dma1"); - request_region(0x40,0x20,"timer"); - request_region(0x80,0x10,"dma page reg"); - request_region(0xc0,0x20,"dma2"); - - /* - * Some machines have an unterminated i8042 so check the device - * tree and reserve the region if it does not appear. Later on - * the i8042 code will try and reserve this region and fail. - */ - if (!(i8042 = of_find_node_by_type(NULL, "8042"))) - request_region(I8042_DATA_REG, 16, "reserved (no i8042)"); - of_node_put(i8042); -} - -void __init -chrp_setup_arch(void) -{ - struct device_node *root; - unsigned int *opprop; - - /* openpic global configuration register (64-bit format). */ - /* openpic Interrupt Source Unit pointer (64-bit format). */ - /* python0 facility area (mmio) (64-bit format) REAL address. */ - - /* init to some ~sane value until calibrate_delay() runs */ - loops_per_jiffy = 50000000; - - if (ROOT_DEV == 0) { - printk("No ramdisk, default root is /dev/sda2\n"); - ROOT_DEV = Root_SDA2; - } - - printk("Boot arguments: %s\n", cmd_line); - - fwnmi_init(); - -#ifndef CONFIG_PPC_ISERIES - /* Find and initialize PCI host bridges */ - /* iSeries needs to be done much later. */ - eeh_init(); - find_and_init_phbs(); -#endif - - /* Find the Open PIC if present */ - root = of_find_node_by_path("/"); - opprop = (unsigned int *) get_property(root, - "platform-open-pic", NULL); - if (opprop != 0) { - int n = prom_n_addr_cells(root); - unsigned long openpic; - - for (openpic = 0; n > 0; --n) - openpic = (openpic << 32) + *opprop++; - printk(KERN_DEBUG "OpenPIC addr: %lx\n", openpic); - OpenPIC_Addr = __ioremap(openpic, 0x40000, _PAGE_NO_CACHE); - } - of_node_put(root); - -#ifdef CONFIG_DUMMY_CONSOLE - conswitchp = &dummy_con; -#endif - -#ifdef CONFIG_PPC_PSERIES - pSeries_nvram_init(); -#endif -} - -void __init -chrp_init2(void) -{ - /* Manually leave the kernel version on the panel. */ - ppc_md.progress("Linux ppc64\n", 0); - ppc_md.progress(UTS_RELEASE, 0); -} - -/* Initialize firmware assisted non-maskable interrupts if - * the firmware supports this feature. - * - */ -void __init fwnmi_init(void) -{ - int ret; - int ibm_nmi_register = rtas_token("ibm,nmi-register"); - if (ibm_nmi_register == RTAS_UNKNOWN_SERVICE) - return; - ret = rtas_call(ibm_nmi_register, 2, 1, NULL, - __pa((unsigned long)SystemReset_FWNMI), - __pa((unsigned long)MachineCheck_FWNMI)); - if (ret == 0) - fwnmi_active = 1; -} - -/* Early initialization. Relocation is on but do not reference unbolted pages */ -void __init pSeries_init_early(void) -{ - void *comport; - - hpte_init_pSeries(); - - if (ppc64_iommu_off) - pci_dma_init_direct(); - else - tce_init_pSeries(); - -#ifdef CONFIG_SMP - smp_init_pSeries(); -#endif - - /* Map the uart for udbg. */ - comport = (void *)__ioremap(naca->serialPortAddr, 16, _PAGE_NO_CACHE); - udbg_init_uart(comport); - - ppc_md.udbg_putc = udbg_putc; - ppc_md.udbg_getc = udbg_getc; - ppc_md.udbg_getc_poll = udbg_getc_poll; -} - -void __init -chrp_init(unsigned long r3, unsigned long r4, unsigned long r5, - unsigned long r6, unsigned long r7) -{ - ppc_md.setup_arch = chrp_setup_arch; - ppc_md.get_cpuinfo = chrp_get_cpuinfo; - if (naca->interrupt_controller == IC_OPEN_PIC) { - ppc_md.init_IRQ = pSeries_init_openpic; - ppc_md.get_irq = openpic_get_irq; - } else { - ppc_md.init_IRQ = xics_init_IRQ; - ppc_md.get_irq = xics_get_irq; - } - - ppc_md.log_error = pSeries_log_error; - - ppc_md.init = chrp_init2; - - ppc_md.pcibios_fixup = pSeries_final_fixup; - - ppc_md.restart = rtas_restart; - ppc_md.power_off = rtas_power_off; - ppc_md.halt = rtas_halt; - ppc_md.panic = rtas_os_term; - - ppc_md.get_boot_time = pSeries_get_boot_time; - ppc_md.get_rtc_time = pSeries_get_rtc_time; - ppc_md.set_rtc_time = pSeries_set_rtc_time; - ppc_md.calibrate_decr = pSeries_calibrate_decr; - - ppc_md.progress = chrp_progress; - -} - -/* Build up the firmware_features bitmask field - * using contents of device-tree/ibm,hypertas-functions. - * Ultimately this functionality may be moved into prom.c prom_init(). - */ -void __init fw_feature_init(void) -{ - struct device_node * dn; - char * hypertas; - unsigned int len; - - cur_cpu_spec->firmware_features = 0; - dn = of_find_node_by_path("/rtas"); - if (dn == NULL) { - printk(KERN_ERR "WARNING ! Cannot find RTAS in device-tree !\n"); - goto no_rtas; - } - - hypertas = get_property(dn, "ibm,hypertas-functions", &len); - if (hypertas) { - while (len > 0){ - int i, hypertas_len; - /* check value against table of strings */ - for(i=0; i < FIRMWARE_MAX_FEATURES ;i++) { - if ((firmware_features_table[i].name) && - (strcmp(firmware_features_table[i].name,hypertas))==0) { - /* we have a match */ - cur_cpu_spec->firmware_features |= - (firmware_features_table[i].val); - break; - } - } - hypertas_len = strlen(hypertas); - len -= hypertas_len +1; - hypertas+= hypertas_len +1; - } - } - - of_node_put(dn); - no_rtas: - printk(KERN_INFO "firmware_features = 0x%lx\n", - cur_cpu_spec->firmware_features); -} - -void chrp_progress(char *s, unsigned short hex) -{ - struct device_node *root; - int width, *p; - char *os; - static int display_character, set_indicator; - static int max_width; - static spinlock_t progress_lock = SPIN_LOCK_UNLOCKED; - static int pending_newline = 0; /* did last write end with unprinted newline? */ - - if (!rtas.base) - return; - - if (max_width == 0) { - if ((root = find_path_device("/rtas")) && - (p = (unsigned int *)get_property(root, - "ibm,display-line-length", - NULL))) - max_width = *p; - else - max_width = 0x10; - display_character = rtas_token("display-character"); - set_indicator = rtas_token("set-indicator"); - } - - if (display_character == RTAS_UNKNOWN_SERVICE) { - /* use hex display if available */ - if (set_indicator != RTAS_UNKNOWN_SERVICE) - rtas_call(set_indicator, 3, 1, NULL, 6, 0, hex); - return; - } - - spin_lock(&progress_lock); - - /* - * Last write ended with newline, but we didn't print it since - * it would just clear the bottom line of output. Print it now - * instead. - * - * If no newline is pending, print a CR to start output at the - * beginning of the line. - */ - if (pending_newline) { - rtas_call(display_character, 1, 1, NULL, '\r'); - rtas_call(display_character, 1, 1, NULL, '\n'); - pending_newline = 0; - } else { - rtas_call(display_character, 1, 1, NULL, '\r'); - } - - width = max_width; - os = s; - while (*os) { - if (*os == '\n' || *os == '\r') { - /* Blank to end of line. */ - while (width-- > 0) - rtas_call(display_character, 1, 1, NULL, ' '); - - /* If newline is the last character, save it - * until next call to avoid bumping up the - * display output. - */ - if (*os == '\n' && !os[1]) { - pending_newline = 1; - spin_unlock(&progress_lock); - return; - } - - /* RTAS wants CR-LF, not just LF */ - - if (*os == '\n') { - rtas_call(display_character, 1, 1, NULL, '\r'); - rtas_call(display_character, 1, 1, NULL, '\n'); - } else { - /* CR might be used to re-draw a line, so we'll - * leave it alone and not add LF. - */ - rtas_call(display_character, 1, 1, NULL, *os); - } - - width = max_width; - } else { - width--; - rtas_call(display_character, 1, 1, NULL, *os); - } - - os++; - - /* if we overwrite the screen length */ - if (width <= 0) - while ((*os != 0) && (*os != '\n') && (*os != '\r')) - os++; - } - - /* Blank to end of line. */ - while (width-- > 0) - rtas_call(display_character, 1, 1, NULL, ' '); - - spin_unlock(&progress_lock); -} - -extern void setup_default_decr(void); - -/* Some sane defaults: 125 MHz timebase, 1GHz processor */ -#define DEFAULT_TB_FREQ 125000000UL -#define DEFAULT_PROC_FREQ (DEFAULT_TB_FREQ * 8) - -void __init pSeries_calibrate_decr(void) -{ - struct device_node *cpu; - struct div_result divres; - unsigned int *fp; - int node_found; - - /* - * The cpu node should have a timebase-frequency property - * to tell us the rate at which the decrementer counts. - */ - cpu = of_find_node_by_type(NULL, "cpu"); - - ppc_tb_freq = DEFAULT_TB_FREQ; /* hardcoded default */ - node_found = 0; - if (cpu != 0) { - fp = (unsigned int *)get_property(cpu, "timebase-frequency", - NULL); - if (fp != 0) { - node_found = 1; - ppc_tb_freq = *fp; - } - } - if (!node_found) - printk(KERN_ERR "WARNING: Estimating decrementer frequency " - "(not found)\n"); - - ppc_proc_freq = DEFAULT_PROC_FREQ; - node_found = 0; - if (cpu != 0) { - fp = (unsigned int *)get_property(cpu, "clock-frequency", - NULL); - if (fp != 0) { - node_found = 1; - ppc_proc_freq = *fp; - } - } - if (!node_found) - printk(KERN_ERR "WARNING: Estimating processor frequency " - "(not found)\n"); - - of_node_put(cpu); - - printk(KERN_INFO "time_init: decrementer frequency = %lu.%.6lu MHz\n", - ppc_tb_freq/1000000, ppc_tb_freq%1000000); - printk(KERN_INFO "time_init: processor frequency = %lu.%.6lu MHz\n", - ppc_proc_freq/1000000, ppc_proc_freq%1000000); - - tb_ticks_per_jiffy = ppc_tb_freq / HZ; - tb_ticks_per_sec = tb_ticks_per_jiffy * HZ; - tb_ticks_per_usec = ppc_tb_freq / 1000000; - tb_to_us = mulhwu_scale_factor(ppc_tb_freq, 1000000); - div128_by_32(1024*1024, 0, tb_ticks_per_sec, &divres); - tb_to_xs = divres.result_low; - - setup_default_decr(); -} diff -Nru a/arch/ppc64/kernel/eeh.c b/arch/ppc64/kernel/eeh.c --- a/arch/ppc64/kernel/eeh.c 2004-09-26 10:25:56 -07:00 +++ b/arch/ppc64/kernel/eeh.c 2004-09-26 10:25:56 -07:00 @@ -48,9 +48,6 @@ static int ibm_slot_error_detail; static int eeh_subsystem_enabled; -#define EEH_MAX_OPTS 4096 -static char *eeh_opts; -static int eeh_opts_last; /* Buffer for reporting slot-error-detail rtas calls */ static unsigned char slot_errbuf[RTAS_ERROR_LOG_MAX]; @@ -62,10 +59,6 @@ static DEFINE_PER_CPU(unsigned long, false_positives); static DEFINE_PER_CPU(unsigned long, ignored_failures); -static int eeh_check_opts_config(struct device_node *dn, int class_code, - int vendor_id, int device_id, - int default_state); - /** * The pci address cache subsystem. This subsystem places * PCI device address resources into a red-black tree, sorted @@ -342,26 +335,19 @@ /** * eeh_token_to_phys - convert EEH address token to phys address - * @token i/o token, should be address in the form 0xA.... - * - * Converts EEH address tokens into physical addresses. Note that - * ths routine does *not* convert I/O BAR addresses (which start - * with 0xE...) to phys addresses! + * @token i/o token, should be address in the form 0xE.... */ static inline unsigned long eeh_token_to_phys(unsigned long token) { pte_t *ptep; - unsigned long pa, vaddr; + unsigned long pa; - if (REGION_ID(token) == EEH_REGION_ID) - vaddr = IO_TOKEN_TO_ADDR(token); - else + ptep = find_linux_pte(ioremap_mm.pgd, token); + if (!ptep) return token; - - ptep = find_linux_pte(ioremap_mm.pgd, vaddr); pa = pte_pfn(*ptep) << PAGE_SHIFT; - return pa | (vaddr & (PAGE_SIZE-1)); + return pa | (token & (PAGE_SIZE-1)); } /** @@ -480,7 +466,7 @@ struct device_node *dn; /* Finding the phys addr + pci device; this is pretty quick. */ - addr = eeh_token_to_phys((unsigned long)token); + addr = eeh_token_to_phys((unsigned long __force) token); dev = pci_get_device_by_addr(addr); if (!dev) return val; @@ -497,7 +483,6 @@ struct eeh_early_enable_info { unsigned int buid_hi; unsigned int buid_lo; - int force_off; }; /* Enable eeh for the given device node. */ @@ -539,18 +524,8 @@ if ((*class_code >> 16) == PCI_BASE_CLASS_DISPLAY) enable = 0; - if (!eeh_check_opts_config(dn, *class_code, *vendor_id, *device_id, - enable)) { - if (enable) { - printk(KERN_WARNING "EEH: %s user requested to run " - "without EEH checking.\n", dn->full_name); - enable = 0; - } - } - - if (!enable || info->force_off) { + if (!enable) dn->eeh_mode |= EEH_MODE_NOCHECK; - } /* Ok... see if this device supports EEH. Some do, some don't, * and the only way to find out is to check each and every one. */ @@ -604,15 +579,12 @@ { struct device_node *phb, *np; struct eeh_early_enable_info info; - char *eeh_force_off = strstr(saved_command_line, "eeh-force-off"); init_pci_config_tokens(); np = of_find_node_by_path("/rtas"); - if (np == NULL) { - printk(KERN_WARNING "EEH: RTAS not found !\n"); + if (np == NULL) return; - } ibm_set_eeh_option = rtas_token("ibm,set-eeh-option"); ibm_set_slot_reset = rtas_token("ibm,set-slot-reset"); @@ -632,13 +604,6 @@ eeh_error_buf_size = RTAS_ERROR_LOG_MAX; } - info.force_off = 0; - if (eeh_force_off) { - printk(KERN_WARNING "EEH: WARNING: PCI Enhanced I/O Error " - "Handling is user disabled\n"); - info.force_off = 1; - } - /* Enable EEH for all adapters. Note that eeh requires buid's */ for (phb = of_find_node_by_name(NULL, "pci"); phb; phb = of_find_node_by_name(phb, "pci")) { @@ -653,11 +618,10 @@ traverse_pci_devices(phb, early_enable_eeh, &info); } - if (eeh_subsystem_enabled) { + if (eeh_subsystem_enabled) printk(KERN_INFO "EEH: PCI Enhanced I/O Error Handling Enabled\n"); - } else { - printk(KERN_WARNING "EEH: disabled PCI Enhanced I/O Error Handling\n"); - } + else + printk(KERN_WARNING "EEH: No capable adapters found\n"); } /** @@ -734,37 +698,119 @@ EXPORT_SYMBOL(eeh_remove_device); /* - * If EEH is implemented, find the PCI device using given phys addr - * and check to see if eeh failure checking is disabled. - * Remap the addr (trivially) to the EEH region if EEH checking enabled. - * For addresses not known to PCI the vaddr is simply returned unchanged. + * Here comes the EEH implementation of the IOMAP + * interfaces. */ -void __iomem *eeh_ioremap(unsigned long addr, void __iomem *vaddr) +unsigned int fastcall ioread8(void __iomem *addr) { - struct pci_dev *dev; - struct device_node *dn; + return readb(addr); +} +unsigned int fastcall ioread16(void __iomem *addr) +{ + return readw(addr); +} +unsigned int fastcall ioread32(void __iomem *addr) +{ + return readl(addr); +} +EXPORT_SYMBOL(ioread8); +EXPORT_SYMBOL(ioread16); +EXPORT_SYMBOL(ioread32); - if (!eeh_subsystem_enabled) - return vaddr; +void fastcall iowrite8(u8 val, void __iomem *addr) +{ + writeb(val, addr); +} +void fastcall iowrite16(u16 val, void __iomem *addr) +{ + writew(val, addr); +} +void fastcall iowrite32(u32 val, void __iomem *addr) +{ + writel(val, addr); +} +EXPORT_SYMBOL(iowrite8); +EXPORT_SYMBOL(iowrite16); +EXPORT_SYMBOL(iowrite32); - dev = pci_get_device_by_addr(addr); - if (!dev) - return vaddr; +/* + * These are the "repeat read/write" functions. Note the + * non-CPU byte order. We do things in "IO byteorder" + * here. + * + * FIXME! We could make these do EEH handling if we really + * wanted. Not clear if we do. + */ +void ioread8_rep(void __iomem *addr, void *dst, unsigned long count) +{ + _insb((u8 __force *) addr, dst, count); +} +void ioread16_rep(void __iomem *addr, void *dst, unsigned long count) +{ + _insw_ns((u16 __force *) addr, dst, count); +} +void ioread32_rep(void __iomem *addr, void *dst, unsigned long count) +{ + _insl_ns((u32 __force *) addr, dst, count); +} +EXPORT_SYMBOL(ioread8_rep); +EXPORT_SYMBOL(ioread16_rep); +EXPORT_SYMBOL(ioread32_rep); - dn = pci_device_to_OF_node(dev); - if (!dn) { - pci_dev_put(dev); - return vaddr; - } +void iowrite8_rep(void __iomem *addr, const void *src, unsigned long count) +{ + _outsb((u8 __force *) addr, src, count); +} +void iowrite16_rep(void __iomem *addr, const void *src, unsigned long count) +{ + _outsw_ns((u16 __force *) addr, src, count); +} +void iowrite32_rep(void __iomem *addr, const void *src, unsigned long count) +{ + _outsl_ns((u32 __force *) addr, src, count); +} +EXPORT_SYMBOL(iowrite8_rep); +EXPORT_SYMBOL(iowrite16_rep); +EXPORT_SYMBOL(iowrite32_rep); - if (dn->eeh_mode & EEH_MODE_NOCHECK) { - pci_dev_put(dev); - return vaddr; - } +void __iomem *ioport_map(unsigned long port, unsigned int len) +{ + if (!_IO_IS_VALID(port)) + return NULL; + return (void __iomem *) (port+pci_io_base); +} - pci_dev_put(dev); - return (void __iomem *)IO_ADDR_TO_TOKEN(vaddr); +void ioport_unmap(void __iomem *addr) +{ + /* Nothing to do */ } +EXPORT_SYMBOL(ioport_map); +EXPORT_SYMBOL(ioport_unmap); + +void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max) +{ + unsigned long start = pci_resource_start(dev, bar); + unsigned long len = pci_resource_len(dev, bar); + unsigned long flags = pci_resource_flags(dev, bar); + + if (!len) + return NULL; + if (max && len > max) + len = max; + if (flags & IORESOURCE_IO) + return ioport_map(start, len); + if (flags & IORESOURCE_MEM) + return (void __iomem *) start; + /* What? */ + return NULL; +} + +void pci_iounmap(struct pci_dev *dev, void __iomem *addr) +{ + /* Nothing to do */ +} +EXPORT_SYMBOL(pci_iomap); +EXPORT_SYMBOL(pci_iounmap); static int proc_eeh_show(struct seq_file *m, void *v) { @@ -816,129 +862,3 @@ return 0; } __initcall(eeh_init_proc); - -/* - * Test if "dev" should be configured on or off. - * This processes the options literally from left to right. - * This lets the user specify stupid combinations of options, - * but at least the result should be very predictable. - */ -static int eeh_check_opts_config(struct device_node *dn, - int class_code, int vendor_id, int device_id, - int default_state) -{ - char devname[32], classname[32]; - char *strs[8], *s; - int nstrs, i; - int ret = default_state; - - /* Build list of strings to match */ - nstrs = 0; - s = (char *)get_property(dn, "ibm,loc-code", NULL); - if (s) - strs[nstrs++] = s; - sprintf(devname, "dev%04x:%04x", vendor_id, device_id); - strs[nstrs++] = devname; - sprintf(classname, "class%04x", class_code); - strs[nstrs++] = classname; - strs[nstrs++] = ""; /* yes, this matches the empty string */ - - /* - * Now see if any string matches the eeh_opts list. - * The eeh_opts list entries start with + or -. - */ - for (s = eeh_opts; s && (s < (eeh_opts + eeh_opts_last)); - s += strlen(s)+1) { - for (i = 0; i < nstrs; i++) { - if (strcasecmp(strs[i], s+1) == 0) { - ret = (strs[i][0] == '+') ? 1 : 0; - } - } - } - return ret; -} - -/* - * Handle kernel eeh-on & eeh-off cmd line options for eeh. - * - * We support: - * eeh-off=loc1,loc2,loc3... - * - * and this option can be repeated so - * eeh-off=loc1,loc2 eeh-off=loc3 - * is the same as eeh-off=loc1,loc2,loc3 - * - * loc is an IBM location code that can be found in a manual or - * via openfirmware (or the Hardware Management Console). - * - * We also support these additional "loc" values: - * - * dev#:# vendor:device id in hex (e.g. dev1022:2000) - * class# class id in hex (e.g. class0200) - * - * If no location code is specified all devices are assumed - * so eeh-off means eeh by default is off. - */ - -/* - * This is implemented as a null separated list of strings. - * Each string looks like this: "+X" or "-X" - * where X is a loc code, vendor:device, class (as shown above) - * or empty which is used to indicate all. - * - * We interpret this option string list so that it will literally - * behave left-to-right even if some combinations don't make sense. - */ -static int __init eeh_parm(char *str, int state) -{ - char *s, *cur, *curend; - - if (!eeh_opts) { - eeh_opts = alloc_bootmem(EEH_MAX_OPTS); - eeh_opts[eeh_opts_last++] = '+'; /* default */ - eeh_opts[eeh_opts_last++] = '\0'; - } - if (*str == '\0') { - eeh_opts[eeh_opts_last++] = state ? '+' : '-'; - eeh_opts[eeh_opts_last++] = '\0'; - return 1; - } - if (*str == '=') - str++; - for (s = str; s && *s != '\0'; s = curend) { - cur = s; - /* ignore empties. Don't treat as "all-on" or "all-off" */ - while (*cur == ',') - cur++; - curend = strchr(cur, ','); - if (!curend) - curend = cur + strlen(cur); - if (*cur) { - int curlen = curend-cur; - if (eeh_opts_last + curlen > EEH_MAX_OPTS-2) { - printk(KERN_WARNING "EEH: sorry...too many " - "eeh cmd line options\n"); - return 1; - } - eeh_opts[eeh_opts_last++] = state ? '+' : '-'; - strncpy(eeh_opts+eeh_opts_last, cur, curlen); - eeh_opts_last += curlen; - eeh_opts[eeh_opts_last++] = '\0'; - } - } - - return 1; -} - -static int __init eehoff_parm(char *str) -{ - return eeh_parm(str, 0); -} - -static int __init eehon_parm(char *str) -{ - return eeh_parm(str, 1); -} - -__setup("eeh-off", eehoff_parm); -__setup("eeh-on", eehon_parm); diff -Nru a/arch/ppc64/kernel/entry.S b/arch/ppc64/kernel/entry.S --- a/arch/ppc64/kernel/entry.S 2004-09-26 10:25:55 -07:00 +++ b/arch/ppc64/kernel/entry.S 2004-09-26 10:25:55 -07:00 @@ -746,6 +746,10 @@ mtlr r0 blr /* return to caller */ +#endif /* CONFIG_PPC_PSERIES */ + +#ifdef CONFIG_PPC_MULTIPLATFORM + _GLOBAL(enter_prom) mflr r0 std r0,16(r1) @@ -777,11 +781,8 @@ std r11,_MSR(r1) /* Get the PROM entrypoint */ - bl .reloc_offset - LOADADDR(r12,prom) - sub r12,r12,r3 - ld r12,PROMENTRY(r12) - mtlr r12 + ld r0,GPR4(r1) + mtlr r0 /* Switch MSR to 32 bits mode */ @@ -834,4 +835,4 @@ mtlr r0 blr -#endif /* defined(CONFIG_PPC_PSERIES) */ +#endif /* CONFIG_PPC_MULTIPLATFORM */ diff -Nru a/arch/ppc64/kernel/head.S b/arch/ppc64/kernel/head.S --- a/arch/ppc64/kernel/head.S 2004-09-26 10:25:56 -07:00 +++ b/arch/ppc64/kernel/head.S 2004-09-26 10:25:56 -07:00 @@ -83,13 +83,14 @@ .text .globl _stext _stext: -#ifdef CONFIG_PPC_PSERIES -_STATIC(__start) +#ifdef CONFIG_PPC_MULTIPLATFORM +_GLOBAL(__start) /* NOP this out unconditionally */ BEGIN_FTR_SECTION - b .__start_initialization_pSeries + b .__start_initialization_multiplatform END_FTR_SECTION(0, 1) -#endif +#endif /* CONFIG_PPC_MULTIPLATFORM */ + /* Catch branch to 0 in real mode */ trap #ifdef CONFIG_PPC_ISERIES @@ -117,7 +118,8 @@ .globl embedded_sysmap_end embedded_sysmap_end: .llong 0 -#else + +#else /* CONFIG_PPC_ISERIES */ /* Secondary processors spin on this value until it goes to 1. */ .globl __secondary_hold_spinloop @@ -548,15 +550,15 @@ .llong 0 /* Reserved */ .llong 0 /* Reserved */ .llong 0 /* Reserved */ - .llong 0xc00000000 /* KERNELBASE ESID */ - .llong 0x6a99b4b14 /* KERNELBASE VSID */ + .llong (KERNELBASE>>SID_SHIFT) + .llong 0x40bffffd5 /* KERNELBASE VSID */ /* We have to list the bolted VMALLOC segment here, too, so that it * will be restored on shared processor switch */ - .llong 0xd00000000 /* VMALLOCBASE ESID */ - .llong 0x08d12e6ab /* VMALLOCBASE VSID */ + .llong (VMALLOCBASE>>SID_SHIFT) + .llong 0xb0cffffd1 /* VMALLOCBASE VSID */ .llong 8192 /* # pages to map (32 MB) */ .llong 0 /* Offset from start of loadarea to start of map */ - .llong 0x0006a99b4b140000 /* VPN of first page to map */ + .llong 0x40bffffd50000 /* VPN of first page to map */ . = 0x6100 @@ -1064,18 +1066,9 @@ rldimi r10,r11,7,52 /* r10 = first ste of the group */ /* Calculate VSID */ - /* (((ea >> 28) & 0x1fff) << 15) | (ea >> 60) */ - rldic r11,r11,15,36 - ori r11,r11,0xc - - /* VSID_RANDOMIZER */ - li r9,9 - sldi r9,r9,32 - oris r9,r9,58231 - ori r9,r9,39831 - - mulld r9,r11,r9 - rldic r9,r9,12,16 /* r9 = vsid << 12 */ + /* This is a kernel address, so protovsid = ESID */ + ASM_VSID_SCRAMBLE(r11, r9) + rldic r9,r11,12,16 /* r9 = vsid << 12 */ /* Search the primary group for a free entry */ 1: ld r11,0(r10) /* Test valid bit of the current ste */ @@ -1232,12 +1225,10 @@ #endif b 1b /* Loop until told to go */ #ifdef CONFIG_PPC_ISERIES -_GLOBAL(__start_initialization_iSeries) +_STATIC(__start_initialization_iSeries) /* Clear out the BSS */ LOADADDR(r11,__bss_stop) - LOADADDR(r8,__bss_start) - sub r11,r11,r8 /* bss size */ addi r11,r11,7 /* round up to an even double word */ rldicl. r11,r11,61,3 /* shift right by 3 */ @@ -1274,32 +1265,73 @@ ld r6,PACA(r4) /* Get the base paca pointer */ ld r4,PACASTABVIRT(r6) - bl .iSeries_fixup_klimit + bl .iSeries_early_setup /* relocation is on at this point */ b .start_here_common -#endif +#endif /* CONFIG_PPC_ISERIES */ -#ifdef CONFIG_PPC_PSERIES +#ifdef CONFIG_PPC_MULTIPLATFORM -_STATIC(mmu_off) +_STATIC(__mmu_off) mfmsr r3 andi. r0,r3,MSR_IR|MSR_DR beqlr andc r3,r3,r0 - mtspr SRR0,r4 - mtspr SRR1,r3 + mtspr SPRN_SRR0,r4 + mtspr SPRN_SRR1,r3 sync rfid b . /* prevent speculative execution */ -_GLOBAL(__start_initialization_pSeries) - mr r31,r3 /* save parameters */ + + +/* + * Here is our main kernel entry point. We support currently 2 kind of entries + * depending on the value of r5. + * + * r5 != NULL -> OF entry, we go to prom_init, "legacy" parameter content + * in r3...r7 + * + * r5 == NULL -> kexec style entry. r3 is a physical pointer to the + * DT block, r4 is a physical pointer to the kernel itself + * + */ +_GLOBAL(__start_initialization_multiplatform) + /* + * Are we booted from a PROM Of-type client-interface ? + */ + cmpldi cr0,r5,0 + bne .__boot_from_prom /* yes -> prom */ + + /* Save parameters */ + mr r31,r3 + mr r30,r4 + + /* Make sure we are running in 64 bits mode */ + bl .enable_64b_mode + + /* Setup some critical 970 SPRs before switching MMU off */ + bl .__970_cpu_preinit + + /* cpu # */ + li r24,0 + + /* Switch off MMU if not already */ + LOADADDR(r4, .__after_prom_start - KERNELBASE) + add r4,r4,r30 + bl .__mmu_off + b .__after_prom_start + +_STATIC(__boot_from_prom) + /* Save parameters */ + mr r31,r3 mr r30,r4 mr r29,r5 mr r28,r6 mr r27,r7 + /* Make sure we are running in 64 bits mode */ bl .enable_64b_mode /* put a relocation offset into r3 */ @@ -1312,7 +1344,7 @@ /* Relocate the TOC from a virt addr to a real addr */ sub r2,r2,r3 - /* Save parameters */ + /* Restore parameters */ mr r3,r31 mr r4,r30 mr r5,r29 @@ -1321,17 +1353,8 @@ /* Do all of the interaction with OF client interface */ bl .prom_init - mr r23,r3 /* Save phys address we are running at */ - - /* Setup some critical 970 SPRs before switching MMU off */ - bl .__970_cpu_preinit - - li r24,0 /* cpu # */ - - /* Switch off MMU if not already */ - LOADADDR(r4, .__after_prom_start - KERNELBASE) - add r4,r4,r23 - bl .mmu_off + /* We never return */ + trap /* * At this point, r3 contains the physical address we are running at, @@ -1357,7 +1380,7 @@ li r3,0 /* target addr */ - // XXX FIXME: Use phys returned by OF (r23) + // XXX FIXME: Use phys returned by OF (r30) sub r4,r27,r26 /* source addr */ /* current address of _start */ /* i.e. where we are running */ @@ -1382,8 +1405,9 @@ ld r5,0(r5) /* get the value of klimit */ sub r5,r5,r27 bl .copy_and_flush /* copy the rest */ - b .start_here_pSeries -#endif + b .start_here_multiplatform + +#endif /* CONFIG_PPC_MULTIPLATFORM */ /* * Copy routine used to copy the kernel to start at physical address 0 @@ -1803,15 +1827,33 @@ isync blr -#ifdef CONFIG_PPC_PSERIES +#ifdef CONFIG_PPC_MULTIPLATFORM /* * This is where the main kernel code starts. */ -_STATIC(start_here_pSeries) +_STATIC(start_here_multiplatform) /* get a new offset, now that the kernel has moved. */ bl .reloc_offset mr r26,r3 + /* Clear out the BSS. It may have been done in prom_init, + * already but that's irrelevant since prom_init will soon + * be detached from the kernel completely. Besides, we need + * to clear it now for kexec-style entry. + */ + LOADADDR(r11,__bss_stop) + LOADADDR(r8,__bss_start) + sub r11,r11,r8 /* bss size */ + addi r11,r11,7 /* round up to an even double word */ + rldicl. r11,r11,61,3 /* shift right by 3 */ + beq 4f + addi r8,r8,-8 + li r0,0 + mtctr r11 /* zero this many doublewords */ +3: stdu r0,8(r8) + bdnz 3b +4: + mfmsr r6 ori r6,r6,MSR_RI mtmsrd r6 /* RI on */ @@ -1884,8 +1926,11 @@ mr r5,r26 bl .identify_cpu - /* Get the pointer to the segment table which is used by */ - /* stab_initialize */ + /* Setup a valid physical PACA pointer in SPRG3 for early_setup + * note that boot_cpuid can always be 0 nowadays since there is + * nowhere it can be initialized differently before we reach this + * code + */ LOADADDR(r27, boot_cpuid) sub r27,r27,r26 lwz r27,0(r27) @@ -1894,12 +1939,18 @@ mulli r13,r27,PACA_SIZE /* Calculate vaddr of right paca */ add r13,r13,r24 /* for this processor. */ sub r13,r13,r26 /* convert to physical addr */ - mtspr SPRG3,r13 /* PPPBBB: Temp... -Peter */ - ld r3,PACASTABREAL(r13) - ori r4,r3,1 /* turn on valid bit */ + /* Do very early kernel initializations, including initial hash table, + * stab and slb setup before we turn on relocation. */ + + /* Restore parameters passed from prom_init/kexec */ + mr r3,r31 + bl .early_setup + /* set the ASR */ + ld r3,PACASTABREAL(r13) + ori r4,r3,1 /* turn on valid bit */ li r3,SYSTEMCFG_PHYS_ADDR /* r3 = ptr to systemcfg */ lwz r3,PLATFORM(r3) /* r3 = platform flags */ cmpldi r3,PLATFORM_PSERIES_LPAR @@ -1918,13 +1969,7 @@ 98: /* !(rpa hypervisor) || !(star) */ mtasr r4 /* set the stab location */ 99: - mfspr r6,SPRG3 - ld r3,PACASTABREAL(r6) /* restore r3 for stab_initialize */ - - /* Initialize an initial memory mapping and turn on relocation. */ - bl .stab_initialize - bl .htab_initialize - + /* Set SDR1 (hash table pointer) */ li r3,SYSTEMCFG_PHYS_ADDR /* r3 = ptr to systemcfg */ lwz r3,PLATFORM(r3) /* r3 = platform flags */ /* Test if bit 0 is set (LPAR bit) */ @@ -1941,7 +1986,7 @@ mtspr SRR1,r4 rfid b . /* prevent speculative execution */ -#endif /* CONFIG_PPC_PSERIES */ +#endif /* CONFIG_PPC_MULTIPLATFORM */ /* This is where all platforms converge execution */ _STATIC(start_here_common) @@ -1988,13 +2033,6 @@ /* Load the TOC */ ld r2,PACATOC(r13) std r1,PACAKSAVE(r13) - - /* Restore the parms passed in from the bootloader. */ - mr r3,r31 - mr r4,r30 - mr r5,r29 - mr r6,r28 - mr r7,r27 bl .setup_system diff -Nru a/arch/ppc64/kernel/iSeries_htab.c b/arch/ppc64/kernel/iSeries_htab.c --- a/arch/ppc64/kernel/iSeries_htab.c 2004-09-26 10:25:56 -07:00 +++ b/arch/ppc64/kernel/iSeries_htab.c 2004-09-26 10:25:56 -07:00 @@ -233,4 +233,6 @@ ppc_md.hpte_updateboltedpp = iSeries_hpte_updateboltedpp; ppc_md.hpte_insert = iSeries_hpte_insert; ppc_md.hpte_remove = iSeries_hpte_remove; + + htab_finish_init(); } diff -Nru a/arch/ppc64/kernel/iSeries_pci_reset.c b/arch/ppc64/kernel/iSeries_pci_reset.c --- a/arch/ppc64/kernel/iSeries_pci_reset.c 2004-09-26 10:25:57 -07:00 +++ b/arch/ppc64/kernel/iSeries_pci_reset.c 2004-09-26 10:25:57 -07:00 @@ -65,7 +65,8 @@ AssertDelay = (5 * HZ) / 10; else AssertDelay = (AssertTime * HZ) / 10; - if (WaitDelay == 0) + + if (DelayTime == 0) WaitDelay = (30 * HZ) / 10; else WaitDelay = (DelayTime * HZ) / 10; diff -Nru a/arch/ppc64/kernel/iSeries_setup.c b/arch/ppc64/kernel/iSeries_setup.c --- a/arch/ppc64/kernel/iSeries_setup.c 2004-09-26 10:25:57 -07:00 +++ b/arch/ppc64/kernel/iSeries_setup.c 2004-09-26 10:25:57 -07:00 @@ -16,6 +16,8 @@ * 2 of the License, or (at your option) any later version. */ +#undef DEBUG + #include #include #include @@ -54,6 +56,14 @@ #include #include +extern void hvlog(char *fmt, ...); + +#ifdef DEBUG +#define DBG(fmt...) hvlog(fmt) +#else +#define DBG(fmt...) +#endif + /* Function Prototypes */ extern void ppcdbg_initialize(void); extern void tce_init_iSeries(void); @@ -75,8 +85,6 @@ int piranha_simulator; -int boot_cpuid; - extern int rd_size; /* Defined in drivers/block/rd.c */ extern unsigned long klimit; extern unsigned long embedded_sysmap_start; @@ -275,8 +283,28 @@ return mem_blocks; } -void __init iSeries_init_early(void) +static void __init iSeries_parse_cmdline(void) +{ + char *p, *q; + + /* copy the command line parameter from the primary VSP */ + HvCallEvent_dmaToSp(cmd_line, 2 * 64* 1024, 256, + HvLpDma_Direction_RemoteToLocal); + + p = cmd_line; + q = cmd_line + 255; + while(p < q) { + if (!*p || *p == '\n') + break; + ++p; + } + *p = 0; +} + +/*static*/ void __init iSeries_init_early(void) { + DBG(" -> iSeries_init_early()\n"); + ppcdbg_initialize(); #if defined(CONFIG_BLK_DEV_INITRD) @@ -300,25 +328,20 @@ iSeries_recal_tb = get_tb(); iSeries_recal_titan = HvCallXm_loadTod(); - ppc_md.setup_arch = iSeries_setup_arch; - ppc_md.get_cpuinfo = iSeries_get_cpuinfo; - ppc_md.init_IRQ = iSeries_init_IRQ; - ppc_md.get_irq = iSeries_get_irq; - ppc_md.init = NULL; - - ppc_md.pcibios_fixup = iSeries_pci_final_fixup; - - ppc_md.restart = iSeries_restart; - ppc_md.power_off = iSeries_power_off; - ppc_md.halt = iSeries_halt; - - ppc_md.get_boot_time = iSeries_get_boot_time; - ppc_md.set_rtc_time = iSeries_set_rtc_time; - ppc_md.get_rtc_time = iSeries_get_rtc_time; - ppc_md.calibrate_decr = iSeries_calibrate_decr; - ppc_md.progress = iSeries_progress; + /* + * Cache sizes must be initialized before hpte_init_iSeries is called + * as the later need them for flush_icache_range() + */ + setup_iSeries_cache_sizes(); + /* + * Initialize the hash table management pointers + */ hpte_init_iSeries(); + + /* + * Initialize the DMA/TCE management + */ tce_init_iSeries(); /* @@ -326,39 +349,36 @@ * AS/400 absolute addresses */ build_iSeries_Memory_Map(); - setup_iSeries_cache_sizes(); + /* Initialize machine-dependency vectors */ #ifdef CONFIG_SMP smp_init_iSeries(); #endif if (itLpNaca.xPirEnvironMode == 0) piranha_simulator = 1; -} - -void __init iSeries_init(unsigned long r3, unsigned long r4, unsigned long r5, - unsigned long r6, unsigned long r7) -{ - char *p, *q; /* Associate Lp Event Queue 0 with processor 0 */ HvCallEvent_setLpEventQueueInterruptProc(0, 0); - /* copy the command line parameter from the primary VSP */ - HvCallEvent_dmaToSp(cmd_line, 2 * 64* 1024, 256, - HvLpDma_Direction_RemoteToLocal); - - p = cmd_line; - q = cmd_line + 255; - while( p < q ) { - if (!*p || *p == '\n') - break; - ++p; - } - *p = 0; - mf_init(); mf_initialized = 1; mb(); + + /* If we were passed an initrd, set the ROOT_DEV properly if the values + * look sensible. If not, clear initrd reference. + */ +#ifdef CONFIG_BLK_DEV_INITRD + if (initrd_start >= KERNELBASE && initrd_end >= KERNELBASE && + initrd_end > initrd_start) + ROOT_DEV = Root_RAM0; + else + initrd_start = initrd_end = 0; +#endif /* CONFIG_BLK_DEV_INITRD */ + + + iSeries_parse_cmdline(); + + DBG(" <- iSeries_init_early()\n"); } /* @@ -782,7 +802,7 @@ } } -void iSeries_fixup_klimit(void) +static void __init iSeries_fixup_klimit(void) { /* * Change klimit to take into account any ram disk @@ -811,3 +831,27 @@ } late_initcall(iSeries_src_init); + +void __init iSeries_early_setup(void) +{ + iSeries_fixup_klimit(); + + ppc_md.setup_arch = iSeries_setup_arch; + ppc_md.get_cpuinfo = iSeries_get_cpuinfo; + ppc_md.init_IRQ = iSeries_init_IRQ; + ppc_md.get_irq = iSeries_get_irq; + ppc_md.init_early = iSeries_init_early, + + ppc_md.pcibios_fixup = iSeries_pci_final_fixup; + + ppc_md.restart = iSeries_restart; + ppc_md.power_off = iSeries_power_off; + ppc_md.halt = iSeries_halt; + + ppc_md.get_boot_time = iSeries_get_boot_time; + ppc_md.set_rtc_time = iSeries_set_rtc_time; + ppc_md.get_rtc_time = iSeries_get_rtc_time; + ppc_md.calibrate_decr = iSeries_calibrate_decr; + ppc_md.progress = iSeries_progress; +} + diff -Nru a/arch/ppc64/kernel/iSeries_setup.h b/arch/ppc64/kernel/iSeries_setup.h --- a/arch/ppc64/kernel/iSeries_setup.h 2004-09-26 10:25:57 -07:00 +++ b/arch/ppc64/kernel/iSeries_setup.h 2004-09-26 10:25:57 -07:00 @@ -19,10 +19,6 @@ #ifndef __ISERIES_SETUP_H__ #define __ISERIES_SETUP_H__ -extern void iSeries_init_early(void); -extern void iSeries_init(unsigned long r3, unsigned long ird_start, - unsigned long ird_end, unsigned long cline_start, - unsigned long cline_end); extern void iSeries_setup_arch(void); extern void iSeries_setup_residual(struct seq_file *m, int cpu_id); extern void iSeries_get_cpuinfo(struct seq_file *m); diff -Nru a/arch/ppc64/kernel/idle.c b/arch/ppc64/kernel/idle.c --- a/arch/ppc64/kernel/idle.c 2004-09-26 10:25:57 -07:00 +++ b/arch/ppc64/kernel/idle.c 2004-09-26 10:25:57 -07:00 @@ -16,40 +16,29 @@ */ #include -#include #include #include -#include #include -#include -#include -#include -#include -#include #include +#include +#include -#include -#include #include -#include #include #include -#include #include #include -#include #include #include +#include -extern long cede_processor(void); -extern long poll_pending(void); extern void power4_idle(void); -int (*idle_loop)(void); +static int (*idle_loop)(void); #ifdef CONFIG_PPC_ISERIES -unsigned long maxYieldTime = 0; -unsigned long minYieldTime = 0xffffffffffffffffUL; +static unsigned long maxYieldTime = 0; +static unsigned long minYieldTime = 0xffffffffffffffffUL; static void yield_shared_processor(void) { @@ -80,7 +69,7 @@ process_iSeries_events(); } -int iSeries_idle(void) +static int iSeries_idle(void) { struct paca_struct *lpaca; long oldval; @@ -91,13 +80,10 @@ CTRL = mfspr(CTRLF); CTRL &= ~RUNLATCH; mtspr(CTRLT, CTRL); -#if 0 - init_idle(); -#endif lpaca = get_paca(); - for (;;) { + while (1) { if (lpaca->lppaca.xSharedProc) { if (ItLpQueue_isLpIntPending(lpaca->lpqueue_ptr)) process_iSeries_events(); @@ -125,11 +111,13 @@ schedule(); } + return 0; } -#endif -int default_idle(void) +#else + +static int default_idle(void) { long oldval; unsigned int cpu = smp_processor_id(); @@ -142,7 +130,12 @@ while (!need_resched() && !cpu_is_offline(cpu)) { barrier(); + /* + * Go into low thread priority and possibly + * low power mode. + */ HMT_low(); + HMT_very_low(); } HMT_medium(); @@ -174,8 +167,10 @@ ppaca = &paca[cpu ^ 1]; while (1) { - /* Indicate to the HV that we are idle. Now would be - * a good time to find other work to dispatch. */ + /* + * Indicate to the HV that we are idle. Now would be + * a good time to find other work to dispatch. + */ lpaca->lppaca.xIdle = 1; oldval = test_and_clear_thread_flag(TIF_NEED_RESCHED); @@ -184,41 +179,31 @@ start_snooze = __get_tb() + *smt_snooze_delay * tb_ticks_per_usec; while (!need_resched() && !cpu_is_offline(cpu)) { - /* need_resched could be 1 or 0 at this - * point. If it is 0, set it to 0, so - * an IPI/Prod is sent. If it is 1, keep - * it that way & schedule work. + /* + * Go into low thread priority and possibly + * low power mode. */ + HMT_low(); + HMT_very_low(); + if (*smt_snooze_delay == 0 || - __get_tb() < start_snooze) { - HMT_low(); /* Low thread priority */ + __get_tb() < start_snooze) continue; - } - HMT_very_low(); /* Low power mode */ + HMT_medium(); - /* If the SMT mode is system controlled & the - * partner thread is doing work, switch into - * ST mode. - */ - if((naca->smt_state == SMT_DYNAMIC) && - (!(ppaca->lppaca.xIdle))) { - /* Indicate we are no longer polling for - * work, and then clear need_resched. If - * need_resched was 1, set it back to 1 - * and schedule work + if (!(ppaca->lppaca.xIdle)) { + local_irq_disable(); + + /* + * We are about to sleep the thread + * and so wont be polling any + * more. */ clear_thread_flag(TIF_POLLING_NRFLAG); - oldval = test_and_clear_thread_flag(TIF_NEED_RESCHED); - if(oldval == 1) { - set_need_resched(); - break; - } - /* DRENG: Go HMT_medium here ? */ - local_irq_disable(); - - /* SMT dynamic mode. Cede will result + /* + * SMT dynamic mode. Cede will result * in this thread going dormant, if the * partner thread is still doing work. * Thread wakes up if partner goes idle, @@ -226,15 +211,21 @@ * occurs. Returning from the cede * enables external interrupts. */ - cede_processor(); + if (!need_resched()) + cede_processor(); + else + local_irq_enable(); } else { - /* Give the HV an opportunity at the + /* + * Give the HV an opportunity at the * processor, since we are not doing * any work. */ poll_pending(); } } + + clear_thread_flag(TIF_POLLING_NRFLAG); } else { set_need_resched(); } @@ -248,50 +239,54 @@ return 0; } -int shared_idle(void) +static int shared_idle(void) { struct paca_struct *lpaca = get_paca(); + unsigned int cpu = smp_processor_id(); while (1) { - if (cpu_is_offline(smp_processor_id()) && - system_state == SYSTEM_RUNNING) - cpu_die(); - - /* Indicate to the HV that we are idle. Now would be - * a good time to find other work to dispatch. */ + /* + * Indicate to the HV that we are idle. Now would be + * a good time to find other work to dispatch. + */ lpaca->lppaca.xIdle = 1; - if (!need_resched()) { - local_irq_disable(); - - /* + while (!need_resched() && !cpu_is_offline(cpu)) { + local_irq_disable(); + + /* * Yield the processor to the hypervisor. We return if * an external interrupt occurs (which are driven prior * to returning here) or if a prod occurs from another - * processor. When returning here, external interrupts + * processor. When returning here, external interrupts * are enabled. + * + * Check need_resched() again with interrupts disabled + * to avoid a race. */ - cede_processor(); + if (!need_resched()) + cede_processor(); + else + local_irq_enable(); } HMT_medium(); lpaca->lppaca.xIdle = 0; schedule(); + if (cpu_is_offline(smp_processor_id()) && + system_state == SYSTEM_RUNNING) + cpu_die(); } return 0; } -#endif -int cpu_idle(void) -{ - idle_loop(); - return 0; -} +#endif /* CONFIG_PPC_PSERIES */ -int native_idle(void) +static int native_idle(void) { while(1) { + /* check CPU type here */ if (!need_resched()) power4_idle(); if (need_resched()) @@ -300,33 +295,80 @@ return 0; } +#endif /* CONFIG_PPC_ISERIES */ + +int cpu_idle(void) +{ + idle_loop(); + return 0; +} + +int powersave_nap; + +#ifdef CONFIG_SYSCTL +/* + * Register the sysctl to set/clear powersave_nap. + */ +static ctl_table powersave_nap_ctl_table[]={ + { + .ctl_name = KERN_PPC_POWERSAVE_NAP, + .procname = "powersave-nap", + .data = &powersave_nap, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = &proc_dointvec, + }, + { 0, }, +}; +static ctl_table powersave_nap_sysctl_root[] = { + { 1, "kernel", NULL, 0, 0755, powersave_nap_ctl_table, }, + { 0,}, +}; + +static int __init +register_powersave_nap_sysctl(void) +{ + register_sysctl_table(powersave_nap_sysctl_root, 0); + + return 0; +} +__initcall(register_powersave_nap_sysctl); +#endif + int idle_setup(void) { + /* + * Move that junk to each platform specific file, eventually define + * a pSeries_idle for shared processor stuff + */ #ifdef CONFIG_PPC_ISERIES idle_loop = iSeries_idle; + return 1; #else + idle_loop = default_idle; +#endif +#ifdef CONFIG_PPC_PSERIES if (systemcfg->platform & PLATFORM_PSERIES) { if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR) { if (get_paca()->lppaca.xSharedProc) { - printk("idle = shared_idle\n"); + printk(KERN_INFO "Using shared processor idle loop\n"); idle_loop = shared_idle; } else { - printk("idle = dedicated_idle\n"); + printk(KERN_INFO "Using dedicated idle loop\n"); idle_loop = dedicated_idle; } } else { - printk("idle = default_idle\n"); + printk(KERN_INFO "Using default idle loop\n"); idle_loop = default_idle; } - } else if (systemcfg->platform == PLATFORM_POWERMAC) { - printk("idle = native_idle\n"); + } +#endif /* CONFIG_PPC_PSERIES */ +#ifdef CONFIG_PPC_PMAC + if (systemcfg->platform == PLATFORM_POWERMAC) { + printk(KERN_INFO "Using native/NAP idle loop\n"); idle_loop = native_idle; - } else { - printk("idle_setup: unknown platform, use default_idle\n"); - idle_loop = default_idle; } -#endif +#endif /* CONFIG_PPC_PMAC */ return 1; } - diff -Nru a/arch/ppc64/kernel/ioctl32.c b/arch/ppc64/kernel/ioctl32.c --- a/arch/ppc64/kernel/ioctl32.c 2004-09-26 10:25:57 -07:00 +++ b/arch/ppc64/kernel/ioctl32.c 2004-09-26 10:25:57 -07:00 @@ -22,9 +22,7 @@ #define INCLUDES #include "compat_ioctl.c" -#include #include -#include #define CODE #include "compat_ioctl.c" diff -Nru a/arch/ppc64/kernel/iommu.c b/arch/ppc64/kernel/iommu.c --- a/arch/ppc64/kernel/iommu.c 2004-09-26 10:25:55 -07:00 +++ b/arch/ppc64/kernel/iommu.c 2004-09-26 10:25:55 -07:00 @@ -229,7 +229,7 @@ struct scatterlist *sglist, int nelems, enum dma_data_direction direction) { - dma_addr_t dma_next, dma_addr; + dma_addr_t dma_next = 0, dma_addr; unsigned long flags; struct scatterlist *s, *outs, *segstart; int outcount; diff -Nru a/arch/ppc64/kernel/irq.c b/arch/ppc64/kernel/irq.c --- a/arch/ppc64/kernel/irq.c 2004-09-26 10:25:56 -07:00 +++ b/arch/ppc64/kernel/irq.c 2004-09-26 10:25:56 -07:00 @@ -677,6 +677,8 @@ return 0; } +EXPORT_SYMBOL(probe_irq_mask); + void __init init_IRQ(void) { static int once = 0; diff -Nru a/arch/ppc64/kernel/lmb.c b/arch/ppc64/kernel/lmb.c --- a/arch/ppc64/kernel/lmb.c 2004-09-26 10:25:56 -07:00 +++ b/arch/ppc64/kernel/lmb.c 2004-09-26 10:25:56 -07:00 @@ -22,6 +22,43 @@ struct lmb lmb; +#undef DEBUG + +void lmb_dump_all(void) +{ +#ifdef DEBUG + unsigned long i; + struct lmb *_lmb = &lmb; + + udbg_printf("lmb_dump_all:\n"); + udbg_printf(" memory.cnt = 0x%lx\n", + _lmb->memory.cnt); + udbg_printf(" memory.size = 0x%lx\n", + _lmb->memory.size); + for (i=0; i < _lmb->memory.cnt ;i++) { + udbg_printf(" memory.region[0x%x].base = 0x%lx\n", + i, _lmb->memory.region[i].base); + udbg_printf(" .physbase = 0x%lx\n", + _lmb->memory.region[i].physbase); + udbg_printf(" .size = 0x%lx\n", + _lmb->memory.region[i].size); + } + + udbg_printf("\n reserved.cnt = 0x%lx\n", + _lmb->reserved.cnt); + udbg_printf(" reserved.size = 0x%lx\n", + _lmb->reserved.size); + for (i=0; i < _lmb->reserved.cnt ;i++) { + udbg_printf(" reserved.region[0x%x].base = 0x%lx\n", + i, _lmb->reserved.region[i].base); + udbg_printf(" .physbase = 0x%lx\n", + _lmb->reserved.region[i].physbase); + udbg_printf(" .size = 0x%lx\n", + _lmb->reserved.region[i].size); + } +#endif /* DEBUG */ +} + static unsigned long __init lmb_addrs_overlap(unsigned long base1, unsigned long size1, unsigned long base2, unsigned long size2) @@ -71,8 +108,7 @@ void __init lmb_init(void) { - unsigned long offset = reloc_offset(); - struct lmb *_lmb = PTRRELOC(&lmb); + struct lmb *_lmb = &lmb; /* Create a dummy zero size LMB which will get coalesced away later. * This simplifies the lmb_add() code below... @@ -94,8 +130,7 @@ unsigned long i; unsigned long mem_size = 0; unsigned long size_mask = 0; - unsigned long offset = reloc_offset(); - struct lmb *_lmb = PTRRELOC(&lmb); + struct lmb *_lmb = &lmb; #ifdef CONFIG_MSCHUNKS unsigned long physbase = 0; #endif @@ -178,8 +213,7 @@ long __init lmb_add(unsigned long base, unsigned long size) { - unsigned long offset = reloc_offset(); - struct lmb *_lmb = PTRRELOC(&lmb); + struct lmb *_lmb = &lmb; struct lmb_region *_rgn = &(_lmb->memory); /* On pSeries LPAR systems, the first LMB is our RMO region. */ @@ -193,8 +227,7 @@ long __init lmb_reserve(unsigned long base, unsigned long size) { - unsigned long offset = reloc_offset(); - struct lmb *_lmb = PTRRELOC(&lmb); + struct lmb *_lmb = &lmb; struct lmb_region *_rgn = &(_lmb->reserved); return lmb_add_region(_rgn, base, size); @@ -227,8 +260,7 @@ { long i, j; unsigned long base = 0; - unsigned long offset = reloc_offset(); - struct lmb *_lmb = PTRRELOC(&lmb); + struct lmb *_lmb = &lmb; struct lmb_region *_mem = &(_lmb->memory); struct lmb_region *_rsv = &(_lmb->reserved); @@ -263,8 +295,7 @@ unsigned long __init lmb_phys_mem_size(void) { - unsigned long offset = reloc_offset(); - struct lmb *_lmb = PTRRELOC(&lmb); + struct lmb *_lmb = &lmb; #ifdef CONFIG_MSCHUNKS return _lmb->memory.size; #else @@ -282,8 +313,7 @@ unsigned long __init lmb_end_of_DRAM(void) { - unsigned long offset = reloc_offset(); - struct lmb *_lmb = PTRRELOC(&lmb); + struct lmb *_lmb = &lmb; struct lmb_region *_mem = &(_lmb->memory); int idx = _mem->cnt - 1; @@ -300,8 +330,7 @@ lmb_abs_to_phys(unsigned long aa) { unsigned long i, pa = aa; - unsigned long offset = reloc_offset(); - struct lmb *_lmb = PTRRELOC(&lmb); + struct lmb *_lmb = &lmb; struct lmb_region *_mem = &(_lmb->memory); for (i=0; i < _mem->cnt; i++) { diff -Nru a/arch/ppc64/kernel/lparcfg.c b/arch/ppc64/kernel/lparcfg.c --- a/arch/ppc64/kernel/lparcfg.c 2004-09-26 10:25:55 -07:00 +++ b/arch/ppc64/kernel/lparcfg.c 2004-09-26 10:25:55 -07:00 @@ -34,31 +34,37 @@ #include #include -#define MODULE_VERS "1.3" +#define MODULE_VERS "1.4" #define MODULE_NAME "lparcfg" /* #define LPARCFG_DEBUG */ /* find a better place for this function... */ -void log_plpar_hcall_return(unsigned long rc,char * tag) +void log_plpar_hcall_return(unsigned long rc, char *tag) { - if (rc ==0 ) /* success, return */ + if (rc == 0) /* success, return */ return; /* check for null tag ? */ if (rc == H_Hardware) - printk(KERN_INFO "plpar-hcall (%s) failed with hardware fault\n",tag); + printk(KERN_INFO + "plpar-hcall (%s) failed with hardware fault\n", tag); else if (rc == H_Function) - printk(KERN_INFO "plpar-hcall (%s) failed; function not allowed\n",tag); + printk(KERN_INFO + "plpar-hcall (%s) failed; function not allowed\n", tag); else if (rc == H_Authority) - printk(KERN_INFO "plpar-hcall (%s) failed; not authorized to this function\n",tag); + printk(KERN_INFO + "plpar-hcall (%s) failed; not authorized to this function\n", + tag); else if (rc == H_Parameter) - printk(KERN_INFO "plpar-hcall (%s) failed; Bad parameter(s)\n",tag); + printk(KERN_INFO "plpar-hcall (%s) failed; Bad parameter(s)\n", + tag); else - printk(KERN_INFO "plpar-hcall (%s) failed with unexpected rc(0x%lx)\n",tag,rc); + printk(KERN_INFO + "plpar-hcall (%s) failed with unexpected rc(0x%lx)\n", + tag, rc); } - static struct proc_dir_entry *proc_ppc64_lparcfg; #define LPARCFG_BUFF_SIZE 4096 @@ -78,59 +84,60 @@ shared = (int)(lpaca->lppaca_ptr->xSharedProc); seq_printf(m, "serial_number=%c%c%c%c%c%c%c\n", - e2a(xItExtVpdPanel.mfgID[2]), - e2a(xItExtVpdPanel.mfgID[3]), - e2a(xItExtVpdPanel.systemSerial[1]), - e2a(xItExtVpdPanel.systemSerial[2]), - e2a(xItExtVpdPanel.systemSerial[3]), - e2a(xItExtVpdPanel.systemSerial[4]), - e2a(xItExtVpdPanel.systemSerial[5])); + e2a(xItExtVpdPanel.mfgID[2]), + e2a(xItExtVpdPanel.mfgID[3]), + e2a(xItExtVpdPanel.systemSerial[1]), + e2a(xItExtVpdPanel.systemSerial[2]), + e2a(xItExtVpdPanel.systemSerial[3]), + e2a(xItExtVpdPanel.systemSerial[4]), + e2a(xItExtVpdPanel.systemSerial[5])); seq_printf(m, "system_type=%c%c%c%c\n", - e2a(xItExtVpdPanel.machineType[0]), - e2a(xItExtVpdPanel.machineType[1]), - e2a(xItExtVpdPanel.machineType[2]), - e2a(xItExtVpdPanel.machineType[3])); + e2a(xItExtVpdPanel.machineType[0]), + e2a(xItExtVpdPanel.machineType[1]), + e2a(xItExtVpdPanel.machineType[2]), + e2a(xItExtVpdPanel.machineType[3])); - lp_index = HvLpConfig_getLpIndex(); + lp_index = HvLpConfig_getLpIndex(); seq_printf(m, "partition_id=%d\n", (int)lp_index); seq_printf(m, "system_active_processors=%d\n", - (int)HvLpConfig_getSystemPhysicalProcessors()); + (int)HvLpConfig_getSystemPhysicalProcessors()); seq_printf(m, "system_potential_processors=%d\n", - (int)HvLpConfig_getSystemPhysicalProcessors()); + (int)HvLpConfig_getSystemPhysicalProcessors()); - processors = (int)HvLpConfig_getPhysicalProcessors(); + processors = (int)HvLpConfig_getPhysicalProcessors(); seq_printf(m, "partition_active_processors=%d\n", processors); - max_processors = (int)HvLpConfig_getMaxPhysicalProcessors(); + max_processors = (int)HvLpConfig_getMaxPhysicalProcessors(); seq_printf(m, "partition_potential_processors=%d\n", max_processors); - if(shared) { - entitled_capacity = HvLpConfig_getSharedProcUnits(); - max_entitled_capacity = HvLpConfig_getMaxSharedProcUnits(); + if (shared) { + entitled_capacity = HvLpConfig_getSharedProcUnits(); + max_entitled_capacity = HvLpConfig_getMaxSharedProcUnits(); } else { - entitled_capacity = processors * 100; - max_entitled_capacity = max_processors * 100; + entitled_capacity = processors * 100; + max_entitled_capacity = max_processors * 100; } seq_printf(m, "partition_entitled_capacity=%d\n", entitled_capacity); seq_printf(m, "partition_max_entitled_capacity=%d\n", - max_entitled_capacity); + max_entitled_capacity); - if(shared) { - pool_id = HvLpConfig_getSharedPoolIndex(); + if (shared) { + pool_id = HvLpConfig_getSharedPoolIndex(); seq_printf(m, "pool=%d\n", (int)pool_id); seq_printf(m, "pool_capacity=%d\n", - (int)(HvLpConfig_getNumProcsInSharedPool(pool_id)*100)); + (int)(HvLpConfig_getNumProcsInSharedPool(pool_id) * + 100)); } seq_printf(m, "shared_processor_mode=%d\n", shared); return 0; } -#endif /* CONFIG_PPC_ISERIES */ +#endif /* CONFIG_PPC_ISERIES */ #ifdef CONFIG_PPC_PSERIES /* @@ -158,11 +165,13 @@ * XXXX - Processors active on platform. */ static unsigned int h_get_ppp(unsigned long *entitled, - unsigned long *unallocated, unsigned long *aggregation, - unsigned long *resource) + unsigned long *unallocated, + unsigned long *aggregation, + unsigned long *resource) { unsigned long rc; - rc = plpar_hcall_4out(H_GET_PPP,0,0,0,0,entitled,unallocated,aggregation,resource); + rc = plpar_hcall_4out(H_GET_PPP, 0, 0, 0, 0, entitled, unallocated, + aggregation, resource); log_plpar_hcall_return(rc, "H_GET_PPP"); @@ -185,7 +194,7 @@ */ static unsigned long get_purr() { - unsigned long sum_purr=0; + unsigned long sum_purr = 0; return sum_purr; } @@ -202,7 +211,7 @@ { int call_status; - char * local_buffer = kmalloc(SPLPAR_MAXLENGTH, GFP_KERNEL); + char *local_buffer = kmalloc(SPLPAR_MAXLENGTH, GFP_KERNEL); if (!local_buffer) { printk(KERN_ERR "%s %s kmalloc failure at line %d \n", __FILE__, __FUNCTION__, __LINE__); @@ -219,22 +228,23 @@ spin_unlock(&rtas_data_buf_lock); if (call_status != 0) { - printk(KERN_INFO "%s %s Error calling get-system-parameter (0x%x)\n", + printk(KERN_INFO + "%s %s Error calling get-system-parameter (0x%x)\n", __FILE__, __FUNCTION__, call_status); } else { int splpar_strlen; int idx, w_idx; - char * workbuffer = kmalloc(SPLPAR_MAXLENGTH, GFP_KERNEL); + char *workbuffer = kmalloc(SPLPAR_MAXLENGTH, GFP_KERNEL); if (!workbuffer) { - printk(KERN_ERR "%s %s kmalloc failure at line %d \n",__FILE__,__FUNCTION__,__LINE__); + printk(KERN_ERR "%s %s kmalloc failure at line %d \n", + __FILE__, __FUNCTION__, __LINE__); return; } - #ifdef LPARCFG_DEBUG printk(KERN_INFO "success calling get-system-parameter \n"); #endif splpar_strlen = local_buffer[0] * 16 + local_buffer[1]; - local_buffer += 2; /* step over strlen value */ + local_buffer += 2; /* step over strlen value */ memset(workbuffer, 0, SPLPAR_MAXLENGTH); w_idx = 0; @@ -253,13 +263,15 @@ w_idx = 0; } else if (local_buffer[idx] == '=') { /* code here to replace workbuffer contents - with different keyword strings */ - if (0 == strcmp(workbuffer,"MaxEntCap")) { - strcpy(workbuffer, "partition_max_entitled_capacity"); + with different keyword strings */ + if (0 == strcmp(workbuffer, "MaxEntCap")) { + strcpy(workbuffer, + "partition_max_entitled_capacity"); w_idx = strlen(workbuffer); } - if (0 == strcmp(workbuffer,"MaxPlatProcs")) { - strcpy(workbuffer, "system_potential_processors"); + if (0 == strcmp(workbuffer, "MaxPlatProcs")) { + strcpy(workbuffer, + "system_potential_processors"); w_idx = strlen(workbuffer); } } @@ -283,7 +295,7 @@ while ((cpus_dn = of_find_node_by_type(cpus_dn, "cpu"))) { #ifdef LPARCFG_DEBUG - printk(KERN_ERR "cpus_dn %p \n",cpus_dn); + printk(KERN_ERR "cpus_dn %p \n", cpus_dn); #endif count++; } @@ -292,7 +304,8 @@ static int lparcfg_data(struct seq_file *m, void *v) { - int system_active_processors; + int partition_potential_processors; + int partition_active_processors; struct device_node *rootdn; const char *model = ""; const char *system_id = ""; @@ -305,12 +318,11 @@ model = get_property(rootdn, "model", NULL); system_id = get_property(rootdn, "system-id", NULL); lp_index_ptr = (unsigned int *) - get_property(rootdn, "ibm,partition-no", NULL); + get_property(rootdn, "ibm,partition-no", NULL); if (lp_index_ptr) lp_index = *lp_index_ptr; } - seq_printf(m, "%s %s \n", MODULE_NAME, MODULE_VERS); seq_printf(m, "serial_number=%s\n", system_id); @@ -323,11 +335,13 @@ lrdrp = (int *)get_property(rtas_node, "ibm,lrdr-capacity", NULL); if (lrdrp == NULL) { - system_active_processors = systemcfg->processorCount; + partition_potential_processors = systemcfg->processorCount; } else { - system_active_processors = *(lrdrp + 4); + partition_potential_processors = *(lrdrp + 4); } + partition_active_processors = lparcfg_count_active_processors(); + if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR) { unsigned long h_entitled, h_unallocated; unsigned long h_aggregation, h_resource; @@ -342,71 +356,69 @@ seq_printf(m, "R6=0x%lx\n", h_aggregation); seq_printf(m, "R7=0x%lx\n", h_resource); - h_pic(&pool_idle_time, &pool_procs); - purr = get_purr(); /* this call handles the ibm,get-system-parameter contents */ parse_system_parameter_string(m); - seq_printf(m, "partition_entitled_capacity=%ld\n", - h_entitled); - - seq_printf(m, "pool=%ld\n", - (h_aggregation >> 0*8) & 0xffff); + seq_printf(m, "partition_entitled_capacity=%ld\n", h_entitled); - seq_printf(m, "group=%ld\n", - (h_aggregation >> 2*8) & 0xffff); + seq_printf(m, "group=%ld\n", (h_aggregation >> 2 * 8) & 0xffff); seq_printf(m, "system_active_processors=%ld\n", - (h_resource >> 0*8) & 0xffff); + (h_resource >> 0 * 8) & 0xffff); + + /* pool related entries are apropriate for shared configs */ + if (paca[0].lppaca.xSharedProc) { - seq_printf(m, "pool_capacity=%ld\n", - (h_resource >> 2*8) & 0xffff); + h_pic(&pool_idle_time, &pool_procs); + + seq_printf(m, "pool=%ld\n", + (h_aggregation >> 0 * 8) & 0xffff); + + /* report pool_capacity in percentage */ + seq_printf(m, "pool_capacity=%ld\n", + ((h_resource >> 2 * 8) & 0xffff) * 100); + + seq_printf(m, "pool_idle_time=%ld\n", pool_idle_time); + + seq_printf(m, "pool_num_procs=%ld\n", pool_procs); + } seq_printf(m, "unallocated_capacity_weight=%ld\n", - (h_resource >> 4*8) & 0xFF); + (h_resource >> 4 * 8) & 0xFF); seq_printf(m, "capacity_weight=%ld\n", - (h_resource >> 5*8) & 0xFF); - - seq_printf(m, "capped=%ld\n", - (h_resource >> 6*8) & 0x01); + (h_resource >> 5 * 8) & 0xFF); - seq_printf(m, "unallocated_capacity=%ld\n", - h_unallocated); + seq_printf(m, "capped=%ld\n", (h_resource >> 6 * 8) & 0x01); - seq_printf(m, "pool_idle_time=%ld\n", - pool_idle_time); + seq_printf(m, "unallocated_capacity=%ld\n", h_unallocated); - seq_printf(m, "pool_num_procs=%ld\n", - pool_procs); + seq_printf(m, "purr=%ld\n", purr); - seq_printf(m, "purr=%ld\n", - purr); + } else { /* non SPLPAR case */ - } else /* non SPLPAR case */ { seq_printf(m, "system_active_processors=%d\n", - system_active_processors); + partition_potential_processors); seq_printf(m, "system_potential_processors=%d\n", - system_active_processors); + partition_potential_processors); seq_printf(m, "partition_max_entitled_capacity=%d\n", - 100*system_active_processors); + partition_potential_processors * 100); seq_printf(m, "partition_entitled_capacity=%d\n", - system_active_processors*100); + partition_active_processors * 100); } seq_printf(m, "partition_active_processors=%d\n", - (int) lparcfg_count_active_processors()); + partition_active_processors); seq_printf(m, "partition_potential_processors=%d\n", - system_active_processors); + partition_potential_processors); - seq_printf(m, "shared_processor_mode=%d\n", - paca[0].lppaca.xSharedProc); + seq_printf(m, "shared_processor_mode=%d\n", paca[0].lppaca.xSharedProc); return 0; } @@ -421,14 +433,15 @@ * This function should be invoked only on systems with * FW_FEATURE_SPLPAR. */ -static ssize_t lparcfg_write(struct file *file, const char __user *buf, size_t count, loff_t *off) +static ssize_t lparcfg_write(struct file *file, const char __user * buf, + size_t count, loff_t * off) { char *kbuf; char *tmp; u64 new_entitled, *new_entitled_ptr = &new_entitled; u8 new_weight, *new_weight_ptr = &new_weight; - unsigned long current_entitled; /* parameters for h_get_ppp */ + unsigned long current_entitled; /* parameters for h_get_ppp */ unsigned long dummy; unsigned long resource; u8 current_weight; @@ -453,13 +466,13 @@ if (!strcmp(kbuf, "partition_entitled_capacity")) { char *endp; - *new_entitled_ptr = (u64)simple_strtoul(tmp, &endp, 10); + *new_entitled_ptr = (u64) simple_strtoul(tmp, &endp, 10); if (endp == tmp) goto out; new_weight_ptr = ¤t_weight; } else if (!strcmp(kbuf, "capacity_weight")) { char *endp; - *new_weight_ptr = (u8)simple_strtoul(tmp, &endp, 10); + *new_weight_ptr = (u8) simple_strtoul(tmp, &endp, 10); if (endp == tmp) goto out; new_entitled_ptr = ¤t_entitled; @@ -473,7 +486,7 @@ goto out; } - current_weight = (resource>>5*8)&0xFF; + current_weight = (resource >> 5 * 8) & 0xFF; pr_debug("%s: current_entitled = %lu, current_weight = %lu\n", __FUNCTION__, current_entitled, current_weight); @@ -498,23 +511,23 @@ retval = -EIO; } -out: + out: kfree(kbuf); return retval; } -#endif /* CONFIG_PPC_PSERIES */ +#endif /* CONFIG_PPC_PSERIES */ -static int lparcfg_open(struct inode * inode, struct file * file) +static int lparcfg_open(struct inode *inode, struct file *file) { - return single_open(file,lparcfg_data,NULL); + return single_open(file, lparcfg_data, NULL); } struct file_operations lparcfg_fops = { - owner: THIS_MODULE, - read: seq_read, - open: lparcfg_open, - release: single_release, + owner:THIS_MODULE, + read:seq_read, + open:lparcfg_open, + release:single_release, }; int __init lparcfg_init(void) @@ -533,7 +546,8 @@ ent->proc_fops = &lparcfg_fops; ent->data = kmalloc(LPARCFG_BUFF_SIZE, GFP_KERNEL); if (!ent->data) { - printk(KERN_ERR "Failed to allocate buffer for lparcfg\n"); + printk(KERN_ERR + "Failed to allocate buffer for lparcfg\n"); remove_proc_entry("lparcfg", ent->parent); return -ENOMEM; } @@ -550,7 +564,7 @@ { if (proc_ppc64_lparcfg) { if (proc_ppc64_lparcfg->data) { - kfree(proc_ppc64_lparcfg->data); + kfree(proc_ppc64_lparcfg->data); } remove_proc_entry("lparcfg", proc_ppc64_lparcfg->parent); } diff -Nru a/arch/ppc64/kernel/misc.S b/arch/ppc64/kernel/misc.S --- a/arch/ppc64/kernel/misc.S 2004-09-26 10:25:57 -07:00 +++ b/arch/ppc64/kernel/misc.S 2004-09-26 10:25:57 -07:00 @@ -127,6 +127,47 @@ blr #endif /* CONFIG_IRQSTACKS */ + /* + * To be called by C code which needs to do some operations with MMU + * disabled. Note that interrupts have to be disabled by the caller + * prior to calling us. The code called _MUST_ be in the RMO of course + * and part of the linear mapping as we don't attempt to translate the + * stack pointer at all. The function is called with the stack switched + * to this CPU emergency stack + * + * prototype is void *call_with_mmu_off(void *func, void *data); + * + * the called function is expected to be of the form + * + * void *called(void *data); + */ +_GLOBAL(call_with_mmu_off) + mflr r0 /* get link, save it on stackframe */ + std r0,16(r1) + mr r1,r5 /* save old stack ptr */ + ld r1,PACAEMERGSP(r13) /* get emerg. stack */ + subi r1,r1,STACK_FRAME_OVERHEAD + std r0,16(r1) /* save link on emerg. stack */ + std r5,0(r1) /* save old stack ptr in backchain */ + ld r3,0(r3) /* get to real function ptr (assume same TOC) */ + bl 2f /* we need LR to return, continue at label 2 */ + + ld r0,16(r1) /* we return here from the call, get LR and */ + ld r1,0(r1) /* .. old stack ptr */ + mtspr SPRN_SRR0,r0 /* and get back to virtual mode with these */ + mfmsr r4 + ori r4,r4,MSR_IR|MSR_DR + mtspr SPRN_SRR1,r4 + rfid + +2: mtspr SPRN_SRR0,r3 /* coming from above, enter real mode */ + mr r3,r4 /* get parameter */ + mfmsr r0 + ori r0,r0,MSR_IR|MSR_DR + xori r0,r0,MSR_IR|MSR_DR + mtspr SPRN_SRR1,r0 + rfid + /* * Flush instruction cache. */ @@ -454,17 +495,6 @@ sync blr -_GLOBAL(_get_PVR) - mfspr r3,PVR - blr - -_GLOBAL(_get_PIR) - mfspr r3,PIR - blr - -_GLOBAL(_get_HID0) - mfspr r3,HID0 - blr _GLOBAL(cvt_fd) lfd 0,0(r5) /* load up fpscr value */ @@ -561,6 +591,69 @@ isync b 1b +#ifdef CONFIG_PPC_PMAC +/* + * Do an IO access in real mode + */ +_GLOBAL(real_readb) + mfmsr r7 + ori r0,r7,MSR_DR + xori r0,r0,MSR_DR + sync + mtmsrd r0 + sync + isync + mfspr r6,SPRN_HID4 + rldicl r5,r6,32,0 + ori r5,r5,0x100 + rldicl r5,r5,32,0 + sync + mtspr SPRN_HID4,r5 + isync + slbia + isync + lbz r3,0(r3) + sync + mtspr SPRN_HID4,r6 + isync + slbia + isync + mtmsrd r7 + sync + isync + blr + + /* + * Do an IO access in real mode + */ +_GLOBAL(real_writeb) + mfmsr r7 + ori r0,r7,MSR_DR + xori r0,r0,MSR_DR + sync + mtmsrd r0 + sync + isync + mfspr r6,SPRN_HID4 + rldicl r5,r6,32,0 + ori r5,r5,0x100 + rldicl r5,r5,32,0 + sync + mtspr SPRN_HID4,r5 + isync + slbia + isync + stb r3,0(r4) + sync + mtspr SPRN_HID4,r6 + isync + slbia + isync + mtmsrd r7 + sync + isync + blr +#endif /* CONFIG_PPC_PMAC */ /* * Create a kernel thread @@ -594,7 +687,7 @@ ld r30,-16(r1) blr -#ifdef CONFIG_PPC_ISERIES /* hack hack hack */ +#ifndef CONFIG_PPC_PSERIE /* hack hack hack */ #define ppc_rtas sys_ni_syscall #endif @@ -860,9 +953,9 @@ .llong .sys_ni_syscall /* 256 reserved for sys_debug_setcontext */ .llong .sys_ni_syscall /* 257 reserved for vserver */ .llong .sys_ni_syscall /* 258 reserved for new sys_remap_file_pages */ - .llong .sys_ni_syscall /* 259 reserved for new sys_mbind */ - .llong .sys_ni_syscall /* 260 reserved for new sys_get_mempolicy */ - .llong .sys_ni_syscall /* 261 reserved for new sys_set_mempolicy */ + .llong .compat_mbind + .llong .compat_get_mempolicy /* 260 */ + .llong .compat_set_mempolicy .llong .compat_sys_mq_open .llong .sys_mq_unlink .llong .compat_sys_mq_timedsend @@ -1132,9 +1225,9 @@ .llong .sys_ni_syscall /* 256 reserved for sys_debug_setcontext */ .llong .sys_ni_syscall /* 257 reserved for vserver */ .llong .sys_ni_syscall /* 258 reserved for new sys_remap_file_pages */ - .llong .sys_ni_syscall /* 259 reserved for new sys_mbind */ - .llong .sys_ni_syscall /* 260 reserved for new sys_get_mempolicy */ - .llong .sys_ni_syscall /* 261 reserved for new sys_set_mempolicy */ + .llong .sys_mbind + .llong .sys_get_mempolicy /* 260 */ + .llong .sys_set_mempolicy .llong .sys_mq_open .llong .sys_mq_unlink .llong .sys_mq_timedsend diff -Nru a/arch/ppc64/kernel/nvram.c b/arch/ppc64/kernel/nvram.c --- a/arch/ppc64/kernel/nvram.c 2004-09-26 10:25:55 -07:00 +++ b/arch/ppc64/kernel/nvram.c 2004-09-26 10:25:55 -07:00 @@ -340,7 +340,7 @@ struct list_head * p; struct nvram_partition * part; struct nvram_partition * new_part = NULL; - struct nvram_partition * free_part; + struct nvram_partition * free_part = NULL; int seq_init[2] = { 0, 0 }; loff_t tmp_index; long size = 0; @@ -603,6 +603,7 @@ } +#ifdef CONFIG_PPC_PSERIES /* nvram_write_error_log * @@ -727,6 +728,7 @@ return 0; } +#endif /* CONFIG_PPC_PSERIES */ module_init(nvram_init); module_exit(nvram_cleanup); diff -Nru a/arch/ppc64/kernel/open_pic.c b/arch/ppc64/kernel/open_pic.c --- a/arch/ppc64/kernel/open_pic.c 2004-09-26 10:25:56 -07:00 +++ b/arch/ppc64/kernel/open_pic.c 2004-09-26 10:25:56 -07:00 @@ -362,7 +362,6 @@ find_ISUs(); /* Initialize timer interrupts */ - ppc64_boot_msg(0x21, "OpenPic Timer"); for (i = 0; i < OPENPIC_NUM_TIMERS; i++) { /* Disabled, Priority 0 */ openpic_inittimer(i, 0, openpic_vec_timer+i); @@ -372,7 +371,6 @@ #ifdef CONFIG_SMP /* Initialize IPI interrupts */ - ppc64_boot_msg(0x22, "OpenPic IPI"); openpic_test_broken_IPI(); for (i = 0; i < OPENPIC_NUM_IPI; i++) { /* Disabled, Priority 10..13 */ @@ -384,8 +382,6 @@ #endif /* Initialize external interrupts */ - ppc64_boot_msg(0x23, "OpenPic Ext"); - openpic_set_priority(0xf); /* SIOint (8259 cascade) is special */ @@ -420,7 +416,6 @@ irq_desc[i].handler = &open_pic; /* Initialize the spurious interrupt */ - ppc64_boot_msg(0x24, "OpenPic Spurious"); openpic_set_spurious(openpic_vec_spurious); openpic_set_priority(0); diff -Nru a/arch/ppc64/kernel/open_pic_u3.c b/arch/ppc64/kernel/open_pic_u3.c --- a/arch/ppc64/kernel/open_pic_u3.c 2004-09-26 10:25:55 -07:00 +++ b/arch/ppc64/kernel/open_pic_u3.c 2004-09-26 10:25:55 -07:00 @@ -344,5 +344,5 @@ openpic2_set_priority(0); openpic2_disable_8259_pass_through(); - ppc64_boot_msg(0x25, "OpenPic2 Done"); + ppc64_boot_msg(0x25, "OpenPic U3 Done"); } diff -Nru a/arch/ppc64/kernel/pSeries_htab.c b/arch/ppc64/kernel/pSeries_htab.c --- a/arch/ppc64/kernel/pSeries_htab.c 2004-09-26 10:25:56 -07:00 +++ /dev/null Wed Dec 31 16:00:00 196900 @@ -1,408 +0,0 @@ -/* - * pSeries hashtable management. - * - * SMP scalability work: - * Copyright (C) 2001 Anton Blanchard , IBM - * - * 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 -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#define HPTE_LOCK_BIT 3 - -static inline void pSeries_lock_hpte(HPTE *hptep) -{ - unsigned long *word = &hptep->dw0.dword0; - - while (1) { - if (!test_and_set_bit(HPTE_LOCK_BIT, word)) - break; - while(test_bit(HPTE_LOCK_BIT, word)) - cpu_relax(); - } -} - -static inline void pSeries_unlock_hpte(HPTE *hptep) -{ - unsigned long *word = &hptep->dw0.dword0; - - asm volatile("lwsync":::"memory"); - clear_bit(HPTE_LOCK_BIT, word); -} - -static spinlock_t pSeries_tlbie_lock = SPIN_LOCK_UNLOCKED; - -long pSeries_hpte_insert(unsigned long hpte_group, unsigned long va, - unsigned long prpn, int secondary, - unsigned long hpteflags, int bolted, int large) -{ - unsigned long arpn = physRpn_to_absRpn(prpn); - HPTE *hptep = htab_data.htab + hpte_group; - Hpte_dword0 dw0; - HPTE lhpte; - int i; - - for (i = 0; i < HPTES_PER_GROUP; i++) { - dw0 = hptep->dw0.dw0; - - if (!dw0.v) { - /* retry with lock held */ - pSeries_lock_hpte(hptep); - dw0 = hptep->dw0.dw0; - if (!dw0.v) - break; - pSeries_unlock_hpte(hptep); - } - - hptep++; - } - - if (i == HPTES_PER_GROUP) - return -1; - - lhpte.dw1.dword1 = 0; - lhpte.dw1.dw1.rpn = arpn; - lhpte.dw1.flags.flags = hpteflags; - - lhpte.dw0.dword0 = 0; - lhpte.dw0.dw0.avpn = va >> 23; - lhpte.dw0.dw0.h = secondary; - lhpte.dw0.dw0.bolted = bolted; - lhpte.dw0.dw0.v = 1; - - if (large) { - lhpte.dw0.dw0.l = 1; - lhpte.dw0.dw0.avpn &= ~0x1UL; - } - - hptep->dw1.dword1 = lhpte.dw1.dword1; - - /* Guarantee the second dword is visible before the valid bit */ - __asm__ __volatile__ ("eieio" : : : "memory"); - - /* - * Now set the first dword including the valid bit - * NOTE: this also unlocks the hpte - */ - hptep->dw0.dword0 = lhpte.dw0.dword0; - - __asm__ __volatile__ ("ptesync" : : : "memory"); - - return i | (secondary << 3); -} - -static long pSeries_hpte_remove(unsigned long hpte_group) -{ - HPTE *hptep; - Hpte_dword0 dw0; - int i; - int slot_offset; - - /* pick a random entry to start at */ - slot_offset = mftb() & 0x7; - - for (i = 0; i < HPTES_PER_GROUP; i++) { - hptep = htab_data.htab + hpte_group + slot_offset; - dw0 = hptep->dw0.dw0; - - if (dw0.v && !dw0.bolted) { - /* retry with lock held */ - pSeries_lock_hpte(hptep); - dw0 = hptep->dw0.dw0; - if (dw0.v && !dw0.bolted) - break; - pSeries_unlock_hpte(hptep); - } - - slot_offset++; - slot_offset &= 0x7; - } - - if (i == HPTES_PER_GROUP) - return -1; - - /* Invalidate the hpte. NOTE: this also unlocks it */ - hptep->dw0.dword0 = 0; - - return i; -} - -static inline void set_pp_bit(unsigned long pp, HPTE *addr) -{ - unsigned long old; - unsigned long *p = &addr->dw1.dword1; - - __asm__ __volatile__( - "1: ldarx %0,0,%3\n\ - rldimi %0,%2,0,61\n\ - stdcx. %0,0,%3\n\ - bne 1b" - : "=&r" (old), "=m" (*p) - : "r" (pp), "r" (p), "m" (*p) - : "cc"); -} - -/* - * Only works on small pages. Yes its ugly to have to check each slot in - * the group but we only use this during bootup. - */ -static long pSeries_hpte_find(unsigned long vpn) -{ - HPTE *hptep; - unsigned long hash; - unsigned long i, j; - long slot; - Hpte_dword0 dw0; - - hash = hpt_hash(vpn, 0); - - for (j = 0; j < 2; j++) { - slot = (hash & htab_data.htab_hash_mask) * HPTES_PER_GROUP; - for (i = 0; i < HPTES_PER_GROUP; i++) { - hptep = htab_data.htab + slot; - dw0 = hptep->dw0.dw0; - - if ((dw0.avpn == (vpn >> 11)) && dw0.v && - (dw0.h == j)) { - /* HPTE matches */ - if (j) - slot = -slot; - return slot; - } - ++slot; - } - hash = ~hash; - } - - return -1; -} - -static long pSeries_hpte_updatepp(unsigned long slot, unsigned long newpp, - unsigned long va, int large, int local) -{ - HPTE *hptep = htab_data.htab + slot; - Hpte_dword0 dw0; - unsigned long avpn = va >> 23; - int ret = 0; - - if (large) - avpn &= ~0x1UL; - - pSeries_lock_hpte(hptep); - - dw0 = hptep->dw0.dw0; - - /* Even if we miss, we need to invalidate the TLB */ - if ((dw0.avpn != avpn) || !dw0.v) { - pSeries_unlock_hpte(hptep); - ret = -1; - } else { - set_pp_bit(newpp, hptep); - pSeries_unlock_hpte(hptep); - } - - /* Ensure it is out of the tlb too */ - if ((cur_cpu_spec->cpu_features & CPU_FTR_TLBIEL) && !large && local) { - tlbiel(va); - } else { - if (!(cur_cpu_spec->cpu_features & CPU_FTR_LOCKLESS_TLBIE)) - spin_lock(&pSeries_tlbie_lock); - tlbie(va, large); - if (!(cur_cpu_spec->cpu_features & CPU_FTR_LOCKLESS_TLBIE)) - spin_unlock(&pSeries_tlbie_lock); - } - - return ret; -} - -/* - * Update the page protection bits. Intended to be used to create - * guard pages for kernel data structures on pages which are bolted - * in the HPT. Assumes pages being operated on will not be stolen. - * Does not work on large pages. - * - * No need to lock here because we should be the only user. - */ -static void pSeries_hpte_updateboltedpp(unsigned long newpp, unsigned long ea) -{ - unsigned long vsid, va, vpn, flags; - long slot; - HPTE *hptep; - - vsid = get_kernel_vsid(ea); - va = (vsid << 28) | (ea & 0x0fffffff); - vpn = va >> PAGE_SHIFT; - - slot = pSeries_hpte_find(vpn); - if (slot == -1) - panic("could not find page to bolt\n"); - hptep = htab_data.htab + slot; - - set_pp_bit(newpp, hptep); - - /* Ensure it is out of the tlb too */ - if (!(cur_cpu_spec->cpu_features & CPU_FTR_LOCKLESS_TLBIE)) - spin_lock_irqsave(&pSeries_tlbie_lock, flags); - tlbie(va, 0); - if (!(cur_cpu_spec->cpu_features & CPU_FTR_LOCKLESS_TLBIE)) - spin_unlock_irqrestore(&pSeries_tlbie_lock, flags); -} - -static void pSeries_hpte_invalidate(unsigned long slot, unsigned long va, - int large, int local) -{ - HPTE *hptep = htab_data.htab + slot; - Hpte_dword0 dw0; - unsigned long avpn = va >> 23; - unsigned long flags; - - if (large) - avpn &= ~0x1UL; - - local_irq_save(flags); - pSeries_lock_hpte(hptep); - - dw0 = hptep->dw0.dw0; - - /* Even if we miss, we need to invalidate the TLB */ - if ((dw0.avpn != avpn) || !dw0.v) { - pSeries_unlock_hpte(hptep); - } else { - /* Invalidate the hpte. NOTE: this also unlocks it */ - hptep->dw0.dword0 = 0; - } - - /* Invalidate the tlb */ - if ((cur_cpu_spec->cpu_features & CPU_FTR_TLBIEL) && !large && local) { - tlbiel(va); - } else { - if (!(cur_cpu_spec->cpu_features & CPU_FTR_LOCKLESS_TLBIE)) - spin_lock(&pSeries_tlbie_lock); - tlbie(va, large); - if (!(cur_cpu_spec->cpu_features & CPU_FTR_LOCKLESS_TLBIE)) - spin_unlock(&pSeries_tlbie_lock); - } - local_irq_restore(flags); -} - -static void pSeries_flush_hash_range(unsigned long context, - unsigned long number, int local) -{ - unsigned long vsid, vpn, va, hash, secondary, slot, flags, avpn; - int i, j; - HPTE *hptep; - Hpte_dword0 dw0; - struct ppc64_tlb_batch *batch = &__get_cpu_var(ppc64_tlb_batch); - - /* XXX fix for large ptes */ - unsigned long large = 0; - - local_irq_save(flags); - - j = 0; - for (i = 0; i < number; i++) { - if ((batch->addr[i] >= USER_START) && - (batch->addr[i] <= USER_END)) - vsid = get_vsid(context, batch->addr[i]); - else - vsid = get_kernel_vsid(batch->addr[i]); - - va = (vsid << 28) | (batch->addr[i] & 0x0fffffff); - batch->vaddr[j] = va; - if (large) - vpn = va >> LARGE_PAGE_SHIFT; - else - vpn = va >> PAGE_SHIFT; - hash = hpt_hash(vpn, large); - secondary = (pte_val(batch->pte[i]) & _PAGE_SECONDARY) >> 15; - if (secondary) - hash = ~hash; - slot = (hash & htab_data.htab_hash_mask) * HPTES_PER_GROUP; - slot += (pte_val(batch->pte[i]) & _PAGE_GROUP_IX) >> 12; - - hptep = htab_data.htab + slot; - - avpn = va >> 23; - if (large) - avpn &= ~0x1UL; - - pSeries_lock_hpte(hptep); - - dw0 = hptep->dw0.dw0; - - /* Even if we miss, we need to invalidate the TLB */ - if ((dw0.avpn != avpn) || !dw0.v) { - pSeries_unlock_hpte(hptep); - } else { - /* Invalidate the hpte. NOTE: this also unlocks it */ - hptep->dw0.dword0 = 0; - } - - j++; - } - - if ((cur_cpu_spec->cpu_features & CPU_FTR_TLBIEL) && !large && local) { - asm volatile("ptesync":::"memory"); - - for (i = 0; i < j; i++) - __tlbiel(batch->vaddr[i]); - - asm volatile("ptesync":::"memory"); - } else { - /* XXX double check that it is safe to take this late */ - if (!(cur_cpu_spec->cpu_features & CPU_FTR_LOCKLESS_TLBIE)) - spin_lock(&pSeries_tlbie_lock); - - asm volatile("ptesync":::"memory"); - - for (i = 0; i < j; i++) - __tlbie(batch->vaddr[i], 0); - - asm volatile("eieio; tlbsync; ptesync":::"memory"); - - if (!(cur_cpu_spec->cpu_features & CPU_FTR_LOCKLESS_TLBIE)) - spin_unlock(&pSeries_tlbie_lock); - } - - local_irq_restore(flags); -} - -void hpte_init_pSeries(void) -{ - struct device_node *root; - const char *model; - - ppc_md.hpte_invalidate = pSeries_hpte_invalidate; - ppc_md.hpte_updatepp = pSeries_hpte_updatepp; - ppc_md.hpte_updateboltedpp = pSeries_hpte_updateboltedpp; - ppc_md.hpte_insert = pSeries_hpte_insert; - ppc_md.hpte_remove = pSeries_hpte_remove; - - /* Disable TLB batching on nighthawk */ - root = of_find_node_by_path("/"); - if (root) { - model = get_property(root, "model", NULL); - if (!strcmp(model, "CHRP IBM,9076-N81")) { - of_node_put(root); - return; - } - of_node_put(root); - } - - ppc_md.flush_hash_range = pSeries_flush_hash_range; -} diff -Nru a/arch/ppc64/kernel/pSeries_iommu.c b/arch/ppc64/kernel/pSeries_iommu.c --- a/arch/ppc64/kernel/pSeries_iommu.c 2004-09-26 10:25:55 -07:00 +++ b/arch/ppc64/kernel/pSeries_iommu.c 2004-09-26 10:25:55 -07:00 @@ -42,6 +42,7 @@ #include #include #include +#include #include "pci.h" @@ -88,6 +89,150 @@ } +static void tce_build_pSeriesLP(struct iommu_table *tbl, long tcenum, + long npages, unsigned long uaddr, + enum dma_data_direction direction) +{ + u64 rc; + union tce_entry tce; + + tce.te_word = 0; + tce.te_rpn = (virt_to_abs(uaddr)) >> PAGE_SHIFT; + tce.te_rdwr = 1; + if (direction != DMA_TO_DEVICE) + tce.te_pciwr = 1; + + while (npages--) { + rc = plpar_tce_put((u64)tbl->it_index, + (u64)tcenum << 12, + tce.te_word ); + + if (rc && printk_ratelimit()) { + printk("tce_build_pSeriesLP: plpar_tce_put failed. rc=%ld\n", rc); + printk("\tindex = 0x%lx\n", (u64)tbl->it_index); + printk("\ttcenum = 0x%lx\n", (u64)tcenum); + printk("\ttce val = 0x%lx\n", tce.te_word ); + show_stack(current, (unsigned long *)__get_SP()); + } + + tcenum++; + tce.te_rpn++; + } +} + +DEFINE_PER_CPU(void *, tce_page) = NULL; + +static void tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum, + long npages, unsigned long uaddr, + enum dma_data_direction direction) +{ + u64 rc; + union tce_entry tce, *tcep; + long l, limit; + + if (npages == 1) + return tce_build_pSeriesLP(tbl, tcenum, npages, uaddr, + direction); + + tcep = __get_cpu_var(tce_page); + + /* This is safe to do since interrupts are off when we're called + * from iommu_alloc{,_sg}() + */ + if (!tcep) { + tcep = (void *)__get_free_page(GFP_ATOMIC); + /* If allocation fails, fall back to the loop implementation */ + if (!tcep) + return tce_build_pSeriesLP(tbl, tcenum, npages, + uaddr, direction); + __get_cpu_var(tce_page) = tcep; + } + + tce.te_word = 0; + tce.te_rpn = (virt_to_abs(uaddr)) >> PAGE_SHIFT; + tce.te_rdwr = 1; + if (direction != DMA_TO_DEVICE) + tce.te_pciwr = 1; + + /* We can map max one pageful of TCEs at a time */ + do { + /* + * Set up the page with TCE data, looping through and setting + * the values. + */ + limit = min_t(long, npages, PAGE_SIZE/sizeof(union tce_entry)); + + for (l = 0; l < limit; l++) { + tcep[l] = tce; + tce.te_rpn++; + } + + rc = plpar_tce_put_indirect((u64)tbl->it_index, + (u64)tcenum << 12, + (u64)virt_to_abs(tcep), + limit); + + npages -= limit; + tcenum += limit; + } while (npages > 0 && !rc); + + if (rc && printk_ratelimit()) { + printk("tce_buildmulti_pSeriesLP: plpar_tce_put failed. rc=%ld\n", rc); + printk("\tindex = 0x%lx\n", (u64)tbl->it_index); + printk("\tnpages = 0x%lx\n", (u64)npages); + printk("\ttce[0] val = 0x%lx\n", tcep[0].te_word); + show_stack(current, (unsigned long *)__get_SP()); + } +} + +static void tce_free_pSeriesLP(struct iommu_table *tbl, long tcenum, long npages) +{ + u64 rc; + union tce_entry tce; + + tce.te_word = 0; + + while (npages--) { + rc = plpar_tce_put((u64)tbl->it_index, + (u64)tcenum << 12, + tce.te_word); + + if (rc && printk_ratelimit()) { + printk("tce_free_pSeriesLP: plpar_tce_put failed. rc=%ld\n", rc); + printk("\tindex = 0x%lx\n", (u64)tbl->it_index); + printk("\ttcenum = 0x%lx\n", (u64)tcenum); + printk("\ttce val = 0x%lx\n", tce.te_word ); + show_stack(current, (unsigned long *)__get_SP()); + } + + tcenum++; + } +} + + +static void tce_freemulti_pSeriesLP(struct iommu_table *tbl, long tcenum, long npages) +{ + u64 rc; + union tce_entry tce; + + tce.te_word = 0; + + rc = plpar_tce_stuff((u64)tbl->it_index, + (u64)tcenum << 12, + tce.te_word, + npages); + + if (rc && printk_ratelimit()) { + printk("tce_freemulti_pSeriesLP: plpar_tce_stuff failed\n"); + printk("\trc = %ld\n", rc); + printk("\tindex = 0x%lx\n", (u64)tbl->it_index); + printk("\tnpages = 0x%lx\n", (u64)npages); + printk("\ttce val = 0x%lx\n", tce.te_word ); + show_stack(current, (unsigned long *)__get_SP()); + } +} + + static void iommu_buses_init(void) { struct pci_controller *phb, *tmp; @@ -166,24 +311,25 @@ struct device_node *dn, struct iommu_table *tbl) { - phandle node; - unsigned long i; - struct of_tce_table *oft; - - node = ((struct device_node *)(phb->arch_data))->node; - - oft = NULL; - - for (i=0; of_tce_table[i].node; i++) - if(of_tce_table[i].node == node) { - oft = &of_tce_table[i]; - break; - } - - if (!oft) - panic("PCI_DMA: iommu_table_setparms: Can't find phb named '%s' in of_tce_table\n", dn->full_name); - - memset((void *)oft->base, 0, oft->size); + struct device_node *node; + unsigned long *basep; + unsigned int *sizep; + + node = (struct device_node *)phb->arch_data; + + if (get_property(node, "linux,has-tce-table", NULL) == NULL) { + printk(KERN_ERR "PCI_DMA: iommu_table_setparms: %s has no tce table !\n", + dn->full_name); + return; + } + basep = (unsigned long *)get_property(node, "linux,tce-base", NULL); + sizep = (unsigned int *)get_property(node, "linux,tce-size", NULL); + if (basep == NULL || sizep == NULL) { + printk(KERN_ERR "PCI_DMA: iommu_table_setparms: %s has missing tce" + " entries !\n", dn->full_name); + return; + } + memset((void *)(*basep), 0, *sizep); tbl->it_busno = phb->bus->number; @@ -207,7 +353,7 @@ if (phb->dma_window_base_cur > (1 << 19)) panic("PCI_DMA: Unexpected number of IOAs under this PHB.\n"); - tbl->it_base = oft->base; + tbl->it_base = *basep; tbl->it_index = 0; tbl->it_entrysize = sizeof(union tce_entry); tbl->it_blocksize = 16; @@ -295,8 +441,16 @@ /* These are called very early. */ void tce_init_pSeries(void) { - ppc_md.tce_build = tce_build_pSeries; - ppc_md.tce_free = tce_free_pSeries; + if (!(systemcfg->platform & PLATFORM_LPAR)) { + ppc_md.tce_build = tce_build_pSeries; + ppc_md.tce_free = tce_free_pSeries; + } else if (cur_cpu_spec->firmware_features & FW_FEATURE_MULTITCE) { + ppc_md.tce_build = tce_buildmulti_pSeriesLP; + ppc_md.tce_free = tce_freemulti_pSeriesLP; + } else { + ppc_md.tce_build = tce_build_pSeriesLP; + ppc_md.tce_free = tce_free_pSeriesLP; + } pci_iommu_init(); } diff -Nru a/arch/ppc64/kernel/pSeries_lpar.c b/arch/ppc64/kernel/pSeries_lpar.c --- a/arch/ppc64/kernel/pSeries_lpar.c 2004-09-26 10:25:57 -07:00 +++ b/arch/ppc64/kernel/pSeries_lpar.c 2004-09-26 10:25:57 -07:00 @@ -19,6 +19,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#define DEBUG + #include #include #include @@ -34,10 +36,16 @@ #include #include #include -#include #include #include #include +#include + +#ifdef DEBUG +#define DBG(fmt...) udbg_printf(fmt) +#else +#define DBG(fmt...) +#endif /* in pSeries_hvCall.S */ EXPORT_SYMBOL(plpar_hcall); @@ -45,249 +53,9 @@ EXPORT_SYMBOL(plpar_hcall_norets); EXPORT_SYMBOL(plpar_hcall_8arg_2ret); -long poll_pending(void) -{ - unsigned long dummy; - return plpar_hcall(H_POLL_PENDING, 0, 0, 0, 0, - &dummy, &dummy, &dummy); -} - -long prod_processor(void) -{ - plpar_hcall_norets(H_PROD); - return(0); -} - -long cede_processor(void) -{ - plpar_hcall_norets(H_CEDE); - return(0); -} +extern void fw_feature_init(void); +extern void pSeries_find_serial_port(void); -long register_vpa(unsigned long flags, unsigned long proc, unsigned long vpa) -{ - plpar_hcall_norets(H_REGISTER_VPA, flags, proc, vpa); - return(0); -} - -long plpar_pte_remove(unsigned long flags, - unsigned long ptex, - unsigned long avpn, - unsigned long *old_pteh_ret, unsigned long *old_ptel_ret) -{ - unsigned long dummy; - return plpar_hcall(H_REMOVE, flags, ptex, avpn, 0, - old_pteh_ret, old_ptel_ret, &dummy); -} - -long plpar_pte_read(unsigned long flags, - unsigned long ptex, - unsigned long *old_pteh_ret, unsigned long *old_ptel_ret) -{ - unsigned long dummy; - return plpar_hcall(H_READ, flags, ptex, 0, 0, - old_pteh_ret, old_ptel_ret, &dummy); -} - -long plpar_pte_protect(unsigned long flags, - unsigned long ptex, - unsigned long avpn) -{ - return plpar_hcall_norets(H_PROTECT, flags, ptex, avpn); -} - -long plpar_tce_get(unsigned long liobn, - unsigned long ioba, - unsigned long *tce_ret) -{ - unsigned long dummy; - return plpar_hcall(H_GET_TCE, liobn, ioba, 0, 0, - tce_ret, &dummy, &dummy); -} - -long plpar_tce_put(unsigned long liobn, - unsigned long ioba, - unsigned long tceval) -{ - return plpar_hcall_norets(H_PUT_TCE, liobn, ioba, tceval); -} - -long plpar_tce_put_indirect(unsigned long liobn, - unsigned long ioba, - unsigned long page, - unsigned long count) -{ - return plpar_hcall_norets(H_PUT_TCE_INDIRECT, liobn, ioba, page, count); -} - -long plpar_tce_stuff(unsigned long liobn, - unsigned long ioba, - unsigned long tceval, - unsigned long count) -{ - return plpar_hcall_norets(H_STUFF_TCE, liobn, ioba, tceval, count); -} - -long plpar_get_term_char(unsigned long termno, - unsigned long *len_ret, - char *buf_ret) -{ - unsigned long *lbuf = (unsigned long *)buf_ret; /* ToDo: alignment? */ - return plpar_hcall(H_GET_TERM_CHAR, termno, 0, 0, 0, - len_ret, lbuf+0, lbuf+1); -} - -long plpar_put_term_char(unsigned long termno, - unsigned long len, - const char *buffer) -{ - unsigned long *lbuf = (unsigned long *)buffer; /* ToDo: alignment? */ - return plpar_hcall_norets(H_PUT_TERM_CHAR, termno, len, lbuf[0], - lbuf[1]); -} - -static void tce_build_pSeriesLP(struct iommu_table *tbl, long tcenum, - long npages, unsigned long uaddr, - enum dma_data_direction direction) -{ - u64 rc; - union tce_entry tce; - - tce.te_word = 0; - tce.te_rpn = (virt_to_abs(uaddr)) >> PAGE_SHIFT; - tce.te_rdwr = 1; - if (direction != DMA_TO_DEVICE) - tce.te_pciwr = 1; - - while (npages--) { - rc = plpar_tce_put((u64)tbl->it_index, - (u64)tcenum << 12, - tce.te_word ); - - if (rc && printk_ratelimit()) { - printk("tce_build_pSeriesLP: plpar_tce_put failed. rc=%ld\n", rc); - printk("\tindex = 0x%lx\n", (u64)tbl->it_index); - printk("\ttcenum = 0x%lx\n", (u64)tcenum); - printk("\ttce val = 0x%lx\n", tce.te_word ); - show_stack(current, (unsigned long *)__get_SP()); - } - - tcenum++; - tce.te_rpn++; - } -} - -DEFINE_PER_CPU(void *, tce_page) = NULL; - -static void tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum, - long npages, unsigned long uaddr, - enum dma_data_direction direction) -{ - u64 rc; - union tce_entry tce, *tcep; - long l, limit; - - if (npages == 1) - return tce_build_pSeriesLP(tbl, tcenum, npages, uaddr, - direction); - - tcep = __get_cpu_var(tce_page); - - /* This is safe to do since interrupts are off when we're called - * from iommu_alloc{,_sg}() - */ - if (!tcep) { - tcep = (void *)__get_free_page(GFP_ATOMIC); - /* If allocation fails, fall back to the loop implementation */ - if (!tcep) - return tce_build_pSeriesLP(tbl, tcenum, npages, - uaddr, direction); - __get_cpu_var(tce_page) = tcep; - } - - tce.te_word = 0; - tce.te_rpn = (virt_to_abs(uaddr)) >> PAGE_SHIFT; - tce.te_rdwr = 1; - if (direction != DMA_TO_DEVICE) - tce.te_pciwr = 1; - - /* We can map max one pageful of TCEs at a time */ - do { - /* - * Set up the page with TCE data, looping through and setting - * the values. - */ - limit = min_t(long, npages, PAGE_SIZE/sizeof(union tce_entry)); - - for (l = 0; l < limit; l++) { - tcep[l] = tce; - tce.te_rpn++; - } - - rc = plpar_tce_put_indirect((u64)tbl->it_index, - (u64)tcenum << 12, - (u64)virt_to_abs(tcep), - limit); - - npages -= limit; - tcenum += limit; - } while (npages > 0 && !rc); - - if (rc && printk_ratelimit()) { - printk("tce_buildmulti_pSeriesLP: plpar_tce_put failed. rc=%ld\n", rc); - printk("\tindex = 0x%lx\n", (u64)tbl->it_index); - printk("\tnpages = 0x%lx\n", (u64)npages); - printk("\ttce[0] val = 0x%lx\n", tcep[0].te_word); - show_stack(current, (unsigned long *)__get_SP()); - } -} - -static void tce_free_pSeriesLP(struct iommu_table *tbl, long tcenum, long npages) -{ - u64 rc; - union tce_entry tce; - - tce.te_word = 0; - - while (npages--) { - rc = plpar_tce_put((u64)tbl->it_index, - (u64)tcenum << 12, - tce.te_word); - - if (rc && printk_ratelimit()) { - printk("tce_free_pSeriesLP: plpar_tce_put failed. rc=%ld\n", rc); - printk("\tindex = 0x%lx\n", (u64)tbl->it_index); - printk("\ttcenum = 0x%lx\n", (u64)tcenum); - printk("\ttce val = 0x%lx\n", tce.te_word ); - show_stack(current, (unsigned long *)__get_SP()); - } - - tcenum++; - } -} - - -static void tce_freemulti_pSeriesLP(struct iommu_table *tbl, long tcenum, long npages) -{ - u64 rc; - union tce_entry tce; - - tce.te_word = 0; - - rc = plpar_tce_stuff((u64)tbl->it_index, - (u64)tcenum << 12, - tce.te_word, - npages); - - if (rc && printk_ratelimit()) { - printk("tce_freemulti_pSeriesLP: plpar_tce_stuff failed\n"); - printk("\trc = %ld\n", rc); - printk("\tindex = 0x%lx\n", (u64)tbl->it_index); - printk("\tnpages = 0x%lx\n", (u64)npages); - printk("\ttce val = 0x%lx\n", tce.te_word ); - show_stack(current, (unsigned long *)__get_SP()); - } -} int vtermno; /* virtual terminal# for udbg */ @@ -352,24 +120,35 @@ } } +/* call this from early_init() for a working debug console on + * vterm capable LPAR machines + */ +void udbg_init_debug_lpar(void) +{ + vtermno = 0; + ppc_md.udbg_putc = udbg_putcLP; + ppc_md.udbg_getc = udbg_getcLP; + ppc_md.udbg_getc_poll = udbg_getc_pollLP; +} + /* returns 0 if couldn't find or use /chosen/stdout as console */ -static int find_udbg_vterm(void) +int find_udbg_vterm(void) { struct device_node *stdout_node; + phandle *stdout_ph; u32 *termno; char *name; int found = 0; /* find the boot console from /chosen/stdout */ - if (!of_stdout_device) { - printk(KERN_WARNING "couldn't get path from /chosen/stdout!\n"); - return found; - } - stdout_node = of_find_node_by_path(of_stdout_device); - if (!stdout_node) { - printk(KERN_WARNING "couldn't find node from /chosen/stdout\n"); - return found; - } + if (!of_chosen) + return 0; + stdout_ph = (phandle *)get_property(of_chosen, "linux,stdout-package", NULL); + if (stdout_ph == NULL) + return 0; + stdout_node = of_find_node_by_phandle(*stdout_ph); + if (!stdout_node) + return 0; /* now we have the stdout node; figure out what type of device it is. */ name = (char *)get_property(stdout_node, "name", NULL); @@ -391,15 +170,17 @@ } else { /* XXX implement udbg_putcLP_vtty for hvterm-protocol1 case */ printk(KERN_WARNING "%s doesn't speak hvterm1; " - "can't print udbg messages\n", of_stdout_device); + "can't print udbg messages\n", + stdout_node->full_name); } } else if (strncmp(name, "serial", 6)) { /* XXX fix ISA serial console */ printk(KERN_WARNING "serial stdout on LPAR ('%s')! " - "can't print udbg messages\n", of_stdout_device); + "can't print udbg messages\n", + stdout_node->full_name); } else { printk(KERN_WARNING "don't know how to print to stdout '%s'\n", - of_stdout_device); + stdout_node->full_name); } out: @@ -407,40 +188,6 @@ return found; } -void pSeries_lpar_mm_init(void); - -/* This is called early in setup.c. - * Use it to setup page table ppc_md stuff as well as udbg. - */ -void pSeriesLP_init_early(void) -{ - pSeries_lpar_mm_init(); - - tce_init_pSeries(); - - if (cur_cpu_spec->firmware_features & FW_FEATURE_MULTITCE) { - ppc_md.tce_build = tce_buildmulti_pSeriesLP; - ppc_md.tce_free = tce_freemulti_pSeriesLP; - } else { - ppc_md.tce_build = tce_build_pSeriesLP; - ppc_md.tce_free = tce_free_pSeriesLP; - } - - pci_iommu_init(); - -#ifdef CONFIG_SMP - smp_init_pSeries(); -#endif - - /* The keyboard is not useful in the LPAR environment. - * Leave all the ppc_md keyboard interfaces NULL. - */ - - if (0 == find_udbg_vterm()) { - printk(KERN_WARNING - "can't use stdout; can't print early debug messages.\n"); - } -} long pSeries_lpar_hpte_insert(unsigned long hpte_group, unsigned long va, unsigned long prpn, @@ -532,6 +279,18 @@ return -1; } +static void pSeries_lpar_hptab_clear(void) +{ + unsigned long size_bytes = 1UL << naca->pftSize; + unsigned long hpte_count = size_bytes >> 4; + unsigned long dummy1, dummy2; + int i; + + /* TODO: Use bulk call */ + for (i = 0; i < hpte_count; i++) + plpar_pte_remove(0, i, 0, &dummy1, &dummy2); +} + /* * NOTE: for updatepp ops we are fortunate that the linux "newpp" bits and * the low 3 bits of flags happen to line up. So no transform is needed. @@ -660,18 +419,19 @@ int i; unsigned long flags; struct ppc64_tlb_batch *batch = &__get_cpu_var(ppc64_tlb_batch); + int lock_tlbie = !(cur_cpu_spec->cpu_features & CPU_FTR_LOCKLESS_TLBIE); - if (!(cur_cpu_spec->cpu_features & CPU_FTR_LOCKLESS_TLBIE)) + if (lock_tlbie) spin_lock_irqsave(&pSeries_lpar_tlbie_lock, flags); for (i = 0; i < number; i++) flush_hash_page(context, batch->addr[i], batch->pte[i], local); - if (!(cur_cpu_spec->cpu_features & CPU_FTR_LOCKLESS_TLBIE)) + if (lock_tlbie) spin_unlock_irqrestore(&pSeries_lpar_tlbie_lock, flags); } -void pSeries_lpar_mm_init(void) +void hpte_init_lpar(void) { ppc_md.hpte_invalidate = pSeries_lpar_hpte_invalidate; ppc_md.hpte_updatepp = pSeries_lpar_hpte_updatepp; @@ -679,4 +439,7 @@ ppc_md.hpte_insert = pSeries_lpar_hpte_insert; ppc_md.hpte_remove = pSeries_lpar_hpte_remove; ppc_md.flush_hash_range = pSeries_lpar_flush_hash_range; + ppc_md.htpe_clear_all = pSeries_lpar_hptab_clear; + + htab_finish_init(); } diff -Nru a/arch/ppc64/kernel/pSeries_pci.c b/arch/ppc64/kernel/pSeries_pci.c --- a/arch/ppc64/kernel/pSeries_pci.c 2004-09-26 10:25:57 -07:00 +++ b/arch/ppc64/kernel/pSeries_pci.c 2004-09-26 10:25:57 -07:00 @@ -45,12 +45,6 @@ #include "open_pic.h" #include "pci.h" -/* legal IO pages under MAX_ISA_PORT. This is to ensure we don't touch - devices we don't have access to. */ -unsigned long io_page_mask; - -EXPORT_SYMBOL(io_page_mask); - /* RTAS tokens */ static int read_pci_config; static int write_pci_config; @@ -157,189 +151,6 @@ rtas_pci_write_config }; -/****************************************************************** - * pci_read_irq_line - * - * Reads the Interrupt Pin to determine if interrupt is use by card. - * If the interrupt is used, then gets the interrupt line from the - * openfirmware and sets it in the pci_dev and pci_config line. - * - ******************************************************************/ -int pci_read_irq_line(struct pci_dev *pci_dev) -{ - u8 intpin; - struct device_node *node; - - pci_read_config_byte(pci_dev, PCI_INTERRUPT_PIN, &intpin); - - if (intpin == 0) { - PPCDBG(PPCDBG_BUSWALK,"\tDevice: %s No Interrupt used by device.\n", pci_name(pci_dev)); - return 0; - } - - node = pci_device_to_OF_node(pci_dev); - if (node == NULL) { - PPCDBG(PPCDBG_BUSWALK,"\tDevice: %s Device Node not found.\n", - pci_name(pci_dev)); - return -1; - } - if (node->n_intrs == 0) { - PPCDBG(PPCDBG_BUSWALK,"\tDevice: %s No Device OF interrupts defined.\n", pci_name(pci_dev)); - return -1; - } - pci_dev->irq = node->intrs[0].line; - - if (s7a_workaround) { - if (pci_dev->irq > 16) - pci_dev->irq -= 3; - } - - pci_write_config_byte(pci_dev, PCI_INTERRUPT_LINE, pci_dev->irq); - - PPCDBG(PPCDBG_BUSWALK,"\tDevice: %s pci_dev->irq = 0x%02X\n", - pci_name(pci_dev), pci_dev->irq); - return 0; -} -EXPORT_SYMBOL(pci_read_irq_line); - -#define ISA_SPACE_MASK 0x1 -#define ISA_SPACE_IO 0x1 - -static void pci_process_ISA_OF_ranges(struct device_node *isa_node, - unsigned long phb_io_base_phys, - void * phb_io_base_virt) -{ - struct isa_range *range; - unsigned long pci_addr; - unsigned int isa_addr; - unsigned int size; - int rlen = 0; - - range = (struct isa_range *) get_property(isa_node, "ranges", &rlen); - if (rlen < sizeof(struct isa_range)) { - printk(KERN_ERR "unexpected isa range size: %s\n", - __FUNCTION__); - return; - } - - /* From "ISA Binding to 1275" - * The ranges property is laid out as an array of elements, - * each of which comprises: - * cells 0 - 1: an ISA address - * cells 2 - 4: a PCI address - * (size depending on dev->n_addr_cells) - * cell 5: the size of the range - */ - if ((range->isa_addr.a_hi && ISA_SPACE_MASK) == ISA_SPACE_IO) { - isa_addr = range->isa_addr.a_lo; - pci_addr = (unsigned long) range->pci_addr.a_mid << 32 | - range->pci_addr.a_lo; - - /* Assume these are both zero */ - if ((pci_addr != 0) || (isa_addr != 0)) { - printk(KERN_ERR "unexpected isa to pci mapping: %s\n", - __FUNCTION__); - return; - } - - size = PAGE_ALIGN(range->size); - - __ioremap_explicit(phb_io_base_phys, - (unsigned long) phb_io_base_virt, - size, _PAGE_NO_CACHE); - } -} - -static void __init pci_process_bridge_OF_ranges(struct pci_controller *hose, - struct device_node *dev, - int primary) -{ - unsigned int *ranges; - unsigned long size; - int rlen = 0; - int memno = 0; - struct resource *res; - int np, na = prom_n_addr_cells(dev); - unsigned long pci_addr, cpu_phys_addr; - struct device_node *isa_dn; - - np = na + 5; - - /* From "PCI Binding to 1275" - * The ranges property is laid out as an array of elements, - * each of which comprises: - * cells 0 - 2: a PCI address - * cells 3 or 3+4: a CPU physical address - * (size depending on dev->n_addr_cells) - * cells 4+5 or 5+6: the size of the range - */ - rlen = 0; - hose->io_base_phys = 0; - ranges = (unsigned int *) get_property(dev, "ranges", &rlen); - while ((rlen -= np * sizeof(unsigned int)) >= 0) { - res = NULL; - pci_addr = (unsigned long)ranges[1] << 32 | ranges[2]; - - cpu_phys_addr = ranges[3]; - if (na == 2) - cpu_phys_addr = cpu_phys_addr << 32 | ranges[4]; - - size = (unsigned long)ranges[na+3] << 32 | ranges[na+4]; - - switch (ranges[0] >> 24) { - case 1: /* I/O space */ - hose->io_base_phys = cpu_phys_addr; - hose->io_base_virt = reserve_phb_iospace(size); - PPCDBG(PPCDBG_PHBINIT, - "phb%d io_base_phys 0x%lx io_base_virt 0x%lx\n", - hose->global_number, hose->io_base_phys, - (unsigned long) hose->io_base_virt); - - if (primary) { - pci_io_base = (unsigned long)hose->io_base_virt; - isa_dn = of_find_node_by_type(NULL, "isa"); - if (isa_dn) { - isa_io_base = pci_io_base; - pci_process_ISA_OF_ranges(isa_dn, - hose->io_base_phys, - hose->io_base_virt); - of_node_put(isa_dn); - /* Allow all IO */ - io_page_mask = -1; - } - } - - res = &hose->io_resource; - res->flags = IORESOURCE_IO; - res->start = pci_addr; - res->start += (unsigned long)hose->io_base_virt - - pci_io_base; - break; - case 2: /* memory space */ - memno = 0; - while (memno < 3 && hose->mem_resources[memno].flags) - ++memno; - - if (memno == 0) - hose->pci_mem_offset = cpu_phys_addr - pci_addr; - if (memno < 3) { - res = &hose->mem_resources[memno]; - res->flags = IORESOURCE_MEM; - res->start = cpu_phys_addr; - } - break; - } - if (res != NULL) { - res->name = dev->full_name; - res->end = res->start + size - 1; - res->parent = NULL; - res->sibling = NULL; - res->child = NULL; - } - ranges += np; - } -} - static void python_countermeasures(unsigned long addr) { void *chip_regs; @@ -497,7 +308,7 @@ struct pci_controller *phb; unsigned int root_size_cells = 0; unsigned int index; - unsigned int *opprop; + unsigned int *opprop = NULL; struct device_node *root = of_find_node_by_path("/"); if (naca->interrupt_controller == IC_OPEN_PIC) { @@ -561,96 +372,6 @@ DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pcibios_name_device); #endif -void __devinit pcibios_fixup_device_resources(struct pci_dev *dev, - struct pci_bus *bus) -{ - /* Update device resources. */ - struct pci_controller *hose = PCI_GET_PHB_PTR(bus); - int i; - - for (i = 0; i < PCI_NUM_RESOURCES; i++) { - if (dev->resource[i].flags & IORESOURCE_IO) { - unsigned long offset = (unsigned long)hose->io_base_virt - pci_io_base; - unsigned long start, end, mask; - - start = dev->resource[i].start += offset; - end = dev->resource[i].end += offset; - - /* Need to allow IO access to pages that are in the - ISA range */ - if (start < MAX_ISA_PORT) { - if (end > MAX_ISA_PORT) - end = MAX_ISA_PORT; - - start >>= PAGE_SHIFT; - end >>= PAGE_SHIFT; - - /* get the range of pages for the map */ - mask = ((1 << (end+1))-1) ^ ((1 << start)-1); - io_page_mask |= mask; - } - } - else if (dev->resource[i].flags & IORESOURCE_MEM) { - dev->resource[i].start += hose->pci_mem_offset; - dev->resource[i].end += hose->pci_mem_offset; - } - } -} -EXPORT_SYMBOL(pcibios_fixup_device_resources); - -void __devinit pcibios_fixup_bus(struct pci_bus *bus) -{ - struct pci_controller *hose = PCI_GET_PHB_PTR(bus); - struct list_head *ln; - - /* XXX or bus->parent? */ - struct pci_dev *dev = bus->self; - struct resource *res; - int i; - - if (!dev) { - /* Root bus. */ - - hose->bus = bus; - bus->resource[0] = res = &hose->io_resource; - if (!res->flags) - BUG(); /* No I/O resource for this PHB? */ - - if (request_resource(&ioport_resource, res)) - printk(KERN_ERR "Failed to request IO on " - "PCI domain %d\n", pci_domain_nr(bus)); - - - for (i = 0; i < 3; ++i) { - res = &hose->mem_resources[i]; - if (!res->flags && i == 0) - BUG(); /* No memory resource for this PHB? */ - bus->resource[i+1] = res; - if (res->flags && request_resource(&iomem_resource, res)) - printk(KERN_ERR "Failed to request MEM on " - "PCI domain %d\n", - pci_domain_nr(bus)); - } - } else if (pci_probe_only && - (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) { - /* This is a subordinate bridge */ - - pci_read_bridge_bases(bus); - pcibios_fixup_device_resources(dev, bus); - } - - /* XXX Need to check why Alpha doesnt do this - Anton */ - if (!pci_probe_only) - return; - - for (ln = bus->devices.next; ln != &bus->devices; ln = ln->next) { - struct pci_dev *dev = pci_dev_b(ln); - if ((dev->class >> 8) != PCI_CLASS_BRIDGE_PCI) - pcibios_fixup_device_resources(dev, bus); - } -} -EXPORT_SYMBOL(pcibios_fixup_bus); - static void check_s7a(void) { struct device_node *root; @@ -751,7 +472,28 @@ remap_bus_range(hose->bus); } -extern void chrp_request_regions(void); +static void __init pSeries_request_regions(void) +{ + struct device_node *i8042; + + request_region(0x20,0x20,"pic1"); + request_region(0xa0,0x20,"pic2"); + request_region(0x00,0x20,"dma1"); + request_region(0x40,0x20,"timer"); + request_region(0x80,0x10,"dma page reg"); + request_region(0xc0,0x20,"dma2"); + +#define I8042_DATA_REG 0x60 + + /* + * Some machines have an unterminated i8042 so check the device + * tree and reserve the region if it does not appear. Later on + * the i8042 code will try and reserve this region and fail. + */ + if (!(i8042 = of_find_node_by_type(NULL, "8042"))) + request_region(I8042_DATA_REG, 16, "reserved (no i8042)"); + of_node_put(i8042); +} void __init pSeries_final_fixup(void) { @@ -759,58 +501,23 @@ check_s7a(); - while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) + while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { pci_read_irq_line(dev); + if (s7a_workaround) { + if (dev->irq > 16) { + dev->irq -= 3; + pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq); + } + } + } phbs_fixup_io(); - chrp_request_regions(); + pSeries_request_regions(); pci_fix_bus_sysdata(); - if (!ppc64_iommu_off) - iommu_setup_pSeries(); -} -/*********************************************************************** - * pci_find_hose_for_OF_device - * - * This function finds the PHB that matching device_node in the - * OpenFirmware by scanning all the pci_controllers. - * - ***********************************************************************/ -struct pci_controller* -pci_find_hose_for_OF_device(struct device_node *node) -{ - while (node) { - struct pci_controller *hose, *tmp; - list_for_each_entry_safe(hose, tmp, &hose_list, list_node) - if (hose->arch_data == node) - return hose; - node=node->parent; - } - return NULL; -} - -/* - * ppc64 can have multifunction devices that do not respond to function 0. - * In this case we must scan all functions. - */ -int -pcibios_scan_all_fns(struct pci_bus *bus, int devfn) -{ - struct device_node *busdn, *dn; - - if (bus->self) - busdn = pci_device_to_OF_node(bus->self); - else - busdn = bus->sysdata; /* must be a phb */ - - /* - * Check to see if there is any of the 8 functions are in the - * device tree. If they are then we need to scan all the - * functions of this slot. - */ - for (dn = busdn->child; dn; dn = dn->sibling) - if ((dn->devfn >> 3) == (devfn >> 3)) - return 1; + if (!of_chosen || !get_property(of_chosen, "linux,iommu-off", NULL)) + iommu_setup_pSeries(); - return 0; + pci_addr_cache_build(); } + diff -Nru a/arch/ppc64/kernel/pSeries_setup.c b/arch/ppc64/kernel/pSeries_setup.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/ppc64/kernel/pSeries_setup.c 2004-09-26 10:25:55 -07:00 @@ -0,0 +1,579 @@ +/* + * linux/arch/ppc/kernel/setup.c + * + * Copyright (C) 1995 Linus Torvalds + * Adapted from 'alpha' version by Gary Thomas + * Modified by Cort Dougan (cort@cs.nmt.edu) + * Modified by PPC64 Team, IBM Corp + * + * 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. + */ + +/* + * bootup setup stuff.. + */ + +#undef DEBUG + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "i8259.h" +#include "open_pic.h" +#include +#include +#include + +#ifdef DEBUG +#define DBG(fmt...) udbg_printf(fmt) +#else +#define DBG(fmt...) +#endif + +extern void pSeries_init_openpic(void); + +extern void find_and_init_phbs(void); +extern void pSeries_final_fixup(void); + +extern void pSeries_get_boot_time(struct rtc_time *rtc_time); +extern void pSeries_get_rtc_time(struct rtc_time *rtc_time); +extern int pSeries_set_rtc_time(struct rtc_time *rtc_time); +extern void find_udbg_vterm(void); +extern void SystemReset_FWNMI(void), MachineCheck_FWNMI(void); /* from head.S */ +int fwnmi_active; /* TRUE if an FWNMI handler is present */ + +unsigned long virtPython0Facilities = 0; // python0 facility area (memory mapped io) (64-bit format) VIRTUAL address. + +extern unsigned long loops_per_jiffy; + +extern unsigned long ppc_proc_freq; +extern unsigned long ppc_tb_freq; + +void pSeries_get_cpuinfo(struct seq_file *m) +{ + struct device_node *root; + const char *model = ""; + + root = of_find_node_by_path("/"); + if (root) + model = get_property(root, "model", NULL); + seq_printf(m, "machine\t\t: CHRP %s\n", model); + of_node_put(root); +} + +/* Initialize firmware assisted non-maskable interrupts if + * the firmware supports this feature. + * + */ +static void __init fwnmi_init(void) +{ + int ret; + int ibm_nmi_register = rtas_token("ibm,nmi-register"); + if (ibm_nmi_register == RTAS_UNKNOWN_SERVICE) + return; + ret = rtas_call(ibm_nmi_register, 2, 1, NULL, + __pa((unsigned long)SystemReset_FWNMI), + __pa((unsigned long)MachineCheck_FWNMI)); + if (ret == 0) + fwnmi_active = 1; +} + +static void __init pSeries_setup_arch(void) +{ + struct device_node *root; + unsigned int *opprop; + + /* Fixup ppc_md depending on the type of interrupt controller */ + if (naca->interrupt_controller == IC_OPEN_PIC) { + ppc_md.init_IRQ = pSeries_init_openpic; + ppc_md.get_irq = openpic_get_irq; + } else { + ppc_md.init_IRQ = xics_init_IRQ; + ppc_md.get_irq = xics_get_irq; + } + +#ifdef CONFIG_SMP + smp_init_pSeries(); +#endif + /* openpic global configuration register (64-bit format). */ + /* openpic Interrupt Source Unit pointer (64-bit format). */ + /* python0 facility area (mmio) (64-bit format) REAL address. */ + + /* init to some ~sane value until calibrate_delay() runs */ + loops_per_jiffy = 50000000; + + if (ROOT_DEV == 0) { + printk("No ramdisk, default root is /dev/sda2\n"); + ROOT_DEV = Root_SDA2; + } + + fwnmi_init(); + + /* Find and initialize PCI host bridges */ + /* iSeries needs to be done much later. */ + eeh_init(); + find_and_init_phbs(); + + /* Find the Open PIC if present */ + root = of_find_node_by_path("/"); + opprop = (unsigned int *) get_property(root, + "platform-open-pic", NULL); + if (opprop != 0) { + int n = prom_n_addr_cells(root); + unsigned long openpic; + + for (openpic = 0; n > 0; --n) + openpic = (openpic << 32) + *opprop++; + printk(KERN_DEBUG "OpenPIC addr: %lx\n", openpic); + OpenPIC_Addr = __ioremap(openpic, 0x40000, _PAGE_NO_CACHE); + } + of_node_put(root); + +#ifdef CONFIG_DUMMY_CONSOLE + conswitchp = &dummy_con; +#endif + + pSeries_nvram_init(); +} + +static int __init pSeries_init_panel(void) +{ + /* Manually leave the kernel version on the panel. */ + ppc_md.progress("Linux ppc64\n", 0); + ppc_md.progress(UTS_RELEASE, 0); + + return 0; +} +arch_initcall(pSeries_init_panel); + + + +void __init pSeries_find_serial_port(void) +{ + struct device_node *np; + unsigned long encode_phys_size = 32; + u32 *sizeprop; + + struct isa_reg_property { + u32 space; + u32 address; + u32 size; + }; + struct pci_reg_property { + struct pci_address addr; + u32 size_hi; + u32 size_lo; + }; + + DBG(" -> pSeries_find_serial_port()\n"); + + naca->serialPortAddr = 0; + + np = of_find_node_by_path("/"); + if (!np) + return; + sizeprop = (u32 *)get_property(np, "#size-cells", NULL); + if (sizeprop != NULL) + encode_phys_size = (*sizeprop) << 5; + + for (np = NULL; (np = of_find_node_by_type(np, "serial"));) { + struct device_node *isa, *pci; + struct isa_reg_property *reg; + union pci_range *rangesp; + char *typep; + + typep = (char *)get_property(np, "ibm,aix-loc", NULL); + if ((typep == NULL) || (typep && strcmp(typep, "S1"))) + continue; + + reg = (struct isa_reg_property *)get_property(np, "reg", NULL); + + isa = of_get_parent(np); + if (!isa) { + DBG("no isa parent found\n"); + break; + } + pci = of_get_parent(isa); + if (!pci) { + DBG("no pci parent found\n"); + break; + } + + rangesp = (union pci_range *)get_property(pci, "ranges", NULL); + + if ( encode_phys_size == 32 ) + naca->serialPortAddr = rangesp->pci32.phys+reg->address; + else { + naca->serialPortAddr = + ((((unsigned long)rangesp->pci64.phys_hi) << 32) + | + (rangesp->pci64.phys_lo)) + reg->address; + } + break; + } + + DBG(" <- pSeries_find_serial_port()\n"); +} + + +/* Build up the firmware_features bitmask field + * using contents of device-tree/ibm,hypertas-functions. + * Ultimately this functionality may be moved into prom.c prom_init(). + */ +void __init fw_feature_init(void) +{ + struct device_node * dn; + char * hypertas; + unsigned int len; + + DBG(" -> fw_feature_init()\n"); + + cur_cpu_spec->firmware_features = 0; + dn = of_find_node_by_path("/rtas"); + if (dn == NULL) { + printk(KERN_ERR "WARNING ! Cannot find RTAS in device-tree !\n"); + goto no_rtas; + } + + hypertas = get_property(dn, "ibm,hypertas-functions", &len); + if (hypertas) { + while (len > 0){ + int i, hypertas_len; + /* check value against table of strings */ + for(i=0; i < FIRMWARE_MAX_FEATURES ;i++) { + if ((firmware_features_table[i].name) && + (strcmp(firmware_features_table[i].name,hypertas))==0) { + /* we have a match */ + cur_cpu_spec->firmware_features |= + (firmware_features_table[i].val); + break; + } + } + hypertas_len = strlen(hypertas); + len -= hypertas_len +1; + hypertas+= hypertas_len +1; + } + } + + of_node_put(dn); + no_rtas: + printk(KERN_INFO "firmware_features = 0x%lx\n", + cur_cpu_spec->firmware_features); + + DBG(" <- fw_feature_init()\n"); +} + + +static void __init pSeries_discover_pic(void) +{ + struct device_node *np; + char *typep; + + /* + * Setup interrupt mapping options that are needed for finish_device_tree + * to properly parse the OF interrupt tree & do the virtual irq mapping + */ + __irq_offset_value = NUM_ISA_INTERRUPTS; + naca->interrupt_controller = IC_INVALID; + for (np = NULL; (np = of_find_node_by_name(np, "interrupt-controller"));) { + typep = (char *)get_property(np, "compatible", NULL); + if (strstr(typep, "open-pic")) + naca->interrupt_controller = IC_OPEN_PIC; + else if (strstr(typep, "ppc-xicp")) + naca->interrupt_controller = IC_PPC_XIC; + else + printk("initialize_naca: failed to recognize" + " interrupt-controller\n"); + break; + } +} + +/* + * Early initialization. Relocation is on but do not reference unbolted pages + */ +static void __init pSeries_init_early(void) +{ + void *comport; + int iommu_off = 0; + + DBG(" -> pSeries_init_early()\n"); + + fw_feature_init(); + + if (systemcfg->platform & PLATFORM_LPAR) + hpte_init_lpar(); + else { + hpte_init_native(); + iommu_off = (of_chosen && + get_property(of_chosen, "linux,iommu-off", NULL)); + } + + pSeries_find_serial_port(); + + if (systemcfg->platform & PLATFORM_LPAR) + find_udbg_vterm(); + else if (naca->serialPortAddr) { + /* Map the uart for udbg. */ + comport = (void *)__ioremap(naca->serialPortAddr, 16, _PAGE_NO_CACHE); + udbg_init_uart(comport); + + ppc_md.udbg_putc = udbg_putc; + ppc_md.udbg_getc = udbg_getc; + ppc_md.udbg_getc_poll = udbg_getc_poll; + DBG("Hello World !\n"); + } + + + if (iommu_off) + pci_dma_init_direct(); + else + tce_init_pSeries(); + + pSeries_discover_pic(); + + DBG(" <- pSeries_init_early()\n"); +} + + +static void pSeries_progress(char *s, unsigned short hex) +{ + struct device_node *root; + int width, *p; + char *os; + static int display_character, set_indicator; + static int max_width; + static spinlock_t progress_lock = SPIN_LOCK_UNLOCKED; + static int pending_newline = 0; /* did last write end with unprinted newline? */ + + if (!rtas.base) + return; + + if (max_width == 0) { + if ((root = find_path_device("/rtas")) && + (p = (unsigned int *)get_property(root, + "ibm,display-line-length", + NULL))) + max_width = *p; + else + max_width = 0x10; + display_character = rtas_token("display-character"); + set_indicator = rtas_token("set-indicator"); + } + + if (display_character == RTAS_UNKNOWN_SERVICE) { + /* use hex display if available */ + if (set_indicator != RTAS_UNKNOWN_SERVICE) + rtas_call(set_indicator, 3, 1, NULL, 6, 0, hex); + return; + } + + spin_lock(&progress_lock); + + /* + * Last write ended with newline, but we didn't print it since + * it would just clear the bottom line of output. Print it now + * instead. + * + * If no newline is pending, print a CR to start output at the + * beginning of the line. + */ + if (pending_newline) { + rtas_call(display_character, 1, 1, NULL, '\r'); + rtas_call(display_character, 1, 1, NULL, '\n'); + pending_newline = 0; + } else { + rtas_call(display_character, 1, 1, NULL, '\r'); + } + + width = max_width; + os = s; + while (*os) { + if (*os == '\n' || *os == '\r') { + /* Blank to end of line. */ + while (width-- > 0) + rtas_call(display_character, 1, 1, NULL, ' '); + + /* If newline is the last character, save it + * until next call to avoid bumping up the + * display output. + */ + if (*os == '\n' && !os[1]) { + pending_newline = 1; + spin_unlock(&progress_lock); + return; + } + + /* RTAS wants CR-LF, not just LF */ + + if (*os == '\n') { + rtas_call(display_character, 1, 1, NULL, '\r'); + rtas_call(display_character, 1, 1, NULL, '\n'); + } else { + /* CR might be used to re-draw a line, so we'll + * leave it alone and not add LF. + */ + rtas_call(display_character, 1, 1, NULL, *os); + } + + width = max_width; + } else { + width--; + rtas_call(display_character, 1, 1, NULL, *os); + } + + os++; + + /* if we overwrite the screen length */ + if (width <= 0) + while ((*os != 0) && (*os != '\n') && (*os != '\r')) + os++; + } + + /* Blank to end of line. */ + while (width-- > 0) + rtas_call(display_character, 1, 1, NULL, ' '); + + spin_unlock(&progress_lock); +} + +extern void setup_default_decr(void); + +/* Some sane defaults: 125 MHz timebase, 1GHz processor */ +#define DEFAULT_TB_FREQ 125000000UL +#define DEFAULT_PROC_FREQ (DEFAULT_TB_FREQ * 8) + +static void __init pSeries_calibrate_decr(void) +{ + struct device_node *cpu; + struct div_result divres; + unsigned int *fp; + int node_found; + + /* + * The cpu node should have a timebase-frequency property + * to tell us the rate at which the decrementer counts. + */ + cpu = of_find_node_by_type(NULL, "cpu"); + + ppc_tb_freq = DEFAULT_TB_FREQ; /* hardcoded default */ + node_found = 0; + if (cpu != 0) { + fp = (unsigned int *)get_property(cpu, "timebase-frequency", + NULL); + if (fp != 0) { + node_found = 1; + ppc_tb_freq = *fp; + } + } + if (!node_found) + printk(KERN_ERR "WARNING: Estimating decrementer frequency " + "(not found)\n"); + + ppc_proc_freq = DEFAULT_PROC_FREQ; + node_found = 0; + if (cpu != 0) { + fp = (unsigned int *)get_property(cpu, "clock-frequency", + NULL); + if (fp != 0) { + node_found = 1; + ppc_proc_freq = *fp; + } + } + if (!node_found) + printk(KERN_ERR "WARNING: Estimating processor frequency " + "(not found)\n"); + + of_node_put(cpu); + + printk(KERN_INFO "time_init: decrementer frequency = %lu.%.6lu MHz\n", + ppc_tb_freq/1000000, ppc_tb_freq%1000000); + printk(KERN_INFO "time_init: processor frequency = %lu.%.6lu MHz\n", + ppc_proc_freq/1000000, ppc_proc_freq%1000000); + + tb_ticks_per_jiffy = ppc_tb_freq / HZ; + tb_ticks_per_sec = tb_ticks_per_jiffy * HZ; + tb_ticks_per_usec = ppc_tb_freq / 1000000; + tb_to_us = mulhwu_scale_factor(ppc_tb_freq, 1000000); + div128_by_32(1024*1024, 0, tb_ticks_per_sec, &divres); + tb_to_xs = divres.result_low; + + setup_default_decr(); +} + +/* + * Called very early, MMU is off, device-tree isn't unflattened + */ +extern struct machdep_calls pSeries_md; + +static int __init pSeries_probe(int platform) +{ + if (platform != PLATFORM_PSERIES && + platform != PLATFORM_PSERIES_LPAR) + return 0; + + /* if we have some ppc_md fixups for LPAR to do, do + * it here ... + */ + + return 1; +} + +struct machdep_calls __initdata pSeries_md = { + .probe = pSeries_probe, + .setup_arch = pSeries_setup_arch, + .init_early = pSeries_init_early, + .get_cpuinfo = pSeries_get_cpuinfo, + .log_error = pSeries_log_error, + .pcibios_fixup = pSeries_final_fixup, + .restart = rtas_restart, + .power_off = rtas_power_off, + .halt = rtas_halt, + .panic = rtas_os_term, + .get_boot_time = pSeries_get_boot_time, + .get_rtc_time = pSeries_get_rtc_time, + .set_rtc_time = pSeries_set_rtc_time, + .calibrate_decr = pSeries_calibrate_decr, + .progress = pSeries_progress, +}; diff -Nru a/arch/ppc64/kernel/pci.c b/arch/ppc64/kernel/pci.c --- a/arch/ppc64/kernel/pci.c 2004-09-26 10:25:57 -07:00 +++ b/arch/ppc64/kernel/pci.c 2004-09-26 10:25:57 -07:00 @@ -42,6 +42,13 @@ unsigned long pci_probe_only = 1; unsigned long pci_assign_all_buses = 0; +/* legal IO pages under MAX_ISA_PORT. This is to ensure we don't touch + devices we don't have access to. */ +unsigned long io_page_mask; + +EXPORT_SYMBOL(io_page_mask); + + unsigned int pcibios_assign_all_busses(void) { return pci_assign_all_buses; @@ -270,7 +277,6 @@ iSeries_pcibios_init(); #endif - //ppc64_boot_msg(0x40, "PCI Probe"); printk("PCI: Probing PCI hardware\n"); /* Scan all of the recorded PCI controllers. */ @@ -290,7 +296,7 @@ pci_assign_unassigned_resources() is able to work correctly with [partially] allocated PCI tree. */ pci_assign_unassigned_resources(); -#endif +#endif /* !CONFIG_PPC_ISERIES */ /* Call machine dependent final fixup */ if (ppc_md.pcibios_fixup) @@ -302,11 +308,6 @@ printk("ISA bridge at %s\n", pci_name(ppc64_isabridge_dev)); printk("PCI: Probing PCI hardware done\n"); - //ppc64_boot_msg(0x41, "PCI Done"); - -#ifdef CONFIG_PPC_PSERIES - pci_addr_cache_build(); -#endif return 0; } @@ -506,7 +507,7 @@ return ret; } -#ifdef CONFIG_PPC_PSERIES +#ifdef CONFIG_PPC_MULTIPLATFORM static ssize_t pci_show_devspec(struct device *dev, char *buf) { struct pci_dev *pdev; @@ -519,11 +520,329 @@ return sprintf(buf, "%s", np->full_name); } static DEVICE_ATTR(devspec, S_IRUGO, pci_show_devspec, NULL); -#endif /* CONFIG_PPC_PSERIES */ +#endif /* CONFIG_PPC_MULTIPLATFORM */ void pcibios_add_platform_entries(struct pci_dev *pdev) { -#ifdef CONFIG_PPC_PSERIES +#ifdef CONFIG_PPC_MULTIPLATFORM device_create_file(&pdev->dev, &dev_attr_devspec); -#endif /* CONFIG_PPC_PSERIES */ +#endif /* CONFIG_PPC_MULTIPLATFORM */ } + +#ifdef CONFIG_PPC_MULTIPLATFORM + +#define ISA_SPACE_MASK 0x1 +#define ISA_SPACE_IO 0x1 + +static void pci_process_ISA_OF_ranges(struct device_node *isa_node, + unsigned long phb_io_base_phys, + void * phb_io_base_virt) +{ + struct isa_range *range; + unsigned long pci_addr; + unsigned int isa_addr; + unsigned int size; + int rlen = 0; + + range = (struct isa_range *) get_property(isa_node, "ranges", &rlen); + if (rlen < sizeof(struct isa_range)) { + printk(KERN_ERR "unexpected isa range size: %s\n", + __FUNCTION__); + return; + } + + /* From "ISA Binding to 1275" + * The ranges property is laid out as an array of elements, + * each of which comprises: + * cells 0 - 1: an ISA address + * cells 2 - 4: a PCI address + * (size depending on dev->n_addr_cells) + * cell 5: the size of the range + */ + if ((range->isa_addr.a_hi && ISA_SPACE_MASK) == ISA_SPACE_IO) { + isa_addr = range->isa_addr.a_lo; + pci_addr = (unsigned long) range->pci_addr.a_mid << 32 | + range->pci_addr.a_lo; + + /* Assume these are both zero */ + if ((pci_addr != 0) || (isa_addr != 0)) { + printk(KERN_ERR "unexpected isa to pci mapping: %s\n", + __FUNCTION__); + return; + } + + size = PAGE_ALIGN(range->size); + + __ioremap_explicit(phb_io_base_phys, + (unsigned long) phb_io_base_virt, + size, _PAGE_NO_CACHE); + } +} + +void __init pci_process_bridge_OF_ranges(struct pci_controller *hose, + struct device_node *dev, int primary) +{ + unsigned int *ranges; + unsigned long size; + int rlen = 0; + int memno = 0; + struct resource *res; + int np, na = prom_n_addr_cells(dev); + unsigned long pci_addr, cpu_phys_addr; + struct device_node *isa_dn; + + np = na + 5; + + /* From "PCI Binding to 1275" + * The ranges property is laid out as an array of elements, + * each of which comprises: + * cells 0 - 2: a PCI address + * cells 3 or 3+4: a CPU physical address + * (size depending on dev->n_addr_cells) + * cells 4+5 or 5+6: the size of the range + */ + rlen = 0; + hose->io_base_phys = 0; + ranges = (unsigned int *) get_property(dev, "ranges", &rlen); + while ((rlen -= np * sizeof(unsigned int)) >= 0) { + res = NULL; + pci_addr = (unsigned long)ranges[1] << 32 | ranges[2]; + + cpu_phys_addr = ranges[3]; + if (na == 2) + cpu_phys_addr = cpu_phys_addr << 32 | ranges[4]; + + size = (unsigned long)ranges[na+3] << 32 | ranges[na+4]; + + switch (ranges[0] >> 24) { + case 1: /* I/O space */ + hose->io_base_phys = cpu_phys_addr; + hose->io_base_virt = reserve_phb_iospace(size); + PPCDBG(PPCDBG_PHBINIT, + "phb%d io_base_phys 0x%lx io_base_virt 0x%lx\n", + hose->global_number, hose->io_base_phys, + (unsigned long) hose->io_base_virt); + + if (primary) { + pci_io_base = (unsigned long)hose->io_base_virt; + isa_dn = of_find_node_by_type(NULL, "isa"); + if (isa_dn) { + isa_io_base = pci_io_base; + pci_process_ISA_OF_ranges(isa_dn, + hose->io_base_phys, + hose->io_base_virt); + of_node_put(isa_dn); + /* Allow all IO */ + io_page_mask = -1; + } + } + + res = &hose->io_resource; + res->flags = IORESOURCE_IO; + res->start = pci_addr; + res->start += (unsigned long)hose->io_base_virt - + pci_io_base; + break; + case 2: /* memory space */ + memno = 0; + while (memno < 3 && hose->mem_resources[memno].flags) + ++memno; + + if (memno == 0) + hose->pci_mem_offset = cpu_phys_addr - pci_addr; + if (memno < 3) { + res = &hose->mem_resources[memno]; + res->flags = IORESOURCE_MEM; + res->start = cpu_phys_addr; + } + break; + } + if (res != NULL) { + res->name = dev->full_name; + res->end = res->start + size - 1; + res->parent = NULL; + res->sibling = NULL; + res->child = NULL; + } + ranges += np; + } +} + +/*********************************************************************** + * pci_find_hose_for_OF_device + * + * This function finds the PHB that matching device_node in the + * OpenFirmware by scanning all the pci_controllers. + * + ***********************************************************************/ +struct pci_controller* pci_find_hose_for_OF_device(struct device_node *node) +{ + while (node) { + struct pci_controller *hose, *tmp; + list_for_each_entry_safe(hose, tmp, &hose_list, list_node) + if (hose->arch_data == node) + return hose; + node=node->parent; + } + return NULL; +} + +/* + * ppc64 can have multifunction devices that do not respond to function 0. + * In this case we must scan all functions. + */ +int pcibios_scan_all_fns(struct pci_bus *bus, int devfn) +{ + struct device_node *busdn, *dn; + + if (bus->self) + busdn = pci_device_to_OF_node(bus->self); + else + busdn = bus->sysdata; /* must be a phb */ + + /* + * Check to see if there is any of the 8 functions are in the + * device tree. If they are then we need to scan all the + * functions of this slot. + */ + for (dn = busdn->child; dn; dn = dn->sibling) + if ((dn->devfn >> 3) == (devfn >> 3)) + return 1; + + return 0; +} + + +void __devinit pcibios_fixup_device_resources(struct pci_dev *dev, + struct pci_bus *bus) +{ + /* Update device resources. */ + struct pci_controller *hose = PCI_GET_PHB_PTR(bus); + int i; + + for (i = 0; i < PCI_NUM_RESOURCES; i++) { + if (dev->resource[i].flags & IORESOURCE_IO) { + unsigned long offset = (unsigned long)hose->io_base_virt - pci_io_base; + unsigned long start, end, mask; + + start = dev->resource[i].start += offset; + end = dev->resource[i].end += offset; + + /* Need to allow IO access to pages that are in the + ISA range */ + if (start < MAX_ISA_PORT) { + if (end > MAX_ISA_PORT) + end = MAX_ISA_PORT; + + start >>= PAGE_SHIFT; + end >>= PAGE_SHIFT; + + /* get the range of pages for the map */ + mask = ((1 << (end+1))-1) ^ ((1 << start)-1); + io_page_mask |= mask; + } + } + else if (dev->resource[i].flags & IORESOURCE_MEM) { + dev->resource[i].start += hose->pci_mem_offset; + dev->resource[i].end += hose->pci_mem_offset; + } + } +} +EXPORT_SYMBOL(pcibios_fixup_device_resources); + +void __devinit pcibios_fixup_bus(struct pci_bus *bus) +{ + struct pci_controller *hose = PCI_GET_PHB_PTR(bus); + struct list_head *ln; + + /* XXX or bus->parent? */ + struct pci_dev *dev = bus->self; + struct resource *res; + int i; + + if (!dev) { + /* Root bus. */ + + hose->bus = bus; + bus->resource[0] = res = &hose->io_resource; + if (!res->flags) + BUG(); /* No I/O resource for this PHB? */ + + if (request_resource(&ioport_resource, res)) + printk(KERN_ERR "Failed to request IO on " + "PCI domain %d\n", pci_domain_nr(bus)); + + + for (i = 0; i < 3; ++i) { + res = &hose->mem_resources[i]; + if (!res->flags && i == 0) + BUG(); /* No memory resource for this PHB? */ + bus->resource[i+1] = res; + if (res->flags && request_resource(&iomem_resource, res)) + printk(KERN_ERR "Failed to request MEM on " + "PCI domain %d\n", + pci_domain_nr(bus)); + } + } else if (pci_probe_only && + (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) { + /* This is a subordinate bridge */ + + pci_read_bridge_bases(bus); + pcibios_fixup_device_resources(dev, bus); + } + + /* XXX Need to check why Alpha doesnt do this - Anton */ + if (!pci_probe_only) + return; + + for (ln = bus->devices.next; ln != &bus->devices; ln = ln->next) { + struct pci_dev *dev = pci_dev_b(ln); + if ((dev->class >> 8) != PCI_CLASS_BRIDGE_PCI) + pcibios_fixup_device_resources(dev, bus); + } +} +EXPORT_SYMBOL(pcibios_fixup_bus); + +/****************************************************************** + * pci_read_irq_line + * + * Reads the Interrupt Pin to determine if interrupt is use by card. + * If the interrupt is used, then gets the interrupt line from the + * openfirmware and sets it in the pci_dev and pci_config line. + * + ******************************************************************/ +int pci_read_irq_line(struct pci_dev *pci_dev) +{ + u8 intpin; + struct device_node *node; + + pci_read_config_byte(pci_dev, PCI_INTERRUPT_PIN, &intpin); + + if (intpin == 0) { + PPCDBG(PPCDBG_BUSWALK,"\tDevice: %s No Interrupt used by device.\n", + pci_name(pci_dev)); + return 0; + } + + node = pci_device_to_OF_node(pci_dev); + if (node == NULL) { + PPCDBG(PPCDBG_BUSWALK,"\tDevice: %s Device Node not found.\n", + pci_name(pci_dev)); + return -1; + } + if (node->n_intrs == 0) { + PPCDBG(PPCDBG_BUSWALK,"\tDevice: %s No Device OF interrupts defined.\n", + pci_name(pci_dev)); + return -1; + } + pci_dev->irq = node->intrs[0].line; + + pci_write_config_byte(pci_dev, PCI_INTERRUPT_LINE, pci_dev->irq); + + PPCDBG(PPCDBG_BUSWALK,"\tDevice: %s pci_dev->irq = 0x%02X\n", + pci_name(pci_dev), pci_dev->irq); + return 0; +} +EXPORT_SYMBOL(pci_read_irq_line); + +#endif /* CONFIG_PPC_MULTIPLATFORM */ diff -Nru a/arch/ppc64/kernel/pci_iommu.c b/arch/ppc64/kernel/pci_iommu.c --- a/arch/ppc64/kernel/pci_iommu.c 2004-09-26 10:25:56 -07:00 +++ b/arch/ppc64/kernel/pci_iommu.c 2004-09-26 10:25:56 -07:00 @@ -54,9 +54,9 @@ return ISERIES_DEVNODE(dev)->iommu_table; #endif /* CONFIG_PPC_ISERIES */ -#ifdef CONFIG_PPC_PSERIES +#ifdef CONFIG_PPC_MULTIPLATFORM return PCI_GET_DN(dev)->iommu_table; -#endif /* CONFIG_PPC_PSERIES */ +#endif /* CONFIG_PPC_MULTIPLATFORM */ } diff -Nru a/arch/ppc64/kernel/pmac.h b/arch/ppc64/kernel/pmac.h --- a/arch/ppc64/kernel/pmac.h 2004-09-26 10:25:56 -07:00 +++ b/arch/ppc64/kernel/pmac.h 2004-09-26 10:25:56 -07:00 @@ -29,4 +29,6 @@ extern void pmac_nvram_init(void); +extern void pmac_iommu_alloc(void); + #endif /* __PMAC_H__ */ diff -Nru a/arch/ppc64/kernel/pmac_feature.c b/arch/ppc64/kernel/pmac_feature.c --- a/arch/ppc64/kernel/pmac_feature.c 2004-09-26 10:25:57 -07:00 +++ b/arch/ppc64/kernel/pmac_feature.c 2004-09-26 10:25:57 -07:00 @@ -44,9 +44,9 @@ #undef DEBUG_FEATURE #ifdef DEBUG_FEATURE -#define DBG(fmt,...) printk(KERN_DEBUG fmt) +#define DBG(fmt...) printk(KERN_DEBUG fmt) #else -#define DBG(fmt,...) +#define DBG(fmt...) #endif /* diff -Nru a/arch/ppc64/kernel/pmac_iommu.c b/arch/ppc64/kernel/pmac_iommu.c --- a/arch/ppc64/kernel/pmac_iommu.c 2004-09-26 10:25:57 -07:00 +++ b/arch/ppc64/kernel/pmac_iommu.c 2004-09-26 10:25:57 -07:00 @@ -37,13 +37,14 @@ #include #include #include -#include #include #include #include #include #include #include +#include + #include "pci.h" @@ -76,8 +77,8 @@ #define DARTMAP_RPNMASK 0x00ffffff /* Physical base address and size of the DART table */ -unsigned long dart_tablebase; -unsigned long dart_tablesize; +unsigned long dart_tablebase; /* exported to htab_initialize */ +static unsigned long dart_tablesize; /* Virtual base address of the DART table */ static u32 *dart_vbase; @@ -263,7 +264,6 @@ return 0; } - void iommu_setup_pmac(void) { struct pci_dev *dev = NULL; @@ -300,6 +300,22 @@ } } +void __init pmac_iommu_alloc(void) +{ + /* Only reserve DART space if machine has more than 2GB of RAM + * or if requested with iommu=on on cmdline. + */ + if (lmb_end_of_DRAM() <= 0x80000000ull && + get_property(of_chosen, "linux,iommu-force-on", NULL) == NULL) + return; + /* 512 pages (2MB) is max DART tablesize. */ + dart_tablesize = 1UL << 21; + /* 16MB (1 << 24) alignment. We allocate a full 16Mb chuck since we + * will blow up an entire large page anyway in the kernel mapping + */ + dart_tablebase = (unsigned long) + abs_to_virt(lmb_alloc_base(1UL<<24, 1UL<<24, 0x80000000L)); - + printk(KERN_INFO "U3-DART allocated at: %lx\n", dart_tablebase); +} diff -Nru a/arch/ppc64/kernel/pmac_pci.c b/arch/ppc64/kernel/pmac_pci.c --- a/arch/ppc64/kernel/pmac_pci.c 2004-09-26 10:25:56 -07:00 +++ b/arch/ppc64/kernel/pmac_pci.c 2004-09-26 10:25:56 -07:00 @@ -746,6 +746,9 @@ * the exception of U3/AGP (hook into pci_set_mwi) */ pci_cache_line_size = 16; /* 64 bytes */ + + /* Allow all IO */ + io_page_mask = -1; } /* diff -Nru a/arch/ppc64/kernel/pmac_setup.c b/arch/ppc64/kernel/pmac_setup.c --- a/arch/ppc64/kernel/pmac_setup.c 2004-09-26 10:25:55 -07:00 +++ b/arch/ppc64/kernel/pmac_setup.c 2004-09-26 10:25:55 -07:00 @@ -23,6 +23,8 @@ * bootup setup stuff.. */ +#undef DEBUG + #include #include #include @@ -63,7 +65,6 @@ #include #include #include -#include #include #include #include @@ -73,6 +74,13 @@ #include "pmac.h" +#ifdef DEBUG +#define DBG(fmt...) udbg_printf(fmt) +#else +#define DBG(fmt...) +#endif + + static int current_root_goodness = -1; #define DEFAULT_ROOT_DEVICE Root_SDA1 /* sda1 - slightly silly choice */ @@ -81,10 +89,6 @@ extern void udbg_init_scc(struct device_node *np); -#ifdef CONFIG_BOOTX_TEXT -void pmac_progress(char *s, unsigned short hex); -#endif - void __pmac pmac_show_cpuinfo(struct seq_file *m) { struct device_node *np; @@ -134,28 +138,20 @@ void __init pmac_setup_arch(void) { - struct device_node *cpu; - int *fp; - unsigned long pvr; - - pvr = PVR_VER(mfspr(PVR)); - - /* Set loops_per_jiffy to a half-way reasonable value, - for use until calibrate_delay gets called. */ - cpu = find_type_devices("cpu"); - if (cpu != 0) { - fp = (int *) get_property(cpu, "clock-frequency", NULL); - if (fp != 0) { - if (pvr == 4 || pvr >= 8) - /* 604, G3, G4 etc. */ - loops_per_jiffy = *fp / HZ; - else - /* 601, 603, etc. */ - loops_per_jiffy = *fp / (2*HZ); - } else - loops_per_jiffy = 50000000 / HZ; + /* init to some ~sane value until calibrate_delay() runs */ + loops_per_jiffy = 50000000; + + /* Probe motherboard chipset */ + pmac_feature_init(); +#if 0 + /* Lock-enable the SCC channel used for debug */ + if (sccdbg) { + np = of_find_node_by_name(NULL, "escc"); + if (np) + pmac_call_feature(PMAC_FTR_SCC_ENABLE, np, + PMAC_SCC_ASYNC | PMAC_SCC_FLAG_XMON, 1); } - +#endif /* We can NAP */ powersave_nap = 1; @@ -183,67 +179,13 @@ #endif } -extern char *bootpath; -extern char *bootdevice; -void *boot_host; -int boot_target; -int boot_part; -extern dev_t boot_dev; - #ifdef CONFIG_SCSI -void __init note_scsi_host(struct device_node *node, void *host) +void note_scsi_host(struct device_node *node, void *host) { - int l; - char *p; - - l = strlen(node->full_name); - if (bootpath != NULL && bootdevice != NULL - && strncmp(node->full_name, bootdevice, l) == 0 - && (bootdevice[l] == '/' || bootdevice[l] == 0)) { - boot_host = host; - /* - * There's a bug in OF 1.0.5. (Why am I not surprised.) - * If you pass a path like scsi/sd@1:0 to canon, it returns - * something like /bandit@F2000000/gc@10/53c94@10000/sd@0,0 - * That is, the scsi target number doesn't get preserved. - * So we pick the target number out of bootpath and use that. - */ - p = strstr(bootpath, "/sd@"); - if (p != NULL) { - p += 4; - boot_target = simple_strtoul(p, NULL, 10); - p = strchr(p, ':'); - if (p != NULL) - boot_part = simple_strtoul(p + 1, NULL, 10); - } - } + /* Obsolete */ } #endif -#if defined(CONFIG_BLK_DEV_IDE) && defined(CONFIG_BLK_DEV_IDE_PMAC) -static dev_t __init find_ide_boot(void) -{ - char *p; - int n; - dev_t __init pmac_find_ide_boot(char *bootdevice, int n); - - if (bootdevice == NULL) - return 0; - p = strrchr(bootdevice, '/'); - if (p == NULL) - return 0; - n = p - bootdevice; - - return pmac_find_ide_boot(bootdevice, n); -} -#endif /* CONFIG_BLK_DEV_IDE && CONFIG_BLK_DEV_IDE_PMAC */ - -void __init find_boot_device(void) -{ -#if defined(CONFIG_BLK_DEV_IDE) && defined(CONFIG_BLK_DEV_IDE_PMAC) - boot_dev = find_ide_boot(); -#endif -} static int initializing = 1; @@ -258,7 +200,7 @@ /* can't be __init - can be called whenever a disk is first accessed */ void __pmac note_bootable_part(dev_t dev, int part, int goodness) { - static int found_boot = 0; + extern dev_t boot_dev; char *p; if (!initializing) @@ -270,10 +212,6 @@ if (p != NULL && (p == saved_command_line || p[-1] == ' ')) return; - if (!found_boot) { - find_boot_device(); - found_boot = 1; - } if (!boot_dev || dev == boot_dev) { ROOT_DEV = dev + part; boot_dev = 0; @@ -313,21 +251,73 @@ } #endif /* CONFIG_BOOTX_TEXT */ +static void __init init_boot_display(void) +{ + char *name; + struct device_node *np = NULL; + int rc = -ENODEV; + + printk("trying to initialize btext ...\n"); + + name = (char *)get_property(of_chosen, "linux,stdout-path", NULL); + if (name != NULL) { + np = of_find_node_by_path(name); + if (np != NULL) { + if (strcmp(np->type, "display") != 0) { + printk("boot stdout isn't a display !\n"); + of_node_put(np); + np = NULL; + } + } + } + if (np) + rc = btext_initialize(np); + if (rc == 0) + return; + + for (np = NULL; (np = of_find_node_by_type(np, "display"));) { + if (get_property(np, "linux,opened", NULL)) { + printk("trying %s ...\n", np->full_name); + rc = btext_initialize(np); + printk("result: %d\n", rc); + } + if (rc == 0) + return; + } +} + /* * Early initialization. - * Relocation is on but do not reference unbolted pages - * Also, device-tree hasn't been "finished", so don't muck with - * it too much */ void __init pmac_init_early(void) { - hpte_init_pSeries(); + DBG(" -> pmac_init_early\n"); + + /* Initialize hash table, from now on, we can take hash faults + * and call ioremap + */ + hpte_init_native(); + /* Init SCC */ + if (strstr(cmd_line, "sccdbg")) { + sccdbg = 1; + udbg_init_scc(NULL); + } + + else { #ifdef CONFIG_BOOTX_TEXT - ppc_md.udbg_putc = btext_putc; - ppc_md.udbg_getc = dummy_getc; - ppc_md.udbg_getc_poll = dummy_getc_poll; + init_boot_display(); + + ppc_md.udbg_putc = btext_putc; + ppc_md.udbg_getc = dummy_getc; + ppc_md.udbg_getc_poll = dummy_getc_poll; #endif /* CONFIG_BOOTX_TEXT */ + } + + /* Setup interrupt mapping options */ + naca->interrupt_controller = IC_OPEN_PIC; + + DBG(" <- pmac_init_early\n"); } extern void* OpenPIC_Addr; @@ -417,60 +407,19 @@ core_initcall(pmac_irq_cascade_init); -void __init pmac_init(unsigned long r3, unsigned long r4, unsigned long r5, - unsigned long r6, unsigned long r7) -{ - /* Probe motherboard chipset */ - pmac_feature_init(); - - /* Init SCC */ - if (strstr(cmd_line, "sccdbg")) { - sccdbg = 1; - udbg_init_scc(NULL); - } - - /* Fill up the machine description */ - ppc_md.setup_arch = pmac_setup_arch; - ppc_md.get_cpuinfo = pmac_show_cpuinfo; - - ppc_md.init_IRQ = pmac_init_IRQ; - ppc_md.get_irq = openpic_get_irq; - - ppc_md.pcibios_fixup = pmac_pcibios_fixup; - - ppc_md.restart = pmac_restart; - ppc_md.power_off = pmac_power_off; - ppc_md.halt = pmac_halt; - - ppc_md.get_boot_time = pmac_get_boot_time; - ppc_md.set_rtc_time = pmac_set_rtc_time; - ppc_md.get_rtc_time = pmac_get_rtc_time; - ppc_md.calibrate_decr = pmac_calibrate_decr; - - ppc_md.feature_call = pmac_do_feature_call; - - -#ifdef CONFIG_BOOTX_TEXT - ppc_md.progress = pmac_progress; -#endif /* CONFIG_BOOTX_TEXT */ - - if (ppc_md.progress) ppc_md.progress("pmac_init(): exit", 0); - -} - -#ifdef CONFIG_BOOTX_TEXT -void __init pmac_progress(char *s, unsigned short hex) +static void __init pmac_progress(char *s, unsigned short hex) { if (sccdbg) { udbg_puts(s); - udbg_putc('\n'); + udbg_puts("\n"); } +#ifdef CONFIG_BOOTX_TEXT else if (boot_text_mapped) { btext_drawstring(s); - btext_drawchar('\n'); + btext_drawstring("\n"); } -} #endif /* CONFIG_BOOTX_TEXT */ +} static int __init pmac_declare_of_platform_devices(void) { @@ -489,3 +438,43 @@ } device_initcall(pmac_declare_of_platform_devices); + +/* + * Called very early, MMU is off, device-tree isn't unflattened + */ +static int __init pmac_probe(int platform) +{ + if (platform != PLATFORM_POWERMAC) + return 0; + +#ifdef CONFIG_PMAC_DART + /* + * On U3, the DART (iommu) must be allocated now since it + * has an impact on htab_initialize (due to the large page it + * occupies having to be broken up so the DART itself is not + * part of the cacheable linar mapping + */ + pmac_iommu_alloc(); +#endif /* CONFIG_PMAC_DART */ + + return 1; +} + +struct machdep_calls __initdata pmac_md = { + .probe = pmac_probe, + .setup_arch = pmac_setup_arch, + .init_early = pmac_init_early, + .get_cpuinfo = pmac_show_cpuinfo, + .init_IRQ = pmac_init_IRQ, + .get_irq = openpic_get_irq, + .pcibios_fixup = pmac_pcibios_fixup, + .restart = pmac_restart, + .power_off = pmac_power_off, + .halt = pmac_halt, + .get_boot_time = pmac_get_boot_time, + .set_rtc_time = pmac_set_rtc_time, + .get_rtc_time = pmac_get_rtc_time, + .calibrate_decr = pmac_calibrate_decr, + .feature_call = pmac_do_feature_call, + .progress = pmac_progress, +}; diff -Nru a/arch/ppc64/kernel/ppc_ksyms.c b/arch/ppc64/kernel/ppc_ksyms.c --- a/arch/ppc64/kernel/ppc_ksyms.c 2004-09-26 10:25:55 -07:00 +++ b/arch/ppc64/kernel/ppc_ksyms.c 2004-09-26 10:25:55 -07:00 @@ -119,7 +119,6 @@ EXPORT_SYMBOL(kernel_thread); EXPORT_SYMBOL(flush_instruction_cache); -EXPORT_SYMBOL(_get_PVR); EXPORT_SYMBOL(giveup_fpu); #ifdef CONFIG_ALTIVEC EXPORT_SYMBOL(giveup_altivec); diff -Nru a/arch/ppc64/kernel/process.c b/arch/ppc64/kernel/process.c --- a/arch/ppc64/kernel/process.c 2004-09-26 10:25:56 -07:00 +++ b/arch/ppc64/kernel/process.c 2004-09-26 10:25:56 -07:00 @@ -397,9 +397,20 @@ /* Check whether the e_entry function descriptor entries * need to be relocated before we can use them. */ - if ( load_addr != 0 ) { + if (load_addr != 0) { entry += load_addr; toc += load_addr; + } + + /* + * If we exec out of a kernel thread then thread.regs will not be + * set. Do it now. + */ + if (!current->thread.regs) { + unsigned long childregs = (unsigned long)current->thread_info + + THREAD_SIZE; + childregs -= sizeof(struct pt_regs); + current->thread.regs = childregs; } regs->nip = entry; diff -Nru a/arch/ppc64/kernel/prom.c b/arch/ppc64/kernel/prom.c --- a/arch/ppc64/kernel/prom.c 2004-09-26 10:25:57 -07:00 +++ b/arch/ppc64/kernel/prom.c 2004-09-26 10:25:57 -07:00 @@ -15,7 +15,7 @@ * 2 of the License, or (at your option) any later version. */ -#undef DEBUG_PROM +#undef DEBUG #include #include @@ -54,1757 +54,57 @@ #include #include "open_pic.h" -#ifdef CONFIG_LOGO_LINUX_CLUT224 -#include -extern const struct linux_logo logo_linux_clut224; -#endif - -/* - * Properties whose value is longer than this get excluded from our - * copy of the device tree. This value does need to be big enough to - * ensure that we don't lose things like the interrupt-map property - * on a PCI-PCI bridge. - */ -#define MAX_PROPERTY_LENGTH (1UL * 1024 * 1024) - -/* - * prom_init() is called very early on, before the kernel text - * and data have been mapped to KERNELBASE. At this point the code - * is running at whatever address it has been loaded at, so - * references to extern and static variables must be relocated - * explicitly. The procedure reloc_offset() returns the address - * we're currently running at minus the address we were linked at. - * (Note that strings count as static variables.) - * - * Because OF may have mapped I/O devices into the area starting at - * KERNELBASE, particularly on CHRP machines, we can't safely call - * OF once the kernel has been mapped to KERNELBASE. Therefore all - * OF calls should be done within prom_init(), and prom_init() - * and all routines called within it must be careful to relocate - * references as necessary. - * - * Note that the bss is cleared *after* prom_init runs, so we have - * to make sure that any static or extern variables it accesses - * are put in the data segment. - */ - - -#define PROM_BUG() do { \ - prom_printf("kernel BUG at %s line 0x%x!\n", \ - RELOC(__FILE__), __LINE__); \ - __asm__ __volatile__(".long " BUG_ILLEGAL_INSTR); \ -} while (0) - -#ifdef DEBUG_PROM -#define prom_debug(x...) prom_printf(x) +#ifdef DEBUG +#define DBG(fmt...) udbg_printf(fmt) #else -#define prom_debug(x...) +#define DBG(fmt...) #endif - struct pci_reg_property { struct pci_address addr; u32 size_hi; u32 size_lo; }; - struct isa_reg_property { u32 space; u32 address; u32 size; }; -struct pci_intr_map { - struct pci_address addr; - u32 dunno; - phandle int_ctrler; - u32 intr; -}; - typedef unsigned long interpret_func(struct device_node *, unsigned long, int, int, int); -#ifndef FB_MAX /* avoid pulling in all of the fb stuff */ -#define FB_MAX 8 -#endif - -/* prom structure */ -struct prom_t prom; - -char *prom_display_paths[FB_MAX] __initdata = { NULL, }; -phandle prom_display_nodes[FB_MAX] __initdata; -unsigned int prom_num_displays = 0; -char *of_stdout_device = NULL; - -static int iommu_force_on; -int ppc64_iommu_off; - extern struct rtas_t rtas; -extern unsigned long klimit; extern struct lmb lmb; +extern unsigned long klimit; -#define MAX_PHB (32 * 6) /* 32 drawers * 6 PHBs/drawer */ -struct of_tce_table of_tce_table[MAX_PHB + 1]; +static int __initdata dt_root_addr_cells; +static int __initdata dt_root_size_cells; +static int __initdata iommu_is_off; +typedef u32 cell_t; -char *bootpath = NULL; -char *bootdevice = NULL; +#if 0 +static struct boot_param_header *initial_boot_params __initdata; +#else +struct boot_param_header *initial_boot_params; +#endif -int boot_cpuid = 0; -#define MAX_CPU_THREADS 2 +static struct device_node *allnodes = NULL; -struct device_node *allnodes = NULL; /* use when traversing tree through the allnext, child, sibling, * or parent members of struct device_node. */ static rwlock_t devtree_lock = RW_LOCK_UNLOCKED; -extern unsigned long reloc_offset(void); - -extern void enter_prom(struct prom_args *args); -extern void copy_and_flush(unsigned long dest, unsigned long src, - unsigned long size, unsigned long offset); - -unsigned long dev_tree_size; -unsigned long _get_PIR(void); - -#ifdef CONFIG_HMT -struct { - unsigned int pir; - unsigned int threadid; -} hmt_thread_data[NR_CPUS]; -#endif /* CONFIG_HMT */ - -char testString[] = "LINUX\n"; - -/* - * This are used in calls to call_prom. The 4th and following - * arguments to call_prom should be 32-bit values. 64 bit values - * are truncated to 32 bits (and fortunately don't get interpreted - * as two arguments). - */ -#define ADDR(x) (u32) ((unsigned long)(x) - offset) - -/* This is the one and *ONLY* place where we actually call open - * firmware from, since we need to make sure we're running in 32b - * mode when we do. We switch back to 64b mode upon return. - */ - -#define PROM_ERROR (-1) - -static int __init call_prom(const char *service, int nargs, int nret, ...) -{ - int i; - unsigned long offset = reloc_offset(); - struct prom_t *_prom = PTRRELOC(&prom); - va_list list; - - _prom->args.service = ADDR(service); - _prom->args.nargs = nargs; - _prom->args.nret = nret; - _prom->args.rets = (prom_arg_t *)&(_prom->args.args[nargs]); - - va_start(list, nret); - for (i=0; i < nargs; i++) - _prom->args.args[i] = va_arg(list, prom_arg_t); - va_end(list); - - for (i=0; i < nret ;i++) - _prom->args.rets[i] = 0; - - enter_prom(&_prom->args); - - return (nret > 0)? _prom->args.rets[0]: 0; -} - - -static void __init prom_print(const char *msg) -{ - const char *p, *q; - unsigned long offset = reloc_offset(); - struct prom_t *_prom = PTRRELOC(&prom); - - if (_prom->stdout == 0) - return; - - for (p = msg; *p != 0; p = q) { - for (q = p; *q != 0 && *q != '\n'; ++q) - ; - if (q > p) - call_prom("write", 3, 1, _prom->stdout, p, q - p); - if (*q == 0) - break; - ++q; - call_prom("write", 3, 1, _prom->stdout, ADDR("\r\n"), 2); - } -} - - -static void __init prom_print_hex(unsigned long val) -{ - unsigned long offset = reloc_offset(); - int i, nibbles = sizeof(val)*2; - char buf[sizeof(val)*2+1]; - struct prom_t *_prom = PTRRELOC(&prom); - - for (i = nibbles-1; i >= 0; i--) { - buf[i] = (val & 0xf) + '0'; - if (buf[i] > '9') - buf[i] += ('a'-'0'-10); - val >>= 4; - } - buf[nibbles] = '\0'; - call_prom("write", 3, 1, _prom->stdout, buf, nibbles); -} - - -static void __init prom_printf(const char *format, ...) -{ - unsigned long offset = reloc_offset(); - const char *p, *q, *s; - va_list args; - unsigned long v; - struct prom_t *_prom = PTRRELOC(&prom); - - va_start(args, format); - for (p = PTRRELOC(format); *p != 0; p = q) { - for (q = p; *q != 0 && *q != '\n' && *q != '%'; ++q) - ; - if (q > p) - call_prom("write", 3, 1, _prom->stdout, p, q - p); - if (*q == 0) - break; - if (*q == '\n') { - ++q; - call_prom("write", 3, 1, _prom->stdout, - ADDR("\r\n"), 2); - continue; - } - ++q; - if (*q == 0) - break; - switch (*q) { - case 's': - ++q; - s = va_arg(args, const char *); - prom_print(s); - break; - case 'x': - ++q; - v = va_arg(args, unsigned long); - prom_print_hex(v); - break; - } - } -} - - -static void __init __attribute__((noreturn)) prom_panic(const char *reason) -{ - unsigned long offset = reloc_offset(); - - prom_print(PTRRELOC(reason)); - /* ToDo: should put up an SRC here */ - call_prom("exit", 0, 0); - - for (;;) /* should never get here */ - ; -} - - -static int __init prom_next_node(phandle *nodep) -{ - phandle node; - - if ((node = *nodep) != 0 - && (*nodep = call_prom("child", 1, 1, node)) != 0) - return 1; - if ((*nodep = call_prom("peer", 1, 1, node)) != 0) - return 1; - for (;;) { - if ((node = call_prom("parent", 1, 1, node)) == 0) - return 0; - if ((*nodep = call_prom("peer", 1, 1, node)) != 0) - return 1; - } -} - -static int __init prom_getprop(phandle node, const char *pname, - void *value, size_t valuelen) -{ - unsigned long offset = reloc_offset(); - - return call_prom("getprop", 4, 1, node, ADDR(pname), - (u32)(unsigned long) value, (u32) valuelen); -} - -static void __init prom_initialize_naca(void) -{ - phandle node; - char type[64]; - unsigned long num_cpus = 0; - unsigned long offset = reloc_offset(); - struct prom_t *_prom = PTRRELOC(&prom); - struct naca_struct *_naca = RELOC(naca); - struct systemcfg *_systemcfg = RELOC(systemcfg); - - /* NOTE: _naca->debug_switch is already initialized. */ - prom_debug("prom_initialize_naca: start...\n"); - - _naca->pftSize = 0; /* ilog2 of htab size. computed below. */ - - for (node = 0; prom_next_node(&node); ) { - type[0] = 0; - prom_getprop(node, "device_type", type, sizeof(type)); - - if (!strcmp(type, RELOC("cpu"))) { - num_cpus += 1; - - /* We're assuming *all* of the CPUs have the same - * d-cache and i-cache sizes... -Peter - */ - if ( num_cpus == 1 ) { - u32 size, lsize; - const char *dc, *ic; - - if (_systemcfg->platform == PLATFORM_POWERMAC){ - dc = "d-cache-block-size"; - ic = "i-cache-block-size"; - } else { - dc = "d-cache-line-size"; - ic = "i-cache-line-size"; - } - - prom_getprop(node, "d-cache-size", - &size, sizeof(size)); - - prom_getprop(node, dc, &lsize, sizeof(lsize)); - - _systemcfg->dCacheL1Size = size; - _systemcfg->dCacheL1LineSize = lsize; - _naca->dCacheL1LogLineSize = __ilog2(lsize); - _naca->dCacheL1LinesPerPage = PAGE_SIZE/lsize; - - prom_getprop(node, "i-cache-size", - &size, sizeof(size)); - - prom_getprop(node, ic, &lsize, sizeof(lsize)); - - _systemcfg->iCacheL1Size = size; - _systemcfg->iCacheL1LineSize = lsize; - _naca->iCacheL1LogLineSize = __ilog2(lsize); - _naca->iCacheL1LinesPerPage = PAGE_SIZE/lsize; - - if (_systemcfg->platform == PLATFORM_PSERIES_LPAR) { - u32 pft_size[2]; - prom_getprop(node, "ibm,pft-size", - &pft_size, sizeof(pft_size)); - /* pft_size[0] is the NUMA CEC cookie */ - _naca->pftSize = pft_size[1]; - } - } - } else if (!strcmp(type, RELOC("serial"))) { - phandle isa, pci; - struct isa_reg_property reg; - union pci_range ranges; - - if (_systemcfg->platform == PLATFORM_POWERMAC) - continue; - type[0] = 0; - prom_getprop(node, "ibm,aix-loc", type, sizeof(type)); - - if (strcmp(type, RELOC("S1"))) - continue; - - prom_getprop(node, "reg", ®, sizeof(reg)); - - isa = call_prom("parent", 1, 1, node); - if (!isa) - PROM_BUG(); - pci = call_prom("parent", 1, 1, isa); - if (!pci) - PROM_BUG(); - - prom_getprop(pci, "ranges", &ranges, sizeof(ranges)); - - if ( _prom->encode_phys_size == 32 ) - _naca->serialPortAddr = ranges.pci32.phys+reg.address; - else { - _naca->serialPortAddr = - ((((unsigned long)ranges.pci64.phys_hi) << 32) | - (ranges.pci64.phys_lo)) + reg.address; - } - } - } - - if (_systemcfg->platform == PLATFORM_POWERMAC) - _naca->interrupt_controller = IC_OPEN_PIC; - else { - _naca->interrupt_controller = IC_INVALID; - for (node = 0; prom_next_node(&node); ) { - type[0] = 0; - prom_getprop(node, "name", type, sizeof(type)); - if (strcmp(type, RELOC("interrupt-controller"))) - continue; - prom_getprop(node, "compatible", type, sizeof(type)); - if (strstr(type, RELOC("open-pic"))) - _naca->interrupt_controller = IC_OPEN_PIC; - else if (strstr(type, RELOC("ppc-xicp"))) - _naca->interrupt_controller = IC_PPC_XIC; - else - prom_printf("prom: failed to recognize" - " interrupt-controller\n"); - break; - } - } - - if (_naca->interrupt_controller == IC_INVALID) { - prom_printf("prom: failed to find interrupt-controller\n"); - PROM_BUG(); - } - - /* We gotta have at least 1 cpu... */ - if ( (_systemcfg->processorCount = num_cpus) < 1 ) - PROM_BUG(); - - _systemcfg->physicalMemorySize = lmb_phys_mem_size(); - - if (_systemcfg->platform == PLATFORM_PSERIES || - _systemcfg->platform == PLATFORM_POWERMAC) { - unsigned long rnd_mem_size, pteg_count; - - /* round mem_size up to next power of 2 */ - rnd_mem_size = 1UL << __ilog2(_systemcfg->physicalMemorySize); - if (rnd_mem_size < _systemcfg->physicalMemorySize) - rnd_mem_size <<= 1; - - /* # pages / 2 */ - pteg_count = (rnd_mem_size >> (12 + 1)); - - _naca->pftSize = __ilog2(pteg_count << 7); - } - - if (_naca->pftSize == 0) { - prom_printf("prom: failed to compute pftSize!\n"); - PROM_BUG(); - } - - /* Add an eye catcher and the systemcfg layout version number */ - strcpy(_systemcfg->eye_catcher, RELOC("SYSTEMCFG:PPC64")); - _systemcfg->version.major = SYSTEMCFG_MAJOR; - _systemcfg->version.minor = SYSTEMCFG_MINOR; - _systemcfg->processor = _get_PVR(); - - prom_debug("systemcfg->processorCount = 0x%x\n", - _systemcfg->processorCount); - prom_debug("systemcfg->physicalMemorySize = 0x%x\n", - _systemcfg->physicalMemorySize); - prom_debug("naca->pftSize = 0x%x\n", - _naca->pftSize); - prom_debug("systemcfg->dCacheL1LineSize = 0x%x\n", - _systemcfg->dCacheL1LineSize); - prom_debug("systemcfg->iCacheL1LineSize = 0x%x\n", - _systemcfg->iCacheL1LineSize); - prom_debug("naca->serialPortAddr = 0x%x\n", - _naca->serialPortAddr); - prom_debug("naca->interrupt_controller = 0x%x\n", - _naca->interrupt_controller); - prom_debug("systemcfg->platform = 0x%x\n", - _systemcfg->platform); - prom_debug("prom_initialize_naca: end...\n"); -} - - -static void __init early_cmdline_parse(void) -{ - unsigned long offset = reloc_offset(); - char *opt; -#ifndef CONFIG_PMAC_DART - struct systemcfg *_systemcfg = RELOC(systemcfg); -#endif - - opt = strstr(RELOC(cmd_line), RELOC("iommu=")); - if (opt) { - prom_printf("opt is:%s\n", opt); - opt += 6; - while (*opt && *opt == ' ') - opt++; - if (!strncmp(opt, RELOC("off"), 3)) - RELOC(ppc64_iommu_off) = 1; - else if (!strncmp(opt, RELOC("force"), 5)) - RELOC(iommu_force_on) = 1; - } - -#ifndef CONFIG_PMAC_DART - if (_systemcfg->platform == PLATFORM_POWERMAC) { - RELOC(ppc64_iommu_off) = 1; - prom_printf("DART disabled on PowerMac !\n"); - } -#endif -} - -#ifdef DEBUG_PROM -void prom_dump_lmb(void) -{ - unsigned long i; - unsigned long offset = reloc_offset(); - struct lmb *_lmb = PTRRELOC(&lmb); - - prom_printf("\nprom_dump_lmb:\n"); - prom_printf(" memory.cnt = 0x%x\n", - _lmb->memory.cnt); - prom_printf(" memory.size = 0x%x\n", - _lmb->memory.size); - for (i=0; i < _lmb->memory.cnt ;i++) { - prom_printf(" memory.region[0x%x].base = 0x%x\n", - i, _lmb->memory.region[i].base); - prom_printf(" .physbase = 0x%x\n", - _lmb->memory.region[i].physbase); - prom_printf(" .size = 0x%x\n", - _lmb->memory.region[i].size); - } - - prom_printf("\n reserved.cnt = 0x%x\n", - _lmb->reserved.cnt); - prom_printf(" reserved.size = 0x%x\n", - _lmb->reserved.size); - for (i=0; i < _lmb->reserved.cnt ;i++) { - prom_printf(" reserved.region[0x%x\n].base = 0x%x\n", - i, _lmb->reserved.region[i].base); - prom_printf(" .physbase = 0x%x\n", - _lmb->reserved.region[i].physbase); - prom_printf(" .size = 0x%x\n", - _lmb->reserved.region[i].size); - } -} -#endif /* DEBUG_PROM */ - -static void __init prom_initialize_lmb(void) -{ - phandle node; - char type[64]; - unsigned long i, offset = reloc_offset(); - struct prom_t *_prom = PTRRELOC(&prom); - struct systemcfg *_systemcfg = RELOC(systemcfg); - union lmb_reg_property reg; - unsigned long lmb_base, lmb_size; - unsigned long num_regs, bytes_per_reg = (_prom->encode_phys_size*2)/8; - - lmb_init(); - - /* XXX Quick HACK. Proper fix is to drop those structures and properly use - * #address-cells. PowerMac has #size-cell set to 1 and #address-cells to 2 - */ - if (_systemcfg->platform == PLATFORM_POWERMAC) - bytes_per_reg = 12; - - for (node = 0; prom_next_node(&node); ) { - type[0] = 0; - prom_getprop(node, "device_type", type, sizeof(type)); - - if (strcmp(type, RELOC("memory"))) - continue; - - num_regs = prom_getprop(node, "reg", ®, sizeof(reg)) - / bytes_per_reg; - - for (i=0; i < num_regs ;i++) { - if (_systemcfg->platform == PLATFORM_POWERMAC) { - lmb_base = ((unsigned long)reg.addrPM[i].address_hi) << 32; - lmb_base |= (unsigned long)reg.addrPM[i].address_lo; - lmb_size = reg.addrPM[i].size; - } else if (_prom->encode_phys_size == 32) { - lmb_base = reg.addr32[i].address; - lmb_size = reg.addr32[i].size; - } else { - lmb_base = reg.addr64[i].address; - lmb_size = reg.addr64[i].size; - } - - /* We limit memory to 2GB if the IOMMU is off */ - if (RELOC(ppc64_iommu_off)) { - if (lmb_base >= 0x80000000UL) - continue; - - if ((lmb_base + lmb_size) > 0x80000000UL) - lmb_size = 0x80000000UL - lmb_base; - } - - if (lmb_add(lmb_base, lmb_size) < 0) - prom_printf("Too many LMB's, discarding this one...\n"); - } - - } - - lmb_analyze(); -#ifdef DEBUG_PROM - prom_dump_lmb(); -#endif /* DEBUG_PROM */ -} - -static void __init -prom_instantiate_rtas(void) -{ - unsigned long offset = reloc_offset(); - struct prom_t *_prom = PTRRELOC(&prom); - struct rtas_t *_rtas = PTRRELOC(&rtas); - struct systemcfg *_systemcfg = RELOC(systemcfg); - ihandle prom_rtas; - u32 getprop_rval; - char hypertas_funcs[4]; - - prom_debug("prom_instantiate_rtas: start...\n"); - - prom_rtas = call_prom("finddevice", 1, 1, ADDR("/rtas")); - if (prom_rtas != (ihandle) -1) { - unsigned long x; - x = prom_getprop(prom_rtas, "ibm,hypertas-functions", - hypertas_funcs, sizeof(hypertas_funcs)); - - if (x != PROM_ERROR) { - prom_printf("Hypertas detected, assuming LPAR !\n"); - _systemcfg->platform = PLATFORM_PSERIES_LPAR; - } - - prom_getprop(prom_rtas, "rtas-size", - &getprop_rval, sizeof(getprop_rval)); - _rtas->size = getprop_rval; - prom_printf("instantiating rtas"); - if (_rtas->size != 0) { - unsigned long rtas_region = RTAS_INSTANTIATE_MAX; - - /* Grab some space within the first RTAS_INSTANTIATE_MAX bytes - * of physical memory (or within the RMO region) because RTAS - * runs in 32-bit mode and relocate off. - */ - if ( _systemcfg->platform == PLATFORM_PSERIES_LPAR ) { - struct lmb *_lmb = PTRRELOC(&lmb); - rtas_region = min(_lmb->rmo_size, RTAS_INSTANTIATE_MAX); - } - - _rtas->base = lmb_alloc_base(_rtas->size, PAGE_SIZE, rtas_region); - - prom_printf(" at 0x%x", _rtas->base); - - prom_rtas = call_prom("open", 1, 1, ADDR("/rtas")); - prom_printf("..."); - - if (call_prom("call-method", 3, 2, - ADDR("instantiate-rtas"), - prom_rtas, - _rtas->base) != PROM_ERROR) { - _rtas->entry = (long)_prom->args.rets[1]; - } - RELOC(rtas_rmo_buf) - = lmb_alloc_base(RTAS_RMOBUF_MAX, PAGE_SIZE, - rtas_region); - } - - if (_rtas->entry <= 0) { - prom_printf(" failed\n"); - } else { - prom_printf(" done\n"); - } - - prom_debug("rtas->base = 0x%x\n", _rtas->base); - prom_debug("rtas->entry = 0x%x\n", _rtas->entry); - prom_debug("rtas->size = 0x%x\n", _rtas->size); - } - prom_debug("prom_instantiate_rtas: end...\n"); -} - - -#ifdef CONFIG_PMAC_DART -static void __init prom_initialize_dart_table(void) -{ - unsigned long offset = reloc_offset(); - extern unsigned long dart_tablebase; - extern unsigned long dart_tablesize; - - /* Only reserve DART space if machine has more than 2GB of RAM - * or if requested with iommu=on on cmdline. - */ - if (lmb_end_of_DRAM() <= 0x80000000ull && !RELOC(iommu_force_on)) - return; - - /* 512 pages (2MB) is max DART tablesize. */ - RELOC(dart_tablesize) = 1UL << 21; - /* 16MB (1 << 24) alignment. We allocate a full 16Mb chuck since we - * will blow up an entire large page anyway in the kernel mapping - */ - RELOC(dart_tablebase) = (unsigned long) - abs_to_virt(lmb_alloc_base(1UL<<24, 1UL<<24, 0x80000000L)); - - prom_printf("Dart at: %x\n", RELOC(dart_tablebase)); -} -#endif /* CONFIG_PMAC_DART */ - -static void __init prom_initialize_tce_table(void) -{ - phandle node; - ihandle phb_node; - unsigned long offset = reloc_offset(); - char compatible[64], path[64], type[64], model[64]; - unsigned long i, table = 0; - unsigned long base, vbase, align; - unsigned int minalign, minsize; - struct of_tce_table *prom_tce_table = RELOC(of_tce_table); - unsigned long tce_entry, *tce_entryp; - - if (RELOC(ppc64_iommu_off)) - return; - - prom_debug("starting prom_initialize_tce_table\n"); - - /* Search all nodes looking for PHBs. */ - for (node = 0; prom_next_node(&node); ) { - if (table == MAX_PHB) { - prom_printf("WARNING: PCI host bridge ignored, " - "need to increase MAX_PHB\n"); - continue; - } - - compatible[0] = 0; - type[0] = 0; - model[0] = 0; - prom_getprop(node, "compatible", - compatible, sizeof(compatible)); - prom_getprop(node, "device_type", type, sizeof(type)); - prom_getprop(node, "model", model, sizeof(model)); - - /* Keep the old logic in tack to avoid regression. */ - if (compatible[0] != 0) { - if ((strstr(compatible, RELOC("python")) == NULL) && - (strstr(compatible, RELOC("Speedwagon")) == NULL) && - (strstr(compatible, RELOC("Winnipeg")) == NULL)) - continue; - } else if (model[0] != 0) { - if ((strstr(model, RELOC("ython")) == NULL) && - (strstr(model, RELOC("peedwagon")) == NULL) && - (strstr(model, RELOC("innipeg")) == NULL)) - continue; - } - - if ((type[0] == 0) || (strstr(type, RELOC("pci")) == NULL)) { - continue; - } - - if (prom_getprop(node, "tce-table-minalign", &minalign, - sizeof(minalign)) == PROM_ERROR) { - minalign = 0; - } - - if (prom_getprop(node, "tce-table-minsize", &minsize, - sizeof(minsize)) == PROM_ERROR) { - minsize = 4UL << 20; - } - - /* - * Even though we read what OF wants, we just set the table - * size to 4 MB. This is enough to map 2GB of PCI DMA space. - * By doing this, we avoid the pitfalls of trying to DMA to - * MMIO space and the DMA alias hole. - * - * On POWER4, firmware sets the TCE region by assuming - * each TCE table is 8MB. Using this memory for anything - * else will impact performance, so we always allocate 8MB. - * Anton - */ - if (__is_processor(PV_POWER4) || __is_processor(PV_POWER4p)) - minsize = 8UL << 20; - else - minsize = 4UL << 20; - - /* Align to the greater of the align or size */ - align = max(minalign, minsize); - - /* Carve out storage for the TCE table. */ - base = lmb_alloc(minsize, align); - - if ( !base ) { - prom_panic("ERROR, cannot find space for TCE table.\n"); - } - - vbase = (unsigned long)abs_to_virt(base); - - /* Save away the TCE table attributes for later use. */ - prom_tce_table[table].node = node; - prom_tce_table[table].base = vbase; - prom_tce_table[table].size = minsize; - - prom_debug("TCE table: 0x%x\n", table); - prom_debug("\tnode = 0x%x\n", node); - prom_debug("\tbase = 0x%x\n", vbase); - prom_debug("\tsize = 0x%x\n", minsize); - - /* Initialize the table to have a one-to-one mapping - * over the allocated size. - */ - tce_entryp = (unsigned long *)base; - for (i = 0; i < (minsize >> 3) ;tce_entryp++, i++) { - tce_entry = (i << PAGE_SHIFT); - tce_entry |= 0x3; - *tce_entryp = tce_entry; - } - - /* It seems OF doesn't null-terminate the path :-( */ - memset(path, 0, sizeof(path)); - /* Call OF to setup the TCE hardware */ - if (call_prom("package-to-path", 3, 1, node, - path, sizeof(path)-1) == PROM_ERROR) { - prom_printf("package-to-path failed\n"); - } else { - prom_printf("opening PHB %s", path); - } - - phb_node = call_prom("open", 1, 1, path); - if ( (long)phb_node <= 0) { - prom_printf("... failed\n"); - } else { - prom_printf("... done\n"); - } - call_prom("call-method", 6, 0, ADDR("set-64-bit-addressing"), - phb_node, -1, minsize, - (u32) base, (u32) (base >> 32)); - call_prom("close", 1, 0, phb_node); - - table++; - } - - /* Flag the first invalid entry */ - prom_tce_table[table].node = 0; - prom_debug("ending prom_initialize_tce_table\n"); -} - -/* - * With CHRP SMP we need to use the OF to start the other - * processors so we can't wait until smp_boot_cpus (the OF is - * trashed by then) so we have to put the processors into - * a holding pattern controlled by the kernel (not OF) before - * we destroy the OF. - * - * This uses a chunk of low memory, puts some holding pattern - * code there and sends the other processors off to there until - * smp_boot_cpus tells them to do something. The holding pattern - * checks that address until its cpu # is there, when it is that - * cpu jumps to __secondary_start(). smp_boot_cpus() takes care - * of setting those values. - * - * We also use physical address 0x4 here to tell when a cpu - * is in its holding pattern code. - * - * Fixup comment... DRENG / PPPBBB - Peter - * - * -- Cort - */ -static void __init prom_hold_cpus(unsigned long mem) -{ - unsigned long i; - unsigned int reg; - phandle node; - unsigned long offset = reloc_offset(); - char type[64], *path; - int cpuid = 0; - unsigned int interrupt_server[MAX_CPU_THREADS]; - unsigned int cpu_threads, hw_cpu_num; - int propsize; - extern void __secondary_hold(void); - extern unsigned long __secondary_hold_spinloop; - extern unsigned long __secondary_hold_acknowledge; - unsigned long *spinloop - = (void *)virt_to_abs(&__secondary_hold_spinloop); - unsigned long *acknowledge - = (void *)virt_to_abs(&__secondary_hold_acknowledge); - unsigned long secondary_hold - = virt_to_abs(*PTRRELOC((unsigned long *)__secondary_hold)); - struct systemcfg *_systemcfg = RELOC(systemcfg); - struct prom_t *_prom = PTRRELOC(&prom); -#ifdef CONFIG_SMP - struct naca_struct *_naca = RELOC(naca); -#endif - - prom_debug("prom_hold_cpus: start...\n"); - prom_debug(" 1) spinloop = 0x%x\n", (unsigned long)spinloop); - prom_debug(" 1) *spinloop = 0x%x\n", *spinloop); - prom_debug(" 1) acknowledge = 0x%x\n", - (unsigned long)acknowledge); - prom_debug(" 1) *acknowledge = 0x%x\n", *acknowledge); - prom_debug(" 1) secondary_hold = 0x%x\n", secondary_hold); - - /* Set the common spinloop variable, so all of the secondary cpus - * will block when they are awakened from their OF spinloop. - * This must occur for both SMP and non SMP kernels, since OF will - * be trashed when we move the kernel. - */ - *spinloop = 0; - -#ifdef CONFIG_HMT - for (i=0; i < NR_CPUS; i++) { - RELOC(hmt_thread_data)[i].pir = 0xdeadbeef; - } -#endif - /* look for cpus */ - for (node = 0; prom_next_node(&node); ) { - type[0] = 0; - prom_getprop(node, "device_type", type, sizeof(type)); - if (strcmp(type, RELOC("cpu")) != 0) - continue; - - /* Skip non-configured cpus. */ - prom_getprop(node, "status", type, sizeof(type)); - if (strcmp(type, RELOC("okay")) != 0) - continue; - - reg = -1; - prom_getprop(node, "reg", ®, sizeof(reg)); - - path = (char *) mem; - memset(path, 0, 256); - if (call_prom("package-to-path", 3, 1, - node, path, 255) == PROM_ERROR) - continue; - - prom_debug("\ncpuid = 0x%x\n", cpuid); - prom_debug("cpu hw idx = 0x%x\n", reg); - - /* Init the acknowledge var which will be reset by - * the secondary cpu when it awakens from its OF - * spinloop. - */ - *acknowledge = (unsigned long)-1; - - propsize = prom_getprop(node, "ibm,ppc-interrupt-server#s", - &interrupt_server, - sizeof(interrupt_server)); - if (propsize < 0) { - /* no property. old hardware has no SMT */ - cpu_threads = 1; - interrupt_server[0] = reg; /* fake it with phys id */ - } else { - /* We have a threaded processor */ - cpu_threads = propsize / sizeof(u32); - if (cpu_threads > MAX_CPU_THREADS) { - prom_printf("SMT: too many threads!\n" - "SMT: found %x, max is %x\n", - cpu_threads, MAX_CPU_THREADS); - cpu_threads = 1; /* ToDo: panic? */ - } - } - - hw_cpu_num = interrupt_server[0]; - if (hw_cpu_num != _prom->cpu) { - /* Primary Thread of non-boot cpu */ - prom_printf("%x : starting cpu %s... ", cpuid, path); - call_prom("start-cpu", 3, 0, node, - secondary_hold, cpuid); - - for ( i = 0 ; (i < 100000000) && - (*acknowledge == ((unsigned long)-1)); i++ ) ; - - if (*acknowledge == cpuid) { - prom_printf("... done\n"); - /* We have to get every CPU out of OF, - * even if we never start it. */ - if (cpuid >= NR_CPUS) - goto next; - } else { - prom_printf("... failed: %x\n", *acknowledge); - } - } -#ifdef CONFIG_SMP - else - prom_printf("%x : booting cpu %s\n", cpuid, path); -#endif -next: -#ifdef CONFIG_SMP - /* Init paca for secondary threads. They start later. */ - for (i=1; i < cpu_threads; i++) { - cpuid++; - if (cpuid >= NR_CPUS) - continue; - prom_printf("%x : preparing thread ... ", - interrupt_server[i]); - if (_naca->smt_state) { - prom_printf("available\n"); - } else { - prom_printf("not available\n"); - } - } -#endif - cpuid++; - } -#ifdef CONFIG_HMT - /* Only enable HMT on processors that provide support. */ - if (__is_processor(PV_PULSAR) || - __is_processor(PV_ICESTAR) || - __is_processor(PV_SSTAR)) { - prom_printf(" starting secondary threads\n"); - - for (i = 0; i < NR_CPUS; i += 2) { - if (!cpu_online(i)) - continue; - - if (i == 0) { - unsigned long pir = _get_PIR(); - if (__is_processor(PV_PULSAR)) { - RELOC(hmt_thread_data)[i].pir = - pir & 0x1f; - } else { - RELOC(hmt_thread_data)[i].pir = - pir & 0x3ff; - } - } - } - } else { - prom_printf("Processor is not HMT capable\n"); - } -#endif - - if (cpuid > NR_CPUS) - prom_printf("WARNING: maximum CPUs (" __stringify(NR_CPUS) - ") exceeded: ignoring extras\n"); - - prom_debug("prom_hold_cpus: end...\n"); -} - -static void __init smt_setup(void) -{ - char *p, *q; - char my_smt_enabled = SMT_DYNAMIC; - ihandle prom_options = 0; - char option[9]; - unsigned long offset = reloc_offset(); - struct naca_struct *_naca = RELOC(naca); - char found = 0; - - if (strstr(RELOC(cmd_line), RELOC("smt-enabled="))) { - for (q = RELOC(cmd_line); (p = strstr(q, RELOC("smt-enabled="))) != 0; ) { - q = p + 12; - if (p > RELOC(cmd_line) && p[-1] != ' ') - continue; - found = 1; - if (q[0] == 'o' && q[1] == 'f' && - q[2] == 'f' && (q[3] == ' ' || q[3] == '\0')) { - my_smt_enabled = SMT_OFF; - } else if (q[0]=='o' && q[1] == 'n' && - (q[2] == ' ' || q[2] == '\0')) { - my_smt_enabled = SMT_ON; - } else { - my_smt_enabled = SMT_DYNAMIC; - } - } - } - if (!found) { - prom_options = call_prom("finddevice", 1, 1, ADDR("/options")); - if (prom_options != (ihandle) -1) { - prom_getprop(prom_options, "ibm,smt-enabled", - option, sizeof(option)); - if (option[0] != 0) { - found = 1; - if (!strcmp(option, RELOC("off"))) - my_smt_enabled = SMT_OFF; - else if (!strcmp(option, RELOC("on"))) - my_smt_enabled = SMT_ON; - else - my_smt_enabled = SMT_DYNAMIC; - } - } - } - - if (!found ) - my_smt_enabled = SMT_DYNAMIC; /* default to on */ - - _naca->smt_state = my_smt_enabled; -} - - -#ifdef CONFIG_BOOTX_TEXT - -/* This function will enable the early boot text when doing OF booting. This - * way, xmon output should work too - */ -static void __init setup_disp_fake_bi(ihandle dp) -{ - int width = 640, height = 480, depth = 8, pitch; - unsigned address; - struct pci_reg_property addrs[8]; - int i, naddrs; - char name[64]; - unsigned long offset = reloc_offset(); - - memset(name, 0, sizeof(name)); - prom_getprop(dp, "name", name, sizeof(name)); - name[sizeof(name)-1] = 0; - prom_printf("Initializing fake screen: %s\n", name); - - prom_getprop(dp, "width", &width, sizeof(width)); - prom_getprop(dp, "height", &height, sizeof(height)); - prom_getprop(dp, "depth", &depth, sizeof(depth)); - pitch = width * ((depth + 7) / 8); - prom_getprop(dp, "linebytes", &pitch, sizeof(pitch)); - if (pitch == 1) - pitch = 0x1000; /* for strange IBM display */ - address = 0; - - prom_printf("width %x height %x depth %x linebytes %x\n", - width, height, depth, depth); - - prom_getprop(dp, "address", &address, sizeof(address)); - if (address == 0) { - /* look for an assigned address with a size of >= 1MB */ - naddrs = prom_getprop(dp, "assigned-addresses", - addrs, sizeof(addrs)); - naddrs /= sizeof(struct pci_reg_property); - for (i = 0; i < naddrs; ++i) { - if (addrs[i].size_lo >= (1 << 20)) { - address = addrs[i].addr.a_lo; - /* use the BE aperture if possible */ - if (addrs[i].size_lo >= (16 << 20)) - address += (8 << 20); - break; - } - } - if (address == 0) { - prom_printf("Failed to get address of frame buffer\n"); - return; - } - } - btext_setup_display(width, height, depth, pitch, address); - prom_printf("Addr of fb: %x\n", address); - RELOC(boot_text_mapped) = 0; -} -#endif /* CONFIG_BOOTX_TEXT */ - -static void __init prom_init_client_services(unsigned long pp) -{ - unsigned long offset = reloc_offset(); - struct prom_t *_prom = PTRRELOC(&prom); - - /* Get a handle to the prom entry point before anything else */ - _prom->entry = pp; - - /* Init default value for phys size */ - _prom->encode_phys_size = 32; - - /* get a handle for the stdout device */ - _prom->chosen = call_prom("finddevice", 1, 1, ADDR("/chosen")); - if ((long)_prom->chosen <= 0) - prom_panic("cannot find chosen"); /* msg won't be printed :( */ - - /* get device tree root */ - _prom->root = call_prom("finddevice", 1, 1, ADDR("/")); - if ((long)_prom->root <= 0) - prom_panic("cannot find device tree root"); /* msg won't be printed :( */ -} - -static void __init prom_init_stdout(void) -{ - unsigned long offset = reloc_offset(); - struct prom_t *_prom = PTRRELOC(&prom); - u32 val; - - if (prom_getprop(_prom->chosen, "stdout", &val, sizeof(val)) <= 0) - prom_panic("cannot find stdout"); - - _prom->stdout = val; -} - -static int __init prom_find_machine_type(void) -{ - unsigned long offset = reloc_offset(); - struct prom_t *_prom = PTRRELOC(&prom); - char compat[256]; - int len, i = 0; - - len = prom_getprop(_prom->root, "compatible", - compat, sizeof(compat)-1); - if (len > 0) { - compat[len] = 0; - while (i < len) { - char *p = &compat[i]; - int sl = strlen(p); - if (sl == 0) - break; - if (strstr(p, RELOC("Power Macintosh")) || - strstr(p, RELOC("MacRISC4"))) - return PLATFORM_POWERMAC; - i += sl + 1; - } - } - /* Default to pSeries */ - return PLATFORM_PSERIES; -} - -static int __init prom_set_color(ihandle ih, int i, int r, int g, int b) -{ - unsigned long offset = reloc_offset(); - - return call_prom("call-method", 6, 1, ADDR("color!"), ih, i, b, g, r); -} - -/* - * If we have a display that we don't know how to drive, - * we will want to try to execute OF's open method for it - * later. However, OF will probably fall over if we do that - * we've taken over the MMU. - * So we check whether we will need to open the display, - * and if so, open it now. - */ -static unsigned long __init check_display(unsigned long mem) -{ - phandle node; - ihandle ih; - int i, j; - unsigned long offset = reloc_offset(); - struct prom_t *_prom = PTRRELOC(&prom); - char type[16], *path; - static unsigned char default_colors[] = { - 0x00, 0x00, 0x00, - 0x00, 0x00, 0xaa, - 0x00, 0xaa, 0x00, - 0x00, 0xaa, 0xaa, - 0xaa, 0x00, 0x00, - 0xaa, 0x00, 0xaa, - 0xaa, 0xaa, 0x00, - 0xaa, 0xaa, 0xaa, - 0x55, 0x55, 0x55, - 0x55, 0x55, 0xff, - 0x55, 0xff, 0x55, - 0x55, 0xff, 0xff, - 0xff, 0x55, 0x55, - 0xff, 0x55, 0xff, - 0xff, 0xff, 0x55, - 0xff, 0xff, 0xff - }; - const unsigned char *clut; - - _prom->disp_node = 0; - - prom_printf("Looking for displays\n"); - if (RELOC(of_stdout_device) != 0) - prom_printf("OF stdout is : %s\n", - PTRRELOC(RELOC(of_stdout_device))); - for (node = 0; prom_next_node(&node); ) { - type[0] = 0; - prom_getprop(node, "device_type", type, sizeof(type)); - if (strcmp(type, RELOC("display")) != 0) - continue; - /* It seems OF doesn't null-terminate the path :-( */ - path = (char *) mem; - memset(path, 0, 256); - - /* - * leave some room at the end of the path for appending extra - * arguments - */ - if (call_prom("package-to-path", 3, 1, node, path, 250) < 0) - continue; - prom_printf("found display : %s\n", path); - - /* - * If this display is the device that OF is using for stdout, - * move it to the front of the list. - */ - mem += strlen(path) + 1; - i = RELOC(prom_num_displays); - RELOC(prom_num_displays) = i + 1; - if (RELOC(of_stdout_device) != 0 && i > 0 - && strcmp(PTRRELOC(RELOC(of_stdout_device)), path) == 0) { - for (; i > 0; --i) { - RELOC(prom_display_paths[i]) - = RELOC(prom_display_paths[i-1]); - RELOC(prom_display_nodes[i]) - = RELOC(prom_display_nodes[i-1]); - } - _prom->disp_node = node; - } - RELOC(prom_display_paths[i]) = PTRUNRELOC(path); - RELOC(prom_display_nodes[i]) = node; - if (_prom->disp_node == 0) - _prom->disp_node = node; - if (RELOC(prom_num_displays) >= FB_MAX) - break; - } - prom_printf("Opening displays...\n"); - for (j = RELOC(prom_num_displays) - 1; j >= 0; j--) { - path = PTRRELOC(RELOC(prom_display_paths[j])); - prom_printf("opening display : %s", path); - ih = call_prom("open", 1, 1, path); - if (ih == (ihandle)0 || ih == (ihandle)-1) { - prom_printf("... failed\n"); - continue; - } - - prom_printf("... done\n"); - - /* Setup a useable color table when the appropriate - * method is available. Should update this to set-colors */ - clut = RELOC(default_colors); - for (i = 0; i < 32; i++, clut += 3) - if (prom_set_color(ih, i, clut[0], clut[1], - clut[2]) != 0) - break; - -#ifdef CONFIG_LOGO_LINUX_CLUT224 - clut = PTRRELOC(RELOC(logo_linux_clut224.clut)); - for (i = 0; i < RELOC(logo_linux_clut224.clutsize); i++, clut += 3) - if (prom_set_color(ih, i + 32, clut[0], clut[1], - clut[2]) != 0) - break; -#endif /* CONFIG_LOGO_LINUX_CLUT224 */ - } - - return DOUBLEWORD_ALIGN(mem); -} - -/* Return (relocated) pointer to this much memory: moves initrd if reqd. */ -static void __init *__make_room(unsigned long *mem_start, unsigned long *mem_end, - unsigned long needed, unsigned long align) -{ - void *ret; - - *mem_start = ALIGN(*mem_start, align); - if (*mem_start + needed > *mem_end) { -#ifdef CONFIG_BLK_DEV_INITRD - unsigned long offset = reloc_offset(); - /* FIXME: Apple OF doesn't map unclaimed mem. If this - * ever happened on G5, we'd need to fix. */ - unsigned long initrd_len; - - if (*mem_end != RELOC(initrd_start)) - prom_panic("No memory for copy_device_tree"); - - prom_printf("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; - memmove((void *)*mem_end, (void *)RELOC(initrd_start), - initrd_len); - RELOC(initrd_start) = *mem_end; - RELOC(initrd_end) = RELOC(initrd_start) + initrd_len; -#else - prom_panic("No memory for copy_device_tree"); -#endif - } - - ret = (void *)*mem_start; - *mem_start += needed; - - return ret; -} - -#define make_room(startp, endp, type) \ - __make_room(startp, endp, sizeof(type), __alignof__(type)) - -static void __init -inspect_node(phandle node, struct device_node *dad, - unsigned long *mem_start, unsigned long *mem_end, - struct device_node ***allnextpp) -{ - int l; - phandle child; - struct device_node *np; - struct property *pp, **prev_propp; - 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)); - - np->node = node; - **allnextpp = PTRUNRELOC(np); - *allnextpp = &np->allnext; - if (dad != 0) { - np->parent = PTRUNRELOC(dad); - /* we temporarily use the `next' field as `last_child'. */ - if (dad->next == 0) - dad->child = PTRUNRELOC(np); - else - dad->next->sibling = PTRUNRELOC(np); - dad->next = np; - } - - /* get and store all properties */ - prev_propp = &np->properties; - prev_name = RELOC(""); - for (;;) { - /* 32 is max len of name including nul. */ - namep = make_room(mem_start, mem_end, char[32]); - if (call_prom("nextprop", 3, 1, node, prev_name, namep) <= 0) { - /* No more nodes: unwind alloc */ - *mem_start = (unsigned long)namep; - break; - } - /* Trim off some if we can */ - *mem_start = DOUBLEWORD_ALIGN((unsigned long)namep - + strlen(namep) + 1); - pp = make_room(mem_start, mem_end, struct property); - pp->name = PTRUNRELOC(namep); - prev_name = namep; - - pp->length = call_prom("getproplen", 2, 1, node, namep); - if (pp->length < 0) - continue; - if (pp->length > MAX_PROPERTY_LENGTH) { - char path[128]; - - prom_printf("WARNING: ignoring large property "); - /* It seems OF doesn't null-terminate the path :-( */ - memset(path, 0, sizeof(path)); - if (call_prom("package-to-path", 3, 1, node, - path, sizeof(path)-1) > 0) - prom_printf("[%s] ", path); - prom_printf("%s length 0x%x\n", namep, pp->length); - continue; - } - valp = __make_room(mem_start, mem_end, pp->length, 1); - pp->value = PTRUNRELOC(valp); - call_prom("getprop", 4, 1, node, namep, valp, pp->length); - *prev_propp = PTRUNRELOC(pp); - prev_propp = &pp->next; - } - - /* 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 (prom_getprop(node, "ibm,phandle", - &ibm_phandle, sizeof(ibm_phandle)) > 0) - np->linux_phandle = ibm_phandle; - - /* get the node's full name */ - namep = (char *)*mem_start; - l = call_prom("package-to-path", 3, 1, node, - namep, *mem_end - *mem_start); - if (l >= 0) { - /* Didn't fit? Get more room. */ - if (l+1 > *mem_end - *mem_start) { - namep = __make_room(mem_start, mem_end, l+1, 1); - call_prom("package-to-path", 3, 1, node, namep, l); - } - np->full_name = PTRUNRELOC(namep); - namep[l] = '\0'; - *mem_start = DOUBLEWORD_ALIGN(*mem_start + l + 1); - } - - /* do all our children */ - child = call_prom("child", 1, 1, node); - while (child != (phandle)0) { - inspect_node(child, np, mem_start, mem_end, - allnextpp); - child = call_prom("peer", 1, 1, child); - } -} - -/* - * Make a copy of the device tree from the PROM. - */ -static unsigned long __init -copy_device_tree(unsigned long mem_start) -{ - phandle root; - struct device_node **allnextp; - unsigned long offset = reloc_offset(); - unsigned long mem_end; - - /* We pass mem_end-mem_start to OF: keep it well under 32-bit */ - mem_end = mem_start + 1024*1024*1024; -#ifdef CONFIG_BLK_DEV_INITRD - if (RELOC(initrd_start) && RELOC(initrd_start) > mem_start) - mem_end = RELOC(initrd_start); -#endif /* CONFIG_BLK_DEV_INITRD */ - - root = call_prom("peer", 1, 1, (phandle)0); - if (root == (phandle)0) { - prom_panic("couldn't get device tree root\n"); - } - allnextp = &RELOC(allnodes); - inspect_node(root, NULL, &mem_start, &mem_end, &allnextp); - *allnextp = NULL; - return mem_start; -} - -/* Verify bi_recs are good */ -static struct bi_record * __init prom_bi_rec_verify(struct bi_record *bi_recs) -{ - struct bi_record *first, *last; - - prom_debug("birec_verify: r6=0x%x\n", (unsigned long)bi_recs); - if (bi_recs != NULL) - prom_debug(" tag=0x%x\n", bi_recs->tag); - - if ( bi_recs == NULL || bi_recs->tag != BI_FIRST ) - return NULL; - - last = (struct bi_record *)(long)bi_recs->data[0]; - - prom_debug(" last=0x%x\n", (unsigned long)last); - if (last != NULL) - prom_debug(" last_tag=0x%x\n", last->tag); - - if ( last == NULL || last->tag != BI_LAST ) - return NULL; - - first = (struct bi_record *)(long)last->data[0]; - prom_debug(" first=0x%x\n", (unsigned long)first); - - if ( first == NULL || first != bi_recs ) - return NULL; - - return bi_recs; -} - -static void __init prom_bi_rec_reserve(void) -{ - unsigned long offset = reloc_offset(); - struct prom_t *_prom = PTRRELOC(&prom); - struct bi_record *rec; - - if ( _prom->bi_recs != NULL) { - - for ( rec=_prom->bi_recs; - rec->tag != BI_LAST; - rec=bi_rec_next(rec) ) { - prom_debug("bi: 0x%x\n", rec->tag); - switch (rec->tag) { -#ifdef CONFIG_BLK_DEV_INITRD - case BI_INITRD: - RELOC(initrd_start) = (unsigned long)(rec->data[0]); - RELOC(initrd_end) = RELOC(initrd_start) + rec->data[1]; - break; -#endif /* CONFIG_BLK_DEV_INITRD */ - } - } - /* The next use of this field will be after relocation - * is enabled, so convert this physical address into a - * virtual address. - */ - _prom->bi_recs = PTRUNRELOC(_prom->bi_recs); - } -} - -/* - * We enter here early on, when the Open Firmware prom is still - * handling exceptions and the MMU hash table for us. - */ - -unsigned long __init -prom_init(unsigned long r3, unsigned long r4, unsigned long pp, - unsigned long r6, unsigned long r7) -{ - unsigned long mem; - ihandle prom_cpu; - phandle cpu_pkg; - unsigned long offset = reloc_offset(); - long l; - char *p, *d; - unsigned long phys; - u32 getprop_rval; - struct systemcfg *_systemcfg; - struct paca_struct *lpaca = PTRRELOC(&paca[0]); - struct prom_t *_prom = PTRRELOC(&prom); - - /* First zero the BSS -- use memset, some arches don't have - * caches on yet */ - memset(PTRRELOC(&__bss_start), 0, __bss_stop - __bss_start); - - /* Setup systemcfg and NACA pointers now */ - RELOC(systemcfg) = _systemcfg = (struct systemcfg *)(SYSTEMCFG_VIRT_ADDR - offset); - RELOC(naca) = (struct naca_struct *)(NACA_VIRT_ADDR - offset); - - /* Init interface to Open Firmware and pickup bi-recs */ - prom_init_client_services(pp); - - /* Init prom stdout device */ - prom_init_stdout(); - - prom_debug("klimit=0x%x\n", RELOC(klimit)); - prom_debug("offset=0x%x\n", offset); - prom_debug("->mem=0x%x\n", RELOC(klimit) - offset); - - /* check out if we have bi_recs */ - _prom->bi_recs = prom_bi_rec_verify((struct bi_record *)r6); - if ( _prom->bi_recs != NULL ) { - RELOC(klimit) = PTRUNRELOC((unsigned long)_prom->bi_recs + - _prom->bi_recs->data[1]); - prom_debug("bi_recs=0x%x\n", (unsigned long)_prom->bi_recs); - prom_debug("new mem=0x%x\n", RELOC(klimit) - offset); - } - - /* If we don't have birec's or didn't find them, check for an initrd - * using the "yaboot" way - */ -#ifdef CONFIG_BLK_DEV_INITRD - if ( _prom->bi_recs == NULL && r3 && r4 && r4 != 0xdeadbeef) { - RELOC(initrd_start) = (r3 >= KERNELBASE) ? __pa(r3) : r3; - RELOC(initrd_end) = RELOC(initrd_start) + r4; - RELOC(initrd_below_start_ok) = 1; - } -#endif /* CONFIG_BLK_DEV_INITRD */ - - /* Default machine type. */ - _systemcfg->platform = prom_find_machine_type(); - - /* On pSeries, copy the CPU hold code */ - if (_systemcfg->platform == PLATFORM_PSERIES) - copy_and_flush(0, KERNELBASE - offset, 0x100, 0); - - /* Start storing things at klimit */ - mem = RELOC(klimit) - offset; - - /* Get the full OF pathname of the stdout device */ - p = (char *) mem; - memset(p, 0, 256); - call_prom("instance-to-path", 3, 1, _prom->stdout, p, 255); - RELOC(of_stdout_device) = PTRUNRELOC(p); - mem += strlen(p) + 1; - - getprop_rval = 1; - prom_getprop(_prom->root, "#size-cells", - &getprop_rval, sizeof(getprop_rval)); - _prom->encode_phys_size = (getprop_rval == 1) ? 32 : 64; - - /* Determine which cpu is actually running right _now_ */ - if (prom_getprop(_prom->chosen, "cpu", - &prom_cpu, sizeof(prom_cpu)) <= 0) - prom_panic("cannot find boot cpu"); - - cpu_pkg = call_prom("instance-to-package", 1, 1, prom_cpu); - prom_getprop(cpu_pkg, "reg", &getprop_rval, sizeof(getprop_rval)); - _prom->cpu = getprop_rval; - lpaca[0].hw_cpu_id = _prom->cpu; - - RELOC(boot_cpuid) = 0; - - prom_debug("Booting CPU hw index = 0x%x\n", _prom->cpu); - - /* Get the boot device and translate it to a full OF pathname. */ - p = (char *) mem; - l = prom_getprop(_prom->chosen, "bootpath", p, 1<<20); - if (l > 0) { - p[l] = 0; /* should already be null-terminated */ - RELOC(bootpath) = PTRUNRELOC(p); - mem += l + 1; - d = (char *) mem; - *d = 0; - call_prom("canon", 3, 1, p, d, 1<<20); - RELOC(bootdevice) = PTRUNRELOC(d); - mem = DOUBLEWORD_ALIGN(mem + strlen(d) + 1); - } - - RELOC(cmd_line[0]) = 0; - if ((long)_prom->chosen > 0) { - prom_getprop(_prom->chosen, "bootargs", p, sizeof(cmd_line)); - if (p != NULL && p[0] != 0) - strlcpy(RELOC(cmd_line), p, sizeof(cmd_line)); - } - - early_cmdline_parse(); - - prom_initialize_lmb(); - - prom_bi_rec_reserve(); - - mem = check_display(mem); - - if (_systemcfg->platform != PLATFORM_POWERMAC) - prom_instantiate_rtas(); - - /* Initialize some system info into the Naca early... */ - prom_initialize_naca(); - - smt_setup(); - - /* If we are on an SMP machine, then we *MUST* do the - * following, regardless of whether we have an SMP - * kernel or not. - */ - prom_hold_cpus(mem); - - prom_debug("after basic inits, mem=0x%x\n", mem); -#ifdef CONFIG_BLK_DEV_INITRD - prom_debug("initrd_start=0x%x\n", RELOC(initrd_start)); - prom_debug("initrd_end=0x%x\n", RELOC(initrd_end)); -#endif /* CONFIG_BLK_DEV_INITRD */ - prom_debug("copying OF device tree...\n"); - - mem = copy_device_tree(mem); - - RELOC(klimit) = mem + offset; - - prom_debug("new klimit is\n"); - prom_debug("klimit=0x%x\n", RELOC(klimit)); - prom_debug(" ->mem=0x%x\n", mem); - - lmb_reserve(0, __pa(RELOC(klimit))); - -#ifdef CONFIG_BLK_DEV_INITRD - if (RELOC(initrd_start)) { - unsigned long initrd_len; - initrd_len = RELOC(initrd_end) - RELOC(initrd_start); - - /* Move initrd if it's where we're going to copy kernel. */ - if (RELOC(initrd_start) < __pa(RELOC(klimit))) { - memmove((void *)mem, (void *)RELOC(initrd_start), - initrd_len); - RELOC(initrd_start) = mem; - RELOC(initrd_end) = mem + initrd_len; - } - - lmb_reserve(RELOC(initrd_start), initrd_len); - } -#endif /* CONFIG_BLK_DEV_INITRD */ - - if (_systemcfg->platform == PLATFORM_PSERIES) - prom_initialize_tce_table(); - -#ifdef CONFIG_PMAC_DART - if (_systemcfg->platform == PLATFORM_POWERMAC) - prom_initialize_dart_table(); -#endif - -#ifdef CONFIG_BOOTX_TEXT - if (_prom->disp_node) { - prom_printf("Setting up bi display...\n"); - setup_disp_fake_bi(_prom->disp_node); - } -#endif /* CONFIG_BOOTX_TEXT */ - - prom_printf("Calling quiesce ...\n"); - call_prom("quiesce", 0, 0); - phys = KERNELBASE - offset; - -#ifdef CONFIG_BLK_DEV_INITRD - /* If we had an initrd, we convert its address to virtual */ - if (RELOC(initrd_start)) { - RELOC(initrd_start) = (unsigned long)__va(RELOC(initrd_start)); - RELOC(initrd_end) = (unsigned long)__va(RELOC(initrd_end)); - } -#endif /* CONFIG_BLK_DEV_INITRD */ - - prom_printf("returning from prom_init\n"); - return phys; -} +/* export that to outside world */ +struct device_node *of_chosen; /* * Find the device_node with a given phandle. */ -static struct device_node * __devinit -find_phandle(phandle ph) +static struct device_node * find_phandle(phandle ph) { struct device_node *np; @@ -1817,8 +117,7 @@ /* * Find the interrupt parent of a node. */ -static struct device_node * __devinit -intr_parent(struct device_node *p) +static struct device_node * __devinit intr_parent(struct device_node *p) { phandle *parp; @@ -1859,14 +158,14 @@ * Map an interrupt from a device up to the platform interrupt * descriptor. */ -static int __devinit -map_interrupt(unsigned int **irq, struct device_node **ictrler, - struct device_node *np, unsigned int *ints, int nintrc) +static int __devinit map_interrupt(unsigned int **irq, struct device_node **ictrler, + struct device_node *np, unsigned int *ints, + int nintrc) { struct device_node *p, *ipar; unsigned int *imap, *imask, *ip; int i, imaplen, match; - int newintrc, newaddrc; + int newintrc = 0, newaddrc = 0; unsigned int *reg; int naddrc; @@ -1955,9 +254,9 @@ return nintrc; } -static unsigned long __init -finish_node_interrupts(struct device_node *np, unsigned long mem_start, - int measure_only) +static unsigned long __init finish_node_interrupts(struct device_node *np, + unsigned long mem_start, + int measure_only) { unsigned int *ints; int intlen, intrcells, intrcount; @@ -2018,9 +317,10 @@ return mem_start; } -static unsigned long __init -interpret_pci_props(struct device_node *np, unsigned long mem_start, - int naddrc, int nsizec, int measure_only) +static unsigned long __init interpret_pci_props(struct device_node *np, + unsigned long mem_start, + int naddrc, int nsizec, + int measure_only) { struct address_range *adr; struct pci_reg_property *pci_addrs; @@ -2046,9 +346,10 @@ return mem_start; } -static unsigned long __init -interpret_dbdma_props(struct device_node *np, unsigned long mem_start, - int naddrc, int nsizec, int measure_only) +static unsigned long __init interpret_dbdma_props(struct device_node *np, + unsigned long mem_start, + int naddrc, int nsizec, + int measure_only) { struct reg_property32 *rp; struct address_range *adr; @@ -2086,9 +387,10 @@ return mem_start; } -static unsigned long __init -interpret_macio_props(struct device_node *np, unsigned long mem_start, - int naddrc, int nsizec, int measure_only) +static unsigned long __init interpret_macio_props(struct device_node *np, + unsigned long mem_start, + int naddrc, int nsizec, + int measure_only) { struct reg_property32 *rp; struct address_range *adr; @@ -2126,9 +428,10 @@ return mem_start; } -static unsigned long __init -interpret_isa_props(struct device_node *np, unsigned long mem_start, - int naddrc, int nsizec, int measure_only) +static unsigned long __init interpret_isa_props(struct device_node *np, + unsigned long mem_start, + int naddrc, int nsizec, + int measure_only) { struct isa_reg_property *rp; struct address_range *adr; @@ -2154,9 +457,10 @@ return mem_start; } -static unsigned long __init -interpret_root_props(struct device_node *np, unsigned long mem_start, - int naddrc, int nsizec, int measure_only) +static unsigned long __init interpret_root_props(struct device_node *np, + unsigned long mem_start, + int naddrc, int nsizec, + int measure_only) { struct address_range *adr; int i, l; @@ -2184,21 +488,15 @@ return mem_start; } -static unsigned long __init -finish_node(struct device_node *np, unsigned long mem_start, - interpret_func *ifunc, int naddrc, int nsizec, int measure_only) +static unsigned long __init finish_node(struct device_node *np, + unsigned long mem_start, + interpret_func *ifunc, + int naddrc, int nsizec, + int measure_only) { struct device_node *child; int *ip; - np->name = get_property(np, "name", NULL); - np->type = get_property(np, "device_type", NULL); - - if (!np->name) - np->name = ""; - if (!np->type) - np->type = ""; - /* get the device addresses and interrupts */ if (ifunc != NULL) mem_start = ifunc(np, mem_start, naddrc, nsizec, measure_only); @@ -2249,24 +547,514 @@ /** * finish_device_tree is called once things are running normally * (i.e. with text and data mapped to the address they were linked at). - * It traverses the device tree and fills in the name, type, - * {n_}addrs and {n_}intrs fields of each node. + * It traverses the device tree and fills in some of the additional, + * fields in each node like {n_}addrs and {n_}intrs, the virt interrupt + * mapping is also initialized at this point. */ -void __init -finish_device_tree(void) +void __init finish_device_tree(void) { - unsigned long mem = klimit; + unsigned long mem, size; + + DBG(" -> finish_device_tree\n"); + if (naca->interrupt_controller == IC_INVALID) { + DBG("failed to configure interrupt controller type\n"); + panic("failed to configure interrupt controller type\n"); + } + + /* Initialize virtual IRQ map */ virt_irq_init(); - dev_tree_size = finish_node(allnodes, 0, NULL, 0, 0, 1); - mem = (long)abs_to_virt(lmb_alloc(dev_tree_size, - __alignof__(struct device_node))); - if (finish_node(allnodes, mem, NULL, 0, 0, 0) != mem + dev_tree_size) + /* Finish device-tree (pre-parsing some properties etc...) */ + size = finish_node(allnodes, 0, NULL, 0, 0, 1); + mem = (unsigned long)abs_to_virt(lmb_alloc(size, 128)); + if (finish_node(allnodes, mem, NULL, 0, 0, 0) != mem + size) BUG(); - rtas.dev = of_find_node_by_name(NULL, "rtas"); + + DBG(" <- finish_device_tree\n"); +} + +#ifdef DEBUG +#define printk udbg_printf +#endif + +static inline char *find_flat_dt_string(u32 offset) +{ + return ((char *)initial_boot_params) + initial_boot_params->off_dt_strings + + offset; +} + +/** + * This function is used to scan the flattened device-tree, it is + * used to extract the memory informations at boot before we can + * unflatten the tree + */ +static int __init scan_flat_dt(int (*it)(unsigned long node, + const char *full_path, void *data), + void *data) +{ + unsigned long p = ((unsigned long)initial_boot_params) + + initial_boot_params->off_dt_struct; + int rc = 0; + + do { + u32 tag = *((u32 *)p); + char *pathp; + + p += 4; + if (tag == OF_DT_END_NODE) + continue; + if (tag == OF_DT_END) + break; + if (tag == OF_DT_PROP) { + u32 sz = *((u32 *)p); + p += 8; + p = _ALIGN(p, sz >= 8 ? 8 : 4); + p += sz; + p = _ALIGN(p, 4); + continue; + } + if (tag != OF_DT_BEGIN_NODE) { + printk(KERN_WARNING "Invalid tag %x scanning flattened" + " device tree !\n", tag); + return -EINVAL; + } + pathp = (char *)p; + p = _ALIGN(p + strlen(pathp) + 1, 4); + rc = it(p, pathp, data); + if (rc != 0) + break; + } while(1); + + return rc; } +/** + * This function can be used within scan_flattened_dt callback to get + * access to properties + */ +static void* __init get_flat_dt_prop(unsigned long node, const char *name, + unsigned long *size) +{ + unsigned long p = node; + + do { + u32 tag = *((u32 *)p); + u32 sz, noff; + const char *nstr; + + p += 4; + if (tag != OF_DT_PROP) + return NULL; + + sz = *((u32 *)p); + noff = *((u32 *)(p + 4)); + p += 8; + p = _ALIGN(p, sz >= 8 ? 8 : 4); + + nstr = find_flat_dt_string(noff); + if (nstr == NULL) { + printk(KERN_WARNING "Can't find property index name !\n"); + return NULL; + } + if (strcmp(name, nstr) == 0) { + if (size) + *size = sz; + return (void *)p; + } + p += sz; + p = _ALIGN(p, 4); + } while(1); +} + +static void *__init unflatten_dt_alloc(unsigned long *mem, unsigned long size, + unsigned long align) +{ + void *res; + + *mem = _ALIGN(*mem, align); + res = (void *)*mem; + *mem += size; + + return res; +} + +static unsigned long __init unflatten_dt_node(unsigned long mem, + unsigned long *p, + struct device_node *dad, + struct device_node ***allnextpp) +{ + struct device_node *np; + struct property *pp, **prev_pp = NULL; + char *pathp; + u32 tag; + unsigned int l; + + tag = *((u32 *)(*p)); + if (tag != OF_DT_BEGIN_NODE) { + printk("Weird tag at start of node: %x\n", tag); + return mem; + } + *p += 4; + pathp = (char *)*p; + l = strlen(pathp) + 1; + *p = _ALIGN(*p + l, 4); + + np = unflatten_dt_alloc(&mem, sizeof(struct device_node) + l, + __alignof__(struct device_node)); + if (allnextpp) { + memset(np, 0, sizeof(*np)); + np->full_name = ((char*)np) + sizeof(struct device_node); + memcpy(np->full_name, pathp, l); + prev_pp = &np->properties; + **allnextpp = np; + *allnextpp = &np->allnext; + if (dad != NULL) { + np->parent = dad; + /* we temporarily use the `next' field as `last_child'. */ + if (dad->next == 0) + dad->child = np; + else + dad->next->sibling = np; + dad->next = np; + } + } + while(1) { + u32 sz, noff; + char *pname; + + tag = *((u32 *)(*p)); + if (tag != OF_DT_PROP) + break; + *p += 4; + sz = *((u32 *)(*p)); + noff = *((u32 *)((*p) + 4)); + *p = _ALIGN((*p) + 8, sz >= 8 ? 8 : 4); + + pname = find_flat_dt_string(noff); + if (pname == NULL) { + printk("Can't find property name in list !\n"); + break; + } + l = strlen(pname) + 1; + pp = unflatten_dt_alloc(&mem, sizeof(struct property), + __alignof__(struct property)); + if (allnextpp) { + if (strcmp(pname, "linux,phandle") == 0) { + np->node = *((u32 *)*p); + if (np->linux_phandle == 0) + np->linux_phandle = np->node; + } + if (strcmp(pname, "ibm,phandle") == 0) + np->linux_phandle = *((u32 *)*p); + pp->name = pname; + pp->length = sz; + pp->value = (void *)*p; + *prev_pp = pp; + prev_pp = &pp->next; + } + *p = _ALIGN((*p) + sz, 4); + } + if (allnextpp) { + *prev_pp = NULL; + np->name = get_property(np, "name", NULL); + np->type = get_property(np, "device_type", NULL); + + if (!np->name) + np->name = ""; + if (!np->type) + np->type = ""; + } + while (tag == OF_DT_BEGIN_NODE) { + mem = unflatten_dt_node(mem, p, np, allnextpp); + tag = *((u32 *)(*p)); + } + if (tag != OF_DT_END_NODE) { + printk("Weird tag at start of node: %x\n", tag); + return mem; + } + *p += 4; + return mem; +} + + +/** + * unflattens the device-tree passed by the firmware, creating the + * tree of struct device_node. It also fills the "name" and "type" + * pointers of the nodes so the normal device-tree walking functions + * can be used (this used to be done by finish_device_tree) + */ +void __init unflatten_device_tree(void) +{ + unsigned long start, mem, size; + struct device_node **allnextp = &allnodes; + char *p; + int l = 0; + + DBG(" -> unflatten_device_tree()\n"); + + /* First pass, scan for size */ + start = ((unsigned long)initial_boot_params) + + initial_boot_params->off_dt_struct; + size = unflatten_dt_node(0, &start, NULL, NULL); + + DBG(" size is %lx, allocating...\n", size); + + /* Allocate memory for the expanded device tree */ + mem = (unsigned long)abs_to_virt(lmb_alloc(size, + __alignof__(struct device_node))); + DBG(" unflattening...\n", mem); + + /* Second pass, do actual unflattening */ + start = ((unsigned long)initial_boot_params) + + initial_boot_params->off_dt_struct; + unflatten_dt_node(mem, &start, NULL, &allnextp); + if (*((u32 *)start) != OF_DT_END) + printk(KERN_WARNING "Weird tag at end of tree: %x\n", *((u32 *)start)); + *allnextp = NULL; + + /* Get pointer to OF "/chosen" node for use everywhere */ + of_chosen = of_find_node_by_path("/chosen"); + + /* Retreive command line */ + if (of_chosen != NULL) { + p = (char *)get_property(of_chosen, "bootargs", &l); + if (p != NULL && l > 0) + strlcpy(cmd_line, p, min(l, COMMAND_LINE_SIZE)); + } +#ifdef CONFIG_CMDLINE + if (l == 0) /* dbl check */ + strlcpy(cmd_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE); +#endif /* CONFIG_CMDLINE */ + + DBG("Command line is: %s\n", cmd_line); + + DBG(" <- unflatten_device_tree()\n"); +} + + +static int __init early_init_dt_scan_cpus(unsigned long node, + const char *full_path, void *data) +{ + char *type = get_flat_dt_prop(node, "device_type", NULL); + + /* We are scanning "cpu" nodes only */ + if (type == NULL || strcmp(type, "cpu") != 0) + return 0; + + /* On LPAR, look for the first ibm,pft-size property for the hash table size + */ + if (systemcfg->platform == PLATFORM_PSERIES_LPAR && naca->pftSize == 0) { + u32 *pft_size; + pft_size = (u32 *)get_flat_dt_prop(node, "ibm,pft-size", NULL); + if (pft_size != NULL) { + /* pft_size[0] is the NUMA CEC cookie */ + naca->pftSize = pft_size[1]; + } + } + + /* Check if it's the boot-cpu, set it's hw index in paca now */ + if (get_flat_dt_prop(node, "linux,boot-cpu", NULL) != NULL) { + u32 *prop = get_flat_dt_prop(node, "reg", NULL); + paca[0].hw_cpu_id = prop == NULL ? 0 : *prop; + } + + return 0; +} + +static int __init early_init_dt_scan_chosen(unsigned long node, + const char *full_path, void *data) +{ + u32 *prop; + + if (strcmp(full_path, "/chosen") != 0) + return 0; + + /* get platform type */ + prop = (u32 *)get_flat_dt_prop(node, "linux,platform", NULL); + if (prop == NULL) + return 0; + systemcfg->platform = *prop; + + /* check if iommu is forced off */ + if (get_flat_dt_prop(node, "linux,iommu-off", NULL) != NULL) + iommu_is_off = 1; + +#ifdef CONFIG_PPC_PSERIES + /* To help early debugging via the front panel, we retreive a minimal + * set of RTAS infos now if available + */ + { + u64 *basep, *entryp; + + basep = (u64*)get_flat_dt_prop(node, "linux,rtas-base", NULL); + entryp = (u64*)get_flat_dt_prop(node, "linux,rtas-entry", NULL); + prop = (u32*)get_flat_dt_prop(node, "linux,rtas-size", NULL); + if (basep && entryp && prop) { + rtas.base = *basep; + rtas.entry = *entryp; + rtas.size = *prop; + } + } +#endif /* CONFIG_PPC_PSERIES */ + + /* break now */ + return 1; +} + +static int __init early_init_dt_scan_root(unsigned long node, + const char *full_path, void *data) +{ + u32 *prop; + + if (strcmp(full_path, "/") != 0) + return 0; + + prop = (u32 *)get_flat_dt_prop(node, "#size-cells", NULL); + dt_root_size_cells = (prop == NULL) ? 1 : *prop; + + prop = (u32 *)get_flat_dt_prop(node, "#address-cells", NULL); + dt_root_addr_cells = (prop == NULL) ? 2 : *prop; + + /* break now */ + return 1; +} + +static unsigned long __init dt_mem_next_cell(int s, cell_t **cellp) +{ + cell_t *p = *cellp; + unsigned long r = 0; + + /* Ignore more than 2 cells */ + while (s > 2) { + p++; + s--; + } + while (s) { + r <<= 32; + r |= *(p++); + s--; + } + + *cellp = p; + return r; +} + + +static int __init early_init_dt_scan_memory(unsigned long node, + const char *full_path, void *data) +{ + char *type = get_flat_dt_prop(node, "device_type", NULL); + cell_t *reg, *endp; + unsigned long l; + + /* We are scanning "memory" nodes only */ + if (type == NULL || strcmp(type, "memory") != 0) + return 0; + + reg = (cell_t *)get_flat_dt_prop(node, "reg", &l); + if (reg == NULL) + return 0; + + endp = reg + (l / sizeof(cell_t)); + + DBG("memory scan node %s ...\n", full_path); + while ((endp - reg) >= (dt_root_addr_cells + dt_root_size_cells)) { + unsigned long base, size; + + base = dt_mem_next_cell(dt_root_addr_cells, ®); + size = dt_mem_next_cell(dt_root_size_cells, ®); + + if (size == 0) + continue; + DBG(" - %lx , %lx\n", base, size); + if (iommu_is_off) { + if (base >= 0x80000000ul) + continue; + if ((base + size) > 0x80000000ul) + size = 0x80000000ul - base; + } + lmb_add(base, size); + } + return 0; +} + +static void __init early_reserve_mem(void) +{ + u64 base, size; + u64 *reserve_map = (u64 *)(((unsigned long)initial_boot_params) + + initial_boot_params->off_mem_rsvmap); + while (1) { + base = *(reserve_map++); + size = *(reserve_map++); + if (size == 0) + break; + DBG("reserving: %lx -> %lx\n", base, size); + lmb_reserve(base, size); + } + +#if 0 + DBG("memory reserved, lmbs :\n"); + lmb_dump_all(); +#endif +} + +void __init early_init_devtree(void *params) +{ + DBG(" -> early_init_devtree()\n"); + + /* Setup flat device-tree pointer */ + initial_boot_params = params; + + /* By default, hash size is not set */ + naca->pftSize = 0; + + /* Retreive various informations from the /chosen node of the + * device-tree, including the platform type, initrd location and + * size, TCE reserve, and more ... + */ + scan_flat_dt(early_init_dt_scan_chosen, NULL); + + /* Scan memory nodes and rebuild LMBs */ + lmb_init(); + scan_flat_dt(early_init_dt_scan_root, NULL); + scan_flat_dt(early_init_dt_scan_memory, NULL); + lmb_analyze(); + systemcfg->physicalMemorySize = lmb_phys_mem_size(); + + DBG("Phys. mem: %lx\n", systemcfg->physicalMemorySize); + + /* Reserve LMB regions used by kernel, initrd, dt, etc... */ + early_reserve_mem(); + + DBG("Scanning CPUs ...\n"); + + /* Retreive hash table size from flattened tree */ + scan_flat_dt(early_init_dt_scan_cpus, NULL); + + /* If hash size wasn't obtained above, we calculate it now based on + * the total RAM size + */ + if (naca->pftSize == 0) { + unsigned long rnd_mem_size, pteg_count; + + /* round mem_size up to next power of 2 */ + rnd_mem_size = 1UL << __ilog2(systemcfg->physicalMemorySize); + if (rnd_mem_size < systemcfg->physicalMemorySize) + rnd_mem_size <<= 1; + + /* # pages / 2 */ + pteg_count = (rnd_mem_size >> (12 + 1)); + + naca->pftSize = __ilog2(pteg_count << 7); + } + + DBG("Hash pftSize: %x\n", (int)naca->pftSize); + DBG(" <- early_init_devtree()\n"); +} + +#undef printk + int prom_n_addr_cells(struct device_node* np) { @@ -2579,6 +1367,28 @@ EXPORT_SYMBOL(of_find_node_by_path); /** + * of_find_node_by_phandle - Find a node given a phandle + * @handle: phandle of the node to find + * + * Returns a node pointer with refcount incremented, use + * of_node_put() on it when done. + */ +struct device_node *of_find_node_by_phandle(phandle handle) +{ + struct device_node *np; + + read_lock(&devtree_lock); + for (np = allnodes; np != 0; np = np->allnext) + if (np->linux_phandle == handle) + break; + if (np) + of_node_get(np); + read_unlock(&devtree_lock); + return np; +} +EXPORT_SYMBOL(of_find_node_by_phandle); + +/** * of_find_all_nodes - Get next node in global list * @prev: Previous node or NULL to start iteration * of_node_put() will be called on it @@ -2837,6 +1647,7 @@ return 0; } + /* * Fix up the uninitialized fields in a new device node: * name, type, n_addrs, addrs, n_intrs, intrs, and pci-specific fields @@ -2922,12 +1733,14 @@ /* fixing up iommu_table */ +#ifdef CONFIG_PPC_PSERIES if (strcmp(node->name, "pci") == 0 && get_property(node, "ibm,dma-window", NULL)) { node->bussubno = node->busno; iommu_devnode_init(node); } else node->iommu_table = parent->iommu_table; +#endif /* CONFIG_PPC_PSERIES */ out: of_node_put(parent); @@ -3114,3 +1927,13 @@ } } #endif + + + + + + + + + + diff -Nru a/arch/ppc64/kernel/prom_init.c b/arch/ppc64/kernel/prom_init.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/ppc64/kernel/prom_init.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,1718 @@ +/* + * + * + * Procedures for interfacing to Open Firmware. + * + * Paul Mackerras August 1996. + * Copyright (C) 1996 Paul Mackerras. + * + * Adapted for 64bit PowerPC by Dave Engebretsen and Peter Bergner. + * {engebret|bergner}@us.ibm.com + * + * 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. + */ + +#undef DEBUG_PROM + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "open_pic.h" + +#ifdef CONFIG_LOGO_LINUX_CLUT224 +#include +extern const struct linux_logo logo_linux_clut224; +#endif + +/* + * Properties whose value is longer than this get excluded from our + * copy of the device tree. This value does need to be big enough to + * ensure that we don't lose things like the interrupt-map property + * on a PCI-PCI bridge. + */ +#define MAX_PROPERTY_LENGTH (1UL * 1024 * 1024) + +/* + * Eventually bump that one up + */ +#define DEVTREE_CHUNK_SIZE 0x100000 + +/* + * This is the size of the local memory reserve map that gets copied + * into the boot params passed to the kernel. That size is totally + * flexible as the kernel just reads the list until it encounters an + * entry with size 0, so it can be changed without breaking binary + * compatibility + */ +#define MEM_RESERVE_MAP_SIZE 8 + +/* + * prom_init() is called very early on, before the kernel text + * and data have been mapped to KERNELBASE. At this point the code + * is running at whatever address it has been loaded at, so + * references to extern and static variables must be relocated + * explicitly. The procedure reloc_offset() returns the address + * we're currently running at minus the address we were linked at. + * (Note that strings count as static variables.) + * + * Because OF may have mapped I/O devices into the area starting at + * KERNELBASE, particularly on CHRP machines, we can't safely call + * OF once the kernel has been mapped to KERNELBASE. Therefore all + * OF calls should be done within prom_init(), and prom_init() + * and all routines called within it must be careful to relocate + * references as necessary. + * + * Note that the bss is cleared *after* prom_init runs, so we have + * to make sure that any static or extern variables it accesses + * are put in the data segment. + */ + + +#define PROM_BUG() do { \ + prom_printf("kernel BUG at %s line 0x%x!\n", \ + RELOC(__FILE__), __LINE__); \ + __asm__ __volatile__(".long " BUG_ILLEGAL_INSTR); \ +} while (0) + +#ifdef DEBUG_PROM +#define prom_debug(x...) prom_printf(x) +#else +#define prom_debug(x...) +#endif + + +typedef u32 prom_arg_t; + +struct prom_args { + u32 service; + u32 nargs; + u32 nret; + prom_arg_t args[10]; + prom_arg_t *rets; /* Pointer to return values in args[16]. */ +}; + +struct prom_t { + unsigned long entry; + ihandle root; + ihandle chosen; + int cpu; + ihandle stdout; + ihandle disp_node; + struct prom_args args; + unsigned long version; + unsigned long root_size_cells; + unsigned long root_addr_cells; +}; + +struct pci_reg_property { + struct pci_address addr; + u32 size_hi; + u32 size_lo; +}; + +struct mem_map_entry { + u64 base; + u64 size; +}; + +typedef u32 cell_t; + +extern void __start(unsigned long r3, unsigned long r4, unsigned long r5); + +extern unsigned long reloc_offset(void); +extern void enter_prom(struct prom_args *args, unsigned long entry); +extern void copy_and_flush(unsigned long dest, unsigned long src, + unsigned long size, unsigned long offset); + +extern unsigned long klimit; + +//int global_width = 640, global_height = 480, global_depth = 8, global_pitch; +//unsigned global_address; +/* prom structure */ +static struct prom_t __initdata prom; + +#define PROM_SCRATCH_SIZE 256 + +static char __initdata of_stdout_device[256]; +static char __initdata prom_scratch[PROM_SCRATCH_SIZE]; + +static unsigned long __initdata dt_header_start; +static unsigned long __initdata dt_struct_start, dt_struct_end; +static unsigned long __initdata dt_string_start, dt_string_end; + +static unsigned long __initdata prom_initrd_start, prom_initrd_end; + +static int __initdata iommu_force_on; +static int __initdata ppc64_iommu_off; +static int __initdata of_platform; + +static char __initdata prom_cmd_line[COMMAND_LINE_SIZE]; + +static unsigned long __initdata alloc_top; +static unsigned long __initdata alloc_top_high; +static unsigned long __initdata alloc_bottom; +static unsigned long __initdata rmo_top; +static unsigned long __initdata ram_top; + +static struct mem_map_entry __initdata mem_reserve_map[MEM_RESERVE_MAP_SIZE]; +static int __initdata mem_reserve_cnt; + +static cell_t __initdata regbuf[1024]; + + +#define MAX_CPU_THREADS 2 + +/* TO GO */ +#ifdef CONFIG_HMT +struct { + unsigned int pir; + unsigned int threadid; +} hmt_thread_data[NR_CPUS]; +#endif /* CONFIG_HMT */ + +/* + * This are used in calls to call_prom. The 4th and following + * arguments to call_prom should be 32-bit values. 64 bit values + * are truncated to 32 bits (and fortunately don't get interpreted + * as two arguments). + */ +#define ADDR(x) (u32) ((unsigned long)(x) - offset) + +/* This is the one and *ONLY* place where we actually call open + * firmware from, since we need to make sure we're running in 32b + * mode when we do. We switch back to 64b mode upon return. + */ + +#define PROM_ERROR (-1) + +static int __init call_prom(const char *service, int nargs, int nret, ...) +{ + int i; + unsigned long offset = reloc_offset(); + struct prom_t *_prom = PTRRELOC(&prom); + va_list list; + + _prom->args.service = ADDR(service); + _prom->args.nargs = nargs; + _prom->args.nret = nret; + _prom->args.rets = (prom_arg_t *)&(_prom->args.args[nargs]); + + va_start(list, nret); + for (i=0; i < nargs; i++) + _prom->args.args[i] = va_arg(list, prom_arg_t); + va_end(list); + + for (i=0; i < nret ;i++) + _prom->args.rets[i] = 0; + + enter_prom(&_prom->args, _prom->entry); + + return (nret > 0) ? _prom->args.rets[0] : 0; +} + + +static unsigned int __init prom_claim(unsigned long virt, unsigned long size, + unsigned long align) +{ + return (unsigned int)call_prom("claim", 3, 1, + (prom_arg_t)virt, (prom_arg_t)size, + (prom_arg_t)align); +} + +static void __init prom_print(const char *msg) +{ + const char *p, *q; + unsigned long offset = reloc_offset(); + struct prom_t *_prom = PTRRELOC(&prom); + + if (_prom->stdout == 0) + return; + + for (p = msg; *p != 0; p = q) { + for (q = p; *q != 0 && *q != '\n'; ++q) + ; + if (q > p) + call_prom("write", 3, 1, _prom->stdout, p, q - p); + if (*q == 0) + break; + ++q; + call_prom("write", 3, 1, _prom->stdout, ADDR("\r\n"), 2); + } +} + + +static void __init prom_print_hex(unsigned long val) +{ + unsigned long offset = reloc_offset(); + int i, nibbles = sizeof(val)*2; + char buf[sizeof(val)*2+1]; + struct prom_t *_prom = PTRRELOC(&prom); + + for (i = nibbles-1; i >= 0; i--) { + buf[i] = (val & 0xf) + '0'; + if (buf[i] > '9') + buf[i] += ('a'-'0'-10); + val >>= 4; + } + buf[nibbles] = '\0'; + call_prom("write", 3, 1, _prom->stdout, buf, nibbles); +} + + +static void __init prom_printf(const char *format, ...) +{ + unsigned long offset = reloc_offset(); + const char *p, *q, *s; + va_list args; + unsigned long v; + struct prom_t *_prom = PTRRELOC(&prom); + + va_start(args, format); + for (p = PTRRELOC(format); *p != 0; p = q) { + for (q = p; *q != 0 && *q != '\n' && *q != '%'; ++q) + ; + if (q > p) + call_prom("write", 3, 1, _prom->stdout, p, q - p); + if (*q == 0) + break; + if (*q == '\n') { + ++q; + call_prom("write", 3, 1, _prom->stdout, + ADDR("\r\n"), 2); + continue; + } + ++q; + if (*q == 0) + break; + switch (*q) { + case 's': + ++q; + s = va_arg(args, const char *); + prom_print(s); + break; + case 'x': + ++q; + v = va_arg(args, unsigned long); + prom_print_hex(v); + break; + } + } +} + + +static void __init __attribute__((noreturn)) prom_panic(const char *reason) +{ + unsigned long offset = reloc_offset(); + + prom_print(PTRRELOC(reason)); + /* ToDo: should put up an SRC here */ + call_prom("exit", 0, 0); + + for (;;) /* should never get here */ + ; +} + + +static int __init prom_next_node(phandle *nodep) +{ + phandle node; + + if ((node = *nodep) != 0 + && (*nodep = call_prom("child", 1, 1, node)) != 0) + return 1; + if ((*nodep = call_prom("peer", 1, 1, node)) != 0) + return 1; + for (;;) { + if ((node = call_prom("parent", 1, 1, node)) == 0) + return 0; + if ((*nodep = call_prom("peer", 1, 1, node)) != 0) + return 1; + } +} + +static int __init prom_getprop(phandle node, const char *pname, + void *value, size_t valuelen) +{ + unsigned long offset = reloc_offset(); + + return call_prom("getprop", 4, 1, node, ADDR(pname), + (u32)(unsigned long) value, (u32) valuelen); +} + +static int __init prom_getproplen(phandle node, const char *pname) +{ + unsigned long offset = reloc_offset(); + + return call_prom("getproplen", 2, 1, node, ADDR(pname)); +} + +static int __init prom_setprop(phandle node, const char *pname, + void *value, size_t valuelen) +{ + unsigned long offset = reloc_offset(); + + return call_prom("setprop", 4, 1, node, ADDR(pname), + (u32)(unsigned long) value, (u32) valuelen); +} + + +/* + * Early parsing of the command line passed to the kernel, used for + * the options that affect the iommu + */ +static void __init early_cmdline_parse(void) +{ + unsigned long offset = reloc_offset(); + struct prom_t *_prom = PTRRELOC(&prom); + char *opt, *p; + int l = 0; + + RELOC(prom_cmd_line[0]) = 0; + p = RELOC(prom_cmd_line); + if ((long)_prom->chosen > 0) + l = prom_getprop(_prom->chosen, "bootargs", p, COMMAND_LINE_SIZE-1); +#ifdef CONFIG_CMDLINE + if (l == 0) /* dbl check */ + strlcpy(RELOC(prom_cmd_line), + RELOC(CONFIG_CMDLINE), sizeof(prom_cmd_line)); +#endif /* CONFIG_CMDLINE */ + prom_printf("command line: %s\n", RELOC(prom_cmd_line)); + + opt = strstr(RELOC(prom_cmd_line), RELOC("iommu=")); + if (opt) { + prom_printf("iommu opt is: %s\n", opt); + opt += 6; + while (*opt && *opt == ' ') + opt++; + if (!strncmp(opt, RELOC("off"), 3)) + RELOC(ppc64_iommu_off) = 1; + else if (!strncmp(opt, RELOC("force"), 5)) + RELOC(iommu_force_on) = 1; + } + +#ifndef CONFIG_PMAC_DART + if (RELOC(of_platform) == PLATFORM_POWERMAC) { + RELOC(ppc64_iommu_off) = 1; + prom_printf("DART disabled on PowerMac !\n"); + } +#endif +} + +/* + * Memory allocation strategy... our layout is normally: + * + * at 14Mb or more we vmlinux, then a gap and initrd. In some rare cases, initrd + * might end up beeing before the kernel though. We assume this won't override + * the final kernel at 0, we have no provision to handle that in this version, + * but it should hopefully never happen. + * + * alloc_top is set to the top of RMO, eventually shrink down if the TCEs overlap + * alloc_bottom is set to the top of kernel/initrd + * + * from there, allocations are done that way : rtas is allocated topmost, and + * the device-tree is allocated from the bottom. We try to grow the device-tree + * allocation as we progress. If we can't, then we fail, we don't currently have + * a facility to restart elsewhere, but that shouldn't be necessary neither + * + * Note that calls to reserve_mem have to be done explicitely, memory allocated + * with either alloc_up or alloc_down isn't automatically reserved. + */ + + +/* + * Allocates memory in the RMO upward from the kernel/initrd + * + * When align is 0, this is a special case, it means to allocate in place + * at the current location of alloc_bottom or fail (that is basically + * extending the previous allocation). Used for the device-tree flattening + */ +static unsigned long __init alloc_up(unsigned long size, unsigned long align) +{ + unsigned long offset = reloc_offset(); + unsigned long base = _ALIGN_UP(RELOC(alloc_bottom), align); + unsigned long addr = 0; + + prom_debug("alloc_up(%x, %x)\n", size, align); + if (RELOC(ram_top) == 0) + prom_panic("alloc_up() called with mem not initialized\n"); + + if (align) + base = _ALIGN_UP(RELOC(alloc_bottom), align); + else + base = RELOC(alloc_bottom); + + for(; (base + size) <= RELOC(alloc_top); + base = _ALIGN_UP(base + 0x100000, align)) { + prom_debug(" trying: 0x%x\n\r", base); + addr = (unsigned long)prom_claim(base, size, 0); + if ((int)addr != PROM_ERROR) + break; + addr = 0; + if (align == 0) + break; + } + if (addr == 0) + return 0; + RELOC(alloc_bottom) = addr; + + prom_debug(" -> %x\n", addr); + prom_debug(" alloc_bottom : %x\n", RELOC(alloc_bottom)); + prom_debug(" alloc_top : %x\n", RELOC(alloc_top)); + prom_debug(" alloc_top_hi : %x\n", RELOC(alloc_top_high)); + prom_debug(" rmo_top : %x\n", RELOC(rmo_top)); + prom_debug(" ram_top : %x\n", RELOC(ram_top)); + + return addr; +} + +/* + * Allocates memory downard, either from top of RMO, or if highmem + * is set, from the top of RAM. Note that this one doesn't handle + * failures. In does claim memory if highmem is not set. + */ +static unsigned long __init alloc_down(unsigned long size, unsigned long align, + int highmem) +{ + unsigned long offset = reloc_offset(); + unsigned long base, addr = 0; + + prom_debug("alloc_down(%x, %x, %s)\n", size, align, + highmem ? RELOC("(high)") : RELOC("(low)")); + if (RELOC(ram_top) == 0) + prom_panic("alloc_down() called with mem not initialized\n"); + + if (highmem) { + /* Carve out storage for the TCE table. */ + addr = _ALIGN_DOWN(RELOC(alloc_top_high) - size, align); + if (addr <= RELOC(alloc_bottom)) + return 0; + else { + /* Will we bump into the RMO ? If yes, check out that we + * didn't overlap existing allocations there, if we did, + * we are dead, we must be the first in town ! + */ + if (addr < RELOC(rmo_top)) { + /* Good, we are first */ + if (RELOC(alloc_top) == RELOC(rmo_top)) + RELOC(alloc_top) = RELOC(rmo_top) = addr; + else + return 0; + } + RELOC(alloc_top_high) = addr; + } + goto bail; + } + + base = _ALIGN_DOWN(RELOC(alloc_top) - size, align); + for(; base > RELOC(alloc_bottom); base = _ALIGN_DOWN(base - 0x100000, align)) { + prom_debug(" trying: 0x%x\n\r", base); + addr = (unsigned long)prom_claim(base, size, 0); + if ((int)addr != PROM_ERROR) + break; + addr = 0; + } + if (addr == 0) + return 0; + RELOC(alloc_top) = addr; + + bail: + prom_debug(" -> %x\n", addr); + prom_debug(" alloc_bottom : %x\n", RELOC(alloc_bottom)); + prom_debug(" alloc_top : %x\n", RELOC(alloc_top)); + prom_debug(" alloc_top_hi : %x\n", RELOC(alloc_top_high)); + prom_debug(" rmo_top : %x\n", RELOC(rmo_top)); + prom_debug(" ram_top : %x\n", RELOC(ram_top)); + + return addr; +} + +/* + * Parse a "reg" cell + */ +static unsigned long __init prom_next_cell(int s, cell_t **cellp) +{ + cell_t *p = *cellp; + unsigned long r = 0; + + /* Ignore more than 2 cells */ + while (s > 2) { + p++; + s--; + } + while (s) { + r <<= 32; + r |= *(p++); + s--; + } + + *cellp = p; + return r; +} + +/* + * Very dumb function for adding to the memory reserve list, but + * we don't need anything smarter at this point + * + * XXX Eventually check for collisions. They should NEVER happen + * if problems seem to show up, it would be a good start to track + * them down. + */ +static void reserve_mem(unsigned long base, unsigned long size) +{ + unsigned long offset = reloc_offset(); + unsigned long top = base + size; + unsigned long cnt = RELOC(mem_reserve_cnt); + + /* We need to always keep one empty entry so that we + * have our terminator with "size" set to 0 since we are + * dumb and just copy this entire array to the boot params + */ + base = _ALIGN_DOWN(base, PAGE_SIZE); + top = _ALIGN_DOWN(top, PAGE_SIZE); + size = top - base; + + if (cnt >= (MEM_RESERVE_MAP_SIZE - 1)) + prom_panic("Memory reserve map exhausted !\n"); + RELOC(mem_reserve_map)[cnt].base = base; + RELOC(mem_reserve_map)[cnt].size = size; + RELOC(mem_reserve_cnt) = cnt + 1; +} + +/* + * Initialize memory allocation mecanism, parse "memory" nodes and + * obtain that way the top of memory and RMO to setup out local allocator + */ +static void __init prom_init_mem(void) +{ + phandle node; + char *path, type[64]; + unsigned int plen; + cell_t *p, *endp; + unsigned long offset = reloc_offset(); + struct prom_t *_prom = PTRRELOC(&prom); + + /* + * We iterate the memory nodes to find + * 1) top of RMO (first node) + * 2) top of memory + */ + prom_debug("root_addr_cells: %x\n", (long)_prom->root_addr_cells); + prom_debug("root_size_cells: %x\n", (long)_prom->root_size_cells); + + prom_debug("scanning memory:\n"); + path = RELOC(prom_scratch); + + for (node = 0; prom_next_node(&node); ) { + type[0] = 0; + prom_getprop(node, "device_type", type, sizeof(type)); + + if (strcmp(type, RELOC("memory"))) + continue; + + plen = prom_getprop(node, "reg", RELOC(regbuf), sizeof(regbuf)); + if (plen > sizeof(regbuf)) { + prom_printf("memory node too large for buffer !\n"); + plen = sizeof(regbuf); + } + p = RELOC(regbuf); + endp = p + (plen / sizeof(cell_t)); + +#ifdef DEBUG_PROM + memset(path, 0, PROM_SCRATCH_SIZE); + call_prom("package-to-path", 3, 1, node, path, PROM_SCRATCH_SIZE-1); + prom_debug(" node %s :\n", path); +#endif /* DEBUG_PROM */ + + while ((endp - p) >= (_prom->root_addr_cells + _prom->root_size_cells)) { + unsigned long base, size; + + base = prom_next_cell(_prom->root_addr_cells, &p); + size = prom_next_cell(_prom->root_size_cells, &p); + + if (size == 0) + continue; + prom_debug(" %x %x\n", base, size); + if (base == 0) + RELOC(rmo_top) = size; + if ((base + size) > RELOC(ram_top)) + RELOC(ram_top) = base + size; + } + } + + /* Setup our top/bottom alloc points, that is top of RMO or top of + * segment 0 when running non-LPAR + */ + if ( RELOC(of_platform) == PLATFORM_PSERIES_LPAR ) + RELOC(alloc_top) = RELOC(rmo_top); + else + RELOC(alloc_top) = min(0x40000000ul, RELOC(ram_top)); + RELOC(alloc_bottom) = PAGE_ALIGN(RELOC(klimit) - offset + 0x4000); + RELOC(alloc_top_high) = RELOC(ram_top); + + /* Check if we have an initrd after the kernel, if we do move our bottom + * point to after it + */ + if (RELOC(prom_initrd_start)) { + if ((RELOC(prom_initrd_start) + RELOC(prom_initrd_end)) + > RELOC(alloc_bottom)) + RELOC(alloc_bottom) = PAGE_ALIGN(RELOC(prom_initrd_end)); + } + + prom_printf("memory layout at init:\n"); + prom_printf(" alloc_bottom : %x\n", RELOC(alloc_bottom)); + prom_printf(" alloc_top : %x\n", RELOC(alloc_top)); + prom_printf(" alloc_top_hi : %x\n", RELOC(alloc_top_high)); + prom_printf(" rmo_top : %x\n", RELOC(rmo_top)); + prom_printf(" ram_top : %x\n", RELOC(ram_top)); +} + + +/* + * Allocate room for and instanciate RTAS + */ +static void __init prom_instantiate_rtas(void) +{ + unsigned long offset = reloc_offset(); + struct prom_t *_prom = PTRRELOC(&prom); + phandle prom_rtas; + u64 base, entry = 0; + u32 size; + + prom_debug("prom_instantiate_rtas: start...\n"); + + prom_rtas = call_prom("finddevice", 1, 1, ADDR("/rtas")); + if (prom_rtas != (phandle) -1) { + prom_getprop(prom_rtas, "rtas-size", &size, sizeof(size)); + if (size != 0) { + base = alloc_down(size, PAGE_SIZE, 0); + if (base == 0) { + prom_printf("RTAS allocation failed !\n"); + return; + } + prom_printf("instantiating rtas at 0x%x", base); + + prom_rtas = call_prom("open", 1, 1, ADDR("/rtas")); + prom_printf("..."); + + if (call_prom("call-method", 3, 2, + ADDR("instantiate-rtas"), + prom_rtas, base) != PROM_ERROR) { + entry = (long)_prom->args.rets[1]; + } + if (entry == 0) { + prom_printf(" failed\n"); + return; + } + prom_printf(" done\n"); + + reserve_mem(base, size); + } + + prom_setprop(_prom->chosen, "linux,rtas-base", &base, sizeof(base)); + prom_setprop(_prom->chosen, "linux,rtas-entry", &entry, sizeof(entry)); + prom_setprop(_prom->chosen, "linux,rtas-size", &size, sizeof(size)); + + prom_debug("rtas base = 0x%x\n", base); + prom_debug("rtas entry = 0x%x\n", entry); + prom_debug("rtas size = 0x%x\n", (long)size); + } + prom_debug("prom_instantiate_rtas: end...\n"); +} + + +/* + * Allocate room for and initialize TCE tables + */ +static void __init prom_initialize_tce_table(void) +{ + phandle node; + ihandle phb_node; + unsigned long offset = reloc_offset(); + char compatible[64], type[64], model[64]; + char *path = RELOC(prom_scratch); + u64 base, vbase, align; + u32 minalign, minsize; + u64 tce_entry, *tce_entryp; + u64 local_alloc_top, local_alloc_bottom; + u64 i; + + if (RELOC(ppc64_iommu_off)) + return; + + prom_debug("starting prom_initialize_tce_table\n"); + + /* Cache current top of allocs so we reserve a single block */ + local_alloc_top = RELOC(alloc_top_high); + local_alloc_bottom = local_alloc_top; + + /* Search all nodes looking for PHBs. */ + for (node = 0; prom_next_node(&node); ) { + compatible[0] = 0; + type[0] = 0; + model[0] = 0; + prom_getprop(node, "compatible", + compatible, sizeof(compatible)); + prom_getprop(node, "device_type", type, sizeof(type)); + prom_getprop(node, "model", model, sizeof(model)); + + if ((type[0] == 0) || (strstr(type, RELOC("pci")) == NULL)) + continue; + + /* Keep the old logic in tack to avoid regression. */ + if (compatible[0] != 0) { + if ((strstr(compatible, RELOC("python")) == NULL) && + (strstr(compatible, RELOC("Speedwagon")) == NULL) && + (strstr(compatible, RELOC("Winnipeg")) == NULL)) + continue; + } else if (model[0] != 0) { + if ((strstr(model, RELOC("ython")) == NULL) && + (strstr(model, RELOC("peedwagon")) == NULL) && + (strstr(model, RELOC("innipeg")) == NULL)) + continue; + } + + if (prom_getprop(node, "tce-table-minalign", &minalign, + sizeof(minalign)) == PROM_ERROR) + minalign = 0; + if (prom_getprop(node, "tce-table-minsize", &minsize, + sizeof(minsize)) == PROM_ERROR) + minsize = 4UL << 20; + + /* + * Even though we read what OF wants, we just set the table + * size to 4 MB. This is enough to map 2GB of PCI DMA space. + * By doing this, we avoid the pitfalls of trying to DMA to + * MMIO space and the DMA alias hole. + * + * On POWER4, firmware sets the TCE region by assuming + * each TCE table is 8MB. Using this memory for anything + * else will impact performance, so we always allocate 8MB. + * Anton + */ + if (__is_processor(PV_POWER4) || __is_processor(PV_POWER4p)) + minsize = 8UL << 20; + else + minsize = 4UL << 20; + + /* Align to the greater of the align or size */ + align = max(minalign, minsize); + base = alloc_down(minsize, align, 1); + if (base == 0) + prom_panic("ERROR, cannot find space for TCE table.\n"); + if (base < local_alloc_bottom) + local_alloc_bottom = base; + + vbase = (unsigned long)abs_to_virt(base); + + /* Save away the TCE table attributes for later use. */ + prom_setprop(node, "linux,tce-base", &vbase, sizeof(vbase)); + prom_setprop(node, "linux,tce-size", &minsize, sizeof(minsize)); + prom_setprop(node, "linux,has-tce-table", NULL, 0); + + /* It seems OF doesn't null-terminate the path :-( */ + memset(path, 0, sizeof(path)); + /* Call OF to setup the TCE hardware */ + if (call_prom("package-to-path", 3, 1, node, + path, PROM_SCRATCH_SIZE-1) == PROM_ERROR) { + prom_printf("package-to-path failed\n"); + } + + prom_debug("TCE table: %s\n", path); + prom_debug("\tnode = 0x%x\n", node); + prom_debug("\tbase = 0x%x\n", vbase); + prom_debug("\tsize = 0x%x\n", minsize); + + /* Initialize the table to have a one-to-one mapping + * over the allocated size. + */ + tce_entryp = (unsigned long *)base; + for (i = 0; i < (minsize >> 3) ;tce_entryp++, i++) { + tce_entry = (i << PAGE_SHIFT); + tce_entry |= 0x3; + *tce_entryp = tce_entry; + } + + prom_printf("opening PHB %s", path); + phb_node = call_prom("open", 1, 1, path); + if ( (long)phb_node <= 0) + prom_printf("... failed\n"); + else + prom_printf("... done\n"); + + call_prom("call-method", 6, 0, ADDR("set-64-bit-addressing"), + phb_node, -1, minsize, + (u32) base, (u32) (base >> 32)); + call_prom("close", 1, 0, phb_node); + } + + reserve_mem(local_alloc_bottom, local_alloc_top - local_alloc_bottom); + + /* Flag the first invalid entry */ + prom_debug("ending prom_initialize_tce_table\n"); +} + +/* + * With CHRP SMP we need to use the OF to start the other + * processors so we can't wait until smp_boot_cpus (the OF is + * trashed by then) so we have to put the processors into + * a holding pattern controlled by the kernel (not OF) before + * we destroy the OF. + * + * This uses a chunk of low memory, puts some holding pattern + * code there and sends the other processors off to there until + * smp_boot_cpus tells them to do something. The holding pattern + * checks that address until its cpu # is there, when it is that + * cpu jumps to __secondary_start(). smp_boot_cpus() takes care + * of setting those values. + * + * We also use physical address 0x4 here to tell when a cpu + * is in its holding pattern code. + * + * Fixup comment... DRENG / PPPBBB - Peter + * + * -- Cort + */ +static void __init prom_hold_cpus(void) +{ + unsigned long i; + unsigned int reg; + phandle node; + unsigned long offset = reloc_offset(); + char type[64]; + int cpuid = 0; + unsigned int interrupt_server[MAX_CPU_THREADS]; + unsigned int cpu_threads, hw_cpu_num; + int propsize; + extern void __secondary_hold(void); + extern unsigned long __secondary_hold_spinloop; + extern unsigned long __secondary_hold_acknowledge; + unsigned long *spinloop + = (void *)virt_to_abs(&__secondary_hold_spinloop); + unsigned long *acknowledge + = (void *)virt_to_abs(&__secondary_hold_acknowledge); + unsigned long secondary_hold + = virt_to_abs(*PTRRELOC((unsigned long *)__secondary_hold)); + struct prom_t *_prom = PTRRELOC(&prom); + + prom_debug("prom_hold_cpus: start...\n"); + prom_debug(" 1) spinloop = 0x%x\n", (unsigned long)spinloop); + prom_debug(" 1) *spinloop = 0x%x\n", *spinloop); + prom_debug(" 1) acknowledge = 0x%x\n", + (unsigned long)acknowledge); + prom_debug(" 1) *acknowledge = 0x%x\n", *acknowledge); + prom_debug(" 1) secondary_hold = 0x%x\n", secondary_hold); + + /* Set the common spinloop variable, so all of the secondary cpus + * will block when they are awakened from their OF spinloop. + * This must occur for both SMP and non SMP kernels, since OF will + * be trashed when we move the kernel. + */ + *spinloop = 0; + +#ifdef CONFIG_HMT + for (i=0; i < NR_CPUS; i++) { + RELOC(hmt_thread_data)[i].pir = 0xdeadbeef; + } +#endif + /* look for cpus */ + for (node = 0; prom_next_node(&node); ) { + type[0] = 0; + prom_getprop(node, "device_type", type, sizeof(type)); + if (strcmp(type, RELOC("cpu")) != 0) + continue; + + /* Skip non-configured cpus. */ + prom_getprop(node, "status", type, sizeof(type)); + if (strcmp(type, RELOC("okay")) != 0) + continue; + + reg = -1; + prom_getprop(node, "reg", ®, sizeof(reg)); + + prom_debug("\ncpuid = 0x%x\n", cpuid); + prom_debug("cpu hw idx = 0x%x\n", reg); + + /* Init the acknowledge var which will be reset by + * the secondary cpu when it awakens from its OF + * spinloop. + */ + *acknowledge = (unsigned long)-1; + + propsize = prom_getprop(node, "ibm,ppc-interrupt-server#s", + &interrupt_server, + sizeof(interrupt_server)); + if (propsize < 0) { + /* no property. old hardware has no SMT */ + cpu_threads = 1; + interrupt_server[0] = reg; /* fake it with phys id */ + } else { + /* We have a threaded processor */ + cpu_threads = propsize / sizeof(u32); + if (cpu_threads > MAX_CPU_THREADS) { + prom_printf("SMT: too many threads!\n" + "SMT: found %x, max is %x\n", + cpu_threads, MAX_CPU_THREADS); + cpu_threads = 1; /* ToDo: panic? */ + } + } + + hw_cpu_num = interrupt_server[0]; + if (hw_cpu_num != _prom->cpu) { + /* Primary Thread of non-boot cpu */ + prom_printf("%x : starting cpu hw idx %x... ", cpuid, reg); + call_prom("start-cpu", 3, 0, node, + secondary_hold, cpuid); + + for ( i = 0 ; (i < 100000000) && + (*acknowledge == ((unsigned long)-1)); i++ ) ; + + if (*acknowledge == cpuid) { + prom_printf("done\n"); + /* We have to get every CPU out of OF, + * even if we never start it. */ + if (cpuid >= NR_CPUS) + goto next; + } else { + prom_printf("failed: %x\n", *acknowledge); + } + } +#ifdef CONFIG_SMP + else + prom_printf("%x : boot cpu %x\n", cpuid, reg); +#endif +next: +#ifdef CONFIG_SMP + /* Init paca for secondary threads. They start later. */ + for (i=1; i < cpu_threads; i++) { + cpuid++; + if (cpuid >= NR_CPUS) + continue; + } +#endif /* CONFIG_SMP */ + cpuid++; + } +#ifdef CONFIG_HMT + /* Only enable HMT on processors that provide support. */ + if (__is_processor(PV_PULSAR) || + __is_processor(PV_ICESTAR) || + __is_processor(PV_SSTAR)) { + prom_printf(" starting secondary threads\n"); + + for (i = 0; i < NR_CPUS; i += 2) { + if (!cpu_online(i)) + continue; + + if (i == 0) { + unsigned long pir = mfspr(SPRN_PIR); + if (__is_processor(PV_PULSAR)) { + RELOC(hmt_thread_data)[i].pir = + pir & 0x1f; + } else { + RELOC(hmt_thread_data)[i].pir = + pir & 0x3ff; + } + } + } + } else { + prom_printf("Processor is not HMT capable\n"); + } +#endif + + if (cpuid > NR_CPUS) + prom_printf("WARNING: maximum CPUs (" __stringify(NR_CPUS) + ") exceeded: ignoring extras\n"); + + prom_debug("prom_hold_cpus: end...\n"); +} + + +static void __init prom_init_client_services(unsigned long pp) +{ + unsigned long offset = reloc_offset(); + struct prom_t *_prom = PTRRELOC(&prom); + + /* Get a handle to the prom entry point before anything else */ + _prom->entry = pp; + + /* Init default value for phys size */ + _prom->root_size_cells = 1; + _prom->root_addr_cells = 2; + + /* get a handle for the stdout device */ + _prom->chosen = call_prom("finddevice", 1, 1, ADDR("/chosen")); + if ((long)_prom->chosen <= 0) + prom_panic("cannot find chosen"); /* msg won't be printed :( */ + + /* get device tree root */ + _prom->root = call_prom("finddevice", 1, 1, ADDR("/")); + if ((long)_prom->root <= 0) + prom_panic("cannot find device tree root"); /* msg won't be printed :( */ +} + +static void __init prom_init_stdout(void) +{ + unsigned long offset = reloc_offset(); + struct prom_t *_prom = PTRRELOC(&prom); + char *path = RELOC(of_stdout_device); + char type[16]; + u32 val; + + if (prom_getprop(_prom->chosen, "stdout", &val, sizeof(val)) <= 0) + prom_panic("cannot find stdout"); + + _prom->stdout = val; + + /* Get the full OF pathname of the stdout device */ + memset(path, 0, 256); + call_prom("instance-to-path", 3, 1, _prom->stdout, path, 255); + val = call_prom("instance-to-package", 1, 1, _prom->stdout); + prom_setprop(_prom->chosen, "linux,stdout-package", &val, sizeof(val)); + prom_printf("OF stdout device is: %s\n", RELOC(of_stdout_device)); + prom_setprop(_prom->chosen, "linux,stdout-path", + RELOC(of_stdout_device), strlen(RELOC(of_stdout_device))+1); + + /* If it's a display, note it */ + memset(type, 0, sizeof(type)); + prom_getprop(val, "device_type", type, sizeof(type)); + if (strcmp(type, RELOC("display")) == 0) { + _prom->disp_node = val; + prom_setprop(val, "linux,boot-display", NULL, 0); + } +} + +static int __init prom_find_machine_type(void) +{ + unsigned long offset = reloc_offset(); + struct prom_t *_prom = PTRRELOC(&prom); + char compat[256]; + int len, i = 0; + phandle rtas; + + len = prom_getprop(_prom->root, "compatible", + compat, sizeof(compat)-1); + if (len > 0) { + compat[len] = 0; + while (i < len) { + char *p = &compat[i]; + int sl = strlen(p); + if (sl == 0) + break; + if (strstr(p, RELOC("Power Macintosh")) || + strstr(p, RELOC("MacRISC4"))) + return PLATFORM_POWERMAC; + i += sl + 1; + } + } + /* Default to pSeries. We need to know if we are running LPAR */ + rtas = call_prom("finddevice", 1, 1, ADDR("/rtas")); + if (rtas != (phandle) -1) { + unsigned long x; + x = prom_getproplen(rtas, "ibm,hypertas-functions"); + if (x != PROM_ERROR) { + prom_printf("Hypertas detected, assuming LPAR !\n"); + return PLATFORM_PSERIES_LPAR; + } + } + return PLATFORM_PSERIES; +} + +static int __init prom_set_color(ihandle ih, int i, int r, int g, int b) +{ + unsigned long offset = reloc_offset(); + + return call_prom("call-method", 6, 1, ADDR("color!"), ih, i, b, g, r); +} + +/* + * If we have a display that we don't know how to drive, + * we will want to try to execute OF's open method for it + * later. However, OF will probably fall over if we do that + * we've taken over the MMU. + * So we check whether we will need to open the display, + * and if so, open it now. + */ +static unsigned long __init prom_check_displays(void) +{ + unsigned long offset = reloc_offset(); + struct prom_t *_prom = PTRRELOC(&prom); + char type[16], *path; + phandle node; + ihandle ih; + int i; + + static unsigned char default_colors[] = { + 0x00, 0x00, 0x00, + 0x00, 0x00, 0xaa, + 0x00, 0xaa, 0x00, + 0x00, 0xaa, 0xaa, + 0xaa, 0x00, 0x00, + 0xaa, 0x00, 0xaa, + 0xaa, 0xaa, 0x00, + 0xaa, 0xaa, 0xaa, + 0x55, 0x55, 0x55, + 0x55, 0x55, 0xff, + 0x55, 0xff, 0x55, + 0x55, 0xff, 0xff, + 0xff, 0x55, 0x55, + 0xff, 0x55, 0xff, + 0xff, 0xff, 0x55, + 0xff, 0xff, 0xff + }; + const unsigned char *clut; + + prom_printf("Looking for displays\n"); + for (node = 0; prom_next_node(&node); ) { + memset(type, 0, sizeof(type)); + prom_getprop(node, "device_type", type, sizeof(type)); + if (strcmp(type, RELOC("display")) != 0) + continue; + + /* It seems OF doesn't null-terminate the path :-( */ + path = RELOC(prom_scratch); + memset(path, 0, PROM_SCRATCH_SIZE); + + /* + * leave some room at the end of the path for appending extra + * arguments + */ + if (call_prom("package-to-path", 3, 1, node, path, PROM_SCRATCH_SIZE-10) < 0) + continue; + prom_printf("found display : %s, opening ... ", path); + + ih = call_prom("open", 1, 1, path); + if (ih == (ihandle)0 || ih == (ihandle)-1) { + prom_printf("failed\n"); + continue; + } + + /* Success */ + prom_printf("done\n"); + prom_setprop(node, "linux,opened", NULL, 0); + + /* + * stdout wasn't a display node, pick the first we can find + * for btext + */ + if (_prom->disp_node == 0) + _prom->disp_node = node; + + /* Setup a useable color table when the appropriate + * method is available. Should update this to set-colors */ + clut = RELOC(default_colors); + for (i = 0; i < 32; i++, clut += 3) + if (prom_set_color(ih, i, clut[0], clut[1], + clut[2]) != 0) + break; + +#ifdef CONFIG_LOGO_LINUX_CLUT224 + clut = PTRRELOC(RELOC(logo_linux_clut224.clut)); + for (i = 0; i < RELOC(logo_linux_clut224.clutsize); i++, clut += 3) + if (prom_set_color(ih, i + 32, clut[0], clut[1], + clut[2]) != 0) + break; +#endif /* CONFIG_LOGO_LINUX_CLUT224 */ + } +} + + +/* Return (relocated) pointer to this much memory: moves initrd if reqd. */ +static void __init *make_room(unsigned long *mem_start, unsigned long *mem_end, + unsigned long needed, unsigned long align) +{ + unsigned long offset = reloc_offset(); + void *ret; + + *mem_start = _ALIGN(*mem_start, align); + while ((*mem_start + needed) > *mem_end) { + unsigned long room, chunk; + + prom_debug("Chunk exhausted, claiming more at %x...\n", + RELOC(alloc_bottom)); + room = RELOC(alloc_top) - RELOC(alloc_bottom); + if (room > DEVTREE_CHUNK_SIZE) + room = DEVTREE_CHUNK_SIZE; + if (room < PAGE_SIZE) + prom_panic("No memory for flatten_device_tree (no room)"); + chunk = alloc_up(room, 0); + if (chunk == 0) + prom_panic("No memory for flatten_device_tree (claim failed)"); + *mem_end = RELOC(alloc_top); + } + + ret = (void *)*mem_start; + *mem_start += needed; + + return ret; +} + +#define dt_push_token(token, mem_start, mem_end) \ + do { *((u32 *)make_room(mem_start, mem_end, 4, 4)) = token; } while(0) + +static unsigned long __init dt_find_string(char *str) +{ + unsigned long offset = reloc_offset(); + char *s, *os; + + s = os = (char *)RELOC(dt_string_start); + s += 4; + while (s < (char *)RELOC(dt_string_end)) { + if (strcmp(s, str) == 0) + return s - os; + s += strlen(s) + 1; + } + return 0; +} + +static void __init scan_dt_build_strings(phandle node, unsigned long *mem_start, + unsigned long *mem_end) +{ + unsigned long offset = reloc_offset(); + char *prev_name, *namep, *sstart; + unsigned long soff; + phandle child; + + sstart = (char *)RELOC(dt_string_start); + + /* get and store all property names */ + prev_name = RELOC(""); + for (;;) { + + /* 32 is max len of name including nul. */ + namep = make_room(mem_start, mem_end, 32, 1); + if (call_prom("nextprop", 3, 1, node, prev_name, namep) <= 0) { + /* No more nodes: unwind alloc */ + *mem_start = (unsigned long)namep; + break; + } + soff = dt_find_string(namep); + if (soff != 0) { + *mem_start = (unsigned long)namep; + namep = sstart + soff; + } else { + /* Trim off some if we can */ + *mem_start = (unsigned long)namep + strlen(namep) + 1; + RELOC(dt_string_end) = *mem_start; + } + prev_name = namep; + } + + /* do all our children */ + child = call_prom("child", 1, 1, node); + while (child != (phandle)0) { + scan_dt_build_strings(child, mem_start, mem_end); + child = call_prom("peer", 1, 1, child); + } +} + +static void __init scan_dt_build_struct(phandle node, unsigned long *mem_start, + unsigned long *mem_end) +{ + int l, align; + phandle child; + char *namep, *prev_name, *sstart; + unsigned long soff; + unsigned char *valp; + unsigned long offset = reloc_offset(); + char pname[32]; + char *path; + + path = RELOC(prom_scratch); + + dt_push_token(OF_DT_BEGIN_NODE, mem_start, mem_end); + + /* get the node's full name */ + namep = (char *)*mem_start; + l = call_prom("package-to-path", 3, 1, node, + namep, *mem_end - *mem_start); + if (l >= 0) { + /* Didn't fit? Get more room. */ + if (l+1 > *mem_end - *mem_start) { + namep = make_room(mem_start, mem_end, l+1, 1); + call_prom("package-to-path", 3, 1, node, namep, l); + } + namep[l] = '\0'; + *mem_start = _ALIGN(((unsigned long) namep) + strlen(namep) + 1, 4); + } + + /* get it again for debugging */ + memset(path, 0, PROM_SCRATCH_SIZE); + call_prom("package-to-path", 3, 1, node, path, PROM_SCRATCH_SIZE-1); + + /* get and store all properties */ + prev_name = RELOC(""); + sstart = (char *)RELOC(dt_string_start); + for (;;) { + if (call_prom("nextprop", 3, 1, node, prev_name, pname) <= 0) + break; + + /* find string offset */ + soff = dt_find_string(pname); + if (soff == 0) { + prom_printf("WARNING: Can't find string index for <%s>, node %s\n", + pname, path); + break; + } + prev_name = sstart + soff; + + /* get length */ + l = call_prom("getproplen", 2, 1, node, pname); + + /* sanity checks */ + if (l < 0) + continue; + if (l > MAX_PROPERTY_LENGTH) { + prom_printf("WARNING: ignoring large property "); + /* It seems OF doesn't null-terminate the path :-( */ + prom_printf("[%s] ", path); + prom_printf("%s length 0x%x\n", pname, l); + continue; + } + + /* push property head */ + dt_push_token(OF_DT_PROP, mem_start, mem_end); + dt_push_token(l, mem_start, mem_end); + dt_push_token(soff, mem_start, mem_end); + + /* push property content */ + align = (l >= 8) ? 8 : 4; + valp = make_room(mem_start, mem_end, l, align); + call_prom("getprop", 4, 1, node, pname, valp, l); + *mem_start = _ALIGN(*mem_start, 4); + } + + /* Add a "linux,phandle" property. */ + soff = dt_find_string(RELOC("linux,phandle")); + if (soff == 0) + prom_printf("WARNING: Can't find string index for " + " node %s\n", path); + else { + dt_push_token(OF_DT_PROP, mem_start, mem_end); + dt_push_token(4, mem_start, mem_end); + dt_push_token(soff, mem_start, mem_end); + valp = make_room(mem_start, mem_end, 4, 4); + *(u32 *)valp = node; + } + + /* do all our children */ + child = call_prom("child", 1, 1, node); + while (child != (phandle)0) { + scan_dt_build_struct(child, mem_start, mem_end); + child = call_prom("peer", 1, 1, child); + } + + dt_push_token(OF_DT_END_NODE, mem_start, mem_end); +} + +static void __init flatten_device_tree(void) +{ + phandle root; + unsigned long offset = reloc_offset(); + unsigned long mem_start, mem_end, room; + struct boot_param_header *hdr; + char *namep; + u64 *rsvmap; + + /* + * Check how much room we have between alloc top & bottom (+/- a + * few pages), crop to 4Mb, as this is our "chuck" size + */ + room = RELOC(alloc_top) - RELOC(alloc_bottom) - 0x4000; + if (room > DEVTREE_CHUNK_SIZE) + room = DEVTREE_CHUNK_SIZE; + prom_debug("starting device tree allocs at %x\n", RELOC(alloc_bottom)); + + /* Now try to claim that */ + mem_start = (unsigned long)alloc_up(room, PAGE_SIZE); + if (mem_start == 0) + prom_panic("Can't allocate initial device-tree chunk\n"); + mem_end = RELOC(alloc_top); + + /* Get root of tree */ + root = call_prom("peer", 1, 1, (phandle)0); + if (root == (phandle)0) + prom_panic ("couldn't get device tree root\n"); + + /* Build header and make room for mem rsv map */ + mem_start = _ALIGN(mem_start, 4); + hdr = make_room(&mem_start, &mem_end, sizeof(struct boot_param_header), 4); + RELOC(dt_header_start) = (unsigned long)hdr; + rsvmap = make_room(&mem_start, &mem_end, sizeof(mem_reserve_map), 8); + + /* Start of strings */ + mem_start = PAGE_ALIGN(mem_start); + RELOC(dt_string_start) = mem_start; + mem_start += 4; /* hole */ + + /* Add "linux,phandle" in there, we'll need it */ + namep = make_room(&mem_start, &mem_end, 16, 1); + strcpy(namep, RELOC("linux,phandle")); + mem_start = (unsigned long)namep + strlen(namep) + 1; + RELOC(dt_string_end) = mem_start; + + /* Build string array */ + prom_printf("Building dt strings...\n"); + scan_dt_build_strings(root, &mem_start, &mem_end); + + /* Build structure */ + mem_start = PAGE_ALIGN(mem_start); + RELOC(dt_struct_start) = mem_start; + prom_printf("Building dt structure...\n"); + scan_dt_build_struct(root, &mem_start, &mem_end); + dt_push_token(OF_DT_END, &mem_start, &mem_end); + RELOC(dt_struct_end) = PAGE_ALIGN(mem_start); + + /* Finish header */ + hdr->magic = OF_DT_HEADER; + hdr->totalsize = RELOC(dt_struct_end) - RELOC(dt_header_start); + hdr->off_dt_struct = RELOC(dt_struct_start) - RELOC(dt_header_start); + hdr->off_dt_strings = RELOC(dt_string_start) - RELOC(dt_header_start); + hdr->off_mem_rsvmap = ((unsigned long)rsvmap) - RELOC(dt_header_start); + hdr->version = OF_DT_VERSION; + hdr->last_comp_version = 1; + + /* Reserve the whole thing and copy the reserve map in, we + * also bump mem_reserve_cnt to cause further reservations to + * fail since it's too late. + */ + reserve_mem(RELOC(dt_header_start), hdr->totalsize); + memcpy(rsvmap, RELOC(mem_reserve_map), sizeof(mem_reserve_map)); + +#ifdef DEBUG_PROM + { + int i; + prom_printf("reserved memory map:\n"); + for (i = 0; i < RELOC(mem_reserve_cnt); i++) + prom_printf(" %x - %x\n", RELOC(mem_reserve_map)[i].base, + RELOC(mem_reserve_map)[i].size); + } +#endif + RELOC(mem_reserve_cnt) = MEM_RESERVE_MAP_SIZE; + + prom_printf("Device tree strings 0x%x -> 0x%x\n", + RELOC(dt_string_start), RELOC(dt_string_end)); + prom_printf("Device tree struct 0x%x -> 0x%x\n", + RELOC(dt_struct_start), RELOC(dt_struct_end)); + + } + +static void __init prom_find_boot_cpu(void) +{ + unsigned long offset = reloc_offset(); + struct prom_t *_prom = PTRRELOC(&prom); + u32 getprop_rval; + ihandle prom_cpu; + phandle cpu_pkg; + + if (prom_getprop(_prom->chosen, "cpu", &prom_cpu, sizeof(prom_cpu)) <= 0) + prom_panic("cannot find boot cpu"); + + cpu_pkg = call_prom("instance-to-package", 1, 1, prom_cpu); + + prom_setprop(cpu_pkg, "linux,boot-cpu", NULL, 0); + prom_getprop(cpu_pkg, "reg", &getprop_rval, sizeof(getprop_rval)); + _prom->cpu = getprop_rval; + + prom_debug("Booting CPU hw index = 0x%x\n", _prom->cpu); +} + +static void __init prom_check_initrd(unsigned long r3, unsigned long r4) +{ +#ifdef CONFIG_BLK_DEV_INITRD + unsigned long offset = reloc_offset(); + struct prom_t *_prom = PTRRELOC(&prom); + + if ( r3 && r4 && r4 != 0xdeadbeef) { + u64 val; + + RELOC(prom_initrd_start) = (r3 >= KERNELBASE) ? __pa(r3) : r3; + RELOC(prom_initrd_end) = RELOC(prom_initrd_start) + r4; + + val = (u64)RELOC(prom_initrd_start); + prom_setprop(_prom->chosen, "linux,initrd-start", &val, sizeof(val)); + val = (u64)RELOC(prom_initrd_end); + prom_setprop(_prom->chosen, "linux,initrd-end", &val, sizeof(val)); + + reserve_mem(RELOC(prom_initrd_start), + RELOC(prom_initrd_end) - RELOC(prom_initrd_start)); + + prom_debug("initrd_start=0x%x\n", RELOC(prom_initrd_start)); + prom_debug("initrd_end=0x%x\n", RELOC(prom_initrd_end)); + } +#endif /* CONFIG_BLK_DEV_INITRD */ +} + +/* + * We enter here early on, when the Open Firmware prom is still + * handling exceptions and the MMU hash table for us. + */ + +unsigned long __init prom_init(unsigned long r3, unsigned long r4, unsigned long pp, + unsigned long r6, unsigned long r7) +{ + unsigned long offset = reloc_offset(); + struct prom_t *_prom = PTRRELOC(&prom); + unsigned long phys = KERNELBASE - offset; + u32 getprop_rval; + + /* + * First zero the BSS + */ + memset(PTRRELOC(&__bss_start), 0, __bss_stop - __bss_start); + + /* + * Init interface to Open Firmware, get some node references, + * like /chosen + */ + prom_init_client_services(pp); + + /* + * Init prom stdout device + */ + prom_init_stdout(); + prom_debug("klimit=0x%x\n", RELOC(klimit)); + prom_debug("offset=0x%x\n", offset); + + /* + * Reserve kernel in reserve map + */ + reserve_mem(0, __pa(RELOC(klimit))); + + /* + * Check for an initrd + */ + prom_check_initrd(r3, r4); + + /* + * Get default machine type. At this point, we do not differenciate + * between pSeries SMP and pSeries LPAR + */ + RELOC(of_platform) = prom_find_machine_type(); + getprop_rval = RELOC(of_platform); + prom_setprop(_prom->chosen, "linux,platform", + &getprop_rval, sizeof(getprop_rval)); + + /* + * On pSeries, copy the CPU hold code + */ + if (RELOC(of_platform) & PLATFORM_PSERIES) + copy_and_flush(0, KERNELBASE - offset, 0x100, 0); + + /* + * Get memory cells format + */ + getprop_rval = 1; + prom_getprop(_prom->root, "#size-cells", + &getprop_rval, sizeof(getprop_rval)); + _prom->root_size_cells = getprop_rval; + getprop_rval = 2; + prom_getprop(_prom->root, "#address-cells", + &getprop_rval, sizeof(getprop_rval)); + _prom->root_addr_cells = getprop_rval; + + /* + * Do early parsing of command line + */ + early_cmdline_parse(); + + /* + * Initialize memory management within prom_init + */ + prom_init_mem(); + + /* + * Determine which cpu is actually running right _now_ + */ + prom_find_boot_cpu(); + + /* + * Initialize display devices + */ + prom_check_displays(); + + /* + * Initialize IOMMU (TCE tables) on pSeries. Do that before anything else + * that uses the allocator, we need to make sure we get the top of memory + * available for us here... + */ + if (RELOC(of_platform) == PLATFORM_PSERIES) + prom_initialize_tce_table(); + + /* + * On non-powermacs, try to instantiate RTAS and puts all CPUs + * in spin-loops. PowerMacs don't have a working RTAS and use + * a different way to spin CPUs + */ + if (RELOC(of_platform) != PLATFORM_POWERMAC) { + prom_instantiate_rtas(); + prom_hold_cpus(); + } + + /* + * Fill in some infos for use by the kernel later on + */ + if (RELOC(ppc64_iommu_off)) + prom_setprop(_prom->chosen, "linux,iommu-off", NULL, 0); + if (RELOC(iommu_force_on)) + prom_setprop(_prom->chosen, "linux,iommu-force-on", NULL, 0); + + /* + * Now finally create the flattened device-tree + */ + prom_printf("copying OF device tree ...\n"); + flatten_device_tree(); + + /* + * Call OF "quiesce" method to shut down pending DMA's from + * devices etc... + */ + prom_printf("Calling quiesce ...\n"); + call_prom("quiesce", 0, 0); + + /* + * And finally, call the kernel passing it the flattened device + * tree and NULL as r5, thus triggering the new entry point which + * is common to us and kexec + */ + prom_printf("returning from prom_init\n"); + prom_debug("->dt_header_start=0x%x\n", RELOC(dt_header_start)); + prom_debug("->phys=0x%x\n", phys); + + __start(RELOC(dt_header_start), phys, 0); + + return 0; +} + diff -Nru a/arch/ppc64/kernel/rtas.c b/arch/ppc64/kernel/rtas.c --- a/arch/ppc64/kernel/rtas.c 2004-09-26 10:25:55 -07:00 +++ b/arch/ppc64/kernel/rtas.c 2004-09-26 10:25:55 -07:00 @@ -42,13 +42,16 @@ spinlock_t rtas_data_buf_lock = SPIN_LOCK_UNLOCKED; char rtas_data_buf[RTAS_DATA_BUF_SIZE]__page_aligned; +unsigned long rtas_rmo_buf; void -call_rtas_display_status(char c) +call_rtas_display_status(unsigned char c) { struct rtas_args *args = &rtas.args; unsigned long s; + if (!rtas.base) + return; spin_lock_irqsave(&rtas.lock, s); args->token = 10; @@ -62,6 +65,31 @@ spin_unlock_irqrestore(&rtas.lock, s); } +void +call_rtas_display_status_delay(unsigned char c) +{ + static int pending_newline = 0; /* did last write end with unprinted newline? */ + static int width = 16; + + if (c == '\n') { + while (width-- > 0) + call_rtas_display_status(' '); + width = 16; + udelay(500000); + pending_newline = 1; + } else { + if (pending_newline) { + call_rtas_display_status('\r'); + call_rtas_display_status('\n'); + } + pending_newline = 0; + if (width--) { + call_rtas_display_status(c); + udelay(10000); + } + } +} + int rtas_token(const char *service) { @@ -425,7 +453,6 @@ } while (status == RTAS_BUSY); } -unsigned long rtas_rmo_buf = 0; asmlinkage int ppc_rtas(struct rtas_args __user *uargs) { @@ -535,6 +562,53 @@ } return rtas_error_log_max; } + +/* + * Call early during boot, before mem init or bootmem, to retreive the RTAS + * informations from the device-tree and allocate the RMO buffer for userland + * accesses. + */ +void __init rtas_initialize(void) +{ + /* Get RTAS dev node and fill up our "rtas" structure with infos + * about it. + */ + rtas.dev = of_find_node_by_name(NULL, "rtas"); + if (rtas.dev) { + u64 *basep, *entryp; + u32 *sizep; + + basep = (u64 *)get_property(of_chosen, "linux,rtas-base", NULL); + sizep = (u32 *)get_property(of_chosen, "linux,rtas-size", NULL); + if (basep != NULL && sizep != NULL) { + rtas.base = *basep; + rtas.size = *sizep; + entryp = (u64 *)get_property(of_chosen, "linux,rtas-entry", NULL); + if (entryp == NULL) /* Ugh */ + rtas.entry = rtas.base; + else + rtas.entry = *entryp; + } else + rtas.dev = NULL; + } + /* If RTAS was found, allocate the RMO buffer for it and look for + * the stop-self token if any + */ + if (rtas.dev) { + unsigned long rtas_region = RTAS_INSTANTIATE_MAX; + if (systemcfg->platform == PLATFORM_PSERIES_LPAR) + rtas_region = min(lmb.rmo_size, RTAS_INSTANTIATE_MAX); + + rtas_rmo_buf = lmb_alloc_base(RTAS_RMOBUF_MAX, PAGE_SIZE, + rtas_region); + +#ifdef CONFIG_HOTPLUG_CPU + rtas_stop_self_args.token = rtas_token("stop-self"); +#endif /* CONFIG_HOTPLUG_CPU */ + } + +} + EXPORT_SYMBOL(rtas_firmware_flash_list); EXPORT_SYMBOL(rtas_token); diff -Nru a/arch/ppc64/kernel/rtasd.c b/arch/ppc64/kernel/rtasd.c --- a/arch/ppc64/kernel/rtasd.c 2004-09-26 10:25:56 -07:00 +++ b/arch/ppc64/kernel/rtasd.c 2004-09-26 10:25:56 -07:00 @@ -106,7 +106,7 @@ static void printk_log_rtas(char *buf, int len) { - int i,j,n; + int i,j,n = 0; int perline = 16; char buffer[64]; char * str = "RTAS event"; @@ -216,12 +216,13 @@ if (!no_more_logging && !(err_type & ERR_FLAG_BOOT)) nvram_write_error_log(buf, len, err_type); - /* rtas errors can occur during boot, and we do want to capture + /* + * rtas errors can occur during boot, and we do want to capture * those somewhere, even if nvram isn't ready (why not?), and even - * if rtasd isn't ready. Put them into the boot log, at least. */ - if ((err_type & ERR_TYPE_MASK) == ERR_TYPE_RTAS_LOG) { + * if rtasd isn't ready. Put them into the boot log, at least. + */ + if ((err_type & ERR_TYPE_MASK) == ERR_TYPE_RTAS_LOG) printk_log_rtas(buf, len); - } /* Check to see if we need to or have stopped logging */ if (fatal || no_more_logging) { @@ -233,9 +234,6 @@ /* call type specific method for error */ switch (err_type & ERR_TYPE_MASK) { case ERR_TYPE_RTAS_LOG: - /* put into syslog and error_log file */ - printk_log_rtas(buf, len); - offset = rtas_error_log_buffer_max * ((rtas_log_start+rtas_log_size) & LOG_NUMBER_MASK); diff -Nru a/arch/ppc64/kernel/setup.c b/arch/ppc64/kernel/setup.c --- a/arch/ppc64/kernel/setup.c 2004-09-26 10:25:56 -07:00 +++ b/arch/ppc64/kernel/setup.c 2004-09-26 10:25:56 -07:00 @@ -10,6 +10,8 @@ * 2 of the License, or (at your option) any later version. */ +#undef DEBUG + #include #include #include @@ -27,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -48,57 +51,74 @@ #include #include -extern unsigned long klimit; +#ifdef DEBUG +#define DBG(fmt...) udbg_printf(fmt) +#else +#define DBG(fmt...) +#endif + +/* + * Here are some early debugging facilities. You can enable one + * but your kernel will not boot on anything else if you do so + */ + +/* This one is for use on LPAR machines that support an HVC console + * on vterm 0 + */ +extern void udbg_init_debug_lpar(void); +/* This one is for use on Apple G5 machines + */ +extern void udbg_init_pmac_realmode(void); +/* That's RTAS panel debug */ +extern void call_rtas_display_status_delay(unsigned char c); + +#define EARLY_DEBUG_INIT() do {} while(0) + +#if 0 +#define EARLY_DEBUG_INIT() udbg_init_debug_lpar() +#define EARLY_DEBUG_INIT() udbg_init_pmac_realmode() +#define EARLY_DEBUG_INIT() \ + do { ppc_md.udbg_putc = call_rtas_display_status_delay; } while(0) +#endif + /* extern void *stab; */ extern HTAB htab_data; -extern unsigned long loops_per_jiffy; - -int have_of = 1; +extern unsigned long klimit; -extern void chrp_init(unsigned long r3, - unsigned long r4, - unsigned long r5, - unsigned long r6, - unsigned long r7); - -extern void pmac_init(unsigned long r3, - unsigned long r4, - unsigned long r5, - unsigned long r6, - unsigned long r7); - -extern void fw_feature_init(void); -extern void iSeries_init( void ); -extern void iSeries_init_early( void ); -extern void pSeries_init_early( void ); -extern void pSeriesLP_init_early(void); -extern void pmac_init_early(void); -extern void mm_init_ppc64( void ); -extern void pseries_secondary_smp_init(unsigned long); +extern void mm_init_ppc64(void); extern int idle_setup(void); -extern void vpa_init(int cpu); +extern void stab_initialize(unsigned long stab); +extern void htab_initialize(void); +extern void early_init_devtree(void *flat_dt); +extern void unflatten_device_tree(void); unsigned long decr_overclock = 1; unsigned long decr_overclock_proc0 = 1; unsigned long decr_overclock_set = 0; unsigned long decr_overclock_proc0_set = 0; -int powersave_nap; +int have_of = 1; -unsigned char aux_device_present; +dev_t boot_dev; -void parse_cmd_line(unsigned long r3, unsigned long r4, unsigned long r5, - unsigned long r6, unsigned long r7); -int parse_bootinfo(void); +/* + * These are used in binfmt_elf.c to put aux entries on the stack + * for each elf executable being started. + */ +int dcache_bsize; +int icache_bsize; +int ucache_bsize; + +/* The main machine-dep calls structure + */ +struct machdep_calls ppc_md; #ifdef CONFIG_MAGIC_SYSRQ unsigned long SYSRQ_KEY; #endif /* CONFIG_MAGIC_SYSRQ */ -struct machdep_calls ppc_md; static int ppc64_panic_event(struct notifier_block *, unsigned long, void *); - static struct notifier_block ppc64_panic_block = { notifier_call: ppc64_panic_event, priority: INT_MIN /* may not return; must be done last */ @@ -122,30 +142,23 @@ }; /* - * These are used in binfmt_elf.c to put aux entries on the stack - * for each elf executable being started. - */ -int dcache_bsize; -int icache_bsize; -int ucache_bsize; - -/* * Initialize the PPCDBG state. Called before relocation has been enabled. */ -void ppcdbg_initialize(void) { - unsigned long offset = reloc_offset(); - struct naca_struct *_naca = RELOC(naca); - - _naca->debug_switch = PPC_DEBUG_DEFAULT; /* | PPCDBG_BUSWALK | PPCDBG_PHBINIT | PPCDBG_MM | PPCDBG_MMINIT | PPCDBG_TCEINIT | PPCDBG_TCE */; +void __init ppcdbg_initialize(void) +{ + naca->debug_switch = PPC_DEBUG_DEFAULT; /* | PPCDBG_BUSWALK | */ + /* PPCDBG_PHBINIT | PPCDBG_MM | PPCDBG_MMINIT | PPCDBG_TCEINIT | PPCDBG_TCE */; } +/* + * Early boot console based on udbg + */ static struct console udbg_console = { .name = "udbg", .write = udbg_console_write, .flags = CON_PRINTBUFFER, .index = -1, }; - static int early_console_initialized; void __init disable_early_printk(void) @@ -156,7 +169,51 @@ early_console_initialized = 0; } -#if !defined(CONFIG_PPC_ISERIES) && defined(CONFIG_SMP) +#if defined(CONFIG_PPC_MULTIPLATFORM) && defined(CONFIG_SMP) + +static int smt_enabled_cmdline; + +/* Look for ibm,smt-enabled OF option */ +static void check_smt_enabled(void) +{ + struct device_node *dn; + char *smt_option; + + /* Allow the command line to overrule the OF option */ + if (smt_enabled_cmdline) + return; + + dn = of_find_node_by_path("/options"); + + if (dn) { + smt_option = (char *)get_property(dn, "ibm,smt-enabled", NULL); + + if (smt_option) { + if (!strcmp(smt_option, "on")) + smt_enabled_at_boot = 1; + else if (!strcmp(smt_option, "off")) + smt_enabled_at_boot = 0; + } + } +} + +/* Look for smt-enabled= cmdline option */ +static int __init early_smt_enabled(char *p) +{ + smt_enabled_cmdline = 1; + + if (!p) + return 0; + + if (!strcmp(p, "on") || !strcmp(p, "1")) + smt_enabled_at_boot = 1; + else if (!strcmp(p, "off") || !strcmp(p, "0")) + smt_enabled_at_boot = 0; + + return 0; +} +early_param("smt-enabled", early_smt_enabled); + /** * setup_cpu_maps - initialize the following cpu maps: * cpu_possible_map @@ -179,6 +236,8 @@ struct device_node *dn = NULL; int cpu = 0; + check_smt_enabled(); + while ((dn = of_find_node_by_type(dn, "cpu")) && cpu < NR_CPUS) { u32 *intserv; int j, len = sizeof(u32), nthreads; @@ -191,9 +250,16 @@ nthreads = len / sizeof(u32); for (j = 0; j < nthreads && cpu < NR_CPUS; j++) { + /* + * Only spin up secondary threads if SMT is enabled. + * We must leave space in the logical map for the + * threads. + */ + if (j == 0 || smt_enabled_at_boot) { + cpu_set(cpu, cpu_present_map); + set_hard_smp_processor_id(cpu, intserv[j]); + } cpu_set(cpu, cpu_possible_map); - cpu_set(cpu, cpu_present_map); - set_hard_smp_processor_id(cpu, intserv[j]); cpu++; } } @@ -249,123 +315,311 @@ systemcfg->processorCount = num_present_cpus(); } -#endif /* !defined(CONFIG_PPC_ISERIES) && defined(CONFIG_SMP) */ -/* - * Do some initial setup of the system. The parameters are those which - * were passed in from the bootloader. - */ -void setup_system(unsigned long r3, unsigned long r4, unsigned long r5, - unsigned long r6, unsigned long r7) -{ -#if defined(CONFIG_SMP) && defined(CONFIG_PPC_PSERIES) - int ret, i; -#endif +#endif /* defined(CONFIG_PPC_MULTIPLATFORM) && defined(CONFIG_SMP) */ -#ifdef CONFIG_XMON_DEFAULT - xmon_init(); -#endif -#ifdef CONFIG_PPC_ISERIES - /* pSeries systems are identified in prom.c via OF. */ - if ( itLpNaca.xLparInstalled == 1 ) - systemcfg->platform = PLATFORM_ISERIES_LPAR; -#endif - - switch (systemcfg->platform) { -#ifdef CONFIG_PPC_ISERIES - case PLATFORM_ISERIES_LPAR: - iSeries_init_early(); - break; -#endif +#ifdef CONFIG_PPC_MULTIPLATFORM + +extern struct machdep_calls pSeries_md; +extern struct machdep_calls pmac_md; +/* Ultimately, stuff them in an elf section like initcalls... */ +static struct machdep_calls __initdata *machines[] = { #ifdef CONFIG_PPC_PSERIES - case PLATFORM_PSERIES: - fw_feature_init(); - pSeries_init_early(); - parse_bootinfo(); - break; - - case PLATFORM_PSERIES_LPAR: - fw_feature_init(); - pSeriesLP_init_early(); - parse_bootinfo(); - break; + &pSeries_md, #endif /* CONFIG_PPC_PSERIES */ #ifdef CONFIG_PPC_PMAC - case PLATFORM_POWERMAC: - pmac_init_early(); - parse_bootinfo(); + &pmac_md, #endif /* CONFIG_PPC_PMAC */ + NULL +}; + +/* + * Early initialization entry point. This is called by head.S + * with MMU translation disabled. We rely on the "feature" of + * the CPU that ignores the top 2 bits of the address in real + * mode so we can access kernel globals normally provided we + * only toy with things in the RMO region. From here, we do + * some early parsing of the device-tree to setup out LMB + * data structures, and allocate & initialize the hash table + * and segment tables so we can start running with translation + * enabled. + * + * It is this function which will call the probe() callback of + * the various platform types and copy the matching one to the + * global ppc_md structure. Your platform can eventually do + * some very early initializations from the probe() routine, but + * this is not recommended, be very careful as, for example, the + * device-tree is not accessible via normal means at this point. + */ + +void __init early_setup(unsigned long dt_ptr) +{ + struct paca_struct *lpaca = get_paca(); + static struct machdep_calls **mach; + + /* + * Enable early debugging if any specified (see top of + * this file) + */ + EARLY_DEBUG_INIT(); + + DBG(" -> early_setup()\n"); + + /* + * Fill the default DBG level in naca (do we want to keep + * that old mecanism around forever ?) + */ + ppcdbg_initialize(); + + /* + * Do early initializations using the flattened device + * tree, like retreiving the physical memory map or + * calculating/retreiving the hash table size + */ + early_init_devtree(__va(dt_ptr)); + + /* + * Iterate all ppc_md structures until we find the proper + * one for the current machine type + */ + DBG("Probing machine type for platform %x...\n", + systemcfg->platform); + + for (mach = machines; *mach; mach++) { + if ((*mach)->probe(systemcfg->platform)) + break; + } + /* What can we do if we didn't find ? */ + if (*mach == NULL) { + DBG("No suitable machine found !\n"); + for (;;); + } + ppc_md = **mach; + + /* our udbg callbacks got overriden by the above, let's put them + * back in. Ultimately, I want those things to be split from the + * main ppc_md + */ + EARLY_DEBUG_INIT(); + + DBG("Found, Initializing memory management...\n"); + + /* + * Initialize stab / SLB management + */ + stab_initialize(lpaca->stab_real); + + /* + * Initialize the MMU Hash table and create the linear mapping + * of memory + */ + htab_initialize(); + + DBG(" <- early_setup()\n"); +} + + +/* + * Initialize some remaining members of the naca and systemcfg structures + * (at least until we get rid of them completely). This is mostly some + * cache informations about the CPU that will be used by cache flush + * routines and/or provided to userland + */ +static void __init initialize_naca(void) +{ + struct device_node *np; + unsigned long num_cpus = 0; + + DBG(" -> initialize_naca()\n"); + + for (np = NULL; (np = of_find_node_by_type(np, "cpu"));) { + num_cpus += 1; + + /* We're assuming *all* of the CPUs have the same + * d-cache and i-cache sizes... -Peter + */ + + if ( num_cpus == 1 ) { + u32 *sizep, *lsizep; + u32 size, lsize; + const char *dc, *ic; + + /* Then read cache informations */ + if (systemcfg->platform == PLATFORM_POWERMAC) { + dc = "d-cache-block-size"; + ic = "i-cache-block-size"; + } else { + dc = "d-cache-line-size"; + ic = "i-cache-line-size"; + } + + size = 0; + lsize = cur_cpu_spec->dcache_bsize; + sizep = (u32 *)get_property(np, "d-cache-size", NULL); + if (sizep != NULL) + size = *sizep; + lsizep = (u32 *) get_property(np, dc, NULL); + if (lsizep != NULL) + lsize = *lsizep; + + if (sizep == 0 || lsizep == 0) + DBG("Argh, can't find dcache properties ! " + "sizep: %p, lsizep: %p\n", sizep, lsizep); + + systemcfg->dCacheL1Size = size; + systemcfg->dCacheL1LineSize = lsize; + naca->dCacheL1LogLineSize = __ilog2(lsize); + naca->dCacheL1LinesPerPage = PAGE_SIZE/(lsize); + + size = 0; + lsize = cur_cpu_spec->icache_bsize; + sizep = (u32 *)get_property(np, "i-cache-size", NULL); + if (sizep != NULL) + size = *sizep; + lsizep = (u32 *)get_property(np, ic, NULL); + if (lsizep != NULL) + lsize = *lsizep; + if (sizep == 0 || lsizep == 0) + DBG("Argh, can't find icache properties ! " + "sizep: %p, lsizep: %p\n", sizep, lsizep); + + systemcfg->iCacheL1Size = size; + systemcfg->iCacheL1LineSize = lsize; + naca->iCacheL1LogLineSize = __ilog2(lsize); + naca->iCacheL1LinesPerPage = PAGE_SIZE/(lsize); + + } + } + + /* Add an eye catcher and the systemcfg layout version number */ + strcpy(systemcfg->eye_catcher, "SYSTEMCFG:PPC64"); + systemcfg->version.major = SYSTEMCFG_MAJOR; + systemcfg->version.minor = SYSTEMCFG_MINOR; + systemcfg->processor = mfspr(SPRN_PVR); + + DBG(" <- initialize_naca()\n"); +} + +static void __init check_for_initrd(void) +{ +#ifdef CONFIG_BLK_DEV_INITRD + u64 *prop; + + DBG(" -> check_for_initrd()\n"); + + prop = (u64 *)get_property(of_chosen, "linux,initrd-start", NULL); + if (prop != NULL) { + initrd_start = (unsigned long)__va(*prop); + prop = (u64 *)get_property(of_chosen, "linux,initrd-end", NULL); + if (prop != NULL) { + initrd_end = (unsigned long)__va(*prop); + initrd_below_start_ok = 1; + } else + initrd_start = 0; } /* If we were passed an initrd, set the ROOT_DEV properly if the values * look sensible. If not, clear initrd reference. */ -#ifdef CONFIG_BLK_DEV_INITRD if (initrd_start >= KERNELBASE && initrd_end >= KERNELBASE && initrd_end > initrd_start) ROOT_DEV = Root_RAM0; else initrd_start = initrd_end = 0; + + if (initrd_start) + printk("Found initrd at 0x%lx:0x%lx\n", initrd_start, initrd_end); + + DBG(" <- check_for_initrd()\n"); #endif /* CONFIG_BLK_DEV_INITRD */ +} -#ifdef CONFIG_BOOTX_TEXT - map_boot_text(); - if (systemcfg->platform == PLATFORM_POWERMAC) { - early_console_initialized = 1; - register_console(&udbg_console); - } -#endif /* CONFIG_BOOTX_TEXT */ +#endif /* CONFIG_PPC_MULTIPLATFORM */ -#ifdef CONFIG_PPC_PMAC - if (systemcfg->platform == PLATFORM_POWERMAC) { - finish_device_tree(); - pmac_init(r3, r4, r5, r6, r7); - } -#endif /* CONFIG_PPC_PMAC */ +/* + * Do some initial setup of the system. The parameters are those which + * were passed in from the bootloader. + */ +void __init setup_system(void) +{ + DBG(" -> setup_system()\n"); -#ifdef CONFIG_PPC_PSERIES - if (systemcfg->platform & PLATFORM_PSERIES) { - early_console_initialized = 1; - register_console(&udbg_console); - __irq_offset_value = NUM_ISA_INTERRUPTS; - finish_device_tree(); - chrp_init(r3, r4, r5, r6, r7); - } -#endif /* CONFIG_PPC_PSERIES */ +#ifdef CONFIG_PPC_ISERIES + /* pSeries systems are identified in prom.c via OF. */ + if (itLpNaca.xLparInstalled == 1) + systemcfg->platform = PLATFORM_ISERIES_LPAR; + + ppc_md.init_early(); +#else /* CONFIG_PPC_ISERIES */ -#ifdef CONFIG_SMP -#ifndef CONFIG_PPC_ISERIES /* - * iSeries has already initialized the cpu maps at this point. + * Unflatten the device-tree passed by prom_init or kexec */ - setup_cpu_maps(); -#endif /* CONFIG_PPC_ISERIES */ + unflatten_device_tree(); + + /* + * Fill the naca & systemcfg structures with informations + * retreived from the device-tree. Need to be called before + * finish_device_tree() since the later requires some of the + * informations filled up here to properly parse the interrupt + * tree. + * It also sets up the cache line sizes which allows to call + * routines like flush_icache_range (used by the hash init + * later on). + */ + initialize_naca(); #ifdef CONFIG_PPC_PSERIES - /* Start secondary threads on SMT systems; primary threads - * are already in the running state. + /* + * Initialize RTAS if available */ - for_each_present_cpu(i) { - if (query_cpu_stopped(get_hard_smp_processor_id(i)) == 0) { - printk("%16.16x : starting thread\n", i); - rtas_call(rtas_token("start-cpu"), 3, 1, &ret, - get_hard_smp_processor_id(i), - (u32)*((unsigned long *)pseries_secondary_smp_init), - i); - } - } + rtas_initialize(); #endif /* CONFIG_PPC_PSERIES */ -#endif /* CONFIG_SMP */ -#if defined(CONFIG_HOTPLUG_CPU) && !defined(CONFIG_PPC_PMAC) - rtas_stop_self_args.token = rtas_token("stop-self"); -#endif /* CONFIG_HOTPLUG_CPU && !CONFIG_PPC_PMAC */ + /* + * Check if we have an initrd provided via the device-tree + */ + check_for_initrd(); - /* Finish initializing the hash table (do the dynamic - * patching for the fast-path hashtable.S code) + /* + * Do some platform specific early initializations, that includes + * setting up the hash table pointers. It also sets up some interrupt-mapping + * related options that will be used by finish_device_tree() */ - htab_finish_init(); + ppc_md.init_early(); + + /* + * "Finish" the device-tree, that is do the actual parsing of + * some of the properties like the interrupt map + */ + finish_device_tree(); + + /* + * Initialize xmon + */ +#ifdef CONFIG_XMON_DEFAULT + xmon_init(); +#endif + /* + * Register early console + */ + early_console_initialized = 1; + register_console(&udbg_console); + +#endif /* !CONFIG_PPC_ISERIES */ + + /* Save unparsed command line copy for /proc/cmdline */ + strlcpy(saved_command_line, cmd_line, COMMAND_LINE_SIZE); + + parse_early_param(); + +#if defined(CONFIG_SMP) && !defined(CONFIG_PPC_ISERIES) + /* + * iSeries has already initialized the cpu maps at this point. + */ + setup_cpu_maps(); +#endif /* defined(CONFIG_SMP) && !defined(CONFIG_PPC_ISERIES) */ printk("Starting Linux PPC64 %s\n", UTS_RELEASE); @@ -385,28 +639,10 @@ mm_init_ppc64(); -#if defined(CONFIG_SMP) && defined(CONFIG_PPC_PSERIES) - if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR) { - vpa_init(boot_cpuid); - } -#endif - - /* Select the correct idle loop for the platform. */ - idle_setup(); - - switch (systemcfg->platform) { -#ifdef CONFIG_PPC_ISERIES - case PLATFORM_ISERIES_LPAR: - iSeries_init(); - break; -#endif - default: - /* The following relies on the device tree being */ - /* fully configured. */ - parse_cmd_line(r3, r4, r5, r6, r7); - } + DBG(" <- setup_system()\n"); } + void machine_restart(char *cmd) { if (ppc_md.nvram_sync) @@ -476,7 +712,7 @@ #ifdef CONFIG_SMP pvr = per_cpu(pvr, cpu_id); #else - pvr = _get_PVR(); + pvr = mfpvr(PSRN_PVR); #endif maj = (pvr >> 8) & 0xFF; min = pvr & 0xFF; @@ -528,74 +764,75 @@ .show = show_cpuinfo, }; -/* - * Fetch the cmd_line from open firmware. - */ -void parse_cmd_line(unsigned long r3, unsigned long r4, unsigned long r5, - unsigned long r6, unsigned long r7) -{ - cmd_line[0] = 0; - -#ifdef CONFIG_CMDLINE - strlcpy(cmd_line, CONFIG_CMDLINE, sizeof(cmd_line)); -#endif /* CONFIG_CMDLINE */ +#if 0 /* XXX not currently used */ +unsigned long memory_limit; -#ifdef CONFIG_PPC_PSERIES - { - struct device_node *chosen; +static int __init early_parsemem(char *p) +{ + if (!p) + return 0; - chosen = of_find_node_by_name(NULL, "chosen"); - if (chosen != NULL) { - char *p; - p = get_property(chosen, "bootargs", NULL); - if (p != NULL && p[0] != 0) - strlcpy(cmd_line, p, sizeof(cmd_line)); - of_node_put(chosen); - } - } -#endif + memory_limit = memparse(p, &p); - /* Look for mem= option on command line */ - if (strstr(cmd_line, "mem=")) { - char *p, *q; - unsigned long maxmem = 0; - extern unsigned long __max_memory; - - for (q = cmd_line; (p = strstr(q, "mem=")) != 0; ) { - q = p + 4; - if (p > cmd_line && p[-1] != ' ') - continue; - maxmem = simple_strtoul(q, &q, 0); - if (*q == 'k' || *q == 'K') { - maxmem <<= 10; - ++q; - } else if (*q == 'm' || *q == 'M') { - maxmem <<= 20; - ++q; - } - } - __max_memory = maxmem; - } + return 0; } +early_param("mem", early_parsemem); +#endif -#ifdef CONFIG_PPC_PSERIES +#ifdef CONFIG_PPC_MULTIPLATFORM static int __init set_preferred_console(void) { struct device_node *prom_stdout; char *name; - int offset; + int offset = 0; +#if 0 + phandle *stdout_ph; +#endif + DBG(" -> set_preferred_console()\n"); /* The user has requested a console so this is already set up. */ - if (strstr(saved_command_line, "console=")) + if (strstr(saved_command_line, "console=")) { + DBG(" console was specified !\n"); return -EBUSY; + } - prom_stdout = find_path_device(of_stdout_device); - if (!prom_stdout) + if (!of_chosen) { + DBG(" of_chosen is NULL !\n"); + return -ENODEV; + } + /* We are getting a weird phandle from OF ... */ +#if 0 + stdout_ph = (phandle *)get_property(of_chosen, "linux,stdout-package", NULL); + if (stdout_ph == NULL) { + DBG(" no linux,stdout-package !\n"); + return -ENODEV; + } + prom_stdout = of_find_node_by_phandle(*stdout_ph); + if (!prom_stdout) { + DBG(" can't find stdout package for phandle 0x%x !\n", *stdout_ph); return -ENODEV; + } +#endif + /* ... So use the full path instead */ +#if 1 + name = (char *)get_property(of_chosen, "linux,stdout-path", NULL); + if (name == NULL) { + DBG(" no linux,stdout-path !\n"); + return -ENODEV; + } + prom_stdout = of_find_node_by_path(name); + if (!prom_stdout) { + DBG(" can't find stdout package %s !\n", name); + return -ENODEV; + } +#endif + DBG("stdout is %s\n", prom_stdout->full_name); name = (char *)get_property(prom_stdout, "name", NULL); - if (!name) - return -ENODEV; + if (!name) { + DBG(" stdout package has no name !\n"); + goto not_found; + } if (strcmp(name, "serial") == 0) { int i; @@ -616,10 +853,12 @@ break; default: /* We dont recognise the serial port */ - return -ENODEV; + goto not_found; } } - } else if (strcmp(name, "vty") == 0) { + } +#ifdef CONFIG_PPC_PSERIES + else if (strcmp(name, "vty") == 0) { u32 *reg = (u32 *)get_property(prom_stdout, "reg", NULL); char *compat = (char *)get_property(prom_stdout, "compatible", NULL); @@ -634,69 +873,38 @@ offset = 1; break; default: - return -ENODEV; + goto not_found; } + of_node_put(prom_stdout); + DBG("Found hvsi console at offset %d\n", offset); return add_preferred_console("hvsi", offset, NULL); } else { /* pSeries LPAR virtual console */ + of_node_put(prom_stdout); + DBG("Found hvc console\n"); return add_preferred_console("hvc", 0, NULL); } - } else if (strcmp(name, "ch-a") == 0) + } +#endif /* CONFIG_PPC_PSERIES */ + else if (strcmp(name, "ch-a") == 0) offset = 0; else if (strcmp(name, "ch-b") == 0) offset = 1; else - return -ENODEV; + goto not_found; + of_node_put(prom_stdout); + + DBG("Found serial console at ttyS%d\n", offset); return add_preferred_console("ttyS", offset, NULL); + not_found: + DBG("No preferred console found !\n"); + of_node_put(prom_stdout); + return -ENODEV; } console_initcall(set_preferred_console); - -int parse_bootinfo(void) -{ - struct bi_record *rec; - - rec = prom.bi_recs; - - if ( rec == NULL || rec->tag != BI_FIRST ) - return -1; - - for ( ; rec->tag != BI_LAST ; rec = bi_rec_next(rec) ) { - switch (rec->tag) { - case BI_CMD_LINE: - strlcpy(cmd_line, (void *)rec->data, sizeof(cmd_line)); - break; - } - } - - return 0; -} -#endif - -int __init ppc_init(void) -{ - /* clear the progress line */ - ppc_md.progress(" ", 0xffff); - - if (ppc_md.init != NULL) { - ppc_md.init(); - } - return 0; -} - -arch_initcall(ppc_init); - -void __init ppc64_calibrate_delay(void) -{ - loops_per_jiffy = tb_ticks_per_jiffy; - - printk("Calibrating delay loop... %lu.%02lu BogoMips\n", - loops_per_jiffy/(500000/HZ), - loops_per_jiffy/(5000/HZ) % 100); -} - -extern void (*calibrate_delay)(void); +#endif /* CONFIG_PPC_MULTIPLATFORM */ #ifdef CONFIG_IRQSTACKS static void __init irqstack_early_init(void) @@ -753,17 +961,9 @@ extern int panic_timeout; extern void do_init_bootmem(void); - calibrate_delay = ppc64_calibrate_delay; - ppc64_boot_msg(0x12, "Setup Arch"); -#ifdef CONFIG_XMON - if (strstr(cmd_line, "xmon")) { - /* ensure xmon is enabled */ - xmon_init(); - debugger(0); - } -#endif /* CONFIG_XMON */ + *cmdline_p = cmd_line; /* * Set cache line size based on type of cpu as a default. @@ -784,22 +984,22 @@ init_mm.end_data = (unsigned long) _edata; init_mm.brk = klimit; - /* Save unparsed command line copy for /proc/cmdline */ - strlcpy(saved_command_line, cmd_line, COMMAND_LINE_SIZE); - *cmdline_p = cmd_line; - irqstack_early_init(); emergency_stack_init(); /* set up the bootmem stuff with available memory */ do_init_bootmem(); + /* Select the correct idle loop for the platform. */ + idle_setup(); + ppc_md.setup_arch(); paging_init(); ppc64_boot_msg(0x15, "Setup Done"); } + /* ToDo: do something useful if ppc_md is not yet setup. */ #define PPC64_LINUX_FUNCTION 0x0f000000 #define PPC64_IPL_MESSAGE 0xc0000000 @@ -904,3 +1104,16 @@ __setup("spread_lpevents=", set_spread_lpevents ); __setup("decr_overclock_proc0=", set_decr_overclock_proc0 ); __setup("decr_overclock=", set_decr_overclock ); + +#ifdef CONFIG_XMON +static int __init early_xmon(char *p) +{ + /* ensure xmon is enabled */ + xmon_init(); + debugger(0); + + return 0; +} +early_param("xmon", early_xmon); +#endif + diff -Nru a/arch/ppc64/kernel/signal.c b/arch/ppc64/kernel/signal.c --- a/arch/ppc64/kernel/signal.c 2004-09-26 10:25:55 -07:00 +++ b/arch/ppc64/kernel/signal.c 2004-09-26 10:25:55 -07:00 @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include @@ -178,7 +177,7 @@ elf_vrreg_t __user *v_regs; #endif unsigned long err = 0; - unsigned long save_r13; + unsigned long save_r13 = 0; elf_greg_t *gregs = (elf_greg_t *)regs; int i; @@ -371,7 +370,8 @@ printk("badframe in sys_rt_sigreturn, regs=%p uc=%p &uc->uc_mcontext=%p\n", regs, uc, &uc->uc_mcontext); #endif - do_exit(SIGSEGV); + force_sig(SIGSEGV, current); + return 0; } static void setup_rt_frame(int signr, struct k_sigaction *ka, siginfo_t *info, @@ -446,7 +446,7 @@ printk("badframe in setup_rt_frame, regs=%p frame=%p newsp=%lx\n", regs, frame, newsp); #endif - do_exit(SIGSEGV); + force_sigsegv(signr, current); } diff -Nru a/arch/ppc64/kernel/signal32.c b/arch/ppc64/kernel/signal32.c --- a/arch/ppc64/kernel/signal32.c 2004-09-26 10:25:57 -07:00 +++ b/arch/ppc64/kernel/signal32.c 2004-09-26 10:25:57 -07:00 @@ -189,7 +189,7 @@ elf_greg_t64 *gregs = (elf_greg_t64 *)regs; int i; long err = 0; - unsigned int save_r2; + unsigned int save_r2 = 0; #ifdef CONFIG_ALTIVEC unsigned long msr; #endif @@ -472,9 +472,13 @@ &d->si_addr); break; case __SI_POLL >> 16: - case __SI_TIMER >> 16: err |= __put_user(s->si_band, &d->si_band); err |= __put_user(s->si_fd, &d->si_fd); + break; + case __SI_TIMER >> 16: + err |= __put_user(s->si_tid, &d->si_tid); + err |= __put_user(s->si_overrun, &d->si_overrun); + err |= __put_user(s->si_int, &d->si_int); break; case __SI_RT >> 16: /* This is not generated by the kernel as of now. */ case __SI_MESGQ >> 16: diff -Nru a/arch/ppc64/kernel/smp.c b/arch/ppc64/kernel/smp.c --- a/arch/ppc64/kernel/smp.c 2004-09-26 10:25:57 -07:00 +++ b/arch/ppc64/kernel/smp.c 2004-09-26 10:25:57 -07:00 @@ -15,6 +15,8 @@ * 2 of the License, or (at your option) any later version. */ +#undef DEBUG + #include #include #include @@ -52,6 +54,13 @@ #include #include #include +#include + +#ifdef DEBUG +#define DBG(fmt...) udbg_printf(fmt) +#else +#define DBG(fmt...) +#endif int smp_threads_ready; unsigned long cache_decay_ticks; @@ -74,9 +83,14 @@ extern long register_vpa(unsigned long flags, unsigned long proc, unsigned long vpa); +int smt_enabled_at_boot = 1; +int boot_cpuid = 0; + /* Low level assembly function used to backup CPU 0 state */ extern void __save_cpu_setup(void); +extern void pseries_secondary_smp_init(unsigned long); + #ifdef CONFIG_PPC_ISERIES static unsigned long iSeries_smp_message[NR_CPUS]; @@ -180,7 +194,7 @@ } #endif -#ifdef CONFIG_PPC_PSERIES +#ifdef CONFIG_PPC_MULTIPLATFORM void smp_openpic_message_pass(int target, int msg) { /* make sure we're sending something that translates to an IPI */ @@ -221,6 +235,10 @@ do_openpic_setup_cpu(); } +#endif /* CONFIG_PPC_MULTIPLATFORM */ + +#ifdef CONFIG_PPC_PSERIES + /* Get state of physical CPU. * Return codes: * 0 - The processor is in the RTAS stopped state @@ -234,6 +252,7 @@ int cpu_status; int status, qcss_tok; + DBG(" -> query_cpu_stopped(%d)\n", pcpu); qcss_tok = rtas_token("query-cpu-stopped-state"); if (qcss_tok == RTAS_UNKNOWN_SERVICE) return -1; @@ -244,6 +263,8 @@ return status; } + DBG(" <- query_cpu_stopped(), status: %d\n", cpu_status); + return cpu_status; } @@ -273,8 +294,7 @@ for (tries = 0; tries < 25; tries++) { cpu_status = query_cpu_stopped(pcpu); - - if (cpu_status == 0) + if (cpu_status == 0 || cpu_status == -1) break; set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout(HZ/5); @@ -371,13 +391,12 @@ static inline int __devinit smp_startup_cpu(unsigned int lcpu) { int status; - extern void (*pseries_secondary_smp_init)(unsigned int cpu); unsigned long start_here = __pa(pseries_secondary_smp_init); unsigned int pcpu; /* At boot time the cpus are already spinning in hold * loops, so nothing to do. */ - if (system_state == SYSTEM_BOOTING) + if (system_state < SYSTEM_RUNNING) return 1; pcpu = find_physical_cpu_to_start(get_hard_smp_processor_id(lcpu)); @@ -439,7 +458,7 @@ } #ifdef CONFIG_PPC_PSERIES -void vpa_init(int cpu) +static void vpa_init(int cpu) { unsigned long flags, pcpu = get_hard_smp_processor_id(cpu); @@ -530,19 +549,43 @@ /* This is called very early */ void __init smp_init_pSeries(void) { + int ret, i; + + DBG(" -> smp_init_pSeries()\n"); if (naca->interrupt_controller == IC_OPEN_PIC) smp_ops = &pSeries_openpic_smp_ops; else smp_ops = &pSeries_xics_smp_ops; + /* Start secondary threads on SMT systems; primary threads + * are already in the running state. + */ + for_each_present_cpu(i) { + if (query_cpu_stopped(get_hard_smp_processor_id(i)) == 0) { + printk("%16.16x : starting thread\n", i); + DBG("%16.16x : starting thread\n", i); + rtas_call(rtas_token("start-cpu"), 3, 1, &ret, + get_hard_smp_processor_id(i), + __pa((u32)*((unsigned long *) + pseries_secondary_smp_init)), + i); + } + } + + if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR) + vpa_init(boot_cpuid); + /* Non-lpar has additional take/give timebase */ if (systemcfg->platform == PLATFORM_PSERIES) { smp_ops->give_timebase = pSeries_give_timebase; smp_ops->take_timebase = pSeries_take_timebase; } + + + DBG(" <- smp_init_pSeries()\n"); } -#endif +#endif /* CONFIG_PPC_PSERIES */ void smp_local_timer_interrupt(struct pt_regs * regs) { @@ -747,7 +790,7 @@ static void __devinit smp_store_cpu_info(int id) { - per_cpu(pvr, id) = _get_PVR(); + per_cpu(pvr, id) = mfspr(SPRN_PVR); } static void __init smp_create_idle(unsigned int cpu) @@ -815,7 +858,7 @@ int c; /* At boot, don't bother with non-present cpus -JSCHOPP */ - if (system_state == SYSTEM_BOOTING && !cpu_present(cpu)) + if (system_state < SYSTEM_RUNNING && !cpu_present(cpu)) return -ENOENT; paca[cpu].default_decr = tb_ticks_per_jiffy / decr_overclock; @@ -847,7 +890,7 @@ * use this value that I found through experimentation. * -- Cort */ - if (system_state == SYSTEM_BOOTING) + if (system_state < SYSTEM_RUNNING) for (c = 5000; c && !cpu_callin_map[cpu]; c--) udelay(100); #ifdef CONFIG_HOTPLUG_CPU @@ -942,4 +985,12 @@ smp_threads_ready = 1; set_cpus_allowed(current, old_mask); + + /* + * We know at boot the maximum number of cpus we can add to + * a partition and set cpu_possible_map accordingly. cpu_present_map + * needs to match for the hotplug code to allow us to hot add + * any offline cpus. + */ + cpu_present_map = cpu_possible_map; } diff -Nru a/arch/ppc64/kernel/sys_ppc32.c b/arch/ppc64/kernel/sys_ppc32.c --- a/arch/ppc64/kernel/sys_ppc32.c 2004-09-26 10:25:57 -07:00 +++ b/arch/ppc64/kernel/sys_ppc32.c 2004-09-26 10:25:57 -07:00 @@ -72,7 +72,6 @@ #include #include #include -#include #include #include "pci.h" @@ -634,8 +633,24 @@ void start_thread32(struct pt_regs* regs, unsigned long nip, unsigned long sp) { set_fs(USER_DS); - memset(regs->gpr, 0, sizeof(regs->gpr)); - memset(®s->ctr, 0, 4 * sizeof(regs->ctr)); + + /* + * If we exec out of a kernel thread then thread.regs will not be + * set. Do it now. + */ + if (!current->thread.regs) { + unsigned long childregs = (unsigned long)current->thread_info + + THREAD_SIZE; + childregs -= sizeof(struct pt_regs); + current->thread.regs = childregs; + } + + /* + * ELF_PLAT_INIT already clears all registers but it also sets r2. + * So just clear r2 here. + */ + regs->gpr[2] = 0; + regs->nip = nip; regs->gpr[1] = sp; regs->msr = MSR_USER32; @@ -700,7 +715,7 @@ (unsigned long) dfn, (unsigned long) off, (unsigned long) len, - (unsigned char __user *)AA(ubuf)); + compat_ptr(ubuf)); } asmlinkage int sys32_pciconfig_write(u32 bus, u32 dfn, u32 off, u32 len, u32 ubuf) @@ -709,7 +724,7 @@ (unsigned long) dfn, (unsigned long) off, (unsigned long) len, - (unsigned char __user *)AA(ubuf)); + compat_ptr(ubuf)); } #define IOBASE_BRIDGE_NUMBER 0 @@ -1095,7 +1110,7 @@ u32 __unused[4]; }; -extern asmlinkage long sys32_sysctl(struct __sysctl_args32 __user *args) +asmlinkage long sys32_sysctl(struct __sysctl_args32 __user *args) { struct __sysctl_args32 tmp; int error; @@ -1114,19 +1129,20 @@ glibc's __sysctl uses rw memory for the structure anyway. */ oldlenp = (size_t __user *)addr; - if (get_user(oldlen, (u32 __user *)A(tmp.oldlenp)) || + if (get_user(oldlen, (compat_size_t __user *)compat_ptr(tmp.oldlenp)) || put_user(oldlen, oldlenp)) return -EFAULT; } lock_kernel(); - error = do_sysctl((int __user *)A(tmp.name), tmp.nlen, (void __user *)A(tmp.oldval), - oldlenp, (void __user *)A(tmp.newval), tmp.newlen); + error = do_sysctl(compat_ptr(tmp.name), tmp.nlen, + compat_ptr(tmp.oldval), oldlenp, + compat_ptr(tmp.newval), tmp.newlen); unlock_kernel(); if (oldlenp) { if (!error) { if (get_user(oldlen, oldlenp) || - put_user(oldlen, (u32 __user *)A(tmp.oldlenp))) + put_user(oldlen, (compat_size_t __user *)compat_ptr(tmp.oldlenp))) error = -EFAULT; } copy_to_user(args->__unused, tmp.__unused, sizeof(tmp.__unused)); diff -Nru a/arch/ppc64/kernel/sysfs.c b/arch/ppc64/kernel/sysfs.c --- a/arch/ppc64/kernel/sysfs.c 2004-09-26 10:25:55 -07:00 +++ b/arch/ppc64/kernel/sysfs.c 2004-09-26 10:25:55 -07:00 @@ -97,6 +97,14 @@ /* PMC stuff */ +#ifdef CONFIG_PPC_ISERIES +void ppc64_enable_pmcs(void) +{ + /* XXX Implement for iseries */ +} +#endif + +#ifdef CONFIG_PPC_MULTIPLATFORM /* * Enabling PMCs will slow partition context switch times so we only do * it the first time we write to the PMCs. @@ -104,18 +112,14 @@ static DEFINE_PER_CPU(char, pmcs_enabled); -#ifdef CONFIG_PPC_ISERIES -void ppc64_enable_pmcs(void) -{ - /* XXX Implement for iseries */ -} -#else void ppc64_enable_pmcs(void) { unsigned long hid0; +#ifdef CONFIG_PPC_PSERIES unsigned long set, reset; int ret; unsigned int ctrl; +#endif /* CONFIG_PPC_PSERIES */ /* Only need to enable them once */ if (__get_cpu_var(pmcs_enabled)) @@ -124,38 +128,42 @@ __get_cpu_var(pmcs_enabled) = 1; switch (systemcfg->platform) { - case PLATFORM_PSERIES: - hid0 = mfspr(HID0); - hid0 |= 1UL << (63 - 20); - - /* POWER4 requires the following sequence */ - asm volatile( - "sync\n" - "mtspr %1, %0\n" - "mfspr %0, %1\n" - "mfspr %0, %1\n" - "mfspr %0, %1\n" - "mfspr %0, %1\n" - "mfspr %0, %1\n" - "mfspr %0, %1\n" - "isync" : "=&r" (hid0) : "i" (HID0), "0" (hid0): - "memory"); - break; - - case PLATFORM_PSERIES_LPAR: - set = 1UL << 63; - reset = 0; - ret = plpar_hcall_norets(H_PERFMON, set, reset); - if (ret) - printk(KERN_ERR "H_PERFMON call on cpu %u " - "returned %d\n", - smp_processor_id(), ret); - break; + case PLATFORM_PSERIES: + case PLATFORM_POWERMAC: + hid0 = mfspr(HID0); + hid0 |= 1UL << (63 - 20); + + /* POWER4 requires the following sequence */ + asm volatile( + "sync\n" + "mtspr %1, %0\n" + "mfspr %0, %1\n" + "mfspr %0, %1\n" + "mfspr %0, %1\n" + "mfspr %0, %1\n" + "mfspr %0, %1\n" + "mfspr %0, %1\n" + "isync" : "=&r" (hid0) : "i" (HID0), "0" (hid0): + "memory"); + break; + +#ifdef CONFIG_PPC_PSERIES + case PLATFORM_PSERIES_LPAR: + set = 1UL << 63; + reset = 0; + ret = plpar_hcall_norets(H_PERFMON, set, reset); + if (ret) + printk(KERN_ERR "H_PERFMON call on cpu %u " + "returned %d\n", + smp_processor_id(), ret); + break; +#endif /* CONFIG_PPC_PSERIES */ - default: - break; + default: + break; } +#ifdef CONFIG_PPC_PSERIES /* instruct hypervisor to maintain PMCs */ if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR) { char *ptr = (char *)&paca[smp_processor_id()].lppaca; @@ -171,8 +179,9 @@ ctrl |= RUNLATCH; mtspr(CTRLT, ctrl); } +#endif /* CONFIG_PPC_PSERIES */ } -#endif +#endif /* CONFIG_PPC_MULTIPLATFORM */ EXPORT_SYMBOL(ppc64_enable_pmcs); diff -Nru a/arch/ppc64/kernel/time.c b/arch/ppc64/kernel/time.c --- a/arch/ppc64/kernel/time.c 2004-09-26 10:25:57 -07:00 +++ b/arch/ppc64/kernel/time.c 2004-09-26 10:25:57 -07:00 @@ -84,7 +84,7 @@ #define XSEC_PER_SEC (1024*1024) unsigned long tb_ticks_per_jiffy; -unsigned long tb_ticks_per_usec; +unsigned long tb_ticks_per_usec = 100; /* sane default */ unsigned long tb_ticks_per_sec; unsigned long next_xtime_sync_tb; unsigned long xtime_sync_interval; diff -Nru a/arch/ppc64/kernel/udbg.c b/arch/ppc64/kernel/udbg.c --- a/arch/ppc64/kernel/udbg.c 2004-09-26 10:25:55 -07:00 +++ b/arch/ppc64/kernel/udbg.c 2004-09-26 10:25:55 -07:00 @@ -84,23 +84,38 @@ void udbg_init_scc(struct device_node *np) { + u32 *reg; unsigned long addr; int i, x; if (np == NULL) np = of_find_node_by_name(NULL, "escc"); - if (np == NULL) + if (np == NULL || np->parent == NULL) + return; + + udbg_printf("found SCC...\n"); + /* Get address within mac-io ASIC */ + reg = (u32 *)get_property(np, "reg", NULL); + if (reg == NULL) + return; + addr = reg[0]; + udbg_printf("local addr: %lx\n", addr); + /* Get address of mac-io PCI itself */ + reg = (u32 *)get_property(np->parent, "assigned-addresses", NULL); + if (reg == NULL) return; - - /* Lock-enable the SCC channel */ - pmac_call_feature(PMAC_FTR_SCC_ENABLE, np, PMAC_SCC_ASYNC | PMAC_SCC_FLAG_XMON, 1); + addr += reg[2]; + udbg_printf("final addr: %lx\n", addr); /* Setup for 57600 8N1 */ - addr = np->addrs[0].address + 0x20; + addr += 0x20; sccc = (volatile u8 *) ioremap(addr & PAGE_MASK, PAGE_SIZE) ; sccc += addr & ~PAGE_MASK; sccd = sccc + 0x10; + udbg_printf("ioremap result sccc: %p\n", sccc); + mb(); + for (i = 20000; i != 0; --i) x = *sccc; eieio(); *sccc = 9; eieio(); /* reset A or B side */ @@ -119,6 +134,30 @@ #endif /* CONFIG_PPC_PMAC */ +#if CONFIG_PPC_PMAC +extern u8 real_readb(volatile u8 *addr); +extern void real_writeb(u8 data, volatile u8 *addr); + +static void udbg_real_putc(unsigned char c) +{ + while ((real_readb(sccc) & SCC_TXRDY) == 0) + ; + real_writeb(c, sccd); + if (c == '\n') + udbg_real_putc('\r'); +} + +void udbg_init_pmac_realmode(void) +{ + sccc = (volatile u8 *)0x80013020ul; + sccd = (volatile u8 *)0x80013030ul; + + ppc_md.udbg_putc = udbg_real_putc; + ppc_md.udbg_getc = NULL; + ppc_md.udbg_getc_poll = NULL; +} +#endif /* CONFIG_PPC_PMAC */ + void udbg_putc(unsigned char c) { if (udbg_comport) { @@ -191,9 +230,12 @@ while ((c = *s++) != '\0') ppc_md.udbg_putc(c); } - } else { + } +#if 0 + else { printk("%s", s); } +#endif } int udbg_write(const char *s, int n) @@ -218,7 +260,7 @@ char c, *p = buf; int i; - if (!ppc_md.udbg_putc) + if (!ppc_md.udbg_getc) return 0; for (i = 0; i < buflen; ++i) { diff -Nru a/arch/ppc64/kernel/vio.c b/arch/ppc64/kernel/vio.c --- a/arch/ppc64/kernel/vio.c 2004-09-26 10:25:55 -07:00 +++ b/arch/ppc64/kernel/vio.c 2004-09-26 10:25:55 -07:00 @@ -225,6 +225,10 @@ struct vio_dev *viodev; int i; + /* there is only one of each of these */ + vio_register_device_iseries("viocons", 0); + vio_register_device_iseries("vscsi", 0); + vlan_map = HvLpConfig_getVirtualLanIndexMap(); for (i = 0; i < HVMAXARCHITECTEDVIRTUALLANS; i++) { if ((vlan_map & (0x8000 >> i)) == 0) diff -Nru a/arch/ppc64/kernel/vmlinux.lds.S b/arch/ppc64/kernel/vmlinux.lds.S --- a/arch/ppc64/kernel/vmlinux.lds.S 2004-09-26 10:25:57 -07:00 +++ b/arch/ppc64/kernel/vmlinux.lds.S 2004-09-26 10:25:57 -07:00 @@ -117,8 +117,11 @@ .data : { *(.data .data.rel* .toc1) - *(.opd) *(.branch_lt) + } + + .opd : { + *(.opd) } .got : { diff -Nru a/arch/ppc64/lib/locks.c b/arch/ppc64/lib/locks.c --- a/arch/ppc64/lib/locks.c 2004-09-26 10:25:56 -07:00 +++ b/arch/ppc64/lib/locks.c 2004-09-26 10:25:56 -07:00 @@ -20,8 +20,6 @@ #include #include -#ifndef CONFIG_SPINLINE - /* waiting for a spinlock... */ #if defined(CONFIG_PPC_SPLPAR) || defined(CONFIG_PPC_ISERIES) @@ -95,5 +93,3 @@ } EXPORT_SYMBOL(spin_unlock_wait); - -#endif /* CONFIG_SPINLINE */ diff -Nru a/arch/ppc64/mm/Makefile b/arch/ppc64/mm/Makefile --- a/arch/ppc64/mm/Makefile 2004-09-26 10:25:55 -07:00 +++ b/arch/ppc64/mm/Makefile 2004-09-26 10:25:55 -07:00 @@ -8,3 +8,4 @@ slb_low.o slb.o stab.o mmap.o obj-$(CONFIG_DISCONTIGMEM) += numa.o obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o +obj-$(CONFIG_PPC_MULTIPLATFORM) += hash_native.o diff -Nru a/arch/ppc64/mm/hash_native.c b/arch/ppc64/mm/hash_native.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/ppc64/mm/hash_native.c 2004-09-26 10:25:56 -07:00 @@ -0,0 +1,419 @@ +/* + * native hashtable management. + * + * SMP scalability work: + * Copyright (C) 2001 Anton Blanchard , IBM + * + * 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 +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#define HPTE_LOCK_BIT 3 + +static spinlock_t native_tlbie_lock = SPIN_LOCK_UNLOCKED; + +static inline void native_lock_hpte(HPTE *hptep) +{ + unsigned long *word = &hptep->dw0.dword0; + + while (1) { + if (!test_and_set_bit(HPTE_LOCK_BIT, word)) + break; + while(test_bit(HPTE_LOCK_BIT, word)) + cpu_relax(); + } +} + +static inline void native_unlock_hpte(HPTE *hptep) +{ + unsigned long *word = &hptep->dw0.dword0; + + asm volatile("lwsync":::"memory"); + clear_bit(HPTE_LOCK_BIT, word); +} + +long native_hpte_insert(unsigned long hpte_group, unsigned long va, + unsigned long prpn, int secondary, + unsigned long hpteflags, int bolted, int large) +{ + unsigned long arpn = physRpn_to_absRpn(prpn); + HPTE *hptep = htab_data.htab + hpte_group; + Hpte_dword0 dw0; + HPTE lhpte; + int i; + + for (i = 0; i < HPTES_PER_GROUP; i++) { + dw0 = hptep->dw0.dw0; + + if (!dw0.v) { + /* retry with lock held */ + native_lock_hpte(hptep); + dw0 = hptep->dw0.dw0; + if (!dw0.v) + break; + native_unlock_hpte(hptep); + } + + hptep++; + } + + if (i == HPTES_PER_GROUP) + return -1; + + lhpte.dw1.dword1 = 0; + lhpte.dw1.dw1.rpn = arpn; + lhpte.dw1.flags.flags = hpteflags; + + lhpte.dw0.dword0 = 0; + lhpte.dw0.dw0.avpn = va >> 23; + lhpte.dw0.dw0.h = secondary; + lhpte.dw0.dw0.bolted = bolted; + lhpte.dw0.dw0.v = 1; + + if (large) { + lhpte.dw0.dw0.l = 1; + lhpte.dw0.dw0.avpn &= ~0x1UL; + } + + hptep->dw1.dword1 = lhpte.dw1.dword1; + + /* Guarantee the second dword is visible before the valid bit */ + __asm__ __volatile__ ("eieio" : : : "memory"); + + /* + * Now set the first dword including the valid bit + * NOTE: this also unlocks the hpte + */ + hptep->dw0.dword0 = lhpte.dw0.dword0; + + __asm__ __volatile__ ("ptesync" : : : "memory"); + + return i | (secondary << 3); +} + +static long native_hpte_remove(unsigned long hpte_group) +{ + HPTE *hptep; + Hpte_dword0 dw0; + int i; + int slot_offset; + + /* pick a random entry to start at */ + slot_offset = mftb() & 0x7; + + for (i = 0; i < HPTES_PER_GROUP; i++) { + hptep = htab_data.htab + hpte_group + slot_offset; + dw0 = hptep->dw0.dw0; + + if (dw0.v && !dw0.bolted) { + /* retry with lock held */ + native_lock_hpte(hptep); + dw0 = hptep->dw0.dw0; + if (dw0.v && !dw0.bolted) + break; + native_unlock_hpte(hptep); + } + + slot_offset++; + slot_offset &= 0x7; + } + + if (i == HPTES_PER_GROUP) + return -1; + + /* Invalidate the hpte. NOTE: this also unlocks it */ + hptep->dw0.dword0 = 0; + + return i; +} + +static inline void set_pp_bit(unsigned long pp, HPTE *addr) +{ + unsigned long old; + unsigned long *p = &addr->dw1.dword1; + + __asm__ __volatile__( + "1: ldarx %0,0,%3\n\ + rldimi %0,%2,0,61\n\ + stdcx. %0,0,%3\n\ + bne 1b" + : "=&r" (old), "=m" (*p) + : "r" (pp), "r" (p), "m" (*p) + : "cc"); +} + +/* + * Only works on small pages. Yes its ugly to have to check each slot in + * the group but we only use this during bootup. + */ +static long native_hpte_find(unsigned long vpn) +{ + HPTE *hptep; + unsigned long hash; + unsigned long i, j; + long slot; + Hpte_dword0 dw0; + + hash = hpt_hash(vpn, 0); + + for (j = 0; j < 2; j++) { + slot = (hash & htab_data.htab_hash_mask) * HPTES_PER_GROUP; + for (i = 0; i < HPTES_PER_GROUP; i++) { + hptep = htab_data.htab + slot; + dw0 = hptep->dw0.dw0; + + if ((dw0.avpn == (vpn >> 11)) && dw0.v && + (dw0.h == j)) { + /* HPTE matches */ + if (j) + slot = -slot; + return slot; + } + ++slot; + } + hash = ~hash; + } + + return -1; +} + +static long native_hpte_updatepp(unsigned long slot, unsigned long newpp, + unsigned long va, int large, int local) +{ + HPTE *hptep = htab_data.htab + slot; + Hpte_dword0 dw0; + unsigned long avpn = va >> 23; + int ret = 0; + + if (large) + avpn &= ~0x1UL; + + native_lock_hpte(hptep); + + dw0 = hptep->dw0.dw0; + + /* Even if we miss, we need to invalidate the TLB */ + if ((dw0.avpn != avpn) || !dw0.v) { + native_unlock_hpte(hptep); + ret = -1; + } else { + set_pp_bit(newpp, hptep); + native_unlock_hpte(hptep); + } + + /* Ensure it is out of the tlb too */ + if ((cur_cpu_spec->cpu_features & CPU_FTR_TLBIEL) && !large && local) { + tlbiel(va); + } else { + int lock_tlbie = !(cur_cpu_spec->cpu_features & CPU_FTR_LOCKLESS_TLBIE); + + if (lock_tlbie) + spin_lock(&native_tlbie_lock); + tlbie(va, large); + if (lock_tlbie) + spin_unlock(&native_tlbie_lock); + } + + return ret; +} + +/* + * Update the page protection bits. Intended to be used to create + * guard pages for kernel data structures on pages which are bolted + * in the HPT. Assumes pages being operated on will not be stolen. + * Does not work on large pages. + * + * No need to lock here because we should be the only user. + */ +static void native_hpte_updateboltedpp(unsigned long newpp, unsigned long ea) +{ + unsigned long vsid, va, vpn, flags; + long slot; + HPTE *hptep; + int lock_tlbie = !(cur_cpu_spec->cpu_features & CPU_FTR_LOCKLESS_TLBIE); + + vsid = get_kernel_vsid(ea); + va = (vsid << 28) | (ea & 0x0fffffff); + vpn = va >> PAGE_SHIFT; + + slot = native_hpte_find(vpn); + if (slot == -1) + panic("could not find page to bolt\n"); + hptep = htab_data.htab + slot; + + set_pp_bit(newpp, hptep); + + /* Ensure it is out of the tlb too */ + if (lock_tlbie) + spin_lock_irqsave(&native_tlbie_lock, flags); + tlbie(va, 0); + if (lock_tlbie) + spin_unlock_irqrestore(&native_tlbie_lock, flags); +} + +static void native_hpte_invalidate(unsigned long slot, unsigned long va, + int large, int local) +{ + HPTE *hptep = htab_data.htab + slot; + Hpte_dword0 dw0; + unsigned long avpn = va >> 23; + unsigned long flags; + int lock_tlbie = !(cur_cpu_spec->cpu_features & CPU_FTR_LOCKLESS_TLBIE); + + if (large) + avpn &= ~0x1UL; + + local_irq_save(flags); + native_lock_hpte(hptep); + + dw0 = hptep->dw0.dw0; + + /* Even if we miss, we need to invalidate the TLB */ + if ((dw0.avpn != avpn) || !dw0.v) { + native_unlock_hpte(hptep); + } else { + /* Invalidate the hpte. NOTE: this also unlocks it */ + hptep->dw0.dword0 = 0; + } + + /* Invalidate the tlb */ + if ((cur_cpu_spec->cpu_features & CPU_FTR_TLBIEL) && !large && local) { + tlbiel(va); + } else { + if (lock_tlbie) + spin_lock(&native_tlbie_lock); + tlbie(va, large); + if (lock_tlbie) + spin_unlock(&native_tlbie_lock); + } + local_irq_restore(flags); +} + +static void native_flush_hash_range(unsigned long context, + unsigned long number, int local) +{ + unsigned long vsid, vpn, va, hash, secondary, slot, flags, avpn; + int i, j; + HPTE *hptep; + Hpte_dword0 dw0; + struct ppc64_tlb_batch *batch = &__get_cpu_var(ppc64_tlb_batch); + + /* XXX fix for large ptes */ + unsigned long large = 0; + + local_irq_save(flags); + + j = 0; + for (i = 0; i < number; i++) { + if ((batch->addr[i] >= USER_START) && + (batch->addr[i] <= USER_END)) + vsid = get_vsid(context, batch->addr[i]); + else + vsid = get_kernel_vsid(batch->addr[i]); + + va = (vsid << 28) | (batch->addr[i] & 0x0fffffff); + batch->vaddr[j] = va; + if (large) + vpn = va >> HPAGE_SHIFT; + else + vpn = va >> PAGE_SHIFT; + hash = hpt_hash(vpn, large); + secondary = (pte_val(batch->pte[i]) & _PAGE_SECONDARY) >> 15; + if (secondary) + hash = ~hash; + slot = (hash & htab_data.htab_hash_mask) * HPTES_PER_GROUP; + slot += (pte_val(batch->pte[i]) & _PAGE_GROUP_IX) >> 12; + + hptep = htab_data.htab + slot; + + avpn = va >> 23; + if (large) + avpn &= ~0x1UL; + + native_lock_hpte(hptep); + + dw0 = hptep->dw0.dw0; + + /* Even if we miss, we need to invalidate the TLB */ + if ((dw0.avpn != avpn) || !dw0.v) { + native_unlock_hpte(hptep); + } else { + /* Invalidate the hpte. NOTE: this also unlocks it */ + hptep->dw0.dword0 = 0; + } + + j++; + } + + if ((cur_cpu_spec->cpu_features & CPU_FTR_TLBIEL) && !large && local) { + asm volatile("ptesync":::"memory"); + + for (i = 0; i < j; i++) + __tlbiel(batch->vaddr[i]); + + asm volatile("ptesync":::"memory"); + } else { + int lock_tlbie = !(cur_cpu_spec->cpu_features & CPU_FTR_LOCKLESS_TLBIE); + + if (lock_tlbie) + spin_lock(&native_tlbie_lock); + + asm volatile("ptesync":::"memory"); + + for (i = 0; i < j; i++) + __tlbie(batch->vaddr[i], 0); + + asm volatile("eieio; tlbsync; ptesync":::"memory"); + + if (lock_tlbie) + spin_unlock(&native_tlbie_lock); + } + + local_irq_restore(flags); +} + +void hpte_init_native(void) +{ +#ifdef CONFIG_PPC_PSERIES + struct device_node *root; + const char *model; +#endif /* CONFIG_PPC_PSERIES */ + + ppc_md.hpte_invalidate = native_hpte_invalidate; + ppc_md.hpte_updatepp = native_hpte_updatepp; + ppc_md.hpte_updateboltedpp = native_hpte_updateboltedpp; + ppc_md.hpte_insert = native_hpte_insert; + ppc_md.hpte_remove = native_hpte_remove; + +#ifdef CONFIG_PPC_PSERIES + /* Disable TLB batching on nighthawk */ + root = of_find_node_by_path("/"); + if (root) { + model = get_property(root, "model", NULL); + if (!strcmp(model, "CHRP IBM,9076-N81")) { + of_node_put(root); + return; + } + of_node_put(root); + } +#endif /* CONFIG_PPC_PSERIES */ + + ppc_md.flush_hash_range = native_flush_hash_range; + + htab_finish_init(); +} diff -Nru a/arch/ppc64/mm/hash_utils.c b/arch/ppc64/mm/hash_utils.c --- a/arch/ppc64/mm/hash_utils.c 2004-09-26 10:25:56 -07:00 +++ b/arch/ppc64/mm/hash_utils.c 2004-09-26 10:25:56 -07:00 @@ -18,6 +18,8 @@ * 2 of the License, or (at your option) any later version. */ +#undef DEBUG + #include #include #include @@ -51,6 +53,12 @@ #include #include +#ifdef DEBUG +#define DBG(fmt...) udbg_printf(fmt) +#else +#define DBG(fmt...) +#endif + /* * Note: pte --> Linux PTE * HPTE --> PowerPC Hashed Page Table Entry @@ -81,7 +89,7 @@ ; } -#ifdef CONFIG_PPC_PSERIES +#ifdef CONFIG_PPC_MULTIPLATFORM static inline void create_pte_mapping(unsigned long start, unsigned long end, unsigned long mode, int large) { @@ -100,7 +108,7 @@ int ret; if (large) - vpn = va >> LARGE_PAGE_SHIFT; + vpn = va >> HPAGE_SHIFT; else vpn = va >> PAGE_SHIFT; @@ -108,12 +116,14 @@ hpteg = ((hash & htab_data.htab_hash_mask)*HPTES_PER_GROUP); - if (systemcfg->platform == PLATFORM_PSERIES_LPAR) +#ifdef CONFIG_PPC_PSERIES + if (systemcfg->platform & PLATFORM_LPAR) ret = pSeries_lpar_hpte_insert(hpteg, va, virt_to_abs(addr) >> PAGE_SHIFT, 0, mode, 1, large); else - ret = pSeries_hpte_insert(hpteg, va, +#endif /* CONFIG_PPC_PSERIES */ + ret = native_hpte_insert(hpteg, va, virt_to_abs(addr) >> PAGE_SHIFT, 0, mode, 1, large); @@ -131,6 +141,8 @@ unsigned long mode_rw; int i, use_largepages = 0; + DBG(" -> htab_initialize()\n"); + /* * Calculate the required size of the htab. We want the number of * PTEGs to equal one half the number of real pages. @@ -147,12 +159,19 @@ htab_data.htab_num_ptegs = pteg_count; htab_data.htab_hash_mask = pteg_count - 1; - if (systemcfg->platform == PLATFORM_PSERIES || - systemcfg->platform == PLATFORM_POWERMAC) { + if (systemcfg->platform & PLATFORM_LPAR) { + /* Using a hypervisor which owns the htab */ + htab_data.htab = NULL; + _SDR1 = 0; + } else { /* Find storage for the HPT. Must be contiguous in * the absolute address space. */ table = lmb_alloc(htab_size_bytes, htab_size_bytes); + + DBG("Hash table allocated at %lx, size: %lx\n", table, + htab_size_bytes); + if ( !table ) { ppc64_terminate_msg(0x20, "hpt space"); loop_forever(); @@ -164,10 +183,6 @@ /* Initialize the HPT with no entries */ memset((void *)table, 0, htab_size_bytes); - } else { - /* Using a hypervisor which owns the htab */ - htab_data.htab = NULL; - _SDR1 = 0; } mode_rw = _PAGE_ACCESSED | _PAGE_COHERENT | PP_RWXX; @@ -179,13 +194,15 @@ if (cur_cpu_spec->cpu_features & CPU_FTR_16M_PAGE) use_largepages = 1; - /* add all physical memory to the bootmem map */ + /* create bolted the linear mapping in the hash table */ for (i=0; i < lmb.memory.cnt; i++) { unsigned long base, size; base = lmb.memory.region[i].physbase + KERNELBASE; size = lmb.memory.region[i].size; + DBG("creating mapping for region: %lx : %lx\n", base, size); + #ifdef CONFIG_PMAC_DART /* Do not map the DART space. Fortunately, it will be aligned * in such a way that it will not cross two lmb regions and will @@ -194,6 +211,8 @@ * only use 2Mb of that space. We will use more of it later for * AGP GART. We have to use a full 16Mb large page. */ + DBG("DART base: %lx\n", dart_tablebase); + if (dart_tablebase != 0 && dart_tablebase >= base && dart_tablebase < (base + size)) { if (base != dart_tablebase) @@ -207,10 +226,11 @@ #endif /* CONFIG_PMAC_DART */ create_pte_mapping(base, base + size, mode_rw, use_largepages); } + DBG(" <- htab_initialize()\n"); } #undef KB #undef MB -#endif +#endif /* CONFIG_PPC_MULTIPLATFORM */ /* * Called by asm hashtable.S for doing lazy icache flush @@ -253,24 +273,24 @@ int local = 0; cpumask_t tmp; - /* Check for invalid addresses. */ - if (!IS_VALID_EA(ea)) - return 1; - switch (REGION_ID(ea)) { case USER_REGION_ID: user_region = 1; mm = current->mm; - if (mm == NULL) + if ((ea > USER_END) || (! mm)) return 1; vsid = get_vsid(mm->context.id, ea); break; case IO_REGION_ID: + if (ea > IMALLOC_END) + return 1; mm = &ioremap_mm; vsid = get_kernel_vsid(ea); break; case VMALLOC_REGION_ID: + if (ea > VMALLOC_END) + return 1; mm = &init_mm; vsid = get_kernel_vsid(ea); break; @@ -332,7 +352,7 @@ va = (vsid << 28) | (ea & 0x0fffffff); if (large) - vpn = va >> LARGE_PAGE_SHIFT; + vpn = va >> HPAGE_SHIFT; else vpn = va >> PAGE_SHIFT; hash = hpt_hash(vpn, large); diff -Nru a/arch/ppc64/mm/hugetlbpage.c b/arch/ppc64/mm/hugetlbpage.c --- a/arch/ppc64/mm/hugetlbpage.c 2004-09-26 10:25:56 -07:00 +++ b/arch/ppc64/mm/hugetlbpage.c 2004-09-26 10:25:56 -07:00 @@ -853,7 +853,7 @@ vsid = get_vsid(context.id, ea); va = (vsid << 28) | (ea & 0x0fffffff); - vpn = va >> LARGE_PAGE_SHIFT; + vpn = va >> HPAGE_SHIFT; hash = hpt_hash(vpn, 1); if (hugepte_val(pte) & _HUGEPAGE_SECONDARY) hash = ~hash; diff -Nru a/arch/ppc64/mm/init.c b/arch/ppc64/mm/init.c --- a/arch/ppc64/mm/init.c 2004-09-26 10:25:56 -07:00 +++ b/arch/ppc64/mm/init.c 2004-09-26 10:25:56 -07:00 @@ -36,6 +36,7 @@ #include #include #include +#include #include #include @@ -62,8 +63,6 @@ #include #include - -struct mmu_context_queue_t mmu_context_queue; int mem_init_done; unsigned long ioremap_bot = IMALLOC_BASE; static unsigned long phbs_io_bot = PHBS_IO_BASE; @@ -204,10 +203,7 @@ void __iomem * ioremap(unsigned long addr, unsigned long size) { - void __iomem *ret = __ioremap(addr, size, _PAGE_NO_CACHE); - if(mem_init_done) - return eeh_ioremap(addr, ret); /* may remap the addr */ - return ret; + return __ioremap(addr, size, _PAGE_NO_CACHE); } void __iomem * @@ -364,9 +360,7 @@ return; } - /* addr could be in EEH or IO region, map it to IO region regardless. - */ - addr = (void *) (IO_TOKEN_TO_ADDR(token) & PAGE_MASK); + addr = (void *) ((unsigned long __force) token & PAGE_MASK); if ((size = im_free(addr)) == 0) { return; @@ -416,9 +410,7 @@ unsigned long addr; int rc; - /* addr could be in EEH or IO region, map it to IO region regardless. - */ - addr = (IO_TOKEN_TO_ADDR(start) & PAGE_MASK); + addr = (unsigned long __force) start & PAGE_MASK; /* Verify that the region either exists or is a subset of an existing * region. In the latter case, split the parent region to create @@ -477,25 +469,69 @@ } #endif +static spinlock_t mmu_context_lock = SPIN_LOCK_UNLOCKED; +static DEFINE_IDR(mmu_context_idr); + +int init_new_context(struct task_struct *tsk, struct mm_struct *mm) +{ + int index; + int err; + +again: + if (!idr_pre_get(&mmu_context_idr, GFP_KERNEL)) + return -ENOMEM; + + spin_lock(&mmu_context_lock); + err = idr_get_new(&mmu_context_idr, NULL, &index); + spin_unlock(&mmu_context_lock); + + if (err == -EAGAIN) + goto again; + else if (err) + return err; + + if (index > MAX_CONTEXT) { + idr_remove(&mmu_context_idr, index); + return -ENOMEM; + } + + mm->context.id = index; + + return 0; +} + +void destroy_context(struct mm_struct *mm) +{ + spin_lock(&mmu_context_lock); + idr_remove(&mmu_context_idr, mm->context.id); + spin_unlock(&mmu_context_lock); + + mm->context.id = NO_CONTEXT; +} + +static int __init mmu_context_init(void) +{ + int index; + + /* Reserve the first (invalid) context*/ + idr_pre_get(&mmu_context_idr, GFP_KERNEL); + idr_get_new(&mmu_context_idr, NULL, &index); + BUG_ON(0 != index); + + return 0; +} +arch_initcall(mmu_context_init); + /* * Do very early mm setup. */ void __init mm_init_ppc64(void) { +#ifndef CONFIG_PPC_ISERIES unsigned long i; +#endif ppc64_boot_msg(0x100, "MM Init"); - - /* Reserve all contexts < FIRST_USER_CONTEXT for kernel use. - * The range of contexts [FIRST_USER_CONTEXT, NUM_USER_CONTEXT) - * are stored on a stack/queue for easy allocation and deallocation. - */ - mmu_context_queue.lock = SPIN_LOCK_UNLOCKED; - mmu_context_queue.head = 0; - mmu_context_queue.tail = NUM_USER_CONTEXT-1; - mmu_context_queue.size = NUM_USER_CONTEXT; - for (i = 0; i < NUM_USER_CONTEXT; i++) - mmu_context_queue.elements[i] = i + FIRST_USER_CONTEXT; /* This is the story of the IO hole... please, keep seated, * unfortunately, we are out of oxygen masks at the moment. diff -Nru a/arch/ppc64/mm/numa.c b/arch/ppc64/mm/numa.c --- a/arch/ppc64/mm/numa.c 2004-09-26 10:25:56 -07:00 +++ b/arch/ppc64/mm/numa.c 2004-09-26 10:25:56 -07:00 @@ -18,6 +18,8 @@ #include #include +static int numa_enabled = 1; + static int numa_debug; #define dbg(args...) if (numa_debug) { printk(KERN_INFO args); } @@ -189,10 +191,7 @@ long entries = lmb_end_of_DRAM() >> MEMORY_INCREMENT_SHIFT; unsigned long i; - if (strstr(saved_command_line, "numa=debug")) - numa_debug = 1; - - if (strstr(saved_command_line, "numa=off")) { + if (numa_enabled == 0) { printk(KERN_WARNING "NUMA disabled by user\n"); return -1; } @@ -587,3 +586,18 @@ start_pfn, zholes_size); } } + +static int __init early_numa(char *p) +{ + if (!p) + return 0; + + if (strstr(p, "off")) + numa_enabled = 0; + + if (strstr(p, "debug")) + numa_debug = 1; + + return 0; +} +early_param("numa", early_numa); diff -Nru a/arch/ppc64/mm/slb_low.S b/arch/ppc64/mm/slb_low.S --- a/arch/ppc64/mm/slb_low.S 2004-09-26 10:25:56 -07:00 +++ b/arch/ppc64/mm/slb_low.S 2004-09-26 10:25:56 -07:00 @@ -68,19 +68,19 @@ srdi r3,r3,28 /* get esid */ cmpldi cr7,r9,0xc /* cmp KERNELBASE for later use */ - /* r9 = region, r3 = esid, cr7 = <>KERNELBASE */ - - rldicr. r11,r3,32,16 - bne- 8f /* invalid ea bits set */ - addi r11,r9,-1 - cmpldi r11,0xb - blt- 8f /* invalid region */ + rldimi r10,r3,28,0 /* r10= ESID<<28 | entry */ + oris r10,r10,SLB_ESID_V@h /* r10 |= SLB_ESID_V */ - /* r9 = region, r3 = esid, r10 = entry, cr7 = <>KERNELBASE */ + /* r3 = esid, r10 = esid_data, cr7 = <>KERNELBASE */ blt cr7,0f /* user or kernel? */ - /* kernel address */ + /* kernel address: proto-VSID = ESID */ + /* WARNING - MAGIC: we don't use the VSID 0xfffffffff, but + * this code will generate the protoVSID 0xfffffffff for the + * top segment. That's ok, the scramble below will translate + * it to VSID 0, which is reserved as a bad VSID - one which + * will never have any pages in it. */ li r11,SLB_VSID_KERNEL BEGIN_FTR_SECTION bne cr7,9f @@ -88,8 +88,12 @@ END_FTR_SECTION_IFSET(CPU_FTR_16M_PAGE) b 9f -0: /* user address */ +0: /* user address: proto-VSID = context<<15 | ESID */ li r11,SLB_VSID_USER + + srdi. r9,r3,13 + bne- 8f /* invalid ea bits set */ + #ifdef CONFIG_HUGETLB_PAGE BEGIN_FTR_SECTION /* check against the hugepage ranges */ @@ -111,33 +115,18 @@ #endif /* CONFIG_HUGETLB_PAGE */ 6: ld r9,PACACONTEXTID(r13) + rldimi r3,r9,USER_ESID_BITS,0 -9: /* r9 = "context", r3 = esid, r11 = flags, r10 = entry */ - - rldimi r9,r3,15,0 /* r9= VSID ordinal */ - -7: rldimi r10,r3,28,0 /* r10= ESID<<28 | entry */ - oris r10,r10,SLB_ESID_V@h /* r10 |= SLB_ESID_V */ - - /* r9 = ordinal, r3 = esid, r11 = flags, r10 = esid_data */ - - li r3,VSID_RANDOMIZER@higher - sldi r3,r3,32 - oris r3,r3,VSID_RANDOMIZER@h - ori r3,r3,VSID_RANDOMIZER@l - - mulld r9,r3,r9 /* r9 = ordinal * VSID_RANDOMIZER */ - clrldi r9,r9,28 /* r9 &= VSID_MASK */ - sldi r9,r9,SLB_VSID_SHIFT /* r9 <<= SLB_VSID_SHIFT */ - or r9,r9,r11 /* r9 |= flags */ +9: /* r3 = protovsid, r11 = flags, r10 = esid_data, cr7 = <>KERNELBASE */ + ASM_VSID_SCRAMBLE(r3,r9) - /* r9 = vsid_data, r10 = esid_data, cr7 = <>KERNELBASE */ + rldimi r11,r3,SLB_VSID_SHIFT,16 /* combine VSID and flags */ /* * No need for an isync before or after this slbmte. The exception * we enter with and the rfid we exit with are context synchronizing. */ - slbmte r9,r10 + slbmte r11,r10 bgelr cr7 /* we're done for kernel addresses */ @@ -160,6 +149,6 @@ blr 8: /* invalid EA */ - li r9,0 /* 0 VSID ordinal -> BAD_VSID */ + li r3,0 /* BAD_VSID */ li r11,SLB_VSID_USER /* flags don't much matter */ - b 7b + b 9b diff -Nru a/arch/ppc64/mm/stab.c b/arch/ppc64/mm/stab.c --- a/arch/ppc64/mm/stab.c 2004-09-26 10:25:58 -07:00 +++ b/arch/ppc64/mm/stab.c 2004-09-26 10:25:58 -07:00 @@ -115,15 +115,11 @@ unsigned char stab_entry; unsigned long offset; - /* Check for invalid effective addresses. */ - if (!IS_VALID_EA(ea)) - return 1; - /* Kernel or user address? */ if (ea >= KERNELBASE) { vsid = get_kernel_vsid(ea); } else { - if (! mm) + if ((ea >= TASK_SIZE_USER64) || (! mm)) return 1; vsid = get_vsid(mm->context.id, ea); diff -Nru a/arch/ppc64/oprofile/common.c b/arch/ppc64/oprofile/common.c --- a/arch/ppc64/oprofile/common.c 2004-09-26 10:25:57 -07:00 +++ b/arch/ppc64/oprofile/common.c 2004-09-26 10:25:57 -07:00 @@ -133,7 +133,7 @@ { unsigned int pvr; - pvr = _get_PVR(); + pvr = mfspr(SPRN_PVR); switch (PVR_VER(pvr)) { case PV_630: diff -Nru a/arch/ppc64/oprofile/op_model_rs64.c b/arch/ppc64/oprofile/op_model_rs64.c --- a/arch/ppc64/oprofile/op_model_rs64.c 2004-09-26 10:25:57 -07:00 +++ b/arch/ppc64/oprofile/op_model_rs64.c 2004-09-26 10:25:57 -07:00 @@ -21,8 +21,8 @@ static void ctrl_write(unsigned int i, unsigned int val) { - unsigned int tmp; - unsigned long shift, mask; + unsigned int tmp = 0; + unsigned long shift = 0, mask = 0; dbg("ctrl_write %d %x\n", i, val); diff -Nru a/arch/ppc64/xmon/xmon.c b/arch/ppc64/xmon/xmon.c --- a/arch/ppc64/xmon/xmon.c 2004-09-26 10:25:57 -07:00 +++ b/arch/ppc64/xmon/xmon.c 2004-09-26 10:25:57 -07:00 @@ -252,30 +252,28 @@ static inline void disable_surveillance(void) { -#ifndef CONFIG_PPC_ISERIES +#ifdef CONFIG_PPC_PSERIES /* Since this can't be a module, args should end up below 4GB. */ static struct rtas_args args; - if (systemcfg->platform & PLATFORM_PSERIES) { - /* - * At this point we have got all the cpus we can into - * xmon, so there is hopefully no other cpu calling RTAS - * at the moment, even though we don't take rtas.lock. - * If we did try to take rtas.lock there would be a - * real possibility of deadlock. - */ - args.token = rtas_token("set-indicator"); - if (args.token == RTAS_UNKNOWN_SERVICE) - return; - args.nargs = 3; - args.nret = 1; - args.rets = &args.args[3]; - args.args[0] = SURVEILLANCE_TOKEN; - args.args[1] = 0; - args.args[2] = 0; - enter_rtas(__pa(&args)); - } -#endif + /* + * At this point we have got all the cpus we can into + * xmon, so there is hopefully no other cpu calling RTAS + * at the moment, even though we don't take rtas.lock. + * If we did try to take rtas.lock there would be a + * real possibility of deadlock. + */ + args.token = rtas_token("set-indicator"); + if (args.token == RTAS_UNKNOWN_SERVICE) + return; + args.nargs = 3; + args.nret = 1; + args.rets = &args.args[3]; + args.args[0] = SURVEILLANCE_TOKEN; + args.args[1] = 0; + args.args[2] = 0; + enter_rtas(__pa(&args)); +#endif /* CONFIG_PPC_PSERIES */ } #ifdef CONFIG_SMP @@ -2059,7 +2057,7 @@ { int nr, dotted; unsigned long first_adr; - unsigned long inst, last_inst; + unsigned long inst, last_inst = 0; unsigned char val[4]; dotted = 0; diff -Nru a/arch/s390/defconfig b/arch/s390/defconfig --- a/arch/s390/defconfig 2004-09-26 10:25:57 -07:00 +++ b/arch/s390/defconfig 2004-09-26 10:25:57 -07:00 @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit -# Linux kernel version: 2.6.9-rc1 -# Mon Aug 30 19:03:48 2004 +# Linux kernel version: 2.6.9-rc2 +# Mon Sep 20 17:16:38 2004 # CONFIG_MMU=y CONFIG_RWSEM_XCHGADD_ALGORITHM=y @@ -17,6 +17,7 @@ # # General setup # +CONFIG_LOCALVERSION="" CONFIG_SWAP=y CONFIG_SYSVIPC=y # CONFIG_POSIX_MQUEUE is not set @@ -38,6 +39,8 @@ CONFIG_IOSCHED_DEADLINE=y CONFIG_IOSCHED_CFQ=y # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set +CONFIG_SHMEM=y +# CONFIG_TINY_SHMEM is not set # # Loadable module support @@ -162,7 +165,7 @@ CONFIG_BLK_DEV_XPRAM=m # CONFIG_DCSSBLK is not set CONFIG_DASD=y -# CONFIG_DASD_PROFILE is not set +CONFIG_DASD_PROFILE=y CONFIG_DASD_ECKD=y CONFIG_DASD_FBA=y CONFIG_DASD_DIAG=y diff -Nru a/arch/s390/kernel/Makefile b/arch/s390/kernel/Makefile --- a/arch/s390/kernel/Makefile 2004-09-26 10:25:57 -07:00 +++ b/arch/s390/kernel/Makefile 2004-09-26 10:25:57 -07:00 @@ -6,7 +6,7 @@ obj-y := bitmap.o traps.o time.o process.o \ setup.o sys_s390.o ptrace.o signal.o cpcmd.o ebcdic.o \ - semaphore.o s390_ext.o debug.o profile.o + semaphore.o s390_ext.o debug.o profile.o irq.o extra-$(CONFIG_ARCH_S390_31) += head.o extra-$(CONFIG_ARCH_S390X) += head64.o diff -Nru a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S --- a/arch/s390/kernel/entry.S 2004-09-26 10:25:55 -07:00 +++ b/arch/s390/kernel/entry.S 2004-09-26 10:25:55 -07:00 @@ -150,30 +150,6 @@ st %r3,__LC_KERNEL_STACK # __LC_KERNEL_STACK = new kernel stack br %r14 -/* - * do_softirq calling function. We want to run the softirq functions on the - * asynchronous interrupt stack. - */ - .global do_call_softirq -do_call_softirq: - stnsm __SF_EMPTY(%r15),0xfc - stm %r12,%r15,__SF_GPRS(%r15) - lr %r12,%r15 - basr %r13,0 -do_call_base: - l %r0,__LC_ASYNC_STACK - slr %r0,%r15 - sra %r0,STACK_SHIFT - be 0f-do_call_base(%r13) - l %r15,__LC_ASYNC_STACK -0: sl %r15,.Lc_overhead-do_call_base(%r13) - st %r12,__SF_BACKCHAIN(%r15) # store backchain - l %r1,.Ldo_softirq-do_call_base(%r13) - basr %r14,%r1 - lm %r12,%r15,__SF_GPRS(%r12) - ssm __SF_EMPTY(%r15) - br %r14 - __critical_start: /* * SVC interrupt handler routine. System calls are synchronous events and @@ -733,7 +709,6 @@ .Ldo_IRQ: .long do_IRQ .Ldo_extint: .long do_extint .Ldo_signal: .long do_signal -.Ldo_softirq: .long do_softirq .Lhandle_per: .long do_single_step .Ljump_table: .long pgm_check_table .Lschedule: .long schedule diff -Nru a/arch/s390/kernel/entry64.S b/arch/s390/kernel/entry64.S --- a/arch/s390/kernel/entry64.S 2004-09-26 10:25:55 -07:00 +++ b/arch/s390/kernel/entry64.S 2004-09-26 10:25:55 -07:00 @@ -147,27 +147,6 @@ stg %r3,__LC_KERNEL_STACK # __LC_KERNEL_STACK = new kernel stack br %r14 -/* - * do_softirq calling function. We want to run the softirq functions on the - * asynchronous interrupt stack. - */ - .global do_call_softirq -do_call_softirq: - stnsm __SF_EMPTY(%r15),0xfc - stmg %r12,%r15,__SF_GPRS(%r15) - lgr %r12,%r15 - lg %r0,__LC_ASYNC_STACK - slgr %r0,%r15 - srag %r0,%r0,STACK_SHIFT - je 0f - lg %r15,__LC_ASYNC_STACK -0: aghi %r15,-STACK_FRAME_OVERHEAD - stg %r12,__SF_BACKCHAIN(%r15) # store back chain - brasl %r14,do_softirq - lmg %r12,%r15,__SF_GPRS(%r12) - ssm __SF_EMPTY(%r15) - br %r14 - __critical_start: /* * SVC interrupt handler routine. System calls are synchronous events and diff -Nru a/arch/s390/kernel/irq.c b/arch/s390/kernel/irq.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/s390/kernel/irq.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,99 @@ +/* + * arch/s390/kernel/irq.c + * + * S390 version + * Copyright (C) 2004 IBM Deutschland Entwicklung GmbH, IBM Corporation + * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), + * + * This file contains interrupt related functions. + */ + +#include +#include +#include +#include +#include +#include + +/* + * show_interrupts is needed by /proc/interrupts. + */ +int show_interrupts(struct seq_file *p, void *v) +{ + static const char *intrclass_names[] = { "EXT", "I/O", }; + int i = *(loff_t *) v, j; + + if (i == 0) { + seq_puts(p, " "); + for (j=0; j> (PAGE_SHIFT + THREAD_ORDER)) != 0) { + /* Need to switch to the async. stack. */ + new -= STACK_FRAME_OVERHEAD; + ((struct stack_frame *) new)->back_chain = old; + + asm volatile(" la 15,0(%0)\n" + " basr 14,%2\n" + " la 15,0(%1)\n" + : : "a" (new), "a" (old), + "a" (__do_softirq) + : "0", "1", "2", "3", "4", "5", + "cc", "memory" ); + } else + /* We are already on the async stack. */ + __do_softirq(); + } + + local_irq_restore(flags); +} + +EXPORT_SYMBOL(do_softirq); diff -Nru a/arch/s390/kernel/s390_ext.c b/arch/s390/kernel/s390_ext.c --- a/arch/s390/kernel/s390_ext.c 2004-09-26 10:25:56 -07:00 +++ b/arch/s390/kernel/s390_ext.c 2004-09-26 10:25:56 -07:00 @@ -12,6 +12,7 @@ #include #include #include +#include #include #include diff -Nru a/arch/s390/kernel/s390_ksyms.c b/arch/s390/kernel/s390_ksyms.c --- a/arch/s390/kernel/s390_ksyms.c 2004-09-26 10:25:56 -07:00 +++ b/arch/s390/kernel/s390_ksyms.c 2004-09-26 10:25:56 -07:00 @@ -61,6 +61,5 @@ EXPORT_SYMBOL(console_mode); EXPORT_SYMBOL(console_devno); EXPORT_SYMBOL(console_irq); -EXPORT_SYMBOL(do_call_softirq); EXPORT_SYMBOL(sys_wait4); EXPORT_SYMBOL(cpcmd); diff -Nru a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c --- a/arch/s390/kernel/setup.c 2004-09-26 10:25:55 -07:00 +++ b/arch/s390/kernel/setup.c 2004-09-26 10:25:55 -07:00 @@ -608,49 +608,3 @@ .show = show_cpuinfo, }; -/* - * show_interrupts is needed by /proc/interrupts. - */ - -static const char *intrclass_names[] = { - "EXT", - "I/O", -}; - -int show_interrupts(struct seq_file *p, void *v) -{ - int i = *(loff_t *) v, j; - - if (i == 0) { - seq_puts(p, " "); - for (j=0; j /* This cannot be static, as it is referenced in entry.S */ -unsigned long auxio_register = 0UL; +void __iomem *auxio_register = 0UL; enum auxio_type { AUXIO_TYPE_NODEV, @@ -30,7 +30,7 @@ static void __auxio_sbus_set(u8 bits_on, u8 bits_off) { - if(auxio_register) { + if (auxio_register) { unsigned char regval; unsigned long flags; unsigned char newval; @@ -49,7 +49,7 @@ static void __auxio_ebus_set(u8 bits_on, u8 bits_off) { - if(auxio_register) { + if (auxio_register) { unsigned char regval; unsigned long flags; unsigned char newval; @@ -126,7 +126,8 @@ if (sdev) { auxio_devtype = AUXIO_TYPE_SBUS; auxio_register = sbus_ioremap(&sdev->resource[0], 0, - sdev->reg_addrs[0].reg_size, "auxiliaryIO"); + sdev->reg_addrs[0].reg_size, + "auxiliaryIO"); } #ifdef CONFIG_PCI else { @@ -142,7 +143,7 @@ ebus_done: if (edev) { auxio_devtype = AUXIO_TYPE_EBUS; - auxio_register = (unsigned long) + auxio_register = ioremap(edev->resource[0].start, sizeof(u32)); } } diff -Nru a/arch/sparc64/kernel/pci_schizo.c b/arch/sparc64/kernel/pci_schizo.c --- a/arch/sparc64/kernel/pci_schizo.c 2004-09-26 10:25:56 -07:00 +++ b/arch/sparc64/kernel/pci_schizo.c 2004-09-26 10:25:56 -07:00 @@ -1171,7 +1171,7 @@ prom_halt(); } bucket = __bucket(irq); - tmp = readl(bucket->imap); + tmp = upa_readl(bucket->imap); upa_writel(tmp, (pbm->pbm_regs + schizo_imap_offset(SCHIZO_UE_INO) + 4)); @@ -1309,7 +1309,7 @@ prom_halt(); } bucket = __bucket(irq); - tmp = readl(bucket->imap); + tmp = upa_readl(bucket->imap); upa_writel(tmp, (pbm->pbm_regs + schizo_imap_offset(SCHIZO_UE_INO) + 4)); pbm = pbm_for_ino(p, SCHIZO_CE_INO); diff -Nru a/arch/sparc64/kernel/power.c b/arch/sparc64/kernel/power.c --- a/arch/sparc64/kernel/power.c 2004-09-26 10:25:57 -07:00 +++ b/arch/sparc64/kernel/power.c 2004-09-26 10:25:57 -07:00 @@ -27,7 +27,7 @@ int scons_pwroff = 1; #ifdef CONFIG_PCI -static unsigned long power_reg = 0UL; +static void __iomem *power_reg; static DECLARE_WAIT_QUEUE_HEAD(powerd_wait); static int button_pressed; @@ -52,7 +52,7 @@ { if (!serial_console || scons_pwroff) { #ifdef CONFIG_PCI - if (power_reg != 0UL) { + if (power_reg) { /* Both register bits seem to have the * same effect, so until I figure out * what the difference is... @@ -130,8 +130,8 @@ return; found: - power_reg = (unsigned long)ioremap(edev->resource[0].start, 0x4); - printk("power: Control reg at %016lx ... ", power_reg); + power_reg = ioremap(edev->resource[0].start, 0x4); + printk("power: Control reg at %p ... ", power_reg); poweroff_method = machine_halt; /* able to use the standard halt */ if (has_button_interrupt(edev)) { if (kernel_thread(powerd, NULL, CLONE_FS) < 0) { diff -Nru a/arch/sparc64/kernel/signal32.c b/arch/sparc64/kernel/signal32.c --- a/arch/sparc64/kernel/signal32.c 2004-09-26 10:25:55 -07:00 +++ b/arch/sparc64/kernel/signal32.c 2004-09-26 10:25:55 -07:00 @@ -122,7 +122,6 @@ int _status; /* exit code */ compat_clock_t _utime; compat_clock_t _stime; - struct compat_rusage _rusage; } _sigchld; /* SIGILL, SIGFPE, SIGSEGV, SIGBUS, SIGEMT */ @@ -188,8 +187,6 @@ err |= __put_user(from->si_utime, &to->si_utime); err |= __put_user(from->si_stime, &to->si_stime); err |= __put_user(from->si_status, &to->si_status); - err |= put_compat_rusage(&from->si_rusage, - &to->si_rusage); default: err |= __put_user(from->si_pid, &to->si_pid); err |= __put_user(from->si_uid, &to->si_uid); diff -Nru a/arch/sparc64/kernel/sys_sparc32.c b/arch/sparc64/kernel/sys_sparc32.c --- a/arch/sparc64/kernel/sys_sparc32.c 2004-09-26 10:25:56 -07:00 +++ b/arch/sparc64/kernel/sys_sparc32.c 2004-09-26 10:25:56 -07:00 @@ -1737,21 +1737,30 @@ } asmlinkage long compat_sys_waitid(u32 which, u32 pid, - struct siginfo32 __user *uinfo, u32 options) + struct siginfo32 __user *uinfo, u32 options, + struct compat_rusage __user *uru) { siginfo_t info; + struct rusage ru; long ret; mm_segment_t old_fs = get_fs(); memset(&info, 0, sizeof(info)); set_fs (KERNEL_DS); - ret = sys_waitid((int)which, (compat_pid_t) pid, - (siginfo_t __user *) &info, (int) options); + ret = sys_waitid(which, pid, (siginfo_t __user *) &info, + options, uru ? &ru : NULL); set_fs (old_fs); if (ret < 0 || info.si_signo == 0) return ret; + + if (uru) { + ret = put_compat_rusage(&ru, uru); + if (ret) + return ret; + } + BUG_ON(info.si_code & __SI_MASK); info.si_code |= __SI_CHLD; return copy_siginfo_to_user32(uinfo, &info); diff -Nru a/arch/sparc64/kernel/time.c b/arch/sparc64/kernel/time.c --- a/arch/sparc64/kernel/time.c 2004-09-26 10:25:56 -07:00 +++ b/arch/sparc64/kernel/time.c 2004-09-26 10:25:56 -07:00 @@ -910,10 +910,10 @@ } /* This is gets the master TICK_INT timer going. */ -static unsigned long sparc64_init_timers(irqreturn_t (*cfunc)(int, void *, struct pt_regs *)) +static unsigned long sparc64_init_timers(void) { - unsigned long pstate, clock; - int node, err; + unsigned long clock; + int node; #ifdef CONFIG_SMP extern void smp_tick_init(void); #endif @@ -946,6 +946,14 @@ smp_tick_init(); #endif + return clock; +} + +static void sparc64_start_timers(irqreturn_t (*cfunc)(int, void *, struct pt_regs *)) +{ + unsigned long pstate; + int err; + /* Register IRQ handler. */ err = request_irq(build_irq(0, 0, 0UL, 0UL), cfunc, SA_STATIC_ALLOC, "timer", NULL); @@ -971,8 +979,6 @@ : "r" (pstate)); local_irq_enable(); - - return clock; } struct freq_table { @@ -1036,10 +1042,15 @@ #define SPARC64_NSEC_PER_CYC_SHIFT 30UL void __init time_init(void) { - unsigned long clock = sparc64_init_timers(timer_interrupt); + unsigned long clock = sparc64_init_timers(); sparc64_cpu_interpolator.frequency = clock; register_time_interpolator(&sparc64_cpu_interpolator); + + /* Now that the interpolator is registered, it is + * safe to start the timer ticking. + */ + sparc64_start_timers(timer_interrupt); timer_ticks_per_nsec_quotient = (((NSEC_PER_SEC << SPARC64_NSEC_PER_CYC_SHIFT) + diff -Nru a/arch/sparc64/kernel/traps.c b/arch/sparc64/kernel/traps.c --- a/arch/sparc64/kernel/traps.c 2004-09-26 10:25:57 -07:00 +++ b/arch/sparc64/kernel/traps.c 2004-09-26 10:25:57 -07:00 @@ -1843,6 +1843,37 @@ EXPORT_SYMBOL(dump_stack); +static inline int is_kernel_stack(struct task_struct *task, + struct reg_window *rw) +{ + unsigned long rw_addr = (unsigned long) rw; + unsigned long thread_base, thread_end; + + if (rw_addr < PAGE_OFFSET) { + if (task != &init_task) + return 0; + } + + thread_base = (unsigned long) task->thread_info; + thread_end = thread_base + sizeof(union thread_union); + if (rw_addr >= thread_base && + rw_addr < thread_end && + !(rw_addr & 0x7UL)) + return 1; + + return 0; +} + +static inline struct reg_window *kernel_stack_up(struct reg_window *rw) +{ + unsigned long fp = rw->ins[6]; + + if (!fp) + return NULL; + + return (struct reg_window *) (fp + STACK_BIAS); +} + void die_if_kernel(char *str, struct pt_regs *regs) { static int die_counter; @@ -1868,17 +1899,14 @@ /* Stop the back trace when we hit userland or we * find some badly aligned kernel stack. */ - while (rw && - count++ < 30 && - (((unsigned long) rw) >= PAGE_OFFSET) && - (char *) rw < ((char *) current) - + sizeof (union thread_union) && - !(((unsigned long) rw) & 0x7)) { + while (rw && + count++ < 30&& + is_kernel_stack(current, rw)) { printk("Caller[%016lx]", rw->ins[7]); print_symbol(": %s", rw->ins[7]); printk("\n"); - rw = (struct reg_window *) - (rw->ins[6] + STACK_BIAS); + + rw = kernel_stack_up(rw); } instruction_dump ((unsigned int *) regs->tpc); } else { diff -Nru a/arch/sparc64/lib/Makefile b/arch/sparc64/lib/Makefile --- a/arch/sparc64/lib/Makefile 2004-09-26 10:25:55 -07:00 +++ b/arch/sparc64/lib/Makefile 2004-09-26 10:25:55 -07:00 @@ -12,7 +12,7 @@ U1memcpy.o U1copy_from_user.o U1copy_to_user.o \ U3memcpy.o U3copy_from_user.o U3copy_to_user.o U3patch.o \ copy_in_user.o user_fixup.o memmove.o \ - mcount.o ipcsum.o rwsem.o xor.o find_bit.o delay.o + mcount.o ipcsum.o rwsem.o xor.o find_bit.o delay.o iomap.o lib-$(CONFIG_DEBUG_SPINLOCK) += debuglocks.o lib-$(CONFIG_HAVE_DEC_LOCK) += dec_and_lock.o diff -Nru a/arch/sparc64/lib/PeeCeeI.c b/arch/sparc64/lib/PeeCeeI.c --- a/arch/sparc64/lib/PeeCeeI.c 2004-09-26 10:25:57 -07:00 +++ b/arch/sparc64/lib/PeeCeeI.c 2004-09-26 10:25:57 -07:00 @@ -7,7 +7,7 @@ #include #include -void outsb(unsigned long addr, const void *src, unsigned long count) +void outsb(void __iomem *addr, const void *src, unsigned long count) { const u8 *p = src; @@ -15,7 +15,7 @@ outb(*p++, addr); } -void outsw(unsigned long addr, const void *src, unsigned long count) +void outsw(void __iomem *addr, const void *src, unsigned long count) { if(count) { u16 *ps = (u16 *)src; @@ -44,7 +44,7 @@ } } -void outsl(unsigned long addr, const void *src, unsigned long count) +void outsl(void __iomem *addr, const void *src, unsigned long count) { if(count) { if((((u64)src) & 0x3) == 0) { @@ -119,7 +119,7 @@ } } -void insb(unsigned long addr, void *dst, unsigned long count) +void insb(void __iomem *addr, void *dst, unsigned long count) { if(count) { u32 *pi; @@ -144,7 +144,7 @@ } } -void insw(unsigned long addr, void *dst, unsigned long count) +void insw(void __iomem *addr, void *dst, unsigned long count) { if(count) { u16 *ps = dst; @@ -169,7 +169,7 @@ } } -void insl(unsigned long addr, void *dst, unsigned long count) +void insl(void __iomem *addr, void *dst, unsigned long count) { if(count) { if((((unsigned long)dst) & 0x3) == 0) { diff -Nru a/arch/sparc64/lib/iomap.c b/arch/sparc64/lib/iomap.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/sparc64/lib/iomap.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,48 @@ +/* + * Implement the sparc64 iomap interfaces + */ +#include +#include +#include + +/* Create a virtual mapping cookie for an IO port range */ +void __iomem *ioport_map(unsigned long port, unsigned int nr) +{ + return (void __iomem *) (unsigned long) port; +} + +void ioport_unmap(void __iomem *addr) +{ + /* Nothing to do */ +} +EXPORT_SYMBOL(ioport_map); +EXPORT_SYMBOL(ioport_unmap); + +/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */ +void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) +{ + unsigned long start = pci_resource_start(dev, bar); + unsigned long len = pci_resource_len(dev, bar); + unsigned long flags = pci_resource_flags(dev, bar); + + if (!len || !start) + return NULL; + if (maxlen && len > maxlen) + len = maxlen; + if (flags & IORESOURCE_IO) + return ioport_map(start, len); + if (flags & IORESOURCE_MEM) { + if (flags & IORESOURCE_CACHEABLE) + return ioremap(start, len); + return ioremap_nocache(start, len); + } + /* What? */ + return NULL; +} + +void pci_iounmap(struct pci_dev *dev, void __iomem * addr) +{ + /* nothing to do */ +} +EXPORT_SYMBOL(pci_iomap); +EXPORT_SYMBOL(pci_iounmap); diff -Nru a/arch/um/Kconfig b/arch/um/Kconfig --- a/arch/um/Kconfig 2004-09-26 10:25:56 -07:00 +++ b/arch/um/Kconfig 2004-09-26 10:25:56 -07:00 @@ -132,8 +132,9 @@ config HOST_2G_2G bool "2G/2G host address space split" -config UML_SMP +config SMP bool "Symmetric multi-processing support" + default n help This option enables UML SMP support. UML implements virtual SMP by allowing as many processes to run simultaneously on the host as @@ -144,10 +145,6 @@ on the host scheduler. CONFIG_SMP will be set to whatever this option is set to. It is safe to leave this unchanged. - -config SMP - bool - default UML_SMP config NR_CPUS int "Maximum number of CPUs (2-32)" diff -Nru a/arch/um/Kconfig_char b/arch/um/Kconfig_char --- a/arch/um/Kconfig_char 2004-09-26 10:25:56 -07:00 +++ b/arch/um/Kconfig_char 2004-09-26 10:25:56 -07:00 @@ -158,11 +158,6 @@ When not in use, each legacy PTY occupies 12 bytes on 32-bit architectures and 24 bytes on 64-bit architectures. -#config UNIX98_PTY_COUNT -# int "Maximum number of Unix98 PTYs in use (0-2048)" -# depends on UNIX98_PTYS -# default "256" - config WATCHDOG bool "Watchdog Timer Support" diff -Nru a/arch/um/Makefile b/arch/um/Makefile --- a/arch/um/Makefile 2004-09-26 10:25:56 -07:00 +++ b/arch/um/Makefile 2004-09-26 10:25:56 -07:00 @@ -48,8 +48,6 @@ include $(ARCH_DIR)/Makefile-$(SUBARCH) include $(ARCH_DIR)/Makefile-os-$(OS) -EXTRAVERSION := $(EXTRAVERSION)-1um - ARCH_INCLUDE = -I$(ARCH_DIR)/include # -Derrno=kernel_errno - This turns all kernel references to errno into @@ -69,7 +67,7 @@ # included; the values here are meaningless CONFIG_NEST_LEVEL ?= 0 -CONFIG_KERNEL_HALF_GIGS ?= 0 +CONFIG_KERNEL_HALF_GIGS ?= 0 SIZE = (($(CONFIG_NEST_LEVEL) + $(CONFIG_KERNEL_HALF_GIGS)) * 0x20000000) @@ -111,8 +109,12 @@ CONFIG_KERNEL_STACK_ORDER ?= 2 STACK_SIZE := $(shell echo $$[ 4096 * (1 << $(CONFIG_KERNEL_STACK_ORDER)) ] ) +ifndef START + START = $$(($(TOP_ADDR) - $(SIZE))) +endif + CPPFLAGS_vmlinux.lds = $(shell echo -U$(SUBARCH) \ - -DSTART=$$(($(TOP_ADDR) - $(SIZE))) -DELF_ARCH=$(ELF_ARCH) \ + -DSTART=$(START) -DELF_ARCH=$(ELF_ARCH) \ -DELF_FORMAT=\"$(ELF_FORMAT)\" $(CPP_MODE_TT) \ -DKERNEL_STACK_SIZE=$(STACK_SIZE)) diff -Nru a/arch/um/Makefile-i386 b/arch/um/Makefile-i386 --- a/arch/um/Makefile-i386 2004-09-26 10:25:57 -07:00 +++ b/arch/um/Makefile-i386 2004-09-26 10:25:57 -07:00 @@ -4,7 +4,18 @@ TOP_ADDR = 0xc0000000 endif +ifeq ($(CONFIG_MODE_SKAS),y) + ifneq ($(CONFIG_MODE_TT),y) + START = 0x8048000 + endif +endif + CFLAGS += -U__$(SUBARCH)__ -U$(SUBARCH) + +ifneq ($(CONFIG_GPROF),y) +ARCH_CFLAGS += -DUM_FASTCALL +endif + ELF_ARCH = $(SUBARCH) ELF_FORMAT = elf32-$(SUBARCH) diff -Nru a/arch/um/defconfig b/arch/um/defconfig --- a/arch/um/defconfig 2004-09-26 10:25:56 -07:00 +++ b/arch/um/defconfig 2004-09-26 10:25:56 -07:00 @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit -# Linux kernel version: 2.6.8.1-mm3 -# Fri Aug 20 13:03:03 2004 +# Linux kernel version: 2.6.9-rc2-mm1 +# Thu Sep 16 23:44:48 2004 # CONFIG_USERMODE=y CONFIG_MMU=y @@ -20,7 +20,6 @@ CONFIG_HPPFS=y CONFIG_MCONSOLE=y # CONFIG_HOST_2G_2G is not set -# CONFIG_UML_SMP is not set # CONFIG_SMP is not set CONFIG_NEST_LEVEL=0 CONFIG_KERNEL_HALF_GIGS=1 @@ -38,6 +37,7 @@ # # General setup # +CONFIG_LOCALVERSION="" CONFIG_SWAP=y CONFIG_SYSVIPC=y # CONFIG_POSIX_MQUEUE is not set @@ -47,6 +47,7 @@ # CONFIG_AUDIT is not set CONFIG_LOG_BUF_SHIFT=14 # CONFIG_HOTPLUG is not set +CONFIG_KOBJECT_UEVENT=y # CONFIG_IKCONFIG is not set # CONFIG_EMBEDDED is not set CONFIG_KALLSYMS=y @@ -54,12 +55,13 @@ # CONFIG_KALLSYMS_EXTRA_PASS is not set CONFIG_FUTEX=y CONFIG_EPOLL=y -# CONFIG_CPUSETS is not set CONFIG_IOSCHED_NOOP=y CONFIG_IOSCHED_AS=y CONFIG_IOSCHED_DEADLINE=y CONFIG_IOSCHED_CFQ=y # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set +CONFIG_SHMEM=y +# CONFIG_TINY_SHMEM is not set # # Loadable module support @@ -144,6 +146,7 @@ # CONFIG_INET_AH is not set # CONFIG_INET_ESP is not set # CONFIG_INET_IPCOMP is not set +# CONFIG_INET_TUNNEL is not set # CONFIG_IPV6 is not set # CONFIG_NETFILTER is not set @@ -253,6 +256,11 @@ CONFIG_QUOTACTL=y CONFIG_AUTOFS_FS=y CONFIG_AUTOFS4_FS=y + +# +# Caches +# +# CONFIG_CACHEFS is not set # # CD-ROM/DVD Filesystems diff -Nru a/arch/um/drivers/chan_kern.c b/arch/um/drivers/chan_kern.c --- a/arch/um/drivers/chan_kern.c 2004-09-26 10:25:57 -07:00 +++ b/arch/um/drivers/chan_kern.c 2004-09-26 10:25:57 -07:00 @@ -106,6 +106,8 @@ return(n); } +/* XXX Trivial wrapper around os_write_file */ + int generic_write(int fd, const char *buf, int n, void *unused) { return(os_write_file(fd, buf, n)); diff -Nru a/arch/um/drivers/cow_user.c b/arch/um/drivers/cow_user.c --- a/arch/um/drivers/cow_user.c 2004-09-26 10:25:56 -07:00 +++ b/arch/um/drivers/cow_user.c 2004-09-26 10:25:56 -07:00 @@ -27,8 +27,8 @@ #define PATH_LEN_V2 MAXPATHLEN struct cow_header_v2 { - unsigned long magic; - unsigned long version; + __u32 magic; + __u32 version; char backing_file[PATH_LEN_V2]; time_t mtime; __u64 size; diff -Nru a/arch/um/drivers/fd.c b/arch/um/drivers/fd.c --- a/arch/um/drivers/fd.c 2004-09-26 10:25:57 -07:00 +++ b/arch/um/drivers/fd.c 2004-09-26 10:25:57 -07:00 @@ -7,6 +7,7 @@ #include #include #include +#include #include "user.h" #include "user_util.h" #include "chan_user.h" @@ -45,10 +46,16 @@ int fd_open(int input, int output, int primary, void *d, char **dev_out) { struct fd_chan *data = d; + int err; if(data->raw && isatty(data->fd)){ - tcgetattr(data->fd, &data->tt); - raw(data->fd, 0); + CATCH_EINTR(err = tcgetattr(data->fd, &data->tt)); + if(err) + return(err); + + err = raw(data->fd); + if(err) + return(err); } sprintf(data->str, "%d", data->fd); *dev_out = data->str; @@ -58,9 +65,13 @@ void fd_close(int fd, void *d) { struct fd_chan *data = d; + int err; if(data->raw && isatty(fd)){ - tcsetattr(fd, TCSAFLUSH, &data->tt); + CATCH_EINTR(err = tcsetattr(fd, TCSAFLUSH, &data->tt)); + if(err) + printk("Failed to restore terminal state - " + "errno = %d\n", -err); data->raw = 0; } } diff -Nru a/arch/um/drivers/hostaudio_kern.c b/arch/um/drivers/hostaudio_kern.c --- a/arch/um/drivers/hostaudio_kern.c 2004-09-26 10:25:57 -07:00 +++ b/arch/um/drivers/hostaudio_kern.c 2004-09-26 10:25:57 -07:00 @@ -35,7 +35,7 @@ " The default is \"" HOSTAUDIO_DEV_DSP "\".\n\n" #define MIXER_HELP \ -" This is used to specify the host mixer device to the hostaudio driver.\n" \ +" This is used to specify the host mixer device to the hostaudio driver.\n"\ " The default is \"" HOSTAUDIO_DEV_MIXER "\".\n\n" #ifndef MODULE @@ -72,7 +72,7 @@ { struct hostaudio_state *state = file->private_data; void *kbuf; - int ret; + int err; #ifdef DEBUG printk("hostaudio: read called, count = %d\n", count); @@ -82,16 +82,16 @@ if(kbuf == NULL) return(-ENOMEM); - ret = os_read_file(state->fd, kbuf, count); - if(ret < 0) + err = os_read_file(state->fd, kbuf, count); + if(err < 0) goto out; - if(copy_to_user(buffer, kbuf, ret)) - ret = -EFAULT; + if(copy_to_user(buffer, kbuf, err)) + err = -EFAULT; out: kfree(kbuf); - return(ret); + return(err); } static ssize_t hostaudio_write(struct file *file, const char *buffer, @@ -99,7 +99,7 @@ { struct hostaudio_state *state = file->private_data; void *kbuf; - int ret; + int err; #ifdef DEBUG printk("hostaudio: write called, count = %d\n", count); @@ -109,17 +109,18 @@ if(kbuf == NULL) return(-ENOMEM); - ret = -EFAULT; + err = -EFAULT; if(copy_from_user(kbuf, buffer, count)) goto out; - ret = os_write_file(state->fd, kbuf, count); - if(ret < 0) + err = os_write_file(state->fd, kbuf, count); + if(err < 0) goto out; + *ppos += err; out: kfree(kbuf); - return(ret); + return(err); } static unsigned int hostaudio_poll(struct file *file, @@ -139,7 +140,7 @@ { struct hostaudio_state *state = file->private_data; unsigned long data = 0; - int ret; + int err; #ifdef DEBUG printk("hostaudio: ioctl called, cmd = %u\n", cmd); @@ -158,7 +159,7 @@ break; } - ret = os_ioctl_generic(state->fd, cmd, (unsigned long) &data); + err = os_ioctl_generic(state->fd, cmd, (unsigned long) &data); switch(cmd){ case SNDCTL_DSP_SPEED: @@ -174,7 +175,7 @@ break; } - return(ret); + return(err); } static int hostaudio_open(struct inode *inode, struct file *file) @@ -188,22 +189,19 @@ #endif state = kmalloc(sizeof(struct hostaudio_state), GFP_KERNEL); - if(state == NULL) return(-ENOMEM); + if(state == NULL) + return(-ENOMEM); if(file->f_mode & FMODE_READ) r = 1; if(file->f_mode & FMODE_WRITE) w = 1; ret = os_open_file(dsp, of_set_rw(OPENFLAGS(), r, w), 0); - if(ret < 0){ - printk("hostaudio_open failed to open '%s', err = %d\n", - dsp, -ret); kfree(state); return(ret); } state->fd = ret; - file->private_data = state; return(0); } @@ -216,11 +214,7 @@ printk("hostaudio: release called\n"); #endif - if(state->fd >= 0){ os_close_file(state->fd); - state->fd = -1; - } - kfree(state); return(0); @@ -265,8 +259,6 @@ return(ret); } - state->fd = ret; - file->private_data = state; return(0); } @@ -279,10 +271,7 @@ printk("hostmixer: release called\n"); #endif - if(state->fd >= 0){ os_close_file(state->fd); - state->fd = -1; - } kfree(state); return(0); diff -Nru a/arch/um/drivers/line.c b/arch/um/drivers/line.c --- a/arch/um/drivers/line.c 2004-09-26 10:25:57 -07:00 +++ b/arch/um/drivers/line.c 2004-09-26 10:25:57 -07:00 @@ -73,9 +73,8 @@ else { memcpy(line->tail, buf, end); buf += end; - len -= end; - memcpy(line->buffer, buf, len); - line->tail = line->buffer + len; + memcpy(line->buffer, buf, len - end); + line->tail = line->buffer + len - end; } return(len); @@ -332,7 +331,7 @@ init++; if((n >= 0) && (n >= num)){ printk("line_setup - %d out of range ((0 ... %d) allowed)\n", - n, num); + n, num - 1); return(0); } else if(n >= 0){ diff -Nru a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c --- a/arch/um/drivers/mconsole_kern.c 2004-09-26 10:25:55 -07:00 +++ b/arch/um/drivers/mconsole_kern.c 2004-09-26 10:25:55 -07:00 @@ -51,27 +51,26 @@ LIST_HEAD(mc_requests); -void mc_work_proc(void *unused) +static void mc_work_proc(void *unused) { struct mconsole_entry *req; unsigned long flags; - int done; - do { + while(!list_empty(&mc_requests)){ local_save_flags(flags); req = list_entry(mc_requests.next, struct mconsole_entry, list); list_del(&req->list); - done = list_empty(&mc_requests); local_irq_restore(flags); req->request.cmd->handler(&req->request); kfree(req); - } while(!done); + } } DECLARE_WORK(mconsole_work, mc_work_proc, NULL); -irqreturn_t mconsole_interrupt(int irq, void *dev_id, struct pt_regs *regs) +static irqreturn_t mconsole_interrupt(int irq, void *dev_id, + struct pt_regs *regs) { int fd; struct mconsole_entry *new; @@ -91,7 +90,8 @@ } } } - if(!list_empty(&mc_requests)) schedule_work(&mconsole_work); + if(!list_empty(&mc_requests)) + schedule_work(&mconsole_work); reactivate_fd(fd, MCONSOLE_IRQ); return(IRQ_HANDLED); } @@ -374,8 +374,8 @@ ptr += strlen("sysrq"); while(isspace(*ptr)) ptr++; - handle_sysrq(*ptr, ¤t->thread.regs, NULL); mconsole_reply(req, "", 0, 0); + handle_sysrq(*ptr, ¤t->thread.regs, NULL); } #else void mconsole_sysrq(struct mc_request *req) diff -Nru a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c --- a/arch/um/drivers/net_kern.c 2004-09-26 10:25:56 -07:00 +++ b/arch/um/drivers/net_kern.c 2004-09-26 10:25:56 -07:00 @@ -19,6 +19,8 @@ #include "linux/inetdevice.h" #include "linux/ctype.h" #include "linux/bootmem.h" +#include "linux/ethtool.h" +#include "asm/uaccess.h" #include "user_util.h" #include "kern_util.h" #include "net_kern.h" @@ -127,6 +129,13 @@ spin_lock(&opened_lock); list_add(&lp->list, &opened); spin_unlock(&opened_lock); + + /* clear buffer - it can happen that the host side of the interface + * is full when we get here. In this case, new data is never queued, + * SIGIOs never arrive, and the net never works. + */ + while((err = uml_net_rx(dev)) > 0) ; + out: spin_unlock(&lp->lock); return(err); @@ -240,7 +249,30 @@ static int uml_net_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) { - return(-EINVAL); + static const struct ethtool_drvinfo info = { + .cmd = ETHTOOL_GDRVINFO, + .driver = "uml virtual ethernet", + .version = "42", + }; + void *useraddr; + u32 ethcmd; + + switch (cmd) { + case SIOCETHTOOL: + useraddr = ifr->ifr_data; + if (copy_from_user(ðcmd, useraddr, sizeof(ethcmd))) + return -EFAULT; + switch (ethcmd) { + case ETHTOOL_GDRVINFO: + if (copy_to_user(useraddr, &info, sizeof(info))) + return -EFAULT; + return 0; + default: + return -EOPNOTSUPP; + } + default: + return -EINVAL; + } } void uml_net_user_timer_expire(unsigned long _conn) diff -Nru a/arch/um/drivers/port_user.c b/arch/um/drivers/port_user.c --- a/arch/um/drivers/port_user.c 2004-09-26 10:25:56 -07:00 +++ b/arch/um/drivers/port_user.c 2004-09-26 10:25:56 -07:00 @@ -76,12 +76,17 @@ int port_open(int input, int output, int primary, void *d, char **dev_out) { struct port_chan *data = d; - int fd; + int fd, err; fd = port_wait(data->kernel_data); if((fd >= 0) && data->raw){ - tcgetattr(fd, &data->tt); - raw(fd, 0); + CATCH_EINTR(err = tcgetattr(fd, &data->tt)); + if(err) + return(err); + + err = raw(fd); + if(err) + return(err); } *dev_out = data->dev; return(fd); diff -Nru a/arch/um/drivers/pty.c b/arch/um/drivers/pty.c --- a/arch/um/drivers/pty.c 2004-09-26 10:25:57 -07:00 +++ b/arch/um/drivers/pty.c 2004-09-26 10:25:57 -07:00 @@ -38,7 +38,7 @@ { struct pty_chan *data = d; char *dev; - int fd; + int fd, err; fd = get_pty(); if(fd < 0){ @@ -46,8 +46,13 @@ return(-errno); } if(data->raw){ - tcgetattr(fd, &data->tt); - raw(fd, 0); + CATCH_EINTR(err = tcgetattr(fd, &data->tt)); + if(err) + return(err); + + err = raw(fd); + if(err) + return(err); } dev = ptsname(fd); @@ -89,13 +94,19 @@ int pty_open(int input, int output, int primary, void *d, char **dev_out) { struct pty_chan *data = d; - int fd; + int fd, err; char dev[sizeof("/dev/ptyxx\0")] = "/dev/ptyxx"; fd = getmaster(dev); - if(fd < 0) return(-errno); + if(fd < 0) + return(-errno); + + if(data->raw){ + err = raw(fd); + if(err) + return(err); + } - if(data->raw) raw(fd, 0); if(data->announce) (*data->announce)(dev, data->dev); sprintf(data->dev_name, "%s", dev); diff -Nru a/arch/um/drivers/stdio_console.c b/arch/um/drivers/stdio_console.c --- a/arch/um/drivers/stdio_console.c 2004-09-26 10:25:55 -07:00 +++ b/arch/um/drivers/stdio_console.c 2004-09-26 10:25:55 -07:00 @@ -191,7 +191,7 @@ late_initcall(stdio_init); -static void console_write(struct console *console, const char *string, +static void uml_console_write(struct console *console, const char *string, unsigned len) { struct line *line = &vts[console->index]; @@ -203,22 +203,22 @@ up(&line->sem); } -static struct tty_driver *um_console_device(struct console *c, int *index) +static struct tty_driver *uml_console_device(struct console *c, int *index) { *index = c->index; return console_driver; } -static int console_setup(struct console *co, char *options) +static int uml_console_setup(struct console *co, char *options) { return(0); } static struct console stdiocons = { name: "tty", - write: console_write, - device: um_console_device, - setup: console_setup, + write: uml_console_write, + device: uml_console_device, + setup: uml_console_setup, flags: CON_PRINTBUFFER, index: -1, }; diff -Nru a/arch/um/drivers/tty.c b/arch/um/drivers/tty.c --- a/arch/um/drivers/tty.c 2004-09-26 10:25:56 -07:00 +++ b/arch/um/drivers/tty.c 2004-09-26 10:25:56 -07:00 @@ -41,13 +41,18 @@ int tty_open(int input, int output, int primary, void *d, char **dev_out) { struct tty_chan *data = d; - int fd; + int fd, err; fd = os_open_file(data->dev, of_set_rw(OPENFLAGS(), input, output), 0); if(fd < 0) return(fd); if(data->raw){ - tcgetattr(fd, &data->tt); - raw(fd, 0); + CATCH_EINTR(err = tcgetattr(fd, &data->tt)); + if(err) + return(err); + + err = raw(fd); + if(err) + return(err); } *dev_out = data->dev; diff -Nru a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c --- a/arch/um/drivers/ubd_kern.c 2004-09-26 10:25:56 -07:00 +++ b/arch/um/drivers/ubd_kern.c 2004-09-26 10:25:56 -07:00 @@ -299,7 +299,7 @@ } if(n >= MAX_DEV){ printk(KERN_ERR "ubd_setup : index %d out of range " - "(%d devices)\n", n, MAX_DEV); + "(%d devices, from 0 to %d)\n", n, MAX_DEV, MAX_DEV - 1); return(1); } @@ -776,10 +776,10 @@ io_pid = start_io_thread(stack + PAGE_SIZE - sizeof(void *), &thread_fd); if(io_pid < 0){ - io_pid = -1; printk(KERN_ERR "ubd : Failed to start I/O thread (errno = %d) - " "falling back to synchronous I/O\n", -io_pid); + io_pid = -1; return(0); } err = um_request_irq(UBD_IRQ, thread_fd, IRQ_READ, ubd_intr, @@ -1064,7 +1064,6 @@ { struct hd_geometry *loc = (struct hd_geometry *) arg; struct ubd *dev = inode->i_bdev->bd_disk->private_data; - int err; struct hd_driveid ubd_id = { .cyls = 0, .heads = 128, @@ -1081,32 +1080,6 @@ g.cylinders = dev->size / (128 * 32 * 512); g.start = get_start_sect(inode->i_bdev); return(copy_to_user(loc, &g, sizeof(g)) ? -EFAULT : 0); - - case HDIO_SET_UNMASKINTR: - if(!capable(CAP_SYS_ADMIN)) return(-EACCES); - if((arg > 1) || (inode->i_bdev->bd_contains != inode->i_bdev)) - return(-EINVAL); - return(0); - - case HDIO_GET_UNMASKINTR: - if(!arg) return(-EINVAL); - err = verify_area(VERIFY_WRITE, (long *) arg, sizeof(long)); - if(err) - return(err); - return(0); - - case HDIO_GET_MULTCOUNT: - if(!arg) return(-EINVAL); - err = verify_area(VERIFY_WRITE, (long *) arg, sizeof(long)); - if(err) - return(err); - return(0); - - case HDIO_SET_MULTCOUNT: - if(!capable(CAP_SYS_ADMIN)) return(-EACCES); - if(inode->i_bdev->bd_contains != inode->i_bdev) - return(-EINVAL); - return(0); case HDIO_GET_IDENTITY: ubd_id.cyls = dev->size / (128 * 32 * 512); diff -Nru a/arch/um/drivers/xterm.c b/arch/um/drivers/xterm.c --- a/arch/um/drivers/xterm.c 2004-09-26 10:25:55 -07:00 +++ b/arch/um/drivers/xterm.c 2004-09-26 10:25:55 -07:00 @@ -83,6 +83,7 @@ " are 'xterm=gnome-terminal,-t,-x'.\n\n" ); +/* XXX This badly needs some cleaning up in the error paths */ int xterm_open(int input, int output, int primary, void *d, char **dev_out) { struct xterm_chan *data = d; @@ -141,8 +142,19 @@ goto out; } - tcgetattr(new, &data->tt); - if(data->raw) raw(new, 0); + CATCH_EINTR(err = tcgetattr(new, &data->tt)); + if(err){ + new = err; + goto out; + } + + if(data->raw){ + err = raw(new); + if(err){ + new = err; + goto out; + } + } data->pid = pid; *dev_out = NULL; diff -Nru a/arch/um/dyn.lds.S b/arch/um/dyn.lds.S --- a/arch/um/dyn.lds.S 2004-09-26 10:25:56 -07:00 +++ /dev/null Wed Dec 31 16:00:00 196900 @@ -1,174 +0,0 @@ -#include - -OUTPUT_FORMAT(ELF_FORMAT) -OUTPUT_ARCH(ELF_ARCH) -ENTRY(_start) -jiffies = jiffies_64; - -SEARCH_DIR("/usr/local/i686-pc-linux-gnu/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib"); -/* Do we need any of these for elf? - __DYNAMIC = 0; */ -SECTIONS -{ - . = START + SIZEOF_HEADERS; - .interp : { *(.interp) } - __binary_start = .; - . = ALIGN(4096); /* Init code and data */ - _stext = .; - __init_begin = .; - .init.text : { - _sinittext = .; - *(.init.text) - _einittext = .; - } - - . = ALIGN(4096); - - /* Read-only sections, merged into text segment: */ - .hash : { *(.hash) } - .dynsym : { *(.dynsym) } - .dynstr : { *(.dynstr) } - .gnu.version : { *(.gnu.version) } - .gnu.version_d : { *(.gnu.version_d) } - .gnu.version_r : { *(.gnu.version_r) } - .rel.init : { *(.rel.init) } - .rela.init : { *(.rela.init) } - .rel.text : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) } - .rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) } - .rel.fini : { *(.rel.fini) } - .rela.fini : { *(.rela.fini) } - .rel.rodata : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) } - .rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) } - .rel.data : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) } - .rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) } - .rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) } - .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) } - .rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) } - .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) } - .rel.ctors : { *(.rel.ctors) } - .rela.ctors : { *(.rela.ctors) } - .rel.dtors : { *(.rel.dtors) } - .rela.dtors : { *(.rela.dtors) } - .rel.got : { *(.rel.got) } - .rela.got : { *(.rela.got) } - .rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) } - .rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) } - .rel.plt : { *(.rel.plt) } - .rela.plt : { *(.rela.plt) } - .init : { - KEEP (*(.init)) - } =0x90909090 - .plt : { *(.plt) } - .text : { - *(.text) - SCHED_TEXT - *(.stub .text.* .gnu.linkonce.t.*) - /* .gnu.warning sections are handled specially by elf32.em. */ - *(.gnu.warning) - } =0x90909090 - .fini : { - KEEP (*(.fini)) - } =0x90909090 - - .kstrtab : { *(.kstrtab) } - - #include "asm/common.lds.S" - - init.data : { *(.init.data) } - - /* Ensure the __preinit_array_start label is properly aligned. We - could instead move the label definition inside the section, but - the linker would then create the section even if it turns out to - be empty, which isn't pretty. */ - . = ALIGN(32 / 8); - .preinit_array : { *(.preinit_array) } - .init_array : { *(.init_array) } - .fini_array : { *(.fini_array) } - .data : { - . = ALIGN(KERNEL_STACK_SIZE); /* init_task */ - *(.data.init_task) - *(.data .data.* .gnu.linkonce.d.*) - SORT(CONSTRUCTORS) - } - .data1 : { *(.data1) } - .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } - .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } - .eh_frame : { KEEP (*(.eh_frame)) } - .gcc_except_table : { *(.gcc_except_table) } - .dynamic : { *(.dynamic) } - .ctors : { - /* gcc uses crtbegin.o to find the start of - the constructors, so we make sure it is - first. Because this is a wildcard, it - doesn't matter if the user does not - actually link against crtbegin.o; the - linker won't look for a file to match a - wildcard. The wildcard also means that it - doesn't matter which directory crtbegin.o - is in. */ - KEEP (*crtbegin.o(.ctors)) - /* We don't want to include the .ctor section from - from the crtend.o file until after the sorted ctors. - The .ctor section from the crtend file contains the - end of ctors marker and it must be last */ - KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors)) - KEEP (*(SORT(.ctors.*))) - KEEP (*(.ctors)) - } - .dtors : { - KEEP (*crtbegin.o(.dtors)) - KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors)) - KEEP (*(SORT(.dtors.*))) - KEEP (*(.dtors)) - } - .jcr : { KEEP (*(.jcr)) } - .got : { *(.got.plt) *(.got) } - _edata = .; - PROVIDE (edata = .); - __bss_start = .; - .bss : { - *(.dynbss) - *(.bss .bss.* .gnu.linkonce.b.*) - *(COMMON) - /* Align here to ensure that the .bss section occupies space up to - _end. Align after .bss to ensure correct alignment even if the - .bss section disappears because there are no input sections. */ - . = ALIGN(32 / 8); - . = ALIGN(32 / 8); - } - _end = .; - PROVIDE (end = .); - /* Stabs debugging sections. */ - .stab 0 : { *(.stab) } - .stabstr 0 : { *(.stabstr) } - .stab.excl 0 : { *(.stab.excl) } - .stab.exclstr 0 : { *(.stab.exclstr) } - .stab.index 0 : { *(.stab.index) } - .stab.indexstr 0 : { *(.stab.indexstr) } - .comment 0 : { *(.comment) } - /* DWARF debug sections. - Symbols in the DWARF debugging sections are relative to the beginning - of the section so we begin them at 0. */ - /* DWARF 1 */ - .debug 0 : { *(.debug) } - .line 0 : { *(.line) } - /* GNU DWARF 1 extensions */ - .debug_srcinfo 0 : { *(.debug_srcinfo) } - .debug_sfnames 0 : { *(.debug_sfnames) } - /* DWARF 1.1 and DWARF 2 */ - .debug_aranges 0 : { *(.debug_aranges) } - .debug_pubnames 0 : { *(.debug_pubnames) } - /* DWARF 2 */ - .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } - .debug_abbrev 0 : { *(.debug_abbrev) } - .debug_line 0 : { *(.debug_line) } - .debug_frame 0 : { *(.debug_frame) } - .debug_str 0 : { *(.debug_str) } - .debug_loc 0 : { *(.debug_loc) } - .debug_macinfo 0 : { *(.debug_macinfo) } - /* SGI/MIPS DWARF 2 extensions */ - .debug_weaknames 0 : { *(.debug_weaknames) } - .debug_funcnames 0 : { *(.debug_funcnames) } - .debug_typenames 0 : { *(.debug_typenames) } - .debug_varnames 0 : { *(.debug_varnames) } -} diff -Nru a/arch/um/include/irq_user.h b/arch/um/include/irq_user.h --- a/arch/um/include/irq_user.h 2004-09-26 10:25:56 -07:00 +++ b/arch/um/include/irq_user.h 2004-09-26 10:25:56 -07:00 @@ -14,6 +14,7 @@ extern void free_irq_by_fd(int fd); extern void reactivate_fd(int fd, int irqnum); extern void deactivate_fd(int fd, int irqnum); +extern int deactivate_all_fds(void); extern void forward_interrupts(int pid); extern void init_irq_signals(int on_sigstack); extern void forward_ipi(int fd, int pid); diff -Nru a/arch/um/include/os.h b/arch/um/include/os.h --- a/arch/um/include/os.h 2004-09-26 10:25:55 -07:00 +++ b/arch/um/include/os.h 2004-09-26 10:25:55 -07:00 @@ -140,6 +140,7 @@ extern int os_file_modtime(char *file, unsigned long *modtime); extern int os_pipe(int *fd, int stream, int close_on_exec); extern int os_set_fd_async(int fd, int owner); +extern int os_clear_fd_async(int fd); extern int os_set_fd_block(int fd, int blocking); extern int os_accept_connection(int fd); extern int os_create_unix_socket(char *file, int len, int close_on_exec); @@ -165,6 +166,7 @@ int r, int w, int x); extern int os_unmap_memory(void *addr, int len); extern void os_flush_stdout(void); +extern unsigned long long os_usecs(void); #endif diff -Nru a/arch/um/include/time_user.h b/arch/um/include/time_user.h --- a/arch/um/include/time_user.h 2004-09-26 10:25:55 -07:00 +++ b/arch/um/include/time_user.h 2004-09-26 10:25:55 -07:00 @@ -11,6 +11,7 @@ extern void set_interval(int timer_type); extern void idle_sleep(int secs); extern void enable_timer(void); +extern void disable_timer(void); extern unsigned long time_lock(void); extern void time_unlock(unsigned long); diff -Nru a/arch/um/include/user_util.h b/arch/um/include/user_util.h --- a/arch/um/include/user_util.h 2004-09-26 10:25:55 -07:00 +++ b/arch/um/include/user_util.h 2004-09-26 10:25:55 -07:00 @@ -8,6 +8,8 @@ #include "sysdep/ptrace.h" +#define CATCH_EINTR(expr) while (((expr) < 0) && (errno == EINTR)) + extern int mode_tt; extern int grantpt(int __fd); @@ -72,7 +74,6 @@ extern void tracer_panic(char *msg, ...); extern char *get_umid(int only_if_set); extern void do_longjmp(void *p, int val); -extern void suspend_new_thread(int fd); extern int detach(int pid, int sig); extern int attach(int pid); extern void kill_child_dead(int pid); @@ -88,11 +89,9 @@ extern void forward_pending_sigio(int target); extern int can_do_skas(void); extern void arch_init_thread(void); +extern int setjmp_wrapper(void (*proc)(void *, void *), ...); +extern int raw(int fd); -extern int __raw(int fd, int complain, int now); -#define raw(fd, complain) __raw((fd), (complain), 1) - -#define CATCH_EINTR(expr) while ( ((expr) < 0) && errno == EINTR) #endif /* diff -Nru a/arch/um/kernel/Makefile b/arch/um/kernel/Makefile --- a/arch/um/kernel/Makefile 2004-09-26 10:25:56 -07:00 +++ b/arch/um/kernel/Makefile 2004-09-26 10:25:56 -07:00 @@ -3,7 +3,12 @@ # Licensed under the GPL # -extra-y := vmlinux.lds uml.lds +extra-y := vmlinux.lds uml.lds dyn.lds + +# Descend into ../util for make clean. This is here because it doesn't work +# in arch/um/Makefile. + +subdir- = ../util obj-y = checksum.o config.o exec_kern.o exitcode.o frame_kern.o frame.o \ helper.o init_task.o irq.o irq_user.o ksyms.o main.o mem.o mem_user.o \ diff -Nru a/arch/um/kernel/dyn.lds.S b/arch/um/kernel/dyn.lds.S --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/um/kernel/dyn.lds.S 2004-09-26 10:25:56 -07:00 @@ -0,0 +1,171 @@ +#include + +OUTPUT_FORMAT(ELF_FORMAT) +OUTPUT_ARCH(ELF_ARCH) +ENTRY(_start) +jiffies = jiffies_64; + +SECTIONS +{ + . = START + SIZEOF_HEADERS; + .interp : { *(.interp) } + __binary_start = .; + . = ALIGN(4096); /* Init code and data */ + _stext = .; + __init_begin = .; + .init.text : { + _sinittext = .; + *(.init.text) + _einittext = .; + } + + . = ALIGN(4096); + + /* Read-only sections, merged into text segment: */ + .hash : { *(.hash) } + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } + .gnu.version : { *(.gnu.version) } + .gnu.version_d : { *(.gnu.version_d) } + .gnu.version_r : { *(.gnu.version_r) } + .rel.init : { *(.rel.init) } + .rela.init : { *(.rela.init) } + .rel.text : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) } + .rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) } + .rel.fini : { *(.rel.fini) } + .rela.fini : { *(.rela.fini) } + .rel.rodata : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) } + .rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) } + .rel.data : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) } + .rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) } + .rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) } + .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) } + .rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) } + .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) } + .rel.ctors : { *(.rel.ctors) } + .rela.ctors : { *(.rela.ctors) } + .rel.dtors : { *(.rel.dtors) } + .rela.dtors : { *(.rela.dtors) } + .rel.got : { *(.rel.got) } + .rela.got : { *(.rela.got) } + .rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) } + .rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) } + .rel.plt : { *(.rel.plt) } + .rela.plt : { *(.rela.plt) } + .init : { + KEEP (*(.init)) + } =0x90909090 + .plt : { *(.plt) } + .text : { + *(.text) + SCHED_TEXT + *(.stub .text.* .gnu.linkonce.t.*) + /* .gnu.warning sections are handled specially by elf32.em. */ + *(.gnu.warning) + } =0x90909090 + .fini : { + KEEP (*(.fini)) + } =0x90909090 + + .kstrtab : { *(.kstrtab) } + + #include "asm/common.lds.S" + + init.data : { *(.init.data) } + + /* Ensure the __preinit_array_start label is properly aligned. We + could instead move the label definition inside the section, but + the linker would then create the section even if it turns out to + be empty, which isn't pretty. */ + . = ALIGN(32 / 8); + .preinit_array : { *(.preinit_array) } + .init_array : { *(.init_array) } + .fini_array : { *(.fini_array) } + .data : { + . = ALIGN(KERNEL_STACK_SIZE); /* init_task */ + *(.data.init_task) + *(.data .data.* .gnu.linkonce.d.*) + SORT(CONSTRUCTORS) + } + .data1 : { *(.data1) } + .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } + .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } + .eh_frame : { KEEP (*(.eh_frame)) } + .gcc_except_table : { *(.gcc_except_table) } + .dynamic : { *(.dynamic) } + .ctors : { + /* gcc uses crtbegin.o to find the start of + the constructors, so we make sure it is + first. Because this is a wildcard, it + doesn't matter if the user does not + actually link against crtbegin.o; the + linker won't look for a file to match a + wildcard. The wildcard also means that it + doesn't matter which directory crtbegin.o + is in. */ + KEEP (*crtbegin.o(.ctors)) + /* We don't want to include the .ctor section from + from the crtend.o file until after the sorted ctors. + The .ctor section from the crtend file contains the + end of ctors marker and it must be last */ + KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + } + .dtors : { + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + } + .jcr : { KEEP (*(.jcr)) } + .got : { *(.got.plt) *(.got) } + _edata = .; + PROVIDE (edata = .); + __bss_start = .; + .bss : { + *(.dynbss) + *(.bss .bss.* .gnu.linkonce.b.*) + *(COMMON) + /* Align here to ensure that the .bss section occupies space up to + _end. Align after .bss to ensure correct alignment even if the + .bss section disappears because there are no input sections. */ + . = ALIGN(32 / 8); + . = ALIGN(32 / 8); + } + _end = .; + PROVIDE (end = .); + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + /* DWARF debug sections. + Symbols in the DWARF debugging sections are relative to the beginning + of the section so we begin them at 0. */ + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } +} diff -Nru a/arch/um/kernel/helper.c b/arch/um/kernel/helper.c --- a/arch/um/kernel/helper.c 2004-09-26 10:25:56 -07:00 +++ b/arch/um/kernel/helper.c 2004-09-26 10:25:56 -07:00 @@ -132,7 +132,7 @@ return(-errno); } if(stack_out == NULL){ - pid = waitpid(pid, &status, 0); + CATCH_EINTR(pid = waitpid(pid, &status, 0)); if(pid < 0){ printk("run_helper_thread - wait failed, errno = %d\n", errno); @@ -151,7 +151,7 @@ { int ret; - ret = waitpid(pid, NULL, WNOHANG); + CATCH_EINTR(ret = waitpid(pid, NULL, WNOHANG)); if(ret < 0){ printk("helper_wait : waitpid failed, errno = %d\n", errno); return(-errno); diff -Nru a/arch/um/kernel/irq.c b/arch/um/kernel/irq.c --- a/arch/um/kernel/irq.c 2004-09-26 10:25:57 -07:00 +++ b/arch/um/kernel/irq.c 2004-09-26 10:25:57 -07:00 @@ -147,7 +147,7 @@ struct irqaction * action) { int status = 1; /* Force the "do bottom halves" bit */ - int ret; + int ret, retval = 0; if (!(action->flags & SA_INTERRUPT)) local_irq_enable(); @@ -156,6 +156,7 @@ ret = action->handler(irq, action->dev_id, regs); if (ret == IRQ_HANDLED) status |= action->flags; + retval |= ret; action = action->next; } while (action); if (status & SA_SAMPLE_RANDOM) @@ -163,7 +164,7 @@ local_irq_disable(); - return status; + return retval; } /* diff -Nru a/arch/um/kernel/irq_user.c b/arch/um/kernel/irq_user.c --- a/arch/um/kernel/irq_user.c 2004-09-26 10:25:56 -07:00 +++ b/arch/um/kernel/irq_user.c 2004-09-26 10:25:56 -07:00 @@ -364,6 +364,20 @@ irq_unlock(flags); } +int deactivate_all_fds(void) +{ + struct irq_fd *irq; + int err; + + for(irq=active_fds;irq != NULL;irq = irq->next){ + err = os_clear_fd_async(irq->fd); + if(err) + return(err); + } + + return(0); +} + void forward_ipi(int fd, int pid) { int err; diff -Nru a/arch/um/kernel/main.c b/arch/um/kernel/main.c --- a/arch/um/kernel/main.c 2004-09-26 10:25:57 -07:00 +++ b/arch/um/kernel/main.c 2004-09-26 10:25:57 -07:00 @@ -147,7 +147,21 @@ /* Reboot */ if(ret){ + int err; + printf("\n"); + + /* Let any pending signals fire, then disable them. This + * ensures that they won't be delivered after the exec, when + * they are definitely not expected. + */ + unblock_signals(); + disable_timer(); + err = deactivate_all_fds(); + if(err) + printf("deactivate_all_fds failed, errno = %d\n", + -err); + execvp(new_argv[0], new_argv); perror("Failed to exec kernel"); ret = 1; @@ -206,14 +220,19 @@ * If kmalloc is not yet possible, then the kernel memory regions * may not be set up yet, and the variables not initialized. So, * free is called. + * + * CAN_KMALLOC is checked because it would be bad to free a buffer + * with kmalloc/vmalloc after they have been turned off during + * shutdown. */ - if(CAN_KMALLOC()){ - if((addr >= uml_physmem) && (addr <= high_physmem)) + + if((addr >= uml_physmem) && (addr < high_physmem)){ + if(CAN_KMALLOC()) kfree(ptr); - else if((addr >= start_vm) && (addr <= end_vm)) + } + else if((addr >= start_vm) && (addr < end_vm)){ + if(CAN_KMALLOC()) vfree(ptr); - else - __real_free(ptr); } else __real_free(ptr); } diff -Nru a/arch/um/kernel/mem_user.c b/arch/um/kernel/mem_user.c --- a/arch/um/kernel/mem_user.c 2004-09-26 10:25:56 -07:00 +++ b/arch/um/kernel/mem_user.c 2004-09-26 10:25:56 -07:00 @@ -143,7 +143,7 @@ struct iomem_region *new; struct uml_stat buf; char *file, *driver; - int fd, err; + int fd, err, size; driver = str; file = strchr(str,','); @@ -171,10 +171,12 @@ goto out_close; } + size = (buf.ust_size + UM_KERN_PAGE_SIZE) & ~(UM_KERN_PAGE_SIZE - 1); + *new = ((struct iomem_region) { .next = iomem_regions, .driver = driver, .fd = fd, - .size = buf.ust_size, + .size = size, .phys = 0, .virt = 0 }); iomem_regions = new; diff -Nru a/arch/um/kernel/mprot.h b/arch/um/kernel/mprot.h --- a/arch/um/kernel/mprot.h 2004-09-26 10:25:56 -07:00 +++ /dev/null Wed Dec 31 16:00:00 196900 @@ -1,6 +0,0 @@ -#ifndef __MPROT_H__ -#define __MPROT_H__ - -extern void no_access(unsigned long addr, unsigned int len); - -#endif diff -Nru a/arch/um/kernel/physmem.c b/arch/um/kernel/physmem.c --- a/arch/um/kernel/physmem.c 2004-09-26 10:25:56 -07:00 +++ b/arch/um/kernel/physmem.c 2004-09-26 10:25:56 -07:00 @@ -4,7 +4,7 @@ */ #include "linux/mm.h" -#include "linux/ghash.h" +#include "linux/rbtree.h" #include "linux/slab.h" #include "linux/vmalloc.h" #include "linux/bootmem.h" @@ -19,36 +19,8 @@ #include "kern.h" #include "init.h" -#if 0 -static pgd_t physmem_pgd[PTRS_PER_PGD]; - -static struct phys_desc *lookup_mapping(void *addr) -{ - pgd = &physmem_pgd[pgd_index(addr)]; - if(pgd_none(pgd)) - return(NULL); - - pmd = pmd_offset(pgd, addr); - if(pmd_none(pmd)) - return(NULL); - - pte = pte_offset_kernel(pmd, addr); - return((struct phys_desc *) pte_val(pte)); -} - -static struct add_mapping(void *addr, struct phys_desc *new) -{ -} -#endif - -#define PHYS_HASHSIZE (8192) - -struct phys_desc; - -DEF_HASH_STRUCTS(virtmem, PHYS_HASHSIZE, struct phys_desc); - struct phys_desc { - struct virtmem_ptrs virt_ptrs; + struct rb_node rb; int fd; __u64 offset; void *virt; @@ -56,21 +28,48 @@ struct list_head list; }; -struct virtmem_table virtmem_hash; +static struct rb_root phys_mappings = RB_ROOT; -static int virt_cmp(void *virt1, void *virt2) +static struct rb_node **find_rb(void *virt) { - return(virt1 != virt2); + struct rb_node **n = &phys_mappings.rb_node; + struct phys_desc *d; + + while(*n != NULL){ + d = rb_entry(n, struct phys_desc, rb); + if(d->virt == virt) + return(n); + + if(d->virt > virt) + n = &(*n)->rb_left; + else + n = &(*n)->rb_right; + } + + return(n); } -static int virt_hash(void *virt) +static struct phys_desc *find_phys_mapping(void *virt) { - unsigned long addr = ((unsigned long) virt) >> PAGE_SHIFT; - return(addr % PHYS_HASHSIZE); + struct rb_node **n = find_rb(virt); + + if(*n == NULL) + return(NULL); + + return(rb_entry(n, struct phys_desc, rb)); } -DEF_HASH(static, virtmem, struct phys_desc, virt_ptrs, void *, virt, virt_cmp, - virt_hash); +static void insert_phys_mapping(struct phys_desc *desc) +{ + struct rb_node **n = find_rb(desc->virt); + + if(*n != NULL) + panic("Physical remapping for %p already present", + desc->virt); + + rb_link_node(&desc->rb, (*n)->rb_parent, n); + rb_insert_color(&desc->rb, &phys_mappings); +} LIST_HEAD(descriptor_mappings); @@ -127,7 +126,8 @@ return(-ENOMEM); phys = __pa(virt); - if(find_virtmem_hash(&virtmem_hash, virt) != NULL) + desc = find_phys_mapping(virt); + if(desc != NULL) panic("Address 0x%p is already substituted\n", virt); err = -ENOMEM; @@ -136,13 +136,12 @@ goto out; *desc = ((struct phys_desc) - { .virt_ptrs = { NULL, NULL }, - .fd = fd, + { .fd = fd, .offset = offset, .virt = virt, .phys = __pa(virt), .list = LIST_HEAD_INIT(desc->list) }); - insert_virtmem_hash(&virtmem_hash, desc); + insert_phys_mapping(desc); list_add(&desc->list, &fd_maps->pages); @@ -151,7 +150,7 @@ if(!err) goto out; - remove_virtmem_hash(&virtmem_hash, desc); + rb_erase(&desc->rb, &phys_mappings); kfree(desc); out: return(err); @@ -164,7 +163,7 @@ void *virt = desc->virt; int err; - remove_virtmem_hash(&virtmem_hash, desc); + rb_erase(&desc->rb, &phys_mappings); list_del(&desc->list); kfree(desc); @@ -179,7 +178,7 @@ struct phys_desc *desc; virt = (void *) ((unsigned long) virt & PAGE_MASK); - desc = find_virtmem_hash(&virtmem_hash, virt); + desc = find_phys_mapping(virt); if(desc == NULL) return(0); @@ -234,7 +233,9 @@ int is_remapped(void *virt) { - return(find_virtmem_hash(&virtmem_hash, virt) != NULL); + struct phys_desc *desc = find_phys_mapping(virt); + + return(desc != NULL); } /* Changed during early boot */ @@ -335,9 +336,14 @@ fd = phys_mapping(phys, &offset); err = os_map_memory((void *) virt, fd, offset, len, r, w, x); - if(err) + if(err) { + if(err == -ENOMEM) + printk("try increasing the host's " + "/proc/sys/vm/max_map_count to /4096\n"); panic("map_memory(0x%lx, %d, 0x%llx, %ld, %d, %d, %d) failed, " "err = %d\n", virt, fd, offset, len, r, w, x, err); + } } #define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT) @@ -367,8 +373,7 @@ int phys_mapping(unsigned long phys, __u64 *offset_out) { - struct phys_desc *desc = find_virtmem_hash(&virtmem_hash, - __va(phys & PAGE_MASK)); + struct phys_desc *desc = find_phys_mapping(__va(phys & PAGE_MASK)); int fd = -1; if(desc != NULL){ diff -Nru a/arch/um/kernel/process.c b/arch/um/kernel/process.c --- a/arch/um/kernel/process.c 2004-09-26 10:25:57 -07:00 +++ b/arch/um/kernel/process.c 2004-09-26 10:25:57 -07:00 @@ -46,7 +46,7 @@ int flags = 0, pages; if(sig_stack != NULL){ - pages = (1 << UML_CONFIG_KERNEL_STACK_ORDER) - 2; + pages = (1 << UML_CONFIG_KERNEL_STACK_ORDER); set_sigstack(sig_stack, pages * page_size()); flags = SA_ONSTACK; } @@ -57,11 +57,7 @@ { int flags = altstack ? SA_ONSTACK : 0; - /* NODEFER is set here because SEGV isn't turned back on when the - * handler is ready to receive signals. This causes any segfault - * during a copy_user to kill the process because the fault is blocked. - */ - set_handler(SIGSEGV, (__sighandler_t) sig_handler, flags | SA_NODEFER, + set_handler(SIGSEGV, (__sighandler_t) sig_handler, flags, SIGUSR1, SIGIO, SIGWINCH, SIGALRM, SIGVTALRM, -1); set_handler(SIGTRAP, (__sighandler_t) sig_handler, flags, SIGUSR1, SIGIO, SIGWINCH, SIGALRM, SIGVTALRM, -1); @@ -74,7 +70,7 @@ set_handler(SIGWINCH, (__sighandler_t) sig_handler, flags, SIGUSR1, SIGIO, SIGWINCH, SIGALRM, SIGVTALRM, -1); set_handler(SIGUSR2, (__sighandler_t) sig_handler, - SA_NOMASK | flags, -1); + flags, SIGUSR1, SIGIO, SIGWINCH, SIGALRM, SIGVTALRM, -1); signal(SIGHUP, SIG_IGN); init_irq_signals(altstack); @@ -139,16 +135,6 @@ return(arg.pid); } -void suspend_new_thread(int fd) -{ - char c; - - os_stop_process(os_getpid()); - - if(os_read_file(fd, &c, sizeof(c)) != sizeof(c)) - panic("read failed in suspend_new_thread"); -} - static int ptrace_child(void *arg) { int pid = os_getpid(); @@ -297,7 +283,7 @@ int run_kernel_thread(int (*fn)(void *), void *arg, void **jmp_ptr) { - jmp_buf buf; + sigjmp_buf buf; int n; *jmp_ptr = &buf; diff -Nru a/arch/um/kernel/process_kern.c b/arch/um/kernel/process_kern.c --- a/arch/um/kernel/process_kern.c 2004-09-26 10:25:56 -07:00 +++ b/arch/um/kernel/process_kern.c 2004-09-26 10:25:56 -07:00 @@ -166,8 +166,6 @@ struct pt_regs *regs) { p->thread = (struct thread_struct) INIT_THREAD; - p->thread.kernel_stack = - (unsigned long) p->thread_info + 2 * PAGE_SIZE; return(CHOOSE_MODE_PROC(copy_thread_tt, copy_thread_skas, nr, clone_flags, sp, stack_top, p, regs)); } @@ -327,8 +325,7 @@ unsigned long stack; stack = sp & (PAGE_MASK << CONFIG_KERNEL_STACK_ORDER); - stack += 2 * PAGE_SIZE; - return(stack != current->thread.kernel_stack); + return(stack != (unsigned long) current_thread); } extern void remove_umid_dir(void); diff -Nru a/arch/um/kernel/sigio_kern.c b/arch/um/kernel/sigio_kern.c --- a/arch/um/kernel/sigio_kern.c 2004-09-26 10:25:55 -07:00 +++ b/arch/um/kernel/sigio_kern.c 2004-09-26 10:25:55 -07:00 @@ -16,7 +16,7 @@ /* Protected by sigio_lock() called from write_sigio_workaround */ static int sigio_irq_fd = -1; -irqreturn_t sigio_interrupt(int irq, void *data, struct pt_regs *unused) +static irqreturn_t sigio_interrupt(int irq, void *data, struct pt_regs *unused) { read_sigio_fd(sigio_irq_fd); reactivate_fd(sigio_irq_fd, SIGIO_WRITE_IRQ); @@ -25,10 +25,14 @@ int write_sigio_irq(int fd) { - if(um_request_irq(SIGIO_WRITE_IRQ, fd, IRQ_READ, sigio_interrupt, + int err; + + err = um_request_irq(SIGIO_WRITE_IRQ, fd, IRQ_READ, sigio_interrupt, SA_INTERRUPT | SA_SAMPLE_RANDOM, "write sigio", - NULL)){ - printk("write_sigio_irq : um_request_irq failed\n"); + NULL); + if(err){ + printk("write_sigio_irq : um_request_irq failed, err = %d\n", + err); return(-1); } sigio_irq_fd = fd; diff -Nru a/arch/um/kernel/sigio_user.c b/arch/um/kernel/sigio_user.c --- a/arch/um/kernel/sigio_user.c 2004-09-26 10:25:57 -07:00 +++ b/arch/um/kernel/sigio_user.c 2004-09-26 10:25:57 -07:00 @@ -68,7 +68,8 @@ return; } - err = __raw(master, 1, 0); //Not now, but complain so we now where we failed. + /* Not now, but complain so we now where we failed. */ + err = raw(master); if (err < 0) panic("check_sigio : __raw failed, errno = %d\n", -err); diff -Nru a/arch/um/kernel/signal_user.c b/arch/um/kernel/signal_user.c --- a/arch/um/kernel/signal_user.c 2004-09-26 10:25:57 -07:00 +++ b/arch/um/kernel/signal_user.c 2004-09-26 10:25:57 -07:00 @@ -80,6 +80,12 @@ change_signals(SIG_UNBLOCK); } +/* These are the asynchronous signals. SIGVTALRM and SIGARLM are handled + * together under SIGVTALRM_BIT. SIGPROF is excluded because we want to + * be able to profile all of UML, not just the non-critical sections. If + * profiling is not thread-safe, then that is not my problem. We can disable + * profiling when SMP is enabled in that case. + */ #define SIGIO_BIT 0 #define SIGVTALRM_BIT 1 @@ -114,6 +120,11 @@ sigaddset(&mask, SIGVTALRM); sigaddset(&mask, SIGALRM); } + + /* This is safe - sigprocmask is guaranteed to copy locally the + * value of new_set, do his work and then, at the end, write to + * old_set. + */ if(sigprocmask(SIG_UNBLOCK, &mask, &mask) < 0) panic("Failed to enable signals"); ret = enable_mask(&mask); diff -Nru a/arch/um/kernel/skas/process.c b/arch/um/kernel/skas/process.c --- a/arch/um/kernel/skas/process.c 2004-09-26 10:25:57 -07:00 +++ b/arch/um/kernel/skas/process.c 2004-09-26 10:25:57 -07:00 @@ -209,7 +209,7 @@ void (*handler)(int)) { unsigned long flags; - jmp_buf switch_buf, fork_buf; + sigjmp_buf switch_buf, fork_buf; *switch_buf_ptr = &switch_buf; *fork_buf_ptr = &fork_buf; @@ -233,7 +233,7 @@ void thread_wait(void *sw, void *fb) { - jmp_buf buf, **switch_buf = sw, *fork_buf; + sigjmp_buf buf, **switch_buf = sw, *fork_buf; *switch_buf = &buf; fork_buf = fb; @@ -295,23 +295,23 @@ void switch_threads(void *me, void *next) { - jmp_buf my_buf, **me_ptr = me, *next_buf = next; + sigjmp_buf my_buf, **me_ptr = me, *next_buf = next; *me_ptr = &my_buf; if(sigsetjmp(my_buf, 1) == 0) siglongjmp(*next_buf, 1); } -static jmp_buf initial_jmpbuf; +static sigjmp_buf initial_jmpbuf; /* XXX Make these percpu */ static void (*cb_proc)(void *arg); static void *cb_arg; -static jmp_buf *cb_back; +static sigjmp_buf *cb_back; int start_idle_thread(void *stack, void *switch_buf_ptr, void **fork_buf_ptr) { - jmp_buf **switch_buf = switch_buf_ptr; + sigjmp_buf **switch_buf = switch_buf_ptr; int n; *fork_buf_ptr = &initial_jmpbuf; @@ -347,7 +347,7 @@ void initial_thread_cb_skas(void (*proc)(void *), void *arg) { - jmp_buf here; + sigjmp_buf here; cb_proc = proc; cb_arg = arg; @@ -373,28 +373,6 @@ { block_signals(); siglongjmp(initial_jmpbuf, 4); -} - -int new_mm(int from) -{ - struct proc_mm_op copy; - int n, fd = os_open_file("/proc/mm", - of_cloexec(of_write(OPENFLAGS())), 0); - - if(fd < 0) - return(fd); - - if(from != -1){ - copy = ((struct proc_mm_op) { .op = MM_COPY_SEGMENTS, - .u = - { .copy_segments = from } } ); - n = os_write_file(fd, ©, sizeof(copy)); - if(n != sizeof(copy)) - printk("new_mm : /proc/mm copy_segments failed, " - "err = %d\n", -n); - } - - return(fd); } void switch_mm_skas(int mm_fd) diff -Nru a/arch/um/kernel/skas/process_kern.c b/arch/um/kernel/skas/process_kern.c --- a/arch/um/kernel/skas/process_kern.c 2004-09-26 10:25:58 -07:00 +++ b/arch/um/kernel/skas/process_kern.c 2004-09-26 10:25:58 -07:00 @@ -22,6 +22,7 @@ #include "frame.h" #include "kern.h" #include "mode.h" +#include "proc_mm.h" static atomic_t using_sysemu; int sysemu_supported; @@ -191,12 +192,33 @@ handler = new_thread_handler; } - new_thread((void *) p->thread.kernel_stack, - &p->thread.mode.skas.switch_buf, + new_thread(p->thread_info, &p->thread.mode.skas.switch_buf, &p->thread.mode.skas.fork_buf, handler); return(0); } +int new_mm(int from) +{ + struct proc_mm_op copy; + int n, fd; + + fd = os_open_file("/proc/mm", of_cloexec(of_write(OPENFLAGS())), 0); + if(fd < 0) + return(fd); + + if(from != -1){ + copy = ((struct proc_mm_op) { .op = MM_COPY_SEGMENTS, + .u = + { .copy_segments = from } } ); + n = os_write_file(fd, ©, sizeof(copy)); + if(n != sizeof(copy)) + printk("new_mm : /proc/mm copy_segments failed, " + "err = %d\n", -n); + } + + return(fd); +} + void init_idle_skas(void) { cpu_tasks[current_thread->cpu].pid = os_getpid(); @@ -225,13 +247,13 @@ { start_userspace(0); capture_signal_stack(); - uml_idle_timer(); init_new_thread_signals(1); + uml_idle_timer(); init_task.thread.request.u.thread.proc = start_kernel_proc; init_task.thread.request.u.thread.arg = NULL; - return(start_idle_thread((void *) init_task.thread.kernel_stack, + return(start_idle_thread(init_task.thread_info, &init_task.thread.mode.skas.switch_buf, &init_task.thread.mode.skas.fork_buf)); } diff -Nru a/arch/um/kernel/skas/tlb.c b/arch/um/kernel/skas/tlb.c --- a/arch/um/kernel/skas/tlb.c 2004-09-26 10:25:56 -07:00 +++ b/arch/um/kernel/skas/tlb.c 2004-09-26 10:25:56 -07:00 @@ -77,7 +77,7 @@ int updated = 0, err; mm = &init_mm; - for(addr = start_vm; addr < end_vm;){ + for(addr = start; addr < end;){ pgd = pgd_offset(mm, addr); pmd = pmd_offset(pgd, addr); if(pmd_present(*pmd)){ diff -Nru a/arch/um/kernel/skas/trap_user.c b/arch/um/kernel/skas/trap_user.c --- a/arch/um/kernel/skas/trap_user.c 2004-09-26 10:25:56 -07:00 +++ b/arch/um/kernel/skas/trap_user.c 2004-09-26 10:25:56 -07:00 @@ -19,8 +19,10 @@ struct skas_regs *r; struct signal_info *info; int save_errno = errno; + int save_user; r = &TASK_REGS(get_current())->skas; + save_user = r->is_user; r->is_user = 0; r->fault_addr = SC_FAULT_ADDR(sc); r->fault_type = SC_FAULT_TYPE(sc); @@ -33,6 +35,7 @@ (*info->handler)(sig, (union uml_pt_regs *) r); errno = save_errno; + r->is_user = save_user; } void user_signal(int sig, union uml_pt_regs *regs) diff -Nru a/arch/um/kernel/skas/uaccess.c b/arch/um/kernel/skas/uaccess.c --- a/arch/um/kernel/skas/uaccess.c 2004-09-26 10:25:57 -07:00 +++ b/arch/um/kernel/skas/uaccess.c 2004-09-26 10:25:57 -07:00 @@ -12,6 +12,7 @@ #include "asm/pgtable.h" #include "asm/uaccess.h" #include "kern_util.h" +#include "user_util.h" extern void *um_virt_to_phys(struct task_struct *task, unsigned long addr, pte_t *pte_out); @@ -51,37 +52,67 @@ return(n); } -static int buffer_op(unsigned long addr, int len, int is_write, - int (*op)(unsigned long addr, int len, void *arg), - void *arg) +static void do_buffer_op(void *jmpbuf, void *arg_ptr) { + va_list args = *((va_list *) arg_ptr); + unsigned long addr = va_arg(args, unsigned long); + int len = va_arg(args, int); + int is_write = va_arg(args, int); + int (*op)(unsigned long, int, void *) = va_arg(args, void *); + void *arg = va_arg(args, void *); + int *res = va_arg(args, int *); int size = min(PAGE_ALIGN(addr) - addr, (unsigned long) len); int remain = len, n; + current->thread.fault_catcher = jmpbuf; n = do_op(addr, size, is_write, op, arg); - if(n != 0) - return(n < 0 ? remain : 0); + if(n != 0){ + *res = (n < 0 ? remain : 0); + goto out; + } addr += size; remain -= size; - if(remain == 0) - return(0); + if(remain == 0){ + *res = 0; + goto out; + } while(addr < ((addr + remain) & PAGE_MASK)){ n = do_op(addr, PAGE_SIZE, is_write, op, arg); - if(n != 0) - return(n < 0 ? remain : 0); + if(n != 0){ + *res = (n < 0 ? remain : 0); + goto out; + } addr += PAGE_SIZE; remain -= PAGE_SIZE; } - if(remain == 0) - return(0); + if(remain == 0){ + *res = 0; + goto out; + } n = do_op(addr, remain, is_write, op, arg); if(n != 0) - return(n < 0 ? remain : 0); - return(0); + *res = (n < 0 ? remain : 0); + else *res = 0; + out: + current->thread.fault_catcher = NULL; +} + +static int buffer_op(unsigned long addr, int len, int is_write, + int (*op)(unsigned long addr, int len, void *arg), + void *arg) +{ + int faulted, res; + + faulted = setjmp_wrapper(do_buffer_op, addr, len, is_write, op, arg, + &res); + if(!faulted) + return(res); + + return(addr + len - (unsigned long) current->thread.fault_addr); } static int copy_chunk_from_user(unsigned long from, int len, void *arg) diff -Nru a/arch/um/kernel/smp.c b/arch/um/kernel/smp.c --- a/arch/um/kernel/smp.c 2004-09-26 10:25:55 -07:00 +++ b/arch/um/kernel/smp.c 2004-09-26 10:25:55 -07:00 @@ -29,9 +29,11 @@ #include "os.h" /* CPU online map, set by smp_boot_cpus */ -unsigned long cpu_online_map = CPU_MASK_NONE; +cpumask_t cpu_online_map = CPU_MASK_NONE; +cpumask_t cpu_possible_map = CPU_MASK_NONE; EXPORT_SYMBOL(cpu_online_map); +EXPORT_SYMBOL(cpu_possible_map); /* Per CPU bogomips and other parameters * The only piece used here is the ipi pipe, which is set before SMP is @@ -125,6 +127,10 @@ struct task_struct *idle; unsigned long waittime; int err, cpu, me = smp_processor_id(); + int i; + + for (i = 0; i < ncpus; ++i) + cpu_set(i, cpu_possible_map); cpu_clear(me, cpu_online_map); cpu_set(me, cpu_online_map); diff -Nru a/arch/um/kernel/syscall_kern.c b/arch/um/kernel/syscall_kern.c --- a/arch/um/kernel/syscall_kern.c 2004-09-26 10:25:57 -07:00 +++ b/arch/um/kernel/syscall_kern.c 2004-09-26 10:25:57 -07:00 @@ -44,17 +44,6 @@ return(ret); } -long sys_clone(unsigned long clone_flags, unsigned long newsp, - int *parent_tid, int *child_tid) -{ - long ret; - - current->thread.forking = 1; - ret = do_fork(clone_flags, newsp, NULL, 0, parent_tid, child_tid); - current->thread.forking = 0; - return(ret); -} - long sys_vfork(void) { long ret; diff -Nru a/arch/um/kernel/time.c b/arch/um/kernel/time.c --- a/arch/um/kernel/time.c 2004-09-26 10:25:55 -07:00 +++ b/arch/um/kernel/time.c 2004-09-26 10:25:55 -07:00 @@ -10,7 +10,6 @@ #include #include #include -#include #include "user_util.h" #include "kern_util.h" #include "user.h" @@ -54,6 +53,15 @@ errno); } +void disable_timer(void) +{ + struct itimerval disable = ((struct itimerval) { { 0, 0 }, { 0, 0 }}); + if((setitimer(ITIMER_VIRTUAL, &disable, NULL) < 0) || + (setitimer(ITIMER_REAL, &disable, NULL) < 0)) + printk("disnable_timer - setitimer failed, errno = %d\n", + errno); +} + void switch_timers(int to_real) { struct itimerval disable = ((struct itimerval) { { 0, 0 }, { 0, 0 }}); @@ -86,49 +94,12 @@ set_interval(ITIMER_REAL); } -static unsigned long long get_host_hz(void) -{ - char mhzline[16], *end; - unsigned long long mhz; - int ret, mult, rest, len; - - ret = cpu_feature("cpu MHz", mhzline, - sizeof(mhzline) / sizeof(mhzline[0])); - if(!ret) - panic ("Could not get host MHZ"); - - mhz = strtoul(mhzline, &end, 10); - - /* This business is to parse a floating point number without using - * floating types. - */ - - rest = 0; - mult = 0; - if(*end == '.'){ - end++; - len = strlen(end); - if(len < 6) - mult = 6 - len; - else if(len > 6) - end[6] = '\0'; - rest = strtoul(end, NULL, 10); - while(mult-- > 0) - rest *= 10; - } - - return(1000000 * mhz + rest); -} - -unsigned long long host_hz = 0; - extern int do_posix_clock_monotonic_gettime(struct timespec *tp); void time_init(void) { struct timespec now; - host_hz = get_host_hz(); if(signal(SIGVTALRM, boot_timer_handler) == SIG_ERR) panic("Couldn't set SIGVTALRM handler"); set_interval(ITIMER_VIRTUAL); diff -Nru a/arch/um/kernel/time_kern.c b/arch/um/kernel/time_kern.c --- a/arch/um/kernel/time_kern.c 2004-09-26 10:25:56 -07:00 +++ b/arch/um/kernel/time_kern.c 2004-09-26 10:25:56 -07:00 @@ -20,6 +20,7 @@ #include "user_util.h" #include "time_user.h" #include "mode.h" +#include "os.h" u64 jiffies_64; @@ -42,12 +43,10 @@ int timer_irq_inited = 0; static int first_tick; -static unsigned long long prev_tsc; -#ifdef CONFIG_UML_REAL_TIME_CLOCK +static unsigned long long prev_usecs; static long long delta; /* Deviation per interval */ -#endif -extern unsigned long long host_hz; +#define MILLION 1000000 void timer_irq(union uml_pt_regs *regs) { @@ -61,22 +60,25 @@ } if(first_tick){ -#ifdef CONFIG_UML_REAL_TIME_CLOCK - unsigned long long tsc; +#if defined(CONFIG_UML_REAL_TIME_CLOCK) /* We've had 1 tick */ - tsc = time_stamp(); + unsigned long long usecs = os_usecs(); + + delta += usecs - prev_usecs; + prev_usecs = usecs; - delta += tsc - prev_tsc; - prev_tsc = tsc; + /* Protect against the host clock being set backwards */ + if(delta < 0) + delta = 0; - ticks += (delta * HZ) / host_hz; - delta -= (ticks * host_hz) / HZ; + ticks += (delta * HZ) / MILLION; + delta -= (ticks * MILLION) / HZ; #else ticks = 1; #endif } else { - prev_tsc = time_stamp(); + prev_usecs = os_usecs(); first_tick = 1; } @@ -151,7 +153,7 @@ { int i, n; - n = (loops_per_jiffy * HZ * usecs) / 1000000; + n = (loops_per_jiffy * HZ * usecs) / MILLION; for(i=0;ithread.kernel_stack, - stack, 0, exec_tramp); + new_pid = start_fork_tramp(current->thread_info, stack, 0, exec_tramp); if(new_pid < 0){ printk(KERN_ERR "flush_thread : new thread failed, errno = %d\n", @@ -54,7 +54,9 @@ current->thread.request.u.exec.pid = new_pid; unprotect_stack((unsigned long) current_thread); os_usr1_process(os_getpid()); + change_sig(SIGUSR1, 1); + change_sig(SIGUSR1, 0); enable_timer(); free_page(stack); protect_memory(uml_reserved, high_physmem - uml_reserved, 1, 1, 0, 1); diff -Nru a/arch/um/kernel/tt/process_kern.c b/arch/um/kernel/tt/process_kern.c --- a/arch/um/kernel/tt/process_kern.c 2004-09-26 10:25:57 -07:00 +++ b/arch/um/kernel/tt/process_kern.c 2004-09-26 10:25:57 -07:00 @@ -28,7 +28,7 @@ void *switch_to_tt(void *prev, void *next, void *last) { - struct task_struct *from, *to; + struct task_struct *from, *to, *prev_sched; unsigned long flags; int err, vtalrm, alrm, prof, cpu; char c; @@ -72,6 +72,18 @@ if(err != sizeof(c)) panic("read of switch_pipe failed, errno = %d", -err); + /* If the process that we have just scheduled away from has exited, + * then it needs to be killed here. The reason is that, even though + * it will kill itself when it next runs, that may be too late. Its + * stack will be freed, possibly before then, and if that happens, + * we have a use-after-free situation. So, it gets killed here + * in case it has not already killed itself. + */ + prev_sched = current->thread.prev_sched; + if((prev_sched->state == TASK_ZOMBIE) || + (prev_sched->state == TASK_DEAD)) + os_kill_process(prev_sched->thread.mode.tt.extern_pid, 1); + /* This works around a nasty race with 'jail'. If we are switching * between two threads of a threaded app and the incoming process * runs before the outgoing process reaches the read, and it makes @@ -116,6 +128,17 @@ os_close_file(current->thread.mode.tt.switch_pipe[1]); } +void suspend_new_thread(int fd) +{ + int err; + char c; + + os_stop_process(os_getpid()); + err = os_read_file(fd, &c, sizeof(c)); + if(err != sizeof(c)) + panic("read failed in suspend_new_thread, err = %d", -err); +} + void schedule_tail(task_t *prev); static void new_thread_handler(int sig) @@ -150,6 +173,12 @@ local_irq_enable(); if(!run_kernel_thread(fn, arg, ¤t->thread.exec_buf)) do_exit(0); + + /* XXX No set_user_mode here because a newly execed process will + * immediately segfault on its non-existent IP, coming straight back + * to the signal handler, which will call set_user_mode on its way + * out. This should probably change since it's confusing. + */ } static int new_thread_proc(void *stack) @@ -172,6 +201,7 @@ local_irq_disable(); init_new_thread_stack(stack, new_thread_handler); os_usr1_process(os_getpid()); + change_sig(SIGUSR1, 1); return(0); } @@ -215,6 +245,7 @@ init_new_thread_stack(stack, finish_fork_handler); os_usr1_process(os_getpid()); + change_sig(SIGUSR1, 1); return(0); } @@ -248,8 +279,7 @@ clone_flags &= CLONE_VM; p->thread.temp_stack = stack; - new_pid = start_fork_tramp((void *) p->thread.kernel_stack, stack, - clone_flags, tramp); + new_pid = start_fork_tramp(p->thread_info, stack, clone_flags, tramp); if(new_pid < 0){ printk(KERN_ERR "copy_thread : clone failed - errno = %d\n", -new_pid); @@ -267,19 +297,30 @@ current->thread.request.op = OP_FORK; current->thread.request.u.fork.pid = new_pid; os_usr1_process(os_getpid()); - return(0); + + /* Enable the signal and then disable it to ensure that it is handled + * here, and nowhere else. + */ + change_sig(SIGUSR1, 1); + + change_sig(SIGUSR1, 0); + err = 0; + out: + return(err); } void reboot_tt(void) { current->thread.request.op = OP_REBOOT; os_usr1_process(os_getpid()); + change_sig(SIGUSR1, 1); } void halt_tt(void) { current->thread.request.op = OP_HALT; os_usr1_process(os_getpid()); + change_sig(SIGUSR1, 1); } void kill_off_processes_tt(void) @@ -306,6 +347,9 @@ current->thread.request.u.cb.proc = proc; current->thread.request.u.cb.arg = arg; os_usr1_process(os_getpid()); + change_sig(SIGUSR1, 1); + + change_sig(SIGUSR1, 0); } } @@ -412,7 +456,7 @@ protect_memory(start, end - start, 1, w, 1, 1); start = (unsigned long) UML_ROUND_DOWN(&__bss_start); - end = (unsigned long) UML_ROUND_UP(&_end); + end = (unsigned long) UML_ROUND_UP(brk_start); protect_memory(start, end - start, 1, w, 1, 1); mprotect_kernel_vm(w); @@ -501,9 +545,9 @@ void *sp; int pages; - pages = (1 << CONFIG_KERNEL_STACK_ORDER) - 2; - sp = (void *) init_task.thread.kernel_stack + pages * PAGE_SIZE - - sizeof(unsigned long); + pages = (1 << CONFIG_KERNEL_STACK_ORDER); + sp = (void *) ((unsigned long) init_task.thread_info) + + pages * PAGE_SIZE - sizeof(unsigned long); return(tracer(start_kernel_proc, sp)); } diff -Nru a/arch/um/kernel/tt/tracer.c b/arch/um/kernel/tt/tracer.c --- a/arch/um/kernel/tt/tracer.c 2004-09-26 10:25:55 -07:00 +++ b/arch/um/kernel/tt/tracer.c 2004-09-26 10:25:55 -07:00 @@ -330,7 +330,8 @@ continue; } tracing = 0; - if(do_syscall(task, pid)) sig = SIGUSR2; + if(do_syscall(task, pid)) + sig = SIGUSR2; else clear_singlestep(task); break; case SIGPROF: diff -Nru a/arch/um/kernel/tt/trap_user.c b/arch/um/kernel/tt/trap_user.c --- a/arch/um/kernel/tt/trap_user.c 2004-09-26 10:25:56 -07:00 +++ b/arch/um/kernel/tt/trap_user.c 2004-09-26 10:25:56 -07:00 @@ -23,6 +23,13 @@ unprotect_kernel_mem(); + /* This is done because to allow SIGSEGV to be delivered inside a SEGV + * handler. This can happen in copy_user, and if SEGV is disabled, + * the process will die. + */ + if(sig == SIGSEGV) + change_sig(SIGSEGV, 1); + r = &TASK_REGS(get_current())->tt; save_regs = *r; is_user = user_context(SC_SP(sc)); @@ -30,7 +37,6 @@ if(sig != SIGUSR2) r->syscall = -1; - change_sig(SIGUSR1, 1); info = &sig_info[sig]; if(!info->is_irq) unblock_signals(); @@ -39,7 +45,6 @@ if(is_user){ interrupt_end(); block_signals(); - change_sig(SIGUSR1, 0); set_user_mode(NULL); } *r = save_regs; diff -Nru a/arch/um/kernel/tt/uaccess_user.c b/arch/um/kernel/tt/uaccess_user.c --- a/arch/um/kernel/tt/uaccess_user.c 2004-09-26 10:25:56 -07:00 +++ b/arch/um/kernel/tt/uaccess_user.c 2004-09-26 10:25:56 -07:00 @@ -72,7 +72,7 @@ struct tt_regs save = TASK_REGS(get_current())->tt; int ret; unsigned long *faddrp = (unsigned long *)fault_addr; - jmp_buf jbuf; + sigjmp_buf jbuf; *fault_catcher = &jbuf; if(sigsetjmp(jbuf, 1) == 0) diff -Nru a/arch/um/kernel/uaccess_user.c b/arch/um/kernel/uaccess_user.c --- a/arch/um/kernel/uaccess_user.c 2004-09-26 10:25:57 -07:00 +++ b/arch/um/kernel/uaccess_user.c 2004-09-26 10:25:57 -07:00 @@ -18,7 +18,7 @@ { unsigned long *faddrp = (unsigned long *) fault_addr, ret; - jmp_buf jbuf; + sigjmp_buf jbuf; *fault_catcher = &jbuf; if(sigsetjmp(jbuf, 1) == 0){ (*op)(to, from, n); diff -Nru a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c --- a/arch/um/kernel/um_arch.c 2004-09-26 10:25:57 -07:00 +++ b/arch/um/kernel/um_arch.c 2004-09-26 10:25:57 -07:00 @@ -27,7 +27,6 @@ #include "user_util.h" #include "kern_util.h" #include "kern.h" -#include "mprot.h" #include "mem_user.h" #include "mem.h" #include "umid.h" @@ -306,7 +305,7 @@ int linux_main(int argc, char **argv) { - unsigned long avail; + unsigned long avail, diff; unsigned long virtmem_size, max_physmem; unsigned int i, add; @@ -324,6 +323,16 @@ brk_start = (unsigned long) sbrk(0); CHOOSE_MODE_PROC(before_mem_tt, before_mem_skas, brk_start); + /* Increase physical memory size for exec-shield users + so they actually get what they asked for. This should + add zero for non-exec shield users */ + + diff = UML_ROUND_UP(brk_start) - UML_ROUND_UP(&_end); + if(diff > 1024 * 1024){ + printf("Adding %ld bytes to physical memory to account for " + "exec-shield gap\n", diff); + physmem_size += UML_ROUND_UP(brk_start) - UML_ROUND_UP(&_end); + } uml_physmem = uml_start; @@ -379,9 +388,6 @@ virtmem_size); uml_postsetup(); - - init_task.thread.kernel_stack = (unsigned long) &init_thread_info + - 2 * PAGE_SIZE; task_protections((unsigned long) &init_thread_info); os_flush_stdout(); diff -Nru a/arch/um/kernel/umid.c b/arch/um/kernel/umid.c --- a/arch/um/kernel/umid.c 2004-09-26 10:25:57 -07:00 +++ b/arch/um/kernel/umid.c 2004-09-26 10:25:57 -07:00 @@ -43,7 +43,7 @@ } if(strlen(name) > UMID_LEN - 1) - (*printer)("Unique machine name is being truncated to %s " + (*printer)("Unique machine name is being truncated to %d " "characters\n", UMID_LEN); strlcpy(umid, name, sizeof(umid)); @@ -199,17 +199,20 @@ static int __init set_uml_dir(char *name, int *add) { if((strlen(name) > 0) && (name[strlen(name) - 1] != '/')){ - uml_dir = malloc(strlen(name) + 1); + uml_dir = malloc(strlen(name) + 2); if(uml_dir == NULL){ printf("Failed to malloc uml_dir - error = %d\n", errno); uml_dir = name; + /* Return 0 here because do_initcalls doesn't look at + * the return value. + */ return(0); } sprintf(uml_dir, "%s/", name); } else uml_dir = name; - return 0; + return(0); } static int __init make_uml_dir(void) diff -Nru a/arch/um/kernel/user_util.c b/arch/um/kernel/user_util.c --- a/arch/um/kernel/user_util.c 2004-09-26 10:25:55 -07:00 +++ b/arch/um/kernel/user_util.c 2004-09-26 10:25:55 -07:00 @@ -7,7 +7,8 @@ #include #include #include -#include +#include +#include #include #include #include @@ -88,11 +89,11 @@ errno); } else if(WIFEXITED(status)) - printk("process exited with status %d\n", - WEXITSTATUS(status)); + printk("process %d exited with status %d\n", + pid, WEXITSTATUS(status)); else if(WIFSIGNALED(status)) - printk("process exited with signal %d\n", - WTERMSIG(status)); + printk("process %d exited with signal %d\n", + pid, WTERMSIG(status)); else if((WSTOPSIG(status) == SIGVTALRM) || (WSTOPSIG(status) == SIGALRM) || (WSTOPSIG(status) == SIGIO) || @@ -108,8 +109,8 @@ ptrace(cont_type, pid, 0, WSTOPSIG(status)); continue; } - else printk("process stopped with signal %d\n", - WSTOPSIG(status)); + else printk("process %d stopped with signal %d\n", + pid, WSTOPSIG(status)); panic("wait_for_stop failed to wait for %d to stop " "with %d\n", pid, sig); } @@ -117,35 +118,26 @@ } } -int __raw(int fd, int complain, int now) +int raw(int fd) { struct termios tt; int err; - int when; CATCH_EINTR(err = tcgetattr(fd, &tt)); - if (err < 0) { - if (complain) printk("tcgetattr failed, errno = %d\n", errno); return(-errno); } cfmakeraw(&tt); - if (now) - when = TCSANOW; - else - when = TCSADRAIN; - - CATCH_EINTR(err = tcsetattr(fd, when, &tt)); - + CATCH_EINTR(err = tcsetattr(fd, TCSADRAIN, &tt)); if (err < 0) { - if (complain) printk("tcsetattr failed, errno = %d\n", errno); return(-errno); } - /*XXX: tcsetattr could have applied only some changes + + /* XXX tcsetattr could have applied only some changes * (and cfmakeraw() is a set of changes) */ return(0); } @@ -167,6 +159,21 @@ uname(&host); sprintf(host_info, "%s %s %s %s %s", host.sysname, host.nodename, host.release, host.version, host.machine); +} + +int setjmp_wrapper(void (*proc)(void *, void *), ...) +{ + va_list args; + sigjmp_buf buf; + int n; + + n = sigsetjmp(buf, 1); + if(n == 0){ + va_start(args, proc); + (*proc)(&buf, &args); + } + va_end(args); + return(n); } /* diff -Nru a/arch/um/os-Linux/Makefile b/arch/um/os-Linux/Makefile --- a/arch/um/os-Linux/Makefile 2004-09-26 10:25:56 -07:00 +++ b/arch/um/os-Linux/Makefile 2004-09-26 10:25:56 -07:00 @@ -3,9 +3,9 @@ # Licensed under the GPL # -obj-y = file.o process.o tty.o user_syms.o drivers/ +obj-y = file.o process.o time.o tty.o user_syms.o drivers/ -USER_OBJS := $(foreach file,file.o process.o tty.o,$(obj)/$(file)) +USER_OBJS := $(foreach file,file.o process.o time.o tty.o,$(obj)/$(file)) $(USER_OBJS) : %.o: %.c $(CC) $(CFLAGS_$(notdir $@)) $(USER_CFLAGS) -c -o $@ $< diff -Nru a/arch/um/os-Linux/file.c b/arch/um/os-Linux/file.c --- a/arch/um/os-Linux/file.c 2004-09-26 10:25:57 -07:00 +++ b/arch/um/os-Linux/file.c 2004-09-26 10:25:57 -07:00 @@ -187,7 +187,8 @@ if((fcntl(master, F_SETFL, flags | O_NONBLOCK | O_ASYNC) < 0) || (fcntl(master, F_SETOWN, os_getpid()) < 0)){ - printk("fcntl F_SETFL or F_SETOWN failed, errno = %d\n", errno); + printk("fcntl F_SETFL or F_SETOWN failed, errno = %d\n", + errno); return(-errno); } @@ -492,6 +493,16 @@ return(-errno); } + return(0); +} + +int os_clear_fd_async(int fd) +{ + int flags = fcntl(fd, F_GETFL); + + flags &= ~(O_ASYNC | O_NONBLOCK); + if(fcntl(fd, F_SETFL, flags) < 0) + return(-errno); return(0); } diff -Nru a/arch/um/os-Linux/process.c b/arch/um/os-Linux/process.c --- a/arch/um/os-Linux/process.c 2004-09-26 10:25:55 -07:00 +++ b/arch/um/os-Linux/process.c 2004-09-26 10:25:55 -07:00 @@ -42,9 +42,9 @@ } os_close_file(fd); pc = ARBITRARY_ADDR; - if(sscanf(buf, "%*d " COMM_SCANF " %*c %*d %*d %*d %*d %*d %*d %*d %*d " + if(sscanf(buf, "%*d " COMM_SCANF " %*c %*d %*d %*d %*d %*d %*d %*d " "%*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d " - "%*d %*d %*d %*d %lu", &pc) != 1){ + "%*d %*d %*d %*d %*d %lu", &pc) != 1){ printk("os_process_pc - couldn't find pc in '%s'\n", buf); } return(pc); @@ -96,11 +96,7 @@ void os_usr1_process(int pid) { -#ifdef __NR_tkill - syscall(__NR_tkill, pid, SIGUSR1); -#else kill(pid, SIGUSR1); -#endif } int os_getpid(void) diff -Nru a/arch/um/os-Linux/time.c b/arch/um/os-Linux/time.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/um/os-Linux/time.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,21 @@ +#include +#include + +unsigned long long os_usecs(void) +{ + struct timeval tv; + + gettimeofday(&tv, NULL); + return((unsigned long long) tv.tv_sec * 1000000 + tv.tv_usec); +} + +/* + * Overrides for Emacs so that we follow Linus's tabbing style. + * Emacs will notice this stuff at the end of the file and automatically + * adjust the settings for this buffer only. This must remain at the end + * of the file. + * --------------------------------------------------------------------------- + * Local variables: + * c-file-style: "linux" + * End: + */ diff -Nru a/arch/um/os-Linux/user_syms.c b/arch/um/os-Linux/user_syms.c --- a/arch/um/os-Linux/user_syms.c 2004-09-26 10:25:57 -07:00 +++ b/arch/um/os-Linux/user_syms.c 2004-09-26 10:25:57 -07:00 @@ -14,11 +14,13 @@ extern size_t strlen(const char *); extern void *memcpy(void *, const void *, size_t); +extern void *memmove(void *, const void *, size_t); extern void *memset(void *, int, size_t); extern int printf(const char *, ...); EXPORT_SYMBOL(strlen); EXPORT_SYMBOL(memcpy); +EXPORT_SYMBOL(memmove); EXPORT_SYMBOL(memset); EXPORT_SYMBOL(printf); diff -Nru a/arch/um/sys-i386/Makefile b/arch/um/sys-i386/Makefile --- a/arch/um/sys-i386/Makefile 2004-09-26 10:25:55 -07:00 +++ b/arch/um/sys-i386/Makefile 2004-09-26 10:25:55 -07:00 @@ -1,5 +1,5 @@ obj-y = bitops.o bugs.o checksum.o fault.o ksyms.o ldt.o ptrace.o \ - ptrace_user.o semaphore.o sigcontext.o syscalls.o sysrq.o time.o + ptrace_user.o semaphore.o sigcontext.o syscalls.o sysrq.o obj-$(CONFIG_HIGHMEM) += highmem.o obj-$(CONFIG_MODULES) += module.o diff -Nru a/arch/um/sys-i386/bugs.c b/arch/um/sys-i386/bugs.c --- a/arch/um/sys-i386/bugs.c 2004-09-26 10:25:58 -07:00 +++ b/arch/um/sys-i386/bugs.c 2004-09-26 10:25:58 -07:00 @@ -183,15 +183,16 @@ int arch_handle_signal(int sig, union uml_pt_regs *regs) { - unsigned long ip; + unsigned char tmp[2]; /* This is testing for a cmov (0x0f 0x4x) instruction causing a * SIGILL in init. */ if((sig != SIGILL) || (TASK_PID(get_current()) != 1)) return(0); - ip = UPT_IP(regs); - if((*((char *) ip) != 0x0f) || ((*((char *) (ip + 1)) & 0xf0) != 0x40)) + if (copy_from_user_proc(tmp, (void *) UPT_IP(regs), 2)) + panic("SIGILL in init, could not read instructions!\n"); + if((tmp[0] != 0x0f) || ((tmp[1] & 0xf0) != 0x40)) return(0); if(host_has_cmov == 0) diff -Nru a/arch/um/sys-i386/ldt.c b/arch/um/sys-i386/ldt.c --- a/arch/um/sys-i386/ldt.c 2004-09-26 10:25:56 -07:00 +++ b/arch/um/sys-i386/ldt.c 2004-09-26 10:25:56 -07:00 @@ -13,6 +13,8 @@ #ifdef CONFIG_MODE_TT extern int modify_ldt(int func, void *ptr, unsigned long bytecount); +/* XXX this needs copy_to_user and copy_from_user */ + int sys_modify_ldt_tt(int func, void *ptr, unsigned long bytecount) { if(verify_area(VERIFY_READ, ptr, bytecount)) return(-EFAULT); diff -Nru a/arch/um/sys-i386/ptrace_user.c b/arch/um/sys-i386/ptrace_user.c --- a/arch/um/sys-i386/ptrace_user.c 2004-09-26 10:25:58 -07:00 +++ b/arch/um/sys-i386/ptrace_user.c 2004-09-26 10:25:58 -07:00 @@ -42,7 +42,8 @@ if(ptrace(PTRACE_POKEUSER, pid, &dummy->u_debugreg[i], regs[i]) < 0) printk("write_debugregs - ptrace failed on " - "register %d, errno = %d\n", errno); + "register %d, value = 0x%x, errno = %d\n", i, + regs[i], errno); } } diff -Nru a/arch/um/sys-i386/syscalls.c b/arch/um/sys-i386/syscalls.c --- a/arch/um/sys-i386/syscalls.c 2004-09-26 10:25:56 -07:00 +++ b/arch/um/sys-i386/syscalls.c 2004-09-26 10:25:56 -07:00 @@ -3,6 +3,7 @@ * Licensed under the GPL */ +#include "linux/sched.h" #include "asm/mman.h" #include "asm/uaccess.h" #include "asm/unistd.h" @@ -54,6 +55,27 @@ return -EFAULT; /* sys_select() does the appropriate kernel locking */ return sys_select(a.n, a.inp, a.outp, a.exp, a.tvp); +} + +/* The i386 version skips reading from %esi, the fourth argument. So we must do + * this, too. + */ +int sys_clone(unsigned long clone_flags, unsigned long newsp, int *parent_tid, + int unused, int *child_tid) +{ + long ret; + + /* XXX: normal arch do here this pass, and also pass the regs to + * do_fork, instead of NULL. Currently the arch-independent code + * ignores these values, while the UML code (actually it's + * copy_thread) does the right thing. But this should change, + probably. */ + /*if (!newsp) + newsp = UPT_SP(current->thread.regs);*/ + current->thread.forking = 1; + ret = do_fork(clone_flags, newsp, NULL, 0, parent_tid, child_tid); + current->thread.forking = 0; + return(ret); } /* diff -Nru a/arch/um/sys-i386/time.c b/arch/um/sys-i386/time.c --- a/arch/um/sys-i386/time.c 2004-09-26 10:25:56 -07:00 +++ /dev/null Wed Dec 31 16:00:00 196900 @@ -1,24 +0,0 @@ -/* - * sys-i386/time.c - * Created 25.9.2002 Sapan Bhatia - * - */ - -unsigned long long time_stamp(void) -{ - unsigned long low, high; - - asm("rdtsc" : "=a" (low), "=d" (high)); - return((((unsigned long long) high) << 32) + low); -} - -/* - * Overrides for Emacs so that we follow Linus's tabbing style. - * Emacs will notice this stuff at the end of the file and automatically - * adjust the settings for this buffer only. This must remain at the end - * of the file. - * --------------------------------------------------------------------------- - * Local variables: - * c-file-style: "linux" - * End: - */ diff -Nru a/arch/x86_64/Kconfig b/arch/x86_64/Kconfig --- a/arch/x86_64/Kconfig 2004-09-26 10:25:57 -07:00 +++ b/arch/x86_64/Kconfig 2004-09-26 10:25:57 -07:00 @@ -78,6 +78,10 @@ bool default y +config GENERIC_IOMAP + bool + default y + source "init/Kconfig" @@ -315,8 +319,13 @@ are doing. config X86_MCE - bool + bool "Machine check support" if EMBEDDED default y + help + Include a machine check error handler to report hardware errors. + This version will require the mcelog utility to decode some + machine check error logs. See + ftp://ftp.x86-64.org/pub/linux/tools/mcelog endmenu diff -Nru a/arch/x86_64/boot/video.S b/arch/x86_64/boot/video.S --- a/arch/x86_64/boot/video.S 2004-09-26 10:25:56 -07:00 +++ b/arch/x86_64/boot/video.S 2004-09-26 10:25:56 -07:00 @@ -66,6 +66,7 @@ #define VIDEO_80x30 0x0f05 #define VIDEO_80x34 0x0f06 #define VIDEO_80x60 0x0f07 +#define VIDEO_GFX_HACK 0x0f08 #define VIDEO_LAST_SPECIAL 0x0f09 /* Video modes given by resolution */ @@ -97,7 +98,6 @@ #define PARAM_LFB_PAGES 0x32 #define PARAM_VESA_ATTRIB 0x34 - /* Define DO_STORE according to CONFIG_VIDEO_RETAIN */ #ifdef CONFIG_VIDEO_RETAIN #define DO_STORE call store_screen @@ -133,6 +133,7 @@ #ifdef CONFIG_VIDEO_RETAIN call restore_screen # Restore screen contents #endif /* CONFIG_VIDEO_RETAIN */ + call store_edid #endif /* CONFIG_VIDEO_SELECT */ call mode_params # Store mode parameters popw %ds # Restore original DS @@ -231,6 +232,41 @@ xorl %eax, %eax movw 18(%di), %ax movl %eax, %fs:(PARAM_LFB_SIZE) + +# switching the DAC to 8-bit is for <= 8 bpp only + movw %fs:(PARAM_LFB_DEPTH), %ax + cmpw $8, %ax + jg dac_done + +# get DAC switching capability + xorl %eax, %eax + movb 10(%di), %al + testb $1, %al + jz dac_set + +# attempt to switch DAC to 8-bit + movw $0x4f08, %ax + movw $0x0800, %bx + int $0x10 + cmpw $0x004f, %ax + jne dac_set + movb %bh, dac_size # store actual DAC size + +dac_set: +# set color size to DAC size + movb dac_size, %al + movb %al, %fs:(PARAM_LFB_COLORS+0) + movb %al, %fs:(PARAM_LFB_COLORS+2) + movb %al, %fs:(PARAM_LFB_COLORS+4) + movb %al, %fs:(PARAM_LFB_COLORS+6) + +# set color offsets to 0 + movb $0, %fs:(PARAM_LFB_COLORS+1) + movb $0, %fs:(PARAM_LFB_COLORS+3) + movb $0, %fs:(PARAM_LFB_COLORS+5) + movb $0, %fs:(PARAM_LFB_COLORS+7) + +dac_done: # get protected mode interface informations movw $0x4f0a, %ax xorw %bx, %bx @@ -440,7 +476,7 @@ # Setting of user mode (AX=mode ID) => CF=success mode_set: - movw %ax, %fs:(0x01fa) + movw %ax, %fs:(0x01fa) # Store mode for use in acpi_wakeup.S movw %ax, %bx cmpb $0xff, %ah jz setalias @@ -744,7 +780,15 @@ movw $0x503c, force_size jmp setvde +# Special hack for ThinkPad graphics set_gfx: +#ifdef CONFIG_VIDEO_GFX_HACK + movw $VIDEO_GFX_BIOS_AX, %ax + movw $VIDEO_GFX_BIOS_BX, %bx + int $0x10 + movw $VIDEO_GFX_DUMMY_RESOLUTION, force_size + stc +#endif ret #ifdef CONFIG_VIDEO_RETAIN @@ -969,6 +1013,10 @@ .word 0x5022 # 80x34 .word VIDEO_80x60 .word 0x503c # 80x60 +#ifdef CONFIG_VIDEO_GFX_HACK + .word VIDEO_GFX_HACK + .word VIDEO_GFX_DUMMY_RESOLUTION +#endif vga_modes_end: # Detect VESA modes. @@ -1875,6 +1923,39 @@ popw %ax ret +store_edid: + pushw %es # just save all registers + pushw %ax + pushw %bx + pushw %cx + pushw %dx + pushw %di + + pushw %fs + popw %es + + movl $0x13131313, %eax # memset block with 0x13 + movw $32, %cx + movw $0x440, %di + cld + rep + stosl + + movw $0x4f15, %ax # do VBE/DDC + movw $0x01, %bx + movw $0x00, %cx + movw $0x01, %dx + movw $0x440, %di + int $0x10 + + popw %di # restore all registers + popw %dx + popw %cx + popw %bx + popw %ax + popw %es + ret + # VIDEO_SELECT-only variables mt_end: .word 0 # End of video mode table if built edit_buf: .space 6 # Line editor buffer @@ -1883,6 +1964,7 @@ do_restore: .byte 0 # Screen contents altered during mode change svga_prefix: .byte VIDEO_FIRST_BIOS>>8 # Default prefix for BIOS modes graphic_mode: .byte 0 # Graphic mode with a linear frame buffer +dac_size: .byte 6 # DAC bit depth # Status messages keymsg: .ascii "Press to see video modes available, " diff -Nru a/arch/x86_64/defconfig b/arch/x86_64/defconfig --- a/arch/x86_64/defconfig 2004-09-26 10:25:56 -07:00 +++ b/arch/x86_64/defconfig 2004-09-26 10:25:56 -07:00 @@ -1,5 +1,7 @@ # # Automatically generated make config: don't edit +# Linux kernel version: 2.6.9-rc1-bk19 +# Sun Sep 12 23:13:23 2004 # CONFIG_X86_64=y CONFIG_64BIT=y @@ -21,6 +23,7 @@ # # General setup # +CONFIG_LOCALVERSION="" CONFIG_SWAP=y CONFIG_SYSVIPC=y CONFIG_POSIX_MQUEUE=y @@ -28,13 +31,13 @@ CONFIG_SYSCTL=y # CONFIG_AUDIT is not set CONFIG_LOG_BUF_SHIFT=18 -CONFIG_HOTPLUG=y +# CONFIG_HOTPLUG is not set CONFIG_IKCONFIG=y CONFIG_IKCONFIG_PROC=y # CONFIG_EMBEDDED is not set CONFIG_KALLSYMS=y CONFIG_KALLSYMS_ALL=y -CONFIG_KALLSYMS_EXTRA_PASS=y +# CONFIG_KALLSYMS_EXTRA_PASS is not set CONFIG_FUTEX=y CONFIG_EPOLL=y CONFIG_IOSCHED_NOOP=y @@ -42,6 +45,8 @@ CONFIG_IOSCHED_DEADLINE=y CONFIG_IOSCHED_CFQ=y # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set +CONFIG_SHMEM=y +# CONFIG_TINY_SHMEM is not set # # Loadable module support @@ -104,8 +109,8 @@ CONFIG_ACPI_PROCESSOR=y CONFIG_ACPI_THERMAL=y # CONFIG_ACPI_ASUS is not set -# CONFIG_ACPI_TOSHIBA is not set -# CONFIG_ACPI_DEBUG is not set +CONFIG_ACPI_TOSHIBA=y +CONFIG_ACPI_DEBUG=y CONFIG_ACPI_BUS=y CONFIG_ACPI_EC=y CONFIG_ACPI_POWER=y @@ -115,23 +120,7 @@ # # CPU Frequency scaling # -CONFIG_CPU_FREQ=y -CONFIG_CPU_FREQ_PROC_INTF=y -CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y -# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set -CONFIG_CPU_FREQ_GOV_PERFORMANCE=y -CONFIG_CPU_FREQ_GOV_POWERSAVE=y -CONFIG_CPU_FREQ_GOV_USERSPACE=y -# CONFIG_CPU_FREQ_24_API is not set -CONFIG_CPU_FREQ_TABLE=y - -# -# CPUFreq processor drivers -# -CONFIG_X86_POWERNOW_K8=y -# CONFIG_X86_SPEEDSTEP_CENTRINO is not set -CONFIG_X86_ACPI_CPUFREQ=y -CONFIG_X86_ACPI_CPUFREQ_PROC_INTF=y +# CONFIG_CPU_FREQ is not set # # Bus options (PCI etc.) @@ -145,21 +134,6 @@ # CONFIG_PCI_NAMES is not set # -# PCMCIA/CardBus support -# -# CONFIG_PCMCIA is not set - -# -# PCI Hotplug Support -# -CONFIG_HOTPLUG_PCI=y -# CONFIG_HOTPLUG_PCI_FAKE is not set -# CONFIG_HOTPLUG_PCI_ACPI is not set -# CONFIG_HOTPLUG_PCI_CPCI is not set -# CONFIG_HOTPLUG_PCI_PCIE is not set -# CONFIG_HOTPLUG_PCI_SHPC is not set - -# # Executable file formats / Emulations # CONFIG_BINFMT_ELF=y @@ -179,7 +153,6 @@ # CONFIG_STANDALONE=y CONFIG_PREVENT_FIRMWARE_BUILD=y -# CONFIG_FW_LOADER is not set # CONFIG_DEBUG_DRIVER is not set # @@ -208,6 +181,7 @@ # CONFIG_BLK_DEV_CRYPTOLOOP is not set # CONFIG_BLK_DEV_NBD is not set # CONFIG_BLK_DEV_SX8 is not set +# CONFIG_BLK_DEV_UB is not set CONFIG_BLK_DEV_RAM=y CONFIG_BLK_DEV_RAM_SIZE=4096 CONFIG_BLK_DEV_INITRD=y @@ -270,7 +244,7 @@ # CONFIG_BLK_DEV_SIS5513 is not set # CONFIG_BLK_DEV_SLC90E66 is not set # CONFIG_BLK_DEV_TRM290 is not set -CONFIG_BLK_DEV_VIA82CXXX=y +# CONFIG_BLK_DEV_VIA82CXXX is not set # CONFIG_IDE_ARM is not set CONFIG_BLK_DEV_IDEDMA=y # CONFIG_IDEDMA_IVB is not set @@ -316,13 +290,13 @@ # CONFIG_SCSI_AIC7XXX_OLD is not set CONFIG_SCSI_AIC79XX=y CONFIG_AIC79XX_CMDS_PER_DEVICE=32 -CONFIG_AIC79XX_RESET_DELAY_MS=2000 -# CONFIG_AIC79XX_BUILD_FIRMWARE is not set +CONFIG_AIC79XX_RESET_DELAY_MS=4000 # CONFIG_AIC79XX_ENABLE_RD_STRM is not set # CONFIG_AIC79XX_DEBUG_ENABLE is not set CONFIG_AIC79XX_DEBUG_MASK=0 -CONFIG_AIC79XX_REG_PRETTY_PRINT=y -# CONFIG_SCSI_MEGARAID is not set +# CONFIG_AIC79XX_REG_PRETTY_PRINT is not set +# CONFIG_MEGARAID_NEWGEN is not set +# CONFIG_MEGARAID_LEGACY is not set CONFIG_SCSI_SATA=y # CONFIG_SCSI_SATA_SVW is not set CONFIG_SCSI_ATA_PIIX=y @@ -367,7 +341,6 @@ # CONFIG_FUSION=y CONFIG_FUSION_MAX_SGE=40 -# CONFIG_FUSION_ISENSE is not set # CONFIG_FUSION_CTL is not set # @@ -405,11 +378,13 @@ # CONFIG_INET_AH is not set # CONFIG_INET_ESP is not set # CONFIG_INET_IPCOMP is not set +# CONFIG_INET_TUNNEL is not set CONFIG_IPV6=y # CONFIG_IPV6_PRIVACY is not set # CONFIG_INET6_AH is not set # CONFIG_INET6_ESP is not set # CONFIG_INET6_IPCOMP is not set +# CONFIG_INET6_TUNNEL is not set # CONFIG_IPV6_TUNNEL is not set # CONFIG_NETFILTER is not set @@ -475,7 +450,8 @@ # CONFIG_HP100 is not set CONFIG_NET_PCI=y # CONFIG_PCNET32 is not set -# CONFIG_AMD8111_ETH is not set +CONFIG_AMD8111_ETH=y +# CONFIG_AMD8111E_NAPI is not set # CONFIG_ADAPTEC_STARFIRE is not set # CONFIG_B44 is not set CONFIG_FORCEDETH=y @@ -485,8 +461,12 @@ # CONFIG_FEALNX is not set # CONFIG_NATSEMI is not set # CONFIG_NE2K_PCI is not set -# CONFIG_8139CP is not set -# CONFIG_8139TOO is not set +CONFIG_8139CP=m +CONFIG_8139TOO=m +# CONFIG_8139TOO_PIO is not set +# CONFIG_8139TOO_TUNE_TWISTER is not set +# CONFIG_8139TOO_8129 is not set +# CONFIG_8139_OLD_RX_RESET is not set # CONFIG_SIS900 is not set # CONFIG_EPIC100 is not set # CONFIG_SUNDANCE is not set @@ -615,7 +595,6 @@ CONFIG_UNIX98_PTYS=y CONFIG_LEGACY_PTYS=y CONFIG_LEGACY_PTY_COUNT=256 -# CONFIG_QIC02_TAPE is not set # # IPMI @@ -683,7 +662,6 @@ # Console display driver support # CONFIG_VGA_CONSOLE=y -# CONFIG_MDA_CONSOLE is not set CONFIG_DUMMY_CONSOLE=y # @@ -734,6 +712,8 @@ CONFIG_USB_DEVICEFS=y # CONFIG_USB_BANDWIDTH is not set # CONFIG_USB_DYNAMIC_MINORS is not set +# CONFIG_USB_SUSPEND is not set +# CONFIG_USB_OTG is not set # # USB Host Controller Drivers @@ -751,8 +731,18 @@ # CONFIG_USB_BLUETOOTH_TTY is not set # CONFIG_USB_MIDI is not set # CONFIG_USB_ACM is not set -# CONFIG_USB_PRINTER is not set -# CONFIG_USB_STORAGE is not set +CONFIG_USB_PRINTER=y +CONFIG_USB_STORAGE=y +# CONFIG_USB_STORAGE_DEBUG is not set +# CONFIG_USB_STORAGE_RW_DETECT is not set +# CONFIG_USB_STORAGE_DATAFAB is not set +# CONFIG_USB_STORAGE_FREECOM is not set +# CONFIG_USB_STORAGE_ISD200 is not set +# CONFIG_USB_STORAGE_DPCM is not set +# CONFIG_USB_STORAGE_HP8200e is not set +# CONFIG_USB_STORAGE_SDDR09 is not set +# CONFIG_USB_STORAGE_SDDR55 is not set +# CONFIG_USB_STORAGE_JUMPSHOT is not set # # USB Human Interface Devices (HID) @@ -896,7 +886,6 @@ # CONFIG_BEFS_FS is not set # CONFIG_BFS_FS is not set # CONFIG_EFS_FS is not set -# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set # CONFIG_CRAMFS is not set # CONFIG_VXFS_FS is not set # CONFIG_HPFS_FS is not set @@ -920,6 +909,7 @@ CONFIG_EXPORTFS=y CONFIG_SUNRPC=y # CONFIG_RPCSEC_GSS_KRB5 is not set +# CONFIG_RPCSEC_GSS_SPKM3 is not set # CONFIG_SMB_FS is not set # CONFIG_CIFS is not set # CONFIG_NCP_FS is not set @@ -947,14 +937,15 @@ # Kernel hacking # CONFIG_DEBUG_KERNEL=y -# CONFIG_DEBUG_SLAB is not set CONFIG_MAGIC_SYSRQ=y +# CONFIG_DEBUG_SLAB is not set # CONFIG_DEBUG_SPINLOCK is not set -CONFIG_INIT_DEBUG=y +# CONFIG_DEBUG_SPINLOCK_SLEEP is not set # CONFIG_DEBUG_INFO is not set # CONFIG_FRAME_POINTER is not set -CONFIG_IOMMU_DEBUG=y -# CONFIG_IOMMU_LEAK is not set +# CONFIG_INIT_DEBUG is not set +# CONFIG_SCHEDSTATS is not set +# CONFIG_IOMMU_DEBUG is not set # # Security options diff -Nru a/arch/x86_64/ia32/ia32_signal.c b/arch/x86_64/ia32/ia32_signal.c --- a/arch/x86_64/ia32/ia32_signal.c 2004-09-26 10:25:57 -07:00 +++ b/arch/x86_64/ia32/ia32_signal.c 2004-09-26 10:25:57 -07:00 @@ -74,8 +74,6 @@ err |= __put_user(from->si_utime, &to->si_utime); err |= __put_user(from->si_stime, &to->si_stime); err |= __put_user(from->si_status, &to->si_status); - err |= put_compat_rusage(&from->si_rusage, - &to->si_rusage); default: case __SI_KILL >> 16: err |= __put_user(from->si_uid, &to->si_uid); diff -Nru a/arch/x86_64/ia32/sys_ia32.c b/arch/x86_64/ia32/sys_ia32.c --- a/arch/x86_64/ia32/sys_ia32.c 2004-09-26 10:25:56 -07:00 +++ b/arch/x86_64/ia32/sys_ia32.c 2004-09-26 10:25:56 -07:00 @@ -1152,19 +1152,26 @@ } asmlinkage long sys32_waitid(int which, compat_pid_t pid, - siginfo_t32 __user *uinfo, int options) + siginfo_t32 __user *uinfo, int options, + struct compat_rusage __user *uru) { siginfo_t info; + struct rusage ru; long ret; mm_segment_t old_fs = get_fs(); info.si_signo = 0; set_fs (KERNEL_DS); - ret = sys_waitid(which, pid, (siginfo_t __user *) &info, options); + ret = sys_waitid(which, pid, (siginfo_t __user *) &info, options, + uru ? &ru : NULL); set_fs (old_fs); if (ret < 0 || info.si_signo == 0) return ret; + + if (uru && (ret = put_compat_rusage(&ru, uru))) + return ret; + BUG_ON(info.si_code & __SI_MASK); info.si_code |= __SI_CHLD; return ia32_copy_siginfo_to_user(uinfo, &info); diff -Nru a/arch/x86_64/kernel/apic.c b/arch/x86_64/kernel/apic.c --- a/arch/x86_64/kernel/apic.c 2004-09-26 10:25:55 -07:00 +++ b/arch/x86_64/kernel/apic.c 2004-09-26 10:25:55 -07:00 @@ -33,6 +33,8 @@ #include #include +int apic_verbosity; + int disable_apic_timer __initdata; /* Using APIC to generate smp_local_timer_interrupt? */ @@ -123,7 +125,7 @@ * PIC mode, enable APIC mode in the IMCR, i.e. * connect BSP's local APIC to INT and NMI lines. */ - printk(KERN_INFO "leaving PIC mode, enabling APIC mode.\n"); + apic_printk(APIC_VERBOSE, "leaving PIC mode, enabling APIC mode.\n"); outb(0x70, 0x22); outb(0x01, 0x23); } @@ -138,7 +140,7 @@ * interrupts, including IPIs, won't work beyond * this point! The only exception are INIT IPIs. */ - printk(KERN_INFO "disabling APIC mode, entering PIC mode.\n"); + apic_printk(APIC_QUIET, "disabling APIC mode, entering PIC mode.\n"); outb(0x70, 0x22); outb(0x00, 0x23); } @@ -172,10 +174,10 @@ * The version register is read-only in a real APIC. */ reg0 = apic_read(APIC_LVR); - Dprintk("Getting VERSION: %x\n", reg0); + apic_printk(APIC_DEBUG, "Getting VERSION: %x\n", reg0); apic_write(APIC_LVR, reg0 ^ APIC_LVR_MASK); reg1 = apic_read(APIC_LVR); - Dprintk("Getting VERSION: %x\n", reg1); + apic_printk(APIC_DEBUG, "Getting VERSION: %x\n", reg1); /* * The two version reads above should print the same @@ -199,10 +201,10 @@ * The ID register is read/write in a real APIC. */ reg0 = apic_read(APIC_ID); - Dprintk("Getting ID: %x\n", reg0); + apic_printk(APIC_DEBUG, "Getting ID: %x\n", reg0); apic_write(APIC_ID, reg0 ^ APIC_ID_MASK); reg1 = apic_read(APIC_ID); - Dprintk("Getting ID: %x\n", reg1); + apic_printk(APIC_DEBUG, "Getting ID: %x\n", reg1); apic_write(APIC_ID, reg0); if (reg1 != (reg0 ^ APIC_ID_MASK)) return 0; @@ -213,9 +215,9 @@ * compatibility mode, but most boxes are anymore. */ reg0 = apic_read(APIC_LVT0); - Dprintk("Getting LVT0: %x\n", reg0); + apic_printk(APIC_DEBUG,"Getting LVT0: %x\n", reg0); reg1 = apic_read(APIC_LVT1); - Dprintk("Getting LVT1: %x\n", reg1); + apic_printk(APIC_DEBUG, "Getting LVT1: %x\n", reg1); return 1; } @@ -227,7 +229,7 @@ */ apic_wait_icr_idle(); - Dprintk("Synchronizing Arb IDs.\n"); + apic_printk(APIC_DEBUG, "Synchronizing Arb IDs.\n"); apic_write_around(APIC_ICR, APIC_DEST_ALLINC | APIC_INT_LEVELTRIG | APIC_DM_INIT); } @@ -388,10 +390,10 @@ value = apic_read(APIC_LVT0) & APIC_LVT_MASKED; if (!smp_processor_id() && (pic_mode || !value)) { value = APIC_DM_EXTINT; - Dprintk(KERN_INFO "enabled ExtINT on CPU#%d\n", smp_processor_id()); + apic_printk(APIC_VERBOSE, "enabled ExtINT on CPU#%d\n", smp_processor_id()); } else { value = APIC_DM_EXTINT | APIC_LVT_MASKED; - Dprintk(KERN_INFO "masked ExtINT on CPU#%d\n", smp_processor_id()); + apic_printk(APIC_VERBOSE, "masked ExtINT on CPU#%d\n", smp_processor_id()); } apic_write_around(APIC_LVT0, value); @@ -407,12 +409,11 @@ apic_write_around(APIC_LVT1, value); if (APIC_INTEGRATED(ver) && !esr_disable) { /* !82489DX */ + unsigned oldvalue; maxlvt = get_maxlvt(); if (maxlvt > 3) /* Due to the Pentium erratum 3AP. */ apic_write(APIC_ESR, 0); - value = apic_read(APIC_ESR); - Dprintk("ESR value before enabling vector: %08x\n", value); - + oldvalue = apic_read(APIC_ESR); value = ERROR_APIC_VECTOR; // enables sending errors apic_write_around(APIC_LVTERR, value); /* @@ -421,7 +422,10 @@ if (maxlvt > 3) apic_write(APIC_ESR, 0); value = apic_read(APIC_ESR); - Dprintk("ESR value after enabling vector: %08x\n", value); + if (value != oldvalue) + apic_printk(APIC_VERBOSE, + "ESR value after enabling vector: %08x, after %08x\n", + oldvalue, value); } else { if (esr_disable) /* @@ -430,9 +434,9 @@ * ESR disabled - we can't do anything useful with the * errors anyway - mbligh */ - printk("Leaving ESR disabled.\n"); + apic_printk(APIC_DEBUG, "Leaving ESR disabled.\n"); else - printk("No ESR for 82489DX.\n"); + apic_printk(APIC_DEBUG, "No ESR for 82489DX.\n"); } nmi_watchdog_default(); @@ -564,6 +568,21 @@ #endif /* CONFIG_PM */ +static int __init apic_set_verbosity(char *str) +{ + if (strcmp("debug", str) == 0) + apic_verbosity = APIC_DEBUG; + else if (strcmp("verbose", str) == 0) + apic_verbosity = APIC_VERBOSE; + else + printk(KERN_WARNING "APIC Verbosity level %s not recognised" + " use apic=verbose or apic=debug", str); + + return 0; +} + +__setup("apic=", apic_set_verbosity); + /* * Detect and enable local APICs on non-SMP boards. * Original code written by Keir Fraser. @@ -599,7 +618,7 @@ apic_phys = mp_lapic_addr; set_fixmap_nocache(FIX_APIC_BASE, apic_phys); - Dprintk("mapped APIC to %16lx (%16lx)\n", APIC_BASE, apic_phys); + apic_printk(APIC_VERBOSE,"mapped APIC to %16lx (%16lx)\n", APIC_BASE, apic_phys); /* * Fetch the APIC ID of the BSP in case we have a @@ -621,7 +640,7 @@ ioapic_phys = __pa(ioapic_phys); } set_fixmap_nocache(idx, ioapic_phys); - Dprintk("mapped IOAPIC to %016lx (%016lx)\n", + apic_printk(APIC_VERBOSE,"mapped IOAPIC to %016lx (%016lx)\n", __fix_to_virt(idx), ioapic_phys); idx++; } @@ -961,7 +980,7 @@ 6: Received illegal vector 7: Illegal register address */ - printk (KERN_INFO "APIC error on CPU%d: %02x(%02x)\n", + printk (KERN_DEBUG "APIC error on CPU%d: %02x(%02x)\n", smp_processor_id(), v , v1); irq_exit(); } diff -Nru a/arch/x86_64/kernel/i8259.c b/arch/x86_64/kernel/i8259.c --- a/arch/x86_64/kernel/i8259.c 2004-09-26 10:25:55 -07:00 +++ b/arch/x86_64/kernel/i8259.c 2004-09-26 10:25:55 -07:00 @@ -329,7 +329,7 @@ * lets ACK and report it. [once per IRQ] */ if (!(spurious_irq_mask & irqmask)) { - printk("spurious 8259A interrupt: IRQ%d.\n", irq); + printk(KERN_DEBUG "spurious 8259A interrupt: IRQ%d.\n", irq); spurious_irq_mask |= irqmask; } atomic_inc(&irq_err_count); diff -Nru a/arch/x86_64/kernel/init_task.c b/arch/x86_64/kernel/init_task.c --- a/arch/x86_64/kernel/init_task.c 2004-09-26 10:25:56 -07:00 +++ b/arch/x86_64/kernel/init_task.c 2004-09-26 10:25:56 -07:00 @@ -44,8 +44,7 @@ * section. Since TSS's are completely CPU-local, we want them * on exact cacheline boundaries, to eliminate cacheline ping-pong. */ -struct tss_struct init_tss[NR_CPUS] __cacheline_aligned; - +DEFINE_PER_CPU(struct tss_struct, init_tss) ____cacheline_maxaligned_in_smp; #define ALIGN_TO_4K __attribute__((section(".data.init_task"))) diff -Nru a/arch/x86_64/kernel/io_apic.c b/arch/x86_64/kernel/io_apic.c --- a/arch/x86_64/kernel/io_apic.c 2004-09-26 10:25:56 -07:00 +++ b/arch/x86_64/kernel/io_apic.c 2004-09-26 10:25:56 -07:00 @@ -30,12 +30,15 @@ #include #include #include +#include #include #include #include #include +#define __apicdebuginit __init + int sis_apic_bug; /* not actually supported, dummy for compile */ #undef APIC_LOCKUP_DEBUG @@ -292,13 +295,13 @@ pirq_entries[i] = -1; pirqs_enabled = 1; - printk(KERN_INFO "PIRQ redirection, working around broken MP-BIOS.\n"); + apic_printk(APIC_VERBOSE, "PIRQ redirection, working around broken MP-BIOS.\n"); max = MAX_PIRQS; if (ints[0] < MAX_PIRQS) max = ints[0]; for (i = 0; i < max; i++) { - printk(KERN_DEBUG "... PIRQ%d -> IRQ %d\n", i, ints[i+1]); + apic_printk(APIC_VERBOSE, "... PIRQ%d -> IRQ %d\n", i, ints[i+1]); /* * PIRQs are mapped upside down, usually. */ @@ -357,10 +360,10 @@ { int apic, i, best_guess = -1; - Dprintk("querying PCI -> IRQ mapping bus:%d, slot:%d, pin:%d.\n", + apic_printk(APIC_DEBUG, "querying PCI -> IRQ mapping bus:%d, slot:%d, pin:%d.\n", bus, slot, pin); if (mp_bus_id_to_pci_bus[bus] == -1) { - printk(KERN_WARNING "PCI BIOS passed nonexistent PCI bus %d!\n", bus); + apic_printk(APIC_VERBOSE, "PCI BIOS passed nonexistent PCI bus %d!\n", bus); return -1; } for (i = 0; i < mp_irq_entries; i++) { @@ -402,7 +405,7 @@ unsigned int port = 0x4d0 + (irq >> 3); return (inb(port) >> (irq & 7)) & 1; } - printk(KERN_INFO "Broken MPtable reports ISA irq %d\n", irq); + apic_printk(APIC_VERBOSE, "Broken MPtable reports ISA irq %d\n", irq); return 0; } @@ -625,10 +628,10 @@ if ((pin >= 16) && (pin <= 23)) { if (pirq_entries[pin-16] != -1) { if (!pirq_entries[pin-16]) { - printk(KERN_DEBUG "disabling PIRQ%d\n", pin-16); + apic_printk(APIC_VERBOSE, "disabling PIRQ%d\n", pin-16); } else { irq = pirq_entries[pin-16]; - printk(KERN_DEBUG "using PIRQ%d -> IRQ %d\n", + apic_printk(APIC_VERBOSE, "using PIRQ%d -> IRQ %d\n", pin-16, irq); } } @@ -719,7 +722,7 @@ int apic, pin, idx, irq, first_notcon = 1, vector; unsigned long flags; - printk(KERN_DEBUG "init IO_APIC IRQs\n"); + apic_printk(APIC_VERBOSE, KERN_DEBUG "init IO_APIC IRQs\n"); for (apic = 0; apic < nr_ioapics; apic++) { for (pin = 0; pin < nr_ioapic_registers[apic]; pin++) { @@ -737,10 +740,10 @@ idx = find_irq_entry(apic,pin,mp_INT); if (idx == -1) { if (first_notcon) { - printk(KERN_DEBUG " IO-APIC (apicid-pin) %d-%d", mp_ioapics[apic].mpc_apicid, pin); + apic_printk(APIC_VERBOSE, KERN_DEBUG " IO-APIC (apicid-pin) %d-%d", mp_ioapics[apic].mpc_apicid, pin); first_notcon = 0; } else - printk(", %d-%d", mp_ioapics[apic].mpc_apicid, pin); + apic_printk(APIC_VERBOSE, ", %d-%d", mp_ioapics[apic].mpc_apicid, pin); continue; } @@ -775,7 +778,7 @@ } if (!first_notcon) - printk(" not connected.\n"); + apic_printk(APIC_VERBOSE," not connected.\n"); } /* @@ -825,13 +828,9 @@ void __init UNEXPECTED_IO_APIC(void) { -#if 0 - printk(KERN_WARNING " WARNING: unexpected IO-APIC, please mail\n"); - printk(KERN_WARNING " to linux-smp@vger.kernel.org\n"); -#endif } -void __init print_IO_APIC(void) +void __apicdebuginit print_IO_APIC(void) { int apic, i; union IO_APIC_reg_00 reg_00; @@ -839,7 +838,10 @@ union IO_APIC_reg_02 reg_02; unsigned long flags; - printk(KERN_DEBUG "number of MP IRQ sources: %d.\n", mp_irq_entries); + if (apic_verbosity == APIC_QUIET) + return; + + printk(KERN_DEBUG "number of MP IRQ sources: %d.\n", mp_irq_entries); for (i = 0; i < nr_ioapics; i++) printk(KERN_DEBUG "number of IO-APIC #%d registers: %d.\n", mp_ioapics[i].mpc_apicid, nr_ioapic_registers[i]); @@ -955,11 +957,14 @@ return; } -static void print_APIC_bitfield (int base) +static __apicdebuginit void print_APIC_bitfield (int base) { unsigned int v; int i, j; + if (apic_verbosity == APIC_QUIET) + return; + printk(KERN_DEBUG "0123456789abcdef0123456789abcdef\n" KERN_DEBUG); for (i = 0; i < 8; i++) { v = apic_read(base + i*0x10); @@ -973,10 +978,13 @@ } } -void /*__init*/ print_local_APIC(void * dummy) +void __apicdebuginit print_local_APIC(void * dummy) { unsigned int v, ver, maxlvt; + if (apic_verbosity == APIC_QUIET) + return; + printk("\n" KERN_DEBUG "printing local APIC contents on CPU#%d/%d:\n", smp_processor_id(), hard_smp_processor_id()); v = apic_read(APIC_ID); @@ -1058,12 +1066,15 @@ on_each_cpu(print_local_APIC, NULL, 1, 1); } -void /*__init*/ print_PIC(void) +void __apicdebuginit print_PIC(void) { extern spinlock_t i8259A_lock; unsigned int v; unsigned long flags; + if (apic_verbosity == APIC_QUIET) + return; + printk(KERN_DEBUG "\nprinting PIC contents\n"); spin_lock_irqsave(&i8259A_lock, flags); @@ -1160,9 +1171,9 @@ old_id = mp_ioapics[apic].mpc_apicid; if (mp_ioapics[apic].mpc_apicid >= 0xf) { - printk(KERN_ERR "BIOS bug, IO-APIC#%d ID is %d in the MPC table!...\n", + apic_printk(APIC_QUIET,KERN_ERR "BIOS bug, IO-APIC#%d ID is %d in the MPC table!...\n", apic, mp_ioapics[apic].mpc_apicid); - printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n", + apic_printk(APIC_QUIET,KERN_ERR "... fixing up to %d. (tell your hw vendor)\n", reg_00.bits.ID); mp_ioapics[apic].mpc_apicid = reg_00.bits.ID; } @@ -1205,7 +1216,7 @@ * Read the right value from the MPC table and * write it into the ID register. */ - printk(KERN_INFO "...changing IO-APIC physical APIC ID to %d ...", + apic_printk(APIC_VERBOSE,KERN_INFO "...changing IO-APIC physical APIC ID to %d ...", mp_ioapics[apic].mpc_apicid); reg_00.bits.ID = mp_ioapics[apic].mpc_apicid; @@ -1220,9 +1231,9 @@ reg_00.raw = io_apic_read(apic, 0); spin_unlock_irqrestore(&ioapic_lock, flags); if (reg_00.bits.ID != mp_ioapics[apic].mpc_apicid) - panic("could not set ID!\n"); + printk("could not set ID!\n"); else - printk(" ok.\n"); + apic_printk(APIC_VERBOSE," ok.\n"); } } @@ -1671,7 +1682,7 @@ pin1 = find_isa_irq_pin(0, mp_INT); pin2 = find_isa_irq_pin(0, mp_ExtINT); - printk(KERN_INFO "..TIMER: vector=0x%02X pin1=%d pin2=%d\n", vector, pin1, pin2); + apic_printk(APIC_VERBOSE,KERN_INFO "..TIMER: vector=0x%02X pin1=%d pin2=%d\n", vector, pin1, pin2); if (pin1 != -1) { /* @@ -1689,12 +1700,12 @@ return; } clear_IO_APIC_pin(0, pin1); - printk(KERN_ERR "..MP-BIOS bug: 8254 timer not connected to IO-APIC\n"); + apic_printk(APIC_QUIET,KERN_ERR "..MP-BIOS bug: 8254 timer not connected to IO-APIC\n"); } - printk(KERN_INFO "...trying to set up timer (IRQ0) through the 8259A ... "); + apic_printk(APIC_VERBOSE,KERN_INFO "...trying to set up timer (IRQ0) through the 8259A ... "); if (pin2 != -1) { - printk("\n..... (found pin %d) ...", pin2); + apic_printk(APIC_VERBOSE,"\n..... (found pin %d) ...", pin2); /* * legacy devices should be connected to IO APIC #0 */ @@ -1720,7 +1731,7 @@ nmi_watchdog = 0; } - printk(KERN_INFO "...trying to set up timer as Virtual Wire IRQ..."); + apic_printk(APIC_VERBOSE, KERN_INFO "...trying to set up timer as Virtual Wire IRQ..."); disable_8259A_irq(0); irq_desc[0].handler = &lapic_irq_type; @@ -1728,13 +1739,13 @@ enable_8259A_irq(0); if (timer_irq_works()) { - printk(" works.\n"); + apic_printk(APIC_QUIET, " works.\n"); return; } apic_write_around(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_FIXED | vector); - printk(" failed.\n"); + apic_printk(APIC_VERBOSE," failed.\n"); - printk(KERN_INFO "...trying to set up timer as ExtINT IRQ..."); + apic_printk(APIC_VERBOSE, KERN_INFO "...trying to set up timer as ExtINT IRQ..."); init_8259A(0); make_8259A_irq(0); @@ -1743,10 +1754,10 @@ unlock_ExtINT_logic(); if (timer_irq_works()) { - printk(" works.\n"); + apic_printk(APIC_VERBOSE," works.\n"); return; } - printk(" failed :(.\n"); + apic_printk(APIC_VERBOSE," failed :(.\n"); panic("IO-APIC + timer doesn't work! Try using the 'noapic' kernel parameter\n"); } @@ -1768,7 +1779,7 @@ else io_apic_irqs = ~PIC_IRQS; - printk("ENABLING IO-APIC IRQs\n"); + apic_printk(APIC_VERBOSE, "ENABLING IO-APIC IRQs\n"); /* * Set up the IO-APIC IRQ routing table. @@ -1783,6 +1794,98 @@ print_IO_APIC(); } +struct sysfs_ioapic_data { + struct sys_device dev; + struct IO_APIC_route_entry entry[0]; +}; +static struct sysfs_ioapic_data * mp_ioapic_data[MAX_IO_APICS]; + +static int ioapic_suspend(struct sys_device *dev, u32 state) +{ + struct IO_APIC_route_entry *entry; + struct sysfs_ioapic_data *data; + unsigned long flags; + int i; + + data = container_of(dev, struct sysfs_ioapic_data, dev); + entry = data->entry; + spin_lock_irqsave(&ioapic_lock, flags); + for (i = 0; i < nr_ioapic_registers[dev->id]; i ++, entry ++ ) { + *(((int *)entry) + 1) = io_apic_read(dev->id, 0x11 + 2 * i); + *(((int *)entry) + 0) = io_apic_read(dev->id, 0x10 + 2 * i); + } + spin_unlock_irqrestore(&ioapic_lock, flags); + + return 0; +} + +static int ioapic_resume(struct sys_device *dev) +{ + struct IO_APIC_route_entry *entry; + struct sysfs_ioapic_data *data; + unsigned long flags; + union IO_APIC_reg_00 reg_00; + int i; + + data = container_of(dev, struct sysfs_ioapic_data, dev); + entry = data->entry; + + spin_lock_irqsave(&ioapic_lock, flags); + reg_00.raw = io_apic_read(dev->id, 0); + if (reg_00.bits.ID != mp_ioapics[dev->id].mpc_apicid) { + reg_00.bits.ID = mp_ioapics[dev->id].mpc_apicid; + io_apic_write(dev->id, 0, reg_00.raw); + } + for (i = 0; i < nr_ioapic_registers[dev->id]; i ++, entry ++ ) { + io_apic_write(dev->id, 0x11+2*i, *(((int *)entry)+1)); + io_apic_write(dev->id, 0x10+2*i, *(((int *)entry)+0)); + } + spin_unlock_irqrestore(&ioapic_lock, flags); + + return 0; +} + +static struct sysdev_class ioapic_sysdev_class = { + set_kset_name("ioapic"), + .suspend = ioapic_suspend, + .resume = ioapic_resume, +}; + +static int __init ioapic_init_sysfs(void) +{ + struct sys_device * dev; + int i, size, error = 0; + + error = sysdev_class_register(&ioapic_sysdev_class); + if (error) + return error; + + for (i = 0; i < nr_ioapics; i++ ) { + size = sizeof(struct sys_device) + nr_ioapic_registers[i] + * sizeof(struct IO_APIC_route_entry); + mp_ioapic_data[i] = kmalloc(size, GFP_KERNEL); + if (!mp_ioapic_data[i]) { + printk(KERN_ERR "Can't suspend/resume IOAPIC %d\n", i); + continue; + } + memset(mp_ioapic_data[i], 0, size); + dev = &mp_ioapic_data[i]->dev; + dev->id = i; + dev->cls = &ioapic_sysdev_class; + error = sysdev_register(dev); + if (error) { + kfree(mp_ioapic_data[i]); + mp_ioapic_data[i] = NULL; + printk(KERN_ERR "Can't suspend/resume IOAPIC %d\n", i); + continue; + } + } + + return 0; +} + +device_initcall(ioapic_init_sysfs); + /* -------------------------------------------------------------------------- ACPI-based IOAPIC Configuration -------------------------------------------------------------------------- */ @@ -1815,7 +1918,7 @@ spin_unlock_irqrestore(&ioapic_lock, flags); if (apic_id >= IO_APIC_MAX_ID) { - printk(KERN_WARNING "IOAPIC[%d]: Invalid apic_id %d, trying " + apic_printk(APIC_QUIET, KERN_WARNING "IOAPIC[%d]: Invalid apic_id %d, trying " "%d\n", ioapic, apic_id, reg_00.bits.ID); apic_id = reg_00.bits.ID; } @@ -1834,7 +1937,7 @@ if (i == IO_APIC_MAX_ID) panic("Max apic_id exceeded!\n"); - printk(KERN_WARNING "IOAPIC[%d]: apic_id %d already used, " + apic_printk(APIC_VERBOSE, KERN_WARNING "IOAPIC[%d]: apic_id %d already used, " "trying %d\n", ioapic, apic_id, i); apic_id = i; @@ -1855,7 +1958,7 @@ panic("IOAPIC[%d]: Unable change apic_id!\n", ioapic); } - printk(KERN_INFO "IOAPIC[%d]: Assigned apic_id %d\n", ioapic, apic_id); + apic_printk(APIC_VERBOSE,KERN_INFO "IOAPIC[%d]: Assigned apic_id %d\n", ioapic, apic_id); return apic_id; } @@ -1893,7 +1996,7 @@ unsigned long flags; if (!IO_APIC_IRQ(irq)) { - printk(KERN_ERR "IOAPIC[%d]: Invalid reference to IRQ 0\n", + apic_printk(APIC_QUIET,KERN_ERR "IOAPIC[%d]: Invalid reference to IRQ 0\n", ioapic); return -EINVAL; } @@ -1921,7 +2024,7 @@ entry.vector = assign_irq_vector(irq); - printk(KERN_DEBUG "IOAPIC[%d]: Set PCI routing entry (%d-%d -> 0x%x -> " + apic_printk(APIC_VERBOSE,KERN_DEBUG "IOAPIC[%d]: Set PCI routing entry (%d-%d -> 0x%x -> " "IRQ %d Mode:%i Active:%i)\n", ioapic, mp_ioapics[ioapic].mpc_apicid, pin, entry.vector, irq, edge_level, active_high_low); diff -Nru a/arch/x86_64/kernel/ioport.c b/arch/x86_64/kernel/ioport.c --- a/arch/x86_64/kernel/ioport.c 2004-09-26 10:25:55 -07:00 +++ b/arch/x86_64/kernel/ioport.c 2004-09-26 10:25:55 -07:00 @@ -28,12 +28,12 @@ clear_bit(i, bitmap); } - /* * this changes the io permissions bitmap in the current task. */ asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int turn_on) { + unsigned int i, max_long, bytes, bytes_updated; struct thread_struct * t = ¤t->thread; struct tss_struct * tss; unsigned long *bitmap; @@ -59,16 +59,34 @@ /* * do it in the per-thread copy and in the TSS ... + * + * Disable preemption via get_cpu() - we must not switch away + * because the ->io_bitmap_max value must match the bitmap + * contents: */ + tss = &per_cpu(init_tss, get_cpu()); + set_bitmap(t->io_bitmap_ptr, from, num, !turn_on); - tss = init_tss + get_cpu(); - if (tss->io_bitmap_base == IO_BITMAP_OFFSET) { /* already active? */ - set_bitmap(tss->io_bitmap, from, num, !turn_on); - } else { - memcpy(tss->io_bitmap, t->io_bitmap_ptr, IO_BITMAP_BYTES); - tss->io_bitmap_base = IO_BITMAP_OFFSET; /* Activate it in the TSS */ - } + + /* + * Search for a (possibly new) maximum. This is simple and stupid, + * to keep it obviously correct: + */ + max_long = 0; + for (i = 0; i < IO_BITMAP_LONGS; i++) + if (t->io_bitmap_ptr[i] != ~0UL) + max_long = i; + + bytes = (max_long + 1) * sizeof(long); + bytes_updated = max(bytes, t->io_bitmap_max); + + t->io_bitmap_max = bytes; + + /* Update the TSS: */ + memcpy(tss->io_bitmap, t->io_bitmap_ptr, bytes_updated); + put_cpu(); + return 0; } diff -Nru a/arch/x86_64/kernel/mce.c b/arch/x86_64/kernel/mce.c --- a/arch/x86_64/kernel/mce.c 2004-09-26 10:25:56 -07:00 +++ b/arch/x86_64/kernel/mce.c 2004-09-26 10:25:56 -07:00 @@ -470,7 +470,7 @@ /* Why are there no generic functions for this? */ #define ACCESSOR(name, var, start) \ static ssize_t show_ ## name(struct sys_device *s, char *buf) { \ - return sprintf(buf, "%lu\n", (unsigned long)var); \ + return sprintf(buf, "%lx\n", (unsigned long)var); \ } \ static ssize_t set_ ## name(struct sys_device *s,const char *buf,size_t siz) { \ char *end; \ diff -Nru a/arch/x86_64/kernel/process.c b/arch/x86_64/kernel/process.c --- a/arch/x86_64/kernel/process.c 2004-09-26 10:25:56 -07:00 +++ b/arch/x86_64/kernel/process.c 2004-09-26 10:25:56 -07:00 @@ -130,11 +130,20 @@ { /* 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); + /* + * Mark this as an RCU critical section so that + * synchronize_kernel() in the unload path waits + * for our completion. + */ + rcu_read_lock(); + idle = pm_idle; + if (!idle) + idle = default_idle; idle(); + rcu_read_unlock(); + } schedule(); } } @@ -250,11 +259,17 @@ void exit_thread(void) { struct task_struct *me = current; + struct thread_struct *t = &me->thread; if (me->thread.io_bitmap_ptr) { - struct tss_struct *tss = init_tss + get_cpu(); - kfree(me->thread.io_bitmap_ptr); - me->thread.io_bitmap_ptr = NULL; - tss->io_bitmap_base = INVALID_IO_BITMAP_OFFSET; + struct tss_struct *tss = &per_cpu(init_tss, get_cpu()); + + kfree(t->io_bitmap_ptr); + t->io_bitmap_ptr = NULL; + /* + * Careful, clear this in the TSS too: + */ + memset(tss->io_bitmap, 0xff, t->io_bitmap_max); + t->io_bitmap_max = 0; put_cpu(); } } @@ -362,8 +377,10 @@ if (unlikely(me->thread.io_bitmap_ptr != NULL)) { p->thread.io_bitmap_ptr = kmalloc(IO_BITMAP_BYTES, GFP_KERNEL); - if (!p->thread.io_bitmap_ptr) + if (!p->thread.io_bitmap_ptr) { + p->thread.io_bitmap_max = 0; return -ENOMEM; + } memcpy(p->thread.io_bitmap_ptr, me->thread.io_bitmap_ptr, IO_BITMAP_BYTES); } @@ -382,8 +399,10 @@ } err = 0; out: - if (err && p->thread.io_bitmap_ptr) + if (err && p->thread.io_bitmap_ptr) { kfree(p->thread.io_bitmap_ptr); + p->thread.io_bitmap_max = 0; + } return err; } @@ -404,7 +423,7 @@ struct thread_struct *prev = &prev_p->thread, *next = &next_p->thread; int cpu = smp_processor_id(); - struct tss_struct *tss = init_tss + cpu; + struct tss_struct *tss = &per_cpu(init_tss, cpu); unlazy_fpu(prev_p); @@ -490,22 +509,18 @@ * Handle the IO bitmap */ if (unlikely(prev->io_bitmap_ptr || next->io_bitmap_ptr)) { - if (next->io_bitmap_ptr) { + if (next->io_bitmap_ptr) /* - * 2 cachelines copy ... not good, but not that - * bad either. Anyone got something better? - * This only affects processes which use ioperm(). - */ - memcpy(tss->io_bitmap, next->io_bitmap_ptr, IO_BITMAP_BYTES); - tss->io_bitmap_base = IO_BITMAP_OFFSET; - } else { + * Copy the relevant range of the IO bitmap. + * Normally this is 128 bytes or less: + */ + memcpy(tss->io_bitmap, next->io_bitmap_ptr, + max(prev->io_bitmap_max, next->io_bitmap_max)); + else { /* - * a bitmap offset pointing outside of the TSS limit - * causes a nicely controllable SIGSEGV if a process - * tries to use a port IO instruction. The first - * sys_ioperm() call sets up the bitmap properly. + * Clear any possible leftover bits: */ - tss->io_bitmap_base = INVALID_IO_BITMAP_OFFSET; + memset(tss->io_bitmap, 0xff, prev->io_bitmap_max); } } diff -Nru a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c --- a/arch/x86_64/kernel/setup.c 2004-09-26 10:25:55 -07:00 +++ b/arch/x86_64/kernel/setup.c 2004-09-26 10:25:55 -07:00 @@ -745,7 +745,7 @@ } if (index_lsb != index_msb ) index_msb++; - initial_apic_id = ebx >> 24 & 0xff; + initial_apic_id = hard_smp_processor_id(); phys_proc_id[cpu] = initial_apic_id >> index_msb; printk(KERN_INFO "CPU: Physical Processor ID: %d\n", diff -Nru a/arch/x86_64/kernel/setup64.c b/arch/x86_64/kernel/setup64.c --- a/arch/x86_64/kernel/setup64.c 2004-09-26 10:25:55 -07:00 +++ b/arch/x86_64/kernel/setup64.c 2004-09-26 10:25:55 -07:00 @@ -237,10 +237,11 @@ #else int cpu = smp_processor_id(); #endif - struct tss_struct * t = &init_tss[cpu]; + struct tss_struct *t = &per_cpu(init_tss, cpu); unsigned long v; char *estacks = NULL; struct task_struct *me; + int i; /* CPU 0 is initialised in head64.c */ if (cpu != 0) { @@ -304,12 +305,13 @@ t->ist[v] = (unsigned long)estacks; } - t->io_bitmap_base = INVALID_IO_BITMAP_OFFSET; + t->io_bitmap_base = offsetof(struct tss_struct, io_bitmap); /* - * This is required because the CPU will access up to + * <= is required because the CPU will access up to * 8 bits beyond the end of the IO permission bitmap. */ - t->io_bitmap[IO_BITMAP_LONGS] = ~0UL; + for (i = 0; i <= IO_BITMAP_LONGS; i++) + t->io_bitmap[i] = ~0UL; atomic_inc(&init_mm.mm_count); me->active_mm = &init_mm; diff -Nru a/arch/x86_64/kernel/smp.c b/arch/x86_64/kernel/smp.c --- a/arch/x86_64/kernel/smp.c 2004-09-26 10:25:58 -07:00 +++ b/arch/x86_64/kernel/smp.c 2004-09-26 10:25:58 -07:00 @@ -396,6 +396,7 @@ * * You must not call this function with disabled interrupts or from a * hardware interrupt handler or from a bottom half handler. + * Actually there are a few legal cases, like panic. */ { struct call_data_struct data; @@ -403,9 +404,6 @@ if (!cpus) return 0; - - /* Can deadlock when called with interrupts disabled */ - WARN_ON(irqs_disabled()); data.func = func; data.info = info; diff -Nru a/arch/x86_64/kernel/smpboot.c b/arch/x86_64/kernel/smpboot.c --- a/arch/x86_64/kernel/smpboot.c 2004-09-26 10:25:57 -07:00 +++ b/arch/x86_64/kernel/smpboot.c 2004-09-26 10:25:57 -07:00 @@ -575,7 +575,7 @@ start_rip = setup_trampoline(); init_rsp = idle->thread.rsp; - init_tss[cpu].rsp0 = init_rsp; + per_cpu(init_tss,cpu).rsp0 = init_rsp; initial_code = start_secondary; clear_ti_thread_flag(idle->thread_info, TIF_FORK); diff -Nru a/arch/x86_64/kernel/suspend.c b/arch/x86_64/kernel/suspend.c --- a/arch/x86_64/kernel/suspend.c 2004-09-26 10:25:56 -07:00 +++ b/arch/x86_64/kernel/suspend.c 2004-09-26 10:25:56 -07:00 @@ -129,7 +129,7 @@ void fix_processor_context(void) { int cpu = smp_processor_id(); - struct tss_struct * t = init_tss + cpu; + struct tss_struct *t = &per_cpu(init_tss, cpu); set_tss_desc(cpu,t); /* This just modifies memory; should not be neccessary. But... This is neccessary, because 386 hardware has concept of busy TSS or some similar stupidity. */ diff -Nru a/arch/x86_64/kernel/traps.c b/arch/x86_64/kernel/traps.c --- a/arch/x86_64/kernel/traps.c 2004-09-26 10:25:55 -07:00 +++ b/arch/x86_64/kernel/traps.c 2004-09-26 10:25:55 -07:00 @@ -110,9 +110,10 @@ { int k; for (k = 0; k < N_EXCEPTION_STACKS; k++) { - unsigned long end = init_tss[cpu].ist[k] + EXCEPTION_STKSZ; + struct tss_struct *tss = &per_cpu(init_tss, cpu); + unsigned long end = tss->ist[k] + EXCEPTION_STKSZ; - if (stack >= init_tss[cpu].ist[k] && stack <= end) + if (stack >= tss->ist[k] && stack <= end) return (unsigned long *)end; } return NULL; @@ -463,7 +464,7 @@ DO_ERROR( 9, SIGFPE, "coprocessor segment overrun", coprocessor_segment_overrun) DO_ERROR(10, SIGSEGV, "invalid TSS", invalid_TSS) DO_ERROR(11, SIGBUS, "segment not present", segment_not_present) -DO_ERROR_INFO(17, SIGBUS, "alignment check", alignment_check, BUS_ADRALN, get_cr2()) +DO_ERROR_INFO(17, SIGBUS, "alignment check", alignment_check, BUS_ADRALN, 0) DO_ERROR(18, SIGSEGV, "reserved", reserved) #define DO_ERROR_STACK(trapnr, signr, str, name) \ diff -Nru a/arch/x86_64/lib/csum-wrappers.c b/arch/x86_64/lib/csum-wrappers.c --- a/arch/x86_64/lib/csum-wrappers.c 2004-09-26 10:25:55 -07:00 +++ b/arch/x86_64/lib/csum-wrappers.c 2004-09-26 10:25:55 -07:00 @@ -22,6 +22,7 @@ csum_partial_copy_from_user(const char __user *src, char *dst, int len, unsigned int isum, int *errp) { + might_sleep(); *errp = 0; if (likely(access_ok(VERIFY_READ,src, len))) { /* Why 6, not 7? To handle odd addresses aligned we @@ -69,6 +70,7 @@ csum_partial_copy_to_user(const char *src, char __user *dst, int len, unsigned int isum, int *errp) { + might_sleep(); if (unlikely(!access_ok(VERIFY_WRITE, dst, len))) { *errp = -EFAULT; return 0; diff -Nru a/arch/x86_64/lib/usercopy.c b/arch/x86_64/lib/usercopy.c --- a/arch/x86_64/lib/usercopy.c 2004-09-26 10:25:55 -07:00 +++ b/arch/x86_64/lib/usercopy.c 2004-09-26 10:25:55 -07:00 @@ -14,6 +14,7 @@ #define __do_strncpy_from_user(dst,src,count,res) \ do { \ long __d0, __d1, __d2; \ + might_sleep(); \ __asm__ __volatile__( \ " testq %1,%1\n" \ " jz 2f\n" \ @@ -63,6 +64,7 @@ unsigned long __clear_user(void __user *addr, unsigned long size) { long __d0; + might_sleep(); /* no memory constraint because it doesn't change any memory gcc knows about */ asm volatile( diff -Nru a/arch/x86_64/mm/fault.c b/arch/x86_64/mm/fault.c --- a/arch/x86_64/mm/fault.c 2004-09-26 10:25:55 -07:00 +++ b/arch/x86_64/mm/fault.c 2004-09-26 10:25:55 -07:00 @@ -315,7 +315,27 @@ goto bad_area_nosemaphore; again: - down_read(&mm->mmap_sem); + /* When running in the kernel we expect faults to occur only to + * addresses in user space. All other faults represent errors in the + * kernel and should generate an OOPS. Unfortunatly, in the case of an + * erroneous fault occuring in a code path which already holds mmap_sem + * we will deadlock attempting to validate the fault against the + * address space. Luckily the kernel only validly references user + * space from well defined areas of code, which are listed in the + * exceptions table. + * + * As the vast majority of faults will be valid we will only perform + * the source reference check when there is a possibilty of a deadlock. + * Attempt to lock the address space, if we cannot we then validate the + * source. If this is invalid we can skip the address space check, + * thus avoiding the deadlock. + */ + if (!down_read_trylock(&mm->mmap_sem)) { + if ((error_code & 4) == 0 && + !search_exception_tables(regs->rip)) + goto bad_area_nosemaphore; + down_read(&mm->mmap_sem); + } vma = find_vma(mm, address); if (!vma) diff -Nru a/arch/x86_64/mm/k8topology.c b/arch/x86_64/mm/k8topology.c --- a/arch/x86_64/mm/k8topology.c 2004-09-26 10:25:57 -07:00 +++ b/arch/x86_64/mm/k8topology.c 2004-09-26 10:25:57 -07:00 @@ -100,8 +100,8 @@ limit <<= 24; limit |= (1<<24)-1; - if (limit > end_pfn_map << PAGE_SHIFT) - limit = end_pfn_map << PAGE_SHIFT; + if (limit > end_pfn << PAGE_SHIFT) + limit = end_pfn << PAGE_SHIFT; if (limit <= base) continue; diff -Nru a/crypto/api.c b/crypto/api.c --- a/crypto/api.c 2004-09-26 10:25:57 -07:00 +++ b/crypto/api.c 2004-09-26 10:25:57 -07:00 @@ -155,8 +155,12 @@ void crypto_free_tfm(struct crypto_tfm *tfm) { + struct crypto_alg *alg = tfm->__crt_alg; + int size = sizeof(*tfm) + alg->cra_ctxsize; + crypto_exit_ops(tfm); - crypto_alg_put(tfm->__crt_alg); + crypto_alg_put(alg); + memset(tfm, 0, size); kfree(tfm); } diff -Nru a/drivers/Makefile b/drivers/Makefile --- a/drivers/Makefile 2004-09-26 10:25:57 -07:00 +++ b/drivers/Makefile 2004-09-26 10:25:57 -07:00 @@ -16,6 +16,13 @@ # char/ comes before serial/ etc so that the VT console is the boot-time # default. obj-y += char/ + +# i810fb depends on char/agp/ +obj-$(CONFIG_FB_I810) += video/i810/ + +# we also need input/serio early so serio bus is initialized by the time +# serial drivers start registering their serio ports +obj-$(CONFIG_SERIO) += input/serio/ obj-y += serial/ obj-$(CONFIG_PARPORT) += parport/ obj-y += base/ block/ misc/ net/ media/ @@ -40,7 +47,6 @@ obj-$(CONFIG_USB_GADGET) += usb/gadget/ obj-$(CONFIG_INPUT) += input/ obj-$(CONFIG_GAMEPORT) += input/gameport/ -obj-$(CONFIG_SERIO) += input/serio/ obj-$(CONFIG_I2O) += message/ obj-$(CONFIG_I2C) += i2c/ obj-$(CONFIG_W1) += w1/ diff -Nru a/drivers/acpi/processor.c b/drivers/acpi/processor.c --- a/drivers/acpi/processor.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/acpi/processor.c 2004-09-26 10:25:56 -07:00 @@ -2419,6 +2419,11 @@ /* Unregister the idle handler when processor #0 is removed. */ if (pr->id == 0) { pm_idle = pm_idle_save; + /* + * We are about to unload the current idle thread pm callback + * (pm_idle), Wait for all processors to update cached/local + * copies of pm_idle before proceeding. + */ synchronize_kernel(); } diff -Nru a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c --- a/drivers/acpi/thermal.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/acpi/thermal.c 2004-09-26 10:25:57 -07:00 @@ -659,7 +659,7 @@ struct acpi_thermal *tz = (struct acpi_thermal *) data; unsigned long sleep_time = 0; int i = 0; - struct acpi_thermal_state state = tz->state; + struct acpi_thermal_state state; ACPI_FUNCTION_TRACE("acpi_thermal_check"); @@ -667,6 +667,8 @@ ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid (NULL) context.\n")); return_VOID; } + + state = tz->state; result = acpi_thermal_get_temperature(tz); if (result) diff -Nru a/drivers/atm/ambassador.c b/drivers/atm/ambassador.c --- a/drivers/atm/ambassador.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/atm/ambassador.c 2004-09-26 10:25:55 -07:00 @@ -2291,11 +2291,10 @@ // 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); + " IO %x, IRQ %u, MEM %p", pci_resource_start(pci_dev, 1), + irq, bus_to_virt(pci_resource_start(pci_dev, 0))); // check IO region err = pci_request_region(pci_dev, 1, DEV_LABEL); diff -Nru a/drivers/atm/eni.c b/drivers/atm/eni.c --- a/drivers/atm/eni.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/atm/eni.c 2004-09-26 10:25:55 -07:00 @@ -173,7 +173,7 @@ int i; for (i = 0; i < eni_dev->free_len; i++) - printk(KERN_DEBUG " %d: 0x%lx %d\n",i, + printk(KERN_DEBUG " %d: %p %d\n",i, eni_dev->free_list[i].start, 1 << eni_dev->free_list[i].order); } @@ -191,19 +191,19 @@ printk(KERN_NOTICE "TX buffers\n"); for (i = 0; i < NR_CHAN; i++) if (eni_dev->tx[i].send) - printk(KERN_NOTICE " TX %d @ 0x%lx: %ld\n",i, + printk(KERN_NOTICE " TX %d @ %p: %ld\n",i, eni_dev->tx[i].send,eni_dev->tx[i].words*4); printk(KERN_NOTICE "RX buffers\n"); for (i = 0; i < 1024; i++) if (eni_dev->rx_map[i] && ENI_VCC(eni_dev->rx_map[i])->rx) - printk(KERN_NOTICE " RX %d @ 0x%lx: %ld\n",i, + printk(KERN_NOTICE " RX %d @ %p: %ld\n",i, ENI_VCC(eni_dev->rx_map[i])->recv, ENI_VCC(eni_dev->rx_map[i])->words*4); printk(KERN_NOTICE "----\n"); } -static void eni_put_free(struct eni_dev *eni_dev,unsigned long start, +static void eni_put_free(struct eni_dev *eni_dev, void __iomem *start, unsigned long size) { struct eni_free *list; @@ -215,17 +215,17 @@ len = eni_dev->free_len; while (size) { if (len >= eni_dev->free_list_size) { - printk(KERN_CRIT "eni_put_free overflow (0x%lx,%ld)\n", + printk(KERN_CRIT "eni_put_free overflow (%p,%ld)\n", start,size); break; } - for (order = 0; !((start | size) & (1 << order)); order++); + for (order = 0; !(((unsigned long)start | size) & (1 << order)); order++); if (MID_MIN_BUF_SIZE > (1 << order)) { printk(KERN_CRIT "eni_put_free: order %d too small\n", order); break; } - list[len].start = start; + list[len].start = (void __iomem *) start; list[len].order = order; len++; start += 1 << order; @@ -236,10 +236,10 @@ } -static unsigned long eni_alloc_mem(struct eni_dev *eni_dev,unsigned long *size) +static void __iomem *eni_alloc_mem(struct eni_dev *eni_dev, unsigned long *size) { struct eni_free *list; - unsigned long start; + void __iomem *start; int len,i,order,best_order,index; list = eni_dev->free_list; @@ -273,7 +273,7 @@ } -static void eni_free_mem(struct eni_dev *eni_dev,unsigned long start, +static void eni_free_mem(struct eni_dev *eni_dev, void __iomem *start, unsigned long size) { struct eni_free *list; @@ -283,20 +283,20 @@ list = eni_dev->free_list; len = eni_dev->free_len; for (order = -1; size; order++) size >>= 1; - DPRINTK("eni_free_mem: 0x%lx+0x%lx (order %d)\n",start,size,order); + DPRINTK("eni_free_mem: %p+0x%lx (order %d)\n",start,size,order); for (i = 0; i < len; i++) - if (list[i].start == (start^(1 << order)) && + if (((unsigned long) list[i].start) == ((unsigned long)start^(1 << order)) && list[i].order == order) { DPRINTK("match[%d]: 0x%lx/0x%lx(0x%x), %d/%d\n",i, list[i].start,start,1 << order,list[i].order,order); list[i] = list[--len]; - start &= ~(unsigned long) (1 << order); + start = (void __iomem *) ((unsigned long) start & ~(unsigned long) (1 << order)); order++; i = -1; continue; } if (len >= eni_dev->free_list_size) { - printk(KERN_ALERT "eni_free_mem overflow (0x%lx,%d)\n",start, + printk(KERN_ALERT "eni_free_mem overflow (%p,%d)\n",start, order); return; } @@ -333,7 +333,7 @@ printk(KERN_ALERT " host descr 0x%lx, rx pos 0x%lx, descr value " "0x%x\n",eni_vcc->descr,eni_vcc->rx_pos, (unsigned) readl(eni_vcc->recv+eni_vcc->descr*4)); - printk(KERN_ALERT " last 0x%p, servicing %d\n",eni_vcc->last, + printk(KERN_ALERT " last %p, servicing %d\n",eni_vcc->last, eni_vcc->servicing); EVENT("---dump ends here---\n",0,0); printk(KERN_NOTICE "---recent events---\n"); @@ -617,7 +617,8 @@ static inline int rx_vcc(struct atm_vcc *vcc) { - unsigned long vci_dsc,tmp; + void __iomem *vci_dsc; + unsigned long tmp; struct eni_vcc *eni_vcc; eni_vcc = ENI_VCC(vcc); @@ -728,7 +729,7 @@ struct eni_vcc *eni_vcc; struct atm_vcc *vcc; struct sk_buff *skb; - unsigned long vci_dsc; + void __iomem *vci_dsc; int first; eni_dev = ENI_DEV(dev); @@ -808,7 +809,7 @@ static int open_rx_second(struct atm_vcc *vcc) { - unsigned long here; + void __iomem *here; struct eni_dev *eni_dev; struct eni_vcc *eni_vcc; unsigned long size; @@ -840,7 +841,7 @@ static void close_rx(struct atm_vcc *vcc) { DECLARE_WAITQUEUE(wait,current); - unsigned long here; + void __iomem *here; struct eni_dev *eni_dev; struct eni_vcc *eni_vcc; @@ -1289,7 +1290,8 @@ struct eni_dev *eni_dev = ENI_DEV(vcc->dev); struct eni_vcc *eni_vcc = ENI_VCC(vcc); struct eni_tx *tx; - unsigned long size,mem; + unsigned long size; + void __iomem *mem; int rate,ubr,unlimited,new_tx; int pre,res,order; int error; @@ -1687,9 +1689,9 @@ #undef GET_SEPROM -static int __devinit get_esi_fpga(struct atm_dev *dev,unsigned long base) +static int __devinit get_esi_fpga(struct atm_dev *dev, void __iomem *base) { - unsigned long mac_base; + void __iomem *mac_base; int i; mac_base = base+EPROM_SIZE-sizeof(struct midway_eprom); @@ -1703,7 +1705,8 @@ struct midway_eprom *eprom; struct eni_dev *eni_dev; struct pci_dev *pci_dev; - unsigned long real_base,base; + unsigned long real_base; + void __iomem *base; unsigned char revision; int error,i,last; @@ -1730,13 +1733,13 @@ } printk(KERN_NOTICE DEV_LABEL "(itf %d): rev.%d,base=0x%lx,irq=%d,", dev->number,revision,real_base,eni_dev->irq); - if (!(base = (unsigned long) ioremap_nocache(real_base,MAP_MAX_SIZE))) { + if (!(base = ioremap_nocache(real_base,MAP_MAX_SIZE))) { printk("\n"); printk(KERN_ERR DEV_LABEL "(itf %d): can't set up page " "mapping\n",dev->number); return error; } - eni_dev->base_diff = real_base-base; + eni_dev->base_diff = real_base - (unsigned long) base; /* id may not be present in ASIC Tonga boards - check this @@@ */ if (!eni_dev->asic) { eprom = (struct midway_eprom *) (base+EPROM_SIZE-sizeof(struct @@ -1790,7 +1793,9 @@ static int __devinit eni_start(struct atm_dev *dev) { struct eni_dev *eni_dev; - unsigned long buf,buffer_mem; + + void __iomem *buf; + unsigned long buffer_mem; int error; DPRINTK(">eni_start\n"); @@ -1828,7 +1833,7 @@ tasklet_init(&eni_dev->task,eni_tasklet,(unsigned long) dev); eni_dev->events = 0; /* initialize memory management */ - buffer_mem = eni_dev->mem-(buf-eni_dev->ram); + buffer_mem = eni_dev->mem - (buf - eni_dev->ram); eni_dev->free_list_size = buffer_mem/MID_MIN_BUF_SIZE/2; eni_dev->free_list = (struct eni_free *) kmalloc( sizeof(struct eni_free)*(eni_dev->free_list_size+1),GFP_KERNEL); @@ -1955,7 +1960,7 @@ */ tasklet_disable(&eni_dev->task); skb_queue_walk(&eni_dev->tx_queue, skb) { - unsigned long dsc; + void __iomem *dsc; if (ATM_SKB(skb)->vcc != vcc) continue; dsc = tx->send+ENI_PRV_POS(skb)*4; @@ -2136,9 +2141,9 @@ if (!tx->send) continue; if (!--left) { - return sprintf(page,"tx[%d]: 0x%06lx-0x%06lx " + return sprintf(page,"tx[%d]: 0x%ld-0x%ld " "(%6ld bytes), rsv %d cps, shp %d cps%s\n",i, - tx->send-eni_dev->ram, + (unsigned long) (tx->send - eni_dev->ram), tx->send-eni_dev->ram+tx->words*4-1,tx->words*4, tx->reserved,tx->shaping, tx == eni_dev->ubr ? " (UBR)" : ""); @@ -2162,9 +2167,9 @@ if (--left) continue; length = sprintf(page,"vcc %4d: ",vcc->vci); if (eni_vcc->rx) { - length += sprintf(page+length,"0x%06lx-0x%06lx " + length += sprintf(page+length,"0x%ld-0x%ld " "(%6ld bytes)", - eni_vcc->recv-eni_dev->ram, + (unsigned long) (eni_vcc->recv - eni_dev->ram), eni_vcc->recv-eni_dev->ram+eni_vcc->words*4-1, eni_vcc->words*4); if (eni_vcc->tx) length += sprintf(page+length,", "); @@ -2183,8 +2188,8 @@ unsigned long offset; if (--left) continue; - offset = eni_dev->ram+eni_dev->base_diff; - return sprintf(page,"free 0x%06lx-0x%06lx (%6d bytes)\n", + offset = (unsigned long) eni_dev->ram+eni_dev->base_diff; + return sprintf(page,"free %p-%p (%6d bytes)\n", fe->start-offset,fe->start-offset+(1 << fe->order)-1, 1 << fe->order); } diff -Nru a/drivers/atm/eni.h b/drivers/atm/eni.h --- a/drivers/atm/eni.h 2004-09-26 10:25:56 -07:00 +++ b/drivers/atm/eni.h 2004-09-26 10:25:56 -07:00 @@ -33,12 +33,12 @@ struct eni_free { - unsigned long start; /* counting in bytes */ + void __iomem *start; /* counting in bytes */ int order; }; struct eni_tx { - unsigned long send; /* base, 0 if unused */ + void __iomem *send; /* base, 0 if unused */ int prescaler; /* shaping prescaler */ int resolution; /* shaping divider */ unsigned long tx_pos; /* current TX write position */ @@ -51,7 +51,7 @@ struct eni_vcc { int (*rx)(struct atm_vcc *vcc); /* RX function, NULL if none */ - unsigned long recv; /* receive buffer */ + void __iomem *recv; /* receive buffer */ unsigned long words; /* its size in words */ unsigned long descr; /* next descriptor (RX) */ unsigned long rx_pos; /* current RX descriptor pos */ @@ -72,13 +72,13 @@ u32 events; /* pending events */ /*-------------------------------- base pointers into Midway address space */ - unsigned long phy; /* PHY interface chip registers */ - unsigned long reg; /* register base */ - unsigned long ram; /* RAM base */ - unsigned long vci; /* VCI table */ - unsigned long rx_dma; /* RX DMA queue */ - unsigned long tx_dma; /* TX DMA queue */ - unsigned long service; /* service list */ + void __iomem *phy; /* PHY interface chip registers */ + void __iomem *reg; /* register base */ + void __iomem *ram; /* RAM base */ + void __iomem *vci; /* VCI table */ + void __iomem *rx_dma; /* RX DMA queue */ + void __iomem *tx_dma; /* TX DMA queue */ + void __iomem *service; /* service list */ /*-------------------------------- TX part */ struct eni_tx tx[NR_CHAN]; /* TX channels */ struct eni_tx *ubr; /* UBR channel */ diff -Nru a/drivers/atm/firestream.c b/drivers/atm/firestream.c --- a/drivers/atm/firestream.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/atm/firestream.c 2004-09-26 10:25:55 -07:00 @@ -1667,7 +1667,7 @@ dev->hw_base = pci_resource_start(pci_dev, 0); - dev->base = (ulong) ioremap(dev->hw_base, 0x1000); + dev->base = ioremap(dev->hw_base, 0x1000); reset_chip (dev); @@ -1704,8 +1704,7 @@ } /* Try again after 10ms. */ - set_current_state(TASK_UNINTERRUPTIBLE); - schedule_timeout ((HZ+99)/100); + msleep(10); } if (!to) { diff -Nru a/drivers/atm/firestream.h b/drivers/atm/firestream.h --- a/drivers/atm/firestream.h 2004-09-26 10:25:57 -07:00 +++ b/drivers/atm/firestream.h 2004-09-26 10:25:57 -07:00 @@ -477,7 +477,7 @@ struct timer_list timer; unsigned long hw_base; /* mem base address */ - unsigned long base; /* Mapping of base address */ + void __iomem *base; /* Mapping of base address */ int channo; unsigned long channel_mask; diff -Nru a/drivers/atm/fore200e.h b/drivers/atm/fore200e.h --- a/drivers/atm/fore200e.h 2004-09-26 10:25:56 -07:00 +++ b/drivers/atm/fore200e.h 2004-09-26 10:25:56 -07:00 @@ -565,7 +565,7 @@ typedef struct chunk { void* alloc_addr; /* base address of allocated chunk */ void* align_addr; /* base address of aligned chunk */ - u32 dma_addr; /* DMA address of aligned chunk */ + dma_addr_t dma_addr; /* DMA address of aligned chunk */ int direction; /* direction of DMA mapping */ u32 alloc_size; /* length of allocated chunk */ u32 align_size; /* length of aligned chunk */ diff -Nru a/drivers/atm/he.c b/drivers/atm/he.c --- a/drivers/atm/he.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/atm/he.c 2004-09-26 10:25:55 -07:00 @@ -1007,6 +1007,7 @@ { struct he_dev *he_dev; struct pci_dev *pci_dev; + unsigned long membase; u16 command; u32 gen_cntl_0, host_cntl, lb_swap; @@ -1019,8 +1020,8 @@ he_dev = HE_DEV(dev); pci_dev = he_dev->pci_dev; - he_dev->membase = pci_dev->resource[0].start; - HPRINTK("membase = 0x%lx irq = %d.\n", he_dev->membase, pci_dev->irq); + membase = pci_resource_start(pci_dev, 0); + HPRINTK("membase = 0x%lx irq = %d.\n", membase, pci_dev->irq); /* * pci bus controller initialization @@ -1080,7 +1081,7 @@ hprintk("can't set latency timer to %d\n", timer); } - if (!(he_dev->membase = (unsigned long) ioremap(he_dev->membase, HE_REGMAP_SIZE))) { + if (!(he_dev->membase = ioremap(membase, HE_REGMAP_SIZE))) { hprintk("can't set up page mapping\n"); return -EINVAL; } @@ -1962,7 +1963,7 @@ struct he_tpd *tpd; int slot, updated = 0; #ifdef USE_TPD_POOL - struct list_head *p; + struct he_tpd *__tpd; #endif /* 2.1.6 transmit buffer return queue */ @@ -1977,8 +1978,7 @@ TBRQ_MULTIPLE(he_dev->tbrq_head) ? " MULTIPLE" : ""); #ifdef USE_TPD_POOL tpd = NULL; - list_for_each(p, &he_dev->outstanding_tpds) { - struct he_tpd *__tpd = list_entry(p, struct he_tpd, entry); + list_for_each_entry(__tpd, &he_dev->outstanding_tpds, entry) { if (TPD_ADDR(__tpd->status) == TBRQ_TPD(he_dev->tbrq_head)) { tpd = __tpd; list_del(&__tpd->entry); @@ -2595,9 +2595,8 @@ while (((tx_inuse = atomic_read(&vcc->sk->sk_wmem_alloc)) > 0) && (retry < MAX_RETRY)) { - set_current_state(TASK_UNINTERRUPTIBLE); - (void) schedule_timeout(sleep); - if (sleep < HZ) + msleep(sleep); + if (sleep < 250) sleep = sleep * 2; ++retry; diff -Nru a/drivers/atm/he.h b/drivers/atm/he.h --- a/drivers/atm/he.h 2004-09-26 10:25:56 -07:00 +++ b/drivers/atm/he.h 2004-09-26 10:25:56 -07:00 @@ -265,7 +265,7 @@ struct he_dev { unsigned int number; unsigned int irq; - unsigned long membase; + void __iomem *membase; char prod_id[30]; char mac_addr[6]; diff -Nru a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c --- a/drivers/atm/idt77252.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/atm/idt77252.c 2004-09-26 10:25:56 -07:00 @@ -2516,7 +2516,7 @@ struct vc_map *vc = vcc->dev_data; unsigned long flags; unsigned long addr; - int timeout; + unsigned long timeout; down(&card->mutex); @@ -2566,9 +2566,9 @@ } spin_unlock_irqrestore(&vc->lock, flags); - timeout = 5 * HZ; + timeout = 5 * 1000; while (atomic_read(&vc->scq->used) > 0) { - timeout = schedule_timeout(timeout); + timeout = msleep_interruptible(timeout); if (!timeout) break; } @@ -3164,7 +3164,7 @@ for (i = 0; i < 4; i++) { if (card->fbq[i]) - iounmap((void *) card->fbq[i]); + iounmap(card->fbq[i]); } if (card->membase) @@ -3722,7 +3722,7 @@ card->tst_timer.function = tst_timer; /* Do the I/O remapping... */ - card->membase = (unsigned long) ioremap(membase, 1024); + card->membase = ioremap(membase, 1024); if (!card->membase) { printk("%s: can't ioremap() membase\n", card->name); err = -EIO; @@ -3756,8 +3756,7 @@ card->sramsize = probe_sram(card); for (i = 0; i < 4; i++) { - card->fbq[i] = (unsigned long) - ioremap(srambase | 0x200000 | (i << 18), 4); + card->fbq[i] = ioremap(srambase | 0x200000 | (i << 18), 4); if (!card->fbq[i]) { printk("%s: can't ioremap() FBQ%d\n", card->name, i); err = -EIO; diff -Nru a/drivers/atm/idt77252.h b/drivers/atm/idt77252.h --- a/drivers/atm/idt77252.h 2004-09-26 10:25:57 -07:00 +++ b/drivers/atm/idt77252.h 2004-09-26 10:25:57 -07:00 @@ -355,9 +355,9 @@ struct pci_dev *pcidev; /* PCI handle (desriptor) */ struct atm_dev *atmdev; /* ATM device desriptor */ - unsigned long membase; /* SAR's memory base address */ + void __iomem *membase; /* SAR's memory base address */ unsigned long srambase; /* SAR's sram base address */ - unsigned long fbq[4]; /* FBQ fill addresses */ + void __iomem *fbq[4]; /* FBQ fill addresses */ struct semaphore mutex; spinlock_t cmd_lock; /* for r/w utility/sram */ diff -Nru a/drivers/atm/lanai.c b/drivers/atm/lanai.c --- a/drivers/atm/lanai.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/atm/lanai.c 2004-09-26 10:25:55 -07:00 @@ -191,7 +191,7 @@ #define LANAI_EEPROM_SIZE (128) typedef int vci_t; -typedef unsigned long bus_addr_t; +typedef void __iomem *bus_addr_t; /* DMA buffer in host memory for TX, RX, or service list. */ struct lanai_buffer { @@ -471,7 +471,7 @@ static inline bus_addr_t reg_addr(const struct lanai_dev *lanai, enum lanai_register reg) { - return lanai->base + (bus_addr_t) reg; + return lanai->base + reg; } static inline u32 reg_read(const struct lanai_dev *lanai, @@ -651,7 +651,7 @@ { u32 val; APRINTK(lvcc->vbase != 0, "cardvcc_read: unbound vcc!\n"); - val= readl(lvcc->vbase + (bus_addr_t) offset); + val= readl(lvcc->vbase + offset); RWDEBUG("VR vci=%04d 0x%02X = 0x%08X\n", lvcc->vci, (int) offset, val); return val; @@ -666,7 +666,7 @@ (unsigned int) val, lvcc->vci, (unsigned int) offset); RWDEBUG("VW vci=%04d 0x%02X > 0x%08X\n", lvcc->vci, (unsigned int) offset, (unsigned int) val); - writel(val, lvcc->vbase + (bus_addr_t) offset); + writel(val, lvcc->vbase + offset); } /* -------------------- COMPUTE SIZE OF AN AAL5 PDU: */ @@ -813,7 +813,7 @@ DPRINTK("read, write = %d, %d\n", read, write); break; } - schedule_timeout(HZ / 25); + msleep(40); } /* 15.2.2 - clear out all tx registers */ cardvcc_write(lvcc, 0, vcc_txreadptr); @@ -2177,7 +2177,7 @@ /* 3.2: PCI initialization */ if ((result = lanai_pci_start(lanai)) != 0) goto error; - raw_base = (bus_addr_t) lanai->pci->resource[0].start; + raw_base = lanai->pci->resource[0].start; lanai->base = (bus_addr_t) ioremap(raw_base, LANAI_MAPPING_SIZE); if (lanai->base == 0) { printk(KERN_ERR DEV_LABEL ": couldn't remap I/O space\n"); diff -Nru a/drivers/atm/nicstar.c b/drivers/atm/nicstar.c --- a/drivers/atm/nicstar.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/atm/nicstar.c 2004-09-26 10:25:55 -07:00 @@ -467,6 +467,7 @@ u32 u32d[4]; u32 ns_cfg_rctsize; int bcount; + unsigned long membase; error = 0; @@ -494,8 +495,8 @@ card->index = i; card->atmdev = NULL; card->pcidev = pcidev; - card->membase = pci_resource_start(pcidev, 1); - card->membase = (unsigned long) ioremap(card->membase, NS_IOREMAP_SIZE); + membase = pci_resource_start(pcidev, 1); + card->membase = ioremap(membase, NS_IOREMAP_SIZE); if (card->membase == 0) { printk("nicstar%d: can't ioremap() membase.\n",i); diff -Nru a/drivers/atm/nicstar.h b/drivers/atm/nicstar.h --- a/drivers/atm/nicstar.h 2004-09-26 10:25:55 -07:00 +++ b/drivers/atm/nicstar.h 2004-09-26 10:25:55 -07:00 @@ -763,7 +763,7 @@ { int index; /* Card ID to the device driver */ int sram_size; /* In k x 32bit words. 32 or 128 */ - unsigned long membase; /* Card's memory base address */ + void __iomem *membase; /* Card's memory base address */ unsigned long max_pcr; int rct_size; /* Number of entries */ int vpibits; diff -Nru a/drivers/atm/nicstarmac.c b/drivers/atm/nicstarmac.c --- a/drivers/atm/nicstarmac.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/atm/nicstarmac.c 2004-09-26 10:25:57 -07:00 @@ -162,7 +162,7 @@ */ static u_int8_t -read_eprom_byte(u_int32_t base, u_int8_t offset) +read_eprom_byte(virt_addr_t base, u_int8_t offset) { u_int32_t val = 0; int i,j=0; diff -Nru a/drivers/atm/nicstarmac.h b/drivers/atm/nicstarmac.h --- a/drivers/atm/nicstarmac.h 2004-09-26 10:25:55 -07:00 +++ b/drivers/atm/nicstarmac.h 2004-09-26 10:25:55 -07:00 @@ -7,7 +7,7 @@ ******************************************************************************/ -typedef unsigned int virt_addr_t; +typedef void __iomem *virt_addr_t; u_int32_t nicstar_read_eprom_status( virt_addr_t base ); void nicstar_init_eprom( virt_addr_t base ); diff -Nru a/drivers/block/amiflop.c b/drivers/block/amiflop.c --- a/drivers/block/amiflop.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/block/amiflop.c 2004-09-26 10:25:56 -07:00 @@ -386,16 +386,6 @@ fd_select(drive); udelay (1); fd_deselect(drive); - -#ifdef MODULE -/* - this is the last interrupt for any drive access, happens after - release (from floppy_off). So we have to wait until now to decrease - the use count. -*/ - if (decusecount) - MOD_DEC_USE_COUNT; -#endif } static void floppy_off (unsigned int nr) @@ -1590,10 +1580,6 @@ local_irq_save(flags); fd_ref[drive]++; fd_device[drive] = system; -#ifdef MODULE - if (unit[drive].motor == 0) - MOD_INC_USE_COUNT; -#endif local_irq_restore(flags); unit[drive].dtype=&data_types[system]; @@ -1839,6 +1825,7 @@ return amiga_floppy_init(); } +#if 0 /* not safe to unload */ void cleanup_module(void) { int i; @@ -1859,4 +1846,5 @@ release_mem_region(CUSTOM_PHYSADDR+0x20, 8); unregister_blkdev(FLOPPY_MAJOR, "fd"); } +#endif #endif diff -Nru a/drivers/block/genhd.c b/drivers/block/genhd.c --- a/drivers/block/genhd.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/block/genhd.c 2004-09-26 10:25:56 -07:00 @@ -365,7 +365,9 @@ static ssize_t disk_stats_read(struct gendisk * disk, char *page) { + preempt_disable(); disk_round_stats(disk); + preempt_enable(); return sprintf(page, "%8u %8u %8llu %8u " "%8u %8u %8llu %8u " @@ -494,7 +496,9 @@ "\n\n"); */ + preempt_disable(); disk_round_stats(gp); + preempt_enable(); seq_printf(s, "%4d %4d %s %u %u %llu %u %u %u %llu %u %u %u %u\n", gp->major, n + gp->first_minor, disk_name(gp, n, buf), disk_stat_read(gp, reads), disk_stat_read(gp, read_merges), diff -Nru a/drivers/block/ll_rw_blk.c b/drivers/block/ll_rw_blk.c --- a/drivers/block/ll_rw_blk.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/block/ll_rw_blk.c 2004-09-26 10:25:55 -07:00 @@ -352,7 +352,7 @@ printk("%s: set to minimum %d\n", __FUNCTION__, max_sectors); } - q->max_sectors = max_sectors; + q->max_sectors = q->max_hw_sectors = max_sectors; } EXPORT_SYMBOL(blk_queue_max_sectors); @@ -454,7 +454,8 @@ void blk_queue_stack_limits(request_queue_t *t, request_queue_t *b) { /* zero is "infinity" */ - t->max_sectors = min_not_zero(t->max_sectors,b->max_sectors); + t->max_sectors = t->max_hw_sectors = + min_not_zero(t->max_sectors,b->max_sectors); t->max_phys_segments = min(t->max_phys_segments,b->max_phys_segments); t->max_hw_segments = min(t->max_hw_segments,b->max_hw_segments); @@ -2583,11 +2584,11 @@ break; } - if (unlikely(bio_sectors(bio) > q->max_sectors)) { + if (unlikely(bio_sectors(bio) > q->max_hw_sectors)) { printk("bio too big device %s (%u > %u)\n", bdevname(bio->bi_bdev, b), bio_sectors(bio), - q->max_sectors); + q->max_hw_sectors); goto end_io; } @@ -3206,13 +3207,61 @@ unsigned long ra_kb; ssize_t ret = queue_var_store(&ra_kb, page, count); + spin_lock_irq(q->queue_lock); if (ra_kb > (q->max_sectors >> 1)) ra_kb = (q->max_sectors >> 1); q->backing_dev_info.ra_pages = ra_kb >> (PAGE_CACHE_SHIFT - 10); + spin_unlock_irq(q->queue_lock); + + return ret; +} + +static ssize_t queue_max_sectors_show(struct request_queue *q, char *page) +{ + int max_sectors_kb = q->max_sectors >> 1; + + return queue_var_show(max_sectors_kb, (page)); +} + +static ssize_t +queue_max_sectors_store(struct request_queue *q, const char *page, size_t count) +{ + unsigned long max_sectors_kb, + max_hw_sectors_kb = q->max_hw_sectors >> 1, + page_kb = 1 << (PAGE_CACHE_SHIFT - 10); + ssize_t ret = queue_var_store(&max_sectors_kb, page, count); + int ra_kb; + + if (max_sectors_kb > max_hw_sectors_kb || max_sectors_kb < page_kb) + return -EINVAL; + /* + * Take the queue lock to update the readahead and max_sectors + * values synchronously: + */ + spin_lock_irq(q->queue_lock); + /* + * Trim readahead window as well, if necessary: + */ + ra_kb = q->backing_dev_info.ra_pages << (PAGE_CACHE_SHIFT - 10); + if (ra_kb > max_sectors_kb) + q->backing_dev_info.ra_pages = + max_sectors_kb >> (PAGE_CACHE_SHIFT - 10); + + q->max_sectors = max_sectors_kb << 1; + spin_unlock_irq(q->queue_lock); + return ret; } +static ssize_t queue_max_hw_sectors_show(struct request_queue *q, char *page) +{ + int max_hw_sectors_kb = q->max_hw_sectors >> 1; + + return queue_var_show(max_hw_sectors_kb, (page)); +} + + static struct queue_sysfs_entry queue_requests_entry = { .attr = {.name = "nr_requests", .mode = S_IRUGO | S_IWUSR }, .show = queue_requests_show, @@ -3225,9 +3274,22 @@ .store = queue_ra_store, }; +static struct queue_sysfs_entry queue_max_sectors_entry = { + .attr = {.name = "max_sectors_kb", .mode = S_IRUGO | S_IWUSR }, + .show = queue_max_sectors_show, + .store = queue_max_sectors_store, +}; + +static struct queue_sysfs_entry queue_max_hw_sectors_entry = { + .attr = {.name = "max_hw_sectors_kb", .mode = S_IRUGO }, + .show = queue_max_hw_sectors_show, +}; + static struct attribute *default_attrs[] = { &queue_requests_entry.attr, &queue_ra_entry.attr, + &queue_max_hw_sectors_entry.attr, + &queue_max_sectors_entry.attr, NULL, }; diff -Nru a/drivers/bluetooth/hci_usb.c b/drivers/bluetooth/hci_usb.c --- a/drivers/bluetooth/hci_usb.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/bluetooth/hci_usb.c 2004-09-26 10:25:57 -07:00 @@ -96,7 +96,7 @@ { USB_DEVICE(0x0a5c, 0x2033), .driver_info = HCI_IGNORE }, /* Broadcom BCM2035 */ - { USB_DEVICE(0x0a5c, 0x200a), .driver_info = HCI_RESET }, + { USB_DEVICE(0x0a5c, 0x200a), .driver_info = HCI_RESET | HCI_BROKEN_ISOC }, /* ISSC Bluetooth Adapter v3.1 */ { USB_DEVICE(0x1131, 0x1001), .driver_info = HCI_RESET }, diff -Nru a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c --- a/drivers/cdrom/cdrom.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/cdrom/cdrom.c 2004-09-26 10:25:55 -07:00 @@ -1933,7 +1933,8 @@ int lba, int nframes) { struct packet_command cgc; - int nr, ret; + int ret = 0; + int nr; cdi->last_sense = 0; @@ -1955,8 +1956,8 @@ return -ENOMEM; if (!access_ok(VERIFY_WRITE, ubuf, nframes * CD_FRAMESIZE_RAW)) { - kfree(cgc.buffer); - return -EFAULT; + ret = -EFAULT; + goto out; } cgc.data_direction = CGC_DATA_READ; @@ -1967,13 +1968,17 @@ ret = cdrom_read_block(cdi, &cgc, lba, nr, 1, CD_FRAMESIZE_RAW); if (ret) break; - __copy_to_user(ubuf, cgc.buffer, CD_FRAMESIZE_RAW * nr); + if (__copy_to_user(ubuf, cgc.buffer, CD_FRAMESIZE_RAW * nr)) { + ret = -EFAULT; + break; + } ubuf += CD_FRAMESIZE_RAW * nr; nframes -= nr; lba += nr; } +out: kfree(cgc.buffer); - return 0; + return ret; } static int cdrom_read_cdda_bpc(struct cdrom_device_info *cdi, __u8 __user *ubuf, diff -Nru a/drivers/char/Kconfig b/drivers/char/Kconfig --- a/drivers/char/Kconfig 2004-09-26 10:25:55 -07:00 +++ b/drivers/char/Kconfig 2004-09-26 10:25:55 -07:00 @@ -59,7 +59,7 @@ config HW_CONSOLE bool - depends on VT && !S390 && !UM + depends on VT && !S390 && !USERMODE default y config SERIAL_NONSTANDARD @@ -980,6 +980,14 @@ The hangcheck-timer module detects when the system has gone out to lunch past a certain margin. It can reboot the system or merely print a warning. + +config MMTIMER + tristate "MMTIMER Memory mapped RTC for SGI Altix" + depends on IA64_GENERIC || IA64_SGI_SN2 + default y + help + The mmtimer device allows direct userspace access to the + Altix system timer. endmenu diff -Nru a/drivers/char/Makefile b/drivers/char/Makefile --- a/drivers/char/Makefile 2004-09-26 10:25:57 -07:00 +++ b/drivers/char/Makefile 2004-09-26 10:25:57 -07:00 @@ -45,6 +45,7 @@ obj-$(CONFIG_HVC_CONSOLE) += hvc_console.o hvsi.o obj-$(CONFIG_RAW_DRIVER) += raw.o obj-$(CONFIG_SGI_SNSC) += snsc.o +obj-$(CONFIG_MMTIMER) += mmtimer.o obj-$(CONFIG_VIOCONS) += viocons.o obj-$(CONFIG_VIOTAPE) += viotape.o obj-$(CONFIG_HVCS) += hvcs.o diff -Nru a/drivers/char/applicom.c b/drivers/char/applicom.c --- a/drivers/char/applicom.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/char/applicom.c 2004-09-26 10:25:57 -07:00 @@ -89,7 +89,7 @@ static struct applicom_board { unsigned long PhysIO; - unsigned long RamIO; + void __iomem *RamIO; wait_queue_head_t FlagSleepSend; long irq; spinlock_t mutex; @@ -127,7 +127,7 @@ static int dummy; /* dev_id for request_irq() */ -static int ac_register_board(unsigned long physloc, unsigned long loc, +static int ac_register_board(unsigned long physloc, void __iomem *loc, unsigned char boardno) { volatile unsigned char byte_reset_it; @@ -179,11 +179,11 @@ if (!apbs[i].RamIO) continue; - - iounmap((void *) apbs[i].RamIO); if (apbs[i].irq) free_irq(apbs[i].irq, &dummy); + + iounmap(apbs[i].RamIO); } } @@ -193,7 +193,7 @@ { int i, numisa = 0; struct pci_dev *dev = NULL; - void *RamIO; + void __iomem *RamIO; int boardno; printk(KERN_INFO "Applicom driver: $Id: ac.c,v 1.30 2000/03/22 16:03:57 dwmw2 Exp $\n"); @@ -223,8 +223,8 @@ applicom_pci_devnames[dev->device-1], dev->resource[0].start, dev->irq); - if (!(boardno = ac_register_board(dev->resource[0].start, - (unsigned long)RamIO,0))) { + boardno = ac_register_board(dev->resource[0].start, RamIO,0); + if (!boardno) { printk(KERN_INFO "ac.o: PCI Applicom device doesn't have correct signature.\n"); iounmap(RamIO); pci_disable_device(dev); @@ -235,7 +235,7 @@ printk(KERN_INFO "Could not allocate IRQ %d for PCI Applicom device.\n", dev->irq); iounmap(RamIO); pci_disable_device(dev); - apbs[boardno - 1].RamIO = 0; + apbs[boardno - 1].RamIO = NULL; continue; } @@ -270,7 +270,7 @@ } if (!(boardno = ac_register_board((unsigned long)mem+ (LEN_RAM_IO*i), - (unsigned long)RamIO,i+1))) { + RamIO,i+1))) { iounmap(RamIO); continue; } @@ -280,8 +280,8 @@ if (!numisa) { if (request_irq(irq, &ac_interrupt, SA_SHIRQ, "Applicom ISA", &dummy)) { printk(KERN_WARNING "Could not allocate IRQ %d for ISA Applicom device.\n", irq); - iounmap((void *) RamIO); - apbs[boardno - 1].RamIO = 0; + iounmap(RamIO); + apbs[boardno - 1].RamIO = NULL; } else apbs[boardno - 1].irq = irq; @@ -449,7 +449,7 @@ because it works with 2.2 still */ { unsigned char *from = (unsigned char *) &tmpmailbox; - unsigned long to = (unsigned long) apbs[IndexCard].RamIO + RAM_FROM_PC; + void __iomem *to = apbs[IndexCard].RamIO + RAM_FROM_PC; int c; for (c = 0; c < sizeof(struct mailbox); c++) @@ -470,7 +470,7 @@ static int do_ac_read(int IndexCard, char __user *buf, struct st_ram_io *st_loc, struct mailbox *mailbox) { - unsigned long from = (unsigned long)apbs[IndexCard].RamIO + RAM_TO_PC; + void __iomem *from = apbs[IndexCard].RamIO + RAM_TO_PC; unsigned char *to = (unsigned char *)&mailbox; #ifdef DEBUG int c; @@ -685,7 +685,7 @@ { /* @ ADG ou ATO selon le cas */ int i; unsigned char IndexCard; - unsigned long pmem; + void __iomem *pmem; int ret = 0; volatile unsigned char byte_reset_it; struct st_ram_io *adgl; diff -Nru a/drivers/char/drm/drm_drv.h b/drivers/char/drm/drm_drv.h --- a/drivers/char/drm/drm_drv.h 2004-09-26 10:25:57 -07:00 +++ b/drivers/char/drm/drm_drv.h 2004-09-26 10:25:57 -07:00 @@ -52,10 +52,6 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -#ifndef __HAVE_COUNTERS -#define __HAVE_COUNTERS 0 -#endif - #ifndef DRIVER_IOCTLS #define DRIVER_IOCTLS #endif @@ -195,41 +191,6 @@ return i; } - dev->counters = 6 + __HAVE_COUNTERS; - dev->types[0] = _DRM_STAT_LOCK; - dev->types[1] = _DRM_STAT_OPENS; - dev->types[2] = _DRM_STAT_CLOSES; - dev->types[3] = _DRM_STAT_IOCTLS; - dev->types[4] = _DRM_STAT_LOCKS; - dev->types[5] = _DRM_STAT_UNLOCKS; -#ifdef __HAVE_COUNTER6 - dev->types[6] = __HAVE_COUNTER6; -#endif -#ifdef __HAVE_COUNTER7 - dev->types[7] = __HAVE_COUNTER7; -#endif -#ifdef __HAVE_COUNTER8 - dev->types[8] = __HAVE_COUNTER8; -#endif -#ifdef __HAVE_COUNTER9 - dev->types[9] = __HAVE_COUNTER9; -#endif -#ifdef __HAVE_COUNTER10 - dev->types[10] = __HAVE_COUNTER10; -#endif -#ifdef __HAVE_COUNTER11 - dev->types[11] = __HAVE_COUNTER11; -#endif -#ifdef __HAVE_COUNTER12 - dev->types[12] = __HAVE_COUNTER12; -#endif -#ifdef __HAVE_COUNTER13 - dev->types[13] = __HAVE_COUNTER13; -#endif -#ifdef __HAVE_COUNTER14 - dev->types[14] = __HAVE_COUNTER14; -#endif - for ( i = 0 ; i < DRM_ARRAY_SIZE(dev->counts) ; i++ ) atomic_set( &dev->counts[i], 0 ); @@ -480,6 +441,9 @@ if (DRM(numdevs) >= MAX_DEVICES) return -ENODEV; + if ((retcode=pci_enable_device(pdev))) + return retcode; + dev = &(DRM(device)[DRM(numdevs)]); memset( (void *)dev, 0, sizeof(*dev) ); @@ -507,7 +471,16 @@ /* dev_priv_size can be changed by a driver in driver_register_fns */ dev->dev_priv_size = sizeof(u32); - + + /* the DRM has 6 basic counters - drivers add theirs in register_fns */ + dev->counters = 6; + dev->types[0] = _DRM_STAT_LOCK; + dev->types[1] = _DRM_STAT_OPENS; + dev->types[2] = _DRM_STAT_CLOSES; + dev->types[3] = _DRM_STAT_IOCTLS; + dev->types[4] = _DRM_STAT_LOCKS; + dev->types[5] = _DRM_STAT_UNLOCKS; + DRM(init_fn_table)(dev); DRM(driver_register_fns)(dev); @@ -785,7 +758,7 @@ add_wait_queue( &dev->lock.lock_queue, &entry ); for (;;) { - current->state = TASK_INTERRUPTIBLE; + __set_current_state(TASK_INTERRUPTIBLE); if ( !dev->lock.hw_lock ) { /* Device has been unregistered */ retcode = -EINTR; @@ -805,7 +778,7 @@ break; } } - current->state = TASK_RUNNING; + __set_current_state(TASK_RUNNING); remove_wait_queue( &dev->lock.lock_queue, &entry ); if( !retcode ) { if (dev->fn_tbl.release) @@ -985,7 +958,7 @@ add_wait_queue( &dev->lock.lock_queue, &entry ); for (;;) { - current->state = TASK_INTERRUPTIBLE; + __set_current_state(TASK_INTERRUPTIBLE); if ( !dev->lock.hw_lock ) { /* Device has been unregistered */ ret = -EINTR; @@ -1006,7 +979,7 @@ break; } } - current->state = TASK_RUNNING; + __set_current_state(TASK_RUNNING); remove_wait_queue( &dev->lock.lock_queue, &entry ); sigemptyset( &dev->sigmask ); diff -Nru a/drivers/char/drm/drm_os_linux.h b/drivers/char/drm/drm_os_linux.h --- a/drivers/char/drm/drm_os_linux.h 2004-09-26 10:25:57 -07:00 +++ b/drivers/char/drm/drm_os_linux.h 2004-09-26 10:25:57 -07:00 @@ -134,7 +134,7 @@ add_wait_queue(&(queue), &entry); \ \ for (;;) { \ - current->state = TASK_INTERRUPTIBLE; \ + __set_current_state(TASK_INTERRUPTIBLE); \ if (condition) \ break; \ if (time_after_eq(jiffies, end)) { \ @@ -147,7 +147,7 @@ break; \ } \ } \ - current->state = TASK_RUNNING; \ + __set_current_state(TASK_RUNNING); \ remove_wait_queue(&(queue), &entry); \ } while (0) diff -Nru a/drivers/char/drm/drm_scatter.h b/drivers/char/drm/drm_scatter.h --- a/drivers/char/drm/drm_scatter.h 2004-09-26 10:25:56 -07:00 +++ b/drivers/char/drm/drm_scatter.h 2004-09-26 10:25:56 -07:00 @@ -73,7 +73,7 @@ DRM_DEBUG( "%s\n", __FUNCTION__ ); - if (drm_core_check_feature(dev, DRIVER_SG)) + if (!drm_core_check_feature(dev, DRIVER_SG)) return -EINVAL; if ( dev->sg ) @@ -209,7 +209,7 @@ drm_scatter_gather_t request; drm_sg_mem_t *entry; - if (drm_core_check_feature(dev, DRIVER_SG)) + if (!drm_core_check_feature(dev, DRIVER_SG)) return -EINVAL; if ( copy_from_user( &request, diff -Nru a/drivers/char/drm/i810.h b/drivers/char/drm/i810.h --- a/drivers/char/drm/i810.h 2004-09-26 10:25:56 -07:00 +++ b/drivers/char/drm/i810.h 2004-09-26 10:25:56 -07:00 @@ -74,10 +74,4 @@ [DRM_IOCTL_NR(DRM_IOCTL_I810_RSTATUS)] = { i810_rstatus, 1, 0 }, \ [DRM_IOCTL_NR(DRM_IOCTL_I810_FLIP)] = { i810_flip_bufs, 1, 0 } -#define __HAVE_COUNTERS 4 -#define __HAVE_COUNTER6 _DRM_STAT_IRQ -#define __HAVE_COUNTER7 _DRM_STAT_PRIMARY -#define __HAVE_COUNTER8 _DRM_STAT_SECONDARY -#define __HAVE_COUNTER9 _DRM_STAT_DMA - #endif diff -Nru a/drivers/char/drm/i810_dma.c b/drivers/char/drm/i810_dma.c --- a/drivers/char/drm/i810_dma.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/char/drm/i810_dma.c 2004-09-26 10:25:56 -07:00 @@ -1412,5 +1412,11 @@ dev->fn_tbl.release = i810_driver_release; dev->fn_tbl.dma_quiescent = i810_driver_dma_quiescent; dev->fn_tbl.reclaim_buffers = i810_reclaim_buffers; + + dev->counters += 4; + dev->types[6] = _DRM_STAT_IRQ; + dev->types[7] = _DRM_STAT_PRIMARY; + dev->types[8] = _DRM_STAT_SECONDARY; + dev->types[9] = _DRM_STAT_DMA; } diff -Nru a/drivers/char/drm/i830.h b/drivers/char/drm/i830.h --- a/drivers/char/drm/i830.h 2004-09-26 10:25:56 -07:00 +++ b/drivers/char/drm/i830.h 2004-09-26 10:25:56 -07:00 @@ -73,12 +73,6 @@ [DRM_IOCTL_NR(DRM_IOCTL_I830_GETPARAM)] = { i830_getparam, 1, 0 }, \ [DRM_IOCTL_NR(DRM_IOCTL_I830_SETPARAM)] = { i830_setparam, 1, 0 } -#define __HAVE_COUNTERS 4 -#define __HAVE_COUNTER6 _DRM_STAT_IRQ -#define __HAVE_COUNTER7 _DRM_STAT_PRIMARY -#define __HAVE_COUNTER8 _DRM_STAT_SECONDARY -#define __HAVE_COUNTER9 _DRM_STAT_DMA - /* Driver will work either way: IRQ's save cpu time when waiting for * the card, but are subject to subtle interactions between bios, * hardware and the driver. diff -Nru a/drivers/char/drm/i830_dma.c b/drivers/char/drm/i830_dma.c --- a/drivers/char/drm/i830_dma.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/char/drm/i830_dma.c 2004-09-26 10:25:55 -07:00 @@ -1615,5 +1615,10 @@ dev->fn_tbl.irq_uninstall = i830_driver_irq_uninstall; dev->fn_tbl.irq_handler = i830_driver_irq_handler; #endif + dev->counters += 4; + dev->types[6] = _DRM_STAT_IRQ; + dev->types[7] = _DRM_STAT_PRIMARY; + dev->types[8] = _DRM_STAT_SECONDARY; + dev->types[9] = _DRM_STAT_DMA; } diff -Nru a/drivers/char/drm/i830_irq.c b/drivers/char/drm/i830_irq.c --- a/drivers/char/drm/i830_irq.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/char/drm/i830_irq.c 2004-09-26 10:25:57 -07:00 @@ -92,7 +92,7 @@ add_wait_queue(&dev_priv->irq_queue, &entry); for (;;) { - current->state = TASK_INTERRUPTIBLE; + __set_current_state(TASK_INTERRUPTIBLE); if (atomic_read(&dev_priv->irq_received) >= irq_nr) break; if((signed)(end - jiffies) <= 0) { @@ -112,7 +112,7 @@ } } - current->state = TASK_RUNNING; + __set_current_state(TASK_RUNNING); remove_wait_queue(&dev_priv->irq_queue, &entry); return ret; } diff -Nru a/drivers/char/drm/i915.h b/drivers/char/drm/i915.h --- a/drivers/char/drm/i915.h 2004-09-26 10:25:55 -07:00 +++ b/drivers/char/drm/i915.h 2004-09-26 10:25:55 -07:00 @@ -45,12 +45,6 @@ [DRM_IOCTL_NR(DRM_IOCTL_I915_INIT_HEAP)] = { i915_mem_init_heap, 1, 1 }, \ [DRM_IOCTL_NR(DRM_IOCTL_I915_CMDBUFFER)] = { i915_cmdbuffer, 1, 0 } -#define __HAVE_COUNTERS 4 -#define __HAVE_COUNTER6 _DRM_STAT_IRQ -#define __HAVE_COUNTER7 _DRM_STAT_PRIMARY -#define __HAVE_COUNTER8 _DRM_STAT_SECONDARY -#define __HAVE_COUNTER9 _DRM_STAT_DMA - /* We use our own dma mechanisms, not the drm template code. However, * the shared IRQ code is useful to us: */ diff -Nru a/drivers/char/drm/i915_dma.c b/drivers/char/drm/i915_dma.c --- a/drivers/char/drm/i915_dma.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/char/drm/i915_dma.c 2004-09-26 10:25:56 -07:00 @@ -746,4 +746,10 @@ dev->fn_tbl.irq_postinstall = i915_driver_irq_postinstall; dev->fn_tbl.irq_uninstall = i915_driver_irq_uninstall; dev->fn_tbl.irq_handler = i915_driver_irq_handler; + + dev->counters += 4; + dev->types[6] = _DRM_STAT_IRQ; + dev->types[7] = _DRM_STAT_PRIMARY; + dev->types[8] = _DRM_STAT_SECONDARY; + dev->types[9] = _DRM_STAT_DMA; } diff -Nru a/drivers/char/drm/mga.h b/drivers/char/drm/mga.h --- a/drivers/char/drm/mga.h 2004-09-26 10:25:58 -07:00 +++ b/drivers/char/drm/mga.h 2004-09-26 10:25:58 -07:00 @@ -60,9 +60,4 @@ [DRM_IOCTL_NR(DRM_IOCTL_MGA_BLIT)] = { mga_dma_blit, 1, 0 }, \ [DRM_IOCTL_NR(DRM_IOCTL_MGA_GETPARAM)]= { mga_getparam, 1, 0 }, -#define __HAVE_COUNTERS 3 -#define __HAVE_COUNTER6 _DRM_STAT_IRQ -#define __HAVE_COUNTER7 _DRM_STAT_PRIMARY -#define __HAVE_COUNTER8 _DRM_STAT_SECONDARY - #endif diff -Nru a/drivers/char/drm/mga_dma.c b/drivers/char/drm/mga_dma.c --- a/drivers/char/drm/mga_dma.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/char/drm/mga_dma.c 2004-09-26 10:25:57 -07:00 @@ -819,4 +819,9 @@ dev->fn_tbl.irq_postinstall = mga_driver_irq_postinstall; dev->fn_tbl.irq_uninstall = mga_driver_irq_uninstall; dev->fn_tbl.irq_handler = mga_driver_irq_handler; + + dev->counters += 3; + dev->types[6] = _DRM_STAT_IRQ; + dev->types[7] = _DRM_STAT_PRIMARY; + dev->types[8] = _DRM_STAT_SECONDARY; } diff -Nru a/drivers/char/drm/sis.h b/drivers/char/drm/sis.h --- a/drivers/char/drm/sis.h 2004-09-26 10:25:57 -07:00 +++ b/drivers/char/drm/sis.h 2004-09-26 10:25:57 -07:00 @@ -58,6 +58,4 @@ [DRM_IOCTL_NR(DRM_IOCTL_SIS_AGP_FREE)] = { sis_ioctl_agp_free, 1, 0 }, \ [DRM_IOCTL_NR(DRM_IOCTL_SIS_FB_INIT)] = { sis_fb_init, 1, 1 } -#define __HAVE_COUNTERS 5 - #endif diff -Nru a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c --- a/drivers/char/hvc_console.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/char/hvc_console.c 2004-09-26 10:25:57 -07:00 @@ -265,6 +265,11 @@ */ tty_wait_until_sent(tty, HVC_CLOSE_WAIT); + /* + * Since the line disc doesn't block writes during tty close + * operations we'll set driver_data to NULL and then make sure + * to check tty->driver_data for NULL in hvc_write(). + */ tty->driver_data = NULL; if (irq != NO_IRQ) @@ -418,6 +423,10 @@ struct hvc_struct *hp = tty->driver_data; int written; + /* This write was probably executed during a tty close. */ + if (!hp) + return -EPIPE; + if (from_user) written = __hvc_write_user(hp, buf, count); else @@ -801,7 +810,7 @@ void hvc_console_print(struct console *co, const char *b, unsigned count) { char c[16] __ALIGNED__; - unsigned i, n = 0; + unsigned i = 0, n = 0; int r, donecr = 0; /* Console access attempt outside of acceptable console range. */ diff -Nru a/drivers/char/hvcs.c b/drivers/char/hvcs.c --- a/drivers/char/hvcs.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/char/hvcs.c 2004-09-26 10:25:56 -07:00 @@ -119,8 +119,16 @@ * Rearranged hvcs_close(). Cleaned up some printks and did some housekeeping * on the changelog. Removed local CLC_LENGTH and used HVCS_CLC_LENGTH from * arch/ppc64/hvcserver.h. + * + * 1.3.2 -> 1.3.3 Replaced yield() in hvcs_close() with tty_wait_until_sent() to + * prevent possible lockup with realtime scheduling as similarily pointed out by + * akpm in hvc_console. Changed resulted in the removal of hvcs_final_close() + * to reorder cleanup operations and prevent discarding of pending data during + * an hvcs_close(). Removed spinlock protection of hvcs_struct data members in + * hvcs_write_room() and hvcs_chars_in_buffer() because they aren't needed. */ -#define HVCS_DRIVER_VERSION "1.3.2" + +#define HVCS_DRIVER_VERSION "1.3.3" MODULE_AUTHOR("Ryan S. Arnold "); MODULE_DESCRIPTION("IBM hvcs (Hypervisor Virtual Console Server) Driver"); @@ -128,6 +136,12 @@ MODULE_VERSION(HVCS_DRIVER_VERSION); /* + * Wait this long per iteration while trying to push buffered data to the + * hypervisor before allowing the tty to complete a close operation. + */ +#define HVCS_CLOSE_WAIT (HZ/100) /* 1/10 of a second */ + +/* * Since the Linux TTY code does not currently (2-04-2004) support dynamic * addition of tty derived devices and we shouldn't allocate thousands of * tty_device pointers when the number of vty-server & vty partner connections @@ -317,7 +331,6 @@ static int hvcs_enable_device(struct hvcs_struct *hvcsd, uint32_t unit_address, unsigned int irq, struct vio_dev *dev); -static void hvcs_final_close(struct hvcs_struct *hvcsd); static void destroy_hvcs_struct(struct kobject *kobj); static int hvcs_open(struct tty_struct *tty, struct file *filp); @@ -427,7 +440,7 @@ struct tty_struct *tty; char buf[HVCS_BUFF_LEN] __ALIGNED__; unsigned long flags; - int got; + int got = 0; int i; spin_lock_irqsave(&hvcsd->lock, flags); @@ -574,28 +587,6 @@ kfree(hvcsd); } -/* - * This function must be called with hvcsd->lock held. Do not free the irq in - * this function since it is called with the spinlock held. - */ -static void hvcs_final_close(struct hvcs_struct *hvcsd) -{ - vio_disable_interrupts(hvcsd->vdev); - - hvcsd->todo_mask = 0; - - /* These two may be redundant if the operation was a close. */ - if (hvcsd->tty) { - hvcsd->tty->driver_data = NULL; - hvcsd->tty = NULL; - } - - hvcsd->open_count = 0; - - memset(&hvcsd->buffer[0], 0x00, HVCS_BUFF_LEN); - hvcsd->chars_in_buffer = 0; -} - static struct kobj_type hvcs_kobj_type = { .release = destroy_hvcs_struct, }; @@ -692,8 +683,6 @@ return 0; } - - static int __devexit hvcs_remove(struct vio_dev *dev) { struct hvcs_struct *hvcsd = dev->dev.driver_data; @@ -945,7 +934,7 @@ */ struct hvcs_struct *hvcs_get_by_index(int index) { - struct hvcs_struct *hvcsd; + struct hvcs_struct *hvcsd = NULL; unsigned long flags; spin_lock(&hvcs_structs_lock); @@ -1099,12 +1088,7 @@ kobjp = &hvcsd->kobj; if (--hvcsd->open_count == 0) { - /* - * This line is important because it tells hvcs_open that this - * device needs to be re-configured the next time hvcs_open is - * called. - */ - hvcsd->tty->driver_data = NULL; + vio_disable_interrupts(hvcsd->vdev); /* * NULL this early so that the kernel_thread doesn't try to @@ -1113,26 +1097,18 @@ */ hvcsd->tty = NULL; + irq = hvcsd->vdev->irq; + spin_unlock_irqrestore(&hvcsd->lock, flags); + + tty_wait_until_sent(tty, HVCS_CLOSE_WAIT); + /* - * Block the close until all the buffered data has been - * delivered. + * This line is important because it tells hvcs_open that this + * device needs to be re-configured the next time hvcs_open is + * called. */ - while(hvcsd->chars_in_buffer) { - spin_unlock_irqrestore(&hvcsd->lock, flags); - - /* - * Give the kernel thread the hvcs_struct so that it can - * try to deliver the remaining data but block the close - * operation by spinning in this function so that other - * tty operations have to wait. - */ - yield(); - spin_lock_irqsave(&hvcsd->lock, flags); - } + tty->driver_data = NULL; - hvcs_final_close(hvcsd); - irq = hvcsd->vdev->irq; - spin_unlock_irqrestore(&hvcsd->lock, flags); free_irq(irq, hvcsd); kobject_put(kobjp); return; @@ -1162,12 +1138,25 @@ * Don't kobject put inside the spinlock because the destruction * callback may use the spinlock and it may get called before the * spinlock has been released. Get a pointer to the kobject and - * kobject_put on that instead. + * kobject_put on that after releasing the spinlock. */ kobjp = &hvcsd->kobj; - /* Calling this will drop any buffered data on the floor. */ - hvcs_final_close(hvcsd); + vio_disable_interrupts(hvcsd->vdev); + + hvcsd->todo_mask = 0; + + /* I don't think the tty needs the hvcs_struct pointer after a hangup */ + hvcsd->tty->driver_data = NULL; + hvcsd->tty = NULL; + + hvcsd->open_count = 0; + + /* This will drop any buffered data on the floor which is OK in a hangup + * scenario. */ + memset(&hvcsd->buffer[0], 0x00, HVCS_BUFF_LEN); + hvcsd->chars_in_buffer = 0; + irq = hvcsd->vdev->irq; spin_unlock_irqrestore(&hvcsd->lock, flags); @@ -1323,28 +1312,18 @@ static int hvcs_write_room(struct tty_struct *tty) { struct hvcs_struct *hvcsd = tty->driver_data; - unsigned long flags; - int retval; if (!hvcsd || hvcsd->open_count <= 0) return 0; - spin_lock_irqsave(&hvcsd->lock, flags); - retval = HVCS_BUFF_LEN - hvcsd->chars_in_buffer; - spin_unlock_irqrestore(&hvcsd->lock, flags); - return retval; + return HVCS_BUFF_LEN - hvcsd->chars_in_buffer; } static int hvcs_chars_in_buffer(struct tty_struct *tty) { struct hvcs_struct *hvcsd = tty->driver_data; - unsigned long flags; - int retval; - spin_lock_irqsave(&hvcsd->lock, flags); - retval = hvcsd->chars_in_buffer; - spin_unlock_irqrestore(&hvcsd->lock, flags); - return retval; + return hvcsd->chars_in_buffer; } static struct tty_operations hvcs_ops = { @@ -1433,7 +1412,7 @@ " as a tty driver failed.\n"); hvcs_free_index_list(); put_tty_driver(hvcs_tty_driver); - return rc; + return -EIO; } hvcs_pi_buff = kmalloc(PAGE_SIZE, GFP_KERNEL); diff -Nru a/drivers/char/hvsi.c b/drivers/char/hvsi.c --- a/drivers/char/hvsi.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/char/hvsi.c 2004-09-26 10:25:56 -07:00 @@ -1004,7 +1004,7 @@ { struct hvsi_struct *hp = tty->driver_data; const char *source = buf; - char *kbuf; + char *kbuf = NULL; unsigned long flags; int total = 0; int origcount = count; diff -Nru a/drivers/char/keyboard.c b/drivers/char/keyboard.c --- a/drivers/char/keyboard.c 2004-09-26 10:25:58 -07:00 +++ b/drivers/char/keyboard.c 2004-09-26 10:25:58 -07:00 @@ -123,7 +123,7 @@ */ static struct input_handler kbd_handler; -static unsigned long key_down[256/BITS_PER_LONG]; /* keyboard key bitmap */ +static unsigned long key_down[NBITS(KEY_MAX)]; /* keyboard key bitmap */ static unsigned char shift_down[NR_SHIFT]; /* shift state counters.. */ static int dead_key_next; static int npadch = -1; /* -1 or number assembled on pad */ @@ -142,7 +142,7 @@ /* Simple translation table for the SysRq keys */ #ifdef CONFIG_MAGIC_SYSRQ -unsigned char kbd_sysrq_xlate[128] = +unsigned char kbd_sysrq_xlate[KEY_MAX] = "\000\0331234567890-=\177\t" /* 0x00 - 0x0f */ "qwertyuiop[]\r\000as" /* 0x10 - 0x1f */ "dfghjkl;'`\000\\zxcv" /* 0x20 - 0x2f */ @@ -941,6 +941,9 @@ #if defined(CONFIG_X86) || defined(CONFIG_IA64) || defined(CONFIG_ALPHA) || defined(CONFIG_MIPS) || defined(CONFIG_PPC) || defined(CONFIG_SPARC32) || defined(CONFIG_SPARC64) || defined(CONFIG_PARISC) || defined(CONFIG_SUPERH) +#define HW_RAW(dev) (test_bit(EV_MSC, dev->evbit) && test_bit(MSC_RAW, dev->mscbit) &&\ + ((dev)->id.bustype == BUS_I8042) && ((dev)->id.vendor == 0x0001) && ((dev)->id.product == 0x0001)) + static unsigned short x86_keycodes[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, @@ -1007,6 +1010,8 @@ #else +#define HW_RAW(dev) 0 + #warning "Cannot generate rawmode keyboard for your architecture yet." static int emulate_raw(struct vc_data *vc, unsigned int keycode, unsigned char up_flag) @@ -1019,7 +1024,15 @@ } #endif -void kbd_keycode(unsigned int keycode, int down, struct pt_regs *regs) +void kbd_rawcode(unsigned char data) +{ + struct vc_data *vc = vc_cons[fg_console].d; + kbd = kbd_table + fg_console; + if (kbd->kbdmode == VC_RAW) + put_queue(vc, data); +} + +void kbd_keycode(unsigned int keycode, int down, int hw_raw, struct pt_regs *regs) { struct vc_data *vc = vc_cons[fg_console].d; unsigned short keysym, *key_map; @@ -1053,7 +1066,7 @@ return; #endif /* CONFIG_MAC_EMUMOUSEBTN */ - if ((raw_mode = (kbd->kbdmode == VC_RAW))) + if ((raw_mode = (kbd->kbdmode == VC_RAW)) && !hw_raw) if (emulate_raw(vc, keycode, !down << 7)) if (keycode < BTN_MISC) printk(KERN_WARNING "keyboard.c: can't emulate rawmode for keycode %d\n", keycode); @@ -1119,6 +1132,9 @@ return; } + if (keycode > NR_KEYS) + return; + keysym = key_map[keycode]; type = KTYP(keysym); @@ -1148,11 +1164,12 @@ } static void kbd_event(struct input_handle *handle, unsigned int event_type, - unsigned int keycode, int down) + unsigned int event_code, int value) { - if (event_type != EV_KEY) - return; - kbd_keycode(keycode, down, handle->dev->regs); + if (event_type == EV_MSC && event_code == MSC_RAW && HW_RAW(handle->dev)) + kbd_rawcode(value); + if (event_type == EV_KEY) + kbd_keycode(event_code, value, HW_RAW(handle->dev), handle->dev->regs); tasklet_schedule(&keyboard_tasklet); do_poke_blanked_console = 1; schedule_console_callback(); diff -Nru a/drivers/char/mmtimer.c b/drivers/char/mmtimer.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/char/mmtimer.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,216 @@ +/* + * Intel Multimedia Timer device implementation for SGI SN platforms. + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (c) 2001-2004 Silicon Graphics, Inc. All rights reserved. + * + * This driver exports an API that should be supportable by any HPET or IA-PC + * multimedia timer. The code below is currently specific to the SGI Altix + * SHub RTC, however. + * + * 11/01/01 - jbarnes - initial revision + * 9/10/04 - Christoph Lameter - remove interrupt support for kernel inclusion + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +MODULE_AUTHOR("Jesse Barnes "); +MODULE_DESCRIPTION("Multimedia timer support"); +MODULE_LICENSE("GPL"); + +/* name of the device, usually in /dev */ +#define MMTIMER_NAME "mmtimer" +#define MMTIMER_DESC "IA-PC Multimedia Timer" +#define MMTIMER_VERSION "1.0" + +#define RTC_BITS 55 /* 55 bits for this implementation */ + +static int mmtimer_ioctl(struct inode *inode, struct file *file, + unsigned int cmd, unsigned long arg); +static int mmtimer_mmap(struct file *file, struct vm_area_struct *vma); + +/* + * Period in femtoseconds (10^-15 s) + */ +static unsigned long mmtimer_femtoperiod = 0; + +static struct file_operations mmtimer_fops = { + .owner = THIS_MODULE, + .mmap = mmtimer_mmap, + .ioctl = mmtimer_ioctl, +}; + +/** + * mmtimer_ioctl - ioctl interface for /dev/mmtimer + * @inode: inode of the device + * @file: file structure for the device + * @cmd: command to execute + * @arg: optional argument to command + * + * Executes the command specified by @cmd. Returns 0 for success, < 0 for + * failure. + * + * Valid commands: + * + * %MMTIMER_GETOFFSET - Should return the offset (relative to the start + * of the page where the registers are mapped) for the counter in question. + * + * %MMTIMER_GETRES - Returns the resolution of the clock in femto (10^-15) + * seconds + * + * %MMTIMER_GETFREQ - Copies the frequency of the clock in Hz to the address + * specified by @arg + * + * %MMTIMER_GETBITS - Returns the number of bits in the clock's counter + * + * %MMTIMER_MMAPAVAIL - Returns 1 if the registers can be mmap'd into userspace + * + * %MMTIMER_GETCOUNTER - Gets the current value in the counter and places it + * in the address specified by @arg. + */ +static int mmtimer_ioctl(struct inode *inode, struct file *file, + unsigned int cmd, unsigned long arg) +{ + int ret = 0; + + switch (cmd) { + case MMTIMER_GETOFFSET: /* offset of the counter */ + /* + * SN RTC registers are on their own 64k page + */ + if(PAGE_SIZE <= (1 << 16)) + ret = (((long)RTC_COUNTER_ADDR) & (PAGE_SIZE-1)) / 8; + else + ret = -ENOSYS; + break; + + case MMTIMER_GETRES: /* resolution of the clock in 10^-15 s */ + if(copy_to_user((unsigned long *)arg, &mmtimer_femtoperiod, + sizeof(unsigned long))) + return -EFAULT; + break; + + case MMTIMER_GETFREQ: /* frequency in Hz */ + if(copy_to_user((unsigned long *)arg, + &sn_rtc_cycles_per_second, + sizeof(unsigned long))) + return -EFAULT; + ret = 0; + break; + + case MMTIMER_GETBITS: /* number of bits in the clock */ + ret = RTC_BITS; + break; + + case MMTIMER_MMAPAVAIL: /* can we mmap the clock into userspace? */ + ret = (PAGE_SIZE <= (1 << 16)) ? 1 : 0; + break; + + case MMTIMER_GETCOUNTER: + if(copy_to_user((unsigned long *)arg, RTC_COUNTER_ADDR, + sizeof(unsigned long))) + return -EFAULT; + break; + default: + ret = -ENOSYS; + break; + } + + return ret; +} + +/** + * mmtimer_mmap - maps the clock's registers into userspace + * @file: file structure for the device + * @vma: VMA to map the registers into + * + * Calls remap_page_range() to map the clock's registers into + * the calling process' address space. + */ +static int mmtimer_mmap(struct file *file, struct vm_area_struct *vma) +{ + unsigned long mmtimer_addr; + + if (vma->vm_end - vma->vm_start != PAGE_SIZE) + return -EINVAL; + + if (vma->vm_flags & VM_WRITE) + return -EPERM; + + if (PAGE_SIZE > (1 << 16)) + return -ENOSYS; + + vma->vm_flags |= (VM_IO | VM_SHM | VM_LOCKED ); + vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); + + mmtimer_addr = __pa(RTC_COUNTER_ADDR); + mmtimer_addr &= ~(PAGE_SIZE - 1); + mmtimer_addr &= 0xfffffffffffffffUL; + + if (remap_page_range(vma, vma->vm_start, mmtimer_addr, PAGE_SIZE, + vma->vm_page_prot)) { + printk(KERN_ERR "remap_page_range failed in mmtimer.c\n"); + return -EAGAIN; + } + + return 0; +} + +static struct miscdevice mmtimer_miscdev = { + SGI_MMTIMER, + MMTIMER_NAME, + &mmtimer_fops +}; + +/** + * mmtimer_init - device initialization routine + * + * Does initial setup for the mmtimer device. + */ +static int __init mmtimer_init(void) +{ + if (!ia64_platform_is("sn2")) + return -1; + + /* + * Sanity check the cycles/sec variable + */ + if (sn_rtc_cycles_per_second < 100000) { + printk(KERN_ERR "%s: unable to determine clock frequency\n", + MMTIMER_NAME); + return -1; + } + + mmtimer_femtoperiod = ((unsigned long)1E15 + sn_rtc_cycles_per_second / + 2) / sn_rtc_cycles_per_second; + + strcpy(mmtimer_miscdev.devfs_name, MMTIMER_NAME); + if (misc_register(&mmtimer_miscdev)) { + printk(KERN_ERR "%s: failed to register device\n", + MMTIMER_NAME); + return -1; + } + + printk(KERN_INFO "%s: v%s, %ld MHz\n", MMTIMER_DESC, MMTIMER_VERSION, + sn_rtc_cycles_per_second/(unsigned long)1E6); + + return 0; +} + +module_init(mmtimer_init); + diff -Nru a/drivers/char/rio/rio_linux.c b/drivers/char/rio/rio_linux.c --- a/drivers/char/rio/rio_linux.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/char/rio/rio_linux.c 2004-09-26 10:25:56 -07:00 @@ -1138,8 +1138,8 @@ hp->Ivec = pdev->irq; if (((1 << hp->Ivec) & rio_irqmask) == 0) hp->Ivec = 0; - hp->CardP = (struct DpRam *) hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, RIO_WINDOW_LEN); + hp->CardP = (struct DpRam *) hp->Caddr; hp->Type = RIO_PCI; hp->Copy = rio_pcicopy; hp->Mode = RIO_PCI_BOOT_FROM_RAM; @@ -1196,8 +1196,8 @@ if (((1 << hp->Ivec) & rio_irqmask) == 0) hp->Ivec = 0; hp->Ivec |= 0x8000; /* Mark as non-sharable */ - hp->CardP = (struct DpRam *) hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, RIO_WINDOW_LEN); + hp->CardP = (struct DpRam *) hp->Caddr; hp->Type = RIO_PCI; hp->Copy = rio_pcicopy; hp->Mode = RIO_PCI_BOOT_FROM_RAM; @@ -1242,8 +1242,8 @@ hp->PaddrP = rio_probe_addrs[i]; /* There was something about the IRQs of these cards. 'Forget what.--REW */ hp->Ivec = 0; - hp->CardP = (struct DpRam *) hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, RIO_WINDOW_LEN); + hp->CardP = (struct DpRam *) hp->Caddr; hp->Type = RIO_AT; hp->Copy = rio_pcicopy; /* AT card PCI???? - PVDL * -- YES! this is now a normal copy. Only the diff -Nru a/drivers/fc4/soc.h b/drivers/fc4/soc.h --- a/drivers/fc4/soc.h 2004-09-26 10:25:55 -07:00 +++ b/drivers/fc4/soc.h 2004-09-26 10:25:55 -07:00 @@ -81,29 +81,29 @@ * That's why here are the following inline functions... */ -typedef unsigned long xram_p; +typedef void __iomem *xram_p; /* Get 32bit number from XRAM */ -static inline u32 xram_get_32 (xram_p x) +static inline u32 xram_get_32(xram_p x) { return ((sbus_readw(x + 0x00UL) << 16) | (sbus_readw(x + 0x02UL))); } /* Like the above, but when we don't care about the high 16 bits */ -static inline u32 xram_get_32low (xram_p x) +static inline u32 xram_get_32low(xram_p x) { return (u32) sbus_readw(x + 0x02UL); } -static inline u16 xram_get_16 (xram_p x) +static inline u16 xram_get_16(xram_p x) { return sbus_readw(x); } -static inline u8 xram_get_8 (xram_p x) +static inline u8 xram_get_8(xram_p x) { - if (x & (xram_p)0x1) { + if ((unsigned long)x & 0x1UL) { x = x - 1; return (u8) sbus_readw(x); } else { @@ -111,7 +111,7 @@ } } -static inline void xram_copy_from (void *p, xram_p x, int len) +static inline void xram_copy_from(void *p, xram_p x, int len) { for (len >>= 2; len > 0; len--, x += sizeof(u32)) { u32 val, *p32 = p; @@ -123,7 +123,7 @@ } } -static inline void xram_copy_to (xram_p x, void *p, int len) +static inline void xram_copy_to(xram_p x, void *p, int len) { for (len >>= 2; len > 0; len--, x += sizeof(u32)) { u32 tmp, *p32 = p; @@ -135,7 +135,7 @@ } } -static inline void xram_bzero (xram_p x, int len) +static inline void xram_bzero(xram_p x, int len) { for (len >>= 1; len > 0; len--, x += sizeof(u16)) sbus_writew(0, x); @@ -274,7 +274,7 @@ soc_cq req[2]; /* Request CQs */ soc_cq rsp[2]; /* Response CQs */ int soc_no; - unsigned long regs; + void __iomem *regs; xram_p xram; fc_wwn wwn; u32 imask; /* Our copy of regs->imask */ diff -Nru a/drivers/fc4/socal.c b/drivers/fc4/socal.c --- a/drivers/fc4/socal.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/fc4/socal.c 2004-09-26 10:25:56 -07:00 @@ -60,7 +60,7 @@ #define for_each_socal(s) for (s = socals; s; s = s->next) struct socal *socals = NULL; -static void socal_copy_from_xram(void *d, unsigned long xram, long size) +static void socal_copy_from_xram(void *d, void __iomem *xram, long size) { u32 *dp = (u32 *) d; while (size) { @@ -70,7 +70,7 @@ } } -static void socal_copy_to_xram(unsigned long xram, void *s, long size) +static void socal_copy_to_xram(void __iomem *xram, void *s, long size) { u32 *sp = (u32 *) s; while (size) { diff -Nru a/drivers/fc4/socal.h b/drivers/fc4/socal.h --- a/drivers/fc4/socal.h 2004-09-26 10:25:56 -07:00 +++ b/drivers/fc4/socal.h 2004-09-26 10:25:56 -07:00 @@ -295,9 +295,9 @@ socal_cq req[4]; /* Request CQs */ socal_cq rsp[4]; /* Response CQs */ int socal_no; - unsigned long regs; - unsigned long xram; - unsigned long eeprom; + void __iomem *regs; + void __iomem *xram; + void __iomem *eeprom; fc_wwn wwn; u32 imask; /* Our copy of regs->imask */ u32 cfg; /* Our copy of regs->cfg */ diff -Nru a/drivers/ide/Kconfig b/drivers/ide/Kconfig --- a/drivers/ide/Kconfig 2004-09-26 10:25:56 -07:00 +++ b/drivers/ide/Kconfig 2004-09-26 10:25:56 -07:00 @@ -457,11 +457,6 @@ Generally say N here. -config BLK_DEV_ADMA - bool - depends on PCI && BLK_DEV_IDEPCI - default BLK_DEV_IDEDMA_PCI - config BLK_DEV_AEC62XX tristate "AEC62XX chipset support" help diff -Nru a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c --- a/drivers/ide/arm/icside.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/ide/arm/icside.c 2004-09-26 10:25:56 -07:00 @@ -215,8 +215,6 @@ struct scatterlist *sg = hwif->sg_table; int nents; - BUG_ON(hwif->sg_dma_active); - if (rq->flags & REQ_DRIVE_TASKFILE) { ide_task_t *args = rq->special; @@ -401,8 +399,6 @@ dma_unmap_sg(state->dev, hwif->sg_table, hwif->sg_nents, hwif->sg_dma_direction); - hwif->sg_dma_active = 0; - return get_dma_residue(hwif->hw.dma) != 0; } @@ -454,7 +450,6 @@ /* * We can not enable DMA on both channels. */ - BUG_ON(hwif->sg_dma_active); BUG_ON(dma_channel_active(hwif->hw.dma)); icside_build_sglist(drive, rq); diff -Nru a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c --- a/drivers/ide/ide-dma.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/ide/ide-dma.c 2004-09-26 10:25:56 -07:00 @@ -208,9 +208,6 @@ struct scatterlist *sg = hwif->sg_table; int nents; - if (hwif->sg_dma_active) - BUG(); - nents = blk_rq_map_sg(drive->queue, rq, hwif->sg_table); if (rq_data_dir(rq) == READ) @@ -366,7 +363,6 @@ hwif->sg_table, hwif->sg_nents, hwif->sg_dma_direction); - hwif->sg_dma_active = 0; return 0; /* revert to PIO for this request */ } @@ -390,7 +386,6 @@ int nents = HWIF(drive)->sg_nents; pci_unmap_sg(dev, sg, nents, HWIF(drive)->sg_dma_direction); - HWIF(drive)->sg_dma_active = 0; } EXPORT_SYMBOL_GPL(ide_destroy_dmatable); diff -Nru a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c --- a/drivers/ide/ide-io.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/ide/ide-io.c 2004-09-26 10:25:57 -07:00 @@ -384,6 +384,8 @@ args->hobRegister[IDE_DATA_OFFSET] = (data >> 8) & 0xFF; } args->tfRegister[IDE_ERROR_OFFSET] = err; + /* be sure we're looking at the low order bits */ + hwif->OUTB(drive->ctl & ~0x80, IDE_CONTROL_REG); args->tfRegister[IDE_NSECTOR_OFFSET] = hwif->INB(IDE_NSECTOR_REG); args->tfRegister[IDE_SECTOR_OFFSET] = hwif->INB(IDE_SECTOR_REG); args->tfRegister[IDE_LCYL_OFFSET] = hwif->INB(IDE_LCYL_REG); diff -Nru a/drivers/ide/pci/amd74xx.c b/drivers/ide/pci/amd74xx.c --- a/drivers/ide/pci/amd74xx.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/ide/pci/amd74xx.c 2004-09-26 10:25:57 -07:00 @@ -416,6 +416,9 @@ { int i; + if (!hwif->irq) + hwif->irq = hwif->channel ? 15 : 14; + hwif->autodma = 0; hwif->tuneproc = &amd74xx_tune_drive; diff -Nru a/drivers/ide/pci/hpt34x.c b/drivers/ide/pci/hpt34x.c --- a/drivers/ide/pci/hpt34x.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/ide/pci/hpt34x.c 2004-09-26 10:25:56 -07:00 @@ -44,65 +44,6 @@ #include "hpt34x.h" -#if defined(DISPLAY_HPT34X_TIMINGS) && defined(CONFIG_PROC_FS) -#include -#include - -static u8 hpt34x_proc = 0; - -#define HPT34X_MAX_DEVS 8 -static struct pci_dev *hpt34x_devs[HPT34X_MAX_DEVS]; -static int n_hpt34x_devs; - -static int hpt34x_get_info (char *buffer, char **addr, off_t offset, int count) -{ - char *p = buffer; - int i, len; - - p += sprintf(p, "\n " - "HPT34X Chipset.\n"); - for (i = 0; i < n_hpt34x_devs; i++) { - struct pci_dev *dev = hpt34x_devs[i]; - unsigned long bibma = pci_resource_start(dev, 4); - u8 c0 = 0, c1 = 0; - - /* - * at that point bibma+0x2 et bibma+0xa are byte registers - * to investigate: - */ - c0 = inb_p((u16)bibma + 0x02); - c1 = inb_p((u16)bibma + 0x0a); - p += sprintf(p, "\nController: %d\n", i); - p += sprintf(p, "--------------- Primary Channel " - "---------------- Secondary Channel " - "-------------\n"); - p += sprintf(p, " %sabled " - " %sabled\n", - (c0&0x80) ? "dis" : " en", - (c1&0x80) ? "dis" : " en"); - p += sprintf(p, "--------------- drive0 --------- drive1 " - "-------- drive0 ---------- drive1 ------\n"); - p += sprintf(p, "DMA enabled: %s %s" - " %s %s\n", - (c0&0x20) ? "yes" : "no ", - (c0&0x40) ? "yes" : "no ", - (c1&0x20) ? "yes" : "no ", - (c1&0x40) ? "yes" : "no " ); - - p += sprintf(p, "UDMA\n"); - p += sprintf(p, "DMA\n"); - p += sprintf(p, "PIO\n"); - } - p += sprintf(p, "\n"); - - /* p - buffer must be less than 4k! */ - len = (p - buffer) - offset; - *addr = buffer + offset; - - return len > count ? count : len; -} -#endif /* defined(DISPLAY_HPT34X_TIMINGS) && defined(CONFIG_PROC_FS) */ - static u8 hpt34x_ratemask (ide_drive_t *drive) { return 1; @@ -276,15 +217,6 @@ pci_write_config_word(dev, PCI_COMMAND, cmd); local_irq_restore(flags); - -#if defined(DISPLAY_HPT34X_TIMINGS) && defined(CONFIG_PROC_FS) - hpt34x_devs[n_hpt34x_devs++] = dev; - - if (!hpt34x_proc) { - hpt34x_proc = 1; - ide_pci_create_host_proc("hpt34x", hpt34x_get_info); - } -#endif /* DISPLAY_HPT34X_TIMINGS && CONFIG_PROC_FS */ return dev->irq; } diff -Nru a/drivers/ide/pci/hpt34x.h b/drivers/ide/pci/hpt34x.h --- a/drivers/ide/pci/hpt34x.h 2004-09-26 10:25:55 -07:00 +++ b/drivers/ide/pci/hpt34x.h 2004-09-26 10:25:55 -07:00 @@ -11,8 +11,6 @@ #define SPLIT_BYTE(B,H,L) ((H)=(B>>4), (L)=(B-((B>>4)<<4))) #endif -#undef DISPLAY_HPT34X_TIMINGS - static unsigned int init_chipset_hpt34x(struct pci_dev *, const char *); static void init_hwif_hpt34x(ide_hwif_t *); diff -Nru a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c --- a/drivers/ide/pci/sgiioc4.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/ide/pci/sgiioc4.c 2004-09-26 10:25:56 -07:00 @@ -570,7 +570,6 @@ use_pio_instead: pci_unmap_sg(hwif->pci_dev, hwif->sg_table, hwif->sg_nents, hwif->sg_dma_direction); - hwif->sg_dma_active = 0; return 0; /* revert to PIO for this request */ } diff -Nru a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c --- a/drivers/ide/pci/sis5513.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/ide/pci/sis5513.c 2004-09-26 10:25:56 -07:00 @@ -954,31 +954,25 @@ return; } -#define DECLARE_SIS_DEV(name_str) \ - { \ - .name = name_str, \ - .init_chipset = init_chipset_sis5513, \ - .init_hwif = init_hwif_sis5513, \ - .channels = 2, \ - .autodma = NOAUTODMA, \ - .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, \ - .bootable = ON_BOARD, \ - } - -static ide_pci_device_t sis5513_chipsets[] __devinitdata = { - /* 0 */ DECLARE_SIS_DEV("SIS5513"), - /* 1 */ DECLARE_SIS_DEV("SIS5518") +static ide_pci_device_t sis5513_chipset __devinitdata = { + .name = "SIS5513", + .init_chipset = init_chipset_sis5513, + .init_hwif = init_hwif_sis5513, + .channels = 2, + .autodma = NOAUTODMA, + .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, + .bootable = ON_BOARD, }; static int __devinit sis5513_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_setup_pci_device(dev, &sis5513_chipsets[id->driver_data]); + ide_setup_pci_device(dev, &sis5513_chipset); return 0; } static struct pci_device_id sis5513_pci_tbl[] = { { PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_5513, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, - { PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_5518, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1}, + { PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_5518, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { 0, }, }; MODULE_DEVICE_TABLE(pci, sis5513_pci_tbl); diff -Nru a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c --- a/drivers/ide/ppc/pmac.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/ide/ppc/pmac.c 2004-09-26 10:25:55 -07:00 @@ -75,7 +75,7 @@ * beeing done by the generic code about the kind of dma controller * and format of the dma table. This will have to be fixed though. */ - volatile struct dbdma_regs* dma_regs; + volatile struct dbdma_regs __iomem * dma_regs; struct dbdma_cmd* dma_table_cpu; dma_addr_t dma_table_dma; struct scatterlist* sg_table; @@ -497,6 +497,8 @@ *irq = pmac_ide[ix].irq; } +#define PMAC_IDE_REG(x) ((void __iomem *)(IDE_DATA_REG+(x))) + /* * Apply the timings of the proper unit (master/slave) to the shared * timing register when selecting that unit. This version is for @@ -511,12 +513,10 @@ return; if (drive->select.b.unit & 0x01) - writel(pmif->timings[1], - (unsigned *)(IDE_DATA_REG+IDE_TIMING_CONFIG)); + writel(pmif->timings[1], PMAC_IDE_REG(IDE_TIMING_CONFIG)); else - writel(pmif->timings[0], - (unsigned *)(IDE_DATA_REG+IDE_TIMING_CONFIG)); - (void)readl((unsigned *)(IDE_DATA_REG+IDE_TIMING_CONFIG)); + writel(pmif->timings[0], PMAC_IDE_REG(IDE_TIMING_CONFIG)); + (void)readl(PMAC_IDE_REG(IDE_TIMING_CONFIG)); } /* @@ -533,17 +533,13 @@ return; if (drive->select.b.unit & 0x01) { - writel(pmif->timings[1], - (unsigned *)(IDE_DATA_REG + IDE_KAUAI_PIO_CONFIG)); - writel(pmif->timings[3], - (unsigned *)(IDE_DATA_REG + IDE_KAUAI_ULTRA_CONFIG)); + writel(pmif->timings[1], PMAC_IDE_REG(IDE_KAUAI_PIO_CONFIG)); + writel(pmif->timings[3], PMAC_IDE_REG(IDE_KAUAI_ULTRA_CONFIG)); } else { - writel(pmif->timings[0], - (unsigned *)(IDE_DATA_REG + IDE_KAUAI_PIO_CONFIG)); - writel(pmif->timings[2], - (unsigned *)(IDE_DATA_REG + IDE_KAUAI_ULTRA_CONFIG)); + writel(pmif->timings[0], PMAC_IDE_REG(IDE_KAUAI_PIO_CONFIG)); + writel(pmif->timings[2], PMAC_IDE_REG(IDE_KAUAI_ULTRA_CONFIG)); } - (void)readl((unsigned *)(IDE_DATA_REG + IDE_KAUAI_PIO_CONFIG)); + (void)readl(PMAC_IDE_REG(IDE_KAUAI_PIO_CONFIG)); } /* @@ -569,7 +565,7 @@ u32 tmp; writeb(value, (void __iomem *) port); - tmp = readl((unsigned *)(IDE_DATA_REG + IDE_TIMING_CONFIG)); + tmp = readl(PMAC_IDE_REG(IDE_TIMING_CONFIG)); } /* @@ -792,7 +788,7 @@ set_timings_mdma(ide_drive_t *drive, int intf_type, u32 *timings, u32 *timings2, u8 speed, int drive_cycle_time) { - int cycleTime, accessTime, recTime; + int cycleTime, accessTime = 0, recTime = 0; unsigned accessTicks, recTicks; struct mdma_timings_t* tm = NULL; int i; @@ -1281,7 +1277,8 @@ static int __devinit pmac_ide_macio_attach(struct macio_dev *mdev, const struct of_match *match) { - unsigned long base, regbase; + void __iomem *base; + unsigned long regbase; int irq; ide_hwif_t *hwif; pmac_ide_hwif_t *pmif; @@ -1324,8 +1321,8 @@ } else irq = macio_irq(mdev, 0); - base = (unsigned long)ioremap(macio_resource_start(mdev, 0), 0x400); - regbase = base; + base = ioremap(macio_resource_start(mdev, 0), 0x400); + regbase = (unsigned long) base; hwif->pci_dev = mdev->bus->pdev; hwif->gendev.parent = &mdev->ofdev.dev; @@ -1339,8 +1336,7 @@ if (macio_request_resource(mdev, 1, "ide-pmac (dma)")) printk(KERN_WARNING "ide%d: can't request DMA resource !\n", i); else - pmif->dma_regs = (volatile struct dbdma_regs*) - ioremap(macio_resource_start(mdev, 1), 0x1000); + pmif->dma_regs = ioremap(macio_resource_start(mdev, 1), 0x1000); } else pmif->dma_regs = NULL; #endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */ @@ -1350,9 +1346,9 @@ if (rc != 0) { /* The inteface is released to the common IDE layer */ dev_set_drvdata(&mdev->ofdev.dev, NULL); - iounmap((void *)base); + iounmap(base); if (pmif->dma_regs) - iounmap((void *)pmif->dma_regs); + iounmap(pmif->dma_regs); memset(pmif, 0, sizeof(*pmif)); macio_release_resource(mdev, 0); if (pmif->dma_regs) @@ -1401,7 +1397,7 @@ ide_hwif_t *hwif; struct device_node *np; pmac_ide_hwif_t *pmif; - unsigned long base; + void __iomem *base; unsigned long rbase, rlen; int i, rc; @@ -1444,10 +1440,10 @@ rbase = pci_resource_start(pdev, 0); rlen = pci_resource_len(pdev, 0); - base = (unsigned long) ioremap(rbase, rlen); - pmif->regbase = base + 0x2000; + base = ioremap(rbase, rlen); + pmif->regbase = (unsigned long) base + 0x2000; #ifdef CONFIG_BLK_DEV_IDEDMA_PMAC - pmif->dma_regs = (volatile struct dbdma_regs*)(base + 0x1000); + pmif->dma_regs = base + 0x1000; #endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */ /* We use the OF node irq mapping */ @@ -1462,7 +1458,7 @@ if (rc != 0) { /* The inteface is released to the common IDE layer */ pci_set_drvdata(pdev, NULL); - iounmap((void *)base); + iounmap(base); memset(pmif, 0, sizeof(*pmif)); pci_release_regions(pdev); } @@ -1578,9 +1574,6 @@ struct scatterlist *sg = pmif->sg_table; int nents; - if (hwif->sg_dma_active) - BUG(); - nents = blk_rq_map_sg(drive->queue, rq, sg); if (rq_data_dir(rq) == READ) @@ -1639,7 +1632,7 @@ int i, count = 0; ide_hwif_t *hwif = HWIF(drive); pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)hwif->hwif_data; - volatile struct dbdma_regs *dma = pmif->dma_regs; + volatile struct dbdma_regs __iomem *dma = pmif->dma_regs; struct scatterlist *sg; int wr = (rq_data_dir(rq) == WRITE); @@ -1715,7 +1708,6 @@ pmif->sg_table, pmif->sg_nents, pmif->sg_dma_direction); - hwif->sg_dma_active = 0; return 0; /* revert to PIO for this request */ } @@ -1731,7 +1723,6 @@ if (nents) { pci_unmap_sg(dev, sg, nents, pmif->sg_dma_direction); pmif->sg_nents = 0; - HWIF(drive)->sg_dma_active = 0; } } @@ -1912,8 +1903,8 @@ /* Apple adds 60ns to wrDataSetup on reads */ if (ata4 && (pmif->timings[unit] & TR_66_UDMA_EN)) { writel(pmif->timings[unit] + (reading ? 0x00800000UL : 0), - (unsigned *)(IDE_DATA_REG+IDE_TIMING_CONFIG)); - (void)readl((unsigned *)(IDE_DATA_REG + IDE_TIMING_CONFIG)); + PMAC_IDE_REG(IDE_TIMING_CONFIG)); + (void)readl(PMAC_IDE_REG(IDE_TIMING_CONFIG)); } drive->waiting_for_dma = 1; @@ -1992,7 +1983,7 @@ pmac_ide_dma_begin (ide_drive_t *drive) { pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data; - volatile struct dbdma_regs *dma; + volatile struct dbdma_regs __iomem *dma; if (pmif == NULL) return 1; @@ -2011,7 +2002,7 @@ pmac_ide_dma_end (ide_drive_t *drive) { pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data; - volatile struct dbdma_regs *dma; + volatile struct dbdma_regs __iomem *dma; u32 dstat; if (pmif == NULL) @@ -2039,7 +2030,7 @@ pmac_ide_dma_test_irq (ide_drive_t *drive) { pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data; - volatile struct dbdma_regs *dma; + volatile struct dbdma_regs __iomem *dma; unsigned long status, timeout; if (pmif == NULL) @@ -2107,7 +2098,7 @@ pmac_ide_dma_lostirq (ide_drive_t *drive) { pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data; - volatile struct dbdma_regs *dma; + volatile struct dbdma_regs __iomem *dma; unsigned long status; if (pmif == NULL) diff -Nru a/drivers/ieee1394/eth1394.c b/drivers/ieee1394/eth1394.c --- a/drivers/ieee1394/eth1394.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/ieee1394/eth1394.c 2004-09-26 10:25:56 -07:00 @@ -132,7 +132,7 @@ }; /* Our ieee1394 highlevel driver */ -#define ETH1394_DRIVER_NAME "ip1394" +#define ETH1394_DRIVER_NAME "eth1394" static const char driver_name[] = ETH1394_DRIVER_NAME; static kmem_cache_t *packet_task_cache; diff -Nru a/drivers/input/gameport/emu10k1-gp.c b/drivers/input/gameport/emu10k1-gp.c --- a/drivers/input/gameport/emu10k1-gp.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/input/gameport/emu10k1-gp.c 2004-09-26 10:25:56 -07:00 @@ -50,8 +50,11 @@ }; 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 */ + { 0x1102, 0x7004, PCI_ANY_ID, PCI_ANY_ID }, /* Dell SB Live */ + { 0x1102, 0x7005, PCI_ANY_ID, PCI_ANY_ID }, /* Audigy LS gameport */ { 0, } }; diff -Nru a/drivers/input/gameport/vortex.c b/drivers/input/gameport/vortex.c --- a/drivers/input/gameport/vortex.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/input/gameport/vortex.c 2004-09-26 10:25:57 -07:00 @@ -55,8 +55,8 @@ struct vortex { struct gameport gameport; struct pci_dev *dev; - unsigned char *base; - unsigned char *io; + unsigned char __iomem *base; + unsigned char __iomem *io; char phys[32]; }; diff -Nru a/drivers/input/joydev.c b/drivers/input/joydev.c --- a/drivers/input/joydev.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/input/joydev.c 2004-09-26 10:25:56 -07:00 @@ -232,8 +232,10 @@ && list->head == list->tail && (file->f_flags & O_NONBLOCK)) return -EAGAIN; - retval = wait_event_interruptible(list->joydev->wait, list->joydev->exist - && (list->startup < joydev->nabs + joydev->nkey || list->head != list->tail)); + retval = wait_event_interruptible(list->joydev->wait, + !list->joydev->exist || + list->startup < joydev->nabs + joydev->nkey || + list->head != list->tail); if (retval) return retval; diff -Nru a/drivers/input/joystick/Kconfig b/drivers/input/joystick/Kconfig --- a/drivers/input/joystick/Kconfig 2004-09-26 10:25:55 -07:00 +++ b/drivers/input/joystick/Kconfig 2004-09-26 10:25:55 -07:00 @@ -247,7 +247,7 @@ To compile this driver as a module, choose M here: the module will be called amijoy. -config INPUT_JOYDUMP +config JOYSTICK_JOYDUMP tristate "Gameport data dumper" depends on INPUT && INPUT_JOYSTICK help diff -Nru a/drivers/input/joystick/gamecon.c b/drivers/input/joystick/gamecon.c --- a/drivers/input/joystick/gamecon.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/input/joystick/gamecon.c 2004-09-26 10:25:57 -07:00 @@ -1,7 +1,8 @@ /* - * $Id: gamecon.c,v 1.22 2002/07/01 15:42:25 vojtech Exp $ + * NES, SNES, N64, MultiSystem, PSX gamepad driver for Linux * - * Copyright (c) 1999-2001 Vojtech Pavlik + * Copyright (c) 1999-2004 Vojtech Pavlik + * Copyright (c) 2004 Peter Nelson * * Based on the work of: * Andree Borrmann John Dahlstrom @@ -9,10 +10,6 @@ */ /* - * NES, SNES, N64, MultiSystem, PSX gamepad driver for Linux - */ - -/* * 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 @@ -72,8 +69,9 @@ #define GC_MULTI2 5 #define GC_N64 6 #define GC_PSX 7 +#define GC_DDR 8 -#define GC_MAX 7 +#define GC_MAX 8 #define GC_REFRESH_TIME HZ/100 @@ -91,7 +89,8 @@ static int gc_status_bit[] = { 0x40, 0x80, 0x20, 0x10, 0x08 }; static char *gc_names[] = { NULL, "SNES pad", "NES pad", "NES FourPort", "Multisystem joystick", - "Multisystem 2-button joystick", "N64 controller", "PSX controller" }; + "Multisystem 2-button joystick", "N64 controller", "PSX controller" + "PSX DDR controller" }; /* * N64 support. */ @@ -237,7 +236,7 @@ #define GC_PSX_RUMBLE 7 /* Rumble in Red mode */ #define GC_PSX_CLOCK 0x04 /* Pin 4 */ -#define GC_PSX_COMMAND 0x01 /* Pin 1 */ +#define GC_PSX_COMMAND 0x01 /* Pin 2 */ #define GC_PSX_POWER 0xf8 /* Pins 5-9 */ #define GC_PSX_SELECT 0x02 /* Pin 3 */ @@ -253,25 +252,29 @@ static short gc_psx_abs[] = { ABS_X, ABS_Y, ABS_RX, ABS_RY, ABS_HAT0X, ABS_HAT0Y }; static short gc_psx_btn[] = { BTN_TL, BTN_TR, BTN_TL2, BTN_TR2, BTN_A, BTN_B, BTN_X, BTN_Y, BTN_START, BTN_SELECT, BTN_THUMBL, BTN_THUMBR }; +static short gc_psx_ddr_btn[] = { BTN_0, BTN_1, BTN_2, BTN_3 }; /* * gc_psx_command() writes 8bit command and reads 8bit data from * the psx pad. */ -static int gc_psx_command(struct gc *gc, int b) +static void gc_psx_command(struct gc *gc, int b, unsigned char data[GC_PSX_LENGTH]) { - int i, cmd, data = 0; + int i, j, cmd, read; + for (i = 0; i < 5; i++) + data[i] = 0; for (i = 0; i < 8; i++, b >>= 1) { cmd = (b & 1) ? GC_PSX_COMMAND : 0; parport_write_data(gc->pd->port, cmd | GC_PSX_POWER); udelay(gc_psx_delay); - data |= ((parport_read_status(gc->pd->port) ^ 0x80) & gc->pads[GC_PSX]) ? (1 << i) : 0; + read = parport_read_status(gc->pd->port) ^ 0x80; + for (j = 0; j < 5; j++) + data[j] |= (read & gc_status_bit[j] & gc->pads[GC_PSX]) ? (1 << i) : 0; parport_write_data(gc->pd->port, cmd | GC_PSX_CLOCK | GC_PSX_POWER); udelay(gc_psx_delay); } - return data; } /* @@ -279,30 +282,39 @@ * device identifier code. */ -static int gc_psx_read_packet(struct gc *gc, unsigned char *data) +static void gc_psx_read_packet(struct gc *gc, unsigned char data[5][GC_PSX_LENGTH], unsigned char id[5]) { - int i, id; + int i, j, max_len = 0; unsigned long flags; + unsigned char data2[5]; parport_write_data(gc->pd->port, GC_PSX_CLOCK | GC_PSX_SELECT | GC_PSX_POWER); /* Select pad */ - udelay(gc_psx_delay * 2); + udelay(gc_psx_delay); parport_write_data(gc->pd->port, GC_PSX_CLOCK | GC_PSX_POWER); /* Deselect, begin command */ - udelay(gc_psx_delay * 2); + udelay(gc_psx_delay); local_irq_save(flags); - gc_psx_command(gc, 0x01); /* Access pad */ - id = gc_psx_command(gc, 0x42); /* Get device id */ - if (gc_psx_command(gc, 0) == 0x5a) { /* Okay? */ - for (i = 0; i < GC_PSX_LEN(id) * 2; i++) - data[i] = gc_psx_command(gc, 0); - } else id = 0; + gc_psx_command(gc, 0x01, data2); /* Access pad */ + gc_psx_command(gc, 0x42, id); /* Get device ids */ + gc_psx_command(gc, 0, data2); /* Dump status */ + + for (i =0; i < 5; i++) /* Find the longest pad */ + if((gc_status_bit[i] & gc->pads[GC_PSX]) && (GC_PSX_LEN(id[i]) > max_len)) + max_len = GC_PSX_LEN(id[i]); + + for (i = 0; i < max_len * 2; i++) { /* Read in all the data */ + gc_psx_command(gc, 0, data2); + for (j = 0; j < 5; j++) + data[j][i] = data2[j]; + } local_irq_restore(flags); parport_write_data(gc->pd->port, GC_PSX_CLOCK | GC_PSX_SELECT | GC_PSX_POWER); - return GC_PSX_ID(id); + for(i = 0; i < 5; i++) /* Set id's to the real value */ + id[i] = GC_PSX_ID(id[i]); } /* @@ -316,6 +328,7 @@ struct gc *gc = (void *) private; struct input_dev *dev = gc->dev; unsigned char data[GC_MAX_LENGTH]; + unsigned char data_psx[5][GC_PSX_LENGTH]; int i, j, s; /* @@ -412,53 +425,72 @@ * PSX controllers */ - if (gc->pads[GC_PSX]) { + if (gc->pads[GC_PSX] || gc->pads[GC_DDR]) { - for (i = 0; i < 5; i++) - if (gc->pads[GC_PSX] & gc_status_bit[i]) - break; + gc_psx_read_packet(gc, data_psx, data); - switch (gc_psx_read_packet(gc, data)) { + for (i = 0; i < 5; i++) { + switch (data[i]) { - case GC_PSX_RUMBLE: + case GC_PSX_RUMBLE: - input_report_key(dev + i, BTN_THUMBL, ~data[0] & 0x04); - input_report_key(dev + i, BTN_THUMBR, ~data[0] & 0x02); - input_sync(dev + i); + input_report_key(dev + i, BTN_THUMBL, ~data_psx[i][0] & 0x04); + input_report_key(dev + i, BTN_THUMBR, ~data_psx[i][0] & 0x02); - case GC_PSX_NEGCON: - case GC_PSX_ANALOG: + case GC_PSX_NEGCON: + case GC_PSX_ANALOG: - for (j = 0; j < 4; j++) - input_report_abs(dev + i, gc_psx_abs[j], data[j + 2]); + if(gc->pads[GC_DDR] & gc_status_bit[i]) { + for(j = 0; j < 4; j++) + input_report_key(dev + i, gc_psx_ddr_btn[j], ~data_psx[i][0] & (0x10 << j)); + } else { + for (j = 0; j < 4; j++) + input_report_abs(dev + i, gc_psx_abs[j+2], data_psx[i][j + 2]); - input_report_abs(dev + i, ABS_HAT0X, !(data[0] & 0x20) - !(data[0] & 0x80)); - input_report_abs(dev + i, ABS_HAT0Y, !(data[0] & 0x40) - !(data[0] & 0x10)); + input_report_abs(dev + i, ABS_X, 128 + !(data_psx[i][0] & 0x20) * 127 - !(data_psx[i][0] & 0x80) * 128); + input_report_abs(dev + i, ABS_Y, 128 + !(data_psx[i][0] & 0x40) * 127 - !(data_psx[i][0] & 0x10) * 128); + } - for (j = 0; j < 8; j++) - input_report_key(dev + i, gc_psx_btn[j], ~data[1] & (1 << j)); + for (j = 0; j < 8; j++) + input_report_key(dev + i, gc_psx_btn[j], ~data_psx[i][1] & (1 << j)); - input_report_key(dev + i, BTN_START, ~data[0] & 0x08); - input_report_key(dev + i, BTN_SELECT, ~data[0] & 0x01); + input_report_key(dev + i, BTN_START, ~data_psx[i][0] & 0x08); + input_report_key(dev + i, BTN_SELECT, ~data_psx[i][0] & 0x01); - input_sync(dev + i); + input_sync(dev + i); - break; + break; - case GC_PSX_NORMAL: + case GC_PSX_NORMAL: + if(gc->pads[GC_DDR] & gc_status_bit[i]) { + for(j = 0; j < 4; j++) + input_report_key(dev + i, gc_psx_ddr_btn[j], ~data_psx[i][0] & (0x10 << j)); + } else { + input_report_abs(dev + i, ABS_X, 128 + !(data_psx[i][0] & 0x20) * 127 - !(data_psx[i][0] & 0x80) * 128); + input_report_abs(dev + i, ABS_Y, 128 + !(data_psx[i][0] & 0x40) * 127 - !(data_psx[i][0] & 0x10) * 128); - input_report_abs(dev + i, ABS_X, 128 + !(data[0] & 0x20) * 127 - !(data[0] & 0x80) * 128); - input_report_abs(dev + i, ABS_Y, 128 + !(data[0] & 0x40) * 127 - !(data[0] & 0x10) * 128); + /* for some reason if the extra axes are left unset they drift */ + /* for (j = 0; j < 4; j++) + input_report_abs(dev + i, gc_psx_abs[j+2], 128); + * This needs to be debugged properly, + * maybe fuzz processing needs to be done in input_sync() + * --vojtech + */ + } - for (j = 0; j < 8; j++) - input_report_key(dev + i, gc_psx_btn[j], ~data[1] & (1 << j)); + for (j = 0; j < 8; j++) + input_report_key(dev + i, gc_psx_btn[j], ~data_psx[i][1] & (1 << j)); - input_report_key(dev + i, BTN_START, ~data[0] & 0x08); - input_report_key(dev + i, BTN_SELECT, ~data[0] & 0x01); + input_report_key(dev + i, BTN_START, ~data_psx[i][0] & 0x08); + input_report_key(dev + i, BTN_SELECT, ~data_psx[i][0] & 0x01); - input_sync(dev + i); + input_sync(dev + i); - break; + break; + + case 0: /* not a pad, ignore */ + break; + } } } @@ -490,8 +522,7 @@ { struct gc *gc; struct parport *pp; - int i, j, psx; - unsigned char data[32]; + int i, j; if (config[0] < 0) return NULL; @@ -588,43 +619,22 @@ break; case GC_PSX: + case GC_DDR: + if(config[i + 1] == GC_DDR) { + for (j = 0; j < 4; j++) + set_bit(gc_psx_ddr_btn[j], gc->dev[i].keybit); + } else { + for (j = 0; j < 6; j++) { + set_bit(gc_psx_abs[j], gc->dev[i].absbit); + gc->dev[i].absmin[gc_psx_abs[j]] = 4; + gc->dev[i].absmax[gc_psx_abs[j]] = 252; + gc->dev[i].absflat[gc_psx_abs[j]] = 2; + } + } - psx = gc_psx_read_packet(gc, data); + for (j = 0; j < 12; j++) + set_bit(gc_psx_btn[j], gc->dev[i].keybit); - switch(psx) { - case GC_PSX_NEGCON: - case GC_PSX_NORMAL: - case GC_PSX_ANALOG: - case GC_PSX_RUMBLE: - - for (j = 0; j < 6; j++) { - psx = gc_psx_abs[j]; - set_bit(psx, gc->dev[i].absbit); - if (j < 4) { - gc->dev[i].absmin[psx] = 4; - gc->dev[i].absmax[psx] = 252; - gc->dev[i].absflat[psx] = 2; - } else { - gc->dev[i].absmin[psx] = -1; - gc->dev[i].absmax[psx] = 1; - } - } - - for (j = 0; j < 12; j++) - set_bit(gc_psx_btn[j], gc->dev[i].keybit); - - break; - - case 0: - gc->pads[GC_PSX] &= ~gc_status_bit[i]; - printk(KERN_ERR "gamecon.c: No PSX controller found.\n"); - break; - - default: - gc->pads[GC_PSX] &= ~gc_status_bit[i]; - printk(KERN_WARNING "gamecon.c: Unsupported PSX controller %#x," - " please report to .\n", psx); - } break; } diff -Nru a/drivers/input/joystick/grip_mp.c b/drivers/input/joystick/grip_mp.c --- a/drivers/input/joystick/grip_mp.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/input/joystick/grip_mp.c 2004-09-26 10:25:57 -07:00 @@ -107,6 +107,8 @@ static int axis_map[] = { 5, 9, 1, 5, 6, 10, 2, 6, 4, 8, 0, 4, 5, 9, 1, 5 }; +static void register_slot(int i, struct grip_mp *grip); + /* * Returns whether an odd or even number of bits are on in pkt. */ @@ -355,7 +357,6 @@ u32 packet; int joytype = 0; int slot = 0; - static void register_slot(int i, struct grip_mp *grip); /* Get a packet and check for validity */ diff -Nru a/drivers/input/joystick/iforce/iforce-main.c b/drivers/input/joystick/iforce/iforce-main.c --- a/drivers/input/joystick/iforce/iforce-main.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/input/joystick/iforce/iforce-main.c 2004-09-26 10:25:56 -07:00 @@ -524,7 +524,7 @@ usb_register(&iforce_usb_driver); #endif #ifdef CONFIG_JOYSTICK_IFORCE_232 - serio_register_device(&iforce_serio_dev); + serio_register_driver(&iforce_serio_drv); #endif return 0; } @@ -535,7 +535,7 @@ usb_deregister(&iforce_usb_driver); #endif #ifdef CONFIG_JOYSTICK_IFORCE_232 - serio_unregister_device(&iforce_serio_dev); + serio_unregister_driver(&iforce_serio_drv); #endif } diff -Nru a/drivers/input/joystick/iforce/iforce-serio.c b/drivers/input/joystick/iforce/iforce-serio.c --- a/drivers/input/joystick/iforce/iforce-serio.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/input/joystick/iforce/iforce-serio.c 2004-09-26 10:25:55 -07:00 @@ -124,7 +124,7 @@ return IRQ_HANDLED; } -static void iforce_serio_connect(struct serio *serio, struct serio_dev *dev) +static void iforce_serio_connect(struct serio *serio, struct serio_driver *drv) { struct iforce *iforce; if (serio->type != (SERIO_RS232 | SERIO_IFORCE)) @@ -137,7 +137,7 @@ iforce->serio = serio; serio->private = iforce; - if (serio_open(serio, dev)) { + if (serio_open(serio, drv)) { kfree(iforce); return; } @@ -158,9 +158,13 @@ kfree(iforce); } -struct serio_dev iforce_serio_dev = { - .write_wakeup = iforce_serio_write_wakeup, - .interrupt = iforce_serio_irq, - .connect = iforce_serio_connect, - .disconnect = iforce_serio_disconnect, +struct serio_driver iforce_serio_drv = { + .driver = { + .name = "iforce", + }, + .description = "RS232 I-Force joysticks and wheels driver", + .write_wakeup = iforce_serio_write_wakeup, + .interrupt = iforce_serio_irq, + .connect = iforce_serio_connect, + .disconnect = iforce_serio_disconnect, }; diff -Nru a/drivers/input/joystick/iforce/iforce.h b/drivers/input/joystick/iforce/iforce.h --- a/drivers/input/joystick/iforce/iforce.h 2004-09-26 10:25:58 -07:00 +++ b/drivers/input/joystick/iforce/iforce.h 2004-09-26 10:25:58 -07:00 @@ -187,5 +187,5 @@ int iforce_upload_condition(struct iforce*, struct ff_effect*, int is_update); /* Public variables */ -extern struct serio_dev iforce_serio_dev; +extern struct serio_driver iforce_serio_drv; extern struct usb_driver iforce_usb_driver; diff -Nru a/drivers/input/joystick/magellan.c b/drivers/input/joystick/magellan.c --- a/drivers/input/joystick/magellan.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/input/joystick/magellan.c 2004-09-26 10:25:55 -07:00 @@ -35,8 +35,10 @@ #include #include +#define DRIVER_DESC "Magellan and SpaceMouse 6dof controller driver" + MODULE_AUTHOR("Vojtech Pavlik "); -MODULE_DESCRIPTION("Magellan and SpaceMouse 6dof controller driver"); +MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); /* @@ -146,7 +148,7 @@ * it as an input device. */ -static void magellan_connect(struct serio *serio, struct serio_dev *dev) +static void magellan_connect(struct serio *serio, struct serio_driver *drv) { struct magellan *magellan; int i, t; @@ -184,7 +186,7 @@ serio->private = magellan; - if (serio_open(serio, dev)) { + if (serio_open(serio, drv)) { kfree(magellan); return; } @@ -199,10 +201,14 @@ * The serio device structure. */ -static struct serio_dev magellan_dev = { - .interrupt = magellan_interrupt, - .connect = magellan_connect, - .disconnect = magellan_disconnect, +static struct serio_driver magellan_drv = { + .driver = { + .name = "magellan", + }, + .description = DRIVER_DESC, + .interrupt = magellan_interrupt, + .connect = magellan_connect, + .disconnect = magellan_disconnect, }; /* @@ -211,13 +217,13 @@ int __init magellan_init(void) { - serio_register_device(&magellan_dev); + serio_register_driver(&magellan_drv); return 0; } void __exit magellan_exit(void) { - serio_unregister_device(&magellan_dev); + serio_unregister_driver(&magellan_drv); } module_init(magellan_init); diff -Nru a/drivers/input/joystick/spaceball.c b/drivers/input/joystick/spaceball.c --- a/drivers/input/joystick/spaceball.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/input/joystick/spaceball.c 2004-09-26 10:25:55 -07:00 @@ -39,8 +39,10 @@ #include #include +#define DRIVER_DESC "SpaceTec SpaceBall 2003/3003/4000 FLX driver" + MODULE_AUTHOR("Vojtech Pavlik "); -MODULE_DESCRIPTION("SpaceTec SpaceBall 2003/3003/4000 FLX driver"); +MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); /* @@ -201,7 +203,7 @@ * it as an input device. */ -static void spaceball_connect(struct serio *serio, struct serio_dev *dev) +static void spaceball_connect(struct serio *serio, struct serio_driver *drv) { struct spaceball *spaceball; int i, t, id; @@ -254,7 +256,7 @@ serio->private = spaceball; - if (serio_open(serio, dev)) { + if (serio_open(serio, drv)) { kfree(spaceball); return; } @@ -269,10 +271,14 @@ * The serio device structure. */ -static struct serio_dev spaceball_dev = { - .interrupt = spaceball_interrupt, - .connect = spaceball_connect, - .disconnect = spaceball_disconnect, +static struct serio_driver spaceball_drv = { + .driver = { + .name = "spaceball", + }, + .description = DRIVER_DESC, + .interrupt = spaceball_interrupt, + .connect = spaceball_connect, + .disconnect = spaceball_disconnect, }; /* @@ -281,13 +287,13 @@ int __init spaceball_init(void) { - serio_register_device(&spaceball_dev); + serio_register_driver(&spaceball_drv); return 0; } void __exit spaceball_exit(void) { - serio_unregister_device(&spaceball_dev); + serio_unregister_driver(&spaceball_drv); } module_init(spaceball_init); diff -Nru a/drivers/input/joystick/spaceorb.c b/drivers/input/joystick/spaceorb.c --- a/drivers/input/joystick/spaceorb.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/input/joystick/spaceorb.c 2004-09-26 10:25:56 -07:00 @@ -38,8 +38,10 @@ #include #include +#define DRIVER_DESC "SpaceTec SpaceOrb 360 and Avenger 6dof controller driver" + MODULE_AUTHOR("Vojtech Pavlik "); -MODULE_DESCRIPTION("SpaceTec SpaceOrb 360 and Avenger 6dof controller driver"); +MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); /* @@ -162,7 +164,7 @@ * it as an input device. */ -static void spaceorb_connect(struct serio *serio, struct serio_dev *dev) +static void spaceorb_connect(struct serio *serio, struct serio_driver *drv) { struct spaceorb *spaceorb; int i, t; @@ -201,7 +203,7 @@ serio->private = spaceorb; - if (serio_open(serio, dev)) { + if (serio_open(serio, drv)) { kfree(spaceorb); return; } @@ -213,10 +215,14 @@ * The serio device structure. */ -static struct serio_dev spaceorb_dev = { - .interrupt = spaceorb_interrupt, - .connect = spaceorb_connect, - .disconnect = spaceorb_disconnect, +static struct serio_driver spaceorb_drv = { + .driver = { + .name = "spaceorb", + }, + .description = DRIVER_DESC, + .interrupt = spaceorb_interrupt, + .connect = spaceorb_connect, + .disconnect = spaceorb_disconnect, }; /* @@ -225,13 +231,13 @@ int __init spaceorb_init(void) { - serio_register_device(&spaceorb_dev); + serio_register_driver(&spaceorb_drv); return 0; } void __exit spaceorb_exit(void) { - serio_unregister_device(&spaceorb_dev); + serio_unregister_driver(&spaceorb_drv); } module_init(spaceorb_init); diff -Nru a/drivers/input/joystick/stinger.c b/drivers/input/joystick/stinger.c --- a/drivers/input/joystick/stinger.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/input/joystick/stinger.c 2004-09-26 10:25:55 -07:00 @@ -36,8 +36,10 @@ #include #include +#define DRIVER_DESC "Gravis Stinger gamepad driver" + MODULE_AUTHOR("Vojtech Pavlik "); -MODULE_DESCRIPTION("Gravis Stinger gamepad driver"); +MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); /* @@ -134,7 +136,7 @@ * it as an input device. */ -static void stinger_connect(struct serio *serio, struct serio_dev *dev) +static void stinger_connect(struct serio *serio, struct serio_driver *drv) { struct stinger *stinger; int i; @@ -172,7 +174,7 @@ stinger->dev.private = stinger; serio->private = stinger; - if (serio_open(serio, dev)) { + if (serio_open(serio, drv)) { kfree(stinger); return; } @@ -187,10 +189,14 @@ * The serio device structure. */ -static struct serio_dev stinger_dev = { - .interrupt = stinger_interrupt, - .connect = stinger_connect, - .disconnect = stinger_disconnect, +static struct serio_driver stinger_drv = { + .driver = { + .name = "stinger", + }, + .description = DRIVER_DESC, + .interrupt = stinger_interrupt, + .connect = stinger_connect, + .disconnect = stinger_disconnect, }; /* @@ -199,13 +205,13 @@ int __init stinger_init(void) { - serio_register_device(&stinger_dev); + serio_register_driver(&stinger_drv); return 0; } void __exit stinger_exit(void) { - serio_unregister_device(&stinger_dev); + serio_unregister_driver(&stinger_drv); } module_init(stinger_init); diff -Nru a/drivers/input/joystick/tmdc.c b/drivers/input/joystick/tmdc.c --- a/drivers/input/joystick/tmdc.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/input/joystick/tmdc.c 2004-09-26 10:25:56 -07:00 @@ -322,7 +322,7 @@ tmdc->dev[j].evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); for (i = 0; i < models[m].abs && i < TMDC_ABS; i++) { - if (tmdc->abs[i] < 0) continue; + if (tmdc->abs[j][i] < 0) continue; set_bit(tmdc->abs[j][i], tmdc->dev[j].absbit); tmdc->dev[j].absmin[tmdc->abs[j][i]] = 8; tmdc->dev[j].absmax[tmdc->abs[j][i]] = 248; diff -Nru a/drivers/input/joystick/twidjoy.c b/drivers/input/joystick/twidjoy.c --- a/drivers/input/joystick/twidjoy.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/input/joystick/twidjoy.c 2004-09-26 10:25:55 -07:00 @@ -187,7 +187,7 @@ * it as an input device. */ -static void twidjoy_connect(struct serio *serio, struct serio_dev *dev) +static void twidjoy_connect(struct serio *serio, struct serio_driver *drv) { struct twidjoy_button_spec *bp; struct twidjoy *twidjoy; @@ -232,7 +232,7 @@ twidjoy->dev.private = twidjoy; serio->private = twidjoy; - if (serio_open(serio, dev)) { + if (serio_open(serio, drv)) { kfree(twidjoy); return; } @@ -246,10 +246,14 @@ * The serio device structure. */ -static struct serio_dev twidjoy_dev = { - .interrupt = twidjoy_interrupt, - .connect = twidjoy_connect, - .disconnect = twidjoy_disconnect, +static struct serio_driver twidjoy_drv = { + .driver = { + .name = "twidjoy", + }, + .description = DRIVER_DESC, + .interrupt = twidjoy_interrupt, + .connect = twidjoy_connect, + .disconnect = twidjoy_disconnect, }; /* @@ -258,13 +262,13 @@ int __init twidjoy_init(void) { - serio_register_device(&twidjoy_dev); + serio_register_driver(&twidjoy_drv); return 0; } void __exit twidjoy_exit(void) { - serio_unregister_device(&twidjoy_dev); + serio_unregister_driver(&twidjoy_drv); } module_init(twidjoy_init); diff -Nru a/drivers/input/joystick/warrior.c b/drivers/input/joystick/warrior.c --- a/drivers/input/joystick/warrior.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/input/joystick/warrior.c 2004-09-26 10:25:57 -07:00 @@ -35,8 +35,10 @@ #include #include +#define DRIVER_DESC "Logitech WingMan Warrior joystick driver" + MODULE_AUTHOR("Vojtech Pavlik "); -MODULE_DESCRIPTION("Logitech WingMan Warrior joystick driver"); +MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); /* @@ -139,7 +141,7 @@ * it as an input device. */ -static void warrior_connect(struct serio *serio, struct serio_dev *dev) +static void warrior_connect(struct serio *serio, struct serio_driver *drv) { struct warrior *warrior; int i; @@ -185,7 +187,7 @@ serio->private = warrior; - if (serio_open(serio, dev)) { + if (serio_open(serio, drv)) { kfree(warrior); return; } @@ -199,10 +201,14 @@ * The serio device structure. */ -static struct serio_dev warrior_dev = { - .interrupt = warrior_interrupt, - .connect = warrior_connect, - .disconnect = warrior_disconnect, +static struct serio_driver warrior_drv = { + .driver = { + .name = "warrior", + }, + .description = DRIVER_DESC, + .interrupt = warrior_interrupt, + .connect = warrior_connect, + .disconnect = warrior_disconnect, }; /* @@ -211,13 +217,13 @@ int __init warrior_init(void) { - serio_register_device(&warrior_dev); + serio_register_driver(&warrior_drv); return 0; } void __exit warrior_exit(void) { - serio_unregister_device(&warrior_dev); + serio_unregister_driver(&warrior_drv); } module_init(warrior_init); diff -Nru a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c --- a/drivers/input/keyboard/atkbd.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/input/keyboard/atkbd.c 2004-09-26 10:25:57 -07:00 @@ -27,8 +27,10 @@ #include #include +#define DRIVER_DESC "AT and PS/2 keyboard driver" + MODULE_AUTHOR("Vojtech Pavlik "); -MODULE_DESCRIPTION("AT and PS/2 keyboard driver"); +MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); static int atkbd_set = 2; @@ -47,6 +49,10 @@ module_param_named(softrepeat, atkbd_softrepeat, bool, 0); MODULE_PARM_DESC(softrepeat, "Use software keyboard repeat"); +static int atkbd_softraw = 1; +module_param_named(softraw, atkbd_softraw, bool, 0); +MODULE_PARM_DESC(softraw, "Use software generated rawmode"); + static int atkbd_scroll; module_param_named(scroll, atkbd_scroll, bool, 0); MODULE_PARM_DESC(scroll, "Enable scroll-wheel on MS Office and similar keyboards"); @@ -164,36 +170,64 @@ { ATKBD_SCR_CLICK, 0x60 }, }; +#define ATKBD_FLAG_ACK 0 /* Waiting for ACK/NAK */ +#define ATKBD_FLAG_CMD 1 /* Waiting for command to finish */ +#define ATKBD_FLAG_CMD1 2 /* First byte of command response */ +#define ATKBD_FLAG_ENABLED 3 /* Waining for init to finish */ + /* * The atkbd control structure */ struct atkbd { - unsigned char keycode[512]; - struct input_dev dev; - struct serio *serio; + /* Written only during init */ char name[64]; char phys[32]; - unsigned short id; + struct serio *serio; + struct input_dev dev; + unsigned char set; - unsigned int translated:1; - unsigned int extra:1; - unsigned int write:1; + unsigned short id; + unsigned char keycode[512]; + unsigned char translated; + unsigned char extra; + unsigned char write; + + /* Protected by FLAG_ACK */ + unsigned char nak; + /* Protected by FLAG_CMD */ unsigned char cmdbuf[4]; unsigned char cmdcnt; - volatile signed char ack; - unsigned char emul; - unsigned int resend:1; - unsigned int release:1; - unsigned int bat_xl:1; - unsigned int enabled:1; + /* Accessed only from interrupt */ + unsigned char emul; + unsigned char resend; + unsigned char release; + unsigned char bat_xl; unsigned int last; unsigned long time; + + /* Ensures that only one command is executing at a time */ + struct semaphore cmd_sem; + + /* Used to signal completion from interrupt handler */ + wait_queue_head_t wait; + + /* Flags */ + unsigned long flags; }; +/* Work structure to schedule execution of a command */ +struct atkbd_work { + struct work_struct work; + struct atkbd *atkbd; + int command; + unsigned char param[0]; +}; + + static void atkbd_report_key(struct input_dev *dev, struct pt_regs *regs, int code, int value) { input_regs(dev, regs); @@ -224,7 +258,7 @@ #if !defined(__i386__) && !defined (__x86_64__) if ((flags & (SERIO_FRAME | SERIO_PARITY)) && (~flags & SERIO_TIMEOUT) && !atkbd->resend && atkbd->write) { - printk("atkbd.c: frame/parity error: %02x\n", flags); + printk(KERN_WARNING "atkbd.c: frame/parity error: %02x\n", flags); serio_write(serio, ATKBD_CMD_RESEND); atkbd->resend = 1; goto out; @@ -234,24 +268,46 @@ atkbd->resend = 0; #endif - if (!atkbd->ack) + if (test_bit(ATKBD_FLAG_ACK, &atkbd->flags)) { switch (code) { case ATKBD_RET_ACK: - atkbd->ack = 1; - goto out; + atkbd->nak = 0; + if (atkbd->cmdcnt) { + set_bit(ATKBD_FLAG_CMD, &atkbd->flags); + set_bit(ATKBD_FLAG_CMD1, &atkbd->flags); + } + clear_bit(ATKBD_FLAG_ACK, &atkbd->flags); + wake_up_interruptible(&atkbd->wait); + break; case ATKBD_RET_NAK: - atkbd->ack = -1; - goto out; + atkbd->nak = 1; + clear_bit(ATKBD_FLAG_ACK, &atkbd->flags); + wake_up_interruptible(&atkbd->wait); + break; } + goto out; + } + + if (test_bit(ATKBD_FLAG_CMD, &atkbd->flags)) { + + if (atkbd->cmdcnt) + atkbd->cmdbuf[--atkbd->cmdcnt] = code; - if (atkbd->cmdcnt) { - atkbd->cmdbuf[--atkbd->cmdcnt] = code; + if (test_and_clear_bit(ATKBD_FLAG_CMD1, &atkbd->flags) && atkbd->cmdcnt) + wake_up_interruptible(&atkbd->wait); + + if (!atkbd->cmdcnt) { + clear_bit(ATKBD_FLAG_CMD, &atkbd->flags); + wake_up_interruptible(&atkbd->wait); + } goto out; } - if (!atkbd->enabled) + if (!test_bit(ATKBD_FLAG_ENABLED, &atkbd->flags)) goto out; + input_event(&atkbd->dev, EV_MSC, MSC_RAW, code); + if (atkbd->translated) { if (atkbd->emul || @@ -270,6 +326,7 @@ switch (code) { case ATKBD_RET_BAT: + clear_bit(ATKBD_FLAG_ENABLED, &atkbd->flags); serio_rescan(atkbd->serio); goto out; case ATKBD_RET_EMUL0: @@ -300,6 +357,9 @@ code |= (atkbd->set != 3) ? 0x80 : 0x100; } + if (atkbd->keycode[code] != ATKBD_KEY_NULL) + input_event(&atkbd->dev, EV_MSC, MSC_SCAN, code); + switch (atkbd->keycode[code]) { case ATKBD_KEY_NULL: break; @@ -372,83 +432,147 @@ * acknowledge. It doesn't handle resends according to the keyboard * protocol specs, because if these are needed, the keyboard needs * replacement anyway, and they only make a mess in the protocol. + * + * atkbd_sendbyte() can only be called from a process context */ static int atkbd_sendbyte(struct atkbd *atkbd, unsigned char byte) { - int timeout = 20000; /* 200 msec */ - atkbd->ack = 0; - #ifdef ATKBD_DEBUG printk(KERN_DEBUG "atkbd.c: Sent: %02x\n", byte); #endif - if (serio_write(atkbd->serio, byte)) - return -1; + atkbd->nak = 1; + set_bit(ATKBD_FLAG_ACK, &atkbd->flags); - while (!atkbd->ack && timeout--) udelay(10); + if (serio_write(atkbd->serio, byte) == 0) + wait_event_interruptible_timeout(atkbd->wait, + !test_bit(ATKBD_FLAG_ACK, &atkbd->flags), + msecs_to_jiffies(200)); - return -(atkbd->ack <= 0); + clear_bit(ATKBD_FLAG_ACK, &atkbd->flags); + return -atkbd->nak; } /* * atkbd_command() sends a command, and its parameters to the keyboard, * then waits for the response and puts it in the param array. + * + * atkbd_command() can only be called from a process context */ static int atkbd_command(struct atkbd *atkbd, unsigned char *param, int command) { - int timeout = 500000; /* 500 msec */ + int timeout; int send = (command >> 12) & 0xf; int receive = (command >> 8) & 0xf; + int rc = -1; int i; - atkbd->cmdcnt = receive; + timeout = msecs_to_jiffies(command == ATKBD_CMD_RESET_BAT ? 4000 : 500); - if (command == ATKBD_CMD_RESET_BAT) - timeout = 2000000; /* 2 sec */ + down(&atkbd->cmd_sem); + clear_bit(ATKBD_FLAG_CMD, &atkbd->flags); if (receive && param) for (i = 0; i < receive; i++) atkbd->cmdbuf[(receive - 1) - i] = param[i]; + atkbd->cmdcnt = receive; + if (command & 0xff) if (atkbd_sendbyte(atkbd, command & 0xff)) - return (atkbd->cmdcnt = 0) - 1; + goto out; for (i = 0; i < send; i++) if (atkbd_sendbyte(atkbd, param[i])) - return (atkbd->cmdcnt = 0) - 1; - - while (atkbd->cmdcnt && timeout--) { + goto out; - if (atkbd->cmdcnt == 1 && - command == ATKBD_CMD_RESET_BAT && timeout > 100000) - timeout = 100000; + timeout = wait_event_interruptible_timeout(atkbd->wait, + !test_bit(ATKBD_FLAG_CMD1, &atkbd->flags), timeout); - if (atkbd->cmdcnt == 1 && command == ATKBD_CMD_GETID && - atkbd->cmdbuf[1] != 0xab && atkbd->cmdbuf[1] != 0xac) { + if (atkbd->cmdcnt && timeout > 0) { + if (command == ATKBD_CMD_RESET_BAT && jiffies_to_msecs(timeout) > 100) + timeout = msecs_to_jiffies(100); + + if (command == ATKBD_CMD_GETID && + atkbd->cmdbuf[receive - 1] != 0xab && atkbd->cmdbuf[receive - 1] != 0xac) { + /* + * Device behind the port is not a keyboard + * so we don't need to wait for the 2nd byte + * of ID response. + */ + clear_bit(ATKBD_FLAG_CMD, &atkbd->flags); atkbd->cmdcnt = 0; - break; } - udelay(1); + wait_event_interruptible_timeout(atkbd->wait, + !test_bit(ATKBD_FLAG_CMD, &atkbd->flags), timeout); } if (param) for (i = 0; i < receive; i++) param[i] = atkbd->cmdbuf[(receive - 1) - i]; - if (command == ATKBD_CMD_RESET_BAT && atkbd->cmdcnt == 1) - atkbd->cmdcnt = 0; + if (atkbd->cmdcnt && (command != ATKBD_CMD_RESET_BAT || atkbd->cmdcnt != 1)) + goto out; + + rc = 0; + +out: + clear_bit(ATKBD_FLAG_CMD, &atkbd->flags); + clear_bit(ATKBD_FLAG_CMD1, &atkbd->flags); + up(&atkbd->cmd_sem); + + return rc; +} + +/* + * atkbd_execute_scheduled_command() sends a command, previously scheduled by + * atkbd_schedule_command(), to the keyboard. + */ + +static void atkbd_execute_scheduled_command(void *data) +{ + struct atkbd_work *atkbd_work = data; + + atkbd_command(atkbd_work->atkbd, atkbd_work->param, atkbd_work->command); + + kfree(atkbd_work); +} + +/* + * atkbd_schedule_command() allows to schedule delayed execution of a keyboard + * command and can be used to issue a command from an interrupt or softirq + * context. + */ + +static int atkbd_schedule_command(struct atkbd *atkbd, unsigned char *param, int command) +{ + struct atkbd_work *atkbd_work; + int send = (command >> 12) & 0xf; + int receive = (command >> 8) & 0xf; + + if (!test_bit(ATKBD_FLAG_ENABLED, &atkbd->flags)) + return -1; - if (atkbd->cmdcnt) { - atkbd->cmdcnt = 0; + if (!(atkbd_work = kmalloc(sizeof(struct atkbd_work) + max(send, receive), GFP_ATOMIC))) + return -1; + + memset(atkbd_work, 0, sizeof(struct atkbd_work)); + atkbd_work->atkbd = atkbd; + atkbd_work->command = command; + memcpy(atkbd_work->param, param, send); + INIT_WORK(&atkbd_work->work, atkbd_execute_scheduled_command, atkbd_work); + + if (!schedule_work(&atkbd_work->work)) { + kfree(atkbd_work); return -1; } return 0; } + /* * Event callback from the input module. Events that change the state of * the hardware are processed here. @@ -475,7 +599,7 @@ param[0] = (test_bit(LED_SCROLLL, dev->led) ? 1 : 0) | (test_bit(LED_NUML, dev->led) ? 2 : 0) | (test_bit(LED_CAPSL, dev->led) ? 4 : 0); - atkbd_command(atkbd, param, ATKBD_CMD_SETLEDS); + atkbd_schedule_command(atkbd, param, ATKBD_CMD_SETLEDS); if (atkbd->extra) { param[0] = 0; @@ -484,7 +608,7 @@ | (test_bit(LED_SUSPEND, dev->led) ? 0x04 : 0) | (test_bit(LED_MISC, dev->led) ? 0x10 : 0) | (test_bit(LED_MUTE, dev->led) ? 0x20 : 0); - atkbd_command(atkbd, param, ATKBD_CMD_EX_SETLEDS); + atkbd_schedule_command(atkbd, param, ATKBD_CMD_EX_SETLEDS); } return 0; @@ -500,7 +624,7 @@ dev->rep[REP_PERIOD] = period[i]; dev->rep[REP_DELAY] = delay[j]; param[0] = i | (j << 5); - atkbd_command(atkbd, param, ATKBD_CMD_SETREP); + atkbd_schedule_command(atkbd, param, ATKBD_CMD_SETREP); return 0; } @@ -672,6 +796,11 @@ static void atkbd_disconnect(struct serio *serio) { struct atkbd *atkbd = serio->private; + + clear_bit(ATKBD_FLAG_ENABLED, &atkbd->flags); + synchronize_kernel(); + flush_scheduled_work(); + input_unregister_device(&atkbd->dev); serio_close(serio); kfree(atkbd); @@ -684,7 +813,7 @@ * to the input module. */ -static void atkbd_connect(struct serio *serio, struct serio_dev *dev) +static void atkbd_connect(struct serio *serio, struct serio_driver *drv) { struct atkbd *atkbd; int i; @@ -693,6 +822,9 @@ return; memset(atkbd, 0, sizeof(struct atkbd)); + init_MUTEX(&atkbd->cmd_sem); + init_waitqueue_head(&atkbd->wait); + switch (serio->type & SERIO_TYPE) { case SERIO_8042_XL: @@ -709,17 +841,22 @@ return; } + if (!atkbd->write) + atkbd_softrepeat = 1; + if (atkbd_softrepeat) + atkbd_softraw = 1; + if (atkbd->write) { - atkbd->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_LED) | BIT(EV_REP); + atkbd->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_LED) | BIT(EV_REP) | BIT(EV_MSC); atkbd->dev.ledbit[0] = BIT(LED_NUML) | BIT(LED_CAPSL) | BIT(LED_SCROLLL); - } else atkbd->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REP); + } else atkbd->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REP) | BIT(EV_MSC); + atkbd->dev.mscbit[0] = atkbd_softraw ? BIT(MSC_SCAN) : BIT(MSC_RAW) | BIT(MSC_SCAN); if (!atkbd_softrepeat) { atkbd->dev.rep[REP_DELAY] = 250; atkbd->dev.rep[REP_PERIOD] = 33; - } + } else atkbd_softraw = 1; - atkbd->ack = 1; atkbd->serio = serio; init_input_dev(&atkbd->dev); @@ -732,7 +869,7 @@ serio->private = atkbd; - if (serio_open(serio, dev)) { + if (serio_open(serio, drv)) { kfree(atkbd); return; } @@ -754,8 +891,6 @@ 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"); @@ -797,6 +932,8 @@ input_register_device(&atkbd->dev); + set_bit(ATKBD_FLAG_ENABLED, &atkbd->flags); + printk(KERN_INFO "input: %s on %s\n", atkbd->name, serio->phys); } @@ -808,10 +945,10 @@ static int atkbd_reconnect(struct serio *serio) { struct atkbd *atkbd = serio->private; - struct serio_dev *dev = serio->dev; + struct serio_driver *drv = serio->drv; unsigned char param[1]; - if (!dev) { + if (!drv) { printk(KERN_DEBUG "atkbd: reconnect request, but serio is disconnected, ignoring...\n"); return -1; } @@ -832,26 +969,32 @@ return -1; } + set_bit(ATKBD_FLAG_ENABLED, &atkbd->flags); + return 0; } -static struct serio_dev atkbd_dev = { - .interrupt = atkbd_interrupt, - .connect = atkbd_connect, - .reconnect = atkbd_reconnect, - .disconnect = atkbd_disconnect, - .cleanup = atkbd_cleanup, +static struct serio_driver atkbd_drv = { + .driver = { + .name = "atkbd", + }, + .description = DRIVER_DESC, + .interrupt = atkbd_interrupt, + .connect = atkbd_connect, + .reconnect = atkbd_reconnect, + .disconnect = atkbd_disconnect, + .cleanup = atkbd_cleanup, }; int __init atkbd_init(void) { - serio_register_device(&atkbd_dev); + serio_register_driver(&atkbd_drv); return 0; } void __exit atkbd_exit(void) { - serio_unregister_device(&atkbd_dev); + serio_unregister_driver(&atkbd_drv); } module_init(atkbd_init); diff -Nru a/drivers/input/keyboard/lkkbd.c b/drivers/input/keyboard/lkkbd.c --- a/drivers/input/keyboard/lkkbd.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/input/keyboard/lkkbd.c 2004-09-26 10:25:55 -07:00 @@ -76,8 +76,10 @@ #include #include +#define DRIVER_DESC "LK keyboard driver" + MODULE_AUTHOR ("Jan-Benedict Glaw "); -MODULE_DESCRIPTION ("LK keyboard driver"); +MODULE_DESCRIPTION (DRIVER_DESC); MODULE_LICENSE ("GPL"); /* @@ -622,7 +624,7 @@ * lkkbd_connect() probes for a LK keyboard and fills the necessary structures. */ static void -lkkbd_connect (struct serio *serio, struct serio_dev *dev) +lkkbd_connect (struct serio *serio, struct serio_driver *drv) { struct lkkbd *lk; int i; @@ -665,7 +667,7 @@ serio->private = lk; - if (serio_open (serio, dev)) { + if (serio_open (serio, drv)) { kfree (lk); return; } @@ -703,10 +705,14 @@ kfree (lk); } -static struct serio_dev lkkbd_dev = { - .connect = lkkbd_connect, - .disconnect = lkkbd_disconnect, - .interrupt = lkkbd_interrupt, +static struct serio_driver lkkbd_drv = { + .driver = { + .name = "lkkbd", + }, + .description = DRIVER_DESC, + .connect = lkkbd_connect, + .disconnect = lkkbd_disconnect, + .interrupt = lkkbd_interrupt, }; /* @@ -715,14 +721,14 @@ int __init lkkbd_init (void) { - serio_register_device (&lkkbd_dev); + serio_register_driver(&lkkbd_drv); return 0; } void __exit lkkbd_exit (void) { - serio_unregister_device (&lkkbd_dev); + serio_unregister_driver(&lkkbd_drv); } module_init (lkkbd_init); diff -Nru a/drivers/input/keyboard/newtonkbd.c b/drivers/input/keyboard/newtonkbd.c --- a/drivers/input/keyboard/newtonkbd.c 2004-09-26 10:25:58 -07:00 +++ b/drivers/input/keyboard/newtonkbd.c 2004-09-26 10:25:58 -07:00 @@ -32,8 +32,10 @@ #include #include +#define DRIVER_DESC "Newton keyboard driver" + MODULE_AUTHOR("Justin Cormack "); -MODULE_DESCRIPTION("Newton keyboard driver"); +MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); #define NKBD_KEY 0x7f @@ -82,7 +84,7 @@ } -void nkbd_connect(struct serio *serio, struct serio_dev *dev) +void nkbd_connect(struct serio *serio, struct serio_driver *drv) { struct nkbd *nkbd; int i; @@ -106,7 +108,7 @@ nkbd->dev.private = nkbd; serio->private = nkbd; - if (serio_open(serio, dev)) { + if (serio_open(serio, drv)) { kfree(nkbd); return; } @@ -138,21 +140,25 @@ kfree(nkbd); } -struct serio_dev nkbd_dev = { - .interrupt = nkbd_interrupt, - .connect = nkbd_connect, - .disconnect = nkbd_disconnect +struct serio_driver nkbd_drv = { + .driver = { + .name = "newtonkbd", + }, + .description = DRIVER_DESC, + .interrupt = nkbd_interrupt, + .connect = nkbd_connect, + .disconnect = nkbd_disconnect, }; int __init nkbd_init(void) { - serio_register_device(&nkbd_dev); + serio_register_driver(&nkbd_drv); return 0; } void __exit nkbd_exit(void) { - serio_unregister_device(&nkbd_dev); + serio_unregister_driver(&nkbd_drv); } module_init(nkbd_init); diff -Nru a/drivers/input/keyboard/sunkbd.c b/drivers/input/keyboard/sunkbd.c --- a/drivers/input/keyboard/sunkbd.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/input/keyboard/sunkbd.c 2004-09-26 10:25:55 -07:00 @@ -37,8 +37,10 @@ #include #include +#define DRIVER_DESC "Sun keyboard driver" + MODULE_AUTHOR("Vojtech Pavlik "); -MODULE_DESCRIPTION("Sun keyboard driver"); +MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); static unsigned char sunkbd_keycode[128] = { @@ -221,7 +223,7 @@ * sunkbd_connect() probes for a Sun keyboard and fills the necessary structures. */ -static void sunkbd_connect(struct serio *serio, struct serio_dev *dev) +static void sunkbd_connect(struct serio *serio, struct serio_driver *drv) { struct sunkbd *sunkbd; int i; @@ -257,7 +259,7 @@ serio->private = sunkbd; - if (serio_open(serio, dev)) { + if (serio_open(serio, drv)) { kfree(sunkbd); return; } @@ -301,10 +303,14 @@ kfree(sunkbd); } -static struct serio_dev sunkbd_dev = { - .interrupt = sunkbd_interrupt, - .connect = sunkbd_connect, - .disconnect = sunkbd_disconnect +static struct serio_driver sunkbd_drv = { + .driver = { + .name = "sunkbd", + }, + .description = DRIVER_DESC, + .interrupt = sunkbd_interrupt, + .connect = sunkbd_connect, + .disconnect = sunkbd_disconnect, }; /* @@ -313,13 +319,13 @@ int __init sunkbd_init(void) { - serio_register_device(&sunkbd_dev); + serio_register_driver(&sunkbd_drv); return 0; } void __exit sunkbd_exit(void) { - serio_unregister_device(&sunkbd_dev); + serio_unregister_driver(&sunkbd_drv); } module_init(sunkbd_init); diff -Nru a/drivers/input/keyboard/xtkbd.c b/drivers/input/keyboard/xtkbd.c --- a/drivers/input/keyboard/xtkbd.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/input/keyboard/xtkbd.c 2004-09-26 10:25:56 -07:00 @@ -34,8 +34,10 @@ #include #include +#define DRIVER_DESC "XT keyboard driver" + MODULE_AUTHOR("Vojtech Pavlik "); -MODULE_DESCRIPTION("XT keyboard driver"); +MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); #define XTKBD_EMUL0 0xe0 @@ -86,7 +88,7 @@ return IRQ_HANDLED; } -void xtkbd_connect(struct serio *serio, struct serio_dev *dev) +void xtkbd_connect(struct serio *serio, struct serio_driver *drv) { struct xtkbd *xtkbd; int i; @@ -111,7 +113,7 @@ serio->private = xtkbd; - if (serio_open(serio, dev)) { + if (serio_open(serio, drv)) { kfree(xtkbd); return; } @@ -143,21 +145,25 @@ kfree(xtkbd); } -struct serio_dev xtkbd_dev = { - .interrupt = xtkbd_interrupt, - .connect = xtkbd_connect, - .disconnect = xtkbd_disconnect +struct serio_driver xtkbd_drv = { + .driver = { + .name = "xtkbd", + }, + .description = DRIVER_DESC, + .interrupt = xtkbd_interrupt, + .connect = xtkbd_connect, + .disconnect = xtkbd_disconnect, }; int __init xtkbd_init(void) { - serio_register_device(&xtkbd_dev); + serio_register_driver(&xtkbd_drv); return 0; } void __exit xtkbd_exit(void) { - serio_unregister_device(&xtkbd_dev); + serio_unregister_driver(&xtkbd_drv); } module_init(xtkbd_init); diff -Nru a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig --- a/drivers/input/misc/Kconfig 2004-09-26 10:25:56 -07:00 +++ b/drivers/input/misc/Kconfig 2004-09-26 10:25:56 -07:00 @@ -14,7 +14,7 @@ config INPUT_PCSPKR tristate "PC Speaker support" - depends on (ALPHA || X86 || X86_64 || MIPS) && INPUT && INPUT_MISC + depends on (ALPHA || X86 || X86_64 || MIPS || PPC_PREP || PPC_CHRP || PPC_PSERIES) && INPUT && INPUT_MISC help Say Y here if you want the standard PC Speaker to be used for bells and whistles. diff -Nru a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c --- a/drivers/input/misc/uinput.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/input/misc/uinput.c 2004-09-26 10:25:57 -07:00 @@ -279,6 +279,9 @@ { struct uinput_device *udev = file->private_data; + if (!test_bit(UIST_CREATED, &(udev->state))) + return 0; + poll_wait(file, &udev->waitq, wait); if (udev->head != udev->tail) diff -Nru a/drivers/input/mouse/Kconfig b/drivers/input/mouse/Kconfig --- a/drivers/input/mouse/Kconfig 2004-09-26 10:25:57 -07:00 +++ b/drivers/input/mouse/Kconfig 2004-09-26 10:25:57 -07:00 @@ -30,8 +30,6 @@ and a new verion of GPM at: http://www.geocities.com/dt_or/gpm/gpm.html to take advantage of the advanced features of the touchpad. - If you do not want install specialized drivers but want tapping - working please use option psmouse.proto=imps. If unsure, say Y. diff -Nru a/drivers/input/mouse/logips2pp.c b/drivers/input/mouse/logips2pp.c --- a/drivers/input/mouse/logips2pp.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/input/mouse/logips2pp.c 2004-09-26 10:25:56 -07:00 @@ -277,7 +277,7 @@ protocol = PSMOUSE_PS2TPP; } - } else if (get_model_info(model) != NULL) { + } else if (model_info != NULL) { param[0] = param[1] = param[2] = 0; ps2pp_cmd(psmouse, param, 0x39); /* Magic knock */ diff -Nru a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c --- a/drivers/input/mouse/psmouse-base.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/input/mouse/psmouse-base.c 2004-09-26 10:25:55 -07:00 @@ -22,8 +22,10 @@ #include "synaptics.h" #include "logips2pp.h" +#define DRIVER_DESC "PS/2 mouse driver" + MODULE_AUTHOR("Vojtech Pavlik "); -MODULE_DESCRIPTION("PS/2 mouse driver"); +MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); static char *psmouse_proto; @@ -142,37 +144,67 @@ printk(KERN_WARNING "psmouse.c: bad data from KBC -%s%s\n", flags & SERIO_TIMEOUT ? " timeout" : "", flags & SERIO_PARITY ? " bad parity" : ""); - if (psmouse->acking) { - psmouse->ack = -1; - psmouse->acking = 0; - } - psmouse->pktcnt = 0; + psmouse->nak = 1; + clear_bit(PSMOUSE_FLAG_ACK, &psmouse->flags); + clear_bit(PSMOUSE_FLAG_CMD, &psmouse->flags); + wake_up_interruptible(&psmouse->wait); goto out; } - if (psmouse->acking) { + if (test_bit(PSMOUSE_FLAG_ACK, &psmouse->flags)) { switch (data) { case PSMOUSE_RET_ACK: - psmouse->ack = 1; + psmouse->nak = 0; break; + case PSMOUSE_RET_NAK: - psmouse->ack = -1; + psmouse->nak = 1; break; + + /* + * Workaround for mice which don't ACK the Get ID command. + * These are valid mouse IDs that we recognize. + */ + case 0x00: + case 0x03: + case 0x04: + if (test_bit(PSMOUSE_FLAG_WAITID, &psmouse->flags)) { + psmouse->nak = 0; + break; + } + /* Fall through */ default: - psmouse->ack = 1; /* Workaround for mice which don't ACK the Get ID command */ - if (psmouse->cmdcnt) - psmouse->cmdbuf[--psmouse->cmdcnt] = data; - break; + goto out; } - psmouse->acking = 0; - goto out; + + if (!psmouse->nak && psmouse->cmdcnt) { + set_bit(PSMOUSE_FLAG_CMD, &psmouse->flags); + set_bit(PSMOUSE_FLAG_CMD1, &psmouse->flags); + } + clear_bit(PSMOUSE_FLAG_ACK, &psmouse->flags); + wake_up_interruptible(&psmouse->wait); + + if (data == PSMOUSE_RET_ACK || data == PSMOUSE_RET_NAK) + goto out; } - if (psmouse->cmdcnt) { - psmouse->cmdbuf[--psmouse->cmdcnt] = data; + if (test_bit(PSMOUSE_FLAG_CMD, &psmouse->flags)) { + if (psmouse->cmdcnt) + psmouse->cmdbuf[--psmouse->cmdcnt] = data; + + if (test_and_clear_bit(PSMOUSE_FLAG_CMD1, &psmouse->flags) && psmouse->cmdcnt) + wake_up_interruptible(&psmouse->wait); + + if (!psmouse->cmdcnt) { + clear_bit(PSMOUSE_FLAG_CMD, &psmouse->flags); + wake_up_interruptible(&psmouse->wait); + } goto out; } + if (psmouse->state == PSMOUSE_INITIALIZING) + goto out; + if (psmouse->state == PSMOUSE_ACTIVATED && psmouse->pktcnt && time_after(jiffies, psmouse->last + HZ/2)) { printk(KERN_WARNING "psmouse.c: %s at %s lost synchronization, throwing %d bytes away.\n", @@ -238,78 +270,96 @@ * psmouse_sendbyte() sends a byte to the mouse, and waits for acknowledge. * It doesn't handle retransmission, though it could - because when there would * be need for retransmissions, the mouse has to be replaced anyway. + * + * psmouse_sendbyte() can only be called from a process context */ static int psmouse_sendbyte(struct psmouse *psmouse, unsigned char byte) { - int timeout = 10000; /* 100 msec */ - psmouse->ack = 0; - psmouse->acking = 1; - - if (serio_write(psmouse->serio, byte)) { - psmouse->acking = 0; - return -1; - } + psmouse->nak = 1; + set_bit(PSMOUSE_FLAG_ACK, &psmouse->flags); - while (!psmouse->ack && timeout--) udelay(10); + if (serio_write(psmouse->serio, byte) == 0) + wait_event_interruptible_timeout(psmouse->wait, + !test_bit(PSMOUSE_FLAG_ACK, &psmouse->flags), + msecs_to_jiffies(200)); - return -(psmouse->ack <= 0); + clear_bit(PSMOUSE_FLAG_ACK, &psmouse->flags); + return -psmouse->nak; } /* * psmouse_command() sends a command and its parameters to the mouse, * then waits for the response and puts it in the param array. + * + * psmouse_command() can only be called from a process context */ int psmouse_command(struct psmouse *psmouse, unsigned char *param, int command) { - int timeout = 500000; /* 500 msec */ + int timeout; int send = (command >> 12) & 0xf; int receive = (command >> 8) & 0xf; + int rc = -1; int i; - psmouse->cmdcnt = receive; + timeout = msecs_to_jiffies(command == PSMOUSE_CMD_RESET_BAT ? 4000 : 500); - if (command == PSMOUSE_CMD_RESET_BAT) - timeout = 4000000; /* 4 sec */ + clear_bit(PSMOUSE_FLAG_CMD, &psmouse->flags); + if (command == PSMOUSE_CMD_GETID) + set_bit(PSMOUSE_FLAG_WAITID, &psmouse->flags); + + if (receive && param) + for (i = 0; i < receive; i++) + psmouse->cmdbuf[(receive - 1) - i] = param[i]; - /* initialize cmdbuf with preset values from param */ - if (receive) - for (i = 0; i < receive; i++) - psmouse->cmdbuf[(receive - 1) - i] = param[i]; + psmouse->cmdcnt = receive; if (command & 0xff) if (psmouse_sendbyte(psmouse, command & 0xff)) - return (psmouse->cmdcnt = 0) - 1; + goto out; for (i = 0; i < send; i++) if (psmouse_sendbyte(psmouse, param[i])) - return (psmouse->cmdcnt = 0) - 1; - - while (psmouse->cmdcnt && timeout--) { + goto out; - if (psmouse->cmdcnt == 1 && command == PSMOUSE_CMD_RESET_BAT && - timeout > 100000) /* do not run in a endless loop */ - timeout = 100000; /* 1 sec */ + timeout = wait_event_interruptible_timeout(psmouse->wait, + !test_bit(PSMOUSE_FLAG_CMD1, &psmouse->flags), timeout); - if (psmouse->cmdcnt == 1 && command == PSMOUSE_CMD_GETID && - psmouse->cmdbuf[1] != 0xab && psmouse->cmdbuf[1] != 0xac) { + if (psmouse->cmdcnt && timeout > 0) { + if (command == PSMOUSE_CMD_RESET_BAT && jiffies_to_msecs(timeout) > 100) + timeout = msecs_to_jiffies(100); + + if (command == PSMOUSE_CMD_GETID && + psmouse->cmdbuf[receive - 1] != 0xab && psmouse->cmdbuf[receive - 1] != 0xac) { + /* + * Device behind the port is not a keyboard + * so we don't need to wait for the 2nd byte + * of ID response. + */ + clear_bit(PSMOUSE_FLAG_CMD, &psmouse->flags); psmouse->cmdcnt = 0; - break; } - udelay(1); + wait_event_interruptible_timeout(psmouse->wait, + !test_bit(PSMOUSE_FLAG_CMD, &psmouse->flags), timeout); } - for (i = 0; i < receive; i++) - param[i] = psmouse->cmdbuf[(receive - 1) - i]; + if (param) + for (i = 0; i < receive; i++) + param[i] = psmouse->cmdbuf[(receive - 1) - i]; - if (psmouse->cmdcnt) - return (psmouse->cmdcnt = 0) - 1; + if (psmouse->cmdcnt && (command != PSMOUSE_CMD_RESET_BAT || psmouse->cmdcnt != 1)) + goto out; - return 0; -} + rc = 0; +out: + clear_bit(PSMOUSE_FLAG_CMD, &psmouse->flags); + clear_bit(PSMOUSE_FLAG_CMD1, &psmouse->flags); + clear_bit(PSMOUSE_FLAG_WAITID, &psmouse->flags); + return rc; +} /* * psmouse_sliced_command() sends an extended PS/2 command to the mouse @@ -394,6 +444,8 @@ { unsigned char param[2]; + intellimouse_detect(psmouse); + param[0] = 200; psmouse_command(psmouse, param, PSMOUSE_CMD_SETRATE); param[0] = 200; @@ -598,6 +650,21 @@ } /* + * psmouse_set_state() sets new psmouse state and resets all flags and + * counters while holding serio lock so fighting with interrupt handler + * is not a concern. + */ + +static void psmouse_set_state(struct psmouse *psmouse, enum psmouse_state new_state) +{ + serio_pause_rx(psmouse->serio); + psmouse->state = new_state; + psmouse->pktcnt = psmouse->cmdcnt = psmouse->out_of_sync = 0; + psmouse->flags = 0; + serio_continue_rx(psmouse->serio); +} + +/* * psmouse_activate() enables the mouse so that we get motion reports from it. */ @@ -606,9 +673,24 @@ if (psmouse_command(psmouse, NULL, PSMOUSE_CMD_ENABLE)) printk(KERN_WARNING "psmouse.c: Failed to enable mouse on %s\n", psmouse->serio->phys); - psmouse->state = PSMOUSE_ACTIVATED; + psmouse_set_state(psmouse, PSMOUSE_ACTIVATED); } + +/* + * psmouse_deactivate() puts the mouse into poll mode so that we don't get motion + * reports from it unless we explicitely request it. + */ + +static void psmouse_deactivate(struct psmouse *psmouse) +{ + if (psmouse_command(psmouse, NULL, PSMOUSE_CMD_DISABLE)) + printk(KERN_WARNING "psmouse.c: Failed to deactivate mouse on %s\n", psmouse->serio->phys); + + psmouse_set_state(psmouse, PSMOUSE_CMD_MODE); +} + + /* * psmouse_cleanup() resets the mouse into power-on state. */ @@ -626,22 +708,21 @@ static void psmouse_disconnect(struct serio *serio) { - struct psmouse *psmouse = serio->private; + struct psmouse *psmouse, *parent; - psmouse->state = PSMOUSE_CMD_MODE; + psmouse = serio->private; + psmouse_set_state(psmouse, PSMOUSE_CMD_MODE); - if (psmouse->ptport) { - if (psmouse->ptport->deactivate) - psmouse->ptport->deactivate(psmouse); - __serio_unregister_port(&psmouse->ptport->serio); /* we have serio_sem */ - kfree(psmouse->ptport); - psmouse->ptport = NULL; + if (serio->parent && (serio->type & SERIO_TYPE) == SERIO_PS_PSTHRU) { + parent = serio->parent->private; + if (parent->pt_deactivate) + parent->pt_deactivate(parent); } if (psmouse->disconnect) psmouse->disconnect(psmouse); - psmouse->state = PSMOUSE_IGNORE; + psmouse_set_state(psmouse, PSMOUSE_IGNORE); input_unregister_device(&psmouse->dev); serio_close(serio); @@ -652,39 +733,49 @@ * psmouse_connect() is a callback from the serio module when * an unhandled serio port is found. */ -static void psmouse_connect(struct serio *serio, struct serio_dev *dev) +static void psmouse_connect(struct serio *serio, struct serio_driver *drv) { - struct psmouse *psmouse; + struct psmouse *psmouse, *parent = NULL; if ((serio->type & SERIO_TYPE) != SERIO_8042 && (serio->type & SERIO_TYPE) != SERIO_PS_PSTHRU) return; + /* + * If this is a pass-through port deactivate parent so the device + * connected to this port can be successfully identified + */ + if (serio->parent && (serio->type & SERIO_TYPE) == SERIO_PS_PSTHRU) { + parent = serio->parent->private; + psmouse_deactivate(parent); + } + if (!(psmouse = kmalloc(sizeof(struct psmouse), GFP_KERNEL))) - return; + goto out; memset(psmouse, 0, sizeof(struct psmouse)); + init_waitqueue_head(&psmouse->wait); init_input_dev(&psmouse->dev); 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; + psmouse_set_state(psmouse, PSMOUSE_INITIALIZING); serio->private = psmouse; - if (serio_open(serio, dev)) { + if (serio_open(serio, drv)) { kfree(psmouse); serio->private = NULL; - return; + goto out; } if (psmouse_probe(psmouse) < 0) { serio_close(serio); kfree(psmouse); serio->private = NULL; - return; + goto out; } psmouse->type = psmouse_extensions(psmouse, psmouse_max_proto, 1); @@ -711,63 +802,88 @@ printk(KERN_INFO "input: %s on %s\n", psmouse->devname, serio->phys); + psmouse_set_state(psmouse, PSMOUSE_CMD_MODE); + psmouse_initialize(psmouse); - if (psmouse->ptport) { - printk(KERN_INFO "serio: %s port at %s\n", psmouse->ptport->serio.name, psmouse->phys); - __serio_register_port(&psmouse->ptport->serio); /* we have serio_sem */ - if (psmouse->ptport->activate) - psmouse->ptport->activate(psmouse); + if (parent && parent->pt_activate) + parent->pt_activate(parent); + + if (serio->child) { + /* + * Nothing to be done here, serio core will detect that + * the driver set serio->child and will register it for us. + */ + printk(KERN_INFO "serio: %s port at %s\n", serio->child->name, psmouse->phys); } psmouse_activate(psmouse); + +out: + /* If this is a pass-through port the parent awaits to be activated */ + if (parent) + psmouse_activate(parent); } static int psmouse_reconnect(struct serio *serio) { struct psmouse *psmouse = serio->private; - struct serio_dev *dev = serio->dev; + struct psmouse *parent = NULL; + struct serio_driver *drv = serio->drv; + int rc = -1; - if (!dev || !psmouse) { + if (!drv || !psmouse) { printk(KERN_DEBUG "psmouse: reconnect request, but serio is disconnected, ignoring...\n"); return -1; } - psmouse->state = PSMOUSE_CMD_MODE; - psmouse->acking = psmouse->cmdcnt = psmouse->pktcnt = psmouse->out_of_sync = 0; + if (serio->parent && (serio->type & SERIO_TYPE) == SERIO_PS_PSTHRU) { + parent = serio->parent->private; + psmouse_deactivate(parent); + } + + psmouse_set_state(psmouse, PSMOUSE_INITIALIZING); + if (psmouse->reconnect) { if (psmouse->reconnect(psmouse)) - return -1; + goto out; } else if (psmouse_probe(psmouse) < 0 || psmouse->type != psmouse_extensions(psmouse, psmouse_max_proto, 0)) - return -1; + goto out; /* ok, the device type (and capabilities) match the old one, * we can continue using it, complete intialization */ + psmouse_set_state(psmouse, PSMOUSE_CMD_MODE); + psmouse_initialize(psmouse); - if (psmouse->ptport) { - if (psmouse_reconnect(&psmouse->ptport->serio)) { - __serio_unregister_port(&psmouse->ptport->serio); - __serio_register_port(&psmouse->ptport->serio); - if (psmouse->ptport->activate) - psmouse->ptport->activate(psmouse); - } - } + if (parent && parent->pt_activate) + parent->pt_activate(parent); psmouse_activate(psmouse); - return 0; + rc = 0; + +out: + /* If this is a pass-through port the parent waits to be activated */ + if (parent) + psmouse_activate(parent); + + return rc; } -static struct serio_dev psmouse_dev = { - .interrupt = psmouse_interrupt, - .connect = psmouse_connect, - .reconnect = psmouse_reconnect, - .disconnect = psmouse_disconnect, - .cleanup = psmouse_cleanup, +static struct serio_driver psmouse_drv = { + .driver = { + .name = "psmouse", + }, + .description = DRIVER_DESC, + .interrupt = psmouse_interrupt, + .connect = psmouse_connect, + .reconnect = psmouse_reconnect, + .disconnect = psmouse_disconnect, + .cleanup = psmouse_cleanup, }; static inline void psmouse_parse_proto(void) @@ -787,13 +903,13 @@ int __init psmouse_init(void) { psmouse_parse_proto(); - serio_register_device(&psmouse_dev); + serio_register_driver(&psmouse_drv); return 0; } void __exit psmouse_exit(void) { - serio_unregister_device(&psmouse_dev); + serio_unregister_driver(&psmouse_drv); } module_init(psmouse_init); diff -Nru a/drivers/input/mouse/psmouse.h b/drivers/input/mouse/psmouse.h --- a/drivers/input/mouse/psmouse.h 2004-09-26 10:25:57 -07:00 +++ b/drivers/input/mouse/psmouse.h 2004-09-26 10:25:57 -07:00 @@ -9,6 +9,7 @@ #define PSMOUSE_CMD_GETID 0x02f2 #define PSMOUSE_CMD_SETRATE 0x10f3 #define PSMOUSE_CMD_ENABLE 0x00f4 +#define PSMOUSE_CMD_DISABLE 0x00f5 #define PSMOUSE_CMD_RESET_DIS 0x00f6 #define PSMOUSE_CMD_RESET_BAT 0x02ff @@ -17,10 +18,17 @@ #define PSMOUSE_RET_ACK 0xfa #define PSMOUSE_RET_NAK 0xfe -/* psmouse states */ -#define PSMOUSE_CMD_MODE 0 -#define PSMOUSE_ACTIVATED 1 -#define PSMOUSE_IGNORE 2 +#define PSMOUSE_FLAG_ACK 0 /* Waiting for ACK/NAK */ +#define PSMOUSE_FLAG_CMD 1 /* Waiting for command to finish */ +#define PSMOUSE_FLAG_CMD1 2 /* Waiting for the first byte of command response */ +#define PSMOUSE_FLAG_WAITID 3 /* Command execiting is GET ID */ + +enum psmouse_state { + PSMOUSE_IGNORE, + PSMOUSE_INITIALIZING, + PSMOUSE_CMD_MODE, + PSMOUSE_ACTIVATED, +}; /* psmouse protocol handler return codes */ typedef enum { @@ -29,20 +37,10 @@ PSMOUSE_FULL_PACKET } psmouse_ret_t; -struct psmouse; - -struct psmouse_ptport { - struct serio serio; - - void (*activate)(struct psmouse *parent); - void (*deactivate)(struct psmouse *parent); -}; - struct psmouse { void *private; struct input_dev dev; struct serio *serio; - struct psmouse_ptport *ptport; char *vendor; char *name; unsigned char cmdbuf[8]; @@ -53,16 +51,22 @@ unsigned char model; unsigned long last; unsigned long out_of_sync; - unsigned char state; - char acking; - volatile char ack; + enum psmouse_state state; + unsigned char nak; char error; char devname[64]; char phys[32]; + unsigned long flags; + + /* Used to signal completion from interrupt handler */ + wait_queue_head_t wait; - psmouse_ret_t (*protocol_handler)(struct psmouse *psmouse, struct pt_regs *regs); + psmouse_ret_t (*protocol_handler)(struct psmouse *psmouse, struct pt_regs *regs); int (*reconnect)(struct psmouse *psmouse); void (*disconnect)(struct psmouse *psmouse); + + void (*pt_activate)(struct psmouse *psmouse); + void (*pt_deactivate)(struct psmouse *psmouse); }; #define PSMOUSE_PS2 1 diff -Nru a/drivers/input/mouse/sermouse.c b/drivers/input/mouse/sermouse.c --- a/drivers/input/mouse/sermouse.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/input/mouse/sermouse.c 2004-09-26 10:25:57 -07:00 @@ -37,8 +37,10 @@ #include #include +#define DRIVER_DESC "Serial mouse driver" + MODULE_AUTHOR("Vojtech Pavlik "); -MODULE_DESCRIPTION("Serial mouse driver"); +MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); static char *sermouse_protocols[] = { "None", "Mouse Systems Mouse", "Sun Mouse", "Microsoft Mouse", @@ -237,7 +239,7 @@ * an unhandled serio port is found. */ -static void sermouse_connect(struct serio *serio, struct serio_dev *dev) +static void sermouse_connect(struct serio *serio, struct serio_driver *drv) { struct sermouse *sermouse; unsigned char c; @@ -279,7 +281,7 @@ sermouse->dev.id.product = c; sermouse->dev.id.version = 0x0100; - if (serio_open(serio, dev)) { + if (serio_open(serio, drv)) { kfree(sermouse); return; } @@ -289,21 +291,25 @@ printk(KERN_INFO "input: %s on %s\n", sermouse_protocols[sermouse->type], serio->phys); } -static struct serio_dev sermouse_dev = { - .interrupt = sermouse_interrupt, - .connect = sermouse_connect, - .disconnect = sermouse_disconnect +static struct serio_driver sermouse_drv = { + .driver = { + .name = "sermouse", + }, + .description = DRIVER_DESC, + .interrupt = sermouse_interrupt, + .connect = sermouse_connect, + .disconnect = sermouse_disconnect, }; int __init sermouse_init(void) { - serio_register_device(&sermouse_dev); + serio_register_driver(&sermouse_drv); return 0; } void __exit sermouse_exit(void) { - serio_unregister_device(&sermouse_dev); + serio_unregister_driver(&sermouse_drv); } module_init(sermouse_init); diff -Nru a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c --- a/drivers/input/mouse/synaptics.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/input/mouse/synaptics.c 2004-09-26 10:25:56 -07:00 @@ -212,9 +212,9 @@ /***************************************************************************** * Synaptics pass-through PS/2 port support ****************************************************************************/ -static int synaptics_pt_write(struct serio *port, unsigned char c) +static int synaptics_pt_write(struct serio *serio, unsigned char c) { - struct psmouse *parent = port->driver; + struct psmouse *parent = serio->parent->private; char rate_param = SYN_PS_CLIENT_CMD; /* indicates that we want pass-through port */ if (psmouse_sliced_command(parent, c)) @@ -233,22 +233,19 @@ { struct psmouse *child = ptport->private; - if (child) { - if (child->state == PSMOUSE_ACTIVATED) { - serio_interrupt(ptport, packet[1], 0, NULL); - serio_interrupt(ptport, packet[4], 0, NULL); - serio_interrupt(ptport, packet[5], 0, NULL); - if (child->type >= PSMOUSE_GENPS) - serio_interrupt(ptport, packet[2], 0, NULL); - } else if (child->state != PSMOUSE_IGNORE) { - serio_interrupt(ptport, packet[1], 0, NULL); - } - } + if (child && child->state == PSMOUSE_ACTIVATED) { + serio_interrupt(ptport, packet[1], 0, NULL); + serio_interrupt(ptport, packet[4], 0, NULL); + serio_interrupt(ptport, packet[5], 0, NULL); + if (child->type >= PSMOUSE_GENPS) + serio_interrupt(ptport, packet[2], 0, NULL); + } else + serio_interrupt(ptport, packet[1], 0, NULL); } static void synaptics_pt_activate(struct psmouse *psmouse) { - struct psmouse *child = psmouse->ptport->serio.private; + struct psmouse *child = psmouse->serio->child->private; /* adjust the touchpad to child's choice of protocol */ if (child && child->type >= PSMOUSE_GENPS) { @@ -259,23 +256,25 @@ static void synaptics_pt_create(struct psmouse *psmouse) { - struct psmouse_ptport *port; + struct serio *serio; - psmouse->ptport = port = kmalloc(sizeof(struct psmouse_ptport), GFP_KERNEL); - if (!port) { + serio = kmalloc(sizeof(struct serio), GFP_KERNEL); + if (!serio) { printk(KERN_ERR "synaptics: not enough memory to allocate pass-through port\n"); return; } - memset(port, 0, sizeof(struct psmouse_ptport)); + memset(serio, 0, sizeof(struct serio)); + + serio->type = SERIO_PS_PSTHRU; + strlcpy(serio->name, "Synaptics pass-through", sizeof(serio->name)); + strlcpy(serio->phys, "synaptics-pt/serio0", sizeof(serio->name)); + serio->write = synaptics_pt_write; + serio->parent = psmouse->serio; - port->serio.type = SERIO_PS_PSTHRU; - port->serio.name = "Synaptics pass-through"; - port->serio.phys = "synaptics-pt/serio0"; - port->serio.write = synaptics_pt_write; - port->serio.driver = psmouse; + psmouse->pt_activate = synaptics_pt_activate; - port->activate = synaptics_pt_activate; + psmouse->serio->child = serio; } /***************************************************************************** @@ -470,9 +469,10 @@ if (unlikely(priv->pkt_type == SYN_NEWABS)) priv->pkt_type = synaptics_detect_pkt_type(psmouse); - if (psmouse->ptport && psmouse->ptport->serio.dev && synaptics_is_pt_packet(psmouse->packet)) - synaptics_pass_pt_packet(&psmouse->ptport->serio, psmouse->packet); - else + if (SYN_CAP_PASS_THROUGH(priv->capabilities) && synaptics_is_pt_packet(psmouse->packet)) { + if (psmouse->serio->child) + synaptics_pass_pt_packet(psmouse->serio->child, psmouse->packet); + } else synaptics_process_packet(psmouse); return PSMOUSE_FULL_PACKET; diff -Nru a/drivers/input/mouse/vsxxxaa.c b/drivers/input/mouse/vsxxxaa.c --- a/drivers/input/mouse/vsxxxaa.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/input/mouse/vsxxxaa.c 2004-09-26 10:25:57 -07:00 @@ -82,8 +82,10 @@ #include #include +#define DRIVER_DESC "Serial DEC VSXXX-AA/GA mouse / DEC tablet driver" + MODULE_AUTHOR ("Jan-Benedict Glaw "); -MODULE_DESCRIPTION ("Serial DEC VSXXX-AA/GA mouse / DEC tablet driver"); +MODULE_DESCRIPTION (DRIVER_DESC); MODULE_LICENSE ("GPL"); #undef VSXXXAA_DEBUG @@ -482,7 +484,7 @@ } static void -vsxxxaa_connect (struct serio *serio, struct serio_dev *dev) +vsxxxaa_connect (struct serio *serio, struct serio_driver *drv) { struct vsxxxaa *mouse; @@ -524,7 +526,7 @@ mouse->dev.id.bustype = BUS_RS232; mouse->serio = serio; - if (serio_open (serio, dev)) { + if (serio_open (serio, drv)) { kfree (mouse); return; } @@ -540,23 +542,27 @@ printk (KERN_INFO "input: %s on %s\n", mouse->name, mouse->phys); } -static struct serio_dev vsxxxaa_dev = { - .connect = vsxxxaa_connect, - .interrupt = vsxxxaa_interrupt, - .disconnect = vsxxxaa_disconnect, +static struct serio_driver vsxxxaa_drv = { + .driver = { + .name = "vsxxxaa", + }, + .description = DRIVER_DESC, + .connect = vsxxxaa_connect, + .interrupt = vsxxxaa_interrupt, + .disconnect = vsxxxaa_disconnect, }; int __init vsxxxaa_init (void) { - serio_register_device (&vsxxxaa_dev); + serio_register_driver(&vsxxxaa_drv); return 0; } void __exit vsxxxaa_exit (void) { - serio_unregister_device (&vsxxxaa_dev); + serio_unregister_driver(&vsxxxaa_drv); } module_init (vsxxxaa_init); diff -Nru a/drivers/input/mousedev.c b/drivers/input/mousedev.c --- a/drivers/input/mousedev.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/input/mousedev.c 2004-09-26 10:25:57 -07:00 @@ -48,8 +48,15 @@ module_param(yres, uint, 0); MODULE_PARM_DESC(yres, "Vertical screen resolution"); -struct mousedev_motion { +static unsigned tap_time = 200; +module_param(tap_time, uint, 0); +MODULE_PARM_DESC(tap_time, "Tap time for touchpads in absolute mode (msecs)"); + +struct mousedev_hw_data { int dx, dy, dz; + int x, y; + int abs_event; + unsigned long buttons; }; struct mousedev { @@ -61,22 +68,38 @@ struct list_head list; struct input_handle handle; - struct mousedev_motion packet; - unsigned long buttons; + struct mousedev_hw_data packet; unsigned int pkt_count; int old_x[4], old_y[4]; - unsigned int touch; + unsigned long touch; }; +enum mousedev_emul { + MOUSEDEV_EMUL_PS2, + MOUSEDEV_EMUL_IMPS, + MOUSEDEV_EMUL_EXPS +}; + +struct mousedev_motion { + int dx, dy, dz; + unsigned long buttons; +}; + +#define PACKET_QUEUE_LEN 16 struct mousedev_list { struct fasync_struct *fasync; struct mousedev *mousedev; struct list_head node; - int dx, dy, dz; - unsigned long buttons; + + struct mousedev_motion packets[PACKET_QUEUE_LEN]; + unsigned int head, tail; + spinlock_t packet_lock; + int pos_x, pos_y; + signed char ps2[6]; unsigned char ready, buffer, bufsiz; - unsigned char mode, imexseq, impsseq; + unsigned char imexseq, impsseq; + enum mousedev_emul mode; }; #define MOUSEDEV_SEQ_LEN 6 @@ -119,15 +142,19 @@ case ABS_X: 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; + if (value > dev->absmax[ABS_X]) value = dev->absmax[ABS_X]; + if (value < dev->absmin[ABS_X]) value = dev->absmin[ABS_X]; + mousedev->packet.x = ((value - dev->absmin[ABS_X]) * xres) / size; + mousedev->packet.abs_event = 1; break; case ABS_Y: 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; + if (value > dev->absmax[ABS_Y]) value = dev->absmax[ABS_Y]; + if (value < dev->absmin[ABS_Y]) value = dev->absmin[ABS_Y]; + mousedev->packet.y = yres - ((value - dev->absmin[ABS_Y]) * yres) / size; + mousedev->packet.abs_event = 1; break; } } @@ -165,30 +192,82 @@ } if (value) { - set_bit(index, &mousedev->buttons); - set_bit(index, &mousedev_mix.buttons); + set_bit(index, &mousedev->packet.buttons); + set_bit(index, &mousedev_mix.packet.buttons); } else { - clear_bit(index, &mousedev->buttons); - clear_bit(index, &mousedev_mix.buttons); + clear_bit(index, &mousedev->packet.buttons); + clear_bit(index, &mousedev_mix.packet.buttons); } } -static void mousedev_notify_readers(struct mousedev *mousedev, struct mousedev_motion *packet) +static void mousedev_notify_readers(struct mousedev *mousedev, struct mousedev_hw_data *packet) { struct mousedev_list *list; + struct mousedev_motion *p; + unsigned long flags; list_for_each_entry(list, &mousedev->list, node) { - list->dx += packet->dx; - list->dy += packet->dy; - list->dz += packet->dz; - list->buttons = mousedev->buttons; + spin_lock_irqsave(&list->packet_lock, flags); + + p = &list->packets[list->head]; + if (list->ready && p->buttons != packet->buttons) { + unsigned int new_head = (list->head + 1) % PACKET_QUEUE_LEN; + if (new_head != list->tail) { + p = &list->packets[list->head = new_head]; + memset(p, 0, sizeof(struct mousedev_motion)); + } + } + + if (packet->abs_event) { + p->dx += packet->x - list->pos_x; + p->dy += packet->y - list->pos_y; + list->pos_x = packet->x; + list->pos_y = packet->y; + } + + list->pos_x += packet->dx; + list->pos_x = list->pos_x < 0 ? 0 : (list->pos_x >= xres ? xres : list->pos_x); + list->pos_y += packet->dy; + list->pos_y = list->pos_y < 0 ? 0 : (list->pos_y >= yres ? yres : list->pos_y); + + p->dx += packet->dx; + p->dy += packet->dy; + p->dz += packet->dz; + p->buttons = mousedev->packet.buttons; + list->ready = 1; + + spin_unlock_irqrestore(&list->packet_lock, flags); kill_fasync(&list->fasync, SIGIO, POLL_IN); } wake_up_interruptible(&mousedev->wait); } +static void mousedev_touchpad_touch(struct mousedev *mousedev, int value) +{ + if (!value) { + if (mousedev->touch && + time_before(jiffies, mousedev->touch + msecs_to_jiffies(tap_time))) { + /* + * Toggle left button to emulate tap. + * We rely on the fact that mousedev_mix always has 0 + * motion packet so we won't mess current position. + */ + set_bit(0, &mousedev->packet.buttons); + set_bit(0, &mousedev_mix.packet.buttons); + mousedev_notify_readers(mousedev, &mousedev_mix.packet); + mousedev_notify_readers(&mousedev_mix, &mousedev_mix.packet); + clear_bit(0, &mousedev->packet.buttons); + clear_bit(0, &mousedev_mix.packet.buttons); + } + mousedev->touch = mousedev->pkt_count = 0; + } + else + if (!mousedev->touch) + mousedev->touch = jiffies; +} + static void mousedev_event(struct input_handle *handle, unsigned int type, unsigned int code, int value) { struct mousedev *mousedev = handle->private; @@ -212,12 +291,8 @@ 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; - } + if (code == BTN_TOUCH && test_bit(BTN_TOOL_FINGER, handle->dev->keybit)) + mousedev_touchpad_touch(mousedev, value); else mousedev_key_event(mousedev, code, value); } @@ -237,7 +312,8 @@ mousedev_notify_readers(mousedev, &mousedev->packet); mousedev_notify_readers(&mousedev_mix, &mousedev->packet); - memset(&mousedev->packet, 0, sizeof(struct mousedev_motion)); + mousedev->packet.dx = mousedev->packet.dy = mousedev->packet.dz = 0; + mousedev->packet.abs_event = 0; } break; } @@ -322,6 +398,9 @@ return -ENOMEM; memset(list, 0, sizeof(struct mousedev_list)); + spin_lock_init(&list->packet_lock); + list->pos_x = xres / 2; + list->pos_y = yres / 2; list->mousedev = mousedev_table[i]; list_add_tail(&list->node, &mousedev_table[i]->list); file->private_data = list; @@ -341,32 +420,56 @@ return 0; } -static void mousedev_packet(struct mousedev_list *list, unsigned char off) +static inline int mousedev_limit_delta(int delta, int limit) { - list->ps2[off] = 0x08 | ((list->dx < 0) << 4) | ((list->dy < 0) << 5) | (list->buttons & 0x07); - list->ps2[off + 1] = (list->dx > 127 ? 127 : (list->dx < -127 ? -127 : list->dx)); - list->ps2[off + 2] = (list->dy > 127 ? 127 : (list->dy < -127 ? -127 : list->dy)); - list->dx -= list->ps2[off + 1]; - list->dy -= list->ps2[off + 2]; - list->bufsiz = off + 3; - - if (list->mode == 2) { - list->ps2[off + 3] = (list->dz > 7 ? 7 : (list->dz < -7 ? -7 : list->dz)); - 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); + return delta > limit ? limit : (delta < -limit ? -limit : delta); +} + +static void mousedev_packet(struct mousedev_list *list, signed char *ps2_data) +{ + struct mousedev_motion *p; + unsigned long flags; + + spin_lock_irqsave(&list->packet_lock, flags); + p = &list->packets[list->tail]; + + ps2_data[0] = 0x08 | ((p->dx < 0) << 4) | ((p->dy < 0) << 5) | (p->buttons & 0x07); + ps2_data[1] = mousedev_limit_delta(p->dx, 127); + ps2_data[2] = mousedev_limit_delta(p->dy, 127); + p->dx -= ps2_data[1]; + p->dy -= ps2_data[2]; + + switch (list->mode) { + case MOUSEDEV_EMUL_EXPS: + ps2_data[3] = mousedev_limit_delta(p->dz, 127); + p->dz -= ps2_data[3]; + ps2_data[3] = (ps2_data[3] & 0x0f) | ((p->buttons & 0x18) << 1); + list->bufsiz = 4; + break; + + case MOUSEDEV_EMUL_IMPS: + ps2_data[0] |= ((p->buttons & 0x10) >> 3) | ((p->buttons & 0x08) >> 1); + ps2_data[3] = mousedev_limit_delta(p->dz, 127); + p->dz -= ps2_data[3]; + list->bufsiz = 4; + break; + + case MOUSEDEV_EMUL_PS2: + default: + ps2_data[0] |= ((p->buttons & 0x10) >> 3) | ((p->buttons & 0x08) >> 1); + p->dz = 0; + list->bufsiz = 3; + break; } - if (list->mode == 1) { - list->ps2[off + 3] = (list->dz > 127 ? 127 : (list->dz < -127 ? -127 : list->dz)); - list->dz -= list->ps2[off + 3]; - list->bufsiz++; + if (!p->dx && !p->dy && !p->dz) { + if (list->tail != list->head) + list->tail = (list->tail + 1) % PACKET_QUEUE_LEN; + if (list->tail == list->head) + list->ready = 0; } - if (!list->dx && !list->dy && (!list->mode || !list->dz)) list->ready = 0; - list->buffer = list->bufsiz; + spin_unlock_irqrestore(&list->packet_lock, flags); } @@ -384,31 +487,31 @@ if (c == mousedev_imex_seq[list->imexseq]) { if (++list->imexseq == MOUSEDEV_SEQ_LEN) { list->imexseq = 0; - list->mode = 2; + list->mode = MOUSEDEV_EMUL_EXPS; } } else list->imexseq = 0; if (c == mousedev_imps_seq[list->impsseq]) { if (++list->impsseq == MOUSEDEV_SEQ_LEN) { list->impsseq = 0; - list->mode = 1; + list->mode = MOUSEDEV_EMUL_IMPS; } } else list->impsseq = 0; list->ps2[0] = 0xfa; - list->bufsiz = 1; switch (c) { case 0xeb: /* Poll */ - mousedev_packet(list, 1); + mousedev_packet(list, &list->ps2[1]); + list->bufsiz++; /* account for leading ACK */ break; case 0xf2: /* Get ID */ switch (list->mode) { - case 0: list->ps2[1] = 0; break; - case 1: list->ps2[1] = 3; break; - case 2: list->ps2[1] = 4; break; + case MOUSEDEV_EMUL_PS2: list->ps2[1] = 0; break; + case MOUSEDEV_EMUL_IMPS: list->ps2[1] = 3; break; + case MOUSEDEV_EMUL_EXPS: list->ps2[1] = 4; break; } list->bufsiz = 2; break; @@ -419,13 +522,15 @@ break; case 0xff: /* Reset */ - list->impsseq = 0; - list->imexseq = 0; - list->mode = 0; - list->ps2[1] = 0xaa; - list->ps2[2] = 0x00; + list->impsseq = list->imexseq = 0; + list->mode = MOUSEDEV_EMUL_PS2; + list->ps2[1] = 0xaa; list->ps2[2] = 0x00; list->bufsiz = 3; break; + + default: + list->bufsiz = 1; + break; } list->buffer = list->bufsiz; @@ -446,13 +551,19 @@ if (!list->ready && !list->buffer && (file->f_flags & O_NONBLOCK)) return -EAGAIN; - retval = wait_event_interruptible(list->mousedev->wait, list->ready || list->buffer); + retval = wait_event_interruptible(list->mousedev->wait, + !list->mousedev->exist || list->ready || list->buffer); if (retval) return retval; - if (!list->buffer && list->ready) - mousedev_packet(list, 0); + if (!list->mousedev->exist) + return -ENODEV; + + if (!list->buffer && list->ready) { + mousedev_packet(list, list->ps2); + list->buffer = list->bufsiz; + } if (count > list->buffer) count = list->buffer; diff -Nru a/drivers/input/serio/Kconfig b/drivers/input/serio/Kconfig --- a/drivers/input/serio/Kconfig 2004-09-26 10:25:56 -07:00 +++ b/drivers/input/serio/Kconfig 2004-09-26 10:25:56 -07:00 @@ -20,7 +20,7 @@ tristate "i8042 PC Keyboard controller" if EMBEDDED || !X86 default y select SERIO - depends on !PARISC && (!ARM || ARCH_SHARK || ARCH_EBSA285) + depends on !PARISC && (!ARM || ARCH_SHARK || FOOTBRIDGE_HOST) ---help--- i8042 is the chip over which the standard AT keyboard and PS/2 mouse are connected to the computer. If you use these devices, @@ -130,3 +130,19 @@ To compile this driver as a module, choose M here: the module will be called maceps2. + +config SERIO_RAW + tristate "Raw access to serio ports" + depends on SERIO + help + Say Y here if you want to have raw access to serio ports, such as + AUX ports on i8042 keyboard controller. Each serio port that is + bound to this driver will be accessible via a char device with + major 10 and dynamically allocated minor. The driver will try + allocating minor 1 (that historically corresponds to /dev/psaux) + first. To bind this driver to a serio port use sysfs interface: + + echo -n "serio_raw" > /sys/bus/serio/devices/serioX/driver + + To compile this driver as a module, choose M here: the + module will be called serio_raw. diff -Nru a/drivers/input/serio/Makefile b/drivers/input/serio/Makefile --- a/drivers/input/serio/Makefile 2004-09-26 10:25:55 -07:00 +++ b/drivers/input/serio/Makefile 2004-09-26 10:25:55 -07:00 @@ -17,3 +17,4 @@ obj-$(CONFIG_SERIO_GSCPS2) += gscps2.o obj-$(CONFIG_SERIO_PCIPS2) += pcips2.o obj-$(CONFIG_SERIO_MACEPS2) += maceps2.o +obj-$(CONFIG_SERIO_RAW) += serio_raw.o diff -Nru a/drivers/input/serio/ambakmi.c b/drivers/input/serio/ambakmi.c --- a/drivers/input/serio/ambakmi.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/input/serio/ambakmi.c 2004-09-26 10:25:56 -07:00 @@ -29,7 +29,7 @@ #define KMI_BASE (kmi->base) struct amba_kmi_port { - struct serio io; + struct serio *io; struct clk *clk; unsigned char *base; unsigned int irq; @@ -44,7 +44,7 @@ int handled = IRQ_NONE; while (status & KMIIR_RXINTR) { - serio_interrupt(&kmi->io, readb(KMIDATA), 0, regs); + serio_interrupt(kmi->io, readb(KMIDATA), 0, regs); status = readb(KMIIR); handled = IRQ_HANDLED; } @@ -54,7 +54,7 @@ static int amba_kmi_write(struct serio *io, unsigned char val) { - struct amba_kmi_port *kmi = io->driver; + struct amba_kmi_port *kmi = io->port_data; unsigned int timeleft = 10000; /* timeout in 100ms */ while ((readb(KMISTAT) & KMISTAT_TXEMPTY) == 0 && timeleft--) @@ -68,7 +68,7 @@ static int amba_kmi_open(struct serio *io) { - struct amba_kmi_port *kmi = io->driver; + struct amba_kmi_port *kmi = io->port_data; unsigned int divisor; int ret; @@ -105,7 +105,7 @@ static void amba_kmi_close(struct serio *io) { - struct amba_kmi_port *kmi = io->driver; + struct amba_kmi_port *kmi = io->port_data; writeb(0, KMICR); @@ -117,6 +117,7 @@ static int amba_kmi_probe(struct amba_device *dev, void *id) { struct amba_kmi_port *kmi; + struct serio *io; int ret; ret = amba_request_regions(dev, NULL); @@ -124,21 +125,25 @@ return ret; kmi = kmalloc(sizeof(struct amba_kmi_port), GFP_KERNEL); - if (!kmi) { + io = kmalloc(sizeof(struct serio), GFP_KERNEL); + if (!kmi || !io) { ret = -ENOMEM; goto out; } memset(kmi, 0, sizeof(struct amba_kmi_port)); + memset(io, 0, sizeof(struct serio)); - kmi->io.type = SERIO_8042; - kmi->io.write = amba_kmi_write; - kmi->io.open = amba_kmi_open; - kmi->io.close = amba_kmi_close; - kmi->io.name = dev->dev.bus_id; - kmi->io.phys = dev->dev.bus_id; - kmi->io.driver = kmi; + io->type = SERIO_8042; + io->write = amba_kmi_write; + io->open = amba_kmi_open; + io->close = amba_kmi_close; + strlcpy(io->name, dev->dev.bus_id, sizeof(io->name)); + strlcpy(io->phys, dev->dev.bus_id, sizeof(io->phys)); + io->port_data = kmi; + io->dev.parent = &dev->dev; + kmi->io = io; kmi->base = ioremap(dev->res.start, KMI_SIZE); if (!kmi->base) { ret = -ENOMEM; @@ -154,13 +159,14 @@ kmi->irq = dev->irq[0]; amba_set_drvdata(dev, kmi); - serio_register_port(&kmi->io); + serio_register_port(kmi->io); return 0; unmap: iounmap(kmi->base); out: kfree(kmi); + kfree(io); amba_release_regions(dev); return ret; } @@ -171,7 +177,7 @@ amba_set_drvdata(dev, NULL); - serio_unregister_port(&kmi->io); + serio_unregister_port(kmi->io); clk_put(kmi->clk); iounmap(kmi->base); kfree(kmi); @@ -184,7 +190,7 @@ struct amba_kmi_port *kmi = amba_get_drvdata(dev); /* kick the serio layer to rescan this port */ - serio_rescan(&kmi->io); + serio_reconnect(kmi->io); return 0; } @@ -214,7 +220,7 @@ static void __exit amba_kmi_exit(void) { - return amba_driver_unregister(&ambakmi_driver); + amba_driver_unregister(&ambakmi_driver); } module_init(amba_kmi_init); diff -Nru a/drivers/input/serio/ct82c710.c b/drivers/input/serio/ct82c710.c --- a/drivers/input/serio/ct82c710.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/input/serio/ct82c710.c 2004-09-26 10:25:55 -07:00 @@ -36,6 +36,7 @@ #include #include #include +#include #include @@ -43,9 +44,6 @@ MODULE_DESCRIPTION("82C710 C&T mouse port chip driver"); MODULE_LICENSE("GPL"); -static char ct82c710_name[] = "C&T 82c710 mouse port"; -static char ct82c710_phys[16]; - /* * ct82c710 interface */ @@ -61,10 +59,22 @@ #define CT82C710_IRQ 12 -static int ct82c710_data; -static int ct82c710_status; +#define CT82C710_DATA ct82c710_iores.start +#define CT82C710_STATUS (ct82c710_iores.start + 1) -static irqreturn_t ct82c710_interrupt(int cpl, void *dev_id, struct pt_regs * regs); +static struct serio *ct82c710_port; +static struct platform_device *ct82c710_device; +static struct resource ct82c710_iores; + +/* + * Interrupt handler for the 82C710 mouse port. A character + * is waiting in the 82C710. + */ + +static irqreturn_t ct82c710_interrupt(int cpl, void *dev_id, struct pt_regs * regs) +{ + return serio_interrupt(ct82c710_port, inb(CT82C710_DATA), 0, regs); +} /* * Wait for device to send output char and flush any input char. @@ -74,10 +84,10 @@ { int timeout = 60000; - while ((inb(ct82c710_status) & (CT82C710_RX_FULL | CT82C710_TX_IDLE | CT82C710_DEV_IDLE)) + while ((inb(CT82C710_STATUS) & (CT82C710_RX_FULL | CT82C710_TX_IDLE | CT82C710_DEV_IDLE)) != (CT82C710_DEV_IDLE | CT82C710_TX_IDLE) && timeout) { - if (inb_p(ct82c710_status) & CT82C710_RX_FULL) inb_p(ct82c710_data); + if (inb_p(CT82C710_STATUS) & CT82C710_RX_FULL) inb_p(CT82C710_DATA); udelay(1); timeout--; @@ -91,7 +101,7 @@ if (ct82c170_wait()) printk(KERN_WARNING "ct82c710.c: Device busy in close()\n"); - outb_p(inb_p(ct82c710_status) & ~(CT82C710_ENABLE | CT82C710_INTS_ON), ct82c710_status); + outb_p(inb_p(CT82C710_STATUS) & ~(CT82C710_ENABLE | CT82C710_INTS_ON), CT82C710_STATUS); if (ct82c170_wait()) printk(KERN_WARNING "ct82c710.c: Device busy in close()\n"); @@ -106,21 +116,21 @@ if (request_irq(CT82C710_IRQ, ct82c710_interrupt, 0, "ct82c710", NULL)) return -1; - status = inb_p(ct82c710_status); + status = inb_p(CT82C710_STATUS); status |= (CT82C710_ENABLE | CT82C710_RESET); - outb_p(status, ct82c710_status); + outb_p(status, CT82C710_STATUS); status &= ~(CT82C710_RESET); - outb_p(status, ct82c710_status); + outb_p(status, CT82C710_STATUS); status |= CT82C710_INTS_ON; - outb_p(status, ct82c710_status); /* Enable interrupts */ + outb_p(status, CT82C710_STATUS); /* Enable interrupts */ while (ct82c170_wait()) { printk(KERN_ERR "ct82c710: Device busy in open()\n"); status &= ~(CT82C710_ENABLE | CT82C710_INTS_ON); - outb_p(status, ct82c710_status); + outb_p(status, CT82C710_STATUS); free_irq(CT82C710_IRQ, NULL); return -1; } @@ -135,30 +145,10 @@ static int ct82c710_write(struct serio *port, unsigned char c) { if (ct82c170_wait()) return -1; - outb_p(c, ct82c710_data); + outb_p(c, CT82C710_DATA); return 0; } -static struct serio ct82c710_port = -{ - .type = SERIO_8042, - .name = ct82c710_name, - .phys = ct82c710_phys, - .write = ct82c710_write, - .open = ct82c710_open, - .close = ct82c710_close, -}; - -/* - * Interrupt handler for the 82C710 mouse port. A character - * is waiting in the 82C710. - */ - -static irqreturn_t ct82c710_interrupt(int cpl, void *dev_id, struct pt_regs * regs) -{ - return serio_interrupt(&ct82c710_port, inb(ct82c710_data), 0, regs); -} - /* * See if we can find a 82C710 device. Read mouse address. */ @@ -175,36 +165,60 @@ return -1; /* No: no 82C710 here */ outb_p(0x0d, 0x390); /* Write index */ - ct82c710_data = inb_p(0x391) << 2; /* Get mouse I/O address */ - ct82c710_status = ct82c710_data + 1; + ct82c710_iores.start = inb_p(0x391) << 2; /* Get mouse I/O address */ + ct82c710_iores.end = ct82c710_iores.start + 1; + ct82c710_iores.flags = IORESOURCE_IO; outb_p(0x0f, 0x390); outb_p(0x0f, 0x391); /* Close config mode */ return 0; } +static struct serio * __init ct82c710_allocate_port(void) +{ + struct serio *serio; + + serio = kmalloc(sizeof(struct serio), GFP_KERNEL); + if (serio) { + memset(serio, 0, sizeof(struct serio)); + serio->type = SERIO_8042; + serio->open = ct82c710_open; + serio->close = ct82c710_close; + serio->write = ct82c710_write; + serio->dev.parent = &ct82c710_device->dev; + strlcpy(serio->name, "C&T 82c710 mouse port", sizeof(serio->name)); + snprintf(serio->phys, sizeof(serio->phys), "isa%04lx/serio0", CT82C710_DATA); + } + + return serio; +} + int __init ct82c710_init(void) { if (ct82c710_probe()) return -ENODEV; - if (request_region(ct82c710_data, 2, "ct82c710")) - return -EBUSY; - - sprintf(ct82c710_phys, "isa%04x/serio0", ct82c710_data); + ct82c710_device = platform_device_register_simple("ct82c710", -1, &ct82c710_iores, 1); + if (IS_ERR(ct82c710_device)) + return PTR_ERR(ct82c710_device); + + if (!(ct82c710_port = ct82c710_allocate_port())) { + platform_device_unregister(ct82c710_device); + return -ENOMEM; + } - serio_register_port(&ct82c710_port); + serio_register_port(ct82c710_port); - printk(KERN_INFO "serio: C&T 82c710 mouse port at %#x irq %d\n", - ct82c710_data, CT82C710_IRQ); + printk(KERN_INFO "serio: C&T 82c710 mouse port at %#lx irq %d\n", + CT82C710_DATA, CT82C710_IRQ); return 0; } void __exit ct82c710_exit(void) { - serio_unregister_port(&ct82c710_port); - release_region(ct82c710_data, 2); + serio_unregister_port(ct82c710_port); + platform_device_unregister(ct82c710_device); } module_init(ct82c710_init); diff -Nru a/drivers/input/serio/gscps2.c b/drivers/input/serio/gscps2.c --- a/drivers/input/serio/gscps2.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/input/serio/gscps2.c 2004-09-26 10:25:57 -07:00 @@ -91,7 +91,7 @@ struct gscps2port { struct list_head node; struct parisc_device *padev; - struct serio port; + struct serio *port; spinlock_t lock; char *addr; u8 act, append; /* position in buffer[] */ @@ -100,7 +100,6 @@ u8 str; } buffer[BUFFER_SIZE+1]; int id; - char name[32]; }; /* @@ -272,7 +271,7 @@ rxflags = ((status & GSC_STAT_TERR) ? SERIO_TIMEOUT : 0 ) | ((status & GSC_STAT_PERR) ? SERIO_PARITY : 0 ); - serio_interrupt(&ps2port->port, data, rxflags, regs); + serio_interrupt(ps2port->port, data, rxflags, regs); } /* while() */ @@ -288,7 +287,7 @@ static int gscps2_write(struct serio *port, unsigned char data) { - struct gscps2port *ps2port = port->driver; + struct gscps2port *ps2port = port->port_data; if (!gscps2_writeb_output(ps2port, data)) { printk(KERN_DEBUG PFX "sending byte %#x failed.\n", data); @@ -304,7 +303,7 @@ static int gscps2_open(struct serio *port) { - struct gscps2port *ps2port = port->driver; + struct gscps2port *ps2port = port->port_data; gscps2_reset(ps2port); @@ -319,7 +318,7 @@ static void gscps2_close(struct serio *port) { - struct gscps2port *ps2port = port->driver; + struct gscps2port *ps2port = port->port_data; gscps2_enable(ps2port, DISABLE); } @@ -343,7 +342,8 @@ static int __init gscps2_probe(struct parisc_device *dev) { - struct gscps2port *ps2port; + struct gscps2port *ps2port; + struct serio *serio; unsigned long hpa = dev->hpa; int ret; @@ -355,34 +355,45 @@ hpa += GSC_DINO_OFFSET; ps2port = kmalloc(sizeof(struct gscps2port), GFP_KERNEL); - if (!ps2port) - return -ENOMEM; + serio = kmalloc(sizeof(struct serio), GFP_KERNEL); + if (!ps2port || !serio) { + ret = -ENOMEM; + goto fail_nomem; + } dev_set_drvdata(&dev->dev, ps2port); memset(ps2port, 0, sizeof(struct gscps2port)); + memset(serio, 0, sizeof(struct serio)); + ps2port->port = serio; ps2port->padev = dev; ps2port->addr = ioremap(hpa, GSC_STATUS + 4); spin_lock_init(&ps2port->lock); gscps2_reset(ps2port); - ps2port->id = readb(ps2port->addr+GSC_ID) & 0x0f; - snprintf(ps2port->name, sizeof(ps2port->name)-1, "%s %s", - gscps2_serio_port.name, - (ps2port->id == GSC_ID_KEYBOARD) ? "keyboard" : "mouse" ); - - memcpy(&ps2port->port, &gscps2_serio_port, sizeof(gscps2_serio_port)); - ps2port->port.driver = ps2port; - ps2port->port.name = ps2port->name; - ps2port->port.phys = dev->dev.bus_id; + ps2port->id = readb(ps2port->addr + GSC_ID) & 0x0f; + + snprintf(serio->name, sizeof(serio->name), "GSC PS/2 %s", + (ps2port->id == GSC_ID_KEYBOARD) ? "keyboard" : "mouse"); + strlcpy(serio->phys, dev->dev.bus_id, sizeof(serio->phys)); + serio->idbus = BUS_GSC; + serio->idvendor = PCI_VENDOR_ID_HP; + serio->idproduct = 0x0001; + serio->idversion = 0x0010; + serio->type = SERIO_8042; + serio->write = gscps2_write; + serio->open = gscps2_open; + serio->close = gscps2_close; + serio->port_data = ps2port; + serio->dev.parent = &dev->dev; list_add_tail(&ps2port->node, &ps2port_list); ret = -EBUSY; - if (request_irq(dev->irq, gscps2_interrupt, SA_SHIRQ, ps2port->name, ps2port)) + if (request_irq(dev->irq, gscps2_interrupt, SA_SHIRQ, ps2port->port->name, ps2port)) goto fail_miserably; - if ( (ps2port->id != GSC_ID_KEYBOARD) && (ps2port->id != GSC_ID_MOUSE) ) { + if (ps2port->id != GSC_ID_KEYBOARD && ps2port->id != GSC_ID_MOUSE) { printk(KERN_WARNING PFX "Unsupported PS/2 port at 0x%08lx (id=%d) ignored\n", hpa, ps2port->id); ret = -ENODEV; @@ -395,12 +406,12 @@ #endif printk(KERN_INFO "serio: %s port at 0x%p irq %d @ %s\n", - ps2port->name, + ps2port->port->name, ps2port->addr, ps2port->padev->irq, - ps2port->port.phys); + ps2port->port->phys); - serio_register_port(&ps2port->port); + serio_register_port(ps2port->port); return 0; @@ -411,7 +422,10 @@ list_del(&ps2port->node); iounmap(ps2port->addr); release_mem_region(dev->hpa, GSC_STATUS + 4); + +fail_nomem: kfree(ps2port); + kfree(serio); return ret; } @@ -424,7 +438,7 @@ { struct gscps2port *ps2port = dev_get_drvdata(&dev->dev); - serio_unregister_port(&ps2port->port); + serio_unregister_port(ps2port->port); free_irq(dev->irq, ps2port); gscps2_flush(ps2port); list_del(&ps2port->node); diff -Nru a/drivers/input/serio/i8042-io.h b/drivers/input/serio/i8042-io.h --- a/drivers/input/serio/i8042-io.h 2004-09-26 10:25:55 -07:00 +++ b/drivers/input/serio/i8042-io.h 2004-09-26 10:25:55 -07:00 @@ -65,6 +65,31 @@ return; } +#if defined(__i386__) + +#include + +static struct dmi_system_id __initdata i8042_dmi_table[] = { + { + .ident = "Compaq Proliant 8500", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Compaq"), + DMI_MATCH(DMI_PRODUCT_NAME , "ProLiant"), + DMI_MATCH(DMI_PRODUCT_VERSION, "8500"), + }, + }, + { + .ident = "Compaq Proliant DL760", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Compaq"), + DMI_MATCH(DMI_PRODUCT_NAME , "ProLiant"), + DMI_MATCH(DMI_PRODUCT_VERSION, "DL760"), + }, + }, + { } +}; +#endif + static inline int i8042_platform_init(void) { /* @@ -79,6 +104,12 @@ #if !defined(__i386__) && !defined(__x86_64__) i8042_reset = 1; #endif + +#if defined(__i386__) + if (dmi_check_system(i8042_dmi_table)) + i8042_noloop = 1; +#endif + return 0; } diff -Nru a/drivers/input/serio/i8042-sparcio.h b/drivers/input/serio/i8042-sparcio.h --- a/drivers/input/serio/i8042-sparcio.h 2004-09-26 10:25:57 -07:00 +++ b/drivers/input/serio/i8042-sparcio.h 2004-09-26 10:25:57 -07:00 @@ -18,7 +18,7 @@ #define I8042_AUX_PHYS_DESC "sparcps2/serio1" #define I8042_MUX_PHYS_DESC "sparcps2/serio%d" -static unsigned long kbd_iobase; +static void __iomem *kbd_iobase; #define I8042_COMMAND_REG (kbd_iobase + 0x64UL) #define I8042_DATA_REG (kbd_iobase + 0x60UL) @@ -64,7 +64,7 @@ if (strncmp(prop, "SUNW,JavaStation-1", len) == 0) { /* Hardcoded values for MrCoffee. */ i8042_kbd_irq = i8042_aux_irq = 13 | 0x20; - kbd_iobase = (unsigned long) ioremap(0x71300060, 8); + kbd_iobase = ioremap(0x71300060, 8); if (!kbd_iobase) return -1; } else { @@ -85,7 +85,7 @@ if (!strcmp(child->prom_name, OBP_PS2KBD_NAME1) || !strcmp(child->prom_name, OBP_PS2KBD_NAME2)) { i8042_kbd_irq = child->irqs[0]; - kbd_iobase = (unsigned long) + kbd_iobase = ioremap(child->resource[0].start, 8); } if (!strcmp(child->prom_name, OBP_PS2MS_NAME1) || @@ -109,7 +109,7 @@ static inline void i8042_platform_exit(void) { #ifdef CONFIG_PCI - iounmap((void *)kbd_iobase); + iounmap(kbd_iobase); #endif } diff -Nru a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c --- a/drivers/input/serio/i8042.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/input/serio/i8042.c 2004-09-26 10:25:55 -07:00 @@ -1,7 +1,7 @@ /* * i8042 keyboard and mouse controller driver for Linux * - * Copyright (c) 1999-2002 Vojtech Pavlik + * Copyright (c) 1999-2004 Vojtech Pavlik */ /* @@ -21,6 +21,7 @@ #include #include #include +#include #include @@ -52,6 +53,10 @@ module_param_named(dumbkbd, i8042_dumbkbd, bool, 0); MODULE_PARM_DESC(dumbkbd, "Pretend that controller can only read data from keyboard"); +static unsigned int i8042_noloop; +module_param_named(noloop, i8042_noloop, bool, 0); +MODULE_PARM_DESC(dumbkbd, "Disable the AUX Loopback command while probing for the AUX port"); + __obsolete_setup("i8042_noaux"); __obsolete_setup("i8042_nomux"); __obsolete_setup("i8042_unlock"); @@ -70,19 +75,35 @@ unsigned char irqen; unsigned char exists; signed char mux; - unsigned char *name; - unsigned char *phys; + char name[8]; +}; + +static struct i8042_values i8042_kbd_values = { + .disable = I8042_CTR_KBDDIS, + .irqen = I8042_CTR_KBDINT, + .mux = -1, + .name = "KBD", +}; + +static struct i8042_values i8042_aux_values = { + .disable = I8042_CTR_AUXDIS, + .irqen = I8042_CTR_AUXINT, + .mux = -1, + .name = "AUX", }; -static struct serio i8042_kbd_port; -static struct serio i8042_aux_port; +static struct i8042_values i8042_mux_values[I8042_NUM_MUX_PORTS]; + +static struct serio *i8042_kbd_port; +static struct serio *i8042_aux_port; +static struct serio *i8042_mux_port[I8042_NUM_MUX_PORTS]; static unsigned char i8042_initial_ctr; static unsigned char i8042_ctr; static unsigned char i8042_mux_open; static unsigned char i8042_mux_present; -static unsigned char i8042_sysdev_initialized; static struct pm_dev *i8042_pm_dev; -struct timer_list i8042_timer; +static struct timer_list i8042_timer; +static struct platform_device *i8042_platform_device; /* * Shared IRQ's require a device pointer, but this driver doesn't support @@ -95,6 +116,7 @@ /* * The i8042_wait_read() and i8042_wait_write functions wait for the i8042 to * be ready for reading values from it / writing values to it. + * Called always with i8042_lock held. */ static int i8042_wait_read(void) @@ -131,6 +153,7 @@ spin_lock_irqsave(&i8042_lock, flags); while ((i8042_read_status() & I8042_STR_OBF) && (i++ < I8042_BUFFER_SIZE)) { + udelay(50); data = i8042_read_data(); dbg("%02x <- i8042 (flush, %s)", data, i8042_read_status() & I8042_STR_AUXDATA ? "aux" : "kbd"); @@ -154,6 +177,9 @@ unsigned long flags; int retval = 0, i = 0; + if (i8042_noloop && command == I8042_CMD_AUX_LOOP) + return -1; + spin_lock_irqsave(&i8042_lock, flags); retval = i8042_wait_write(); @@ -214,7 +240,7 @@ static int i8042_aux_write(struct serio *port, unsigned char c) { - struct i8042_values *values = port->driver; + struct i8042_values *values = port->port_data; int retval; /* @@ -242,7 +268,7 @@ static int i8042_activate_port(struct serio *port) { - struct i8042_values *values = port->driver; + struct i8042_values *values = port->port_data; i8042_flush(); @@ -270,7 +296,7 @@ static int i8042_open(struct serio *port) { - struct i8042_values *values = port->driver; + struct i8042_values *values = port->port_data; if (values->mux != -1) if (i8042_mux_open++) @@ -309,7 +335,7 @@ static void i8042_close(struct serio *port) { - struct i8042_values *values = port->driver; + struct i8042_values *values = port->port_data; if (values->mux != -1) if (--i8042_mux_open) @@ -328,52 +354,6 @@ } /* - * Structures for registering the devices in the serio.c module. - */ - -static struct i8042_values i8042_kbd_values = { - .irqen = I8042_CTR_KBDINT, - .disable = I8042_CTR_KBDDIS, - .name = "KBD", - .mux = -1, -}; - -static struct serio i8042_kbd_port = -{ - .type = SERIO_8042_XL, - .write = i8042_kbd_write, - .open = i8042_open, - .close = i8042_close, - .driver = &i8042_kbd_values, - .name = "i8042 Kbd Port", - .phys = I8042_KBD_PHYS_DESC, -}; - -static struct i8042_values i8042_aux_values = { - .irqen = I8042_CTR_AUXINT, - .disable = I8042_CTR_AUXDIS, - .name = "AUX", - .mux = -1, -}; - -static struct serio i8042_aux_port = -{ - .type = SERIO_8042, - .write = i8042_aux_write, - .open = i8042_open, - .close = i8042_close, - .driver = &i8042_aux_values, - .name = "i8042 Aux Port", - .phys = I8042_AUX_PHYS_DESC, -}; - -static struct i8042_values i8042_mux_values[4]; -static struct serio i8042_mux_port[4]; -static char i8042_mux_names[4][32]; -static char i8042_mux_short[4][16]; -static char i8042_mux_phys[4][32]; - -/* * i8042_interrupt() is the most important function in this driver - * it handles the interrupts from the i8042, and sends incoming bytes * to the upper layers. @@ -384,6 +364,7 @@ unsigned long flags; unsigned char str, data = 0; unsigned int dfl; + unsigned int aux_idx; int ret; mod_timer(&i8042_timer, jiffies + I8042_POLL_PERIOD); @@ -400,44 +381,67 @@ goto out; } - dfl = ((str & I8042_STR_PARITY) ? SERIO_PARITY : 0) | - ((str & I8042_STR_TIMEOUT) ? SERIO_TIMEOUT : 0); - - if (i8042_mux_values[0].exists && (str & I8042_STR_AUXDATA)) { + if (i8042_mux_present && (str & I8042_STR_AUXDATA)) { + static unsigned long last_transmit; + static unsigned char last_str; + dfl = 0; if (str & I8042_STR_MUXERR) { + dbg("MUX error, status is %02x, data is %02x", str, data); switch (data) { + default: +/* + * When MUXERR condition is signalled the data register can only contain + * 0xfd, 0xfe or 0xff if implementation follows the spec. Unfortunately + * it is not always the case. Some KBC just get confused which port the + * data came from and signal error leaving the data intact. They _do not_ + * revert to legacy mode (actually I've never seen KBC reverting to legacy + * mode yet, when we see one we'll add proper handling). + * Anyway, we will assume that the data came from the same serio last byte + * was transmitted (if transmission happened not too long ago). + */ + if (time_before(jiffies, last_transmit + HZ/10)) { + str = last_str; + break; + } + /* fall through - report timeout */ case 0xfd: - case 0xfe: dfl = SERIO_TIMEOUT; break; - case 0xff: dfl = SERIO_PARITY; break; + case 0xfe: dfl = SERIO_TIMEOUT; data = 0xfe; break; + case 0xff: dfl = SERIO_PARITY; data = 0xfe; break; } - data = 0xfe; - } else dfl = 0; + } + + aux_idx = (str >> 6) & 3; dbg("%02x <- i8042 (interrupt, aux%d, %d%s%s)", - data, (str >> 6), irq, + data, aux_idx, irq, dfl & SERIO_PARITY ? ", bad parity" : "", dfl & SERIO_TIMEOUT ? ", timeout" : ""); - serio_interrupt(i8042_mux_port + ((str >> 6) & 3), data, dfl, regs); + if (likely(i8042_mux_values[aux_idx].exists)) + serio_interrupt(i8042_mux_port[aux_idx], data, dfl, regs); + last_str = str; + last_transmit = jiffies; goto irq_ret; } + dfl = ((str & I8042_STR_PARITY) ? SERIO_PARITY : 0) | + ((str & I8042_STR_TIMEOUT) ? SERIO_TIMEOUT : 0); + dbg("%02x <- i8042 (interrupt, %s, %d%s%s)", data, (str & I8042_STR_AUXDATA) ? "aux" : "kbd", irq, dfl & SERIO_PARITY ? ", bad parity" : "", dfl & SERIO_TIMEOUT ? ", timeout" : ""); - if (i8042_aux_values.exists && (str & I8042_STR_AUXDATA)) { - serio_interrupt(&i8042_aux_port, data, dfl, regs); - goto irq_ret; - } - - if (!i8042_kbd_values.exists) - goto irq_ret; - serio_interrupt(&i8042_kbd_port, data, dfl, regs); + if (str & I8042_STR_AUXDATA) { + if (likely(i8042_aux_values.exists)) + serio_interrupt(i8042_aux_port, data, dfl, regs); + } else { + if (likely(i8042_kbd_values.exists)) + serio_interrupt(i8042_kbd_port, data, dfl, regs); + } irq_ret: ret = 1; @@ -474,17 +478,8 @@ if (i8042_command(¶m, I8042_CMD_AUX_LOOP) || param != 0xa9) return -1; param = 0xa4; - 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); + if (i8042_command(¶m, I8042_CMD_AUX_LOOP) || param == 0x5b) return -1; - } if (mux_version) *mux_version = ~param; @@ -639,8 +634,10 @@ * registers it, and reports to the user. */ -static int __init i8042_port_register(struct i8042_values *values, struct serio *port) +static int __init i8042_port_register(struct serio *port) { + struct i8042_values *values = port->port_data; + values->exists = 1; i8042_ctr &= ~values->disable; @@ -677,6 +674,7 @@ static int i8042_controller_init(void) { + unsigned long flags; /* * Test the i8042. We need to know if it thinks it's working correctly @@ -723,12 +721,14 @@ * Handle keylock. */ + spin_lock_irqsave(&i8042_lock, flags); if (~i8042_read_status() & I8042_STR_KEYLOCK) { if (i8042_unlock) i8042_ctr |= I8042_CTR_IGNKEYLOCK; else printk(KERN_WARNING "i8042.c: Warning: Keylock active.\n"); } + spin_unlock_irqrestore(&i8042_lock, flags); /* * If the chip is configured into nontranslated mode by the BIOS, don't @@ -745,10 +745,8 @@ * BIOSes. */ - if (i8042_direct) { + if (i8042_direct) i8042_ctr &= ~I8042_CTR_XLATE; - i8042_kbd_port.type = SERIO_8042; - } /* * Write CTR back. @@ -802,14 +800,14 @@ */ if (i8042_kbd_values.exists) - serio_cleanup(&i8042_kbd_port); + serio_cleanup(i8042_kbd_port); if (i8042_aux_values.exists) - serio_cleanup(&i8042_aux_port); + serio_cleanup(i8042_aux_port); - for (i = 0; i < 4; i++) + for (i = 0; i < I8042_NUM_MUX_PORTS; i++) if (i8042_mux_values[i].exists) - serio_cleanup(i8042_mux_port + i); + serio_cleanup(i8042_mux_port[i]); i8042_controller_reset(); } @@ -851,15 +849,15 @@ * Reconnect anything that was connected to the ports. */ - if (i8042_kbd_values.exists && i8042_activate_port(&i8042_kbd_port) == 0) - serio_reconnect(&i8042_kbd_port); + if (i8042_kbd_values.exists && i8042_activate_port(i8042_kbd_port) == 0) + serio_reconnect(i8042_kbd_port); - if (i8042_aux_values.exists && i8042_activate_port(&i8042_aux_port) == 0) - serio_reconnect(&i8042_aux_port); + if (i8042_aux_values.exists && i8042_activate_port(i8042_aux_port) == 0) + serio_reconnect(i8042_aux_port); - for (i = 0; i < 4; i++) - if (i8042_mux_values[i].exists && i8042_activate_port(i8042_mux_port + i) == 0) - serio_reconnect(i8042_mux_port + i); + for (i = 0; i < I8042_NUM_MUX_PORTS; i++) + if (i8042_mux_values[i].exists && i8042_activate_port(i8042_mux_port[i]) == 0) + serio_reconnect(i8042_mux_port[i]); /* * Restart timer (for polling "stuck" data) */ @@ -882,7 +880,7 @@ return NOTIFY_DONE; } -static struct notifier_block i8042_notifier= +static struct notifier_block i8042_notifier = { i8042_notify_sys, NULL, @@ -892,25 +890,27 @@ /* * Suspend/resume handlers for the new PM scheme (driver model) */ -static int i8042_suspend(struct sys_device *dev, u32 state) +static int i8042_suspend(struct device *dev, u32 state, u32 level) { - return i8042_controller_suspend(); + return level == SUSPEND_DISABLE ? i8042_controller_suspend() : 0; } -static int i8042_resume(struct sys_device *dev) +static int i8042_resume(struct device *dev, u32 level) { - return i8042_controller_resume(); + return level == RESUME_ENABLE ? i8042_controller_resume() : 0; } -static struct sysdev_class kbc_sysclass = { - set_kset_name("i8042"), - .suspend = i8042_suspend, - .resume = i8042_resume, -}; +static void i8042_shutdown(struct device *dev) +{ + i8042_controller_cleanup(); +} -static struct sys_device device_i8042 = { - .id = 0, - .cls = &kbc_sysclass, +static struct device_driver i8042_driver = { + .name = "i8042", + .bus = &platform_bus_type, + .suspend = i8042_suspend, + .resume = i8042_resume, + .shutdown = i8042_shutdown, }; /* @@ -929,23 +929,75 @@ return 0; } -static void __init i8042_init_mux_values(struct i8042_values *values, struct serio *port, int index) +static struct serio * __init i8042_allocate_kbd_port(void) { - memcpy(port, &i8042_aux_port, sizeof(struct serio)); - memcpy(values, &i8042_aux_values, sizeof(struct i8042_values)); - sprintf(i8042_mux_names[index], "i8042 Aux-%d Port", index); - sprintf(i8042_mux_phys[index], I8042_MUX_PHYS_DESC, index + 1); - sprintf(i8042_mux_short[index], "AUX%d", index); - port->name = i8042_mux_names[index]; - port->phys = i8042_mux_phys[index]; - port->driver = values; - values->name = i8042_mux_short[index]; - values->mux = index; + struct serio *serio; + + serio = kmalloc(sizeof(struct serio), GFP_KERNEL); + if (serio) { + memset(serio, 0, sizeof(struct serio)); + serio->type = i8042_direct ? SERIO_8042 : SERIO_8042_XL, + serio->write = i8042_dumbkbd ? NULL : i8042_kbd_write, + serio->open = i8042_open, + serio->close = i8042_close, + serio->port_data = &i8042_kbd_values, + serio->dev.parent = &i8042_platform_device->dev; + strlcpy(serio->name, "i8042 Kbd Port", sizeof(serio->name)); + strlcpy(serio->phys, I8042_KBD_PHYS_DESC, sizeof(serio->phys)); + } + + return serio; +} + +static struct serio * __init i8042_allocate_aux_port(void) +{ + struct serio *serio; + + serio = kmalloc(sizeof(struct serio), GFP_KERNEL); + if (serio) { + memset(serio, 0, sizeof(struct serio)); + serio->type = SERIO_8042; + serio->write = i8042_aux_write; + serio->open = i8042_open; + serio->close = i8042_close; + serio->port_data = &i8042_aux_values, + serio->dev.parent = &i8042_platform_device->dev; + strlcpy(serio->name, "i8042 Aux Port", sizeof(serio->name)); + strlcpy(serio->phys, I8042_AUX_PHYS_DESC, sizeof(serio->phys)); + } + + return serio; +} + +static struct serio * __init i8042_allocate_mux_port(int index) +{ + struct serio *serio; + struct i8042_values *values = &i8042_mux_values[index]; + + serio = kmalloc(sizeof(struct serio), GFP_KERNEL); + if (serio) { + *values = i8042_aux_values; + snprintf(values->name, sizeof(values->name), "AUX%d", index); + values->mux = index; + + memset(serio, 0, sizeof(struct serio)); + serio->type = SERIO_8042; + serio->write = i8042_aux_write; + serio->open = i8042_open; + serio->close = i8042_close; + serio->port_data = values; + serio->dev.parent = &i8042_platform_device->dev; + snprintf(serio->name, sizeof(serio->name), "i8042 Aux-%d Port", index); + snprintf(serio->phys, sizeof(serio->phys), I8042_MUX_PHYS_DESC, index + 1); + } + + return serio; } int __init i8042_init(void) { int i; + int err; dbg_init(); @@ -961,30 +1013,36 @@ if (i8042_controller_init()) return -ENODEV; - if (i8042_dumbkbd) - i8042_kbd_port.write = NULL; + err = driver_register(&i8042_driver); + if (err) + return err; + + i8042_platform_device = platform_device_register_simple("i8042", -1, NULL, 0); + if (IS_ERR(i8042_platform_device)) { + driver_unregister(&i8042_driver); + return PTR_ERR(i8042_platform_device); + } if (!i8042_noaux && !i8042_check_aux(&i8042_aux_values)) { if (!i8042_nomux && !i8042_check_mux(&i8042_aux_values)) - for (i = 0; i < 4; i++) { - i8042_init_mux_values(i8042_mux_values + i, i8042_mux_port + i, i); - i8042_port_register(i8042_mux_values + i, i8042_mux_port + i); + for (i = 0; i < I8042_NUM_MUX_PORTS; i++) { + i8042_mux_port[i] = i8042_allocate_mux_port(i); + if (i8042_mux_port[i]) + i8042_port_register(i8042_mux_port[i]); } - else - i8042_port_register(&i8042_aux_values, &i8042_aux_port); + else { + i8042_aux_port = i8042_allocate_aux_port(); + if (i8042_aux_port) + i8042_port_register(i8042_aux_port); + } } - i8042_port_register(&i8042_kbd_values, &i8042_kbd_port); + i8042_kbd_port = i8042_allocate_kbd_port(); + if (i8042_kbd_port) + i8042_port_register(i8042_kbd_port); mod_timer(&i8042_timer, jiffies + I8042_POLL_PERIOD); - if (sysdev_class_register(&kbc_sysclass) == 0) { - if (sysdev_register(&device_i8042) == 0) - i8042_sysdev_initialized = 1; - else - sysdev_class_unregister(&kbc_sysclass); - } - i8042_pm_dev = pm_register(PM_SYS_DEV, PM_SYS_UNKNOWN, i8042_pm_callback); register_reboot_notifier(&i8042_notifier); @@ -1001,23 +1059,22 @@ if (i8042_pm_dev) pm_unregister(i8042_pm_dev); - if (i8042_sysdev_initialized) { - sysdev_unregister(&device_i8042); - sysdev_class_unregister(&kbc_sysclass); - } - i8042_controller_cleanup(); if (i8042_kbd_values.exists) - serio_unregister_port(&i8042_kbd_port); + serio_unregister_port(i8042_kbd_port); if (i8042_aux_values.exists) - serio_unregister_port(&i8042_aux_port); + serio_unregister_port(i8042_aux_port); - for (i = 0; i < 4; i++) + for (i = 0; i < I8042_NUM_MUX_PORTS; i++) if (i8042_mux_values[i].exists) - serio_unregister_port(i8042_mux_port + i); + serio_unregister_port(i8042_mux_port[i]); + del_timer_sync(&i8042_timer); + + platform_device_unregister(i8042_platform_device); + driver_unregister(&i8042_driver); i8042_platform_exit(); } diff -Nru a/drivers/input/serio/i8042.h b/drivers/input/serio/i8042.h --- a/drivers/input/serio/i8042.h 2004-09-26 10:25:57 -07:00 +++ b/drivers/input/serio/i8042.h 2004-09-26 10:25:57 -07:00 @@ -104,6 +104,13 @@ #define I8042_BUFFER_SIZE 32 /* + * Number of AUX ports on controllers supporting active multiplexing + * specification + */ + +#define I8042_NUM_MUX_PORTS 4 + +/* * Debug. */ diff -Nru a/drivers/input/serio/maceps2.c b/drivers/input/serio/maceps2.c --- a/drivers/input/serio/maceps2.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/input/serio/maceps2.c 2004-09-26 10:25:56 -07:00 @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -46,15 +47,18 @@ #define PS2_CONTROL_RX_CLOCK_ENABLE BIT(4) /* pause reception if set to 0 */ #define PS2_CONTROL_RESET BIT(5) /* reset */ - struct maceps2_data { struct mace_ps2port *port; int irq; }; +static struct maceps2_data port_data[2]; +static struct serio *maceps2_port[2]; +static struct platform_device *maceps2_device; + static int maceps2_write(struct serio *dev, unsigned char val) { - struct mace_ps2port *port = ((struct maceps2_data *)dev->driver)->port; + struct mace_ps2port *port = ((struct maceps2_data *)dev->port_data)->port; unsigned int timeout = MACE_PS2_TIMEOUT; do { @@ -68,11 +72,10 @@ return -1; } -static irqreturn_t maceps2_interrupt(int irq, void *dev_id, - struct pt_regs *regs) +static irqreturn_t maceps2_interrupt(int irq, void *dev_id, struct pt_regs *regs) { struct serio *dev = dev_id; - struct mace_ps2port *port = ((struct maceps2_data *)dev->driver)->port; + struct mace_ps2port *port = ((struct maceps2_data *)dev->port_data)->port; unsigned int byte; if (mace_read(port->status) & PS2_STATUS_RX_FULL) { @@ -85,7 +88,7 @@ static int maceps2_open(struct serio *dev) { - struct maceps2_data *data = (struct maceps2_data *)dev->driver; + struct maceps2_data *data = (struct maceps2_data *)dev->port_data; if (request_irq(data->irq, maceps2_interrupt, 0, "PS/2 port", dev)) { printk(KERN_ERR "Could not allocate PS/2 IRQ\n"); @@ -106,7 +109,7 @@ static void maceps2_close(struct serio *dev) { - struct maceps2_data *data = (struct maceps2_data *)dev->driver; + struct maceps2_data *data = (struct maceps2_data *)dev->port_data; mace_write(PS2_CONTROL_TX_CLOCK_DISABLE | PS2_CONTROL_RESET, data->port->control); @@ -114,46 +117,59 @@ free_irq(data->irq, dev); } -static struct maceps2_data port0_data, port1_data; -static struct serio maceps2_port0 = +static struct serio * __init maceps2_allocate_port(int idx) { - .type = SERIO_8042, - .open = maceps2_open, - .close = maceps2_close, - .write = maceps2_write, - .name = "MACE PS/2 port0", - .phys = "mace/serio0", - .driver = &port0_data, -}; + struct serio *serio; + + serio = kmalloc(sizeof(struct serio), GFP_KERNEL); + if (serio) { + memset(serio, 0, sizeof(struct serio)); + serio->type = SERIO_8042; + serio->write = maceps2_write; + serio->open = maceps2_open; + serio->close = maceps2_close; + snprintf(serio->name, sizeof(serio->name), "MACE PS/2 port%d", idx); + snprintf(serio->phys, sizeof(serio->phys), "mace/serio%d", idx); + serio->port_data = &port_data[idx]; + serio->dev.parent = &maceps2_device->dev; + } + + return serio; +} -static struct serio maceps2_port1 = -{ - .type = SERIO_8042, - .open = maceps2_open, - .close = maceps2_close, - .write = maceps2_write, - .name = "MACE PS/2 port1", - .phys = "mace/serio1", - .driver = &port1_data, -}; static int __init maceps2_init(void) { - port0_data.port = &mace->perif.ps2.keyb; - port0_data.irq = MACEISA_KEYB_IRQ; - port1_data.port = &mace->perif.ps2.mouse; - port1_data.irq = MACEISA_MOUSE_IRQ; - serio_register_port(&maceps2_port0); - serio_register_port(&maceps2_port1); + maceps2_device = platform_device_register_simple("maceps2", -1, NULL, 0); + if (IS_ERR(maceps2_device)) + return PTR_ERR(maceps2_device); + + port_data[0].port = &mace->perif.ps2.keyb; + port_data[0].irq = MACEISA_KEYB_IRQ; + port_data[1].port = &mace->perif.ps2.mouse; + port_data[1].irq = MACEISA_MOUSE_IRQ; + + maceps2_port[0] = maceps2_allocate_port(0); + maceps2_port[1] = maceps2_allocate_port(1); + if (!maceps2_port[0] || !maceps2_port[1]) { + kfree(maceps2_port[0]); + kfree(maceps2_port[1]); + platform_device_unregister(maceps2_device); + return -ENOMEM; + } + + serio_register_port(maceps2_port[0]); + serio_register_port(maceps2_port[1]); return 0; } static void __exit maceps2_exit(void) { - serio_unregister_port(&maceps2_port0); - serio_unregister_port(&maceps2_port1); + serio_unregister_port(maceps2_port[0]); + serio_unregister_port(maceps2_port[1]); + platform_device_unregister(maceps2_device); } module_init(maceps2_init); diff -Nru a/drivers/input/serio/parkbd.c b/drivers/input/serio/parkbd.c --- a/drivers/input/serio/parkbd.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/input/serio/parkbd.c 2004-09-26 10:25:55 -07:00 @@ -53,9 +53,7 @@ static unsigned long parkbd_start; static struct pardevice *parkbd_dev; - -static char parkbd_name[] = "PARKBD AT/XT keyboard adapter"; -static char parkbd_phys[32]; +static struct serio *parkbd_port; static int parkbd_readlines(void) { @@ -86,13 +84,6 @@ return 0; } -static struct serio parkbd_port = -{ - .write = parkbd_write, - .name = parkbd_name, - .phys = parkbd_phys, -}; - static void parkbd_interrupt(int irq, void *dev_id, struct pt_regs *regs) { @@ -125,7 +116,7 @@ parkbd_buffer |= (parkbd_readlines() >> 1) << parkbd_counter++; if (parkbd_counter == parkbd_mode + 10) - serio_interrupt(&parkbd_port, (parkbd_buffer >> (2 - parkbd_mode)) & 0xff, 0, regs); + serio_interrupt(parkbd_port, (parkbd_buffer >> (2 - parkbd_mode)) & 0xff, 0, regs); } parkbd_last = jiffies; @@ -163,16 +154,38 @@ return 0; } +static struct serio * __init parkbd_allocate_serio(void) +{ + struct serio *serio; + + serio = kmalloc(sizeof(struct serio), GFP_KERNEL); + if (serio) { + serio->type = parkbd_mode; + serio->write = parkbd_write, + strlcpy(serio->name, "PARKBD AT/XT keyboard adapter", sizeof(serio->name)); + snprintf(serio->phys, sizeof(serio->phys), "%s/serio0", parkbd_dev->port->name); + } + + return serio; +} int __init parkbd_init(void) { - if (parkbd_getport()) return -1; - parkbd_writelines(3); - parkbd_port.type = parkbd_mode; + int err; - sprintf(parkbd_phys, "%s/serio0", parkbd_dev->port->name); + err = parkbd_getport(); + if (err) + return err; + + parkbd_port = parkbd_allocate_serio(); + if (!parkbd_port) { + parport_release(parkbd_dev); + return -ENOMEM; + } + + parkbd_writelines(3); - serio_register_port(&parkbd_port); + serio_register_port(parkbd_port); printk(KERN_INFO "serio: PARKBD %s adapter on %s\n", parkbd_mode ? "AT" : "XT", parkbd_dev->port->name); @@ -183,7 +196,7 @@ void __exit parkbd_exit(void) { parport_release(parkbd_dev); - serio_unregister_port(&parkbd_port); + serio_unregister_port(parkbd_port); parport_unregister_device(parkbd_dev); } diff -Nru a/drivers/input/serio/pcips2.c b/drivers/input/serio/pcips2.c --- a/drivers/input/serio/pcips2.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/input/serio/pcips2.c 2004-09-26 10:25:55 -07:00 @@ -38,14 +38,14 @@ #define PS2_STAT_TXEMPTY (1<<7) struct pcips2_data { - struct serio io; + struct serio *io; unsigned int base; struct pci_dev *dev; }; static int pcips2_write(struct serio *io, unsigned char val) { - struct pcips2_data *ps2if = io->driver; + struct pcips2_data *ps2if = io->port_data; unsigned int stat; do { @@ -80,7 +80,7 @@ if (hweight8(scancode) & 1) flag ^= SERIO_PARITY; - serio_interrupt(&ps2if->io, scancode, flag, regs); + serio_interrupt(ps2if->io, scancode, flag, regs); } while (1); return IRQ_RETVAL(handled); } @@ -101,7 +101,7 @@ static int pcips2_open(struct serio *io) { - struct pcips2_data *ps2if = io->driver; + struct pcips2_data *ps2if = io->port_data; int ret, val = 0; outb(PS2_CTRL_ENABLE, ps2if->base); @@ -119,7 +119,7 @@ static void pcips2_close(struct serio *io) { - struct pcips2_data *ps2if = io->driver; + struct pcips2_data *ps2if = io->port_data; outb(0, ps2if->base); @@ -129,46 +129,51 @@ static int __devinit pcips2_probe(struct pci_dev *dev, const struct pci_device_id *id) { struct pcips2_data *ps2if; + struct serio *serio; int ret; ret = pci_enable_device(dev); if (ret) - return ret; + goto out; - if (!request_region(pci_resource_start(dev, 0), - pci_resource_len(dev, 0), "pcips2")) { - ret = -EBUSY; + ret = pci_request_regions(dev, "pcips2"); + if (ret) goto disable; - } ps2if = kmalloc(sizeof(struct pcips2_data), GFP_KERNEL); - if (!ps2if) { + serio = kmalloc(sizeof(struct serio), GFP_KERNEL); + if (!ps2if || !serio) { ret = -ENOMEM; goto release; } memset(ps2if, 0, sizeof(struct pcips2_data)); + memset(serio, 0, sizeof(struct serio)); - ps2if->io.type = SERIO_8042; - ps2if->io.write = pcips2_write; - ps2if->io.open = pcips2_open; - ps2if->io.close = pcips2_close; - ps2if->io.name = pci_name(dev); - ps2if->io.phys = dev->dev.bus_id; - ps2if->io.driver = ps2if; + serio->type = SERIO_8042; + serio->write = pcips2_write; + serio->open = pcips2_open; + serio->close = pcips2_close; + strlcpy(serio->name, pci_name(dev), sizeof(serio->name)); + strlcpy(serio->phys, dev->dev.bus_id, sizeof(serio->phys)); + serio->port_data = ps2if; + serio->dev.parent = &dev->dev; + ps2if->io = serio; ps2if->dev = dev; ps2if->base = pci_resource_start(dev, 0); pci_set_drvdata(dev, ps2if); - serio_register_port(&ps2if->io); + serio_register_port(ps2if->io); return 0; release: - release_region(pci_resource_start(dev, 0), - pci_resource_len(dev, 0)); + kfree(ps2if); + kfree(serio); + pci_release_regions(dev); disable: pci_disable_device(dev); + out: return ret; } @@ -176,11 +181,10 @@ { struct pcips2_data *ps2if = pci_get_drvdata(dev); - serio_unregister_port(&ps2if->io); - release_region(pci_resource_start(dev, 0), - pci_resource_len(dev, 0)); + serio_unregister_port(ps2if->io); pci_set_drvdata(dev, NULL); kfree(ps2if); + pci_release_regions(dev); pci_disable_device(dev); } diff -Nru a/drivers/input/serio/q40kbd.c b/drivers/input/serio/q40kbd.c --- a/drivers/input/serio/q40kbd.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/input/serio/q40kbd.c 2004-09-26 10:25:55 -07:00 @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -47,43 +48,106 @@ MODULE_DESCRIPTION("Q40 PS/2 keyboard controller driver"); MODULE_LICENSE("GPL"); -static struct serio q40kbd_port = -{ - .type = SERIO_8042, - .name = "Q40 kbd port", - .phys = "Q40", - .write = NULL, -}; +spinlock_t q40kbd_lock = SPIN_LOCK_UNLOCKED; +static struct serio *q40kbd_port; +static struct platform_device *q40kbd_device; -static irqreturn_t q40kbd_interrupt(int irq, void *dev_id, - struct pt_regs *regs) +static irqreturn_t q40kbd_interrupt(int irq, void *dev_id, struct pt_regs *regs) { + unsigned long flags; + + spin_lock_irqsave(&q40kbd_lock, flags); + if (Q40_IRQ_KEYB_MASK & master_inb(INTERRUPT_REG)) - serio_interrupt(&q40kbd_port, master_inb(KEYCODE_REG), 0, regs); + serio_interrupt(q40kbd_port, master_inb(KEYCODE_REG), 0, regs); master_outb(-1, KEYBOARD_UNLOCK_REG); + + spin_unlock_irqrestore(&q40kbd_lock, flags); + return IRQ_HANDLED; } -static int __init q40kbd_init(void) +/* + * q40kbd_flush() flushes all data that may be in the keyboard buffers + */ + +static void q40kbd_flush(void) { - int maxread = 100; + int maxread = 100; + unsigned long flags; + + spin_lock_irqsave(&q40kbd_lock, flags); + + while (maxread-- && (Q40_IRQ_KEYB_MASK & master_inb(INTERRUPT_REG))) + master_inb(KEYCODE_REG); + + spin_unlock_irqrestore(&q40kbd_lock, flags); +} + +/* + * q40kbd_open() is called when a port is open by the higher layer. + * It allocates the interrupt and enables in in the chip. + */ + +static int q40kbd_open(struct serio *port) +{ + q40kbd_flush(); + + if (request_irq(Q40_IRQ_KEYBOARD, q40kbd_interrupt, 0, "q40kbd", NULL)) { + printk(KERN_ERR "q40kbd.c: Can't get irq %d.\n", Q40_IRQ_KEYBOARD); + return -1; + } + + /* off we go */ + master_outb(-1, KEYBOARD_UNLOCK_REG); + master_outb(1, KEY_IRQ_ENABLE_REG); + + return 0; +} +static void q40kbd_close(struct serio *port) +{ + master_outb(0, KEY_IRQ_ENABLE_REG); + master_outb(-1, KEYBOARD_UNLOCK_REG); + free_irq(Q40_IRQ_KEYBOARD, NULL); + + q40kbd_flush(); +} + +static struct serio * __init q40kbd_allocate_port(void) +{ + struct serio *serio; + + serio = kmalloc(sizeof(struct serio), GFP_KERNEL); + if (serio) { + memset(serio, 0, sizeof(struct serio)); + serio->type = SERIO_8042; + serio->open = q40kbd_open; + serio->close = q40kbd_close; + serio->dev.parent = &q40kbd_device->dev; + strlcpy(serio->name, "Q40 Kbd Port", sizeof(serio->name)); + strlcpy(serio->phys, "Q40", sizeof(serio->phys)); + } + + return serio; +} + +static int __init q40kbd_init(void) +{ if (!MACH_IS_Q40) return -EIO; - /* allocate the IRQ */ - request_irq(Q40_IRQ_KEYBOARD, q40kbd_interrupt, 0, "q40kbd", NULL); - - /* flush any pending input */ - while (maxread-- && (Q40_IRQ_KEYB_MASK & master_inb(INTERRUPT_REG))) - master_inb(KEYCODE_REG); - - /* off we go */ - master_outb(-1,KEYBOARD_UNLOCK_REG); - master_outb(1,KEY_IRQ_ENABLE_REG); + q40kbd_device = platform_device_register_simple("q40kbd", -1, NULL, 0); + if (IS_ERR(q40kbd_device)) + return PTR_ERR(q40kbd_device); + + if (!(q40kbd_port = q40kbd_allocate_port())) { + platform_device_unregister(q40kbd_device); + return -ENOMEM; + } - serio_register_port(&q40kbd_port); + serio_register_port(q40kbd_port); printk(KERN_INFO "serio: Q40 kbd registered\n"); return 0; @@ -91,11 +155,8 @@ static void __exit q40kbd_exit(void) { - master_outb(0,KEY_IRQ_ENABLE_REG); - master_outb(-1,KEYBOARD_UNLOCK_REG); - - serio_unregister_port(&q40kbd_port); - free_irq(Q40_IRQ_KEYBOARD, NULL); + serio_unregister_port(q40kbd_port); + platform_device_unregister(q40kbd_device); } module_init(q40kbd_init); diff -Nru a/drivers/input/serio/rpckbd.c b/drivers/input/serio/rpckbd.c --- a/drivers/input/serio/rpckbd.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/input/serio/rpckbd.c 2004-09-26 10:25:55 -07:00 @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -44,6 +45,9 @@ MODULE_DESCRIPTION("Acorn RiscPC PS/2 keyboard controller driver"); MODULE_LICENSE("GPL"); +static struct serio *rpckbd_port; +static struct platform_device *rpckbd_device; + static int rpckbd_write(struct serio *port, unsigned char val) { while (!(iomd_readb(IOMD_KCTRL) & (1 << 7))) @@ -101,25 +105,49 @@ free_irq(IRQ_KEYBOARDTX, port); } -static struct serio rpckbd_port = -{ - .type = SERIO_8042, - .open = rpckbd_open, - .close = rpckbd_close, - .write = rpckbd_write, - .name = "RiscPC PS/2 kbd port", - .phys = "rpckbd/serio0", -}; +/* + * Allocate and initialize serio structure for subsequent registration + * with serio core. + */ + +static struct serio * __init rpckbd_allocate_port(void) +{ + struct serio *serio; + + serio = kmalloc(sizeof(struct serio), GFP_KERNEL); + if (serio) { + memset(serio, 0, sizeof(struct serio)); + serio->type = SERIO_8042; + serio->write = rpckbd_write; + serio->open = rpckbd_open; + serio->close = rpckbd_close; + serio->dev.parent = &rpckbd_device->dev; + strlcpy(serio->name, "RiscPC PS/2 kbd port", sizeof(serio->name)); + strlcpy(serio->phys, "rpckbd/serio0", sizeof(serio->phys)); + } + + return serio; +} static int __init rpckbd_init(void) { - serio_register_port(&rpckbd_port); + rpckbd_device = platform_device_register_simple("rpckbd", -1, NULL, 0); + if (IS_ERR(rpckbd_device)) + return PTR_ERR(rpckbd_device); + + if (!(rpckbd_port = rpckbd_allocate_port())) { + platform_device_unregister(rpckbd_device); + return -ENOMEM; + } + + serio_register_port(rpckbd_port); return 0; } static void __exit rpckbd_exit(void) { - serio_unregister_port(&rpckbd_port); + serio_unregister_port(rpckbd_port); + platform_device_unregister(rpckbd_device); } module_init(rpckbd_init); diff -Nru a/drivers/input/serio/sa1111ps2.c b/drivers/input/serio/sa1111ps2.c --- a/drivers/input/serio/sa1111ps2.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/input/serio/sa1111ps2.c 2004-09-26 10:25:56 -07:00 @@ -26,7 +26,7 @@ #include struct ps2if { - struct serio io; + struct serio *io; struct sa1111_dev *dev; unsigned long base; unsigned int open; @@ -59,7 +59,7 @@ if (hweight8(scancode) & 1) flag ^= SERIO_PARITY; - serio_interrupt(&ps2if->io, scancode, flag, regs); + serio_interrupt(ps2if->io, scancode, flag, regs); status = sa1111_readl(ps2if->base + SA1111_PS2STAT); } @@ -95,7 +95,7 @@ */ static int ps2_write(struct serio *io, unsigned char val) { - struct ps2if *ps2if = io->driver; + struct ps2if *ps2if = io->port_data; unsigned long flags; unsigned int head; @@ -122,7 +122,7 @@ static int ps2_open(struct serio *io) { - struct ps2if *ps2if = io->driver; + struct ps2if *ps2if = io->port_data; int ret; sa1111_enable_device(ps2if->dev); @@ -154,7 +154,7 @@ static void ps2_close(struct serio *io) { - struct ps2if *ps2if = io->driver; + struct ps2if *ps2if = io->port_data; sa1111_writel(0, ps2if->base + SA1111_PS2CR); @@ -232,22 +232,28 @@ static int ps2_probe(struct sa1111_dev *dev) { struct ps2if *ps2if; + struct serio *serio; int ret; ps2if = kmalloc(sizeof(struct ps2if), GFP_KERNEL); - if (!ps2if) { - return -ENOMEM; + serio = kmalloc(sizeof(struct serio), GFP_KERNEL); + if (!ps2if || !serio) { + ret = -ENOMEM; + goto free; } memset(ps2if, 0, sizeof(struct ps2if)); + memset(serio, 0, sizeof(struct serio)); - ps2if->io.type = SERIO_8042; - ps2if->io.write = ps2_write; - ps2if->io.open = ps2_open; - ps2if->io.close = ps2_close; - ps2if->io.name = dev->dev.bus_id; - ps2if->io.phys = dev->dev.bus_id; - ps2if->io.driver = ps2if; + serio->type = SERIO_8042; + serio->write = ps2_write; + serio->open = ps2_open; + serio->close = ps2_close; + strlcpy(serio->name, dev->dev.bus_id, sizeof(serio->name)); + strlcpy(serio->phys, dev->dev.bus_id, sizeof(serio->phys)); + serio->port_data = ps2if; + serio->dev.parent = &dev->dev; + ps2if->io = serio; ps2if->dev = dev; sa1111_set_drvdata(dev, ps2if); @@ -292,7 +298,7 @@ ps2_clear_input(ps2if); sa1111_disable_device(ps2if->dev); - serio_register_port(&ps2if->io); + serio_register_port(ps2if->io); return 0; out: @@ -302,6 +308,7 @@ free: sa1111_set_drvdata(dev, NULL); kfree(ps2if); + kfree(serio); return ret; } @@ -312,7 +319,7 @@ { struct ps2if *ps2if = sa1111_get_drvdata(dev); - serio_unregister_port(&ps2if->io); + serio_unregister_port(ps2if->io); release_mem_region(dev->res.start, dev->res.end - dev->res.start + 1); sa1111_set_drvdata(dev, NULL); diff -Nru a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c --- a/drivers/input/serio/serio.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/input/serio/serio.c 2004-09-26 10:25:55 -07:00 @@ -1,11 +1,9 @@ /* - * $Id: serio.c,v 1.15 2002/01/22 21:12:03 vojtech Exp $ - * - * Copyright (c) 1999-2001 Vojtech Pavlik - */ - -/* * The Serio abstraction module + * + * Copyright (c) 1999-2004 Vojtech Pavlik + * Copyright (c) 2004 Dmitry Torokhov + * Copyright (c) 2003 Daniele Bellucci */ /* @@ -26,10 +24,6 @@ * 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 - * - * Changes: - * 20 Jul. 2003 Daniele Bellucci - * Minor cleanups. */ #include @@ -50,100 +44,178 @@ EXPORT_SYMBOL(serio_interrupt); EXPORT_SYMBOL(serio_register_port); EXPORT_SYMBOL(serio_register_port_delayed); -EXPORT_SYMBOL(__serio_register_port); EXPORT_SYMBOL(serio_unregister_port); EXPORT_SYMBOL(serio_unregister_port_delayed); -EXPORT_SYMBOL(__serio_unregister_port); -EXPORT_SYMBOL(serio_register_device); -EXPORT_SYMBOL(serio_unregister_device); +EXPORT_SYMBOL(serio_register_driver); +EXPORT_SYMBOL(serio_unregister_driver); EXPORT_SYMBOL(serio_open); EXPORT_SYMBOL(serio_close); EXPORT_SYMBOL(serio_rescan); EXPORT_SYMBOL(serio_reconnect); +static DECLARE_MUTEX(serio_sem); /* protects serio_list and serio_diriver_list */ +static LIST_HEAD(serio_list); +static LIST_HEAD(serio_driver_list); +static unsigned int serio_no; + +struct bus_type serio_bus = { + .name = "serio", +}; + +static void serio_find_driver(struct serio *serio); +static void serio_create_port(struct serio *serio); +static void serio_destroy_port(struct serio *serio); +static void serio_connect_port(struct serio *serio, struct serio_driver *drv); +static void serio_reconnect_port(struct serio *serio); +static void serio_disconnect_port(struct serio *serio); + +static int serio_bind_driver(struct serio *serio, struct serio_driver *drv) +{ + get_driver(&drv->driver); + + drv->connect(serio, drv); + if (serio->drv) { + down_write(&serio_bus.subsys.rwsem); + serio->dev.driver = &drv->driver; + device_bind_driver(&serio->dev); + up_write(&serio_bus.subsys.rwsem); + return 1; + } + + put_driver(&drv->driver); + return 0; +} + +/* serio_find_driver() must be called with serio_sem down. */ +static void serio_find_driver(struct serio *serio) +{ + struct serio_driver *drv; + + list_for_each_entry(drv, &serio_driver_list, node) + if (!drv->manual_bind) + if (serio_bind_driver(serio, drv)) + break; +} + +/* + * Serio event processing. + */ + struct serio_event { int type; struct serio *serio; struct list_head node; }; -static DECLARE_MUTEX(serio_sem); -static LIST_HEAD(serio_list); -static LIST_HEAD(serio_dev_list); +enum serio_event_type { + SERIO_RESCAN, + SERIO_RECONNECT, + SERIO_REGISTER_PORT, + SERIO_UNREGISTER_PORT, +}; + +static spinlock_t serio_event_lock = SPIN_LOCK_UNLOCKED; /* protects serio_event_list */ static LIST_HEAD(serio_event_list); +static DECLARE_WAIT_QUEUE_HEAD(serio_wait); +static DECLARE_COMPLETION(serio_exited); static int serio_pid; -static void serio_find_dev(struct serio *serio) +static void serio_queue_event(struct serio *serio, int event_type) { - struct serio_dev *dev; + unsigned long flags; + struct serio_event *event; - list_for_each_entry(dev, &serio_dev_list, node) { - if (serio->dev) - break; - if (dev->connect) - dev->connect(serio, dev); - } -} + spin_lock_irqsave(&serio_event_lock, flags); -#define SERIO_RESCAN 1 -#define SERIO_RECONNECT 2 -#define SERIO_REGISTER_PORT 3 -#define SERIO_UNREGISTER_PORT 4 + if ((event = kmalloc(sizeof(struct serio_event), GFP_ATOMIC))) { + event->type = event_type; + event->serio = serio; -static DECLARE_WAIT_QUEUE_HEAD(serio_wait); -static DECLARE_COMPLETION(serio_exited); + list_add_tail(&event->node, &serio_event_list); + wake_up(&serio_wait); + } + + spin_unlock_irqrestore(&serio_event_lock, flags); +} -static void serio_invalidate_pending_events(struct serio *serio) +static struct serio_event *serio_get_event(void) { struct serio_event *event; + struct list_head *node; + unsigned long flags; + + spin_lock_irqsave(&serio_event_lock, flags); + + if (list_empty(&serio_event_list)) { + spin_unlock_irqrestore(&serio_event_lock, flags); + return NULL; + } + + node = serio_event_list.next; + event = container_of(node, struct serio_event, node); + list_del_init(node); + + spin_unlock_irqrestore(&serio_event_lock, flags); - list_for_each_entry(event, &serio_event_list, node) - if (event->serio == serio) - event->serio = NULL; + return event; } -void serio_handle_events(void) +static void serio_handle_events(void) { - struct list_head *node, *next; struct serio_event *event; - list_for_each_safe(node, next, &serio_event_list) { - event = container_of(node, struct serio_event, node); + while ((event = serio_get_event())) { down(&serio_sem); - if (event->serio == NULL) - goto event_done; switch (event->type) { case SERIO_REGISTER_PORT : - __serio_register_port(event->serio); + serio_create_port(event->serio); + serio_connect_port(event->serio, NULL); break; case SERIO_UNREGISTER_PORT : - __serio_unregister_port(event->serio); + serio_disconnect_port(event->serio); + serio_destroy_port(event->serio); break; case SERIO_RECONNECT : - if (event->serio->dev && event->serio->dev->reconnect) - if (event->serio->dev->reconnect(event->serio) == 0) - break; - /* reconnect failed - fall through to rescan */ + serio_reconnect_port(event->serio); + break; case SERIO_RESCAN : - if (event->serio->dev && event->serio->dev->disconnect) - event->serio->dev->disconnect(event->serio); - serio_find_dev(event->serio); + serio_disconnect_port(event->serio); + serio_connect_port(event->serio, NULL); break; default: break; } -event_done: + up(&serio_sem); - list_del_init(node); kfree(event); } } +static void serio_remove_pending_events(struct serio *serio) +{ + struct list_head *node, *next; + struct serio_event *event; + unsigned long flags; + + spin_lock_irqsave(&serio_event_lock, flags); + + list_for_each_safe(node, next, &serio_event_list) { + event = container_of(node, struct serio_event, node); + if (event->serio == serio) { + list_del_init(node); + kfree(event); + } + } + + spin_unlock_irqrestore(&serio_event_lock, flags); +} + + static int serio_thread(void *nothing) { lock_kernel(); @@ -163,52 +235,239 @@ complete_and_exit(&serio_exited, 0); } -static void serio_queue_event(struct serio *serio, int event_type) + +/* + * Serio port operations + */ + +static ssize_t serio_show_description(struct device *dev, char *buf) { - struct serio_event *event; + struct serio *serio = to_serio_port(dev); + return sprintf(buf, "%s\n", serio->name); +} - if ((event = kmalloc(sizeof(struct serio_event), GFP_ATOMIC))) { - event->type = event_type; - event->serio = serio; +static ssize_t serio_show_driver(struct device *dev, char *buf) +{ + return sprintf(buf, "%s\n", dev->driver ? dev->driver->name : "(none)"); +} - list_add_tail(&event->node, &serio_event_list); - wake_up(&serio_wait); +static ssize_t serio_rebind_driver(struct device *dev, const char *buf, size_t count) +{ + struct serio *serio = to_serio_port(dev); + struct device_driver *drv; + int retval; + + retval = down_interruptible(&serio_sem); + if (retval) + return retval; + + retval = count; + if (!strncmp(buf, "none", count)) { + serio_disconnect_port(serio); + } else if (!strncmp(buf, "reconnect", count)) { + serio_reconnect_port(serio); + } else if (!strncmp(buf, "rescan", count)) { + serio_disconnect_port(serio); + serio_connect_port(serio, NULL); + } else if ((drv = driver_find(buf, &serio_bus)) != NULL) { + serio_disconnect_port(serio); + serio_connect_port(serio, to_serio_driver(drv)); + put_driver(drv); + } else { + retval = -EINVAL; } + + up(&serio_sem); + + return retval; } -void serio_rescan(struct serio *serio) +static ssize_t serio_show_bind_mode(struct device *dev, char *buf) { - serio_queue_event(serio, SERIO_RESCAN); + struct serio *serio = to_serio_port(dev); + return sprintf(buf, "%s\n", serio->manual_bind ? "manual" : "auto"); } -void serio_reconnect(struct serio *serio) +static ssize_t serio_set_bind_mode(struct device *dev, const char *buf, size_t count) { - serio_queue_event(serio, SERIO_RECONNECT); + struct serio *serio = to_serio_port(dev); + int retval; + + retval = count; + if (!strncmp(buf, "manual", count)) { + serio->manual_bind = 1; + } else if (!strncmp(buf, "auto", count)) { + serio->manual_bind = 0; + } else { + retval = -EINVAL; + } + + return retval; } -irqreturn_t serio_interrupt(struct serio *serio, - unsigned char data, unsigned int flags, struct pt_regs *regs) +static struct device_attribute serio_device_attrs[] = { + __ATTR(description, S_IRUGO, serio_show_description, NULL), + __ATTR(driver, S_IWUSR | S_IRUGO, serio_show_driver, serio_rebind_driver), + __ATTR(bind_mode, S_IWUSR | S_IRUGO, serio_show_bind_mode, serio_set_bind_mode), + __ATTR_NULL +}; + + +static void serio_release_port(struct device *dev) { - irqreturn_t ret = IRQ_NONE; + struct serio *serio = to_serio_port(dev); - if (serio->dev && serio->dev->interrupt) { - ret = serio->dev->interrupt(serio, data, flags, regs); - } else { - if (!flags) { - if ((serio->type == SERIO_8042 || - serio->type == SERIO_8042_XL) && (data != 0xaa)) - return ret; - serio_rescan(serio); - ret = IRQ_HANDLED; + kfree(serio); + module_put(THIS_MODULE); +} + +static void serio_create_port(struct serio *serio) +{ + try_module_get(THIS_MODULE); + + spin_lock_init(&serio->lock); + list_add_tail(&serio->node, &serio_list); + snprintf(serio->dev.bus_id, sizeof(serio->dev.bus_id), "serio%d", serio_no++); + serio->dev.bus = &serio_bus; + serio->dev.release = serio_release_port; + if (serio->parent) + serio->dev.parent = &serio->parent->dev; + device_register(&serio->dev); +} + +/* + * serio_destroy_port() completes deregistration process and removes + * port from the system + */ +static void serio_destroy_port(struct serio *serio) +{ + struct serio_driver *drv = serio->drv; + unsigned long flags; + + serio_remove_pending_events(serio); + list_del_init(&serio->node); + + if (drv) { + drv->disconnect(serio); + down_write(&serio_bus.subsys.rwsem); + device_release_driver(&serio->dev); + up_write(&serio_bus.subsys.rwsem); + put_driver(&drv->driver); + } + + if (serio->parent) { + spin_lock_irqsave(&serio->parent->lock, flags); + serio->parent->child = NULL; + spin_unlock_irqrestore(&serio->parent->lock, flags); + } + + device_unregister(&serio->dev); +} + +/* + * serio_connect_port() tries to bind the port and possible all its + * children to appropriate drivers. If driver passed in the function will not + * try otehr drivers when binding parent port. + */ +static void serio_connect_port(struct serio *serio, struct serio_driver *drv) +{ + WARN_ON(serio->drv); + WARN_ON(serio->child); + + if (drv) + serio_bind_driver(serio, drv); + else if (!serio->manual_bind) + serio_find_driver(serio); + + /* Ok, now bind children, if any */ + while (serio->child) { + serio = serio->child; + + WARN_ON(serio->drv); + WARN_ON(serio->child); + + serio_create_port(serio); + + if (!serio->manual_bind) { + /* + * With children we just _prefer_ passed in driver, + * but we will try other options in case preferred + * is not the one + */ + if (!drv || !serio_bind_driver(serio, drv)) + serio_find_driver(serio); } } - return ret; +} + +/* + * + */ +static void serio_reconnect_port(struct serio *serio) +{ + do { + if (!serio->drv || !serio->drv->reconnect || serio->drv->reconnect(serio)) { + serio_disconnect_port(serio); + serio_connect_port(serio, NULL); + /* Ok, old children are now gone, we are done */ + break; + } + serio = serio->child; + } while (serio); +} + +/* + * serio_disconnect_port() unbinds a port from its driver. As a side effect + * all child ports are unbound and destroyed. + */ +static void serio_disconnect_port(struct serio *serio) +{ + struct serio_driver *drv = serio->drv; + struct serio *s; + + if (serio->child) { + /* + * Children ports should be disconnected and destroyed + * first, staring with the leaf one, since we don't want + * to do recursion + */ + do { + s = serio->child; + } while (s->child); + + while (s != serio) { + s = s->parent; + serio_destroy_port(s->child); + } + } + + /* + * Ok, no children left, now disconnect this port + */ + if (drv) { + drv->disconnect(serio); + down_write(&serio_bus.subsys.rwsem); + device_release_driver(&serio->dev); + up_write(&serio_bus.subsys.rwsem); + put_driver(&drv->driver); + } +} + +void serio_rescan(struct serio *serio) +{ + serio_queue_event(serio, SERIO_RESCAN); +} + +void serio_reconnect(struct serio *serio) +{ + serio_queue_event(serio, SERIO_RECONNECT); } void serio_register_port(struct serio *serio) { down(&serio_sem); - __serio_register_port(serio); + serio_create_port(serio); + serio_connect_port(serio, NULL); up(&serio_sem); } @@ -222,21 +481,11 @@ serio_queue_event(serio, SERIO_REGISTER_PORT); } -/* - * Should only be called directly if serio_sem has already been taken, - * for example when unregistering a serio from other input device's - * connect() function. - */ -void __serio_register_port(struct serio *serio) -{ - list_add_tail(&serio->node, &serio_list); - serio_find_dev(serio); -} - void serio_unregister_port(struct serio *serio) { down(&serio_sem); - __serio_unregister_port(serio); + serio_disconnect_port(serio); + serio_destroy_port(serio); up(&serio_sem); } @@ -250,82 +499,171 @@ serio_queue_event(serio, SERIO_UNREGISTER_PORT); } + /* - * Should only be called directly if serio_sem has already been taken, - * for example when unregistering a serio from other input device's - * disconnect() function. + * Serio driver operations */ -void __serio_unregister_port(struct serio *serio) + +static ssize_t serio_driver_show_description(struct device_driver *drv, char *buf) { - serio_invalidate_pending_events(serio); - list_del_init(&serio->node); - if (serio->dev && serio->dev->disconnect) - serio->dev->disconnect(serio); + struct serio_driver *driver = to_serio_driver(drv); + return sprintf(buf, "%s\n", driver->description ? driver->description : "(none)"); +} + +static ssize_t serio_driver_show_bind_mode(struct device_driver *drv, char *buf) +{ + struct serio_driver *serio_drv = to_serio_driver(drv); + return sprintf(buf, "%s\n", serio_drv->manual_bind ? "manual" : "auto"); } -void serio_register_device(struct serio_dev *dev) +static ssize_t serio_driver_set_bind_mode(struct device_driver *drv, const char *buf, size_t count) +{ + struct serio_driver *serio_drv = to_serio_driver(drv); + int retval; + + retval = count; + if (!strncmp(buf, "manual", count)) { + serio_drv->manual_bind = 1; + } else if (!strncmp(buf, "auto", count)) { + serio_drv->manual_bind = 0; + } else { + retval = -EINVAL; + } + + return retval; +} + + +static struct driver_attribute serio_driver_attrs[] = { + __ATTR(description, S_IRUGO, serio_driver_show_description, NULL), + __ATTR(bind_mode, S_IWUSR | S_IRUGO, + serio_driver_show_bind_mode, serio_driver_set_bind_mode), + __ATTR_NULL +}; + +void serio_register_driver(struct serio_driver *drv) { struct serio *serio; + down(&serio_sem); - list_add_tail(&dev->node, &serio_dev_list); - list_for_each_entry(serio, &serio_list, node) - if (!serio->dev && dev->connect) - dev->connect(serio, dev); + + list_add_tail(&drv->node, &serio_driver_list); + + drv->driver.bus = &serio_bus; + driver_register(&drv->driver); + + if (drv->manual_bind) + goto out; + +start_over: + list_for_each_entry(serio, &serio_list, node) { + if (!serio->drv) { + serio_connect_port(serio, drv); + /* + * if new child appeared then the list is changed, + * we need to start over + */ + if (serio->child) + goto start_over; + } + } + +out: up(&serio_sem); } -void serio_unregister_device(struct serio_dev *dev) +void serio_unregister_driver(struct serio_driver *drv) { struct serio *serio; down(&serio_sem); - list_del_init(&dev->node); + list_del_init(&drv->node); + +start_over: list_for_each_entry(serio, &serio_list, node) { - if (serio->dev == dev && dev->disconnect) - dev->disconnect(serio); - serio_find_dev(serio); + if (serio->drv == drv) { + serio_disconnect_port(serio); + serio_connect_port(serio, NULL); + /* we could've deleted some ports, restart */ + goto start_over; + } } + + driver_unregister(&drv->driver); + up(&serio_sem); } -/* called from serio_dev->connect/disconnect methods under serio_sem */ -int serio_open(struct serio *serio, struct serio_dev *dev) +/* called from serio_driver->connect/disconnect methods under serio_sem */ +int serio_open(struct serio *serio, struct serio_driver *drv) { - serio->dev = dev; + serio_pause_rx(serio); + serio->drv = drv; + serio_continue_rx(serio); + if (serio->open && serio->open(serio)) { - serio->dev = NULL; + serio_pause_rx(serio); + serio->drv = NULL; + serio_continue_rx(serio); return -1; } return 0; } -/* called from serio_dev->connect/disconnect methods under serio_sem */ +/* called from serio_driver->connect/disconnect methods under serio_sem */ void serio_close(struct serio *serio) { if (serio->close) serio->close(serio); - serio->dev = NULL; + + serio_pause_rx(serio); + serio->drv = NULL; + serio_continue_rx(serio); } -static int __init serio_init(void) +irqreturn_t serio_interrupt(struct serio *serio, + unsigned char data, unsigned int dfl, struct pt_regs *regs) { - int pid; + unsigned long flags; + irqreturn_t ret = IRQ_NONE; + + spin_lock_irqsave(&serio->lock, flags); + + if (likely(serio->drv)) { + ret = serio->drv->interrupt(serio, data, dfl, regs); + } else { + if (!dfl) { + if ((serio->type != SERIO_8042 && + serio->type != SERIO_8042_XL) || (data == 0xaa)) { + serio_rescan(serio); + ret = IRQ_HANDLED; + } + } + } + + spin_unlock_irqrestore(&serio->lock, flags); - pid = kernel_thread(serio_thread, NULL, CLONE_KERNEL); + return ret; +} - if (!pid) { +static int __init serio_init(void) +{ + if (!(serio_pid = kernel_thread(serio_thread, NULL, CLONE_KERNEL))) { printk(KERN_WARNING "serio: Failed to start kseriod\n"); return -1; } - serio_pid = pid; + serio_bus.dev_attrs = serio_device_attrs; + serio_bus.drv_attrs = serio_driver_attrs; + bus_register(&serio_bus); return 0; } static void __exit serio_exit(void) { + bus_unregister(&serio_bus); kill_proc(serio_pid, SIGTERM, 1); wait_for_completion(&serio_exited); } diff -Nru a/drivers/input/serio/serio_raw.c b/drivers/input/serio/serio_raw.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/input/serio/serio_raw.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,390 @@ +/* + * Raw serio device providing access to a raw byte stream from underlying + * serio port. Closely emulates behavior of pre-2.6 /dev/psaux device + * + * 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 + * the Free Software Foundation. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DRIVER_DESC "Raw serio driver" + +MODULE_AUTHOR("Dmitry Torokhov "); +MODULE_DESCRIPTION(DRIVER_DESC); +MODULE_LICENSE("GPL"); + +#define SERIO_RAW_QUEUE_LEN 64 +struct serio_raw { + unsigned char queue[SERIO_RAW_QUEUE_LEN]; + unsigned int tail, head; + + char name[16]; + unsigned int refcnt; + struct serio *serio; + struct miscdevice dev; + wait_queue_head_t wait; + struct list_head list; + struct list_head node; +}; + +struct serio_raw_list { + struct fasync_struct *fasync; + struct serio_raw *serio_raw; + struct list_head node; +}; + +static DECLARE_MUTEX(serio_raw_sem); +static LIST_HEAD(serio_raw_list); +static unsigned int serio_raw_no; + +/********************************************************************* + * Interface with userspace (file operations) * + *********************************************************************/ + +static int serio_raw_fasync(int fd, struct file *file, int on) +{ + struct serio_raw_list *list = file->private_data; + int retval; + + retval = fasync_helper(fd, file, on, &list->fasync); + return retval < 0 ? retval : 0; +} + +static struct serio_raw *serio_raw_locate(int minor) +{ + struct serio_raw *serio_raw; + + list_for_each_entry(serio_raw, &serio_raw_list, node) { + if (serio_raw->dev.minor == minor) + return serio_raw; + } + + return NULL; +} + +static int serio_raw_open(struct inode *inode, struct file *file) +{ + struct serio_raw *serio_raw; + struct serio_raw_list *list; + int retval = 0; + + retval = down_interruptible(&serio_raw_sem); + if (retval) + return retval; + + if (!(serio_raw = serio_raw_locate(iminor(inode)))) { + retval = -ENODEV; + goto out; + } + + if (!serio_raw->serio) { + retval = -ENODEV; + goto out; + } + + if (!(list = kmalloc(sizeof(struct serio_raw_list), GFP_KERNEL))) { + retval = -ENOMEM; + goto out; + } + + memset(list, 0, sizeof(struct serio_raw_list)); + list->serio_raw = serio_raw; + file->private_data = list; + + serio_raw->refcnt++; + list_add_tail(&list->node, &serio_raw->list); + +out: + up(&serio_raw_sem); + return retval; +} + +static int serio_raw_cleanup(struct serio_raw *serio_raw) +{ + if (--serio_raw->refcnt == 0) { + misc_deregister(&serio_raw->dev); + list_del_init(&serio_raw->node); + kfree(serio_raw); + + return 1; + } + + return 0; +} + +static int serio_raw_release(struct inode *inode, struct file *file) +{ + struct serio_raw_list *list = file->private_data; + struct serio_raw *serio_raw = list->serio_raw; + + down(&serio_raw_sem); + + serio_raw_fasync(-1, file, 0); + serio_raw_cleanup(serio_raw); + + up(&serio_raw_sem); + return 0; +} + +static int serio_raw_fetch_byte(struct serio_raw *serio_raw, char *c) +{ + unsigned long flags; + int empty; + + spin_lock_irqsave(&serio_raw->serio->lock, flags); + + empty = serio_raw->head == serio_raw->tail; + if (!empty) { + *c = serio_raw->queue[serio_raw->tail]; + serio_raw->tail = (serio_raw->tail + 1) % SERIO_RAW_QUEUE_LEN; + } + + spin_unlock_irqrestore(&serio_raw->serio->lock, flags); + + return !empty; +} + +static ssize_t serio_raw_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) +{ + struct serio_raw_list *list = file->private_data; + struct serio_raw *serio_raw = list->serio_raw; + char c; + ssize_t retval = 0; + + if (!serio_raw->serio) + return -ENODEV; + + if (serio_raw->head == serio_raw->tail && (file->f_flags & O_NONBLOCK)) + return -EAGAIN; + + retval = wait_event_interruptible(list->serio_raw->wait, + serio_raw->head != serio_raw->tail || !serio_raw->serio); + if (retval) + return retval; + + if (!serio_raw->serio) + return -ENODEV; + + while (retval < count && serio_raw_fetch_byte(serio_raw, &c)) { + if (put_user(c, buffer++)) + return -EFAULT; + retval++; + } + + return retval; +} + +static ssize_t serio_raw_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) +{ + struct serio_raw_list *list = file->private_data; + ssize_t written = 0; + int retval; + unsigned char c; + + retval = down_interruptible(&serio_raw_sem); + if (retval) + return retval; + + if (!list->serio_raw->serio) { + retval = -ENODEV; + goto out; + } + + if (count > 32) + count = 32; + + while (count--) { + if (get_user(c, buffer++)) { + retval = -EFAULT; + goto out; + } + if (serio_write(list->serio_raw->serio, c)) { + retval = -EIO; + goto out; + } + written++; + }; + +out: + up(&serio_raw_sem); + return written; +} + +static unsigned int serio_raw_poll(struct file *file, poll_table *wait) +{ + struct serio_raw_list *list = file->private_data; + + poll_wait(file, &list->serio_raw->wait, wait); + + if (list->serio_raw->head != list->serio_raw->tail) + return POLLIN | POLLRDNORM; + + return 0; +} + +struct file_operations serio_raw_fops = { + .owner = THIS_MODULE, + .open = serio_raw_open, + .release = serio_raw_release, + .read = serio_raw_read, + .write = serio_raw_write, + .poll = serio_raw_poll, + .fasync = serio_raw_fasync, +}; + + +/********************************************************************* + * Interface with serio port * + *********************************************************************/ + +static irqreturn_t serio_raw_interrupt(struct serio *serio, unsigned char data, + unsigned int dfl, struct pt_regs *regs) +{ + struct serio_raw *serio_raw = serio->private; + struct serio_raw_list *list; + unsigned int head = serio_raw->head; + + /* we are holding serio->lock here so we are prootected */ + serio_raw->queue[head] = data; + head = (head + 1) % SERIO_RAW_QUEUE_LEN; + if (likely(head != serio_raw->tail)) { + serio_raw->head = head; + list_for_each_entry(list, &serio_raw->list, node) + kill_fasync(&list->fasync, SIGIO, POLL_IN); + wake_up_interruptible(&serio_raw->wait); + } + + return IRQ_HANDLED; +} + +static void serio_raw_connect(struct serio *serio, struct serio_driver *drv) +{ + struct serio_raw *serio_raw; + int err; + + if ((serio->type & SERIO_TYPE) != SERIO_8042) + return; + + if (!(serio_raw = kmalloc(sizeof(struct serio_raw), GFP_KERNEL))) { + printk(KERN_ERR "serio_raw.c: can't allocate memory for a device\n"); + return; + } + + down(&serio_raw_sem); + + memset(serio_raw, 0, sizeof(struct serio_raw)); + snprintf(serio_raw->name, sizeof(serio_raw->name), "serio_raw%d", serio_raw_no++); + serio_raw->refcnt = 1; + serio_raw->serio = serio; + INIT_LIST_HEAD(&serio_raw->list); + init_waitqueue_head(&serio_raw->wait); + + serio->private = serio_raw; + if (serio_open(serio, drv)) + goto out_free; + + list_add_tail(&serio_raw->node, &serio_raw_list); + + serio_raw->dev.minor = PSMOUSE_MINOR; + serio_raw->dev.name = serio_raw->name; + serio_raw->dev.fops = &serio_raw_fops; + + err = misc_register(&serio_raw->dev); + if (err) { + serio_raw->dev.minor = MISC_DYNAMIC_MINOR; + err = misc_register(&serio_raw->dev); + } + + if (err) { + printk(KERN_INFO "serio_raw: failed to register raw access device for %s\n", + serio->phys); + goto out_close; + } + + printk(KERN_INFO "serio_raw: raw access enabled on %s (%s, minor %d)\n", + serio->phys, serio_raw->name, serio_raw->dev.minor); + goto out; + +out_close: + serio_close(serio); + list_del_init(&serio_raw->node); +out_free: + serio->private = NULL; + kfree(serio_raw); +out: + up(&serio_raw_sem); +} + +static int serio_raw_reconnect(struct serio *serio) +{ + struct serio_raw *serio_raw = serio->private; + struct serio_driver *drv = serio->drv; + + if (!drv || !serio_raw) { + printk(KERN_DEBUG "serio_raw: reconnect request, but serio is disconnected, ignoring...\n"); + return -1; + } + + /* + * Nothing needs to be done here, we just need this method to + * keep the same device. + */ + return 0; +} + +static void serio_raw_disconnect(struct serio *serio) +{ + struct serio_raw *serio_raw; + + down(&serio_raw_sem); + + serio_raw = serio->private; + + serio_close(serio); + serio->private = NULL; + + serio_raw->serio = NULL; + if (!serio_raw_cleanup(serio_raw)) + wake_up_interruptible(&serio_raw->wait); + + up(&serio_raw_sem); +} + +static struct serio_driver serio_raw_drv = { + .driver = { + .name = "serio_raw", + }, + .description = DRIVER_DESC, + .interrupt = serio_raw_interrupt, + .connect = serio_raw_connect, + .reconnect = serio_raw_reconnect, + .disconnect = serio_raw_disconnect, + .manual_bind = 1, +}; + +int __init serio_raw_init(void) +{ + serio_register_driver(&serio_raw_drv); + return 0; +} + +void __exit serio_raw_exit(void) +{ + serio_unregister_driver(&serio_raw_drv); +} + +module_init(serio_raw_init); +module_exit(serio_raw_exit); diff -Nru a/drivers/input/serio/serport.c b/drivers/input/serio/serport.c --- a/drivers/input/serio/serport.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/input/serio/serport.c 2004-09-26 10:25:57 -07:00 @@ -31,28 +31,25 @@ struct serport { struct tty_struct *tty; wait_queue_head_t wait; - struct serio serio; + struct serio *serio; unsigned long flags; - char phys[32]; }; -char serport_name[] = "Serial port"; - /* * Callback functions from the serio code. */ static int serport_serio_write(struct serio *serio, unsigned char data) { - struct serport *serport = serio->driver; + struct serport *serport = serio->port_data; return -(serport->tty->driver->write(serport->tty, 0, &data, 1) != 1); } static void serport_serio_close(struct serio *serio) { - struct serport *serport = serio->driver; + struct serport *serport = serio->port_data; - serport->serio.type = 0; + serport->serio->type = 0; wake_up_interruptible(&serport->wait); } @@ -64,26 +61,30 @@ static int serport_ldisc_open(struct tty_struct *tty) { struct serport *serport; + struct serio *serio; char name[64]; serport = kmalloc(sizeof(struct serport), GFP_KERNEL); - if (unlikely(!serport)) + serio = kmalloc(sizeof(struct serio), GFP_KERNEL); + if (unlikely(!serport || !serio)) { + kfree(serport); + kfree(serio); return -ENOMEM; - memset(serport, 0, sizeof(struct serport)); + } + memset(serport, 0, sizeof(struct serport)); + serport->serio = serio; set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); serport->tty = tty; tty->disc_data = serport; - snprintf(serport->phys, sizeof(serport->phys), "%s/serio0", tty_name(tty, name)); - - serport->serio.name = serport_name; - serport->serio.phys = serport->phys; - - serport->serio.type = SERIO_RS232; - serport->serio.write = serport_serio_write; - serport->serio.close = serport_serio_close; - serport->serio.driver = serport; + memset(serio, 0, sizeof(struct serio)); + strlcpy(serio->name, "Serial port", sizeof(serio->name)); + snprintf(serio->phys, sizeof(serio->phys), "%s/serio0", tty_name(tty, name)); + serio->type = SERIO_RS232; + serio->write = serport_serio_write; + serio->close = serport_serio_close; + serio->port_data = serport; init_waitqueue_head(&serport->wait); @@ -114,7 +115,7 @@ struct serport *serport = (struct serport*) tty->disc_data; int i; for (i = 0; i < count; i++) - serio_interrupt(&serport->serio, cp[i], 0, NULL); + serio_interrupt(serport->serio, cp[i], 0, NULL); } /* @@ -142,10 +143,10 @@ if (test_and_set_bit(SERPORT_BUSY, &serport->flags)) return -EBUSY; - serio_register_port(&serport->serio); + serio_register_port(serport->serio); printk(KERN_INFO "serio: Serial port %s\n", tty_name(tty, name)); - wait_event_interruptible(serport->wait, !serport->serio.type); - serio_unregister_port(&serport->serio); + wait_event_interruptible(serport->wait, !serport->serio->type); + serio_unregister_port(serport->serio); clear_bit(SERPORT_BUSY, &serport->flags); @@ -161,7 +162,7 @@ struct serport *serport = (struct serport*) tty->disc_data; if (cmd == SPIOCSTYPE) - return get_user(serport->serio.type, (unsigned long __user *) arg); + return get_user(serport->serio->type, (unsigned long __user *) arg); return -EINVAL; } @@ -170,7 +171,7 @@ { struct serport *sp = (struct serport *) tty->disc_data; - serio_dev_write_wakeup(&sp->serio); + serio_drv_write_wakeup(sp->serio); } /* diff -Nru a/drivers/input/touchscreen/gunze.c b/drivers/input/touchscreen/gunze.c --- a/drivers/input/touchscreen/gunze.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/input/touchscreen/gunze.c 2004-09-26 10:25:56 -07:00 @@ -36,8 +36,10 @@ #include #include +#define DRIVER_DESC "Gunze AHL-51S touchscreen driver" + MODULE_AUTHOR("Vojtech Pavlik "); -MODULE_DESCRIPTION("Gunze AHL-51S touchscreen driver"); +MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); /* @@ -111,7 +113,7 @@ * and if yes, registers it as an input device. */ -static void gunze_connect(struct serio *serio, struct serio_dev *dev) +static void gunze_connect(struct serio *serio, struct serio_driver *drv) { struct gunze *gunze; @@ -142,7 +144,7 @@ gunze->dev.id.product = 0x0051; gunze->dev.id.version = 0x0100; - if (serio_open(serio, dev)) { + if (serio_open(serio, drv)) { kfree(gunze); return; } @@ -156,10 +158,14 @@ * The serio device structure. */ -static struct serio_dev gunze_dev = { - .interrupt = gunze_interrupt, - .connect = gunze_connect, - .disconnect = gunze_disconnect, +static struct serio_driver gunze_drv = { + .driver = { + .name = "gunze", + }, + .description = DRIVER_DESC, + .interrupt = gunze_interrupt, + .connect = gunze_connect, + .disconnect = gunze_disconnect, }; /* @@ -168,13 +174,13 @@ int __init gunze_init(void) { - serio_register_device(&gunze_dev); + serio_register_driver(&gunze_drv); return 0; } void __exit gunze_exit(void) { - serio_unregister_device(&gunze_dev); + serio_unregister_driver(&gunze_drv); } module_init(gunze_init); diff -Nru a/drivers/input/touchscreen/h3600_ts_input.c b/drivers/input/touchscreen/h3600_ts_input.c --- a/drivers/input/touchscreen/h3600_ts_input.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/input/touchscreen/h3600_ts_input.c 2004-09-26 10:25:57 -07:00 @@ -45,8 +45,10 @@ #include #include +#define DRIVER_DESC "H3600 touchscreen driver" + MODULE_AUTHOR("James Simmons "); -MODULE_DESCRIPTION("H3600 touchscreen driver"); +MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); /* @@ -373,7 +375,7 @@ * new serio device. It looks whether it was registered as a H3600 touchscreen * and if yes, registers it as an input device. */ -static void h3600ts_connect(struct serio *serio, struct serio_dev *dev) +static void h3600ts_connect(struct serio *serio, struct serio_driver *drv) { struct h3600_dev *ts; @@ -441,7 +443,7 @@ ts->dev.id.product = 0x0666; /* FIXME !!! We can ask the hardware */ ts->dev.id.version = 0x0100; - if (serio_open(serio, dev)) { + if (serio_open(serio, drv)) { free_irq(IRQ_GPIO_BITSY_ACTION_BUTTON, ts); free_irq(IRQ_GPIO_BITSY_NPOWER_BUTTON, ts); kfree(ts); @@ -478,10 +480,14 @@ * The serio device structure. */ -static struct serio_dev h3600ts_dev = { - .interrupt = h3600ts_interrupt, - .connect = h3600ts_connect, - .disconnect = h3600ts_disconnect, +static struct serio_driver h3600ts_drv = { + .driver = { + .name = "h3600ts", + }, + .description = DRIVER_DESC, + .interrupt = h3600ts_interrupt, + .connect = h3600ts_connect, + .disconnect = h3600ts_disconnect, }; /* @@ -490,13 +496,13 @@ static int __init h3600ts_init(void) { - serio_register_device(&h3600ts_dev); + serio_register_driver(&h3600ts_drv); return 0; } static void __exit h3600ts_exit(void) { - serio_unregister_device(&h3600ts_dev); + serio_unregister_driver(&h3600ts_drv); } module_init(h3600ts_init); diff -Nru a/drivers/input/tsdev.c b/drivers/input/tsdev.c --- a/drivers/input/tsdev.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/input/tsdev.c 2004-09-26 10:25:57 -07:00 @@ -3,32 +3,42 @@ * * Copyright (c) 2001 "Crazy" james Simmons * - * Input driver to Touchscreen device driver module. + * Compaq touchscreen protocol driver. The protocol emulated by this driver + * is obsolete; for new programs use the tslib library which can read directly + * from evdev and perform dejittering, variance filtering and calibration - + * all in user space, not at kernel level. The meaning of this driver is + * to allow usage of newer input drivers with old applications that use the + * old /dev/h3600_ts and /dev/h3600_tsraw devices. * - * Sponsored by Transvirtual Technology + * 09-Apr-2004: Andrew Zabolotny + * Fixed to actually work, not just output random numbers. + * Added support for both h3600_ts and h3600_tsraw protocol + * emulation. */ /* * 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 . + * e-mail - mail your message to . */ #define TSDEV_MINOR_BASE 128 #define TSDEV_MINORS 32 +/* First 16 devices are h3600_ts compatible; second 16 are h3600_tsraw */ +#define TSDEV_MINOR_MASK 15 #define TSDEV_BUFFER_SIZE 64 #include @@ -52,48 +62,84 @@ #define CONFIG_INPUT_TSDEV_SCREEN_Y 320 #endif +/* This driver emulates both protocols of the old h3600_ts and h3600_tsraw + * devices. The first one must output X/Y data in 'cooked' format, e.g. + * filtered, dejittered and calibrated. Second device just outputs raw + * data received from the hardware. + * + * This driver doesn't support filtering and dejittering; it supports only + * calibration. Filtering and dejittering must be done in the low-level + * driver, if needed, because it may gain additional benefits from knowing + * the low-level details, the nature of noise and so on. + * + * The driver precomputes a calibration matrix given the initial xres and + * yres values (quite innacurate for most touchscreens) that will result + * in a more or less expected range of output values. The driver supports + * the TS_SET_CAL ioctl, which will replace the calibration matrix with a + * new one, supposedly generated from the values taken from the raw device. + */ + MODULE_AUTHOR("James Simmons "); MODULE_DESCRIPTION("Input driver to touchscreen converter"); MODULE_LICENSE("GPL"); static int xres = CONFIG_INPUT_TSDEV_SCREEN_X; module_param(xres, uint, 0); -MODULE_PARM_DESC(xres, "Horizontal screen resolution"); +MODULE_PARM_DESC(xres, "Horizontal screen resolution (can be negative for X-mirror)"); static int yres = CONFIG_INPUT_TSDEV_SCREEN_Y; module_param(yres, uint, 0); -MODULE_PARM_DESC(yres, "Vertical screen resolution"); +MODULE_PARM_DESC(yres, "Vertical screen resolution (can be negative for Y-mirror)"); + +/* From Compaq's Touch Screen Specification version 0.2 (draft) */ +struct ts_event { + short pressure; + short x; + short y; + short millisecs; +}; + +struct ts_calibration { + int xscale; + int xtrans; + int yscale; + int ytrans; + int xyswap; +}; struct tsdev { int exist; int open; int minor; - char name[16]; + char name[8]; wait_queue_head_t wait; struct list_head list; struct input_handle handle; + int x, y, pressure; + struct ts_calibration cal; }; -/* From Compaq's Touch Screen Specification version 0.2 (draft) */ -typedef struct { - short pressure; - short x; - short y; - short millisecs; -} TS_EVENT; - struct tsdev_list { struct fasync_struct *fasync; struct list_head node; struct tsdev *tsdev; int head, tail; - int oldx, oldy, pendown; - TS_EVENT event[TSDEV_BUFFER_SIZE]; + struct ts_event event[TSDEV_BUFFER_SIZE]; + int raw; }; +/* The following ioctl codes are defined ONLY for backward compatibility. + * Don't use tsdev for new developement; use the tslib library instead. + * Touchscreen calibration is a fully userspace task. + */ +/* Use 'f' as magic number */ +#define IOC_H3600_TS_MAGIC 'f' +#define TS_GET_CAL _IOR(IOC_H3600_TS_MAGIC, 10, struct ts_calibration) +#define TS_SET_CAL _IOW(IOC_H3600_TS_MAGIC, 11, struct ts_calibration) + static struct input_handler tsdev_handler; -static struct tsdev *tsdev_table[TSDEV_MINORS]; +static struct tsdev *tsdev_table[TSDEV_MINORS/2]; static int tsdev_fasync(int fd, struct file *file, int on) { @@ -109,13 +155,16 @@ int i = iminor(inode) - TSDEV_MINOR_BASE; struct tsdev_list *list; - if (i >= TSDEV_MINORS || !tsdev_table[i]) + if (i >= TSDEV_MINORS || !tsdev_table[i & TSDEV_MINOR_MASK]) return -ENODEV; if (!(list = kmalloc(sizeof(struct tsdev_list), GFP_KERNEL))) return -ENOMEM; memset(list, 0, sizeof(struct tsdev_list)); + list->raw = (i >= TSDEV_MINORS/2) ? 1 : 0; + + i &= TSDEV_MINOR_MASK; list->tsdev = tsdev_table[i]; list_add_tail(&list->node, &tsdev_table[i]->list); file->private_data = list; @@ -161,7 +210,7 @@ return -EAGAIN; retval = wait_event_interruptible(list->tsdev->wait, - (list->head != list->tail) && list->tsdev->exist); + list->head != list->tail || !list->tsdev->exist); if (retval) return retval; @@ -169,11 +218,13 @@ if (!list->tsdev->exist) return -ENODEV; - while (list->head != list->tail && retval + sizeof(TS_EVENT) <= count) { - if (copy_to_user (buffer + retval, list->event + list->tail, sizeof(TS_EVENT))) + while (list->head != list->tail && + retval + sizeof (struct ts_event) <= count) { + if (copy_to_user (buffer + retval, list->event + list->tail, + sizeof (struct ts_event))) return -EFAULT; list->tail = (list->tail + 1) & (TSDEV_BUFFER_SIZE - 1); - retval += sizeof(TS_EVENT); + retval += sizeof (struct ts_event); } return retval; @@ -193,22 +244,27 @@ static int tsdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { -/* struct tsdev_list *list = file->private_data; - struct tsdev *evdev = list->tsdev; - struct input_dev *dev = tsdev->handle.dev; - int retval; - + struct tsdev *tsdev = list->tsdev; + int retval = 0; + switch (cmd) { - case HHEHE: - return 0; - case hjff: - return 0; - default: - return 0; + case TS_GET_CAL: + if (copy_to_user ((void __user *)arg, &tsdev->cal, + sizeof (struct ts_calibration))) + retval = -EFAULT; + break; + case TS_SET_CAL: + if (copy_from_user (&tsdev->cal, (void __user *)arg, + sizeof (struct ts_calibration))) + retval = -EFAULT; + break; + default: + retval = -EINVAL; + break; } -*/ - return -EINVAL; + + return retval; } struct file_operations tsdev_fops = { @@ -227,82 +283,85 @@ struct tsdev *tsdev = handle->private; struct tsdev_list *list; struct timeval time; - int size; - list_for_each_entry(list, &tsdev->list, node) { - switch (type) { - case EV_ABS: - switch (code) { - case ABS_X: - if (!list->pendown) - return; - size = handle->dev->absmax[ABS_X] - handle->dev->absmin[ABS_X]; - if (size > 0) - list->oldx = ((value - handle->dev->absmin[ABS_X]) * xres / size); - else - list->oldx = ((value - handle->dev->absmin[ABS_X])); - break; - case ABS_Y: - if (!list->pendown) - return; - size = handle->dev->absmax[ABS_Y] - handle->dev->absmin[ABS_Y]; - if (size > 0) - list->oldy = ((value - handle->dev->absmin[ABS_Y]) * yres / size); - else - list->oldy = ((value - handle->dev->absmin[ABS_Y])); - break; - case ABS_PRESSURE: - list->pendown = ((value > handle->dev-> absmin[ABS_PRESSURE])) ? - value - handle->dev->absmin[ABS_PRESSURE] : 0; - break; - } + switch (type) { + case EV_ABS: + switch (code) { + case ABS_X: + tsdev->x = value; + break; + case ABS_Y: + tsdev->y = value; break; + case ABS_PRESSURE: + if (value > handle->dev->absmax[ABS_PRESSURE]) + value = handle->dev->absmax[ABS_PRESSURE]; + value -= handle->dev->absmin[ABS_PRESSURE]; + if (value < 0) + value = 0; + tsdev->pressure = value; + break; + } + break; - case EV_REL: - switch (code) { - case REL_X: - if (!list->pendown) - return; - list->oldx += value; - if (list->oldx < 0) - list->oldx = 0; - else if (list->oldx > xres) - list->oldx = xres; + case EV_REL: + switch (code) { + case REL_X: + tsdev->x += value; + if (tsdev->x < 0) + tsdev->x = 0; + else if (tsdev->x > xres) + tsdev->x = xres; + break; + case REL_Y: + tsdev->y += value; + if (tsdev->y < 0) + tsdev->y = 0; + else if (tsdev->y > yres) + tsdev->y = yres; + break; + } + break; + + case EV_KEY: + if (code == BTN_TOUCH || code == BTN_MOUSE) { + switch (value) { + case 0: + tsdev->pressure = 0; break; - case REL_Y: - if (!list->pendown) - return; - list->oldy += value; - if (list->oldy < 0) - list->oldy = 0; - else if (list->oldy > xres) - list->oldy = xres; + case 1: + if (!tsdev->pressure) + tsdev->pressure = 1; break; } - break; - - case EV_KEY: - if (code == BTN_TOUCH || code == BTN_MOUSE) { - switch (value) { - case 0: - list->pendown = 0; - break; - case 1: - if (!list->pendown) - list->pendown = 1; - break; - case 2: - return; - } - } else - return; - break; } + break; + } + + if (type != EV_SYN || code != SYN_REPORT) + return; + + list_for_each_entry(list, &tsdev->list, node) { + int x, y, tmp; + do_gettimeofday(&time); list->event[list->head].millisecs = time.tv_usec / 100; - list->event[list->head].pressure = list->pendown; - list->event[list->head].x = list->oldx; - list->event[list->head].y = list->oldy; + list->event[list->head].pressure = tsdev->pressure; + + x = tsdev->x; + y = tsdev->y; + + /* Calibration */ + if (!list->raw) { + x = ((x * tsdev->cal.xscale) >> 8) + tsdev->cal.xtrans; + y = ((y * tsdev->cal.yscale) >> 8) + tsdev->cal.ytrans; + if (tsdev->cal.xyswap) { + tmp = x; x = y; y = tmp; + } + } + + list->event[list->head].x = x; + list->event[list->head].y = y; list->head = (list->head + 1) & (TSDEV_BUFFER_SIZE - 1); kill_fasync(&list->fasync, SIGIO, POLL_IN); } @@ -314,11 +373,11 @@ struct input_device_id *id) { struct tsdev *tsdev; - int minor; + int minor, delta; - for (minor = 0; minor < TSDEV_MINORS && tsdev_table[minor]; + for (minor = 0; minor < TSDEV_MINORS/2 && tsdev_table[minor]; minor++); - if (minor == TSDEV_MINORS) { + if (minor >= TSDEV_MINORS/2) { printk(KERN_ERR "tsdev: You have way too many touchscreens\n"); return NULL; @@ -340,10 +399,25 @@ tsdev->handle.handler = handler; tsdev->handle.private = tsdev; + /* Precompute the rough calibration matrix */ + delta = dev->absmax [ABS_X] - dev->absmin [ABS_X] + 1; + if (delta == 0) + delta = 1; + tsdev->cal.xscale = (xres << 8) / delta; + tsdev->cal.xtrans = - ((dev->absmin [ABS_X] * tsdev->cal.xscale) >> 8); + + delta = dev->absmax [ABS_Y] - dev->absmin [ABS_Y] + 1; + if (delta == 0) + delta = 1; + tsdev->cal.yscale = (yres << 8) / delta; + tsdev->cal.ytrans = - ((dev->absmin [ABS_Y] * tsdev->cal.yscale) >> 8); + tsdev_table[minor] = tsdev; - + devfs_mk_cdev(MKDEV(INPUT_MAJOR, TSDEV_MINOR_BASE + minor), S_IFCHR|S_IRUGO|S_IWUSR, "input/ts%d", minor); + devfs_mk_cdev(MKDEV(INPUT_MAJOR, TSDEV_MINOR_BASE + minor + TSDEV_MINORS/2), + S_IFCHR|S_IRUGO|S_IWUSR, "input/tsraw%d", minor); class_simple_device_add(input_class, MKDEV(INPUT_MAJOR, TSDEV_MINOR_BASE + minor), dev->dev, "ts%d", minor); @@ -362,6 +436,7 @@ wake_up_interruptible(&tsdev->wait); } else tsdev_free(tsdev); + devfs_remove("input/tsraw%d", tsdev->minor); } static struct input_device_id tsdev_ids[] = { @@ -378,6 +453,12 @@ .keybit = { [LONG(BTN_TOUCH)] = BIT(BTN_TOUCH) }, .absbit = { BIT(ABS_X) | BIT(ABS_Y) }, },/* A tablet like device, at least touch detection, two absolute axes */ + + { + .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_ABSBIT, + .evbit = { BIT(EV_ABS) }, + .absbit = { BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_PRESSURE) }, + },/* A tablet like device with several gradations of pressure */ {},/* Terminating entry */ }; diff -Nru a/drivers/isdn/act2000/act2000_isa.c b/drivers/isdn/act2000/act2000_isa.c --- a/drivers/isdn/act2000/act2000_isa.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/isdn/act2000/act2000_isa.c 2004-09-26 10:25:56 -07:00 @@ -434,7 +434,10 @@ l = (length > 1024) ? 1024 : length; c = 0; b = buf; - copy_from_user(buf, p, l); + if (copy_from_user(buf, p, l)) { + kfree(buf); + return -EFAULT; + } while (c < l) { if (act2000_isa_writeb(card, *b++)) { printk(KERN_WARNING diff -Nru a/drivers/macintosh/adbhid.c b/drivers/macintosh/adbhid.c --- a/drivers/macintosh/adbhid.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/macintosh/adbhid.c 2004-09-26 10:25:57 -07:00 @@ -74,15 +74,135 @@ #define ADB_KEY_POWER_OLD 0x7e #define ADB_KEY_POWER 0x7f -unsigned char adb_to_linux_keycodes[128] = { - 30, 31, 32, 33, 35, 34, 44, 45, 46, 47, 86, 48, 16, 17, 18, 19, - 21, 20, 2, 3, 4, 5, 7, 6, 13, 10, 8, 12, 9, 11, 27, 24, - 22, 26, 23, 25, 28, 38, 36, 40, 37, 39, 43, 51, 53, 49, 50, 52, - 15, 57, 41, 14, 96, 1, 29,125, 42, 58, 56,105,106,108,103, 0, - 0, 83, 0, 55, 0, 78, 0, 69, 0, 0, 0, 98, 96, 0, 74, 0, - 0,117, 82, 79, 80, 81, 75, 76, 77, 71, 0, 72, 73,124, 89,121, - 63, 64, 65, 61, 66, 67,123, 87,122, 99, 0, 70, 0, 68,101, 88, - 0,119,110,102,104,111, 62,107, 60,109, 59, 54,100, 97,126,116 +u8 adb_to_linux_keycodes[128] = { + /* 0x00 */ KEY_A, /* 30 */ + /* 0x01 */ KEY_S, /* 31 */ + /* 0x02 */ KEY_D, /* 32 */ + /* 0x03 */ KEY_F, /* 33 */ + /* 0x04 */ KEY_H, /* 35 */ + /* 0x05 */ KEY_G, /* 34 */ + /* 0x06 */ KEY_Z, /* 44 */ + /* 0x07 */ KEY_X, /* 45 */ + /* 0x08 */ KEY_C, /* 46 */ + /* 0x09 */ KEY_V, /* 47 */ + /* 0x0a */ KEY_102ND, /* 86 */ + /* 0x0b */ KEY_B, /* 48 */ + /* 0x0c */ KEY_Q, /* 16 */ + /* 0x0d */ KEY_W, /* 17 */ + /* 0x0e */ KEY_E, /* 18 */ + /* 0x0f */ KEY_R, /* 19 */ + /* 0x10 */ KEY_Y, /* 21 */ + /* 0x11 */ KEY_T, /* 20 */ + /* 0x12 */ KEY_1, /* 2 */ + /* 0x13 */ KEY_2, /* 3 */ + /* 0x14 */ KEY_3, /* 4 */ + /* 0x15 */ KEY_4, /* 5 */ + /* 0x16 */ KEY_6, /* 7 */ + /* 0x17 */ KEY_5, /* 6 */ + /* 0x18 */ KEY_EQUAL, /* 13 */ + /* 0x19 */ KEY_9, /* 10 */ + /* 0x1a */ KEY_7, /* 8 */ + /* 0x1b */ KEY_MINUS, /* 12 */ + /* 0x1c */ KEY_8, /* 9 */ + /* 0x1d */ KEY_0, /* 11 */ + /* 0x1e */ KEY_RIGHTBRACE, /* 27 */ + /* 0x1f */ KEY_O, /* 24 */ + /* 0x20 */ KEY_U, /* 22 */ + /* 0x21 */ KEY_LEFTBRACE, /* 26 */ + /* 0x22 */ KEY_I, /* 23 */ + /* 0x23 */ KEY_P, /* 25 */ + /* 0x24 */ KEY_ENTER, /* 28 */ + /* 0x25 */ KEY_L, /* 38 */ + /* 0x26 */ KEY_J, /* 36 */ + /* 0x27 */ KEY_APOSTROPHE, /* 40 */ + /* 0x28 */ KEY_K, /* 37 */ + /* 0x29 */ KEY_SEMICOLON, /* 39 */ + /* 0x2a */ KEY_BACKSLASH, /* 43 */ + /* 0x2b */ KEY_COMMA, /* 51 */ + /* 0x2c */ KEY_SLASH, /* 53 */ + /* 0x2d */ KEY_N, /* 49 */ + /* 0x2e */ KEY_M, /* 50 */ + /* 0x2f */ KEY_DOT, /* 52 */ + /* 0x30 */ KEY_TAB, /* 15 */ + /* 0x31 */ KEY_SPACE, /* 57 */ + /* 0x32 */ KEY_GRAVE, /* 41 */ + /* 0x33 */ KEY_BACKSPACE, /* 14 */ + /* 0x34 */ KEY_KPENTER, /* 96 */ + /* 0x35 */ KEY_ESC, /* 1 */ + /* 0x36 */ KEY_LEFTCTRL, /* 29 */ + /* 0x37 */ KEY_LEFTMETA, /* 125 */ + /* 0x38 */ KEY_LEFTSHIFT, /* 42 */ + /* 0x39 */ KEY_CAPSLOCK, /* 58 */ + /* 0x3a */ KEY_LEFTALT, /* 56 */ + /* 0x3b */ KEY_LEFT, /* 105 */ + /* 0x3c */ KEY_RIGHT, /* 106 */ + /* 0x3d */ KEY_DOWN, /* 108 */ + /* 0x3e */ KEY_UP, /* 103 */ + /* 0x3f */ 0, + /* 0x40 */ 0, + /* 0x41 */ KEY_KPDOT, /* 83 */ + /* 0x42 */ 0, + /* 0x43 */ KEY_KPASTERISK, /* 55 */ + /* 0x44 */ 0, + /* 0x45 */ KEY_KPPLUS, /* 78 */ + /* 0x46 */ 0, + /* 0x47 */ KEY_NUMLOCK, /* 69 */ + /* 0x48 */ 0, + /* 0x49 */ 0, + /* 0x4a */ 0, + /* 0x4b */ KEY_KPSLASH, /* 98 */ + /* 0x4c */ KEY_KPENTER, /* 96 */ + /* 0x4d */ 0, + /* 0x4e */ KEY_KPMINUS, /* 74 */ + /* 0x4f */ 0, + /* 0x50 */ 0, + /* 0x51 */ KEY_KPEQUAL, /* 117 */ + /* 0x52 */ KEY_KP0, /* 82 */ + /* 0x53 */ KEY_KP1, /* 79 */ + /* 0x54 */ KEY_KP2, /* 80 */ + /* 0x55 */ KEY_KP3, /* 81 */ + /* 0x56 */ KEY_KP4, /* 75 */ + /* 0x57 */ KEY_KP5, /* 76 */ + /* 0x58 */ KEY_KP6, /* 77 */ + /* 0x59 */ KEY_KP7, /* 71 */ + /* 0x5a */ 0, + /* 0x5b */ KEY_KP8, /* 72 */ + /* 0x5c */ KEY_KP9, /* 73 */ + /* 0x5d */ KEY_YEN, /* 124 */ + /* 0x5e */ KEY_RO, /* 89 */ + /* 0x5f */ KEY_KPCOMMA, /* 121 */ + /* 0x60 */ KEY_F5, /* 63 */ + /* 0x61 */ KEY_F6, /* 64 */ + /* 0x62 */ KEY_F7, /* 65 */ + /* 0x63 */ KEY_F3, /* 61 */ + /* 0x64 */ KEY_F8, /* 66 */ + /* 0x65 */ KEY_F9, /* 67 */ + /* 0x66 */ KEY_HANJA, /* 123 */ + /* 0x67 */ KEY_F11, /* 87 */ + /* 0x68 */ KEY_HANGUEL, /* 122 */ + /* 0x69 */ KEY_SYSRQ, /* 99 */ + /* 0x6a */ 0, + /* 0x6b */ KEY_SCROLLLOCK, /* 70 */ + /* 0x6c */ 0, + /* 0x6d */ KEY_F10, /* 68 */ + /* 0x6e */ KEY_COMPOSE, /* 127 */ + /* 0x6f */ KEY_F12, /* 88 */ + /* 0x70 */ 0, + /* 0x71 */ KEY_PAUSE, /* 119 */ + /* 0x72 */ KEY_INSERT, /* 110 */ + /* 0x73 */ KEY_HOME, /* 102 */ + /* 0x74 */ KEY_PAGEUP, /* 104 */ + /* 0x75 */ KEY_DELETE, /* 111 */ + /* 0x76 */ KEY_F4, /* 62 */ + /* 0x77 */ KEY_END, /* 107 */ + /* 0x78 */ KEY_F2, /* 60 */ + /* 0x79 */ KEY_PAGEDOWN, /* 109 */ + /* 0x7a */ KEY_F1, /* 59 */ + /* 0x7b */ KEY_RIGHTSHIFT, /* 54 */ + /* 0x7c */ KEY_RIGHTALT, /* 100 */ + /* 0x7d */ KEY_RIGHTCTRL, /* 97 */ + /* 0x7e */ KEY_RIGHTMETA, /* 126 */ + /* 0x7f */ KEY_POWER, /* 116 */ }; struct adbhid { @@ -453,7 +573,7 @@ static void leds_done(struct adb_request *req) { - int leds, device; + int leds = 0, device = 0, pending = 0; unsigned long flags; spin_lock_irqsave(&leds_lock, flags); @@ -464,11 +584,11 @@ leds_pending[device] = 0; pending_led_start++; pending_led_start = (pending_led_start < 16) ? pending_led_start : 0; + pending = leds_req_pending; } else leds_req_pending = 0; - spin_unlock_irqrestore(&leds_lock, flags); - if (leds_req_pending) + if (pending) adb_request(&led_request, leds_done, 0, 3, ADB_WRITEREG(device, KEYB_LEDREG), 0xff, ~leds); } diff -Nru a/drivers/macintosh/macserial.c b/drivers/macintosh/macserial.c --- a/drivers/macintosh/macserial.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/macintosh/macserial.c 2004-09-26 10:25:57 -07:00 @@ -2002,8 +2002,7 @@ if (info->blocked_open) { if (info->close_delay) { - current->state = TASK_INTERRUPTIBLE; - schedule_timeout(info->close_delay); + msleep_interruptible(jiffies_to_msecs(info->close_delay)); } wake_up_interruptible(&info->open_wait); } @@ -2048,8 +2047,7 @@ if (timeout) char_time = min_t(unsigned long, char_time, timeout); while ((read_zsreg(info->zs_channel, 1) & ALL_SNT) == 0) { - current->state = TASK_INTERRUPTIBLE; - schedule_timeout(char_time); + msleep_interruptible(jiffies_to_msecs(char_time)); if (signal_pending(current)) break; if (timeout && time_after(jiffies, orig_jiffies + timeout)) diff -Nru a/drivers/macintosh/therm_adt746x.c b/drivers/macintosh/therm_adt746x.c --- a/drivers/macintosh/therm_adt746x.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/macintosh/therm_adt746x.c 2004-09-26 10:25:57 -07:00 @@ -417,11 +417,6 @@ * choice but implement a bunch of them... * */ -#define BUILD_SHOW_FUNC_DEG(name, data) \ -static ssize_t show_##name(struct device *dev, char *buf) \ -{ \ - return sprintf(buf, "%d°C\n", data); \ -} #define BUILD_SHOW_FUNC_INT(name, data) \ static ssize_t show_##name(struct device *dev, char *buf) \ { \ @@ -453,10 +448,10 @@ return n; \ } -BUILD_SHOW_FUNC_DEG(cpu_temperature, (read_reg(thermostat, TEMP_REG[1]))) -BUILD_SHOW_FUNC_DEG(gpu_temperature, (read_reg(thermostat, TEMP_REG[2]))) -BUILD_SHOW_FUNC_DEG(cpu_limit, thermostat->limits[1]) -BUILD_SHOW_FUNC_DEG(gpu_limit, thermostat->limits[2]) +BUILD_SHOW_FUNC_INT(cpu_temperature, (read_reg(thermostat, TEMP_REG[1]))) +BUILD_SHOW_FUNC_INT(gpu_temperature, (read_reg(thermostat, TEMP_REG[2]))) +BUILD_SHOW_FUNC_INT(cpu_limit, thermostat->limits[1]) +BUILD_SHOW_FUNC_INT(gpu_limit, thermostat->limits[2]) BUILD_SHOW_FUNC_INT(specified_fan_speed, fan_speed) BUILD_SHOW_FUNC_INT(cpu_fan_speed, (read_fan_speed(thermostat, FAN_SPEED[0]))) diff -Nru a/drivers/macintosh/therm_windtunnel.c b/drivers/macintosh/therm_windtunnel.c --- a/drivers/macintosh/therm_windtunnel.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/macintosh/therm_windtunnel.c 2004-09-26 10:25:57 -07:00 @@ -292,8 +292,7 @@ while( x.running ) { up( &x.lock ); - set_current_state(TASK_INTERRUPTIBLE); - schedule_timeout( 8*HZ ); + msleep_interruptible(8000); down( &x.lock ); poll_temp(); diff -Nru a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c --- a/drivers/macintosh/via-pmu.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/macintosh/via-pmu.c 2004-09-26 10:25:57 -07:00 @@ -747,6 +747,8 @@ pmu_power_flags &= ~PMU_PWR_AC_PRESENT; + capa = max = amperage = voltage = 0; + if (req->reply[1] & 0x04) { bat_flags |= PMU_BATT_PRESENT; switch(req->reply[0]) { @@ -766,8 +768,7 @@ req->reply_len, req->reply[0], req->reply[1], req->reply[2], req->reply[3]); break; } - } else - capa = max = amperage = voltage = 0; + } if ((req->reply[1] & 0x01) && (amperage > 0)) bat_flags |= PMU_BATT_CHARGING; @@ -1446,7 +1447,7 @@ pmu_sr_intr(struct pt_regs *regs) { struct adb_request *req; - int bite; + int bite = 0; if (via[B] & TREQ) { printk(KERN_ERR "PMU: spurious SR intr (%x)\n", via[B]); diff -Nru a/drivers/md/dm-log.c b/drivers/md/dm-log.c --- a/drivers/md/dm-log.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/md/dm-log.c 2004-09-26 10:25:57 -07:00 @@ -140,6 +140,13 @@ int sync_search; + /* Resync flag */ + enum sync { + DEFAULTSYNC, /* Synchronize if necessary */ + NOSYNC, /* Devices known to be already in sync */ + FORCESYNC, /* Force a sync to happen */ + } sync; + /* * Disk log fields */ @@ -205,7 +212,8 @@ header_from_disk(&log->header, log->disk_header); - if (log->header.magic != MIRROR_MAGIC) { + /* New log required? */ + if (log->sync != DEFAULTSYNC || log->header.magic != MIRROR_MAGIC) { log->header.magic = MIRROR_MAGIC; log->header.version = MIRROR_DISK_VERSION; log->header.nr_regions = 0; @@ -273,22 +281,38 @@ } /*---------------------------------------------------------------- - * constructor/destructor + * core log constructor/destructor + * + * argv contains region_size followed optionally by [no]sync *--------------------------------------------------------------*/ #define BYTE_SHIFT 3 static int core_ctr(struct dirty_log *log, struct dm_target *ti, unsigned int argc, char **argv) { + enum sync sync = DEFAULTSYNC; + struct log_c *lc; sector_t region_size; unsigned int region_count; size_t bitset_size; - if (argc != 1) { - DMWARN("wrong number of arguments to log_c"); + if (argc < 1 || argc > 2) { + DMWARN("wrong number of arguments to mirror log"); return -EINVAL; } + if (argc > 1) { + if (!strcmp(argv[1], "sync")) + sync = FORCESYNC; + else if (!strcmp(argv[1], "nosync")) + sync = NOSYNC; + else { + DMWARN("unrecognised sync argument to mirror log: %s", + argv[1]); + return -EINVAL; + } + } + if (sscanf(argv[0], SECTOR_FORMAT, ®ion_size) != 1) { DMWARN("invalid region size string"); return -EINVAL; @@ -306,6 +330,7 @@ lc->touched = 0; lc->region_size = region_size; lc->region_count = region_count; + lc->sync = sync; /* * Work out how many words we need to hold the bitset. @@ -330,8 +355,8 @@ kfree(lc); return -ENOMEM; } - memset(lc->sync_bits, 0, bitset_size); - lc->sync_count = 0; + memset(lc->sync_bits, (sync == NOSYNC) ? -1 : 0, bitset_size); + lc->sync_count = (sync == NOSYNC) ? region_count : 0; lc->recovering_bits = vmalloc(bitset_size); if (!lc->recovering_bits) { @@ -356,6 +381,11 @@ kfree(lc); } +/*---------------------------------------------------------------- + * disk log constructor/destructor + * + * argv contains log_device region_size followed optionally by [no]sync + *--------------------------------------------------------------*/ static int disk_ctr(struct dirty_log *log, struct dm_target *ti, unsigned int argc, char **argv) { @@ -364,8 +394,8 @@ struct log_c *lc; struct dm_dev *dev; - if (argc != 2) { - DMWARN("wrong number of arguments to log_d"); + if (argc < 2 || argc > 3) { + DMWARN("wrong number of arguments to disk mirror log"); return -EINVAL; } @@ -452,10 +482,15 @@ if (r) return r; - /* zero any new bits if the mirror has grown */ - for (i = lc->header.nr_regions; i < lc->region_count; i++) - /* FIXME: amazingly inefficient */ - log_clear_bit(lc, lc->clean_bits, i); + /* set or clear any new bits */ + if (lc->sync == NOSYNC) + for (i = lc->header.nr_regions; i < lc->region_count; i++) + /* FIXME: amazingly inefficient */ + log_set_bit(lc, lc->clean_bits, i); + else + for (i = lc->header.nr_regions; i < lc->region_count; i++) + /* FIXME: amazingly inefficient */ + log_clear_bit(lc, lc->clean_bits, i); /* copy clean across to sync */ memcpy(lc->sync_bits, lc->clean_bits, size); @@ -566,6 +601,51 @@ return lc->sync_count; } +#define DMEMIT_SYNC \ + if (lc->sync != DEFAULTSYNC) \ + DMEMIT("%ssync ", lc->sync == NOSYNC ? "no" : "") + +static int core_status(struct dirty_log *log, status_type_t status, + char *result, unsigned int maxlen) +{ + int sz = 0; + struct log_c *lc = log->context; + + switch(status) { + case STATUSTYPE_INFO: + break; + + case STATUSTYPE_TABLE: + DMEMIT("%s %u " SECTOR_FORMAT " ", log->type->name, + lc->sync == DEFAULTSYNC ? 1 : 2, lc->region_size); + DMEMIT_SYNC; + } + + return sz; +} + +static int disk_status(struct dirty_log *log, status_type_t status, + char *result, unsigned int maxlen) +{ + int sz = 0; + char buffer[16]; + struct log_c *lc = log->context; + + switch(status) { + case STATUSTYPE_INFO: + break; + + case STATUSTYPE_TABLE: + format_dev_t(buffer, lc->log_dev->bdev->bd_dev); + DMEMIT("%s %u %s " SECTOR_FORMAT " ", log->type->name, + lc->sync == DEFAULTSYNC ? 2 : 3, buffer, + lc->region_size); + DMEMIT_SYNC; + } + + return sz; +} + static struct dirty_log_type _core_type = { .name = "core", .module = THIS_MODULE, @@ -579,7 +659,8 @@ .clear_region = core_clear_region, .get_resync_work = core_get_resync_work, .complete_resync_work = core_complete_resync_work, - .get_sync_count = core_get_sync_count + .get_sync_count = core_get_sync_count, + .status = core_status, }; static struct dirty_log_type _disk_type = { @@ -597,7 +678,8 @@ .clear_region = core_clear_region, .get_resync_work = core_get_resync_work, .complete_resync_work = core_complete_resync_work, - .get_sync_count = core_get_sync_count + .get_sync_count = core_get_sync_count, + .status = disk_status, }; int __init dm_dirty_log_init(void) diff -Nru a/drivers/md/dm-log.h b/drivers/md/dm-log.h --- a/drivers/md/dm-log.h 2004-09-26 10:25:55 -07:00 +++ b/drivers/md/dm-log.h 2004-09-26 10:25:55 -07:00 @@ -101,6 +101,12 @@ * Returns the number of regions that are in sync. */ region_t (*get_sync_count)(struct dirty_log *log); + + /* + * Support function for mirror status requests. + */ + int (*status)(struct dirty_log *log, status_type_t status_type, + char *result, unsigned int maxlen); }; int dm_register_dirty_log_type(struct dirty_log_type *type); diff -Nru a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c --- a/drivers/md/dm-raid1.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/md/dm-raid1.c 2004-09-26 10:25:57 -07:00 @@ -1009,8 +1009,8 @@ * log_type #log_params * #mirrors [mirror_path offset]{2,} * - * For now, #log_params = 1, log_type = "core" - * + * log_type is "core" or "disk" + * #log_params is between 1 and 3 */ #define DM_IO_PAGES 64 static int mirror_ctr(struct dm_target *ti, unsigned int argc, char **argv) @@ -1182,35 +1182,30 @@ char *result, unsigned int maxlen) { char buffer[32]; - unsigned int m, sz = 0; + unsigned int m, sz; struct mirror_set *ms = (struct mirror_set *) ti->private; -#define EMIT(x...) sz += ((sz >= maxlen) ? \ - 0 : scnprintf(result + sz, maxlen - sz, x)) + sz = ms->rh.log->type->status(ms->rh.log, type, result, maxlen); switch (type) { case STATUSTYPE_INFO: - EMIT("%d ", ms->nr_mirrors); - + DMEMIT("%d ", ms->nr_mirrors); for (m = 0; m < ms->nr_mirrors; m++) { format_dev_t(buffer, ms->mirror[m].dev->bdev->bd_dev); - EMIT("%s ", buffer); + DMEMIT("%s ", buffer); } - EMIT(SECTOR_FORMAT "/" SECTOR_FORMAT, - ms->rh.log->type->get_sync_count(ms->rh.log), - ms->nr_regions); + DMEMIT(SECTOR_FORMAT "/" SECTOR_FORMAT, + ms->rh.log->type->get_sync_count(ms->rh.log), + ms->nr_regions); break; case STATUSTYPE_TABLE: - EMIT("%s 1 " SECTOR_FORMAT " %d ", - ms->rh.log->type->name, ms->rh.region_size, - ms->nr_mirrors); - + DMEMIT("%d ", ms->nr_mirrors); for (m = 0; m < ms->nr_mirrors; m++) { format_dev_t(buffer, ms->mirror[m].dev->bdev->bd_dev); - EMIT("%s " SECTOR_FORMAT " ", - buffer, ms->mirror[m].offset); + DMEMIT("%s " SECTOR_FORMAT " ", + buffer, ms->mirror[m].offset); } } diff -Nru a/drivers/md/dm-stripe.c b/drivers/md/dm-stripe.c --- a/drivers/md/dm-stripe.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/md/dm-stripe.c 2004-09-26 10:25:56 -07:00 @@ -191,20 +191,17 @@ unsigned int i; char buffer[32]; -#define EMIT(x...) sz += ((sz >= maxlen) ? \ - 0 : scnprintf(result + sz, maxlen - sz, x)) - switch (type) { case STATUSTYPE_INFO: result[0] = '\0'; break; case STATUSTYPE_TABLE: - EMIT("%d " SECTOR_FORMAT, sc->stripes, sc->chunk_mask + 1); + DMEMIT("%d " SECTOR_FORMAT, sc->stripes, sc->chunk_mask + 1); for (i = 0; i < sc->stripes; i++) { format_dev_t(buffer, sc->stripe[i].dev->bdev->bd_dev); - EMIT(" %s " SECTOR_FORMAT, buffer, - sc->stripe[i].physical_start); + DMEMIT(" %s " SECTOR_FORMAT, buffer, + sc->stripe[i].physical_start); } break; } diff -Nru a/drivers/md/dm-table.c b/drivers/md/dm-table.c --- a/drivers/md/dm-table.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/md/dm-table.c 2004-09-26 10:25:57 -07:00 @@ -825,7 +825,7 @@ * Make sure we obey the optimistic sub devices * restrictions. */ - q->max_sectors = t->limits.max_sectors; + blk_queue_max_sectors(q, t->limits.max_sectors); q->max_phys_segments = t->limits.max_phys_segments; q->max_hw_segments = t->limits.max_hw_segments; q->hardsect_size = t->limits.hardsect_size; diff -Nru a/drivers/md/dm.c b/drivers/md/dm.c --- a/drivers/md/dm.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/md/dm.c 2004-09-26 10:25:57 -07:00 @@ -647,7 +647,7 @@ { int r, m; - if (minor > (1 << MINORBITS)) + if (minor >= (1 << MINORBITS)) return -EINVAL; down(&_minor_lock); @@ -697,7 +697,7 @@ goto out; } - if (m > (1 << MINORBITS)) { + if (m >= (1 << MINORBITS)) { idr_remove(&_minor_idr, m); r = -ENOSPC; goto out; diff -Nru a/drivers/md/dm.h b/drivers/md/dm.h --- a/drivers/md/dm.h 2004-09-26 10:25:56 -07:00 +++ b/drivers/md/dm.h 2004-09-26 10:25:56 -07:00 @@ -19,6 +19,9 @@ #define DMERR(f, x...) printk(KERN_ERR DM_NAME ": " f "\n" , ## x) #define DMINFO(f, x...) printk(KERN_INFO DM_NAME ": " f "\n" , ## x) +#define DMEMIT(x...) sz += ((sz >= maxlen) ? \ + 0 : scnprintf(result + sz, maxlen - sz, x)) + /* * FIXME: I think this should be with the definition of sector_t * in types.h. diff -Nru a/drivers/md/linear.c b/drivers/md/linear.c --- a/drivers/md/linear.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/md/linear.c 2004-09-26 10:25:56 -07:00 @@ -157,7 +157,7 @@ */ if (rdev->bdev->bd_disk->queue->merge_bvec_fn && mddev->queue->max_sectors > (PAGE_SIZE>>9)) - mddev->queue->max_sectors = (PAGE_SIZE>>9); + blk_queue_max_sectors(mddev->queue, PAGE_SIZE>>9); disk->size = rdev->size; mddev->array_size += rdev->size; diff -Nru a/drivers/md/md.c b/drivers/md/md.c --- a/drivers/md/md.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/md/md.c 2004-09-26 10:25:56 -07:00 @@ -2895,7 +2895,7 @@ return thread; } -void md_interrupt_thread(mdk_thread_t *thread) +static void md_interrupt_thread(mdk_thread_t *thread) { if (!thread->tsk) { MD_BUG(); @@ -3797,6 +3797,5 @@ EXPORT_SYMBOL(md_unregister_thread); EXPORT_SYMBOL(md_wakeup_thread); EXPORT_SYMBOL(md_print_devices); -EXPORT_SYMBOL(md_interrupt_thread); EXPORT_SYMBOL(md_check_recovery); MODULE_LICENSE("GPL"); diff -Nru a/drivers/md/multipath.c b/drivers/md/multipath.c --- a/drivers/md/multipath.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/md/multipath.c 2004-09-26 10:25:56 -07:00 @@ -325,7 +325,7 @@ */ if (rdev->bdev->bd_disk->queue->merge_bvec_fn && mddev->queue->max_sectors > (PAGE_SIZE>>9)) - mddev->queue->max_sectors = (PAGE_SIZE>>9); + blk_queue_max_sectors(mddev->queue, PAGE_SIZE>>9); conf->working_disks++; rdev->raid_disk = path; @@ -479,7 +479,7 @@ * a merge_bvec_fn to be involved in multipath */ if (rdev->bdev->bd_disk->queue->merge_bvec_fn && mddev->queue->max_sectors > (PAGE_SIZE>>9)) - mddev->queue->max_sectors = (PAGE_SIZE>>9); + blk_queue_max_sectors(mddev->queue, PAGE_SIZE>>9); if (!rdev->faulty) conf->working_disks++; diff -Nru a/drivers/md/raid0.c b/drivers/md/raid0.c --- a/drivers/md/raid0.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/md/raid0.c 2004-09-26 10:25:56 -07:00 @@ -162,7 +162,7 @@ if (rdev1->bdev->bd_disk->queue->merge_bvec_fn && mddev->queue->max_sectors > (PAGE_SIZE>>9)) - mddev->queue->max_sectors = (PAGE_SIZE>>9); + blk_queue_max_sectors(mddev->queue, PAGE_SIZE>>9); if (!smallest || (rdev1->size size)) smallest = rdev1; diff -Nru a/drivers/md/raid1.c b/drivers/md/raid1.c --- a/drivers/md/raid1.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/md/raid1.c 2004-09-26 10:25:56 -07:00 @@ -753,7 +753,7 @@ */ if (rdev->bdev->bd_disk->queue->merge_bvec_fn && mddev->queue->max_sectors > (PAGE_SIZE>>9)) - mddev->queue->max_sectors = (PAGE_SIZE>>9); + blk_queue_max_sectors(mddev->queue, PAGE_SIZE>>9); p->head_position = 0; rdev->raid_disk = mirror; @@ -1196,7 +1196,7 @@ */ if (rdev->bdev->bd_disk->queue->merge_bvec_fn && mddev->queue->max_sectors > (PAGE_SIZE>>9)) - mddev->queue->max_sectors = (PAGE_SIZE>>9); + blk_queue_max_sectors(mddev->queue, PAGE_SIZE>>9); disk->head_position = 0; if (!rdev->faulty && rdev->in_sync) diff -Nru a/drivers/media/video/bttv-driver.c b/drivers/media/video/bttv-driver.c --- a/drivers/media/video/bttv-driver.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/media/video/bttv-driver.c 2004-09-26 10:25:57 -07:00 @@ -1051,11 +1051,6 @@ btwrite(whitecrush_upper, BT848_WC_UP); btwrite(whitecrush_lower, BT848_WC_DOWN); - bt848_bright(btv, btv->bright); - bt848_hue(btv, btv->hue); - bt848_contrast(btv, btv->contrast); - bt848_sat(btv, btv->saturation); - if (btv->opt_lumafilter) { btwrite(0, BT848_E_CONTROL); btwrite(0, BT848_O_CONTROL); @@ -1063,6 +1058,11 @@ btwrite(BT848_CONTROL_LDEC, BT848_E_CONTROL); btwrite(BT848_CONTROL_LDEC, BT848_O_CONTROL); } + + bt848_bright(btv, btv->bright); + bt848_hue(btv, btv->hue); + bt848_contrast(btv, btv->contrast); + bt848_sat(btv, btv->saturation); /* interrupt */ init_irqreg(btv); diff -Nru a/drivers/media/video/bttv-risc.c b/drivers/media/video/bttv-risc.c --- a/drivers/media/video/bttv-risc.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/media/video/bttv-risc.c 2004-09-26 10:25:56 -07:00 @@ -125,6 +125,7 @@ struct scatterlist *ysg; struct scatterlist *usg; struct scatterlist *vsg; + int topfield = (0 == yoffset); int rc; /* estimate risc mem: worst case is one write per page border + @@ -153,13 +154,13 @@ chroma = 1; break; case 1: - if (!yoffset) + if (topfield) chroma = (line & 1) == 0; else chroma = (line & 1) == 1; break; case 2: - if (!yoffset) + if (topfield) chroma = (line & 3) == 0; else chroma = (line & 3) == 2; diff -Nru a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h --- a/drivers/message/fusion/mptbase.h 2004-09-26 10:25:55 -07:00 +++ b/drivers/message/fusion/mptbase.h 2004-09-26 10:25:55 -07:00 @@ -581,8 +581,8 @@ int pci_irq; /* This irq */ char name[MPT_NAME_LENGTH]; /* "iocN" */ char *prod_name; /* "LSIFC9x9" */ - volatile SYSIF_REGS *chip; /* == c8817000 (mmap) */ - volatile SYSIF_REGS *pio_chip; /* Programmed IO (downloadboot) */ + SYSIF_REGS __iomem *chip; /* == c8817000 (mmap) */ + SYSIF_REGS __iomem *pio_chip; /* Programmed IO (downloadboot) */ u32 mem_phys; /* == f4020000 (mmap) */ u32 pio_mem_phys; /* Programmed IO (downloadboot) */ int mem_size; /* mmap memory size */ diff -Nru a/drivers/message/i2o/i2o_core.c b/drivers/message/i2o/i2o_core.c --- a/drivers/message/i2o/i2o_core.c 2004-09-26 10:25:56 -07:00 +++ /dev/null Wed Dec 31 16:00:00 196900 @@ -1,3977 +0,0 @@ -/* - * Core I2O structure management - * - * (C) Copyright 1999-2002 Red Hat Software - * - * Written by Alan Cox, Building Number Three Ltd - * - * 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. - * - * A lot of the I2O message side code from this is taken from the - * Red Creek RCPCI45 adapter driver by Red Creek Communications - * - * Fixes/additions: - * Philipp Rumpf - * Juha Sievänen - * Auvo Häkkinen - * Deepak Saxena - * Boji T Kannanthanam - * Alan Cox : - * Ported to Linux 2.5. - * Markus Lidel : - * Minor fixes for 2.6. - * - */ - -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#ifdef CONFIG_MTRR -#include -#endif // CONFIG_MTRR - -#include "i2o_lan.h" - -//#define DRIVERDEBUG - -#ifdef DRIVERDEBUG -#define dprintk(s, args...) printk(s, ## args) -#else -#define dprintk(s, args...) -#endif - -/* OSM table */ -static struct i2o_handler *i2o_handlers[MAX_I2O_MODULES]; - -/* Controller list */ -static struct i2o_controller *i2o_controllers[MAX_I2O_CONTROLLERS]; -struct i2o_controller *i2o_controller_chain; -int i2o_num_controllers; - -/* Initiator Context for Core message */ -static int core_context; - -/* Initialization && shutdown functions */ -void i2o_sys_init(void); -static void i2o_sys_shutdown(void); -static int i2o_reset_controller(struct i2o_controller *); -static int i2o_reboot_event(struct notifier_block *, unsigned long , void *); -static int i2o_online_controller(struct i2o_controller *); -static int i2o_init_outbound_q(struct i2o_controller *); -static int i2o_post_outbound_messages(struct i2o_controller *); - -/* Reply handler */ -static void i2o_core_reply(struct i2o_handler *, struct i2o_controller *, - struct i2o_message *); - -/* Various helper functions */ -static int i2o_lct_get(struct i2o_controller *); -static int i2o_lct_notify(struct i2o_controller *); -static int i2o_hrt_get(struct i2o_controller *); - -static int i2o_build_sys_table(void); -static int i2o_systab_send(struct i2o_controller *c); - -/* I2O core event handler */ -static int i2o_core_evt(void *); -static int evt_pid; -static int evt_running; - -/* Dynamic LCT update handler */ -static int i2o_dyn_lct(void *); - -void i2o_report_controller_unit(struct i2o_controller *, struct i2o_device *); - -static void i2o_pci_dispose(struct i2o_controller *c); - -/* - * I2O System Table. Contains information about - * all the IOPs in the system. Used to inform IOPs - * about each other's existence. - * - * sys_tbl_ver is the CurrentChangeIndicator that is - * used by IOPs to track changes. - */ -static struct i2o_sys_tbl *sys_tbl; -static int sys_tbl_ind; -static int sys_tbl_len; - -/* - * This spin lock is used to keep a device from being - * added and deleted concurrently across CPUs or interrupts. - * This can occur when a user creates a device and immediatelly - * deletes it before the new_dev_notify() handler is called. - */ -static spinlock_t i2o_dev_lock = SPIN_LOCK_UNLOCKED; - -/* - * Structures and definitions for synchronous message posting. - * See i2o_post_wait() for description. - */ -struct i2o_post_wait_data -{ - int *status; /* Pointer to status block on caller stack */ - int *complete; /* Pointer to completion flag on caller stack */ - u32 id; /* Unique identifier */ - wait_queue_head_t *wq; /* Wake up for caller (NULL for dead) */ - struct i2o_post_wait_data *next; /* Chain */ - void *mem[2]; /* Memory blocks to recover on failure path */ - dma_addr_t phys[2]; /* Physical address of blocks to recover */ - u32 size[2]; /* Size of blocks to recover */ -}; - -static struct i2o_post_wait_data *post_wait_queue; -static u32 post_wait_id; // Unique ID for each post_wait -static spinlock_t post_wait_lock = SPIN_LOCK_UNLOCKED; -static void i2o_post_wait_complete(struct i2o_controller *, u32, int); - -/* OSM descriptor handler */ -static struct i2o_handler i2o_core_handler = -{ - (void *)i2o_core_reply, - NULL, - NULL, - NULL, - "I2O core layer", - 0, - I2O_CLASS_EXECUTIVE -}; - -/* - * Used when queueing a reply to be handled later - */ - -struct reply_info -{ - struct i2o_controller *iop; - u32 msg[MSG_FRAME_SIZE]; -}; -static struct reply_info evt_reply; -static struct reply_info events[I2O_EVT_Q_LEN]; -static int evt_in; -static int evt_out; -static int evt_q_len; -#define MODINC(x,y) ((x) = ((x) + 1) % (y)) - -/* - * I2O configuration spinlock. This isnt a big deal for contention - * so we have one only - */ - -static DECLARE_MUTEX(i2o_configuration_lock); - -/* - * Event spinlock. Used to keep event queue sane and from - * handling multiple events simultaneously. - */ -static spinlock_t i2o_evt_lock = SPIN_LOCK_UNLOCKED; - -/* - * Semaphore used to synchronize event handling thread with - * interrupt handler. - */ - -static DECLARE_MUTEX(evt_sem); -static DECLARE_COMPLETION(evt_dead); -static DECLARE_WAIT_QUEUE_HEAD(evt_wait); - -static struct notifier_block i2o_reboot_notifier = -{ - i2o_reboot_event, - NULL, - 0 -}; - -/* - * Config options - */ - -static int verbose; - -#if BITS_PER_LONG == 64 -/** - * i2o_context_list_add - append an ptr to the context list and return a - * matching context id. - * @ptr: pointer to add to the context list - * @c: controller to which the context list belong - * returns context id, which could be used in the transaction context - * field. - * - * Because the context field in I2O is only 32-bit large, on 64-bit the - * pointer is to large to fit in the context field. The i2o_context_list - * functiones map pointers to context fields. - */ -u32 i2o_context_list_add(void *ptr, struct i2o_controller *c) { - u32 context = 1; - struct i2o_context_list_element **entry = &c->context_list; - struct i2o_context_list_element *element; - unsigned long flags; - - spin_lock_irqsave(&c->context_list_lock, flags); - while(*entry && ((*entry)->flags & I2O_CONTEXT_LIST_USED)) { - if((*entry)->context >= context) - context = (*entry)->context + 1; - entry = &((*entry)->next); - } - - if(!*entry) { - if(unlikely(!context)) { - spin_unlock_irqrestore(&c->context_list_lock, flags); - printk(KERN_EMERG "i2o_core: context list overflow\n"); - return 0; - } - - element = kmalloc(sizeof(struct i2o_context_list_element), GFP_KERNEL); - if(!element) { - printk(KERN_EMERG "i2o_core: could not allocate memory for context list element\n"); - return 0; - } - element->context = context; - element->next = NULL; - *entry = element; - } else - element = *entry; - - element->ptr = ptr; - element->flags = I2O_CONTEXT_LIST_USED; - - spin_unlock_irqrestore(&c->context_list_lock, flags); - dprintk(KERN_DEBUG "i2o_core: add context to list %p -> %d\n", ptr, context); - return context; -} - -/** - * i2o_context_list_remove - remove a ptr from the context list and return - * the matching context id. - * @ptr: pointer to be removed from the context list - * @c: controller to which the context list belong - * returns context id, which could be used in the transaction context - * field. - */ -u32 i2o_context_list_remove(void *ptr, struct i2o_controller *c) { - struct i2o_context_list_element **entry = &c->context_list; - struct i2o_context_list_element *element; - u32 context; - unsigned long flags; - - spin_lock_irqsave(&c->context_list_lock, flags); - while(*entry && ((*entry)->ptr != ptr)) - entry = &((*entry)->next); - - if(unlikely(!*entry)) { - spin_unlock_irqrestore(&c->context_list_lock, flags); - printk(KERN_WARNING "i2o_core: could not remove nonexistent ptr %p\n", ptr); - return 0; - } - - element = *entry; - - context = element->context; - element->ptr = NULL; - element->flags |= I2O_CONTEXT_LIST_DELETED; - - spin_unlock_irqrestore(&c->context_list_lock, flags); - dprintk(KERN_DEBUG "i2o_core: markt as deleted in context list %p -> %d\n", ptr, context); - return context; -} - -/** - * i2o_context_list_get - get a ptr from the context list and remove it - * from the list. - * @context: context id to which the pointer belong - * @c: controller to which the context list belong - * returns pointer to the matching context id - */ -void *i2o_context_list_get(u32 context, struct i2o_controller *c) { - struct i2o_context_list_element **entry = &c->context_list; - struct i2o_context_list_element *element; - void *ptr; - int count = 0; - unsigned long flags; - - spin_lock_irqsave(&c->context_list_lock, flags); - while(*entry && ((*entry)->context != context)) { - entry = &((*entry)->next); - count ++; - } - - if(unlikely(!*entry)) { - spin_unlock_irqrestore(&c->context_list_lock, flags); - printk(KERN_WARNING "i2o_core: context id %d not found\n", context); - return NULL; - } - - element = *entry; - ptr = element->ptr; - if(count >= I2O_CONTEXT_LIST_MIN_LENGTH) { - *entry = (*entry)->next; - kfree(element); - } else { - element->ptr = NULL; - element->flags &= !I2O_CONTEXT_LIST_USED; - } - - spin_unlock_irqrestore(&c->context_list_lock, flags); - dprintk(KERN_DEBUG "i2o_core: get ptr from context list %d -> %p\n", context, ptr); - return ptr; -} -#endif - -/* - * I2O Core reply handler - */ -static void i2o_core_reply(struct i2o_handler *h, struct i2o_controller *c, - struct i2o_message *m) -{ - u32 *msg=(u32 *)m; - u32 status; - u32 context = msg[2]; - - if (msg[0] & MSG_FAIL) // Fail bit is set - { - u32 *preserved_msg = (u32*)(c->msg_virt + msg[7]); - - i2o_report_status(KERN_INFO, "i2o_core", msg); - i2o_dump_message(preserved_msg); - - /* If the failed request needs special treatment, - * it should be done here. */ - - /* Release the preserved msg by resubmitting it as a NOP */ - - preserved_msg[0] = cpu_to_le32(THREE_WORD_MSG_SIZE | SGL_OFFSET_0); - preserved_msg[1] = cpu_to_le32(I2O_CMD_UTIL_NOP << 24 | HOST_TID << 12 | 0); - preserved_msg[2] = 0; - i2o_post_message(c, msg[7]); - - /* If reply to i2o_post_wait failed, return causes a timeout */ - - return; - } - -#ifdef DRIVERDEBUG - i2o_report_status(KERN_INFO, "i2o_core", msg); -#endif - - if(msg[2]&0x80000000) // Post wait message - { - if (msg[4] >> 24) - status = (msg[4] & 0xFFFF); - else - status = I2O_POST_WAIT_OK; - - i2o_post_wait_complete(c, context, status); - return; - } - - if(m->function == I2O_CMD_UTIL_EVT_REGISTER) - { - memcpy(events[evt_in].msg, msg, (msg[0]>>16)<<2); - events[evt_in].iop = c; - - spin_lock(&i2o_evt_lock); - MODINC(evt_in, I2O_EVT_Q_LEN); - if(evt_q_len == I2O_EVT_Q_LEN) - MODINC(evt_out, I2O_EVT_Q_LEN); - else - evt_q_len++; - spin_unlock(&i2o_evt_lock); - - up(&evt_sem); - wake_up_interruptible(&evt_wait); - return; - } - - if(m->function == I2O_CMD_LCT_NOTIFY) - { - up(&c->lct_sem); - return; - } - - /* - * If this happens, we want to dump the message to the syslog so - * it can be sent back to the card manufacturer by the end user - * to aid in debugging. - * - */ - printk(KERN_WARNING "%s: Unsolicited message reply sent to core!" - "Message dumped to syslog\n", - c->name); - i2o_dump_message(msg); - - return; -} - -/** - * i2o_install_handler - install a message handler - * @h: Handler structure - * - * Install an I2O handler - these handle the asynchronous messaging - * from the card once it has initialised. If the table of handlers is - * full then -ENOSPC is returned. On a success 0 is returned and the - * context field is set by the function. The structure is part of the - * system from this time onwards. It must not be freed until it has - * been uninstalled - */ - -int i2o_install_handler(struct i2o_handler *h) -{ - int i; - down(&i2o_configuration_lock); - for(i=0;icontext = i; - i2o_handlers[i]=h; - up(&i2o_configuration_lock); - return 0; - } - } - up(&i2o_configuration_lock); - return -ENOSPC; -} - -/** - * i2o_remove_handler - remove an i2o message handler - * @h: handler - * - * Remove a message handler previously installed with i2o_install_handler. - * After this function returns the handler object can be freed or re-used - */ - -int i2o_remove_handler(struct i2o_handler *h) -{ - i2o_handlers[h->context]=NULL; - return 0; -} - - -/* - * Each I2O controller has a chain of devices on it. - * Each device has a pointer to its LCT entry to be used - * for fun purposes. - */ - -/** - * i2o_install_device - attach a device to a controller - * @c: controller - * @d: device - * - * Add a new device to an i2o controller. This can be called from - * non interrupt contexts only. It adds the device and marks it as - * unclaimed. The device memory becomes part of the kernel and must - * be uninstalled before being freed or reused. Zero is returned - * on success. - */ - -int i2o_install_device(struct i2o_controller *c, struct i2o_device *d) -{ - int i; - - down(&i2o_configuration_lock); - d->controller=c; - d->owner=NULL; - d->next=c->devices; - d->prev=NULL; - if (c->devices != NULL) - c->devices->prev=d; - c->devices=d; - *d->dev_name = 0; - - for(i = 0; i < I2O_MAX_MANAGERS; i++) - d->managers[i] = NULL; - - up(&i2o_configuration_lock); - return 0; -} - -/* we need this version to call out of i2o_delete_controller */ - -int __i2o_delete_device(struct i2o_device *d) -{ - struct i2o_device **p; - int i; - - p=&(d->controller->devices); - - /* - * Hey we have a driver! - * Check to see if the driver wants us to notify it of - * device deletion. If it doesn't we assume that it - * is unsafe to delete a device with an owner and - * fail. - */ - if(d->owner) - { - if(d->owner->dev_del_notify) - { - dprintk(KERN_INFO "Device has owner, notifying\n"); - d->owner->dev_del_notify(d->controller, d); - if(d->owner) - { - printk(KERN_WARNING - "Driver \"%s\" did not release device!\n", d->owner->name); - return -EBUSY; - } - } - else - return -EBUSY; - } - - /* - * Tell any other users who are talking to this device - * that it's going away. We assume that everything works. - */ - for(i=0; i < I2O_MAX_MANAGERS; i++) - { - if(d->managers[i] && d->managers[i]->dev_del_notify) - d->managers[i]->dev_del_notify(d->controller, d); - } - - while(*p!=NULL) - { - if(*p==d) - { - /* - * Destroy - */ - *p=d->next; - kfree(d); - return 0; - } - p=&((*p)->next); - } - printk(KERN_ERR "i2o_delete_device: passed invalid device.\n"); - return -EINVAL; -} - -/** - * i2o_delete_device - remove an i2o device - * @d: device to remove - * - * This function unhooks a device from a controller. The device - * will not be unhooked if it has an owner who does not wish to free - * it, or if the owner lacks a dev_del_notify function. In that case - * -EBUSY is returned. On success 0 is returned. Other errors cause - * negative errno values to be returned - */ - -int i2o_delete_device(struct i2o_device *d) -{ - int ret; - - down(&i2o_configuration_lock); - - /* - * Seek, locate - */ - - ret = __i2o_delete_device(d); - - up(&i2o_configuration_lock); - - return ret; -} - -/** - * i2o_install_controller - attach a controller - * @c: controller - * - * Add a new controller to the i2o layer. This can be called from - * non interrupt contexts only. It adds the controller and marks it as - * unused with no devices. If the tables are full or memory allocations - * fail then a negative errno code is returned. On success zero is - * returned and the controller is bound to the system. The structure - * must not be freed or reused until being uninstalled. - */ - -int i2o_install_controller(struct i2o_controller *c) -{ - int i; - down(&i2o_configuration_lock); - for(i=0;idlct = (i2o_lct*)pci_alloc_consistent(c->pdev, 8192, &c->dlct_phys); - if(c->dlct==NULL) - { - up(&i2o_configuration_lock); - return -ENOMEM; - } - i2o_controllers[i]=c; - c->devices = NULL; - c->next=i2o_controller_chain; - i2o_controller_chain=c; - c->unit = i; - c->page_frame = NULL; - c->hrt = NULL; - c->hrt_len = 0; - c->lct = NULL; - c->status_block = NULL; - sprintf(c->name, "i2o/iop%d", i); - i2o_num_controllers++; - init_MUTEX_LOCKED(&c->lct_sem); - up(&i2o_configuration_lock); - return 0; - } - } - printk(KERN_ERR "No free i2o controller slots.\n"); - up(&i2o_configuration_lock); - return -EBUSY; -} - -/** - * i2o_delete_controller - delete a controller - * @c: controller - * - * Remove an i2o controller from the system. If the controller or its - * devices are busy then -EBUSY is returned. On a failure a negative - * errno code is returned. On success zero is returned. - */ - -int i2o_delete_controller(struct i2o_controller *c) -{ - struct i2o_controller **p; - int users; - char name[16]; - int stat; - - dprintk(KERN_INFO "Deleting controller %s\n", c->name); - - /* - * Clear event registration as this can cause weird behavior - */ - if(c->status_block->iop_state == ADAPTER_STATE_OPERATIONAL) - i2o_event_register(c, core_context, 0, 0, 0); - - down(&i2o_configuration_lock); - if((users=atomic_read(&c->users))) - { - dprintk(KERN_INFO "I2O: %d users for controller %s\n", users, - c->name); - up(&i2o_configuration_lock); - return -EBUSY; - } - while(c->devices) - { - if(__i2o_delete_device(c->devices)<0) - { - /* Shouldnt happen */ - I2O_IRQ_WRITE32(c, 0xFFFFFFFF); - c->enabled = 0; - up(&i2o_configuration_lock); - return -EBUSY; - } - } - - /* - * If this is shutdown time, the thread's already been killed - */ - if(c->lct_running) { - stat = kill_proc(c->lct_pid, SIGKILL, 1); - if(!stat) { - int count = 10 * 100; - while(c->lct_running && --count) { - current->state = TASK_INTERRUPTIBLE; - schedule_timeout(1); - } - - if(!count) - printk(KERN_ERR - "%s: LCT thread still running!\n", - c->name); - } - } - - p=&i2o_controller_chain; - - while(*p) - { - if(*p==c) - { - /* Ask the IOP to switch to RESET state */ - i2o_reset_controller(c); - - /* Release IRQ */ - i2o_pci_dispose(c); - - *p=c->next; - up(&i2o_configuration_lock); - - if(c->page_frame) - { - pci_unmap_single(c->pdev, c->page_frame_map, MSG_POOL_SIZE, PCI_DMA_FROMDEVICE); - kfree(c->page_frame); - } - if(c->hrt) - pci_free_consistent(c->pdev, c->hrt_len, c->hrt, c->hrt_phys); - if(c->lct) - pci_free_consistent(c->pdev, c->lct->table_size << 2, c->lct, c->lct_phys); - if(c->status_block) - pci_free_consistent(c->pdev, sizeof(i2o_status_block), c->status_block, c->status_block_phys); - if(c->dlct) - pci_free_consistent(c->pdev, 8192, c->dlct, c->dlct_phys); - - i2o_controllers[c->unit]=NULL; - memcpy(name, c->name, strlen(c->name)+1); - kfree(c); - dprintk(KERN_INFO "%s: Deleted from controller chain.\n", name); - - i2o_num_controllers--; - return 0; - } - p=&((*p)->next); - } - up(&i2o_configuration_lock); - printk(KERN_ERR "i2o_delete_controller: bad pointer!\n"); - return -ENOENT; -} - -/** - * i2o_unlock_controller - unlock a controller - * @c: controller to unlock - * - * Take a lock on an i2o controller. This prevents it being deleted. - * i2o controllers are not refcounted so a deletion of an in use device - * will fail, not take affect on the last dereference. - */ - -void i2o_unlock_controller(struct i2o_controller *c) -{ - atomic_dec(&c->users); -} - -/** - * i2o_find_controller - return a locked controller - * @n: controller number - * - * Returns a pointer to the controller object. The controller is locked - * on return. NULL is returned if the controller is not found. - */ - -struct i2o_controller *i2o_find_controller(int n) -{ - struct i2o_controller *c; - - if(n<0 || n>=MAX_I2O_CONTROLLERS) - return NULL; - - down(&i2o_configuration_lock); - c=i2o_controllers[n]; - if(c!=NULL) - atomic_inc(&c->users); - up(&i2o_configuration_lock); - return c; -} - -/** - * i2o_issue_claim - claim or release a device - * @cmd: command - * @c: controller to claim for - * @tid: i2o task id - * @type: type of claim - * - * Issue I2O UTIL_CLAIM and UTIL_RELEASE messages. The message to be sent - * is set by cmd. The tid is the task id of the object to claim and the - * type is the claim type (see the i2o standard) - * - * Zero is returned on success. - */ - -static int i2o_issue_claim(u32 cmd, struct i2o_controller *c, int tid, u32 type) -{ - u32 msg[5]; - - msg[0] = FIVE_WORD_MSG_SIZE | SGL_OFFSET_0; - msg[1] = cmd << 24 | HOST_TID<<12 | tid; - msg[3] = 0; - msg[4] = type; - - return i2o_post_wait(c, msg, sizeof(msg), 60); -} - -/* - * i2o_claim_device - claim a device for use by an OSM - * @d: device to claim - * @h: handler for this device - * - * Do the leg work to assign a device to a given OSM on Linux. The - * kernel updates the internal handler data for the device and then - * performs an I2O claim for the device, attempting to claim the - * device as primary. If the attempt fails a negative errno code - * is returned. On success zero is returned. - */ - -int i2o_claim_device(struct i2o_device *d, struct i2o_handler *h) -{ - int ret = 0; - - down(&i2o_configuration_lock); - if (d->owner) { - printk(KERN_INFO "Device claim called, but dev already owned by %s!", - h->name); - ret = -EBUSY; - goto out; - } - d->owner=h; - - if(i2o_issue_claim(I2O_CMD_UTIL_CLAIM ,d->controller,d->lct_data.tid, - I2O_CLAIM_PRIMARY)) - { - d->owner = NULL; - ret = -EBUSY; - } -out: - up(&i2o_configuration_lock); - return ret; -} - -/** - * i2o_release_device - release a device that the OSM is using - * @d: device to claim - * @h: handler for this device - * - * Drop a claim by an OSM on a given I2O device. The handler is cleared - * and 0 is returned on success. - * - * AC - some devices seem to want to refuse an unclaim until they have - * finished internal processing. It makes sense since you don't want a - * new device to go reconfiguring the entire system until you are done. - * Thus we are prepared to wait briefly. - */ - -int i2o_release_device(struct i2o_device *d, struct i2o_handler *h) -{ - int err = 0; - int tries; - - down(&i2o_configuration_lock); - if (d->owner != h) { - printk(KERN_INFO "Claim release called, but not owned by %s!\n", - h->name); - up(&i2o_configuration_lock); - return -ENOENT; - } - - for(tries=0;tries<10;tries++) - { - d->owner = NULL; - - /* - * If the controller takes a nonblocking approach to - * releases we have to sleep/poll for a few times. - */ - - if((err=i2o_issue_claim(I2O_CMD_UTIL_RELEASE, d->controller, d->lct_data.tid, I2O_CLAIM_PRIMARY)) ) - { - err = -ENXIO; - msleep(1000); - } - else - { - err=0; - break; - } - } - up(&i2o_configuration_lock); - return err; -} - -/** - * i2o_device_notify_on - Enable deletion notifiers - * @d: device for notification - * @h: handler to install - * - * Called by OSMs to let the core know that they want to be - * notified if the given device is deleted from the system. - */ - -int i2o_device_notify_on(struct i2o_device *d, struct i2o_handler *h) -{ - int i; - - if(d->num_managers == I2O_MAX_MANAGERS) - return -ENOSPC; - - for(i = 0; i < I2O_MAX_MANAGERS; i++) - { - if(!d->managers[i]) - { - d->managers[i] = h; - break; - } - } - - d->num_managers++; - - return 0; -} - -/** - * i2o_device_notify_off - Remove deletion notifiers - * @d: device for notification - * @h: handler to remove - * - * Called by OSMs to let the core know that they no longer - * are interested in the fate of the given device. - */ -int i2o_device_notify_off(struct i2o_device *d, struct i2o_handler *h) -{ - int i; - - for(i=0; i < I2O_MAX_MANAGERS; i++) - { - if(d->managers[i] == h) - { - d->managers[i] = NULL; - d->num_managers--; - return 0; - } - } - - return -ENOENT; -} - -/** - * i2o_event_register - register interest in an event - * @c: Controller to register interest with - * @tid: I2O task id - * @init_context: initiator context to use with this notifier - * @tr_context: transaction context to use with this notifier - * @evt_mask: mask of events - * - * Create and posts an event registration message to the task. No reply - * is waited for, or expected. Errors in posting will be reported. - */ - -int i2o_event_register(struct i2o_controller *c, u32 tid, - u32 init_context, u32 tr_context, u32 evt_mask) -{ - u32 msg[5]; // Not performance critical, so we just - // i2o_post_this it instead of building it - // in IOP memory - - msg[0] = FIVE_WORD_MSG_SIZE|SGL_OFFSET_0; - msg[1] = I2O_CMD_UTIL_EVT_REGISTER<<24 | HOST_TID<<12 | tid; - msg[2] = init_context; - msg[3] = tr_context; - msg[4] = evt_mask; - - return i2o_post_this(c, msg, sizeof(msg)); -} - -/* - * i2o_event_ack - acknowledge an event - * @c: controller - * @msg: pointer to the UTIL_EVENT_REGISTER reply we received - * - * We just take a pointer to the original UTIL_EVENT_REGISTER reply - * message and change the function code since that's what spec - * describes an EventAck message looking like. - */ - -int i2o_event_ack(struct i2o_controller *c, u32 *msg) -{ - struct i2o_message *m = (struct i2o_message *)msg; - - m->function = I2O_CMD_UTIL_EVT_ACK; - - return i2o_post_wait(c, msg, m->size * 4, 2); -} - -/* - * Core event handler. Runs as a separate thread and is woken - * up whenever there is an Executive class event. - */ -static int i2o_core_evt(void *reply_data) -{ - struct reply_info *reply = (struct reply_info *) reply_data; - u32 *msg = reply->msg; - struct i2o_controller *c = NULL; - unsigned long flags; - - daemonize("i2oevtd"); - allow_signal(SIGKILL); - - evt_running = 1; - - while(1) - { - if(down_interruptible(&evt_sem)) - { - dprintk(KERN_INFO "I2O event thread dead\n"); - printk("exiting..."); - evt_running = 0; - complete_and_exit(&evt_dead, 0); - } - - /* - * Copy the data out of the queue so that we don't have to lock - * around the whole function and just around the qlen update - */ - spin_lock_irqsave(&i2o_evt_lock, flags); - memcpy(reply, &events[evt_out], sizeof(struct reply_info)); - MODINC(evt_out, I2O_EVT_Q_LEN); - evt_q_len--; - spin_unlock_irqrestore(&i2o_evt_lock, flags); - - c = reply->iop; - dprintk(KERN_INFO "I2O IRTOS EVENT: iop%d, event %#10x\n", c->unit, msg[4]); - - /* - * We do not attempt to delete/quiesce/etc. the controller if - * some sort of error indidication occurs. We may want to do - * so in the future, but for now we just let the user deal with - * it. One reason for this is that what to do with an error - * or when to send what ærror is not really agreed on, so - * we get errors that may not be fatal but just look like they - * are...so let the user deal with it. - */ - switch(msg[4]) - { - case I2O_EVT_IND_EXEC_RESOURCE_LIMITS: - printk(KERN_ERR "%s: Out of resources\n", c->name); - break; - - case I2O_EVT_IND_EXEC_POWER_FAIL: - printk(KERN_ERR "%s: Power failure\n", c->name); - break; - - case I2O_EVT_IND_EXEC_HW_FAIL: - { - char *fail[] = - { - "Unknown Error", - "Power Lost", - "Code Violation", - "Parity Error", - "Code Execution Exception", - "Watchdog Timer Expired" - }; - - if(msg[5] <= 6) - printk(KERN_ERR "%s: Hardware Failure: %s\n", - c->name, fail[msg[5]]); - else - printk(KERN_ERR "%s: Unknown Hardware Failure\n", c->name); - - break; - } - - /* - * New device created - * - Create a new i2o_device entry - * - Inform all interested drivers about this device's existence - */ - case I2O_EVT_IND_EXEC_NEW_LCT_ENTRY: - { - struct i2o_device *d = (struct i2o_device *) - kmalloc(sizeof(struct i2o_device), GFP_KERNEL); - int i; - - if (d == NULL) { - printk(KERN_EMERG "i2oevtd: out of memory\n"); - break; - } - memcpy(&d->lct_data, &msg[5], sizeof(i2o_lct_entry)); - - d->next = NULL; - d->controller = c; - d->flags = 0; - - i2o_report_controller_unit(c, d); - i2o_install_device(c,d); - - for(i = 0; i < MAX_I2O_MODULES; i++) - { - if(i2o_handlers[i] && - i2o_handlers[i]->new_dev_notify && - (i2o_handlers[i]->class&d->lct_data.class_id)) - { - spin_lock(&i2o_dev_lock); - i2o_handlers[i]->new_dev_notify(c,d); - spin_unlock(&i2o_dev_lock); - } - } - - break; - } - - /* - * LCT entry for a device has been modified, so update it - * internally. - */ - case I2O_EVT_IND_EXEC_MODIFIED_LCT: - { - struct i2o_device *d; - i2o_lct_entry *new_lct = (i2o_lct_entry *)&msg[5]; - - for(d = c->devices; d; d = d->next) - { - if(d->lct_data.tid == new_lct->tid) - { - memcpy(&d->lct_data, new_lct, sizeof(i2o_lct_entry)); - break; - } - } - break; - } - - case I2O_EVT_IND_CONFIGURATION_FLAG: - printk(KERN_WARNING "%s requires user configuration\n", c->name); - break; - - case I2O_EVT_IND_GENERAL_WARNING: - printk(KERN_WARNING "%s: Warning notification received!" - "Check configuration for errors!\n", c->name); - break; - - case I2O_EVT_IND_EVT_MASK_MODIFIED: - /* Well I guess that was us hey .. */ - break; - - default: - printk(KERN_WARNING "%s: No handler for event (0x%08x)\n", c->name, msg[4]); - break; - } - } - - return 0; -} - -/* - * Dynamic LCT update. This compares the LCT with the currently - * installed devices to check for device deletions..this needed b/c there - * is no DELETED_LCT_ENTRY EventIndicator for the Executive class so - * we can't just have the event handler do this...annoying - * - * This is a hole in the spec that will hopefully be fixed someday. - */ -static int i2o_dyn_lct(void *foo) -{ - struct i2o_controller *c = (struct i2o_controller *)foo; - struct i2o_device *d = NULL; - struct i2o_device *d1 = NULL; - int i = 0; - int found = 0; - int entries; - void *tmp; - - daemonize("iop%d_lctd", c->unit); - allow_signal(SIGKILL); - - c->lct_running = 1; - - while(1) - { - down_interruptible(&c->lct_sem); - if(signal_pending(current)) - { - dprintk(KERN_ERR "%s: LCT thread dead\n", c->name); - c->lct_running = 0; - return 0; - } - - entries = c->dlct->table_size; - entries -= 3; - entries /= 9; - - dprintk(KERN_INFO "%s: Dynamic LCT Update\n",c->name); - dprintk(KERN_INFO "%s: Dynamic LCT contains %d entries\n", c->name, entries); - - if(!entries) - { - printk(KERN_INFO "%s: Empty LCT???\n", c->name); - continue; - } - - /* - * Loop through all the devices on the IOP looking for their - * LCT data in the LCT. We assume that TIDs are not repeated. - * as that is the only way to really tell. It's been confirmed - * by the IRTOS vendor(s?) that TIDs are not reused until they - * wrap arround(4096), and I doubt a system will up long enough - * to create/delete that many devices. - */ - for(d = c->devices; d; ) - { - found = 0; - d1 = d->next; - - for(i = 0; i < entries; i++) - { - if(d->lct_data.tid == c->dlct->lct_entry[i].tid) - { - found = 1; - break; - } - } - if(!found) - { - dprintk(KERN_INFO "i2o_core: Deleted device!\n"); - spin_lock(&i2o_dev_lock); - i2o_delete_device(d); - spin_unlock(&i2o_dev_lock); - } - d = d1; - } - - /* - * Tell LCT to renotify us next time there is a change - */ - i2o_lct_notify(c); - - /* - * Copy new LCT into public LCT - * - * Possible race if someone is reading LCT while we are copying - * over it. If this happens, we'll fix it then. but I doubt that - * the LCT will get updated often enough or will get read by - * a user often enough to worry. - */ - if(c->lct->table_size < c->dlct->table_size) - { - dma_addr_t phys; - tmp = c->lct; - c->lct = pci_alloc_consistent(c->pdev, c->dlct->table_size<<2, &phys); - if(!c->lct) - { - printk(KERN_ERR "%s: No memory for LCT!\n", c->name); - c->lct = tmp; - continue; - } - pci_free_consistent(tmp, c->lct->table_size << 2, c->lct, c->lct_phys); - c->lct_phys = phys; - } - memcpy(c->lct, c->dlct, c->dlct->table_size<<2); - } - - return 0; -} - -/** - * i2o_run_queue - process pending events on a controller - * @c: controller to process - * - * This is called by the bus specific driver layer when an interrupt - * or poll of this card interface is desired. - */ - -void i2o_run_queue(struct i2o_controller *c) -{ - struct i2o_message *m; - u32 mv; - u32 *msg; - - /* - * Old 960 steppings had a bug in the I2O unit that caused - * the queue to appear empty when it wasn't. - */ - if((mv=I2O_REPLY_READ32(c))==0xFFFFFFFF) - mv=I2O_REPLY_READ32(c); - - while(mv!=0xFFFFFFFF) - { - struct i2o_handler *i; - /* Map the message from the page frame map to kernel virtual */ - /* m=(struct i2o_message *)(mv - (unsigned long)c->page_frame_map + (unsigned long)c->page_frame); */ - m=(struct i2o_message *)bus_to_virt(mv); - msg=(u32*)m; - - /* - * Ensure this message is seen coherently but cachably by - * the processor - */ - - pci_dma_sync_single_for_cpu(c->pdev, c->page_frame_map, MSG_FRAME_SIZE, PCI_DMA_FROMDEVICE); - - /* - * Despatch it - */ - - i=i2o_handlers[m->initiator_context&(MAX_I2O_MODULES-1)]; - if(i && i->reply) - i->reply(i,c,m); - else - { - printk(KERN_WARNING "I2O: Spurious reply to handler %d\n", - m->initiator_context&(MAX_I2O_MODULES-1)); - } - i2o_flush_reply(c,mv); - mb(); - - /* That 960 bug again... */ - if((mv=I2O_REPLY_READ32(c))==0xFFFFFFFF) - mv=I2O_REPLY_READ32(c); - } -} - - -/** - * i2o_get_class_name - do i2o class name lookup - * @class: class number - * - * Return a descriptive string for an i2o class - */ - -const char *i2o_get_class_name(int class) -{ - int idx = 16; - static char *i2o_class_name[] = { - "Executive", - "Device Driver Module", - "Block Device", - "Tape Device", - "LAN Interface", - "WAN Interface", - "Fibre Channel Port", - "Fibre Channel Device", - "SCSI Device", - "ATE Port", - "ATE Device", - "Floppy Controller", - "Floppy Device", - "Secondary Bus Port", - "Peer Transport Agent", - "Peer Transport", - "Unknown" - }; - - switch(class&0xFFF) - { - case I2O_CLASS_EXECUTIVE: - idx = 0; break; - case I2O_CLASS_DDM: - idx = 1; break; - case I2O_CLASS_RANDOM_BLOCK_STORAGE: - idx = 2; break; - case I2O_CLASS_SEQUENTIAL_STORAGE: - idx = 3; break; - case I2O_CLASS_LAN: - idx = 4; break; - case I2O_CLASS_WAN: - idx = 5; break; - case I2O_CLASS_FIBRE_CHANNEL_PORT: - idx = 6; break; - case I2O_CLASS_FIBRE_CHANNEL_PERIPHERAL: - idx = 7; break; - case I2O_CLASS_SCSI_PERIPHERAL: - idx = 8; break; - case I2O_CLASS_ATE_PORT: - idx = 9; break; - case I2O_CLASS_ATE_PERIPHERAL: - idx = 10; break; - case I2O_CLASS_FLOPPY_CONTROLLER: - idx = 11; break; - case I2O_CLASS_FLOPPY_DEVICE: - idx = 12; break; - case I2O_CLASS_BUS_ADAPTER_PORT: - idx = 13; break; - case I2O_CLASS_PEER_TRANSPORT_AGENT: - idx = 14; break; - case I2O_CLASS_PEER_TRANSPORT: - idx = 15; break; - } - - return i2o_class_name[idx]; -} - - -/** - * i2o_wait_message - obtain an i2o message from the IOP - * @c: controller - * @why: explanation - * - * This function waits up to 5 seconds for a message slot to be - * available. If no message is available it prints an error message - * that is expected to be what the message will be used for (eg - * "get_status"). 0xFFFFFFFF is returned on a failure. - * - * On a success the message is returned. This is the physical page - * frame offset address from the read port. (See the i2o spec) - */ - -u32 i2o_wait_message(struct i2o_controller *c, char *why) -{ - long time=jiffies; - u32 m; - while((m=I2O_POST_READ32(c))==0xFFFFFFFF) - { - if((jiffies-time)>=5*HZ) - { - dprintk(KERN_ERR "%s: Timeout waiting for message frame to send %s.\n", - c->name, why); - return 0xFFFFFFFF; - } - schedule(); - barrier(); - } - return m; -} - -/** - * i2o_report_controller_unit - print information about a tid - * @c: controller - * @d: device - * - * Dump an information block associated with a given unit (TID). The - * tables are read and a block of text is output to printk that is - * formatted intended for the user. - */ - -void i2o_report_controller_unit(struct i2o_controller *c, struct i2o_device *d) -{ - char buf[64]; - char str[22]; - int ret; - int unit = d->lct_data.tid; - - if(verbose==0) - return; - - printk(KERN_INFO "Target ID %d.\n", unit); - if((ret=i2o_query_scalar(c, unit, 0xF100, 3, buf, 16))>=0) - { - buf[16]=0; - printk(KERN_INFO " Vendor: %s\n", buf); - } - if((ret=i2o_query_scalar(c, unit, 0xF100, 4, buf, 16))>=0) - { - buf[16]=0; - printk(KERN_INFO " Device: %s\n", buf); - } - if(i2o_query_scalar(c, unit, 0xF100, 5, buf, 16)>=0) - { - buf[16]=0; - printk(KERN_INFO " Description: %s\n", buf); - } - if((ret=i2o_query_scalar(c, unit, 0xF100, 6, buf, 8))>=0) - { - buf[8]=0; - printk(KERN_INFO " Rev: %s\n", buf); - } - - printk(KERN_INFO " Class: "); - sprintf(str, "%-21s", i2o_get_class_name(d->lct_data.class_id)); - printk("%s\n", str); - - printk(KERN_INFO " Subclass: 0x%04X\n", d->lct_data.sub_class); - printk(KERN_INFO " Flags: "); - - if(d->lct_data.device_flags&(1<<0)) - printk("C"); // ConfigDialog requested - if(d->lct_data.device_flags&(1<<1)) - printk("U"); // Multi-user capable - if(!(d->lct_data.device_flags&(1<<4))) - printk("P"); // Peer service enabled! - if(!(d->lct_data.device_flags&(1<<5))) - printk("M"); // Mgmt service enabled! - printk("\n"); - -} - - -/* - * Parse the hardware resource table. Right now we print it out - * and don't do a lot with it. We should collate these and then - * interact with the Linux resource allocation block. - * - * Lets prove we can read it first eh ? - * - * This is full of endianisms! - */ - -static int i2o_parse_hrt(struct i2o_controller *c) -{ -#ifdef DRIVERDEBUG - u32 *rows=(u32*)c->hrt; - u8 *p=(u8 *)c->hrt; - u8 *d; - int count; - int length; - int i; - int state; - - if(p[3]!=0) - { - printk(KERN_ERR "%s: HRT table for controller is too new a version.\n", - c->name); - return -1; - } - - count=p[0]|(p[1]<<8); - length = p[2]; - - printk(KERN_INFO "%s: HRT has %d entries of %d bytes each.\n", - c->name, count, length<<2); - - rows+=2; - - for(i=0;i>=12; - if(state&(1<<0)) - printk("H"); /* Hidden */ - if(state&(1<<2)) - { - printk("P"); /* Present */ - if(state&(1<<1)) - printk("C"); /* Controlled */ - } - if(state>9) - printk("*"); /* Hard */ - - printk("]:"); - - switch(p[3]&0xFFFF) - { - case 0: - /* Adapter private bus - easy */ - printk("Local bus %d: I/O at 0x%04X Mem 0x%08X", - p[2], d[1]<<8|d[0], *(u32 *)(d+4)); - break; - case 1: - /* ISA bus */ - printk("ISA %d: CSN %d I/O at 0x%04X Mem 0x%08X", - p[2], d[2], d[1]<<8|d[0], *(u32 *)(d+4)); - break; - - case 2: /* EISA bus */ - printk("EISA %d: Slot %d I/O at 0x%04X Mem 0x%08X", - p[2], d[3], d[1]<<8|d[0], *(u32 *)(d+4)); - break; - - case 3: /* MCA bus */ - printk("MCA %d: Slot %d I/O at 0x%04X Mem 0x%08X", - p[2], d[3], d[1]<<8|d[0], *(u32 *)(d+4)); - break; - - case 4: /* PCI bus */ - printk("PCI %d: Bus %d Device %d Function %d", - p[2], d[2], d[1], d[0]); - break; - - case 0x80: /* Other */ - default: - printk("Unsupported bus type."); - break; - } - printk("\n"); - rows+=length; - } -#endif - return 0; -} - -/* - * The logical configuration table tells us what we can talk to - * on the board. Most of the stuff isn't interesting to us. - */ - -static int i2o_parse_lct(struct i2o_controller *c) -{ - int i; - int max; - int tid; - struct i2o_device *d; - i2o_lct *lct = c->lct; - - if (lct == NULL) { - printk(KERN_ERR "%s: LCT is empty???\n", c->name); - return -1; - } - - max = lct->table_size; - max -= 3; - max /= 9; - - printk(KERN_INFO "%s: LCT has %d entries.\n", c->name, max); - - if(lct->iop_flags&(1<<0)) - printk(KERN_WARNING "%s: Configuration dialog desired.\n", c->name); - - for(i=0;icontroller = c; - d->next = NULL; - - memcpy(&d->lct_data, &lct->lct_entry[i], sizeof(i2o_lct_entry)); - - d->flags = 0; - tid = d->lct_data.tid; - - i2o_report_controller_unit(c, d); - - i2o_install_device(c, d); - } - return 0; -} - - -/** - * i2o_quiesce_controller - quiesce controller - * @c: controller - * - * Quiesce an IOP. Causes IOP to make external operation quiescent - * (i2o 'READY' state). Internal operation of the IOP continues normally. - */ - -int i2o_quiesce_controller(struct i2o_controller *c) -{ - u32 msg[4]; - int ret; - - i2o_status_get(c); - - /* SysQuiesce discarded if IOP not in READY or OPERATIONAL state */ - - if ((c->status_block->iop_state != ADAPTER_STATE_READY) && - (c->status_block->iop_state != ADAPTER_STATE_OPERATIONAL)) - { - return 0; - } - - msg[0] = FOUR_WORD_MSG_SIZE|SGL_OFFSET_0; - msg[1] = I2O_CMD_SYS_QUIESCE<<24|HOST_TID<<12|ADAPTER_TID; - msg[3] = 0; - - /* Long timeout needed for quiesce if lots of devices */ - - if ((ret = i2o_post_wait(c, msg, sizeof(msg), 240))) - printk(KERN_INFO "%s: Unable to quiesce (status=%#x).\n", - c->name, -ret); - else - dprintk(KERN_INFO "%s: Quiesced.\n", c->name); - - i2o_status_get(c); // Entered READY state - return ret; -} - -/** - * i2o_enable_controller - move controller from ready to operational - * @c: controller - * - * Enable IOP. This allows the IOP to resume external operations and - * reverses the effect of a quiesce. In the event of an error a negative - * errno code is returned. - */ - -int i2o_enable_controller(struct i2o_controller *c) -{ - u32 msg[4]; - int ret; - - i2o_status_get(c); - - /* Enable only allowed on READY state */ - if(c->status_block->iop_state != ADAPTER_STATE_READY) - return -EINVAL; - - msg[0]=FOUR_WORD_MSG_SIZE|SGL_OFFSET_0; - msg[1]=I2O_CMD_SYS_ENABLE<<24|HOST_TID<<12|ADAPTER_TID; - - /* How long of a timeout do we need? */ - - if ((ret = i2o_post_wait(c, msg, sizeof(msg), 240))) - printk(KERN_ERR "%s: Could not enable (status=%#x).\n", - c->name, -ret); - else - dprintk(KERN_INFO "%s: Enabled.\n", c->name); - - i2o_status_get(c); // entered OPERATIONAL state - - return ret; -} - -/** - * i2o_clear_controller - clear a controller - * @c: controller - * - * Clear an IOP to HOLD state, ie. terminate external operations, clear all - * input queues and prepare for a system restart. IOP's internal operation - * continues normally and the outbound queue is alive. - * The IOP is not expected to rebuild its LCT. - */ - -int i2o_clear_controller(struct i2o_controller *c) -{ - struct i2o_controller *iop; - u32 msg[4]; - int ret; - - /* Quiesce all IOPs first */ - - for (iop = i2o_controller_chain; iop; iop = iop->next) - i2o_quiesce_controller(iop); - - msg[0]=FOUR_WORD_MSG_SIZE|SGL_OFFSET_0; - msg[1]=I2O_CMD_ADAPTER_CLEAR<<24|HOST_TID<<12|ADAPTER_TID; - msg[3]=0; - - if ((ret=i2o_post_wait(c, msg, sizeof(msg), 30))) - printk(KERN_INFO "%s: Unable to clear (status=%#x).\n", - c->name, -ret); - else - dprintk(KERN_INFO "%s: Cleared.\n",c->name); - - i2o_status_get(c); - - /* Enable other IOPs */ - - for (iop = i2o_controller_chain; iop; iop = iop->next) - if (iop != c) - i2o_enable_controller(iop); - - return ret; -} - - -/** - * i2o_reset_controller - reset an IOP - * @c: controller to reset - * - * Reset the IOP into INIT state and wait until IOP gets into RESET state. - * Terminate all external operations, clear IOP's inbound and outbound - * queues, terminate all DDMs, and reload the IOP's operating environment - * and all local DDMs. The IOP rebuilds its LCT. - */ - -static int i2o_reset_controller(struct i2o_controller *c) -{ - struct i2o_controller *iop; - u32 m; - u8 *status; - dma_addr_t status_phys; - u32 *msg; - long time; - - /* Quiesce all IOPs first */ - - for (iop = i2o_controller_chain; iop; iop = iop->next) - { - if(!iop->dpt) - i2o_quiesce_controller(iop); - } - - m=i2o_wait_message(c, "AdapterReset"); - if(m==0xFFFFFFFF) - return -ETIMEDOUT; - msg=(u32 *)(c->msg_virt+m); - - status = pci_alloc_consistent(c->pdev, 4, &status_phys); - if(status == NULL) { - printk(KERN_ERR "IOP reset failed - no free memory.\n"); - return -ENOMEM; - } - memset(status, 0, 4); - - msg[0]=EIGHT_WORD_MSG_SIZE|SGL_OFFSET_0; - msg[1]=I2O_CMD_ADAPTER_RESET<<24|HOST_TID<<12|ADAPTER_TID; - msg[2]=core_context; - msg[3]=0; - msg[4]=0; - msg[5]=0; - msg[6]=status_phys; - msg[7]=0; /* 64bit host FIXME */ - - i2o_post_message(c,m); - - /* Wait for a reply */ - time=jiffies; - while(*status==0) - { - if((jiffies-time)>=20*HZ) - { - printk(KERN_ERR "IOP reset timeout.\n"); - /* The controller still may respond and overwrite - * status_phys, LEAK it to prevent memory corruption. - */ - return -ETIMEDOUT; - } - schedule(); - barrier(); - } - - if (*status==I2O_CMD_IN_PROGRESS) - { - /* - * Once the reset is sent, the IOP goes into the INIT state - * which is indeterminate. We need to wait until the IOP - * has rebooted before we can let the system talk to - * it. We read the inbound Free_List until a message is - * available. If we can't read one in the given ammount of - * time, we assume the IOP could not reboot properly. - */ - - dprintk(KERN_INFO "%s: Reset in progress, waiting for reboot...\n", - c->name); - - time = jiffies; - m = I2O_POST_READ32(c); - while(m == 0XFFFFFFFF) - { - if((jiffies-time) >= 30*HZ) - { - printk(KERN_ERR "%s: Timeout waiting for IOP reset.\n", - c->name); - /* The controller still may respond and - * overwrite status_phys, LEAK it to prevent - * memory corruption. - */ - return -ETIMEDOUT; - } - schedule(); - barrier(); - m = I2O_POST_READ32(c); - } - i2o_flush_reply(c,m); - } - - /* If IopReset was rejected or didn't perform reset, try IopClear */ - - i2o_status_get(c); - if (status[0] == I2O_CMD_REJECTED || - c->status_block->iop_state != ADAPTER_STATE_RESET) - { - printk(KERN_WARNING "%s: Reset rejected, trying to clear\n",c->name); - i2o_clear_controller(c); - } - else - dprintk(KERN_INFO "%s: Reset completed.\n", c->name); - - /* Enable other IOPs */ - - for (iop = i2o_controller_chain; iop; iop = iop->next) - if (iop != c) - i2o_enable_controller(iop); - - pci_free_consistent(c->pdev, 4, status, status_phys); - return 0; -} - - -/** - * i2o_status_get - get the status block for the IOP - * @c: controller - * - * Issue a status query on the controller. This updates the - * attached status_block. If the controller fails to reply or an - * error occurs then a negative errno code is returned. On success - * zero is returned and the status_blok is updated. - */ - -int i2o_status_get(struct i2o_controller *c) -{ - long time; - u32 m; - u32 *msg; - u8 *status_block; - - if (c->status_block == NULL) - { - c->status_block = (i2o_status_block *) - pci_alloc_consistent(c->pdev, sizeof(i2o_status_block), &c->status_block_phys); - if (c->status_block == NULL) - { - printk(KERN_CRIT "%s: Get Status Block failed; Out of memory.\n", - c->name); - return -ENOMEM; - } - } - - status_block = (u8*)c->status_block; - memset(c->status_block,0,sizeof(i2o_status_block)); - - m=i2o_wait_message(c, "StatusGet"); - if(m==0xFFFFFFFF) - return -ETIMEDOUT; - msg=(u32 *)(c->msg_virt+m); - - msg[0]=NINE_WORD_MSG_SIZE|SGL_OFFSET_0; - msg[1]=I2O_CMD_STATUS_GET<<24|HOST_TID<<12|ADAPTER_TID; - msg[2]=core_context; - msg[3]=0; - msg[4]=0; - msg[5]=0; - msg[6]=c->status_block_phys; - msg[7]=0; /* 64bit host FIXME */ - msg[8]=sizeof(i2o_status_block); /* always 88 bytes */ - - i2o_post_message(c,m); - - /* Wait for a reply */ - - time=jiffies; - while(status_block[87]!=0xFF) - { - if((jiffies-time)>=5*HZ) - { - printk(KERN_ERR "%s: Get status timeout.\n",c->name); - return -ETIMEDOUT; - } - yield(); - barrier(); - } - -#ifdef DRIVERDEBUG - printk(KERN_INFO "%s: State = ", c->name); - switch (c->status_block->iop_state) { - case 0x01: - printk("INIT\n"); - break; - case 0x02: - printk("RESET\n"); - break; - case 0x04: - printk("HOLD\n"); - break; - case 0x05: - printk("READY\n"); - break; - case 0x08: - printk("OPERATIONAL\n"); - break; - case 0x10: - printk("FAILED\n"); - break; - case 0x11: - printk("FAULTED\n"); - break; - default: - printk("%x (unknown !!)\n",c->status_block->iop_state); -} -#endif - - return 0; -} - -/* - * Get the Hardware Resource Table for the device. - * The HRT contains information about possible hidden devices - * but is mostly useless to us - */ -int i2o_hrt_get(struct i2o_controller *c) -{ - u32 msg[6]; - int ret, size = sizeof(i2o_hrt); - int loops = 3; /* we only try 3 times to get the HRT, this should be - more then enough. Worst case should be 2 times.*/ - - /* First read just the header to figure out the real size */ - - do { - /* first we allocate the memory for the HRT */ - if (c->hrt == NULL) { - c->hrt=pci_alloc_consistent(c->pdev, size, &c->hrt_phys); - if (c->hrt == NULL) { - printk(KERN_CRIT "%s: Hrt Get failed; Out of memory.\n", c->name); - return -ENOMEM; - } - c->hrt_len = size; - } - - msg[0]= SIX_WORD_MSG_SIZE| SGL_OFFSET_4; - msg[1]= I2O_CMD_HRT_GET<<24 | HOST_TID<<12 | ADAPTER_TID; - msg[3]= 0; - msg[4]= (0xD0000000 | c->hrt_len); /* Simple transaction */ - msg[5]= c->hrt_phys; /* Dump it here */ - - ret = i2o_post_wait_mem(c, msg, sizeof(msg), 20, c->hrt, NULL, c->hrt_phys, 0, c->hrt_len, 0); - - if(ret == -ETIMEDOUT) - { - /* The HRT block we used is in limbo somewhere. When the iop wakes up - we will recover it */ - c->hrt = NULL; - c->hrt_len = 0; - return ret; - } - - if(ret<0) - { - printk(KERN_ERR "%s: Unable to get HRT (status=%#x)\n", - c->name, -ret); - return ret; - } - - if (c->hrt->num_entries * c->hrt->entry_len << 2 > c->hrt_len) { - size = c->hrt->num_entries * c->hrt->entry_len << 2; - pci_free_consistent(c->pdev, c->hrt_len, c->hrt, c->hrt_phys); - c->hrt_len = 0; - c->hrt = NULL; - } - loops --; - } while (c->hrt == NULL && loops > 0); - - if(c->hrt == NULL) - { - printk(KERN_ERR "%s: Unable to get HRT after three tries, giving up\n", c->name); - return -1; - } - - i2o_parse_hrt(c); // just for debugging - - return 0; -} - -/* - * Send the I2O System Table to the specified IOP - * - * The system table contains information about all the IOPs in the - * system. It is build and then sent to each IOP so that IOPs can - * establish connections between each other. - * - */ -static int i2o_systab_send(struct i2o_controller *iop) -{ - u32 msg[12]; - dma_addr_t sys_tbl_phys; - int ret; - struct resource *root; - u32 *privbuf = kmalloc(16, GFP_KERNEL); - if(privbuf == NULL) - return -ENOMEM; - - - if(iop->status_block->current_mem_size < iop->status_block->desired_mem_size) - { - struct resource *res = &iop->mem_resource; - res->name = iop->pdev->bus->name; - res->flags = IORESOURCE_MEM; - res->start = 0; - res->end = 0; - printk("%s: requires private memory resources.\n", iop->name); - root = pci_find_parent_resource(iop->pdev, res); - if(root==NULL) - printk("Can't find parent resource!\n"); - if(root && allocate_resource(root, res, - iop->status_block->desired_mem_size, - iop->status_block->desired_mem_size, - iop->status_block->desired_mem_size, - 1<<20, /* Unspecified, so use 1Mb and play safe */ - NULL, - NULL)>=0) - { - iop->mem_alloc = 1; - iop->status_block->current_mem_size = 1 + res->end - res->start; - iop->status_block->current_mem_base = res->start; - printk(KERN_INFO "%s: allocated %ld bytes of PCI memory at 0x%08lX.\n", - iop->name, 1+res->end-res->start, res->start); - } - } - if(iop->status_block->current_io_size < iop->status_block->desired_io_size) - { - struct resource *res = &iop->io_resource; - res->name = iop->pdev->bus->name; - res->flags = IORESOURCE_IO; - res->start = 0; - res->end = 0; - printk("%s: requires private memory resources.\n", iop->name); - root = pci_find_parent_resource(iop->pdev, res); - if(root==NULL) - printk("Can't find parent resource!\n"); - if(root && allocate_resource(root, res, - iop->status_block->desired_io_size, - iop->status_block->desired_io_size, - iop->status_block->desired_io_size, - 1<<20, /* Unspecified, so use 1Mb and play safe */ - NULL, - NULL)>=0) - { - iop->io_alloc = 1; - iop->status_block->current_io_size = 1 + res->end - res->start; - iop->status_block->current_mem_base = res->start; - printk(KERN_INFO "%s: allocated %ld bytes of PCI I/O at 0x%08lX.\n", - iop->name, 1+res->end-res->start, res->start); - } - } - else - { - privbuf[0] = iop->status_block->current_mem_base; - privbuf[1] = iop->status_block->current_mem_size; - privbuf[2] = iop->status_block->current_io_base; - privbuf[3] = iop->status_block->current_io_size; - } - - msg[0] = I2O_MESSAGE_SIZE(12) | SGL_OFFSET_6; - msg[1] = I2O_CMD_SYS_TAB_SET<<24 | HOST_TID<<12 | ADAPTER_TID; - msg[3] = 0; - msg[4] = (0<<16) | ((iop->unit+2) ); /* Host 0 IOP ID (unit + 2) */ - msg[5] = 0; /* Segment 0 */ - - /* - * Provide three SGL-elements: - * System table (SysTab), Private memory space declaration and - * Private i/o space declaration - * - * Nasty one here. We can't use pci_alloc_consistent to send the - * same table to everyone. We have to go remap it for them all - */ - - sys_tbl_phys = pci_map_single(iop->pdev, sys_tbl, sys_tbl_len, PCI_DMA_TODEVICE); - msg[6] = 0x54000000 | sys_tbl_phys; - - msg[7] = sys_tbl_phys; - msg[8] = 0x54000000 | privbuf[1]; - msg[9] = privbuf[0]; - msg[10] = 0xD4000000 | privbuf[3]; - msg[11] = privbuf[2]; - - ret=i2o_post_wait(iop, msg, sizeof(msg), 120); - - pci_unmap_single(iop->pdev, sys_tbl_phys, sys_tbl_len, PCI_DMA_TODEVICE); - - if(ret==-ETIMEDOUT) - { - printk(KERN_ERR "%s: SysTab setup timed out.\n", iop->name); - } - else if(ret<0) - { - printk(KERN_ERR "%s: Unable to set SysTab (status=%#x).\n", - iop->name, -ret); - } - else - { - dprintk(KERN_INFO "%s: SysTab set.\n", iop->name); - } - i2o_status_get(iop); // Entered READY state - - kfree(privbuf); - return ret; - - } - -/* - * Initialize I2O subsystem. - */ -void __init i2o_sys_init(void) -{ - struct i2o_controller *iop, *niop = NULL; - - printk(KERN_INFO "Activating I2O controllers...\n"); - printk(KERN_INFO "This may take a few minutes if there are many devices\n"); - - /* In INIT state, Activate IOPs */ - for (iop = i2o_controller_chain; iop; iop = niop) { - dprintk(KERN_INFO "Calling i2o_activate_controller for %s...\n", - iop->name); - niop = iop->next; - if (i2o_activate_controller(iop) < 0) - i2o_delete_controller(iop); - } - - /* Active IOPs in HOLD state */ - -rebuild_sys_tab: - if (i2o_controller_chain == NULL) - return; - - /* - * If build_sys_table fails, we kill everything and bail - * as we can't init the IOPs w/o a system table - */ - dprintk(KERN_INFO "i2o_core: Calling i2o_build_sys_table...\n"); - if (i2o_build_sys_table() < 0) { - i2o_sys_shutdown(); - return; - } - - /* If IOP don't get online, we need to rebuild the System table */ - for (iop = i2o_controller_chain; iop; iop = niop) { - niop = iop->next; - dprintk(KERN_INFO "Calling i2o_online_controller for %s...\n", iop->name); - if (i2o_online_controller(iop) < 0) { - i2o_delete_controller(iop); - goto rebuild_sys_tab; - } - } - - /* Active IOPs now in OPERATIONAL state */ - - /* - * Register for status updates from all IOPs - */ - for(iop = i2o_controller_chain; iop; iop=iop->next) { - - /* Create a kernel thread to deal with dynamic LCT updates */ - iop->lct_pid = kernel_thread(i2o_dyn_lct, iop, CLONE_SIGHAND); - - /* Update change ind on DLCT */ - iop->dlct->change_ind = iop->lct->change_ind; - - /* Start dynamic LCT updates */ - i2o_lct_notify(iop); - - /* Register for all events from IRTOS */ - i2o_event_register(iop, core_context, 0, 0, 0xFFFFFFFF); - } -} - -/** - * i2o_sys_shutdown - shutdown I2O system - * - * Bring down each i2o controller and then return. Each controller - * is taken through an orderly shutdown - */ - -static void i2o_sys_shutdown(void) -{ - struct i2o_controller *iop, *niop; - - /* Delete all IOPs from the controller chain */ - /* that will reset all IOPs too */ - - for (iop = i2o_controller_chain; iop; iop = niop) { - niop = iop->next; - i2o_delete_controller(iop); - } -} - -/** - * i2o_activate_controller - bring controller up to HOLD - * @iop: controller - * - * This function brings an I2O controller into HOLD state. The adapter - * is reset if necessary and then the queues and resource table - * are read. -1 is returned on a failure, 0 on success. - * - */ - -int i2o_activate_controller(struct i2o_controller *iop) -{ - /* In INIT state, Wait Inbound Q to initialize (in i2o_status_get) */ - /* In READY state, Get status */ - - if (i2o_status_get(iop) < 0) { - printk(KERN_INFO "Unable to obtain status of %s, " - "attempting a reset.\n", iop->name); - if (i2o_reset_controller(iop) < 0) - return -1; - } - - if(iop->status_block->iop_state == ADAPTER_STATE_FAULTED) { - printk(KERN_CRIT "%s: hardware fault\n", iop->name); - return -1; - } - - if (iop->status_block->i2o_version > I2OVER15) { - printk(KERN_ERR "%s: Not running vrs. 1.5. of the I2O Specification.\n", - iop->name); - return -1; - } - - if (iop->status_block->iop_state == ADAPTER_STATE_READY || - iop->status_block->iop_state == ADAPTER_STATE_OPERATIONAL || - iop->status_block->iop_state == ADAPTER_STATE_HOLD || - iop->status_block->iop_state == ADAPTER_STATE_FAILED) - { - dprintk(KERN_INFO "%s: Already running, trying to reset...\n", - iop->name); - if (i2o_reset_controller(iop) < 0) - return -1; - } - - if (i2o_init_outbound_q(iop) < 0) - return -1; - - if (i2o_post_outbound_messages(iop)) - return -1; - - /* In HOLD state */ - - if (i2o_hrt_get(iop) < 0) - return -1; - - return 0; -} - - -/** - * i2o_init_outbound_queue - setup the outbound queue - * @c: controller - * - * Clear and (re)initialize IOP's outbound queue. Returns 0 on - * success or a negative errno code on a failure. - */ - -int i2o_init_outbound_q(struct i2o_controller *c) -{ - u8 *status; - dma_addr_t status_phys; - u32 m; - u32 *msg; - u32 time; - - dprintk(KERN_INFO "%s: Initializing Outbound Queue...\n", c->name); - m=i2o_wait_message(c, "OutboundInit"); - if(m==0xFFFFFFFF) - return -ETIMEDOUT; - msg=(u32 *)(c->msg_virt+m); - - status = pci_alloc_consistent(c->pdev, 4, &status_phys); - if (status==NULL) { - printk(KERN_ERR "%s: Outbound Queue initialization failed - no free memory.\n", - c->name); - return -ENOMEM; - } - memset(status, 0, 4); - - msg[0]= EIGHT_WORD_MSG_SIZE| TRL_OFFSET_6; - msg[1]= I2O_CMD_OUTBOUND_INIT<<24 | HOST_TID<<12 | ADAPTER_TID; - msg[2]= core_context; - msg[3]= 0x0106; /* Transaction context */ - msg[4]= 4096; /* Host page frame size */ - /* Frame size is in words. 256 bytes a frame for now */ - msg[5]= MSG_FRAME_SIZE<<16|0x80; /* Outbound msg frame size in words and Initcode */ - msg[6]= 0xD0000004; /* Simple SG LE, EOB */ - msg[7]= status_phys; - - i2o_post_message(c,m); - - barrier(); - time=jiffies; - while(status[0] < I2O_CMD_REJECTED) - { - if((jiffies-time)>=30*HZ) - { - if(status[0]==0x00) - printk(KERN_ERR "%s: Ignored queue initialize request.\n", - c->name); - else - printk(KERN_ERR "%s: Outbound queue initialize timeout.\n", - c->name); - pci_free_consistent(c->pdev, 4, status, status_phys); - return -ETIMEDOUT; - } - yield(); - barrier(); - } - - if(status[0] != I2O_CMD_COMPLETED) - { - printk(KERN_ERR "%s: IOP outbound initialise failed.\n", c->name); - pci_free_consistent(c->pdev, 4, status, status_phys); - return -ETIMEDOUT; - } - pci_free_consistent(c->pdev, 4, status, status_phys); - return 0; -} - -/** - * i2o_post_outbound_messages - fill message queue - * @c: controller - * - * Allocate a message frame and load the messages into the IOP. The - * function returns zero on success or a negative errno code on - * failure. - */ - -int i2o_post_outbound_messages(struct i2o_controller *c) -{ - int i; - u32 m; - /* Alloc space for IOP's outbound queue message frames */ - - c->page_frame = kmalloc(MSG_POOL_SIZE, GFP_KERNEL); - if(c->page_frame==NULL) { - printk(KERN_ERR "%s: Outbound Q initialize failed; out of memory.\n", - c->name); - return -ENOMEM; - } - - c->page_frame_map = pci_map_single(c->pdev, c->page_frame, MSG_POOL_SIZE, PCI_DMA_FROMDEVICE); - - if(c->page_frame_map == 0) - { - kfree(c->page_frame); - printk(KERN_ERR "%s: Unable to map outbound queue.\n", c->name); - return -ENOMEM; - } - - m = c->page_frame_map; - - /* Post frames */ - - for(i=0; i< NMBR_MSG_FRAMES; i++) { - I2O_REPLY_WRITE32(c,m); - mb(); - m += (MSG_FRAME_SIZE << 2); - } - - return 0; -} - -/* - * Get the IOP's Logical Configuration Table - */ -int i2o_lct_get(struct i2o_controller *c) -{ - u32 msg[8]; - int ret, size = c->status_block->expected_lct_size; - - do { - if (c->lct == NULL) { - c->lct = pci_alloc_consistent(c->pdev, size, &c->lct_phys); - if(c->lct == NULL) { - printk(KERN_CRIT "%s: Lct Get failed. Out of memory.\n", - c->name); - return -ENOMEM; - } - } - memset(c->lct, 0, size); - - msg[0] = EIGHT_WORD_MSG_SIZE|SGL_OFFSET_6; - msg[1] = I2O_CMD_LCT_NOTIFY<<24 | HOST_TID<<12 | ADAPTER_TID; - /* msg[2] filled in i2o_post_wait */ - msg[3] = 0; - msg[4] = 0xFFFFFFFF; /* All devices */ - msg[5] = 0x00000000; /* Report now */ - msg[6] = 0xD0000000|size; - msg[7] = c->lct_phys; - - ret=i2o_post_wait_mem(c, msg, sizeof(msg), 120, c->lct, NULL, c->lct_phys, 0, size, 0); - - if(ret == -ETIMEDOUT) - { - c->lct = NULL; - return ret; - } - - if(ret<0) - { - printk(KERN_ERR "%s: LCT Get failed (status=%#x.\n", - c->name, -ret); - return ret; - } - - if (c->lct->table_size << 2 > size) { - int new_size = c->lct->table_size << 2; - pci_free_consistent(c->pdev, size, c->lct, c->lct_phys); - size = new_size; - c->lct = NULL; - } - } while (c->lct == NULL); - - if ((ret=i2o_parse_lct(c)) < 0) - return ret; - - return 0; -} - -/* - * Like above, but used for async notification. The main - * difference is that we keep track of the CurrentChangeIndiicator - * so that we only get updates when it actually changes. - * - */ -int i2o_lct_notify(struct i2o_controller *c) -{ - u32 msg[8]; - - msg[0] = EIGHT_WORD_MSG_SIZE|SGL_OFFSET_6; - msg[1] = I2O_CMD_LCT_NOTIFY<<24 | HOST_TID<<12 | ADAPTER_TID; - msg[2] = core_context; - msg[3] = 0xDEADBEEF; - msg[4] = 0xFFFFFFFF; /* All devices */ - msg[5] = c->dlct->change_ind+1; /* Next change */ - msg[6] = 0xD0000000|8192; - msg[7] = c->dlct_phys; - - return i2o_post_this(c, msg, sizeof(msg)); -} - -/* - * Bring a controller online into OPERATIONAL state. - */ - -int i2o_online_controller(struct i2o_controller *iop) -{ - u32 v; - - if (i2o_systab_send(iop) < 0) - return -1; - - /* In READY state */ - - dprintk(KERN_INFO "%s: Attempting to enable...\n", iop->name); - if (i2o_enable_controller(iop) < 0) - return -1; - - /* In OPERATIONAL state */ - - dprintk(KERN_INFO "%s: Attempting to get/parse lct...\n", iop->name); - if (i2o_lct_get(iop) < 0) - return -1; - - /* Check battery status */ - - iop->battery = 0; - if(i2o_query_scalar(iop, ADAPTER_TID, 0x0000, 4, &v, 4)>=0) - { - if(v&16) - iop->battery = 1; - } - - return 0; -} - -/* - * Build system table - * - * The system table contains information about all the IOPs in the - * system (duh) and is used by the Executives on the IOPs to establish - * peer2peer connections. We're not supporting peer2peer at the moment, - * but this will be needed down the road for things like lan2lan forwarding. - */ -static int i2o_build_sys_table(void) -{ - struct i2o_controller *iop = NULL; - struct i2o_controller *niop = NULL; - int count = 0; - - sys_tbl_len = sizeof(struct i2o_sys_tbl) + // Header + IOPs - (i2o_num_controllers) * - sizeof(struct i2o_sys_tbl_entry); - - if(sys_tbl) - kfree(sys_tbl); - - sys_tbl = kmalloc(sys_tbl_len, GFP_KERNEL); - if(!sys_tbl) { - printk(KERN_CRIT "SysTab Set failed. Out of memory.\n"); - return -ENOMEM; - } - memset((void*)sys_tbl, 0, sys_tbl_len); - - sys_tbl->num_entries = i2o_num_controllers; - sys_tbl->version = I2OVERSION; /* TODO: Version 2.0 */ - sys_tbl->change_ind = sys_tbl_ind++; - - for(iop = i2o_controller_chain; iop; iop = niop) - { - niop = iop->next; - - /* - * Get updated IOP state so we have the latest information - * - * We should delete the controller at this point if it - * doesn't respond since if it's not on the system table - * it is techninically not part of the I2O subsyßtem... - */ - if(i2o_status_get(iop)) { - printk(KERN_ERR "%s: Deleting b/c could not get status while" - "attempting to build system table\n", iop->name); - i2o_delete_controller(iop); - sys_tbl->num_entries--; - continue; // try the next one - } - - sys_tbl->iops[count].org_id = iop->status_block->org_id; - sys_tbl->iops[count].iop_id = iop->unit + 2; - sys_tbl->iops[count].seg_num = 0; - sys_tbl->iops[count].i2o_version = - iop->status_block->i2o_version; - sys_tbl->iops[count].iop_state = - iop->status_block->iop_state; - sys_tbl->iops[count].msg_type = - iop->status_block->msg_type; - sys_tbl->iops[count].frame_size = - iop->status_block->inbound_frame_size; - sys_tbl->iops[count].last_changed = sys_tbl_ind - 1; // ?? - sys_tbl->iops[count].iop_capabilities = - iop->status_block->iop_capabilities; - sys_tbl->iops[count].inbound_low = (u32)iop->post_port; - sys_tbl->iops[count].inbound_high = 0; // FIXME: 64-bit support - - count++; - } - -#ifdef DRIVERDEBUG -{ - u32 *table; - table = (u32*)sys_tbl; - for(count = 0; count < (sys_tbl_len >>2); count++) - printk(KERN_INFO "sys_tbl[%d] = %0#10x\n", count, table[count]); -} -#endif - - return 0; -} - - -/* - * Run time support routines - */ - -/* - * Generic "post and forget" helpers. This is less efficient - we do - * a memcpy for example that isnt strictly needed, but for most uses - * this is simply not worth optimising - */ - -int i2o_post_this(struct i2o_controller *c, u32 *data, int len) -{ - u32 m; - u32 *msg; - unsigned long t=jiffies; - - do - { - mb(); - m = I2O_POST_READ32(c); - } - while(m==0xFFFFFFFF && (jiffies-t)name); - return -ETIMEDOUT; - } - msg = (u32 *)(c->msg_virt + m); - memcpy_toio(msg, data, len); - i2o_post_message(c,m); - return 0; -} - -/** - * i2o_post_wait_mem - I2O query/reply with DMA buffers - * @c: controller - * @msg: message to send - * @len: length of message - * @timeout: time in seconds to wait - * @mem1: attached memory buffer 1 - * @mem2: attached memory buffer 2 - * @phys1: physical address of buffer 1 - * @phys2: physical address of buffer 2 - * @size1: size of buffer 1 - * @size2: size of buffer 2 - * - * This core API allows an OSM to post a message and then be told whether - * or not the system received a successful reply. - * - * If the message times out then the value '-ETIMEDOUT' is returned. This - * is a special case. In this situation the message may (should) complete - * at an indefinite time in the future. When it completes it will use the - * memory buffers attached to the request. If -ETIMEDOUT is returned then - * the memory buffers must not be freed. Instead the event completion will - * free them for you. In all other cases the buffers are your problem. - * - * Pass NULL for unneeded buffers. - */ - -int i2o_post_wait_mem(struct i2o_controller *c, u32 *msg, int len, int timeout, void *mem1, void *mem2, dma_addr_t phys1, dma_addr_t phys2, int size1, int size2) -{ - DECLARE_WAIT_QUEUE_HEAD(wq_i2o_post); - DECLARE_WAITQUEUE(wait, current); - int complete = 0; - int status; - unsigned long flags = 0; - struct i2o_post_wait_data *wait_data = - kmalloc(sizeof(struct i2o_post_wait_data), GFP_KERNEL); - - if(!wait_data) - return -ENOMEM; - - /* - * Create a new notification object - */ - wait_data->status = &status; - wait_data->complete = &complete; - wait_data->mem[0] = mem1; - wait_data->mem[1] = mem2; - wait_data->phys[0] = phys1; - wait_data->phys[1] = phys2; - wait_data->size[0] = size1; - wait_data->size[1] = size2; - - /* - * Queue the event with its unique id - */ - spin_lock_irqsave(&post_wait_lock, flags); - - wait_data->next = post_wait_queue; - post_wait_queue = wait_data; - wait_data->id = (++post_wait_id) & 0x7fff; - wait_data->wq = &wq_i2o_post; - - spin_unlock_irqrestore(&post_wait_lock, flags); - - /* - * Fill in the message id - */ - - msg[2] = 0x80000000|(u32)core_context|((u32)wait_data->id<<16); - - /* - * Post the message to the controller. At some point later it - * will return. If we time out before it returns then - * complete will be zero. From the point post_this returns - * the wait_data may have been deleted. - */ - - add_wait_queue(&wq_i2o_post, &wait); - set_current_state(TASK_INTERRUPTIBLE); - if ((status = i2o_post_this(c, msg, len))==0) { - schedule_timeout(HZ * timeout); - } - else - { - remove_wait_queue(&wq_i2o_post, &wait); - return -EIO; - } - remove_wait_queue(&wq_i2o_post, &wait); - - if(signal_pending(current)) - status = -EINTR; - - spin_lock_irqsave(&post_wait_lock, flags); - barrier(); /* Be sure we see complete as it is locked */ - if(!complete) - { - /* - * Mark the entry dead. We cannot remove it. This is important. - * When it does terminate (which it must do if the controller hasnt - * died..) then it will otherwise scribble on stuff. - * !complete lets us safely check if the entry is still - * allocated and thus we can write into it - */ - wait_data->wq = NULL; - status = -ETIMEDOUT; - } - else - { - /* Debugging check - remove me soon */ - if(status == -ETIMEDOUT) - { - printk("TIMEDOUT BUG!\n"); - status = -EIO; - } - } - /* And the wait_data is not leaked either! */ - spin_unlock_irqrestore(&post_wait_lock, flags); - return status; -} - -/** - * i2o_post_wait - I2O query/reply - * @c: controller - * @msg: message to send - * @len: length of message - * @timeout: time in seconds to wait - * - * This core API allows an OSM to post a message and then be told whether - * or not the system received a successful reply. - */ - -int i2o_post_wait(struct i2o_controller *c, u32 *msg, int len, int timeout) -{ - return i2o_post_wait_mem(c, msg, len, timeout, NULL, NULL, 0, 0, 0, 0); -} - -/* - * i2o_post_wait is completed and we want to wake up the - * sleeping proccess. Called by core's reply handler. - */ - -static void i2o_post_wait_complete(struct i2o_controller *c, u32 context, int status) -{ - struct i2o_post_wait_data **p1, *q; - unsigned long flags; - - /* - * We need to search through the post_wait - * queue to see if the given message is still - * outstanding. If not, it means that the IOP - * took longer to respond to the message than we - * had allowed and timer has already expired. - * Not much we can do about that except log - * it for debug purposes, increase timeout, and recompile - * - * Lock needed to keep anyone from moving queue pointers - * around while we're looking through them. - */ - - spin_lock_irqsave(&post_wait_lock, flags); - - for(p1 = &post_wait_queue; *p1!=NULL; p1 = &((*p1)->next)) - { - q = (*p1); - if(q->id == ((context >> 16) & 0x7fff)) { - /* - * Delete it - */ - - *p1 = q->next; - - /* - * Live or dead ? - */ - - if(q->wq) - { - /* Live entry - wakeup and set status */ - *q->status = status; - *q->complete = 1; - wake_up(q->wq); - } - else - { - /* - * Free resources. Caller is dead - */ - - if(q->mem[0]) - pci_free_consistent(c->pdev, q->size[0], q->mem[0], q->phys[0]); - if(q->mem[1]) - pci_free_consistent(c->pdev, q->size[1], q->mem[1], q->phys[1]); - - printk(KERN_WARNING "i2o_post_wait event completed after timeout.\n"); - } - kfree(q); - spin_unlock(&post_wait_lock); - return; - } - } - spin_unlock(&post_wait_lock); - - printk(KERN_DEBUG "i2o_post_wait: Bogus reply!\n"); -} - -/* Issue UTIL_PARAMS_GET or UTIL_PARAMS_SET - * - * This function can be used for all UtilParamsGet/Set operations. - * The OperationList is given in oplist-buffer, - * and results are returned in reslist-buffer. - * Note that the minimum sized reslist is 8 bytes and contains - * ResultCount, ErrorInfoSize, BlockStatus and BlockSize. - */ - -int i2o_issue_params(int cmd, struct i2o_controller *iop, int tid, - void *oplist, int oplen, void *reslist, int reslen) -{ - u32 msg[9]; - u32 *res32 = (u32*)reslist; - u32 *restmp = (u32*)reslist; - int len = 0; - int i = 0; - int wait_status; - u32 *opmem, *resmem; - dma_addr_t opmem_phys, resmem_phys; - - /* Get DMAable memory */ - opmem = pci_alloc_consistent(iop->pdev, oplen, &opmem_phys); - if(opmem == NULL) - return -ENOMEM; - memcpy(opmem, oplist, oplen); - - resmem = pci_alloc_consistent(iop->pdev, reslen, &resmem_phys); - if(resmem == NULL) - { - pci_free_consistent(iop->pdev, oplen, opmem, opmem_phys); - return -ENOMEM; - } - - msg[0] = NINE_WORD_MSG_SIZE | SGL_OFFSET_5; - msg[1] = cmd << 24 | HOST_TID << 12 | tid; - msg[3] = 0; - msg[4] = 0; - msg[5] = 0x54000000 | oplen; /* OperationList */ - msg[6] = opmem_phys; - msg[7] = 0xD0000000 | reslen; /* ResultList */ - msg[8] = resmem_phys; - - wait_status = i2o_post_wait_mem(iop, msg, sizeof(msg), 10, opmem, resmem, opmem_phys, resmem_phys, oplen, reslen); - - /* - * This only looks like a memory leak - don't "fix" it. - */ - if(wait_status == -ETIMEDOUT) - return wait_status; - - memcpy(reslist, resmem, reslen); - pci_free_consistent(iop->pdev, reslen, resmem, resmem_phys); - pci_free_consistent(iop->pdev, oplen, opmem, opmem_phys); - - /* Query failed */ - if(wait_status != 0) - return wait_status; - /* - * Calculate number of bytes of Result LIST - * We need to loop through each Result BLOCK and grab the length - */ - restmp = res32 + 1; - len = 1; - for(i = 0; i < (res32[0]&0X0000FFFF); i++) - { - if(restmp[0]&0x00FF0000) /* BlockStatus != SUCCESS */ - { - printk(KERN_WARNING "%s - Error:\n ErrorInfoSize = 0x%02x, " - "BlockStatus = 0x%02x, BlockSize = 0x%04x\n", - (cmd == I2O_CMD_UTIL_PARAMS_SET) ? "PARAMS_SET" - : "PARAMS_GET", - res32[1]>>24, (res32[1]>>16)&0xFF, res32[1]&0xFFFF); - - /* - * If this is the only request,than we return an error - */ - if((res32[0]&0x0000FFFF) == 1) - { - return -((res32[1] >> 16) & 0xFF); /* -BlockStatus */ - } - } - len += restmp[0] & 0x0000FFFF; /* Length of res BLOCK */ - restmp += restmp[0] & 0x0000FFFF; /* Skip to next BLOCK */ - } - return (len << 2); /* bytes used by result list */ -} - -/* - * Query one scalar group value or a whole scalar group. - */ -int i2o_query_scalar(struct i2o_controller *iop, int tid, - int group, int field, void *buf, int buflen) -{ - u16 opblk[] = { 1, 0, I2O_PARAMS_FIELD_GET, group, 1, field }; - u8 resblk[8+buflen]; /* 8 bytes for header */ - int size; - - if (field == -1) /* whole group */ - opblk[4] = -1; - - size = i2o_issue_params(I2O_CMD_UTIL_PARAMS_GET, iop, tid, - opblk, sizeof(opblk), resblk, sizeof(resblk)); - - memcpy(buf, resblk+8, buflen); /* cut off header */ - - if(size>buflen) - return buflen; - return size; -} - -/* - * Set a scalar group value or a whole group. - */ -int i2o_set_scalar(struct i2o_controller *iop, int tid, - int group, int field, void *buf, int buflen) -{ - u16 *opblk; - u8 resblk[8+buflen]; /* 8 bytes for header */ - int size; - - opblk = kmalloc(buflen+64, GFP_KERNEL); - if (opblk == NULL) - { - printk(KERN_ERR "i2o: no memory for operation buffer.\n"); - return -ENOMEM; - } - - opblk[0] = 1; /* operation count */ - opblk[1] = 0; /* pad */ - opblk[2] = I2O_PARAMS_FIELD_SET; - opblk[3] = group; - - if(field == -1) { /* whole group */ - opblk[4] = -1; - memcpy(opblk+5, buf, buflen); - } - else /* single field */ - { - opblk[4] = 1; - opblk[5] = field; - memcpy(opblk+6, buf, buflen); - } - - size = i2o_issue_params(I2O_CMD_UTIL_PARAMS_SET, iop, tid, - opblk, 12+buflen, resblk, sizeof(resblk)); - - kfree(opblk); - if(size>buflen) - return buflen; - return size; -} - -/* - * if oper == I2O_PARAMS_TABLE_GET, get from all rows - * if fieldcount == -1 return all fields - * ibuf and ibuflen are unused (use NULL, 0) - * else return specific fields - * ibuf contains fieldindexes - * - * if oper == I2O_PARAMS_LIST_GET, get from specific rows - * if fieldcount == -1 return all fields - * ibuf contains rowcount, keyvalues - * else return specific fields - * fieldcount is # of fieldindexes - * ibuf contains fieldindexes, rowcount, keyvalues - * - * You could also use directly function i2o_issue_params(). - */ -int i2o_query_table(int oper, struct i2o_controller *iop, int tid, int group, - int fieldcount, void *ibuf, int ibuflen, - void *resblk, int reslen) -{ - u16 *opblk; - int size; - - opblk = kmalloc(10 + ibuflen, GFP_KERNEL); - if (opblk == NULL) - { - printk(KERN_ERR "i2o: no memory for query buffer.\n"); - return -ENOMEM; - } - - opblk[0] = 1; /* operation count */ - opblk[1] = 0; /* pad */ - opblk[2] = oper; - opblk[3] = group; - opblk[4] = fieldcount; - memcpy(opblk+5, ibuf, ibuflen); /* other params */ - - size = i2o_issue_params(I2O_CMD_UTIL_PARAMS_GET,iop, tid, - opblk, 10+ibuflen, resblk, reslen); - - kfree(opblk); - if(size>reslen) - return reslen; - return size; -} - -/* - * Clear table group, i.e. delete all rows. - */ -int i2o_clear_table(struct i2o_controller *iop, int tid, int group) -{ - u16 opblk[] = { 1, 0, I2O_PARAMS_TABLE_CLEAR, group }; - u8 resblk[32]; /* min 8 bytes for result header */ - - return i2o_issue_params(I2O_CMD_UTIL_PARAMS_SET, iop, tid, - opblk, sizeof(opblk), resblk, sizeof(resblk)); -} - -/* - * Add a new row into a table group. - * - * if fieldcount==-1 then we add whole rows - * buf contains rowcount, keyvalues - * else just specific fields are given, rest use defaults - * buf contains fieldindexes, rowcount, keyvalues - */ -int i2o_row_add_table(struct i2o_controller *iop, int tid, - int group, int fieldcount, void *buf, int buflen) -{ - u16 *opblk; - u8 resblk[32]; /* min 8 bytes for header */ - int size; - - opblk = kmalloc(buflen+64, GFP_KERNEL); - if (opblk == NULL) - { - printk(KERN_ERR "i2o: no memory for operation buffer.\n"); - return -ENOMEM; - } - - opblk[0] = 1; /* operation count */ - opblk[1] = 0; /* pad */ - opblk[2] = I2O_PARAMS_ROW_ADD; - opblk[3] = group; - opblk[4] = fieldcount; - memcpy(opblk+5, buf, buflen); - - size = i2o_issue_params(I2O_CMD_UTIL_PARAMS_SET, iop, tid, - opblk, 10+buflen, resblk, sizeof(resblk)); - - kfree(opblk); - if(size>buflen) - return buflen; - return size; -} - - -/* - * Used for error reporting/debugging purposes. - * Following fail status are common to all classes. - * The preserved message must be handled in the reply handler. - */ -void i2o_report_fail_status(u8 req_status, u32* msg) -{ - static char *FAIL_STATUS[] = { - "0x80", /* not used */ - "SERVICE_SUSPENDED", /* 0x81 */ - "SERVICE_TERMINATED", /* 0x82 */ - "CONGESTION", - "FAILURE", - "STATE_ERROR", - "TIME_OUT", - "ROUTING_FAILURE", - "INVALID_VERSION", - "INVALID_OFFSET", - "INVALID_MSG_FLAGS", - "FRAME_TOO_SMALL", - "FRAME_TOO_LARGE", - "INVALID_TARGET_ID", - "INVALID_INITIATOR_ID", - "INVALID_INITIATOR_CONTEX", /* 0x8F */ - "UNKNOWN_FAILURE" /* 0xFF */ - }; - - if (req_status == I2O_FSC_TRANSPORT_UNKNOWN_FAILURE) - printk("TRANSPORT_UNKNOWN_FAILURE (%0#2x)\n.", req_status); - else - printk("TRANSPORT_%s.\n", FAIL_STATUS[req_status & 0x0F]); - - /* Dump some details */ - - printk(KERN_ERR " InitiatorId = %d, TargetId = %d\n", - (msg[1] >> 12) & 0xFFF, msg[1] & 0xFFF); - printk(KERN_ERR " LowestVersion = 0x%02X, HighestVersion = 0x%02X\n", - (msg[4] >> 8) & 0xFF, msg[4] & 0xFF); - printk(KERN_ERR " FailingHostUnit = 0x%04X, FailingIOP = 0x%03X\n", - msg[5] >> 16, msg[5] & 0xFFF); - - printk(KERN_ERR " Severity: 0x%02X ", (msg[4] >> 16) & 0xFF); - if (msg[4] & (1<<16)) - printk("(FormatError), " - "this msg can never be delivered/processed.\n"); - if (msg[4] & (1<<17)) - printk("(PathError), " - "this msg can no longer be delivered/processed.\n"); - if (msg[4] & (1<<18)) - printk("(PathState), " - "the system state does not allow delivery.\n"); - if (msg[4] & (1<<19)) - printk("(Congestion), resources temporarily not available;" - "do not retry immediately.\n"); -} - -/* - * Used for error reporting/debugging purposes. - * Following reply status are common to all classes. - */ -void i2o_report_common_status(u8 req_status) -{ - static char *REPLY_STATUS[] = { - "SUCCESS", - "ABORT_DIRTY", - "ABORT_NO_DATA_TRANSFER", - "ABORT_PARTIAL_TRANSFER", - "ERROR_DIRTY", - "ERROR_NO_DATA_TRANSFER", - "ERROR_PARTIAL_TRANSFER", - "PROCESS_ABORT_DIRTY", - "PROCESS_ABORT_NO_DATA_TRANSFER", - "PROCESS_ABORT_PARTIAL_TRANSFER", - "TRANSACTION_ERROR", - "PROGRESS_REPORT" - }; - - if (req_status >= ARRAY_SIZE(REPLY_STATUS)) - printk("RequestStatus = %0#2x", req_status); - else - printk("%s", REPLY_STATUS[req_status]); -} - -/* - * Used for error reporting/debugging purposes. - * Following detailed status are valid for executive class, - * utility class, DDM class and for transaction error replies. - */ -static void i2o_report_common_dsc(u16 detailed_status) -{ - static char *COMMON_DSC[] = { - "SUCCESS", - "0x01", // not used - "BAD_KEY", - "TCL_ERROR", - "REPLY_BUFFER_FULL", - "NO_SUCH_PAGE", - "INSUFFICIENT_RESOURCE_SOFT", - "INSUFFICIENT_RESOURCE_HARD", - "0x08", // not used - "CHAIN_BUFFER_TOO_LARGE", - "UNSUPPORTED_FUNCTION", - "DEVICE_LOCKED", - "DEVICE_RESET", - "INAPPROPRIATE_FUNCTION", - "INVALID_INITIATOR_ADDRESS", - "INVALID_MESSAGE_FLAGS", - "INVALID_OFFSET", - "INVALID_PARAMETER", - "INVALID_REQUEST", - "INVALID_TARGET_ADDRESS", - "MESSAGE_TOO_LARGE", - "MESSAGE_TOO_SMALL", - "MISSING_PARAMETER", - "TIMEOUT", - "UNKNOWN_ERROR", - "UNKNOWN_FUNCTION", - "UNSUPPORTED_VERSION", - "DEVICE_BUSY", - "DEVICE_NOT_AVAILABLE" - }; - - if (detailed_status > I2O_DSC_DEVICE_NOT_AVAILABLE) - printk(" / DetailedStatus = %0#4x.\n", detailed_status); - else - printk(" / %s.\n", COMMON_DSC[detailed_status]); -} - -/* - * Used for error reporting/debugging purposes - */ -static void i2o_report_lan_dsc(u16 detailed_status) -{ - static char *LAN_DSC[] = { // Lan detailed status code strings - "SUCCESS", - "DEVICE_FAILURE", - "DESTINATION_NOT_FOUND", - "TRANSMIT_ERROR", - "TRANSMIT_ABORTED", - "RECEIVE_ERROR", - "RECEIVE_ABORTED", - "DMA_ERROR", - "BAD_PACKET_DETECTED", - "OUT_OF_MEMORY", - "BUCKET_OVERRUN", - "IOP_INTERNAL_ERROR", - "CANCELED", - "INVALID_TRANSACTION_CONTEXT", - "DEST_ADDRESS_DETECTED", - "DEST_ADDRESS_OMITTED", - "PARTIAL_PACKET_RETURNED", - "TEMP_SUSPENDED_STATE", // last Lan detailed status code - "INVALID_REQUEST" // general detailed status code - }; - - if (detailed_status > I2O_DSC_INVALID_REQUEST) - printk(" / %0#4x.\n", detailed_status); - else - printk(" / %s.\n", LAN_DSC[detailed_status]); -} - -/* - * Used for error reporting/debugging purposes - */ -static void i2o_report_util_cmd(u8 cmd) -{ - switch (cmd) { - case I2O_CMD_UTIL_NOP: - printk("UTIL_NOP, "); - break; - case I2O_CMD_UTIL_ABORT: - printk("UTIL_ABORT, "); - break; - case I2O_CMD_UTIL_CLAIM: - printk("UTIL_CLAIM, "); - break; - case I2O_CMD_UTIL_RELEASE: - printk("UTIL_CLAIM_RELEASE, "); - break; - case I2O_CMD_UTIL_CONFIG_DIALOG: - printk("UTIL_CONFIG_DIALOG, "); - break; - case I2O_CMD_UTIL_DEVICE_RESERVE: - printk("UTIL_DEVICE_RESERVE, "); - break; - case I2O_CMD_UTIL_DEVICE_RELEASE: - printk("UTIL_DEVICE_RELEASE, "); - break; - case I2O_CMD_UTIL_EVT_ACK: - printk("UTIL_EVENT_ACKNOWLEDGE, "); - break; - case I2O_CMD_UTIL_EVT_REGISTER: - printk("UTIL_EVENT_REGISTER, "); - break; - case I2O_CMD_UTIL_LOCK: - printk("UTIL_LOCK, "); - break; - case I2O_CMD_UTIL_LOCK_RELEASE: - printk("UTIL_LOCK_RELEASE, "); - break; - case I2O_CMD_UTIL_PARAMS_GET: - printk("UTIL_PARAMS_GET, "); - break; - case I2O_CMD_UTIL_PARAMS_SET: - printk("UTIL_PARAMS_SET, "); - break; - case I2O_CMD_UTIL_REPLY_FAULT_NOTIFY: - printk("UTIL_REPLY_FAULT_NOTIFY, "); - break; - default: - printk("Cmd = %0#2x, ",cmd); - } -} - -/* - * Used for error reporting/debugging purposes - */ -static void i2o_report_exec_cmd(u8 cmd) -{ - switch (cmd) { - case I2O_CMD_ADAPTER_ASSIGN: - printk("EXEC_ADAPTER_ASSIGN, "); - break; - case I2O_CMD_ADAPTER_READ: - printk("EXEC_ADAPTER_READ, "); - break; - case I2O_CMD_ADAPTER_RELEASE: - printk("EXEC_ADAPTER_RELEASE, "); - break; - case I2O_CMD_BIOS_INFO_SET: - printk("EXEC_BIOS_INFO_SET, "); - break; - case I2O_CMD_BOOT_DEVICE_SET: - printk("EXEC_BOOT_DEVICE_SET, "); - break; - case I2O_CMD_CONFIG_VALIDATE: - printk("EXEC_CONFIG_VALIDATE, "); - break; - case I2O_CMD_CONN_SETUP: - printk("EXEC_CONN_SETUP, "); - break; - case I2O_CMD_DDM_DESTROY: - printk("EXEC_DDM_DESTROY, "); - break; - case I2O_CMD_DDM_ENABLE: - printk("EXEC_DDM_ENABLE, "); - break; - case I2O_CMD_DDM_QUIESCE: - printk("EXEC_DDM_QUIESCE, "); - break; - case I2O_CMD_DDM_RESET: - printk("EXEC_DDM_RESET, "); - break; - case I2O_CMD_DDM_SUSPEND: - printk("EXEC_DDM_SUSPEND, "); - break; - case I2O_CMD_DEVICE_ASSIGN: - printk("EXEC_DEVICE_ASSIGN, "); - break; - case I2O_CMD_DEVICE_RELEASE: - printk("EXEC_DEVICE_RELEASE, "); - break; - case I2O_CMD_HRT_GET: - printk("EXEC_HRT_GET, "); - break; - case I2O_CMD_ADAPTER_CLEAR: - printk("EXEC_IOP_CLEAR, "); - break; - case I2O_CMD_ADAPTER_CONNECT: - printk("EXEC_IOP_CONNECT, "); - break; - case I2O_CMD_ADAPTER_RESET: - printk("EXEC_IOP_RESET, "); - break; - case I2O_CMD_LCT_NOTIFY: - printk("EXEC_LCT_NOTIFY, "); - break; - case I2O_CMD_OUTBOUND_INIT: - printk("EXEC_OUTBOUND_INIT, "); - break; - case I2O_CMD_PATH_ENABLE: - printk("EXEC_PATH_ENABLE, "); - break; - case I2O_CMD_PATH_QUIESCE: - printk("EXEC_PATH_QUIESCE, "); - break; - case I2O_CMD_PATH_RESET: - printk("EXEC_PATH_RESET, "); - break; - case I2O_CMD_STATIC_MF_CREATE: - printk("EXEC_STATIC_MF_CREATE, "); - break; - case I2O_CMD_STATIC_MF_RELEASE: - printk("EXEC_STATIC_MF_RELEASE, "); - break; - case I2O_CMD_STATUS_GET: - printk("EXEC_STATUS_GET, "); - break; - case I2O_CMD_SW_DOWNLOAD: - printk("EXEC_SW_DOWNLOAD, "); - break; - case I2O_CMD_SW_UPLOAD: - printk("EXEC_SW_UPLOAD, "); - break; - case I2O_CMD_SW_REMOVE: - printk("EXEC_SW_REMOVE, "); - break; - case I2O_CMD_SYS_ENABLE: - printk("EXEC_SYS_ENABLE, "); - break; - case I2O_CMD_SYS_MODIFY: - printk("EXEC_SYS_MODIFY, "); - break; - case I2O_CMD_SYS_QUIESCE: - printk("EXEC_SYS_QUIESCE, "); - break; - case I2O_CMD_SYS_TAB_SET: - printk("EXEC_SYS_TAB_SET, "); - break; - default: - printk("Cmd = %#02x, ",cmd); - } -} - -/* - * Used for error reporting/debugging purposes - */ -static void i2o_report_lan_cmd(u8 cmd) -{ - switch (cmd) { - case LAN_PACKET_SEND: - printk("LAN_PACKET_SEND, "); - break; - case LAN_SDU_SEND: - printk("LAN_SDU_SEND, "); - break; - case LAN_RECEIVE_POST: - printk("LAN_RECEIVE_POST, "); - break; - case LAN_RESET: - printk("LAN_RESET, "); - break; - case LAN_SUSPEND: - printk("LAN_SUSPEND, "); - break; - default: - printk("Cmd = %0#2x, ",cmd); - } -} - -/* - * Used for error reporting/debugging purposes. - * Report Cmd name, Request status, Detailed Status. - */ -void i2o_report_status(const char *severity, const char *str, u32 *msg) -{ - u8 cmd = (msg[1]>>24)&0xFF; - u8 req_status = (msg[4]>>24)&0xFF; - u16 detailed_status = msg[4]&0xFFFF; - struct i2o_handler *h = i2o_handlers[msg[2] & (MAX_I2O_MODULES-1)]; - - if (cmd == I2O_CMD_UTIL_EVT_REGISTER) - return; // No status in this reply - - printk("%s%s: ", severity, str); - - if (cmd < 0x1F) // Utility cmd - i2o_report_util_cmd(cmd); - - else if (cmd >= 0xA0 && cmd <= 0xEF) // Executive cmd - i2o_report_exec_cmd(cmd); - - else if (h->class == I2O_CLASS_LAN && cmd >= 0x30 && cmd <= 0x3F) - i2o_report_lan_cmd(cmd); // LAN cmd - else - printk("Cmd = %0#2x, ", cmd); // Other cmds - - if (msg[0] & MSG_FAIL) { - i2o_report_fail_status(req_status, msg); - return; - } - - i2o_report_common_status(req_status); - - if (cmd < 0x1F || (cmd >= 0xA0 && cmd <= 0xEF)) - i2o_report_common_dsc(detailed_status); - else if (h->class == I2O_CLASS_LAN && cmd >= 0x30 && cmd <= 0x3F) - i2o_report_lan_dsc(detailed_status); - else - printk(" / DetailedStatus = %0#4x.\n", detailed_status); -} - -/* Used to dump a message to syslog during debugging */ -void i2o_dump_message(u32 *msg) -{ -#ifdef DRIVERDEBUG - int i; - printk(KERN_INFO "Dumping I2O message size %d @ %p\n", - msg[0]>>16&0xffff, msg); - for(i = 0; i < ((msg[0]>>16)&0xffff); i++) - printk(KERN_INFO " msg[%d] = %0#10x\n", i, msg[i]); -#endif -} - -/* - * I2O reboot/shutdown notification. - * - * - Call each OSM's reboot notifier (if one exists) - * - Quiesce each IOP in the system - * - * Each IOP has to be quiesced before we can ensure that the system - * can be properly shutdown as a transaction that has already been - * acknowledged still needs to be placed in permanent store on the IOP. - * The SysQuiesce causes the IOP to force all HDMs to complete their - * transactions before returning, so only at that point is it safe - * - */ -static int i2o_reboot_event(struct notifier_block *n, unsigned long code, void -*p) -{ - int i = 0; - struct i2o_controller *c = NULL; - - if(code != SYS_RESTART && code != SYS_HALT && code != SYS_POWER_OFF) - return NOTIFY_DONE; - - printk(KERN_INFO "Shutting down I2O system.\n"); - printk(KERN_INFO - " This could take a few minutes if there are many devices attached\n"); - - for(i = 0; i < MAX_I2O_MODULES; i++) - { - if(i2o_handlers[i] && i2o_handlers[i]->reboot_notify) - i2o_handlers[i]->reboot_notify(); - } - - for(c = i2o_controller_chain; c; c = c->next) - { - if(i2o_quiesce_controller(c)) - { - printk(KERN_WARNING "i2o: Could not quiesce %s.\n" - "Verify setup on next system power up.\n", - c->name); - } - } - - printk(KERN_INFO "I2O system down.\n"); - return NOTIFY_DONE; -} - - - - -/** - * i2o_pci_dispose - Free bus specific resources - * @c: I2O controller - * - * Disable interrupts and then free interrupt, I/O and mtrr resources - * used by this controller. Called by the I2O core on unload. - */ - -static void i2o_pci_dispose(struct i2o_controller *c) -{ - I2O_IRQ_WRITE32(c,0xFFFFFFFF); - if(c->irq > 0) - free_irq(c->irq, c); - iounmap(c->base_virt); - if(c->raptor) - iounmap(c->msg_virt); - -#ifdef CONFIG_MTRR - if(c->mtrr_reg0 > 0) - mtrr_del(c->mtrr_reg0, 0, 0); - if(c->mtrr_reg1 > 0) - mtrr_del(c->mtrr_reg1, 0, 0); -#endif -} - -/** - * i2o_pci_interrupt - Bus specific interrupt handler - * @irq: interrupt line - * @dev_id: cookie - * - * Handle an interrupt from a PCI based I2O controller. This turns out - * to be rather simple. We keep the controller pointer in the cookie. - */ - -static irqreturn_t i2o_pci_interrupt(int irq, void *dev_id, struct pt_regs *r) -{ - struct i2o_controller *c = dev_id; - i2o_run_queue(c); - return IRQ_HANDLED; -} - -/** - * i2o_pci_install - Install a PCI i2o controller - * @dev: PCI device of the I2O controller - * - * Install a PCI (or in theory AGP) i2o controller. Devices are - * initialized, configured and registered with the i2o core subsystem. Be - * very careful with ordering. There may be pending interrupts. - * - * To Do: Add support for polled controllers - */ - -int __init i2o_pci_install(struct pci_dev *dev) -{ - struct i2o_controller *c=kmalloc(sizeof(struct i2o_controller), - GFP_KERNEL); - void *bar0_virt; - void *bar1_virt; - unsigned long bar0_phys = 0; - unsigned long bar1_phys = 0; - unsigned long bar0_size = 0; - unsigned long bar1_size = 0; - - int i; - - if(c==NULL) - { - printk(KERN_ERR "i2o: Insufficient memory to add controller.\n"); - return -ENOMEM; - } - memset(c, 0, sizeof(*c)); - - c->irq = -1; - c->dpt = 0; - c->raptor = 0; - c->short_req = 0; - c->pdev = dev; - -#if BITS_PER_LONG == 64 - c->context_list_lock = SPIN_LOCK_UNLOCKED; -#endif - - /* - * Cards that fall apart if you hit them with large I/O - * loads... - */ - - if(dev->vendor == PCI_VENDOR_ID_NCR && dev->device == 0x0630) - { - c->short_req = 1; - printk(KERN_INFO "I2O: Symbios FC920 workarounds activated.\n"); - } - - if(dev->subsystem_vendor == PCI_VENDOR_ID_PROMISE) - { - c->promise = 1; - printk(KERN_INFO "I2O: Promise workarounds activated.\n"); - } - - /* - * Cards that go bananas if you quiesce them before you reset - * them - */ - - if(dev->vendor == PCI_VENDOR_ID_DPT) { - c->dpt=1; - if(dev->device == 0xA511) - c->raptor=1; - } - - for(i=0; i<6; i++) - { - /* Skip I/O spaces */ - if(!(pci_resource_flags(dev, i) & IORESOURCE_IO)) - { - if(!bar0_phys) - { - bar0_phys = pci_resource_start(dev, i); - bar0_size = pci_resource_len(dev, i); - if(!c->raptor) - break; - } - else - { - bar1_phys = pci_resource_start(dev, i); - bar1_size = pci_resource_len(dev, i); - break; - } - } - } - - if(i==6) - { - printk(KERN_ERR "i2o: I2O controller has no memory regions defined.\n"); - kfree(c); - return -EINVAL; - } - - - /* Map the I2O controller */ - if(!c->raptor) - printk(KERN_INFO "i2o: PCI I2O controller at %08lX size=%ld\n", bar0_phys, bar0_size); - else - printk(KERN_INFO "i2o: PCI I2O controller\n BAR0 at 0x%08lX size=%ld\n BAR1 at 0x%08lX size=%ld\n", bar0_phys, bar0_size, bar1_phys, bar1_size); - - bar0_virt = ioremap(bar0_phys, bar0_size); - if(bar0_virt==0) - { - printk(KERN_ERR "i2o: Unable to map controller.\n"); - kfree(c); - return -EINVAL; - } - - if(c->raptor) - { - bar1_virt = ioremap(bar1_phys, bar1_size); - if(bar1_virt==0) - { - printk(KERN_ERR "i2o: Unable to map controller.\n"); - kfree(c); - iounmap(bar0_virt); - return -EINVAL; - } - } else { - bar1_virt = bar0_virt; - bar1_phys = bar0_phys; - bar1_size = bar0_size; - } - - c->irq_mask = bar0_virt+0x34; - c->post_port = bar0_virt+0x40; - c->reply_port = bar0_virt+0x44; - - c->base_phys = bar0_phys; - c->base_virt = bar0_virt; - c->msg_phys = bar1_phys; - c->msg_virt = bar1_virt; - - /* - * Enable Write Combining MTRR for IOP's memory region - */ -#ifdef CONFIG_MTRR - c->mtrr_reg0 = mtrr_add(c->base_phys, bar0_size, MTRR_TYPE_WRCOMB, 1); - /* - * If it is an INTEL i960 I/O processor then set the first 64K to - * Uncacheable since the region contains the Messaging unit which - * shouldn't be cached. - */ - c->mtrr_reg1 = -1; - if(dev->vendor == PCI_VENDOR_ID_INTEL || dev->vendor == PCI_VENDOR_ID_DPT) - { - printk(KERN_INFO "I2O: MTRR workaround for Intel i960 processor\n"); - c->mtrr_reg1 = mtrr_add(c->base_phys, 65536, MTRR_TYPE_UNCACHABLE, 1); - if(c->mtrr_reg1< 0) - { - printk(KERN_INFO "i2o_pci: Error in setting MTRR_TYPE_UNCACHABLE\n"); - mtrr_del(c->mtrr_reg0, c->msg_phys, bar1_size); - c->mtrr_reg0 = -1; - } - } - if(c->raptor) - c->mtrr_reg1 = mtrr_add(c->msg_phys, bar1_size, MTRR_TYPE_WRCOMB, 1); - -#endif - - I2O_IRQ_WRITE32(c,0xFFFFFFFF); - - i = i2o_install_controller(c); - - if(i<0) - { - printk(KERN_ERR "i2o: Unable to install controller.\n"); - kfree(c); - iounmap(bar0_virt); - if(c->raptor) - iounmap(bar1_virt); - return i; - } - - c->irq = dev->irq; - if(c->irq) - { - i=request_irq(dev->irq, i2o_pci_interrupt, SA_SHIRQ, - c->name, c); - if(i<0) - { - printk(KERN_ERR "%s: unable to allocate interrupt %d.\n", - c->name, dev->irq); - c->irq = -1; - i2o_delete_controller(c); - iounmap(bar0_virt); - if(c->raptor) - iounmap(bar1_virt); - return -EBUSY; - } - } - - printk(KERN_INFO "%s: Installed at IRQ%d\n", c->name, dev->irq); - I2O_IRQ_WRITE32(c,0x0); - c->enabled = 1; - return 0; -} - -/** - * i2o_pci_scan - Scan the pci bus for controllers - * - * Scan the PCI devices on the system looking for any device which is a - * memory of the Intelligent, I2O class. We attempt to set up each such device - * and register it with the core. - * - * Returns the number of controllers registered - * - * Note; Do not change this to a hot plug interface. I2O 1.5 itself - * does not support hot plugging. - */ - -int __init i2o_pci_scan(void) -{ - struct pci_dev *dev = NULL; - int count=0; - - printk(KERN_INFO "i2o: Checking for PCI I2O controllers...\n"); - - while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) - { - if((dev->class>>8)!=PCI_CLASS_INTELLIGENT_I2O && - (dev->vendor!=PCI_VENDOR_ID_DPT || dev->device!=0xA511)) - continue; - - if((dev->class>>8)==PCI_CLASS_INTELLIGENT_I2O && - (dev->class&0xFF)>1) - { - printk(KERN_INFO "i2o: I2O Controller found but does not support I2O 1.5 (skipping).\n"); - continue; - } - if (pci_enable_device(dev)) - continue; - printk(KERN_INFO "i2o: I2O controller on bus %d at %d.\n", - dev->bus->number, dev->devfn); - if(pci_set_dma_mask(dev, 0xffffffff)) - { - printk(KERN_WARNING "I2O controller on bus %d at %d : No suitable DMA available\n", dev->bus->number, dev->devfn); - continue; - } - pci_set_master(dev); - if(i2o_pci_install(dev)==0) - count++; - } - if(count) - printk(KERN_INFO "i2o: %d I2O controller%s found and installed.\n", count, - count==1?"":"s"); - return count?count:-ENODEV; -} - -static int i2o_core_init(void) -{ - printk(KERN_INFO "I2O Core - (C) Copyright 1999 Red Hat Software\n"); - if (i2o_install_handler(&i2o_core_handler) < 0) - { - printk(KERN_ERR "i2o_core: Unable to install core handler.\nI2O stack not loaded!"); - return 0; - } - - core_context = i2o_core_handler.context; - - /* - * Initialize event handling thread - */ - - init_MUTEX_LOCKED(&evt_sem); - evt_pid = kernel_thread(i2o_core_evt, &evt_reply, CLONE_SIGHAND); - if(evt_pid < 0) - { - printk(KERN_ERR "I2O: Could not create event handler kernel thread\n"); - i2o_remove_handler(&i2o_core_handler); - return 0; - } - else - printk(KERN_INFO "I2O: Event thread created as pid %d\n", evt_pid); - - i2o_pci_scan(); - if(i2o_num_controllers) - i2o_sys_init(); - - register_reboot_notifier(&i2o_reboot_notifier); - - return 0; -} - -static void i2o_core_exit(void) -{ - int stat; - - unregister_reboot_notifier(&i2o_reboot_notifier); - - if(i2o_num_controllers) - i2o_sys_shutdown(); - - /* - * If this is shutdown time, the thread has already been killed - */ - if(evt_running) { - printk("Terminating i2o threads..."); - stat = kill_proc(evt_pid, SIGKILL, 1); - if(!stat) { - printk("waiting...\n"); - wait_for_completion(&evt_dead); - } - printk("done.\n"); - } - i2o_remove_handler(&i2o_core_handler); -} - -module_init(i2o_core_init); -module_exit(i2o_core_exit); - -MODULE_PARM(verbose, "i"); -MODULE_PARM_DESC(verbose, "Verbose diagnostics"); - -MODULE_AUTHOR("Red Hat Software"); -MODULE_DESCRIPTION("I2O Core"); -MODULE_LICENSE("GPL"); - -EXPORT_SYMBOL(i2o_controller_chain); -EXPORT_SYMBOL(i2o_num_controllers); -EXPORT_SYMBOL(i2o_find_controller); -EXPORT_SYMBOL(i2o_unlock_controller); -EXPORT_SYMBOL(i2o_status_get); -EXPORT_SYMBOL(i2o_install_handler); -EXPORT_SYMBOL(i2o_remove_handler); -EXPORT_SYMBOL(i2o_install_controller); -EXPORT_SYMBOL(i2o_delete_controller); -EXPORT_SYMBOL(i2o_run_queue); -EXPORT_SYMBOL(i2o_claim_device); -EXPORT_SYMBOL(i2o_release_device); -EXPORT_SYMBOL(i2o_device_notify_on); -EXPORT_SYMBOL(i2o_device_notify_off); -EXPORT_SYMBOL(i2o_post_this); -EXPORT_SYMBOL(i2o_post_wait); -EXPORT_SYMBOL(i2o_post_wait_mem); -EXPORT_SYMBOL(i2o_query_scalar); -EXPORT_SYMBOL(i2o_set_scalar); -EXPORT_SYMBOL(i2o_query_table); -EXPORT_SYMBOL(i2o_clear_table); -EXPORT_SYMBOL(i2o_row_add_table); -EXPORT_SYMBOL(i2o_issue_params); -EXPORT_SYMBOL(i2o_event_register); -EXPORT_SYMBOL(i2o_event_ack); -EXPORT_SYMBOL(i2o_report_status); -EXPORT_SYMBOL(i2o_dump_message); -EXPORT_SYMBOL(i2o_get_class_name); -EXPORT_SYMBOL(i2o_context_list_add); -EXPORT_SYMBOL(i2o_context_list_get); -EXPORT_SYMBOL(i2o_context_list_remove); diff -Nru a/drivers/message/i2o/pci.c b/drivers/message/i2o/pci.c --- a/drivers/message/i2o/pci.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/message/i2o/pci.c 2004-09-26 10:25:55 -07:00 @@ -133,6 +133,21 @@ if (!c->base.phys) { c->base.phys = pci_resource_start(pdev, i); c->base.len = pci_resource_len(pdev, i); + + /* + * If we know what card it is, set the size + * correctly. Code is taken from dpt_i2o.c + */ + if(pdev->device == 0xa501) { + if(pdev->subsystem_device >= 0xc032 && + pdev->subsystem_device <= 0xc03b) { + if(c->base.len > 0x400000) + c->base.len = 0x400000; + } else { + if(c->base.len > 0x100000) + c->base.len = 0x100000; + } + } if (!c->raptor) break; } else { diff -Nru a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c --- a/drivers/mmc/mmc.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/mmc/mmc.c 2004-09-26 10:25:56 -07:00 @@ -300,58 +300,121 @@ return ocr; } -static void mmc_decode_cid(struct mmc_cid *cid, u32 *resp) +#define UNSTUFF_BITS(resp,start,size) \ + ({ \ + const u32 __mask = (1 << (size)) - 1; \ + const int __off = 3 - ((start) / 32); \ + const int __shft = (start) & 31; \ + u32 __res; \ + \ + __res = resp[__off] >> __shft; \ + if ((size) + __shft >= 32) \ + __res |= resp[__off-1] << (32 - __shft); \ + __res & __mask; \ + }) + +/* + * Given the decoded CSD structure, decode the raw CID to our CID structure. + */ +static void mmc_decode_cid(struct mmc_card *card) { - memset(cid, 0, sizeof(struct mmc_cid)); + u32 *resp = card->raw_cid; - cid->manfid = resp[0] >> 8; - cid->prod_name[0] = resp[0]; - cid->prod_name[1] = resp[1] >> 24; - cid->prod_name[2] = resp[1] >> 16; - cid->prod_name[3] = resp[1] >> 8; - cid->prod_name[4] = resp[1]; - cid->prod_name[5] = resp[2] >> 24; - cid->prod_name[6] = resp[2] >> 16; - cid->prod_name[7] = '\0'; - cid->hwrev = (resp[2] >> 12) & 15; - cid->fwrev = (resp[2] >> 8) & 15; - cid->serial = (resp[2] & 255) << 16 | (resp[3] >> 16); - cid->month = (resp[3] >> 12) & 15; - cid->year = (resp[3] >> 8) & 15; -} - -static void mmc_decode_csd(struct mmc_csd *csd, u32 *resp) -{ - unsigned int e, m; - - csd->mmc_prot = (resp[0] >> 26) & 15; - m = (resp[0] >> 19) & 15; - e = (resp[0] >> 16) & 7; + memset(&card->cid, 0, sizeof(struct mmc_cid)); + + /* + * The selection of the format here is guesswork based upon + * information people have sent to date. + */ + switch (card->csd.mmca_vsn) { + case 0: /* MMC v1.? */ + case 1: /* MMC v1.4 */ + card->cid.manfid = UNSTUFF_BITS(resp, 104, 24); + card->cid.prod_name[0] = UNSTUFF_BITS(resp, 96, 8); + card->cid.prod_name[1] = UNSTUFF_BITS(resp, 88, 8); + card->cid.prod_name[2] = UNSTUFF_BITS(resp, 80, 8); + card->cid.prod_name[3] = UNSTUFF_BITS(resp, 72, 8); + card->cid.prod_name[4] = UNSTUFF_BITS(resp, 64, 8); + card->cid.prod_name[5] = UNSTUFF_BITS(resp, 56, 8); + card->cid.prod_name[6] = UNSTUFF_BITS(resp, 48, 8); + card->cid.hwrev = UNSTUFF_BITS(resp, 44, 4); + card->cid.fwrev = UNSTUFF_BITS(resp, 40, 4); + card->cid.serial = UNSTUFF_BITS(resp, 16, 24); + card->cid.month = UNSTUFF_BITS(resp, 12, 4); + card->cid.year = UNSTUFF_BITS(resp, 8, 4) + 1997; + break; + + case 2: /* MMC v2.x ? */ + case 3: /* MMC v3.x ? */ + card->cid.manfid = UNSTUFF_BITS(resp, 120, 8); + card->cid.oemid = UNSTUFF_BITS(resp, 104, 16); + card->cid.prod_name[0] = UNSTUFF_BITS(resp, 96, 8); + card->cid.prod_name[1] = UNSTUFF_BITS(resp, 88, 8); + card->cid.prod_name[2] = UNSTUFF_BITS(resp, 80, 8); + card->cid.prod_name[3] = UNSTUFF_BITS(resp, 72, 8); + card->cid.prod_name[4] = UNSTUFF_BITS(resp, 64, 8); + card->cid.prod_name[5] = UNSTUFF_BITS(resp, 56, 8); + card->cid.serial = UNSTUFF_BITS(resp, 16, 32); + card->cid.month = UNSTUFF_BITS(resp, 12, 4); + card->cid.year = UNSTUFF_BITS(resp, 8, 4) + 1997; + break; + + default: + printk("%s: card has unknown MMCA version %d\n", + card->host->host_name, card->csd.mmca_vsn); + mmc_card_set_bad(card); + break; + } +} + +/* + * Given a 128-bit response, decode to our card CSD structure. + */ +static void mmc_decode_csd(struct mmc_card *card) +{ + struct mmc_csd *csd = &card->csd; + unsigned int e, m, csd_struct; + u32 *resp = card->raw_csd; + + /* + * We only understand CSD structure v1.1 and v2. + * v2 has extra information in bits 15, 11 and 10. + */ + csd_struct = UNSTUFF_BITS(resp, 126, 2); + if (csd_struct != 1 && csd_struct != 2) { + printk("%s: unrecognised CSD structure version %d\n", + card->host->host_name, csd_struct); + mmc_card_set_bad(card); + return; + } + + csd->mmca_vsn = UNSTUFF_BITS(resp, 122, 4); + m = UNSTUFF_BITS(resp, 115, 4); + e = UNSTUFF_BITS(resp, 112, 3); csd->tacc_ns = (tacc_exp[e] * tacc_mant[m] + 9) / 10; - csd->tacc_clks = ((resp[0] >> 8) & 255) * 100; + csd->tacc_clks = UNSTUFF_BITS(resp, 104, 8) * 100; - m = (resp[0] >> 3) & 15; - e = resp[0] & 7; + m = UNSTUFF_BITS(resp, 99, 4); + e = UNSTUFF_BITS(resp, 96, 3); csd->max_dtr = tran_exp[e] * tran_mant[m]; - csd->cmdclass = (resp[1] >> 20) & 0xfff; + csd->cmdclass = UNSTUFF_BITS(resp, 84, 12); - e = (resp[2] >> 15) & 7; - m = (resp[1] << 2 | resp[2] >> 30) & 0x3fff; + e = UNSTUFF_BITS(resp, 47, 3); + m = UNSTUFF_BITS(resp, 62, 12); csd->capacity = (1 + m) << (e + 2); - csd->read_blkbits = (resp[1] >> 16) & 15; + csd->read_blkbits = UNSTUFF_BITS(resp, 80, 4); } /* - * Locate a MMC card on this MMC host given a CID. + * Locate a MMC card on this MMC host given a raw CID. */ -static struct mmc_card * -mmc_find_card(struct mmc_host *host, struct mmc_cid *cid) +static struct mmc_card *mmc_find_card(struct mmc_host *host, u32 *raw_cid) { struct mmc_card *card; list_for_each_entry(card, &host->cards, node) { - if (memcmp(&card->cid, cid, sizeof(struct mmc_cid)) == 0) + if (memcmp(card->raw_cid, raw_cid, sizeof(card->raw_cid)) == 0) return card; } return NULL; @@ -361,7 +424,7 @@ * Allocate a new MMC card, and assign a unique RCA. */ static struct mmc_card * -mmc_alloc_card(struct mmc_host *host, struct mmc_cid *cid, unsigned int *frca) +mmc_alloc_card(struct mmc_host *host, u32 *raw_cid, unsigned int *frca) { struct mmc_card *card, *c; unsigned int rca = *frca; @@ -371,7 +434,7 @@ return ERR_PTR(-ENOMEM); mmc_init_card(card, host); - memcpy(&card->cid, cid, sizeof(struct mmc_cid)); + memcpy(card->raw_cid, raw_cid, sizeof(card->raw_cid)); again: list_for_each_entry(c, &host->cards, node) @@ -456,7 +519,7 @@ * to be discovered. Add new cards to the list. * * Create a mmc_card entry for each discovered card, assigning - * it an RCA, and save the CID. + * it an RCA, and save the raw CID for decoding later. */ static void mmc_discover_cards(struct mmc_host *host) { @@ -465,7 +528,6 @@ while (1) { struct mmc_command cmd; - struct mmc_cid cid; cmd.opcode = MMC_ALL_SEND_CID; cmd.arg = 0; @@ -482,11 +544,9 @@ break; } - mmc_decode_cid(&cid, cmd.resp); - - card = mmc_find_card(host, &cid); + card = mmc_find_card(host, cmd.resp); if (!card) { - card = mmc_alloc_card(host, &cid, &first_rca); + card = mmc_alloc_card(host, cmd.resp, &first_rca); if (IS_ERR(card)) { err = PTR_ERR(card); break; @@ -502,7 +562,7 @@ err = mmc_wait_for_cmd(host, &cmd, CMD_RETRIES); if (err != MMC_ERR_NONE) - card->state |= MMC_STATE_DEAD; + mmc_card_set_dead(card); } } @@ -523,11 +583,14 @@ err = mmc_wait_for_cmd(host, &cmd, CMD_RETRIES); if (err != MMC_ERR_NONE) { - card->state |= MMC_STATE_DEAD; + mmc_card_set_dead(card); continue; } - mmc_decode_csd(&card->csd, cmd.resp); + memcpy(card->raw_csd, cmd.resp, sizeof(card->raw_csd)); + + mmc_decode_csd(card); + mmc_decode_cid(card); } } @@ -573,7 +636,7 @@ if (err == MMC_ERR_NONE) continue; - card->state |= MMC_STATE_DEAD; + mmc_card_set_dead(card); } } @@ -678,9 +741,9 @@ */ if (!mmc_card_present(card) && !mmc_card_dead(card)) { if (mmc_register_card(card)) - card->state |= MMC_STATE_DEAD; + mmc_card_set_dead(card); else - card->state |= MMC_STATE_PRESENT; + mmc_card_set_present(card); } /* diff -Nru a/drivers/mmc/mmc_block.c b/drivers/mmc/mmc_block.c --- a/drivers/mmc/mmc_block.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/mmc/mmc_block.c 2004-09-26 10:25:57 -07:00 @@ -428,7 +428,7 @@ struct mmc_blk_data *md = mmc_get_drvdata(card); if (md) { - blk_stop_queue(md->queue.queue); + mmc_queue_suspend(&md->queue); } return 0; } @@ -439,7 +439,7 @@ if (md) { mmc_blk_set_blksize(md, card); - blk_start_queue(md->queue.queue); + mmc_queue_resume(&md->queue); } return 0; } diff -Nru a/drivers/mmc/mmc_queue.c b/drivers/mmc/mmc_queue.c --- a/drivers/mmc/mmc_queue.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/mmc/mmc_queue.c 2004-09-26 10:25:56 -07:00 @@ -15,6 +15,9 @@ #include #include "mmc_queue.h" +#define MMC_QUEUE_EXIT (1 << 0) +#define MMC_QUEUE_SUSPENDED (1 << 1) + /* * Prepare a MMC request. Essentially, this means passing the * preparation off to the media driver. The media driver will @@ -66,14 +69,9 @@ daemonize("mmcqd"); - spin_lock_irq(¤t->sighand->siglock); - sigfillset(¤t->blocked); - recalc_sigpending(); - spin_unlock_irq(¤t->sighand->siglock); - - mq->thread = current; complete(&mq->thread_complete); + down(&mq->thread_sem); add_wait_queue(&mq->thread_wq, &wait); do { struct request *req = NULL; @@ -85,9 +83,11 @@ spin_unlock(q->queue_lock); if (!req) { - if (!mq->thread) + if (mq->flags & MMC_QUEUE_EXIT) break; + up(&mq->thread_sem); schedule(); + down(&mq->thread_sem); continue; } set_current_state(TASK_RUNNING); @@ -95,6 +95,7 @@ mq->issue_fn(mq, req); } while (1); remove_wait_queue(&mq->thread_wq, &wait); + up(&mq->thread_sem); complete_and_exit(&mq->thread_complete, 0); return 0; @@ -148,6 +149,7 @@ init_completion(&mq->thread_complete); init_waitqueue_head(&mq->thread_wq); + init_MUTEX(&mq->thread_sem); ret = kernel_thread(mmc_queue_thread, mq, CLONE_KERNEL); if (ret < 0) { @@ -160,17 +162,61 @@ return ret; } - EXPORT_SYMBOL(mmc_init_queue); void mmc_cleanup_queue(struct mmc_queue *mq) { - mq->thread = NULL; + mq->flags |= MMC_QUEUE_EXIT; wake_up(&mq->thread_wq); wait_for_completion(&mq->thread_complete); blk_cleanup_queue(mq->queue); mq->card = NULL; } - EXPORT_SYMBOL(mmc_cleanup_queue); + +/** + * mmc_queue_suspend - suspend a MMC request queue + * @mq: MMC queue to suspend + * + * Stop the block request queue, and wait for our thread to + * complete any outstanding requests. This ensures that we + * won't suspend while a request is being processed. + */ +void mmc_queue_suspend(struct mmc_queue *mq) +{ + request_queue_t *q = mq->queue; + unsigned long flags; + + if (!(mq->flags & MMC_QUEUE_SUSPENDED)) { + mq->flags |= MMC_QUEUE_SUSPENDED; + + spin_lock_irqsave(q->queue_lock, flags); + blk_stop_queue(q); + spin_unlock_irqrestore(q->queue_lock, flags); + + down(&mq->thread_sem); + } +} +EXPORT_SYMBOL(mmc_queue_suspend); + +/** + * mmc_queue_resume - resume a previously suspended MMC request queue + * @mq: MMC queue to resume + */ +void mmc_queue_resume(struct mmc_queue *mq) +{ + request_queue_t *q = mq->queue; + unsigned long flags; + + if (mq->flags & MMC_QUEUE_SUSPENDED) { + mq->flags &= ~MMC_QUEUE_SUSPENDED; + + up(&mq->thread_sem); + + spin_lock_irqsave(q->queue_lock, flags); + blk_start_queue(q); + spin_unlock_irqrestore(q->queue_lock, flags); + } +} +EXPORT_SYMBOL(mmc_queue_resume); diff -Nru a/drivers/mmc/mmc_queue.h b/drivers/mmc/mmc_queue.h --- a/drivers/mmc/mmc_queue.h 2004-09-26 10:25:55 -07:00 +++ b/drivers/mmc/mmc_queue.h 2004-09-26 10:25:55 -07:00 @@ -8,7 +8,8 @@ struct mmc_card *card; struct completion thread_complete; wait_queue_head_t thread_wq; - struct task_struct *thread; + struct semaphore thread_sem; + unsigned int flags; struct request *req; int (*prep_fn)(struct mmc_queue *, struct request *); int (*issue_fn)(struct mmc_queue *, struct request *); @@ -25,5 +26,7 @@ extern int mmc_init_queue(struct mmc_queue *, struct mmc_card *, spinlock_t *); extern void mmc_cleanup_queue(struct mmc_queue *); +extern void mmc_queue_suspend(struct mmc_queue *); +extern void mmc_queue_resume(struct mmc_queue *); #endif diff -Nru a/drivers/mmc/mmc_sysfs.c b/drivers/mmc/mmc_sysfs.c --- a/drivers/mmc/mmc_sysfs.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/mmc/mmc_sysfs.c 2004-09-26 10:25:56 -07:00 @@ -31,11 +31,12 @@ /* * This currently matches any MMC driver to any MMC card - drivers * themselves make the decision whether to drive this card in their - * probe method. + * probe method. However, we force "bad" cards to fail. */ static int mmc_bus_match(struct device *dev, struct device_driver *drv) { - return 1; + struct mmc_card *card = dev_to_mmc_card(dev); + return !mmc_card_bad(card); } static int @@ -66,8 +67,9 @@ i = 0; add_env("MMC_CCC=%s", ccc); - add_env("MMC_MANFID=%03x", card->cid.manfid); - add_env("MMC_SLOT_NAME=%s", card->dev.bus_id); + add_env("MMC_MANFID=%06x", card->cid.manfid); + add_env("MMC_NAME=%s", mmc_card_name(card)); + add_env("MMC_OEMID=%04x", card->cid.oemid); return 0; } @@ -157,20 +159,28 @@ } \ static DEVICE_ATTR(name, S_IRUGO, mmc_dev_show_##name, NULL) -MMC_ATTR(date, "%02d/%04d\n", card->cid.month, 1997 + card->cid.year); +MMC_ATTR(cid, "%08x%08x%08x%08x\n", card->raw_cid[0], card->raw_cid[1], + card->raw_cid[2], card->raw_cid[3]); +MMC_ATTR(csd, "%08x%08x%08x%08x\n", card->raw_csd[0], card->raw_csd[1], + card->raw_csd[2], card->raw_csd[3]); +MMC_ATTR(date, "%02d/%04d\n", card->cid.month, card->cid.year); MMC_ATTR(fwrev, "0x%x\n", card->cid.fwrev); MMC_ATTR(hwrev, "0x%x\n", card->cid.hwrev); -MMC_ATTR(manfid, "0x%03x\n", card->cid.manfid); -MMC_ATTR(serial, "0x%06x\n", card->cid.serial); +MMC_ATTR(manfid, "0x%06x\n", card->cid.manfid); MMC_ATTR(name, "%s\n", card->cid.prod_name); +MMC_ATTR(oemid, "0x%04x\n", card->cid.oemid); +MMC_ATTR(serial, "0x%08x\n", card->cid.serial); static struct device_attribute *mmc_dev_attributes[] = { + &dev_attr_cid, + &dev_attr_csd, &dev_attr_date, &dev_attr_fwrev, &dev_attr_hwrev, &dev_attr_manfid, - &dev_attr_serial, &dev_attr_name, + &dev_attr_oemid, + &dev_attr_serial, }; /* diff -Nru a/drivers/mmc/pxamci.c b/drivers/mmc/pxamci.c --- a/drivers/mmc/pxamci.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/mmc/pxamci.c 2004-09-26 10:25:57 -07:00 @@ -33,6 +33,8 @@ #include #include +#include + #include "pxamci.h" #ifdef CONFIG_MMC_DEBUG @@ -52,6 +54,7 @@ unsigned int cmdat; unsigned int imask; unsigned int power_mode; + struct pxamci_platform_data *pdata; struct mmc_request *mrq; struct mmc_command *cmd; @@ -384,9 +387,8 @@ if (host->power_mode != ios->power_mode) { host->power_mode = ios->power_mode; - /* - * power control? none on the lubbock. - */ + if (host->pdata && host->pdata->setpower) + host->pdata->setpower(mmc->dev, ios->vdd); if (ios->power_mode == MMC_POWER_ON) host->cmdat |= CMDAT_INIT; @@ -407,6 +409,12 @@ DCSR(dma) = DCSR_STARTINTR|DCSR_ENDINTR|DCSR_BUSERR; } +static irqreturn_t pxamci_detect_irq(int irq, void *devid, struct pt_regs *regs) +{ + mmc_detect_change(devid); + return IRQ_HANDLED; +} + static int pxamci_probe(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); @@ -433,11 +441,14 @@ mmc->ops = &pxamci_ops; mmc->f_min = 312500; mmc->f_max = 20000000; - mmc->ocr_avail = MMC_VDD_32_33; host = mmc_priv(mmc); host->mmc = mmc; host->dma = -1; + host->pdata = pdev->dev.platform_data; + mmc->ocr_avail = host->pdata ? + host->pdata->ocr_mask : + MMC_VDD_32_33|MMC_VDD_33_34; host->sg_cpu = dma_alloc_coherent(dev, PAGE_SIZE, &host->sg_dma, GFP_KERNEL); if (!host->sg_cpu) { @@ -464,6 +475,7 @@ pxamci_stop_clock(host); writel(0, host->base + MMC_SPI); writel(64, host->base + MMC_RESTO); + writel(host->imask, host->base + MMC_I_MASK); pxa_gpio_mode(GPIO6_MMCCLK_MD); pxa_gpio_mode(GPIO8_MMCCS0_MD); @@ -481,6 +493,9 @@ dev_set_drvdata(dev, mmc); + if (host->pdata && host->pdata->init) + host->pdata->init(dev, pxamci_detect_irq, mmc); + mmc_add_host(mmc); return 0; @@ -509,12 +524,17 @@ if (mmc) { struct pxamci_host *host = mmc_priv(mmc); + if (host->pdata && host->pdata->exit) + host->pdata->exit(dev, mmc); + mmc_remove_host(mmc); pxamci_stop_clock(host); writel(TXFIFO_WR_REQ|RXFIFO_RD_REQ|CLK_IS_OFF|STOP_CMD| END_CMD_RES|PRG_DONE|DATA_TRAN_DONE, host->base + MMC_I_MASK); + + pxa_set_cken(CKEN12_MMC, 0); free_irq(host->irq, host); pxa_free_dma(host->dma); diff -Nru a/drivers/mtd/maps/Kconfig b/drivers/mtd/maps/Kconfig --- a/drivers/mtd/maps/Kconfig 2004-09-26 10:25:57 -07:00 +++ b/drivers/mtd/maps/Kconfig 2004-09-26 10:25:57 -07:00 @@ -473,6 +473,15 @@ IXDP425 and Coyote. If you have an IXP4xx based board and would like to use the flash chips on it, say 'Y'. +config MTD_IXP2000 + tristate "CFI Flash device mapped on Intel IXP2000 based systems" + depends on ARM && MTD_CFI && MTD_COMPLEX_MAPPINGS && ARCH_IXP2000 + help + This enables MTD access to flash devices on platforms based + on Intel's IXP2000 family of network processors such as the + IXDP2400 and IXDP2401. If you have an IXP2000 based board and + would like to use the flash chips on it, say 'Y'. + config MTD_EPXA10DB tristate "CFI Flash device mapped on Epxa10db" depends on ARM && MTD_CFI && MTD_PARTITIONS && ARCH_CAMELOT diff -Nru a/drivers/mtd/maps/Makefile b/drivers/mtd/maps/Makefile --- a/drivers/mtd/maps/Makefile 2004-09-26 10:25:55 -07:00 +++ b/drivers/mtd/maps/Makefile 2004-09-26 10:25:55 -07:00 @@ -62,5 +62,6 @@ obj-$(CONFIG_MTD_NOR_TOTO) += omap-toto-flash.o obj-$(CONFIG_MTD_MPC1211) += mpc1211.o obj-$(CONFIG_MTD_IXP4XX) += ixp4xx.o +obj-$(CONFIG_MTD_IXP2000) += ixp2000.o obj-$(CONFIG_MTD_WRSBC8260) += wr_sbc82xx_flash.o obj-$(CONFIG_MTD_DMV182) += dmv182.o diff -Nru a/drivers/mtd/maps/ixp2000.c b/drivers/mtd/maps/ixp2000.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/mtd/maps/ixp2000.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,281 @@ +/* + * $Id: ixp2000.c,v 1.1 2004/09/02 00:13:41 dsaxena Exp $ + * + * drivers/mtd/maps/ixp2000.c + * + * Mapping for the Intel XScale IXP2000 based systems + * + * Copyright (C) 2002 Intel Corp. + * Copyright (C) 2003-2004 MontaVista Software, Inc. + * + * Original Author: Naeem M Afzal + * Maintainer: Deepak Saxena + * + * 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. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +struct ixp2000_flash_info { + struct mtd_info *mtd; + struct map_info map; + struct mtd_partition *partitions; + struct resource *res; + int nr_banks; +}; + +static inline unsigned long flash_bank_setup(struct map_info *map, unsigned long ofs) +{ + unsigned long (*set_bank)(unsigned long) = + (unsigned long(*)(unsigned long))map->map_priv_2; + + return (set_bank ? set_bank(ofs) : ofs); +} + +#ifdef __ARMEB__ +/* + * Rev A0 and A1 of IXP2400 silicon have a broken addressing unit which + * causes the lower address bits to be XORed with 0x11 on 8 bit accesses + * and XORed with 0x10 on 16 bit accesses. See the spec update, erratta 44. + */ +static int errata44_workaround = 0; + +static inline unsigned long address_fix8_write(unsigned long addr) +{ + if (errata44_workaround) { + return (addr ^ 3); + } + return addr; +} +#else + +#define address_fix8_write(x) (x) +#endif + +static map_word ixp2000_flash_read8(struct map_info *map, unsigned long ofs) +{ + map_word val; + + val.x[0] = *((u8 *)(map->map_priv_1 + flash_bank_setup(map, ofs))); + return val; +} + +/* + * We can't use the standard memcpy due to the broken SlowPort + * address translation on rev A0 and A1 silicon and the fact that + * we have banked flash. + */ +static void ixp2000_flash_copy_from(struct map_info *map, void *to, + unsigned long from, ssize_t len) +{ + from = flash_bank_setup(map, from); + while(len--) + *(__u8 *) to++ = *(__u8 *)(map->map_priv_1 + from++); +} + +static void ixp2000_flash_write8(struct map_info *map, map_word d, unsigned long ofs) +{ + *(__u8 *) (address_fix8_write(map->map_priv_1 + + flash_bank_setup(map, ofs))) = d.x[0]; +} + +static void ixp2000_flash_copy_to(struct map_info *map, unsigned long to, + const void *from, ssize_t len) +{ + to = flash_bank_setup(map, to); + while(len--) { + unsigned long tmp = address_fix8_write(map->map_priv_1 + to++); + *(__u8 *)(tmp) = *(__u8 *)(from++); + } +} + + +static int ixp2000_flash_remove(struct device *_dev) +{ + struct platform_device *dev = to_platform_device(_dev); + struct flash_platform_data *plat = dev->dev.platform_data; + struct ixp2000_flash_info *info = dev_get_drvdata(&dev->dev); + + dev_set_drvdata(&dev->dev, NULL); + + if(!info) + return 0; + + if (info->mtd) { + del_mtd_partitions(info->mtd); + map_destroy(info->mtd); + } + if (info->map.map_priv_1) + iounmap((void *) info->map.map_priv_1); + + if (info->partitions) + kfree(info->partitions); + + if (info->res) { + release_resource(info->res); + kfree(info->res); + } + + if (plat->exit) + plat->exit(); + + return 0; +} + + +static int ixp2000_flash_probe(struct device *_dev) +{ + static const char *probes[] = { "RedBoot", "cmdlinepart", NULL }; + struct platform_device *dev = to_platform_device(_dev); + struct ixp2000_flash_data *ixp_data = dev->dev.platform_data; + struct flash_platform_data *plat; + struct ixp2000_flash_info *info; + unsigned long window_size; + int err = -1; + + if (!ixp_data) + return -ENODEV; + + plat = ixp_data->platform_data; + if (!plat) + return -ENODEV; + + window_size = dev->resource->end - dev->resource->start + 1; + dev_info(_dev, "Probe of IXP2000 flash(%d banks x %dM)\n", + ixp_data->nr_banks, ((u32)window_size >> 20)); + + if (plat->width != 1) { + dev_err(_dev, "IXP2000 MTD map only supports 8-bit mode, asking for %d\n", + plat->width * 8); + return -EIO; + } + + info = kmalloc(sizeof(struct ixp2000_flash_info), GFP_KERNEL); + if(!info) { + err = -ENOMEM; + goto Error; + } + memzero(info, sizeof(struct ixp2000_flash_info)); + + dev_set_drvdata(&dev->dev, info); + + /* + * Tell the MTD layer we're not 1:1 mapped so that it does + * not attempt to do a direct access on us. + */ + info->map.phys = NO_XIP; + + info->nr_banks = ixp_data->nr_banks; + info->map.size = ixp_data->nr_banks * window_size; + info->map.bankwidth = 1; + + /* + * map_priv_2 is used to store a ptr to to the bank_setup routine + */ + info->map.map_priv_2 = (u32) ixp_data->bank_setup; + + info->map.name = dev->dev.bus_id; + info->map.read = ixp2000_flash_read8; + info->map.write = ixp2000_flash_write8; + info->map.copy_from = ixp2000_flash_copy_from; + info->map.copy_to = ixp2000_flash_copy_to; + + info->res = request_mem_region(dev->resource->start, + dev->resource->end - dev->resource->start + 1, + dev->dev.bus_id); + if (!info->res) { + dev_err(_dev, "Could not reserve memory region\n"); + err = -ENOMEM; + goto Error; + } + + info->map.map_priv_1 = + (unsigned long) ioremap(dev->resource->start, + dev->resource->end - dev->resource->start + 1); + if (!info->map.map_priv_1) { + dev_err(_dev, "Failed to ioremap flash region\n"); + err = -EIO; + goto Error; + } + + /* + * Setup read mode for FLASH + */ + *IXP2000_SLOWPORT_FRM = 1; + +#if defined(__ARMEB__) + /* + * Enable errata 44 workaround for NPUs with broken slowport + */ + + errata44_workaround = ixp2000_has_broken_slowport(); + dev_info(_dev, "Errata 44 workaround %s\n", + errata44_workaround ? "enabled" : "disabled"); +#endif + + info->mtd = do_map_probe(plat->map_name, &info->map); + if (!info->mtd) { + dev_err(_dev, "map_probe failed\n"); + err = -ENXIO; + goto Error; + } + info->mtd->owner = THIS_MODULE; + + err = parse_mtd_partitions(info->mtd, probes, &info->partitions, 0); + if (err > 0) { + err = add_mtd_partitions(info->mtd, info->partitions, err); + if(err) + dev_err(_dev, "Could not parse partitions\n"); + } + + if (err) + goto Error; + + return 0; + +Error: + ixp2000_flash_remove(_dev); + return err; +} + +static struct device_driver ixp2000_flash_driver = { + .name = "IXP2000-Flash", + .bus = &platform_bus_type, + .probe = &ixp2000_flash_probe, + .remove = &ixp2000_flash_remove +}; + +static int __init ixp2000_flash_init(void) +{ + return driver_register(&ixp2000_flash_driver); +} + +static void __exit ixp2000_flash_exit(void) +{ + driver_unregister(&ixp2000_flash_driver); +} + +module_init(ixp2000_flash_init); +module_exit(ixp2000_flash_exit); +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Deepak Saxena "); + diff -Nru a/drivers/mtd/maps/ixp4xx.c b/drivers/mtd/maps/ixp4xx.c --- a/drivers/mtd/maps/ixp4xx.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/mtd/maps/ixp4xx.c 2004-09-26 10:25:55 -07:00 @@ -1,5 +1,5 @@ /* - * $Id: ixp4xx.c,v 1.3 2004/07/12 22:38:29 dwmw2 Exp $ + * $Id: ixp4xx.c,v 1.4 2004/08/31 22:55:51 dsaxena Exp $ * * drivers/mtd/maps/ixp4xx.c * @@ -88,6 +88,7 @@ struct platform_device *dev = to_platform_device(_dev); struct flash_platform_data *plat = dev->dev.platform_data; struct ixp4xx_flash_info *info = dev_get_drvdata(&dev->dev); + map_word d; dev_set_drvdata(&dev->dev, NULL); @@ -97,7 +98,8 @@ /* * This is required for a soft reboot to work. */ - ixp4xx_write16(&info->map, 0xff, 0x55 * 0x2); + d.x[0] = 0xff; + ixp4xx_write16(&info->map, d, 0x55 * 0x2); if (info->mtd) { del_mtd_partitions(info->mtd); diff -Nru a/drivers/net/3c507.c b/drivers/net/3c507.c --- a/drivers/net/3c507.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/net/3c507.c 2004-09-26 10:25:57 -07:00 @@ -294,6 +294,7 @@ static void hardware_send_packet(struct net_device *dev, void *buf, short length, short pad); static void init_82586_mem(struct net_device *dev); static struct ethtool_ops netdev_ethtool_ops; +static void init_rx_bufs(struct net_device *); static int io = 0x300; static int irq; @@ -612,7 +613,6 @@ } if ((status & 0x0070) != 0x0040 && netif_running(dev)) { - static void init_rx_bufs(struct net_device *); /* The Rx unit is not ready, it must be hung. Restart the receiver by initializing the rx buffers, and issuing an Rx start command. */ if (net_debug) diff -Nru a/drivers/net/3c59x.c b/drivers/net/3c59x.c --- a/drivers/net/3c59x.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/net/3c59x.c 2004-09-26 10:25:55 -07:00 @@ -902,7 +902,9 @@ static void update_stats(long ioaddr, struct net_device *dev); static struct net_device_stats *vortex_get_stats(struct net_device *dev); static void set_rx_mode(struct net_device *dev); +#ifdef CONFIG_PCI static int vortex_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); +#endif static void vortex_tx_timeout(struct net_device *dev); static void acpi_set_WOL(struct net_device *dev); static struct ethtool_ops vortex_ethtool_ops; @@ -1473,7 +1475,9 @@ dev->stop = vortex_close; dev->get_stats = vortex_get_stats; +#ifdef CONFIG_PCI dev->do_ioctl = vortex_ioctl; +#endif dev->ethtool_ops = &vortex_ethtool_ops; dev->set_multicast_list = set_rx_mode; dev->tx_timeout = vortex_tx_timeout; @@ -2880,6 +2884,7 @@ .get_drvinfo = vortex_get_drvinfo, }; +#ifdef CONFIG_PCI static int vortex_do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { struct vortex_private *vp = netdev_priv(dev); @@ -2937,6 +2942,7 @@ return err; } +#endif /* Pre-Cyclone chips have no documented multicast filter, so the only diff -Nru a/drivers/net/8390.c b/drivers/net/8390.c --- a/drivers/net/8390.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/net/8390.c 2004-09-26 10:25:55 -07:00 @@ -42,6 +42,7 @@ Alan Cox : Spinlocking work, added 'BUG_83C690' Paul Gortmaker : Separate out Tx timeout code from Tx path. Paul Gortmaker : Remove old unused single Tx buffer code. + Hayato Fujiwara : Add m32r support. Sources: The National Semiconductor LAN Databook, and the 3Com 3c503 databook. @@ -219,6 +220,15 @@ int txsr, isr, tickssofar = jiffies - dev->trans_start; unsigned long flags; +#if defined(CONFIG_M32R) && defined(CONFIG_SMP) + unsigned long icucr; + + local_irq_save(flags); + icucr = inl(ICUCR1); + icucr |= M32R_ICUCR_ISMOD11; + outl(icucr, ICUCR1); + local_irq_restore(flags); +#endif ei_local->stat.tx_errors++; spin_lock_irqsave(&ei_local->page_lock, flags); diff -Nru a/drivers/net/Kconfig b/drivers/net/Kconfig --- a/drivers/net/Kconfig 2004-09-26 10:25:57 -07:00 +++ b/drivers/net/Kconfig 2004-09-26 10:25:57 -07:00 @@ -200,7 +200,7 @@ config MACE tristate "MACE (Power Mac ethernet) support" - depends on NET_ETHERNET && PPC_PMAC + depends on NET_ETHERNET && PPC_PMAC && PPC32 select CRC32 help Power Macintoshes and clones with Ethernet built-in on the @@ -223,7 +223,7 @@ config BMAC tristate "BMAC (G3 ethernet) support" - depends on NET_ETHERNET && PPC_PMAC + depends on NET_ETHERNET && PPC_PMAC && PPC32 select CRC32 help Say Y for support of BMAC Ethernet interfaces. These are used on G3 @@ -817,7 +817,7 @@ tristate "SMC 91C9x/91C1xxx support" select CRC32 select MII - depends on NET_ETHERNET && (ARM || REDWOOD_5 || REDWOOD_6) + depends on NET_ETHERNET && (ARM || REDWOOD_5 || REDWOOD_6 || M32R) help This is a driver for SMC's 91x series of Ethernet chipsets, including the SMC91C94 and the SMC91C111. Say Y if you want it @@ -1075,7 +1075,7 @@ config NE2000 tristate "NE2000/NE1000 support" - depends on NET_ISA || (Q40 && m) + depends on NET_ISA || (Q40 && m) || M32R select CRC32 ---help--- If you have a network (Ethernet) card of this type, say Y and read diff -Nru a/drivers/net/arcnet/arcnet.c b/drivers/net/arcnet/arcnet.c --- a/drivers/net/arcnet/arcnet.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/net/arcnet/arcnet.c 2004-09-26 10:25:57 -07:00 @@ -401,7 +401,8 @@ lp->rfc1201.sequence = 1; /* bring up the hardware driver */ - lp->hw.open(dev); + if (lp->hw.open) + lp->hw.open(dev); if (dev->dev_addr[0] == 0) BUGMSG(D_NORMAL, "WARNING! Station address 00 is reserved " diff -Nru a/drivers/net/b44.c b/drivers/net/b44.c --- a/drivers/net/b44.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/net/b44.c 2004-09-26 10:25:56 -07:00 @@ -98,13 +98,24 @@ static void b44_init_rings(struct b44 *); static void b44_init_hw(struct b44 *); +static inline unsigned long br32(const struct b44 *bp, unsigned long reg) +{ + return readl(bp->regs + reg); +} + +static inline void bw32(const struct b44 *bp, + unsigned long reg, unsigned long val) +{ + writel(val, bp->regs + reg); +} + static int b44_wait_bit(struct b44 *bp, unsigned long reg, u32 bit, unsigned long timeout, const int clear) { unsigned long i; for (i = 0; i < timeout; i++) { - u32 val = br32(reg); + u32 val = br32(bp, reg); if (clear && !(val & bit)) break; @@ -168,7 +179,7 @@ static u32 ssb_get_core_rev(struct b44 *bp) { - return (br32(B44_SBIDHIGH) & SBIDHIGH_RC_MASK); + return (br32(bp, B44_SBIDHIGH) & SBIDHIGH_RC_MASK); } static u32 ssb_pci_setup(struct b44 *bp, u32 cores) @@ -180,13 +191,13 @@ ssb_get_addr(bp, SBID_REG_PCI, 0)); pci_rev = ssb_get_core_rev(bp); - val = br32(B44_SBINTVEC); + val = br32(bp, B44_SBINTVEC); val |= cores; - bw32(B44_SBINTVEC, val); + bw32(bp, B44_SBINTVEC, val); - val = br32(SSB_PCI_TRANS_2); + val = br32(bp, SSB_PCI_TRANS_2); val |= SSB_PCI_PREF | SSB_PCI_BURST; - bw32(SSB_PCI_TRANS_2, val); + bw32(bp, SSB_PCI_TRANS_2, val); pci_write_config_dword(bp->pdev, SSB_BAR0_WIN, bar_orig); @@ -195,18 +206,18 @@ static void ssb_core_disable(struct b44 *bp) { - if (br32(B44_SBTMSLOW) & SBTMSLOW_RESET) + if (br32(bp, B44_SBTMSLOW) & SBTMSLOW_RESET) return; - bw32(B44_SBTMSLOW, (SBTMSLOW_REJECT | SBTMSLOW_CLOCK)); + bw32(bp, B44_SBTMSLOW, (SBTMSLOW_REJECT | SBTMSLOW_CLOCK)); b44_wait_bit(bp, B44_SBTMSLOW, SBTMSLOW_REJECT, 100000, 0); b44_wait_bit(bp, B44_SBTMSHIGH, SBTMSHIGH_BUSY, 100000, 1); - bw32(B44_SBTMSLOW, (SBTMSLOW_FGC | SBTMSLOW_CLOCK | + bw32(bp, B44_SBTMSLOW, (SBTMSLOW_FGC | SBTMSLOW_CLOCK | SBTMSLOW_REJECT | SBTMSLOW_RESET)); - br32(B44_SBTMSLOW); + br32(bp, B44_SBTMSLOW); udelay(1); - bw32(B44_SBTMSLOW, (SBTMSLOW_REJECT | SBTMSLOW_RESET)); - br32(B44_SBTMSLOW); + bw32(bp, B44_SBTMSLOW, (SBTMSLOW_REJECT | SBTMSLOW_RESET)); + br32(bp, B44_SBTMSLOW); udelay(1); } @@ -215,31 +226,31 @@ u32 val; ssb_core_disable(bp); - bw32(B44_SBTMSLOW, (SBTMSLOW_RESET | SBTMSLOW_CLOCK | SBTMSLOW_FGC)); - br32(B44_SBTMSLOW); + bw32(bp, B44_SBTMSLOW, (SBTMSLOW_RESET | SBTMSLOW_CLOCK | SBTMSLOW_FGC)); + br32(bp, B44_SBTMSLOW); udelay(1); /* Clear SERR if set, this is a hw bug workaround. */ - if (br32(B44_SBTMSHIGH) & SBTMSHIGH_SERR) - bw32(B44_SBTMSHIGH, 0); + if (br32(bp, B44_SBTMSHIGH) & SBTMSHIGH_SERR) + bw32(bp, B44_SBTMSHIGH, 0); - val = br32(B44_SBIMSTATE); + val = br32(bp, B44_SBIMSTATE); if (val & (SBIMSTATE_IBE | SBIMSTATE_TO)) - bw32(B44_SBIMSTATE, val & ~(SBIMSTATE_IBE | SBIMSTATE_TO)); + bw32(bp, B44_SBIMSTATE, val & ~(SBIMSTATE_IBE | SBIMSTATE_TO)); - bw32(B44_SBTMSLOW, (SBTMSLOW_CLOCK | SBTMSLOW_FGC)); - br32(B44_SBTMSLOW); + bw32(bp, B44_SBTMSLOW, (SBTMSLOW_CLOCK | SBTMSLOW_FGC)); + br32(bp, B44_SBTMSLOW); udelay(1); - bw32(B44_SBTMSLOW, (SBTMSLOW_CLOCK)); - br32(B44_SBTMSLOW); + bw32(bp, B44_SBTMSLOW, (SBTMSLOW_CLOCK)); + br32(bp, B44_SBTMSLOW); udelay(1); } static int ssb_core_unit(struct b44 *bp) { #if 0 - u32 val = br32(B44_SBADMATCH0); + u32 val = br32(bp, B44_SBADMATCH0); u32 base; type = val & SBADMATCH0_TYPE_MASK; @@ -263,7 +274,7 @@ static int ssb_is_core_up(struct b44 *bp) { - return ((br32(B44_SBTMSLOW) & (SBTMSLOW_RESET | SBTMSLOW_REJECT | SBTMSLOW_CLOCK)) + return ((br32(bp, B44_SBTMSLOW) & (SBTMSLOW_RESET | SBTMSLOW_REJECT | SBTMSLOW_CLOCK)) == SBTMSLOW_CLOCK); } @@ -275,19 +286,19 @@ val |= ((u32) data[3]) << 16; val |= ((u32) data[4]) << 8; val |= ((u32) data[5]) << 0; - bw32(B44_CAM_DATA_LO, val); + bw32(bp, B44_CAM_DATA_LO, val); val = (CAM_DATA_HI_VALID | (((u32) data[0]) << 8) | (((u32) data[1]) << 0)); - bw32(B44_CAM_DATA_HI, val); - bw32(B44_CAM_CTRL, (CAM_CTRL_WRITE | + bw32(bp, B44_CAM_DATA_HI, val); + bw32(bp, B44_CAM_CTRL, (CAM_CTRL_WRITE | (index << CAM_CTRL_INDEX_SHIFT))); b44_wait_bit(bp, B44_CAM_CTRL, CAM_CTRL_BUSY, 100, 1); } static inline void __b44_disable_ints(struct b44 *bp) { - bw32(B44_IMASK, 0); + bw32(bp, B44_IMASK, 0); } static void b44_disable_ints(struct b44 *bp) @@ -295,34 +306,34 @@ __b44_disable_ints(bp); /* Flush posted writes. */ - br32(B44_IMASK); + br32(bp, B44_IMASK); } static void b44_enable_ints(struct b44 *bp) { - bw32(B44_IMASK, bp->imask); + bw32(bp, B44_IMASK, bp->imask); } static int b44_readphy(struct b44 *bp, int reg, u32 *val) { int err; - bw32(B44_EMAC_ISTAT, EMAC_INT_MII); - bw32(B44_MDIO_DATA, (MDIO_DATA_SB_START | + bw32(bp, B44_EMAC_ISTAT, EMAC_INT_MII); + bw32(bp, B44_MDIO_DATA, (MDIO_DATA_SB_START | (MDIO_OP_READ << MDIO_DATA_OP_SHIFT) | (bp->phy_addr << MDIO_DATA_PMD_SHIFT) | (reg << MDIO_DATA_RA_SHIFT) | (MDIO_TA_VALID << MDIO_DATA_TA_SHIFT))); err = b44_wait_bit(bp, B44_EMAC_ISTAT, EMAC_INT_MII, 100, 0); - *val = br32(B44_MDIO_DATA) & MDIO_DATA_DATA; + *val = br32(bp, B44_MDIO_DATA) & MDIO_DATA_DATA; return err; } static int b44_writephy(struct b44 *bp, int reg, u32 val) { - bw32(B44_EMAC_ISTAT, EMAC_INT_MII); - bw32(B44_MDIO_DATA, (MDIO_DATA_SB_START | + bw32(bp, B44_EMAC_ISTAT, EMAC_INT_MII); + bw32(bp, B44_MDIO_DATA, (MDIO_DATA_SB_START | (MDIO_OP_WRITE << MDIO_DATA_OP_SHIFT) | (bp->phy_addr << MDIO_DATA_PMD_SHIFT) | (reg << MDIO_DATA_RA_SHIFT) | @@ -382,20 +393,20 @@ bp->flags &= ~(B44_FLAG_TX_PAUSE | B44_FLAG_RX_PAUSE); bp->flags |= pause_flags; - val = br32(B44_RXCONFIG); + val = br32(bp, B44_RXCONFIG); if (pause_flags & B44_FLAG_RX_PAUSE) val |= RXCONFIG_FLOW; else val &= ~RXCONFIG_FLOW; - bw32(B44_RXCONFIG, val); + bw32(bp, B44_RXCONFIG, val); - val = br32(B44_MAC_FLOW); + val = br32(bp, B44_MAC_FLOW); if (pause_flags & B44_FLAG_TX_PAUSE) val |= (MAC_FLOW_PAUSE_ENAB | (0xc0 & MAC_FLOW_RX_HI_WATER)); else val &= ~MAC_FLOW_PAUSE_ENAB; - bw32(B44_MAC_FLOW, val); + bw32(bp, B44_MAC_FLOW, val); } static void b44_set_flow_ctrl(struct b44 *bp, u32 local, u32 remote) @@ -491,11 +502,11 @@ val = &bp->hw_stats.tx_good_octets; for (reg = B44_TX_GOOD_O; reg <= B44_TX_PAUSE; reg += 4UL) { - *val++ += br32(reg); + *val++ += br32(bp, reg); } val = &bp->hw_stats.rx_good_octets; for (reg = B44_RX_GOOD_O; reg <= B44_RX_NPAUSE; reg += 4UL) { - *val++ += br32(reg); + *val++ += br32(bp, reg); } } @@ -535,14 +546,14 @@ if (!netif_carrier_ok(bp->dev) && (bmsr & BMSR_LSTATUS)) { - u32 val = br32(B44_TX_CTRL); + u32 val = br32(bp, B44_TX_CTRL); u32 local_adv, remote_adv; if (bp->flags & B44_FLAG_FULL_DUPLEX) val |= TX_CTRL_DUPLEX; else val &= ~TX_CTRL_DUPLEX; - bw32(B44_TX_CTRL, val); + bw32(bp, B44_TX_CTRL, val); if (!(bp->flags & B44_FLAG_FORCE_LINK) && !b44_readphy(bp, MII_ADVERTISE, &local_adv) && @@ -587,7 +598,7 @@ { u32 cur, cons; - cur = br32(B44_DMATX_STAT) & DMATX_STAT_CDMASK; + cur = br32(bp, B44_DMATX_STAT) & DMATX_STAT_CDMASK; cur /= sizeof(struct dma_desc); /* XXX needs updating when NETIF_F_SG is supported */ @@ -611,7 +622,7 @@ TX_BUFFS_AVAIL(bp) > B44_TX_WAKEUP_THRESH) netif_wake_queue(bp->dev); - bw32(B44_GPTIMER, 0); + bw32(bp, B44_GPTIMER, 0); } /* Works like this. This chip writes a 'struct rx_header" 30 bytes @@ -708,7 +719,7 @@ u32 cons, prod; received = 0; - prod = br32(B44_DMARX_STAT) & DMARX_STAT_CDMASK; + prod = br32(bp, B44_DMARX_STAT) & DMARX_STAT_CDMASK; prod /= sizeof(struct dma_desc); cons = bp->rx_cons; @@ -787,7 +798,7 @@ } bp->rx_cons = cons; - bw32(B44_DMARX_PTR, cons * sizeof(struct dma_desc)); + bw32(bp, B44_DMARX_PTR, cons * sizeof(struct dma_desc)); return received; } @@ -851,8 +862,8 @@ spin_lock_irqsave(&bp->lock, flags); - istat = br32(B44_ISTAT); - imask = br32(B44_IMASK); + istat = br32(bp, B44_ISTAT); + imask = br32(bp, B44_IMASK); /* ??? What the fuck is the purpose of the interrupt mask * ??? register if we have to mask it out by hand anyways? @@ -872,8 +883,8 @@ dev->name); } - bw32(B44_ISTAT, istat); - br32(B44_ISTAT); + bw32(bp, B44_ISTAT, istat); + br32(bp, B44_ISTAT); } spin_unlock_irqrestore(&bp->lock, flags); return IRQ_RETVAL(handled); @@ -937,11 +948,11 @@ wmb(); - bw32(B44_DMATX_PTR, entry * sizeof(struct dma_desc)); + bw32(bp, B44_DMATX_PTR, entry * sizeof(struct dma_desc)); if (bp->flags & B44_FLAG_BUGGY_TXPTR) - bw32(B44_DMATX_PTR, entry * sizeof(struct dma_desc)); + bw32(bp, B44_DMATX_PTR, entry * sizeof(struct dma_desc)); if (bp->flags & B44_FLAG_REORDER_BUG) - br32(B44_DMATX_PTR); + br32(bp, B44_DMATX_PTR); if (TX_BUFFS_AVAIL(bp) < 1) netif_stop_queue(dev); @@ -1109,27 +1120,27 @@ { unsigned long reg; - bw32(B44_MIB_CTRL, MIB_CTRL_CLR_ON_READ); + bw32(bp, B44_MIB_CTRL, MIB_CTRL_CLR_ON_READ); for (reg = B44_TX_GOOD_O; reg <= B44_TX_PAUSE; reg += 4UL) - br32(reg); + br32(bp, reg); for (reg = B44_RX_GOOD_O; reg <= B44_RX_NPAUSE; reg += 4UL) - br32(reg); + br32(bp, reg); } /* bp->lock is held. */ static void b44_chip_reset(struct b44 *bp) { if (ssb_is_core_up(bp)) { - bw32(B44_RCV_LAZY, 0); - bw32(B44_ENET_CTRL, ENET_CTRL_DISABLE); + bw32(bp, B44_RCV_LAZY, 0); + bw32(bp, B44_ENET_CTRL, ENET_CTRL_DISABLE); b44_wait_bit(bp, B44_ENET_CTRL, ENET_CTRL_DISABLE, 100, 1); - bw32(B44_DMATX_CTRL, 0); + bw32(bp, B44_DMATX_CTRL, 0); bp->tx_prod = bp->tx_cons = 0; - if (br32(B44_DMARX_STAT) & DMARX_STAT_EMASK) { + if (br32(bp, B44_DMARX_STAT) & DMARX_STAT_EMASK) { b44_wait_bit(bp, B44_DMARX_STAT, DMARX_STAT_SIDLE, 100, 0); } - bw32(B44_DMARX_CTRL, 0); + bw32(bp, B44_DMARX_CTRL, 0); bp->rx_prod = bp->rx_cons = 0; } else { ssb_pci_setup(bp, (bp->core_unit == 0 ? @@ -1142,20 +1153,20 @@ b44_clear_stats(bp); /* Make PHY accessible. */ - bw32(B44_MDIO_CTRL, (MDIO_CTRL_PREAMBLE | + bw32(bp, B44_MDIO_CTRL, (MDIO_CTRL_PREAMBLE | (0x0d & MDIO_CTRL_MAXF_MASK))); - br32(B44_MDIO_CTRL); + br32(bp, B44_MDIO_CTRL); - if (!(br32(B44_DEVCTRL) & DEVCTRL_IPP)) { - bw32(B44_ENET_CTRL, ENET_CTRL_EPSEL); - br32(B44_ENET_CTRL); + if (!(br32(bp, B44_DEVCTRL) & DEVCTRL_IPP)) { + bw32(bp, B44_ENET_CTRL, ENET_CTRL_EPSEL); + br32(bp, B44_ENET_CTRL); bp->flags &= ~B44_FLAG_INTERNAL_PHY; } else { - u32 val = br32(B44_DEVCTRL); + u32 val = br32(bp, B44_DEVCTRL); if (val & DEVCTRL_EPR) { - bw32(B44_DEVCTRL, (val & ~DEVCTRL_EPR)); - br32(B44_DEVCTRL); + bw32(bp, B44_DEVCTRL, (val & ~DEVCTRL_EPR)); + br32(bp, B44_DEVCTRL); udelay(100); } bp->flags |= B44_FLAG_INTERNAL_PHY; @@ -1172,13 +1183,13 @@ /* bp->lock is held. */ static void __b44_set_mac_addr(struct b44 *bp) { - bw32(B44_CAM_CTRL, 0); + bw32(bp, B44_CAM_CTRL, 0); if (!(bp->dev->flags & IFF_PROMISC)) { u32 val; __b44_cam_write(bp, bp->dev->dev_addr, 0); - val = br32(B44_CAM_CTRL); - bw32(B44_CAM_CTRL, val | CAM_CTRL_ENABLE); + val = br32(bp, B44_CAM_CTRL); + bw32(bp, B44_CAM_CTRL, val | CAM_CTRL_ENABLE); } } @@ -1212,30 +1223,30 @@ b44_setup_phy(bp); /* Enable CRC32, set proper LED modes and power on PHY */ - bw32(B44_MAC_CTRL, MAC_CTRL_CRC32_ENAB | MAC_CTRL_PHY_LEDCTRL); - bw32(B44_RCV_LAZY, (1 << RCV_LAZY_FC_SHIFT)); + bw32(bp, B44_MAC_CTRL, MAC_CTRL_CRC32_ENAB | MAC_CTRL_PHY_LEDCTRL); + bw32(bp, B44_RCV_LAZY, (1 << RCV_LAZY_FC_SHIFT)); /* This sets the MAC address too. */ __b44_set_rx_mode(bp->dev); /* MTU + eth header + possible VLAN tag + struct rx_header */ - bw32(B44_RXMAXLEN, bp->dev->mtu + ETH_HLEN + 8 + RX_HEADER_LEN); - bw32(B44_TXMAXLEN, bp->dev->mtu + ETH_HLEN + 8 + RX_HEADER_LEN); + bw32(bp, B44_RXMAXLEN, bp->dev->mtu + ETH_HLEN + 8 + RX_HEADER_LEN); + bw32(bp, B44_TXMAXLEN, bp->dev->mtu + ETH_HLEN + 8 + RX_HEADER_LEN); - bw32(B44_TX_WMARK, 56); /* XXX magic */ - bw32(B44_DMATX_CTRL, DMATX_CTRL_ENABLE); - bw32(B44_DMATX_ADDR, bp->tx_ring_dma + bp->dma_offset); - bw32(B44_DMARX_CTRL, (DMARX_CTRL_ENABLE | + bw32(bp, B44_TX_WMARK, 56); /* XXX magic */ + bw32(bp, B44_DMATX_CTRL, DMATX_CTRL_ENABLE); + bw32(bp, B44_DMATX_ADDR, bp->tx_ring_dma + bp->dma_offset); + bw32(bp, B44_DMARX_CTRL, (DMARX_CTRL_ENABLE | (bp->rx_offset << DMARX_CTRL_ROSHIFT))); - bw32(B44_DMARX_ADDR, bp->rx_ring_dma + bp->dma_offset); + bw32(bp, B44_DMARX_ADDR, bp->rx_ring_dma + bp->dma_offset); - bw32(B44_DMARX_PTR, bp->rx_pending); + bw32(bp, B44_DMARX_PTR, bp->rx_pending); bp->rx_prod = bp->rx_pending; - bw32(B44_MIB_CTRL, MIB_CTRL_CLR_ON_READ); + bw32(bp, B44_MIB_CTRL, MIB_CTRL_CLR_ON_READ); - val = br32(B44_ENET_CTRL); - bw32(B44_ENET_CTRL, (val | ENET_CTRL_ENABLE)); + val = br32(bp, B44_ENET_CTRL); + bw32(bp, B44_ENET_CTRL, (val | ENET_CTRL_ENABLE)); } static int b44_open(struct net_device *dev) @@ -1372,11 +1383,11 @@ int i=0; unsigned char zero[6] = {0,0,0,0,0,0}; - val = br32(B44_RXCONFIG); + val = br32(bp, B44_RXCONFIG); val &= ~(RXCONFIG_PROMISC | RXCONFIG_ALLMULTI); if (dev->flags & IFF_PROMISC) { val |= RXCONFIG_PROMISC; - bw32(B44_RXCONFIG, val); + bw32(bp, B44_RXCONFIG, val); } else { __b44_set_mac_addr(bp); @@ -1388,9 +1399,9 @@ for(;i<64;i++) { __b44_cam_write(bp, zero, i); } - bw32(B44_RXCONFIG, val); - val = br32(B44_CAM_CTRL); - bw32(B44_CAM_CTRL, val | CAM_CTRL_ENABLE); + bw32(bp, B44_RXCONFIG, val); + val = br32(bp, B44_CAM_CTRL); + bw32(bp, B44_CAM_CTRL, val | CAM_CTRL_ENABLE); } } @@ -1760,7 +1771,7 @@ spin_lock_init(&bp->lock); - bp->regs = (unsigned long) ioremap(b44reg_base, b44reg_len); + bp->regs = ioremap(b44reg_base, b44reg_len); if (bp->regs == 0UL) { printk(KERN_ERR PFX "Cannot map device registers, " "aborting.\n"); @@ -1826,7 +1837,7 @@ return 0; err_out_iounmap: - iounmap((void *) bp->regs); + iounmap(bp->regs); err_out_free_dev: free_netdev(dev); @@ -1848,7 +1859,7 @@ struct b44 *bp = netdev_priv(dev); unregister_netdev(dev); - iounmap((void *) bp->regs); + iounmap(bp->regs); free_netdev(dev); pci_release_regions(pdev); pci_disable_device(pdev); diff -Nru a/drivers/net/b44.h b/drivers/net/b44.h --- a/drivers/net/b44.h 2004-09-26 10:25:56 -07:00 +++ b/drivers/net/b44.h 2004-09-26 10:25:56 -07:00 @@ -395,9 +395,6 @@ #define SSB_PCI_MASK1 0xfc000000 #define SSB_PCI_MASK2 0xc0000000 -#define br32(REG) readl(bp->regs + (REG)) -#define bw32(REG,VAL) writel((VAL), bp->regs + (REG)) - /* 4400 PHY registers */ #define B44_MII_AUXCTRL 24 /* Auxiliary Control */ #define MII_AUXCTRL_DUPLEX 0x0001 /* Full Duplex */ @@ -530,7 +527,7 @@ struct net_device_stats stats; struct b44_hw_stats hw_stats; - unsigned long regs; + void __iomem *regs; struct pci_dev *pdev; struct net_device *dev; diff -Nru a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c --- a/drivers/net/ibmveth.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/net/ibmveth.c 2004-09-26 10:25:55 -07:00 @@ -885,13 +885,16 @@ mac_addr_p = (unsigned char *) vio_get_attribute(dev, VETH_MAC_ADDR, 0); if(!mac_addr_p) { - ibmveth_error_printk("Can't find VETH_MAC_ADDR attribute\n"); + printk(KERN_ERR "(%s:%3.3d) ERROR: Can't find VETH_MAC_ADDR " + "attribute\n", __FILE__, __LINE__); return 0; } mcastFilterSize_p= (unsigned int *) vio_get_attribute(dev, VETH_MCAST_FILTER_SIZE, 0); if(!mcastFilterSize_p) { - ibmveth_error_printk("Can't find VETH_MCAST_FILTER_SIZE attribute\n"); + printk(KERN_ERR "(%s:%3.3d) ERROR: Can't find " + "VETH_MCAST_FILTER_SIZE attribute\n", + __FILE__, __LINE__); return 0; } diff -Nru a/drivers/net/loopback.c b/drivers/net/loopback.c --- a/drivers/net/loopback.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/net/loopback.c 2004-09-26 10:25:55 -07:00 @@ -49,6 +49,7 @@ #include #include #include +#include #include #include #include /* For the statistics structure. */ @@ -183,6 +184,17 @@ return stats; } +u32 loopback_get_link(struct net_device *dev) +{ + return 1; +} + +static struct ethtool_ops loopback_ethtool_ops = { + .get_link = loopback_get_link, + .get_tso = ethtool_op_get_tso, + .set_tso = ethtool_op_set_tso, +}; + struct net_device loopback_dev = { .name = "lo", .mtu = (16 * 1024) + 20 + 20 + 12, @@ -199,6 +211,7 @@ .features = NETIF_F_SG|NETIF_F_FRAGLIST |NETIF_F_NO_CSUM|NETIF_F_HIGHDMA |NETIF_F_LLTX, + .ethtool_ops = &loopback_ethtool_ops, }; /* Setup and register the of the LOOPBACK device. */ diff -Nru a/drivers/net/myri_sbus.c b/drivers/net/myri_sbus.c --- a/drivers/net/myri_sbus.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/net/myri_sbus.c 2004-09-26 10:25:55 -07:00 @@ -85,7 +85,7 @@ static struct myri_eth *root_myri_dev; #endif -static void myri_reset_off(unsigned long lp, unsigned long cregs) +static void myri_reset_off(void __iomem *lp, void __iomem *cregs) { /* Clear IRQ mask. */ sbus_writel(0, lp + LANAI_EIMASK); @@ -94,7 +94,7 @@ sbus_writel(CONTROL_ROFF, cregs + MYRICTRL_CTRL); } -static void myri_reset_on(unsigned long cregs) +static void myri_reset_on(void __iomem *cregs) { /* Enable RESET function. */ sbus_writel(CONTROL_RON, cregs + MYRICTRL_CTRL); @@ -103,14 +103,14 @@ sbus_writel(CONTROL_DIRQ, cregs + MYRICTRL_CTRL); } -static void myri_disable_irq(unsigned long lp, unsigned long cregs) +static void myri_disable_irq(void __iomem *lp, void __iomem *cregs) { sbus_writel(CONTROL_DIRQ, cregs + MYRICTRL_CTRL); sbus_writel(0, lp + LANAI_EIMASK); sbus_writel(ISTAT_HOST, lp + LANAI_ISTAT); } -static void myri_enable_irq(unsigned long lp, unsigned long cregs) +static void myri_enable_irq(void __iomem *lp, void __iomem *cregs) { sbus_writel(CONTROL_EIRQ, cregs + MYRICTRL_CTRL); sbus_writel(ISTAT_HOST, lp + LANAI_EIMASK); @@ -119,7 +119,7 @@ static inline void bang_the_chip(struct myri_eth *mp) { struct myri_shmem *shmem = mp->shmem; - unsigned long cregs = mp->cregs; + void __iomem *cregs = mp->cregs; sbus_writel(1, &shmem->send); sbus_writel(CONTROL_WON, cregs + MYRICTRL_CTRL); @@ -128,7 +128,7 @@ static int myri_do_handshake(struct myri_eth *mp) { struct myri_shmem *shmem = mp->shmem; - unsigned long cregs = mp->cregs; + void __iomem *cregs = mp->cregs; struct myri_channel *chan = &shmem->channel; int tick = 0; @@ -176,27 +176,27 @@ static int myri_load_lanai(struct myri_eth *mp) { struct net_device *dev = mp->dev; - struct myri_shmem *shmem = mp->shmem; - unsigned char *rptr; + struct myri_shmem __iomem *shmem = mp->shmem; + void __iomem *rptr; int i; myri_disable_irq(mp->lregs, mp->cregs); myri_reset_on(mp->cregs); - rptr = (unsigned char *) mp->lanai; + rptr = mp->lanai; for (i = 0; i < mp->eeprom.ramsz; i++) - sbus_writeb(0, &rptr[i]); + sbus_writeb(0, rptr + i); if (mp->eeprom.cpuvers >= CPUVERS_3_0) sbus_writel(mp->eeprom.cval, mp->lregs + LANAI_CVAL); /* Load executable code. */ for (i = 0; i < sizeof(lanai4_code); i++) - sbus_writeb(lanai4_code[i], &rptr[(lanai4_code_off * 2) + i]); + sbus_writeb(lanai4_code[i], rptr + (lanai4_code_off * 2) + i); /* Load data segment. */ for (i = 0; i < sizeof(lanai4_data); i++) - sbus_writeb(lanai4_data[i], &rptr[(lanai4_data_off * 2) + i]); + sbus_writeb(lanai4_data[i], rptr + (lanai4_data_off * 2) + i); /* Set device address. */ sbus_writeb(0, &shmem->addr[0]); @@ -237,15 +237,15 @@ static void myri_clean_rings(struct myri_eth *mp) { - struct sendq *sq = mp->sq; - struct recvq *rq = mp->rq; + struct sendq __iomem *sq = mp->sq; + struct recvq __iomem *rq = mp->rq; int i; sbus_writel(0, &rq->tail); sbus_writel(0, &rq->head); for (i = 0; i < (RX_RING_SIZE+1); i++) { if (mp->rx_skbs[i] != NULL) { - struct myri_rxd *rxd = &rq->myri_rxd[i]; + struct myri_rxd __iomem *rxd = &rq->myri_rxd[i]; u32 dma_addr; dma_addr = sbus_readl(&rxd->myri_scatters[0].addr); @@ -261,7 +261,7 @@ for (i = 0; i < TX_RING_SIZE; i++) { if (mp->tx_skbs[i] != NULL) { struct sk_buff *skb = mp->tx_skbs[i]; - struct myri_txd *txd = &sq->myri_txd[i]; + struct myri_txd __iomem *txd = &sq->myri_txd[i]; u32 dma_addr; dma_addr = sbus_readl(&txd->myri_gathers[0].addr); @@ -274,8 +274,8 @@ static void myri_init_rings(struct myri_eth *mp, int from_irq) { - struct recvq *rq = mp->rq; - struct myri_rxd *rxd = &rq->myri_rxd[0]; + struct recvq __iomem *rq = mp->rq; + struct myri_rxd __iomem *rxd = &rq->myri_rxd[0]; struct net_device *dev = mp->dev; int gfp_flags = GFP_KERNEL; int i; @@ -343,7 +343,7 @@ static void myri_tx(struct myri_eth *mp, struct net_device *dev) { - struct sendq *sq = mp->sq; + struct sendq __iomem *sq= mp->sq; int entry = mp->tx_old; int limit = sbus_readl(&sq->head); @@ -411,8 +411,8 @@ static void myri_rx(struct myri_eth *mp, struct net_device *dev) { - struct recvq *rq = mp->rq; - struct recvq *rqa = mp->rqack; + struct recvq __iomem *rq = mp->rq; + struct recvq __iomem *rqa = mp->rqack; int entry = sbus_readl(&rqa->head); int limit = sbus_readl(&rqa->tail); int drops; @@ -423,11 +423,11 @@ drops = 0; DRX(("\n")); while (entry != limit) { - struct myri_rxd *rxdack = &rqa->myri_rxd[entry]; + struct myri_rxd __iomem *rxdack = &rqa->myri_rxd[entry]; u32 csum = sbus_readl(&rxdack->csum); int len = sbus_readl(&rxdack->myri_scatters[0].len); int index = sbus_readl(&rxdack->ctx); - struct myri_rxd *rxd = &rq->myri_rxd[rq->tail]; + struct myri_rxd __iomem *rxd = &rq->myri_rxd[rq->tail]; struct sk_buff *skb = mp->rx_skbs[index]; /* Ack it. */ @@ -545,7 +545,7 @@ { struct net_device *dev = (struct net_device *) dev_id; struct myri_eth *mp = (struct myri_eth *) dev->priv; - unsigned long lregs = mp->lregs; + void __iomem *lregs = mp->lregs; struct myri_channel *chan = &mp->shmem->channel; unsigned long flags; u32 status; @@ -610,8 +610,8 @@ static int myri_start_xmit(struct sk_buff *skb, struct net_device *dev) { struct myri_eth *mp = (struct myri_eth *) dev->priv; - struct sendq *sq = mp->sq; - struct myri_txd *txd; + struct sendq __iomem *sq = mp->sq; + struct myri_txd __iomem *txd; unsigned long flags; unsigned int head, tail; int len, entry; @@ -998,22 +998,20 @@ printk("MyriCOM: Cannot map MyriCOM registers.\n"); goto err; } - mp->lanai = (unsigned short *) (mp->regs + (256 * 1024)); - mp->lanai3 = (unsigned int *) mp->lanai; - mp->lregs = (unsigned long) &mp->lanai[0x10000]; + mp->lanai = mp->regs + (256 * 1024); + mp->lregs = mp->lanai + (0x10000 * 2); } else { DET(("Mapping regs for cpuvers >= CPUVERS_4_0\n")); mp->cregs = sbus_ioremap(&sdev->resource[0], 0, PAGE_SIZE, "MyriCOM Control Regs"); mp->lregs = sbus_ioremap(&sdev->resource[0], (256 * 1024), PAGE_SIZE, "MyriCOM LANAI Regs"); - mp->lanai = (unsigned short *) + mp->lanai = sbus_ioremap(&sdev->resource[0], (512 * 1024), mp->eeprom.ramsz, "MyriCOM SRAM"); - mp->lanai3 = (unsigned int *) mp->lanai; } - DET(("Registers mapped: cregs[%lx] lregs[%lx] lanai[%p] lanai3[%p]\n", - mp->cregs, mp->lregs, mp->lanai, mp->lanai3)); + DET(("Registers mapped: cregs[%p] lregs[%p] lanai[%p]\n", + mp->cregs, mp->lregs, mp->lanai)); if (mp->eeprom.cpuvers >= CPUVERS_4_0) mp->shmem_base = 0xf000; @@ -1022,7 +1020,8 @@ DET(("Shared memory base is %04x, ", mp->shmem_base)); - mp->shmem = (struct myri_shmem *) &mp->lanai[mp->shmem_base]; + mp->shmem = (struct myri_shmem __iomem *) + (mp->lanai + (mp->shmem_base * 2)); DET(("shmem mapped at %p\n", mp->shmem)); mp->rqack = &mp->shmem->channel.recvqa; diff -Nru a/drivers/net/myri_sbus.h b/drivers/net/myri_sbus.h --- a/drivers/net/myri_sbus.h 2004-09-26 10:25:57 -07:00 +++ b/drivers/net/myri_sbus.h 2004-09-26 10:25:57 -07:00 @@ -270,22 +270,21 @@ * to obtain good cache hit rates. */ spinlock_t irq_lock; - struct myri_shmem *shmem; /* Shared data structures. */ - unsigned long cregs; /* Control register space. */ - struct recvq *rqack; /* Where we ack rx's. */ - struct recvq *rq; /* Where we put buffers. */ - struct sendq *sq; /* Where we stuff tx's. */ + struct myri_shmem __iomem *shmem; /* Shared data structures. */ + void __iomem *cregs; /* Control register space. */ + struct recvq __iomem *rqack; /* Where we ack rx's. */ + struct recvq __iomem *rq; /* Where we put buffers. */ + struct sendq __iomem *sq; /* Where we stuff tx's. */ struct net_device *dev; /* Linux/NET dev struct. */ int tx_old; /* To speed up tx cleaning. */ - unsigned long lregs; /* Quick ptr to LANAI regs. */ + void __iomem *lregs; /* Quick ptr to LANAI regs. */ struct sk_buff *rx_skbs[RX_RING_SIZE+1];/* RX skb's */ struct sk_buff *tx_skbs[TX_RING_SIZE]; /* TX skb's */ struct net_device_stats enet_stats; /* Interface stats. */ /* These are less frequently accessed. */ - unsigned long regs; /* MyriCOM register space. */ - unsigned short *lanai; /* View 2 of register space. */ - unsigned int *lanai3; /* View 3 of register space. */ + void __iomem *regs; /* MyriCOM register space. */ + void __iomem *lanai; /* View 2 of register space. */ unsigned int myri_bursts; /* SBUS bursts. */ struct myri_eeprom eeprom; /* Local copy of EEPROM. */ unsigned int reg_size; /* Size of register space. */ diff -Nru a/drivers/net/ne.c b/drivers/net/ne.c --- a/drivers/net/ne.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/net/ne.c 2004-09-26 10:25:56 -07:00 @@ -29,6 +29,7 @@ last in cleanup_modue() Richard Guenther : Added support for ISAPnP cards Paul Gortmaker : Discontinued PCI support - use ne2k-pci.c instead. + Hayato Fujiwara : Add m32r support. */ @@ -128,6 +129,14 @@ #define NESM_START_PG 0x40 /* First page of TX buffer */ #define NESM_STOP_PG 0x80 /* Last page +1 of RX ring */ +#ifdef CONFIG_PLAT_MAPPI +# define DCR_VAL 0x4b +#elif CONFIG_PLAT_OAKS32R +# define DCR_VAL 0x48 +#else +# define DCR_VAL 0x49 +#endif + static int ne_probe1(struct net_device *dev, int ioaddr); static int ne_probe_isapnp(struct net_device *dev); @@ -387,7 +396,7 @@ for (i = 0; i < 16; i++) SA_prom[i] = SA_prom[i+i]; /* We must set the 8390 for word mode. */ - outb_p(0x49, ioaddr + EN0_DCFG); + outb_p(DCR_VAL, ioaddr + EN0_DCFG); start_page = NESM_START_PG; stop_page = NESM_STOP_PG; } else { @@ -395,7 +404,12 @@ stop_page = NE1SM_STOP_PG; } +#if defined(CONFIG_PLAT_MAPPI) || defined(CONFIG_PLAT_OAKS32R) + neX000 = ((SA_prom[14] == 0x57 && SA_prom[15] == 0x57) + || (SA_prom[14] == 0x42 && SA_prom[15] == 0x42)); +#else neX000 = (SA_prom[14] == 0x57 && SA_prom[15] == 0x57); +#endif ctron = (SA_prom[0] == 0x00 && SA_prom[1] == 0x00 && SA_prom[2] == 0x1d); copam = (SA_prom[14] == 0x49 && SA_prom[15] == 0x00); @@ -476,10 +490,20 @@ dev->base_addr = ioaddr; +#ifdef CONFIG_PLAT_MAPPI + outb_p(E8390_NODMA + E8390_PAGE1 + E8390_STOP, + ioaddr + E8390_CMD); /* 0x61 */ + for (i = 0 ; i < ETHER_ADDR_LEN ; i++) { + dev->dev_addr[i] = SA_prom[i] + = inb_p(ioaddr + EN1_PHYS_SHIFT(i)); + printk(" %2.2x", SA_prom[i]); + } +#else for(i = 0; i < ETHER_ADDR_LEN; i++) { printk(" %2.2x", SA_prom[i]); dev->dev_addr[i] = SA_prom[i]; } +#endif printk("\n%s: %s found at %#x, using IRQ %d.\n", dev->name, name, ioaddr, dev->irq); @@ -487,7 +511,11 @@ ei_status.name = name; ei_status.tx_start_page = start_page; ei_status.stop_page = stop_page; +#ifdef CONFIG_PLAT_OAKS32R + ei_status.word16 = 0; +#else ei_status.word16 = (wordlength == 2); +#endif ei_status.rx_start_page = start_page + TX_PAGES; #ifdef PACKETBUF_MEMSIZE diff -Nru a/drivers/net/r8169.c b/drivers/net/r8169.c --- a/drivers/net/r8169.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/net/r8169.c 2004-09-26 10:25:56 -07:00 @@ -156,6 +156,7 @@ MODULE_DEVICE_TABLE(pci, rtl8169_pci_tbl); static int rx_copybreak = 200; +static int use_dac; enum RTL8169_registers { MAC0 = 0, /* Ethernet hardware address. */ @@ -358,6 +359,8 @@ MODULE_DESCRIPTION("RealTek RTL-8169 Gigabit Ethernet driver"); MODULE_PARM(media, "1-" __MODULE_STRING(MAX_UNITS) "i"); MODULE_PARM(rx_copybreak, "i"); +MODULE_PARM(use_dac, "i"); +MODULE_PARM_DESC(use_dac, "Enable PCI DAC. Unsafe on 32 bit PCI slot."); MODULE_LICENSE("GPL"); static int rtl8169_open(struct net_device *dev); @@ -375,7 +378,7 @@ #endif static const u16 rtl8169_intr_mask = - LinkChg | RxOverflow | RxFIFOOver | TxErr | TxOK | RxErr | RxOK; + SYSErr | LinkChg | RxOverflow | RxFIFOOver | TxErr | TxOK | RxErr | RxOK; static const u16 rtl8169_napi_event = RxOK | RxOverflow | RxFIFOOver | TxOK | TxErr; static const unsigned int rtl8169_rx_config = @@ -984,7 +987,7 @@ tp->cp_cmd = PCIMulRW | RxChkSum; if ((sizeof(dma_addr_t) > 4) && - !pci_set_dma_mask(pdev, DMA_64BIT_MASK)) + !pci_set_dma_mask(pdev, DMA_64BIT_MASK) && use_dac) tp->cp_cmd |= PCIDAC; else { rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK); @@ -1760,6 +1763,15 @@ if (!(status & rtl8169_intr_mask)) break; + + if (unlikely(status & SYSErr)) { + printk(KERN_ERR PFX "%s: PCI error (status: 0x%04x)." + " Device disabled.\n", dev->name, status); + RTL_W8(ChipCmd, 0x00); + RTL_W16(IntrMask, 0x0000); + RTL_R16(IntrMask); + break; + } if (status & LinkChg) rtl8169_check_link_status(dev, tp, ioaddr); diff -Nru a/drivers/net/smc91x.c b/drivers/net/smc91x.c --- a/drivers/net/smc91x.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/net/smc91x.c 2004-09-26 10:25:57 -07:00 @@ -55,6 +55,9 @@ * smc_phy_configure * - clean up (and fix stack overrun) in PHY * MII read/write functions + * 09/15/04 Hayato Fujiwara - Add m32r support. + * - Modify for SMP kernel; Change spin-locked + * regions. */ static const char version[] = "smc91x.c: v1.0, mar 07 2003 by Nicolas Pitre \n"; @@ -256,24 +259,18 @@ /* this enables an interrupt in the interrupt mask register */ #define SMC_ENABLE_INT(x) do { \ - unsigned long flags; \ unsigned char mask; \ - spin_lock_irqsave(&lp->lock, flags); \ mask = SMC_GET_INT_MASK(); \ mask |= (x); \ SMC_SET_INT_MASK(mask); \ - spin_unlock_irqrestore(&lp->lock, flags); \ } while (0) /* this disables an interrupt from the interrupt mask register */ #define SMC_DISABLE_INT(x) do { \ - unsigned long flags; \ unsigned char mask; \ - spin_lock_irqsave(&lp->lock, flags); \ mask = SMC_GET_INT_MASK(); \ mask &= ~(x); \ SMC_SET_INT_MASK(mask); \ - spin_unlock_irqrestore(&lp->lock, flags); \ } while (0) /* @@ -580,9 +577,12 @@ struct smc_local *lp = netdev_priv(dev); unsigned long ioaddr = dev->base_addr; unsigned int numPages, poll_count, status, saved_bank; + unsigned long flags; DBG(3, "%s: %s\n", dev->name, __FUNCTION__); + spin_lock_irqsave(&lp->lock, flags); + BUG_ON(lp->saved_skb != NULL); lp->saved_skb = skb; @@ -604,6 +604,7 @@ lp->stats.tx_errors++; lp->stats.tx_dropped++; dev_kfree_skb(skb); + spin_unlock_irqrestore(&lp->lock, flags); return 0; } @@ -652,6 +653,7 @@ } SMC_SELECT_BANK(saved_bank); + spin_unlock_irqrestore(&lp->lock, flags); return 0; } @@ -1166,6 +1168,8 @@ DBG(3, "%s: %s\n", dev->name, __FUNCTION__); + spin_lock(&lp->lock); + saved_bank = SMC_CURRENT_BANK(); SMC_SELECT_BANK(2); saved_pointer = SMC_GET_PTR(); @@ -1189,8 +1193,6 @@ if (!status) break; - spin_lock(&lp->lock); - if (status & IM_RCV_INT) { DBG(3, "%s: RX irq\n", dev->name); smc_rcv(dev); @@ -1239,7 +1241,6 @@ PRINTK("%s: UNSUPPORTED: ERCV INTERRUPT \n", dev->name); } - spin_unlock(&lp->lock); } while (--timeout); /* restore register states */ @@ -1249,6 +1250,7 @@ DBG(3, "%s: Interrupt done (%d loops)\n", dev->name, 8-timeout); + spin_unlock(&lp->lock); /* * We return IRQ_HANDLED unconditionally here even if there was * nothing to do. There is a possibility that a packet might @@ -1264,7 +1266,9 @@ static void smc_timeout(struct net_device *dev) { struct smc_local *lp = netdev_priv(dev); + unsigned long flags; + spin_lock_irqsave(&lp->lock, flags); DBG(2, "%s: %s\n", dev->name, __FUNCTION__); smc_reset(dev); @@ -1298,6 +1302,9 @@ } /* We can accept TX packets again */ dev->trans_start = jiffies; + + spin_unlock_irqrestore(&lp->lock, flags); + netif_wake_queue(dev); } @@ -1438,7 +1445,7 @@ * address using ifconfig eth0 hw ether xx:xx:xx:xx:xx:xx */ if (!is_valid_ether_addr(dev->dev_addr)) { - DBG(2, (KERN_DEBUG "smc_open: no valid ethernet hw addr\n")); + DBG(2, "smc_open: no valid ethernet hw addr\n"); return -EINVAL; } @@ -1878,7 +1885,9 @@ if (retval) goto err_out; +#if !defined(__m32r__) set_irq_type(dev->irq, IRQT_RISING); +#endif #ifdef SMC_USE_PXA_DMA { int dma = pxa_request_dma(dev->name, DMA_PRIO_LOW, diff -Nru a/drivers/net/smc91x.h b/drivers/net/smc91x.h --- a/drivers/net/smc91x.h 2004-09-26 10:25:57 -07:00 +++ b/drivers/net/smc91x.h 2004-09-26 10:25:57 -07:00 @@ -160,6 +160,19 @@ #define SMC_insw(a, r, p, l) insw((a) + (r), p, l) #define SMC_outsw(a, r, p, l) outsw((a) + (r), p, l) +#elif defined(CONFIG_M32R) + +#define SMC_CAN_USE_8BIT 0 +#define SMC_CAN_USE_16BIT 1 +#define SMC_CAN_USE_32BIT 0 + +#define SMC_inb(a, r) inb((a) + (r) - 0xa0000000) +#define SMC_inw(a, r) inw((a) + (r) - 0xa0000000) +#define SMC_outb(v, a, r) outb(v, (a) + (r) - 0xa0000000) +#define SMC_outw(v, a, r) outw(v, (a) + (r) - 0xa0000000) +#define SMC_insw(a, r, p, l) insw((a) + (r) - 0xa0000000, p, l) +#define SMC_outsw(a, r, p, l) outsw((a) + (r) - 0xa0000000, p, l) + #else #define SMC_CAN_USE_8BIT 1 diff -Nru a/drivers/net/sunbmac.c b/drivers/net/sunbmac.c --- a/drivers/net/sunbmac.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/net/sunbmac.c 2004-09-26 10:25:56 -07:00 @@ -68,7 +68,7 @@ #define QEC_RESET_TRIES 200 -static int qec_global_reset(unsigned long gregs) +static int qec_global_reset(void __iomem *gregs) { int tries = QEC_RESET_TRIES; @@ -88,7 +88,7 @@ static void qec_init(struct bigmac *bp) { - unsigned long gregs = bp->gregs; + void __iomem *gregs = bp->gregs; struct sbus_dev *qec_sdev = bp->qec_sdev; u8 bsizes = bp->bigmac_bursts; u32 regval; @@ -117,7 +117,7 @@ #define TX_RESET_TRIES 32 #define RX_RESET_TRIES 32 -static void bigmac_tx_reset(unsigned long bregs) +static void bigmac_tx_reset(void __iomem *bregs) { int tries = TX_RESET_TRIES; @@ -137,7 +137,7 @@ } } -static void bigmac_rx_reset(unsigned long bregs) +static void bigmac_rx_reset(void __iomem *bregs) { int tries = RX_RESET_TRIES; @@ -159,7 +159,7 @@ bigmac_rx_reset(bp->bregs); } -static void bigmac_get_counters(struct bigmac *bp, unsigned long bregs) +static void bigmac_get_counters(struct bigmac *bp, void __iomem *bregs) { struct net_device_stats *stats = &bp->enet_stats; @@ -244,7 +244,7 @@ #define MGMT_CLKON (MGMT_PAL_INT_MDIO|MGMT_PAL_EXT_MDIO|MGMT_PAL_OENAB|MGMT_PAL_DCLOCK) #define MGMT_CLKOFF (MGMT_PAL_INT_MDIO|MGMT_PAL_EXT_MDIO|MGMT_PAL_OENAB) -static void idle_transceiver(unsigned long tregs) +static void idle_transceiver(void __iomem *tregs) { int i = 20; @@ -256,7 +256,7 @@ } } -static void write_tcvr_bit(struct bigmac *bp, unsigned long tregs, int bit) +static void write_tcvr_bit(struct bigmac *bp, void __iomem *tregs, int bit) { if (bp->tcvr_type == internal) { bit = (bit & 1) << 3; @@ -279,7 +279,7 @@ } } -static int read_tcvr_bit(struct bigmac *bp, unsigned long tregs) +static int read_tcvr_bit(struct bigmac *bp, void __iomem *tregs) { int retval = 0; @@ -302,7 +302,7 @@ return retval; } -static int read_tcvr_bit2(struct bigmac *bp, unsigned long tregs) +static int read_tcvr_bit2(struct bigmac *bp, void __iomem *tregs) { int retval = 0; @@ -325,7 +325,7 @@ } static void put_tcvr_byte(struct bigmac *bp, - unsigned long tregs, + void __iomem *tregs, unsigned int byte) { int shift = 4; @@ -336,7 +336,7 @@ } while (shift >= 0); } -static void bigmac_tcvr_write(struct bigmac *bp, unsigned long tregs, +static void bigmac_tcvr_write(struct bigmac *bp, void __iomem *tregs, int reg, unsigned short val) { int shift; @@ -376,7 +376,7 @@ } static unsigned short bigmac_tcvr_read(struct bigmac *bp, - unsigned long tregs, + void __iomem *tregs, int reg) { unsigned short retval = 0; @@ -444,7 +444,7 @@ static void bigmac_tcvr_init(struct bigmac *bp) { - unsigned long tregs = bp->tregs; + void __iomem *tregs = bp->tregs; u32 mpal; idle_transceiver(tregs); @@ -482,7 +482,7 @@ static int bigmac_init(struct bigmac *, int); -static int try_next_permutation(struct bigmac *bp, unsigned long tregs) +static int try_next_permutation(struct bigmac *bp, void __iomem *tregs) { if (bp->sw_bmcr & BMCR_SPEED100) { int timeout; @@ -518,7 +518,7 @@ static void bigmac_timer(unsigned long data) { struct bigmac *bp = (struct bigmac *) data; - unsigned long tregs = bp->tregs; + void __iomem *tregs = bp->tregs; int restart_timer = 0; bp->timer_ticks++; @@ -573,7 +573,7 @@ */ static void bigmac_begin_auto_negotiation(struct bigmac *bp) { - unsigned long tregs = bp->tregs; + void __iomem *tregs = bp->tregs; int timeout; /* Grab new software copies of PHY registers. */ @@ -612,9 +612,9 @@ static int bigmac_init(struct bigmac *bp, int from_irq) { - unsigned long gregs = bp->gregs; - unsigned long cregs = bp->creg; - unsigned long bregs = bp->bregs; + void __iomem *gregs = bp->gregs; + void __iomem *cregs = bp->creg; + void __iomem *bregs = bp->bregs; unsigned char *e = &bp->dev->dev_addr[0]; /* Latch current counters into statistics. */ @@ -987,7 +987,7 @@ static void bigmac_set_multicast(struct net_device *dev) { struct bigmac *bp = (struct bigmac *) dev->priv; - unsigned long bregs = bp->bregs; + void __iomem *bregs = bp->bregs; struct dev_mc_list *dmi = dev->mc_list; char *addrs; int i; diff -Nru a/drivers/net/sunbmac.h b/drivers/net/sunbmac.h --- a/drivers/net/sunbmac.h 2004-09-26 10:25:55 -07:00 +++ b/drivers/net/sunbmac.h 2004-09-26 10:25:55 -07:00 @@ -303,10 +303,10 @@ }; struct bigmac { - unsigned long gregs; /* QEC Global Registers */ - unsigned long creg; /* QEC BigMAC Channel Registers */ - unsigned long bregs; /* BigMAC Registers */ - unsigned long tregs; /* BigMAC Transceiver */ + void __iomem *gregs; /* QEC Global Registers */ + void __iomem *creg; /* QEC BigMAC Channel Registers */ + void __iomem *bregs; /* BigMAC Registers */ + void __iomem *tregs; /* BigMAC Transceiver */ struct bmac_init_block *bmac_block; /* RX and TX descriptors */ __u32 bblock_dvma; /* RX and TX descriptors */ diff -Nru a/drivers/net/sungem.c b/drivers/net/sungem.c --- a/drivers/net/sungem.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/net/sungem.c 2004-09-26 10:25:57 -07:00 @@ -5,6 +5,9 @@ * * Support for Apple GMAC and assorted PHYs by * Benjamin Herrenscmidt (benh@kernel.crashing.org) + * + * NAPI and NETPOLL support + * (C) 2004 by Eric Lemoine (eric.lemoine@gmail.com) * * TODO: * - Get rid of all those nasty mdelay's and replace them @@ -832,7 +835,9 @@ } /* Run TX completion thread */ + spin_lock(&gp->tx_lock); gem_tx(dev, gp, gp->status); + spin_unlock(&gp->tx_lock); spin_unlock_irqrestore(&gp->lock, flags); @@ -896,6 +901,16 @@ return IRQ_HANDLED; } +#ifdef CONFIG_NET_POLL_CONTROLLER +static void gem_poll_controller(struct net_device *dev) +{ + /* gem_interrupt is safe to reentrance so no need + * to disable_irq here. + */ + gem_interrupt(dev->irq, dev, NULL); +} +#endif + static void gem_tx_timeout(struct net_device *dev) { struct gem *gp = dev->priv; @@ -917,10 +932,12 @@ readl(gp->regs + MAC_RXCFG)); spin_lock_irq(&gp->lock); + spin_lock(&gp->tx_lock); gp->reset_task_pending = 2; schedule_work(&gp->reset_task); + spin_unlock(&gp->tx_lock); spin_unlock_irq(&gp->lock); } @@ -938,6 +955,7 @@ struct gem *gp = dev->priv; int entry; u64 ctrl; + unsigned long flags; ctrl = 0; if (skb->ip_summed == CHECKSUM_HW) { @@ -951,12 +969,17 @@ (csum_stuff_off << 21)); } - spin_lock_irq(&gp->lock); + local_irq_save(flags); + if (!spin_trylock(&gp->tx_lock)) { + /* Tell upper layer to requeue */ + local_irq_restore(flags); + return -1; + } /* This is a hard error, log it. */ if (TX_BUFFS_AVAIL(gp) <= (skb_shinfo(skb)->nr_frags + 1)) { netif_stop_queue(dev); - spin_unlock_irq(&gp->lock); + spin_unlock_irqrestore(&gp->tx_lock, flags); printk(KERN_ERR PFX "%s: BUG! Tx Ring full when queue awake!\n", dev->name); return 1; @@ -1043,7 +1066,7 @@ dev->name, entry, skb->len); mb(); writel(gp->tx_new, gp->regs + TXDMA_KICK); - spin_unlock_irq(&gp->lock); + spin_unlock_irqrestore(&gp->tx_lock, flags); dev->trans_start = jiffies; @@ -1074,9 +1097,11 @@ } spin_lock_irq(&gp->lock); + spin_lock(&gp->tx_lock); dev->mtu = new_mtu; gp->reset_task_pending = 1; schedule_work(&gp->reset_task); + spin_unlock(&gp->tx_lock); spin_unlock_irq(&gp->lock); flush_scheduled_work(); @@ -1086,7 +1111,7 @@ #define STOP_TRIES 32 -/* Must be invoked under gp->lock. */ +/* Must be invoked under gp->lock and gp->tx_lock. */ static void gem_stop(struct gem *gp) { int limit; @@ -1112,7 +1137,7 @@ printk(KERN_ERR "%s: SW reset is ghetto.\n", gp->dev->name); } -/* Must be invoked under gp->lock. */ +/* Must be invoked under gp->lock and gp->tx_lock. */ static void gem_start_dma(struct gem *gp) { unsigned long val; @@ -1137,7 +1162,7 @@ } -/* Must be invoked under gp->lock. */ +/* Must be invoked under gp->lock and gp->tx_lock. */ // XXX dbl check what that function should do when called on PCS PHY static void gem_begin_auto_negotiation(struct gem *gp, struct ethtool_cmd *ep) { @@ -1224,7 +1249,7 @@ /* A link-up condition has occurred, initialize and enable the * rest of the chip. * - * Must be invoked under gp->lock. + * Must be invoked under gp->lock and gp->tx_lock. */ static int gem_set_link_modes(struct gem *gp) { @@ -1331,7 +1356,7 @@ return 0; } -/* Must be invoked under gp->lock. */ +/* Must be invoked under gp->lock and gp->tx_lock. */ static int gem_mdio_link_not_up(struct gem *gp) { switch (gp->lstate) { @@ -1389,6 +1414,7 @@ netif_poll_disable(gp->dev); spin_lock_irq(&gp->lock); + spin_lock(&gp->tx_lock); if (gp->hw_running && gp->opened) { netif_stop_queue(gp->dev); @@ -1404,6 +1430,7 @@ } gp->reset_task_pending = 0; + spin_unlock(&gp->tx_lock); spin_unlock_irq(&gp->lock); netif_poll_enable(gp->dev); } @@ -1417,6 +1444,7 @@ return; spin_lock_irq(&gp->lock); + spin_lock(&gp->tx_lock); /* If the link of task is still pending, we just * reschedule the link timer @@ -1486,10 +1514,11 @@ restart: mod_timer(&gp->link_timer, jiffies + ((12 * HZ) / 10)); out_unlock: + spin_unlock(&gp->tx_lock); spin_unlock_irq(&gp->lock); } -/* Must be invoked under gp->lock. */ +/* Must be invoked under gp->lock and gp->tx_lock. */ static void gem_clean_rings(struct gem *gp) { struct gem_init_block *gb = gp->init_block; @@ -1540,7 +1569,7 @@ } } -/* Must be invoked under gp->lock. */ +/* Must be invoked under gp->lock and gp->tx_lock. */ static void gem_init_rings(struct gem *gp) { struct gem_init_block *gb = gp->init_block; @@ -1590,7 +1619,7 @@ wmb(); } -/* Must be invoked under gp->lock. */ +/* Must be invoked under gp->lock and gp->tx_lock. */ static void gem_init_phy(struct gem *gp) { u32 mifcfg; @@ -1728,7 +1757,7 @@ } } -/* Must be invoked under gp->lock. */ +/* Must be invoked under gp->lock and gp->tx_lock. */ static void gem_init_dma(struct gem *gp) { u64 desc_dma = (u64) gp->gblock_dvma; @@ -1766,7 +1795,7 @@ gp->regs + RXDMA_BLANK); } -/* Must be invoked under gp->lock. */ +/* Must be invoked under gp->lock and gp->tx_lock. */ static u32 gem_setup_multicast(struct gem *gp) { @@ -1809,7 +1838,7 @@ return rxcfg; } -/* Must be invoked under gp->lock. */ +/* Must be invoked under gp->lock and gp->tx_lock. */ static void gem_init_mac(struct gem *gp) { unsigned char *e = &gp->dev->dev_addr[0]; @@ -1887,7 +1916,7 @@ writel(0xffffffff, gp->regs + MAC_MCMASK); } -/* Must be invoked under gp->lock. */ +/* Must be invoked under gp->lock and gp->tx_lock. */ static void gem_init_pause_thresholds(struct gem *gp) { u32 cfg; @@ -2023,7 +2052,7 @@ return 0; } -/* Must be invoked under gp->lock. */ +/* Must be invoked under gp->lock and gp->tx_lock. */ static void gem_init_hw(struct gem *gp, int restart_link) { /* On Apple's gmac, I initialize the PHY only after @@ -2121,9 +2150,11 @@ if (!gp->wake_on_lan) { spin_lock_irqsave(&gp->lock, flags); + spin_lock(&gp->tx_lock); gem_stop(gp); writel(MAC_TXRST_CMD, gp->regs + MAC_TXRST); writel(MAC_RXRST_CMD, gp->regs + MAC_RXRST); + spin_unlock(&gp->tx_lock); spin_unlock_irqrestore(&gp->lock, flags); } @@ -2171,8 +2202,10 @@ unsigned long flags; spin_lock_irqsave(&gp->lock, flags); + spin_lock(&gp->tx_lock); gem_stop(gp); - spin_unlock_irqrestore(&gp->lock, flags); + spin_unlock(&gp->tx_lock); + spin_unlock_irqrestore(&gp->lock, flags); } } @@ -2232,7 +2265,9 @@ /* Reset the chip */ spin_lock_irq(&gp->lock); + spin_lock(&gp->tx_lock); gem_stop(gp); + spin_unlock(&gp->tx_lock); spin_unlock_irq(&gp->lock); gp->hw_running = 1; @@ -2246,6 +2281,7 @@ printk(KERN_ERR "%s: failed to request irq !\n", gp->dev->name); spin_lock_irq(&gp->lock); + spin_lock(&gp->tx_lock); #ifdef CONFIG_PPC_PMAC if (!hw_was_up && gp->pdev->vendor == PCI_VENDOR_ID_APPLE) gem_apple_powerdown(gp); @@ -2254,12 +2290,14 @@ gp->pm_timer.expires = jiffies + 10*HZ; add_timer(&gp->pm_timer); up(&gp->pm_sem); + spin_unlock(&gp->tx_lock); spin_unlock_irq(&gp->lock); return -EAGAIN; } spin_lock_irq(&gp->lock); + spin_lock(&gp->tx_lock); /* Allocate & setup ring buffers */ gem_init_rings(gp); @@ -2269,6 +2307,7 @@ gp->opened = 1; + spin_unlock(&gp->tx_lock); spin_unlock_irq(&gp->lock); up(&gp->pm_sem); @@ -2289,6 +2328,7 @@ /* Stop traffic, mark us closed */ spin_lock_irq(&gp->lock); + spin_lock(&gp->tx_lock); gp->opened = 0; @@ -2303,6 +2343,7 @@ /* Bye, the pm timer will finish the job */ free_irq(gp->pdev->irq, (void *) dev); + spin_unlock(&gp->tx_lock); spin_unlock_irq(&gp->lock); /* Fire the PM timer that will shut us down in about 10 seconds */ @@ -2333,6 +2374,7 @@ /* If the driver is opened, we stop the DMA */ if (gp->opened) { spin_lock_irq(&gp->lock); + spin_lock(&gp->tx_lock); /* Stop traffic, mark us closed */ netif_device_detach(dev); @@ -2343,6 +2385,7 @@ /* Get rid of ring buffers */ gem_clean_rings(gp); + spin_unlock(&gp->tx_lock); spin_unlock_irq(&gp->lock); if (gp->pdev->vendor == PCI_VENDOR_ID_APPLE) @@ -2376,12 +2419,14 @@ } #endif /* CONFIG_PPC_PMAC */ spin_lock_irq(&gp->lock); + spin_lock(&gp->tx_lock); gem_stop(gp); gp->hw_running = 1; gem_init_rings(gp); gem_init_hw(gp, 1); + spin_unlock(&gp->tx_lock); spin_unlock_irq(&gp->lock); netif_device_attach(dev); @@ -2402,6 +2447,7 @@ struct net_device_stats *stats = &gp->net_stats; spin_lock_irq(&gp->lock); + spin_lock(&gp->tx_lock); if (gp->hw_running) { stats->rx_crc_errors += readl(gp->regs + MAC_FCSERR); @@ -2421,6 +2467,7 @@ writel(0, gp->regs + MAC_LCOLL); } + spin_unlock(&gp->tx_lock); spin_unlock_irq(&gp->lock); return &gp->net_stats; @@ -2436,6 +2483,7 @@ return; spin_lock_irq(&gp->lock); + spin_lock(&gp->tx_lock); netif_stop_queue(dev); @@ -2460,6 +2508,7 @@ netif_wake_queue(dev); + spin_unlock(&gp->tx_lock); spin_unlock_irq(&gp->lock); } @@ -2491,6 +2540,7 @@ /* Return current PHY settings */ spin_lock_irq(&gp->lock); + spin_lock(&gp->tx_lock); cmd->autoneg = gp->want_autoneg; cmd->speed = gp->phy_mii.speed; cmd->duplex = gp->phy_mii.duplex; @@ -2502,6 +2552,7 @@ */ if (cmd->advertising == 0) cmd->advertising = cmd->supported; + spin_unlock(&gp->tx_lock); spin_unlock_irq(&gp->lock); } else { // XXX PCS ? cmd->supported = @@ -2541,7 +2592,9 @@ /* Apply settings and restart link process. */ spin_lock_irq(&gp->lock); + spin_lock(&gp->tx_lock); gem_begin_auto_negotiation(gp, cmd); + spin_unlock(&gp->tx_lock); spin_unlock_irq(&gp->lock); return 0; @@ -2556,7 +2609,9 @@ /* Restart link process. */ spin_lock_irq(&gp->lock); + spin_lock(&gp->tx_lock); gem_begin_auto_negotiation(gp, NULL); + spin_unlock(&gp->tx_lock); spin_unlock_irq(&gp->lock); return 0; @@ -2808,6 +2863,7 @@ gp->msg_enable = DEFAULT_MSG; spin_lock_init(&gp->lock); + spin_lock_init(&gp->tx_lock); init_MUTEX(&gp->pm_sem); init_timer(&gp->link_timer); @@ -2843,7 +2899,9 @@ gem_apple_powerup(gp); #endif spin_lock_irq(&gp->lock); + spin_lock(&gp->tx_lock); gem_stop(gp); + spin_unlock(&gp->tx_lock); spin_unlock_irq(&gp->lock); /* Fill up the mii_phy structure (even if we won't use it) */ @@ -2889,6 +2947,9 @@ dev->change_mtu = gem_change_mtu; dev->irq = pdev->irq; dev->dma = 0; +#ifdef CONFIG_NET_POLL_CONTROLLER + dev->poll_controller = gem_poll_controller; +#endif if (register_netdev(dev)) { printk(KERN_ERR PFX "Cannot register net device, " @@ -2906,9 +2967,11 @@ /* Detect & init PHY, start autoneg */ spin_lock_irq(&gp->lock); + spin_lock(&gp->tx_lock); gp->hw_running = 1; gem_init_phy(gp); gem_begin_auto_negotiation(gp, NULL); + spin_unlock(&gp->tx_lock); spin_unlock_irq(&gp->lock); if (gp->phy_type == phy_mii_mdio0 || @@ -2919,7 +2982,7 @@ pci_set_drvdata(pdev, dev); /* GEM can do it all... */ - dev->features |= NETIF_F_SG | NETIF_F_HW_CSUM; + dev->features |= NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_LLTX; if (pci_using_dac) dev->features |= NETIF_F_HIGHDMA; diff -Nru a/drivers/net/sungem.h b/drivers/net/sungem.h --- a/drivers/net/sungem.h 2004-09-26 10:25:56 -07:00 +++ b/drivers/net/sungem.h 2004-09-26 10:25:56 -07:00 @@ -953,6 +953,7 @@ struct gem { spinlock_t lock; + spinlock_t tx_lock; void __iomem *regs; int rx_new, rx_old; int tx_new, tx_old; diff -Nru a/drivers/net/sunhme.c b/drivers/net/sunhme.c --- a/drivers/net/sunhme.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/net/sunhme.c 2004-09-26 10:25:56 -07:00 @@ -203,12 +203,12 @@ */ #if defined(CONFIG_SBUS) && defined(CONFIG_PCI) -static void sbus_hme_write32(unsigned long reg, u32 val) +static void sbus_hme_write32(void __iomem *reg, u32 val) { sbus_writel(val, reg); } -static u32 sbus_hme_read32(unsigned long reg) +static u32 sbus_hme_read32(void __iomem *reg) { return sbus_readl(reg); } @@ -232,12 +232,12 @@ return *p; } -static void pci_hme_write32(unsigned long reg, u32 val) +static void pci_hme_write32(void __iomem *reg, u32 val) { writel(val, reg); } -static u32 pci_hme_read32(unsigned long reg) +static u32 pci_hme_read32(void __iomem *reg) { return readl(reg); } @@ -354,7 +354,7 @@ /* Oh yes, the MIF BitBang is mighty fun to program. BitBucket is more like it. */ -static void BB_PUT_BIT(struct happy_meal *hp, unsigned long tregs, int bit) +static void BB_PUT_BIT(struct happy_meal *hp, void __iomem *tregs, int bit) { hme_write32(hp, tregs + TCVR_BBDATA, bit); hme_write32(hp, tregs + TCVR_BBCLOCK, 0); @@ -362,7 +362,7 @@ } #if 0 -static u32 BB_GET_BIT(struct happy_meal *hp, unsigned long tregs, int internal) +static u32 BB_GET_BIT(struct happy_meal *hp, void __iomem *tregs, int internal) { u32 ret; @@ -378,7 +378,7 @@ } #endif -static u32 BB_GET_BIT2(struct happy_meal *hp, unsigned long tregs, int internal) +static u32 BB_GET_BIT2(struct happy_meal *hp, void __iomem *tregs, int internal) { u32 retval; @@ -397,7 +397,7 @@ #define TCVR_FAILURE 0x80000000 /* Impossible MIF read value */ static int happy_meal_bb_read(struct happy_meal *hp, - unsigned long tregs, int reg) + void __iomem *tregs, int reg) { u32 tmp; int retval = 0; @@ -443,7 +443,7 @@ } static void happy_meal_bb_write(struct happy_meal *hp, - unsigned long tregs, int reg, + void __iomem *tregs, int reg, unsigned short value) { u32 tmp; @@ -488,7 +488,7 @@ #define TCVR_READ_TRIES 16 static int happy_meal_tcvr_read(struct happy_meal *hp, - unsigned long tregs, int reg) + void __iomem *tregs, int reg) { int tries = TCVR_READ_TRIES; int retval; @@ -520,7 +520,7 @@ #define TCVR_WRITE_TRIES 16 static void happy_meal_tcvr_write(struct happy_meal *hp, - unsigned long tregs, int reg, + void __iomem *tregs, int reg, unsigned short value) { int tries = TCVR_WRITE_TRIES; @@ -579,7 +579,7 @@ * service routine, and the chip is reset, or the link is ifconfig'd down * and then back up, this entire process repeats itself all over again. */ -static int try_next_permutation(struct happy_meal *hp, unsigned long tregs) +static int try_next_permutation(struct happy_meal *hp, void __iomem *tregs) { hp->sw_bmcr = happy_meal_tcvr_read(hp, tregs, MII_BMCR); @@ -603,7 +603,7 @@ return -1; } -static void display_link_mode(struct happy_meal *hp, unsigned long tregs) +static void display_link_mode(struct happy_meal *hp, void __iomem *tregs) { printk(KERN_INFO "%s: Link is up using ", hp->dev->name); if (hp->tcvr_type == external) @@ -625,7 +625,7 @@ } } -static void display_forced_link_mode(struct happy_meal *hp, unsigned long tregs) +static void display_forced_link_mode(struct happy_meal *hp, void __iomem *tregs) { printk(KERN_INFO "%s: Link has been forced up using ", hp->dev->name); if (hp->tcvr_type == external) @@ -644,7 +644,7 @@ printk("Half Duplex.\n"); } -static int set_happy_link_modes(struct happy_meal *hp, unsigned long tregs) +static int set_happy_link_modes(struct happy_meal *hp, void __iomem *tregs) { int full; @@ -708,7 +708,7 @@ static int is_lucent_phy(struct happy_meal *hp) { - unsigned long tregs = hp->tcvregs; + void __iomem *tregs = hp->tcvregs; unsigned short mr2, mr3; int ret = 0; @@ -724,7 +724,7 @@ static void happy_meal_timer(unsigned long data) { struct happy_meal *hp = (struct happy_meal *) data; - unsigned long tregs = hp->tcvregs; + void __iomem *tregs = hp->tcvregs; int restart_timer = 0; spin_lock_irq(&hp->happy_lock); @@ -905,7 +905,7 @@ #define RX_RESET_TRIES 32 /* hp->happy_lock must be held */ -static void happy_meal_tx_reset(struct happy_meal *hp, unsigned long bregs) +static void happy_meal_tx_reset(struct happy_meal *hp, void __iomem *bregs) { int tries = TX_RESET_TRIES; @@ -925,7 +925,7 @@ } /* hp->happy_lock must be held */ -static void happy_meal_rx_reset(struct happy_meal *hp, unsigned long bregs) +static void happy_meal_rx_reset(struct happy_meal *hp, void __iomem *bregs) { int tries = RX_RESET_TRIES; @@ -947,7 +947,7 @@ #define STOP_TRIES 16 /* hp->happy_lock must be held */ -static void happy_meal_stop(struct happy_meal *hp, unsigned long gregs) +static void happy_meal_stop(struct happy_meal *hp, void __iomem *gregs) { int tries = STOP_TRIES; @@ -967,7 +967,7 @@ } /* hp->happy_lock must be held */ -static void happy_meal_get_counters(struct happy_meal *hp, unsigned long bregs) +static void happy_meal_get_counters(struct happy_meal *hp, void __iomem *bregs) { struct net_device_stats *stats = &hp->net_stats; @@ -990,7 +990,7 @@ } /* hp->happy_lock must be held */ -static void happy_meal_poll_stop(struct happy_meal *hp, unsigned long tregs) +static void happy_meal_poll_stop(struct happy_meal *hp, void __iomem *tregs) { ASD(("happy_meal_poll_stop: ")); @@ -1025,7 +1025,7 @@ #define TCVR_UNISOLATE_TRIES 32 /* Dis-isolation can take longer. */ /* hp->happy_lock must be held */ -static int happy_meal_tcvr_reset(struct happy_meal *hp, unsigned long tregs) +static int happy_meal_tcvr_reset(struct happy_meal *hp, void __iomem *tregs) { u32 tconfig; int result, tries = TCVR_RESET_TRIES; @@ -1123,7 +1123,7 @@ * * hp->happy_lock must be held */ -static void happy_meal_transceiver_check(struct happy_meal *hp, unsigned long tregs) +static void happy_meal_transceiver_check(struct happy_meal *hp, void __iomem *tregs) { unsigned long tconfig = hme_read32(hp, tregs + TCVR_CFG); @@ -1318,7 +1318,7 @@ /* hp->happy_lock must be held */ static void happy_meal_begin_auto_negotiation(struct happy_meal *hp, - unsigned long tregs, + void __iomem *tregs, struct ethtool_cmd *ep) { int timeout; @@ -1443,11 +1443,11 @@ /* hp->happy_lock must be held */ static int happy_meal_init(struct happy_meal *hp) { - unsigned long gregs = hp->gregs; - unsigned long etxregs = hp->etxregs; - unsigned long erxregs = hp->erxregs; - unsigned long bregs = hp->bigmacregs; - unsigned long tregs = hp->tcvregs; + void __iomem *gregs = hp->gregs; + void __iomem *etxregs = hp->etxregs; + void __iomem *erxregs = hp->erxregs; + void __iomem *bregs = hp->bigmacregs; + void __iomem *tregs = hp->tcvregs; u32 regtmp, rxcfg; unsigned char *e = &hp->dev->dev_addr[0]; @@ -1736,9 +1736,9 @@ /* hp->happy_lock must be held */ static void happy_meal_set_initial_advertisement(struct happy_meal *hp) { - unsigned long tregs = hp->tcvregs; - unsigned long bregs = hp->bigmacregs; - unsigned long gregs = hp->gregs; + void __iomem *tregs = hp->tcvregs; + void __iomem *bregs = hp->bigmacregs; + void __iomem *gregs = hp->gregs; happy_meal_stop(hp, gregs); hme_write32(hp, tregs + TCVR_IMASK, 0xffff); @@ -1910,7 +1910,7 @@ /* hp->happy_lock must be held */ static void happy_meal_mif_interrupt(struct happy_meal *hp) { - unsigned long tregs = hp->tcvregs; + void __iomem *tregs = hp->tcvregs; printk(KERN_INFO "%s: Link status change.\n", hp->dev->name); hp->sw_bmcr = happy_meal_tcvr_read(hp, tregs, MII_BMCR); @@ -2390,7 +2390,7 @@ static void happy_meal_set_multicast(struct net_device *dev) { struct happy_meal *hp = dev->priv; - unsigned long bregs = hp->bigmacregs; + void __iomem *bregs = hp->bigmacregs; struct dev_mc_list *dmi = dev->mc_list; char *addrs; int i; @@ -3025,7 +3025,8 @@ #endif struct happy_meal *hp; struct net_device *dev; - unsigned long hpreg_base; + void __iomem *hpreg_base; + unsigned long hpreg_res; int i, qfe_slot = -1; char prom_name[64]; int err; @@ -3084,7 +3085,7 @@ qp->happy_meals[qfe_slot] = dev; } - hpreg_base = pci_resource_start(pdev, 0); + hpreg_res = pci_resource_start(pdev, 0); err = -ENODEV; if ((pci_resource_flags(pdev, 0) & IORESOURCE_IO) != 0) { printk(KERN_ERR "happymeal(PCI): Cannot find proper PCI device base address.\n"); @@ -3096,7 +3097,7 @@ goto err_out_clear_quattro; } - if ((hpreg_base = (unsigned long) ioremap(hpreg_base, 0x8000)) == 0) { + if ((hpreg_base = ioremap(hpreg_res, 0x8000)) == 0) { printk(KERN_ERR "happymeal(PCI): Unable to remap card memory.\n"); goto err_out_free_res; } diff -Nru a/drivers/net/sunhme.h b/drivers/net/sunhme.h --- a/drivers/net/sunhme.h 2004-09-26 10:25:56 -07:00 +++ b/drivers/net/sunhme.h 2004-09-26 10:25:56 -07:00 @@ -397,7 +397,7 @@ /* Happy happy, joy joy! */ struct happy_meal { - unsigned long gregs; /* Happy meal global registers */ + void __iomem *gregs; /* Happy meal global registers */ struct hmeal_init_block *happy_block; /* RX and TX descriptors (CPU addr) */ #if defined(CONFIG_SBUS) && defined(CONFIG_PCI) @@ -423,14 +423,14 @@ struct net_device_stats net_stats; /* Statistical counters */ #if defined(CONFIG_SBUS) && defined(CONFIG_PCI) - u32 (*read32)(unsigned long); - void (*write32)(unsigned long, u32); + u32 (*read32)(void __iomem *); + void (*write32)(void __iomem *, u32); #endif - unsigned long etxregs; /* External transmitter regs */ - unsigned long erxregs; /* External receiver regs */ - unsigned long bigmacregs; /* BIGMAC core regs */ - unsigned long tcvregs; /* MIF transceiver regs */ + void __iomem *etxregs; /* External transmitter regs */ + void __iomem *erxregs; /* External receiver regs */ + void __iomem *bigmacregs; /* BIGMAC core regs */ + void __iomem *tcvregs; /* MIF transceiver regs */ dma_addr_t hblock_dvma; /* DVMA visible address happy block */ unsigned int happy_flags; /* Driver state flags */ diff -Nru a/drivers/net/sunlance.c b/drivers/net/sunlance.c --- a/drivers/net/sunlance.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/net/sunlance.c 2004-09-26 10:25:56 -07:00 @@ -230,9 +230,9 @@ ((__u32)(((unsigned long)(&(((struct lance_init_block *)0)->rt[elem][0]))))) struct lance_private { - unsigned long lregs; /* Lance RAP/RDP regs. */ - unsigned long dregs; /* DMA controller regs. */ - volatile struct lance_init_block *init_block; + void __iomem *lregs; /* Lance RAP/RDP regs. */ + void __iomem *dregs; /* DMA controller regs. */ + struct lance_init_block *init_block; spinlock_t lock; @@ -270,7 +270,7 @@ #define LANCE_REG_SIZE 0x04UL #define STOP_LANCE(__lp) \ -do { unsigned long __base = (__lp)->lregs; \ +do { void __iomem *__base = (__lp)->lregs; \ sbus_writew(LE_CSR0, __base + RAP); \ sbus_writew(LE_C0_STOP, __base + RDP); \ } while (0) @@ -314,7 +314,7 @@ static void lance_init_ring_dvma(struct net_device *dev) { struct lance_private *lp = netdev_priv(dev); - volatile struct lance_init_block *ib = lp->init_block; + struct lance_init_block *ib = lp->init_block; dma_addr_t aib = lp->init_block_dvma; __u32 leptr; int i; @@ -371,7 +371,7 @@ static void lance_init_ring_pio(struct net_device *dev) { struct lance_private *lp = netdev_priv(dev); - volatile struct lance_init_block *ib = lp->init_block; + struct lance_init_block *ib = lp->init_block; u32 leptr; int i; @@ -501,8 +501,8 @@ static void lance_rx_dvma(struct net_device *dev) { struct lance_private *lp = netdev_priv(dev); - volatile struct lance_init_block *ib = lp->init_block; - volatile struct lance_rx_desc *rd; + struct lance_init_block *ib = lp->init_block; + struct lance_rx_desc *rd; u8 bits; int len, entry = lp->rx_new; struct sk_buff *skb; @@ -564,14 +564,14 @@ static void lance_tx_dvma(struct net_device *dev) { struct lance_private *lp = netdev_priv(dev); - volatile struct lance_init_block *ib = lp->init_block; + struct lance_init_block *ib = lp->init_block; int i, j; spin_lock(&lp->lock); j = lp->tx_old; for (i = j; i != lp->tx_new; i = j) { - volatile struct lance_tx_desc *td = &ib->btx_ring [i]; + struct lance_tx_desc *td = &ib->btx_ring [i]; u8 bits = td->tmd1_bits; /* If we hit a packet not owned by us, stop */ @@ -641,12 +641,12 @@ spin_unlock(&lp->lock); } -static void lance_piocopy_to_skb(struct sk_buff *skb, volatile void *piobuf, int len) +static void lance_piocopy_to_skb(struct sk_buff *skb, void __iomem *piobuf, int len) { u16 *p16 = (u16 *) skb->data; u32 *p32; u8 *p8; - unsigned long pbuf = (unsigned long) piobuf; + void __iomem *pbuf = piobuf; /* We know here that both src and dest are on a 16bit boundary. */ *p16++ = sbus_readw(pbuf); @@ -674,8 +674,8 @@ static void lance_rx_pio(struct net_device *dev) { struct lance_private *lp = netdev_priv(dev); - volatile struct lance_init_block *ib = lp->init_block; - volatile struct lance_rx_desc *rd; + struct lance_init_block *ib = lp->init_block; + struct lance_rx_desc *rd; unsigned char bits; int len, entry; struct sk_buff *skb; @@ -736,14 +736,14 @@ static void lance_tx_pio(struct net_device *dev) { struct lance_private *lp = netdev_priv(dev); - volatile struct lance_init_block *ib = lp->init_block; + struct lance_init_block *ib = lp->init_block; int i, j; spin_lock(&lp->lock); j = lp->tx_old; for (i = j; i != lp->tx_new; i = j) { - volatile struct lance_tx_desc *td = &ib->btx_ring [i]; + struct lance_tx_desc *td = &ib->btx_ring [i]; u8 bits = sbus_readb(&td->tmd1_bits); /* If we hit a packet not owned by us, stop */ @@ -880,7 +880,7 @@ static void build_fake_packet(struct lance_private *lp) { struct net_device *dev = lp->dev; - volatile struct lance_init_block *ib = lp->init_block; + struct lance_init_block *ib = lp->init_block; u16 *packet; struct ethhdr *eth; int i, entry; @@ -916,7 +916,7 @@ static int lance_open(struct net_device *dev) { struct lance_private *lp = netdev_priv(dev); - volatile struct lance_init_block *ib = lp->init_block; + struct lance_init_block *ib = lp->init_block; int status = 0; last_dev = dev; @@ -1006,9 +1006,9 @@ return status; } -static void lance_piocopy_from_skb(volatile void *dest, unsigned char *src, int len) +static void lance_piocopy_from_skb(void __iomem *dest, unsigned char *src, int len) { - unsigned long piobuf = (unsigned long) dest; + void __iomem *piobuf = dest; u32 *p32; u16 *p16; u8 *p8; @@ -1064,11 +1064,11 @@ sbus_writeb(src[0], piobuf); } -static void lance_piozero(volatile void *dest, int len) +static void lance_piozero(void __iomem *dest, int len) { - unsigned long piobuf = (unsigned long) dest; + void __iomem *piobuf = dest; - if (piobuf & 1) { + if ((unsigned long)piobuf & 1) { sbus_writeb(0, piobuf); piobuf += 1; len -= 1; @@ -1079,7 +1079,7 @@ sbus_writeb(0, piobuf); return; } - if (piobuf & 2) { + if ((unsigned long)piobuf & 2) { sbus_writew(0, piobuf); piobuf += 2; len -= 2; @@ -1113,7 +1113,7 @@ static int lance_start_xmit(struct sk_buff *skb, struct net_device *dev) { struct lance_private *lp = netdev_priv(dev); - volatile struct lance_init_block *ib = lp->init_block; + struct lance_init_block *ib = lp->init_block; int entry, skblen, len; skblen = skb->len; @@ -1174,8 +1174,8 @@ static void lance_load_multicast(struct net_device *dev) { struct lance_private *lp = netdev_priv(dev); - volatile struct lance_init_block *ib = lp->init_block; - volatile u16 *mcast_table = (u16 *) &ib->filter; + struct lance_init_block *ib = lp->init_block; + u16 *mcast_table = (u16 *) &ib->filter; struct dev_mc_list *dmi = dev->mc_list; char *addrs; int i; @@ -1224,7 +1224,7 @@ static void lance_set_multicast(struct net_device *dev) { struct lance_private *lp = netdev_priv(dev); - volatile struct lance_init_block *ib = lp->init_block; + struct lance_init_block *ib = lp->init_block; u16 mode; if (!netif_running(dev)) @@ -1277,12 +1277,12 @@ sbus_iounmap(lp->lregs, LANCE_REG_SIZE); if (lp->init_block != NULL) { if (lp->pio_buffer) { - sbus_iounmap((unsigned long)lp->init_block, + sbus_iounmap(lp->init_block, sizeof(struct lance_init_block)); } else { sbus_free_consistent(lp->sdev, sizeof(struct lance_init_block), - (void *)lp->init_block, + lp->init_block, lp->init_block_dvma); } } @@ -1349,7 +1349,7 @@ lp->sdev = sdev; if (lebuffer) { - lp->init_block = (volatile struct lance_init_block *) + lp->init_block = sbus_ioremap(&lebuffer->resource[0], 0, sizeof(struct lance_init_block), "lebuffer"); if (lp->init_block == NULL) { @@ -1362,7 +1362,7 @@ lp->rx = lance_rx_pio; lp->tx = lance_tx_pio; } else { - lp->init_block = (volatile struct lance_init_block *) + lp->init_block = sbus_alloc_consistent(sdev, sizeof(struct lance_init_block), &lp->init_block_dvma); if (lp->init_block == NULL || diff -Nru a/drivers/net/sunqe.c b/drivers/net/sunqe.c --- a/drivers/net/sunqe.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/net/sunqe.c 2004-09-26 10:25:56 -07:00 @@ -49,7 +49,7 @@ #define QEC_RESET_TRIES 200 -static inline int qec_global_reset(unsigned long gregs) +static inline int qec_global_reset(void __iomem *gregs) { int tries = QEC_RESET_TRIES; @@ -73,8 +73,8 @@ static inline int qe_stop(struct sunqe *qep) { - unsigned long cregs = qep->qcregs; - unsigned long mregs = qep->mregs; + void __iomem *cregs = qep->qcregs; + void __iomem *mregs = qep->mregs; int tries; /* Reset the MACE, then the QEC channel. */ @@ -130,9 +130,9 @@ static int qe_init(struct sunqe *qep, int from_irq) { struct sunqec *qecp = qep->parent; - unsigned long cregs = qep->qcregs; - unsigned long mregs = qep->mregs; - unsigned long gregs = qecp->gregs; + void __iomem *cregs = qep->qcregs; + void __iomem *mregs = qep->mregs; + void __iomem *gregs = qecp->gregs; unsigned char *e = &qep->dev->dev_addr[0]; u32 tmp; int i; @@ -699,7 +699,7 @@ static u32 qe_get_link(struct net_device *dev) { struct sunqe *qep = dev->priv; - unsigned long mregs = qep->mregs; + void __iomem *mregs = qep->mregs; u8 phyconfig; spin_lock_irq(&qep->lock); diff -Nru a/drivers/net/sunqe.h b/drivers/net/sunqe.h --- a/drivers/net/sunqe.h 2004-09-26 10:25:55 -07:00 +++ b/drivers/net/sunqe.h 2004-09-26 10:25:55 -07:00 @@ -311,7 +311,7 @@ struct sunqe; struct sunqec { - unsigned long gregs; /* QEC Global Registers */ + void __iomem *gregs; /* QEC Global Registers */ struct sunqe *qes[4]; /* Each child MACE */ unsigned int qec_bursts; /* Support burst sizes */ struct sbus_dev *qec_sdev; /* QEC's SBUS device */ @@ -331,8 +331,8 @@ ((__u32)((unsigned long)(&(((struct sunqe_buffers *)0)->mem[elem][0])))) struct sunqe { - unsigned long qcregs; /* QEC per-channel Registers */ - unsigned long mregs; /* Per-channel MACE Registers */ + void __iomem *qcregs; /* QEC per-channel Registers */ + void __iomem *mregs; /* Per-channel MACE Registers */ struct qe_init_block *qe_block; /* RX and TX descriptors */ __u32 qblock_dvma; /* RX and TX descriptors */ spinlock_t lock; /* Protects txfull state */ diff -Nru a/drivers/net/tg3.c b/drivers/net/tg3.c --- a/drivers/net/tg3.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/net/tg3.c 2004-09-26 10:25:56 -07:00 @@ -60,8 +60,8 @@ #define DRV_MODULE_NAME "tg3" #define PFX DRV_MODULE_NAME ": " -#define DRV_MODULE_VERSION "3.9" -#define DRV_MODULE_RELDATE "August 30, 2004" +#define DRV_MODULE_VERSION "3.10" +#define DRV_MODULE_RELDATE "September 14, 2004" #define TG3_DEF_MAC_MODE 0 #define TG3_DEF_RX_MODE 0 @@ -1122,29 +1122,33 @@ u32 old_rx_mode = tp->rx_mode; u32 old_tx_mode = tp->tx_mode; - if (local_adv & ADVERTISE_PAUSE_CAP) { - if (local_adv & ADVERTISE_PAUSE_ASYM) { - if (remote_adv & LPA_PAUSE_CAP) - new_tg3_flags |= - (TG3_FLAG_RX_PAUSE | - TG3_FLAG_TX_PAUSE); - else if (remote_adv & LPA_PAUSE_ASYM) - new_tg3_flags |= - (TG3_FLAG_RX_PAUSE); - } else { - if (remote_adv & LPA_PAUSE_CAP) - new_tg3_flags |= - (TG3_FLAG_RX_PAUSE | - TG3_FLAG_TX_PAUSE); + if (tp->tg3_flags & TG3_FLAG_PAUSE_AUTONEG) { + if (local_adv & ADVERTISE_PAUSE_CAP) { + if (local_adv & ADVERTISE_PAUSE_ASYM) { + if (remote_adv & LPA_PAUSE_CAP) + new_tg3_flags |= + (TG3_FLAG_RX_PAUSE | + TG3_FLAG_TX_PAUSE); + else if (remote_adv & LPA_PAUSE_ASYM) + new_tg3_flags |= + (TG3_FLAG_RX_PAUSE); + } else { + if (remote_adv & LPA_PAUSE_CAP) + new_tg3_flags |= + (TG3_FLAG_RX_PAUSE | + TG3_FLAG_TX_PAUSE); + } + } else if (local_adv & ADVERTISE_PAUSE_ASYM) { + if ((remote_adv & LPA_PAUSE_CAP) && + (remote_adv & LPA_PAUSE_ASYM)) + new_tg3_flags |= TG3_FLAG_TX_PAUSE; } - } else if (local_adv & ADVERTISE_PAUSE_ASYM) { - if ((remote_adv & LPA_PAUSE_CAP) && - (remote_adv & LPA_PAUSE_ASYM)) - new_tg3_flags |= TG3_FLAG_TX_PAUSE; - } - tp->tg3_flags &= ~(TG3_FLAG_RX_PAUSE | TG3_FLAG_TX_PAUSE); - tp->tg3_flags |= new_tg3_flags; + tp->tg3_flags &= ~(TG3_FLAG_RX_PAUSE | TG3_FLAG_TX_PAUSE); + tp->tg3_flags |= new_tg3_flags; + } else { + new_tg3_flags = tp->tg3_flags; + } if (new_tg3_flags & TG3_FLAG_RX_PAUSE) tp->rx_mode |= RX_MODE_FLOW_CTRL_ENABLE; @@ -2168,7 +2172,7 @@ else val |= 0x4010880; - tw32_f(MAC_SERDES_CFG, serdes_cfg); + tw32_f(MAC_SERDES_CFG, val); } tw32_f(SG_DIG_CTRL, 0x01388400); @@ -3698,7 +3702,7 @@ u32 flags_save; int i; - if (!(tp->tg3_flags2 & TG3_FLG2_SUN_5704)) + if (!(tp->tg3_flags2 & TG3_FLG2_SUN_570X)) tg3_nvram_lock(tp); /* @@ -3829,7 +3833,7 @@ udelay(10); } if (i >= 100000 && - !(tp->tg3_flags2 & TG3_FLG2_SUN_5704)) { + !(tp->tg3_flags2 & TG3_FLG2_SUN_570X)) { printk(KERN_ERR PFX "tg3_reset_hw timed out for %s, " "firmware will not restart magic=%08x\n", tp->dev->name, val); @@ -6585,8 +6589,8 @@ struct tg3 *tp = netdev_priv(dev); epause->autoneg = (tp->tg3_flags & TG3_FLAG_PAUSE_AUTONEG) != 0; - epause->rx_pause = (tp->tg3_flags & TG3_FLAG_PAUSE_RX) != 0; - epause->tx_pause = (tp->tg3_flags & TG3_FLAG_PAUSE_TX) != 0; + epause->rx_pause = (tp->tg3_flags & TG3_FLAG_RX_PAUSE) != 0; + epause->tx_pause = (tp->tg3_flags & TG3_FLAG_TX_PAUSE) != 0; } static int tg3_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam *epause) @@ -6601,13 +6605,13 @@ else tp->tg3_flags &= ~TG3_FLAG_PAUSE_AUTONEG; if (epause->rx_pause) - tp->tg3_flags |= TG3_FLAG_PAUSE_RX; + tp->tg3_flags |= TG3_FLAG_RX_PAUSE; else - tp->tg3_flags &= ~TG3_FLAG_PAUSE_RX; + tp->tg3_flags &= ~TG3_FLAG_RX_PAUSE; if (epause->tx_pause) - tp->tg3_flags |= TG3_FLAG_PAUSE_TX; + tp->tg3_flags |= TG3_FLAG_TX_PAUSE; else - tp->tg3_flags &= ~TG3_FLAG_PAUSE_TX; + tp->tg3_flags &= ~TG3_FLAG_TX_PAUSE; tg3_halt(tp); tg3_init_hw(tp); tg3_netif_start(tp); @@ -6799,7 +6803,7 @@ { int j; - if (tp->tg3_flags2 & TG3_FLG2_SUN_5704) + if (tp->tg3_flags2 & TG3_FLG2_SUN_570X) return; tw32_f(GRC_EEPROM_ADDR, @@ -6886,8 +6890,8 @@ { int i; - if (tp->tg3_flags2 & TG3_FLG2_SUN_5704) { - printk(KERN_ERR PFX "Attempt to do nvram_read on Sun 5704\n"); + if (tp->tg3_flags2 & TG3_FLG2_SUN_570X) { + printk(KERN_ERR PFX "Attempt to do nvram_read on Sun 570X\n"); return -EINVAL; } @@ -7222,11 +7226,11 @@ unsigned char vpd_data[256]; int i; - if (tp->tg3_flags2 & TG3_FLG2_SUN_5704) { + if (tp->tg3_flags2 & TG3_FLG2_SUN_570X) { /* Sun decided not to put the necessary bits in the * NVRAM of their onboard tg3 parts :( */ - strcpy(tp->board_part_number, "Sun 5704"); + strcpy(tp->board_part_number, "Sun 570X"); return; } @@ -7287,27 +7291,21 @@ } #ifdef CONFIG_SPARC64 -static int __devinit tg3_is_sun_5704(struct tg3 *tp) +static int __devinit tg3_is_sun_570X(struct tg3 *tp) { struct pci_dev *pdev = tp->pdev; struct pcidev_cookie *pcp = pdev->sysdata; if (pcp != NULL) { int node = pcp->prom_node; - u32 venid, devid; + u32 venid; int err; err = prom_getproperty(node, "subsystem-vendor-id", (char *) &venid, sizeof(venid)); if (err == 0 || err == -1) return 0; - err = prom_getproperty(node, "subsystem-id", - (char *) &devid, sizeof(devid)); - if (err == 0 || err == -1) - return 0; - - if (venid == PCI_VENDOR_ID_SUN && - devid == PCI_DEVICE_ID_TIGON3_5704) + if (venid == PCI_VENDOR_ID_SUN) return 1; } return 0; @@ -7324,8 +7322,8 @@ int err; #ifdef CONFIG_SPARC64 - if (tg3_is_sun_5704(tp)) - tp->tg3_flags2 |= TG3_FLG2_SUN_5704; + if (tg3_is_sun_570X(tp)) + tp->tg3_flags2 |= TG3_FLG2_SUN_570X; #endif /* If we have an AMD 762 or Intel ICH/ICH0/ICH2 chipset, write @@ -7707,7 +7705,7 @@ mac_offset = 0x7c; if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704 && - !(tp->tg3_flags & TG3_FLG2_SUN_5704)) { + !(tp->tg3_flags & TG3_FLG2_SUN_570X)) { if (tr32(TG3PCI_DUAL_MAC_CTRL) & DUAL_MAC_CTRL_ID) mac_offset = 0xcc; if (tg3_nvram_lock(tp)) @@ -7729,7 +7727,7 @@ dev->dev_addr[5] = (lo >> 0) & 0xff; } /* Next, try NVRAM. */ - else if (!(tp->tg3_flags & TG3_FLG2_SUN_5704) && + else if (!(tp->tg3_flags & TG3_FLG2_SUN_570X) && !tg3_nvram_read(tp, mac_offset + 0, &hi) && !tg3_nvram_read(tp, mac_offset + 4, &lo)) { dev->dev_addr[0] = ((hi >> 16) & 0xff); @@ -8340,6 +8338,9 @@ if (tp->tg3_flags2 & TG3_FLG2_IS_5788) dev->features &= ~NETIF_F_HIGHDMA; + + /* flow control autonegotiation is default behavior */ + tp->tg3_flags |= TG3_FLAG_PAUSE_AUTONEG; err = register_netdev(dev); if (err) { diff -Nru a/drivers/net/tg3.h b/drivers/net/tg3.h --- a/drivers/net/tg3.h 2004-09-26 10:25:55 -07:00 +++ b/drivers/net/tg3.h 2004-09-26 10:25:55 -07:00 @@ -2069,15 +2069,13 @@ #define TG3_FLAG_JUMBO_ENABLE 0x00800000 #define TG3_FLAG_10_100_ONLY 0x01000000 #define TG3_FLAG_PAUSE_AUTONEG 0x02000000 -#define TG3_FLAG_PAUSE_RX 0x04000000 -#define TG3_FLAG_PAUSE_TX 0x08000000 #define TG3_FLAG_BROKEN_CHECKSUMS 0x10000000 #define TG3_FLAG_GOT_SERDES_FLOWCTL 0x20000000 #define TG3_FLAG_SPLIT_MODE 0x40000000 #define TG3_FLAG_INIT_COMPLETE 0x80000000 u32 tg3_flags2; #define TG3_FLG2_RESTART_TIMER 0x00000001 -#define TG3_FLG2_SUN_5704 0x00000002 +#define TG3_FLG2_SUN_570X 0x00000002 #define TG3_FLG2_NO_ETH_WIRE_SPEED 0x00000004 #define TG3_FLG2_IS_5788 0x00000008 #define TG3_FLG2_MAX_RXPEND_64 0x00000010 diff -Nru a/drivers/net/tulip/Kconfig b/drivers/net/tulip/Kconfig --- a/drivers/net/tulip/Kconfig 2004-09-26 10:25:57 -07:00 +++ b/drivers/net/tulip/Kconfig 2004-09-26 10:25:57 -07:00 @@ -40,9 +40,7 @@ (smc9332dst), you can also try the driver for "Generic DECchip" cards, above. However, most people with a network card of this type will say Y here.) Do read the Ethernet-HOWTO, available from - . More specific - information is contained in - . + . To compile this driver as a module, choose M here and read . The module will diff -Nru a/drivers/net/typhoon.c b/drivers/net/typhoon.c --- a/drivers/net/typhoon.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/net/typhoon.c 2004-09-26 10:25:56 -07:00 @@ -248,11 +248,11 @@ /* Tx cache line section */ struct transmit_ring txLoRing ____cacheline_aligned; struct pci_dev * tx_pdev; - unsigned long tx_ioaddr; + void __iomem *tx_ioaddr; u32 txlo_dma_addr; /* Irq/Rx cache line section */ - unsigned long ioaddr ____cacheline_aligned; + void __iomem *ioaddr ____cacheline_aligned; struct typhoon_indexes *indexes; u8 awaiting_resp; u8 duplex; @@ -373,7 +373,7 @@ } static int -typhoon_reset(unsigned long ioaddr, int wait_type) +typhoon_reset(void __iomem *ioaddr, int wait_type) { int i, err = 0; int timeout; @@ -428,7 +428,7 @@ } static int -typhoon_wait_status(unsigned long ioaddr, u32 wait_value) +typhoon_wait_status(void __iomem *ioaddr, u32 wait_value) { int i, err = 0; @@ -1240,7 +1240,7 @@ } static int -typhoon_wait_interrupt(unsigned long ioaddr) +typhoon_wait_interrupt(void __iomem *ioaddr) { int i, err = 0; @@ -1348,7 +1348,7 @@ static int typhoon_download_firmware(struct typhoon *tp) { - unsigned long ioaddr = tp->ioaddr; + void __iomem *ioaddr = tp->ioaddr; struct pci_dev *pdev = tp->pdev; struct typhoon_file_header *fHdr; struct typhoon_section_header *sHdr; @@ -1497,7 +1497,7 @@ static int typhoon_boot_3XP(struct typhoon *tp, u32 initial_status) { - unsigned long ioaddr = tp->ioaddr; + void __iomem *ioaddr = tp->ioaddr; if(typhoon_wait_status(ioaddr, initial_status) < 0) { printk(KERN_ERR "%s: boot ready timeout\n", tp->name); @@ -1812,7 +1812,8 @@ typhoon_interrupt(int irq, void *dev_instance, struct pt_regs *rgs) { struct net_device *dev = (struct net_device *) dev_instance; - unsigned long ioaddr = dev->base_addr; + struct typhoon *tp = dev->priv; + void __iomem *ioaddr = tp->ioaddr; u32 intr_status; intr_status = readl(ioaddr + TYPHOON_REG_INTR_STATUS); @@ -1852,7 +1853,7 @@ typhoon_sleep(struct typhoon *tp, int state, u16 events) { struct pci_dev *pdev = tp->pdev; - unsigned long ioaddr = tp->ioaddr; + void __iomem *ioaddr = tp->ioaddr; struct cmd_desc xp_cmd; int err; @@ -1890,7 +1891,7 @@ typhoon_wakeup(struct typhoon *tp, int wait_type) { struct pci_dev *pdev = tp->pdev; - unsigned long ioaddr = tp->ioaddr; + void __iomem *ioaddr = tp->ioaddr; pci_set_power_state(pdev, 0); pci_restore_state(pdev, tp->pci_state); @@ -1911,7 +1912,7 @@ typhoon_start_runtime(struct typhoon *tp) { struct net_device *dev = tp->dev; - unsigned long ioaddr = tp->ioaddr; + void __iomem *ioaddr = tp->ioaddr; struct cmd_desc xp_cmd; int err; @@ -2006,7 +2007,7 @@ { struct typhoon_indexes *indexes = tp->indexes; struct transmit_ring *txLo = &tp->txLoRing; - unsigned long ioaddr = tp->ioaddr; + void __iomem *ioaddr = tp->ioaddr; struct cmd_desc xp_cmd; int i; @@ -2070,7 +2071,7 @@ { struct typhoon *tp = (struct typhoon *) dev->priv; - if(typhoon_reset(dev->base_addr, WaitNoSleep) < 0) { + if(typhoon_reset(tp->ioaddr, WaitNoSleep) < 0) { printk(KERN_WARNING "%s: could not reset in tx timeout\n", dev->name); goto truely_dead; @@ -2091,7 +2092,7 @@ truely_dead: /* Reset the hardware, and turn off carrier to avoid more timeouts */ - typhoon_reset(dev->base_addr, NoWait); + typhoon_reset(tp->ioaddr, NoWait); netif_carrier_off(dev); } @@ -2126,7 +2127,7 @@ if(typhoon_boot_3XP(tp, TYPHOON_STATUS_WAITING_FOR_HOST) < 0) { printk(KERN_ERR "%s: unable to reboot into sleep img\n", dev->name); - typhoon_reset(dev->base_addr, NoWait); + typhoon_reset(tp->ioaddr, NoWait); goto out; } @@ -2192,7 +2193,7 @@ return 0; reset: - typhoon_reset(dev->base_addr, NoWait); + typhoon_reset(tp->ioaddr, NoWait); return -EBUSY; } @@ -2276,6 +2277,7 @@ struct typhoon *tp; int card_id = (int) ent->driver_data; unsigned long ioaddr; + void __iomem *ioaddr_mapped; void *shared; dma_addr_t shared_dma; struct cmd_desc xp_cmd; @@ -2345,14 +2347,13 @@ /* map our MMIO region */ ioaddr = pci_resource_start(pdev, 1); - ioaddr = (unsigned long) ioremap(ioaddr, 128); - if(!ioaddr) { + ioaddr_mapped = ioremap(ioaddr, 128); + if (!ioaddr_mapped) { printk(ERR_PFX "%s: cannot remap MMIO, aborting\n", pci_name(pdev)); err = -EIO; goto error_out_regions; } - dev->base_addr = ioaddr; /* allocate pci dma space for rx and tx descriptor rings */ @@ -2371,8 +2372,8 @@ tp->shared_dma = shared_dma; tp->pdev = pdev; tp->tx_pdev = pdev; - tp->ioaddr = dev->base_addr; - tp->tx_ioaddr = dev->base_addr; + tp->ioaddr = ioaddr_mapped; + tp->tx_ioaddr = ioaddr_mapped; tp->dev = dev; /* need to be able to restore PCI state after a suspend */ @@ -2385,7 +2386,7 @@ * 4) Get the hardware address. * 5) Put the card to sleep. */ - if(typhoon_reset(ioaddr, WaitSleep) < 0) { + if (typhoon_reset(ioaddr_mapped, WaitSleep) < 0) { printk(ERR_PFX "%s: could not reset 3XP\n", pci_name(pdev)); err = -EIO; goto error_out_dma; @@ -2518,13 +2519,13 @@ return 0; error_out_reset: - typhoon_reset(ioaddr, NoWait); + typhoon_reset(ioaddr_mapped, NoWait); error_out_dma: pci_free_consistent(pdev, sizeof(struct typhoon_shared), shared, shared_dma); error_out_remap: - iounmap((void *) ioaddr); + iounmap(ioaddr_mapped); error_out_regions: pci_release_regions(pdev); error_out_dev: @@ -2542,8 +2543,8 @@ unregister_netdev(dev); pci_set_power_state(pdev, 0); pci_restore_state(pdev, tp->pci_state); - typhoon_reset(dev->base_addr, NoWait); - iounmap((char *) (dev->base_addr)); + typhoon_reset(tp->ioaddr, NoWait); + iounmap(tp->ioaddr); pci_free_consistent(pdev, sizeof(struct typhoon_shared), tp->shared, tp->shared_dma); pci_release_regions(pdev); diff -Nru a/drivers/net/wan/sdla_fr.c b/drivers/net/wan/sdla_fr.c --- a/drivers/net/wan/sdla_fr.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/net/wan/sdla_fr.c 2004-09-26 10:25:57 -07:00 @@ -3678,7 +3678,7 @@ break; } - (void *)ptr_trc_el = card->u.f.curr_trc_el; + ptr_trc_el = (void *)card->u.f.curr_trc_el; buffer_length = 0; fr_udp_pkt->data[0x00] = 0x00; @@ -3729,7 +3729,7 @@ ptr_trc_el ++; if((void *)ptr_trc_el > card->u.f.trc_el_last) - (void*)ptr_trc_el = card->u.f.trc_el_base; + ptr_trc_el = (void*)card->u.f.trc_el_base; buffer_length += sizeof(fpipemon_trc_hdr_t); if(fpipemon_trc->fpipemon_trc_hdr.data_passed) { diff -Nru a/drivers/net/wan/sdladrv.c b/drivers/net/wan/sdladrv.c --- a/drivers/net/wan/sdladrv.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/net/wan/sdladrv.c 2004-09-26 10:25:55 -07:00 @@ -937,7 +937,7 @@ peek_by_4 ((unsigned long)hw->dpmbase + curpos, buf, curlen); addr += curlen; - (char*)buf += curlen; + buf = (char*)buf + curlen; len -= curlen; } @@ -1019,7 +1019,7 @@ poke_by_4 ((unsigned long)hw->dpmbase + curpos, buf, curlen); addr += curlen; - (char*)buf += curlen; + buf = (char*)buf + curlen; len -= curlen; } @@ -2001,7 +2001,7 @@ (void *)hw->dpmbase = ioremap((unsigned long)S514_mem_base_addr, (unsigned long)MAX_SIZEOF_S514_MEMORY); /* map the physical control register memory to virtual memory */ - (void *)hw->vector = ioremap( + hw->vector = (unsigned long)ioremap( (unsigned long)(S514_mem_base_addr + S514_CTRL_REG_BYTE), (unsigned long)16); diff -Nru a/drivers/net/wan/sdlamain.c b/drivers/net/wan/sdlamain.c --- a/drivers/net/wan/sdlamain.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/net/wan/sdlamain.c 2004-09-26 10:25:57 -07:00 @@ -976,7 +976,7 @@ dump.length -= len; dump.offset += len; - (char*)dump.ptr += len; + dump.ptr = (char*)dump.ptr + len; } sdla_mapmem(&card->hw, oldvec);/* restore DPM window position */ diff -Nru a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c --- a/drivers/net/wireless/airo.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/net/wireless/airo.c 2004-09-26 10:25:55 -07:00 @@ -1816,7 +1816,8 @@ if (!test_bit (FLAG_COMMIT, &ai->flags)) return SUCCESS; - clear_bit (FLAG_COMMIT | FLAG_RESET, &ai->flags); + clear_bit (FLAG_COMMIT, &ai->flags); + clear_bit (FLAG_RESET, &ai->flags); checkThrottle(ai); cfgr = ai->config; @@ -1980,9 +1981,6 @@ ai->txfids[0].tx_desc.eoc = 1; ai->txfids[0].tx_desc.len =len+sizeof(WifiHdr); - memcpy((char *)ai->txfids[0].card_ram_off, - (char *)&ai->txfids[0].tx_desc, sizeof(TxFid)); - /* * Magic, the cards firmware needs a length count (2 bytes) in the host buffer * right after TXFID_HDR.The TXFID_HDR contains the status short so payloadlen @@ -2012,6 +2010,7 @@ return ERROR; *payloadLen = cpu_to_le16(len-sizeof(etherHead)+sizeof(pMic)); + ai->txfids[0].tx_desc.len += sizeof(pMic); /* copy data into airo dma buffer */ memcpy (sendbuf, buffer, sizeof(etherHead)); buffer += sizeof(etherHead); @@ -2030,6 +2029,9 @@ memcpy(sendbuf, buffer, len); } + memcpy((char *)ai->txfids[0].card_ram_off, + (char *)&ai->txfids[0].tx_desc, sizeof(TxFid)); + OUT4500(ai, EVACK, 8); dev_kfree_skb_any(skb); @@ -2184,6 +2186,12 @@ struct airo_info *priv = dev->priv; u32 *fids = priv->fids; + if (test_bit(FLAG_MPI, &priv->flags)) { + /* Not implemented yet for MPI350 */ + netif_stop_queue(dev); + return -ENETDOWN; + } + if ( skb == NULL ) { printk( KERN_ERR "airo: skb == NULL!!!\n" ); return 0; @@ -2249,12 +2257,14 @@ { struct airo_info *local = dev->priv; - /* Get stats out of the card if available */ - if (down_trylock(&local->sem) != 0) { - set_bit(JOB_STATS, &local->flags); - wake_up_interruptible(&local->thr_wait); - } else - airo_read_stats(local); + if (!test_bit(JOB_STATS, &local->flags)) { + /* Get stats out of the card if available */ + if (down_trylock(&local->sem) != 0) { + set_bit(JOB_STATS, &local->flags); + wake_up_interruptible(&local->thr_wait); + } else + airo_read_stats(local); + } return &local->stats; } @@ -2340,6 +2350,9 @@ void stop_airo_card( struct net_device *dev, int freeres ) { struct airo_info *ai = dev->priv; + + set_bit(FLAG_RADIO_DOWN, &ai->flags); + disable_MAC(ai, 1); disable_interrupts(ai); free_irq( dev->irq, dev ); takedown_proc_entry( dev, ai ); @@ -3406,13 +3419,8 @@ } static void enable_interrupts( struct airo_info *ai ) { - /* Reset the status register */ - u16 status = IN4500( ai, EVSTAT ); - OUT4500( ai, EVACK, status ); /* Enable the interrupts */ OUT4500( ai, EVINTEN, STATUS_INTS ); - /* Note there is a race condition between the last two lines that - I don't know how to get rid of right now... */ } static void disable_interrupts( struct airo_info *ai ) { @@ -3460,7 +3468,7 @@ memcpy(buffer + ETH_ALEN * 2, ai->rxfids[0].virtual_host_addr + ETH_ALEN * 2 + off, len - ETH_ALEN * 2 - off); - if (decapsulate (ai, &micbuf, (etherHead*)buffer, len - off)) { + if (decapsulate (ai, &micbuf, (etherHead*)buffer, len - off - ETH_ALEN * 2)) { badmic: dev_kfree_skb_irq (skb); goto badrx; @@ -3670,18 +3678,6 @@ status = readCapabilityRid(ai, &cap_rid, lock); if ( status != SUCCESS ) return ERROR; - /* - * This driver supports MPI350 firmwares up to, and - * including 5.30.17 - */ - if (test_bit(FLAG_MPI, &ai->flags) && - strncmp (cap_rid.prodVer, "5.00.", 5) && - strncmp (cap_rid.prodVer, "5b00.", 5) && - strncmp (cap_rid.prodVer, "5.02.", 5) && - strncmp (cap_rid.prodVer, "5.20.", 5) && - strncmp (cap_rid.prodVer, "5.30.", 5)) - printk(KERN_ERR "airo: Firmware version %s is not supported. Use it at your own risk!\n", cap_rid.prodVer); - status = PC4500_readrid(ai,RID_RSSI,&rssi_rid,sizeof(rssi_rid),lock); if ( status == SUCCESS ) { if (ai->rssi || (ai->rssi = kmalloc(512, GFP_KERNEL)) != NULL) @@ -3716,9 +3712,9 @@ /* Check to see if there are any insmod configured rates to add */ - if ( rates ) { + if ( rates[0] ) { int i = 0; - if ( rates[0] ) memset(ai->config.rates,0,sizeof(ai->config.rates)); + memset(ai->config.rates,0,sizeof(ai->config.rates)); for( i = 0; i < 8 && rates[i]; i++ ) { ai->config.rates[i] = rates[i]; } @@ -3785,7 +3781,6 @@ static u16 issuecommand(struct airo_info *ai, Cmd *pCmd, Resp *pRsp) { // Im really paranoid about letting it run forever! int max_tries = 600000; - u16 cmd; if (IN4500(ai, EVSTAT) & EV_CMD) OUT4500(ai, EVACK, EV_CMD); @@ -3794,26 +3789,23 @@ OUT4500(ai, PARAM1, pCmd->parm1); OUT4500(ai, PARAM2, pCmd->parm2); OUT4500(ai, COMMAND, pCmd->cmd); - while ( max_tries-- && (IN4500(ai, EVSTAT) & EV_CMD) == 0 && - (cmd = IN4500(ai, COMMAND)) != 0 ) - if (cmd == pCmd->cmd) - // PC4500 didn't notice command, try again - OUT4500(ai, COMMAND, pCmd->cmd); - if ( max_tries == -1 ) { - printk( KERN_ERR - "airo: Max tries exceeded when issueing command\n" ); - return ERROR; - } while (max_tries-- && (IN4500(ai, EVSTAT) & EV_CMD) == 0) { + if ((IN4500(ai, COMMAND)) == pCmd->cmd) + // PC4500 didn't notice command, try again + OUT4500(ai, COMMAND, pCmd->cmd); if (!in_atomic() && (max_tries & 255) == 0) schedule(); } + if ( max_tries == -1 ) { printk( KERN_ERR - "airo: Max tries exceeded waiting for command\n" ); - return ERROR; + "airo: Max tries exceeded when issueing command\n" ); + if (IN4500(ai, COMMAND) & COMMAND_BUSY) + OUT4500(ai, EVACK, EV_CLEARCOMMANDBUSY); + return ERROR; } + // command completed pRsp->status = IN4500(ai, STATUS); pRsp->rsp0 = IN4500(ai, RESP0); @@ -4509,8 +4501,6 @@ len = priv->readlen - pos; if (copy_to_user(buffer, priv->rbuffer + pos, len)) return -EFAULT; - if (pos + len > priv->writelen) - priv->writelen = pos + len; *offset = pos + len; return len; } @@ -5521,7 +5511,6 @@ mpi_init_descriptors(ai); setup_card(ai, dev->dev_addr, 0); clear_bit(FLAG_RADIO_OFF, &ai->flags); - clear_bit(FLAG_RADIO_DOWN, &ai->flags); clear_bit(FLAG_PENDING_XMIT, &ai->flags); } else { OUT4500(ai, EVACK, EV_AWAKEN); @@ -5606,6 +5595,30 @@ * would not work at all... - Jean II */ +static int airo_get_quality (StatusRid *status_rid, CapabilityRid *cap_rid) +{ + int quality = 0; + + if ((status_rid->mode & 0x3f) == 0x3f && (cap_rid->hardCap & 8)) { + if (memcmp(cap_rid->prodName, "350", 3)) + if (status_rid->signalQuality > 0x20) + quality = 0; + else + quality = 0x20 - status_rid->signalQuality; + else + if (status_rid->signalQuality > 0xb0) + quality = 0; + else if (status_rid->signalQuality < 0x10) + quality = 0xa0; + else + quality = 0xb0 - status_rid->signalQuality; + } + return quality; +} + +#define airo_get_max_quality(cap_rid) (memcmp((cap_rid)->prodName, "350", 3) ? 0x20 : 0xa0) +#define airo_get_avg_quality(cap_rid) (memcmp((cap_rid)->prodName, "350", 3) ? 0x10 : 0x50); + /*------------------------------------------------------------------*/ /* * Wireless Handler : get protocol name @@ -6293,7 +6306,8 @@ readCapabilityRid(local, &cap_rid, 1); if (vwrq->disabled) { - set_bit (FLAG_RADIO_OFF | FLAG_COMMIT, &local->flags); + set_bit (FLAG_RADIO_OFF, &local->flags); + set_bit (FLAG_COMMIT, &local->flags); return -EINPROGRESS; /* Call commit handler */ } if (vwrq->flags != IW_TXPOW_MWATT) { @@ -6432,7 +6446,7 @@ range->num_frequency = k; /* Hum... Should put the right values there */ - range->max_qual.qual = 10; + range->max_qual.qual = airo_get_max_quality(&cap_rid); range->max_qual.level = 0x100 - 120; /* -120 dBm */ range->max_qual.noise = 0; range->sensitivity = 65535; @@ -6499,7 +6513,7 @@ /* Experimental measurements - boundary 11/5.5 Mb/s */ /* Note : with or without the (local->rssi), results * are somewhat different. - Jean II */ - range->avg_qual.qual = 6; + range->avg_qual.qual = airo_get_avg_quality(&cap_rid); if (local->rssi) range->avg_qual.level = 186; /* -70 dBm */ else @@ -7113,6 +7127,7 @@ { StatusRid status_rid; StatsRid stats_rid; + CapabilityRid cap_rid; u32 *vals = stats_rid.vals; /* Get stats out of the card */ @@ -7121,6 +7136,7 @@ up(&local->sem); return; } + readCapabilityRid(local, &cap_rid, 0); readStatusRid(local, &status_rid, 0); readStatsRid(local, &stats_rid, RID_STATS, 0); up(&local->sem); @@ -7129,7 +7145,7 @@ local->wstats.status = status_rid.mode; /* Signal quality and co. But where is the noise level ??? */ - local->wstats.qual.qual = status_rid.signalQuality; + local->wstats.qual.qual = airo_get_quality(&status_rid, &cap_rid); if (local->rssi) local->wstats.qual.level = 0x100 - local->rssi[status_rid.sigQuality].rssidBm; else @@ -7156,12 +7172,14 @@ { struct airo_info *local = dev->priv; - /* Get stats out of the card if available */ - if (down_trylock(&local->sem) != 0) { - set_bit(JOB_WSTATS, &local->flags); - wake_up_interruptible(&local->thr_wait); - } else - airo_read_wireless_stats(local); + if (!test_bit(JOB_WSTATS, &local->flags)) { + /* Get stats out of the card if available */ + if (down_trylock(&local->sem) != 0) { + set_bit(JOB_WSTATS, &local->flags); + wake_up_interruptible(&local->thr_wait); + } else + airo_read_wireless_stats(local); + } return &local->wstats; } @@ -7188,9 +7206,11 @@ { case AIROGCAP: ridcode = RID_CAPABILITIES; break; case AIROGCFG: ridcode = RID_CONFIG; - disable_MAC (ai, 1); - writeConfigRid (ai, 1); - enable_MAC (ai, &rsp, 1); + if (test_bit(FLAG_COMMIT, &ai->flags)) { + disable_MAC (ai, 1); + writeConfigRid (ai, 1); + enable_MAC (ai, &rsp, 1); + } break; case AIROGSLIST: ridcode = RID_SSID; break; case AIROGVLIST: ridcode = RID_APLIST; break; @@ -7270,6 +7290,7 @@ case AIROPCAP: ridcode = RID_CAPABILITIES; break; case AIROPAPLIST: ridcode = RID_APLIST; break; case AIROPCFG: ai->config.len = 0; + clear_bit(FLAG_COMMIT, &ai->flags); ridcode = RID_CONFIG; break; case AIROPWEPKEYNV: ridcode = RID_WEP_PERM; break; case AIROPLEAPUSR: ridcode = RID_LEAPUSERNAME; break; diff -Nru a/drivers/net/wireless/airport.c b/drivers/net/wireless/airport.c --- a/drivers/net/wireless/airport.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/net/wireless/airport.c 2004-09-26 10:25:57 -07:00 @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -94,8 +95,7 @@ printk(KERN_DEBUG "%s: Airport waking up\n", dev->name); pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE, macio_get_of_node(mdev), 0, 1); - set_current_state(TASK_UNINTERRUPTIBLE); - schedule_timeout(HZ/5); + msleep(200); enable_irq(dev->irq); @@ -147,8 +147,7 @@ macio_release_resource(mdev, 0); pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE, macio_get_of_node(mdev), 0, 0); - set_current_state(TASK_UNINTERRUPTIBLE); - schedule_timeout(HZ); + ssleep(1); macio_set_drvdata(mdev, NULL); free_netdev(dev); @@ -174,14 +173,12 @@ disable_irq(dev->irq); pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE, macio_get_of_node(card->mdev), 0, 0); - set_current_state(TASK_UNINTERRUPTIBLE); - schedule_timeout(HZ); + ssleep(1); pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE, macio_get_of_node(card->mdev), 0, 1); - set_current_state(TASK_UNINTERRUPTIBLE); - schedule_timeout(HZ); + ssleep(1); enable_irq(dev->irq); - schedule_timeout(HZ); + ssleep(1); #endif return 0; @@ -240,8 +237,7 @@ /* Power up card */ pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE, macio_get_of_node(mdev), 0, 1); - set_current_state(TASK_UNINTERRUPTIBLE); - schedule_timeout(HZ); + ssleep(1); /* Reset it before we get the interrupt */ hermes_init(hw); diff -Nru a/drivers/oprofile/buffer_sync.c b/drivers/oprofile/buffer_sync.c --- a/drivers/oprofile/buffer_sync.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/oprofile/buffer_sync.c 2004-09-26 10:25:55 -07:00 @@ -133,7 +133,7 @@ static void end_sync(void) { - end_cpu_timers(); + end_cpu_work(); /* make sure we don't leak task structs */ process_task_mortuary(); process_task_mortuary(); @@ -144,7 +144,7 @@ { int err; - start_cpu_timers(); + start_cpu_work(); err = task_handoff_register(&task_free_nb); if (err) @@ -339,40 +339,25 @@ } } - + static void release_mm(struct mm_struct * mm) { - if (mm) - up_read(&mm->mmap_sem); + if (!mm) + return; + up_read(&mm->mmap_sem); + mmput(mm); } -/* Take the task's mmap_sem to protect ourselves from - * races when we do lookup_dcookie(). - */ static struct mm_struct * take_tasks_mm(struct task_struct * task) { - struct mm_struct * mm; - - /* Subtle. We don't need to keep a reference to this task's mm, - * because, for the mm to be freed on another CPU, that would have - * to go through the task exit notifier, which ends up sleeping - * on the buffer_sem we hold, so we end up with mutual exclusion - * anyway. - */ - task_lock(task); - mm = task->mm; - task_unlock(task); - - if (mm) { - /* needed to walk the task's VMAs */ + struct mm_struct * mm = get_task_mm(task); + if (mm) down_read(&mm->mmap_sem); - } - return mm; } - - + + static inline int is_ctx_switch(unsigned long val) { return val == ~0UL; diff -Nru a/drivers/oprofile/cpu_buffer.c b/drivers/oprofile/cpu_buffer.c --- a/drivers/oprofile/cpu_buffer.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/oprofile/cpu_buffer.c 2004-09-26 10:25:55 -07:00 @@ -30,7 +30,7 @@ static void wq_sync_buffer(void *); #define DEFAULT_TIMER_EXPIRE (HZ / 10) -int timers_enabled; +int work_enabled; static void __free_cpu_buffers(int num) { @@ -80,11 +80,11 @@ } -void start_cpu_timers(void) +void start_cpu_work(void) { int i; - timers_enabled = 1; + work_enabled = 1; for_each_online_cpu(i) { struct oprofile_cpu_buffer * b = &cpu_buffer[i]; @@ -98,11 +98,11 @@ } -void end_cpu_timers(void) +void end_cpu_work(void) { int i; - timers_enabled = 0; + work_enabled = 0; for_each_online_cpu(i) { struct oprofile_cpu_buffer * b = &cpu_buffer[i]; @@ -220,6 +220,6 @@ sync_buffer(b->cpu); /* don't re-add the work if we're shutting down */ - if (timers_enabled) + if (work_enabled) schedule_delayed_work(&b->work, DEFAULT_TIMER_EXPIRE); } diff -Nru a/drivers/oprofile/cpu_buffer.h b/drivers/oprofile/cpu_buffer.h --- a/drivers/oprofile/cpu_buffer.h 2004-09-26 10:25:57 -07:00 +++ b/drivers/oprofile/cpu_buffer.h 2004-09-26 10:25:57 -07:00 @@ -20,8 +20,8 @@ int alloc_cpu_buffers(void); void free_cpu_buffers(void); -void start_cpu_timers(void); -void end_cpu_timers(void); +void start_cpu_work(void); +void end_cpu_work(void); /* CPU buffer is composed of such entries (which are * also used for context switch notes) diff -Nru a/drivers/pci/hotplug/rpaphp_core.c b/drivers/pci/hotplug/rpaphp_core.c --- a/drivers/pci/hotplug/rpaphp_core.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/pci/hotplug/rpaphp_core.c 2004-09-26 10:25:57 -07:00 @@ -449,7 +449,7 @@ static int disable_slot(struct hotplug_slot *hotplug_slot) { - int retval; + int retval = -EINVAL; struct slot *slot = (struct slot *)hotplug_slot->private; dbg("%s - Entry: slot[%s]\n", __FUNCTION__, slot->name); diff -Nru a/drivers/pci/hotplug/rpaphp_pci.c b/drivers/pci/hotplug/rpaphp_pci.c --- a/drivers/pci/hotplug/rpaphp_pci.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/pci/hotplug/rpaphp_pci.c 2004-09-26 10:25:55 -07:00 @@ -186,7 +186,7 @@ rpaphp_pci_config_slot(struct device_node *dn, struct pci_bus *bus) { struct device_node *eads_first_child = dn->child; - struct pci_dev *dev; + struct pci_dev *dev = NULL; int num; dbg("Enter %s: dn=%s bus=%s\n", __FUNCTION__, dn->full_name, bus->name); diff -Nru a/drivers/pnp/pnpbios/rsparser.c b/drivers/pnp/pnpbios/rsparser.c --- a/drivers/pnp/pnpbios/rsparser.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/pnp/pnpbios/rsparser.c 2004-09-26 10:25:56 -07:00 @@ -346,12 +346,12 @@ { unsigned int len, tag; int priority = 0; - struct pnp_option *option; + struct pnp_option *option, *option_independent; if (!p) return NULL; - option = pnp_register_independent_option(dev); + option_independent = option = pnp_register_independent_option(dev); if (!option) return NULL; @@ -428,9 +428,14 @@ case SMALL_TAG_ENDDEP: if (len != 0) goto len_err; + if (option_independent == option) + printk(KERN_WARNING "PnPBIOS: Missing SMALL_TAG_STARTDEP tag\n"); + option = option_independent; break; case SMALL_TAG_END: + if (option_independent != option) + printk(KERN_WARNING "PnPBIOS: Missing SMALL_TAG_ENDDEP tag\n"); p = p + 2; return (unsigned char *)p; break; diff -Nru a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c --- a/drivers/s390/block/dasd_eckd.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/s390/block/dasd_eckd.c 2004-09-26 10:25:55 -07:00 @@ -7,7 +7,7 @@ * Bugreports.to..: * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000 * - * $Revision: 1.57 $ + * $Revision: 1.59 $ */ #include @@ -68,6 +68,10 @@ { CCW_DEVICE_DEVTYPE (0x3990, 0, 0x3380, 0), driver_info: 0x4}, { CCW_DEVICE_DEVTYPE (0x2105, 0, 0x3380, 0), driver_info: 0x5}, { CCW_DEVICE_DEVTYPE (0x9343, 0, 0x9345, 0), driver_info: 0x6}, + { CCW_DEVICE_DEVTYPE (0x2107, 0, 0x3390, 0), driver_info: 0x7}, + { CCW_DEVICE_DEVTYPE (0x2107, 0, 0x3380, 0), driver_info: 0x8}, + { CCW_DEVICE_DEVTYPE (0x1750, 0, 0x3390, 0), driver_info: 0x9}, + { CCW_DEVICE_DEVTYPE (0x1750, 0, 0x3380, 0), driver_info: 0xa}, { /* end of list */ }, }; @@ -274,9 +278,11 @@ data->attributes.mode = 0x3; /* ECKD */ - if (private->rdc_data.cu_type == 0x2105 + if ((private->rdc_data.cu_type == 0x2105 || + private->rdc_data.cu_type == 0x2107 || + private->rdc_data.cu_type == 0x1750) && !(private->uses_cdl && trk < 2)) - data->ga_extended |= 0x40; + data->ga_extended |= 0x40; /* Regular Data Format Mode */ geo.cyl = private->rdc_data.no_cyl; geo.head = private->rdc_data.trk_per_cyl; @@ -903,6 +909,8 @@ switch (cdev->id.cu_type) { case 0x3990: case 0x2105: + case 0x2107: + case 0x1750: return dasd_3990_erp_examine(cqr, irb); case 0x9343: return dasd_9343_erp_examine(cqr, irb); @@ -923,6 +931,8 @@ switch (cdev->id.cu_type) { case 0x3990: case 0x2105: + case 0x2107: + case 0x1750: return dasd_3990_erp_action; case 0x9343: /* Return dasd_9343_erp_action; */ diff -Nru a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c --- a/drivers/s390/net/qeth_main.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/s390/net/qeth_main.c 2004-09-26 10:25:56 -07:00 @@ -1,6 +1,6 @@ /* * - * linux/drivers/s390/net/qeth_main.c ($Revision: 1.132 $) + * linux/drivers/s390/net/qeth_main.c ($Revision: 1.138 $) * * Linux on zSeries OSA Express and HiperSockets support * @@ -12,7 +12,7 @@ * Frank Pavlic (pavlic@de.ibm.com) and * Thomas Spatzier * - * $Revision: 1.132 $ $Date: 2004/08/19 12:39:43 $ + * $Revision: 1.138 $ $Date: 2004/09/17 10:40:53 $ * * 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 @@ -79,7 +79,7 @@ #include "qeth_mpc.h" #include "qeth_fs.h" -#define VERSION_QETH_C "$Revision: 1.132 $" +#define VERSION_QETH_C "$Revision: 1.138 $" static const char *version = "qeth S/390 OSA-Express driver"; /** @@ -4373,12 +4373,13 @@ /* skip 4 bytes (data_len struct member) to get req_len */ if (copy_from_user(&req_len, udata + sizeof(int), sizeof(int))) return -EFAULT; - ureq = kmalloc(req_len, GFP_KERNEL); + ureq = kmalloc(req_len+sizeof(struct qeth_snmp_ureq_hdr), GFP_KERNEL); if (!ureq) { QETH_DBF_TEXT(trace, 2, "snmpnome"); return -ENOMEM; } - if (copy_from_user(ureq, udata, req_len)){ + if (copy_from_user(ureq, udata, + req_len+sizeof(struct qeth_snmp_ureq_hdr))){ kfree(ureq); return -EFAULT; } @@ -5743,7 +5744,7 @@ QETH_DBF_TEXT(trace,3,"ipaipfrg"); if (!qeth_is_supported(card, IPA_IP_FRAGMENTATION)) { - PRINT_INFO("IP fragmentation not supported on %s\n", + PRINT_INFO("Hardware IP fragmentation not supported on %s\n", card->info.if_name); return -EOPNOTSUPP; } @@ -5751,11 +5752,11 @@ rc = qeth_send_simple_setassparms(card, IPA_IP_FRAGMENTATION, IPA_CMD_ASS_START, 0); if (rc) { - PRINT_WARN("Could not start IP fragmentation " + PRINT_WARN("Could not start Hardware IP fragmentation " "assist on %s: 0x%x\n", card->info.if_name, rc); } else - PRINT_INFO("IP fragmentation enabled \n"); + PRINT_INFO("Hardware IP fragmentation enabled \n"); return rc; } diff -Nru a/drivers/s390/s390mach.h b/drivers/s390/s390mach.h --- a/drivers/s390/s390mach.h 2004-09-26 10:25:56 -07:00 +++ b/drivers/s390/s390mach.h 2004-09-26 10:25:56 -07:00 @@ -63,10 +63,6 @@ #define CRW_ERC_PERRI 0x07 /* perm. error, facility init */ #define CRW_ERC_PMOD 0x08 /* installed parameters modified */ -#define MCHCHK_STATUS_TO_PROCESS 0x00000001 -#define MCHCHK_STATUS_IN_PROGRESS 0x00000002 -#define MCHCHK_STATUS_WAITING 0x00000004 - extern __inline__ int stcrw(struct crw *pcrw ) { int ccode; diff -Nru a/drivers/sbus/char/cpwatchdog.c b/drivers/sbus/char/cpwatchdog.c --- a/drivers/sbus/char/cpwatchdog.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/sbus/char/cpwatchdog.c 2004-09-26 10:25:57 -07:00 @@ -118,40 +118,26 @@ * UNKNOWN, MAGICAL MYSTERY REGISTER * */ -struct wd_timer_regblk { - volatile __u16 dcntr; /* down counter - hw */ - volatile __u16 dcntr_pad; - volatile __u16 limit; /* limit register - hw */ - volatile __u16 limit_pad; - volatile __u8 status; /* status register - b */ - volatile __u8 status_pad; - volatile __u16 status_pad2; - volatile __u32 pad32; /* yet more padding */ -}; - -struct wd_pld_regblk { - volatile __u8 intr_mask; /* interrupt mask - b */ - volatile __u8 intr_mask_pad; - volatile __u16 intr_mask_pad2; - volatile __u8 status; /* device status - b */ - volatile __u8 status_pad; - volatile __u16 status_pad2; -}; +#define WD_TIMER_REGSZ 16 +#define WD0_OFF 0 +#define WD1_OFF (WD_TIMER_REGSZ * 1) +#define WD2_OFF (WD_TIMER_REGSZ * 2) +#define PLD_OFF (WD_TIMER_REGSZ * 3) + +#define WD_DCNTR 0x00 +#define WD_LIMIT 0x04 +#define WD_STATUS 0x08 -struct wd_regblk { - volatile struct wd_timer_regblk wd0_regs; - volatile struct wd_timer_regblk wd1_regs; - volatile struct wd_timer_regblk wd2_regs; - volatile struct wd_pld_regblk pld_regs; -}; +#define PLD_IMASK (PLD_OFF + 0x00) +#define PLD_STATUS (PLD_OFF + 0x04) /* Individual timer structure */ struct wd_timer { __u16 timeout; __u8 intr_mask; - unsigned char runstatus; - volatile struct wd_timer_regblk* regs; + unsigned char runstatus; + void __iomem *regs; }; /* Device structure @@ -165,7 +151,7 @@ unsigned short opt_timeout; unsigned char initialized; struct wd_timer watchdog[WD_NUMDEVS]; - volatile struct wd_regblk* regs; + void __iomem *regs; }; static struct wd_device wd_dev = { @@ -495,12 +481,12 @@ i, wd_getstatus(&wd_dev.watchdog[i])); } - printk("\tintr_mask at 0x%lx: 0x%x\n", - (unsigned long)(&wd_dev.regs->pld_regs.intr_mask), - readb(&wd_dev.regs->pld_regs.intr_mask)); - printk("\tpld_status at 0x%lx: 0x%x\n", - (unsigned long)(&wd_dev.regs->pld_regs.status), - readb(&wd_dev.regs->pld_regs.status)); + printk("\tintr_mask at %p: 0x%x\n", + wd_dev.regs + PLD_IMASK, + readb(wd_dev.regs + PLD_IMASK)); + printk("\tpld_status at %p: 0x%x\n", + wd_dev.regs + PLD_STATUS, + readb(wd_dev.regs + PLD_STATUS)); } #endif @@ -513,7 +499,7 @@ */ static void wd_toggleintr(struct wd_timer* pTimer, int enable) { - unsigned char curregs = wd_readb(&wd_dev.regs->pld_regs.intr_mask); + unsigned char curregs = wd_readb(wd_dev.regs + PLD_IMASK); unsigned char setregs = (NULL == pTimer) ? (WD0_INTR_MASK | WD1_INTR_MASK | WD2_INTR_MASK) : @@ -523,7 +509,7 @@ (curregs &= ~setregs): (curregs |= setregs); - wd_writeb(curregs, &wd_dev.regs->pld_regs.intr_mask); + wd_writeb(curregs, wd_dev.regs + PLD_IMASK); return; } @@ -534,8 +520,8 @@ */ static void wd_pingtimer(struct wd_timer* pTimer) { - if(wd_readb(&pTimer->regs->status) & WD_S_RUNNING) { - wd_readw(&pTimer->regs->dcntr); + if (wd_readb(pTimer->regs + WD_STATUS) & WD_S_RUNNING) { + wd_readw(pTimer->regs + WD_DCNTR); } } @@ -547,7 +533,7 @@ */ static void wd_stoptimer(struct wd_timer* pTimer) { - if(wd_readb(&pTimer->regs->status) & WD_S_RUNNING) { + if(wd_readb(pTimer->regs + WD_STATUS) & WD_S_RUNNING) { wd_toggleintr(pTimer, WD_INTR_OFF); if(wd_dev.isbaddoggie) { @@ -574,7 +560,7 @@ } pTimer->runstatus &= ~WD_STAT_SVCD; - wd_writew(pTimer->timeout, &pTimer->regs->limit); + wd_writew(pTimer->timeout, pTimer->regs + WD_LIMIT); wd_toggleintr(pTimer, WD_INTR_ON); } @@ -584,7 +570,7 @@ static void wd_resetbrokentimer(struct wd_timer* pTimer) { wd_toggleintr(pTimer, WD_INTR_ON); - wd_writew(WD_BLIMIT, &pTimer->regs->limit); + wd_writew(WD_BLIMIT, pTimer->regs + WD_LIMIT); } /* Timer device initialization helper. @@ -593,7 +579,7 @@ static int wd_inittimer(int whichdog) { struct miscdevice *whichmisc; - volatile struct wd_timer_regblk *whichregs; + void __iomem *whichregs; char whichident[8]; int whichmask; __u16 whichlimit; @@ -603,7 +589,7 @@ case WD0_ID: whichmisc = &wd0_miscdev; strcpy(whichident, "RIC"); - whichregs = &wd_dev.regs->wd0_regs; + whichregs = wd_dev.regs + WD0_OFF; whichmask = WD0_INTR_MASK; whichlimit= (0 == wd0_timeout) ? (wd_dev.opt_timeout): @@ -612,7 +598,7 @@ case WD1_ID: whichmisc = &wd1_miscdev; strcpy(whichident, "XIR"); - whichregs = &wd_dev.regs->wd1_regs; + whichregs = wd_dev.regs + WD1_OFF; whichmask = WD1_INTR_MASK; whichlimit= (0 == wd1_timeout) ? (wd_dev.opt_timeout): @@ -621,7 +607,7 @@ case WD2_ID: whichmisc = &wd2_miscdev; strcpy(whichident, "POR"); - whichregs = &wd_dev.regs->wd2_regs; + whichregs = wd_dev.regs + WD2_OFF; whichmask = WD2_INTR_MASK; whichlimit= (0 == wd2_timeout) ? (wd_dev.opt_timeout): @@ -686,8 +672,8 @@ static int wd_getstatus(struct wd_timer* pTimer) { - unsigned char stat = wd_readb(&pTimer->regs->status); - unsigned char intr = wd_readb(&wd_dev.regs->pld_regs.intr_mask); + unsigned char stat = wd_readb(pTimer->regs + WD_STATUS); + unsigned char intr = wd_readb(wd_dev.regs + PLD_IMASK); unsigned char ret = WD_STOPPED; /* determine STOPPED */ @@ -805,7 +791,7 @@ * also now eventually trip. */ for(id = WD0_ID; id < WD_NUMDEVS; ++id) { - if(WD_S_RUNNING == wd_readb(&wd_dev.watchdog[id].regs->status)) { + if(WD_S_RUNNING == wd_readb(wd_dev.watchdog[id].regs + WD_STATUS)) { if(wd_dev.opt_enable) { printk(KERN_WARNING "%s%i: timer not stopped at release\n", WD_OBPNAME, id); @@ -818,7 +804,7 @@ "%s%i: defect workaround disabled at release, "\ "timer expires in ~%01i sec\n", WD_OBPNAME, id, - wd_readw(&wd_dev.watchdog[id].regs->limit) / 10); + wd_readw(wd_dev.watchdog[id].regs + WD_LIMIT) / 10); } } } diff -Nru a/drivers/sbus/char/display7seg.c b/drivers/sbus/char/display7seg.c --- a/drivers/sbus/char/display7seg.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/sbus/char/display7seg.c 2004-09-26 10:25:57 -07:00 @@ -70,7 +70,7 @@ * FLIP - Inverts display for upside-down mounted board * bits 0-4 - 7-segment display contents */ -volatile u8* d7s_regs = NULL; +static void __iomem* d7s_regs; static inline void d7s_free(void) { diff -Nru a/drivers/sbus/char/envctrl.c b/drivers/sbus/char/envctrl.c --- a/drivers/sbus/char/envctrl.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/sbus/char/envctrl.c 2004-09-26 10:25:55 -07:00 @@ -130,10 +130,8 @@ */ #define ENVCTRL_CPCI_IGNORED_NODE 0x70 -struct pcf8584_reg { - unsigned char data; - unsigned char csr; -}; +#define PCF8584_DATA 0x00 +#define PCF8584_CSR 0x01 /* Each child device can be monitored by up to PCF8584_MAX_CHANNELS. * Property of a port or channel as defined by the firmware. @@ -175,7 +173,7 @@ char mon_type[PCF8584_MAX_CHANNELS]; }; -volatile static struct pcf8584_reg *i2c = NULL; +static void __iomem *i2c; static struct i2c_child_t i2c_childlist[ENVCTRL_MAX_CPU*2]; static unsigned char chnls_mask[] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 }; static unsigned int warning_temperature = 0; @@ -185,22 +183,6 @@ /* Forward declarations. */ static struct i2c_child_t *envctrl_get_i2c_child(unsigned char); -/* Function description: Read a byte from an i2c controller register. - * Return: A byte from the passed in address. - */ -static inline unsigned char envctrl_readb(volatile unsigned char *p) -{ - return readb(p); -} - -/* Function description: Write a byte to an i2c controller register. - * Return: Nothing. - */ -static inline void envctrl_writeb(unsigned char val, volatile unsigned char *p) -{ - writeb(val, p); -} - /* Function Description: Test the PIN bit (Pending Interrupt Not) * to test when serial transmission is completed . * Return : None. @@ -210,7 +192,7 @@ int limit = 1000000; while (--limit > 0) { - if (!(envctrl_readb(&i2c->csr) & STATUS_PIN)) + if (!(readb(i2c + PCF8584_CSR) & STATUS_PIN)) break; udelay(1); } @@ -228,7 +210,7 @@ while (--limit > 0) { /* Busy bit 0 means busy. */ - if (envctrl_readb(&i2c->csr) & STATUS_BB) + if (readb(i2c + PCF8584_CSR) & STATUS_BB) break; udelay(1); } @@ -245,20 +227,20 @@ envctrl_i2c_test_bb(); /* Load address. */ - envctrl_writeb(addr + 1, &i2c->data); + writeb(addr + 1, i2c + PCF8584_DATA); envctrl_i2c_test_bb(); - envctrl_writeb(OBD_SEND_START, &i2c->csr); + writeb(OBD_SEND_START, i2c + PCF8584_CSR); /* Wait for PIN. */ envtrl_i2c_test_pin(); /* CSR 0 means acknowledged. */ - if (!(envctrl_readb(&i2c->csr) & STATUS_LRB)) { - return envctrl_readb(&i2c->data); + if (!(readb(i2c + PCF8584_CSR) & STATUS_LRB)) { + return readb(i2c + PCF8584_DATA); } else { - envctrl_writeb(OBD_SEND_STOP, &i2c->csr); + writeb(OBD_SEND_STOP, i2c + PCF8584_CSR); return 0; } } @@ -269,10 +251,10 @@ static void envctrl_i2c_write_addr(unsigned char addr) { envctrl_i2c_test_bb(); - envctrl_writeb(addr, &i2c->data); + writeb(addr, i2c + PCF8584_DATA); /* Generate Start condition. */ - envctrl_writeb(OBD_SEND_START, &i2c->csr); + writeb(OBD_SEND_START, i2c + PCF8584_CSR); } /* Function Description: Read 1 byte of data from addr @@ -282,8 +264,8 @@ static unsigned char envctrl_i2c_read_data(void) { envtrl_i2c_test_pin(); - envctrl_writeb(CONTROL_ES0, &i2c->csr); /* Send neg ack. */ - return envctrl_readb(&i2c->data); + writeb(CONTROL_ES0, i2c + PCF8584_CSR); /* Send neg ack. */ + return readb(i2c + PCF8584_DATA); } /* Function Description: Instruct the device which port to read data from. @@ -292,7 +274,7 @@ static void envctrl_i2c_write_data(unsigned char port) { envtrl_i2c_test_pin(); - envctrl_writeb(port, &i2c->data); + writeb(port, i2c + PCF8584_DATA); } /* Function Description: Generate Stop condition after last byte is sent. @@ -301,7 +283,7 @@ static void envctrl_i2c_stop(void) { envtrl_i2c_test_pin(); - envctrl_writeb(OBD_SEND_STOP, &i2c->csr); + writeb(OBD_SEND_STOP, i2c + PCF8584_CSR); } /* Function Description: Read adc device. @@ -323,7 +305,7 @@ envctrl_i2c_read_data(); envctrl_i2c_stop(); - return envctrl_readb(&i2c->data); + return readb(i2c + PCF8584_DATA); } /* Function Description: Read gpio device. @@ -1084,8 +1066,7 @@ for_each_ebus(ebus) { for_each_ebusdev(edev, ebus) { if (!strcmp(edev->prom_name, "i2c")) { - i2c = ioremap( edev->resource[0].start, - sizeof(struct pcf8584_reg)); + i2c = ioremap(edev->resource[0].start, 0x2); for_each_edevchild(edev, edev_child) { if (!strcmp("gpio", edev_child->prom_name)) { i2c_childlist[i].i2ctype = I2C_GPIO; @@ -1108,15 +1089,15 @@ } /* Set device address. */ - envctrl_writeb(CONTROL_PIN, &i2c->csr); - envctrl_writeb(PCF8584_ADDRESS, &i2c->data); + writeb(CONTROL_PIN, i2c + PCF8584_CSR); + writeb(PCF8584_ADDRESS, i2c + PCF8584_DATA); /* Set system clock and SCL frequencies. */ - envctrl_writeb(CONTROL_PIN | CONTROL_ES1, &i2c->csr); - envctrl_writeb(CLK_4_43 | BUS_CLK_90, &i2c->data); + writeb(CONTROL_PIN | CONTROL_ES1, i2c + PCF8584_CSR); + writeb(CLK_4_43 | BUS_CLK_90, i2c + PCF8584_DATA); /* Enable serial interface. */ - envctrl_writeb(CONTROL_PIN | CONTROL_ES0 | CONTROL_ACK, &i2c->csr); + writeb(CONTROL_PIN | CONTROL_ES0 | CONTROL_ACK, i2c + PCF8584_CSR); udelay(200); /* Register the device as a minor miscellaneous device. */ diff -Nru a/drivers/sbus/char/flash.c b/drivers/sbus/char/flash.c --- a/drivers/sbus/char/flash.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/sbus/char/flash.c 2004-09-26 10:25:56 -07:00 @@ -22,6 +22,7 @@ #include #include #include +#include static spinlock_t flash_lock = SPIN_LOCK_UNLOCKED; static struct { @@ -115,7 +116,7 @@ count = flash.read_size - p; for (i = 0; i < count; i++) { - u8 data = readb(flash.read_base + p + i); + u8 data = upa_readb(flash.read_base + p + i); if (put_user(data, buf)) return -EFAULT; buf++; diff -Nru a/drivers/sbus/dvma.c b/drivers/sbus/dvma.c --- a/drivers/sbus/dvma.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/sbus/dvma.c 2004-09-26 10:25:57 -07:00 @@ -17,14 +17,6 @@ struct sbus_dma *dma_chain; -/* Print out the current values in the DMA control registers */ -extern __inline__ void dump_dma_regs(unsigned long dregs) -{ - printk("DMA CONTROL<%08x> ADDR<%08x> CNT<%08x> TEST<%08x>\n", - sbus_readl(dregs + DMA_CSR), sbus_readl(dregs + DMA_ADDR), - sbus_readl(dregs + DMA_COUNT), sbus_readl(dregs + DMA_TEST)); -} - void __init init_one_dvma(struct sbus_dma *dma, int num_dma) { printk("dma%d: ", num_dma); @@ -64,9 +56,6 @@ break; } printk("\n"); -#if 0 /* Clutters up the screen */ - dump_dma_regs(dma->regs); -#endif } /* Probe this SBus DMA module(s) */ diff -Nru a/drivers/scsi/ata_piix.c b/drivers/scsi/ata_piix.c --- a/drivers/scsi/ata_piix.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/scsi/ata_piix.c 2004-09-26 10:25:56 -07:00 @@ -125,15 +125,16 @@ .set_piomode = piix_set_piomode, .set_dmamode = piix_set_dmamode, - .tf_load = ata_tf_load_pio, - .tf_read = ata_tf_read_pio, - .check_status = ata_check_status_pio, - .exec_command = ata_exec_command_pio, + .tf_load = ata_tf_load, + .tf_read = ata_tf_read, + .check_status = ata_check_status, + .exec_command = ata_exec_command, + .dev_select = ata_std_dev_select, .phy_reset = piix_pata_phy_reset, - .bmdma_setup = ata_bmdma_setup_pio, - .bmdma_start = ata_bmdma_start_pio, + .bmdma_setup = ata_bmdma_setup, + .bmdma_start = ata_bmdma_start, .qc_prep = ata_qc_prep, .qc_issue = ata_qc_issue_prot, @@ -149,15 +150,16 @@ static struct ata_port_operations piix_sata_ops = { .port_disable = ata_port_disable, - .tf_load = ata_tf_load_pio, - .tf_read = ata_tf_read_pio, - .check_status = ata_check_status_pio, - .exec_command = ata_exec_command_pio, + .tf_load = ata_tf_load, + .tf_read = ata_tf_read, + .check_status = ata_check_status, + .exec_command = ata_exec_command, + .dev_select = ata_std_dev_select, .phy_reset = piix_sata_phy_reset, - .bmdma_setup = ata_bmdma_setup_pio, - .bmdma_start = ata_bmdma_start_pio, + .bmdma_setup = ata_bmdma_setup, + .bmdma_start = ata_bmdma_start, .qc_prep = ata_qc_prep, .qc_issue = ata_qc_issue_prot, diff -Nru a/drivers/scsi/esp.h b/drivers/scsi/esp.h --- a/drivers/scsi/esp.h 2004-09-26 10:25:55 -07:00 +++ b/drivers/scsi/esp.h 2004-09-26 10:25:55 -07:00 @@ -77,8 +77,8 @@ /* We get one of these for each ESP probed. */ struct esp { - unsigned long eregs; /* ESP controller registers */ - unsigned long dregs; /* DMA controller registers */ + void __iomem *eregs; /* ESP controller registers */ + void __iomem *dregs; /* DMA controller registers */ struct sbus_dma *dma; /* DMA controller sw state */ struct Scsi_Host *ehost; /* Backpointer to SCSI Host */ struct sbus_dev *sdev; /* Pointer to SBus entry */ diff -Nru a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c --- a/drivers/scsi/libata-core.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/scsi/libata-core.c 2004-09-26 10:25:55 -07:00 @@ -50,7 +50,6 @@ static unsigned int ata_busy_sleep (struct ata_port *ap, unsigned long tmout_pat, unsigned long tmout); -static void __ata_dev_select (struct ata_port *ap, unsigned int device); static void ata_set_mode(struct ata_port *ap); static void ata_dev_set_xfermode(struct ata_port *ap, struct ata_device *dev); static unsigned int ata_get_mode_mask(struct ata_port *ap, int shift); @@ -68,17 +67,17 @@ MODULE_LICENSE("GPL"); /** - * ata_tf_load_pio - send taskfile registers to host controller + * ata_tf_load - send taskfile registers to host controller * @ap: Port to which output is sent * @tf: ATA taskfile register set * - * Outputs ATA taskfile to standard ATA host controller using PIO. + * Outputs ATA taskfile to standard ATA host controller. * * LOCKING: * Inherited from caller. */ -void ata_tf_load_pio(struct ata_port *ap, struct ata_taskfile *tf) +static void ata_tf_load_pio(struct ata_port *ap, struct ata_taskfile *tf) { struct ata_ioports *ioaddr = &ap->ioaddr; unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR; @@ -136,7 +135,7 @@ * Inherited from caller. */ -void ata_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf) +static void ata_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf) { struct ata_ioports *ioaddr = &ap->ioaddr; unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR; @@ -183,19 +182,27 @@ ata_wait_idle(ap); } +void ata_tf_load(struct ata_port *ap, struct ata_taskfile *tf) +{ + if (ap->flags & ATA_FLAG_MMIO) + ata_tf_load_mmio(ap, tf); + else + ata_tf_load_pio(ap, tf); +} + /** - * ata_exec_command_pio - issue ATA command to host controller + * ata_exec_command - issue ATA command to host controller * @ap: port to which command is being issued * @tf: ATA taskfile register set * - * Issues PIO write to ATA command register, with proper + * Issues PIO/MMIO write to ATA command register, with proper * synchronization with interrupt handler / other threads. * * LOCKING: * spin_lock_irqsave(host_set lock) */ -void ata_exec_command_pio(struct ata_port *ap, struct ata_taskfile *tf) +static void ata_exec_command_pio(struct ata_port *ap, struct ata_taskfile *tf) { DPRINTK("ata%u: cmd 0x%X\n", ap->id, tf->command); @@ -216,7 +223,7 @@ * spin_lock_irqsave(host_set lock) */ -void ata_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf) +static void ata_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf) { DPRINTK("ata%u: cmd 0x%X\n", ap->id, tf->command); @@ -224,12 +231,20 @@ ata_pause(ap); } +void ata_exec_command(struct ata_port *ap, struct ata_taskfile *tf) +{ + if (ap->flags & ATA_FLAG_MMIO) + ata_exec_command_mmio(ap, tf); + else + ata_exec_command_pio(ap, tf); +} + /** * ata_exec - issue ATA command to host controller * @ap: port to which command is being issued * @tf: ATA taskfile register set * - * Issues PIO write to ATA command register, with proper + * Issues PIO/MMIO write to ATA command register, with proper * synchronization with interrupt handler / other threads. * * LOCKING: @@ -252,7 +267,7 @@ * @tf: ATA taskfile register set * * Issues ATA taskfile register set to ATA host controller, - * via PIO, with proper synchronization with interrupt handler and + * with proper synchronization with interrupt handler and * other threads. * * LOCKING: @@ -272,7 +287,7 @@ * @tf: ATA taskfile register set * * Issues ATA taskfile register set to ATA host controller, - * via PIO, with proper synchronization with interrupt handler and + * with proper synchronization with interrupt handler and * other threads. * * LOCKING: @@ -286,18 +301,18 @@ } /** - * ata_tf_read_pio - input device's ATA taskfile shadow registers + * ata_tf_read - input device's ATA taskfile shadow registers * @ap: Port from which input is read * @tf: ATA taskfile register set for storing input * * Reads ATA taskfile registers for currently-selected device - * into @tf via PIO. + * into @tf. * * LOCKING: * Inherited from caller. */ -void ata_tf_read_pio(struct ata_port *ap, struct ata_taskfile *tf) +static void ata_tf_read_pio(struct ata_port *ap, struct ata_taskfile *tf) { struct ata_ioports *ioaddr = &ap->ioaddr; @@ -329,7 +344,7 @@ * Inherited from caller. */ -void ata_tf_read_mmio(struct ata_port *ap, struct ata_taskfile *tf) +static void ata_tf_read_mmio(struct ata_port *ap, struct ata_taskfile *tf) { struct ata_ioports *ioaddr = &ap->ioaddr; @@ -349,18 +364,26 @@ } } +void ata_tf_read(struct ata_port *ap, struct ata_taskfile *tf) +{ + if (ap->flags & ATA_FLAG_MMIO) + ata_tf_read_mmio(ap, tf); + else + ata_tf_read_pio(ap, tf); +} + /** - * ata_check_status_pio - Read device status reg & clear interrupt + * ata_check_status - Read device status reg & clear interrupt * @ap: port where the device is * * Reads ATA taskfile status register for currently-selected device - * via PIO and return it's value. This also clears pending interrupts + * and return it's value. This also clears pending interrupts * from this device * * LOCKING: * Inherited from caller. */ -u8 ata_check_status_pio(struct ata_port *ap) +static u8 ata_check_status_pio(struct ata_port *ap) { return inb(ap->ioaddr.status_addr); } @@ -376,11 +399,18 @@ * LOCKING: * Inherited from caller. */ -u8 ata_check_status_mmio(struct ata_port *ap) +static u8 ata_check_status_mmio(struct ata_port *ap) { return readb((void __iomem *) ap->ioaddr.status_addr); } +u8 ata_check_status(struct ata_port *ap) +{ + if (ap->flags & ATA_FLAG_MMIO) + return ata_check_status_mmio(ap); + return ata_check_status_pio(ap); +} + /** * ata_tf_to_fis - Convert ATA taskfile to SATA FIS structure * @tf: Taskfile to convert @@ -606,7 +636,7 @@ struct ata_ioports *ioaddr = &ap->ioaddr; u8 nsect, lbal; - __ata_dev_select(ap, device); + ap->ops->dev_select(ap, device); outb(0x55, ioaddr->nsect_addr); outb(0xaa, ioaddr->lbal_addr); @@ -650,7 +680,7 @@ struct ata_ioports *ioaddr = &ap->ioaddr; u8 nsect, lbal; - __ata_dev_select(ap, device); + ap->ops->dev_select(ap, device); writeb(0x55, (void __iomem *) ioaddr->nsect_addr); writeb(0xaa, (void __iomem *) ioaddr->lbal_addr); @@ -671,7 +701,7 @@ } /** - * ata_dev_devchk - PATA device presence detection + * ata_devchk - PATA device presence detection * @ap: ATA channel to examine * @device: Device to examine (starting at zero) * @@ -683,7 +713,7 @@ * caller. */ -static unsigned int ata_dev_devchk(struct ata_port *ap, +static unsigned int ata_devchk(struct ata_port *ap, unsigned int device) { if (ap->flags & ATA_FLAG_MMIO) @@ -707,7 +737,7 @@ * the event of failure. */ -static unsigned int ata_dev_classify(struct ata_taskfile *tf) +unsigned int ata_dev_classify(struct ata_taskfile *tf) { /* Apple's open source Darwin code hints that some devices only * put a proper signature into the LBA mid/high registers, @@ -755,7 +785,7 @@ unsigned int class; u8 err; - __ata_dev_select(ap, device); + ap->ops->dev_select(ap, device); memset(&tf, 0, sizeof(tf)); @@ -818,8 +848,12 @@ } } +void ata_noop_dev_select (struct ata_port *ap, unsigned int device) +{ +} + /** - * __ata_dev_select - Select device 0/1 on ATA bus + * ata_std_dev_select - Select device 0/1 on ATA bus * @ap: ATA channel to manipulate * @device: ATA device (numbered from zero) to select * @@ -831,7 +865,7 @@ * caller. */ -static void __ata_dev_select (struct ata_port *ap, unsigned int device) +void ata_std_dev_select (struct ata_port *ap, unsigned int device) { u8 tmp; @@ -859,7 +893,7 @@ * make either device 0, or device 1, active on the * ATA channel. * - * This is a high-level version of __ata_dev_select(), + * This is a high-level version of ata_std_dev_select(), * which additionally provides the services of inserting * the proper pauses and status polling, where needed. * @@ -876,7 +910,7 @@ if (wait) ata_wait_idle(ap); - __ata_dev_select(ap, device); + ap->ops->dev_select(ap, device); if (wait) { if (can_sleep && ap->device[device].class == ATA_DEV_ATAPI) @@ -1183,13 +1217,13 @@ } /** - * sata_phy_reset - + * __sata_phy_reset - * @ap: * * LOCKING: * */ -void sata_phy_reset(struct ata_port *ap) +void __sata_phy_reset(struct ata_port *ap) { u32 sstatus; unsigned long timeout = jiffies + (HZ * 5); @@ -1227,6 +1261,21 @@ return; } + ap->cbl = ATA_CBL_SATA; +} + +/** + * __sata_phy_reset - + * @ap: + * + * LOCKING: + * + */ +void sata_phy_reset(struct ata_port *ap) +{ + __sata_phy_reset(ap); + if (ap->flags & ATA_FLAG_PORT_DISABLED) + return; ata_bus_reset(ap); } @@ -1439,20 +1488,20 @@ unsigned int dev1 = devmask & (1 << 1); unsigned long timeout; - /* if device 0 was found in ata_dev_devchk, wait for its + /* if device 0 was found in ata_devchk, wait for its * BSY bit to clear */ if (dev0) ata_busy_sleep(ap, ATA_TMOUT_BOOT_QUICK, ATA_TMOUT_BOOT); - /* if device 1 was found in ata_dev_devchk, wait for + /* if device 1 was found in ata_devchk, wait for * register access, then wait for BSY to clear */ timeout = jiffies + ATA_TMOUT_BOOT; while (dev1) { u8 nsect, lbal; - __ata_dev_select(ap, 1); + ap->ops->dev_select(ap, 1); if (ap->flags & ATA_FLAG_MMIO) { nsect = readb((void __iomem *) ioaddr->nsect_addr); lbal = readb((void __iomem *) ioaddr->lbal_addr); @@ -1472,11 +1521,11 @@ ata_busy_sleep(ap, ATA_TMOUT_BOOT_QUICK, ATA_TMOUT_BOOT); /* is all this really necessary? */ - __ata_dev_select(ap, 0); + ap->ops->dev_select(ap, 0); if (dev1) - __ata_dev_select(ap, 1); + ap->ops->dev_select(ap, 1); if (dev0) - __ata_dev_select(ap, 0); + ap->ops->dev_select(ap, 0); } /** @@ -1580,9 +1629,9 @@ if (ap->flags & ATA_FLAG_SATA_RESET) dev0 = 1; else { - dev0 = ata_dev_devchk(ap, 0); + dev0 = ata_devchk(ap, 0); if (slave_possible) - dev1 = ata_dev_devchk(ap, 1); + dev1 = ata_devchk(ap, 1); } if (dev0) @@ -1591,7 +1640,7 @@ devmask |= (1 << 1); /* select device 0 again */ - __ata_dev_select(ap, 0); + ap->ops->dev_select(ap, 0); /* issue bus reset */ if (ap->flags & ATA_FLAG_SRST) @@ -1620,9 +1669,9 @@ /* is double-select really necessary? */ if (ap->device[1].class != ATA_DEV_NONE) - __ata_dev_select(ap, 1); + ap->ops->dev_select(ap, 1); if (ap->device[0].class != ATA_DEV_NONE) - __ata_dev_select(ap, 0); + ap->ops->dev_select(ap, 0); /* if no devices were detected, disable this port */ if ((ap->device[0].class == ATA_DEV_NONE) && @@ -2135,9 +2184,7 @@ qc->cursg_ofs = 0; } - DPRINTK("data %s, drv_stat 0x%X\n", - qc->tf.flags & ATA_TFLAG_WRITE ? "write" : "read", - status); + DPRINTK("data %s\n", qc->tf.flags & ATA_TFLAG_WRITE ? "write" : "read"); /* do the actual data transfer */ do_write = (qc->tf.flags & ATA_TFLAG_WRITE); @@ -2162,7 +2209,7 @@ /* shall be cleared to zero, indicating xfer of data */ if (ireason & (1 << 0)) goto err_out; - + /* make sure transfer direction matches expected */ i_write = ((ireason & (1 << 1)) == 0) ? 1 : 0; if (do_write != i_write) @@ -2178,7 +2225,7 @@ for (i = 0; i < (bytes >> 9); i++) ata_pio_sector(qc); - + return; err_out: @@ -2606,14 +2653,14 @@ } /** - * ata_bmdma_setup_mmio - Set up PCI IDE BMDMA transaction (MMIO) + * ata_bmdma_setup - Set up PCI IDE BMDMA transaction * @qc: Info associated with this ATA transaction. * * LOCKING: * spin_lock_irqsave(host_set lock) */ -void ata_bmdma_setup_mmio (struct ata_queued_cmd *qc) +static void ata_bmdma_setup_mmio (struct ata_queued_cmd *qc) { struct ata_port *ap = qc->ap; unsigned int rw = (qc->tf.flags & ATA_TFLAG_WRITE); @@ -2636,14 +2683,14 @@ } /** - * ata_bmdma_start_mmio - Start a PCI IDE BMDMA transaction (MMIO) + * ata_bmdma_start - Start a PCI IDE BMDMA transaction * @qc: Info associated with this ATA transaction. * * LOCKING: * spin_lock_irqsave(host_set lock) */ -void ata_bmdma_start_mmio (struct ata_queued_cmd *qc) +static void ata_bmdma_start_mmio (struct ata_queued_cmd *qc) { struct ata_port *ap = qc->ap; void __iomem *mmio = (void __iomem *) ap->ioaddr.bmdma_addr; @@ -2674,7 +2721,7 @@ * spin_lock_irqsave(host_set lock) */ -void ata_bmdma_setup_pio (struct ata_queued_cmd *qc) +static void ata_bmdma_setup_pio (struct ata_queued_cmd *qc) { struct ata_port *ap = qc->ap; unsigned int rw = (qc->tf.flags & ATA_TFLAG_WRITE); @@ -2702,7 +2749,7 @@ * spin_lock_irqsave(host_set lock) */ -void ata_bmdma_start_pio (struct ata_queued_cmd *qc) +static void ata_bmdma_start_pio (struct ata_queued_cmd *qc) { struct ata_port *ap = qc->ap; u8 dmactl; @@ -2713,6 +2760,22 @@ ap->ioaddr.bmdma_addr + ATA_DMA_CMD); } +void ata_bmdma_start(struct ata_queued_cmd *qc) +{ + if (qc->ap->flags & ATA_FLAG_MMIO) + ata_bmdma_start_mmio(qc); + else + ata_bmdma_start_pio(qc); +} + +void ata_bmdma_setup(struct ata_queued_cmd *qc) +{ + if (qc->ap->flags & ATA_FLAG_MMIO) + ata_bmdma_setup_mmio(qc); + else + ata_bmdma_setup_pio(qc); +} + void ata_bmdma_irq_clear(struct ata_port *ap) { ata_bmdma_ack_irq(ap); @@ -3205,6 +3268,95 @@ ioaddr->command_addr = ioaddr->cmd_addr + ATA_REG_CMD; } +static struct ata_probe_ent * +ata_probe_ent_alloc(int n, struct pci_dev *pdev, struct ata_port_info **port) +{ + struct ata_probe_ent *probe_ent; + int i; + + probe_ent = kmalloc(sizeof(*probe_ent) * n, GFP_KERNEL); + if (!probe_ent) { + printk(KERN_ERR DRV_NAME "(%s): out of memory\n", + pci_name(pdev)); + return NULL; + } + + memset(probe_ent, 0, sizeof(*probe_ent) * n); + + for (i = 0; i < n; i++) { + INIT_LIST_HEAD(&probe_ent[i].node); + probe_ent[i].pdev = pdev; + + probe_ent[i].sht = port[i]->sht; + probe_ent[i].host_flags = port[i]->host_flags; + probe_ent[i].pio_mask = port[i]->pio_mask; + probe_ent[i].mwdma_mask = port[i]->mwdma_mask; + probe_ent[i].udma_mask = port[i]->udma_mask; + probe_ent[i].port_ops = port[i]->port_ops; + + } + + return probe_ent; +} + +struct ata_probe_ent * +ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port) +{ + struct ata_probe_ent *probe_ent = ata_probe_ent_alloc(1, pdev, port); + if (!probe_ent) + return NULL; + + probe_ent->n_ports = 2; + probe_ent->irq = pdev->irq; + probe_ent->irq_flags = SA_SHIRQ; + + probe_ent->port[0].cmd_addr = pci_resource_start(pdev, 0); + probe_ent->port[0].altstatus_addr = + probe_ent->port[0].ctl_addr = + pci_resource_start(pdev, 1) | ATA_PCI_CTL_OFS; + probe_ent->port[0].bmdma_addr = pci_resource_start(pdev, 4); + + probe_ent->port[1].cmd_addr = pci_resource_start(pdev, 2); + probe_ent->port[1].altstatus_addr = + probe_ent->port[1].ctl_addr = + pci_resource_start(pdev, 3) | ATA_PCI_CTL_OFS; + probe_ent->port[1].bmdma_addr = pci_resource_start(pdev, 4) + 8; + + ata_std_ports(&probe_ent->port[0]); + ata_std_ports(&probe_ent->port[1]); + + return probe_ent; +} + +struct ata_probe_ent * +ata_pci_init_legacy_mode(struct pci_dev *pdev, struct ata_port_info **port) +{ + struct ata_probe_ent *probe_ent = ata_probe_ent_alloc(2, pdev, port); + if (!probe_ent) + return NULL; + + probe_ent[0].n_ports = 1; + probe_ent[0].irq = 14; + + probe_ent[1].n_ports = 1; + probe_ent[1].irq = 15; + + probe_ent[0].port[0].cmd_addr = 0x1f0; + probe_ent[0].port[0].altstatus_addr = + probe_ent[0].port[0].ctl_addr = 0x3f6; + probe_ent[0].port[0].bmdma_addr = pci_resource_start(pdev, 4); + + probe_ent[1].port[0].cmd_addr = 0x170; + probe_ent[1].port[0].altstatus_addr = + probe_ent[1].port[0].ctl_addr = 0x376; + probe_ent[1].port[0].bmdma_addr = pci_resource_start(pdev, 4)+8; + + ata_std_ports(&probe_ent[0].port[0]); + ata_std_ports(&probe_ent[1].port[0]); + + return probe_ent; +} + /** * ata_pci_init_one - Initialize/register PCI IDE host controller * @pdev: Controller to be initialized @@ -3222,20 +3374,20 @@ unsigned int n_ports) { struct ata_probe_ent *probe_ent, *probe_ent2 = NULL; - struct ata_port_info *port0, *port1; + struct ata_port_info *port[2]; u8 tmp8, mask; unsigned int legacy_mode = 0; int rc; DPRINTK("ENTER\n"); - port0 = port_info[0]; + port[0] = port_info[0]; if (n_ports > 1) - port1 = port_info[1]; + port[1] = port_info[1]; else - port1 = port0; + port[1] = port[0]; - if ((port0->host_flags & ATA_FLAG_NO_LEGACY) == 0) { + if ((port[0]->host_flags & ATA_FLAG_NO_LEGACY) == 0) { /* TODO: support transitioning to native mode? */ pci_read_config_byte(pdev, PCI_CLASS_PROG, &tmp8); mask = (1 << 2) | (1 << 0); @@ -3296,77 +3448,17 @@ if (rc) goto err_out_regions; - probe_ent = kmalloc(sizeof(*probe_ent), GFP_KERNEL); + if (legacy_mode) { + probe_ent = ata_pci_init_legacy_mode(pdev, port); + if (probe_ent) + probe_ent2 = &probe_ent[1]; + } else + probe_ent = ata_pci_init_native_mode(pdev, port); if (!probe_ent) { rc = -ENOMEM; goto err_out_regions; } - memset(probe_ent, 0, sizeof(*probe_ent)); - probe_ent->pdev = pdev; - INIT_LIST_HEAD(&probe_ent->node); - - if (legacy_mode) { - probe_ent2 = kmalloc(sizeof(*probe_ent), GFP_KERNEL); - if (!probe_ent2) { - rc = -ENOMEM; - goto err_out_free_ent; - } - - memset(probe_ent2, 0, sizeof(*probe_ent)); - probe_ent2->pdev = pdev; - INIT_LIST_HEAD(&probe_ent2->node); - } - - probe_ent->port[0].bmdma_addr = pci_resource_start(pdev, 4); - probe_ent->sht = port0->sht; - probe_ent->host_flags = port0->host_flags; - probe_ent->pio_mask = port0->pio_mask; - probe_ent->mwdma_mask = port0->mwdma_mask; - probe_ent->udma_mask = port0->udma_mask; - probe_ent->port_ops = port0->port_ops; - - if (legacy_mode) { - probe_ent->port[0].cmd_addr = 0x1f0; - probe_ent->port[0].altstatus_addr = - probe_ent->port[0].ctl_addr = 0x3f6; - probe_ent->n_ports = 1; - probe_ent->irq = 14; - ata_std_ports(&probe_ent->port[0]); - - probe_ent2->port[0].cmd_addr = 0x170; - probe_ent2->port[0].altstatus_addr = - probe_ent2->port[0].ctl_addr = 0x376; - probe_ent2->port[0].bmdma_addr = pci_resource_start(pdev, 4)+8; - probe_ent2->n_ports = 1; - probe_ent2->irq = 15; - ata_std_ports(&probe_ent2->port[0]); - - probe_ent2->sht = port1->sht; - probe_ent2->host_flags = port1->host_flags; - probe_ent2->pio_mask = port1->pio_mask; - probe_ent2->mwdma_mask = port1->mwdma_mask; - probe_ent2->udma_mask = port1->udma_mask; - probe_ent2->port_ops = port1->port_ops; - } else { - probe_ent->port[0].cmd_addr = pci_resource_start(pdev, 0); - ata_std_ports(&probe_ent->port[0]); - probe_ent->port[0].altstatus_addr = - probe_ent->port[0].ctl_addr = - pci_resource_start(pdev, 1) | ATA_PCI_CTL_OFS; - - probe_ent->port[1].cmd_addr = pci_resource_start(pdev, 2); - ata_std_ports(&probe_ent->port[1]); - probe_ent->port[1].altstatus_addr = - probe_ent->port[1].ctl_addr = - pci_resource_start(pdev, 3) | ATA_PCI_CTL_OFS; - probe_ent->port[1].bmdma_addr = pci_resource_start(pdev, 4) + 8; - - probe_ent->n_ports = 2; - probe_ent->irq = pdev->irq; - probe_ent->irq_flags = SA_SHIRQ; - } - pci_set_master(pdev); /* FIXME: check ata_device_add return */ @@ -3375,17 +3467,13 @@ ata_device_add(probe_ent); if (legacy_mode & (1 << 1)) ata_device_add(probe_ent2); - kfree(probe_ent2); } else { ata_device_add(probe_ent); - assert(probe_ent2 == NULL); } kfree(probe_ent); return 0; -err_out_free_ent: - kfree(probe_ent); err_out_regions: if (legacy_mode & (1 << 0)) release_region(0x1f0, 8); @@ -3535,27 +3623,26 @@ EXPORT_SYMBOL_GPL(ata_qc_complete); EXPORT_SYMBOL_GPL(ata_qc_issue_prot); EXPORT_SYMBOL_GPL(ata_eng_timeout); -EXPORT_SYMBOL_GPL(ata_tf_load_pio); -EXPORT_SYMBOL_GPL(ata_tf_load_mmio); -EXPORT_SYMBOL_GPL(ata_tf_read_pio); -EXPORT_SYMBOL_GPL(ata_tf_read_mmio); +EXPORT_SYMBOL_GPL(ata_tf_load); +EXPORT_SYMBOL_GPL(ata_tf_read); +EXPORT_SYMBOL_GPL(ata_noop_dev_select); +EXPORT_SYMBOL_GPL(ata_std_dev_select); EXPORT_SYMBOL_GPL(ata_tf_to_fis); EXPORT_SYMBOL_GPL(ata_tf_from_fis); -EXPORT_SYMBOL_GPL(ata_check_status_pio); -EXPORT_SYMBOL_GPL(ata_check_status_mmio); -EXPORT_SYMBOL_GPL(ata_exec_command_pio); -EXPORT_SYMBOL_GPL(ata_exec_command_mmio); +EXPORT_SYMBOL_GPL(ata_pci_init_legacy_mode); +EXPORT_SYMBOL_GPL(ata_pci_init_native_mode); +EXPORT_SYMBOL_GPL(ata_check_status); +EXPORT_SYMBOL_GPL(ata_exec_command); EXPORT_SYMBOL_GPL(ata_port_start); EXPORT_SYMBOL_GPL(ata_port_stop); EXPORT_SYMBOL_GPL(ata_interrupt); EXPORT_SYMBOL_GPL(ata_qc_prep); -EXPORT_SYMBOL_GPL(ata_bmdma_setup_pio); -EXPORT_SYMBOL_GPL(ata_bmdma_start_pio); -EXPORT_SYMBOL_GPL(ata_bmdma_setup_mmio); -EXPORT_SYMBOL_GPL(ata_bmdma_start_mmio); +EXPORT_SYMBOL_GPL(ata_bmdma_setup); +EXPORT_SYMBOL_GPL(ata_bmdma_start); EXPORT_SYMBOL_GPL(ata_bmdma_irq_clear); EXPORT_SYMBOL_GPL(ata_port_probe); EXPORT_SYMBOL_GPL(sata_phy_reset); +EXPORT_SYMBOL_GPL(__sata_phy_reset); EXPORT_SYMBOL_GPL(ata_bus_reset); EXPORT_SYMBOL_GPL(ata_port_disable); EXPORT_SYMBOL_GPL(ata_pci_init_one); @@ -3566,4 +3653,5 @@ EXPORT_SYMBOL_GPL(ata_scsi_slave_config); EXPORT_SYMBOL_GPL(ata_scsi_release); EXPORT_SYMBOL_GPL(ata_host_intr); +EXPORT_SYMBOL_GPL(ata_dev_classify); EXPORT_SYMBOL_GPL(ata_dev_id_string); diff -Nru a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c --- a/drivers/scsi/qlogicpti.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/scsi/qlogicpti.c 2004-09-26 10:25:56 -07:00 @@ -987,7 +987,7 @@ static char buf[80]; struct qlogicpti *qpti = (struct qlogicpti *) host->hostdata; - sprintf(buf, "PTI Qlogic,ISP SBUS SCSI irq %s regs at %lx", + sprintf(buf, "PTI Qlogic,ISP SBUS SCSI irq %s regs at %p", __irq_itoa(qpti->qhost->irq), qpti->qregs); return buf; } diff -Nru a/drivers/scsi/qlogicpti.h b/drivers/scsi/qlogicpti.h --- a/drivers/scsi/qlogicpti.h 2004-09-26 10:25:55 -07:00 +++ b/drivers/scsi/qlogicpti.h 2004-09-26 10:25:55 -07:00 @@ -335,7 +335,7 @@ /* Software state for the driver. */ struct qlogicpti { /* These are the hot elements in the cache, so they come first. */ - unsigned long qregs; /* Adapter registers */ + void __iomem *qregs; /* Adapter registers */ struct pti_queue_entry *res_cpu; /* Ptr to RESPONSE bufs (CPU) */ struct pti_queue_entry *req_cpu; /* Ptr to REQUEST bufs (CPU) */ @@ -370,7 +370,7 @@ struct host_param host_param; struct dev_param dev_param[MAX_TARGETS]; - unsigned long sreg; + void __iomem *sreg; #define SREG_TPOWER 0x80 /* State of termpwr */ #define SREG_FUSE 0x40 /* State of on board fuse */ #define SREG_PDISAB 0x20 /* Disable state for power on */ diff -Nru a/drivers/scsi/sata_nv.c b/drivers/scsi/sata_nv.c --- a/drivers/scsi/sata_nv.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/scsi/sata_nv.c 2004-09-26 10:25:55 -07:00 @@ -50,8 +50,6 @@ #define NV_PIO_MASK 0x1f #define NV_MWDMA_MASK 0x07 #define NV_UDMA_MASK 0x7f -#define NV_PORT0_BMDMA_REG_OFFSET 0x00 -#define NV_PORT1_BMDMA_REG_OFFSET 0x08 #define NV_PORT0_SCR_REG_OFFSET 0x00 #define NV_PORT1_SCR_REG_OFFSET 0x40 @@ -187,7 +185,7 @@ .eh_strategy_handler = ata_scsi_error, .can_queue = ATA_DEF_QUEUE, .this_id = ATA_SHT_THIS_ID, - .sg_tablesize = ATA_MAX_PRD, + .sg_tablesize = LIBATA_MAX_PRD, .max_sectors = ATA_MAX_SECTORS, .cmd_per_lun = ATA_SHT_CMD_PER_LUN, .emulated = ATA_SHT_EMULATED, @@ -200,13 +198,14 @@ static struct ata_port_operations nv_ops = { .port_disable = ata_port_disable, - .tf_load = ata_tf_load_pio, - .tf_read = ata_tf_read_pio, - .exec_command = ata_exec_command_pio, - .check_status = ata_check_status_pio, + .tf_load = ata_tf_load, + .tf_read = ata_tf_read, + .exec_command = ata_exec_command, + .check_status = ata_check_status, + .dev_select = ata_std_dev_select, .phy_reset = sata_phy_reset, - .bmdma_setup = ata_bmdma_setup_pio, - .bmdma_start = ata_bmdma_start_pio, + .bmdma_setup = ata_bmdma_setup, + .bmdma_start = ata_bmdma_start, .qc_prep = ata_qc_prep, .qc_issue = ata_qc_issue_prot, .eng_timeout = ata_eng_timeout, @@ -219,6 +218,18 @@ .host_stop = nv_host_stop, }; +static struct ata_port_info nv_port_info = { + .sht = &nv_sht, + .host_flags = ATA_FLAG_SATA | + ATA_FLAG_SATA_RESET | + ATA_FLAG_SRST | + ATA_FLAG_NO_LEGACY, + .pio_mask = NV_PIO_MASK, + .mwdma_mask = NV_MWDMA_MASK, + .udma_mask = NV_UDMA_MASK, + .port_ops = &nv_ops, +}; + MODULE_AUTHOR("NVIDIA"); MODULE_DESCRIPTION("low-level driver for NVIDIA nForce SATA controller"); MODULE_LICENSE("GPL"); @@ -299,6 +310,7 @@ { static int printed_version = 0; struct nv_host *host; + struct ata_port_info *ppi; struct ata_probe_ent *probe_ent = NULL; int rc; @@ -320,7 +332,8 @@ if (rc) goto err_out_regions; - probe_ent = kmalloc(sizeof(*probe_ent), GFP_KERNEL); + ppi = &nv_port_info; + probe_ent = ata_pci_init_native_mode(pdev, &ppi); if (!probe_ent) { rc = -ENOMEM; goto err_out_regions; @@ -333,40 +346,6 @@ } host->host_desc = &nv_device_tbl[ent->driver_data]; - - memset(probe_ent, 0, sizeof(*probe_ent)); - INIT_LIST_HEAD(&probe_ent->node); - - probe_ent->pdev = pdev; - probe_ent->sht = &nv_sht; - probe_ent->host_flags = ATA_FLAG_SATA | - ATA_FLAG_SATA_RESET | - ATA_FLAG_SRST | - ATA_FLAG_NO_LEGACY; - - probe_ent->port_ops = &nv_ops; - probe_ent->n_ports = NV_PORTS; - probe_ent->irq = pdev->irq; - probe_ent->irq_flags = SA_SHIRQ; - probe_ent->pio_mask = NV_PIO_MASK; - probe_ent->mwdma_mask = NV_MWDMA_MASK; - probe_ent->udma_mask = NV_UDMA_MASK; - - probe_ent->port[0].cmd_addr = pci_resource_start(pdev, 0); - ata_std_ports(&probe_ent->port[0]); - probe_ent->port[0].altstatus_addr = - probe_ent->port[0].ctl_addr = - pci_resource_start(pdev, 1) | ATA_PCI_CTL_OFS; - probe_ent->port[0].bmdma_addr = - pci_resource_start(pdev, 4) | NV_PORT0_BMDMA_REG_OFFSET; - - probe_ent->port[1].cmd_addr = pci_resource_start(pdev, 2); - ata_std_ports(&probe_ent->port[1]); - probe_ent->port[1].altstatus_addr = - probe_ent->port[1].ctl_addr = - pci_resource_start(pdev, 3) | ATA_PCI_CTL_OFS; - probe_ent->port[1].bmdma_addr = - pci_resource_start(pdev, 4) | NV_PORT1_BMDMA_REG_OFFSET; probe_ent->private_data = host; diff -Nru a/drivers/scsi/sata_promise.c b/drivers/scsi/sata_promise.c --- a/drivers/scsi/sata_promise.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/scsi/sata_promise.c 2004-09-26 10:25:57 -07:00 @@ -107,9 +107,10 @@ static struct ata_port_operations pdc_sata_ops = { .port_disable = ata_port_disable, .tf_load = pdc_tf_load_mmio, - .tf_read = ata_tf_read_mmio, - .check_status = ata_check_status_mmio, + .tf_read = ata_tf_read, + .check_status = ata_check_status, .exec_command = pdc_exec_command_mmio, + .dev_select = ata_std_dev_select, .phy_reset = pdc_phy_reset, .qc_prep = pdc_qc_prep, .qc_issue = pdc_qc_issue_prot, @@ -468,7 +469,7 @@ { WARN_ON (tf->protocol == ATA_PROT_DMA || tf->protocol == ATA_PROT_NODATA); - ata_tf_load_mmio(ap, tf); + ata_tf_load(ap, tf); } @@ -476,7 +477,7 @@ { WARN_ON (tf->protocol == ATA_PROT_DMA || tf->protocol == ATA_PROT_NODATA); - ata_exec_command_mmio(ap, tf); + ata_exec_command(ap, tf); } diff -Nru a/drivers/scsi/sata_sil.c b/drivers/scsi/sata_sil.c --- a/drivers/scsi/sata_sil.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/scsi/sata_sil.c 2004-09-26 10:25:55 -07:00 @@ -125,14 +125,15 @@ static struct ata_port_operations sil_ops = { .port_disable = ata_port_disable, .dev_config = sil_dev_config, - .tf_load = ata_tf_load_mmio, - .tf_read = ata_tf_read_mmio, - .check_status = ata_check_status_mmio, - .exec_command = ata_exec_command_mmio, + .tf_load = ata_tf_load, + .tf_read = ata_tf_read, + .check_status = ata_check_status, + .exec_command = ata_exec_command, + .dev_select = ata_std_dev_select, .phy_reset = sata_phy_reset, .post_set_mode = sil_post_set_mode, - .bmdma_setup = ata_bmdma_setup_mmio, - .bmdma_start = ata_bmdma_start_mmio, + .bmdma_setup = ata_bmdma_setup, + .bmdma_start = ata_bmdma_start, .qc_prep = ata_qc_prep, .qc_issue = ata_qc_issue_prot, .eng_timeout = ata_eng_timeout, diff -Nru a/drivers/scsi/sata_sis.c b/drivers/scsi/sata_sis.c --- a/drivers/scsi/sata_sis.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/scsi/sata_sis.c 2004-09-26 10:25:56 -07:00 @@ -94,13 +94,14 @@ static struct ata_port_operations sis_ops = { .port_disable = ata_port_disable, - .tf_load = ata_tf_load_pio, - .tf_read = ata_tf_read_pio, - .check_status = ata_check_status_pio, - .exec_command = ata_exec_command_pio, + .tf_load = ata_tf_load, + .tf_read = ata_tf_read, + .check_status = ata_check_status, + .exec_command = ata_exec_command, + .dev_select = ata_std_dev_select, .phy_reset = sata_phy_reset, - .bmdma_setup = ata_bmdma_setup_pio, - .bmdma_start = ata_bmdma_start_pio, + .bmdma_setup = ata_bmdma_setup, + .bmdma_start = ata_bmdma_start, .qc_prep = ata_qc_prep, .qc_issue = ata_qc_issue_prot, .eng_timeout = ata_eng_timeout, @@ -112,6 +113,16 @@ .port_stop = ata_port_stop, }; +static struct ata_port_info sis_port_info = { + .sht = &sis_sht, + .host_flags = ATA_FLAG_SATA | ATA_FLAG_SATA_RESET | + ATA_FLAG_NO_LEGACY, + .pio_mask = 0x1f, + .mwdma_mask = 0x7, + .udma_mask = 0x7f, + .port_ops = &sis_ops, +}; + MODULE_AUTHOR("Uwe Koziolek"); MODULE_DESCRIPTION("low-level driver for Silicon Integratad Systems SATA controller"); @@ -185,6 +196,7 @@ struct ata_probe_ent *probe_ent = NULL; int rc; u32 genctl; + struct ata_port_info *ppi; rc = pci_enable_device(pdev); if (rc) @@ -201,20 +213,13 @@ if (rc) goto err_out_regions; - probe_ent = kmalloc(sizeof(*probe_ent), GFP_KERNEL); + ppi = &sis_port_info; + probe_ent = ata_pci_init_native_mode(pdev, &ppi); if (!probe_ent) { rc = -ENOMEM; goto err_out_regions; } - memset(probe_ent, 0, sizeof(*probe_ent)); - probe_ent->pdev = pdev; - INIT_LIST_HEAD(&probe_ent->node); - - probe_ent->sht = &sis_sht; - probe_ent->host_flags = ATA_FLAG_SATA | ATA_FLAG_SATA_RESET | - ATA_FLAG_NO_LEGACY; - /* check and see if the SCRs are in IO space or PCI cfg space */ pci_read_config_dword(pdev, SIS_GENCTL, &genctl); if ((genctl & GENCTL_IOMAPPED_SCR) == 0) @@ -231,32 +236,12 @@ probe_ent->host_flags |= SIS_FLAG_CFGSCR; } - probe_ent->pio_mask = 0x1f; - probe_ent->mwdma_mask = 0x7; - probe_ent->udma_mask = 0x7f; - probe_ent->port_ops = &sis_ops; - - probe_ent->port[0].cmd_addr = pci_resource_start(pdev, 0); - ata_std_ports(&probe_ent->port[0]); - probe_ent->port[0].ctl_addr = - pci_resource_start(pdev, 1) | ATA_PCI_CTL_OFS; - probe_ent->port[0].bmdma_addr = pci_resource_start(pdev, 4); - if (!(probe_ent->host_flags & SIS_FLAG_CFGSCR)) + if (!(probe_ent->host_flags & SIS_FLAG_CFGSCR)) { probe_ent->port[0].scr_addr = pci_resource_start(pdev, SIS_SCR_PCI_BAR); - - probe_ent->port[1].cmd_addr = pci_resource_start(pdev, 2); - ata_std_ports(&probe_ent->port[1]); - probe_ent->port[1].ctl_addr = - pci_resource_start(pdev, 3) | ATA_PCI_CTL_OFS; - probe_ent->port[1].bmdma_addr = pci_resource_start(pdev, 4) + 8; - if (!(probe_ent->host_flags & SIS_FLAG_CFGSCR)) probe_ent->port[1].scr_addr = pci_resource_start(pdev, SIS_SCR_PCI_BAR) + 64; - - probe_ent->n_ports = 2; - probe_ent->irq = pdev->irq; - probe_ent->irq_flags = SA_SHIRQ; + } pci_set_master(pdev); pci_enable_intx(pdev); diff -Nru a/drivers/scsi/sata_svw.c b/drivers/scsi/sata_svw.c --- a/drivers/scsi/sata_svw.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/scsi/sata_svw.c 2004-09-26 10:25:56 -07:00 @@ -148,7 +148,73 @@ } } +/** + * k2_bmdma_setup_mmio - Set up PCI IDE BMDMA transaction (MMIO) + * @qc: Info associated with this ATA transaction. + * + * LOCKING: + * spin_lock_irqsave(host_set lock) + */ + +void k2_bmdma_setup_mmio (struct ata_queued_cmd *qc) +{ + struct ata_port *ap = qc->ap; + unsigned int rw = (qc->tf.flags & ATA_TFLAG_WRITE); + u8 dmactl; + void *mmio = (void *) ap->ioaddr.bmdma_addr; + /* load PRD table addr. */ + mb(); /* make sure PRD table writes are visible to controller */ + writel(ap->prd_dma, mmio + ATA_DMA_TABLE_OFS); + + /* specify data direction, triple-check start bit is clear */ + dmactl = readb(mmio + ATA_DMA_CMD); + dmactl &= ~(ATA_DMA_WR | ATA_DMA_START); + if (!rw) + dmactl |= ATA_DMA_WR; + writeb(dmactl, mmio + ATA_DMA_CMD); + + /* issue r/w command if this is not a ATA DMA command*/ + if (qc->tf.protocol != ATA_PROT_DMA) + ap->ops->exec_command(ap, &qc->tf); +} + +/** + * k2_bmdma_start_mmio - Start a PCI IDE BMDMA transaction (MMIO) + * @qc: Info associated with this ATA transaction. + * + * LOCKING: + * spin_lock_irqsave(host_set lock) + */ + +void k2_bmdma_start_mmio (struct ata_queued_cmd *qc) +{ + struct ata_port *ap = qc->ap; + void *mmio = (void *) ap->ioaddr.bmdma_addr; + u8 dmactl; + + /* start host DMA transaction */ + dmactl = readb(mmio + ATA_DMA_CMD); + writeb(dmactl | ATA_DMA_START, mmio + ATA_DMA_CMD); + /* There is a race condition in certain SATA controllers that can + be seen when the r/w command is given to the controller before the + host DMA is started. On a Read command, the controller would initiate + the command to the drive even before it sees the DMA start. When there + are very fast drives connected to the controller, or when the data request + hits in the drive cache, there is the possibility that the drive returns a part + or all of the requested data to the controller before the DMA start is issued. + In this case, the controller would become confused as to what to do with the data. + In the worst case when all the data is returned back to the controller, the + controller could hang. In other cases it could return partial data returning + in data corruption. This problem has been seen in PPC systems and can also appear + on an system with very fast disks, where the SATA controller is sitting behind a + number of bridges, and hence there is significant latency between the r/w command + and the start command. */ + /* issue r/w command if the access is to ATA*/ + if (qc->tf.protocol == ATA_PROT_DMA) + ap->ops->exec_command(ap, &qc->tf); +} + static u8 k2_stat_check_status(struct ata_port *ap) { return readl((void *) ap->ioaddr.status_addr); @@ -230,10 +296,11 @@ .tf_load = k2_sata_tf_load, .tf_read = k2_sata_tf_read, .check_status = k2_stat_check_status, - .exec_command = ata_exec_command_mmio, + .exec_command = ata_exec_command, + .dev_select = ata_std_dev_select, .phy_reset = sata_phy_reset, - .bmdma_setup = ata_bmdma_setup_mmio, - .bmdma_start = ata_bmdma_start_mmio, + .bmdma_setup = k2_bmdma_setup_mmio, + .bmdma_start = k2_bmdma_start_mmio, .qc_prep = ata_qc_prep, .qc_issue = ata_qc_issue_prot, .eng_timeout = ata_eng_timeout, @@ -373,6 +440,8 @@ static struct pci_device_id k2_sata_pci_tbl[] = { { 0x1166, 0x0240, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, + { 0x1166, 0x0241, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, + { 0x1166, 0x0242, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, { } }; diff -Nru a/drivers/scsi/sata_sx4.c b/drivers/scsi/sata_sx4.c --- a/drivers/scsi/sata_sx4.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/scsi/sata_sx4.c 2004-09-26 10:25:55 -07:00 @@ -193,9 +193,10 @@ static struct ata_port_operations pdc_20621_ops = { .port_disable = ata_port_disable, .tf_load = pdc_tf_load_mmio, - .tf_read = ata_tf_read_mmio, - .check_status = ata_check_status_mmio, + .tf_read = ata_tf_read, + .check_status = ata_check_status, .exec_command = pdc_exec_command_mmio, + .dev_select = ata_std_dev_select, .phy_reset = pdc_20621_phy_reset, .qc_prep = pdc20621_qc_prep, .qc_issue = pdc20621_qc_issue_prot, @@ -533,7 +534,7 @@ readl(dimm_mmio); /* MMIO PCI posting flush */ - VPRINTK("ata pkt buf ofs %u, prd size %u, mmio copied\n", i, sgt_len); + VPRINTK("ata pkt buf ofs %u, mmio copied\n", i); } static void pdc20621_qc_prep(struct ata_queued_cmd *qc) @@ -887,7 +888,7 @@ { WARN_ON (tf->protocol == ATA_PROT_DMA || tf->protocol == ATA_PROT_NODATA); - ata_tf_load_mmio(ap, tf); + ata_tf_load(ap, tf); } @@ -895,7 +896,7 @@ { WARN_ON (tf->protocol == ATA_PROT_DMA || tf->protocol == ATA_PROT_NODATA); - ata_exec_command_mmio(ap, tf); + ata_exec_command(ap, tf); } diff -Nru a/drivers/scsi/sata_via.c b/drivers/scsi/sata_via.c --- a/drivers/scsi/sata_via.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/scsi/sata_via.c 2004-09-26 10:25:55 -07:00 @@ -100,15 +100,16 @@ static struct ata_port_operations svia_sata_ops = { .port_disable = ata_port_disable, - .tf_load = ata_tf_load_pio, - .tf_read = ata_tf_read_pio, - .check_status = ata_check_status_pio, - .exec_command = ata_exec_command_pio, + .tf_load = ata_tf_load, + .tf_read = ata_tf_read, + .check_status = ata_check_status, + .exec_command = ata_exec_command, + .dev_select = ata_std_dev_select, .phy_reset = sata_phy_reset, - .bmdma_setup = ata_bmdma_setup_pio, - .bmdma_start = ata_bmdma_start_pio, + .bmdma_setup = ata_bmdma_setup, + .bmdma_start = ata_bmdma_start, .qc_prep = ata_qc_prep, .qc_issue = ata_qc_issue_prot, @@ -124,6 +125,15 @@ .port_stop = ata_port_stop, }; +static struct ata_port_info svia_port_info = { + .sht = &svia_sht, + .host_flags = ATA_FLAG_SATA | ATA_FLAG_SRST | ATA_FLAG_NO_LEGACY, + .pio_mask = 0x1f, + .mwdma_mask = 0x07, + .udma_mask = 0x7f, + .port_ops = &svia_sata_ops, +}; + MODULE_AUTHOR("Jeff Garzik"); MODULE_DESCRIPTION("SCSI low-level driver for VIA SATA controllers"); MODULE_LICENSE("GPL"); @@ -157,6 +167,7 @@ static int printed_version; unsigned int i; int rc; + struct ata_port_info *ppi; struct ata_probe_ent *probe_ent; u8 tmp8; @@ -197,42 +208,17 @@ if (rc) goto err_out_regions; - probe_ent = kmalloc(sizeof(*probe_ent), GFP_KERNEL); + ppi = &svia_port_info; + probe_ent = ata_pci_init_native_mode(pdev, &ppi); if (!probe_ent) { printk(KERN_ERR DRV_NAME "(%s): out of memory\n", pci_name(pdev)); rc = -ENOMEM; goto err_out_regions; } - memset(probe_ent, 0, sizeof(*probe_ent)); - INIT_LIST_HEAD(&probe_ent->node); - probe_ent->pdev = pdev; - probe_ent->sht = &svia_sht; - probe_ent->host_flags = ATA_FLAG_SATA | ATA_FLAG_SRST | - ATA_FLAG_NO_LEGACY; - probe_ent->port_ops = &svia_sata_ops; - probe_ent->n_ports = 2; - probe_ent->irq = pdev->irq; - probe_ent->irq_flags = SA_SHIRQ; - probe_ent->pio_mask = 0x1f; - probe_ent->mwdma_mask = 0x07; - probe_ent->udma_mask = 0x7f; - - probe_ent->port[0].cmd_addr = pci_resource_start(pdev, 0); - ata_std_ports(&probe_ent->port[0]); - probe_ent->port[0].altstatus_addr = - probe_ent->port[0].ctl_addr = - pci_resource_start(pdev, 1) | ATA_PCI_CTL_OFS; - probe_ent->port[0].bmdma_addr = pci_resource_start(pdev, 4); + probe_ent->port[0].scr_addr = svia_scr_addr(pci_resource_start(pdev, 5), 0); - - probe_ent->port[1].cmd_addr = pci_resource_start(pdev, 2); - ata_std_ports(&probe_ent->port[1]); - probe_ent->port[1].altstatus_addr = - probe_ent->port[1].ctl_addr = - pci_resource_start(pdev, 3) | ATA_PCI_CTL_OFS; - probe_ent->port[1].bmdma_addr = pci_resource_start(pdev, 4) + 8; probe_ent->port[1].scr_addr = svia_scr_addr(pci_resource_start(pdev, 5), 1); diff -Nru a/drivers/scsi/sata_vsc.c b/drivers/scsi/sata_vsc.c --- a/drivers/scsi/sata_vsc.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/scsi/sata_vsc.c 2004-09-26 10:25:56 -07:00 @@ -211,11 +211,12 @@ .port_disable = ata_port_disable, .tf_load = vsc_sata_tf_load, .tf_read = vsc_sata_tf_read, - .exec_command = ata_exec_command_mmio, - .check_status = ata_check_status_mmio, + .exec_command = ata_exec_command, + .check_status = ata_check_status, + .dev_select = ata_std_dev_select, .phy_reset = sata_phy_reset, - .bmdma_setup = ata_bmdma_setup_mmio, - .bmdma_start = ata_bmdma_start_mmio, + .bmdma_setup = ata_bmdma_setup, + .bmdma_start = ata_bmdma_start, .qc_prep = ata_qc_prep, .qc_issue = ata_qc_issue_prot, .eng_timeout = ata_eng_timeout, diff -Nru a/drivers/scsi/sym53c8xx_2/sym_glue.h b/drivers/scsi/sym53c8xx_2/sym_glue.h --- a/drivers/scsi/sym53c8xx_2/sym_glue.h 2004-09-26 10:25:57 -07:00 +++ b/drivers/scsi/sym53c8xx_2/sym_glue.h 2004-09-26 10:25:57 -07:00 @@ -288,32 +288,32 @@ * MEMORY mapped IO input / output */ -#define INB_OFF(o) readb((char *)np->s.mmio_va + sym_offb(o)) -#define OUTB_OFF(o, val) writeb((val), (char *)np->s.mmio_va + sym_offb(o)) +#define INB_OFF(o) readb(np->s.mmio_va + sym_offb(o)) +#define OUTB_OFF(o, val) writeb((val), np->s.mmio_va + sym_offb(o)) #if defined(__BIG_ENDIAN) && !defined(SYM_CONF_CHIP_BIG_ENDIAN) -#define INW_OFF(o) readw_l2b((char *)np->s.mmio_va + sym_offw(o)) -#define INL_OFF(o) readl_l2b((char *)np->s.mmio_va + (o)) +#define INW_OFF(o) readw_l2b(np->s.mmio_va + sym_offw(o)) +#define INL_OFF(o) readl_l2b(np->s.mmio_va + (o)) -#define OUTW_OFF(o, val) writew_b2l((val), (char *)np->s.mmio_va + sym_offw(o)) -#define OUTL_OFF(o, val) writel_b2l((val), (char *)np->s.mmio_va + (o)) +#define OUTW_OFF(o, val) writew_b2l((val), np->s.mmio_va + sym_offw(o)) +#define OUTL_OFF(o, val) writel_b2l((val), np->s.mmio_va + (o)) #elif defined(__LITTLE_ENDIAN) && defined(SYM_CONF_CHIP_BIG_ENDIAN) -#define INW_OFF(o) readw_b2l((char *)np->s.mmio_va + sym_offw(o)) -#define INL_OFF(o) readl_b2l((char *)np->s.mmio_va + (o)) +#define INW_OFF(o) readw_b2l(np->s.mmio_va + sym_offw(o)) +#define INL_OFF(o) readl_b2l(np->s.mmio_va + (o)) -#define OUTW_OFF(o, val) writew_l2b((val), (char *)np->s.mmio_va + sym_offw(o)) -#define OUTL_OFF(o, val) writel_l2b((val), (char *)np->s.mmio_va + (o)) +#define OUTW_OFF(o, val) writew_l2b((val), np->s.mmio_va + sym_offw(o)) +#define OUTL_OFF(o, val) writel_l2b((val), np->s.mmio_va + (o)) #else -#define INW_OFF(o) readw_raw((char *)np->s.mmio_va + sym_offw(o)) -#define INL_OFF(o) readl_raw((char *)np->s.mmio_va + (o)) +#define INW_OFF(o) readw_raw(np->s.mmio_va + sym_offw(o)) +#define INL_OFF(o) readl_raw(np->s.mmio_va + (o)) -#define OUTW_OFF(o, val) writew_raw((val), (char *)np->s.mmio_va + sym_offw(o)) -#define OUTL_OFF(o, val) writel_raw((val), (char *)np->s.mmio_va + (o)) +#define OUTW_OFF(o, val) writew_raw((val), np->s.mmio_va + sym_offw(o)) +#define OUTL_OFF(o, val) writel_raw((val), np->s.mmio_va + (o)) #endif @@ -390,8 +390,8 @@ struct Scsi_Host *host; - void * mmio_va; /* MMIO kernel virtual address */ - void * ram_va; /* RAM kernel virtual address */ + void __iomem * mmio_va; /* MMIO kernel virtual address */ + void __iomem * ram_va; /* RAM kernel virtual address */ u_long io_port; /* IO port address cookie */ u_short io_ws; /* IO window size */ int irq; /* IRQ number */ @@ -423,7 +423,7 @@ int irq; /* port and address fields to fit INB, OUTB macros */ u_long io_port; - void * mmio_va; + void __iomem * mmio_va; char inst_name[16]; }; diff -Nru a/drivers/serial/8250.c b/drivers/serial/8250.c --- a/drivers/serial/8250.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/serial/8250.c 2004-09-26 10:25:55 -07:00 @@ -188,6 +188,9 @@ case UPIO_MEM: return readb(up->port.membase + offset); + case UPIO_MEM32: + return readl(up->port.membase + offset); + default: return inb(up->port.iobase + offset); } @@ -206,6 +209,10 @@ case UPIO_MEM: writeb(value, up->port.membase + offset); + break; + + case UPIO_MEM32: + writel(value, up->port.membase + offset); break; default: diff -Nru a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c --- a/drivers/serial/serial_core.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/serial/serial_core.c 2004-09-26 10:25:55 -07:00 @@ -1978,6 +1978,7 @@ printk("I/O 0x%x offset 0x%x", port->iobase, port->hub6); break; case UPIO_MEM: + case UPIO_MEM32: printk("MMIO 0x%lx", port->mapbase); break; } diff -Nru a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c --- a/drivers/serial/serial_cs.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/serial/serial_cs.c 2004-09-26 10:25:56 -07:00 @@ -363,9 +363,10 @@ /*====================================================================*/ -static int simple_config(dev_link_t * link) +static int simple_config(dev_link_t *link) { static ioaddr_t base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; + static int size_table[2] = { 8, 16 }; client_handle_t handle = link->handle; struct serial_info *info = link->priv; tuple_t tuple; @@ -374,6 +375,7 @@ cistpl_cftable_entry_t *cf = &parse.cftable_entry; config_info_t config; int i, j, try; + int s; /* If the card is already configured, look up the port and irq */ i = pcmcia_get_configuration_info(handle, &config); @@ -399,29 +401,30 @@ tuple.Attributes = 0; tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; /* Two tries: without IO aliases, then with aliases */ - for (try = 0; try < 2; try++) { - i = first_tuple(handle, &tuple, &parse); - while (i != CS_NO_MORE_ITEMS) { - if (i != CS_SUCCESS) - goto next_entry; - if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM)) - link->conf.Vpp1 = link->conf.Vpp2 = - cf->vpp1.param[CISTPL_POWER_VNOM] / 10000; - if ((cf->io.nwin > 0) && (cf->io.win[0].len == 8) && - (cf->io.win[0].base != 0)) { - link->conf.ConfigIndex = cf->index; - link->io.BasePort1 = cf->io.win[0].base; - link->io.IOAddrLines = (try == 0) ? - 16 : cf->io.flags & CISTPL_IO_LINES_MASK; - i = pcmcia_request_io(link->handle, &link->io); - if (i == CS_SUCCESS) - goto found_port; + for (s = 0; s < 2; s++) { + for (try = 0; try < 2; try++) { + i = first_tuple(handle, &tuple, &parse); + while (i != CS_NO_MORE_ITEMS) { + if (i != CS_SUCCESS) + goto next_entry; + if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM)) + link->conf.Vpp1 = link->conf.Vpp2 = + cf->vpp1.param[CISTPL_POWER_VNOM] / 10000; + if ((cf->io.nwin > 0) && (cf->io.win[0].len == size_table[s]) && + (cf->io.win[0].base != 0)) { + link->conf.ConfigIndex = cf->index; + link->io.BasePort1 = cf->io.win[0].base; + link->io.IOAddrLines = (try == 0) ? + 16 : cf->io.flags & CISTPL_IO_LINES_MASK; + i = pcmcia_request_io(link->handle, &link->io); + if (i == CS_SUCCESS) + goto found_port; + } +next_entry: + i = next_tuple(handle, &tuple, &parse); } - next_entry: - i = next_tuple(handle, &tuple, &parse); } } - /* Second pass: try to find an entry that isn't picky about its base address, then try to grab any standard serial port address, and finally try to get any free port. */ diff -Nru a/drivers/serial/sn_console.c b/drivers/serial/sn_console.c --- a/drivers/serial/sn_console.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/serial/sn_console.c 2004-09-26 10:25:56 -07:00 @@ -596,10 +596,15 @@ sysrq_requested = jiffies; sysrq_serial_ptr = sysrq_serial_str; } - continue; /* ignore the whole sysrq string */ + /* + * ignore the whole sysrq string except for the + * leading escape + */ + if (ch != '\e') + continue; } else - sysrq_serial_ptr = sysrq_serial_str; + sysrq_serial_ptr = sysrq_serial_str; #endif /* CONFIG_MAGIC_SYSRQ */ /* record the character to pass up to the tty layer */ @@ -610,8 +615,6 @@ tty->flip.count++; if (tty->flip.count == TTY_FLIPBUF_SIZE) break; - } - else { } port->sc_port.icount.rx++; } diff -Nru a/drivers/serial/sunsu.c b/drivers/serial/sunsu.c --- a/drivers/serial/sunsu.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/serial/sunsu.c 2004-09-26 10:25:55 -07:00 @@ -98,7 +98,7 @@ unsigned int irq; #ifdef CONFIG_SERIO - struct serio serio; + struct serio *serio; int serio_open; #endif }; @@ -520,7 +520,7 @@ /* Stop-A is handled by drivers/char/keyboard.c now. */ if (up->su_type == SU_PORT_KBD) { #ifdef CONFIG_SERIO - serio_interrupt(&up->serio, ch, 0, regs); + serio_interrupt(up->serio, ch, 0, regs); #endif } else if (up->su_type == SU_PORT_MS) { int ret = suncore_mouse_baud_detection(ch, is_break); @@ -534,7 +534,7 @@ case 0: #ifdef CONFIG_SERIO - serio_interrupt(&up->serio, ch, 0, regs); + serio_interrupt(up->serio, ch, 0, regs); #endif break; }; @@ -994,7 +994,7 @@ static int sunsu_serio_write(struct serio *serio, unsigned char ch) { - struct uart_sunsu_port *up = serio->driver; + struct uart_sunsu_port *up = serio->port_data; unsigned long flags; int lsr; @@ -1014,7 +1014,7 @@ static int sunsu_serio_open(struct serio *serio) { - struct uart_sunsu_port *up = serio->driver; + struct uart_sunsu_port *up = serio->port_data; unsigned long flags; int ret; @@ -1031,7 +1031,7 @@ static void sunsu_serio_close(struct serio *serio) { - struct uart_sunsu_port *up = serio->driver; + struct uart_sunsu_port *up = serio->port_data; unsigned long flags; spin_lock_irqsave(&sunsu_serio_lock, flags); @@ -1284,54 +1284,58 @@ .major = TTY_MAJOR, }; -static int __init sunsu_kbd_ms_init(void) +static int __init sunsu_kbd_ms_init(struct uart_sunsu_port *up, int channel) { - struct uart_sunsu_port *up; - int i; + struct serio *serio; - for (i = 0, up = sunsu_ports; i < 2; i++, up++) { - up->port.line = i; - up->port.type = PORT_UNKNOWN; - up->port.uartclk = (SU_BASE_BAUD * 16); + up->port.line = channel; + up->port.type = PORT_UNKNOWN; + up->port.uartclk = (SU_BASE_BAUD * 16); - if (up->su_type == SU_PORT_KBD) - up->cflag = B1200 | CS8 | CLOCAL | CREAD; - else - up->cflag = B4800 | CS8 | CLOCAL | CREAD; + if (up->su_type == SU_PORT_KBD) + up->cflag = B1200 | CS8 | CLOCAL | CREAD; + else + up->cflag = B4800 | CS8 | CLOCAL | CREAD; - sunsu_autoconfig(up); - if (up->port.type == PORT_UNKNOWN) - continue; + sunsu_autoconfig(up); + if (up->port.type == PORT_UNKNOWN) + return -1; - printk(KERN_INFO "su%d at 0x%p (irq = %s) is a %s\n", - i, - up->port.membase, __irq_itoa(up->irq), - sunsu_type(&up->port)); + printk(KERN_INFO "su%d at 0x%p (irq = %s) is a %s\n", + channel, + up->port.membase, __irq_itoa(up->irq), + sunsu_type(&up->port)); #ifdef CONFIG_SERIO - memset(&up->serio, 0, sizeof(up->serio)); + up->serio = serio = kmalloc(sizeof(struct serio), GFP_KERNEL); + if (serio) { + memset(serio, 0, sizeof(*serio)); - up->serio.driver = up; + serio->port_data = up; - up->serio.type = SERIO_RS232; + serio->type = SERIO_RS232; if (up->su_type == SU_PORT_KBD) { - up->serio.type |= SERIO_SUNKBD; - up->serio.name = "sukbd"; + serio->type |= SERIO_SUNKBD; + strlcpy(serio->name, "sukbd", sizeof(serio->name)); } else { - up->serio.type |= (SERIO_SUN | (1 << 16)); - up->serio.name = "sums"; + serio->type |= (SERIO_SUN | (1 << 16)); + strlcpy(serio->name, "sums", sizeof(serio->name)); } - up->serio.phys = (i == 0 ? "su/serio0" : "su/serio1"); + strlcpy(serio->phys, (channel == 0 ? "su/serio0" : "su/serio1"), + sizeof(serio->phys)); - up->serio.write = sunsu_serio_write; - up->serio.open = sunsu_serio_open; - up->serio.close = sunsu_serio_close; + serio->write = sunsu_serio_write; + serio->open = sunsu_serio_open; + serio->close = sunsu_serio_close; - serio_register_port(&up->serio); + serio_register_port(serio); + } else { + printk(KERN_WARNING "su%d: not enough memory for serio port\n", + channel); + } #endif - sunsu_startup(&up->port); - } + sunsu_startup(&up->port); return 0; } @@ -1680,10 +1684,12 @@ if (scan.msx != -1 && scan.kbx != -1) { sunsu_ports[0].su_type = SU_PORT_MS; sunsu_ports[0].port_node = scan.msnode; + sunsu_kbd_ms_init(&sunsu_ports[0], 0); + sunsu_ports[1].su_type = SU_PORT_KBD; sunsu_ports[1].port_node = scan.kbnode; + sunsu_kbd_ms_init(&sunsu_ports[1], 1); - sunsu_kbd_ms_init(); return 0; } @@ -1715,7 +1721,10 @@ if (up->su_type == SU_PORT_MS || up->su_type == SU_PORT_KBD) { #ifdef CONFIG_SERIO - serio_unregister_port(&up->serio); + if (up->serio) { + serio_unregister_port(up->serio); + up->serio = NULL; + } #endif } else if (up->port.type != PORT_UNKNOWN) { uart_remove_one_port(&sunsu_reg, &up->port); diff -Nru a/drivers/serial/sunzilog.c b/drivers/serial/sunzilog.c --- a/drivers/serial/sunzilog.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/serial/sunzilog.c 2004-09-26 10:25:57 -07:00 @@ -107,7 +107,7 @@ unsigned char prev_status; #ifdef CONFIG_SERIO - struct serio serio; + struct serio *serio; int serio_open; #endif }; @@ -291,7 +291,7 @@ /* Stop-A is handled by drivers/char/keyboard.c now. */ #ifdef CONFIG_SERIO if (up->serio_open) - serio_interrupt(&up->serio, ch, 0, regs); + serio_interrupt(up->serio, ch, 0, regs); #endif } else if (ZS_IS_MOUSE(up)) { int ret = suncore_mouse_baud_detection(ch, is_break); @@ -306,7 +306,7 @@ case 0: #ifdef CONFIG_SERIO if (up->serio_open) - serio_interrupt(&up->serio, ch, 0, regs); + serio_interrupt(up->serio, ch, 0, regs); #endif break; }; @@ -1295,7 +1295,7 @@ static int sunzilog_serio_write(struct serio *serio, unsigned char ch) { - struct uart_sunzilog_port *up = serio->driver; + struct uart_sunzilog_port *up = serio->port_data; unsigned long flags; spin_lock_irqsave(&sunzilog_serio_lock, flags); @@ -1309,7 +1309,7 @@ static int sunzilog_serio_open(struct serio *serio) { - struct uart_sunzilog_port *up = serio->driver; + struct uart_sunzilog_port *up = serio->port_data; unsigned long flags; int ret; @@ -1326,7 +1326,7 @@ static void sunzilog_serio_close(struct serio *serio) { - struct uart_sunzilog_port *up = serio->driver; + struct uart_sunzilog_port *up = serio->port_data; unsigned long flags; spin_lock_irqsave(&sunzilog_serio_lock, flags); @@ -1545,33 +1545,44 @@ up->curregs[R15] = BRKIE; brg = BPS_TO_BRG(baud, ZS_CLOCK / ZS_CLOCK_DIVISOR); sunzilog_convert_to_zs(up, up->cflag, 0, brg); + sunzilog_set_mctrl(&up->port, TIOCM_DTR | TIOCM_RTS); + __sunzilog_startup(up); +} #ifdef CONFIG_SERIO - memset(&up->serio, 0, sizeof(up->serio)); +static void __init sunzilog_register_serio(struct uart_sunzilog_port *up, int channel) +{ + struct serio *serio; - up->serio.driver = up; + up->serio = serio = kmalloc(sizeof(struct serio), GFP_KERNEL); + if (serio) { + memset(serio, 0, sizeof(*serio)); - up->serio.type = SERIO_RS232; - if (channel == KEYBOARD_LINE) { - up->serio.type |= SERIO_SUNKBD; - up->serio.name = "zskbd"; - } else { - up->serio.type |= (SERIO_SUN | (1 << 16)); - up->serio.name = "zsms"; - } - up->serio.phys = (channel == KEYBOARD_LINE ? - "zs/serio0" : "zs/serio1"); + serio->port_data = up; - up->serio.write = sunzilog_serio_write; - up->serio.open = sunzilog_serio_open; - up->serio.close = sunzilog_serio_close; - - serio_register_port(&up->serio); -#endif + serio->type = SERIO_RS232; + if (channel == KEYBOARD_LINE) { + serio->type |= SERIO_SUNKBD; + strlcpy(serio->name, "zskbd", sizeof(serio->name)); + } else { + serio->type |= (SERIO_SUN | (1 << 16)); + strlcpy(serio->name, "zsms", sizeof(serio->name)); + } + strlcpy(serio->phys, + (channel == KEYBOARD_LINE ? "zs/serio0" : "zs/serio1"), + sizeof(serio->phys)); + + serio->write = sunzilog_serio_write; + serio->open = sunzilog_serio_open; + serio->close = sunzilog_serio_close; - sunzilog_set_mctrl(&up->port, TIOCM_DTR | TIOCM_RTS); - __sunzilog_startup(up); + serio_register_port(serio); + } else { + printk(KERN_WARNING "zs%d: not enough memory for serio port\n", + channel); + } } +#endif static void __init sunzilog_init_hw(void) { @@ -1615,6 +1626,11 @@ } spin_unlock_irqrestore(&up->port.lock, flags); + +#ifdef CONFIG_SERIO + if (i == KEYBOARD_LINE || i == MOUSE_LINE) + sunzilog_register_serio(up, i); +#endif } } @@ -1732,10 +1748,15 @@ for (i = 0; i < NUM_CHANNELS; i++) { struct uart_sunzilog_port *up = &sunzilog_port_table[i]; - if (ZS_IS_KEYB(up) || ZS_IS_MOUSE(up)) - continue; - - uart_remove_one_port(&sunzilog_reg, &up->port); + if (ZS_IS_KEYB(up) || ZS_IS_MOUSE(up)) { +#ifdef CONFIG_SERIO + if (up->serio) { + serio_unregister_port(up->serio); + up->serio = NULL; + } +#endif + } else + uart_remove_one_port(&sunzilog_reg, &up->port); } uart_unregister_driver(&sunzilog_reg); diff -Nru a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c --- a/drivers/usb/core/hcd-pci.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/usb/core/hcd-pci.c 2004-09-26 10:25:56 -07:00 @@ -65,7 +65,7 @@ { struct hc_driver *driver; unsigned long resource, len; - void *base; + void __iomem *base; struct usb_hcd *hcd; int retval, region; char buf [8], *bufp = buf; @@ -121,7 +121,7 @@ dev_dbg (&dev->dev, "no i/o regions available\n"); return -EBUSY; } - base = (void *) resource; + base = (void __iomem *) resource; } // driver->reset(), later on, will transfer device from diff -Nru a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h --- a/drivers/usb/core/hcd.h 2004-09-26 10:25:56 -07:00 +++ b/drivers/usb/core/hcd.h 2004-09-26 10:25:56 -07:00 @@ -77,7 +77,7 @@ unsigned can_wakeup:1; /* hw supports wakeup? */ unsigned remote_wakeup:1;/* sw should use wakeup? */ int irq; /* irq allocated */ - void *regs; /* device memory/io */ + void __iomem *regs; /* device memory/io */ #ifdef CONFIG_PCI int region; /* pci region for regs */ diff -Nru a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c --- a/drivers/usb/gadget/net2280.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/usb/gadget/net2280.c 2004-09-26 10:25:55 -07:00 @@ -253,7 +253,7 @@ return 0; } -static int handshake (u32 *ptr, u32 mask, u32 done, int usec) +static int handshake (u32 __iomem *ptr, u32 mask, u32 done, int usec) { u32 result; @@ -272,7 +272,7 @@ static struct usb_ep_ops net2280_ep_ops; -static void ep_reset (struct net2280_regs *regs, struct net2280_ep *ep) +static void ep_reset (struct net2280_regs __iomem *regs, struct net2280_ep *ep) { u32 tmp; @@ -512,7 +512,7 @@ static void write_fifo (struct net2280_ep *ep, struct usb_request *req) { - struct net2280_ep_regs *regs = ep->regs; + struct net2280_ep_regs __iomem *regs = ep->regs; u8 *buf; u32 tmp; unsigned count, total; @@ -572,7 +572,8 @@ */ static void out_flush (struct net2280_ep *ep) { - u32 *statp, tmp; + u32 __iomem *statp; + u32 tmp; ASSERT_OUT_NAKING (ep); @@ -605,7 +606,7 @@ static int read_fifo (struct net2280_ep *ep, struct net2280_request *req) { - struct net2280_ep_regs *regs = ep->regs; + struct net2280_ep_regs __iomem *regs = ep->regs; u8 *buf = req->req.buf + req->req.actual; unsigned count, tmp, is_short; unsigned cleanup = 0, prevent = 0; @@ -732,12 +733,12 @@ /* erratum 0116 workaround part 2 (no AUTOSTART) */ | (1 << DMA_ENABLE); -static inline void spin_stop_dma (struct net2280_dma_regs *dma) +static inline void spin_stop_dma (struct net2280_dma_regs __iomem *dma) { handshake (&dma->dmactl, (1 << DMA_ENABLE), 0, 50); } -static inline void stop_dma (struct net2280_dma_regs *dma) +static inline void stop_dma (struct net2280_dma_regs __iomem *dma) { writel (readl (&dma->dmactl) & ~(1 << DMA_ENABLE), &dma->dmactl); spin_stop_dma (dma); @@ -745,7 +746,7 @@ static void start_queue (struct net2280_ep *ep, u32 dmactl, u32 td_dma) { - struct net2280_dma_regs *dma = ep->dma; + struct net2280_dma_regs __iomem *dma = ep->dma; writel ((1 << VALID_BIT) | (ep->is_in << DMA_DIRECTION), &dma->dmacount); @@ -766,7 +767,7 @@ static void start_dma (struct net2280_ep *ep, struct net2280_request *req) { u32 tmp; - struct net2280_dma_regs *dma = ep->dma; + struct net2280_dma_regs __iomem *dma = ep->dma; /* FIXME can't use DMA for ZLPs */ @@ -2579,7 +2580,7 @@ stat &= ~DMA_INTERRUPTS; scratch >>= 9; for (num = 0; scratch; num++) { - struct net2280_dma_regs *dma; + struct net2280_dma_regs __iomem *dma; tmp = 1 << num; if ((tmp & scratch) == 0) @@ -2748,7 +2749,7 @@ { struct net2280 *dev; unsigned long resource, len; - void *base = NULL; + void __iomem *base = NULL; int retval, i; char buf [8], *bufp; @@ -2806,12 +2807,12 @@ retval = -EFAULT; goto done; } - dev->regs = (struct net2280_regs *) base; - dev->usb = (struct net2280_usb_regs *) (base + 0x0080); - dev->pci = (struct net2280_pci_regs *) (base + 0x0100); - dev->dma = (struct net2280_dma_regs *) (base + 0x0180); - dev->dep = (struct net2280_dep_regs *) (base + 0x0200); - dev->epregs = (struct net2280_ep_regs *) (base + 0x0300); + dev->regs = (struct net2280_regs __iomem *) base; + dev->usb = (struct net2280_usb_regs __iomem *) (base + 0x0080); + dev->pci = (struct net2280_pci_regs __iomem *) (base + 0x0100); + dev->dma = (struct net2280_dma_regs __iomem *) (base + 0x0180); + dev->dep = (struct net2280_dep_regs __iomem *) (base + 0x0200); + dev->epregs = (struct net2280_ep_regs __iomem *) (base + 0x0300); /* put into initial config, link up all endpoints */ writel (0, &dev->usb->usbctl); diff -Nru a/drivers/usb/gadget/net2280.h b/drivers/usb/gadget/net2280.h --- a/drivers/usb/gadget/net2280.h 2004-09-26 10:25:57 -07:00 +++ b/drivers/usb/gadget/net2280.h 2004-09-26 10:25:57 -07:00 @@ -446,7 +446,7 @@ */ static inline u32 -get_idx_reg (struct net2280_regs *regs, u32 index) +get_idx_reg (struct net2280_regs __iomem *regs, u32 index) { writel (index, ®s->idxaddr); /* NOTE: synchs device/cpu memory views */ @@ -454,7 +454,7 @@ } static inline void -set_idx_reg (struct net2280_regs *regs, u32 index, u32 value) +set_idx_reg (struct net2280_regs __iomem *regs, u32 index, u32 value) { writel (index, ®s->idxaddr); writel (value, ®s->idxdata); @@ -507,8 +507,8 @@ struct net2280_ep { struct usb_ep ep; - struct net2280_ep_regs *regs; - struct net2280_dma_regs *dma; + struct net2280_ep_regs __iomem *regs; + struct net2280_dma_regs __iomem *dma; struct net2280_dma *dummy; dma_addr_t td_dma; /* of dummy */ struct net2280 *dev; @@ -539,7 +539,7 @@ /* count (<= 4) bytes in the next fifo write will be valid */ static inline void set_fifo_bytecount (struct net2280_ep *ep, unsigned count) { - writeb (count, 2 + (u8 *) &ep->regs->ep_cfg); + writeb (count, 2 + (u8 __iomem *) &ep->regs->ep_cfg); } struct net2280_request { @@ -566,12 +566,12 @@ /* pci state used to access those endpoints */ struct pci_dev *pdev; - struct net2280_regs *regs; - struct net2280_usb_regs *usb; - struct net2280_pci_regs *pci; - struct net2280_dma_regs *dma; - struct net2280_dep_regs *dep; - struct net2280_ep_regs *epregs; + struct net2280_regs __iomem *regs; + struct net2280_usb_regs __iomem *usb; + struct net2280_pci_regs __iomem *pci; + struct net2280_dma_regs __iomem *dma; + struct net2280_dep_regs __iomem *dep; + struct net2280_ep_regs __iomem *epregs; struct pci_pool *requests; // statistics... diff -Nru a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c --- a/drivers/usb/host/ehci-hcd.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/usb/host/ehci-hcd.c 2004-09-26 10:25:56 -07:00 @@ -155,7 +155,7 @@ * before driver shutdown. But it also seems to be caused by bugs in cardbus * bridge shutdown: shutting down the bridge before the devices using it. */ -static int handshake (u32 *ptr, u32 mask, u32 done, int usec) +static int handshake (u32 __iomem *ptr, u32 mask, u32 done, int usec) { u32 result; @@ -340,8 +340,8 @@ spin_lock_init (&ehci->lock); - ehci->caps = (struct ehci_caps *) hcd->regs; - ehci->regs = (struct ehci_regs *) (hcd->regs + + ehci->caps = hcd->regs; + ehci->regs = (hcd->regs + HC_LENGTH (readl (&ehci->caps->hc_capbase))); dbg_hcs_params (ehci, "reset"); dbg_hcc_params (ehci, "reset"); diff -Nru a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h --- a/drivers/usb/host/ehci.h 2004-09-26 10:25:57 -07:00 +++ b/drivers/usb/host/ehci.h 2004-09-26 10:25:57 -07:00 @@ -70,8 +70,8 @@ /* glue to PCI and HCD framework */ struct usb_hcd hcd; - struct ehci_caps *caps; - struct ehci_regs *regs; + struct ehci_caps __iomem *caps; + struct ehci_regs __iomem *regs; u32 hcs_params; /* cached register copy */ /* per-HC memory pools (could be per-bus, but ...) */ diff -Nru a/drivers/usb/host/ohci-dbg.c b/drivers/usb/host/ohci-dbg.c --- a/drivers/usb/host/ohci-dbg.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/usb/host/ohci-dbg.c 2004-09-26 10:25:57 -07:00 @@ -131,7 +131,7 @@ static void ohci_dump_status (struct ohci_hcd *controller, char **next, unsigned *size) { - struct ohci_regs *regs = controller->regs; + struct ohci_regs __iomem *regs = controller->regs; u32 temp; temp = ohci_readl (®s->revision) & 0xff; @@ -599,7 +599,7 @@ struct usb_bus *bus; struct usb_hcd *hcd; struct ohci_hcd *ohci; - struct ohci_regs *regs; + struct ohci_regs __iomem *regs; unsigned long flags; unsigned temp, size; char *next; diff -Nru a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c --- a/drivers/usb/host/ohci-hcd.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/usb/host/ohci-hcd.c 2004-09-26 10:25:55 -07:00 @@ -594,7 +594,7 @@ static irqreturn_t ohci_irq (struct usb_hcd *hcd, struct pt_regs *ptregs) { struct ohci_hcd *ohci = hcd_to_ohci (hcd); - struct ohci_regs *regs = ohci->regs; + struct ohci_regs __iomem *regs = ohci->regs; int ints; /* we can eliminate a (slow) ohci_readl() diff -Nru a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c --- a/drivers/usb/host/ohci-hub.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/usb/host/ohci-hub.c 2004-09-26 10:25:55 -07:00 @@ -487,7 +487,7 @@ /* called from some task, normally khubd */ static inline void root_port_reset (struct ohci_hcd *ohci, unsigned port) { - u32 *portstat = &ohci->regs->roothub.portstatus [port]; + u32 __iomem *portstat = &ohci->regs->roothub.portstatus [port]; u32 temp; u16 now = readl(&ohci->regs->fmnumber); u16 reset_done = now + PORT_RESET_MSEC; diff -Nru a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h --- a/drivers/usb/host/ohci.h 2004-09-26 10:25:57 -07:00 +++ b/drivers/usb/host/ohci.h 2004-09-26 10:25:57 -07:00 @@ -343,7 +343,7 @@ /* * I/O memory used to communicate with the HC (dma-consistent) */ - struct ohci_regs *regs; + struct ohci_regs __iomem *regs; /* * main memory used to communicate with the HC (dma-consistent). @@ -450,7 +450,7 @@ #else /* Standard version of ohci_readl uses standard, platform * specific implementation. */ -static inline unsigned int ohci_readl (void* regs) +static inline unsigned int ohci_readl (void __iomem * regs) { return readl (regs); } diff -Nru a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c --- a/drivers/usb/input/hid-core.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/usb/input/hid-core.c 2004-09-26 10:25:56 -07:00 @@ -219,17 +219,13 @@ dbg("logical range invalid %d %d", parser->global.logical_minimum, parser->global.logical_maximum); return -1; } - usages = parser->local.usage_index; + + if (!(usages = max_t(int, parser->local.usage_index, parser->global.report_count))) + return 0; /* Ignore padding fields */ offset = report->size; report->size += parser->global.report_size * parser->global.report_count; - if (usages < parser->global.report_count) - usages = parser->global.report_count; - - if (usages == 0) - return 0; /* ignore padding fields */ - if ((field = hid_register_field(report, usages, parser->global.report_count)) == NULL) return 0; @@ -923,20 +919,20 @@ int status; switch (urb->status) { - case 0: /* success */ - hid_input_report(HID_INPUT_REPORT, urb, regs); - break; - case -ECONNRESET: /* unlink */ - case -ENOENT: - case -ESHUTDOWN: - return; - default: /* error */ - dbg("nonzero status in input irq %d", urb->status); + case 0: /* success */ + hid_input_report(HID_INPUT_REPORT, urb, regs); + break; + case -ECONNRESET: /* unlink */ + case -ENOENT: + case -ESHUTDOWN: + return; + default: /* error */ + warn("input irq status %d received", urb->status); } - status = usb_submit_urb (urb, SLAB_ATOMIC); + status = usb_submit_urb(urb, SLAB_ATOMIC); if (status) - err ("can't resubmit intr, %s-%s/input%d, status %d", + err("can't resubmit intr, %s-%s/input%d, status %d", hid->dev->bus->bus_name, hid->dev->devpath, hid->ifnum, status); } @@ -1137,23 +1133,31 @@ struct hid_device *hid = urb->context; unsigned long flags; - if (urb->status) - warn("output irq status %d received", urb->status); + switch (urb->status) { + case 0: /* success */ + case -ECONNRESET: /* unlink */ + case -ENOENT: + case -ESHUTDOWN: + break; + default: /* error */ + warn("output irq status %d received", urb->status); + } spin_lock_irqsave(&hid->outlock, flags); hid->outtail = (hid->outtail + 1) & (HID_OUTPUT_FIFO_SIZE - 1); if (hid->outhead != hid->outtail) { - hid_submit_out(hid); + if (hid_submit_out(hid)) { + clear_bit(HID_OUT_RUNNING, &hid->iofl);; + wake_up(&hid->wait); + } spin_unlock_irqrestore(&hid->outlock, flags); return; } clear_bit(HID_OUT_RUNNING, &hid->iofl); - spin_unlock_irqrestore(&hid->outlock, flags); - wake_up(&hid->wait); } @@ -1166,26 +1170,34 @@ struct hid_device *hid = urb->context; unsigned long flags; - if (urb->status) - warn("ctrl urb status %d received", urb->status); - spin_lock_irqsave(&hid->ctrllock, flags); - if (hid->ctrl[hid->ctrltail].dir == USB_DIR_IN) - hid_input_report(hid->ctrl[hid->ctrltail].report->type, urb, regs); + switch (urb->status) { + case 0: /* success */ + if (hid->ctrl[hid->ctrltail].dir == USB_DIR_IN) + hid_input_report(hid->ctrl[hid->ctrltail].report->type, urb, regs); + case -ECONNRESET: /* unlink */ + case -ENOENT: + case -ESHUTDOWN: + case -EPIPE: /* report not available */ + break; + default: /* error */ + warn("ctrl urb status %d received", urb->status); + } hid->ctrltail = (hid->ctrltail + 1) & (HID_CONTROL_FIFO_SIZE - 1); if (hid->ctrlhead != hid->ctrltail) { - hid_submit_ctrl(hid); + if (hid_submit_ctrl(hid)) { + clear_bit(HID_CTRL_RUNNING, &hid->iofl); + wake_up(&hid->wait); + } spin_unlock_irqrestore(&hid->ctrllock, flags); return; } clear_bit(HID_CTRL_RUNNING, &hid->iofl); - spin_unlock_irqrestore(&hid->ctrllock, flags); - wake_up(&hid->wait); } @@ -1211,7 +1223,8 @@ hid->outhead = head; if (!test_and_set_bit(HID_OUT_RUNNING, &hid->iofl)) - hid_submit_out(hid); + if (hid_submit_out(hid)) + clear_bit(HID_OUT_RUNNING, &hid->iofl); spin_unlock_irqrestore(&hid->outlock, flags); return; @@ -1230,7 +1243,8 @@ hid->ctrlhead = head; if (!test_and_set_bit(HID_CTRL_RUNNING, &hid->iofl)) - hid_submit_ctrl(hid); + if (hid_submit_ctrl(hid)) + clear_bit(HID_CTRL_RUNNING, &hid->iofl); spin_unlock_irqrestore(&hid->ctrllock, flags); } @@ -1282,7 +1296,7 @@ void hid_close(struct hid_device *hid) { if (!--hid->open) - usb_unlink_urb(hid->urbin); + usb_kill_urb(hid->urbin); } /* @@ -1439,6 +1453,11 @@ #define USB_DEVICE_ID_1_PHIDGETSERVO_20 0x8101 #define USB_DEVICE_ID_4_PHIDGETSERVO_20 0x8104 +#define USB_VENDOR_ID_CODEMERCS 0x07c0 +#define USB_DEVICE_ID_CODEMERCS_IOW40 0x1500 +#define USB_DEVICE_ID_CODEMERCS_IOW24 0x1501 + + static struct hid_blacklist { __u16 idVendor; __u16 idProduct; @@ -1453,20 +1472,20 @@ { USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_23, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_24, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_BERKSHIRE, USB_DEVICE_ID_BERKSHIRE_PCWD, HID_QUIRK_IGNORE }, + { USB_VENDOR_ID_CODEMERCS, USB_DEVICE_ID_CODEMERCS_IOW40, HID_QUIRK_IGNORE }, + { USB_VENDOR_ID_CODEMERCS, USB_DEVICE_ID_CODEMERCS_IOW24, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_ESSENTIAL_REALITY, USB_DEVICE_ID_ESSENTIAL_REALITY_P5, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_KBGEAR, USB_DEVICE_ID_KBGEAR_JAMSTUDIO, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_POWERMATE, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_SOUNDKNOB, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS1, HID_QUIRK_IGNORE }, - { USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 100, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 200, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 300, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 400, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 500, HID_QUIRK_IGNORE }, - { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_PENPARTNER, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_GRAPHIRE, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_GRAPHIRE + 1, HID_QUIRK_IGNORE }, @@ -1644,7 +1663,7 @@ usb_fill_int_urb(hid->urbin, dev, pipe, hid->inbuf, len, hid_irq_in, hid, interval); hid->urbin->transfer_dma = hid->inbuf_dma; - hid->urbin->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; + hid->urbin->transfer_flags |=(URB_NO_TRANSFER_DMA_MAP | URB_ASYNC_UNLINK); } else { if (hid->urbout) continue; @@ -1654,7 +1673,7 @@ usb_fill_int_urb(hid->urbout, dev, pipe, hid->outbuf, 0, hid_irq_out, hid, interval); hid->urbout->transfer_dma = hid->outbuf_dma; - hid->urbout->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; + hid->urbout->transfer_flags |= (URB_NO_TRANSFER_DMA_MAP | URB_ASYNC_UNLINK); } } @@ -1704,8 +1723,7 @@ hid->ctrlbuf, 1, hid_ctrl, hid); hid->urbctrl->setup_dma = hid->cr_dma; hid->urbctrl->transfer_dma = hid->ctrlbuf_dma; - hid->urbctrl->transfer_flags |= (URB_NO_TRANSFER_DMA_MAP - | URB_NO_SETUP_DMA_MAP); + hid->urbctrl->transfer_flags |= (URB_NO_TRANSFER_DMA_MAP | URB_NO_SETUP_DMA_MAP | URB_ASYNC_UNLINK); return hid; @@ -1731,9 +1749,9 @@ return; usb_set_intfdata(intf, NULL); - usb_unlink_urb(hid->urbin); - usb_unlink_urb(hid->urbout); - usb_unlink_urb(hid->urbctrl); + usb_kill_urb(hid->urbin); + usb_kill_urb(hid->urbout); + usb_kill_urb(hid->urbctrl); if (hid->claimed & HID_CLAIMED_INPUT) hidinput_disconnect(hid); diff -Nru a/drivers/usb/input/hiddev.c b/drivers/usb/input/hiddev.c --- a/drivers/usb/input/hiddev.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/usb/input/hiddev.c 2004-09-26 10:25:56 -07:00 @@ -626,16 +626,19 @@ goto inval; field = report->field[uref->field_index]; - if (uref->usage_index >= field->maxusage) - goto inval; - if (cmd == HIDIOCGUSAGES || cmd == HIDIOCSUSAGES) { - if (uref_multi->num_values >= HID_MAX_USAGES || - uref->usage_index >= field->maxusage || - (uref->usage_index + uref_multi->num_values) >= field->maxusage) + if (cmd == HIDIOCGCOLLECTIONINDEX) { + if (uref->usage_index >= field->maxusage) goto inval; + } else if (uref->usage_index >= field->report_count) + goto inval; + + else if ((cmd == HIDIOCGUSAGES || cmd == HIDIOCSUSAGES) && + (uref_multi->num_values >= HID_MAX_MULTI_USAGES || + uref->usage_index + uref_multi->num_values >= field->report_count || + uref->usage_index + uref_multi->num_values < uref->usage_index)) + goto inval; } - } switch (cmd) { case HIDIOCGUSAGE: diff -Nru a/drivers/video/68328fb.c b/drivers/video/68328fb.c --- a/drivers/video/68328fb.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/video/68328fb.c 2004-09-26 10:25:57 -07:00 @@ -440,7 +440,11 @@ int __init mc68x328fb_init(void) { #ifndef MODULE - mc68x328fb_setup(fb_get_options("68328fb")); + char *option = NULL; + + if (fb_get_options("68328fb", &option)) + return -ENODEV; + mc68x328fb_setup(option); #endif /* * initialize the default mode from the LCD controller registers diff -Nru a/drivers/video/Makefile b/drivers/video/Makefile --- a/drivers/video/Makefile 2004-09-26 10:25:55 -07:00 +++ b/drivers/video/Makefile 2004-09-26 10:25:55 -07:00 @@ -13,84 +13,88 @@ obj-$(CONFIG_PPC) += macmodes.o endif -obj-$(CONFIG_FB_ARMCLCD) += amba-clcd.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o -obj-$(CONFIG_FB_ACORN) += acornfb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o +# Hardware specific drivers go first +obj-$(CONFIG_FB_RETINAZ3) += retz3fb.o obj-$(CONFIG_FB_AMIGA) += amifb.o c2p.o +obj-$(CONFIG_FB_CLPS711X) += clps711xfb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o +obj-$(CONFIG_FB_CYBER) += cyberfb.o +obj-$(CONFIG_FB_CYBER2000) += cyber2000fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o obj-$(CONFIG_FB_PM2) += pm2fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o obj-$(CONFIG_FB_PM3) += pm3fb.o -obj-$(CONFIG_FB_APOLLO) += dnfb.o cfbfillrect.o cfbimgblt.o -obj-$(CONFIG_FB_Q40) += q40fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o -obj-$(CONFIG_FB_ATARI) += atafb.o -obj-$(CONFIG_FB_68328) += 68328fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o + +obj-$(CONFIG_FB_MATROX) += matrox/ cfbfillrect.o cfbcopyarea.o cfbimgblt.o +obj-$(CONFIG_FB_RIVA) += riva/ cfbimgblt.o vgastate.o +obj-$(CONFIG_FB_ATY) += aty/ cfbcopyarea.o cfbfillrect.o cfbimgblt.o +obj-$(CONFIG_FB_ATY128) += aty/ cfbcopyarea.o cfbfillrect.o cfbimgblt.o +obj-$(CONFIG_FB_RADEON) += aty/ cfbcopyarea.o cfbfillrect.o cfbimgblt.o +obj-$(CONFIG_FB_SIS) += sis/ cfbcopyarea.o cfbfillrect.o cfbimgblt.o +obj-$(CONFIG_FB_KYRO) += kyro/ cfbfillrect.o cfbcopyarea.o cfbimgblt.o + +obj-$(CONFIG_FB_I810) += cfbcopyarea.o cfbfillrect.o cfbimgblt.o \ + vgastate.o obj-$(CONFIG_FB_RADEON_OLD) += radeonfb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o obj-$(CONFIG_FB_NEOMAGIC) += neofb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o vgastate.o -obj-$(CONFIG_FB_IGA) += igafb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o -obj-$(CONFIG_FB_CONTROL) += controlfb.o macmodes.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o -obj-$(CONFIG_FB_PLATINUM) += platinumfb.o macmodes.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o -obj-$(CONFIG_FB_VALKYRIE) += valkyriefb.o macmodes.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o -obj-$(CONFIG_FB_CT65550) += chipsfb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o -obj-$(CONFIG_FB_CLPS711X) += clps711xfb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o -obj-$(CONFIG_FB_CYBER) += cyberfb.o -obj-$(CONFIG_FB_CYBER2000) += cyber2000fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o -obj-$(CONFIG_FB_GBE) += gbefb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o -obj-$(CONFIG_FB_SGIVW) += sgivwfb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o +obj-$(CONFIG_FB_VIRGE) += virgefb.o obj-$(CONFIG_FB_3DFX) += tdfxfb.o cfbimgblt.o ifneq ($(CONFIG_FB_3DFX_ACCEL),y) obj-$(CONFIG_FB_3DFX) += cfbfillrect.o cfbcopyarea.o endif -obj-$(CONFIG_FB_MAC) += macfb.o macmodes.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o -obj-$(CONFIG_FB_HP300) += hpfb.o cfbfillrect.o cfbimgblt.o +obj-$(CONFIG_FB_CONTROL) += controlfb.o macmodes.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o +obj-$(CONFIG_FB_PLATINUM) += platinumfb.o macmodes.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o +obj-$(CONFIG_FB_VALKYRIE) += valkyriefb.o macmodes.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o +obj-$(CONFIG_FB_CT65550) += chipsfb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o obj-$(CONFIG_FB_IMSTT) += imsttfb.o cfbimgblt.o -obj-$(CONFIG_FB_RETINAZ3) += retz3fb.o -obj-$(CONFIG_FB_CIRRUS) += cirrusfb.o cfbfillrect.o cfbimgblt.o cfbcopyarea.o -obj-$(CONFIG_FB_TRIDENT) += tridentfb.o cfbfillrect.o cfbimgblt.o cfbcopyarea.o obj-$(CONFIG_FB_S3TRIO) += S3triofb.o -obj-$(CONFIG_FB_TGA) += tgafb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o -obj-$(CONFIG_FB_VIRGE) += virgefb.o -obj-$(CONFIG_FB_G364) += g364fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o obj-$(CONFIG_FB_FM2) += fm2fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o +obj-$(CONFIG_FB_TRIDENT) += tridentfb.o cfbfillrect.o cfbimgblt.o cfbcopyarea.o obj-$(CONFIG_FB_STI) += stifb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o -obj-$(CONFIG_FB_PMAG_BA) += pmag-ba-fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o -obj-$(CONFIG_FB_PMAGB_B) += pmagb-b-fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o -obj-$(CONFIG_FB_MAXINE) += maxinefb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o -obj-$(CONFIG_FB_TX3912) += tx3912fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o - -obj-$(CONFIG_FB_MATROX) += matrox/ cfbfillrect.o cfbcopyarea.o cfbimgblt.o -obj-$(CONFIG_FB_RIVA) += riva/ cfbimgblt.o vgastate.o -obj-$(CONFIG_FB_SIS) += sis/ cfbcopyarea.o cfbfillrect.o cfbimgblt.o -obj-$(CONFIG_FB_ATY) += aty/ cfbcopyarea.o cfbfillrect.o cfbimgblt.o -obj-$(CONFIG_FB_ATY128) += aty/ cfbcopyarea.o cfbfillrect.o cfbimgblt.o -obj-$(CONFIG_FB_RADEON) += aty/ cfbcopyarea.o cfbfillrect.o cfbimgblt.o -obj-$(CONFIG_FB_I810) += i810/ cfbfillrect.o cfbcopyarea.o \ - cfbimgblt.o vgastate.o - -obj-$(CONFIG_FB_SUN3) += sun3fb.o +obj-$(CONFIG_FB_FFB) += ffb.o sbuslib.o cfbimgblt.o cfbcopyarea.o +obj-$(CONFIG_FB_CG6) += cg6.o sbuslib.o cfbimgblt.o cfbcopyarea.o +obj-$(CONFIG_FB_CG3) += cg3.o sbuslib.o cfbimgblt.o cfbcopyarea.o \ + cfbfillrect.o +obj-$(CONFIG_FB_BW2) += bw2.o sbuslib.o cfbimgblt.o cfbcopyarea.o \ + cfbfillrect.o +obj-$(CONFIG_FB_CG14) += cg14.o sbuslib.o cfbimgblt.o cfbcopyarea.o \ + cfbfillrect.o +obj-$(CONFIG_FB_P9100) += p9100.o sbuslib.o cfbimgblt.o cfbcopyarea.o \ + cfbfillrect.o +obj-$(CONFIG_FB_TCX) += tcx.o sbuslib.o cfbimgblt.o cfbcopyarea.o \ + cfbfillrect.o +obj-$(CONFIG_FB_LEO) += leo.o sbuslib.o cfbimgblt.o cfbcopyarea.o \ + cfbfillrect.o +obj-$(CONFIG_FB_SGIVW) += sgivwfb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o +obj-$(CONFIG_FB_ACORN) += acornfb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o +obj-$(CONFIG_FB_ATARI) += atafb.o +obj-$(CONFIG_FB_MAC) += macfb.o macmodes.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o obj-$(CONFIG_FB_HGA) += hgafb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o +obj-$(CONFIG_FB_IGA) += igafb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o +obj-$(CONFIG_FB_APOLLO) += dnfb.o cfbfillrect.o cfbimgblt.o +obj-$(CONFIG_FB_Q40) += q40fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o +obj-$(CONFIG_FB_TGA) += tgafb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o +obj-$(CONFIG_FB_HP300) += hpfb.o cfbfillrect.o cfbimgblt.o +obj-$(CONFIG_FB_G364) += g364fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o obj-$(CONFIG_FB_SA1100) += sa1100fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o +obj-$(CONFIG_FB_SUN3) += sun3fb.o obj-$(CONFIG_FB_HIT) += hitfb.o cfbfillrect.o cfbimgblt.o +obj-$(CONFIG_FB_TX3912) += tx3912fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o obj-$(CONFIG_FB_EPSON1355) += epson1355fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o obj-$(CONFIG_FB_PVR2) += pvr2fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o -obj-$(CONFIG_FB_KYRO) += kyro/ cfbfillrect.o cfbcopyarea.o cfbimgblt.o +obj-$(CONFIG_FB_PMAG_BA) += pmag-ba-fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o +obj-$(CONFIG_FB_PMAGB_B) += pmagb-b-fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o +obj-$(CONFIG_FB_MAXINE) += maxinefb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o obj-$(CONFIG_FB_VOODOO1) += sstfb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o +obj-$(CONFIG_FB_ARMCLCD) += amba-clcd.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o +obj-$(CONFIG_FB_68328) += 68328fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o +obj-$(CONFIG_FB_GBE) += gbefb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o +obj-$(CONFIG_FB_CIRRUS) += cirrusfb.o cfbfillrect.o cfbimgblt.o cfbcopyarea.o obj-$(CONFIG_FB_ASILIANT) += asiliantfb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o +obj-$(CONFIG_FB_PXA) += pxafb.o cfbimgblt.o cfbcopyarea.o cfbfillrect0.o -obj-$(CONFIG_FB_FFB) += ffb.o sbuslib.o cfbimgblt.o cfbcopyarea.o -obj-$(CONFIG_FB_CG6) += cg6.o sbuslib.o cfbimgblt.o cfbcopyarea.o -obj-$(CONFIG_FB_CG3) += cg3.o sbuslib.o cfbimgblt.o cfbcopyarea.o \ - cfbfillrect.o -obj-$(CONFIG_FB_BW2) += bw2.o sbuslib.o cfbimgblt.o cfbcopyarea.o \ - cfbfillrect.o -obj-$(CONFIG_FB_CG14) += cg14.o sbuslib.o cfbimgblt.o cfbcopyarea.o \ - cfbfillrect.o -obj-$(CONFIG_FB_P9100) += p9100.o sbuslib.o cfbimgblt.o cfbcopyarea.o \ - cfbfillrect.o -obj-$(CONFIG_FB_TCX) += tcx.o sbuslib.o cfbimgblt.o cfbcopyarea.o \ - cfbfillrect.o -obj-$(CONFIG_FB_LEO) += leo.o sbuslib.o cfbimgblt.o cfbcopyarea.o \ - cfbfillrect.o -obj-$(CONFIG_FB_PXA) += pxafb.o cfbimgblt.o cfbcopyarea.o cfbfillrect.o +# Platform or fallback drivers go here +obj-$(CONFIG_FB_VESA) += vesafb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o obj-$(CONFIG_FB_VGA16) += vga16fb.o cfbfillrect.o cfbcopyarea.o \ cfbimgblt.o vgastate.o -obj-$(CONFIG_FB_VESA) += vesafb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o -obj-$(CONFIG_FB_VIRTUAL) += vfb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o obj-$(CONFIG_FB_OF) += offb.o cfbfillrect.o cfbimgblt.o cfbcopyarea.o + +# the test framebuffer is last +obj-$(CONFIG_FB_VIRTUAL) += vfb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o diff -Nru a/drivers/video/acornfb.c b/drivers/video/acornfb.c --- a/drivers/video/acornfb.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/video/acornfb.c 2004-09-26 10:25:57 -07:00 @@ -1291,8 +1291,12 @@ unsigned long size; u_int h_sync, v_sync; int rc, i; + char *option = NULL; + + if (fb_get_options("acornfb", &option)) + return -ENODEV; + acornfb_setup(option); - acornfb_setup(fb_get_options("acornfb")); acornfb_init_fbinfo(); current_par.dev = &acornfb_device; diff -Nru a/drivers/video/amba-clcd.c b/drivers/video/amba-clcd.c --- a/drivers/video/amba-clcd.c 2004-09-26 10:25:58 -07:00 +++ b/drivers/video/amba-clcd.c 2004-09-26 10:25:58 -07:00 @@ -496,6 +496,8 @@ int __init amba_clcdfb_init(void) { + if (fb_get_options("ambafb", NULL)) + return -ENODEV; return amba_driver_register(&clcd_driver); } diff -Nru a/drivers/video/amifb.c b/drivers/video/amifb.c --- a/drivers/video/amifb.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/video/amifb.c 2004-09-26 10:25:57 -07:00 @@ -2258,7 +2258,11 @@ u_int defmode; #ifndef MODULE - amifb_setup(fb_get_options("amifb")); + char *option = NULL; + + if (fb_get_options("amifb", &option)) + return -ENODEV; + amifb_setup(option); #endif if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(AMI_VIDEO)) return -ENXIO; diff -Nru a/drivers/video/asiliantfb.c b/drivers/video/asiliantfb.c --- a/drivers/video/asiliantfb.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/video/asiliantfb.c 2004-09-26 10:25:57 -07:00 @@ -609,6 +609,9 @@ int __init asiliantfb_init(void) { + if (fb_get_options("asiliantfb", NULL)) + return -ENODEV; + return pci_module_init(&asiliantfb_driver); } diff -Nru a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c --- a/drivers/video/aty/aty128fb.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/video/aty/aty128fb.c 2004-09-26 10:25:56 -07:00 @@ -2439,6 +2439,14 @@ int __init aty128fb_init(void) { +#ifndef MODULE + char *option = NULL; + + if (fb_get_options("aty128fb", &option)) + return -ENODEV; + aty128fb_setup(option); +#endif + return pci_module_init(&aty128fb_driver); } @@ -2447,8 +2455,9 @@ pci_unregister_driver(&aty128fb_driver); } -#ifdef MODULE module_init(aty128fb_init); + +#ifdef MODULE module_exit(aty128fb_exit); MODULE_AUTHOR("(c)1999-2003 Brad Douglas "); diff -Nru a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c --- a/drivers/video/aty/atyfb_base.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/video/aty/atyfb_base.c 2004-09-26 10:25:57 -07:00 @@ -1902,7 +1902,7 @@ return 1; } -int __init atyfb_init(void) +int __init atyfb_do_init(void) { #if defined(CONFIG_PCI) unsigned long addr, res_start, res_size; @@ -1920,13 +1920,6 @@ #else u16 tmp; #endif -#endif - -#ifndef MODULE - atyfb_setup(fb_get_options("atyfb")); -#endif - -#if defined(CONFIG_PCI) #ifdef __sparc__ /* Do not attach when we have a serial console. */ @@ -2385,6 +2378,19 @@ #endif /* CONFIG_ATARI */ return 0; } + +int __init atyfb_init(void) +{ +#ifndef MODULE + char *option = NULL; + + if (fb_get_options("atyfb", &option)) + return -ENODEV; + atyfb_setup(option); +#endif + return atyfb_do_init(); +} + #ifndef MODULE int __init atyfb_setup(char *options) diff -Nru a/drivers/video/aty/radeon_base.c b/drivers/video/aty/radeon_base.c --- a/drivers/video/aty/radeon_base.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/video/aty/radeon_base.c 2004-09-26 10:25:56 -07:00 @@ -1868,7 +1868,7 @@ #undef SET_MC_FB_FROM_APERTURE static void fixup_memory_mappings(struct radeonfb_info *rinfo) { - u32 save_crtc_gen_cntl, save_crtc2_gen_cntl; + u32 save_crtc_gen_cntl, save_crtc2_gen_cntl = 0; u32 save_crtc_ext_cntl; u32 aper_base, aper_size; u32 agp_base; @@ -2373,7 +2373,11 @@ int __init radeonfb_init (void) { #ifndef MODULE - radeonfb_setup(fb_get_options("radeonfb")); + char *option = NULL; + + if (fb_get_options("radeonfb", &option)) + return -ENODEV; + radeonfb_setup(option); #endif return pci_module_init (&radeonfb_driver); } diff -Nru a/drivers/video/aty/radeon_monitor.c b/drivers/video/aty/radeon_monitor.c --- a/drivers/video/aty/radeon_monitor.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/video/aty/radeon_monitor.c 2004-09-26 10:25:55 -07:00 @@ -55,7 +55,7 @@ u8 *pedid = NULL; u8 *pmt = NULL; u8 *tmp; - int i, mt; + int i, mt = MT_NONE; RTRACE("analyzing OF properties...\n"); pmt = (u8 *)get_property(dp, "display-type", NULL); @@ -72,7 +72,9 @@ else if (strcmp(pmt, "NONE")) { printk(KERN_WARNING "radeonfb: Unknown OF display-type: %s\n", pmt); return MT_NONE; - } + } else + return MT_NONE; + for (i = 0; propnames[i] != NULL; ++i) { pedid = (u8 *)get_property(dp, propnames[i], NULL); if (pedid != NULL) @@ -645,15 +647,23 @@ rinfo->panel_info.fbk_divider = 0xad; rinfo->panel_info.use_bios_dividers = 1; } + /* Aluminium PowerBook 15" */ + if (machine_is_compatible("PowerBook5,4")) { + rinfo->panel_info.ref_divider = rinfo->pll.ref_div; + rinfo->panel_info.post_divider = 0x2; + rinfo->panel_info.fbk_divider = 0x8e; + rinfo->panel_info.use_bios_dividers = 1; + } /* Aluminium PowerBook 17" */ - if (machine_is_compatible("PowerBook5,3")) { + if (machine_is_compatible("PowerBook5,3") || + machine_is_compatible("PowerBook5,5")) { rinfo->panel_info.ref_divider = rinfo->pll.ref_div; rinfo->panel_info.post_divider = 0x4; rinfo->panel_info.fbk_divider = 0x80; rinfo->panel_info.use_bios_dividers = 1; } /* iBook G4 */ - if (machine_is_compatible("PowerBook6,3") | + if (machine_is_compatible("PowerBook6,3") || machine_is_compatible("PowerBook6,5")) { rinfo->panel_info.ref_divider = rinfo->pll.ref_div; rinfo->panel_info.post_divider = 0x6; diff -Nru a/drivers/video/bw2.c b/drivers/video/bw2.c --- a/drivers/video/bw2.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/video/bw2.c 2004-09-26 10:25:56 -07:00 @@ -386,6 +386,9 @@ struct sbus_bus *sbus; struct sbus_dev *sdev; + if (fb_get_options("bw2fb", &option)) + return -ENODEV; + #ifdef CONFIG_SUN4 bw2_init_one(NULL); #endif diff -Nru a/drivers/video/cfbcopyarea.c b/drivers/video/cfbcopyarea.c --- a/drivers/video/cfbcopyarea.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/video/cfbcopyarea.c 2004-09-26 10:25:57 -07:00 @@ -43,8 +43,9 @@ #define BYTES_PER_LONG 8 #endif -static void bitcpy(unsigned long *dst, int dst_idx, const unsigned long *src, - int src_idx, unsigned long n) +static void bitcpy(unsigned long __iomem *dst, int dst_idx, + const unsigned long __iomem *src, int src_idx, + unsigned long n) { unsigned long first, last; int shift = dst_idx-src_idx, left, right; @@ -185,8 +186,8 @@ } } -static void bitcpy_rev(unsigned long *dst, int dst_idx, - const unsigned long *src, int src_idx, unsigned long n) +static void bitcpy_rev(unsigned long __iomem *dst, int dst_idx, + const unsigned long __iomem *src, int src_idx, unsigned long n) { unsigned long first, last; int shift = dst_idx-src_idx, left, right; @@ -344,7 +345,7 @@ int x2, y2, old_dx, old_dy, vxres, vyres; unsigned long next_line = p->fix.line_length; int dst_idx = 0, src_idx = 0, rev_copy = 0; - unsigned long *dst = NULL, *src = NULL; + unsigned long __iomem *dst = NULL, *src = NULL; if (p->state != FBINFO_STATE_RUNNING) return; @@ -394,7 +395,7 @@ rev_copy = 1; } - dst = src = (unsigned long *)((unsigned long)p->screen_base & + dst = src = (unsigned long __iomem *)((unsigned long)p->screen_base & ~(BYTES_PER_LONG-1)); dst_idx = src_idx = (unsigned long)p->screen_base & (BYTES_PER_LONG-1); dst_idx += dy*next_line*8 + dx*p->var.bits_per_pixel; diff -Nru a/drivers/video/cfbfillrect.c b/drivers/video/cfbfillrect.c --- a/drivers/video/cfbfillrect.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/video/cfbfillrect.c 2004-09-26 10:25:56 -07:00 @@ -119,7 +119,7 @@ * Unaligned 32-bit pattern fill using 32/64-bit memory accesses */ -void bitfill32(unsigned long *dst, int dst_idx, u32 pat, u32 n) +void bitfill32(unsigned long __iomem *dst, int dst_idx, u32 pat, u32 n) { unsigned long val = pat; unsigned long first, last; @@ -178,7 +178,7 @@ * used for the next 32/64-bit word */ -void bitfill(unsigned long *dst, int dst_idx, unsigned long pat, int left, +void bitfill(unsigned long __iomem *dst, int dst_idx, unsigned long pat, int left, int right, u32 n) { unsigned long first, last; @@ -228,7 +228,7 @@ } } -void bitfill32_rev(unsigned long *dst, int dst_idx, u32 pat, u32 n) +void bitfill32_rev(unsigned long __iomem *dst, int dst_idx, u32 pat, u32 n) { unsigned long val = pat, dat; unsigned long first, last; @@ -300,7 +300,7 @@ * used for the next 32/64-bit word */ -void bitfill_rev(unsigned long *dst, int dst_idx, unsigned long pat, int left, +void bitfill_rev(unsigned long __iomem *dst, int dst_idx, unsigned long pat, int left, int right, u32 n) { unsigned long first, last, dat; @@ -364,7 +364,7 @@ u32 bpp = p->var.bits_per_pixel; unsigned long x2, y2, vxres, vyres; unsigned long height, width, fg; - unsigned long *dst; + unsigned long __iomem *dst; int dst_idx, left; if (p->state != FBINFO_STATE_RUNNING) @@ -397,7 +397,7 @@ else fg = rect->color; - dst = (unsigned long *)((unsigned long)p->screen_base & + dst = (unsigned long __iomem *)((unsigned long)p->screen_base & ~(BYTES_PER_LONG-1)); dst_idx = ((unsigned long)p->screen_base & (BYTES_PER_LONG-1))*8; dst_idx += rect->dy*p->fix.line_length*8+rect->dx*bpp; @@ -407,7 +407,7 @@ p->fbops->fb_sync(p); if (!left) { u32 pat = pixel_to_pat32(p, fg); - void (*fill_op32)(unsigned long *dst, int dst_idx, u32 pat, + void (*fill_op32)(unsigned long __iomem *dst, int dst_idx, u32 pat, u32 n) = NULL; switch (rect->rop) { @@ -429,7 +429,7 @@ unsigned long pat = pixel_to_pat(p, fg, (left-dst_idx) % bpp); int right = bpp-left; int r; - void (*fill_op)(unsigned long *dst, int dst_idx, + void (*fill_op)(unsigned long __iomem *dst, int dst_idx, unsigned long pat, int left, int right, u32 n) = NULL; diff -Nru a/drivers/video/cfbimgblt.c b/drivers/video/cfbimgblt.c --- a/drivers/video/cfbimgblt.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/video/cfbimgblt.c 2004-09-26 10:25:56 -07:00 @@ -87,21 +87,22 @@ #endif static inline void color_imageblit(const struct fb_image *image, - struct fb_info *p, u8 *dst1, + struct fb_info *p, u8 __iomem *dst1, u32 start_index, u32 pitch_index) { /* Draw the penguin */ - u32 *dst, *dst2, color = 0, val, shift; + u32 __iomem *dst, *dst2; + u32 color = 0, val, shift; int i, n, bpp = p->var.bits_per_pixel; u32 null_bits = 32 - bpp; u32 *palette = (u32 *) p->pseudo_palette; const u8 *src = image->data; - dst2 = (u32 *) dst1; + dst2 = (u32 __iomem *) dst1; for (i = image->height; i--; ) { n = image->width; - dst = (u32 *) dst1; + dst = (u32 __iomem *) dst1; shift = 0; val = 0; @@ -136,7 +137,7 @@ dst1 += p->fix.line_length; if (pitch_index) { dst2 += p->fix.line_length; - dst1 = (u8 *)((long)dst2 & ~(sizeof(u32) - 1)); + dst1 = (u8 __iomem *)((long __force)dst2 & ~(sizeof(u32) - 1)); start_index += pitch_index; start_index &= 32 - 1; @@ -145,25 +146,26 @@ } static inline void slow_imageblit(const struct fb_image *image, struct fb_info *p, - u8 *dst1, u32 fgcolor, + u8 __iomem *dst1, u32 fgcolor, u32 bgcolor, u32 start_index, u32 pitch_index) { u32 shift, color = 0, bpp = p->var.bits_per_pixel; - u32 *dst, *dst2, val, pitch = p->fix.line_length; + u32 __iomem *dst, *dst2; + u32 val, pitch = p->fix.line_length; u32 null_bits = 32 - bpp; u32 spitch = (image->width+7)/8; const u8 *src = image->data, *s; u32 i, j, l; - dst2 = (u32 *) dst1; + dst2 = (u32 __iomem *) dst1; for (i = image->height; i--; ) { shift = val = 0; l = 8; j = image->width; - dst = (u32 *) dst1; + dst = (u32 __iomem *) dst1; s = src; /* write leading bits */ @@ -201,7 +203,7 @@ src += spitch; if (pitch_index) { dst2 += pitch; - dst1 = (u8 *)((long)dst2 & ~(sizeof(u32) - 1)); + dst1 = (u8 __iomem *)((long __force)dst2 & ~(sizeof(u32) - 1)); start_index += pitch_index; start_index &= 32 - 1; } @@ -218,14 +220,14 @@ * beginning and end of a scanline is dword aligned */ static inline void fast_imageblit(const struct fb_image *image, struct fb_info *p, - u8 *dst1, u32 fgcolor, + u8 __iomem *dst1, u32 fgcolor, u32 bgcolor) { u32 fgx = fgcolor, bgx = bgcolor, bpp = p->var.bits_per_pixel; u32 ppw = 32/bpp, spitch = (image->width + 7)/8; u32 bit_mask, end_mask, eorx, shift; const char *s = image->data, *src; - u32 *dst; + u32 __iomem *dst; u32 *tab = NULL; int i, j, k; @@ -253,7 +255,7 @@ k = image->width/ppw; for (i = image->height; i--; ) { - dst = (u32 *) dst1, shift = 8; src = s; + dst = (u32 __iomem *) dst1, shift = 8; src = s; for (j = k; j--; ) { shift -= ppw; @@ -273,7 +275,7 @@ u32 width = image->width, height = image->height; u32 dx = image->dx, dy = image->dy; int x2, y2, vxres, vyres; - u8 *dst1; + u8 __iomem *dst1; if (p->state != FBINFO_STATE_RUNNING) return; diff -Nru a/drivers/video/cg14.c b/drivers/video/cg14.c --- a/drivers/video/cg14.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/video/cg14.c 2004-09-26 10:25:57 -07:00 @@ -584,6 +584,9 @@ struct sbus_bus *sbus; struct sbus_dev *sdev; + if (fb_get_options("cg14fb", NULL)) + return -ENODEV; + #ifdef CONFIG_SPARC32 { int root, node; diff -Nru a/drivers/video/cg3.c b/drivers/video/cg3.c --- a/drivers/video/cg3.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/video/cg3.c 2004-09-26 10:25:56 -07:00 @@ -444,6 +444,9 @@ struct sbus_bus *sbus; struct sbus_dev *sdev; + if (fb_get_options("cg3fb", NULL)) + return -ENODEV; + for_all_sbusdev(sdev, sbus) { if (!strcmp(sdev->prom_name, "cgthree") || !strcmp(sdev->prom_name, "cgRDI")) diff -Nru a/drivers/video/cg6.c b/drivers/video/cg6.c --- a/drivers/video/cg6.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/video/cg6.c 2004-09-26 10:25:55 -07:00 @@ -760,6 +760,9 @@ struct sbus_bus *sbus; struct sbus_dev *sdev; + if (fb_get_options("cg6fb", NULL)) + return -ENODEV; + for_all_sbusdev(sdev, sbus) { if (!strcmp(sdev->prom_name, "cgsix") || !strcmp(sdev->prom_name, "cgthree+")) diff -Nru a/drivers/video/chipsfb.c b/drivers/video/chipsfb.c --- a/drivers/video/chipsfb.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/video/chipsfb.c 2004-09-26 10:25:56 -07:00 @@ -462,6 +462,9 @@ int __init chips_init(void) { + if (fb_get_options("chipsfb", NULL)) + return -ENODEV; + return pci_module_init(&chipsfb_driver); } diff -Nru a/drivers/video/cirrusfb.c b/drivers/video/cirrusfb.c --- a/drivers/video/cirrusfb.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/video/cirrusfb.c 2004-09-26 10:25:57 -07:00 @@ -2607,7 +2607,11 @@ int error = 0; #ifndef MODULE - cirrusfb_setup(fb_get_options("cirrusfb")); + char *option = NULL; + + if (fb_get_options("cirrusfb", &option)) + return -ENODEV; + cirrusfb_setup(option); #endif #ifdef CONFIG_ZORRO diff -Nru a/drivers/video/clps711xfb.c b/drivers/video/clps711xfb.c --- a/drivers/video/clps711xfb.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/video/clps711xfb.c 2004-09-26 10:25:55 -07:00 @@ -364,6 +364,9 @@ { int err = -ENOMEM; + if (fb_get_options("clps711xfb", NULL)) + return -ENODEV; + cfb = kmalloc(sizeof(*cfb), GFP_KERNEL); if (!cfb) goto out; diff -Nru a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c --- a/drivers/video/console/fbcon.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/video/console/fbcon.c 2004-09-26 10:25:57 -07:00 @@ -689,7 +689,7 @@ disp->green = var->green; disp->blue = var->blue; disp->transp = var->transp; - disp->mode = fb_match_mode(var, &info->monspecs.modelist); + disp->mode = fb_match_mode(var, &info->modelist); if (disp->mode == NULL) /* This should not happen */ return -EINVAL; @@ -1973,7 +1973,7 @@ struct fb_videomode *mode; DPRINTK("attempting resize %ix%i\n", var.xres, var.yres); - mode = fb_find_best_mode(&var, &info->monspecs.modelist); + mode = fb_find_best_mode(&var, &info->modelist); if (mode == NULL) return -EINVAL; fb_videomode_to_var(&var, mode); diff -Nru a/drivers/video/controlfb.c b/drivers/video/controlfb.c --- a/drivers/video/controlfb.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/video/controlfb.c 2004-09-26 10:25:55 -07:00 @@ -556,8 +556,11 @@ int __init control_init(void) { struct device_node *dp; + char *option = NULL; - control_setup(fb_get_options("controlfb")); + if (fb_get_options("controlfb", &option)) + return -ENODEV; + control_setup(option); dp = find_devices("control"); if (dp != 0 && !control_of_init(dp)) diff -Nru a/drivers/video/cyber2000fb.c b/drivers/video/cyber2000fb.c --- a/drivers/video/cyber2000fb.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/video/cyber2000fb.c 2004-09-26 10:25:55 -07:00 @@ -1720,7 +1720,11 @@ int ret = -1, err; #ifndef MODULE - cyber2000fb_setup(fb_get_options("cyber200fb")); + char *option = NULL; + + if (fb_get_options("cyber2000fb", NULL)) + return -ENODEV; + cyber2000fb_setup(option); #endif #ifdef CONFIG_ARCH_SHARK diff -Nru a/drivers/video/dnfb.c b/drivers/video/dnfb.c --- a/drivers/video/dnfb.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/video/dnfb.c 2004-09-26 10:25:57 -07:00 @@ -284,6 +284,9 @@ { int ret; + if (fb_get_options("dnfb", NULL)) + return -ENODEV; + ret = driver_register(&dnfb_driver); if (!ret) { diff -Nru a/drivers/video/epson1355fb.c b/drivers/video/epson1355fb.c --- a/drivers/video/epson1355fb.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/video/epson1355fb.c 2004-09-26 10:25:55 -07:00 @@ -740,6 +740,9 @@ { int ret = 0; + if (fb_get_options("epson1355fb", NULL)) + return -ENODEV; + ret = driver_register(&epson1355fb_driver); if (!ret) { ret = platform_device_register(&epson1355fb_device); diff -Nru a/drivers/video/fbmem.c b/drivers/video/fbmem.c --- a/drivers/video/fbmem.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/video/fbmem.c 2004-09-26 10:25:55 -07:00 @@ -801,7 +801,7 @@ } if (!ret) - fb_delete_videomode(&mode1, &info->monspecs.modelist); + fb_delete_videomode(&mode1, &info->modelist); return ret; } @@ -828,7 +828,7 @@ fb_set_cmap(&info->cmap, info); fb_var_to_videomode(&mode, &info->var); - fb_add_videomode(&mode, &info->monspecs.modelist); + fb_add_videomode(&mode, &info->modelist); if (info->flags & FBINFO_MISC_MODECHANGEUSER) { struct fb_event event; @@ -1174,14 +1174,14 @@ } fb_info->sprite.offset = 0; - if (!fb_info->monspecs.modelist.prev || - !fb_info->monspecs.modelist.next || - list_empty(&fb_info->monspecs.modelist)) { + if (!fb_info->modelist.prev || + !fb_info->modelist.next || + list_empty(&fb_info->modelist)) { struct fb_videomode mode; - INIT_LIST_HEAD(&fb_info->monspecs.modelist); + INIT_LIST_HEAD(&fb_info->modelist); fb_var_to_videomode(&mode, &fb_info->var); - fb_add_videomode(&mode, &fb_info->monspecs.modelist); + fb_add_videomode(&mode, &fb_info->modelist); } registered_fb[i] = fb_info; @@ -1219,7 +1219,7 @@ kfree(fb_info->pixmap.addr); if (fb_info->sprite.addr && (fb_info->sprite.flags & FB_PIXMAP_DEFAULT)) kfree(fb_info->sprite.addr); - fb_destroy_modelist(&fb_info->monspecs.modelist); + fb_destroy_modelist(&fb_info->modelist); registered_fb[i]=NULL; num_registered_fb--; class_simple_device_remove(MKDEV(FB_MAJOR, i)); @@ -1296,6 +1296,7 @@ #define NR_FB_DRIVERS 64 static char *video_options[NR_FB_DRIVERS]; +static int ofonly; /** * fb_get_options - get kernel boot parameters @@ -1305,30 +1306,35 @@ * * NOTE: Needed to maintain backwards compatibility */ -char* fb_get_options(char *name) +int fb_get_options(char *name, char **option) { - char *option = NULL; - char *opt; - int opt_len; + char *opt, *options = NULL; + int opt_len, retval = 0; int name_len = strlen(name), i; - if (!name_len) - return option; + if (name_len && ofonly && strncmp(name, "offb", 4)) + retval = 1; - for (i = 0; i < NR_FB_DRIVERS; i++) { - if (video_options[i] == NULL) - continue; - opt_len = strlen(video_options[i]); - if (!opt_len) - continue; - opt = video_options[i]; - if (!strncmp(name, opt, name_len) && - opt[name_len] == ':') { - option = opt + name_len + 1; - break; + if (name_len && !retval) { + for (i = 0; i < NR_FB_DRIVERS; i++) { + if (video_options[i] == NULL) + continue; + opt_len = strlen(video_options[i]); + if (!opt_len) + continue; + opt = video_options[i]; + if (!strncmp(name, opt, name_len) && + opt[name_len] == ':') + options = opt + name_len + 1; } } - return option; + if (options && !strncmp(options, "off", 3)) + retval = 1; + + if (option) + *option = options; + + return retval; } /** @@ -1353,6 +1359,8 @@ return 0; for (i = 0; i < NR_FB_DRIVERS; i++) { + if (!strncmp(options, "ofonly", 6)) + ofonly = 1; if (video_options[i] == NULL) { video_options[i] = options; break; diff -Nru a/drivers/video/ffb.c b/drivers/video/ffb.c --- a/drivers/video/ffb.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/video/ffb.c 2004-09-26 10:25:57 -07:00 @@ -1049,6 +1049,9 @@ { int root; + if (fb_get_options("ffb", NULL)) + return -ENODEV; + ffb_scan_siblings(prom_root_node); root = prom_getchild(prom_root_node); diff -Nru a/drivers/video/fm2fb.c b/drivers/video/fm2fb.c --- a/drivers/video/fm2fb.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/video/fm2fb.c 2004-09-26 10:25:56 -07:00 @@ -296,7 +296,11 @@ int __init fm2fb_init(void) { - fm2fb_setup(fb_get_options("fb2fb")); + char *option = NULL; + + if (fb_get_options("fm2fb", &option)) + return -ENODEV; + fm2fb_setup(option); return zorro_register_driver(&fm2fb_driver); } diff -Nru a/drivers/video/g364fb.c b/drivers/video/g364fb.c --- a/drivers/video/g364fb.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/video/g364fb.c 2004-09-26 10:25:55 -07:00 @@ -202,6 +202,9 @@ (volatile unsigned int *) CURS_PAL_REG; int mem, i, j; + if (fb_get_options("g364fb", NULL)) + return -ENODEV; + /* TBD: G364 detection */ /* get the resolution set by ARC console */ diff -Nru a/drivers/video/gbefb.c b/drivers/video/gbefb.c --- a/drivers/video/gbefb.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/video/gbefb.c 2004-09-26 10:25:56 -07:00 @@ -1084,7 +1084,11 @@ int i, ret = 0; #ifndef MODULE - gbefb_setup(fb_get_options("gbefb")); + char *option = NULL; + + if (fb_get_options("gbefb", &option)) + return -ENODEV; + gbefb_setup(options); #endif if (!request_mem_region(GBE_BASE, sizeof(struct sgi_gbe), "GBE")) { diff -Nru a/drivers/video/hgafb.c b/drivers/video/hgafb.c --- a/drivers/video/hgafb.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/video/hgafb.c 2004-09-26 10:25:57 -07:00 @@ -547,6 +547,9 @@ int __init hgafb_init(void) { + if (fb_get_options("hgafb", NULL)) + return -ENODEV; + if (! hga_card_detect()) { printk(KERN_INFO "hgafb: HGA card not detected.\n"); return -EINVAL; diff -Nru a/drivers/video/hitfb.c b/drivers/video/hitfb.c --- a/drivers/video/hitfb.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/video/hitfb.c 2004-09-26 10:25:55 -07:00 @@ -270,6 +270,9 @@ unsigned short lcdclor, ldr3, ldvndr; int size; + if (fb_get_options("hitfb", NULL)) + return -ENODEV; + hitfb_fix.smem_start = CONFIG_HD64461_IOBASE + 0x02000000; hitfb_fix.smem_len = (MACH_HP690) ? 1024 * 1024 : 512 * 1024; diff -Nru a/drivers/video/hpfb.c b/drivers/video/hpfb.c --- a/drivers/video/hpfb.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/video/hpfb.c 2004-09-26 10:25:56 -07:00 @@ -115,6 +115,9 @@ { unsigned long fboff; + if (fb_get_options("hpfb", NULL)) + return -ENODEV; + fboff = (in_8(base + TOPCAT_FBOMSB) << 8) | in_8(base + TOPCAT_FBOLSB); hpfb_fix.smem_start = 0xf0000000 | (in_8(base + fboff) << 16); diff -Nru a/drivers/video/i810/i810_main.c b/drivers/video/i810/i810_main.c --- a/drivers/video/i810/i810_main.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/video/i810/i810_main.c 2004-09-26 10:25:56 -07:00 @@ -1989,12 +1989,11 @@ #ifndef MODULE int __init i810fb_init(void) { - i810fb_setup(fb_get_options("i810fb")); + char *option = NULL; - if (agp_intel_init()) { - printk("i810fb_init: cannot initialize intel agpgart\n"); + if (fb_get_options("i810fb", &option)) return -ENODEV; - } + i810fb_setup(option); if (pci_register_driver(&i810fb_driver) > 0) return 0; diff -Nru a/drivers/video/igafb.c b/drivers/video/igafb.c --- a/drivers/video/igafb.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/video/igafb.c 2004-09-26 10:25:56 -07:00 @@ -381,6 +381,9 @@ unsigned long addr; int size, iga2000 = 0; + if (fb_get_options("igafb", NULL)) + return -ENODEV; + /* Do not attach when we have a serial console. */ if (!con_is_present()) return -ENXIO; diff -Nru a/drivers/video/imsttfb.c b/drivers/video/imsttfb.c --- a/drivers/video/imsttfb.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/video/imsttfb.c 2004-09-26 10:25:56 -07:00 @@ -1603,7 +1603,12 @@ int __init imsttfb_init(void) { #ifndef MODULE - imsttfb_setup(fb_get_options("imsttfb")); + char *option = NULL; + + if (fb_get_options("imsttfb", &option)) + return -ENODEV; + + imsttfb_setup(option); #endif return pci_module_init(&imsttfb_pci_driver); } diff -Nru a/drivers/video/kyro/fbdev.c b/drivers/video/kyro/fbdev.c --- a/drivers/video/kyro/fbdev.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/video/kyro/fbdev.c 2004-09-26 10:25:55 -07:00 @@ -788,7 +788,11 @@ int __init kyrofb_init(void) { #ifndef MODULE - kyrofb_setup(fb_get_options("kyrofb")); + char *option = NULL; + + if (fb_get_options("kyrofb", &option)) + return -ENODEV; + kyrofb_setup(option); #endif return pci_module_init(&kyrofb_pci_driver); } diff -Nru a/drivers/video/leo.c b/drivers/video/leo.c --- a/drivers/video/leo.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/video/leo.c 2004-09-26 10:25:57 -07:00 @@ -626,6 +626,9 @@ struct sbus_bus *sbus; struct sbus_dev *sdev; + if (fb_get_options("leofb", NULL)) + return -ENODEV; + for_all_sbusdev(sdev, sbus) { if (!strcmp(sdev->prom_name, "leo")) leo_init_one(sdev); diff -Nru a/drivers/video/macfb.c b/drivers/video/macfb.c --- a/drivers/video/macfb.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/video/macfb.c 2004-09-26 10:25:55 -07:00 @@ -614,8 +614,11 @@ { int video_cmap_len, video_is_nubus = 0; struct nubus_dev* ndev = NULL; + char *option = NULL; - macfb_setup(fb_get_options("macfb")); + if (fb_get_options("macfb", &option)) + return -ENODEV; + macfb_setup(option); if (!MACH_IS_MAC) return; diff -Nru a/drivers/video/matrox/matroxfb_base.c b/drivers/video/matrox/matroxfb_base.c --- a/drivers/video/matrox/matroxfb_base.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/video/matrox/matroxfb_base.c 2004-09-26 10:25:57 -07:00 @@ -2415,9 +2415,13 @@ int __init matroxfb_init(void) { + char *option = NULL; + DBG(__FUNCTION__) - matroxfb_setup(fb_get_options("matroxfb")); + if (fb_get_options("matroxfb", &option)) + return -ENODEV; + matroxfb_setup(option); if (disabled) return -ENXIO; diff -Nru a/drivers/video/matrox/matroxfb_base.h b/drivers/video/matrox/matroxfb_base.h --- a/drivers/video/matrox/matroxfb_base.h 2004-09-26 10:25:56 -07:00 +++ b/drivers/video/matrox/matroxfb_base.h 2004-09-26 10:25:56 -07:00 @@ -99,21 +99,16 @@ #endif #endif -#if defined(__alpha__) || defined(__mc68000__) +#if defined(__alpha__) || defined(__mc68000__) || defined(__i386__) || defined(__x86_64__) #define READx_WORKS #define MEMCPYTOIO_WORKS #else +/* ppc/ppc64 must use __raw_{read,write}[bwl] as we drive adapter + in big-endian mode for compatibility with XFree mga driver, and + so we do not want little-endian {read,write}[bwl] */ #define READx_FAILS -/* recheck __ppc__, maybe that __ppc__ needs MEMCPYTOIO_WRITEL */ -/* I benchmarked PII/350MHz with G200... MEMCPY, MEMCPYTOIO and WRITEL are on same speed ( <2% diff) */ -/* so that means that G200 speed (or AGP speed?) is our limit... I do not have benchmark to test, how */ -/* much of PCI bandwidth is used during transfers... */ -#if defined(__i386__) || defined(__x86_64__) -#define MEMCPYTOIO_MEMCPY -#else #define MEMCPYTOIO_WRITEL #endif -#endif #if defined(__mc68000__) #define MAP_BUSTOVIRT @@ -160,7 +155,7 @@ #endif typedef struct { - u_int8_t* vaddr; + u_int8_t __iomem* vaddr; } vaddr_t; #ifdef READx_WORKS @@ -189,27 +184,27 @@ } #else static inline unsigned int mga_readb(vaddr_t va, unsigned int offs) { - return *(volatile u_int8_t*)(va.vaddr + offs); + return __raw_readb(va.vaddr + offs); } static inline unsigned int mga_readw(vaddr_t va, unsigned int offs) { - return *(volatile u_int16_t*)(va.vaddr + offs); + return __raw_readw(va.vaddr + offs); } static inline u_int32_t mga_readl(vaddr_t va, unsigned int offs) { - return *(volatile u_int32_t*)(va.vaddr + offs); + return __raw_readl(va.vaddr + offs); } static inline void mga_writeb(vaddr_t va, unsigned int offs, u_int8_t value) { - *(volatile u_int8_t*)(va.vaddr + offs) = value; + __raw_writeb(value, va.vaddr + offs); } static inline void mga_writew(vaddr_t va, unsigned int offs, u_int16_t value) { - *(volatile u_int16_t*)(va.vaddr + offs) = value; + __raw_writew(value, va.vaddr + offs); } static inline void mga_writel(vaddr_t va, unsigned int offs, u_int32_t value) { - *(volatile u_int32_t*)(va.vaddr + offs) = value; + __raw_writel(value, va.vaddr + offs); } #endif @@ -238,8 +233,6 @@ memcpy(&tmp, src, len); mga_writel(va, offs, tmp); } -#elif defined(MEMCPYTOIO_MEMCPY) - memcpy(va.vaddr + offs, src, len); #else #error "Sorry, do not know how to write block of data to device" #endif @@ -249,7 +242,7 @@ va->vaddr += offs; } -static inline void* vaddr_va(vaddr_t va) { +static inline void __iomem* vaddr_va(vaddr_t va) { return va.vaddr; } diff -Nru a/drivers/video/matrox/matroxfb_crtc2.c b/drivers/video/matrox/matroxfb_crtc2.c --- a/drivers/video/matrox/matroxfb_crtc2.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/video/matrox/matroxfb_crtc2.c 2004-09-26 10:25:57 -07:00 @@ -721,6 +721,9 @@ .remove = matroxfb_crtc2_remove }; static int matroxfb_crtc2_init(void) { + if (fb_get_options("matrox_crtc2fb", NULL)) + return -ENODEV; + matroxfb_register_driver(&crtc2); return 0; } diff -Nru a/drivers/video/matrox/matroxfb_crtc2.h b/drivers/video/matrox/matroxfb_crtc2.h --- a/drivers/video/matrox/matroxfb_crtc2.h 2004-09-26 10:25:55 -07:00 +++ b/drivers/video/matrox/matroxfb_crtc2.h 2004-09-26 10:25:55 -07:00 @@ -27,7 +27,7 @@ unsigned int len; } mmio; - int interlaced:1; + unsigned int interlaced:1; u_int32_t cmap[17]; }; diff -Nru a/drivers/video/matrox/matroxfb_misc.c b/drivers/video/matrox/matroxfb_misc.c --- a/drivers/video/matrox/matroxfb_misc.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/video/matrox/matroxfb_misc.c 2004-09-26 10:25:56 -07:00 @@ -391,7 +391,7 @@ CRITEND } -static void get_pins(unsigned char* pins, struct matrox_bios* bd) { +static void get_pins(unsigned char __iomem* pins, struct matrox_bios* bd) { unsigned int b0 = readb(pins); if (b0 == 0x2E && readb(pins+1) == 0x41) { @@ -427,7 +427,7 @@ } } -static void get_bios_version(unsigned char* vbios, struct matrox_bios* bd) { +static void get_bios_version(unsigned char __iomem * vbios, struct matrox_bios* bd) { unsigned int pcir_offset; pcir_offset = readb(vbios + 24) | (readb(vbios + 25) << 8); @@ -452,7 +452,7 @@ } } -static void get_bios_output(unsigned char* vbios, struct matrox_bios* bd) { +static void get_bios_output(unsigned char __iomem* vbios, struct matrox_bios* bd) { unsigned char b; b = readb(vbios + 0x7FF1); @@ -462,7 +462,7 @@ bd->output.state = b; } -static void get_bios_tvout(unsigned char* vbios, struct matrox_bios* bd) { +static void get_bios_tvout(unsigned char __iomem* vbios, struct matrox_bios* bd) { unsigned int i; /* Check for 'IBM .*(V....TVO' string - it means TVO BIOS */ @@ -489,7 +489,7 @@ } } -static void parse_bios(unsigned char* vbios, struct matrox_bios* bd) { +static void parse_bios(unsigned char __iomem* vbios, struct matrox_bios* bd) { unsigned int pins_offset; if (readb(vbios) != 0x55 || readb(vbios + 1) != 0xAA) { @@ -738,7 +738,7 @@ pci_write_config_dword(pdev, PCI_OPTION_REG, opt); #ifdef CONFIG_X86 if (!ACCESS_FBINFO(bios).bios_valid) { - unsigned char* b; + unsigned char __iomem* b; b = ioremap(0x000C0000, 65536); if (!b) { diff -Nru a/drivers/video/maxinefb.c b/drivers/video/maxinefb.c --- a/drivers/video/maxinefb.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/video/maxinefb.c 2004-09-26 10:25:55 -07:00 @@ -126,6 +126,9 @@ unsigned long fb_start; int i; + if (fb_get_options("maxinefb", NULL)) + return -ENODEV; + /* Validate we're on the proper machine type */ if (mips_machtype != MACH_DS5000_XX) { return -EINVAL; diff -Nru a/drivers/video/modedb.c b/drivers/video/modedb.c --- a/drivers/video/modedb.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/video/modedb.c 2004-09-26 10:25:56 -07:00 @@ -670,7 +670,7 @@ * * IMPORTANT: * This function assumes that all modelist entries in - * info->monspecs.modelist are valid. + * info->modelist are valid. * * NOTES: * Finds best matching videomode which has an equal or greater dimension than diff -Nru a/drivers/video/neofb.c b/drivers/video/neofb.c --- a/drivers/video/neofb.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/video/neofb.c 2004-09-26 10:25:56 -07:00 @@ -2268,7 +2268,11 @@ int __init neofb_init(void) { #ifndef MODULE - neofb_setup(fb_get_options("neofb")); + char *option = NULL; + + if (fb_get_options("neofb", &option)) + return -ENODEV; + neofb_setup(option); #endif return pci_register_driver(&neofb_driver); } diff -Nru a/drivers/video/offb.c b/drivers/video/offb.c --- a/drivers/video/offb.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/video/offb.c 2004-09-26 10:25:57 -07:00 @@ -28,7 +28,8 @@ #include #include #include -#ifdef CONFIG_BOOTX_TEXT + +#ifdef CONFIG_PPC32 #include #endif @@ -70,7 +71,7 @@ u_int transp, struct fb_info *info); static int offb_blank(int blank, struct fb_info *info); -#ifdef CONFIG_BOOTX_TEXT +#ifdef CONFIG_PPC32 extern boot_infos_t *boot_infos; #endif @@ -245,18 +246,20 @@ int __init offb_init(void) { - struct device_node *dp; - unsigned int dpy; + struct device_node *dp = NULL, *boot_disp = NULL; #if defined(CONFIG_BOOTX_TEXT) && defined(CONFIG_PPC32) - struct device_node *displays = find_type_devices("display"); struct device_node *macos_display = NULL; +#endif + if (fb_get_options("offb", NULL)) + return -ENODEV; +#if defined(CONFIG_BOOTX_TEXT) && defined(CONFIG_PPC32) /* If we're booted from BootX... */ - if (prom_num_displays == 0 && boot_infos != 0) { + if (boot_infos != 0) { unsigned long addr = (unsigned long) boot_infos->dispDeviceBase; /* find the device node corresponding to the macos display */ - for (dp = displays; dp != NULL; dp = dp->next) { + while ((dp = of_find_node_by_type(dp, "display"))) { int i; /* * Grrr... It looks like the MacOS ATI driver @@ -325,10 +328,19 @@ } #endif /* defined(CONFIG_BOOTX_TEXT) && defined(CONFIG_PPC32) */ - for (dpy = 0; dpy < prom_num_displays; dpy++) { - if ((dp = find_path_device(prom_display_paths[dpy]))) + for (dp = NULL; (dp = of_find_node_by_type(dp, "display"));) { + if (get_property(dp, "linux,opened", NULL) && + get_property(dp, "linux,boot-display", NULL)) { + boot_disp = dp; offb_init_nodriver(dp); + } } + for (dp = NULL; (dp = of_find_node_by_type(dp, "display"));) { + if (get_property(dp, "linux,opened", NULL) && + dp != boot_disp) + offb_init_nodriver(dp); + } + return 0; } diff -Nru a/drivers/video/p9100.c b/drivers/video/p9100.c --- a/drivers/video/p9100.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/video/p9100.c 2004-09-26 10:25:57 -07:00 @@ -340,6 +340,9 @@ struct sbus_bus *sbus; struct sbus_dev *sdev; + if (fb_get_options("p9100fb", NULL)) + return -ENODEV; + for_all_sbusdev(sdev, sbus) { if (!strcmp(sdev->prom_name, "p9100")) p9100_init_one(sdev); diff -Nru a/drivers/video/platinumfb.c b/drivers/video/platinumfb.c --- a/drivers/video/platinumfb.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/video/platinumfb.c 2004-09-26 10:25:56 -07:00 @@ -668,7 +668,11 @@ int __init platinumfb_init(void) { #ifndef MODULE - platinumfb_setup(fb_get_options("platinumfb")); + char *option = NULL; + + if (fb_get_options("platinumfb", &option)) + return -ENODEV; + platinumfb_setup(option); #endif of_register_driver(&platinum_driver); diff -Nru a/drivers/video/pm2fb.c b/drivers/video/pm2fb.c --- a/drivers/video/pm2fb.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/video/pm2fb.c 2004-09-26 10:25:57 -07:00 @@ -1220,7 +1220,11 @@ int __init pm2fb_init(void) { #ifndef MODULE - pm2fb_setup(fb_get_options("pm2fb")); + char *option = NULL; + + if (fb_get_options("pm2fb", &option)) + return -ENODEV; + pm2fb_setup(option); #endif return pci_module_init(&pm2fb_driver); diff -Nru a/drivers/video/pmag-ba-fb.c b/drivers/video/pmag-ba-fb.c --- a/drivers/video/pmag-ba-fb.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/video/pmag-ba-fb.c 2004-09-26 10:25:57 -07:00 @@ -160,6 +160,9 @@ int sid; int found = 0; + if (fb_get_options("pmagbafb", NULL)) + return -ENODEV; + if (TURBOCHANNEL) { while ((sid = search_tc_card("PMAG-BA")) >= 0) { found = 1; diff -Nru a/drivers/video/pmagb-b-fb.c b/drivers/video/pmagb-b-fb.c --- a/drivers/video/pmagb-b-fb.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/video/pmagb-b-fb.c 2004-09-26 10:25:56 -07:00 @@ -163,6 +163,9 @@ int sid; int found = 0; + if (fb_get_options("pmagbbfb", NULL)) + return -ENODEV; + if (TURBOCHANNEL) { while ((sid = search_tc_card("PMAGB-BA")) >= 0) { found = 1; diff -Nru a/drivers/video/pvr2fb.c b/drivers/video/pvr2fb.c --- a/drivers/video/pvr2fb.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/video/pvr2fb.c 2004-09-26 10:25:55 -07:00 @@ -1058,7 +1058,11 @@ int size; #ifndef MODULE - pvr2fb_setup(fb_get_options("pvr2fb")); + char *option = NULL; + + if (fb_get_options("pvr2fb", &option)) + return -ENODEV; + pvr2fb_setup(option); #endif size = sizeof(struct fb_info) + sizeof(struct pvr2fb_par) + 16 * sizeof(u32); diff -Nru a/drivers/video/pxafb.c b/drivers/video/pxafb.c --- a/drivers/video/pxafb.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/video/pxafb.c 2004-09-26 10:25:56 -07:00 @@ -1377,7 +1377,11 @@ int __devinit pxafb_init(void) { #ifndef MODULE - pxafb_setup(fb_get_options("pxafb")); + char *option = NULL; + + if (fb_get_options("pxafb", &option)) + return -ENODEV; + pxafb_setup(option); #endif return driver_register(&pxafb_driver); } diff -Nru a/drivers/video/q40fb.c b/drivers/video/q40fb.c --- a/drivers/video/q40fb.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/video/q40fb.c 2004-09-26 10:25:55 -07:00 @@ -143,6 +143,9 @@ { int ret = 0; + if (fb_get_options("q40fb", NULL)) + return -ENODEV; + ret = driver_register(&q40fb_driver); if (!ret) { diff -Nru a/drivers/video/radeonfb.c b/drivers/video/radeonfb.c --- a/drivers/video/radeonfb.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/video/radeonfb.c 2004-09-26 10:25:57 -07:00 @@ -3137,7 +3137,11 @@ int __init radeonfb_old_init (void) { #ifndef MODULE - radeonfb_old_setup(fb_get_options("radeonfb_old")); + char *option = NULL; + + if (fb_get_options("radeonfb_old", &option)) + return -ENODEV; + radeonfb_old_setup(option); #endif return pci_module_init (&radeonfb_driver); } diff -Nru a/drivers/video/riva/fbdev.c b/drivers/video/riva/fbdev.c --- a/drivers/video/riva/fbdev.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/video/riva/fbdev.c 2004-09-26 10:25:57 -07:00 @@ -1115,14 +1115,14 @@ } if (!mode_valid) { - mode = fb_find_best_mode(var, &info->monspecs.modelist); + mode = fb_find_best_mode(var, &info->modelist); if (mode) { riva_update_var(var, mode); mode_valid = 1; } } - if (!mode_valid && !list_empty(&info->monspecs.modelist)) + if (!mode_valid && !list_empty(&info->modelist)) return -EINVAL; if (var->xres_virtual < var->xres) @@ -1797,7 +1797,7 @@ fb_edid_to_monspecs(par->EDID, &info->monspecs); fb_videomode_to_modelist(info->monspecs.modedb, info->monspecs.modedb_len, - &info->monspecs.modelist); + &info->modelist); riva_update_default_var(var, info); /* if user specified flatpanel, we respect that */ @@ -2141,7 +2141,11 @@ int __devinit rivafb_init(void) { #ifndef MODULE - rivafb_setup(fb_get_options("rivafb")); + char *option = NULL; + + if (fb_get_options("rivafb", &option)) + return -ENODEV; + rivafb_setup(option); #endif if (pci_register_driver(&rivafb_driver) > 0) return 0; diff -Nru a/drivers/video/riva/rivafb-i2c.c b/drivers/video/riva/rivafb-i2c.c --- a/drivers/video/riva/rivafb-i2c.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/video/riva/rivafb-i2c.c 2004-09-26 10:25:56 -07:00 @@ -105,9 +105,9 @@ chan->algo.setscl = riva_gpio_setscl; chan->algo.getsda = riva_gpio_getsda; chan->algo.getscl = riva_gpio_getscl; - chan->algo.udelay = 5; + chan->algo.udelay = 40; chan->algo.mdelay = 5; - chan->algo.timeout = 10; + chan->algo.timeout = 20; chan->algo.data = chan; i2c_set_adapdata(&chan->adapter, chan); diff -Nru a/drivers/video/sa1100fb.c b/drivers/video/sa1100fb.c --- a/drivers/video/sa1100fb.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/video/sa1100fb.c 2004-09-26 10:25:55 -07:00 @@ -1804,6 +1804,9 @@ int __init sa1100fb_init(void) { + if (fb_get_options("sa1100fb", NULL)) + return -ENODEV; + return driver_register(&sa1100fb_driver); } diff -Nru a/drivers/video/sgivwfb.c b/drivers/video/sgivwfb.c --- a/drivers/video/sgivwfb.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/video/sgivwfb.c 2004-09-26 10:25:56 -07:00 @@ -870,7 +870,11 @@ int ret; #ifndef MODULE - sgivwfb_setup(fb_get_options("sgivwfb")); + char *option = NULL; + + if (fb_get_options("sgivwfb", &option)) + return -ENODEV; + sgivwfb_setup(option); #endif ret = driver_register(&sgivwfb_driver); if (!ret) { diff -Nru a/drivers/video/sis/sis_main.c b/drivers/video/sis/sis_main.c --- a/drivers/video/sis/sis_main.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/video/sis/sis_main.c 2004-09-26 10:25:56 -07:00 @@ -5720,7 +5720,11 @@ { #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,8) #ifndef MODULE - sisfb_setup(fb_get_options("sisfb")); + char *option = NULL; + + if (fb_get_options("sisfb", &option)) + return -ENODEV; + sisfb_setup(option); #endif #endif return(pci_module_init(&sisfb_driver)); diff -Nru a/drivers/video/skeletonfb.c b/drivers/video/skeletonfb.c --- a/drivers/video/skeletonfb.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/video/skeletonfb.c 2004-09-26 10:25:55 -07:00 @@ -586,7 +586,11 @@ * For kernel boot options (in 'video=xxxfb:' format) */ #ifndef MODULE - xxxfb_setup(fb_get_options("xxxfb")); + char *option = NULL; + + if (fb_get_options("xxxfb", &option)) + return -ENODEV; + xxxfb_setup(option); #endif /* diff -Nru a/drivers/video/sstfb.c b/drivers/video/sstfb.c --- a/drivers/video/sstfb.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/video/sstfb.c 2004-09-26 10:25:56 -07:00 @@ -1572,7 +1572,11 @@ int __devinit sstfb_init(void) { #ifndef MODULE - sstfb_setup(fb_get_options("sstfb")); + char *option = NULL; + + if (fb_get_options("sstfb", &option)) + return -ENODEV; + sstfb_setup(option); #endif return pci_module_init(&sstfb_driver); } diff -Nru a/drivers/video/stifb.c b/drivers/video/stifb.c --- a/drivers/video/stifb.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/video/stifb.c 2004-09-26 10:25:57 -07:00 @@ -1386,7 +1386,11 @@ int i; #ifndef MODULE - stifb_setup(fb_get_options("stifb")); + char *option = NULL; + + if (fb_get_options("stifb", &option)) + return -ENODEV; + stifb_setup(option); #endif if (stifb_disabled) { printk(KERN_INFO "stifb: disabled by \"stifb=off\" kernel parameter\n"); diff -Nru a/drivers/video/tcx.c b/drivers/video/tcx.c --- a/drivers/video/tcx.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/video/tcx.c 2004-09-26 10:25:55 -07:00 @@ -468,6 +468,9 @@ struct sbus_bus *sbus; struct sbus_dev *sdev; + if (fb_get_options("tcxfb", NULL)) + return -ENODEV; + for_all_sbusdev(sdev, sbus) { if (!strcmp(sdev->prom_name, "tcx")) tcx_init_one(sdev); diff -Nru a/drivers/video/tdfxfb.c b/drivers/video/tdfxfb.c --- a/drivers/video/tdfxfb.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/video/tdfxfb.c 2004-09-26 10:25:55 -07:00 @@ -1363,7 +1363,12 @@ int __init tdfxfb_init(void) { #ifndef MODULE - tdfxfb_setup(fb_get_options("tdfxfb")); + char *option = NULL; + + if (fb_get_options("tdfxfb", &option)) + return -ENODEV; + + tdfxfb_setup(option); #endif return pci_module_init(&tdfxfb_driver); } diff -Nru a/drivers/video/tgafb.c b/drivers/video/tgafb.c --- a/drivers/video/tgafb.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/video/tgafb.c 2004-09-26 10:25:57 -07:00 @@ -1527,7 +1527,11 @@ tgafb_init(void) { #ifndef MODULE - tgafb_setup(fb_get_options("tgafb")); + char *option = NULL; + + if (fb_get_options("tgafb", &option)) + return -ENODEV; + tgafb_setup(option); #endif return pci_module_init(&tgafb_driver); } diff -Nru a/drivers/video/tridentfb.c b/drivers/video/tridentfb.c --- a/drivers/video/tridentfb.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/video/tridentfb.c 2004-09-26 10:25:56 -07:00 @@ -1223,7 +1223,11 @@ int __init tridentfb_init(void) { #ifndef MODULE - tridentfb_setup(fb_get_options("tridentfb")); + char *option = NULL; + + if (fb_get_options("tridentfb", &option)) + return -ENODEV; + tridentfb_setup(option); #endif output("Trident framebuffer %s initializing\n", VERSION); return pci_module_init(&tridentfb_pci_driver); diff -Nru a/drivers/video/tx3912fb.c b/drivers/video/tx3912fb.c --- a/drivers/video/tx3912fb.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/video/tx3912fb.c 2004-09-26 10:25:56 -07:00 @@ -217,8 +217,11 @@ { u_long tx3912fb_paddr = 0; int size = (info->var.bits_per_pixel == 8) ? 256 : 16; + char *option = NULL; - tx3912fb_setup(fb_get_options("tx3912fb")); + if (fb_get_options("tx3912fb", &option)) + return -ENODEV; + tx3912fb_setup(option); /* Disable the video logic */ outl(inl(TX3912_VIDEO_CTRL1) & diff -Nru a/drivers/video/valkyriefb.c b/drivers/video/valkyriefb.c --- a/drivers/video/valkyriefb.c 2004-09-26 10:25:57 -07:00 +++ b/drivers/video/valkyriefb.c 2004-09-26 10:25:57 -07:00 @@ -322,8 +322,11 @@ struct fb_info_valkyrie *p; unsigned long frame_buffer_phys, cmap_regs_phys, flags; int err; + char *option = NULL; - valkyriefb_setup(fb_get_options("valkyriefb")); + if (fb_get_options("valkyriefb", &option)) + return -ENODEV; + valkyriefb_setup(option); #ifdef CONFIG_MAC if (!MACH_IS_MAC) diff -Nru a/drivers/video/vesafb.c b/drivers/video/vesafb.c --- a/drivers/video/vesafb.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/video/vesafb.c 2004-09-26 10:25:55 -07:00 @@ -410,8 +410,11 @@ int __init vesafb_init(void) { int ret; + char *option = NULL; - vesafb_setup(fb_get_options("vesafb")); + /* ignore error return of fb_get_options */ + fb_get_options("vesafb", &option); + vesafb_setup(option); ret = driver_register(&vesafb_driver); if (!ret) { diff -Nru a/drivers/video/vfb.c b/drivers/video/vfb.c --- a/drivers/video/vfb.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/video/vfb.c 2004-09-26 10:25:55 -07:00 @@ -497,7 +497,11 @@ int ret = 0; #ifndef MODULE - vfb_setup(fb_get_options("vfb")); + char *option = NULL; + + if (fb_get_options("vfb", &option)) + return -ENODEV; + vfb_setup(option); #endif if (!vfb_enable) diff -Nru a/drivers/video/vga16fb.c b/drivers/video/vga16fb.c --- a/drivers/video/vga16fb.c 2004-09-26 10:25:55 -07:00 +++ b/drivers/video/vga16fb.c 2004-09-26 10:25:55 -07:00 @@ -1342,9 +1342,13 @@ { int i; int ret; - #ifndef MODULE - vga16fb_setup(fb_get_options("vga16fb")); + char *option = NULL; + + if (fb_get_options("vga16fb", &option)) + return -ENODEV; + + vga16fb_setup(option); #endif printk(KERN_DEBUG "vga16fb: initializing\n"); diff -Nru a/drivers/video/vgastate.c b/drivers/video/vgastate.c --- a/drivers/video/vgastate.c 2004-09-26 10:25:56 -07:00 +++ b/drivers/video/vgastate.c 2004-09-26 10:25:56 -07:00 @@ -32,21 +32,21 @@ __u8 misc; }; -static inline unsigned char vga_rcrtcs(caddr_t regbase, unsigned short iobase, +static inline unsigned char vga_rcrtcs(void __iomem *regbase, unsigned short iobase, unsigned char reg) { vga_w(regbase, iobase + 0x4, reg); return vga_r(regbase, iobase + 0x5); } -static inline void vga_wcrtcs(caddr_t regbase, unsigned short iobase, +static inline void vga_wcrtcs(void __iomem *regbase, unsigned short iobase, unsigned char reg, unsigned char val) { vga_w(regbase, iobase + 0x4, reg); vga_w(regbase, iobase + 0x5, val); } -static void save_vga_text(struct vgastate *state, caddr_t fbbase) +static void save_vga_text(struct vgastate *state, void __iomem *fbbase) { struct regstate *saved = (struct regstate *) state->vidstate; int i; @@ -134,7 +134,7 @@ vga_wseq(state->vgabase, VGA_SEQ_CLOCK_MODE, seq1); } -static void restore_vga_text(struct vgastate *state, caddr_t fbbase) +static void restore_vga_text(struct vgastate *state, void __iomem *fbbase) { struct regstate *saved = (struct regstate *) state->vidstate; int i; @@ -403,7 +403,7 @@ } if (state->flags & VGA_SAVE_FONTS) { - caddr_t fbbase; + void __iomem *fbbase; /* exit if window is less than 32K */ if (state->memsize && state->memsize < 4 * 8192) { @@ -473,7 +473,7 @@ restore_vga_mode(state); if (state->flags & VGA_SAVE_FONTS) { - caddr_t fbbase = ioremap(state->membase, state->memsize); + void __iomem *fbbase = ioremap(state->membase, state->memsize); if (!fbbase) { vga_cleanup(state); diff -Nru a/fs/adfs/adfs.h b/fs/adfs/adfs.h --- a/fs/adfs/adfs.h 2004-09-26 10:25:57 -07:00 +++ b/fs/adfs/adfs.h 2004-09-26 10:25:57 -07:00 @@ -66,7 +66,7 @@ /* Inode stuff */ struct inode *adfs_iget(struct super_block *sb, struct object_info *obj); -void adfs_write_inode(struct inode *inode,int unused); +int adfs_write_inode(struct inode *inode,int unused); int adfs_notify_change(struct dentry *dentry, struct iattr *attr); /* map.c */ diff -Nru a/fs/adfs/inode.c b/fs/adfs/inode.c --- a/fs/adfs/inode.c 2004-09-26 10:25:56 -07:00 +++ b/fs/adfs/inode.c 2004-09-26 10:25:56 -07:00 @@ -373,10 +373,11 @@ * The adfs-specific inode data has already been updated by * adfs_notify_change() */ -void adfs_write_inode(struct inode *inode, int unused) +int adfs_write_inode(struct inode *inode, int unused) { struct super_block *sb = inode->i_sb; struct object_info obj; + int ret; lock_kernel(); obj.file_id = inode->i_ino; @@ -387,7 +388,8 @@ obj.attr = ADFS_I(inode)->attr; obj.size = inode->i_size; - adfs_dir_update(sb, &obj); + ret = adfs_dir_update(sb, &obj); unlock_kernel(); + return ret; } MODULE_LICENSE("GPL"); diff -Nru a/fs/affs/inode.c b/fs/affs/inode.c --- a/fs/affs/inode.c 2004-09-26 10:25:56 -07:00 +++ b/fs/affs/inode.c 2004-09-26 10:25:56 -07:00 @@ -181,7 +181,7 @@ return; } -void +int affs_write_inode(struct inode *inode, int unused) { struct super_block *sb = inode->i_sb; @@ -194,11 +194,11 @@ if (!inode->i_nlink) // possibly free block - return; + return 0; bh = affs_bread(sb, inode->i_ino); if (!bh) { affs_error(sb,"write_inode","Cannot read block %lu",inode->i_ino); - return; + return -EIO; } tail = AFFS_TAIL(sb, bh); if (tail->stype == cpu_to_be32(ST_ROOT)) { @@ -226,6 +226,7 @@ mark_buffer_dirty_inode(bh, inode); affs_brelse(bh); affs_free_prealloc(inode); + return 0; } int diff -Nru a/fs/afs/cmservice.c b/fs/afs/cmservice.c --- a/fs/afs/cmservice.c 2004-09-26 10:25:56 -07:00 +++ b/fs/afs/cmservice.c 2004-09-26 10:25:56 -07:00 @@ -424,7 +424,7 @@ { struct afs_callback *cb, *pcb; int loop; - u32 *fp, *bp; + __be32 *fp, *bp; fp = rxrpc_call_alloc_scratch(call, qty); diff -Nru a/fs/afs/dir.c b/fs/afs/dir.c --- a/fs/afs/dir.c 2004-09-26 10:25:56 -07:00 +++ b/fs/afs/dir.c 2004-09-26 10:25:56 -07:00 @@ -65,9 +65,9 @@ struct { uint8_t valid; uint8_t unused[1]; - uint16_t hash_next; - uint32_t vnode; - uint32_t unique; + __be16 hash_next; + __be32 vnode; + __be32 unique; uint8_t name[16]; uint8_t overflow[4]; /* if any char of the name (inc * NUL) reaches here, consume @@ -78,8 +78,8 @@ /* AFS directory page header (one at the beginning of every 2048-byte chunk) */ struct afs_dir_pagehdr { - uint16_t npages; - uint16_t magic; + __be16 npages; + __be16 magic; #define AFS_DIR_MAGIC htons(1234) uint8_t nentries; uint8_t bitmap[8]; @@ -308,7 +308,7 @@ blkoff + offset * sizeof(union afs_dirent), ntohl(dire->u.vnode), filldir == afs_dir_lookup_filldir ? - dire->u.unique : DT_UNKNOWN); + ntohl(dire->u.unique) : DT_UNKNOWN); if (ret < 0) { _leave(" = 0 [full]"); return 0; @@ -416,7 +416,7 @@ struct afs_dir_lookup_cookie *cookie = _cookie; _enter("{%s,%Zu},%s,%u,,%lu,%u", - cookie->name, cookie->nlen, name, nlen, ino, ntohl(dtype)); + cookie->name, cookie->nlen, name, nlen, ino, dtype); if (cookie->nlen != nlen || memcmp(cookie->name, name, nlen) != 0) { _leave(" = 0 [no]"); @@ -424,7 +424,7 @@ } cookie->fid.vnode = ino; - cookie->fid.unique = ntohl(dtype); + cookie->fid.unique = dtype; cookie->found = 1; _leave(" = -1 [found]"); diff -Nru a/fs/afs/fsclient.c b/fs/afs/fsclient.c --- a/fs/afs/fsclient.c 2004-09-26 10:25:57 -07:00 +++ b/fs/afs/fsclient.c 2004-09-26 10:25:57 -07:00 @@ -307,7 +307,7 @@ struct kvec piov[1]; size_t sent; int ret; - u32 *bp; + __be32 *bp; DECLARE_WAITQUEUE(myself, current); @@ -432,7 +432,7 @@ struct kvec piov[1]; size_t sent; int ret; - u32 *bp; + __be32 *bp; DECLARE_WAITQUEUE(myself, current); @@ -583,7 +583,7 @@ struct kvec piov[1]; size_t sent; int ret; - u32 *bp; + __be32 *bp; DECLARE_WAITQUEUE(myself, current); diff -Nru a/fs/afs/vlclient.c b/fs/afs/vlclient.c --- a/fs/afs/vlclient.c 2004-09-26 10:25:55 -07:00 +++ b/fs/afs/vlclient.c 2004-09-26 10:25:55 -07:00 @@ -101,7 +101,7 @@ struct kvec piov[1]; size_t sent; int ret; - u32 param[1]; + __be32 param[1]; DECLARE_WAITQUEUE(myself, current); @@ -193,7 +193,7 @@ unsigned tmp; size_t sent; int ret, loop; - u32 *bp, param[2], zero; + __be32 *bp, param[2], zero; _enter(",%*.*s,%u,", volnamesz, volnamesz, volname, volnamesz); @@ -328,7 +328,7 @@ unsigned tmp; size_t sent; int ret, loop; - u32 *bp, param[3]; + __be32 *bp, param[3]; _enter(",%x,%d,", volid, voltype); @@ -464,7 +464,7 @@ struct kvec piov[1]; size_t sent; int ret; - u32 param[3]; + __be32 param[3]; _enter(",%x,%d,", volid, voltype); @@ -547,7 +547,8 @@ int afs_rxvl_get_entry_by_id_async2(struct afs_async_op *op, struct afs_cache_vlocation *entry) { - unsigned *bp, tmp; + __be32 *bp; + __u32 tmp; int loop, ret; _enter("{op=%p cst=%u}", op, op->call->app_call_state); diff -Nru a/fs/bfs/inode.c b/fs/bfs/inode.c --- a/fs/bfs/inode.c 2004-09-26 10:25:56 -07:00 +++ b/fs/bfs/inode.c 2004-09-26 10:25:56 -07:00 @@ -85,7 +85,7 @@ brelse(bh); } -static void bfs_write_inode(struct inode * inode, int unused) +static int bfs_write_inode(struct inode * inode, int unused) { unsigned long ino = inode->i_ino; struct bfs_inode * di; @@ -94,7 +94,7 @@ if (ino < BFS_ROOT_INO || ino > BFS_SB(inode->i_sb)->si_lasti) { printf("Bad inode number %s:%08lx\n", inode->i_sb->s_id, ino); - return; + return -EIO; } lock_kernel(); @@ -103,7 +103,7 @@ if (!bh) { printf("Unable to read inode %s:%08lx\n", inode->i_sb->s_id, ino); unlock_kernel(); - return; + return -EIO; } off = (ino - BFS_ROOT_INO)%BFS_INODES_PER_BLOCK; @@ -129,6 +129,7 @@ mark_buffer_dirty(bh); brelse(bh); unlock_kernel(); + return 0; } static void bfs_delete_inode(struct inode * inode) diff -Nru a/fs/binfmt_elf.c b/fs/binfmt_elf.c --- a/fs/binfmt_elf.c 2004-09-26 10:25:56 -07:00 +++ b/fs/binfmt_elf.c 2004-09-26 10:25:56 -07:00 @@ -488,25 +488,33 @@ unsigned long elf_entry, interp_load_addr = 0; unsigned long start_code, end_code, start_data, end_data; unsigned long reloc_func_desc = 0; - struct elfhdr elf_ex; - struct elfhdr interp_elf_ex; - struct exec interp_ex; char passed_fileno[6]; struct files_struct *files; int have_pt_gnu_stack, executable_stack = EXSTACK_DEFAULT; unsigned long def_flags = 0; + struct { + struct elfhdr elf_ex; + struct elfhdr interp_elf_ex; + struct exec interp_ex; + } *loc; + + loc = kmalloc(sizeof(*loc), GFP_KERNEL); + if (!loc) { + retval = -ENOMEM; + goto out_ret; + } /* Get the exec-header */ - elf_ex = *((struct elfhdr *) bprm->buf); + loc->elf_ex = *((struct elfhdr *) bprm->buf); retval = -ENOEXEC; /* First of all, some simple consistency checks */ - if (memcmp(elf_ex.e_ident, ELFMAG, SELFMAG) != 0) + if (memcmp(loc->elf_ex.e_ident, ELFMAG, SELFMAG) != 0) goto out; - if (elf_ex.e_type != ET_EXEC && elf_ex.e_type != ET_DYN) + if (loc->elf_ex.e_type != ET_EXEC && loc->elf_ex.e_type != ET_DYN) goto out; - if (!elf_check_arch(&elf_ex)) + if (!elf_check_arch(&loc->elf_ex)) goto out; if (!bprm->file->f_op||!bprm->file->f_op->mmap) goto out; @@ -514,16 +522,16 @@ /* Now read in all of the header information */ retval = -ENOMEM; - if (elf_ex.e_phentsize != sizeof(struct elf_phdr)) + if (loc->elf_ex.e_phentsize != sizeof(struct elf_phdr)) goto out; - if (elf_ex.e_phnum > 65536U / sizeof(struct elf_phdr)) + if (loc->elf_ex.e_phnum > 65536U / sizeof(struct elf_phdr)) goto out; - size = elf_ex.e_phnum * sizeof(struct elf_phdr); + size = loc->elf_ex.e_phnum * sizeof(struct elf_phdr); elf_phdata = (struct elf_phdr *) kmalloc(size, GFP_KERNEL); if (!elf_phdata) goto out; - retval = kernel_read(bprm->file, elf_ex.e_phoff, (char *) elf_phdata, size); + retval = kernel_read(bprm->file, loc->elf_ex.e_phoff, (char *) elf_phdata, size); if (retval < 0) goto out_free_ph; @@ -554,7 +562,7 @@ start_data = 0; end_data = 0; - for (i = 0; i < elf_ex.e_phnum; i++) { + for (i = 0; i < loc->elf_ex.e_phnum; i++) { if (elf_ppnt->p_type == PT_INTERP) { /* This is the program interpreter used for * shared libraries - for now assume that this @@ -601,7 +609,7 @@ * switch really is going to happen - do this in * flush_thread(). - akpm */ - SET_PERSONALITY(elf_ex, ibcs2_interpreter); + SET_PERSONALITY(loc->elf_ex, ibcs2_interpreter); interpreter = open_exec(elf_interpreter); retval = PTR_ERR(interpreter); @@ -612,15 +620,15 @@ goto out_free_dentry; /* Get the exec headers */ - interp_ex = *((struct exec *) bprm->buf); - interp_elf_ex = *((struct elfhdr *) bprm->buf); + loc->interp_ex = *((struct exec *) bprm->buf); + loc->interp_elf_ex = *((struct elfhdr *) bprm->buf); break; } elf_ppnt++; } elf_ppnt = elf_phdata; - for (i = 0; i < elf_ex.e_phnum; i++, elf_ppnt++) + for (i = 0; i < loc->elf_ex.e_phnum; i++, elf_ppnt++) if (elf_ppnt->p_type == PT_GNU_STACK) { if (elf_ppnt->p_flags & PF_X) executable_stack = EXSTACK_ENABLE_X; @@ -628,19 +636,19 @@ executable_stack = EXSTACK_DISABLE_X; break; } - have_pt_gnu_stack = (i < elf_ex.e_phnum); + have_pt_gnu_stack = (i < loc->elf_ex.e_phnum); /* Some simple consistency checks for the interpreter */ if (elf_interpreter) { interpreter_type = INTERPRETER_ELF | INTERPRETER_AOUT; /* Now figure out which format our binary is */ - if ((N_MAGIC(interp_ex) != OMAGIC) && - (N_MAGIC(interp_ex) != ZMAGIC) && - (N_MAGIC(interp_ex) != QMAGIC)) + if ((N_MAGIC(loc->interp_ex) != OMAGIC) && + (N_MAGIC(loc->interp_ex) != ZMAGIC) && + (N_MAGIC(loc->interp_ex) != QMAGIC)) interpreter_type = INTERPRETER_ELF; - if (memcmp(interp_elf_ex.e_ident, ELFMAG, SELFMAG) != 0) + if (memcmp(loc->interp_elf_ex.e_ident, ELFMAG, SELFMAG) != 0) interpreter_type &= ~INTERPRETER_ELF; retval = -ELIBBAD; @@ -656,11 +664,11 @@ } /* Verify the interpreter has a valid arch */ if ((interpreter_type == INTERPRETER_ELF) && - !elf_check_arch(&interp_elf_ex)) + !elf_check_arch(&loc->interp_elf_ex)) goto out_free_dentry; } else { /* Executables without an interpreter also need a personality */ - SET_PERSONALITY(elf_ex, ibcs2_interpreter); + SET_PERSONALITY(loc->elf_ex, ibcs2_interpreter); } /* OK, we are done with that, now set up the arg stuff, @@ -700,8 +708,8 @@ /* Do this immediately, since STACK_TOP as used in setup_arg_pages may depend on the personality. */ - SET_PERSONALITY(elf_ex, ibcs2_interpreter); - if (elf_read_implies_exec(elf_ex, have_pt_gnu_stack)) + SET_PERSONALITY(loc->elf_ex, ibcs2_interpreter); + if (elf_read_implies_exec(loc->elf_ex, have_pt_gnu_stack)) current->personality |= READ_IMPLIES_EXEC; arch_pick_mmap_layout(current->mm); @@ -723,7 +731,7 @@ the image should be loaded at fixed address, not at a variable address. */ - for(i = 0, elf_ppnt = elf_phdata; i < elf_ex.e_phnum; i++, elf_ppnt++) { + for(i = 0, elf_ppnt = elf_phdata; i < loc->elf_ex.e_phnum; i++, elf_ppnt++) { int elf_prot = 0, elf_flags; unsigned long k, vaddr; @@ -758,9 +766,9 @@ elf_flags = MAP_PRIVATE|MAP_DENYWRITE|MAP_EXECUTABLE; vaddr = elf_ppnt->p_vaddr; - if (elf_ex.e_type == ET_EXEC || load_addr_set) { + if (loc->elf_ex.e_type == ET_EXEC || load_addr_set) { elf_flags |= MAP_FIXED; - } else if (elf_ex.e_type == ET_DYN) { + } else if (loc->elf_ex.e_type == ET_DYN) { /* Try and get dynamic programs out of the way of the default mmap base, as well as whatever program they might try to exec. This is because the brk will follow the loader, and is not movable. */ @@ -774,7 +782,7 @@ if (!load_addr_set) { load_addr_set = 1; load_addr = (elf_ppnt->p_vaddr - elf_ppnt->p_offset); - if (elf_ex.e_type == ET_DYN) { + if (loc->elf_ex.e_type == ET_DYN) { load_bias += error - ELF_PAGESTART(load_bias + vaddr); load_addr += load_bias; @@ -811,7 +819,7 @@ elf_brk = k; } - elf_ex.e_entry += load_bias; + loc->elf_ex.e_entry += load_bias; elf_bss += load_bias; elf_brk += load_bias; start_code += load_bias; @@ -833,10 +841,10 @@ if (elf_interpreter) { if (interpreter_type == INTERPRETER_AOUT) - elf_entry = load_aout_interp(&interp_ex, + elf_entry = load_aout_interp(&loc->interp_ex, interpreter); else - elf_entry = load_elf_interp(&interp_elf_ex, + elf_entry = load_elf_interp(&loc->interp_elf_ex, interpreter, &interp_load_addr); if (BAD_ADDR(elf_entry)) { @@ -851,7 +859,7 @@ fput(interpreter); kfree(elf_interpreter); } else { - elf_entry = elf_ex.e_entry; + elf_entry = loc->elf_ex.e_entry; } kfree(elf_phdata); @@ -863,7 +871,7 @@ compute_creds(bprm); current->flags &= ~PF_FORKNOEXEC; - create_elf_tables(bprm, &elf_ex, (interpreter_type == INTERPRETER_AOUT), + create_elf_tables(bprm, &loc->elf_ex, (interpreter_type == INTERPRETER_AOUT), load_addr, interp_load_addr); /* N.B. passed_fileno might not be initialized? */ if (interpreter_type == INTERPRETER_AOUT) @@ -908,6 +916,8 @@ } retval = 0; out: + kfree(loc); +out_ret: return retval; /* error cleanup */ diff -Nru a/fs/bio.c b/fs/bio.c --- a/fs/bio.c 2004-09-26 10:25:56 -07:00 +++ b/fs/bio.c 2004-09-26 10:25:56 -07:00 @@ -137,33 +137,29 @@ **/ struct bio *bio_alloc(int gfp_mask, int nr_iovecs) { - struct bio_vec *bvl = NULL; - unsigned long idx; - struct bio *bio; - - bio = mempool_alloc(bio_pool, gfp_mask); - if (unlikely(!bio)) - goto out; + struct bio *bio = mempool_alloc(bio_pool, gfp_mask); - bio_init(bio); + if (likely(bio)) { + struct bio_vec *bvl = NULL; - if (unlikely(!nr_iovecs)) - goto noiovec; - - bvl = bvec_alloc(gfp_mask, nr_iovecs, &idx); - if (bvl) { - bio->bi_flags |= idx << BIO_POOL_OFFSET; - bio->bi_max_vecs = bvec_array[idx].nr_vecs; -noiovec: + bio_init(bio); + if (likely(nr_iovecs)) { + unsigned long idx; + + bvl = bvec_alloc(gfp_mask, nr_iovecs, &idx); + if (unlikely(!bvl)) { + mempool_free(bio, bio_pool); + bio = NULL; + goto out; + } + bio->bi_flags |= idx << BIO_POOL_OFFSET; + bio->bi_max_vecs = bvec_array[idx].nr_vecs; + } bio->bi_io_vec = bvl; bio->bi_destructor = bio_destructor; -out: - return bio; } - - mempool_free(bio, bio_pool); - bio = NULL; - goto out; +out: + return bio; } /** @@ -606,18 +602,6 @@ { struct bio_vec *bvec; int i; - - /* - * find original bio if it was bounced - */ - if (bio->bi_private) { - /* - * someone stole our bio, must not happen - */ - BUG_ON(!bio_flagged(bio, BIO_BOUNCED)); - - bio = bio->bi_private; - } /* * make sure we dirty pages we wrote to diff -Nru a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c --- a/fs/cifs/cifs_debug.c 2004-09-26 10:25:56 -07:00 +++ b/fs/cifs/cifs_debug.c 2004-09-26 10:25:56 -07:00 @@ -126,26 +126,28 @@ i = 0; read_lock(&GlobalSMBSeslock); list_for_each(tmp, &GlobalTreeConnectionList) { + __u32 dev_type; i++; tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList); + dev_type = le32_to_cpu(tcon->fsDevInfo.DeviceType); length = sprintf(buf, "\n%d) %s Uses: %d Type: %s Characteristics: 0x%x Attributes: 0x%x\nPathComponentMax: %d Status: %d", i, tcon->treeName, atomic_read(&tcon->useCount), tcon->nativeFileSystem, - tcon->fsDevInfo.DeviceCharacteristics, - tcon->fsAttrInfo.Attributes, - tcon->fsAttrInfo.MaxPathNameComponentLength,tcon->tidStatus); + le32_to_cpu(tcon->fsDevInfo.DeviceCharacteristics), + le32_to_cpu(tcon->fsAttrInfo.Attributes), + le32_to_cpu(tcon->fsAttrInfo.MaxPathNameComponentLength), + tcon->tidStatus); buf += length; - if (tcon->fsDevInfo.DeviceType == FILE_DEVICE_DISK) + if (dev_type == FILE_DEVICE_DISK) length = sprintf(buf, " type: DISK "); - else if (tcon->fsDevInfo.DeviceType == FILE_DEVICE_CD_ROM) + else if (dev_type == FILE_DEVICE_CD_ROM) length = sprintf(buf, " type: CDROM "); else length = - sprintf(buf, " type: %d ", - tcon->fsDevInfo.DeviceType); + sprintf(buf, " type: %d ", dev_type); buf += length; if(tcon->tidStatus == CifsNeedReconnect) { buf += sprintf(buf, "\tDISCONNECTED "); diff -Nru a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c --- a/fs/cifs/cifsencrypt.c 2004-09-26 10:25:56 -07:00 +++ b/fs/cifs/cifsencrypt.c 2004-09-26 10:25:56 -07:00 @@ -61,7 +61,7 @@ if((cifs_pdu == NULL) || (ses == NULL)) return -EINVAL; - if((le32_to_cpu(cifs_pdu->Flags2) & SMBFLG2_SECURITY_SIGNATURE) == 0) + if((cifs_pdu->Flags2 & SMBFLG2_SECURITY_SIGNATURE) == 0) return rc; spin_lock(&GlobalMid_Lock); @@ -107,13 +107,11 @@ if(memcmp(cifs_pdu->Signature.SecuritySignature,"BSRSPYL ",8)==0) cFYI(1,("dummy signature received for smb command 0x%x",cifs_pdu->Command)); - expected_sequence_number = cpu_to_le32(expected_sequence_number); - /* save off the origiginal signature so we can modify the smb and check its signature against what the server sent */ memcpy(server_response_sig,cifs_pdu->Signature.SecuritySignature,8); - cifs_pdu->Signature.Sequence.SequenceNumber = expected_sequence_number; + cifs_pdu->Signature.Sequence.SequenceNumber = cpu_to_le32(expected_sequence_number); cifs_pdu->Signature.Sequence.Reserved = 0; rc = cifs_calculate_signature(cifs_pdu, mac_key, diff -Nru a/fs/cifs/cifspdu.h b/fs/cifs/cifspdu.h --- a/fs/cifs/cifspdu.h 2004-09-26 10:25:57 -07:00 +++ b/fs/cifs/cifspdu.h 2004-09-26 10:25:57 -07:00 @@ -137,15 +137,15 @@ /* * SMB flag2 definitions */ -#define SMBFLG2_KNOWS_LONG_NAMES 0x0001 /* can send long (non-8.3) path names in response */ -#define SMBFLG2_KNOWS_EAS 0x0002 -#define SMBFLG2_SECURITY_SIGNATURE 0x0004 -#define SMBFLG2_IS_LONG_NAME 0x0040 -#define SMBFLG2_EXT_SEC 0x0800 -#define SMBFLG2_DFS 0x1000 -#define SMBFLG2_PAGING_IO 0x2000 -#define SMBFLG2_ERR_STATUS 0x4000 -#define SMBFLG2_UNICODE 0x8000 +#define SMBFLG2_KNOWS_LONG_NAMES cpu_to_le16(1) /* can send long (non-8.3) path names in response */ +#define SMBFLG2_KNOWS_EAS cpu_to_le16(2) +#define SMBFLG2_SECURITY_SIGNATURE cpu_to_le16(4) +#define SMBFLG2_IS_LONG_NAME cpu_to_le16(0x40) +#define SMBFLG2_EXT_SEC cpu_to_le16(0x80) +#define SMBFLG2_DFS cpu_to_le16(0x1000) +#define SMBFLG2_PAGING_IO cpu_to_le16(0x2000) +#define SMBFLG2_ERR_STATUS cpu_to_le16(0x4000) +#define SMBFLG2_UNICODE cpu_to_le16(0x8000) /* * These are the file access permission bits defined in CIFS for the @@ -303,23 +303,23 @@ struct { __u8 ErrorClass; __u8 Reserved; - __u16 Error; /* note: treated as little endian (le) on wire */ + __le16 Error; } DosError; - __u32 CifsError; /* note: le */ + __le32 CifsError; } Status; __u8 Flags; - __u16 Flags2; /* note: le */ - __u16 PidHigh; /* note: le */ + __le16 Flags2; /* note: le */ + __le16 PidHigh; union { struct { - __u32 SequenceNumber; /* le */ + __le32 SequenceNumber; /* le */ __u32 Reserved; /* zero */ } Sequence; __u8 SecuritySignature[8]; /* le */ } Signature; __u8 pad[2]; __u16 Tid; - __u16 Pid; /* note: le */ + __le16 Pid; __u16 Uid; __u16 Mid; __u8 WordCount; @@ -328,7 +328,7 @@ #define BCC(smb_var) ( *(__u16 *)((char *)smb_var + sizeof(struct smb_hdr) + (2* smb_var->WordCount) ) ) /* given a pointer to an smb_hdr retrieve the pointer to the byte area */ -#define pByteArea(smb_var) ((char *)smb_var + sizeof(struct smb_hdr) + (2* smb_var->WordCount) + 2 ) +#define pByteArea(smb_var) ((unsigned char *)smb_var + sizeof(struct smb_hdr) + (2* smb_var->WordCount) + 2 ) /* * Computer Name Length @@ -373,23 +373,23 @@ typedef struct negotiate_req { struct smb_hdr hdr; /* wct = 0 */ - __u16 ByteCount; + __le16 ByteCount; unsigned char DialectsArray[1]; } NEGOTIATE_REQ; typedef struct negotiate_rsp { struct smb_hdr hdr; /* wct = 17 */ - __u16 DialectIndex; + __le16 DialectIndex; __u8 SecurityMode; - __u16 MaxMpxCount; - __u16 MaxNumberVcs; - __u32 MaxBufferSize; - __u32 MaxRawSize; - __u32 SessionKey; - __u32 Capabilities; /* see below */ - __u32 SystemTimeLow; - __u32 SystemTimeHigh; - __u16 ServerTimeZone; + __le16 MaxMpxCount; + __le16 MaxNumberVcs; + __le32 MaxBufferSize; + __le32 MaxRawSize; + __le32 SessionKey; + __le32 Capabilities; /* see below */ + __le32 SystemTimeLow; + __le32 SystemTimeHigh; + __le16 ServerTimeZone; __u8 EncryptionKeyLength; __u16 ByteCount; union { @@ -436,15 +436,15 @@ struct smb_hdr hdr; /* wct = 12 */ __u8 AndXCommand; __u8 AndXReserved; - __u16 AndXOffset; - __u16 MaxBufferSize; - __u16 MaxMpxCount; - __u16 VcNumber; + __le16 AndXOffset; + __le16 MaxBufferSize; + __le16 MaxMpxCount; + __le16 VcNumber; __u32 SessionKey; - __u16 SecurityBlobLength; + __le16 SecurityBlobLength; __u32 Reserved; - __u32 Capabilities; /* see below */ - __u16 ByteCount; + __le32 Capabilities; /* see below */ + __le16 ByteCount; unsigned char SecurityBlob[1]; /* followed by */ /* STRING NativeOS */ /* STRING NativeLanMan */ @@ -454,16 +454,16 @@ struct smb_hdr hdr; /* wct = 13 */ __u8 AndXCommand; __u8 AndXReserved; - __u16 AndXOffset; - __u16 MaxBufferSize; - __u16 MaxMpxCount; - __u16 VcNumber; + __le16 AndXOffset; + __le16 MaxBufferSize; + __le16 MaxMpxCount; + __le16 VcNumber; __u32 SessionKey; - __u16 CaseInsensitivePasswordLength; /* ASCII password length */ - __u16 CaseSensitivePasswordLength; /* Unicode password length */ + __le16 CaseInsensitivePasswordLength; /* ASCII password length */ + __le16 CaseSensitivePasswordLength; /* Unicode password length */ __u32 Reserved; /* see below */ - __u32 Capabilities; - __u16 ByteCount; + __le32 Capabilities; + __le16 ByteCount; unsigned char CaseInsensitivePassword[1]; /* followed by: */ /* unsigned char * CaseSensitivePassword; */ /* STRING AccountName */ @@ -476,9 +476,9 @@ struct smb_hdr hdr; /* wct = 4 */ __u8 AndXCommand; __u8 AndXReserved; - __u16 AndXOffset; - __u16 Action; /* see below */ - __u16 SecurityBlobLength; + __le16 AndXOffset; + __le16 Action; /* see below */ + __le16 SecurityBlobLength; __u16 ByteCount; unsigned char SecurityBlob[1]; /* followed by */ /* unsigned char * NativeOS; */ @@ -490,14 +490,14 @@ struct smb_hdr hdr; /* wct = 10 */ __u8 AndXCommand; __u8 AndXReserved; - __u16 AndXOffset; - __u16 MaxBufferSize; - __u16 MaxMpxCount; - __u16 VcNumber; + __le16 AndXOffset; + __le16 MaxBufferSize; + __le16 MaxMpxCount; + __le16 VcNumber; __u32 SessionKey; - __u16 PassswordLength; + __le16 PassswordLength; __u32 Reserved; - __u16 ByteCount; + __le16 ByteCount; unsigned char AccountPassword[1]; /* followed by */ /* STRING AccountName */ /* STRING PrimaryDomain */ @@ -509,8 +509,8 @@ struct smb_hdr hdr; /* wct = 3 */ __u8 AndXCommand; __u8 AndXReserved; - __u16 AndXOffset; - __u16 Action; /* see below */ + __le16 AndXOffset; + __le16 Action; /* see below */ __u16 ByteCount; unsigned char NativeOS[1]; /* followed by */ /* unsigned char * NativeLanMan; */ @@ -537,10 +537,10 @@ struct smb_hdr hdr; /* wct = 4 */ __u8 AndXCommand; __u8 AndXReserved; - __u16 AndXOffset; - __u16 Flags; /* see below */ - __u16 PasswordLength; - __u16 ByteCount; + __le16 AndXOffset; + __le16 Flags; /* see below */ + __le16 PasswordLength; + __le16 ByteCount; unsigned char Password[1]; /* followed by */ /* STRING Path *//* \\server\share name */ /* STRING Service */ @@ -550,8 +550,8 @@ struct smb_hdr hdr; /* wct = 3 *//* note that Win2000 has sent wct=7 in some cases on responses. Four unspecified words followed OptionalSupport */ __u8 AndXCommand; __u8 AndXReserved; - __u16 AndXOffset; - __u16 OptionalSupport; /* see below */ + __le16 AndXOffset; + __le16 OptionalSupport; /* see below */ __u16 ByteCount; unsigned char Service[1]; /* always ASCII, not Unicode */ /* STRING NativeFileSystem */ @@ -619,20 +619,20 @@ struct smb_hdr hdr; /* wct = 24 */ __u8 AndXCommand; __u8 AndXReserved; - __u16 AndXOffset; + __le16 AndXOffset; __u8 Reserved; /* Must Be Zero */ - __u16 NameLength; - __u32 OpenFlags; - __u32 RootDirectoryFid; - __u32 DesiredAccess; - __u64 AllocationSize; - __u32 FileAttributes; - __u32 ShareAccess; - __u32 CreateDisposition; - __u32 CreateOptions; - __u32 ImpersonationLevel; + __le16 NameLength; + __le32 OpenFlags; + __le32 RootDirectoryFid; + __le32 DesiredAccess; + __le64 AllocationSize; + __le32 FileAttributes; + __le32 ShareAccess; + __le32 CreateDisposition; + __le32 CreateOptions; + __le32 ImpersonationLevel; __u8 SecurityFlags; - __u16 ByteCount; + __le16 ByteCount; char fileName[1]; } OPEN_REQ; @@ -649,19 +649,19 @@ struct smb_hdr hdr; /* wct = 34 BB */ __u8 AndXCommand; __u8 AndXReserved; - __u16 AndXOffset; + __le16 AndXOffset; __u8 OplockLevel; __u16 Fid; - __u32 CreateAction; - __u64 CreationTime; - __u64 LastAccessTime; - __u64 LastWriteTime; - __u64 ChangeTime; - __u32 FileAttributes; - __u64 AllocationSize; - __u64 EndOfFile; - __u16 FileType; - __u16 DeviceState; + __le32 CreateAction; + __le64 CreationTime; + __le64 LastAccessTime; + __le64 LastWriteTime; + __le64 ChangeTime; + __le32 FileAttributes; + __le64 AllocationSize; + __le64 EndOfFile; + __le16 FileType; + __le16 DeviceState; __u8 DirectoryFlag; __u16 ByteCount; /* bct = 0 */ } OPEN_RSP; @@ -670,17 +670,17 @@ struct smb_hdr hdr; /* wct = 14 */ __u8 AndXCommand; __u8 AndXReserved; - __u16 AndXOffset; + __le16 AndXOffset; __u16 Fid; - __u32 OffsetLow; + __le32 OffsetLow; __u32 Reserved; - __u16 WriteMode; - __u16 Remaining; - __u16 DataLengthHigh; - __u16 DataLengthLow; - __u16 DataOffset; - __u32 OffsetHigh; - __u16 ByteCount; + __le16 WriteMode; + __le16 Remaining; + __le16 DataLengthHigh; + __le16 DataLengthLow; + __le16 DataOffset; + __le32 OffsetHigh; + __le16 ByteCount; __u8 Pad; /* BB check for whether padded to DWORD boundary and optimum performance here */ char Data[1]; } WRITE_REQ; @@ -689,10 +689,10 @@ struct smb_hdr hdr; /* wct = 6 */ __u8 AndXCommand; __u8 AndXReserved; - __u16 AndXOffset; - __u16 Count; - __u16 Remaining; - __u32 Reserved; + __le16 AndXOffset; + __le16 Count; + __le16 Remaining; + __le32 Reserved; __u16 ByteCount; } WRITE_RSP; @@ -700,28 +700,28 @@ struct smb_hdr hdr; /* wct = 12 */ __u8 AndXCommand; __u8 AndXReserved; - __u16 AndXOffset; + __le16 AndXOffset; __u16 Fid; - __u32 OffsetLow; - __u16 MaxCount; - __u16 MinCount; /* obsolete */ - __u32 MaxCountHigh; - __u16 Remaining; - __u32 OffsetHigh; - __u16 ByteCount; + __le32 OffsetLow; + __le16 MaxCount; + __le16 MinCount; /* obsolete */ + __le32 MaxCountHigh; + __le16 Remaining; + __le32 OffsetHigh; + __le16 ByteCount; } READ_REQ; typedef struct smb_com_read_rsp { struct smb_hdr hdr; /* wct = 12 */ __u8 AndXCommand; __u8 AndXReserved; - __u16 AndXOffset; - __u16 Remaining; - __u16 DataCompactionMode; - __u16 Reserved; - __u16 DataLength; - __u16 DataOffset; - __u16 DataLengthHigh; + __le16 AndXOffset; + __le16 Remaining; + __le16 DataCompactionMode; + __le16 Reserved; + __le16 DataLength; + __le16 DataOffset; + __le16 DataLengthHigh; __u64 Reserved2; __u16 ByteCount; __u8 Pad; /* BB check for whether padded to DWORD boundary and optimum performance here */ @@ -729,12 +729,12 @@ } READ_RSP; typedef struct locking_andx_range { - __u16 Pid; - __u16 Pad; - __u32 OffsetHigh; - __u32 OffsetLow; - __u32 LengthHigh; - __u32 LengthLow; + __le16 Pid; + __le16 Pad; + __le32 OffsetHigh; + __le32 OffsetLow; + __le32 LengthHigh; + __le32 LengthLow; } LOCKING_ANDX_RANGE; #define LOCKING_ANDX_SHARED_LOCK 0x01 @@ -747,14 +747,14 @@ struct smb_hdr hdr; /* wct = 8 */ __u8 AndXCommand; __u8 AndXReserved; - __u16 AndXOffset; + __le16 AndXOffset; __u16 Fid; __u8 LockType; __u8 OplockLevel; - __u32 Timeout; - __u16 NumberOfUnlocks; - __u16 NumberOfLocks; - __u16 ByteCount; + __le32 Timeout; + __le16 NumberOfUnlocks; + __le16 NumberOfLocks; + __le16 ByteCount; LOCKING_ANDX_RANGE Locks[1]; } LOCK_REQ; @@ -762,14 +762,14 @@ struct smb_hdr hdr; /* wct = 2 */ __u8 AndXCommand; __u8 AndXReserved; - __u16 AndXOffset; + __le16 AndXOffset; __u16 ByteCount; } LOCK_RSP; typedef struct smb_com_rename_req { struct smb_hdr hdr; /* wct = 1 */ - __u16 SearchAttributes; /* target file attributes */ - __u16 ByteCount; + __le16 SearchAttributes; /* target file attributes */ + __le16 ByteCount; __u8 BufferFormat; /* 4 = ASCII or Unicode */ unsigned char OldFileName[1]; /* followed by __u8 BufferFormat2 */ @@ -787,9 +787,9 @@ typedef struct smb_com_copy_req { struct smb_hdr hdr; /* wct = 3 */ __u16 Tid2; - __u16 OpenFunction; - __u16 Flags; - __u16 ByteCount; + __le16 OpenFunction; + __le16 Flags; + __le16 ByteCount; __u8 BufferFormat; /* 4 = ASCII or Unicode */ unsigned char OldFileName[1]; /* followed by __u8 BufferFormat2 */ @@ -798,7 +798,7 @@ typedef struct smb_com_copy_rsp { struct smb_hdr hdr; /* wct = 1 */ - __u16 CopyCount; /* number of files copied */ + __le16 CopyCount; /* number of files copied */ __u16 ByteCount; /* may be zero */ __u8 BufferFormat; /* 0x04 - only present if errored file follows */ unsigned char ErrorFileName[1]; /* only present if error in copy */ @@ -810,10 +810,10 @@ typedef struct smb_com_nt_rename_req { /* A5 - also used for create hardlink */ struct smb_hdr hdr; /* wct = 4 */ - __u16 SearchAttributes; /* target file attributes */ - __u16 Flags; /* spec says Information Level */ - __u32 ClusterCount; - __u16 ByteCount; + __le16 SearchAttributes; /* target file attributes */ + __le16 Flags; /* spec says Information Level */ + __le32 ClusterCount; + __le16 ByteCount; __u8 BufferFormat; /* 4 = ASCII or Unicode */ unsigned char OldFileName[1]; /* followed by __u8 BufferFormat2 */ @@ -827,8 +827,8 @@ typedef struct smb_com_delete_file_req { struct smb_hdr hdr; /* wct = 1 */ - __u16 SearchAttributes; - __u16 ByteCount; + __le16 SearchAttributes; + __le16 ByteCount; __u8 BufferFormat; /* 4 = ASCII */ unsigned char fileName[1]; } DELETE_FILE_REQ; @@ -840,7 +840,7 @@ typedef struct smb_com_delete_directory_req { struct smb_hdr hdr; /* wct = 0 */ - __u16 ByteCount; + __le16 ByteCount; __u8 BufferFormat; /* 4 = ASCII */ unsigned char DirName[1]; } DELETE_DIRECTORY_REQ; @@ -852,7 +852,7 @@ typedef struct smb_com_create_directory_req { struct smb_hdr hdr; /* wct = 0 */ - __u16 ByteCount; + __le16 ByteCount; __u8 BufferFormat; /* 4 = ASCII */ unsigned char DirName[1]; } CREATE_DIRECTORY_REQ; @@ -870,22 +870,22 @@ struct smb_hdr hdr; /* wct = 23 */ __u8 MaxSetupCount; __u16 Reserved; - __u32 TotalParameterCount; - __u32 TotalDataCount; - __u32 MaxParameterCount; - __u32 MaxDataCount; - __u32 ParameterCount; - __u32 ParameterOffset; - __u32 DataCount; - __u32 DataOffset; + __le32 TotalParameterCount; + __le32 TotalDataCount; + __le32 MaxParameterCount; + __le32 MaxDataCount; + __le32 ParameterCount; + __le32 ParameterOffset; + __le32 DataCount; + __le32 DataOffset; __u8 SetupCount; /* four setup words follow subcommand */ /* SNIA spec incorrectly included spurious pad here */ - __u16 SubCommand;/* 2 = IOCTL/FSCTL */ - __u32 FunctionCode; + __le16 SubCommand;/* 2 = IOCTL/FSCTL */ + __le32 FunctionCode; __u16 Fid; __u8 IsFsctl; /* 1 = File System Control, 0 = device control (IOCTL)*/ __u8 IsRootFlag; /* 1 = apply command to root of share (must be DFS share)*/ - __u16 ByteCount; + __le16 ByteCount; __u8 Pad[3]; __u8 Data[1]; } TRANSACT_IOCTL_REQ; @@ -893,16 +893,16 @@ typedef struct smb_com_transaction_ioctl_rsp { struct smb_hdr hdr; /* wct = 19 */ __u8 Reserved[3]; - __u32 TotalParameterCount; - __u32 TotalDataCount; - __u32 ParameterCount; - __u32 ParameterOffset; - __u32 ParameterDisplacement; - __u32 DataCount; - __u32 DataOffset; - __u32 DataDisplacement; + __le32 TotalParameterCount; + __le32 TotalDataCount; + __le32 ParameterCount; + __le32 ParameterOffset; + __le32 ParameterDisplacement; + __le32 DataCount; + __le32 DataOffset; + __le32 DataDisplacement; __u8 SetupCount; /* 1 */ - __u16 ReturnedDataLen; + __le16 ReturnedDataLen; __u16 ByteCount; __u8 Pad[3]; } TRANSACT_IOCTL_RSP; @@ -911,22 +911,22 @@ struct smb_hdr hdr; /* wct = 23 */ __u8 MaxSetupCount; __u16 Reserved; - __u32 TotalParameterCount; - __u32 TotalDataCount; - __u32 MaxParameterCount; - __u32 MaxDataCount; - __u32 ParameterCount; - __u32 ParameterOffset; - __u32 DataCount; - __u32 DataOffset; + __le32 TotalParameterCount; + __le32 TotalDataCount; + __le32 MaxParameterCount; + __le32 MaxDataCount; + __le32 ParameterCount; + __le32 ParameterOffset; + __le32 DataCount; + __le32 DataOffset; __u8 SetupCount; /* four setup words follow subcommand */ /* SNIA spec incorrectly included spurious pad here */ - __u16 SubCommand;/* 4 = Change Notify */ - __u32 CompletionFilter; /* operation to monitor */ + __le16 SubCommand;/* 4 = Change Notify */ + __le32 CompletionFilter; /* operation to monitor */ __u16 Fid; __u8 WatchTree; /* 1 = Monitor subdirectories */ __u8 Reserved2; - __u16 ByteCount; + __le16 ByteCount; /* __u8 Pad[3];*/ /* __u8 Data[1];*/ } TRANSACT_CHANGE_NOTIFY_REQ; @@ -934,14 +934,14 @@ typedef struct smb_com_transaction_change_notify_rsp { struct smb_hdr hdr; /* wct = 18 */ __u8 Reserved[3]; - __u32 TotalParameterCount; - __u32 TotalDataCount; - __u32 ParameterCount; - __u32 ParameterOffset; - __u32 ParameterDisplacement; - __u32 DataCount; - __u32 DataOffset; - __u32 DataDisplacement; + __le32 TotalParameterCount; + __le32 TotalDataCount; + __le32 ParameterCount; + __le32 ParameterOffset; + __le32 ParameterDisplacement; + __le32 DataCount; + __le32 DataOffset; + __le32 DataDisplacement; __u8 SetupCount; /* 0 */ __u16 ByteCount; /* __u8 Pad[3]; */ @@ -1090,40 +1090,40 @@ typedef struct smb_com_transaction2_qpi_req { struct smb_hdr hdr; /* wct = 14+ */ - __u16 TotalParameterCount; - __u16 TotalDataCount; - __u16 MaxParameterCount; - __u16 MaxDataCount; + __le16 TotalParameterCount; + __le16 TotalDataCount; + __le16 MaxParameterCount; + __le16 MaxDataCount; __u8 MaxSetupCount; __u8 Reserved; - __u16 Flags; - __u32 Timeout; + __le16 Flags; + __le32 Timeout; __u16 Reserved2; - __u16 ParameterCount; - __u16 ParameterOffset; - __u16 DataCount; - __u16 DataOffset; + __le16 ParameterCount; + __le16 ParameterOffset; + __le16 DataCount; + __le16 DataOffset; __u8 SetupCount; __u8 Reserved3; - __u16 SubCommand; /* one setup word */ - __u16 ByteCount; + __le16 SubCommand; /* one setup word */ + __le16 ByteCount; __u8 Pad; - __u16 InformationLevel; + __le16 InformationLevel; __u32 Reserved4; char FileName[1]; } TRANSACTION2_QPI_REQ; typedef struct smb_com_transaction2_qpi_rsp { struct smb_hdr hdr; /* wct = 10 + SetupCount */ - __u16 TotalParameterCount; - __u16 TotalDataCount; - __u16 Reserved; - __u16 ParameterCount; - __u16 ParameterOffset; - __u16 ParameterDisplacement; - __u16 DataCount; - __u16 DataOffset; - __u16 DataDisplacement; + __le16 TotalParameterCount; + __le16 TotalDataCount; + __le16 Reserved; + __le16 ParameterCount; + __le16 ParameterOffset; + __le16 ParameterDisplacement; + __le16 DataCount; + __le16 DataOffset; + __le16 DataDisplacement; __u8 SetupCount; __u8 Reserved1; /* should be zero setup words following */ __u16 ByteCount; @@ -1132,41 +1132,41 @@ typedef struct smb_com_transaction2_spi_req { struct smb_hdr hdr; /* wct = 15 */ - __u16 TotalParameterCount; - __u16 TotalDataCount; - __u16 MaxParameterCount; - __u16 MaxDataCount; + __le16 TotalParameterCount; + __le16 TotalDataCount; + __le16 MaxParameterCount; + __le16 MaxDataCount; __u8 MaxSetupCount; __u8 Reserved; - __u16 Flags; - __u32 Timeout; + __le16 Flags; + __le32 Timeout; __u16 Reserved2; - __u16 ParameterCount; - __u16 ParameterOffset; - __u16 DataCount; - __u16 DataOffset; + __le16 ParameterCount; + __le16 ParameterOffset; + __le16 DataCount; + __le16 DataOffset; __u8 SetupCount; __u8 Reserved3; - __u16 SubCommand; /* one setup word */ - __u16 ByteCount; + __le16 SubCommand; /* one setup word */ + __le16 ByteCount; __u8 Pad; __u16 Pad1; - __u16 InformationLevel; + __le16 InformationLevel; __u32 Reserved4; char FileName[1]; } TRANSACTION2_SPI_REQ; typedef struct smb_com_transaction2_spi_rsp { struct smb_hdr hdr; /* wct = 10 + SetupCount */ - __u16 TotalParameterCount; - __u16 TotalDataCount; + __le16 TotalParameterCount; + __le16 TotalDataCount; __u16 Reserved; - __u16 ParameterCount; - __u16 ParameterOffset; - __u16 ParameterDisplacement; - __u16 DataCount; - __u16 DataOffset; - __u16 DataDisplacement; + __le16 ParameterCount; + __le16 ParameterOffset; + __le16 ParameterDisplacement; + __le16 DataCount; + __le16 DataOffset; + __le16 DataDisplacement; __u8 SetupCount; __u8 Reserved1; /* should be zero setup words following */ __u16 ByteCount; @@ -1174,49 +1174,49 @@ } TRANSACTION2_SPI_RSP; struct set_file_rename { - __u32 overwrite; /* 1 = overwrite dest */ + __le32 overwrite; /* 1 = overwrite dest */ __u32 root_fid; /* zero */ - __u32 target_name_len; + __le32 target_name_len; char target_name[0]; /* Must be unicode */ }; struct smb_com_transaction2_sfi_req { struct smb_hdr hdr; /* wct = 15 */ - __u16 TotalParameterCount; - __u16 TotalDataCount; - __u16 MaxParameterCount; - __u16 MaxDataCount; + __le16 TotalParameterCount; + __le16 TotalDataCount; + __le16 MaxParameterCount; + __le16 MaxDataCount; __u8 MaxSetupCount; __u8 Reserved; - __u16 Flags; - __u32 Timeout; + __le16 Flags; + __le32 Timeout; __u16 Reserved2; - __u16 ParameterCount; - __u16 ParameterOffset; - __u16 DataCount; - __u16 DataOffset; + __le16 ParameterCount; + __le16 ParameterOffset; + __le16 DataCount; + __le16 DataOffset; __u8 SetupCount; __u8 Reserved3; - __u16 SubCommand; /* one setup word */ - __u16 ByteCount; + __le16 SubCommand; /* one setup word */ + __le16 ByteCount; __u8 Pad; __u16 Pad1; __u16 Fid; - __u16 InformationLevel; + __le16 InformationLevel; __u16 Reserved4; }; struct smb_com_transaction2_sfi_rsp { struct smb_hdr hdr; /* wct = 10 + SetupCount */ - __u16 TotalParameterCount; - __u16 TotalDataCount; + __le16 TotalParameterCount; + __le16 TotalDataCount; __u16 Reserved; - __u16 ParameterCount; - __u16 ParameterOffset; - __u16 ParameterDisplacement; - __u16 DataCount; - __u16 DataOffset; - __u16 DataDisplacement; + __le16 ParameterCount; + __le16 ParameterOffset; + __le16 ParameterDisplacement; + __le16 DataCount; + __le16 DataOffset; + __le16 DataDisplacement; __u8 SetupCount; __u8 Reserved1; /* should be zero setup words following */ __u16 ByteCount; @@ -1240,43 +1240,43 @@ typedef struct smb_com_transaction2_ffirst_req { struct smb_hdr hdr; /* wct = 15 */ - __u16 TotalParameterCount; - __u16 TotalDataCount; - __u16 MaxParameterCount; - __u16 MaxDataCount; + __le16 TotalParameterCount; + __le16 TotalDataCount; + __le16 MaxParameterCount; + __le16 MaxDataCount; __u8 MaxSetupCount; __u8 Reserved; - __u16 Flags; - __u32 Timeout; + __le16 Flags; + __le32 Timeout; __u16 Reserved2; - __u16 ParameterCount; - __u16 ParameterOffset; - __u16 DataCount; - __u16 DataOffset; + __le16 ParameterCount; + __le16 ParameterOffset; + __le16 DataCount; + __le16 DataOffset; __u8 SetupCount; /* one */ __u8 Reserved3; - __u16 SubCommand; /* TRANS2_FIND_FIRST */ - __u16 ByteCount; + __le16 SubCommand; /* TRANS2_FIND_FIRST */ + __le16 ByteCount; __u8 Pad; - __u16 SearchAttributes; - __u16 SearchCount; - __u16 SearchFlags; - __u16 InformationLevel; - __u32 SearchStorageType; + __le16 SearchAttributes; + __le16 SearchCount; + __le16 SearchFlags; + __le16 InformationLevel; + __le32 SearchStorageType; char FileName[1]; } TRANSACTION2_FFIRST_REQ; typedef struct smb_com_transaction2_ffirst_rsp { struct smb_hdr hdr; /* wct = 10 */ - __u16 TotalParameterCount; - __u16 TotalDataCount; + __le16 TotalParameterCount; + __le16 TotalDataCount; __u16 Reserved; - __u16 ParameterCount; - __u16 ParameterOffset; - __u16 ParameterDisplacement; - __u16 DataCount; - __u16 DataOffset; - __u16 DataDisplacement; + __le16 ParameterCount; + __le16 ParameterOffset; + __le16 ParameterDisplacement; + __le16 DataCount; + __le16 DataOffset; + __le16 DataDisplacement; __u8 SetupCount; __u8 Reserved1; /* should be zero setup words following */ __u16 ByteCount; @@ -1284,61 +1284,61 @@ typedef struct smb_com_transaction2_ffirst_rsp_parms { __u16 SearchHandle; - __u16 SearchCount; - __u16 EndofSearch; - __u16 EAErrorOffset; - __u16 LastNameOffset; + __le16 SearchCount; + __le16 EndofSearch; + __le16 EAErrorOffset; + __le16 LastNameOffset; } T2_FFIRST_RSP_PARMS; typedef struct smb_com_transaction2_fnext_req { struct smb_hdr hdr; /* wct = 15 */ - __u16 TotalParameterCount; - __u16 TotalDataCount; - __u16 MaxParameterCount; - __u16 MaxDataCount; + __le16 TotalParameterCount; + __le16 TotalDataCount; + __le16 MaxParameterCount; + __le16 MaxDataCount; __u8 MaxSetupCount; __u8 Reserved; - __u16 Flags; - __u32 Timeout; + __le16 Flags; + __le32 Timeout; __u16 Reserved2; - __u16 ParameterCount; - __u16 ParameterOffset; - __u16 DataCount; - __u16 DataOffset; + __le16 ParameterCount; + __le16 ParameterOffset; + __le16 DataCount; + __le16 DataOffset; __u8 SetupCount; /* one */ __u8 Reserved3; - __u16 SubCommand; /* TRANS2_FIND_NEXT */ - __u16 ByteCount; + __le16 SubCommand; /* TRANS2_FIND_NEXT */ + __le16 ByteCount; __u8 Pad; __u16 SearchHandle; - __u16 SearchCount; - __u16 InformationLevel; + __le16 SearchCount; + __le16 InformationLevel; __u32 ResumeKey; - __u16 SearchFlags; + __le16 SearchFlags; char ResumeFileName[1]; } TRANSACTION2_FNEXT_REQ; typedef struct smb_com_transaction2_fnext_rsp { struct smb_hdr hdr; /* wct = 10 */ - __u16 TotalParameterCount; - __u16 TotalDataCount; + __le16 TotalParameterCount; + __le16 TotalDataCount; __u16 Reserved; - __u16 ParameterCount; - __u16 ParameterOffset; - __u16 ParameterDisplacement; - __u16 DataCount; - __u16 DataOffset; - __u16 DataDisplacement; + __le16 ParameterCount; + __le16 ParameterOffset; + __le16 ParameterDisplacement; + __le16 DataCount; + __le16 DataOffset; + __le16 DataDisplacement; __u8 SetupCount; __u8 Reserved1; /* should be zero setup words following */ __u16 ByteCount; } TRANSACTION2_FNEXT_RSP; typedef struct smb_com_transaction2_fnext_rsp_parms { - __u16 SearchCount; - __u16 EndofSearch; - __u16 EAErrorOffset; - __u16 LastNameOffset; + __le16 SearchCount; + __le16 EndofSearch; + __le16 EAErrorOffset; + __le16 LastNameOffset; } T2_FNEXT_RSP_PARMS; /* QFSInfo Levels */ @@ -1354,38 +1354,38 @@ typedef struct smb_com_transaction2_qfsi_req { struct smb_hdr hdr; /* wct = 14+ */ - __u16 TotalParameterCount; - __u16 TotalDataCount; - __u16 MaxParameterCount; - __u16 MaxDataCount; + __le16 TotalParameterCount; + __le16 TotalDataCount; + __le16 MaxParameterCount; + __le16 MaxDataCount; __u8 MaxSetupCount; __u8 Reserved; - __u16 Flags; - __u32 Timeout; + __le16 Flags; + __le32 Timeout; __u16 Reserved2; - __u16 ParameterCount; - __u16 ParameterOffset; - __u16 DataCount; - __u16 DataOffset; + __le16 ParameterCount; + __le16 ParameterOffset; + __le16 DataCount; + __le16 DataOffset; __u8 SetupCount; __u8 Reserved3; - __u16 SubCommand; /* one setup word */ - __u16 ByteCount; + __le16 SubCommand; /* one setup word */ + __le16 ByteCount; __u8 Pad; - __u16 InformationLevel; + __le16 InformationLevel; } TRANSACTION2_QFSI_REQ; typedef struct smb_com_transaction_qfsi_rsp { struct smb_hdr hdr; /* wct = 10 + SetupCount */ - __u16 TotalParameterCount; - __u16 TotalDataCount; + __le16 TotalParameterCount; + __le16 TotalDataCount; __u16 Reserved; - __u16 ParameterCount; - __u16 ParameterOffset; - __u16 ParameterDisplacement; - __u16 DataCount; - __u16 DataOffset; - __u16 DataDisplacement; + __le16 ParameterCount; + __le16 ParameterOffset; + __le16 ParameterDisplacement; + __le16 DataCount; + __le16 DataOffset; + __le16 DataDisplacement; __u8 SetupCount; __u8 Reserved1; /* should be zero setup words following */ __u16 ByteCount; @@ -1394,58 +1394,58 @@ typedef struct smb_com_transaction2_get_dfs_refer_req { struct smb_hdr hdr; /* wct = 15 */ - __u16 TotalParameterCount; - __u16 TotalDataCount; - __u16 MaxParameterCount; - __u16 MaxDataCount; + __le16 TotalParameterCount; + __le16 TotalDataCount; + __le16 MaxParameterCount; + __le16 MaxDataCount; __u8 MaxSetupCount; __u8 Reserved; - __u16 Flags; - __u32 Timeout; + __le16 Flags; + __le32 Timeout; __u16 Reserved2; - __u16 ParameterCount; - __u16 ParameterOffset; - __u16 DataCount; - __u16 DataOffset; + __le16 ParameterCount; + __le16 ParameterOffset; + __le16 DataCount; + __le16 DataOffset; __u8 SetupCount; __u8 Reserved3; - __u16 SubCommand; /* one setup word */ - __u16 ByteCount; + __le16 SubCommand; /* one setup word */ + __le16 ByteCount; __u8 Pad[3]; /* Win2K has sent 0x0F01 (max resp length perhaps?) followed by one byte pad - doesn't seem to matter though */ - __u16 MaxReferralLevel; + __le16 MaxReferralLevel; char RequestFileName[1]; } TRANSACTION2_GET_DFS_REFER_REQ; typedef struct dfs_referral_level_3 { - __u16 VersionNumber; - __u16 ReferralSize; - __u16 ServerType; /* 0x0001 = CIFS server */ - __u16 ReferralFlags; /* or proximity - not clear which since always set to zero - SNIA spec says 0x01 means strip off PathConsumed chars before submitting RequestFileName to remote node */ - __u16 TimeToLive; - __u16 Proximity; - __u16 DfsPathOffset; - __u16 DfsAlternatePathOffset; - __u16 NetworkAddressOffset; + __le16 VersionNumber; + __le16 ReferralSize; + __le16 ServerType; /* 0x0001 = CIFS server */ + __le16 ReferralFlags; /* or proximity - not clear which since always set to zero - SNIA spec says 0x01 means strip off PathConsumed chars before submitting RequestFileName to remote node */ + __le16 TimeToLive; + __le16 Proximity; + __le16 DfsPathOffset; + __le16 DfsAlternatePathOffset; + __le16 NetworkAddressOffset; } REFERRAL3; typedef struct smb_com_transaction_get_dfs_refer_rsp { struct smb_hdr hdr; /* wct = 10 */ - __u16 TotalParameterCount; - __u16 TotalDataCount; + __le16 TotalParameterCount; + __le16 TotalDataCount; __u16 Reserved; - __u16 ParameterCount; - __u16 ParameterOffset; - __u16 ParameterDisplacement; - __u16 DataCount; - __u16 DataOffset; - __u16 DataDisplacement; + __le16 ParameterCount; + __le16 ParameterOffset; + __le16 ParameterDisplacement; + __le16 DataCount; + __le16 DataOffset; + __le16 DataDisplacement; __u8 SetupCount; __u8 Reserved1; /* zero setup words following */ __u16 ByteCount; __u8 Pad; - __u16 PathConsumed; - __u16 NumberOfReferrals; - __u16 DFSFlags; + __le16 PathConsumed; + __le16 NumberOfReferrals; + __le16 DFSFlags; __u16 Pad2; REFERRAL3 referrals[1]; /* array of level 3 dfs_referral structures */ /* followed by the strings pointed to by the referral structures */ @@ -1531,16 +1531,16 @@ }; typedef struct { - __u64 TotalAllocationUnits; - __u64 FreeAllocationUnits; - __u32 SectorsPerAllocationUnit; - __u32 BytesPerSector; + __le64 TotalAllocationUnits; + __le64 FreeAllocationUnits; + __le32 SectorsPerAllocationUnit; + __le32 BytesPerSector; } FILE_SYSTEM_INFO; /* size info, level 0x103 */ typedef struct { - __u16 MajorVersionNumber; - __u16 MinorVersionNumber; - __u64 Capability; + __le16 MajorVersionNumber; + __le16 MinorVersionNumber; + __le64 Capability; } FILE_SYSTEM_UNIX_INFO; /* Unix extensions info, level 0x200 */ /* Linux/Unix extensions capability flags */ #define CIFS_UNIX_FCNTL_CAP 0x00000001 /* support for fcntl locks */ @@ -1567,55 +1567,55 @@ #define FILE_DEVICE_NETWORK_REDIRECTOR 0x00000028 typedef struct { - __u32 DeviceType; - __u32 DeviceCharacteristics; + __le32 DeviceType; + __le32 DeviceCharacteristics; } FILE_SYSTEM_DEVICE_INFO; /* device info, level 0x104 */ typedef struct { - __u32 Attributes; - __u32 MaxPathNameComponentLength; - __u32 FileSystemNameLen; + __le32 Attributes; + __le32 MaxPathNameComponentLength; + __le32 FileSystemNameLen; char FileSystemName[52]; /* do not really need to save this - so potentially get only subset of name */ } FILE_SYSTEM_ATTRIBUTE_INFO; typedef struct { /* data block encoding of response to level 263 QPathInfo */ - __u64 CreationTime; - __u64 LastAccessTime; - __u64 LastWriteTime; - __u64 ChangeTime; - __u32 Attributes; + __le64 CreationTime; + __le64 LastAccessTime; + __le64 LastWriteTime; + __le64 ChangeTime; + __le32 Attributes; __u32 Pad1; - __u64 AllocationSize; - __u64 EndOfFile; /* size ie offset to first free byte in file */ - __u32 NumberOfLinks; /* hard links */ + __le64 AllocationSize; + __le64 EndOfFile; /* size ie offset to first free byte in file */ + __le32 NumberOfLinks; /* hard links */ __u8 DeletePending; __u8 Directory; __u16 Pad2; __u64 IndexNumber; - __u32 EASize; - __u32 AccessFlags; + __le32 EASize; + __le32 AccessFlags; __u64 IndexNumber1; - __u64 CurrentByteOffset; - __u32 Mode; - __u32 AlignmentRequirement; - __u32 FileNameLength; + __le64 CurrentByteOffset; + __le32 Mode; + __le32 AlignmentRequirement; + __le32 FileNameLength; char FileName[1]; } FILE_ALL_INFO; /* level 263 QPathInfo */ typedef struct { - __u64 EndOfFile; - __u64 NumOfBytes; - __u64 LastStatusChange; /*SNIA spec says DCE time for the three time fields */ - __u64 LastAccessTime; - __u64 LastModificationTime; - __u64 Uid; - __u64 Gid; - __u32 Type; - __u64 DevMajor; - __u64 DevMinor; + __le64 EndOfFile; + __le64 NumOfBytes; + __le64 LastStatusChange; /*SNIA spec says DCE time for the three time fields */ + __le64 LastAccessTime; + __le64 LastModificationTime; + __le64 Uid; + __le64 Gid; + __le32 Type; + __le64 DevMajor; + __le64 DevMinor; __u64 UniqueId; - __u64 Permissions; - __u64 Nlinks; + __le64 Permissions; + __le64 Nlinks; } FILE_UNIX_BASIC_INFO; /* level 512 QPathInfo */ typedef struct { @@ -1645,52 +1645,52 @@ #define UNIX_SOCKET 6 typedef struct { - __u32 NextEntryOffset; - __u32 ResumeKey; - __u64 EndOfFile; - __u64 NumOfBytes; - __u64 LastStatusChange; /*SNIA spec says DCE time for the three time fields */ - __u64 LastAccessTime; - __u64 LastModificationTime; - __u64 Uid; - __u64 Gid; - __u32 Type; - __u64 DevMajor; - __u64 DevMinor; - __u64 UniqueId; - __u64 Permissions; - __u64 Nlinks; + __le32 NextEntryOffset; + __le32 ResumeKey; + __le64 EndOfFile; + __le64 NumOfBytes; + __le64 LastStatusChange; /*SNIA spec says DCE time for the three time fields */ + __le64 LastAccessTime; + __le64 LastModificationTime; + __le64 Uid; + __le64 Gid; + __le32 Type; + __le64 DevMajor; + __le64 DevMinor; + __le64 UniqueId; + __le64 Permissions; + __le64 Nlinks; char FileName[1]; } FILE_UNIX_INFO; typedef struct { - __u64 CreationTime; - __u64 LastAccessTime; - __u64 LastWriteTime; - __u64 ChangeTime; - __u32 Attributes; + __le64 CreationTime; + __le64 LastAccessTime; + __le64 LastWriteTime; + __le64 ChangeTime; + __le32 Attributes; __u32 Pad; } FILE_BASIC_INFO; /* size info, level 0x101 */ struct file_allocation_info { - __u64 AllocationSize; + __le64 AllocationSize; }; /* size info, level 0x103 */ struct file_end_of_file_info { - __u64 FileSize; /* offset to end of file */ + __le64 FileSize; /* offset to end of file */ }; /* size info, level 0x104 */ typedef struct { - __u32 NextEntryOffset; + __le32 NextEntryOffset; __u32 FileIndex; - __u64 CreationTime; - __u64 LastAccessTime; - __u64 LastWriteTime; - __u64 ChangeTime; - __u64 EndOfFile; - __u64 AllocationSize; - __u32 ExtFileAttributes; - __u32 FileNameLength; + __le64 CreationTime; + __le64 LastAccessTime; + __le64 LastWriteTime; + __le64 ChangeTime; + __le64 EndOfFile; + __le64 AllocationSize; + __le32 ExtFileAttributes; + __le32 FileNameLength; char FileName[1]; } FILE_DIRECTORY_INFO; /* level 257 FF response data area */ @@ -1707,7 +1707,7 @@ struct fea { unsigned char EA_flags; __u8 name_len; - __u16 value_len; + __le16 value_len; char name[1]; /* optionally followed by value */ }; @@ -1715,7 +1715,7 @@ #define FEA_NEEDEA 0x80 /* need EA bit */ struct fealist { - __u32 list_len; + __le32 list_len; struct fea list[1]; }; diff -Nru a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c --- a/fs/cifs/cifssmb.c 2004-09-26 10:25:55 -07:00 +++ b/fs/cifs/cifssmb.c 2004-09-26 10:25:55 -07:00 @@ -183,6 +183,7 @@ int rc = 0; int bytes_returned; struct TCP_Server_Info * server; + u16 count; if(ses->server) server = ses->server; @@ -199,12 +200,12 @@ if (extended_security) pSMB->hdr.Flags2 |= SMBFLG2_EXT_SEC; - pSMB->ByteCount = strlen(protocols[0].name) + 1; + count = strlen(protocols[0].name) + 1; strncpy(pSMB->DialectsArray, protocols[0].name, 30); /* null guaranteed to be at end of source and target buffers anyway */ - pSMB->hdr.smb_buf_length += pSMB->ByteCount; - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + pSMB->hdr.smb_buf_length += count; + pSMB->ByteCount = cpu_to_le16(count); rc = SendReceive(xid, ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); @@ -236,7 +237,7 @@ if ((pSMBr->hdr.Flags2 & SMBFLG2_EXT_SEC) && (server->capabilities & CAP_EXTENDED_SECURITY)) { - __u16 count = le16_to_cpu(pSMBr->ByteCount); + count = pSMBr->ByteCount; if (count < 16) rc = -EIO; else if (count == 16) { @@ -435,10 +436,9 @@ } pSMB->SearchAttributes = cpu_to_le16(ATTR_READONLY | ATTR_HIDDEN | ATTR_SYSTEM); - pSMB->ByteCount = name_len + 1; pSMB->BufferFormat = 0x04; - pSMB->hdr.smb_buf_length += pSMB->ByteCount; - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + pSMB->hdr.smb_buf_length += name_len + 1; + pSMB->ByteCount = cpu_to_le16(name_len + 1); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); if (rc) { @@ -487,10 +487,9 @@ strncpy(pSMB->DirName, dirName, name_len); } - pSMB->ByteCount = name_len + 1; pSMB->BufferFormat = 0x04; - pSMB->hdr.smb_buf_length += pSMB->ByteCount; - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + pSMB->hdr.smb_buf_length += name_len + 1; + pSMB->ByteCount = cpu_to_le16(name_len + 1); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); if (rc) { @@ -538,10 +537,9 @@ strncpy(pSMB->DirName, name, name_len); } - pSMB->ByteCount = name_len + 1 /* for buf format */ ; pSMB->BufferFormat = 0x04; - pSMB->hdr.smb_buf_length += pSMB->ByteCount; - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + pSMB->hdr.smb_buf_length += name_len + 1; + pSMB->ByteCount = cpu_to_le16(name_len + 1); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); if (rc) { @@ -571,6 +569,7 @@ OPEN_RSP *pSMBr = NULL; int bytes_returned; int name_len; + __u16 count; openRetry: rc = smb_init(SMB_COM_NT_CREATE_ANDX, 24, tcon, (void **) &pSMB, @@ -581,7 +580,7 @@ pSMB->AndXCommand = 0xFF; /* none */ if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { - pSMB->ByteCount = 1; /* account for one byte pad to word boundary */ + count = 1; /* account for one byte pad to word boundary */ name_len = cifs_strtoUCS((wchar_t *) (pSMB->fileName + 1), fileName, 530 @@ -591,7 +590,7 @@ name_len *= 2; pSMB->NameLength = cpu_to_le16(name_len); } else { /* BB improve the check for buffer overruns BB */ - pSMB->ByteCount = 0; /* no pad */ + count = 0; /* no pad */ name_len = strnlen(fileName, 530); name_len++; /* trailing null */ pSMB->NameLength = cpu_to_le16(name_len); @@ -604,30 +603,29 @@ } pSMB->DesiredAccess = cpu_to_le32(access_flags); pSMB->AllocationSize = 0; - pSMB->FileAttributes = ATTR_NORMAL; + pSMB->FileAttributes = cpu_to_le32(ATTR_NORMAL); /* XP does not handle ATTR_POSIX_SEMANTICS */ /* but it helps speed up case sensitive checks for other servers such as Samba */ if (tcon->ses->capabilities & CAP_UNIX) - pSMB->FileAttributes |= ATTR_POSIX_SEMANTICS; + pSMB->FileAttributes |= cpu_to_le32(ATTR_POSIX_SEMANTICS); /* if ((omode & S_IWUGO) == 0) - pSMB->FileAttributes |= ATTR_READONLY;*/ + pSMB->FileAttributes |= cpu_to_le32(ATTR_READONLY);*/ /* Above line causes problems due to vfs splitting create into two pieces - need to set mode after file created not while it is being created */ - pSMB->FileAttributes = cpu_to_le32(pSMB->FileAttributes); pSMB->ShareAccess = cpu_to_le32(FILE_SHARE_ALL); pSMB->CreateDisposition = cpu_to_le32(openDisposition); pSMB->CreateOptions = cpu_to_le32(create_options); pSMB->ImpersonationLevel = cpu_to_le32(SECURITY_IMPERSONATION); /* BB ??*/ pSMB->SecurityFlags = - cpu_to_le32(SECURITY_CONTEXT_TRACKING | SECURITY_EFFECTIVE_ONLY); + SECURITY_CONTEXT_TRACKING | SECURITY_EFFECTIVE_ONLY; - pSMB->ByteCount += name_len; - pSMB->hdr.smb_buf_length += pSMB->ByteCount; + count += name_len; + pSMB->hdr.smb_buf_length += count; - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + pSMB->ByteCount = cpu_to_le16(count); /* long_op set to 1 to allow for oplock break timeouts */ rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 1); @@ -699,24 +697,24 @@ if (rc) { cERROR(1, ("Send error in read = %d", rc)); } else { - pSMBr->DataLength = le16_to_cpu(pSMBr->DataLength); - *nbytes = pSMBr->DataLength; + __u16 data_length = le16_to_cpu(pSMBr->DataLength); + *nbytes = data_length; /*check that DataLength would not go beyond end of SMB */ - if ((pSMBr->DataLength > CIFS_MAX_MSGSIZE) - || (pSMBr->DataLength > count)) { - cFYI(1,("bad length %d for count %d",pSMBr->DataLength,count)); + if ((data_length > CIFS_MAX_MSGSIZE) + || (data_length > count)) { + cFYI(1,("bad length %d for count %d",data_length,count)); rc = -EIO; *nbytes = 0; } else { pReadData = (char *) (&pSMBr->hdr.Protocol) + le16_to_cpu(pSMBr->DataOffset); -/* if(rc = copy_to_user(buf, pReadData, pSMBr->DataLength)) { +/* if(rc = copy_to_user(buf, pReadData, data_length)) { cERROR(1,("Faulting on read rc = %d",rc)); rc = -EFAULT; }*/ /* can not use copy_to_user when using page cache*/ if(*buf) - memcpy(*buf,pReadData,pSMBr->DataLength); + memcpy(*buf,pReadData,data_length); } } if (pSMB) { @@ -741,6 +739,8 @@ WRITE_REQ *pSMB = NULL; WRITE_RSP *pSMBr = NULL; int bytes_returned; + unsigned bytes_sent; + __u16 byte_count; rc = smb_init(SMB_COM_WRITE_ANDX, 14, tcon, (void **) &pSMB, (void **) &pSMBr); @@ -755,21 +755,20 @@ pSMB->OffsetLow = cpu_to_le32(offset & 0xFFFFFFFF); pSMB->OffsetHigh = cpu_to_le32(offset >> 32); pSMB->Remaining = 0; - if (count > ((tcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE) & 0xFFFFFF00)) - pSMB->DataLengthLow = - (tcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE) & 0xFFFFFF00; - else - pSMB->DataLengthLow = count; + bytes_sent = (tcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE) & ~0xFF; + if (bytes_sent > count) + bytes_sent = count; pSMB->DataLengthHigh = 0; pSMB->DataOffset = cpu_to_le16(offsetof(struct smb_com_write_req,Data) - 4); - memcpy(pSMB->Data,buf,pSMB->DataLengthLow); + memcpy(pSMB->Data,buf,bytes_sent); - pSMB->ByteCount += pSMB->DataLengthLow + 1 /* pad */ ; - pSMB->DataLengthLow = cpu_to_le16(pSMB->DataLengthLow); - pSMB->hdr.smb_buf_length += pSMB->ByteCount; - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + byte_count = bytes_sent + 1 /* pad */ ; + pSMB->DataLengthLow = cpu_to_le16(bytes_sent); + pSMB->DataLengthHigh = 0; + pSMB->hdr.smb_buf_length += byte_count; + pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, long_op); @@ -812,7 +811,7 @@ pSMB->Timeout = 0; } else if (waitFlag == TRUE) { timeout = 3; /* blocking operation, no timeout */ - pSMB->Timeout = -1; /* blocking - do not time out */ + pSMB->Timeout = cpu_to_le32(-1);/* blocking - do not time out */ } else { pSMB->Timeout = 0; } @@ -900,6 +899,7 @@ RENAME_RSP *pSMBr = NULL; int bytes_returned; int name_len, name_len2; + __u16 count; cFYI(1, ("In CIFSSMBRename")); renameRetry: @@ -941,9 +941,9 @@ name_len2++; /* signature byte */ } - pSMB->ByteCount = 1 /* 1st signature byte */ + name_len + name_len2; - pSMB->hdr.smb_buf_length += pSMB->ByteCount; - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + count = 1 /* 1st signature byte */ + name_len + name_len2; + pSMB->hdr.smb_buf_length += count; + pSMB->ByteCount = cpu_to_le16(count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); @@ -977,6 +977,7 @@ int rc = 0; int bytes_returned = 0; int len_of_str; + __u16 params, param_offset, offset, count, byte_count; cFYI(1, ("Rename to File by handle")); rc = smb_init(SMB_COM_TRANSACTION2, 15, pTcon, (void **) &pSMB, @@ -984,28 +985,27 @@ if (rc) return rc; - pSMB->ParameterCount = 6; + params = 6; pSMB->MaxSetupCount = 0; pSMB->Reserved = 0; pSMB->Flags = 0; pSMB->Timeout = 0; pSMB->Reserved2 = 0; - pSMB->ParameterOffset = offsetof(struct smb_com_transaction2_sfi_req, - Fid) - 4; - pSMB->DataOffset = pSMB->ParameterOffset + pSMB->ParameterCount; + param_offset = offsetof(struct smb_com_transaction2_sfi_req, Fid) - 4; + offset = param_offset + params; - data_offset = (char *) (&pSMB->hdr.Protocol) + pSMB->DataOffset; + data_offset = (char *) (&pSMB->hdr.Protocol) + offset; rename_info = (struct set_file_rename *) data_offset; pSMB->MaxParameterCount = cpu_to_le16(2); pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find max SMB PDU from sess */ pSMB->SetupCount = 1; pSMB->Reserved3 = 0; pSMB->SubCommand = cpu_to_le16(TRANS2_SET_FILE_INFORMATION); - pSMB->ByteCount = 3 /* pad */ + pSMB->ParameterCount; - pSMB->ParameterCount = cpu_to_le16(pSMB->ParameterCount); + byte_count = 3 /* pad */ + params; + pSMB->ParameterCount = cpu_to_le16(params); pSMB->TotalParameterCount = pSMB->ParameterCount; - pSMB->ParameterOffset = cpu_to_le16(pSMB->ParameterOffset); - pSMB->DataOffset = cpu_to_le16(pSMB->DataOffset); + pSMB->ParameterOffset = cpu_to_le16(param_offset); + pSMB->DataOffset = cpu_to_le16(offset); /* construct random name ".cifs_tmp" */ rename_info->overwrite = cpu_to_le32(1); rename_info->root_fid = 0; @@ -1017,16 +1017,16 @@ len_of_str = cifs_strtoUCS((wchar_t *) rename_info->target_name, target_name, 530, nls_codepage); } rename_info->target_name_len = cpu_to_le32(2 * len_of_str); - pSMB->DataCount = 12 /* sizeof(struct set_file_rename) */ + (2 * len_of_str) + 2; - pSMB->ByteCount += pSMB->DataCount; - pSMB->DataCount = cpu_to_le16(pSMB->DataCount); + count = 12 /* sizeof(struct set_file_rename) */ + (2 * len_of_str) + 2; + byte_count += count; + pSMB->DataCount = cpu_to_le16(count); pSMB->TotalDataCount = pSMB->DataCount; pSMB->Fid = netfid; pSMB->InformationLevel = cpu_to_le16(SMB_SET_FILE_RENAME_INFORMATION); pSMB->Reserved4 = 0; - pSMB->hdr.smb_buf_length += pSMB->ByteCount; - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + pSMB->hdr.smb_buf_length += byte_count; + pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, pTcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); if (rc) { @@ -1056,6 +1056,7 @@ COPY_RSP *pSMBr = NULL; int bytes_returned; int name_len, name_len2; + __u16 count; cFYI(1, ("In CIFSSMBCopy")); copyRetry: @@ -1067,9 +1068,7 @@ pSMB->BufferFormat = 0x04; pSMB->Tid2 = target_tid; - if(flags & COPY_TREE) - pSMB->Flags |= COPY_TREE; - pSMB->Flags = cpu_to_le16(pSMB->Flags); + pSMB->Flags = cpu_to_le16(flags & COPY_TREE); if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { name_len = cifs_strtoUCS((wchar_t *) pSMB->OldFileName, @@ -1098,15 +1097,15 @@ name_len2++; /* signature byte */ } - pSMB->ByteCount = 1 /* 1st signature byte */ + name_len + name_len2; - pSMB->hdr.smb_buf_length += pSMB->ByteCount; - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + count = 1 /* 1st signature byte */ + name_len + name_len2; + pSMB->hdr.smb_buf_length += count; + pSMB->ByteCount = cpu_to_le16(count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); if (rc) { cFYI(1, ("Send error in copy = %d with %d files copied", - rc, pSMBr->CopyCount)); + rc, le16_to_cpu(pSMBr->CopyCount))); } if (pSMB) cifs_buf_release(pSMB); @@ -1129,6 +1128,7 @@ int name_len_target; int rc = 0; int bytes_returned = 0; + __u16 params, param_offset, offset, byte_count; cFYI(1, ("In Symlink Unix style")); createSymLinkRetry: @@ -1150,17 +1150,17 @@ name_len++; /* trailing null */ strncpy(pSMB->FileName, fromName, name_len); } - pSMB->ParameterCount = 6 + name_len; + params = 6 + name_len; pSMB->MaxSetupCount = 0; pSMB->Reserved = 0; pSMB->Flags = 0; pSMB->Timeout = 0; pSMB->Reserved2 = 0; - pSMB->ParameterOffset = offsetof(struct smb_com_transaction2_spi_req, + param_offset = offsetof(struct smb_com_transaction2_spi_req, InformationLevel) - 4; - pSMB->DataOffset = pSMB->ParameterOffset + pSMB->ParameterCount; + offset = param_offset + params; - data_offset = (char *) (&pSMB->hdr.Protocol) + pSMB->DataOffset; + data_offset = (char *) (&pSMB->hdr.Protocol) + offset; if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { name_len_target = cifs_strtoUCS((wchar_t *) data_offset, toName, 530 @@ -1174,24 +1174,23 @@ strncpy(data_offset, toName, name_len_target); } - pSMB->DataCount = name_len_target; pSMB->MaxParameterCount = cpu_to_le16(2); /* BB find exact max on data count below from sess */ pSMB->MaxDataCount = cpu_to_le16(1000); pSMB->SetupCount = 1; pSMB->Reserved3 = 0; pSMB->SubCommand = cpu_to_le16(TRANS2_SET_PATH_INFORMATION); - pSMB->ByteCount = 3 /* pad */ + pSMB->ParameterCount + pSMB->DataCount; - pSMB->DataCount = cpu_to_le16(pSMB->DataCount); - pSMB->ParameterCount = cpu_to_le16(pSMB->ParameterCount); + byte_count = 3 /* pad */ + params + name_len_target; + pSMB->DataCount = cpu_to_le16(name_len_target); + pSMB->ParameterCount = cpu_to_le16(params); pSMB->TotalDataCount = pSMB->DataCount; pSMB->TotalParameterCount = pSMB->ParameterCount; - pSMB->ParameterOffset = cpu_to_le16(pSMB->ParameterOffset); - pSMB->DataOffset = cpu_to_le16(pSMB->DataOffset); + pSMB->ParameterOffset = cpu_to_le16(param_offset); + pSMB->DataOffset = cpu_to_le16(offset); pSMB->InformationLevel = cpu_to_le16(SMB_SET_FILE_UNIX_LINK); pSMB->Reserved4 = 0; - pSMB->hdr.smb_buf_length += pSMB->ByteCount; - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + pSMB->hdr.smb_buf_length += byte_count; + pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); if (rc) { @@ -1221,6 +1220,7 @@ int name_len_target; int rc = 0; int bytes_returned = 0; + __u16 params, param_offset, offset, byte_count; cFYI(1, ("In Create Hard link Unix style")); createHardLinkRetry: @@ -1241,17 +1241,17 @@ name_len++; /* trailing null */ strncpy(pSMB->FileName, toName, name_len); } - pSMB->ParameterCount = 6 + name_len; + params = 6 + name_len; pSMB->MaxSetupCount = 0; pSMB->Reserved = 0; pSMB->Flags = 0; pSMB->Timeout = 0; pSMB->Reserved2 = 0; - pSMB->ParameterOffset = offsetof(struct smb_com_transaction2_spi_req, + param_offset = offsetof(struct smb_com_transaction2_spi_req, InformationLevel) - 4; - pSMB->DataOffset = pSMB->ParameterOffset + pSMB->ParameterCount; + offset = param_offset + params; - data_offset = (char *) (&pSMB->hdr.Protocol) + pSMB->DataOffset; + data_offset = (char *) (&pSMB->hdr.Protocol) + offset; if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { name_len_target = cifs_strtoUCS((wchar_t *) data_offset, fromName, 530 @@ -1265,24 +1265,23 @@ strncpy(data_offset, fromName, name_len_target); } - pSMB->DataCount = name_len_target; pSMB->MaxParameterCount = cpu_to_le16(2); /* BB find exact max on data count below from sess*/ pSMB->MaxDataCount = cpu_to_le16(1000); pSMB->SetupCount = 1; pSMB->Reserved3 = 0; pSMB->SubCommand = cpu_to_le16(TRANS2_SET_PATH_INFORMATION); - pSMB->ByteCount = 3 /* pad */ + pSMB->ParameterCount + pSMB->DataCount; - pSMB->ParameterCount = cpu_to_le16(pSMB->ParameterCount); + byte_count = 3 /* pad */ + params + name_len_target; + pSMB->ParameterCount = cpu_to_le16(params); pSMB->TotalParameterCount = pSMB->ParameterCount; - pSMB->DataCount = cpu_to_le16(pSMB->DataCount); + pSMB->DataCount = cpu_to_le16(name_len_target); pSMB->TotalDataCount = pSMB->DataCount; - pSMB->ParameterOffset = cpu_to_le16(pSMB->ParameterOffset); - pSMB->DataOffset = cpu_to_le16(pSMB->DataOffset); + pSMB->ParameterOffset = cpu_to_le16(param_offset); + pSMB->DataOffset = cpu_to_le16(offset); pSMB->InformationLevel = cpu_to_le16(SMB_SET_FILE_UNIX_HLINK); pSMB->Reserved4 = 0; - pSMB->hdr.smb_buf_length += pSMB->ByteCount; - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + pSMB->hdr.smb_buf_length += byte_count; + pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); if (rc) { @@ -1307,6 +1306,7 @@ RENAME_RSP *pSMBr = NULL; int bytes_returned; int name_len, name_len2; + __u16 count; cFYI(1, ("In CIFSCreateHardLink")); winCreateHardLinkRetry: @@ -1351,9 +1351,9 @@ name_len2++; /* signature byte */ } - pSMB->ByteCount = 1 /* string type byte */ + name_len + name_len2; - pSMB->hdr.smb_buf_length += pSMB->ByteCount; - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + count = 1 /* string type byte */ + name_len + name_len2; + pSMB->hdr.smb_buf_length += count; + pSMB->ByteCount = cpu_to_le16(count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); @@ -1380,6 +1380,7 @@ int rc = 0; int bytes_returned; int name_len; + __u16 params, byte_count; cFYI(1, ("In QPathSymLinkInfo (Unix) for path %s", searchName)); @@ -1402,8 +1403,7 @@ strncpy(pSMB->FileName, searchName, name_len); } - pSMB->TotalParameterCount = - 2 /* level */ + 4 /* rsrvd */ + name_len /* incl null */ ; + params = 2 /* level */ + 4 /* rsrvd */ + name_len /* incl null */ ; pSMB->TotalDataCount = 0; pSMB->MaxParameterCount = cpu_to_le16(2); /* BB find exact max data count below from sess structure BB */ @@ -1420,38 +1420,38 @@ pSMB->SetupCount = 1; pSMB->Reserved3 = 0; pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_PATH_INFORMATION); - pSMB->ByteCount = pSMB->TotalParameterCount + 1 /* pad */ ; - pSMB->TotalParameterCount = cpu_to_le16(pSMB->TotalParameterCount); + byte_count = params + 1 /* pad */ ; + pSMB->TotalParameterCount = cpu_to_le16(params); pSMB->ParameterCount = pSMB->TotalParameterCount; pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_FILE_UNIX_LINK); pSMB->Reserved4 = 0; - pSMB->hdr.smb_buf_length += pSMB->ByteCount; - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + pSMB->hdr.smb_buf_length += byte_count; + pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); if (rc) { cFYI(1, ("Send error in QuerySymLinkInfo = %d", rc)); } else { /* decode response */ - pSMBr->DataOffset = le16_to_cpu(pSMBr->DataOffset); - pSMBr->DataCount = le16_to_cpu(pSMBr->DataCount); - if ((pSMBr->ByteCount < 2) || (pSMBr->DataOffset > 512)) + __u16 data_offset = le16_to_cpu(pSMBr->DataOffset); + __u16 count = le16_to_cpu(pSMBr->DataCount); + if ((pSMBr->ByteCount < 2) || (data_offset > 512)) /* BB also check enough total bytes returned */ rc = -EIO; /* bad smb */ else { if (pSMBr->hdr.Flags2 & SMBFLG2_UNICODE) { name_len = UniStrnlen((wchar_t *) ((char *) - &pSMBr->hdr.Protocol +pSMBr->DataOffset), - min_t(const int, buflen,pSMBr->DataCount) / 2); + &pSMBr->hdr.Protocol +data_offset), + min_t(const int, buflen,count) / 2); cifs_strfromUCS_le(symlinkinfo, (wchar_t *) ((char *)&pSMBr->hdr.Protocol + - pSMBr->DataOffset), + data_offset), name_len, nls_codepage); } else { strncpy(symlinkinfo, (char *) &pSMBr->hdr.Protocol + - pSMBr->DataOffset, - min_t(const int, buflen, pSMBr->DataCount)); + data_offset, + min_t(const int, buflen, count)); } symlinkinfo[buflen] = 0; /* just in case so calling code does not go off the end of buffer */ @@ -1562,6 +1562,7 @@ int rc = 0; int bytes_returned; int name_len; + __u16 params, byte_count; cFYI(1, ("In QPathInfo path %s", searchName)); QPathInfoRetry: @@ -1583,8 +1584,7 @@ strncpy(pSMB->FileName, searchName, name_len); } - pSMB->TotalParameterCount = 2 /* level */ + 4 /* reserved */ + - name_len /* includes null */ ; + params = 2 /* level */ + 4 /* reserved */ + name_len /* includes NUL */ ; pSMB->TotalDataCount = 0; pSMB->MaxParameterCount = cpu_to_le16(2); pSMB->MaxDataCount = cpu_to_le16(4000); /* BB find exact max SMB PDU from sess structure BB */ @@ -1600,29 +1600,29 @@ pSMB->SetupCount = 1; pSMB->Reserved3 = 0; pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_PATH_INFORMATION); - pSMB->ByteCount = pSMB->TotalParameterCount + 1 /* pad */ ; - pSMB->TotalParameterCount = cpu_to_le16(pSMB->TotalParameterCount); + byte_count = params + 1 /* pad */ ; + pSMB->TotalParameterCount = cpu_to_le16(params); pSMB->ParameterCount = pSMB->TotalParameterCount; pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_FILE_ALL_INFO); pSMB->Reserved4 = 0; - pSMB->hdr.smb_buf_length += pSMB->ByteCount; - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + pSMB->hdr.smb_buf_length += byte_count; + pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); if (rc) { cFYI(1, ("Send error in QPathInfo = %d", rc)); } else { /* decode response */ - pSMBr->DataOffset = le16_to_cpu(pSMBr->DataOffset); + __u16 data_offset = le16_to_cpu(pSMBr->DataOffset); /* BB also check enough total bytes returned */ /* BB we need to improve the validity checking of these trans2 responses */ - if ((pSMBr->ByteCount < 40) || (pSMBr->DataOffset > 512)) + if ((pSMBr->ByteCount < 40) || (data_offset > 512)) rc = -EIO; /* bad smb */ else if (pFindData){ memcpy((char *) pFindData, (char *) &pSMBr->hdr.Protocol + - pSMBr->DataOffset, sizeof (FILE_ALL_INFO)); + data_offset, sizeof (FILE_ALL_INFO)); } else rc = -ENOMEM; } @@ -1646,6 +1646,7 @@ int rc = 0; int bytes_returned = 0; int name_len; + __u16 params, byte_count; cFYI(1, ("In QPathInfo (Unix) the path %s", searchName)); UnixQPathInfoRetry: @@ -1667,8 +1668,7 @@ strncpy(pSMB->FileName, searchName, name_len); } - pSMB->TotalParameterCount = 2 /* level */ + 4 /* reserved */ + - name_len /* includes null */ ; + params = 2 /* level */ + 4 /* reserved */ + name_len /* includes NUL */ ; pSMB->TotalDataCount = 0; pSMB->MaxParameterCount = cpu_to_le16(2); /* BB find exact max SMB PDU from sess structure BB */ @@ -1685,31 +1685,31 @@ pSMB->SetupCount = 1; pSMB->Reserved3 = 0; pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_PATH_INFORMATION); - pSMB->ByteCount = pSMB->TotalParameterCount + 1 /* pad */ ; - pSMB->TotalParameterCount = cpu_to_le16(pSMB->TotalParameterCount); + byte_count = params + 1 /* pad */ ; + pSMB->TotalParameterCount = cpu_to_le16(params); pSMB->ParameterCount = pSMB->TotalParameterCount; pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_FILE_UNIX_BASIC); pSMB->Reserved4 = 0; - pSMB->hdr.smb_buf_length += pSMB->ByteCount; - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + pSMB->hdr.smb_buf_length += byte_count; + pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); if (rc) { cFYI(1, ("Send error in QPathInfo = %d", rc)); } else { /* decode response */ - pSMBr->DataOffset = le16_to_cpu(pSMBr->DataOffset); + __u16 data_offset = le16_to_cpu(pSMBr->DataOffset); /* BB also check if enough total bytes returned */ if ((pSMBr->ByteCount < sizeof(FILE_UNIX_BASIC_INFO)) || - (pSMBr->DataOffset > 512) || - (pSMBr->DataOffset < sizeof(struct smb_hdr))) { + (data_offset > 512) || + (data_offset < sizeof(struct smb_hdr))) { cFYI(1,("UnixQPathinfo invalid data offset %d bytes returned %d", - (int)pSMBr->DataOffset,bytes_returned)); + (int)data_offset,bytes_returned)); rc = -EIO; /* bad smb */ } else { memcpy((char *) pFindData, (char *) &pSMBr->hdr.Protocol + - pSMBr->DataOffset, + data_offset, sizeof (FILE_UNIX_BASIC_INFO)); } } @@ -1732,6 +1732,7 @@ int rc = 0; int bytes_returned; int name_len; + __u16 params, byte_count; cFYI(1, ("In FindUnique")); findUniqueRetry: @@ -1753,7 +1754,7 @@ strncpy(pSMB->FileName, searchName, name_len); } - pSMB->TotalParameterCount = 12 + name_len /* includes null */ ; + params = 12 + name_len /* includes null */ ; pSMB->TotalDataCount = 0; /* no EAs */ pSMB->MaxParameterCount = cpu_to_le16(2); pSMB->MaxDataCount = cpu_to_le16(4000); /* BB find exact max SMB PDU from sess structure BB */ @@ -1769,8 +1770,8 @@ pSMB->SetupCount = 1; /* one byte, no need to le convert */ pSMB->Reserved3 = 0; pSMB->SubCommand = cpu_to_le16(TRANS2_FIND_FIRST); - pSMB->ByteCount = pSMB->TotalParameterCount + 1 /* pad */ ; - pSMB->TotalParameterCount = cpu_to_le16(pSMB->TotalDataCount); + byte_count = params + 1 /* pad */ ; + pSMB->TotalParameterCount = cpu_to_le16(params); pSMB->ParameterCount = pSMB->TotalParameterCount; pSMB->SearchAttributes = cpu_to_le16(ATTR_READONLY | ATTR_HIDDEN | ATTR_SYSTEM | @@ -1779,8 +1780,8 @@ pSMB->SearchFlags = cpu_to_le16(1); pSMB->InformationLevel = cpu_to_le16(SMB_FIND_FILE_DIRECTORY_INFO); pSMB->SearchStorageType = 0; /* BB what should we set this to? BB */ - pSMB->hdr.smb_buf_length += pSMB->ByteCount; - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + pSMB->hdr.smb_buf_length += byte_count; + pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); @@ -1813,6 +1814,7 @@ int rc = 0; int bytes_returned; int name_len; + __u16 params, byte_count; cFYI(1, ("In FindFirst")); findFirstRetry: @@ -1834,7 +1836,7 @@ strncpy(pSMB->FileName, searchName, name_len); } - pSMB->TotalParameterCount = 12 + name_len /* includes null */ ; + params = 12 + name_len /* includes null */ ; pSMB->TotalDataCount = 0; /* no EAs */ pSMB->MaxParameterCount = cpu_to_le16(10); pSMB->MaxDataCount = cpu_to_le16((tcon->ses->server->maxBuf - @@ -1844,8 +1846,8 @@ pSMB->Flags = 0; pSMB->Timeout = 0; pSMB->Reserved2 = 0; - pSMB->ByteCount = pSMB->TotalParameterCount + 1 /* pad */ ; - pSMB->TotalParameterCount = cpu_to_le16(pSMB->TotalParameterCount); + byte_count = params + 1 /* pad */ ; + pSMB->TotalParameterCount = cpu_to_le16(params); pSMB->ParameterCount = pSMB->TotalParameterCount; pSMB->ParameterOffset = cpu_to_le16(offsetof(struct smb_com_transaction2_ffirst_req, SearchAttributes) - 4); @@ -1870,8 +1872,8 @@ *pUnixFlag = FALSE; } pSMB->SearchStorageType = 0; /* BB what should we set this to? It is not clear if it matters BB */ - pSMB->hdr.smb_buf_length += pSMB->ByteCount; - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + pSMB->hdr.smb_buf_length += byte_count; + pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); @@ -1888,11 +1890,6 @@ (char *) &pSMBr->hdr.Protocol + le16_to_cpu(pSMBr->ParameterOffset), sizeof (T2_FFIRST_RSP_PARMS)); - /* search handle can stay LE and EAoffset not needed so not converted */ - findParms->EndofSearch = le16_to_cpu(findParms->EndofSearch); - findParms->LastNameOffset = - le16_to_cpu(findParms->LastNameOffset); - findParms->SearchCount = le16_to_cpu(findParms->SearchCount); response_data = (char *) &pSMBr->hdr.Protocol + le16_to_cpu(pSMBr->DataOffset); @@ -1919,6 +1916,7 @@ char *response_data; int rc = 0; int bytes_returned; + __u16 params, byte_count; cFYI(1, ("In FindNext")); @@ -1930,7 +1928,8 @@ if (rc) return rc; - pSMB->TotalParameterCount = 14; /* includes 2 bytes of null string, converted to LE below */ + params = 14; /* includes 2 bytes of null string, converted to LE below */ + byte_count = 0; pSMB->TotalDataCount = 0; /* no EAs */ pSMB->MaxParameterCount = cpu_to_le16(8); pSMB->MaxDataCount = @@ -1966,15 +1965,15 @@ /* BB add check to make sure we do not cross end of smb */ if(name_len < CIFS_MAX_MSGSIZE) { memcpy(pSMB->ResumeFileName, resume_file_name, name_len); - pSMB->ByteCount += name_len; + byte_count += name_len; } - pSMB->TotalParameterCount += name_len; - pSMB->ByteCount = pSMB->TotalParameterCount + 1 /* pad */ ; - pSMB->TotalParameterCount = cpu_to_le16(pSMB->TotalParameterCount); + params += name_len; + byte_count = params + 1 /* pad */ ; + pSMB->TotalParameterCount = cpu_to_le16(params); pSMB->ParameterCount = pSMB->TotalParameterCount; /* BB improve error handling here */ - pSMB->hdr.smb_buf_length += pSMB->ByteCount; - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + pSMB->hdr.smb_buf_length += byte_count; + pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); @@ -1994,10 +1993,6 @@ (char *) &pSMBr->hdr.Protocol + le16_to_cpu(pSMBr->ParameterOffset), sizeof (T2_FNEXT_RSP_PARMS)); - findParms->EndofSearch = le16_to_cpu(findParms->EndofSearch); - findParms->LastNameOffset = - le16_to_cpu(findParms->LastNameOffset); - findParms->SearchCount = le16_to_cpu(findParms->SearchCount); response_data = (char *) &pSMBr->hdr.Protocol + le16_to_cpu(pSMBr->DataOffset); @@ -2063,6 +2058,7 @@ int name_len; unsigned int i; char * temp; + __u16 params, byte_count; *number_of_UNC_in_array = 0; *targetUNCs = NULL; @@ -2099,7 +2095,7 @@ strncpy(pSMB->RequestFileName, searchName, name_len); } - pSMB->ParameterCount = 2 /* level */ + name_len /*includes null */ ; + params = 2 /* level */ + name_len /*includes null */ ; pSMB->TotalDataCount = 0; pSMB->DataCount = 0; pSMB->DataOffset = 0; @@ -2115,12 +2111,12 @@ pSMB->SetupCount = 1; pSMB->Reserved3 = 0; pSMB->SubCommand = cpu_to_le16(TRANS2_GET_DFS_REFERRAL); - pSMB->ByteCount = pSMB->ParameterCount + 3 /* pad */ ; - pSMB->ParameterCount = cpu_to_le16(pSMB->ParameterCount); + byte_count = params + 3 /* pad */ ; + pSMB->ParameterCount = cpu_to_le16(params); pSMB->TotalParameterCount = pSMB->ParameterCount; pSMB->MaxReferralLevel = cpu_to_le16(3); - pSMB->hdr.smb_buf_length += pSMB->ByteCount; - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + pSMB->hdr.smb_buf_length += byte_count; + pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); @@ -2128,20 +2124,21 @@ cFYI(1, ("Send error in GetDFSRefer = %d", rc)); } else { /* decode response */ /* BB Add logic to parse referrals here */ - pSMBr->DataOffset = le16_to_cpu(pSMBr->DataOffset); - pSMBr->DataCount = le16_to_cpu(pSMBr->DataCount); + __u16 data_offset = le16_to_cpu(pSMBr->DataOffset); + __u16 data_count = le16_to_cpu(pSMBr->DataCount); cFYI(1, ("Decoding GetDFSRefer response. BCC: %d Offset %d", - pSMBr->ByteCount, pSMBr->DataOffset)); - if ((pSMBr->ByteCount < 17) || (pSMBr->DataOffset > 512)) /* BB also check enough total bytes returned */ + pSMBr->ByteCount, data_offset)); + if ((pSMBr->ByteCount < 17) || (data_offset > 512)) /* BB also check enough total bytes returned */ rc = -EIO; /* bad smb */ else { referrals = (struct dfs_referral_level_3 *) (8 /* sizeof start of data block */ + - pSMBr->DataOffset + + data_offset + (char *) &pSMBr->hdr.Protocol); - cFYI(1,("num_referrals: %d dfs flags: 0x%x ... \nfor referral one refer size: 0x%x srv type: 0x%x refer flags: 0x%x ttl: 0x%x",pSMBr->NumberOfReferrals,pSMBr->DFSFlags, referrals->ReferralSize,referrals->ServerType,referrals->ReferralFlags,referrals->TimeToLive)); + cFYI(1,("num_referrals: %d dfs flags: 0x%x ... \nfor referral one refer size: 0x%x srv type: 0x%x refer flags: 0x%x ttl: 0x%x", + le16_to_cpu(pSMBr->NumberOfReferrals),le16_to_cpu(pSMBr->DFSFlags), le16_to_cpu(referrals->ReferralSize),le16_to_cpu(referrals->ServerType),le16_to_cpu(referrals->ReferralFlags),le16_to_cpu(referrals->TimeToLive))); /* BB This field is actually two bytes in from start of data block so we could do safety check that DataBlock begins at address of pSMBr->NumberOfReferrals */ @@ -2155,19 +2152,19 @@ name_len = 0; for(i=0;i<*number_of_UNC_in_array;i++) { /* make sure that DfsPathOffset not past end */ - referrals->DfsPathOffset = le16_to_cpu(referrals->DfsPathOffset); - if(referrals->DfsPathOffset > pSMBr->DataCount) { + __u16 offset = le16_to_cpu(referrals->DfsPathOffset); + if (offset > data_count) { /* if invalid referral, stop here and do not try to copy any more */ *number_of_UNC_in_array = i; break; } - temp = ((char *)referrals) + referrals->DfsPathOffset; + temp = ((char *)referrals) + offset; if (pSMBr->hdr.Flags2 & SMBFLG2_UNICODE) { - name_len += UniStrnlen((wchar_t *)temp,pSMBr->DataCount); + name_len += UniStrnlen((wchar_t *)temp,data_count); } else { - name_len += strnlen(temp,pSMBr->DataCount); + name_len += strnlen(temp,data_count); } referrals++; /* BB add check that referral pointer does not fall off end PDU */ @@ -2184,11 +2181,11 @@ referrals = (struct dfs_referral_level_3 *) (8 /* sizeof data hdr */ + - pSMBr->DataOffset + + data_offset + (char *) &pSMBr->hdr.Protocol); for(i=0;i<*number_of_UNC_in_array;i++) { - temp = ((char *)referrals) + referrals->DfsPathOffset; + temp = ((char *)referrals) + le16_to_cpu(referrals->DfsPathOffset); if (pSMBr->hdr.Flags2 & SMBFLG2_UNICODE) { cifs_strfromUCS_le(*targetUNCs, (wchar_t *) temp, name_len, nls_codepage); @@ -2223,6 +2220,7 @@ FILE_SYSTEM_INFO *response_data; int rc = 0; int bytes_returned = 0; + __u16 params, byte_count; cFYI(1, ("In QFSInfo")); QFSInfoRetry: @@ -2231,7 +2229,7 @@ if (rc) return rc; - pSMB->TotalParameterCount = 2; /* level */ + params = 2; /* level */ pSMB->TotalDataCount = 0; pSMB->MaxParameterCount = cpu_to_le16(2); pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find exact max SMB PDU from sess structure BB */ @@ -2240,8 +2238,8 @@ pSMB->Flags = 0; pSMB->Timeout = 0; pSMB->Reserved2 = 0; - pSMB->ByteCount = pSMB->TotalParameterCount + 1 /* pad */ ; - pSMB->TotalParameterCount = cpu_to_le16(pSMB->TotalParameterCount); + byte_count = params + 1 /* pad */ ; + pSMB->TotalParameterCount = cpu_to_le16(params); pSMB->ParameterCount = pSMB->TotalParameterCount; pSMB->ParameterOffset = cpu_to_le16(offsetof( struct smb_com_transaction2_qfsi_req, InformationLevel) - 4); @@ -2251,25 +2249,25 @@ pSMB->Reserved3 = 0; pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_FS_INFORMATION); pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_FS_SIZE_INFO); - pSMB->hdr.smb_buf_length += pSMB->ByteCount; - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + pSMB->hdr.smb_buf_length += byte_count; + pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); if (rc) { cERROR(1, ("Send error in QFSInfo = %d", rc)); } else { /* decode response */ - pSMBr->DataOffset = le16_to_cpu(pSMBr->DataOffset); + __u16 data_offset = le16_to_cpu(pSMBr->DataOffset); cFYI(1, ("Decoding qfsinfo response. BCC: %d Offset %d", - pSMBr->ByteCount, pSMBr->DataOffset)); - if ((pSMBr->ByteCount < 24) || (pSMBr->DataOffset > 512)) /* BB also check enough total bytes returned */ + pSMBr->ByteCount, data_offset)); + if ((pSMBr->ByteCount < 24) || (data_offset > 512)) /* BB also check enough total bytes returned */ rc = -EIO; /* bad smb */ else { response_data = (FILE_SYSTEM_INFO *) (((char *) &pSMBr->hdr.Protocol) + - pSMBr->DataOffset); + data_offset); FSData->f_bsize = le32_to_cpu(response_data->BytesPerSector) * le32_to_cpu(response_data-> @@ -2304,6 +2302,7 @@ FILE_SYSTEM_ATTRIBUTE_INFO *response_data; int rc = 0; int bytes_returned = 0; + __u16 params, byte_count; cFYI(1, ("In QFSAttributeInfo")); QFSAttributeRetry: @@ -2312,7 +2311,7 @@ if (rc) return rc; - pSMB->TotalParameterCount = 2; /* level */ + params = 2; /* level */ pSMB->TotalDataCount = 0; pSMB->MaxParameterCount = cpu_to_le16(2); pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find exact max SMB PDU from sess structure BB */ @@ -2321,8 +2320,8 @@ pSMB->Flags = 0; pSMB->Timeout = 0; pSMB->Reserved2 = 0; - pSMB->ByteCount = pSMB->TotalParameterCount + 1 /* pad */ ; - pSMB->TotalParameterCount = cpu_to_le16(pSMB->TotalParameterCount); + byte_count = params + 1 /* pad */ ; + pSMB->TotalParameterCount = cpu_to_le16(params); pSMB->ParameterCount = pSMB->TotalParameterCount; pSMB->ParameterOffset = cpu_to_le16(offsetof( struct smb_com_transaction2_qfsi_req, InformationLevel) - 4); @@ -2332,27 +2331,22 @@ pSMB->Reserved3 = 0; pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_FS_INFORMATION); pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_FS_ATTRIBUTE_INFO); - pSMB->hdr.smb_buf_length += pSMB->ByteCount; - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + pSMB->hdr.smb_buf_length += byte_count; + pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); if (rc) { cERROR(1, ("Send error in QFSAttributeInfo = %d", rc)); } else { /* decode response */ - pSMBr->DataOffset = le16_to_cpu(pSMBr->DataOffset); - if ((pSMBr->ByteCount < 13) || (pSMBr->DataOffset > 512)) { /* BB also check enough bytes returned */ + __u16 data_offset = le16_to_cpu(pSMBr->DataOffset); + if ((pSMBr->ByteCount < 13) || (data_offset > 512)) { /* BB also check enough bytes returned */ rc = -EIO; /* bad smb */ } else { response_data = (FILE_SYSTEM_ATTRIBUTE_INFO *) (((char *) &pSMBr->hdr.Protocol) + - pSMBr->DataOffset); - response_data->Attributes = le32_to_cpu(response_data->Attributes); - response_data->MaxPathNameComponentLength = - le32_to_cpu(response_data->MaxPathNameComponentLength); - response_data->FileSystemNameLen = - le32_to_cpu(response_data->FileSystemNameLen); + data_offset); memcpy(&tcon->fsAttrInfo, response_data, sizeof (FILE_SYSTEM_ATTRIBUTE_INFO)); } @@ -2376,6 +2370,7 @@ FILE_SYSTEM_DEVICE_INFO *response_data; int rc = 0; int bytes_returned = 0; + __u16 params, byte_count; cFYI(1, ("In QFSDeviceInfo")); QFSDeviceRetry: @@ -2384,7 +2379,7 @@ if (rc) return rc; - pSMB->TotalParameterCount = 2; /* level */ + params = 2; /* level */ pSMB->TotalDataCount = 0; pSMB->MaxParameterCount = cpu_to_le16(2); pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find exact max SMB PDU from sess structure BB */ @@ -2393,8 +2388,8 @@ pSMB->Flags = 0; pSMB->Timeout = 0; pSMB->Reserved2 = 0; - pSMB->ByteCount = pSMB->TotalParameterCount + 1 /* pad */ ; - pSMB->TotalParameterCount = cpu_to_le16(pSMB->TotalParameterCount); + byte_count = params + 1 /* pad */ ; + pSMB->TotalParameterCount = cpu_to_le16(params); pSMB->ParameterCount = pSMB->TotalParameterCount; pSMB->ParameterOffset = cpu_to_le16(offsetof( struct smb_com_transaction2_qfsi_req, InformationLevel) - 4); @@ -2405,27 +2400,23 @@ pSMB->Reserved3 = 0; pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_FS_INFORMATION); pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_FS_DEVICE_INFO); - pSMB->hdr.smb_buf_length += pSMB->ByteCount; - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + pSMB->hdr.smb_buf_length += byte_count; + pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); if (rc) { cFYI(1, ("Send error in QFSDeviceInfo = %d", rc)); } else { /* decode response */ - pSMBr->DataOffset = le16_to_cpu(pSMBr->DataOffset); + __u16 data_offset = le16_to_cpu(pSMBr->DataOffset); if ((pSMBr->ByteCount < sizeof (FILE_SYSTEM_DEVICE_INFO)) - || (pSMBr->DataOffset > 512)) + || (data_offset > 512)) rc = -EIO; /* bad smb */ else { response_data = (FILE_SYSTEM_DEVICE_INFO *) (((char *) &pSMBr->hdr.Protocol) + - pSMBr->DataOffset); - response_data->DeviceType = - le32_to_cpu(response_data->DeviceType); - response_data->DeviceCharacteristics = - le32_to_cpu(response_data->DeviceCharacteristics); + data_offset); memcpy(&tcon->fsDevInfo, response_data, sizeof (FILE_SYSTEM_DEVICE_INFO)); } @@ -2449,6 +2440,7 @@ FILE_SYSTEM_UNIX_INFO *response_data; int rc = 0; int bytes_returned = 0; + __u16 params, byte_count; cFYI(1, ("In QFSUnixInfo")); QFSUnixRetry: @@ -2457,7 +2449,7 @@ if (rc) return rc; - pSMB->ParameterCount = 2; /* level */ + params = 2; /* level */ pSMB->TotalDataCount = 0; pSMB->DataCount = 0; pSMB->DataOffset = 0; @@ -2468,8 +2460,8 @@ pSMB->Flags = 0; pSMB->Timeout = 0; pSMB->Reserved2 = 0; - pSMB->ByteCount = pSMB->ParameterCount + 1 /* pad */ ; - pSMB->ParameterCount = cpu_to_le16(pSMB->ParameterCount); + byte_count = params + 1 /* pad */ ; + pSMB->ParameterCount = cpu_to_le16(params); pSMB->TotalParameterCount = pSMB->ParameterCount; pSMB->ParameterOffset = cpu_to_le16(offsetof(struct smb_com_transaction2_qfsi_req, InformationLevel) - 4); @@ -2477,28 +2469,22 @@ pSMB->Reserved3 = 0; pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_FS_INFORMATION); pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_CIFS_UNIX_INFO); - pSMB->hdr.smb_buf_length += pSMB->ByteCount; - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + pSMB->hdr.smb_buf_length += byte_count; + pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); if (rc) { cERROR(1, ("Send error in QFSUnixInfo = %d", rc)); } else { /* decode response */ - pSMBr->DataOffset = cpu_to_le16(pSMBr->DataOffset); - if ((pSMBr->ByteCount < 13) || (pSMBr->DataOffset > 512)) { + __u16 data_offset = le16_to_cpu(pSMBr->DataOffset); + if ((pSMBr->ByteCount < 13) || (data_offset > 512)) { rc = -EIO; /* bad smb */ } else { response_data = (FILE_SYSTEM_UNIX_INFO *) (((char *) &pSMBr->hdr.Protocol) + - pSMBr->DataOffset); - response_data->MajorVersionNumber = - le16_to_cpu(response_data->MajorVersionNumber); - response_data->MinorVersionNumber = - le16_to_cpu(response_data->MinorVersionNumber); - response_data->Capability = - le64_to_cpu(response_data->Capability); + data_offset); memcpy(&tcon->fsUnixInfo, response_data, sizeof (FILE_SYSTEM_UNIX_INFO)); } @@ -2529,6 +2515,7 @@ int name_len; int rc = 0; int bytes_returned = 0; + __u16 params, byte_count, data_count, param_offset, offset; cFYI(1, ("In SetEOF")); SetEOFRetry: @@ -2549,8 +2536,8 @@ name_len++; /* trailing null */ strncpy(pSMB->FileName, fileName, name_len); } - pSMB->ParameterCount = 6 + name_len; - pSMB->DataCount = sizeof (struct file_end_of_file_info); + params = 6 + name_len; + data_count = sizeof (struct file_end_of_file_info); pSMB->MaxParameterCount = cpu_to_le16(2); pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find max SMB size from sess */ pSMB->MaxSetupCount = 0; @@ -2558,9 +2545,9 @@ pSMB->Flags = 0; pSMB->Timeout = 0; pSMB->Reserved2 = 0; - pSMB->ParameterOffset = offsetof(struct smb_com_transaction2_spi_req, + param_offset = offsetof(struct smb_com_transaction2_spi_req, InformationLevel) - 4; - pSMB->DataOffset = pSMB->ParameterOffset + pSMB->ParameterCount; + offset = param_offset + params; if(SetAllocation) { if (tcon->ses->capabilities & CAP_INFOLEVEL_PASSTHRU) pSMB->InformationLevel = @@ -2579,21 +2566,21 @@ parm_data = (struct file_end_of_file_info *) (((char *) &pSMB->hdr.Protocol) + - pSMB->DataOffset); - pSMB->ParameterOffset = cpu_to_le16(pSMB->ParameterOffset); - pSMB->DataOffset = cpu_to_le16(pSMB->DataOffset); + offset); + pSMB->ParameterOffset = cpu_to_le16(param_offset); + pSMB->DataOffset = cpu_to_le16(offset); pSMB->SetupCount = 1; pSMB->Reserved3 = 0; pSMB->SubCommand = cpu_to_le16(TRANS2_SET_PATH_INFORMATION); - pSMB->ByteCount = 3 /* pad */ + pSMB->ParameterCount + pSMB->DataCount; - pSMB->DataCount = cpu_to_le16(pSMB->DataCount); + byte_count = 3 /* pad */ + params + data_count; + pSMB->DataCount = cpu_to_le16(data_count); pSMB->TotalDataCount = pSMB->DataCount; - pSMB->ParameterCount = cpu_to_le16(pSMB->ParameterCount); + pSMB->ParameterCount = cpu_to_le16(params); pSMB->TotalParameterCount = pSMB->ParameterCount; pSMB->Reserved4 = 0; - pSMB->hdr.smb_buf_length += pSMB->ByteCount; + pSMB->hdr.smb_buf_length += byte_count; parm_data->FileSize = cpu_to_le64(size); - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); if (rc) { @@ -2619,7 +2606,7 @@ struct file_end_of_file_info *parm_data; int rc = 0; int bytes_returned = 0; - __u32 tmp; + __u16 params, param_offset, offset, byte_count, count; cFYI(1, ("SetFileSize (via SetFileInfo) %lld", (long long)size)); @@ -2628,40 +2615,36 @@ if (rc) return rc; - tmp = cpu_to_le32(pid_of_opener); /* override pid of current process - so network fid will be valid */ - pSMB->hdr.Pid = tmp & 0xFFFF; - tmp >>= 16; - pSMB->hdr.PidHigh = tmp & 0xFFFF; + pSMB->hdr.Pid = cpu_to_le16((__u16)pid_of_opener); + pSMB->hdr.PidHigh = cpu_to_le16((__u16)(pid_of_opener >> 16)); - pSMB->ParameterCount = 6; + params = 6; pSMB->MaxSetupCount = 0; pSMB->Reserved = 0; pSMB->Flags = 0; pSMB->Timeout = 0; pSMB->Reserved2 = 0; - pSMB->ParameterOffset = offsetof(struct smb_com_transaction2_sfi_req, - Fid) - 4; - pSMB->DataOffset = pSMB->ParameterOffset + pSMB->ParameterCount; + param_offset = offsetof(struct smb_com_transaction2_sfi_req, Fid) - 4; + offset = param_offset + params; - data_offset = (char *) (&pSMB->hdr.Protocol) + pSMB->DataOffset; + data_offset = (char *) (&pSMB->hdr.Protocol) + offset; - pSMB->DataCount = sizeof(struct file_end_of_file_info); + count = sizeof(struct file_end_of_file_info); pSMB->MaxParameterCount = cpu_to_le16(2); pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find max SMB PDU from sess */ pSMB->SetupCount = 1; pSMB->Reserved3 = 0; pSMB->SubCommand = cpu_to_le16(TRANS2_SET_FILE_INFORMATION); - pSMB->ByteCount = 3 /* pad */ + pSMB->ParameterCount + pSMB->DataCount; - pSMB->DataCount = cpu_to_le16(pSMB->DataCount); - pSMB->ParameterCount = cpu_to_le16(pSMB->ParameterCount); + byte_count = 3 /* pad */ + params + count; + pSMB->DataCount = cpu_to_le16(count); + pSMB->ParameterCount = cpu_to_le16(params); pSMB->TotalDataCount = pSMB->DataCount; pSMB->TotalParameterCount = pSMB->ParameterCount; - pSMB->ParameterOffset = cpu_to_le16(pSMB->ParameterOffset); + pSMB->ParameterOffset = cpu_to_le16(param_offset); parm_data = (struct file_end_of_file_info *) (((char *) &pSMB->hdr.Protocol) + - pSMB->DataOffset); - pSMB->DataOffset = cpu_to_le16(pSMB->DataOffset); /* now safe to change to le */ + offset); + pSMB->DataOffset = cpu_to_le16(offset); parm_data->FileSize = cpu_to_le64(size); pSMB->Fid = fid; if(SetAllocation) { @@ -2680,8 +2663,8 @@ cpu_to_le16(SMB_SET_FILE_END_OF_FILE_INFO); } pSMB->Reserved4 = 0; - pSMB->hdr.smb_buf_length += pSMB->ByteCount; - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + pSMB->hdr.smb_buf_length += byte_count; + pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); if (rc) { @@ -2710,6 +2693,7 @@ int rc = 0; int bytes_returned = 0; char *data_offset; + __u16 params, param_offset, offset, byte_count, count; cFYI(1, ("In SetTimes")); @@ -2732,8 +2716,8 @@ strncpy(pSMB->FileName, fileName, name_len); } - pSMB->ParameterCount = 6 + name_len; - pSMB->DataCount = sizeof (FILE_BASIC_INFO); + params = 6 + name_len; + count = sizeof (FILE_BASIC_INFO); pSMB->MaxParameterCount = cpu_to_le16(2); pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find exact max SMB PDU from sess structure BB */ pSMB->MaxSetupCount = 0; @@ -2741,19 +2725,19 @@ pSMB->Flags = 0; pSMB->Timeout = 0; pSMB->Reserved2 = 0; - pSMB->ParameterOffset = offsetof(struct smb_com_transaction2_spi_req, + param_offset = offsetof(struct smb_com_transaction2_spi_req, InformationLevel) - 4; - pSMB->DataOffset = pSMB->ParameterOffset + pSMB->ParameterCount; - data_offset = (char *) (&pSMB->hdr.Protocol) + pSMB->DataOffset; - pSMB->ParameterOffset = cpu_to_le16(pSMB->ParameterOffset); - pSMB->DataOffset = cpu_to_le16(pSMB->DataOffset); + offset = param_offset + params; + data_offset = (char *) (&pSMB->hdr.Protocol) + offset; + pSMB->ParameterOffset = cpu_to_le16(param_offset); + pSMB->DataOffset = cpu_to_le16(offset); pSMB->SetupCount = 1; pSMB->Reserved3 = 0; pSMB->SubCommand = cpu_to_le16(TRANS2_SET_PATH_INFORMATION); - pSMB->ByteCount = 3 /* pad */ + pSMB->ParameterCount + pSMB->DataCount; + byte_count = 3 /* pad */ + params + count; - pSMB->DataCount = cpu_to_le16(pSMB->DataCount); - pSMB->ParameterCount = cpu_to_le16(pSMB->ParameterCount); + pSMB->DataCount = cpu_to_le16(count); + pSMB->ParameterCount = cpu_to_le16(params); pSMB->TotalDataCount = pSMB->DataCount; pSMB->TotalParameterCount = pSMB->ParameterCount; if (tcon->ses->capabilities & CAP_INFOLEVEL_PASSTHRU) @@ -2761,9 +2745,9 @@ else pSMB->InformationLevel = cpu_to_le16(SMB_SET_FILE_BASIC_INFO); pSMB->Reserved4 = 0; - pSMB->hdr.smb_buf_length += pSMB->ByteCount; + pSMB->hdr.smb_buf_length += byte_count; memcpy(data_offset, data, sizeof (FILE_BASIC_INFO)); - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); if (rc) { @@ -2779,7 +2763,6 @@ return rc; } - int CIFSSMBSetTimesLegacy(int xid, struct cifsTconInfo *tcon, char *fileName, FILE_INFO_STANDARD * data, const struct nls_table *nls_codepage) @@ -2790,6 +2773,7 @@ int rc = 0; int bytes_returned = 0; char *data_offset; + __u16 params, param_offset, count, offset, byte_count; cFYI(1, ("In SetTimesLegacy")); @@ -2813,8 +2797,8 @@ } /* BB fixme - we have to map to FILE_STANDARD_INFO (level 1 info in parent function, from the better and ususal FILE_BASIC_INFO */ - pSMB->ParameterCount = 6 + name_len; - pSMB->DataCount = sizeof (FILE_INFO_STANDARD); + params = 6 + name_len; + count = sizeof (FILE_INFO_STANDARD); pSMB->MaxParameterCount = cpu_to_le16(2); pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find exact max SMB PDU from sess structure BB */ pSMB->MaxSetupCount = 0; @@ -2822,19 +2806,19 @@ pSMB->Flags = 0; pSMB->Timeout = 0; pSMB->Reserved2 = 0; - pSMB->ParameterOffset = offsetof(struct smb_com_transaction2_spi_req, + param_offset = offsetof(struct smb_com_transaction2_spi_req, InformationLevel) - 4; - pSMB->DataOffset = pSMB->ParameterOffset + pSMB->ParameterCount; - data_offset = (char *) (&pSMB->hdr.Protocol) + pSMB->DataOffset; - pSMB->ParameterOffset = cpu_to_le16(pSMB->ParameterOffset); - pSMB->DataOffset = cpu_to_le16(pSMB->DataOffset); + offset = param_offset + params; + data_offset = (char *) (&pSMB->hdr.Protocol) + offset; + pSMB->ParameterOffset = cpu_to_le16(param_offset); + pSMB->DataOffset = cpu_to_le16(offset); pSMB->SetupCount = 1; pSMB->Reserved3 = 0; pSMB->SubCommand = cpu_to_le16(TRANS2_SET_PATH_INFORMATION); - pSMB->ByteCount = 3 /* pad */ + pSMB->ParameterCount + pSMB->DataCount; + byte_count = 3 /* pad */ + params + count; - pSMB->DataCount = cpu_to_le16(pSMB->DataCount); - pSMB->ParameterCount = cpu_to_le16(pSMB->ParameterCount); + pSMB->DataCount = cpu_to_le16(count); + pSMB->ParameterCount = cpu_to_le16(params); pSMB->TotalDataCount = pSMB->DataCount; pSMB->TotalParameterCount = pSMB->ParameterCount; /* I doubt that passthrough levels apply to this old @@ -2844,9 +2828,9 @@ else*/ pSMB->InformationLevel = cpu_to_le16(SMB_INFO_STANDARD); pSMB->Reserved4 = 0; - pSMB->hdr.smb_buf_length += pSMB->ByteCount; + pSMB->hdr.smb_buf_length += byte_count; memcpy(data_offset, data, sizeof (FILE_INFO_STANDARD)); - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); if (rc) { @@ -2873,6 +2857,7 @@ int rc = 0; int bytes_returned = 0; FILE_UNIX_BASIC_INFO *data_offset; + __u16 params, param_offset, offset, count, byte_count; cFYI(1, ("In SetUID/GID/Mode")); setPermsRetry: @@ -2894,8 +2879,8 @@ strncpy(pSMB->FileName, fileName, name_len); } - pSMB->ParameterCount = 6 + name_len; - pSMB->DataCount = sizeof (FILE_UNIX_BASIC_INFO); + params = 6 + name_len; + count = sizeof (FILE_UNIX_BASIC_INFO); pSMB->MaxParameterCount = cpu_to_le16(2); pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find exact max SMB PDU from sess structure BB */ pSMB->MaxSetupCount = 0; @@ -2903,25 +2888,25 @@ pSMB->Flags = 0; pSMB->Timeout = 0; pSMB->Reserved2 = 0; - pSMB->ParameterOffset = offsetof(struct smb_com_transaction2_spi_req, + param_offset = offsetof(struct smb_com_transaction2_spi_req, InformationLevel) - 4; - pSMB->DataOffset = pSMB->ParameterOffset + pSMB->ParameterCount; + offset = param_offset + params; data_offset = (FILE_UNIX_BASIC_INFO *) ((char *) &pSMB->hdr.Protocol + - pSMB->DataOffset); - pSMB->DataOffset = cpu_to_le16(pSMB->DataOffset); - pSMB->ParameterOffset = cpu_to_le16(pSMB->ParameterOffset); + offset); + pSMB->DataOffset = cpu_to_le16(offset); + pSMB->ParameterOffset = cpu_to_le16(param_offset); pSMB->SetupCount = 1; pSMB->Reserved3 = 0; pSMB->SubCommand = cpu_to_le16(TRANS2_SET_PATH_INFORMATION); - pSMB->ByteCount = 3 /* pad */ + pSMB->ParameterCount + pSMB->DataCount; - pSMB->ParameterCount = cpu_to_le16(pSMB->ParameterCount); - pSMB->DataCount = cpu_to_le16(pSMB->DataCount); + byte_count = 3 /* pad */ + params + count; + pSMB->ParameterCount = cpu_to_le16(params); + pSMB->DataCount = cpu_to_le16(count); pSMB->TotalParameterCount = pSMB->ParameterCount; pSMB->TotalDataCount = pSMB->DataCount; pSMB->InformationLevel = cpu_to_le16(SMB_SET_FILE_UNIX_BASIC); pSMB->Reserved4 = 0; - pSMB->hdr.smb_buf_length += pSMB->ByteCount; + pSMB->hdr.smb_buf_length += byte_count; data_offset->Uid = cpu_to_le64(uid); data_offset->Gid = cpu_to_le64(gid); /* better to leave device as zero when it is */ @@ -2945,7 +2930,7 @@ data_offset->Type = cpu_to_le32(UNIX_SOCKET); - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); if (rc) { @@ -2994,7 +2979,6 @@ pSMB->Fid = netfid; /* file handle always le */ pSMB->ByteCount = 0; - pSMB->hdr.smb_buf_length += pSMB->ByteCount; rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); if (rc) { @@ -3021,6 +3005,7 @@ int name_len; struct fea * temp_fea; char * temp_ptr; + __u16 params, byte_count; cFYI(1, ("In Query All EAs path %s", searchName)); QAllEAsRetry: @@ -3042,8 +3027,7 @@ strncpy(pSMB->FileName, searchName, name_len); } - pSMB->TotalParameterCount = 2 /* level */ + 4 /* reserved */ + - name_len /* includes null */ ; + params = 2 /* level */ + 4 /* reserved */ + name_len /* includes NUL */ ; pSMB->TotalDataCount = 0; pSMB->MaxParameterCount = cpu_to_le16(2); pSMB->MaxDataCount = cpu_to_le16(4000); /* BB find exact max SMB PDU from sess structure BB */ @@ -3059,29 +3043,29 @@ pSMB->SetupCount = 1; pSMB->Reserved3 = 0; pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_PATH_INFORMATION); - pSMB->ByteCount = pSMB->TotalParameterCount + 1 /* pad */ ; - pSMB->TotalParameterCount = cpu_to_le16(pSMB->TotalParameterCount); + byte_count = params + 1 /* pad */ ; + pSMB->TotalParameterCount = cpu_to_le16(params); pSMB->ParameterCount = pSMB->TotalParameterCount; pSMB->InformationLevel = cpu_to_le16(SMB_INFO_QUERY_ALL_EAS); pSMB->Reserved4 = 0; - pSMB->hdr.smb_buf_length += pSMB->ByteCount; - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + pSMB->hdr.smb_buf_length += byte_count; + pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); if (rc) { cFYI(1, ("Send error in QueryAllEAs = %d", rc)); } else { /* decode response */ - pSMBr->DataOffset = le16_to_cpu(pSMBr->DataOffset); + __u16 data_offset = le16_to_cpu(pSMBr->DataOffset); /* BB also check enough total bytes returned */ /* BB we need to improve the validity checking of these trans2 responses */ - if ((pSMBr->ByteCount < 4) || (pSMBr->DataOffset > 512)) + if ((pSMBr->ByteCount < 4) || (data_offset > 512)) rc = -EIO; /* bad smb */ /* else if (pFindData){ memcpy((char *) pFindData, (char *) &pSMBr->hdr.Protocol + - pSMBr->DataOffset, kl); + data_offset, kl); }*/ else { /* check that length of list is not more than bcc */ /* check that each entry does not go beyond length @@ -3091,14 +3075,12 @@ struct fealist * ea_response_data; rc = 0; /* validate_trans2_offsets() */ - /* BB to check if(start of smb + pSMBr->DataOffset > &bcc+ bcc)*/ + /* BB to check if(start of smb + data_offset > &bcc+ bcc)*/ ea_response_data = (struct fealist *) (((char *) &pSMBr->hdr.Protocol) + - pSMBr->DataOffset); - ea_response_data->list_len = - cpu_to_le32(ea_response_data->list_len); - cFYI(1,("ea length %d",ea_response_data->list_len)); - name_len = ea_response_data->list_len; + data_offset); + name_len = le32_to_cpu(ea_response_data->list_len); + cFYI(1,("ea length %d", name_len)); if(name_len <= 8) { /* returned EA size zeroed at top of function */ cFYI(1,("empty EA list returned from server")); @@ -3108,6 +3090,7 @@ temp_fea = ea_response_data->list; temp_ptr = (char *)temp_fea; while(name_len > 0) { + __u16 value_len; name_len -= 4; temp_ptr += 4; rc += temp_fea->name_len; @@ -3133,9 +3116,9 @@ /* account for trailing null */ name_len--; temp_ptr++; - temp_fea->value_len = cpu_to_le16(temp_fea->value_len); - name_len -= temp_fea->value_len; - temp_ptr += temp_fea->value_len; + value_len = le16_to_cpu(temp_fea->value_len); + name_len -= value_len; + temp_ptr += value_len; /* BB check that temp_ptr is still within smb BB*/ /* no trailing null to account for in value len */ /* go on to next EA */ @@ -3164,6 +3147,7 @@ int name_len; struct fea * temp_fea; char * temp_ptr; + __u16 params, byte_count; cFYI(1, ("In Query EA path %s", searchName)); QEARetry: @@ -3185,8 +3169,7 @@ strncpy(pSMB->FileName, searchName, name_len); } - pSMB->TotalParameterCount = 2 /* level */ + 4 /* reserved */ + - name_len /* includes null */ ; + params = 2 /* level */ + 4 /* reserved */ + name_len /* includes NUL */ ; pSMB->TotalDataCount = 0; pSMB->MaxParameterCount = cpu_to_le16(2); pSMB->MaxDataCount = cpu_to_le16(4000); /* BB find exact max SMB PDU from sess structure BB */ @@ -3202,29 +3185,29 @@ pSMB->SetupCount = 1; pSMB->Reserved3 = 0; pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_PATH_INFORMATION); - pSMB->ByteCount = pSMB->TotalParameterCount + 1 /* pad */ ; - pSMB->TotalParameterCount = cpu_to_le16(pSMB->TotalParameterCount); + byte_count = params + 1 /* pad */ ; + pSMB->TotalParameterCount = cpu_to_le16(params); pSMB->ParameterCount = pSMB->TotalParameterCount; pSMB->InformationLevel = cpu_to_le16(SMB_INFO_QUERY_ALL_EAS); pSMB->Reserved4 = 0; - pSMB->hdr.smb_buf_length += pSMB->ByteCount; - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + pSMB->hdr.smb_buf_length += byte_count; + pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); if (rc) { cFYI(1, ("Send error in Query EA = %d", rc)); } else { /* decode response */ - pSMBr->DataOffset = le16_to_cpu(pSMBr->DataOffset); + __u16 data_offset = le16_to_cpu(pSMBr->DataOffset); /* BB also check enough total bytes returned */ /* BB we need to improve the validity checking of these trans2 responses */ - if ((pSMBr->ByteCount < 4) || (pSMBr->DataOffset > 512)) + if ((pSMBr->ByteCount < 4) || (data_offset > 512)) rc = -EIO; /* bad smb */ /* else if (pFindData){ memcpy((char *) pFindData, (char *) &pSMBr->hdr.Protocol + - pSMBr->DataOffset, kl); + data_offset, kl); }*/ else { /* check that length of list is not more than bcc */ /* check that each entry does not go beyond length @@ -3234,14 +3217,12 @@ struct fealist * ea_response_data; rc = -ENOENT; /* validate_trans2_offsets() */ - /* BB to check if(start of smb + pSMBr->DataOffset > &bcc+ bcc)*/ + /* BB to check if(start of smb + data_offset > &bcc+ bcc)*/ ea_response_data = (struct fealist *) (((char *) &pSMBr->hdr.Protocol) + - pSMBr->DataOffset); - ea_response_data->list_len = - cpu_to_le32(ea_response_data->list_len); - cFYI(1,("ea length %d",ea_response_data->list_len)); - name_len = ea_response_data->list_len; + data_offset); + name_len = le32_to_cpu(ea_response_data->list_len); + cFYI(1,("ea length %d", name_len)); if(name_len <= 8) { /* returned EA size zeroed at top of function */ cFYI(1,("empty EA list returned from server")); @@ -3253,15 +3234,16 @@ /* loop through checking if we have a matching name and then return the associated value */ while(name_len > 0) { + __u16 value_len; name_len -= 4; temp_ptr += 4; - temp_fea->value_len = cpu_to_le16(temp_fea->value_len); + value_len = le16_to_cpu(temp_fea->value_len); /* BB validate that value_len falls within SMB, even though maximum for name_len is 255 */ if(memcmp(temp_fea->name,ea_name, temp_fea->name_len) == 0) { /* found a match */ - rc = temp_fea->value_len; + rc = value_len; /* account for prefix user. and trailing null */ if(rc<=(int)buf_size) { memcpy(ea_value, @@ -3282,8 +3264,8 @@ /* account for trailing null */ name_len--; temp_ptr++; - name_len -= temp_fea->value_len; - temp_ptr += temp_fea->value_len; + name_len -= value_len; + temp_ptr += value_len; /* no trailing null to account for in value len */ /* go on to next EA */ temp_fea = (struct fea *)temp_ptr; @@ -3310,6 +3292,7 @@ int name_len; int rc = 0; int bytes_returned = 0; + __u16 params, param_offset, byte_count, offset, count; cFYI(1, ("In SetEA")); SetEARetry: @@ -3331,7 +3314,7 @@ strncpy(pSMB->FileName, fileName, name_len); } - pSMB->ParameterCount = 6 + name_len; + params = 6 + name_len; /* done calculating parms using name_len of file name, now use name_len to calculate length of ea name @@ -3341,7 +3324,7 @@ else name_len = strnlen(ea_name,255); - pSMB->DataCount = sizeof(*parm_data) + ea_value_len + name_len + 1; + count = sizeof(*parm_data) + ea_value_len + name_len + 1; pSMB->MaxParameterCount = cpu_to_le16(2); pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find max SMB size from sess */ pSMB->MaxSetupCount = 0; @@ -3349,23 +3332,23 @@ pSMB->Flags = 0; pSMB->Timeout = 0; pSMB->Reserved2 = 0; - pSMB->ParameterOffset = offsetof(struct smb_com_transaction2_spi_req, + param_offset = offsetof(struct smb_com_transaction2_spi_req, InformationLevel) - 4; - pSMB->DataOffset = pSMB->ParameterOffset + pSMB->ParameterCount; + offset = param_offset + params; pSMB->InformationLevel = cpu_to_le16(SMB_SET_FILE_EA); parm_data = (struct fealist *) (((char *) &pSMB->hdr.Protocol) + - pSMB->DataOffset); - pSMB->ParameterOffset = cpu_to_le16(pSMB->ParameterOffset); - pSMB->DataOffset = cpu_to_le16(pSMB->DataOffset); + offset); + pSMB->ParameterOffset = cpu_to_le16(param_offset); + pSMB->DataOffset = cpu_to_le16(offset); pSMB->SetupCount = 1; pSMB->Reserved3 = 0; pSMB->SubCommand = cpu_to_le16(TRANS2_SET_PATH_INFORMATION); - pSMB->ByteCount = 3 /* pad */ + pSMB->ParameterCount + pSMB->DataCount; - pSMB->DataCount = cpu_to_le16(pSMB->DataCount); - parm_data->list_len = (__u32)(pSMB->DataCount); + byte_count = 3 /* pad */ + params + count; + pSMB->DataCount = cpu_to_le16(count); + parm_data->list_len = cpu_to_le32(count); parm_data->list[0].EA_flags = 0; /* we checked above that name len is less than 255 */ parm_data->list[0].name_len = (__u8)name_len;; @@ -3382,11 +3365,11 @@ memcpy(parm_data->list[0].name+name_len+1,ea_value,ea_value_len); pSMB->TotalDataCount = pSMB->DataCount; - pSMB->ParameterCount = cpu_to_le16(pSMB->ParameterCount); + pSMB->ParameterCount = cpu_to_le16(params); pSMB->TotalParameterCount = pSMB->ParameterCount; pSMB->Reserved4 = 0; - pSMB->hdr.smb_buf_length += pSMB->ByteCount; - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + pSMB->hdr.smb_buf_length += byte_count; + pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); if (rc) { diff -Nru a/fs/cifs/connect.c b/fs/cifs/connect.c --- a/fs/cifs/connect.c 2004-09-26 10:25:57 -07:00 +++ b/fs/cifs/connect.c 2004-09-26 10:25:57 -07:00 @@ -313,7 +313,7 @@ connected to port 139 (the NACK is since we do not begin with RFC1001 session initialize frame) */ - server->addr.sockAddr.sin_port = CIFS_PORT; + server->addr.sockAddr.sin_port = htons(CIFS_PORT); cifs_reconnect(server); csocket = server->ssocket; wake_up(&server->response_q); @@ -849,7 +849,7 @@ } static struct cifsTconInfo * -find_unc(__u32 new_target_ip_addr, char *uncName, char *userName) +find_unc(__be32 new_target_ip_addr, char *uncName, char *userName) { struct list_head *tmp; struct cifsTconInfo *tcon; @@ -968,7 +968,7 @@ { int rc = 0; int connected = 0; - unsigned short int orig_port = 0; + __be16 orig_port = 0; if(*csocket == NULL) { rc = sock_create_kern(PF_INET, SOCK_STREAM, IPPROTO_TCP, csocket); @@ -1076,7 +1076,7 @@ { int rc = 0; int connected = 0; - unsigned short int orig_port = 0; + __be16 orig_port = 0; if(*csocket == NULL) { rc = sock_create_kern(PF_INET6, SOCK_STREAM, IPPROTO_TCP, csocket); @@ -1512,6 +1512,8 @@ int remaining_words = 0; int bytes_returned = 0; int len; + __u32 capabilities; + __u16 count; cFYI(1, ("In sesssetup ")); if(ses == NULL) @@ -1536,22 +1538,20 @@ if(ses->server->secMode & (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) smb_buffer->Flags2 |= SMBFLG2_SECURITY_SIGNATURE; - pSMB->req_no_secext.Capabilities = - CAP_LARGE_FILES | CAP_NT_SMBS | CAP_LEVEL_II_OPLOCKS; + capabilities = CAP_LARGE_FILES | CAP_NT_SMBS | CAP_LEVEL_II_OPLOCKS; if (ses->capabilities & CAP_UNICODE) { smb_buffer->Flags2 |= SMBFLG2_UNICODE; - pSMB->req_no_secext.Capabilities |= CAP_UNICODE; + capabilities |= CAP_UNICODE; } if (ses->capabilities & CAP_STATUS32) { smb_buffer->Flags2 |= SMBFLG2_ERR_STATUS; - pSMB->req_no_secext.Capabilities |= CAP_STATUS32; + capabilities |= CAP_STATUS32; } if (ses->capabilities & CAP_DFS) { smb_buffer->Flags2 |= SMBFLG2_DFS; - pSMB->req_no_secext.Capabilities |= CAP_DFS; + capabilities |= CAP_DFS; } - pSMB->req_no_secext.Capabilities = - cpu_to_le32(pSMB->req_no_secext.Capabilities); + pSMB->req_no_secext.Capabilities = cpu_to_le32(capabilities); /* pSMB->req_no_secext.CaseInsensitivePasswordLength = CIFS_SESSION_KEY_SIZE; */ pSMB->req_no_secext.CaseInsensitivePasswordLength = 0; @@ -1623,9 +1623,9 @@ strcpy(bcc_ptr, CIFS_NETWORK_OPSYS); bcc_ptr += strlen(CIFS_NETWORK_OPSYS) + 1; } - BCC(smb_buffer) = (long) bcc_ptr - (long) pByteArea(smb_buffer); - smb_buffer->smb_buf_length += BCC(smb_buffer); - BCC(smb_buffer) = cpu_to_le16(BCC(smb_buffer)); + count = (long) bcc_ptr - (long) pByteArea(smb_buffer); + smb_buffer->smb_buf_length += count; + pSMB->req_no_secext.ByteCount = cpu_to_le16(count); rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response, &bytes_returned, 1); @@ -1633,8 +1633,9 @@ /* rc = map_smb_to_linux_error(smb_buffer_response); now done in SendReceive */ } else if ((smb_buffer_response->WordCount == 3) || (smb_buffer_response->WordCount == 4)) { - pSMBr->resp.Action = le16_to_cpu(pSMBr->resp.Action); - if (pSMBr->resp.Action & GUEST_LOGIN) + __u16 action = le16_to_cpu(pSMBr->resp.Action); + __u16 blob_len = le16_to_cpu(pSMBr->resp.SecurityBlobLength); + if (action & GUEST_LOGIN) cFYI(1, (" Guest login")); /* do we want to mark SesInfo struct ? */ ses->Suid = smb_buffer_response->Uid; /* UID left in wire format (le) */ cFYI(1, ("UID = %d ", ses->Suid)); @@ -1642,11 +1643,9 @@ bcc_ptr = pByteArea(smb_buffer_response); if ((pSMBr->resp.hdr.WordCount == 3) || ((pSMBr->resp.hdr.WordCount == 4) - && (pSMBr->resp.SecurityBlobLength < - pSMBr->resp.ByteCount))) { + && (blob_len < pSMBr->resp.ByteCount))) { if (pSMBr->resp.hdr.WordCount == 4) - bcc_ptr += - pSMBr->resp.SecurityBlobLength; + bcc_ptr += blob_len; if (smb_buffer->Flags2 & SMBFLG2_UNICODE) { if ((long) (bcc_ptr) % 2) { @@ -1764,6 +1763,8 @@ int remaining_words = 0; int bytes_returned = 0; int len; + __u32 capabilities; + __u16 count; cFYI(1, ("In spnego sesssetup ")); if(ses == NULL) @@ -1789,22 +1790,21 @@ if(ses->server->secMode & (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) smb_buffer->Flags2 |= SMBFLG2_SECURITY_SIGNATURE; - pSMB->req.Capabilities = - CAP_LARGE_FILES | CAP_NT_SMBS | CAP_LEVEL_II_OPLOCKS | + capabilities = CAP_LARGE_FILES | CAP_NT_SMBS | CAP_LEVEL_II_OPLOCKS | CAP_EXTENDED_SECURITY; if (ses->capabilities & CAP_UNICODE) { smb_buffer->Flags2 |= SMBFLG2_UNICODE; - pSMB->req.Capabilities |= CAP_UNICODE; + capabilities |= CAP_UNICODE; } if (ses->capabilities & CAP_STATUS32) { smb_buffer->Flags2 |= SMBFLG2_ERR_STATUS; - pSMB->req.Capabilities |= CAP_STATUS32; + capabilities |= CAP_STATUS32; } if (ses->capabilities & CAP_DFS) { smb_buffer->Flags2 |= SMBFLG2_DFS; - pSMB->req.Capabilities |= CAP_DFS; + capabilities |= CAP_DFS; } - pSMB->req.Capabilities = cpu_to_le32(pSMB->req.Capabilities); + pSMB->req.Capabilities = cpu_to_le32(capabilities); pSMB->req.SecurityBlobLength = cpu_to_le16(SecurityBlobLength); bcc_ptr = pByteArea(smb_buffer); @@ -1865,9 +1865,9 @@ strcpy(bcc_ptr, CIFS_NETWORK_OPSYS); bcc_ptr += strlen(CIFS_NETWORK_OPSYS) + 1; } - BCC(smb_buffer) = (long) bcc_ptr - (long) pByteArea(smb_buffer); - smb_buffer->smb_buf_length += BCC(smb_buffer); - BCC(smb_buffer) = cpu_to_le16(BCC(smb_buffer)); + count = (long) bcc_ptr - (long) pByteArea(smb_buffer); + smb_buffer->smb_buf_length += count; + pSMB->req.ByteCount = cpu_to_le16(count); rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response, &bytes_returned, 1); @@ -1875,10 +1875,10 @@ /* rc = map_smb_to_linux_error(smb_buffer_response); *//* done in SendReceive now */ } else if ((smb_buffer_response->WordCount == 3) || (smb_buffer_response->WordCount == 4)) { - pSMBr->resp.Action = le16_to_cpu(pSMBr->resp.Action); - pSMBr->resp.SecurityBlobLength = + __u16 action = le16_to_cpu(pSMBr->resp.Action); + __u16 blob_len = le16_to_cpu(pSMBr->resp.SecurityBlobLength); - if (pSMBr->resp.Action & GUEST_LOGIN) + if (action & GUEST_LOGIN) cFYI(1, (" Guest login")); /* BB do we want to set anything in SesInfo struct ? */ if (ses) { ses->Suid = smb_buffer_response->Uid; /* UID left in wire format (le) */ @@ -1889,14 +1889,14 @@ if ((pSMBr->resp.hdr.WordCount == 3) || ((pSMBr->resp.hdr.WordCount == 4) - && (pSMBr->resp.SecurityBlobLength < + && (blob_len < pSMBr->resp.ByteCount))) { if (pSMBr->resp.hdr.WordCount == 4) { bcc_ptr += - pSMBr->resp.SecurityBlobLength; + blob_len; cFYI(1, ("Security Blob Length %d ", - pSMBr->resp.SecurityBlobLength)); + blob_len)); } if (smb_buffer->Flags2 & SMBFLG2_UNICODE) { @@ -2029,6 +2029,8 @@ int SecurityBlobLength = sizeof (NEGOTIATE_MESSAGE); PNEGOTIATE_MESSAGE SecurityBlob; PCHALLENGE_MESSAGE SecurityBlob2; + __u32 negotiate_flags, capabilities; + __u16 count; cFYI(1, ("In NTLMSSP sesssetup (negotiate) ")); if(ses == NULL) @@ -2056,35 +2058,34 @@ if(ses->server->secMode & (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) smb_buffer->Flags2 |= SMBFLG2_SECURITY_SIGNATURE; - pSMB->req.Capabilities = - CAP_LARGE_FILES | CAP_NT_SMBS | CAP_LEVEL_II_OPLOCKS | + capabilities = CAP_LARGE_FILES | CAP_NT_SMBS | CAP_LEVEL_II_OPLOCKS | CAP_EXTENDED_SECURITY; if (ses->capabilities & CAP_UNICODE) { smb_buffer->Flags2 |= SMBFLG2_UNICODE; - pSMB->req.Capabilities |= CAP_UNICODE; + capabilities |= CAP_UNICODE; } if (ses->capabilities & CAP_STATUS32) { smb_buffer->Flags2 |= SMBFLG2_ERR_STATUS; - pSMB->req.Capabilities |= CAP_STATUS32; + capabilities |= CAP_STATUS32; } if (ses->capabilities & CAP_DFS) { smb_buffer->Flags2 |= SMBFLG2_DFS; - pSMB->req.Capabilities |= CAP_DFS; + capabilities |= CAP_DFS; } - pSMB->req.Capabilities = cpu_to_le32(pSMB->req.Capabilities); + pSMB->req.Capabilities = cpu_to_le32(capabilities); bcc_ptr = (char *) &pSMB->req.SecurityBlob; SecurityBlob = (PNEGOTIATE_MESSAGE) bcc_ptr; strncpy(SecurityBlob->Signature, NTLMSSP_SIGNATURE, 8); SecurityBlob->MessageType = NtLmNegotiate; - SecurityBlob->NegotiateFlags = + negotiate_flags = NTLMSSP_NEGOTIATE_UNICODE | NTLMSSP_NEGOTIATE_OEM | NTLMSSP_REQUEST_TARGET | NTLMSSP_NEGOTIATE_NTLM | 0x80000000 | /* NTLMSSP_NEGOTIATE_ALWAYS_SIGN | */ NTLMSSP_NEGOTIATE_128; if(sign_CIFS_PDUs) - SecurityBlob->NegotiateFlags |= NTLMSSP_NEGOTIATE_SIGN; + negotiate_flags |= NTLMSSP_NEGOTIATE_SIGN; if(ntlmv2_support) - SecurityBlob->NegotiateFlags |= NTLMSSP_NEGOTIATE_NTLMV2; + negotiate_flags |= NTLMSSP_NEGOTIATE_NTLMV2; /* setup pointers to domain name and workstation name */ bcc_ptr += SecurityBlobLength; @@ -2097,20 +2098,20 @@ SecurityBlob->DomainName.Length = 0; SecurityBlob->DomainName.MaximumLength = 0; } else { - SecurityBlob->NegotiateFlags |= - NTLMSSP_NEGOTIATE_DOMAIN_SUPPLIED; + __u16 len; + negotiate_flags |= NTLMSSP_NEGOTIATE_DOMAIN_SUPPLIED; strncpy(bcc_ptr, domain, 63); - SecurityBlob->DomainName.Length = strnlen(domain, 64); + len = strnlen(domain, 64); SecurityBlob->DomainName.MaximumLength = - cpu_to_le16(SecurityBlob->DomainName.Length); + cpu_to_le16(len); SecurityBlob->DomainName.Buffer = cpu_to_le32((long) &SecurityBlob-> DomainString - (long) &SecurityBlob->Signature); - bcc_ptr += SecurityBlob->DomainName.Length; - SecurityBlobLength += SecurityBlob->DomainName.Length; + bcc_ptr += len; + SecurityBlobLength += len; SecurityBlob->DomainName.Length = - cpu_to_le16(SecurityBlob->DomainName.Length); + cpu_to_le16(len); } if (ses->capabilities & CAP_UNICODE) { if ((long) bcc_ptr % 2) { @@ -2147,28 +2148,27 @@ bcc_ptr++; /* empty domain field */ *bcc_ptr = 0; } - SecurityBlob->NegotiateFlags = - cpu_to_le32(SecurityBlob->NegotiateFlags); + SecurityBlob->NegotiateFlags = cpu_to_le32(negotiate_flags); pSMB->req.SecurityBlobLength = cpu_to_le16(SecurityBlobLength); - BCC(smb_buffer) = (long) bcc_ptr - (long) pByteArea(smb_buffer); - smb_buffer->smb_buf_length += BCC(smb_buffer); - BCC(smb_buffer) = cpu_to_le16(BCC(smb_buffer)); + count = (long) bcc_ptr - (long) pByteArea(smb_buffer); + smb_buffer->smb_buf_length += count; + pSMB->req.ByteCount = cpu_to_le16(count); rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response, &bytes_returned, 1); if (smb_buffer_response->Status.CifsError == - (NT_STATUS_MORE_PROCESSING_REQUIRED)) + cpu_to_le32(NT_STATUS_MORE_PROCESSING_REQUIRED)) rc = 0; if (rc) { /* rc = map_smb_to_linux_error(smb_buffer_response); *//* done in SendReceive now */ } else if ((smb_buffer_response->WordCount == 3) || (smb_buffer_response->WordCount == 4)) { - pSMBr->resp.Action = le16_to_cpu(pSMBr->resp.Action); - pSMBr->resp.SecurityBlobLength = - le16_to_cpu(pSMBr->resp.SecurityBlobLength); - if (pSMBr->resp.Action & GUEST_LOGIN) + __u16 action = le16_to_cpu(pSMBr->resp.Action); + __u16 blob_len = le16_to_cpu(pSMBr->resp.SecurityBlobLength); + + if (action & GUEST_LOGIN) cFYI(1, (" Guest login")); /* Do we want to set anything in SesInfo struct when guest login? */ @@ -2185,14 +2185,14 @@ cFYI(1, ("UID = %d ", ses->Suid)); if ((pSMBr->resp.hdr.WordCount == 3) || ((pSMBr->resp.hdr.WordCount == 4) - && (pSMBr->resp.SecurityBlobLength < + && (blob_len < pSMBr->resp.ByteCount))) { + if (pSMBr->resp.hdr.WordCount == 4) { - bcc_ptr += - pSMBr->resp.SecurityBlobLength; + bcc_ptr += blob_len; cFYI(1, ("Security Blob Length %d ", - pSMBr->resp.SecurityBlobLength)); + blob_len)); } cFYI(1, ("NTLMSSP Challenge rcvd ")); @@ -2200,16 +2200,16 @@ memcpy(ses->server->cryptKey, SecurityBlob2->Challenge, CIFS_CRYPTO_KEY_SIZE); - if(SecurityBlob2->NegotiateFlags & NTLMSSP_NEGOTIATE_NTLMV2) + if(SecurityBlob2->NegotiateFlags & cpu_to_le32(NTLMSSP_NEGOTIATE_NTLMV2)) *pNTLMv2_flag = TRUE; if((SecurityBlob2->NegotiateFlags & - NTLMSSP_NEGOTIATE_ALWAYS_SIGN) + cpu_to_le32(NTLMSSP_NEGOTIATE_ALWAYS_SIGN)) || (sign_CIFS_PDUs > 1)) ses->server->secMode |= SECMODE_SIGN_REQUIRED; if ((SecurityBlob2->NegotiateFlags & - NTLMSSP_NEGOTIATE_SIGN) && (sign_CIFS_PDUs)) + cpu_to_le32(NTLMSSP_NEGOTIATE_SIGN)) && (sign_CIFS_PDUs)) ses->server->secMode |= SECMODE_SIGN_ENABLED; @@ -2353,7 +2353,6 @@ return rc; } - static int CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses, char *ntlm_session_key, int ntlmv2_flag, @@ -2372,6 +2371,8 @@ int len; int SecurityBlobLength = sizeof (AUTHENTICATE_MESSAGE); PAUTHENTICATE_MESSAGE SecurityBlob; + __u32 negotiate_flags, capabilities; + __u16 count; cFYI(1, ("In NTLMSSPSessSetup (Authenticate)")); if(ses == NULL) @@ -2400,36 +2401,35 @@ if(ses->server->secMode & (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) smb_buffer->Flags2 |= SMBFLG2_SECURITY_SIGNATURE; - pSMB->req.Capabilities = - CAP_LARGE_FILES | CAP_NT_SMBS | CAP_LEVEL_II_OPLOCKS | + capabilities = CAP_LARGE_FILES | CAP_NT_SMBS | CAP_LEVEL_II_OPLOCKS | CAP_EXTENDED_SECURITY; if (ses->capabilities & CAP_UNICODE) { smb_buffer->Flags2 |= SMBFLG2_UNICODE; - pSMB->req.Capabilities |= CAP_UNICODE; + capabilities |= CAP_UNICODE; } if (ses->capabilities & CAP_STATUS32) { smb_buffer->Flags2 |= SMBFLG2_ERR_STATUS; - pSMB->req.Capabilities |= CAP_STATUS32; + capabilities |= CAP_STATUS32; } if (ses->capabilities & CAP_DFS) { smb_buffer->Flags2 |= SMBFLG2_DFS; - pSMB->req.Capabilities |= CAP_DFS; + capabilities |= CAP_DFS; } - pSMB->req.Capabilities = cpu_to_le32(pSMB->req.Capabilities); + pSMB->req.Capabilities = cpu_to_le32(capabilities); bcc_ptr = (char *) &pSMB->req.SecurityBlob; SecurityBlob = (PAUTHENTICATE_MESSAGE) bcc_ptr; strncpy(SecurityBlob->Signature, NTLMSSP_SIGNATURE, 8); SecurityBlob->MessageType = NtLmAuthenticate; bcc_ptr += SecurityBlobLength; - SecurityBlob->NegotiateFlags = + negotiate_flags = NTLMSSP_NEGOTIATE_UNICODE | NTLMSSP_REQUEST_TARGET | NTLMSSP_NEGOTIATE_NTLM | NTLMSSP_NEGOTIATE_TARGET_INFO | 0x80000000 | NTLMSSP_NEGOTIATE_128; if(sign_CIFS_PDUs) - SecurityBlob->NegotiateFlags |= /* NTLMSSP_NEGOTIATE_ALWAYS_SIGN |*/ NTLMSSP_NEGOTIATE_SIGN; + negotiate_flags |= /* NTLMSSP_NEGOTIATE_ALWAYS_SIGN |*/ NTLMSSP_NEGOTIATE_SIGN; if(ntlmv2_flag) - SecurityBlob->NegotiateFlags |= NTLMSSP_NEGOTIATE_NTLMV2; + negotiate_flags |= NTLMSSP_NEGOTIATE_NTLMV2; /* setup pointers to domain name and workstation name */ @@ -2460,36 +2460,36 @@ SecurityBlob->DomainName.Length = 0; SecurityBlob->DomainName.MaximumLength = 0; } else { - SecurityBlob->DomainName.Length = + __u16 len = cifs_strtoUCS((wchar_t *) bcc_ptr, domain, 64, nls_codepage); - SecurityBlob->DomainName.Length *= 2; + len *= 2; SecurityBlob->DomainName.MaximumLength = - cpu_to_le16(SecurityBlob->DomainName.Length); + cpu_to_le16(len); SecurityBlob->DomainName.Buffer = cpu_to_le32(SecurityBlobLength); - bcc_ptr += SecurityBlob->DomainName.Length; - SecurityBlobLength += SecurityBlob->DomainName.Length; + bcc_ptr += len; + SecurityBlobLength += len; SecurityBlob->DomainName.Length = - cpu_to_le16(SecurityBlob->DomainName.Length); + cpu_to_le16(len); } if (user == NULL) { SecurityBlob->UserName.Buffer = 0; SecurityBlob->UserName.Length = 0; SecurityBlob->UserName.MaximumLength = 0; } else { - SecurityBlob->UserName.Length = + __u16 len = cifs_strtoUCS((wchar_t *) bcc_ptr, user, 64, nls_codepage); - SecurityBlob->UserName.Length *= 2; + len *= 2; SecurityBlob->UserName.MaximumLength = - cpu_to_le16(SecurityBlob->UserName.Length); + cpu_to_le16(len); SecurityBlob->UserName.Buffer = cpu_to_le32(SecurityBlobLength); - bcc_ptr += SecurityBlob->UserName.Length; - SecurityBlobLength += SecurityBlob->UserName.Length; + bcc_ptr += len; + SecurityBlobLength += len; SecurityBlob->UserName.Length = - cpu_to_le16(SecurityBlob->UserName.Length); + cpu_to_le16(len); } /* SecurityBlob->WorkstationName.Length = cifs_strtoUCS((wchar_t *) bcc_ptr, "AMACHINE",64, nls_codepage); @@ -2529,34 +2529,33 @@ SecurityBlob->DomainName.Length = 0; SecurityBlob->DomainName.MaximumLength = 0; } else { - SecurityBlob->NegotiateFlags |= - NTLMSSP_NEGOTIATE_DOMAIN_SUPPLIED; + __u16 len; + negotiate_flags |= NTLMSSP_NEGOTIATE_DOMAIN_SUPPLIED; strncpy(bcc_ptr, domain, 63); - SecurityBlob->DomainName.Length = strnlen(domain, 64); + len = strnlen(domain, 64); SecurityBlob->DomainName.MaximumLength = - cpu_to_le16(SecurityBlob->DomainName.Length); + cpu_to_le16(len); SecurityBlob->DomainName.Buffer = cpu_to_le32(SecurityBlobLength); - bcc_ptr += SecurityBlob->DomainName.Length; - SecurityBlobLength += SecurityBlob->DomainName.Length; - SecurityBlob->DomainName.Length = - cpu_to_le16(SecurityBlob->DomainName.Length); + bcc_ptr += len; + SecurityBlobLength += len; + SecurityBlob->DomainName.Length = cpu_to_le16(len); } if (user == NULL) { SecurityBlob->UserName.Buffer = 0; SecurityBlob->UserName.Length = 0; SecurityBlob->UserName.MaximumLength = 0; } else { + __u16 len; strncpy(bcc_ptr, user, 63); - SecurityBlob->UserName.Length = strnlen(user, 64); + len = strnlen(user, 64); SecurityBlob->UserName.MaximumLength = - cpu_to_le16(SecurityBlob->UserName.Length); + cpu_to_le16(len); SecurityBlob->UserName.Buffer = cpu_to_le32(SecurityBlobLength); - bcc_ptr += SecurityBlob->UserName.Length; - SecurityBlobLength += SecurityBlob->UserName.Length; - SecurityBlob->UserName.Length = - cpu_to_le16(SecurityBlob->UserName.Length); + bcc_ptr += len; + SecurityBlobLength += len; + SecurityBlob->UserName.Length = cpu_to_le16(len); } /* BB fill in our workstation name if known BB */ @@ -2569,12 +2568,11 @@ bcc_ptr++; /* null domain */ *bcc_ptr = 0; } - SecurityBlob->NegotiateFlags = - cpu_to_le32(SecurityBlob->NegotiateFlags); + SecurityBlob->NegotiateFlags = cpu_to_le32(negotiate_flags); pSMB->req.SecurityBlobLength = cpu_to_le16(SecurityBlobLength); - BCC(smb_buffer) = (long) bcc_ptr - (long) pByteArea(smb_buffer); - smb_buffer->smb_buf_length += BCC(smb_buffer); - BCC(smb_buffer) = cpu_to_le16(BCC(smb_buffer)); + count = (long) bcc_ptr - (long) pByteArea(smb_buffer); + smb_buffer->smb_buf_length += count; + pSMB->req.ByteCount = cpu_to_le16(count); rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response, &bytes_returned, 1); @@ -2582,10 +2580,10 @@ /* rc = map_smb_to_linux_error(smb_buffer_response); *//* done in SendReceive now */ } else if ((smb_buffer_response->WordCount == 3) || (smb_buffer_response->WordCount == 4)) { - pSMBr->resp.Action = le16_to_cpu(pSMBr->resp.Action); - pSMBr->resp.SecurityBlobLength = + __u16 action = le16_to_cpu(pSMBr->resp.Action); + __u16 blob_len = le16_to_cpu(pSMBr->resp.SecurityBlobLength); - if (pSMBr->resp.Action & GUEST_LOGIN) + if (action & GUEST_LOGIN) cFYI(1, (" Guest login")); /* BB do we want to set anything in SesInfo struct ? */ /* if(SecurityBlob2->MessageType != NtLm??){ cFYI("Unexpected message type on auth response is %d ")); @@ -2599,14 +2597,14 @@ /* response can have either 3 or 4 word count - Samba sends 3 */ if ((pSMBr->resp.hdr.WordCount == 3) || ((pSMBr->resp.hdr.WordCount == 4) - && (pSMBr->resp.SecurityBlobLength < + && (blob_len < pSMBr->resp.ByteCount))) { if (pSMBr->resp.hdr.WordCount == 4) { bcc_ptr += - pSMBr->resp.SecurityBlobLength; + blob_len; cFYI(1, ("Security Blob Length %d ", - pSMBr->resp.SecurityBlobLength)); + blob_len)); } cFYI(1, @@ -2747,9 +2745,10 @@ struct smb_hdr *smb_buffer_response; TCONX_REQ *pSMB; TCONX_RSP *pSMBr; - char *bcc_ptr; + unsigned char *bcc_ptr; int rc = 0; int length; + __u16 count; if (ses == NULL) return -EIO; @@ -2769,7 +2768,7 @@ pSMB->AndXCommand = 0xFF; pSMB->Flags = cpu_to_le16(TCON_EXTENDED_SECINFO); pSMB->PasswordLength = cpu_to_le16(1); /* minimum */ - bcc_ptr = &(pSMB->Password[0]); + bcc_ptr = &pSMB->Password[0]; bcc_ptr++; /* skip password */ if(ses->server->secMode & (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) @@ -2795,16 +2794,16 @@ strcpy(bcc_ptr, "?????"); bcc_ptr += strlen("?????"); bcc_ptr += 1; - BCC(smb_buffer) = (long) bcc_ptr - (long) pByteArea(smb_buffer); - smb_buffer->smb_buf_length += BCC(smb_buffer); - BCC(smb_buffer) = cpu_to_le16(BCC(smb_buffer)); + count = bcc_ptr - &pSMB->Password[0]; + pSMB->hdr.smb_buf_length += count; + pSMB->ByteCount = cpu_to_le16(count); rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response, &length, 0); /* if (rc) rc = map_smb_to_linux_error(smb_buffer_response); */ /* above now done in SendReceive */ if ((rc == 0) && (tcon != NULL)) { - tcon->tidStatus = CifsGood; + tcon->tidStatus = CifsGood; tcon->tid = smb_buffer_response->Tid; bcc_ptr = pByteArea(smb_buffer_response); length = strnlen(bcc_ptr, BCC(smb_buffer_response) - 2); @@ -2813,8 +2812,8 @@ strncpy(tcon->treeName, tree, MAX_TREE_SIZE); if (smb_buffer->Flags2 & SMBFLG2_UNICODE) { length = UniStrnlen((wchar_t *) bcc_ptr, 512); - if (((long) bcc_ptr + (2 * length)) - - (long) pByteArea(smb_buffer_response) <= + if ((bcc_ptr + (2 * length)) - + pByteArea(smb_buffer_response) <= BCC(smb_buffer_response)) { if(tcon->nativeFileSystem) kfree(tcon->nativeFileSystem); @@ -2831,8 +2830,8 @@ /* else do not bother copying these informational fields */ } else { length = strnlen(bcc_ptr, 1024); - if (((long) bcc_ptr + length) - - (long) pByteArea(smb_buffer_response) <= + if ((bcc_ptr + length) - + pByteArea(smb_buffer_response) <= BCC(smb_buffer_response)) { if(tcon->nativeFileSystem) kfree(tcon->nativeFileSystem); diff -Nru a/fs/cifs/file.c b/fs/cifs/file.c --- a/fs/cifs/file.c 2004-09-26 10:25:55 -07:00 +++ b/fs/cifs/file.c 2004-09-26 10:25:55 -07:00 @@ -1348,12 +1348,11 @@ { struct cifsInodeInfo *cifsInfo = CIFS_I(tmp_inode); struct cifs_sb_info *cifs_sb = CIFS_SB(tmp_inode->i_sb); + __u32 attr = le32_to_cpu(pfindData->ExtFileAttributes); + __u64 allocation_size = le64_to_cpu(pfindData->AllocationSize); + __u64 end_of_file = le64_to_cpu(pfindData->EndOfFile); - pfindData->ExtFileAttributes = - le32_to_cpu(pfindData->ExtFileAttributes); - pfindData->AllocationSize = le64_to_cpu(pfindData->AllocationSize); - pfindData->EndOfFile = le64_to_cpu(pfindData->EndOfFile); - cifsInfo->cifsAttrs = pfindData->ExtFileAttributes; + cifsInfo->cifsAttrs = attr; cifsInfo->time = jiffies; /* Linux can not store file creation time unfortunately so ignore it */ @@ -1376,12 +1375,12 @@ cFYI(0, ("CIFS FFIRST: Attributes came in as 0x%x", - pfindData->ExtFileAttributes)); - if (pfindData->ExtFileAttributes & ATTR_REPARSE) { + attr)); + if (attr & ATTR_REPARSE) { *pobject_type = DT_LNK; /* BB can this and S_IFREG or S_IFDIR be set as in Windows? */ tmp_inode->i_mode |= S_IFLNK; - } else if (pfindData->ExtFileAttributes & ATTR_DIRECTORY) { + } else if (attr & ATTR_DIRECTORY) { *pobject_type = DT_DIR; /* override default perms since we do not lock dirs */ if(atomic_read(&cifsInfo->inUse) == 0) { @@ -1391,7 +1390,7 @@ } else { *pobject_type = DT_REG; tmp_inode->i_mode |= S_IFREG; - if(pfindData->ExtFileAttributes & ATTR_READONLY) + if(attr & ATTR_READONLY) tmp_inode->i_mode &= ~(S_IWUGO); }/* could add code here - to validate if device or weird share type? */ @@ -1404,14 +1403,14 @@ if(is_size_safe_to_change(cifsInfo)) { /* can not safely change the file size here if the client is writing to it due to potential races */ - i_size_write(tmp_inode,pfindData->EndOfFile); + i_size_write(tmp_inode,end_of_file); /* 512 bytes (2**9) is the fake blocksize that must be used */ /* for this calculation, even though the reported blocksize is larger */ - tmp_inode->i_blocks = (512 - 1 + pfindData->AllocationSize) >> 9; + tmp_inode->i_blocks = (512 - 1 + allocation_size) >> 9; } - if (pfindData->AllocationSize < pfindData->EndOfFile) + if (allocation_size < end_of_file) cFYI(1, ("Possible sparse file: allocation size less than end of file ")); cFYI(1, ("File Size %ld and blocks %ld and blocksize %ld", @@ -1441,6 +1440,9 @@ FILE_UNIX_INFO * pfindData, int *pobject_type) { struct cifsInodeInfo *cifsInfo = CIFS_I(tmp_inode); + __u32 type = le32_to_cpu(pfindData->Type); + __u64 num_of_bytes = le64_to_cpu(pfindData->NumOfBytes); + __u64 end_of_file = le64_to_cpu(pfindData->EndOfFile); cifsInfo->time = jiffies; atomic_inc(&cifsInfo->inUse); @@ -1452,30 +1454,29 @@ cifs_NTtimeToUnix(le64_to_cpu(pfindData->LastStatusChange)); tmp_inode->i_mode = le64_to_cpu(pfindData->Permissions); - pfindData->Type = le32_to_cpu(pfindData->Type); - if (pfindData->Type == UNIX_FILE) { + if (type == UNIX_FILE) { *pobject_type = DT_REG; tmp_inode->i_mode |= S_IFREG; - } else if (pfindData->Type == UNIX_SYMLINK) { + } else if (type == UNIX_SYMLINK) { *pobject_type = DT_LNK; tmp_inode->i_mode |= S_IFLNK; - } else if (pfindData->Type == UNIX_DIR) { + } else if (type == UNIX_DIR) { *pobject_type = DT_DIR; tmp_inode->i_mode |= S_IFDIR; - } else if (pfindData->Type == UNIX_CHARDEV) { + } else if (type == UNIX_CHARDEV) { *pobject_type = DT_CHR; tmp_inode->i_mode |= S_IFCHR; tmp_inode->i_rdev = MKDEV(le64_to_cpu(pfindData->DevMajor), le64_to_cpu(pfindData->DevMinor) & MINORMASK); - } else if (pfindData->Type == UNIX_BLOCKDEV) { + } else if (type == UNIX_BLOCKDEV) { *pobject_type = DT_BLK; tmp_inode->i_mode |= S_IFBLK; tmp_inode->i_rdev = MKDEV(le64_to_cpu(pfindData->DevMajor), le64_to_cpu(pfindData->DevMinor) & MINORMASK); - } else if (pfindData->Type == UNIX_FIFO) { + } else if (type == UNIX_FIFO) { *pobject_type = DT_FIFO; tmp_inode->i_mode |= S_IFIFO; - } else if (pfindData->Type == UNIX_SOCKET) { + } else if (type == UNIX_SOCKET) { *pobject_type = DT_SOCK; tmp_inode->i_mode |= S_IFSOCK; } @@ -1484,17 +1485,15 @@ tmp_inode->i_gid = le64_to_cpu(pfindData->Gid); tmp_inode->i_nlink = le64_to_cpu(pfindData->Nlinks); - pfindData->NumOfBytes = le64_to_cpu(pfindData->NumOfBytes); if(is_size_safe_to_change(cifsInfo)) { /* can not safely change the file size here if the client is writing to it due to potential races */ - pfindData->EndOfFile = le64_to_cpu(pfindData->EndOfFile); - i_size_write(tmp_inode,pfindData->EndOfFile); + i_size_write(tmp_inode,end_of_file); /* 512 bytes (2**9) is the fake blocksize that must be used */ /* for this calculation, not the real blocksize */ - tmp_inode->i_blocks = (512 - 1 + pfindData->NumOfBytes) >> 9; + tmp_inode->i_blocks = (512 - 1 + num_of_bytes) >> 9; } if (S_ISREG(tmp_inode->i_mode)) { @@ -1608,7 +1607,7 @@ int object_type,rc; pqstring->name = pfindData->FileName; - pqstring->len = pfindData->FileNameLength; + /* pqstring->len is already set by caller */ construct_dentry(pqstring, file, &tmp_inode, &tmp_dentry); if((tmp_inode == NULL) || (tmp_dentry == NULL)) { @@ -1746,10 +1745,12 @@ rc = CIFSFindFirst(xid, pTcon, full_path, pfindData, &findParms, cifs_sb->local_nls, &Unicode, &UnixSearch); - cFYI(1, ("Count: %d End: %d ", findParms.SearchCount, - findParms.EndofSearch)); + cFYI(1, ("Count: %d End: %d ", + le16_to_cpu(findParms.SearchCount), + le16_to_cpu(findParms.EndofSearch))); if (rc == 0) { + __u16 count = le16_to_cpu(findParms.SearchCount); searchHandle = findParms.SearchHandle; if(file->private_data == NULL) file->private_data = @@ -1770,7 +1771,7 @@ renew_parental_timestamps(file->f_dentry); lastFindData = (FILE_DIRECTORY_INFO *) ((char *) pfindData + - findParms.LastNameOffset); + le16_to_cpu(findParms.LastNameOffset)); if((char *)lastFindData > (char *)pfindData + bufsize) { cFYI(1,("last search entry past end of packet")); rc = -EIO; @@ -1833,23 +1834,21 @@ pfindDataUnix->FileName, cifsFile->resume_name_length); } - for (i = 2; i < (unsigned int)findParms.SearchCount + 2; i++) { + for (i = 2; i < count + 2; i++) { if (UnixSearch == FALSE) { - pfindData->FileNameLength = - le32_to_cpu(pfindData->FileNameLength); + __u32 len = le32_to_cpu(pfindData->FileNameLength); if (Unicode == TRUE) - pfindData->FileNameLength = + len = cifs_strfromUCS_le (pfindData->FileName, (wchar_t *) pfindData->FileName, - (pfindData-> - FileNameLength) / 2, + len / 2, cifs_sb->local_nls); - qstring.len = pfindData->FileNameLength; - if (((qstring.len != 1) + qstring.len = len; + if (((len != 1) || (pfindData->FileName[0] != '.')) - && ((qstring.len != 2) + && ((len != 2) || (pfindData-> FileName[0] != '.') || (pfindData-> @@ -1917,7 +1916,7 @@ } /* end for loop */ if ((findParms.EndofSearch != 0) && cifsFile) { cifsFile->endOfSearch = TRUE; - if(findParms.SearchCount == 2) + if(findParms.SearchCount == cpu_to_le16(2)) cifsFile->emptyDir = TRUE; } } else { @@ -1948,13 +1947,14 @@ cifsFile->resume_key, &Unicode, &UnixSearch); cFYI(1,("Count: %d End: %d ", - findNextParms.SearchCount, - findNextParms.EndofSearch)); + le16_to_cpu(findNextParms.SearchCount), + le16_to_cpu(findNextParms.EndofSearch))); if ((rc == 0) && (findNextParms.SearchCount != 0)) { /* BB save off resume key, key name and name length */ + __u16 count = le16_to_cpu(findNextParms.SearchCount); lastFindData = (FILE_DIRECTORY_INFO *) ((char *) pfindData - + findNextParms.LastNameOffset); + + le16_to_cpu(findNextParms.LastNameOffset)); if((char *)lastFindData > (char *)pfindData + bufsize) { cFYI(1,("last search entry past end of packet")); rc = -EIO; @@ -2031,24 +2031,22 @@ cifsFile->resume_name_length); } - for (i = 0; i < findNextParms.SearchCount; i++) { - pfindData->FileNameLength = - le32_to_cpu(pfindData-> + for (i = 0; i < count; i++) { + __u32 len = le32_to_cpu(pfindData-> FileNameLength); if (UnixSearch == FALSE) { if (Unicode == TRUE) - pfindData->FileNameLength = + len = cifs_strfromUCS_le (pfindData->FileName, (wchar_t *) pfindData->FileName, - (pfindData->FileNameLength)/ 2, + len / 2, cifs_sb->local_nls); - qstring.len = - pfindData->FileNameLength; - if (((qstring.len != 1) + qstring.len = len; + if (((len != 1) || (pfindData->FileName[0] != '.')) - && ((qstring.len != 2) + && ((len != 2) || (pfindData->FileName[0] != '.') || (pfindData->FileName[1] != '.'))) { diff -Nru a/fs/cifs/inode.c b/fs/cifs/inode.c --- a/fs/cifs/inode.c 2004-09-26 10:25:55 -07:00 +++ b/fs/cifs/inode.c 2004-09-26 10:25:55 -07:00 @@ -76,6 +76,9 @@ } else { struct cifsInodeInfo *cifsInfo; + __u32 type = le32_to_cpu(findData.Type); + __u64 num_of_bytes = le64_to_cpu(findData.NumOfBytes); + __u64 end_of_file = le64_to_cpu(findData.EndOfFile); /* get new inode */ if (*pinode == NULL) { @@ -101,37 +104,34 @@ inode->i_ctime = cifs_NTtimeToUnix(le64_to_cpu(findData.LastStatusChange)); inode->i_mode = le64_to_cpu(findData.Permissions); - findData.Type = le32_to_cpu(findData.Type); - if (findData.Type == UNIX_FILE) { + if (type == UNIX_FILE) { inode->i_mode |= S_IFREG; - } else if (findData.Type == UNIX_SYMLINK) { + } else if (type == UNIX_SYMLINK) { inode->i_mode |= S_IFLNK; - } else if (findData.Type == UNIX_DIR) { + } else if (type == UNIX_DIR) { inode->i_mode |= S_IFDIR; - } else if (findData.Type == UNIX_CHARDEV) { + } else if (type == UNIX_CHARDEV) { inode->i_mode |= S_IFCHR; inode->i_rdev = MKDEV(le64_to_cpu(findData.DevMajor), le64_to_cpu(findData.DevMinor) & MINORMASK); - } else if (findData.Type == UNIX_BLOCKDEV) { + } else if (type == UNIX_BLOCKDEV) { inode->i_mode |= S_IFBLK; inode->i_rdev = MKDEV(le64_to_cpu(findData.DevMajor), le64_to_cpu(findData.DevMinor) & MINORMASK); - } else if (findData.Type == UNIX_FIFO) { + } else if (type == UNIX_FIFO) { inode->i_mode |= S_IFIFO; - } else if (findData.Type == UNIX_SOCKET) { + } else if (type == UNIX_SOCKET) { inode->i_mode |= S_IFSOCK; } inode->i_uid = le64_to_cpu(findData.Uid); inode->i_gid = le64_to_cpu(findData.Gid); inode->i_nlink = le64_to_cpu(findData.Nlinks); - findData.NumOfBytes = le64_to_cpu(findData.NumOfBytes); - findData.EndOfFile = le64_to_cpu(findData.EndOfFile); if(is_size_safe_to_change(cifsInfo)) { /* can not safely change the file size here if the client is writing to it due to potential races */ - i_size_write(inode,findData.EndOfFile); + i_size_write(inode, end_of_file); /* blksize needs to be multiple of two. So safer to default to blksize and blkbits set in superblock so 2**blkbits and blksize will match */ /* inode->i_blksize = @@ -143,14 +143,14 @@ /* inode->i_blocks = - (inode->i_blksize - 1 + findData.NumOfBytes) >> inode->i_blkbits;*/ + (inode->i_blksize - 1 + num_of_bytes) >> inode->i_blkbits;*/ /* 512 bytes (2**9) is the fake blocksize that must be used */ /* for this calculation */ - inode->i_blocks = (512 - 1 + findData.NumOfBytes) >> 9; + inode->i_blocks = (512 - 1 + num_of_bytes) >> 9; } - if (findData.NumOfBytes < findData.EndOfFile) + if (num_of_bytes < end_of_file) cFYI(1, ("Server inconsistency Error: it says allocation size less than end of file ")); cFYI(1, ("Size %ld and blocks %ld ", @@ -237,6 +237,7 @@ } } else { struct cifsInodeInfo *cifsInfo; + __u32 attr = le32_to_cpu(pfindData->Attributes); /* get new inode */ if (*pinode == NULL) { @@ -247,8 +248,7 @@ } inode = *pinode; cifsInfo = CIFS_I(inode); - pfindData->Attributes = le32_to_cpu(pfindData->Attributes); - cifsInfo->cifsAttrs = pfindData->Attributes; + cifsInfo->cifsAttrs = attr; cFYI(1, (" Old time %ld ", cifsInfo->time)); cifsInfo->time = jiffies; cFYI(1, (" New time %ld ", cifsInfo->time)); @@ -266,17 +266,17 @@ inode->i_ctime = cifs_NTtimeToUnix(le64_to_cpu(pfindData->ChangeTime)); cFYI(0, - (" Attributes came in as 0x%x ", pfindData->Attributes)); + (" Attributes came in as 0x%x ", attr)); /* set default mode. will override for dirs below */ if(atomic_read(&cifsInfo->inUse) == 0) /* new inode, can safely set these fields */ inode->i_mode = cifs_sb->mnt_file_mode; - if (pfindData->Attributes & ATTR_REPARSE) { + if (attr & ATTR_REPARSE) { /* Can IFLNK be set as it basically is on windows with IFREG or IFDIR? */ inode->i_mode |= S_IFLNK; - } else if (pfindData->Attributes & ATTR_DIRECTORY) { + } else if (attr & ATTR_DIRECTORY) { /* override default perms since we do not do byte range locking on dirs */ inode->i_mode = cifs_sb->mnt_dir_mode; inode->i_mode |= S_IFDIR; @@ -298,7 +298,6 @@ inode->i_blocks = (512 - 1 + le64_to_cpu(pfindData->AllocationSize)) >> 9; } - pfindData->AllocationSize = le64_to_cpu(pfindData->AllocationSize); inode->i_nlink = le32_to_cpu(pfindData->NumberOfLinks); @@ -951,7 +950,7 @@ } else time_buf.ChangeTime = 0; - if (set_time | time_buf.Attributes) { + if (set_time || time_buf.Attributes) { /* BB what if setting one attribute fails (such as size) but time setting works */ time_buf.CreationTime = 0; /* do not change */ diff -Nru a/fs/cifs/misc.c b/fs/cifs/misc.c --- a/fs/cifs/misc.c 2004-09-26 10:25:57 -07:00 +++ b/fs/cifs/misc.c 2004-09-26 10:25:57 -07:00 @@ -189,7 +189,6 @@ ) { int i; - __u32 tmp; struct list_head* temp_item; struct cifsSesInfo * ses; char *temp = (char *) buffer; @@ -211,10 +210,8 @@ buffer->Command = smb_command; buffer->Flags = 0x00; /* case sensitive */ buffer->Flags2 = SMBFLG2_KNOWS_LONG_NAMES; - tmp = cpu_to_le32(current->tgid); - buffer->Pid = tmp & 0xFFFF; - tmp >>= 16; - buffer->PidHigh = tmp & 0xFFFF; + buffer->Pid = cpu_to_le16((__u16)current->tgid); + buffer->PidHigh = cpu_to_le16((__u16)(current->tgid >> 16)); spin_lock(&GlobalMid_Lock); GlobalMid++; buffer->Mid = GlobalMid; @@ -292,7 +289,7 @@ { /* Make sure that this really is an SMB, that it is a response, and that the message ids match */ - if ((*(unsigned int *) smb->Protocol == cpu_to_le32(0x424d53ff)) && + if ((*(__le32 *) smb->Protocol == cpu_to_le32(0x424d53ff)) && (mid == smb->Mid)) { if(smb->Flags & SMBFLG_RESPONSE) return 0; @@ -304,7 +301,7 @@ cERROR(1, ("Rcvd Request not response ")); } } else { /* bad signature or mid */ - if (*(unsigned int *) smb->Protocol != cpu_to_le32(0x424d53ff)) + if (*(__le32 *) smb->Protocol != cpu_to_le32(0x424d53ff)) cERROR(1, ("Bad protocol string signature header %x ", *(unsigned int *) smb->Protocol)); @@ -318,12 +315,12 @@ int checkSMB(struct smb_hdr *smb, __u16 mid, int length) { + __u32 len = be32_to_cpu(smb->smb_buf_length); cFYI(0, ("Entering checkSMB with Length: %x, smb_buf_length: %x ", - length, ntohl(smb->smb_buf_length))); - if (((unsigned int)length < 2 + sizeof (struct smb_hdr)) - || (ntohl(smb->smb_buf_length) > - CIFS_MAX_MSGSIZE + MAX_CIFS_HDR_SIZE - 4)) { + length, len)); + if (((unsigned int)length < 2 + sizeof (struct smb_hdr)) || + (len > CIFS_MAX_MSGSIZE + MAX_CIFS_HDR_SIZE - 4)) { if ((unsigned int)length < 2 + sizeof (struct smb_hdr)) { cERROR(1, ("Length less than 2 + sizeof smb_hdr ")); if (((unsigned int)length >= sizeof (struct smb_hdr) - 1) @@ -331,8 +328,7 @@ return 0; /* some error cases do not return wct and bcc */ } - if (ntohl(smb->smb_buf_length) > - CIFS_MAX_MSGSIZE + MAX_CIFS_HDR_SIZE - 4) + if (len > CIFS_MAX_MSGSIZE + MAX_CIFS_HDR_SIZE - 4) cERROR(1, ("smb_buf_length greater than CIFS_MAX_MSGSIZE ... ")); cERROR(1, @@ -344,8 +340,8 @@ if (checkSMBhdr(smb, mid)) return 1; - if ((4 + ntohl(smb->smb_buf_length) != smbCalcSize(smb)) - || (4 + ntohl(smb->smb_buf_length) != (unsigned int)length)) { + if ((4 + len != smbCalcSize(smb)) + || (4 + len != (unsigned int)length)) { return 0; } else { cERROR(1, ("smbCalcSize %x ", smbCalcSize(smb))); diff -Nru a/fs/cifs/netmisc.c b/fs/cifs/netmisc.c --- a/fs/cifs/netmisc.c 2004-09-26 10:25:57 -07:00 +++ b/fs/cifs/netmisc.c 2004-09-26 10:25:57 -07:00 @@ -187,8 +187,8 @@ if (value > addr_class_max[end - bytes]) return 0; - address.s_addr = *((int *) bytes) | htonl(value); - *((int *)dst) = address.s_addr; + address.s_addr = *((__be32 *) bytes) | htonl(value); + *((__be32 *)dst) = address.s_addr; return 1; /* success */ } @@ -810,16 +810,13 @@ if (smb->Flags2 & SMBFLG2_ERR_STATUS) { /* translate the newer STATUS codes to old style errors and then to POSIX errors */ - smb->Status.CifsError = le32_to_cpu(smb->Status.CifsError); + __u32 err = le32_to_cpu(smb->Status.CifsError); if(cifsFYI) - cifs_print_status(smb->Status.CifsError); - ntstatus_to_dos(smb->Status.CifsError, &smberrclass, - &smberrcode); + cifs_print_status(err); + ntstatus_to_dos(err, &smberrclass, &smberrcode); } else { smberrclass = smb->Status.DosError.ErrorClass; - smb->Status.DosError.Error = - le16_to_cpu(smb->Status.DosError.Error); - smberrcode = smb->Status.DosError.Error; + smberrcode = le16_to_cpu(smb->Status.DosError.Error); } /* old style errors */ diff -Nru a/fs/cifs/ntlmssp.h b/fs/cifs/ntlmssp.h --- a/fs/cifs/ntlmssp.h 2004-09-26 10:25:55 -07:00 +++ b/fs/cifs/ntlmssp.h 2004-09-26 10:25:55 -07:00 @@ -23,10 +23,10 @@ #define NTLMSSP_SIGNATURE "NTLMSSP" /* Message Types */ -#define NtLmNegotiate 1 -#define NtLmChallenge 2 -#define NtLmAuthenticate 3 -#define UnknownMessage 8 +#define NtLmNegotiate cpu_to_le32(1) +#define NtLmChallenge cpu_to_le32(2) +#define NtLmAuthenticate cpu_to_le32(3) +#define UnknownMessage cpu_to_le32(8) /* Negotiate Flags */ #define NTLMSSP_NEGOTIATE_UNICODE 0x01 // Text strings are in unicode @@ -60,15 +60,15 @@ /* appearance */ typedef struct _SECURITY_BUFFER { - __u16 Length; - __u16 MaximumLength; - __u32 Buffer; /* offset to buffer */ + __le16 Length; + __le16 MaximumLength; + __le32 Buffer; /* offset to buffer */ } SECURITY_BUFFER; typedef struct _NEGOTIATE_MESSAGE { __u8 Signature[sizeof (NTLMSSP_SIGNATURE)]; - __u32 MessageType; /* 1 */ - __u32 NegotiateFlags; + __le32 MessageType; /* 1 */ + __le32 NegotiateFlags; SECURITY_BUFFER DomainName; /* RFC 1001 style and ASCII */ SECURITY_BUFFER WorkstationName; /* RFC 1001 and ASCII */ char DomainString[0]; @@ -77,9 +77,9 @@ typedef struct _CHALLENGE_MESSAGE { __u8 Signature[sizeof (NTLMSSP_SIGNATURE)]; - __u32 MessageType; /* 2 */ + __le32 MessageType; /* 2 */ SECURITY_BUFFER TargetName; - __u32 NegotiateFlags; + __le32 NegotiateFlags; __u8 Challenge[CIFS_CRYPTO_KEY_SIZE]; __u8 Reserved[8]; SECURITY_BUFFER TargetInfoArray; @@ -87,14 +87,14 @@ typedef struct _AUTHENTICATE_MESSAGE { __u8 Signature[sizeof (NTLMSSP_SIGNATURE)]; - __u32 MessageType; /* 3 */ + __le32 MessageType; /* 3 */ SECURITY_BUFFER LmChallengeResponse; SECURITY_BUFFER NtChallengeResponse; SECURITY_BUFFER DomainName; SECURITY_BUFFER UserName; SECURITY_BUFFER WorkstationName; SECURITY_BUFFER SessionKey; - __u32 NegotiateFlags; + __le32 NegotiateFlags; char UserString[0]; } AUTHENTICATE_MESSAGE, *PAUTHENTICATE_MESSAGE; diff -Nru a/fs/cifs/transport.c b/fs/cifs/transport.c --- a/fs/cifs/transport.c 2004-09-26 10:25:56 -07:00 +++ b/fs/cifs/transport.c 2004-09-26 10:25:56 -07:00 @@ -123,11 +123,12 @@ int i = 0; struct msghdr smb_msg; struct kvec iov; + unsigned len = smb_buf_length + 4; if(ssocket == NULL) return -ENOTSOCK; /* BB eventually add reconnect code here */ iov.iov_base = smb_buffer; - iov.iov_len = smb_buf_length + 4; + iov.iov_len = len; smb_msg.msg_name = sin; smb_msg.msg_namelen = sizeof (struct sockaddr); @@ -142,10 +143,10 @@ smb_buffer->smb_buf_length = cpu_to_be32(smb_buffer->smb_buf_length); cFYI(1, ("Sending smb of length %d ", smb_buf_length)); - dump_smb(smb_buffer, smb_buf_length + 4); + dump_smb(smb_buffer, len); - while(iov.iov_len > 0) { - rc = kernel_sendmsg(ssocket, &smb_msg, &iov, 1, smb_buf_length + 4); + while (len > 0) { + rc = kernel_sendmsg(ssocket, &smb_msg, &iov, 1, len); if ((rc == -ENOSPC) || (rc == -EAGAIN)) { i++; if(i > 60) { @@ -163,6 +164,7 @@ break; iov.iov_base += rc; iov.iov_len -= rc; + len -= rc; } if (rc < 0) { @@ -272,9 +274,6 @@ return -EIO; } - if (in_buf->smb_buf_length > 12) - in_buf->Flags2 = cpu_to_le16(in_buf->Flags2); - rc = cifs_sign_smb(in_buf, ses, &midQ->sequence_number); midQ->midState = MID_REQUEST_SUBMITTED; @@ -329,7 +328,7 @@ spin_lock(&GlobalMid_Lock); if (midQ->resp_buf) { spin_unlock(&GlobalMid_Lock); - receive_len = be32_to_cpu(midQ->resp_buf->smb_buf_length); + receive_len = be32_to_cpu(*(__be32 *)midQ->resp_buf); } else { cERROR(1,("No response buffer")); if(midQ->midState == MID_REQUEST_SUBMITTED) { @@ -368,28 +367,19 @@ if (midQ->resp_buf && out_buf && (midQ->midState == MID_RESPONSE_RECEIVED)) { - memcpy(out_buf, midQ->resp_buf, - receive_len + - 4 /* include 4 byte RFC1001 header */ ); + out_buf->smb_buf_length = receive_len; + memcpy((char *)out_buf + 4, + (char *)midQ->resp_buf + 4, + receive_len); dump_smb(out_buf, 92); /* convert the length into a more usable form */ - out_buf->smb_buf_length = - be32_to_cpu(out_buf->smb_buf_length); - if((out_buf->smb_buf_length > 24) && + if((receive_len > 24) && (ses->server->secMode & (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED))) { rc = cifs_verify_signature(out_buf, ses->mac_signing_key,midQ->sequence_number); /* BB fix BB */ if(rc) cFYI(1,("Unexpected signature received from server")); } - - if (out_buf->smb_buf_length > 12) - out_buf->Flags2 = le16_to_cpu(out_buf->Flags2); - if (out_buf->smb_buf_length > 28) - out_buf->Pid = le16_to_cpu(out_buf->Pid); - if (out_buf->smb_buf_length > 28) - out_buf->PidHigh = - le16_to_cpu(out_buf->PidHigh); *pbytes_returned = out_buf->smb_buf_length; diff -Nru a/fs/compat.c b/fs/compat.c --- a/fs/compat.c 2004-09-26 10:25:56 -07:00 +++ b/fs/compat.c 2004-09-26 10:25:56 -07:00 @@ -528,8 +528,15 @@ ret = sys_fcntl(fd, cmd, (unsigned long)&f); set_fs(old_fs); if ((cmd == F_GETLK) && (ret == 0)) { + /* POSIX-2001 now defines negative l_len */ + if (f.l_len < 0) { + f.l_start += f.l_len; + f.l_len = -f.l_len; + } + if (f.l_start < 0) + return -EINVAL; if ((f.l_start >= COMPAT_OFF_T_MAX) || - ((f.l_start + f.l_len) >= COMPAT_OFF_T_MAX)) + ((f.l_start + f.l_len) > COMPAT_OFF_T_MAX)) ret = -EOVERFLOW; if (ret == 0) ret = put_compat_flock(&f, compat_ptr(arg)); @@ -549,8 +556,15 @@ (unsigned long)&f); set_fs(old_fs); if ((cmd == F_GETLK64) && (ret == 0)) { + /* POSIX-2001 now defines negative l_len */ + if (f.l_len < 0) { + f.l_start += f.l_len; + f.l_len = -f.l_len; + } + if (f.l_start < 0) + return -EINVAL; if ((f.l_start >= COMPAT_LOFF_T_MAX) || - ((f.l_start + f.l_len) >= COMPAT_LOFF_T_MAX)) + ((f.l_start + f.l_len) > COMPAT_LOFF_T_MAX)) ret = -EOVERFLOW; if (ret == 0) ret = put_compat_flock64(&f, compat_ptr(arg)); @@ -1368,7 +1382,7 @@ compat_uptr_t __user *envp, struct pt_regs * regs) { - struct linux_binprm bprm; + struct linux_binprm *bprm; struct file *file; int retval; int i; @@ -1381,86 +1395,86 @@ sched_exec(); - bprm.p = PAGE_SIZE*MAX_ARG_PAGES-sizeof(void *); - memset(bprm.page, 0, MAX_ARG_PAGES*sizeof(bprm.page[0])); - - bprm.file = file; - bprm.filename = filename; - bprm.interp = filename; - bprm.sh_bang = 0; - bprm.loader = 0; - bprm.exec = 0; - bprm.interp_flags = 0; - bprm.interp_data = 0; - bprm.security = NULL; - bprm.mm = mm_alloc(); retval = -ENOMEM; - if (!bprm.mm) + bprm = kmalloc(sizeof(*bprm), GFP_KERNEL); + if (!bprm) + goto out_ret; + memset(bprm, 0, sizeof(*bprm)); + + bprm->p = PAGE_SIZE*MAX_ARG_PAGES-sizeof(void *); + bprm->file = file; + bprm->filename = filename; + bprm->interp = filename; + bprm->mm = mm_alloc(); + if (!bprm->mm) goto out_file; - retval = init_new_context(current, bprm.mm); + retval = init_new_context(current, bprm->mm); if (retval < 0) goto out_mm; - bprm.argc = compat_count(argv, bprm.p / sizeof(compat_uptr_t)); - if ((retval = bprm.argc) < 0) + bprm->argc = compat_count(argv, bprm->p / sizeof(compat_uptr_t)); + if ((retval = bprm->argc) < 0) goto out_mm; - bprm.envc = compat_count(envp, bprm.p / sizeof(compat_uptr_t)); - if ((retval = bprm.envc) < 0) + bprm->envc = compat_count(envp, bprm->p / sizeof(compat_uptr_t)); + if ((retval = bprm->envc) < 0) goto out_mm; - retval = security_bprm_alloc(&bprm); + retval = security_bprm_alloc(bprm); if (retval) goto out; - retval = prepare_binprm(&bprm); + retval = prepare_binprm(bprm); if (retval < 0) goto out; - retval = copy_strings_kernel(1, &bprm.filename, &bprm); + retval = copy_strings_kernel(1, &bprm->filename, bprm); if (retval < 0) goto out; - bprm.exec = bprm.p; - retval = compat_copy_strings(bprm.envc, envp, &bprm); + bprm->exec = bprm->p; + retval = compat_copy_strings(bprm->envc, envp, bprm); if (retval < 0) goto out; - retval = compat_copy_strings(bprm.argc, argv, &bprm); + retval = compat_copy_strings(bprm->argc, argv, bprm); if (retval < 0) goto out; - retval = search_binary_handler(&bprm,regs); + retval = search_binary_handler(bprm, regs); if (retval >= 0) { - free_arg_pages(&bprm); + free_arg_pages(bprm); /* execve success */ - security_bprm_free(&bprm); + security_bprm_free(bprm); + kfree(bprm); return retval; } out: /* Something went wrong, return the inode and free the argument pages*/ for (i = 0 ; i < MAX_ARG_PAGES ; i++) { - struct page * page = bprm.page[i]; + struct page * page = bprm->page[i]; if (page) __free_page(page); } - if (bprm.security) - security_bprm_free(&bprm); + if (bprm->security) + security_bprm_free(bprm); out_mm: - if (bprm.mm) - mmdrop(bprm.mm); + if (bprm->mm) + mmdrop(bprm->mm); out_file: - if (bprm.file) { - allow_write_access(bprm.file); - fput(bprm.file); + if (bprm->file) { + allow_write_access(bprm->file); + fput(bprm->file); } + kfree(bprm); +out_ret: return retval; } diff -Nru a/fs/compat_ioctl.c b/fs/compat_ioctl.c --- a/fs/compat_ioctl.c 2004-09-26 10:25:57 -07:00 +++ b/fs/compat_ioctl.c 2004-09-26 10:25:57 -07:00 @@ -116,6 +116,8 @@ #include #include +#include + #undef INCLUDES #endif diff -Nru a/fs/direct-io.c b/fs/direct-io.c --- a/fs/direct-io.c 2004-09-26 10:25:56 -07:00 +++ b/fs/direct-io.c 2004-09-26 10:25:56 -07:00 @@ -53,9 +53,12 @@ * If blkfactor is zero then the user's request was aligned to the filesystem's * blocksize. * - * needs_locking is set for regular files on direct-IO-naive filesystems. It - * determines whether we need to do the fancy locking which prevents direct-IO - * from being able to read uninitialised disk blocks. + * lock_type is DIO_LOCKING for regular files on direct-IO-naive filesystems. + * This determines whether we need to do the fancy locking which prevents + * direct-IO from being able to read uninitialised disk blocks. If its zero + * (blockdev) this locking is not done, and if it is DIO_OWN_LOCKING i_sem is + * not held for the entire direct write (taken briefly, initially, during a + * direct read though, but its never held for the duration of a direct-IO). */ struct dio { @@ -63,7 +66,7 @@ struct bio *bio; /* bio under assembly */ struct inode *inode; int rw; - int needs_locking; /* doesn't change */ + int lock_type; /* doesn't change */ unsigned blkbits; /* doesn't change */ unsigned blkfactor; /* When we're using an alignment which is finer than the filesystem's soft @@ -212,7 +215,7 @@ { if (dio->end_io && dio->result) dio->end_io(dio->inode, offset, bytes, dio->map_bh.b_private); - if (dio->needs_locking) + if (dio->lock_type != DIO_NO_LOCKING) up_read(&dio->inode->i_alloc_sem); } @@ -493,7 +496,7 @@ unsigned long fs_count; /* Number of filesystem-sized blocks */ unsigned long dio_count;/* Number of dio_block-sized blocks */ unsigned long blkmask; - int beyond_eof = 0; + int create; /* * If there was a memory error and we've overwritten all the @@ -511,10 +514,13 @@ if (dio_count & blkmask) fs_count++; - if (dio->needs_locking) { - if (dio->block_in_file >= (i_size_read(dio->inode) >> + create = dio->rw == WRITE; + if (dio->lock_type == DIO_LOCKING) { + if (dio->block_in_file < (i_size_read(dio->inode) >> dio->blkbits)) - beyond_eof = 1; + create = 0; + } else if (dio->lock_type == DIO_NO_LOCKING) { + create = 0; } /* * For writes inside i_size we forbid block creations: only @@ -523,7 +529,7 @@ * writes. */ ret = (*dio->get_blocks)(dio->inode, fs_startblk, fs_count, - map_bh, (dio->rw == WRITE) && beyond_eof); + map_bh, create); } return ret; } @@ -958,7 +964,15 @@ dio->bio_list = NULL; dio->waiter = NULL; - dio->pages_in_io = 0; + /* + * In case of non-aligned buffers, we may need 2 more + * pages since we need to zero out first and last block. + */ + if (unlikely(dio->blkfactor)) + dio->pages_in_io = 2; + else + dio->pages_in_io = 0; + for (seg = 0; seg < nr_segs; seg++) { user_addr = (unsigned long)iov[seg].iov_base; dio->pages_in_io += @@ -1033,7 +1047,7 @@ * we can let i_sem go now that its achieved its purpose * of protecting us from looking up uninitialized blocks. */ - if ((rw == READ) && dio->needs_locking) + if ((rw == READ) && (dio->lock_type == DIO_LOCKING)) up(&dio->inode->i_sem); /* @@ -1120,7 +1134,7 @@ __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, struct block_device *bdev, const struct iovec *iov, loff_t offset, unsigned long nr_segs, get_blocks_t get_blocks, dio_iodone_t end_io, - int needs_special_locking) + int dio_lock_type) { int seg; size_t size; @@ -1131,7 +1145,6 @@ ssize_t retval = -EINVAL; loff_t end = offset; struct dio *dio; - int needs_locking; if (bdev) bdev_blkbits = blksize_bits(bdev_hardsect_size(bdev)); @@ -1164,13 +1177,15 @@ goto out; /* - * For regular files, + * For regular files using DIO_LOCKING, * readers need to grab i_sem and i_alloc_sem * writers need to grab i_alloc_sem only (i_sem is already held) + * For regular files using DIO_OWN_LOCKING, + * both readers and writers need to grab i_alloc_sem + * neither readers nor writers hold i_sem on entry (nor exit) */ - needs_locking = 0; - if (S_ISREG(inode->i_mode) && needs_special_locking) { - needs_locking = 1; + dio->lock_type = dio_lock_type; + if (dio_lock_type != DIO_NO_LOCKING) { if (rw == READ) { struct address_space *mapping; @@ -1182,10 +1197,13 @@ kfree(dio); goto out; } + down_read(&inode->i_alloc_sem); + if (dio_lock_type == DIO_OWN_LOCKING) + up(&inode->i_sem); + } else { + down_read(&inode->i_alloc_sem); } - down_read(&inode->i_alloc_sem); } - dio->needs_locking = needs_locking; /* * For file extending writes updating i_size before data * writeouts complete can expose uninitialized blocks. So diff -Nru a/fs/dquot.c b/fs/dquot.c --- a/fs/dquot.c 2004-09-26 10:25:56 -07:00 +++ b/fs/dquot.c 2004-09-26 10:25:56 -07:00 @@ -120,7 +120,7 @@ * i_sem on quota files is special (it's below dqio_sem) */ -spinlock_t dq_list_lock = SPIN_LOCK_UNLOCKED; +static spinlock_t dq_list_lock = SPIN_LOCK_UNLOCKED; spinlock_t dq_data_lock = SPIN_LOCK_UNLOCKED; static char *quotatypes[] = INITQFNAMES; @@ -1792,7 +1792,6 @@ EXPORT_SYMBOL(register_quota_format); EXPORT_SYMBOL(unregister_quota_format); EXPORT_SYMBOL(dqstats); -EXPORT_SYMBOL(dq_list_lock); EXPORT_SYMBOL(dq_data_lock); EXPORT_SYMBOL(vfs_quota_on); EXPORT_SYMBOL(vfs_quota_on_mount); diff -Nru a/fs/efs/super.c b/fs/efs/super.c --- a/fs/efs/super.c 2004-09-26 10:25:57 -07:00 +++ b/fs/efs/super.c 2004-09-26 10:25:57 -07:00 @@ -121,7 +121,8 @@ static efs_block_t efs_validate_vh(struct volume_header *vh) { int i; - unsigned int cs, csum, *ui; + __be32 cs, *ui; + int csum; efs_block_t sblock = 0; /* shuts up gcc */ struct pt_types *pt_entry; int pt_type, slice = -1; @@ -135,8 +136,8 @@ return 0; } - ui = ((unsigned int *) (vh + 1)) - 1; - for(csum = 0; ui >= ((unsigned int *) vh);) { + ui = ((__be32 *) (vh + 1)) - 1; + for(csum = 0; ui >= ((__be32 *) vh);) { cs = *ui--; csum += be32_to_cpu(cs); } diff -Nru a/fs/exec.c b/fs/exec.c --- a/fs/exec.c 2004-09-26 10:25:56 -07:00 +++ b/fs/exec.c 2004-09-26 10:25:56 -07:00 @@ -741,8 +741,10 @@ spin_unlock(&oldsighand->siglock); write_unlock_irq(&tasklist_lock); - if (newsig && atomic_dec_and_test(&oldsig->count)) + if (newsig && atomic_dec_and_test(&oldsig->count)) { + exit_itimers(oldsig); kmem_cache_free(signal_cachep, oldsig); + } if (atomic_dec_and_test(&oldsighand->count)) kmem_cache_free(sighand_cachep, oldsighand); @@ -1092,7 +1094,7 @@ char __user *__user *envp, struct pt_regs * regs) { - struct linux_binprm bprm; + struct linux_binprm *bprm; struct file *file; int retval; int i; @@ -1105,85 +1107,87 @@ sched_exec(); - bprm.p = PAGE_SIZE*MAX_ARG_PAGES-sizeof(void *); - memset(bprm.page, 0, MAX_ARG_PAGES*sizeof(bprm.page[0])); - - bprm.file = file; - bprm.filename = filename; - bprm.interp = filename; - bprm.interp_flags = 0; - bprm.interp_data = 0; - bprm.sh_bang = 0; - bprm.loader = 0; - bprm.exec = 0; - bprm.security = NULL; - bprm.mm = mm_alloc(); retval = -ENOMEM; - if (!bprm.mm) + bprm = kmalloc(sizeof(*bprm), GFP_KERNEL); + if (!bprm) + goto out_ret; + memset(bprm, 0, sizeof(*bprm)); + + bprm->p = PAGE_SIZE*MAX_ARG_PAGES-sizeof(void *); + + bprm->file = file; + bprm->filename = filename; + bprm->interp = filename; + bprm->mm = mm_alloc(); + if (!bprm->mm) goto out_file; - retval = init_new_context(current, bprm.mm); + retval = init_new_context(current, bprm->mm); if (retval < 0) goto out_mm; - bprm.argc = count(argv, bprm.p / sizeof(void *)); - if ((retval = bprm.argc) < 0) + bprm->argc = count(argv, bprm->p / sizeof(void *)); + if ((retval = bprm->argc) < 0) goto out_mm; - bprm.envc = count(envp, bprm.p / sizeof(void *)); - if ((retval = bprm.envc) < 0) + bprm->envc = count(envp, bprm->p / sizeof(void *)); + if ((retval = bprm->envc) < 0) goto out_mm; - retval = security_bprm_alloc(&bprm); + retval = security_bprm_alloc(bprm); if (retval) goto out; - retval = prepare_binprm(&bprm); + retval = prepare_binprm(bprm); if (retval < 0) goto out; - retval = copy_strings_kernel(1, &bprm.filename, &bprm); + retval = copy_strings_kernel(1, &bprm->filename, bprm); if (retval < 0) goto out; - bprm.exec = bprm.p; - retval = copy_strings(bprm.envc, envp, &bprm); + bprm->exec = bprm->p; + retval = copy_strings(bprm->envc, envp, bprm); if (retval < 0) goto out; - retval = copy_strings(bprm.argc, argv, &bprm); + retval = copy_strings(bprm->argc, argv, bprm); if (retval < 0) goto out; - retval = search_binary_handler(&bprm,regs); + retval = search_binary_handler(bprm,regs); if (retval >= 0) { - free_arg_pages(&bprm); + free_arg_pages(bprm); /* execve success */ - security_bprm_free(&bprm); + security_bprm_free(bprm); + kfree(bprm); return retval; } out: /* Something went wrong, return the inode and free the argument pages*/ for (i = 0 ; i < MAX_ARG_PAGES ; i++) { - struct page * page = bprm.page[i]; + struct page * page = bprm->page[i]; if (page) __free_page(page); } - if (bprm.security) - security_bprm_free(&bprm); + if (bprm->security) + security_bprm_free(bprm); out_mm: - if (bprm.mm) - mmdrop(bprm.mm); + if (bprm->mm) + mmdrop(bprm->mm); out_file: - if (bprm.file) { - allow_write_access(bprm.file); - fput(bprm.file); + if (bprm->file) { + allow_write_access(bprm->file); + fput(bprm->file); } + kfree(bprm); + +out_ret: return retval; } diff -Nru a/fs/ext2/ext2.h b/fs/ext2/ext2.h --- a/fs/ext2/ext2.h 2004-09-26 10:25:57 -07:00 +++ b/fs/ext2/ext2.h 2004-09-26 10:25:57 -07:00 @@ -115,7 +115,7 @@ /* inode.c */ extern void ext2_read_inode (struct inode *); -extern void ext2_write_inode (struct inode *, int); +extern int ext2_write_inode (struct inode *, int); extern void ext2_put_inode (struct inode *); extern void ext2_delete_inode (struct inode *); extern int ext2_sync_inode (struct inode *); diff -Nru a/fs/ext2/inode.c b/fs/ext2/inode.c --- a/fs/ext2/inode.c 2004-09-26 10:25:55 -07:00 +++ b/fs/ext2/inode.c 2004-09-26 10:25:55 -07:00 @@ -1248,9 +1248,9 @@ return err; } -void ext2_write_inode(struct inode *inode, int wait) +int ext2_write_inode(struct inode *inode, int wait) { - ext2_update_inode(inode, wait); + return ext2_update_inode(inode, wait); } int ext2_sync_inode(struct inode *inode) diff -Nru a/fs/ext3/acl.h b/fs/ext3/acl.h --- a/fs/ext3/acl.h 2004-09-26 10:25:57 -07:00 +++ b/fs/ext3/acl.h 2004-09-26 10:25:57 -07:00 @@ -10,18 +10,18 @@ #define EXT3_ACL_MAX_ENTRIES 32 typedef struct { - __u16 e_tag; - __u16 e_perm; - __u32 e_id; + __le16 e_tag; + __le16 e_perm; + __le32 e_id; } ext3_acl_entry; typedef struct { - __u16 e_tag; - __u16 e_perm; + __le16 e_tag; + __le16 e_perm; } ext3_acl_entry_short; typedef struct { - __u32 a_version; + __le32 a_version; } ext3_acl_header; static inline size_t ext3_acl_size(int count) diff -Nru a/fs/ext3/balloc.c b/fs/ext3/balloc.c --- a/fs/ext3/balloc.c 2004-09-26 10:25:55 -07:00 +++ b/fs/ext3/balloc.c 2004-09-26 10:25:55 -07:00 @@ -91,8 +91,8 @@ if (!bh) ext3_error (sb, "read_block_bitmap", "Cannot read block bitmap - " - "block_group = %d, block_bitmap = %lu", - block_group, (unsigned long) desc->bg_block_bitmap); + "block_group = %d, block_bitmap = %u", + block_group, le32_to_cpu(desc->bg_block_bitmap)); error_out: return bh; } diff -Nru a/fs/ext3/fsync.c b/fs/ext3/fsync.c --- a/fs/ext3/fsync.c 2004-09-26 10:25:57 -07:00 +++ b/fs/ext3/fsync.c 2004-09-26 10:25:57 -07:00 @@ -49,10 +49,6 @@ J_ASSERT(ext3_journal_current_handle() == 0); - smp_mb(); /* prepare for lockless i_state read */ - if (!(inode->i_state & I_DIRTY)) - goto out; - /* * data=writeback: * The caller's filemap_fdatawrite()/wait will sync the data. diff -Nru a/fs/ext3/ialloc.c b/fs/ext3/ialloc.c --- a/fs/ext3/ialloc.c 2004-09-26 10:25:56 -07:00 +++ b/fs/ext3/ialloc.c 2004-09-26 10:25:56 -07:00 @@ -64,8 +64,8 @@ if (!bh) ext3_error(sb, "read_inode_bitmap", "Cannot read inode bitmap - " - "block_group = %lu, inode_bitmap = %lu", - block_group, (unsigned long) desc->bg_inode_bitmap); + "block_group = %lu, inode_bitmap = %u", + block_group, le32_to_cpu(desc->bg_inode_bitmap)); error_out: return bh; } diff -Nru a/fs/ext3/inode.c b/fs/ext3/inode.c --- a/fs/ext3/inode.c 2004-09-26 10:25:56 -07:00 +++ b/fs/ext3/inode.c 2004-09-26 10:25:56 -07:00 @@ -305,12 +305,12 @@ typedef struct { - u32 *p; - u32 key; + __le32 *p; + __le32 key; struct buffer_head *bh; } Indirect; -static inline void add_chain(Indirect *p, struct buffer_head *bh, u32 *v) +static inline void add_chain(Indirect *p, struct buffer_head *bh, __le32 *v) { p->key = *(p->p = v); p->bh = bh; @@ -441,7 +441,7 @@ /* Reader: pointers */ if (!verify_chain(chain, p)) goto changed; - add_chain(++p, bh, (u32*)bh->b_data + *++offsets); + add_chain(++p, bh, (__le32*)bh->b_data + *++offsets); /* Reader: end */ if (!p->key) goto no_block; @@ -482,8 +482,8 @@ static unsigned long ext3_find_near(struct inode *inode, Indirect *ind) { struct ext3_inode_info *ei = EXT3_I(inode); - u32 *start = ind->bh ? (u32*) ind->bh->b_data : ei->i_data; - u32 *p; + __le32 *start = ind->bh ? (__le32*) ind->bh->b_data : ei->i_data; + __le32 *p; unsigned long bg_start; unsigned long colour; @@ -611,7 +611,7 @@ } memset(bh->b_data, 0, blocksize); - branch[n].p = (u32*) bh->b_data + offsets[n]; + branch[n].p = (__le32*) bh->b_data + offsets[n]; *branch[n].p = branch[n].key; BUFFER_TRACE(bh, "marking uptodate"); set_buffer_uptodate(bh); @@ -1767,7 +1767,7 @@ * or memcmp with zero_page, whatever is better for particular architecture. * Linus? */ -static inline int all_zeroes(u32 *p, u32 *q) +static inline int all_zeroes(__le32 *p, __le32 *q) { while (p < q) if (*p++) @@ -1814,7 +1814,7 @@ int depth, int offsets[4], Indirect chain[4], - u32 *top) + __le32 *top) { Indirect *partial, *p; int k, err; @@ -1834,7 +1834,7 @@ if (!partial->key && *partial->p) /* Writer: end */ goto no_top; - for (p=partial; p>chain && all_zeroes((u32*)p->bh->b_data,p->p); p--) + for (p=partial; p>chain && all_zeroes((__le32*)p->bh->b_data,p->p); p--) ; /* * OK, we've found the last block that must survive. The rest of our @@ -1873,9 +1873,9 @@ static void ext3_clear_blocks(handle_t *handle, struct inode *inode, struct buffer_head *bh, unsigned long block_to_free, unsigned long count, - u32 *first, u32 *last) + __le32 *first, __le32 *last) { - u32 *p; + __le32 *p; if (try_to_extend_transaction(handle, inode)) { if (bh) { BUFFER_TRACE(bh, "call ext3_journal_dirty_metadata"); @@ -1931,15 +1931,16 @@ * block pointers. */ static void ext3_free_data(handle_t *handle, struct inode *inode, - struct buffer_head *this_bh, u32 *first, u32 *last) + struct buffer_head *this_bh, + __le32 *first, __le32 *last) { unsigned long block_to_free = 0; /* Starting block # of a run */ unsigned long count = 0; /* Number of blocks in the run */ - u32 *block_to_free_p = NULL; /* Pointer into inode/ind + __le32 *block_to_free_p = NULL; /* Pointer into inode/ind corresponding to block_to_free */ unsigned long nr; /* Current block # */ - u32 *p; /* Pointer into inode/ind + __le32 *p; /* Pointer into inode/ind for current block */ int err; @@ -1998,10 +1999,10 @@ */ static void ext3_free_branches(handle_t *handle, struct inode *inode, struct buffer_head *parent_bh, - u32 *first, u32 *last, int depth) + __le32 *first, __le32 *last, int depth) { unsigned long nr; - u32 *p; + __le32 *p; if (is_handle_aborted(handle)) return; @@ -2031,8 +2032,9 @@ /* This zaps the entire block. Bottom up. */ BUFFER_TRACE(bh, "free child branches"); - ext3_free_branches(handle, inode, bh, (u32*)bh->b_data, - (u32*)bh->b_data + addr_per_block, + ext3_free_branches(handle, inode, bh, + (__le32*)bh->b_data, + (__le32*)bh->b_data + addr_per_block, depth); /* @@ -2137,13 +2139,13 @@ { handle_t *handle; struct ext3_inode_info *ei = EXT3_I(inode); - u32 *i_data = ei->i_data; + __le32 *i_data = ei->i_data; int addr_per_block = EXT3_ADDR_PER_BLOCK(inode->i_sb); struct address_space *mapping = inode->i_mapping; int offsets[4]; Indirect chain[4]; Indirect *partial; - int nr = 0; + __le32 nr = 0; int n; long last_block; unsigned blocksize = inode->i_sb->s_blocksize; @@ -2250,7 +2252,7 @@ /* Clear the ends of indirect blocks on the shared branch */ while (partial > chain) { ext3_free_branches(handle, inode, partial->bh, partial->p + 1, - (u32*)partial->bh->b_data + addr_per_block, + (__le32*)partial->bh->b_data+addr_per_block, (chain+n-1) - partial); BUFFER_TRACE(partial->bh, "call brelse"); brelse (partial->bh); @@ -2745,21 +2747,21 @@ * `stuff()' is running, and the new i_size will be lost. Plus the inode * will no longer be on the superblock's dirty inode list. */ -void ext3_write_inode(struct inode *inode, int wait) +int ext3_write_inode(struct inode *inode, int wait) { if (current->flags & PF_MEMALLOC) - return; + return 0; if (ext3_journal_current_handle()) { jbd_debug(0, "called recursively, non-PF_MEMALLOC!\n"); dump_stack(); - return; + return -EIO; } if (!wait) - return; + return 0; - ext3_force_commit(inode->i_sb); + return ext3_force_commit(inode->i_sb); } /* diff -Nru a/fs/ext3/namei.c b/fs/ext3/namei.c --- a/fs/ext3/namei.c 2004-09-26 10:25:56 -07:00 +++ b/fs/ext3/namei.c 2004-09-26 10:25:56 -07:00 @@ -71,9 +71,6 @@ #define swap(x, y) do { typeof(x) z = x; x = y; y = z; } while (0) #endif -typedef struct { u32 v; } le_u32; -typedef struct { u16 v; } le_u16; - #ifdef DX_DEBUG #define dxtrace(command) command #else @@ -82,22 +79,22 @@ struct fake_dirent { - /*le*/u32 inode; - /*le*/u16 rec_len; + __le32 inode; + __le16 rec_len; u8 name_len; u8 file_type; }; struct dx_countlimit { - le_u16 limit; - le_u16 count; + __le16 limit; + __le16 count; }; struct dx_entry { - le_u32 hash; - le_u32 block; + __le32 hash; + __le32 block; }; /* @@ -114,7 +111,7 @@ char dotdot_name[4]; struct dx_root_info { - le_u32 reserved_zero; + __le32 reserved_zero; u8 hash_version; u8 info_length; /* 8 */ u8 indirect_levels; @@ -184,42 +181,42 @@ static inline unsigned dx_get_block (struct dx_entry *entry) { - return le32_to_cpu(entry->block.v) & 0x00ffffff; + return le32_to_cpu(entry->block) & 0x00ffffff; } static inline void dx_set_block (struct dx_entry *entry, unsigned value) { - entry->block.v = cpu_to_le32(value); + entry->block = cpu_to_le32(value); } static inline unsigned dx_get_hash (struct dx_entry *entry) { - return le32_to_cpu(entry->hash.v); + return le32_to_cpu(entry->hash); } static inline void dx_set_hash (struct dx_entry *entry, unsigned value) { - entry->hash.v = cpu_to_le32(value); + entry->hash = cpu_to_le32(value); } static inline unsigned dx_get_count (struct dx_entry *entries) { - return le16_to_cpu(((struct dx_countlimit *) entries)->count.v); + return le16_to_cpu(((struct dx_countlimit *) entries)->count); } static inline unsigned dx_get_limit (struct dx_entry *entries) { - return le16_to_cpu(((struct dx_countlimit *) entries)->limit.v); + return le16_to_cpu(((struct dx_countlimit *) entries)->limit); } static inline void dx_set_count (struct dx_entry *entries, unsigned value) { - ((struct dx_countlimit *) entries)->count.v = cpu_to_le16(value); + ((struct dx_countlimit *) entries)->count = cpu_to_le16(value); } static inline void dx_set_limit (struct dx_entry *entries, unsigned value) { - ((struct dx_countlimit *) entries)->limit.v = cpu_to_le16(value); + ((struct dx_countlimit *) entries)->limit = cpu_to_le16(value); } static inline unsigned dx_root_limit (struct inode *dir, unsigned infosize) @@ -2258,7 +2255,7 @@ } else { BUFFER_TRACE(new_bh, "get write access"); ext3_journal_get_write_access(handle, new_bh); - new_de->inode = le32_to_cpu(old_inode->i_ino); + new_de->inode = cpu_to_le32(old_inode->i_ino); if (EXT3_HAS_INCOMPAT_FEATURE(new_dir->i_sb, EXT3_FEATURE_INCOMPAT_FILETYPE)) new_de->file_type = old_de->file_type; @@ -2313,7 +2310,7 @@ if (dir_bh) { BUFFER_TRACE(dir_bh, "get_write_access"); ext3_journal_get_write_access(handle, dir_bh); - PARENT_INO(dir_bh->b_data) = le32_to_cpu(new_dir->i_ino); + PARENT_INO(dir_bh->b_data) = cpu_to_le32(new_dir->i_ino); BUFFER_TRACE(dir_bh, "call ext3_journal_dirty_metadata"); ext3_journal_dirty_metadata(handle, dir_bh); old_dir->i_nlink--; diff -Nru a/fs/ext3/super.c b/fs/ext3/super.c --- a/fs/ext3/super.c 2004-09-26 10:25:57 -07:00 +++ b/fs/ext3/super.c 2004-09-26 10:25:57 -07:00 @@ -138,7 +138,7 @@ struct ext3_super_block *es = EXT3_SB(sb)->s_es; EXT3_SB(sb)->s_mount_state |= EXT3_ERROR_FS; - es->s_state |= cpu_to_le32(EXT3_ERROR_FS); + es->s_state |= cpu_to_le16(EXT3_ERROR_FS); if (sb->s_flags & MS_RDONLY) return; @@ -377,7 +377,7 @@ "inode %s:%ld at %p: mode %o, nlink %d, next %d\n", inode->i_sb->s_id, inode->i_ino, inode, inode->i_mode, inode->i_nlink, - le32_to_cpu(NEXT_ORPHAN(inode))); + NEXT_ORPHAN(inode)); } } @@ -391,7 +391,7 @@ journal_destroy(sbi->s_journal); if (!(sb->s_flags & MS_RDONLY)) { EXT3_CLEAR_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER); - es->s_state = le16_to_cpu(sbi->s_mount_state); + es->s_state = cpu_to_le16(sbi->s_mount_state); BUFFER_TRACE(sbi->s_sbh, "marking dirty"); mark_buffer_dirty(sbi->s_sbh); ext3_commit_super(sb, es, 1); @@ -964,8 +964,7 @@ es->s_state = cpu_to_le16(le16_to_cpu(es->s_state) & ~EXT3_VALID_FS); #endif if (!(__s16) le16_to_cpu(es->s_max_mnt_count)) - es->s_max_mnt_count = - (__s16) cpu_to_le16(EXT3_DFL_MAX_MNT_COUNT); + es->s_max_mnt_count = cpu_to_le16(EXT3_DFL_MAX_MNT_COUNT); es->s_mnt_count=cpu_to_le16(le16_to_cpu(es->s_mnt_count) + 1); es->s_mtime = cpu_to_le32(get_seconds()); ext3_update_dynamic_rev(sb); @@ -1221,6 +1220,7 @@ int db_count; int i; int needs_recovery; + __le32 features; sbi = kmalloc(sizeof(*sbi), GFP_KERNEL); if (!sbi) @@ -1313,17 +1313,18 @@ * previously didn't change the revision level when setting the flags, * so there is a chance incompat flags are set on a rev 0 filesystem. */ - if ((i = EXT3_HAS_INCOMPAT_FEATURE(sb, ~EXT3_FEATURE_INCOMPAT_SUPP))) { + features = EXT3_HAS_INCOMPAT_FEATURE(sb, ~EXT3_FEATURE_INCOMPAT_SUPP); + if (features) { printk(KERN_ERR "EXT3-fs: %s: couldn't mount because of " "unsupported optional features (%x).\n", - sb->s_id, i); + sb->s_id, le32_to_cpu(features)); goto failed_mount; } - if (!(sb->s_flags & MS_RDONLY) && - (i = EXT3_HAS_RO_COMPAT_FEATURE(sb, ~EXT3_FEATURE_RO_COMPAT_SUPP))){ + features = EXT3_HAS_RO_COMPAT_FEATURE(sb, ~EXT3_FEATURE_RO_COMPAT_SUPP); + if (!(sb->s_flags & MS_RDONLY) && features) { printk(KERN_ERR "EXT3-fs: %s: couldn't mount RDWR because of " "unsupported optional features (%x).\n", - sb->s_id, i); + sb->s_id, le32_to_cpu(features)); goto failed_mount; } blocksize = BLOCK_SIZE << le32_to_cpu(es->s_log_block_size); @@ -1360,7 +1361,7 @@ } es = (struct ext3_super_block *)(((char *)bh->b_data) + offset); sbi->s_es = es; - if (es->s_magic != le16_to_cpu(EXT3_SUPER_MAGIC)) { + if (es->s_magic != cpu_to_le16(EXT3_SUPER_MAGIC)) { printk (KERN_ERR "EXT3-fs: Magic mismatch, very weird !\n"); goto failed_mount; @@ -1737,10 +1738,10 @@ printk(KERN_ERR "EXT3-fs: I/O error on journal device\n"); goto out_journal; } - if (ntohl(journal->j_superblock->s_nr_users) != 1) { + if (be32_to_cpu(journal->j_superblock->s_nr_users) != 1) { printk(KERN_ERR "EXT3-fs: External journal has more than one " "user (unsupported) - %d\n", - ntohl(journal->j_superblock->s_nr_users)); + be32_to_cpu(journal->j_superblock->s_nr_users)); goto out_journal; } EXT3_SB(sb)->journal_bdev = bdev; @@ -2065,13 +2066,13 @@ ext3_mark_recovery_complete(sb, es); } else { - int ret; + __le32 ret; if ((ret = EXT3_HAS_RO_COMPAT_FEATURE(sb, ~EXT3_FEATURE_RO_COMPAT_SUPP))) { printk(KERN_WARNING "EXT3-fs: %s: couldn't " "remount RDWR because of unsupported " "optional features (%x).\n", - sb->s_id, ret); + sb->s_id, le32_to_cpu(ret)); return -EROFS; } /* diff -Nru a/fs/ext3/xattr.c b/fs/ext3/xattr.c --- a/fs/ext3/xattr.c 2004-09-26 10:25:56 -07:00 +++ b/fs/ext3/xattr.c 2004-09-26 10:25:56 -07:00 @@ -1130,7 +1130,7 @@ } if (entry->e_value_block == 0 && entry->e_value_size != 0) { - __u32 *value = (__u32 *)((char *)header + + __le32 *value = (__le32 *)((char *)header + le16_to_cpu(entry->e_value_offs)); for (n = (le32_to_cpu(entry->e_value_size) + EXT3_XATTR_ROUND) >> EXT3_XATTR_PAD_BITS; n; n--) { diff -Nru a/fs/ext3/xattr.h b/fs/ext3/xattr.h --- a/fs/ext3/xattr.h 2004-09-26 10:25:57 -07:00 +++ b/fs/ext3/xattr.h 2004-09-26 10:25:57 -07:00 @@ -25,20 +25,20 @@ #define EXT3_XATTR_INDEX_SECURITY 6 struct ext3_xattr_header { - __u32 h_magic; /* magic number for identification */ - __u32 h_refcount; /* reference count */ - __u32 h_blocks; /* number of disk blocks used */ - __u32 h_hash; /* hash value of all attributes */ + __le32 h_magic; /* magic number for identification */ + __le32 h_refcount; /* reference count */ + __le32 h_blocks; /* number of disk blocks used */ + __le32 h_hash; /* hash value of all attributes */ __u32 h_reserved[4]; /* zero right now */ }; struct ext3_xattr_entry { __u8 e_name_len; /* length of name */ __u8 e_name_index; /* attribute name index */ - __u16 e_value_offs; /* offset in disk block of value */ - __u32 e_value_block; /* disk block attribute is stored on (n/i) */ - __u32 e_value_size; /* size of attribute value */ - __u32 e_hash; /* hash value of name and value */ + __le16 e_value_offs; /* offset in disk block of value */ + __le32 e_value_block; /* disk block attribute is stored on (n/i) */ + __le32 e_value_size; /* size of attribute value */ + __le32 e_hash; /* hash value of name and value */ char e_name[0]; /* attribute name */ }; diff -Nru a/fs/fat/cache.c b/fs/fat/cache.c --- a/fs/fat/cache.c 2004-09-26 10:25:57 -07:00 +++ b/fs/fat/cache.c 2004-09-26 10:25:57 -07:00 @@ -45,13 +45,13 @@ } if (sbi->fat_bits == 32) { p_first = p_last = NULL; /* GCC needs that stuff */ - next = CF_LE_L(((__u32 *) bh->b_data)[(first & + next = CF_LE_L(((__le32 *) bh->b_data)[(first & (sb->s_blocksize - 1)) >> 2]); /* Fscking Microsoft marketing department. Their "32" is 28. */ next &= 0x0fffffff; } else if (sbi->fat_bits == 16) { p_first = p_last = NULL; /* GCC needs that stuff */ - next = CF_LE_W(((__u16 *) bh->b_data)[(first & + next = CF_LE_W(((__le16 *) bh->b_data)[(first & (sb->s_blocksize - 1)) >> 1]); } else { p_first = &((__u8 *)bh->b_data)[first & (sb->s_blocksize - 1)]; @@ -63,10 +63,10 @@ } if (new_value != -1) { if (sbi->fat_bits == 32) { - ((__u32 *)bh->b_data)[(first & (sb->s_blocksize - 1)) >> 2] + ((__le32 *)bh->b_data)[(first & (sb->s_blocksize - 1)) >> 2] = CT_LE_L(new_value); } else if (sbi->fat_bits == 16) { - ((__u16 *)bh->b_data)[(first & (sb->s_blocksize - 1)) >> 1] + ((__le16 *)bh->b_data)[(first & (sb->s_blocksize - 1)) >> 1] = CT_LE_W(new_value); } else { if (nr & 1) { diff -Nru a/fs/fat/dir.c b/fs/fat/dir.c --- a/fs/fat/dir.c 2004-09-26 10:25:55 -07:00 +++ b/fs/fat/dir.c 2004-09-26 10:25:55 -07:00 @@ -714,7 +714,7 @@ { struct buffer_head *bh; struct msdos_dir_entry *de; - __u16 date, time; + __le16 date, time; bh = fat_extend_dir(dir); if (IS_ERR(bh)) diff -Nru a/fs/fat/inode.c b/fs/fat/inode.c --- a/fs/fat/inode.c 2004-09-26 10:25:56 -07:00 +++ b/fs/fat/inode.c 2004-09-26 10:25:56 -07:00 @@ -857,7 +857,7 @@ brelse(bh); goto out_invalid; } - logical_sector_size = CF_LE_W(get_unaligned((u16 *)&b->sector_size)); + logical_sector_size = CF_LE_W(get_unaligned((__le16 *)&b->sector_size)); if (!logical_sector_size || (logical_sector_size & (logical_sector_size - 1)) || (logical_sector_size < 512) @@ -957,7 +957,7 @@ sbi->dir_per_block_bits = ffs(sbi->dir_per_block) - 1; sbi->dir_start = sbi->fat_start + sbi->fats * sbi->fat_length; - sbi->dir_entries = CF_LE_W(get_unaligned((u16 *)&b->dir_entries)); + sbi->dir_entries = CF_LE_W(get_unaligned((__le16 *)&b->dir_entries)); if (sbi->dir_entries & (sbi->dir_per_block - 1)) { if (!silent) printk(KERN_ERR "FAT: bogus directroy-entries per block" @@ -969,7 +969,7 @@ rootdir_sectors = sbi->dir_entries * sizeof(struct msdos_dir_entry) / sb->s_blocksize; sbi->data_start = sbi->dir_start + rootdir_sectors; - total_sectors = CF_LE_W(get_unaligned((u16 *)&b->sectors)); + total_sectors = CF_LE_W(get_unaligned((__le16 *)&b->sectors)); if (total_sectors == 0) total_sectors = CF_LE_L(b->total_sect); @@ -1227,7 +1227,7 @@ return 0; } -void fat_write_inode(struct inode *inode, int wait) +int fat_write_inode(struct inode *inode, int wait) { struct super_block *sb = inode->i_sb; struct buffer_head *bh; @@ -1237,14 +1237,14 @@ retry: i_pos = MSDOS_I(inode)->i_pos; if (inode->i_ino == MSDOS_ROOT_INO || !i_pos) { - return; + return 0; } lock_kernel(); if (!(bh = sb_bread(sb, i_pos >> MSDOS_SB(sb)->dir_per_block_bits))) { printk(KERN_ERR "FAT: unable to read inode block " "for updating (i_pos %lld)\n", i_pos); unlock_kernel(); - return /* -EIO */; + return -EIO; } spin_lock(&fat_inode_lock); if (i_pos != MSDOS_I(inode)->i_pos) { @@ -1277,6 +1277,7 @@ mark_buffer_dirty(bh); brelse(bh); unlock_kernel(); + return 0; } diff -Nru a/fs/fat/misc.c b/fs/fat/misc.c --- a/fs/fat/misc.c 2004-09-26 10:25:57 -07:00 +++ b/fs/fat/misc.c 2004-09-26 10:25:57 -07:00 @@ -73,9 +73,9 @@ sbi->fsinfo_sector); } else { if (sbi->free_clusters != -1) - fsinfo->free_clusters = CF_LE_L(sbi->free_clusters); + fsinfo->free_clusters = cpu_to_le32(sbi->free_clusters); if (sbi->prev_free != -1) - fsinfo->next_cluster = CF_LE_L(sbi->prev_free); + fsinfo->next_cluster = cpu_to_le32(sbi->prev_free); mark_buffer_dirty(bh); } brelse(bh); @@ -243,8 +243,7 @@ /* Convert linear UNIX date to a MS-DOS time/date pair. */ -void fat_date_unix2dos(int unix_date,unsigned short *time, - unsigned short *date) +void fat_date_unix2dos(int unix_date,__le16 *time, __le16 *date) { int day,year,nl_day,month; diff -Nru a/fs/fs-writeback.c b/fs/fs-writeback.c --- a/fs/fs-writeback.c 2004-09-26 10:25:57 -07:00 +++ b/fs/fs-writeback.c 2004-09-26 10:25:57 -07:00 @@ -133,10 +133,11 @@ EXPORT_SYMBOL(__mark_inode_dirty); -static void write_inode(struct inode *inode, int sync) +static int write_inode(struct inode *inode, int sync) { if (inode->i_sb->s_op->write_inode && !is_bad_inode(inode)) - inode->i_sb->s_op->write_inode(inode, sync); + return inode->i_sb->s_op->write_inode(inode, sync); + return 0; } /* @@ -170,8 +171,11 @@ ret = do_writepages(mapping, wbc); /* Don't write the inode if only I_DIRTY_PAGES was set */ - if (dirty & (I_DIRTY_SYNC | I_DIRTY_DATASYNC)) - write_inode(inode, wait); + if (dirty & (I_DIRTY_SYNC | I_DIRTY_DATASYNC)) { + int err = write_inode(inode, wait); + if (ret == 0) + ret = err; + } if (wait) { int err = filemap_fdatawait(mapping); @@ -399,7 +403,6 @@ struct super_block *sb; might_sleep(); - spin_lock(&inode_lock); spin_lock(&sb_lock); restart: sb = sb_entry(super_blocks.prev); @@ -414,19 +417,21 @@ * be unmounted by the time it is released. */ if (down_read_trylock(&sb->s_umount)) { - if (sb->s_root) + if (sb->s_root) { + spin_lock(&inode_lock); sync_sb_inodes(sb, wbc); + spin_unlock(&inode_lock); + } up_read(&sb->s_umount); } spin_lock(&sb_lock); - if (__put_super(sb)) + if (__put_super_and_need_restart(sb)) goto restart; } if (wbc->nr_to_write <= 0) break; } spin_unlock(&sb_lock); - spin_unlock(&inode_lock); } /* diff -Nru a/fs/hfs/hfs_fs.h b/fs/hfs/hfs_fs.h --- a/fs/hfs/hfs_fs.h 2004-09-26 10:25:57 -07:00 +++ b/fs/hfs/hfs_fs.h 2004-09-26 10:25:57 -07:00 @@ -198,7 +198,7 @@ extern struct inode *hfs_new_inode(struct inode *, struct qstr *, int); extern void hfs_inode_write_fork(struct inode *, struct hfs_extent *, u32 *, u32 *); -extern void hfs_write_inode(struct inode *, int); +extern int hfs_write_inode(struct inode *, int); extern int hfs_inode_setattr(struct dentry *, struct iattr *); extern void hfs_inode_read_fork(struct inode *inode, struct hfs_extent *ext, u32 log_size, u32 phys_size, u32 clump_size); diff -Nru a/fs/hfs/inode.c b/fs/hfs/inode.c --- a/fs/hfs/inode.c 2004-09-26 10:25:57 -07:00 +++ b/fs/hfs/inode.c 2004-09-26 10:25:57 -07:00 @@ -381,7 +381,7 @@ HFS_SB(inode->i_sb)->alloc_blksz); } -void hfs_write_inode(struct inode *inode, int unused) +int hfs_write_inode(struct inode *inode, int unused) { struct hfs_find_data fd; hfs_cat_rec rec; @@ -395,27 +395,27 @@ break; case HFS_EXT_CNID: hfs_btree_write(HFS_SB(inode->i_sb)->ext_tree); - return; + return 0; case HFS_CAT_CNID: hfs_btree_write(HFS_SB(inode->i_sb)->cat_tree); - return; + return 0; default: BUG(); - return; + return -EIO; } } if (HFS_IS_RSRC(inode)) { mark_inode_dirty(HFS_I(inode)->rsrc_inode); - return; + return 0; } if (!inode->i_nlink) - return; + return 0; if (hfs_find_init(HFS_SB(inode->i_sb)->cat_tree, &fd)) /* panic? */ - return; + return -EIO; fd.search_key->cat = HFS_I(inode)->cat_key; if (hfs_brec_find(&fd)) @@ -460,6 +460,7 @@ } out: hfs_find_exit(&fd); + return 0; } static struct dentry *hfs_file_lookup(struct inode *dir, struct dentry *dentry, diff -Nru a/fs/hfsplus/hfsplus_fs.h b/fs/hfsplus/hfsplus_fs.h --- a/fs/hfsplus/hfsplus_fs.h 2004-09-26 10:25:57 -07:00 +++ b/fs/hfsplus/hfsplus_fs.h 2004-09-26 10:25:57 -07:00 @@ -333,7 +333,7 @@ void hfsplus_inode_read_fork(struct inode *, struct hfsplus_fork_raw *); void hfsplus_inode_write_fork(struct inode *, struct hfsplus_fork_raw *); int hfsplus_cat_read_inode(struct inode *, struct hfs_find_data *); -void hfsplus_cat_write_inode(struct inode *); +int hfsplus_cat_write_inode(struct inode *); struct inode *hfsplus_new_inode(struct super_block *, int); void hfsplus_delete_inode(struct inode *); diff -Nru a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c --- a/fs/hfsplus/inode.c 2004-09-26 10:25:55 -07:00 +++ b/fs/hfsplus/inode.c 2004-09-26 10:25:55 -07:00 @@ -484,22 +484,22 @@ return res; } -void hfsplus_cat_write_inode(struct inode *inode) +int hfsplus_cat_write_inode(struct inode *inode) { struct hfs_find_data fd; hfsplus_cat_entry entry; if (HFSPLUS_IS_RSRC(inode)) { mark_inode_dirty(HFSPLUS_I(inode).rsrc_inode); - return; + return 0; } if (!inode->i_nlink) - return; + return 0; if (hfs_find_init(HFSPLUS_SB(inode->i_sb).cat_tree, &fd)) /* panic? */ - return; + return -EIO; if (hfsplus_find_cat(inode->i_sb, inode->i_ino, &fd)) /* panic? */ @@ -547,4 +547,5 @@ } out: hfs_find_exit(&fd); + return 0; } diff -Nru a/fs/hfsplus/super.c b/fs/hfsplus/super.c --- a/fs/hfsplus/super.c 2004-09-26 10:25:55 -07:00 +++ b/fs/hfsplus/super.c 2004-09-26 10:25:55 -07:00 @@ -94,20 +94,20 @@ make_bad_inode(inode); } -void hfsplus_write_inode(struct inode *inode, int unused) +int hfsplus_write_inode(struct inode *inode, int unused) { struct hfsplus_vh *vhdr; + int ret = 0; dprint(DBG_INODE, "hfsplus_write_inode: %lu\n", inode->i_ino); hfsplus_ext_write_extent(inode); if (inode->i_ino >= HFSPLUS_FIRSTUSER_CNID) { - hfsplus_cat_write_inode(inode); - return; + return hfsplus_cat_write_inode(inode); } vhdr = HFSPLUS_SB(inode->i_sb).s_vhdr; switch (inode->i_ino) { case HFSPLUS_ROOT_CNID: - hfsplus_cat_write_inode(inode); + ret = hfsplus_cat_write_inode(inode); break; case HFSPLUS_EXT_CNID: if (vhdr->ext_file.total_size != cpu_to_be64(inode->i_size)) { @@ -148,6 +148,7 @@ hfs_btree_write(HFSPLUS_SB(inode->i_sb).attr_tree); break; } + return ret; } static void hfsplus_clear_inode(struct inode *inode) diff -Nru a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c --- a/fs/hugetlbfs/inode.c 2004-09-26 10:25:57 -07:00 +++ b/fs/hugetlbfs/inode.c 2004-09-26 10:25:57 -07:00 @@ -800,8 +800,7 @@ hugetlbfs_inode_cachep = kmem_cache_create("hugetlbfs_inode_cache", sizeof(struct hugetlbfs_inode_info), - 0, SLAB_RECLAIM_ACCOUNT, - init_once, NULL); + 0, 0, init_once, NULL); if (hugetlbfs_inode_cachep == NULL) return -ENOMEM; diff -Nru a/fs/isofs/rock.c b/fs/isofs/rock.c --- a/fs/isofs/rock.c 2004-09-26 10:25:56 -07:00 +++ b/fs/isofs/rock.c 2004-09-26 10:25:56 -07:00 @@ -62,7 +62,7 @@ } #define MAYBE_CONTINUE(LABEL,DEV) \ - {if (buffer) kfree(buffer); \ + {if (buffer) { kfree(buffer); buffer = NULL; } \ if (cont_extent){ \ int block, offset, offset1; \ struct buffer_head * pbh; \ diff -Nru a/fs/jbd/commit.c b/fs/jbd/commit.c --- a/fs/jbd/commit.c 2004-09-26 10:25:57 -07:00 +++ b/fs/jbd/commit.c 2004-09-26 10:25:57 -07:00 @@ -405,9 +405,9 @@ jbd_debug(4, "JBD: got buffer %llu (%p)\n", (unsigned long long)bh->b_blocknr, bh->b_data); header = (journal_header_t *)&bh->b_data[0]; - header->h_magic = htonl(JFS_MAGIC_NUMBER); - header->h_blocktype = htonl(JFS_DESCRIPTOR_BLOCK); - header->h_sequence = htonl(commit_transaction->t_tid); + header->h_magic = cpu_to_be32(JFS_MAGIC_NUMBER); + header->h_blocktype = cpu_to_be32(JFS_DESCRIPTOR_BLOCK); + header->h_sequence = cpu_to_be32(commit_transaction->t_tid); tagp = &bh->b_data[sizeof(journal_header_t)]; space_left = bh->b_size - sizeof(journal_header_t); @@ -473,8 +473,8 @@ tag_flag |= JFS_FLAG_SAME_UUID; tag = (journal_block_tag_t *) tagp; - tag->t_blocknr = htonl(jh2bh(jh)->b_blocknr); - tag->t_flags = htonl(tag_flag); + tag->t_blocknr = cpu_to_be32(jh2bh(jh)->b_blocknr); + tag->t_flags = cpu_to_be32(tag_flag); tagp += sizeof(journal_block_tag_t); space_left -= sizeof(journal_block_tag_t); @@ -498,7 +498,7 @@ submitting the IOs. "tag" still points to the last tag we set up. */ - tag->t_flags |= htonl(JFS_FLAG_LAST_TAG); + tag->t_flags |= cpu_to_be32(JFS_FLAG_LAST_TAG); start_journal_io: for (i = 0; i < bufs; i++) { @@ -631,9 +631,9 @@ for (i = 0; i < jh2bh(descriptor)->b_size; i += 512) { journal_header_t *tmp = (journal_header_t*)jh2bh(descriptor)->b_data; - tmp->h_magic = htonl(JFS_MAGIC_NUMBER); - tmp->h_blocktype = htonl(JFS_COMMIT_BLOCK); - tmp->h_sequence = htonl(commit_transaction->t_tid); + tmp->h_magic = cpu_to_be32(JFS_MAGIC_NUMBER); + tmp->h_blocktype = cpu_to_be32(JFS_COMMIT_BLOCK); + tmp->h_sequence = cpu_to_be32(commit_transaction->t_tid); } JBUFFER_TRACE(descriptor, "write commit block"); diff -Nru a/fs/jbd/journal.c b/fs/jbd/journal.c --- a/fs/jbd/journal.c 2004-09-26 10:25:55 -07:00 +++ b/fs/jbd/journal.c 2004-09-26 10:25:55 -07:00 @@ -326,8 +326,8 @@ /* * Check for escaping */ - if (*((unsigned int *)(mapped_data + new_offset)) == - htonl(JFS_MAGIC_NUMBER)) { + if (*((__be32 *)(mapped_data + new_offset)) == + cpu_to_be32(JFS_MAGIC_NUMBER)) { need_copy_out = 1; do_escape = 1; } @@ -809,8 +809,8 @@ journal_superblock_t *sb = journal->j_superblock; unsigned int first, last; - first = ntohl(sb->s_first); - last = ntohl(sb->s_maxlen); + first = be32_to_cpu(sb->s_first); + last = be32_to_cpu(sb->s_maxlen); journal->j_first = first; journal->j_last = last; @@ -887,12 +887,12 @@ /* OK, fill in the initial static fields in the new superblock */ sb = journal->j_superblock; - sb->s_header.h_magic = htonl(JFS_MAGIC_NUMBER); - sb->s_header.h_blocktype = htonl(JFS_SUPERBLOCK_V2); + sb->s_header.h_magic = cpu_to_be32(JFS_MAGIC_NUMBER); + sb->s_header.h_blocktype = cpu_to_be32(JFS_SUPERBLOCK_V2); - sb->s_blocksize = htonl(journal->j_blocksize); - sb->s_maxlen = htonl(journal->j_maxlen); - sb->s_first = htonl(1); + sb->s_blocksize = cpu_to_be32(journal->j_blocksize); + sb->s_maxlen = cpu_to_be32(journal->j_maxlen); + sb->s_first = cpu_to_be32(1); journal->j_transaction_sequence = 1; @@ -935,9 +935,9 @@ jbd_debug(1,"JBD: updating superblock (start %ld, seq %d, errno %d)\n", journal->j_tail, journal->j_tail_sequence, journal->j_errno); - sb->s_sequence = htonl(journal->j_tail_sequence); - sb->s_start = htonl(journal->j_tail); - sb->s_errno = htonl(journal->j_errno); + sb->s_sequence = cpu_to_be32(journal->j_tail_sequence); + sb->s_start = cpu_to_be32(journal->j_tail); + sb->s_errno = cpu_to_be32(journal->j_errno); spin_unlock(&journal->j_state_lock); BUFFER_TRACE(bh, "marking dirty"); @@ -988,13 +988,13 @@ err = -EINVAL; - if (sb->s_header.h_magic != htonl(JFS_MAGIC_NUMBER) || - sb->s_blocksize != htonl(journal->j_blocksize)) { + if (sb->s_header.h_magic != cpu_to_be32(JFS_MAGIC_NUMBER) || + sb->s_blocksize != cpu_to_be32(journal->j_blocksize)) { printk(KERN_WARNING "JBD: no valid journal superblock found\n"); goto out; } - switch(ntohl(sb->s_header.h_blocktype)) { + switch(be32_to_cpu(sb->s_header.h_blocktype)) { case JFS_SUPERBLOCK_V1: journal->j_format_version = 1; break; @@ -1006,9 +1006,9 @@ goto out; } - if (ntohl(sb->s_maxlen) < journal->j_maxlen) - journal->j_maxlen = ntohl(sb->s_maxlen); - else if (ntohl(sb->s_maxlen) > journal->j_maxlen) { + if (be32_to_cpu(sb->s_maxlen) < journal->j_maxlen) + journal->j_maxlen = be32_to_cpu(sb->s_maxlen); + else if (be32_to_cpu(sb->s_maxlen) > journal->j_maxlen) { printk (KERN_WARNING "JBD: journal file too short\n"); goto out; } @@ -1036,11 +1036,11 @@ sb = journal->j_superblock; - journal->j_tail_sequence = ntohl(sb->s_sequence); - journal->j_tail = ntohl(sb->s_start); - journal->j_first = ntohl(sb->s_first); - journal->j_last = ntohl(sb->s_maxlen); - journal->j_errno = ntohl(sb->s_errno); + journal->j_tail_sequence = be32_to_cpu(sb->s_sequence); + journal->j_tail = be32_to_cpu(sb->s_start); + journal->j_first = be32_to_cpu(sb->s_first); + journal->j_last = be32_to_cpu(sb->s_maxlen); + journal->j_errno = be32_to_cpu(sb->s_errno); return 0; } @@ -1253,7 +1253,7 @@ sb = journal->j_superblock; - switch (ntohl(sb->s_header.h_blocktype)) { + switch (be32_to_cpu(sb->s_header.h_blocktype)) { case JFS_SUPERBLOCK_V2: return 0; case JFS_SUPERBLOCK_V1: @@ -1275,7 +1275,7 @@ /* Pre-initialise new fields to zero */ offset = ((char *) &(sb->s_feature_compat)) - ((char *) sb); - blocksize = ntohl(sb->s_blocksize); + blocksize = be32_to_cpu(sb->s_blocksize); memset(&sb->s_feature_compat, 0, blocksize-offset); sb->s_nr_users = cpu_to_be32(1); diff -Nru a/fs/jbd/recovery.c b/fs/jbd/recovery.c --- a/fs/jbd/recovery.c 2004-09-26 10:25:57 -07:00 +++ b/fs/jbd/recovery.c 2004-09-26 10:25:57 -07:00 @@ -191,10 +191,10 @@ nr++; tagp += sizeof(journal_block_tag_t); - if (!(tag->t_flags & htonl(JFS_FLAG_SAME_UUID))) + if (!(tag->t_flags & cpu_to_be32(JFS_FLAG_SAME_UUID))) tagp += 16; - if (tag->t_flags & htonl(JFS_FLAG_LAST_TAG)) + if (tag->t_flags & cpu_to_be32(JFS_FLAG_LAST_TAG)) break; } @@ -239,8 +239,8 @@ if (!sb->s_start) { jbd_debug(1, "No recovery required, last transaction %d\n", - ntohl(sb->s_sequence)); - journal->j_transaction_sequence = ntohl(sb->s_sequence) + 1; + be32_to_cpu(sb->s_sequence)); + journal->j_transaction_sequence = be32_to_cpu(sb->s_sequence) + 1; return 0; } @@ -295,7 +295,7 @@ ++journal->j_transaction_sequence; } else { #ifdef CONFIG_JBD_DEBUG - int dropped = info.end_transaction - ntohl(sb->s_sequence); + int dropped = info.end_transaction - be32_to_cpu(sb->s_sequence); #endif jbd_debug(0, "JBD: ignoring %d transaction%s from the journal.\n", @@ -331,8 +331,8 @@ */ sb = journal->j_superblock; - next_commit_ID = ntohl(sb->s_sequence); - next_log_block = ntohl(sb->s_start); + next_commit_ID = be32_to_cpu(sb->s_sequence); + next_log_block = be32_to_cpu(sb->s_start); first_commit_ID = next_commit_ID; if (pass == PASS_SCAN) @@ -385,13 +385,13 @@ tmp = (journal_header_t *)bh->b_data; - if (tmp->h_magic != htonl(JFS_MAGIC_NUMBER)) { + if (tmp->h_magic != cpu_to_be32(JFS_MAGIC_NUMBER)) { brelse(bh); break; } - blocktype = ntohl(tmp->h_blocktype); - sequence = ntohl(tmp->h_sequence); + blocktype = be32_to_cpu(tmp->h_blocktype); + sequence = be32_to_cpu(tmp->h_sequence); jbd_debug(3, "Found magic %d, sequence %d\n", blocktype, sequence); @@ -427,7 +427,7 @@ unsigned long io_block; tag = (journal_block_tag_t *) tagp; - flags = ntohl(tag->t_flags); + flags = be32_to_cpu(tag->t_flags); io_block = next_log_block++; wrap(journal, next_log_block); @@ -444,7 +444,7 @@ unsigned long blocknr; J_ASSERT(obh != NULL); - blocknr = ntohl(tag->t_blocknr); + blocknr = be32_to_cpu(tag->t_blocknr); /* If the block has been * revoked, then we're all done @@ -476,8 +476,8 @@ memcpy(nbh->b_data, obh->b_data, journal->j_blocksize); if (flags & JFS_FLAG_ESCAPE) { - *((unsigned int *)bh->b_data) = - htonl(JFS_MAGIC_NUMBER); + *((__be32 *)bh->b_data) = + cpu_to_be32(JFS_MAGIC_NUMBER); } BUFFER_TRACE(nbh, "marking dirty"); @@ -572,13 +572,13 @@ header = (journal_revoke_header_t *) bh->b_data; offset = sizeof(journal_revoke_header_t); - max = ntohl(header->r_count); + max = be32_to_cpu(header->r_count); while (offset < max) { unsigned long blocknr; int err; - blocknr = ntohl(* ((unsigned int *) (bh->b_data+offset))); + blocknr = be32_to_cpu(* ((__be32 *) (bh->b_data+offset))); offset += 4; err = journal_set_revoke(journal, blocknr, sequence); if (err) diff -Nru a/fs/jbd/revoke.c b/fs/jbd/revoke.c --- a/fs/jbd/revoke.c 2004-09-26 10:25:55 -07:00 +++ b/fs/jbd/revoke.c 2004-09-26 10:25:55 -07:00 @@ -566,9 +566,9 @@ if (!descriptor) return; header = (journal_header_t *) &jh2bh(descriptor)->b_data[0]; - header->h_magic = htonl(JFS_MAGIC_NUMBER); - header->h_blocktype = htonl(JFS_REVOKE_BLOCK); - header->h_sequence = htonl(transaction->t_tid); + header->h_magic = cpu_to_be32(JFS_MAGIC_NUMBER); + header->h_blocktype = cpu_to_be32(JFS_REVOKE_BLOCK); + header->h_sequence = cpu_to_be32(transaction->t_tid); /* Record it so that we can wait for IO completion later */ JBUFFER_TRACE(descriptor, "file as BJ_LogCtl"); @@ -578,8 +578,8 @@ *descriptorp = descriptor; } - * ((unsigned int *)(&jh2bh(descriptor)->b_data[offset])) = - htonl(record->blocknr); + * ((__be32 *)(&jh2bh(descriptor)->b_data[offset])) = + cpu_to_be32(record->blocknr); offset += 4; *offsetp = offset; } @@ -604,7 +604,7 @@ } header = (journal_revoke_header_t *) jh2bh(descriptor)->b_data; - header->r_count = htonl(offset); + header->r_count = cpu_to_be32(offset); set_buffer_jwrite(bh); BUFFER_TRACE(bh, "write"); set_buffer_dirty(bh); diff -Nru a/fs/jfs/inode.c b/fs/jfs/inode.c --- a/fs/jfs/inode.c 2004-09-26 10:25:55 -07:00 +++ b/fs/jfs/inode.c 2004-09-26 10:25:55 -07:00 @@ -106,10 +106,10 @@ return rc; } -void jfs_write_inode(struct inode *inode, int wait) +int jfs_write_inode(struct inode *inode, int wait) { if (test_cflag(COMMIT_Nolink, inode)) - return; + return 0; /* * If COMMIT_DIRTY is not set, the inode isn't really dirty. * It has been committed since the last change, but was still @@ -118,12 +118,14 @@ if (!test_cflag(COMMIT_Dirty, inode)) { /* Make sure committed changes hit the disk */ jfs_flush_journal(JFS_SBI(inode->i_sb)->log, wait); - return; + return 0; } if (jfs_commit_inode(inode, wait)) { jfs_err("jfs_write_inode: jfs_commit_inode failed!"); - } + return -EIO; + } else + return 0; } void jfs_delete_inode(struct inode *inode) diff -Nru a/fs/jfs/super.c b/fs/jfs/super.c --- a/fs/jfs/super.c 2004-09-26 10:25:56 -07:00 +++ b/fs/jfs/super.c 2004-09-26 10:25:56 -07:00 @@ -77,7 +77,7 @@ extern void jfs_read_inode(struct inode *inode); extern void jfs_dirty_inode(struct inode *inode); extern void jfs_delete_inode(struct inode *inode); -extern void jfs_write_inode(struct inode *inode, int wait); +extern int jfs_write_inode(struct inode *inode, int wait); extern struct dentry *jfs_get_parent(struct dentry *dentry); extern int jfs_extendfs(struct super_block *, s64, int); diff -Nru a/fs/locks.c b/fs/locks.c --- a/fs/locks.c 2004-09-26 10:25:57 -07:00 +++ b/fs/locks.c 2004-09-26 10:25:57 -07:00 @@ -463,7 +463,8 @@ } list_add_tail(&waiter->fl_block, &blocker->fl_block); waiter->fl_next = blocker; - list_add(&waiter->fl_link, &blocked_list); + if (IS_POSIX(blocker)) + list_add(&waiter->fl_link, &blocked_list); } /* Wake up processes blocked waiting for blocker. diff -Nru a/fs/minix/inode.c b/fs/minix/inode.c --- a/fs/minix/inode.c 2004-09-26 10:25:56 -07:00 +++ b/fs/minix/inode.c 2004-09-26 10:25:56 -07:00 @@ -18,7 +18,7 @@ #include static void minix_read_inode(struct inode * inode); -static void minix_write_inode(struct inode * inode, int wait); +static int minix_write_inode(struct inode * inode, int wait); static int minix_statfs(struct super_block *sb, struct kstatfs *buf); static int minix_remount (struct super_block * sb, int * flags, char * data); @@ -505,9 +505,10 @@ return V2_minix_update_inode(inode); } -static void minix_write_inode(struct inode * inode, int wait) +static int minix_write_inode(struct inode * inode, int wait) { brelse(minix_update_inode(inode)); + return 0; } int minix_sync_inode(struct inode * inode) diff -Nru a/fs/nfs/inode.c b/fs/nfs/inode.c --- a/fs/nfs/inode.c 2004-09-26 10:25:57 -07:00 +++ b/fs/nfs/inode.c 2004-09-26 10:25:57 -07:00 @@ -57,7 +57,7 @@ static struct inode *nfs_alloc_inode(struct super_block *sb); static void nfs_destroy_inode(struct inode *); -static void nfs_write_inode(struct inode *,int); +static int nfs_write_inode(struct inode *,int); static void nfs_delete_inode(struct inode *); static void nfs_clear_inode(struct inode *); static void nfs_umount_begin(struct super_block *); @@ -110,12 +110,16 @@ return nfs_fileid_to_ino_t(fattr->fileid); } -static void +static int nfs_write_inode(struct inode *inode, int sync) { int flags = sync ? FLUSH_WAIT : 0; + int ret; - nfs_commit_inode(inode, 0, 0, flags); + ret = nfs_commit_inode(inode, 0, 0, flags); + if (ret < 0) + return ret; + return 0; } static void diff -Nru a/fs/ntfs/ChangeLog b/fs/ntfs/ChangeLog --- a/fs/ntfs/ChangeLog 2004-09-26 10:25:55 -07:00 +++ b/fs/ntfs/ChangeLog 2004-09-26 10:25:55 -07:00 @@ -21,6 +21,75 @@ - Enable the code for setting the NT4 compatibility flag when we start making NTFS 1.2 specific modifications. +2.1.19 - Many cleanups, improvements, and a minor bug fix. + + - Update ->setattr (fs/ntfs/inode.c::ntfs_setattr()) to refuse to + change the uid, gid, and mode of an inode as we do not support NTFS + ACLs yet. + - Remove BKL use from ntfs_setattr() syncing up with the rest of the + kernel. + - Get rid of the ugly transparent union in fs/ntfs/dir.c::ntfs_readdir() + and ntfs_filldir() as per suggestion from Al Viro. + - Change '\0' and L'\0' to simply 0 as per advice from Linus Torvalds. + - Update ->truncate (fs/ntfs/inode.c::ntfs_truncate()) to check if the + inode size has changed and to only output an error if so. + - Rename fs/ntfs/attrib.h::attribute_value_length() to ntfs_attr_size(). + - Add le{16,32,64} as well as sle{16,32,64} data types to + fs/ntfs/types.h. + - Change ntfschar to be le16 instead of u16 in fs/ntfs/types.h. + - Add le versions of VCN, LCN, and LSN called leVCN, leLCN, and leLSN, + respectively, to fs/ntfs/types.h. + - Update endianness conversion macros in fs/ntfs/endian.h to use the + new types as appropriate. + - Do proper type casting when using sle64_to_cpup() in fs/ntfs/dir.c + and index.c. + - Add leMFT_REF data type to fs/ntfs/layout.h. + - Update all NTFS header files with the new little endian data types. + Affected files are fs/ntfs/layout.h, logfile.h, and time.h. + - Do proper type casting when using ntfs_is_*_recordp() in + fs/ntfs/logfile.c, mft.c, and super.c. + - Fix all the sparse bitwise warnings. Had to change all the enums + storing little endian values to #defines because we cannot set enums + to be little endian so we had lots of bitwise warnings from sparse. + - Fix a bug found by the new sparse bitwise warnings where the default + upcase table was defined as a pointer to wchar_t rather than ntfschar + in fs/ntfs/ntfs.h and super.c. + +2.1.18 - Fix scheduling latencies at mount time as well as an endianness bug. + + - Remove vol->nr_mft_records as it was pretty meaningless and optimize + the calculation of total/free inodes as used by statfs(). + - Fix scheduling latencies in ntfs_fill_super() by dropping the BKL + because the code itself is using the ntfs_lock semaphore which + provides safe locking. (Ingo Molnar) + - Fix a potential bug in fs/ntfs/mft.c::map_extent_mft_record() that + could occur in the future for when we start closing/freeing extent + inodes if we don't set base_ni->ext.extent_ntfs_inos to NULL after + we free it. + - Rename {find,lookup}_attr() to ntfs_attr_{find,lookup}() as well as + find_external_attr() to ntfs_external_attr_find() to cleanup the + namespace a bit and to be more consistent with libntfs. + - Rename {{re,}init,get,put}_attr_search_ctx() to + ntfs_attr_{{re,}init,get,put}_search_ctx() as well as the type + attr_search_context to ntfs_attr_search_ctx. + - Force use of ntfs_attr_find() in ntfs_attr_lookup() when searching + for the attribute list attribute itself. + - Fix endianness bug in ntfs_external_attr_find(). + - Change ntfs_{external_,}attr_find() to return 0 on success, -ENOENT + if the attribute is not found, and -EIO on real error. In the case + of -ENOENT, the search context is updated to describe the attribute + before which the attribute being searched for would need to be + inserted if such an action were to be desired and in the case of + ntfs_external_attr_find() the search context is also updated to + indicate the attribute list entry before which the attribute list + entry of the attribute being searched for would need to be inserted + if such an action were to be desired. Also make ntfs_find_attr() + static and remove its prototype from attrib.h as it is not used + anywhere other than attrib.c. Update ntfs_attr_lookup() and all + callers of ntfs_{external,}attr_{find,lookup}() for the new return + values. + - Minor cleanup of fs/ntfs/inode.c::ntfs_init_locked_inode(). + 2.1.17 - Fix bugs in mount time error code paths and other updates. - Implement bitmap modification code (fs/ntfs/bitmap.[hc]). This diff -Nru a/fs/ntfs/Makefile b/fs/ntfs/Makefile --- a/fs/ntfs/Makefile 2004-09-26 10:25:56 -07:00 +++ b/fs/ntfs/Makefile 2004-09-26 10:25:56 -07:00 @@ -6,7 +6,7 @@ index.o inode.o mft.o mst.o namei.o super.o sysctl.o unistr.o \ upcase.o -EXTRA_CFLAGS = -DNTFS_VERSION=\"2.1.17\" +EXTRA_CFLAGS = -DNTFS_VERSION=\"2.1.19\" ifeq ($(CONFIG_NTFS_DEBUG),y) EXTRA_CFLAGS += -DDEBUG diff -Nru a/fs/ntfs/aops.c b/fs/ntfs/aops.c --- a/fs/ntfs/aops.c 2004-09-26 10:25:57 -07:00 +++ b/fs/ntfs/aops.c 2004-09-26 10:25:57 -07:00 @@ -348,7 +348,7 @@ s64 attr_pos; ntfs_inode *ni, *base_ni; u8 *kaddr; - attr_search_context *ctx; + ntfs_attr_search_ctx *ctx; MFT_RECORD *mrec; u32 attr_len; int err = 0; @@ -397,16 +397,15 @@ err = PTR_ERR(mrec); goto err_out; } - ctx = get_attr_search_ctx(base_ni, mrec); + ctx = ntfs_attr_get_search_ctx(base_ni, mrec); if (unlikely(!ctx)) { err = -ENOMEM; goto unm_err_out; } - if (unlikely(!lookup_attr(ni->type, ni->name, ni->name_len, - CASE_SENSITIVE, 0, NULL, 0, ctx))) { - err = -ENOENT; + err = ntfs_attr_lookup(ni->type, ni->name, ni->name_len, + CASE_SENSITIVE, 0, NULL, 0, ctx); + if (unlikely(err)) goto put_unm_err_out; - } /* Starting position of the page within the attribute value. */ attr_pos = page->index << PAGE_CACHE_SHIFT; @@ -433,7 +432,7 @@ SetPageUptodate(page); put_unm_err_out: - put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); unm_err_out: unmap_mft_record(base_ni); err_out: @@ -1030,7 +1029,7 @@ struct inode *vi; ntfs_inode *ni, *base_ni; char *kaddr; - attr_search_context *ctx; + ntfs_attr_search_ctx *ctx; MFT_RECORD *m; u32 attr_len, bytes; int err; @@ -1117,16 +1116,15 @@ ctx = NULL; goto err_out; } - ctx = get_attr_search_ctx(base_ni, m); + ctx = ntfs_attr_get_search_ctx(base_ni, m); if (unlikely(!ctx)) { err = -ENOMEM; goto err_out; } - if (unlikely(!lookup_attr(ni->type, ni->name, ni->name_len, - CASE_SENSITIVE, 0, NULL, 0, ctx))) { - err = -ENOENT; + err = ntfs_attr_lookup(ni->type, ni->name, ni->name_len, + CASE_SENSITIVE, 0, NULL, 0, ctx); + if (unlikely(err)) goto err_out; - } /* Starting position of the page within the attribute value. */ attr_pos = page->index << PAGE_CACHE_SHIFT; @@ -1201,7 +1199,7 @@ /* Mark the mft record dirty, so it gets written back. */ mark_mft_record_dirty(ctx->ntfs_ino); - put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); unmap_mft_record(base_ni); return 0; err_out: @@ -1221,7 +1219,7 @@ } unlock_page(page); if (ctx) - put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); if (m) unmap_mft_record(base_ni); return err; @@ -1683,9 +1681,9 @@ * We thus defer the uptodate bringing of the page region outside the * region written to to ntfs_commit_write(). The reason for doing this * is that we save one round of: - * map_mft_record(), get_attr_search_ctx(), lookup_attr(), - * kmap_atomic(), kunmap_atomic(), put_attr_search_ctx(), - * unmap_mft_record(). + * map_mft_record(), ntfs_attr_get_search_ctx(), + * ntfs_attr_lookup(), kmap_atomic(), kunmap_atomic(), + * ntfs_attr_put_search_ctx(), unmap_mft_record(). * Which is obviously a very worthwhile save. * * Thus we just return success now... @@ -1804,7 +1802,7 @@ struct inode *vi; ntfs_inode *ni, *base_ni; char *kaddr, *kattr; - attr_search_context *ctx; + ntfs_attr_search_ctx *ctx; MFT_RECORD *m; u32 attr_len, bytes; int err; @@ -1891,16 +1889,15 @@ ctx = NULL; goto err_out; } - ctx = get_attr_search_ctx(base_ni, m); + ctx = ntfs_attr_get_search_ctx(base_ni, m); if (unlikely(!ctx)) { err = -ENOMEM; goto err_out; } - if (unlikely(!lookup_attr(ni->type, ni->name, ni->name_len, - CASE_SENSITIVE, 0, NULL, 0, ctx))) { - err = -ENOENT; + err = ntfs_attr_lookup(ni->type, ni->name, ni->name_len, + CASE_SENSITIVE, 0, NULL, 0, ctx); + if (unlikely(err)) goto err_out; - } /* Starting position of the page within the attribute value. */ attr_pos = page->index << PAGE_CACHE_SHIFT; @@ -1966,7 +1963,7 @@ /* Mark the mft record dirty, so it gets written back. */ mark_mft_record_dirty(ctx->ntfs_ino); - put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); unmap_mft_record(base_ni); ntfs_debug("Done."); return 0; @@ -1993,7 +1990,7 @@ SetPageError(page); } if (ctx) - put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); if (m) unmap_mft_record(base_ni); return err; diff -Nru a/fs/ntfs/attrib.c b/fs/ntfs/attrib.c --- a/fs/ntfs/attrib.c 2004-09-26 10:25:57 -07:00 +++ b/fs/ntfs/attrib.c 2004-09-26 10:25:57 -07:00 @@ -946,7 +946,7 @@ int ntfs_map_runlist(ntfs_inode *ni, VCN vcn) { ntfs_inode *base_ni; - attr_search_context *ctx; + ntfs_attr_search_ctx *ctx; MFT_RECORD *mrec; int err = 0; @@ -961,17 +961,15 @@ mrec = map_mft_record(base_ni); if (IS_ERR(mrec)) return PTR_ERR(mrec); - ctx = get_attr_search_ctx(base_ni, mrec); - if (!ctx) { + ctx = ntfs_attr_get_search_ctx(base_ni, mrec); + if (unlikely(!ctx)) { err = -ENOMEM; goto err_out; } - if (!lookup_attr(ni->type, ni->name, ni->name_len, CASE_SENSITIVE, vcn, - NULL, 0, ctx)) { - put_attr_search_ctx(ctx); - err = -ENOENT; - goto err_out; - } + err = ntfs_attr_lookup(ni->type, ni->name, ni->name_len, + CASE_SENSITIVE, vcn, NULL, 0, ctx); + if (unlikely(err)) + goto put_err_out; down_write(&ni->runlist.lock); /* Make sure someone else didn't do the work while we were sleeping. */ @@ -987,7 +985,8 @@ } up_write(&ni->runlist.lock); - put_attr_search_ctx(ctx); +put_err_out: + ntfs_attr_put_search_ctx(ctx); err_out: unmap_mft_record(base_ni); return err; @@ -1148,7 +1147,7 @@ } /** - * find_attr - find (next) attribute in mft record + * ntfs_attr_find - find (next) attribute in mft record * @type: attribute type to find * @name: attribute name to find (optional, i.e. NULL means don't care) * @name_len: attribute name length (only needed if @name present) @@ -1157,47 +1156,56 @@ * @val_len: attribute value length * @ctx: search context with mft record and attribute to search from * - * You shouldn't need to call this function directly. Use lookup_attr() instead. + * You should not need to call this function directly. Use ntfs_attr_lookup() + * instead. + * + * ntfs_attr_find() takes a search context @ctx as parameter and searches the + * mft record specified by @ctx->mrec, beginning at @ctx->attr, for an + * attribute of @type, optionally @name and @val. + * + * If the attribute is found, ntfs_attr_find() returns 0 and @ctx->attr will + * point to the found attribute. + * + * If the attribute is not found, ntfs_attr_find() returns -ENOENT and + * @ctx->attr will point to the attribute before which the attribute being + * searched for would need to be inserted if such an action were to be desired. * - * find_attr() takes a search context @ctx as parameter and searches the mft - * record specified by @ctx->mrec, beginning at @ctx->attr, for an attribute of - * @type, optionally @name and @val. If found, find_attr() returns TRUE and - * @ctx->attr will point to the found attribute. If not found, find_attr() - * returns FALSE and @ctx->attr is undefined (i.e. do not rely on it not - * changing). + * On actual error, ntfs_attr_find() returns -EIO. In this case @ctx->attr is + * undefined and in particular do not rely on it not changing. * - * If @ctx->is_first is TRUE, the search begins with @ctx->attr itself. If it + * If @ctx->is_first is TRUE, the search begins with @ctx->attr itself. If it * is FALSE, the search begins after @ctx->attr. * * If @ic is IGNORE_CASE, the @name comparisson is not case sensitive and * @ctx->ntfs_ino must be set to the ntfs inode to which the mft record - * @ctx->mrec belongs. This is so we can get at the ntfs volume and hence at - * the upcase table. If @ic is CASE_SENSITIVE, the comparison is case - * sensitive. When @name is present, @name_len is the @name length in Unicode + * @ctx->mrec belongs. This is so we can get at the ntfs volume and hence at + * the upcase table. If @ic is CASE_SENSITIVE, the comparison is case + * sensitive. When @name is present, @name_len is the @name length in Unicode * characters. * * If @name is not present (NULL), we assume that the unnamed attribute is * being searched for. * - * Finally, the resident attribute value @val is looked for, if present. If @val - * is not present (NULL), @val_len is ignored. + * Finally, the resident attribute value @val is looked for, if present. If + * @val is not present (NULL), @val_len is ignored. * - * find_attr() only searches the specified mft record and it ignores the + * ntfs_attr_find() only searches the specified mft record and it ignores the * presence of an attribute list attribute (unless it is the one being searched - * for, obviously). If you need to take attribute lists into consideration, use - * lookup_attr() instead (see below). This also means that you cannot use - * find_attr() to search for extent records of non-resident attributes, as - * extents with lowest_vcn != 0 are usually described by the attribute list - * attribute only. - Note that it is possible that the first extent is only in - * the attribute list while the last extent is in the base mft record, so don't - * rely on being able to find the first extent in the base mft record. + * for, obviously). If you need to take attribute lists into consideration, + * use ntfs_attr_lookup() instead (see below). This also means that you cannot + * use ntfs_attr_find() to search for extent records of non-resident + * attributes, as extents with lowest_vcn != 0 are usually described by the + * attribute list attribute only. - Note that it is possible that the first + * extent is only in the attribute list while the last extent is in the base + * mft record, so do not rely on being able to find the first extent in the + * base mft record. * * Warning: Never use @val when looking for attribute types which can be * non-resident as this most likely will result in a crash! */ -BOOL find_attr(const ATTR_TYPES type, const ntfschar *name, const u32 name_len, - const IGNORE_CASE_BOOL ic, const u8 *val, const u32 val_len, - attr_search_context *ctx) +static int ntfs_attr_find(const ATTR_TYPE type, const ntfschar *name, + const u32 name_len, const IGNORE_CASE_BOOL ic, + const u8 *val, const u32 val_len, ntfs_attr_search_ctx *ctx) { ATTR_RECORD *a; ntfs_volume *vol; @@ -1228,21 +1236,21 @@ le32_to_cpu(ctx->mrec->bytes_allocated)) break; ctx->attr = a; - /* We catch $END with this more general check, too... */ - if (le32_to_cpu(a->type) > le32_to_cpu(type)) - return FALSE; + if (unlikely(le32_to_cpu(a->type) > le32_to_cpu(type) || + a->type == AT_END)) + return -ENOENT; if (unlikely(!a->length)) break; if (a->type != type) continue; /* - * If @name is present, compare the two names. If @name is + * If @name is present, compare the two names. If @name is * missing, assume we want an unnamed attribute. */ if (!name) { /* The search failed if the found attribute is named. */ if (a->name_length) - return FALSE; + return -ENOENT; } else if (!ntfs_are_names_equal(name, name_len, (ntfschar*)((u8*)a + le16_to_cpu(a->name_offset)), a->name_length, ic, upcase, upcase_len)) { @@ -1250,7 +1258,7 @@ rc = ntfs_collate_names(name, name_len, (ntfschar*)((u8*)a + - le16_to_cpu(a->name_offset)), + le16_to_cpu(a->name_offset)), a->name_length, 1, IGNORE_CASE, upcase, upcase_len); /* @@ -1258,56 +1266,55 @@ * matching attribute. */ if (rc == -1) - return FALSE; + return -ENOENT; /* If the strings are not equal, continue search. */ if (rc) continue; rc = ntfs_collate_names(name, name_len, (ntfschar*)((u8*)a + - le16_to_cpu(a->name_offset)), + le16_to_cpu(a->name_offset)), a->name_length, 1, CASE_SENSITIVE, upcase, upcase_len); if (rc == -1) - return FALSE; + return -ENOENT; if (rc) continue; } /* * The names match or @name not present and attribute is - * unnamed. If no @val specified, we have found the attribute + * unnamed. If no @val specified, we have found the attribute * and are done. */ if (!val) - return TRUE; + return 0; /* @val is present; compare values. */ else { - u32 vl; register int rc; - vl = le32_to_cpu(a->data.resident.value_length); - if (vl > val_len) - vl = val_len; - rc = memcmp(val, (u8*)a + le16_to_cpu( - a->data.resident.value_offset), vl); + a->data.resident.value_offset), + min_t(u32, val_len, le32_to_cpu( + a->data.resident.value_length))); /* * If @val collates before the current attribute's * value, there is no matching attribute. */ if (!rc) { register u32 avl; + avl = le32_to_cpu( a->data.resident.value_length); if (val_len == avl) - return TRUE; + return 0; if (val_len < avl) - return FALSE; + return -ENOENT; } else if (rc < 0) - return FALSE; + return -ENOENT; } } - ntfs_error(NULL, "Inode is corrupt. Run chkdsk."); - return FALSE; + ntfs_error(NULL, "Inode is corrupt. Run chkdsk."); + NVolSetErrors(vol); + return -EIO; } /** @@ -1419,7 +1426,7 @@ } /** - * find_external_attr - find an attribute in the attribute list of an ntfs inode + * ntfs_external_attr_find - find an attribute in the attribute list of an inode * @type: attribute type to find * @name: attribute name to find (optional, i.e. NULL means don't care) * @name_len: attribute name length (only needed if @name present) @@ -1429,34 +1436,49 @@ * @val_len: attribute value length * @ctx: search context with mft record and attribute to search from * - * You shouldn't need to call this function directly. Use lookup_attr() instead. + * You should not need to call this function directly. Use ntfs_attr_lookup() + * instead. * * Find an attribute by searching the attribute list for the corresponding - * attribute list entry. Having found the entry, map the mft record for read - * if the attribute is in a different mft record/inode, find_attr the attribute + * attribute list entry. Having found the entry, map the mft record if the + * attribute is in a different mft record/inode, ntfs_attr_find() the attribute * in there and return it. * * On first search @ctx->ntfs_ino must be the base mft record and @ctx must - * have been obtained from a call to get_attr_search_ctx(). On subsequent calls - * @ctx->ntfs_ino can be any extent inode, too (@ctx->base_ntfs_ino is then the - * base inode). + * have been obtained from a call to ntfs_attr_get_search_ctx(). On subsequent + * calls @ctx->ntfs_ino can be any extent inode, too (@ctx->base_ntfs_ino is + * then the base inode). * * After finishing with the attribute/mft record you need to call - * put_attr_search_ctx() to cleanup the search context (unmapping any mapped - * inodes, etc). + * ntfs_attr_put_search_ctx() to cleanup the search context (unmapping any + * mapped inodes, etc). * - * Return TRUE if the search was successful and FALSE if not. When TRUE, - * @ctx->attr is the found attribute and it is in mft record @ctx->mrec. When - * FALSE, @ctx->attr is the attribute which collates just after the attribute - * being searched for in the base ntfs inode, i.e. if one wants to add the - * attribute to the mft record this is the correct place to insert it into - * and if there is not enough space, the attribute should be placed in an - * extent mft record. + * If the attribute is found, ntfs_external_attr_find() returns 0 and + * @ctx->attr will point to the found attribute. @ctx->mrec will point to the + * mft record in which @ctx->attr is located and @ctx->al_entry will point to + * the attribute list entry for the attribute. + * + * If the attribute is not found, ntfs_external_attr_find() returns -ENOENT and + * @ctx->attr will point to the attribute in the base mft record before which + * the attribute being searched for would need to be inserted if such an action + * were to be desired. @ctx->mrec will point to the mft record in which + * @ctx->attr is located and @ctx->al_entry will point to the attribute list + * entry of the attribute before which the attribute being searched for would + * need to be inserted if such an action were to be desired. + * + * Thus to insert the not found attribute, one wants to add the attribute to + * @ctx->mrec (the base mft record) and if there is not enough space, the + * attribute should be placed in a newly allocated extent mft record. The + * attribute list entry for the inserted attribute should be inserted in the + * attribute list attribute at @ctx->al_entry. + * + * On actual error, ntfs_external_attr_find() returns -EIO. In this case + * @ctx->attr is undefined and in particular do not rely on it not changing. */ -static BOOL find_external_attr(const ATTR_TYPES type, const ntfschar *name, - const u32 name_len, const IGNORE_CASE_BOOL ic, - const VCN lowest_vcn, const u8 *val, const u32 val_len, - attr_search_context *ctx) +static int ntfs_external_attr_find(const ATTR_TYPE type, + const ntfschar *name, const u32 name_len, + const IGNORE_CASE_BOOL ic, const VCN lowest_vcn, + const u8 *val, const u32 val_len, ntfs_attr_search_ctx *ctx) { ntfs_inode *base_ni, *ni; ntfs_volume *vol; @@ -1465,6 +1487,8 @@ ATTR_RECORD *a; ntfschar *al_name; u32 al_name_len; + int err = 0; + static const char *es = " Unmount and run chkdsk."; ni = ctx->ntfs_ino; base_ni = ctx->base_ntfs_ino; @@ -1476,6 +1500,8 @@ } if (ni == base_ni) ctx->base_attr = ctx->attr; + if (type == AT_END) + goto not_found; vol = base_ni->vol; al_start = base_ni->attr_list; al_end = al_start + base_ni->attr_list_size; @@ -1512,7 +1538,7 @@ if (type != al_entry->type) continue; /* - * If @name is present, compare the two names. If @name is + * If @name is present, compare the two names. If @name is * missing, assume we want an unnamed attribute. */ al_name_len = al_entry->name_length; @@ -1538,10 +1564,11 @@ continue; /* * FIXME: Reverse engineering showed 0, IGNORE_CASE but - * that is inconsistent with find_attr(). The subsequent - * rc checks were also different. Perhaps I made a - * mistake in one of the two. Need to recheck which is - * correct or at least see what is going on... (AIA) + * that is inconsistent with ntfs_attr_find(). The + * subsequent rc checks were also different. Perhaps I + * made a mistake in one of the two. Need to recheck + * which is correct or at least see what is going on... + * (AIA) */ rc = ntfs_collate_names(name, name_len, al_name, al_name_len, 1, CASE_SENSITIVE, @@ -1553,8 +1580,8 @@ } /* * The names match or @name not present and attribute is - * unnamed. Now check @lowest_vcn. Continue search if the - * next attribute list entry still fits @lowest_vcn. Otherwise + * unnamed. Now check @lowest_vcn. Continue search if the + * next attribute list entry still fits @lowest_vcn. Otherwise * we have reached the right one or the search has failed. */ if (lowest_vcn && (u8*)next_al_entry >= al_start && @@ -1562,7 +1589,7 @@ (u8*)next_al_entry + le16_to_cpu( next_al_entry->length) <= al_end && sle64_to_cpu(next_al_entry->lowest_vcn) <= - sle64_to_cpu(lowest_vcn) && + lowest_vcn && next_al_entry->type == al_entry->type && next_al_entry->name_length == al_name_len && ntfs_are_names_equal((ntfschar*)((u8*) @@ -1575,7 +1602,10 @@ if (MREF_LE(al_entry->mft_reference) == ni->mft_no) { if (MSEQNO_LE(al_entry->mft_reference) != ni->seq_no) { ntfs_error(vol->sb, "Found stale mft " - "reference in attribute list!"); + "reference in attribute list " + "of base inode 0x%lx.%s", + base_ni->mft_no, es); + err = -EIO; break; } } else { /* Mft references do not match. */ @@ -1590,13 +1620,20 @@ } else { /* We want an extent record. */ ctx->mrec = map_extent_mft_record(base_ni, - al_entry->mft_reference, &ni); + le64_to_cpu( + al_entry->mft_reference), &ni); ctx->ntfs_ino = ni; if (IS_ERR(ctx->mrec)) { - ntfs_error(vol->sb, "Failed to map mft " - "record, error code " - "%ld.", - -PTR_ERR(ctx->mrec)); + ntfs_error(vol->sb, "Failed to map " + "extent mft record " + "0x%lx of base inode " + "0x%lx.%s", + MREF_LE(al_entry-> + mft_reference), + base_ni->mft_no, es); + err = PTR_ERR(ctx->mrec); + if (err == -ENOENT) + err = -EIO; break; } } @@ -1609,14 +1646,14 @@ * current al_entry. */ /* - * We could call into find_attr() to find the right attribute - * in this mft record but this would be less efficient and not - * quite accurate as find_attr() ignores the attribute instance - * numbers for example which become important when one plays - * with attribute lists. Also, because a proper match has been - * found in the attribute list entry above, the comparison can - * now be optimized. So it is worth re-implementing a - * simplified find_attr() here. + * We could call into ntfs_attr_find() to find the right + * attribute in this mft record but this would be less + * efficient and not quite accurate as ntfs_attr_find() ignores + * the attribute instance numbers for example which become + * important when one plays with attribute lists. Also, + * because a proper match has been found in the attribute list + * entry above, the comparison can now be optimized. So it is + * worth re-implementing a simplified ntfs_attr_find() here. */ a = ctx->attr; /* @@ -1633,18 +1670,18 @@ break; if (al_entry->instance != a->instance) goto do_next_attr; + /* + * If the type and/or the name are mismatched between the + * attribute list entry and the attribute record, there is + * corruption so we break and return error EIO. + */ if (al_entry->type != a->type) - continue; - if (name) { - if (a->name_length != al_name_len) - continue; - if (!ntfs_are_names_equal((ntfschar*)((u8*)a + - le16_to_cpu(a->name_offset)), - a->name_length, al_name, al_name_len, - CASE_SENSITIVE, vol->upcase, - vol->upcase_len)) - continue; - } + break; + if (!ntfs_are_names_equal((ntfschar*)((u8*)a + + le16_to_cpu(a->name_offset)), a->name_length, + al_name, al_name_len, CASE_SENSITIVE, + vol->upcase, vol->upcase_len)) + break; ctx->attr = a; /* * If no @val specified or @val specified and it matches, we @@ -1656,46 +1693,76 @@ le16_to_cpu(a->data.resident.value_offset), val, val_len))) { ntfs_debug("Done, found."); - return TRUE; + return 0; } do_next_attr: /* Proceed to the next attribute in the current mft record. */ a = (ATTR_RECORD*)((u8*)a + le32_to_cpu(a->length)); goto do_next_attr_loop; } - ntfs_error(base_ni->vol->sb, "Inode contains corrupt attribute list " - "attribute."); + if (!err) { + ntfs_error(vol->sb, "Base inode 0x%lx contains corrupt " + "attribute list attribute.%s", base_ni->mft_no, + es); + err = -EIO; + } if (ni != base_ni) { unmap_extent_mft_record(ni); ctx->ntfs_ino = base_ni; ctx->mrec = ctx->base_mrec; ctx->attr = ctx->base_attr; } + if (err != -ENOMEM) + NVolSetErrors(vol); + return err; +not_found: /* - * FIXME: We absolutely have to return ERROR status instead of just - * false or we will blow up or even worse cause corruption when we add - * write support and we reach this code path! + * If we were looking for AT_END, we reset the search context @ctx and + * use ntfs_attr_find() to seek to the end of the base mft record. */ - printk(KERN_CRIT "NTFS: FIXME: Hit unfinished error code path!!!\n"); - return FALSE; -not_found: + if (type == AT_END) { + ntfs_attr_reinit_search_ctx(ctx); + return ntfs_attr_find(AT_END, name, name_len, ic, val, val_len, + ctx); + } /* - * Seek to the end of the base mft record, i.e. when we return false, - * ctx->mrec and ctx->attr indicate where the attribute should be - * inserted into the attribute record. - * And of course ctx->al_entry points to the end of the attribute - * list inside NTFS_I(ctx->base_vfs_ino)->attr_list. - * - * FIXME: Do we really want to do this here? Think about it... (AIA) + * The attribute was not found. Before we return, we want to ensure + * @ctx->mrec and @ctx->attr indicate the position at which the + * attribute should be inserted in the base mft record. Since we also + * want to preserve @ctx->al_entry we cannot reinitialize the search + * context using ntfs_attr_reinit_search_ctx() as this would set + * @ctx->al_entry to NULL. Thus we do the necessary bits manually (see + * ntfs_attr_init_search_ctx() below). Note, we _only_ preserve + * @ctx->al_entry as the remaining fields (base_*) are identical to + * their non base_ counterparts and we cannot set @ctx->base_attr + * correctly yet as we do not know what @ctx->attr will be set to by + * the call to ntfs_attr_find() below. */ - reinit_attr_search_ctx(ctx); - find_attr(type, name, name_len, ic, val, val_len, ctx); + ctx->mrec = ctx->base_mrec; + ctx->attr = (ATTR_RECORD*)((u8*)ctx->mrec + + le16_to_cpu(ctx->mrec->attrs_offset)); + ctx->is_first = TRUE; + ctx->ntfs_ino = ctx->base_ntfs_ino; + ctx->base_ntfs_ino = NULL; + ctx->base_mrec = NULL; + ctx->base_attr = NULL; + /* + * In case there are multiple matches in the base mft record, need to + * keep enumerating until we get an attribute not found response (or + * another error), otherwise we would keep returning the same attribute + * over and over again and all programs using us for enumeration would + * lock up in a tight loop. + */ + do { + err = ntfs_attr_find(type, name, name_len, ic, val, val_len, + ctx); + } while (!err); ntfs_debug("Done, not found."); - return FALSE; + return err; } /** - * lookup_attr - find an attribute in an ntfs inode + * ntfs_attr_lookup - find an attribute in an ntfs inode * @type: attribute type to find * @name: attribute name to find (optional, i.e. NULL means don't care) * @name_len: attribute name length (only needed if @name present) @@ -1705,27 +1772,38 @@ * @val_len: attribute value length * @ctx: search context with mft record and attribute to search from * - * Find an attribute in an ntfs inode. On first search @ctx->ntfs_ino must + * Find an attribute in an ntfs inode. On first search @ctx->ntfs_ino must * be the base mft record and @ctx must have been obtained from a call to - * get_attr_search_ctx(). + * ntfs_attr_get_search_ctx(). * * This function transparently handles attribute lists and @ctx is used to * continue searches where they were left off at. * * After finishing with the attribute/mft record you need to call - * put_attr_search_ctx() to cleanup the search context (unmapping any mapped - * inodes, etc). + * ntfs_attr_put_search_ctx() to cleanup the search context (unmapping any + * mapped inodes, etc). + * + * Return 0 if the search was successful and -errno if not. * - * Return TRUE if the search was successful and FALSE if not. When TRUE, - * @ctx->attr is the found attribute and it is in mft record @ctx->mrec. When - * FALSE, @ctx->attr is the attribute which collates just after the attribute - * being searched for, i.e. if one wants to add the attribute to the mft - * record this is the correct place to insert it into. + * When 0, @ctx->attr is the found attribute and it is in mft record + * @ctx->mrec. If an attribute list attribute is present, @ctx->al_entry is + * the attribute list entry of the found attribute. + * + * When -ENOENT, @ctx->attr is the attribute which collates just after the + * attribute being searched for, i.e. if one wants to add the attribute to the + * mft record this is the correct place to insert it into. If an attribute + * list attribute is present, @ctx->al_entry is the attribute list entry which + * collates just after the attribute list entry of the attribute being searched + * for, i.e. if one wants to add the attribute to the mft record this is the + * correct place to insert its attribute list entry into. + * + * When -errno != -ENOENT, an error occured during the lookup. @ctx->attr is + * then undefined and in particular you should not rely on it not changing. */ -BOOL lookup_attr(const ATTR_TYPES type, const ntfschar *name, +int ntfs_attr_lookup(const ATTR_TYPE type, const ntfschar *name, const u32 name_len, const IGNORE_CASE_BOOL ic, const VCN lowest_vcn, const u8 *val, const u32 val_len, - attr_search_context *ctx) + ntfs_attr_search_ctx *ctx) { ntfs_inode *base_ni; @@ -1736,21 +1814,22 @@ base_ni = ctx->ntfs_ino; /* Sanity check, just for debugging really. */ BUG_ON(!base_ni); - if (!NInoAttrList(base_ni)) - return find_attr(type, name, name_len, ic, val, val_len, ctx); - return find_external_attr(type, name, name_len, ic, lowest_vcn, val, - val_len, ctx); + if (!NInoAttrList(base_ni) || type == AT_ATTRIBUTE_LIST) + return ntfs_attr_find(type, name, name_len, ic, val, val_len, + ctx); + return ntfs_external_attr_find(type, name, name_len, ic, lowest_vcn, + val, val_len, ctx); } /** - * init_attr_search_ctx - initialize an attribute search context + * ntfs_attr_init_search_ctx - initialize an attribute search context * @ctx: attribute search context to initialize * @ni: ntfs inode with which to initialize the search context * @mrec: mft record with which to initialize the search context * * Initialize the attribute search context @ctx with @ni and @mrec. */ -static inline void init_attr_search_ctx(attr_search_context *ctx, +static inline void ntfs_attr_init_search_ctx(ntfs_attr_search_ctx *ctx, ntfs_inode *ni, MFT_RECORD *mrec) { ctx->mrec = mrec; @@ -1765,7 +1844,7 @@ } /** - * reinit_attr_search_ctx - reinitialize an attribute search context + * ntfs_attr_reinit_search_ctx - reinitialize an attribute search context * @ctx: attribute search context to reinitialize * * Reinitialize the attribute search context @ctx, unmapping an associated @@ -1774,7 +1853,7 @@ * This is used when a search for a new attribute is being started to reset * the search context to the beginning. */ -void reinit_attr_search_ctx(attr_search_context *ctx) +void ntfs_attr_reinit_search_ctx(ntfs_attr_search_ctx *ctx) { if (likely(!ctx->base_ntfs_ino)) { /* No attribute list. */ @@ -1786,40 +1865,39 @@ } /* Attribute list. */ if (ctx->ntfs_ino != ctx->base_ntfs_ino) unmap_extent_mft_record(ctx->ntfs_ino); - init_attr_search_ctx(ctx, ctx->base_ntfs_ino, ctx->base_mrec); + ntfs_attr_init_search_ctx(ctx, ctx->base_ntfs_ino, ctx->base_mrec); return; } /** - * get_attr_search_ctx - allocate and initialize a new attribute search context + * ntfs_attr_get_search_ctx - allocate/initialize a new attribute search context * @ni: ntfs inode with which to initialize the search context * @mrec: mft record with which to initialize the search context * * Allocate a new attribute search context, initialize it with @ni and @mrec, * and return it. Return NULL if allocation failed. */ -attr_search_context *get_attr_search_ctx(ntfs_inode *ni, MFT_RECORD *mrec) +ntfs_attr_search_ctx *ntfs_attr_get_search_ctx(ntfs_inode *ni, MFT_RECORD *mrec) { - attr_search_context *ctx; + ntfs_attr_search_ctx *ctx; ctx = kmem_cache_alloc(ntfs_attr_ctx_cache, SLAB_NOFS); if (ctx) - init_attr_search_ctx(ctx, ni, mrec); + ntfs_attr_init_search_ctx(ctx, ni, mrec); return ctx; } /** - * put_attr_search_ctx - release an attribute search context + * ntfs_attr_put_search_ctx - release an attribute search context * @ctx: attribute search context to free * * Release the attribute search context @ctx, unmapping an associated extent * mft record if present. */ -void put_attr_search_ctx(attr_search_context *ctx) +void ntfs_attr_put_search_ctx(ntfs_attr_search_ctx *ctx) { if (ctx->base_ntfs_ino && ctx->ntfs_ino != ctx->base_ntfs_ino) unmap_extent_mft_record(ctx->ntfs_ino); kmem_cache_free(ntfs_attr_ctx_cache, ctx); return; } - diff -Nru a/fs/ntfs/attrib.h b/fs/ntfs/attrib.h --- a/fs/ntfs/attrib.h 2004-09-26 10:25:56 -07:00 +++ b/fs/ntfs/attrib.h 2004-09-26 10:25:56 -07:00 @@ -43,10 +43,10 @@ } LCN_SPECIAL_VALUES; /** - * attr_search_context - used in attribute search functions + * ntfs_attr_search_ctx - used in attribute search functions * @mrec: buffer containing mft record to search * @attr: attribute record in @mrec where to begin/continue search - * @is_first: if true lookup_attr() begins search with @attr, else after @attr + * @is_first: if true ntfs_attr_lookup() begins search with @attr, else after * * Structure must be initialized to zero before the first call to one of the * attribute search functions. Initialize @mrec to point to the mft record to @@ -69,7 +69,7 @@ ntfs_inode *base_ntfs_ino; MFT_RECORD *base_mrec; ATTR_RECORD *base_attr; -} attr_search_context; +} ntfs_attr_search_ctx; extern runlist_element *decompress_mapping_pairs(const ntfs_volume *vol, const ATTR_RECORD *attr, runlist_element *old_rl); @@ -81,28 +81,24 @@ extern runlist_element *ntfs_find_vcn(ntfs_inode *ni, const VCN vcn, const BOOL need_write); -extern BOOL find_attr(const ATTR_TYPES type, const ntfschar *name, - const u32 name_len, const IGNORE_CASE_BOOL ic, const u8 *val, - const u32 val_len, attr_search_context *ctx); - -BOOL lookup_attr(const ATTR_TYPES type, const ntfschar *name, +int ntfs_attr_lookup(const ATTR_TYPE type, const ntfschar *name, const u32 name_len, const IGNORE_CASE_BOOL ic, const VCN lowest_vcn, const u8 *val, const u32 val_len, - attr_search_context *ctx); + ntfs_attr_search_ctx *ctx); extern int load_attribute_list(ntfs_volume *vol, runlist *rl, u8 *al_start, const s64 size, const s64 initialized_size); -static inline s64 attribute_value_length(const ATTR_RECORD *a) +static inline s64 ntfs_attr_size(const ATTR_RECORD *a) { if (!a->non_resident) return (s64)le32_to_cpu(a->data.resident.value_length); return sle64_to_cpu(a->data.non_resident.data_size); } -extern void reinit_attr_search_ctx(attr_search_context *ctx); -extern attr_search_context *get_attr_search_ctx(ntfs_inode *ni, +extern void ntfs_attr_reinit_search_ctx(ntfs_attr_search_ctx *ctx); +extern ntfs_attr_search_ctx *ntfs_attr_get_search_ctx(ntfs_inode *ni, MFT_RECORD *mrec); -extern void put_attr_search_ctx(attr_search_context *ctx); +extern void ntfs_attr_put_search_ctx(ntfs_attr_search_ctx *ctx); #endif /* _LINUX_NTFS_ATTRIB_H */ diff -Nru a/fs/ntfs/collate.c b/fs/ntfs/collate.c --- a/fs/ntfs/collate.c 2004-09-26 10:25:57 -07:00 +++ b/fs/ntfs/collate.c 2004-09-26 10:25:57 -07:00 @@ -97,24 +97,26 @@ * For speed we use the collation rule @cr as an index into two tables of * function pointers to call the appropriate collation function. */ -int ntfs_collate(ntfs_volume *vol, COLLATION_RULES cr, +int ntfs_collate(ntfs_volume *vol, COLLATION_RULE cr, const void *data1, const int data1_len, const void *data2, const int data2_len) { + int i; + ntfs_debug("Entering."); /* * FIXME: At the moment we only support COLLATION_BINARY and * COLLATION_NTOFS_ULONG, so we BUG() for everything else for now. */ BUG_ON(cr != COLLATION_BINARY && cr != COLLATION_NTOFS_ULONG); - cr = le32_to_cpu(cr); - BUG_ON(cr < 0); - if (cr <= 0x02) - return ntfs_do_collate0x0[cr](vol, data1, data1_len, + i = le32_to_cpu(cr); + BUG_ON(i < 0); + if (i <= 0x02) + return ntfs_do_collate0x0[i](vol, data1, data1_len, data2, data2_len); - BUG_ON(cr < 0x10); - cr -= 0x10; - if (likely(cr <= 3)) - return ntfs_do_collate0x1[cr](vol, data1, data1_len, + BUG_ON(i < 0x10); + i -= 0x10; + if (likely(i <= 3)) + return ntfs_do_collate0x1[i](vol, data1, data1_len, data2, data2_len); BUG(); return 0; diff -Nru a/fs/ntfs/collate.h b/fs/ntfs/collate.h --- a/fs/ntfs/collate.h 2004-09-26 10:25:55 -07:00 +++ b/fs/ntfs/collate.h 2004-09-26 10:25:55 -07:00 @@ -26,7 +26,9 @@ #include "types.h" #include "volume.h" -static inline BOOL ntfs_is_collation_rule_supported(COLLATION_RULES cr) { +static inline BOOL ntfs_is_collation_rule_supported(COLLATION_RULE cr) { + int i; + /* * FIXME: At the moment we only support COLLATION_BINARY and * COLLATION_NTOFS_ULONG, so we return false for everything else for @@ -34,14 +36,14 @@ */ if (unlikely(cr != COLLATION_BINARY && cr != COLLATION_NTOFS_ULONG)) return FALSE; - cr = le32_to_cpu(cr); - if (likely(((cr >= 0) && (cr <= 0x02)) || - ((cr >= 0x10) && (cr <= 0x13)))) + i = le32_to_cpu(cr); + if (likely(((i >= 0) && (i <= 0x02)) || + ((i >= 0x10) && (i <= 0x13)))) return TRUE; return FALSE; } -extern int ntfs_collate(ntfs_volume *vol, COLLATION_RULES cr, +extern int ntfs_collate(ntfs_volume *vol, COLLATION_RULE cr, const void *data1, const int data1_len, const void *data2, const int data2_len); diff -Nru a/fs/ntfs/compress.c b/fs/ntfs/compress.c --- a/fs/ntfs/compress.c 2004-09-26 10:25:56 -07:00 +++ b/fs/ntfs/compress.c 2004-09-26 10:25:56 -07:00 @@ -203,7 +203,7 @@ * position in the compression block is one byte before its end so the * first two checks do not detect it. */ - if (cb == cb_end || !le16_to_cpup((u16*)cb) || + if (cb == cb_end || !le16_to_cpup((le16*)cb) || (*dest_index == dest_max_index && *dest_ofs == dest_max_ofs)) { int i; @@ -255,7 +255,7 @@ /* Setup the current sub-block source pointers and validate range. */ cb_sb_start = cb; - cb_sb_end = cb_sb_start + (le16_to_cpup((u16*)cb) & NTFS_SB_SIZE_MASK) + cb_sb_end = cb_sb_start + (le16_to_cpup((le16*)cb) & NTFS_SB_SIZE_MASK) + 3; if (cb_sb_end > cb_end) goto return_overflow; @@ -277,7 +277,7 @@ dp_addr = (u8*)page_address(dp) + do_sb_start; /* Now, we are ready to process the current sub-block (sb). */ - if (!(le16_to_cpup((u16*)cb) & NTFS_SB_IS_COMPRESSED)) { + if (!(le16_to_cpup((le16*)cb) & NTFS_SB_IS_COMPRESSED)) { ntfs_debug("Found uncompressed sub-block."); /* This sb is not compressed, just copy it into destination. */ @@ -382,7 +382,7 @@ lg++; /* Get the phrase token into i. */ - pt = le16_to_cpup((u16*)cb); + pt = le16_to_cpup((le16*)cb); /* * Calculate starting position of the byte sequence in diff -Nru a/fs/ntfs/debug.c b/fs/ntfs/debug.c --- a/fs/ntfs/debug.c 2004-09-26 10:25:58 -07:00 +++ b/fs/ntfs/debug.c 2004-09-26 10:25:58 -07:00 @@ -127,7 +127,7 @@ va_start(args, fmt); vsnprintf(err_buf, sizeof(err_buf), fmt, args); va_end(args); - printk(KERN_DEBUG "NTFS-fs DEBUG (%s, %d): %s: %s\n", + printk(KERN_DEBUG "NTFS-fs DEBUG (%s, %d): %s(): %s\n", file, line, flen ? function : "", err_buf); spin_unlock(&err_buf_lock); } diff -Nru a/fs/ntfs/dir.c b/fs/ntfs/dir.c --- a/fs/ntfs/dir.c 2004-09-26 10:25:56 -07:00 +++ b/fs/ntfs/dir.c 2004-09-26 10:25:56 -07:00 @@ -83,7 +83,7 @@ INDEX_ALLOCATION *ia; u8 *index_end; u64 mref; - attr_search_context *ctx; + ntfs_attr_search_ctx *ctx; int err, rc; VCN vcn, old_vcn; struct address_space *ia_mapping; @@ -100,17 +100,21 @@ -PTR_ERR(m)); return ERR_MREF(PTR_ERR(m)); } - ctx = get_attr_search_ctx(dir_ni, m); + ctx = ntfs_attr_get_search_ctx(dir_ni, m); if (unlikely(!ctx)) { err = -ENOMEM; goto err_out; } /* Find the index root attribute in the mft record. */ - if (!lookup_attr(AT_INDEX_ROOT, I30, 4, CASE_SENSITIVE, 0, NULL, 0, - ctx)) { - ntfs_error(sb, "Index root attribute missing in directory " - "inode 0x%lx.", dir_ni->mft_no); - err = -EIO; + err = ntfs_attr_lookup(AT_INDEX_ROOT, I30, 4, CASE_SENSITIVE, 0, NULL, + 0, ctx); + if (unlikely(err)) { + if (err == -ENOENT) { + ntfs_error(sb, "Index root attribute missing in " + "directory inode 0x%lx.", + dir_ni->mft_no); + err = -EIO; + } goto err_out; } /* Get to the index root value (it's been verified in read_inode). */ @@ -179,7 +183,7 @@ *res = NULL; } mref = le64_to_cpu(ie->data.dir.indexed_file); - put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); unmap_mft_record(dir_ni); return mref; } @@ -278,7 +282,7 @@ */ if (!(ie->flags & INDEX_ENTRY_NODE)) { if (name) { - put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); unmap_mft_record(dir_ni); return name->mref; } @@ -295,13 +299,13 @@ goto err_out; } /* Get the starting vcn of the index_block holding the child node. */ - vcn = sle64_to_cpup((u8*)ie + le16_to_cpu(ie->length) - 8); + vcn = sle64_to_cpup((sle64*)((u8*)ie + le16_to_cpu(ie->length) - 8)); ia_mapping = VFS_I(dir_ni)->i_mapping; /* * We are done with the index root and the mft record. Release them, * otherwise we deadlock with ntfs_map_page(). */ - put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); unmap_mft_record(dir_ni); m = NULL; ctx = NULL; @@ -547,7 +551,8 @@ } /* Child node present, descend into it. */ old_vcn = vcn; - vcn = sle64_to_cpup((u8*)ie + le16_to_cpu(ie->length) - 8); + vcn = sle64_to_cpup((sle64*)((u8*)ie + + le16_to_cpu(ie->length) - 8)); if (vcn >= 0) { /* If vcn is in the same page cache page as old_vcn we * recycle the mapped page. */ @@ -582,7 +587,7 @@ ntfs_unmap_page(page); err_out: if (ctx) - put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); if (m) unmap_mft_record(dir_ni); if (name) { @@ -634,7 +639,7 @@ INDEX_ALLOCATION *ia; u8 *index_end; u64 mref; - attr_search_context *ctx; + ntfs_attr_search_ctx *ctx; int err, rc; IGNORE_CASE_BOOL ic; VCN vcn, old_vcn; @@ -649,17 +654,21 @@ -PTR_ERR(m)); return ERR_MREF(PTR_ERR(m)); } - ctx = get_attr_search_ctx(dir_ni, m); + ctx = ntfs_attr_get_search_ctx(dir_ni, m); if (!ctx) { err = -ENOMEM; goto err_out; } /* Find the index root attribute in the mft record. */ - if (!lookup_attr(AT_INDEX_ROOT, I30, 4, CASE_SENSITIVE, 0, NULL, 0, - ctx)) { - ntfs_error(sb, "Index root attribute missing in directory " - "inode 0x%lx.", dir_ni->mft_no); - err = -EIO; + err = ntfs_attr_lookup(AT_INDEX_ROOT, I30, 4, CASE_SENSITIVE, 0, NULL, + 0, ctx); + if (unlikely(err)) { + if (err == -ENOENT) { + ntfs_error(sb, "Index root attribute missing in " + "directory inode 0x%lx.", + dir_ni->mft_no); + err = -EIO; + } goto err_out; } /* Get to the index root value (it's been verified in read_inode). */ @@ -710,7 +719,7 @@ vol->upcase, vol->upcase_len)) { found_it: mref = le64_to_cpu(ie->data.dir.indexed_file); - put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); unmap_mft_record(dir_ni); return mref; } @@ -776,7 +785,7 @@ * We are done with the index root and the mft record. Release them, * otherwise we deadlock with ntfs_map_page(). */ - put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); unmap_mft_record(dir_ni); m = NULL; ctx = NULL; @@ -979,7 +988,7 @@ ntfs_unmap_page(page); err_out: if (ctx) - put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); if (m) unmap_mft_record(dir_ni); return ERR_MREF(err); @@ -991,23 +1000,11 @@ #endif -typedef union { - INDEX_ROOT *ir; - INDEX_ALLOCATION *ia; -} index_union __attribute__ ((__transparent_union__)); - -typedef enum { - INDEX_TYPE_ROOT, /* index root */ - INDEX_TYPE_ALLOCATION, /* index allocation */ -} INDEX_TYPE; - /** * ntfs_filldir - ntfs specific filldir method * @vol: current ntfs volume * @fpos: position in the directory * @ndir: ntfs inode of current directory - * @index_type: specifies whether @iu is an index root or an index allocation - * @iu: index root or index allocation attribute to which @ie belongs * @ia_page: page in which the index allocation buffer @ie is in resides * @ie: current index entry * @name: buffer to use for the converted name @@ -1017,9 +1014,8 @@ * Convert the Unicode @name to the loaded NLS and pass it to the @filldir * callback. * - * If @index_type is INDEX_TYPE_ALLOCATION, @ia_page is the locked page - * containing the index allocation block containing the index entry @ie. - * Otherwise, @ia_page is NULL. + * If @ia_page is not NULL it is the locked page containing the index + * allocation block containing the index entry @ie. * * Note, we drop (and then reacquire) the page lock on @ia_page across the * @filldir() call otherwise we would deadlock with NFSd when it calls ->lookup @@ -1027,9 +1023,8 @@ * retake the lock if we are returning a non-zero value as ntfs_readdir() * would need to drop the lock immediately anyway. */ -static inline int ntfs_filldir(ntfs_volume *vol, loff_t *fpos, - ntfs_inode *ndir, const INDEX_TYPE index_type, - index_union iu, struct page *ia_page, INDEX_ENTRY *ie, +static inline int ntfs_filldir(ntfs_volume *vol, loff_t fpos, + ntfs_inode *ndir, struct page *ia_page, INDEX_ENTRY *ie, u8 *name, void *dirent, filldir_t filldir) { unsigned long mref; @@ -1037,14 +1032,6 @@ unsigned dt_type; FILE_NAME_TYPE_FLAGS name_type; - /* Advance the position even if going to skip the entry. */ - if (index_type == INDEX_TYPE_ALLOCATION) - *fpos = (u8*)ie - (u8*)iu.ia + - (sle64_to_cpu(iu.ia->index_block_vcn) << - ndir->itype.index.vcn_size_bits) + - vol->mft_record_size; - else /* if (index_type == INDEX_TYPE_ROOT) */ - *fpos = (u8*)ie - (u8*)iu.ir; name_type = ie->key.file_name.file_name_type; if (name_type == FILE_NAME_DOS) { ntfs_debug("Skipping DOS name space entry."); @@ -1076,14 +1063,14 @@ * Drop the page lock otherwise we deadlock with NFS when it calls * ->lookup since ntfs_lookup() will lock the same page. */ - if (index_type == INDEX_TYPE_ALLOCATION) + if (ia_page) unlock_page(ia_page); ntfs_debug("Calling filldir for %s with len %i, fpos 0x%llx, inode " - "0x%lx, DT_%s.", name, name_len, *fpos, mref, + "0x%lx, DT_%s.", name, name_len, fpos, mref, dt_type == DT_DIR ? "DIR" : "REG"); - rc = filldir(dirent, name, name_len, *fpos, mref, dt_type); + rc = filldir(dirent, name, name_len, fpos, mref, dt_type); /* Relock the page but not if we are aborting ->readdir. */ - if (!rc && index_type == INDEX_TYPE_ALLOCATION) + if (!rc && ia_page) lock_page(ia_page); return rc; } @@ -1125,7 +1112,7 @@ struct address_space *ia_mapping, *bmp_mapping; struct page *bmp_page = NULL, *ia_page = NULL; u8 *kaddr, *bmp, *index_end; - attr_search_context *ctx; + ntfs_attr_search_ctx *ctx; fpos = filp->f_pos; ntfs_debug("Entering for inode 0x%lx, fpos 0x%llx.", @@ -1175,7 +1162,7 @@ m = NULL; goto err_out; } - ctx = get_attr_search_ctx(ndir, m); + ctx = ntfs_attr_get_search_ctx(ndir, m); if (unlikely(!ctx)) { err = -ENOMEM; goto err_out; @@ -1183,8 +1170,9 @@ /* Get the offset into the index root attribute. */ ir_pos = (s64)fpos; /* Find the index root attribute in the mft record. */ - if (unlikely(!lookup_attr(AT_INDEX_ROOT, I30, 4, CASE_SENSITIVE, 0, - NULL, 0, ctx))) { + err = ntfs_attr_lookup(AT_INDEX_ROOT, I30, 4, CASE_SENSITIVE, 0, NULL, + 0, ctx); + if (unlikely(err)) { ntfs_error(sb, "Index root attribute missing in directory " "inode 0x%lx.", vdir->i_ino); goto err_out; @@ -1208,7 +1196,7 @@ /* Copy the index root value (it has been verified in read_inode). */ memcpy(ir, (u8*)ctx->attr + le16_to_cpu(ctx->attr->data.resident.value_offset), rc); - put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); unmap_mft_record(ndir); ctx = NULL; m = NULL; @@ -1235,9 +1223,11 @@ /* Skip index root entry if continuing previous readdir. */ if (ir_pos > (u8*)ie - (u8*)ir) continue; + /* Advance the position even if going to skip the entry. */ + fpos = (u8*)ie - (u8*)ir; /* Submit the name to the filldir callback. */ - rc = ntfs_filldir(vol, &fpos, ndir, INDEX_TYPE_ROOT, ir, NULL, - ie, name, dirent, filldir); + rc = ntfs_filldir(vol, fpos, ndir, NULL, ie, name, dirent, + filldir); if (rc) { kfree(ir); goto abort; @@ -1411,14 +1401,19 @@ /* Skip index block entry if continuing previous readdir. */ if (ia_pos - ia_start > (u8*)ie - (u8*)ia) continue; + /* Advance the position even if going to skip the entry. */ + fpos = (u8*)ie - (u8*)ia + + (sle64_to_cpu(ia->index_block_vcn) << + ndir->itype.index.vcn_size_bits) + + vol->mft_record_size; /* * Submit the name to the @filldir callback. Note, * ntfs_filldir() drops the lock on @ia_page but it retakes it * before returning, unless a non-zero value is returned in * which case the page is left unlocked. */ - rc = ntfs_filldir(vol, &fpos, ndir, INDEX_TYPE_ALLOCATION, ia, - ia_page, ie, name, dirent, filldir); + rc = ntfs_filldir(vol, fpos, ndir, ia_page, ie, name, dirent, + filldir); if (rc) { /* @ia_page is already unlocked in this case. */ ntfs_unmap_page(ia_page); @@ -1460,7 +1455,7 @@ if (name) kfree(name); if (ctx) - put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); if (m) unmap_mft_record(ndir); if (!err) diff -Nru a/fs/ntfs/endian.h b/fs/ntfs/endian.h --- a/fs/ntfs/endian.h 2004-09-26 10:25:57 -07:00 +++ b/fs/ntfs/endian.h 2004-09-26 10:25:57 -07:00 @@ -24,24 +24,70 @@ #define _LINUX_NTFS_ENDIAN_H #include +#include "types.h" /* - * Signed endianness conversion defines. + * Signed endianness conversion functions. */ -#define sle16_to_cpu(x) ((s16)__le16_to_cpu((s16)(x))) -#define sle32_to_cpu(x) ((s32)__le32_to_cpu((s32)(x))) -#define sle64_to_cpu(x) ((s64)__le64_to_cpu((s64)(x))) - -#define sle16_to_cpup(x) ((s16)__le16_to_cpu(*(s16*)(x))) -#define sle32_to_cpup(x) ((s32)__le32_to_cpu(*(s32*)(x))) -#define sle64_to_cpup(x) ((s64)__le64_to_cpu(*(s64*)(x))) - -#define cpu_to_sle16(x) ((s16)__cpu_to_le16((s16)(x))) -#define cpu_to_sle32(x) ((s32)__cpu_to_le32((s32)(x))) -#define cpu_to_sle64(x) ((s64)__cpu_to_le64((s64)(x))) - -#define cpu_to_sle16p(x) ((s16)__cpu_to_le16(*(s16*)(x))) -#define cpu_to_sle32p(x) ((s32)__cpu_to_le32(*(s32*)(x))) -#define cpu_to_sle64p(x) ((s64)__cpu_to_le64(*(s64*)(x))) + +static inline s16 sle16_to_cpu(sle16 x) +{ + return le16_to_cpu((__force le16)x); +} + +static inline s32 sle32_to_cpu(sle32 x) +{ + return le32_to_cpu((__force le32)x); +} + +static inline s64 sle64_to_cpu(sle64 x) +{ + return le64_to_cpu((__force le64)x); +} + +static inline s16 sle16_to_cpup(sle16 *x) +{ + return le16_to_cpu(*(__force le16*)x); +} + +static inline s32 sle32_to_cpup(sle32 *x) +{ + return le32_to_cpu(*(__force le32*)x); +} + +static inline s64 sle64_to_cpup(sle64 *x) +{ + return le64_to_cpu(*(__force le64*)x); +} + +static inline sle16 cpu_to_sle16(s16 x) +{ + return (__force sle16)cpu_to_le16(x); +} + +static inline sle32 cpu_to_sle32(s32 x) +{ + return (__force sle32)cpu_to_le32(x); +} + +static inline sle64 cpu_to_sle64(s64 x) +{ + return (__force sle64)cpu_to_le64(x); +} + +static inline sle16 cpu_to_sle16p(s16 *x) +{ + return (__force sle16)cpu_to_le16(*x); +} + +static inline sle32 cpu_to_sle32p(s32 *x) +{ + return (__force sle32)cpu_to_le32(*x); +} + +static inline sle64 cpu_to_sle64p(s64 *x) +{ + return (__force sle64)cpu_to_le64(*x); +} #endif /* _LINUX_NTFS_ENDIAN_H */ diff -Nru a/fs/ntfs/index.c b/fs/ntfs/index.c --- a/fs/ntfs/index.c 2004-09-26 10:25:57 -07:00 +++ b/fs/ntfs/index.c 2004-09-26 10:25:57 -07:00 @@ -65,7 +65,7 @@ if (ictx->entry) { if (ictx->is_in_root) { if (ictx->actx) - put_attr_search_ctx(ictx->actx); + ntfs_attr_put_search_ctx(ictx->actx); if (ictx->base_ni) unmap_mft_record(ictx->base_ni); } else { @@ -125,6 +125,7 @@ int ntfs_index_lookup(const void *key, const int key_len, ntfs_index_context *ictx) { + VCN vcn, old_vcn; ntfs_inode *idx_ni = ictx->idx_ni; ntfs_volume *vol = idx_ni->vol; struct super_block *sb = vol->sb; @@ -133,13 +134,11 @@ INDEX_ROOT *ir; INDEX_ENTRY *ie; INDEX_ALLOCATION *ia; - u8 *index_end; - attr_search_context *actx; - int rc, err = 0; - VCN vcn, old_vcn; + u8 *index_end, *kaddr; + ntfs_attr_search_ctx *actx; struct address_space *ia_mapping; struct page *page; - u8 *kaddr; + int rc, err = 0; ntfs_debug("Entering."); BUG_ON(!NInoAttr(idx_ni)); @@ -162,17 +161,20 @@ -PTR_ERR(m)); return PTR_ERR(m); } - actx = get_attr_search_ctx(base_ni, m); + actx = ntfs_attr_get_search_ctx(base_ni, m); if (unlikely(!actx)) { err = -ENOMEM; goto err_out; } /* Find the index root attribute in the mft record. */ - if (!lookup_attr(AT_INDEX_ROOT, idx_ni->name, idx_ni->name_len, - CASE_SENSITIVE, 0, NULL, 0, actx)) { - ntfs_error(sb, "Index root attribute missing in inode 0x%lx.", - idx_ni->mft_no); - err = -EIO; + err = ntfs_attr_lookup(AT_INDEX_ROOT, idx_ni->name, idx_ni->name_len, + CASE_SENSITIVE, 0, NULL, 0, actx); + if (unlikely(err)) { + if (err == -ENOENT) { + ntfs_error(sb, "Index root attribute missing in inode " + "0x%lx.", idx_ni->mft_no); + err = -EIO; + } goto err_out; } /* Get to the index root value (it has been verified in read_inode). */ @@ -263,13 +265,13 @@ goto err_out; } /* Get the starting vcn of the index_block holding the child node. */ - vcn = sle64_to_cpup((u8*)ie + le16_to_cpu(ie->length) - 8); + vcn = sle64_to_cpup((sle64*)((u8*)ie + le16_to_cpu(ie->length) - 8)); ia_mapping = VFS_I(idx_ni)->i_mapping; /* * We are done with the index root and the mft record. Release them, * otherwise we deadlock with ntfs_map_page(). */ - put_attr_search_ctx(actx); + ntfs_attr_put_search_ctx(actx); unmap_mft_record(base_ni); m = NULL; actx = NULL; @@ -425,7 +427,7 @@ } /* Child node present, descend into it. */ old_vcn = vcn; - vcn = sle64_to_cpup((u8*)ie + le16_to_cpu(ie->length) - 8); + vcn = sle64_to_cpup((sle64*)((u8*)ie + le16_to_cpu(ie->length) - 8)); if (vcn >= 0) { /* * If vcn is in the same page cache page as old_vcn we recycle @@ -448,7 +450,7 @@ ntfs_unmap_page(page); err_out: if (actx) - put_attr_search_ctx(actx); + ntfs_attr_put_search_ctx(actx); if (m) unmap_mft_record(base_ni); return err; diff -Nru a/fs/ntfs/index.h b/fs/ntfs/index.h --- a/fs/ntfs/index.h 2004-09-26 10:25:57 -07:00 +++ b/fs/ntfs/index.h 2004-09-26 10:25:57 -07:00 @@ -78,7 +78,7 @@ u16 data_len; BOOL is_in_root; INDEX_ROOT *ir; - attr_search_context *actx; + ntfs_attr_search_ctx *actx; ntfs_inode *base_ni; INDEX_ALLOCATION *ia; struct page *page; diff -Nru a/fs/ntfs/inode.c b/fs/ntfs/inode.c --- a/fs/ntfs/inode.c 2004-09-26 10:25:57 -07:00 +++ b/fs/ntfs/inode.c 2004-09-26 10:25:57 -07:00 @@ -105,8 +105,11 @@ ni->name_len = na->name_len; /* If initializing a normal inode, we are done. */ - if (likely(na->type == AT_UNUSED)) + if (likely(na->type == AT_UNUSED)) { + BUG_ON(na->name); + BUG_ON(na->name_len); return 0; + } /* It is a fake inode. */ NInoSetAttr(ni); @@ -118,15 +121,16 @@ * thus the fraction of named attributes with name != I30 is actually * absolutely tiny. */ - if (na->name && na->name_len && na->name != I30) { + if (na->name_len && na->name != I30) { unsigned int i; + BUG_ON(!na->name); i = na->name_len * sizeof(ntfschar); ni->name = (ntfschar*)kmalloc(i + sizeof(ntfschar), GFP_ATOMIC); if (!ni->name) return -ENOMEM; memcpy(ni->name, na->name, i); - ni->name[i] = cpu_to_le16('\0'); + ni->name[i] = cpu_to_le16(0); } return 0; } @@ -210,7 +214,7 @@ * value with IS_ERR() and if true, the function failed and the error code is * obtained from PTR_ERR(). */ -struct inode *ntfs_attr_iget(struct inode *base_vi, ATTR_TYPES type, +struct inode *ntfs_attr_iget(struct inode *base_vi, ATTR_TYPE type, ntfschar *name, u32 name_len) { struct inode *vi; @@ -428,20 +432,21 @@ * Return values: * 1: file is in $Extend directory * 0: file is not in $Extend directory - * -EIO: file is corrupt + * -errno: failed to determine if the file is in the $Extend directory */ -static int ntfs_is_extended_system_file(attr_search_context *ctx) +static int ntfs_is_extended_system_file(ntfs_attr_search_ctx *ctx) { - int nr_links; + int nr_links, err; /* Restart search. */ - reinit_attr_search_ctx(ctx); + ntfs_attr_reinit_search_ctx(ctx); /* Get number of hard links. */ nr_links = le16_to_cpu(ctx->mrec->link_count); /* Loop through all hard links. */ - while (lookup_attr(AT_FILE_NAME, NULL, 0, 0, 0, NULL, 0, ctx)) { + while (!(err = ntfs_attr_lookup(AT_FILE_NAME, NULL, 0, 0, 0, NULL, 0, + ctx))) { FILE_NAME_ATTR *file_name_attr; ATTR_RECORD *attr = ctx->attr; u8 *p, *p2; @@ -484,7 +489,9 @@ if (MREF_LE(file_name_attr->parent_directory) == FILE_Extend) return 1; /* YES, it's an extended system file. */ } - if (nr_links) { + if (unlikely(err != -ENOENT)) + return err; + if (unlikely(nr_links)) { ntfs_error(ctx->ntfs_ino->vol->sb, "Inode hard link count " "doesn't match number of name attributes. You " "should run chkdsk."); @@ -525,7 +532,7 @@ ntfs_inode *ni; MFT_RECORD *m; STANDARD_INFORMATION *si; - attr_search_context *ctx; + ntfs_attr_search_ctx *ctx; int err = 0; ntfs_debug("Entering for i_ino 0x%lx.", vi->i_ino); @@ -557,7 +564,7 @@ err = PTR_ERR(m); goto err_out; } - ctx = get_attr_search_ctx(ni, m); + ctx = ntfs_attr_get_search_ctx(ni, m); if (!ctx) { err = -ENOMEM; goto unm_err_out; @@ -608,14 +615,18 @@ * in fact fail if the standard information is in an extent record, but * I don't think this actually ever happens. */ - if (!lookup_attr(AT_STANDARD_INFORMATION, NULL, 0, 0, 0, NULL, 0, - ctx)) { - /* - * TODO: We should be performing a hot fix here (if the recover - * mount option is set) by creating a new attribute. - */ - ntfs_error(vi->i_sb, "$STANDARD_INFORMATION attribute is " - "missing."); + err = ntfs_attr_lookup(AT_STANDARD_INFORMATION, NULL, 0, 0, 0, NULL, 0, + ctx); + if (unlikely(err)) { + if (err == -ENOENT) { + /* + * TODO: We should be performing a hot fix here (if the + * recover mount option is set) by creating a new + * attribute. + */ + ntfs_error(vi->i_sb, "$STANDARD_INFORMATION attribute " + "is missing."); + } goto unm_err_out; } /* Get the standard information attribute value. */ @@ -646,8 +657,15 @@ vi->i_atime = ntfs2utc(si->last_access_time); /* Find the attribute list attribute if present. */ - reinit_attr_search_ctx(ctx); - if (lookup_attr(AT_ATTRIBUTE_LIST, NULL, 0, 0, 0, NULL, 0, ctx)) { + ntfs_attr_reinit_search_ctx(ctx); + err = ntfs_attr_lookup(AT_ATTRIBUTE_LIST, NULL, 0, 0, 0, NULL, 0, ctx); + if (err) { + if (unlikely(err != -ENOENT)) { + ntfs_error(vi->i_sb, "Failed to lookup attribute list " + "attribute. You should run chkdsk."); + goto unm_err_out; + } + } else /* if (!err) */ { if (vi->i_ino == FILE_MFT) goto skip_attr_list_load; ntfs_debug("Attribute list found in inode 0x%lx.", vi->i_ino); @@ -662,7 +680,7 @@ goto unm_err_out; } /* Now allocate memory for the attribute list. */ - ni->attr_list_size = (u32)attribute_value_length(ctx->attr); + ni->attr_list_size = (u32)ntfs_attr_size(ctx->attr); ni->attr_list = ntfs_malloc_nofs(ni->attr_list_size); if (!ni->attr_list) { ntfs_error(vi->i_sb, "Not enough memory to allocate " @@ -733,13 +751,17 @@ char *ir_end, *index_end; /* It is a directory, find index root attribute. */ - reinit_attr_search_ctx(ctx); - if (!lookup_attr(AT_INDEX_ROOT, I30, 4, CASE_SENSITIVE, 0, - NULL, 0, ctx)) { - // FIXME: File is corrupt! Hot-fix with empty index - // root attribute if recovery option is set. - ntfs_error(vi->i_sb, "$INDEX_ROOT attribute is " - "missing."); + ntfs_attr_reinit_search_ctx(ctx); + err = ntfs_attr_lookup(AT_INDEX_ROOT, I30, 4, CASE_SENSITIVE, + 0, NULL, 0, ctx); + if (unlikely(err)) { + if (err == -ENOENT) { + // FIXME: File is corrupt! Hot-fix with empty + // index root attribute if recovery option is + // set. + ntfs_error(vi->i_sb, "$INDEX_ROOT attribute " + "is missing."); + } goto unm_err_out; } /* Set up the state. */ @@ -841,7 +863,7 @@ vi->i_size = ni->initialized_size = ni->allocated_size = 0; /* We are done with the mft record, so we release it. */ - put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); unmap_mft_record(ni); m = NULL; ctx = NULL; @@ -849,12 +871,19 @@ } /* LARGE_INDEX: Index allocation present. Setup state. */ NInoSetIndexAllocPresent(ni); /* Find index allocation attribute. */ - reinit_attr_search_ctx(ctx); - if (!lookup_attr(AT_INDEX_ALLOCATION, I30, 4, CASE_SENSITIVE, - 0, NULL, 0, ctx)) { - ntfs_error(vi->i_sb, "$INDEX_ALLOCATION attribute " - "is not present but $INDEX_ROOT " - "indicated it is."); + ntfs_attr_reinit_search_ctx(ctx); + err = ntfs_attr_lookup(AT_INDEX_ALLOCATION, I30, 4, + CASE_SENSITIVE, 0, NULL, 0, ctx); + if (unlikely(err)) { + if (err == -ENOENT) + ntfs_error(vi->i_sb, "$INDEX_ALLOCATION " + "attribute is not present but " + "$INDEX_ROOT indicated it " + "is."); + else + ntfs_error(vi->i_sb, "Failed to lookup " + "$INDEX_ALLOCATION " + "attribute."); goto unm_err_out; } if (!ctx->attr->non_resident) { @@ -894,7 +923,7 @@ * We are done with the mft record, so we release it. Otherwise * we would deadlock in ntfs_attr_iget(). */ - put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); unmap_mft_record(ni); m = NULL; ctx = NULL; @@ -938,7 +967,7 @@ vi->i_mapping->a_ops = &ntfs_mst_aops; } else { /* It is a file. */ - reinit_attr_search_ctx(ctx); + ntfs_attr_reinit_search_ctx(ctx); /* Setup the data attribute, even if not present. */ ni->type = AT_DATA; @@ -946,9 +975,15 @@ ni->name_len = 0; /* Find first extent of the unnamed data attribute. */ - if (!lookup_attr(AT_DATA, NULL, 0, 0, 0, NULL, 0, ctx)) { + err = ntfs_attr_lookup(AT_DATA, NULL, 0, 0, 0, NULL, 0, ctx); + if (unlikely(err)) { vi->i_size = ni->initialized_size = - ni->allocated_size = 0LL; + ni->allocated_size = 0; + if (err != -ENOENT) { + ntfs_error(vi->i_sb, "Failed to lookup $DATA " + "attribute."); + goto unm_err_out; + } /* * FILE_Secure does not have an unnamed $DATA * attribute, so we special case it here. @@ -1059,7 +1094,7 @@ } no_data_attr_special_case: /* We are done with the mft record, so we release it. */ - put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); unmap_mft_record(ni); m = NULL; ctx = NULL; @@ -1098,7 +1133,7 @@ if (!err) err = -EIO; if (ctx) - put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); if (m) unmap_mft_record(ni); err_out: @@ -1133,7 +1168,7 @@ ntfs_volume *vol = NTFS_SB(vi->i_sb); ntfs_inode *ni, *base_ni; MFT_RECORD *m; - attr_search_context *ctx; + ntfs_attr_search_ctx *ctx; int err = 0; ntfs_debug("Entering for i_ino 0x%lx.", vi->i_ino); @@ -1162,15 +1197,16 @@ err = PTR_ERR(m); goto err_out; } - ctx = get_attr_search_ctx(base_ni, m); + ctx = ntfs_attr_get_search_ctx(base_ni, m); if (!ctx) { err = -ENOMEM; goto unm_err_out; } /* Find the attribute. */ - if (!lookup_attr(ni->type, ni->name, ni->name_len, CASE_SENSITIVE, 0, - NULL, 0, ctx)) + err = ntfs_attr_lookup(ni->type, ni->name, ni->name_len, + CASE_SENSITIVE, 0, NULL, 0, ctx); + if (unlikely(err)) goto unm_err_out; if (!ctx->attr->non_resident) { @@ -1333,7 +1369,7 @@ ni->ext.base_ntfs_ino = base_ni; ni->nr_extents = -1; - put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); unmap_mft_record(base_ni); ntfs_debug("Done."); @@ -1343,7 +1379,7 @@ if (!err) err = -EIO; if (ctx) - put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); unmap_mft_record(base_ni); err_out: ntfs_error(vi->i_sb, "Failed with error code %i while reading " @@ -1392,7 +1428,7 @@ ntfs_inode *ni, *base_ni, *bni; struct inode *bvi; MFT_RECORD *m; - attr_search_context *ctx; + ntfs_attr_search_ctx *ctx; INDEX_ROOT *ir; u8 *ir_end, *index_end; int err = 0; @@ -1419,15 +1455,18 @@ err = PTR_ERR(m); goto err_out; } - ctx = get_attr_search_ctx(base_ni, m); + ctx = ntfs_attr_get_search_ctx(base_ni, m); if (!ctx) { err = -ENOMEM; goto unm_err_out; } /* Find the index root attribute. */ - if (!lookup_attr(AT_INDEX_ROOT, ni->name, ni->name_len, CASE_SENSITIVE, - 0, NULL, 0, ctx)) { - ntfs_error(vi->i_sb, "$INDEX_ROOT attribute is missing."); + err = ntfs_attr_lookup(AT_INDEX_ROOT, ni->name, ni->name_len, + CASE_SENSITIVE, 0, NULL, 0, ctx); + if (unlikely(err)) { + if (err == -ENOENT) + ntfs_error(vi->i_sb, "$INDEX_ROOT attribute is " + "missing."); goto unm_err_out; } /* Set up the state. */ @@ -1497,7 +1536,7 @@ /* No index allocation. */ vi->i_size = ni->initialized_size = ni->allocated_size = 0; /* We are done with the mft record, so we release it. */ - put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); unmap_mft_record(base_ni); m = NULL; ctx = NULL; @@ -1505,11 +1544,17 @@ } /* LARGE_INDEX: Index allocation present. Setup state. */ NInoSetIndexAllocPresent(ni); /* Find index allocation attribute. */ - reinit_attr_search_ctx(ctx); - if (!lookup_attr(AT_INDEX_ALLOCATION, ni->name, ni->name_len, - CASE_SENSITIVE, 0, NULL, 0, ctx)) { - ntfs_error(vi->i_sb, "$INDEX_ALLOCATION attribute is not " - "present but $INDEX_ROOT indicated it is."); + ntfs_attr_reinit_search_ctx(ctx); + err = ntfs_attr_lookup(AT_INDEX_ALLOCATION, ni->name, ni->name_len, + CASE_SENSITIVE, 0, NULL, 0, ctx); + if (unlikely(err)) { + if (err == -ENOENT) + ntfs_error(vi->i_sb, "$INDEX_ALLOCATION attribute is " + "not present but $INDEX_ROOT " + "indicated it is."); + else + ntfs_error(vi->i_sb, "Failed to lookup " + "$INDEX_ALLOCATION attribute."); goto unm_err_out; } if (!ctx->attr->non_resident) { @@ -1546,7 +1591,7 @@ * We are done with the mft record, so we release it. Otherwise * we would deadlock in ntfs_attr_iget(). */ - put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); unmap_mft_record(base_ni); m = NULL; ctx = NULL; @@ -1597,7 +1642,7 @@ if (!err) err = -EIO; if (ctx) - put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); if (m) unmap_mft_record(base_ni); err_out: @@ -1619,16 +1664,16 @@ * is not initialized and hence we cannot get at the contents of mft records * by calling map_mft_record*(). * - * Further it needs to cope with the circular references problem, i.e. can't + * Further it needs to cope with the circular references problem, i.e. cannot * load any attributes other than $ATTRIBUTE_LIST until $DATA is loaded, because - * we don't know where the other extent mft records are yet and again, because - * we cannot call map_mft_record*() yet. Obviously this applies only when an + * we do not know where the other extent mft records are yet and again, because + * we cannot call map_mft_record*() yet. Obviously this applies only when an * attribute list is actually present in $MFT inode. * * We solve these problems by starting with the $DATA attribute before anything - * else and iterating using lookup_attr($DATA) over all extents. As each extent - * is found, we decompress_mapping_pairs() including the implied - * merge_runlists(). Each step of the iteration necessarily provides + * else and iterating using ntfs_attr_lookup($DATA) over all extents. As each + * extent is found, we decompress_mapping_pairs() including the implied + * ntfs_merge_runlists(). Each step of the iteration necessarily provides * sufficient information for the next step to complete. * * This should work but there are two possible pit falls (see inline comments @@ -1644,7 +1689,7 @@ ntfs_inode *ni; MFT_RECORD *m = NULL; ATTR_RECORD *attr; - attr_search_context *ctx; + ntfs_attr_search_ctx *ctx; unsigned int i, nr_blocks; int err; @@ -1719,14 +1764,21 @@ /* Provides readpage() and sync_page() for map_mft_record(). */ vi->i_mapping->a_ops = &ntfs_mft_aops; - ctx = get_attr_search_ctx(ni, m); + ctx = ntfs_attr_get_search_ctx(ni, m); if (!ctx) { err = -ENOMEM; goto err_out; } /* Find the attribute list attribute if present. */ - if (lookup_attr(AT_ATTRIBUTE_LIST, NULL, 0, 0, 0, NULL, 0, ctx)) { + err = ntfs_attr_lookup(AT_ATTRIBUTE_LIST, NULL, 0, 0, 0, NULL, 0, ctx); + if (err) { + if (unlikely(err != -ENOENT)) { + ntfs_error(sb, "Failed to lookup attribute list " + "attribute. You should run chkdsk."); + goto put_err_out; + } + } else /* if (!err) */ { ATTR_LIST_ENTRY *al_entry, *next_al_entry; u8 *al_end; @@ -1742,7 +1794,7 @@ goto put_err_out; } /* Now allocate memory for the attribute list. */ - ni->attr_list_size = (u32)attribute_value_length(ctx->attr); + ni->attr_list_size = (u32)ntfs_attr_size(ctx->attr); ni->attr_list = ntfs_malloc_nofs(ni->attr_list_size); if (!ni->attr_list) { ntfs_error(sb, "Not enough memory to allocate buffer " @@ -1855,12 +1907,13 @@ } } - reinit_attr_search_ctx(ctx); + ntfs_attr_reinit_search_ctx(ctx); /* Now load all attribute extents. */ attr = NULL; next_vcn = last_vcn = highest_vcn = 0; - while (lookup_attr(AT_DATA, NULL, 0, 0, next_vcn, NULL, 0, ctx)) { + while (!(err = ntfs_attr_lookup(AT_DATA, NULL, 0, 0, next_vcn, NULL, 0, + ctx))) { runlist_element *nrl; /* Cache the current attribute. */ @@ -1900,8 +1953,6 @@ /* Are we in the first extent? */ if (!next_vcn) { - u64 ll; - if (attr->data.non_resident.lowest_vcn) { ntfs_error(sb, "First extent of $DATA " "attribute has non zero " @@ -1920,17 +1971,15 @@ non_resident.initialized_size); ni->allocated_size = sle64_to_cpu( attr->data.non_resident.allocated_size); - /* Set the number of mft records. */ - ll = vi->i_size >> vol->mft_record_size_bits; /* * Verify the number of mft records does not exceed * 2^32 - 1. */ - if (ll >= (1ULL << 32)) { + if ((vi->i_size >> vol->mft_record_size_bits) >= + (1ULL << 32)) { ntfs_error(sb, "$MFT is too big! Aborting."); goto put_err_out; } - vol->nr_mft_records = ll; /* * We have got the first extent of the runlist for * $MFT which means it is now relatively safe to call @@ -1959,7 +2008,7 @@ "saw this message to " "linux-ntfs-dev@lists." "sourceforge.net"); - put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); /* Revert to the safe super operations. */ ntfs_free(m); return -1; @@ -1995,21 +2044,26 @@ goto put_err_out; } } + if (err != -ENOENT) { + ntfs_error(sb, "Failed to lookup $MFT/$DATA attribute extent. " + "$MFT is corrupt. Run chkdsk."); + goto put_err_out; + } if (!attr) { ntfs_error(sb, "$MFT/$DATA attribute not found. $MFT is " "corrupt. Run chkdsk."); goto put_err_out; } if (highest_vcn && highest_vcn != last_vcn - 1) { - ntfs_error(sb, "Failed to load the complete runlist " - "for $MFT/$DATA. Driver bug or " - "corrupt $MFT. Run chkdsk."); + ntfs_error(sb, "Failed to load the complete runlist for " + "$MFT/$DATA. Driver bug or corrupt $MFT. " + "Run chkdsk."); ntfs_debug("highest_vcn = 0x%llx, last_vcn - 1 = 0x%llx", (unsigned long long)highest_vcn, (unsigned long long)last_vcn - 1); goto put_err_out; } - put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); ntfs_debug("Done."); ntfs_free(m); return 0; @@ -2018,7 +2072,7 @@ ntfs_error(sb, "Couldn't find first extent of $DATA attribute in " "attribute list. $MFT is corrupt. Run chkdsk."); put_err_out: - put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); err_out: ntfs_error(sb, "Failed. Marking inode as bad."); make_bad_inode(vi); @@ -2216,16 +2270,71 @@ * * We don't support i_size changes yet. * - * Called with ->i_sem held. + * The kernel guarantees that @vi is a regular file (S_ISREG() is true) and + * that the change is allowed. + * + * This implies for us that @vi is a file inode rather than a directory, index, + * or attribute inode as well as that @vi is a base inode. + * + * Called with ->i_sem held. In all but one case ->i_alloc_sem is held for + * writing. The only case where ->i_alloc_sem is not held is + * mm/filemap.c::generic_file_buffered_write() where vmtruncate() is called + * with the current i_size as the offset which means that it is a noop as far + * as ntfs_truncate() is concerned. */ void ntfs_truncate(struct inode *vi) { - // TODO: Implement... - ntfs_warning(vi->i_sb, "Eeek: i_size may have changed! If you see " - "this right after a message from " - "ntfs_{prepare,commit}_{,nonresident_}write() then " - "just ignore it. Otherwise it is bad news."); - // TODO: reset i_size now! + ntfs_inode *ni = NTFS_I(vi); + ntfs_attr_search_ctx *ctx; + MFT_RECORD *m; + int err; + + m = map_mft_record(ni); + if (IS_ERR(m)) { + ntfs_error(vi->i_sb, "Failed to map mft record for inode 0x%lx " + "(error code %ld).", vi->i_ino, PTR_ERR(m)); + if (PTR_ERR(m) != ENOMEM) + make_bad_inode(vi); + return; + } + ctx = ntfs_attr_get_search_ctx(ni, m); + if (unlikely(!ctx)) { + ntfs_error(vi->i_sb, "Failed to allocate a search context: " + "Not enough memory"); + // FIXME: We can't report an error code upstream. So what do + // we do?!? make_bad_inode() seems a bit harsh... + unmap_mft_record(ni); + return; + } + err = ntfs_attr_lookup(ni->type, ni->name, ni->name_len, + CASE_SENSITIVE, 0, NULL, 0, ctx); + if (unlikely(err)) { + if (err == -ENOENT) { + ntfs_error(vi->i_sb, "Open attribute is missing from " + "mft record. Inode 0x%lx is corrupt. " + "Run chkdsk.", vi->i_ino); + make_bad_inode(vi); + } else { + ntfs_error(vi->i_sb, "Failed to lookup attribute in " + "inode 0x%lx (error code %d).", + vi->i_ino, err); + // FIXME: We can't report an error code upstream. So + // what do we do?!? make_bad_inode() seems a bit + // harsh... + } + goto out; + } + /* If the size has not changed there is nothing to do. */ + if (ntfs_attr_size(ctx->attr) == i_size_read(vi)) + goto out; + // TODO: Implement the truncate... + ntfs_error(vi->i_sb, "Inode size has changed but this is not " + "implemented yet. Resetting inode size to old value. " + " This is most likely a bug in the ntfs driver!"); + i_size_write(vi, ntfs_attr_size(ctx->attr)); +out: + ntfs_attr_put_search_ctx(ctx); + unmap_mft_record(ni); return; } @@ -2235,67 +2344,62 @@ * @attr: structure describing the attributes and the changes * * We have to trap VFS attempts to truncate the file described by @dentry as - * soon as possible, because we do not implement changes in i_size yet. So we + * soon as possible, because we do not implement changes in i_size yet. So we * abort all i_size changes here. * - * Called with ->i_sem held. + * We also abort all changes of user, group, and mode as we do not implement + * the NTFS ACLs yet. + * + * Called with ->i_sem held. For the ATTR_SIZE (i.e. ->truncate) case, also + * called with ->i_alloc_sem held for writing. * * Basically this is a copy of generic notify_change() and inode_setattr() * functionality, except we intercept and abort changes in i_size. */ int ntfs_setattr(struct dentry *dentry, struct iattr *attr) { - struct inode *vi; + struct inode *vi = dentry->d_inode; int err; unsigned int ia_valid = attr->ia_valid; - vi = dentry->d_inode; - err = inode_change_ok(vi, attr); if (err) return err; - if ((ia_valid & ATTR_UID && attr->ia_uid != vi->i_uid) || - (ia_valid & ATTR_GID && attr->ia_gid != vi->i_gid)) { - err = DQUOT_TRANSFER(vi, attr) ? -EDQUOT : 0; - if (err) - return err; + /* We do not support NTFS ACLs yet. */ + if (ia_valid & (ATTR_UID | ATTR_GID | ATTR_MODE)) { + ntfs_warning(vi->i_sb, "Changes in user/group/mode are not " + "supported yet, ignoring."); + err = -EOPNOTSUPP; + goto out; } - lock_kernel(); - if (ia_valid & ATTR_SIZE) { - ntfs_error(vi->i_sb, "Changes in i_size are not supported " - "yet. Sorry."); - // TODO: Implement... - // err = vmtruncate(vi, attr->ia_size); - err = -EOPNOTSUPP; - if (err) - goto trunc_err; + if (attr->ia_size != i_size_read(vi)) { + ntfs_warning(vi->i_sb, "Changes in inode size are not " + "supported yet, ignoring."); + err = -EOPNOTSUPP; + // TODO: Implement... + // err = vmtruncate(vi, attr->ia_size); + if (err || ia_valid == ATTR_SIZE) + goto out; + } else { + /* + * We skipped the truncate but must still update + * timestamps. + */ + ia_valid |= ATTR_MTIME|ATTR_CTIME; + } } - if (ia_valid & ATTR_UID) - vi->i_uid = attr->ia_uid; - if (ia_valid & ATTR_GID) - vi->i_gid = attr->ia_gid; if (ia_valid & ATTR_ATIME) vi->i_atime = attr->ia_atime; if (ia_valid & ATTR_MTIME) vi->i_mtime = attr->ia_mtime; if (ia_valid & ATTR_CTIME) vi->i_ctime = attr->ia_ctime; - if (ia_valid & ATTR_MODE) { - vi->i_mode = attr->ia_mode; - if (!in_group_p(vi->i_gid) && - !capable(CAP_FSETID)) - vi->i_mode &= ~S_ISGID; - } mark_inode_dirty(vi); - -trunc_err: - - unlock_kernel(); - +out: return err; } @@ -2319,9 +2423,9 @@ */ int ntfs_write_inode(struct inode *vi, int sync) { - s64 nt; + sle64 nt; ntfs_inode *ni = NTFS_I(vi); - attr_search_context *ctx; + ntfs_attr_search_ctx *ctx; MFT_RECORD *m; STANDARD_INFORMATION *si; int err = 0; @@ -2346,15 +2450,15 @@ goto err_out; } /* Update the access times in the standard information attribute. */ - ctx = get_attr_search_ctx(ni, m); + ctx = ntfs_attr_get_search_ctx(ni, m); if (unlikely(!ctx)) { err = -ENOMEM; goto unm_err_out; } - if (unlikely(!lookup_attr(AT_STANDARD_INFORMATION, NULL, 0, - CASE_SENSITIVE, 0, NULL, 0, ctx))) { - put_attr_search_ctx(ctx); - err = -ENOENT; + err = ntfs_attr_lookup(AT_STANDARD_INFORMATION, NULL, 0, + CASE_SENSITIVE, 0, NULL, 0, ctx); + if (unlikely(err)) { + ntfs_attr_put_search_ctx(ctx); goto unm_err_out; } si = (STANDARD_INFORMATION*)((u8*)ctx->attr + @@ -2399,7 +2503,7 @@ */ if (modified && !NInoTestSetDirty(ctx->ntfs_ino)) __set_page_dirty_nobuffers(ctx->ntfs_ino->page); - put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); /* Now the access times are updated, write the base mft record. */ if (NInoDirty(ni)) err = write_mft_record(ni, m, sync); @@ -2451,30 +2555,6 @@ make_bad_inode(vi); } return err; -} - -/** - * ntfs_write_inode_vfs - write out a dirty inode - * @vi: inode to write out - * @sync: if true, write out synchronously - * - * Write out a dirty inode to disk including any extent inodes if present. - * - * If @sync is true, commit the inode to disk and wait for io completion. This - * is done using write_mft_record(). - * - * If @sync is false, just schedule the write to happen but do not wait for i/o - * completion. In 2.6 kernels, scheduling usually happens just by virtue of - * marking the page (and in this case mft record) dirty but we do not implement - * this yet as write_mft_record() largely ignores the @sync parameter and - * always performs synchronous writes. - * - * This functions does not have a return value which is the required behaviour - * for the VFS super_operations ->dirty_inode function. - */ -void ntfs_write_inode_vfs(struct inode *vi, int sync) -{ - ntfs_write_inode(vi, sync); } #endif /* NTFS_RW */ diff -Nru a/fs/ntfs/inode.h b/fs/ntfs/inode.h --- a/fs/ntfs/inode.h 2004-09-26 10:25:57 -07:00 +++ b/fs/ntfs/inode.h 2004-09-26 10:25:57 -07:00 @@ -53,7 +53,7 @@ * name_len = 0 for files and name = I30 (global constant) and * name_len = 4 for directories. */ - ATTR_TYPES type; /* Attribute type of this fake inode. */ + ATTR_TYPE type; /* Attribute type of this fake inode. */ ntfschar *name; /* Attribute name of this fake inode. */ u32 name_len; /* Attribute name length of this fake inode. */ runlist runlist; /* If state has the NI_NonResident bit set, @@ -96,7 +96,7 @@ u32 block_size; /* Size of an index block. */ u32 vcn_size; /* Size of a vcn in this index. */ - COLLATION_RULES collation_rule; /* The collation rule + COLLATION_RULE collation_rule; /* The collation rule for the index. */ u8 block_size_bits; /* Log2 of the above. */ u8 vcn_size_bits; /* Log2 of the above. */ @@ -252,7 +252,7 @@ unsigned long mft_no; ntfschar *name; u32 name_len; - ATTR_TYPES type; + ATTR_TYPE type; } ntfs_attr; typedef int (*test_t)(struct inode *, void *); @@ -260,7 +260,7 @@ extern int ntfs_test_inode(struct inode *vi, ntfs_attr *na); extern struct inode *ntfs_iget(struct super_block *sb, unsigned long mft_no); -extern struct inode *ntfs_attr_iget(struct inode *base_vi, ATTR_TYPES type, +extern struct inode *ntfs_attr_iget(struct inode *base_vi, ATTR_TYPE type, ntfschar *name, u32 name_len); extern struct inode *ntfs_index_iget(struct inode *base_vi, ntfschar *name, u32 name_len); @@ -286,7 +286,6 @@ extern int ntfs_setattr(struct dentry *dentry, struct iattr *attr); extern int ntfs_write_inode(struct inode *vi, int sync); -extern void ntfs_write_inode_vfs(struct inode *vi, int sync); static inline void ntfs_commit_inode(struct inode *vi) { diff -Nru a/fs/ntfs/layout.h b/fs/ntfs/layout.h --- a/fs/ntfs/layout.h 2004-09-26 10:25:56 -07:00 +++ b/fs/ntfs/layout.h 2004-09-26 10:25:56 -07:00 @@ -60,18 +60,18 @@ * BIOS parameter block (bpb) structure. */ typedef struct { - u16 bytes_per_sector; /* Size of a sector in bytes. */ + le16 bytes_per_sector; /* Size of a sector in bytes. */ u8 sectors_per_cluster; /* Size of a cluster in sectors. */ - u16 reserved_sectors; /* zero */ + le16 reserved_sectors; /* zero */ u8 fats; /* zero */ - u16 root_entries; /* zero */ - u16 sectors; /* zero */ + le16 root_entries; /* zero */ + le16 sectors; /* zero */ u8 media_type; /* 0xf8 = hard disk */ - u16 sectors_per_fat; /* zero */ - u16 sectors_per_track; /* irrelevant */ - u16 heads; /* irrelevant */ - u32 hidden_sectors; /* zero */ - u32 large_sectors; /* zero */ + le16 sectors_per_fat; /* zero */ + le16 sectors_per_track; /* irrelevant */ + le16 heads; /* irrelevant */ + le32 hidden_sectors; /* zero */ + le32 large_sectors; /* zero */ } __attribute__ ((__packed__)) BIOS_PARAMETER_BLOCK; /* @@ -79,7 +79,7 @@ */ typedef struct { u8 jump[3]; /* Irrelevant (jump to boot up code).*/ - u64 oem_id; /* Magic "NTFS ". */ + le64 oem_id; /* Magic "NTFS ". */ BIOS_PARAMETER_BLOCK bpb; /* See BIOS_PARAMETER_BLOCK. */ u8 unused[4]; /* zero, NTFS diskedit.exe states that this is actually: @@ -89,21 +89,21 @@ // 0x80 __u8 unused; // zero */ -/*0x28*/s64 number_of_sectors; /* Number of sectors in volume. Gives +/*0x28*/sle64 number_of_sectors; /* Number of sectors in volume. Gives maximum volume size of 2^63 sectors. Assuming standard sector size of 512 bytes, the maximum byte size is approx. 4.7x10^21 bytes. (-; */ - s64 mft_lcn; /* Cluster location of mft data. */ - s64 mftmirr_lcn; /* Cluster location of copy of mft. */ + sle64 mft_lcn; /* Cluster location of mft data. */ + sle64 mftmirr_lcn; /* Cluster location of copy of mft. */ s8 clusters_per_mft_record; /* Mft record size in clusters. */ u8 reserved0[3]; /* zero */ s8 clusters_per_index_record; /* Index block size in clusters. */ u8 reserved1[3]; /* zero */ - u64 volume_serial_number; /* Irrelevant (serial number). */ - u32 checksum; /* Boot sector checksum. */ + le64 volume_serial_number; /* Irrelevant (serial number). */ + le32 checksum; /* Boot sector checksum. */ /*0x54*/u8 bootstrap[426]; /* Irrelevant (boot up code). */ - u16 end_of_sector_marker; /* End of bootsector magic. Always is + le16 end_of_sector_marker; /* End of bootsector magic. Always is 0xaa55 in little endian. */ /* sizeof() = 512 (0x200) bytes */ } __attribute__ ((__packed__)) NTFS_BOOT_SECTOR; @@ -112,88 +112,95 @@ * Magic identifiers present at the beginning of all ntfs record containing * records (like mft records for example). */ -typedef enum { - /* Found in $MFT/$DATA. */ - magic_FILE = const_cpu_to_le32(0x454c4946), /* Mft entry. */ - magic_INDX = const_cpu_to_le32(0x58444e49), /* Index buffer. */ - magic_HOLE = const_cpu_to_le32(0x454c4f48), /* ? (NTFS 3.0+?) */ - - /* Found in $LogFile/$DATA. */ - magic_RSTR = const_cpu_to_le32(0x52545352), /* Restart page. */ - magic_RCRD = const_cpu_to_le32(0x44524352), /* Log record page. */ - - /* Found in $LogFile/$DATA. (May be found in $MFT/$DATA, also?) */ - magic_CHKD = const_cpu_to_le32(0x424b4843), /* Modified by chkdsk. */ - - /* Found in all ntfs record containing records. */ - magic_BAAD = const_cpu_to_le32(0x44414142), /* Failed multi sector - transfer was detected. */ - - /* - * Found in $LogFile/$DATA when a page is full or 0xff bytes and is - * thus not initialized. User has to initialize the page before using - * it. - */ - magic_empty = const_cpu_to_le32(0xffffffff),/* Record is empty and has - to be initialized before - it can be used. */ -} NTFS_RECORD_TYPES; +/* Found in $MFT/$DATA. */ +#define magic_FILE const_cpu_to_le32(0x454c4946) /* Mft entry. */ +#define magic_INDX const_cpu_to_le32(0x58444e49) /* Index buffer. */ +#define magic_HOLE const_cpu_to_le32(0x454c4f48) /* ? (NTFS 3.0+?) */ + +/* Found in $LogFile/$DATA. */ +#define magic_RSTR const_cpu_to_le32(0x52545352) /* Restart page. */ +#define magic_RCRD const_cpu_to_le32(0x44524352) /* Log record page. */ + +/* Found in $LogFile/$DATA. (May be found in $MFT/$DATA, also?) */ +#define magic_CHKD const_cpu_to_le32(0x424b4843) /* Modified by chkdsk. */ + +/* Found in all ntfs record containing records. */ +#define magic_BAAD const_cpu_to_le32(0x44414142) /* Failed multi sector + transfer was detected. */ +/* + * Found in $LogFile/$DATA when a page is full or 0xff bytes and is thus not + * initialized. User has to initialize the page before using it. + */ +#define magic_empty const_cpu_to_le32(0xffffffff)/* Record is empty and has to + be initialized before it + can be used. */ +typedef le32 NTFS_RECORD_TYPE; /* * Generic magic comparison macros. Finally found a use for the ## preprocessor * operator! (-8 */ -#define ntfs_is_magic(x, m) ( (u32)(x) == magic_##m ) -#define ntfs_is_magicp(p, m) ( *(u32*)(p) == magic_##m ) -/* - * Specialised magic comparison macros for the NTFS_RECORD_TYPES defined above. - */ -#define ntfs_is_file_record(x) ( ntfs_is_magic (x, FILE) ) -#define ntfs_is_file_recordp(p) ( ntfs_is_magicp(p, FILE) ) -#define ntfs_is_mft_record(x) ( ntfs_is_file_record(x) ) -#define ntfs_is_mft_recordp(p) ( ntfs_is_file_recordp(p) ) -#define ntfs_is_indx_record(x) ( ntfs_is_magic (x, INDX) ) -#define ntfs_is_indx_recordp(p) ( ntfs_is_magicp(p, INDX) ) -#define ntfs_is_hole_record(x) ( ntfs_is_magic (x, HOLE) ) -#define ntfs_is_hole_recordp(p) ( ntfs_is_magicp(p, HOLE) ) - -#define ntfs_is_rstr_record(x) ( ntfs_is_magic (x, RSTR) ) -#define ntfs_is_rstr_recordp(p) ( ntfs_is_magicp(p, RSTR) ) -#define ntfs_is_rcrd_record(x) ( ntfs_is_magic (x, RCRD) ) -#define ntfs_is_rcrd_recordp(p) ( ntfs_is_magicp(p, RCRD) ) +static inline BOOL __ntfs_is_magic(le32 x, NTFS_RECORD_TYPE r) +{ + return (x == (__force le32)r); +} +#define ntfs_is_magic(x, m) __ntfs_is_magic(x, magic_##m) + +static inline BOOL __ntfs_is_magicp(le32 *p, NTFS_RECORD_TYPE r) +{ + return (*p == (__force le32)r); +} +#define ntfs_is_magicp(p, m) __ntfs_is_magicp(p, magic_##m) + +/* + * Specialised magic comparison macros for the NTFS_RECORD_TYPEs defined above. + */ +#define ntfs_is_file_record(x) ( ntfs_is_magic (x, FILE) ) +#define ntfs_is_file_recordp(p) ( ntfs_is_magicp(p, FILE) ) +#define ntfs_is_mft_record(x) ( ntfs_is_file_record (x) ) +#define ntfs_is_mft_recordp(p) ( ntfs_is_file_recordp(p) ) +#define ntfs_is_indx_record(x) ( ntfs_is_magic (x, INDX) ) +#define ntfs_is_indx_recordp(p) ( ntfs_is_magicp(p, INDX) ) +#define ntfs_is_hole_record(x) ( ntfs_is_magic (x, HOLE) ) +#define ntfs_is_hole_recordp(p) ( ntfs_is_magicp(p, HOLE) ) + +#define ntfs_is_rstr_record(x) ( ntfs_is_magic (x, RSTR) ) +#define ntfs_is_rstr_recordp(p) ( ntfs_is_magicp(p, RSTR) ) +#define ntfs_is_rcrd_record(x) ( ntfs_is_magic (x, RCRD) ) +#define ntfs_is_rcrd_recordp(p) ( ntfs_is_magicp(p, RCRD) ) -#define ntfs_is_chkd_record(x) ( ntfs_is_magic (x, CHKD) ) -#define ntfs_is_chkd_recordp(p) ( ntfs_is_magicp(p, CHKD) ) +#define ntfs_is_chkd_record(x) ( ntfs_is_magic (x, CHKD) ) +#define ntfs_is_chkd_recordp(p) ( ntfs_is_magicp(p, CHKD) ) -#define ntfs_is_baad_record(x) ( ntfs_is_magic (x, BAAD) ) -#define ntfs_is_baad_recordp(p) ( ntfs_is_magicp(p, BAAD) ) +#define ntfs_is_baad_record(x) ( ntfs_is_magic (x, BAAD) ) +#define ntfs_is_baad_recordp(p) ( ntfs_is_magicp(p, BAAD) ) #define ntfs_is_empty_record(x) ( ntfs_is_magic (x, empty) ) #define ntfs_is_empty_recordp(p) ( ntfs_is_magicp(p, empty) ) /* - * The Update Sequence Array (usa) is an array of the u16 values which belong + * The Update Sequence Array (usa) is an array of the le16 values which belong * to the end of each sector protected by the update sequence record in which * this array is contained. Note that the first entry is the Update Sequence * Number (usn), a cyclic counter of how many times the protected record has * been written to disk. The values 0 and -1 (ie. 0xffff) are not used. All - * last u16's of each sector have to be equal to the usn (during reading) or + * last le16's of each sector have to be equal to the usn (during reading) or * are set to it (during writing). If they are not, an incomplete multi sector * transfer has occurred when the data was written. * The maximum size for the update sequence array is fixed to: * maximum size = usa_ofs + (usa_count * 2) = 510 bytes - * The 510 bytes comes from the fact that the last u16 in the array has to - * (obviously) finish before the last u16 of the first 512-byte sector. + * The 510 bytes comes from the fact that the last le16 in the array has to + * (obviously) finish before the last le16 of the first 512-byte sector. * This formula can be used as a consistency check in that usa_ofs + * (usa_count * 2) has to be less than or equal to 510. */ typedef struct { - NTFS_RECORD_TYPES magic; /* A four-byte magic identifying the - record type and/or status. */ - u16 usa_ofs; /* Offset to the Update Sequence Array (usa) + NTFS_RECORD_TYPE magic; /* A four-byte magic identifying the record + type and/or status. */ + le16 usa_ofs; /* Offset to the Update Sequence Array (usa) from the start of the ntfs record. */ - u16 usa_count; /* Number of u16 sized entries in the usa + le16 usa_count; /* Number of le16 sized entries in the usa including the Update Sequence Number (usn), thus the number of fixups is the usa_count minus 1. */ @@ -249,11 +256,10 @@ * These are the so far known MFT_RECORD_* flags (16-bit) which contain * information about the mft record in which they are present. */ -typedef enum { - MFT_RECORD_IN_USE = const_cpu_to_le16(0x0001), - MFT_RECORD_IS_DIRECTORY = const_cpu_to_le16(0x0002), - MFT_REC_SPACE_FILLER = 0xffff /* Just to make flags 16-bit. */ -} __attribute__ ((__packed__)) MFT_RECORD_FLAGS; +#define MFT_RECORD_IN_USE const_cpu_to_le16(0x0001) +#define MFT_RECORD_IS_DIRECTORY const_cpu_to_le16(0x0002) + +typedef le16 MFT_RECORD_FLAGS; /* * mft references (aka file references or file record segment references) are @@ -305,6 +311,7 @@ } MFT_REF_CONSTS; typedef u64 MFT_REF; +typedef le64 leMFT_REF; #define MREF(x) ((unsigned long)((x) & MFT_REF_MASK_CPU)) #define MSEQNO(x) ((u16)(((x) >> 48) & 0xffff)) @@ -325,18 +332,18 @@ typedef struct { /*Ofs*/ /* 0 NTFS_RECORD; -- Unfolded here as gcc doesn't like unnamed structs. */ - NTFS_RECORD_TYPES magic;/* Usually the magic is "FILE". */ - u16 usa_ofs; /* See NTFS_RECORD definition above. */ - u16 usa_count; /* See NTFS_RECORD definition above. */ + NTFS_RECORD_TYPE magic; /* Usually the magic is "FILE". */ + le16 usa_ofs; /* See NTFS_RECORD definition above. */ + le16 usa_count; /* See NTFS_RECORD definition above. */ -/* 8*/ u64 lsn; /* $LogFile sequence number for this record. +/* 8*/ le64 lsn; /* $LogFile sequence number for this record. Changed every time the record is modified. */ -/* 16*/ u16 sequence_number; /* Number of times this mft record has been +/* 16*/ le16 sequence_number; /* Number of times this mft record has been reused. (See description for MFT_REF above.) NOTE: The increment (skipping zero) is done when the file is deleted. NOTE: If this is zero it is left zero. */ -/* 18*/ u16 link_count; /* Number of hard links, i.e. the number of +/* 18*/ le16 link_count; /* Number of hard links, i.e. the number of directory entries referencing this record. NOTE: Only used in mft base records. NOTE: When deleting a directory entry we @@ -346,18 +353,18 @@ directory entry from the mft record and decrement the link_count. FIXME: Careful with Win32 + DOS names! */ -/* 20*/ u16 attrs_offset; /* Byte offset to the first attribute in this +/* 20*/ le16 attrs_offset; /* Byte offset to the first attribute in this mft record from the start of the mft record. NOTE: Must be aligned to 8-byte boundary. */ /* 22*/ MFT_RECORD_FLAGS flags; /* Bit array of MFT_RECORD_FLAGS. When a file is deleted, the MFT_RECORD_IN_USE flag is set to zero. */ -/* 24*/ u32 bytes_in_use; /* Number of bytes used in this mft record. +/* 24*/ le32 bytes_in_use; /* Number of bytes used in this mft record. NOTE: Must be aligned to 8-byte boundary. */ -/* 28*/ u32 bytes_allocated; /* Number of bytes allocated for this mft +/* 28*/ le32 bytes_allocated; /* Number of bytes allocated for this mft record. This should be equal to the mft record size. */ -/* 32*/ MFT_REF base_mft_record; /* This is zero for base mft records. +/* 32*/ leMFT_REF base_mft_record;/* This is zero for base mft records. When it is not zero it is a mft reference pointing to the base mft record to which this record belongs (this is then used to @@ -369,17 +376,16 @@ attribute list also means finding the other potential extents, belonging to the non-base mft record). */ -/* 40*/ u16 next_attr_instance; /* The instance number that will be - assigned to the next attribute added to this - mft record. NOTE: Incremented each time - after it is used. NOTE: Every time the mft - record is reused this number is set to zero. - NOTE: The first instance number is always 0. - */ +/* 40*/ le16 next_attr_instance;/* The instance number that will be assigned to + the next attribute added to this mft record. + NOTE: Incremented each time after it is used. + NOTE: Every time the mft record is reused + this number is set to zero. NOTE: The first + instance number is always 0. */ /* sizeof() = 42 bytes */ /* NTFS 3.1+ (Windows XP and above) introduce the following additions. */ -/* 42*/ //u16 reserved; /* Reserved/alignment. */ -/* 44*/ //u32 mft_record_number;/* Number of this mft record. */ +/* 42*/ //le16 reserved; /* Reserved/alignment. */ +/* 44*/ //le32 mft_record_number;/* Number of this mft record. */ /* sizeof() = 48 bytes */ /* * When (re)using the mft record, we place the update sequence array at this @@ -393,38 +399,40 @@ } __attribute__ ((__packed__)) MFT_RECORD; /* - * System defined attributes (32-bit). Each attribute type has a corresponding + * System defined attributes (32-bit). Each attribute type has a corresponding * attribute name (Unicode string of maximum 64 character length) as described * by the attribute definitions present in the data attribute of the $AttrDef - * system file. On NTFS 3.0 volumes the names are just as the types are named - * in the below enum exchanging AT_ for the dollar sign ($). If that isn't a - * revealing choice of symbol... (-; - */ -typedef enum { - AT_UNUSED = const_cpu_to_le32( 0), - AT_STANDARD_INFORMATION = const_cpu_to_le32( 0x10), - AT_ATTRIBUTE_LIST = const_cpu_to_le32( 0x20), - AT_FILE_NAME = const_cpu_to_le32( 0x30), - AT_OBJECT_ID = const_cpu_to_le32( 0x40), - AT_SECURITY_DESCRIPTOR = const_cpu_to_le32( 0x50), - AT_VOLUME_NAME = const_cpu_to_le32( 0x60), - AT_VOLUME_INFORMATION = const_cpu_to_le32( 0x70), - AT_DATA = const_cpu_to_le32( 0x80), - AT_INDEX_ROOT = const_cpu_to_le32( 0x90), - AT_INDEX_ALLOCATION = const_cpu_to_le32( 0xa0), - AT_BITMAP = const_cpu_to_le32( 0xb0), - AT_REPARSE_POINT = const_cpu_to_le32( 0xc0), - AT_EA_INFORMATION = const_cpu_to_le32( 0xd0), - AT_EA = const_cpu_to_le32( 0xe0), - AT_PROPERTY_SET = const_cpu_to_le32( 0xf0), - AT_LOGGED_UTILITY_STREAM = const_cpu_to_le32( 0x100), - AT_FIRST_USER_DEFINED_ATTRIBUTE = const_cpu_to_le32( 0x1000), - AT_END = const_cpu_to_le32(0xffffffff), -} ATTR_TYPES; + * system file. On NTFS 3.0 volumes the names are just as the types are named + * in the below defines exchanging AT_ for the dollar sign ($). If that is not + * a revealing choice of symbol I do not know what is... (-; + */ +#define AT_UNUSED const_cpu_to_le32( 0) +#define AT_STANDARD_INFORMATION const_cpu_to_le32( 0x10) +#define AT_ATTRIBUTE_LIST const_cpu_to_le32( 0x20) +#define AT_FILE_NAME const_cpu_to_le32( 0x30) +#define AT_OBJECT_ID const_cpu_to_le32( 0x40) +#define AT_SECURITY_DESCRIPTOR const_cpu_to_le32( 0x50) +#define AT_VOLUME_NAME const_cpu_to_le32( 0x60) +#define AT_VOLUME_INFORMATION const_cpu_to_le32( 0x70) +#define AT_DATA const_cpu_to_le32( 0x80) +#define AT_INDEX_ROOT const_cpu_to_le32( 0x90) +#define AT_INDEX_ALLOCATION const_cpu_to_le32( 0xa0) +#define AT_BITMAP const_cpu_to_le32( 0xb0) +#define AT_REPARSE_POINT const_cpu_to_le32( 0xc0) +#define AT_EA_INFORMATION const_cpu_to_le32( 0xd0) +#define AT_EA const_cpu_to_le32( 0xe0) +#define AT_PROPERTY_SET const_cpu_to_le32( 0xf0) +#define AT_LOGGED_UTILITY_STREAM const_cpu_to_le32( 0x100) +#define AT_FIRST_USER_DEFINED_ATTRIBUTE const_cpu_to_le32( 0x1000) +#define AT_END const_cpu_to_le32(0xffffffff) + +typedef le32 ATTR_TYPE; /* * The collation rules for sorting views/indexes/etc (32-bit). * + * COLLATION_BINARY - Collate by binary compare where the first byte is most + * significant. * COLLATION_UNICODE_STRING - Collate Unicode strings by comparing their binary * Unicode values, except that when a character can be uppercased, the * upper case value collates before the lower case one. @@ -435,63 +443,55 @@ * unistr.c::ntfs_collate_names() and unistr.c::legal_ansi_char_array[] * for what I mean but COLLATION_UNICODE_STRING would not give any special * treatment to any characters at all, but this is speculation. - * COLLATION_NTOFS_ULONG - Sorting is done according to ascending u32 key + * COLLATION_NTOFS_ULONG - Sorting is done according to ascending le32 key * values. E.g. used for $SII index in FILE_Secure, which sorts by - * security_id (u32). + * security_id (le32). * COLLATION_NTOFS_SID - Sorting is done according to ascending SID values. * E.g. used for $O index in FILE_Extend/$Quota. * COLLATION_NTOFS_SECURITY_HASH - Sorting is done first by ascending hash * values and second by ascending security_id values. E.g. used for $SDH * index in FILE_Secure. * COLLATION_NTOFS_ULONGS - Sorting is done according to a sequence of ascending - * u32 key values. E.g. used for $O index in FILE_Extend/$ObjId, which + * le32 key values. E.g. used for $O index in FILE_Extend/$ObjId, which * sorts by object_id (16-byte), by splitting up the object_id in four - * u32 values and using them as individual keys. E.g. take the following + * le32 values and using them as individual keys. E.g. take the following * two security_ids, stored as follows on disk: * 1st: a1 61 65 b7 65 7b d4 11 9e 3d 00 e0 81 10 42 59 * 2nd: 38 14 37 d2 d2 f3 d4 11 a5 21 c8 6b 79 b1 97 45 - * To compare them, they are split into four u32 values each, like so: + * To compare them, they are split into four le32 values each, like so: * 1st: 0xb76561a1 0x11d47b65 0xe0003d9e 0x59421081 * 2nd: 0xd2371438 0x11d4f3d2 0x6bc821a5 0x4597b179 * Now, it is apparent why the 2nd object_id collates after the 1st: the - * first u32 value of the 1st object_id is less than the first u32 of - * the 2nd object_id. If the first u32 values of both object_ids were - * equal then the second u32 values would be compared, etc. - */ -typedef enum { - COLLATION_BINARY = const_cpu_to_le32(0x00), /* Collate by - binary compare where the first byte is - most significant. */ - COLLATION_FILE_NAME = const_cpu_to_le32(0x01), /* Collate file - names as Unicode strings. */ - COLLATION_UNICODE_STRING = const_cpu_to_le32(0x02), /* Collate Unicode - strings by comparing their binary - Unicode values, except that when a - character can be uppercased, the upper - case value collates before the lower - case one. */ - COLLATION_NTOFS_ULONG = const_cpu_to_le32(0x10), - COLLATION_NTOFS_SID = const_cpu_to_le32(0x11), - COLLATION_NTOFS_SECURITY_HASH = const_cpu_to_le32(0x12), - COLLATION_NTOFS_ULONGS = const_cpu_to_le32(0x13), -} COLLATION_RULES; + * first le32 value of the 1st object_id is less than the first le32 of + * the 2nd object_id. If the first le32 values of both object_ids were + * equal then the second le32 values would be compared, etc. + */ +#define COLLATION_BINARY const_cpu_to_le32(0x00) +#define COLLATION_FILE_NAME const_cpu_to_le32(0x01) +#define COLLATION_UNICODE_STRING const_cpu_to_le32(0x02) +#define COLLATION_NTOFS_ULONG const_cpu_to_le32(0x10) +#define COLLATION_NTOFS_SID const_cpu_to_le32(0x11) +#define COLLATION_NTOFS_SECURITY_HASH const_cpu_to_le32(0x12) +#define COLLATION_NTOFS_ULONGS const_cpu_to_le32(0x13) + +typedef le32 COLLATION_RULE; /* * The flags (32-bit) describing attribute properties in the attribute - * definition structure. FIXME: This information is from Regis's information + * definition structure. FIXME: This information is from Regis's information * and, according to him, it is not certain and probably incomplete. * The INDEXABLE flag is fairly certainly correct as only the file name * attribute has this flag set and this is the only attribute indexed in NT4. */ -typedef enum { - INDEXABLE = const_cpu_to_le32(0x02), /* Attribute can be - indexed. */ - NEED_TO_REGENERATE = const_cpu_to_le32(0x40), /* Need to regenerate - during regeneration - phase. */ - CAN_BE_NON_RESIDENT = const_cpu_to_le32(0x80), /* Attribute can be - non-resident. */ -} ATTR_DEF_FLAGS; +#define INDEXABLE const_cpu_to_le32(0x02) /* Attribute can be + indexed. */ +#define NEED_TO_REGENERATE const_cpu_to_le32(0x40) /* Need to regenerate + during regeneration + phase. */ +#define CAN_BE_NON_RESIDENT const_cpu_to_le32(0x80) /* Attribute can be + non-resident. */ + +typedef le32 ATTR_DEF_FLAGS; /* * The data attribute of FILE_AttrDef contains a sequence of attribute @@ -506,27 +506,27 @@ /*hex ofs*/ /* 0*/ ntfschar name[0x40]; /* Unicode name of the attribute. Zero terminated. */ -/* 80*/ ATTR_TYPES type; /* Type of the attribute. */ -/* 84*/ u32 display_rule; /* Default display rule. +/* 80*/ ATTR_TYPE type; /* Type of the attribute. */ +/* 84*/ le32 display_rule; /* Default display rule. FIXME: What does it mean? (AIA) */ -/* 88*/ COLLATION_RULES collation_rule; /* Default collation rule. */ +/* 88*/ COLLATION_RULE collation_rule; /* Default collation rule. */ /* 8c*/ ATTR_DEF_FLAGS flags; /* Flags describing the attribute. */ -/* 90*/ u64 min_size; /* Optional minimum attribute size. */ -/* 98*/ u64 max_size; /* Maximum size of attribute. */ +/* 90*/ le64 min_size; /* Optional minimum attribute size. */ +/* 98*/ le64 max_size; /* Maximum size of attribute. */ /* sizeof() = 0xa0 or 160 bytes */ } __attribute__ ((__packed__)) ATTR_DEF; /* * Attribute flags (16-bit). */ -typedef enum { - ATTR_IS_COMPRESSED = const_cpu_to_le16(0x0001), - ATTR_COMPRESSION_MASK = const_cpu_to_le16(0x00ff), /* Compression - method mask. Also, first - illegal value. */ - ATTR_IS_ENCRYPTED = const_cpu_to_le16(0x4000), - ATTR_IS_SPARSE = const_cpu_to_le16(0x8000), -} __attribute__ ((__packed__)) ATTR_FLAGS; +#define ATTR_IS_COMPRESSED const_cpu_to_le16(0x0001) +#define ATTR_COMPRESSION_MASK const_cpu_to_le16(0x00ff) /* Compression method + mask. Also, first + illegal value. */ +#define ATTR_IS_ENCRYPTED const_cpu_to_le16(0x4000) +#define ATTR_IS_SPARSE const_cpu_to_le16(0x8000) + +typedef le16 ATTR_FLAGS; /* * Attribute compression. @@ -598,26 +598,26 @@ /* * Flags of resident attributes (8-bit). */ -typedef enum { - RESIDENT_ATTR_IS_INDEXED = 0x01, /* Attribute is referenced in an index - (has implications for deleting and - modifying the attribute). */ -} __attribute__ ((__packed__)) RESIDENT_ATTR_FLAGS; +#define RESIDENT_ATTR_IS_INDEXED 0x01 /* Attribute is referenced in an index + (has implications for deleting and + modifying the attribute). */ + +typedef u8 RESIDENT_ATTR_FLAGS; /* * Attribute record header. Always aligned to 8-byte boundary. */ typedef struct { /*Ofs*/ -/* 0*/ ATTR_TYPES type; /* The (32-bit) type of the attribute. */ -/* 4*/ u32 length; /* Byte size of the resident part of the +/* 0*/ ATTR_TYPE type; /* The (32-bit) type of the attribute. */ +/* 4*/ le32 length; /* Byte size of the resident part of the attribute (aligned to 8-byte boundary). Used to get to the next attribute. */ /* 8*/ u8 non_resident; /* If 0, attribute is resident. If 1, attribute is non-resident. */ /* 9*/ u8 name_length; /* Unicode character size of name of attribute. 0 if unnamed. */ -/* 10*/ u16 name_offset; /* If name_length != 0, the byte offset to the +/* 10*/ le16 name_offset; /* If name_length != 0, the byte offset to the beginning of the name from the attribute record. Note that the name is stored as a Unicode string. When creating, place offset @@ -627,15 +627,15 @@ respectively, aligning to an 8-byte boundary. */ /* 12*/ ATTR_FLAGS flags; /* Flags describing the attribute. */ -/* 14*/ u16 instance; /* The instance of this attribute record. This +/* 14*/ le16 instance; /* The instance of this attribute record. This number is unique within this mft record (see MFT_RECORD/next_attribute_instance notes in in mft.h for more details). */ /* 16*/ union { /* Resident attributes. */ struct { -/* 16 */ u32 value_length; /* Byte size of attribute value. */ -/* 20 */ u16 value_offset; /* Byte offset of the attribute +/* 16 */ le32 value_length;/* Byte size of attribute value. */ +/* 20 */ le16 value_offset;/* Byte offset of the attribute value from the start of the attribute record. When creating, align to 8-byte boundary if we @@ -648,18 +648,18 @@ } __attribute__ ((__packed__)) resident; /* Non-resident attributes. */ struct { -/* 16*/ VCN lowest_vcn; /* Lowest valid virtual cluster number +/* 16*/ leVCN lowest_vcn;/* Lowest valid virtual cluster number for this portion of the attribute value or 0 if this is the only extent (usually the case). - Only when an attribute list is used does lowest_vcn != 0 ever occur. */ -/* 24*/ VCN highest_vcn; /* Highest valid vcn of this extent of +/* 24*/ leVCN highest_vcn;/* Highest valid vcn of this extent of the attribute value. - Usually there is only one portion, so this usually equals the attribute value size in clusters minus 1. Can be -1 for zero length files. Can be 0 for "single extent" attributes. */ -/* 32*/ u16 mapping_pairs_offset; /* Byte offset from the +/* 32*/ le16 mapping_pairs_offset; /* Byte offset from the beginning of the structure to the mapping pairs array which contains the mappings between the vcns and the logical cluster numbers (lcns). @@ -674,7 +674,7 @@ /* 35*/ u8 reserved[5]; /* Align to 8-byte boundary. */ /* The sizes below are only used when lowest_vcn is zero, as otherwise it would be difficult to keep them up-to-date.*/ -/* 40*/ s64 allocated_size; /* Byte size of disk space +/* 40*/ sle64 allocated_size; /* Byte size of disk space allocated to hold the attribute value. Always is a multiple of the cluster size. When a file is compressed, this field is a multiple of the @@ -682,14 +682,14 @@ it represents the logically allocated space rather than the actual on disk usage. For this use the compressed_size (see below). */ -/* 48*/ s64 data_size; /* Byte size of the attribute +/* 48*/ sle64 data_size; /* Byte size of the attribute value. Can be larger than allocated_size if attribute value is compressed or sparse. */ -/* 56*/ s64 initialized_size; /* Byte size of initialized +/* 56*/ sle64 initialized_size; /* Byte size of initialized portion of the attribute value. Usually equals data_size. */ /* sizeof(uncompressed attr) = 64*/ -/* 64*/ s64 compressed_size; /* Byte size of the attribute +/* 64*/ sle64 compressed_size; /* Byte size of the attribute value after compression. Only present when compressed. Always is a multiple of the cluster size. Represents the actual amount of @@ -703,57 +703,56 @@ /* * File attribute flags (32-bit). + * + * The following flags are only present in the STANDARD_INFORMATION attribute + * (in the field file_attributes). */ -typedef enum { - /* - * These flags are only present in the STANDARD_INFORMATION attribute - * (in the field file_attributes). - */ - FILE_ATTR_READONLY = const_cpu_to_le32(0x00000001), - FILE_ATTR_HIDDEN = const_cpu_to_le32(0x00000002), - FILE_ATTR_SYSTEM = const_cpu_to_le32(0x00000004), - /* Old DOS volid. Unused in NT. = cpu_to_le32(0x00000008), */ - - FILE_ATTR_DIRECTORY = const_cpu_to_le32(0x00000010), - /* FILE_ATTR_DIRECTORY is not considered valid in NT. It is reserved - for the DOS SUBDIRECTORY flag. */ - FILE_ATTR_ARCHIVE = const_cpu_to_le32(0x00000020), - FILE_ATTR_DEVICE = const_cpu_to_le32(0x00000040), - FILE_ATTR_NORMAL = const_cpu_to_le32(0x00000080), - - FILE_ATTR_TEMPORARY = const_cpu_to_le32(0x00000100), - FILE_ATTR_SPARSE_FILE = const_cpu_to_le32(0x00000200), - FILE_ATTR_REPARSE_POINT = const_cpu_to_le32(0x00000400), - FILE_ATTR_COMPRESSED = const_cpu_to_le32(0x00000800), - - FILE_ATTR_OFFLINE = const_cpu_to_le32(0x00001000), - FILE_ATTR_NOT_CONTENT_INDEXED = const_cpu_to_le32(0x00002000), - FILE_ATTR_ENCRYPTED = const_cpu_to_le32(0x00004000), - - FILE_ATTR_VALID_FLAGS = const_cpu_to_le32(0x00007fb7), - /* FILE_ATTR_VALID_FLAGS masks out the old DOS VolId and the - FILE_ATTR_DEVICE and preserves everything else. This mask - is used to obtain all flags that are valid for reading. */ - FILE_ATTR_VALID_SET_FLAGS = const_cpu_to_le32(0x000031a7), - /* FILE_ATTR_VALID_SET_FLAGS masks out the old DOS VolId, the - F_A_DEVICE, F_A_DIRECTORY, F_A_SPARSE_FILE, F_A_REPARSE_POINT, - F_A_COMPRESSED and F_A_ENCRYPTED and preserves the rest. This mask - is used to to obtain all flags that are valid for setting. */ +#define FILE_ATTR_READONLY const_cpu_to_le32(0x00000001) +#define FILE_ATTR_HIDDEN const_cpu_to_le32(0x00000002) +#define FILE_ATTR_SYSTEM const_cpu_to_le32(0x00000004) +/* Old DOS volid. Unused in NT. = cpu_to_le32(0x00000008), */ + +#define FILE_ATTR_DIRECTORY const_cpu_to_le32(0x00000010) +/* FILE_ATTR_DIRECTORY is not considered valid in NT. It is reserved for the + DOS SUBDIRECTORY flag. */ +#define FILE_ATTR_ARCHIVE const_cpu_to_le32(0x00000020) +#define FILE_ATTR_DEVICE const_cpu_to_le32(0x00000040) +#define FILE_ATTR_NORMAL const_cpu_to_le32(0x00000080) + +#define FILE_ATTR_TEMPORARY const_cpu_to_le32(0x00000100) +#define FILE_ATTR_SPARSE_FILE const_cpu_to_le32(0x00000200) +#define FILE_ATTR_REPARSE_POINT const_cpu_to_le32(0x00000400) +#define FILE_ATTR_COMPRESSED const_cpu_to_le32(0x00000800) + +#define FILE_ATTR_OFFLINE const_cpu_to_le32(0x00001000) +#define FILE_ATTR_NOT_CONTENT_INDEXED const_cpu_to_le32(0x00002000) +#define FILE_ATTR_ENCRYPTED const_cpu_to_le32(0x00004000) + +#define FILE_ATTR_VALID_FLAGS const_cpu_to_le32(0x00007fb7) +/* FILE_ATTR_VALID_FLAGS masks out the old DOS VolId and the FILE_ATTR_DEVICE + and preserves everything else. This mask is used to obtain all flags that + are valid for reading. */ +#define FILE_ATTR_VALID_SET_FLAGS const_cpu_to_le32(0x000031a7) +/* FILE_ATTR_VALID_SET_FLAGS masks out the old DOS VolId, the F_A_DEVICE, + F_A_DIRECTORY, F_A_SPARSE_FILE, F_A_REPARSE_POINT, F_A_COMPRESSED, and + F_A_ENCRYPTED and preserves the rest. This mask is used to to obtain all + flags that are valid for setting. */ + +/* + * The following flags are only present in the FILE_NAME attribute (in the + * field file_attributes). + */ +#define FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT const_cpu_to_le32(0x10000000) +/* This is a copy of the corresponding bit from the mft record, telling us + whether this is a directory or not, i.e. whether it has an index root + attribute or not. */ +#define FILE_ATTR_DUP_VIEW_INDEX_PRESENT const_cpu_to_le32(0x20000000) +/* This is a copy of the corresponding bit from the mft record, telling us + whether this file has a view index present (eg. object id index, quota + index, one of the security indexes or the encrypting file system related + indexes). */ - /* - * These flags are only present in the FILE_NAME attribute (in the - * field file_attributes). - */ - FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT = const_cpu_to_le32(0x10000000), - /* This is a copy of the corresponding bit from the mft record, telling - us whether this is a directory or not, i.e. whether it has an - index root attribute or not. */ - FILE_ATTR_DUP_VIEW_INDEX_PRESENT = const_cpu_to_le32(0x20000000), - /* This is a copy of the corresponding bit from the mft record, telling - us whether this file has a view index present (eg. object id index, - quota index, one of the security indexes or the encrypting file - system related indexes). */ -} FILE_ATTR_FLAGS; +typedef le32 FILE_ATTR_FLAGS; /* * NOTE on times in NTFS: All times are in MS standard time format, i.e. they @@ -774,13 +773,13 @@ */ typedef struct { /*Ofs*/ -/* 0*/ s64 creation_time; /* Time file was created. Updated when +/* 0*/ sle64 creation_time; /* Time file was created. Updated when a filename is changed(?). */ -/* 8*/ s64 last_data_change_time; /* Time the data attribute was last +/* 8*/ sle64 last_data_change_time; /* Time the data attribute was last modified. */ -/* 16*/ s64 last_mft_change_time; /* Time this mft record was last +/* 16*/ sle64 last_mft_change_time; /* Time this mft record was last modified. */ -/* 24*/ s64 last_access_time; /* Approximate time when the file was +/* 24*/ sle64 last_access_time; /* Approximate time when the file was last accessed (obviously this is not updated on read-only volumes). In Windows this is only updated when @@ -817,23 +816,23 @@ * views that as a corruption, assuming that it behaves like this for all * attributes. */ - /* 36*/ u32 maximum_versions; /* Maximum allowed versions for + /* 36*/ le32 maximum_versions; /* Maximum allowed versions for file. Zero if version numbering is disabled. */ - /* 40*/ u32 version_number; /* This file's version (if any). + /* 40*/ le32 version_number; /* This file's version (if any). Set to zero if maximum_versions is zero. */ - /* 44*/ u32 class_id; /* Class id from bidirectional + /* 44*/ le32 class_id; /* Class id from bidirectional class id index (?). */ - /* 48*/ u32 owner_id; /* Owner_id of the user owning + /* 48*/ le32 owner_id; /* Owner_id of the user owning the file. Translate via $Q index in FILE_Extend /$Quota to the quota control entry for the user owning the file. Zero if quotas are disabled. */ - /* 52*/ u32 security_id; /* Security_id for the file. + /* 52*/ le32 security_id; /* Security_id for the file. Translate via $SII index and $SDS data stream in FILE_Secure to the security descriptor. */ - /* 56*/ u64 quota_charged; /* Byte size of the charge to + /* 56*/ le64 quota_charged; /* Byte size of the charge to the quota for all streams of the file. Note: Is zero if quotas are disabled. */ - /* 64*/ u64 usn; /* Last update sequence number + /* 64*/ le64 usn; /* Last update sequence number of the file. This is a direct index into the change (aka usn) journal file. It is zero if the usn journal is disabled. @@ -886,14 +885,14 @@ */ typedef struct { /*Ofs*/ -/* 0*/ ATTR_TYPES type; /* Type of referenced attribute. */ -/* 4*/ u16 length; /* Byte size of this entry (8-byte aligned). */ +/* 0*/ ATTR_TYPE type; /* Type of referenced attribute. */ +/* 4*/ le16 length; /* Byte size of this entry (8-byte aligned). */ /* 6*/ u8 name_length; /* Size in Unicode chars of the name of the attribute or 0 if unnamed. */ /* 7*/ u8 name_offset; /* Byte offset to beginning of attribute name (always set this to where the name would start even if unnamed). */ -/* 8*/ VCN lowest_vcn; /* Lowest virtual cluster number of this portion +/* 8*/ leVCN lowest_vcn; /* Lowest virtual cluster number of this portion of the attribute value. This is usually 0. It is non-zero for the case where one attribute does not fit into one mft record and thus @@ -905,10 +904,10 @@ value! The windows driver uses cmp, followed by jg when comparing this, thus it treats it as signed. */ -/* 16*/ MFT_REF mft_reference; /* The reference of the mft record holding +/* 16*/ leMFT_REF mft_reference;/* The reference of the mft record holding the ATTR_RECORD for this portion of the attribute value. */ -/* 24*/ u16 instance; /* If lowest_vcn = 0, the instance of the +/* 24*/ le16 instance; /* If lowest_vcn = 0, the instance of the attribute being referenced; otherwise 0. */ /* 26*/ ntfschar name[0]; /* Use when creating only. When reading use name_offset to determine the location of the @@ -924,28 +923,26 @@ /* * Possible namespaces for filenames in ntfs (8-bit). */ -typedef enum { - FILE_NAME_POSIX = 0x00, - /* This is the largest namespace. It is case sensitive and - allows all Unicode characters except for: '\0' and '/'. - Beware that in WinNT/2k files which eg have the same name - except for their case will not be distinguished by the - standard utilities and thus a "del filename" will delete - both "filename" and "fileName" without warning. */ - FILE_NAME_WIN32 = 0x01, - /* The standard WinNT/2k NTFS long filenames. Case insensitive. - All Unicode chars except: '\0', '"', '*', '/', ':', '<', - '>', '?', '\' and '|'. Further, names cannot end with a '.' - or a space. */ - FILE_NAME_DOS = 0x02, - /* The standard DOS filenames (8.3 format). Uppercase only. - All 8-bit characters greater space, except: '"', '*', '+', - ',', '/', ':', ';', '<', '=', '>', '?' and '\'. */ - FILE_NAME_WIN32_AND_DOS = 0x03, - /* 3 means that both the Win32 and the DOS filenames are - identical and hence have been saved in this single filename - record. */ -} __attribute__ ((__packed__)) FILE_NAME_TYPE_FLAGS; +#define FILE_NAME_POSIX 0x00 + /* This is the largest namespace. It is case sensitive and allows all + Unicode characters except for: '\0' and '/'. Beware that in + WinNT/2k files which eg have the same name except for their case + will not be distinguished by the standard utilities and thus a "del + filename" will delete both "filename" and "fileName" without + warning. */ +#define FILE_NAME_WIN32 0x01 + /* The standard WinNT/2k NTFS long filenames. Case insensitive. All + Unicode chars except: '\0', '"', '*', '/', ':', '<', '>', '?', '\', + and '|'. Further, names cannot end with a '.' or a space. */ +#define FILE_NAME_DOS 0x02 + /* The standard DOS filenames (8.3 format). Uppercase only. All 8-bit + characters greater space, except: '"', '*', '+', ',', '/', ':', ';', + '<', '=', '>', '?', and '\'. */ +#define FILE_NAME_WIN32_AND_DOS 0x03 + /* 3 means that both the Win32 and the DOS filenames are identical and + hence have been saved in this single filename record. */ + +typedef u8 FILE_NAME_TYPE_FLAGS; /* * Attribute: Filename (0x30). @@ -962,30 +959,30 @@ */ typedef struct { /*hex ofs*/ -/* 0*/ MFT_REF parent_directory; /* Directory this filename is +/* 0*/ leMFT_REF parent_directory; /* Directory this filename is referenced from. */ -/* 8*/ s64 creation_time; /* Time file was created. */ -/* 10*/ s64 last_data_change_time; /* Time the data attribute was last +/* 8*/ sle64 creation_time; /* Time file was created. */ +/* 10*/ sle64 last_data_change_time; /* Time the data attribute was last modified. */ -/* 18*/ s64 last_mft_change_time; /* Time this mft record was last +/* 18*/ sle64 last_mft_change_time; /* Time this mft record was last modified. */ -/* 20*/ s64 last_access_time; /* Time this mft record was last +/* 20*/ sle64 last_access_time; /* Time this mft record was last accessed. */ -/* 28*/ s64 allocated_size; /* Byte size of allocated space for the +/* 28*/ sle64 allocated_size; /* Byte size of allocated space for the data attribute. NOTE: Is a multiple of the cluster size. */ -/* 30*/ s64 data_size; /* Byte size of actual data in data +/* 30*/ sle64 data_size; /* Byte size of actual data in data attribute. */ /* 38*/ FILE_ATTR_FLAGS file_attributes; /* Flags describing the file. */ /* 3c*/ union { /* 3c*/ struct { - /* 3c*/ u16 packed_ea_size; /* Size of the buffer needed to + /* 3c*/ le16 packed_ea_size; /* Size of the buffer needed to pack the extended attributes (EAs), if such are present.*/ - /* 3e*/ u16 reserved; /* Reserved for alignment. */ + /* 3e*/ le16 reserved; /* Reserved for alignment. */ } __attribute__ ((__packed__)) ea; /* 3c*/ struct { - /* 3c*/ u32 reparse_point_tag; /* Type of reparse point, + /* 3c*/ le32 reparse_point_tag; /* Type of reparse point, present only in reparse points and only if there are no EAs. */ @@ -1007,9 +1004,9 @@ * 1F010768-5A73-BC91-0010A52216A7 */ typedef struct { - u32 data1; /* The first eight hexadecimal digits of the GUID. */ - u16 data2; /* The first group of four hexadecimal digits. */ - u16 data3; /* The second group of four hexadecimal digits. */ + le32 data1; /* The first eight hexadecimal digits of the GUID. */ + le16 data2; /* The first group of four hexadecimal digits. */ + le16 data3; /* The second group of four hexadecimal digits. */ u8 data4[8]; /* The first two bytes are the third group of four hexadecimal digits. The remaining six bytes are the final 12 hexadecimal digits. */ @@ -1027,7 +1024,7 @@ * domain_id - Reserved (always zero). */ typedef struct { - MFT_REF mft_reference; /* Mft record containing the object_id in + leMFT_REF mft_reference;/* Mft record containing the object_id in the index entry key. */ union { struct { @@ -1195,13 +1192,16 @@ /* * The SID_IDENTIFIER_AUTHORITY is a 48-bit value used in the SID structure. + * + * NOTE: This is stored as a big endian number, hence the high_part comes + * before the low_part. */ typedef union { struct { - u32 low; /* Low 32-bits. */ - u16 high; /* High 16-bits. */ + u16 high_part; /* High 16-bits. */ + u32 low_part; /* Low 32-bits. */ } __attribute__ ((__packed__)) parts; - u8 value[6]; /* Value as individual bytes. */ + u8 value[6]; /* Value as individual bytes. */ } __attribute__ ((__packed__)) SID_IDENTIFIER_AUTHORITY; /* @@ -1232,7 +1232,7 @@ u8 revision; u8 sub_authority_count; SID_IDENTIFIER_AUTHORITY identifier_authority; - u32 sub_authority[1]; /* At least one sub_authority. */ + le32 sub_authority[1]; /* At least one sub_authority. */ } __attribute__ ((__packed__)) SID; /* @@ -1248,30 +1248,31 @@ /* * The predefined ACE types (8-bit, see below). */ -typedef enum { - ACCESS_MIN_MS_ACE_TYPE = 0, - ACCESS_ALLOWED_ACE_TYPE = 0, - ACCESS_DENIED_ACE_TYPE = 1, - SYSTEM_AUDIT_ACE_TYPE = 2, - SYSTEM_ALARM_ACE_TYPE = 3, /* Not implemented as of Win2k. */ - ACCESS_MAX_MS_V2_ACE_TYPE = 3, - - ACCESS_ALLOWED_COMPOUND_ACE_TYPE= 4, - ACCESS_MAX_MS_V3_ACE_TYPE = 4, - - /* The following are Win2k only. */ - ACCESS_MIN_MS_OBJECT_ACE_TYPE = 5, - ACCESS_ALLOWED_OBJECT_ACE_TYPE = 5, - ACCESS_DENIED_OBJECT_ACE_TYPE = 6, - SYSTEM_AUDIT_OBJECT_ACE_TYPE = 7, - SYSTEM_ALARM_OBJECT_ACE_TYPE = 8, - ACCESS_MAX_MS_OBJECT_ACE_TYPE = 8, - - ACCESS_MAX_MS_V4_ACE_TYPE = 8, - - /* This one is for WinNT&2k. */ - ACCESS_MAX_MS_ACE_TYPE = 8, -} __attribute__ ((__packed__)) ACE_TYPES; +#define ACCESS_MIN_MS_ACE_TYPE 0 +#define ACCESS_ALLOWED_ACE_TYPE 0 +#define ACCESS_DENIED_ACE_TYPE 1 +#define SYSTEM_AUDIT_ACE_TYPE 2 +#define SYSTEM_ALARM_ACE_TYPE 3 /* Not implemented as of + Win2k. */ +#define ACCESS_MAX_MS_V2_ACE_TYPE 3 + +#define ACCESS_ALLOWED_COMPOUND_ACE_TYPE 4 +#define ACCESS_MAX_MS_V3_ACE_TYPE 4 + +/* The following are Win2k only. */ +#define ACCESS_MIN_MS_OBJECT_ACE_TYPE 5 +#define ACCESS_ALLOWED_OBJECT_ACE_TYPE 5 +#define ACCESS_DENIED_OBJECT_ACE_TYPE 6 +#define SYSTEM_AUDIT_OBJECT_ACE_TYPE 7 +#define SYSTEM_ALARM_OBJECT_ACE_TYPE 8 +#define ACCESS_MAX_MS_OBJECT_ACE_TYPE 8 + +#define ACCESS_MAX_MS_V4_ACE_TYPE 8 + +/* This one is for WinNT/2k. */ +#define ACCESS_MAX_MS_ACE_TYPE 8 + +typedef u8 ACE_TYPES; /* * The ACE flags (8-bit) for audit and inheritance (see below). @@ -1283,19 +1284,19 @@ * FAILED_ACCESS_ACE_FLAG is only used with system audit and alarm ACE types * to indicate that a message is generated (in Windows!) for failed accesses. */ -typedef enum { - /* The inheritance flags. */ - OBJECT_INHERIT_ACE = 0x01, - CONTAINER_INHERIT_ACE = 0x02, - NO_PROPAGATE_INHERIT_ACE = 0x04, - INHERIT_ONLY_ACE = 0x08, - INHERITED_ACE = 0x10, /* Win2k only. */ - VALID_INHERIT_FLAGS = 0x1f, - - /* The audit flags. */ - SUCCESSFUL_ACCESS_ACE_FLAG = 0x40, - FAILED_ACCESS_ACE_FLAG = 0x80, -} __attribute__ ((__packed__)) ACE_FLAGS; +/* The inheritance flags. */ +#define OBJECT_INHERIT_ACE 0x01 +#define CONTAINER_INHERIT_ACE 0x02 +#define NO_PROPAGATE_INHERIT_ACE 0x04 +#define INHERIT_ONLY_ACE 0x08 +#define INHERITED_ACE 0x10 /* Win2k only. */ +#define VALID_INHERIT_FLAGS 0x1f + +/* The audit flags. */ +#define SUCCESSFUL_ACCESS_ACE_FLAG 0x40 +#define FAILED_ACCESS_ACE_FLAG 0x80 + +typedef u8 ACE_FLAGS; /* * An ACE is an access-control entry in an access-control list (ACL). @@ -1312,141 +1313,140 @@ /*Ofs*/ /* 0*/ ACE_TYPES type; /* Type of the ACE. */ /* 1*/ ACE_FLAGS flags; /* Flags describing the ACE. */ -/* 2*/ u16 size; /* Size in bytes of the ACE. */ +/* 2*/ le16 size; /* Size in bytes of the ACE. */ } __attribute__ ((__packed__)) ACE_HEADER; /* * The access mask (32-bit). Defines the access rights. + * + * The specific rights (bits 0 to 15). These depend on the type of the object + * being secured by the ACE. */ -typedef enum { - /* - * The specific rights (bits 0 to 15). Depend on the type of the - * object being secured by the ACE. - */ - /* Specific rights for files and directories are as follows: */ +/* Specific rights for files and directories are as follows: */ - /* Right to read data from the file. (FILE) */ - FILE_READ_DATA = const_cpu_to_le32(0x00000001), - /* Right to list contents of a directory. (DIRECTORY) */ - FILE_LIST_DIRECTORY = const_cpu_to_le32(0x00000001), - - /* Right to write data to the file. (FILE) */ - FILE_WRITE_DATA = const_cpu_to_le32(0x00000002), - /* Right to create a file in the directory. (DIRECTORY) */ - FILE_ADD_FILE = const_cpu_to_le32(0x00000002), - - /* Right to append data to the file. (FILE) */ - FILE_APPEND_DATA = const_cpu_to_le32(0x00000004), - /* Right to create a subdirectory. (DIRECTORY) */ - FILE_ADD_SUBDIRECTORY = const_cpu_to_le32(0x00000004), - - /* Right to read extended attributes. (FILE/DIRECTORY) */ - FILE_READ_EA = const_cpu_to_le32(0x00000008), - - /* Right to write extended attributes. (FILE/DIRECTORY) */ - FILE_WRITE_EA = const_cpu_to_le32(0x00000010), - - /* Right to execute a file. (FILE) */ - FILE_EXECUTE = const_cpu_to_le32(0x00000020), - /* Right to traverse the directory. (DIRECTORY) */ - FILE_TRAVERSE = const_cpu_to_le32(0x00000020), +/* Right to read data from the file. (FILE) */ +#define FILE_READ_DATA const_cpu_to_le32(0x00000001) +/* Right to list contents of a directory. (DIRECTORY) */ +#define FILE_LIST_DIRECTORY const_cpu_to_le32(0x00000001) - /* - * Right to delete a directory and all the files it contains (its - * children), even if the files are read-only. (DIRECTORY) - */ - FILE_DELETE_CHILD = const_cpu_to_le32(0x00000040), +/* Right to write data to the file. (FILE) */ +#define FILE_WRITE_DATA const_cpu_to_le32(0x00000002) +/* Right to create a file in the directory. (DIRECTORY) */ +#define FILE_ADD_FILE const_cpu_to_le32(0x00000002) - /* Right to read file attributes. (FILE/DIRECTORY) */ - FILE_READ_ATTRIBUTES = const_cpu_to_le32(0x00000080), +/* Right to append data to the file. (FILE) */ +#define FILE_APPEND_DATA const_cpu_to_le32(0x00000004) +/* Right to create a subdirectory. (DIRECTORY) */ +#define FILE_ADD_SUBDIRECTORY const_cpu_to_le32(0x00000004) - /* Right to change file attributes. (FILE/DIRECTORY) */ - FILE_WRITE_ATTRIBUTES = const_cpu_to_le32(0x00000100), +/* Right to read extended attributes. (FILE/DIRECTORY) */ +#define FILE_READ_EA const_cpu_to_le32(0x00000008) - /* - * The standard rights (bits 16 to 23). Are independent of the type of - * object being secured. - */ +/* Right to write extended attributes. (FILE/DIRECTORY) */ +#define FILE_WRITE_EA const_cpu_to_le32(0x00000010) - /* Right to delete the object. */ - DELETE = const_cpu_to_le32(0x00010000), +/* Right to execute a file. (FILE) */ +#define FILE_EXECUTE const_cpu_to_le32(0x00000020) +/* Right to traverse the directory. (DIRECTORY) */ +#define FILE_TRAVERSE const_cpu_to_le32(0x00000020) - /* - * Right to read the information in the object's security descriptor, - * not including the information in the SACL. I.e. right to read the - * security descriptor and owner. - */ - READ_CONTROL = const_cpu_to_le32(0x00020000), +/* + * Right to delete a directory and all the files it contains (its children), + * even if the files are read-only. (DIRECTORY) + */ +#define FILE_DELETE_CHILD const_cpu_to_le32(0x00000040) - /* Right to modify the DACL in the object's security descriptor. */ - WRITE_DAC = const_cpu_to_le32(0x00040000), +/* Right to read file attributes. (FILE/DIRECTORY) */ +#define FILE_READ_ATTRIBUTES const_cpu_to_le32(0x00000080) - /* Right to change the owner in the object's security descriptor. */ - WRITE_OWNER = const_cpu_to_le32(0x00080000), +/* Right to change file attributes. (FILE/DIRECTORY) */ +#define FILE_WRITE_ATTRIBUTES const_cpu_to_le32(0x00000100) - /* - * Right to use the object for synchronization. Enables a process to - * wait until the object is in the signalled state. Some object types - * do not support this access right. - */ - SYNCHRONIZE = const_cpu_to_le32(0x00100000), +/* + * The standard rights (bits 16 to 23). These are independent of the type of + * object being secured. + */ - /* - * The following STANDARD_RIGHTS_* are combinations of the above for - * convenience and are defined by the Win32 API. - */ +/* Right to delete the object. */ +#define DELETE const_cpu_to_le32(0x00010000) - /* These are currently defined to READ_CONTROL. */ - STANDARD_RIGHTS_READ = const_cpu_to_le32(0x00020000), - STANDARD_RIGHTS_WRITE = const_cpu_to_le32(0x00020000), - STANDARD_RIGHTS_EXECUTE = const_cpu_to_le32(0x00020000), +/* + * Right to read the information in the object's security descriptor, not + * including the information in the SACL. I.e. right to read the security + * descriptor and owner. + */ +#define READ_CONTROL const_cpu_to_le32(0x00020000) - /* Combines DELETE, READ_CONTROL, WRITE_DAC, and WRITE_OWNER access. */ - STANDARD_RIGHTS_REQUIRED = const_cpu_to_le32(0x000f0000), +/* Right to modify the DACL in the object's security descriptor. */ +#define WRITE_DAC const_cpu_to_le32(0x00040000) - /* - * Combines DELETE, READ_CONTROL, WRITE_DAC, WRITE_OWNER, and - * SYNCHRONIZE access. - */ - STANDARD_RIGHTS_ALL = const_cpu_to_le32(0x001f0000), +/* Right to change the owner in the object's security descriptor. */ +#define WRITE_OWNER const_cpu_to_le32(0x00080000) - /* - * The access system ACL and maximum allowed access types (bits 24 to - * 25, bits 26 to 27 are reserved). - */ - ACCESS_SYSTEM_SECURITY = const_cpu_to_le32(0x01000000), - MAXIMUM_ALLOWED = const_cpu_to_le32(0x02000000), +/* + * Right to use the object for synchronization. Enables a process to wait until + * the object is in the signalled state. Some object types do not support this + * access right. + */ +#define SYNCHRONIZE const_cpu_to_le32(0x00100000) - /* - * The generic rights (bits 28 to 31). These map onto the standard and - * specific rights. - */ +/* + * The following STANDARD_RIGHTS_* are combinations of the above for + * convenience and are defined by the Win32 API. + */ - /* Read, write, and execute access. */ - GENERIC_ALL = const_cpu_to_le32(0x10000000), +/* These are currently defined to READ_CONTROL. */ +#define STANDARD_RIGHTS_READ const_cpu_to_le32(0x00020000) +#define STANDARD_RIGHTS_WRITE const_cpu_to_le32(0x00020000) +#define STANDARD_RIGHTS_EXECUTE const_cpu_to_le32(0x00020000) - /* Execute access. */ - GENERIC_EXECUTE = const_cpu_to_le32(0x20000000), +/* Combines DELETE, READ_CONTROL, WRITE_DAC, and WRITE_OWNER access. */ +#define STANDARD_RIGHTS_REQUIRED const_cpu_to_le32(0x000f0000) - /* - * Write access. For files, this maps onto: - * FILE_APPEND_DATA | FILE_WRITE_ATTRIBUTES | FILE_WRITE_DATA | - * FILE_WRITE_EA | STANDARD_RIGHTS_WRITE | SYNCHRONIZE - * For directories, the mapping has the same numberical value. See - * above for the descriptions of the rights granted. - */ - GENERIC_WRITE = const_cpu_to_le32(0x40000000), +/* + * Combines DELETE, READ_CONTROL, WRITE_DAC, WRITE_OWNER, and + * SYNCHRONIZE access. + */ +#define STANDARD_RIGHTS_ALL const_cpu_to_le32(0x001f0000) - /* - * Read access. For files, this maps onto: - * FILE_READ_ATTRIBUTES | FILE_READ_DATA | FILE_READ_EA | - * STANDARD_RIGHTS_READ | SYNCHRONIZE - * For directories, the mapping has the same numberical value. See - * above for the descriptions of the rights granted. - */ - GENERIC_READ = const_cpu_to_le32(0x80000000), -} ACCESS_MASK; +/* + * The access system ACL and maximum allowed access types (bits 24 to + * 25, bits 26 to 27 are reserved). + */ +#define ACCESS_SYSTEM_SECURITY const_cpu_to_le32(0x01000000) +#define MAXIMUM_ALLOWED const_cpu_to_le32(0x02000000) + +/* + * The generic rights (bits 28 to 31). These map onto the standard and specific + * rights. + */ + +/* Read, write, and execute access. */ +#define GENERIC_ALL const_cpu_to_le32(0x10000000) + +/* Execute access. */ +#define GENERIC_EXECUTE const_cpu_to_le32(0x20000000) + +/* + * Write access. For files, this maps onto: + * FILE_APPEND_DATA | FILE_WRITE_ATTRIBUTES | FILE_WRITE_DATA | + * FILE_WRITE_EA | STANDARD_RIGHTS_WRITE | SYNCHRONIZE + * For directories, the mapping has the same numberical value. See above for + * the descriptions of the rights granted. + */ +#define GENERIC_WRITE const_cpu_to_le32(0x40000000) + +/* + * Read access. For files, this maps onto: + * FILE_READ_ATTRIBUTES | FILE_READ_DATA | FILE_READ_EA | + * STANDARD_RIGHTS_READ | SYNCHRONIZE + * For directories, the mapping has the same numberical value. See above for + * the descriptions of the rights granted. + */ +#define GENERIC_READ const_cpu_to_le32(0x80000000) + +typedef le32 ACCESS_MASK; /* * The generic mapping array. Used to denote the mapping of each generic @@ -1472,7 +1472,7 @@ /* 0 ACE_HEADER; -- Unfolded here as gcc doesn't like unnamed structs. */ ACE_TYPES type; /* Type of the ACE. */ ACE_FLAGS flags; /* Flags describing the ACE. */ - u16 size; /* Size in bytes of the ACE. */ + le16 size; /* Size in bytes of the ACE. */ /* 4*/ ACCESS_MASK mask; /* Access mask associated with the ACE. */ /* 8*/ SID sid; /* The SID associated with the ACE. */ @@ -1482,16 +1482,16 @@ /* * The object ACE flags (32-bit). */ -typedef enum { - ACE_OBJECT_TYPE_PRESENT = const_cpu_to_le32(1), - ACE_INHERITED_OBJECT_TYPE_PRESENT = const_cpu_to_le32(2), -} OBJECT_ACE_FLAGS; +#define ACE_OBJECT_TYPE_PRESENT const_cpu_to_le32(1) +#define ACE_INHERITED_OBJECT_TYPE_PRESENT const_cpu_to_le32(2) + +typedef le32 OBJECT_ACE_FLAGS; typedef struct { /* 0 ACE_HEADER; -- Unfolded here as gcc doesn't like unnamed structs. */ ACE_TYPES type; /* Type of the ACE. */ ACE_FLAGS flags; /* Flags describing the ACE. */ - u16 size; /* Size in bytes of the ACE. */ + le16 size; /* Size in bytes of the ACE. */ /* 4*/ ACCESS_MASK mask; /* Access mask associated with the ACE. */ /* 8*/ OBJECT_ACE_FLAGS object_flags; /* Flags describing the object ACE. */ @@ -1514,10 +1514,10 @@ typedef struct { u8 revision; /* Revision of this ACL. */ u8 alignment1; - u16 size; /* Allocated space in bytes for ACL. Includes this + le16 size; /* Allocated space in bytes for ACL. Includes this header, the ACEs and the remaining free space. */ - u16 ace_count; /* Number of ACEs in the ACL. */ - u16 alignment2; + le16 ace_count; /* Number of ACEs in the ACL. */ + le16 alignment2; /* sizeof() = 8 bytes */ } __attribute__ ((__packed__)) ACL; @@ -1582,22 +1582,22 @@ * security descriptor are contiguous in memory and all pointer fields are * expressed as offsets from the beginning of the security descriptor. */ -typedef enum { - SE_OWNER_DEFAULTED = const_cpu_to_le16(0x0001), - SE_GROUP_DEFAULTED = const_cpu_to_le16(0x0002), - SE_DACL_PRESENT = const_cpu_to_le16(0x0004), - SE_DACL_DEFAULTED = const_cpu_to_le16(0x0008), - SE_SACL_PRESENT = const_cpu_to_le16(0x0010), - SE_SACL_DEFAULTED = const_cpu_to_le16(0x0020), - SE_DACL_AUTO_INHERIT_REQ = const_cpu_to_le16(0x0100), - SE_SACL_AUTO_INHERIT_REQ = const_cpu_to_le16(0x0200), - SE_DACL_AUTO_INHERITED = const_cpu_to_le16(0x0400), - SE_SACL_AUTO_INHERITED = const_cpu_to_le16(0x0800), - SE_DACL_PROTECTED = const_cpu_to_le16(0x1000), - SE_SACL_PROTECTED = const_cpu_to_le16(0x2000), - SE_RM_CONTROL_VALID = const_cpu_to_le16(0x4000), - SE_SELF_RELATIVE = const_cpu_to_le16(0x8000), -} __attribute__ ((__packed__)) SECURITY_DESCRIPTOR_CONTROL; +#define SE_OWNER_DEFAULTED const_cpu_to_le16(0x0001) +#define SE_GROUP_DEFAULTED const_cpu_to_le16(0x0002) +#define SE_DACL_PRESENT const_cpu_to_le16(0x0004) +#define SE_DACL_DEFAULTED const_cpu_to_le16(0x0008) +#define SE_SACL_PRESENT const_cpu_to_le16(0x0010) +#define SE_SACL_DEFAULTED const_cpu_to_le16(0x0020) +#define SE_DACL_AUTO_INHERIT_REQ const_cpu_to_le16(0x0100) +#define SE_SACL_AUTO_INHERIT_REQ const_cpu_to_le16(0x0200) +#define SE_DACL_AUTO_INHERITED const_cpu_to_le16(0x0400) +#define SE_SACL_AUTO_INHERITED const_cpu_to_le16(0x0800) +#define SE_DACL_PROTECTED const_cpu_to_le16(0x1000) +#define SE_SACL_PROTECTED const_cpu_to_le16(0x2000) +#define SE_RM_CONTROL_VALID const_cpu_to_le16(0x4000) +#define SE_SELF_RELATIVE const_cpu_to_le16(0x8000) + +typedef le16 SECURITY_DESCRIPTOR_CONTROL; /* * Self-relative security descriptor. Contains the owner and group SIDs as well @@ -1608,17 +1608,17 @@ u8 alignment; SECURITY_DESCRIPTOR_CONTROL control; /* Flags qualifying the type of the descriptor as well as the following fields. */ - u32 owner; /* Byte offset to a SID representing an object's + le32 owner; /* Byte offset to a SID representing an object's owner. If this is NULL, no owner SID is present in the descriptor. */ - u32 group; /* Byte offset to a SID representing an object's + le32 group; /* Byte offset to a SID representing an object's primary group. If this is NULL, no primary group SID is present in the descriptor. */ - u32 sacl; /* Byte offset to a system ACL. Only valid, if + le32 sacl; /* Byte offset to a system ACL. Only valid, if SE_SACL_PRESENT is set in the control field. If SE_SACL_PRESENT is set but sacl is NULL, a NULL ACL is specified. */ - u32 dacl; /* Byte offset to a discretionary ACL. Only valid, if + le32 dacl; /* Byte offset to a discretionary ACL. Only valid, if SE_DACL_PRESENT is set in the control field. If SE_DACL_PRESENT is set but dacl is NULL, a NULL ACL (unconditionally granting access) is specified. */ @@ -1721,10 +1721,10 @@ * This is also the index entry data part of both the $SII and $SDH indexes. */ typedef struct { - u32 hash; /* Hash of the security descriptor. */ - u32 security_id; /* The security_id assigned to the descriptor. */ - u64 offset; /* Byte offset of this entry in the $SDS stream. */ - u32 length; /* Size in bytes of this entry in $SDS stream. */ + le32 hash; /* Hash of the security descriptor. */ + le32 security_id; /* The security_id assigned to the descriptor. */ + le64 offset; /* Byte offset of this entry in the $SDS stream. */ + le32 length; /* Size in bytes of this entry in $SDS stream. */ } __attribute__ ((__packed__)) SECURITY_DESCRIPTOR_HEADER; /* @@ -1742,10 +1742,10 @@ /*Ofs*/ /* 0 SECURITY_DESCRIPTOR_HEADER; -- Unfolded here as gcc doesn't like unnamed structs. */ - u32 hash; /* Hash of the security descriptor. */ - u32 security_id; /* The security_id assigned to the descriptor. */ - u64 offset; /* Byte offset of this entry in the $SDS stream. */ - u32 length; /* Size in bytes of this entry in $SDS stream. */ + le32 hash; /* Hash of the security descriptor. */ + le32 security_id; /* The security_id assigned to the descriptor. */ + le64 offset; /* Byte offset of this entry in the $SDS stream. */ + le32 length; /* Size in bytes of this entry in $SDS stream. */ /* 20*/ SECURITY_DESCRIPTOR_RELATIVE sid; /* The self-relative security descriptor. */ } __attribute__ ((__packed__)) SDS_ENTRY; @@ -1755,7 +1755,7 @@ * COLLATION_NTOFS_ULONG. */ typedef struct { - u32 security_id; /* The security_id assigned to the descriptor. */ + le32 security_id; /* The security_id assigned to the descriptor. */ } __attribute__ ((__packed__)) SII_INDEX_KEY; /* @@ -1764,8 +1764,8 @@ * COLLATION_NTOFS_SECURITY_HASH. */ typedef struct { - u32 hash; /* Hash of the security descriptor. */ - u32 security_id; /* The security_id assigned to the descriptor. */ + le32 hash; /* Hash of the security descriptor. */ + le32 security_id; /* The security_id assigned to the descriptor. */ } __attribute__ ((__packed__)) SDH_INDEX_KEY; /* @@ -1781,19 +1781,19 @@ /* * Possible flags for the volume (16-bit). */ -typedef enum { - VOLUME_IS_DIRTY = const_cpu_to_le16(0x0001), - VOLUME_RESIZE_LOG_FILE = const_cpu_to_le16(0x0002), - VOLUME_UPGRADE_ON_MOUNT = const_cpu_to_le16(0x0004), - VOLUME_MOUNTED_ON_NT4 = const_cpu_to_le16(0x0008), - VOLUME_DELETE_USN_UNDERWAY = const_cpu_to_le16(0x0010), - VOLUME_REPAIR_OBJECT_ID = const_cpu_to_le16(0x0020), - VOLUME_MODIFIED_BY_CHKDSK = const_cpu_to_le16(0x8000), - VOLUME_FLAGS_MASK = const_cpu_to_le16(0x803f), - - /* To make our life easier when checking if we must mount read-only. */ - VOLUME_MUST_MOUNT_RO_MASK = const_cpu_to_le16(0x8037), -} __attribute__ ((__packed__)) VOLUME_FLAGS; +#define VOLUME_IS_DIRTY const_cpu_to_le16(0x0001) +#define VOLUME_RESIZE_LOG_FILE const_cpu_to_le16(0x0002) +#define VOLUME_UPGRADE_ON_MOUNT const_cpu_to_le16(0x0004) +#define VOLUME_MOUNTED_ON_NT4 const_cpu_to_le16(0x0008) +#define VOLUME_DELETE_USN_UNDERWAY const_cpu_to_le16(0x0010) +#define VOLUME_REPAIR_OBJECT_ID const_cpu_to_le16(0x0020) +#define VOLUME_MODIFIED_BY_CHKDSK const_cpu_to_le16(0x8000) +#define VOLUME_FLAGS_MASK const_cpu_to_le16(0x803f) + +/* To make our life easier when checking if we must mount read-only. */ +#define VOLUME_MUST_MOUNT_RO_MASK const_cpu_to_le16(0x8037) + +typedef le16 VOLUME_FLAGS; /* * Attribute: Volume information (0x70). @@ -1804,7 +1804,7 @@ * NTFS 1.2. I haven't personally seen other values yet. */ typedef struct { - u64 reserved; /* Not used (yet?). */ + le64 reserved; /* Not used (yet?). */ u8 major_ver; /* Major version of the ntfs format. */ u8 minor_ver; /* Minor version of the ntfs format. */ VOLUME_FLAGS flags; /* Bit array of VOLUME_* flags. */ @@ -1823,25 +1823,26 @@ /* * Index header flags (8-bit). + * + * When index header is in an index root attribute: */ -typedef enum { - /* When index header is in an index root attribute: */ - SMALL_INDEX = 0, /* The index is small enough to fit inside the - index root attribute and there is no index - allocation attribute present. */ - LARGE_INDEX = 1, /* The index is too large to fit in the index - root attribute and/or an index allocation - attribute is present. */ - /* - * When index header is in an index block, i.e. is part of index - * allocation attribute: - */ - LEAF_NODE = 0, /* This is a leaf node, i.e. there are no more - nodes branching off it. */ - INDEX_NODE = 1, /* This node indexes other nodes, i.e. is not a - leaf node. */ - NODE_MASK = 1, /* Mask for accessing the *_NODE bits. */ -} __attribute__ ((__packed__)) INDEX_HEADER_FLAGS; +#define SMALL_INDEX 0 /* The index is small enough to fit inside the index root + attribute and there is no index allocation attribute + present. */ +#define LARGE_INDEX 1 /* The index is too large to fit in the index root + attribute and/or an index allocation attribute is + present. */ +/* + * When index header is in an index block, i.e. is part of index allocation + * attribute: + */ +#define LEAF_NODE 0 /* This is a leaf node, i.e. there are no more nodes + branching off it. */ +#define INDEX_NODE 1 /* This node indexes other nodes, i.e. it is not a leaf + node. */ +#define NODE_MASK 1 /* Mask for accessing the *_NODE bits. */ + +typedef u8 INDEX_HEADER_FLAGS; /* * This is the header for indexes, describing the INDEX_ENTRY records, which @@ -1853,12 +1854,12 @@ * start of the index root or index allocation structures themselves. */ typedef struct { - u32 entries_offset; /* Byte offset to first INDEX_ENTRY + le32 entries_offset; /* Byte offset to first INDEX_ENTRY aligned to 8-byte boundary. */ - u32 index_length; /* Data size of the index in bytes, + le32 index_length; /* Data size of the index in bytes, i.e. bytes used from allocated size, aligned to 8-byte boundary. */ - u32 allocated_size; /* Byte size of this index (block), + le32 allocated_size; /* Byte size of this index (block), multiple of 8 bytes. */ /* NOTE: For the index root attribute, the above two numbers are always equal, as the attribute is resident and it is resized as needed. In @@ -1891,14 +1892,14 @@ * dircetories do not contain entries for themselves, though. */ typedef struct { - ATTR_TYPES type; /* Type of the indexed attribute. Is + ATTR_TYPE type; /* Type of the indexed attribute. Is $FILE_NAME for directories, zero for view indexes. No other values allowed. */ - COLLATION_RULES collation_rule; /* Collation rule used to sort the + COLLATION_RULE collation_rule; /* Collation rule used to sort the index entries. If type is $FILE_NAME, this must be COLLATION_FILE_NAME. */ - u32 index_block_size; /* Size of each index block in bytes (in + le32 index_block_size; /* Size of each index block in bytes (in the index allocation attribute). */ u8 clusters_per_index_block; /* Cluster size of each index block (in the index allocation attribute), when @@ -1924,13 +1925,13 @@ */ typedef struct { /* 0 NTFS_RECORD; -- Unfolded here as gcc doesn't like unnamed structs. */ - NTFS_RECORD_TYPES magic;/* Magic is "INDX". */ - u16 usa_ofs; /* See NTFS_RECORD definition. */ - u16 usa_count; /* See NTFS_RECORD definition. */ + NTFS_RECORD_TYPE magic; /* Magic is "INDX". */ + le16 usa_ofs; /* See NTFS_RECORD definition. */ + le16 usa_count; /* See NTFS_RECORD definition. */ -/* 8*/ s64 lsn; /* $LogFile sequence number of the last +/* 8*/ sle64 lsn; /* $LogFile sequence number of the last modification of this index block. */ -/* 16*/ VCN index_block_vcn; /* Virtual cluster number of the index block. +/* 16*/ leVCN index_block_vcn; /* Virtual cluster number of the index block. If the cluster_size on the volume is <= the index_block_size of the directory, index_block_vcn counts in units of clusters, @@ -1960,34 +1961,35 @@ * primary key / is not a key at all. (AIA) */ typedef struct { - u32 reparse_tag; /* Reparse point type (inc. flags). */ - MFT_REF file_id; /* Mft record of the file containing the + le32 reparse_tag; /* Reparse point type (inc. flags). */ + leMFT_REF file_id; /* Mft record of the file containing the reparse point attribute. */ } __attribute__ ((__packed__)) REPARSE_INDEX_KEY; /* * Quota flags (32-bit). + * + * The user quota flags. Names explain meaning. */ -typedef enum { - /* The user quota flags. Names explain meaning. */ - QUOTA_FLAG_DEFAULT_LIMITS = const_cpu_to_le32(0x00000001), - QUOTA_FLAG_LIMIT_REACHED = const_cpu_to_le32(0x00000002), - QUOTA_FLAG_ID_DELETED = const_cpu_to_le32(0x00000004), - - QUOTA_FLAG_USER_MASK = const_cpu_to_le32(0x00000007), - /* Bit mask for user quota flags. */ - - /* These flags are only present in the quota defaults index entry, - i.e. in the entry where owner_id = QUOTA_DEFAULTS_ID. */ - QUOTA_FLAG_TRACKING_ENABLED = const_cpu_to_le32(0x00000010), - QUOTA_FLAG_ENFORCEMENT_ENABLED = const_cpu_to_le32(0x00000020), - QUOTA_FLAG_TRACKING_REQUESTED = const_cpu_to_le32(0x00000040), - QUOTA_FLAG_LOG_THRESHOLD = const_cpu_to_le32(0x00000080), - QUOTA_FLAG_LOG_LIMIT = const_cpu_to_le32(0x00000100), - QUOTA_FLAG_OUT_OF_DATE = const_cpu_to_le32(0x00000200), - QUOTA_FLAG_CORRUPT = const_cpu_to_le32(0x00000400), - QUOTA_FLAG_PENDING_DELETES = const_cpu_to_le32(0x00000800), -} QUOTA_FLAGS; +#define QUOTA_FLAG_DEFAULT_LIMITS const_cpu_to_le32(0x00000001) +#define QUOTA_FLAG_LIMIT_REACHED const_cpu_to_le32(0x00000002) +#define QUOTA_FLAG_ID_DELETED const_cpu_to_le32(0x00000004) + +#define QUOTA_FLAG_USER_MASK const_cpu_to_le32(0x00000007) + /* Bit mask for user quota flags. */ + +/* These flags are only present in the quota defaults index entry, i.e. in the + entry where owner_id = QUOTA_DEFAULTS_ID. */ +#define QUOTA_FLAG_TRACKING_ENABLED const_cpu_to_le32(0x00000010) +#define QUOTA_FLAG_ENFORCEMENT_ENABLED const_cpu_to_le32(0x00000020) +#define QUOTA_FLAG_TRACKING_REQUESTED const_cpu_to_le32(0x00000040) +#define QUOTA_FLAG_LOG_THRESHOLD const_cpu_to_le32(0x00000080) +#define QUOTA_FLAG_LOG_LIMIT const_cpu_to_le32(0x00000100) +#define QUOTA_FLAG_OUT_OF_DATE const_cpu_to_le32(0x00000200) +#define QUOTA_FLAG_CORRUPT const_cpu_to_le32(0x00000400) +#define QUOTA_FLAG_PENDING_DELETES const_cpu_to_le32(0x00000800) + +typedef le32 QUOTA_FLAGS; /* * The system file FILE_Extend/$Quota contains two indexes $O and $Q. Quotas @@ -2011,13 +2013,13 @@ * The $Q index entry data is the quota control entry and is defined below. */ typedef struct { - u32 version; /* Currently equals 2. */ + le32 version; /* Currently equals 2. */ QUOTA_FLAGS flags; /* Flags describing this quota entry. */ - u64 bytes_used; /* How many bytes of the quota are in use. */ - s64 change_time; /* Last time this quota entry was changed. */ - s64 threshold; /* Soft quota (-1 if not limited). */ - s64 limit; /* Hard quota (-1 if not limited). */ - s64 exceeded_time; /* How long the soft quota has been exceeded. */ + le64 bytes_used; /* How many bytes of the quota are in use. */ + sle64 change_time; /* Last time this quota entry was changed. */ + sle64 threshold; /* Soft quota (-1 if not limited). */ + sle64 limit; /* Hard quota (-1 if not limited). */ + sle64 exceeded_time; /* How long the soft quota has been exceeded. */ SID sid; /* The SID of the user/object associated with this quota entry. Equals zero for the quota defaults entry (and in fact on a WinXP @@ -2027,11 +2029,9 @@ /* * Predefined owner_id values (32-bit). */ -typedef enum { - QUOTA_INVALID_ID = const_cpu_to_le32(0x00000000), - QUOTA_DEFAULTS_ID = const_cpu_to_le32(0x00000001), - QUOTA_FIRST_USER_ID = const_cpu_to_le32(0x00000100), -} PREDEFINED_OWNER_IDS; +#define QUOTA_INVALID_ID const_cpu_to_le32(0x00000000) +#define QUOTA_DEFAULTS_ID const_cpu_to_le32(0x00000001) +#define QUOTA_FIRST_USER_ID const_cpu_to_le32(0x00000100) /* * Current constants for quota control entries. @@ -2044,18 +2044,14 @@ /* * Index entry flags (16-bit). */ -typedef enum { - INDEX_ENTRY_NODE = const_cpu_to_le16(1), /* This entry contains a - sub-node, i.e. a reference to an - index block in form of a virtual - cluster number (see below). */ - INDEX_ENTRY_END = const_cpu_to_le16(2), /* This signifies the last - entry in an index block. The - index entry does not represent a - file but it can point to a - sub-node. */ - INDEX_ENTRY_SPACE_FILLER = 0xffff, /* Just to force 16-bit width. */ -} __attribute__ ((__packed__)) INDEX_ENTRY_FLAGS; +#define INDEX_ENTRY_NODE const_cpu_to_le16(1) /* This entry contains a + sub-node, i.e. a reference to an index block in form of + a virtual cluster number (see below). */ +#define INDEX_ENTRY_END const_cpu_to_le16(2) /* This signifies the last entry + in an index block. The index entry does not represent + a file but it can point to a sub-node. */ + +typedef le16 INDEX_ENTRY_FLAGS; /* * This the index entry header (see below). @@ -2063,26 +2059,26 @@ typedef struct { /* 0*/ union { struct { /* Only valid when INDEX_ENTRY_END is not set. */ - MFT_REF indexed_file; /* The mft reference of the file + leMFT_REF indexed_file; /* The mft reference of the file described by this index entry. Used for directory indexes. */ } __attribute__ ((__packed__)) dir; struct { /* Used for views/indexes to find the entry's data. */ - u16 data_offset; /* Data byte offset from this + le16 data_offset; /* Data byte offset from this INDEX_ENTRY. Follows the index key. */ - u16 data_length; /* Data length in bytes. */ - u32 reservedV; /* Reserved (zero). */ + le16 data_length; /* Data length in bytes. */ + le32 reservedV; /* Reserved (zero). */ } __attribute__ ((__packed__)) vi; } __attribute__ ((__packed__)) data; -/* 8*/ u16 length; /* Byte size of this index entry, multiple of +/* 8*/ le16 length; /* Byte size of this index entry, multiple of 8-bytes. */ -/* 10*/ u16 key_length; /* Byte size of the key value, which is in the +/* 10*/ le16 key_length; /* Byte size of the key value, which is in the index entry. It follows field reserved. Not multiple of 8-bytes. */ /* 12*/ INDEX_ENTRY_FLAGS flags; /* Bit field of INDEX_ENTRY_* flags. */ -/* 14*/ u16 reserved; /* Reserved/align to 8-byte boundary. */ +/* 14*/ le16 reserved; /* Reserved/align to 8-byte boundary. */ /* sizeof() = 16 bytes */ } __attribute__ ((__packed__)) INDEX_ENTRY_HEADER; @@ -2098,26 +2094,26 @@ /* 0 INDEX_ENTRY_HEADER; -- Unfolded here as gcc dislikes unnamed structs. */ union { struct { /* Only valid when INDEX_ENTRY_END is not set. */ - MFT_REF indexed_file; /* The mft reference of the file + leMFT_REF indexed_file; /* The mft reference of the file described by this index entry. Used for directory indexes. */ } __attribute__ ((__packed__)) dir; struct { /* Used for views/indexes to find the entry's data. */ - u16 data_offset; /* Data byte offset from this + le16 data_offset; /* Data byte offset from this INDEX_ENTRY. Follows the index key. */ - u16 data_length; /* Data length in bytes. */ - u32 reservedV; /* Reserved (zero). */ + le16 data_length; /* Data length in bytes. */ + le32 reservedV; /* Reserved (zero). */ } __attribute__ ((__packed__)) vi; } __attribute__ ((__packed__)) data; - u16 length; /* Byte size of this index entry, multiple of + le16 length; /* Byte size of this index entry, multiple of 8-bytes. */ - u16 key_length; /* Byte size of the key value, which is in the + le16 key_length; /* Byte size of the key value, which is in the index entry. It follows field reserved. Not multiple of 8-bytes. */ INDEX_ENTRY_FLAGS flags; /* Bit field of INDEX_ENTRY_* flags. */ - u16 reserved; /* Reserved/align to 8-byte boundary. */ + le16 reserved; /* Reserved/align to 8-byte boundary. */ /* 16*/ union { /* The key of the indexed attribute. NOTE: Only present if INDEX_ENTRY_END bit in flags is not set. NOTE: On @@ -2134,13 +2130,13 @@ FILE_Extend/$Reparse. */ SID sid; /* $O index in FILE_Extend/$Quota: SID of the owner of the user_id. */ - u32 owner_id; /* $Q index in FILE_Extend/$Quota: + le32 owner_id; /* $Q index in FILE_Extend/$Quota: user_id of the owner of the quota control entry in the data part of the index. */ } __attribute__ ((__packed__)) key; /* The (optional) index data is inserted here when creating. */ - // VCN vcn; /* If INDEX_ENTRY_NODE bit in flags is set, the last + // leVCN vcn; /* If INDEX_ENTRY_NODE bit in flags is set, the last // eight bytes of this index entry contain the virtual // cluster number of the index block that holds the // entries immediately preceding the current entry (the @@ -2185,29 +2181,29 @@ * be slow. (E.g. the data is stored on a tape drive.) * bit 31: Microsoft bit. If set, the tag is owned by Microsoft. User * defined tags have to use zero here. + * + * These are the predefined reparse point tags: */ -typedef enum { - IO_REPARSE_TAG_IS_ALIAS = const_cpu_to_le32(0x20000000), - IO_REPARSE_TAG_IS_HIGH_LATENCY = const_cpu_to_le32(0x40000000), - IO_REPARSE_TAG_IS_MICROSOFT = const_cpu_to_le32(0x80000000), +#define IO_REPARSE_TAG_IS_ALIAS const_cpu_to_le32(0x20000000) +#define IO_REPARSE_TAG_IS_HIGH_LATENCY const_cpu_to_le32(0x40000000) +#define IO_REPARSE_TAG_IS_MICROSOFT const_cpu_to_le32(0x80000000) - IO_REPARSE_TAG_RESERVED_ZERO = const_cpu_to_le32(0x00000000), - IO_REPARSE_TAG_RESERVED_ONE = const_cpu_to_le32(0x00000001), - IO_REPARSE_TAG_RESERVED_RANGE = const_cpu_to_le32(0x00000001), +#define IO_REPARSE_TAG_RESERVED_ZERO const_cpu_to_le32(0x00000000) +#define IO_REPARSE_TAG_RESERVED_ONE const_cpu_to_le32(0x00000001) +#define IO_REPARSE_TAG_RESERVED_RANGE const_cpu_to_le32(0x00000001) - IO_REPARSE_TAG_NSS = const_cpu_to_le32(0x68000005), - IO_REPARSE_TAG_NSS_RECOVER = const_cpu_to_le32(0x68000006), - IO_REPARSE_TAG_SIS = const_cpu_to_le32(0x68000007), - IO_REPARSE_TAG_DFS = const_cpu_to_le32(0x68000008), +#define IO_REPARSE_TAG_NSS const_cpu_to_le32(0x68000005) +#define IO_REPARSE_TAG_NSS_RECOVER const_cpu_to_le32(0x68000006) +#define IO_REPARSE_TAG_SIS const_cpu_to_le32(0x68000007) +#define IO_REPARSE_TAG_DFS const_cpu_to_le32(0x68000008) - IO_REPARSE_TAG_MOUNT_POINT = const_cpu_to_le32(0x88000003), +#define IO_REPARSE_TAG_MOUNT_POINT const_cpu_to_le32(0x88000003) - IO_REPARSE_TAG_HSM = const_cpu_to_le32(0xa8000004), +#define IO_REPARSE_TAG_HSM const_cpu_to_le32(0xa8000004) - IO_REPARSE_TAG_SYMBOLIC_LINK = const_cpu_to_le32(0xe8000000), +#define IO_REPARSE_TAG_SYMBOLIC_LINK const_cpu_to_le32(0xe8000000) - IO_REPARSE_TAG_VALID_VALUES = const_cpu_to_le32(0xe000ffff), -} PREDEFINED_REPARSE_TAGS; +#define IO_REPARSE_TAG_VALID_VALUES const_cpu_to_le32(0xe000ffff) /* * Attribute: Reparse point (0xc0). @@ -2215,9 +2211,9 @@ * NOTE: Can be resident or non-resident. */ typedef struct { - u32 reparse_tag; /* Reparse point type (inc. flags). */ - u16 reparse_data_length; /* Byte size of reparse data. */ - u16 reserved; /* Align to 8-byte boundary. */ + le32 reparse_tag; /* Reparse point type (inc. flags). */ + le16 reparse_data_length; /* Byte size of reparse data. */ + le16 reserved; /* Align to 8-byte boundary. */ u8 reparse_data[0]; /* Meaning depends on reparse_tag. */ } __attribute__ ((__packed__)) REPARSE_POINT; @@ -2227,11 +2223,11 @@ * NOTE: Always resident. (Is this true???) */ typedef struct { - u16 ea_length; /* Byte size of the packed extended + le16 ea_length; /* Byte size of the packed extended attributes. */ - u16 need_ea_count; /* The number of extended attributes which have + le16 need_ea_count; /* The number of extended attributes which have the NEED_EA bit set. */ - u32 ea_query_length; /* Byte size of the buffer required to query + le32 ea_query_length; /* Byte size of the buffer required to query the extended attributes when calling ZwQueryEaFile() in Windows NT/2k. I.e. the byte size of the unpacked extended @@ -2241,9 +2237,9 @@ /* * Extended attribute flags (8-bit). */ -typedef enum { - NEED_EA = 0x80, -} __attribute__ ((__packed__)) EA_FLAGS; +#define NEED_EA 0x80 + +typedef u8 EA_FLAGS; /* * Attribute: Extended attribute (EA) (0xe0). @@ -2256,10 +2252,10 @@ * FIXME: It appears weird that the EA name is not unicode. Is it true? */ typedef struct { - u32 next_entry_offset; /* Offset to the next EA_ATTR. */ + le32 next_entry_offset; /* Offset to the next EA_ATTR. */ EA_FLAGS flags; /* Flags describing the EA. */ u8 ea_name_length; /* Length of the name of the EA in bytes. */ - u16 ea_value_length; /* Byte size of the EA's value. */ + le16 ea_value_length; /* Byte size of the EA's value. */ u8 ea_name[0]; /* Name of the EA. */ u8 ea_value[0]; /* The value of the EA. Immediately follows the name. */ diff -Nru a/fs/ntfs/logfile.c b/fs/ntfs/logfile.c --- a/fs/ntfs/logfile.c 2004-09-26 10:25:56 -07:00 +++ b/fs/ntfs/logfile.c 2004-09-26 10:25:56 -07:00 @@ -497,7 +497,7 @@ * empty block after a non-empty block has been encountered * means we are done. */ - if (!ntfs_is_empty_recordp(kaddr)) + if (!ntfs_is_empty_recordp((le32*)kaddr)) logfile_is_empty = FALSE; else if (!logfile_is_empty) break; @@ -505,20 +505,20 @@ * A log record page means there cannot be a restart page after * this so no need to continue searching. */ - if (ntfs_is_rcrd_recordp(kaddr)) + if (ntfs_is_rcrd_recordp((le32*)kaddr)) break; /* * A modified by chkdsk restart page means we cannot handle * this log file. */ - if (ntfs_is_chkd_recordp(kaddr)) { + if (ntfs_is_chkd_recordp((le32*)kaddr)) { ntfs_error(vol->sb, "$LogFile has been modified by " "chkdsk. Mount this volume in " "Windows."); goto err_out; } /* If not a restart page, continue. */ - if (!ntfs_is_rstr_recordp(kaddr)) { + if (!ntfs_is_rstr_recordp((le32*)kaddr)) { /* Skip to the minimum page size for the next one. */ if (!pos) pos = NTFS_BLOCK_SIZE >> 1; diff -Nru a/fs/ntfs/logfile.h b/fs/ntfs/logfile.h --- a/fs/ntfs/logfile.h 2004-09-26 10:25:57 -07:00 +++ b/fs/ntfs/logfile.h 2004-09-26 10:25:57 -07:00 @@ -67,34 +67,34 @@ typedef struct { /*Ofs*/ /* 0 NTFS_RECORD; -- Unfolded here as gcc doesn't like unnamed structs. */ -/* 0*/ NTFS_RECORD_TYPES magic;/* The magic is "RSTR". */ -/* 4*/ u16 usa_ofs; /* See NTFS_RECORD definition in layout.h. +/* 0*/ NTFS_RECORD_TYPE magic; /* The magic is "RSTR". */ +/* 4*/ le16 usa_ofs; /* See NTFS_RECORD definition in layout.h. When creating, set this to be immediately after this header structure (without any alignment). */ -/* 6*/ u16 usa_count; /* See NTFS_RECORD definition in layout.h. */ +/* 6*/ le16 usa_count; /* See NTFS_RECORD definition in layout.h. */ -/* 8*/ LSN chkdsk_lsn; /* The last log file sequence number found by +/* 8*/ leLSN chkdsk_lsn; /* The last log file sequence number found by chkdsk. Only used when the magic is changed to "CHKD". Otherwise this is zero. */ -/* 16*/ u32 system_page_size; /* Byte size of system pages when the log file +/* 16*/ le32 system_page_size; /* Byte size of system pages when the log file was created, has to be >= 512 and a power of 2. Use this to calculate the required size of the usa (usa_count) and add it to usa_ofs. Then verify that the result is less than the value of the restart_area_offset. */ -/* 20*/ u32 log_page_size; /* Byte size of log file pages, has to be >= +/* 20*/ le32 log_page_size; /* Byte size of log file pages, has to be >= 512 and a power of 2. The default is 4096 and is used when the system page size is between 4096 and 8192. Otherwise this is set to the system page size instead. */ -/* 24*/ u16 restart_area_offset;/* Byte offset from the start of this header to +/* 24*/ le16 restart_area_offset;/* Byte offset from the start of this header to the RESTART_AREA. Value has to be aligned to 8-byte boundary. When creating, set this to be after the usa. */ -/* 26*/ s16 minor_ver; /* Log file minor version. Only check if major +/* 26*/ sle16 minor_ver; /* Log file minor version. Only check if major version is 1. */ -/* 28*/ s16 major_ver; /* Log file major version. We only support +/* 28*/ sle16 major_ver; /* Log file major version. We only support version 1.1. */ /* sizeof() = 30 (0x1e) bytes */ } __attribute__ ((__packed__)) RESTART_PAGE_HEADER; @@ -123,16 +123,16 @@ */ typedef struct { /*Ofs*/ -/* 0*/ LSN current_lsn; /* The current, i.e. last LSN inside the log +/* 0*/ leLSN current_lsn; /* The current, i.e. last LSN inside the log when the restart area was last written. This happens often but what is the interval? Is it just fixed time or is it every time a check point is written or somethine else? On create set to 0. */ -/* 8*/ u16 log_clients; /* Number of log client records in the array of +/* 8*/ le16 log_clients; /* Number of log client records in the array of log client records which follows this restart area. Must be 1. */ -/* 10*/ u16 client_free_list; /* The index of the first free log client record +/* 10*/ le16 client_free_list; /* The index of the first free log client record in the array of log client records. LOGFILE_NO_CLIENT means that there are no free log client records in the array. @@ -148,7 +148,7 @@ and presumably later, the logfile is always open, even on clean shutdown so this should always be LOGFILE_NO_CLIENT. */ -/* 12*/ u16 client_in_use_list; /* The index of the first in-use log client +/* 12*/ le16 client_in_use_list;/* The index of the first in-use log client record in the array of log client records. LOGFILE_NO_CLIENT means that there are no in-use log client records in the array. If @@ -181,13 +181,13 @@ clean. If on the other hand the logfile is open and this bit is clear, we can be almost certain that the logfile is dirty. */ -/* 16*/ u32 seq_number_bits; /* How many bits to use for the sequence +/* 16*/ le32 seq_number_bits; /* How many bits to use for the sequence number. This is calculated as 67 - the number of bits required to store the logfile size in bytes and this can be used in with the specified file_size as a consistency check. */ -/* 20*/ u16 restart_area_length;/* Length of the restart area including the +/* 20*/ le16 restart_area_length;/* Length of the restart area including the client array. Following checks required if version matches. Otherwise, skip them. restart_area_offset + restart_area_length @@ -195,7 +195,7 @@ restart_area_length has to be >= client_array_offset + (log_clients * sizeof(log client record)). */ -/* 22*/ u16 client_array_offset;/* Offset from the start of this record to +/* 22*/ le16 client_array_offset;/* Offset from the start of this record to the first log client record if versions are matched. When creating, set this to be after this restart area structure, aligned @@ -217,7 +217,7 @@ the client array. This probably means that the RESTART_AREA record is actually bigger in WinXP and later. */ -/* 24*/ s64 file_size; /* Usable byte size of the log file. If the +/* 24*/ sle64 file_size; /* Usable byte size of the log file. If the restart_area_offset + the offset of the file_size are > 510 then corruption has occured. This is the very first check when @@ -230,28 +230,28 @@ then it has to be at least big enough to store the two restart pages and 48 (0x30) log record pages. */ -/* 32*/ u32 last_lsn_data_length;/* Length of data of last LSN, not including +/* 32*/ le32 last_lsn_data_length;/* Length of data of last LSN, not including the log record header. On create set to 0. */ -/* 36*/ u16 log_record_header_length;/* Byte size of the log record header. If - the version matches then check that the +/* 36*/ le16 log_record_header_length;/* Byte size of the log record header. + If the version matches then check that the value of log_record_header_length is a multiple of 8, i.e. (log_record_header_length + 7) & ~7 == log_record_header_length. When creating set it to sizeof(LOG_RECORD_HEADER), aligned to 8 bytes. */ -/* 38*/ u16 log_page_data_offset;/* Offset to the start of data in a log record +/* 38*/ le16 log_page_data_offset;/* Offset to the start of data in a log record page. Must be a multiple of 8. On create set it to immediately after the update sequence array of the log record page. */ -/* 40*/ u32 restart_log_open_count;/* A counter that gets incremented every time - the logfile is restarted which happens at - mount time when the logfile is opened. When - creating set to a random value. Win2k sets - it to the low 32 bits of the current system - time in NTFS format (see time.h). */ -/* 44*/ u32 reserved; /* Reserved/alignment to 8-byte boundary. */ +/* 40*/ le32 restart_log_open_count;/* A counter that gets incremented every + time the logfile is restarted which happens + at mount time when the logfile is opened. + When creating set to a random value. Win2k + sets it to the low 32 bits of the current + system time in NTFS format (see time.h). */ +/* 44*/ le32 reserved; /* Reserved/alignment to 8-byte boundary. */ /* sizeof() = 48 (0x30) bytes */ } __attribute__ ((__packed__)) RESTART_AREA; @@ -261,32 +261,32 @@ */ typedef struct { /*Ofs*/ -/* 0*/ LSN oldest_lsn; /* Oldest LSN needed by this client. On create +/* 0*/ leLSN oldest_lsn; /* Oldest LSN needed by this client. On create set to 0. */ -/* 8*/ LSN client_restart_lsn; /* LSN at which this client needs to restart +/* 8*/ leLSN client_restart_lsn;/* LSN at which this client needs to restart the volume, i.e. the current position within the log file. At present, if clean this should = current_lsn in restart area but it probably also = current_lsn when dirty most of the time. At create set to 0. */ -/* 16*/ u16 prev_client; /* The offset to the previous log client record +/* 16*/ le16 prev_client; /* The offset to the previous log client record in the array of log client records. LOGFILE_NO_CLIENT means there is no previous client record, i.e. this is the first one. This is always LOGFILE_NO_CLIENT. */ -/* 18*/ u16 next_client; /* The offset to the next log client record in +/* 18*/ le16 next_client; /* The offset to the next log client record in the array of log client records. LOGFILE_NO_CLIENT means there are no next client records, i.e. this is the last one. This is always LOGFILE_NO_CLIENT. */ -/* 20*/ u16 seq_number; /* On Win2k and presumably earlier, this is set +/* 20*/ le16 seq_number; /* On Win2k and presumably earlier, this is set to zero every time the logfile is restarted and it is incremented when the logfile is closed at dismount time. Thus it is 0 when dirty and 1 when clean. On WinXP and presumably later, this is always 0. */ /* 22*/ u8 reserved[6]; /* Reserved/alignment. */ -/* 28*/ u32 client_name_length; /* Length of client name in bytes. Should +/* 28*/ le32 client_name_length;/* Length of client name in bytes. Should always be 8. */ /* 32*/ ntfschar client_name[64];/* Name of the client in Unicode. Should always be "NTFS" with the remaining bytes diff -Nru a/fs/ntfs/mft.c b/fs/ntfs/mft.c --- a/fs/ntfs/mft.c 2004-09-26 10:25:56 -07:00 +++ b/fs/ntfs/mft.c 2004-09-26 10:25:56 -07:00 @@ -44,7 +44,7 @@ m->usa_ofs = cpu_to_le16((sizeof(MFT_RECORD) + 1) & ~1); m->usa_count = cpu_to_le16(size / NTFS_BLOCK_SIZE + 1); /* Set the update sequence number to 1. */ - *(u16*)((char*)m + ((sizeof(MFT_RECORD) + 1) & ~1)) = cpu_to_le16(1); + *(le16*)((char*)m + ((sizeof(MFT_RECORD) + 1) & ~1)) = cpu_to_le16(1); m->lsn = cpu_to_le64(0LL); m->sequence_number = cpu_to_le16(1); m->link_count = cpu_to_le16(0); @@ -311,11 +311,11 @@ /** * map_extent_mft_record - load an extent inode and attach it to its base * @base_ni: base ntfs inode - * @mref: mft reference of the extent inode to load (in little endian) + * @mref: mft reference of the extent inode to load * @ntfs_ino: on successful return, pointer to the ntfs_inode structure * * Load the extent mft record @mref and attach it to its base inode @base_ni. - * Return the mapped extent mft record if IS_ERR(result) is false. Otherwise + * Return the mapped extent mft record if IS_ERR(result) is false. Otherwise * PTR_ERR(result) gives the negative error code. * * On successful return, @ntfs_ino contains a pointer to the ntfs_inode @@ -328,8 +328,8 @@ ntfs_inode *ni = NULL; ntfs_inode **extent_nis = NULL; int i; - unsigned long mft_no = MREF_LE(mref); - u16 seq_no = MSEQNO_LE(mref); + unsigned long mft_no = MREF(mref); + u16 seq_no = MSEQNO(mref); BOOL destroy_ni = FALSE; ntfs_debug("Mapping extent mft record 0x%lx (base mft record 0x%lx).", @@ -418,7 +418,8 @@ m = ERR_PTR(-ENOMEM); goto unm_err_out; } - if (base_ni->ext.extent_ntfs_inos) { + if (base_ni->nr_extents) { + BUG_ON(!base_ni->ext.extent_ntfs_inos); memcpy(tmp, base_ni->ext.extent_ntfs_inos, new_size - 4 * sizeof(ntfs_inode *)); kfree(base_ni->ext.extent_ntfs_inos); @@ -979,7 +980,7 @@ ntfs_debug("Inode 0x%lx is not in icache.", mft_no); /* The inode is not in icache. */ /* Skip the record if it is not a mft record (type "FILE"). */ - if (!ntfs_is_mft_recordp(maddr)) { + if (!ntfs_is_mft_recordp((le32*)maddr)) { ntfs_debug("Mft record 0x%lx is not a FILE record, " "continuing search.", mft_no); continue; diff -Nru a/fs/ntfs/mst.c b/fs/ntfs/mst.c --- a/fs/ntfs/mst.c 2004-09-26 10:25:56 -07:00 +++ b/fs/ntfs/mst.c 2004-09-26 10:25:56 -07:00 @@ -122,8 +122,9 @@ */ int pre_write_mst_fixup(NTFS_RECORD *b, const u32 size) { + le16 *usa_pos, *data_pos; u16 usa_ofs, usa_count, usn; - u16 *usa_pos, *data_pos; + le16 le_usn; /* Sanity check + only fixup if it makes sense. */ if (!b || ntfs_is_baad_record(b->magic) || @@ -140,7 +141,7 @@ (size >> NTFS_BLOCK_SIZE_BITS) != usa_count) return -EINVAL; /* Position of usn in update sequence array. */ - usa_pos = (u16*)((u8*)b + usa_ofs); + usa_pos = (le16*)((u8*)b + usa_ofs); /* * Cyclically increment the update sequence number * (skipping 0 and -1, i.e. 0xffff). @@ -148,10 +149,10 @@ usn = le16_to_cpup(usa_pos) + 1; if (usn == 0xffff || !usn) usn = 1; - usn = cpu_to_le16(usn); - *usa_pos = usn; + le_usn = cpu_to_le16(usn); + *usa_pos = le_usn; /* Position in data of first u16 that needs fixing up. */ - data_pos = (u16*)b + NTFS_BLOCK_SIZE/sizeof(u16) - 1; + data_pos = (le16*)b + NTFS_BLOCK_SIZE/sizeof(le16) - 1; /* Fixup all sectors. */ while (usa_count--) { /* @@ -160,9 +161,9 @@ */ *(++usa_pos) = *data_pos; /* Apply fixup to data. */ - *data_pos = usn; + *data_pos = le_usn; /* Increment position in data as well. */ - data_pos += NTFS_BLOCK_SIZE/sizeof(u16); + data_pos += NTFS_BLOCK_SIZE/sizeof(le16); } return 0; } @@ -177,16 +178,16 @@ */ void post_write_mst_fixup(NTFS_RECORD *b) { - u16 *usa_pos, *data_pos; + le16 *usa_pos, *data_pos; u16 usa_ofs = le16_to_cpu(b->usa_ofs); u16 usa_count = le16_to_cpu(b->usa_count) - 1; /* Position of usn in update sequence array. */ - usa_pos = (u16*)b + usa_ofs/sizeof(u16); + usa_pos = (le16*)b + usa_ofs/sizeof(le16); /* Position in protected data of first u16 that needs fixing up. */ - data_pos = (u16*)b + NTFS_BLOCK_SIZE/sizeof(u16) - 1; + data_pos = (le16*)b + NTFS_BLOCK_SIZE/sizeof(le16) - 1; /* Fixup all sectors. */ while (usa_count--) { @@ -197,6 +198,6 @@ *data_pos = *(++usa_pos); /* Increment position in data as well. */ - data_pos += NTFS_BLOCK_SIZE/sizeof(u16); + data_pos += NTFS_BLOCK_SIZE/sizeof(le16); } } diff -Nru a/fs/ntfs/namei.c b/fs/ntfs/namei.c --- a/fs/ntfs/namei.c 2004-09-26 10:25:57 -07:00 +++ b/fs/ntfs/namei.c 2004-09-26 10:25:57 -07:00 @@ -171,7 +171,7 @@ { struct dentry *real_dent, *new_dent; MFT_RECORD *m; - attr_search_context *ctx; + ntfs_attr_search_ctx *ctx; ntfs_inode *ni = NTFS_I(dent_inode); int err; struct qstr nls_name; @@ -196,8 +196,8 @@ ctx = NULL; goto err_out; } - ctx = get_attr_search_ctx(ni, m); - if (!ctx) { + ctx = ntfs_attr_get_search_ctx(ni, m); + if (unlikely(!ctx)) { err = -ENOMEM; goto err_out; } @@ -205,12 +205,14 @@ ATTR_RECORD *a; u32 val_len; - if (!lookup_attr(AT_FILE_NAME, NULL, 0, 0, 0, NULL, 0, - ctx)) { + err = ntfs_attr_lookup(AT_FILE_NAME, NULL, 0, 0, 0, + NULL, 0, ctx); + if (unlikely(err)) { ntfs_error(vol->sb, "Inode corrupt: No WIN32 " "namespace counterpart to DOS " "file name. Run chkdsk."); - err = -EIO; + if (err == -ENOENT) + err = -EIO; goto err_out; } /* Consistency checks. */ @@ -233,7 +235,7 @@ (ntfschar*)&fn->file_name, fn->file_name_length, (unsigned char**)&nls_name.name, 0); - put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); unmap_mft_record(ni); } m = NULL; @@ -329,7 +331,7 @@ err = -EIO; err_out: if (ctx) - put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); if (m) unmap_mft_record(ni); iput(dent_inode); @@ -366,12 +368,13 @@ struct inode *vi = child_dent->d_inode; ntfs_inode *ni = NTFS_I(vi); MFT_RECORD *mrec; - attr_search_context *ctx; + ntfs_attr_search_ctx *ctx; ATTR_RECORD *attr; FILE_NAME_ATTR *fn; struct inode *parent_vi; struct dentry *parent_dent; unsigned long parent_ino; + int err; ntfs_debug("Entering for inode 0x%lx.", vi->i_ino); /* Get the mft record of the inode belonging to the child dentry. */ @@ -379,19 +382,22 @@ if (IS_ERR(mrec)) return (struct dentry *)mrec; /* Find the first file name attribute in the mft record. */ - ctx = get_attr_search_ctx(ni, mrec); + ctx = ntfs_attr_get_search_ctx(ni, mrec); if (unlikely(!ctx)) { unmap_mft_record(ni); return ERR_PTR(-ENOMEM); } try_next: - if (unlikely(!lookup_attr(AT_FILE_NAME, NULL, 0, CASE_SENSITIVE, 0, - NULL, 0, ctx))) { - put_attr_search_ctx(ctx); + err = ntfs_attr_lookup(AT_FILE_NAME, NULL, 0, CASE_SENSITIVE, 0, NULL, + 0, ctx); + if (unlikely(err)) { + ntfs_attr_put_search_ctx(ctx); unmap_mft_record(ni); - ntfs_error(vi->i_sb, "Inode 0x%lx does not have a file name " - "attribute. Run chkdsk.", vi->i_ino); - return ERR_PTR(-ENOENT); + if (err == -ENOENT) + ntfs_error(vi->i_sb, "Inode 0x%lx does not have a " + "file name attribute. Run chkdsk.", + vi->i_ino); + return ERR_PTR(err); } attr = ctx->attr; if (unlikely(attr->non_resident)) @@ -404,7 +410,7 @@ /* Get the inode number of the parent directory. */ parent_ino = MREF_LE(fn->parent_directory); /* Release the search context and the mft record of the child. */ - put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); unmap_mft_record(ni); /* Get the inode of the parent directory. */ parent_vi = ntfs_iget(vi->i_sb, parent_ino); diff -Nru a/fs/ntfs/ntfs.h b/fs/ntfs/ntfs.h --- a/fs/ntfs/ntfs.h 2004-09-26 10:25:56 -07:00 +++ b/fs/ntfs/ntfs.h 2004-09-26 10:25:56 -07:00 @@ -156,7 +156,7 @@ /* From fs/ntfs/super.c */ #define default_upcase_len 0x10000 -extern wchar_t *default_upcase; +extern ntfschar *default_upcase; extern unsigned long ntfs_nr_upcase_users; extern struct semaphore ntfs_lock; diff -Nru a/fs/ntfs/quota.c b/fs/ntfs/quota.c --- a/fs/ntfs/quota.c 2004-09-26 10:25:58 -07:00 +++ b/fs/ntfs/quota.c 2004-09-26 10:25:58 -07:00 @@ -37,7 +37,7 @@ { ntfs_index_context *ictx; QUOTA_CONTROL_ENTRY *qce; - const u32 qid = QUOTA_DEFAULTS_ID; + const le32 qid = QUOTA_DEFAULTS_ID; int err; ntfs_debug("Entering."); diff -Nru a/fs/ntfs/super.c b/fs/ntfs/super.c --- a/fs/ntfs/super.c 2004-09-26 10:25:57 -07:00 +++ b/fs/ntfs/super.c 2004-09-26 10:25:57 -07:00 @@ -29,6 +29,7 @@ #include #include #include +#include #include "ntfs.h" #include "sysctl.h" @@ -144,7 +145,7 @@ ntfs_debug("Entering with mount options string: %s", opt); while ((p = strsep(&opt, ","))) { if ((v = strchr(p, '='))) - *v++ = '\0'; + *v++ = 0; NTFS_GETOPT("uid", uid) else NTFS_GETOPT("gid", gid) else NTFS_GETOPT("umask", fmask = dmask) @@ -317,11 +318,11 @@ ntfs_inode *ni = NTFS_I(vol->vol_ino); MFT_RECORD *m; VOLUME_INFORMATION *vi; - attr_search_context *ctx; + ntfs_attr_search_ctx *ctx; int err; ntfs_debug("Entering, old flags = 0x%x, new flags = 0x%x.", - vol->vol_flags, flags); + le16_to_cpu(vol->vol_flags), le16_to_cpu(flags)); if (vol->vol_flags == flags) goto done; BUG_ON(!ni); @@ -330,28 +331,28 @@ err = PTR_ERR(m); goto err_out; } - ctx = get_attr_search_ctx(ni, m); + ctx = ntfs_attr_get_search_ctx(ni, m); if (!ctx) { err = -ENOMEM; goto put_unm_err_out; } - if (!lookup_attr(AT_VOLUME_INFORMATION, NULL, 0, 0, 0, NULL, 0, ctx)) { - err = -EIO; + err = ntfs_attr_lookup(AT_VOLUME_INFORMATION, NULL, 0, 0, 0, NULL, 0, + ctx); + if (err) goto put_unm_err_out; - } vi = (VOLUME_INFORMATION*)((u8*)ctx->attr + le16_to_cpu(ctx->attr->data.resident.value_offset)); vol->vol_flags = vi->flags = flags; flush_dcache_mft_record_page(ctx->ntfs_ino); mark_mft_record_dirty(ctx->ntfs_ino); - put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); unmap_mft_record(ni); done: ntfs_debug("Done."); return 0; put_unm_err_out: if (ctx) - put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); unmap_mft_record(ni); err_out: ntfs_error(vol->sb, "Failed with error code %i.", -err); @@ -385,7 +386,8 @@ static inline int ntfs_clear_volume_flags(ntfs_volume *vol, VOLUME_FLAGS flags) { flags &= VOLUME_FLAGS_MASK; - return ntfs_write_volume_flags(vol, vol->vol_flags & ~flags); + flags = vol->vol_flags & cpu_to_le16(~le16_to_cpu(flags)); + return ntfs_write_volume_flags(vol, flags); } #endif /* NTFS_RW */ @@ -510,8 +512,10 @@ * field. If checksum is zero, no checking is done. */ if ((void*)b < (void*)&b->checksum && b->checksum) { - u32 i, *u; - for (i = 0, u = (u32*)b; u < (u32*)(&b->checksum); ++u) + le32 *u; + u32 i; + + for (i = 0, u = (le32*)b; u < (le32*)(&b->checksum); ++u) i += le32_to_cpup(u); if (le32_to_cpu(b->checksum) != i) goto not_ntfs; @@ -520,7 +524,7 @@ if (b->oem_id != magicNTFS) goto not_ntfs; /* Check bytes per sector value is between 256 and 4096. */ - if (le16_to_cpu(b->bpb.bytes_per_sector) < 0x100 || + if (le16_to_cpu(b->bpb.bytes_per_sector) < 0x100 || le16_to_cpu(b->bpb.bytes_per_sector) > 0x1000) goto not_ntfs; /* Check sectors per cluster value is valid. */ @@ -1002,7 +1006,7 @@ ++index; } /* Make sure the record is ok. */ - if (ntfs_is_baad_recordp(kmft)) { + if (ntfs_is_baad_recordp((le32*)kmft)) { ntfs_error(sb, "Incomplete multi sector transfer " "detected in mft record %i.", i); mm_unmap_out: @@ -1011,7 +1015,7 @@ ntfs_unmap_page(mft_page); return FALSE; } - if (ntfs_is_baad_recordp(kmirr)) { + if (ntfs_is_baad_recordp((le32*)kmirr)) { ntfs_error(sb, "Incomplete multi sector transfer " "detected in mft mirror record %i.", i); goto mm_unmap_out; @@ -1343,7 +1347,7 @@ struct super_block *sb = vol->sb; MFT_RECORD *m; VOLUME_INFORMATION *vi; - attr_search_context *ctx; + ntfs_attr_search_ctx *ctx; ntfs_debug("Entering."); #ifdef NTFS_RW @@ -1427,14 +1431,14 @@ iput(vol->vol_ino); goto volume_failed; } - if (!(ctx = get_attr_search_ctx(NTFS_I(vol->vol_ino), m))) { + if (!(ctx = ntfs_attr_get_search_ctx(NTFS_I(vol->vol_ino), m))) { ntfs_error(sb, "Failed to get attribute search context."); goto get_ctx_vol_failed; } - if (!lookup_attr(AT_VOLUME_INFORMATION, NULL, 0, 0, 0, NULL, 0, ctx) || - ctx->attr->non_resident || ctx->attr->flags) { + if (ntfs_attr_lookup(AT_VOLUME_INFORMATION, NULL, 0, 0, 0, NULL, 0, + ctx) || ctx->attr->non_resident || ctx->attr->flags) { err_put_vol: - put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); get_ctx_vol_failed: unmap_mft_record(NTFS_I(vol->vol_ino)); goto iput_volume_failed; @@ -1450,7 +1454,7 @@ vol->vol_flags = vi->flags; vol->major_ver = vi->major_ver; vol->minor_ver = vi->minor_ver; - put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); unmap_mft_record(NTFS_I(vol->vol_ino)); printk(KERN_INFO "NTFS volume version %i.%i.\n", vol->major_ver, vol->minor_ver); @@ -2013,7 +2017,7 @@ */ static unsigned long __get_nr_free_mft_records(ntfs_volume *vol) { - s64 nr_free = vol->nr_mft_records; + s64 nr_free; u32 *kaddr; struct address_space *mapping = vol->mftbmp_ino->i_mapping; filler_t *readpage = (filler_t*)mapping->a_ops->readpage; @@ -2022,13 +2026,16 @@ unsigned int max_size; ntfs_debug("Entering."); + /* Number of mft records in file system (at this point in time). */ + nr_free = vol->mft_ino->i_size >> vol->mft_record_size_bits; /* - * Convert the number of bits into bytes rounded up, then convert into - * multiples of PAGE_CACHE_SIZE, rounding up so that if we have one - * full and one partial page max_index = 2. - */ - max_index = (((vol->nr_mft_records + 7) >> 3) + PAGE_CACHE_SIZE - 1) >> - PAGE_CACHE_SHIFT; + * Convert the maximum number of set bits into bytes rounded up, then + * convert into multiples of PAGE_CACHE_SIZE, rounding up so that if we + * have one full and one partial page max_index = 2. + */ + max_index = ((((NTFS_I(vol->mft_ino)->initialized_size >> + vol->mft_record_size_bits) + 7) >> 3) + + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; /* Use multiples of 4 bytes. */ max_size = PAGE_CACHE_SIZE >> 2; ntfs_debug("Reading $MFT/$BITMAP, max_index = 0x%lx, max_size = " @@ -2123,9 +2130,9 @@ sfs->f_bavail = sfs->f_bfree = size; /* Serialize accesses to the inode bitmap. */ down_read(&vol->mftbmp_lock); - /* Total file nodes in file system (at this moment in time). */ - sfs->f_files = vol->mft_ino->i_size >> vol->mft_record_size_bits; - /* Free file nodes in fs (based on current total count). */ + /* Number of inodes in file system (at this point in time). */ + sfs->f_files = vol->mft_ino->i_size >> vol->mft_record_size_bits; + /* Free inodes in fs (based on current total count). */ sfs->f_ffree = __get_nr_free_mft_records(vol); up_read(&vol->mftbmp_lock); /* @@ -2157,7 +2164,7 @@ #ifdef NTFS_RW //.dirty_inode = NULL, /* VFS: Called from // __mark_inode_dirty(). */ - .write_inode = ntfs_write_inode_vfs, /* VFS: Write dirty inode to + .write_inode = ntfs_write_inode, /* VFS: Write dirty inode to disk. */ //.drop_inode = NULL, /* VFS: Called just after the // inode reference count has @@ -2288,6 +2295,8 @@ vol->fmask = 0177; vol->dmask = 0077; + unlock_kernel(); + /* Important to get the mount options dealt with now. */ if (!parse_options(vol, (char*)opt)) goto err_out_now; @@ -2424,6 +2433,7 @@ } up(&ntfs_lock); sb->s_export_op = &ntfs_export_ops; + lock_kernel(); return 0; } ntfs_error(sb, "Failed to allocate root directory."); @@ -2527,6 +2537,7 @@ } /* Errors at this stage are irrelevant. */ err_out_now: + lock_kernel(); sb->s_fs_info = NULL; kfree(vol); ntfs_debug("Failed, returning -EINVAL."); @@ -2563,7 +2574,7 @@ kmem_cache_t *ntfs_index_ctx_cache; /* A global default upcase table and a corresponding reference count. */ -wchar_t *default_upcase = NULL; +ntfschar *default_upcase = NULL; unsigned long ntfs_nr_upcase_users = 0; /* Driver wide semaphore. */ @@ -2620,7 +2631,7 @@ goto ictx_err_out; } ntfs_attr_ctx_cache = kmem_cache_create(ntfs_attr_ctx_cache_name, - sizeof(attr_search_context), 0 /* offset */, + sizeof(ntfs_attr_search_ctx), 0 /* offset */, SLAB_HWCACHE_ALIGN, NULL /* ctor */, NULL /* dtor */); if (!ntfs_attr_ctx_cache) { printk(KERN_CRIT "NTFS: Failed to create %s!\n", diff -Nru a/fs/ntfs/time.h b/fs/ntfs/time.h --- a/fs/ntfs/time.h 2004-09-26 10:25:56 -07:00 +++ b/fs/ntfs/time.h 2004-09-26 10:25:56 -07:00 @@ -45,7 +45,7 @@ * measured as the number of 100-nano-second intervals since 1st January 1601, * 00:00:00 UTC. */ -static inline s64 utc2ntfs(const struct timespec ts) +static inline sle64 utc2ntfs(const struct timespec ts) { /* * Convert the seconds to 100ns intervals, add the nano-seconds @@ -61,7 +61,7 @@ * Get the current time from the Linux kernel, convert it to its corresponding * NTFS time and return that in little endian format. */ -static inline s64 get_current_ntfs_time(void) +static inline sle64 get_current_ntfs_time(void) { return utc2ntfs(current_kernel_time()); } @@ -82,7 +82,7 @@ * measured as the number of 100 nano-second intervals since 1st January 1601, * 00:00:00 UTC. */ -static inline struct timespec ntfs2utc(const s64 time) +static inline struct timespec ntfs2utc(const sle64 time) { struct timespec ts; diff -Nru a/fs/ntfs/types.h b/fs/ntfs/types.h --- a/fs/ntfs/types.h 2004-09-26 10:25:57 -07:00 +++ b/fs/ntfs/types.h 2004-09-26 10:25:57 -07:00 @@ -23,8 +23,17 @@ #ifndef _LINUX_NTFS_TYPES_H #define _LINUX_NTFS_TYPES_H +#include + +typedef __le16 le16; +typedef __le32 le32; +typedef __le64 le64; +typedef __u16 __bitwise sle16; +typedef __u32 __bitwise sle32; +typedef __u64 __bitwise sle64; + /* 2-byte Unicode character type. */ -typedef u16 ntfschar; +typedef le16 ntfschar; #define UCHAR_T_SIZE_BITS 1 /* @@ -32,7 +41,9 @@ * and VCN, to allow for type checking and better code readability. */ typedef s64 VCN; +typedef sle64 leVCN; typedef s64 LCN; +typedef sle64 leLCN; /* * The NTFS journal $LogFile uses log sequence numbers which are signed 64-bit @@ -40,6 +51,7 @@ * code readability. */ typedef s64 LSN; +typedef sle64 leLSN; /** * runlist_element - in memory vcn to lcn mapping array element diff -Nru a/fs/ntfs/unistr.c b/fs/ntfs/unistr.c --- a/fs/ntfs/unistr.c 2004-09-26 10:25:57 -07:00 +++ b/fs/ntfs/unistr.c 2004-09-26 10:25:57 -07:00 @@ -96,7 +96,7 @@ const ntfschar *upcase, const u32 upcase_len) { u32 cnt, min_len; - ntfschar c1, c2; + u16 c1, c2; min_len = name1_len; if (name1_len > name2_len) @@ -144,7 +144,7 @@ */ int ntfs_ucsncmp(const ntfschar *s1, const ntfschar *s2, size_t n) { - ntfschar c1, c2; + u16 c1, c2; size_t i; for (i = 0; i < n; ++i) { @@ -181,8 +181,8 @@ int ntfs_ucsncasecmp(const ntfschar *s1, const ntfschar *s2, size_t n, const ntfschar *upcase, const u32 upcase_size) { - ntfschar c1, c2; size_t i; + u16 c1, c2; for (i = 0; i < n; ++i) { if ((c1 = le16_to_cpu(s1[i])) < upcase_size) @@ -203,7 +203,7 @@ const u32 upcase_len) { u32 i; - ntfschar u; + u16 u; for (i = 0; i < name_len; i++) if ((u = le16_to_cpu(name[i])) < upcase_len) @@ -276,7 +276,7 @@ } /* else (wc_len < 0) */ goto conversion_err; } - ucs[o] = cpu_to_le16('\0'); + ucs[o] = cpu_to_le16(0); *outs = ucs; return o; } /* else (!ucs) */ @@ -362,7 +362,7 @@ } /* wc < 0, real error. */ goto conversion_err; } - ns[o] = '\0'; + ns[o] = 0; *outs = ns; return o; } /* else (!ins) */ diff -Nru a/fs/ntfs/upcase.c b/fs/ntfs/upcase.c --- a/fs/ntfs/upcase.c 2004-09-26 10:25:55 -07:00 +++ b/fs/ntfs/upcase.c 2004-09-26 10:25:55 -07:00 @@ -3,7 +3,7 @@ * Part of the Linux-NTFS project. * * Copyright (c) 2001 Richard Russon - * Copyright (c) 2001-2003 Anton Altaparmakov + * Copyright (c) 2001-2004 Anton Altaparmakov * * Modified for mkntfs inclusion 9 June 2001 by Anton Altaparmakov. * Modified for kernel inclusion 10 September 2001 by Anton Altparmakov. @@ -87,4 +87,3 @@ uc[uc_word_table[r][0]] = cpu_to_le16(uc_word_table[r][1]); return uc; } - diff -Nru a/fs/ntfs/volume.h b/fs/ntfs/volume.h --- a/fs/ntfs/volume.h 2004-09-26 10:25:55 -07:00 +++ b/fs/ntfs/volume.h 2004-09-26 10:25:55 -07:00 @@ -95,9 +95,6 @@ struct inode *mftbmp_ino; /* Attribute inode for $MFT/$BITMAP. */ struct rw_semaphore mftbmp_lock; /* Lock for serializing accesses to the mft record bitmap ($MFT/$BITMAP). */ - unsigned long nr_mft_records; /* Number of mft records == number of - bits in mft bitmap. */ - #ifdef NTFS_RW struct inode *mftmirr_ino; /* The VFS inode of $MFTMirr. */ int mftmirr_size; /* Size of mft mirror in mft records. */ diff -Nru a/fs/partitions/msdos.c b/fs/partitions/msdos.c --- a/fs/partitions/msdos.c 2004-09-26 10:25:56 -07:00 +++ b/fs/partitions/msdos.c 2004-09-26 10:25:56 -07:00 @@ -246,6 +246,9 @@ put_partition(state, state->next++, bsd_start, bsd_size); } put_dev_sector(sect); + if (le16_to_cpu(l->d_npartitions) > max_partitions) + printk(" (ignored %d more)", + le16_to_cpu(l->d_npartitions) - max_partitions); printk(" >\n"); } #endif diff -Nru a/fs/qnx4/inode.c b/fs/qnx4/inode.c --- a/fs/qnx4/inode.c 2004-09-26 10:25:57 -07:00 +++ b/fs/qnx4/inode.c 2004-09-26 10:25:57 -07:00 @@ -78,7 +78,7 @@ unlock_kernel(); } -static void qnx4_write_inode(struct inode *inode, int unused) +static int qnx4_write_inode(struct inode *inode, int unused) { struct qnx4_inode_entry *raw_inode; int block, ino; @@ -87,12 +87,12 @@ QNX4DEBUG(("qnx4: write inode 1.\n")); if (inode->i_nlink == 0) { - return; + return 0; } if (!ino) { printk("qnx4: bad inode number on dev %s: %d is out of range\n", inode->i_sb->s_id, ino); - return; + return -EIO; } QNX4DEBUG(("qnx4: write inode 2.\n")); block = ino / QNX4_INODES_PER_BLOCK; @@ -101,7 +101,7 @@ printk("qnx4: major problem: unable to read inode from dev " "%s\n", inode->i_sb->s_id); unlock_kernel(); - return; + return -EIO; } raw_inode = ((struct qnx4_inode_entry *) bh->b_data) + (ino % QNX4_INODES_PER_BLOCK); @@ -117,6 +117,7 @@ mark_buffer_dirty(bh); brelse(bh); unlock_kernel(); + return 0; } #endif diff -Nru a/fs/reiserfs/file.c b/fs/reiserfs/file.c --- a/fs/reiserfs/file.c 2004-09-26 10:25:55 -07:00 +++ b/fs/reiserfs/file.c 2004-09-26 10:25:55 -07:00 @@ -1099,7 +1099,7 @@ { size_t already_written = 0; // Number of bytes already written to the file. loff_t pos; // Current position in the file. - size_t res; // return value of various functions that we call. + ssize_t res; // return value of various functions that we call. struct inode *inode = file->f_dentry->d_inode; // Inode of the file that we are writing to. /* To simplify coding at this time, we store locked pages in array for now */ @@ -1108,7 +1108,7 @@ th.t_trans_id = 0; if ( file->f_flags & O_DIRECT) { // Direct IO needs treatment - int result, after_file_end = 0; + ssize_t result, after_file_end = 0; if ( (*ppos + count >= inode->i_size) || (file->f_flags & O_APPEND) ) { /* If we are appending a file, we need to put this savelink in here. If we will crash while doing direct io, finish_unfinished will diff -Nru a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c --- a/fs/reiserfs/inode.c 2004-09-26 10:25:56 -07:00 +++ b/fs/reiserfs/inode.c 2004-09-26 10:25:56 -07:00 @@ -1504,7 +1504,7 @@ ** to properly mark inodes for datasync and such, but only actually ** does something when called for a synchronous update. */ -void reiserfs_write_inode (struct inode * inode, int do_sync) { +int reiserfs_write_inode (struct inode * inode, int do_sync) { struct reiserfs_transaction_handle th ; int jbegin_count = 1 ; @@ -1512,7 +1512,7 @@ reiserfs_warning (inode->i_sb, "clm-6005: writing inode %lu on readonly FS", inode->i_ino) ; - return ; + return -EROFS; } /* memory pressure can sometimes initiate write_inode calls with sync == 1, ** these cases are just when the system needs ram, not when the @@ -1526,6 +1526,7 @@ journal_end_sync(&th, inode->i_sb, jbegin_count) ; reiserfs_write_unlock(inode->i_sb); } + return 0; } /* FIXME: no need any more. right? */ diff -Nru a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c --- a/fs/reiserfs/xattr.c 2004-09-26 10:25:57 -07:00 +++ b/fs/reiserfs/xattr.c 2004-09-26 10:25:57 -07:00 @@ -589,8 +589,14 @@ break; } - inode->i_ctime = CURRENT_TIME; - mark_inode_dirty (inode); + /* We can't mark the inode dirty if it's not hashed. This is the case + * when we're inheriting the default ACL. If we dirty it, the inode + * gets marked dirty, but won't (ever) make it onto the dirty list until + * it's synced explicitly to clear I_DIRTY. This is bad. */ + if (!hlist_unhashed(&inode->i_hash)) { + inode->i_ctime = CURRENT_TIME; + mark_inode_dirty (inode); + } out_filp: up (&xinode->i_sem); diff -Nru a/fs/smbfs/proc.c b/fs/smbfs/proc.c --- a/fs/smbfs/proc.c 2004-09-26 10:25:55 -07:00 +++ b/fs/smbfs/proc.c 2004-09-26 10:25:55 -07:00 @@ -2076,6 +2076,8 @@ void smb_decode_unix_basic(struct smb_fattr *fattr, char *p) { + u64 size, disk_bytes; + /* FIXME: verify nls support. all is sent as utf8? */ fattr->f_unix = 1; @@ -2093,8 +2095,19 @@ /* 84 L permissions */ /* 92 L link count */ - fattr->f_size = LVAL(p, 0); - fattr->f_blocks = LVAL(p, 8); + size = LVAL(p, 0); + disk_bytes = LVAL(p, 8); + + /* + * Some samba versions round up on-disk byte usage + * to 1MB boundaries, making it useless. When seeing + * that, use the size instead. + */ + if (!(disk_bytes & 0xfffff)) + disk_bytes = size+511; + + fattr->f_size = size; + fattr->f_blocks = disk_bytes >> 9; fattr->f_ctime = smb_ntutc2unixutc(LVAL(p, 16)); fattr->f_atime = smb_ntutc2unixutc(LVAL(p, 24)); fattr->f_mtime = smb_ntutc2unixutc(LVAL(p, 32)); diff -Nru a/fs/super.c b/fs/super.c --- a/fs/super.c 2004-09-26 10:25:56 -07:00 +++ b/fs/super.c 2004-09-26 10:25:56 -07:00 @@ -116,6 +116,27 @@ return ret; } +/* + * Drop a superblock's refcount. + * Returns non-zero if the superblock is about to be destroyed and + * at least is already removed from super_blocks list, so if we are + * making a loop through super blocks then we need to restart. + * The caller must hold sb_lock. + */ +int __put_super_and_need_restart(struct super_block *sb) +{ + /* check for race with generic_shutdown_super() */ + if (list_empty(&sb->s_list)) { + /* super block is removed, need to restart... */ + __put_super(sb); + return 1; + } + /* can't be the last, since s_list is still in use */ + sb->s_count--; + BUG_ON(sb->s_count == 0); + return 0; +} + /** * put_super - drop a temporary reference to superblock * @s: superblock in question @@ -229,7 +250,8 @@ unlock_super(sb); } spin_lock(&sb_lock); - list_del(&sb->s_list); + /* should be initialized for __put_super_and_need_restart() */ + list_del_init(&sb->s_list); list_del(&sb->s_instances); spin_unlock(&sb_lock); up_write(&sb->s_umount); @@ -282,7 +304,7 @@ } s->s_type = type; strlcpy(s->s_id, type->name, sizeof(s->s_id)); - list_add(&s->s_list, super_blocks.prev); + list_add_tail(&s->s_list, &super_blocks); list_add(&s->s_instances, &type->fs_supers); spin_unlock(&sb_lock); get_filesystem(type); diff -Nru a/fs/sysv/balloc.c b/fs/sysv/balloc.c --- a/fs/sysv/balloc.c 2004-09-26 10:25:56 -07:00 +++ b/fs/sysv/balloc.c 2004-09-26 10:25:56 -07:00 @@ -27,23 +27,23 @@ sb->sv_sbd2->s_tfree = *sb->sv_free_blocks but we nevertheless keep it up to date. */ -static inline u32 *get_chunk(struct super_block *sb, struct buffer_head *bh) +static inline sysv_zone_t *get_chunk(struct super_block *sb, struct buffer_head *bh) { char *bh_data = bh->b_data; if (SYSV_SB(sb)->s_type == FSTYPE_SYSV4) - return (u32*)(bh_data+4); + return (sysv_zone_t*)(bh_data+4); else - return (u32*)(bh_data+2); + return (sysv_zone_t*)(bh_data+2); } /* NOTE NOTE NOTE: nr is a block number _as_ _stored_ _on_ _disk_ */ -void sysv_free_block(struct super_block * sb, u32 nr) +void sysv_free_block(struct super_block * sb, sysv_zone_t nr) { struct sysv_sb_info * sbi = SYSV_SB(sb); struct buffer_head * bh; - u32 *blocks = sbi->s_bcache; + sysv_zone_t *blocks = sbi->s_bcache; unsigned count; unsigned block = fs32_to_cpu(sbi, nr); @@ -81,7 +81,7 @@ return; } memset(bh->b_data, 0, sb->s_blocksize); - *(u16*)bh->b_data = cpu_to_fs16(sbi, count); + *(__fs16*)bh->b_data = cpu_to_fs16(sbi, count); memcpy(get_chunk(sb,bh), blocks, count * sizeof(sysv_zone_t)); mark_buffer_dirty(bh); set_buffer_uptodate(bh); @@ -96,11 +96,11 @@ unlock_super(sb); } -u32 sysv_new_block(struct super_block * sb) +sysv_zone_t sysv_new_block(struct super_block * sb) { struct sysv_sb_info *sbi = SYSV_SB(sb); unsigned int block; - u32 nr; + sysv_zone_t nr; struct buffer_head * bh; unsigned count; @@ -133,7 +133,7 @@ *sbi->s_bcache_count = cpu_to_fs16(sbi, 1); goto Enospc; } - count = fs16_to_cpu(sbi, *(u16*)bh->b_data); + count = fs16_to_cpu(sbi, *(__fs16*)bh->b_data); if (count > sbi->s_flc_size) { printk("sysv_new_block: free-list block with >flc_size entries\n"); brelse(bh); @@ -161,7 +161,7 @@ int sb_count; int count; struct buffer_head * bh = NULL; - u32 *blocks; + sysv_zone_t *blocks; unsigned block; int n; @@ -184,15 +184,16 @@ n = fs16_to_cpu(sbi, *sbi->s_bcache_count); blocks = sbi->s_bcache; while (1) { + sysv_zone_t zone; if (n > sbi->s_flc_size) goto E2big; - block = 0; - while (n && (block = blocks[--n]) != 0) + zone = 0; + while (n && (zone = blocks[--n]) != 0) count++; - if (block == 0) + if (zone == 0) break; - block = fs32_to_cpu(sbi, block); + block = fs32_to_cpu(sbi, zone); if (bh) brelse(bh); @@ -202,7 +203,7 @@ bh = sb_bread(sb, block); if (!bh) goto Eio; - n = fs16_to_cpu(sbi, *(u16*)bh->b_data); + n = fs16_to_cpu(sbi, *(__fs16*)bh->b_data); blocks = get_chunk(sb, bh); } if (bh) diff -Nru a/fs/sysv/ialloc.c b/fs/sysv/ialloc.c --- a/fs/sysv/ialloc.c 2004-09-26 10:25:55 -07:00 +++ b/fs/sysv/ialloc.c 2004-09-26 10:25:55 -07:00 @@ -137,7 +137,7 @@ struct super_block *sb = dir->i_sb; struct sysv_sb_info *sbi = SYSV_SB(sb); struct inode *inode; - u16 ino; + sysv_ino_t ino; unsigned count; inode = new_inode(sb); diff -Nru a/fs/sysv/inode.c b/fs/sysv/inode.c --- a/fs/sysv/inode.c 2004-09-26 10:25:55 -07:00 +++ b/fs/sysv/inode.c 2004-09-26 10:25:55 -07:00 @@ -260,13 +260,14 @@ return bh; } -void sysv_write_inode(struct inode * inode, int wait) +int sysv_write_inode(struct inode * inode, int wait) { struct buffer_head *bh; lock_kernel(); bh = sysv_update_inode(inode); brelse(bh); unlock_kernel(); + return 0; } int sysv_sync_inode(struct inode * inode) diff -Nru a/fs/sysv/itree.c b/fs/sysv/itree.c --- a/fs/sysv/itree.c 2004-09-26 10:25:55 -07:00 +++ b/fs/sysv/itree.c 2004-09-26 10:25:55 -07:00 @@ -50,20 +50,20 @@ return n; } -static inline int block_to_cpu(struct sysv_sb_info *sbi, u32 nr) +static inline int block_to_cpu(struct sysv_sb_info *sbi, sysv_zone_t nr) { return sbi->s_block_base + fs32_to_cpu(sbi, nr); } typedef struct { - u32 *p; - u32 key; + sysv_zone_t *p; + sysv_zone_t key; struct buffer_head *bh; } Indirect; static rwlock_t pointers_lock = RW_LOCK_UNLOCKED; -static inline void add_chain(Indirect *p, struct buffer_head *bh, u32 *v) +static inline void add_chain(Indirect *p, struct buffer_head *bh, sysv_zone_t *v) { p->key = *(p->p = v); p->bh = bh; @@ -76,9 +76,9 @@ return (from > to); } -static inline u32 *block_end(struct buffer_head *bh) +static inline sysv_zone_t *block_end(struct buffer_head *bh) { - return (u32*)((char*)bh->b_data + bh->b_size); + return (sysv_zone_t*)((char*)bh->b_data + bh->b_size); } /* @@ -105,7 +105,7 @@ goto failure; if (!verify_chain(chain, p)) goto changed; - add_chain(++p, bh, (u32*)bh->b_data + *++offsets); + add_chain(++p, bh, (sysv_zone_t*)bh->b_data + *++offsets); if (!p->key) goto no_block; } @@ -147,7 +147,7 @@ lock_buffer(bh); memset(bh->b_data, 0, blocksize); branch[n].bh = bh; - branch[n].p = (u32*) bh->b_data + offsets[n]; + branch[n].p = (sysv_zone_t*) bh->b_data + offsets[n]; *branch[n].p = branch[n].key; set_buffer_uptodate(bh); unlock_buffer(bh); @@ -265,7 +265,7 @@ goto reread; } -static inline int all_zeroes(u32 *p, u32 *q) +static inline int all_zeroes(sysv_zone_t *p, sysv_zone_t *q) { while (p < q) if (*p++) @@ -277,7 +277,7 @@ int depth, int offsets[], Indirect chain[], - u32 *top) + sysv_zone_t *top) { Indirect *partial, *p; int k, err; @@ -298,7 +298,7 @@ write_unlock(&pointers_lock); goto no_top; } - for (p=partial; p>chain && all_zeroes((u32*)p->bh->b_data,p->p); p--) + for (p=partial; p>chain && all_zeroes((sysv_zone_t*)p->bh->b_data,p->p); p--) ; /* * OK, we've found the last block that must survive. The rest of our @@ -322,10 +322,10 @@ return partial; } -static inline void free_data(struct inode *inode, u32 *p, u32 *q) +static inline void free_data(struct inode *inode, sysv_zone_t *p, sysv_zone_t *q) { for ( ; p < q ; p++) { - u32 nr = *p; + sysv_zone_t nr = *p; if (nr) { *p = 0; sysv_free_block(inode->i_sb, nr); @@ -334,7 +334,7 @@ } } -static void free_branches(struct inode *inode, u32 *p, u32 *q, int depth) +static void free_branches(struct inode *inode, sysv_zone_t *p, sysv_zone_t *q, int depth) { struct buffer_head * bh; struct super_block *sb = inode->i_sb; @@ -342,7 +342,7 @@ if (depth--) { for ( ; p < q ; p++) { int block; - u32 nr = *p; + sysv_zone_t nr = *p; if (!nr) continue; *p = 0; @@ -350,7 +350,7 @@ bh = sb_bread(sb, block); if (!bh) continue; - free_branches(inode, (u32*)bh->b_data, + free_branches(inode, (sysv_zone_t*)bh->b_data, block_end(bh), depth); bforget(bh); sysv_free_block(sb, nr); @@ -362,11 +362,11 @@ void sysv_truncate (struct inode * inode) { - u32 *i_data = SYSV_I(inode)->i_data; + sysv_zone_t *i_data = SYSV_I(inode)->i_data; int offsets[DEPTH]; Indirect chain[DEPTH]; Indirect *partial; - int nr = 0; + sysv_zone_t nr = 0; int n; long iblock; unsigned blocksize; diff -Nru a/fs/sysv/super.c b/fs/sysv/super.c --- a/fs/sysv/super.c 2004-09-26 10:25:58 -07:00 +++ b/fs/sysv/super.c 2004-09-26 10:25:58 -07:00 @@ -178,16 +178,22 @@ static int detect_xenix(struct sysv_sb_info *sbi, struct buffer_head *bh) { struct xenix_super_block *sbd = (struct xenix_super_block *)bh->b_data; - if (sbd->s_magic == cpu_to_le32(0x2b5544)) + if (*(__le32 *)&sbd->s_magic == cpu_to_le32(0x2b5544)) sbi->s_bytesex = BYTESEX_LE; - else if (sbd->s_magic == cpu_to_be32(0x2b5544)) + else if (*(__be32 *)&sbd->s_magic == cpu_to_be32(0x2b5544)) sbi->s_bytesex = BYTESEX_BE; else return 0; - if (sbd->s_type > 2 || sbd->s_type < 1) + switch (fs32_to_cpu(sbi, sbd->s_type)) { + case 1: + sbi->s_type = FSTYPE_XENIX; + return 1; + case 2: + sbi->s_type = FSTYPE_XENIX; + return 2; + default: return 0; - sbi->s_type = FSTYPE_XENIX; - return sbd->s_type; + } } static int detect_sysv(struct sysv_sb_info *sbi, struct buffer_head *bh) @@ -195,14 +201,17 @@ struct super_block *sb = sbi->s_sb; /* All relevant fields are at the same offsets in R2 and R4 */ struct sysv4_super_block * sbd; + u32 type; sbd = (struct sysv4_super_block *) (bh->b_data + BLOCK_SIZE/2); - if (sbd->s_magic == cpu_to_le32(0xfd187e20)) + if (*(__le32 *)&sbd->s_magic == cpu_to_le32(0xfd187e20)) sbi->s_bytesex = BYTESEX_LE; - else if (sbd->s_magic == cpu_to_be32(0xfd187e20)) + else if (*(__be32 *)&sbd->s_magic == cpu_to_be32(0xfd187e20)) sbi->s_bytesex = BYTESEX_BE; else return 0; + + type = fs32_to_cpu(sbi, sbd->s_type); if (fs16_to_cpu(sbi, sbd->s_nfree) == 0xffff) { sbi->s_type = FSTYPE_AFS; @@ -212,18 +221,17 @@ "forcing read-only mode.\n", sb->s_id); } - return sbd->s_type; + return type; } if (fs32_to_cpu(sbi, sbd->s_time) < JAN_1_1980) { /* this is likely to happen on SystemV2 FS */ - if (sbd->s_type > 3 || sbd->s_type < 1) + if (type > 3 || type < 1) return 0; sbi->s_type = FSTYPE_SYSV2; - return sbd->s_type; + return type; } - if ((sbd->s_type > 3 || sbd->s_type < 1) && - (sbd->s_type > 0x30 || sbd->s_type < 0x10)) + if ((type > 3 || type < 1) && (type > 0x30 || type < 0x10)) return 0; /* On Interactive Unix (ISC) Version 4.0/3.x s_type field = 0x10, @@ -231,14 +239,14 @@ filename limit is gone. Due to lack of information about this feature read-only mode seems to be a reasonable approach... -KGB */ - if (sbd->s_type >= 0x10) { + if (type >= 0x10) { printk("SysV FS: can't handle long file names on %s, " "forcing read-only mode.\n", sb->s_id); sbi->s_forced_ro = 1; } sbi->s_type = FSTYPE_SYSV4; - return sbd->s_type >= 0x10 ? (sbd->s_type >> 4) : sbd->s_type; + return type >= 0x10 ? type >> 4 : type; } static int detect_coherent(struct sysv_sb_info *sbi, struct buffer_head *bh) diff -Nru a/fs/sysv/sysv.h b/fs/sysv/sysv.h --- a/fs/sysv/sysv.h 2004-09-26 10:25:56 -07:00 +++ b/fs/sysv/sysv.h 2004-09-26 10:25:56 -07:00 @@ -2,6 +2,10 @@ #define _SYSV_H #include + +typedef __u16 __bitwise __fs16; +typedef __u32 __bitwise __fs32; + #include /* @@ -38,14 +42,14 @@ different superblock layout. */ char * s_sbd1; /* entire superblock data, for part 1 */ char * s_sbd2; /* entire superblock data, for part 2 */ - u16 *s_sb_fic_count; /* pointer to s_sbd->s_ninode */ - u16 *s_sb_fic_inodes; /* pointer to s_sbd->s_inode */ - u16 *s_sb_total_free_inodes; /* pointer to s_sbd->s_tinode */ - u16 *s_bcache_count; /* pointer to s_sbd->s_nfree */ - u32 *s_bcache; /* pointer to s_sbd->s_free */ - u32 *s_free_blocks; /* pointer to s_sbd->s_tfree */ - u32 *s_sb_time; /* pointer to s_sbd->s_time */ - u32 *s_sb_state; /* pointer to s_sbd->s_state, only FSTYPE_SYSV */ + __fs16 *s_sb_fic_count; /* pointer to s_sbd->s_ninode */ + sysv_ino_t *s_sb_fic_inodes; /* pointer to s_sbd->s_inode */ + __fs16 *s_sb_total_free_inodes; /* pointer to s_sbd->s_tinode */ + __fs16 *s_bcache_count; /* pointer to s_sbd->s_nfree */ + sysv_zone_t *s_bcache; /* pointer to s_sbd->s_free */ + __fs32 *s_free_blocks; /* pointer to s_sbd->s_tfree */ + __fs32 *s_sb_time; /* pointer to s_sbd->s_time */ + __fs32 *s_sb_state; /* pointer to s_sbd->s_state, only FSTYPE_SYSV */ /* We keep those superblock entities that don't change here; this saves us an indirection and perhaps a conversion. */ u32 s_firstinodezone; /* index of first inode zone */ @@ -61,7 +65,7 @@ * SystemV/V7/Coherent FS inode data in memory */ struct sysv_inode_info { - u32 i_data[13]; + __fs32 i_data[13]; u32 i_dir_start_lookup; struct inode vfs_inode; }; @@ -126,15 +130,15 @@ extern unsigned long sysv_count_free_inodes(struct super_block *); /* balloc.c */ -extern u32 sysv_new_block(struct super_block *); -extern void sysv_free_block(struct super_block *, u32); +extern sysv_zone_t sysv_new_block(struct super_block *); +extern void sysv_free_block(struct super_block *, sysv_zone_t); extern unsigned long sysv_count_free_blocks(struct super_block *); /* itree.c */ extern void sysv_truncate(struct inode *); /* inode.c */ -extern void sysv_write_inode(struct inode *, int); +extern int sysv_write_inode(struct inode *, int); extern int sysv_sync_inode(struct inode *); extern int sysv_sync_file(struct file *, struct dentry *, int); extern void sysv_set_inode(struct inode *, dev_t); @@ -181,58 +185,60 @@ #endif } -static inline u32 fs32_to_cpu(struct sysv_sb_info *sbi, u32 n) +static inline __u32 fs32_to_cpu(struct sysv_sb_info *sbi, __fs32 n) { if (sbi->s_bytesex == BYTESEX_PDP) - return PDP_swab(n); + return PDP_swab((__force __u32)n); else if (sbi->s_bytesex == BYTESEX_LE) - return le32_to_cpu(n); + return le32_to_cpu((__force __le32)n); else - return be32_to_cpu(n); + return be32_to_cpu((__force __be32)n); } -static inline u32 cpu_to_fs32(struct sysv_sb_info *sbi, u32 n) +static inline __fs32 cpu_to_fs32(struct sysv_sb_info *sbi, __u32 n) { if (sbi->s_bytesex == BYTESEX_PDP) - return PDP_swab(n); + return (__force __fs32)PDP_swab(n); else if (sbi->s_bytesex == BYTESEX_LE) - return cpu_to_le32(n); + return (__force __fs32)cpu_to_le32(n); else - return cpu_to_be32(n); + return (__force __fs32)cpu_to_be32(n); } -static inline u32 fs32_add(struct sysv_sb_info *sbi, u32 *n, int d) +static inline __fs32 fs32_add(struct sysv_sb_info *sbi, __fs32 *n, int d) { if (sbi->s_bytesex == BYTESEX_PDP) - return *n = PDP_swab(PDP_swab(*n)+d); + *(__u32*)n = PDP_swab(PDP_swab(*(__u32*)n)+d); else if (sbi->s_bytesex == BYTESEX_LE) - return *n = cpu_to_le32(le32_to_cpu(*n)+d); + *(__le32*)n = cpu_to_le32(le32_to_cpu(*(__le32*)n)+d); else - return *n = cpu_to_be32(be32_to_cpu(*n)+d); + *(__be32*)n = cpu_to_be32(be32_to_cpu(*(__be32*)n)+d); + return *n; } -static inline u16 fs16_to_cpu(struct sysv_sb_info *sbi, u16 n) +static inline __u16 fs16_to_cpu(struct sysv_sb_info *sbi, __fs16 n) { if (sbi->s_bytesex != BYTESEX_BE) - return le16_to_cpu(n); + return le16_to_cpu((__force __le16)n); else - return be16_to_cpu(n); + return be16_to_cpu((__force __be16)n); } -static inline u16 cpu_to_fs16(struct sysv_sb_info *sbi, u16 n) +static inline __fs16 cpu_to_fs16(struct sysv_sb_info *sbi, __u16 n) { if (sbi->s_bytesex != BYTESEX_BE) - return cpu_to_le16(n); + return (__force __fs16)cpu_to_le16(n); else - return cpu_to_be16(n); + return (__force __fs16)cpu_to_be16(n); } -static inline u16 fs16_add(struct sysv_sb_info *sbi, u16 *n, int d) +static inline __fs16 fs16_add(struct sysv_sb_info *sbi, __fs16 *n, int d) { if (sbi->s_bytesex != BYTESEX_BE) - return *n = cpu_to_le16(le16_to_cpu(*n)+d); + *(__le16*)n = cpu_to_le16(le16_to_cpu(*(__le16 *)n)+d); else - return *n = cpu_to_be16(be16_to_cpu(*n)+d); + *(__be16*)n = cpu_to_be16(be16_to_cpu(*(__be16 *)n)+d); + return *n; } #endif /* _SYSV_H */ diff -Nru a/fs/udf/inode.c b/fs/udf/inode.c --- a/fs/udf/inode.c 2004-09-26 10:25:57 -07:00 +++ b/fs/udf/inode.c 2004-09-26 10:25:57 -07:00 @@ -1316,11 +1316,13 @@ * Written, tested, and released. */ -void udf_write_inode(struct inode * inode, int sync) +int udf_write_inode(struct inode * inode, int sync) { + int ret; lock_kernel(); - udf_update_inode(inode, sync); + ret = udf_update_inode(inode, sync); unlock_kernel(); + return ret; } int udf_sync_inode(struct inode * inode) diff -Nru a/fs/udf/udfdecl.h b/fs/udf/udfdecl.h --- a/fs/udf/udfdecl.h 2004-09-26 10:25:56 -07:00 +++ b/fs/udf/udfdecl.h 2004-09-26 10:25:56 -07:00 @@ -99,7 +99,7 @@ extern void udf_put_inode(struct inode *); extern void udf_delete_inode(struct inode *); extern void udf_clear_inode(struct inode *); -extern void udf_write_inode(struct inode *, int); +extern int udf_write_inode(struct inode *, int); extern long udf_block_map(struct inode *, long); extern int8_t inode_bmap(struct inode *, int, kernel_lb_addr *, uint32_t *, kernel_lb_addr *, uint32_t *, uint32_t *, struct buffer_head **); extern int8_t udf_add_aext(struct inode *, kernel_lb_addr *, int *, kernel_lb_addr, uint32_t, struct buffer_head **, int); diff -Nru a/fs/ufs/inode.c b/fs/ufs/inode.c --- a/fs/ufs/inode.c 2004-09-26 10:25:55 -07:00 +++ b/fs/ufs/inode.c 2004-09-26 10:25:55 -07:00 @@ -788,11 +788,13 @@ return 0; } -void ufs_write_inode (struct inode * inode, int wait) +int ufs_write_inode (struct inode * inode, int wait) { + int ret; lock_kernel(); - ufs_update_inode (inode, wait); + ret = ufs_update_inode (inode, wait); unlock_kernel(); + return ret; } int ufs_sync_inode (struct inode *inode) diff -Nru a/fs/umsdos/inode.c b/fs/umsdos/inode.c --- a/fs/umsdos/inode.c 2004-09-26 10:25:55 -07:00 +++ b/fs/umsdos/inode.c 2004-09-26 10:25:55 -07:00 @@ -312,11 +312,12 @@ /* * Update the disk with the inode content */ -void UMSDOS_write_inode (struct inode *inode, int wait) +int UMSDOS_write_inode (struct inode *inode, int wait) { struct iattr newattrs; + int ret; - fat_write_inode (inode, wait); + ret = fat_write_inode (inode, wait); newattrs.ia_mtime = inode->i_mtime; newattrs.ia_atime = inode->i_atime; newattrs.ia_ctime = inode->i_ctime; @@ -330,6 +331,7 @@ * UMSDOS_notify_change (inode, &newattrs); * inode->i_state &= ~I_DIRTY; / * FIXME: this doesn't work. We need to remove ourselves from list on dirty inodes. /mn/ */ + return ret; } diff -Nru a/fs/vfat/namei.c b/fs/vfat/namei.c --- a/fs/vfat/namei.c 2004-09-26 10:25:56 -07:00 +++ b/fs/vfat/namei.c 2004-09-26 10:25:56 -07:00 @@ -677,7 +677,8 @@ de->attr = is_dir ? ATTR_DIR : ATTR_ARCH; de->lcase = lcase; de->adate = de->cdate = de->date = 0; - de->ctime_ms = de->ctime = de->time = 0; + de->ctime = de->time = 0; + de->ctime_ms = 0; de->start = 0; de->starthi = 0; de->size = 0; @@ -1046,8 +1047,8 @@ if (is_dir) { int start = MSDOS_I(new_dir)->i_logstart; - dotdot_de->start = CT_LE_W(start); - dotdot_de->starthi = CT_LE_W(start>>16); + dotdot_de->start = cpu_to_le16(start); + dotdot_de->starthi = cpu_to_le16(start>>16); mark_buffer_dirty(dotdot_bh); old_dir->i_nlink--; if (new_inode) { diff -Nru a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c --- a/fs/xfs/linux-2.6/xfs_aops.c 2004-09-26 10:25:57 -07:00 +++ b/fs/xfs/linux-2.6/xfs_aops.c 2004-09-26 10:25:57 -07:00 @@ -1024,7 +1024,7 @@ if (error) return -error; - return blockdev_direct_IO_no_locking(rw, iocb, inode, + return blockdev_direct_IO_own_locking(rw, iocb, inode, iomap.iomap_target->pbr_bdev, iov, offset, nr_segs, linvfs_get_blocks_direct, diff -Nru a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c --- a/fs/xfs/linux-2.6/xfs_super.c 2004-09-26 10:25:57 -07:00 +++ b/fs/xfs/linux-2.6/xfs_super.c 2004-09-26 10:25:57 -07:00 @@ -356,7 +356,7 @@ * at the point when it is unpinned after a log write, * since this is when the inode itself becomes flushable. */ -STATIC void +STATIC int linvfs_write_inode( struct inode *inode, int sync) @@ -364,12 +364,14 @@ vnode_t *vp = LINVFS_GET_VP(inode); int error, flags = FLUSH_INODE; + error = 0; if (vp) { vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address); if (sync) flags |= FLUSH_SYNC; VOP_IFLUSH(vp, flags, error); } + return error; } STATIC void diff -Nru a/include/asm-alpha/bitops.h b/include/asm-alpha/bitops.h --- a/include/asm-alpha/bitops.h 2004-09-26 10:25:56 -07:00 +++ b/include/asm-alpha/bitops.h 2004-09-26 10:25:56 -07:00 @@ -2,7 +2,6 @@ #define _ALPHA_BITOPS_H #include -#include #include /* @@ -324,7 +323,7 @@ #endif /* Compute powers of two for the given integer. */ -static inline int floor_log2(unsigned long word) +static inline long floor_log2(unsigned long word) { #if defined(__alpha_cix__) && defined(__alpha_fix__) return 63 - __kernel_ctlz(word); @@ -336,7 +335,7 @@ #endif } -static inline int ceil_log2(unsigned int word) +static inline long ceil_log2(unsigned long word) { long bit = floor_log2(word); return bit + (word > (1UL << bit)); diff -Nru a/include/asm-alpha/compiler.h b/include/asm-alpha/compiler.h --- a/include/asm-alpha/compiler.h 2004-09-26 10:25:56 -07:00 +++ b/include/asm-alpha/compiler.h 2004-09-26 10:25:56 -07:00 @@ -17,9 +17,9 @@ # define __kernel_extbl(val, shift) __builtin_alpha_extbl(val, shift) # define __kernel_extwl(val, shift) __builtin_alpha_extwl(val, shift) # define __kernel_cmpbge(a, b) __builtin_alpha_cmpbge(a, b) -# define __kernel_cttz(x) __builtin_ctz(x) -# define __kernel_ctlz(x) __builtin_clz(x) -# define __kernel_ctpop(x) __builtin_popcount(x) +# define __kernel_cttz(x) __builtin_ctzl(x) +# define __kernel_ctlz(x) __builtin_clzl(x) +# define __kernel_ctpop(x) __builtin_popcountl(x) #else # define __kernel_insbl(val, shift) \ ({ unsigned long __kir; \ @@ -89,5 +89,15 @@ #define __kernel_stw(val,mem) \ __asm__("stw %1,%0" : "=m"(mem) : "r"(val)) #endif + +/* Some idiots over in thought inline should imply + always_inline. This breaks stuff. We'll include this file whenever + we run into such problems. */ + +#include +#undef inline +#undef __inline__ +#undef __inline + #endif /* __ALPHA_COMPILER_H */ diff -Nru a/include/asm-alpha/core_apecs.h b/include/asm-alpha/core_apecs.h --- a/include/asm-alpha/core_apecs.h 2004-09-26 10:25:57 -07:00 +++ b/include/asm-alpha/core_apecs.h 2004-09-26 10:25:57 -07:00 @@ -370,178 +370,142 @@ * data to/from the right byte-lanes. */ -#define vip volatile int * -#define vuip volatile unsigned int * -#define vulp volatile unsigned long * +#define vip volatile int __force * +#define vuip volatile unsigned int __force * +#define vulp volatile unsigned long __force * + +#define APECS_SET_HAE \ + do { \ + if (addr >= (1UL << 24)) { \ + unsigned long msb = addr & 0xf8000000; \ + addr -= msb; \ + set_hae(msb); \ + } \ + } while (0) + +__EXTERN_INLINE unsigned int apecs_ioread8(void __iomem *xaddr) +{ + unsigned long addr = (unsigned long) xaddr; + unsigned long result, base_and_type; + + if (addr >= APECS_DENSE_MEM) { + addr -= APECS_DENSE_MEM; + APECS_SET_HAE; + base_and_type = APECS_SPARSE_MEM + 0x00; + } else { + addr -= APECS_IO; + base_and_type = APECS_IO + 0x00; + } -__EXTERN_INLINE u8 apecs_inb(unsigned long addr) -{ - long result = *(vip) ((addr << 5) + APECS_IO + 0x00); + result = *(vip) ((addr << 5) + base_and_type); return __kernel_extbl(result, addr & 3); } -__EXTERN_INLINE void apecs_outb(u8 b, unsigned long addr) -{ - unsigned long w; - - w = __kernel_insbl(b, addr & 3); - *(vuip) ((addr << 5) + APECS_IO + 0x00) = w; - mb(); -} - -__EXTERN_INLINE u16 apecs_inw(unsigned long addr) -{ - long result = *(vip) ((addr << 5) + APECS_IO + 0x08); - return __kernel_extwl(result, addr & 3); -} - -__EXTERN_INLINE void apecs_outw(u16 b, unsigned long addr) +__EXTERN_INLINE void apecs_iowrite8(u8 b, void __iomem *xaddr) { - unsigned long w; + unsigned long addr = (unsigned long) xaddr; + unsigned long w, base_and_type; - w = __kernel_inswl(b, addr & 3); - *(vuip) ((addr << 5) + APECS_IO + 0x08) = w; - mb(); -} - -__EXTERN_INLINE u32 apecs_inl(unsigned long addr) -{ - return *(vuip) ((addr << 5) + APECS_IO + 0x18); -} + if (addr >= APECS_DENSE_MEM) { + addr -= APECS_DENSE_MEM; + APECS_SET_HAE; + base_and_type = APECS_SPARSE_MEM + 0x00; + } else { + addr -= APECS_IO; + base_and_type = APECS_IO + 0x00; + } -__EXTERN_INLINE void apecs_outl(u32 b, unsigned long addr) -{ - *(vuip) ((addr << 5) + APECS_IO + 0x18) = b; - mb(); + w = __kernel_insbl(b, addr & 3); + *(vuip) ((addr << 5) + base_and_type) = w; } - -/* - * Memory functions. 64-bit and 32-bit accesses are done through - * dense memory space, everything else through sparse space. - */ - -__EXTERN_INLINE u8 apecs_readb(unsigned long addr) +__EXTERN_INLINE unsigned int apecs_ioread16(void __iomem *xaddr) { - unsigned long result, msb; + unsigned long addr = (unsigned long) xaddr; + unsigned long result, base_and_type; - addr -= APECS_DENSE_MEM; - if (addr >= (1UL << 24)) { - msb = addr & 0xf8000000; - addr -= msb; - set_hae(msb); + if (addr >= APECS_DENSE_MEM) { + addr -= APECS_DENSE_MEM; + APECS_SET_HAE; + base_and_type = APECS_SPARSE_MEM + 0x08; + } else { + addr -= APECS_IO; + base_and_type = APECS_IO + 0x08; } - result = *(vip) ((addr << 5) + APECS_SPARSE_MEM + 0x00); - return __kernel_extbl(result, addr & 3); -} - -__EXTERN_INLINE u16 apecs_readw(unsigned long addr) -{ - unsigned long result, msb; - addr -= APECS_DENSE_MEM; - if (addr >= (1UL << 24)) { - msb = addr & 0xf8000000; - addr -= msb; - set_hae(msb); - } - result = *(vip) ((addr << 5) + APECS_SPARSE_MEM + 0x08); + result = *(vip) ((addr << 5) + base_and_type); return __kernel_extwl(result, addr & 3); } -__EXTERN_INLINE u32 apecs_readl(unsigned long addr) +__EXTERN_INLINE void apecs_iowrite16(u16 b, void __iomem *xaddr) { - return (*(vuip)addr) & 0xffffffff; -} + unsigned long addr = (unsigned long) xaddr; + unsigned long w, base_and_type; -__EXTERN_INLINE u64 apecs_readq(unsigned long addr) -{ - return *(vulp)addr; -} - -__EXTERN_INLINE void apecs_writeb(u8 b, unsigned long addr) -{ - unsigned long msb; - - addr -= APECS_DENSE_MEM; - if (addr >= (1UL << 24)) { - msb = addr & 0xf8000000; - addr -= msb; - set_hae(msb); + if (addr >= APECS_DENSE_MEM) { + addr -= APECS_DENSE_MEM; + APECS_SET_HAE; + base_and_type = APECS_SPARSE_MEM + 0x08; + } else { + addr -= APECS_IO; + base_and_type = APECS_IO + 0x08; } - *(vuip) ((addr << 5) + APECS_SPARSE_MEM + 0x00) = b * 0x01010101; + + w = __kernel_inswl(b, addr & 3); + *(vuip) ((addr << 5) + base_and_type) = w; } -__EXTERN_INLINE void apecs_writew(u16 b, unsigned long addr) +__EXTERN_INLINE unsigned int apecs_ioread32(void __iomem *xaddr) { - unsigned long msb; - - addr -= APECS_DENSE_MEM; - if (addr >= (1UL << 24)) { - msb = addr & 0xf8000000; - addr -= msb; - set_hae(msb); - } - *(vuip) ((addr << 5) + APECS_SPARSE_MEM + 0x08) = b * 0x00010001; + unsigned long addr = (unsigned long) xaddr; + if (addr < APECS_DENSE_MEM) + addr = ((addr - APECS_IO) << 5) + APECS_IO + 0x18; + return *(vuip)addr; } -__EXTERN_INLINE void apecs_writel(u32 b, unsigned long addr) +__EXTERN_INLINE void apecs_iowrite32(u32 b, void __iomem *xaddr) { + unsigned long addr = (unsigned long) xaddr; + if (addr < APECS_DENSE_MEM) + addr = ((addr - APECS_IO) << 5) + APECS_IO + 0x18; *(vuip)addr = b; } -__EXTERN_INLINE void apecs_writeq(u64 b, unsigned long addr) +__EXTERN_INLINE void __iomem *apecs_ioportmap(unsigned long addr) { - *(vulp)addr = b; + return (void __iomem *)(addr + APECS_IO); } -__EXTERN_INLINE unsigned long apecs_ioremap(unsigned long addr, - unsigned long size - __attribute__((unused))) +__EXTERN_INLINE void __iomem *apecs_ioremap(unsigned long addr, + unsigned long size) { - return addr + APECS_DENSE_MEM; + return (void __iomem *)(addr + APECS_DENSE_MEM); } -__EXTERN_INLINE void apecs_iounmap(unsigned long addr) +__EXTERN_INLINE int apecs_is_ioaddr(unsigned long addr) { - return; + return addr >= IDENT_ADDR + 0x180000000UL; } -__EXTERN_INLINE int apecs_is_ioaddr(unsigned long addr) +__EXTERN_INLINE int apecs_is_mmio(const volatile void __iomem *addr) { - return addr >= IDENT_ADDR + 0x180000000UL; + return (unsigned long)addr >= APECS_DENSE_MEM; } +#undef APECS_SET_HAE + #undef vip #undef vuip #undef vulp -#ifdef __WANT_IO_DEF - -#define __inb(p) apecs_inb((unsigned long)(p)) -#define __inw(p) apecs_inw((unsigned long)(p)) -#define __inl(p) apecs_inl((unsigned long)(p)) -#define __outb(x,p) apecs_outb((x),(unsigned long)(p)) -#define __outw(x,p) apecs_outw((x),(unsigned long)(p)) -#define __outl(x,p) apecs_outl((x),(unsigned long)(p)) -#define __readb(a) apecs_readb((unsigned long)(a)) -#define __readw(a) apecs_readw((unsigned long)(a)) -#define __readl(a) apecs_readl((unsigned long)(a)) -#define __readq(a) apecs_readq((unsigned long)(a)) -#define __writeb(x,a) apecs_writeb((x),(unsigned long)(a)) -#define __writew(x,a) apecs_writew((x),(unsigned long)(a)) -#define __writel(x,a) apecs_writel((x),(unsigned long)(a)) -#define __writeq(x,a) apecs_writeq((x),(unsigned long)(a)) -#define __ioremap(a,s) apecs_ioremap((unsigned long)(a),(s)) -#define __iounmap(a) apecs_iounmap((unsigned long)(a)) -#define __is_ioaddr(a) apecs_is_ioaddr((unsigned long)(a)) - -#define __raw_readl(a) __readl(a) -#define __raw_readq(a) __readq(a) -#define __raw_writel(v,a) __writel((v),(a)) -#define __raw_writeq(v,a) __writeq((v),(a)) - -#endif /* __WANT_IO_DEF */ +#undef __IO_PREFIX +#define __IO_PREFIX apecs +#define apecs_trivial_io_bw 0 +#define apecs_trivial_io_lq 0 +#define apecs_trivial_rw_bw 2 +#define apecs_trivial_rw_lq 1 +#define apecs_trivial_iounmap 1 +#include #ifdef __IO_EXTERN_INLINE #undef __EXTERN_INLINE diff -Nru a/include/asm-alpha/core_cia.h b/include/asm-alpha/core_cia.h --- a/include/asm-alpha/core_cia.h 2004-09-26 10:25:56 -07:00 +++ b/include/asm-alpha/core_cia.h 2004-09-26 10:25:56 -07:00 @@ -306,90 +306,6 @@ * get at PCI memory and I/O. */ -#define vucp volatile unsigned char * -#define vusp volatile unsigned short * -#define vip volatile int * -#define vuip volatile unsigned int * -#define vulp volatile unsigned long * - -__EXTERN_INLINE u8 cia_inb(unsigned long addr) -{ - long result; - result = *(vip) ((addr << 5) + CIA_IO + 0x00); - return __kernel_extbl(result, addr & 3); -} - -__EXTERN_INLINE void cia_outb(u8 b, unsigned long addr) -{ - unsigned long w = __kernel_insbl(b, addr & 3); - *(vuip) ((addr << 5) + CIA_IO + 0x00) = w; - mb(); -} - -__EXTERN_INLINE u16 cia_inw(unsigned long addr) -{ - long result; - result = *(vip) ((addr << 5) + CIA_IO + 0x08); - return __kernel_extwl(result, addr & 3); -} - -__EXTERN_INLINE void cia_outw(u16 b, unsigned long addr) -{ - unsigned long w = __kernel_inswl(b, addr & 3); - *(vuip) ((addr << 5) + CIA_IO + 0x08) = w; - mb(); -} - -__EXTERN_INLINE u32 cia_inl(unsigned long addr) -{ - return *(vuip) ((addr << 5) + CIA_IO + 0x18); -} - -__EXTERN_INLINE void cia_outl(u32 b, unsigned long addr) -{ - *(vuip) ((addr << 5) + CIA_IO + 0x18) = b; - mb(); -} - -__EXTERN_INLINE u8 cia_bwx_inb(unsigned long addr) -{ - /* ??? I wish I could get rid of this. But there's no ioremap - equivalent for I/O space. PCI I/O can be forced into the - CIA BWX I/O region, but that doesn't take care of legacy - ISA crap. */ - - return __kernel_ldbu(*(vucp)(addr+CIA_BW_IO)); -} - -__EXTERN_INLINE void cia_bwx_outb(u8 b, unsigned long addr) -{ - __kernel_stb(b, *(vucp)(addr+CIA_BW_IO)); - mb(); -} - -__EXTERN_INLINE u16 cia_bwx_inw(unsigned long addr) -{ - return __kernel_ldwu(*(vusp)(addr+CIA_BW_IO)); -} - -__EXTERN_INLINE void cia_bwx_outw(u16 b, unsigned long addr) -{ - __kernel_stw(b, *(vusp)(addr+CIA_BW_IO)); - mb(); -} - -__EXTERN_INLINE u32 cia_bwx_inl(unsigned long addr) -{ - return *(vuip)(addr+CIA_BW_IO); -} - -__EXTERN_INLINE void cia_bwx_outl(u32 b, unsigned long addr) -{ - *(vuip)(addr+CIA_BW_IO) = b; - mb(); -} - - /* * Memory functions. 64-bit and 32-bit accesses are done through * dense memory space, everything else through sparse space. @@ -422,195 +338,158 @@ * */ -__EXTERN_INLINE u8 cia_readb(unsigned long addr) +#define vip volatile int __force * +#define vuip volatile unsigned int __force * +#define vulp volatile unsigned long __force * + +__EXTERN_INLINE unsigned int cia_ioread8(void __iomem *xaddr) { - unsigned long result; + unsigned long addr = (unsigned long) xaddr; + unsigned long result, base_and_type; + /* We can use CIA_MEM_R1_MASK for io ports too, since it is large + enough to cover all io ports, and smaller than CIA_IO. */ addr &= CIA_MEM_R1_MASK; - result = *(vip) ((addr << 5) + CIA_SPARSE_MEM + 0x00); + if (addr >= CIA_DENSE_MEM) + base_and_type = CIA_SPARSE_MEM + 0x00; + else + base_and_type = CIA_IO + 0x00; + + result = *(vip) ((addr << 5) + base_and_type); return __kernel_extbl(result, addr & 3); } -__EXTERN_INLINE u16 cia_readw(unsigned long addr) +__EXTERN_INLINE void cia_iowrite8(u8 b, void __iomem *xaddr) { - unsigned long result; + unsigned long addr = (unsigned long) xaddr; + unsigned long w, base_and_type; addr &= CIA_MEM_R1_MASK; - result = *(vip) ((addr << 5) + CIA_SPARSE_MEM + 0x08); - return __kernel_extwl(result, addr & 3); -} + if (addr >= CIA_DENSE_MEM) + base_and_type = CIA_SPARSE_MEM + 0x00; + else + base_and_type = CIA_IO + 0x00; -__EXTERN_INLINE void cia_writeb(u8 b, unsigned long addr) -{ - unsigned long w; - - addr &= CIA_MEM_R1_MASK; w = __kernel_insbl(b, addr & 3); - *(vuip) ((addr << 5) + CIA_SPARSE_MEM + 0x00) = w; + *(vuip) ((addr << 5) + base_and_type) = w; } -__EXTERN_INLINE void cia_writew(u16 b, unsigned long addr) +__EXTERN_INLINE unsigned int cia_ioread16(void __iomem *xaddr) { - unsigned long w; + unsigned long addr = (unsigned long) xaddr; + unsigned long result, base_and_type; addr &= CIA_MEM_R1_MASK; - w = __kernel_inswl(b, addr & 3); - *(vuip) ((addr << 5) + CIA_SPARSE_MEM + 0x08) = w; -} - -__EXTERN_INLINE u32 cia_readl(unsigned long addr) -{ - return *(vuip)addr; -} - -__EXTERN_INLINE u64 cia_readq(unsigned long addr) -{ - return *(vulp)addr; -} - -__EXTERN_INLINE void cia_writel(u32 b, unsigned long addr) -{ - *(vuip)addr = b; -} + if (addr >= CIA_DENSE_MEM) + base_and_type = CIA_SPARSE_MEM + 0x08; + else + base_and_type = CIA_IO + 0x08; -__EXTERN_INLINE void cia_writeq(u64 b, unsigned long addr) -{ - *(vulp)addr = b; + result = *(vip) ((addr << 5) + base_and_type); + return __kernel_extwl(result, addr & 3); } -__EXTERN_INLINE unsigned long cia_ioremap(unsigned long addr, - unsigned long size - __attribute__((unused))) +__EXTERN_INLINE void cia_iowrite16(u16 b, void __iomem *xaddr) { - return addr + CIA_DENSE_MEM; -} + unsigned long addr = (unsigned long) xaddr; + unsigned long w, base_and_type; -__EXTERN_INLINE void cia_iounmap(unsigned long addr) -{ - return; -} + addr &= CIA_MEM_R1_MASK; + if (addr >= CIA_DENSE_MEM) + base_and_type = CIA_SPARSE_MEM + 0x08; + else + base_and_type = CIA_IO + 0x08; -__EXTERN_INLINE u8 cia_bwx_readb(unsigned long addr) -{ - return __kernel_ldbu(*(vucp)addr); + w = __kernel_inswl(b, addr & 3); + *(vuip) ((addr << 5) + base_and_type) = w; } -__EXTERN_INLINE u16 cia_bwx_readw(unsigned long addr) +__EXTERN_INLINE unsigned int cia_ioread32(void __iomem *xaddr) { - return __kernel_ldwu(*(vusp)addr); + unsigned long addr = (unsigned long) xaddr; + if (addr < CIA_DENSE_MEM) + addr = ((addr - CIA_IO) << 5) + CIA_IO + 0x18; + return *(vuip)addr; } -__EXTERN_INLINE u32 cia_bwx_readl(unsigned long addr) +__EXTERN_INLINE void cia_iowrite32(u32 b, void __iomem *xaddr) { - return *(vuip)addr; + unsigned long addr = (unsigned long) xaddr; + if (addr < CIA_DENSE_MEM) + addr = ((addr - CIA_IO) << 5) + CIA_IO + 0x18; + *(vuip)addr = b; } -__EXTERN_INLINE u64 cia_bwx_readq(unsigned long addr) +__EXTERN_INLINE void __iomem *cia_ioportmap(unsigned long addr) { - return *(vulp)addr; + return (void __iomem *)(addr + CIA_IO); } -__EXTERN_INLINE void cia_bwx_writeb(u8 b, unsigned long addr) +__EXTERN_INLINE void __iomem *cia_ioremap(unsigned long addr, + unsigned long size) { - __kernel_stb(b, *(vucp)addr); + return (void __iomem *)(addr + CIA_DENSE_MEM); } -__EXTERN_INLINE void cia_bwx_writew(u16 b, unsigned long addr) +__EXTERN_INLINE int cia_is_ioaddr(unsigned long addr) { - __kernel_stw(b, *(vusp)addr); + return addr >= IDENT_ADDR + 0x8000000000UL; } -__EXTERN_INLINE void cia_bwx_writel(u32 b, unsigned long addr) +__EXTERN_INLINE int cia_is_mmio(const volatile void __iomem *addr) { - *(vuip)addr = b; + return (unsigned long)addr >= CIA_DENSE_MEM; } -__EXTERN_INLINE void cia_bwx_writeq(u64 b, unsigned long addr) +__EXTERN_INLINE void __iomem *cia_bwx_ioportmap(unsigned long addr) { - *(vulp)addr = b; + return (void __iomem *)(addr + CIA_BW_IO); } -__EXTERN_INLINE unsigned long cia_bwx_ioremap(unsigned long addr, +__EXTERN_INLINE void __iomem *cia_bwx_ioremap(unsigned long addr, unsigned long size) { - return addr + CIA_BW_MEM; + return (void __iomem *)(addr + CIA_BW_MEM); } -__EXTERN_INLINE void cia_bwx_iounmap(unsigned long addr) +__EXTERN_INLINE int cia_bwx_is_ioaddr(unsigned long addr) { - return; + return addr >= IDENT_ADDR + 0x8000000000UL; } -__EXTERN_INLINE int cia_is_ioaddr(unsigned long addr) +__EXTERN_INLINE int cia_bwx_is_mmio(const volatile void __iomem *addr) { - return addr >= IDENT_ADDR + 0x8000000000UL; + return (unsigned long)addr < CIA_BW_IO; } -#undef vucp -#undef vusp #undef vip #undef vuip #undef vulp -#ifdef __WANT_IO_DEF +#undef __IO_PREFIX +#define __IO_PREFIX cia +#define cia_trivial_rw_bw 2 +#define cia_trivial_rw_lq 1 +#define cia_trivial_io_bw 0 +#define cia_trivial_io_lq 0 +#define cia_trivial_iounmap 1 +#include + +#undef __IO_PREFIX +#define __IO_PREFIX cia_bwx +#define cia_bwx_trivial_rw_bw 1 +#define cia_bwx_trivial_rw_lq 1 +#define cia_bwx_trivial_io_bw 1 +#define cia_bwx_trivial_io_lq 1 +#define cia_bwx_trivial_iounmap 1 +#include +#undef __IO_PREFIX #ifdef CONFIG_ALPHA_PYXIS -# define __inb(p) cia_bwx_inb((unsigned long)(p)) -# define __inw(p) cia_bwx_inw((unsigned long)(p)) -# define __inl(p) cia_bwx_inl((unsigned long)(p)) -# define __outb(x,p) cia_bwx_outb((x),(unsigned long)(p)) -# define __outw(x,p) cia_bwx_outw((x),(unsigned long)(p)) -# define __outl(x,p) cia_bwx_outl((x),(unsigned long)(p)) -# define __readb(a) cia_bwx_readb((unsigned long)(a)) -# define __readw(a) cia_bwx_readw((unsigned long)(a)) -# define __readl(a) cia_bwx_readl((unsigned long)(a)) -# define __readq(a) cia_bwx_readq((unsigned long)(a)) -# define __writeb(x,a) cia_bwx_writeb((x),(unsigned long)(a)) -# define __writew(x,a) cia_bwx_writew((x),(unsigned long)(a)) -# define __writel(x,a) cia_bwx_writel((x),(unsigned long)(a)) -# define __writeq(x,a) cia_bwx_writeq((x),(unsigned long)(a)) -# define __ioremap(a,s) cia_bwx_ioremap((unsigned long)(a),(s)) -# define __iounmap(a) cia_bwx_iounmap((unsigned long)(a)) -# define inb(p) __inb(p) -# define inw(p) __inw(p) -# define inl(p) __inl(p) -# define outb(x,p) __outb((x),(p)) -# define outw(x,p) __outw((x),(p)) -# define outl(x,p) __outl((x),(p)) -# define __raw_readb(a) __readb(a) -# define __raw_readw(a) __readw(a) -# define __raw_readl(a) __readl(a) -# define __raw_readq(a) __readq(a) -# define __raw_writeb(x,a) __writeb((x),(a)) -# define __raw_writew(x,a) __writew((x),(a)) -# define __raw_writel(x,a) __writel((x),(a)) -# define __raw_writeq(x,a) __writeq((x),(a)) +#define __IO_PREFIX cia_bwx #else -# define __inb(p) cia_inb((unsigned long)(p)) -# define __inw(p) cia_inw((unsigned long)(p)) -# define __inl(p) cia_inl((unsigned long)(p)) -# define __outb(x,p) cia_outb((x),(unsigned long)(p)) -# define __outw(x,p) cia_outw((x),(unsigned long)(p)) -# define __outl(x,p) cia_outl((x),(unsigned long)(p)) -# define __readb(a) cia_readb((unsigned long)(a)) -# define __readw(a) cia_readw((unsigned long)(a)) -# define __readl(a) cia_readl((unsigned long)(a)) -# define __readq(a) cia_readq((unsigned long)(a)) -# define __writeb(x,a) cia_writeb((x),(unsigned long)(a)) -# define __writew(x,a) cia_writew((x),(unsigned long)(a)) -# define __writel(x,a) cia_writel((x),(unsigned long)(a)) -# define __writeq(x,a) cia_writeq((x),(unsigned long)(a)) -# define __ioremap(a,s) cia_ioremap((unsigned long)(a),(s)) -# define __iounmap(a) cia_iounmap((unsigned long)(a)) -# define __raw_readl(a) __readl(a) -# define __raw_readq(a) __readq(a) -# define __raw_writel(v,a) __writel((v),(a)) -# define __raw_writeq(v,a) __writeq((v),(a)) -#endif /* PYXIS */ - -#define __is_ioaddr(a) cia_is_ioaddr((unsigned long)(a)) - -#endif /* __WANT_IO_DEF */ +#define __IO_PREFIX cia +#endif #ifdef __IO_EXTERN_INLINE #undef __EXTERN_INLINE diff -Nru a/include/asm-alpha/core_irongate.h b/include/asm-alpha/core_irongate.h --- a/include/asm-alpha/core_irongate.h 2004-09-26 10:25:56 -07:00 +++ b/include/asm-alpha/core_irongate.h 2004-09-26 10:25:56 -07:00 @@ -190,137 +190,37 @@ * K7 can only use linear accesses to get at PCI memory and I/O spaces. */ -#define vucp volatile unsigned char * -#define vusp volatile unsigned short * -#define vuip volatile unsigned int * -#define vulp volatile unsigned long * - -__EXTERN_INLINE u8 irongate_inb(unsigned long addr) -{ - return __kernel_ldbu(*(vucp)(addr + IRONGATE_IO)); -} - -__EXTERN_INLINE void irongate_outb(u8 b, unsigned long addr) -{ - __kernel_stb(b, *(vucp)(addr + IRONGATE_IO)); - mb(); -} - -__EXTERN_INLINE u16 irongate_inw(unsigned long addr) -{ - return __kernel_ldwu(*(vusp)(addr + IRONGATE_IO)); -} - -__EXTERN_INLINE void irongate_outw(u16 b, unsigned long addr) -{ - __kernel_stw(b, *(vusp)(addr + IRONGATE_IO)); - mb(); -} - -__EXTERN_INLINE u32 irongate_inl(unsigned long addr) -{ - return *(vuip)(addr + IRONGATE_IO); -} - -__EXTERN_INLINE void irongate_outl(u32 b, unsigned long addr) -{ - *(vuip)(addr + IRONGATE_IO) = b; - mb(); -} - /* * Memory functions. All accesses are done through linear space. */ -__EXTERN_INLINE u8 irongate_readb(unsigned long addr) +__EXTERN_INLINE void __iomem *irongate_ioportmap(unsigned long addr) { - return __kernel_ldbu(*(vucp)addr); + return (void __iomem *)(addr + IRONGATE_IO); } -__EXTERN_INLINE u16 irongate_readw(unsigned long addr) -{ - return __kernel_ldwu(*(vusp)addr); -} - -__EXTERN_INLINE u32 irongate_readl(unsigned long addr) -{ - return (*(vuip)addr) & 0xffffffff; -} - -__EXTERN_INLINE u64 irongate_readq(unsigned long addr) -{ - return *(vulp)addr; -} - -__EXTERN_INLINE void irongate_writeb(u8 b, unsigned long addr) -{ - __kernel_stb(b, *(vucp)addr); -} - -__EXTERN_INLINE void irongate_writew(u16 b, unsigned long addr) -{ - __kernel_stw(b, *(vusp)addr); -} - -__EXTERN_INLINE void irongate_writel(u32 b, unsigned long addr) -{ - *(vuip)addr = b; -} - -__EXTERN_INLINE void irongate_writeq(u64 b, unsigned long addr) -{ - *(vulp)addr = b; -} - -extern unsigned long irongate_ioremap(unsigned long addr, unsigned long size); -extern void irongate_iounmap(unsigned long addr); +extern void __iomem *irongate_ioremap(unsigned long addr, unsigned long size); +extern void irongate_iounmap(volatile void __iomem *addr); __EXTERN_INLINE int irongate_is_ioaddr(unsigned long addr) { return addr >= IRONGATE_MEM; } -#undef vucp -#undef vusp -#undef vuip -#undef vulp - -#ifdef __WANT_IO_DEF - -#define __inb(p) irongate_inb((unsigned long)(p)) -#define __inw(p) irongate_inw((unsigned long)(p)) -#define __inl(p) irongate_inl((unsigned long)(p)) -#define __outb(x,p) irongate_outb((x),(unsigned long)(p)) -#define __outw(x,p) irongate_outw((x),(unsigned long)(p)) -#define __outl(x,p) irongate_outl((x),(unsigned long)(p)) -#define __readb(a) irongate_readb((unsigned long)(a)) -#define __readw(a) irongate_readw((unsigned long)(a)) -#define __readl(a) irongate_readl((unsigned long)(a)) -#define __readq(a) irongate_readq((unsigned long)(a)) -#define __writeb(x,a) irongate_writeb((x),(unsigned long)(a)) -#define __writew(x,a) irongate_writew((x),(unsigned long)(a)) -#define __writel(x,a) irongate_writel((x),(unsigned long)(a)) -#define __writeq(x,a) irongate_writeq((x),(unsigned long)(a)) -#define __ioremap(a,s) irongate_ioremap((unsigned long)(a),(s)) -#define __iounmap(a) irongate_iounmap((unsigned long)(a)) -#define __is_ioaddr(a) irongate_is_ioaddr((unsigned long)(a)) - -#define inb(p) __inb(p) -#define inw(p) __inw(p) -#define inl(p) __inl(p) -#define outb(x,p) __outb((x),(p)) -#define outw(x,p) __outw((x),(p)) -#define outl(x,p) __outl((x),(p)) -#define __raw_readb(a) __readb(a) -#define __raw_readw(a) __readw(a) -#define __raw_readl(a) __readl(a) -#define __raw_readq(a) __readq(a) -#define __raw_writeb(v,a) __writeb((v),(a)) -#define __raw_writew(v,a) __writew((v),(a)) -#define __raw_writel(v,a) __writel((v),(a)) -#define __raw_writeq(v,a) __writeq((v),(a)) +__EXTERN_INLINE int irongate_is_mmio(const volatile void __iomem *xaddr) +{ + unsigned long addr = (unsigned long)xaddr; + return addr < IRONGATE_IO || addr >= IRONGATE_CONF; +} -#endif /* __WANT_IO_DEF */ +#undef __IO_PREFIX +#define __IO_PREFIX irongate +#define irongate_trivial_rw_bw 1 +#define irongate_trivial_rw_lq 1 +#define irongate_trivial_io_bw 1 +#define irongate_trivial_io_lq 1 +#define irongate_trivial_iounmap 0 +#include #ifdef __IO_EXTERN_INLINE #undef __EXTERN_INLINE diff -Nru a/include/asm-alpha/core_lca.h b/include/asm-alpha/core_lca.h --- a/include/asm-alpha/core_lca.h 2004-09-26 10:25:57 -07:00 +++ b/include/asm-alpha/core_lca.h 2004-09-26 10:25:57 -07:00 @@ -215,145 +215,117 @@ * data to/from the right byte-lanes. */ -#define vip volatile int * -#define vuip volatile unsigned int * -#define vulp volatile unsigned long * +#define vip volatile int __force * +#define vuip volatile unsigned int __force * +#define vulp volatile unsigned long __force * + +#define LCA_SET_HAE \ + do { \ + if (addr >= (1UL << 24)) { \ + unsigned long msb = addr & 0xf8000000; \ + addr -= msb; \ + set_hae(msb); \ + } \ + } while (0) + + +__EXTERN_INLINE unsigned int lca_ioread8(void __iomem *xaddr) +{ + unsigned long addr = (unsigned long) xaddr; + unsigned long result, base_and_type; + + if (addr >= LCA_DENSE_MEM) { + addr -= LCA_DENSE_MEM; + LCA_SET_HAE; + base_and_type = LCA_SPARSE_MEM + 0x00; + } else { + addr -= LCA_IO; + base_and_type = LCA_IO + 0x00; + } -__EXTERN_INLINE u8 lca_inb(unsigned long addr) -{ - long result = *(vip) ((addr << 5) + LCA_IO + 0x00); + result = *(vip) ((addr << 5) + base_and_type); return __kernel_extbl(result, addr & 3); } -__EXTERN_INLINE void lca_outb(u8 b, unsigned long addr) -{ - unsigned long w; - - w = __kernel_insbl(b, addr & 3); - *(vuip) ((addr << 5) + LCA_IO + 0x00) = w; - mb(); -} - -__EXTERN_INLINE u16 lca_inw(unsigned long addr) -{ - long result = *(vip) ((addr << 5) + LCA_IO + 0x08); - return __kernel_extwl(result, addr & 3); -} - -__EXTERN_INLINE void lca_outw(u16 b, unsigned long addr) +__EXTERN_INLINE void lca_iowrite8(u8 b, void __iomem *xaddr) { - unsigned long w; + unsigned long addr = (unsigned long) xaddr; + unsigned long w, base_and_type; - w = __kernel_inswl(b, addr & 3); - *(vuip) ((addr << 5) + LCA_IO + 0x08) = w; - mb(); -} - -__EXTERN_INLINE u32 lca_inl(unsigned long addr) -{ - return *(vuip) ((addr << 5) + LCA_IO + 0x18); -} + if (addr >= LCA_DENSE_MEM) { + addr -= LCA_DENSE_MEM; + LCA_SET_HAE; + base_and_type = LCA_SPARSE_MEM + 0x00; + } else { + addr -= LCA_IO; + base_and_type = LCA_IO + 0x00; + } -__EXTERN_INLINE void lca_outl(u32 b, unsigned long addr) -{ - *(vuip) ((addr << 5) + LCA_IO + 0x18) = b; - mb(); + w = __kernel_insbl(b, addr & 3); + *(vuip) ((addr << 5) + base_and_type) = w; } - -/* - * Memory functions. 64-bit and 32-bit accesses are done through - * dense memory space, everything else through sparse space. - */ - -__EXTERN_INLINE u8 lca_readb(unsigned long addr) +__EXTERN_INLINE unsigned int lca_ioread16(void __iomem *xaddr) { - unsigned long result, msb; + unsigned long addr = (unsigned long) xaddr; + unsigned long result, base_and_type; - addr -= LCA_DENSE_MEM; - if (addr >= (1UL << 24)) { - msb = addr & 0xf8000000; - addr -= msb; - set_hae(msb); + if (addr >= LCA_DENSE_MEM) { + addr -= LCA_DENSE_MEM; + LCA_SET_HAE; + base_and_type = LCA_SPARSE_MEM + 0x08; + } else { + addr -= LCA_IO; + base_and_type = LCA_IO + 0x08; } - result = *(vip) ((addr << 5) + LCA_SPARSE_MEM + 0x00); - return __kernel_extbl(result, addr & 3); -} - -__EXTERN_INLINE u16 lca_readw(unsigned long addr) -{ - unsigned long result, msb; - addr -= LCA_DENSE_MEM; - if (addr >= (1UL << 24)) { - msb = addr & 0xf8000000; - addr -= msb; - set_hae(msb); - } - result = *(vip) ((addr << 5) + LCA_SPARSE_MEM + 0x08); + result = *(vip) ((addr << 5) + base_and_type); return __kernel_extwl(result, addr & 3); } -__EXTERN_INLINE u32 lca_readl(unsigned long addr) +__EXTERN_INLINE void lca_iowrite16(u16 b, void __iomem *xaddr) { - return (*(vuip)addr) & 0xffffffff; -} + unsigned long addr = (unsigned long) xaddr; + unsigned long w, base_and_type; -__EXTERN_INLINE u64 lca_readq(unsigned long addr) -{ - return *(vulp)addr; -} - -__EXTERN_INLINE void lca_writeb(u8 b, unsigned long addr) -{ - unsigned long msb; - unsigned long w; - - addr -= LCA_DENSE_MEM; - if (addr >= (1UL << 24)) { - msb = addr & 0xf8000000; - addr -= msb; - set_hae(msb); + if (addr >= LCA_DENSE_MEM) { + addr -= LCA_DENSE_MEM; + LCA_SET_HAE; + base_and_type = LCA_SPARSE_MEM + 0x08; + } else { + addr -= LCA_IO; + base_and_type = LCA_IO + 0x08; } - w = __kernel_insbl(b, addr & 3); - *(vuip) ((addr << 5) + LCA_SPARSE_MEM + 0x00) = w; -} - -__EXTERN_INLINE void lca_writew(u16 b, unsigned long addr) -{ - unsigned long msb; - unsigned long w; - addr -= LCA_DENSE_MEM; - if (addr >= (1UL << 24)) { - msb = addr & 0xf8000000; - addr -= msb; - set_hae(msb); - } w = __kernel_inswl(b, addr & 3); - *(vuip) ((addr << 5) + LCA_SPARSE_MEM + 0x08) = w; + *(vuip) ((addr << 5) + base_and_type) = w; } -__EXTERN_INLINE void lca_writel(u32 b, unsigned long addr) +__EXTERN_INLINE unsigned int lca_ioread32(void __iomem *xaddr) { - *(vuip)addr = b; + unsigned long addr = (unsigned long) xaddr; + if (addr < LCA_DENSE_MEM) + addr = ((addr - LCA_IO) << 5) + LCA_IO + 0x18; + return *(vuip)addr; } -__EXTERN_INLINE void lca_writeq(u64 b, unsigned long addr) +__EXTERN_INLINE void lca_iowrite32(u32 b, void __iomem *xaddr) { - *(vulp)addr = b; + unsigned long addr = (unsigned long) xaddr; + if (addr < LCA_DENSE_MEM) + addr = ((addr - LCA_IO) << 5) + LCA_IO + 0x18; + *(vuip)addr = b; } -__EXTERN_INLINE unsigned long lca_ioremap(unsigned long addr, - unsigned long size - __attribute__((unused))) +__EXTERN_INLINE void __iomem *lca_ioportmap(unsigned long addr) { - return addr + LCA_DENSE_MEM; + return (void __iomem *)(addr + LCA_IO); } -__EXTERN_INLINE void lca_iounmap(unsigned long addr) +__EXTERN_INLINE void __iomem *lca_ioremap(unsigned long addr, + unsigned long size) { - return; + return (void __iomem *)(addr + LCA_DENSE_MEM); } __EXTERN_INLINE int lca_is_ioaddr(unsigned long addr) @@ -361,36 +333,23 @@ return addr >= IDENT_ADDR + 0x120000000UL; } +__EXTERN_INLINE int lca_is_mmio(const volatile void __iomem *addr) +{ + return (unsigned long)addr >= LCA_DENSE_MEM; +} + #undef vip #undef vuip #undef vulp -#ifdef __WANT_IO_DEF - -#define __inb(p) lca_inb((unsigned long)(p)) -#define __inw(p) lca_inw((unsigned long)(p)) -#define __inl(p) lca_inl((unsigned long)(p)) -#define __outb(x,p) lca_outb((x),(unsigned long)(p)) -#define __outw(x,p) lca_outw((x),(unsigned long)(p)) -#define __outl(x,p) lca_outl((x),(unsigned long)(p)) -#define __readb(a) lca_readb((unsigned long)(a)) -#define __readw(a) lca_readw((unsigned long)(a)) -#define __readl(a) lca_readl((unsigned long)(a)) -#define __readq(a) lca_readq((unsigned long)(a)) -#define __writeb(x,a) lca_writeb((x),(unsigned long)(a)) -#define __writew(x,a) lca_writew((x),(unsigned long)(a)) -#define __writel(x,a) lca_writel((x),(unsigned long)(a)) -#define __writeq(x,a) lca_writeq((x),(unsigned long)(a)) -#define __ioremap(a,s) lca_ioremap((unsigned long)(a),(s)) -#define __iounmap(a) lca_iounmap((unsigned long)(a)) -#define __is_ioaddr(a) lca_is_ioaddr((unsigned long)(a)) - -#define __raw_readl(a) __readl(a) -#define __raw_readq(a) __readq(a) -#define __raw_writel(v,a) __writel((v),(a)) -#define __raw_writeq(v,a) __writeq((v),(a)) - -#endif /* __WANT_IO_DEF */ +#undef __IO_PREFIX +#define __IO_PREFIX lca +#define lca_trivial_rw_bw 2 +#define lca_trivial_rw_lq 1 +#define lca_trivial_io_bw 0 +#define lca_trivial_io_lq 0 +#define lca_trivial_iounmap 1 +#include #ifdef __IO_EXTERN_INLINE #undef __EXTERN_INLINE diff -Nru a/include/asm-alpha/core_marvel.h b/include/asm-alpha/core_marvel.h --- a/include/asm-alpha/core_marvel.h 2004-09-26 10:25:55 -07:00 +++ b/include/asm-alpha/core_marvel.h 2004-09-26 10:25:55 -07:00 @@ -325,249 +325,48 @@ * I/O functions. All access through linear space. */ -#define vucp volatile unsigned char * -#define vusp volatile unsigned short * -#define vuip volatile unsigned int * -#define vulp volatile unsigned long * - -#ifdef CONFIG_VGA_HOSE -extern struct pci_controller *pci_vga_hose; - -# define __marvel_is_port_vga(a) \ - (((a) >= 0x3b0) && ((a) < 0x3e0) && ((a) != 0x3b3) && ((a) != 0x3d3)) -# define __marvel_is_mem_vga(a) (((a) >= 0xa0000) && ((a) <= 0xc0000)) -# define FIXUP_IOADDR_VGA(a) do { \ - if (pci_vga_hose && __marvel_is_port_vga(a)) \ - a += pci_vga_hose->io_space->start; \ - } while(0) -#else -# define FIXUP_IOADDR_VGA(a) -#endif - -#define __marvel_is_port_kbd(a) (((a) == 0x60) || ((a) == 0x64)) -#define __marvel_is_port_rtc(a) (((a) == 0x70) || ((a) == 0x71)) - -#define FIXUP_IOADDR_LEGACY(a) - -#define FIXUP_IOADDR(a) do { \ - FIXUP_IOADDR_VGA(a); \ - FIXUP_IOADDR_LEGACY(a); \ - } while(0) - -#if 0 -# define IOBUG(x) printk x -# define IOBUG_FILTER_IOADDR(a, x) \ - if (!__marvel_is_port_kbd(a) && !__marvel_is_port_rtc(a)) IOBUG(x) -#else -# define IOBUG(x) -# define IOBUG_FILTER_IOADDR(a, x) -#endif - -extern u8 __marvel_rtc_io(int write, u8 b, unsigned long addr); -#define __marvel_rtc_inb(a) __marvel_rtc_io(0, 0, (a)) -#define __marvel_rtc_outb(b, a) __marvel_rtc_io(1, (b), (a)) - -__EXTERN_INLINE int marvel_is_ioaddr(unsigned long addr) -{ - return (addr & (1UL << 40)) != 0; /*FIXME - hardwire*/ -} - -__EXTERN_INLINE u8 marvel_inb(unsigned long addr) -{ - FIXUP_IOADDR(addr); - if (!marvel_is_ioaddr(addr)) { - if (__marvel_is_port_kbd(addr)) - return (u8)0; - if (__marvel_is_port_rtc(addr)) - return __marvel_rtc_inb(addr); - IOBUG_FILTER_IOADDR(addr, - ("Bad IO addr %lx - reading -1\n", addr)); - return (u8)-1; - } - return __kernel_ldbu(*(vucp)addr); -} - -__EXTERN_INLINE void marvel_outb(u8 b, unsigned long addr) -{ - FIXUP_IOADDR(addr); - if (!marvel_is_ioaddr(addr)) { - if (__marvel_is_port_rtc(addr)) - return (void)__marvel_rtc_outb(b, addr); - IOBUG_FILTER_IOADDR(addr, - ("Bad IO addr %lx - reading -1\n", addr)); - return; - } - __kernel_stb(b, *(vucp)addr); - mb(); -} - -__EXTERN_INLINE u16 marvel_inw(unsigned long addr) -{ - FIXUP_IOADDR(addr); - if (!marvel_is_ioaddr(addr)) { - IOBUG_FILTER_IOADDR(addr, - ("Bad IO addr %lx - reading -1\n", addr)); - return (u16)-1; - } - return __kernel_ldwu(*(vusp)addr); -} - -__EXTERN_INLINE void marvel_outw(u16 w, unsigned long addr) -{ - FIXUP_IOADDR(addr); - if (!marvel_is_ioaddr(addr)) { - IOBUG_FILTER_IOADDR(addr, - ("Bad IO addr %lx - reading -1\n", addr)); - return; - } - __kernel_stw(w, *(vusp)addr); - mb(); -} - -__EXTERN_INLINE u32 marvel_inl(unsigned long addr) -{ - FIXUP_IOADDR(addr); - if (!marvel_is_ioaddr(addr)) { - IOBUG_FILTER_IOADDR(addr, - ("Bad IO addr %lx - reading -1\n", addr)); - return (u32)-1; - } - return *(vuip)addr; -} - -__EXTERN_INLINE void marvel_outl(u32 l, unsigned long addr) -{ - FIXUP_IOADDR(addr); - if (!marvel_is_ioaddr(addr)) { - IOBUG_FILTER_IOADDR(addr, - ("Bad IO addr %lx - reading -1\n", addr)); - return; - } - *(vuip)addr = l; - mb(); -} - /* * Memory functions. All accesses through linear space. */ -extern unsigned long marvel_ioremap(unsigned long addr, unsigned long size); -extern void marvel_iounmap(unsigned long addr); +#define vucp volatile unsigned char __force * +#define vusp volatile unsigned short __force * -__EXTERN_INLINE u8 marvel_readb(unsigned long addr) -{ - if (!marvel_is_ioaddr(addr)) { - IOBUG(("Bad MEM addr %lx - reading -1\n", addr)); - return (u8)-1; - } - return __kernel_ldbu(*(vucp)addr); -} +extern unsigned int marvel_ioread8(void __iomem *); +extern void marvel_iowrite8(u8 b, void __iomem *); -__EXTERN_INLINE u16 marvel_readw(unsigned long addr) +__EXTERN_INLINE unsigned int marvel_ioread16(void __iomem *addr) { - if (!marvel_is_ioaddr(addr)) { - IOBUG(("Bad MEM addr %lx - reading -1\n", addr)); - return (u16)-1; - } return __kernel_ldwu(*(vusp)addr); } -__EXTERN_INLINE u32 marvel_readl(unsigned long addr) -{ - if (!marvel_is_ioaddr(addr)) { - IOBUG(("Bad MEM addr %lx - reading -1\n", addr)); - return (u32)-1; - } - return *(vuip)addr; -} - -__EXTERN_INLINE u64 marvel_readq(unsigned long addr) -{ - if (!marvel_is_ioaddr(addr)) { - IOBUG(("Bad MEM addr %lx - reading -1\n", addr)); - return (u64)-1; - } - return *(vulp)addr; -} - -__EXTERN_INLINE void marvel_writeb(u8 b, unsigned long addr) -{ - if (!marvel_is_ioaddr(addr)) { - IOBUG(("Bad MEM addr %lx - dropping store\n", addr)); - return; - } - __kernel_stb(b, *(vucp)addr); -} - -__EXTERN_INLINE void marvel_writew(u16 w, unsigned long addr) +__EXTERN_INLINE void marvel_iowrite16(u16 b, void __iomem *addr) { - if (!marvel_is_ioaddr(addr)) { - IOBUG(("Bad MEM addr %lx - dropping store\n", addr)); - return; - } - __kernel_stw(w, *(vusp)addr); + __kernel_stw(b, *(vusp)addr); } -__EXTERN_INLINE void marvel_writel(u32 l, unsigned long addr) -{ - if (!marvel_is_ioaddr(addr)) { - IOBUG(("Bad MEM addr %lx - dropping store\n", addr)); - return; - } - *(vuip)addr = l; -} +extern void __iomem *marvel_ioremap(unsigned long addr, unsigned long size); +extern void marvel_iounmap(volatile void __iomem *addr); +extern void __iomem *marvel_ioportmap (unsigned long addr); -__EXTERN_INLINE void marvel_writeq(u64 q, unsigned long addr) +__EXTERN_INLINE int marvel_is_ioaddr(unsigned long addr) { - if (!marvel_is_ioaddr(addr)) { - IOBUG(("Bad MEM addr %lx - dropping store\n", addr)); - return; - } - *(vulp)addr = q; + return (addr >> 40) & 1; } -#undef FIXUP_IOADDR -#undef FIXUP_IOADDR_LEGACY -#undef FIXUP_IOADDR_VGA +extern int marvel_is_mmio(const volatile void __iomem *); #undef vucp #undef vusp -#undef vuip -#undef vulp - -#ifdef __WANT_IO_DEF - -#define __inb(p) marvel_inb((unsigned long)(p)) -#define __inw(p) marvel_inw((unsigned long)(p)) -#define __inl(p) marvel_inl((unsigned long)(p)) -#define __outb(x,p) marvel_outb((x),(unsigned long)(p)) -#define __outw(x,p) marvel_outw((x),(unsigned long)(p)) -#define __outl(x,p) marvel_outl((x),(unsigned long)(p)) -#define __readb(a) marvel_readb((unsigned long)(a)) -#define __readw(a) marvel_readw((unsigned long)(a)) -#define __readl(a) marvel_readl((unsigned long)(a)) -#define __readq(a) marvel_readq((unsigned long)(a)) -#define __writeb(x,a) marvel_writeb((x),(unsigned long)(a)) -#define __writew(x,a) marvel_writew((x),(unsigned long)(a)) -#define __writel(x,a) marvel_writel((x),(unsigned long)(a)) -#define __writeq(x,a) marvel_writeq((x),(unsigned long)(a)) -#define __ioremap(a,s) marvel_ioremap((unsigned long)(a),(s)) -#define __iounmap(a) marvel_iounmap((unsigned long)(a)) -#define __is_ioaddr(a) marvel_is_ioaddr((unsigned long)(a)) - -/* Disable direct inlining of these calls with the debug checks present. */ -#if 0 -#define __raw_readb(a) __readb(a) -#define __raw_readw(a) __readw(a) -#define __raw_readl(a) __readl(a) -#define __raw_readq(a) __readq(a) -#define __raw_writeb(v,a) __writeb(v,a) -#define __raw_writew(v,a) __writew(v,a) -#define __raw_writel(v,a) __writel(v,a) -#define __raw_writeq(v,a) __writeq(v,a) -#endif -#endif /* __WANT_IO_DEF */ +#undef __IO_PREFIX +#define __IO_PREFIX marvel +#define marvel_trivial_rw_bw 1 +#define marvel_trivial_rw_lq 1 +#define marvel_trivial_io_bw 0 +#define marvel_trivial_io_lq 1 +#define marvel_trivial_iounmap 0 +#include #ifdef __IO_EXTERN_INLINE # undef __EXTERN_INLINE diff -Nru a/include/asm-alpha/core_mcpcia.h b/include/asm-alpha/core_mcpcia.h --- a/include/asm-alpha/core_mcpcia.h 2004-09-26 10:25:57 -07:00 +++ b/include/asm-alpha/core_mcpcia.h 2004-09-26 10:25:57 -07:00 @@ -211,91 +211,6 @@ * Unfortunately, we can't use BWIO with EV5, so for now, we always use SPARSE. */ -#define vucp volatile unsigned char * -#define vusp volatile unsigned short * -#define vip volatile int * -#define vuip volatile unsigned int * -#define vulp volatile unsigned long * - -__EXTERN_INLINE u8 mcpcia_inb(unsigned long in_addr) -{ - unsigned long addr, hose, result; - - addr = in_addr & 0xffffUL; - hose = in_addr & ~0xffffUL; - - /* ??? I wish I could get rid of this. But there's no ioremap - equivalent for I/O space. PCI I/O can be forced into the - correct hose's I/O region, but that doesn't take care of - legacy ISA crap. */ - hose += MCPCIA_IO_BIAS; - - result = *(vip) ((addr << 5) + hose + 0x00); - return __kernel_extbl(result, addr & 3); -} - -__EXTERN_INLINE void mcpcia_outb(u8 b, unsigned long in_addr) -{ - unsigned long addr, hose, w; - - addr = in_addr & 0xffffUL; - hose = in_addr & ~0xffffUL; - hose += MCPCIA_IO_BIAS; - - w = __kernel_insbl(b, addr & 3); - *(vuip) ((addr << 5) + hose + 0x00) = w; - mb(); -} - -__EXTERN_INLINE u16 mcpcia_inw(unsigned long in_addr) -{ - unsigned long addr, hose, result; - - addr = in_addr & 0xffffUL; - hose = in_addr & ~0xffffUL; - hose += MCPCIA_IO_BIAS; - - result = *(vip) ((addr << 5) + hose + 0x08); - return __kernel_extwl(result, addr & 3); -} - -__EXTERN_INLINE void mcpcia_outw(u16 b, unsigned long in_addr) -{ - unsigned long addr, hose, w; - - addr = in_addr & 0xffffUL; - hose = in_addr & ~0xffffUL; - hose += MCPCIA_IO_BIAS; - - w = __kernel_inswl(b, addr & 3); - *(vuip) ((addr << 5) + hose + 0x08) = w; - mb(); -} - -__EXTERN_INLINE u32 mcpcia_inl(unsigned long in_addr) -{ - unsigned long addr, hose; - - addr = in_addr & 0xffffUL; - hose = in_addr & ~0xffffUL; - hose += MCPCIA_IO_BIAS; - - return *(vuip) ((addr << 5) + hose + 0x18); -} - -__EXTERN_INLINE void mcpcia_outl(u32 b, unsigned long in_addr) -{ - unsigned long addr, hose; - - addr = in_addr & 0xffffUL; - hose = in_addr & ~0xffffUL; - hose += MCPCIA_IO_BIAS; - - *(vuip) ((addr << 5) + hose + 0x18) = b; - mb(); -} - - /* * Memory functions. 64-bit and 32-bit accesses are done through * dense memory space, everything else through sparse space. @@ -328,149 +243,131 @@ * */ -__EXTERN_INLINE unsigned long mcpcia_ioremap(unsigned long addr, - unsigned long size - __attribute__((unused))) -{ - return addr + MCPCIA_MEM_BIAS; -} +#define vip volatile int __force * +#define vuip volatile unsigned int __force * + +#ifdef MCPCIA_ONE_HAE_WINDOW +#define MCPCIA_FROB_MMIO \ + if (__mcpcia_is_mmio(hose)) { \ + set_hae(hose & 0xffffffff); \ + hose = hose - MCPCIA_DENSE(4) + MCPCIA_SPARSE(4); \ + } +#else +#define MCPCIA_FROB_MMIO \ + if (__mcpcia_is_mmio(hose)) { \ + hose = hose - MCPCIA_DENSE(4) + MCPCIA_SPARSE(4); \ + } +#endif -__EXTERN_INLINE void mcpcia_iounmap(unsigned long addr) +static inline int __mcpcia_is_mmio(unsigned long addr) { - return; + return (addr & 0x80000000UL) == 0; } -__EXTERN_INLINE int mcpcia_is_ioaddr(unsigned long addr) +__EXTERN_INLINE unsigned int mcpcia_ioread8(void __iomem *xaddr) { - return addr >= MCPCIA_SPARSE(0); + unsigned long addr = (unsigned long)xaddr & MCPCIA_MEM_MASK; + unsigned long hose = (unsigned long)xaddr & ~MCPCIA_MEM_MASK; + unsigned long result; + + MCPCIA_FROB_MMIO; + + result = *(vip) ((addr << 5) + hose + 0x00); + return __kernel_extbl(result, addr & 3); } -__EXTERN_INLINE u8 mcpcia_readb(unsigned long in_addr) +__EXTERN_INLINE void mcpcia_iowrite8(u8 b, void __iomem *xaddr) { - unsigned long addr = in_addr & 0xffffffffUL; - unsigned long hose = in_addr & ~0xffffffffUL; - unsigned long result, work; - -#ifndef MCPCIA_ONE_HAE_WINDOW - unsigned long msb; - msb = addr & ~MCPCIA_MEM_MASK; - set_hae(msb); -#endif - addr = addr & MCPCIA_MEM_MASK; + unsigned long addr = (unsigned long)xaddr & MCPCIA_MEM_MASK; + unsigned long hose = (unsigned long)xaddr & ~MCPCIA_MEM_MASK; + unsigned long w; - hose = hose - MCPCIA_DENSE(4) + MCPCIA_SPARSE(4); - work = ((addr << 5) + hose + 0x00); - result = *(vip) work; - return __kernel_extbl(result, addr & 3); + MCPCIA_FROB_MMIO; + + w = __kernel_insbl(b, addr & 3); + *(vuip) ((addr << 5) + hose + 0x00) = w; } -__EXTERN_INLINE u16 mcpcia_readw(unsigned long in_addr) +__EXTERN_INLINE unsigned int mcpcia_ioread16(void __iomem *xaddr) { - unsigned long addr = in_addr & 0xffffffffUL; - unsigned long hose = in_addr & ~0xffffffffUL; - unsigned long result, work; - -#ifndef MCPCIA_ONE_HAE_WINDOW - unsigned long msb; - msb = addr & ~MCPCIA_MEM_MASK; - set_hae(msb); -#endif - addr = addr & MCPCIA_MEM_MASK; + unsigned long addr = (unsigned long)xaddr & MCPCIA_MEM_MASK; + unsigned long hose = (unsigned long)xaddr & ~MCPCIA_MEM_MASK; + unsigned long result; + + MCPCIA_FROB_MMIO; - hose = hose - MCPCIA_DENSE(4) + MCPCIA_SPARSE(4); - work = ((addr << 5) + hose + 0x08); - result = *(vip) work; + result = *(vip) ((addr << 5) + hose + 0x08); return __kernel_extwl(result, addr & 3); } -__EXTERN_INLINE void mcpcia_writeb(u8 b, unsigned long in_addr) +__EXTERN_INLINE void mcpcia_iowrite16(u16 b, void __iomem *xaddr) { - unsigned long addr = in_addr & 0xffffffffUL; - unsigned long hose = in_addr & ~0xffffffffUL; + unsigned long addr = (unsigned long)xaddr & MCPCIA_MEM_MASK; + unsigned long hose = (unsigned long)xaddr & ~MCPCIA_MEM_MASK; unsigned long w; -#ifndef MCPCIA_ONE_HAE_WINDOW - unsigned long msb; - msb = addr & ~MCPCIA_MEM_MASK; - set_hae(msb); -#endif - addr = addr & MCPCIA_MEM_MASK; + MCPCIA_FROB_MMIO; - w = __kernel_insbl(b, in_addr & 3); - hose = hose - MCPCIA_DENSE(4) + MCPCIA_SPARSE(4); - *(vuip) ((addr << 5) + hose + 0x00) = w; + w = __kernel_inswl(b, addr & 3); + *(vuip) ((addr << 5) + hose + 0x08) = w; } -__EXTERN_INLINE void mcpcia_writew(u16 b, unsigned long in_addr) +__EXTERN_INLINE unsigned int mcpcia_ioread32(void __iomem *xaddr) { - unsigned long addr = in_addr & 0xffffffffUL; - unsigned long hose = in_addr & ~0xffffffffUL; - unsigned long w; + unsigned long addr = (unsigned long)xaddr; -#ifndef MCPCIA_ONE_HAE_WINDOW - unsigned long msb; - msb = addr & ~MCPCIA_MEM_MASK; - set_hae(msb); -#endif - addr = addr & MCPCIA_MEM_MASK; + if (!__mcpcia_is_mmio(addr)) + addr = ((addr & 0xffff) << 5) + (addr & ~0xfffful) + 0x18; - w = __kernel_inswl(b, in_addr & 3); - hose = hose - MCPCIA_DENSE(4) + MCPCIA_SPARSE(4); - *(vuip) ((addr << 5) + hose + 0x08) = w; + return *(vuip)addr; } -__EXTERN_INLINE u32 mcpcia_readl(unsigned long addr) +__EXTERN_INLINE void mcpcia_iowrite32(u32 b, void __iomem *xaddr) { - return (*(vuip)addr) & 0xffffffff; + unsigned long addr = (unsigned long)xaddr; + + if (!__mcpcia_is_mmio(addr)) + addr = ((addr & 0xffff) << 5) + (addr & ~0xfffful) + 0x18; + + *(vuip)addr = b; } -__EXTERN_INLINE u64 mcpcia_readq(unsigned long addr) + +__EXTERN_INLINE void __iomem *mcpcia_ioportmap(unsigned long addr) { - return *(vulp)addr; + return (void __iomem *)(addr + MCPCIA_IO_BIAS); } -__EXTERN_INLINE void mcpcia_writel(u32 b, unsigned long addr) +__EXTERN_INLINE void __iomem *mcpcia_ioremap(unsigned long addr, + unsigned long size) { - *(vuip)addr = b; + return (void __iomem *)(addr + MCPCIA_MEM_BIAS); } -__EXTERN_INLINE void mcpcia_writeq(u64 b, unsigned long addr) +__EXTERN_INLINE int mcpcia_is_ioaddr(unsigned long addr) { - *(vulp)addr = b; + return addr >= MCPCIA_SPARSE(0); } -#undef vucp -#undef vusp -#undef vip -#undef vuip -#undef vulp +__EXTERN_INLINE int mcpcia_is_mmio(const volatile void __iomem *xaddr) +{ + unsigned long addr = (unsigned long) xaddr; + return __mcpcia_is_mmio(addr); +} -#ifdef __WANT_IO_DEF +#undef MCPCIA_FROB_MMIO -#define __inb(p) mcpcia_inb((unsigned long)(p)) -#define __inw(p) mcpcia_inw((unsigned long)(p)) -#define __inl(p) mcpcia_inl((unsigned long)(p)) -#define __outb(x,p) mcpcia_outb((x),(unsigned long)(p)) -#define __outw(x,p) mcpcia_outw((x),(unsigned long)(p)) -#define __outl(x,p) mcpcia_outl((x),(unsigned long)(p)) -#define __readb(a) mcpcia_readb((unsigned long)(a)) -#define __readw(a) mcpcia_readw((unsigned long)(a)) -#define __readl(a) mcpcia_readl((unsigned long)(a)) -#define __readq(a) mcpcia_readq((unsigned long)(a)) -#define __writeb(x,a) mcpcia_writeb((x),(unsigned long)(a)) -#define __writew(x,a) mcpcia_writew((x),(unsigned long)(a)) -#define __writel(x,a) mcpcia_writel((x),(unsigned long)(a)) -#define __writeq(x,a) mcpcia_writeq((x),(unsigned long)(a)) -#define __ioremap(a,s) mcpcia_ioremap((unsigned long)(a),(s)) -#define __iounmap(a) mcpcia_iounmap((unsigned long)(a)) -#define __is_ioaddr(a) mcpcia_is_ioaddr((unsigned long)(a)) - -#define __raw_readl(a) __readl(a) -#define __raw_readq(a) __readq(a) -#define __raw_writel(v,a) __writel((v),(a)) -#define __raw_writeq(v,a) __writeq((v),(a)) +#undef vip +#undef vuip -#endif /* __WANT_IO_DEF */ +#undef __IO_PREFIX +#define __IO_PREFIX mcpcia +#define mcpcia_trivial_rw_bw 2 +#define mcpcia_trivial_rw_lq 1 +#define mcpcia_trivial_io_bw 0 +#define mcpcia_trivial_io_lq 0 +#define mcpcia_trivial_iounmap 1 +#include #ifdef __IO_EXTERN_INLINE #undef __EXTERN_INLINE diff -Nru a/include/asm-alpha/core_polaris.h b/include/asm-alpha/core_polaris.h --- a/include/asm-alpha/core_polaris.h 2004-09-26 10:25:55 -07:00 +++ b/include/asm-alpha/core_polaris.h 2004-09-26 10:25:55 -07:00 @@ -63,49 +63,6 @@ * However, we will support only the BWX form. */ -#define vucp volatile unsigned char * -#define vusp volatile unsigned short * -#define vuip volatile unsigned int * -#define vulp volatile unsigned long * - -__EXTERN_INLINE u8 polaris_inb(unsigned long addr) -{ - /* ??? I wish I could get rid of this. But there's no ioremap - equivalent for I/O space. PCI I/O can be forced into the - POLARIS I/O region, but that doesn't take care of legacy - ISA crap. */ - - return __kernel_ldbu(*(vucp)(addr + POLARIS_DENSE_IO_BASE)); -} - -__EXTERN_INLINE void polaris_outb(u8 b, unsigned long addr) -{ - __kernel_stb(b, *(vucp)(addr + POLARIS_DENSE_IO_BASE)); - mb(); -} - -__EXTERN_INLINE u16 polaris_inw(unsigned long addr) -{ - return __kernel_ldwu(*(vusp)(addr + POLARIS_DENSE_IO_BASE)); -} - -__EXTERN_INLINE void polaris_outw(u16 b, unsigned long addr) -{ - __kernel_stw(b, *(vusp)(addr + POLARIS_DENSE_IO_BASE)); - mb(); -} - -__EXTERN_INLINE u32 polaris_inl(unsigned long addr) -{ - return *(vuip)(addr + POLARIS_DENSE_IO_BASE); -} - -__EXTERN_INLINE void polaris_outl(u32 b, unsigned long addr) -{ - *(vuip)(addr + POLARIS_DENSE_IO_BASE) = b; - mb(); -} - /* * Memory functions. Polaris allows all accesses (byte/word * as well as long/quad) to be done through dense space. @@ -113,56 +70,15 @@ * We will only support DENSE access via BWX insns. */ -__EXTERN_INLINE u8 polaris_readb(unsigned long addr) -{ - return __kernel_ldbu(*(vucp)addr); -} - -__EXTERN_INLINE u16 polaris_readw(unsigned long addr) +__EXTERN_INLINE void __iomem *polaris_ioportmap(unsigned long addr) { - return __kernel_ldwu(*(vusp)addr); + return (void __iomem *)(addr + POLARIS_DENSE_IO_BASE); } -__EXTERN_INLINE u32 polaris_readl(unsigned long addr) +__EXTERN_INLINE void __iomem *polaris_ioremap(unsigned long addr, + unsigned long size) { - return (*(vuip)addr) & 0xffffffff; -} - -__EXTERN_INLINE u64 polaris_readq(unsigned long addr) -{ - return *(vulp)addr; -} - -__EXTERN_INLINE void polaris_writeb(u8 b, unsigned long addr) -{ - __kernel_stb(b, *(vucp)addr); -} - -__EXTERN_INLINE void polaris_writew(u16 b, unsigned long addr) -{ - __kernel_stw(b, *(vusp)addr); -} - -__EXTERN_INLINE void polaris_writel(u32 b, unsigned long addr) -{ - *(vuip)addr = b; -} - -__EXTERN_INLINE void polaris_writeq(u64 b, unsigned long addr) -{ - *(vulp)addr = b; -} - -__EXTERN_INLINE unsigned long polaris_ioremap(unsigned long addr, - unsigned long size - __attribute__((unused))) -{ - return addr + POLARIS_DENSE_MEM_BASE; -} - -__EXTERN_INLINE void polaris_iounmap(unsigned long addr) -{ - return; + return (void __iomem *)(addr + POLARIS_DENSE_MEM_BASE); } __EXTERN_INLINE int polaris_is_ioaddr(unsigned long addr) @@ -170,47 +86,19 @@ return addr >= POLARIS_SPARSE_MEM_BASE; } -#undef vucp -#undef vusp -#undef vuip -#undef vulp - -#ifdef __WANT_IO_DEF - -#define __inb(p) polaris_inb((unsigned long)(p)) -#define __inw(p) polaris_inw((unsigned long)(p)) -#define __inl(p) polaris_inl((unsigned long)(p)) -#define __outb(x,p) polaris_outb((x),(unsigned long)(p)) -#define __outw(x,p) polaris_outw((x),(unsigned long)(p)) -#define __outl(x,p) polaris_outl((x),(unsigned long)(p)) -#define __readb(a) polaris_readb((unsigned long)(a)) -#define __readw(a) polaris_readw((unsigned long)(a)) -#define __readl(a) polaris_readl((unsigned long)(a)) -#define __readq(a) polaris_readq((unsigned long)(a)) -#define __writeb(x,a) polaris_writeb((x),(unsigned long)(a)) -#define __writew(x,a) polaris_writew((x),(unsigned long)(a)) -#define __writel(x,a) polaris_writel((x),(unsigned long)(a)) -#define __writeq(x,a) polaris_writeq((x),(unsigned long)(a)) -#define __ioremap(a,s) polaris_ioremap((unsigned long)(a),(s)) -#define __iounmap(a) polaris_iounmap((unsigned long)(a)) -#define __is_ioaddr(a) polaris_is_ioaddr((unsigned long)(a)) - -#define inb(p) __inb(p) -#define inw(p) __inw(p) -#define inl(p) __inl(p) -#define outb(x,p) __outb((x),(p)) -#define outw(x,p) __outw((x),(p)) -#define outl(x,p) __outl((x),(p)) -#define __raw_readb(a) __readb(a) -#define __raw_readw(a) __readw(a) -#define __raw_readl(a) __readl(a) -#define __raw_readq(a) __readq(a) -#define __raw_writeb(v,a) __writeb((v),(a)) -#define __raw_writew(v,a) __writew((v),(a)) -#define __raw_writel(v,a) __writel((v),(a)) -#define __raw_writeq(v,a) __writeq((v),(a)) +__EXTERN_INLINE int polaris_is_mmio(const volatile void __iomem *addr) +{ + return (unsigned long)addr < POLARIS_SPARSE_IO_BASE; +} -#endif /* __WANT_IO_DEF */ +#undef __IO_PREFIX +#define __IO_PREFIX polaris +#define polaris_trivial_rw_bw 1 +#define polaris_trivial_rw_lq 1 +#define polaris_trivial_io_bw 1 +#define polaris_trivial_io_lq 1 +#define polaris_trivial_iounmap 1 +#include #ifdef __IO_EXTERN_INLINE #undef __EXTERN_INLINE diff -Nru a/include/asm-alpha/core_t2.h b/include/asm-alpha/core_t2.h --- a/include/asm-alpha/core_t2.h 2004-09-26 10:25:56 -07:00 +++ b/include/asm-alpha/core_t2.h 2004-09-26 10:25:56 -07:00 @@ -199,8 +199,8 @@ struct el_t2_logout_header { unsigned int elfl_size; /* size in bytes of logout area. */ - int elfl_sbz1:31; /* Should be zero. */ - char elfl_retry:1; /* Retry flag. */ + unsigned int elfl_sbz1:31; /* Should be zero. */ + unsigned int elfl_retry:1; /* Retry flag. */ unsigned int elfl_procoffset; /* Processor-specific offset. */ unsigned int elfl_sysoffset; /* Offset of system-specific. */ unsigned int elfl_error_type; /* PAL error type code. */ @@ -357,13 +357,13 @@ #define vip volatile int * #define vuip volatile unsigned int * -__EXTERN_INLINE u8 t2_inb(unsigned long addr) +static inline u8 t2_inb(unsigned long addr) { long result = *(vip) ((addr << 5) + T2_IO + 0x00); return __kernel_extbl(result, addr & 3); } -__EXTERN_INLINE void t2_outb(u8 b, unsigned long addr) +static inline void t2_outb(u8 b, unsigned long addr) { unsigned long w; @@ -372,13 +372,13 @@ mb(); } -__EXTERN_INLINE u16 t2_inw(unsigned long addr) +static inline u16 t2_inw(unsigned long addr) { long result = *(vip) ((addr << 5) + T2_IO + 0x08); return __kernel_extwl(result, addr & 3); } -__EXTERN_INLINE void t2_outw(u16 b, unsigned long addr) +static inline void t2_outw(u16 b, unsigned long addr) { unsigned long w; @@ -387,12 +387,12 @@ mb(); } -__EXTERN_INLINE u32 t2_inl(unsigned long addr) +static inline u32 t2_inl(unsigned long addr) { return *(vuip) ((addr << 5) + T2_IO + 0x18); } -__EXTERN_INLINE void t2_outl(u32 b, unsigned long addr) +static inline void t2_outl(u32 b, unsigned long addr) { *(vuip) ((addr << 5) + T2_IO + 0x18) = b; mb(); @@ -438,8 +438,9 @@ static spinlock_t t2_hae_lock = SPIN_LOCK_UNLOCKED; -__EXTERN_INLINE u8 t2_readb(unsigned long addr) +__EXTERN_INLINE u8 t2_readb(const volatile void __iomem *xaddr) { + unsigned long addr = (unsigned long) xaddr; unsigned long result, msb; unsigned long flags; spin_lock_irqsave(&t2_hae_lock, flags); @@ -451,8 +452,9 @@ return __kernel_extbl(result, addr & 3); } -__EXTERN_INLINE u16 t2_readw(unsigned long addr) +__EXTERN_INLINE u16 t2_readw(const volatile void __iomem *xaddr) { + unsigned long addr = (unsigned long) xaddr; unsigned long result, msb; unsigned long flags; spin_lock_irqsave(&t2_hae_lock, flags); @@ -468,8 +470,9 @@ * On SABLE with T2, we must use SPARSE memory even for 32-bit access, * because we cannot access all of DENSE without changing its HAE. */ -__EXTERN_INLINE u32 t2_readl(unsigned long addr) +__EXTERN_INLINE u32 t2_readl(const volatile void __iomem *xaddr) { + unsigned long addr = (unsigned long) xaddr; unsigned long result, msb; unsigned long flags; spin_lock_irqsave(&t2_hae_lock, flags); @@ -481,8 +484,9 @@ return result & 0xffffffffUL; } -__EXTERN_INLINE u64 t2_readq(unsigned long addr) +__EXTERN_INLINE u64 t2_readq(const volatile void __iomem *xaddr) { + unsigned long addr = (unsigned long) xaddr; unsigned long r0, r1, work, msb; unsigned long flags; spin_lock_irqsave(&t2_hae_lock, flags); @@ -496,8 +500,9 @@ return r1 << 32 | r0; } -__EXTERN_INLINE void t2_writeb(u8 b, unsigned long addr) +__EXTERN_INLINE void t2_writeb(u8 b, volatile void __iomem *xaddr) { + unsigned long addr = (unsigned long) xaddr; unsigned long msb, w; unsigned long flags; spin_lock_irqsave(&t2_hae_lock, flags); @@ -509,8 +514,9 @@ spin_unlock_irqrestore(&t2_hae_lock, flags); } -__EXTERN_INLINE void t2_writew(u16 b, unsigned long addr) +__EXTERN_INLINE void t2_writew(u16 b, volatile void __iomem *xaddr) { + unsigned long addr = (unsigned long) xaddr; unsigned long msb, w; unsigned long flags; spin_lock_irqsave(&t2_hae_lock, flags); @@ -526,8 +532,9 @@ * On SABLE with T2, we must use SPARSE memory even for 32-bit access, * because we cannot access all of DENSE without changing its HAE. */ -__EXTERN_INLINE void t2_writel(u32 b, unsigned long addr) +__EXTERN_INLINE void t2_writel(u32 b, volatile void __iomem *xaddr) { + unsigned long addr = (unsigned long) xaddr; unsigned long msb; unsigned long flags; spin_lock_irqsave(&t2_hae_lock, flags); @@ -538,8 +545,9 @@ spin_unlock_irqrestore(&t2_hae_lock, flags); } -__EXTERN_INLINE void t2_writeq(u64 b, unsigned long addr) +__EXTERN_INLINE void t2_writeq(u64 b, volatile void __iomem *xaddr) { + unsigned long addr = (unsigned long) xaddr; unsigned long msb, work; unsigned long flags; spin_lock_irqsave(&t2_hae_lock, flags); @@ -552,16 +560,15 @@ spin_unlock_irqrestore(&t2_hae_lock, flags); } -__EXTERN_INLINE unsigned long t2_ioremap(unsigned long addr, - unsigned long size - __attribute__((unused))) +__EXTERN_INLINE void __iomem *t2_ioportmap(unsigned long addr) { - return addr; + return (void __iomem *)(addr + T2_IO); } -__EXTERN_INLINE void t2_iounmap(unsigned long addr) +__EXTERN_INLINE void __iomem *t2_ioremap(unsigned long addr, + unsigned long size) { - return; + return (void __iomem *)(addr + T2_DENSE_MEM); } __EXTERN_INLINE int t2_is_ioaddr(unsigned long addr) @@ -569,30 +576,47 @@ return (long)addr >= 0; } -#undef vip -#undef vuip +__EXTERN_INLINE int t2_is_mmio(const volatile void __iomem *addr) +{ + return (unsigned long)addr >= T2_DENSE_MEM; +} -#ifdef __WANT_IO_DEF +/* New-style ioread interface. The mmio routines are so ugly for T2 that + it doesn't make sense to merge the pio and mmio routines. */ -#define __inb(p) t2_inb((unsigned long)(p)) -#define __inw(p) t2_inw((unsigned long)(p)) -#define __inl(p) t2_inl((unsigned long)(p)) -#define __outb(x,p) t2_outb((x),(unsigned long)(p)) -#define __outw(x,p) t2_outw((x),(unsigned long)(p)) -#define __outl(x,p) t2_outl((x),(unsigned long)(p)) -#define __readb(a) t2_readb((unsigned long)(a)) -#define __readw(a) t2_readw((unsigned long)(a)) -#define __readl(a) t2_readl((unsigned long)(a)) -#define __readq(a) t2_readq((unsigned long)(a)) -#define __writeb(x,a) t2_writeb((x),(unsigned long)(a)) -#define __writew(x,a) t2_writew((x),(unsigned long)(a)) -#define __writel(x,a) t2_writel((x),(unsigned long)(a)) -#define __writeq(x,a) t2_writeq((x),(unsigned long)(a)) -#define __ioremap(a,s) t2_ioremap((unsigned long)(a),(s)) -#define __iounmap(a) t2_iounmap((unsigned long)(a)) -#define __is_ioaddr(a) t2_is_ioaddr((unsigned long)(a)) +#define IOPORT(OS, NS) \ +__EXTERN_INLINE unsigned int t2_ioread##NS(void __iomem *xaddr) \ +{ \ + if (t2_is_mmio(xaddr)) \ + return t2_read##OS(xaddr - T2_DENSE_MEM); \ + else \ + return t2_in##OS((unsigned long)xaddr - T2_IO); \ +} \ +__EXTERN_INLINE void t2_iowrite##NS(u##NS b, void __iomem *xaddr) \ +{ \ + if (t2_is_mmio(xaddr)) \ + t2_write##OS(b, xaddr - T2_DENSE_MEM); \ + else \ + t2_out##OS(b, (unsigned long)xaddr - T2_IO); \ +} + +IOPORT(b, 8) +IOPORT(w, 16) +IOPORT(l, 32) + +#undef IOPORT + +#undef vip +#undef vuip -#endif /* __WANT_IO_DEF */ +#undef __IO_PREFIX +#define __IO_PREFIX t2 +#define t2_trivial_rw_bw 0 +#define t2_trivial_rw_lq 0 +#define t2_trivial_io_bw 0 +#define t2_trivial_io_lq 0 +#define t2_trivial_iounmap 1 +#include #ifdef __IO_EXTERN_INLINE #undef __EXTERN_INLINE diff -Nru a/include/asm-alpha/core_titan.h b/include/asm-alpha/core_titan.h --- a/include/asm-alpha/core_titan.h 2004-09-26 10:25:57 -07:00 +++ b/include/asm-alpha/core_titan.h 2004-09-26 10:25:57 -07:00 @@ -377,149 +377,33 @@ * can only use linear accesses to get at PCI/AGP memory and I/O spaces. */ -#define vucp volatile unsigned char * -#define vusp volatile unsigned short * -#define vuip volatile unsigned int * -#define vulp volatile unsigned long * - -__EXTERN_INLINE u8 titan_inb(unsigned long addr) -{ - /* ??? I wish I could get rid of this. But there's no ioremap - equivalent for I/O space. PCI I/O can be forced into the - correct hose's I/O region, but that doesn't take care of - legacy ISA crap. */ - - addr += TITAN_IO_BIAS; - return __kernel_ldbu(*(vucp)addr); -} - -__EXTERN_INLINE void titan_outb(u8 b, unsigned long addr) -{ - addr += TITAN_IO_BIAS; - __kernel_stb(b, *(vucp)addr); - mb(); -} - -__EXTERN_INLINE u16 titan_inw(unsigned long addr) -{ - addr += TITAN_IO_BIAS; - return __kernel_ldwu(*(vusp)addr); -} - -__EXTERN_INLINE void titan_outw(u16 b, unsigned long addr) -{ - addr += TITAN_IO_BIAS; - __kernel_stw(b, *(vusp)addr); - mb(); -} - -__EXTERN_INLINE u32 titan_inl(unsigned long addr) -{ - addr += TITAN_IO_BIAS; - return *(vuip)addr; -} - -__EXTERN_INLINE void titan_outl(u32 b, unsigned long addr) -{ - addr += TITAN_IO_BIAS; - *(vuip)addr = b; - mb(); -} - /* * Memory functions. all accesses are done through linear space. */ -extern unsigned long titan_ioremap(unsigned long addr, unsigned long size); -extern void titan_iounmap(unsigned long addr); - -__EXTERN_INLINE int titan_is_ioaddr(unsigned long addr) +__EXTERN_INLINE void __iomem *titan_ioportmap(unsigned long addr) { - return addr >= TITAN_BASE; + return (void __iomem *)(addr + TITAN_IO_BIAS); } -__EXTERN_INLINE u8 titan_readb(unsigned long addr) -{ - return __kernel_ldbu(*(vucp)addr); -} +extern void __iomem *titan_ioremap(unsigned long addr, unsigned long size); +extern void titan_iounmap(volatile void __iomem *addr); -__EXTERN_INLINE u16 titan_readw(unsigned long addr) -{ - return __kernel_ldwu(*(vusp)addr); -} - -__EXTERN_INLINE u32 titan_readl(unsigned long addr) -{ - return (*(vuip)addr) & 0xffffffff; -} - -__EXTERN_INLINE u64 titan_readq(unsigned long addr) -{ - return *(vulp)addr; -} - -__EXTERN_INLINE void titan_writeb(u8 b, unsigned long addr) -{ - __kernel_stb(b, *(vucp)addr); -} - -__EXTERN_INLINE void titan_writew(u16 b, unsigned long addr) -{ - __kernel_stw(b, *(vusp)addr); -} - -__EXTERN_INLINE void titan_writel(u32 b, unsigned long addr) -{ - *(vuip)addr = b; -} - -__EXTERN_INLINE void titan_writeq(u64 b, unsigned long addr) +__EXTERN_INLINE int titan_is_ioaddr(unsigned long addr) { - *(vulp)addr = b; + return addr >= TITAN_BASE; } -#undef vucp -#undef vusp -#undef vuip -#undef vulp - -#ifdef __WANT_IO_DEF - -#define __inb(p) titan_inb((unsigned long)(p)) -#define __inw(p) titan_inw((unsigned long)(p)) -#define __inl(p) titan_inl((unsigned long)(p)) -#define __outb(x,p) titan_outb((x),(unsigned long)(p)) -#define __outw(x,p) titan_outw((x),(unsigned long)(p)) -#define __outl(x,p) titan_outl((x),(unsigned long)(p)) -#define __readb(a) titan_readb((unsigned long)(a)) -#define __readw(a) titan_readw((unsigned long)(a)) -#define __readl(a) titan_readl((unsigned long)(a)) -#define __readq(a) titan_readq((unsigned long)(a)) -#define __writeb(x,a) titan_writeb((x),(unsigned long)(a)) -#define __writew(x,a) titan_writew((x),(unsigned long)(a)) -#define __writel(x,a) titan_writel((x),(unsigned long)(a)) -#define __writeq(x,a) titan_writeq((x),(unsigned long)(a)) -#define __ioremap(a,s) titan_ioremap((unsigned long)(a),(s)) -#define __iounmap(a) titan_iounmap((unsigned long)(a)) -#define __is_ioaddr(a) titan_is_ioaddr((unsigned long)(a)) - -#define inb(port) __inb((port)) -#define inw(port) __inw((port)) -#define inl(port) __inl((port)) -#define outb(v, port) __outb((v),(port)) -#define outw(v, port) __outw((v),(port)) -#define outl(v, port) __outl((v),(port)) - -#define __raw_readb(a) __readb((unsigned long)(a)) -#define __raw_readw(a) __readw((unsigned long)(a)) -#define __raw_readl(a) __readl((unsigned long)(a)) -#define __raw_readq(a) __readq((unsigned long)(a)) -#define __raw_writeb(v,a) __writeb((v),(unsigned long)(a)) -#define __raw_writew(v,a) __writew((v),(unsigned long)(a)) -#define __raw_writel(v,a) __writel((v),(unsigned long)(a)) -#define __raw_writeq(v,a) __writeq((v),(unsigned long)(a)) +extern int titan_is_mmio(const volatile void __iomem *addr); -#endif /* __WANT_IO_DEF */ +#undef __IO_PREFIX +#define __IO_PREFIX titan +#define titan_trivial_rw_bw 1 +#define titan_trivial_rw_lq 1 +#define titan_trivial_io_bw 1 +#define titan_trivial_io_lq 1 +#define titan_trivial_iounmap 0 +#include #ifdef __IO_EXTERN_INLINE #undef __EXTERN_INLINE diff -Nru a/include/asm-alpha/core_tsunami.h b/include/asm-alpha/core_tsunami.h --- a/include/asm-alpha/core_tsunami.h 2004-09-26 10:25:57 -07:00 +++ b/include/asm-alpha/core_tsunami.h 2004-09-26 10:25:57 -07:00 @@ -299,69 +299,19 @@ * can only use linear accesses to get at PCI memory and I/O spaces. */ -#define vucp volatile unsigned char * -#define vusp volatile unsigned short * -#define vuip volatile unsigned int * -#define vulp volatile unsigned long * - -__EXTERN_INLINE u8 tsunami_inb(unsigned long addr) -{ - /* ??? I wish I could get rid of this. But there's no ioremap - equivalent for I/O space. PCI I/O can be forced into the - correct hose's I/O region, but that doesn't take care of - legacy ISA crap. */ - - addr += TSUNAMI_IO_BIAS; - return __kernel_ldbu(*(vucp)addr); -} - -__EXTERN_INLINE void tsunami_outb(u8 b, unsigned long addr) -{ - addr += TSUNAMI_IO_BIAS; - __kernel_stb(b, *(vucp)addr); - mb(); -} - -__EXTERN_INLINE u16 tsunami_inw(unsigned long addr) -{ - addr += TSUNAMI_IO_BIAS; - return __kernel_ldwu(*(vusp)addr); -} - -__EXTERN_INLINE void tsunami_outw(u16 b, unsigned long addr) -{ - addr += TSUNAMI_IO_BIAS; - __kernel_stw(b, *(vusp)addr); - mb(); -} - -__EXTERN_INLINE u32 tsunami_inl(unsigned long addr) -{ - addr += TSUNAMI_IO_BIAS; - return *(vuip)addr; -} - -__EXTERN_INLINE void tsunami_outl(u32 b, unsigned long addr) -{ - addr += TSUNAMI_IO_BIAS; - *(vuip)addr = b; - mb(); -} - /* * Memory functions. all accesses are done through linear space. */ -__EXTERN_INLINE unsigned long tsunami_ioremap(unsigned long addr, - unsigned long size - __attribute__((unused))) +__EXTERN_INLINE void __iomem *tsunami_ioportmap(unsigned long addr) { - return addr + TSUNAMI_MEM_BIAS; + return (void __iomem *)(addr + TSUNAMI_IO_BIAS); } -__EXTERN_INLINE void tsunami_iounmap(unsigned long addr) +__EXTERN_INLINE void __iomem *tsunami_ioremap(unsigned long addr, + unsigned long size) { - return; + return (void __iomem *)(addr + TSUNAMI_MEM_BIAS); } __EXTERN_INLINE int tsunami_is_ioaddr(unsigned long addr) @@ -369,87 +319,20 @@ return addr >= TSUNAMI_BASE; } -__EXTERN_INLINE u8 tsunami_readb(unsigned long addr) -{ - return __kernel_ldbu(*(vucp)addr); -} - -__EXTERN_INLINE u16 tsunami_readw(unsigned long addr) +__EXTERN_INLINE int tsunami_is_mmio(const volatile void __iomem *xaddr) { - return __kernel_ldwu(*(vusp)addr); + unsigned long addr = (unsigned long) xaddr; + return (addr & 0x100000000UL) == 0; } -__EXTERN_INLINE u32 tsunami_readl(unsigned long addr) -{ - return *(vuip)addr; -} - -__EXTERN_INLINE u64 tsunami_readq(unsigned long addr) -{ - return *(vulp)addr; -} - -__EXTERN_INLINE void tsunami_writeb(u8 b, unsigned long addr) -{ - __kernel_stb(b, *(vucp)addr); -} - -__EXTERN_INLINE void tsunami_writew(u16 b, unsigned long addr) -{ - __kernel_stw(b, *(vusp)addr); -} - -__EXTERN_INLINE void tsunami_writel(u32 b, unsigned long addr) -{ - *(vuip)addr = b; -} - -__EXTERN_INLINE void tsunami_writeq(u64 b, unsigned long addr) -{ - *(vulp)addr = b; -} - -#undef vucp -#undef vusp -#undef vuip -#undef vulp - -#ifdef __WANT_IO_DEF - -#define __inb(p) tsunami_inb((unsigned long)(p)) -#define __inw(p) tsunami_inw((unsigned long)(p)) -#define __inl(p) tsunami_inl((unsigned long)(p)) -#define __outb(x,p) tsunami_outb((x),(unsigned long)(p)) -#define __outw(x,p) tsunami_outw((x),(unsigned long)(p)) -#define __outl(x,p) tsunami_outl((x),(unsigned long)(p)) -#define __readb(a) tsunami_readb((unsigned long)(a)) -#define __readw(a) tsunami_readw((unsigned long)(a)) -#define __readl(a) tsunami_readl((unsigned long)(a)) -#define __readq(a) tsunami_readq((unsigned long)(a)) -#define __writeb(x,a) tsunami_writeb((x),(unsigned long)(a)) -#define __writew(x,a) tsunami_writew((x),(unsigned long)(a)) -#define __writel(x,a) tsunami_writel((x),(unsigned long)(a)) -#define __writeq(x,a) tsunami_writeq((x),(unsigned long)(a)) -#define __ioremap(a,s) tsunami_ioremap((unsigned long)(a),(s)) -#define __iounmap(a) tsunami_iounmap((unsigned long)(a)) -#define __is_ioaddr(a) tsunami_is_ioaddr((unsigned long)(a)) - -#define inb(p) __inb(p) -#define inw(p) __inw(p) -#define inl(p) __inl(p) -#define outb(x,p) __outb((x),(p)) -#define outw(x,p) __outw((x),(p)) -#define outl(x,p) __outl((x),(p)) -#define __raw_readb(a) __readb(a) -#define __raw_readw(a) __readw(a) -#define __raw_readl(a) __readl(a) -#define __raw_readq(a) __readq(a) -#define __raw_writeb(v,a) __writeb((v),(a)) -#define __raw_writew(v,a) __writew((v),(a)) -#define __raw_writel(v,a) __writel((v),(a)) -#define __raw_writeq(v,a) __writeq((v),(a)) - -#endif /* __WANT_IO_DEF */ +#undef __IO_PREFIX +#define __IO_PREFIX tsunami +#define tsunami_trivial_rw_bw 1 +#define tsunami_trivial_rw_lq 1 +#define tsunami_trivial_io_bw 1 +#define tsunami_trivial_io_lq 1 +#define tsunami_trivial_iounmap 1 +#include #ifdef __IO_EXTERN_INLINE #undef __EXTERN_INLINE diff -Nru a/include/asm-alpha/core_wildfire.h b/include/asm-alpha/core_wildfire.h --- a/include/asm-alpha/core_wildfire.h 2004-09-26 10:25:55 -07:00 +++ b/include/asm-alpha/core_wildfire.h 2004-09-26 10:25:55 -07:00 @@ -273,69 +273,19 @@ #define __IO_EXTERN_INLINE #endif -#define vucp volatile unsigned char * -#define vusp volatile unsigned short * -#define vuip volatile unsigned int * -#define vulp volatile unsigned long * - -__EXTERN_INLINE u8 wildfire_inb(unsigned long addr) -{ - /* ??? I wish I could get rid of this. But there's no ioremap - equivalent for I/O space. PCI I/O can be forced into the - correct hose's I/O region, but that doesn't take care of - legacy ISA crap. */ - - addr += WILDFIRE_IO_BIAS; - return __kernel_ldbu(*(vucp)addr); -} - -__EXTERN_INLINE void wildfire_outb(u8 b, unsigned long addr) -{ - addr += WILDFIRE_IO_BIAS; - __kernel_stb(b, *(vucp)addr); - mb(); -} - -__EXTERN_INLINE u16 wildfire_inw(unsigned long addr) -{ - addr += WILDFIRE_IO_BIAS; - return __kernel_ldwu(*(vusp)addr); -} - -__EXTERN_INLINE void wildfire_outw(u16 b, unsigned long addr) -{ - addr += WILDFIRE_IO_BIAS; - __kernel_stw(b, *(vusp)addr); - mb(); -} - -__EXTERN_INLINE u32 wildfire_inl(unsigned long addr) -{ - addr += WILDFIRE_IO_BIAS; - return *(vuip)addr; -} - -__EXTERN_INLINE void wildfire_outl(u32 b, unsigned long addr) -{ - addr += WILDFIRE_IO_BIAS; - *(vuip)addr = b; - mb(); -} - /* * Memory functions. all accesses are done through linear space. */ -__EXTERN_INLINE unsigned long wildfire_ioremap(unsigned long addr, - unsigned long size - __attribute__((unused))) +__EXTERN_INLINE void __iomem *wildfire_ioportmap(unsigned long addr) { - return addr + WILDFIRE_MEM_BIAS; + return (void __iomem *)(addr + WILDFIRE_IO_BIAS); } -__EXTERN_INLINE void wildfire_iounmap(unsigned long addr) +__EXTERN_INLINE void __iomem *wildfire_ioremap(unsigned long addr, + unsigned long size) { - return; + return (void __iomem *)(addr + WILDFIRE_MEM_BIAS); } __EXTERN_INLINE int wildfire_is_ioaddr(unsigned long addr) @@ -343,87 +293,20 @@ return addr >= WILDFIRE_BASE; } -__EXTERN_INLINE u8 wildfire_readb(unsigned long addr) -{ - return __kernel_ldbu(*(vucp)addr); -} - -__EXTERN_INLINE u16 wildfire_readw(unsigned long addr) +__EXTERN_INLINE int wildfire_is_mmio(const volatile void __iomem *xaddr) { - return __kernel_ldwu(*(vusp)addr); + unsigned long addr = (unsigned long)addr; + return (addr & 0x100000000UL) == 0; } -__EXTERN_INLINE u32 wildfire_readl(unsigned long addr) -{ - return (*(vuip)addr) & 0xffffffff; -} - -__EXTERN_INLINE u64 wildfire_readq(unsigned long addr) -{ - return *(vulp)addr; -} - -__EXTERN_INLINE void wildfire_writeb(u8 b, unsigned long addr) -{ - __kernel_stb(b, *(vucp)addr); -} - -__EXTERN_INLINE void wildfire_writew(u16 b, unsigned long addr) -{ - __kernel_stw(b, *(vusp)addr); -} - -__EXTERN_INLINE void wildfire_writel(u32 b, unsigned long addr) -{ - *(vuip)addr = b; -} - -__EXTERN_INLINE void wildfire_writeq(u64 b, unsigned long addr) -{ - *(vulp)addr = b; -} - -#undef vucp -#undef vusp -#undef vuip -#undef vulp - -#ifdef __WANT_IO_DEF - -#define __inb(p) wildfire_inb((unsigned long)(p)) -#define __inw(p) wildfire_inw((unsigned long)(p)) -#define __inl(p) wildfire_inl((unsigned long)(p)) -#define __outb(x,p) wildfire_outb((x),(unsigned long)(p)) -#define __outw(x,p) wildfire_outw((x),(unsigned long)(p)) -#define __outl(x,p) wildfire_outl((x),(unsigned long)(p)) -#define __readb(a) wildfire_readb((unsigned long)(a)) -#define __readw(a) wildfire_readw((unsigned long)(a)) -#define __readl(a) wildfire_readl((unsigned long)(a)) -#define __readq(a) wildfire_readq((unsigned long)(a)) -#define __writeb(x,a) wildfire_writeb((x),(unsigned long)(a)) -#define __writew(x,a) wildfire_writew((x),(unsigned long)(a)) -#define __writel(x,a) wildfire_writel((x),(unsigned long)(a)) -#define __writeq(x,a) wildfire_writeq((x),(unsigned long)(a)) -#define __ioremap(a,s) wildfire_ioremap((unsigned long)(a),(s)) -#define __iounmap(a) wildfire_iounmap((unsigned long)(a)) -#define __is_ioaddr(a) wildfire_is_ioaddr((unsigned long)(a)) - -#define inb(p) __inb(p) -#define inw(p) __inw(p) -#define inl(p) __inl(p) -#define outb(x,p) __outb((x),(p)) -#define outw(x,p) __outw((x),(p)) -#define outl(x,p) __outl((x),(p)) -#define __raw_readb(a) __readb(a) -#define __raw_readw(a) __readw(a) -#define __raw_readl(a) __readl(a) -#define __raw_readq(a) __readq(a) -#define __raw_writeb(v,a) __writeb((v),(a)) -#define __raw_writew(v,a) __writew((v),(a)) -#define __raw_writel(v,a) __writel((v),(a)) -#define __raw_writeq(v,a) __writeq((v),(a)) - -#endif /* __WANT_IO_DEF */ +#undef __IO_PREFIX +#define __IO_PREFIX wildfire +#define wildfire_trivial_rw_bw 1 +#define wildfire_trivial_rw_lq 1 +#define wildfire_trivial_io_bw 1 +#define wildfire_trivial_io_lq 1 +#define wildfire_trivial_iounmap 1 +#include #ifdef __IO_EXTERN_INLINE #undef __EXTERN_INLINE diff -Nru a/include/asm-alpha/io.h b/include/asm-alpha/io.h --- a/include/asm-alpha/io.h 2004-09-26 10:25:57 -07:00 +++ b/include/asm-alpha/io.h 2004-09-26 10:25:57 -07:00 @@ -1,6 +1,20 @@ #ifndef __ALPHA_IO_H #define __ALPHA_IO_H +#ifdef __KERNEL__ + +#include +#include +#include +#include +#include +#include +#include + +/* The generic header contains only prototypes. Including it ensures that + the implementation we have here matches that interface. */ +#include + /* We don't use IO slowdowns on the Alpha, but.. */ #define __SLOW_DOWN_IO do { } while (0) #define SLOW_DOWN_IO do { } while (0) @@ -14,14 +28,6 @@ #define IDENT_ADDR 0xfffffc0000000000UL #endif -#ifdef __KERNEL__ -#include -#include -#include -#include -#include -#include - /* * We try to avoid hae updates (thus the cache), but when we * do need to update the hae, we need to do it atomically, so @@ -88,6 +94,9 @@ /* This depends on working iommu. */ #define BIO_VMERGE_BOUNDARY (alpha_mv.mv_pci_tbi ? PAGE_SIZE : 0) +/* Maximum PIO space address supported? */ +#define IO_SPACE_LIMIT 0xffff + /* * Change addresses as seen by the kernel (virtual) to addresses as * seen by a device (bus), and vice versa. @@ -118,67 +127,81 @@ return (long)address <= 0 ? NULL : virt; } -#else /* !__KERNEL__ */ - -/* - * Define actual functions in private name-space so it's easier to - * accommodate things like XFree or svgalib that like to define their - * own versions of inb etc. - */ -extern void __sethae (unsigned long addr); /* syscall */ -extern void _sethae (unsigned long addr); /* cached version */ - -#endif /* !__KERNEL__ */ - /* * There are different chipsets to interface the Alpha CPUs to the world. */ -#ifdef __KERNEL__ +#define IO_CONCAT(a,b) _IO_CONCAT(a,b) +#define _IO_CONCAT(a,b) a ## _ ## b + #ifdef CONFIG_ALPHA_GENERIC /* In a generic kernel, we always go through the machine vector. */ -# define __inb(p) alpha_mv.mv_inb((unsigned long)(p)) -# define __inw(p) alpha_mv.mv_inw((unsigned long)(p)) -# define __inl(p) alpha_mv.mv_inl((unsigned long)(p)) -# define __outb(x,p) alpha_mv.mv_outb((x),(unsigned long)(p)) -# define __outw(x,p) alpha_mv.mv_outw((x),(unsigned long)(p)) -# define __outl(x,p) alpha_mv.mv_outl((x),(unsigned long)(p)) - -# define __readb(a) alpha_mv.mv_readb((unsigned long)(a)) -# define __readw(a) alpha_mv.mv_readw((unsigned long)(a)) -# define __readl(a) alpha_mv.mv_readl((unsigned long)(a)) -# define __readq(a) alpha_mv.mv_readq((unsigned long)(a)) -# define __writeb(v,a) alpha_mv.mv_writeb((v),(unsigned long)(a)) -# define __writew(v,a) alpha_mv.mv_writew((v),(unsigned long)(a)) -# define __writel(v,a) alpha_mv.mv_writel((v),(unsigned long)(a)) -# define __writeq(v,a) alpha_mv.mv_writeq((v),(unsigned long)(a)) - -# define __ioremap(a,s) alpha_mv.mv_ioremap((unsigned long)(a),(s)) -# define __iounmap(a) alpha_mv.mv_iounmap((unsigned long)(a)) -# define __is_ioaddr(a) alpha_mv.mv_is_ioaddr((unsigned long)(a)) - -# define inb __inb -# define inw __inw -# define inl __inl -# define outb __outb -# define outw __outw -# define outl __outl - -# define __raw_readb __readb -# define __raw_readw __readw -# define __raw_readl __readl -# define __raw_readq __readq -# define __raw_writeb __writeb -# define __raw_writew __writew -# define __raw_writel __writel -# define __raw_writeq __writeq +#define REMAP1(TYPE, NAME, QUAL) \ +static inline TYPE generic_##NAME(QUAL void __iomem *addr) \ +{ \ + return alpha_mv.mv_##NAME(addr); \ +} -#else +#define REMAP2(TYPE, NAME, QUAL) \ +static inline void generic_##NAME(TYPE b, QUAL void __iomem *addr) \ +{ \ + alpha_mv.mv_##NAME(b, addr); \ +} + +REMAP1(unsigned int, ioread8, /**/) +REMAP1(unsigned int, ioread16, /**/) +REMAP1(unsigned int, ioread32, /**/) +REMAP1(u8, readb, const volatile) +REMAP1(u16, readw, const volatile) +REMAP1(u32, readl, const volatile) +REMAP1(u64, readq, const volatile) + +REMAP2(u8, iowrite8, /**/) +REMAP2(u16, iowrite16, /**/) +REMAP2(u32, iowrite32, /**/) +REMAP2(u8, writeb, volatile) +REMAP2(u16, writew, volatile) +REMAP2(u32, writel, volatile) +REMAP2(u64, writeq, volatile) + +#undef REMAP1 +#undef REMAP2 + +static inline void __iomem *generic_ioportmap(unsigned long a) +{ + return alpha_mv.mv_ioportmap(a); +} + +static inline void __iomem *generic_ioremap(unsigned long a, unsigned long s) +{ + return alpha_mv.mv_ioremap(a, s); +} + +static inline void generic_iounmap(volatile void __iomem *a) +{ + return alpha_mv.mv_iounmap(a); +} + +static inline int generic_is_ioaddr(unsigned long a) +{ + return alpha_mv.mv_is_ioaddr(a); +} + +static inline int generic_is_mmio(const volatile void __iomem *a) +{ + return alpha_mv.mv_is_mmio(a); +} -/* Control how and what gets defined within the core logic headers. */ -#define __WANT_IO_DEF +#define __IO_PREFIX generic +#define generic_trivial_rw_bw 0 +#define generic_trivial_rw_lq 0 +#define generic_trivial_io_bw 0 +#define generic_trivial_io_lq 0 +#define generic_trivial_iounmap 0 + +#else #if defined(CONFIG_ALPHA_APECS) # include @@ -208,245 +231,281 @@ #error "What system is this?" #endif -#undef __WANT_IO_DEF - #endif /* GENERIC */ -#endif /* __KERNEL__ */ /* - * The convention used for inb/outb etc. is that names starting with - * two underscores are the inline versions, names starting with a - * single underscore are proper functions, and names starting with a - * letter are macros that map in some way to inline or proper function - * versions. Not all that pretty, but before you change it, be sure - * to convince yourself that it won't break anything (in particular - * module support). - */ -extern u8 _inb (unsigned long port); -extern u16 _inw (unsigned long port); -extern u32 _inl (unsigned long port); -extern void _outb (u8 b,unsigned long port); -extern void _outw (u16 w,unsigned long port); -extern void _outl (u32 l,unsigned long port); -extern u8 _readb(unsigned long addr); -extern u16 _readw(unsigned long addr); -extern u32 _readl(unsigned long addr); -extern u64 _readq(unsigned long addr); -extern void _writeb(u8 b, unsigned long addr); -extern void _writew(u16 b, unsigned long addr); -extern void _writel(u32 b, unsigned long addr); -extern void _writeq(u64 b, unsigned long addr); - -#ifdef __KERNEL__ -/* - * The platform header files may define some of these macros to use - * the inlined versions where appropriate. These macros may also be - * redefined by userlevel programs. + * We always have external versions of these routines. */ -#ifndef inb -# define inb(p) _inb(p) -#endif -#ifndef inw -# define inw(p) _inw(p) -#endif -#ifndef inl -# define inl(p) _inl(p) -#endif -#ifndef outb -# define outb(b,p) _outb((b),(p)) -#endif -#ifndef outw -# define outw(w,p) _outw((w),(p)) -#endif -#ifndef outl -# define outl(l,p) _outl((l),(p)) -#endif - -#ifndef inb_p -# define inb_p inb -#endif -#ifndef inw_p -# define inw_p inw -#endif -#ifndef inl_p -# define inl_p inl -#endif +extern u8 inb(unsigned long port); +extern u16 inw(unsigned long port); +extern u32 inl(unsigned long port); +extern void outb(u8 b, unsigned long port); +extern void outw(u16 b, unsigned long port); +extern void outl(u32 b, unsigned long port); + +extern u8 readb(const volatile void __iomem *addr); +extern u16 readw(const volatile void __iomem *addr); +extern u32 readl(const volatile void __iomem *addr); +extern u64 readq(const volatile void __iomem *addr); +extern void writeb(u8 b, volatile void __iomem *addr); +extern void writew(u16 b, volatile void __iomem *addr); +extern void writel(u32 b, volatile void __iomem *addr); +extern void writeq(u64 b, volatile void __iomem *addr); + +extern u8 __raw_readb(const volatile void __iomem *addr); +extern u16 __raw_readw(const volatile void __iomem *addr); +extern u32 __raw_readl(const volatile void __iomem *addr); +extern u64 __raw_readq(const volatile void __iomem *addr); +extern void __raw_writeb(u8 b, volatile void __iomem *addr); +extern void __raw_writew(u16 b, volatile void __iomem *addr); +extern void __raw_writel(u32 b, volatile void __iomem *addr); +extern void __raw_writeq(u64 b, volatile void __iomem *addr); + +/* + * Mapping from port numbers to __iomem space is pretty easy. + */ + +/* These two have to be extern inline because of the extern prototype from + . It is not legal to mix "extern" and "static" for + the same declaration. */ +extern inline void __iomem *ioport_map(unsigned long port, unsigned int size) +{ + return IO_CONCAT(__IO_PREFIX,ioportmap) (port); +} -#ifndef outb_p -# define outb_p outb -#endif -#ifndef outw_p -# define outw_p outw -#endif -#ifndef outl_p -# define outl_p outl -#endif +extern inline void ioport_unmap(void __iomem *addr) +{ +} -#define IO_SPACE_LIMIT 0xffff +static inline void __iomem *ioremap(unsigned long port, unsigned long size) +{ + return IO_CONCAT(__IO_PREFIX,ioremap) (port, size); +} -#else +static inline void __iomem * ioremap_nocache(unsigned long offset, + unsigned long size) +{ + return ioremap(offset, size); +} -/* Userspace declarations. Kill in 2.5. */ +static inline void iounmap(volatile void __iomem *addr) +{ + IO_CONCAT(__IO_PREFIX,iounmap)(addr); +} -extern unsigned int inb(unsigned long port); -extern unsigned int inw(unsigned long port); -extern unsigned int inl(unsigned long port); -extern void outb(unsigned char b,unsigned long port); -extern void outw(unsigned short w,unsigned long port); -extern void outl(unsigned int l,unsigned long port); -extern unsigned long readb(unsigned long addr); -extern unsigned long readw(unsigned long addr); -extern unsigned long readl(unsigned long addr); -extern void writeb(unsigned char b, unsigned long addr); -extern void writew(unsigned short b, unsigned long addr); -extern void writel(unsigned int b, unsigned long addr); +static inline int __is_ioaddr(unsigned long addr) +{ + return IO_CONCAT(__IO_PREFIX,is_ioaddr)(addr); +} +#define __is_ioaddr(a) __is_ioaddr((unsigned long)(a)) -#endif /* __KERNEL__ */ +static inline int __is_mmio(const volatile void __iomem *addr) +{ + return IO_CONCAT(__IO_PREFIX,is_mmio)(addr); +} -#ifdef __KERNEL__ /* - * On Alpha, we have the whole of I/O space mapped at all times, but - * at odd and sometimes discontinuous addresses. Note that the - * discontinuities are all across busses, so we need not care for that - * for any one device. - * - * The DRM drivers need to be able to map contiguously a (potentially) - * discontiguous set of I/O pages. This set of pages is scatter-gather - * mapped contiguously from the perspective of the bus, but we can't - * directly access DMA addresses from the CPU, these addresses need to - * have a real ioremap. Therefore, iounmap and the size argument to - * ioremap are needed to give the platforms the ability to fully implement - * ioremap. - * - * Map the I/O space address into the kernel's virtual address space. + * If the actual I/O bits are sufficiently trivial, then expand inline. */ -static inline void * ioremap(unsigned long offset, unsigned long size) + +#if IO_CONCAT(__IO_PREFIX,trivial_io_bw) +extern inline unsigned int ioread8(void __iomem *addr) { - return (void *) __ioremap(offset, size); -} + unsigned int ret = IO_CONCAT(__IO_PREFIX,ioread8)(addr); + mb(); + return ret; +} -static inline void iounmap(void *addr) +extern inline unsigned int ioread16(void __iomem *addr) { - __iounmap(addr); + unsigned int ret = IO_CONCAT(__IO_PREFIX,ioread16)(addr); + mb(); + return ret; } -static inline void * ioremap_nocache(unsigned long offset, unsigned long size) +extern inline void iowrite8(u8 b, void __iomem *addr) { - return ioremap(offset, size); -} + IO_CONCAT(__IO_PREFIX,iowrite8)(b, addr); + mb(); +} -/* Indirect back to the macros provided. */ +extern inline void iowrite16(u16 b, void __iomem *addr) +{ + IO_CONCAT(__IO_PREFIX,iowrite16)(b, addr); + mb(); +} -extern u8 ___raw_readb(unsigned long addr); -extern u16 ___raw_readw(unsigned long addr); -extern u32 ___raw_readl(unsigned long addr); -extern u64 ___raw_readq(unsigned long addr); -extern void ___raw_writeb(u8 b, unsigned long addr); -extern void ___raw_writew(u16 b, unsigned long addr); -extern void ___raw_writel(u32 b, unsigned long addr); -extern void ___raw_writeq(u64 b, unsigned long addr); +extern inline u8 inb(unsigned long port) +{ + return ioread8(ioport_map(port, 1)); +} -#ifdef __raw_readb -# define readb(a) ({ u8 r_ = __raw_readb(a); mb(); r_; }) -#endif -#ifdef __raw_readw -# define readw(a) ({ u16 r_ = __raw_readw(a); mb(); r_; }) -#endif -#ifdef __raw_readl -# define readl(a) ({ u32 r_ = __raw_readl(a); mb(); r_; }) -#endif -#ifdef __raw_readq -# define readq(a) ({ u64 r_ = __raw_readq(a); mb(); r_; }) -#endif +extern inline u16 inw(unsigned long port) +{ + return ioread16(ioport_map(port, 2)); +} -#ifdef __raw_writeb -# define writeb(v,a) ({ __raw_writeb((v),(a)); mb(); }) -#endif -#ifdef __raw_writew -# define writew(v,a) ({ __raw_writew((v),(a)); mb(); }) -#endif -#ifdef __raw_writel -# define writel(v,a) ({ __raw_writel((v),(a)); mb(); }) -#endif -#ifdef __raw_writeq -# define writeq(v,a) ({ __raw_writeq((v),(a)); mb(); }) -#endif +extern inline void outb(u8 b, unsigned long port) +{ + iowrite8(b, ioport_map(port, 1)); +} -#ifndef __raw_readb -# define __raw_readb(a) ___raw_readb((unsigned long)(a)) -#endif -#ifndef __raw_readw -# define __raw_readw(a) ___raw_readw((unsigned long)(a)) -#endif -#ifndef __raw_readl -# define __raw_readl(a) ___raw_readl((unsigned long)(a)) -#endif -#ifndef __raw_readq -# define __raw_readq(a) ___raw_readq((unsigned long)(a)) +extern inline void outw(u16 b, unsigned long port) +{ + iowrite16(b, ioport_map(port, 2)); +} #endif -#ifndef __raw_writeb -# define __raw_writeb(v,a) ___raw_writeb((v),(unsigned long)(a)) -#endif -#ifndef __raw_writew -# define __raw_writew(v,a) ___raw_writew((v),(unsigned long)(a)) -#endif -#ifndef __raw_writel -# define __raw_writel(v,a) ___raw_writel((v),(unsigned long)(a)) -#endif -#ifndef __raw_writeq -# define __raw_writeq(v,a) ___raw_writeq((v),(unsigned long)(a)) -#endif +#if IO_CONCAT(__IO_PREFIX,trivial_io_lq) +extern inline unsigned int ioread32(void __iomem *addr) +{ + unsigned int ret = IO_CONCAT(__IO_PREFIX,ioread32)(addr); + mb(); + return ret; +} -#ifndef readb -# define readb(a) _readb((unsigned long)(a)) -#endif -#ifndef readw -# define readw(a) _readw((unsigned long)(a)) -#endif -#ifndef readl -# define readl(a) _readl((unsigned long)(a)) -#endif -#ifndef readq -# define readq(a) _readq((unsigned long)(a)) -#endif +extern inline void iowrite32(u32 b, void __iomem *addr) +{ + IO_CONCAT(__IO_PREFIX,iowrite32)(b, addr); + mb(); +} -#define readb_relaxed(addr) readb(addr) -#define readw_relaxed(addr) readw(addr) -#define readl_relaxed(addr) readl(addr) -#define readq_relaxed(addr) readq(addr) +extern inline u32 inl(unsigned long port) +{ + return ioread32(ioport_map(port, 4)); +} -#ifndef writeb -# define writeb(v,a) _writeb((v),(unsigned long)(a)) -#endif -#ifndef writew -# define writew(v,a) _writew((v),(unsigned long)(a)) +extern inline void outl(u32 b, unsigned long port) +{ + iowrite32(b, ioport_map(port, 4)); +} #endif -#ifndef writel -# define writel(v,a) _writel((v),(unsigned long)(a)) + +#if IO_CONCAT(__IO_PREFIX,trivial_rw_bw) == 1 +extern inline u8 __raw_readb(const volatile void __iomem *addr) +{ + return IO_CONCAT(__IO_PREFIX,readb)(addr); +} + +extern inline u16 __raw_readw(const volatile void __iomem *addr) +{ + return IO_CONCAT(__IO_PREFIX,readw)(addr); +} + +extern inline void __raw_writeb(u8 b, volatile void __iomem *addr) +{ + IO_CONCAT(__IO_PREFIX,writeb)(b, addr); +} + +extern inline void __raw_writew(u16 b, volatile void __iomem *addr) +{ + IO_CONCAT(__IO_PREFIX,writew)(b, addr); +} + +extern inline u8 readb(const volatile void __iomem *addr) +{ + u8 ret = __raw_readb(addr); + mb(); + return ret; +} + +extern inline u16 readw(const volatile void __iomem *addr) +{ + u16 ret = __raw_readw(addr); + mb(); + return ret; +} + +extern inline void writeb(u8 b, volatile void __iomem *addr) +{ + __raw_writeb(b, addr); + mb(); +} + +extern inline void writew(u16 b, volatile void __iomem *addr) +{ + __raw_writew(b, addr); + mb(); +} #endif -#ifndef writeq -# define writeq(v,a) _writeq((v),(unsigned long)(a)) + +#if IO_CONCAT(__IO_PREFIX,trivial_rw_lq) == 1 +extern inline u32 __raw_readl(const volatile void __iomem *addr) +{ + return IO_CONCAT(__IO_PREFIX,readl)(addr); +} + +extern inline u64 __raw_readq(const volatile void __iomem *addr) +{ + return IO_CONCAT(__IO_PREFIX,readq)(addr); +} + +extern inline void __raw_writel(u32 b, volatile void __iomem *addr) +{ + IO_CONCAT(__IO_PREFIX,writel)(b, addr); +} + +extern inline void __raw_writeq(u64 b, volatile void __iomem *addr) +{ + IO_CONCAT(__IO_PREFIX,writeq)(b, addr); +} + +extern inline u32 readl(const volatile void __iomem *addr) +{ + u32 ret = __raw_readl(addr); + mb(); + return ret; +} + +extern inline u64 readq(const volatile void __iomem *addr) +{ + u64 ret = __raw_readq(addr); + mb(); + return ret; +} + +extern inline void writel(u32 b, volatile void __iomem *addr) +{ + __raw_writel(b, addr); + mb(); +} + +extern inline void writeq(u64 b, volatile void __iomem *addr) +{ + __raw_writeq(b, addr); + mb(); +} #endif +#define inb_p inb +#define inw_p inw +#define inl_p inl +#define outb_p outb +#define outw_p outw +#define outl_p outl +#define readb_relaxed(addr) __raw_readb(addr) +#define readw_relaxed(addr) __raw_readw(addr) +#define readl_relaxed(addr) __raw_readl(addr) +#define readq_relaxed(addr) __raw_readq(addr) + /* * String version of IO memory access ops: */ -extern void _memcpy_fromio(void *, unsigned long, long); -extern void _memcpy_toio(unsigned long, const void *, long); -extern void _memset_c_io(unsigned long, unsigned long, long); - -#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(addr,c,len) \ - _memset_c_io((unsigned long)(addr),0x0101010101010101UL*(u8)(c),(len)) +extern void memcpy_fromio(void *, const volatile void __iomem *, long); +extern void memcpy_toio(volatile void __iomem *, const void *, long); +extern void _memset_c_io(volatile void __iomem *, unsigned long, long); + +static inline void memset_io(volatile void __iomem *addr, u8 c, long len) +{ + _memset_c_io(addr, 0x0101010101010101UL * c, len); +} #define __HAVE_ARCH_MEMSETW_IO -#define memsetw_io(addr,c,len) \ - _memset_c_io((unsigned long)(addr),0x0001000100010001UL*(u16)(c),(len)) +static inline void memsetw_io(volatile void __iomem *addr, u16 c, long len) +{ + _memset_c_io(addr, 0x0001000100010001UL * c, len); +} /* * String versions of in/out ops: @@ -465,26 +524,22 @@ */ #define eth_io_copy_and_sum(skb,src,len,unused) \ - memcpy_fromio((skb)->data,(src),(len)) + memcpy_fromio((skb)->data,src,len) #define isa_eth_io_copy_and_sum(skb,src,len,unused) \ - isa_memcpy_fromio((skb)->data,(src),(len)) + isa_memcpy_fromio((skb)->data,src,len) static inline int -check_signature(unsigned long io_addr, const unsigned char *signature, - int length) +check_signature(const volatile void __iomem *io_addr, + const unsigned char *signature, int length) { - int retval = 0; do { if (readb(io_addr) != *signature) - goto out; + return 0; io_addr++; signature++; - length--; - } while (length); - retval = 1; -out: - return retval; + } while (--length); + return 1; } @@ -492,31 +547,89 @@ * ISA space is mapped to some machine-specific location on Alpha. * Call into the existing hooks to get the address translated. */ -#define isa_readb(a) readb(__ioremap((a),1)) -#define isa_readw(a) readw(__ioremap((a),2)) -#define isa_readl(a) readl(__ioremap((a),4)) -#define isa_writeb(b,a) writeb((b),__ioremap((a),1)) -#define isa_writew(w,a) writew((w),__ioremap((a),2)) -#define isa_writel(l,a) writel((l),__ioremap((a),4)) -#define isa_memset_io(a,b,c) memset_io(__ioremap((a),(c)),(b),(c)) -#define isa_memcpy_fromio(a,b,c) memcpy_fromio((a),__ioremap((b),(c)),(c)) -#define isa_memcpy_toio(a,b,c) memcpy_toio(__ioremap((a),(c)),(b),(c)) + +static inline u8 +isa_readb(unsigned long offset) +{ + void __iomem *addr = ioremap(offset, 1); + u8 ret = readb(addr); + iounmap(addr); + return ret; +} + +static inline u16 +isa_readw(unsigned long offset) +{ + void __iomem *addr = ioremap(offset, 2); + u16 ret = readw(addr); + iounmap(addr); + return ret; +} + +static inline u32 +isa_readl(unsigned long offset) +{ + void __iomem *addr = ioremap(offset, 2); + u32 ret = readl(addr); + iounmap(addr); + return ret; +} + +static inline void +isa_writeb(u8 b, unsigned long offset) +{ + void __iomem *addr = ioremap(offset, 2); + writeb(b, addr); + iounmap(addr); +} + +static inline void +isa_writew(u16 w, unsigned long offset) +{ + void __iomem *addr = ioremap(offset, 2); + writew(w, addr); + iounmap(addr); +} + +static inline void +isa_writel(u32 l, unsigned long offset) +{ + void __iomem *addr = ioremap(offset, 2); + writel(l, addr); + iounmap(addr); +} + +static inline void +isa_memset_io(unsigned long offset, u8 val, long n) +{ + void __iomem *addr = ioremap(offset, n); + memset_io(addr, val, n); + iounmap(addr); +} + +static inline void +isa_memcpy_fromio(void *dest, unsigned long offset, long n) +{ + void __iomem *addr = ioremap(offset, n); + memcpy_fromio(dest, addr, n); + iounmap(addr); +} + +static inline void +isa_memcpy_toio(unsigned long offset, const void *src, long n) +{ + void __iomem *addr = ioremap(offset, n); + memcpy_toio(addr, src, n); + iounmap(addr); +} static inline int -isa_check_signature(unsigned long io_addr, const unsigned char *signature, - int length) +isa_check_signature(unsigned long offset, const unsigned char *sig, long len) { - int retval = 0; - do { - if (isa_readb(io_addr) != *signature) - goto out; - io_addr++; - signature++; - length--; - } while (length); - retval = 1; -out: - return retval; + void __iomem *addr = ioremap(offset, len); + int ret = check_signature(addr, sig, len); + iounmap(addr); + return ret; } diff -Nru a/include/asm-alpha/io_trivial.h b/include/asm-alpha/io_trivial.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-alpha/io_trivial.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,127 @@ +/* Trivial implementations of basic i/o routines. Assumes that all + of the hard work has been done by ioremap and ioportmap, and that + access to i/o space is linear. */ + +/* This file may be included multiple times. */ + +#if IO_CONCAT(__IO_PREFIX,trivial_io_bw) +__EXTERN_INLINE unsigned int +IO_CONCAT(__IO_PREFIX,ioread8)(void __iomem *a) +{ + return __kernel_ldbu(*(volatile u8 __force *)a); +} + +__EXTERN_INLINE unsigned int +IO_CONCAT(__IO_PREFIX,ioread16)(void __iomem *a) +{ + return __kernel_ldwu(*(volatile u16 __force *)a); +} + +__EXTERN_INLINE void +IO_CONCAT(__IO_PREFIX,iowrite8)(u8 b, void __iomem *a) +{ + __kernel_stb(b, *(volatile u8 __force *)a); +} + +__EXTERN_INLINE void +IO_CONCAT(__IO_PREFIX,iowrite16)(u16 b, void __iomem *a) +{ + __kernel_stb(b, *(volatile u16 __force *)a); +} +#endif + +#if IO_CONCAT(__IO_PREFIX,trivial_io_lq) +__EXTERN_INLINE unsigned int +IO_CONCAT(__IO_PREFIX,ioread32)(void __iomem *a) +{ + return *(volatile u32 __force *)a; +} + +__EXTERN_INLINE void +IO_CONCAT(__IO_PREFIX,iowrite32)(u32 b, void __iomem *a) +{ + *(volatile u32 __force *)a = b; +} +#endif + +#if IO_CONCAT(__IO_PREFIX,trivial_rw_bw) == 1 +__EXTERN_INLINE u8 +IO_CONCAT(__IO_PREFIX,readb)(const volatile void __iomem *a) +{ + return __kernel_ldbu(*(const volatile u8 __force *)a); +} + +__EXTERN_INLINE u16 +IO_CONCAT(__IO_PREFIX,readw)(const volatile void __iomem *a) +{ + return __kernel_ldwu(*(const volatile u16 __force *)a); +} + +__EXTERN_INLINE void +IO_CONCAT(__IO_PREFIX,writeb)(u8 b, volatile void __iomem *a) +{ + __kernel_stb(b, *(volatile u8 __force *)a); +} + +__EXTERN_INLINE void +IO_CONCAT(__IO_PREFIX,writew)(u16 b, volatile void __iomem *a) +{ + __kernel_stb(b, *(volatile u16 __force *)a); +} +#elif IO_CONCAT(__IO_PREFIX,trivial_rw_bw) == 2 +__EXTERN_INLINE u8 +IO_CONCAT(__IO_PREFIX,readb)(const volatile void __iomem *a) +{ + return IO_CONCAT(__IO_PREFIX,ioread8)((void __iomem *)a); +} + +__EXTERN_INLINE u16 +IO_CONCAT(__IO_PREFIX,readw)(const volatile void __iomem *a) +{ + return IO_CONCAT(__IO_PREFIX,ioread16)((void __iomem *)a); +} + +__EXTERN_INLINE void +IO_CONCAT(__IO_PREFIX,writeb)(u8 b, volatile void __iomem *a) +{ + IO_CONCAT(__IO_PREFIX,iowrite8)(b, (void __iomem *)a); +} + +__EXTERN_INLINE void +IO_CONCAT(__IO_PREFIX,writew)(u16 b, volatile void __iomem *a) +{ + IO_CONCAT(__IO_PREFIX,iowrite16)(b, (void __iomem *)a); +} +#endif + +#if IO_CONCAT(__IO_PREFIX,trivial_rw_lq) == 1 +__EXTERN_INLINE u32 +IO_CONCAT(__IO_PREFIX,readl)(const volatile void __iomem *a) +{ + return *(const volatile u32 __force *)a; +} + +__EXTERN_INLINE u64 +IO_CONCAT(__IO_PREFIX,readq)(const volatile void __iomem *a) +{ + return *(const volatile u64 __force *)a; +} + +__EXTERN_INLINE void +IO_CONCAT(__IO_PREFIX,writel)(u32 b, volatile void __iomem *a) +{ + *(volatile u32 __force *)a = b; +} + +__EXTERN_INLINE void +IO_CONCAT(__IO_PREFIX,writeq)(u64 b, volatile void __iomem *a) +{ + *(volatile u64 __force *)a = b; +} +#endif + +#if IO_CONCAT(__IO_PREFIX,trivial_iounmap) +__EXTERN_INLINE void IO_CONCAT(__IO_PREFIX,iounmap)(volatile void __iomem *a) +{ +} +#endif diff -Nru a/include/asm-alpha/jensen.h b/include/asm-alpha/jensen.h --- a/include/asm-alpha/jensen.h 2004-09-26 10:25:56 -07:00 +++ b/include/asm-alpha/jensen.h 2004-09-26 10:25:56 -07:00 @@ -200,8 +200,9 @@ * Memory functions. */ -__EXTERN_INLINE u8 jensen_readb(unsigned long addr) +__EXTERN_INLINE u8 jensen_readb(const volatile void __iomem *xaddr) { + unsigned long addr = (unsigned long) xaddr; long result; jensen_set_hae(addr); @@ -211,8 +212,9 @@ return 0xffUL & result; } -__EXTERN_INLINE u16 jensen_readw(unsigned long addr) +__EXTERN_INLINE u16 jensen_readw(const volatile void __iomem *xaddr) { + unsigned long addr = (unsigned long) xaddr; long result; jensen_set_hae(addr); @@ -222,15 +224,17 @@ return 0xffffUL & result; } -__EXTERN_INLINE u32 jensen_readl(unsigned long addr) +__EXTERN_INLINE u32 jensen_readl(const volatile void __iomem *xaddr) { + unsigned long addr = (unsigned long) xaddr; jensen_set_hae(addr); addr &= JENSEN_HAE_MASK; return *(vuip) ((addr << 7) + EISA_MEM + 0x60); } -__EXTERN_INLINE u64 jensen_readq(unsigned long addr) +__EXTERN_INLINE u64 jensen_readq(const volatile void __iomem *xaddr) { + unsigned long addr = (unsigned long) xaddr; unsigned long r0, r1; jensen_set_hae(addr); @@ -241,29 +245,33 @@ return r1 << 32 | r0; } -__EXTERN_INLINE void jensen_writeb(u8 b, unsigned long addr) +__EXTERN_INLINE void jensen_writeb(u8 b, volatile void __iomem *xaddr) { + unsigned long addr = (unsigned long) xaddr; jensen_set_hae(addr); addr &= JENSEN_HAE_MASK; *(vuip) ((addr << 7) + EISA_MEM + 0x00) = b * 0x01010101; } -__EXTERN_INLINE void jensen_writew(u16 b, unsigned long addr) +__EXTERN_INLINE void jensen_writew(u16 b, volatile void __iomem *xaddr) { + unsigned long addr = (unsigned long) xaddr; jensen_set_hae(addr); addr &= JENSEN_HAE_MASK; *(vuip) ((addr << 7) + EISA_MEM + 0x20) = b * 0x00010001; } -__EXTERN_INLINE void jensen_writel(u32 b, unsigned long addr) +__EXTERN_INLINE void jensen_writel(u32 b, volatile void __iomem *xaddr) { + unsigned long addr = (unsigned long) xaddr; jensen_set_hae(addr); addr &= JENSEN_HAE_MASK; *(vuip) ((addr << 7) + EISA_MEM + 0x60) = b; } -__EXTERN_INLINE void jensen_writeq(u64 b, unsigned long addr) +__EXTERN_INLINE void jensen_writeq(u64 b, volatile void __iomem *xaddr) { + unsigned long addr = (unsigned long) xaddr; jensen_set_hae(addr); addr &= JENSEN_HAE_MASK; addr = (addr << 7) + EISA_MEM + 0x60; @@ -271,15 +279,15 @@ *(vuip) (addr + (4 << 7)) = b >> 32; } -__EXTERN_INLINE unsigned long jensen_ioremap(unsigned long addr, - unsigned long size) +__EXTERN_INLINE void __iomem *jensen_ioportmap(unsigned long addr) { - return addr; + return (void __iomem *)addr; } -__EXTERN_INLINE void jensen_iounmap(unsigned long addr) +__EXTERN_INLINE void __iomem *jensen_ioremap(unsigned long addr, + unsigned long size) { - return; + return (void __iomem *)(addr + 0x100000000ul); } __EXTERN_INLINE int jensen_is_ioaddr(unsigned long addr) @@ -287,39 +295,46 @@ return (long)addr >= 0; } -#undef vuip +__EXTERN_INLINE int jensen_is_mmio(const volatile void __iomem *addr) +{ + return (unsigned long)addr >= 0x100000000ul; +} + +/* New-style ioread interface. All the routines are so ugly for Jensen + that it doesn't make sense to merge them. */ -#ifdef __WANT_IO_DEF +#define IOPORT(OS, NS) \ +__EXTERN_INLINE unsigned int jensen_ioread##NS(void __iomem *xaddr) \ +{ \ + if (jensen_is_mmio(xaddr)) \ + return jensen_read##OS(xaddr - 0x100000000ul); \ + else \ + return jensen_in##OS((unsigned long)xaddr); \ +} \ +__EXTERN_INLINE void jensen_iowrite##NS(u##NS b, void __iomem *xaddr) \ +{ \ + if (jensen_is_mmio(xaddr)) \ + jensen_write##OS(b, xaddr - 0x100000000ul); \ + else \ + jensen_out##OS(b, (unsigned long)xaddr); \ +} + +IOPORT(b, 8) +IOPORT(w, 16) +IOPORT(l, 32) -#define __inb jensen_inb -#define __inw jensen_inw -#define __inl jensen_inl -#define __outb jensen_outb -#define __outw jensen_outw -#define __outl jensen_outl -#define __readb jensen_readb -#define __readw jensen_readw -#define __writeb jensen_writeb -#define __writew jensen_writew -#define __readl jensen_readl -#define __readq jensen_readq -#define __writel jensen_writel -#define __writeq jensen_writeq -#define __ioremap jensen_ioremap -#define __iounmap(a) jensen_iounmap((unsigned long)a) -#define __is_ioaddr jensen_is_ioaddr - -/* - * The above have so much overhead that it probably doesn't make - * sense to have them inlined (better icache behaviour). - */ -#define inb(port) \ -(__builtin_constant_p((port))?__inb(port):_inb(port)) +#undef IOPORT -#define outb(x, port) \ -(__builtin_constant_p((port))?__outb((x),(port)):_outb((x),(port))) +#undef vuip -#endif /* __WANT_IO_DEF */ +#undef __IO_PREFIX +#define __IO_PREFIX jensen +#define jensen_trivial_rw_bw 0 +#define jensen_trivial_rw_lq 0 +#define jensen_trivial_io_bw 0 +#define jensen_trivial_io_lq 0 +#define jensen_trivial_iounmap 1 +#include #ifdef __IO_EXTERN_INLINE #undef __EXTERN_INLINE diff -Nru a/include/asm-alpha/machvec.h b/include/asm-alpha/machvec.h --- a/include/asm-alpha/machvec.h 2004-09-26 10:25:55 -07:00 +++ b/include/asm-alpha/machvec.h 2004-09-26 10:25:55 -07:00 @@ -45,27 +45,29 @@ void (*mv_pci_tbi)(struct pci_controller *hose, dma_addr_t start, dma_addr_t end); - u8 (*mv_inb)(unsigned long); - u16 (*mv_inw)(unsigned long); - u32 (*mv_inl)(unsigned long); + unsigned int (*mv_ioread8)(void __iomem *); + unsigned int (*mv_ioread16)(void __iomem *); + unsigned int (*mv_ioread32)(void __iomem *); - void (*mv_outb)(u8, unsigned long); - void (*mv_outw)(u16, unsigned long); - void (*mv_outl)(u32, unsigned long); - - u8 (*mv_readb)(unsigned long); - u16 (*mv_readw)(unsigned long); - u32 (*mv_readl)(unsigned long); - u64 (*mv_readq)(unsigned long); + void (*mv_iowrite8)(u8, void __iomem *); + void (*mv_iowrite16)(u16, void __iomem *); + void (*mv_iowrite32)(u32, void __iomem *); - void (*mv_writeb)(u8, unsigned long); - void (*mv_writew)(u16, unsigned long); - void (*mv_writel)(u32, unsigned long); - void (*mv_writeq)(u64, unsigned long); + u8 (*mv_readb)(const volatile void __iomem *); + u16 (*mv_readw)(const volatile void __iomem *); + u32 (*mv_readl)(const volatile void __iomem *); + u64 (*mv_readq)(const volatile void __iomem *); - unsigned long (*mv_ioremap)(unsigned long, unsigned long); - void (*mv_iounmap)(unsigned long); + void (*mv_writeb)(u8, volatile void __iomem *); + void (*mv_writew)(u16, volatile void __iomem *); + void (*mv_writel)(u32, volatile void __iomem *); + void (*mv_writeq)(u64, volatile void __iomem *); + + void __iomem *(*mv_ioportmap)(unsigned long); + void __iomem *(*mv_ioremap)(unsigned long, unsigned long); + void (*mv_iounmap)(volatile void __iomem *); int (*mv_is_ioaddr)(unsigned long); + int (*mv_is_mmio)(const volatile void __iomem *); void (*mv_switch_mm)(struct mm_struct *, struct mm_struct *, struct task_struct *); diff -Nru a/include/asm-alpha/mmu_context.h b/include/asm-alpha/mmu_context.h --- a/include/asm-alpha/mmu_context.h 2004-09-26 10:25:56 -07:00 +++ b/include/asm-alpha/mmu_context.h 2004-09-26 10:25:56 -07:00 @@ -10,6 +10,7 @@ #include #include #include +#include /* * Force a context reload. This is needed when we change the page diff -Nru a/include/asm-alpha/spinlock.h b/include/asm-alpha/spinlock.h --- a/include/asm-alpha/spinlock.h 2004-09-26 10:25:56 -07:00 +++ b/include/asm-alpha/spinlock.h 2004-09-26 10:25:56 -07:00 @@ -95,7 +95,7 @@ /***********************************************************/ typedef struct { - volatile int write_lock:1, read_counter:31; + volatile unsigned int write_lock:1, read_counter:31; } /*__attribute__((aligned(32)))*/ rwlock_t; #define RW_LOCK_UNLOCKED (rwlock_t) { 0, 0 } @@ -124,7 +124,7 @@ " br 1b\n" ".previous" : "=m" (*lock), "=&r" (regx) - : "0" (*lock) : "memory"); + : "m" (*lock) : "memory"); } static inline void _raw_read_lock(rwlock_t * lock) @@ -147,6 +147,29 @@ : "m" (*lock) : "memory"); } #endif /* CONFIG_DEBUG_RWLOCK */ + +static inline int _raw_write_trylock(rwlock_t * lock) +{ + long regx; + int success; + + __asm__ __volatile__( + "1: ldl_l %1,%0\n" + " lda %2,0\n" + " bne %1,2f\n" + " or $31,1,%1\n" + " stl_c %1,%0\n" + " beq %1,6f\n" + " lda %2,1\n" + "2: mb\n" + ".subsection 2\n" + "6: br 1b\n" + ".previous" + : "=m" (*lock), "=&r" (regx), "=&r" (success) + : "m" (*lock) : "memory"); + + return success; +} static inline void _raw_write_unlock(rwlock_t * lock) { diff -Nru a/include/asm-alpha/system.h b/include/asm-alpha/system.h --- a/include/asm-alpha/system.h 2004-09-26 10:25:56 -07:00 +++ b/include/asm-alpha/system.h 2004-09-26 10:25:56 -07:00 @@ -55,9 +55,9 @@ */ struct el_common { unsigned int size; /* size in bytes of logout area */ - int sbz1 : 30; /* should be zero */ - int err2 : 1; /* second error */ - int retry : 1; /* retry flag */ + unsigned int sbz1 : 30; /* should be zero */ + unsigned int err2 : 1; /* second error */ + unsigned int retry : 1; /* retry flag */ unsigned int proc_offset; /* processor-specific offset */ unsigned int sys_offset; /* system-specific offset */ unsigned int code; /* machine check code */ diff -Nru a/include/asm-alpha/tlbflush.h b/include/asm-alpha/tlbflush.h --- a/include/asm-alpha/tlbflush.h 2004-09-26 10:25:55 -07:00 +++ b/include/asm-alpha/tlbflush.h 2004-09-26 10:25:55 -07:00 @@ -3,6 +3,7 @@ #include #include +#include #ifndef __EXTERN_INLINE #define __EXTERN_INLINE extern inline @@ -86,7 +87,7 @@ static inline void flush_tlb_other(struct mm_struct *mm) { - long *mmc = &mm->context[smp_processor_id()]; + unsigned long *mmc = &mm->context[smp_processor_id()]; /* Check it's not zero first to avoid cacheline ping pong when possible. */ if (*mmc) *mmc = 0; diff -Nru a/include/asm-alpha/unistd.h b/include/asm-alpha/unistd.h --- a/include/asm-alpha/unistd.h 2004-09-26 10:25:56 -07:00 +++ b/include/asm-alpha/unistd.h 2004-09-26 10:25:56 -07:00 @@ -373,8 +373,9 @@ #define __NR_mq_timedreceive 435 #define __NR_mq_notify 436 #define __NR_mq_getsetattr 437 +#define __NR_waitid 438 -#define NR_SYSCALLS 438 +#define NR_SYSCALLS 439 #if defined(__GNUC__) @@ -617,7 +618,7 @@ return sys_read(fd, buf, nr); } -extern long execve(char *, char **, char **); +extern int execve(char *, char **, char **); static inline long setsid(void) { diff -Nru a/include/asm-alpha/vga.h b/include/asm-alpha/vga.h --- a/include/asm-alpha/vga.h 2004-09-26 10:25:55 -07:00 +++ b/include/asm-alpha/vga.h 2004-09-26 10:25:55 -07:00 @@ -15,24 +15,24 @@ extern inline void scr_writew(u16 val, volatile u16 *addr) { - if (__is_ioaddr((unsigned long) addr)) - __raw_writew(val, (unsigned long) addr); + if (__is_ioaddr(addr)) + __raw_writew(val, (volatile u16 __iomem *) addr); else *addr = val; } extern inline u16 scr_readw(volatile const u16 *addr) { - if (__is_ioaddr((unsigned long) addr)) - return __raw_readw((unsigned long) addr); + if (__is_ioaddr(addr)) + return __raw_readw((volatile const u16 __iomem *) addr); else return *addr; } extern inline void scr_memsetw(u16 *s, u16 c, unsigned int count) { - if (__is_ioaddr((unsigned long) s)) - memsetw_io(s, c, count); + if (__is_ioaddr(s)) + memsetw_io((u16 __iomem *) s, c, count); else memsetw(s, c, count); } @@ -43,9 +43,9 @@ /* ??? These are currently only used for downloading character sets. As such, they don't need memory barriers. Is this all they are intended to be used for? */ -#define vga_readb readb -#define vga_writeb writeb +#define vga_readb(a) readb((u8 __iomem *)(a)) +#define vga_writeb(v,a) writeb(v, (u8 __iomem *)(a)) -#define VGA_MAP_MEM(x) ((unsigned long) ioremap((x), 0)) +#define VGA_MAP_MEM(x) ((unsigned long) ioremap(x, 0)) #endif diff -Nru a/include/asm-arm/apm.h b/include/asm-arm/apm.h --- a/include/asm-arm/apm.h 2004-09-26 10:25:57 -07:00 +++ b/include/asm-arm/apm.h 2004-09-26 10:25:57 -07:00 @@ -14,24 +14,7 @@ #define ARM_ASM_SA1100_APM_H #include - -#if defined(CONFIG_APM) || defined(CONFIG_APM_MODULE) - - -#define APM_AC_OFFLINE 0 -#define APM_AC_ONLINE 1 -#define APM_AC_BACKUP 2 -#define APM_AC_UNKNOWN 0xFF - -#define APM_BATTERY_STATUS_HIGH 0 -#define APM_BATTERY_STATUS_LOW 1 -#define APM_BATTERY_STATUS_CRITICAL 2 -#define APM_BATTERY_STATUS_CHARGING 3 -#define APM_BATTERY_STATUS_UNKNOWN 0xFF - -#define APM_BATTERY_LIFE_UNKNOWN 0xFFFF -#define APM_BATTERY_LIFE_MINUTES 0x8000 -#define APM_BATTERY_LIFE_VALUE_MASK 0x7FFF +#include /* * This structure gets filled in by the machine specific 'get_power_status' @@ -39,18 +22,44 @@ */ struct apm_power_info { unsigned char ac_line_status; +#define APM_AC_OFFLINE 0 +#define APM_AC_ONLINE 1 +#define APM_AC_BACKUP 2 +#define APM_AC_UNKNOWN 0xff + unsigned char battery_status; +#define APM_BATTERY_STATUS_HIGH 0 +#define APM_BATTERY_STATUS_LOW 1 +#define APM_BATTERY_STATUS_CRITICAL 2 +#define APM_BATTERY_STATUS_CHARGING 3 +#define APM_BATTERY_STATUS_NOT_PRESENT 4 +#define APM_BATTERY_STATUS_UNKNOWN 0xff + unsigned char battery_flag; - unsigned char battery_life; +#define APM_BATTERY_FLAG_HIGH (1 << 0) +#define APM_BATTERY_FLAG_LOW (1 << 1) +#define APM_BATTERY_FLAG_CRITICAL (1 << 2) +#define APM_BATTERY_FLAG_CHARGING (1 << 3) +#define APM_BATTERY_FLAG_NOT_PRESENT (1 << 7) +#define APM_BATTERY_FLAG_UNKNOWN 0xff + + int battery_life; int time; int units; +#define APM_UNITS_MINS 0 +#define APM_UNITS_SECS 1 +#define APM_UNITS_UNKNOWN -1 + }; /* * This allows machines to provide their own "apm get power status" function. */ extern void (*apm_get_power_status)(struct apm_power_info *); -#endif +/* + * Queue an event (APM_SYS_SUSPEND or APM_CRITICAL_SUSPEND) + */ +void apm_queue_event(apm_event_t event); #endif diff -Nru a/include/asm-arm/arch-pxa/mmc.h b/include/asm-arm/arch-pxa/mmc.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-arm/arch-pxa/mmc.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,19 @@ +#ifndef ASMARM_ARCH_MMC_H +#define ASMARM_ARCH_MMC_H + +#include +#include + +struct device; +struct mmc_host; + +struct pxamci_platform_data { + unsigned int ocr_mask; /* available voltages */ + int (*init)(struct device *, irqreturn_t (*)(int, void *, struct pt_regs *), void *); + void (*setpower)(struct device *, unsigned int); + void (*exit)(struct device *, void *); +}; + +extern void pxa_set_mci_info(struct pxamci_platform_data *info); + +#endif diff -Nru a/include/asm-arm/arch-s3c2410/hardware.h b/include/asm-arm/arch-s3c2410/hardware.h --- a/include/asm-arm/arch-s3c2410/hardware.h 2004-09-26 10:25:56 -07:00 +++ b/include/asm-arm/arch-s3c2410/hardware.h 2004-09-26 10:25:56 -07:00 @@ -14,6 +14,7 @@ * 06-Jun-2003 BJD Added CPU frequency settings * 03-Sep-2003 BJD Linux v2.6 support * 12-Mar-2004 BJD Fixed include protection, fixed type of clock vars + * 14-Sep-2004 BJD Added misccr and getpin to gpio */ #ifndef __ASM_ARCH_HARDWARE_H @@ -60,6 +61,10 @@ extern void s3c2410_gpio_pullup(unsigned int pin, unsigned int to); extern void s3c2410_gpio_setpin(unsigned int pin, unsigned int to); + +extern unsigned int s3c2410_gpio_getpin(unsigned int pin); + +extern unsigned int s3c2410_modify_misccr(unsigned int clr, unsigned int chg); #endif /* __ASSEMBLY__ */ diff -Nru a/include/asm-arm/arch-s3c2410/regs-udc.h b/include/asm-arm/arch-s3c2410/regs-udc.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-arm/arch-s3c2410/regs-udc.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,162 @@ +/* linux/include/asm/arch-s3c2410/regs-udc.h + * + * Copyright (C) 2004 Herbert Poetzl + * + * This include file 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. + * + * Changelog: + * 01-08-2004 initial creation + * 12-09-2004 cleanup for submission + */ + +#ifndef __ASM_ARCH_REGS_UDC_H +#define __ASM_ARCH_REGS_UDC_H + + +#define S3C2410_USBDREG(x) ((x) + S3C2410_VA_USBDEV) + +#define S3C2410_UDC_FUNC_ADDR_REG S3C2410_USBDREG(0x0140) +#define S3C2410_UDC_PWR_REG S3C2410_USBDREG(0x0144) +#define S3C2410_UDC_EP_INT_REG S3C2410_USBDREG(0x0148) + +#define S3C2410_UDC_USB_INT_REG S3C2410_USBDREG(0x0158) +#define S3C2410_UDC_EP_INT_EN_REG S3C2410_USBDREG(0x015c) + +#define S3C2410_UDC_USB_INT_EN_REG S3C2410_USBDREG(0x016c) + +#define S3C2410_UDC_FRAME_NUM1_REG S3C2410_USBDREG(0x0170) +#define S3C2410_UDC_FRAME_NUM2_REG S3C2410_USBDREG(0x0174) + +#define S3C2410_UDC_EP0_FIFO_REG S3C2410_USBDREG(0x01c0) +#define S3C2410_UDC_EP1_FIFO_REG S3C2410_USBDREG(0x01c4) +#define S3C2410_UDC_EP2_FIFO_REG S3C2410_USBDREG(0x01c8) +#define S3C2410_UDC_EP3_FIFO_REG S3C2410_USBDREG(0x01cc) +#define S3C2410_UDC_EP4_FIFO_REG S3C2410_USBDREG(0x01d0) + +#define S3C2410_UDC_EP1_DMA_CON S3C2410_USBDREG(0x0200) +#define S3C2410_UDC_EP1_DMA_UNIT S3C2410_USBDREG(0x0204) +#define S3C2410_UDC_EP1_DMA_FIFO S3C2410_USBDREG(0x0208) +#define S3C2410_UDC_EP1_DMA_TTC_L S3C2410_USBDREG(0x020c) +#define S3C2410_UDC_EP1_DMA_TTC_M S3C2410_USBDREG(0x0210) +#define S3C2410_UDC_EP1_DMA_TTC_H S3C2410_USBDREG(0x0214) + +#define S3C2410_UDC_EP2_DMA_CON S3C2410_USBDREG(0x0218) +#define S3C2410_UDC_EP2_DMA_UNIT S3C2410_USBDREG(0x021c) +#define S3C2410_UDC_EP2_DMA_FIFO S3C2410_USBDREG(0x0220) +#define S3C2410_UDC_EP2_DMA_TTC_L S3C2410_USBDREG(0x0224) +#define S3C2410_UDC_EP2_DMA_TTC_M S3C2410_USBDREG(0x0228) +#define S3C2410_UDC_EP2_DMA_TTC_H S3C2410_USBDREG(0x022c) + +#define S3C2410_UDC_EP3_DMA_CON S3C2410_USBDREG(0x0240) +#define S3C2410_UDC_EP3_DMA_UNIT S3C2410_USBDREG(0x0244) +#define S3C2410_UDC_EP3_DMA_FIFO S3C2410_USBDREG(0x0248) +#define S3C2410_UDC_EP3_DMA_TTC_L S3C2410_USBDREG(0x024c) +#define S3C2410_UDC_EP3_DMA_TTC_M S3C2410_USBDREG(0x0250) +#define S3C2410_UDC_EP3_DMA_TTC_H S3C2410_USBDREG(0x0254) + +#define S3C2410_UDC_EP4_DMA_CON S3C2410_USBDREG(0x0258) +#define S3C2410_UDC_EP4_DMA_UNIT S3C2410_USBDREG(0x025c) +#define S3C2410_UDC_EP4_DMA_FIFO S3C2410_USBDREG(0x0260) +#define S3C2410_UDC_EP4_DMA_TTC_L S3C2410_USBDREG(0x0264) +#define S3C2410_UDC_EP4_DMA_TTC_M S3C2410_USBDREG(0x0268) +#define S3C2410_UDC_EP4_DMA_TTC_H S3C2410_USBDREG(0x026c) + +#define S3C2410_UDC_INDEX_REG S3C2410_USBDREG(0x0178) + +/* indexed registers */ + +#define S3C2410_UDC_MAXP_REG S3C2410_USBDREG(0x018c) + +#define S3C2410_UDC_EP0_CSR_REG S3C2410_USBDREG(0x0184) + +#define S3C2410_UDC_IN_CSR1_REG S3C2410_USBDREG(0x0184) +#define S3C2410_UDC_IN_CSR2_REG S3C2410_USBDREG(0x0188) + +#define S3C2410_UDC_OUT_CSR1_REG S3C2410_USBDREG(0x0190) +#define S3C2410_UDC_OUT_CSR2_REG S3C2410_USBDREG(0x0194) +#define S3C2410_UDC_OUT_FIFO_CNT1_REG S3C2410_USBDREG(0x0198) +#define S3C2410_UDC_OUT_FIFO_CNT2_REG S3C2410_USBDREG(0x019c) + + + +#define S3C2410_UDC_PWR_ISOUP (1<<7) // R/W +#define S3C2410_UDC_PWR_RESET (1<<3) // R +#define S3C2410_UDC_PWR_RESUME (1<<2) // R/W +#define S3C2410_UDC_PWR_SUSPEND (1<<1) // R +#define S3C2410_UDC_PWR_ENSUSPEND (1<<0) // R/W + +#define S3C2410_UDC_PWR_DEFAULT 0x00 + +#define S3C2410_UDC_INT_EP4 (1<<4) // R/W (clear only) +#define S3C2410_UDC_INT_EP3 (1<<3) // R/W (clear only) +#define S3C2410_UDC_INT_EP2 (1<<2) // R/W (clear only) +#define S3C2410_UDC_INT_EP1 (1<<1) // R/W (clear only) +#define S3C2410_UDC_INT_EP0 (1<<0) // R/W (clear only) + +#define S3C2410_UDC_USBINT_RESET (1<<2) // R/W (clear only) +#define S3C2410_UDC_USBINT_RESUME (1<<1) // R/W (clear only) +#define S3C2410_UDC_USBINT_SUSPEND (1<<0) // R/W (clear only) + +#define S3C2410_UDC_INTE_EP4 (1<<4) // R/W +#define S3C2410_UDC_INTE_EP3 (1<<3) // R/W +#define S3C2410_UDC_INTE_EP2 (1<<2) // R/W +#define S3C2410_UDC_INTE_EP1 (1<<1) // R/W +#define S3C2410_UDC_INTE_EP0 (1<<0) // R/W + +#define S3C2410_UDC_USBINTE_RESET (1<<2) // R/W +#define S3C2410_UDC_USBINTE_SUSPEND (1<<0) // R/W + + +#define S3C2410_UDC_INDEX_EP0 (0x00) +#define S3C2410_UDC_INDEX_EP1 (0x01) // ?? +#define S3C2410_UDC_INDEX_EP2 (0x02) // ?? +#define S3C2410_UDC_INDEX_EP3 (0x03) // ?? +#define S3C2410_UDC_INDEX_EP4 (0x04) // ?? + +#define S3C2410_UDC_ICSR1_CLRDT (1<<6) // R/W +#define S3C2410_UDC_ICSR1_SENTSTL (1<<5) // R/W (clear only) +#define S3C2410_UDC_ICSR1_SENDSTL (1<<4) // R/W +#define S3C2410_UDC_ICSR1_FFLUSH (1<<3) // W (set only) +#define S3C2410_UDC_ICSR1_UNDRUN (1<<2) // R/W (clear only) +#define S3C2410_UDC_ICSR1_PKTRDY (1<<0) // R/W (set only) + +#define S3C2410_UDC_ICSR2_AUTOSET (1<<7) // R/W +#define S3C2410_UDC_ICSR2_ISO (1<<6) // R/W +#define S3C2410_UDC_ICSR2_MODEIN (1<<5) // R/W +#define S3C2410_UDC_ICSR2_DMAIEN (1<<4) // R/W + +#define S3C2410_UDC_OCSR1_CLRDT (1<<7) // R/W +#define S3C2410_UDC_OCSR1_SENTSTL (1<<6) // R/W (clear only) +#define S3C2410_UDC_OCSR1_SENDSTL (1<<5) // R/W +#define S3C2410_UDC_OCSR1_FFLUSH (1<<4) // R/W +#define S3C2410_UDC_OCSR1_DERROR (1<<3) // R +#define S3C2410_UDC_OCSR1_OVRRUN (1<<2) // R/W (clear only) +#define S3C2410_UDC_OCSR1_PKTRDY (1<<0) // R/W (clear only) + +#define S3C2410_UDC_OCSR2_AUTOCLR (1<<7) // R/W +#define S3C2410_UDC_OCSR2_ISO (1<<6) // R/W +#define S3C2410_UDC_OCSR2_DMAIEN (1<<5) // R/W + +#define S3C2410_UDC_SETIX(x) \ + __raw_writel(S3C2410_UDC_INDEX_ ## x, S3C2410_UDC_INDEX_REG); + + +#define S3C2410_UDC_EP0_CSR_OPKRDY (1<<0) +#define S3C2410_UDC_EP0_CSR_IPKRDY (1<<1) +#define S3C2410_UDC_EP0_CSR_SENTSTL (1<<2) +#define S3C2410_UDC_EP0_CSR_DE (1<<3) +#define S3C2410_UDC_EP0_CSR_SE (1<<4) +#define S3C2410_UDC_EP0_CSR_SENDSTL (1<<5) +#define S3C2410_UDC_EP0_CSR_SOPKTRDY (1<<6) +#define S3C2410_UDC_EP0_CSR_SSE (1<<7) + +#define S3C2410_UDC_MAXP_8 (1<<0) +#define S3C2410_UDC_MAXP_16 (1<<1) +#define S3C2410_UDC_MAXP_32 (1<<2) +#define S3C2410_UDC_MAXP_64 (1<<3) + + +#endif diff -Nru a/include/asm-arm/cacheflush.h b/include/asm-arm/cacheflush.h --- a/include/asm-arm/cacheflush.h 2004-09-26 10:25:57 -07:00 +++ b/include/asm-arm/cacheflush.h 2004-09-26 10:25:57 -07:00 @@ -237,11 +237,17 @@ * space" model to handle this. */ #define copy_to_user_page(vma, page, vaddr, dst, src, len) \ -do { memcpy(dst, src, len); \ - flush_icache_user_range(vma, page, vaddr, len); \ -} while (0) + do { \ + flush_cache_page(vma, vaddr); \ + memcpy(dst, src, len); \ + flush_dcache_page(page); \ + } while (0) + #define copy_from_user_page(vma, page, vaddr, dst, src, len) \ - memcpy(dst, src, len) + do { \ + flush_cache_page(vma, vaddr); \ + memcpy(dst, src, len); \ + } while (0) /* * Convert calls to our calling convention. diff -Nru a/include/asm-arm/system.h b/include/asm-arm/system.h --- a/include/asm-arm/system.h 2004-09-26 10:25:55 -07:00 +++ b/include/asm-arm/system.h 2004-09-26 10:25:55 -07:00 @@ -98,9 +98,10 @@ #ifndef __ASSEMBLY__ -#include +#include struct thread_info; +struct task_struct; /* information about the system we're running on */ extern unsigned int system_rev; @@ -203,8 +204,6 @@ * `prev' will never be the same as `next'. schedule() itself * contains the memory barrier to tell GCC not to cache `current'. */ -struct thread_info; -struct task_struct; extern struct task_struct *__switch_to(struct task_struct *, struct thread_info *, struct thread_info *); #define switch_to(prev,next,last) \ diff -Nru a/include/asm-generic/iomap.h b/include/asm-generic/iomap.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-generic/iomap.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,63 @@ +#ifndef __GENERIC_IO_H +#define __GENERIC_IO_H + +#include + +/* + * These are the "generic" interfaces for doing new-style + * memory-mapped or PIO accesses. Architectures may do + * their own arch-optimized versions, these just act as + * wrappers around the old-style IO register access functions: + * read[bwl]/write[bwl]/in[bwl]/out[bwl] + * + * Don't include this directly, include it from . + */ + +/* + * Read/write from/to an (offsettable) iomem cookie. It might be a PIO + * access or a MMIO access, these functions don't care. The info is + * encoded in the hardware mapping set up by the mapping functions + * (or the cookie itself, depending on implementation and hw). + * + * The generic routines just encode the PIO/MMIO as part of the + * cookie, and coldly assume that the MMIO IO mappings are not + * in the low address range. Architectures for which this is not + * true can't use this generic implementation. + */ +extern unsigned int fastcall ioread8(void __iomem *); +extern unsigned int fastcall ioread16(void __iomem *); +extern unsigned int fastcall ioread32(void __iomem *); + +extern void fastcall iowrite8(u8, void __iomem *); +extern void fastcall iowrite16(u16, void __iomem *); +extern void fastcall iowrite32(u32, void __iomem *); + +/* + * "string" versions of the above. Note that they + * use native byte ordering for the accesses (on + * the assumption that IO and memory agree on a + * byte order, and CPU byteorder is irrelevant). + * + * They do _not_ update the port address. If you + * want MMIO that copies stuff laid out in MMIO + * memory across multiple ports, use "memcpy_toio()" + * and friends. + */ +extern void fastcall ioread8_rep(void __iomem *port, void *buf, unsigned long count); +extern void fastcall ioread16_rep(void __iomem *port, void *buf, unsigned long count); +extern void fastcall ioread32_rep(void __iomem *port, void *buf, unsigned long count); + +extern void fastcall iowrite8_rep(void __iomem *port, const void *buf, unsigned long count); +extern void fastcall iowrite16_rep(void __iomem *port, const void *buf, unsigned long count); +extern void fastcall iowrite32_rep(void __iomem *port, const void *buf, unsigned long count); + +/* Create a virtual mapping cookie for an IO port range */ +extern void __iomem *ioport_map(unsigned long port, unsigned int nr); +extern void ioport_unmap(void __iomem *); + +/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */ +struct pci_dev; +extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max); +extern void pci_iounmap(struct pci_dev *dev, void __iomem *); + +#endif diff -Nru a/include/asm-generic/siginfo.h b/include/asm-generic/siginfo.h --- a/include/asm-generic/siginfo.h 2004-09-26 10:25:56 -07:00 +++ b/include/asm-generic/siginfo.h 2004-09-26 10:25:56 -07:00 @@ -75,7 +75,6 @@ int _status; /* exit code */ clock_t _utime; clock_t _stime; - struct rusage _rusage; } _sigchld; /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ @@ -107,7 +106,6 @@ #define si_status _sifields._sigchld._status #define si_utime _sifields._sigchld._utime #define si_stime _sifields._sigchld._stime -#define si_rusage _sifields._sigchld._rusage #define si_value _sifields._rt._sigval #define si_int _sifields._rt._sigval.sival_int #define si_ptr _sifields._rt._sigval.sival_ptr diff -Nru a/include/asm-h8300/softirq.h b/include/asm-h8300/softirq.h --- a/include/asm-h8300/softirq.h 2004-09-26 10:25:56 -07:00 +++ /dev/null Wed Dec 31 16:00:00 196900 @@ -1,20 +0,0 @@ -#ifndef __ASM_SOFTIRQ_H -#define __ASM_SOFTIRQ_H - -#include -#include - -#define local_bh_disable() \ - do { preempt_count() += SOFTIRQ_OFFSET; barrier(); } while (0) -#define __local_bh_enable() \ - do { barrier(); preempt_count() -= SOFTIRQ_OFFSET; } while (0) - -#define local_bh_enable() \ -do { \ - __local_bh_enable(); \ - if (unlikely(!in_interrupt() && softirq_pending(smp_processor_id()))) \ - do_softirq(); \ - preempt_check_resched(); \ -} while (0) - -#endif /* __ASM_SOFTIRQ_H */ diff -Nru a/include/asm-i386/dma-mapping.h b/include/asm-i386/dma-mapping.h --- a/include/asm-i386/dma-mapping.h 2004-09-26 10:25:57 -07:00 +++ b/include/asm-i386/dma-mapping.h 2004-09-26 10:25:57 -07:00 @@ -1,7 +1,6 @@ #ifndef _ASM_I386_DMA_MAPPING_H #define _ASM_I386_DMA_MAPPING_H -#include #include #include diff -Nru a/include/asm-i386/elf.h b/include/asm-i386/elf.h --- a/include/asm-i386/elf.h 2004-09-26 10:25:57 -07:00 +++ b/include/asm-i386/elf.h 2004-09-26 10:25:57 -07:00 @@ -123,7 +123,7 @@ * An executable for which elf_read_implies_exec() returns TRUE will * have the READ_IMPLIES_EXEC personality flag set automatically. */ -#define elf_read_implies_exec_binary(ex, have_pt_gnu_stack) (!(have_pt_gnu_stack)) +#define elf_read_implies_exec(ex, have_pt_gnu_stack) (!(have_pt_gnu_stack)) extern int dump_task_regs (struct task_struct *, elf_gregset_t *); extern int dump_task_fpu (struct task_struct *, elf_fpregset_t *); diff -Nru a/include/asm-i386/io.h b/include/asm-i386/io.h --- a/include/asm-i386/io.h 2004-09-26 10:25:57 -07:00 +++ b/include/asm-i386/io.h 2004-09-26 10:25:57 -07:00 @@ -45,6 +45,8 @@ #ifdef __KERNEL__ +#include + #include /** diff -Nru a/include/asm-i386/page.h b/include/asm-i386/page.h --- a/include/asm-i386/page.h 2004-09-26 10:25:55 -07:00 +++ b/include/asm-i386/page.h 2004-09-26 10:25:55 -07:00 @@ -94,13 +94,13 @@ * and CONFIG_HIGHMEM64G options in the kernel configuration. */ +#ifndef __ASSEMBLY__ + /* * This much address space is reserved for vmalloc() and iomap() * as well as fixmap mappings. */ -#define __VMALLOC_RESERVE (128 << 20) - -#ifndef __ASSEMBLY__ +extern unsigned int __VMALLOC_RESERVE; /* Pure 2^n version of get_order */ static __inline__ int get_order(unsigned long size) diff -Nru a/include/asm-i386/processor.h b/include/asm-i386/processor.h --- a/include/asm-i386/processor.h 2004-09-26 10:25:55 -07:00 +++ b/include/asm-i386/processor.h 2004-09-26 10:25:55 -07:00 @@ -307,6 +307,7 @@ #define IO_BITMAP_LONGS (IO_BITMAP_BYTES/sizeof(long)) #define IO_BITMAP_OFFSET offsetof(struct tss_struct,io_bitmap) #define INVALID_IO_BITMAP_OFFSET 0x8000 +#define INVALID_IO_BITMAP_OFFSET_LAZY 0x9000 struct i387_fsave_struct { long cwd; @@ -360,6 +361,8 @@ unsigned long seg; } mm_segment_t; +struct thread_struct; + struct tss_struct { unsigned short back_link,__blh; unsigned long esp0; @@ -392,9 +395,14 @@ */ unsigned long io_bitmap[IO_BITMAP_LONGS + 1]; /* + * Cache the current maximum and the last task that used the bitmap: + */ + unsigned long io_bitmap_max; + struct thread_struct *io_bitmap_owner; + /* * pads the TSS to be cacheline-aligned (size is 0x100) */ - unsigned long __cacheline_filler[37]; + unsigned long __cacheline_filler[35]; /* * .. and then another 0x100 bytes for emergency kernel stack */ @@ -426,7 +434,7 @@ /* IO permissions */ unsigned long *io_bitmap_ptr; /* max allowed port in the bitmap, in bytes: */ - unsigned int io_bitmap_max; + unsigned long io_bitmap_max; }; #define INIT_THREAD { \ @@ -446,7 +454,7 @@ .ss0 = __KERNEL_DS, \ .ss1 = __KERNEL_CS, \ .ldt = GDT_ENTRY_LDT, \ - .io_bitmap_base = offsetof(struct tss_struct,io_bitmap), \ + .io_bitmap_base = INVALID_IO_BITMAP_OFFSET, \ .io_bitmap = { [ 0 ... IO_BITMAP_LONGS] = ~0 }, \ } diff -Nru a/include/asm-ia64/dma-mapping.h b/include/asm-ia64/dma-mapping.h --- a/include/asm-ia64/dma-mapping.h 2004-09-26 10:25:57 -07:00 +++ b/include/asm-ia64/dma-mapping.h 2004-09-26 10:25:57 -07:00 @@ -6,7 +6,6 @@ * David Mosberger-Tang */ #include -#include #include #define dma_alloc_coherent platform_dma_alloc_coherent diff -Nru a/include/asm-ia64/ia32.h b/include/asm-ia64/ia32.h --- a/include/asm-ia64/ia32.h 2004-09-26 10:25:57 -07:00 +++ b/include/asm-ia64/ia32.h 2004-09-26 10:25:57 -07:00 @@ -14,7 +14,7 @@ # ifdef CONFIG_IA32_SUPPORT extern void ia32_cpu_init (void); -extern void ia32_boot_gdt_init (void); +extern void ia32_mem_init (void); extern void ia32_gdt_init (void); extern int ia32_exception (struct pt_regs *regs, unsigned long isr); extern int ia32_intercept (struct pt_regs *regs, unsigned long isr); diff -Nru a/include/asm-ia64/iosapic.h b/include/asm-ia64/iosapic.h --- a/include/asm-ia64/iosapic.h 2004-09-26 10:25:56 -07:00 +++ b/include/asm-ia64/iosapic.h 2004-09-26 10:25:56 -07:00 @@ -90,6 +90,9 @@ extern unsigned int iosapic_version (char *addr); extern void iosapic_pci_fixup (int); +#ifdef CONFIG_NUMA +extern void __init map_iosapic_to_node (unsigned int, int); +#endif #else #define iosapic_system_init(pcat_compat) do { } while (0) #define iosapic_init(address,gsi_base) do { } while (0) diff -Nru a/include/asm-ia64/mca_asm.h b/include/asm-ia64/mca_asm.h --- a/include/asm-ia64/mca_asm.h 2004-09-26 10:25:57 -07:00 +++ b/include/asm-ia64/mca_asm.h 2004-09-26 10:25:57 -07:00 @@ -162,9 +162,6 @@ ;; \ srlz.d; \ mov r13 = ar.k6; \ - ;; \ - DATA_PA_TO_VA(r13,temp1); \ - ;; \ mov temp2 = ar.bspstore; \ ;; \ DATA_PA_TO_VA(temp2,temp1); \ diff -Nru a/include/asm-ia64/siginfo.h b/include/asm-ia64/siginfo.h --- a/include/asm-ia64/siginfo.h 2004-09-26 10:25:57 -07:00 +++ b/include/asm-ia64/siginfo.h 2004-09-26 10:25:57 -07:00 @@ -56,7 +56,6 @@ int _status; /* exit code */ clock_t _utime; clock_t _stime; - struct rusage _rusage; } _sigchld; /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ diff -Nru a/include/asm-ia64/sn/sn2/sn_hwperf.h b/include/asm-ia64/sn/sn2/sn_hwperf.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-ia64/sn/sn2/sn_hwperf.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,218 @@ +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 2004 Silicon Graphics, Inc. All rights reserved. + * + * Data types used by the SN_SAL_HWPERF_OP SAL call for monitoring + * SGI Altix node and router hardware + * + * Mark Goodwin Mon Aug 30 12:23:46 EST 2004 + */ + +#ifndef SN_HWPERF_H +#define SN_HWPERF_H + +/* + * object structure. SN_HWPERF_ENUM_OBJECTS and SN_HWPERF_GET_CPU_INFO + * return an array of these. Do not change this without also + * changing the corresponding SAL code. + */ +#define SN_HWPERF_MAXSTRING 128 +struct sn_hwperf_object_info { + u32 id; + union { + struct { + u64 this_part:1; + u64 is_shared:1; + } fields; + struct { + u64 flags; + u64 reserved; + } b; + } f; + char name[SN_HWPERF_MAXSTRING]; + char location[SN_HWPERF_MAXSTRING]; + u32 ports; +}; + +#define sn_hwp_this_part f.fields.this_part +#define sn_hwp_is_shared f.fields.is_shared +#define sn_hwp_flags f.b.flags + +#define SN_HWPERF_FOREIGN(x) (!(x)->sn_hwp_this_part && !(x)->sn_hwp_is_shared) + +/* numa port structure, SN_HWPERF_ENUM_PORTS returns an array of these */ +struct sn_hwperf_port_info { + u32 port; + u32 conn_id; + u32 conn_port; +}; + +/* for HWPERF_{GET,SET}_MMRS */ +struct sn_hwperf_data { + u64 addr; + u64 data; +}; + +/* user ioctl() argument, see below */ +struct sn_hwperf_ioctl_args { + u64 arg; /* argument, usually an object id */ + u64 sz; /* size of transfer */ + void *ptr; /* pointer to source/target */ + u32 v0; /* second return value */ +}; + +/* + * For SN_HWPERF_{GET,SET}_MMRS and SN_HWPERF_OBJECT_DISTANCE, + * sn_hwperf_ioctl_args.arg can be used to specify a CPU on which + * to call SAL, and whether to use an interprocessor interrupt + * or task migration in order to do so. If the CPU specified is + * SN_HWPERF_ARG_ANY_CPU, then the current CPU will be used. + */ +#define SN_HWPERF_ARG_ANY_CPU 0x7fffffffUL +#define SN_HWPERF_ARG_CPU_MASK 0x7fffffff00000000ULL +#define SN_HWPERF_ARG_USE_IPI_MASK 0x8000000000000000ULL +#define SN_HWPERF_ARG_OBJID_MASK 0x00000000ffffffffULL + +/* + * ioctl requests on the "sn_hwperf" misc device that call SAL. + */ +#define SN_HWPERF_OP_MEM_COPYIN 0x1000 +#define SN_HWPERF_OP_MEM_COPYOUT 0x2000 +#define SN_HWPERF_OP_MASK 0x0fff + +/* + * Determine mem requirement. + * arg don't care + * sz 8 + * p pointer to u64 integer + */ +#define SN_HWPERF_GET_HEAPSIZE 1 + +/* + * Install mem for SAL drvr + * arg don't care + * sz sizeof buffer pointed to by p + * p pointer to buffer for scratch area + */ +#define SN_HWPERF_INSTALL_HEAP 2 + +/* + * Determine number of objects + * arg don't care + * sz 8 + * p pointer to u64 integer + */ +#define SN_HWPERF_OBJECT_COUNT (10|SN_HWPERF_OP_MEM_COPYOUT) + +/* + * Determine object "distance", relative to a cpu. This operation can + * execute on a designated logical cpu number, using either an IPI or + * via task migration. If the cpu number is SN_HWPERF_ANY_CPU, then + * the current CPU is used. See the SN_HWPERF_ARG_* macros above. + * + * arg bitmap of IPI flag, cpu number and object id + * sz 8 + * p pointer to u64 integer + */ +#define SN_HWPERF_OBJECT_DISTANCE (11|SN_HWPERF_OP_MEM_COPYOUT) + +/* + * Enumerate objects. Special case if sz == 8, returns the required + * buffer size. + * arg don't care + * sz sizeof buffer pointed to by p + * p pointer to array of struct sn_hwperf_object_info + */ +#define SN_HWPERF_ENUM_OBJECTS (12|SN_HWPERF_OP_MEM_COPYOUT) + +/* + * Enumerate NumaLink ports for an object. Special case if sz == 8, + * returns the required buffer size. + * arg object id + * sz sizeof buffer pointed to by p + * p pointer to array of struct sn_hwperf_port_info + */ +#define SN_HWPERF_ENUM_PORTS (13|SN_HWPERF_OP_MEM_COPYOUT) + +/* + * SET/GET memory mapped registers. These operations can execute + * on a designated logical cpu number, using either an IPI or via + * task migration. If the cpu number is SN_HWPERF_ANY_CPU, then + * the current CPU is used. See the SN_HWPERF_ARG_* macros above. + * + * arg bitmap of ipi flag, cpu number and object id + * sz sizeof buffer pointed to by p + * p pointer to array of struct sn_hwperf_data + */ +#define SN_HWPERF_SET_MMRS (14|SN_HWPERF_OP_MEM_COPYIN) +#define SN_HWPERF_GET_MMRS (15|SN_HWPERF_OP_MEM_COPYOUT| \ + SN_HWPERF_OP_MEM_COPYIN) +/* + * Lock a shared object + * arg object id + * sz don't care + * p don't care + */ +#define SN_HWPERF_ACQUIRE 16 + +/* + * Unlock a shared object + * arg object id + * sz don't care + * p don't care + */ +#define SN_HWPERF_RELEASE 17 + +/* + * Break a lock on a shared object + * arg object id + * sz don't care + * p don't care + */ +#define SN_HWPERF_FORCE_RELEASE 18 + +/* + * ioctl requests on "sn_hwperf" that do not call SAL + */ + +/* + * get cpu info as an array of hwperf_object_info_t. + * id is logical CPU number, name is description, location + * is geoid (e.g. 001c04#1c). Special case if sz == 8, + * returns the required buffer size. + * + * arg don't care + * sz sizeof buffer pointed to by p + * p pointer to array of struct sn_hwperf_object_info + */ +#define SN_HWPERF_GET_CPU_INFO (100|SN_HWPERF_OP_MEM_COPYOUT) + +/* + * Given an object id, return it's node number (aka cnode). + * arg object id + * sz 8 + * p pointer to u64 integer + */ +#define SN_HWPERF_GET_OBJ_NODE (101|SN_HWPERF_OP_MEM_COPYOUT) + +/* + * Given a node number (cnode), return it's nasid. + * arg ordinal node number (aka cnodeid) + * sz 8 + * p pointer to u64 integer + */ +#define SN_HWPERF_GET_NODE_NASID (102|SN_HWPERF_OP_MEM_COPYOUT) + +/* return codes */ +#define SN_HWPERF_OP_OK 0 +#define SN_HWPERF_OP_NOMEM 1 +#define SN_HWPERF_OP_NO_PERM 2 +#define SN_HWPERF_OP_IO_ERROR 3 +#define SN_HWPERF_OP_BUSY 4 +#define SN_HWPERF_OP_RECONFIGURE 253 +#define SN_HWPERF_OP_INVAL 254 + +#endif /* SN_HWPERF_H */ diff -Nru a/include/asm-ia64/sn/sn_sal.h b/include/asm-ia64/sn/sn_sal.h --- a/include/asm-ia64/sn/sn_sal.h 2004-09-26 10:25:57 -07:00 +++ b/include/asm-ia64/sn/sn_sal.h 2004-09-26 10:25:57 -07:00 @@ -61,6 +61,7 @@ #define SN_SAL_SYSCTL_IOBRICK_PCI_OP 0x02000042 // reentrant #define SN_SAL_IROUTER_OP 0x02000043 +#define SN_SAL_HWPERF_OP 0x02000050 // lock /* * Service-specific constants @@ -841,6 +842,23 @@ struct ia64_sal_retval rv; SAL_CALL_REENTRANT(rv, SN_SAL_IROUTER_OP, SAL_IROUTER_INIT, (u64) nasid, (u64) buf, (u64) len, 0, 0, 0); + return (int) rv.status; +} + +/* + * This is the access point to the Altix PROM hardware performance + * and status monitoring interface. For info on using this, see + * include/asm-ia64/sn/sn2/sn_hwperf.h + */ +static inline int +ia64_sn_hwperf_op(nasid_t nasid, u64 opcode, u64 a0, u64 a1, u64 a2, + u64 a3, u64 a4, int *v0) +{ + struct ia64_sal_retval rv; + SAL_CALL_NOLOCK(rv, SN_SAL_HWPERF_OP, (u64)nasid, + opcode, a0, a1, a2, a3, a4); + if (v0) + *v0 = (int) rv.v0; return (int) rv.status; } diff -Nru a/include/asm-m32r/a.out.h b/include/asm-m32r/a.out.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/a.out.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,28 @@ +#ifndef _ASM_M32R_A_OUT_H +#define _ASM_M32R_A_OUT_H + +/* orig : i386 2.4.18 */ + +struct exec +{ + unsigned long a_info; /* Use macros N_MAGIC, etc for access */ + unsigned a_text; /* length of text, in bytes */ + unsigned a_data; /* length of data, in bytes */ + unsigned a_bss; /* length of uninitialized data area for file, in bytes */ + unsigned a_syms; /* length of symbol table data in file, in bytes */ + unsigned a_entry; /* start address */ + unsigned a_trsize; /* length of relocation info for text, in bytes */ + unsigned a_drsize; /* length of relocation info for data, in bytes */ +}; + +#define N_TRSIZE(a) ((a).a_trsize) +#define N_DRSIZE(a) ((a).a_drsize) +#define N_SYMSIZE(a) ((a).a_syms) + +#ifdef __KERNEL__ + +#define STACK_TOP TASK_SIZE + +#endif + +#endif /* _ASM_M32R_A_OUT_H */ diff -Nru a/include/asm-m32r/addrspace.h b/include/asm-m32r/addrspace.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/addrspace.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,58 @@ +/* $Id$ */ +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 2001 by Hiroyuki Kondo + * + * Defitions for the address spaces of the M32R CPUs. + */ +#ifndef __ASM_M32R_ADDRSPACE_H +#define __ASM_M32R_ADDRSPACE_H + +/* + * Memory segments (32bit kernel mode addresses) + */ +#define KUSEG 0x00000000 +#define KSEG0 0x80000000 +#define KSEG1 0xa0000000 +#define KSEG2 0xc0000000 +#define KSEG3 0xe0000000 + +#define K0BASE KSEG0 + +/* + * Returns the kernel segment base of a given address + */ +#ifndef __ASSEMBLY__ +#define KSEGX(a) (((unsigned long)(a)) & 0xe0000000) +#else +#define KSEGX(a) ((a) & 0xe0000000) +#endif + +/* + * Returns the physical address of a KSEG0/KSEG1 address + */ +#ifndef __ASSEMBLY__ +#define PHYSADDR(a) (((unsigned long)(a)) & 0x1fffffff) +#else +#define PHYSADDR(a) ((a) & 0x1fffffff) +#endif + +/* + * Map an address to a certain kernel segment + */ +#ifndef __ASSEMBLY__ +#define KSEG0ADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | KSEG0)) +#define KSEG1ADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | KSEG1)) +#define KSEG2ADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | KSEG2)) +#define KSEG3ADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | KSEG3)) +#else +#define KSEG0ADDR(a) (((a) & 0x1fffffff) | KSEG0) +#define KSEG1ADDR(a) (((a) & 0x1fffffff) | KSEG1) +#define KSEG2ADDR(a) (((a) & 0x1fffffff) | KSEG2) +#define KSEG3ADDR(a) (((a) & 0x1fffffff) | KSEG3) +#endif + +#endif /* __ASM_M32R_ADDRSPACE_H */ diff -Nru a/include/asm-m32r/assembler.h b/include/asm-m32r/assembler.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/assembler.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,212 @@ +#ifndef _ASM_M32R_ASSEMBLER_H +#define _ASM_M32R_ASSEMBLER_H + +/* $Id$ */ + +/* + * linux/asm-m32r/assembler.h + * + * This file contains M32R architecture specific defines. + * + * Do not include any C declarations in this file - it is included by + * assembler source. + */ + +#include + + +#undef ENTRY +#define ENTRY(name) ENTRY_M name + .macro ENTRY_M name + .global \name + ALIGN +\name: + .endm + +/* + * LDIMM: load immediate value + * + * STI: enable interruption + * CLI: disable interruption + */ + +#ifdef __ASSEMBLY__ + +#define LDIMM(reg,x) LDIMM reg x + .macro LDIMM reg x + seth \reg, #high(\x) + or3 \reg, \reg, #low(\x) + .endm + +#if !defined(CONFIG_CHIP_M32102) +#define STI(reg) STI_M reg + .macro STI_M reg + setpsw #0x40 -> nop + ; WORKAROUND: "-> nop" is a workaround for the M32700(TS1). + .endm + +#define CLI(reg) CLI_M reg + .macro CLI_M reg + clrpsw #0x40 -> nop + ; WORKAROUND: "-> nop" is a workaround for the M32700(TS1). + .endm +#else /* CONFIG_CHIP_M32102 */ +#define STI(reg) STI_M reg + .macro STI_M reg + mvfc \reg, psw + or3 \reg, \reg, #0x0040 + mvtc \reg, psw + .endm + +#define CLI(reg) CLI_M reg + .macro CLI_M reg + mvfc \reg, psw + and3 \reg, \reg, #0xffbf + mvtc \reg, psw + .endm +#endif /* CONFIG_CHIP_M32102 */ + + .macro SAVE_ALL + push r0 ; orig_r0 + push sp ; spi (r15) + push lr ; r14 + push r13 + mvfc r13, cr3 ; spu + push r13 + mvfc r13, bbpc + push r13 + mvfc r13, bbpsw + push r13 + mvfc r13, bpc + push r13 + mvfc r13, psw + push r13 +#if defined(CONFIG_ISA_M32R2) && defined(CONFIG_ISA_DSP_LEVEL2) + mvfaclo r13, a1 + push r13 + mvfachi r13, a1 + push r13 + mvfaclo r13, a0 + push r13 + mvfachi r13, a0 + push r13 +#elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R) + mvfaclo r13 + push r13 + mvfachi r13 + push r13 +#else +#error unknown isa configuration +#endif + ldi r13, #-1 + push r13 ; syscall_nr (default: -1) + push r12 + push r11 + push r10 + push r9 + push r8 + push r7 + push r3 + push r2 + push r1 + push r0 + addi sp, #-4 ; room for implicit pt_regs parameter + push r6 + push r5 + push r4 + .endm + + .macro RESTORE_ALL + pop r4 + pop r5 + pop r6 + addi sp, #4 + pop r0 + pop r1 + pop r2 + pop r3 + pop r7 + pop r8 + pop r9 + pop r10 + pop r11 + pop r12 + addi r15, #4 ; Skip syscall number +#if defined(CONFIG_ISA_M32R2) && defined(CONFIG_ISA_DSP_LEVEL2) + pop r13 + mvtachi r13, a0 + pop r13 + mvtaclo r13, a0 + pop r13 + mvtachi r13, a1 + pop r13 + mvtaclo r13, a1 +#elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R) + pop r13 + mvtachi r13 + pop r13 + mvtaclo r13 +#else +#error unknown isa configuration +#endif + pop r14 + mvtc r14, psw + pop r14 + mvtc r14, bpc + addi sp, #8 ; Skip bbpsw, bbpc + pop r14 + mvtc r14, cr3 ; spu + pop r13 + pop lr ; r14 + pop sp ; spi (r15) + addi sp, #4 ; Skip orig_r0 + .fillinsn +1: rte + .section .fixup,"ax" +2: bl do_exit + .previous + .section __ex_table,"a" + ALIGN + .long 1b, 2b + .previous + .endm + +#define GET_CURRENT(reg) get_current reg + .macro get_current reg + ldi \reg, #-8192 + and \reg, sp + .endm + +#if !defined(CONFIG_CHIP_M32102) + .macro SWITCH_TO_KERNEL_STACK + ; switch to kernel stack (spi) + clrpsw #0x80 -> nop + .endm +#else /* CONFIG_CHIP_M32102 */ + .macro SWITCH_TO_KERNEL_STACK + push r0 ; save r0 for working + mvfc r0, psw + and3 r0, r0, #0x00ff7f + mvtc r0, psw + slli r0, #16 + bltz r0, 1f ; check BSM-bit +; + ;; called from kernel context: previous stack = spi + pop r0 ; retrieve r0 + bra 2f + .fillinsn +1: + ;; called from user context: previous stack = spu + mvfc r0, cr3 ; spu + addi r0, #4 + mvtc r0, cr3 ; spu + ld r0, @(-4,r0) ; retrieve r0 + .fillinsn +2: + .endm +#endif /* CONFIG_CHIP_M32102 */ + +#endif /* __ASSEMBLY__ */ + +#endif /* _ASM_M32R_ASSEMBLER_H */ + diff -Nru a/include/asm-m32r/atomic.h b/include/asm-m32r/atomic.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/atomic.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,305 @@ +#ifndef _ASM_M32R_ATOMIC_H +#define _ASM_M32R_ATOMIC_H + +/* + * linux/include/asm-m32r/atomic.h + * + * M32R version: + * Copyright (C) 2001, 2002 Hitoshi Yamamoto + * Copyright (C) 2004 Hirokazu Takata + */ + +#include +#include + +/* + * Atomic operations that C can't guarantee us. Useful for + * resource counting etc.. + */ + +#undef LOAD +#undef STORE +#ifdef CONFIG_SMP +#define LOAD "lock" +#define STORE "unlock" +#else +#define LOAD "ld" +#define STORE "st" +#endif + +/* + * Make sure gcc doesn't try to be clever and move things around + * on us. We need to use _exactly_ the address the user gave us, + * not some alias that contains the same information. + */ +typedef struct { volatile int counter; } atomic_t; + +#define ATOMIC_INIT(i) { (i) } + +/** + * atomic_read - read atomic variable + * @v: pointer of type atomic_t + * + * Atomically reads the value of @v. + */ +#define atomic_read(v) ((v)->counter) + +/** + * atomic_set - set atomic variable + * @v: pointer of type atomic_t + * @i: required value + * + * Atomically sets the value of @v to @i. + */ +#define atomic_set(v,i) (((v)->counter) = (i)) + +/** + * atomic_add_return - add integer to atomic variable and return it + * @i: integer value to add + * @v: pointer of type atomic_t + * + * Atomically adds @i to @v and return (@i + @v). + */ +static inline int atomic_add_return(int i, atomic_t *v) +{ + unsigned long flags; + int result; + + local_irq_save(flags); + __asm__ __volatile__ ( + "# atomic_add_return \n\t" + DCACHE_CLEAR("%0", "r4", "%1") + LOAD" %0, @%1; \n\t" + "add %0, %2; \n\t" + STORE" %0, @%1; \n\t" + : "=&r" (result) + : "r" (&v->counter), "r" (i) + : "memory" +#ifdef CONFIG_CHIP_M32700_TS1 + , "r4" +#endif /* CONFIG_CHIP_M32700_TS1 */ + ); + local_irq_restore(flags); + + return result; +} + +/** + * atomic_sub_return - subtract integer from atomic variable and return it + * @i: integer value to subtract + * @v: pointer of type atomic_t + * + * Atomically subtracts @i from @v and return (@v - @i). + */ +static inline int atomic_sub_return(int i, atomic_t *v) +{ + unsigned long flags; + int result; + + local_irq_save(flags); + __asm__ __volatile__ ( + "# atomic_sub_return \n\t" + DCACHE_CLEAR("%0", "r4", "%1") + LOAD" %0, @%1; \n\t" + "sub %0, %2; \n\t" + STORE" %0, @%1; \n\t" + : "=&r" (result) + : "r" (&v->counter), "r" (i) + : "memory" +#ifdef CONFIG_CHIP_M32700_TS1 + , "r4" +#endif /* CONFIG_CHIP_M32700_TS1 */ + ); + local_irq_restore(flags); + + return result; +} + +/** + * atomic_add - add integer to atomic variable + * @i: integer value to add + * @v: pointer of type atomic_t + * + * Atomically adds @i to @v. + */ +#define atomic_add(i,v) ((void) atomic_add_return((i), (v))) + +/** + * atomic_sub - subtract the atomic variable + * @i: integer value to subtract + * @v: pointer of type atomic_t + * + * Atomically subtracts @i from @v. + */ +#define atomic_sub(i,v) ((void) atomic_sub_return((i), (v))) + +/** + * atomic_sub_and_test - subtract value from variable and test result + * @i: integer value to subtract + * @v: pointer of type atomic_t + * + * Atomically subtracts @i from @v and returns + * true if the result is zero, or false for all + * other cases. + */ +#define atomic_sub_and_test(i,v) (atomic_sub_return((i), (v)) == 0) + +/** + * atomic_inc_return - increment atomic variable and return it + * @v: pointer of type atomic_t + * + * Atomically increments @v by 1 and returns the result. + */ +static inline int atomic_inc_return(atomic_t *v) +{ + unsigned long flags; + int result; + + local_irq_save(flags); + __asm__ __volatile__ ( + "# atomic_inc_return \n\t" + DCACHE_CLEAR("%0", "r4", "%1") + LOAD" %0, @%1; \n\t" + "addi %0, #1; \n\t" + STORE" %0, @%1; \n\t" + : "=&r" (result) + : "r" (&v->counter) + : "memory" +#ifdef CONFIG_CHIP_M32700_TS1 + , "r4" +#endif /* CONFIG_CHIP_M32700_TS1 */ + ); + local_irq_restore(flags); + + return result; +} + +/** + * atomic_dec_return - decrement atomic variable and return it + * @v: pointer of type atomic_t + * + * Atomically decrements @v by 1 and returns the result. + */ +static inline int atomic_dec_return(atomic_t *v) +{ + unsigned long flags; + int result; + + local_irq_save(flags); + __asm__ __volatile__ ( + "# atomic_dec_return \n\t" + DCACHE_CLEAR("%0", "r4", "%1") + LOAD" %0, @%1; \n\t" + "addi %0, #-1; \n\t" + STORE" %0, @%1; \n\t" + : "=&r" (result) + : "r" (&v->counter) + : "memory" +#ifdef CONFIG_CHIP_M32700_TS1 + , "r4" +#endif /* CONFIG_CHIP_M32700_TS1 */ + ); + local_irq_restore(flags); + + return result; +} + +/** + * atomic_inc - increment atomic variable + * @v: pointer of type atomic_t + * + * Atomically increments @v by 1. + */ +#define atomic_inc(v) ((void)atomic_inc_return(v)) + +/** + * atomic_dec - decrement atomic variable + * @v: pointer of type atomic_t + * + * Atomically decrements @v by 1. + */ +#define atomic_dec(v) ((void)atomic_dec_return(v)) + +/** + * atomic_inc_and_test - increment and test + * @v: pointer of type atomic_t + * + * Atomically increments @v by 1 + * and returns true if the result is zero, or false for all + * other cases. + */ +#define atomic_inc_and_test(v) (atomic_inc_return(v) == 0) + +/** + * atomic_dec_and_test - decrement and test + * @v: pointer of type atomic_t + * + * Atomically decrements @v by 1 and + * returns true if the result is 0, or false for all + * other cases. + */ +#define atomic_dec_and_test(v) (atomic_dec_return(v) == 0) + +/** + * atomic_add_negative - add and test if negative + * @v: pointer of type atomic_t + * @i: integer value to add + * + * Atomically adds @i to @v and returns true + * if the result is negative, or false when + * result is greater than or equal to zero. + */ +#define atomic_add_negative(i,v) (atomic_add_return((i), (v)) < 0) + +static inline void atomic_clear_mask(unsigned long mask, atomic_t *addr) +{ + unsigned long flags; + unsigned long tmp; + + local_irq_save(flags); + __asm__ __volatile__ ( + "# atomic_clear_mask \n\t" + DCACHE_CLEAR("%0", "r5", "%1") + LOAD" %0, @%1; \n\t" + "and %0, %2; \n\t" + STORE" %0, @%1; \n\t" + : "=&r" (tmp) + : "r" (addr), "r" (~mask) + : "memory" +#ifdef CONFIG_CHIP_M32700_TS1 + , "r5" +#endif /* CONFIG_CHIP_M32700_TS1 */ + ); + local_irq_restore(flags); +} + +static inline void atomic_set_mask(unsigned long mask, atomic_t *addr) +{ + unsigned long flags; + unsigned long tmp; + + local_irq_save(flags); + __asm__ __volatile__ ( + "# atomic_set_mask \n\t" + DCACHE_CLEAR("%0", "r5", "%1") + LOAD" %0, @%1; \n\t" + "or %0, %2; \n\t" + STORE" %0, @%1; \n\t" + : "=&r" (tmp) + : "r" (addr), "r" (mask) + : "memory" +#ifdef CONFIG_CHIP_M32700_TS1 + , "r5" +#endif /* CONFIG_CHIP_M32700_TS1 */ + ); + local_irq_restore(flags); +} + +/* Atomic operations are already serializing on m32r */ +#define smp_mb__before_atomic_dec() barrier() +#define smp_mb__after_atomic_dec() barrier() +#define smp_mb__before_atomic_inc() barrier() +#define smp_mb__after_atomic_inc() barrier() + +#endif /* _ASM_M32R_ATOMIC_H */ + diff -Nru a/include/asm-m32r/bitops.h b/include/asm-m32r/bitops.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/bitops.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,712 @@ +#ifndef _ASM_M32R_BITOPS_H +#define _ASM_M32R_BITOPS_H + +/* $Id$ */ + +/* + * linux/include/asm-m32r/bitops.h + * orig : i386 2.4.10 + * + * Copyright 1992, Linus Torvalds. + * + * M32R version: + * Copyright (C) 2001, 2002 Hitoshi Yamamoto + * Copyright (C) 2004 Hirokazu Takata + */ + +#include +#include +#include +#include +#include + +/* + * These have to be done with inline assembly: that way the bit-setting + * is guaranteed to be atomic. All bit operations return 0 if the bit + * was cleared before the operation and != 0 if it was not. + * + * bit 0 is the LSB of addr; bit 32 is the LSB of (addr+1). + */ + +#undef LOAD +#undef STORE +#ifdef CONFIG_SMP +#define LOAD "lock" +#define STORE "unlock" +#else +#define LOAD "ld" +#define STORE "st" +#endif + +/* #define ADDR (*(volatile long *) addr) */ + +/** + * set_bit - Atomically set a bit in memory + * @nr: the bit to set + * @addr: the address to start counting from + * + * This function is atomic and may not be reordered. See __set_bit() + * if you do not require the atomic guarantees. + * Note that @nr may be almost arbitrarily large; this function is not + * restricted to acting on a single-word quantity. + */ +static __inline__ void set_bit(int nr, volatile void * addr) +{ + __u32 mask; + volatile __u32 *a = addr; + unsigned long flags; + + a += (nr >> 5); + mask = (1 << (nr & 0x1F)); + + local_irq_save(flags); + __asm__ __volatile__ ( + DCACHE_CLEAR("r4", "r6", "%0") + LOAD" r4, @%0; \n\t" + "or r4, %1; \n\t" + STORE" r4, @%0; \n\t" + : /* no outputs */ + : "r" (a), "r" (mask) + : "memory", "r4" +#ifdef CONFIG_CHIP_M32700_TS1 + , "r6" +#endif /* CONFIG_CHIP_M32700_TS1 */ + ); + local_irq_restore(flags); +} + +/** + * __set_bit - Set a bit in memory + * @nr: the bit to set + * @addr: the address to start counting from + * + * Unlike set_bit(), this function is non-atomic and may be reordered. + * If it's called on the same region of memory simultaneously, the effect + * may be that only one operation succeeds. + */ +static __inline__ void __set_bit(int nr, volatile void * addr) +{ + __u32 mask; + volatile __u32 *a = addr; + + a += (nr >> 5); + mask = (1 << (nr & 0x1F)); + *a |= mask; +} + +/** + * clear_bit - Clears a bit in memory + * @nr: Bit to clear + * @addr: Address to start counting from + * + * clear_bit() is atomic and may not be reordered. However, it does + * not contain a memory barrier, so if it is used for locking purposes, + * you should call smp_mb__before_clear_bit() and/or smp_mb__after_clear_bit() + * in order to ensure changes are visible on other processors. + */ +static __inline__ void clear_bit(int nr, volatile void * addr) +{ + __u32 mask; + volatile __u32 *a = addr; + unsigned long flags; + + a += (nr >> 5); + mask = (1 << (nr & 0x1F)); + + local_irq_save(flags); + + __asm__ __volatile__ ( + DCACHE_CLEAR("r4", "r6", "%0") + LOAD" r4, @%0; \n\t" + "and r4, %1; \n\t" + STORE" r4, @%0; \n\t" + : /* no outputs */ + : "r" (a), "r" (~mask) + : "memory", "r4" +#ifdef CONFIG_CHIP_M32700_TS1 + , "r6" +#endif /* CONFIG_CHIP_M32700_TS1 */ + ); + local_irq_restore(flags); +} + +static __inline__ void __clear_bit(int nr, volatile unsigned long * addr) +{ + unsigned long mask; + volatile unsigned long *a = addr; + + a += (nr >> 5); + mask = (1 << (nr & 0x1F)); + *a &= ~mask; +} + +#define smp_mb__before_clear_bit() barrier() +#define smp_mb__after_clear_bit() barrier() + +/** + * __change_bit - Toggle a bit in memory + * @nr: the bit to set + * @addr: the address to start counting from + * + * Unlike change_bit(), this function is non-atomic and may be reordered. + * If it's called on the same region of memory simultaneously, the effect + * may be that only one operation succeeds. + */ +static __inline__ void __change_bit(int nr, volatile void * addr) +{ + __u32 mask; + volatile __u32 *a = addr; + + a += (nr >> 5); + mask = (1 << (nr & 0x1F)); + *a ^= mask; +} + +/** + * change_bit - Toggle a bit in memory + * @nr: Bit to clear + * @addr: Address to start counting from + * + * change_bit() is atomic and may not be reordered. + * Note that @nr may be almost arbitrarily large; this function is not + * restricted to acting on a single-word quantity. + */ +static __inline__ void change_bit(int nr, volatile void * addr) +{ + __u32 mask; + volatile __u32 *a = addr; + unsigned long flags; + + a += (nr >> 5); + mask = (1 << (nr & 0x1F)); + + local_irq_save(flags); + __asm__ __volatile__ ( + DCACHE_CLEAR("r4", "r6", "%0") + LOAD" r4, @%0; \n\t" + "xor r4, %1; \n\t" + STORE" r4, @%0; \n\t" + : /* no outputs */ + : "r" (a), "r" (mask) + : "memory", "r4" +#ifdef CONFIG_CHIP_M32700_TS1 + , "r6" +#endif /* CONFIG_CHIP_M32700_TS1 */ + ); + local_irq_restore(flags); +} + +/** + * test_and_set_bit - Set a bit and return its old value + * @nr: Bit to set + * @addr: Address to count from + * + * This operation is atomic and cannot be reordered. + * It also implies a memory barrier. + */ +static __inline__ int test_and_set_bit(int nr, volatile void * addr) +{ + __u32 mask, oldbit; + volatile __u32 *a = addr; + unsigned long flags; + + a += (nr >> 5); + mask = (1 << (nr & 0x1F)); + + local_irq_save(flags); + __asm__ __volatile__ ( + DCACHE_CLEAR("%0", "r4", "%1") + LOAD" %0, @%1; \n\t" + "mv r4, %0; \n\t" + "and %0, %2; \n\t" + "or r4, %2; \n\t" + STORE" r4, @%1; \n\t" + : "=&r" (oldbit) + : "r" (a), "r" (mask) + : "memory", "r4" + ); + local_irq_restore(flags); + return (oldbit != 0); +} + +/** + * __test_and_set_bit - Set a bit and return its old value + * @nr: Bit to set + * @addr: Address to count from + * + * This operation is non-atomic and can be reordered. + * If two examples of this operation race, one can appear to succeed + * but actually fail. You must protect multiple accesses with a lock. + */ +static __inline__ int __test_and_set_bit(int nr, volatile void * addr) +{ + __u32 mask, oldbit; + volatile __u32 *a = addr; + + a += (nr >> 5); + mask = (1 << (nr & 0x1F)); + oldbit = (*a & mask); + *a |= mask; + + return (oldbit != 0); +} + +/** + * test_and_clear_bit - Clear a bit and return its old value + * @nr: Bit to set + * @addr: Address to count from + * + * This operation is atomic and cannot be reordered. + * It also implies a memory barrier. + */ +static __inline__ int test_and_clear_bit(int nr, volatile void * addr) +{ + __u32 mask, oldbit; + volatile __u32 *a = addr; + unsigned long flags; + + a += (nr >> 5); + mask = (1 << (nr & 0x1F)); + + local_irq_save(flags); + + __asm__ __volatile__ ( + DCACHE_CLEAR("%0", "r4", "%2") + LOAD" %0, @%2; \n\t" + "mv r4, %0; \n\t" + "and %0, %1; \n\t" + "not %1, %1; \n\t" + "and r4, %1; \n\t" + STORE" r4, @%2; \n\t" + : "=&r" (oldbit), "+r" (mask) + : "r" (a) + : "memory", "r4" + ); + local_irq_restore(flags); + + return (oldbit != 0); +} + +/** + * __test_and_clear_bit - Clear a bit and return its old value + * @nr: Bit to set + * @addr: Address to count from + * + * This operation is non-atomic and can be reordered. + * If two examples of this operation race, one can appear to succeed + * but actually fail. You must protect multiple accesses with a lock. + */ +static __inline__ int __test_and_clear_bit(int nr, volatile void * addr) +{ + __u32 mask, oldbit; + volatile __u32 *a = addr; + + a += (nr >> 5); + mask = (1 << (nr & 0x1F)); + oldbit = (*a & mask); + *a &= ~mask; + + return (oldbit != 0); +} + +/* WARNING: non atomic and it can be reordered! */ +static __inline__ int __test_and_change_bit(int nr, volatile void * addr) +{ + __u32 mask, oldbit; + volatile __u32 *a = addr; + + a += (nr >> 5); + mask = (1 << (nr & 0x1F)); + oldbit = (*a & mask); + *a ^= mask; + + return (oldbit != 0); +} + +/** + * test_and_change_bit - Change a bit and return its old value + * @nr: Bit to set + * @addr: Address to count from + * + * This operation is atomic and cannot be reordered. + * It also implies a memory barrier. + */ +static __inline__ int test_and_change_bit(int nr, volatile void * addr) +{ + __u32 mask, oldbit; + volatile __u32 *a = addr; + unsigned long flags; + + a += (nr >> 5); + mask = (1 << (nr & 0x1F)); + + local_irq_save(flags); + __asm__ __volatile__ ( + DCACHE_CLEAR("%0", "r4", "%1") + LOAD" %0, @%1; \n\t" + "mv r4, %0; \n\t" + "and %0, %2; \n\t" + "xor r4, %2; \n\t" + STORE" r4, @%1; \n\t" + : "=&r" (oldbit) + : "r" (a), "r" (mask) + : "memory", "r4" + ); + local_irq_restore(flags); + return (oldbit != 0); +} + +#if 0 /* Fool kernel-doc since it doesn't do macros yet */ +/** + * test_bit - Determine whether a bit is set + * @nr: bit number to test + * @addr: Address to start counting from + */ +static int test_bit(int nr, const volatile void * addr); +#endif + +static __inline__ int test_bit(int nr, const volatile void * addr) +{ + __u32 mask; + const volatile __u32 *a = addr; + + a += (nr >> 5); + mask = (1 << (nr & 0x1F)); + + return ((*a & mask) != 0); +} + +/** + * ffz - find first zero in word. + * @word: The word to search + * + * Undefined if no zero exists, so code should check against ~0UL first. + */ +static __inline__ unsigned long ffz(unsigned long word) +{ + int k; + + word = ~word; + k = 0; + if (!(word & 0x0000ffff)) { k += 16; word >>= 16; } + if (!(word & 0x000000ff)) { k += 8; word >>= 8; } + if (!(word & 0x0000000f)) { k += 4; word >>= 4; } + if (!(word & 0x00000003)) { k += 2; word >>= 2; } + if (!(word & 0x00000001)) { k += 1; } + + return k; +} + +/** + * 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 + * + * Returns the bit-number of the first zero bit, not the number of the byte + * containing a bit. + */ + +#define find_first_zero_bit(addr, size) \ + find_next_zero_bit((addr), (size), 0) + +/** + * find_next_zero_bit - find the first zero 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_zero_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 >> (32-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 << size; +found_middle: + return result + ffz(tmp); +} + +/** + * __ffs - find first bit in word. + * @word: The word to search + * + * Undefined if no bit exists, so code should check against 0 first. + */ +static __inline__ unsigned long __ffs(unsigned long word) +{ + int k = 0; + + if (!(word & 0x0000ffff)) { k += 16; word >>= 16; } + if (!(word & 0x000000ff)) { k += 8; word >>= 8; } + if (!(word & 0x0000000f)) { k += 4; word >>= 4; } + if (!(word & 0x00000003)) { k += 2; word >>= 2; } + if (!(word & 0x00000001)) { k += 1;} + + return k; +} + +/* + * fls: find last bit set. + */ +#define fls(x) generic_fls(x) + +#ifdef __KERNEL__ + +/* + * Every architecture must define this function. It's the fastest + * way of searching a 140-bit bitmap where the first 100 bits are + * unlikely to be set. It's guaranteed that at least one of the 140 + * bits is cleared. + */ +static __inline__ int sched_find_first_bit(unsigned long *b) +{ + if (unlikely(b[0])) + return __ffs(b[0]); + if (unlikely(b[1])) + return __ffs(b[1]) + 32; + if (unlikely(b[2])) + return __ffs(b[2]) + 64; + if (b[3]) + return __ffs(b[3]) + 96; + return __ffs(b[4]) + 128; +} + +/** + * 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__ unsigned long find_next_bit(const unsigned long *addr, + unsigned long size, unsigned long offset) +{ + unsigned int *p = ((unsigned int *) addr) + (offset >> 5); + unsigned int result = offset & ~31UL; + unsigned int 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 >= 32) { + if ((tmp = *p++) != 0) + 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_bit - find the first set bit in a memory region + * @addr: The address to start the search at + * @size: The maximum size to search + * + * Returns the bit-number of the first set bit, not the number of the byte + * containing a bit. + */ +#define find_first_bit(addr, size) \ + find_next_bit((addr), (size), 0) + +/** + * ffs - find first bit set + * @x: the word to search + * + * This is defined the same way as + * the libc and compiler builtin ffs routines, therefore + * differs in spirit from the above ffz (man ffs). + */ +#define ffs(x) generic_ffs(x) + +/** + * hweightN - returns the hamming weight of a N-bit word + * @x: the word to weigh + * + * The Hamming Weight of a number is the total number of bits set in it. + */ + +#define hweight32(x) generic_hweight32(x) +#define hweight16(x) generic_hweight16(x) +#define hweight8(x) generic_hweight8(x) + +#endif /* __KERNEL__ */ + +#ifdef __KERNEL__ + +/* + * ext2_XXXX function + * orig: include/asm-sh/bitops.h + */ + +#ifdef __LITTLE_ENDIAN__ +#define ext2_set_bit test_and_set_bit +#define ext2_clear_bit __test_and_clear_bit +#define ext2_test_bit test_bit +#define ext2_find_first_zero_bit find_first_zero_bit +#define ext2_find_next_zero_bit find_next_zero_bit +#else +static __inline__ int ext2_set_bit(int nr, volatile void * addr) +{ + __u8 mask, oldbit; + volatile __u8 *a = addr; + + a += (nr >> 3); + mask = (1 << (nr & 0x07)); + oldbit = (*a & mask); + *a |= mask; + + return (oldbit != 0); +} + +static __inline__ int ext2_clear_bit(int nr, volatile void * addr) +{ + __u8 mask, oldbit; + volatile __u8 *a = addr; + + a += (nr >> 3); + mask = (1 << (nr & 0x07)); + oldbit = (*a & mask); + *a &= ~mask; + + return (oldbit != 0); +} + +static __inline__ int ext2_test_bit(int nr, const volatile void * addr) +{ + __u32 mask; + const volatile __u8 *a = addr; + + a += (nr >> 3); + mask = (1 << (nr & 0x07)); + + return ((mask & *a) != 0); +} + +#define ext2_find_first_zero_bit(addr, size) \ + ext2_find_next_zero_bit((addr), (size), 0) + +static __inline__ unsigned long ext2_find_next_zero_bit(void *addr, + unsigned long size, unsigned long 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) { + /* We hold the little endian value in tmp, but then the + * shift is illegal. So we could keep a big endian value + * in tmp, like this: + * + * tmp = __swab32(*(p++)); + * tmp |= ~0UL >> (32-offset); + * + * but this would decrease preformance, so we change the + * shift: + */ + tmp = *(p++); + tmp |= __swab32(~0UL >> (32-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 is little endian, so we would have to swab the shift, + * see above. But then we have to swab tmp below for ffz, so + * we might as well do this here. + */ + return result + ffz(__swab32(tmp) | (~0UL << size)); +found_middle: + return result + ffz(__swab32(tmp)); +} +#endif + +#define ext2_set_bit_atomic(lock, nr, addr) \ + ({ \ + int ret; \ + spin_lock(lock); \ + ret = ext2_set_bit((nr), (addr)); \ + spin_unlock(lock); \ + ret; \ + }) + +#define ext2_clear_bit_atomic(lock, nr, addr) \ + ({ \ + int ret; \ + spin_lock(lock); \ + ret = ext2_clear_bit((nr), (addr)); \ + spin_unlock(lock); \ + ret; \ + }) + +/* Bitmap functions for the minix filesystem. */ +#define minix_test_and_set_bit(nr,addr) __test_and_set_bit(nr,addr) +#define minix_set_bit(nr,addr) __set_bit(nr,addr) +#define minix_test_and_clear_bit(nr,addr) __test_and_clear_bit(nr,addr) +#define minix_test_bit(nr,addr) test_bit(nr,addr) +#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size) + +#endif /* __KERNEL__ */ + +#endif /* _ASM_M32R_BITOPS_H */ + diff -Nru a/include/asm-m32r/bug.h b/include/asm-m32r/bug.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/bug.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,22 @@ +#ifndef _M32R_BUG_H +#define _M32R_BUG_H + +#define BUG() do { \ + printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \ +} while (0) + +#define PAGE_BUG(page) do { BUG(); } while (0) + +#define BUG_ON(condition) \ + do { if (unlikely((condition)!=0)) BUG(); } while(0) + +#define WARN_ON(condition) do { \ + if (unlikely((condition)!=0)) { \ + printk("Badness in %s at %s:%d\n", __FUNCTION__, \ + __FILE__, __LINE__); \ + dump_stack(); \ + } \ +} while (0) + +#endif /* _M32R_BUG_H */ + diff -Nru a/include/asm-m32r/bugs.h b/include/asm-m32r/bugs.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/bugs.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,21 @@ +#ifndef _ASM_M32R_BUGS_H +#define _ASM_M32R_BUGS_H + +/* $Id$ */ + +/* + * This is included by init/main.c to check for architecture-dependent bugs. + * + * Needs: + * void check_bugs(void); + */ +#include + +static void __init check_bugs(void) +{ + extern unsigned long loops_per_jiffy; + + current_cpu_data.loops_per_jiffy = loops_per_jiffy; +} + +#endif /* _ASM_M32R_BUGS_H */ diff -Nru a/include/asm-m32r/byteorder.h b/include/asm-m32r/byteorder.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/byteorder.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,19 @@ +#ifndef _ASM_M32R_BYTEORDER_H +#define _ASM_M32R_BYTEORDER_H + +/* $Id$ */ + +#include + +#if !defined(__STRICT_ANSI__) || defined(__KERNEL__) +# define __BYTEORDER_HAS_U64__ +# define __SWAB_64_THRU_32__ +#endif + +#if defined(__LITTLE_ENDIAN__) +# include +#else +# include +#endif + +#endif /* _ASM_M32R_BYTEORDER_H */ diff -Nru a/include/asm-m32r/cache.h b/include/asm-m32r/cache.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/cache.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,12 @@ +#ifndef _ASM_M32R_CACHE_H +#define _ASM_M32R_CACHE_H + +/* $Id$ */ + +/* L1 cache line size */ +#define L1_CACHE_SHIFT 4 +#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) + +#define L1_CACHE_SHIFT_MAX 4 + +#endif /* _ASM_M32R_CACHE_H */ diff -Nru a/include/asm-m32r/cachectl.h b/include/asm-m32r/cachectl.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/cachectl.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,26 @@ +/* + * cachectl.h -- defines for M32R cache control system calls + * + * Copyright (C) 2003 by Kazuhiro Inaoka + */ +#ifndef __ASM_M32R_CACHECTL +#define __ASM_M32R_CACHECTL + +/* + * Options for cacheflush system call + * + * cacheflush() is currently fluch_cache_all(). + */ +#define ICACHE (1<<0) /* flush instruction cache */ +#define DCACHE (1<<1) /* writeback and flush data cache */ +#define BCACHE (ICACHE|DCACHE) /* flush both caches */ + +/* + * Caching modes for the cachectl(2) call + * + * cachectl(2) is currently not supported and returns ENOSYS. + */ +#define CACHEABLE 0 /* make pages cacheable */ +#define UNCACHEABLE 1 /* make pages uncacheable */ + +#endif /* __ASM_M32R_CACHECTL */ diff -Nru a/include/asm-m32r/cacheflush.h b/include/asm-m32r/cacheflush.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/cacheflush.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,68 @@ +#ifndef _ASM_M32R_CACHEFLUSH_H +#define _ASM_M32R_CACHEFLUSH_H + +#include +#include + +extern void _flush_cache_all(void); +extern void _flush_cache_copyback_all(void); + +#if defined(CONFIG_CHIP_M32700) || defined(CONFIG_CHIP_OPSP) +#define flush_cache_all() do { } while (0) +#define flush_cache_mm(mm) do { } while (0) +#define flush_cache_range(vma, start, end) do { } while (0) +#define flush_cache_page(vma, vmaddr) do { } while (0) +#define flush_dcache_page(page) do { } while (0) +#define flush_dcache_mmap_lock(mapping) do { } while (0) +#define flush_dcache_mmap_unlock(mapping) do { } while (0) +#ifndef CONFIG_SMP +#define flush_icache_range(start, end) _flush_cache_copyback_all() +#define flush_icache_page(vma,pg) _flush_cache_copyback_all() +#define flush_icache_user_range(vma,pg,adr,len) _flush_cache_copyback_all() +#define flush_cache_sigtramp(addr) _flush_cache_copyback_all() +#else /* CONFIG_SMP */ +extern void smp_flush_cache_all(void); +#define flush_icache_range(start, end) smp_flush_cache_all() +#define flush_icache_page(vma,pg) smp_flush_cache_all() +#define flush_icache_user_range(vma,pg,adr,len) smp_flush_cache_all() +#define flush_cache_sigtramp(addr) _flush_cache_copyback_all() +#endif /* CONFIG_SMP */ +#elif defined(CONFIG_CHIP_M32102) +#define flush_cache_all() do { } while (0) +#define flush_cache_mm(mm) do { } while (0) +#define flush_cache_range(vma, start, end) do { } while (0) +#define flush_cache_page(vma, vmaddr) do { } while (0) +#define flush_dcache_page(page) do { } while (0) +#define flush_dcache_mmap_lock(mapping) do { } while (0) +#define flush_dcache_mmap_unlock(mapping) do { } while (0) +#define flush_icache_range(start, end) _flush_cache_all() +#define flush_icache_page(vma,pg) _flush_cache_all() +#define flush_icache_user_range(vma,pg,adr,len) _flush_cache_all() +#define flush_cache_sigtramp(addr) _flush_cache_all() +#else +#define flush_cache_all() do { } while (0) +#define flush_cache_mm(mm) do { } while (0) +#define flush_cache_range(vma, start, end) do { } while (0) +#define flush_cache_page(vma, vmaddr) do { } while (0) +#define flush_dcache_page(page) do { } while (0) +#define flush_dcache_mmap_lock(mapping) do { } while (0) +#define flush_dcache_mmap_unlock(mapping) do { } while (0) +#define flush_icache_range(start, end) do { } while (0) +#define flush_icache_page(vma,pg) do { } while (0) +#define flush_icache_user_range(vma,pg,adr,len) do { } while (0) +#define flush_cache_sigtramp(addr) do { } while (0) +#endif /* CONFIG_CHIP_* */ + +#define flush_cache_vmap(start, end) do { } while (0) +#define flush_cache_vunmap(start, end) do { } while (0) + +#define copy_to_user_page(vma, page, vaddr, dst, src, len) \ +do { \ + memcpy(dst, src, len); \ + flush_icache_user_range(vma, page, vaddr, len); \ +} while (0) +#define copy_from_user_page(vma, page, vaddr, dst, src, len) \ + memcpy(dst, src, len) + +#endif /* _ASM_M32R_CACHEFLUSH_H */ + diff -Nru a/include/asm-m32r/checksum.h b/include/asm-m32r/checksum.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/checksum.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,206 @@ +#ifdef __KERNEL__ +#ifndef _ASM_M32R_CHECKSUM_H +#define _ASM_M32R_CHECKSUM_H + +/* + * include/asm-m32r/checksum.h + * + * IP/TCP/UDP checksum routines + * + * 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. + * + * Some code taken from mips and parisc architecture. + * + * Copyright (C) 2001, 2002 Hiroyuki Kondo, Hirokazu Takata + * Copyright (C) 2004 Hirokazu Takata + */ + +#include + +/* + * computes the checksum of a memory block at buff, length len, + * and adds in "sum" (32-bit) + * + * returns a 32-bit number suitable for feeding into itself + * or csum_tcpudp_magic + * + * this function must be called with even lengths, except + * for the last fragment, which may be odd + * + * it's best to have buff aligned on a 32-bit boundary + */ +asmlinkage unsigned int csum_partial(const unsigned char *buff, int len, unsigned int sum); + +/* + * The same as csum_partial, but copies from src while it checksums. + * + * Here even more important to align src and dst on a 32-bit (or even + * better 64-bit) boundary + */ +extern unsigned int csum_partial_copy_nocheck(const char *src, char *dst, + int len, unsigned int sum); + +/* + * This is a new version of the above that records errors it finds in *errp, + * but continues and zeros thre rest of the buffer. + */ +extern unsigned int csum_partial_copy_from_user(const char __user *src, + char *dst, + int len, unsigned int sum, + int *err_ptr); + +/* + * Fold a partial checksum + */ + +static inline unsigned int csum_fold(unsigned int sum) +{ + unsigned long tmpreg; + __asm__( + " sll3 %1, %0, #16 \n" + " cmp %0, %0 \n" + " addx %0, %1 \n" + " ldi %1, #0 \n" + " srli %0, #16 \n" + " addx %0, %1 \n" + " xor3 %0, %0, #0x0000ffff \n" + : "=r" (sum), "=&r" (tmpreg) + : "0" (sum) + : "cbit" + ); + return sum; +} + +/* + * This is a version of ip_compute_csum() optimized for IP headers, + * which always checksum on 4 octet boundaries. + */ +static inline unsigned short ip_fast_csum(unsigned char * iph, + unsigned int ihl) { + unsigned long sum, tmpreg0, tmpreg1; + + __asm__ __volatile__( + " ld %0, @%1+ \n" + " addi %2, #-4 \n" + "# bgez %2, 2f \n" + " cmp %0, %0 \n" + " ld %3, @%1+ \n" + " ld %4, @%1+ \n" + " addx %0, %3 \n" + " ld %3, @%1+ \n" + " addx %0, %4 \n" + " addx %0, %3 \n" + " .fillinsn\n" + "1: \n" + " ld %4, @%1+ \n" + " addi %2, #-1 \n" + " addx %0, %4 \n" + " bgtz %2, 1b \n" + "\n" + " ldi %3, #0 \n" + " addx %0, %3 \n" + " .fillinsn\n" + "2: \n" + /* Since the input registers which are loaded with iph and ipl + are modified, we must also specify them as outputs, or gcc + will assume they contain their original values. */ + : "=&r" (sum), "=r" (iph), "=r" (ihl), "=&r" (tmpreg0), "=&r" (tmpreg1) + : "1" (iph), "2" (ihl) + : "cbit", "memory"); + + return csum_fold(sum); +} + +static inline unsigned long csum_tcpudp_nofold(unsigned long saddr, + unsigned long daddr, + unsigned short len, + unsigned short proto, + unsigned int sum) +{ +#if defined(__LITTLE_ENDIAN) + unsigned long len_proto = (ntohs(len)<<16)+proto*256; +#else + unsigned long len_proto = (proto<<16)+len; +#endif + unsigned long tmpreg; + + __asm__( + " cmp %0, %0 \n" + " addx %0, %2 \n" + " addx %0, %3 \n" + " addx %0, %4 \n" + " ldi %1, #0 \n" + " addx %0, %1 \n" + : "=r" (sum), "=&r" (tmpreg) + : "r" (daddr), "r" (saddr), "r" (len_proto), "0" (sum) + : "cbit" + ); + + return sum; +} + +/* + * computes the checksum of the TCP/UDP pseudo-header + * returns a 16-bit checksum, already complemented + */ +static inline unsigned short int csum_tcpudp_magic(unsigned long saddr, + unsigned long daddr, + unsigned short len, + unsigned short proto, + unsigned int sum) +{ + return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); +} + +/* + * this routine is used for miscellaneous IP-like checksums, mainly + * in icmp.c + */ + +static inline unsigned short ip_compute_csum(unsigned char * buff, int len) { + return csum_fold (csum_partial(buff, len, 0)); +} + +#define _HAVE_ARCH_IPV6_CSUM +static inline unsigned short int csum_ipv6_magic(struct in6_addr *saddr, + struct in6_addr *daddr, + __u16 len, + unsigned short proto, + unsigned int sum) +{ + unsigned long tmpreg0, tmpreg1, tmpreg2, tmpreg3; + __asm__( + " ld %1, @(%5) \n" + " ld %2, @(4,%5) \n" + " ld %3, @(8,%5) \n" + " ld %4, @(12,%5) \n" + " add %0, %1 \n" + " addx %0, %2 \n" + " addx %0, %3 \n" + " addx %0, %4 \n" + " ld %1, @(%6) \n" + " ld %2, @(4,%6) \n" + " ld %3, @(8,%6) \n" + " ld %4, @(12,%6) \n" + " addx %0, %1 \n" + " addx %0, %2 \n" + " addx %0, %3 \n" + " addx %0, %4 \n" + " addx %0, %7 \n" + " addx %0, %8 \n" + " ldi %1, #0 \n" + " addx %0, %1 \n" + : "=&r" (sum), "=&r" (tmpreg0), "=&r" (tmpreg1), + "=&r" (tmpreg2), "=&r" (tmpreg3) + : "r" (saddr), "r" (daddr), + "r" (htonl((__u32) (len))), "r" (htonl(proto)), "0" (sum) + : "cbit" + ); + + return csum_fold(sum); +} + +#endif /* _ASM_M32R_CHECKSUM_H */ +#endif /* __KERNEL__ */ diff -Nru a/include/asm-m32r/current.h b/include/asm-m32r/current.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/current.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,18 @@ +#ifndef _ASM_M32R_CURRENT_H +#define _ASM_M32R_CURRENT_H + +/* $Id$ */ + +#include + +struct task_struct; + +static __inline__ struct task_struct *get_current(void) +{ + return current_thread_info()->task; +} + +#define current (get_current()) + +#endif /* _ASM_M32R_CURRENT_H */ + diff -Nru a/include/asm-m32r/delay.h b/include/asm-m32r/delay.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/delay.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,28 @@ +#ifndef _ASM_M32R_DELAY_H +#define _ASM_M32R_DELAY_H + +/* $Id$ */ + +/* + * Copyright (C) 1993 Linus Torvalds + * + * Delay routines calling functions in arch/m32r/lib/delay.c + */ + +extern void __bad_udelay(void); +extern void __bad_ndelay(void); + +extern void __udelay(unsigned long usecs); +extern void __ndelay(unsigned long nsecs); +extern void __const_udelay(unsigned long usecs); +extern void __delay(unsigned long loops); + +#define udelay(n) (__builtin_constant_p(n) ? \ + ((n) > 20000 ? __bad_udelay() : __const_udelay((n) * 0x10c7ul)) : \ + __udelay(n)) + +#define ndelay(n) (__builtin_constant_p(n) ? \ + ((n) > 20000 ? __bad_ndelay() : __const_udelay((n) * 5ul)) : \ + __ndelay(n)) + +#endif /* _ASM_M32R_DELAY_H */ diff -Nru a/include/asm-m32r/div64.h b/include/asm-m32r/div64.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/div64.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,38 @@ +#ifndef _ASM_M32R_DIV64 +#define _ASM_M32R_DIV64 + +/* $Id$ */ + +/* unsigned long long division. + * Input: + * unsigned long long n + * unsigned long base + * Output: + * n = n / base; + * return value = n % base; + */ +#define do_div(n, base) \ +({ \ + unsigned long _res, _high, _mid, _low; \ + \ + _low = (n) & 0xffffffffUL; \ + _high = (n) >> 32; \ + if (_high) { \ + _mid = (_high % (unsigned long)(base)) << 16; \ + _high = _high / (unsigned long)(base); \ + _mid += _low >> 16; \ + _low &= 0x0000ffffUL; \ + _low += (_mid % (unsigned long)(base)) << 16; \ + _mid = _mid / (unsigned long)(base); \ + _res = _low % (unsigned long)(base); \ + _low = _low / (unsigned long)(base); \ + n = _low + ((long long)_mid << 16) + \ + ((long long)_high << 32); \ + } else { \ + _res = _low % (unsigned long)(base); \ + n = (_low / (unsigned long)(base)); \ + } \ + _res; \ +}) + +#endif /* _ASM_M32R_DIV64 */ diff -Nru a/include/asm-m32r/dma-mapping.h b/include/asm-m32r/dma-mapping.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/dma-mapping.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,23 @@ +#ifndef _ASM_M32R_DMA_MAPPING_H +#define _ASM_M32R_DMA_MAPPING_H + +/* + * NOTE: Do not include + * Because it requires PCI stuffs, but current M32R don't provide these. + */ + +static inline void * +dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, + int flag) +{ + return (void *)NULL; +} + +static inline void +dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, + dma_addr_t dma_handle) +{ + return; +} + +#endif /* _ASM_M32R_DMA_MAPPING_H */ diff -Nru a/include/asm-m32r/dma.h b/include/asm-m32r/dma.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/dma.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,14 @@ +#ifndef _ASM_M32R_DMA_H +#define _ASM_M32R_DMA_H + +/* $Id$ */ + +#include + +/* + * The maximum address that we can perform a DMA transfer + * to on this platform + */ +#define MAX_DMA_ADDRESS (PAGE_OFFSET+0x20000000) + +#endif /* _ASM_M32R_DMA_H */ diff -Nru a/include/asm-m32r/elf.h b/include/asm-m32r/elf.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/elf.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,172 @@ +#ifndef _ASM_M32R__ELF_H +#define _ASM_M32R__ELF_H + +/* + * ELF-specific definitions. + * + * Copyright (C) 1999-2004, Renesas Technology Corp. + * Hirokazu Takata + */ + +#include +#include +#include + +/* M32R relocation types */ +#define R_M32R_NONE 0 +#define R_M32R_16 1 +#define R_M32R_32 2 +#define R_M32R_24 3 +#define R_M32R_10_PCREL 4 +#define R_M32R_18_PCREL 5 +#define R_M32R_26_PCREL 6 +#define R_M32R_HI16_ULO 7 +#define R_M32R_HI16_SLO 8 +#define R_M32R_LO16 9 +#define R_M32R_SDA16 10 +#ifdef OLD_TYPE +#define R_M32R_GOT24 11 +#define R_M32R_26_PLTREL 12 +#define R_M32R_GOT16_HI_ULO 13 +#define R_M32R_GOT16_HI_SLO 14 +#define R_M32R_GOT16_LO 15 +#define R_M32R_GOTPC24 16 +#define R_M32R_COPY 17 +#define R_M32R_GLOB_DAT 18 +#define R_M32R_JMP_SLOT 19 +#define R_M32R_RELATIVE 20 +#define R_M32R_GNU_VTINHERIT 21 +#define R_M32R_GNU_VTENTRY 22 + +#define R_M32R_16_RELA R_M32R_16 +#define R_M32R_32_RELA R_M32R_32 +#define R_M32R_24_RELA R_M32R_24 +#define R_M32R_10_PCREL_RELA R_M32R_10_PCREL +#define R_M32R_18_PCREL_RELA R_M32R_18_PCREL +#define R_M32R_26_PCREL_RELA R_M32R_26_PCREL +#define R_M32R_HI16_ULO_RELA R_M32R_HI16_ULO +#define R_M32R_HI16_SLO_RELA R_M32R_HI16_SLO +#define R_M32R_LO16_RELA R_M32R_LO16 +#define R_M32R_SDA16_RELA R_M32R_SDA16 +#else /* not OLD_TYPE */ +#define R_M32R_GNU_VTINHERIT 11 +#define R_M32R_GNU_VTENTRY 12 + +#define R_M32R_GOT24_SAMPLE 11 /* comflict */ +#define R_M32R_26_PLTREL_SAMPLE 12 /* comflict */ +#define R_M32R_GOT16_HI_ULO_SAMPLE 13 +#define R_M32R_GOT16_HI_SLO_SAMPLE 14 +#define R_M32R_GOT16_LO_SAMPLE 15 +#define R_M32R_GOTPC24_SAMPLE 16 +#define R_M32R_COPY_SAMPLE 17 +#define R_M32R_GLOB_DAT_SAMPLE 18 +#define R_M32R_JMP_SLOT_SAMPLE 19 +#define R_M32R_RELATIVE_SAMPLE 20 +#define R_M32R_GNU_VTINHERIT_SAMPLE 21 +#define R_M32R_GNU_VTENTRY_SAMPLE 22 + +#define R_M32R_16_RELA 33 +#define R_M32R_32_RELA 34 +#define R_M32R_24_RELA 35 +#define R_M32R_10_PCREL_RELA 36 +#define R_M32R_18_PCREL_RELA 37 +#define R_M32R_26_PCREL_RELA 38 +#define R_M32R_HI16_ULO_RELA 39 +#define R_M32R_HI16_SLO_RELA 40 +#define R_M32R_LO16_RELA 41 +#define R_M32R_SDA16_RELA 42 +#define R_M32R_RELA_GNU_VTINHERIT 43 +#define R_M32R_RELA_GNU_VTENTRY 44 + +#define R_M32R_GOT24 48 +#define R_M32R_26_PLTREL 49 +#define R_M32R_COPY 50 +#define R_M32R_GLOB_DAT 51 +#define R_M32R_JMP_SLOT 52 +#define R_M32R_RELATIVE 53 +#define R_M32R_GOTOFF 54 +#define R_M32R_GOTPC24 55 +#define R_M32R_GOT16_HI_ULO 56 +#define R_M32R_GOT16_HI_SLO 57 +#define R_M32R_GOT16_LO 58 +#define R_M32R_GOTPC_HI_ULO 59 +#define R_M32R_GOTPC_HI_SLO 60 +#define R_M32R_GOTPC_LO 61 +#endif /* not OLD_TYPE */ + +#define R_M32R_NUM 256 + +/* + * ELF register definitions.. + */ +#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t)) + +typedef unsigned long elf_greg_t; +typedef elf_greg_t elf_gregset_t[ELF_NGREG]; + +/* We have no FP mumumu. */ +typedef double elf_fpreg_t; +typedef elf_fpreg_t elf_fpregset_t; + +/* + * This is used to ensure we don't load something for the wrong architecture. + */ +#define elf_check_arch(x) \ + (((x)->e_machine == EM_M32R) || ((x)->e_machine == EM_CYGNUS_M32R)) + +/* + * These are used to set parameters in the core dumps. + */ +#define ELF_CLASS ELFCLASS32 +#if defined(__LITTLE_ENDIAN) +#define ELF_DATA ELFDATA2LSB +#elif defined(__BIG_ENDIAN) +#define ELF_DATA ELFDATA2MSB +#else +#error no endian defined +#endif +#define ELF_ARCH EM_M32R + +/* r0 is set by ld.so to a pointer to a function which might be + * registered using 'atexit'. This provides a mean for the dynamic + * linker to call DT_FINI functions for shared libraries that have + * been loaded before the code runs. + * + * So that we can use the same startup file with static executables, + * we start programs with a value of 0 to indicate that there is no + * such function. + */ +#define ELF_PLAT_INIT(_r, load_addr) (_r)->r0 = 0 + +#define USE_ELF_CORE_DUMP +#define ELF_EXEC_PAGESIZE PAGE_SIZE + +/* + * This is the location that an ET_DYN program is loaded if exec'ed. + * Typical use of this is to invoke "./ld.so someprog" to test out a + * new version of the loader. We need to make sure that it is out of + * the way of the program that it will "exec", and that there is + * sufficient room for the brk. + */ +#define ELF_ET_DYN_BASE (TASK_SIZE / 3 * 2) + +/* regs is struct pt_regs, pr_reg is elf_gregset_t (which is + now struct_user_regs, they are different) */ + +#define ELF_CORE_COPY_REGS(pr_reg, regs) \ + memcpy((char *)&pr_reg, (char *)®s, sizeof (struct pt_regs)); + +/* This yields a mask that user programs can use to figure out what + instruction set this CPU supports. */ +#define ELF_HWCAP (0) + +/* This yields a string that ld.so will use to load implementation + specific libraries for optimization. This is more specific in + intent than poking at uname or /proc/cpuinfo. */ +#define ELF_PLATFORM (NULL) + +#ifdef __KERNEL__ +#define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX) +#endif + +#endif /* _ASM_M32R__ELF_H */ diff -Nru a/include/asm-m32r/errno.h b/include/asm-m32r/errno.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/errno.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,9 @@ +#ifndef _ASM_M32R_ERRNO_H +#define _ASM_M32R_ERRNO_H + +/* $Id$ */ + +#include + +#endif /* _ASM_M32R_ERRNO_H */ + diff -Nru a/include/asm-m32r/fcntl.h b/include/asm-m32r/fcntl.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/fcntl.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,92 @@ +#ifndef _ASM_M32R_FCNTL_H +#define _ASM_M32R_FCNTL_H + +/* $Id$ */ + +/* orig : i386 2.4.18 */ + +/* open/fcntl - O_SYNC is only implemented on blocks devices and on files + located on an ext2 file system */ +#define O_ACCMODE 0003 +#define O_RDONLY 00 +#define O_WRONLY 01 +#define O_RDWR 02 +#define O_CREAT 0100 /* not fcntl */ +#define O_EXCL 0200 /* not fcntl */ +#define O_NOCTTY 0400 /* not fcntl */ +#define O_TRUNC 01000 /* not fcntl */ +#define O_APPEND 02000 +#define O_NONBLOCK 04000 +#define O_NDELAY O_NONBLOCK +#define O_SYNC 010000 +#define FASYNC 020000 /* fcntl, for BSD compatibility */ +#define O_DIRECT 040000 /* direct disk access hint */ +#define O_LARGEFILE 0100000 +#define O_DIRECTORY 0200000 /* must be a directory */ +#define O_NOFOLLOW 0400000 /* don't follow links */ +#define O_NOATIME 01000000 + +#define F_DUPFD 0 /* dup */ +#define F_GETFD 1 /* get close_on_exec */ +#define F_SETFD 2 /* set/clear close_on_exec */ +#define F_GETFL 3 /* get file->f_flags */ +#define F_SETFL 4 /* set file->f_flags */ +#define F_GETLK 5 +#define F_SETLK 6 +#define F_SETLKW 7 + +#define F_SETOWN 8 /* for sockets. */ +#define F_GETOWN 9 /* for sockets. */ +#define F_SETSIG 10 /* for sockets. */ +#define F_GETSIG 11 /* for sockets. */ + +#define F_GETLK64 12 /* using 'struct flock64' */ +#define F_SETLK64 13 +#define F_SETLKW64 14 + +/* for F_[GET|SET]FL */ +#define FD_CLOEXEC 1 /* actually anything with low bit set goes */ + +/* for posix fcntl() and lockf() */ +#define F_RDLCK 0 +#define F_WRLCK 1 +#define F_UNLCK 2 + +/* for old implementation of bsd flock () */ +#define F_EXLCK 4 /* or 3 */ +#define F_SHLCK 8 /* or 4 */ + +/* for leases */ +#define F_INPROGRESS 16 + +/* operations for bsd flock(), also used by the kernel implementation */ +#define LOCK_SH 1 /* shared lock */ +#define LOCK_EX 2 /* exclusive lock */ +#define LOCK_NB 4 /* or'd with one of the above to prevent + blocking */ +#define LOCK_UN 8 /* remove lock */ + +#define LOCK_MAND 32 /* This is a mandatory flock */ +#define LOCK_READ 64 /* ... Which allows concurrent read operations */ +#define LOCK_WRITE 128 /* ... Which allows concurrent write operations */ +#define LOCK_RW 192 /* ... Which allows concurrent read & write ops */ + +struct flock { + short l_type; + short l_whence; + off_t l_start; + off_t l_len; + pid_t l_pid; +}; + +struct flock64 { + short l_type; + short l_whence; + loff_t l_start; + loff_t l_len; + pid_t l_pid; +}; + +#define F_LINUX_SPECIFIC_BASE 1024 + +#endif /* _ASM_M32R_FCNTL_H */ diff -Nru a/include/asm-m32r/flat.h b/include/asm-m32r/flat.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/flat.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,145 @@ +/* + * include/asm-m32r/flat.h + * + * uClinux flat-format executables + * + * Copyright (C) 2004 Kazuhiro Inaoka + * + * 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. + */ +#ifndef __ASM_M32R_FLAT_H +#define __ASM_M32R_FLAT_H + +#define flat_stack_align(sp) (*sp += (*sp & 3 ? (4 - (*sp & 3)): 0)) +#define flat_argvp_envp_on_stack() 0 +#define flat_old_ram_flag(flags) (flags) +#define flat_reloc_valid(reloc, size) \ + (((reloc) - textlen_for_m32r_lo16_data) <= (size)) +#define flat_get_addr_from_rp(rp, relval, flags) \ + m32r_flat_get_addr_from_rp(rp, relval, (text_len) ) + +#define flat_put_addr_at_rp(rp, addr, relval) \ + m32r_flat_put_addr_at_rp(rp, addr, relval) + +/* Convert a relocation entry into an address. */ +static inline unsigned long +flat_get_relocate_addr (unsigned long relval) +{ + return relval & 0x00ffffff; /* Mask out top 8-bits */ +} + +#define flat_m32r_get_reloc_type(relval) ((relval) >> 24) + +#define M32R_SETH_OPCODE 0xd0c00000 /* SETH instruction code */ + +#define FLAT_M32R_32 0x00 /* 32bits reloc */ +#define FLAT_M32R_24 0x01 /* unsigned 24bits reloc */ +#define FLAT_M32R_16 0x02 /* 16bits reloc */ +#define FLAT_M32R_LO16 0x03 /* signed low 16bits reloc (low()) */ +#define FLAT_M32R_LO16_DATA 0x04 /* signed low 16bits reloc (low()) + for a symbol in .data section */ + /* High 16bits of an address used + when the lower 16bbits are treated + as unsigned. + To create SETH instruction only. + 0x1X: X means a number of register. + 0x10 - 0x3F are reserved. */ +#define FLAT_M32R_HI16_ULO 0x10 /* reloc for SETH Rn,#high(imm16) */ + /* High 16bits of an address used + when the lower 16bbits are treated + as signed. + To create SETH instruction only. + 0x2X: X means a number of register. + 0x20 - 0x4F are reserved. */ +#define FLAT_M32R_HI16_SLO 0x20 /* reloc for SETH Rn,#shigh(imm16) */ + +static unsigned long textlen_for_m32r_lo16_data = 0; + +static inline unsigned long m32r_flat_get_addr_from_rp (unsigned long *rp, + unsigned long relval, + unsigned long textlen) +{ + unsigned int reloc = flat_m32r_get_reloc_type (relval); + textlen_for_m32r_lo16_data = 0; + if (reloc & 0xf0) { + unsigned long addr = htonl(*rp); + switch (reloc & 0xf0) + { + case FLAT_M32R_HI16_ULO: + case FLAT_M32R_HI16_SLO: + if (addr == 0) { + /* put "seth Rn,#0x0" instead of 0 (addr). */ + *rp = (M32R_SETH_OPCODE | ((reloc & 0x0f)<<24)); + } + return addr; + default: + break; + } + } else { + switch (reloc) + { + case FLAT_M32R_LO16: + return htonl(*rp) & 0xFFFF; + case FLAT_M32R_LO16_DATA: + /* FIXME: The return value will decrease by textlen + at m32r_flat_put_addr_at_rp () */ + textlen_for_m32r_lo16_data = textlen; + return (htonl(*rp) & 0xFFFF) + textlen; + case FLAT_M32R_16: + return htons(*(unsigned short *)rp) & 0xFFFF; + case FLAT_M32R_24: + return htonl(*rp) & 0xFFFFFF; + case FLAT_M32R_32: + return htonl(*rp); + default: + break; + } + } + return ~0; /* bogus value */ +} + +static inline void m32r_flat_put_addr_at_rp (unsigned long *rp, + unsigned long addr, + unsigned long relval) +{ + unsigned int reloc = flat_m32r_get_reloc_type (relval); + if (reloc & 0xf0) { + unsigned long Rn = reloc & 0x0f; /* get a number of register */ + Rn <<= 24; /* 0x0R000000 */ + reloc &= 0xf0; + switch (reloc) + { + case FLAT_M32R_HI16_ULO: /* To create SETH Rn,#high(imm16) */ + *rp = (M32R_SETH_OPCODE | Rn + | ((addr >> 16) & 0xFFFF)); + break; + case FLAT_M32R_HI16_SLO: /* To create SETH Rn,#shigh(imm16) */ + *rp = (M32R_SETH_OPCODE | Rn + | (((addr >> 16) + ((addr & 0x8000) ? 1 : 0)) + & 0xFFFF)); + break; + } + } else { + switch (reloc) { + case FLAT_M32R_LO16_DATA: + addr -= textlen_for_m32r_lo16_data; + textlen_for_m32r_lo16_data = 0; + case FLAT_M32R_LO16: + *rp = (htonl(*rp) & 0xFFFF0000) | (addr & 0xFFFF); + break; + case FLAT_M32R_16: + *(unsigned short *)rp = addr & 0xFFFF; + break; + case FLAT_M32R_24: + *rp = (htonl(*rp) & 0xFF000000) | (addr & 0xFFFFFF); + break; + case FLAT_M32R_32: + *rp = addr; + break; + } + } +} + +#endif /* __ASM_M32R_FLAT_H */ diff -Nru a/include/asm-m32r/hardirq.h b/include/asm-m32r/hardirq.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/hardirq.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,85 @@ +#ifndef __ASM_HARDIRQ_H +#define __ASM_HARDIRQ_H + +#include +#include +#include + +typedef struct { + unsigned int __softirq_pending; + unsigned int __syscall_count; + struct task_struct * __ksoftirqd_task; /* waitqueue is too large */ +} ____cacheline_aligned irq_cpustat_t; + +#include /* Standard mappings for irq_cpustat_t above */ + +/* + * We put the hardirq and softirq counter into the preemption + * counter. The bitmask has the following meaning: + * + * - bits 0-7 are the preemption count (max preemption depth: 256) + * - bits 8-15 are the softirq count (max # of softirqs: 256) + * - bits 16-23 are the hardirq count (max # of hardirqs: 256) + * + * - ( bit 26 is the PREEMPT_ACTIVE flag. ) + * + * PREEMPT_MASK: 0x000000ff + * SOFTIRQ_MASK: 0x0000ff00 + * HARDIRQ_MASK: 0x00ff0000 + */ + +#define PREEMPT_BITS 8 +#define SOFTIRQ_BITS 8 +#define HARDIRQ_BITS 8 + +#define PREEMPT_SHIFT 0 +#define SOFTIRQ_SHIFT (PREEMPT_SHIFT + PREEMPT_BITS) +#define HARDIRQ_SHIFT (SOFTIRQ_SHIFT + SOFTIRQ_BITS) + +/* + * 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? + */ +#define in_irq() (hardirq_count()) +#define in_softirq() (softirq_count()) +#define in_interrupt() (irq_count()) + + +#define hardirq_trylock() (!in_interrupt()) +#define hardirq_endlock() do { } while (0) + +#define irq_enter() (preempt_count() += HARDIRQ_OFFSET) +#define nmi_enter() (irq_enter()) +#define nmi_exit() (preempt_count() -= HARDIRQ_OFFSET) + +#ifdef CONFIG_PREEMPT +# define in_atomic() ((preempt_count() & ~PREEMPT_ACTIVE) != kernel_locked()) +# define IRQ_EXIT_OFFSET (HARDIRQ_OFFSET-1) +#else +# define in_atomic() (preempt_count() != 0) +# define IRQ_EXIT_OFFSET HARDIRQ_OFFSET +#endif +#define irq_exit() \ +do { \ + preempt_count() -= IRQ_EXIT_OFFSET; \ + if (!in_interrupt() && softirq_pending(smp_processor_id())) \ + do_softirq(); \ + preempt_enable_no_resched(); \ +} while (0) + +#ifndef CONFIG_SMP +# define synchronize_irq(irq) barrier() +#else + extern void synchronize_irq(unsigned int irq); +#endif /* CONFIG_SMP */ + +#endif /* __ASM_HARDIRQ_H */ diff -Nru a/include/asm-m32r/hdreg.h b/include/asm-m32r/hdreg.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/hdreg.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1 @@ +#include diff -Nru a/include/asm-m32r/hw_irq.h b/include/asm-m32r/hw_irq.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/hw_irq.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,9 @@ +#ifndef _ASM_M32R_HW_IRQ_H +#define _ASM_M32R_HW_IRQ_H + +static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i) +{ + /* Nothing to do */ +} + +#endif /* _ASM_M32R_HW_IRQ_H */ diff -Nru a/include/asm-m32r/ide.h b/include/asm-m32r/ide.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/ide.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,82 @@ +#ifndef _ASM_M32R_IDE_H +#define _ASM_M32R_IDE_H + +/* $Id$ */ + +/* + * linux/include/asm-m32r/ide.h + * + * Copyright (C) 1994-1996 Linus Torvalds & authors + */ + +/* + * This file contains the i386 architecture specific IDE code. + */ + +#ifdef __KERNEL__ + +#include + +#ifndef MAX_HWIFS +# ifdef CONFIG_BLK_DEV_IDEPCI +#define MAX_HWIFS 10 +# else +#define MAX_HWIFS 2 +# endif +#endif + +#if defined(CONFIG_PLAT_M32700UT) +#include +#include +#endif + +#define IDE_ARCH_OBSOLETE_DEFAULTS + +static __inline__ int ide_default_irq(unsigned long base) +{ + switch (base) { +#if defined(CONFIG_PLAT_M32700UT) + case 0x1f0: return PLD_IRQ_CFIREQ; + default: + return 0; +#else + 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; +#endif + } +} + +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 /* _ASM_M32R_IDE_H */ diff -Nru a/include/asm-m32r/io.h b/include/asm-m32r/io.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/io.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,201 @@ +#ifndef _ASM_M32R_IO_H +#define _ASM_M32R_IO_H + +/* $Id$ */ + +#include /* __va */ + +#ifdef __KERNEL__ + +#define IO_SPACE_LIMIT 0xFFFFFFFF + +/** + * virt_to_phys - map virtual addresses to physical + * @address: address to remap + * + * The returned physical address is the physical (CPU) mapping for + * the memory address given. It is only valid to use this function on + * addresses directly mapped or allocated via kmalloc. + * + * This function does not give bus mappings for DMA transfers. In + * almost all conceivable cases a device driver should not be using + * this function + */ + +static __inline__ unsigned long virt_to_phys(volatile void * address) +{ + return __pa(address); +} + +/** + * phys_to_virt - map physical address to virtual + * @address: address to remap + * + * The returned virtual address is a current CPU mapping for + * the memory address given. It is only valid to use this function on + * addresses that have a kernel mapping + * + * This function does not handle bus mappings for DMA transfers. In + * almost all conceivable cases a device driver should not be using + * this function + */ + +static __inline__ void *phys_to_virt(unsigned long address) +{ + return __va(address); +} + +extern void * __ioremap(unsigned long offset, unsigned long size, unsigned long flags); + +/** + * ioremap - map bus memory into CPU space + * @offset: bus address of the memory + * @size: size of the resource to map + * + * ioremap performs a platform specific sequence of operations to + * make bus memory CPU accessible via the readb/readw/readl/writeb/ + * writew/writel functions and the other mmio helpers. The returned + * address is not guaranteed to be usable directly as a virtual + * address. + */ + +static __inline__ void * ioremap(unsigned long offset, unsigned long size) +{ + return __ioremap(offset, size, 0); +} + +extern void iounmap(void *addr); +#define ioremap_nocache(off,size) ioremap(off,size) + +/* + * IO bus memory addresses are also 1:1 with the physical address + */ +#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) +#define page_to_bus page_to_phys +#define virt_to_bus virt_to_phys + +extern unsigned char _inb(unsigned long); +extern unsigned short _inw(unsigned long); +extern unsigned long _inl(unsigned long); +extern unsigned char _inb_p(unsigned long); +extern unsigned short _inw_p(unsigned long); +extern unsigned long _inl_p(unsigned long); +extern void _outb(unsigned char, unsigned long); +extern void _outw(unsigned short, unsigned long); +extern void _outl(unsigned long, unsigned long); +extern void _outb_p(unsigned char, unsigned long); +extern void _outw_p(unsigned short, unsigned long); +extern void _outl_p(unsigned long, unsigned long); +extern void _insb(unsigned int, void *, unsigned long); +extern void _insw(unsigned int, void *, unsigned long); +extern void _insl(unsigned int, void *, unsigned long); +extern void _outsb(unsigned int, const void *, unsigned long); +extern void _outsw(unsigned int, const void *, unsigned long); +extern void _outsl(unsigned int, const void *, unsigned long); + +static inline unsigned char _readb(unsigned long addr) +{ + return *(volatile unsigned char *)addr; +} + +static inline unsigned short _readw(unsigned long addr) +{ + return *(volatile unsigned short *)addr; +} + +static inline unsigned long _readl(unsigned long addr) +{ + return *(volatile unsigned long *)addr; +} + +static inline void _writeb(unsigned char b, unsigned long addr) +{ + *(volatile unsigned char *)addr = b; +} + +static inline void _writew(unsigned short w, unsigned long addr) +{ + *(volatile unsigned short *)addr = w; +} + +static inline void _writel(unsigned long l, unsigned long addr) +{ + *(volatile unsigned long *)addr = l; +} + +#define inb _inb +#define inw _inw +#define inl _inl +#define outb _outb +#define outw _outw +#define outl _outl + +#define inb_p _inb_p +#define inw_p _inw_p +#define inl_p _inl_p +#define outb_p _outb_p +#define outw_p _outw_p +#define outl_p _outl_p + +#define insb _insb +#define insw _insw +#define insl _insl +#define outsb _outsb +#define outsw _outsw +#define outsl _outsl + +#define readb(addr) _readb((unsigned long)(addr)) +#define readw(addr) _readw((unsigned long)(addr)) +#define readl(addr) _readl((unsigned long)(addr)) +#define __raw_readb readb +#define __raw_readw readw +#define __raw_readl readl + +#define writeb(val, addr) _writeb((val), (unsigned long)(addr)) +#define writew(val, addr) _writew((val), (unsigned long)(addr)) +#define writel(val, addr) _writel((val), (unsigned long)(addr)) +#define __raw_writeb writeb +#define __raw_writew writew +#define __raw_writel writel + +#define flush_write_buffers() do { } while (0) /* M32R_FIXME */ + +/** + * isa_check_signature - find BIOS signatures + * @io_addr: mmio address to check + * @signature: signature block + * @length: length of signature + * + * Perform a signature comparison with the ISA mmio address io_addr. + * Returns 1 on a match. + * + * This function is deprecated. New drivers should use ioremap and + * check_signature. + */ + +static inline int isa_check_signature(unsigned long io_addr, + const unsigned char *signature, int length) +{ + int retval = 0; +#if 0 +printk("isa_check_signature\n"); + do { + if (isa_readb(io_addr) != *signature) + goto out; + io_addr++; + signature++; + length--; + } while (length); + retval = 1; +out: +#endif + return retval; +} + +#define memset_io(a, b, c) memset((void *)(a), (b), (c)) +#define memcpy_fromio(a, b, c) memcpy((a), (void *)(b), (c)) +#define memcpy_toio(a, b, c) memcpy((void *)(a), (b), (c)) + +#endif /* __KERNEL__ */ + +#endif /* _ASM_M32R_IO_H */ diff -Nru a/include/asm-m32r/ioctl.h b/include/asm-m32r/ioctl.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/ioctl.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,78 @@ +#ifndef _ASM_M32R_IOCTL_H +#define _ASM_M32R_IOCTL_H + +/* $Id$ */ + +/* orig : i386 2.4.18 */ + +/* + * linux/ioctl.h for Linux by H.H. Bergman. + */ + +/* ioctl command encoding: 32 bits total, command in lower 16 bits, + * size of the parameter structure in the lower 14 bits of the + * upper 16 bits. + * Encoding the size of the parameter structure in the ioctl request + * is useful for catching programs compiled with old versions + * and to avoid overwriting user space outside the user buffer area. + * The highest 2 bits are reserved for indicating the ``access mode''. + * NOTE: This limits the max parameter size to 16kB -1 ! + */ + +/* + * The following is for compatibility across the various Linux + * platforms. The i386 ioctl numbering scheme doesn't really enforce + * a type field. De facto, however, the top 8 bits of the lower 16 + * bits are indeed used as a type field, so we might just as well make + * this explicit here. Please be sure to use the decoding macros + * below from now on. + */ +#define _IOC_NRBITS 8 +#define _IOC_TYPEBITS 8 +#define _IOC_SIZEBITS 14 +#define _IOC_DIRBITS 2 + +#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) +#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) +#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) +#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) + +#define _IOC_NRSHIFT 0 +#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) +#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) +#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) + +/* + * Direction bits. + */ +#define _IOC_NONE 0U +#define _IOC_WRITE 1U +#define _IOC_READ 2U + +#define _IOC(dir,type,nr,size) \ + (((dir) << _IOC_DIRSHIFT) | \ + ((type) << _IOC_TYPESHIFT) | \ + ((nr) << _IOC_NRSHIFT) | \ + ((size) << _IOC_SIZESHIFT)) + +/* 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)) + +/* used to decode ioctl numbers.. */ +#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) +#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) +#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) +#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK) + +/* ...and for the drivers/sound files... */ + +#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) +#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) +#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) +#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) +#define IOCSIZE_SHIFT (_IOC_SIZESHIFT) + +#endif /* _ASM_M32R_IOCTL_H */ diff -Nru a/include/asm-m32r/ioctls.h b/include/asm-m32r/ioctls.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/ioctls.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,88 @@ +#ifndef __ARCH_M32R_IOCTLS_H__ +#define __ARCH_M32R_IOCTLS_H__ + +/* $Id$ */ + +/* orig : i386 2.5.67 */ + +#include + +/* 0x54 is just a magic number to make these relatively unique ('T') */ + +#define TCGETS 0x5401 +#define TCSETS 0x5402 /* Clashes with SNDCTL_TMR_START sound ioctl */ +#define TCSETSW 0x5403 +#define TCSETSF 0x5404 +#define TCGETA 0x5405 +#define TCSETA 0x5406 +#define TCSETAW 0x5407 +#define TCSETAF 0x5408 +#define TCSBRK 0x5409 +#define TCXONC 0x540A +#define TCFLSH 0x540B +#define TIOCEXCL 0x540C +#define TIOCNXCL 0x540D +#define TIOCSCTTY 0x540E +#define TIOCGPGRP 0x540F +#define TIOCSPGRP 0x5410 +#define TIOCOUTQ 0x5411 +#define TIOCSTI 0x5412 +#define TIOCGWINSZ 0x5413 +#define TIOCSWINSZ 0x5414 +#define TIOCMGET 0x5415 +#define TIOCMBIS 0x5416 +#define TIOCMBIC 0x5417 +#define TIOCMSET 0x5418 +#define TIOCGSOFTCAR 0x5419 +#define TIOCSSOFTCAR 0x541A +#define FIONREAD 0x541B +#define TIOCINQ FIONREAD +#define TIOCLINUX 0x541C +#define TIOCCONS 0x541D +#define TIOCGSERIAL 0x541E +#define TIOCSSERIAL 0x541F +#define TIOCPKT 0x5420 +#define FIONBIO 0x5421 +#define TIOCNOTTY 0x5422 +#define TIOCSETD 0x5423 +#define TIOCGETD 0x5424 +#define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */ +/* #define TIOCTTYGSTRUCT 0x5426 - Former debugging-only ioctl */ +#define TIOCSBRK 0x5427 /* BSD compatibility */ +#define TIOCCBRK 0x5428 /* BSD compatibility */ +#define TIOCGSID 0x5429 /* Return the session ID of FD */ +#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ +#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ + +#define FIONCLEX 0x5450 +#define FIOCLEX 0x5451 +#define FIOASYNC 0x5452 +#define TIOCSERCONFIG 0x5453 +#define TIOCSERGWILD 0x5454 +#define TIOCSERSWILD 0x5455 +#define TIOCGLCKTRMIOS 0x5456 +#define TIOCSLCKTRMIOS 0x5457 +#define TIOCSERGSTRUCT 0x5458 /* For debugging only */ +#define TIOCSERGETLSR 0x5459 /* Get line status register */ +#define TIOCSERGETMULTI 0x545A /* Get multiport config */ +#define TIOCSERSETMULTI 0x545B /* Set multiport config */ + +#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */ +#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */ +#define TIOCGHAYESESP 0x545E /* Get Hayes ESP configuration */ +#define TIOCSHAYESESP 0x545F /* Set Hayes ESP configuration */ +#define FIOQSIZE 0x5460 + +/* Used for packet mode */ +#define TIOCPKT_DATA 0 +#define TIOCPKT_FLUSHREAD 1 +#define TIOCPKT_FLUSHWRITE 2 +#define TIOCPKT_STOP 4 +#define TIOCPKT_START 8 +#define TIOCPKT_NOSTOP 16 +#define TIOCPKT_DOSTOP 32 + +#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */ + +#endif /* __ARCH_M32R_IOCTLS_H__ */ + diff -Nru a/include/asm-m32r/ipc.h b/include/asm-m32r/ipc.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/ipc.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,35 @@ +#ifndef __M32R_IPC_H__ +#define __M32R_IPC_H__ + +/* orig : i386/ipc.h 2.6.0-test3 */ + +/* + * These are used to wrap system calls on x86. + * + * See arch/i386/kernel/sys_i386.c for ugly details.. + */ +struct ipc_kludge { + struct msgbuf __user *msgp; + long msgtyp; +}; + +#define SEMOP 1 +#define SEMGET 2 +#define SEMCTL 3 +#define SEMTIMEDOP 4 +#define MSGSND 11 +#define MSGRCV 12 +#define MSGGET 13 +#define MSGCTL 14 +#define SHMAT 21 +#define SHMDT 22 +#define SHMGET 23 +#define SHMCTL 24 + +/* Used by the DIPC package, try and avoid reusing it */ +#define DIPC 25 + +#define IPCCALL(version,op) ((version)<<16 | (op)) + +#endif /* __M32R_IPC_H__ */ + diff -Nru a/include/asm-m32r/ipcbuf.h b/include/asm-m32r/ipcbuf.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/ipcbuf.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,33 @@ +#ifndef _ASM_M32R_IPCBUF_H +#define _ASM_M32R_IPCBUF_H + +/* $Id$ */ + +/* orig : i386 2.4.18 */ + +/* + * The ipc64_perm structure for m32r architecture. + * Note extra padding because this structure is passed back and forth + * between kernel and user space. + * + * Pad space is left for: + * - 32-bit mode_t and seq + * - 2 miscellaneous 32-bit values + */ + +struct ipc64_perm +{ + __kernel_key_t key; + __kernel_uid32_t uid; + __kernel_gid32_t gid; + __kernel_uid32_t cuid; + __kernel_gid32_t cgid; + __kernel_mode_t mode; + unsigned short __pad1; + unsigned short seq; + unsigned short __pad2; + unsigned long __unused1; + unsigned long __unused2; +}; + +#endif /* _ASM_M32R_IPCBUF_H */ diff -Nru a/include/asm-m32r/irq.h b/include/asm-m32r/irq.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/irq.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,86 @@ +#ifndef _ASM_M32R_IRQ_H +#define _ASM_M32R_IRQ_H + +/* $Id$ */ + +#include + +#if defined(CONFIG_PLAT_M32700UT_Alpha) || defined(CONFIG_PLAT_USRV) +/* + * IRQ definitions for M32700UT + * M32700 Chip: 64 interrupts + * ICU of M32700UT-on-board PLD: 32 interrupts cascaded to INT1# chip pin + */ +#define M32700UT_NUM_CPU_IRQ (64) +#define M32700UT_NUM_PLD_IRQ (32) +#define M32700UT_IRQ_BASE 0 +#define M32700UT_CPU_IRQ_BASE M32700UT_IRQ_BASE +#define M32700UT_PLD_IRQ_BASE (M32700UT_CPU_IRQ_BASE + M32700UT_NUM_CPU_IRQ) + +#define NR_IRQS (M32700UT_NUM_CPU_IRQ + M32700UT_NUM_PLD_IRQ) +#elif defined(CONFIG_PLAT_M32700UT) +/* + * IRQ definitions for M32700UT(Rev.C) + M32R-LAN + * M32700 Chip: 64 interrupts + * ICU of M32700UT-on-board PLD: 32 interrupts cascaded to INT1# chip pin + * ICU of M32R-LCD-on-board PLD: 32 interrupts cascaded to INT2# chip pin + * ICU of M32R-LAN-on-board PLD: 32 interrupts cascaded to INT0# chip pin + */ +#define M32700UT_NUM_CPU_IRQ (64) +#define M32700UT_NUM_PLD_IRQ (32) +#define M32700UT_NUM_LCD_PLD_IRQ (32) +#define M32700UT_NUM_LAN_PLD_IRQ (32) +#define M32700UT_IRQ_BASE 0 +#define M32700UT_CPU_IRQ_BASE (M32700UT_IRQ_BASE) +#define M32700UT_PLD_IRQ_BASE \ + (M32700UT_CPU_IRQ_BASE + M32700UT_NUM_CPU_IRQ) +#define M32700UT_LCD_PLD_IRQ_BASE \ + (M32700UT_PLD_IRQ_BASE + M32700UT_NUM_PLD_IRQ) +#define M32700UT_LAN_PLD_IRQ_BASE \ + (M32700UT_LCD_PLD_IRQ_BASE + M32700UT_NUM_LCD_PLD_IRQ) + +#define NR_IRQS \ + (M32700UT_NUM_CPU_IRQ + M32700UT_NUM_PLD_IRQ \ + + M32700UT_NUM_LCD_PLD_IRQ + M32700UT_NUM_LAN_PLD_IRQ) +#elif defined(CONFIG_PLAT_OPSPUT) +/* + * IRQ definitions for OPSPUT + M32R-LAN + * OPSP Chip: 64 interrupts + * ICU of OPSPUT-on-board PLD: 32 interrupts cascaded to INT1# chip pin + * ICU of M32R-LCD-on-board PLD: 32 interrupts cascaded to INT2# chip pin + * ICU of M32R-LAN-on-board PLD: 32 interrupts cascaded to INT0# chip pin + */ +#define OPSPUT_NUM_CPU_IRQ (64) +#define OPSPUT_NUM_PLD_IRQ (32) +#define OPSPUT_NUM_LCD_PLD_IRQ (32) +#define OPSPUT_NUM_LAN_PLD_IRQ (32) +#define OPSPUT_IRQ_BASE 0 +#define OPSPUT_CPU_IRQ_BASE (OPSPUT_IRQ_BASE) +#define OPSPUT_PLD_IRQ_BASE \ + (OPSPUT_CPU_IRQ_BASE + OPSPUT_NUM_CPU_IRQ) +#define OPSPUT_LCD_PLD_IRQ_BASE \ + (OPSPUT_PLD_IRQ_BASE + OPSPUT_NUM_PLD_IRQ) +#define OPSPUT_LAN_PLD_IRQ_BASE \ + (OPSPUT_LCD_PLD_IRQ_BASE + OPSPUT_NUM_LCD_PLD_IRQ) + +#define NR_IRQS \ + (OPSPUT_NUM_CPU_IRQ + OPSPUT_NUM_PLD_IRQ \ + + OPSPUT_NUM_LCD_PLD_IRQ + OPSPUT_NUM_LAN_PLD_IRQ) +#else +#define NR_IRQS 64 +#endif + +#define irq_canonicalize(irq) (irq) + +#ifndef __ASSEMBLY__ +extern void disable_irq(unsigned int); +extern void disable_irq_nosync(unsigned int); +extern void enable_irq(unsigned int); + +struct irqaction; +struct pt_regs; +int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *); +#endif + +#endif /* _ASM_M32R_IRQ_H */ + diff -Nru a/include/asm-m32r/kmap_types.h b/include/asm-m32r/kmap_types.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/kmap_types.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,34 @@ +#ifndef __M32R_KMAP_TYPES_H +#define __M32R_KMAP_TYPES_H + +/* Dummy header just to define km_type. */ + +#include + +#ifdef CONFIG_DEBUG_HIGHMEM +# define D(n) __KM_FENCE_##n , +#else +# define D(n) +#endif + +enum km_type { +D(0) KM_BOUNCE_READ, +D(1) KM_SKB_SUNRPC_DATA, +D(2) KM_SKB_DATA_SOFTIRQ, +D(3) KM_USER0, +D(4) KM_USER1, +D(5) KM_BIO_SRC_IRQ, +D(6) KM_BIO_DST_IRQ, +D(7) KM_PTE0, +D(8) KM_PTE1, +D(9) KM_IRQ0, +D(10) KM_IRQ1, +D(11) KM_SOFTIRQ0, +D(12) KM_SOFTIRQ1, +D(13) KM_TYPE_NR +}; + +#undef D + +#endif /* __M32R_KMAP_TYPES_H */ + diff -Nru a/include/asm-m32r/linkage.h b/include/asm-m32r/linkage.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/linkage.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,7 @@ +#ifndef __ASM_LINKAGE_H +#define __ASM_LINKAGE_H + +#define __ALIGN .balign 4 +#define __ALIGN_STR ".balign 4" + +#endif /* __ASM_LINKAGE_H */ diff -Nru a/include/asm-m32r/local.h b/include/asm-m32r/local.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/local.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,6 @@ +#ifndef __M32R_LOCAL_H +#define __M32R_LOCAL_H + +#include + +#endif /* __M32R_LOCAL_H */ diff -Nru a/include/asm-m32r/m32102.h b/include/asm-m32r/m32102.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/m32102.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,265 @@ +#ifndef _M32102_H_ +#define _M32102_H_ + +/* + * Mitsubishi M32R 32102 group + * Copyright (c) 2001 [Hitoshi Yamamoto] All rights reserved. + */ +/* $Id$ */ + +/*======================================================================* + * Special Function Register + *======================================================================*/ +#define M32R_SFR_OFFSET (0x00E00000) /* 0x00E00000-0x00EFFFFF 1[MB] */ + +/* + * Clock and Power Management registers. + */ +#define M32R_CPM_OFFSET (0x000F4000+M32R_SFR_OFFSET) + +#define M32R_CPM_CPUCLKCR_PORTL (0x00+M32R_CPM_OFFSET) +#define M32R_CPM_CLKMOD_PORTL (0x04+M32R_CPM_OFFSET) +#define M32R_CPM_PLLCR_PORTL (0x08+M32R_CPM_OFFSET) + +/* + * Multi Function Timer registers. + */ +#define M32R_MFT_OFFSET (0x000FC000+M32R_SFR_OFFSET) + +#define M32R_MFTCR_PORTL (0x000+M32R_MFT_OFFSET) /* MFT control */ +#define M32R_MFTRPR_PORTL (0x004+M32R_MFT_OFFSET) /* MFT real port */ + +#define M32R_MFT0_OFFSET (0x100+M32R_MFT_OFFSET) +#define M32R_MFT0MOD_PORTL (0x00+M32R_MFT0_OFFSET) /* MFT0 mode */ +#define M32R_MFT0BOS_PORTL (0x04+M32R_MFT0_OFFSET) /* MFT0 b-port output status */ +#define M32R_MFT0CUT_PORTL (0x08+M32R_MFT0_OFFSET) /* MFT0 count */ +#define M32R_MFT0RLD_PORTL (0x0C+M32R_MFT0_OFFSET) /* MFT0 reload */ +#define M32R_MFT0CMPRLD_PORTL (0x10+M32R_MFT0_OFFSET) /* MFT0 compare reload */ + +#define M32R_MFT1_OFFSET (0x200+M32R_MFT_OFFSET) +#define M32R_MFT1MOD_PORTL (0x00+M32R_MFT1_OFFSET) /* MFT1 mode */ +#define M32R_MFT1BOS_PORTL (0x04+M32R_MFT1_OFFSET) /* MFT1 b-port output status */ +#define M32R_MFT1CUT_PORTL (0x08+M32R_MFT1_OFFSET) /* MFT1 count */ +#define M32R_MFT1RLD_PORTL (0x0C+M32R_MFT1_OFFSET) /* MFT1 reload */ +#define M32R_MFT1CMPRLD_PORTL (0x10+M32R_MFT1_OFFSET) /* MFT1 compare reload */ + +#define M32R_MFT2_OFFSET (0x300+M32R_MFT_OFFSET) +#define M32R_MFT2MOD_PORTL (0x00+M32R_MFT2_OFFSET) /* MFT2 mode */ +#define M32R_MFT2BOS_PORTL (0x04+M32R_MFT2_OFFSET) /* MFT2 b-port output status */ +#define M32R_MFT2CUT_PORTL (0x08+M32R_MFT2_OFFSET) /* MFT2 count */ +#define M32R_MFT2RLD_PORTL (0x0C+M32R_MFT2_OFFSET) /* MFT2 reload */ +#define M32R_MFT2CMPRLD_PORTL (0x10+M32R_MFT2_OFFSET) /* MFT2 compare reload */ + +#define M32R_MFT3_OFFSET (0x400+M32R_MFT_OFFSET) +#define M32R_MFT3MOD_PORTL (0x00+M32R_MFT3_OFFSET) /* MFT3 mode */ +#define M32R_MFT3BOS_PORTL (0x04+M32R_MFT3_OFFSET) /* MFT3 b-port output status */ +#define M32R_MFT3CUT_PORTL (0x08+M32R_MFT3_OFFSET) /* MFT3 count */ +#define M32R_MFT3RLD_PORTL (0x0C+M32R_MFT3_OFFSET) /* MFT3 reload */ +#define M32R_MFT3CMPRLD_PORTL (0x10+M32R_MFT3_OFFSET) /* MFT3 compare reload */ + +#define M32R_MFT4_OFFSET (0x500+M32R_MFT_OFFSET) +#define M32R_MFT4MOD_PORTL (0x00+M32R_MFT4_OFFSET) /* MFT4 mode */ +#define M32R_MFT4BOS_PORTL (0x04+M32R_MFT4_OFFSET) /* MFT4 b-port output status */ +#define M32R_MFT4CUT_PORTL (0x08+M32R_MFT4_OFFSET) /* MFT4 count */ +#define M32R_MFT4RLD_PORTL (0x0C+M32R_MFT4_OFFSET) /* MFT4 reload */ +#define M32R_MFT4CMPRLD_PORTL (0x10+M32R_MFT4_OFFSET) /* MFT4 compare reload */ + +#define M32R_MFT5_OFFSET (0x600+M32R_MFT_OFFSET) +#define M32R_MFT5MOD_PORTL (0x00+M32R_MFT5_OFFSET) /* MFT4 mode */ +#define M32R_MFT5BOS_PORTL (0x04+M32R_MFT5_OFFSET) /* MFT4 b-port output status */ +#define M32R_MFT5CUT_PORTL (0x08+M32R_MFT5_OFFSET) /* MFT4 count */ +#define M32R_MFT5RLD_PORTL (0x0C+M32R_MFT5_OFFSET) /* MFT4 reload */ +#define M32R_MFT5CMPRLD_PORTL (0x10+M32R_MFT5_OFFSET) /* MFT4 compare reload */ + +#ifdef CONFIG_CHIP_M32700 +#define M32R_MFTCR_MFT0MSK (1UL<<31) /* b0 */ +#define M32R_MFTCR_MFT1MSK (1UL<<30) /* b1 */ +#define M32R_MFTCR_MFT2MSK (1UL<<29) /* b2 */ +#define M32R_MFTCR_MFT3MSK (1UL<<28) /* b3 */ +#define M32R_MFTCR_MFT4MSK (1UL<<27) /* b4 */ +#define M32R_MFTCR_MFT5MSK (1UL<<26) /* b5 */ +#define M32R_MFTCR_MFT0EN (1UL<<23) /* b8 */ +#define M32R_MFTCR_MFT1EN (1UL<<22) /* b9 */ +#define M32R_MFTCR_MFT2EN (1UL<<21) /* b10 */ +#define M32R_MFTCR_MFT3EN (1UL<<20) /* b11 */ +#define M32R_MFTCR_MFT4EN (1UL<<19) /* b12 */ +#define M32R_MFTCR_MFT5EN (1UL<<18) /* b13 */ +#else /* not CONFIG_CHIP_M32700 */ +#define M32R_MFTCR_MFT0MSK (1UL<<15) /* b16 */ +#define M32R_MFTCR_MFT1MSK (1UL<<14) /* b17 */ +#define M32R_MFTCR_MFT2MSK (1UL<<13) /* b18 */ +#define M32R_MFTCR_MFT3MSK (1UL<<12) /* b19 */ +#define M32R_MFTCR_MFT4MSK (1UL<<11) /* b20 */ +#define M32R_MFTCR_MFT5MSK (1UL<<10) /* b21 */ +#define M32R_MFTCR_MFT0EN (1UL<<7) /* b24 */ +#define M32R_MFTCR_MFT1EN (1UL<<6) /* b25 */ +#define M32R_MFTCR_MFT2EN (1UL<<5) /* b26 */ +#define M32R_MFTCR_MFT3EN (1UL<<4) /* b27 */ +#define M32R_MFTCR_MFT4EN (1UL<<3) /* b28 */ +#define M32R_MFTCR_MFT5EN (1UL<<2) /* b29 */ +#endif /* not CONFIG_CHIP_M32700 */ + +#define M32R_MFTMOD_CC_MASK (1UL<<15) /* b16 */ +#define M32R_MFTMOD_TCCR (1UL<<13) /* b18 */ +#define M32R_MFTMOD_GTSEL000 (0UL<<8) /* b21-23 : 000 */ +#define M32R_MFTMOD_GTSEL001 (1UL<<8) /* b21-23 : 001 */ +#define M32R_MFTMOD_GTSEL010 (2UL<<8) /* b21-23 : 010 */ +#define M32R_MFTMOD_GTSEL011 (3UL<<8) /* b21-23 : 011 */ +#define M32R_MFTMOD_GTSEL110 (6UL<<8) /* b21-23 : 110 */ +#define M32R_MFTMOD_GTSEL111 (7UL<<8) /* b21-23 : 111 */ +#define M32R_MFTMOD_CMSEL (1UL<<3) /* b28 */ +#define M32R_MFTMOD_CSSEL000 (0UL<<0) /* b29-b31 : 000 */ +#define M32R_MFTMOD_CSSEL001 (1UL<<0) /* b29-b31 : 001 */ +#define M32R_MFTMOD_CSSEL010 (2UL<<0) /* b29-b31 : 010 */ +#define M32R_MFTMOD_CSSEL011 (3UL<<0) /* b29-b31 : 011 */ +#define M32R_MFTMOD_CSSEL100 (4UL<<0) /* b29-b31 : 100 */ +#define M32R_MFTMOD_CSSEL110 (6UL<<0) /* b29-b31 : 110 */ + +/* + * Serial I/O registers. + */ +#define M32R_SIO_OFFSET (0x000FD000+M32R_SFR_OFFSET) + +#define M32R_SIO0_CR_PORTL (0x000+M32R_SIO_OFFSET) +#define M32R_SIO0_MOD0_PORTL (0x004+M32R_SIO_OFFSET) +#define M32R_SIO0_MOD1_PORTL (0x008+M32R_SIO_OFFSET) +#define M32R_SIO0_STS_PORTL (0x00C+M32R_SIO_OFFSET) +#define M32R_SIO0_TRCR_PORTL (0x010+M32R_SIO_OFFSET) +#define M32R_SIO0_BAUR_PORTL (0x014+M32R_SIO_OFFSET) +#define M32R_SIO0_RBAUR_PORTL (0x018+M32R_SIO_OFFSET) +#define M32R_SIO0_TXB_PORTL (0x01C+M32R_SIO_OFFSET) +#define M32R_SIO0_RXB_PORTL (0x020+M32R_SIO_OFFSET) + +/* + * Interrupt Control Unit registers. + */ +#define M32R_ICU_OFFSET (0x000FF000+M32R_SFR_OFFSET) +#define M32R_ICU_ISTS_PORTL (0x004+M32R_ICU_OFFSET) +#define M32R_ICU_IREQ0_PORTL (0x008+M32R_ICU_OFFSET) +#define M32R_ICU_IREQ1_PORTL (0x00C+M32R_ICU_OFFSET) +#define M32R_ICU_SBICR_PORTL (0x018+M32R_ICU_OFFSET) +#define M32R_ICU_IMASK_PORTL (0x01C+M32R_ICU_OFFSET) +#define M32R_ICU_CR1_PORTL (0x200+M32R_ICU_OFFSET) /* INT0 */ +#define M32R_ICU_CR2_PORTL (0x204+M32R_ICU_OFFSET) /* INT1 */ +#define M32R_ICU_CR3_PORTL (0x208+M32R_ICU_OFFSET) /* INT2 */ +#define M32R_ICU_CR4_PORTL (0x20C+M32R_ICU_OFFSET) /* INT3 */ +#define M32R_ICU_CR5_PORTL (0x210+M32R_ICU_OFFSET) /* INT4 */ +#define M32R_ICU_CR6_PORTL (0x214+M32R_ICU_OFFSET) /* INT5 */ +#define M32R_ICU_CR7_PORTL (0x218+M32R_ICU_OFFSET) /* INT6 */ +#define M32R_ICU_CR16_PORTL (0x23C+M32R_ICU_OFFSET) /* MFT0 */ +#define M32R_ICU_CR17_PORTL (0x240+M32R_ICU_OFFSET) /* MFT1 */ +#define M32R_ICU_CR18_PORTL (0x244+M32R_ICU_OFFSET) /* MFT2 */ +#define M32R_ICU_CR19_PORTL (0x248+M32R_ICU_OFFSET) /* MFT3 */ +#define M32R_ICU_CR20_PORTL (0x24C+M32R_ICU_OFFSET) /* MFT4 */ +#define M32R_ICU_CR21_PORTL (0x250+M32R_ICU_OFFSET) /* MFT5 */ +#define M32R_ICU_CR32_PORTL (0x27C+M32R_ICU_OFFSET) /* DMA0 */ +#define M32R_ICU_CR33_PORTL (0x280+M32R_ICU_OFFSET) /* DMA1 */ +#define M32R_ICU_CR48_PORTL (0x2BC+M32R_ICU_OFFSET) /* SIO0 */ +#define M32R_ICU_CR49_PORTL (0x2C0+M32R_ICU_OFFSET) /* SIO0 */ +#define M32R_ICU_CR50_PORTL (0x2C4+M32R_ICU_OFFSET) /* SIO1 */ +#define M32R_ICU_CR51_PORTL (0x2C8+M32R_ICU_OFFSET) /* SIO1 */ +#define M32R_ICU_CR52_PORTL (0x2CC+M32R_ICU_OFFSET) /* SIO2 */ +#define M32R_ICU_CR53_PORTL (0x2D0+M32R_ICU_OFFSET) /* SIO2 */ +#define M32R_ICU_CR54_PORTL (0x2D4+M32R_ICU_OFFSET) /* SIO3 */ +#define M32R_ICU_CR55_PORTL (0x2D8+M32R_ICU_OFFSET) /* SIO3 */ +#define M32R_ICU_CR56_PORTL (0x2DC+M32R_ICU_OFFSET) /* SIO4 */ +#define M32R_ICU_CR57_PORTL (0x2E0+M32R_ICU_OFFSET) /* SIO4 */ + +#ifdef CONFIG_SMP +#define M32R_ICU_IPICR0_PORTL (0x2dc+M32R_ICU_OFFSET) /* IPI0 */ +#define M32R_ICU_IPICR1_PORTL (0x2e0+M32R_ICU_OFFSET) /* IPI1 */ +#define M32R_ICU_IPICR2_PORTL (0x2e4+M32R_ICU_OFFSET) /* IPI2 */ +#define M32R_ICU_IPICR3_PORTL (0x2e8+M32R_ICU_OFFSET) /* IPI3 */ +#define M32R_ICU_IPICR4_PORTL (0x2ec+M32R_ICU_OFFSET) /* IPI4 */ +#define M32R_ICU_IPICR5_PORTL (0x2f0+M32R_ICU_OFFSET) /* IPI5 */ +#define M32R_ICU_IPICR6_PORTL (0x2f4+M32R_ICU_OFFSET) /* IPI6 */ +#define M32R_ICU_IPICR7_PORTL (0x2f8+M32R_ICU_OFFSET) /* IPI7 */ +#endif /* CONFIG_SMP */ + +#define M32R_ICUIMASK_IMSK0 (0UL<<16) /* b13-b15: Disable interrupt */ +#define M32R_ICUIMASK_IMSK1 (1UL<<16) /* b13-b15: Enable level 0 interrupt */ +#define M32R_ICUIMASK_IMSK2 (2UL<<16) /* b13-b15: Enable level 0,1 interrupt */ +#define M32R_ICUIMASK_IMSK3 (3UL<<16) /* b13-b15: Enable level 0-2 interrupt */ +#define M32R_ICUIMASK_IMSK4 (4UL<<16) /* b13-b15: Enable level 0-3 interrupt */ +#define M32R_ICUIMASK_IMSK5 (5UL<<16) /* b13-b15: Enable level 0-4 interrupt */ +#define M32R_ICUIMASK_IMSK6 (6UL<<16) /* b13-b15: Enable level 0-5 interrupt */ +#define M32R_ICUIMASK_IMSK7 (7UL<<16) /* b13-b15: Enable level 0-6 interrupt */ + +#define M32R_ICUCR_IEN (1UL<<12) /* b19: Interrupt enable */ +#define M32R_ICUCR_IRQ (1UL<<8) /* b23: Interrupt request */ +#define M32R_ICUCR_ISMOD00 (0UL<<4) /* b26-b27: Interrupt sense mode Edge HtoL */ +#define M32R_ICUCR_ISMOD01 (1UL<<4) /* b26-b27: Interrupt sense mode Level L */ +#define M32R_ICUCR_ISMOD10 (2UL<<4) /* b26-b27: Interrupt sense mode Edge LtoH*/ +#define M32R_ICUCR_ISMOD11 (3UL<<4) /* b26-b27: Interrupt sense mode Level H */ +#define M32R_ICUCR_ILEVEL0 (0UL<<0) /* b29-b31: Interrupt priority level 0 */ +#define M32R_ICUCR_ILEVEL1 (1UL<<0) /* b29-b31: Interrupt priority level 1 */ +#define M32R_ICUCR_ILEVEL2 (2UL<<0) /* b29-b31: Interrupt priority level 2 */ +#define M32R_ICUCR_ILEVEL3 (3UL<<0) /* b29-b31: Interrupt priority level 3 */ +#define M32R_ICUCR_ILEVEL4 (4UL<<0) /* b29-b31: Interrupt priority level 4 */ +#define M32R_ICUCR_ILEVEL5 (5UL<<0) /* b29-b31: Interrupt priority level 5 */ +#define M32R_ICUCR_ILEVEL6 (6UL<<0) /* b29-b31: Interrupt priority level 6 */ +#define M32R_ICUCR_ILEVEL7 (7UL<<0) /* b29-b31: Disable interrupt */ + +#define M32R_IRQ_INT0 (1) /* INT0 */ +#define M32R_IRQ_INT1 (2) /* INT1 */ +#define M32R_IRQ_INT2 (3) /* INT2 */ +#define M32R_IRQ_INT3 (4) /* INT3 */ +#define M32R_IRQ_INT4 (5) /* INT4 */ +#define M32R_IRQ_INT5 (6) /* INT5 */ +#define M32R_IRQ_INT6 (7) /* INT6 */ +#define M32R_IRQ_MFT0 (16) /* MFT0 */ +#define M32R_IRQ_MFT1 (17) /* MFT1 */ +#define M32R_IRQ_MFT2 (18) /* MFT2 */ +#define M32R_IRQ_MFT3 (19) /* MFT3 */ +#define M32R_IRQ_MFT4 (20) /* MFT4 */ +#define M32R_IRQ_MFT5 (21) /* MFT5 */ +#define M32R_IRQ_DMA0 (32) /* DMA0 */ +#define M32R_IRQ_DMA1 (33) /* DMA1 */ +#define M32R_IRQ_SIO0_R (48) /* SIO0 send */ +#define M32R_IRQ_SIO0_S (49) /* SIO0 receive */ +#define M32R_IRQ_SIO1_R (50) /* SIO1 send */ +#define M32R_IRQ_SIO1_S (51) /* SIO1 receive */ +#define M32R_IRQ_SIO2_R (52) /* SIO2 send */ +#define M32R_IRQ_SIO2_S (53) /* SIO2 receive */ +#define M32R_IRQ_SIO3_R (54) /* SIO3 send */ +#define M32R_IRQ_SIO3_S (55) /* SIO3 receive */ +#define M32R_IRQ_SIO4_R (56) /* SIO4 send */ +#define M32R_IRQ_SIO4_S (57) /* SIO4 receive */ + +#ifdef CONFIG_SMP +#define M32R_IRQ_IPI0 (56) +#define M32R_IRQ_IPI1 (57) +#define M32R_IRQ_IPI2 (58) +#define M32R_IRQ_IPI3 (59) +#define M32R_IRQ_IPI4 (60) +#define M32R_IRQ_IPI5 (61) +#define M32R_IRQ_IPI6 (62) +#define M32R_IRQ_IPI7 (63) +#define M32R_CPUID_PORTL (0xffffffe0) + +#define M32R_FPGA_TOP (0x000F0000+M32R_SFR_OFFSET) + +#define M32R_FPGA_NUM_OF_CPUS_PORTL (0x00+M32R_FPGA_TOP) +#define M32R_FPGA_CPU_NAME0_PORTL (0x10+M32R_FPGA_TOP) +#define M32R_FPGA_CPU_NAME1_PORTL (0x14+M32R_FPGA_TOP) +#define M32R_FPGA_CPU_NAME2_PORTL (0x18+M32R_FPGA_TOP) +#define M32R_FPGA_CPU_NAME3_PORTL (0x1c+M32R_FPGA_TOP) +#define M32R_FPGA_MODEL_ID0_PORTL (0x20+M32R_FPGA_TOP) +#define M32R_FPGA_MODEL_ID1_PORTL (0x24+M32R_FPGA_TOP) +#define M32R_FPGA_MODEL_ID2_PORTL (0x28+M32R_FPGA_TOP) +#define M32R_FPGA_MODEL_ID3_PORTL (0x2c+M32R_FPGA_TOP) +#define M32R_FPGA_VERSION0_PORTL (0x30+M32R_FPGA_TOP) +#define M32R_FPGA_VERSION1_PORTL (0x34+M32R_FPGA_TOP) + +#ifndef __ASSEMBLY__ +/* For NETDEV WATCHDOG */ +typedef struct { + unsigned long icucr; /* ICU Control Register */ +} icu_data_t; + +extern icu_data_t icu_data[]; +#endif + +#endif /* CONFIG_SMP */ + +#endif /* _M32102_H_ */ diff -Nru a/include/asm-m32r/m32102peri.h b/include/asm-m32r/m32102peri.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/m32102peri.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,468 @@ +/* $Id$ + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 2000,2001 by Hiroyuki Kondo + */ + +#ifndef __ASSEMBLY__ + +typedef void V; +typedef char B; +typedef short S; +typedef int W; +typedef long L; +typedef float F; +typedef double D; +typedef unsigned char UB; +typedef unsigned short US; +typedef unsigned int UW; +typedef unsigned long UL; +typedef const unsigned int CUW; + +/********************************* + +M32102 ICU + +*********************************/ +#define ICUISTS (UW *)0xa0EFF004 +#define ICUIREQ0 (UW *)0xa0EFF008 +#define ICUIREQ1 (UW *)0xa0EFF00C + +#define ICUSBICR (UW *)0xa0EFF018 +#define ICUIMASK (UW *)0xa0EFF01C + +#define ICUCR1 (UW *)0xa0EFF200 /* INT0 */ +#define ICUCR2 (UW *)0xa0EFF204 /* INT1 */ +#define ICUCR3 (UW *)0xa0EFF208 /* INT2 */ +#define ICUCR4 (UW *)0xa0EFF20C /* INT3 */ +#define ICUCR5 (UW *)0xa0EFF210 /* INT4 */ +#define ICUCR6 (UW *)0xa0EFF214 /* INT5 */ +#define ICUCR7 (UW *)0xa0EFF218 /* INT6 */ + +#define ICUCR16 (UW *)0xa0EFF23C /* MFT0 */ +#define ICUCR17 (UW *)0xa0EFF240 /* MFT1 */ +#define ICUCR18 (UW *)0xa0EFF244 /* MFT2 */ +#define ICUCR19 (UW *)0xa0EFF248 /* MFT3 */ +#define ICUCR20 (UW *)0xa0EFF24C /* MFT4 */ +#define ICUCR21 (UW *)0xa0EFF250 /* MFT5 */ + +#define ICUCR32 (UW *)0xa0EFF27C /* DMA0 */ +#define ICUCR33 (UW *)0xa0EFF280 /* DMA1 */ + +#define ICUCR48 (UW *)0xa0EFF2BC /* SIO0R */ +#define ICUCR49 (UW *)0xa0EFF2C0 /* SIO0S */ +#define ICUCR50 (UW *)0xa0EFF2C4 /* SIO1R */ +#define ICUCR51 (UW *)0xa0EFF2C8 /* SIO1S */ +#define ICUCR52 (UW *)0xa0EFF2CC /* SIO2R */ +#define ICUCR53 (UW *)0xa0EFF2D0 /* SIO2S */ +#define ICUCR54 (UW *)0xa0EFF2D4 /* SIO3R */ +#define ICUCR55 (UW *)0xa0EFF2D8 /* SIO3S */ +#define ICUCR56 (UW *)0xa0EFF2DC /* SIO4R */ +#define ICUCR57 (UW *)0xa0EFF2E0 /* SIO4S */ + +/********************************* + +M32102 MFT + +*********************************/ +#define MFTCR (US *)0xa0EFC002 +#define MFTRPR (UB *)0xa0EFC006 + +#define MFT0MOD (US *)0xa0EFC102 +#define MFT0BOS (US *)0xa0EFC106 +#define MFT0CUT (US *)0xa0EFC10A +#define MFT0RLD (US *)0xa0EFC10E +#define MFT0CRLD (US *)0xa0EFC112 + +#define MFT1MOD (US *)0xa0EFC202 +#define MFT1BOS (US *)0xa0EFC206 +#define MFT1CUT (US *)0xa0EFC20A +#define MFT1RLD (US *)0xa0EFC20E +#define MFT1CRLD (US *)0xa0EFC212 + +#define MFT2MOD (US *)0xa0EFC302 +#define MFT2BOS (US *)0xa0EFC306 +#define MFT2CUT (US *)0xa0EFC30A +#define MFT2RLD (US *)0xa0EFC30E +#define MFT2CRLD (US *)0xa0EFC312 + +#define MFT3MOD (US *)0xa0EFC402 +#define MFT3CUT (US *)0xa0EFC40A +#define MFT3RLD (US *)0xa0EFC40E +#define MFT3CRLD (US *)0xa0EFC412 + +#define MFT4MOD (US *)0xa0EFC502 +#define MFT4CUT (US *)0xa0EFC50A +#define MFT4RLD (US *)0xa0EFC50E +#define MFT4CRLD (US *)0xa0EFC512 + +#define MFT5MOD (US *)0xa0EFC602 +#define MFT5CUT (US *)0xa0EFC60A +#define MFT5RLD (US *)0xa0EFC60E +#define MFT5CRLD (US *)0xa0EFC612 + +/********************************* + +M32102 SIO + +*********************************/ + +#define SIO0CR (volatile int *)0xa0efd000 +#define SIO0MOD0 (volatile int *)0xa0efd004 +#define SIO0MOD1 (volatile int *)0xa0efd008 +#define SIO0STS (volatile int *)0xa0efd00c +#define SIO0IMASK (volatile int *)0xa0efd010 +#define SIO0BAUR (volatile int *)0xa0efd014 +#define SIO0RBAUR (volatile int *)0xa0efd018 +#define SIO0TXB (volatile int *)0xa0efd01c +#define SIO0RXB (volatile int *)0xa0efd020 + +#define SIO1CR (volatile int *)0xa0efd100 +#define SIO1MOD0 (volatile int *)0xa0efd104 +#define SIO1MOD1 (volatile int *)0xa0efd108 +#define SIO1STS (volatile int *)0xa0efd10c +#define SIO1IMASK (volatile int *)0xa0efd110 +#define SIO1BAUR (volatile int *)0xa0efd114 +#define SIO1RBAUR (volatile int *)0xa0efd118 +#define SIO1TXB (volatile int *)0xa0efd11c +#define SIO1RXB (volatile int *)0xa0efd120 +/********************************* + +M32102 PORT + +*********************************/ +#define PIEN (UB *)0xa0EF1003 /* input enable */ + +#define P0DATA (UB *)0xa0EF1020 /* data */ +#define P1DATA (UB *)0xa0EF1021 +#define P2DATA (UB *)0xa0EF1022 +#define P3DATA (UB *)0xa0EF1023 +#define P4DATA (UB *)0xa0EF1024 +#define P5DATA (UB *)0xa0EF1025 +#define P6DATA (UB *)0xa0EF1026 +#define P7DATA (UB *)0xa0EF1027 + +#define P0DIR (UB *)0xa0EF1040 /* direction */ +#define P1DIR (UB *)0xa0EF1041 +#define P2DIR (UB *)0xa0EF1042 +#define P3DIR (UB *)0xa0EF1043 +#define P4DIR (UB *)0xa0EF1044 +#define P5DIR (UB *)0xa0EF1045 +#define P6DIR (UB *)0xa0EF1046 +#define P7DIR (UB *)0xa0EF1047 + +#define P0MOD (US *)0xa0EF1060 /* mode control */ +#define P1MOD (US *)0xa0EF1062 +#define P2MOD (US *)0xa0EF1064 +#define P3MOD (US *)0xa0EF1066 +#define P4MOD (US *)0xa0EF1068 +#define P5MOD (US *)0xa0EF106A +#define P6MOD (US *)0xa0EF106C +#define P7MOD (US *)0xa0EF106E + +#define P0ODCR (UB *)0xa0EF1080 /* open-drain control */ +#define P1ODCR (UB *)0xa0EF1081 +#define P2ODCR (UB *)0xa0EF1082 +#define P3ODCR (UB *)0xa0EF1083 +#define P4ODCR (UB *)0xa0EF1084 +#define P5ODCR (UB *)0xa0EF1085 +#define P6ODCR (UB *)0xa0EF1086 +#define P7ODCR (UB *)0xa0EF1087 + +/********************************* + +M32102 Cache + +********************************/ + +#define MCCR (US *)0xFFFFFFFE + + +#else /* __ASSEMBLY__ */ + +;; +;; PIO 0x80ef1000 +;; + +#define PIEN 0xa0ef1000 + +#define P0DATA 0xa0ef1020 +#define P1DATA 0xa0ef1021 +#define P2DATA 0xa0ef1022 +#define P3DATA 0xa0ef1023 +#define P4DATA 0xa0ef1024 +#define P5DATA 0xa0ef1025 +#define P6DATA 0xa0ef1026 +#define P7DATA 0xa0ef1027 + +#define P0DIR 0xa0ef1040 +#define P1DIR 0xa0ef1041 +#define P2DIR 0xa0ef1042 +#define P3DIR 0xa0ef1043 +#define P4DIR 0xa0ef1044 +#define P5DIR 0xa0ef1045 +#define P6DIR 0xa0ef1046 +#define P7DIR 0xa0ef1047 + +#define P0MOD 0xa0ef1060 +#define P1MOD 0xa0ef1062 +#define P2MOD 0xa0ef1064 +#define P3MOD 0xa0ef1066 +#define P4MOD 0xa0ef1068 +#define P5MOD 0xa0ef106a +#define P6MOD 0xa0ef106c +#define P7MOD 0xa0ef106e +; +#define P0ODCR 0xa0ef1080 +#define P1ODCR 0xa0ef1081 +#define P2ODCR 0xa0ef1082 +#define P3ODCR 0xa0ef1083 +#define P4ODCR 0xa0ef1084 +#define P5ODCR 0xa0ef1085 +#define P6ODCR 0xa0ef1086 +#define P7ODCR 0xa0ef1087 + +;; +;; WDT 0xa0ef2000 +;; + +#define WDTCR 0xa0ef2000 + + +;; +;; CLK 0xa0ef4000 +;; + +#define CPUCLKCR 0xa0ef4000 +#define CLKMOD 0xa0ef4004 +#define PLLCR 0xa0ef4008 + + +;; +;; BSEL 0xa0ef5000 +;; + +#define BSEL0CR 0xa0ef5000 +#define BSEL1CR 0xa0ef5004 +#define BSEL2CR 0xa0ef5008 +#define BSEL3CR 0xa0ef500c +#define BSEL4CR 0xa0ef5010 +#define BSEL5CR 0xa0ef5014 + + +;; +;; SDRAMC 0xa0ef6000 +;; + +#define SDRF0 0xa0ef6000 +#define SDRF1 0xa0ef6004 +#define SDIR0 0xa0ef6008 +#define SDIR1 0xa0ef600c +#define SDBR 0xa0ef6010 + +;; CH0 +#define SD0ADR 0xa0ef6020 +#define SD0SZ 0xa0ef6022 +#define SD0ER 0xa0ef6024 +#define SD0TR 0xa0ef6028 +#define SD0MOD 0xa0ef602c + +;; CH1 +#define SD1ADR 0xa0ef6040 +#define SD1SZ 0xa0ef6042 +#define SD1ER 0xa0ef6044 +#define SD1TR 0xa0ef6048 +#define SD1MOD 0xa0ef604c + + +;; +;; DMAC 0xa0ef8000 +;; + +#define DMAEN 0xa0ef8000 +#define DMAISTS 0xa0ef8004 +#define DMAEDET 0xa0ef8008 +#define DMAASTS 0xa0ef800c + +;; CH0 +#define DMA0CR0 0xa0ef8100 +#define DMA0CR1 0xa0ef8104 +#define DMA0CSA 0xa0ef8108 +#define DMA0RSA 0xa0ef810c +#define DMA0CDA 0xa0ef8110 +#define DMA0RDA 0xa0ef8114 +#define DMA0CBCUT 0xa0ef8118 +#define DMA0RBCUT 0xa0ef811c + +;; CH1 +#define DMA1CR0 0xa0ef8200 +#define DMA1CR1 0xa0ef8204 +#define DMA1CSA 0xa0ef8208 +#define DMA1RSA 0xa0ef820c +#define DMA1CDA 0xa0ef8210 +#define DMA1RDA 0xa0ef8214 +#define DMA1CBCUT 0xa0ef8218 +#define DMA1RBCUT 0xa0ef821c + + +;; +;; MFT 0xa0efc000 +;; + +#define MFTCR 0xa0efc000 +#define MFTRPR 0xa0efc004 + +;; CH0 +#define MFT0MOD 0xa0efc100 +#define MFT0BOS 0xa0efc104 +#define MFT0CUT 0xa0efc108 +#define MFT0RLD 0xa0efc10c +#define MFT0CMPRLD 0xa0efc110 + +;; CH1 +#define MFT1MOD 0xa0efc200 +#define MFT1BOS 0xa0efc204 +#define MFT1CUT 0xa0efc208 +#define MFT1RLD 0xa0efc20c +#define MFT1CMPRLD 0xa0efc210 + +;; CH2 +#define MFT2MOD 0xa0efc300 +#define MFT2BOS 0xa0efc304 +#define MFT2CUT 0xa0efc308 +#define MFT2RLD 0xa0efc30c +#define MFT2CMPRLD 0xa0efc310 + +;; CH3 +#define MFT3MOD 0xa0efc400 +#define MFT3BOS 0xa0efc404 +#define MFT3CUT 0xa0efc408 +#define MFT3RLD 0xa0efc40c +#define MFT3CMPRLD 0xa0efc410 + +;; CH4 +#define MFT4MOD 0xa0efc500 +#define MFT4BOS 0xa0efc504 +#define MFT4CUT 0xa0efc508 +#define MFT4RLD 0xa0efc50c +#define MFT4CMPRLD 0xa0efc510 + +;; CH5 +#define MFT5MOD 0xa0efc600 +#define MFT5BOS 0xa0efc604 +#define MFT5CUT 0xa0efc608 +#define MFT5RLD 0xa0efc60c +#define MFT5CMPRLD 0xa0efc610 + + +;; +;; SIO 0xa0efd000 +;; + +;; CH0 +#define SIO0CR 0xa0efd000 +#define SIO0MOD0 0xa0efd004 +#define SIO0MOD1 0xa0efd008 +#define SIO0STS 0xa0efd00c +#define SIO0IMASK 0xa0efd010 +#define SIO0BAUR 0xa0efd014 +#define SIO0RBAUR 0xa0efd018 +#define SIO0TXB 0xa0efd01c +#define SIO0RXB 0xa0efd020 + +;; CH1 +#define SIO1CR 0xa0efd100 +#define SIO1MOD0 0xa0efd104 +#define SIO1MOD1 0xa0efd108 +#define SIO1STS 0xa0efd10c +#define SIO1IMASK 0xa0efd110 +#define SIO1BAUR 0xa0efd114 +#define SIO1RBAUR 0xa0efd118 +#define SIO1TXB 0xa0efd11c +#define SIO1RXB 0xa0efd120 + +;; CH2 +#define SIO2CR 0xa0efd200 +#define SIO2MOD0 0xa0efd204 +#define SIO2MOD1 0xa0efd208 +#define SIO2STS 0xa0efd20c +#define SIO2IMASK 0xa0efd210 +#define SIO2BAUR 0xa0efd214 +#define SIO2RBAUR 0xa0efd218 +#define SIO2TXB 0xa0efd21c +#define SIO2RXB 0xa0efd220 + +;; CH3 +#define SIO3CR 0xa0efd300 +#define SIO3MOD0 0xa0efd304 +#define SIO3MOD1 0xa0efd308 +#define SIO3STS 0xa0efd30c +#define SIO3IMASK 0xa0efd310 +#define SIO3BAUR 0xa0efd314 +#define SIO3RBAUR 0xa0efd318 +#define SIO3TXB 0xa0efd31c +#define SIO3RXB 0xa0efd320 + +;; CH4 +#define SIO4CR 0xa0efd400 +#define SIO4MOD0 0xa0efd404 +#define SIO4MOD1 0xa0efd408 +#define SIO4STS 0xa0efd40c +#define SIO4IMASK 0xa0efd410 +#define SIO4BAUR 0xa0efd414 +#define SIO4RBAUR 0xa0efd418 +#define SIO4TXB 0xa0efd41c +#define SIO4RXB 0xa0efd420 + + +;; +;; ICU 0xa0eff000 +;; + +#define ICUISTS 0xa0eff004 +#define ICUIREQ0 0xa0eff008 +#define ICUIREQ1 0xa0eff00c + +#define ICUSBICR 0xa0eff018 +#define ICUIMASK 0xa0eff01c + +#define ICUCR1 0xa0eff200 +#define ICUCR2 0xa0eff204 +#define ICUCR3 0xa0eff208 +#define ICUCR4 0xa0eff20c +#define ICUCR5 0xa0eff210 +#define ICUCR6 0xa0eff214 +#define ICUCR7 0xa0eff218 + +#define ICUCR16 0xa0eff23c +#define ICUCR17 0xa0eff240 +#define ICUCR18 0xa0eff244 +#define ICUCR19 0xa0eff248 +#define ICUCR20 0xa0eff24c +#define ICUCR21 0xa0eff250 + +#define ICUCR32 0xa0eff27c +#define ICUCR33 0xa0eff280 + +#define ICUCR48 0xa0eff2bc +#define ICUCR49 0xa0eff2c0 +#define ICUCR50 0xa0eff2c4 +#define ICUCR51 0xa0eff2c8 +#define ICUCR52 0xa0eff2cc +#define ICUCR53 0xa0eff2d0 +#define ICUCR54 0xa0eff2d4 +#define ICUCR55 0xa0eff2d8 +#define ICUCR56 0xa0eff2dc +#define ICUCR57 0xa0eff2e0 + +;; +;; CACHE +;; + +#define MCCR 0xfffffffc + + +#endif /* __ASSEMBLY__ */ diff -Nru a/include/asm-m32r/m32700ut/m32700ut_lan.h b/include/asm-m32r/m32700ut/m32700ut_lan.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/m32700ut/m32700ut_lan.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,107 @@ +/* + * include/asm/m32700ut_lan.h + * + * M32700UT-LAN board + * + * Copyright (c) 2002 Takeo Takahashi + * + * 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. + * + * $Id$ + */ + +#ifndef _M32700UT_M32700UT_LAN_H +#define _M32700UT_M32700UT_LAN_H + +#include + +#ifndef __ASSEMBLY__ +/* + * C functions use non-cache address. + */ +#define M32700UT_LAN_BASE (0x10000000 /* + NONCACHE_OFFSET */) +#else +#define M32700UT_LAN_BASE (0x10000000 + NONCACHE_OFFSET) +#endif /* __ASSEMBLY__ */ + +/* ICU + * ICUISTS: status register + * ICUIREQ0: request register + * ICUIREQ1: request register + * ICUCR3: control register for CFIREQ# interrupt + * ICUCR4: control register for CFC Card insert interrupt + * ICUCR5: control register for CFC Card eject interrupt + * ICUCR6: control register for external interrupt + * ICUCR11: control register for MMC Card insert/eject interrupt + * ICUCR13: control register for SC error interrupt + * ICUCR14: control register for SC receive interrupt + * ICUCR15: control register for SC send interrupt + * ICUCR16: control register for SIO0 receive interrupt + * ICUCR17: control register for SIO0 send interrupt + */ +#define M32700UT_LAN_IRQ_LAN (M32700UT_LAN_PLD_IRQ_BASE + 1) /* LAN */ +#define M32700UT_LAN_IRQ_I2C (M32700UT_LAN_PLD_IRQ_BASE + 3) /* I2C */ + +#define M32700UT_LAN_ICUISTS __reg16(M32700UT_LAN_BASE + 0xc0002) +#define M32700UT_LAN_ICUISTS_VECB_MASK (0xf000) +#define M32700UT_LAN_VECB(x) ((x) & M32700UT_LAN_ICUISTS_VECB_MASK) +#define M32700UT_LAN_ICUISTS_ISN_MASK (0x07c0) +#define M32700UT_LAN_ICUISTS_ISN(x) ((x) & M32700UT_LAN_ICUISTS_ISN_MASK) +#define M32700UT_LAN_ICUIREQ0 __reg16(M32700UT_LAN_BASE + 0xc0004) +#define M32700UT_LAN_ICUCR1 __reg16(M32700UT_LAN_BASE + 0xc0010) +#define M32700UT_LAN_ICUCR3 __reg16(M32700UT_LAN_BASE + 0xc0014) + +/* + * AR register on PLD + */ +#define ARVCR0 __reg32(M32700UT_LAN_BASE + 0x40000) +#define ARVCR0_VDS 0x00080000 +#define ARVCR0_RST 0x00010000 +#define ARVCR1 __reg32(M32700UT_LAN_BASE + 0x40004) +#define ARVCR1_QVGA 0x02000000 +#define ARVCR1_NORMAL 0x01000000 +#define ARVCR1_HIEN 0x00010000 +#define ARVHCOUNT __reg32(M32700UT_LAN_BASE + 0x40008) +#define ARDATA __reg32(M32700UT_LAN_BASE + 0x40010) +#define ARINTSEL __reg32(M32700UT_LAN_BASE + 0x40014) +#define ARINTSEL_INT3 0x10000000 /* CPU INT3 */ +#define ARDATA32 __reg32(M32700UT_LAN_BASE + 0x04040010) // Block 5 +/* +#define ARINTSEL_SEL2 0x00002000 +#define ARINTSEL_SEL3 0x00001000 +#define ARINTSEL_SEL6 0x00000200 +#define ARINTSEL_SEL7 0x00000100 +#define ARINTSEL_SEL9 0x00000040 +#define ARINTSEL_SEL10 0x00000020 +#define ARINTSEL_SEL11 0x00000010 +#define ARINTSEL_SEL12 0x00000008 +*/ + +/* + * I2C register on PLD + */ +#define PLDI2CCR __reg32(M32700UT_LAN_BASE + 0x40040) +#define PLDI2CCR_ES0 0x00000001 /* enable I2C interface */ +#define PLDI2CMOD __reg32(M32700UT_LAN_BASE + 0x40044) +#define PLDI2CMOD_ACKCLK 0x00000200 +#define PLDI2CMOD_DTWD 0x00000100 +#define PLDI2CMOD_10BT 0x00000004 +#define PLDI2CMOD_ATM_NORMAL 0x00000000 +#define PLDI2CMOD_ATM_AUTO 0x00000003 +#define PLDI2CACK __reg32(M32700UT_LAN_BASE + 0x40048) +#define PLDI2CACK_ACK 0x00000001 +#define PLDI2CFREQ __reg32(M32700UT_LAN_BASE + 0x4004c) +#define PLDI2CCND __reg32(M32700UT_LAN_BASE + 0x40050) +#define PLDI2CCND_START 0x00000001 +#define PLDI2CCND_STOP 0x00000002 +#define PLDI2CSTEN __reg32(M32700UT_LAN_BASE + 0x40054) +#define PLDI2CSTEN_STEN 0x00000001 +#define PLDI2CDATA __reg32(M32700UT_LAN_BASE + 0x40060) +#define PLDI2CSTS __reg32(M32700UT_LAN_BASE + 0x40064) +#define PLDI2CSTS_TRX 0x00000020 +#define PLDI2CSTS_BB 0x00000010 +#define PLDI2CSTS_NOACK 0x00000001 /* 0:ack, 1:noack */ + +#endif /* _M32700UT_M32700UT_LAN_H */ diff -Nru a/include/asm-m32r/m32700ut/m32700ut_lcd.h b/include/asm-m32r/m32700ut/m32700ut_lcd.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/m32700ut/m32700ut_lcd.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,59 @@ +/* + * include/asm/m32700ut_lcd.h + * + * M32700UT-LCD board + * + * Copyright (c) 2002 Takeo Takahashi + * + * 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. + * + * $Id$ + */ + +#ifndef _M32700UT_M32700UT_LCD_H +#define _M32700UT_M32700UT_LCD_H + +#include + +#ifndef __ASSEMBLY__ +/* + * C functions use non-cache address. + */ +#define M32700UT_LCD_BASE (0x10000000 /* + NONCACHE_OFFSET */) +#else +#define M32700UT_LCD_BASE (0x10000000 + NONCACHE_OFFSET) +#endif /* __ASSEMBLY__ */ + +/* + * ICU + */ +#define M32700UT_LCD_IRQ_BAT_INT (M32700UT_LCD_PLD_IRQ_BASE + 1) +#define M32700UT_LCD_IRQ_USB_INT1 (M32700UT_LCD_PLD_IRQ_BASE + 2) +#define M32700UT_LCD_IRQ_AUDT0 (M32700UT_LCD_PLD_IRQ_BASE + 3) +#define M32700UT_LCD_IRQ_AUDT2 (M32700UT_LCD_PLD_IRQ_BASE + 4) +#define M32700UT_LCD_IRQ_BATSIO_RCV (M32700UT_LCD_PLD_IRQ_BASE + 16) +#define M32700UT_LCD_IRQ_BATSIO_SND (M32700UT_LCD_PLD_IRQ_BASE + 17) +#define M32700UT_LCD_IRQ_ASNDSIO_RCV (M32700UT_LCD_PLD_IRQ_BASE + 18) +#define M32700UT_LCD_IRQ_ASNDSIO_SND (M32700UT_LCD_PLD_IRQ_BASE + 19) +#define M32700UT_LCD_IRQ_ACNLSIO_SND (M32700UT_LCD_PLD_IRQ_BASE + 21) + +#define M32700UT_LCD_ICUISTS __reg16(M32700UT_LCD_BASE + 0x300002) +#define M32700UT_LCD_ICUISTS_VECB_MASK (0xf000) +#define M32700UT_LCD_VECB(x) ((x) & M32700UT_LCD_ICUISTS_VECB_MASK) +#define M32700UT_LCD_ICUISTS_ISN_MASK (0x07c0) +#define M32700UT_LCD_ICUISTS_ISN(x) ((x) & M32700UT_LCD_ICUISTS_ISN_MASK) +#define M32700UT_LCD_ICUIREQ0 __reg16(M32700UT_LCD_BASE + 0x300004) +#define M32700UT_LCD_ICUIREQ1 __reg16(M32700UT_LCD_BASE + 0x300006) +#define M32700UT_LCD_ICUCR1 __reg16(M32700UT_LCD_BASE + 0x300020) +#define M32700UT_LCD_ICUCR2 __reg16(M32700UT_LCD_BASE + 0x300022) +#define M32700UT_LCD_ICUCR3 __reg16(M32700UT_LCD_BASE + 0x300024) +#define M32700UT_LCD_ICUCR4 __reg16(M32700UT_LCD_BASE + 0x300026) +#define M32700UT_LCD_ICUCR16 __reg16(M32700UT_LCD_BASE + 0x300030) +#define M32700UT_LCD_ICUCR17 __reg16(M32700UT_LCD_BASE + 0x300032) +#define M32700UT_LCD_ICUCR18 __reg16(M32700UT_LCD_BASE + 0x300034) +#define M32700UT_LCD_ICUCR19 __reg16(M32700UT_LCD_BASE + 0x300036) +#define M32700UT_LCD_ICUCR21 __reg16(M32700UT_LCD_BASE + 0x30003a) + +#endif /* _M32700UT_M32700UT_LCD_H */ diff -Nru a/include/asm-m32r/m32700ut/m32700ut_pld.h b/include/asm-m32r/m32700ut/m32700ut_pld.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/m32700ut/m32700ut_pld.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,265 @@ +/* + * include/asm/m32700ut/m32700ut_pld.h + * + * Definitions for Programable Logic Device(PLD) on M32700UT board. + * + * Copyright (c) 2002 Takeo Takahashi + * + * 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. + * + * $Id$ + */ + +#ifndef _M32700UT_M32700UT_PLD_H +#define _M32700UT_M32700UT_PLD_H + +#include + +#if defined(CONFIG_PLAT_M32700UT_Alpha) +#define PLD_PLAT_BASE 0x08c00000 +#elif defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_USRV) +#define PLD_PLAT_BASE 0x04c00000 +#else +#error "no platform configuration" +#endif + +#ifndef __ASSEMBLY__ +/* + * C functions use non-cache address. + */ +#define PLD_BASE (PLD_PLAT_BASE /* + NONCACHE_OFFSET */) +#define __reg8 (volatile unsigned char *) +#define __reg16 (volatile unsigned short *) +#define __reg32 (volatile unsigned int *) +#else +#define PLD_BASE (PLD_PLAT_BASE + NONCACHE_OFFSET) +#define __reg8 +#define __reg16 +#define __reg32 +#endif /* __ASSEMBLY__ */ + +/* CFC */ +#define PLD_CFRSTCR __reg16(PLD_BASE + 0x0000) +#define PLD_CFSTS __reg16(PLD_BASE + 0x0002) +#define PLD_CFIMASK __reg16(PLD_BASE + 0x0004) +#define PLD_CFBUFCR __reg16(PLD_BASE + 0x0006) +#define PLD_CFVENCR __reg16(PLD_BASE + 0x0008) +#define PLD_CFCR0 __reg16(PLD_BASE + 0x000a) +#define PLD_CFCR1 __reg16(PLD_BASE + 0x000c) +#define PLD_IDERSTCR __reg16(PLD_BASE + 0x0010) + +/* MMC */ +#define PLD_MMCCR __reg16(PLD_BASE + 0x4000) +#define PLD_MMCMOD __reg16(PLD_BASE + 0x4002) +#define PLD_MMCSTS __reg16(PLD_BASE + 0x4006) +#define PLD_MMCBAUR __reg16(PLD_BASE + 0x400a) +#define PLD_MMCCMDBCUT __reg16(PLD_BASE + 0x400c) +#define PLD_MMCCDTBCUT __reg16(PLD_BASE + 0x400e) +#define PLD_MMCDET __reg16(PLD_BASE + 0x4010) +#define PLD_MMCWP __reg16(PLD_BASE + 0x4012) +#define PLD_MMCWDATA __reg16(PLD_BASE + 0x5000) +#define PLD_MMCRDATA __reg16(PLD_BASE + 0x6000) +#define PLD_MMCCMDDATA __reg16(PLD_BASE + 0x7000) +#define PLD_MMCRSPDATA __reg16(PLD_BASE + 0x7006) + +/* ICU + * ICUISTS: status register + * ICUIREQ0: request register + * ICUIREQ1: request register + * ICUCR3: control register for CFIREQ# interrupt + * ICUCR4: control register for CFC Card insert interrupt + * ICUCR5: control register for CFC Card eject interrupt + * ICUCR6: control register for external interrupt + * ICUCR11: control register for MMC Card insert/eject interrupt + * ICUCR13: control register for SC error interrupt + * ICUCR14: control register for SC receive interrupt + * ICUCR15: control register for SC send interrupt + * ICUCR16: control register for SIO0 receive interrupt + * ICUCR17: control register for SIO0 send interrupt + */ +#if !defined(CONFIG_PLAT_USRV) +#define PLD_IRQ_INT0 (M32700UT_PLD_IRQ_BASE + 0) /* None */ +#define PLD_IRQ_INT1 (M32700UT_PLD_IRQ_BASE + 1) /* reserved */ +#define PLD_IRQ_INT2 (M32700UT_PLD_IRQ_BASE + 2) /* reserved */ +#define PLD_IRQ_CFIREQ (M32700UT_PLD_IRQ_BASE + 3) /* CF IREQ */ +#define PLD_IRQ_CFC_INSERT (M32700UT_PLD_IRQ_BASE + 4) /* CF Insert */ +#define PLD_IRQ_CFC_EJECT (M32700UT_PLD_IRQ_BASE + 5) /* CF Eject */ +#define PLD_IRQ_EXINT (M32700UT_PLD_IRQ_BASE + 6) /* EXINT */ +#define PLD_IRQ_INT7 (M32700UT_PLD_IRQ_BASE + 7) /* reserved */ +#define PLD_IRQ_INT8 (M32700UT_PLD_IRQ_BASE + 8) /* reserved */ +#define PLD_IRQ_INT9 (M32700UT_PLD_IRQ_BASE + 9) /* reserved */ +#define PLD_IRQ_INT10 (M32700UT_PLD_IRQ_BASE + 10) /* reserved */ +#define PLD_IRQ_MMCCARD (M32700UT_PLD_IRQ_BASE + 11) /* MMC Insert/Eject */ +#define PLD_IRQ_INT12 (M32700UT_PLD_IRQ_BASE + 12) /* reserved */ +#define PLD_IRQ_SC_ERROR (M32700UT_PLD_IRQ_BASE + 13) /* SC error */ +#define PLD_IRQ_SC_RCV (M32700UT_PLD_IRQ_BASE + 14) /* SC receive */ +#define PLD_IRQ_SC_SND (M32700UT_PLD_IRQ_BASE + 15) /* SC send */ +#define PLD_IRQ_SIO0_RCV (M32700UT_PLD_IRQ_BASE + 16) /* SIO receive */ +#define PLD_IRQ_SIO0_SND (M32700UT_PLD_IRQ_BASE + 17) /* SIO send */ +#define PLD_IRQ_INT18 (M32700UT_PLD_IRQ_BASE + 18) /* reserved */ +#define PLD_IRQ_INT19 (M32700UT_PLD_IRQ_BASE + 19) /* reserved */ +#define PLD_IRQ_INT20 (M32700UT_PLD_IRQ_BASE + 20) /* reserved */ +#define PLD_IRQ_INT21 (M32700UT_PLD_IRQ_BASE + 21) /* reserved */ +#define PLD_IRQ_INT22 (M32700UT_PLD_IRQ_BASE + 22) /* reserved */ +#define PLD_IRQ_INT23 (M32700UT_PLD_IRQ_BASE + 23) /* reserved */ +#define PLD_IRQ_INT24 (M32700UT_PLD_IRQ_BASE + 24) /* reserved */ +#define PLD_IRQ_INT25 (M32700UT_PLD_IRQ_BASE + 25) /* reserved */ +#define PLD_IRQ_INT26 (M32700UT_PLD_IRQ_BASE + 26) /* reserved */ +#define PLD_IRQ_INT27 (M32700UT_PLD_IRQ_BASE + 27) /* reserved */ +#define PLD_IRQ_INT28 (M32700UT_PLD_IRQ_BASE + 28) /* reserved */ +#define PLD_IRQ_INT29 (M32700UT_PLD_IRQ_BASE + 29) /* reserved */ +#define PLD_IRQ_INT30 (M32700UT_PLD_IRQ_BASE + 30) /* reserved */ +#define PLD_IRQ_INT31 (M32700UT_PLD_IRQ_BASE + 31) /* reserved */ + +#else /* CONFIG_PLAT_USRV */ + +#define PLD_IRQ_INT0 (M32700UT_PLD_IRQ_BASE + 0) /* None */ +#define PLD_IRQ_INT1 (M32700UT_PLD_IRQ_BASE + 1) /* reserved */ +#define PLD_IRQ_INT2 (M32700UT_PLD_IRQ_BASE + 2) /* reserved */ +#define PLD_IRQ_CF0 (M32700UT_PLD_IRQ_BASE + 3) /* CF0# */ +#define PLD_IRQ_CF1 (M32700UT_PLD_IRQ_BASE + 4) /* CF1# */ +#define PLD_IRQ_CF2 (M32700UT_PLD_IRQ_BASE + 5) /* CF2# */ +#define PLD_IRQ_CF3 (M32700UT_PLD_IRQ_BASE + 6) /* CF3# */ +#define PLD_IRQ_CF4 (M32700UT_PLD_IRQ_BASE + 7) /* CF4# */ +#define PLD_IRQ_INT8 (M32700UT_PLD_IRQ_BASE + 8) /* reserved */ +#define PLD_IRQ_INT9 (M32700UT_PLD_IRQ_BASE + 9) /* reserved */ +#define PLD_IRQ_INT10 (M32700UT_PLD_IRQ_BASE + 10) /* reserved */ +#define PLD_IRQ_INT11 (M32700UT_PLD_IRQ_BASE + 11) /* reserved */ +#define PLD_IRQ_UART0 (M32700UT_PLD_IRQ_BASE + 12) /* UARTIRQ0 */ +#define PLD_IRQ_UART1 (M32700UT_PLD_IRQ_BASE + 13) /* UARTIRQ1 */ +#define PLD_IRQ_INT14 (M32700UT_PLD_IRQ_BASE + 14) /* reserved */ +#define PLD_IRQ_INT15 (M32700UT_PLD_IRQ_BASE + 15) /* reserved */ +#define PLD_IRQ_SNDINT (M32700UT_PLD_IRQ_BASE + 16) /* SNDINT# */ +#define PLD_IRQ_INT17 (M32700UT_PLD_IRQ_BASE + 17) /* reserved */ +#define PLD_IRQ_INT18 (M32700UT_PLD_IRQ_BASE + 18) /* reserved */ +#define PLD_IRQ_INT19 (M32700UT_PLD_IRQ_BASE + 19) /* reserved */ +#define PLD_IRQ_INT20 (M32700UT_PLD_IRQ_BASE + 20) /* reserved */ +#define PLD_IRQ_INT21 (M32700UT_PLD_IRQ_BASE + 21) /* reserved */ +#define PLD_IRQ_INT22 (M32700UT_PLD_IRQ_BASE + 22) /* reserved */ +#define PLD_IRQ_INT23 (M32700UT_PLD_IRQ_BASE + 23) /* reserved */ +#define PLD_IRQ_INT24 (M32700UT_PLD_IRQ_BASE + 24) /* reserved */ +#define PLD_IRQ_INT25 (M32700UT_PLD_IRQ_BASE + 25) /* reserved */ +#define PLD_IRQ_INT26 (M32700UT_PLD_IRQ_BASE + 26) /* reserved */ +#define PLD_IRQ_INT27 (M32700UT_PLD_IRQ_BASE + 27) /* reserved */ +#define PLD_IRQ_INT28 (M32700UT_PLD_IRQ_BASE + 28) /* reserved */ +#define PLD_IRQ_INT29 (M32700UT_PLD_IRQ_BASE + 29) /* reserved */ +#define PLD_IRQ_INT30 (M32700UT_PLD_IRQ_BASE + 30) /* reserved */ + +#endif /* CONFIG_PLAT_USRV */ + +#define PLD_ICUISTS __reg16(PLD_BASE + 0x8002) +#define PLD_ICUISTS_VECB_MASK (0xf000) +#define PLD_ICUISTS_VECB(x) ((x) & PLD_ICUISTS_VECB_MASK) +#define PLD_ICUISTS_ISN_MASK (0x07c0) +#define PLD_ICUISTS_ISN(x) ((x) & PLD_ICUISTS_ISN_MASK) +#define PLD_ICUIREQ0 __reg16(PLD_BASE + 0x8004) +#define PLD_ICUIREQ1 __reg16(PLD_BASE + 0x8006) +#define PLD_ICUCR1 __reg16(PLD_BASE + 0x8100) +#define PLD_ICUCR2 __reg16(PLD_BASE + 0x8102) +#define PLD_ICUCR3 __reg16(PLD_BASE + 0x8104) +#define PLD_ICUCR4 __reg16(PLD_BASE + 0x8106) +#define PLD_ICUCR5 __reg16(PLD_BASE + 0x8108) +#define PLD_ICUCR6 __reg16(PLD_BASE + 0x810a) +#define PLD_ICUCR7 __reg16(PLD_BASE + 0x810c) +#define PLD_ICUCR8 __reg16(PLD_BASE + 0x810e) +#define PLD_ICUCR9 __reg16(PLD_BASE + 0x8110) +#define PLD_ICUCR10 __reg16(PLD_BASE + 0x8112) +#define PLD_ICUCR11 __reg16(PLD_BASE + 0x8114) +#define PLD_ICUCR12 __reg16(PLD_BASE + 0x8116) +#define PLD_ICUCR13 __reg16(PLD_BASE + 0x8118) +#define PLD_ICUCR14 __reg16(PLD_BASE + 0x811a) +#define PLD_ICUCR15 __reg16(PLD_BASE + 0x811c) +#define PLD_ICUCR16 __reg16(PLD_BASE + 0x811e) +#define PLD_ICUCR17 __reg16(PLD_BASE + 0x8120) +#define PLD_ICUCR_IEN (0x1000) +#define PLD_ICUCR_IREQ (0x0100) +#define PLD_ICUCR_ISMOD00 (0x0000) /* Low edge */ +#define PLD_ICUCR_ISMOD01 (0x0010) /* Low level */ +#define PLD_ICUCR_ISMOD02 (0x0020) /* High edge */ +#define PLD_ICUCR_ISMOD03 (0x0030) /* High level */ +#define PLD_ICUCR_ILEVEL0 (0x0000) +#define PLD_ICUCR_ILEVEL1 (0x0001) +#define PLD_ICUCR_ILEVEL2 (0x0002) +#define PLD_ICUCR_ILEVEL3 (0x0003) +#define PLD_ICUCR_ILEVEL4 (0x0004) +#define PLD_ICUCR_ILEVEL5 (0x0005) +#define PLD_ICUCR_ILEVEL6 (0x0006) +#define PLD_ICUCR_ILEVEL7 (0x0007) + +/* Power Control of MMC and CF */ +#define PLD_CPCR __reg16(PLD_BASE + 0x14000) +#define PLD_CPCR_CF 0x0001 +#define PLD_CPCR_MMC 0x0002 + +/* LED Control + * + * 1: DIP swich side + * 2: Reset switch side + */ +#define PLD_IOLEDCR __reg16(PLD_BASE + 0x14002) +#define PLD_IOLED_1_ON 0x001 +#define PLD_IOLED_1_OFF 0x000 +#define PLD_IOLED_2_ON 0x002 +#define PLD_IOLED_2_OFF 0x000 + +/* DIP Switch + * 0: Write-protect of Flash Memory (0:protected, 1:non-protected) + * 1: - + * 2: - + * 3: - + */ +#define PLD_IOSWSTS __reg16(PLD_BASE + 0x14004) +#define PLD_IOSWSTS_IOSW2 0x0200 +#define PLD_IOSWSTS_IOSW1 0x0100 +#define PLD_IOSWSTS_IOWP0 0x0001 + +/* CRC */ +#define PLD_CRC7DATA __reg16(PLD_BASE + 0x18000) +#define PLD_CRC7INDATA __reg16(PLD_BASE + 0x18002) +#define PLD_CRC16DATA __reg16(PLD_BASE + 0x18004) +#define PLD_CRC16INDATA __reg16(PLD_BASE + 0x18006) +#define PLD_CRC16ADATA __reg16(PLD_BASE + 0x18008) +#define PLD_CRC16AINDATA __reg16(PLD_BASE + 0x1800a) + +/* RTC */ +#define PLD_RTCCR __reg16(PLD_BASE + 0x1c000) +#define PLD_RTCBAUR __reg16(PLD_BASE + 0x1c002) +#define PLD_RTCWRDATA __reg16(PLD_BASE + 0x1c004) +#define PLD_RTCRDDATA __reg16(PLD_BASE + 0x1c006) +#define PLD_RTCRSTODT __reg16(PLD_BASE + 0x1c008) + +/* SIO0 */ +#define PLD_ESIO0CR __reg16(PLD_BASE + 0x20000) +#define PLD_ESIO0CR_TXEN 0x0001 +#define PLD_ESIO0CR_RXEN 0x0002 +#define PLD_ESIO0MOD0 __reg16(PLD_BASE + 0x20002) +#define PLD_ESIO0MOD0_CTSS 0x0040 +#define PLD_ESIO0MOD0_RTSS 0x0080 +#define PLD_ESIO0MOD1 __reg16(PLD_BASE + 0x20004) +#define PLD_ESIO0MOD1_LMFS 0x0010 +#define PLD_ESIO0STS __reg16(PLD_BASE + 0x20006) +#define PLD_ESIO0STS_TEMP 0x0001 +#define PLD_ESIO0STS_TXCP 0x0002 +#define PLD_ESIO0STS_RXCP 0x0004 +#define PLD_ESIO0STS_TXSC 0x0100 +#define PLD_ESIO0STS_RXSC 0x0200 +#define PLD_ESIO0STS_TXREADY (PLD_ESIO0STS_TXCP | PLD_ESIO0STS_TEMP) +#define PLD_ESIO0INTCR __reg16(PLD_BASE + 0x20008) +#define PLD_ESIO0INTCR_TXIEN 0x0002 +#define PLD_ESIO0INTCR_RXCEN 0x0004 +#define PLD_ESIO0BAUR __reg16(PLD_BASE + 0x2000a) +#define PLD_ESIO0TXB __reg16(PLD_BASE + 0x2000c) +#define PLD_ESIO0RXB __reg16(PLD_BASE + 0x2000e) + +/* SIM Card */ +#define PLD_SCCR __reg16(PLD_BASE + 0x38000) +#define PLD_SCMOD __reg16(PLD_BASE + 0x38004) +#define PLD_SCSTS __reg16(PLD_BASE + 0x38006) +#define PLD_SCINTCR __reg16(PLD_BASE + 0x38008) +#define PLD_SCBAUR __reg16(PLD_BASE + 0x3800a) +#define PLD_SCTXB __reg16(PLD_BASE + 0x3800c) +#define PLD_SCRXB __reg16(PLD_BASE + 0x3800e) + +#endif /* _M32700UT_M32700UT_PLD.H */ diff -Nru a/include/asm-m32r/m32r.h b/include/asm-m32r/m32r.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/m32r.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,135 @@ +#ifndef _ASM_M32R_M32R_H_ +#define _ASM_M32R_M32R_H_ + +/* + * Mitsubishi M32R processor + * Copyright (C) 1997-2002, Mitsubishi Electric Corporation + */ + +/* $Id$ */ + +#include + +/* Chip type */ +#if defined(CONFIG_CHIP_XNUX_MP) || defined(CONFIG_CHIP_XNUX2_MP) +#include +#elif defined(CONFIG_CHIP_VDEC2) || defined(CONFIG_CHIP_XNUX2) \ + || defined(CONFIG_CHIP_M32700) || defined(CONFIG_CHIP_M32102) \ + || defined(CONFIG_CHIP_OPSP) +#include +#include +#endif + +/* Platform type */ +#if defined(CONFIG_PLAT_M32700UT) +#include +#include +#include +#endif /* CONFIG_PLAT_M32700UT */ + +#if defined(CONFIG_PLAT_OPSPUT) +#include +#include +#include +#endif /* CONFIG_PLAT_OPSPUT */ + +#if defined(CONFIG_PLAT_MAPPI2) +#include +#endif /* CONFIG_PLAT_MAPPI2 */ + +#if defined(CONFIG_PLAT_USRV) +#include +#endif + +/* + * M32R Register + */ + +/* + * MMU Register + */ + +#define MMU_REG_BASE (0xffff0000) +#define ITLB_BASE (0xfe000000) +#define DTLB_BASE (0xfe000800) + +#define NR_TLB_ENTRIES CONFIG_TLB_ENTRIES + +#define MATM MMU_REG_BASE /* MMU Address Translation Mode + Register */ +#define MPSZ (0x04 + MMU_REG_BASE) /* MMU Page Size Designation Register */ +#define MASID (0x08 + MMU_REG_BASE) /* MMU Address Space ID Register */ +#define MESTS (0x0c + MMU_REG_BASE) /* MMU Exception Status Register */ +#define MDEVA (0x10 + MMU_REG_BASE) /* MMU Operand Exception Virtual + Address Register */ +#define MDEVP (0x14 + MMU_REG_BASE) /* MMU Operand Exception Virtual Page + Number Register */ +#define MPTB (0x18 + MMU_REG_BASE) /* MMU Page Table Base Register */ +#define MSVA (0x20 + MMU_REG_BASE) /* MMU Search Virtual Address + Register */ +#define MTOP (0x24 + MMU_REG_BASE) /* MMU TLB Operation Register */ +#define MIDXI (0x28 + MMU_REG_BASE) /* MMU Index Register for + Instruciton */ +#define MIDXD (0x2c + MMU_REG_BASE) /* MMU Index Register for Operand */ + +#define MATM_offset (MATM - MMU_REG_BASE) +#define MPSZ_offset (MPSZ - MMU_REG_BASE) +#define MASID_offset (MASID - MMU_REG_BASE) +#define MESTS_offset (MESTS - MMU_REG_BASE) +#define MDEVA_offset (MDEVA - MMU_REG_BASE) +#define MDEVP_offset (MDEVP - MMU_REG_BASE) +#define MPTB_offset (MPTB - MMU_REG_BASE) +#define MSVA_offset (MSVA - MMU_REG_BASE) +#define MTOP_offset (MTOP - MMU_REG_BASE) +#define MIDXI_offset (MIDXI - MMU_REG_BASE) +#define MIDXD_offset (MIDXD - MMU_REG_BASE) + +#define MESTS_IT (1 << 0) /* Instruction TLB miss */ +#define MESTS_IA (1 << 1) /* Instruction Access Exception */ +#define MESTS_DT (1 << 4) /* Operand TLB miss */ +#define MESTS_DA (1 << 5) /* Operand Access Exception */ +#define MESTS_DRW (1 << 6) /* Operand Write Exception Flag */ + +/* + * PSW (Processor Status Word) + */ + +/* PSW bit */ +#define M32R_PSW_BIT_SM (7) /* Stack Mode */ +#define M32R_PSW_BIT_IE (6) /* Interrupt Enable */ +#define M32R_PSW_BIT_PM (3) /* Processor Mode [0:Supervisor,1:User] */ +#define M32R_PSW_BIT_C (0) /* Condition */ +#define M32R_PSW_BIT_BSM (7+8) /* Backup Stack Mode */ +#define M32R_PSW_BIT_BIE (6+8) /* Backup Interrupt Enable */ +#define M32R_PSW_BIT_BPM (3+8) /* Backup Processor Mode */ +#define M32R_PSW_BIT_BC (0+8) /* Backup Condition */ + +/* PSW bit map */ +#define M32R_PSW_SM (1UL<< M32R_PSW_BIT_SM) /* Stack Mode */ +#define M32R_PSW_IE (1UL<< M32R_PSW_BIT_IE) /* Interrupt Enable */ +#define M32R_PSW_PM (1UL<< M32R_PSW_BIT_PM) /* Processor Mode */ +#define M32R_PSW_C (1UL<< M32R_PSW_BIT_C) /* Condition */ +#define M32R_PSW_BSM (1UL<< M32R_PSW_BIT_BSM) /* Backup Stack Mode */ +#define M32R_PSW_BIE (1UL<< M32R_PSW_BIT_BIE) /* Backup Interrupt Enable */ +#define M32R_PSW_BPM (1UL<< M32R_PSW_BIT_BPM) /* Backup Processor Mode */ +#define M32R_PSW_BC (1UL<< M32R_PSW_BIT_BC) /* Backup Condition */ + +/* + * Direct address to SFR + */ + +#include +#ifdef CONFIG_MMU +#define NONCACHE_OFFSET __PAGE_OFFSET+0x20000000 +#else +#define NONCACHE_OFFSET __PAGE_OFFSET +#endif /* CONFIG_MMU */ + +#define M32R_ICU_ISTS_ADDR M32R_ICU_ISTS_PORTL+NONCACHE_OFFSET +#define M32R_ICU_IPICR_ADDR M32R_ICU_IPICR0_PORTL+NONCACHE_OFFSET +#define M32R_ICU_IMASK_ADDR M32R_ICU_IMASK_PORTL+NONCACHE_OFFSET +#define M32R_FPGA_CPU_NAME_ADDR M32R_FPGA_CPU_NAME0_PORTL+NONCACHE_OFFSET +#define M32R_FPGA_MODEL_ID_ADDR M32R_FPGA_MODEL_ID0_PORTL+NONCACHE_OFFSET +#define M32R_FPGA_VERSION_ADDR M32R_FPGA_VERSION0_PORTL+NONCACHE_OFFSET + +#endif /* _ASM_M32R_M32R_H_ */ diff -Nru a/include/asm-m32r/m32r_mp_fpga.h b/include/asm-m32r/m32r_mp_fpga.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/m32r_mp_fpga.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,313 @@ +#ifndef _ASM_M32R_M32R_MP_FPGA_ +#define _ASM_M32R_M32R_MP_FPGA_ + +/* + * Mitsubishi M32R-MP-FPGA + * Copyright (c) 2002 [Hitoshi Yamamoto] All rights reserved. + */ + +/* $Id$ */ + +/* + * ======================================================== + * M32R-MP-FPGA Memory Map + * ======================================================== + * 0x00000000 : Block#0 : 64[MB] + * 0x03E00000 : SFR + * 0x03E00000 : reserved + * 0x03EF0000 : FPGA + * 0x03EF1000 : reserved + * 0x03EF4000 : CKM + * 0x03EF4000 : BSELC + * 0x03EF5000 : reserved + * 0x03EFC000 : MFT + * 0x03EFD000 : SIO + * 0x03EFE000 : reserved + * 0x03EFF000 : ICU + * 0x03F00000 : Internal SRAM 64[KB] + * 0x03F10000 : reserved + * -------------------------------------------------------- + * 0x04000000 : Block#1 : 64[MB] + * 0x04000000 : Debug board SRAM 4[MB] + * 0x04400000 : reserved + * -------------------------------------------------------- + * 0x08000000 : Block#2 : 64[MB] + * -------------------------------------------------------- + * 0x0C000000 : Block#3 : 64[MB] + * -------------------------------------------------------- + * 0x10000000 : Block#4 : 64[MB] + * -------------------------------------------------------- + * 0x14000000 : Block#5 : 64[MB] + * -------------------------------------------------------- + * 0x18000000 : Block#6 : 64[MB] + * -------------------------------------------------------- + * 0x1C000000 : Block#7 : 64[MB] + * -------------------------------------------------------- + * 0xFE000000 : TLB + * 0xFE000000 : ITLB + * 0xFE000080 : reserved + * 0xFE000800 : DTLB + * 0xFE000880 : reserved + * -------------------------------------------------------- + * 0xFF000000 : System area + * 0xFFFF0000 : MMU + * 0xFFFF0030 : reserved + * 0xFFFF8000 : Debug function + * 0xFFFFA000 : reserved + * 0xFFFFC000 : CPU control + * 0xFFFFFFFF + * ======================================================== + */ + +/*======================================================================* + * Special Function Register + *======================================================================*/ +#define M32R_SFR_OFFSET (0x00E00000) /* 0x03E00000-0x03EFFFFF 1[MB] */ + +/* + * FPGA registers. + */ +#define M32R_FPGA_TOP (0x000F0000+M32R_SFR_OFFSET) + +#define M32R_FPGA_NUM_OF_CPUS_PORTL (0x00+M32R_FPGA_TOP) +#define M32R_FPGA_CPU_NAME0_PORTL (0x10+M32R_FPGA_TOP) +#define M32R_FPGA_CPU_NAME1_PORTL (0x14+M32R_FPGA_TOP) +#define M32R_FPGA_CPU_NAME2_PORTL (0x18+M32R_FPGA_TOP) +#define M32R_FPGA_CPU_NAME3_PORTL (0x1C+M32R_FPGA_TOP) +#define M32R_FPGA_MODEL_ID0_PORTL (0x20+M32R_FPGA_TOP) +#define M32R_FPGA_MODEL_ID1_PORTL (0x24+M32R_FPGA_TOP) +#define M32R_FPGA_MODEL_ID2_PORTL (0x28+M32R_FPGA_TOP) +#define M32R_FPGA_MODEL_ID3_PORTL (0x2C+M32R_FPGA_TOP) +#define M32R_FPGA_VERSION0_PORTL (0x30+M32R_FPGA_TOP) +#define M32R_FPGA_VERSION1_PORTL (0x34+M32R_FPGA_TOP) + +/* + * Clock and Power Manager registers. + */ +#define M32R_CPM_OFFSET (0x000F4000+M32R_SFR_OFFSET) + +#define M32R_CPM_CPUCLKCR_PORTL (0x00+M32R_CPM_OFFSET) +#define M32R_CPM_CLKMOD_PORTL (0x04+M32R_CPM_OFFSET) +#define M32R_CPM_PLLCR_PORTL (0x08+M32R_CPM_OFFSET) + +/* + * Block SELect Controller registers. + */ +#define M32R_BSELC_OFFSET (0x000F5000+M32R_SFR_OFFSET) + +#define M32R_BSEL0_CR0_PORTL (0x000+M32R_BSELC_OFFSET) +#define M32R_BSEL0_CR1_PORTL (0x004+M32R_BSELC_OFFSET) +#define M32R_BSEL1_CR0_PORTL (0x100+M32R_BSELC_OFFSET) +#define M32R_BSEL1_CR1_PORTL (0x104+M32R_BSELC_OFFSET) +#define M32R_BSEL2_CR0_PORTL (0x200+M32R_BSELC_OFFSET) +#define M32R_BSEL2_CR1_PORTL (0x204+M32R_BSELC_OFFSET) +#define M32R_BSEL3_CR0_PORTL (0x300+M32R_BSELC_OFFSET) +#define M32R_BSEL3_CR1_PORTL (0x304+M32R_BSELC_OFFSET) +#define M32R_BSEL4_CR0_PORTL (0x400+M32R_BSELC_OFFSET) +#define M32R_BSEL4_CR1_PORTL (0x404+M32R_BSELC_OFFSET) +#define M32R_BSEL5_CR0_PORTL (0x500+M32R_BSELC_OFFSET) +#define M32R_BSEL5_CR1_PORTL (0x504+M32R_BSELC_OFFSET) +#define M32R_BSEL6_CR0_PORTL (0x600+M32R_BSELC_OFFSET) +#define M32R_BSEL6_CR1_PORTL (0x604+M32R_BSELC_OFFSET) +#define M32R_BSEL7_CR0_PORTL (0x700+M32R_BSELC_OFFSET) +#define M32R_BSEL7_CR1_PORTL (0x704+M32R_BSELC_OFFSET) + +/* + * Multi Function Timer registers. + */ +#define M32R_MFT_OFFSET (0x000FC000+M32R_SFR_OFFSET) + +#define M32R_MFTCR_PORTL (0x000+M32R_MFT_OFFSET) /* MFT control */ +#define M32R_MFTRPR_PORTL (0x004+M32R_MFT_OFFSET) /* MFT real port */ + +#define M32R_MFT0_OFFSET (0x100+M32R_MFT_OFFSET) +#define M32R_MFT0MOD_PORTL (0x00+M32R_MFT0_OFFSET) /* MFT0 mode */ +#define M32R_MFT0BOS_PORTL (0x04+M32R_MFT0_OFFSET) /* MFT0 b-port output status */ +#define M32R_MFT0CUT_PORTL (0x08+M32R_MFT0_OFFSET) /* MFT0 count */ +#define M32R_MFT0RLD_PORTL (0x0C+M32R_MFT0_OFFSET) /* MFT0 reload */ +#define M32R_MFT0CMPRLD_PORTL (0x10+M32R_MFT0_OFFSET) /* MFT0 compare reload */ + +#define M32R_MFT1_OFFSET (0x200+M32R_MFT_OFFSET) +#define M32R_MFT1MOD_PORTL (0x00+M32R_MFT1_OFFSET) /* MFT1 mode */ +#define M32R_MFT1BOS_PORTL (0x04+M32R_MFT1_OFFSET) /* MFT1 b-port output status */ +#define M32R_MFT1CUT_PORTL (0x08+M32R_MFT1_OFFSET) /* MFT1 count */ +#define M32R_MFT1RLD_PORTL (0x0C+M32R_MFT1_OFFSET) /* MFT1 reload */ +#define M32R_MFT1CMPRLD_PORTL (0x10+M32R_MFT1_OFFSET) /* MFT1 compare reload */ + +#define M32R_MFT2_OFFSET (0x300+M32R_MFT_OFFSET) +#define M32R_MFT2MOD_PORTL (0x00+M32R_MFT2_OFFSET) /* MFT2 mode */ +#define M32R_MFT2BOS_PORTL (0x04+M32R_MFT2_OFFSET) /* MFT2 b-port output status */ +#define M32R_MFT2CUT_PORTL (0x08+M32R_MFT2_OFFSET) /* MFT2 count */ +#define M32R_MFT2RLD_PORTL (0x0C+M32R_MFT2_OFFSET) /* MFT2 reload */ +#define M32R_MFT2CMPRLD_PORTL (0x10+M32R_MFT2_OFFSET) /* MFT2 compare reload */ + +#define M32R_MFT3_OFFSET (0x400+M32R_MFT_OFFSET) +#define M32R_MFT3MOD_PORTL (0x00+M32R_MFT3_OFFSET) /* MFT3 mode */ +#define M32R_MFT3BOS_PORTL (0x04+M32R_MFT3_OFFSET) /* MFT3 b-port output status */ +#define M32R_MFT3CUT_PORTL (0x08+M32R_MFT3_OFFSET) /* MFT3 count */ +#define M32R_MFT3RLD_PORTL (0x0C+M32R_MFT3_OFFSET) /* MFT3 reload */ +#define M32R_MFT3CMPRLD_PORTL (0x10+M32R_MFT3_OFFSET) /* MFT3 compare reload */ + +#define M32R_MFT4_OFFSET (0x500+M32R_MFT_OFFSET) +#define M32R_MFT4MOD_PORTL (0x00+M32R_MFT4_OFFSET) /* MFT4 mode */ +#define M32R_MFT4BOS_PORTL (0x04+M32R_MFT4_OFFSET) /* MFT4 b-port output status */ +#define M32R_MFT4CUT_PORTL (0x08+M32R_MFT4_OFFSET) /* MFT4 count */ +#define M32R_MFT4RLD_PORTL (0x0C+M32R_MFT4_OFFSET) /* MFT4 reload */ +#define M32R_MFT4CMPRLD_PORTL (0x10+M32R_MFT4_OFFSET) /* MFT4 compare reload */ + +#define M32R_MFT5_OFFSET (0x600+M32R_MFT_OFFSET) +#define M32R_MFT5MOD_PORTL (0x00+M32R_MFT5_OFFSET) /* MFT4 mode */ +#define M32R_MFT5BOS_PORTL (0x04+M32R_MFT5_OFFSET) /* MFT4 b-port output status */ +#define M32R_MFT5CUT_PORTL (0x08+M32R_MFT5_OFFSET) /* MFT4 count */ +#define M32R_MFT5RLD_PORTL (0x0C+M32R_MFT5_OFFSET) /* MFT4 reload */ +#define M32R_MFT5CMPRLD_PORTL (0x10+M32R_MFT5_OFFSET) /* MFT4 compare reload */ + +#define M32R_MFTCR_MFT0MSK (1UL<<15) /* b16 */ +#define M32R_MFTCR_MFT1MSK (1UL<<14) /* b17 */ +#define M32R_MFTCR_MFT2MSK (1UL<<13) /* b18 */ +#define M32R_MFTCR_MFT3MSK (1UL<<12) /* b19 */ +#define M32R_MFTCR_MFT4MSK (1UL<<11) /* b20 */ +#define M32R_MFTCR_MFT5MSK (1UL<<10) /* b21 */ +#define M32R_MFTCR_MFT0EN (1UL<<7) /* b24 */ +#define M32R_MFTCR_MFT1EN (1UL<<6) /* b25 */ +#define M32R_MFTCR_MFT2EN (1UL<<5) /* b26 */ +#define M32R_MFTCR_MFT3EN (1UL<<4) /* b27 */ +#define M32R_MFTCR_MFT4EN (1UL<<3) /* b28 */ +#define M32R_MFTCR_MFT5EN (1UL<<2) /* b29 */ + +#define M32R_MFTMOD_CC_MASK (1UL<<15) /* b16 */ +#define M32R_MFTMOD_TCCR (1UL<<13) /* b18 */ +#define M32R_MFTMOD_GTSEL000 (0UL<<8) /* b21-23 : 000 */ +#define M32R_MFTMOD_GTSEL001 (1UL<<8) /* b21-23 : 001 */ +#define M32R_MFTMOD_GTSEL010 (2UL<<8) /* b21-23 : 010 */ +#define M32R_MFTMOD_GTSEL011 (3UL<<8) /* b21-23 : 011 */ +#define M32R_MFTMOD_GTSEL110 (6UL<<8) /* b21-23 : 110 */ +#define M32R_MFTMOD_GTSEL111 (7UL<<8) /* b21-23 : 111 */ +#define M32R_MFTMOD_CMSEL (1UL<<3) /* b28 */ +#define M32R_MFTMOD_CSSEL000 (0UL<<0) /* b29-b31 : 000 */ +#define M32R_MFTMOD_CSSEL001 (1UL<<0) /* b29-b31 : 001 */ +#define M32R_MFTMOD_CSSEL010 (2UL<<0) /* b29-b31 : 010 */ +#define M32R_MFTMOD_CSSEL011 (3UL<<0) /* b29-b31 : 011 */ +#define M32R_MFTMOD_CSSEL100 (4UL<<0) /* b29-b31 : 100 */ +#define M32R_MFTMOD_CSSEL110 (6UL<<0) /* b29-b31 : 110 */ + +/* + * Serial I/O registers. + */ +#define M32R_SIO_OFFSET (0x000FD000+M32R_SFR_OFFSET) + +#define M32R_SIO0_CR_PORTL (0x000+M32R_SIO_OFFSET) +#define M32R_SIO0_MOD0_PORTL (0x004+M32R_SIO_OFFSET) +#define M32R_SIO0_MOD1_PORTL (0x008+M32R_SIO_OFFSET) +#define M32R_SIO0_STS_PORTL (0x00C+M32R_SIO_OFFSET) +#define M32R_SIO0_TRCR_PORTL (0x010+M32R_SIO_OFFSET) +#define M32R_SIO0_BAUR_PORTL (0x014+M32R_SIO_OFFSET) +#define M32R_SIO0_RBAUR_PORTL (0x018+M32R_SIO_OFFSET) +#define M32R_SIO0_TXB_PORTL (0x01C+M32R_SIO_OFFSET) +#define M32R_SIO0_RXB_PORTL (0x020+M32R_SIO_OFFSET) + +/* + * Interrupt Control Unit registers. + */ +#define M32R_ICU_OFFSET (0x000FF000+M32R_SFR_OFFSET) + +#define M32R_ICU_ISTS_PORTL (0x004+M32R_ICU_OFFSET) +#define M32R_ICU_IREQ0_PORTL (0x008+M32R_ICU_OFFSET) +#define M32R_ICU_IREQ1_PORTL (0x00C+M32R_ICU_OFFSET) +#define M32R_ICU_SBICR_PORTL (0x018+M32R_ICU_OFFSET) +#define M32R_ICU_IMASK_PORTL (0x01C+M32R_ICU_OFFSET) +#define M32R_ICU_CR1_PORTL (0x200+M32R_ICU_OFFSET) /* INT0 */ +#define M32R_ICU_CR2_PORTL (0x204+M32R_ICU_OFFSET) /* INT1 */ +#define M32R_ICU_CR3_PORTL (0x208+M32R_ICU_OFFSET) /* INT2 */ +#define M32R_ICU_CR4_PORTL (0x20C+M32R_ICU_OFFSET) /* INT3 */ +#define M32R_ICU_CR5_PORTL (0x210+M32R_ICU_OFFSET) /* INT4 */ +#define M32R_ICU_CR6_PORTL (0x214+M32R_ICU_OFFSET) /* INT5 */ +#define M32R_ICU_CR7_PORTL (0x218+M32R_ICU_OFFSET) /* INT6 */ +#define M32R_ICU_CR8_PORTL (0x218+M32R_ICU_OFFSET) /* INT7 */ +#define M32R_ICU_CR32_PORTL (0x27C+M32R_ICU_OFFSET) /* SIO0 RX */ +#define M32R_ICU_CR33_PORTL (0x280+M32R_ICU_OFFSET) /* SIO0 TX */ +#define M32R_ICU_CR40_PORTL (0x29C+M32R_ICU_OFFSET) /* DMAC0 */ +#define M32R_ICU_CR41_PORTL (0x2A0+M32R_ICU_OFFSET) /* DMAC1 */ +#define M32R_ICU_CR48_PORTL (0x2BC+M32R_ICU_OFFSET) /* MFT0 */ +#define M32R_ICU_CR49_PORTL (0x2C0+M32R_ICU_OFFSET) /* MFT1 */ +#define M32R_ICU_CR50_PORTL (0x2C4+M32R_ICU_OFFSET) /* MFT2 */ +#define M32R_ICU_CR51_PORTL (0x2C8+M32R_ICU_OFFSET) /* MFT3 */ +#define M32R_ICU_CR52_PORTL (0x2CC+M32R_ICU_OFFSET) /* MFT4 */ +#define M32R_ICU_CR53_PORTL (0x2D0+M32R_ICU_OFFSET) /* MFT5 */ +#define M32R_ICU_IPICR0_PORTL (0x2DC+M32R_ICU_OFFSET) /* IPI0 */ +#define M32R_ICU_IPICR1_PORTL (0x2E0+M32R_ICU_OFFSET) /* IPI1 */ +#define M32R_ICU_IPICR2_PORTL (0x2E4+M32R_ICU_OFFSET) /* IPI2 */ +#define M32R_ICU_IPICR3_PORTL (0x2E8+M32R_ICU_OFFSET) /* IPI3 */ +#define M32R_ICU_IPICR4_PORTL (0x2EC+M32R_ICU_OFFSET) /* IPI4 */ +#define M32R_ICU_IPICR5_PORTL (0x2F0+M32R_ICU_OFFSET) /* IPI5 */ +#define M32R_ICU_IPICR6_PORTL (0x2F4+M32R_ICU_OFFSET) /* IPI6 */ +#define M32R_ICU_IPICR7_PORTL (0x2FC+M32R_ICU_OFFSET) /* IPI7 */ + +#define M32R_ICUISTS_VECB(val) ((val>>28) & 0xF) +#define M32R_ICUISTS_ISN(val) ((val>>22) & 0x3F) +#define M32R_ICUISTS_PIML(val) ((val>>16) & 0x7) + +#define M32R_ICUIMASK_IMSK0 (0UL<<16) /* b13-b15: Disable interrupt */ +#define M32R_ICUIMASK_IMSK1 (1UL<<16) /* b13-b15: Enable level 0 interrupt */ +#define M32R_ICUIMASK_IMSK2 (2UL<<16) /* b13-b15: Enable level 0,1 interrupt */ +#define M32R_ICUIMASK_IMSK3 (3UL<<16) /* b13-b15: Enable level 0-2 interrupt */ +#define M32R_ICUIMASK_IMSK4 (4UL<<16) /* b13-b15: Enable level 0-3 interrupt */ +#define M32R_ICUIMASK_IMSK5 (5UL<<16) /* b13-b15: Enable level 0-4 interrupt */ +#define M32R_ICUIMASK_IMSK6 (6UL<<16) /* b13-b15: Enable level 0-5 interrupt */ +#define M32R_ICUIMASK_IMSK7 (7UL<<16) /* b13-b15: Enable level 0-6 interrupt */ + +#define M32R_ICUCR_IEN (1UL<<12) /* b19: Interrupt enable */ +#define M32R_ICUCR_IRQ (1UL<<8) /* b23: Interrupt request */ +#define M32R_ICUCR_ISMOD00 (0UL<<4) /* b26-b27: Interrupt sense mode Edge HtoL */ +#define M32R_ICUCR_ISMOD01 (1UL<<4) /* b26-b27: Interrupt sense mode Level L */ +#define M32R_ICUCR_ISMOD10 (2UL<<4) /* b26-b27: Interrupt sense mode Edge LtoH*/ +#define M32R_ICUCR_ISMOD11 (3UL<<4) /* b26-b27: Interrupt sense mode Level H */ +#define M32R_ICUCR_ILEVEL0 (0UL<<0) /* b29-b31: Interrupt priority level 0 */ +#define M32R_ICUCR_ILEVEL1 (1UL<<0) /* b29-b31: Interrupt priority level 1 */ +#define M32R_ICUCR_ILEVEL2 (2UL<<0) /* b29-b31: Interrupt priority level 2 */ +#define M32R_ICUCR_ILEVEL3 (3UL<<0) /* b29-b31: Interrupt priority level 3 */ +#define M32R_ICUCR_ILEVEL4 (4UL<<0) /* b29-b31: Interrupt priority level 4 */ +#define M32R_ICUCR_ILEVEL5 (5UL<<0) /* b29-b31: Interrupt priority level 5 */ +#define M32R_ICUCR_ILEVEL6 (6UL<<0) /* b29-b31: Interrupt priority level 6 */ +#define M32R_ICUCR_ILEVEL7 (7UL<<0) /* b29-b31: Disable interrupt */ +#define M32R_ICUCR_ILEVEL_MASK (7UL) + +#define M32R_IRQ_INT0 (1) /* INT0 */ +#define M32R_IRQ_INT1 (2) /* INT1 */ +#define M32R_IRQ_INT2 (3) /* INT2 */ +#define M32R_IRQ_INT3 (4) /* INT3 */ +#define M32R_IRQ_INT4 (5) /* INT4 */ +#define M32R_IRQ_INT5 (6) /* INT5 */ +#define M32R_IRQ_INT6 (7) /* INT6 */ +#define M32R_IRQ_INT7 (8) /* INT7 */ +#define M32R_IRQ_MFT0 (16) /* MFT0 */ +#define M32R_IRQ_MFT1 (17) /* MFT1 */ +#define M32R_IRQ_MFT2 (18) /* MFT2 */ +#define M32R_IRQ_MFT3 (19) /* MFT3 */ +#define M32R_IRQ_MFT4 (20) /* MFT4 */ +#define M32R_IRQ_MFT5 (21) /* MFT5 */ +#define M32R_IRQ_DMAC0 (32) /* DMAC0 */ +#define M32R_IRQ_DMAC1 (33) /* DMAC1 */ +#define M32R_IRQ_SIO0_R (48) /* SIO0 receive */ +#define M32R_IRQ_SIO0_S (49) /* SIO0 send */ +#define M32R_IRQ_SIO1_R (50) /* SIO1 send */ +#define M32R_IRQ_SIO1_S (51) /* SIO1 receive */ +#define M32R_IRQ_IPI0 (56) /* IPI0 */ +#define M32R_IRQ_IPI1 (57) /* IPI1 */ +#define M32R_IRQ_IPI2 (58) /* IPI2 */ +#define M32R_IRQ_IPI3 (59) /* IPI3 */ +#define M32R_IRQ_IPI4 (60) /* IPI4 */ +#define M32R_IRQ_IPI5 (61) /* IPI5 */ +#define M32R_IRQ_IPI6 (62) /* IPI6 */ +#define M32R_IRQ_IPI7 (63) /* IPI7 */ + +/*======================================================================* + * CPU + *======================================================================*/ + +#define M32R_CPUID_PORTL (0xFFFFFFE0) +#define M32R_MCICAR_PORTL (0xFFFFFFF0) +#define M32R_MCDCAR_PORTL (0xFFFFFFF4) +#define M32R_MCCR_PORTL (0xFFFFFFFC) + +#endif /* _ASM_M32R_M32R_MP_FPGA_ */ diff -Nru a/include/asm-m32r/mappi2/mappi2_pld.h b/include/asm-m32r/mappi2/mappi2_pld.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/mappi2/mappi2_pld.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,151 @@ +/* + * include/asm/mappi2/mappi2_pld.h + * + * Definitions for Extended IO Logic on MAPPI2 board. + * based on m32700ut_pld.h by + * + * 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. + * + */ + +#ifndef _MAPPI2_PLD_H +#define _MAPPI2_PLD_H + +#ifndef __ASSEMBLY__ +/* FIXME: + * Some C functions use non-cache address, so can't define non-cache address. + */ +#define PLD_BASE (0x10c00000 /* + NONCACHE_OFFSET */) +#define __reg8 (volatile unsigned char *) +#define __reg16 (volatile unsigned short *) +#define __reg32 (volatile unsigned int *) +#else +#define PLD_BASE (0x10c00000 + NONCACHE_OFFSET) +#define __reg8 +#define __reg16 +#define __reg32 +#endif /* __ASSEMBLY__ */ + +/* CFC */ +#define PLD_CFRSTCR __reg16(PLD_BASE + 0x0000) +#define PLD_CFSTS __reg16(PLD_BASE + 0x0002) +#define PLD_CFIMASK __reg16(PLD_BASE + 0x0004) +#define PLD_CFBUFCR __reg16(PLD_BASE + 0x0006) +#define PLD_CFCR0 __reg16(PLD_BASE + 0x000a) +#define PLD_CFCR1 __reg16(PLD_BASE + 0x000c) + +/* MMC */ +#define PLD_MMCCR __reg16(PLD_BASE + 0x4000) +#define PLD_MMCMOD __reg16(PLD_BASE + 0x4002) +#define PLD_MMCSTS __reg16(PLD_BASE + 0x4006) +#define PLD_MMCBAUR __reg16(PLD_BASE + 0x400a) +#define PLD_MMCCMDBCUT __reg16(PLD_BASE + 0x400c) +#define PLD_MMCCDTBCUT __reg16(PLD_BASE + 0x400e) +#define PLD_MMCDET __reg16(PLD_BASE + 0x4010) +#define PLD_MMCWP __reg16(PLD_BASE + 0x4012) +#define PLD_MMCWDATA __reg16(PLD_BASE + 0x5000) +#define PLD_MMCRDATA __reg16(PLD_BASE + 0x6000) +#define PLD_MMCCMDDATA __reg16(PLD_BASE + 0x7000) +#define PLD_MMCRSPDATA __reg16(PLD_BASE + 0x7006) + +/* Power Control of MMC and CF */ +#define PLD_CPCR __reg16(PLD_BASE + 0x14000) + + +/*==== ICU ====*/ +#define M32R_IRQ_PC104 (5) /* INT4(PC/104) */ +#define M32R_IRQ_I2C (28) /* I2C-BUS */ +#if 1 +#define PLD_IRQ_CFIREQ (40) /* CFC Card Interrupt */ +#define PLD_IRQ_CFC_INSERT (41) /* CFC Card Insert */ +#define PLD_IRQ_CFC_EJECT (42) /* CFC Card Eject */ +#define PLD_IRQ_MMCCARD (43) /* MMC Card Insert */ +#define PLD_IRQ_MMCIRQ (44) /* MMC Transfer Done */ +#else +#define PLD_IRQ_CFIREQ (34) /* CFC Card Interrupt */ +#define PLD_IRQ_CFC_INSERT (35) /* CFC Card Insert */ +#define PLD_IRQ_CFC_EJECT (36) /* CFC Card Eject */ +#define PLD_IRQ_MMCCARD (37) /* MMC Card Insert */ +#define PLD_IRQ_MMCIRQ (38) /* MMC Transfer Done */ +#endif + + +#if 0 +/* LED Control + * + * 1: DIP swich side + * 2: Reset switch side + */ +#define PLD_IOLEDCR __reg16(PLD_BASE + 0x14002) +#define PLD_IOLED_1_ON 0x001 +#define PLD_IOLED_1_OFF 0x000 +#define PLD_IOLED_2_ON 0x002 +#define PLD_IOLED_2_OFF 0x000 + +/* DIP Switch + * 0: Write-protect of Flash Memory (0:protected, 1:non-protected) + * 1: - + * 2: - + * 3: - + */ +#define PLD_IOSWSTS __reg16(PLD_BASE + 0x14004) +#define PLD_IOSWSTS_IOSW2 0x0200 +#define PLD_IOSWSTS_IOSW1 0x0100 +#define PLD_IOSWSTS_IOWP0 0x0001 + +#endif + +/* CRC */ +#define PLD_CRC7DATA __reg16(PLD_BASE + 0x18000) +#define PLD_CRC7INDATA __reg16(PLD_BASE + 0x18002) +#define PLD_CRC16DATA __reg16(PLD_BASE + 0x18004) +#define PLD_CRC16INDATA __reg16(PLD_BASE + 0x18006) +#define PLD_CRC16ADATA __reg16(PLD_BASE + 0x18008) +#define PLD_CRC16AINDATA __reg16(PLD_BASE + 0x1800a) + + +#if 0 +/* RTC */ +#define PLD_RTCCR __reg16(PLD_BASE + 0x1c000) +#define PLD_RTCBAUR __reg16(PLD_BASE + 0x1c002) +#define PLD_RTCWRDATA __reg16(PLD_BASE + 0x1c004) +#define PLD_RTCRDDATA __reg16(PLD_BASE + 0x1c006) +#define PLD_RTCRSTODT __reg16(PLD_BASE + 0x1c008) + +/* SIO0 */ +#define PLD_ESIO0CR __reg16(PLD_BASE + 0x20000) +#define PLD_ESIO0CR_TXEN 0x0001 +#define PLD_ESIO0CR_RXEN 0x0002 +#define PLD_ESIO0MOD0 __reg16(PLD_BASE + 0x20002) +#define PLD_ESIO0MOD0_CTSS 0x0040 +#define PLD_ESIO0MOD0_RTSS 0x0080 +#define PLD_ESIO0MOD1 __reg16(PLD_BASE + 0x20004) +#define PLD_ESIO0MOD1_LMFS 0x0010 +#define PLD_ESIO0STS __reg16(PLD_BASE + 0x20006) +#define PLD_ESIO0STS_TEMP 0x0001 +#define PLD_ESIO0STS_TXCP 0x0002 +#define PLD_ESIO0STS_RXCP 0x0004 +#define PLD_ESIO0STS_TXSC 0x0100 +#define PLD_ESIO0STS_RXSC 0x0200 +#define PLD_ESIO0STS_TXREADY (PLD_ESIO0STS_TXCP | PLD_ESIO0STS_TEMP) +#define PLD_ESIO0INTCR __reg16(PLD_BASE + 0x20008) +#define PLD_ESIO0INTCR_TXIEN 0x0002 +#define PLD_ESIO0INTCR_RXCEN 0x0004 +#define PLD_ESIO0BAUR __reg16(PLD_BASE + 0x2000a) +#define PLD_ESIO0TXB __reg16(PLD_BASE + 0x2000c) +#define PLD_ESIO0RXB __reg16(PLD_BASE + 0x2000e) + +/* SIM Card */ +#define PLD_SCCR __reg16(PLD_BASE + 0x38000) +#define PLD_SCMOD __reg16(PLD_BASE + 0x38004) +#define PLD_SCSTS __reg16(PLD_BASE + 0x38006) +#define PLD_SCINTCR __reg16(PLD_BASE + 0x38008) +#define PLD_SCBAUR __reg16(PLD_BASE + 0x3800a) +#define PLD_SCTXB __reg16(PLD_BASE + 0x3800c) +#define PLD_SCRXB __reg16(PLD_BASE + 0x3800e) + +#endif + +#endif /* _MAPPI2_PLD.H */ diff -Nru a/include/asm-m32r/mc146818rtc.h b/include/asm-m32r/mc146818rtc.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/mc146818rtc.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,32 @@ +/* + * Machine dependent access functions for RTC registers. + */ +#ifndef _ASM_MC146818RTC_H +#define _ASM_MC146818RTC_H + +#include + +#ifndef RTC_PORT +// #define RTC_PORT(x) (0x70 + (x)) +#define RTC_PORT(x) ((x)) +#define RTC_ALWAYS_BCD 1 /* RTC operates in binary mode */ +#endif + +/* + * The yet supported machines all access the RTC index register via + * an ISA port access but the way to access the date register differs ... + */ +#define CMOS_READ(addr) ({ \ +outb_p((addr),RTC_PORT(0)); \ +inb_p(RTC_PORT(1)); \ +}) +#define CMOS_WRITE(val, addr) ({ \ +outb_p((addr),RTC_PORT(0)); \ +outb_p((val),RTC_PORT(1)); \ +}) + +#define RTC_IRQ 8 +#if 0 +#endif + +#endif /* _ASM_MC146818RTC_H */ diff -Nru a/include/asm-m32r/mman.h b/include/asm-m32r/mman.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/mman.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,45 @@ +#ifndef __M32R_MMAN_H__ +#define __M32R_MMAN_H__ + +/* orig : i386 2.6.0-test6 */ + +#define PROT_READ 0x1 /* page can be read */ +#define PROT_WRITE 0x2 /* page can be written */ +#define PROT_EXEC 0x4 /* page can be executed */ +#define PROT_SEM 0x8 /* page may be used for atomic ops */ +#define PROT_NONE 0x0 /* page can not be accessed */ +#define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */ +#define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */ + +#define MAP_SHARED 0x01 /* Share changes */ +#define MAP_PRIVATE 0x02 /* Changes are private */ +#define MAP_TYPE 0x0f /* Mask for type of mapping */ +#define MAP_FIXED 0x10 /* Interpret addr exactly */ +#define MAP_ANONYMOUS 0x20 /* don't use a file */ + +#define MAP_GROWSDOWN 0x0100 /* stack-like segment */ +#define MAP_DENYWRITE 0x0800 /* ETXTBSY */ +#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */ +#define MAP_LOCKED 0x2000 /* pages are locked */ +#define MAP_NORESERVE 0x4000 /* don't check for reservations */ +#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ +#define MAP_NONBLOCK 0x10000 /* do not block on IO */ + +#define MS_ASYNC 1 /* sync memory asynchronously */ +#define MS_INVALIDATE 2 /* invalidate the caches */ +#define MS_SYNC 4 /* synchronous memory sync */ + +#define MCL_CURRENT 1 /* lock all current mappings */ +#define MCL_FUTURE 2 /* lock all future mappings */ + +#define MADV_NORMAL 0x0 /* default page-in behavior */ +#define MADV_RANDOM 0x1 /* page-in minimum required */ +#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */ +#define MADV_WILLNEED 0x3 /* pre-fault pages */ +#define MADV_DONTNEED 0x4 /* discard these pages */ + +/* compatibility flags */ +#define MAP_ANON MAP_ANONYMOUS +#define MAP_FILE 0 + +#endif /* __M32R_MMAN_H__ */ diff -Nru a/include/asm-m32r/mmu.h b/include/asm-m32r/mmu.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/mmu.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,35 @@ +#ifndef _ASM_M32R_MMU_H +#define _ASM_M32R_MMU_H + +/* $Id$ */ + +#include + +#if !defined(CONFIG_MMU) +struct mm_rblock_struct { + int size; + int refcount; + void *kblock; +}; + +struct mm_tblock_struct { + struct mm_rblock_struct *rblock; + struct mm_tblock_struct *next; +}; + +typedef struct { + struct mm_tblock_struct tblock; + unsigned long end_brk; +} mm_context_t; +#else + +/* Default "unsigned long" context */ +#ifndef CONFIG_SMP +typedef unsigned long mm_context_t; +#else +typedef unsigned long mm_context_t[NR_CPUS]; +#endif + +#endif /* CONFIG_MMU */ +#endif /* _ASM_M32R_MMU_H */ + diff -Nru a/include/asm-m32r/mmu_context.h b/include/asm-m32r/mmu_context.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/mmu_context.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,169 @@ +#ifndef _ASM_M32R_MMU_CONTEXT_H +#define _ASM_M32R_MMU_CONTEXT_H + +/* $Id */ + +#include + +#include + +#define MMU_CONTEXT_ASID_MASK (0x000000FF) +#define MMU_CONTEXT_VERSION_MASK (0xFFFFFF00) +#define MMU_CONTEXT_FIRST_VERSION (0x00000100) +#define NO_CONTEXT (0x00000000) + + +#ifndef __ASSEMBLY__ + +#include +#include +#include +#include +#include + +/* + * Cache of MMU context last used. + */ +#ifndef CONFIG_SMP +extern unsigned long mmu_context_cache_dat; +#define mmu_context_cache mmu_context_cache_dat +#define mm_context(mm) mm->context +#else /* not CONFIG_SMP */ +extern unsigned long mmu_context_cache_dat[]; +#define mmu_context_cache mmu_context_cache_dat[smp_processor_id()] +#define mm_context(mm) mm->context[smp_processor_id()] +#endif /* not CONFIG_SMP */ + +#define set_tlb_tag(entry, tag) (*entry = (tag & PAGE_MASK)|get_asid()) +#define set_tlb_data(entry, data) (*entry = (data | _PAGE_PRESENT)) + +#ifdef CONFIG_MMU +#define enter_lazy_tlb(mm, tsk) do { } while (0) + +static __inline__ void get_new_mmu_context(struct mm_struct *mm) +{ + unsigned long mc = ++mmu_context_cache; + + if (!(mc & MMU_CONTEXT_ASID_MASK)) { + /* We exhaust ASID of this version. + Flush all TLB and start new cycle. */ + local_flush_tlb_all(); + /* Fix version if needed. + Note that we avoid version #0 to distingush NO_CONTEXT. */ + if (!mc) + mmu_context_cache = mc = MMU_CONTEXT_FIRST_VERSION; + } + mm_context(mm) = mc; +} + +/* + * Get MMU context if needed. + */ +static __inline__ void get_mmu_context(struct mm_struct *mm) +{ + if (mm) { + unsigned long mc = mmu_context_cache; + + /* Check if we have old version of context. + If it's old, we need to get new context with new version. */ + if ((mm_context(mm) ^ mc) & MMU_CONTEXT_VERSION_MASK) + get_new_mmu_context(mm); + } +} + +/* + * Initialize the context related info for a new mm_struct + * instance. + */ +static __inline__ int init_new_context(struct task_struct *tsk, + struct mm_struct *mm) +{ +#ifndef CONFIG_SMP + mm->context = NO_CONTEXT; +#else /* CONFIG_SMP */ + int num_cpus = num_online_cpus(); + int i; + + for (i = 0 ; i < num_cpus ; i++) + mm->context[i] = NO_CONTEXT; +#endif /* CONFIG_SMP */ + + return 0; +} + +/* + * Destroy context related info for an mm_struct that is about + * to be put to rest. + */ +#define destroy_context(mm) do { } while (0) + +static __inline__ void set_asid(unsigned long asid) +{ + *(volatile unsigned long *)MASID = (asid & MMU_CONTEXT_ASID_MASK); +} + +static __inline__ unsigned long get_asid(void) +{ + unsigned long asid; + + asid = *(volatile long *)MASID; + asid &= MMU_CONTEXT_ASID_MASK; + + return asid; +} + +/* + * After we have set current->mm to a new value, this activates + * the context for the new mm so we see the new mappings. + */ +static __inline__ void activate_context(struct mm_struct *mm) +{ + get_mmu_context(mm); + set_asid(mm_context(mm) & MMU_CONTEXT_ASID_MASK); +} + +static __inline__ void switch_mm(struct mm_struct *prev, + struct mm_struct *next, struct task_struct *tsk) +{ +#ifdef CONFIG_SMP + int cpu = smp_processor_id(); +#endif /* CONFIG_SMP */ + + if (prev != next) { +#ifdef CONFIG_SMP + cpu_set(cpu, next->cpu_vm_mask); +#endif /* CONFIG_SMP */ + /* Set MPTB = next->pgd */ + *(volatile unsigned long *)MPTB = (unsigned long)next->pgd; + activate_context(next); + } +#ifdef CONFIG_SMP + else + if (!cpu_test_and_set(cpu, next->cpu_vm_mask)) + activate_context(next); +#endif /* CONFIG_SMP */ +} + +#define deactivate_mm(tsk, mm) do { } while (0) + +#define activate_mm(prev, next) \ + switch_mm((prev), (next), NULL) + +#else +#define get_mmu_context(mm) do { } while (0) +#define init_new_context(tsk,mm) (0) +#define destroy_context(mm) do { } while (0) +#define set_asid(asid) do { } while (0) +#define get_asid() (0) +#define activate_context(mm) do { } while (0) +#define switch_mm(prev,next,tsk) do { } while (0) +#define deactivate_mm(mm,tsk) do { } while (0) +#define activate_mm(prev,next) do { } while (0) +#define enter_lazy_tlb(mm,tsk) do { } while (0) +#endif /* CONFIG_MMU */ + + +#endif /* not __ASSEMBLY__ */ + +#endif /* _ASM_M32R_MMU_CONTEXT_H */ + diff -Nru a/include/asm-m32r/mmzone.h b/include/asm-m32r/mmzone.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/mmzone.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,80 @@ +/* + * Written by Pat Gaughen (gone@us.ibm.com) Mar 2002 + * + */ + +#ifndef _ASM_MMZONE_H_ +#define _ASM_MMZONE_H_ + +#include + +#ifdef CONFIG_DISCONTIGMEM + +extern struct pglist_data *node_data[]; +#define NODE_DATA(nid) (node_data[nid]) + +#define node_localnr(pfn, nid) ((pfn) - NODE_DATA(nid)->node_start_pfn) +#define node_mem_map(nid) (NODE_DATA(nid)->node_mem_map) +#define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) +#define node_end_pfn(nid) \ +({ \ + pg_data_t *__pgdat = NODE_DATA(nid); \ + __pgdat->node_start_pfn + __pgdat->node_spanned_pages - 1; \ +}) + +#define local_mapnr(kvaddr) \ +({ \ + unsigned long __pfn = __pa(kvaddr) >> PAGE_SHIFT; \ + (__pfn - node_start_pfn(pfn_to_nid(__pfn))); \ +}) + +#define pfn_to_page(pfn) \ +({ \ + unsigned long __pfn = pfn; \ + int __node = pfn_to_nid(__pfn); \ + &node_mem_map(__node)[node_localnr(__pfn,__node)]; \ +}) + +#define page_to_pfn(pg) \ +({ \ + struct page *__page = pg; \ + struct zone *__zone = page_zone(__page); \ + (unsigned long)(__page - __zone->zone_mem_map) \ + + __zone->zone_start_pfn; \ +}) +#define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT)) +/* + * pfn_valid should be made as fast as possible, and the current definition + * is valid for machines that are NUMA, but still contiguous, which is what + * is currently supported. A more generalised, but slower definition would + * be something like this - mbligh: + * ( pfn_to_pgdat(pfn) && ((pfn) < node_end_pfn(pfn_to_nid(pfn))) ) + */ +#if 1 /* M32R_FIXME */ +#define pfn_valid(pfn) (1) +#else +#define pfn_valid(pfn) ((pfn) < num_physpages) +#endif + +/* + * generic node memory support, the following assumptions apply: + */ + +static __inline__ int pfn_to_nid(unsigned long pfn) +{ + int node; + + for (node = 0 ; node < MAX_NUMNODES ; node++) + if (pfn >= node_start_pfn(node) && pfn <= node_end_pfn(node)) + break; + + return node; +} + +static __inline__ struct pglist_data *pfn_to_pgdat(unsigned long pfn) +{ + return(NODE_DATA(pfn_to_nid(pfn))); +} + +#endif /* CONFIG_DISCONTIGMEM */ +#endif /* _ASM_MMZONE_H_ */ diff -Nru a/include/asm-m32r/module.h b/include/asm-m32r/module.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/module.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,13 @@ +#ifndef _ASM_M32R_MODULE_H +#define _ASM_M32R_MODULE_H + +/* $Id$ */ + +struct mod_arch_specific { }; + +#define Elf_Shdr Elf32_Shdr +#define Elf_Sym Elf32_Sym +#define Elf_Ehdr Elf32_Ehdr + +#endif /* _ASM_M32R_MODULE_H */ + diff -Nru a/include/asm-m32r/msgbuf.h b/include/asm-m32r/msgbuf.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/msgbuf.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,35 @@ +#ifndef _ASM_M32R_MSGBUF_H +#define _ASM_M32R_MSGBUF_H + +/* $Id$ */ + +/* orig : i386 2.4.18 */ + +/* + * The msqid64_ds structure for m32r architecture. + * Note extra padding because this structure is passed back and forth + * between kernel and user space. + * + * Pad space is left for: + * - 64-bit time_t to solve y2038 problem + * - 2 miscellaneous 32-bit values + */ + +struct msqid64_ds { + struct ipc64_perm msg_perm; + __kernel_time_t msg_stime; /* last msgsnd time */ + unsigned long __unused1; + __kernel_time_t msg_rtime; /* last msgrcv time */ + unsigned long __unused2; + __kernel_time_t msg_ctime; /* last change time */ + unsigned long __unused3; + unsigned long msg_cbytes; /* current number of bytes on queue */ + unsigned long msg_qnum; /* number of messages in queue */ + unsigned long msg_qbytes; /* max number of bytes on queue */ + __kernel_pid_t msg_lspid; /* pid of last msgsnd */ + __kernel_pid_t msg_lrpid; /* last receive pid */ + unsigned long __unused4; + unsigned long __unused5; +}; + +#endif /* _ASM_M32R_MSGBUF_H */ diff -Nru a/include/asm-m32r/namei.h b/include/asm-m32r/namei.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/namei.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,21 @@ +#ifndef _ASM_M32R_NAMEI_H +#define _ASM_M32R_NAMEI_H + +/* $Id$ */ + +/* orig : i386 2.4.18 */ + +/* + * linux/include/asm-m32r/namei.h + * + * Included from linux/fs/namei.c + */ + +/* This dummy routine maybe changed to something useful + * for /usr/gnemul/ emulation stuff. + * Look at asm-sparc/namei.h for details. + */ + +#define __emul_prefix() NULL + +#endif /* _ASM_M32R_NAMEI_H */ diff -Nru a/include/asm-m32r/numnodes.h b/include/asm-m32r/numnodes.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/numnodes.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,15 @@ +#ifndef _ASM_NUMNODES_H_ +#define _ASM_NUMNODES_H_ + +#include + +#ifdef CONFIG_DISCONTIGMEM + +#if defined(CONFIG_CHIP_M32700) +#define NODES_SHIFT 1 /* Max 2 Nodes */ +#endif /* CONFIG_CHIP_M32700 */ + +#endif /* CONFIG_DISCONTIGMEM */ + +#endif /* _ASM_NUMNODES_H_ */ + diff -Nru a/include/asm-m32r/opsput/opsput_lan.h b/include/asm-m32r/opsput/opsput_lan.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/opsput/opsput_lan.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,56 @@ +/* + * include/asm/opsput_lan.h + * + * OPSPUT-LAN board + * + * Copyright (c) 2002-2004 Takeo Takahashi, Mamoru Sakugawa + * + * 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. + * + * $Id: opsput_lan.h,v 1.1 2004/07/27 06:54:20 sakugawa Exp $ + */ + +#ifndef _OPSPUT_OPSPUT_LAN_H +#define _OPSPUT_OPSPUT_LAN_H + +#include + +#ifndef __ASSEMBLY__ +/* + * C functions use non-cache address. + */ +#define OPSPUT_LAN_BASE (0x10000000 /* + NONCACHE_OFFSET */) +#else +#define OPSPUT_LAN_BASE (0x10000000 + NONCACHE_OFFSET) +#endif /* __ASSEMBLY__ */ + +/* ICU + * ICUISTS: status register + * ICUIREQ0: request register + * ICUIREQ1: request register + * ICUCR3: control register for CFIREQ# interrupt + * ICUCR4: control register for CFC Card insert interrupt + * ICUCR5: control register for CFC Card eject interrupt + * ICUCR6: control register for external interrupt + * ICUCR11: control register for MMC Card insert/eject interrupt + * ICUCR13: control register for SC error interrupt + * ICUCR14: control register for SC receive interrupt + * ICUCR15: control register for SC send interrupt + * ICUCR16: control register for SIO0 receive interrupt + * ICUCR17: control register for SIO0 send interrupt + */ +#define OPSPUT_LAN_IRQ_LAN (OPSPUT_LAN_PLD_IRQ_BASE + 1) /* LAN */ +#define OPSPUT_LAN_IRQ_I2C (OPSPUT_LAN_PLD_IRQ_BASE + 3) /* I2C */ + +#define OPSPUT_LAN_ICUISTS __reg16(OPSPUT_LAN_BASE + 0xc0002) +#define OPSPUT_LAN_ICUISTS_VECB_MASK (0xf000) +#define OPSPUT_LAN_VECB(x) ((x) & OPSPUT_LAN_ICUISTS_VECB_MASK) +#define OPSPUT_LAN_ICUISTS_ISN_MASK (0x07c0) +#define OPSPUT_LAN_ICUISTS_ISN(x) ((x) & OPSPUT_LAN_ICUISTS_ISN_MASK) +#define OPSPUT_LAN_ICUIREQ0 __reg16(OPSPUT_LAN_BASE + 0xc0004) +#define OPSPUT_LAN_ICUCR1 __reg16(OPSPUT_LAN_BASE + 0xc0010) +#define OPSPUT_LAN_ICUCR3 __reg16(OPSPUT_LAN_BASE + 0xc0014) + +#endif /* _OPSPUT_OPSPUT_LAN_H */ diff -Nru a/include/asm-m32r/opsput/opsput_lcd.h b/include/asm-m32r/opsput/opsput_lcd.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/opsput/opsput_lcd.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,59 @@ +/* + * include/asm/opsput_lcd.h + * + * OPSPUT-LCD board + * + * Copyright (c) 2002 Takeo Takahashi + * + * 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. + * + * $Id: opsput_lcd.h,v 1.1 2004/07/27 06:54:20 sakugawa Exp $ + */ + +#ifndef _OPSPUT_OPSPUT_LCD_H +#define _OPSPUT_OPSPUT_LCD_H + +#include + +#ifndef __ASSEMBLY__ +/* + * C functions use non-cache address. + */ +#define OPSPUT_LCD_BASE (0x10000000 /* + NONCACHE_OFFSET */) +#else +#define OPSPUT_LCD_BASE (0x10000000 + NONCACHE_OFFSET) +#endif /* __ASSEMBLY__ */ + +/* + * ICU + */ +#define OPSPUT_LCD_IRQ_BAT_INT (OPSPUT_LCD_PLD_IRQ_BASE + 1) +#define OPSPUT_LCD_IRQ_USB_INT1 (OPSPUT_LCD_PLD_IRQ_BASE + 2) +#define OPSPUT_LCD_IRQ_AUDT0 (OPSPUT_LCD_PLD_IRQ_BASE + 3) +#define OPSPUT_LCD_IRQ_AUDT2 (OPSPUT_LCD_PLD_IRQ_BASE + 4) +#define OPSPUT_LCD_IRQ_BATSIO_RCV (OPSPUT_LCD_PLD_IRQ_BASE + 16) +#define OPSPUT_LCD_IRQ_BATSIO_SND (OPSPUT_LCD_PLD_IRQ_BASE + 17) +#define OPSPUT_LCD_IRQ_ASNDSIO_RCV (OPSPUT_LCD_PLD_IRQ_BASE + 18) +#define OPSPUT_LCD_IRQ_ASNDSIO_SND (OPSPUT_LCD_PLD_IRQ_BASE + 19) +#define OPSPUT_LCD_IRQ_ACNLSIO_SND (OPSPUT_LCD_PLD_IRQ_BASE + 21) + +#define OPSPUT_LCD_ICUISTS __reg16(OPSPUT_LCD_BASE + 0x300002) +#define OPSPUT_LCD_ICUISTS_VECB_MASK (0xf000) +#define OPSPUT_LCD_VECB(x) ((x) & OPSPUT_LCD_ICUISTS_VECB_MASK) +#define OPSPUT_LCD_ICUISTS_ISN_MASK (0x07c0) +#define OPSPUT_LCD_ICUISTS_ISN(x) ((x) & OPSPUT_LCD_ICUISTS_ISN_MASK) +#define OPSPUT_LCD_ICUIREQ0 __reg16(OPSPUT_LCD_BASE + 0x300004) +#define OPSPUT_LCD_ICUIREQ1 __reg16(OPSPUT_LCD_BASE + 0x300006) +#define OPSPUT_LCD_ICUCR1 __reg16(OPSPUT_LCD_BASE + 0x300020) +#define OPSPUT_LCD_ICUCR2 __reg16(OPSPUT_LCD_BASE + 0x300022) +#define OPSPUT_LCD_ICUCR3 __reg16(OPSPUT_LCD_BASE + 0x300024) +#define OPSPUT_LCD_ICUCR4 __reg16(OPSPUT_LCD_BASE + 0x300026) +#define OPSPUT_LCD_ICUCR16 __reg16(OPSPUT_LCD_BASE + 0x300030) +#define OPSPUT_LCD_ICUCR17 __reg16(OPSPUT_LCD_BASE + 0x300032) +#define OPSPUT_LCD_ICUCR18 __reg16(OPSPUT_LCD_BASE + 0x300034) +#define OPSPUT_LCD_ICUCR19 __reg16(OPSPUT_LCD_BASE + 0x300036) +#define OPSPUT_LCD_ICUCR21 __reg16(OPSPUT_LCD_BASE + 0x30003a) + +#endif /* _OPSPUT_OPSPUT_LCD_H */ diff -Nru a/include/asm-m32r/opsput/opsput_pld.h b/include/asm-m32r/opsput/opsput_pld.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/opsput/opsput_pld.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,259 @@ +/* + * include/asm/opsput/opsput_pld.h + * + * Definitions for Programable Logic Device(PLD) on OPSPUT board. + * + * Copyright (c) 2002 Takeo Takahashi + * + * 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. + * + * $Id: opsput_pld.h,v 1.1 2004/07/27 06:54:20 sakugawa Exp $ + */ + +#ifndef _OPSPUT_OPSPUT_PLD_H +#define _OPSPUT_OPSPUT_PLD_H + +#include + +#define PLD_PLAT_BASE 0x1cc00000 + +#ifndef __ASSEMBLY__ +/* + * C functions use non-cache address. + */ +#define PLD_BASE (PLD_PLAT_BASE /* + NONCACHE_OFFSET */) +#define __reg8 (volatile unsigned char *) +#define __reg16 (volatile unsigned short *) +#define __reg32 (volatile unsigned int *) +#else +#define PLD_BASE (PLD_PLAT_BASE + NONCACHE_OFFSET) +#define __reg8 +#define __reg16 +#define __reg32 +#endif /* __ASSEMBLY__ */ + +/* CFC */ +#define PLD_CFRSTCR __reg16(PLD_BASE + 0x0000) +#define PLD_CFSTS __reg16(PLD_BASE + 0x0002) +#define PLD_CFIMASK __reg16(PLD_BASE + 0x0004) +#define PLD_CFBUFCR __reg16(PLD_BASE + 0x0006) +#define PLD_CFVENCR __reg16(PLD_BASE + 0x0008) +#define PLD_CFCR0 __reg16(PLD_BASE + 0x000a) +#define PLD_CFCR1 __reg16(PLD_BASE + 0x000c) +#define PLD_IDERSTCR __reg16(PLD_BASE + 0x0010) + +/* MMC */ +#define PLD_MMCCR __reg16(PLD_BASE + 0x4000) +#define PLD_MMCMOD __reg16(PLD_BASE + 0x4002) +#define PLD_MMCSTS __reg16(PLD_BASE + 0x4006) +#define PLD_MMCBAUR __reg16(PLD_BASE + 0x400a) +#define PLD_MMCCMDBCUT __reg16(PLD_BASE + 0x400c) +#define PLD_MMCCDTBCUT __reg16(PLD_BASE + 0x400e) +#define PLD_MMCDET __reg16(PLD_BASE + 0x4010) +#define PLD_MMCWP __reg16(PLD_BASE + 0x4012) +#define PLD_MMCWDATA __reg16(PLD_BASE + 0x5000) +#define PLD_MMCRDATA __reg16(PLD_BASE + 0x6000) +#define PLD_MMCCMDDATA __reg16(PLD_BASE + 0x7000) +#define PLD_MMCRSPDATA __reg16(PLD_BASE + 0x7006) + +/* ICU + * ICUISTS: status register + * ICUIREQ0: request register + * ICUIREQ1: request register + * ICUCR3: control register for CFIREQ# interrupt + * ICUCR4: control register for CFC Card insert interrupt + * ICUCR5: control register for CFC Card eject interrupt + * ICUCR6: control register for external interrupt + * ICUCR11: control register for MMC Card insert/eject interrupt + * ICUCR13: control register for SC error interrupt + * ICUCR14: control register for SC receive interrupt + * ICUCR15: control register for SC send interrupt + * ICUCR16: control register for SIO0 receive interrupt + * ICUCR17: control register for SIO0 send interrupt + */ +#if !defined(CONFIG_PLAT_USRV) +#define PLD_IRQ_INT0 (OPSPUT_PLD_IRQ_BASE + 0) /* None */ +#define PLD_IRQ_INT1 (OPSPUT_PLD_IRQ_BASE + 1) /* reserved */ +#define PLD_IRQ_INT2 (OPSPUT_PLD_IRQ_BASE + 2) /* reserved */ +#define PLD_IRQ_CFIREQ (OPSPUT_PLD_IRQ_BASE + 3) /* CF IREQ */ +#define PLD_IRQ_CFC_INSERT (OPSPUT_PLD_IRQ_BASE + 4) /* CF Insert */ +#define PLD_IRQ_CFC_EJECT (OPSPUT_PLD_IRQ_BASE + 5) /* CF Eject */ +#define PLD_IRQ_EXINT (OPSPUT_PLD_IRQ_BASE + 6) /* EXINT */ +#define PLD_IRQ_INT7 (OPSPUT_PLD_IRQ_BASE + 7) /* reserved */ +#define PLD_IRQ_INT8 (OPSPUT_PLD_IRQ_BASE + 8) /* reserved */ +#define PLD_IRQ_INT9 (OPSPUT_PLD_IRQ_BASE + 9) /* reserved */ +#define PLD_IRQ_INT10 (OPSPUT_PLD_IRQ_BASE + 10) /* reserved */ +#define PLD_IRQ_MMCCARD (OPSPUT_PLD_IRQ_BASE + 11) /* MMC Insert/Eject */ +#define PLD_IRQ_INT12 (OPSPUT_PLD_IRQ_BASE + 12) /* reserved */ +#define PLD_IRQ_SC_ERROR (OPSPUT_PLD_IRQ_BASE + 13) /* SC error */ +#define PLD_IRQ_SC_RCV (OPSPUT_PLD_IRQ_BASE + 14) /* SC receive */ +#define PLD_IRQ_SC_SND (OPSPUT_PLD_IRQ_BASE + 15) /* SC send */ +#define PLD_IRQ_SIO0_RCV (OPSPUT_PLD_IRQ_BASE + 16) /* SIO receive */ +#define PLD_IRQ_SIO0_SND (OPSPUT_PLD_IRQ_BASE + 17) /* SIO send */ +#define PLD_IRQ_INT18 (OPSPUT_PLD_IRQ_BASE + 18) /* reserved */ +#define PLD_IRQ_INT19 (OPSPUT_PLD_IRQ_BASE + 19) /* reserved */ +#define PLD_IRQ_INT20 (OPSPUT_PLD_IRQ_BASE + 20) /* reserved */ +#define PLD_IRQ_INT21 (OPSPUT_PLD_IRQ_BASE + 21) /* reserved */ +#define PLD_IRQ_INT22 (OPSPUT_PLD_IRQ_BASE + 22) /* reserved */ +#define PLD_IRQ_INT23 (OPSPUT_PLD_IRQ_BASE + 23) /* reserved */ +#define PLD_IRQ_INT24 (OPSPUT_PLD_IRQ_BASE + 24) /* reserved */ +#define PLD_IRQ_INT25 (OPSPUT_PLD_IRQ_BASE + 25) /* reserved */ +#define PLD_IRQ_INT26 (OPSPUT_PLD_IRQ_BASE + 26) /* reserved */ +#define PLD_IRQ_INT27 (OPSPUT_PLD_IRQ_BASE + 27) /* reserved */ +#define PLD_IRQ_INT28 (OPSPUT_PLD_IRQ_BASE + 28) /* reserved */ +#define PLD_IRQ_INT29 (OPSPUT_PLD_IRQ_BASE + 29) /* reserved */ +#define PLD_IRQ_INT30 (OPSPUT_PLD_IRQ_BASE + 30) /* reserved */ +#define PLD_IRQ_INT31 (OPSPUT_PLD_IRQ_BASE + 31) /* reserved */ + +#else /* CONFIG_PLAT_USRV */ + +#define PLD_IRQ_INT0 (OPSPUT_PLD_IRQ_BASE + 0) /* None */ +#define PLD_IRQ_INT1 (OPSPUT_PLD_IRQ_BASE + 1) /* reserved */ +#define PLD_IRQ_INT2 (OPSPUT_PLD_IRQ_BASE + 2) /* reserved */ +#define PLD_IRQ_CF0 (OPSPUT_PLD_IRQ_BASE + 3) /* CF0# */ +#define PLD_IRQ_CF1 (OPSPUT_PLD_IRQ_BASE + 4) /* CF1# */ +#define PLD_IRQ_CF2 (OPSPUT_PLD_IRQ_BASE + 5) /* CF2# */ +#define PLD_IRQ_CF3 (OPSPUT_PLD_IRQ_BASE + 6) /* CF3# */ +#define PLD_IRQ_CF4 (OPSPUT_PLD_IRQ_BASE + 7) /* CF4# */ +#define PLD_IRQ_INT8 (OPSPUT_PLD_IRQ_BASE + 8) /* reserved */ +#define PLD_IRQ_INT9 (OPSPUT_PLD_IRQ_BASE + 9) /* reserved */ +#define PLD_IRQ_INT10 (OPSPUT_PLD_IRQ_BASE + 10) /* reserved */ +#define PLD_IRQ_INT11 (OPSPUT_PLD_IRQ_BASE + 11) /* reserved */ +#define PLD_IRQ_UART0 (OPSPUT_PLD_IRQ_BASE + 12) /* UARTIRQ0 */ +#define PLD_IRQ_UART1 (OPSPUT_PLD_IRQ_BASE + 13) /* UARTIRQ1 */ +#define PLD_IRQ_INT14 (OPSPUT_PLD_IRQ_BASE + 14) /* reserved */ +#define PLD_IRQ_INT15 (OPSPUT_PLD_IRQ_BASE + 15) /* reserved */ +#define PLD_IRQ_SNDINT (OPSPUT_PLD_IRQ_BASE + 16) /* SNDINT# */ +#define PLD_IRQ_INT17 (OPSPUT_PLD_IRQ_BASE + 17) /* reserved */ +#define PLD_IRQ_INT18 (OPSPUT_PLD_IRQ_BASE + 18) /* reserved */ +#define PLD_IRQ_INT19 (OPSPUT_PLD_IRQ_BASE + 19) /* reserved */ +#define PLD_IRQ_INT20 (OPSPUT_PLD_IRQ_BASE + 20) /* reserved */ +#define PLD_IRQ_INT21 (OPSPUT_PLD_IRQ_BASE + 21) /* reserved */ +#define PLD_IRQ_INT22 (OPSPUT_PLD_IRQ_BASE + 22) /* reserved */ +#define PLD_IRQ_INT23 (OPSPUT_PLD_IRQ_BASE + 23) /* reserved */ +#define PLD_IRQ_INT24 (OPSPUT_PLD_IRQ_BASE + 24) /* reserved */ +#define PLD_IRQ_INT25 (OPSPUT_PLD_IRQ_BASE + 25) /* reserved */ +#define PLD_IRQ_INT26 (OPSPUT_PLD_IRQ_BASE + 26) /* reserved */ +#define PLD_IRQ_INT27 (OPSPUT_PLD_IRQ_BASE + 27) /* reserved */ +#define PLD_IRQ_INT28 (OPSPUT_PLD_IRQ_BASE + 28) /* reserved */ +#define PLD_IRQ_INT29 (OPSPUT_PLD_IRQ_BASE + 29) /* reserved */ +#define PLD_IRQ_INT30 (OPSPUT_PLD_IRQ_BASE + 30) /* reserved */ + +#endif /* CONFIG_PLAT_USRV */ + +#define PLD_ICUISTS __reg16(PLD_BASE + 0x8002) +#define PLD_ICUISTS_VECB_MASK (0xf000) +#define PLD_ICUISTS_VECB(x) ((x) & PLD_ICUISTS_VECB_MASK) +#define PLD_ICUISTS_ISN_MASK (0x07c0) +#define PLD_ICUISTS_ISN(x) ((x) & PLD_ICUISTS_ISN_MASK) +#define PLD_ICUIREQ0 __reg16(PLD_BASE + 0x8004) +#define PLD_ICUIREQ1 __reg16(PLD_BASE + 0x8006) +#define PLD_ICUCR1 __reg16(PLD_BASE + 0x8100) +#define PLD_ICUCR2 __reg16(PLD_BASE + 0x8102) +#define PLD_ICUCR3 __reg16(PLD_BASE + 0x8104) +#define PLD_ICUCR4 __reg16(PLD_BASE + 0x8106) +#define PLD_ICUCR5 __reg16(PLD_BASE + 0x8108) +#define PLD_ICUCR6 __reg16(PLD_BASE + 0x810a) +#define PLD_ICUCR7 __reg16(PLD_BASE + 0x810c) +#define PLD_ICUCR8 __reg16(PLD_BASE + 0x810e) +#define PLD_ICUCR9 __reg16(PLD_BASE + 0x8110) +#define PLD_ICUCR10 __reg16(PLD_BASE + 0x8112) +#define PLD_ICUCR11 __reg16(PLD_BASE + 0x8114) +#define PLD_ICUCR12 __reg16(PLD_BASE + 0x8116) +#define PLD_ICUCR13 __reg16(PLD_BASE + 0x8118) +#define PLD_ICUCR14 __reg16(PLD_BASE + 0x811a) +#define PLD_ICUCR15 __reg16(PLD_BASE + 0x811c) +#define PLD_ICUCR16 __reg16(PLD_BASE + 0x811e) +#define PLD_ICUCR17 __reg16(PLD_BASE + 0x8120) +#define PLD_ICUCR_IEN (0x1000) +#define PLD_ICUCR_IREQ (0x0100) +#define PLD_ICUCR_ISMOD00 (0x0000) /* Low edge */ +#define PLD_ICUCR_ISMOD01 (0x0010) /* Low level */ +#define PLD_ICUCR_ISMOD02 (0x0020) /* High edge */ +#define PLD_ICUCR_ISMOD03 (0x0030) /* High level */ +#define PLD_ICUCR_ILEVEL0 (0x0000) +#define PLD_ICUCR_ILEVEL1 (0x0001) +#define PLD_ICUCR_ILEVEL2 (0x0002) +#define PLD_ICUCR_ILEVEL3 (0x0003) +#define PLD_ICUCR_ILEVEL4 (0x0004) +#define PLD_ICUCR_ILEVEL5 (0x0005) +#define PLD_ICUCR_ILEVEL6 (0x0006) +#define PLD_ICUCR_ILEVEL7 (0x0007) + +/* Power Control of MMC and CF */ +#define PLD_CPCR __reg16(PLD_BASE + 0x14000) +#define PLD_CPCR_CF 0x0001 +#define PLD_CPCR_MMC 0x0002 + +/* LED Control + * + * 1: DIP swich side + * 2: Reset switch side + */ +#define PLD_IOLEDCR __reg16(PLD_BASE + 0x14002) +#define PLD_IOLED_1_ON 0x001 +#define PLD_IOLED_1_OFF 0x000 +#define PLD_IOLED_2_ON 0x002 +#define PLD_IOLED_2_OFF 0x000 + +/* DIP Switch + * 0: Write-protect of Flash Memory (0:protected, 1:non-protected) + * 1: - + * 2: - + * 3: - + */ +#define PLD_IOSWSTS __reg16(PLD_BASE + 0x14004) +#define PLD_IOSWSTS_IOSW2 0x0200 +#define PLD_IOSWSTS_IOSW1 0x0100 +#define PLD_IOSWSTS_IOWP0 0x0001 + +/* CRC */ +#define PLD_CRC7DATA __reg16(PLD_BASE + 0x18000) +#define PLD_CRC7INDATA __reg16(PLD_BASE + 0x18002) +#define PLD_CRC16DATA __reg16(PLD_BASE + 0x18004) +#define PLD_CRC16INDATA __reg16(PLD_BASE + 0x18006) +#define PLD_CRC16ADATA __reg16(PLD_BASE + 0x18008) +#define PLD_CRC16AINDATA __reg16(PLD_BASE + 0x1800a) + +/* RTC */ +#define PLD_RTCCR __reg16(PLD_BASE + 0x1c000) +#define PLD_RTCBAUR __reg16(PLD_BASE + 0x1c002) +#define PLD_RTCWRDATA __reg16(PLD_BASE + 0x1c004) +#define PLD_RTCRDDATA __reg16(PLD_BASE + 0x1c006) +#define PLD_RTCRSTODT __reg16(PLD_BASE + 0x1c008) + +/* SIO0 */ +#define PLD_ESIO0CR __reg16(PLD_BASE + 0x20000) +#define PLD_ESIO0CR_TXEN 0x0001 +#define PLD_ESIO0CR_RXEN 0x0002 +#define PLD_ESIO0MOD0 __reg16(PLD_BASE + 0x20002) +#define PLD_ESIO0MOD0_CTSS 0x0040 +#define PLD_ESIO0MOD0_RTSS 0x0080 +#define PLD_ESIO0MOD1 __reg16(PLD_BASE + 0x20004) +#define PLD_ESIO0MOD1_LMFS 0x0010 +#define PLD_ESIO0STS __reg16(PLD_BASE + 0x20006) +#define PLD_ESIO0STS_TEMP 0x0001 +#define PLD_ESIO0STS_TXCP 0x0002 +#define PLD_ESIO0STS_RXCP 0x0004 +#define PLD_ESIO0STS_TXSC 0x0100 +#define PLD_ESIO0STS_RXSC 0x0200 +#define PLD_ESIO0STS_TXREADY (PLD_ESIO0STS_TXCP | PLD_ESIO0STS_TEMP) +#define PLD_ESIO0INTCR __reg16(PLD_BASE + 0x20008) +#define PLD_ESIO0INTCR_TXIEN 0x0002 +#define PLD_ESIO0INTCR_RXCEN 0x0004 +#define PLD_ESIO0BAUR __reg16(PLD_BASE + 0x2000a) +#define PLD_ESIO0TXB __reg16(PLD_BASE + 0x2000c) +#define PLD_ESIO0RXB __reg16(PLD_BASE + 0x2000e) + +/* SIM Card */ +#define PLD_SCCR __reg16(PLD_BASE + 0x38000) +#define PLD_SCMOD __reg16(PLD_BASE + 0x38004) +#define PLD_SCSTS __reg16(PLD_BASE + 0x38006) +#define PLD_SCINTCR __reg16(PLD_BASE + 0x38008) +#define PLD_SCBAUR __reg16(PLD_BASE + 0x3800a) +#define PLD_SCTXB __reg16(PLD_BASE + 0x3800c) +#define PLD_SCRXB __reg16(PLD_BASE + 0x3800e) + +#endif /* _OPSPUT_OPSPUT_PLD.H */ diff -Nru a/include/asm-m32r/page.h b/include/asm-m32r/page.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/page.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,112 @@ +#ifndef _ASM_M32R_PAGE_H +#define _ASM_M32R_PAGE_H + +#include + +/* PAGE_SHIFT determines the page size */ +#define PAGE_SHIFT 12 +#define PAGE_SIZE (1UL << PAGE_SHIFT) +#define PAGE_MASK (~(PAGE_SIZE-1)) + +#ifdef __KERNEL__ +#ifndef __ASSEMBLY__ + +extern void clear_page(void *to); +extern void copy_page(void *to, void *from); + +#define clear_user_page(page, vaddr, pg) clear_page(page) +#define copy_user_page(to, from, vaddr, pg) copy_page(to, from) + +/* + * These are used to make use of C type-checking.. + */ +typedef struct { unsigned long pte; } pte_t; +typedef struct { unsigned long pmd; } pmd_t; +typedef struct { unsigned long pgd; } pgd_t; +#define pte_val(x) ((x).pte) +#define PTE_MASK PAGE_MASK + +typedef struct { unsigned long pgprot; } pgprot_t; + +#define pmd_val(x) ((x).pmd) +#define pgd_val(x) ((x).pgd) +#define pgprot_val(x) ((x).pgprot) + +#define __pte(x) ((pte_t) { (x) } ) +#define __pmd(x) ((pmd_t) { (x) } ) +#define __pgd(x) ((pgd_t) { (x) } ) +#define __pgprot(x) ((pgprot_t) { (x) } ) + +#endif /* !__ASSEMBLY__ */ + +/* to align the pointer to the (next) page boundary */ +#define PAGE_ALIGN(addr) (((addr) + PAGE_SIZE - 1) & PAGE_MASK) + +/* + * This handles the memory map.. We could make this a config + * option, but too many people screw it up, and too few need + * it. + * + * A __PAGE_OFFSET of 0xC0000000 means that the kernel has + * a virtual address space of one gigabyte, which limits the + * amount of physical memory you can use to about 950MB. + * + * If you want more physical memory than this then see the CONFIG_HIGHMEM4G + * and CONFIG_HIGHMEM64G options in the kernel configuration. + */ + + +/* This handles the memory map.. */ + +#ifndef __ASSEMBLY__ + +/* Pure 2^n version of get_order */ +static __inline__ int get_order(unsigned long size) +{ + int order; + + size = (size - 1) >> (PAGE_SHIFT - 1); + order = -1; + do { + size >>= 1; + order++; + } while (size); + + return order; +} + +#endif /* __ASSEMBLY__ */ + +#define __MEMORY_START CONFIG_MEMORY_START +#define __MEMORY_SIZE CONFIG_MEMORY_SIZE + +#ifdef CONFIG_MMU +#define __PAGE_OFFSET (0x80000000) +#else +#define __PAGE_OFFSET (0x00000000) +#endif + +#define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET) +#define __pa(x) ((unsigned long)(x) - PAGE_OFFSET) +#define __va(x) ((void *)((unsigned long)(x) + PAGE_OFFSET)) + +#ifndef CONFIG_DISCONTIGMEM +#define PFN_BASE (CONFIG_MEMORY_START >> PAGE_SHIFT) +#define pfn_to_page(pfn) (mem_map + ((pfn) - PFN_BASE)) +#define page_to_pfn(page) \ + ((unsigned long)((page) - mem_map) + PFN_BASE) +#define pfn_valid(pfn) (((pfn) - PFN_BASE) < max_mapnr) +#endif /* !CONFIG_DISCONTIGMEM */ + +#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) +#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) + +#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ + VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC ) + +#define devmem_is_allowed(x) 1 + +#endif /* __KERNEL__ */ + +#endif /* _ASM_M32R_PAGE_H */ + diff -Nru a/include/asm-m32r/param.h b/include/asm-m32r/param.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/param.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,27 @@ +#ifndef _ASM_M32R_PARAM_H +#define _ASM_M32R_PARAM_H + +/* $Id$ */ + +/* orig : i386 2.5.67 */ + +#ifdef __KERNEL__ +# define HZ 100 /* Internal kernel timer frequency */ +# define USER_HZ 100 /* .. some user interfaces are in "ticks" */ +# define CLOCKS_PER_SEC (USER_HZ) /* like times() */ +#endif + +#ifndef HZ +#define HZ 100 +#endif + +#define EXEC_PAGESIZE 4096 + +#ifndef NOGROUP +#define NOGROUP (-1) +#endif + +#define MAXHOSTNAMELEN 64 /* max length of hostname */ + +#endif /* _ASM_M32R_PARAM_H */ + diff -Nru a/include/asm-m32r/pci.h b/include/asm-m32r/pci.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/pci.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,10 @@ +#ifndef _ASM_M32R_PCI_H +#define _ASM_M32R_PCI_H + +/* $Id$ */ + +#include + +#define PCI_DMA_BUS_IS_PHYS (1) + +#endif /* _ASM_M32R_PCI_H */ diff -Nru a/include/asm-m32r/percpu.h b/include/asm-m32r/percpu.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/percpu.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,6 @@ +#ifndef __ARCH_M32R_PERCPU__ +#define __ARCH_M32R_PERCPU__ + +#include + +#endif /* __ARCH_M32R_PERCPU__ */ diff -Nru a/include/asm-m32r/pgalloc.h b/include/asm-m32r/pgalloc.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/pgalloc.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,87 @@ +#ifndef _ASM_M32R_PGALLOC_H +#define _ASM_M32R_PGALLOC_H + +/* $Id$ */ + +#include +#include + +#include +#include + +#define pmd_populate_kernel(mm, pmd, pte) \ + set_pmd(pmd, __pmd(_PAGE_TABLE + __pa(pte))) + +static __inline__ void pmd_populate(struct mm_struct *mm, pmd_t *pmd, + struct page *pte) +{ + set_pmd(pmd, __pmd(_PAGE_TABLE + page_to_phys(pte))); +} + +/* + * Allocate and free page tables. + */ +static __inline__ pgd_t *pgd_alloc(struct mm_struct *mm) +{ + pgd_t *pgd = (pgd_t *)__get_free_page(GFP_KERNEL); + + if (pgd) + clear_page(pgd); + + return pgd; +} + +static __inline__ void pgd_free(pgd_t *pgd) +{ + free_page((unsigned long)pgd); +} + +static __inline__ pte_t *pte_alloc_one_kernel(struct mm_struct *mm, + unsigned long address) +{ + pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL); + + if (pte) + clear_page(pte); + + return pte; +} + +static __inline__ struct page *pte_alloc_one(struct mm_struct *mm, + unsigned long address) +{ + struct page *pte = alloc_page(GFP_KERNEL); + + if (pte) + clear_page(page_address(pte)); + + return pte; +} + +static __inline__ void pte_free_kernel(pte_t *pte) +{ + free_page((unsigned long)pte); +} + +static __inline__ void pte_free(struct page *pte) +{ + __free_page(pte); +} + +#define __pte_free_tlb(tlb, pte) pte_free((pte)) + +/* + * allocating and freeing a pmd is trivial: the 1-entry pmd is + * inside the pgd, so has no extra memory associated with it. + * (In the PAE case we free the pmds as part of the pgd.) + */ + +#define pmd_alloc_one(mm, addr) ({ BUG(); ((pmd_t *)2); }) +#define pmd_free(x) do { } while (0) +#define __pmd_free_tlb(tlb, x) do { } while (0) +#define pgd_populate(mm, pmd, pte) BUG() + +#define check_pgt_cache() do { } while (0) + +#endif /* _ASM_M32R_PGALLOC_H */ + diff -Nru a/include/asm-m32r/pgtable-2level.h b/include/asm-m32r/pgtable-2level.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/pgtable-2level.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,77 @@ +#ifndef _ASM_M32R_PGTABLE_2LEVEL_H +#define _ASM_M32R_PGTABLE_2LEVEL_H + +/* $Id$ */ + +#include + +/* + * traditional M32R two-level paging structure: + */ + +#define PGDIR_SHIFT 22 +#define PTRS_PER_PGD 1024 + +/* + * the M32R is two-level, so we don't really have any + * PMD directory physically. + */ +#define PMD_SHIFT 22 +#define PTRS_PER_PMD 1 + +#define PTRS_PER_PTE 1024 + +#define pte_ERROR(e) \ + printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e)) +#define pmd_ERROR(e) \ + printk("%s:%d: bad pmd %08lx.\n", __FILE__, __LINE__, pmd_val(e)) +#define pgd_ERROR(e) \ + printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e)) + +/* + * 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 + * into the pgd entry) + */ +static __inline__ int pgd_none(pgd_t pgd) { return 0; } +static __inline__ int pgd_bad(pgd_t pgd) { return 0; } +static __inline__ int pgd_present(pgd_t pgd) { return 1; } +#define pgd_clear(xp) do { } while (0) + +/* + * Certain architectures need to do special things when PTEs + * within a page table are directly modified. Thus, the following + * hook is made available. + */ +#define set_pte(pteptr, pteval) (*(pteptr) = pteval) +#define set_pte_atomic(pteptr, pteval) set_pte(pteptr, pteval) +/* + * (pmds are folded into pgds so this doesnt get actually called, + * but the define is needed for a generic inline function.) + */ +#define set_pmd(pmdptr, pmdval) (*(pmdptr) = pmdval) +#define set_pgd(pgdptr, pgdval) (*(pgdptr) = pgdval) + +#define pgd_page(pgd) \ +((unsigned long) __va(pgd_val(pgd) & PAGE_MASK)) + +static __inline__ pmd_t *pmd_offset(pgd_t * dir, unsigned long address) +{ + return (pmd_t *) dir; +} + +#define ptep_get_and_clear(xp) __pte(xchg(&(xp)->pte, 0)) +#define pte_same(a, b) (pte_val(a) == pte_val(b)) +#define pte_page(x) pfn_to_page(pte_pfn(x)) +#define pte_none(x) (!pte_val(x)) +#define pte_pfn(x) (pte_val(x) >> PAGE_SHIFT) +#define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot)) +#define pfn_pmd(pfn, prot) __pmd(((pfn) << PAGE_SHIFT) | pgprot_val(prot)) + +/* M32R_FIXME : PTE_FILE_MAX_BITS, pte_to_pgoff, pgoff_to_pte */ +#define PTE_FILE_MAX_BITS 31 +#define pte_to_pgoff(pte) (pte_val(pte) >> 1) +#define pgoff_to_pte(off) ((pte_t) { ((off) << 1) | _PAGE_FILE }) + +#endif /* _ASM_M32R_PGTABLE_2LEVEL_H */ + diff -Nru a/include/asm-m32r/pgtable.h b/include/asm-m32r/pgtable.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/pgtable.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,422 @@ +#ifndef _ASM_M32R_PGTABLE_H +#define _ASM_M32R_PGTABLE_H + +/* $Id$ */ + +/* + * The Linux memory management assumes a three-level page table setup. On + * the M32R, we use that, but "fold" the mid level into the top-level page + * table, so that we physically have the same two-level page table as the + * M32R mmu expects. + * + * This file contains the functions and defines necessary to modify and use + * the M32R page table tree. + */ + +/* CAUTION!: If you change macro definitions in this file, you might have to + * change arch/m32r/mmu.S manually. + */ + +#ifndef __ASSEMBLY__ + +#include +#include +#include +#include +#include +#include + +extern pgd_t swapper_pg_dir[1024]; +extern void paging_init(void); + +/* + * ZERO_PAGE is a global shared page that is always zero: used + * for zero-mapped memory areas etc.. + */ +extern unsigned long empty_zero_page[1024]; +#define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page)) + +#endif /* !__ASSEMBLY__ */ + +/* + * The Linux x86 paging architecture is 'compile-time dual-mode', it + * implements both the traditional 2-level x86 page tables and the + * newer 3-level PAE-mode page tables. + */ +#ifndef __ASSEMBLY__ +#include +#endif + +#define pgtable_cache_init() do { } while (0) + +#define PMD_SIZE (1UL << PMD_SHIFT) +#define PMD_MASK (~(PMD_SIZE - 1)) +#define PGDIR_SIZE (1UL << PGDIR_SHIFT) +#define PGDIR_MASK (~(PGDIR_SIZE - 1)) + +#define USER_PTRS_PER_PGD (TASK_SIZE / PGDIR_SIZE) +#define FIRST_USER_PGD_NR 0 + +#ifndef __ASSEMBLY__ +/* Just any arbitrary offset to the start of the vmalloc VM area: the + * current 8MB value just means that there will be a 8MB "hole" after the + * physical memory until the kernel virtual memory starts. That means that + * any out-of-bounds memory accesses will hopefully be caught. + * The vmalloc() routines leaves a hole of 4kB between each vmalloced + * area for the same reason. ;) + */ +#define VMALLOC_START KSEG2 +#define VMALLOC_END KSEG3 + +/* + * The 4MB page is guessing.. Detailed in the infamous "Chapter H" + * of the Pentium details, but assuming intel did the straightforward + * thing, this bit set in the page directory entry just means that + * the page directory entry points directly to a 4MB-aligned block of + * memory. + */ + +/* + * M32R TLB format + * + * [0] [1:19] [20:23] [24:31] + * +-----------------------+----+-------------+ + * | VPN |0000| ASID | + * +-----------------------+----+-------------+ + * +-+---------------------+----+-+---+-+-+-+-+ + * |0 PPN |0000|N|AC |L|G|V| | + * +-+---------------------+----+-+---+-+-+-+-+ + * RWX + */ + +#define _PAGE_BIT_DIRTY 0 /* software */ +#define _PAGE_BIT_FILE 0 /* when !present: nonlinear file + mapping */ +#define _PAGE_BIT_PRESENT 1 /* Valid */ +#define _PAGE_BIT_GLOBAL 2 /* Global */ +#define _PAGE_BIT_LARGE 3 /* Large */ +#define _PAGE_BIT_EXEC 4 /* Execute */ +#define _PAGE_BIT_WRITE 5 /* Write */ +#define _PAGE_BIT_READ 6 /* Read */ +#define _PAGE_BIT_NONCACHABLE 7 /* Non cachable */ +#define _PAGE_BIT_USER 8 /* software */ +#define _PAGE_BIT_ACCESSED 9 /* software */ + +#define _PAGE_DIRTY \ + (1UL << _PAGE_BIT_DIRTY) /* software : page changed */ +#define _PAGE_FILE \ + (1UL << _PAGE_BIT_FILE) /* when !present: nonlinear file + mapping */ +#define _PAGE_PRESENT \ + (1UL << _PAGE_BIT_PRESENT) /* Valid : Page is Valid */ +#define _PAGE_GLOBAL \ + (1UL << _PAGE_BIT_GLOBAL) /* Global */ +#define _PAGE_LARGE \ + (1UL << _PAGE_BIT_LARGE) /* Large */ +#define _PAGE_EXEC \ + (1UL << _PAGE_BIT_EXEC) /* Execute */ +#define _PAGE_WRITE \ + (1UL << _PAGE_BIT_WRITE) /* Write */ +#define _PAGE_READ \ + (1UL << _PAGE_BIT_READ) /* Read */ +#define _PAGE_NONCACHABLE \ + (1UL<<_PAGE_BIT_NONCACHABLE) /* Non cachable */ +#define _PAGE_USER \ + (1UL << _PAGE_BIT_USER) /* software : user space access + allowed */ +#define _PAGE_ACCESSED \ + (1UL << _PAGE_BIT_ACCESSED) /* software : page referenced */ + +#define _PAGE_TABLE \ + ( _PAGE_PRESENT | _PAGE_WRITE | _PAGE_READ | _PAGE_USER \ + | _PAGE_ACCESSED | _PAGE_DIRTY ) +#define _KERNPG_TABLE \ + ( _PAGE_PRESENT | _PAGE_WRITE | _PAGE_READ | _PAGE_ACCESSED \ + | _PAGE_DIRTY ) +#define _PAGE_CHG_MASK \ + ( PTE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY ) + +#ifdef CONFIG_MMU +#define PAGE_NONE \ + __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED) +#define PAGE_SHARED \ + __pgprot(_PAGE_PRESENT | _PAGE_WRITE | _PAGE_READ | _PAGE_USER \ + | _PAGE_ACCESSED) +#define PAGE_SHARED_X \ + __pgprot(_PAGE_PRESENT | _PAGE_EXEC | _PAGE_WRITE | _PAGE_READ \ + | _PAGE_USER | _PAGE_ACCESSED) +#define PAGE_COPY \ + __pgprot(_PAGE_PRESENT | _PAGE_EXEC | _PAGE_READ | _PAGE_USER \ + | _PAGE_ACCESSED) +#define PAGE_COPY_X \ + __pgprot(_PAGE_PRESENT | _PAGE_EXEC | _PAGE_READ | _PAGE_USER \ + | _PAGE_ACCESSED) +#define PAGE_READONLY \ + __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_USER | _PAGE_ACCESSED) +#define PAGE_READONLY_X \ + __pgprot(_PAGE_PRESENT | _PAGE_EXEC | _PAGE_READ | _PAGE_USER \ + | _PAGE_ACCESSED) + +#define __PAGE_KERNEL \ + ( _PAGE_PRESENT | _PAGE_EXEC | _PAGE_WRITE | _PAGE_READ | _PAGE_DIRTY \ + | _PAGE_ACCESSED ) +#define __PAGE_KERNEL_RO ( __PAGE_KERNEL & ~_PAGE_WRITE ) +#define __PAGE_KERNEL_NOCACHE ( __PAGE_KERNEL | _PAGE_NONCACHABLE) + +#define MAKE_GLOBAL(x) __pgprot((x) | _PAGE_GLOBAL) + +#define PAGE_KERNEL MAKE_GLOBAL(__PAGE_KERNEL) +#define PAGE_KERNEL_RO MAKE_GLOBAL(__PAGE_KERNEL_RO) +#define PAGE_KERNEL_NOCACHE MAKE_GLOBAL(__PAGE_KERNEL_NOCACHE) + +#else +#define PAGE_NONE __pgprot(0) +#define PAGE_SHARED __pgprot(0) +#define PAGE_SHARED_X __pgprot(0) +#define PAGE_COPY __pgprot(0) +#define PAGE_COPY_X __pgprot(0) +#define PAGE_READONLY __pgprot(0) +#define PAGE_READONLY_X __pgprot(0) + +#define PAGE_KERNEL __pgprot(0) +#define PAGE_KERNEL_RO __pgprot(0) +#define PAGE_KERNEL_NOCACHE __pgprot(0) +#endif /* CONFIG_MMU */ + +/* + * The i386 can't do page protection for execute, and considers that + * the same are read. Also, write permissions imply read permissions. + * This is the closest we can get.. + */ + /* rwx */ +#define __P000 PAGE_NONE +#define __P001 PAGE_READONLY_X +#define __P010 PAGE_COPY_X +#define __P011 PAGE_COPY_X +#define __P100 PAGE_READONLY +#define __P101 PAGE_READONLY_X +#define __P110 PAGE_COPY_X +#define __P111 PAGE_COPY_X + +#define __S000 PAGE_NONE +#define __S001 PAGE_READONLY_X +#define __S010 PAGE_SHARED +#define __S011 PAGE_SHARED_X +#define __S100 PAGE_READONLY +#define __S101 PAGE_READONLY_X +#define __S110 PAGE_SHARED +#define __S111 PAGE_SHARED_X + +/* page table for 0-4MB for everybody */ + +#define pte_present(x) (pte_val(x) & _PAGE_PRESENT) +#define pte_clear(xp) do { set_pte(xp, __pte(0)); } while (0) + +#define pmd_none(x) (!pmd_val(x)) +#define pmd_present(x) (pmd_val(x) & _PAGE_PRESENT) +#define pmd_clear(xp) do { set_pmd(xp, __pmd(0)); } while (0) +#define pmd_bad(x) ((pmd_val(x) & (~PAGE_MASK & ~_PAGE_USER)) \ + != _KERNPG_TABLE) + +#define pages_to_mb(x) ((x) >> (20 - PAGE_SHIFT)) + +/* + * The following only work if pte_present() is true. + * Undefined behaviour if not.. + */ +static __inline__ int pte_user(pte_t pte) +{ + return pte_val(pte) & _PAGE_USER; +} + +static __inline__ int pte_read(pte_t pte) +{ + return pte_val(pte) & _PAGE_READ; +} + +static __inline__ int pte_exec(pte_t pte) +{ + return pte_val(pte) & _PAGE_EXEC; +} + +static __inline__ int pte_dirty(pte_t pte) +{ + return pte_val(pte) & _PAGE_DIRTY; +} + +static __inline__ int pte_young(pte_t pte) +{ + return pte_val(pte) & _PAGE_ACCESSED; +} + +static __inline__ int pte_write(pte_t pte) +{ + return pte_val(pte) & _PAGE_WRITE; +} + +/* + * The following only works if pte_present() is not true. + */ +static __inline__ int pte_file(pte_t pte) +{ + return pte_val(pte) & _PAGE_FILE; +} + +static __inline__ pte_t pte_rdprotect(pte_t pte) +{ + pte_val(pte) &= ~_PAGE_READ; + return pte; +} + +static __inline__ pte_t pte_exprotect(pte_t pte) +{ + pte_val(pte) &= ~_PAGE_EXEC; + return pte; +} + +static __inline__ pte_t pte_mkclean(pte_t pte) +{ + pte_val(pte) &= ~_PAGE_DIRTY; + return pte; +} + +static __inline__ pte_t pte_mkold(pte_t pte) +{ + pte_val(pte) &= ~_PAGE_ACCESSED;return pte;} + +static __inline__ pte_t pte_wrprotect(pte_t pte) +{ + pte_val(pte) &= ~_PAGE_WRITE; + return pte; +} + +static __inline__ pte_t pte_mkread(pte_t pte) +{ + pte_val(pte) |= _PAGE_READ; + return pte; +} + +static __inline__ pte_t pte_mkexec(pte_t pte) +{ + pte_val(pte) |= _PAGE_EXEC; + return pte; +} + +static __inline__ pte_t pte_mkdirty(pte_t pte) +{ + pte_val(pte) |= _PAGE_DIRTY; + return pte; +} + +static __inline__ pte_t pte_mkyoung(pte_t pte) +{ + pte_val(pte) |= _PAGE_ACCESSED; + return pte; +} + +static __inline__ pte_t pte_mkwrite(pte_t pte) +{ + pte_val(pte) |= _PAGE_WRITE; + return pte; +} + +static __inline__ int ptep_test_and_clear_dirty(pte_t *ptep) +{ + return test_and_clear_bit(_PAGE_BIT_DIRTY, ptep); +} + +static __inline__ int ptep_test_and_clear_young(pte_t *ptep) +{ + return test_and_clear_bit(_PAGE_BIT_ACCESSED, ptep); +} + +static __inline__ void ptep_set_wrprotect(pte_t *ptep) +{ + clear_bit(_PAGE_BIT_WRITE, ptep); +} + +static __inline__ void ptep_mkdirty(pte_t *ptep) +{ + set_bit(_PAGE_BIT_DIRTY, ptep); +} + +/* + * Conversion functions: convert a page and protection to a page entry, + * and a page entry and page directory to the page they refer to. + */ +#define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), pgprot) + +static __inline__ pte_t pte_modify(pte_t pte, pgprot_t newprot) +{ + set_pte(&pte, __pte((pte_val(pte) & _PAGE_CHG_MASK) \ + | pgprot_val(newprot))); + + return pte; +} + +#define page_pte(page) page_pte_prot(page, __pgprot(0)) + +/* + * Conversion functions: convert a page and protection to a page entry, + * and a page entry and page directory to the page they refer to. + */ + +static __inline__ void pmd_set(pmd_t * pmdp, pte_t * ptep) +{ + pmd_val(*pmdp) = (((unsigned long) ptep) & PAGE_MASK); +} + +#define pmd_page_kernel(pmd) \ + ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) + +#ifndef CONFIG_DISCONTIGMEM +#define pmd_page(pmd) (mem_map + ((pmd_val(pmd) >> PAGE_SHIFT) - PFN_BASE)) +#endif /* !CONFIG_DISCONTIGMEM */ + +/* to find an entry in a page-table-directory. */ +#define pgd_index(address) \ + (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD - 1)) + +#define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address)) + +/* to find an entry in a kernel page-table-directory */ +#define pgd_offset_k(address) pgd_offset(&init_mm, address) + +#define pmd_index(address) \ + (((address) >> PMD_SHIFT) & (PTRS_PER_PMD - 1)) + +#define pte_index(address) \ + (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) +#define pte_offset_kernel(dir, address) \ + ((pte_t *)pmd_page_kernel(*(dir)) + pte_index(address)) +#define pte_offset_map(dir, address) \ + ((pte_t *)page_address(pmd_page(*(dir))) + pte_index(address)) +#define pte_offset_map_nested(dir, address) pte_offset_map(dir, address) +#define pte_unmap(pte) do { } while (0) +#define pte_unmap_nested(pte) do { } while (0) + +/* Encode and de-code a swap entry */ +#define __swp_type(x) (((x).val >> 1) & 0x3f) +#define __swp_offset(x) ((x).val >> 8) +#define __swp_entry(type, offset) \ + ((swp_entry_t) { ((type) << 1) | ((offset) << 8) }) +#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) +#define __swp_entry_to_pte(x) ((pte_t) { (x).val }) + +#endif /* !__ASSEMBLY__ */ + +/* Needs to be defined here and not in linux/mm.h, as it is arch dependent */ +#define kern_addr_valid(addr) (1) + +#define io_remap_page_range remap_page_range + +#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG +#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY +#define __HAVE_ARCH_PTEP_GET_AND_CLEAR +#define __HAVE_ARCH_PTEP_SET_WRPROTECT +#define __HAVE_ARCH_PTEP_MKDIRTY +#define __HAVE_ARCH_PTE_SAME +#include + +#endif /* _ASM_M32R_PGTABLE_H */ + diff -Nru a/include/asm-m32r/poll.h b/include/asm-m32r/poll.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/poll.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,31 @@ +#ifndef _ASM_M32R_POLL_H +#define _ASM_M32R_POLL_H + +/* + * poll(2) bit definitions. Based on . + * + * Modified 2004 + * Hirokazu Takata + */ + +#define POLLIN 0x0001 +#define POLLPRI 0x0002 +#define POLLOUT 0x0004 +#define POLLERR 0x0008 +#define POLLHUP 0x0010 +#define POLLNVAL 0x0020 + +#define POLLRDNORM 0x0040 +#define POLLRDBAND 0x0080 +#define POLLWRNORM 0x0100 +#define POLLWRBAND 0x0200 +#define POLLMSG 0x0400 +#define POLLREMOVE 0x1000 + +struct pollfd { + int fd; + short events; + short revents; +}; + +#endif /* _ASM_M32R_POLL_H */ diff -Nru a/include/asm-m32r/posix_types.h b/include/asm-m32r/posix_types.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/posix_types.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,126 @@ +#ifndef _ASM_M32R_POSIX_TYPES_H +#define _ASM_M32R_POSIX_TYPES_H + +/* $Id$ */ + +/* orig : i386, sh 2.4.18 */ + +/* + * This file is generally used by user-level software, so you need to + * be a little careful about namespace pollution etc. Also, we cannot + * assume GCC is being used. + */ + +typedef unsigned long __kernel_ino_t; +typedef unsigned short __kernel_mode_t; +typedef unsigned short __kernel_nlink_t; +typedef long __kernel_off_t; +typedef int __kernel_pid_t; +typedef unsigned short __kernel_ipc_pid_t; +typedef unsigned short __kernel_uid_t; +typedef unsigned short __kernel_gid_t; +typedef unsigned int __kernel_size_t; +typedef int __kernel_ssize_t; +typedef int __kernel_ptrdiff_t; +typedef long __kernel_time_t; +typedef long __kernel_suseconds_t; +typedef long __kernel_clock_t; +typedef int __kernel_timer_t; +typedef int __kernel_clockid_t; +typedef int __kernel_daddr_t; +typedef char * __kernel_caddr_t; +typedef unsigned short __kernel_uid16_t; +typedef unsigned short __kernel_gid16_t; +typedef unsigned int __kernel_uid32_t; +typedef unsigned int __kernel_gid32_t; + +typedef unsigned short __kernel_old_uid_t; +typedef unsigned short __kernel_old_gid_t; +typedef unsigned short __kernel_old_dev_t; + +#ifdef __GNUC__ +typedef long long __kernel_loff_t; +#endif + +typedef struct { +#if defined(__KERNEL__) || defined(__USE_ALL) + int val[2]; +#else /* !defined(__KERNEL__) && !defined(__USE_ALL) */ + int __val[2]; +#endif /* !defined(__KERNEL__) && !defined(__USE_ALL) */ +} __kernel_fsid_t; + +#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) + +#undef __FD_SET +static __inline__ void __FD_SET(unsigned long __fd, __kernel_fd_set *__fdsetp) +{ + unsigned long __tmp = __fd / __NFDBITS; + unsigned long __rem = __fd % __NFDBITS; + __fdsetp->fds_bits[__tmp] |= (1UL<<__rem); +} + +#undef __FD_CLR +static __inline__ void __FD_CLR(unsigned long __fd, __kernel_fd_set *__fdsetp) +{ + unsigned long __tmp = __fd / __NFDBITS; + unsigned long __rem = __fd % __NFDBITS; + __fdsetp->fds_bits[__tmp] &= ~(1UL<<__rem); +} + + +#undef __FD_ISSET +static __inline__ int __FD_ISSET(unsigned long __fd, const __kernel_fd_set *__p) +{ + unsigned long __tmp = __fd / __NFDBITS; + unsigned long __rem = __fd % __NFDBITS; + return (__p->fds_bits[__tmp] & (1UL<<__rem)) != 0; +} + +/* + * This will unroll the loop for the normal constant case (8 ints, + * for a 256-bit fd_set) + */ +#undef __FD_ZERO +static __inline__ void __FD_ZERO(__kernel_fd_set *__p) +{ + unsigned long *__tmp = __p->fds_bits; + int __i; + + if (__builtin_constant_p(__FDSET_LONGS)) { + switch (__FDSET_LONGS) { + case 16: + __tmp[ 0] = 0; __tmp[ 1] = 0; + __tmp[ 2] = 0; __tmp[ 3] = 0; + __tmp[ 4] = 0; __tmp[ 5] = 0; + __tmp[ 6] = 0; __tmp[ 7] = 0; + __tmp[ 8] = 0; __tmp[ 9] = 0; + __tmp[10] = 0; __tmp[11] = 0; + __tmp[12] = 0; __tmp[13] = 0; + __tmp[14] = 0; __tmp[15] = 0; + return; + + case 8: + __tmp[ 0] = 0; __tmp[ 1] = 0; + __tmp[ 2] = 0; __tmp[ 3] = 0; + __tmp[ 4] = 0; __tmp[ 5] = 0; + __tmp[ 6] = 0; __tmp[ 7] = 0; + return; + + case 4: + __tmp[ 0] = 0; __tmp[ 1] = 0; + __tmp[ 2] = 0; __tmp[ 3] = 0; + return; + } + } + __i = __FDSET_LONGS; + while (__i) { + __i--; + *__tmp = 0; + __tmp++; + } +} + +#endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */ + +#endif /* _ASM_M32R_POSIX_TYPES_H */ diff -Nru a/include/asm-m32r/processor.h b/include/asm-m32r/processor.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/processor.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,157 @@ +#ifndef _ASM_M32R_PROCESSOR_H +#define _ASM_M32R_PROCESSOR_H + +/* $Id$ */ + +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 2001 by Hiroyuki Kondo, Hirokazu Takata, and Hitoshi Yamamoto + */ + +/* + * include/asm-m32r/processor.h + * + * Copyright (C) 1994 Linus Torvalds + */ +#include +#include +#include +#include /* pt_regs */ + +#include + +/* + * Default implementation of macro that returns current + * instruction pointer ("program counter"). + */ +#define current_text_addr() ({ __label__ _l; _l: &&_l; }) + +/* + * CPU type and hardware bug flags. Kept separately for each CPU. + * Members of this structure are referenced in head.S, so think twice + * before touching them. [mj] + */ + +struct cpuinfo_m32r { + unsigned long pgtable_cache_sz; + unsigned long cpu_clock; + unsigned long bus_clock; + unsigned long timer_divide; + unsigned long loops_per_jiffy; +}; + +/* + * capabilities of CPUs + */ + +extern struct cpuinfo_m32r boot_cpu_data; + +#ifdef CONFIG_SMP +extern struct cpuinfo_m32r cpu_data[]; +#define current_cpu_data cpu_data[smp_processor_id()] +#else +#define cpu_data &boot_cpu_data +#define current_cpu_data boot_cpu_data +#endif + +/* + * User space process size: 2GB (default). + */ +#ifdef CONFIG_MMU +#define TASK_SIZE (0x80000000UL) +#else +#define TASK_SIZE (0x00400000UL) +#endif + +/* This decides where the kernel will search for a free chunk of vm + * space during mmap's. + */ +#define TASK_UNMAPPED_BASE PAGE_ALIGN(TASK_SIZE / 3) + +typedef struct { + unsigned long seg; +} mm_segment_t; + +struct debug_trap { + int nr_trap; + unsigned long addr; + unsigned long insn; +}; + +struct thread_struct { + unsigned long address; + unsigned long trap_no; /* Trap number */ + unsigned long error_code; /* Error code of trap */ + unsigned long lr; /* saved pc */ + unsigned long sp; /* user stack pointer */ + struct debug_trap debug_trap; +}; + +#define INIT_SP (sizeof(init_stack) + (unsigned long) &init_stack) + +#define INIT_THREAD { \ + .sp = INIT_SP, \ +} + +/* + * Do necessary setup to start up a newly executed thread. + */ + +/* User process Backup PSW */ +#define USERPS_BPSW (M32R_PSW_BSM|M32R_PSW_BIE|M32R_PSW_BPM) + +#define start_thread(regs, new_pc, new_spu) \ + do { \ + set_fs(USER_DS); \ + regs->psw = (regs->psw | USERPS_BPSW) & 0x0000FFFFUL; \ + regs->bpc = new_pc; \ + regs->spu = new_spu; \ + } while (0) + +/* Forward declaration, a strange C thing */ +struct task_struct; +struct mm_struct; + +/* Free all resources held by a thread. */ +extern void release_thread(struct task_struct *); + +#define prepare_to_copy(tsk) do { } while (0) + +/* + * create a kernel thread without removing it from tasklists + */ +extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); + +/* Copy and release all segment info associated with a VM */ +extern void copy_segments(struct task_struct *p, struct mm_struct * mm); +extern void release_segments(struct mm_struct * mm); + +extern unsigned long thread_saved_pc(struct task_struct *); + +/* Copy and release all segment info associated with a VM */ +#define copy_segments(p, mm) do { } while (0) +#define release_segments(mm) do { } while (0) + +unsigned long get_wchan(struct task_struct *p); +#define KSTK_EIP(tsk) ((tsk)->thread.lr) +#define KSTK_ESP(tsk) ((tsk)->thread.sp) + +#define THREAD_SIZE (2*PAGE_SIZE) + +/* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */ +static __inline__ void rep_nop(void) +{ + __asm__ __volatile__( + "nop \n\t" + "nop \n\t" + : + : + : "memory"); +} + +#define cpu_relax() rep_nop() + +#endif /* _ASM_M32R_PROCESSOR_H */ diff -Nru a/include/asm-m32r/ptrace.h b/include/asm-m32r/ptrace.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/ptrace.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,165 @@ +#ifndef _ASM_M32R_PTRACE_H +#define _ASM_M32R_PTRACE_H + +/* + * linux/include/asm-m32r/ptrace.h + * + * 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. + * + * M32R version: + * Copyright (C) 2001-2002, 2004 Hirokazu Takata + */ + +#include +#include /* M32R_PSW_BSM, M32R_PSW_BPM */ + +/* 0 - 13 are integer registers (general purpose registers). */ +#define PT_R4 0 +#define PT_R5 1 +#define PT_R6 2 +#define PT_REGS 3 +#define PT_R0 4 +#define PT_R1 5 +#define PT_R2 6 +#define PT_R3 7 +#define PT_R7 8 +#define PT_R8 9 +#define PT_R9 10 +#define PT_R10 11 +#define PT_R11 12 +#define PT_R12 13 +#define PT_SYSCNR 14 +#define PT_R13 PT_FP +#define PT_R14 PT_LR +#define PT_R15 PT_SP + +/* processor status and miscellaneous context registers. */ +#if defined(CONFIG_ISA_M32R2) && defined(CONFIG_ISA_DSP_LEVEL2) +#define PT_ACC0H 15 +#define PT_ACC0L 16 +#define PT_ACC1H 17 +#define PT_ACC1L 18 +#define PT_ACCH PT_ACC0H +#define PT_ACCL PT_ACC0L +#define PT_PSW 19 +#define PT_BPC 20 +#define PT_BBPSW 21 +#define PT_BBPC 22 +#define PT_SPU 23 +#define PT_FP 24 +#define PT_LR 25 +#define PT_SPI 26 +#define PT_ORIGR0 27 +#elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R) +#define PT_ACCH 15 +#define PT_ACCL 16 +#define PT_PSW 17 +#define PT_BPC 18 +#define PT_BBPSW 19 +#define PT_BBPC 20 +#define PT_SPU 21 +#define PT_FP 22 +#define PT_LR 23 +#define PT_SPI 24 +#define PT_ORIGR0 25 +#else +#error unknown isa conifiguration +#endif + +/* virtual pt_reg entry for gdb */ +#define PT_PC 30 +#define PT_CBR 31 +#define PT_EVB 32 + + +/* Control registers. */ +#define SPR_CR0 PT_PSW +#define SPR_CR1 PT_CBR /* read only */ +#define SPR_CR2 PT_SPI +#define SPR_CR3 PT_SPU +#define SPR_CR4 +#define SPR_CR5 PT_EVB /* part of M32R/E, M32R/I core only */ +#define SPR_CR6 PT_BPC +#define SPR_CR7 +#define SPR_CR8 PT_BBPSW +#define SPR_CR9 +#define SPR_CR10 +#define SPR_CR11 +#define SPR_CR12 +#define SPR_CR13 PT_WR +#define SPR_CR14 PT_BBPC +#define SPR_CR15 + +/* this struct defines the way the registers are stored on the + stack during a system call. */ +struct pt_regs { + /* Saved main processor registers. */ + unsigned long r4; + unsigned long r5; + unsigned long r6; + struct pt_regs *pt_regs; + unsigned long r0; + unsigned long r1; + unsigned long r2; + unsigned long r3; + unsigned long r7; + unsigned long r8; + unsigned long r9; + unsigned long r10; + unsigned long r11; + unsigned long r12; + long syscall_nr; + + /* Saved main processor status and miscellaneous context registers. */ +#if defined(CONFIG_ISA_M32R2) && defined(CONFIG_ISA_DSP_LEVEL2) + unsigned long acc0h; + unsigned long acc0l; + unsigned long acc1h; + unsigned long acc1l; +#elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R) + unsigned long acch; + unsigned long accl; +#else +#error unknown isa configuration +#endif + unsigned long psw; + unsigned long bpc; /* saved PC for TRAP syscalls */ + unsigned long bbpsw; + unsigned long bbpc; + unsigned long spu; /* saved user stack */ + unsigned long fp; + unsigned long lr; /* saved PC for JL syscalls */ + unsigned long spi; /* saved kernel stack */ + unsigned long orig_r0; +}; + +/* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */ +#define PTRACE_GETREGS 12 +#define PTRACE_SETREGS 13 + +#define PTRACE_OLDSETOPTIONS 21 + +/* options set using PTRACE_SETOPTIONS */ +#define PTRACE_O_TRACESYSGOOD 0x00000001 + +#ifdef __KERNEL__ +#if defined(CONFIG_ISA_M32R2) || defined(CONFIG_CHIP_VDEC2) +#define user_mode(regs) ((M32R_PSW_BPM & (regs)->psw) != 0) +#elif defined(CONFIG_ISA_M32R) +#define user_mode(regs) ((M32R_PSW_BSM & (regs)->psw) != 0) +#else +#error unknown isa configuration +#endif + +#define instruction_pointer(regs) ((regs)->bpc) +#define profile_pc(regs) instruction_pointer(regs) + +extern void show_regs(struct pt_regs *); + +extern void withdraw_debug_trap(struct pt_regs *regs); + +#endif /* __KERNEL */ + +#endif /* _ASM_M32R_PTRACE_H */ diff -Nru a/include/asm-m32r/resource.h b/include/asm-m32r/resource.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/resource.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,55 @@ +#ifndef _ASM_M32R_RESOURCE_H +#define _ASM_M32R_RESOURCE_H + +/* $Id$ */ + +/* orig : i386 2.4.18 */ + +/* + * Resource limits + */ + +#define RLIMIT_CPU 0 /* CPU time in ms */ +#define RLIMIT_FSIZE 1 /* Maximum filesize */ +#define RLIMIT_DATA 2 /* max data size */ +#define RLIMIT_STACK 3 /* max stack size */ +#define RLIMIT_CORE 4 /* max core file size */ +#define RLIMIT_RSS 5 /* max resident set size */ +#define RLIMIT_NPROC 6 /* max number of processes */ +#define RLIMIT_NOFILE 7 /* max number of open files */ +#define RLIMIT_MEMLOCK 8 /* max locked-in-memory address space */ +#define RLIMIT_AS 9 /* address space limit */ +#define RLIMIT_LOCKS 10 /* maximum file locks held */ +#define RLIMIT_SIGPENDING 11 /* max number of pending signals */ +#define RLIMIT_MSGQUEUE 12 /* maximum bytes in POSIX mqueues */ + +#define RLIM_NLIMITS 13 + +/* + * SuS says limits have to be unsigned. + * Which makes a ton more sense anyway. + */ +#define RLIM_INFINITY (~0UL) + +#ifdef __KERNEL__ + +#define INIT_RLIMITS \ +{ \ + { RLIM_INFINITY, RLIM_INFINITY }, \ + { RLIM_INFINITY, RLIM_INFINITY }, \ + { RLIM_INFINITY, RLIM_INFINITY }, \ + { _STK_LIM, RLIM_INFINITY }, \ + { 0, RLIM_INFINITY }, \ + { RLIM_INFINITY, RLIM_INFINITY }, \ + { 0, 0 }, \ + { INR_OPEN, INR_OPEN }, \ + { MLOCK_LIMIT, MLOCK_LIMIT }, \ + { RLIM_INFINITY, RLIM_INFINITY }, \ + { RLIM_INFINITY, RLIM_INFINITY }, \ + { MAX_SIGPENDING, MAX_SIGPENDING }, \ + { MQ_BYTES_MAX, MQ_BYTES_MAX }, \ +} + +#endif /* __KERNEL__ */ + +#endif /* _ASM_M32R_RESOURCE_H */ diff -Nru a/include/asm-m32r/rtc.h b/include/asm-m32r/rtc.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/rtc.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,70 @@ +/* $Id: rtc.h,v 1.1.1.1 2004/03/25 04:29:22 hitoshiy Exp $ */ + +#ifndef __RTC_H__ +#define __RTC_H__ + + +#include + + /* Dallas DS1302 clock/calendar register numbers. */ +# define RTC_SECONDS 0 +# define RTC_MINUTES 1 +# define RTC_HOURS 2 +# define RTC_DAY_OF_MONTH 3 +# define RTC_MONTH 4 +# define RTC_WEEKDAY 5 +# define RTC_YEAR 6 +# define RTC_CONTROL 7 + + /* Bits in CONTROL register. */ +# define RTC_CONTROL_WRITEPROTECT 0x80 +# define RTC_TRICKLECHARGER 8 + + /* Bits in TRICKLECHARGER register TCS TCS TCS TCS DS DS RS RS. */ +# define RTC_TCR_PATTERN 0xA0 /* 1010xxxx */ +# define RTC_TCR_1DIOD 0x04 /* xxxx01xx */ +# define RTC_TCR_2DIOD 0x08 /* xxxx10xx */ +# define RTC_TCR_DISABLED 0x00 /* xxxxxx00 Disabled */ +# define RTC_TCR_2KOHM 0x01 /* xxxxxx01 2KOhm */ +# define RTC_TCR_4KOHM 0x02 /* xxxxxx10 4kOhm */ +# define RTC_TCR_8KOHM 0x03 /* xxxxxx11 8kOhm */ + +#ifdef CONFIG_M32700UT_DS1302 +extern unsigned char ds1302_readreg(int reg); +extern void ds1302_writereg(int reg, unsigned char val); +extern int ds1302_init(void); +# define CMOS_READ(x) ds1302_readreg(x) +# define CMOS_WRITE(val,reg) ds1302_writereg(reg,val) +# define RTC_INIT() ds1302_init() +#else + /* No RTC configured so we shouldn't try to access any. */ +# define CMOS_READ(x) 42 +# define CMOS_WRITE(x,y) +# define RTC_INIT() (-1) +#endif + +/* + * The struct used to pass data via the following ioctl. Similar to the + * struct tm in , but it needs to be here so that the kernel + * source is self contained, allowing cross-compiles, etc. etc. + */ +struct rtc_time { + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; +}; + +/* ioctl() calls that are permitted to the /dev/rtc interface. */ +#define RTC_MAGIC 'p' +#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 + +#endif /* __RTC_H__ */ diff -Nru a/include/asm-m32r/scatterlist.h b/include/asm-m32r/scatterlist.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/scatterlist.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,18 @@ +#ifndef _ASM_M32R_SCATTERLIST_H +#define _ASM_M32R_SCATTERLIST_H + +/* $Id$ */ + +struct scatterlist { + char * address; /* Location data is to be transferred to, NULL for + * highmem page */ + struct page * page; /* Location for highmem page, if any */ + unsigned int offset;/* for highmem, page offset */ + + dma_addr_t dma_address; + unsigned int length; +}; + +#define ISA_DMA_THRESHOLD (0x1fffffff) + +#endif /* _ASM_M32R_SCATTERLIST_H */ diff -Nru a/include/asm-m32r/sections.h b/include/asm-m32r/sections.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/sections.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,8 @@ +#ifndef _M32R_SECTIONS_H +#define _M32R_SECTIONS_H + +/* nothing to see, move along */ +#include + +#endif /* _M32R_SECTIONS_H */ + diff -Nru a/include/asm-m32r/segment.h b/include/asm-m32r/segment.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/segment.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,14 @@ +#ifndef _ASM_M32R_SEGMENT_H +#define _ASM_M32R_SEGMENT_H + +/* $Id$ */ + +/* orig : i386 (2.4.18) */ + +#define __KERNEL_CS 0x10 +#define __KERNEL_DS 0x18 + +#define __USER_CS 0x23 +#define __USER_DS 0x2B + +#endif /* _ASM_M32R_SEGMENT_H */ diff -Nru a/include/asm-m32r/semaphore.h b/include/asm-m32r/semaphore.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/semaphore.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,266 @@ +#ifndef _ASM_M32R_SEMAPHORE_H +#define _ASM_M32R_SEMAPHORE_H + +/* $Id$ */ + +#include + +#ifdef __KERNEL__ + +/* + * SMP- and interrupt-safe semaphores.. + * + * (C) Copyright 1996 Linus Torvalds + * + * Modified 1996-12-23 by Dave Grothe to fix bugs in + * the original code and to make semaphore waits + * interruptible so that processes waiting on + * semaphores can be killed. + * Modified 1999-02-14 by Andrea Arcangeli, split the sched.c helper + * functions in asm/sempahore-helper.h while fixing a + * potential and subtle race discovered by Ulrich Schmid + * in down_interruptible(). Since I started to play here I + * also implemented the `trylock' semaphore operation. + * 1999-07-02 Artur Skawina + * Optimized "0(ecx)" -> "(ecx)" (the assembler does not + * do this). Changed calling sequences from push/jmp to + * traditional call/ret. + * Modified 2001-01-01 Andreas Franck + * Some hacks to ensure compatibility with recent + * GCC snapshots, to avoid stack corruption when compiling + * with -fomit-frame-pointer. It's not sure if this will + * be fixed in GCC, as our previous implementation was a + * bit dubious. + * + * If you would like to see an analysis of this implementation, please + * ftp to gcom.com and download the file + * /pub/linux/src/semaphore/semaphore-2.0.24.tar.gz. + * + */ + +#include +#include +#include +#include +#include + +#undef LOAD +#undef STORE +#ifdef CONFIG_SMP +#define LOAD "lock" +#define STORE "unlock" +#else +#define LOAD "ld" +#define STORE "st" +#endif + +struct semaphore { + atomic_t count; + int sleepers; + wait_queue_head_t wait; +#ifdef WAITQUEUE_DEBUG + long __magic; +#endif +}; + +#ifdef WAITQUEUE_DEBUG +# define __SEM_DEBUG_INIT(name) \ + , (int)&(name).__magic +#else +# define __SEM_DEBUG_INIT(name) +#endif + +#define __SEMAPHORE_INITIALIZER(name,count) \ +{ ATOMIC_INIT(count), 0, __WAIT_QUEUE_HEAD_INITIALIZER((name).wait) \ + __SEM_DEBUG_INIT(name) } + +#define __MUTEX_INITIALIZER(name) \ + __SEMAPHORE_INITIALIZER(name,1) + +#define __DECLARE_SEMAPHORE_GENERIC(name,count) \ + struct semaphore name = __SEMAPHORE_INITIALIZER(name,count) + +#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1) +#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0) + +static __inline__ void sema_init (struct semaphore *sem, int val) +{ +/* + * *sem = (struct semaphore)__SEMAPHORE_INITIALIZER((*sem),val); + * + * i'd rather use the more flexible initialization above, but sadly + * GCC 2.7.2.3 emits a bogus warning. EGCS doesnt. Oh well. + */ + atomic_set(&sem->count, val); + sem->sleepers = 0; + init_waitqueue_head(&sem->wait); +#ifdef WAITQUEUE_DEBUG + sem->__magic = (int)&sem->__magic; +#endif +} + +static __inline__ void init_MUTEX (struct semaphore *sem) +{ + sema_init(sem, 1); +} + +static __inline__ void init_MUTEX_LOCKED (struct semaphore *sem) +{ + sema_init(sem, 0); +} + +asmlinkage void __down_failed(void /* special register calling convention */); +asmlinkage int __down_failed_interruptible(void /* params in registers */); +asmlinkage int __down_failed_trylock(void /* params in registers */); +asmlinkage void __up_wakeup(void /* special register calling convention */); + +asmlinkage void __down(struct semaphore * sem); +asmlinkage int __down_interruptible(struct semaphore * sem); +asmlinkage int __down_trylock(struct semaphore * sem); +asmlinkage void __up(struct semaphore * sem); + +/* + * This is ugly, but we want the default case to fall through. + * "__down_failed" is a special asm handler that calls the C + * routine that actually waits. See arch/i386/kernel/semaphore.c + */ +static __inline__ void down(struct semaphore * sem) +{ + unsigned long flags; + int temp; + +#ifdef WAITQUEUE_DEBUG + CHECK_MAGIC(sem->__magic); +#endif + + local_irq_save(flags); + __asm__ __volatile__ ( + "# down \n\t" + DCACHE_CLEAR("%0", "r4", "%1") + LOAD" %0, @%1; \n\t" + "addi %0, #-1; \n\t" + STORE" %0, @%1; \n\t" + : "=&r" (temp) + : "r" (&sem->count) + : "memory" +#ifdef CONFIG_CHIP_M32700_TS1 + , "r4" +#endif /* CONFIG_CHIP_M32700_TS1 */ + ); + local_irq_restore(flags); + + if (temp < 0) + __down(sem); +} + +/* + * Interruptible try to acquire a semaphore. If we obtained + * it, return zero. If we were interrupted, returns -EINTR + */ +static __inline__ int down_interruptible(struct semaphore * sem) +{ + unsigned long flags; + int temp; + int result = 0; + +#ifdef WAITQUEUE_DEBUG + CHECK_MAGIC(sem->__magic); +#endif + + local_irq_save(flags); + __asm__ __volatile__ ( + "# down_interruptible \n\t" + DCACHE_CLEAR("%0", "r4", "%1") + LOAD" %0, @%1; \n\t" + "addi %0, #-1; \n\t" + STORE" %0, @%1; \n\t" + : "=&r" (temp) + : "r" (&sem->count) + : "memory" +#ifdef CONFIG_CHIP_M32700_TS1 + , "r4" +#endif /* CONFIG_CHIP_M32700_TS1 */ + ); + local_irq_restore(flags); + + if (temp < 0) + result = __down_interruptible(sem); + + return result; +} + +/* + * Non-blockingly attempt to down() a semaphore. + * Returns zero if we acquired it + */ +static __inline__ int down_trylock(struct semaphore * sem) +{ + unsigned long flags; + int temp; + int result = 0; + +#ifdef WAITQUEUE_DEBUG + CHECK_MAGIC(sem->__magic); +#endif + + local_irq_save(flags); + __asm__ __volatile__ ( + "# down_trylock \n\t" + DCACHE_CLEAR("%0", "r4", "%1") + LOAD" %0, @%1; \n\t" + "addi %0, #-1; \n\t" + STORE" %0, @%1; \n\t" + : "=&r" (temp) + : "r" (&sem->count) + : "memory" +#ifdef CONFIG_CHIP_M32700_TS1 + , "r4" +#endif /* CONFIG_CHIP_M32700_TS1 */ + ); + local_irq_restore(flags); + + if (temp < 0) + result = __down_trylock(sem); + + return result; +} + +/* + * Note! This is subtle. We jump to wake people up only if + * the semaphore was negative (== somebody was waiting on it). + * The default case (no contention) will result in NO + * jumps for both down() and up(). + */ +static __inline__ void up(struct semaphore * sem) +{ + unsigned long flags; + int temp; + +#ifdef WAITQUEUE_DEBUG + CHECK_MAGIC(sem->__magic); +#endif + + local_irq_save(flags); + __asm__ __volatile__ ( + "# up \n\t" + DCACHE_CLEAR("%0", "r4", "%1") + LOAD" %0, @%1; \n\t" + "addi %0, #1; \n\t" + STORE" %0, @%1; \n\t" + : "=&r" (temp) + : "r" (&sem->count) + : "memory" +#ifdef CONFIG_CHIP_M32700_TS1 + , "r4" +#endif /* CONFIG_CHIP_M32700_TS1 */ + ); + local_irq_restore(flags); + + if (temp <= 0) + __up(sem); +} + +#endif /* __KERNEL__ */ + +#endif /* _ASM_M32R_SEMAPHORE_H */ + diff -Nru a/include/asm-m32r/sembuf.h b/include/asm-m32r/sembuf.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/sembuf.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,29 @@ +#ifndef _ASM_M32R_SEMBUF_H +#define _ASM_M32R_SEMBUF_H + +/* $Id$ */ + +/* orig : i386 2.4.18 */ + +/* + * The semid64_ds structure for m32r architecture. + * Note extra padding because this structure is passed back and forth + * between kernel and user space. + * + * Pad space is left for: + * - 64-bit time_t to solve y2038 problem + * - 2 miscellaneous 32-bit values + */ + +struct semid64_ds { + struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ + __kernel_time_t sem_otime; /* last semop time */ + unsigned long __unused1; + __kernel_time_t sem_ctime; /* last change time */ + unsigned long __unused2; + unsigned long sem_nsems; /* no. of semaphores in array */ + unsigned long __unused3; + unsigned long __unused4; +}; + +#endif /* _ASM_M32R_SEMBUF_H */ diff -Nru a/include/asm-m32r/serial.h b/include/asm-m32r/serial.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/serial.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,151 @@ +#ifndef _ASM_M32R_SERIAL_H +#define _ASM_M32R_SERIAL_H + +/* $Id$ */ + +/* orig : i386 2.4.18 */ + +/* + * include/asm-m32r/serial.h + */ + +#include +#include + +/* + * This assumes you have a 1.8432 MHz clock for your UART. + * + * It'd be nice if someone built a serial card with a 24.576 MHz + * clock, since the 16550A is capable of handling a top speed of 1.5 + * megabits/second; but this requires the faster clock. + */ +#define BASE_BAUD ( 1843200 / 16 ) + +/* Standard COM flags (except for COM4, because of the 8514 problem) */ +#ifdef CONFIG_SERIAL_DETECT_IRQ +#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ) +#define STD_COM4_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_AUTO_IRQ) +#else +#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST) +#define STD_COM4_FLAGS ASYNC_BOOT_AUTOCONF +#endif + +#ifdef CONFIG_SERIAL_MANY_PORTS +#define FOURPORT_FLAGS ASYNC_FOURPORT +#define ACCENT_FLAGS 0 +#define BOCA_FLAGS 0 +#define HUB6_FLAGS 0 +#define RS_TABLE_SIZE 64 +#else +#define RS_TABLE_SIZE +#endif + +#define MCA_COM_FLAGS (STD_COM_FLAGS|ASYNC_BOOT_ONLYMCA) + +/* + * The following define the access methods for the HUB6 card. All + * access is through two ports for all 24 possible chips. The card is + * selected through the high 2 bits, the port on that card with the + * "middle" 3 bits, and the register on that port with the bottom + * 3 bits. + * + * While the access port and interrupt is configurable, the default + * port locations are 0x302 for the port control register, and 0x303 + * for the data read/write register. Normally, the interrupt is at irq3 + * but can be anything from 3 to 7 inclusive. Note that using 3 will + * require disabling com2. + */ + +#define C_P(card,port) (((card)<<6|(port)<<3) + 1) + +#define STD_SERIAL_PORT_DEFNS \ + /* UART CLK PORT IRQ FLAGS */ \ + { 0, BASE_BAUD, 0x3F8, 4, STD_COM_FLAGS }, /* ttyS0 */ \ + { 0, BASE_BAUD, 0x2F8, 3, STD_COM_FLAGS }, /* ttyS1 */ \ + { 0, BASE_BAUD, 0x3E8, 4, STD_COM_FLAGS }, /* ttyS2 */ \ + { 0, BASE_BAUD, 0x2E8, 3, STD_COM4_FLAGS }, /* ttyS3 */ + + +#ifdef CONFIG_SERIAL_MANY_PORTS +#define EXTRA_SERIAL_PORT_DEFNS \ + { 0, BASE_BAUD, 0x1A0, 9, FOURPORT_FLAGS }, /* ttyS4 */ \ + { 0, BASE_BAUD, 0x1A8, 9, FOURPORT_FLAGS }, /* ttyS5 */ \ + { 0, BASE_BAUD, 0x1B0, 9, FOURPORT_FLAGS }, /* ttyS6 */ \ + { 0, BASE_BAUD, 0x1B8, 9, FOURPORT_FLAGS }, /* ttyS7 */ \ + { 0, BASE_BAUD, 0x2A0, 5, FOURPORT_FLAGS }, /* ttyS8 */ \ + { 0, BASE_BAUD, 0x2A8, 5, FOURPORT_FLAGS }, /* ttyS9 */ \ + { 0, BASE_BAUD, 0x2B0, 5, FOURPORT_FLAGS }, /* ttyS10 */ \ + { 0, BASE_BAUD, 0x2B8, 5, FOURPORT_FLAGS }, /* ttyS11 */ \ + { 0, BASE_BAUD, 0x330, 4, ACCENT_FLAGS }, /* ttyS12 */ \ + { 0, BASE_BAUD, 0x338, 4, ACCENT_FLAGS }, /* ttyS13 */ \ + { 0, BASE_BAUD, 0x000, 0, 0 }, /* ttyS14 (spare) */ \ + { 0, BASE_BAUD, 0x000, 0, 0 }, /* ttyS15 (spare) */ \ + { 0, BASE_BAUD, 0x100, 12, BOCA_FLAGS }, /* ttyS16 */ \ + { 0, BASE_BAUD, 0x108, 12, BOCA_FLAGS }, /* ttyS17 */ \ + { 0, BASE_BAUD, 0x110, 12, BOCA_FLAGS }, /* ttyS18 */ \ + { 0, BASE_BAUD, 0x118, 12, BOCA_FLAGS }, /* ttyS19 */ \ + { 0, BASE_BAUD, 0x120, 12, BOCA_FLAGS }, /* ttyS20 */ \ + { 0, BASE_BAUD, 0x128, 12, BOCA_FLAGS }, /* ttyS21 */ \ + { 0, BASE_BAUD, 0x130, 12, BOCA_FLAGS }, /* ttyS22 */ \ + { 0, BASE_BAUD, 0x138, 12, BOCA_FLAGS }, /* ttyS23 */ \ + { 0, BASE_BAUD, 0x140, 12, BOCA_FLAGS }, /* ttyS24 */ \ + { 0, BASE_BAUD, 0x148, 12, BOCA_FLAGS }, /* ttyS25 */ \ + { 0, BASE_BAUD, 0x150, 12, BOCA_FLAGS }, /* ttyS26 */ \ + { 0, BASE_BAUD, 0x158, 12, BOCA_FLAGS }, /* ttyS27 */ \ + { 0, BASE_BAUD, 0x160, 12, BOCA_FLAGS }, /* ttyS28 */ \ + { 0, BASE_BAUD, 0x168, 12, BOCA_FLAGS }, /* ttyS29 */ \ + { 0, BASE_BAUD, 0x170, 12, BOCA_FLAGS }, /* ttyS30 */ \ + { 0, BASE_BAUD, 0x178, 12, BOCA_FLAGS }, /* ttyS31 */ +#else +#define EXTRA_SERIAL_PORT_DEFNS +#endif + +/* You can have up to four HUB6's in the system, but I've only + * included two cards here for a total of twelve ports. + */ +#if (defined(CONFIG_HUB6) && defined(CONFIG_SERIAL_MANY_PORTS)) +#define HUB6_SERIAL_PORT_DFNS \ + { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,0) }, /* ttyS32 */ \ + { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,1) }, /* ttyS33 */ \ + { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,2) }, /* ttyS34 */ \ + { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,3) }, /* ttyS35 */ \ + { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,4) }, /* ttyS36 */ \ + { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,5) }, /* ttyS37 */ \ + { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,0) }, /* ttyS38 */ \ + { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,1) }, /* ttyS39 */ \ + { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,2) }, /* ttyS40 */ \ + { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,3) }, /* ttyS41 */ \ + { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,4) }, /* ttyS42 */ \ + { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,5) }, /* ttyS43 */ +#else +#define HUB6_SERIAL_PORT_DFNS +#endif + +#ifdef CONFIG_MCA +#define MCA_SERIAL_PORT_DFNS \ + { 0, BASE_BAUD, 0x3220, 3, MCA_COM_FLAGS }, \ + { 0, BASE_BAUD, 0x3228, 3, MCA_COM_FLAGS }, \ + { 0, BASE_BAUD, 0x4220, 3, MCA_COM_FLAGS }, \ + { 0, BASE_BAUD, 0x4228, 3, MCA_COM_FLAGS }, \ + { 0, BASE_BAUD, 0x5220, 3, MCA_COM_FLAGS }, \ + { 0, BASE_BAUD, 0x5228, 3, MCA_COM_FLAGS }, +#else +#define MCA_SERIAL_PORT_DFNS +#endif + +#ifndef CONFIG_PLAT_USRV +#define SERIAL_PORT_DFNS \ + STD_SERIAL_PORT_DEFNS \ + EXTRA_SERIAL_PORT_DEFNS \ + HUB6_SERIAL_PORT_DFNS \ + MCA_SERIAL_PORT_DFNS + +#else /* CONFIG_PLAT_USRV */ + +#define SERIAL_PORT_DFNS \ + /* UART CLK PORT IRQ FLAGS */ \ + { 0, BASE_BAUD, 0x3F8, PLD_IRQ_UART0, STD_COM_FLAGS }, /* ttyS0 */ \ + { 0, BASE_BAUD, 0x2F8, PLD_IRQ_UART1, STD_COM_FLAGS }, /* ttyS1 */ +#endif /* CONFIG_PLAT_USRV */ + +#endif /* _ASM_M32R_SERIAL_H */ diff -Nru a/include/asm-m32r/setup.h b/include/asm-m32r/setup.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/setup.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,33 @@ +/* + * This is set up by the setup-routine at boot-time + */ +#define PARAM ((unsigned char *)empty_zero_page) + +#define MOUNT_ROOT_RDONLY (*(unsigned long *) (PARAM+0x000)) +#define RAMDISK_FLAGS (*(unsigned long *) (PARAM+0x004)) +#define ORIG_ROOT_DEV (*(unsigned long *) (PARAM+0x008)) +#define LOADER_TYPE (*(unsigned long *) (PARAM+0x00c)) +#define INITRD_START (*(unsigned long *) (PARAM+0x010)) +#define INITRD_SIZE (*(unsigned long *) (PARAM+0x014)) + +#define M32R_CPUCLK (*(unsigned long *) (PARAM+0x018)) +#define M32R_BUSCLK (*(unsigned long *) (PARAM+0x01c)) +#define M32R_TIMER_DIVIDE (*(unsigned long *) (PARAM+0x020)) + +#define COMMAND_LINE ((char *) (PARAM+0x100)) + +#define SCREEN_INFO (*(struct screen_info *) (PARAM+0x200)) + +#define COMMAND_LINE_SIZE (512) + +#define RAMDISK_IMAGE_START_MASK (0x07FF) +#define RAMDISK_PROMPT_FLAG (0x8000) +#define RAMDISK_LOAD_FLAG (0x4000) + +#define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT) +#define PFN_DOWN(x) ((x) >> PAGE_SHIFT) +#define PFN_PHYS(x) ((x) << PAGE_SHIFT) + +extern unsigned long memory_start; +extern unsigned long memory_end; + diff -Nru a/include/asm-m32r/shmbuf.h b/include/asm-m32r/shmbuf.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/shmbuf.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,46 @@ +#ifndef _ASM_M32R_SHMBUF_H +#define _ASM_M32R_SHMBUF_H + +/* $Id$ */ + +/* orig : i386 2.4.18 */ + +/* + * The shmid64_ds structure for M32R architecture. + * Note extra padding because this structure is passed back and forth + * between kernel and user space. + * + * Pad space is left for: + * - 64-bit time_t to solve y2038 problem + * - 2 miscellaneous 32-bit values + */ + +struct shmid64_ds { + struct ipc64_perm shm_perm; /* operation perms */ + size_t shm_segsz; /* size of segment (bytes) */ + __kernel_time_t shm_atime; /* last attach time */ + unsigned long __unused1; + __kernel_time_t shm_dtime; /* last detach time */ + unsigned long __unused2; + __kernel_time_t shm_ctime; /* last change time */ + unsigned long __unused3; + __kernel_pid_t shm_cpid; /* pid of creator */ + __kernel_pid_t shm_lpid; /* pid of last operator */ + unsigned long shm_nattch; /* no. of current attaches */ + unsigned long __unused4; + unsigned long __unused5; +}; + +struct shminfo64 { + unsigned long shmmax; + unsigned long shmmin; + unsigned long shmmni; + unsigned long shmseg; + unsigned long shmall; + unsigned long __unused1; + unsigned long __unused2; + unsigned long __unused3; + unsigned long __unused4; +}; + +#endif /* _ASM_M32R_SHMBUF_H */ diff -Nru a/include/asm-m32r/shmparam.h b/include/asm-m32r/shmparam.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/shmparam.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,8 @@ +#ifndef _ASM_M32R_SHMPARAM_H +#define _ASM_M32R_SHMPARAM_H + +/* $Id$ */ + +#define SHMLBA PAGE_SIZE /* attach addr a multiple of this */ + +#endif /* _ASM_M32R_SHMPARAM_H */ diff -Nru a/include/asm-m32r/sigcontext.h b/include/asm-m32r/sigcontext.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/sigcontext.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,50 @@ +#ifndef _ASM_M32R_SIGCONTEXT_H +#define _ASM_M32R_SIGCONTEXT_H + +/* $Id$ */ + +#include + +struct sigcontext { + /* CPU registers */ + /* Saved main processor registers. */ + unsigned long sc_r4; + unsigned long sc_r5; + unsigned long sc_r6; + struct pt_regs *sc_pt_regs; + unsigned long sc_r0; + unsigned long sc_r1; + unsigned long sc_r2; + unsigned long sc_r3; + unsigned long sc_r7; + unsigned long sc_r8; + unsigned long sc_r9; + unsigned long sc_r10; + unsigned long sc_r11; + unsigned long sc_r12; + + /* Saved main processor status and miscellaneous context registers. */ +#if defined(CONFIG_ISA_M32R2) && defined(CONFIG_ISA_DSP_LEVEL2) + unsigned long sc_acc0h; + unsigned long sc_acc0l; + unsigned long sc_acc1h; + unsigned long sc_acc1l; +#elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R) + unsigned long sc_acch; + unsigned long sc_accl; +#else +#error unknown isa configuration +#endif + unsigned long sc_psw; + unsigned long sc_bpc; /* saved PC for TRAP syscalls */ + unsigned long sc_bbpsw; + unsigned long sc_bbpc; + unsigned long sc_spu; /* saved user stack */ + unsigned long sc_fp; + unsigned long sc_lr; /* saved PC for JL syscalls */ + unsigned long sc_spi; /* saved kernel stack */ + + unsigned long oldmask; +}; + +#endif /* _ASM_M32R_SIGCONTEXT_H */ diff -Nru a/include/asm-m32r/siginfo.h b/include/asm-m32r/siginfo.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/siginfo.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,8 @@ +#ifndef _M32R_SIGINFO_H +#define _M32R_SIGINFO_H + +/* $Id$ */ + +#include + +#endif /* _M32R_SIGINFO_H */ diff -Nru a/include/asm-m32r/signal.h b/include/asm-m32r/signal.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/signal.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,200 @@ +#ifndef _ASM_M32R_SIGNAL_H +#define _ASM_M32R_SIGNAL_H + +/* $Id$ */ + +/* orig : i386 2.4.18 */ + +#include +#include +#include +#include + +/* Avoid too many header ordering problems. */ +struct siginfo; + +#ifdef __KERNEL__ +/* Most things should be clean enough to redefine this at will, if care + is taken to make libc match. */ + +#define _NSIG 64 +#define _NSIG_BPW 32 +#define _NSIG_WORDS (_NSIG / _NSIG_BPW) + +typedef unsigned long old_sigset_t; /* at least 32 bits */ + +typedef struct { + unsigned long sig[_NSIG_WORDS]; +} sigset_t; + +#else +/* Here we must cater to libcs that poke about in kernel headers. */ + +#define NSIG 32 +typedef unsigned long sigset_t; + +#endif /* __KERNEL__ */ + +#define SIGHUP 1 +#define SIGINT 2 +#define SIGQUIT 3 +#define SIGILL 4 +#define SIGTRAP 5 +#define SIGABRT 6 +#define SIGIOT 6 +#define SIGBUS 7 +#define SIGFPE 8 +#define SIGKILL 9 +#define SIGUSR1 10 +#define SIGSEGV 11 +#define SIGUSR2 12 +#define SIGPIPE 13 +#define SIGALRM 14 +#define SIGTERM 15 +#define SIGSTKFLT 16 +#define SIGCHLD 17 +#define SIGCONT 18 +#define SIGSTOP 19 +#define SIGTSTP 20 +#define SIGTTIN 21 +#define SIGTTOU 22 +#define SIGURG 23 +#define SIGXCPU 24 +#define SIGXFSZ 25 +#define SIGVTALRM 26 +#define SIGPROF 27 +#define SIGWINCH 28 +#define SIGIO 29 +#define SIGPOLL SIGIO +/* +#define SIGLOST 29 +*/ +#define SIGPWR 30 +#define SIGSYS 31 +#define SIGUNUSED 31 + +/* These should not be considered constants from userland. */ +#define SIGRTMIN 32 +#define SIGRTMAX _NSIG + +/* + * SA_FLAGS values: + * + * SA_ONSTACK indicates that a registered stack_t will be used. + * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the + * SA_RESTART flag to get restarting signals (which were the default long ago) + * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. + * SA_RESETHAND clears the handler when the signal is delivered. + * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies. + * SA_NODEFER prevents the current signal from being masked in the handler. + * + * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single + * Unix names RESETHAND and NODEFER respectively. + */ +#define SA_NOCLDSTOP 0x00000001u +#define SA_NOCLDWAIT 0x00000002u +#define SA_SIGINFO 0x00000004u +#define SA_ONSTACK 0x08000000u +#define SA_RESTART 0x10000000u +#define SA_NODEFER 0x40000000u +#define SA_RESETHAND 0x80000000u + +#define SA_NOMASK SA_NODEFER +#define SA_ONESHOT SA_RESETHAND +#define SA_INTERRUPT 0x20000000 /* dummy -- ignored */ + +#define SA_RESTORER 0x04000000 + +/* + * sigaltstack controls + */ +#define SS_ONSTACK 1 +#define SS_DISABLE 2 + +#define MINSIGSTKSZ 2048 +#define SIGSTKSZ 8192 + +#ifdef __KERNEL__ + +/* + * These values of sa_flags are used only by the kernel as part of the + * irq handling routines. + * + * SA_INTERRUPT is also used by the irq handling routines. + * SA_SHIRQ is for shared interrupt support on PCI and EISA. + */ +#define SA_PROBE SA_ONESHOT +#define SA_SAMPLE_RANDOM SA_RESTART +#define SA_SHIRQ 0x04000000 +#endif + +#define SIG_BLOCK 0 /* for blocking signals */ +#define SIG_UNBLOCK 1 /* for unblocking signals */ +#define SIG_SETMASK 2 /* for setting the signal mask */ + +/* Type of a signal handler. */ +typedef void __signalfn_t(int); +typedef __signalfn_t __user *__sighandler_t; + +typedef void __restorefn_t(void); +typedef __restorefn_t __user *__sigrestore_t; + +#define SIG_DFL ((__sighandler_t)0) /* default signal handling */ +#define SIG_IGN ((__sighandler_t)1) /* ignore signal */ +#define SIG_ERR ((__sighandler_t)-1) /* error return from signal */ + +#ifdef __KERNEL__ +struct old_sigaction { + __sighandler_t sa_handler; + old_sigset_t sa_mask; + unsigned long sa_flags; + __sigrestore_t sa_restorer; +}; + +struct sigaction { + __sighandler_t sa_handler; + unsigned long sa_flags; + __sigrestore_t sa_restorer; + sigset_t sa_mask; /* mask last for extensibility */ +}; + +struct k_sigaction { + struct sigaction sa; +}; +#else +/* Here we must cater to libcs that poke about in kernel headers. */ + +struct sigaction { + union { + __sighandler_t _sa_handler; + void (*_sa_sigaction)(int, struct siginfo *, void *); + } _u; + sigset_t sa_mask; + unsigned long sa_flags; + void (*sa_restorer)(void); +}; + +#define sa_handler _u._sa_handler +#define sa_sigaction _u._sa_sigaction + +#endif /* __KERNEL__ */ + +typedef struct sigaltstack { + void __user *ss_sp; + int ss_flags; + size_t ss_size; +} stack_t; + +#ifdef __KERNEL__ +#include + +#undef __HAVE_ARCH_SIG_BITOPS + +struct pt_regs; +extern int FASTCALL(do_signal(struct pt_regs *regs, sigset_t *oldset)); + +#define ptrace_signal_deliver(regs, cookie) do { } while (0) + +#endif /* __KERNEL__ */ + +#endif /* _ASM_M32R_SIGNAL_H */ diff -Nru a/include/asm-m32r/smp.h b/include/asm-m32r/smp.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/smp.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,119 @@ +#ifndef _ASM_M32R_SMP_H +#define _ASM_M32R_SMP_H + +/* $Id$ */ + +#include + +#ifdef CONFIG_SMP +#ifndef __ASSEMBLY__ + +#include +#include +#include +#include + +#define PHYSID_ARRAY_SIZE 1 + +struct physid_mask +{ + unsigned long mask[PHYSID_ARRAY_SIZE]; +}; + +typedef struct physid_mask physid_mask_t; + +#define physid_set(physid, map) set_bit(physid, (map).mask) +#define physid_clear(physid, map) clear_bit(physid, (map).mask) +#define physid_isset(physid, map) test_bit(physid, (map).mask) +#define physid_test_and_set(physid, map) test_and_set_bit(physid, (map).mask) + +#define physids_and(dst, src1, src2) bitmap_and((dst).mask, (src1).mask, (src2).mask, MAX_APICS) +#define physids_or(dst, src1, src2) bitmap_or((dst).mask, (src1).mask, (src2).mask, MAX_APICS) +#define physids_clear(map) bitmap_zero((map).mask, MAX_APICS) +#define physids_complement(dst, src) bitmap_complement((dst).mask,(src).mask, MAX_APICS) +#define physids_empty(map) bitmap_empty((map).mask, MAX_APICS) +#define physids_equal(map1, map2) bitmap_equal((map1).mask, (map2).mask, MAX_APICS) +#define physids_weight(map) bitmap_weight((map).mask, MAX_APICS) +#define physids_shift_right(d, s, n) bitmap_shift_right((d).mask, (s).mask, n, MAX_APICS) +#define physids_shift_left(d, s, n) bitmap_shift_left((d).mask, (s).mask, n, MAX_APICS) +#define physids_coerce(map) ((map).mask[0]) + +#define physids_promote(physids) \ + ({ \ + physid_mask_t __physid_mask = PHYSID_MASK_NONE; \ + __physid_mask.mask[0] = physids; \ + __physid_mask; \ + }) + +#define physid_mask_of_physid(physid) \ + ({ \ + physid_mask_t __physid_mask = PHYSID_MASK_NONE; \ + physid_set(physid, __physid_mask); \ + __physid_mask; \ + }) + +#define PHYSID_MASK_ALL { {[0 ... PHYSID_ARRAY_SIZE-1] = ~0UL} } +#define PHYSID_MASK_NONE { {[0 ... PHYSID_ARRAY_SIZE-1] = 0UL} } + +extern physid_mask_t phys_cpu_present_map; + +/* + * Some lowlevel functions might want to know about + * the real CPU ID <-> CPU # mapping. + */ +extern volatile int physid_2_cpu[NR_CPUS]; +extern volatile int cpu_2_physid[NR_CPUS]; +#define physid_to_cpu(physid) physid_2_cpu[physid] +#define cpu_to_physid(cpu_id) cpu_2_physid[cpu_id] + +#define smp_processor_id() (current_thread_info()->cpu) + +extern cpumask_t cpu_callout_map; +#define cpu_possible_map cpu_callout_map + +static __inline__ int hard_smp_processor_id(void) +{ + return (int)*(volatile long *)M32R_CPUID_PORTL; +} + +static __inline__ int cpu_logical_map(int cpu) +{ + return cpu; +} + +static __inline__ int cpu_number_map(int cpu) +{ + return cpu; +} + +static __inline__ unsigned int num_booting_cpus(void) +{ + return cpus_weight(cpu_callout_map); +} + +extern void smp_send_timer(void); +extern void calibrate_delay(void); +extern unsigned long send_IPI_mask_phys(cpumask_t, int, int); + +#endif /* not __ASSEMBLY__ */ + +#define NO_PROC_ID (0xff) /* No processor magic marker */ + +#define PROC_CHANGE_PENALTY (15) /* Schedule penalty */ + +/* + * M32R-mp IPI + */ +#define RESCHEDULE_IPI (M32R_IRQ_IPI0-M32R_IRQ_IPI0) +#define INVALIDATE_TLB_IPI (M32R_IRQ_IPI1-M32R_IRQ_IPI0) +#define CALL_FUNCTION_IPI (M32R_IRQ_IPI2-M32R_IRQ_IPI0) +#define LOCAL_TIMER_IPI (M32R_IRQ_IPI3-M32R_IRQ_IPI0) +#define INVALIDATE_CACHE_IPI (M32R_IRQ_IPI4-M32R_IRQ_IPI0) +#define CPU_BOOT_IPI (M32R_IRQ_IPI5-M32R_IRQ_IPI0) + +#define IPI_SHIFT (0) +#define NR_IPIS (8) + +#endif /* CONFIG_SMP */ + +#endif /* _ASM_M32R_SMP_H */ diff -Nru a/include/asm-m32r/socket.h b/include/asm-m32r/socket.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/socket.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,50 @@ +#ifndef _ASM_M32R_SOCKET_H +#define _ASM_M32R_SOCKET_H + +#include + +/* For setsockoptions(2) */ +#define SOL_SOCKET 1 + +#define SO_DEBUG 1 +#define SO_REUSEADDR 2 +#define SO_TYPE 3 +#define SO_ERROR 4 +#define SO_DONTROUTE 5 +#define SO_BROADCAST 6 +#define SO_SNDBUF 7 +#define SO_RCVBUF 8 +#define SO_KEEPALIVE 9 +#define SO_OOBINLINE 10 +#define SO_NO_CHECK 11 +#define SO_PRIORITY 12 +#define SO_LINGER 13 +#define SO_BSDCOMPAT 14 +/* To add :#define SO_REUSEPORT 15 */ +#define SO_PASSCRED 16 +#define SO_PEERCRED 17 +#define SO_RCVLOWAT 18 +#define SO_SNDLOWAT 19 +#define SO_RCVTIMEO 20 +#define SO_SNDTIMEO 21 + +/* Security levels - as per NRL IPv6 - don't actually do anything */ +#define SO_SECURITY_AUTHENTICATION 22 +#define SO_SECURITY_ENCRYPTION_TRANSPORT 23 +#define SO_SECURITY_ENCRYPTION_NETWORK 24 + +#define SO_BINDTODEVICE 25 + +/* Socket filtering */ +#define SO_ATTACH_FILTER 26 +#define SO_DETACH_FILTER 27 + +#define SO_PEERNAME 28 +#define SO_TIMESTAMP 29 +#define SCM_TIMESTAMP SO_TIMESTAMP + +#define SO_ACCEPTCONN 30 + +#define SO_PEERSEC 31 + +#endif /* _ASM_M32R_SOCKET_H */ diff -Nru a/include/asm-m32r/sockios.h b/include/asm-m32r/sockios.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/sockios.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,14 @@ +#ifndef _ASM_M32R_SOCKIOS_H +#define _ASM_M32R_SOCKIOS_H + +/* $Id$ */ + +/* Socket-level I/O control calls. */ +#define FIOSETOWN 0x8901 +#define SIOCSPGRP 0x8902 +#define FIOGETOWN 0x8903 +#define SIOCGPGRP 0x8904 +#define SIOCATMARK 0x8905 +#define SIOCGSTAMP 0x8906 /* Get stamp */ + +#endif /* _ASM_M32R_SOCKIOS_H */ diff -Nru a/include/asm-m32r/spinlock.h b/include/asm-m32r/spinlock.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/spinlock.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,371 @@ +#ifndef _ASM_M32R_SPINLOCK_H +#define _ASM_M32R_SPINLOCK_H + +/* $Id$ */ + +/* + * linux/include/asm-m32r/spinlock.h + * orig : i386 2.4.10 + * + * M32R version: + * Copyright (C) 2001, 2002 Hitoshi Yamamoto + */ + +#include /* CONFIG_DEBUG_SPINLOCK, CONFIG_SMP */ +#include +#include +#include + +extern int printk(const char * fmt, ...) + __attribute__ ((format (printf, 1, 2))); + +#define RW_LOCK_BIAS 0x01000000 +#define RW_LOCK_BIAS_STR "0x01000000" + +/* It seems that people are forgetting to + * initialize their spinlocks properly, tsk tsk. + * Remember to turn this off in 2.4. -ben + */ +#if defined(CONFIG_DEBUG_SPINLOCK) +#define SPINLOCK_DEBUG 1 +#else +#define SPINLOCK_DEBUG 0 +#endif + +/* + * Your basic SMP spinlocks, allowing only a single CPU anywhere + */ + +typedef struct { + volatile int lock; +#if SPINLOCK_DEBUG + unsigned magic; +#endif +} spinlock_t; + +#define SPINLOCK_MAGIC 0xdead4ead + +#if SPINLOCK_DEBUG +#define SPINLOCK_MAGIC_INIT , SPINLOCK_MAGIC +#else +#define SPINLOCK_MAGIC_INIT /* */ +#endif + +#define SPIN_LOCK_UNLOCKED (spinlock_t) { 1 SPINLOCK_MAGIC_INIT } + +#define spin_lock_init(x) do { *(x) = SPIN_LOCK_UNLOCKED; } while(0) + +/* + * Simple spin lock operations. There are two variants, one clears IRQ's + * on the local processor, one does not. + * + * We make no fairness assumptions. They have a cost. + */ + +#define spin_is_locked(x) (*(volatile int *)(&(x)->lock) <= 0) +#define spin_unlock_wait(x) do { barrier(); } while(spin_is_locked(x)) +#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock) + +/* + * This works. Despite all the confusion. + */ + +/*======================================================================* + * Try spin lock + *======================================================================* + * Argument: + * arg0: lock + * Return value: + * =1: Success + * =0: Failure + *======================================================================*/ +static __inline__ int _raw_spin_trylock(spinlock_t *lock) +{ + int oldval; + + /* + * lock->lock : =1 : unlock + * : <=0 : lock + * { + * oldval = lock->lock; <--+ need atomic operation + * lock->lock = 0; <--+ + * } + */ + __asm__ __volatile__ ( + "# spin_trylock \n\t" + "ldi r4, #0; \n\t" + "mvfc r5, psw; \n\t" + "clrpsw #0x40 -> nop; \n\t" + DCACHE_CLEAR("%0", "r6", "%1") + "lock %0, @%1; \n\t" + "unlock r4, @%1; \n\t" + "mvtc r5, psw; \n\t" + : "=&r" (oldval) + : "r" (&lock->lock) + : "memory", "r4", "r5" +#ifdef CONFIG_CHIP_M32700_TS1 + , "r6" +#endif /* CONFIG_CHIP_M32700_TS1 */ + ); + + return (oldval > 0); +} + +static __inline__ void _raw_spin_lock(spinlock_t *lock) +{ +#if SPINLOCK_DEBUG + __label__ here; +here: + if (lock->magic != SPINLOCK_MAGIC) { + printk("eip: %p\n", &&here); + BUG(); + } +#endif + /* + * lock->lock : =1 : unlock + * : <=0 : lock + * + * for ( ; ; ) { + * lock->lock -= 1; <-- need atomic operation + * if (lock->lock == 0) break; + * for ( ; lock->lock <= 0 ; ); + * } + */ + __asm__ __volatile__ ( + "# spin_lock \n\t" + ".fillinsn \n" + "1: \n\t" + "mvfc r5, psw; \n\t" + "clrpsw #0x40 -> nop; \n\t" + DCACHE_CLEAR("r4", "r6", "%0") + "lock r4, @%0; \n\t" + "addi r4, #-1; \n\t" + "unlock r4, @%0; \n\t" + "mvtc r5, psw; \n\t" + "bltz r4, 2f; \n\t" + LOCK_SECTION_START(".balign 4 \n\t") + ".fillinsn \n" + "2: \n\t" + "ld r4, @%0; \n\t" + "bgtz r4, 1b; \n\t" + "bra 2b; \n\t" + LOCK_SECTION_END + : /* no outputs */ + : "r" (&lock->lock) + : "memory", "r4", "r5" +#ifdef CONFIG_CHIP_M32700_TS1 + , "r6" +#endif /* CONFIG_CHIP_M32700_TS1 */ + ); +} + +static __inline__ void _raw_spin_unlock(spinlock_t *lock) +{ +#if SPINLOCK_DEBUG + BUG_ON(lock->magic != SPINLOCK_MAGIC); + BUG_ON(!spin_is_locked(lock)); +#endif + mb(); + lock->lock = 1; +} + +/* + * Read-write spinlocks, allowing multiple readers + * but only one writer. + * + * NOTE! it is quite common to have readers in interrupts + * but no interrupt writers. For those circumstances we + * can "mix" irq-safe locks - any writer needs to get a + * irq-safe write-lock, but readers can get non-irqsafe + * read-locks. + */ +typedef struct { + volatile int lock; +#if SPINLOCK_DEBUG + unsigned magic; +#endif +} rwlock_t; + +#define RWLOCK_MAGIC 0xdeaf1eed + +#if SPINLOCK_DEBUG +#define RWLOCK_MAGIC_INIT , RWLOCK_MAGIC +#else +#define RWLOCK_MAGIC_INIT /* */ +#endif + +#define RW_LOCK_UNLOCKED (rwlock_t) { RW_LOCK_BIAS RWLOCK_MAGIC_INIT } + +#define rwlock_init(x) do { *(x) = RW_LOCK_UNLOCKED; } while(0) + +#define rwlock_is_locked(x) ((x)->lock != RW_LOCK_BIAS) + +/* + * On x86, we implement read-write locks as a 32-bit counter + * with the high bit (sign) being the "contended" bit. + * + * The inline assembly is non-obvious. Think about it. + * + * Changed to use the same technique as rw semaphores. See + * semaphore.h for details. -ben + */ +/* the spinlock helpers are in arch/i386/kernel/semaphore.c */ + +static __inline__ void _raw_read_lock(rwlock_t *rw) +{ +#if SPINLOCK_DEBUG + BUG_ON(rw->magic != RWLOCK_MAGIC); +#endif + /* + * rw->lock : >0 : unlock + * : <=0 : lock + * + * for ( ; ; ) { + * rw->lock -= 1; <-- need atomic operation + * if (rw->lock >= 0) break; + * rw->lock += 1; <-- need atomic operation + * for ( ; rw->lock <= 0 ; ); + * } + */ + __asm__ __volatile__ ( + "# read_lock \n\t" + ".fillinsn \n" + "1: \n\t" + "mvfc r5, psw; \n\t" + "clrpsw #0x40 -> nop; \n\t" + DCACHE_CLEAR("r4", "r6", "%0") + "lock r4, @%0; \n\t" + "addi r4, #-1; \n\t" + "unlock r4, @%0; \n\t" + "mvtc r5, psw; \n\t" + "bltz r4, 2f; \n\t" + LOCK_SECTION_START(".balign 4 \n\t") + ".fillinsn \n" + "2: \n\t" + "clrpsw #0x40 -> nop; \n\t" + DCACHE_CLEAR("r4", "r6", "%0") + "lock r4, @%0; \n\t" + "addi r4, #1; \n\t" + "unlock r4, @%0; \n\t" + "mvtc r5, psw; \n\t" + ".fillinsn \n" + "3: \n\t" + "ld r4, @%0; \n\t" + "bgtz r4, 1b; \n\t" + "bra 3b; \n\t" + LOCK_SECTION_END + : /* no outputs */ + : "r" (&rw->lock) + : "memory", "r4", "r5" +#ifdef CONFIG_CHIP_M32700_TS1 + , "r6" +#endif /* CONFIG_CHIP_M32700_TS1 */ + ); +} + +static __inline__ void _raw_write_lock(rwlock_t *rw) +{ +#if SPINLOCK_DEBUG + BUG_ON(rw->magic != RWLOCK_MAGIC); +#endif + /* + * rw->lock : =RW_LOCK_BIAS_STR : unlock + * : !=RW_LOCK_BIAS_STR : lock + * + * for ( ; ; ) { + * rw->lock -= RW_LOCK_BIAS_STR; <-- need atomic operation + * if (rw->lock == 0) break; + * rw->lock += RW_LOCK_BIAS_STR; <-- need atomic operation + * for ( ; rw->lock != RW_LOCK_BIAS_STR ; ) ; + * } + */ + __asm__ __volatile__ ( + "# write_lock \n\t" + "seth r5, #high(" RW_LOCK_BIAS_STR "); \n\t" + "or3 r5, r5, #low(" RW_LOCK_BIAS_STR "); \n\t" + ".fillinsn \n" + "1: \n\t" + "mvfc r6, psw; \n\t" + "clrpsw #0x40 -> nop; \n\t" + DCACHE_CLEAR("r4", "r7", "%0") + "lock r4, @%0; \n\t" + "sub r4, r5; \n\t" + "unlock r4, @%0; \n\t" + "mvtc r6, psw; \n\t" + "bnez r4, 2f; \n\t" + LOCK_SECTION_START(".balign 4 \n\t") + ".fillinsn \n" + "2: \n\t" + "clrpsw #0x40 -> nop; \n\t" + DCACHE_CLEAR("r4", "r7", "%0") + "lock r4, @%0; \n\t" + "add r4, r5; \n\t" + "unlock r4, @%0; \n\t" + "mvtc r6, psw; \n\t" + ".fillinsn \n" + "3: \n\t" + "ld r4, @%0; \n\t" + "beq r4, r5, 1b; \n\t" + "bra 3b; \n\t" + LOCK_SECTION_END + : /* no outputs */ + : "r" (&rw->lock) + : "memory", "r4", "r5", "r6" +#ifdef CONFIG_CHIP_M32700_TS1 + , "r7" +#endif /* CONFIG_CHIP_M32700_TS1 */ + ); +} + +static __inline__ void _raw_read_unlock(rwlock_t *rw) +{ + __asm__ __volatile__ ( + "# read_unlock \n\t" + "mvfc r5, psw; \n\t" + "clrpsw #0x40 -> nop; \n\t" + DCACHE_CLEAR("r4", "r6", "%0") + "lock r4, @%0; \n\t" + "addi r4, #1; \n\t" + "unlock r4, @%0; \n\t" + "mvtc r5, psw; \n\t" + : /* no outputs */ + : "r" (&rw->lock) + : "memory", "r4", "r5" +#ifdef CONFIG_CHIP_M32700_TS1 + , "r6" +#endif /* CONFIG_CHIP_M32700_TS1 */ + ); +} + +static __inline__ void _raw_write_unlock(rwlock_t *rw) +{ + __asm__ __volatile__ ( + "# write_unlock \n\t" + "seth r5, #high(" RW_LOCK_BIAS_STR "); \n\t" + "or3 r5, r5, #low(" RW_LOCK_BIAS_STR "); \n\t" + "mvfc r6, psw; \n\t" + "clrpsw #0x40 -> nop; \n\t" + DCACHE_CLEAR("r4", "r7", "%0") + "lock r4, @%0; \n\t" + "add r4, r5; \n\t" + "unlock r4, @%0; \n\t" + "mvtc r6, psw; \n\t" + : /* no outputs */ + : "r" (&rw->lock) + : "memory", "r4", "r5", "r6" +#ifdef CONFIG_CHIP_M32700_TS1 + , "r7" +#endif /* CONFIG_CHIP_M32700_TS1 */ + ); +} + +static __inline__ int _raw_write_trylock(rwlock_t *lock) +{ + atomic_t *count = (atomic_t *)lock; + if (atomic_sub_and_test(RW_LOCK_BIAS, count)) + return 1; + atomic_add(RW_LOCK_BIAS, count); + return 0; +} + +#endif /* _ASM_M32R_SPINLOCK_H */ diff -Nru a/include/asm-m32r/stat.h b/include/asm-m32r/stat.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/stat.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,91 @@ +#ifndef _ASM_M32R_STAT_H +#define _ASM_M32R_STAT_H + +/* $Id$ */ + +/* orig : i386 2.4.18 */ + +#include + +struct __old_kernel_stat { + unsigned short st_dev; + unsigned short st_ino; + unsigned short st_mode; + unsigned short st_nlink; + unsigned short st_uid; + unsigned short st_gid; + unsigned short st_rdev; + unsigned long st_size; + unsigned long st_atime; + unsigned long st_mtime; + unsigned long st_ctime; +}; + +#define STAT_HAVE_NSEC 1 + +struct stat { + unsigned short st_dev; + unsigned short __pad1; + unsigned long st_ino; + unsigned short st_mode; + unsigned short st_nlink; + unsigned short st_uid; + unsigned short st_gid; + unsigned short st_rdev; + unsigned short __pad2; + unsigned long st_size; + unsigned long st_blksize; + unsigned long st_blocks; + unsigned long st_atime; + unsigned long st_atime_nsec; + unsigned long st_mtime; + unsigned long st_mtime_nsec; + unsigned long st_ctime; + unsigned long st_ctime_nsec; + unsigned long __unused4; + unsigned long __unused5; +}; + +/* This matches struct stat64 in glibc2.1, hence the absolutely + * insane amounts of padding around dev_t's. + */ +struct stat64 { + unsigned long long st_dev; + unsigned char __pad0[4]; +#define STAT64_HAS_BROKEN_ST_INO + unsigned long __st_ino; + + unsigned int st_mode; + unsigned int st_nlink; + + unsigned long st_uid; + unsigned long st_gid; + + unsigned long long st_rdev; + unsigned char __pad3[4]; + + long long st_size; + unsigned long st_blksize; + +#if defined(__BIG_ENDIAN) + unsigned long __pad4; /* future possible st_blocks high bits */ + unsigned long st_blocks; /* Number 512-byte blocks allocated. */ +#elif defined(__LITTLE_ENDIAN) + unsigned long st_blocks; /* Number 512-byte blocks allocated. */ + unsigned long __pad4; /* future possible st_blocks high bits */ +#else +#error no endian defined +#endif + unsigned long st_atime; + unsigned long st_atime_nsec; + + unsigned long st_mtime; + unsigned long st_mtime_nsec; + + unsigned long st_ctime; + unsigned long st_ctime_nsec; + + unsigned long long st_ino; +}; + +#endif /* _ASM_M32R_STAT_H */ diff -Nru a/include/asm-m32r/statfs.h b/include/asm-m32r/statfs.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/statfs.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,6 @@ +#ifndef _ASM_M32R_STATFS_H +#define _ASM_M32R_STATFS_H + +#include + +#endif /* _ASM_M32R_STATFS_H */ diff -Nru a/include/asm-m32r/string.h b/include/asm-m32r/string.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/string.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,15 @@ +#ifndef _ASM_M32R_STRING_H +#define _ASM_M32R_STRING_H + +/* $Id$ */ + +#define __HAVE_ARCH_STRLEN +extern size_t strlen(const char * s); + +#define __HAVE_ARCH_MEMCPY +extern void *memcpy(void *__to, __const__ void *__from, size_t __n); + +#define __HAVE_ARCH_MEMSET +extern void *memset(void *__s, int __c, size_t __count); + +#endif /* _ASM_M32R_STRING_H */ diff -Nru a/include/asm-m32r/syscall.h b/include/asm-m32r/syscall.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/syscall.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,11 @@ +#ifndef _ASM_M32R_SYSCALL_H +#define _ASM_M32R_SYSCALL_H + +/* $Id$ */ + +/* Definitions for the system call vector. */ +#define SYSCALL_VECTOR "2" +#define SYSCALL_VECTOR_ADDRESS "0xa0" + +#endif /* _ASM_M32R_SYSCALL_H */ + diff -Nru a/include/asm-m32r/system.h b/include/asm-m32r/system.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/system.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,301 @@ +#ifndef _ASM_M32R_SYSTEM_H +#define _ASM_M32R_SYSTEM_H + +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 2001 by Hiroyuki Kondo, Hirokazu Takata, and Hitoshi Yamamoto + */ + +#include + +#ifdef __KERNEL__ + +/* + * switch_to(prev, next) should switch from task `prev' to `next' + * `prev' will never be the same as `next'. + * + * `next' and `prev' should be struct task_struct, but it isn't always defined + */ + +#ifndef CONFIG_SMP +#define prepare_to_switch() do { } while(0) +#endif /* not CONFIG_SMP */ + +#define switch_to(prev, next, last) do { \ + register unsigned long arg0 __asm__ ("r0") = (unsigned long)prev; \ + register unsigned long arg1 __asm__ ("r1") = (unsigned long)next; \ + register unsigned long *oldsp __asm__ ("r2") = &(prev->thread.sp); \ + register unsigned long *newsp __asm__ ("r3") = &(next->thread.sp); \ + register unsigned long *oldlr __asm__ ("r4") = &(prev->thread.lr); \ + register unsigned long *newlr __asm__ ("r5") = &(next->thread.lr); \ + register struct task_struct *__last __asm__ ("r6"); \ + __asm__ __volatile__ ( \ + "st r8, @-r15 \n\t" \ + "st r9, @-r15 \n\t" \ + "st r10, @-r15 \n\t" \ + "st r11, @-r15 \n\t" \ + "st r12, @-r15 \n\t" \ + "st r13, @-r15 \n\t" \ + "st r14, @-r15 \n\t" \ + "seth r14, #high(1f) \n\t" \ + "or3 r14, r14, #low(1f) \n\t" \ + "st r14, @r4 ; store old LR \n\t" \ + "st r15, @r2 ; store old SP \n\t" \ + "ld r15, @r3 ; load new SP \n\t" \ + "st r0, @-r15 ; store 'prev' onto new stack \n\t" \ + "ld r14, @r5 ; load new LR \n\t" \ + "jmp r14 \n\t" \ + ".fillinsn \n " \ + "1: \n\t" \ + "ld r6, @r15+ ; load 'prev' from new stack \n\t" \ + "ld r14, @r15+ \n\t" \ + "ld r13, @r15+ \n\t" \ + "ld r12, @r15+ \n\t" \ + "ld r11, @r15+ \n\t" \ + "ld r10, @r15+ \n\t" \ + "ld r9, @r15+ \n\t" \ + "ld r8, @r15+ \n\t" \ + : "=&r" (__last) \ + : "r" (arg0), "r" (arg1), "r" (oldsp), "r" (newsp), \ + "r" (oldlr), "r" (newlr) \ + : "memory" \ + ); \ + last = __last; \ +} while(0) + +/* Interrupt Control */ +#if !defined(CONFIG_CHIP_M32102) +#define local_irq_enable() \ + __asm__ __volatile__ ("setpsw #0x40 -> nop": : :"memory") +#define local_irq_disable() \ + __asm__ __volatile__ ("clrpsw #0x40 -> nop": : :"memory") +#else /* CONFIG_CHIP_M32102 */ +static __inline__ void local_irq_enable(void) +{ + unsigned long tmpreg; + __asm__ __volatile__( + "mvfc %0, psw; \n\t" + "or3 %0, %0, #0x0040; \n\t" + "mvtc %0, psw; \n\t" + : "=&r" (tmpreg) : : "cbit", "memory"); +} + +static __inline__ void local_irq_disable(void) +{ + unsigned long tmpreg0, tmpreg1; + __asm__ __volatile__( + "ld24 %0, #0 ; Use 32-bit insn. \n\t" + "mvfc %1, psw ; No interrupt can be accepted here. \n\t" + "mvtc %0, psw \n\t" + "and3 %0, %1, #0xffbf \n\t" + "mvtc %0, psw \n\t" + : "=&r" (tmpreg0), "=&r" (tmpreg1) : : "cbit", "memory"); +} +#endif /* CONFIG_CHIP_M32102 */ + +#define local_save_flags(x) \ + __asm__ __volatile__("mvfc %0,psw" : "=r"(x) : /* no input */) + +#define local_irq_restore(x) \ + __asm__ __volatile__("mvtc %0,psw" : /* no outputs */ \ + : "r" (x) : "cbit", "memory") + +#if !defined(CONFIG_CHIP_M32102) +#define local_irq_save(x) \ + __asm__ __volatile__( \ + "mvfc %0, psw; \n\t" \ + "clrpsw #0x40 -> nop; \n\t" \ + : "=r" (x) : /* no input */ : "memory") +#else /* CONFIG_CHIP_M32102 */ +#define local_irq_save(x) \ + ({ \ + unsigned long tmpreg; \ + __asm__ __volatile__( \ + "ld24 %1, #0 \n\t" \ + "mvfc %0, psw \n\t" \ + "mvtc %1, psw \n\t" \ + "and3 %1, %0, #0xffbf \n\t" \ + "mvtc %1, psw \n\t" \ + : "=r" (x), "=&r" (tmpreg) \ + : : "cbit", "memory"); \ + }) +#endif /* CONFIG_CHIP_M32102 */ + +#define irqs_disabled() \ + ({ \ + unsigned long flags; \ + local_save_flags(flags); \ + !(flags & 0x40); \ + }) + +#endif /* __KERNEL__ */ + +#define nop() __asm__ __volatile__ ("nop" : : ) + +#define xchg(ptr,x) \ + ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) + +#define tas(ptr) (xchg((ptr),1)) + +#ifdef CONFIG_SMP +extern void __xchg_called_with_bad_pointer(void); +#endif + +#ifdef CONFIG_CHIP_M32700_TS1 +#define DCACHE_CLEAR(reg0, reg1, addr) \ + "seth "reg1", #high(dcache_dummy); \n\t" \ + "or3 "reg1", "reg1", #low(dcache_dummy); \n\t" \ + "lock "reg0", @"reg1"; \n\t" \ + "add3 "reg0", "addr", #0x1000; \n\t" \ + "ld "reg0", @"reg0"; \n\t" \ + "add3 "reg0", "addr", #0x2000; \n\t" \ + "ld "reg0", @"reg0"; \n\t" \ + "unlock "reg0", @"reg1"; \n\t" + /* FIXME: This workaround code cannot handle kenrel modules + * correctly under SMP environment. + */ +#else /* CONFIG_CHIP_M32700_TS1 */ +#define DCACHE_CLEAR(reg0, reg1, addr) +#endif /* CONFIG_CHIP_M32700_TS1 */ + +static __inline__ unsigned long __xchg(unsigned long x, volatile void * ptr, + int size) +{ + unsigned long flags; + unsigned long tmp = 0; + + local_irq_save(flags); + + switch (size) { +#ifndef CONFIG_SMP + case 1: + __asm__ __volatile__ ( + "ldb %0, @%2 \n\t" + "stb %1, @%2 \n\t" + : "=&r" (tmp) : "r" (x), "r" (ptr) : "memory"); + break; + case 2: + __asm__ __volatile__ ( + "ldh %0, @%2 \n\t" + "sth %1, @%2 \n\t" + : "=&r" (tmp) : "r" (x), "r" (ptr) : "memory"); + break; + case 4: + __asm__ __volatile__ ( + "ld %0, @%2 \n\t" + "st %1, @%2 \n\t" + : "=&r" (tmp) : "r" (x), "r" (ptr) : "memory"); + break; +#else /* CONFIG_SMP */ + case 4: + __asm__ __volatile__ ( + DCACHE_CLEAR("%0", "r4", "%2") + "lock %0, @%2; \n\t" + "unlock %1, @%2; \n\t" + : "=&r" (tmp) : "r" (x), "r" (ptr) + : "memory" +#ifdef CONFIG_CHIP_M32700_TS1 + , "r4" +#endif /* CONFIG_CHIP_M32700_TS1 */ + ); + break; + default: + __xchg_called_with_bad_pointer(); +#endif /* CONFIG_SMP */ + } + + local_irq_restore(flags); + + return (tmp); +} + +/* + * Memory barrier. + * + * mb() prevents loads and stores being reordered across this point. + * rmb() prevents loads being reordered across this point. + * wmb() prevents stores being reordered across this point. + */ +#if 0 +#define mb() __asm__ __volatile__ ("push r0; \n\t pop r0;" : : : "memory") +#else +#define mb() __asm__ __volatile__ ("" : : : "memory") +#endif +#define rmb() mb() +#define wmb() mb() + +/** + * read_barrier_depends - Flush all pending reads that subsequents reads + * depend on. + * + * No data-dependent reads from memory-like regions are ever reordered + * over this barrier. All reads preceding this primitive are guaranteed + * to access memory (but not necessarily other CPUs' caches) before any + * reads following this primitive that depend on the data return by + * any of the preceding reads. This primitive is much lighter weight than + * rmb() on most CPUs, and is never heavier weight than is + * rmb(). + * + * These ordering constraints are respected by both the local CPU + * and the compiler. + * + * Ordering is not guaranteed by anything other than these primitives, + * not even by data dependencies. See the documentation for + * memory_barrier() for examples and URLs to more information. + * + * For example, the following code would force ordering (the initial + * value of "a" is zero, "b" is one, and "p" is "&a"): + * + * + * CPU 0 CPU 1 + * + * b = 2; + * memory_barrier(); + * p = &b; q = p; + * read_barrier_depends(); + * d = *q; + * + * + * + * because the read of "*q" depends on the read of "p" and these + * two reads are separated by a read_barrier_depends(). However, + * the following code, with the same initial values for "a" and "b": + * + * + * CPU 0 CPU 1 + * + * a = 2; + * memory_barrier(); + * b = 3; y = b; + * read_barrier_depends(); + * x = a; + * + * + * does not enforce ordering, since there is no data dependency between + * the read of "a" and the read of "b". Therefore, on some CPUs, such + * as Alpha, "y" could be set to 3 and "x" to 0. Use rmb() + * in cases like thiswhere there are no data dependencies. + **/ + +#define read_barrier_depends() do { } while (0) + +#ifdef CONFIG_SMP +#define smp_mb() mb() +#define smp_rmb() rmb() +#define smp_wmb() wmb() +#define smp_read_barrier_depends() read_barrier_depends() +#else +#define smp_mb() barrier() +#define smp_rmb() barrier() +#define smp_wmb() barrier() +#define smp_read_barrier_depends() do { } while (0) +#endif + +#define set_mb(var, value) do { xchg(&var, value); } while (0) +#define set_wmb(var, value) do { var = value; wmb(); } while (0) + +#endif /* _ASM_M32R_SYSTEM_H */ + diff -Nru a/include/asm-m32r/termbits.h b/include/asm-m32r/termbits.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/termbits.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,175 @@ +#ifndef _ASM_M32R_TERMBITS_H +#define _ASM_M32R_TERMBITS_H + +/* $Id$ */ + +#include + +typedef unsigned char cc_t; +typedef unsigned int speed_t; +typedef unsigned int tcflag_t; + +#define NCCS 19 +struct termios { + tcflag_t c_iflag; /* input mode flags */ + tcflag_t c_oflag; /* output mode flags */ + tcflag_t c_cflag; /* control mode flags */ + tcflag_t c_lflag; /* local mode flags */ + cc_t c_line; /* line discipline */ + cc_t c_cc[NCCS]; /* control characters */ +}; + +/* c_cc characters */ +#define VINTR 0 +#define VQUIT 1 +#define VERASE 2 +#define VKILL 3 +#define VEOF 4 +#define VTIME 5 +#define VMIN 6 +#define VSWTC 7 +#define VSTART 8 +#define VSTOP 9 +#define VSUSP 10 +#define VEOL 11 +#define VREPRINT 12 +#define VDISCARD 13 +#define VWERASE 14 +#define VLNEXT 15 +#define VEOL2 16 + +/* c_iflag bits */ +#define IGNBRK 0000001 +#define BRKINT 0000002 +#define IGNPAR 0000004 +#define PARMRK 0000010 +#define INPCK 0000020 +#define ISTRIP 0000040 +#define INLCR 0000100 +#define IGNCR 0000200 +#define ICRNL 0000400 +#define IUCLC 0001000 +#define IXON 0002000 +#define IXANY 0004000 +#define IXOFF 0010000 +#define IMAXBEL 0020000 +#define IUTF8 0040000 + +/* c_oflag bits */ +#define OPOST 0000001 +#define OLCUC 0000002 +#define ONLCR 0000004 +#define OCRNL 0000010 +#define ONOCR 0000020 +#define ONLRET 0000040 +#define OFILL 0000100 +#define OFDEL 0000200 +#define NLDLY 0000400 +#define NL0 0000000 +#define NL1 0000400 +#define CRDLY 0003000 +#define CR0 0000000 +#define CR1 0001000 +#define CR2 0002000 +#define CR3 0003000 +#define TABDLY 0014000 +#define TAB0 0000000 +#define TAB1 0004000 +#define TAB2 0010000 +#define TAB3 0014000 +#define XTABS 0014000 +#define BSDLY 0020000 +#define BS0 0000000 +#define BS1 0020000 +#define VTDLY 0040000 +#define VT0 0000000 +#define VT1 0040000 +#define FFDLY 0100000 +#define FF0 0000000 +#define FF1 0100000 + +/* c_cflag bit meaning */ +#define CBAUD 0010017 +#define B0 0000000 /* hang up */ +#define B50 0000001 +#define B75 0000002 +#define B110 0000003 +#define B134 0000004 +#define B150 0000005 +#define B200 0000006 +#define B300 0000007 +#define B600 0000010 +#define B1200 0000011 +#define B1800 0000012 +#define B2400 0000013 +#define B4800 0000014 +#define B9600 0000015 +#define B19200 0000016 +#define B38400 0000017 +#define EXTA B19200 +#define EXTB B38400 +#define CSIZE 0000060 +#define CS5 0000000 +#define CS6 0000020 +#define CS7 0000040 +#define CS8 0000060 +#define CSTOPB 0000100 +#define CREAD 0000200 +#define PARENB 0000400 +#define PARODD 0001000 +#define HUPCL 0002000 +#define CLOCAL 0004000 +#define CBAUDEX 0010000 +#define B57600 0010001 +#define B115200 0010002 +#define B230400 0010003 +#define B460800 0010004 +#define B500000 0010005 +#define B576000 0010006 +#define B921600 0010007 +#define B1000000 0010010 +#define B1152000 0010011 +#define B1500000 0010012 +#define B2000000 0010013 +#define B2500000 0010014 +#define B3000000 0010015 +#define B3500000 0010016 +#define B4000000 0010017 +#define CIBAUD 002003600000 /* input baud rate (not used) */ +#define CMSPAR 010000000000 /* mark or space (stick) parity */ +#define CRTSCTS 020000000000 /* flow control */ + +/* c_lflag bits */ +#define ISIG 0000001 +#define ICANON 0000002 +#define XCASE 0000004 +#define ECHO 0000010 +#define ECHOE 0000020 +#define ECHOK 0000040 +#define ECHONL 0000100 +#define NOFLSH 0000200 +#define TOSTOP 0000400 +#define ECHOCTL 0001000 +#define ECHOPRT 0002000 +#define ECHOKE 0004000 +#define FLUSHO 0010000 +#define PENDIN 0040000 +#define IEXTEN 0100000 + +/* tcflow() and TCXONC use these */ +#define TCOOFF 0 +#define TCOON 1 +#define TCIOFF 2 +#define TCION 3 + +/* tcflush() and TCFLSH use these */ +#define TCIFLUSH 0 +#define TCOFLUSH 1 +#define TCIOFLUSH 2 + +/* tcsetattr uses these */ +#define TCSANOW 0 +#define TCSADRAIN 1 +#define TCSAFLUSH 2 + +#endif /* _ASM_M32R_TERMBITS_H */ diff -Nru a/include/asm-m32r/termios.h b/include/asm-m32r/termios.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/termios.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,109 @@ +#ifndef _M32R_TERMIOS_H +#define _M32R_TERMIOS_H + +/* orig : i386 2.6.0-test5 */ + +#include +#include + +struct winsize { + unsigned short ws_row; + unsigned short ws_col; + unsigned short ws_xpixel; + unsigned short ws_ypixel; +}; + +#define NCC 8 +struct termio { + unsigned short c_iflag; /* input mode flags */ + unsigned short c_oflag; /* output mode flags */ + unsigned short c_cflag; /* control mode flags */ + unsigned short c_lflag; /* local mode flags */ + unsigned char c_line; /* line discipline */ + unsigned char c_cc[NCC]; /* control characters */ +}; + +/* modem lines */ +#define TIOCM_LE 0x001 +#define TIOCM_DTR 0x002 +#define TIOCM_RTS 0x004 +#define TIOCM_ST 0x008 +#define TIOCM_SR 0x010 +#define TIOCM_CTS 0x020 +#define TIOCM_CAR 0x040 +#define TIOCM_RNG 0x080 +#define TIOCM_DSR 0x100 +#define TIOCM_CD TIOCM_CAR +#define TIOCM_RI TIOCM_RNG +#define TIOCM_OUT1 0x2000 +#define TIOCM_OUT2 0x4000 +#define TIOCM_LOOP 0x8000 + +/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ + +/* line disciplines */ +#define N_TTY 0 +#define N_SLIP 1 +#define N_MOUSE 2 +#define N_PPP 3 +#define N_STRIP 4 +#define N_AX25 5 +#define N_X25 6 /* X.25 async */ +#define N_6PACK 7 +#define N_MASC 8 /* Reserved for Mobitex module */ +#define N_R3964 9 /* Reserved for Simatic R3964 module */ +#define N_PROFIBUS_FDL 10 /* Reserved for Profibus */ +#define N_IRDA 11 /* Linux IR - http://irda.sourceforge.net/ */ +#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */ +#define N_HDLC 13 /* synchronous HDLC */ +#define N_SYNC_PPP 14 /* synchronous PPP */ +#define N_HCI 15 /* Bluetooth HCI UART */ + +#ifdef __KERNEL__ +#include + +/* intr=^C quit=^\ erase=del kill=^U + eof=^D vtime=\0 vmin=\1 sxtc=\0 + start=^Q stop=^S susp=^Z eol=\0 + reprint=^R discard=^U werase=^W lnext=^V + eol2=\0 +*/ +#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0" + +/* + * Translate a "termio" structure into a "termios". Ugh. + */ +#define SET_LOW_TERMIOS_BITS(termios, termio, x) { \ + unsigned short __tmp; \ + get_user(__tmp,&(termio)->x); \ + *(unsigned short *) &(termios)->x = __tmp; \ +} + +#define user_termio_to_kernel_termios(termios, termio) \ +({ \ + SET_LOW_TERMIOS_BITS(termios, termio, c_iflag); \ + SET_LOW_TERMIOS_BITS(termios, termio, c_oflag); \ + SET_LOW_TERMIOS_BITS(termios, termio, c_cflag); \ + SET_LOW_TERMIOS_BITS(termios, termio, c_lflag); \ + copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \ +}) + +/* + * Translate a "termios" structure into a "termio". Ugh. + */ +#define kernel_termios_to_user_termio(termio, termios) \ +({ \ + put_user((termios)->c_iflag, &(termio)->c_iflag); \ + put_user((termios)->c_oflag, &(termio)->c_oflag); \ + put_user((termios)->c_cflag, &(termio)->c_cflag); \ + put_user((termios)->c_lflag, &(termio)->c_lflag); \ + put_user((termios)->c_line, &(termio)->c_line); \ + copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \ +}) + +#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios)) +#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios)) + +#endif /* __KERNEL__ */ + +#endif /* _M32R_TERMIOS_H */ diff -Nru a/include/asm-m32r/thread_info.h b/include/asm-m32r/thread_info.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/thread_info.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,149 @@ +/* thread_info.h: i386 low-level thread information + * + * Copyright (C) 2002 David Howells (dhowells@redhat.com) + * - Incorporating suggestions made by Linus Torvalds and Dave Miller + */ + +#ifndef _ASM_THREAD_INFO_H +#define _ASM_THREAD_INFO_H + +#ifdef __KERNEL__ + +#ifndef __ASSEMBLY__ +#include +#endif + +/* + * low level task data that entry.S needs immediate access to + * - this struct should fit entirely inside of one cache line + * - this struct shares the supervisor stack pages + * - if the contents of this structure are changed, the assembly constants must also be changed + */ +#ifndef __ASSEMBLY__ + +struct thread_info { + struct task_struct *task; /* main task structure */ + struct exec_domain *exec_domain; /* execution domain */ + unsigned long flags; /* low level flags */ + unsigned long status; /* thread-synchronous flags */ + __u32 cpu; /* current CPU */ + __s32 preempt_count; /* 0 => preemptable, <0 => BUG */ + + mm_segment_t addr_limit; /* thread address space: + 0-0xBFFFFFFF for user-thead + 0-0xFFFFFFFF for kernel-thread + */ + struct restart_block restart_block; + + __u8 supervisor_stack[0]; +}; + +#else /* !__ASSEMBLY__ */ + +/* offsets into the thread_info struct for assembly code access */ +#define TI_TASK 0x00000000 +#define TI_EXEC_DOMAIN 0x00000004 +#define TI_FLAGS 0x00000008 +#define TI_STATUS 0x0000000C +#define TI_CPU 0x00000010 +#define TI_PRE_COUNT 0x00000014 +#define TI_ADDR_LIMIT 0x00000018 +#define TI_RESTART_BLOCK 0x000001C + +#endif + +#define PREEMPT_ACTIVE 0x4000000 + +/* + * macros/functions for gaining access to the thread information structure + * + * preempt_count needs to be 1 initially, until the scheduler is functional. + */ +#ifndef __ASSEMBLY__ + +#define INIT_THREAD_INFO(tsk) \ +{ \ + .task = &tsk, \ + .exec_domain = &default_exec_domain, \ + .flags = 0, \ + .cpu = 0, \ + .preempt_count = 1, \ + .addr_limit = KERNEL_DS, \ + .restart_block = { \ + .fn = do_no_restart_syscall, \ + }, \ +} + +#define init_thread_info (init_thread_union.thread_info) +#define init_stack (init_thread_union.stack) + +/* how to get the thread information struct from C */ +static inline struct thread_info *current_thread_info(void) +{ + struct thread_info *ti; + + __asm__ __volatile__ ( + "ldi %0, #0xffffe000; \n\t" + "and %0, sp; \n\t" + : "=r" (ti) + ); + + return ti; +} + +/* thread information allocation */ +#define THREAD_SIZE (2*PAGE_SIZE) +#define alloc_thread_info(task) \ + ((struct thread_info *) __get_free_pages(GFP_KERNEL,1)) +#define free_thread_info(ti) free_pages((unsigned long) (ti), 1) +#define get_thread_info(ti) get_task_struct((ti)->task) +#define put_thread_info(ti) put_task_struct((ti)->task) + +#else /* !__ASSEMBLY__ */ + +/* how to get the thread information struct from ASM */ +#define GET_THREAD_INFO(reg) GET_THREAD_INFO reg + .macro GET_THREAD_INFO reg + ldi \reg, #0xffffe000 + and \reg, sp + .endm + +#endif + +/* + * thread information flags + * - these are process state flags that various assembly files may need to access + * - pending work-to-be-done flags are in LSW + * - other flags in MSW + */ +#define TIF_SYSCALL_TRACE 0 /* syscall trace active */ +#define TIF_NOTIFY_RESUME 1 /* resumption notification requested */ +#define TIF_SIGPENDING 2 /* signal pending */ +#define TIF_NEED_RESCHED 3 /* rescheduling necessary */ +#define TIF_SINGLESTEP 4 /* restore singlestep on return to user mode */ +#define TIF_IRET 5 /* return with iret */ +#define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */ + +#define _TIF_SYSCALL_TRACE (1< + +#define CLOCK_TICK_RATE (CONFIG_BUS_CLOCK / CONFIG_TIMER_DIVIDE) +#define CLOCK_TICK_FACTOR 20 /* Factor of both 1000000 and CLOCK_TICK_RATE */ +#define FINETUNE ((((((long)LATCH * HZ - CLOCK_TICK_RATE) << SHIFT_HZ) * \ + (1000000/CLOCK_TICK_FACTOR) / (CLOCK_TICK_RATE/CLOCK_TICK_FACTOR)) \ + << (SHIFT_SCALE-SHIFT_HZ)) / HZ) + +#ifdef __KERNEL__ +/* + * Standard way to access the cycle counter. + * Currently only used on SMP. + */ + +typedef unsigned long long cycles_t; + +extern cycles_t cacheflush_time; + +static __inline__ cycles_t get_cycles (void) +{ + return 0; +} +#endif /* __KERNEL__ */ + +#endif /* _ASM_M32R_TIMEX_H */ diff -Nru a/include/asm-m32r/tlb.h b/include/asm-m32r/tlb.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/tlb.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,20 @@ +#ifndef _M32R_TLB_H +#define _M32R_TLB_H + +/* + * x86 doesn't need any special per-pte or + * per-vma handling.. + */ +#define tlb_start_vma(tlb, vma) do { } while (0) +#define tlb_end_vma(tlb, vma) do { } while (0) +#define __tlb_remove_tlb_entry(tlb, pte, address) do { } while (0) + +/* + * .. because we flush the whole mm when it + * fills up. + */ +#define tlb_flush(tlb) flush_tlb_mm((tlb)->mm) + +#include + +#endif /* _M32R_TLB_H */ diff -Nru a/include/asm-m32r/tlbflush.h b/include/asm-m32r/tlbflush.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/tlbflush.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,102 @@ +#ifndef _ASM_M32R_TLBFLUSH_H +#define _ASM_M32R_TLBFLUSH_H + +#include +#include + +/* + * TLB flushing: + * + * - flush_tlb() flushes the current mm struct TLBs + * - flush_tlb_all() flushes all processes TLBs + * - flush_tlb_mm(mm) flushes the specified mm context TLB's + * - flush_tlb_page(vma, vmaddr) flushes one page + * - 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 + */ + +extern void local_flush_tlb_all(void); +extern void local_flush_tlb_mm(struct mm_struct *); +extern void local_flush_tlb_page(struct vm_area_struct *, unsigned long); +extern void local_flush_tlb_range(struct vm_area_struct *, unsigned long, + unsigned long); + +#ifndef CONFIG_SMP +#ifdef CONFIG_MMU +#define flush_tlb_all() local_flush_tlb_all() +#define flush_tlb_mm(mm) local_flush_tlb_mm(mm) +#define flush_tlb_page(vma, page) local_flush_tlb_page(vma, page) +#define flush_tlb_range(vma, start, end) \ + local_flush_tlb_range(vma, start, end) +#define flush_tlb_kernel_range(start, end) local_flush_tlb_all() +#else /* CONFIG_MMU */ +#define flush_tlb_all() do { } while (0) +#define flush_tlb_mm(mm) do { } while (0) +#define flush_tlb_page(vma, vmaddr) do { } while (0) +#define flush_tlb_range(vma, start, end) do { } while (0) +#endif /* CONFIG_MMU */ +#else /* CONFIG_SMP */ +extern void smp_flush_tlb_all(void); +extern void smp_flush_tlb_mm(struct mm_struct *); +extern void smp_flush_tlb_page(struct vm_area_struct *, unsigned long); +extern void smp_flush_tlb_range(struct vm_area_struct *, unsigned long, + unsigned long); + +#define flush_tlb_all() smp_flush_tlb_all() +#define flush_tlb_mm(mm) smp_flush_tlb_mm(mm) +#define flush_tlb_page(vma, page) smp_flush_tlb_page(vma, page) +#define flush_tlb_range(vma, start, end) \ + smp_flush_tlb_range(vma, start, end) +#define flush_tlb_kernel_range(start, end) smp_flush_tlb_all() +#endif /* CONFIG_SMP */ + +static __inline__ void __flush_tlb_page(unsigned long page) +{ + unsigned int tmpreg0, tmpreg1, tmpreg2; + + __asm__ __volatile__ ( + "seth %0, #high(%4) \n\t" + "st %3, @(%5, %0) \n\t" + "ldi %1, #1 \n\t" + "st %1, @(%6, %0) \n\t" + "add3 %1, %0, %7 \n\t" + ".fillinsn \n" + "1: \n\t" + "ld %2, @(%6, %0) \n\t" + "bnez %2, 1b \n\t" + "ld %0, @%1+ \n\t" + "ld %1, @%1 \n\t" + "st %2, @+%0 \n\t" + "st %2, @+%1 \n\t" + : "=&r" (tmpreg0), "=&r" (tmpreg1), "=&r" (tmpreg2) + : "r" (page), "i" (MMU_REG_BASE), "i" (MSVA_offset), + "i" (MTOP_offset), "i" (MIDXI_offset) + : "memory" + ); +} + +static __inline__ void __flush_tlb_all(void) +{ + unsigned int tmpreg0, tmpreg1; + + __asm__ __volatile__ ( + "seth %0, #high(%2) \n\t" + "or3 %0, %0, #low(%2) \n\t" + "ldi %1, #0xc \n\t" + "st %1, @%0 \n\t" + ".fillinsn \n" + "1: \n\t" + "ld %1, @%0 \n\t" + "bnez %1, 1b \n\t" + : "=&r" (tmpreg0), "=&r" (tmpreg1) + : "i" (MTOP) : "memory" + ); +} + +#define flush_tlb_pgtables(mm, start, end) do { } while (0) + +extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t); + +#endif /* _ASM_M32R_TLBFLUSH_H */ + diff -Nru a/include/asm-m32r/topology.h b/include/asm-m32r/topology.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/topology.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,53 @@ +/* + * linux/include/asm-generic/topology.h + * + * Written by: Matthew Dobson, IBM Corporation + * + * Copyright (C) 2002, IBM Corp. + * + * All rights reserved. + * + * 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. + * + * 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, GOOD TITLE or + * NON INFRINGEMENT. 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Send feedback to + */ +#ifndef _ASM_M32R_TOPOLOGY_H +#define _ASM_M32R_TOPOLOGY_H + +/* Other architectures wishing to use this simple topology API should fill + in the below functions as appropriate in their own file. */ + +#define cpu_to_node(cpu) (0) + +#ifndef parent_node +#define parent_node(node) (0) +#endif +#ifndef node_to_cpumask +#define node_to_cpumask(node) (cpu_online_map) +#endif +#ifndef node_to_first_cpu +#define node_to_first_cpu(node) (0) +#endif +#ifndef pcibus_to_cpumask +#define pcibus_to_cpumask(bus) (cpu_online_map) +#endif + +/* Cross-node load balancing interval. */ +#ifndef NODE_BALANCE_RATE +#define NODE_BALANCE_RATE 10 +#endif + +#endif /* _ASM_M32R_TOPOLOGY_H */ diff -Nru a/include/asm-m32r/types.h b/include/asm-m32r/types.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/types.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,64 @@ +#ifndef _ASM_M32R_TYPES_H +#define _ASM_M32R_TYPES_H + +#ifndef __ASSEMBLY__ + +/* $Id$ */ + +/* orig : i386 2.4.18 */ + +typedef unsigned short umode_t; + +/* + * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the + * header files exported to user space + */ + +typedef __signed__ char __s8; +typedef unsigned char __u8; + +typedef __signed__ short __s16; +typedef unsigned short __u16; + +typedef __signed__ int __s32; +typedef unsigned int __u32; + +#if defined(__GNUC__) && !defined(__STRICT_ANSI__) +typedef __signed__ long long __s64; +typedef unsigned long long __u64; +#endif +#endif /* __ASSEMBLY__ */ + +/* + * These aren't exported outside the kernel to avoid name space clashes + */ +#ifdef __KERNEL__ + +#define BITS_PER_LONG 32 + +#ifndef __ASSEMBLY__ + +typedef signed char s8; +typedef unsigned char u8; + +typedef signed short s16; +typedef unsigned short u16; + +typedef signed int s32; +typedef unsigned int u32; + +typedef signed long long s64; +typedef unsigned long long u64; + +/* DMA addresses are 32-bits wide. */ + +typedef u32 dma_addr_t; +typedef u64 dma64_addr_t; + +typedef unsigned short kmem_bufctl_t; + +#endif /* __ASSEMBLY__ */ + +#endif /* __KERNEL__ */ + +#endif /* _ASM_M32R_TYPES_H */ diff -Nru a/include/asm-m32r/uaccess.h b/include/asm-m32r/uaccess.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/uaccess.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,752 @@ +#ifndef _ASM_M32R_UACCESS_H +#define _ASM_M32R_UACCESS_H + +/* + * linux/include/asm-m32r/uaccess.h + * + * M32R version. + * Copyright (C) 2004 Hirokazu Takata + */ + +#undef UACCESS_DEBUG + +#ifdef UACCESS_DEBUG +#define UAPRINTK(args...) printk(args) +#else +#define UAPRINTK(args...) +#endif /* UACCESS_DEBUG */ + +/* + * User space memory access functions + */ +#include +#include +#include +#include + +#define VERIFY_READ 0 +#define VERIFY_WRITE 1 + +/* + * The fs value determines whether argument validity checking should be + * performed or not. If get_fs() == USER_DS, checking is performed, with + * get_fs() == KERNEL_DS, checking is bypassed. + * + * For historical reasons, these macros are grossly misnamed. + */ + +#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) }) + +#ifdef CONFIG_MMU +#define KERNEL_DS MAKE_MM_SEG(0xFFFFFFFF) +#define USER_DS MAKE_MM_SEG(PAGE_OFFSET) +#else +#define KERNEL_DS MAKE_MM_SEG(0xFFFFFFFF) +#define USER_DS MAKE_MM_SEG(0xFFFFFFFF) +#endif /* CONFIG_MMU */ + +#define get_ds() (KERNEL_DS) +#ifdef CONFIG_MMU +#define get_fs() (current_thread_info()->addr_limit) +#define set_fs(x) (current_thread_info()->addr_limit = (x)) +#else +static inline mm_segment_t get_fs(void) +{ + return USER_DS; +} + +static inline void set_fs(mm_segment_t s) +{ +} +#endif /* CONFIG_MMU */ + +#define segment_eq(a,b) ((a).seg == (b).seg) + +#define __addr_ok(addr) \ + ((unsigned long)(addr) < (current_thread_info()->addr_limit.seg)) + +/* + * Test whether a block of memory is a valid user space address. + * Returns 0 if the range is valid, nonzero otherwise. + * + * This is equivalent to the following test: + * (u33)addr + (u33)size >= (u33)current->addr_limit.seg + * + * This needs 33-bit arithmetic. We have a carry... + */ +#define __range_ok(addr,size) ({ \ + unsigned long flag, sum; \ + __chk_user_ptr(addr); \ + asm ( \ + " cmpu %1, %1 ; clear cbit\n" \ + " addx %1, %3 ; set cbit if overflow\n" \ + " subx %0, %0\n" \ + " cmpu %4, %1\n" \ + " subx %0, %5\n" \ + : "=&r"(flag), "=r"(sum) \ + : "1"(addr), "r"((int)(size)), \ + "r"(current_thread_info()->addr_limit.seg), "r"(0) \ + : "cbit" ); \ + flag; }) + +/** + * access_ok: - Checks if a user space pointer is valid + * @type: Type of access: %VERIFY_READ or %VERIFY_WRITE. Note that + * %VERIFY_WRITE is a superset of %VERIFY_READ - if it is safe + * to write to a block, it is always safe to read from it. + * @addr: User space pointer to start of block to check + * @size: Size of block to check + * + * Context: User context only. This function may sleep. + * + * Checks if a pointer to a block of memory in user space is valid. + * + * Returns true (nonzero) if the memory block may be valid, false (zero) + * if it is definitely invalid. + * + * Note that, depending on architecture, this function probably just + * checks that the pointer is in the user space range - after calling + * this function, memory access functions may still return -EFAULT. + */ +#ifdef CONFIG_MMU +#define access_ok(type,addr,size) (likely(__range_ok(addr,size) == 0)) +#else +static inline int access_ok(int type, const void *addr, unsigned long size) +{ + extern unsigned long memory_start, memory_end; + unsigned long val = (unsigned long)addr; + + return ((val >= memory_start) && ((val + size) < memory_end)); +} +#endif /* CONFIG_MMU */ + +/** + * verify_area: - Obsolete, use access_ok() + * @type: Type of access: %VERIFY_READ or %VERIFY_WRITE + * @addr: User space pointer to start of block to check + * @size: Size of block to check + * + * Context: User context only. This function may sleep. + * + * This function has been replaced by access_ok(). + * + * Checks if a pointer to a block of memory in user space is valid. + * + * Returns zero if the memory block may be valid, -EFAULT + * if it is definitely invalid. + * + * See access_ok() for more details. + */ +static inline int verify_area(int type, const void __user *addr, + unsigned long size) +{ + return access_ok(type, addr, size) ? 0 : -EFAULT; +} + + +/* + * The exception table consists of pairs of addresses: the first is the + * address of an instruction that is allowed to fault, and the second is + * the address at which the program should continue. No registers are + * modified, so it is entirely up to the continuation code to figure out + * what to do. + * + * All the routines below use bits of fixup code that are out of line + * with the main instruction path. This means when everything is well, + * we don't even have to jump over them. Further, they do not intrude + * on our cache or tlb entries. + */ + +struct exception_table_entry +{ + unsigned long insn, fixup; +}; + +extern int fixup_exception(struct pt_regs *regs); + +/* + * These are the main single-value transfer routines. They automatically + * use the right size if we just have the right pointer type. + * + * This gets kind of ugly. We want to return _two_ values in "get_user()" + * and yet we don't want to do any pointers, because that is too much + * of a performance impact. Thus we have a few rather ugly macros here, + * and hide all the uglyness from the user. + * + * The "__xxx" versions of the user access functions are versions that + * do not verify the address space, that must have been done previously + * with a separate "access_ok()" call (this is used when we do multiple + * accesses to the same area of user memory). + */ + +extern void __get_user_1(void); +extern void __get_user_2(void); +extern void __get_user_4(void); + +#ifndef MODULE +#define __get_user_x(size,ret,x,ptr) \ + __asm__ __volatile__( \ + " mv r0, %0\n" \ + " mv r1, %1\n" \ + " bl __get_user_" #size "\n" \ + " mv %0, r0\n" \ + " mv %1, r1\n" \ + : "=r"(ret), "=r"(x) \ + : "0"(ptr) \ + : "r0", "r1", "r14" ) +#else /* MODULE */ +/* + * Use "jl" instead of "bl" for MODULE + */ +#define __get_user_x(size,ret,x,ptr) \ + __asm__ __volatile__( \ + " mv r0, %0\n" \ + " mv r1, %1\n" \ + " seth lr, #high(__get_user_" #size ")\n" \ + " or3 lr, lr, #low(__get_user_" #size ")\n" \ + " jl lr\n" \ + " mv %0, r0\n" \ + " mv %1, r1\n" \ + : "=r"(ret), "=r"(x) \ + : "0"(ptr) \ + : "r0", "r1", "r14" ) +#endif + +/* Careful: we have to cast the result to the type of the pointer for sign + reasons */ +/** + * get_user: - Get a simple variable from user space. + * @x: Variable to store result. + * @ptr: Source address, in user space. + * + * Context: User context only. This function may sleep. + * + * This macro copies a single simple variable from user space to kernel + * space. It supports simple types like char and int, but not larger + * data types like structures or arrays. + * + * @ptr must have pointer-to-simple-variable type, and the result of + * dereferencing @ptr must be assignable to @x without a cast. + * + * Returns zero on success, or -EFAULT on error. + * On error, the variable @x is set to zero. + */ +#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; \ + case 4: __get_user_x(4,__ret_gu,__val_gu,ptr); break; \ + default: __get_user_x(X,__ret_gu,__val_gu,ptr); break; \ + } \ + (x) = (__typeof__(*(ptr)))__val_gu; \ + __ret_gu; \ +}) + +extern void __put_user_bad(void); + +/** + * put_user: - Write a simple value into user space. + * @x: Value to copy to user space. + * @ptr: Destination address, in user space. + * + * Context: User context only. This function may sleep. + * + * This macro copies a single simple value from kernel space to user + * space. It supports simple types like char and int, but not larger + * data types like structures or arrays. + * + * @ptr must have pointer-to-simple-variable type, and @x must be assignable + * to the result of dereferencing @ptr. + * + * Returns zero on success, or -EFAULT on error. + */ +#define put_user(x,ptr) \ + __put_user_check((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr))) + + +/** + * __get_user: - Get a simple variable from user space, with less checking. + * @x: Variable to store result. + * @ptr: Source address, in user space. + * + * Context: User context only. This function may sleep. + * + * This macro copies a single simple variable from user space to kernel + * space. It supports simple types like char and int, but not larger + * data types like structures or arrays. + * + * @ptr must have pointer-to-simple-variable type, and the result of + * dereferencing @ptr must be assignable to @x without a cast. + * + * Caller must check the pointer with access_ok() before calling this + * function. + * + * Returns zero on success, or -EFAULT on error. + * On error, the variable @x is set to zero. + */ +#define __get_user(x,ptr) \ + __get_user_nocheck((x),(ptr),sizeof(*(ptr))) + + +/** + * __put_user: - Write a simple value into user space, with less checking. + * @x: Value to copy to user space. + * @ptr: Destination address, in user space. + * + * Context: User context only. This function may sleep. + * + * This macro copies a single simple value from kernel space to user + * space. It supports simple types like char and int, but not larger + * data types like structures or arrays. + * + * @ptr must have pointer-to-simple-variable type, and @x must be assignable + * to the result of dereferencing @ptr. + * + * Caller must check the pointer with access_ok() before calling this + * function. + * + * Returns zero on success, or -EFAULT on error. + */ +#define __put_user(x,ptr) \ + __put_user_nocheck((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr))) + +#define __put_user_nocheck(x,ptr,size) \ +({ \ + long __pu_err; \ + __put_user_size((x),(ptr),(size),__pu_err); \ + __pu_err; \ +}) + + +#define __put_user_check(x,ptr,size) \ +({ \ + long __pu_err = -EFAULT; \ + __typeof__(*(ptr)) __user *__pu_addr = (ptr); \ + might_sleep(); \ + if (access_ok(VERIFY_WRITE,__pu_addr,size)) \ + __put_user_size((x),__pu_addr,(size),__pu_err); \ + __pu_err; \ +}) + +#if defined(__LITTLE_ENDIAN__) +#define __put_user_u64(x, addr, err) \ + __asm__ __volatile__( \ + " .fillinsn\n" \ + "1: st %L1,@%2\n" \ + " .fillinsn\n" \ + "2: st %H1,@(4,%2)\n" \ + " .fillinsn\n" \ + "3:\n" \ + ".section .fixup,\"ax\"\n" \ + " .balign 4\n" \ + "4: ldi %0,%3\n" \ + " seth r14,#high(3b)\n" \ + " or3 r14,r14,#low(3b)\n" \ + " jmp r14\n" \ + ".previous\n" \ + ".section __ex_table,\"a\"\n" \ + " .balign 4\n" \ + " .long 1b,4b\n" \ + " .long 2b,4b\n" \ + ".previous" \ + : "=r"(err) \ + : "r"(x), "r"(addr), "i"(-EFAULT), "0"(err) \ + : "r14", "memory") + +#elif defined(__BIG_ENDIAN__) +#define __put_user_u64(x, addr, err) \ + __asm__ __volatile__( \ + " .fillinsn\n" \ + "1: st %H1,@%2\n" \ + " .fillinsn\n" \ + "2: st %L1,@(4,%2)\n" \ + " .fillinsn\n" \ + "3:\n" \ + ".section .fixup,\"ax\"\n" \ + " .balign 4\n" \ + "4: ldi %0,%3\n" \ + " seth r14,#high(3b)\n" \ + " or3 r14,r14,#low(3b)\n" \ + " jmp r14\n" \ + ".previous\n" \ + ".section __ex_table,\"a\"\n" \ + " .balign 4\n" \ + " .long 1b,4b\n" \ + " .long 2b,4b\n" \ + ".previous" \ + : "=r"(err) \ + : "r"(x), "r"(addr), "i"(-EFAULT), "0"(err) \ + : "r14", "memory") +#else +#error no endian defined +#endif + +#define __put_user_size(x,ptr,size,retval) \ +do { \ + retval = 0; \ + __chk_user_ptr(ptr); \ + switch (size) { \ + case 1: __put_user_asm(x,ptr,retval,"b"); break; \ + case 2: __put_user_asm(x,ptr,retval,"h"); break; \ + case 4: __put_user_asm(x,ptr,retval,""); break; \ + case 8: __put_user_u64((__typeof__(*ptr))(x),ptr,retval); break;\ + default: __put_user_bad(); \ + } \ +} while (0) + +struct __large_struct { unsigned long buf[100]; }; +#define __m(x) (*(struct __large_struct *)(x)) + +/* + * Tell gcc we read from memory instead of writing: this is because + * we do not write to any memory gcc knows about, so there are no + * aliasing issues. + */ +#define __put_user_asm(x, addr, err, itype) \ + __asm__ __volatile__( \ + " .fillinsn\n" \ + "1: st"itype" %1,@%2\n" \ + " .fillinsn\n" \ + "2:\n" \ + ".section .fixup,\"ax\"\n" \ + " .balign 4\n" \ + "3: ldi %0,%3\n" \ + " seth r14,#high(2b)\n" \ + " or3 r14,r14,#low(2b)\n" \ + " jmp r14\n" \ + ".previous\n" \ + ".section __ex_table,\"a\"\n" \ + " .balign 4\n" \ + " .long 1b,3b\n" \ + ".previous" \ + : "=r"(err) \ + : "r"(x), "r"(addr), "i"(-EFAULT), "0"(err) \ + : "r14", "memory") + +#define __get_user_nocheck(x,ptr,size) \ +({ \ + long __gu_err, __gu_val; \ + __get_user_size(__gu_val,(ptr),(size),__gu_err); \ + (x) = (__typeof__(*(ptr)))__gu_val; \ + __gu_err; \ +}) + +extern long __get_user_bad(void); + +#define __get_user_size(x,ptr,size,retval) \ +do { \ + retval = 0; \ + __chk_user_ptr(ptr); \ + switch (size) { \ + case 1: __get_user_asm(x,ptr,retval,"ub"); break; \ + case 2: __get_user_asm(x,ptr,retval,"uh"); break; \ + case 4: __get_user_asm(x,ptr,retval,""); break; \ + default: (x) = __get_user_bad(); \ + } \ +} while (0) + +#define __get_user_asm(x, addr, err, itype) \ + __asm__ __volatile__( \ + " .fillinsn\n" \ + "1: ld"itype" %1,@%2\n" \ + " .fillinsn\n" \ + "2:\n" \ + ".section .fixup,\"ax\"\n" \ + " .balign 4\n" \ + "3: ldi %0,%3\n" \ + " seth r14,#high(2b)\n" \ + " or3 r14,r14,#low(2b)\n" \ + " jmp r14\n" \ + ".previous\n" \ + ".section __ex_table,\"a\"\n" \ + " .balign 4\n" \ + " .long 1b,3b\n" \ + ".previous" \ + : "=r"(err), "=&r"(x) \ + : "r"(addr), "i"(-EFAULT), "0"(err) \ + : "r14", "memory") + +/* + * Here we special-case 1, 2 and 4-byte copy_*_user invocations. On a fault + * we return the initial request size (1, 2 or 4), as copy_*_user should do. + * If a store crosses a page boundary and gets a fault, the m32r will not write + * anything, so this is accurate. + */ + + +/* + * Copy To/From Userspace + */ + +/* Generic arbitrary sized copy. */ +/* Return the number of bytes NOT copied. */ +#define __copy_user(to,from,size) \ +do { \ + unsigned long __dst, __src, __c; \ + __asm__ __volatile__ ( \ + " mv r14, %0\n" \ + " or r14, %1\n" \ + " beq %0, %1, 9f\n" \ + " beqz %2, 9f\n" \ + " and3 r14, r14, #3\n" \ + " bnez r14, 2f\n" \ + " and3 %2, %2, #3\n" \ + " beqz %3, 2f\n" \ + " addi %0, #-4 ; word_copy \n" \ + " .fillinsn\n" \ + "0: ld r14, @%1+\n" \ + " addi %3, #-1\n" \ + " .fillinsn\n" \ + "1: st r14, @+%0\n" \ + " bnez %3, 0b\n" \ + " beqz %2, 9f\n" \ + " addi %0, #4\n" \ + " .fillinsn\n" \ + "2: ldb r14, @%1 ; byte_copy \n" \ + " .fillinsn\n" \ + "3: stb r14, @%0\n" \ + " addi %1, #1\n" \ + " addi %2, #-1\n" \ + " addi %0, #1\n" \ + " bnez %2, 2b\n" \ + " .fillinsn\n" \ + "9:\n" \ + ".section .fixup,\"ax\"\n" \ + " .balign 4\n" \ + "5: addi %3, #1\n" \ + " addi %1, #-4\n" \ + " .fillinsn\n" \ + "6: slli %3, #2\n" \ + " add %2, %3\n" \ + " addi %0, #4\n" \ + " .fillinsn\n" \ + "7: seth r14, #high(9b)\n" \ + " or3 r14, r14, #low(9b)\n" \ + " jmp r14\n" \ + ".previous\n" \ + ".section __ex_table,\"a\"\n" \ + " .balign 4\n" \ + " .long 0b,6b\n" \ + " .long 1b,5b\n" \ + " .long 2b,9b\n" \ + " .long 3b,9b\n" \ + ".previous\n" \ + : "=&r"(__dst), "=&r"(__src), "=&r"(size), "=&r"(__c) \ + : "0"(to), "1"(from), "2"(size), "3"(size / 4) \ + : "r14", "memory"); \ +} while (0) + +#define __copy_user_zeroing(to,from,size) \ +do { \ + unsigned long __dst, __src, __c; \ + __asm__ __volatile__ ( \ + " mv r14, %0\n" \ + " or r14, %1\n" \ + " beq %0, %1, 9f\n" \ + " beqz %2, 9f\n" \ + " and3 r14, r14, #3\n" \ + " bnez r14, 2f\n" \ + " and3 %2, %2, #3\n" \ + " beqz %3, 2f\n" \ + " addi %0, #-4 ; word_copy \n" \ + " .fillinsn\n" \ + "0: ld r14, @%1+\n" \ + " addi %3, #-1\n" \ + " .fillinsn\n" \ + "1: st r14, @+%0\n" \ + " bnez %3, 0b\n" \ + " beqz %2, 9f\n" \ + " addi %0, #4\n" \ + " .fillinsn\n" \ + "2: ldb r14, @%1 ; byte_copy \n" \ + " .fillinsn\n" \ + "3: stb r14, @%0\n" \ + " addi %1, #1\n" \ + " addi %2, #-1\n" \ + " addi %0, #1\n" \ + " bnez %2, 2b\n" \ + " .fillinsn\n" \ + "9:\n" \ + ".section .fixup,\"ax\"\n" \ + " .balign 4\n" \ + "5: addi %3, #1\n" \ + " addi %1, #-4\n" \ + " .fillinsn\n" \ + "6: slli %3, #2\n" \ + " add %2, %3\n" \ + " addi %0, #4\n" \ + " .fillinsn\n" \ + "7: ldi r14, #0 ; store zero \n" \ + " .fillinsn\n" \ + "8: addi %2, #-1\n" \ + " stb r14, @%0 ; ACE? \n" \ + " addi %0, #1\n" \ + " bnez %2, 8b\n" \ + " seth r14, #high(9b)\n" \ + " or3 r14, r14, #low(9b)\n" \ + " jmp r14\n" \ + ".previous\n" \ + ".section __ex_table,\"a\"\n" \ + " .balign 4\n" \ + " .long 0b,6b\n" \ + " .long 1b,5b\n" \ + " .long 2b,7b\n" \ + " .long 3b,7b\n" \ + ".previous\n" \ + : "=&r"(__dst), "=&r"(__src), "=&r"(size), "=&r"(__c) \ + : "0"(to), "1"(from), "2"(size), "3"(size / 4) \ + : "r14", "memory"); \ +} while (0) + + +/* We let the __ versions of copy_from/to_user inline, because they're often + * used in fast paths and have only a small space overhead. + */ +static inline unsigned long __generic_copy_from_user_nocheck(void *to, + const void __user *from, unsigned long n) +{ + __copy_user_zeroing(to,from,n); + return n; +} + +static inline unsigned long __generic_copy_to_user_nocheck(void __user *to, + const void *from, unsigned long n) +{ + __copy_user(to,from,n); + return n; +} + +unsigned long __generic_copy_to_user(void *, const void *, unsigned long); +unsigned long __generic_copy_from_user(void *, const void *, unsigned long); + +/** + * __copy_to_user: - Copy a block of data into user space, with less checking. + * @to: Destination address, in user space. + * @from: Source address, in kernel space. + * @n: Number of bytes to copy. + * + * Context: User context only. This function may sleep. + * + * Copy data from kernel space to user space. Caller must check + * the specified block with access_ok() before calling this function. + * + * Returns number of bytes that could not be copied. + * On success, this will be zero. + */ +#define __copy_to_user(to,from,n) \ + __generic_copy_to_user_nocheck((to),(from),(n)) + +#define __copy_to_user_inatomic __copy_to_user +#define __copy_from_user_inatomic __copy_from_user + +/** + * copy_to_user: - Copy a block of data into user space. + * @to: Destination address, in user space. + * @from: Source address, in kernel space. + * @n: Number of bytes to copy. + * + * Context: User context only. This function may sleep. + * + * Copy data from kernel space to user space. + * + * Returns number of bytes that could not be copied. + * On success, this will be zero. + */ +#define copy_to_user(to,from,n) \ +({ \ + might_sleep(); \ + __generic_copy_to_user((to),(from),(n)); \ +}) + +/** + * __copy_from_user: - Copy a block of data from user space, with less checking. * @to: Destination address, in kernel space. + * @from: Source address, in user space. + * @n: Number of bytes to copy. + * + * Context: User context only. This function may sleep. + * + * Copy data from user space to kernel space. Caller must check + * the specified block with access_ok() before calling this function. + * + * Returns number of bytes that could not be copied. + * On success, this will be zero. + * + * If some data could not be copied, this function will pad the copied + * data to the requested size using zero bytes. + */ +#define __copy_from_user(to,from,n) \ + __generic_copy_from_user_nocheck((to),(from),(n)) + +/** + * copy_from_user: - Copy a block of data from user space. + * @to: Destination address, in kernel space. + * @from: Source address, in user space. + * @n: Number of bytes to copy. + * + * Context: User context only. This function may sleep. + * + * Copy data from user space to kernel space. + * + * Returns number of bytes that could not be copied. + * On success, this will be zero. + * + * If some data could not be copied, this function will pad the copied + * data to the requested size using zero bytes. + */ +#define copy_from_user(to,from,n) \ +({ \ + might_sleep(); \ +__generic_copy_from_user((to),(from),(n)); \ +}) + +long __must_check strncpy_from_user(char *dst, const char __user *src, + long count); +long __must_check __strncpy_from_user(char *dst, + const char __user *src, long count); + +/** + * __clear_user: - Zero a block of memory in user space, with less checking. + * @to: Destination address, in user space. + * @n: Number of bytes to zero. + * + * Zero a block of memory in user space. Caller must check + * the specified block with access_ok() before calling this function. + * + * Returns number of bytes that could not be cleared. + * On success, this will be zero. + */ +unsigned long __clear_user(void __user *mem, unsigned long len); + +/** + * clear_user: - Zero a block of memory in user space. + * @to: Destination address, in user space. + * @n: Number of bytes to zero. + * + * Zero a block of memory in user space. Caller must check + * the specified block with access_ok() before calling this function. + * + * Returns number of bytes that could not be cleared. + * On success, this will be zero. + */ +unsigned long clear_user(void __user *mem, unsigned long len); + +/** + * strlen_user: - Get the size of a string in user space. + * @str: The string to measure. + * + * Context: User context only. This function may sleep. + * + * Get the size of a NUL-terminated string in user space. + * + * Returns the size of the string INCLUDING the terminating NUL. + * On exception, returns 0. + * + * If there is a limit on the length of a valid string, you may wish to + * consider using strnlen_user() instead. + */ +#define strlen_user(str) strnlen_user(str, ~0UL >> 1) +long strnlen_user(const char __user *str, long n); + +#endif /* _ASM_M32R_UACCESS_H */ diff -Nru a/include/asm-m32r/ucontext.h b/include/asm-m32r/ucontext.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/ucontext.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,14 @@ +#ifndef _ASM_M32R_UCONTEXT_H +#define _ASM_M32R_UCONTEXT_H + +/* orig : i386 2.4.18 */ + +struct ucontext { + unsigned long uc_flags; + struct ucontext *uc_link; + stack_t uc_stack; + struct sigcontext uc_mcontext; + sigset_t uc_sigmask; /* mask last for extensibility */ +}; + +#endif /* _ASM_M32R_UCONTEXT_H */ diff -Nru a/include/asm-m32r/unaligned.h b/include/asm-m32r/unaligned.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/unaligned.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,25 @@ +#ifndef _ASM_M32R_UNALIGNED_H +#define _ASM_M32R_UNALIGNED_H + +/* $Id$ */ + +/* orig : generic 2.4.18 */ + +/* + * For the benefit of those who are trying to port Linux to another + * architecture, here are some C-language equivalents. + */ + +#include + + +#define get_unaligned(ptr) \ + ({ __typeof__(*(ptr)) __tmp; memmove(&__tmp, (ptr), sizeof(*(ptr))); __tmp; }) + +#define put_unaligned(val, ptr) \ + ({ __typeof__(*(ptr)) __tmp = (val); \ + memmove((ptr), &__tmp, sizeof(*(ptr))); \ + (void)0; }) + + +#endif /* _ASM_M32R_UNALIGNED_H */ diff -Nru a/include/asm-m32r/unistd.h b/include/asm-m32r/unistd.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/unistd.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,492 @@ +#ifndef _ASM_M32R_UNISTD_H +#define _ASM_M32R_UNISTD_H + +/* $Id$ */ + +#include /* SYSCALL_* */ + +/* + * This file contains the system call numbers. + */ + +#define __NR_restart_syscall 0 +#define __NR_exit 1 +#define __NR_fork 2 +#define __NR_read 3 +#define __NR_write 4 +#define __NR_open 5 +#define __NR_close 6 +#define __NR_waitpid 7 +#define __NR_creat 8 +#define __NR_link 9 +#define __NR_unlink 10 +#define __NR_execve 11 +#define __NR_chdir 12 +#define __NR_time 13 +#define __NR_mknod 14 +#define __NR_chmod 15 +#define __NR_lchown 16 +#define __NR_break 17 +#define __NR_oldstat 18 +#define __NR_lseek 19 +#define __NR_getpid 20 +#define __NR_mount 21 +#define __NR_umount 22 +#define __NR_setuid 23 +#define __NR_getuid 24 +#define __NR_stime 25 +#define __NR_ptrace 26 +#define __NR_alarm 27 +#define __NR_oldfstat 28 +#define __NR_pause 29 +#define __NR_utime 30 +#define __NR_cacheflush 31 /* old #define __NR_stty 31*/ +#define __NR_cachectl 32 /* old #define __NR_gtty 32*/ +#define __NR_access 33 +#define __NR_nice 34 +#define __NR_ftime 35 +#define __NR_sync 36 +#define __NR_kill 37 +#define __NR_rename 38 +#define __NR_mkdir 39 +#define __NR_rmdir 40 +#define __NR_dup 41 +#define __NR_pipe 42 +#define __NR_times 43 +#define __NR_prof 44 +#define __NR_brk 45 +#define __NR_setgid 46 +#define __NR_getgid 47 +#define __NR_signal 48 +#define __NR_geteuid 49 +#define __NR_getegid 50 +#define __NR_acct 51 +#define __NR_umount2 52 +#define __NR_lock 53 +#define __NR_ioctl 54 +#define __NR_fcntl 55 +#define __NR_mpx 56 +#define __NR_setpgid 57 +#define __NR_ulimit 58 +#define __NR_oldolduname 59 +#define __NR_umask 60 +#define __NR_chroot 61 +#define __NR_ustat 62 +#define __NR_dup2 63 +#define __NR_getppid 64 +#define __NR_getpgrp 65 +#define __NR_setsid 66 +#define __NR_sigaction 67 +#define __NR_sgetmask 68 +#define __NR_ssetmask 69 +#define __NR_setreuid 70 +#define __NR_setregid 71 +#define __NR_sigsuspend 72 +#define __NR_sigpending 73 +#define __NR_sethostname 74 +#define __NR_setrlimit 75 +#define __NR_getrlimit 76 /* Back compatible 2Gig limited rlimit */ +#define __NR_getrusage 77 +#define __NR_gettimeofday 78 +#define __NR_settimeofday 79 +#define __NR_getgroups 80 +#define __NR_setgroups 81 +#define __NR_select 82 +#define __NR_symlink 83 +#define __NR_oldlstat 84 +#define __NR_readlink 85 +#define __NR_uselib 86 +#define __NR_swapon 87 +#define __NR_reboot 88 +#define __NR_readdir 89 +#define __NR_mmap 90 +#define __NR_munmap 91 +#define __NR_truncate 92 +#define __NR_ftruncate 93 +#define __NR_fchmod 94 +#define __NR_fchown 95 +#define __NR_getpriority 96 +#define __NR_setpriority 97 +#define __NR_profil 98 +#define __NR_statfs 99 +#define __NR_fstatfs 100 +#define __NR_ioperm 101 +#define __NR_socketcall 102 +#define __NR_syslog 103 +#define __NR_setitimer 104 +#define __NR_getitimer 105 +#define __NR_stat 106 +#define __NR_lstat 107 +#define __NR_fstat 108 +#define __NR_olduname 109 +#define __NR_iopl 110 +#define __NR_vhangup 111 +#define __NR_idle 112 +#define __NR_vm86old 113 +#define __NR_wait4 114 +#define __NR_swapoff 115 +#define __NR_sysinfo 116 +#define __NR_ipc 117 +#define __NR_fsync 118 +#define __NR_sigreturn 119 +#define __NR_clone 120 +#define __NR_setdomainname 121 +#define __NR_uname 122 +#define __NR_modify_ldt 123 +#define __NR_adjtimex 124 +#define __NR_mprotect 125 +#define __NR_sigprocmask 126 +#define __NR_create_module 127 +#define __NR_init_module 128 +#define __NR_delete_module 129 +#define __NR_get_kernel_syms 130 +#define __NR_quotactl 131 +#define __NR_getpgid 132 +#define __NR_fchdir 133 +#define __NR_bdflush 134 +#define __NR_sysfs 135 +#define __NR_personality 136 +#define __NR_afs_syscall 137 /* Syscall for Andrew File System */ +#define __NR_setfsuid 138 +#define __NR_setfsgid 139 +#define __NR__llseek 140 +#define __NR_getdents 141 +#define __NR__newselect 142 +#define __NR_flock 143 +#define __NR_msync 144 +#define __NR_readv 145 +#define __NR_writev 146 +#define __NR_getsid 147 +#define __NR_fdatasync 148 +#define __NR__sysctl 149 +#define __NR_mlock 150 +#define __NR_munlock 151 +#define __NR_mlockall 152 +#define __NR_munlockall 153 +#define __NR_sched_setparam 154 +#define __NR_sched_getparam 155 +#define __NR_sched_setscheduler 156 +#define __NR_sched_getscheduler 157 +#define __NR_sched_yield 158 +#define __NR_sched_get_priority_max 159 +#define __NR_sched_get_priority_min 160 +#define __NR_sched_rr_get_interval 161 +#define __NR_nanosleep 162 +#define __NR_mremap 163 +#define __NR_setresuid 164 +#define __NR_getresuid 165 +#define __NR_tas 166 +#define __NR_query_module 167 +#define __NR_poll 168 +#define __NR_nfsservctl 169 +#define __NR_setresgid 170 +#define __NR_getresgid 171 +#define __NR_prctl 172 +#define __NR_rt_sigreturn 173 +#define __NR_rt_sigaction 174 +#define __NR_rt_sigprocmask 175 +#define __NR_rt_sigpending 176 +#define __NR_rt_sigtimedwait 177 +#define __NR_rt_sigqueueinfo 178 +#define __NR_rt_sigsuspend 179 +#define __NR_pread64 180 +#define __NR_pwrite64 181 +#define __NR_chown 182 +#define __NR_getcwd 183 +#define __NR_capget 184 +#define __NR_capset 185 +#define __NR_sigaltstack 186 +#define __NR_sendfile 187 +#define __NR_getpmsg 188 /* some people actually want streams */ +#define __NR_putpmsg 189 /* some people actually want streams */ +#define __NR_vfork 190 +#define __NR_ugetrlimit 191 /* SuS compliant getrlimit */ +#define __NR_mmap2 192 +#define __NR_truncate64 193 +#define __NR_ftruncate64 194 +#define __NR_stat64 195 +#define __NR_lstat64 196 +#define __NR_fstat64 197 +#define __NR_lchown32 198 +#define __NR_getuid32 199 +#define __NR_getgid32 200 +#define __NR_geteuid32 201 +#define __NR_getegid32 202 +#define __NR_setreuid32 203 +#define __NR_setregid32 204 +#define __NR_getgroups32 205 +#define __NR_setgroups32 206 +#define __NR_fchown32 207 +#define __NR_setresuid32 208 +#define __NR_getresuid32 209 +#define __NR_setresgid32 210 +#define __NR_getresgid32 211 +#define __NR_chown32 212 +#define __NR_setuid32 213 +#define __NR_setgid32 214 +#define __NR_setfsuid32 215 +#define __NR_setfsgid32 216 +#define __NR_pivot_root 217 +#define __NR_mincore 218 +#define __NR_madvise 219 +#define __NR_madvise1 219 /* delete when C lib stub is removed */ +#define __NR_getdents64 220 +#define __NR_fcntl64 221 +#define __NR_security 223 /* syscall for security modules */ +#define __NR_gettid 224 +#define __NR_readahead 225 +#define __NR_setxattr 226 +#define __NR_lsetxattr 227 +#define __NR_fsetxattr 228 +#define __NR_getxattr 229 +#define __NR_lgetxattr 230 +#define __NR_fgetxattr 231 +#define __NR_listxattr 232 +#define __NR_llistxattr 233 +#define __NR_flistxattr 234 +#define __NR_removexattr 235 +#define __NR_lremovexattr 236 +#define __NR_fremovexattr 237 +#define __NR_tkill 238 +#define __NR_sendfile64 239 +#define __NR_futex 240 +#define __NR_sched_setaffinity 241 +#define __NR_sched_getaffinity 242 +#define __NR_set_thread_area 243 +#define __NR_get_thread_area 244 +#define __NR_io_setup 245 +#define __NR_io_destroy 246 +#define __NR_io_getevents 247 +#define __NR_io_submit 248 +#define __NR_io_cancel 249 +#define __NR_fadvise64 250 + +#define __NR_exit_group 252 +#define __NR_lookup_dcookie 253 +#define __NR_epoll_create 254 +#define __NR_epoll_ctl 255 +#define __NR_epoll_wait 256 +#define __NR_remap_file_pages 257 +#define __NR_set_tid_address 258 +#define __NR_timer_create 259 +#define __NR_timer_settime (__NR_timer_create+1) +#define __NR_timer_gettime (__NR_timer_create+2) +#define __NR_timer_getoverrun (__NR_timer_create+3) +#define __NR_timer_delete (__NR_timer_create+4) +#define __NR_clock_settime (__NR_timer_create+5) +#define __NR_clock_gettime (__NR_timer_create+6) +#define __NR_clock_getres (__NR_timer_create+7) +#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_sys_kexec_load 283 +#define __NR_waitid 284 +#define __NR_perfctr_info 285 +#define __NR_vperfctr_open (__NR_perfctr_info+1) +#define __NR_vperfctr_control (__NR_perfctr_info+2) +#define __NR_vperfctr_unlink (__NR_perfctr_info+3) +#define __NR_vperfctr_iresume (__NR_perfctr_info+4) +#define __NR_vperfctr_read (__NR_perfctr_info+5) +#define __NR_add_key 291 +#define __NR_request_key 292 +#define __NR_keyctl 293 + +#define NR_syscalls 294 + +/* user-visible error numbers are in the range -1 - -128: see + * + */ + +#define __syscall_return(type, res) \ +do { \ + if ((unsigned long)(res) >= (unsigned long)(-(128 + 1))) { \ + /* Avoid using "res" which is declared to be in register r0; \ + errno might expand to a function call and clobber it. */ \ + int __err = -(res); \ + errno = __err; \ + res = -1; \ + } \ + return (type) (res); \ +} while (0) + +#define _syscall0(type,name) \ +type name(void) \ +{ \ +register long __scno __asm__ ("r7") = __NR_##name; \ +register long __res __asm__("r0"); \ +__asm__ __volatile__ (\ + "trap #" SYSCALL_VECTOR \ + : "=r" (__res) \ + : "r" (__scno) \ + : "memory"); \ +__syscall_return(type,__res); \ +} + +#define _syscall1(type,name,type1,arg1) \ +type name(type1 arg1) \ +{ \ +register long __scno __asm__ ("r7") = __NR_##name; \ +register long __res __asm__ ("r0") = (long)(arg1); \ +__asm__ __volatile__ (\ + "trap #" SYSCALL_VECTOR \ + : "=r" (__res) \ + : "r" (__scno), "0" (__res) \ + : "memory"); \ +__syscall_return(type,__res); \ +} + +#define _syscall2(type,name,type1,arg1,type2,arg2) \ +type name(type1 arg1,type2 arg2) \ +{ \ +register long __scno __asm__ ("r7") = __NR_##name; \ +register long __arg2 __asm__ ("r1") = (long)(arg2); \ +register long __res __asm__ ("r0") = (long)(arg1); \ +__asm__ __volatile__ (\ + "trap #" SYSCALL_VECTOR \ + : "=r" (__res) \ + : "r" (__scno), "0" (__res), "r" (__arg2) \ + : "memory"); \ +__syscall_return(type,__res); \ +} + +#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ +type name(type1 arg1,type2 arg2,type3 arg3) \ +{ \ +register long __scno __asm__ ("r7") = __NR_##name; \ +register long __arg3 __asm__ ("r2") = (long)(arg3); \ +register long __arg2 __asm__ ("r1") = (long)(arg2); \ +register long __res __asm__ ("r0") = (long)(arg1); \ +__asm__ __volatile__ (\ + "trap #" SYSCALL_VECTOR \ + : "=r" (__res) \ + : "r" (__scno), "0" (__res), "r" (__arg2), \ + "r" (__arg3) \ + : "memory"); \ +__syscall_return(type,__res); \ +} + +#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ +type name(type1 arg1,type2 arg2,type3 arg3,type4 arg4) \ +{ \ +register long __scno __asm__ ("r7") = __NR_##name; \ +register long __arg4 __asm__ ("r3") = (long)(arg4); \ +register long __arg3 __asm__ ("r2") = (long)(arg3); \ +register long __arg2 __asm__ ("r1") = (long)(arg2); \ +register long __res __asm__ ("r0") = (long)(arg1); \ +__asm__ __volatile__ (\ + "trap #" SYSCALL_VECTOR \ + : "=r" (__res) \ + : "r" (__scno), "0" (__res), "r" (__arg2), \ + "r" (__arg3), "r" (__arg4) \ + : "memory"); \ +__syscall_return(type,__res); \ +} + +#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ + type5,arg5) \ +type name(type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \ +{ \ +register long __scno __asm__ ("r7") = __NR_##name; \ +register long __arg5 __asm__ ("r4") = (long)(arg5); \ +register long __arg4 __asm__ ("r3") = (long)(arg4); \ +register long __arg3 __asm__ ("r2") = (long)(arg3); \ +register long __arg2 __asm__ ("r1") = (long)(arg2); \ +register long __res __asm__ ("r0") = (long)(arg1); \ +__asm__ __volatile__ (\ + "trap #" SYSCALL_VECTOR \ + : "=r" (__res) \ + : "r" (__scno), "0" (__res), "r" (__arg2), \ + "r" (__arg3), "r" (__arg4), "r" (__arg5) \ + : "memory"); \ +__syscall_return(type,__res); \ +} + +#ifdef __KERNEL__ +#define __ARCH_WANT_IPC_PARSE_VERSION +#define __ARCH_WANT_OLD_READDIR +#define __ARCH_WANT_OLD_STAT +#define __ARCH_WANT_STAT64 +#define __ARCH_WANT_SYS_ALARM +#define __ARCH_WANT_SYS_GETHOSTNAME +#define __ARCH_WANT_SYS_PAUSE +#define __ARCH_WANT_SYS_SGETMASK +#define __ARCH_WANT_SYS_SIGNAL +#define __ARCH_WANT_SYS_TIME +#define __ARCH_WANT_SYS_UTIME +#define __ARCH_WANT_SYS_WAITPID +#define __ARCH_WANT_SYS_SOCKETCALL +#define __ARCH_WANT_SYS_FADVISE64 +#define __ARCH_WANT_SYS_GETPGRP +#define __ARCH_WANT_SYS_LLSEEK +#define __ARCH_WANT_SYS_NICE +#define __ARCH_WANT_SYS_OLD_GETRLIMIT +#define __ARCH_WANT_SYS_OLDUMOUNT +#define __ARCH_WANT_SYS_SIGPENDING +#define __ARCH_WANT_SYS_SIGPROCMASK +#define __ARCH_WANT_SYS_RT_SIGACTION +#endif + +#ifdef __KERNEL_SYSCALLS__ + +#include +#include +#include +#include + +/* + * we need this inline - forking from kernel space will result + * in NO COPY ON WRITE (!!!), until an execve is executed. This + * is no problem, but for the stack. This is handled by not letting + * main() use the stack at all after fork(). Thus, no function + * calls - which means inline code for fork too, as otherwise we + * would use the stack upon exit from 'fork()'. + * + * Actually only pause and fork are needed inline, so that there + * won't be any messing with the stack from main(), but we define + * some others too. + */ +static __inline__ _syscall3(int,execve,const char *,file,char **,argv,char **,envp) + +asmlinkage int sys_modify_ldt(int func, void __user *ptr, unsigned long bytecount); +asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, + unsigned long prot, unsigned long flags, + unsigned long fd, unsigned long pgoff); +asmlinkage int sys_execve(struct pt_regs regs); +asmlinkage int sys_clone(struct pt_regs regs); +asmlinkage int sys_fork(struct pt_regs regs); +asmlinkage int sys_vfork(struct pt_regs regs); +asmlinkage int sys_pipe(unsigned long __user *fildes); +asmlinkage int sys_ptrace(long request, long pid, long addr, long data); +asmlinkage long sys_iopl(unsigned long unused); +struct sigaction; +asmlinkage long sys_rt_sigaction(int sig, + const struct sigaction __user *act, + struct sigaction __user *oact, + size_t sigsetsize); + +#endif /* __KERNEL_SYSCALLS__ */ + +/* + * "Conditional" syscalls + * + * What we want is __attribute__((weak,alias("sys_ni_syscall"))), + * but it doesn't work on all toolchains, so we just do it by hand + */ +#ifndef cond_syscall +#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall"); +#endif + +#endif /* _ASM_M32R_UNISTD_H */ diff -Nru a/include/asm-m32r/user.h b/include/asm-m32r/user.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/user.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,59 @@ +#ifndef _ASM_M32R_USER_H +#define _ASM_M32R_USER_H + +/* $Id$ */ + +/* orig : sh 2.4.18 + * mod : remove fpu registers + */ + +#include +#include +#include +#include + +/* + * Core file format: The core file is written in such a way that gdb + * can understand it and provide useful information to the user (under + * linux we use the `trad-core' bfd). + * + * The actual file contents are as follows: + * UPAGE: 1 page consisting of a user struct that tells gdb + * what is present in the file. Directly after this is a + * copy of the task_struct, which is currently not used by gdb, + * but it may come in handy at some point. All of the registers + * are stored as part of the upage. The upage should always be + * only one page. + * DATA: The data area is stored. We use current->end_text to + * current->brk to pick up all of the user variables, plus any memory + * that may have been sbrk'ed. No attempt is made to determine if a + * page is demand-zero or if a page is totally unused, we just cover + * the entire range. All of the addresses are rounded in such a way + * that an integral number of pages is written. + * STACK: We need the stack information in order to get a meaningful + * backtrace. We need to write the data from usp to + * current->start_stack, so we round each of these off in order to be + * able to write an integer number of pages. + */ + +struct user { + struct pt_regs regs; /* entire machine state */ + size_t u_tsize; /* text size (pages) */ + size_t u_dsize; /* data size (pages) */ + size_t u_ssize; /* stack size (pages) */ + unsigned long start_code; /* text starting address */ + unsigned long start_data; /* data starting address */ + unsigned long start_stack; /* stack starting address */ + long int signal; /* signal causing core dump */ + struct regs * u_ar0; /* help gdb find registers */ + unsigned long magic; /* identifies a core file */ + char u_comm[32]; /* user command name */ +}; + +#define NBPG PAGE_SIZE +#define UPAGES 1 +#define HOST_TEXT_START_ADDR (u.start_code) +#define HOST_DATA_START_ADDR (u.start_data) +#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG) + +#endif /* _ASM_M32R_USER_H */ diff -Nru a/include/asm-m32r/vga.h b/include/asm-m32r/vga.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/vga.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,22 @@ +#ifndef _ASM_M32R_VGA_H +#define _ASM_M32R_VGA_H + +/* $Id$ */ + +/* + * Access to VGA videoram + * + * (c) 1998 Martin Mares + */ + +/* + * On the PC, we can just recalculate addresses and then + * access the videoram directly without any black magic. + */ + +#define VGA_MAP_MEM(x) (unsigned long)phys_to_virt(x) + +#define vga_readb(x) (*(x)) +#define vga_writeb(x,y) (*(y) = (x)) + +#endif /* _ASM_M32R_VGA_H */ diff -Nru a/include/asm-m32r/xor.h b/include/asm-m32r/xor.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-m32r/xor.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,8 @@ +#ifndef _ASM_M32R_XOR_H +#define _ASM_M32R_XOR_H + +/* $Id$ */ + +#include + +#endif /* _ASM_M32R_XOR_H */ diff -Nru a/include/asm-m68k/cacheflush.h b/include/asm-m68k/cacheflush.h --- a/include/asm-m68k/cacheflush.h 2004-09-26 10:25:56 -07:00 +++ b/include/asm-m68k/cacheflush.h 2004-09-26 10:25:56 -07:00 @@ -132,10 +132,18 @@ #define flush_dcache_mmap_unlock(mapping) do { } while (0) #define flush_icache_page(vma, page) __flush_page_to_ram(page_address(page)) #define flush_icache_user_range(vma,pg,adr,len) do { } while (0) + #define copy_to_user_page(vma, page, vaddr, dst, src, len) \ - memcpy(dst, src, len) + do { \ + flush_cache_page(vma, vaddr); \ + memcpy(dst, src, len); \ + } while (0) + #define copy_from_user_page(vma, page, vaddr, dst, src, len) \ - memcpy(dst, src, len) + do { \ + flush_cache_page(vma, vaddr); \ + memcpy(dst, src, len); \ + } while (0) extern void flush_icache_range(unsigned long address, unsigned long endaddr); diff -Nru a/include/asm-mips/dma-mapping.h b/include/asm-mips/dma-mapping.h --- a/include/asm-mips/dma-mapping.h 2004-09-26 10:25:56 -07:00 +++ b/include/asm-mips/dma-mapping.h 2004-09-26 10:25:56 -07:00 @@ -1,7 +1,6 @@ #ifndef _ASM_DMA_MAPPING_H #define _ASM_DMA_MAPPING_H -#include #include #include diff -Nru a/include/asm-mips/siginfo.h b/include/asm-mips/siginfo.h --- a/include/asm-mips/siginfo.h 2004-09-26 10:25:56 -07:00 +++ b/include/asm-mips/siginfo.h 2004-09-26 10:25:56 -07:00 @@ -47,8 +47,8 @@ struct { pid_t _pid; /* which child */ uid_t _uid; /* sender's uid */ - clock_t _utime; int _status; /* exit code */ + clock_t _utime; clock_t _stime; } _sigchld; diff -Nru a/include/asm-mips/socket.h b/include/asm-mips/socket.h --- a/include/asm-mips/socket.h 2004-09-26 10:25:57 -07:00 +++ b/include/asm-mips/socket.h 2004-09-26 10:25:57 -07:00 @@ -68,4 +68,31 @@ #define SO_PEERSEC 30 +/** sock_type - Socket types + * + * Please notice that for binary compat reasons MIPS has to + * override the enum sock_type in include/linux/net.h, so + * we define ARCH_HAS_SOCKET_TYPES here. + * + * @SOCK_DGRAM - datagram (conn.less) socket + * @SOCK_STREAM - stream (connection) socket + * @SOCK_RAW - raw socket + * @SOCK_RDM - reliably-delivered message + * @SOCK_SEQPACKET - sequential packet socket + * @SOCK_PACKET - linux specific way of getting packets at the dev level. + * For writing rarp and other similar things on the user level. + */ +enum sock_type { + SOCK_DGRAM = 1, + SOCK_STREAM = 2, + SOCK_RAW = 3, + SOCK_RDM = 4, + SOCK_SEQPACKET = 5, + SOCK_PACKET = 10, +}; + +#define SOCK_MAX (SOCK_PACKET + 1) + +#define ARCH_HAS_SOCKET_TYPES + #endif /* _ASM_SOCKET_H */ diff -Nru a/include/asm-parisc/cacheflush.h b/include/asm-parisc/cacheflush.h --- a/include/asm-parisc/cacheflush.h 2004-09-26 10:25:57 -07:00 +++ b/include/asm-parisc/cacheflush.h 2004-09-26 10:25:57 -07:00 @@ -77,11 +77,17 @@ #define flush_icache_range(s,e) do { flush_kernel_dcache_range_asm(s,e); flush_kernel_icache_range_asm(s,e); } while (0) #define copy_to_user_page(vma, page, vaddr, dst, src, len) \ -do { memcpy(dst, src, len); \ - flush_kernel_dcache_range_asm((unsigned long)dst, (unsigned long)dst + len); \ +do { \ + flush_cache_page(vma, vaddr); \ + memcpy(dst, src, len); \ + flush_kernel_dcache_range_asm((unsigned long)dst, (unsigned long)dst + len); \ } while (0) + #define copy_from_user_page(vma, page, vaddr, dst, src, len) \ - memcpy(dst, src, len) +do { \ + flush_cache_page(vma, vaddr); \ + memcpy(dst, src, len); \ +} while (0) static inline void flush_cache_range(struct vm_area_struct *vma, unsigned long start, unsigned long end) diff -Nru a/include/asm-ppc/8253pit.h b/include/asm-ppc/8253pit.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-ppc/8253pit.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,10 @@ +/* + * 8253/8254 Programmable Interval Timer + */ + +#ifndef _8253PIT_H +#define _8253PIT_H + +#define PIT_TICK_RATE 1193182UL + +#endif diff -Nru a/include/asm-ppc/dma-mapping.h b/include/asm-ppc/dma-mapping.h --- a/include/asm-ppc/dma-mapping.h 2004-09-26 10:25:57 -07:00 +++ b/include/asm-ppc/dma-mapping.h 2004-09-26 10:25:57 -07:00 @@ -8,7 +8,6 @@ #include /* need struct page definitions */ #include -#include #include #include diff -Nru a/include/asm-ppc/open_pic.h b/include/asm-ppc/open_pic.h --- a/include/asm-ppc/open_pic.h 2004-09-26 10:25:56 -07:00 +++ b/include/asm-ppc/open_pic.h 2004-09-26 10:25:56 -07:00 @@ -23,7 +23,7 @@ #define OPENPIC_VEC_TIMER 110 /* and up */ #define OPENPIC_VEC_IPI 118 /* and up */ -#define OPENPIC_VEC_SPURIOUS 239 +#define OPENPIC_VEC_SPURIOUS 255 /* OpenPIC IRQ controller structure */ extern struct hw_interrupt_type open_pic; diff -Nru a/include/asm-ppc64/8253pit.h b/include/asm-ppc64/8253pit.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-ppc64/8253pit.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,10 @@ +/* + * 8253/8254 Programmable Interval Timer + */ + +#ifndef _8253PIT_H +#define _8253PIT_H + +#define PIT_TICK_RATE 1193182UL + +#endif diff -Nru a/include/asm-ppc64/bootx.h b/include/asm-ppc64/bootx.h --- a/include/asm-ppc64/bootx.h 2004-09-26 10:25:56 -07:00 +++ /dev/null Wed Dec 31 16:00:00 196900 @@ -1,135 +0,0 @@ -/* - * This file describes the structure passed from the BootX application - * (for MacOS) when it is used to boot Linux. - * - * Written by Benjamin Herrenschmidt. - */ - - -#ifndef __ASM_BOOTX_H__ -#define __ASM_BOOTX_H__ - -#ifdef macintosh -#include -#include "linux_type_defs.h" -#endif - -#ifdef macintosh -/* All this requires PowerPC alignment */ -#pragma options align=power -#endif - -/* On kernel entry: - * - * r3 = 0x426f6f58 ('BooX') - * r4 = pointer to boot_infos - * r5 = NULL - * - * Data and instruction translation disabled, interrupts - * disabled, kernel loaded at physical 0x00000000 on PCI - * machines (will be different on NuBus). - */ - -#define BOOT_INFO_VERSION 5 -#define BOOT_INFO_COMPATIBLE_VERSION 1 - -/* Bit in the architecture flag mask. More to be defined in - future versions. Note that either BOOT_ARCH_PCI or - BOOT_ARCH_NUBUS is set. The other BOOT_ARCH_NUBUS_xxx are - set additionally when BOOT_ARCH_NUBUS is set. - */ -#define BOOT_ARCH_PCI 0x00000001UL -#define BOOT_ARCH_NUBUS 0x00000002UL -#define BOOT_ARCH_NUBUS_PDM 0x00000010UL -#define BOOT_ARCH_NUBUS_PERFORMA 0x00000020UL -#define BOOT_ARCH_NUBUS_POWERBOOK 0x00000040UL - -/* Maximum number of ranges in phys memory map */ -#define MAX_MEM_MAP_SIZE 26 - -/* This is the format of an element in the physical memory map. Note that - the map is optional and current BootX will only build it for pre-PCI - machines */ -typedef struct boot_info_map_entry -{ - __u32 physAddr; /* Physical starting address */ - __u32 size; /* Size in bytes */ -} boot_info_map_entry_t; - - -/* Here are the boot informations that are passed to the bootstrap - * Note that the kernel arguments and the device tree are appended - * at the end of this structure. */ -typedef struct boot_infos -{ - /* Version of this structure */ - __u32 version; - /* backward compatible down to version: */ - __u32 compatible_version; - - /* NEW (vers. 2) this holds the current _logical_ base addr of - the frame buffer (for use by early boot message) */ - __u8* logicalDisplayBase; - - /* NEW (vers. 4) Apple's machine identification */ - __u32 machineID; - - /* NEW (vers. 4) Detected hw architecture */ - __u32 architecture; - - /* The device tree (internal addresses relative to the beginning of the tree, - * device tree offset relative to the beginning of this structure). - * On pre-PCI macintosh (BOOT_ARCH_PCI bit set to 0 in architecture), this - * field is 0. - */ - __u32 deviceTreeOffset; /* Device tree offset */ - __u32 deviceTreeSize; /* Size of the device tree */ - - /* Some infos about the current MacOS display */ - __u32 dispDeviceRect[4]; /* left,top,right,bottom */ - __u32 dispDeviceDepth; /* (8, 16 or 32) */ - __u8* dispDeviceBase; /* base address (physical) */ - __u32 dispDeviceRowBytes; /* rowbytes (in bytes) */ - __u32 dispDeviceColorsOffset; /* Colormap (8 bits only) or 0 (*) */ - /* Optional offset in the registry to the current - * MacOS display. (Can be 0 when not detected) */ - __u32 dispDeviceRegEntryOffset; - - /* Optional pointer to boot ramdisk (offset from this structure) */ - __u32 ramDisk; - __u32 ramDiskSize; /* size of ramdisk image */ - - /* Kernel command line arguments (offset from this structure) */ - __u32 kernelParamsOffset; - - /* ALL BELOW NEW (vers. 4) */ - - /* This defines the physical memory. Valid with BOOT_ARCH_NUBUS flag - (non-PCI) only. On PCI, memory is contiguous and it's size is in the - device-tree. */ - boot_info_map_entry_t - physMemoryMap[MAX_MEM_MAP_SIZE]; /* Where the phys memory is */ - __u32 physMemoryMapSize; /* How many entries in map */ - - - /* The framebuffer size (optional, currently 0) */ - __u32 frameBufferSize; /* Represents a max size, can be 0. */ - - /* NEW (vers. 5) */ - - /* Total params size (args + colormap + device tree + ramdisk) */ - __u32 totalParamsSize; - -} boot_infos_t; - -/* (*) The format of the colormap is 256 * 3 * 2 bytes. Each color index is represented - * by 3 short words containing a 16 bits (unsigned) color component. - * Later versions may contain the gamma table for direct-color devices here. - */ -#define BOOTX_COLORTABLE_SIZE (256UL*3UL*2UL) - -#ifdef macintosh -#pragma options align=reset -#endif - -#endif diff -Nru a/include/asm-ppc64/btext.h b/include/asm-ppc64/btext.h --- a/include/asm-ppc64/btext.h 2004-09-26 10:25:57 -07:00 +++ b/include/asm-ppc64/btext.h 2004-09-26 10:25:57 -07:00 @@ -7,23 +7,20 @@ #define __PPC_BTEXT_H #ifdef __KERNEL__ -#include - extern void btext_clearscreen(void); extern void btext_flushscreen(void); -extern boot_infos_t disp_bi; extern int boot_text_mapped; -void btext_setup_display(int width, int height, int depth, int pitch, - unsigned long address); -void map_boot_text(void); -void btext_update_display(unsigned long phys, int width, int height, - int depth, int pitch); +extern int btext_initialize(struct device_node *np); + +extern void map_boot_text(void); +extern void btext_update_display(unsigned long phys, int width, int height, + int depth, int pitch); -void btext_drawchar(char c); -void btext_drawstring(const char *str); -void btext_drawhex(unsigned long v); +extern void btext_drawchar(char c); +extern void btext_drawstring(const char *str); +extern void btext_drawhex(unsigned long v); #endif /* __KERNEL__ */ #endif /* __PPC_BTEXT_H */ diff -Nru a/include/asm-ppc64/dma-mapping.h b/include/asm-ppc64/dma-mapping.h --- a/include/asm-ppc64/dma-mapping.h 2004-09-26 10:25:57 -07:00 +++ b/include/asm-ppc64/dma-mapping.h 2004-09-26 10:25:57 -07:00 @@ -8,7 +8,6 @@ #define _ASM_DMA_MAPPING_H #include -#include #include /* need struct page definitions */ #include diff -Nru a/include/asm-ppc64/eeh.h b/include/asm-ppc64/eeh.h --- a/include/asm-ppc64/eeh.h 2004-09-26 10:25:57 -07:00 +++ b/include/asm-ppc64/eeh.h 2004-09-26 10:25:57 -07:00 @@ -26,27 +26,19 @@ struct pci_dev; struct device_node; -/* I/O addresses are converted to EEH "tokens" such that a driver will cause - * a bad page fault if the address is used directly (i.e. these addresses are - * never actually mapped. Translation between IO <-> EEH region is 1 to 1. - */ -#define IO_TOKEN_TO_ADDR(token) \ - (((unsigned long __force)(token) & ~(0xfUL << REGION_SHIFT)) | \ - (IO_REGION_ID << REGION_SHIFT)) - -#define IO_ADDR_TO_TOKEN(addr) \ - (((unsigned long)(addr) & ~(0xfUL << REGION_SHIFT)) | \ - (EEH_REGION_ID << REGION_SHIFT)) - /* Values for eeh_mode bits in device_node */ #define EEH_MODE_SUPPORTED (1<<0) #define EEH_MODE_NOCHECK (1<<1) +#ifdef CONFIG_PPC_PSERIES extern void __init eeh_init(void); unsigned long eeh_check_failure(const volatile void __iomem *token, unsigned long val); int eeh_dn_check_failure (struct device_node *dn, struct pci_dev *dev); void __iomem *eeh_ioremap(unsigned long addr, void __iomem *vaddr); void __init pci_addr_cache_build(void); +#else +#define eeh_check_failure(token, val) (val) +#endif /** * eeh_add_device_early @@ -109,83 +101,83 @@ * MMIO read/write operations with EEH support. */ static inline u8 eeh_readb(const volatile void __iomem *addr) { - volatile u8 *vaddr = (volatile u8 *)IO_TOKEN_TO_ADDR(addr); + volatile u8 *vaddr = (volatile u8 __force *) addr; u8 val = in_8(vaddr); if (EEH_POSSIBLE_ERROR(addr, vaddr, val, u8)) return eeh_check_failure(addr, val); return val; } static inline void eeh_writeb(u8 val, volatile void __iomem *addr) { - volatile u8 *vaddr = (volatile u8 *)IO_TOKEN_TO_ADDR(addr); + volatile u8 *vaddr = (volatile u8 __force *) addr; out_8(vaddr, val); } static inline u16 eeh_readw(const volatile void __iomem *addr) { - volatile u16 *vaddr = (volatile u16 *)IO_TOKEN_TO_ADDR(addr); + volatile u16 *vaddr = (volatile u16 __force *) addr; u16 val = in_le16(vaddr); if (EEH_POSSIBLE_ERROR(addr, vaddr, val, u16)) return eeh_check_failure(addr, val); return val; } static inline void eeh_writew(u16 val, volatile void __iomem *addr) { - volatile u16 *vaddr = (volatile u16 *)IO_TOKEN_TO_ADDR(addr); + volatile u16 *vaddr = (volatile u16 __force *) addr; out_le16(vaddr, val); } static inline u16 eeh_raw_readw(const volatile void __iomem *addr) { - volatile u16 *vaddr = (volatile u16 *)IO_TOKEN_TO_ADDR(addr); + volatile u16 *vaddr = (volatile u16 __force *) addr; u16 val = in_be16(vaddr); if (EEH_POSSIBLE_ERROR(addr, vaddr, val, u16)) return eeh_check_failure(addr, val); return val; } static inline void eeh_raw_writew(u16 val, volatile void __iomem *addr) { - volatile u16 *vaddr = (volatile u16 *)IO_TOKEN_TO_ADDR(addr); + volatile u16 *vaddr = (volatile u16 __force *) addr; out_be16(vaddr, val); } static inline u32 eeh_readl(const volatile void __iomem *addr) { - volatile u32 *vaddr = (volatile u32 *)IO_TOKEN_TO_ADDR(addr); + volatile u32 *vaddr = (volatile u32 __force *) addr; u32 val = in_le32(vaddr); if (EEH_POSSIBLE_ERROR(addr, vaddr, val, u32)) return eeh_check_failure(addr, val); return val; } static inline void eeh_writel(u32 val, volatile void __iomem *addr) { - volatile u32 *vaddr = (volatile u32 *)IO_TOKEN_TO_ADDR(addr); + volatile u32 *vaddr = (volatile u32 __force *) addr; out_le32(vaddr, val); } static inline u32 eeh_raw_readl(const volatile void __iomem *addr) { - volatile u32 *vaddr = (volatile u32 *)IO_TOKEN_TO_ADDR(addr); + volatile u32 *vaddr = (volatile u32 __force *) addr; u32 val = in_be32(vaddr); if (EEH_POSSIBLE_ERROR(addr, vaddr, val, u32)) return eeh_check_failure(addr, val); return val; } static inline void eeh_raw_writel(u32 val, volatile void __iomem *addr) { - volatile u32 *vaddr = (volatile u32 *)IO_TOKEN_TO_ADDR(addr); + volatile u32 *vaddr = (volatile u32 __force *) addr; out_be32(vaddr, val); } static inline u64 eeh_readq(const volatile void __iomem *addr) { - volatile u64 *vaddr = (volatile u64 *)IO_TOKEN_TO_ADDR(addr); + volatile u64 *vaddr = (volatile u64 __force *) addr; u64 val = in_le64(vaddr); if (EEH_POSSIBLE_ERROR(addr, vaddr, val, u64)) return eeh_check_failure(addr, val); return val; } static inline void eeh_writeq(u64 val, volatile void __iomem *addr) { - volatile u64 *vaddr = (volatile u64 *)IO_TOKEN_TO_ADDR(addr); + volatile u64 *vaddr = (volatile u64 __force *) addr; out_le64(vaddr, val); } static inline u64 eeh_raw_readq(const volatile void __iomem *addr) { - volatile u64 *vaddr = (volatile u64 *)IO_TOKEN_TO_ADDR(addr); + volatile u64 *vaddr = (volatile u64 __force *) addr; u64 val = in_be64(vaddr); if (EEH_POSSIBLE_ERROR(addr, vaddr, val, u64)) return eeh_check_failure(addr, val); return val; } static inline void eeh_raw_writeq(u64 val, volatile void __iomem *addr) { - volatile u64 *vaddr = (volatile u64 *)IO_TOKEN_TO_ADDR(addr); + volatile u64 *vaddr = (volatile u64 __force *) addr; out_be64(vaddr, val); } @@ -193,7 +185,7 @@ ((((unsigned long)(v)) & ((a) - 1)) == 0) static inline void eeh_memset_io(volatile void __iomem *addr, int c, unsigned long n) { - void *vaddr = (void *)IO_TOKEN_TO_ADDR(addr); + void *vaddr = (void __force *) addr; u32 lc = c; lc |= lc << 8; lc |= lc << 16; @@ -216,7 +208,7 @@ __asm__ __volatile__ ("sync" : : : "memory"); } static inline void eeh_memcpy_fromio(void *dest, const volatile void __iomem *src, unsigned long n) { - void *vsrc = (void *)IO_TOKEN_TO_ADDR(src); + void *vsrc = (void __force *) src; void *vsrcsave = vsrc, *destsave = dest; const volatile void __iomem *srcsave = src; unsigned long nsave = n; @@ -255,7 +247,7 @@ } static inline void eeh_memcpy_toio(volatile void __iomem *dest, const void *src, unsigned long n) { - void *vdest = (void *)IO_TOKEN_TO_ADDR(dest); + void *vdest = (void __force *) dest; while(n && (!EEH_CHECK_ALIGN(vdest, 4) || !EEH_CHECK_ALIGN(src, 4))) { *((volatile u8 *)vdest) = *((u8 *)src); diff -Nru a/include/asm-ppc64/io.h b/include/asm-ppc64/io.h --- a/include/asm-ppc64/io.h 2004-09-26 10:25:57 -07:00 +++ b/include/asm-ppc64/io.h 2004-09-26 10:25:57 -07:00 @@ -18,6 +18,8 @@ #include #include +#include + #define __ide_mm_insw(p, a, c) _insw_ns((volatile u16 *)(p), (a), (c)) #define __ide_mm_insl(p, a, c) _insl_ns((volatile u32 *)(p), (a), (c)) #define __ide_mm_outsw(p, a, c) _outsw_ns((volatile u16 *)(p), (a), (c)) @@ -69,35 +71,35 @@ static inline unsigned char __raw_readb(const volatile void __iomem *addr) { - return *(unsigned char __force *)addr; + return *(volatile unsigned char __force *)addr; } static inline unsigned short __raw_readw(const volatile void __iomem *addr) { - return *(unsigned short __force *)addr; + return *(volatile unsigned short __force *)addr; } static inline unsigned int __raw_readl(const volatile void __iomem *addr) { - return *(unsigned int __force *)addr; + return *(volatile unsigned int __force *)addr; } static inline unsigned long __raw_readq(const volatile void __iomem *addr) { - return *(unsigned long __force *)addr; + return *(volatile unsigned long __force *)addr; } static inline void __raw_writeb(unsigned char v, volatile void __iomem *addr) { - *(unsigned char __force *)addr = v; + *(volatile unsigned char __force *)addr = v; } static inline void __raw_writew(unsigned short v, volatile void __iomem *addr) { - *(unsigned short __force *)addr = v; + *(volatile unsigned short __force *)addr = v; } static inline void __raw_writel(unsigned int v, volatile void __iomem *addr) { - *(unsigned int __force *)addr = v; + *(volatile unsigned int __force *)addr = v; } static inline void __raw_writeq(unsigned long v, volatile void __iomem *addr) { - *(unsigned long __force *)addr = v; + *(volatile unsigned long __force *)addr = v; } #define readb(addr) eeh_readb(addr) #define readw(addr) eeh_readw(addr) diff -Nru a/include/asm-ppc64/iommu.h b/include/asm-ppc64/iommu.h --- a/include/asm-ppc64/iommu.h 2004-09-26 10:25:57 -07:00 +++ b/include/asm-ppc64/iommu.h 2004-09-26 10:25:57 -07:00 @@ -104,16 +104,19 @@ struct scatterlist; -#ifdef CONFIG_PPC_PSERIES +#ifdef CONFIG_PPC_MULTIPLATFORM + /* Walks all buses and creates iommu tables */ extern void iommu_setup_pSeries(void); extern void iommu_setup_pmac(void); /* Creates table for an individual device node */ extern void iommu_devnode_init(struct device_node *dn); -#endif /* CONFIG_PPC_PSERIES */ + +#endif /* CONFIG_PPC_MULTIPLATFORM */ #ifdef CONFIG_PPC_ISERIES + /* Walks all buses and creates iommu tables */ extern void iommu_setup_iSeries(void); @@ -123,8 +126,8 @@ struct iSeries_Device_Node; /* Creates table for an individual device node */ extern void iommu_devnode_init(struct iSeries_Device_Node *dn); -#endif /* CONFIG_PPC_ISERIES */ +#endif /* CONFIG_PPC_ISERIES */ /* Initializes an iommu_table based in values set in the passed-in * structure diff -Nru a/include/asm-ppc64/lmb.h b/include/asm-ppc64/lmb.h --- a/include/asm-ppc64/lmb.h 2004-09-26 10:25:57 -07:00 +++ b/include/asm-ppc64/lmb.h 2004-09-26 10:25:57 -07:00 @@ -20,12 +20,6 @@ #define MAX_LMB_REGIONS 128 -union lmb_reg_property { - struct reg_property32 addr32[MAX_LMB_REGIONS]; - struct reg_property64 addr64[MAX_LMB_REGIONS]; - struct reg_property_pmac addrPM[MAX_LMB_REGIONS]; -}; - #define LMB_ALLOC_ANYWHERE 0 struct lmb_property { @@ -59,6 +53,8 @@ extern unsigned long __init lmb_phys_mem_size(void); extern unsigned long __init lmb_end_of_DRAM(void); extern unsigned long __init lmb_abs_to_phys(unsigned long); + +extern void lmb_dump_all(void); extern unsigned long io_hole_start; diff -Nru a/include/asm-ppc64/machdep.h b/include/asm-ppc64/machdep.h --- a/include/asm-ppc64/machdep.h 2004-09-26 10:25:56 -07:00 +++ b/include/asm-ppc64/machdep.h 2004-09-26 10:25:56 -07:00 @@ -56,6 +56,9 @@ void (*flush_hash_range)(unsigned long context, unsigned long number, int local); + /* special for kexec, to be called in real mode, linar mapping is + * destroyed as well */ + void (*htpe_clear_all)(void); void (*tce_build)(struct iommu_table * tbl, long index, @@ -67,7 +70,9 @@ long npages); void (*tce_flush)(struct iommu_table *tbl); + int (*probe)(int platform); void (*setup_arch)(void); + void (*init_early)(void); /* Optional, may be NULL. */ void (*get_cpuinfo)(struct seq_file *m); @@ -76,9 +81,6 @@ /* PCI stuff */ void (*pcibios_fixup)(void); - - /* Optional, may be NULL. */ - void (*init)(void); void (*restart)(char *cmd); void (*power_off)(void); diff -Nru a/include/asm-ppc64/memory.h b/include/asm-ppc64/memory.h --- a/include/asm-ppc64/memory.h 2004-09-26 10:25:57 -07:00 +++ b/include/asm-ppc64/memory.h 2004-09-26 10:25:57 -07:00 @@ -56,14 +56,4 @@ #define HMT_MEDIUM_HIGH "\tor 5,5,5 # medium high priority\n" #define HMT_HIGH "\tor 3,3,3 # high priority\n" -/* - * Various operational modes for SMT - * Off : never run threaded - * On : always run threaded - * Dynamic: Allow the system to switch modes as needed - */ -#define SMT_OFF 0 -#define SMT_ON 1 -#define SMT_DYNAMIC 2 - #endif diff -Nru a/include/asm-ppc64/mmu.h b/include/asm-ppc64/mmu.h --- a/include/asm-ppc64/mmu.h 2004-09-26 10:25:56 -07:00 +++ b/include/asm-ppc64/mmu.h 2004-09-26 10:25:56 -07:00 @@ -15,6 +15,7 @@ #include #include +#include #ifndef __ASSEMBLY__ @@ -106,20 +107,6 @@ extern HTAB htab_data; -void invalidate_hpte( unsigned long slot ); -long select_hpte_slot( unsigned long vpn ); -void create_valid_hpte( unsigned long slot, unsigned long vpn, - unsigned long prpn, unsigned hash, - void * ptep, unsigned hpteflags, - unsigned bolted ); - -#define PD_SHIFT (10+12) /* Page directory */ -#define PD_MASK 0x02FF -#define PT_SHIFT (12) /* Page Table */ -#define PT_MASK 0x02FF - -#define LARGE_PAGE_SHIFT 24 - static inline unsigned long hpt_hash(unsigned long vpn, int large) { unsigned long vsid; @@ -215,156 +202,43 @@ #define SLB_VSID_KERNEL (SLB_VSID_KP|SLB_VSID_C) #define SLB_VSID_USER (SLB_VSID_KP|SLB_VSID_KS) -#define VSID_RANDOMIZER ASM_CONST(42470972311) -#define VSID_MASK 0xfffffffffUL -/* Because we never access addresses below KERNELBASE as kernel - * addresses, this VSID is never used for anything real, and will - * never have pages hashed into it */ -#define BAD_VSID ASM_CONST(0) - -/* Block size masks */ -#define BL_128K 0x000 -#define BL_256K 0x001 -#define BL_512K 0x003 -#define BL_1M 0x007 -#define BL_2M 0x00F -#define BL_4M 0x01F -#define BL_8M 0x03F -#define BL_16M 0x07F -#define BL_32M 0x0FF -#define BL_64M 0x1FF -#define BL_128M 0x3FF -#define BL_256M 0x7FF - -/* Used to set up SDR1 register */ -#define HASH_TABLE_SIZE_64K 0x00010000 -#define HASH_TABLE_SIZE_128K 0x00020000 -#define HASH_TABLE_SIZE_256K 0x00040000 -#define HASH_TABLE_SIZE_512K 0x00080000 -#define HASH_TABLE_SIZE_1M 0x00100000 -#define HASH_TABLE_SIZE_2M 0x00200000 -#define HASH_TABLE_SIZE_4M 0x00400000 -#define HASH_TABLE_MASK_64K 0x000 -#define HASH_TABLE_MASK_128K 0x001 -#define HASH_TABLE_MASK_256K 0x003 -#define HASH_TABLE_MASK_512K 0x007 -#define HASH_TABLE_MASK_1M 0x00F -#define HASH_TABLE_MASK_2M 0x01F -#define HASH_TABLE_MASK_4M 0x03F - -/* These are the Ks and Kp from the PowerPC books. For proper operation, - * Ks = 0, Kp = 1. - */ -#define MI_AP 786 -#define MI_Ks 0x80000000 /* Should not be set */ -#define MI_Kp 0x40000000 /* Should always be set */ - -/* The effective page number register. When read, contains the information - * about the last instruction TLB miss. When MI_RPN is written, bits in - * this register are used to create the TLB entry. - */ -#define MI_EPN 787 -#define MI_EPNMASK 0xfffff000 /* Effective page number for entry */ -#define MI_EVALID 0x00000200 /* Entry is valid */ -#define MI_ASIDMASK 0x0000000f /* ASID match value */ - /* Reset value is undefined */ - -/* A "level 1" or "segment" or whatever you want to call it register. - * For the instruction TLB, it contains bits that get loaded into the - * TLB entry when the MI_RPN is written. - */ -#define MI_TWC 789 -#define MI_APG 0x000001e0 /* Access protection group (0) */ -#define MI_GUARDED 0x00000010 /* Guarded storage */ -#define MI_PSMASK 0x0000000c /* Mask of page size bits */ -#define MI_PS8MEG 0x0000000c /* 8M page size */ -#define MI_PS512K 0x00000004 /* 512K page size */ -#define MI_PS4K_16K 0x00000000 /* 4K or 16K page size */ -#define MI_SVALID 0x00000001 /* Segment entry is valid */ - /* Reset value is undefined */ - -/* Real page number. Defined by the pte. Writing this register - * causes a TLB entry to be created for the instruction TLB, using - * additional information from the MI_EPN, and MI_TWC registers. - */ -#define MI_RPN 790 - -/* Define an RPN value for mapping kernel memory to large virtual - * pages for boot initialization. This has real page number of 0, - * large page size, shared page, cache enabled, and valid. - * Also mark all subpages valid and write access. - */ -#define MI_BOOTINIT 0x000001fd - -#define MD_CTR 792 /* Data TLB control register */ -#define MD_GPM 0x80000000 /* Set domain manager mode */ -#define MD_PPM 0x40000000 /* Set subpage protection */ -#define MD_CIDEF 0x20000000 /* Set cache inhibit when MMU dis */ -#define MD_WTDEF 0x10000000 /* Set writethrough when MMU dis */ -#define MD_RSV4I 0x08000000 /* Reserve 4 TLB entries */ -#define MD_TWAM 0x04000000 /* Use 4K page hardware assist */ -#define MD_PPCS 0x02000000 /* Use MI_RPN prob/priv state */ -#define MD_IDXMASK 0x00001f00 /* TLB index to be loaded */ -#define MD_RESETVAL 0x04000000 /* Value of register at reset */ +#define VSID_MULTIPLIER ASM_CONST(268435399) /* largest 28-bit prime */ +#define VSID_BITS 36 +#define VSID_MODULUS ((1UL<= \ + * 2^36-1, then r3+1 has the 2^36 bit set. So, if r3+1 has \ + * the bit clear, r3 already has the answer we want, if it \ + * doesn't, the answer is the low 36 bits of r3+1. So in all \ + * cases the answer is the low 36 bits of (r3 + ((r3+1) >> 36))*/\ + addi rx,rt,1; \ + srdi rx,rx,VSID_BITS; /* extract 2^36 bit */ \ + add rt,rt,rx #endif /* _PPC64_MMU_H_ */ diff -Nru a/include/asm-ppc64/mmu_context.h b/include/asm-ppc64/mmu_context.h --- a/include/asm-ppc64/mmu_context.h 2004-09-26 10:25:56 -07:00 +++ b/include/asm-ppc64/mmu_context.h 2004-09-26 10:25:56 -07:00 @@ -2,11 +2,9 @@ #define __PPC64_MMU_CONTEXT_H #include -#include #include #include #include -#include #include /* @@ -33,107 +31,15 @@ return __ffs(b[2]) + 128; } -#define NO_CONTEXT 0 -#define FIRST_USER_CONTEXT 0x10 /* First 16 reserved for kernel */ -#define LAST_USER_CONTEXT 0x8000 /* Same as PID_MAX for now... */ -#define NUM_USER_CONTEXT (LAST_USER_CONTEXT-FIRST_USER_CONTEXT) - -/* Choose whether we want to implement our context - * number allocator as a LIFO or FIFO queue. - */ -#if 1 -#define MMU_CONTEXT_LIFO -#else -#define MMU_CONTEXT_FIFO -#endif - -struct mmu_context_queue_t { - spinlock_t lock; - long head; - long tail; - long size; - mm_context_id_t elements[LAST_USER_CONTEXT]; -}; - -extern struct mmu_context_queue_t mmu_context_queue; - -static inline void -enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) -{ -} - -/* - * The context number queue has underflowed. - * Meaning: we tried to push a context number that was freed - * back onto the context queue and the queue was already full. - */ -static inline void -mmu_context_underflow(void) -{ - printk(KERN_DEBUG "mmu_context_underflow\n"); - panic("mmu_context_underflow"); -} - -/* - * Set up the context for a new address space. - */ -static inline int -init_new_context(struct task_struct *tsk, struct mm_struct *mm) +static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) { - long head; - unsigned long flags; - /* This does the right thing across a fork (I hope) */ - - spin_lock_irqsave(&mmu_context_queue.lock, flags); - - if (mmu_context_queue.size <= 0) { - spin_unlock_irqrestore(&mmu_context_queue.lock, flags); - return -ENOMEM; - } - - head = mmu_context_queue.head; - mm->context.id = mmu_context_queue.elements[head]; - - head = (head < LAST_USER_CONTEXT-1) ? head+1 : 0; - mmu_context_queue.head = head; - mmu_context_queue.size--; - - spin_unlock_irqrestore(&mmu_context_queue.lock, flags); - - return 0; } -/* - * We're finished using the context for an address space. - */ -static inline void -destroy_context(struct mm_struct *mm) -{ - long index; - unsigned long flags; - - spin_lock_irqsave(&mmu_context_queue.lock, flags); +#define NO_CONTEXT 0 +#define MAX_CONTEXT (0x100000-1) - if (mmu_context_queue.size >= NUM_USER_CONTEXT) { - spin_unlock_irqrestore(&mmu_context_queue.lock, flags); - mmu_context_underflow(); - } - -#ifdef MMU_CONTEXT_LIFO - index = mmu_context_queue.head; - index = (index > 0) ? index-1 : LAST_USER_CONTEXT-1; - mmu_context_queue.head = index; -#else - index = mmu_context_queue.tail; - index = (index < LAST_USER_CONTEXT-1) ? index+1 : 0; - mmu_context_queue.tail = index; -#endif - - mmu_context_queue.size++; - mmu_context_queue.elements[index] = mm->context.id; - - spin_unlock_irqrestore(&mmu_context_queue.lock, flags); -} +extern int init_new_context(struct task_struct *tsk, struct mm_struct *mm); +extern void destroy_context(struct mm_struct *mm); extern void switch_stab(struct task_struct *tsk, struct mm_struct *mm); extern void switch_slb(struct task_struct *tsk, struct mm_struct *mm); @@ -181,46 +87,87 @@ local_irq_restore(flags); } -/* This is only valid for kernel (including vmalloc, imalloc and bolted) EA's +/* VSID allocation + * =============== + * + * We first generate a 36-bit "proto-VSID". For kernel addresses this + * is equal to the ESID, for user addresses it is: + * (context << 15) | (esid & 0x7fff) + * + * The two forms are distinguishable because the top bit is 0 for user + * addresses, whereas the top two bits are 1 for kernel addresses. + * Proto-VSIDs with the top two bits equal to 0b10 are reserved for + * now. + * + * The proto-VSIDs are then scrambled into real VSIDs with the + * multiplicative hash: + * + * VSID = (proto-VSID * VSID_MULTIPLIER) % VSID_MODULUS + * where VSID_MULTIPLIER = 268435399 = 0xFFFFFC7 + * VSID_MODULUS = 2^36-1 = 0xFFFFFFFFF + * + * This scramble is only well defined for proto-VSIDs below + * 0xFFFFFFFFF, so both proto-VSID and actual VSID 0xFFFFFFFFF are + * reserved. VSID_MULTIPLIER is prime (the largest 28-bit prime, in + * fact), so in particular it is co-prime to VSID_MODULUS, making this + * a 1:1 scrambling function. Because the modulus is 2^n-1 we can + * compute it efficiently without a divide or extra multiply (see + * below). + * + * This scheme has several advantages over older methods: + * + * - We have VSIDs allocated for every kernel address + * (i.e. everything above 0xC000000000000000), except the very top + * segment, which simplifies several things. + * + * - We allow for 15 significant bits of ESID and 20 bits of + * context for user addresses. i.e. 8T (43 bits) of address space for + * up to 1M contexts (although the page table structure and context + * allocation will need changes to take advantage of this). + * + * - The scramble function gives robust scattering in the hash + * table (at least based on some initial results). The previous + * method was more susceptible to pathological cases giving excessive + * hash collisions. */ -static inline unsigned long -get_kernel_vsid( unsigned long ea ) + +/* + * WARNING - If you change these you must make sure the asm + * implementations in slb_allocate(), do_stab_bolted and mmu.h + * (ASM_VSID_SCRAMBLE macro) are changed accordingly. + * + * You'll also need to change the precomputed VSID values in head.S + * which are used by the iSeries firmware. + */ + +static inline unsigned long vsid_scramble(unsigned long protovsid) { - unsigned long ordinal, vsid; - - ordinal = (((ea >> 28) & 0x1fff) * LAST_USER_CONTEXT) | (ea >> 60); - vsid = (ordinal * VSID_RANDOMIZER) & VSID_MASK; - -#ifdef HTABSTRESS - /* For debug, this path creates a very poor vsid distribuition. - * A user program can access virtual addresses in the form - * 0x0yyyyxxxx000 where yyyy = xxxx to cause multiple mappings - * to hash to the same page table group. - */ - ordinal = ((ea >> 28) & 0x1fff) | (ea >> 44); - vsid = ordinal & VSID_MASK; -#endif /* HTABSTRESS */ - - return vsid; -} - -/* This is only valid for user EA's (user EA's do not exceed 2^41 (EADDR_SIZE)) - */ -static inline unsigned long -get_vsid( unsigned long context, unsigned long ea ) -{ - unsigned long ordinal, vsid; - - ordinal = (((ea >> 28) & 0x1fff) * LAST_USER_CONTEXT) | context; - vsid = (ordinal * VSID_RANDOMIZER) & VSID_MASK; - -#ifdef HTABSTRESS - /* See comment above. */ - ordinal = ((ea >> 28) & 0x1fff) | (context << 16); - vsid = ordinal & VSID_MASK; -#endif /* HTABSTRESS */ +#if 0 + /* The code below is equivalent to this function for arguments + * < 2^VSID_BITS, which is all this should ever be called + * with. However gcc is not clever enough to compute the + * modulus (2^n-1) without a second multiply. */ + return ((protovsid * VSID_MULTIPLIER) % VSID_MODULUS); +#else /* 1 */ + unsigned long x; - return vsid; + x = protovsid * VSID_MULTIPLIER; + x = (x >> VSID_BITS) + (x & VSID_MODULUS); + return (x + ((x+1) >> VSID_BITS)) & VSID_MODULUS; +#endif /* 1 */ +} + +/* This is only valid for addresses >= KERNELBASE */ +static inline unsigned long get_kernel_vsid(unsigned long ea) +{ + return vsid_scramble(ea >> SID_SHIFT); +} + +/* This is only valid for user addresses (which are below 2^41) */ +static inline unsigned long get_vsid(unsigned long context, unsigned long ea) +{ + return vsid_scramble((context << USER_ESID_BITS) + | (ea >> SID_SHIFT)); } #endif /* __PPC64_MMU_CONTEXT_H */ diff -Nru a/include/asm-ppc64/naca.h b/include/asm-ppc64/naca.h --- a/include/asm-ppc64/naca.h 2004-09-26 10:25:56 -07:00 +++ b/include/asm-ppc64/naca.h 2004-09-26 10:25:56 -07:00 @@ -37,9 +37,6 @@ u32 dCacheL1LinesPerPage; /* L1 d-cache lines / page 0x64 */ u32 iCacheL1LogLineSize; /* L1 i-cache line size Log2 0x68 */ u32 iCacheL1LinesPerPage; /* L1 i-cache lines / page 0x6c */ - u8 smt_state; /* 0 = SMT off 0x70 */ - /* 1 = SMT on */ - /* 2 = SMT dynamic */ u8 resv0[15]; /* Reserved 0x71 - 0x7F */ }; diff -Nru a/include/asm-ppc64/page.h b/include/asm-ppc64/page.h --- a/include/asm-ppc64/page.h 2004-09-26 10:25:55 -07:00 +++ b/include/asm-ppc64/page.h 2004-09-26 10:25:55 -07:00 @@ -30,11 +30,12 @@ #define ESID_MASK 0xfffffffff0000000UL #define GET_ESID(x) (((x) >> SID_SHIFT) & SID_MASK) -#ifdef CONFIG_HUGETLB_PAGE - #define HPAGE_SHIFT 24 #define HPAGE_SIZE ((1UL) << HPAGE_SHIFT) #define HPAGE_MASK (~(HPAGE_SIZE - 1)) + +#ifdef CONFIG_HUGETLB_PAGE + #define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) /* For 64-bit processes the hugepage range is 1T-1.5T */ @@ -201,9 +202,9 @@ /* to change! */ #define PAGE_OFFSET ASM_CONST(0xC000000000000000) #define KERNELBASE PAGE_OFFSET -#define VMALLOCBASE 0xD000000000000000UL -#define IOREGIONBASE 0xE000000000000000UL -#define EEHREGIONBASE 0xA000000000000000UL +#define VMALLOCBASE ASM_CONST(0xD000000000000000) +#define IOREGIONBASE ASM_CONST(0xE000000000000000) +#define EEHREGIONBASE ASM_CONST(0xA000000000000000) #define IO_REGION_ID (IOREGIONBASE>>REGION_SHIFT) #define EEH_REGION_ID (EEHREGIONBASE>>REGION_SHIFT) @@ -211,17 +212,6 @@ #define KERNEL_REGION_ID (KERNELBASE>>REGION_SHIFT) #define USER_REGION_ID (0UL) #define REGION_ID(X) (((unsigned long)(X))>>REGION_SHIFT) - -/* - * Define valid/invalid EA bits (for all ranges) - */ -#define VALID_EA_BITS (0x000001ffffffffffUL) -#define INVALID_EA_BITS (~(REGION_MASK|VALID_EA_BITS)) - -#define IS_VALID_REGION_ID(x) \ - (((x) == USER_REGION_ID) || ((x) >= KERNEL_REGION_ID)) -#define IS_VALID_EA(x) \ - ((!((x) & INVALID_EA_BITS)) && IS_VALID_REGION_ID(REGION_ID(x))) #define __bpn_to_ba(x) ((((unsigned long)(x))<> PAGE_SHIFT) diff -Nru a/include/asm-ppc64/pci-bridge.h b/include/asm-ppc64/pci-bridge.h --- a/include/asm-ppc64/pci-bridge.h 2004-09-26 10:25:55 -07:00 +++ b/include/asm-ppc64/pci-bridge.h 2004-09-26 10:25:55 -07:00 @@ -70,8 +70,8 @@ * for a device on a PCI bus, given its device_node struct. * It returns 0 if OK, -1 on error. */ -int pci_device_loc(struct device_node *dev, unsigned char *bus_ptr, - unsigned char *devfn_ptr); +extern int pci_device_loc(struct device_node *dev, unsigned char *bus_ptr, + unsigned char *devfn_ptr); struct device_node *fetch_dev_dn(struct pci_dev *dev); @@ -86,6 +86,9 @@ else return fetch_dev_dn(dev); } + +extern void pci_process_bridge_OF_ranges(struct pci_controller *hose, + struct device_node *dev, int primary); /* Use this macro after the PCI bus walk for max performance when it * is known that sysdata is correct. diff -Nru a/include/asm-ppc64/pgtable.h b/include/asm-ppc64/pgtable.h --- a/include/asm-ppc64/pgtable.h 2004-09-26 10:25:57 -07:00 +++ b/include/asm-ppc64/pgtable.h 2004-09-26 10:25:57 -07:00 @@ -45,10 +45,16 @@ PGD_INDEX_SIZE + PAGE_SHIFT) /* + * Size of EA range mapped by our pagetables. + */ +#define PGTABLE_EA_BITS 41 +#define PGTABLE_EA_MASK ((1UL< physical */ #define KRANGE_START KERNELBASE -#define KRANGE_END (KRANGE_START + VALID_EA_BITS) +#define KRANGE_END (KRANGE_START + PGTABLE_EA_MASK) /* * Define the user address range */ #define USER_START (0UL) -#define USER_END (USER_START + VALID_EA_BITS) +#define USER_END (USER_START + PGTABLE_EA_MASK) /* @@ -490,7 +496,8 @@ void pgtable_cache_init(void); -extern void hpte_init_pSeries(void); +extern void hpte_init_native(void); +extern void hpte_init_lpar(void); extern void hpte_init_iSeries(void); /* imalloc region types */ @@ -505,14 +512,14 @@ int region_type); unsigned long im_free(void *addr); -long pSeries_lpar_hpte_insert(unsigned long hpte_group, - unsigned long va, unsigned long prpn, - int secondary, unsigned long hpteflags, - int bolted, int large); - -long pSeries_hpte_insert(unsigned long hpte_group, unsigned long va, - unsigned long prpn, int secondary, - unsigned long hpteflags, int bolted, int large); +extern long pSeries_lpar_hpte_insert(unsigned long hpte_group, + unsigned long va, unsigned long prpn, + int secondary, unsigned long hpteflags, + int bolted, int large); + +extern long native_hpte_insert(unsigned long hpte_group, unsigned long va, + unsigned long prpn, int secondary, + unsigned long hpteflags, int bolted, int large); /* * find_linux_pte returns the address of a linux pte for a given diff -Nru a/include/asm-ppc64/plpar_wrappers.h b/include/asm-ppc64/plpar_wrappers.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-ppc64/plpar_wrappers.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,109 @@ +#ifndef _PPC64_PLPAR_WRAPPERS_H +#define _PPC64_PLPAR_WRAPPERS_H + +#include + +static inline long poll_pending(void) +{ + unsigned long dummy; + return plpar_hcall(H_POLL_PENDING, 0, 0, 0, 0, + &dummy, &dummy, &dummy); +} + +static inline long prod_processor(void) +{ + plpar_hcall_norets(H_PROD); + return(0); +} + +static inline long cede_processor(void) +{ + plpar_hcall_norets(H_CEDE); + return(0); +} + +static inline long register_vpa(unsigned long flags, unsigned long proc, unsigned long vpa) +{ + plpar_hcall_norets(H_REGISTER_VPA, flags, proc, vpa); + return(0); +} + +static inline long plpar_pte_remove(unsigned long flags, + unsigned long ptex, + unsigned long avpn, + unsigned long *old_pteh_ret, + unsigned long *old_ptel_ret) +{ + unsigned long dummy; + return plpar_hcall(H_REMOVE, flags, ptex, avpn, 0, + old_pteh_ret, old_ptel_ret, &dummy); +} + +static inline long plpar_pte_read(unsigned long flags, + unsigned long ptex, + unsigned long *old_pteh_ret, unsigned long *old_ptel_ret) +{ + unsigned long dummy; + return plpar_hcall(H_READ, flags, ptex, 0, 0, + old_pteh_ret, old_ptel_ret, &dummy); +} + +static inline long plpar_pte_protect(unsigned long flags, + unsigned long ptex, + unsigned long avpn) +{ + return plpar_hcall_norets(H_PROTECT, flags, ptex, avpn); +} + +static inline long plpar_tce_get(unsigned long liobn, + unsigned long ioba, + unsigned long *tce_ret) +{ + unsigned long dummy; + return plpar_hcall(H_GET_TCE, liobn, ioba, 0, 0, + tce_ret, &dummy, &dummy); +} + +static inline long plpar_tce_put(unsigned long liobn, + unsigned long ioba, + unsigned long tceval) +{ + return plpar_hcall_norets(H_PUT_TCE, liobn, ioba, tceval); +} + +static inline long plpar_tce_put_indirect(unsigned long liobn, + unsigned long ioba, + unsigned long page, + unsigned long count) +{ + return plpar_hcall_norets(H_PUT_TCE_INDIRECT, liobn, ioba, page, count); +} + +static inline long plpar_tce_stuff(unsigned long liobn, + unsigned long ioba, + unsigned long tceval, + unsigned long count) +{ + return plpar_hcall_norets(H_STUFF_TCE, liobn, ioba, tceval, count); +} + +static inline long plpar_get_term_char(unsigned long termno, + unsigned long *len_ret, + char *buf_ret) +{ + unsigned long *lbuf = (unsigned long *)buf_ret; /* ToDo: alignment? */ + return plpar_hcall(H_GET_TERM_CHAR, termno, 0, 0, 0, + len_ret, lbuf+0, lbuf+1); +} + +static inline long plpar_put_term_char(unsigned long termno, + unsigned long len, + const char *buffer) +{ + unsigned long *lbuf = (unsigned long *)buffer; /* ToDo: alignment? */ + return plpar_hcall_norets(H_PUT_TERM_CHAR, termno, len, lbuf[0], + lbuf[1]); +} + + +#endif /* _PPC64_PLPAR_WRAPPERS_H */ diff -Nru a/include/asm-ppc64/ppc32.h b/include/asm-ppc64/ppc32.h --- a/include/asm-ppc64/ppc32.h 2004-09-26 10:25:56 -07:00 +++ b/include/asm-ppc64/ppc32.h 2004-09-26 10:25:56 -07:00 @@ -14,30 +14,6 @@ * 2 of the License, or (at your option) any later version. */ -/* 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. - - - */ -#define A(__x) ((unsigned long)(__x)) -#define AA(__x) \ -({ unsigned long __ret; \ - __asm__ ("clrldi %0, %0, 32" \ - : "=r" (__ret) \ - : "0" (__x)); \ - __ret; \ -}) - /* These are here to support 32-bit syscalls on a 64-bit kernel. */ typedef struct compat_siginfo { @@ -56,8 +32,10 @@ /* POSIX.1b timers */ struct { - unsigned int _timer1; - unsigned int _timer2; + timer_t _tid; /* timer id */ + int _overrun; /* overrun count */ + compat_sigval_t _sigval; /* same as below */ + int _sys_private; /* not to be passed to user */ } _timer; /* POSIX.1b signals */ diff -Nru a/include/asm-ppc64/prom.h b/include/asm-ppc64/prom.h --- a/include/asm-ppc64/prom.h 2004-09-26 10:25:57 -07:00 +++ b/include/asm-ppc64/prom.h 2004-09-26 10:25:57 -07:00 @@ -24,14 +24,47 @@ #define LONG_LSW(X) (((unsigned long)X) & 0xffffffff) #define LONG_MSW(X) (((unsigned long)X) >> 32) +/* Definitions used by the flattened device tree */ +#define OF_DT_HEADER 0xd00dfeed /* 4: version, 4: total size */ +#define OF_DT_BEGIN_NODE 0x1 /* Start node: full name */ +#define OF_DT_END_NODE 0x2 /* End node */ +#define OF_DT_PROP 0x3 /* Property: name off, size, content */ +#define OF_DT_END 0x9 + +#define OF_DT_VERSION 1 + +/* + * This is what gets passed to the kernel by prom_init or kexec + * + * The dt struct contains the device tree structure, full pathes and + * property contents. The dt strings contain a separate block with just + * the strings for the property names, and is fully page aligned and + * self contained in a page, so that it can be kept around by the kernel, + * each property name appears only once in this page (cheap compression) + * + * the mem_rsvmap contains a map of reserved ranges of physical memory, + * passing it here instead of in the device-tree itself greatly simplifies + * the job of everybody. It's just a list of u64 pairs (base/size) that + * ends when size is 0 + */ +struct boot_param_header +{ + u32 magic; /* magic word OF_DT_HEADER */ + u32 totalsize; /* total size of DT block */ + u32 off_dt_struct; /* offset to structure */ + u32 off_dt_strings; /* offset to strings */ + u32 off_mem_rsvmap; /* offset to memory reserve map */ + u32 version; /* format version */ + u32 last_comp_version; /* last compatible version */ +}; + + + typedef u32 phandle; typedef u32 ihandle; typedef u32 phandle32; typedef u32 ihandle32; -extern char *prom_display_paths[]; -extern unsigned int prom_num_displays; - struct address_range { unsigned long space; unsigned long address; @@ -136,6 +169,7 @@ */ struct pci_controller; struct iommu_table; + struct device_node { char *name; char *type; @@ -171,6 +205,8 @@ unsigned long _flags; }; +extern struct device_node *of_chosen; + /* flag descriptions */ #define OF_STALE 0 /* node is slated for deletion */ #define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */ @@ -202,34 +238,6 @@ dn->addr_link = de; } -typedef u32 prom_arg_t; - -struct prom_args { - u32 service; - u32 nargs; - u32 nret; - prom_arg_t args[10]; - prom_arg_t *rets; /* Pointer to return values in args[16]. */ -}; - -struct prom_t { - unsigned long entry; - ihandle root; - ihandle chosen; - int cpu; - ihandle stdout; - ihandle disp_node; - struct prom_args args; - unsigned long version; - unsigned long encode_phys_size; - struct bi_record *bi_recs; -}; - -extern struct prom_t prom; -extern char *of_stdout_device; - -extern int boot_cpuid; - /* OBSOLETE: Old stlye node lookup */ extern struct device_node *find_devices(const char *name); extern struct device_node *find_type_devices(const char *type); @@ -246,6 +254,7 @@ extern struct device_node *of_find_compatible_node(struct device_node *from, const char *type, const char *compat); extern struct device_node *of_find_node_by_path(const char *path); +extern struct device_node *of_find_node_by_phandle(phandle handle); extern struct device_node *of_find_all_nodes(struct device_node *prev); extern struct device_node *of_get_parent(const struct device_node *node); extern struct device_node *of_get_next_child(const struct device_node *node, diff -Nru a/include/asm-ppc64/rtas.h b/include/asm-ppc64/rtas.h --- a/include/asm-ppc64/rtas.h 2004-09-26 10:25:57 -07:00 +++ b/include/asm-ppc64/rtas.h 2004-09-26 10:25:57 -07:00 @@ -180,7 +180,7 @@ extern void enter_rtas(unsigned long); extern int rtas_token(const char *service); extern int rtas_call(int token, int, int, int *, ...); -extern void call_rtas_display_status(char); +extern void call_rtas_display_status(unsigned char); extern void rtas_restart(char *cmd); extern void rtas_power_off(void); extern void rtas_halt(void); @@ -189,6 +189,7 @@ extern int rtas_get_power_level(int powerdomain, int *level); extern int rtas_set_power_level(int powerdomain, int level, int *setlevel); extern int rtas_set_indicator(int indicator, int index, int new_value); +extern void rtas_initialize(void); /* Given an RTAS status code of 9900..9905 compute the hinted delay */ unsigned int rtas_extended_busy_delay_time(int status); diff -Nru a/include/asm-ppc64/smp.h b/include/asm-ppc64/smp.h --- a/include/asm-ppc64/smp.h 2004-09-26 10:25:55 -07:00 +++ b/include/asm-ppc64/smp.h 2004-09-26 10:25:55 -07:00 @@ -37,6 +37,7 @@ #define hard_smp_processor_id() (get_paca()->hw_cpu_id) extern cpumask_t cpu_sibling_map[NR_CPUS]; +extern int boot_cpuid; /* Since OpenPIC has only 4 IPIs, we use slightly different message numbers. * @@ -64,6 +65,8 @@ #define get_hard_smp_processor_id(CPU) (paca[(CPU)].hw_cpu_id) #define set_hard_smp_processor_id(CPU, VAL) \ do { (paca[(CPU)].hw_cpu_id = (VAL)); } while (0) + +extern int smt_enabled_at_boot; #endif /* __ASSEMBLY__ */ diff -Nru a/include/asm-ppc64/unistd.h b/include/asm-ppc64/unistd.h --- a/include/asm-ppc64/unistd.h 2004-09-26 10:25:55 -07:00 +++ b/include/asm-ppc64/unistd.h 2004-09-26 10:25:55 -07:00 @@ -269,9 +269,9 @@ /* Number 256 is reserved for sys_debug_setcontext */ /* Number 257 is reserved for vserver */ /* Number 258 is reserved for new sys_remap_file_pages */ -/* Number 259 is reserved for new sys_mbind */ -/* Number 260 is reserved for new sys_get_mempolicy */ -/* Number 261 is reserved for new sys_set_mempolicy */ +#define __NR_mbind 259 +#define __NR_get_mempolicy 260 +#define __NR_set_mempolicy 261 #define __NR_mq_open 262 #define __NR_mq_unlink 263 #define __NR_mq_timedsend 264 diff -Nru a/include/asm-s390/hardirq.h b/include/asm-s390/hardirq.h --- a/include/asm-s390/hardirq.h 2004-09-26 10:25:57 -07:00 +++ b/include/asm-s390/hardirq.h 2004-09-26 10:25:57 -07:00 @@ -61,10 +61,9 @@ #define SOFTIRQ_SHIFT (PREEMPT_SHIFT + PREEMPT_BITS) #define HARDIRQ_SHIFT (SOFTIRQ_SHIFT + SOFTIRQ_BITS) -extern void do_call_softirq(void); extern void account_ticks(struct pt_regs *); -#define invoke_softirq() do_call_softirq() +#define __ARCH_HAS_DO_SOFTIRQ #define irq_enter() \ do { \ @@ -75,7 +74,7 @@ preempt_count() -= IRQ_EXIT_OFFSET; \ if (!in_interrupt() && local_softirq_pending()) \ /* Use the async. stack for softirq */ \ - do_call_softirq(); \ + do_softirq(); \ preempt_enable_no_resched(); \ } while (0) diff -Nru a/include/asm-sh/cacheflush.h b/include/asm-sh/cacheflush.h --- a/include/asm-sh/cacheflush.h 2004-09-26 10:25:56 -07:00 +++ b/include/asm-sh/cacheflush.h 2004-09-26 10:25:56 -07:00 @@ -14,10 +14,16 @@ #define flush_cache_vunmap(start, end) flush_cache_all() #define copy_to_user_page(vma, page, vaddr, dst, src, len) \ -do { memcpy(dst, src, len); \ - flush_icache_user_range(vma, page, vaddr, len); \ -} while (0) + do { \ + flush_cache_page(vma, vaddr); \ + memcpy(dst, src, len); \ + flush_icache_user_range(vma, page, vaddr, len); \ + } while (0) + #define copy_from_user_page(vma, page, vaddr, dst, src, len) \ - memcpy(dst, src, len) + do { \ + flush_cache_page(vma, vaddr); \ + memcpy(dst, src, len); \ + } while (0) #endif /* __ASM_SH_CACHEFLUSH_H */ diff -Nru a/include/asm-sh/dma-mapping.h b/include/asm-sh/dma-mapping.h --- a/include/asm-sh/dma-mapping.h 2004-09-26 10:25:57 -07:00 +++ b/include/asm-sh/dma-mapping.h 2004-09-26 10:25:57 -07:00 @@ -3,7 +3,6 @@ #include #include -#include #include #include diff -Nru a/include/asm-sh64/cacheflush.h b/include/asm-sh64/cacheflush.h --- a/include/asm-sh64/cacheflush.h 2004-09-26 10:25:56 -07:00 +++ b/include/asm-sh64/cacheflush.h 2004-09-26 10:25:56 -07:00 @@ -30,13 +30,17 @@ #define flush_icache_page(vma, page) do { } while (0) #define copy_to_user_page(vma, page, vaddr, dst, src, len) \ -do { memcpy(dst, src, len); \ - flush_icache_user_range(vma, page, vaddr, len); \ -} while (0) + do { \ + flush_cache_page(vma, vaddr); \ + memcpy(dst, src, len); \ + flush_icache_user_range(vma, page, vaddr, len); \ + } while (0) #define copy_from_user_page(vma, page, vaddr, dst, src, len) \ - memcpy(dst, src, len) - + do { \ + flush_cache_page(vma, vaddr); \ + memcpy(dst, src, len); \ + } while (0) #endif /* __ASSEMBLY__ */ diff -Nru a/include/asm-sh64/dma-mapping.h b/include/asm-sh64/dma-mapping.h --- a/include/asm-sh64/dma-mapping.h 2004-09-26 10:25:57 -07:00 +++ b/include/asm-sh64/dma-mapping.h 2004-09-26 10:25:57 -07:00 @@ -3,7 +3,6 @@ #include #include -#include #include #include diff -Nru a/include/asm-sh64/smplock.h b/include/asm-sh64/smplock.h --- a/include/asm-sh64/smplock.h 2004-09-26 10:25:55 -07:00 +++ /dev/null Wed Dec 31 16:00:00 196900 @@ -1,77 +0,0 @@ -#ifndef __ASM_SH64_SMPLOCK_H -#define __ASM_SH64_SMPLOCK_H - -/* - * 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. - * - * include/asm-sh64/smplock.h - * - * Copyright (C) 2000, 2001 Paolo Alberelli - * - */ - -#include - -#ifndef CONFIG_SMP - -#define lock_kernel() do { } while(0) -#define unlock_kernel() do { } while(0) -#define release_kernel_lock(task, cpu, depth) ((depth) = 1) -#define reacquire_kernel_lock(task, cpu, depth) do { } while(0) - -#else - -#error "We do not support SMP on SH64 yet" -/* - * Default SMP lock implementation - */ - -#include -#include - -extern spinlock_t kernel_flag; - -/* - * Getting the big kernel lock. - * - * This cannot happen asynchronously, - * so we only need to worry about other - * CPU's. - */ -extern __inline__ void lock_kernel(void) -{ - if (!++current->lock_depth) - spin_lock(&kernel_flag); -} - -extern __inline__ void unlock_kernel(void) -{ - if (--current->lock_depth < 0) - spin_unlock(&kernel_flag); -} - -/* - * Release global kernel lock and global interrupt lock - */ -#define release_kernel_lock(task, cpu) \ -do { \ - if (task->lock_depth >= 0) \ - spin_unlock(&kernel_flag); \ - release_irqlock(cpu); \ - __sti(); \ -} while (0) - -/* - * Re-acquire the kernel lock - */ -#define reacquire_kernel_lock(task) \ -do { \ - if (task->lock_depth >= 0) \ - spin_lock(&kernel_flag); \ -} while (0) - -#endif /* CONFIG_SMP */ - -#endif /* __ASM_SH64_SMPLOCK_H */ diff -Nru a/include/asm-sh64/softirq.h b/include/asm-sh64/softirq.h --- a/include/asm-sh64/softirq.h 2004-09-26 10:25:55 -07:00 +++ /dev/null Wed Dec 31 16:00:00 196900 @@ -1,30 +0,0 @@ -#ifndef __ASM_SH_SOFTIRQ_H -#define __ASM_SH_SOFTIRQ_H - -#include -#include - -#define local_bh_disable() \ -do { \ - local_bh_count(smp_processor_id())++; \ - barrier(); \ -} while (0) - -#define __local_bh_enable() \ -do { \ - barrier(); \ - local_bh_count(smp_processor_id())--; \ -} while (0) - -#define local_bh_enable() \ -do { \ - barrier(); \ - if (!--local_bh_count(smp_processor_id()) \ - && softirq_pending(smp_processor_id())) { \ - do_softirq(); \ - } \ -} while (0) - -#define in_softirq() (local_bh_count(smp_processor_id()) != 0) - -#endif /* __ASM_SH_SOFTIRQ_H */ diff -Nru a/include/asm-sparc/cacheflush.h b/include/asm-sparc/cacheflush.h --- a/include/asm-sparc/cacheflush.h 2004-09-26 10:25:56 -07:00 +++ b/include/asm-sparc/cacheflush.h 2004-09-26 10:25:56 -07:00 @@ -57,9 +57,15 @@ #define flush_icache_user_range(vma,pg,adr,len) do { } while (0) #define copy_to_user_page(vma, page, vaddr, dst, src, len) \ - memcpy(dst, src, len) + do { \ + flush_cache_page(vma, vaddr); \ + memcpy(dst, src, len); \ + } while (0) #define copy_from_user_page(vma, page, vaddr, dst, src, len) \ - memcpy(dst, src, len) + do { \ + flush_cache_page(vma, vaddr); \ + memcpy(dst, src, len); \ + } while (0) BTFIXUPDEF_CALL(void, __flush_page_to_ram, unsigned long) BTFIXUPDEF_CALL(void, flush_sig_insns, struct mm_struct *, unsigned long) diff -Nru a/include/asm-sparc/dma-mapping.h b/include/asm-sparc/dma-mapping.h --- a/include/asm-sparc/dma-mapping.h 2004-09-26 10:25:57 -07:00 +++ b/include/asm-sparc/dma-mapping.h 2004-09-26 10:25:57 -07:00 @@ -2,7 +2,6 @@ #define _ASM_SPARC_DMA_MAPPING_H #include -#include #ifdef CONFIG_PCI #include diff -Nru a/include/asm-sparc/vaddrs.h b/include/asm-sparc/vaddrs.h --- a/include/asm-sparc/vaddrs.h 2004-09-26 10:25:55 -07:00 +++ b/include/asm-sparc/vaddrs.h 2004-09-26 10:25:55 -07:00 @@ -33,9 +33,9 @@ #define SUN4M_IOBASE_VADDR 0xfd000000 /* Base for mapping pages */ #define IOBASE_VADDR 0xfe000000 -#define IOBASE_END 0xfe300000 +#define IOBASE_END 0xfe600000 -#define VMALLOC_START 0xfe300000 +#define VMALLOC_START 0xfe600000 /* XXX Alter this when I get around to fixing sun4c - Anton */ #define VMALLOC_END 0xffc00000 diff -Nru a/include/asm-sparc64/cacheflush.h b/include/asm-sparc64/cacheflush.h --- a/include/asm-sparc64/cacheflush.h 2004-09-26 10:25:57 -07:00 +++ b/include/asm-sparc64/cacheflush.h 2004-09-26 10:25:57 -07:00 @@ -38,9 +38,16 @@ #define flush_icache_user_range(vma,pg,adr,len) do { } while (0) #define copy_to_user_page(vma, page, vaddr, dst, src, len) \ - memcpy(dst, src, len) + do { \ + flush_cache_page(vma, vaddr); \ + memcpy(dst, src, len); \ + } while (0) + #define copy_from_user_page(vma, page, vaddr, dst, src, len) \ - memcpy(dst, src, len) + do { \ + flush_cache_page(vma, vaddr); \ + memcpy(dst, src, len); \ + } while (0) extern void flush_dcache_page(struct page *page); #define flush_dcache_mmap_lock(mapping) do { } while (0) diff -Nru a/include/asm-sparc64/dma.h b/include/asm-sparc64/dma.h --- a/include/asm-sparc64/dma.h 2004-09-26 10:25:55 -07:00 +++ b/include/asm-sparc64/dma.h 2004-09-26 10:25:55 -07:00 @@ -62,7 +62,7 @@ struct sbus_dma { struct sbus_dma *next; struct sbus_dev *sdev; - unsigned long regs; + void __iomem *regs; /* Status, misc info */ int node; /* Prom node for this DMA device */ diff -Nru a/include/asm-sparc64/ebus.h b/include/asm-sparc64/ebus.h --- a/include/asm-sparc64/ebus.h 2004-09-26 10:25:57 -07:00 +++ b/include/asm-sparc64/ebus.h 2004-09-26 10:25:57 -07:00 @@ -53,7 +53,7 @@ struct ebus_dma_info { spinlock_t lock; - unsigned long regs; + void __iomem *regs; unsigned int flags; #define EBUS_DMA_FLAG_USE_EBDMA_HANDLER 0x00000001 diff -Nru a/include/asm-sparc64/ide.h b/include/asm-sparc64/ide.h --- a/include/asm-sparc64/ide.h 2004-09-26 10:25:56 -07:00 +++ b/include/asm-sparc64/ide.h 2004-09-26 10:25:56 -07:00 @@ -38,7 +38,7 @@ #define __ide_mm_outsw __ide_outsw #define __ide_mm_outsl __ide_outsl -static __inline__ unsigned int inw_be(unsigned long addr) +static inline unsigned int inw_be(void __iomem *addr) { unsigned int ret; @@ -49,9 +49,7 @@ return ret; } -static __inline__ void __ide_insw(unsigned long port, - void *dst, - u32 count) +static inline void __ide_insw(void __iomem *port, void *dst, u32 count) { #if (L1DCACHE_SIZE > PAGE_SIZE) /* is there D$ aliasing problem */ unsigned long end = (unsigned long)dst + (count << 1); @@ -81,16 +79,14 @@ #endif } -static __inline__ void outw_be(unsigned short w, unsigned long addr) +static inline void outw_be(unsigned short w, void __iomem *addr) { __asm__ __volatile__("stha %0, [%1] %2" : /* no outputs */ : "r" (w), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)); } -static __inline__ void __ide_outsw(unsigned long port, - void *src, - u32 count) +static inline void __ide_outsw(void __iomem *port, void *src, u32 count) { #if (L1DCACHE_SIZE > PAGE_SIZE) /* is there D$ aliasing problem */ unsigned long end = (unsigned long)src + (count << 1); diff -Nru a/include/asm-sparc64/io.h b/include/asm-sparc64/io.h --- a/include/asm-sparc64/io.h 2004-09-26 10:25:57 -07:00 +++ b/include/asm-sparc64/io.h 2004-09-26 10:25:57 -07:00 @@ -3,6 +3,7 @@ #define __SPARC64_IO_H #include +#include #include #include /* IO address mapping routines need this */ @@ -99,28 +100,31 @@ #define inl_p(__addr) inl(__addr) #define outl_p(__l, __addr) outl(__l, __addr) -extern void outsb(unsigned long addr, const void *src, unsigned long count); -extern void outsw(unsigned long addr, const void *src, unsigned long count); -extern void outsl(unsigned long addr, const void *src, unsigned long count); -extern void insb(unsigned long addr, void *dst, unsigned long count); -extern void insw(unsigned long addr, void *dst, unsigned long count); -extern void insl(unsigned long addr, void *dst, unsigned long count); +extern void outsb(void __iomem *addr, const void *src, unsigned long count); +extern void outsw(void __iomem *addr, const void *src, unsigned long count); +extern void outsl(void __iomem *addr, const void *src, unsigned long count); +extern void insb(void __iomem *addr, void *dst, unsigned long count); +extern void insw(void __iomem *addr, void *dst, unsigned long count); +extern void insl(void __iomem *addr, void *dst, unsigned long count); +#define ioread8_rep(a,d,c) insb(a,d,c) +#define ioread16_rep(a,d,c) insw(a,d,c) +#define ioread32_rep(a,d,c) insl(a,d,c) +#define iowrite8_rep(a,s,c) outsb(a,s,c) +#define iowrite16_rep(a,s,c) outsw(a,s,c) +#define iowrite32_rep(a,s,c) outsl(a,s,c) /* Memory functions, same as I/O accesses on Ultra. */ -static __inline__ u8 _readb(unsigned long addr) -{ - u8 ret; +static inline u8 _readb(void __iomem *addr) +{ u8 ret; __asm__ __volatile__("lduba\t[%1] %2, %0\t/* pci_readb */" : "=r" (ret) : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L)); - return ret; } -static __inline__ u16 _readw(unsigned long addr) -{ - u16 ret; +static inline u16 _readw(void __iomem *addr) +{ u16 ret; __asm__ __volatile__("lduha\t[%1] %2, %0\t/* pci_readw */" : "=r" (ret) @@ -129,9 +133,8 @@ return ret; } -static __inline__ u32 _readl(unsigned long addr) -{ - u32 ret; +static inline u32 _readl(void __iomem *addr) +{ u32 ret; __asm__ __volatile__("lduwa\t[%1] %2, %0\t/* pci_readl */" : "=r" (ret) @@ -140,9 +143,8 @@ return ret; } -static __inline__ u64 _readq(unsigned long addr) -{ - u64 ret; +static inline u64 _readq(void __iomem *addr) +{ u64 ret; __asm__ __volatile__("ldxa\t[%1] %2, %0\t/* pci_readq */" : "=r" (ret) @@ -151,46 +153,46 @@ return ret; } -static __inline__ void _writeb(u8 b, unsigned long addr) +static inline void _writeb(u8 b, void __iomem *addr) { __asm__ __volatile__("stba\t%r0, [%1] %2\t/* pci_writeb */" : /* no outputs */ : "Jr" (b), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L)); } -static __inline__ void _writew(u16 w, unsigned long addr) +static inline void _writew(u16 w, void __iomem *addr) { __asm__ __volatile__("stha\t%r0, [%1] %2\t/* pci_writew */" : /* no outputs */ : "Jr" (w), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L)); } -static __inline__ void _writel(u32 l, unsigned long addr) +static inline void _writel(u32 l, void __iomem *addr) { __asm__ __volatile__("stwa\t%r0, [%1] %2\t/* pci_writel */" : /* no outputs */ : "Jr" (l), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L)); } -static __inline__ void _writeq(u64 q, unsigned long addr) +static inline void _writeq(u64 q, void __iomem *addr) { __asm__ __volatile__("stxa\t%r0, [%1] %2\t/* pci_writeq */" : /* no outputs */ : "Jr" (q), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L)); } -#define readb(__addr) (_readb((unsigned long)(__addr))) -#define readw(__addr) (_readw((unsigned long)(__addr))) -#define readl(__addr) (_readl((unsigned long)(__addr))) -#define readq(__addr) (_readq((unsigned long)(__addr))) -#define readb_relaxed(a) readb(a) -#define readw_relaxed(a) readw(a) -#define readl_relaxed(a) readl(a) -#define readq_relaxed(a) readq(a) -#define writeb(__b, __addr) (_writeb((u8)(__b), (unsigned long)(__addr))) -#define writew(__w, __addr) (_writew((u16)(__w), (unsigned long)(__addr))) -#define writel(__l, __addr) (_writel((u32)(__l), (unsigned long)(__addr))) -#define writeq(__q, __addr) (_writeq((u64)(__q), (unsigned long)(__addr))) +#define readb(__addr) _readb(__addr) +#define readw(__addr) _readw(__addr) +#define readl(__addr) _readl(__addr) +#define readq(__addr) _readq(__addr) +#define readb_relaxed(__addr) _readb(__addr) +#define readw_relaxed(__addr) _readw(__addr) +#define readl_relaxed(__addr) _readl(__addr) +#define readq_relaxed(__addr) _readq(__addr) +#define writeb(__b, __addr) _writeb(__b, __addr) +#define writew(__w, __addr) _writew(__w, __addr) +#define writel(__l, __addr) _writel(__l, __addr) +#define writeq(__q, __addr) _writeq(__q, __addr) /* Now versions without byte-swapping. */ static __inline__ u8 _raw_readb(unsigned long addr) @@ -282,7 +284,7 @@ /* Now, SBUS variants, only difference from PCI is that we do * not use little-endian ASIs. */ -static __inline__ u8 _sbus_readb(unsigned long addr) +static inline u8 _sbus_readb(void __iomem *addr) { u8 ret; @@ -293,7 +295,7 @@ return ret; } -static __inline__ u16 _sbus_readw(unsigned long addr) +static inline u16 _sbus_readw(void __iomem *addr) { u16 ret; @@ -304,7 +306,7 @@ return ret; } -static __inline__ u32 _sbus_readl(unsigned long addr) +static inline u32 _sbus_readl(void __iomem *addr) { u32 ret; @@ -315,7 +317,7 @@ return ret; } -static __inline__ u64 _sbus_readq(unsigned long addr) +static inline u64 _sbus_readq(void __iomem *addr) { u64 ret; @@ -326,44 +328,45 @@ return ret; } -static __inline__ void _sbus_writeb(u8 b, unsigned long addr) +static inline void _sbus_writeb(u8 b, void __iomem *addr) { __asm__ __volatile__("stba\t%r0, [%1] %2\t/* sbus_writeb */" : /* no outputs */ : "Jr" (b), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)); } -static __inline__ void _sbus_writew(u16 w, unsigned long addr) +static inline void _sbus_writew(u16 w, void __iomem *addr) { __asm__ __volatile__("stha\t%r0, [%1] %2\t/* sbus_writew */" : /* no outputs */ : "Jr" (w), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)); } -static __inline__ void _sbus_writel(u32 l, unsigned long addr) +static inline void _sbus_writel(u32 l, void __iomem *addr) { __asm__ __volatile__("stwa\t%r0, [%1] %2\t/* sbus_writel */" : /* no outputs */ : "Jr" (l), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)); } -static __inline__ void _sbus_writeq(u64 l, unsigned long addr) +static inline void _sbus_writeq(u64 l, void __iomem *addr) { __asm__ __volatile__("stxa\t%r0, [%1] %2\t/* sbus_writeq */" : /* no outputs */ : "Jr" (l), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)); } -#define sbus_readb(__addr) (_sbus_readb((unsigned long)(__addr))) -#define sbus_readw(__addr) (_sbus_readw((unsigned long)(__addr))) -#define sbus_readl(__addr) (_sbus_readl((unsigned long)(__addr))) -#define sbus_readq(__addr) (_sbus_readq((unsigned long)(__addr))) -#define sbus_writeb(__b, __addr) (_sbus_writeb((__b), (unsigned long)(__addr))) -#define sbus_writew(__w, __addr) (_sbus_writew((__w), (unsigned long)(__addr))) -#define sbus_writel(__l, __addr) (_sbus_writel((__l), (unsigned long)(__addr))) -#define sbus_writeq(__l, __addr) (_sbus_writeq((__l), (unsigned long)(__addr))) +#define sbus_readb(__addr) _sbus_readb(__addr) +#define sbus_readw(__addr) _sbus_readw(__addr) +#define sbus_readl(__addr) _sbus_readl(__addr) +#define sbus_readq(__addr) _sbus_readq(__addr) +#define sbus_writeb(__b, __addr) _sbus_writeb(__b, __addr) +#define sbus_writew(__w, __addr) _sbus_writew(__w, __addr) +#define sbus_writel(__l, __addr) _sbus_writel(__l, __addr) +#define sbus_writeq(__l, __addr) _sbus_writeq(__l, __addr) -static inline void *_sbus_memset_io(unsigned long dst, int c, __kernel_size_t n) +static inline void __iomem*_sbus_memset_io(void __iomem *dst, int c, + __kernel_size_t n) { while(n--) { sbus_writeb(c, dst); @@ -372,13 +375,12 @@ return (void *) dst; } -#define sbus_memset_io(d,c,sz) \ - _sbus_memset_io((unsigned long)d,(int)c,(__kernel_size_t)sz) +#define sbus_memset_io(d,c,sz) _sbus_memset_io(d,c,sz) -static inline void * -_memset_io(void *dst, int c, __kernel_size_t n) +static inline void __iomem * +_memset_io(void __iomem *dst, int c, __kernel_size_t n) { - char *d = dst; + void __iomem *d = dst; while (n--) { writeb(c, d); @@ -388,11 +390,10 @@ return dst; } -#define memset_io(d,c,sz) \ - _memset_io((void *)d,(int)c,(__kernel_size_t)sz) +#define memset_io(d,c,sz) _memset_io(d,c,sz) -static inline void * -_memcpy_fromio(void *dst, unsigned long src, __kernel_size_t n) +static inline void __iomem * +_memcpy_fromio(void *dst, void __iomem *src, __kernel_size_t n) { char *d = dst; @@ -405,25 +406,23 @@ return dst; } -#define memcpy_fromio(d,s,sz) \ - _memcpy_fromio((void *)d,(unsigned long)s,(__kernel_size_t)sz) +#define memcpy_fromio(d,s,sz) _memcpy_fromio(d,s,sz) -static inline void * -_memcpy_toio(unsigned long dst, const void *src, __kernel_size_t n) +static inline void __iomem * +_memcpy_toio(void __iomem *dst, const void *src, __kernel_size_t n) { const char *s = src; - unsigned long d = dst; + void __iomem *d = dst; while (n--) { char tmp = *s++; writeb(tmp, d); d++; } - return (void *)dst; + return dst; } -#define memcpy_toio(d,s,sz) \ - _memcpy_toio((unsigned long)d,(const void *)s,(__kernel_size_t)sz) +#define memcpy_toio(d,s,sz) _memcpy_toio(d,s,sz) static inline int check_signature(unsigned long io_addr, const unsigned char *signature, @@ -431,8 +430,9 @@ { int retval = 0; do { - if (readb(io_addr++) != *signature++) + if (readb((void __iomem *)io_addr) != *signature++) goto out; + io_addr++; } while (--length); retval = 1; out: @@ -444,10 +444,26 @@ /* On sparc64 we have the whole physical IO address space accessible * using physically addressed loads and stores, so this does nothing. */ -#define ioremap(__offset, __size) ((void *)(__offset)) +#define ioremap(__offset, __size) ((void __iomem *)(__offset)) #define ioremap_nocache(X,Y) ioremap((X),(Y)) #define iounmap(__addr) do { (void)(__addr); } while(0) +#define ioread8(X) readb(X) +#define ioread16(X) readw(X) +#define ioread32(X) readl(X) +#define iowrite8(val,X) writeb(val,X) +#define iowrite16(val,X) writew(val,X) +#define iowrite32(val,X) writel(val,X) + +/* Create a virtual mapping cookie for an IO port range */ +extern void __iomem *ioport_map(unsigned long port, unsigned int nr); +extern void ioport_unmap(void __iomem *); + +/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */ +struct pci_dev; +extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max); +extern void pci_iounmap(struct pci_dev *dev, void __iomem *); + /* Similarly for SBUS. */ #define sbus_ioremap(__res, __offset, __size, __name) \ ({ unsigned long __ret; \ @@ -455,11 +471,11 @@ __ret += (unsigned long) (__offset); \ if (! request_region((__ret), (__size), (__name))) \ __ret = 0UL; \ - __ret; \ + (void __iomem *) __ret; \ }) #define sbus_iounmap(__addr, __size) \ - release_region((__addr), (__size)) + release_region((unsigned long)(__addr), (__size)) /* Nothing to do */ diff -Nru a/include/asm-sparc64/parport.h b/include/asm-sparc64/parport.h --- a/include/asm-sparc64/parport.h 2004-09-26 10:25:58 -07:00 +++ b/include/asm-sparc64/parport.h 2004-09-26 10:25:58 -07:00 @@ -126,10 +126,14 @@ if (ebus_ecpp_p(edev)) { unsigned long base = edev->resource[0].start; unsigned long config = edev->resource[1].start; + unsigned long d_base = edev->resource[2].start; + unsigned long d_len; spin_lock_init(&sparc_ebus_dmas[count].info.lock); + d_len = (edev->resource[2].end - + d_base) + 1; sparc_ebus_dmas[count].info.regs = - edev->resource[2].start; + ioremap(d_base, d_len); if (!sparc_ebus_dmas[count].info.regs) continue; sparc_ebus_dmas[count].info.flags = 0; diff -Nru a/include/asm-um/processor-generic.h b/include/asm-um/processor-generic.h --- a/include/asm-um/processor-generic.h 2004-09-26 10:25:55 -07:00 +++ b/include/asm-um/processor-generic.h 2004-09-26 10:25:55 -07:00 @@ -16,13 +16,10 @@ struct mm_struct; -#define current_text_addr() ((void *) 0) - #define cpu_relax() barrier() struct thread_struct { int forking; - unsigned long kernel_stack; int nsyscalls; struct pt_regs regs; unsigned long cr2; @@ -73,7 +70,6 @@ #define INIT_THREAD \ { \ .forking = 0, \ - .kernel_stack = 0, \ .nsyscalls = 0, \ .regs = EMPTY_REGS, \ .cr2 = 0, \ diff -Nru a/include/asm-um/processor-i386.h b/include/asm-um/processor-i386.h --- a/include/asm-um/processor-i386.h 2004-09-26 10:25:55 -07:00 +++ b/include/asm-um/processor-i386.h 2004-09-26 10:25:55 -07:00 @@ -19,6 +19,13 @@ #include "asm/arch/user.h" +/* + * Default implementation of macro that returns current + * instruction pointer ("program counter"). Stolen + * from asm-i386/processor.h + */ +#define current_text_addr() ({ void *pc; __asm__("movl $1f,%0\n1:":"=g" (pc)); pc; }) + #include "asm/processor-generic.h" #endif diff -Nru a/include/asm-um/smp.h b/include/asm-um/smp.h --- a/include/asm-um/smp.h 2004-09-26 10:25:55 -07:00 +++ b/include/asm-um/smp.h 2004-09-26 10:25:55 -07:00 @@ -9,6 +9,8 @@ #include "linux/cpumask.h" extern cpumask_t cpu_online_map; +extern cpumask_t cpu_possible_map; + #define smp_processor_id() (current_thread->cpu) #define cpu_logical_map(n) (n) diff -Nru a/include/asm-um/spinlock.h b/include/asm-um/spinlock.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-um/spinlock.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,6 @@ +#ifndef __UM_SPINLOCK_H +#define __UM_SPINLOCK_H + +#include "asm/arch/spinlock.h" + +#endif diff -Nru a/include/asm-x86_64/apic.h b/include/asm-x86_64/apic.h --- a/include/asm-x86_64/apic.h 2004-09-26 10:25:57 -07:00 +++ b/include/asm-x86_64/apic.h 2004-09-26 10:25:57 -07:00 @@ -7,15 +7,29 @@ #include #include -#ifdef CONFIG_X86_LOCAL_APIC +#define Dprintk(x...) -#define APIC_DEBUG 0 +/* + * Debugging macros + */ +#define APIC_QUIET 0 +#define APIC_VERBOSE 1 +#define APIC_DEBUG 2 -#if APIC_DEBUG -#define Dprintk(x...) printk(x) -#else -#define Dprintk(x...) -#endif +extern int apic_verbosity; + +/* + * Define the default level of output to be very little + * This can be turned up by using apic=verbose for more + * information and apic=debug for _lots_ of information. + * apic_verbosity is defined in apic.c + */ +#define apic_printk(v, s, a...) do { \ + if ((v) <= apic_verbosity) \ + printk(s, ##a); \ + } while (0) + +#ifdef CONFIG_X86_LOCAL_APIC struct pt_regs; diff -Nru a/include/asm-x86_64/atomic.h b/include/asm-x86_64/atomic.h --- a/include/asm-x86_64/atomic.h 2004-09-26 10:25:57 -07:00 +++ b/include/asm-x86_64/atomic.h 2004-09-26 10:25:57 -07:00 @@ -178,6 +178,166 @@ return c; } +/* An 64bit atomic type */ + +typedef struct { volatile long counter; } atomic64_t; + +#define ATOMIC64_INIT(i) { (i) } + +/** + * atomic64_read - read atomic64 variable + * @v: pointer of type atomic64_t + * + * Atomically reads the value of @v. + * Doesn't imply a read memory barrier. + */ +#define atomic64_read(v) ((v)->counter) + +/** + * atomic64_set - set atomic64 variable + * @v: pointer to type atomic64_t + * @i: required value + * + * Atomically sets the value of @v to @i. + */ +#define atomic64_set(v,i) (((v)->counter) = (i)) + +/** + * atomic64_add - add integer to atomic64 variable + * @i: integer value to add + * @v: pointer to type atomic64_t + * + * Atomically adds @i to @v. + */ +static __inline__ void atomic64_add(long i, atomic64_t *v) +{ + __asm__ __volatile__( + LOCK "addq %1,%0" + :"=m" (v->counter) + :"ir" (i), "m" (v->counter)); +} + +/** + * atomic64_sub - subtract the atomic64 variable + * @i: integer value to subtract + * @v: pointer to type atomic64_t + * + * Atomically subtracts @i from @v. + */ +static __inline__ void atomic64_sub(long i, atomic64_t *v) +{ + __asm__ __volatile__( + LOCK "subq %1,%0" + :"=m" (v->counter) + :"ir" (i), "m" (v->counter)); +} + +/** + * atomic64_sub_and_test - subtract value from variable and test result + * @i: integer value to subtract + * @v: pointer to type atomic64_t + * + * Atomically subtracts @i from @v and returns + * true if the result is zero, or false for all + * other cases. + */ +static __inline__ int atomic64_sub_and_test(long i, atomic64_t *v) +{ + unsigned char c; + + __asm__ __volatile__( + LOCK "subq %2,%0; sete %1" + :"=m" (v->counter), "=qm" (c) + :"ir" (i), "m" (v->counter) : "memory"); + return c; +} + +/** + * atomic64_inc - increment atomic64 variable + * @v: pointer to type atomic64_t + * + * Atomically increments @v by 1. + */ +static __inline__ void atomic64_inc(atomic64_t *v) +{ + __asm__ __volatile__( + LOCK "incq %0" + :"=m" (v->counter) + :"m" (v->counter)); +} + +/** + * atomic64_dec - decrement atomic64 variable + * @v: pointer to type atomic64_t + * + * Atomically decrements @v by 1. + */ +static __inline__ void atomic64_dec(atomic64_t *v) +{ + __asm__ __volatile__( + LOCK "decq %0" + :"=m" (v->counter) + :"m" (v->counter)); +} + +/** + * atomic64_dec_and_test - decrement and test + * @v: pointer to type atomic64_t + * + * Atomically decrements @v by 1 and + * returns true if the result is 0, or false for all other + * cases. + */ +static __inline__ int atomic64_dec_and_test(atomic64_t *v) +{ + unsigned char c; + + __asm__ __volatile__( + LOCK "decq %0; sete %1" + :"=m" (v->counter), "=qm" (c) + :"m" (v->counter) : "memory"); + return c != 0; +} + +/** + * atomic64_inc_and_test - increment and test + * @v: pointer to type atomic64_t + * + * Atomically increments @v by 1 + * and returns true if the result is zero, or false for all + * other cases. + */ +static __inline__ int atomic64_inc_and_test(atomic64_t *v) +{ + unsigned char c; + + __asm__ __volatile__( + LOCK "incq %0; sete %1" + :"=m" (v->counter), "=qm" (c) + :"m" (v->counter) : "memory"); + return c != 0; +} + +/** + * atomic64_add_negative - add and test if negative + * @v: pointer to atomic64_t + * @i: integer value to add + * + * Atomically adds @i to @v and returns true + * if the result is negative, or false when + * result is greater than or equal to zero. + */ +static __inline__ long atomic64_add_negative(long i, atomic64_t *v) +{ + unsigned char c; + + __asm__ __volatile__( + LOCK "addq %2,%0; sets %1" + :"=m" (v->counter), "=qm" (c) + :"ir" (i), "m" (v->counter) : "memory"); + return c; +} + /* These are x86-specific, used by some header files */ #define atomic_clear_mask(mask, addr) \ __asm__ __volatile__(LOCK "andl %0,%1" \ diff -Nru a/include/asm-x86_64/dma-mapping.h b/include/asm-x86_64/dma-mapping.h --- a/include/asm-x86_64/dma-mapping.h 2004-09-26 10:25:56 -07:00 +++ b/include/asm-x86_64/dma-mapping.h 2004-09-26 10:25:56 -07:00 @@ -7,7 +7,6 @@ */ #include -#include #include #include diff -Nru a/include/asm-x86_64/elf.h b/include/asm-x86_64/elf.h --- a/include/asm-x86_64/elf.h 2004-09-26 10:25:57 -07:00 +++ b/include/asm-x86_64/elf.h 2004-09-26 10:25:57 -07:00 @@ -144,6 +144,13 @@ extern void set_personality_64bit(void); #define SET_PERSONALITY(ex, ibcs2) set_personality_64bit() +/* + * An executable for which elf_read_implies_exec() returns TRUE will + * have the READ_IMPLIES_EXEC personality flag set automatically. + */ +#define elf_read_implies_exec_binary(ex, have_pt_gnu_stack) \ + (!(have_pt_gnu_stack)) + extern int dump_task_regs (struct task_struct *, elf_gregset_t *); extern int dump_task_fpu (struct task_struct *, elf_fpregset_t *); diff -Nru a/include/asm-x86_64/ia32.h b/include/asm-x86_64/ia32.h --- a/include/asm-x86_64/ia32.h 2004-09-26 10:25:57 -07:00 +++ b/include/asm-x86_64/ia32.h 2004-09-26 10:25:57 -07:00 @@ -115,7 +115,6 @@ int _status; /* exit code */ compat_clock_t _utime; compat_clock_t _stime; - struct compat_rusage _rusage; } _sigchld; /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ diff -Nru a/include/asm-x86_64/processor.h b/include/asm-x86_64/processor.h --- a/include/asm-x86_64/processor.h 2004-09-26 10:25:57 -07:00 +++ b/include/asm-x86_64/processor.h 2004-09-26 10:25:57 -07:00 @@ -18,6 +18,7 @@ #include #include #include +#include #include #define TF_MASK 0x00000100 @@ -77,9 +78,6 @@ #define X86_VENDOR_NUM 8 #define X86_VENDOR_UNKNOWN 0xff -extern struct cpuinfo_x86 boot_cpu_data; -extern struct tss_struct init_tss[NR_CPUS]; - #ifdef CONFIG_SMP extern struct cpuinfo_x86 cpu_data[]; #define current_cpu_data cpu_data[smp_processor_id()] @@ -229,6 +227,9 @@ unsigned long io_bitmap[IO_BITMAP_LONGS + 1]; } __attribute__((packed)) ____cacheline_aligned; +extern struct cpuinfo_x86 boot_cpu_data; +DECLARE_PER_CPU(struct tss_struct,init_tss); + #define ARCH_MIN_TASKALIGN 16 struct thread_struct { @@ -253,6 +254,7 @@ switch faster for a limited number of ioperm using tasks. -AK */ int ioperm; unsigned long *io_bitmap_ptr; + unsigned io_bitmap_max; /* cached TLS descriptors. */ u64 tls_array[GDT_ENTRY_TLS_ENTRIES]; } __attribute__((aligned(16))); diff -Nru a/include/linux/affs_fs.h b/include/linux/affs_fs.h --- a/include/linux/affs_fs.h 2004-09-26 10:25:55 -07:00 +++ b/include/linux/affs_fs.h 2004-09-26 10:25:55 -07:00 @@ -62,7 +62,7 @@ extern void affs_delete_inode(struct inode *inode); extern void affs_clear_inode(struct inode *inode); extern void affs_read_inode(struct inode *inode); -extern void affs_write_inode(struct inode *inode, int); +extern int affs_write_inode(struct inode *inode, int); extern int affs_add_entry(struct inode *dir, struct inode *inode, struct dentry *dentry, s32 type); /* super.c */ diff -Nru a/include/linux/blkdev.h b/include/linux/blkdev.h --- a/include/linux/blkdev.h 2004-09-26 10:25:55 -07:00 +++ b/include/linux/blkdev.h 2004-09-26 10:25:55 -07:00 @@ -344,6 +344,7 @@ unsigned int nr_congestion_off; unsigned short max_sectors; + unsigned short max_hw_sectors; unsigned short max_phys_segments; unsigned short max_hw_segments; unsigned short hardsect_size; diff -Nru a/include/linux/compat_ioctl.h b/include/linux/compat_ioctl.h --- a/include/linux/compat_ioctl.h 2004-09-26 10:25:57 -07:00 +++ b/include/linux/compat_ioctl.h 2004-09-26 10:25:57 -07:00 @@ -735,3 +735,20 @@ COMPATIBLE_IOCTL(SIOCGIWRETRY) COMPATIBLE_IOCTL(SIOCSIWPOWER) COMPATIBLE_IOCTL(SIOCGIWPOWER) +/* hiddev */ +COMPATIBLE_IOCTL(HIDIOCGVERSION) +COMPATIBLE_IOCTL(HIDIOCAPPLICATION) +COMPATIBLE_IOCTL(HIDIOCGDEVINFO) +COMPATIBLE_IOCTL(HIDIOCGSTRING) +COMPATIBLE_IOCTL(HIDIOCINITREPORT) +COMPATIBLE_IOCTL(HIDIOCGREPORT) +COMPATIBLE_IOCTL(HIDIOCSREPORT) +COMPATIBLE_IOCTL(HIDIOCGREPORTINFO) +COMPATIBLE_IOCTL(HIDIOCGFIELDINFO) +COMPATIBLE_IOCTL(HIDIOCGUSAGE) +COMPATIBLE_IOCTL(HIDIOCSUSAGE) +COMPATIBLE_IOCTL(HIDIOCGUCODE) +COMPATIBLE_IOCTL(HIDIOCGFLAG) +COMPATIBLE_IOCTL(HIDIOCSFLAG) +COMPATIBLE_IOCTL(HIDIOCGCOLLECTIONINDEX) +COMPATIBLE_IOCTL(HIDIOCGCOLLECTIONINFO) diff -Nru a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h --- a/include/linux/dma-mapping.h 2004-09-26 10:25:57 -07:00 +++ b/include/linux/dma-mapping.h 2004-09-26 10:25:57 -07:00 @@ -1,6 +1,7 @@ #ifndef _ASM_LINUX_DMA_MAPPING_H #define _ASM_LINUX_DMA_MAPPING_H +#include #include /* These definitions mirror those in pci.h, so they can be used diff -Nru a/include/linux/efs_dir.h b/include/linux/efs_dir.h --- a/include/linux/efs_dir.h 2004-09-26 10:25:55 -07:00 +++ b/include/linux/efs_dir.h 2004-09-26 10:25:55 -07:00 @@ -11,7 +11,7 @@ #define EFS_DIRBSIZE (1 << EFS_DIRBSIZE_BITS) struct efs_dentry { - unsigned int inode; + __be32 inode; unsigned char namelen; char name[3]; }; @@ -23,7 +23,7 @@ #define EFS_DIRBLK_MAGIC 0xbeef /* moo */ struct efs_dir { - unsigned short magic; + __be16 magic; unsigned char firstused; unsigned char slots; diff -Nru a/include/linux/efs_fs_i.h b/include/linux/efs_fs_i.h --- a/include/linux/efs_fs_i.h 2004-09-26 10:25:56 -07:00 +++ b/include/linux/efs_fs_i.h 2004-09-26 10:25:56 -07:00 @@ -28,8 +28,8 @@ } efs_extent; typedef struct edevs { - short odev; - unsigned int ndev; + __be16 odev; + __be32 ndev; } efs_devs; /* @@ -37,16 +37,16 @@ * is exactly 128 bytes long. */ struct efs_dinode { - u_short di_mode; /* mode and type of file */ - short di_nlink; /* number of links to file */ - u_short di_uid; /* owner's user id */ - u_short di_gid; /* owner's group id */ - int32_t di_size; /* number of bytes in file */ - int32_t di_atime; /* time last accessed */ - int32_t di_mtime; /* time last modified */ - int32_t di_ctime; /* time created */ - uint32_t di_gen; /* generation number */ - short di_numextents; /* # of extents */ + __be16 di_mode; /* mode and type of file */ + __be16 di_nlink; /* number of links to file */ + __be16 di_uid; /* owner's user id */ + __be16 di_gid; /* owner's group id */ + __be32 di_size; /* number of bytes in file */ + __be32 di_atime; /* time last accessed */ + __be32 di_mtime; /* time last modified */ + __be32 di_ctime; /* time created */ + __be32 di_gen; /* generation number */ + __be16 di_numextents; /* # of extents */ u_char di_version; /* version of inode */ u_char di_spare; /* spare - used by AFS */ union di_addr { diff -Nru a/include/linux/efs_fs_sb.h b/include/linux/efs_fs_sb.h --- a/include/linux/efs_fs_sb.h 2004-09-26 10:25:56 -07:00 +++ b/include/linux/efs_fs_sb.h 2004-09-26 10:25:56 -07:00 @@ -23,39 +23,39 @@ /* efs superblock on disk */ struct efs_super { - int32_t fs_size; /* size of filesystem, in sectors */ - int32_t fs_firstcg; /* bb offset to first cg */ - int32_t fs_cgfsize; /* size of cylinder group in bb's */ - short fs_cgisize; /* bb's of inodes per cylinder group */ - short fs_sectors; /* sectors per track */ - short fs_heads; /* heads per cylinder */ - short fs_ncg; /* # of cylinder groups in filesystem */ - short fs_dirty; /* fs needs to be fsck'd */ - int32_t fs_time; /* last super-block update */ - int32_t fs_magic; /* magic number */ + __be32 fs_size; /* size of filesystem, in sectors */ + __be32 fs_firstcg; /* bb offset to first cg */ + __be32 fs_cgfsize; /* size of cylinder group in bb's */ + __be16 fs_cgisize; /* bb's of inodes per cylinder group */ + __be16 fs_sectors; /* sectors per track */ + __be16 fs_heads; /* heads per cylinder */ + __be16 fs_ncg; /* # of cylinder groups in filesystem */ + __be16 fs_dirty; /* fs needs to be fsck'd */ + __be32 fs_time; /* last super-block update */ + __be32 fs_magic; /* magic number */ char fs_fname[6]; /* file system name */ char fs_fpack[6]; /* file system pack name */ - int32_t fs_bmsize; /* size of bitmap in bytes */ - int32_t fs_tfree; /* total free data blocks */ - int32_t fs_tinode; /* total free inodes */ - int32_t fs_bmblock; /* bitmap location. */ - int32_t fs_replsb; /* Location of replicated superblock. */ - int32_t fs_lastialloc; /* last allocated inode */ + __be32 fs_bmsize; /* size of bitmap in bytes */ + __be32 fs_tfree; /* total free data blocks */ + __be32 fs_tinode; /* total free inodes */ + __be32 fs_bmblock; /* bitmap location. */ + __be32 fs_replsb; /* Location of replicated superblock. */ + __be32 fs_lastialloc; /* last allocated inode */ char fs_spare[20]; /* space for expansion - MUST BE ZERO */ - int32_t fs_checksum; /* checksum of volume portion of fs */ + __be32 fs_checksum; /* checksum of volume portion of fs */ }; /* efs superblock information in memory */ struct efs_sb_info { - int32_t fs_magic; /* superblock magic number */ - int32_t fs_start; /* first block of filesystem */ - int32_t first_block; /* first data block in filesystem */ - int32_t total_blocks; /* total number of blocks in filesystem */ - int32_t group_size; /* # of blocks a group consists of */ - int32_t data_free; /* # of free data blocks */ - int32_t inode_free; /* # of free inodes */ - short inode_blocks; /* # of blocks used for inodes in every grp */ - short total_groups; /* # of groups */ + __u32 fs_magic; /* superblock magic number */ + __u32 fs_start; /* first block of filesystem */ + __u32 first_block; /* first data block in filesystem */ + __u32 total_blocks; /* total number of blocks in filesystem */ + __u32 group_size; /* # of blocks a group consists of */ + __u32 data_free; /* # of free data blocks */ + __u32 inode_free; /* # of free inodes */ + __u16 inode_blocks; /* # of blocks used for inodes in every grp */ + __u16 total_groups; /* # of groups */ }; #endif /* __EFS_FS_SB_H__ */ diff -Nru a/include/linux/efs_vh.h b/include/linux/efs_vh.h --- a/include/linux/efs_vh.h 2004-09-26 10:25:56 -07:00 +++ b/include/linux/efs_vh.h 2004-09-26 10:25:56 -07:00 @@ -17,26 +17,26 @@ struct volume_directory { char vd_name[VDNAMESIZE]; /* name */ - int vd_lbn; /* logical block number */ - int vd_nbytes; /* file length in bytes */ + __be32 vd_lbn; /* logical block number */ + __be32 vd_nbytes; /* file length in bytes */ }; struct partition_table { /* one per logical partition */ - int pt_nblks; /* # of logical blks in partition */ - int pt_firstlbn; /* first lbn of partition */ - int pt_type; /* use of partition */ + __be32 pt_nblks; /* # of logical blks in partition */ + __be32 pt_firstlbn; /* first lbn of partition */ + __be32 pt_type; /* use of partition */ }; struct volume_header { - int vh_magic; /* identifies volume header */ - short vh_rootpt; /* root partition number */ - short vh_swappt; /* swap partition number */ + __be32 vh_magic; /* identifies volume header */ + __be16 vh_rootpt; /* root partition number */ + __be16 vh_swappt; /* swap partition number */ char vh_bootfile[BFNAMESIZE]; /* name of file to boot */ char pad[48]; /* device param space */ struct volume_directory vh_vd[NVDIR]; /* other vol hdr contents */ struct partition_table vh_pt[NPARTAB]; /* device partition layout */ - int vh_csum; /* volume header checksum */ - int vh_fill; /* fill out to 512 bytes */ + __be32 vh_csum; /* volume header checksum */ + __be32 vh_fill; /* fill out to 512 bytes */ }; /* partition type sysv is used for EFS format CD-ROM partitions */ diff -Nru a/include/linux/elf.h b/include/linux/elf.h --- a/include/linux/elf.h 2004-09-26 10:25:55 -07:00 +++ b/include/linux/elf.h 2004-09-26 10:25:55 -07:00 @@ -88,7 +88,9 @@ #define EM_V850 87 /* NEC v850 */ -#define EM_H8_300 46 /* Hitachi H8/300,300H,H8S */ +#define EM_M32R 88 /* Renesas M32R */ + +#define EM_H8_300 46 /* Renesas H8/300,300H,H8S */ /* * This is an interim value that we will use until the committee comes @@ -98,6 +100,9 @@ /* Bogus old v850 magic number, used by old tools. */ #define EM_CYGNUS_V850 0x9080 + +/* Bogus old m32r magic number, used by old tools. */ +#define EM_CYGNUS_M32R 0x9041 /* * This is the old interim value for S/390 architecture diff -Nru a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h --- a/include/linux/ext3_fs.h 2004-09-26 10:25:56 -07:00 +++ b/include/linux/ext3_fs.h 2004-09-26 10:25:56 -07:00 @@ -129,14 +129,14 @@ */ struct ext3_group_desc { - __u32 bg_block_bitmap; /* Blocks bitmap block */ - __u32 bg_inode_bitmap; /* Inodes bitmap block */ - __u32 bg_inode_table; /* Inodes table block */ - __u16 bg_free_blocks_count; /* Free blocks count */ - __u16 bg_free_inodes_count; /* Free inodes count */ - __u16 bg_used_dirs_count; /* Directories count */ + __le32 bg_block_bitmap; /* Blocks bitmap block */ + __le32 bg_inode_bitmap; /* Inodes bitmap block */ + __le32 bg_inode_table; /* Inodes table block */ + __le16 bg_free_blocks_count; /* Free blocks count */ + __le16 bg_free_inodes_count; /* Free inodes count */ + __le16 bg_used_dirs_count; /* Directories count */ __u16 bg_pad; - __u32 bg_reserved[3]; + __le32 bg_reserved[3]; }; /* @@ -213,17 +213,17 @@ * Structure of an inode on the disk */ struct ext3_inode { - __u16 i_mode; /* File mode */ - __u16 i_uid; /* Low 16 bits of Owner Uid */ - __u32 i_size; /* Size in bytes */ - __u32 i_atime; /* Access time */ - __u32 i_ctime; /* Creation time */ - __u32 i_mtime; /* Modification time */ - __u32 i_dtime; /* Deletion Time */ - __u16 i_gid; /* Low 16 bits of Group Id */ - __u16 i_links_count; /* Links count */ - __u32 i_blocks; /* Blocks count */ - __u32 i_flags; /* File flags */ + __le16 i_mode; /* File mode */ + __le16 i_uid; /* Low 16 bits of Owner Uid */ + __le32 i_size; /* Size in bytes */ + __le32 i_atime; /* Access time */ + __le32 i_ctime; /* Creation time */ + __le32 i_mtime; /* Modification time */ + __le32 i_dtime; /* Deletion Time */ + __le16 i_gid; /* Low 16 bits of Group Id */ + __le16 i_links_count; /* Links count */ + __le32 i_blocks; /* Blocks count */ + __le32 i_flags; /* File flags */ union { struct { __u32 l_i_reserved1; @@ -235,18 +235,18 @@ __u32 m_i_reserved1; } masix1; } osd1; /* OS dependent 1 */ - __u32 i_block[EXT3_N_BLOCKS];/* Pointers to blocks */ - __u32 i_generation; /* File version (for NFS) */ - __u32 i_file_acl; /* File ACL */ - __u32 i_dir_acl; /* Directory ACL */ - __u32 i_faddr; /* Fragment address */ + __le32 i_block[EXT3_N_BLOCKS];/* Pointers to blocks */ + __le32 i_generation; /* File version (for NFS) */ + __le32 i_file_acl; /* File ACL */ + __le32 i_dir_acl; /* Directory ACL */ + __le32 i_faddr; /* Fragment address */ union { struct { __u8 l_i_frag; /* Fragment number */ __u8 l_i_fsize; /* Fragment size */ __u16 i_pad1; - __u16 l_i_uid_high; /* these 2 fields */ - __u16 l_i_gid_high; /* were reserved2[0] */ + __le16 l_i_uid_high; /* these 2 fields */ + __le16 l_i_gid_high; /* were reserved2[0] */ __u32 l_i_reserved2; } linux2; struct { @@ -364,31 +364,31 @@ * Structure of the super block */ struct ext3_super_block { -/*00*/ __u32 s_inodes_count; /* Inodes count */ - __u32 s_blocks_count; /* Blocks count */ - __u32 s_r_blocks_count; /* Reserved blocks count */ - __u32 s_free_blocks_count; /* Free blocks count */ -/*10*/ __u32 s_free_inodes_count; /* Free inodes count */ - __u32 s_first_data_block; /* First Data Block */ - __u32 s_log_block_size; /* Block size */ - __s32 s_log_frag_size; /* Fragment size */ -/*20*/ __u32 s_blocks_per_group; /* # Blocks per group */ - __u32 s_frags_per_group; /* # Fragments per group */ - __u32 s_inodes_per_group; /* # Inodes per group */ - __u32 s_mtime; /* Mount time */ -/*30*/ __u32 s_wtime; /* Write time */ - __u16 s_mnt_count; /* Mount count */ - __s16 s_max_mnt_count; /* Maximal mount count */ - __u16 s_magic; /* Magic signature */ - __u16 s_state; /* File system state */ - __u16 s_errors; /* Behaviour when detecting errors */ - __u16 s_minor_rev_level; /* minor revision level */ -/*40*/ __u32 s_lastcheck; /* time of last check */ - __u32 s_checkinterval; /* max. time between checks */ - __u32 s_creator_os; /* OS */ - __u32 s_rev_level; /* Revision level */ -/*50*/ __u16 s_def_resuid; /* Default uid for reserved blocks */ - __u16 s_def_resgid; /* Default gid for reserved blocks */ +/*00*/ __le32 s_inodes_count; /* Inodes count */ + __le32 s_blocks_count; /* Blocks count */ + __le32 s_r_blocks_count; /* Reserved blocks count */ + __le32 s_free_blocks_count; /* Free blocks count */ +/*10*/ __le32 s_free_inodes_count; /* Free inodes count */ + __le32 s_first_data_block; /* First Data Block */ + __le32 s_log_block_size; /* Block size */ + __le32 s_log_frag_size; /* Fragment size */ +/*20*/ __le32 s_blocks_per_group; /* # Blocks per group */ + __le32 s_frags_per_group; /* # Fragments per group */ + __le32 s_inodes_per_group; /* # Inodes per group */ + __le32 s_mtime; /* Mount time */ +/*30*/ __le32 s_wtime; /* Write time */ + __le16 s_mnt_count; /* Mount count */ + __le16 s_max_mnt_count; /* Maximal mount count */ + __le16 s_magic; /* Magic signature */ + __le16 s_state; /* File system state */ + __le16 s_errors; /* Behaviour when detecting errors */ + __le16 s_minor_rev_level; /* minor revision level */ +/*40*/ __le32 s_lastcheck; /* time of last check */ + __le32 s_checkinterval; /* max. time between checks */ + __le32 s_creator_os; /* OS */ + __le32 s_rev_level; /* Revision level */ +/*50*/ __le16 s_def_resuid; /* Default uid for reserved blocks */ + __le16 s_def_resgid; /* Default gid for reserved blocks */ /* * These fields are for EXT3_DYNAMIC_REV superblocks only. * @@ -402,16 +402,16 @@ * feature set, it must abort and not try to meddle with * things it doesn't understand... */ - __u32 s_first_ino; /* First non-reserved inode */ - __u16 s_inode_size; /* size of inode structure */ - __u16 s_block_group_nr; /* block group # of this superblock */ - __u32 s_feature_compat; /* compatible feature set */ -/*60*/ __u32 s_feature_incompat; /* incompatible feature set */ - __u32 s_feature_ro_compat; /* readonly-compatible feature set */ + __le32 s_first_ino; /* First non-reserved inode */ + __le16 s_inode_size; /* size of inode structure */ + __le16 s_block_group_nr; /* block group # of this superblock */ + __le32 s_feature_compat; /* compatible feature set */ +/*60*/ __le32 s_feature_incompat; /* incompatible feature set */ + __le32 s_feature_ro_compat; /* readonly-compatible feature set */ /*68*/ __u8 s_uuid[16]; /* 128-bit uuid for volume */ /*78*/ char s_volume_name[16]; /* volume name */ /*88*/ char s_last_mounted[64]; /* directory where last mounted */ -/*C8*/ __u32 s_algorithm_usage_bitmap; /* For compression */ +/*C8*/ __le32 s_algorithm_usage_bitmap; /* For compression */ /* * Performance hints. Directory preallocation should only * happen if the EXT3_FEATURE_COMPAT_DIR_PREALLOC flag is on. @@ -423,15 +423,15 @@ * Journaling support valid if EXT3_FEATURE_COMPAT_HAS_JOURNAL set. */ /*D0*/ __u8 s_journal_uuid[16]; /* uuid of journal superblock */ -/*E0*/ __u32 s_journal_inum; /* inode number of journal file */ - __u32 s_journal_dev; /* device number of journal file */ - __u32 s_last_orphan; /* start of list of inodes to delete */ - __u32 s_hash_seed[4]; /* HTREE hash seed */ +/*E0*/ __le32 s_journal_inum; /* inode number of journal file */ + __le32 s_journal_dev; /* device number of journal file */ + __le32 s_last_orphan; /* start of list of inodes to delete */ + __le32 s_hash_seed[4]; /* HTREE hash seed */ __u8 s_def_hash_version; /* Default hash version to use */ __u8 s_reserved_char_pad; __u16 s_reserved_word_pad; - __u32 s_default_mount_opts; - __u32 s_first_meta_bg; /* First metablock block group */ + __le32 s_default_mount_opts; + __le32 s_first_meta_bg; /* First metablock block group */ __u32 s_reserved[190]; /* Padding to the end of the block */ }; @@ -546,9 +546,9 @@ #define EXT3_NAME_LEN 255 struct ext3_dir_entry { - __u32 inode; /* Inode number */ - __u16 rec_len; /* Directory entry length */ - __u16 name_len; /* Name length */ + __le32 inode; /* Inode number */ + __le16 rec_len; /* Directory entry length */ + __le16 name_len; /* Name length */ char name[EXT3_NAME_LEN]; /* File name */ }; @@ -559,8 +559,8 @@ * file_type field. */ struct ext3_dir_entry_2 { - __u32 inode; /* Inode number */ - __u16 rec_len; /* Directory entry length */ + __le32 inode; /* Inode number */ + __le16 rec_len; /* Directory entry length */ __u8 name_len; /* Name length */ __u8 file_type; char name[EXT3_NAME_LEN]; /* File name */ @@ -724,7 +724,7 @@ extern struct buffer_head * ext3_bread (handle_t *, struct inode *, int, int, int *); extern void ext3_read_inode (struct inode *); -extern void ext3_write_inode (struct inode *, int); +extern int ext3_write_inode (struct inode *, int); extern int ext3_setattr (struct dentry *, struct iattr *); extern void ext3_put_inode (struct inode *); extern void ext3_delete_inode (struct inode *); diff -Nru a/include/linux/ext3_fs_i.h b/include/linux/ext3_fs_i.h --- a/include/linux/ext3_fs_i.h 2004-09-26 10:25:55 -07:00 +++ b/include/linux/ext3_fs_i.h 2004-09-26 10:25:55 -07:00 @@ -22,7 +22,7 @@ * second extended file system inode data in memory */ struct ext3_inode_info { - __u32 i_data[15]; + __le32 i_data[15]; /* unconverted */ __u32 i_flags; #ifdef EXT3_FRAGMENTS __u32 i_faddr; diff -Nru a/include/linux/fb.h b/include/linux/fb.h --- a/include/linux/fb.h 2004-09-26 10:25:56 -07:00 +++ b/include/linux/fb.h 2004-09-26 10:25:56 -07:00 @@ -2,7 +2,6 @@ #define _LINUX_FB_H #include -#include /* Definitions of frame buffers */ @@ -243,74 +242,6 @@ #define VESA_HSYNC_SUSPEND 2 #define VESA_POWERDOWN 3 -/* Definitions below are used in the parsed monitor specs */ -#define FB_DPMS_ACTIVE_OFF 1 -#define FB_DPMS_SUSPEND 2 -#define FB_DPMS_STANDBY 4 - -#define FB_DISP_DDI 1 -#define FB_DISP_ANA_700_300 2 -#define FB_DISP_ANA_714_286 4 -#define FB_DISP_ANA_1000_400 8 -#define FB_DISP_ANA_700_000 16 - -#define FB_DISP_MONO 32 -#define FB_DISP_RGB 64 -#define FB_DISP_MULTI 128 -#define FB_DISP_UNKNOWN 256 - -#define FB_SIGNAL_NONE 0 -#define FB_SIGNAL_BLANK_BLANK 1 -#define FB_SIGNAL_SEPARATE 2 -#define FB_SIGNAL_COMPOSITE 4 -#define FB_SIGNAL_SYNC_ON_GREEN 8 -#define FB_SIGNAL_SERRATION_ON 16 - -#define FB_MISC_PRIM_COLOR 1 -#define FB_MISC_1ST_DETAIL 2 /* First Detailed Timing is preferred */ - -struct fb_chroma { - __u32 redx; /* in fraction of 1024 */ - __u32 greenx; - __u32 bluex; - __u32 whitex; - __u32 redy; - __u32 greeny; - __u32 bluey; - __u32 whitey; -}; - -struct fb_monspecs { - struct fb_chroma chroma; - struct fb_videomode *modedb; /* mode database */ - struct list_head modelist; /* mode list */ - __u8 manufacturer[4]; /* Manufacturer */ - __u8 monitor[14]; /* Monitor String */ - __u8 serial_no[14]; /* Serial Number */ - __u8 ascii[14]; /* ? */ - __u32 modedb_len; /* mode database length */ - __u32 model; /* Monitor Model */ - __u32 serial; /* Serial Number - Integer */ - __u32 year; /* Year manufactured */ - __u32 week; /* Week Manufactured */ - __u32 hfmin; /* hfreq lower limit (Hz) */ - __u32 hfmax; /* hfreq upper limit (Hz) */ - __u32 dclkmin; /* pixelclock lower limit (Hz) */ - __u32 dclkmax; /* pixelclock upper limit (Hz) */ - __u16 input; /* display type - see FB_DISP_* */ - __u16 dpms; /* DPMS support - see FB_DPMS_ */ - __u16 signal; /* Signal Type - see FB_SIGNAL_* */ - __u16 vfmin; /* vfreq lower limit (Hz) */ - __u16 vfmax; /* vfreq upper limit (Hz) */ - __u16 gamma; /* Gamma - in fractions of 100 */ - __u16 gtf : 1; /* supports GTF */ - __u16 misc; /* Misc flags - see FB_MISC_* */ - __u8 version; /* EDID version... */ - __u8 revision; /* ...and revision */ - __u8 max_x; /* Maximum horizontal size (cm) */ - __u8 max_y; /* Maximum vertical size (cm) */ -}; - #define FB_VBLANK_VBLANKING 0x001 /* currently in a vertical blank */ #define FB_VBLANK_HBLANKING 0x002 /* currently in a horizontal blank */ #define FB_VBLANK_HAVE_VBLANK 0x004 /* vertical blanks can be detected */ @@ -399,6 +330,7 @@ #include #include #include +#include #include struct vm_area_struct; @@ -406,6 +338,72 @@ struct device; struct file; +/* Definitions below are used in the parsed monitor specs */ +#define FB_DPMS_ACTIVE_OFF 1 +#define FB_DPMS_SUSPEND 2 +#define FB_DPMS_STANDBY 4 + +#define FB_DISP_DDI 1 +#define FB_DISP_ANA_700_300 2 +#define FB_DISP_ANA_714_286 4 +#define FB_DISP_ANA_1000_400 8 +#define FB_DISP_ANA_700_000 16 + +#define FB_DISP_MONO 32 +#define FB_DISP_RGB 64 +#define FB_DISP_MULTI 128 +#define FB_DISP_UNKNOWN 256 + +#define FB_SIGNAL_NONE 0 +#define FB_SIGNAL_BLANK_BLANK 1 +#define FB_SIGNAL_SEPARATE 2 +#define FB_SIGNAL_COMPOSITE 4 +#define FB_SIGNAL_SYNC_ON_GREEN 8 +#define FB_SIGNAL_SERRATION_ON 16 + +#define FB_MISC_PRIM_COLOR 1 +#define FB_MISC_1ST_DETAIL 2 /* First Detailed Timing is preferred */ +struct fb_chroma { + __u32 redx; /* in fraction of 1024 */ + __u32 greenx; + __u32 bluex; + __u32 whitex; + __u32 redy; + __u32 greeny; + __u32 bluey; + __u32 whitey; +}; + +struct fb_monspecs { + struct fb_chroma chroma; + struct fb_videomode *modedb; /* mode database */ + __u8 manufacturer[4]; /* Manufacturer */ + __u8 monitor[14]; /* Monitor String */ + __u8 serial_no[14]; /* Serial Number */ + __u8 ascii[14]; /* ? */ + __u32 modedb_len; /* mode database length */ + __u32 model; /* Monitor Model */ + __u32 serial; /* Serial Number - Integer */ + __u32 year; /* Year manufactured */ + __u32 week; /* Week Manufactured */ + __u32 hfmin; /* hfreq lower limit (Hz) */ + __u32 hfmax; /* hfreq upper limit (Hz) */ + __u32 dclkmin; /* pixelclock lower limit (Hz) */ + __u32 dclkmax; /* pixelclock upper limit (Hz) */ + __u16 input; /* display type - see FB_DISP_* */ + __u16 dpms; /* DPMS support - see FB_DPMS_ */ + __u16 signal; /* Signal Type - see FB_SIGNAL_* */ + __u16 vfmin; /* vfreq lower limit (Hz) */ + __u16 vfmax; /* vfreq upper limit (Hz) */ + __u16 gamma; /* Gamma - in fractions of 100 */ + __u16 gtf : 1; /* supports GTF */ + __u16 misc; /* Misc flags - see FB_MISC_* */ + __u8 version; /* EDID version... */ + __u8 revision; /* ...and revision */ + __u8 max_x; /* Maximum horizontal size (cm) */ + __u8 max_y; /* Maximum vertical size (cm) */ +}; + struct fb_cmap_user { __u32 start; /* First entry */ __u32 len; /* Number of entries */ @@ -601,6 +599,7 @@ struct fb_pixmap pixmap; /* Image hardware mapper */ struct fb_pixmap sprite; /* Cursor hardware mapper */ struct fb_cmap cmap; /* Current cmap */ + struct list_head modelist; /* mode list */ struct fb_ops *fbops; char __iomem *screen_base; /* Virtual address */ unsigned long screen_size; /* Amount of ioremapped VRAM or 0 */ @@ -709,7 +708,7 @@ extern void fb_load_cursor_image(struct fb_info *); extern void fb_set_suspend(struct fb_info *info, int state); extern int fb_get_color_depth(struct fb_info *info); -extern char* fb_get_options(char *name); +extern int fb_get_options(char *name, char **option); extern struct fb_info *registered_fb[FB_MAX]; extern int num_registered_fb; diff -Nru a/include/linux/fs.h b/include/linux/fs.h --- a/include/linux/fs.h 2004-09-26 10:25:55 -07:00 +++ b/include/linux/fs.h 2004-09-26 10:25:55 -07:00 @@ -960,7 +960,7 @@ void (*read_inode) (struct inode *); void (*dirty_inode) (struct inode *); - void (*write_inode) (struct inode *, int); + int (*write_inode) (struct inode *, int); void (*put_inode) (struct inode *); void (*drop_inode) (struct inode *); void (*delete_inode) (struct inode *); @@ -1149,6 +1149,7 @@ struct super_block *get_sb_pseudo(struct file_system_type *, char *, struct super_operations *ops, unsigned long); int __put_super(struct super_block *sb); +int __put_super_and_need_restart(struct super_block *sb); void unnamed_dev_init(void); /* Alas, no aliases. Too much hassle with bringing module.h everywhere */ @@ -1473,18 +1474,21 @@ ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, struct block_device *bdev, const struct iovec *iov, loff_t offset, unsigned long nr_segs, get_blocks_t get_blocks, dio_iodone_t end_io, - int needs_special_locking); + int lock_type); + +enum { + DIO_LOCKING = 1, /* need locking between buffered and direct access */ + DIO_NO_LOCKING, /* bdev; no locking at all between buffered/direct */ + DIO_OWN_LOCKING, /* filesystem locks buffered and direct internally */ +}; -/* - * For filesystems which need locking between buffered and direct access - */ static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, struct block_device *bdev, const struct iovec *iov, loff_t offset, unsigned long nr_segs, get_blocks_t get_blocks, dio_iodone_t end_io) { return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, - nr_segs, get_blocks, end_io, 1); + nr_segs, get_blocks, end_io, DIO_LOCKING); } static inline ssize_t blockdev_direct_IO_no_locking(int rw, struct kiocb *iocb, @@ -1493,7 +1497,16 @@ dio_iodone_t end_io) { return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, - nr_segs, get_blocks, end_io, 0); + nr_segs, get_blocks, end_io, DIO_NO_LOCKING); +} + +static inline ssize_t blockdev_direct_IO_own_locking(int rw, struct kiocb *iocb, + struct inode *inode, struct block_device *bdev, const struct iovec *iov, + loff_t offset, unsigned long nr_segs, get_blocks_t get_blocks, + dio_iodone_t end_io) +{ + return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, + nr_segs, get_blocks, end_io, DIO_OWN_LOCKING); } extern struct file_operations generic_ro_fops; diff -Nru a/include/linux/genhd.h b/include/linux/genhd.h --- a/include/linux/genhd.h 2004-09-26 10:25:55 -07:00 +++ b/include/linux/genhd.h 2004-09-26 10:25:55 -07:00 @@ -249,7 +249,7 @@ /* check against BSD src/sys/sys/disklabel.h for consistency */ #define BSD_DISKMAGIC (0x82564557UL) /* The disk magic number */ -#define BSD_MAXPARTITIONS 8 +#define BSD_MAXPARTITIONS 16 #define OPENBSD_MAXPARTITIONS 16 #define BSD_FS_UNUSED 0 /* disklabel unused partition entry ID */ struct bsd_disklabel { diff -Nru a/include/linux/ghash.h b/include/linux/ghash.h --- a/include/linux/ghash.h 2004-09-26 10:25:56 -07:00 +++ /dev/null Wed Dec 31 16:00:00 196900 @@ -1,236 +0,0 @@ -/* - * include/linux/ghash.h -- generic hashing with fuzzy retrieval - * - * (C) 1997 Thomas Schoebel-Theuer - * - * The algorithms implemented here seem to be a completely new invention, - * and I'll publish the fundamentals in a paper. - */ - -#ifndef _GHASH_H -#define _GHASH_H -/* HASHSIZE _must_ be a power of two!!! */ - - -#define DEF_HASH_FUZZY_STRUCTS(NAME,HASHSIZE,TYPE) \ -\ -struct NAME##_table {\ - TYPE * hashtable[HASHSIZE];\ - TYPE * sorted_list;\ - int nr_entries;\ -};\ -\ -struct NAME##_ptrs {\ - TYPE * next_hash;\ - TYPE * prev_hash;\ - TYPE * next_sorted;\ - TYPE * prev_sorted;\ -}; - -#define DEF_HASH_FUZZY(LINKAGE,NAME,HASHSIZE,TYPE,PTRS,KEYTYPE,KEY,KEYCMP,KEYEQ,HASHFN)\ -\ -LINKAGE void insert_##NAME##_hash(struct NAME##_table * tbl, TYPE * elem)\ -{\ - int ix = HASHFN(elem->KEY);\ - TYPE ** base = &tbl->hashtable[ix];\ - TYPE * ptr = *base;\ - TYPE * prev = NULL;\ -\ - tbl->nr_entries++;\ - while(ptr && KEYCMP(ptr->KEY, elem->KEY)) {\ - base = &ptr->PTRS.next_hash;\ - prev = ptr;\ - ptr = *base;\ - }\ - elem->PTRS.next_hash = ptr;\ - elem->PTRS.prev_hash = prev;\ - if(ptr) {\ - ptr->PTRS.prev_hash = elem;\ - }\ - *base = elem;\ -\ - ptr = prev;\ - if(!ptr) {\ - ptr = tbl->sorted_list;\ - prev = NULL;\ - } else {\ - prev = ptr->PTRS.prev_sorted;\ - }\ - while(ptr) {\ - TYPE * next = ptr->PTRS.next_hash;\ - if(next && KEYCMP(next->KEY, elem->KEY)) {\ - prev = ptr;\ - ptr = next;\ - } else if(KEYCMP(ptr->KEY, elem->KEY)) {\ - prev = ptr;\ - ptr = ptr->PTRS.next_sorted;\ - } else\ - break;\ - }\ - elem->PTRS.next_sorted = ptr;\ - elem->PTRS.prev_sorted = prev;\ - if(ptr) {\ - ptr->PTRS.prev_sorted = elem;\ - }\ - if(prev) {\ - prev->PTRS.next_sorted = elem;\ - } else {\ - tbl->sorted_list = elem;\ - }\ -}\ -\ -LINKAGE void remove_##NAME##_hash(struct NAME##_table * tbl, TYPE * elem)\ -{\ - TYPE * next = elem->PTRS.next_hash;\ - TYPE * prev = elem->PTRS.prev_hash;\ -\ - tbl->nr_entries--;\ - if(next)\ - next->PTRS.prev_hash = prev;\ - if(prev)\ - prev->PTRS.next_hash = next;\ - else {\ - int ix = HASHFN(elem->KEY);\ - tbl->hashtable[ix] = next;\ - }\ -\ - next = elem->PTRS.next_sorted;\ - prev = elem->PTRS.prev_sorted;\ - if(next)\ - next->PTRS.prev_sorted = prev;\ - if(prev)\ - prev->PTRS.next_sorted = next;\ - else\ - tbl->sorted_list = next;\ -}\ -\ -LINKAGE TYPE * find_##NAME##_hash(struct NAME##_table * tbl, KEYTYPE pos)\ -{\ - int ix = hashfn(pos);\ - TYPE * ptr = tbl->hashtable[ix];\ - while(ptr && KEYCMP(ptr->KEY, pos))\ - ptr = ptr->PTRS.next_hash;\ - if(ptr && !KEYEQ(ptr->KEY, pos))\ - ptr = NULL;\ - return ptr;\ -}\ -\ -LINKAGE TYPE * find_##NAME##_hash_fuzzy(struct NAME##_table * tbl, KEYTYPE pos)\ -{\ - int ix;\ - int offset;\ - TYPE * ptr;\ - TYPE * next;\ -\ - ptr = tbl->sorted_list;\ - if(!ptr || KEYCMP(pos, ptr->KEY))\ - return NULL;\ - ix = HASHFN(pos);\ - offset = HASHSIZE;\ - do {\ - offset >>= 1;\ - next = tbl->hashtable[(ix+offset) & ((HASHSIZE)-1)];\ - if(next && (KEYCMP(next->KEY, pos) || KEYEQ(next->KEY, pos))\ - && KEYCMP(ptr->KEY, next->KEY))\ - ptr = next;\ - } while(offset);\ -\ - for(;;) {\ - next = ptr->PTRS.next_hash;\ - if(next) {\ - if(KEYCMP(next->KEY, pos)) {\ - ptr = next;\ - continue;\ - }\ - }\ - next = ptr->PTRS.next_sorted;\ - if(next && KEYCMP(next->KEY, pos)) {\ - ptr = next;\ - continue;\ - }\ - return ptr;\ - }\ - return NULL;\ -} - -/* LINKAGE - empty or "static", depending on whether you want the definitions to - * be public or not - * NAME - a string to stick in names to make this hash table type distinct from - * any others - * HASHSIZE - number of buckets - * TYPE - type of data contained in the buckets - must be a structure, one - * field is of type NAME_ptrs, another is the hash key - * PTRS - TYPE must contain a field of type NAME_ptrs, PTRS is the name of that - * field - * KEYTYPE - type of the key field within TYPE - * KEY - name of the key field within TYPE - * KEYCMP - pointer to function that compares KEYTYPEs to each other - the - * prototype is int KEYCMP(KEYTYPE, KEYTYPE), it returns zero for equal, - * non-zero for not equal - * HASHFN - the hash function - the prototype is int HASHFN(KEYTYPE), - * it returns a number in the range 0 ... HASHSIZE - 1 - * Call DEF_HASH_STRUCTS, define your hash table as a NAME_table, then call - * DEF_HASH. - */ - -#define DEF_HASH_STRUCTS(NAME,HASHSIZE,TYPE) \ -\ -struct NAME##_table {\ - TYPE * hashtable[HASHSIZE];\ - int nr_entries;\ -};\ -\ -struct NAME##_ptrs {\ - TYPE * next_hash;\ - TYPE * prev_hash;\ -}; - -#define DEF_HASH(LINKAGE,NAME,TYPE,PTRS,KEYTYPE,KEY,KEYCMP,HASHFN)\ -\ -LINKAGE void insert_##NAME##_hash(struct NAME##_table * tbl, TYPE * elem)\ -{\ - int ix = HASHFN(elem->KEY);\ - TYPE ** base = &tbl->hashtable[ix];\ - TYPE * ptr = *base;\ - TYPE * prev = NULL;\ -\ - tbl->nr_entries++;\ - while(ptr && KEYCMP(ptr->KEY, elem->KEY)) {\ - base = &ptr->PTRS.next_hash;\ - prev = ptr;\ - ptr = *base;\ - }\ - elem->PTRS.next_hash = ptr;\ - elem->PTRS.prev_hash = prev;\ - if(ptr) {\ - ptr->PTRS.prev_hash = elem;\ - }\ - *base = elem;\ -}\ -\ -LINKAGE void remove_##NAME##_hash(struct NAME##_table * tbl, TYPE * elem)\ -{\ - TYPE * next = elem->PTRS.next_hash;\ - TYPE * prev = elem->PTRS.prev_hash;\ -\ - tbl->nr_entries--;\ - if(next)\ - next->PTRS.prev_hash = prev;\ - if(prev)\ - prev->PTRS.next_hash = next;\ - else {\ - int ix = HASHFN(elem->KEY);\ - tbl->hashtable[ix] = next;\ - }\ -}\ -\ -LINKAGE TYPE * find_##NAME##_hash(struct NAME##_table * tbl, KEYTYPE pos)\ -{\ - int ix = HASHFN(pos);\ - TYPE * ptr = tbl->hashtable[ix];\ - while(ptr && KEYCMP(ptr->KEY, pos))\ - ptr = ptr->PTRS.next_hash;\ - return ptr;\ -} - -#endif diff -Nru a/include/linux/hardirq.h b/include/linux/hardirq.h --- a/include/linux/hardirq.h 2004-09-26 10:25:56 -07:00 +++ b/include/linux/hardirq.h 2004-09-26 10:25:56 -07:00 @@ -2,9 +2,7 @@ #define LINUX_HARDIRQ_H #include -#ifdef CONFIG_PREEPT #include -#endif #include #define __IRQ_MASK(x) ((1UL << (x))-1) @@ -28,9 +26,6 @@ #define in_irq() (hardirq_count()) #define in_softirq() (softirq_count()) #define in_interrupt() (irq_count()) - -#define hardirq_trylock() (!in_interrupt()) -#define hardirq_endlock() do { } while (0) #ifdef CONFIG_PREEMPT # define in_atomic() ((preempt_count() & ~PREEMPT_ACTIVE) != kernel_locked()) diff -Nru a/include/linux/ide.h b/include/linux/ide.h --- a/include/linux/ide.h 2004-09-26 10:25:56 -07:00 +++ b/include/linux/ide.h 2004-09-26 10:25:56 -07:00 @@ -929,7 +929,6 @@ struct scatterlist *sg_table; int sg_nents; /* Current number of entries in it */ int sg_dma_direction; /* dma transfer direction */ - int sg_dma_active; /* is it in use */ /* data phase of the active command (currently only valid for PIO/DMA) */ int data_phase; diff -Nru a/include/linux/if_ether.h b/include/linux/if_ether.h --- a/include/linux/if_ether.h 2004-09-26 10:25:56 -07:00 +++ b/include/linux/if_ether.h 2004-09-26 10:25:56 -07:00 @@ -59,6 +59,8 @@ #define ETH_P_8021Q 0x8100 /* 802.1Q VLAN Extended Header */ #define ETH_P_IPX 0x8137 /* IPX over DIX */ #define ETH_P_IPV6 0x86DD /* IPv6 over bluebook */ +#define ETH_P_WCCP 0x883E /* Web-cache coordination protocol + * defined in draft-wilson-wrec-wccp-v2-00.txt */ #define ETH_P_PPP_DISC 0x8863 /* PPPoE discovery messages */ #define ETH_P_PPP_SES 0x8864 /* PPPoE session messages */ #define ETH_P_MPLS_UC 0x8847 /* MPLS Unicast traffic */ diff -Nru a/include/linux/input.h b/include/linux/input.h --- a/include/linux/input.h 2004-09-26 10:25:56 -07:00 +++ b/include/linux/input.h 2004-09-26 10:25:56 -07:00 @@ -527,6 +527,8 @@ #define MSC_SERIAL 0x00 #define MSC_PULSELED 0x01 #define MSC_GESTURE 0x02 +#define MSC_RAW 0x03 +#define MSC_SCAN 0x04 #define MSC_MAX 0x07 /* diff -Nru a/include/linux/ip6_tunnel.h b/include/linux/ip6_tunnel.h --- a/include/linux/ip6_tunnel.h 2004-09-26 10:25:55 -07:00 +++ b/include/linux/ip6_tunnel.h 2004-09-26 10:25:55 -07:00 @@ -16,6 +16,8 @@ #define IP6_TNL_F_USE_ORIG_FLOWLABEL 0x4 /* being used for Mobile IPv6 */ #define IP6_TNL_F_MIP6_DEV 0x8 +/* copy DSCP from the outer packet */ +#define IP6_TNL_F_RCV_DSCP_COPY 0x10 struct ip6_tnl_parm { char name[IFNAMSIZ]; /* name of tunnel device */ diff -Nru a/include/linux/ipv6.h b/include/linux/ipv6.h --- a/include/linux/ipv6.h 2004-09-26 10:25:57 -07:00 +++ b/include/linux/ipv6.h 2004-09-26 10:25:57 -07:00 @@ -282,6 +282,10 @@ return &((struct raw6_sock *)__sk)->raw6; } +struct ipv6_sk_offset { + int offset; +}; + #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) #define __ipv6_only_sock(sk) (inet6_sk(sk)->ipv6only) #define ipv6_only_sock(sk) ((sk)->sk_family == PF_INET6 && __ipv6_only_sock(sk)) diff -Nru a/include/linux/jbd.h b/include/linux/jbd.h --- a/include/linux/jbd.h 2004-09-26 10:25:57 -07:00 +++ b/include/linux/jbd.h 2004-09-26 10:25:57 -07:00 @@ -137,9 +137,9 @@ */ typedef struct journal_header_s { - __u32 h_magic; - __u32 h_blocktype; - __u32 h_sequence; + __be32 h_magic; + __be32 h_blocktype; + __be32 h_sequence; } journal_header_t; @@ -148,8 +148,8 @@ */ typedef struct journal_block_tag_s { - __u32 t_blocknr; /* The on-disk block number */ - __u32 t_flags; /* See below */ + __be32 t_blocknr; /* The on-disk block number */ + __be32 t_flags; /* See below */ } journal_block_tag_t; /* @@ -159,7 +159,7 @@ typedef struct journal_revoke_header_s { journal_header_t r_header; - int r_count; /* Count of bytes used in the block */ + __be32 r_count; /* Count of bytes used in the block */ } journal_revoke_header_t; @@ -180,35 +180,35 @@ /* 0x000C */ /* Static information describing the journal */ - __u32 s_blocksize; /* journal device blocksize */ - __u32 s_maxlen; /* total blocks in journal file */ - __u32 s_first; /* first block of log information */ + __be32 s_blocksize; /* journal device blocksize */ + __be32 s_maxlen; /* total blocks in journal file */ + __be32 s_first; /* first block of log information */ /* 0x0018 */ /* Dynamic information describing the current state of the log */ - __u32 s_sequence; /* first commit ID expected in log */ - __u32 s_start; /* blocknr of start of log */ + __be32 s_sequence; /* first commit ID expected in log */ + __be32 s_start; /* blocknr of start of log */ /* 0x0020 */ /* Error value, as set by journal_abort(). */ - __s32 s_errno; + __be32 s_errno; /* 0x0024 */ /* Remaining fields are only valid in a version-2 superblock */ - __u32 s_feature_compat; /* compatible feature set */ - __u32 s_feature_incompat; /* incompatible feature set */ - __u32 s_feature_ro_compat; /* readonly-compatible feature set */ + __be32 s_feature_compat; /* compatible feature set */ + __be32 s_feature_incompat; /* incompatible feature set */ + __be32 s_feature_ro_compat; /* readonly-compatible feature set */ /* 0x0030 */ __u8 s_uuid[16]; /* 128-bit uuid for journal */ /* 0x0040 */ - __u32 s_nr_users; /* Nr of filesystems sharing log */ + __be32 s_nr_users; /* Nr of filesystems sharing log */ - __u32 s_dynsuper; /* Blocknr of dynamic superblock copy*/ + __be32 s_dynsuper; /* Blocknr of dynamic superblock copy*/ /* 0x0048 */ - __u32 s_max_transaction; /* Limit of journal blocks per trans.*/ - __u32 s_max_trans_data; /* Limit of data blocks per trans. */ + __be32 s_max_transaction; /* Limit of journal blocks per trans.*/ + __be32 s_max_trans_data; /* Limit of data blocks per trans. */ /* 0x0050 */ __u32 s_padding[44]; diff -Nru a/include/linux/kernel.h b/include/linux/kernel.h --- a/include/linux/kernel.h 2004-09-26 10:25:55 -07:00 +++ b/include/linux/kernel.h 2004-09-26 10:25:55 -07:00 @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -111,6 +112,10 @@ return r; } +static inline unsigned long __attribute_const__ roundup_pow_of_two(unsigned long x) +{ + return (1UL << fls(x - 1)); +} extern int printk_ratelimit(void); extern int __printk_ratelimit(int ratelimit_jiffies, int ratelimit_burst); diff -Nru a/include/linux/libata.h b/include/linux/libata.h --- a/include/linux/libata.h 2004-09-26 10:25:55 -07:00 +++ b/include/linux/libata.h 2004-09-26 10:25:55 -07:00 @@ -320,6 +320,7 @@ void (*exec_command)(struct ata_port *ap, struct ata_taskfile *tf); u8 (*check_status)(struct ata_port *ap); + void (*dev_select)(struct ata_port *ap, unsigned int device); void (*phy_reset) (struct ata_port *ap); void (*post_set_mode) (struct ata_port *ap); @@ -362,6 +363,7 @@ }; extern void ata_port_probe(struct ata_port *); +extern void __sata_phy_reset(struct ata_port *ap); extern void sata_phy_reset(struct ata_port *ap); extern void ata_bus_reset(struct ata_port *ap); extern void ata_port_disable(struct ata_port *); @@ -379,31 +381,32 @@ /* * Default driver ops implementations */ -extern void ata_tf_load_pio(struct ata_port *ap, struct ata_taskfile *tf); -extern void ata_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf); -extern void ata_tf_read_pio(struct ata_port *ap, struct ata_taskfile *tf); -extern void ata_tf_read_mmio(struct ata_port *ap, struct ata_taskfile *tf); +extern void ata_tf_load(struct ata_port *ap, struct ata_taskfile *tf); +extern void ata_tf_read(struct ata_port *ap, struct ata_taskfile *tf); extern void ata_tf_to_fis(struct ata_taskfile *tf, u8 *fis, u8 pmp); extern void ata_tf_from_fis(u8 *fis, struct ata_taskfile *tf); -extern u8 ata_check_status_pio(struct ata_port *ap); -extern u8 ata_check_status_mmio(struct ata_port *ap); -extern void ata_exec_command_pio(struct ata_port *ap, struct ata_taskfile *tf); -extern void ata_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf); +extern void ata_noop_dev_select (struct ata_port *ap, unsigned int device); +extern void ata_std_dev_select (struct ata_port *ap, unsigned int device); +extern u8 ata_check_status(struct ata_port *ap); +extern void ata_exec_command(struct ata_port *ap, struct ata_taskfile *tf); extern int ata_port_start (struct ata_port *ap); extern void ata_port_stop (struct ata_port *ap); extern irqreturn_t ata_interrupt (int irq, void *dev_instance, struct pt_regs *regs); +extern struct ata_probe_ent * +ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port); +extern struct ata_probe_ent * +ata_pci_init_legacy_mode(struct pci_dev *pdev, struct ata_port_info **port); extern void ata_qc_prep(struct ata_queued_cmd *qc); extern int ata_qc_issue_prot(struct ata_queued_cmd *qc); extern void ata_sg_init_one(struct ata_queued_cmd *qc, void *buf, unsigned int buflen); extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg, unsigned int n_elem); +extern unsigned int ata_dev_classify(struct ata_taskfile *tf); extern void ata_dev_id_string(struct ata_device *dev, unsigned char *s, unsigned int ofs, unsigned int len); -extern void ata_bmdma_setup_mmio (struct ata_queued_cmd *qc); -extern void ata_bmdma_start_mmio (struct ata_queued_cmd *qc); -extern void ata_bmdma_setup_pio (struct ata_queued_cmd *qc); -extern void ata_bmdma_start_pio (struct ata_queued_cmd *qc); +extern void ata_bmdma_setup (struct ata_queued_cmd *qc); +extern void ata_bmdma_start (struct ata_queued_cmd *qc); extern void ata_bmdma_irq_clear(struct ata_port *ap); extern int pci_test_config_bits(struct pci_dev *pdev, struct pci_bits *bits); extern void ata_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat); diff -Nru a/include/linux/list.h b/include/linux/list.h --- a/include/linux/list.h 2004-09-26 10:25:56 -07:00 +++ b/include/linux/list.h 2004-09-26 10:25:56 -07:00 @@ -195,6 +195,21 @@ entry->prev = LIST_POISON2; } +/* + * list_replace_rcu - replace old entry by new one + * @old : the element to be replaced + * @new : the new element to insert + * + * The old entry will be replaced with the new entry atomically. + */ +static inline void list_replace_rcu(struct list_head *old, struct list_head *new){ + new->next = old->next; + new->prev = old->prev; + smp_wmb(); + new->next->prev = new; + new->prev->next = new; +} + /** * list_del_init - deletes entry from list and reinitialize it. * @entry: the element to delete from the list. diff -Nru a/include/linux/miscdevice.h b/include/linux/miscdevice.h --- a/include/linux/miscdevice.h 2004-09-26 10:25:56 -07:00 +++ b/include/linux/miscdevice.h 2004-09-26 10:25:56 -07:00 @@ -19,6 +19,7 @@ #define SUN_OPENPROM_MINOR 139 #define DMAPI_MINOR 140 /* DMAPI */ #define NVRAM_MINOR 144 +#define SGI_MMTIMER 153 #define STORE_QUEUE_MINOR 155 #define I2O_MINOR 166 #define MICROCODE_MINOR 184 diff -Nru a/include/linux/mmc/card.h b/include/linux/mmc/card.h --- a/include/linux/mmc/card.h 2004-09-26 10:25:57 -07:00 +++ b/include/linux/mmc/card.h 2004-09-26 10:25:57 -07:00 @@ -14,16 +14,17 @@ struct mmc_cid { unsigned int manfid; - unsigned int serial; char prod_name[8]; + unsigned int serial; + unsigned short oemid; + unsigned short year; unsigned char hwrev; unsigned char fwrev; unsigned char month; - unsigned char year; }; struct mmc_csd { - unsigned char mmc_prot; + unsigned char mmca_vsn; unsigned short cmdclass; unsigned short tacc_clks; unsigned int tacc_ns; @@ -43,14 +44,22 @@ struct device dev; /* the device */ unsigned int rca; /* relative card address of device */ unsigned int state; /* (our) card state */ -#define MMC_STATE_PRESENT (1<<0) -#define MMC_STATE_DEAD (1<<1) +#define MMC_STATE_PRESENT (1<<0) /* present in sysfs */ +#define MMC_STATE_DEAD (1<<1) /* device no longer in stack */ +#define MMC_STATE_BAD (1<<2) /* unrecognised device */ + u32 raw_cid[4]; /* raw card CID */ + u32 raw_csd[4]; /* raw card CSD */ struct mmc_cid cid; /* card identification */ struct mmc_csd csd; /* card specific */ }; -#define mmc_card_dead(c) ((c)->state & MMC_STATE_DEAD) #define mmc_card_present(c) ((c)->state & MMC_STATE_PRESENT) +#define mmc_card_dead(c) ((c)->state & MMC_STATE_DEAD) +#define mmc_card_bad(c) ((c)->state & MMC_STATE_BAD) + +#define mmc_card_set_present(c) ((c)->state |= MMC_STATE_PRESENT) +#define mmc_card_set_dead(c) ((c)->state |= MMC_STATE_DEAD) +#define mmc_card_set_bad(c) ((c)->state |= MMC_STATE_BAD) #define mmc_card_name(c) ((c)->cid.prod_name) #define mmc_card_id(c) ((c)->dev.bus_id) diff -Nru a/include/linux/mmtimer.h b/include/linux/mmtimer.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/linux/mmtimer.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,56 @@ +/* + * Intel Multimedia Timer device interface + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (c) 2001-2004 Silicon Graphics, Inc. All rights reserved. + * + * This file should define an interface compatible with the IA-PC Multimedia + * Timers Draft Specification (rev. 0.97) from Intel. Note that some + * hardware may not be able to safely export its registers to userspace, + * so the ioctl interface should support all necessary functionality. + * + * 11/01/01 - jbarnes - initial revision + * 9/10/04 - Christoph Lameter - remove interrupt support + * 9/17/04 - jbarnes - remove test program, move some #defines to the driver + */ + +#ifndef _LINUX_MMTIMER_H +#define _LINUX_MMTIMER_H + +/* + * Breakdown of the ioctl's available. An 'optional' next to the command + * indicates that supporting this command is optional, while 'required' + * commands must be implemented if conformance is desired. + * + * MMTIMER_GETOFFSET - optional + * Should return the offset (relative to the start of the page where the + * registers are mapped) for the counter in question. + * + * MMTIMER_GETRES - required + * The resolution of the clock in femto (10^-15) seconds + * + * MMTIMER_GETFREQ - required + * Frequency of the clock in Hz + * + * MMTIMER_GETBITS - required + * Number of bits in the clock's counter + * + * MMTIMER_MMAPAVAIL - required + * Returns nonzero if the registers can be mmap'd into userspace, 0 otherwise + * + * MMTIMER_GETCOUNTER - required + * Gets the current value in the counter + */ +#define MMTIMER_IOCTL_BASE 'm' + +#define MMTIMER_GETOFFSET _IO(MMTIMER_IOCTL_BASE, 0) +#define MMTIMER_GETRES _IOR(MMTIMER_IOCTL_BASE, 1, unsigned long) +#define MMTIMER_GETFREQ _IOR(MMTIMER_IOCTL_BASE, 2, unsigned long) +#define MMTIMER_GETBITS _IO(MMTIMER_IOCTL_BASE, 4) +#define MMTIMER_MMAPAVAIL _IO(MMTIMER_IOCTL_BASE, 6) +#define MMTIMER_GETCOUNTER _IOR(MMTIMER_IOCTL_BASE, 9, unsigned long) + +#endif /* _LINUX_MMTIMER_H */ diff -Nru a/include/linux/msdos_fs.h b/include/linux/msdos_fs.h --- a/include/linux/msdos_fs.h 2004-09-26 10:25:57 -07:00 +++ b/include/linux/msdos_fs.h 2004-09-26 10:25:57 -07:00 @@ -123,34 +123,34 @@ partition manager volumes */ __u8 sector_size[2]; /* bytes per logical sector */ __u8 sec_per_clus; /* sectors/cluster */ - __u16 reserved; /* reserved sectors */ + __le16 reserved; /* reserved sectors */ __u8 fats; /* number of FATs */ __u8 dir_entries[2]; /* root directory entries */ __u8 sectors[2]; /* number of sectors */ __u8 media; /* media code */ - __u16 fat_length; /* sectors/FAT */ - __u16 secs_track; /* sectors per track */ - __u16 heads; /* number of heads */ - __u32 hidden; /* hidden sectors (unused) */ - __u32 total_sect; /* number of sectors (if sectors == 0) */ + __le16 fat_length; /* sectors/FAT */ + __le16 secs_track; /* sectors per track */ + __le16 heads; /* number of heads */ + __le32 hidden; /* hidden sectors (unused) */ + __le32 total_sect; /* number of sectors (if sectors == 0) */ /* The following fields are only used by FAT32 */ - __u32 fat32_length; /* sectors/FAT */ - __u16 flags; /* bit 8: fat mirroring, low 4: active fat */ + __le32 fat32_length; /* sectors/FAT */ + __le16 flags; /* bit 8: fat mirroring, low 4: active fat */ __u8 version[2]; /* major, minor filesystem version */ - __u32 root_cluster; /* first cluster in root directory */ - __u16 info_sector; /* filesystem info sector */ - __u16 backup_boot; /* backup boot sector */ - __u16 reserved2[6]; /* Unused */ + __le32 root_cluster; /* first cluster in root directory */ + __le16 info_sector; /* filesystem info sector */ + __le16 backup_boot; /* backup boot sector */ + __le16 reserved2[6]; /* Unused */ }; struct fat_boot_fsinfo { - __u32 signature1; /* 0x41615252L */ - __u32 reserved1[120]; /* Nothing as far as I can tell */ - __u32 signature2; /* 0x61417272L */ - __u32 free_clusters; /* Free cluster count. -1 if unknown */ - __u32 next_cluster; /* Most recently allocated cluster */ - __u32 reserved2[4]; + __le32 signature1; /* 0x41615252L */ + __le32 reserved1[120]; /* Nothing as far as I can tell */ + __le32 signature2; /* 0x61417272L */ + __le32 free_clusters; /* Free cluster count. -1 if unknown */ + __le32 next_cluster; /* Most recently allocated cluster */ + __le32 reserved2[4]; }; struct msdos_dir_entry { @@ -158,12 +158,12 @@ __u8 attr; /* attribute bits */ __u8 lcase; /* Case for base and extension */ __u8 ctime_ms; /* Creation time, milliseconds */ - __u16 ctime; /* Creation time */ - __u16 cdate; /* Creation date */ - __u16 adate; /* Last access date */ - __u16 starthi; /* High 16 bits of cluster in FAT32 */ - __u16 time,date,start;/* time, date and first cluster */ - __u32 size; /* file size (in bytes) */ + __le16 ctime; /* Creation time */ + __le16 cdate; /* Creation date */ + __le16 adate; /* Last access date */ + __le16 starthi; /* High 16 bits of cluster in FAT32 */ + __le16 time,date,start;/* time, date and first cluster */ + __le32 size; /* file size (in bytes) */ }; /* Up to 13 characters of the name */ @@ -174,7 +174,7 @@ __u8 reserved; /* always 0 */ __u8 alias_checksum; /* checksum for 8.3 alias */ __u8 name5_10[12]; /* 6 more characters in name */ - __u16 start; /* starting cluster number, 0 in long slots */ + __le16 start; /* starting cluster number, 0 in long slots */ __u8 name11_12[4]; /* last 2 characters in name */ }; @@ -276,7 +276,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, struct inode_operations *fs_dir_inode_ops, int isvfat); extern int fat_statfs(struct super_block *sb, struct kstatfs *buf); -extern void fat_write_inode(struct inode *inode, int wait); +extern int fat_write_inode(struct inode *inode, int wait); extern int fat_notify_change(struct dentry * dentry, struct iattr * attr); /* fat/misc.c */ @@ -287,8 +287,7 @@ extern int fat_add_cluster(struct inode *inode); extern struct buffer_head *fat_extend_dir(struct inode *inode); extern int date_dos2unix(unsigned short time, unsigned short date); -extern void fat_date_unix2dos(int unix_date, unsigned short *time, - unsigned short *date); +extern void fat_date_unix2dos(int unix_date, __le16 *time, __le16 *date); extern int fat__get_entry(struct inode *dir, loff_t *pos, struct buffer_head **bh, struct msdos_dir_entry **de, loff_t *i_pos); diff -Nru a/include/linux/net.h b/include/linux/net.h --- a/include/linux/net.h 2004-09-26 10:25:56 -07:00 +++ b/include/linux/net.h 2004-09-26 10:25:56 -07:00 @@ -21,6 +21,7 @@ #include #include #include +#include struct poll_table_struct; struct inode; @@ -61,8 +62,13 @@ #define SOCK_ASYNC_WAITDATA 1 #define SOCK_NOSPACE 2 +#ifndef ARCH_HAS_SOCKET_TYPES /** sock_type - Socket types - * + * + * When adding some new socket type please + * grep ARCH_HAS_SOCKET_TYPE include/asm-* /socket.h, at least MIPS + * overrides this enum for binary compat reasons. + * * @SOCK_STREAM - stream (connection) socket * @SOCK_DGRAM - datagram (conn.less) socket * @SOCK_RAW - raw socket @@ -81,6 +87,8 @@ }; #define SOCK_MAX (SOCK_PACKET + 1) + +#endif /* ARCH_HAS_SOCKET_TYPES */ /** * struct socket - general BSD socket diff -Nru a/include/linux/netfilter.h b/include/linux/netfilter.h --- a/include/linux/netfilter.h 2004-09-26 10:25:56 -07:00 +++ b/include/linux/netfilter.h 2004-09-26 10:25:56 -07:00 @@ -178,7 +178,7 @@ 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 *); +extern void (*ip_ct_attach)(struct sk_buff *, struct sk_buff *); #ifdef CONFIG_NETFILTER_DEBUG extern void nf_dump_skb(int pf, struct sk_buff *skb); diff -Nru a/include/linux/netfilter_ipv4/ip_conntrack.h b/include/linux/netfilter_ipv4/ip_conntrack.h --- a/include/linux/netfilter_ipv4/ip_conntrack.h 2004-09-26 10:25:57 -07:00 +++ b/include/linux/netfilter_ipv4/ip_conntrack.h 2004-09-26 10:25:57 -07:00 @@ -172,9 +172,6 @@ plus 1 for any connection(s) we are `master' for */ struct nf_conntrack ct_general; - /* These are my tuples; original and reply */ - struct ip_conntrack_tuple_hash tuplehash[IP_CT_DIR_MAX]; - /* Have we seen traffic both ways yet? (bitset) */ unsigned long status; @@ -199,12 +196,7 @@ /* Helper, if any. */ struct ip_conntrack_helper *helper; - /* Our various nf_ct_info structs specify *what* relation this - packet has to the conntrack */ - struct nf_ct_info infos[IP_CT_NUMBER]; - /* Storage reserved for other modules: */ - union ip_conntrack_proto proto; union ip_conntrack_help help; @@ -220,6 +212,9 @@ } nat; #endif /* CONFIG_IP_NF_NAT_NEEDED */ + /* Traversed often, so hopefully in different cacheline to top */ + /* These are my tuples; original and reply */ + struct ip_conntrack_tuple_hash tuplehash[IP_CT_DIR_MAX]; }; /* get master conntrack via master expectation */ @@ -238,8 +233,12 @@ const struct ip_conntrack *ignored_conntrack); /* Return conntrack_info and tuple hash for given skb. */ -extern struct ip_conntrack * -ip_conntrack_get(struct sk_buff *skb, enum ip_conntrack_info *ctinfo); +static inline struct ip_conntrack * +ip_conntrack_get(const struct sk_buff *skb, enum ip_conntrack_info *ctinfo) +{ + *ctinfo = skb->nfctinfo; + return (struct ip_conntrack *)skb->nfct; +} /* decrement reference count on a conntrack */ extern inline void ip_conntrack_put(struct ip_conntrack *ct); @@ -306,12 +305,13 @@ unsigned int insert_failed; unsigned int drop; unsigned int early_drop; - unsigned int icmp_error; + unsigned int error; unsigned int expect_new; unsigned int expect_create; unsigned int expect_delete; }; +#define CONNTRACK_STAT_INC(count) (__get_cpu_var(ip_conntrack_stat).count++) /* eg. PROVIDES_CONNTRACK(ftp); */ #define PROVIDES_CONNTRACK(name) \ diff -Nru a/include/linux/netfilter_ipv4/ip_conntrack_core.h b/include/linux/netfilter_ipv4/ip_conntrack_core.h --- a/include/linux/netfilter_ipv4/ip_conntrack_core.h 2004-09-26 10:25:57 -07:00 +++ b/include/linux/netfilter_ipv4/ip_conntrack_core.h 2004-09-26 10:25:57 -07:00 @@ -16,10 +16,6 @@ extern void ip_conntrack_cleanup(void); struct ip_conntrack_protocol; -extern struct ip_conntrack_protocol *ip_ct_find_proto(u_int8_t protocol); -/* Like above, but you already have conntrack read lock. */ -extern struct ip_conntrack_protocol *__ip_ct_find_proto(u_int8_t protocol); -extern struct list_head protocol_list; extern int ip_ct_get_tuple(const struct iphdr *iph, @@ -38,14 +34,14 @@ ip_conntrack_find_get(const struct ip_conntrack_tuple *tuple, const struct ip_conntrack *ignored_conntrack); -extern int __ip_conntrack_confirm(struct nf_ct_info *nfct); +extern int __ip_conntrack_confirm(struct sk_buff *skb); /* Confirm a connection: returns NF_DROP if packet must be dropped. */ static inline int ip_conntrack_confirm(struct sk_buff *skb) { if (skb->nfct - && !is_confirmed((struct ip_conntrack *)skb->nfct->master)) - return __ip_conntrack_confirm(skb->nfct); + && !is_confirmed((struct ip_conntrack *)skb->nfct)) + return __ip_conntrack_confirm(skb); return NF_ACCEPT; } diff -Nru a/include/linux/netfilter_ipv4/ip_conntrack_protocol.h b/include/linux/netfilter_ipv4/ip_conntrack_protocol.h --- a/include/linux/netfilter_ipv4/ip_conntrack_protocol.h 2004-09-26 10:25:57 -07:00 +++ b/include/linux/netfilter_ipv4/ip_conntrack_protocol.h 2004-09-26 10:25:57 -07:00 @@ -7,9 +7,6 @@ struct ip_conntrack_protocol { - /* Next pointer. */ - struct list_head list; - /* Protocol number. */ u_int8_t proto; @@ -58,14 +55,23 @@ struct module *me; }; +#define MAX_IP_CT_PROTO 256 +extern struct ip_conntrack_protocol *ip_ct_protos[MAX_IP_CT_PROTO]; + /* Protocol registration. */ extern int ip_conntrack_protocol_register(struct ip_conntrack_protocol *proto); extern void ip_conntrack_protocol_unregister(struct ip_conntrack_protocol *proto); +static inline struct ip_conntrack_protocol *ip_ct_find_proto(u_int8_t protocol) +{ + return ip_ct_protos[protocol]; +} + /* Existing built-in protocols */ extern struct ip_conntrack_protocol ip_conntrack_protocol_tcp; extern struct ip_conntrack_protocol ip_conntrack_protocol_udp; extern struct ip_conntrack_protocol ip_conntrack_protocol_icmp; +extern struct ip_conntrack_protocol ip_conntrack_generic_protocol; extern int ip_conntrack_protocol_tcp_init(void); /* Log invalid packets */ diff -Nru a/include/linux/netfilter_ipv4/ip_nat.h b/include/linux/netfilter_ipv4/ip_nat.h --- a/include/linux/netfilter_ipv4/ip_nat.h 2004-09-26 10:25:57 -07:00 +++ b/include/linux/netfilter_ipv4/ip_nat.h 2004-09-26 10:25:57 -07:00 @@ -80,27 +80,18 @@ /* Protects NAT hash tables, and NAT-private part of conntracks. */ DECLARE_RWLOCK_EXTERN(ip_nat_lock); -/* Hashes for by-source and IP/protocol. */ -struct ip_nat_hash -{ - struct list_head list; - - /* conntrack we're embedded in: NULL if not in hash. */ - struct ip_conntrack *conntrack; -}; - /* The structure embedded in the conntrack structure. */ struct ip_nat_info { /* Set to zero when conntrack created: bitmask of maniptypes */ - int initialized; + u_int16_t initialized; - unsigned int num_manips; + u_int16_t num_manips; /* Manipulations to be done on this conntrack. */ struct ip_nat_info_manip manips[IP_NAT_MAX_MANIPS]; - struct ip_nat_hash bysource, byipsproto; + struct list_head bysource, byipsproto; /* Helper (NULL if none). */ struct ip_nat_helper *helper; diff -Nru a/include/linux/netfilter_ipv4/ip_nat_core.h b/include/linux/netfilter_ipv4/ip_nat_core.h --- a/include/linux/netfilter_ipv4/ip_nat_core.h 2004-09-26 10:25:55 -07:00 +++ b/include/linux/netfilter_ipv4/ip_nat_core.h 2004-09-26 10:25:55 -07:00 @@ -14,8 +14,6 @@ unsigned int hooknum, struct sk_buff **pskb); -extern struct list_head protos; - extern int icmp_reply_translation(struct sk_buff **pskb, struct ip_conntrack *conntrack, unsigned int hooknum, @@ -26,8 +24,4 @@ extern void place_in_hashes(struct ip_conntrack *conntrack, struct ip_nat_info *info); -/* Built-in protocols. */ -extern struct ip_nat_protocol ip_nat_protocol_tcp; -extern struct ip_nat_protocol ip_nat_protocol_udp; -extern struct ip_nat_protocol ip_nat_protocol_icmp; #endif /* _IP_NAT_CORE_H */ diff -Nru a/include/linux/netfilter_ipv4/ip_nat_protocol.h b/include/linux/netfilter_ipv4/ip_nat_protocol.h --- a/include/linux/netfilter_ipv4/ip_nat_protocol.h 2004-09-26 10:25:56 -07:00 +++ b/include/linux/netfilter_ipv4/ip_nat_protocol.h 2004-09-26 10:25:56 -07:00 @@ -9,8 +9,6 @@ struct ip_nat_protocol { - struct list_head list; - /* Protocol name */ const char *name; @@ -47,9 +45,23 @@ const struct ip_nat_range *range); }; +#define MAX_IP_NAT_PROTO 256 +extern struct ip_nat_protocol *ip_nat_protos[MAX_IP_NAT_PROTO]; + /* Protocol registration. */ extern int ip_nat_protocol_register(struct ip_nat_protocol *proto); extern void ip_nat_protocol_unregister(struct ip_nat_protocol *proto); + +static inline struct ip_nat_protocol *ip_nat_find_proto(u_int8_t protocol) +{ + return ip_nat_protos[protocol]; +} + +/* Built-in protocols. */ +extern struct ip_nat_protocol ip_nat_protocol_tcp; +extern struct ip_nat_protocol ip_nat_protocol_udp; +extern struct ip_nat_protocol ip_nat_protocol_icmp; +extern struct ip_nat_protocol ip_nat_unknown_protocol; extern int init_protocols(void) __init; extern void cleanup_protocols(void); diff -Nru a/include/linux/netfilter_ipv4/ipt_comment.h b/include/linux/netfilter_ipv4/ipt_comment.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/linux/netfilter_ipv4/ipt_comment.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,10 @@ +#ifndef _IPT_COMMENT_H +#define _IPT_COMMENT_H + +#define IPT_MAX_COMMENT_LEN 256 + +struct ipt_comment_info { + unsigned char comment[IPT_MAX_COMMENT_LEN]; +}; + +#endif /* _IPT_COMMENT_H */ diff -Nru a/include/linux/netfilter_ipv6/ip6t_physdev.h b/include/linux/netfilter_ipv6/ip6t_physdev.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/linux/netfilter_ipv6/ip6t_physdev.h 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,24 @@ +#ifndef _IP6T_PHYSDEV_H +#define _IP6T_PHYSDEV_H + +#ifdef __KERNEL__ +#include +#endif + +#define IP6T_PHYSDEV_OP_IN 0x01 +#define IP6T_PHYSDEV_OP_OUT 0x02 +#define IP6T_PHYSDEV_OP_BRIDGED 0x04 +#define IP6T_PHYSDEV_OP_ISIN 0x08 +#define IP6T_PHYSDEV_OP_ISOUT 0x10 +#define IP6T_PHYSDEV_OP_MASK (0x20 - 1) + +struct ip6t_physdev_info { + char physindev[IFNAMSIZ]; + char in_mask[IFNAMSIZ]; + char physoutdev[IFNAMSIZ]; + char out_mask[IFNAMSIZ]; + u_int8_t invert; + u_int8_t bitmask; +}; + +#endif /*_IP6T_PHYSDEV_H*/ diff -Nru a/include/linux/pfkeyv2.h b/include/linux/pfkeyv2.h --- a/include/linux/pfkeyv2.h 2004-09-26 10:25:57 -07:00 +++ b/include/linux/pfkeyv2.h 2004-09-26 10:25:57 -07:00 @@ -245,6 +245,7 @@ /* Security Association flags */ #define SADB_SAFLAGS_PFS 1 +#define SADB_SAFLAGS_DECAP_DSCP 0x40000000 #define SADB_SAFLAGS_NOECN 0x80000000 /* Security Association states */ diff -Nru a/include/linux/prctl.h b/include/linux/prctl.h --- a/include/linux/prctl.h 2004-09-26 10:25:56 -07:00 +++ b/include/linux/prctl.h 2004-09-26 10:25:56 -07:00 @@ -50,4 +50,6 @@ process timing */ +#define PR_SET_NAME 15 /* Set process name */ + #endif /* _LINUX_PRCTL_H */ diff -Nru a/include/linux/quota.h b/include/linux/quota.h --- a/include/linux/quota.h 2004-09-26 10:25:57 -07:00 +++ b/include/linux/quota.h 2004-09-26 10:25:57 -07:00 @@ -45,7 +45,6 @@ typedef __kernel_uid32_t qid_t; /* Type in which we store ids in memory */ typedef __u64 qsize_t; /* Type in which we store sizes */ -extern spinlock_t dq_list_lock; extern spinlock_t dq_data_lock; /* Size of blocks in which are counted size limits */ diff -Nru a/include/linux/raid/md.h b/include/linux/raid/md.h --- a/include/linux/raid/md.h 2004-09-26 10:25:55 -07:00 +++ b/include/linux/raid/md.h 2004-09-26 10:25:55 -07:00 @@ -69,7 +69,6 @@ extern void md_unregister_thread (mdk_thread_t *thread); extern void md_wakeup_thread(mdk_thread_t *thread); extern void md_check_recovery(mddev_t *mddev); -extern void md_interrupt_thread (mdk_thread_t *thread); extern void md_write_start(mddev_t *mddev); extern void md_write_end(mddev_t *mddev); extern void md_handle_safemode(mddev_t *mddev); diff -Nru a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h --- a/include/linux/reiserfs_fs.h 2004-09-26 10:25:57 -07:00 +++ b/include/linux/reiserfs_fs.h 2004-09-26 10:25:57 -07:00 @@ -1945,7 +1945,7 @@ int reiserfs_find_actor(struct inode * inode, void *p) ; int reiserfs_init_locked_inode(struct inode * inode, void *p) ; void reiserfs_delete_inode (struct inode * inode); -void reiserfs_write_inode (struct inode * inode, int) ; +int reiserfs_write_inode (struct inode * inode, int) ; struct dentry *reiserfs_get_dentry(struct super_block *, void *) ; struct dentry *reiserfs_decode_fh(struct super_block *sb, __u32 *data, int len, int fhtype, diff -Nru a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h --- a/include/linux/rtnetlink.h 2004-09-26 10:25:57 -07:00 +++ b/include/linux/rtnetlink.h 2004-09-26 10:25:57 -07:00 @@ -9,53 +9,89 @@ /* Types of messages */ -#define RTM_BASE 0x10 +enum { + RTM_BASE = 16, +#define RTM_BASE RTM_BASE + + RTM_NEWLINK = 16, +#define RTM_NEWLINK RTM_NEWLINK + RTM_DELLINK, +#define RTM_DELLINK RTM_DELLINK + RTM_GETLINK, +#define RTM_GETLINK RTM_GETLINK + RTM_SETLINK, +#define RTM_SETLINK RTM_SETLINK + + RTM_NEWADDR = 20, +#define RTM_NEWADDR RTM_NEWADDR + RTM_DELADDR, +#define RTM_DELADDR RTM_DELADDR + RTM_GETADDR, +#define RTM_GETADDR RTM_GETADDR + + RTM_NEWROUTE = 24, +#define RTM_NEWROUTE RTM_NEWROUTE + RTM_DELROUTE, +#define RTM_DELROUTE RTM_DELROUTE + RTM_GETROUTE, +#define RTM_GETROUTE RTM_GETROUTE + + RTM_NEWNEIGH = 28, +#define RTM_NEWNEIGH RTM_NEWNEIGH + RTM_DELNEIGH, +#define RTM_DELNEIGH RTM_DELNEIGH + RTM_GETNEIGH, +#define RTM_GETNEIGH RTM_GETNEIGH + + RTM_NEWRULE = 32, +#define RTM_NEWRULE RTM_NEWRULE + RTM_DELRULE, +#define RTM_DELRULE RTM_DELRULE + RTM_GETRULE, +#define RTM_GETRULE RTM_GETRULE + + RTM_NEWQDISC = 36, +#define RTM_NEWQDISC RTM_NEWQDISC + RTM_DELQDISC, +#define RTM_DELQDISC RTM_DELQDISC + RTM_GETQDISC, +#define RTM_GETQDISC RTM_GETQDISC + + RTM_NEWTCLASS = 40, +#define RTM_NEWTCLASS RTM_NEWTCLASS + RTM_DELTCLASS, +#define RTM_DELTCLASS RTM_DELTCLASS + RTM_GETTCLASS, +#define RTM_GETTCLASS RTM_GETTCLASS + + RTM_NEWTFILTER = 44, +#define RTM_NEWTFILTER RTM_NEWTFILTER + RTM_DELTFILTER, +#define RTM_DELTFILTER RTM_DELTFILTER + RTM_GETTFILTER, +#define RTM_GETTFILTER RTM_GETTFILTER + + RTM_NEWACTION = 48, +#define RTM_NEWACTION RTM_NEWACTION + RTM_DELACTION, +#define RTM_DELACTION RTM_DELACTION + RTM_GETACTION, +#define RTM_GETACTION RTM_GETACTION + + RTM_NEWPREFIX = 52, +#define RTM_NEWPREFIX RTM_NEWPREFIX + RTM_GETPREFIX = 54, +#define RTM_GETPREFIX RTM_GETPREFIX -#define RTM_NEWLINK (RTM_BASE+0) -#define RTM_DELLINK (RTM_BASE+1) -#define RTM_GETLINK (RTM_BASE+2) -#define RTM_SETLINK (RTM_BASE+3) + RTM_GETMULTICAST = 58, +#define RTM_GETMULTICAST RTM_GETMULTICAST -#define RTM_NEWADDR (RTM_BASE+4) -#define RTM_DELADDR (RTM_BASE+5) -#define RTM_GETADDR (RTM_BASE+6) + RTM_GETANYCAST = 62, +#define RTM_GETANYCAST RTM_GETANYCAST -#define RTM_NEWROUTE (RTM_BASE+8) -#define RTM_DELROUTE (RTM_BASE+9) -#define RTM_GETROUTE (RTM_BASE+10) - -#define RTM_NEWNEIGH (RTM_BASE+12) -#define RTM_DELNEIGH (RTM_BASE+13) -#define RTM_GETNEIGH (RTM_BASE+14) - -#define RTM_NEWRULE (RTM_BASE+16) -#define RTM_DELRULE (RTM_BASE+17) -#define RTM_GETRULE (RTM_BASE+18) - -#define RTM_NEWQDISC (RTM_BASE+20) -#define RTM_DELQDISC (RTM_BASE+21) -#define RTM_GETQDISC (RTM_BASE+22) - -#define RTM_NEWTCLASS (RTM_BASE+24) -#define RTM_DELTCLASS (RTM_BASE+25) -#define RTM_GETTCLASS (RTM_BASE+26) - -#define RTM_NEWTFILTER (RTM_BASE+28) -#define RTM_DELTFILTER (RTM_BASE+29) -#define RTM_GETTFILTER (RTM_BASE+30) - -#define RTM_NEWACTION (RTM_BASE+32) -#define RTM_DELACTION (RTM_BASE+33) -#define RTM_GETACTION (RTM_BASE+34) - -#define RTM_NEWPREFIX (RTM_BASE+36) -#define RTM_GETPREFIX (RTM_BASE+38) - -#define RTM_GETMULTICAST (RTM_BASE+42) - -#define RTM_GETANYCAST (RTM_BASE+46) - -#define RTM_MAX (RTM_BASE+47) + RTM_MAX, +#define RTM_MAX RTM_MAX +}; /* Generic structure for encapsulation of optional route information. @@ -539,6 +575,17 @@ /* for cslip etc */ __u32 rx_compressed; __u32 tx_compressed; +}; + +/* The struct should be in sync with struct ifmap */ +struct rtnl_link_ifmap +{ + __u64 mem_start; + __u64 mem_end; + __u64 base_addr; + __u16 irq; + __u8 dma; + __u8 port; }; enum diff -Nru a/include/linux/sched.h b/include/linux/sched.h --- a/include/linux/sched.h 2004-09-26 10:25:55 -07:00 +++ b/include/linux/sched.h 2004-09-26 10:25:55 -07:00 @@ -1024,6 +1024,9 @@ } #endif +extern long sched_setaffinity(pid_t pid, cpumask_t new_mask); +extern long sched_getaffinity(pid_t pid, cpumask_t *mask); + #endif /* __KERNEL__ */ #endif diff -Nru a/include/linux/serial_core.h b/include/linux/serial_core.h --- a/include/linux/serial_core.h 2004-09-26 10:25:55 -07:00 +++ b/include/linux/serial_core.h 2004-09-26 10:25:55 -07:00 @@ -176,6 +176,7 @@ #define UPIO_PORT (0) #define UPIO_HUB6 (1) #define UPIO_MEM (2) +#define UPIO_MEM32 (3) unsigned int read_status_mask; /* driver specific */ unsigned int ignore_status_mask; /* driver specific */ diff -Nru a/include/linux/serio.h b/include/linux/serio.h --- a/include/linux/serio.h 2004-09-26 10:25:56 -07:00 +++ b/include/linux/serio.h 2004-09-26 10:25:56 -07:00 @@ -17,12 +17,17 @@ #ifdef __KERNEL__ #include +#include +#include struct serio { void *private; - void *driver; - char *name; - char *phys; + void *port_data; + + char name[32]; + char phys[32]; + + unsigned int manual_bind; unsigned short idbus; unsigned short idvendor; @@ -32,31 +37,43 @@ unsigned long type; unsigned long event; + spinlock_t lock; /* protects critical sections from port's interrupt handler */ + int (*write)(struct serio *, unsigned char); int (*open)(struct serio *); void (*close)(struct serio *); - struct serio_dev *dev; + struct serio *parent, *child; + + struct serio_driver *drv; /* accessed from interrupt, must be protected by serio->lock */ + + struct device dev; struct list_head node; }; +#define to_serio_port(d) container_of(d, struct serio, dev) -struct serio_dev { +struct serio_driver { void *private; - char *name; + char *description; + + unsigned int manual_bind; void (*write_wakeup)(struct serio *); irqreturn_t (*interrupt)(struct serio *, unsigned char, unsigned int, struct pt_regs *); - void (*connect)(struct serio *, struct serio_dev *dev); + void (*connect)(struct serio *, struct serio_driver *drv); int (*reconnect)(struct serio *); void (*disconnect)(struct serio *); void (*cleanup)(struct serio *); + struct device_driver driver; + struct list_head node; }; +#define to_serio_driver(d) container_of(d, struct serio_driver, driver) -int serio_open(struct serio *serio, struct serio_dev *dev); +int serio_open(struct serio *serio, struct serio_driver *drv); void serio_close(struct serio *serio); void serio_rescan(struct serio *serio); void serio_reconnect(struct serio *serio); @@ -64,12 +81,11 @@ void serio_register_port(struct serio *serio); void serio_register_port_delayed(struct serio *serio); -void __serio_register_port(struct serio *serio); void serio_unregister_port(struct serio *serio); void serio_unregister_port_delayed(struct serio *serio); -void __serio_unregister_port(struct serio *serio); -void serio_register_device(struct serio_dev *dev); -void serio_unregister_device(struct serio_dev *dev); + +void serio_register_driver(struct serio_driver *drv); +void serio_unregister_driver(struct serio_driver *drv); static __inline__ int serio_write(struct serio *serio, unsigned char data) { @@ -79,17 +95,33 @@ return -1; } -static __inline__ void serio_dev_write_wakeup(struct serio *serio) +static __inline__ void serio_drv_write_wakeup(struct serio *serio) { - if (serio->dev && serio->dev->write_wakeup) - serio->dev->write_wakeup(serio); + if (serio->drv && serio->drv->write_wakeup) + serio->drv->write_wakeup(serio); } static __inline__ void serio_cleanup(struct serio *serio) { - if (serio->dev && serio->dev->cleanup) - serio->dev->cleanup(serio); + if (serio->drv && serio->drv->cleanup) + serio->drv->cleanup(serio); } + + +/* + * Use the following fucntions to protect critical sections in + * driver code from port's interrupt handler + */ +static __inline__ void serio_pause_rx(struct serio *serio) +{ + spin_lock_irq(&serio->lock); +} + +static __inline__ void serio_continue_rx(struct serio *serio) +{ + spin_unlock_irq(&serio->lock); +} + #endif diff -Nru a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h --- a/include/linux/shmem_fs.h 2004-09-26 10:25:57 -07:00 +++ b/include/linux/shmem_fs.h 2004-09-26 10:25:57 -07:00 @@ -10,14 +10,14 @@ struct shmem_inode_info { spinlock_t lock; - unsigned long next_index; - swp_entry_t i_direct[SHMEM_NR_DIRECT]; /* for the first blocks */ - struct page *i_indirect; /* indirect blocks */ - unsigned long alloced; /* data pages allocated to file */ - unsigned long swapped; /* subtotal assigned to swap */ unsigned long flags; - struct shared_policy policy; - struct list_head list; + unsigned long alloced; /* data pages alloced to file */ + unsigned long swapped; /* subtotal assigned to swap */ + unsigned long next_index; /* highest alloced index + 1 */ + struct shared_policy policy; /* NUMA memory alloc policy */ + struct page *i_indirect; /* top indirect blocks page */ + swp_entry_t i_direct[SHMEM_NR_DIRECT]; /* first blocks */ + struct list_head swaplist; /* chain of maybes on swap */ struct inode vfs_inode; }; diff -Nru a/include/linux/skbuff.h b/include/linux/skbuff.h --- a/include/linux/skbuff.h 2004-09-26 10:25:56 -07:00 +++ b/include/linux/skbuff.h 2004-09-26 10:25:56 -07:00 @@ -97,10 +97,6 @@ void (*destroy)(struct nf_conntrack *); }; -struct nf_ct_info { - struct nf_conntrack *master; -}; - #ifdef CONFIG_BRIDGE_NETFILTER struct nf_bridge_info { atomic_t use; @@ -186,6 +182,7 @@ * @nfmark: Can be used for communication between hooks * @nfcache: Cache info * @nfct: Associated connection, if any + * @nfctinfo: Relationship of this skb to the connection * @nf_debug: Netfilter debugging * @nf_bridge: Saved data about a bridged frame - see br_netfilter.c * @private: Data which is private to the HIPPI implementation @@ -253,7 +250,8 @@ #ifdef CONFIG_NETFILTER unsigned long nfmark; __u32 nfcache; - struct nf_ct_info *nfct; + struct nf_conntrack *nfct; + __u32 nfctinfo; #ifdef CONFIG_NETFILTER_DEBUG unsigned int nf_debug; #endif @@ -271,7 +269,7 @@ #ifdef CONFIG_NET_CLS_ACT __u32 tc_verd; /* traffic control verdict */ __u32 tc_classid; /* traffic control classid */ - #endif +#endif #endif @@ -1141,15 +1139,15 @@ extern void skb_iter_abort(const struct sk_buff *skb, struct skb_iter *i); #ifdef CONFIG_NETFILTER -static inline void nf_conntrack_put(struct nf_ct_info *nfct) +static inline void nf_conntrack_put(struct nf_conntrack *nfct) { - if (nfct && atomic_dec_and_test(&nfct->master->use)) - nfct->master->destroy(nfct->master); + if (nfct && atomic_dec_and_test(&nfct->use)) + nfct->destroy(nfct); } -static inline void nf_conntrack_get(struct nf_ct_info *nfct) +static inline void nf_conntrack_get(struct nf_conntrack *nfct) { if (nfct) - atomic_inc(&nfct->master->use); + atomic_inc(&nfct->use); } static inline void nf_reset(struct sk_buff *skb) { diff -Nru a/include/linux/slab.h b/include/linux/slab.h --- a/include/linux/slab.h 2004-09-26 10:25:57 -07:00 +++ b/include/linux/slab.h 2004-09-26 10:25:57 -07:00 @@ -55,7 +55,6 @@ /* prototypes */ extern void kmem_cache_init(void); -extern kmem_cache_t *kmem_find_general_cachep(size_t, int gfpflags); extern kmem_cache_t *kmem_cache_create(const char *, size_t, size_t, unsigned long, void (*)(void *, kmem_cache_t *, unsigned long), void (*)(void *, kmem_cache_t *, unsigned long)); diff -Nru a/include/linux/syscalls.h b/include/linux/syscalls.h --- a/include/linux/syscalls.h 2004-09-26 10:25:57 -07:00 +++ b/include/linux/syscalls.h 2004-09-26 10:25:57 -07:00 @@ -160,11 +160,12 @@ asmlinkage long sys_exit(int error_code); asmlinkage void sys_exit_group(int error_code); -asmlinkage long sys_wait4(pid_t pid, unsigned int __user *stat_addr, +asmlinkage long sys_wait4(pid_t pid, int __user *stat_addr, int options, struct rusage __user *ru); asmlinkage long sys_waitid(int which, pid_t pid, - struct siginfo __user *infop, int options); -asmlinkage long sys_waitpid(pid_t pid, unsigned int __user *stat_addr, int options); + struct siginfo __user *infop, + int options, struct rusage __user *ru); +asmlinkage long sys_waitpid(pid_t pid, 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, diff -Nru a/include/linux/sysctl.h b/include/linux/sysctl.h --- a/include/linux/sysctl.h 2004-09-26 10:25:56 -07:00 +++ b/include/linux/sysctl.h 2004-09-26 10:25:56 -07:00 @@ -424,6 +424,7 @@ NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_SENT=24, NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_RECD=25, NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_ACK_SENT=26, + NET_IPV4_NF_CONNTRACK_COUNT=27, }; /* /proc/sys/net/ipv6 */ diff -Nru a/include/linux/sysv_fs.h b/include/linux/sysv_fs.h --- a/include/linux/sysv_fs.h 2004-09-26 10:25:56 -07:00 +++ b/include/linux/sysv_fs.h 2004-09-26 10:25:56 -07:00 @@ -8,13 +8,18 @@ #endif +#ifndef __KERNEL__ +typedef u16 __fs16; +typedef u32 __fs16; +#endif + /* inode numbers are 16 bit */ -typedef u16 sysv_ino_t; +typedef __fs16 sysv_ino_t; /* Block numbers are 24 bit, sometimes stored in 32 bit. On Coherent FS, they are always stored in PDP-11 manner: the least significant 16 bits come last. */ -typedef u32 sysv_zone_t; +typedef __fs32 sysv_zone_t; /* 0 is non-existent */ #define SYSV_BADBL_INO 1 /* inode of bad blocks file */ @@ -25,29 +30,29 @@ #define XENIX_NICINOD 100 /* number of inode cache entries */ #define XENIX_NICFREE 100 /* number of free block list chunk entries */ struct xenix_super_block { - u16 s_isize; /* index of first data zone */ - u32 s_fsize __packed2__; /* total number of zones of this fs */ + __fs16 s_isize; /* index of first data zone */ + __fs32 s_fsize __packed2__; /* total number of zones of this fs */ /* the start of the free block list: */ - u16 s_nfree; /* number of free blocks in s_free, <= XENIX_NICFREE */ - u32 s_free[XENIX_NICFREE]; /* first free block list chunk */ + __fs16 s_nfree; /* number of free blocks in s_free, <= XENIX_NICFREE */ + sysv_zone_t s_free[XENIX_NICFREE]; /* first free block list chunk */ /* the cache of free inodes: */ - u16 s_ninode; /* number of free inodes in s_inode, <= XENIX_NICINOD */ + __fs16 s_ninode; /* number of free inodes in s_inode, <= XENIX_NICINOD */ sysv_ino_t s_inode[XENIX_NICINOD]; /* some free inodes */ /* locks, not used by Linux: */ char s_flock; /* lock during free block list manipulation */ char s_ilock; /* lock during inode cache manipulation */ char s_fmod; /* super-block modified flag */ char s_ronly; /* flag whether fs is mounted read-only */ - u32 s_time __packed2__; /* time of last super block update */ - u32 s_tfree __packed2__; /* total number of free zones */ - u16 s_tinode; /* total number of free inodes */ - s16 s_dinfo[4]; /* device information ?? */ + __fs32 s_time __packed2__; /* time of last super block update */ + __fs32 s_tfree __packed2__; /* total number of free zones */ + __fs16 s_tinode; /* total number of free inodes */ + __fs16 s_dinfo[4]; /* device information ?? */ char s_fname[6]; /* file system volume name */ char s_fpack[6]; /* file system pack name */ char s_clean; /* set to 0x46 when filesystem is properly unmounted */ char s_fill[371]; s32 s_magic; /* version of file system */ - s32 s_type; /* type of file system: 1 for 512 byte blocks + __fs32 s_type; /* type of file system: 1 for 512 byte blocks 2 for 1024 byte blocks 3 for 2048 byte blocks */ @@ -63,15 +68,15 @@ /* SystemV4 super-block data on disk */ struct sysv4_super_block { - u16 s_isize; /* index of first data zone */ + __fs16 s_isize; /* index of first data zone */ u16 s_pad0; - u32 s_fsize; /* total number of zones of this fs */ + __fs32 s_fsize; /* total number of zones of this fs */ /* the start of the free block list: */ - u16 s_nfree; /* number of free blocks in s_free, <= SYSV_NICFREE */ + __fs16 s_nfree; /* number of free blocks in s_free, <= SYSV_NICFREE */ u16 s_pad1; - u32 s_free[SYSV_NICFREE]; /* first free block list chunk */ + sysv_zone_t s_free[SYSV_NICFREE]; /* first free block list chunk */ /* the cache of free inodes: */ - u16 s_ninode; /* number of free inodes in s_inode, <= SYSV_NICINOD */ + __fs16 s_ninode; /* number of free inodes in s_inode, <= SYSV_NICINOD */ u16 s_pad2; sysv_ino_t s_inode[SYSV_NICINOD]; /* some free inodes */ /* locks, not used by Linux: */ @@ -79,45 +84,45 @@ char s_ilock; /* lock during inode cache manipulation */ char s_fmod; /* super-block modified flag */ char s_ronly; /* flag whether fs is mounted read-only */ - u32 s_time; /* time of last super block update */ - s16 s_dinfo[4]; /* device information ?? */ - u32 s_tfree; /* total number of free zones */ - u16 s_tinode; /* total number of free inodes */ + __fs32 s_time; /* time of last super block update */ + __fs16 s_dinfo[4]; /* device information ?? */ + __fs32 s_tfree; /* total number of free zones */ + __fs16 s_tinode; /* total number of free inodes */ u16 s_pad3; char s_fname[6]; /* file system volume name */ char s_fpack[6]; /* file system pack name */ s32 s_fill[12]; - s32 s_state; /* file system state: 0x7c269d38-s_time means clean */ + __fs32 s_state; /* file system state: 0x7c269d38-s_time means clean */ s32 s_magic; /* version of file system */ - s32 s_type; /* type of file system: 1 for 512 byte blocks + __fs32 s_type; /* type of file system: 1 for 512 byte blocks 2 for 1024 byte blocks */ }; /* SystemV2 super-block data on disk */ struct sysv2_super_block { - u16 s_isize; /* index of first data zone */ - u32 s_fsize __packed2__; /* total number of zones of this fs */ + __fs16 s_isize; /* index of first data zone */ + __fs32 s_fsize __packed2__; /* total number of zones of this fs */ /* the start of the free block list: */ - u16 s_nfree; /* number of free blocks in s_free, <= SYSV_NICFREE */ - u32 s_free[SYSV_NICFREE]; /* first free block list chunk */ + __fs16 s_nfree; /* number of free blocks in s_free, <= SYSV_NICFREE */ + sysv_zone_t s_free[SYSV_NICFREE]; /* first free block list chunk */ /* the cache of free inodes: */ - u16 s_ninode; /* number of free inodes in s_inode, <= SYSV_NICINOD */ + __fs16 s_ninode; /* number of free inodes in s_inode, <= SYSV_NICINOD */ sysv_ino_t s_inode[SYSV_NICINOD]; /* some free inodes */ /* locks, not used by Linux: */ char s_flock; /* lock during free block list manipulation */ char s_ilock; /* lock during inode cache manipulation */ char s_fmod; /* super-block modified flag */ char s_ronly; /* flag whether fs is mounted read-only */ - u32 s_time __packed2__; /* time of last super block update */ - s16 s_dinfo[4]; /* device information ?? */ - u32 s_tfree __packed2__; /* total number of free zones */ - u16 s_tinode; /* total number of free inodes */ + __fs32 s_time __packed2__; /* time of last super block update */ + __fs16 s_dinfo[4]; /* device information ?? */ + __fs32 s_tfree __packed2__; /* total number of free zones */ + __fs16 s_tinode; /* total number of free inodes */ char s_fname[6]; /* file system volume name */ char s_fpack[6]; /* file system pack name */ s32 s_fill[14]; - s32 s_state; /* file system state: 0xcb096f43 means clean */ + __fs32 s_state; /* file system state: 0xcb096f43 means clean */ s32 s_magic; /* version of file system */ - s32 s_type; /* type of file system: 1 for 512 byte blocks + __fs32 s_type; /* type of file system: 1 for 512 byte blocks 2 for 1024 byte blocks */ }; @@ -125,25 +130,25 @@ #define V7_NICINOD 100 /* number of inode cache entries */ #define V7_NICFREE 50 /* number of free block list chunk entries */ struct v7_super_block { - u16 s_isize; /* index of first data zone */ - u32 s_fsize __packed2__; /* total number of zones of this fs */ + __fs16 s_isize; /* index of first data zone */ + __fs32 s_fsize __packed2__; /* total number of zones of this fs */ /* the start of the free block list: */ - u16 s_nfree; /* number of free blocks in s_free, <= V7_NICFREE */ - u32 s_free[V7_NICFREE]; /* first free block list chunk */ + __fs16 s_nfree; /* number of free blocks in s_free, <= V7_NICFREE */ + sysv_zone_t s_free[V7_NICFREE]; /* first free block list chunk */ /* the cache of free inodes: */ - u16 s_ninode; /* number of free inodes in s_inode, <= V7_NICINOD */ + __fs16 s_ninode; /* number of free inodes in s_inode, <= V7_NICINOD */ sysv_ino_t s_inode[V7_NICINOD]; /* some free inodes */ /* locks, not used by Linux or V7: */ char s_flock; /* lock during free block list manipulation */ char s_ilock; /* lock during inode cache manipulation */ char s_fmod; /* super-block modified flag */ char s_ronly; /* flag whether fs is mounted read-only */ - u32 s_time __packed2__; /* time of last super block update */ + __fs32 s_time __packed2__; /* time of last super block update */ /* the following fields are not maintained by V7: */ - u32 s_tfree __packed2__; /* total number of free zones */ - u16 s_tinode; /* total number of free inodes */ - u16 s_m; /* interleave factor */ - u16 s_n; /* interleave factor */ + __fs32 s_tfree __packed2__; /* total number of free zones */ + __fs16 s_tinode; /* total number of free inodes */ + __fs16 s_m; /* interleave factor */ + __fs16 s_n; /* interleave factor */ char s_fname[6]; /* file system name */ char s_fpack[6]; /* file system pack name */ }; @@ -152,41 +157,41 @@ #define COH_NICINOD 100 /* number of inode cache entries */ #define COH_NICFREE 64 /* number of free block list chunk entries */ struct coh_super_block { - u16 s_isize; /* index of first data zone */ - u32 s_fsize __packed2__; /* total number of zones of this fs */ + __fs16 s_isize; /* index of first data zone */ + __fs32 s_fsize __packed2__; /* total number of zones of this fs */ /* the start of the free block list: */ - u16 s_nfree; /* number of free blocks in s_free, <= COH_NICFREE */ - u32 s_free[COH_NICFREE] __packed2__; /* first free block list chunk */ + __fs16 s_nfree; /* number of free blocks in s_free, <= COH_NICFREE */ + sysv_zone_t s_free[COH_NICFREE] __packed2__; /* first free block list chunk */ /* the cache of free inodes: */ - u16 s_ninode; /* number of free inodes in s_inode, <= COH_NICINOD */ + __fs16 s_ninode; /* number of free inodes in s_inode, <= COH_NICINOD */ sysv_ino_t s_inode[COH_NICINOD]; /* some free inodes */ /* locks, not used by Linux: */ char s_flock; /* lock during free block list manipulation */ char s_ilock; /* lock during inode cache manipulation */ char s_fmod; /* super-block modified flag */ char s_ronly; /* flag whether fs is mounted read-only */ - u32 s_time __packed2__; /* time of last super block update */ - u32 s_tfree __packed2__; /* total number of free zones */ - u16 s_tinode; /* total number of free inodes */ - u16 s_interleave_m; /* interleave factor */ - u16 s_interleave_n; + __fs32 s_time __packed2__; /* time of last super block update */ + __fs32 s_tfree __packed2__; /* total number of free zones */ + __fs16 s_tinode; /* total number of free inodes */ + __fs16 s_interleave_m; /* interleave factor */ + __fs16 s_interleave_n; char s_fname[6]; /* file system volume name */ char s_fpack[6]; /* file system pack name */ - u32 s_unique; /* zero, not used */ + __fs32 s_unique; /* zero, not used */ }; /* SystemV/Coherent inode data on disk */ struct sysv_inode { - u16 i_mode; - u16 i_nlink; - u16 i_uid; - u16 i_gid; - u32 i_size; + __fs16 i_mode; + __fs16 i_nlink; + __fs16 i_uid; + __fs16 i_gid; + __fs32 i_size; u8 i_data[3*(10+1+1+1)]; u8 i_gen; - u32 i_atime; /* time of last access */ - u32 i_mtime; /* time of last modification */ - u32 i_ctime; /* time of creation */ + __fs32 i_atime; /* time of last access */ + __fs32 i_mtime; /* time of last modification */ + __fs32 i_ctime; /* time of creation */ }; /* SystemV/Coherent directory entry on disk */ diff -Nru a/include/linux/ufs_fs.h b/include/linux/ufs_fs.h --- a/include/linux/ufs_fs.h 2004-09-26 10:25:57 -07:00 +++ b/include/linux/ufs_fs.h 2004-09-26 10:25:57 -07:00 @@ -898,7 +898,7 @@ extern u64 ufs_frag_map (struct inode *, sector_t); extern void ufs_read_inode (struct inode *); extern void ufs_put_inode (struct inode *); -extern void ufs_write_inode (struct inode *, int); +extern int ufs_write_inode (struct inode *, int); extern int ufs_sync_inode (struct inode *); extern void ufs_delete_inode (struct inode *); extern struct buffer_head * ufs_getfrag (struct inode *, unsigned, int, int *); diff -Nru a/include/linux/xfrm.h b/include/linux/xfrm.h --- a/include/linux/xfrm.h 2004-09-26 10:25:55 -07:00 +++ b/include/linux/xfrm.h 2004-09-26 10:25:55 -07:00 @@ -190,6 +190,7 @@ __u8 replay_window; __u8 flags; #define XFRM_STATE_NOECN 1 +#define XFRM_STATE_DECAP_DSCP 2 }; struct xfrm_usersa_id { diff -Nru a/include/net/inet_ecn.h b/include/net/inet_ecn.h --- a/include/net/inet_ecn.h 2004-09-26 10:25:57 -07:00 +++ b/include/net/inet_ecn.h 2004-09-26 10:25:57 -07:00 @@ -2,6 +2,7 @@ #define _INET_ECN_H_ #include +#include enum { INET_ECN_NOT_ECT = 0, @@ -77,13 +78,17 @@ iph->tos &= ~INET_ECN_MASK; } -#define ip6_get_dsfield(iph) ((ntohs(*(u16*)(iph)) >> 4) & 0xFF) +static inline void ipv4_copy_dscp(struct iphdr *outer, struct iphdr *inner) +{ + u32 dscp = ipv4_get_dsfield(outer) & ~INET_ECN_MASK; + ipv4_change_dsfield(inner, INET_ECN_MASK, dscp); +} struct ipv6hdr; static inline void IP6_ECN_set_ce(struct ipv6hdr *iph) { - if (INET_ECN_is_not_ect(ip6_get_dsfield(iph))) + if (INET_ECN_is_not_ect(ipv6_get_dsfield(iph))) return; *(u32*)iph |= htonl(INET_ECN_CE << 20); } @@ -91,6 +96,12 @@ static inline void IP6_ECN_clear(struct ipv6hdr *iph) { *(u32*)iph &= ~htonl(INET_ECN_MASK << 20); +} + +static inline void ipv6_copy_dscp(struct ipv6hdr *outer, struct ipv6hdr *inner) +{ + u32 dscp = ipv6_get_dsfield(outer) & ~INET_ECN_MASK; + ipv6_change_dsfield(inner, INET_ECN_MASK, dscp); } #endif diff -Nru a/include/net/ip6_route.h b/include/net/ip6_route.h --- a/include/net/ip6_route.h 2004-09-26 10:25:55 -07:00 +++ b/include/net/ip6_route.h 2004-09-26 10:25:55 -07:00 @@ -89,9 +89,12 @@ extern void rt6_purge_dflt_routers(int lst_resort); +extern void rt6_reset_dflt_pointer(struct rt6_info *rt); + extern void rt6_redirect(struct in6_addr *dest, struct in6_addr *saddr, struct neighbour *neigh, + u8 *lladdr, int on_link); extern void rt6_pmtu_discovery(struct in6_addr *daddr, diff -Nru a/include/net/ip_fib.h b/include/net/ip_fib.h --- a/include/net/ip_fib.h 2004-09-26 10:25:57 -07:00 +++ b/include/net/ip_fib.h 2004-09-26 10:25:57 -07:00 @@ -23,8 +23,7 @@ /* WARNING: The ordering of these elements must match ordering * of RTA_* rtnetlink attribute numbers. */ -struct kern_rta -{ +struct kern_rta { void *rta_dst; void *rta_src; int *rta_iif; @@ -40,9 +39,12 @@ struct rta_session *rta_sess; }; -struct fib_nh -{ - struct net_device *nh_dev; +struct fib_info; + +struct fib_nh { + struct net_device *nh_dev; + struct hlist_node nh_hash; + struct fib_info *nh_parent; unsigned nh_flags; unsigned char nh_scope; #ifdef CONFIG_IP_ROUTE_MULTIPATH @@ -60,10 +62,9 @@ * This structure contains data shared by many of routes. */ -struct fib_info -{ - struct fib_info *fib_next; - struct fib_info *fib_prev; +struct fib_info { + struct hlist_node fib_hash; + struct hlist_node fib_lhash; int fib_treeref; atomic_t fib_clntref; int fib_dead; @@ -89,8 +90,7 @@ struct fib_rule; #endif -struct fib_result -{ +struct fib_result { unsigned char prefixlen; unsigned char nh_sel; unsigned char type; @@ -119,8 +119,7 @@ #define FIB_RES_DEV(res) (FIB_RES_NH(res).nh_dev) #define FIB_RES_OIF(res) (FIB_RES_NH(res).nh_oif) -struct fib_table -{ +struct fib_table { unsigned char tb_id; unsigned tb_stamp; int (*tb_lookup)(struct fib_table *tb, const struct flowi *flp, struct fib_result *res); diff -Nru a/include/net/neighbour.h b/include/net/neighbour.h --- a/include/net/neighbour.h 2004-09-26 10:25:57 -07:00 +++ b/include/net/neighbour.h 2004-09-26 10:25:57 -07:00 @@ -51,7 +51,7 @@ #include #include -#define NUD_IN_TIMER (NUD_INCOMPLETE|NUD_DELAY|NUD_PROBE) +#define NUD_IN_TIMER (NUD_INCOMPLETE|NUD_REACHABLE|NUD_DELAY|NUD_PROBE) #define NUD_VALID (NUD_PERMANENT|NUD_NOARP|NUD_REACHABLE|NUD_PROBE|NUD_STALE|NUD_DELAY) #define NUD_CONNECTED (NUD_PERMANENT|NUD_NOARP|NUD_REACHABLE) @@ -179,6 +179,13 @@ struct pneigh_entry *phash_buckets[PNEIGH_HASHMASK+1]; }; +/* flags for neigh_update() */ +#define NEIGH_UPDATE_F_OVERRIDE 0x00000001 +#define NEIGH_UPDATE_F_WEAK_OVERRIDE 0x00000002 +#define NEIGH_UPDATE_F_OVERRIDE_ISROUTER 0x00000004 +#define NEIGH_UPDATE_F_ISROUTER 0x40000000 +#define NEIGH_UPDATE_F_ADMIN 0x80000000 + extern void neigh_table_init(struct neigh_table *tbl); extern int neigh_table_clear(struct neigh_table *tbl); extern struct neighbour * neigh_lookup(struct neigh_table *tbl, @@ -189,7 +196,8 @@ struct net_device *dev); extern void neigh_destroy(struct neighbour *neigh); extern int __neigh_event_send(struct neighbour *neigh, struct sk_buff *skb); -extern int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new, int override, int arp); +extern int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new, + u32 flags); extern void neigh_changeaddr(struct neigh_table *tbl, struct net_device *dev); extern int neigh_ifdown(struct neigh_table *tbl, struct net_device *dev); extern int neigh_resolve_output(struct sk_buff *skb); diff -Nru a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h --- a/include/net/sctp/sctp.h 2004-09-26 10:25:55 -07:00 +++ b/include/net/sctp/sctp.h 2004-09-26 10:25:55 -07:00 @@ -505,6 +505,7 @@ /* External references. */ extern struct proto sctp_prot; +extern struct proto sctpv6_prot; extern struct proc_dir_entry *proc_net_sctp; void sctp_put_port(struct sock *sk); diff -Nru a/include/net/sock.h b/include/net/sock.h --- a/include/net/sock.h 2004-09-26 10:25:57 -07:00 +++ b/include/net/sock.h 2004-09-26 10:25:57 -07:00 @@ -555,6 +555,10 @@ int *sysctl_rmem; int max_header; + kmem_cache_t *slab; + int slab_obj_size; + void *af_specific; + char name[32]; struct { @@ -562,6 +566,14 @@ u8 __pad[SMP_CACHE_BYTES - sizeof(int)]; } stats[NR_CPUS]; }; + +extern int sk_alloc_slab(struct proto *prot, char *name); +extern void sk_free_slab(struct proto *prot); + +static inline void sk_alloc_slab_error(struct proto *proto) +{ + printk(KERN_CRIT "%s: Can't create sock SLAB cache!\n", proto->name); +} static __inline__ void sk_set_owner(struct sock *sk, struct module *owner) { diff -Nru a/include/net/tcp.h b/include/net/tcp.h --- a/include/net/tcp.h 2004-09-26 10:25:55 -07:00 +++ b/include/net/tcp.h 2004-09-26 10:25:55 -07:00 @@ -153,9 +153,6 @@ #define tcp_lhash_wait (tcp_hashinfo.__tcp_lhash_wait) #define tcp_portalloc_lock (tcp_hashinfo.__tcp_portalloc_lock) -/* SLAB cache for TCP socks */ -extern kmem_cache_t *tcp_sk_cachep; - extern kmem_cache_t *tcp_bucket_cachep; extern struct tcp_bind_bucket *tcp_bucket_create(struct tcp_bind_hashbucket *head, unsigned short snum); diff -Nru a/include/rxrpc/call.h b/include/rxrpc/call.h --- a/include/rxrpc/call.h 2004-09-26 10:25:55 -07:00 +++ b/include/rxrpc/call.h 2004-09-26 10:25:55 -07:00 @@ -67,8 +67,8 @@ wait_queue_head_t waitq; /* wait queue for events to happen */ struct list_head link; /* general internal list link */ struct list_head call_link; /* master call list link */ - uint32_t chan_ix; /* connection channel index (net order) */ - uint32_t call_id; /* call ID on connection (net order) */ + __be32 chan_ix; /* connection channel index */ + __be32 call_id; /* call ID on connection */ unsigned long cjif; /* jiffies at call creation */ unsigned long flags; /* control flags */ #define RXRPC_CALL_ACKS_TIMO 0x00000001 /* ACKS timeout reached */ @@ -97,7 +97,7 @@ rxrpc_seq_t ackr_win_bot; /* bottom of ACK window */ rxrpc_seq_t ackr_win_top; /* top of ACK window */ rxrpc_seq_t ackr_high_seq; /* highest seqno yet received */ - rxrpc_seq_t ackr_prev_seq; /* previous seqno received */ + rxrpc_seq_net_t ackr_prev_seq; /* previous seqno received */ unsigned ackr_pend_cnt; /* number of pending ACKs */ struct timer_list ackr_dfr_timo; /* timeout on deferred ACK */ char ackr_dfr_perm; /* request for deferred ACKs permitted */ diff -Nru a/include/rxrpc/connection.h b/include/rxrpc/connection.h --- a/include/rxrpc/connection.h 2004-09-26 10:25:57 -07:00 +++ b/include/rxrpc/connection.h 2004-09-26 10:25:57 -07:00 @@ -45,18 +45,18 @@ rxrpc_serial_t serial_counter; /* packet serial number counter */ /* the following should all be in net order */ - uint32_t in_epoch; /* peer's epoch */ - uint32_t out_epoch; /* my epoch */ - uint32_t conn_id; /* connection ID, appropriately shifted */ - uint16_t service_id; /* service ID */ + __be32 in_epoch; /* peer's epoch */ + __be32 out_epoch; /* my epoch */ + __be32 conn_id; /* connection ID, appropriately shifted */ + __be16 service_id; /* service ID */ uint8_t security_ix; /* security ID */ uint8_t in_clientflag; /* RXRPC_CLIENT_INITIATED if we are server */ uint8_t out_clientflag; /* RXRPC_CLIENT_INITIATED if we are client */ }; extern int rxrpc_create_connection(struct rxrpc_transport *trans, - uint16_t port, - uint32_t addr, + __be16 port, + __be32 addr, uint16_t service_id, void *security, struct rxrpc_connection **_conn); diff -Nru a/include/rxrpc/packet.h b/include/rxrpc/packet.h --- a/include/rxrpc/packet.h 2004-09-26 10:25:56 -07:00 +++ b/include/rxrpc/packet.h 2004-09-26 10:25:56 -07:00 @@ -27,19 +27,19 @@ */ struct rxrpc_header { - uint32_t epoch; /* client boot timestamp */ + __be32 epoch; /* client boot timestamp */ - uint32_t cid; /* connection and channel ID */ + __be32 cid; /* connection and channel ID */ #define RXRPC_MAXCALLS 4 /* max active calls per conn */ #define RXRPC_CHANNELMASK (RXRPC_MAXCALLS-1) /* mask for channel ID */ #define RXRPC_CIDMASK (~RXRPC_CHANNELMASK) /* mask for connection ID */ #define RXRPC_CIDSHIFT 2 /* shift for connection ID */ - uint32_t callNumber; /* call ID (0 for connection-level packets) */ + __be32 callNumber; /* call ID (0 for connection-level packets) */ #define RXRPC_PROCESS_MAXCALLS (1<<2) /* maximum number of active calls per conn (power of 2) */ - uint32_t seq; /* sequence number of pkt in call stream */ - uint32_t serial; /* serial number of pkt sent to network */ + __be32 seq; /* sequence number of pkt in call stream */ + __be32 serial; /* serial number of pkt sent to network */ uint8_t type; /* packet type */ #define RXRPC_PACKET_TYPE_DATA 1 /* data */ @@ -62,8 +62,8 @@ uint8_t userStatus; /* app-layer defined status */ uint8_t securityIndex; /* security protocol ID */ - uint16_t _rsvd; /* reserved (used by kerberos security as cksum) */ - uint16_t serviceId; /* service ID */ + __be16 _rsvd; /* reserved (used by kerberos security as cksum) */ + __be16 serviceId; /* service ID */ } __attribute__((packed)); @@ -85,7 +85,7 @@ { uint8_t flags; /* packet flags (as per rxrpc_header) */ uint8_t pad; - uint16_t _rsvd; /* reserved (used by kerberos security as cksum) */ + __be16 _rsvd; /* reserved (used by kerberos security as cksum) */ }; #define RXRPC_JUMBO_DATALEN 1412 /* non-terminal jumbo packet data length */ @@ -97,12 +97,12 @@ */ struct rxrpc_ackpacket { - uint16_t bufferSpace; /* number of packet buffers available */ - uint16_t maxSkew; /* diff between serno being ACK'd and highest serial no + __be16 bufferSpace; /* number of packet buffers available */ + __be16 maxSkew; /* diff between serno being ACK'd and highest serial no * received */ - uint32_t firstPacket; /* sequence no of first ACK'd packet in attached list */ - uint32_t previousPacket; /* sequence no of previous packet received */ - uint32_t serial; /* serial no of packet that prompted this ACK */ + __be32 firstPacket; /* sequence no of first ACK'd packet in attached list */ + __be32 previousPacket; /* sequence no of previous packet received */ + __be32 serial; /* serial no of packet that prompted this ACK */ uint8_t reason; /* reason for ACK */ #define RXRPC_ACK_REQUESTED 1 /* ACK was requested on packet */ diff -Nru a/include/rxrpc/peer.h b/include/rxrpc/peer.h --- a/include/rxrpc/peer.h 2004-09-26 10:25:57 -07:00 +++ b/include/rxrpc/peer.h 2004-09-26 10:25:57 -07:00 @@ -67,7 +67,7 @@ extern int rxrpc_peer_lookup(struct rxrpc_transport *trans, - u32 addr, + __be32 addr, struct rxrpc_peer **_peer); static inline void rxrpc_get_peer(struct rxrpc_peer *peer) diff -Nru a/include/rxrpc/rxrpc.h b/include/rxrpc/rxrpc.h --- a/include/rxrpc/rxrpc.h 2004-09-26 10:25:57 -07:00 +++ b/include/rxrpc/rxrpc.h 2004-09-26 10:25:57 -07:00 @@ -14,7 +14,7 @@ #ifdef __KERNEL__ -extern uint32_t rxrpc_epoch; +extern __be32 rxrpc_epoch; #ifdef CONFIG_SYSCTL extern int rxrpc_ktrace; diff -Nru a/include/rxrpc/types.h b/include/rxrpc/types.h --- a/include/rxrpc/types.h 2004-09-26 10:25:56 -07:00 +++ b/include/rxrpc/types.h 2004-09-26 10:25:56 -07:00 @@ -21,6 +21,8 @@ typedef uint32_t rxrpc_seq_t; /* Rx message sequence number */ typedef uint32_t rxrpc_serial_t; /* Rx message serial number */ +typedef __be32 rxrpc_seq_net_t; /* on-the-wire Rx message sequence number */ +typedef __be32 rxrpc_serial_net_t; /* on-the-wire Rx message serial number */ struct rxrpc_call; struct rxrpc_connection; diff -Nru a/include/video/vga.h b/include/video/vga.h --- a/include/video/vga.h 2004-09-26 10:25:57 -07:00 +++ b/include/video/vga.h 2004-09-26 10:25:57 -07:00 @@ -203,7 +203,7 @@ #define VGA_SAVE_CMAP 16 /* save/restore color map/DAC */ struct vgastate { - caddr_t vgabase; /* mmio base, if supported */ + void __iomem *vgabase; /* mmio base, if supported */ unsigned long membase; /* VGA window base, 0 for default - 0xA000 */ __u32 memsize; /* VGA window size, 0 for default 64K */ __u32 flags; /* what state[s] to save (see VGA_SAVE_*) */ @@ -238,23 +238,23 @@ outw(VGA_OUT16VAL (val, reg), port); } -static inline unsigned char vga_mm_r (caddr_t regbase, unsigned short port) +static inline unsigned char vga_mm_r (void __iomem *regbase, unsigned short port) { return readb (regbase + port); } -static inline void vga_mm_w (caddr_t regbase, unsigned short port, unsigned char val) +static inline void vga_mm_w (void __iomem *regbase, unsigned short port, unsigned char val) { writeb (val, regbase + port); } -static inline void vga_mm_w_fast (caddr_t regbase, unsigned short port, +static inline void vga_mm_w_fast (void __iomem *regbase, unsigned short port, unsigned char reg, unsigned char val) { writew (VGA_OUT16VAL (val, reg), regbase + port); } -static inline unsigned char vga_r (caddr_t regbase, unsigned short port) +static inline unsigned char vga_r (void __iomem *regbase, unsigned short port) { if (regbase) return vga_mm_r (regbase, port); @@ -262,7 +262,7 @@ return vga_io_r (port); } -static inline void vga_w (caddr_t regbase, unsigned short port, unsigned char val) +static inline void vga_w (void __iomem *regbase, unsigned short port, unsigned char val) { if (regbase) vga_mm_w (regbase, port, val); @@ -271,7 +271,7 @@ } -static inline void vga_w_fast (caddr_t regbase, unsigned short port, +static inline void vga_w_fast (void __iomem *regbase, unsigned short port, unsigned char reg, unsigned char val) { if (regbase) @@ -285,13 +285,13 @@ * VGA CRTC register read/write */ -static inline unsigned char vga_rcrt (caddr_t regbase, unsigned char reg) +static inline unsigned char vga_rcrt (void __iomem *regbase, unsigned char reg) { vga_w (regbase, VGA_CRT_IC, reg); return vga_r (regbase, VGA_CRT_DC); } -static inline void vga_wcrt (caddr_t regbase, unsigned char reg, unsigned char val) +static inline void vga_wcrt (void __iomem *regbase, unsigned char reg, unsigned char val) { #ifdef VGA_OUTW_WRITE vga_w_fast (regbase, VGA_CRT_IC, reg, val); @@ -317,13 +317,13 @@ #endif /* VGA_OUTW_WRITE */ } -static inline unsigned char vga_mm_rcrt (caddr_t regbase, unsigned char reg) +static inline unsigned char vga_mm_rcrt (void __iomem *regbase, unsigned char reg) { vga_mm_w (regbase, VGA_CRT_IC, reg); return vga_mm_r (regbase, VGA_CRT_DC); } -static inline void vga_mm_wcrt (caddr_t regbase, unsigned char reg, unsigned char val) +static inline void vga_mm_wcrt (void __iomem *regbase, unsigned char reg, unsigned char val) { #ifdef VGA_OUTW_WRITE vga_mm_w_fast (regbase, VGA_CRT_IC, reg, val); @@ -338,13 +338,13 @@ * VGA sequencer register read/write */ -static inline unsigned char vga_rseq (caddr_t regbase, unsigned char reg) +static inline unsigned char vga_rseq (void __iomem *regbase, unsigned char reg) { vga_w (regbase, VGA_SEQ_I, reg); return vga_r (regbase, VGA_SEQ_D); } -static inline void vga_wseq (caddr_t regbase, unsigned char reg, unsigned char val) +static inline void vga_wseq (void __iomem *regbase, unsigned char reg, unsigned char val) { #ifdef VGA_OUTW_WRITE vga_w_fast (regbase, VGA_SEQ_I, reg, val); @@ -370,13 +370,13 @@ #endif /* VGA_OUTW_WRITE */ } -static inline unsigned char vga_mm_rseq (caddr_t regbase, unsigned char reg) +static inline unsigned char vga_mm_rseq (void __iomem *regbase, unsigned char reg) { vga_mm_w (regbase, VGA_SEQ_I, reg); return vga_mm_r (regbase, VGA_SEQ_D); } -static inline void vga_mm_wseq (caddr_t regbase, unsigned char reg, unsigned char val) +static inline void vga_mm_wseq (void __iomem *regbase, unsigned char reg, unsigned char val) { #ifdef VGA_OUTW_WRITE vga_mm_w_fast (regbase, VGA_SEQ_I, reg, val); @@ -390,13 +390,13 @@ * VGA graphics controller register read/write */ -static inline unsigned char vga_rgfx (caddr_t regbase, unsigned char reg) +static inline unsigned char vga_rgfx (void __iomem *regbase, unsigned char reg) { vga_w (regbase, VGA_GFX_I, reg); return vga_r (regbase, VGA_GFX_D); } -static inline void vga_wgfx (caddr_t regbase, unsigned char reg, unsigned char val) +static inline void vga_wgfx (void __iomem *regbase, unsigned char reg, unsigned char val) { #ifdef VGA_OUTW_WRITE vga_w_fast (regbase, VGA_GFX_I, reg, val); @@ -422,13 +422,13 @@ #endif /* VGA_OUTW_WRITE */ } -static inline unsigned char vga_mm_rgfx (caddr_t regbase, unsigned char reg) +static inline unsigned char vga_mm_rgfx (void __iomem *regbase, unsigned char reg) { vga_mm_w (regbase, VGA_GFX_I, reg); return vga_mm_r (regbase, VGA_GFX_D); } -static inline void vga_mm_wgfx (caddr_t regbase, unsigned char reg, unsigned char val) +static inline void vga_mm_wgfx (void __iomem *regbase, unsigned char reg, unsigned char val) { #ifdef VGA_OUTW_WRITE vga_mm_w_fast (regbase, VGA_GFX_I, reg, val); @@ -443,13 +443,13 @@ * VGA attribute controller register read/write */ -static inline unsigned char vga_rattr (caddr_t regbase, unsigned char reg) +static inline unsigned char vga_rattr (void __iomem *regbase, unsigned char reg) { vga_w (regbase, VGA_ATT_IW, reg); return vga_r (regbase, VGA_ATT_R); } -static inline void vga_wattr (caddr_t regbase, unsigned char reg, unsigned char val) +static inline void vga_wattr (void __iomem *regbase, unsigned char reg, unsigned char val) { vga_w (regbase, VGA_ATT_IW, reg); vga_w (regbase, VGA_ATT_W, val); @@ -467,13 +467,13 @@ vga_io_w (VGA_ATT_W, val); } -static inline unsigned char vga_mm_rattr (caddr_t regbase, unsigned char reg) +static inline unsigned char vga_mm_rattr (void __iomem *regbase, unsigned char reg) { vga_mm_w (regbase, VGA_ATT_IW, reg); return vga_mm_r (regbase, VGA_ATT_R); } -static inline void vga_mm_wattr (caddr_t regbase, unsigned char reg, unsigned char val) +static inline void vga_mm_wattr (void __iomem *regbase, unsigned char reg, unsigned char val) { vga_mm_w (regbase, VGA_ATT_IW, reg); vga_mm_w (regbase, VGA_ATT_W, val); diff -Nru a/kernel/audit.c b/kernel/audit.c --- a/kernel/audit.c 2004-09-26 10:25:57 -07:00 +++ b/kernel/audit.c 2004-09-26 10:25:57 -07:00 @@ -810,16 +810,3 @@ audit_log_end(ab); } } - -EXPORT_SYMBOL_GPL(audit_set_rate_limit); -EXPORT_SYMBOL_GPL(audit_set_backlog_limit); -EXPORT_SYMBOL_GPL(audit_set_enabled); -EXPORT_SYMBOL_GPL(audit_set_failure); - -EXPORT_SYMBOL_GPL(audit_log_start); -EXPORT_SYMBOL_GPL(audit_log_format); -EXPORT_SYMBOL_GPL(audit_log_end_irq); -EXPORT_SYMBOL_GPL(audit_log_end_fast); -EXPORT_SYMBOL_GPL(audit_log_end); -EXPORT_SYMBOL_GPL(audit_log); -EXPORT_SYMBOL_GPL(audit_log_d_path); diff -Nru a/kernel/auditsc.c b/kernel/auditsc.c --- a/kernel/auditsc.c 2004-09-26 10:25:57 -07:00 +++ b/kernel/auditsc.c 2004-09-26 10:25:57 -07:00 @@ -857,6 +857,7 @@ } #endif } +EXPORT_SYMBOL(audit_putname); /* Store the inode and device from a lookup. Called from * fs/namei.c:path_lookup(). */ @@ -913,11 +914,3 @@ } return 0; } - -EXPORT_SYMBOL_GPL(audit_alloc); -EXPORT_SYMBOL_GPL(audit_free); -EXPORT_SYMBOL_GPL(audit_syscall_entry); -EXPORT_SYMBOL_GPL(audit_syscall_exit); -EXPORT_SYMBOL_GPL(audit_getname); -EXPORT_SYMBOL_GPL(audit_putname); -EXPORT_SYMBOL_GPL(audit_inode); diff -Nru a/kernel/compat.c b/kernel/compat.c --- a/kernel/compat.c 2004-09-26 10:25:56 -07:00 +++ b/kernel/compat.c 2004-09-26 10:25:56 -07:00 @@ -412,92 +412,58 @@ } } -/* - * for maximum compatability, we allow programs to use a single (compat) - * unsigned long bitmask if all cpus will fit. If not, you have to have - * at least the kernel size available. - */ -#define USE_COMPAT_ULONG_CPUMASK (NR_CPUS <= BITS_PER_COMPAT_LONG) - -asmlinkage long compat_sys_sched_setaffinity(compat_pid_t pid, - unsigned int len, - compat_ulong_t __user *user_mask_ptr) +static int compat_get_user_cpu_mask(compat_ulong_t __user *user_mask_ptr, + unsigned len, cpumask_t *new_mask) { - cpumask_t kern_mask; - mm_segment_t old_fs; - int ret; + unsigned long *k; - if (USE_COMPAT_ULONG_CPUMASK) { - compat_ulong_t user_mask; + if (len < sizeof(cpumask_t)) + memset(new_mask, 0, sizeof(cpumask_t)); + else if (len > sizeof(cpumask_t)) + len = sizeof(cpumask_t); - if (len < sizeof(user_mask)) - return -EINVAL; + k = cpus_addr(*new_mask); + return compat_get_bitmap(k, user_mask_ptr, len * 8); +} - if (get_user(user_mask, user_mask_ptr)) - return -EFAULT; +asmlinkage long compat_sys_sched_setaffinity(compat_pid_t pid, + unsigned int len, + compat_ulong_t __user *user_mask_ptr) +{ + cpumask_t new_mask; + int retval; - cpus_addr(kern_mask)[0] = user_mask; - } else { - unsigned long *k; - - if (len < sizeof(kern_mask)) - return -EINVAL; - - k = cpus_addr(kern_mask); - ret = compat_get_bitmap(k, user_mask_ptr, - sizeof(kern_mask) * BITS_PER_LONG); - if (ret) - return ret; - } - - old_fs = get_fs(); - set_fs(KERNEL_DS); - ret = sys_sched_setaffinity(pid, - sizeof(kern_mask), - (unsigned long __user *) &kern_mask); - set_fs(old_fs); + retval = compat_get_user_cpu_mask(user_mask_ptr, len, &new_mask); + if (retval) + return retval; - return ret; + return sched_setaffinity(pid, new_mask); } asmlinkage long compat_sys_sched_getaffinity(compat_pid_t pid, unsigned int len, compat_ulong_t __user *user_mask_ptr) { - cpumask_t kern_mask; - mm_segment_t old_fs; int ret; + cpumask_t mask; + unsigned long *k; + unsigned int min_length = sizeof(cpumask_t); - if (len < (USE_COMPAT_ULONG_CPUMASK ? sizeof(compat_ulong_t) - : sizeof(kern_mask))) - return -EINVAL; + if (NR_CPUS <= BITS_PER_COMPAT_LONG) + min_length = sizeof(compat_ulong_t); - old_fs = get_fs(); - set_fs(KERNEL_DS); - ret = sys_sched_getaffinity(pid, - sizeof(kern_mask), - (unsigned long __user *) &kern_mask); - set_fs(old_fs); + if (len < min_length) + return -EINVAL; + ret = sched_getaffinity(pid, &mask); if (ret < 0) return ret; - if (USE_COMPAT_ULONG_CPUMASK) { - if (put_user(&cpus_addr(kern_mask)[0], user_mask_ptr)) - return -EFAULT; - ret = sizeof(compat_ulong_t); - } else { - unsigned long *k; - - k = cpus_addr(kern_mask); - ret = compat_put_bitmap(user_mask_ptr, k, - sizeof(kern_mask) * BITS_PER_LONG); - if (ret) - return ret; - - ret = sizeof(kern_mask); - } + k = cpus_addr(mask); + ret = compat_put_bitmap(user_mask_ptr, k, min_length * 8); + if (ret) + return ret; - return ret; + return min_length; } static int get_compat_itimerspec(struct itimerspec *dst, diff -Nru a/kernel/exit.c b/kernel/exit.c --- a/kernel/exit.c 2004-09-26 10:25:57 -07:00 +++ b/kernel/exit.c 2004-09-26 10:25:57 -07:00 @@ -949,9 +949,10 @@ static int wait_noreap_copyout(task_t *p, pid_t pid, uid_t uid, int why, int status, - struct siginfo __user *infop) + struct siginfo __user *infop, + struct rusage __user *rusagep) { - int retval = getrusage(p, RUSAGE_BOTH, &infop->si_rusage); + int retval = rusagep ? getrusage(p, RUSAGE_BOTH, rusagep) : 0; put_task_struct(p); if (!retval) retval = put_user(SIGCHLD, &infop->si_signo); @@ -1003,7 +1004,8 @@ why = (exit_code & 0x80) ? CLD_DUMPED : CLD_KILLED; status = exit_code & 0x7f; } - return wait_noreap_copyout(p, pid, uid, why, status, infop); + return wait_noreap_copyout(p, pid, uid, why, + status, infop, ru); } /* @@ -1161,7 +1163,7 @@ goto bail_ref; return wait_noreap_copyout(p, pid, uid, why, (exit_code << 8) | 0x7f, - infop); + infop, ru); } write_lock_irq(&tasklist_lock); @@ -1304,7 +1306,7 @@ read_unlock(&tasklist_lock); retval = wait_noreap_copyout(p, pid, uid, CLD_CONTINUED, - SIGCONT, infop); + SIGCONT, infop, ru); BUG_ON(retval == 0); goto end; } @@ -1371,7 +1373,8 @@ } asmlinkage long sys_waitid(int which, pid_t pid, - struct siginfo __user *infop, int options) + struct siginfo __user *infop, int options, + struct rusage __user *ru) { if (options & ~(WNOHANG|WNOWAIT|WEXITED|WSTOPPED|WCONTINUED)) return -EINVAL; @@ -1395,11 +1398,11 @@ return -EINVAL; } - return do_wait(pid, options, infop, NULL, &infop->si_rusage); + return do_wait(pid, options, infop, NULL, ru); } -asmlinkage long sys_wait4(pid_t pid, unsigned int __user *stat_addr, - int options, struct rusage __user *ru) +asmlinkage long sys_wait4(pid_t pid, int __user *stat_addr, + int options, struct rusage __user *ru) { if (options & ~(WNOHANG|WUNTRACED|__WNOTHREAD|__WCLONE|__WALL)) return -EINVAL; @@ -1412,7 +1415,7 @@ * sys_waitpid() remains for compatibility. waitpid() should be * implemented by calling sys_wait4() from libc.a. */ -asmlinkage long sys_waitpid(pid_t pid, unsigned __user *stat_addr, int options) +asmlinkage long sys_waitpid(pid_t pid, int __user *stat_addr, int options) { return sys_wait4(pid, stat_addr, options, NULL); } diff -Nru a/kernel/fork.c b/kernel/fork.c --- a/kernel/fork.c 2004-09-26 10:25:55 -07:00 +++ b/kernel/fork.c 2004-09-26 10:25:55 -07:00 @@ -483,6 +483,7 @@ mmdrop(mm); } } +EXPORT_SYMBOL_GPL(mmput); /** * get_task_mm - acquire a reference to the task's mm @@ -514,6 +515,7 @@ task_unlock(task); return mm; } +EXPORT_SYMBOL_GPL(get_task_mm); /* Please note the differences between mmput and mm_release. * mmput is called whenever we stop holding onto a mm_struct, @@ -1144,9 +1146,7 @@ bad_fork_cleanup_namespace: exit_namespace(p); bad_fork_cleanup_mm: - exit_mm(p); - if (p->active_mm) - mmdrop(p->active_mm); + mmput(p->mm); bad_fork_cleanup_signal: exit_signal(p); bad_fork_cleanup_sighand: @@ -1179,13 +1179,13 @@ goto fork_out; } -struct pt_regs * __init __attribute__((weak)) idle_regs(struct pt_regs *regs) +struct pt_regs * __devinit __attribute__((weak)) idle_regs(struct pt_regs *regs) { memset(regs, 0, sizeof(struct pt_regs)); return regs; } -task_t * __init fork_idle(int cpu) +task_t * __devinit fork_idle(int cpu) { task_t *task; struct pt_regs regs; diff -Nru a/kernel/pid.c b/kernel/pid.c --- a/kernel/pid.c 2004-09-26 10:25:56 -07:00 +++ b/kernel/pid.c 2004-09-26 10:25:56 -07:00 @@ -278,7 +278,7 @@ for (i = 0; i < PIDTYPE_MAX; i++) { pid_hash[i] = alloc_bootmem(pidhash_size * - sizeof(struct list_head)); + sizeof(*(pid_hash[i]))); if (!pid_hash[i]) panic("Could not alloc pidhash!\n"); for (j = 0; j < pidhash_size; j++) diff -Nru a/kernel/printk.c b/kernel/printk.c --- a/kernel/printk.c 2004-09-26 10:25:57 -07:00 +++ b/kernel/printk.c 2004-09-26 10:25:57 -07:00 @@ -192,6 +192,8 @@ unsigned long size = memparse(str, &str); unsigned long flags; + if (size) + size = roundup_pow_of_two(size); if (size > log_buf_len) { unsigned long start, dest_idx, offset; char * new_log_buf; diff -Nru a/kernel/ptrace.c b/kernel/ptrace.c --- a/kernel/ptrace.c 2004-09-26 10:25:57 -07:00 +++ b/kernel/ptrace.c 2004-09-26 10:25:57 -07:00 @@ -202,8 +202,6 @@ if (bytes > PAGE_SIZE-offset) bytes = PAGE_SIZE-offset; - flush_cache_page(vma, addr); - maddr = kmap(page); if (write) { copy_to_user_page(vma, page, addr, diff -Nru a/kernel/sched.c b/kernel/sched.c --- a/kernel/sched.c 2004-09-26 10:25:57 -07:00 +++ b/kernel/sched.c 2004-09-26 10:25:57 -07:00 @@ -1727,8 +1727,8 @@ if (tmp->flags & SD_BALANCE_EXEC) sd = tmp; - schedstat_inc(sd, sbe_attempts); if (sd) { + schedstat_inc(sd, sbe_attempts); new_cpu = find_idlest_cpu(current, this_cpu, sd); if (new_cpu != this_cpu) { schedstat_inc(sd, sbe_pushed); @@ -3362,33 +3362,10 @@ return retval; } -static int get_user_cpu_mask(unsigned long __user *user_mask_ptr, unsigned len, - cpumask_t *new_mask) -{ - if (len < sizeof(cpumask_t)) { - memset(new_mask, 0, sizeof(cpumask_t)); - } else if (len > sizeof(cpumask_t)) { - len = sizeof(cpumask_t); - } - return copy_from_user(new_mask, user_mask_ptr, len) ? -EFAULT : 0; -} - -/** - * sys_sched_setaffinity - set the cpu affinity of a process - * @pid: pid of the process - * @len: length in bytes of the bitmask pointed to by user_mask_ptr - * @user_mask_ptr: user-space pointer to the new cpu mask - */ -asmlinkage long sys_sched_setaffinity(pid_t pid, unsigned int len, - unsigned long __user *user_mask_ptr) +long sched_setaffinity(pid_t pid, cpumask_t new_mask) { - cpumask_t new_mask; - int retval; task_t *p; - - retval = get_user_cpu_mask(user_mask_ptr, len, &new_mask); - if (retval) - return retval; + int retval; lock_cpu_hotplug(); read_lock(&tasklist_lock); @@ -3421,6 +3398,36 @@ return retval; } +static int get_user_cpu_mask(unsigned long __user *user_mask_ptr, unsigned len, + cpumask_t *new_mask) +{ + if (len < sizeof(cpumask_t)) { + memset(new_mask, 0, sizeof(cpumask_t)); + } else if (len > sizeof(cpumask_t)) { + len = sizeof(cpumask_t); + } + return copy_from_user(new_mask, user_mask_ptr, len) ? -EFAULT : 0; +} + +/** + * sys_sched_setaffinity - set the cpu affinity of a process + * @pid: pid of the process + * @len: length in bytes of the bitmask pointed to by user_mask_ptr + * @user_mask_ptr: user-space pointer to the new cpu mask + */ +asmlinkage long sys_sched_setaffinity(pid_t pid, unsigned int len, + unsigned long __user *user_mask_ptr) +{ + cpumask_t new_mask; + int retval; + + retval = get_user_cpu_mask(user_mask_ptr, len, &new_mask); + if (retval) + return retval; + + return sched_setaffinity(pid, new_mask); +} + /* * Represents all cpu's present in the system * In systems capable of hotplug, this map could dynamically grow @@ -3436,24 +3443,11 @@ cpumask_t cpu_possible_map = CPU_MASK_ALL; #endif -/** - * sys_sched_getaffinity - get the cpu affinity of a process - * @pid: pid of the process - * @len: length in bytes of the bitmask pointed to by user_mask_ptr - * @user_mask_ptr: user-space pointer to hold the current cpu mask - */ -asmlinkage long sys_sched_getaffinity(pid_t pid, unsigned int len, - unsigned long __user *user_mask_ptr) +long sched_getaffinity(pid_t pid, cpumask_t *mask) { - unsigned int real_len; - cpumask_t mask; int retval; task_t *p; - real_len = sizeof(mask); - if (len < real_len) - return -EINVAL; - lock_cpu_hotplug(); read_lock(&tasklist_lock); @@ -3463,16 +3457,40 @@ goto out_unlock; retval = 0; - cpus_and(mask, p->cpus_allowed, cpu_possible_map); + cpus_and(*mask, p->cpus_allowed, cpu_possible_map); out_unlock: read_unlock(&tasklist_lock); unlock_cpu_hotplug(); if (retval) return retval; - if (copy_to_user(user_mask_ptr, &mask, real_len)) + + return 0; +} + +/** + * sys_sched_getaffinity - get the cpu affinity of a process + * @pid: pid of the process + * @len: length in bytes of the bitmask pointed to by user_mask_ptr + * @user_mask_ptr: user-space pointer to hold the current cpu mask + */ +asmlinkage long sys_sched_getaffinity(pid_t pid, unsigned int len, + unsigned long __user *user_mask_ptr) +{ + int ret; + cpumask_t mask; + + if (len < sizeof(cpumask_t)) + return -EINVAL; + + ret = sched_getaffinity(pid, &mask); + if (ret < 0) + return ret; + + if (copy_to_user(user_mask_ptr, &mask, sizeof(cpumask_t))) return -EFAULT; - return real_len; + + return sizeof(cpumask_t); } /** @@ -4559,7 +4577,7 @@ } } -#define SCHED_DOMAIN_DEBUG +#undef SCHED_DOMAIN_DEBUG #ifdef SCHED_DOMAIN_DEBUG void sched_domain_debug(void) { diff -Nru a/kernel/signal.c b/kernel/signal.c --- a/kernel/signal.c 2004-09-26 10:25:56 -07:00 +++ b/kernel/signal.c 2004-09-26 10:25:56 -07:00 @@ -1500,7 +1500,6 @@ /* FIXME: find out whether or not this is supposed to be c*time. */ info.si_utime = tsk->utime + tsk->signal->utime; info.si_stime = tsk->stime + tsk->signal->stime; - k_getrusage(tsk, RUSAGE_BOTH, &info.si_rusage); info.si_status = tsk->exit_code & 0x7f; if (tsk->exit_code & 0x80) @@ -1558,7 +1557,6 @@ /* FIXME: find out whether or not this is supposed to be c*time. */ info.si_utime = tsk->utime; info.si_stime = tsk->stime; - k_getrusage(tsk, RUSAGE_BOTH, &info.si_rusage); info.si_code = why; switch (why) { @@ -2170,8 +2168,6 @@ err |= __put_user(from->si_status, &to->si_status); err |= __put_user(from->si_utime, &to->si_utime); err |= __put_user(from->si_stime, &to->si_stime); - err |= __copy_to_user(&to->si_rusage, &from->si_rusage, - sizeof(to->si_rusage)); break; case __SI_RT: /* This is not generated by the kernel as of now. */ case __SI_MESGQ: /* But this is */ diff -Nru a/kernel/sys.c b/kernel/sys.c --- a/kernel/sys.c 2004-09-26 10:25:55 -07:00 +++ b/kernel/sys.c 2004-09-26 10:25:55 -07:00 @@ -274,7 +274,9 @@ cond_syscall(sys_mbind) cond_syscall(sys_get_mempolicy) cond_syscall(sys_set_mempolicy) +cond_syscall(compat_mbind) cond_syscall(compat_get_mempolicy) +cond_syscall(compat_set_mempolicy) /* arch-specific weak syscall entries */ cond_syscall(sys_pciconfig_read) @@ -1727,6 +1729,17 @@ } current->keep_capabilities = arg2; break; + case PR_SET_NAME: { + struct task_struct *me = current; + unsigned char ncomm[sizeof(me->comm)]; + + ncomm[sizeof(me->comm)-1] = 0; + if (strncpy_from_user(ncomm, (char *)arg2, + sizeof(me->comm)-1) < 0) + return -EFAULT; + set_task_comm(me, ncomm); + return 0; + } default: error = -EINVAL; break; diff -Nru a/kernel/timer.c b/kernel/timer.c --- a/kernel/timer.c 2004-09-26 10:25:57 -07:00 +++ b/kernel/timer.c 2004-09-26 10:25:57 -07:00 @@ -1492,7 +1492,10 @@ unsigned long time_interpolator_resolution(void) { - return NSEC_PER_SEC / time_interpolator->frequency; + if (time_interpolator->frequency < NSEC_PER_SEC) + return NSEC_PER_SEC / time_interpolator->frequency; + else + return 1; } #define GET_TI_NSECS(count,i) ((((count) - i->last_counter) * i->nsec_per_cyc) >> i->shift) diff -Nru a/lib/Makefile b/lib/Makefile --- a/lib/Makefile 2004-09-26 10:25:55 -07:00 +++ b/lib/Makefile 2004-09-26 10:25:55 -07:00 @@ -18,6 +18,7 @@ obj-$(CONFIG_CRC_CCITT) += crc-ccitt.o obj-$(CONFIG_CRC32) += crc32.o obj-$(CONFIG_LIBCRC32C) += libcrc32c.o +obj-$(CONFIG_GENERIC_IOMAP) += iomap.o obj-$(CONFIG_ZLIB_INFLATE) += zlib_inflate/ obj-$(CONFIG_ZLIB_DEFLATE) += zlib_deflate/ diff -Nru a/lib/idr.c b/lib/idr.c --- a/lib/idr.c 2004-09-26 10:25:58 -07:00 +++ b/lib/idr.c 2004-09-26 10:25:58 -07:00 @@ -39,8 +39,10 @@ struct idr_layer *p; spin_lock(&idp->lock); - if (!(p = idp->id_free)) + if (!(p = idp->id_free)) { + spin_unlock(&idp->lock); return NULL; + } idp->id_free = p->ary[0]; idp->id_free_cnt--; p->ary[0] = NULL; diff -Nru a/lib/iomap.c b/lib/iomap.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/lib/iomap.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,206 @@ +/* + * Implement the default iomap interfaces + */ +#include +#include +#include + +/* + * Read/write from/to an (offsettable) iomem cookie. It might be a PIO + * access or a MMIO access, these functions don't care. The info is + * encoded in the hardware mapping set up by the mapping functions + * (or the cookie itself, depending on implementation and hw). + * + * The generic routines don't assume any hardware mappings, and just + * encode the PIO/MMIO as part of the cookie. They coldly assume that + * the MMIO IO mappings are not in the low address range. + * + * Architectures for which this is not true can't use this generic + * implementation and should do their own copy. + * + * We encode the physical PIO addresses (0-0xffff) into the + * pointer by offsetting them with a constant (0x10000) and + * assuming that all the low addresses are always PIO. That means + * we can do some sanity checks on the low bits, and don't + * need to just take things for granted. + */ +#define PIO_OFFSET 0x10000UL +#define PIO_MASK 0x0ffffUL +#define PIO_RESERVED 0x40000UL + +/* + * Ugly macros are a way of life. + */ +#define VERIFY_PIO(port) BUG_ON((port & ~PIO_MASK) != PIO_OFFSET) + +#define IO_COND(addr, is_pio, is_mmio) do { \ + unsigned long port = (unsigned long __force)addr; \ + if (port < PIO_RESERVED) { \ + VERIFY_PIO(port); \ + port &= PIO_MASK; \ + is_pio; \ + } else { \ + is_mmio; \ + } \ +} while (0) + +unsigned int fastcall ioread8(void __iomem *addr) +{ + IO_COND(addr, return inb(port), return readb(addr)); +} +unsigned int fastcall ioread16(void __iomem *addr) +{ + IO_COND(addr, return inw(port), return readw(addr)); +} +unsigned int fastcall ioread32(void __iomem *addr) +{ + IO_COND(addr, return inl(port), return readl(addr)); +} +EXPORT_SYMBOL(ioread8); +EXPORT_SYMBOL(ioread16); +EXPORT_SYMBOL(ioread32); + +void fastcall iowrite8(u8 val, void __iomem *addr) +{ + IO_COND(addr, outb(val,port), writeb(val, addr)); +} +void fastcall iowrite16(u16 val, void __iomem *addr) +{ + IO_COND(addr, outw(val,port), writew(val, addr)); +} +void fastcall iowrite32(u32 val, void __iomem *addr) +{ + IO_COND(addr, outl(val,port), writel(val, addr)); +} +EXPORT_SYMBOL(iowrite8); +EXPORT_SYMBOL(iowrite16); +EXPORT_SYMBOL(iowrite32); + +/* + * These are the "repeat MMIO read/write" functions. + * Note the "__raw" accesses, since we don't want to + * convert to CPU byte order. We write in "IO byte + * order" (we also don't have IO barriers). + */ +static inline void mmio_insb(void __iomem *addr, u8 *dst, int count) +{ + while (--count >= 0) { + u8 data = __raw_readb(addr); + *dst = data; + dst++; + } +} +static inline void mmio_insw(void __iomem *addr, u16 *dst, int count) +{ + while (--count >= 0) { + u16 data = __raw_readw(addr); + *dst = data; + dst++; + } +} +static inline void mmio_insl(void __iomem *addr, u32 *dst, int count) +{ + while (--count >= 0) { + u32 data = __raw_readl(addr); + *dst = data; + dst++; + } +} + +static inline void mmio_outsb(void __iomem *addr, const u8 *src, int count) +{ + while (--count >= 0) { + __raw_writeb(*src, addr); + src++; + } +} +static inline void mmio_outsw(void __iomem *addr, const u16 *src, int count) +{ + while (--count >= 0) { + __raw_writew(*src, addr); + src++; + } +} +static inline void mmio_outsl(void __iomem *addr, const u32 *src, int count) +{ + while (--count >= 0) { + __raw_writel(*src, addr); + src++; + } +} + +void fastcall ioread8_rep(void __iomem *addr, void *dst, unsigned long count) +{ + IO_COND(addr, insb(port,dst,count), mmio_insb(addr, dst, count)); +} +void fastcall ioread16_rep(void __iomem *addr, void *dst, unsigned long count) +{ + IO_COND(addr, insw(port,dst,count), mmio_insw(addr, dst, count)); +} +void fastcall ioread32_rep(void __iomem *addr, void *dst, unsigned long count) +{ + IO_COND(addr, insl(port,dst,count), mmio_insl(addr, dst, count)); +} +EXPORT_SYMBOL(ioread8_rep); +EXPORT_SYMBOL(ioread16_rep); +EXPORT_SYMBOL(ioread32_rep); + +void fastcall iowrite8_rep(void __iomem *addr, const void *src, unsigned long count) +{ + IO_COND(addr, outsb(port, src, count), mmio_outsb(addr, src, count)); +} +void fastcall iowrite16_rep(void __iomem *addr, const void *src, unsigned long count) +{ + IO_COND(addr, outsw(port, src, count), mmio_outsw(addr, src, count)); +} +void fastcall iowrite32_rep(void __iomem *addr, const void *src, unsigned long count) +{ + IO_COND(addr, outsl(port, src,count), mmio_outsl(addr, src, count)); +} +EXPORT_SYMBOL(iowrite8_rep); +EXPORT_SYMBOL(iowrite16_rep); +EXPORT_SYMBOL(iowrite32_rep); + +/* Create a virtual mapping cookie for an IO port range */ +void __iomem *ioport_map(unsigned long port, unsigned int nr) +{ + if (port > PIO_MASK) + return NULL; + return (void __iomem *) (unsigned long) (port + PIO_OFFSET); +} + +void ioport_unmap(void __iomem *addr) +{ + /* Nothing to do */ +} +EXPORT_SYMBOL(ioport_map); +EXPORT_SYMBOL(ioport_unmap); + +/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */ +void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) +{ + unsigned long start = pci_resource_start(dev, bar); + unsigned long len = pci_resource_len(dev, bar); + unsigned long flags = pci_resource_flags(dev, bar); + + if (!len || !start) + return NULL; + if (maxlen && len > maxlen) + len = maxlen; + if (flags & IORESOURCE_IO) + return ioport_map(start, len); + if (flags & IORESOURCE_MEM) { + if (flags & IORESOURCE_CACHEABLE) + return ioremap(start, len); + return ioremap_nocache(start, len); + } + /* What? */ + return NULL; +} + +void pci_iounmap(struct pci_dev *dev, void __iomem * addr) +{ + IO_COND(addr, /* nothing */, iounmap(addr)); +} +EXPORT_SYMBOL(pci_iomap); +EXPORT_SYMBOL(pci_iounmap); diff -Nru a/mm/highmem.c b/mm/highmem.c --- a/mm/highmem.c 2004-09-26 10:25:56 -07:00 +++ b/mm/highmem.c 2004-09-26 10:25:56 -07:00 @@ -300,6 +300,7 @@ */ vfrom = page_address(fromvec->bv_page) + tovec->bv_offset; + flush_dcache_page(tovec->bv_page); bounce_copy_vec(tovec, vfrom); } } @@ -406,6 +407,7 @@ if (rw == WRITE) { char *vto, *vfrom; + flush_dcache_page(from->bv_page); vto = page_address(to->bv_page) + to->bv_offset; vfrom = kmap(from->bv_page) + from->bv_offset; memcpy(vto, vfrom, to->bv_len); diff -Nru a/mm/mempolicy.c b/mm/mempolicy.c --- a/mm/mempolicy.c 2004-09-26 10:25:57 -07:00 +++ b/mm/mempolicy.c 2004-09-26 10:25:57 -07:00 @@ -132,6 +132,7 @@ unsigned long nlongs; unsigned long endmask; + --maxnode; bitmap_zero(nodes, MAX_NUMNODES); if (maxnode == 0 || !nmask) return 0; @@ -145,6 +146,8 @@ /* When the user specified more nodes than supported just check if the non supported part is all zero. */ if (nlongs > BITS_TO_LONGS(MAX_NUMNODES)) { + if (nlongs > PAGE_SIZE/sizeof(long)) + return -EINVAL; for (k = BITS_TO_LONGS(MAX_NUMNODES); k < nlongs; k++) { unsigned long t; if (get_user(t, nmask + k)) @@ -557,7 +560,7 @@ asmlinkage long compat_set_mempolicy(int mode, compat_ulong_t __user *nmask, compat_ulong_t maxnode) { - long err; + long err = 0; unsigned long __user *nm = NULL; unsigned long nr_bits, alloc_size; DECLARE_BITMAP(bm, MAX_NUMNODES); @@ -581,7 +584,7 @@ compat_ulong_t mode, compat_ulong_t __user *nmask, compat_ulong_t maxnode, compat_ulong_t flags) { - long err; + long err = 0; unsigned long __user *nm = NULL; unsigned long nr_bits, alloc_size; DECLARE_BITMAP(bm, MAX_NUMNODES); diff -Nru a/mm/rmap.c b/mm/rmap.c --- a/mm/rmap.c 2004-09-26 10:25:57 -07:00 +++ b/mm/rmap.c 2004-09-26 10:25:57 -07:00 @@ -405,8 +405,9 @@ referenced += page_referenced_file(page); else if (TestSetPageLocked(page)) referenced++; - else if (page->mapping) { - referenced += page_referenced_file(page); + else { + if (page->mapping) + referenced += page_referenced_file(page); unlock_page(page); } } diff -Nru a/mm/shmem.c b/mm/shmem.c --- a/mm/shmem.c 2004-09-26 10:25:56 -07:00 +++ b/mm/shmem.c 2004-09-26 10:25:56 -07:00 @@ -6,8 +6,8 @@ * 2000-2001 Christoph Rohland * 2000-2001 SAP AG * 2002 Red Hat Inc. - * Copyright (C) 2002-2003 Hugh Dickins. - * Copyright (C) 2002-2003 VERITAS Software Corporation. + * Copyright (C) 2002-2004 Hugh Dickins. + * Copyright (C) 2002-2004 VERITAS Software Corporation. * Copyright (C) 2004 Andi Kleen, SuSE Labs * * This file is released under the GPL. @@ -179,16 +179,18 @@ .unplug_io_fn = default_unplug_io_fn, }; -static LIST_HEAD(shmem_inodes); -static spinlock_t shmem_ilock = SPIN_LOCK_UNLOCKED; +static LIST_HEAD(shmem_swaplist); +static spinlock_t shmem_swaplist_lock = SPIN_LOCK_UNLOCKED; static void shmem_free_block(struct inode *inode) { struct shmem_sb_info *sbinfo = SHMEM_SB(inode->i_sb); - spin_lock(&sbinfo->stat_lock); - sbinfo->free_blocks++; - inode->i_blocks -= BLOCKS_PER_PAGE; - spin_unlock(&sbinfo->stat_lock); + if (sbinfo) { + spin_lock(&sbinfo->stat_lock); + sbinfo->free_blocks++; + inode->i_blocks -= BLOCKS_PER_PAGE; + spin_unlock(&sbinfo->stat_lock); + } } /* @@ -213,11 +215,13 @@ if (freed > 0) { struct shmem_sb_info *sbinfo = SHMEM_SB(inode->i_sb); info->alloced -= freed; - spin_lock(&sbinfo->stat_lock); - sbinfo->free_blocks += freed; - inode->i_blocks -= freed*BLOCKS_PER_PAGE; - spin_unlock(&sbinfo->stat_lock); shmem_unacct_blocks(info->flags, freed); + if (sbinfo) { + spin_lock(&sbinfo->stat_lock); + sbinfo->free_blocks += freed; + inode->i_blocks -= freed*BLOCKS_PER_PAGE; + spin_unlock(&sbinfo->stat_lock); + } } } @@ -350,14 +354,16 @@ * page (and perhaps indirect index pages) yet to allocate: * a waste to allocate index if we cannot allocate data. */ - spin_lock(&sbinfo->stat_lock); - if (sbinfo->free_blocks <= 1) { + if (sbinfo) { + spin_lock(&sbinfo->stat_lock); + if (sbinfo->free_blocks <= 1) { + spin_unlock(&sbinfo->stat_lock); + return ERR_PTR(-ENOSPC); + } + sbinfo->free_blocks--; + inode->i_blocks += BLOCKS_PER_PAGE; spin_unlock(&sbinfo->stat_lock); - return ERR_PTR(-ENOSPC); } - sbinfo->free_blocks--; - inode->i_blocks += BLOCKS_PER_PAGE; - spin_unlock(&sbinfo->stat_lock); spin_unlock(&info->lock); page = shmem_dir_alloc(mapping_gfp_mask(inode->i_mapping)); @@ -598,17 +604,21 @@ struct shmem_inode_info *info = SHMEM_I(inode); if (inode->i_op->truncate == shmem_truncate) { - spin_lock(&shmem_ilock); - list_del(&info->list); - spin_unlock(&shmem_ilock); shmem_unacct_size(info->flags, inode->i_size); inode->i_size = 0; shmem_truncate(inode); + if (!list_empty(&info->swaplist)) { + spin_lock(&shmem_swaplist_lock); + list_del_init(&info->swaplist); + spin_unlock(&shmem_swaplist_lock); + } + } + if (sbinfo) { + BUG_ON(inode->i_blocks); + spin_lock(&sbinfo->stat_lock); + sbinfo->free_inodes++; + spin_unlock(&sbinfo->stat_lock); } - BUG_ON(inode->i_blocks); - spin_lock(&sbinfo->stat_lock); - sbinfo->free_inodes++; - spin_unlock(&sbinfo->stat_lock); clear_inode(inode); } @@ -713,22 +723,23 @@ */ int shmem_unuse(swp_entry_t entry, struct page *page) { - struct list_head *p; + struct list_head *p, *next; struct shmem_inode_info *info; int found = 0; - spin_lock(&shmem_ilock); - list_for_each(p, &shmem_inodes) { - info = list_entry(p, struct shmem_inode_info, list); - - if (info->swapped && shmem_unuse_inode(info, entry, page)) { + spin_lock(&shmem_swaplist_lock); + list_for_each_safe(p, next, &shmem_swaplist) { + info = list_entry(p, struct shmem_inode_info, swaplist); + if (!info->swapped) + list_del_init(&info->swaplist); + else if (shmem_unuse_inode(info, entry, page)) { /* move head to start search for next from here */ - list_move_tail(&shmem_inodes, &info->list); + list_move_tail(&shmem_swaplist, &info->swaplist); found = 1; break; } } - spin_unlock(&shmem_ilock); + spin_unlock(&shmem_swaplist_lock); return found; } @@ -770,6 +781,12 @@ shmem_swp_set(info, entry, swap.val); shmem_swp_unmap(entry); spin_unlock(&info->lock); + if (list_empty(&info->swaplist)) { + spin_lock(&shmem_swaplist_lock); + /* move instead of add in case we're racing */ + list_move_tail(&info->swaplist, &shmem_swaplist); + spin_unlock(&shmem_swaplist_lock); + } unlock_page(page); return 0; } @@ -868,7 +885,7 @@ struct page *swappage; swp_entry_t *entry; swp_entry_t swap; - int error, majmin = VM_FAULT_MINOR; + int error; if (idx >= SHMEM_MAX_INDEX) return -EFBIG; @@ -906,9 +923,10 @@ shmem_swp_unmap(entry); spin_unlock(&info->lock); /* here we actually do the io */ - if (majmin == VM_FAULT_MINOR && type) + if (type && *type == VM_FAULT_MINOR) { inc_page_state(pgmajfault); - majmin = VM_FAULT_MAJOR; + *type = VM_FAULT_MAJOR; + } swappage = shmem_swapin(info, swap, idx); if (!swappage) { spin_lock(&info->lock); @@ -1001,16 +1019,23 @@ } else { shmem_swp_unmap(entry); sbinfo = SHMEM_SB(inode->i_sb); - spin_lock(&sbinfo->stat_lock); - if (sbinfo->free_blocks == 0 || shmem_acct_block(info->flags)) { + if (sbinfo) { + spin_lock(&sbinfo->stat_lock); + if (sbinfo->free_blocks == 0 || + shmem_acct_block(info->flags)) { + spin_unlock(&sbinfo->stat_lock); + spin_unlock(&info->lock); + error = -ENOSPC; + goto failed; + } + sbinfo->free_blocks--; + inode->i_blocks += BLOCKS_PER_PAGE; spin_unlock(&sbinfo->stat_lock); + } else if (shmem_acct_block(info->flags)) { spin_unlock(&info->lock); error = -ENOSPC; goto failed; } - sbinfo->free_blocks--; - inode->i_blocks += BLOCKS_PER_PAGE; - spin_unlock(&sbinfo->stat_lock); if (!filepage) { spin_unlock(&info->lock); @@ -1053,15 +1078,10 @@ SetPageUptodate(filepage); } done: - if (!*pagep) { - if (filepage) { - unlock_page(filepage); - *pagep = filepage; - } else - *pagep = ZERO_PAGE(0); + if (*pagep != filepage) { + unlock_page(filepage); + *pagep = filepage; } - if (type) - *type = majmin; return 0; failed: @@ -1187,13 +1207,15 @@ struct shmem_inode_info *info; struct shmem_sb_info *sbinfo = SHMEM_SB(sb); - spin_lock(&sbinfo->stat_lock); - if (!sbinfo->free_inodes) { + if (sbinfo) { + spin_lock(&sbinfo->stat_lock); + if (!sbinfo->free_inodes) { + spin_unlock(&sbinfo->stat_lock); + return NULL; + } + sbinfo->free_inodes--; spin_unlock(&sbinfo->stat_lock); - return NULL; } - sbinfo->free_inodes--; - spin_unlock(&sbinfo->stat_lock); inode = new_inode(sb); if (inode) { @@ -1209,6 +1231,8 @@ memset(info, 0, (char *)inode - (char *)info); spin_lock_init(&info->lock); mpol_shared_policy_init(&info->policy); + INIT_LIST_HEAD(&info->swaplist); + switch (mode & S_IFMT) { default: init_special_inode(inode, mode, dev); @@ -1216,9 +1240,6 @@ case S_IFREG: inode->i_op = &shmem_inode_operations; inode->i_fop = &shmem_file_operations; - spin_lock(&shmem_ilock); - list_add_tail(&info->list, &shmem_inodes); - spin_unlock(&shmem_ilock); break; case S_IFDIR: inode->i_nlink++; @@ -1234,32 +1255,32 @@ return inode; } -static int shmem_set_size(struct shmem_sb_info *info, +#ifdef CONFIG_TMPFS + +static int shmem_set_size(struct shmem_sb_info *sbinfo, unsigned long max_blocks, unsigned long max_inodes) { int error; unsigned long blocks, inodes; - spin_lock(&info->stat_lock); - blocks = info->max_blocks - info->free_blocks; - inodes = info->max_inodes - info->free_inodes; + spin_lock(&sbinfo->stat_lock); + blocks = sbinfo->max_blocks - sbinfo->free_blocks; + inodes = sbinfo->max_inodes - sbinfo->free_inodes; error = -EINVAL; if (max_blocks < blocks) goto out; if (max_inodes < inodes) goto out; error = 0; - info->max_blocks = max_blocks; - info->free_blocks = max_blocks - blocks; - info->max_inodes = max_inodes; - info->free_inodes = max_inodes - inodes; + sbinfo->max_blocks = max_blocks; + sbinfo->free_blocks = max_blocks - blocks; + sbinfo->max_inodes = max_inodes; + sbinfo->free_inodes = max_inodes - inodes; out: - spin_unlock(&info->stat_lock); + spin_unlock(&sbinfo->stat_lock); return error; } -#ifdef CONFIG_TMPFS - static struct inode_operations shmem_symlink_inode_operations; static struct inode_operations shmem_symlink_inline_operations; @@ -1280,7 +1301,7 @@ struct inode *inode = file->f_dentry->d_inode; loff_t pos; unsigned long written; - int err; + ssize_t err; if ((ssize_t) count < 0) return -EINVAL; @@ -1417,13 +1438,14 @@ if (index == end_index) { nr = i_size & ~PAGE_CACHE_MASK; if (nr <= offset) { - page_cache_release(page); + if (page) + page_cache_release(page); break; } } nr -= offset; - if (page != ZERO_PAGE(0)) { + if (page) { /* * If users can be writing to this page using arbitrary * virtual addresses, take care about potential aliasing @@ -1436,7 +1458,8 @@ */ if (!offset) mark_page_accessed(page); - } + } else + page = ZERO_PAGE(0); /* * Ok, we have the page, and it's up-to-date, so @@ -1511,13 +1534,16 @@ buf->f_type = TMPFS_MAGIC; buf->f_bsize = PAGE_CACHE_SIZE; - spin_lock(&sbinfo->stat_lock); - buf->f_blocks = sbinfo->max_blocks; - buf->f_bavail = buf->f_bfree = sbinfo->free_blocks; - buf->f_files = sbinfo->max_inodes; - buf->f_ffree = sbinfo->free_inodes; - spin_unlock(&sbinfo->stat_lock); buf->f_namelen = NAME_MAX; + if (sbinfo) { + spin_lock(&sbinfo->stat_lock); + buf->f_blocks = sbinfo->max_blocks; + buf->f_bavail = buf->f_bfree = sbinfo->free_blocks; + buf->f_files = sbinfo->max_inodes; + buf->f_ffree = sbinfo->free_inodes; + spin_unlock(&sbinfo->stat_lock); + } + /* else leave those fields 0 like simple_statfs */ return 0; } @@ -1567,6 +1593,22 @@ static int shmem_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) { struct inode *inode = old_dentry->d_inode; + struct shmem_sb_info *sbinfo = SHMEM_SB(inode->i_sb); + + /* + * No ordinary (disk based) filesystem counts links as inodes; + * but each new link needs a new dentry, pinning lowmem, and + * tmpfs dentries cannot be pruned until they are unlinked. + */ + if (sbinfo) { + spin_lock(&sbinfo->stat_lock); + if (!sbinfo->free_inodes) { + spin_unlock(&sbinfo->stat_lock); + return -ENOSPC; + } + sbinfo->free_inodes--; + spin_unlock(&sbinfo->stat_lock); + } dir->i_size += BOGO_DIRENT_SIZE; inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME; @@ -1581,6 +1623,15 @@ { struct inode *inode = dentry->d_inode; + if (inode->i_nlink > 1 && !S_ISDIR(inode->i_mode)) { + struct shmem_sb_info *sbinfo = SHMEM_SB(inode->i_sb); + if (sbinfo) { + spin_lock(&sbinfo->stat_lock); + sbinfo->free_inodes++; + spin_unlock(&sbinfo->stat_lock); + } + } + dir->i_size -= BOGO_DIRENT_SIZE; inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME; inode->i_nlink--; @@ -1658,9 +1709,6 @@ return error; } inode->i_op = &shmem_symlink_inode_operations; - spin_lock(&shmem_ilock); - list_add_tail(&info->list, &shmem_inodes); - spin_unlock(&shmem_ilock); kaddr = kmap_atomic(page, KM_USER0); memcpy(kaddr, symname, len); kunmap_atomic(kaddr, KM_USER0); @@ -1789,53 +1837,75 @@ static int shmem_remount_fs(struct super_block *sb, int *flags, char *data) { struct shmem_sb_info *sbinfo = SHMEM_SB(sb); - unsigned long max_blocks = sbinfo->max_blocks; - unsigned long max_inodes = sbinfo->max_inodes; + unsigned long max_blocks = 0; + unsigned long max_inodes = 0; + if (sbinfo) { + max_blocks = sbinfo->max_blocks; + max_inodes = sbinfo->max_inodes; + } if (shmem_parse_options(data, NULL, NULL, NULL, &max_blocks, &max_inodes)) return -EINVAL; + /* Keep it simple: disallow limited <-> unlimited remount */ + if ((max_blocks || max_inodes) == !sbinfo) + return -EINVAL; + /* But allow the pointless unlimited -> unlimited remount */ + if (!sbinfo) + return 0; return shmem_set_size(sbinfo, max_blocks, max_inodes); } #endif +static void shmem_put_super(struct super_block *sb) +{ + kfree(sb->s_fs_info); + sb->s_fs_info = NULL; +} + static int shmem_fill_super(struct super_block *sb, void *data, int silent) { struct inode *inode; struct dentry *root; - unsigned long blocks, inodes; int mode = S_IRWXUGO | S_ISVTX; uid_t uid = current->fsuid; gid_t gid = current->fsgid; - struct shmem_sb_info *sbinfo; int err = -ENOMEM; - sbinfo = kmalloc(sizeof(struct shmem_sb_info), GFP_KERNEL); - if (!sbinfo) - return -ENOMEM; - sb->s_fs_info = sbinfo; - memset(sbinfo, 0, sizeof(struct shmem_sb_info)); +#ifdef CONFIG_TMPFS + unsigned long blocks = 0; + unsigned long inodes = 0; /* * Per default we only allow half of the physical ram per - * tmpfs instance + * tmpfs instance, limiting inodes to one per page of lowmem; + * but the internal instance is left unlimited. */ - blocks = inodes = totalram_pages / 2; - -#ifdef CONFIG_TMPFS - if (shmem_parse_options(data, &mode, &uid, &gid, &blocks, &inodes)) { - err = -EINVAL; - goto failed; + if (!(sb->s_flags & MS_NOUSER)) { + blocks = totalram_pages / 2; + inodes = totalram_pages - totalhigh_pages; + if (inodes > blocks) + inodes = blocks; + + if (shmem_parse_options(data, &mode, + &uid, &gid, &blocks, &inodes)) + return -EINVAL; + } + + if (blocks || inodes) { + struct shmem_sb_info *sbinfo; + sbinfo = kmalloc(sizeof(struct shmem_sb_info), GFP_KERNEL); + if (!sbinfo) + return -ENOMEM; + sb->s_fs_info = sbinfo; + spin_lock_init(&sbinfo->stat_lock); + sbinfo->max_blocks = blocks; + sbinfo->free_blocks = blocks; + sbinfo->max_inodes = inodes; + sbinfo->free_inodes = inodes; } -#else - sb->s_flags |= MS_NOUSER; #endif - spin_lock_init(&sbinfo->stat_lock); - sbinfo->max_blocks = blocks; - sbinfo->free_blocks = blocks; - sbinfo->max_inodes = inodes; - sbinfo->free_inodes = inodes; sb->s_maxbytes = SHMEM_MAX_BYTES; sb->s_blocksize = PAGE_CACHE_SIZE; sb->s_blocksize_bits = PAGE_CACHE_SHIFT; @@ -1855,17 +1925,10 @@ failed_iput: iput(inode); failed: - kfree(sbinfo); - sb->s_fs_info = NULL; + shmem_put_super(sb); return err; } -static void shmem_put_super(struct super_block *sb) -{ - kfree(sb->s_fs_info); - sb->s_fs_info = NULL; -} - static kmem_cache_t *shmem_inode_cachep; static struct inode *shmem_alloc_inode(struct super_block *sb) @@ -1897,8 +1960,7 @@ { shmem_inode_cachep = kmem_cache_create("shmem_inode_cache", sizeof(struct shmem_inode_info), - 0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT, - init_once, NULL); + 0, 0, init_once, NULL); if (shmem_inode_cachep == NULL) return -ENOMEM; return 0; @@ -2000,15 +2062,13 @@ #ifdef CONFIG_TMPFS devfs_mk_dir("shm"); #endif - shm_mnt = kern_mount(&tmpfs_fs_type); + shm_mnt = do_kern_mount(tmpfs_fs_type.name, MS_NOUSER, + tmpfs_fs_type.name, NULL); if (IS_ERR(shm_mnt)) { error = PTR_ERR(shm_mnt); printk(KERN_ERR "Could not kern_mount tmpfs\n"); goto out1; } - - /* The internal instance should not do size checking */ - shmem_set_size(SHMEM_SB(shm_mnt->mnt_sb), ULONG_MAX, ULONG_MAX); return 0; out1: @@ -2039,7 +2099,7 @@ if (IS_ERR(shm_mnt)) return (void *)shm_mnt; - if (size > SHMEM_MAX_BYTES) + if (size < 0 || size > SHMEM_MAX_BYTES) return ERR_PTR(-EINVAL); if (shmem_acct_size(flags, size)) @@ -2073,7 +2133,7 @@ file->f_mapping = inode->i_mapping; file->f_op = &shmem_file_operations; file->f_mode = FMODE_WRITE | FMODE_READ; - return(file); + return file; close_file: put_filp(file); diff -Nru a/mm/slab.c b/mm/slab.c --- a/mm/slab.c 2004-09-26 10:25:58 -07:00 +++ b/mm/slab.c 2004-09-26 10:25:58 -07:00 @@ -562,6 +562,22 @@ return cachep->array[smp_processor_id()]; } +static kmem_cache_t * kmem_find_general_cachep (size_t size, int gfpflags) +{ + struct cache_sizes *csizep = malloc_sizes; + + /* This function could be moved to the header file, and + * made inline so consumers can quickly determine what + * cache pointer they require. + */ + for ( ; csizep->cs_size; csizep++) { + if (size > csizep->cs_size) + continue; + break; + } + return (gfpflags & GFP_DMA) ? csizep->cs_dmacachep : csizep->cs_cachep; +} + /* Cal the num objs, wastage, and bytes left over for a given slab size. */ static void cache_estimate (unsigned long gfporder, size_t size, size_t align, int flags, size_t *left_over, unsigned int *num) @@ -2554,24 +2570,6 @@ } EXPORT_SYMBOL(kmem_cache_size); - -kmem_cache_t * kmem_find_general_cachep (size_t size, int gfpflags) -{ - struct cache_sizes *csizep = malloc_sizes; - - /* This function could be moved to the header file, and - * made inline so consumers can quickly determine what - * cache pointer they require. - */ - for ( ; csizep->cs_size; csizep++) { - if (size > csizep->cs_size) - continue; - break; - } - return (gfpflags & GFP_DMA) ? csizep->cs_dmacachep : csizep->cs_cachep; -} - -EXPORT_SYMBOL(kmem_find_general_cachep); struct ccupdate_struct { kmem_cache_t *cachep; diff -Nru a/mm/vmalloc.c b/mm/vmalloc.c --- a/mm/vmalloc.c 2004-09-26 10:25:56 -07:00 +++ b/mm/vmalloc.c 2004-09-26 10:25:56 -07:00 @@ -247,6 +247,8 @@ out: write_unlock(&vmlist_lock); kfree(area); + if (printk_ratelimit()) + printk(KERN_WARNING "allocation failed: out of vmalloc space - use vmalloc= to increase size.\n"); return NULL; } diff -Nru a/net/atm/clip.c b/net/atm/clip.c --- a/net/atm/clip.c 2004-09-26 10:25:57 -07:00 +++ b/net/atm/clip.c 2004-09-26 10:25:57 -07:00 @@ -110,7 +110,8 @@ goto out; entry->expires = jiffies-1; /* force resolution or expiration */ - error = neigh_update(entry->neigh,NULL,NUD_NONE,0,0); + error = neigh_update(entry->neigh, NULL, NUD_NONE, + NEIGH_UPDATE_F_ADMIN); if (error) printk(KERN_CRIT "unlink_clip_vcc: " "neigh_update failed with %d\n",error); @@ -570,7 +571,8 @@ } link_vcc(clip_vcc,entry); } - error = neigh_update(neigh,llc_oui,NUD_PERMANENT,1,0); + error = neigh_update(neigh, llc_oui, NUD_PERMANENT, + NEIGH_UPDATE_F_OVERRIDE|NEIGH_UPDATE_F_ADMIN); neigh_release(neigh); return error; } diff -Nru a/net/bluetooth/bnep/core.c b/net/bluetooth/bnep/core.c --- a/net/bluetooth/bnep/core.c 2004-09-26 10:25:57 -07:00 +++ b/net/bluetooth/bnep/core.c 2004-09-26 10:25:57 -07:00 @@ -384,7 +384,7 @@ s->stats.rx_packets++; nskb->dev = dev; - nskb->ip_summed = CHECKSUM_UNNECESSARY; + nskb->ip_summed = CHECKSUM_NONE; nskb->protocol = eth_type_trans(nskb, dev); netif_rx_ni(nskb); return 0; diff -Nru a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c --- a/net/bluetooth/l2cap.c 2004-09-26 10:25:57 -07:00 +++ b/net/bluetooth/l2cap.c 2004-09-26 10:25:57 -07:00 @@ -57,7 +57,7 @@ #define BT_DBG(D...) #endif -#define VERSION "2.3" +#define VERSION "2.4" static struct proto_ops l2cap_sock_ops; @@ -1453,7 +1453,7 @@ BT_DBG("dcid 0x%4.4x scid 0x%4.4x result 0x%2.2x status 0x%2.2x", dcid, scid, result, status); if (!(sk = l2cap_get_chan_by_scid(&conn->chan_list, scid))) - return -ENOENT; + return 0; switch (result) { case L2CAP_CR_SUCCESS: @@ -1527,7 +1527,6 @@ struct l2cap_conf_rsp *rsp = (struct l2cap_conf_rsp *)data; u16 scid, flags, result; struct sock *sk; - int err = 0; scid = __le16_to_cpu(rsp->scid); flags = __le16_to_cpu(rsp->flags); @@ -1536,7 +1535,7 @@ BT_DBG("scid 0x%4.4x flags 0x%2.2x result 0x%2.2x", scid, flags, result); if (!(sk = l2cap_get_chan_by_scid(&conn->chan_list, scid))) - return -ENOENT; + return 0; switch (result) { case L2CAP_CONF_SUCCESS: @@ -1581,7 +1580,7 @@ done: bh_unlock_sock(sk); - return err; + return 0; } static inline int l2cap_disconnect_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd, u8 *data) @@ -1625,6 +1624,7 @@ if (!(sk = l2cap_get_chan_by_scid(&conn->chan_list, scid))) return 0; + l2cap_chan_del(sk, 0); bh_unlock_sock(sk); @@ -1632,7 +1632,7 @@ return 0; } -static inline int l2cap_info_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd, u8 *data) +static inline int l2cap_information_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd, u8 *data) { struct l2cap_info_req *req = (struct l2cap_info_req *) data; struct l2cap_info_rsp rsp; @@ -1645,10 +1645,11 @@ rsp.type = __cpu_to_le16(type); rsp.result = __cpu_to_le16(L2CAP_IR_NOTSUPP); l2cap_send_rsp(conn, cmd->ident, L2CAP_INFO_RSP, sizeof(rsp), &rsp); + return 0; } -static inline int l2cap_info_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd, u8 *data) +static inline int l2cap_information_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd, u8 *data) { struct l2cap_info_rsp *rsp = (struct l2cap_info_rsp *) data; u16 type, result; @@ -1721,11 +1722,11 @@ break; case L2CAP_INFO_REQ: - err = l2cap_info_req(conn, &cmd, data); + err = l2cap_information_req(conn, &cmd, data); break; case L2CAP_INFO_RSP: - err = l2cap_info_rsp(conn, &cmd, data); + err = l2cap_information_rsp(conn, &cmd, data); break; default: diff -Nru a/net/core/neighbour.c b/net/core/neighbour.c --- a/net/core/neighbour.c 2004-09-26 10:25:55 -07:00 +++ b/net/core/neighbour.c 2004-09-26 10:25:55 -07:00 @@ -133,7 +133,7 @@ if (atomic_read(&n->refcnt) == 1 && !(n->nud_state & NUD_PERMANENT) && (n->nud_state != NUD_INCOMPLETE || - jiffies - n->used > n->parms->retrans_time)) { + time_after(jiffies, n->used + n->parms->retrans_time))) { *np = n->next; n->dead = 1; shrunk = 1; @@ -255,7 +255,7 @@ if (tbl->entries > tbl->gc_thresh3 || (tbl->entries > tbl->gc_thresh2 && - now - tbl->last_flush > 5 * HZ)) { + time_after(now, tbl->last_flush + 5 * HZ))) { if (!neigh_forced_gc(tbl) && tbl->entries > tbl->gc_thresh3) goto out; @@ -542,40 +542,6 @@ hh->hh_output = neigh->ops->hh_output; } -/* - Transitions NUD_STALE <-> NUD_REACHABLE do not occur - when fast path is built: we have no timers associated with - these states, we do not have time to check state when sending. - neigh_periodic_timer check periodically neigh->confirmed - time and moves NUD_REACHABLE -> NUD_STALE. - - If a routine wants to know TRUE entry state, it calls - neigh_sync before checking state. - - Called with write_locked neigh. - */ - -static void neigh_sync(struct neighbour *n) -{ - unsigned long now = jiffies; - u8 state = n->nud_state; - - if (state & (NUD_NOARP | NUD_PERMANENT)) - return; - if (state & NUD_REACHABLE) { - if (now - n->confirmed > n->parms->reachable_time) { - n->nud_state = NUD_STALE; - neigh_suspect(n); - } - } else if (state & NUD_VALID) { - if (now - n->confirmed < n->parms->reachable_time) { - neigh_del_timer(n); - n->nud_state = NUD_REACHABLE; - neigh_connect(n); - } - } -} - static void neigh_periodic_timer(unsigned long arg) { struct neigh_table *tbl = (struct neigh_table *)arg; @@ -589,7 +555,7 @@ * periodically recompute ReachableTime from random function */ - if (now - tbl->last_rand > 300 * HZ) { + if (time_after(now, tbl->last_rand + 300 * HZ)) { struct neigh_parms *p; tbl->last_rand = now; for (p = &tbl->parms; p; p = p->next) @@ -612,24 +578,18 @@ goto next_elt; } - if ((long)(n->used - n->confirmed) < 0) + if (time_before(n->used, n->confirmed)) n->used = n->confirmed; if (atomic_read(&n->refcnt) == 1 && (state == NUD_FAILED || - now - n->used > n->parms->gc_staletime)) { + time_after(now, n->used + n->parms->gc_staletime))) { *np = n->next; n->dead = 1; write_unlock(&n->lock); neigh_release(n); continue; } - - if (n->nud_state & NUD_REACHABLE && - now - n->confirmed > n->parms->reachable_time) { - n->nud_state = NUD_STALE; - neigh_suspect(n); - } write_unlock(&n->lock); next_elt: @@ -654,7 +614,7 @@ static void neigh_timer_handler(unsigned long arg) { - unsigned long now = jiffies; + unsigned long now, next; struct neighbour *neigh = (struct neighbour *)arg; unsigned state; int notify = 0; @@ -662,6 +622,8 @@ write_lock(&neigh->lock); state = neigh->nud_state; + now = jiffies; + next = now + HZ; if (!(state & NUD_IN_TIMER)) { #ifndef CONFIG_SMP @@ -670,20 +632,42 @@ goto out; } - if ((state & NUD_VALID) && - now - neigh->confirmed < neigh->parms->reachable_time) { - neigh->nud_state = NUD_REACHABLE; - NEIGH_PRINTK2("neigh %p is still alive.\n", neigh); - neigh_connect(neigh); - goto out; - } - if (state == NUD_DELAY) { - NEIGH_PRINTK2("neigh %p is probed.\n", neigh); - neigh->nud_state = NUD_PROBE; - atomic_set(&neigh->probes, 0); + if (state & NUD_REACHABLE) { + if (time_before_eq(now, + neigh->confirmed + neigh->parms->reachable_time)) { + NEIGH_PRINTK2("neigh %p is still alive.\n", neigh); + next = neigh->confirmed + neigh->parms->reachable_time; + } else if (time_before_eq(now, + neigh->used + neigh->parms->delay_probe_time)) { + NEIGH_PRINTK2("neigh %p is delayed.\n", neigh); + neigh->nud_state = NUD_DELAY; + neigh_suspect(neigh); + next = now + neigh->parms->delay_probe_time; + } else { + NEIGH_PRINTK2("neigh %p is suspected.\n", neigh); + neigh->nud_state = NUD_STALE; + neigh_suspect(neigh); + } + } else if (state & NUD_DELAY) { + if (time_before_eq(now, + neigh->confirmed + neigh->parms->delay_probe_time)) { + NEIGH_PRINTK2("neigh %p is now reachable.\n", neigh); + neigh->nud_state = NUD_REACHABLE; + neigh_connect(neigh); + next = neigh->confirmed + neigh->parms->reachable_time; + } else { + NEIGH_PRINTK2("neigh %p is probed.\n", neigh); + neigh->nud_state = NUD_PROBE; + atomic_set(&neigh->probes, 0); + next = now + neigh->parms->retrans_time; + } + } else { + /* NUD_PROBE|NUD_INCOMPLETE */ + next = now + neigh->parms->retrans_time; } - if (atomic_read(&neigh->probes) >= neigh_max_probes(neigh)) { + if ((neigh->nud_state & (NUD_INCOMPLETE | NUD_PROBE)) && + atomic_read(&neigh->probes) >= neigh_max_probes(neigh)) { struct sk_buff *skb; neigh->nud_state = NUD_FAILED; @@ -703,19 +687,24 @@ write_lock(&neigh->lock); } skb_queue_purge(&neigh->arp_queue); - goto out; } - neigh->timer.expires = now + neigh->parms->retrans_time; - add_timer(&neigh->timer); - write_unlock(&neigh->lock); - - neigh->ops->solicit(neigh, skb_peek(&neigh->arp_queue)); - atomic_inc(&neigh->probes); - return; - + if (neigh->nud_state & NUD_IN_TIMER) { + neigh_hold(neigh); + if (time_before(next, jiffies + HZ/2)) + next = jiffies + HZ/2; + neigh->timer.expires = next; + add_timer(&neigh->timer); + } + if (neigh->nud_state & (NUD_INCOMPLETE | NUD_PROBE)) { + write_unlock(&neigh->lock); + neigh->ops->solicit(neigh, skb_peek(&neigh->arp_queue)); + atomic_inc(&neigh->probes); + } else { out: - write_unlock(&neigh->lock); + write_unlock(&neigh->lock); + } + #ifdef CONFIG_ARPD if (notify && neigh->parms->app_probes) neigh_app_notify(neigh); @@ -726,6 +715,7 @@ int __neigh_event_send(struct neighbour *neigh, struct sk_buff *skb) { int rc; + unsigned long now; write_lock_bh(&neigh->lock); @@ -733,18 +723,15 @@ if (neigh->nud_state & (NUD_CONNECTED | NUD_DELAY | NUD_PROBE)) goto out_unlock_bh; + now = jiffies; + if (!(neigh->nud_state & (NUD_STALE | NUD_INCOMPLETE))) { if (neigh->parms->mcast_probes + neigh->parms->app_probes) { atomic_set(&neigh->probes, neigh->parms->ucast_probes); neigh->nud_state = NUD_INCOMPLETE; neigh_hold(neigh); - neigh->timer.expires = jiffies + - neigh->parms->retrans_time; + neigh->timer.expires = now + 1; add_timer(&neigh->timer); - write_unlock_bh(&neigh->lock); - neigh->ops->solicit(neigh, skb); - atomic_inc(&neigh->probes); - write_lock_bh(&neigh->lock); } else { neigh->nud_state = NUD_FAILED; write_unlock_bh(&neigh->lock); @@ -753,6 +740,12 @@ kfree_skb(skb); return 1; } + } else if (neigh->nud_state & NUD_STALE) { + NEIGH_PRINTK2("neigh %p is delayed.\n", neigh); + neigh_hold(neigh); + neigh->nud_state = NUD_DELAY; + neigh->timer.expires = jiffies + neigh->parms->delay_probe_time; + add_timer(&neigh->timer); } if (neigh->nud_state == NUD_INCOMPLETE) { @@ -767,13 +760,6 @@ __skb_queue_tail(&neigh->arp_queue, skb); } rc = 1; - } else if (neigh->nud_state == NUD_STALE) { - NEIGH_PRINTK2("neigh %p is delayed.\n", neigh); - neigh_hold(neigh); - neigh->nud_state = NUD_DELAY; - neigh->timer.expires = jiffies + neigh->parms->delay_probe_time; - add_timer(&neigh->timer); - rc = 0; } out_unlock_bh: write_unlock_bh(&neigh->lock); @@ -800,14 +786,26 @@ /* Generic update routine. -- lladdr is new lladdr or NULL, if it is not supplied. -- new is new state. - -- override == 1 allows to override existing lladdr, if it is different. - -- arp == 0 means that the change is administrative. + -- flags + NEIGH_UPDATE_F_OVERRIDE allows to override existing lladdr, + if it is different. + NEIGH_UPDATE_F_WEAK_OVERRIDE will suspect existing "connected" + lladdr instead of overriding it + if it is different. + It also allows to retain current state + if lladdr is unchanged. + NEIGH_UPDATE_F_ADMIN means that the change is administrative. + + NEIGH_UPDATE_F_OVERRIDE_ISROUTER allows to override existing + NTF_ROUTER flag. + NEIGH_UPDATE_F_ISROUTER indicates if the neighbour is known as + a router. Caller MUST hold reference count on the entry. */ int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new, - int override, int arp) + u32 flags) { u8 old; int err; @@ -815,6 +813,7 @@ int notify = 0; #endif struct net_device *dev; + int update_isrouter = 0; write_lock_bh(&neigh->lock); @@ -822,7 +821,8 @@ old = neigh->nud_state; err = -EPERM; - if (arp && (old & (NUD_NOARP | NUD_PERMANENT))) + if (!(flags & NEIGH_UPDATE_F_ADMIN) && + (old & (NUD_NOARP | NUD_PERMANENT))) goto out; if (!(new & NUD_VALID)) { @@ -847,12 +847,9 @@ - compare new & old - if they are different, check override flag */ - if (old & NUD_VALID) { - if (!memcmp(lladdr, neigh->ha, dev->addr_len)) - lladdr = neigh->ha; - else if (!override) - goto out; - } + if ((old & NUD_VALID) && + !memcmp(lladdr, neigh->ha, dev->addr_len)) + lladdr = neigh->ha; } else { /* No address is supplied; if we know something, use it, otherwise discard the request. @@ -863,8 +860,6 @@ lladdr = neigh->ha; } - neigh_sync(neigh); - old = neigh->nud_state; if (new & NUD_CONNECTED) neigh->confirmed = jiffies; neigh->updated = jiffies; @@ -873,12 +868,37 @@ do not change entry state, if new one is STALE. */ err = 0; - if ((old & NUD_VALID) && lladdr == neigh->ha && - (new == old || (new == NUD_STALE && (old & NUD_CONNECTED)))) - goto out; + update_isrouter = flags & NEIGH_UPDATE_F_OVERRIDE_ISROUTER; + if (old & NUD_VALID) { + if (lladdr != neigh->ha && !(flags & NEIGH_UPDATE_F_OVERRIDE)) { + update_isrouter = 0; + if ((flags & NEIGH_UPDATE_F_WEAK_OVERRIDE) && + (old & NUD_CONNECTED)) { + lladdr = neigh->ha; + new = NUD_STALE; + } else + goto out; + } else { + if (lladdr == neigh->ha && new == NUD_STALE && + ((flags & NEIGH_UPDATE_F_WEAK_OVERRIDE) || + (old & NUD_CONNECTED)) + ) + new = old; + } + } + + if (new != old) { + neigh_del_timer(neigh); + if (new & NUD_IN_TIMER) { + neigh_hold(neigh); + neigh->timer.expires = jiffies + + ((new & NUD_REACHABLE) ? + neigh->parms->reachable_time : 0); + add_timer(&neigh->timer); + } + neigh->nud_state = new; + } - neigh_del_timer(neigh); - neigh->nud_state = new; if (lladdr != neigh->ha) { memcpy(&neigh->ha, lladdr, dev->addr_len); neigh_update_hhs(neigh); @@ -913,6 +933,11 @@ skb_queue_purge(&neigh->arp_queue); } out: + if (update_isrouter) { + neigh->flags = (flags & NEIGH_UPDATE_F_ISROUTER) ? + (neigh->flags | NTF_ROUTER) : + (neigh->flags & ~NTF_ROUTER); + } write_unlock_bh(&neigh->lock); #ifdef CONFIG_ARPD if (notify && neigh->parms->app_probes) @@ -928,7 +953,8 @@ struct neighbour *neigh = __neigh_lookup(tbl, saddr, dev, lladdr || !dev->addr_len); if (neigh) - neigh_update(neigh, lladdr, NUD_STALE, 1, 1); + neigh_update(neigh, lladdr, NUD_STALE, + NEIGH_UPDATE_F_OVERRIDE); return neigh; } @@ -1094,26 +1120,25 @@ struct sk_buff *skb) { unsigned long now = jiffies; - long sched_next = net_random() % p->proxy_delay; + unsigned long sched_next = now + (net_random() % p->proxy_delay); if (tbl->proxy_queue.qlen > p->proxy_qlen) { kfree_skb(skb); return; } skb->stamp.tv_sec = LOCALLY_ENQUEUED; - skb->stamp.tv_usec = now + sched_next; + skb->stamp.tv_usec = sched_next; spin_lock(&tbl->proxy_queue.lock); if (del_timer(&tbl->proxy_timer)) { - long tval = tbl->proxy_timer.expires - now; - if (tval < sched_next) - sched_next = tval; + if (time_before(tbl->proxy_timer.expires, sched_next)) + sched_next = tbl->proxy_timer.expires; } dst_release(skb->dst); skb->dst = NULL; dev_hold(skb->dev); __skb_queue_tail(&tbl->proxy_queue, skb); - mod_timer(&tbl->proxy_timer, now + sched_next); + mod_timer(&tbl->proxy_timer, sched_next); spin_unlock(&tbl->proxy_queue.lock); } @@ -1274,7 +1299,9 @@ n = neigh_lookup(tbl, RTA_DATA(nda[NDA_DST - 1]), dev); if (n) { - err = neigh_update(n, NULL, NUD_FAILED, 1, 0); + err = neigh_update(n, NULL, NUD_FAILED, + NEIGH_UPDATE_F_OVERRIDE| + NEIGH_UPDATE_F_ADMIN); neigh_release(n); } goto out_dev_put; @@ -1347,7 +1374,8 @@ RTA_DATA(nda[NDA_LLADDR - 1]) : NULL, ndm->ndm_state, - override, 0); + (override ? NEIGH_UPDATE_F_OVERRIDE : 0) | + NEIGH_UPDATE_F_ADMIN); } if (n) neigh_release(n); diff -Nru a/net/core/netfilter.c b/net/core/netfilter.c --- a/net/core/netfilter.c 2004-09-26 10:25:56 -07:00 +++ b/net/core/netfilter.c 2004-09-26 10:25:56 -07:00 @@ -806,7 +806,7 @@ tracking in use: without this, connection may not be in hash table, and hence manufactured ICMP or RST packets will not be associated with it. */ -void (*ip_ct_attach)(struct sk_buff *, struct nf_ct_info *); +void (*ip_ct_attach)(struct sk_buff *, struct sk_buff *); void __init netfilter_init(void) { diff -Nru a/net/core/netpoll.c b/net/core/netpoll.c --- a/net/core/netpoll.c 2004-09-26 10:25:57 -07:00 +++ b/net/core/netpoll.c 2004-09-26 10:25:57 -07:00 @@ -242,9 +242,9 @@ iph = (struct iphdr *)skb_push(skb, sizeof(*iph)); /* iph->version = 4; iph->ihl = 5; */ - put_unaligned(0x54, (unsigned char *)iph); + put_unaligned(0x45, (unsigned char *)iph); iph->tos = 0; - put_unaligned(htonl(ip_len), &(iph->tot_len)); + put_unaligned(htons(ip_len), &(iph->tot_len)); iph->id = 0; iph->frag_off = 0; iph->ttl = 64; diff -Nru a/net/core/pktgen.c b/net/core/pktgen.c --- a/net/core/pktgen.c 2004-09-26 10:25:56 -07:00 +++ b/net/core/pktgen.c 2004-09-26 10:25:56 -07:00 @@ -52,6 +52,9 @@ * * Fixed unaligned access on IA-64 Grant Grundler * + * New xmit() return, do_div and misc clean up by Stephen Hemminger + * 040923 + * * See Documentation/networking/pktgen.txt for how to use this. */ @@ -94,7 +97,7 @@ #define VERSION "pktgen version 1.32" static char version[] __initdata = - "pktgen.c: v1.3: Packet Generator for packet performance testing.\n"; + "pktgen.c: v1.4: Packet Generator for packet performance testing.\n"; /* Used to help with determining the pkts on receive */ @@ -584,15 +587,48 @@ return skb; } +static void show_results(struct pktgen_info* info, int nr_frags) +{ + __u64 total, bps, mbps, pps; + unsigned long idle; + int size = info->pkt_size + 4; /* incl 32bit ethernet CRC */ + char *p = info->result; + + total = (info->stopped_at.tv_sec - info->started_at.tv_sec) * 1000000ull + + info->stopped_at.tv_usec - info->started_at.tv_usec; + + BUG_ON(cpu_speed == 0); + + idle = info->idle_acc; + do_div(idle, cpu_speed); + + p += sprintf(p, "OK: %llu(c%llu+d%lu) usec, %llu (%dbyte,%dfrags)\n", + total, total - idle, idle, + info->sofar, size, nr_frags); + + pps = info->sofar * USEC_PER_SEC; + + while ((total >> 32) != 0) { + pps >>= 1; + total >>= 1; + } + + do_div(pps, total); + + bps = pps * 8 * size; + + mbps = bps; + do_div(mbps, 1000000); + p += sprintf(p, " %llupps %lluMb/sec (%llubps) errors: %llu", + pps, mbps, bps, info->errors); +} static void inject(struct pktgen_info* info) { - struct net_device *odev = NULL; + struct net_device *odev; struct sk_buff *skb = NULL; - __u64 total = 0; - __u64 idle = 0; __u64 lcount = 0; - int nr_frags = 0; + int ret; int last_ok = 1; /* Was last skb sent? * Or a failed transmit of some sort? This will keep * sequence numbers in order, for example. @@ -632,28 +668,30 @@ } } - nr_frags = skb_shinfo(skb)->nr_frags; - if (!(odev->features & NETIF_F_LLTX)) spin_lock_bh(&odev->xmit_lock); if (!netif_queue_stopped(odev)) { atomic_inc(&skb->users); - if (odev->hard_start_xmit(skb, odev)) { - + retry: + ret = odev->hard_start_xmit(skb, odev); + if (likely(ret == NETDEV_TX_OK)) { + last_ok = 1; + info->sofar++; + info->seq_num++; + } else if (ret == NETDEV_TX_LOCKED + && (odev->features & NETIF_F_LLTX)) { + cpu_relax(); + goto retry; + } else { atomic_dec(&skb->users); - if (net_ratelimit()) { + if (debug && net_ratelimit()) { printk(KERN_INFO "Hard xmit error\n"); } info->errors++; last_ok = 0; } - else { - last_ok = 1; - info->sofar++; - info->seq_num++; - } } else { /* Re-try it next time */ @@ -725,38 +763,7 @@ do_gettimeofday(&(info->stopped_at)); - total = (info->stopped_at.tv_sec - info->started_at.tv_sec) * 1000000 + - info->stopped_at.tv_usec - info->started_at.tv_usec; - - idle = (__u32)(info->idle_acc)/(__u32)(cpu_speed); - - { - char *p = info->result; - __u64 bps, pps = 0; - - if (total > 1000) - pps = (__u32)(info->sofar * 1000) / ((__u32)(total) / 1000); - else if(total > 100) - pps = (__u32)(info->sofar * 10000) / ((__u32)(total) / 100); - else if(total > 10) - pps = (__u32)(info->sofar * 100000) / ((__u32)(total) / 10); - else if(total > 1) - pps = (__u32)(info->sofar * 1000000) / (__u32)total; - - bps = pps * 8 * (info->pkt_size + 4); /* take 32bit ethernet CRC into account */ - p += sprintf(p, "OK: %llu(c%llu+d%llu) usec, %llu (%dbyte,%dfrags) %llupps %lluMb/sec (%llubps) errors: %llu", - (unsigned long long) total, - (unsigned long long) (total - idle), - (unsigned long long) idle, - (unsigned long long) info->sofar, - skb->len + 4, /* Add 4 to account for the ethernet checksum */ - nr_frags, - (unsigned long long) pps, - (unsigned long long) (bps / (u64) 1024 / (u64) 1024), - (unsigned long long) bps, - (unsigned long long) info->errors - ); - } + show_results(info, skb_shinfo(skb)->nr_frags); kfree_skb(skb); diff -Nru a/net/core/rtnetlink.c b/net/core/rtnetlink.c --- a/net/core/rtnetlink.c 2004-09-26 10:25:57 -07:00 +++ b/net/core/rtnetlink.c 2004-09-26 10:25:57 -07:00 @@ -182,7 +182,7 @@ } if (1) { - struct ifmap map = { + struct rtnl_link_ifmap map = { .mem_start = dev->mem_start, .mem_end = dev->mem_end, .base_addr = dev->base_addr, @@ -277,6 +277,9 @@ dev_change_flags(dev, ifm->ifi_flags); if (ida[IFLA_MAP - 1]) { + struct rtnl_link_ifmap *u_map; + struct ifmap k_map; + if (!dev->set_config) { err = -EOPNOTSUPP; goto out; @@ -287,11 +290,19 @@ goto out; } - if (ida[IFLA_MAP - 1]->rta_len != RTA_LENGTH(sizeof(struct ifmap))) + if (ida[IFLA_MAP - 1]->rta_len != RTA_LENGTH(sizeof(*u_map))) goto out; - - err = dev->set_config(dev, (struct ifmap *) - RTA_DATA(ida[IFLA_MAP - 1])); + + u_map = RTA_DATA(ida[IFLA_MAP - 1]); + + k_map.mem_start = (unsigned long) u_map->mem_start; + k_map.mem_end = (unsigned long) u_map->mem_end; + k_map.base_addr = (unsigned short) u_map->base_addr; + k_map.irq = (unsigned char) u_map->irq; + k_map.dma = (unsigned char) u_map->dma; + k_map.port = (unsigned char) u_map->port; + + err = dev->set_config(dev, &k_map); if (err) goto out; diff -Nru a/net/core/skbuff.c b/net/core/skbuff.c --- a/net/core/skbuff.c 2004-09-26 10:25:57 -07:00 +++ b/net/core/skbuff.c 2004-09-26 10:25:57 -07:00 @@ -311,6 +311,7 @@ C(nfcache); C(nfct); nf_conntrack_get(skb->nfct); + C(nfctinfo); #ifdef CONFIG_NETFILTER_DEBUG C(nf_debug); #endif @@ -377,6 +378,7 @@ new->nfcache = old->nfcache; new->nfct = old->nfct; nf_conntrack_get(old->nfct); + new->nfctinfo = old->nfctinfo; #ifdef CONFIG_NETFILTER_DEBUG new->nf_debug = old->nf_debug; #endif diff -Nru a/net/core/sock.c b/net/core/sock.c --- a/net/core/sock.c 2004-09-26 10:25:57 -07:00 +++ b/net/core/sock.c 2004-09-26 10:25:57 -07:00 @@ -1343,6 +1343,27 @@ EXPORT_SYMBOL(sk_common_release); +int sk_alloc_slab(struct proto *prot, char *name) +{ + prot->slab = kmem_cache_create(name, + prot->slab_obj_size, 0, + SLAB_HWCACHE_ALIGN, NULL, NULL); + + return prot->slab != NULL ? 0 : -ENOBUFS; +} + +EXPORT_SYMBOL(sk_alloc_slab); + +void sk_free_slab(struct proto *prot) +{ + if (prot->slab != NULL) { + kmem_cache_destroy(prot->slab); + prot->slab = NULL; + } +} + +EXPORT_SYMBOL(sk_free_slab); + EXPORT_SYMBOL(__lock_sock); EXPORT_SYMBOL(__release_sock); EXPORT_SYMBOL(sk_alloc); diff -Nru a/net/ipv4/Kconfig b/net/ipv4/Kconfig --- a/net/ipv4/Kconfig 2004-09-26 10:25:57 -07:00 +++ b/net/ipv4/Kconfig 2004-09-26 10:25:57 -07:00 @@ -60,12 +60,8 @@ Normally, a router decides what to do with a received packet based solely on the packet's final destination address. If you say Y here, the Linux router will also be able to take the packet's source - address into account. Furthermore, if you also say Y to "Use TOS - value as routing key" below, the TOS (Type-Of-Service) field of the - packet can be used for routing decisions as well. In addition, if - you say Y here and to "Fast network address translation" below, - the router will also be able to modify source and destination - addresses of forwarded packets. + address into account. Furthermore, the TOS (Type-Of-Service) field + of the packet can be used for routing decisions as well. If you are interested in this, please see the preliminary documentation at @@ -93,16 +89,6 @@ for those packets. The router considers all these paths to be of equal "cost" and chooses one of them in a non-deterministic fashion if a matching packet arrives. - -config IP_ROUTE_TOS - bool "IP: use TOS value as routing key" - depends on IP_ADVANCED_ROUTER - help - The header of every IP packet carries a TOS (Type Of Service) value - with which the packet requests a certain treatment, e.g. low - latency (for interactive traffic), high throughput, or high - reliability. If you say Y here, you will be able to specify - different routes for packets with different TOS values. config IP_ROUTE_VERBOSE bool "IP: verbose route monitoring" diff -Nru a/net/ipv4/Makefile b/net/ipv4/Makefile --- a/net/ipv4/Makefile 2004-09-26 10:25:55 -07:00 +++ b/net/ipv4/Makefile 2004-09-26 10:25:55 -07:00 @@ -11,7 +11,6 @@ obj-$(CONFIG_PROC_FS) += proc.o obj-$(CONFIG_IP_MULTIPLE_TABLES) += fib_rules.o -obj-$(CONFIG_IP_ROUTE_NAT) += ip_nat_dumb.o obj-$(CONFIG_IP_MROUTE) += ipmr.o obj-$(CONFIG_NET_IPIP) += ipip.o obj-$(CONFIG_NET_IPGRE) += ip_gre.o diff -Nru a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c --- a/net/ipv4/af_inet.c 2004-09-26 10:25:55 -07:00 +++ b/net/ipv4/af_inet.c 2004-09-26 10:25:55 -07:00 @@ -121,11 +121,6 @@ extern void ip_mc_drop_socket(struct sock *sk); -/* Per protocol sock slabcache */ -kmem_cache_t *tcp_sk_cachep; -static kmem_cache_t *udp_sk_cachep; -static kmem_cache_t *raw4_sk_cachep; - /* The inetsw table contains everything that inet_create needs to * build a new socket. */ @@ -228,28 +223,6 @@ return err; } -static __inline__ kmem_cache_t *inet_sk_slab(int protocol) -{ - kmem_cache_t* rc = tcp_sk_cachep; - - if (protocol == IPPROTO_UDP) - rc = udp_sk_cachep; - else if (protocol == IPPROTO_RAW) - rc = raw4_sk_cachep; - return rc; -} - -static __inline__ int inet_sk_size(int protocol) -{ - int rc = sizeof(struct tcp_sock); - - if (protocol == IPPROTO_UDP) - rc = sizeof(struct udp_sock); - else if (protocol == IPPROTO_RAW) - rc = sizeof(struct raw_sock); - return rc; -} - /* * Create an inet socket. */ @@ -260,13 +233,12 @@ struct list_head *p; struct inet_protosw *answer; struct inet_opt *inet; - int err = -ENOBUFS; + struct proto *answer_prot; + unsigned char answer_flags; + char answer_no_check; + int err; sock->state = SS_UNCONNECTED; - sk = sk_alloc(PF_INET, GFP_KERNEL, inet_sk_size(protocol), - inet_sk_slab(protocol)); - if (!sk) - goto out; /* Look for the requested type/protocol pair. */ answer = NULL; @@ -292,21 +264,35 @@ err = -ESOCKTNOSUPPORT; if (!answer) - goto out_sk_free; + goto out_rcu_unlock; err = -EPERM; if (answer->capability > 0 && !capable(answer->capability)) - goto out_sk_free; + goto out_rcu_unlock; err = -EPROTONOSUPPORT; if (!protocol) - goto out_sk_free; - err = 0; + goto out_rcu_unlock; + sock->ops = answer->ops; - sk->sk_prot = answer->prot; - sk->sk_no_check = answer->no_check; - if (INET_PROTOSW_REUSE & answer->flags) - sk->sk_reuse = 1; + answer_prot = answer->prot; + answer_no_check = answer->no_check; + answer_flags = answer->flags; rcu_read_unlock(); + BUG_TRAP(answer_prot->slab != NULL); + + err = -ENOBUFS; + sk = sk_alloc(PF_INET, GFP_KERNEL, + answer_prot->slab_obj_size, + answer_prot->slab); + if (sk == NULL) + goto out; + + err = 0; + sk->sk_prot = answer_prot; + sk->sk_no_check = answer_no_check; + if (INET_PROTOSW_REUSE & answer_flags) + sk->sk_reuse = 1; + inet = inet_sk(sk); if (SOCK_RAW == sock->type) { @@ -359,9 +345,8 @@ } out: return err; -out_sk_free: +out_rcu_unlock: rcu_read_unlock(); - sk_free(sk); goto out; } @@ -1010,24 +995,29 @@ struct sk_buff *dummy_skb; struct inet_protosw *q; struct list_head *r; + int rc = -EINVAL; if (sizeof(struct inet_skb_parm) > sizeof(dummy_skb->cb)) { printk(KERN_CRIT "%s: panic\n", __FUNCTION__); - return -EINVAL; + goto out; + } + + rc = sk_alloc_slab(&tcp_prot, "tcp_sock"); + if (rc) { + sk_alloc_slab_error(&tcp_prot); + goto out; + } + rc = sk_alloc_slab(&udp_prot, "udp_sock"); + if (rc) { + sk_alloc_slab_error(&udp_prot); + goto out_tcp_free_slab; + } + rc = sk_alloc_slab(&raw_prot, "raw_sock"); + if (rc) { + sk_alloc_slab_error(&raw_prot); + goto out_udp_free_slab; } - tcp_sk_cachep = kmem_cache_create("tcp_sock", - sizeof(struct tcp_sock), 0, - SLAB_HWCACHE_ALIGN, NULL, NULL); - udp_sk_cachep = kmem_cache_create("udp_sock", - sizeof(struct udp_sock), 0, - SLAB_HWCACHE_ALIGN, NULL, NULL); - raw4_sk_cachep = kmem_cache_create("raw4_sock", - sizeof(struct raw_sock), 0, - SLAB_HWCACHE_ALIGN, NULL, NULL); - if (!tcp_sk_cachep || !udp_sk_cachep || !raw4_sk_cachep) - printk(KERN_CRIT - "inet_init: Can't create protocol sock SLAB caches!\n"); /* * Tell SOCKET that we are alive... */ @@ -1097,7 +1087,14 @@ ipfrag_init(); - return 0; + rc = 0; +out: + return rc; +out_tcp_free_slab: + sk_free_slab(&tcp_prot); +out_udp_free_slab: + sk_free_slab(&udp_prot); + goto out; } module_init(inet_init); diff -Nru a/net/ipv4/arp.c b/net/ipv4/arp.c --- a/net/ipv4/arp.c 2004-09-26 10:25:57 -07:00 +++ b/net/ipv4/arp.c 2004-09-26 10:25:57 -07:00 @@ -914,7 +914,7 @@ if (arp->ar_op != htons(ARPOP_REPLY) || skb->pkt_type != PACKET_HOST) state = NUD_STALE; - neigh_update(n, sha, state, override, 1); + neigh_update(n, sha, state, override ? NEIGH_UPDATE_F_OVERRIDE : 0); neigh_release(n); } @@ -1021,7 +1021,9 @@ if (r->arp_flags & ATF_PERM) state = NUD_PERMANENT; err = neigh_update(neigh, (r->arp_flags&ATF_COM) ? - r->arp_ha.sa_data : NULL, state, 1, 0); + r->arp_ha.sa_data : NULL, state, + NEIGH_UPDATE_F_OVERRIDE| + NEIGH_UPDATE_F_ADMIN); neigh_release(neigh); } return err; @@ -1101,7 +1103,9 @@ neigh = neigh_lookup(&arp_tbl, &ip, dev); if (neigh) { if (neigh->nud_state&~NUD_NOARP) - err = neigh_update(neigh, NULL, NUD_FAILED, 1, 0); + err = neigh_update(neigh, NULL, NUD_FAILED, + NEIGH_UPDATE_F_OVERRIDE| + NEIGH_UPDATE_F_ADMIN); neigh_release(neigh); } return err; diff -Nru a/net/ipv4/fib_hash.c b/net/ipv4/fib_hash.c --- a/net/ipv4/fib_hash.c 2004-09-26 10:25:56 -07:00 +++ b/net/ipv4/fib_hash.c 2004-09-26 10:25:56 -07:00 @@ -43,159 +43,115 @@ #include #include -#define FTprint(a...) -/* - printk(KERN_DEBUG a) - */ - -static kmem_cache_t * fn_hash_kmem; - -/* - These bizarre types are just to force strict type checking. - When I reversed order of bytes and changed to natural mask lengths, - I forgot to make fixes in several places. Now I am lazy to return - it back. - */ +static kmem_cache_t *fn_hash_kmem; +static kmem_cache_t *fn_alias_kmem; -typedef struct { - u32 datum; -} fn_key_t; - -typedef struct { - u32 datum; -} fn_hash_idx_t; - -struct fib_node -{ - struct fib_node *fn_next; - struct fib_info *fn_info; -#define FIB_INFO(f) ((f)->fn_info) - fn_key_t fn_key; - u8 fn_tos; - u8 fn_type; - u8 fn_scope; - u8 fn_state; +struct fib_node { + struct hlist_node fn_hash; + struct list_head fn_alias; + u32 fn_key; }; -#define FN_S_ZOMBIE 1 -#define FN_S_ACCESSED 2 - -static int fib_hash_zombies; - -struct fn_zone -{ - struct fn_zone *fz_next; /* Next not empty zone */ - struct fib_node **fz_hash; /* Hash table pointer */ - int fz_nent; /* Number of entries */ +struct fib_alias { + struct list_head fa_list; + struct fib_info *fa_info; + u8 fa_tos; + u8 fa_type; + u8 fa_scope; + u8 fa_state; +}; - int fz_divisor; /* Hash divisor */ - u32 fz_hashmask; /* (fz_divisor - 1) */ -#define FZ_HASHMASK(fz) ((fz)->fz_hashmask) +#define FN_S_ACCESSED 1 - int fz_order; /* Zone order */ - u32 fz_mask; -#define FZ_MASK(fz) ((fz)->fz_mask) +struct fn_zone { + struct fn_zone *fz_next; /* Next not empty zone */ + struct hlist_head *fz_hash; /* Hash table pointer */ + int fz_nent; /* Number of entries */ + + int fz_divisor; /* Hash divisor */ + u32 fz_hashmask; /* (fz_divisor - 1) */ +#define FZ_HASHMASK(fz) ((fz)->fz_hashmask) + + int fz_order; /* Zone order */ + u32 fz_mask; +#define FZ_MASK(fz) ((fz)->fz_mask) }; /* NOTE. On fast computers evaluation of fz_hashmask and fz_mask - can be cheaper than memory lookup, so that FZ_* macros are used. + * can be cheaper than memory lookup, so that FZ_* macros are used. */ -struct fn_hash -{ +struct fn_hash { struct fn_zone *fn_zones[33]; struct fn_zone *fn_zone_list; }; -static __inline__ fn_hash_idx_t fn_hash(fn_key_t key, struct fn_zone *fz) +static inline u32 fn_hash(u32 key, struct fn_zone *fz) { - u32 h = ntohl(key.datum)>>(32 - fz->fz_order); + u32 h = ntohl(key)>>(32 - fz->fz_order); h ^= (h>>20); h ^= (h>>10); h ^= (h>>5); h &= FZ_HASHMASK(fz); - return *(fn_hash_idx_t*)&h; -} - -#define fz_key_0(key) ((key).datum = 0) -#define fz_prefix(key,fz) ((key).datum) - -static __inline__ fn_key_t fz_key(u32 dst, struct fn_zone *fz) -{ - fn_key_t k; - k.datum = dst & FZ_MASK(fz); - return k; -} - -static __inline__ struct fib_node ** fz_chain_p(fn_key_t key, struct fn_zone *fz) -{ - return &fz->fz_hash[fn_hash(key, fz).datum]; -} - -static __inline__ struct fib_node * fz_chain(fn_key_t key, struct fn_zone *fz) -{ - return fz->fz_hash[fn_hash(key, fz).datum]; -} - -static __inline__ int fn_key_eq(fn_key_t a, fn_key_t b) -{ - return a.datum == b.datum; + return h; } -static __inline__ int fn_key_leq(fn_key_t a, fn_key_t b) +static inline u32 fz_key(u32 dst, struct fn_zone *fz) { - return a.datum <= b.datum; + return dst & FZ_MASK(fz); } static rwlock_t fib_hash_lock = RW_LOCK_UNLOCKED; -#define FZ_MAX_DIVISOR ((PAGE_SIZE<fn_next; - for (fp = fz_chain_p(f->fn_key, fz); - *fp && fn_key_leq((*fp)->fn_key, f->fn_key); - fp = &(*fp)->fn_next) - /* NONE */; - f->fn_next = *fp; - *fp = f; + for (i = 0; i < old_divisor; i++) { + struct hlist_node *node, *n; + struct fib_node *f; + + hlist_for_each_entry_safe(f, node, n, &old_ht[i], fn_hash) { + struct hlist_head *new_head; + + hlist_del(&f->fn_hash); + + new_head = &fz->fz_hash[fn_hash(f->fn_key, fz)]; + hlist_add_head(&f->fn_hash, new_head); } } } -static void fz_hash_free(struct fib_node **hash, int divisor) +static void fz_hash_free(struct hlist_head *hash, int divisor) { - if (divisor <= 1024) + unsigned long size = divisor * sizeof(struct hlist_head); + + if (size <= PAGE_SIZE) kfree(hash); else - free_pages((unsigned long) hash, - get_order(divisor * sizeof(struct fib_node *))); + free_pages((unsigned long)hash, get_order(size)); } static void fn_rehash_zone(struct fn_zone *fz) { - struct fib_node **ht, **old_ht; + struct hlist_head *ht, *old_ht; int old_divisor, new_divisor; u32 new_hashmask; @@ -226,7 +182,7 @@ ht = fz_hash_alloc(new_divisor); if (ht) { - memset(ht, 0, new_divisor*sizeof(struct fib_node*)); + memset(ht, 0, new_divisor * sizeof(struct hlist_head)); write_lock_bh(&fib_hash_lock); old_ht = fz->fz_hash; @@ -240,12 +196,16 @@ } } -static void fn_free_node(struct fib_node * f) +static inline void fn_free_node(struct fib_node * f) { - fib_release_info(FIB_INFO(f)); kmem_cache_free(fn_hash_kmem, f); } +static inline void fn_free_alias(struct fib_alias *fa) +{ + fib_release_info(fa->fa_info); + kmem_cache_free(fn_alias_kmem, fa); +} static struct fn_zone * fn_new_zone(struct fn_hash *table, int z) @@ -267,7 +227,7 @@ kfree(fz); return NULL; } - memset(fz->fz_hash, 0, fz->fz_divisor*sizeof(struct fib_node*)); + memset(fz->fz_hash, 0, fz->fz_divisor * sizeof(struct hlist_head *)); fz->fz_order = z; fz->fz_mask = inet_make_mask(z); @@ -298,36 +258,39 @@ read_lock(&fib_hash_lock); for (fz = t->fn_zone_list; fz; fz = fz->fz_next) { + struct hlist_head *head; + struct hlist_node *node; struct fib_node *f; - fn_key_t k = fz_key(flp->fl4_dst, fz); + u32 k = fz_key(flp->fl4_dst, fz); - for (f = fz_chain(k, fz); f; f = f->fn_next) { - if (!fn_key_eq(k, f->fn_key)) { - if (fn_key_leq(k, f->fn_key)) - break; - else - continue; - } -#ifdef CONFIG_IP_ROUTE_TOS - if (f->fn_tos && f->fn_tos != flp->fl4_tos) - continue; -#endif - f->fn_state |= FN_S_ACCESSED; + head = &fz->fz_hash[fn_hash(k, fz)]; + hlist_for_each_entry(f, node, head, fn_hash) { + struct fib_alias *fa; - if (f->fn_state&FN_S_ZOMBIE) - continue; - if (f->fn_scope < flp->fl4_scope) + if (f->fn_key != k) continue; - err = fib_semantic_match(f->fn_type, FIB_INFO(f), flp, res); - if (err == 0) { - res->type = f->fn_type; - res->scope = f->fn_scope; - res->prefixlen = fz->fz_order; - goto out; + list_for_each_entry(fa, &f->fn_alias, fa_list) { + if (fa->fa_tos && + fa->fa_tos != flp->fl4_tos) + continue; + if (fa->fa_scope < flp->fl4_scope) + continue; + + fa->fa_state |= FN_S_ACCESSED; + + err = fib_semantic_match(fa->fa_type, + fa->fa_info, + flp, res); + if (err == 0) { + res->type = fa->fa_type; + res->scope = fa->fa_scope; + res->prefixlen = fz->fz_order; + goto out; + } + if (err < 0) + goto out; } - if (err < 0) - goto out; } } err = 1; @@ -365,6 +328,7 @@ fn_hash_select_default(struct fib_table *tb, const struct flowi *flp, struct fib_result *res) { int order, last_idx; + struct hlist_node *node; struct fib_node *f; struct fib_info *fi = NULL; struct fib_info *last_resort; @@ -379,36 +343,41 @@ order = -1; read_lock(&fib_hash_lock); - for (f = fz->fz_hash[0]; f; f = f->fn_next) { - struct fib_info *next_fi = FIB_INFO(f); + hlist_for_each_entry(f, node, &fz->fz_hash[0], fn_hash) { + struct fib_alias *fa; - if ((f->fn_state&FN_S_ZOMBIE) || - f->fn_scope != res->scope || - f->fn_type != RTN_UNICAST) - continue; + list_for_each_entry(fa, &f->fn_alias, fa_list) { + struct fib_info *next_fi = fa->fa_info; - if (next_fi->fib_priority > res->fi->fib_priority) - break; - if (!next_fi->fib_nh[0].nh_gw || next_fi->fib_nh[0].nh_scope != RT_SCOPE_LINK) - continue; - f->fn_state |= FN_S_ACCESSED; + if (fa->fa_scope != res->scope || + fa->fa_type != RTN_UNICAST) + continue; - if (fi == NULL) { - if (next_fi != res->fi) + if (next_fi->fib_priority > res->fi->fib_priority) break; - } else if (!fib_detect_death(fi, order, &last_resort, &last_idx)) { - if (res->fi) - fib_info_put(res->fi); - res->fi = fi; - atomic_inc(&fi->fib_clntref); - fn_hash_last_dflt = order; - goto out; + if (!next_fi->fib_nh[0].nh_gw || + next_fi->fib_nh[0].nh_scope != RT_SCOPE_LINK) + continue; + fa->fa_state |= FN_S_ACCESSED; + + if (fi == NULL) { + if (next_fi != res->fi) + break; + } else if (!fib_detect_death(fi, order, &last_resort, + &last_idx)) { + if (res->fi) + fib_info_put(res->fi); + res->fi = fi; + atomic_inc(&fi->fib_clntref); + fn_hash_last_dflt = order; + goto out; + } + fi = next_fi; + order++; } - fi = next_fi; - order++; } - if (order<=0 || fi==NULL) { + if (order <= 0 || fi == NULL) { fn_hash_last_dflt = -1; goto out; } @@ -434,52 +403,78 @@ read_unlock(&fib_hash_lock); } -#define FIB_SCAN(f, fp) \ -for ( ; ((f) = *(fp)) != NULL; (fp) = &(f)->fn_next) +static void rtmsg_fib(int, struct fib_node *, struct fib_alias *, + int, int, + struct nlmsghdr *n, + struct netlink_skb_parms *); + +/* Insert node F to FZ. */ +static inline void fib_insert_node(struct fn_zone *fz, struct fib_node *f) +{ + struct hlist_head *head = &fz->fz_hash[fn_hash(f->fn_key, fz)]; -#define FIB_SCAN_KEY(f, fp, key) \ -for ( ; ((f) = *(fp)) != NULL && fn_key_eq((f)->fn_key, (key)); (fp) = &(f)->fn_next) + hlist_add_head(&f->fn_hash, head); +} -#ifndef CONFIG_IP_ROUTE_TOS -#define FIB_SCAN_TOS(f, fp, key, tos) FIB_SCAN_KEY(f, fp, key) -#else -#define FIB_SCAN_TOS(f, fp, key, tos) \ -for ( ; ((f) = *(fp)) != NULL && fn_key_eq((f)->fn_key, (key)) && \ - (f)->fn_tos == (tos) ; (fp) = &(f)->fn_next) -#endif +/* Return the node in FZ matching KEY. */ +static struct fib_node *fib_find_node(struct fn_zone *fz, u32 key) +{ + struct hlist_head *head = &fz->fz_hash[fn_hash(key, fz)]; + struct hlist_node *node; + struct fib_node *f; + hlist_for_each_entry(f, node, head, fn_hash) { + if (f->fn_key == key) + return f; + } -static void rtmsg_fib(int, struct fib_node*, int, int, - struct nlmsghdr *n, - struct netlink_skb_parms *); + return NULL; +} + +/* Return the first fib alias matching TOS with + * priority less than or equal to PRIO. + */ +static struct fib_alias *fib_find_alias(struct fib_node *fn, u8 tos, u32 prio) +{ + if (fn) { + struct list_head *head = &fn->fn_alias; + struct fib_alias *fa, *prev_fa; + + prev_fa = NULL; + list_for_each_entry(fa, head, fa_list) { + if (fa->fa_tos != tos) + continue; + prev_fa = fa; + if (prio <= fa->fa_info->fib_priority) + break; + } + return prev_fa; + } + return NULL; +} static int fn_hash_insert(struct fib_table *tb, struct rtmsg *r, struct kern_rta *rta, - struct nlmsghdr *n, struct netlink_skb_parms *req) + struct nlmsghdr *n, struct netlink_skb_parms *req) { - struct fn_hash *table = (struct fn_hash*)tb->tb_data; - struct fib_node *new_f, *f, **fp, **del_fp; + struct fn_hash *table = (struct fn_hash *) tb->tb_data; + struct fib_node *new_f, *f; + struct fib_alias *fa, *new_fa; struct fn_zone *fz; struct fib_info *fi; - int z = r->rtm_dst_len; int type = r->rtm_type; -#ifdef CONFIG_IP_ROUTE_TOS u8 tos = r->rtm_tos; -#endif - fn_key_t key; + u32 key; int err; -FTprint("tb(%d)_insert: %d %08x/%d %d %08x\n", tb->tb_id, r->rtm_type, rta->rta_dst ? -*(u32*)rta->rta_dst : 0, z, rta->rta_oif ? *rta->rta_oif : -1, -rta->rta_prefsrc ? *(u32*)rta->rta_prefsrc : 0); if (z > 32) return -EINVAL; fz = table->fn_zones[z]; if (!fz && !(fz = fn_new_zone(table, z))) return -ENOBUFS; - fz_key_0(key); + key = 0; if (rta->rta_dst) { u32 dst; memcpy(&dst, rta->rta_dst, 4); @@ -496,136 +491,113 @@ (z==32 || (1< fz->fz_divisor)) fn_rehash_zone(fz); - fp = fz_chain_p(key, fz); - - - /* - * Scan list to find the first route with the same destination - */ - FIB_SCAN(f, fp) { - if (fn_key_leq(key,f->fn_key)) - break; - } - -#ifdef CONFIG_IP_ROUTE_TOS - /* - * Find route with the same destination and tos. - */ - FIB_SCAN_KEY(f, fp, key) { - if (f->fn_tos <= tos) - break; - } -#endif - - del_fp = NULL; - - if (f && (f->fn_state&FN_S_ZOMBIE) && -#ifdef CONFIG_IP_ROUTE_TOS - f->fn_tos == tos && -#endif - fn_key_eq(f->fn_key, key)) { - del_fp = fp; - fp = &f->fn_next; - f = *fp; - goto create; - } + f = fib_find_node(fz, key); + fa = fib_find_alias(f, tos, fi->fib_priority); - FIB_SCAN_TOS(f, fp, key, tos) { - if (fi->fib_priority <= FIB_INFO(f)->fib_priority) - break; - } - - /* Now f==*fp points to the first node with the same - keys [prefix,tos,priority], if such key already - exists or to the node, before which we will insert new one. + /* Now fa, if non-NULL, points to the first fib alias + * with the same keys [prefix,tos,priority], if such key already + * exists or to the node before which we will insert new one. + * + * If fa is NULL, we will need to allocate a new one and + * insert to the head of f. + * + * If f is NULL, no fib node matched the destination key + * and we need to allocate a new one of those as well. */ - if (f && -#ifdef CONFIG_IP_ROUTE_TOS - f->fn_tos == tos && -#endif - fn_key_eq(f->fn_key, key) && - fi->fib_priority == FIB_INFO(f)->fib_priority) { - struct fib_node **ins_fp; + if (fa && + fa->fa_info->fib_priority == fi->fib_priority) { + struct fib_alias *fa_orig; err = -EEXIST; - if (n->nlmsg_flags&NLM_F_EXCL) + if (n->nlmsg_flags & NLM_F_EXCL) goto out; - if (n->nlmsg_flags&NLM_F_REPLACE) { - del_fp = fp; - fp = &f->fn_next; - f = *fp; - goto replace; - } + if (n->nlmsg_flags & NLM_F_REPLACE) { + struct fib_info *fi_drop; + u8 state; - ins_fp = fp; - err = -EEXIST; + write_lock_bh(&fib_hash_lock); + fi_drop = fa->fa_info; + fa->fa_info = fi; + fa->fa_type = type; + fa->fa_scope = r->rtm_scope; + state = fa->fa_state; + fa->fa_state &= ~FN_S_ACCESSED; + write_unlock_bh(&fib_hash_lock); - FIB_SCAN_TOS(f, fp, key, tos) { - if (fi->fib_priority != FIB_INFO(f)->fib_priority) - break; - if (f->fn_type == type && f->fn_scope == r->rtm_scope - && FIB_INFO(f) == fi) - goto out; + fib_release_info(fi_drop); + if (state & FN_S_ACCESSED) + rt_cache_flush(-1); + return 0; } - if (!(n->nlmsg_flags&NLM_F_APPEND)) { - fp = ins_fp; - f = *fp; + /* Error if we find a perfect match which + * uses the same scope, type, and nexthop + * information. + */ + fa_orig = fa; + list_for_each_entry(fa, fa_orig->fa_list.prev, fa_list) { + if (fa->fa_tos != tos) + break; + if (fa->fa_info->fib_priority != fi->fib_priority) + break; + if (fa->fa_type == type && + fa->fa_scope == r->rtm_scope && + fa->fa_info == fi) + goto out; } + if (!(n->nlmsg_flags & NLM_F_APPEND)) + fa = fa_orig; } -create: err = -ENOENT; if (!(n->nlmsg_flags&NLM_F_CREATE)) goto out; -replace: err = -ENOBUFS; - new_f = kmem_cache_alloc(fn_hash_kmem, SLAB_KERNEL); - if (new_f == NULL) + new_fa = kmem_cache_alloc(fn_alias_kmem, SLAB_KERNEL); + if (new_fa == NULL) goto out; - memset(new_f, 0, sizeof(struct fib_node)); - - new_f->fn_key = key; -#ifdef CONFIG_IP_ROUTE_TOS - new_f->fn_tos = tos; -#endif - new_f->fn_type = type; - new_f->fn_scope = r->rtm_scope; - FIB_INFO(new_f) = fi; + new_f = NULL; + if (!f) { + new_f = kmem_cache_alloc(fn_hash_kmem, SLAB_KERNEL); + if (new_f == NULL) + goto out_free_new_fa; + + INIT_HLIST_NODE(&new_f->fn_hash); + INIT_LIST_HEAD(&new_f->fn_alias); + new_f->fn_key = key; + f = new_f; + } + + new_fa->fa_info = fi; + new_fa->fa_tos = tos; + new_fa->fa_type = type; + new_fa->fa_scope = r->rtm_scope; + new_fa->fa_state = 0; /* * Insert new entry to the list. */ - new_f->fn_next = f; write_lock_bh(&fib_hash_lock); - *fp = new_f; + if (new_f) + fib_insert_node(fz, new_f); + list_add(&new_fa->fa_list, + (fa ? &fa->fa_list : &f->fn_alias)); write_unlock_bh(&fib_hash_lock); - fz->fz_nent++; - if (del_fp) { - f = *del_fp; - /* Unlink replaced node */ - write_lock_bh(&fib_hash_lock); - *del_fp = f->fn_next; - write_unlock_bh(&fib_hash_lock); + if (new_f) + fz->fz_nent++; + rt_cache_flush(-1); - if (!(f->fn_state&FN_S_ZOMBIE)) - rtmsg_fib(RTM_DELROUTE, f, z, tb->tb_id, n, req); - if (f->fn_state&FN_S_ACCESSED) - rt_cache_flush(-1); - fn_free_node(f); - fz->fz_nent--; - } else { - rt_cache_flush(-1); - } - rtmsg_fib(RTM_NEWROUTE, new_f, z, tb->tb_id, n, req); + rtmsg_fib(RTM_NEWROUTE, f, new_fa, z, tb->tb_id, n, req); return 0; +out_free_new_fa: + kmem_cache_free(fn_alias_kmem, new_fa); out: fib_release_info(fi); return err; @@ -634,26 +606,23 @@ static int fn_hash_delete(struct fib_table *tb, struct rtmsg *r, struct kern_rta *rta, - struct nlmsghdr *n, struct netlink_skb_parms *req) + struct nlmsghdr *n, struct netlink_skb_parms *req) { struct fn_hash *table = (struct fn_hash*)tb->tb_data; - struct fib_node **fp, **del_fp, *f; + struct fib_node *f; + struct fib_alias *fa, *fa_to_delete; + struct list_head *fa_head; int z = r->rtm_dst_len; struct fn_zone *fz; - fn_key_t key; - int matched; -#ifdef CONFIG_IP_ROUTE_TOS + u32 key; u8 tos = r->rtm_tos; -#endif -FTprint("tb(%d)_delete: %d %08x/%d %d\n", tb->tb_id, r->rtm_type, rta->rta_dst ? - *(u32*)rta->rta_dst : 0, z, rta->rta_oif ? *rta->rta_oif : -1); if (z > 32) return -EINVAL; if ((fz = table->fn_zones[z]) == NULL) return -ESRCH; - fz_key_0(key); + key = 0; if (rta->rta_dst) { u32 dst; memcpy(&dst, rta->rta_dst, 4); @@ -662,62 +631,52 @@ key = fz_key(dst, fz); } - fp = fz_chain_p(key, fz); + f = fib_find_node(fz, key); + fa = fib_find_alias(f, tos, 0); + if (!fa) + return -ESRCH; + fa_to_delete = NULL; + fa_head = fa->fa_list.prev; + list_for_each_entry(fa, fa_head, fa_list) { + struct fib_info *fi = fa->fa_info; - FIB_SCAN(f, fp) { - if (fn_key_eq(f->fn_key, key)) + if (fa->fa_tos != tos) break; - if (fn_key_leq(key, f->fn_key)) { - return -ESRCH; - } - } -#ifdef CONFIG_IP_ROUTE_TOS - FIB_SCAN_KEY(f, fp, key) { - if (f->fn_tos == tos) - break; - } -#endif - - matched = 0; - del_fp = NULL; - FIB_SCAN_TOS(f, fp, key, tos) { - struct fib_info * fi = FIB_INFO(f); - if (f->fn_state&FN_S_ZOMBIE) { - return -ESRCH; + if ((!r->rtm_type || + fa->fa_type == r->rtm_type) && + (r->rtm_scope == RT_SCOPE_NOWHERE || + fa->fa_scope == r->rtm_scope) && + (!r->rtm_protocol || + fi->fib_protocol == r->rtm_protocol) && + fib_nh_match(r, n, rta, fi) == 0) { + fa_to_delete = fa; + break; } - matched++; - - if (del_fp == NULL && - (!r->rtm_type || f->fn_type == r->rtm_type) && - (r->rtm_scope == RT_SCOPE_NOWHERE || f->fn_scope == r->rtm_scope) && - (!r->rtm_protocol || fi->fib_protocol == r->rtm_protocol) && - fib_nh_match(r, n, rta, fi) == 0) - del_fp = fp; } - if (del_fp) { - f = *del_fp; - rtmsg_fib(RTM_DELROUTE, f, z, tb->tb_id, n, req); + if (fa_to_delete) { + int kill_fn; - if (matched != 1) { - write_lock_bh(&fib_hash_lock); - *del_fp = f->fn_next; - write_unlock_bh(&fib_hash_lock); + fa = fa_to_delete; + rtmsg_fib(RTM_DELROUTE, f, fa, z, tb->tb_id, n, req); - if (f->fn_state&FN_S_ACCESSED) - rt_cache_flush(-1); + kill_fn = 0; + write_lock_bh(&fib_hash_lock); + list_del(&fa->fa_list); + if (list_empty(&f->fn_alias)) { + hlist_del(&f->fn_hash); + kill_fn = 1; + } + write_unlock_bh(&fib_hash_lock); + + if (fa->fa_state & FN_S_ACCESSED) + rt_cache_flush(-1); + fn_free_alias(fa); + if (kill_fn) { fn_free_node(f); fz->fz_nent--; - } else { - f->fn_state |= FN_S_ZOMBIE; - if (f->fn_state&FN_S_ACCESSED) { - f->fn_state &= ~FN_S_ACCESSED; - rt_cache_flush(-1); - } - if (++fib_hash_zombies > 128) - fib_flush(); } return 0; @@ -725,74 +684,99 @@ return -ESRCH; } -static __inline__ int -fn_flush_list(struct fib_node ** fp, int z, struct fn_hash *table) +static int fn_flush_list(struct fn_zone *fz, int idx) { - int found = 0; + struct hlist_head *head = &fz->fz_hash[idx]; + struct hlist_node *node, *n; struct fib_node *f; + int found = 0; - while ((f = *fp) != NULL) { - struct fib_info *fi = FIB_INFO(f); - - if (fi && ((f->fn_state&FN_S_ZOMBIE) || (fi->fib_flags&RTNH_F_DEAD))) { - write_lock_bh(&fib_hash_lock); - *fp = f->fn_next; - write_unlock_bh(&fib_hash_lock); + hlist_for_each_entry_safe(f, node, n, head, fn_hash) { + struct fib_alias *fa, *fa_node; + int kill_f; + + kill_f = 0; + list_for_each_entry_safe(fa, fa_node, &f->fn_alias, fa_list) { + struct fib_info *fi = fa->fa_info; + + if (fi && (fi->fib_flags&RTNH_F_DEAD)) { + write_lock_bh(&fib_hash_lock); + list_del(&fa->fa_list); + if (list_empty(&f->fn_alias)) { + hlist_del(&f->fn_hash); + kill_f = 1; + } + write_unlock_bh(&fib_hash_lock); + fn_free_alias(fa); + found++; + } + } + if (kill_f) { fn_free_node(f); - found++; - continue; + fz->fz_nent--; } - fp = &f->fn_next; } return found; } static int fn_hash_flush(struct fib_table *tb) { - struct fn_hash *table = (struct fn_hash*)tb->tb_data; + struct fn_hash *table = (struct fn_hash *) tb->tb_data; struct fn_zone *fz; int found = 0; - fib_hash_zombies = 0; for (fz = table->fn_zone_list; fz; fz = fz->fz_next) { int i; - int tmp = 0; - for (i=fz->fz_divisor-1; i>=0; i--) - tmp += fn_flush_list(&fz->fz_hash[i], fz->fz_order, table); - fz->fz_nent -= tmp; - found += tmp; + + for (i = fz->fz_divisor - 1; i >= 0; i--) + found += fn_flush_list(fz, i); } return found; } -static __inline__ int +static inline int fn_hash_dump_bucket(struct sk_buff *skb, struct netlink_callback *cb, struct fib_table *tb, struct fn_zone *fz, - struct fib_node *f) + struct hlist_head *head) { + struct hlist_node *node; + struct fib_node *f; int i, s_i; s_i = cb->args[3]; - for (i=0; f; i++, f=f->fn_next) { - if (i < s_i) continue; - if (f->fn_state&FN_S_ZOMBIE) continue; - if (fib_dump_info(skb, NETLINK_CB(cb->skb).pid, cb->nlh->nlmsg_seq, - RTM_NEWROUTE, - tb->tb_id, (f->fn_state&FN_S_ZOMBIE) ? 0 : f->fn_type, f->fn_scope, - &f->fn_key, fz->fz_order, f->fn_tos, - f->fn_info) < 0) { - cb->args[3] = i; - return -1; + i = 0; + hlist_for_each_entry(f, node, head, fn_hash) { + struct fib_alias *fa; + + list_for_each_entry(fa, &f->fn_alias, fa_list) { + if (i < s_i) + continue; + + if (fib_dump_info(skb, NETLINK_CB(cb->skb).pid, + cb->nlh->nlmsg_seq, + RTM_NEWROUTE, + tb->tb_id, + fa->fa_type, + fa->fa_scope, + &f->fn_key, + fz->fz_order, + fa->fa_tos, + fa->fa_info) < 0) { + cb->args[3] = i; + return -1; + } + + i++; } } cb->args[3] = i; return skb->len; } -static __inline__ int +static inline int fn_hash_dump_zone(struct sk_buff *skb, struct netlink_callback *cb, struct fib_table *tb, struct fn_zone *fz) @@ -803,10 +787,12 @@ for (h=0; h < fz->fz_divisor; h++) { if (h < s_h) continue; if (h > s_h) - memset(&cb->args[3], 0, sizeof(cb->args) - 3*sizeof(cb->args[0])); - if (fz->fz_hash == NULL || fz->fz_hash[h] == NULL) + memset(&cb->args[3], 0, + sizeof(cb->args) - 3*sizeof(cb->args[0])); + if (fz->fz_hash == NULL || + hlist_empty(&fz->fz_hash[h])) continue; - if (fn_hash_dump_bucket(skb, cb, tb, fz, fz->fz_hash[h]) < 0) { + if (fn_hash_dump_bucket(skb, cb, tb, fz, &fz->fz_hash[h])<0) { cb->args[2] = h; return -1; } @@ -826,7 +812,8 @@ for (fz = table->fn_zone_list, m=0; fz; fz = fz->fz_next, m++) { if (m < s_m) continue; if (m > s_m) - memset(&cb->args[2], 0, sizeof(cb->args) - 2*sizeof(cb->args[0])); + memset(&cb->args[2], 0, + sizeof(cb->args) - 2*sizeof(cb->args[0])); if (fn_hash_dump_zone(skb, cb, tb, fz) < 0) { cb->args[1] = m; read_unlock(&fib_hash_lock); @@ -838,7 +825,8 @@ return skb->len; } -static void rtmsg_fib(int event, struct fib_node* f, int z, int tb_id, +static void rtmsg_fib(int event, struct fib_node *f, struct fib_alias *fa, + int z, int tb_id, struct nlmsghdr *n, struct netlink_skb_parms *req) { struct sk_buff *skb; @@ -850,8 +838,9 @@ return; if (fib_dump_info(skb, pid, n->nlmsg_seq, event, tb_id, - f->fn_type, f->fn_scope, &f->fn_key, z, f->fn_tos, - FIB_INFO(f)) < 0) { + fa->fa_type, fa->fa_scope, &f->fn_key, z, + fa->fa_tos, + fa->fa_info) < 0) { kfree_skb(skb); return; } @@ -877,7 +866,14 @@ 0, SLAB_HWCACHE_ALIGN, NULL, NULL); - tb = kmalloc(sizeof(struct fib_table) + sizeof(struct fn_hash), GFP_KERNEL); + if (fn_alias_kmem == NULL) + fn_alias_kmem = kmem_cache_create("ip_fib_alias", + sizeof(struct fib_alias), + 0, SLAB_HWCACHE_ALIGN, + NULL, NULL); + + tb = kmalloc(sizeof(struct fib_table) + sizeof(struct fn_hash), + GFP_KERNEL); if (tb == NULL) return NULL; @@ -898,64 +894,105 @@ struct fib_iter_state { struct fn_zone *zone; int bucket; - struct fib_node **hash; - struct fib_node *node; + struct hlist_head *hash_head; + struct fib_node *fn; + struct fib_alias *fa; }; -static __inline__ struct fib_node *fib_get_first(struct seq_file *seq) +static struct fib_alias *fib_get_first(struct seq_file *seq) { - struct fib_iter_state* iter = seq->private; - struct fn_hash *table = (struct fn_hash *)ip_fib_main_table->tb_data; + struct fib_iter_state *iter = seq->private; + struct fn_hash *table = (struct fn_hash *) ip_fib_main_table->tb_data; - iter->bucket = 0; - iter->hash = NULL; - iter->node = NULL; + iter->bucket = 0; + iter->hash_head = NULL; + iter->fn = NULL; + iter->fa = NULL; for (iter->zone = table->fn_zone_list; iter->zone; iter->zone = iter->zone->fz_next) { int maxslot; - if (!iter->zone->fz_next) + if (!iter->zone->fz_nent) continue; - iter->hash = iter->zone->fz_hash; + iter->hash_head = iter->zone->fz_hash; maxslot = iter->zone->fz_divisor; for (iter->bucket = 0; iter->bucket < maxslot; - ++iter->bucket, ++iter->hash) { - iter->node = *iter->hash; - - if (iter->node) - goto out; + ++iter->bucket, ++iter->hash_head) { + struct hlist_node *node; + struct fib_node *fn; + + hlist_for_each_entry(fn,node,iter->hash_head,fn_hash) { + struct fib_alias *fa; + + list_for_each_entry(fa,&fn->fn_alias,fa_list) { + iter->fn = fn; + iter->fa = fa; + goto out; + } + } } } out: - return iter->node; + return iter->fa; } -static __inline__ struct fib_node *fib_get_next(struct seq_file *seq) +static struct fib_alias *fib_get_next(struct seq_file *seq) { - struct fib_iter_state* iter = seq->private; + struct fib_iter_state *iter = seq->private; + struct fib_node *fn; + struct fib_alias *fa; + + /* Advance FA, if any. */ + fn = iter->fn; + fa = iter->fa; + if (fa) { + BUG_ON(!fn); + list_for_each_entry_continue(fa, &fn->fn_alias, fa_list) { + iter->fa = fa; + goto out; + } + } - if (iter->node) - iter->node = iter->node->fn_next; + fa = iter->fa = NULL; - if (iter->node) - goto out; + /* Advance FN. */ + if (fn) { + struct hlist_node *node = &fn->fn_hash; + hlist_for_each_entry_continue(fn, node, fn_hash) { + iter->fn = fn; + list_for_each_entry(fa, &fn->fn_alias, fa_list) { + iter->fa = fa; + goto out; + } + } + } + + fn = iter->fn = NULL; + + /* Advance hash chain. */ if (!iter->zone) goto out; for (;;) { + struct hlist_node *node; int maxslot; maxslot = iter->zone->fz_divisor; while (++iter->bucket < maxslot) { - iter->node = *++iter->hash; + iter->hash_head++; - if (iter->node) - goto out; + hlist_for_each_entry(fn, node, iter->hash_head, fn_hash) { + list_for_each_entry(fa, &fn->fn_alias, fa_list) { + iter->fn = fn; + iter->fa = fa; + goto out; + } + } } iter->zone = iter->zone->fz_next; @@ -963,14 +1000,19 @@ if (!iter->zone) goto out; - iter->hash = iter->zone->fz_hash; iter->bucket = 0; - iter->node = *iter->hash; - if (iter->node) - break; + iter->hash_head = iter->zone->fz_hash; + + hlist_for_each_entry(fn, node, iter->hash_head, fn_hash) { + list_for_each_entry(fa, &fn->fn_alias, fa_list) { + iter->fn = fn; + iter->fa = fa; + goto out; + } + } } out: - return iter->node; + return fa; } static void *fib_seq_start(struct seq_file *seq, loff_t *pos) @@ -994,7 +1036,7 @@ read_unlock(&fib_hash_lock); } -static unsigned fib_flag_trans(int type, int dead, u32 mask, struct fib_info *fi) +static unsigned fib_flag_trans(int type, u32 mask, struct fib_info *fi) { static unsigned type2flags[RTN_MAX + 1] = { [7] = RTF_REJECT, [8] = RTF_REJECT, @@ -1005,8 +1047,7 @@ flags |= RTF_GATEWAY; if (mask == 0xFFFFFFFF) flags |= RTF_HOST; - if (!dead) - flags |= RTF_UP; + flags |= RTF_UP; return flags; } @@ -1018,11 +1059,12 @@ */ static int fib_seq_show(struct seq_file *seq, void *v) { - struct fib_iter_state* iter; + struct fib_iter_state *iter; char bf[128]; u32 prefix, mask; unsigned flags; struct fib_node *f; + struct fib_alias *fa; struct fib_info *fi; if (v == SEQ_START_TOKEN) { @@ -1032,13 +1074,13 @@ goto out; } - f = v; - fi = FIB_INFO(f); iter = seq->private; - prefix = fz_prefix(f->fn_key, iter->zone); + f = iter->fn; + fa = iter->fa; + fi = fa->fa_info; + prefix = f->fn_key; mask = FZ_MASK(iter->zone); - flags = fib_flag_trans(f->fn_type, f->fn_state & FN_S_ZOMBIE, - mask, fi); + flags = fib_flag_trans(fa->fa_type, mask, fi); if (fi) snprintf(bf, sizeof(bf), "%s\t%08X\t%08X\t%04X\t%d\t%u\t%d\t%08X\t%d\t%u\t%u", diff -Nru a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c --- a/net/ipv4/fib_rules.c 2004-09-26 10:25:56 -07:00 +++ b/net/ipv4/fib_rules.c 2004-09-26 10:25:56 -07:00 @@ -302,9 +302,7 @@ for (r = fib_rules; r; r=r->r_next) { if (((saddr^r->r_src) & r->r_srcmask) || ((daddr^r->r_dst) & r->r_dstmask) || -#ifdef CONFIG_IP_ROUTE_TOS (r->r_tos && r->r_tos != flp->fl4_tos) || -#endif #ifdef CONFIG_IP_ROUTE_FWMARK (r->r_fwmark && r->r_fwmark != flp->fl4_fwmark) || #endif diff -Nru a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c --- a/net/ipv4/fib_semantics.c 2004-09-26 10:25:55 -07:00 +++ b/net/ipv4/fib_semantics.c 2004-09-26 10:25:55 -07:00 @@ -45,14 +45,15 @@ #define FSprintk(a...) -static struct fib_info *fib_info_list; static rwlock_t fib_info_lock = RW_LOCK_UNLOCKED; -int fib_info_cnt; - -#define for_fib_info() { struct fib_info *fi; \ - for (fi = fib_info_list; fi; fi = fi->fib_next) - -#define endfor_fib_info() } +static struct hlist_head *fib_info_hash; +static struct hlist_head *fib_info_laddrhash; +static unsigned int fib_hash_size; +static unsigned int fib_info_cnt; + +#define DEVINDEX_HASHBITS 8 +#define DEVINDEX_HASHSIZE (1U << DEVINDEX_HASHBITS) +static struct hlist_head fib_info_devhash[DEVINDEX_HASHSIZE]; #ifdef CONFIG_IP_ROUTE_MULTIPATH @@ -156,12 +157,12 @@ { write_lock(&fib_info_lock); if (fi && --fi->fib_treeref == 0) { - if (fi->fib_next) - fi->fib_next->fib_prev = fi->fib_prev; - if (fi->fib_prev) - fi->fib_prev->fib_next = fi->fib_next; - if (fi == fib_info_list) - fib_info_list = fi->fib_next; + hlist_del(&fi->fib_hash); + if (fi->fib_prefsrc) + hlist_del(&fi->fib_lhash); + change_nexthops(fi) { + hlist_del(&nh->nh_hash); + } endfor_nexthops(fi) fi->fib_dead = 1; fib_info_put(fi); } @@ -189,42 +190,79 @@ return 0; } -static __inline__ struct fib_info * fib_find_info(const struct fib_info *nfi) +static inline unsigned int fib_info_hashfn(const struct fib_info *fi) { - for_fib_info() { + unsigned int mask = (fib_hash_size - 1); + unsigned int val = fi->fib_nhs; + + val ^= fi->fib_protocol; + val ^= fi->fib_prefsrc; + val ^= fi->fib_priority; + + return (val ^ (val >> 7) ^ (val >> 12)) & mask; +} + +static struct fib_info *fib_find_info(const struct fib_info *nfi) +{ + struct hlist_head *head; + struct hlist_node *node; + struct fib_info *fi; + unsigned int hash; + + hash = fib_info_hashfn(nfi); + head = &fib_info_hash[hash]; + + hlist_for_each_entry(fi, node, head, fib_hash) { if (fi->fib_nhs != nfi->fib_nhs) continue; if (nfi->fib_protocol == fi->fib_protocol && nfi->fib_prefsrc == fi->fib_prefsrc && nfi->fib_priority == fi->fib_priority && - memcmp(nfi->fib_metrics, fi->fib_metrics, sizeof(fi->fib_metrics)) == 0 && + memcmp(nfi->fib_metrics, fi->fib_metrics, + sizeof(fi->fib_metrics)) == 0 && ((nfi->fib_flags^fi->fib_flags)&~RTNH_F_DEAD) == 0 && (nfi->fib_nhs == 0 || nh_comp(fi, nfi) == 0)) return fi; - } endfor_fib_info(); + } + return NULL; } +static inline unsigned int fib_devindex_hashfn(unsigned int val) +{ + unsigned int mask = DEVINDEX_HASHSIZE - 1; + + return (val ^ + (val >> DEVINDEX_HASHBITS) ^ + (val >> (DEVINDEX_HASHBITS * 2))) & mask; +} + /* Check, that the gateway is already configured. Used only by redirect accept routine. */ int ip_fib_check_default(u32 gw, struct net_device *dev) { + struct hlist_head *head; + struct hlist_node *node; + struct fib_nh *nh; + unsigned int hash; + read_lock(&fib_info_lock); - for_fib_info() { - if (fi->fib_flags & RTNH_F_DEAD) - continue; - for_nexthops(fi) { - if (nh->nh_dev == dev && nh->nh_gw == gw && - nh->nh_scope == RT_SCOPE_LINK && - !(nh->nh_flags&RTNH_F_DEAD)) { - read_unlock(&fib_info_lock); - return 0; - } - } endfor_nexthops(fi); - } endfor_fib_info(); + + hash = fib_devindex_hashfn(dev->ifindex); + head = &fib_info_devhash[hash]; + hlist_for_each_entry(nh, node, head, nh_hash) { + if (nh->nh_dev == dev && + nh->nh_gw == gw && + !(nh->nh_flags&RTNH_F_DEAD)) { + read_unlock(&fib_info_lock); + return 0; + } + } + read_unlock(&fib_info_lock); + return -1; } @@ -451,6 +489,82 @@ return 0; } +static inline unsigned int fib_laddr_hashfn(u32 val) +{ + unsigned int mask = (fib_hash_size - 1); + + return (val ^ (val >> 7) ^ (val >> 14)) & mask; +} + +static struct hlist_head *fib_hash_alloc(int bytes) +{ + if (bytes <= PAGE_SIZE) + return kmalloc(bytes, GFP_KERNEL); + else + return (struct hlist_head *) + __get_free_pages(GFP_KERNEL, get_order(bytes)); +} + +static void fib_hash_free(struct hlist_head *hash, int bytes) +{ + if (!hash) + return; + + if (bytes <= PAGE_SIZE) + kfree(hash); + else + free_pages((unsigned long) hash, get_order(bytes)); +} + +static void fib_hash_move(struct hlist_head *new_info_hash, + struct hlist_head *new_laddrhash, + unsigned int new_size) +{ + unsigned int old_size = fib_hash_size; + unsigned int i; + + write_lock(&fib_info_lock); + fib_hash_size = new_size; + + for (i = 0; i < old_size; i++) { + struct hlist_head *head = &fib_info_hash[i]; + struct hlist_node *node, *n; + struct fib_info *fi; + + hlist_for_each_entry_safe(fi, node, n, head, fib_hash) { + struct hlist_head *dest; + unsigned int new_hash; + + hlist_del(&fi->fib_hash); + + new_hash = fib_info_hashfn(fi); + dest = &new_info_hash[new_hash]; + hlist_add_head(&fi->fib_hash, dest); + } + } + fib_info_hash = new_info_hash; + + for (i = 0; i < old_size; i++) { + struct hlist_head *lhead = &fib_info_laddrhash[i]; + struct hlist_node *node, *n; + struct fib_info *fi; + + hlist_for_each_entry_safe(fi, node, n, lhead, fib_lhash) { + struct hlist_head *ldest; + unsigned int new_hash; + + hlist_del(&fi->fib_lhash); + + new_hash = fib_laddr_hashfn(fi->fib_prefsrc); + ldest = &new_laddrhash[new_hash]; + hlist_add_head(&fi->fib_lhash, ldest); + } + } + fib_info_laddrhash = new_laddrhash; + + write_unlock(&fib_info_lock); +} + struct fib_info * fib_create_info(const struct rtmsg *r, struct kern_rta *rta, const struct nlmsghdr *nlh, int *errp) @@ -476,15 +590,45 @@ } #endif - fi = kmalloc(sizeof(*fi)+nhs*sizeof(struct fib_nh), GFP_KERNEL); err = -ENOBUFS; + if (fib_info_cnt >= fib_hash_size) { + unsigned int new_size = fib_hash_size << 1; + struct hlist_head *new_info_hash; + struct hlist_head *new_laddrhash; + unsigned int bytes; + + if (!new_size) + new_size = 1; + bytes = new_size * sizeof(struct hlist_head *); + new_info_hash = fib_hash_alloc(bytes); + new_laddrhash = fib_hash_alloc(bytes); + if (!new_info_hash || !new_laddrhash) { + fib_hash_free(new_info_hash, bytes); + fib_hash_free(new_laddrhash, bytes); + } else { + memset(new_info_hash, 0, bytes); + memset(new_laddrhash, 0, bytes); + + fib_hash_move(new_info_hash, new_laddrhash, new_size); + } + + if (!fib_hash_size) + goto failure; + } + + fi = kmalloc(sizeof(*fi)+nhs*sizeof(struct fib_nh), GFP_KERNEL); if (fi == NULL) goto failure; fib_info_cnt++; memset(fi, 0, sizeof(*fi)+nhs*sizeof(struct fib_nh)); fi->fib_protocol = r->rtm_protocol; + fi->fib_nhs = nhs; + change_nexthops(fi) { + nh->nh_parent = fi; + } endfor_nexthops(fi) + fi->fib_flags = r->rtm_flags; if (rta->rta_priority) fi->fib_priority = *rta->rta_priority; @@ -581,11 +725,24 @@ fi->fib_treeref++; atomic_inc(&fi->fib_clntref); write_lock(&fib_info_lock); - fi->fib_next = fib_info_list; - fi->fib_prev = NULL; - if (fib_info_list) - fib_info_list->fib_prev = fi; - fib_info_list = fi; + hlist_add_head(&fi->fib_hash, + &fib_info_hash[fib_info_hashfn(fi)]); + if (fi->fib_prefsrc) { + struct hlist_head *head; + + head = &fib_info_laddrhash[fib_laddr_hashfn(fi->fib_prefsrc)]; + hlist_add_head(&fi->fib_lhash, head); + } + change_nexthops(fi) { + struct hlist_head *head; + unsigned int hash; + + if (!nh->nh_dev) + continue; + hash = fib_devindex_hashfn(nh->nh_dev->ifindex); + head = &fib_info_devhash[hash]; + hlist_add_head(&nh->nh_hash, head); + } endfor_nexthops(fi) write_unlock(&fib_info_lock); return fi; @@ -884,13 +1041,36 @@ if (force) scope = -1; - for_fib_info() { - if (local && fi->fib_prefsrc == local) { - fi->fib_flags |= RTNH_F_DEAD; - ret++; - } else if (dev && fi->fib_nhs) { - int dead = 0; + if (local && fib_info_laddrhash) { + unsigned int hash = fib_laddr_hashfn(local); + struct hlist_head *head = &fib_info_laddrhash[hash]; + struct hlist_node *node; + struct fib_info *fi; + hlist_for_each_entry(fi, node, head, fib_lhash) { + if (fi->fib_prefsrc == local) { + fi->fib_flags |= RTNH_F_DEAD; + ret++; + } + } + } + + if (dev) { + struct fib_info *prev_fi = NULL; + unsigned int hash = fib_devindex_hashfn(dev->ifindex); + struct hlist_head *head = &fib_info_devhash[hash]; + struct hlist_node *node; + struct fib_nh *nh; + + hlist_for_each_entry(nh, node, head, nh_hash) { + struct fib_info *fi = nh->nh_parent; + int dead; + + BUG_ON(!fi->fib_nhs); + if (nh->nh_dev != dev || fi == prev_fi) + continue; + prev_fi = fi; + dead = 0; change_nexthops(fi) { if (nh->nh_flags&RTNH_F_DEAD) dead++; @@ -917,7 +1097,8 @@ ret++; } } - } endfor_fib_info(); + } + return ret; } @@ -930,14 +1111,31 @@ int fib_sync_up(struct net_device *dev) { - int ret = 0; + struct fib_info *prev_fi; + unsigned int hash; + struct hlist_head *head; + struct hlist_node *node; + struct fib_nh *nh; + int ret; if (!(dev->flags&IFF_UP)) return 0; - for_fib_info() { - int alive = 0; + prev_fi = NULL; + hash = fib_devindex_hashfn(dev->ifindex); + head = &fib_info_devhash[hash]; + ret = 0; + + hlist_for_each_entry(nh, node, head, nh_hash) { + struct fib_info *fi = nh->nh_parent; + int alive; + + BUG_ON(!fi->fib_nhs); + if (nh->nh_dev != dev || fi == prev_fi) + continue; + prev_fi = fi; + alive = 0; change_nexthops(fi) { if (!(nh->nh_flags&RTNH_F_DEAD)) { alive++; @@ -958,7 +1156,8 @@ fi->fib_flags &= ~RTNH_F_DEAD; ret++; } - } endfor_fib_info(); + } + return ret; } diff -Nru a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c --- a/net/ipv4/ip_gre.c 2004-09-26 10:25:57 -07:00 +++ b/net/ipv4/ip_gre.c 2004-09-26 10:25:57 -07:00 @@ -36,6 +36,7 @@ #include #include #include +#include #include #include @@ -547,7 +548,7 @@ if (skb->protocol == htons(ETH_P_IP)) inner = old_iph->tos; else if (skb->protocol == htons(ETH_P_IPV6)) - inner = ip6_get_dsfield((struct ipv6hdr*)old_iph); + inner = ipv6_get_dsfield((struct ipv6hdr *)old_iph); return INET_ECN_encapsulate(tos, inner); } @@ -603,13 +604,24 @@ if ((tunnel = ipgre_tunnel_lookup(iph->saddr, iph->daddr, key)) != NULL) { secpath_reset(skb); + skb->protocol = *(u16*)(h + 2); + /* WCCP version 1 and 2 protocol decoding. + * - Change protocol to IP + * - When dealing with WCCPv2, Skip extra 4 bytes in GRE header + */ + if (flags == 0 && + skb->protocol == __constant_htons(ETH_P_WCCP)) { + skb->protocol = __constant_htons(ETH_P_IP); + if ((*(h + offset) & 0xF0) != 0x40) + offset += 4; + } + skb->mac.raw = skb->nh.raw; skb->nh.raw = __pskb_pull(skb, offset); memset(&(IPCB(skb)->opt), 0, sizeof(struct ip_options)); if (skb->ip_summed == CHECKSUM_HW) skb->csum = csum_sub(skb->csum, csum_partial(skb->mac.raw, skb->nh.raw-skb->mac.raw, 0)); - skb->protocol = *(u16*)(h + 2); skb->pkt_type = PACKET_HOST; #ifdef CONFIG_NET_IPGRE_BROADCAST if (MULTICAST(iph->daddr)) { diff -Nru a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c --- a/net/ipv4/ip_output.c 2004-09-26 10:25:57 -07:00 +++ b/net/ipv4/ip_output.c 2004-09-26 10:25:57 -07:00 @@ -422,6 +422,7 @@ nf_conntrack_put(to->nfct); to->nfct = from->nfct; nf_conntrack_get(to->nfct); + to->nfctinfo = from->nfctinfo; #ifdef CONFIG_BRIDGE_NETFILTER nf_bridge_put(to->nf_bridge); to->nf_bridge = from->nf_bridge; diff -Nru a/net/ipv4/netfilter/Kconfig b/net/ipv4/netfilter/Kconfig --- a/net/ipv4/netfilter/Kconfig 2004-09-26 10:25:57 -07:00 +++ b/net/ipv4/netfilter/Kconfig 2004-09-26 10:25:57 -07:00 @@ -332,6 +332,16 @@ If you want to compile it as a module, say M here and read Documentation/modules.txt. If unsure, say `N'. +config IP_NF_MATCH_COMMENT + tristate 'comment match support' + depends on IP_NF_IPTABLES + help + This option adds a `comment' dummy-match, which allows you to put + comments in your iptables ruleset. + + If you want to compile it as a module, say M here and read + Documentation/modules.txt. If unsure, say `N'. + # `filter', generic and specific targets config IP_NF_FILTER tristate "Packet filtering" diff -Nru a/net/ipv4/netfilter/Makefile b/net/ipv4/netfilter/Makefile --- a/net/ipv4/netfilter/Makefile 2004-09-26 10:25:55 -07:00 +++ b/net/ipv4/netfilter/Makefile 2004-09-26 10:25:55 -07:00 @@ -50,28 +50,23 @@ obj-$(CONFIG_IP_NF_MATCH_MARK) += ipt_mark.o obj-$(CONFIG_IP_NF_MATCH_MAC) += ipt_mac.o obj-$(CONFIG_IP_NF_MATCH_IPRANGE) += ipt_iprange.o - obj-$(CONFIG_IP_NF_MATCH_PKTTYPE) += ipt_pkttype.o obj-$(CONFIG_IP_NF_MATCH_MULTIPORT) += ipt_multiport.o obj-$(CONFIG_IP_NF_MATCH_OWNER) += ipt_owner.o obj-$(CONFIG_IP_NF_MATCH_TOS) += ipt_tos.o - obj-$(CONFIG_IP_NF_MATCH_RECENT) += ipt_recent.o - obj-$(CONFIG_IP_NF_MATCH_ECN) += ipt_ecn.o obj-$(CONFIG_IP_NF_MATCH_DSCP) += ipt_dscp.o obj-$(CONFIG_IP_NF_MATCH_AH_ESP) += ipt_ah.o ipt_esp.o - obj-$(CONFIG_IP_NF_MATCH_LENGTH) += ipt_length.o - obj-$(CONFIG_IP_NF_MATCH_TTL) += ipt_ttl.o obj-$(CONFIG_IP_NF_MATCH_STATE) += ipt_state.o obj-$(CONFIG_IP_NF_MATCH_CONNTRACK) += ipt_conntrack.o obj-$(CONFIG_IP_NF_MATCH_TCPMSS) += ipt_tcpmss.o obj-$(CONFIG_IP_NF_MATCH_REALM) += ipt_realm.o obj-$(CONFIG_IP_NF_MATCH_ADDRTYPE) += ipt_addrtype.o - obj-$(CONFIG_IP_NF_MATCH_PHYSDEV) += ipt_physdev.o +obj-$(CONFIG_IP_NF_MATCH_COMMENT) += ipt_comment.o # targets obj-$(CONFIG_IP_NF_TARGET_REJECT) += ipt_REJECT.o diff -Nru a/net/ipv4/netfilter/ip_conntrack_core.c b/net/ipv4/netfilter/ip_conntrack_core.c --- a/net/ipv4/netfilter/ip_conntrack_core.c 2004-09-26 10:25:55 -07:00 +++ b/net/ipv4/netfilter/ip_conntrack_core.c 2004-09-26 10:25:55 -07:00 @@ -66,7 +66,7 @@ void (*ip_conntrack_destroyed)(struct ip_conntrack *conntrack) = NULL; LIST_HEAD(ip_conntrack_expect_list); -LIST_HEAD(protocol_list); +struct ip_conntrack_protocol *ip_ct_protos[MAX_IP_CT_PROTO]; static LIST_HEAD(helpers); unsigned int ip_conntrack_htable_size = 0; int ip_conntrack_max; @@ -74,48 +74,15 @@ static kmem_cache_t *ip_conntrack_cachep; static kmem_cache_t *ip_conntrack_expect_cachep; struct ip_conntrack ip_conntrack_untracked; +unsigned int ip_ct_log_invalid; DEFINE_PER_CPU(struct ip_conntrack_stat, ip_conntrack_stat); -extern struct ip_conntrack_protocol ip_conntrack_generic_protocol; - -static inline int proto_cmpfn(const struct ip_conntrack_protocol *curr, - u_int8_t protocol) -{ - return protocol == curr->proto; -} - -struct ip_conntrack_protocol *__ip_ct_find_proto(u_int8_t protocol) -{ - struct ip_conntrack_protocol *p; - - MUST_BE_READ_LOCKED(&ip_conntrack_lock); - p = LIST_FIND(&protocol_list, proto_cmpfn, - struct ip_conntrack_protocol *, protocol); - if (!p) - p = &ip_conntrack_generic_protocol; - - return p; -} - -struct ip_conntrack_protocol *ip_ct_find_proto(u_int8_t protocol) -{ - struct ip_conntrack_protocol *p; - - READ_LOCK(&ip_conntrack_lock); - p = __ip_ct_find_proto(protocol); - READ_UNLOCK(&ip_conntrack_lock); - return p; -} - inline void ip_conntrack_put(struct ip_conntrack *ct) { IP_NF_ASSERT(ct); - IP_NF_ASSERT(ct->infos[0].master); - /* nf_conntrack_put wants to go via an info struct, so feed it - one at random. */ - nf_conntrack_put(&ct->infos[0]); + nf_conntrack_put(&ct->ct_general); } static int ip_conntrack_hash_rnd_initted; @@ -185,7 +152,7 @@ IP_NF_ASSERT(!timer_pending(&exp->timeout)); kmem_cache_free(ip_conntrack_expect_cachep, exp); - __get_cpu_var(ip_conntrack_stat).expect_delete++; + CONNTRACK_STAT_INC(expect_delete); } inline void ip_conntrack_expect_put(struct ip_conntrack_expect *exp) @@ -354,14 +321,14 @@ DEBUGP("destroy_conntrack: returning ct=%p to slab\n", ct); kmem_cache_free(ip_conntrack_cachep, ct); atomic_dec(&ip_conntrack_count); - __get_cpu_var(ip_conntrack_stat).delete++; + CONNTRACK_STAT_INC(delete); } static void death_by_timeout(unsigned long ul_conntrack) { struct ip_conntrack *ct = (void *)ul_conntrack; - __get_cpu_var(ip_conntrack_stat).delete_list++; + CONNTRACK_STAT_INC(delete_list); WRITE_LOCK(&ip_conntrack_lock); clean_from_lists(ct); @@ -416,36 +383,15 @@ return h; } -static inline struct ip_conntrack * -__ip_conntrack_get(struct nf_ct_info *nfct, enum ip_conntrack_info *ctinfo) -{ - struct ip_conntrack *ct - = (struct ip_conntrack *)nfct->master; - - /* ctinfo is the index of the nfct inside the conntrack */ - *ctinfo = nfct - ct->infos; - IP_NF_ASSERT(*ctinfo >= 0 && *ctinfo < IP_CT_NUMBER); - return ct; -} - -/* Return conntrack and conntrack_info given skb->nfct->master */ -struct ip_conntrack * -ip_conntrack_get(struct sk_buff *skb, enum ip_conntrack_info *ctinfo) -{ - if (skb->nfct) - return __ip_conntrack_get(skb->nfct, ctinfo); - return NULL; -} - -/* Confirm a connection given skb->nfct; places it in hash table */ +/* Confirm a connection given skb; places it in hash table */ int -__ip_conntrack_confirm(struct nf_ct_info *nfct) +__ip_conntrack_confirm(struct sk_buff *skb) { unsigned int hash, repl_hash; struct ip_conntrack *ct; enum ip_conntrack_info ctinfo; - ct = __ip_conntrack_get(nfct, &ctinfo); + ct = ip_conntrack_get(skb, &ctinfo); /* ipt_REJECT uses ip_conntrack_attach to attach related ICMP/TCP RST packets in other direction. Actual packet @@ -491,12 +437,12 @@ atomic_inc(&ct->ct_general.use); set_bit(IPS_CONFIRMED_BIT, &ct->status); WRITE_UNLOCK(&ip_conntrack_lock); - __get_cpu_var(ip_conntrack_stat).insert++; + CONNTRACK_STAT_INC(insert); return NF_ACCEPT; } WRITE_UNLOCK(&ip_conntrack_lock); - __get_cpu_var(ip_conntrack_stat).insert_failed++; + CONNTRACK_STAT_INC(insert_failed); return NF_DROP; } @@ -540,7 +486,7 @@ if (del_timer(&h->ctrack->timeout)) { death_by_timeout((unsigned long)h->ctrack); dropped = 1; - __get_cpu_var(ip_conntrack_stat).early_drop++; + CONNTRACK_STAT_INC(early_drop); } ip_conntrack_put(h->ctrack); return dropped; @@ -570,8 +516,6 @@ struct ip_conntrack_tuple repl_tuple; size_t hash; struct ip_conntrack_expect *expected; - int i; - static unsigned int drop_next; if (!ip_conntrack_hash_rnd_initted) { get_random_bytes(&ip_conntrack_hash_rnd, 4); @@ -580,15 +524,10 @@ hash = hash_conntrack(tuple); - if (ip_conntrack_max && - atomic_read(&ip_conntrack_count) >= ip_conntrack_max) { - /* Try dropping from random chain, or else from the - chain about to put into (in case they're trying to - bomb one hash chain). */ - unsigned int next = (drop_next++)%ip_conntrack_htable_size; - - if (!early_drop(&ip_conntrack_hash[next]) - && !early_drop(&ip_conntrack_hash[hash])) { + if (ip_conntrack_max + && atomic_read(&ip_conntrack_count) >= ip_conntrack_max) { + /* Try dropping from this hash chain. */ + if (!early_drop(&ip_conntrack_hash[hash])) { if (net_ratelimit()) printk(KERN_WARNING "ip_conntrack: table full, dropping" @@ -615,9 +554,6 @@ conntrack->tuplehash[IP_CT_DIR_ORIGINAL].ctrack = conntrack; conntrack->tuplehash[IP_CT_DIR_REPLY].tuple = repl_tuple; conntrack->tuplehash[IP_CT_DIR_REPLY].ctrack = conntrack; - for (i=0; i < IP_CT_NUMBER; i++) - conntrack->infos[i].master = &conntrack->ct_general; - if (!protocol->new(conntrack, skb)) { kmem_cache_free(ip_conntrack_cachep, conntrack); return NULL; @@ -655,13 +591,13 @@ DEBUGP("conntrack: expectation arrives ct=%p exp=%p\n", conntrack, expected); /* Welcome, Mr. Bond. We've been expecting you... */ - IP_NF_ASSERT(master_ct(conntrack)); + IP_NF_ASSERT(expected->expectant); __set_bit(IPS_EXPECTED_BIT, &conntrack->status); conntrack->master = expected; expected->sibling = conntrack; LIST_DELETE(&ip_conntrack_expect_list, expected); expected->expectant->expecting--; - nf_conntrack_get(&master_ct(conntrack)->infos[0]); + nf_conntrack_get(&master_ct(conntrack)->ct_general); /* this is a braindead... --pablo */ atomic_inc(&ip_conntrack_count); @@ -670,13 +606,13 @@ if (expected->expectfn) expected->expectfn(conntrack); - __get_cpu_var(ip_conntrack_stat).expect_new++; + CONNTRACK_STAT_INC(expect_new); goto ret; } else { conntrack->helper = ip_ct_find_helper(&repl_tuple); - __get_cpu_var(ip_conntrack_stat).new++; + CONNTRACK_STAT_INC(new); } end: atomic_inc(&ip_conntrack_count); @@ -734,7 +670,8 @@ } *set_reply = 0; } - skb->nfct = &h->ctrack->infos[*ctinfo]; + skb->nfct = &h->ctrack->ct_general; + skb->nfctinfo = *ctinfo; return h->ctrack; } @@ -780,7 +717,7 @@ /* Previously seen (loopback or untracked)? Ignore. */ if ((*pskb)->nfct) { - __get_cpu_var(ip_conntrack_stat).ignore++; + CONNTRACK_STAT_INC(ignore); return NF_ACCEPT; } @@ -791,19 +728,20 @@ * core what to do with the packet. */ if (proto->error != NULL && (ret = proto->error(*pskb, &ctinfo, hooknum)) <= 0) { - __get_cpu_var(ip_conntrack_stat).icmp_error++; + CONNTRACK_STAT_INC(error); + CONNTRACK_STAT_INC(invalid); return -ret; } if (!(ct = resolve_normal_ct(*pskb, proto,&set_reply,hooknum,&ctinfo))) { /* Not valid part of a connection */ - __get_cpu_var(ip_conntrack_stat).invalid++; + CONNTRACK_STAT_INC(invalid); return NF_ACCEPT; } if (IS_ERR(ct)) { /* Too stressed to deal. */ - __get_cpu_var(ip_conntrack_stat).drop++; + CONNTRACK_STAT_INC(drop); return NF_DROP; } @@ -815,7 +753,7 @@ * the netfilter core what to do*/ nf_conntrack_put((*pskb)->nfct); (*pskb)->nfct = NULL; - __get_cpu_var(ip_conntrack_stat).invalid++; + CONNTRACK_STAT_INC(invalid); return -ret; } @@ -823,7 +761,7 @@ ret = ct->helper->help(*pskb, ct, ctinfo); if (ret == -1) { /* Invalid */ - __get_cpu_var(ip_conntrack_stat).invalid++; + CONNTRACK_STAT_INC(invalid); nf_conntrack_put((*pskb)->nfct); (*pskb)->nfct = NULL; return NF_ACCEPT; @@ -1027,7 +965,7 @@ WRITE_UNLOCK(&ip_conntrack_lock); - __get_cpu_var(ip_conntrack_stat).expect_create++; + CONNTRACK_STAT_INC(expect_create); return ret; } @@ -1219,23 +1157,23 @@ } /* Used by ipt_REJECT. */ -static void ip_conntrack_attach(struct sk_buff *nskb, struct nf_ct_info *nfct) +static void ip_conntrack_attach(struct sk_buff *nskb, struct sk_buff *skb) { struct ip_conntrack *ct; enum ip_conntrack_info ctinfo; - ct = __ip_conntrack_get(nfct, &ctinfo); - - /* This ICMP is in reverse direction to the packet which - caused it */ + /* This ICMP is in reverse direction to the packet which caused it */ + ct = ip_conntrack_get(skb, &ctinfo); + if (CTINFO2DIR(ctinfo) == IP_CT_DIR_ORIGINAL) ctinfo = IP_CT_RELATED + IP_CT_IS_REPLY; else ctinfo = IP_CT_RELATED; - /* Attach new skbuff, and increment count */ - nskb->nfct = &ct->infos[ctinfo]; - atomic_inc(&ct->ct_general.use); + /* Attach to new skbuff, and increment count */ + nskb->nfct = &ct->ct_general; + nskb->nfctinfo = ctinfo; + nf_conntrack_get(nskb->nfct); } static inline int @@ -1430,10 +1368,12 @@ /* Don't NEED lock here, but good form anyway. */ WRITE_LOCK(&ip_conntrack_lock); + for (i = 0; i < MAX_IP_CT_PROTO; i++) + ip_ct_protos[i] = &ip_conntrack_generic_protocol; /* Sew in builtin protocols. */ - list_append(&protocol_list, &ip_conntrack_protocol_tcp); - list_append(&protocol_list, &ip_conntrack_protocol_udp); - list_append(&protocol_list, &ip_conntrack_protocol_icmp); + ip_ct_protos[IPPROTO_TCP] = &ip_conntrack_protocol_tcp; + ip_ct_protos[IPPROTO_UDP] = &ip_conntrack_protocol_udp; + ip_ct_protos[IPPROTO_ICMP] = &ip_conntrack_protocol_icmp; WRITE_UNLOCK(&ip_conntrack_lock); for (i = 0; i < ip_conntrack_htable_size; i++) @@ -1447,11 +1387,6 @@ atomic_set(&ip_conntrack_untracked.ct_general.use, 1); /* - and look it like as a confirmed connection */ set_bit(IPS_CONFIRMED_BIT, &ip_conntrack_untracked.status); - /* - and prepare the ctinfo field for REJECT & NAT. */ - ip_conntrack_untracked.infos[IP_CT_NEW].master = - ip_conntrack_untracked.infos[IP_CT_RELATED].master = - ip_conntrack_untracked.infos[IP_CT_RELATED + IP_CT_IS_REPLY].master = - &ip_conntrack_untracked.ct_general; return ret; diff -Nru a/net/ipv4/netfilter/ip_conntrack_proto_icmp.c b/net/ipv4/netfilter/ip_conntrack_proto_icmp.c --- a/net/ipv4/netfilter/ip_conntrack_proto_icmp.c 2004-09-26 10:25:55 -07:00 +++ b/net/ipv4/netfilter/ip_conntrack_proto_icmp.c 2004-09-26 10:25:55 -07:00 @@ -195,7 +195,8 @@ } /* Update skb to refer to this connection */ - skb->nfct = &h->ctrack->infos[*ctinfo]; + skb->nfct = &h->ctrack->ct_general; + skb->nfctinfo = *ctinfo; return -NF_ACCEPT; } diff -Nru a/net/ipv4/netfilter/ip_conntrack_proto_sctp.c b/net/ipv4/netfilter/ip_conntrack_proto_sctp.c --- a/net/ipv4/netfilter/ip_conntrack_proto_sctp.c 2004-09-26 10:25:57 -07:00 +++ b/net/ipv4/netfilter/ip_conntrack_proto_sctp.c 2004-09-26 10:25:57 -07:00 @@ -430,16 +430,16 @@ DEBUGP("\n"); if (skb_copy_bits(skb, skb->nh.iph->ihl * 4, &sctph, sizeof(sctph)) != 0) - return -1; + return 0; if (do_basic_checks(conntrack, skb, map) != 0) - return -1; + return 0; /* If an OOTB packet has any of these chunks discard (Sec 8.4) */ if ((test_bit (SCTP_CID_ABORT, (void *)map)) || (test_bit (SCTP_CID_SHUTDOWN_COMPLETE, (void *)map)) || (test_bit (SCTP_CID_COOKIE_ACK, (void *)map))) { - return -1; + return 0; } newconntrack = SCTP_CONNTRACK_MAX; @@ -461,7 +461,7 @@ if (skb_copy_bits(skb, offset + sizeof (sctp_chunkhdr_t), &inithdr, sizeof(inithdr)) != 0) { - return -1; + return 0; } DEBUGP("Setting vtag %x for new conn\n", @@ -471,7 +471,7 @@ inithdr.init_tag; } else { /* Sec 8.5.1 (A) */ - return -1; + return 0; } } /* If it is a shutdown ack OOTB packet, we expect a return @@ -496,7 +496,6 @@ } struct ip_conntrack_protocol ip_conntrack_protocol_sctp = { - .list = { NULL, NULL }, .proto = IPPROTO_SCTP, .name = "sctp", .pkt_to_tuple = sctp_pkt_to_tuple, diff -Nru a/net/ipv4/netfilter/ip_conntrack_standalone.c b/net/ipv4/netfilter/ip_conntrack_standalone.c --- a/net/ipv4/netfilter/ip_conntrack_standalone.c 2004-09-26 10:25:56 -07:00 +++ b/net/ipv4/netfilter/ip_conntrack_standalone.c 2004-09-26 10:25:56 -07:00 @@ -48,8 +48,6 @@ extern atomic_t ip_conntrack_count; DECLARE_PER_CPU(struct ip_conntrack_stat, ip_conntrack_stat); -unsigned int ip_ct_log_invalid = 0; - static int kill_proto(const struct ip_conntrack *i, void *data) { return (i->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.protonum == @@ -112,7 +110,7 @@ if (DIRECTION(hash)) return 0; - proto = __ip_ct_find_proto(conntrack->tuplehash[IP_CT_DIR_ORIGINAL] + proto = ip_ct_find_proto(conntrack->tuplehash[IP_CT_DIR_ORIGINAL] .tuple.dst.protonum); IP_NF_ASSERT(proto); @@ -241,8 +239,9 @@ seq_printf(s, "use=%u proto=%u ", atomic_read(&expect->use), expect->tuple.dst.protonum); - return print_tuple(s, &expect->tuple, - __ip_ct_find_proto(expect->tuple.dst.protonum)); + print_tuple(s, &expect->tuple, + ip_ct_find_proto(expect->tuple.dst.protonum)); + return seq_putc(s, '\n'); } static struct seq_operations exp_seq_ops = { @@ -316,7 +315,7 @@ st->insert_failed, st->drop, st->early_drop, - st->icmp_error, + st->error, st->expect_new, st->expect_create, @@ -515,6 +514,14 @@ .proc_handler = &proc_dointvec, }, { + .ctl_name = NET_IPV4_NF_CONNTRACK_COUNT, + .procname = "ip_conntrack_count", + .data = &ip_conntrack_count, + .maxlen = sizeof(int), + .mode = 0444, + .proc_handler = &proc_dointvec, + }, + { .ctl_name = NET_IPV4_NF_CONNTRACK_BUCKETS, .procname = "ip_conntrack_buckets", .data = &ip_conntrack_htable_size, @@ -815,19 +822,13 @@ int ip_conntrack_protocol_register(struct ip_conntrack_protocol *proto) { int ret = 0; - struct list_head *i; WRITE_LOCK(&ip_conntrack_lock); - list_for_each(i, &protocol_list) { - if (((struct ip_conntrack_protocol *)i)->proto - == proto->proto) { - ret = -EBUSY; - goto out; - } + if (ip_ct_protos[proto->proto] != &ip_conntrack_generic_protocol) { + ret = -EBUSY; + goto out; } - - list_prepend(&protocol_list, proto); - + ip_ct_protos[proto->proto] = proto; out: WRITE_UNLOCK(&ip_conntrack_lock); return ret; @@ -836,10 +837,7 @@ void ip_conntrack_protocol_unregister(struct ip_conntrack_protocol *proto) { WRITE_LOCK(&ip_conntrack_lock); - - /* ip_ct_find_proto() returns proto_generic in case there is no protocol - * helper. So this should be enough - HW */ - LIST_DELETE(&protocol_list, proto); + ip_ct_protos[proto->proto] = &ip_conntrack_generic_protocol; WRITE_UNLOCK(&ip_conntrack_lock); /* Somebody could be still looking at the proto in bh. */ @@ -879,8 +877,8 @@ EXPORT_SYMBOL(ip_conntrack_helper_unregister); EXPORT_SYMBOL(ip_ct_selective_cleanup); EXPORT_SYMBOL(ip_ct_refresh_acct); +EXPORT_SYMBOL(ip_ct_protos); EXPORT_SYMBOL(ip_ct_find_proto); -EXPORT_SYMBOL(__ip_ct_find_proto); EXPORT_SYMBOL(ip_ct_find_helper); EXPORT_SYMBOL(ip_conntrack_expect_alloc); EXPORT_SYMBOL(ip_conntrack_expect_related); diff -Nru a/net/ipv4/netfilter/ip_fw_compat_masq.c b/net/ipv4/netfilter/ip_fw_compat_masq.c --- a/net/ipv4/netfilter/ip_fw_compat_masq.c 2004-09-26 10:25:57 -07:00 +++ b/net/ipv4/netfilter/ip_fw_compat_masq.c 2004-09-26 10:25:57 -07:00 @@ -146,7 +146,7 @@ case IPPROTO_ICMP: /* ICMP errors. */ protocol->error(*pskb, &ctinfo, NF_IP_PRE_ROUTING); - ct = (struct ip_conntrack *)(*pskb)->nfct->master; + ct = (struct ip_conntrack *)(*pskb)->nfct; if (ct) { /* We only do SNAT in the compatibility layer. So we can manipulate ICMP errors from @@ -187,7 +187,7 @@ NULL, NULL, NULL); /* Put back the reference gained from find_get */ - nf_conntrack_put(&h->ctrack->infos[0]); + nf_conntrack_put(&h->ctrack->ct_general); if (ret == NF_ACCEPT) { struct ip_conntrack *ct; ct = ip_conntrack_get(*pskb, &ctinfo); @@ -206,7 +206,7 @@ } else { if (h) /* Put back the reference gained from find_get */ - nf_conntrack_put(&h->ctrack->infos[0]); + nf_conntrack_put(&h->ctrack->ct_general); ret = NF_ACCEPT; } diff -Nru a/net/ipv4/netfilter/ip_nat_core.c b/net/ipv4/netfilter/ip_nat_core.c --- a/net/ipv4/netfilter/ip_nat_core.c 2004-09-26 10:25:55 -07:00 +++ b/net/ipv4/netfilter/ip_nat_core.c 2004-09-26 10:25:55 -07:00 @@ -48,9 +48,8 @@ static struct list_head *bysource; static struct list_head *byipsproto; -LIST_HEAD(protos); +struct ip_nat_protocol *ip_nat_protos[MAX_IP_NAT_PROTO]; -extern struct ip_nat_protocol unknown_nat_protocol; /* We keep extra hashes for each conntrack, for fast searching. */ static inline size_t @@ -77,9 +76,6 @@ if (!info->initialized) return; - IP_NF_ASSERT(info->bysource.conntrack); - IP_NF_ASSERT(info->byipsproto.conntrack); - hs = hash_by_src(&conn->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src, conn->tuplehash[IP_CT_DIR_ORIGINAL] .tuple.dst.protonum); @@ -90,8 +86,8 @@ .tuple.dst.protonum); WRITE_LOCK(&ip_nat_lock); - LIST_DELETE(&bysource[hs], &info->bysource); - LIST_DELETE(&byipsproto[hp], &info->byipsproto); + list_del(&info->bysource); + list_del(&info->byipsproto); WRITE_UNLOCK(&ip_nat_lock); } @@ -106,23 +102,6 @@ oldcheck^0xFFFF)); } -static inline int cmp_proto(const struct ip_nat_protocol *i, int proto) -{ - return i->protonum == proto; -} - -struct ip_nat_protocol * -find_nat_proto(u_int16_t protonum) -{ - struct ip_nat_protocol *i; - - MUST_BE_READ_LOCKED(&ip_nat_lock); - i = LIST_FIND(&protos, cmp_proto, struct ip_nat_protocol *, protonum); - if (!i) - i = &unknown_nat_protocol; - return i; -} - /* Is this tuple already taken? (not by us) */ int ip_nat_used_tuple(const struct ip_conntrack_tuple *tuple, @@ -145,7 +124,7 @@ const struct ip_conntrack_manip *manip, const struct ip_nat_multi_range *mr) { - struct ip_nat_protocol *proto = find_nat_proto(tuple->dst.protonum); + struct ip_nat_protocol *proto = ip_nat_find_proto(tuple->dst.protonum); unsigned int i; struct ip_conntrack_tuple newtuple = { *manip, tuple->dst }; @@ -171,20 +150,18 @@ } static inline int -src_cmp(const struct ip_nat_hash *i, +src_cmp(const struct ip_conntrack *ct, const struct ip_conntrack_tuple *tuple, const struct ip_nat_multi_range *mr) { - return (i->conntrack->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.protonum + return (ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.protonum == tuple->dst.protonum - && i->conntrack->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.ip + && ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.ip == tuple->src.ip - && i->conntrack->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u.all + && ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u.all == tuple->src.u.all && in_range(tuple, - &i->conntrack->tuplehash[IP_CT_DIR_ORIGINAL] - .tuple.src, - mr)); + &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src, mr)); } /* Only called for SRC manip */ @@ -193,14 +170,13 @@ const struct ip_nat_multi_range *mr) { unsigned int h = hash_by_src(&tuple->src, tuple->dst.protonum); - struct ip_nat_hash *i; + struct ip_conntrack *ct; MUST_BE_READ_LOCKED(&ip_nat_lock); - i = LIST_FIND(&bysource[h], src_cmp, struct ip_nat_hash *, tuple, mr); - if (i) - return &i->conntrack->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src; - else - return NULL; + list_for_each_entry(ct, &bysource[h], nat.info.bysource) + if (src_cmp(ct, tuple, mr)) + return &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src; + return NULL; } #ifdef CONFIG_IP_NF_NAT_LOCAL @@ -226,19 +202,17 @@ #endif /* Simple way to iterate through all. */ -static inline int fake_cmp(const struct ip_nat_hash *i, +static inline int fake_cmp(const struct ip_conntrack *ct, u_int32_t src, u_int32_t dst, u_int16_t protonum, - unsigned int *score, - const struct ip_conntrack *conntrack) + unsigned int *score, const struct ip_conntrack *ct2) { /* Compare backwards: we're dealing with OUTGOING tuples, and inside the conntrack is the REPLY tuple. Don't count this conntrack. */ - if (i->conntrack != conntrack - && i->conntrack->tuplehash[IP_CT_DIR_REPLY].tuple.src.ip == dst - && i->conntrack->tuplehash[IP_CT_DIR_REPLY].tuple.dst.ip == src - && (i->conntrack->tuplehash[IP_CT_DIR_REPLY].tuple.dst.protonum - == protonum)) + if (ct != ct2 + && ct->tuplehash[IP_CT_DIR_REPLY].tuple.src.ip == dst + && ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.ip == src + && (ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.protonum == protonum)) (*score)++; return 0; } @@ -247,13 +221,14 @@ count_maps(u_int32_t src, u_int32_t dst, u_int16_t protonum, const struct ip_conntrack *conntrack) { + struct ip_conntrack *ct; unsigned int score = 0; unsigned int h; MUST_BE_READ_LOCKED(&ip_nat_lock); h = hash_by_ipsproto(src, dst, protonum); - LIST_FIND(&byipsproto[h], fake_cmp, struct ip_nat_hash *, - src, dst, protonum, &score, conntrack); + list_for_each_entry(ct, &byipsproto[h], nat.info.byipsproto) + fake_cmp(ct, src, dst, protonum, &score, conntrack); return score; } @@ -401,7 +376,7 @@ unsigned int hooknum) { struct ip_nat_protocol *proto - = find_nat_proto(orig_tuple->dst.protonum); + = ip_nat_find_proto(orig_tuple->dst.protonum); struct ip_nat_range *rptr; unsigned int i; int ret; @@ -640,12 +615,10 @@ /* It's done. */ info->initialized |= (1 << HOOK2MANIP(hooknum)); - if (in_hashes) { - IP_NF_ASSERT(info->bysource.conntrack); + if (in_hashes) replace_in_hashes(conntrack, info); - } else { + else place_in_hashes(conntrack, info); - } return NF_ACCEPT; } @@ -669,14 +642,9 @@ conntrack->tuplehash[IP_CT_DIR_REPLY] .tuple.dst.protonum); - IP_NF_ASSERT(info->bysource.conntrack == conntrack); MUST_BE_WRITE_LOCKED(&ip_nat_lock); - - list_del(&info->bysource.list); - list_del(&info->byipsproto.list); - - list_prepend(&bysource[srchash], &info->bysource); - list_prepend(&byipsproto[ipsprotohash], &info->byipsproto); + list_move(&info->bysource, &bysource[srchash]); + list_move(&info->byipsproto, &byipsproto[ipsprotohash]); } void place_in_hashes(struct ip_conntrack *conntrack, @@ -697,14 +665,9 @@ conntrack->tuplehash[IP_CT_DIR_REPLY] .tuple.dst.protonum); - IP_NF_ASSERT(!info->bysource.conntrack); - MUST_BE_WRITE_LOCKED(&ip_nat_lock); - info->byipsproto.conntrack = conntrack; - info->bysource.conntrack = conntrack; - - list_prepend(&bysource[srchash], &info->bysource); - list_prepend(&byipsproto[ipsprotohash], &info->byipsproto); + list_add(&info->bysource, &bysource[srchash]); + list_add(&info->byipsproto, &byipsproto[ipsprotohash]); } /* Returns true if succeeded. */ @@ -724,9 +687,8 @@ iph = (void *)(*pskb)->data + iphdroff; /* Manipulate protcol part. */ - if (!find_nat_proto(proto)->manip_pkt(pskb, - iphdroff + iph->ihl*4, - manip, maniptype)) + if (!ip_nat_find_proto(proto)->manip_pkt(pskb, iphdroff + iph->ihl*4, + manip, maniptype)) return 0; iph = (void *)(*pskb)->data + iphdroff; @@ -750,7 +712,7 @@ int ret = 1; MUST_BE_READ_LOCKED(&ip_conntrack_lock); - proto = __ip_ct_find_proto(skb->nh.iph->protocol); + proto = ip_ct_find_proto(skb->nh.iph->protocol); if (proto->exp_matches_pkt) ret = proto->exp_matches_pkt(exp, skb); @@ -890,12 +852,8 @@ } /* Must be RELATED */ - IP_NF_ASSERT((*pskb)->nfct - - ((struct ip_conntrack *)(*pskb)->nfct->master)->infos - == IP_CT_RELATED - || (*pskb)->nfct - - ((struct ip_conntrack *)(*pskb)->nfct->master)->infos - == IP_CT_RELATED+IP_CT_IS_REPLY); + IP_NF_ASSERT((*pskb)->nfctinfo == IP_CT_RELATED || + (*pskb)->nfctinfo == IP_CT_RELATED+IP_CT_IS_REPLY); /* Redirects on non-null nats must be dropped, else they'll start talking to each other without our translation, and be @@ -995,9 +953,11 @@ /* Sew in builtin protocols. */ WRITE_LOCK(&ip_nat_lock); - list_append(&protos, &ip_nat_protocol_tcp); - list_append(&protos, &ip_nat_protocol_udp); - list_append(&protos, &ip_nat_protocol_icmp); + for (i = 0; i < MAX_IP_NAT_PROTO; i++) + ip_nat_protos[i] = &ip_nat_unknown_protocol; + ip_nat_protos[IPPROTO_TCP] = &ip_nat_protocol_tcp; + ip_nat_protos[IPPROTO_UDP] = &ip_nat_protocol_udp; + ip_nat_protos[IPPROTO_ICMP] = &ip_nat_protocol_icmp; WRITE_UNLOCK(&ip_nat_lock); for (i = 0; i < ip_nat_htable_size; i++) { diff -Nru a/net/ipv4/netfilter/ip_nat_ftp.c b/net/ipv4/netfilter/ip_nat_ftp.c --- a/net/ipv4/netfilter/ip_nat_ftp.c 2004-09-26 10:25:56 -07:00 +++ b/net/ipv4/netfilter/ip_nat_ftp.c 2004-09-26 10:25:56 -07:00 @@ -297,7 +297,7 @@ char *tmpname; if (ports_c == 0) - ports[ports_c] = FTP_PORT; + ports[ports_c++] = FTP_PORT; for (i = 0; i < ports_c; i++) { ftp[i].tuple.dst.protonum = IPPROTO_TCP; diff -Nru a/net/ipv4/netfilter/ip_nat_helper.c b/net/ipv4/netfilter/ip_nat_helper.c --- a/net/ipv4/netfilter/ip_nat_helper.c 2004-09-26 10:25:55 -07:00 +++ b/net/ipv4/netfilter/ip_nat_helper.c 2004-09-26 10:25:55 -07:00 @@ -73,7 +73,7 @@ LOCK_BH(&ip_nat_seqofs_lock); - /* SYN adjust. If it's uninitialized, of this is after last + /* SYN adjust. If it's uninitialized, or this is after last * correction, record it: we don't handle more than one * adjustment in the window, but do deal with common case of a * retransmit */ diff -Nru a/net/ipv4/netfilter/ip_nat_proto_icmp.c b/net/ipv4/netfilter/ip_nat_proto_icmp.c --- a/net/ipv4/netfilter/ip_nat_proto_icmp.c 2004-09-26 10:25:56 -07:00 +++ b/net/ipv4/netfilter/ip_nat_proto_icmp.c 2004-09-26 10:25:56 -07:00 @@ -104,7 +104,7 @@ } struct ip_nat_protocol ip_nat_protocol_icmp -= { { NULL, NULL }, "ICMP", IPPROTO_ICMP, += { "ICMP", IPPROTO_ICMP, icmp_manip_pkt, icmp_in_range, icmp_unique_tuple, diff -Nru a/net/ipv4/netfilter/ip_nat_proto_tcp.c b/net/ipv4/netfilter/ip_nat_proto_tcp.c --- a/net/ipv4/netfilter/ip_nat_proto_tcp.c 2004-09-26 10:25:55 -07:00 +++ b/net/ipv4/netfilter/ip_nat_proto_tcp.c 2004-09-26 10:25:55 -07:00 @@ -162,7 +162,7 @@ } struct ip_nat_protocol ip_nat_protocol_tcp -= { { NULL, NULL }, "TCP", IPPROTO_TCP, += { "TCP", IPPROTO_TCP, tcp_manip_pkt, tcp_in_range, tcp_unique_tuple, diff -Nru a/net/ipv4/netfilter/ip_nat_proto_udp.c b/net/ipv4/netfilter/ip_nat_proto_udp.c --- a/net/ipv4/netfilter/ip_nat_proto_udp.c 2004-09-26 10:25:55 -07:00 +++ b/net/ipv4/netfilter/ip_nat_proto_udp.c 2004-09-26 10:25:55 -07:00 @@ -148,7 +148,7 @@ } struct ip_nat_protocol ip_nat_protocol_udp -= { { NULL, NULL }, "UDP", IPPROTO_UDP, += { "UDP", IPPROTO_UDP, udp_manip_pkt, udp_in_range, udp_unique_tuple, diff -Nru a/net/ipv4/netfilter/ip_nat_proto_unknown.c b/net/ipv4/netfilter/ip_nat_proto_unknown.c --- a/net/ipv4/netfilter/ip_nat_proto_unknown.c 2004-09-26 10:25:56 -07:00 +++ b/net/ipv4/netfilter/ip_nat_proto_unknown.c 2004-09-26 10:25:56 -07:00 @@ -60,8 +60,8 @@ return 0; } -struct ip_nat_protocol unknown_nat_protocol = { - { NULL, NULL }, "unknown", 0, +struct ip_nat_protocol ip_nat_unknown_protocol = { + "unknown", 0, unknown_manip_pkt, unknown_in_range, unknown_unique_tuple, diff -Nru a/net/ipv4/netfilter/ip_nat_standalone.c b/net/ipv4/netfilter/ip_nat_standalone.c --- a/net/ipv4/netfilter/ip_nat_standalone.c 2004-09-26 10:25:57 -07:00 +++ b/net/ipv4/netfilter/ip_nat_standalone.c 2004-09-26 10:25:57 -07:00 @@ -283,18 +283,13 @@ int ip_nat_protocol_register(struct ip_nat_protocol *proto) { int ret = 0; - struct list_head *i; WRITE_LOCK(&ip_nat_lock); - list_for_each(i, &protos) { - if (((struct ip_nat_protocol *)i)->protonum - == proto->protonum) { - ret = -EBUSY; - goto out; - } + if (ip_nat_protos[proto->protonum] != &ip_nat_unknown_protocol) { + ret = -EBUSY; + goto out; } - - list_prepend(&protos, proto); + ip_nat_protos[proto->protonum] = proto; out: WRITE_UNLOCK(&ip_nat_lock); return ret; @@ -304,7 +299,7 @@ void ip_nat_protocol_unregister(struct ip_nat_protocol *proto) { WRITE_LOCK(&ip_nat_lock); - LIST_DELETE(&protos, proto); + ip_nat_protos[proto->protonum] = &ip_nat_unknown_protocol; WRITE_UNLOCK(&ip_nat_lock); /* Someone could be still looking at the proto in a bh. */ diff -Nru a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c --- a/net/ipv4/netfilter/ip_tables.c 2004-09-26 10:25:55 -07:00 +++ b/net/ipv4/netfilter/ip_tables.c 2004-09-26 10:25:55 -07:00 @@ -1464,8 +1464,11 @@ unsigned int i; duprintf("tcp_match: finding option\n"); + + if (!optlen) + return invert; + /* If we don't have the whole header, drop packet. */ - BUG_ON(!optlen); op = skb_header_pointer(skb, skb->nh.iph->ihl*4 + sizeof(struct tcphdr), optlen, _opt); diff -Nru a/net/ipv4/netfilter/ipchains_core.c b/net/ipv4/netfilter/ipchains_core.c --- a/net/ipv4/netfilter/ipchains_core.c 2004-09-26 10:25:57 -07:00 +++ b/net/ipv4/netfilter/ipchains_core.c 2004-09-26 10:25:57 -07:00 @@ -1,3 +1,5 @@ +#warning ipchains is obsolete, and will be removed soon. + /* Minor modifications to fit on compatibility framework: Rusty.Russell@rustcorp.com.au */ diff -Nru a/net/ipv4/netfilter/ipfwadm_core.c b/net/ipv4/netfilter/ipfwadm_core.c --- a/net/ipv4/netfilter/ipfwadm_core.c 2004-09-26 10:25:56 -07:00 +++ b/net/ipv4/netfilter/ipfwadm_core.c 2004-09-26 10:25:56 -07:00 @@ -1,3 +1,5 @@ +#warning ipfwadm is obsolete, and will be removed soon. + /* Minor modifications to fit on compatibility framework: Rusty.Russell@rustcorp.com.au */ diff -Nru a/net/ipv4/netfilter/ipt_NOTRACK.c b/net/ipv4/netfilter/ipt_NOTRACK.c --- a/net/ipv4/netfilter/ipt_NOTRACK.c 2004-09-26 10:25:55 -07:00 +++ b/net/ipv4/netfilter/ipt_NOTRACK.c 2004-09-26 10:25:55 -07:00 @@ -23,7 +23,8 @@ If there is a real ct entry correspondig to this packet, it'll hang aroun till timing out. We don't deal with it for performance reasons. JK */ - (*pskb)->nfct = &ip_conntrack_untracked.infos[IP_CT_NEW]; + (*pskb)->nfct = &ip_conntrack_untracked.ct_general; + (*pskb)->nfctinfo = IP_CT_NEW; nf_conntrack_get((*pskb)->nfct); return IPT_CONTINUE; diff -Nru a/net/ipv4/netfilter/ipt_REJECT.c b/net/ipv4/netfilter/ipt_REJECT.c --- a/net/ipv4/netfilter/ipt_REJECT.c 2004-09-26 10:25:57 -07:00 +++ b/net/ipv4/netfilter/ipt_REJECT.c 2004-09-26 10:25:57 -07:00 @@ -41,14 +41,14 @@ /* If the original packet is part of a connection, but the connection is not confirmed, our manufactured reply will not be associated with it, so we need to do this manually. */ -static void connection_attach(struct sk_buff *new_skb, struct nf_ct_info *nfct) +static void connection_attach(struct sk_buff *new_skb, struct sk_buff *skb) { - void (*attach)(struct sk_buff *, struct nf_ct_info *); + void (*attach)(struct sk_buff *, struct sk_buff *); /* Avoid module unload race with ip_ct_attach being NULLed out */ - if (nfct && (attach = ip_ct_attach) != NULL) { + if (skb->nfct && (attach = ip_ct_attach) != NULL) { mb(); /* Just to be sure: must be read before executing this */ - attach(new_skb, nfct); + attach(new_skb, skb); } } @@ -209,7 +209,7 @@ if (nskb->len > dst_pmtu(nskb->dst)) goto free_nskb; - connection_attach(nskb, oldskb->nfct); + connection_attach(nskb, oldskb); NF_HOOK(PF_INET, NF_IP_LOCAL_OUT, nskb, NULL, nskb->dst->dev, ip_finish_output); @@ -360,7 +360,7 @@ icmph->checksum = ip_compute_csum((unsigned char *)icmph, length - sizeof(struct iphdr)); - connection_attach(nskb, skb_in->nfct); + connection_attach(nskb, skb_in); NF_HOOK(PF_INET, NF_IP_LOCAL_OUT, nskb, NULL, nskb->dst->dev, ip_finish_output); diff -Nru a/net/ipv4/netfilter/ipt_comment.c b/net/ipv4/netfilter/ipt_comment.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/net/ipv4/netfilter/ipt_comment.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,59 @@ +/* + * Implements a dummy match to allow attaching comments to rules + * + * 2003-05-13 Brad Fisher (brad@info-link.net) + */ + +#include +#include +#include +#include + +MODULE_AUTHOR("Brad Fisher "); +MODULE_DESCRIPTION("iptables comment match module"); +MODULE_LICENSE("GPL"); + +static int +match(const struct sk_buff *skb, + const struct net_device *in, + const struct net_device *out, + const void *matchinfo, + int offset, + int *hotdrop) +{ + /* We always match */ + return 1; +} + +static int +checkentry(const char *tablename, + const struct ipt_ip *ip, + void *matchinfo, + unsigned int matchsize, + unsigned int hook_mask) +{ + /* Check the size */ + if (matchsize != IPT_ALIGN(sizeof(struct ipt_comment_info))) + return 0; + return 1; +} + +static struct ipt_match comment_match = { + .name = "comment", + .match = match, + .checkentry = checkentry, + .me = THIS_MODULE +}; + +static int __init init(void) +{ + return ipt_register_match(&comment_match); +} + +static void __exit fini(void) +{ + ipt_unregister_match(&comment_match); +} + +module_init(init); +module_exit(fini); diff -Nru a/net/ipv4/netfilter/ipt_conntrack.c b/net/ipv4/netfilter/ipt_conntrack.c --- a/net/ipv4/netfilter/ipt_conntrack.c 2004-09-26 10:25:57 -07:00 +++ b/net/ipv4/netfilter/ipt_conntrack.c 2004-09-26 10:25:57 -07:00 @@ -35,7 +35,7 @@ #define FWINV(bool,invflg) ((bool) ^ !!(sinfo->invflags & invflg)) - if (skb->nfct == &ip_conntrack_untracked.infos[IP_CT_NEW]) + if (ct == &ip_conntrack_untracked) statebit = IPT_CONNTRACK_STATE_UNTRACKED; else if (ct) statebit = IPT_CONNTRACK_STATE_BIT(ctinfo); diff -Nru a/net/ipv4/netfilter/ipt_state.c b/net/ipv4/netfilter/ipt_state.c --- a/net/ipv4/netfilter/ipt_state.c 2004-09-26 10:25:57 -07:00 +++ b/net/ipv4/netfilter/ipt_state.c 2004-09-26 10:25:57 -07:00 @@ -30,9 +30,9 @@ enum ip_conntrack_info ctinfo; unsigned int statebit; - if (skb->nfct == &ip_conntrack_untracked.infos[IP_CT_NEW]) + if (skb->nfct == &ip_conntrack_untracked.ct_general) statebit = IPT_STATE_UNTRACKED; - else if (!ip_conntrack_get((struct sk_buff *)skb, &ctinfo)) + else if (!ip_conntrack_get(skb, &ctinfo)) statebit = IPT_STATE_INVALID; else statebit = IPT_STATE_BIT(ctinfo); diff -Nru a/net/ipv4/raw.c b/net/ipv4/raw.c --- a/net/ipv4/raw.c 2004-09-26 10:25:56 -07:00 +++ b/net/ipv4/raw.c 2004-09-26 10:25:56 -07:00 @@ -719,6 +719,7 @@ .backlog_rcv = raw_rcv_skb, .hash = raw_v4_hash, .unhash = raw_v4_unhash, + .slab_obj_size = sizeof(struct raw_sock), }; #ifdef CONFIG_PROC_FS diff -Nru a/net/ipv4/route.c b/net/ipv4/route.c --- a/net/ipv4/route.c 2004-09-26 10:25:57 -07:00 +++ b/net/ipv4/route.c 2004-09-26 10:25:57 -07:00 @@ -2206,22 +2206,27 @@ return ip_route_output_slow(rp, flp); } -int ip_route_output_key(struct rtable **rp, struct flowi *flp) +int ip_route_output_flow(struct rtable **rp, struct flowi *flp, struct sock *sk, int flags) { int err; if ((err = __ip_route_output_key(rp, flp)) != 0) return err; - return flp->proto ? xfrm_lookup((struct dst_entry**)rp, flp, NULL, 0) : 0; + + if (flp->proto) { + if (!flp->fl4_src) + flp->fl4_src = (*rp)->rt_src; + if (!flp->fl4_dst) + flp->fl4_dst = (*rp)->rt_dst; + return xfrm_lookup((struct dst_entry **)rp, flp, sk, flags); + } + + return 0; } -int ip_route_output_flow(struct rtable **rp, struct flowi *flp, struct sock *sk, int flags) +int ip_route_output_key(struct rtable **rp, struct flowi *flp) { - int err; - - if ((err = __ip_route_output_key(rp, flp)) != 0) - return err; - return flp->proto ? xfrm_lookup((struct dst_entry**)rp, flp, sk, flags) : 0; + return ip_route_output_flow(rp, flp, NULL, 0); } static int rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq, int event, diff -Nru a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c --- a/net/ipv4/tcp_ipv4.c 2004-09-26 10:25:56 -07:00 +++ b/net/ipv4/tcp_ipv4.c 2004-09-26 10:25:56 -07:00 @@ -1033,11 +1033,7 @@ switch (type) { case ICMP_SOURCE_QUENCH: - /* This is deprecated, but if someone generated it, - * we have no reasons to ignore it. - */ - if (!sock_owned_by_user(sk)) - tcp_enter_cwr(tp); + /* Just silently ignore these. */ goto out; case ICMP_PARAMETERPROB: err = EPROTO; @@ -2617,6 +2613,7 @@ .sysctl_wmem = sysctl_tcp_wmem, .sysctl_rmem = sysctl_tcp_rmem, .max_header = MAX_TCP_HEADER, + .slab_obj_size = sizeof(struct tcp_sock), }; diff -Nru a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c --- a/net/ipv4/tcp_minisocks.c 2004-09-26 10:25:57 -07:00 +++ b/net/ipv4/tcp_minisocks.c 2004-09-26 10:25:57 -07:00 @@ -687,7 +687,7 @@ /* allocate the newsk from the same slab of the master sock, * if not, at sk_free time we'll try to free it from the wrong * slabcache (i.e. is it TCPv4 or v6?) -acme */ - struct sock *newsk = sk_alloc(PF_INET, GFP_ATOMIC, 0, sk->sk_slab); + struct sock *newsk = sk_alloc(PF_INET, GFP_ATOMIC, 0, sk->sk_prot->slab); if(newsk != NULL) { struct tcp_opt *newtp; diff -Nru a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c --- a/net/ipv4/tcp_output.c 2004-09-26 10:25:56 -07:00 +++ b/net/ipv4/tcp_output.c 2004-09-26 10:25:56 -07:00 @@ -991,7 +991,7 @@ /* New SKB created, account for it. */ new_factor = TCP_SKB_CB(skb)->tso_factor; tcp_dec_pcount_explicit(&tp->packets_out, - new_factor - old_factor); + old_factor - new_factor); tcp_inc_pcount(&tp->packets_out, skb->next); } diff -Nru a/net/ipv4/udp.c b/net/ipv4/udp.c --- a/net/ipv4/udp.c 2004-09-26 10:25:55 -07:00 +++ b/net/ipv4/udp.c 2004-09-26 10:25:55 -07:00 @@ -1320,6 +1320,7 @@ .hash = udp_v4_hash, .unhash = udp_v4_unhash, .get_port = udp_v4_get_port, + .slab_obj_size = sizeof(struct udp_sock), }; /* ------------------------------------------------------------------------ */ diff -Nru a/net/ipv4/xfrm4_input.c b/net/ipv4/xfrm4_input.c --- a/net/ipv4/xfrm4_input.c 2004-09-26 10:25:55 -07:00 +++ b/net/ipv4/xfrm4_input.c 2004-09-26 10:25:55 -07:00 @@ -101,6 +101,8 @@ if (skb_cloned(skb) && pskb_expand_head(skb, 0, 0, GFP_ATOMIC)) goto drop; + if (x->props.flags & XFRM_STATE_DECAP_DSCP) + ipv4_copy_dscp(iph, skb->h.ipiph); if (!(x->props.flags & XFRM_STATE_NOECN)) ipip_ecn_decapsulate(skb); skb->mac.raw = memmove(skb->data - skb->mac_len, diff -Nru a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c --- a/net/ipv6/af_inet6.c 2004-09-26 10:25:56 -07:00 +++ b/net/ipv6/af_inet6.c 2004-09-26 10:25:56 -07:00 @@ -90,11 +90,6 @@ atomic_t inet6_sock_nr; #endif -/* Per protocol sock slabcache */ -kmem_cache_t *tcp6_sk_cachep; -kmem_cache_t *udp6_sk_cachep; -kmem_cache_t *raw6_sk_cachep; - /* The inetsw table contains everything that inet_create needs to * build a new socket. */ @@ -110,37 +105,11 @@ #endif } -static __inline__ kmem_cache_t *inet6_sk_slab(int protocol) -{ - kmem_cache_t* rc = tcp6_sk_cachep; - - if (protocol == IPPROTO_UDP) - rc = udp6_sk_cachep; - else if (protocol == IPPROTO_RAW) - rc = raw6_sk_cachep; - return rc; -} - -static __inline__ int inet6_sk_size(int protocol) -{ - int rc = sizeof(struct tcp6_sock); - - if (protocol == IPPROTO_UDP) - rc = sizeof(struct udp6_sock); - else if (protocol == IPPROTO_RAW) - rc = sizeof(struct raw6_sock); - return rc; -} - static __inline__ struct ipv6_pinfo *inet6_sk_generic(struct sock *sk) { - struct ipv6_pinfo *rc = (&((struct tcp6_sock *)sk)->inet6); + const struct ipv6_sk_offset *offset = sk->sk_prot->af_specific; - if (sk->sk_protocol == IPPROTO_UDP) - rc = (&((struct udp6_sock *)sk)->inet6); - else if (sk->sk_protocol == IPPROTO_RAW) - rc = (&((struct raw6_sock *)sk)->inet6); - return rc; + return (struct ipv6_pinfo *)(((u8 *)sk) + offset->offset); } static int inet6_create(struct socket *sock, int protocol) @@ -151,11 +120,10 @@ struct tcp6_sock* tcp6sk; struct list_head *p; struct inet_protosw *answer; - - sk = sk_alloc(PF_INET6, GFP_KERNEL, inet6_sk_size(protocol), - inet6_sk_slab(protocol)); - if (sk == NULL) - goto do_oom; + struct proto *answer_prot; + unsigned char answer_flags; + char answer_no_check; + int rc; /* Look for the requested type/protocol pair. */ answer = NULL; @@ -179,22 +147,40 @@ answer = NULL; } + rc = -ESOCKTNOSUPPORT; if (!answer) - goto free_and_badtype; + goto out_rcu_unlock; + rc = -EPERM; if (answer->capability > 0 && !capable(answer->capability)) - goto free_and_badperm; + goto out_rcu_unlock; + rc = -EPROTONOSUPPORT; if (!protocol) - goto free_and_noproto; + goto out_rcu_unlock; sock->ops = answer->ops; + + answer_prot = answer->prot; + answer_no_check = answer->no_check; + answer_flags = answer->flags; + rcu_read_unlock(); + + BUG_TRAP(answer_prot->slab != NULL); + + rc = -ENOBUFS; + sk = sk_alloc(PF_INET6, GFP_KERNEL, + answer_prot->slab_obj_size, + answer_prot->slab); + if (sk == NULL) + goto out; + sock_init_data(sock, sk); sk_set_owner(sk, THIS_MODULE); - sk->sk_prot = answer->prot; - sk->sk_no_check = answer->no_check; - if (INET_PROTOSW_REUSE & answer->flags) + rc = 0; + sk->sk_prot = answer_prot; + sk->sk_no_check = answer_no_check; + if (INET_PROTOSW_REUSE & answer_flags) sk->sk_reuse = 1; - rcu_read_unlock(); inet = inet_sk(sk); @@ -248,28 +234,17 @@ sk->sk_prot->hash(sk); } if (sk->sk_prot->init) { - int err = sk->sk_prot->init(sk); - if (err != 0) { + rc = sk->sk_prot->init(sk); + if (rc) { sk_common_release(sk); - return err; + goto out; } } - return 0; - -free_and_badtype: - rcu_read_unlock(); - sk_free(sk); - return -ESOCKTNOSUPPORT; -free_and_badperm: - rcu_read_unlock(); - sk_free(sk); - return -EPERM; -free_and_noproto: +out: + return rc; +out_rcu_unlock: rcu_read_unlock(); - sk_free(sk); - return -EPROTONOSUPPORT; -do_oom: - return -ENOBUFS; + goto out; } @@ -709,24 +684,26 @@ #endif #endif - if (sizeof(struct inet6_skb_parm) > sizeof(dummy_skb->cb)) - { + if (sizeof(struct inet6_skb_parm) > sizeof(dummy_skb->cb)) { printk(KERN_CRIT "inet6_proto_init: size fault\n"); return -EINVAL; } - /* allocate our sock slab caches */ - tcp6_sk_cachep = kmem_cache_create("tcp6_sock", - sizeof(struct tcp6_sock), 0, - SLAB_HWCACHE_ALIGN, NULL, NULL); - udp6_sk_cachep = kmem_cache_create("udp6_sock", - sizeof(struct udp6_sock), 0, - SLAB_HWCACHE_ALIGN, NULL, NULL); - raw6_sk_cachep = kmem_cache_create("raw6_sock", - sizeof(struct raw6_sock), 0, - SLAB_HWCACHE_ALIGN, NULL, NULL); - if (!tcp6_sk_cachep || !udp6_sk_cachep || !raw6_sk_cachep) - printk(KERN_CRIT "%s: Can't create protocol sock SLAB " - "caches!\n", __FUNCTION__); + + err = sk_alloc_slab(&tcpv6_prot, "tcpv6_sock"); + if (err) { + sk_alloc_slab_error(&tcpv6_prot); + goto out; + } + err = sk_alloc_slab(&udpv6_prot, "udpv6_sock"); + if (err) { + sk_alloc_slab_error(&udpv6_prot); + goto out_tcp_free_slab; + } + err = sk_alloc_slab(&rawv6_prot, "rawv6_sock"); + if (err) { + sk_alloc_slab_error(&rawv6_prot); + goto out_udp_free_slab; + } /* Register the socket-side information for inet6_create. */ for(r = &inetsw6[0]; r < &inetsw6[SOCK_MAX]; ++r) @@ -745,7 +722,7 @@ /* Initialise ipv6 mibs */ err = init_ipv6_mibs(); if (err) - goto init_mib_fail; + goto out_raw_free_slab; /* * ipngwg API draft makes clear that the correct semantics @@ -798,8 +775,9 @@ /* Init v6 transport protocols. */ udpv6_init(); tcpv6_init(); - - return 0; + err = 0; +out: + return err; #ifdef CONFIG_PROC_FS proc_if6_fail: @@ -824,8 +802,13 @@ ipv6_sysctl_unregister(); #endif cleanup_ipv6_mibs(); -init_mib_fail: - return err; +out_raw_free_slab: + sk_free_slab(&rawv6_prot); +out_udp_free_slab: + sk_free_slab(&udpv6_prot); +out_tcp_free_slab: + sk_free_slab(&tcpv6_prot); + goto out; } module_init(inet6_init); @@ -854,9 +837,9 @@ ipv6_sysctl_unregister(); #endif cleanup_ipv6_mibs(); - kmem_cache_destroy(tcp6_sk_cachep); - kmem_cache_destroy(udp6_sk_cachep); - kmem_cache_destroy(raw6_sk_cachep); + sk_free_slab(&rawv6_prot); + sk_free_slab(&udpv6_prot); + sk_free_slab(&tcpv6_prot); } module_exit(inet6_exit); diff -Nru a/net/ipv6/icmp.c b/net/ipv6/icmp.c --- a/net/ipv6/icmp.c 2004-09-26 10:25:56 -07:00 +++ b/net/ipv6/icmp.c 2004-09-26 10:25:56 -07:00 @@ -372,6 +372,8 @@ err = ip6_dst_lookup(sk, &dst, &fl); if (err) goto out; + if ((err = xfrm_lookup(&dst, &fl, sk, 0)) < 0) + goto out_dst_release; if (hlimit < 0) { if (ipv6_addr_is_multicast(&fl.fl6_dst)) @@ -458,6 +460,8 @@ err = ip6_dst_lookup(sk, &dst, &fl); if (err) goto out; + if ((err = xfrm_lookup(&dst, &fl, sk, 0)) < 0) + goto out_dst_release; if (hlimit < 0) { if (ipv6_addr_is_multicast(&fl.fl6_dst)) @@ -489,6 +493,7 @@ out_put: if (likely(idev != NULL)) in6_dev_put(idev); +out_dst_release: dst_release(dst); out: icmpv6_xmit_unlock(); diff -Nru a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c --- a/net/ipv6/ip6_fib.c 2004-09-26 10:25:57 -07:00 +++ b/net/ipv6/ip6_fib.c 2004-09-26 10:25:57 -07:00 @@ -1184,6 +1184,7 @@ if (rt->rt6i_flags&RTF_EXPIRES && rt->rt6i_expires) { if (time_after(now, rt->rt6i_expires)) { RT6_TRACE("expiring %p\n", rt); + rt6_reset_dflt_pointer(rt); return -1; } gc_args.more++; @@ -1191,6 +1192,11 @@ if (atomic_read(&rt->u.dst.__refcnt) == 0 && time_after_eq(now, rt->u.dst.lastuse + gc_args.timeout)) { RT6_TRACE("aging clone %p\n", rt); + return -1; + } else if ((rt->rt6i_flags & RTF_GATEWAY) && + (!(rt->rt6i_nexthop->flags & NTF_ROUTER))) { + RT6_TRACE("purging route %p via non-router but gateway\n", + rt); return -1; } gc_args.more++; diff -Nru a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c --- a/net/ipv6/ip6_output.c 2004-09-26 10:25:55 -07:00 +++ b/net/ipv6/ip6_output.c 2004-09-26 10:25:55 -07:00 @@ -477,6 +477,7 @@ /* Connection association is same as pre-frag packet */ to->nfct = from->nfct; nf_conntrack_get(to->nfct); + to->nfctinfo = from->nfctinfo; #ifdef CONFIG_BRIDGE_NETFILTER nf_bridge_put(to->nf_bridge); to->nf_bridge = from->nf_bridge; diff -Nru a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c --- a/net/ipv6/ip6_tunnel.c 2004-09-26 10:25:55 -07:00 +++ b/net/ipv6/ip6_tunnel.c 2004-09-26 10:25:55 -07:00 @@ -542,6 +542,8 @@ skb->dev = t->dev; dst_release(skb->dst); skb->dst = NULL; + if (t->parms.flags & IP6_TNL_F_RCV_DSCP_COPY) + ipv6_copy_dscp(ipv6h, skb->nh.ipv6h); ip6ip6_ecn_decapsulate(ipv6h, skb); t->stat.rx_packets++; t->stat.rx_bytes += skb->len; diff -Nru a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c --- a/net/ipv6/ndisc.c 2004-09-26 10:25:56 -07:00 +++ b/net/ipv6/ndisc.c 2004-09-26 10:25:56 -07:00 @@ -810,8 +810,12 @@ * update / create cache entry * for the source address */ - neigh = neigh_event_ns(&nd_tbl, lladdr, saddr, dev); - + neigh = __neigh_lookup(&nd_tbl, saddr, dev, + !inc || lladdr || !dev->addr_len); + if (neigh) + neigh_update(neigh, lladdr, NUD_STALE, + NEIGH_UPDATE_F_WEAK_OVERRIDE| + NEIGH_UPDATE_F_OVERRIDE); if (neigh || !dev->hard_header) { ndisc_send_na(dev, neigh, saddr, &msg->target, idev->cnf.forwarding, @@ -894,24 +898,25 @@ neigh = neigh_lookup(&nd_tbl, &msg->target, dev); if (neigh) { - if (neigh->flags & NTF_ROUTER) { - if (msg->icmph.icmp6_router == 0) { - /* - * Change: router to host - */ - struct rt6_info *rt; - rt = rt6_get_dflt_router(saddr, dev); - if (rt) - ip6_del_rt(rt, NULL, NULL); - } - } else { - if (msg->icmph.icmp6_router) - neigh->flags |= NTF_ROUTER; - } + u8 old_flags = neigh->flags; neigh_update(neigh, lladdr, msg->icmph.icmp6_solicited ? NUD_REACHABLE : NUD_STALE, - msg->icmph.icmp6_override, 1); + NEIGH_UPDATE_F_WEAK_OVERRIDE| + (msg->icmph.icmp6_override ? NEIGH_UPDATE_F_OVERRIDE : 0)| + NEIGH_UPDATE_F_OVERRIDE_ISROUTER| + (msg->icmph.icmp6_router ? NEIGH_UPDATE_F_ISROUTER : 0)); + + if ((old_flags & ~neigh->flags) & NTF_ROUTER) { + /* + * Change: router to host + */ + struct rt6_info *rt; + rt = rt6_get_dflt_router(saddr, dev); + if (rt) + ip6_del_rt(rt, NULL, NULL); + } + neigh_release(neigh); } } @@ -1079,7 +1084,11 @@ goto out; } } - neigh_update(neigh, lladdr, NUD_STALE, 1, 1); + neigh_update(neigh, lladdr, NUD_STALE, + NEIGH_UPDATE_F_WEAK_OVERRIDE| + NEIGH_UPDATE_F_OVERRIDE| + NEIGH_UPDATE_F_OVERRIDE_ISROUTER| + NEIGH_UPDATE_F_ISROUTER); } if (ndopts.nd_opts_pi) { @@ -1196,19 +1205,11 @@ return; } } - /* passed validation tests */ - - /* - We install redirect only if nexthop state is valid. - */ neigh = __neigh_lookup(&nd_tbl, target, skb->dev, 1); if (neigh) { - neigh_update(neigh, lladdr, NUD_STALE, 1, 1); - if (neigh->nud_state&NUD_VALID) - rt6_redirect(dest, &skb->nh.ipv6h->saddr, neigh, on_link); - else - __neigh_event_send(neigh, NULL); + rt6_redirect(dest, &skb->nh.ipv6h->saddr, neigh, lladdr, + on_link); neigh_release(neigh); } in6_dev_put(in6_dev); diff -Nru a/net/ipv6/netfilter/Kconfig b/net/ipv6/netfilter/Kconfig --- a/net/ipv6/netfilter/Kconfig 2004-09-26 10:25:57 -07:00 +++ b/net/ipv6/netfilter/Kconfig 2004-09-26 10:25:57 -07:00 @@ -158,6 +158,15 @@ To compile it as a module, choose M here. If unsure, say N. +config IP6_NF_MATCH_PHYSDEV + tristate "Physdev match support" + depends on IP6_NF_IPTABLES && BRIDGE_NETFILTER + help + Physdev packet matching matches against the physical bridge ports + the IP packet arrived on or will leave by. + + To compile it as a module, choose M here. If unsure, say N. + # dep_tristate ' Multiple port match support' CONFIG_IP6_NF_MATCH_MULTIPORT $CONFIG_IP6_NF_IPTABLES # dep_tristate ' TOS match support' CONFIG_IP6_NF_MATCH_TOS $CONFIG_IP6_NF_IPTABLES # if [ "$CONFIG_IP6_NF_CONNTRACK" != "n" ]; then diff -Nru a/net/ipv6/netfilter/Makefile b/net/ipv6/netfilter/Makefile --- a/net/ipv6/netfilter/Makefile 2004-09-26 10:25:56 -07:00 +++ b/net/ipv6/netfilter/Makefile 2004-09-26 10:25:56 -07:00 @@ -16,6 +16,7 @@ obj-$(CONFIG_IP6_NF_MATCH_EUI64) += ip6t_eui64.o obj-$(CONFIG_IP6_NF_MATCH_MULTIPORT) += ip6t_multiport.o obj-$(CONFIG_IP6_NF_MATCH_OWNER) += ip6t_owner.o +obj-$(CONFIG_IP6_NF_MATCH_PHYSDEV) += ip6t_physdev.o obj-$(CONFIG_IP6_NF_FILTER) += ip6table_filter.o obj-$(CONFIG_IP6_NF_MANGLE) += ip6table_mangle.o obj-$(CONFIG_IP6_NF_TARGET_MARK) += ip6t_MARK.o diff -Nru a/net/ipv6/netfilter/ip6t_physdev.c b/net/ipv6/netfilter/ip6t_physdev.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/net/ipv6/netfilter/ip6t_physdev.c 2004-09-26 10:25:58 -07:00 @@ -0,0 +1,136 @@ +/* Kernel module to match the bridge port in and + * out device for IP packets coming into contact with a bridge. */ + +/* (C) 2001-2003 Bart De Schuymer + * + * 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. + */ + +#include +#include +#include +#include +#include +#define MATCH 1 +#define NOMATCH 0 + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Bart De Schuymer "); +MODULE_DESCRIPTION("iptables bridge physical device match module"); + +static int +match(const struct sk_buff *skb, + const struct net_device *in, + const struct net_device *out, + const void *matchinfo, + int offset, + const void *hdr, + u_int16_t datalen, + int *hotdrop) +{ + int i; + static const char nulldevname[IFNAMSIZ]; + const struct ip6t_physdev_info *info = matchinfo; + unsigned int ret; + const char *indev, *outdev; + struct nf_bridge_info *nf_bridge; + + /* Not a bridged IP packet or no info available yet: + * LOCAL_OUT/mangle and LOCAL_OUT/nat don't know if + * the destination device will be a bridge. */ + if (!(nf_bridge = skb->nf_bridge)) { + /* Return MATCH if the invert flags of the used options are on */ + if ((info->bitmask & IP6T_PHYSDEV_OP_BRIDGED) && + !(info->invert & IP6T_PHYSDEV_OP_BRIDGED)) + return NOMATCH; + if ((info->bitmask & IP6T_PHYSDEV_OP_ISIN) && + !(info->invert & IP6T_PHYSDEV_OP_ISIN)) + return NOMATCH; + if ((info->bitmask & IP6T_PHYSDEV_OP_ISOUT) && + !(info->invert & IP6T_PHYSDEV_OP_ISOUT)) + return NOMATCH; + if ((info->bitmask & IP6T_PHYSDEV_OP_IN) && + !(info->invert & IP6T_PHYSDEV_OP_IN)) + return NOMATCH; + if ((info->bitmask & IP6T_PHYSDEV_OP_OUT) && + !(info->invert & IP6T_PHYSDEV_OP_OUT)) + return NOMATCH; + return MATCH; + } + + /* This only makes sense in the FORWARD and POSTROUTING chains */ + if ((info->bitmask & IP6T_PHYSDEV_OP_BRIDGED) && + (!!(nf_bridge->mask & BRNF_BRIDGED) ^ + !(info->invert & IP6T_PHYSDEV_OP_BRIDGED))) + return NOMATCH; + + if ((info->bitmask & IP6T_PHYSDEV_OP_ISIN && + (!nf_bridge->physindev ^ !!(info->invert & IP6T_PHYSDEV_OP_ISIN))) || + (info->bitmask & IP6T_PHYSDEV_OP_ISOUT && + (!nf_bridge->physoutdev ^ !!(info->invert & IP6T_PHYSDEV_OP_ISOUT)))) + return NOMATCH; + + if (!(info->bitmask & IP6T_PHYSDEV_OP_IN)) + goto match_outdev; + indev = nf_bridge->physindev ? nf_bridge->physindev->name : nulldevname; + for (i = 0, ret = 0; i < IFNAMSIZ/sizeof(unsigned int); i++) { + ret |= (((const unsigned int *)indev)[i] + ^ ((const unsigned int *)info->physindev)[i]) + & ((const unsigned int *)info->in_mask)[i]; + } + + if ((ret == 0) ^ !(info->invert & IP6T_PHYSDEV_OP_IN)) + return NOMATCH; + +match_outdev: + if (!(info->bitmask & IP6T_PHYSDEV_OP_OUT)) + return MATCH; + outdev = nf_bridge->physoutdev ? + nf_bridge->physoutdev->name : nulldevname; + for (i = 0, ret = 0; i < IFNAMSIZ/sizeof(unsigned int); i++) { + ret |= (((const unsigned int *)outdev)[i] + ^ ((const unsigned int *)info->physoutdev)[i]) + & ((const unsigned int *)info->out_mask)[i]; + } + + return (ret != 0) ^ !(info->invert & IP6T_PHYSDEV_OP_OUT); +} + +static int +checkentry(const char *tablename, + const struct ip6t_ip6 *ip, + void *matchinfo, + unsigned int matchsize, + unsigned int hook_mask) +{ + const struct ip6t_physdev_info *info = matchinfo; + + if (matchsize != IP6T_ALIGN(sizeof(struct ip6t_physdev_info))) + return 0; + if (!(info->bitmask & IP6T_PHYSDEV_OP_MASK) || + info->bitmask & ~IP6T_PHYSDEV_OP_MASK) + return 0; + return 1; +} + +static struct ip6t_match physdev_match = { + .name = "physdev", + .match = &match, + .checkentry = &checkentry, + .me = THIS_MODULE, +}; + +static int __init init(void) +{ + return ip6t_register_match(&physdev_match); +} + +static void __exit fini(void) +{ + ip6t_unregister_match(&physdev_match); +} + +module_init(init); +module_exit(fini); diff -Nru a/net/ipv6/raw.c b/net/ipv6/raw.c --- a/net/ipv6/raw.c 2004-09-26 10:25:56 -07:00 +++ b/net/ipv6/raw.c 2004-09-26 10:25:56 -07:00 @@ -973,6 +973,10 @@ return(0); } +struct ipv6_sk_offset raw_sock_offset = { + .offset = offsetof(struct raw6_sock, inet6), +}; + struct proto rawv6_prot = { .name = "RAW", .close = rawv6_close, @@ -989,6 +993,8 @@ .backlog_rcv = rawv6_rcv_skb, .hash = raw_v6_hash, .unhash = raw_v6_unhash, + .slab_obj_size = sizeof(struct raw6_sock), + .af_specific = &raw_sock_offset, }; #ifdef CONFIG_PROC_FS diff -Nru a/net/ipv6/route.c b/net/ipv6/route.c --- a/net/ipv6/route.c 2004-09-26 10:25:57 -07:00 +++ b/net/ipv6/route.c 2004-09-26 10:25:57 -07:00 @@ -208,8 +208,18 @@ /* * pointer to the last default router chosen. BH is disabled locally. */ -static struct rt6_info *rt6_dflt_pointer; -static spinlock_t rt6_dflt_lock = SPIN_LOCK_UNLOCKED; +struct rt6_info *rt6_dflt_pointer; +spinlock_t rt6_dflt_lock = SPIN_LOCK_UNLOCKED; + +void rt6_reset_dflt_pointer(struct rt6_info *rt) +{ + spin_lock_bh(&rt6_dflt_lock); + if (rt == NULL || rt == rt6_dflt_pointer) { + RT6_TRACE("reset default router: %p->NULL\n", rt6_dflt_pointer); + rt6_dflt_pointer = NULL; + } + spin_unlock_bh(&rt6_dflt_lock); +} /* Default Router Selection (RFC 2461 6.3.6) */ static struct rt6_info *rt6_best_dflt(struct rt6_info *rt, int oif) @@ -227,6 +237,10 @@ sprt->rt6i_dev->ifindex == oif)) m += 8; + if ((sprt->rt6i_flags & RTF_EXPIRES) && + time_after(jiffies, sprt->rt6i_expires)) + continue; + if (sprt == rt6_dflt_pointer) m += 4; @@ -956,9 +970,7 @@ write_lock_bh(&rt6_lock); - spin_lock_bh(&rt6_dflt_lock); - rt6_dflt_pointer = NULL; - spin_unlock_bh(&rt6_dflt_lock); + rt6_reset_dflt_pointer(NULL); dst_release(&rt->u.dst); @@ -1007,7 +1019,7 @@ * Handle redirects */ void rt6_redirect(struct in6_addr *dest, struct in6_addr *saddr, - struct neighbour *neigh, int on_link) + struct neighbour *neigh, u8 *lladdr, int on_link) { struct rt6_info *rt, *nrt; @@ -1020,22 +1032,13 @@ if (neigh->dev != rt->rt6i_dev) goto out; - /* Redirect received -> path was valid. - Look, redirects are sent only in response to data packets, - so that this nexthop apparently is reachable. --ANK - */ - dst_confirm(&rt->u.dst); - - /* Duplicate redirect: silently ignore. */ - if (neigh == rt->u.dst.neighbour) - goto out; - - /* Current route is on-link; redirect is always invalid. - - Seems, previous statement is not true. It could - be node, which looks for us as on-link (f.e. proxy ndisc) - But then router serving it might decide, that we should - know truth 8)8) --ANK (980726). + /* + * Current route is on-link; redirect is always invalid. + * + * Seems, previous statement is not true. It could + * be node, which looks for us as on-link (f.e. proxy ndisc) + * But then router serving it might decide, that we should + * know truth 8)8) --ANK (980726). */ if (!(rt->rt6i_flags&RTF_GATEWAY)) goto out; @@ -1047,7 +1050,6 @@ * is a bit fuzzy and one might need to check all default * routers. */ - if (ipv6_addr_cmp(saddr, &rt->rt6i_gateway)) { if (rt->rt6i_flags & RTF_DEFAULT) { struct rt6_info *rt1; @@ -1076,6 +1078,24 @@ * We have finally decided to accept it. */ + neigh_update(neigh, lladdr, NUD_STALE, + NEIGH_UPDATE_F_WEAK_OVERRIDE| + NEIGH_UPDATE_F_OVERRIDE| + (on_link ? 0 : (NEIGH_UPDATE_F_OVERRIDE_ISROUTER| + NEIGH_UPDATE_F_ISROUTER)) + ); + + /* + * Redirect received -> path was valid. + * Look, redirects are sent only in response to data packets, + * so that this nexthop apparently is reachable. --ANK + */ + dst_confirm(&rt->u.dst); + + /* Duplicate redirect: silently ignore. */ + if (neigh == rt->u.dst.neighbour) + goto out; + nrt = ip6_rt_copy(rt); if (nrt == NULL) goto out; @@ -1253,7 +1273,7 @@ rtmsg.rtmsg_type = RTMSG_NEWROUTE; ipv6_addr_copy(&rtmsg.rtmsg_gateway, gwaddr); rtmsg.rtmsg_metric = 1024; - rtmsg.rtmsg_flags = RTF_GATEWAY | RTF_ADDRCONF | RTF_DEFAULT | RTF_UP; + rtmsg.rtmsg_flags = RTF_GATEWAY | RTF_ADDRCONF | RTF_DEFAULT | RTF_UP | RTF_EXPIRES; rtmsg.rtmsg_ifindex = dev->ifindex; @@ -1277,9 +1297,7 @@ if (rt->rt6i_flags & flags) { dst_hold(&rt->u.dst); - spin_lock_bh(&rt6_dflt_lock); - rt6_dflt_pointer = NULL; - spin_unlock_bh(&rt6_dflt_lock); + rt6_reset_dflt_pointer(NULL); read_unlock_bh(&rt6_lock); diff -Nru a/net/ipv6/sit.c b/net/ipv6/sit.c --- a/net/ipv6/sit.c 2004-09-26 10:25:57 -07:00 +++ b/net/ipv6/sit.c 2004-09-26 10:25:57 -07:00 @@ -50,6 +50,7 @@ #include #include #include +#include /* This version of net/ipv6/sit.c is cloned of net/ipv4/ip_gre.c @@ -566,7 +567,7 @@ iph->frag_off = 0; iph->protocol = IPPROTO_IPV6; - iph->tos = INET_ECN_encapsulate(tos, ip6_get_dsfield(iph6)); + iph->tos = INET_ECN_encapsulate(tos, ipv6_get_dsfield(iph6)); iph->daddr = rt->rt_dst; iph->saddr = rt->rt_src; diff -Nru a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c --- a/net/ipv6/tcp_ipv6.c 2004-09-26 10:25:56 -07:00 +++ b/net/ipv6/tcp_ipv6.c 2004-09-26 10:25:56 -07:00 @@ -57,6 +57,7 @@ #include #include #include +#include #include @@ -1646,7 +1647,7 @@ skb->len - th->doff*4); TCP_SKB_CB(skb)->ack_seq = ntohl(th->ack_seq); TCP_SKB_CB(skb)->when = 0; - TCP_SKB_CB(skb)->flags = ip6_get_dsfield(skb->nh.ipv6h); + TCP_SKB_CB(skb)->flags = ipv6_get_dsfield(skb->nh.ipv6h); TCP_SKB_CB(skb)->sacked = 0; sk = __tcp_v6_lookup(&skb->nh.ipv6h->saddr, th->source, @@ -2119,6 +2120,10 @@ } #endif +struct ipv6_sk_offset tcp_sock_offset = { + .offset = offsetof(struct tcp6_sock, inet6), +}; + struct proto tcpv6_prot = { .name = "TCPv6", .close = tcp_close, @@ -2145,6 +2150,8 @@ .sysctl_wmem = sysctl_tcp_wmem, .sysctl_rmem = sysctl_tcp_rmem, .max_header = MAX_TCP_HEADER, + .slab_obj_size = sizeof(struct tcp6_sock), + .af_specific = &tcp_sock_offset, }; static struct inet6_protocol tcpv6_protocol = { diff -Nru a/net/ipv6/udp.c b/net/ipv6/udp.c --- a/net/ipv6/udp.c 2004-09-26 10:25:57 -07:00 +++ b/net/ipv6/udp.c 2004-09-26 10:25:57 -07:00 @@ -1031,6 +1031,10 @@ /* ------------------------------------------------------------------------ */ +struct ipv6_sk_offset udp_sock_offset = { + .offset = offsetof(struct udp6_sock, inet6), +}; + struct proto udpv6_prot = { .name = "UDP", .close = udpv6_close, @@ -1046,6 +1050,8 @@ .hash = udp_v6_hash, .unhash = udp_v6_unhash, .get_port = udp_v6_get_port, + .slab_obj_size = sizeof(struct udp6_sock), + .af_specific = &udp_sock_offset, }; extern struct proto_ops inet6_dgram_ops; diff -Nru a/net/ipv6/xfrm6_input.c b/net/ipv6/xfrm6_input.c --- a/net/ipv6/xfrm6_input.c 2004-09-26 10:25:57 -07:00 +++ b/net/ipv6/xfrm6_input.c 2004-09-26 10:25:57 -07:00 @@ -11,6 +11,7 @@ #include #include +#include #include #include #include @@ -21,7 +22,7 @@ struct ipv6hdr *outer_iph = skb->nh.ipv6h; struct ipv6hdr *inner_iph = skb->h.ipv6h; - if (INET_ECN_is_ce(ip6_get_dsfield(outer_iph))) + if (INET_ECN_is_ce(ipv6_get_dsfield(outer_iph))) IP6_ECN_set_ce(inner_iph); } @@ -87,6 +88,8 @@ if (skb_cloned(skb) && pskb_expand_head(skb, 0, 0, GFP_ATOMIC)) goto drop; + if (x->props.flags & XFRM_STATE_DECAP_DSCP) + ipv6_copy_dscp(skb->nh.ipv6h, skb->h.ipv6h); if (!(x->props.flags & XFRM_STATE_NOECN)) ipip6_ecn_decapsulate(skb); skb->mac.raw = memmove(skb->data - skb->mac_len, diff -Nru a/net/key/af_key.c b/net/key/af_key.c --- a/net/key/af_key.c 2004-09-26 10:25:58 -07:00 +++ b/net/key/af_key.c 2004-09-26 10:25:58 -07:00 @@ -683,6 +683,8 @@ sa->sadb_sa_flags = 0; if (x->props.flags & XFRM_STATE_NOECN) sa->sadb_sa_flags |= SADB_SAFLAGS_NOECN; + if (x->props.flags & XFRM_STATE_DECAP_DSCP) + sa->sadb_sa_flags |= SADB_SAFLAGS_DECAP_DSCP; /* hard time */ if (hsc & 2) { @@ -965,6 +967,8 @@ x->props.replay_window = sa->sadb_sa_replay; if (sa->sadb_sa_flags & SADB_SAFLAGS_NOECN) x->props.flags |= XFRM_STATE_NOECN; + if (sa->sadb_sa_flags & SADB_SAFLAGS_DECAP_DSCP) + x->props.flags |= XFRM_STATE_DECAP_DSCP; lifetime = (struct sadb_lifetime*) ext_hdrs[SADB_EXT_LIFETIME_HARD-1]; if (lifetime != NULL) { diff -Nru a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c --- a/net/netlink/af_netlink.c 2004-09-26 10:25:56 -07:00 +++ b/net/netlink/af_netlink.c 2004-09-26 10:25:56 -07:00 @@ -46,7 +46,6 @@ #include #include #include -#include #define Nprintk(a...) @@ -70,14 +69,6 @@ #define nlk_sk(__sk) ((struct netlink_opt *)(__sk)->sk_protinfo) -struct netlink_work -{ - struct sock *sk; - int len; - struct work_struct work; -}; - -static struct workqueue_struct *netlink_wq; static struct hlist_head nl_table[MAX_LINKS]; static DECLARE_WAIT_QUEUE_HEAD(nl_table_wait); static unsigned nl_nonroot[MAX_LINKS]; @@ -96,16 +87,6 @@ static struct notifier_block *netlink_chain; -/* netlink workqueue handler */ -static void netlink_wq_handler(void *data) -{ - struct netlink_work *work = data; - - work->sk->sk_data_ready(work->sk, work->len); - sock_put(work->sk); - kfree(work); -} - static void netlink_sock_destruct(struct sock *sk) { skb_queue_purge(&sk->sk_receive_queue); @@ -497,8 +478,6 @@ if (atomic_read(&sk->sk_rmem_alloc) > sk->sk_rcvbuf || test_bit(0, &nlk->state)) { DECLARE_WAITQUEUE(wait, current); - task_t *client; - if (!timeo) { if (!nlk->pid) netlink_overrun(sk); @@ -507,19 +486,6 @@ return -EAGAIN; } - if (nlk->pid) { - /* Kernel is sending information to user space - * and socket buffer is full: Wake up user - * process */ - client = find_task_by_pid(nlk->pid); - if (!client) { - sock_put(sk); - kfree_skb(skb); - return -EAGAIN; - } - wake_up_process(client); - } - __set_current_state(TASK_INTERRUPTIBLE); add_wait_queue(&nlk->wait, &wait); @@ -559,24 +525,8 @@ #endif skb_queue_tail(&sk->sk_receive_queue, skb); - if (!nlk->pid) { - struct netlink_work *nlwork = - kmalloc(sizeof(struct netlink_work), GFP_KERNEL); - - if (!nlwork) { - sock_put(sk); - return -EAGAIN; - } - - INIT_WORK(&nlwork->work, netlink_wq_handler, nlwork); - nlwork->sk = sk; - nlwork->len = len; - queue_work(netlink_wq, &nlwork->work); - } else { - sk->sk_data_ready(sk, len); - sock_put(sk); - } - + sk->sk_data_ready(sk, len); + sock_put(sk); return len; } @@ -623,21 +573,7 @@ skb_orphan(skb); skb_set_owner_r(skb, sk); skb_queue_tail(&sk->sk_receive_queue, skb); - - if (!nlk->pid) { - struct netlink_work *nlwork = - kmalloc(sizeof(struct netlink_work), GFP_KERNEL); - - if (!nlwork) - return -1; - - INIT_WORK(&nlwork->work, netlink_wq_handler, nlwork); - nlwork->sk = sk; - nlwork->len = skb->len; - queue_work(netlink_wq, &nlwork->work); - } else - sk->sk_data_ready(sk, skb->len); - + sk->sk_data_ready(sk, skb->len); return 0; } return -1; @@ -683,14 +619,13 @@ netlink_overrun(sk); /* Clone failed. Notify ALL listeners. */ failure = 1; - sock_put(sk); } else if (netlink_broadcast_deliver(sk, skb2)) { netlink_overrun(sk); - sock_put(sk); } else { delivered = 1; skb2 = NULL; } + sock_put(sk); } netlink_unlock_table(); @@ -1267,9 +1202,6 @@ #endif /* The netlink device handler may be needed early. */ rtnetlink_init(); - - /* Create a work queue to handle callbacks to modules */ - netlink_wq = create_workqueue("netlink"); return 0; } @@ -1277,7 +1209,6 @@ { sock_unregister(PF_NETLINK); proc_net_remove("netlink"); - destroy_workqueue(netlink_wq); } core_initcall(netlink_proto_init); diff -Nru a/net/rxrpc/call.c b/net/rxrpc/call.c --- a/net/rxrpc/call.c 2004-09-26 10:25:57 -07:00 +++ b/net/rxrpc/call.c 2004-09-26 10:25:57 -07:00 @@ -472,7 +472,7 @@ { struct rxrpc_message *msg; struct kvec diov[3]; - unsigned aux[4]; + __be32 aux[4]; int delta, ret; /* ACKs default to DELAY */ @@ -840,7 +840,7 @@ struct rxrpc_message *msg; struct kvec diov[1]; int ret; - u32 _error; + __be32 _error; _enter("%p{%08x},%p{%d},%d", conn, ntohl(conn->conn_id), call, ntohl(call->call_id), errno); @@ -986,7 +986,7 @@ /* deal with abort packets */ case RXRPC_PACKET_TYPE_ABORT: { - uint32_t _dbuf, *dp; + __be32 _dbuf, *dp; dp = skb_header_pointer(msg->pkt, msg->offset, sizeof(_dbuf), &_dbuf); @@ -1048,7 +1048,7 @@ struct rxrpc_message *pmsg; struct list_head *_p; int ret, lo, hi, rmtimo; - u32 opid; + __be32 opid; _enter("%p{%u},%p{%u}", call, ntohl(call->call_id), msg, msg->seq); @@ -1270,7 +1270,7 @@ struct rxrpc_message *msg) { struct rxrpc_ackpacket _ack, *ap; - rxrpc_serial_t serial; + rxrpc_serial_net_t serial; rxrpc_seq_t seq; int ret; diff -Nru a/net/rxrpc/connection.c b/net/rxrpc/connection.c --- a/net/rxrpc/connection.c 2004-09-26 10:25:56 -07:00 +++ b/net/rxrpc/connection.c 2004-09-26 10:25:56 -07:00 @@ -88,8 +88,8 @@ * create a new connection record for outgoing connections */ int rxrpc_create_connection(struct rxrpc_transport *trans, - uint16_t port, - uint32_t addr, + __be16 port, + __be32 addr, uint16_t service_id, void *security, struct rxrpc_connection **_conn) @@ -97,7 +97,7 @@ struct rxrpc_connection *candidate, *conn; struct rxrpc_peer *peer; struct list_head *_p; - uint32_t connid; + __be32 connid; int ret; _enter("%p{%hu},%u,%hu", trans, trans->port, ntohs(port), service_id); @@ -169,7 +169,7 @@ spin_unlock(&peer->conn_gylock); /* pick the new candidate */ - _debug("created connection: {%08x} [out]", htonl(candidate->conn_id)); + _debug("created connection: {%08x} [out]", ntohl(candidate->conn_id)); atomic_inc(&peer->conn_count); conn = candidate; candidate = NULL; @@ -199,7 +199,7 @@ /* handle resurrecting a connection from the graveyard */ found_in_graveyard: - _debug("resurrecting connection: {%08x} [out]", htonl(conn->conn_id)); + _debug("resurrecting connection: {%08x} [out]", ntohl(conn->conn_id)); rxrpc_get_connection(conn); rxrpc_krxtimod_del_timer(&conn->timeout); list_del_init(&conn->link); @@ -219,8 +219,9 @@ struct rxrpc_connection *conn, *candidate = NULL; struct list_head *_p; int ret, fresh = 0; - u32 x_epoch, x_connid; - u16 x_port, x_secix, x_servid; + __be32 x_epoch, x_connid; + __be16 x_port, x_servid; + __u32 x_secix; u8 x_clflag; _enter("%p{{%hu}},%u,%hu", @@ -310,7 +311,7 @@ } /* we can now add the new candidate to the list */ - _debug("created connection: {%08x} [in]", htonl(candidate->conn_id)); + _debug("created connection: {%08x} [in]", ntohl(candidate->conn_id)); rxrpc_get_peer(peer); conn = candidate; candidate = NULL; @@ -351,7 +352,7 @@ /* handle resurrecting a connection from the graveyard */ found_in_graveyard: - _debug("resurrecting connection: {%08x} [in]", htonl(conn->conn_id)); + _debug("resurrecting connection: {%08x} [in]", ntohl(conn->conn_id)); rxrpc_get_peer(peer); rxrpc_get_connection(conn); rxrpc_krxtimod_del_timer(&conn->timeout); @@ -397,7 +398,7 @@ } /* move to graveyard queue */ - _debug("burying connection: {%08x}", htonl(conn->conn_id)); + _debug("burying connection: {%08x}", ntohl(conn->conn_id)); list_del(&conn->link); list_add_tail(&conn->link, &peer->conn_graveyard); @@ -442,7 +443,7 @@ } _debug("--- Destroying Connection %p{%08x} ---", - conn, htonl(conn->conn_id)); + conn, ntohl(conn->conn_id)); down_write(&rxrpc_conns_sem); list_del(&conn->proc_link); @@ -640,8 +641,8 @@ _net("Sending message type %d of %Zd bytes to %08x:%d", msg->hdr.type, msg->dsize, - htonl(conn->addr.sin_addr.s_addr), - htons(conn->addr.sin_port)); + ntohl(conn->addr.sin_addr.s_addr), + ntohs(conn->addr.sin_port)); /* send the message */ ret = kernel_sendmsg(conn->trans->socket, &msghdr, @@ -699,11 +700,11 @@ } _proto("Received packet %%%u [%u] on call %hu:%u:%u", - htonl(msg->hdr.serial), - htonl(msg->hdr.seq), - htons(msg->hdr.serviceId), - htonl(conn->conn_id), - htonl(call->call_id)); + ntohl(msg->hdr.serial), + ntohl(msg->hdr.seq), + ntohs(msg->hdr.serviceId), + ntohl(conn->conn_id), + ntohl(call->call_id)); call->pkt_rcv_count++; diff -Nru a/net/rxrpc/main.c b/net/rxrpc/main.c --- a/net/rxrpc/main.c 2004-09-26 10:25:57 -07:00 +++ b/net/rxrpc/main.c 2004-09-26 10:25:57 -07:00 @@ -32,7 +32,7 @@ MODULE_AUTHOR("Red Hat, Inc."); MODULE_LICENSE("GPL"); -uint32_t rxrpc_epoch; +__be32 rxrpc_epoch; /*****************************************************************************/ /* diff -Nru a/net/rxrpc/peer.c b/net/rxrpc/peer.c --- a/net/rxrpc/peer.c 2004-09-26 10:25:56 -07:00 +++ b/net/rxrpc/peer.c 2004-09-26 10:25:56 -07:00 @@ -48,7 +48,7 @@ /* * create a peer record */ -static int __rxrpc_create_peer(struct rxrpc_transport *trans, uint32_t addr, +static int __rxrpc_create_peer(struct rxrpc_transport *trans, __be32 addr, struct rxrpc_peer **_peer) { struct rxrpc_peer *peer; @@ -96,7 +96,7 @@ * - returns (if successful) with peer record usage incremented * - resurrects it from the graveyard if found there */ -int rxrpc_peer_lookup(struct rxrpc_transport *trans, uint32_t addr, +int rxrpc_peer_lookup(struct rxrpc_transport *trans, __be32 addr, struct rxrpc_peer **_peer) { struct rxrpc_peer *peer, *candidate = NULL; diff -Nru a/net/rxrpc/transport.c b/net/rxrpc/transport.c --- a/net/rxrpc/transport.c 2004-09-26 10:25:57 -07:00 +++ b/net/rxrpc/transport.c 2004-09-26 10:25:57 -07:00 @@ -457,8 +457,8 @@ struct rxrpc_peer *peer; struct sk_buff *pkt; int ret; - u32 addr; - u16 port; + __be32 addr; + __be16 port; LIST_HEAD(msgq); @@ -612,7 +612,7 @@ struct sockaddr_in sin; struct msghdr msghdr; struct kvec iov[2]; - uint32_t _error; + __be32 _error; int len, ret; _enter("%p,%p,%d", trans, msg, error); @@ -655,8 +655,8 @@ _net("Sending message type %d of %d bytes to %08x:%d", ahdr.type, len, - htonl(sin.sin_addr.s_addr), - htons(sin.sin_port)); + ntohl(sin.sin_addr.s_addr), + ntohs(sin.sin_port)); /* send the message */ ret = kernel_sendmsg(trans->socket, &msghdr, iov, 2, len); @@ -678,7 +678,7 @@ struct list_head connq, *_p; struct errormsg emsg; struct msghdr msg; - uint16_t port; + __be16 port; int local, err; _enter("%p", trans); diff -Nru a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c --- a/net/sched/sch_cbq.c 2004-09-26 10:25:55 -07:00 +++ b/net/sched/sch_cbq.c 2004-09-26 10:25:55 -07:00 @@ -1770,10 +1770,6 @@ #ifdef CONFIG_NET_CLS_POLICE q->rx_class = NULL; #endif - for (h = 0; h < 16; h++) { - for (cl = q->classes[h]; cl; cl = cl->next) - cbq_destroy_filters(cl); - } for (h = 0; h < 16; h++) { struct cbq_class *next; @@ -1783,8 +1779,6 @@ cbq_destroy_class(sch, cl); } } - - qdisc_put_rtab(q->link.R_tab); } static void cbq_put(struct Qdisc *sch, unsigned long arg) diff -Nru a/net/sched/sch_generic.c b/net/sched/sch_generic.c --- a/net/sched/sch_generic.c 2004-09-26 10:25:55 -07:00 +++ b/net/sched/sch_generic.c 2004-09-26 10:25:55 -07:00 @@ -148,8 +148,10 @@ spin_lock(&dev->queue_lock); return -1; } - if (ret == NETDEV_TX_LOCKED && nolock) + if (ret == NETDEV_TX_LOCKED && nolock) { + spin_lock(&dev->queue_lock); goto collision; + } } /* NETDEV_TX_BUSY - we need to requeue */ diff -Nru a/net/sched/sch_red.c b/net/sched/sch_red.c --- a/net/sched/sch_red.c 2004-09-26 10:25:57 -07:00 +++ b/net/sched/sch_red.c 2004-09-26 10:25:57 -07:00 @@ -40,6 +40,7 @@ #include #include #include +#include /* Random Early Detection (RED) algorithm. @@ -167,7 +168,7 @@ IP_ECN_set_ce(skb->nh.iph); return 1; case __constant_htons(ETH_P_IPV6): - if (INET_ECN_is_not_ect(ip6_get_dsfield(skb->nh.ipv6h))) + if (INET_ECN_is_not_ect(ipv6_get_dsfield(skb->nh.ipv6h))) return 0; IP6_ECN_set_ce(skb->nh.ipv6h); return 1; diff -Nru a/net/sctp/ipv6.c b/net/sctp/ipv6.c --- a/net/sctp/ipv6.c 2004-09-26 10:25:56 -07:00 +++ b/net/sctp/ipv6.c 2004-09-26 10:25:56 -07:00 @@ -583,8 +583,8 @@ struct ipv6_pinfo *newnp, *np = inet6_sk(sk); struct sctp6_sock *newsctp6sk; - newsk = sk_alloc(PF_INET6, GFP_KERNEL, sizeof(struct sctp6_sock), - sk->sk_slab); + newsk = sk_alloc(PF_INET6, GFP_KERNEL, sk->sk_prot->slab_obj_size, + sk->sk_prot->slab); if (!newsk) goto out; @@ -892,7 +892,7 @@ static struct inet_protosw sctpv6_seqpacket_protosw = { .type = SOCK_SEQPACKET, .protocol = IPPROTO_SCTP, - .prot = &sctp_prot, + .prot = &sctpv6_prot, .ops = &inet6_seqpacket_ops, .capability = -1, .no_check = 0, @@ -901,7 +901,7 @@ static struct inet_protosw sctpv6_stream_protosw = { .type = SOCK_STREAM, .protocol = IPPROTO_SCTP, - .prot = &sctp_prot, + .prot = &sctpv6_prot, .ops = &inet6_seqpacket_ops, .capability = -1, .no_check = 0, @@ -963,9 +963,14 @@ /* Initialize IPv6 support and register with inet6 stack. */ int sctp_v6_init(void) { + int rc = sk_alloc_slab(&sctpv6_prot, "sctpv6_sock"); + + if (rc) + goto out; /* Register inet6 protocol. */ + rc = -EAGAIN; if (inet6_add_protocol(&sctpv6_protocol, IPPROTO_SCTP) < 0) - return -EAGAIN; + goto out_sctp_free_slab; /* Add SCTPv6(UDP and TCP style) to inetsw6 linked list. */ inet6_register_protosw(&sctpv6_seqpacket_protosw); @@ -979,8 +984,12 @@ /* Register notifier for inet6 address additions/deletions. */ register_inet6addr_notifier(&sctp_inetaddr_notifier); - - return 0; + rc = 0; +out: + return rc; +out_sctp_free_slab: + sk_free_slab(&sctpv6_prot); + goto out; } /* IPv6 specific exit support. */ @@ -991,4 +1000,5 @@ inet6_unregister_protosw(&sctpv6_seqpacket_protosw); inet6_unregister_protosw(&sctpv6_stream_protosw); unregister_inet6addr_notifier(&sctp_inetaddr_notifier); + sk_free_slab(&sctpv6_prot); } diff -Nru a/net/sctp/protocol.c b/net/sctp/protocol.c --- a/net/sctp/protocol.c 2004-09-26 10:25:56 -07:00 +++ b/net/sctp/protocol.c 2004-09-26 10:25:56 -07:00 @@ -554,8 +554,8 @@ struct inet_opt *inet = inet_sk(sk); struct inet_opt *newinet; - newsk = sk_alloc(PF_INET, GFP_KERNEL, sizeof(struct sctp_sock), - sk->sk_slab); + newsk = sk_alloc(PF_INET, GFP_KERNEL, sk->sk_prot->slab_obj_size, + sk->sk_prot->slab); if (!newsk) goto out; @@ -962,23 +962,29 @@ __init int sctp_init(void) { int i; - int status = 0; + int status = -EINVAL; unsigned long goal; int order; /* SCTP_DEBUG sanity check. */ if (!sctp_sanity_check()) - return -EINVAL; + goto out; + + status = sk_alloc_slab(&sctp_prot, "sctp_sock"); + if (status) + goto out; /* Add SCTP to inet_protos hash table. */ + status = -EAGAIN; if (inet_add_protocol(&sctp_protocol, IPPROTO_SCTP) < 0) - return -EAGAIN; + goto err_add_protocol; /* Add SCTP(TCP and UDP style) to inetsw linked list. */ inet_register_protosw(&sctp_seqpacket_protosw); inet_register_protosw(&sctp_stream_protosw); /* Allocate a cache pools. */ + status = -ENOBUFS; sctp_bucket_cachep = kmem_cache_create("sctp_bind_bucket", sizeof(struct sctp_bind_bucket), 0, SLAB_HWCACHE_ALIGN, @@ -1154,8 +1160,11 @@ sctp_get_local_addr_list(); __unsafe(THIS_MODULE); - return 0; - + status = 0; +out: + return status; +err_add_protocol: + sk_free_slab(&sctp_prot); err_ctl_sock_init: sctp_v6_exit(); err_v6_init: @@ -1183,7 +1192,7 @@ inet_del_protocol(&sctp_protocol, IPPROTO_SCTP); inet_unregister_protosw(&sctp_seqpacket_protosw); inet_unregister_protosw(&sctp_stream_protosw); - return status; + goto out; } /* Exit handler for the SCTP protocol. */ @@ -1224,6 +1233,7 @@ inet_del_protocol(&sctp_protocol, IPPROTO_SCTP); inet_unregister_protosw(&sctp_seqpacket_protosw); inet_unregister_protosw(&sctp_stream_protosw); + sk_free_slab(&sctp_prot); } module_init(sctp_init); diff -Nru a/net/sctp/socket.c b/net/sctp/socket.c --- a/net/sctp/socket.c 2004-09-26 10:25:58 -07:00 +++ b/net/sctp/socket.c 2004-09-26 10:25:58 -07:00 @@ -4622,4 +4622,34 @@ .hash = sctp_hash, .unhash = sctp_unhash, .get_port = sctp_get_port, + .slab_obj_size = sizeof(struct sctp_sock), }; + +#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) +struct ipv6_sk_offset sctp_sock_offset = { + .offset = offsetof(struct sctp6_sock, inet6), +}; + +struct proto sctpv6_prot = { + .name = "SCTPv6", + .close = sctp_close, + .connect = sctp_connect, + .disconnect = sctp_disconnect, + .accept = sctp_accept, + .ioctl = sctp_ioctl, + .init = sctp_init_sock, + .destroy = sctp_destroy_sock, + .shutdown = sctp_shutdown, + .setsockopt = sctp_setsockopt, + .getsockopt = sctp_getsockopt, + .sendmsg = sctp_sendmsg, + .recvmsg = sctp_recvmsg, + .bind = sctp_bind, + .backlog_rcv = sctp_backlog_rcv, + .hash = sctp_hash, + .unhash = sctp_unhash, + .get_port = sctp_get_port, + .slab_obj_size = sizeof(struct sctp6_sock), + .af_specific = &sctp_sock_offset, +}; +#endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ diff -Nru a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c --- a/net/xfrm/xfrm_policy.c 2004-09-26 10:25:56 -07:00 +++ b/net/xfrm/xfrm_policy.c 2004-09-26 10:25:56 -07:00 @@ -711,25 +711,11 @@ { struct xfrm_policy *policy; struct xfrm_state *xfrm[XFRM_MAX_DEPTH]; - struct rtable *rt = (struct rtable*)*dst_p; - struct dst_entry *dst; + struct dst_entry *dst, *dst_orig = *dst_p; int nx = 0; int err; u32 genid; - u16 family = (*dst_p)->ops->family; - - switch (family) { - case AF_INET: - if (!fl->fl4_src) - fl->fl4_src = rt->rt_src; - if (!fl->fl4_dst) - fl->fl4_dst = rt->rt_dst; - case AF_INET6: - /* Still not clear... */ - default: - /* nothing */; - } - + u16 family = dst_orig->ops->family; restart: genid = atomic_read(&flow_cache_genid); policy = NULL; @@ -738,7 +724,7 @@ if (!policy) { /* To accelerate a bit... */ - if ((rt->u.dst.flags & DST_NOXFRM) || !xfrm_policy_list[XFRM_POLICY_OUT]) + if ((dst_orig->flags & DST_NOXFRM) || !xfrm_policy_list[XFRM_POLICY_OUT]) return 0; policy = flow_cache_lookup(fl, family, @@ -813,7 +799,7 @@ return 0; } - dst = &rt->u.dst; + dst = dst_orig; err = xfrm_bundle_create(policy, xfrm, nx, fl, &dst, family); if (unlikely(err)) { @@ -843,12 +829,12 @@ write_unlock_bh(&policy->lock); } *dst_p = dst; - ip_rt_put(rt); + dst_release(dst_orig); xfrm_pol_put(policy); return 0; error: - ip_rt_put(rt); + dst_release(dst_orig); xfrm_pol_put(policy); *dst_p = NULL; return err; diff -Nru a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c --- a/net/xfrm/xfrm_state.c 2004-09-26 10:25:57 -07:00 +++ b/net/xfrm/xfrm_state.c 2004-09-26 10:25:57 -07:00 @@ -592,7 +592,6 @@ list_for_each_entry(x, xfrm_state_bydst+i, bydst) { if (x->km.seq == seq) { xfrm_state_hold(x); - spin_unlock_bh(&xfrm_state_lock); return x; } } diff -Nru a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h --- a/scripts/kconfig/lkc.h 2004-09-26 10:25:55 -07:00 +++ b/scripts/kconfig/lkc.h 2004-09-26 10:25:55 -07:00 @@ -59,9 +59,6 @@ struct file *file_lookup(const char *name); int file_write_dep(const char *name); -extern struct menu *current_entry; -extern struct menu *current_menu; - /* symbol.c */ void sym_init(void); void sym_clear_all_valid(void); diff -Nru a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c --- a/scripts/kconfig/mconf.c 2004-09-26 10:25:55 -07:00 +++ b/scripts/kconfig/mconf.c 2004-09-26 10:25:55 -07:00 @@ -18,6 +18,7 @@ #include #include #include +#include #define LKC_DIRECT_LINK #include "lkc.h" @@ -28,7 +29,7 @@ " selects submenus --->. " "Highlighted letters are hotkeys. " "Pressing includes, excludes, modularizes features. " - "Press to exit, for Help. " + "Press to exit, for Help, for Search. " "Legend: [*] built-in [ ] excluded module < > module capable", radiolist_instructions[] = "Use the arrow keys to navigate this window or " @@ -88,7 +89,7 @@ static int indent; static struct termios ios_org; static int rows = 0, cols = 0; -struct menu *current_menu; +static struct menu *current_menu; static int child_count; static int do_resize; static int single_menu_mode; @@ -102,6 +103,10 @@ static void show_helptext(const char *title, const char *text); static void show_help(struct menu *menu); static void show_readme(void); +static void show_file(const char *filename, const char *title, int r, int c); +static void show_expr(struct menu *menu, FILE *fp); +static void search_conf(char *pattern); +static int regex_match(const char *string, regex_t *re); static void cprint_init(void); static int cprint1(const char *fmt, ...); @@ -274,6 +279,114 @@ return WEXITSTATUS(stat); } +static int regex_match(const char *string, regex_t *re) +{ + int rc; + + rc = regexec(re, string, (size_t) 0, NULL, 0); + if (rc) + return 0; + return 1; +} + +static void show_expr(struct menu *menu, FILE *fp) +{ + bool hit = false; + fprintf(fp, "Depends:\n "); + if (menu->prompt->visible.expr) { + if (!hit) + hit = true; + expr_fprint(menu->prompt->visible.expr, fp); + } + if (!hit) + fprintf(fp, "None"); + if (menu->sym) { + struct property *prop; + hit = false; + fprintf(fp, "\nSelects:\n "); + for_all_properties(menu->sym, prop, P_SELECT) { + if (!hit) + hit = true; + expr_fprint(prop->expr, fp); + } + if (!hit) + fprintf(fp, "None"); + hit = false; + fprintf(fp, "\nSelected by:\n "); + if (menu->sym->rev_dep.expr) { + hit = true; + expr_fprint(menu->sym->rev_dep.expr, fp); + } + if (!hit) + fprintf(fp, "None"); + } +} + +static void search_conf(char *pattern) +{ + struct symbol *sym = NULL; + struct menu *menu[32] = { 0 }; + struct property *prop = NULL; + FILE *fp = NULL; + bool hit = false; + int i, j, k, l; + regex_t re; + + if (regcomp(&re, pattern, REG_EXTENDED|REG_NOSUB)) + return; + + fp = fopen(".search.tmp", "w"); + if (fp == NULL) { + perror("fopen"); + return; + } + for_all_symbols(i, sym) { + if (!sym->name) + continue; + if (!regex_match(sym->name, &re)) + continue; + for_all_prompts(sym, prop) { + struct menu *submenu = prop->menu; + if (!submenu) + continue; + j = 0; + hit = false; + while (submenu) { + menu[j++] = submenu; + submenu = submenu->parent; + } + if (j > 0) { + if (!hit) + hit = true; + fprintf(fp, "%s (%s)\n", prop->text, sym->name); + fprintf(fp, "Location:\n"); + } + for (k = j-2, l=1; k > 0; k--, l++) { + const char *prompt = menu_get_prompt(menu[k]); + if (menu[k]->sym) + fprintf(fp, "%*c-> %s (%s)\n", + l, ' ', + prompt, + menu[k]->sym->name); + else + fprintf(fp, "%*c-> %s\n", + l, ' ', + prompt); + } + if (hit) { + show_expr(menu[0], fp); + fprintf(fp, "\n\n\n"); + } + } + } + if (!hit) + fprintf(fp, "No matches found."); + regfree(&re); + fclose(fp); + show_file(".search.tmp", "Search Results", rows, cols); + unlink(".search.tmp"); +} + static void build_conf(struct menu *menu) { struct symbol *sym; @@ -463,6 +576,23 @@ cprint(" Save Configuration to an Alternate File"); } stat = exec_conf(); + if (stat == 26) { + char *pattern; + + if (!strlen(input_buf)) + continue; + pattern = malloc(sizeof(char)*sizeof(input_buf)); + if (pattern == NULL) { + perror("malloc"); + continue; + } + for (i = 0; input_buf[i]; i++) + pattern[i] = toupper(input_buf[i]); + pattern[i] = '\0'; + search_conf(pattern); + free(pattern); + continue; + } if (stat < 0) continue; @@ -550,17 +680,7 @@ fd = creat(".help.tmp", 0777); write(fd, text, strlen(text)); close(fd); - do { - cprint_init(); - if (title) { - cprint("--title"); - cprint("%s", title); - } - cprint("--textbox"); - cprint(".help.tmp"); - cprint("%d", r); - cprint("%d", c); - } while (exec_conf() < 0); + show_file(".help.tmp", title, r, c); unlink(".help.tmp"); } @@ -589,13 +709,22 @@ static void show_readme(void) { + show_file("scripts/README.Menuconfig", NULL, rows, cols); +} + +static void show_file(const char *filename, const char *title, int r, int c) +{ do { cprint_init(); + if (title) { + cprint("--title"); + cprint("%s", title); + } cprint("--textbox"); - cprint("scripts/README.Menuconfig"); - cprint("%d", rows); - cprint("%d", cols); - } while (exec_conf() == -1); + cprint("%s", filename); + cprint("%d", r); + cprint("%d", c); + } while (exec_conf() < 0); } static void conf_choice(struct menu *menu) diff -Nru a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c --- a/scripts/kconfig/menu.c 2004-09-26 10:25:57 -07:00 +++ b/scripts/kconfig/menu.c 2004-09-26 10:25:57 -07:00 @@ -10,7 +10,6 @@ #include "lkc.h" struct menu rootmenu; -struct menu *current_menu, *current_entry; static struct menu **last_entry_ptr; struct file *file_list; diff -Nru a/scripts/kconfig/zconf.tab.c_shipped b/scripts/kconfig/zconf.tab.c_shipped --- a/scripts/kconfig/zconf.tab.c_shipped 2004-09-26 10:25:57 -07:00 +++ b/scripts/kconfig/zconf.tab.c_shipped 2004-09-26 10:25:57 -07:00 @@ -175,6 +175,8 @@ struct symbol *symbol_hash[257]; +static struct menu *current_menu, *current_entry; + #define YYERROR_VERBOSE diff -Nru a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y --- a/scripts/kconfig/zconf.y 2004-09-26 10:25:57 -07:00 +++ b/scripts/kconfig/zconf.y 2004-09-26 10:25:57 -07:00 @@ -25,6 +25,8 @@ struct symbol *symbol_hash[257]; +static struct menu *current_menu, *current_entry; + #define YYERROR_VERBOSE %} %expect 40 diff -Nru a/scripts/lxdialog/menubox.c b/scripts/lxdialog/menubox.c --- a/scripts/lxdialog/menubox.c 2004-09-26 10:25:57 -07:00 +++ b/scripts/lxdialog/menubox.c 2004-09-26 10:25:57 -07:00 @@ -276,6 +276,15 @@ while (key != ESC) { key = wgetch(menu); + if ( key == '/' ) { + int ret = dialog_inputbox("Search Configuration Parameter", + "Enter Keyword", height, width, + (char *) NULL); + if (ret == 0) { + fprintf(stderr, "%s", dialog_input_result); + return 26; + } + } if (key < 256 && isalpha(key)) key = tolower(key); diff -Nru a/sound/oss/dmasound/Kconfig b/sound/oss/dmasound/Kconfig --- a/sound/oss/dmasound/Kconfig 2004-09-26 10:25:56 -07:00 +++ b/sound/oss/dmasound/Kconfig 2004-09-26 10:25:56 -07:00 @@ -14,7 +14,7 @@ config DMASOUND_PMAC tristate "PowerMac DMA sound support" - depends on PPC_PMAC && SOUND && I2C + depends on PPC32 && PPC_PMAC && SOUND && I2C select DMASOUND help If you want to use the internal audio of your PowerMac in Linux, diff -Nru a/sound/pci/atiixp.c b/sound/pci/atiixp.c --- a/sound/pci/atiixp.c 2004-09-26 10:25:56 -07:00 +++ b/sound/pci/atiixp.c 2004-09-26 10:25:56 -07:00 @@ -258,7 +258,7 @@ struct pci_dev *pci; unsigned long addr; - unsigned long remap_addr; + void __iomem *remap_addr; int irq; ac97_bus_t *ac97_bus; @@ -303,7 +303,7 @@ static int snd_atiixp_update_bits(atiixp_t *chip, unsigned int reg, unsigned int mask, unsigned int value) { - unsigned long addr = chip->remap_addr + reg; + void __iomem *addr = chip->remap_addr + reg; unsigned int data, old_data; old_data = data = readl(addr); data &= ~mask; @@ -1472,7 +1472,7 @@ if (chip->irq >= 0) free_irq(chip->irq, (void *)chip); if (chip->remap_addr) - iounmap((void *) chip->remap_addr); + iounmap(chip->remap_addr); pci_release_regions(chip->pci); kfree(chip); return 0; @@ -1515,7 +1515,7 @@ return err; } chip->addr = pci_resource_start(pci, 0); - chip->remap_addr = (unsigned long) ioremap_nocache(chip->addr, pci_resource_len(pci, 0)); + chip->remap_addr = ioremap_nocache(chip->addr, pci_resource_len(pci, 0)); if (chip->remap_addr == 0) { snd_printk(KERN_ERR "AC'97 space ioremap problem\n"); snd_atiixp_free(chip); diff -Nru a/sound/pci/atiixp_modem.c b/sound/pci/atiixp_modem.c --- a/sound/pci/atiixp_modem.c 2004-09-26 10:25:57 -07:00 +++ b/sound/pci/atiixp_modem.c 2004-09-26 10:25:57 -07:00 @@ -241,7 +241,7 @@ struct resource *res; /* memory i/o */ unsigned long addr; - unsigned long remap_addr; + void __iomem *remap_addr; int irq; ac97_bus_t *ac97_bus; @@ -284,7 +284,7 @@ static int snd_atiixp_update_bits(atiixp_t *chip, unsigned int reg, unsigned int mask, unsigned int value) { - unsigned long addr = chip->remap_addr + reg; + void __iomem *addr = chip->remap_addr + reg; unsigned int data, old_data; old_data = data = readl(addr); data &= ~mask; @@ -1194,7 +1194,7 @@ if (chip->irq >= 0) free_irq(chip->irq, (void *)chip); if (chip->remap_addr) - iounmap((void *) chip->remap_addr); + iounmap(chip->remap_addr); pci_release_regions(chip->pci); kfree(chip); return 0; @@ -1237,7 +1237,7 @@ return err; } chip->addr = pci_resource_start(pci, 0); - chip->remap_addr = (unsigned long) ioremap_nocache(chip->addr, pci_resource_len(pci, 0)); + chip->remap_addr = ioremap_nocache(chip->addr, pci_resource_len(pci, 0)); if (chip->remap_addr == 0) { snd_printk(KERN_ERR "AC'97 space ioremap problem\n"); snd_atiixp_free(chip); diff -Nru a/sound/sparc/amd7930.c b/sound/sparc/amd7930.c --- a/sound/sparc/amd7930.c 2004-09-26 10:25:55 -07:00 +++ b/sound/sparc/amd7930.c 2004-09-26 10:25:55 -07:00 @@ -314,7 +314,7 @@ typedef struct snd_amd7930 { spinlock_t lock; - unsigned long regs; + void __iomem *regs; u32 flags; #define AMD7930_FLAG_PLAYBACK 0x00000001 #define AMD7930_FLAG_CAPTURE 0x00000002 diff -Nru a/sound/sparc/cs4231.c b/sound/sparc/cs4231.c --- a/sound/sparc/cs4231.c 2004-09-26 10:25:55 -07:00 +++ b/sound/sparc/cs4231.c 2004-09-26 10:25:55 -07:00 @@ -64,7 +64,7 @@ typedef struct snd_cs4231 { spinlock_t lock; - unsigned long port; + void __iomem *port; #ifdef EBUS_SUPPORT struct ebus_dma_info eb2c; struct ebus_dma_info eb2p; @@ -357,7 +357,7 @@ 0x00, /* 1f/31 - cbrl */ }; -static u8 __cs4231_readb(cs4231_t *cp, unsigned long reg_addr) +static u8 __cs4231_readb(cs4231_t *cp, void __iomem *reg_addr) { #ifdef EBUS_SUPPORT if (cp->flags & CS4231_FLAG_EBUS) { @@ -372,7 +372,7 @@ #endif } -static void __cs4231_writeb(cs4231_t *cp, u8 val, unsigned long reg_addr) +static void __cs4231_writeb(cs4231_t *cp, u8 val, void __iomem *reg_addr) { #ifdef EBUS_SUPPORT if (cp->flags & CS4231_FLAG_EBUS) { @@ -551,7 +551,7 @@ chip->mce_bit |= CS4231_MCE; timeout = __cs4231_readb(chip, CS4231P(chip, REGSEL)); if (timeout == 0x80) - snd_printk("mce_up [0x%lx]: serious init problem - codec still busy\n", chip->port); + snd_printk("mce_up [%p]: serious init problem - codec still busy\n", chip->port); if (!(timeout & CS4231_MCE)) __cs4231_writeb(chip, chip->mce_bit | (timeout & 0x1f), CS4231P(chip, REGSEL)); spin_unlock_irqrestore(&chip->lock, flags); @@ -576,7 +576,7 @@ timeout = __cs4231_readb(chip, CS4231P(chip, REGSEL)); __cs4231_writeb(chip, chip->mce_bit | (timeout & 0x1f), CS4231P(chip, REGSEL)); if (timeout == 0x80) - snd_printk("mce_down [0x%lx]: serious init problem - codec still busy\n", chip->port); + snd_printk("mce_down [%p]: serious init problem - codec still busy\n", chip->port); if ((timeout & CS4231_MCE) == 0) { spin_unlock_irqrestore(&chip->lock, flags); return; @@ -2107,9 +2107,9 @@ chip->eb2p.client_cookie = chip; chip->eb2p.irq = edev->irqs[1]; - chip->port = (unsigned long) ioremap(edev->resource[0].start, 0x10); - chip->eb2p.regs = (unsigned long) ioremap(edev->resource[1].start, 0x10); - chip->eb2c.regs = (unsigned long) ioremap(edev->resource[2].start, 0x10); + chip->port = ioremap(edev->resource[0].start, 0x10); + chip->eb2p.regs = ioremap(edev->resource[1].start, 0x10); + chip->eb2c.regs = ioremap(edev->resource[2].start, 0x10); if (!chip->port || !chip->eb2p.regs || !chip->eb2c.regs) { snd_cs4231_ebus_free(chip); snd_printk("cs4231-%d: Unable to map chip registers.\n", dev);