http://linux.bkbits.net/linux-2.5
torvalds@ppc970.osdl.org|ChangeSet|20040603050515|52638 torvalds
# This is a BitKeeper generated diff -Nru style patch.
#
# net/core/dev.c
#   2004/05/30 14:17:01-07:00 viro@parcelfarce.linux.theplanet.co.uk +1 -1
#   sparse: SIOCGIFCONF handling - the rest of it
# 
# ChangeSet
#   2004/06/02 17:51:11-04:00 arjanv@redhat.com 
#   [libata] Use standard headers from include/scsi, not drivers/scsi
# 
# drivers/scsi/sata_vsc.c
#   2004/05/12 11:46:23-04:00 arjanv@redhat.com +1 -1
#   sata header patch
# 
# drivers/scsi/sata_via.c
#   2004/05/12 11:46:23-04:00 arjanv@redhat.com +1 -1
#   sata header patch
# 
# drivers/scsi/sata_sx4.c
#   2004/05/12 11:46:23-04:00 arjanv@redhat.com +1 -1
#   sata header patch
# 
# drivers/scsi/sata_svw.c
#   2004/05/12 11:46:23-04:00 arjanv@redhat.com +1 -1
#   sata header patch
# 
# drivers/scsi/sata_sis.c
#   2004/05/12 11:46:23-04:00 arjanv@redhat.com +1 -1
#   sata header patch
# 
# drivers/scsi/sata_sil.c
#   2004/05/12 11:46:23-04:00 arjanv@redhat.com +1 -1
#   sata header patch
# 
# drivers/scsi/sata_promise.c
#   2004/05/12 11:46:23-04:00 arjanv@redhat.com +1 -1
#   sata header patch
# 
# drivers/scsi/libata-scsi.c
#   2004/05/12 11:46:21-04:00 arjanv@redhat.com +1 -1
#   sata header patch
# 
# drivers/scsi/libata-core.c
#   2004/05/12 11:46:21-04:00 arjanv@redhat.com +1 -1
#   sata header patch
# 
# drivers/scsi/ata_piix.c
#   2004/05/12 11:46:20-04:00 arjanv@redhat.com +1 -1
#   sata header patch
# 
# ChangeSet
#   2004/06/02 17:31:53-04:00 jgarzik@redhat.com 
#   [libata scsi] ack SYNCHRONIZE CACHE command
#   
#   When taskfile delivery is improved, we will actually perform
#   this command, instead of no-oping it.
#   
#   For now, this is cosmetic except for removing an annoying message
#   that some users see.
# 
# drivers/scsi/libata-scsi.c
#   2004/06/02 17:31:47-04:00 jgarzik@redhat.com +1 -0
#   [libata scsi] ack SYNCHRONIZE CACHE command
#   
#   When taskfile delivery is improved, we will actually perform
#   this command, instead of no-oping it.
#   
#   For now, this is cosmetic except for removing an annoying message
#   that some users see.
# 
# ChangeSet
#   2004/06/02 17:29:00-04:00 jgarzik@redhat.com 
#   [libata promise] revert broken taskfile delivery change
#   
#   The ->tf_load and ->exec_command driver hooks were changed to assume
#   that PIO was the only type of taskfile ever delivered to these functions.
#   This will be true... in the future, but not today.  In other drivers
#   this change was not needed, but Promise executes commands differently
#   due to its "ATA packet" hardware features, so the Promise drivers need
#   this change reverted.
#   
#   Diagnosis and initial fix by Brad Campbell <brad@wasp.net.au>
# 
# drivers/scsi/sata_sx4.c
#   2004/06/02 17:28:55-04:00 jgarzik@redhat.com +2 -2
#   [libata promise] revert broken taskfile delivery change
#   
#   The ->tf_load and ->exec_command driver hooks were changed to assume
#   that PIO was the only type of taskfile ever delivered to these functions.
#   This will be true... in the future, but not today.  In other drivers
#   this change was not needed, but Promise executes commands differently
#   due to its "ATA packet" hardware features, so the Promise drivers need
#   this change reverted.
#   
#   Diagnosis and initial fix by Brad Campbell <brad@wasp.net.au>
# 
# drivers/scsi/sata_promise.c
#   2004/06/02 17:28:55-04:00 jgarzik@redhat.com +2 -2
#   [libata promise] revert broken taskfile delivery change
#   
#   The ->tf_load and ->exec_command driver hooks were changed to assume
#   that PIO was the only type of taskfile ever delivered to these functions.
#   This will be true... in the future, but not today.  In other drivers
#   this change was not needed, but Promise executes commands differently
#   due to its "ATA packet" hardware features, so the Promise drivers need
#   this change reverted.
#   
#   Diagnosis and initial fix by Brad Campbell <brad@wasp.net.au>
# 
# ChangeSet
#   2004/06/02 16:20:04-04:00 khc@pm.waw.pl 
#   [PATCH] 2.6 Generic HDLC update
#   
#   The attached patch updates generic HDLC:
#   - fixed some carrier-related problems (Cisco HDLC and FR links could
#     report valid link when no carrier was detected at startup).
#   - fixed kbuild problems with wanxl firmware (building kernel in separate
#     tree). $(src)/wanxlfw.inc is now wanxlfw.inc_shipped.
# 
# include/linux/hdlc.h
#   2004/05/28 08:53:18-04:00 khc@pm.waw.pl +3 -2
#   2.6 Generic HDLC update
# 
# drivers/net/wan/wanxlfw.inc_shipped
#   2004/05/28 08:50:05-04:00 khc@pm.waw.pl +0 -0
#   2.6 Generic HDLC update
# 
# drivers/net/wan/hdlc_generic.c
#   2004/05/28 08:50:05-04:00 khc@pm.waw.pl +58 -50
#   2.6 Generic HDLC update
# 
# drivers/net/wan/hdlc_fr.c
#   2004/05/28 08:50:05-04:00 khc@pm.waw.pl +11 -9
#   2.6 Generic HDLC update
# 
# drivers/net/wan/hdlc_cisco.c
#   2004/05/28 08:50:05-04:00 khc@pm.waw.pl +14 -8
#   2.6 Generic HDLC update
# 
# drivers/net/wan/c101.c
#   2004/05/28 08:50:05-04:00 khc@pm.waw.pl +0 -2
#   2.6 Generic HDLC update
# 
# drivers/net/wan/Makefile
#   2004/05/28 08:50:05-04:00 khc@pm.waw.pl +5 -2
#   2.6 Generic HDLC update
# 
# ChangeSet
#   2004/06/02 16:14:29-04:00 paulus@samba.org 
#   [PATCH] ppp ldisc close deadlock prevention
#   
#   Jeff Garzik writes:
#   
#   > So what was the resolution of this?
#   
#   This patch is what we want.  We don't in fact need to do the read
#   lock, only the write lock, which is what the original patch did.
#   However, we need to do it in ppp_synctty.c as well as ppp_async.c.
#   
#   Thanks to John K Luebs <jkluebs@luebsphoto.com> for pointing out the
#   problem.
#   
#   Signed-off-by: Paul Mackerras <paulus@samba.org>
# 
# drivers/net/ppp_synctty.c
#   2004/05/24 00:58:39-04:00 paulus@samba.org +2 -2
#   ppp ldisc close deadlock prevention
# 
# drivers/net/ppp_async.c
#   2004/05/24 00:58:26-04:00 paulus@samba.org +2 -2
#   ppp ldisc close deadlock prevention
# 
# ChangeSet
#   2004/06/02 16:04:40-04:00 jgarzik@redhat.com 
#   Cset exclude: jgarzik@redhat.com|ChangeSet|20040527204246|14084
#   
#   Revert CONFIG_NET_GIGE change.
#   
#   The proper fix is _not_ NET_ETHERNET or default twiddling,
#   but better overall organization of the ethernet driver selection,
#   which would include not only CONFIG_NET_GIGE but other options as well.
#   
#   Reverted back to old behavior until a full and complete solution
#   appears (and people like it, of course).
# 
# drivers/net/Kconfig
#   2004/06/02 16:04:38-04:00 jgarzik@redhat.com +0 -0
#   Exclude
# 
# ChangeSet
#   2004/06/02 15:54:58-04:00 margitsw@t-online.de 
#   [PATCH] prism54: Add avs header support
#   
#   * islpci_eth.[c,h], islpci_dev.[c,h], isl_ioctl.[c,h] : added
#     support for avs header in monitor mode. Based on the work of
#     Antonio Eugenio Burriel <aeb@ryanstudios.com>. Unified packets
#     header (rfmon_header and rx_annex) for iwspy.
# 
# drivers/net/wireless/prism54/oid_mgt.h
#   2004/05/28 08:06:38-04:00 margitsw@t-online.de +2 -1
#   prism54: Add avs header support
# 
# drivers/net/wireless/prism54/oid_mgt.c
#   2004/05/28 08:06:38-04:00 margitsw@t-online.de +21 -0
#   prism54: Add avs header support
# 
# drivers/net/wireless/prism54/islpci_eth.h
#   2004/05/28 08:06:38-04:00 margitsw@t-online.de +41 -0
#   prism54: Add avs header support
# 
# drivers/net/wireless/prism54/islpci_eth.c
#   2004/05/28 08:06:38-04:00 margitsw@t-online.de +77 -20
#   prism54: Add avs header support
# 
# drivers/net/wireless/prism54/islpci_dev.h
#   2004/05/28 08:06:38-04:00 margitsw@t-online.de +2 -0
#   prism54: Add avs header support
# 
# drivers/net/wireless/prism54/islpci_dev.c
#   2004/05/28 08:06:38-04:00 margitsw@t-online.de +2 -2
#   prism54: Add avs header support
# 
# drivers/net/wireless/prism54/isl_oid.h
#   2004/05/28 08:06:38-04:00 margitsw@t-online.de +0 -13
#   prism54: Add avs header support
# 
# drivers/net/wireless/prism54/isl_ioctl.c
#   2004/05/28 08:06:38-04:00 margitsw@t-online.de +37 -26
#   prism54: Add avs header support
# 
# ChangeSet
#   2004/06/02 15:54:50-04:00 margitsw@t-online.de 
#   [PATCH] prism54: Add iwspy support
#   
#           * islpci_eth.c, islpci_dev.h, isl_ioctl.c : iwspy support.
# 
# drivers/net/wireless/prism54/oid_mgt.h
#   2004/05/28 08:04:18-04:00 margitsw@t-online.de +2 -0
#   prism54: Add iwspy support
# 
# drivers/net/wireless/prism54/oid_mgt.c
#   2004/05/28 08:04:18-04:00 margitsw@t-online.de +11 -0
#   prism54: Add iwspy support
# 
# drivers/net/wireless/prism54/islpci_eth.c
#   2004/05/28 08:04:18-04:00 margitsw@t-online.de +28 -9
#   prism54: Add iwspy support
# 
# drivers/net/wireless/prism54/islpci_dev.h
#   2004/05/28 08:04:18-04:00 margitsw@t-online.de +3 -0
#   prism54: Add iwspy support
# 
# drivers/net/wireless/prism54/isl_oid.h
#   2004/05/28 08:04:18-04:00 margitsw@t-online.de +13 -0
#   prism54: Add iwspy support
# 
# drivers/net/wireless/prism54/isl_ioctl.c
#   2004/05/28 08:04:18-04:00 margitsw@t-online.de +29 -12
#   prism54: Add iwspy support
# 
# ChangeSet
#   2004/06/02 15:54:42-04:00 margitsw@t-online.de 
#   [PATCH] prism54: Reset card on tx timeout
#   
#   * islpci_eth.[c,h] islpci_dev.[c,h] : reset card on tx_timeout.
#     Patch submited by Denis Vlasenko <vda@port.imtp.ilyichevsk.odessa.ua>
# 
# drivers/net/wireless/prism54/islpci_eth.h
#   2004/05/28 08:01:26-04:00 margitsw@t-online.de +1 -0
#   prism54: Reset card on tx timeout
# 
# drivers/net/wireless/prism54/islpci_eth.c
#   2004/05/28 08:01:26-04:00 margitsw@t-online.de +15 -16
#   prism54: Reset card on tx timeout
# 
# drivers/net/wireless/prism54/islpci_dev.h
#   2004/05/28 08:01:26-04:00 margitsw@t-online.de +3 -0
#   prism54: Reset card on tx timeout
# 
# drivers/net/wireless/prism54/islpci_dev.c
#   2004/05/28 08:01:26-04:00 margitsw@t-online.de +3 -1
#   prism54: Reset card on tx timeout
# 
# ChangeSet
#   2004/06/02 15:54:33-04:00 margitsw@t-online.de 
#   [PATCH] prism54: Add new private ioctls
#   
#   * oid_mgt.[c,h] : added type to oids. New functions :
#     oid_cpu_to_le(), mgt_le_to_cpu() and mgt_response_to_str().
#   
#   * isl_ioctl.c : use private sub-ioctls. Added a
#     bunch of private sub-ioctls. Removed the le??_to_cpu and
#     cpu_to_le??. Give the error code when sending wireless
#     events.
# 
# drivers/net/wireless/prism54/oid_mgt.h
#   2004/05/28 07:56:16-04:00 margitsw@t-online.de +4 -0
#   prism54: Add new private ioctls
# 
# drivers/net/wireless/prism54/oid_mgt.c
#   2004/05/28 07:56:16-04:00 margitsw@t-online.de +417 -185
#   prism54: Add new private ioctls
# 
# drivers/net/wireless/prism54/isl_oid.h
#   2004/05/28 07:56:16-04:00 margitsw@t-online.de +20 -6
#   prism54: Add new private ioctls
# 
# drivers/net/wireless/prism54/isl_ioctl.c
#   2004/05/28 07:56:16-04:00 margitsw@t-online.de +213 -97
#   prism54: Add new private ioctls
# 
# ChangeSet
#   2004/06/02 15:54:25-04:00 margitsw@t-online.de 
#   [PATCH] prism54: delete cvs tags
#   
#   * Remove CVS tags from source
# 
# drivers/net/wireless/prism54/oid_mgt.h
#   2004/05/29 05:06:39-04:00 margitsw@t-online.de +1 -1
#   prism54: delete cvs tags
# 
# drivers/net/wireless/prism54/islpci_mgt.h
#   2004/05/29 05:06:29-04:00 margitsw@t-online.de +1 -1
#   prism54: delete cvs tags
# 
# drivers/net/wireless/prism54/islpci_mgt.c
#   2004/05/29 05:07:14-04:00 margitsw@t-online.de +1 -1
#   prism54: delete cvs tags
# 
# drivers/net/wireless/prism54/islpci_hotplug.c
#   2004/05/29 05:07:10-04:00 margitsw@t-online.de +1 -1
#   prism54: delete cvs tags
# 
# drivers/net/wireless/prism54/islpci_eth.h
#   2004/05/29 05:06:22-04:00 margitsw@t-online.de +1 -1
#   prism54: delete cvs tags
# 
# drivers/net/wireless/prism54/islpci_eth.c
#   2004/05/29 05:07:05-04:00 margitsw@t-online.de +1 -1
#   prism54: delete cvs tags
# 
# drivers/net/wireless/prism54/islpci_dev.h
#   2004/05/29 05:10:39-04:00 margitsw@t-online.de +2 -1
#   prism54: delete cvs tags
# 
# drivers/net/wireless/prism54/islpci_dev.c
#   2004/05/29 05:06:59-04:00 margitsw@t-online.de +1 -1
#   prism54: delete cvs tags
# 
# drivers/net/wireless/prism54/isl_oid.h
#   2004/05/29 05:09:23-04:00 margitsw@t-online.de +2 -1
#   prism54: delete cvs tags
# 
# drivers/net/wireless/prism54/isl_ioctl.h
#   2004/05/29 05:05:40-04:00 margitsw@t-online.de +1 -1
#   prism54: delete cvs tags
# 
# drivers/net/wireless/prism54/isl_ioctl.c
#   2004/05/29 05:06:52-04:00 margitsw@t-online.de +1 -1
#   prism54: delete cvs tags
# 
# drivers/net/wireless/prism54/isl_38xx.h
#   2004/05/29 05:05:34-04:00 margitsw@t-online.de +1 -1
#   prism54: delete cvs tags
# 
# drivers/net/wireless/prism54/isl_38xx.c
#   2004/05/29 05:06:47-04:00 margitsw@t-online.de +1 -1
#   prism54: delete cvs tags
# 
# ChangeSet
#   2004/06/02 15:48:29-04:00 herbert@gondor.apana.org.au 
#   [PATCH] Check cmd in plip_ioctl
#   
#   I received a bug report that a PLIP interface was incorrectly identified
#   as wireless because plip_ioctl did not check what the value of cmd is
#   before processing the request.
#   
#   This patch fixes exactly that.
# 
# drivers/net/plip.c
#   2004/06/01 19:21:05-04:00 herbert@gondor.apana.org.au +3 -0
#   Check cmd in plip_ioctl
# 
# ChangeSet
#   2004/06/02 07:18:12-07:00 jeremy@redfishsoftware.com.au 
#   [PATCH] Fix signal race during process exit
#   
#   Fix a race identified by Jeremy Kerr <jeremy@redfishsoftware.com.au>: if
#   update_process_times() decides to deliver a signal due to process timer
#   expiry, it can race with __exit_sighand()'s freeing of task->sighand.
#   
#   Fix that by clearing the per-process timer state in exit_notify(), while under
#   local_irq_disable() and under tasklist_lock.  tasklist_lock provides exclusion
#   wrt release_task()'s freeing of task->sighand and local_irq_disable() provides
#   exclusion wrt update_process_times()'s inspection of the per-process timer
#   state.
#   
#   We also need to deal with the send_sig() calls in do_process_times() by
#   setting rlim_cur to RLIM_INFINITY.
#   
#   Signed-off-by: Andrew Morton <akpm@osdl.org>
#   Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
#   Signed-off-by: Linus Torvalds <torvalds@osdl.org>
# 
# kernel/exit.c
#   2004/06/02 01:02:05-07:00 jeremy@redfishsoftware.com.au +8 -0
#   Fix signal race during process exit
# 
# ChangeSet
#   2004/06/01 22:37:35+01:00 rmk@flint.arm.linux.org.uk 
#   [ARM] asm_do_IRQ takes an unsigned IRQ number.
# 
# arch/arm/kernel/irq.c
#   2004/06/01 22:35:13+01:00 rmk@flint.arm.linux.org.uk +1 -1
#   asm_do_IRQ should take an unsigned IRQ number.
# 
# ChangeSet
#   2004/06/01 22:06:35+01:00 nico@org.rmk.(none) 
#   [ARM PATCH] 1896/2: distinguish between memory and LCD clock on PXA
#   
#   Patch from Nicolas Pitre
#   
#   [patch rediffed]
#   
#   On PXA27x the memory and LCd clocks are different.
#   Also clean the PXA27x clock code a bit.
# 
# include/asm-arm/arch-pxa/hardware.h
#   2004/05/30 20:28:35+01:00 nico@org.rmk.(none) +3 -2
#   [PATCH] 1896/2: distinguish between memory and LCD clock on PXA
# 
# drivers/video/pxafb.c
#   2004/05/27 03:21:44+01:00 nico@org.rmk.(none) +1 -1
#   [PATCH] 1896/2: distinguish between memory and LCD clock on PXA
# 
# drivers/pcmcia/pxa2xx_base.c
#   2004/05/31 12:19:28+01:00 nico@org.rmk.(none) +6 -6
#   [PATCH] 1896/2: distinguish between memory and LCD clock on PXA
# 
# arch/arm/mach-pxa/pxa27x.c
#   2004/05/27 02:28:30+01:00 nico@org.rmk.(none) +50 -52
#   [PATCH] 1896/2: distinguish between memory and LCD clock on PXA
# 
# arch/arm/mach-pxa/pxa25x.c
#   2004/05/27 02:24:56+01:00 nico@org.rmk.(none) +12 -3
#   [PATCH] 1896/2: distinguish between memory and LCD clock on PXA
# 
# ChangeSet
#   2004/06/01 13:56:21-07:00 torvalds@ppc970.osdl.org 
#   Add comments on load balancing special cases.
#   
#   Ingo explains:
#   
#   The condition is 'impossible', but the whole balancing code is
#   (intentionally) a bit racy:
#   
#                   cpus_and(tmp, group->cpumask, cpu_online_map);
#                   if (!cpus_weight(tmp))
#                           goto next_group;
#   
#                   for_each_cpu_mask(i, tmp) {
#                           if (!idle_cpu(i))
#                                   goto next_group;
#                           push_cpu = i;
#                   }
#   
#                   rq = cpu_rq(push_cpu);
#                   double_lock_balance(busiest, rq);
#                   move_tasks(rq, push_cpu, busiest, 1, sd, IDLE);
#   
#   in the for_each_cpu_mask() loop we specifically check for each CPU in
#   the target group to be idle - so push_cpu's runqueue == busiest [==
#   current runqueue] cannot be true because the current CPU is not idle, we
#   are running in the migration thread ... But this is not a real problem,
#   load-balancing we do in a racy way to reduce overhead [and it's all
#   statistics anyway so absolute accuracy is impossible], and active
#   balancing itself is somewhat racy due to the migration-thread wakeup
#   (and the active_balance flag) going outside the runqueue locks [for
#   similar reasons].
#   
#   so it all looks quite plausible - the normal SMP boxes dont trigger it,
#   but Bjorn's 128-CPU setup with a non-trivial domain hiearachy triggers
#   it.
#   
#   Signed-off-by: Ingo Molnar <mingo@elte.hu>
#   Signed-off-by: Linus Torvalds <torvalds@osdl.org>
# 
# kernel/sched.c
#   2004/06/01 13:56:16-07:00 torvalds@ppc970.osdl.org +13 -1
#   Add comments on load balancing special cases.
# 
# ChangeSet
#   2004/06/01 13:40:59-07:00 bjorn.helgaas@hp.com 
#   [PATCH] active_load_balance() deadlock
#   
#   active_load_balance() looks susceptible to deadlock when busiest==rq.
#   Without the following patch, my 128-way box deadlocks consistently
#   during boot-time driver init.
# 
# kernel/sched.c
#   2004/05/31 11:03:32-07:00 bjorn.helgaas@hp.com +2 -0
#   active_load_balance() deadlock
# 
# ChangeSet
#   2004/06/01 20:42:35+01:00 rmk@flint.arm.linux.org.uk 
#   [ARM] Fix missing spinlock initialisation.
# 
# arch/arm/mach-integrator/core.c
#   2004/06/01 20:40:08+01:00 rmk@flint.arm.linux.org.uk +1 -1
#   Fix missing spinlock initialisation.
# 
# ChangeSet
#   2004/06/01 20:36:39+01:00 rmk@flint.arm.linux.org.uk 
#   [ARM] Update ARM memory region reservations.
#   
#   Remove 26-bit ARM region reserves.
#   
#   All region reserves start at PHYS_OFFSET, and we only ever have one,
#   so set res_size and reserve the region from PHYS_OFFSET size res_size.
#       
#   Don't free the .init sections on Integrator/CP - they sit in the SSRAM
#   obscured region so we are unable to use them for DMA purposes.
# 
# arch/arm/mm/init.c
#   2004/06/01 20:33:57+01:00 rmk@flint.arm.linux.org.uk +21 -19
#   Remove 26-bit ARM region reserves.
#   All region reserves start at PHYS_OFFSET, and we only ever have one,
#   so set res_size and reserve the region from PHYS_OFFSET size res_size.
#   
#   Don't free the .init sections on Integrator/CP - they sit in the SSRAM
#   obscured region.
# 
# ChangeSet
#   2004/06/01 12:13:52-07:00 torvalds@ppc970.osdl.org 
#   Start documenting the sign-off procedure in SubmittingPatches
#   
#   We already have over 200 sign-off lines in the kernel, so
#   let's document the thing, even if discussion may still be
#   on-going.
# 
# Documentation/SubmittingPatches
#   2004/06/01 12:13:47-07:00 torvalds@ppc970.osdl.org +41 -0
#   Start documenting the sign-off procedure in SubmittingPatches
#   
#   We already have over 200 sign-off lines in the kernel, so
#   let's document the thing, even if discussion may still be
#   on-going.
# 
# ChangeSet
#   2004/06/01 11:36:29-07:00 torvalds@ppc970.osdl.org 
#   Merge bk://linux-dj.bkbits.net/agpgart
#   into ppc970.osdl.org:/home/torvalds/v2.6/linux
# 
# include/linux/pci_ids.h
#   2004/06/01 11:36:26-07:00 torvalds@ppc970.osdl.org +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/06/01 18:10:55+01:00 davej@delerium.codemonkey.org.uk 
#   Merge delerium.codemonkey.org.uk:/mnt/nfs/neologic/bar/src/kernel/2.6/trees/bk-linus
#   into delerium.codemonkey.org.uk:/mnt/nfs/neologic/bar/src/kernel/2.6/trees/agpgart
# 
# include/linux/pci_ids.h
#   2004/06/01 18:10:31+01:00 davej@delerium.codemonkey.org.uk +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/06/01 17:39:56+01:00 davej@redhat.com 
#   [AGPGART] intel-agp: skip non-AGP devices
#   From: Matt Domsch.
#   The E7205 doesn't have an AGP header, so printing this message is
#   pretty much useless.  Also make it KERN_WARNING as well, as it's
#   not really worthy of a KERN_ERR
#    
# 
# drivers/char/agp/intel-agp.c
#   2004/06/01 17:39:50+01:00 davej@redhat.com +2 -1
#   [AGPGART] intel-agp: skip non-AGP devices
#   From: Matt Domsch.
#   The E7205 doesn't have an AGP header, so printing this message is
#   pretty much useless.  Also make it KERN_WARNING as well, as it's
#   not really worthy of a KERN_ERR
#    
# 
# ChangeSet
#   2004/06/01 17:34:01+01:00 davej@delerium.codemonkey.org.uk 
#   Cset exclude: davej@redhat.com|ChangeSet|20040523113850|65135
# 
# include/linux/pci_ids.h
#   2004/06/01 17:33:00+01:00 davej@delerium.codemonkey.org.uk +0 -0
#   Exclude
# 
# drivers/char/agp/intel-agp.c
#   2004/06/01 17:32:59+01:00 davej@delerium.codemonkey.org.uk +0 -0
#   Exclude
# 
# ChangeSet
#   2004/06/01 08:52:40-07:00 akpm@osdl.org 
#   [PATCH] radeonfb powerdown doesn't work
#   
#   From: <fxkuehl@gmx.de>
#   
#   When I switch the computer to standby with echo -n standby >
#   /sys/power/state the radeonfb driver tells me its suspending to state 1 but
#   the display does not get turned off.  It turns out to be a small typo in
#   drivers/video/aty/radeon_pm.c.
#   
#   (from http://bugme.osdl.org/show_bug.cgi?id=2758)
#   
#   Signed-off-by: Andrew Morton <akpm@osdl.org>
#   Signed-off-by: Linus Torvalds <torvalds@osdl.org>
# 
# drivers/video/aty/radeon_pm.c
#   2004/06/01 02:49:14-07:00 akpm@osdl.org +1 -1
#   radeonfb powerdown doesn't work
# 
# ChangeSet
#   2004/06/01 08:52:29-07:00 akpm@osdl.org 
#   [PATCH] CRIS architecture update
#   
#   From: "Mikael Starvik" <mikael.starvik@axis.com>
#   
#   - Lots of fixes from 2.4.
#   
#   - Updated for 2.6.6.
#   
#   - Added IDE driver
#   
#   Signed-off-by: Andrew Morton <akpm@osdl.org>
#   Signed-off-by: Linus Torvalds <torvalds@osdl.org>
# 
# include/asm-cris/sections.h
#   2004/06/01 08:52:22-07:00 akpm@osdl.org +7 -0
# 
# include/asm-cris/local.h
#   2004/06/01 08:52:22-07:00 akpm@osdl.org +1 -0
# 
# include/asm-cris/unistd.h
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +15 -1
#   CRIS architecture update
# 
# include/asm-cris/types.h
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +1 -0
#   CRIS architecture update
# 
# include/asm-cris/termbits.h
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +1 -1
#   CRIS architecture update
# 
# include/asm-cris/semaphore.h
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +6 -6
#   CRIS architecture update
# 
# include/asm-cris/semaphore-helper.h
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +2 -2
#   CRIS architecture update
# 
# include/asm-cris/sections.h
#   2004/06/01 08:52:22-07:00 akpm@osdl.org +0 -0
#   BitKeeper file /home/torvalds/v2.6/linux/include/asm-cris/sections.h
# 
# include/asm-cris/rtc.h
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +3 -1
#   CRIS architecture update
# 
# include/asm-cris/ptrace.h
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +2 -0
#   CRIS architecture update
# 
# include/asm-cris/pgtable.h
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +9 -1
#   CRIS architecture update
# 
# include/asm-cris/pci.h
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +4 -0
#   CRIS architecture update
# 
# include/asm-cris/page.h
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +8 -3
#   CRIS architecture update
# 
# include/asm-cris/local.h
#   2004/06/01 08:52:22-07:00 akpm@osdl.org +0 -0
#   BitKeeper file /home/torvalds/v2.6/linux/include/asm-cris/local.h
# 
# include/asm-cris/ioctl.h
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +10 -3
#   CRIS architecture update
# 
# include/asm-cris/io.h
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +2 -0
#   CRIS architecture update
# 
# include/asm-cris/fasttimer.h
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +3 -1
#   CRIS architecture update
# 
# include/asm-cris/dma-mapping.h
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +125 -1
#   CRIS architecture update
# 
# include/asm-cris/bitops.h
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +46 -0
#   CRIS architecture update
# 
# include/asm-cris/arch-v10/offset.h
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +1 -1
#   CRIS architecture update
# 
# include/asm-cris/arch-v10/irq.h
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +5 -0
#   CRIS architecture update
# 
# include/asm-cris/arch-v10/cache.h
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +1 -0
#   CRIS architecture update
# 
# arch/cris/mm/ioremap.c
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +0 -25
#   CRIS architecture update
# 
# arch/cris/mm/init.c
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +10 -15
#   CRIS architecture update
# 
# arch/cris/mm/fault.c
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +16 -10
#   CRIS architecture update
# 
# arch/cris/kernel/traps.c
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +2 -1
#   CRIS architecture update
# 
# arch/cris/kernel/time.c
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +51 -23
#   CRIS architecture update
# 
# arch/cris/kernel/sys_cris.c
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +1 -1
#   CRIS architecture update
# 
# arch/cris/kernel/setup.c
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +11 -10
#   CRIS architecture update
# 
# arch/cris/kernel/process.c
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +20 -6
#   CRIS architecture update
# 
# arch/cris/kernel/module.c
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +20 -5
#   CRIS architecture update
# 
# arch/cris/kernel/irq.c
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +7 -14
#   CRIS architecture update
# 
# arch/cris/kernel/crisksyms.c
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +9 -1
#   CRIS architecture update
# 
# arch/cris/kernel/Makefile
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +3 -3
#   CRIS architecture update
# 
# arch/cris/defconfig
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +375 -208
#   CRIS architecture update
# 
# arch/cris/arch-v10/mm/tlb.c
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +1 -1
#   CRIS architecture update
# 
# arch/cris/arch-v10/mm/fault.c
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +15 -21
#   CRIS architecture update
# 
# arch/cris/arch-v10/lib/old_checksum.c
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +2 -2
#   CRIS architecture update
# 
# arch/cris/arch-v10/lib/dram_init.S
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +7 -3
#   CRIS architecture update
# 
# arch/cris/arch-v10/kernel/time.c
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +7 -1
#   CRIS architecture update
# 
# arch/cris/arch-v10/kernel/signal.c
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +3 -1
#   CRIS architecture update
# 
# arch/cris/arch-v10/kernel/setup.c
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +8 -1
#   CRIS architecture update
# 
# arch/cris/arch-v10/kernel/ptrace.c
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +22 -37
#   CRIS architecture update
# 
# arch/cris/arch-v10/kernel/process.c
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +18 -1
#   CRIS architecture update
# 
# arch/cris/arch-v10/kernel/head.S
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +27 -4
#   CRIS architecture update
# 
# arch/cris/arch-v10/kernel/fasttimer.c
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +12 -5
#   CRIS architecture update
# 
# arch/cris/arch-v10/kernel/entry.S
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +20 -1
#   CRIS architecture update
# 
# arch/cris/arch-v10/kernel/debugport.c
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +64 -88
#   CRIS architecture update
# 
# arch/cris/arch-v10/drivers/serial.h
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +11 -9
#   CRIS architecture update
# 
# arch/cris/arch-v10/drivers/serial.c
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +1207 -229
#   CRIS architecture update
# 
# arch/cris/arch-v10/drivers/pcf8563.c
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +58 -14
#   CRIS architecture update
# 
# arch/cris/arch-v10/drivers/ide.c
#   2004/06/01 08:52:21-07:00 akpm@osdl.org +945 -0
# 
# arch/cris/arch-v10/drivers/i2c.h
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +3 -1
#   CRIS architecture update
# 
# arch/cris/arch-v10/drivers/i2c.c
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +67 -11
#   CRIS architecture update
# 
# arch/cris/arch-v10/drivers/gpio.c
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +59 -25
#   CRIS architecture update
# 
# arch/cris/arch-v10/drivers/ethernet.c
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +237 -66
#   CRIS architecture update
# 
# arch/cris/arch-v10/drivers/eeprom.c
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +5 -2
#   CRIS architecture update
# 
# arch/cris/arch-v10/drivers/ds1302.c
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +63 -31
#   CRIS architecture update
# 
# arch/cris/arch-v10/drivers/axisflashmap.c
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +38 -23
#   CRIS architecture update
# 
# arch/cris/arch-v10/drivers/Makefile
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +2 -0
#   CRIS architecture update
# 
# arch/cris/arch-v10/drivers/Kconfig
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +193 -23
#   CRIS architecture update
# 
# arch/cris/arch-v10/defconfig
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +1 -0
#   CRIS architecture update
# 
# arch/cris/arch-v10/boot/compressed/misc.c
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +2 -2
#   CRIS architecture update
# 
# arch/cris/Makefile
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +7 -3
#   CRIS architecture update
# 
# arch/cris/Kconfig
#   2004/06/01 02:27:58-07:00 akpm@osdl.org +36 -40
#   CRIS architecture update
# 
# arch/cris/arch-v10/drivers/ide.c
#   2004/06/01 08:52:21-07:00 akpm@osdl.org +0 -0
#   BitKeeper file /home/torvalds/v2.6/linux/arch/cris/arch-v10/drivers/ide.c
# 
# BitKeeper/deleted/.del-hexify.c~280d7fbaab878e8a
#   2004/06/01 08:52:21-07:00 akpm@osdl.org +0 -0
#   Delete: arch/cris/kernel/hexify.c
# 
# ChangeSet
#   2004/06/01 08:52:01-07:00 akpm@osdl.org 
#   [PATCH] correct use_mm()/unuse_mm() to use task_lock() to protect ->mm
#   
#   From: William Lee Irwin III <wli@holomorphy.com>
#   
#   Split off from suparna's patches:
#   
#   Correct use_mm()/unuse_mm() to use task_lock() to protect task->mm.
#   
#   Signed-off-by: Andrew Morton <akpm@osdl.org>
#   Signed-off-by: Linus Torvalds <torvalds@osdl.org>
# 
# fs/aio.c
#   2004/06/01 02:27:57-07:00 akpm@osdl.org +7 -1
#   correct use_mm()/unuse_mm() to use task_lock() to protect ->mm
# 
# ChangeSet
#   2004/06/01 08:51:50-07:00 akpm@osdl.org 
#   [PATCH] use aio workqueue in fs/aio.c
#   
#   From: William Lee Irwin III <wli@holomorphy.com>
#   
#   Minor aio correction split off from suparna's patches:
#   
#   Use the dedicated aio workqueue, not keventd, in order to isolate the rest
#   of the system from aio's demands.
#   
#   Signed-off-by: Andrew Morton <akpm@osdl.org>
#   Signed-off-by: Linus Torvalds <torvalds@osdl.org>
# 
# fs/aio.c
#   2004/06/01 02:33:30-07:00 akpm@osdl.org +1 -1
#   use aio workqueue in fs/aio.c
# 
# ChangeSet
#   2004/06/01 08:51:39-07:00 akpm@osdl.org 
#   [PATCH] cpqarray.c: seed the random number pool
#   
#   From: George France <france@handhelds.org>
#   
#   Teach cpqarray.c to do the add_disk_randomness() thing.
#   
#   Signed-off-by: Andrew Morton <akpm@osdl.org>
#   Signed-off-by: Linus Torvalds <torvalds@osdl.org>
# 
# drivers/block/cpqarray.c
#   2004/06/01 02:27:57-07:00 akpm@osdl.org +2 -1
#   cpqarray.c: seed the random number pool
# 
# ChangeSet
#   2004/06/01 08:51:28-07:00 akpm@osdl.org 
#   [PATCH] sched: remove noinline workaround
#   
#   From: Ingo Molnar <mingo@elte.hu>
#   
#   Now the x86_64 bitop memory clobber problem has been fixed we can remove
#   this.
#   
#   Signed-off-by: Ingo Molnar <mingo@elte.hu>
#   Signed-off-by: Andrew Morton <akpm@osdl.org>
#   Signed-off-by: Linus Torvalds <torvalds@osdl.org>
# 
# kernel/sched.c
#   2004/06/01 02:27:57-07:00 akpm@osdl.org +1 -4
#   sched: remove noinline workaround
# 
# ChangeSet
#   2004/06/01 08:51:17-07:00 akpm@osdl.org 
#   [PATCH] i386: add missing bitop.h memory clobbers
#   
#   From: Andi Kleen <ak@muc.de>
#   
#   Add missing memory clobbers to find_first_bit() and find_first_zero_bit().
#   
#   Signed-off-by: Andrew Morton <akpm@osdl.org>
#   Signed-off-by: Linus Torvalds <torvalds@osdl.org>
# 
# include/asm-i386/bitops.h
#   2004/06/01 02:27:57-07:00 akpm@osdl.org +2 -2
#   i386: add missing bitop.h memory clobbers
# 
# ChangeSet
#   2004/06/01 08:51:07-07:00 akpm@osdl.org 
#   [PATCH] Fix readahead handling in knfsd
#   
#   From: NeilBrown <neilb@cse.unsw.edu.au>
#   
#   The read-ahead structures were not being initialised properly, and were not
#   having the use-count decremented after use, making them fairly useless
#   (since Apr 2002!).
#   
#   From: Colin Gibbs <colin@gibbsonline.net>
#   Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
#   Signed-off-by: Andrew Morton <akpm@osdl.org>
#   Signed-off-by: Linus Torvalds <torvalds@osdl.org>
# 
# fs/nfsd/vfs.c
#   2004/06/01 02:27:57-07:00 akpm@osdl.org +9 -5
#   Fix readahead handling in knfsd
# 
# ChangeSet
#   2004/06/01 08:50:56-07:00 akpm@osdl.org 
#   [PATCH] fix mca procfs stub
#   
#   From: Christoph Hellwig <hch@lst.de>
#   
#   
#   Signed-off-by: Andrew Morton <akpm@osdl.org>
#   Signed-off-by: Linus Torvalds <torvalds@osdl.org>
# 
# include/linux/mca.h
#   2004/06/01 02:27:57-07:00 akpm@osdl.org +1 -1
#   fix mca procfs stub
# 
# ChangeSet
#   2004/06/01 08:50:45-07:00 akpm@osdl.org 
#   [PATCH] linux/timer.h needs linux/stddef.h
#   
#   From: Christoph Hellwig <hch@lst.de>
#   
#   timer.h is using NULL and thus needs stddef.h, without it some drivers
#   break on alpha.
#   
#   Signed-off-by: Andrew Morton <akpm@osdl.org>
#   Signed-off-by: Linus Torvalds <torvalds@osdl.org>
# 
# include/linux/timer.h
#   2004/06/01 02:27:56-07:00 akpm@osdl.org +1 -0
#   linux/timer.h needs linux/stddef.h
# 
# ChangeSet
#   2004/06/01 08:50:34-07:00 akpm@osdl.org 
#   [PATCH] s/tkill/tgkill/ in /** documentation */
#   
#   From: bert hubert <ahu@ds9a.nl>
#   
#   Documentation is in fact for tgkill and not for tkill
#   
#   Signed-off-by: Andrew Morton <akpm@osdl.org>
#   Signed-off-by: Linus Torvalds <torvalds@osdl.org>
# 
# kernel/signal.c
#   2004/06/01 02:27:56-07:00 akpm@osdl.org +1 -1
#   s/tkill/tgkill/ in /** documentation */
# 
# ChangeSet
#   2004/06/01 08:50:23-07:00 akpm@osdl.org 
#   [PATCH] vesafb: vram boot option the same as 2.4.x
#   
#   From: Marc-Christian Petersen <m.c.p@kernel.linux-systeme.com>
#   
#   Give the vesafb `vram' boot option the same (silly) syntax as 2.4 and
#   document it.
#   
#   Signed-off-by: Andrew Morton <akpm@osdl.org>
#   Signed-off-by: Linus Torvalds <torvalds@osdl.org>
# 
# drivers/video/vesafb.c
#   2004/06/01 02:27:56-07:00 akpm@osdl.org +1 -1
#   vesafb: vram boot option the same as 2.4.x
# 
# Documentation/fb/vesafb.txt
#   2004/06/01 02:27:56-07:00 akpm@osdl.org +4 -0
#   vesafb: vram boot option the same as 2.4.x
# 
# ChangeSet
#   2004/06/01 08:50:12-07:00 akpm@osdl.org 
#   [PATCH] Document checkstacks
#   
#   From: Diego Calleja =?ISO-8859-15?Q?Garc=EDa?= <diegocg@teleline.es>
#   
#   It'll be much better if the world can know about the existence of
#   checkstacks.
#   
#   Signed-off-by: Andrew Morton <akpm@osdl.org>
#   Signed-off-by: Linus Torvalds <torvalds@osdl.org>
# 
# Makefile
#   2004/06/01 02:27:56-07:00 akpm@osdl.org +1 -0
#   Document checkstacks
# 
# ChangeSet
#   2004/06/01 08:50:02-07:00 akpm@osdl.org 
#   [PATCH] pnpbios only makes sense for X86
#   
#   From: Christoph Hellwig <hch@lst.de>
#   
#   Extracted from the Debian kernel package
#   
#   Signed-off-by: Andrew Morton <akpm@osdl.org>
#   Signed-off-by: Linus Torvalds <torvalds@osdl.org>
# 
# drivers/pnp/pnpbios/Kconfig
#   2004/06/01 02:27:56-07:00 akpm@osdl.org +1 -1
#   pnpbios only makes sense for X86
# 
# ChangeSet
#   2004/06/01 08:49:51-07:00 akpm@osdl.org 
#   [PATCH] SECURITY_SELINUX depends on NET
#   
#   From: Adrian Bunk <bunk@fs.tum.de>
#   
#     LD      .tmp_vmlinux1
#   security/built-in.o(.text+0x97e4): In function `selnl_notify':
#   : undefined reference to `alloc_skb'
#   security/built-in.o(.text+0x988a): In function `selnl_notify':
#   : undefined reference to `netlink_broadcast'
#   
#   Signed-off-by: Andrew Morton <akpm@osdl.org>
#   Signed-off-by: Linus Torvalds <torvalds@osdl.org>
# 
# security/selinux/Kconfig
#   2004/06/01 02:27:56-07:00 akpm@osdl.org +1 -1
#   SECURITY_SELINUX depends on NET
# 
# ChangeSet
#   2004/06/01 08:49:40-07:00 akpm@osdl.org 
#   [PATCH] POSIX_MQUEUE depends on NET
#   
#   From: Adrian Bunk <bunk@fs.tum.de>
#   
#   POSIX_MQUEUE requires netlink.
#   
#   Signed-off-by: Andrew Morton <akpm@osdl.org>
#   Signed-off-by: Linus Torvalds <torvalds@osdl.org>
# 
# init/Kconfig
#   2004/06/01 02:27:56-07:00 akpm@osdl.org +1 -1
#   POSIX_MQUEUE depends on NET
# 
# ChangeSet
#   2004/06/01 08:49:31-07:00 akpm@osdl.org 
#   [PATCH] md.c message during quiet boot
#   
#   From: Ingo Molnar <mingo@elte.hu>
#   
#   the patch below gets rid of a message that gets printed during FC2's quiet
#   bootup.
#   
#   Signed-off-by: Andrew Morton <akpm@osdl.org>
#   Signed-off-by: Linus Torvalds <torvalds@osdl.org>
# 
# drivers/md/md.c
#   2004/06/01 02:27:56-07:00 akpm@osdl.org +1 -1
#   md.c message during quiet boot
# 
# ChangeSet
#   2004/06/01 08:49:20-07:00 akpm@osdl.org 
#   [PATCH] Missing pop-off in arch/i386/kernel/acpi/wakeup.S
#   
#   From: <gniibe@m17n.org>
#   
#   There is a missing pop-off after call of acpi_enter_sleep_state.  On
#   success, acpi_enter_sleep_state never returns, but on failure, it will
#   cause kernel OOPS.
#   
#   Signed-off-by: Andrew Morton <akpm@osdl.org>
#   Signed-off-by: Linus Torvalds <torvalds@osdl.org>
# 
# arch/i386/kernel/acpi/wakeup.S
#   2004/06/01 02:27:55-07:00 akpm@osdl.org +1 -0
#   Missing pop-off in arch/i386/kernel/acpi/wakeup.S
# 
# ChangeSet
#   2004/06/01 08:49:10-07:00 akpm@osdl.org 
#   [PATCH] Support for SC1100
#   
#   From: David Goodenough <david.goodenough@btconnect.com>
#   
#   Add PCI device supoprt for the Geode SC1100-based Microtik Routerboard 230.
#   
#   Signed-off-by: Andrew Morton <akpm@osdl.org>
#   Signed-off-by: Linus Torvalds <torvalds@osdl.org>
# 
# include/linux/pci_ids.h
#   2004/06/01 02:27:55-07:00 akpm@osdl.org +1 -0
#   Support for SC1100
# 
# drivers/i2c/busses/scx200_acb.c
#   2004/06/01 02:27:55-07:00 akpm@osdl.org +5 -2
#   Support for SC1100
# 
# drivers/char/watchdog/scx200_wdt.c
#   2004/06/01 02:27:55-07:00 akpm@osdl.org +8 -2
#   Support for SC1100
# 
# arch/i386/kernel/scx200.c
#   2004/06/01 02:27:55-07:00 akpm@osdl.org +4 -1
#   Support for SC1100
# 
# ChangeSet
#   2004/06/01 08:48:58-07:00 akpm@osdl.org 
#   [PATCH] Mark cache_names __initdata
#   
#   From: Brian Gerst <bgerst@didntduck.org>
#   
#   We don't need to keep the pointer array around after the caches are
#   initialized.  This doesn't affect the actual strings.
#   
#   Signed-off-by: Andrew Morton <akpm@osdl.org>
#   Signed-off-by: Linus Torvalds <torvalds@osdl.org>
# 
# mm/slab.c
#   2004/06/01 02:27:55-07:00 akpm@osdl.org +4 -2
#   Mark cache_names __initdata
# 
# ChangeSet
#   2004/06/01 08:48:47-07:00 akpm@osdl.org 
#   [PATCH] Add FUTEX_CMP_REQUEUE futex op
#   
#   From: Jakub Jelinek <jakub@redhat.com>
#   
#   FUTEX_REQUEUE operation has been added to the kernel mainly to improve
#   pthread_cond_broadcast which previously used FUTEX_WAKE INT_MAX op.
#   pthread_cond_broadcast releases internal condvar mutex before FUTEX_REQUEUE
#   operation, as otherwise the woken up thread most likely immediately sleeps
#   again on the internal condvar mutex until the broadcasting thread releases it.
#   
#   Unfortunately this is racy and causes e.g.
#   http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/nptl/tst-cond16.c?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=glibc
#   to hang on SMP.
#   
#   http://listman.redhat.com/archives/phil-list/2004-May/msg00023.html contains
#   analysis how the hang happens, the problem is if any thread does
#   pthread_cond_*wait in between releasing of the internal condvar mutex and
#   FUTEX_REQUEUE operation, a wrong thread might be awaken (and immediately go to
#   sleep again because it doesn't satisfy conditions for returning from
#   pthread_cond_*wait) while the right thread requeued on the associated mutex
#   and there would be nobody to wake that thread up.
#   
#   The patch below extends FUTEX_REQUEUE operation with something FUTEX_WAIT
#   already uses:
#   
#   FUTEX_CMP_REQUEUE is passed an additional argument which is the expected value
#   of *futex.  Kernel then while holding the futex locks checks if *futex !=
#   expected and returns -EAGAIN in that case, while if it is equal, continues
#   with a normal FUTEX_REQUEUE operation.  If the syscall returns -EAGAIN, NPTL
#   can fall back to FUTEX_WAKE INT_MAX operation which doesn't have this problem,
#   but is less efficient, while in the likely case that nobody hit the (small)
#   window the efficient FUTEX_REQUEUE operation is used.
#   
#   Signed-off-by: Andrew Morton <akpm@osdl.org>
#   Signed-off-by: Linus Torvalds <torvalds@osdl.org>
# 
# kernel/futex.c
#   2004/06/01 02:27:55-07:00 akpm@osdl.org +43 -6
#   Add FUTEX_CMP_REQUEUE futex op
# 
# kernel/compat.c
#   2004/06/01 02:27:55-07:00 akpm@osdl.org +4 -3
#   Add FUTEX_CMP_REQUEUE futex op
# 
# include/linux/futex.h
#   2004/06/01 02:27:55-07:00 akpm@osdl.org +3 -2
#   Add FUTEX_CMP_REQUEUE futex op
# 
# ChangeSet
#   2004/06/01 08:48:36-07:00 akpm@osdl.org 
#   [PATCH] Add watchdog timer to iseries_veth driver
#   
#   From: David Gibson <david@gibson.dropbear.id.au>
#   
#   Currently the iSeries virtual ethernet driver has no Tx watchdog timer. 
#   This makes it vulnerable to clagging up if the other end of connection is
#   misbehaving - in particular if it is not giving timely hypervisor level
#   acks to our data frams.
#   
#   This patch adds a watchdog timer which resets the connection to any lpar we
#   seem to be having trouble sending to.  With any luck the other end might
#   behave better after the reset.  If not, this will at least unclag the queue
#   for a while so we can keep talking to the lpars which are behaving
#   correctly.
#   
#   Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
#   Signed-off-by: Andrew Morton <akpm@osdl.org>
#   Signed-off-by: Linus Torvalds <torvalds@osdl.org>
# 
# drivers/net/iseries_veth.c
#   2004/06/01 02:27:55-07:00 akpm@osdl.org +45 -0
#   Add watchdog timer to iseries_veth driver
# 
# ChangeSet
#   2004/06/01 08:48:25-07:00 akpm@osdl.org 
#   [PATCH] ppc64: iseries bolted SLB fix
#   
#   From: Anton Blanchard <anton@samba.org>
#   
#   Legacy iseries has problems with the bolted vmalloc patch.  This patch
#   disables the optimisation on iseries and creates a slb_add_bolted helper
#   function.
#   
#   Also, while we require all SLB entries to be context switched, we werent
#   informing the iseries hypervisor.
#   
#   Signed-off-by: Anton Blanchard <anton@samba.org>
#   Signed-off-by: Andrew Morton <akpm@osdl.org>
#   Signed-off-by: Linus Torvalds <torvalds@osdl.org>
# 
# arch/ppc64/kernel/stab.c
#   2004/06/01 02:27:50-07:00 akpm@osdl.org +22 -27
#   ppc64: iseries bolted SLB fix
# 
# arch/ppc64/kernel/pacaData.c
#   2004/06/01 02:27:50-07:00 akpm@osdl.org +3 -1
#   ppc64: iseries bolted SLB fix
# 
# ChangeSet
#   2004/06/01 08:48:14-07:00 akpm@osdl.org 
#   [PATCH] ppc64: SLB accounting fix
#   
#   From: Anton Blanchard <anton@samba.org>
#   
#   Even though we have a variable containing the number of entries in the SLB,
#   we hardwire the value at boot.  We also dont use the variable in the head.S
#   fastpath handler.
#   
#   This patch removes it.
#   
#   Signed-off-by: Anton Blanchard <anton@samba.org>
#   Signed-off-by: Andrew Morton <akpm@osdl.org>
#   Signed-off-by: Linus Torvalds <torvalds@osdl.org>
# 
# include/asm-ppc64/processor.h
#   2004/06/01 02:27:47-07:00 akpm@osdl.org +6 -0
#   ppc64: SLB accounting fix
# 
# include/asm-ppc64/naca.h
#   2004/06/01 02:27:47-07:00 akpm@osdl.org +1 -1
#   ppc64: SLB accounting fix
# 
# arch/ppc64/xmon/xmon.c
#   2004/06/01 02:27:47-07:00 akpm@osdl.org +1 -1
#   ppc64: SLB accounting fix
# 
# arch/ppc64/kernel/stab.c
#   2004/06/01 02:33:33-07:00 akpm@osdl.org +1 -1
#   ppc64: SLB accounting fix
# 
# arch/ppc64/kernel/prom.c
#   2004/06/01 02:33:32-07:00 akpm@osdl.org +0 -7
#   ppc64: SLB accounting fix
# 
# arch/ppc64/kernel/iSeries_setup.c
#   2004/06/01 02:27:47-07:00 akpm@osdl.org +0 -5
#   ppc64: SLB accounting fix
# 
# arch/ppc64/kernel/head.S
#   2004/06/01 02:27:47-07:00 akpm@osdl.org +0 -2
#   ppc64: SLB accounting fix
# 
# arch/ppc64/kernel/asm-offsets.c
#   2004/06/01 02:27:47-07:00 akpm@osdl.org +0 -1
#   ppc64: SLB accounting fix
# 
# ChangeSet
#   2004/06/01 08:48:03-07:00 akpm@osdl.org 
#   [PATCH] ppc64: bolt first vmalloc segment into SLB
#   
#   From: Anton Blanchard <anton@samba.org>
#   
#   Based on some profiles we noticed the first vmalloc region was being
#   continually cast out and replaced.  All modules end up there so it is one
#   of our hottest segments.
#   
#   This patch bolts the vmalloc region into the second segment.  SLB misses on
#   an NFS benchmark were reduced by about 10% with this patch.
#   
#   Signed-off-by: Anton Blanchard <anton@samba.org>
#   Signed-off-by: Andrew Morton <akpm@osdl.org>
#   Signed-off-by: Linus Torvalds <torvalds@osdl.org>
# 
# include/asm-ppc64/mmu_context.h
#   2004/06/01 02:27:44-07:00 akpm@osdl.org +8 -2
#   ppc64: bolt first vmalloc segment into SLB
# 
# arch/ppc64/kernel/stab.c
#   2004/06/01 02:33:33-07:00 akpm@osdl.org +41 -4
#   ppc64: bolt first vmalloc segment into SLB
# 
# arch/ppc64/kernel/head.S
#   2004/06/01 02:33:33-07:00 akpm@osdl.org +1 -1
#   ppc64: bolt first vmalloc segment into SLB
# 
# ChangeSet
#   2004/06/01 08:47:52-07:00 akpm@osdl.org 
#   [PATCH] ppc64: reset iseries progress indicator on boot
#   
#   From: Anton Blanchard <anton@samba.org>
#   
#   Reset the progress indicator on iseries after boot.
#   
#   Signed-off-by: John Engel <engel@us.ibm.com>
#   Signed-off-by: Anton Blanchard <anton@samba.org>
#   Signed-off-by: Andrew Morton <akpm@osdl.org>
#   Signed-off-by: Linus Torvalds <torvalds@osdl.org>
# 
# arch/ppc64/kernel/iSeries_setup.c
#   2004/06/01 02:33:33-07:00 akpm@osdl.org +9 -0
#   ppc64: reset iseries progress indicator on boot
# 
# ChangeSet
#   2004/06/01 08:47:41-07:00 akpm@osdl.org 
#   [PATCH] ppc64: add eeh_add_device_early/late
#   
#   From: Anton Blanchard <anton@samba.org>
#   
#   Implement eeh_add_device_early and eeh_add_device_late, required for
#   the ppc64 PCI hotplug code.
#   
#   Signed-off-by: Linas Vepstas <linas@us.ibm.com>
#   Signed-off-by: Anton Blanchard <anton@samba.org>
#   Signed-off-by: Andrew Morton <akpm@osdl.org>
#   Signed-off-by: Linus Torvalds <torvalds@osdl.org>
# 
# include/asm-ppc64/eeh.h
#   2004/06/01 02:27:13-07:00 akpm@osdl.org +8 -8
#   ppc64: add eeh_add_device_early/late
# 
# arch/ppc64/kernel/eeh.c
#   2004/06/01 02:27:13-07:00 akpm@osdl.org +31 -20
#   ppc64: add eeh_add_device_early/late
# 
# ChangeSet
#   2004/06/01 08:47:31-07:00 akpm@osdl.org 
#   [PATCH] ppc64: iSeries fix virtual ethernet transmit block
#   
#   From: Stephen Rothwell <sfr@canb.auug.org.au>
#   
#   This patch fixes the virtual ethernet driver so that it will not block the
#   transmit queue indefinitely.  This patch appplies on top of the previous
#   patch from Rusty that removed skb_clone.  There is one white space fix in
#   hte middle of this - I hope that doesn't offend :-).
#   
#   Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
#   Signed-off-by: Andrew Morton <akpm@osdl.org>
#   Signed-off-by: Linus Torvalds <torvalds@osdl.org>
# 
# drivers/net/iseries_veth.c
#   2004/06/01 02:33:32-07:00 akpm@osdl.org +11 -5
#   ppc64: iSeries fix virtual ethernet transmit block
# 
# ChangeSet
#   2004/06/01 08:47:20-07:00 akpm@osdl.org 
#   [PATCH] ppc64: iSeries virtual ethernet minor optimisation
#   
#   From: Stephen Rothwell <sfr@canb.auug.org.au>
#   
#   This has only been adjusted by me to apply after David Gibson's patch to
#   add a watchdog timer.
#   
#   The iseries_veth driver does skb_clone, it should only need to skb_get,
#   which is cheaper.  Should help performance a little.
#   
#   Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
#   Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
#   Signed-off-by: Andrew Morton <akpm@osdl.org>
#   Signed-off-by: Linus Torvalds <torvalds@osdl.org>
# 
# drivers/net/iseries_veth.c
#   2004/06/01 02:33:33-07:00 akpm@osdl.org +1 -10
#   ppc64: iSeries virtual ethernet minor optimisation
# 
# ChangeSet
#   2004/06/01 08:47:09-07:00 akpm@osdl.org 
#   [PATCH] ppc64: iSeries default config update
#   
#   From: Stephen Rothwell <sfr@canb.auug.org.au>
#   
#   This patch brings the iSeries default config up to date and changes some of
#   the options to what I use.  These are more sensible options (at least in my
#   opinion :-)).  Please apply.
#   
#   Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
#   Signed-off-by: Andrew Morton <akpm@osdl.org>
#   Signed-off-by: Linus Torvalds <torvalds@osdl.org>
# 
# arch/ppc64/configs/iSeries_defconfig
#   2004/06/01 02:27:13-07:00 akpm@osdl.org +62 -80
#   ppc64: iSeries default config update
# 
# ChangeSet
#   2004/06/01 08:46:58-07:00 akpm@osdl.org 
#   [PATCH] radeonfb fix (non-8bpp clear doesn't use palette)
#   
#   From: Jurriaan <thunder7@xs4all.nl>
#   
#   I've used this patch since 2.6.5, and other users have confirmed it
#   solves their problems.
#   
#   Basically, when not in 8bpp mode, radeonfb should use the palette when
#   clearing a region on screen.  This is how it's done in 2.4 and xfree, also.
#   
#   Signed-off-by: Jurriaan Kalkman <thunder7@xs4all.nl>
#   Signed-off-by: Andrew Morton <akpm@osdl.org>
#   Signed-off-by: Linus Torvalds <torvalds@osdl.org>
# 
# drivers/video/aty/radeon_accel.c
#   2004/06/01 02:27:13-07:00 akpm@osdl.org +4 -1
#   radeonfb fix (non-8bpp clear doesn't use palette)
# 
# ChangeSet
#   2004/06/01 08:36:07-07:00 paulus@samba.org 
#   [PATCH] ppc64: fix missing RELOCs, add linux,phandle property
#   
#   This fixes a couple of bugs in arch/ppc64/kernel/prom.c.  We were
#   missing a couple of places where we needed to use RELOC().  I added the
#   RELOC in one case, and in the other, moved the variable that we were
#   accessing onto the stack (and reduced its size).  (We use the variable
#   to get a property value, but we aren't interested in the value, just in
#   whether the property exists or not.  Since we pass the size of the
#   variable to the OF getprop call, it won't overflow.) The effect of
#   missing the RELOCs would be that random memory locations get used on IBM
#   pSeries systems (possibly causing random boot failures). 
#   
#   The other thing that this does is add a linux,phandle property to each
#   node, containing the phandle for the node, which is the token that OF
#   uses to identify the node.  Some nodes reference other nodes by means
#   of their phandle.  Without the linux,phandle property, userspace code
#   looking at the OF device-tree image in /proc/device-tree has no way of
#   knowing which other node is being referenced.
#   
#   Signed-off-by: Paul Mackerras <paulus@samba.org>
#   Signed-off-by: Linus Torvalds <torvalds@osdl.org>
# 
# arch/ppc64/kernel/prom.c
#   2004/05/30 21:20:35-07:00 paulus@samba.org +21 -20
#   ppc64: fix missing RELOCs, add linux,phandle property
# 
# ChangeSet
#   2004/06/01 08:35:56-07:00 rusty@rustcorp.com.au 
#   [PATCH] Export kthread primitives
#   
#   kthreads are not just for breakfast anymore.
#   
#   Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (creator)
#   Signed-off-by: Linus Torvalds <torvalds@osdl.org>
# 
# kernel/kthread.c
#   2004/05/31 20:55:26-07:00 rusty@rustcorp.com.au +5 -1
#   Export kthread primitives
# 
# ChangeSet
#   2004/06/01 08:35:45-07:00 ak@suse.de 
#   [PATCH] Fix x86-64 compilation without CONFIG_NUMA
#   
#   This fixes compilation of x86-64 without CONFIG_NUMA again (got broken
#   by the previous patchkit)
# 
# kernel/sys.c
#   2004/06/01 08:16:26-07:00 ak@suse.de +1 -0
#   Fix x86-64 compilation without CONFIG_NUMA
# 
# ChangeSet
#   2004/06/01 08:33:51-07:00 torvalds@ppc970.osdl.org 
#   sparse: use new generic __chk_user_ptr() macro in x86/ppc64/sparc*
#   
#   Older versions of gcc were unhappy with our previous trick, and
#   just separating out the __CHECKER__ case made it much simpler.
# 
# include/linux/compiler.h
#   2004/06/01 08:33:45-07:00 torvalds@ppc970.osdl.org +2 -0
#   sparse: use new generic __chk_user_ptr() macro in x86/ppc64/sparc*
#   
#   Older versions of gcc were unhappy with our previous trick, and
#   just separating out the __CHECKER__ case made it much simpler.
# 
# include/asm-sparc64/uaccess.h
#   2004/06/01 08:33:45-07:00 torvalds@ppc970.osdl.org +2 -6
#   sparse: use new generic __chk_user_ptr() macro in x86/ppc64/sparc*
#   
#   Older versions of gcc were unhappy with our previous trick, and
#   just separating out the __CHECKER__ case made it much simpler.
# 
# include/asm-sparc/uaccess.h
#   2004/06/01 08:33:45-07:00 torvalds@ppc970.osdl.org +2 -6
#   sparse: use new generic __chk_user_ptr() macro in x86/ppc64/sparc*
#   
#   Older versions of gcc were unhappy with our previous trick, and
#   just separating out the __CHECKER__ case made it much simpler.
# 
# include/asm-ppc64/uaccess.h
#   2004/06/01 08:33:45-07:00 torvalds@ppc970.osdl.org +2 -6
#   sparse: use new generic __chk_user_ptr() macro in x86/ppc64/sparc*
#   
#   Older versions of gcc were unhappy with our previous trick, and
#   just separating out the __CHECKER__ case made it much simpler.
# 
# include/asm-i386/uaccess.h
#   2004/06/01 08:33:45-07:00 torvalds@ppc970.osdl.org +4 -8
#   sparse: use new generic __chk_user_ptr() macro in x86/ppc64/sparc*
#   
#   Older versions of gcc were unhappy with our previous trick, and
#   just separating out the __CHECKER__ case made it much simpler.
# 
# ChangeSet
#   2004/06/01 13:49:42+01:00 davej@redhat.com 
#   [CPUFREQ] Fix build of longhaul.
#   Arjan noted that in some cases, the build fails.
#   This should fix it up.
# 
# arch/i386/kernel/cpu/cpufreq/longhaul.c
#   2004/06/01 13:49:31+01:00 davej@redhat.com +2 -2
#   [CPUFREQ] Fix build of longhaul.
#   Arjan noted that in some cases, the build fails.
#   This should fix it up.
# 
# ChangeSet
#   2004/06/01 10:35:02+01:00 davej@redhat.com 
#   [AGPGART] Improve the resume functions for Intel AGP bridges by restoring config space
#   (the bios might not have done that).
#   
#   From: Arjan van de Ven
# 
# drivers/char/agp/intel-mch-agp.c
#   2004/06/01 10:34:53+01:00 davej@redhat.com +2 -6
#   [AGPGART] Improve the resume functions for Intel AGP bridges by restoring config space
#   (the bios might not have done that).
#   
#   From: Arjan van de Ven
# 
# drivers/char/agp/intel-agp.c
#   2004/06/01 10:34:53+01:00 davej@redhat.com +2 -6
#   [AGPGART] Improve the resume functions for Intel AGP bridges by restoring config space
#   (the bios might not have done that).
#   
#   From: Arjan van de Ven
# 
# ChangeSet
#   2004/06/01 09:00:11+01:00 davej@redhat.com 
#   [AGPGART] Make agp=off work again.
#   This option only worked for the amd64 driver.
#   On every other driver, the only thing it did was
#   make it not printk the banner on startup.
# 
# drivers/char/agp/backend.c
#   2004/06/01 09:00:05+01:00 davej@redhat.com +8 -5
#   [AGPGART] Make agp=off work again.
#   This option only worked for the amd64 driver.
#   On every other driver, the only thing it did was
#   make it not printk the banner on startup.
# 
# ChangeSet
#   2004/06/01 08:50:18+01:00 davej@redhat.com 
#   [AGPGART] Fix broken serverworks tlb flush routine.
#   This is horribly broken due to a jiffy wrap bug, we never get out of
#   the while loop, preventing booting on a kernel with this driver
#   compiled in. (See https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=124495)
#   
#   The warning message there has never been reported in any bug report
#   that google can find, so I'm of the opinion that this driver is trying
#   to be too clever for its own good.  Rip out the jiffies logic completely,
#   it should be totally unnecessary.
# 
# drivers/char/agp/sworks-agp.c
#   2004/06/01 08:50:11+01:00 davej@redhat.com +6 -19
#   [AGPGART] Fix broken serverworks tlb flush routine.
#   This is horribly broken due to a jiffy wrap bug, we never get out of
#   the while loop, preventing booting on a kernel with this driver
#   compiled in. (See https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=124495)
#   
#   The warning message there has never been reported in any bug report
#   that google can find, so I'm of the opinion that this driver is trying
#   to be too clever for its own good.  Rip out the jiffies logic completely,
#   it should be totally unnecessary.
# 
# ChangeSet
#   2004/06/01 07:52:38+02:00 P@draigBrady.com 
#   [WATCHDOG] v2.6.6 w83627hf_wdt.c-patch
#   
#   Add w83627hf_select_wd_register and w83627hf_unselect_wd_register.
#   Add w83627hf_init to fix initialization problem on certain motherboards.
#   Make ping and disable code return 0 (int) on success.
#   Extract set_heartbeat code to seperate function.
# 
# drivers/char/watchdog/w83627hf_wdt.c
#   2004/06/01 07:36:03+02:00 P@draigBrady.com +54 -12
#   Add w83627hf_select_wd_register and w83627hf_unselect_wd_register.
#   Add w83627hf_init to fix initialization problem on certain motherboards.
#   Make ping and disable code return 0 (int) on success.
#   Extract set_heartbeat code to seperate function.
# 
# ChangeSet
#   2004/05/31 22:36:02-07:00 joern@wohnheim.fh-wedel.de 
#   [PATCH] Improve `make checkstack'
#   
#   On i386, stack usually grows with "sub $0x8,%esp" and shrinks with
#   "add $0x8,%esp" respectively.  In some cases, though, stack grows with
#   "add $0xffffff80,%esp" and shrinks with "sub $0xffffff80,%esp".
#   Obviously, we don't want to miss those cases.
#   
#   Since in either case add and sub seem to be balanced and contain the
#   same parameter, we don't need a second regex.  We simply accept hex
#   numbers of up to 8 digits and treat them as negative numbers when the
#   sub appears to be a little too high.
#   
#   ...or so I thought.  But another day of testing proved me wrong again.
#   
#   Some functions do stuff like "sub $0x10,%esp", ..., "add $0x20,%esp".
#   In other words, add and sub are *NOT* balanced.  Manual inspection
#   showed that 0x20 is a more realistic number, so I accept either
#   variant, just in case.  We pay for this with a bunch of duplicates in
#   our output, but that beats missing some stack hogs.
#   
#   In the long run, this script has to be replaced by gcc options,
#   really.  Looking at the result and guessing back is such a stupid
#   idea.
#   
#   Signed-off-by: J�rn Engel <joern@wohnheim.fh-wedel.de>
# 
# scripts/checkstack.pl
#   2004/05/31 20:02:16-07:00 joern@wohnheim.fh-wedel.de +10 -3
#   Improve `make checkstack'
# 
# ChangeSet
#   2004/05/31 23:01:40-04:00 willy@debian.org 
#   [PATCH] Better tulip handling on PA-RISC
#   
#   This patch improves some of the handling of PA-RISC tulip cards.
#   
#    - Introduce HAS_SWAPPED_SEEPROM and NEEDS_FAKE_MEDIA_TABLE
#    - Only trigger this code on GSC machines.  The pure PCI machines don't
#      have these cards.
#    - Allow the chip_name to be overridden in tulip_init_one().
#    - Fix some indentation.
#    - Handle the output from tulip_read_eeprom() better.
# 
# drivers/net/tulip/tulip_core.c
#   2004/02/07 05:58:28-05:00 willy@debian.org +33 -12
#   Better tulip handling on PA-RISC
# 
# drivers/net/tulip/tulip.h
#   2004/02/07 01:52:30-05:00 willy@debian.org +3 -1
#   Better tulip handling on PA-RISC
# 
# drivers/net/tulip/eeprom.c
#   2004/02/07 01:52:30-05:00 willy@debian.org +10 -13
#   Better tulip handling on PA-RISC
# 
# ChangeSet
#   2004/05/31 23:01:28-04:00 khc@pm.waw.pl 
#   [PATCH] Re: [Fwd: [PATCH] Stop queue on close in hdlcdrv]
#   
#   > From: Ralf Baechle <ralf@linux-mips.org>
#   > Subject: [PATCH] Stop queue on close in hdlcdrv
#   > To: Jeff Garzik <garzik@gtf.org>
#   > Date: Tue, 4 May 2004 13:59:15 +0200
#   >
#   > The stop method of a driver should ensure queueing is stopped ...
#   >
#   > diff -u -r1.19 hdlcdrv.c
#   > --- suckage/drivers/net/hamradio/hdlcdrv.c 12 Apr 2004 20:23:32 -0000
#   
#   the above means the following is needed for my drivers - please apply to 2.6:
# 
# drivers/net/wan/wanxl.c
#   2004/05/29 13:00:02-04:00 khc@pm.waw.pl +5 -1
#   Re: [Fwd: [PATCH] Stop queue on close in hdlcdrv]
# 
# drivers/net/wan/hd6457x.c
#   2004/05/29 13:03:41-04:00 khc@pm.waw.pl +1 -1
#   Re: [Fwd: [PATCH] Stop queue on close in hdlcdrv]
# 
# ChangeSet
#   2004/05/31 23:01:17-04:00 hch@lst.de 
#   [PATCH] farsync needs <asm/io.h>
#   
#   i386 gets it implicitly from somewhere but some architectures don't.
#   Also move <asm/uaccess.h> down so we have asm after linux headers.
# 
# drivers/net/wan/farsync.c
#   2004/05/30 04:06:12-04:00 hch@lst.de +2 -1
#   farsync needs <asm/io.h>
# 
# ChangeSet
#   2004/05/31 23:01:07-04:00 akpm@osdl.org 
#   [PATCH] s2io section fix
#   
#   s2io_rem_nic() is marked __exit and is being referred to from .data.
#   
#   Signed-off-by: Andrew Morton <akpm@osdl.org>
# 
# drivers/net/s2io.h
#   2004/05/31 03:46:35-04:00 akpm@osdl.org +1 -1
#   s2io section fix
# 
# drivers/net/s2io.c
#   2004/05/31 03:45:22-04:00 akpm@osdl.org +2 -2
#   s2io section fix
# 
# ChangeSet
#   2004/05/31 23:00:56-04:00 akpm@osdl.org 
#   [PATCH] fix net/ixgb/ixgb_main.c warning
#   
#   From: "Luiz Fernando N. Capitulino" <lcapitulino@prefeitura.sp.gov.br>
#   
#   drivers/net/ixgb/ixgb_main.c: In function `ixgb_intr':
#   drivers/net/ixgb/ixgb_main.c:1593: warning: unused variable `hw'
#   (catch by J. Cherry).
#   
#   This happens because `hw' is only used when CONFIG_IXGB_NAPI is not set.
#   As `hw' is used only to have the code readable, we can use it for
#   !CONFIG_IXGB_NAPI too.
#   
#   Signed-off-by: Andrew Morton <akpm@osdl.org>
# 
# drivers/net/ixgb/ixgb_main.c
#   2004/05/31 20:01:23-04:00 akpm@osdl.org +1 -1
#   fix net/ixgb/ixgb_main.c warning
# 
# ChangeSet
#   2004/05/31 19:08:20-07:00 davem@nuts.davemloft.net 
#   [SPARC]: First stage of sparc32 sparse work.
# 
# include/asm-sparc/uaccess.h
#   2004/05/31 19:07:59-07:00 davem@nuts.davemloft.net +11 -5
#   [SPARC]: First stage of sparc32 sparse work.
# 
# include/asm-sparc/thread_info.h
#   2004/05/31 19:07:59-07:00 davem@nuts.davemloft.net +1 -0
#   [SPARC]: First stage of sparc32 sparse work.
# 
# include/asm-sparc/signal.h
#   2004/05/31 19:07:59-07:00 davem@nuts.davemloft.net +2 -2
#   [SPARC]: First stage of sparc32 sparse work.
# 
# include/asm-sparc/semaphore.h
#   2004/05/31 19:07:59-07:00 davem@nuts.davemloft.net +7 -7
#   [SPARC]: First stage of sparc32 sparse work.
# 
# include/asm-sparc/ipc.h
#   2004/05/31 19:07:59-07:00 davem@nuts.davemloft.net +1 -1
#   [SPARC]: First stage of sparc32 sparse work.
# 
# include/asm-sparc/hardirq.h
#   2004/05/31 19:07:59-07:00 davem@nuts.davemloft.net +0 -9
#   [SPARC]: First stage of sparc32 sparse work.
# 
# arch/sparc/mm/fault.c
#   2004/05/31 19:07:59-07:00 davem@nuts.davemloft.net +3 -3
#   [SPARC]: First stage of sparc32 sparse work.
# 
# arch/sparc/math-emu/math.c
#   2004/05/31 19:07:59-07:00 davem@nuts.davemloft.net +12 -12
#   [SPARC]: First stage of sparc32 sparse work.
# 
# arch/sparc/kernel/windows.c
#   2004/05/31 19:07:59-07:00 davem@nuts.davemloft.net +5 -4
#   [SPARC]: First stage of sparc32 sparse work.
# 
# arch/sparc/kernel/unaligned.c
#   2004/05/31 19:07:59-07:00 davem@nuts.davemloft.net +16 -13
#   [SPARC]: First stage of sparc32 sparse work.
# 
# arch/sparc/kernel/sys_sunos.c
#   2004/05/31 19:07:59-07:00 davem@nuts.davemloft.net +81 -74
#   [SPARC]: First stage of sparc32 sparse work.
# 
# arch/sparc/kernel/sys_sparc.c
#   2004/05/31 19:07:59-07:00 davem@nuts.davemloft.net +7 -3
#   [SPARC]: First stage of sparc32 sparse work.
# 
# arch/sparc/kernel/sunos_ioctl.c
#   2004/05/31 19:07:59-07:00 davem@nuts.davemloft.net +18 -17
#   [SPARC]: First stage of sparc32 sparse work.
# 
# arch/sparc/kernel/signal.c
#   2004/05/31 19:07:59-07:00 davem@nuts.davemloft.net +20 -9
#   [SPARC]: First stage of sparc32 sparse work.
# 
# arch/sparc/kernel/ptrace.c
#   2004/05/31 19:07:59-07:00 davem@nuts.davemloft.net +14 -8
#   [SPARC]: First stage of sparc32 sparse work.
# 
# arch/sparc/kernel/process.c
#   2004/05/31 19:07:59-07:00 davem@nuts.davemloft.net +50 -39
#   [SPARC]: First stage of sparc32 sparse work.
# 
# arch/sparc/kernel/muldiv.c
#   2004/05/31 19:07:59-07:00 davem@nuts.davemloft.net +28 -21
#   [SPARC]: First stage of sparc32 sparse work.
# 
# arch/sparc/kernel/irq.c
#   2004/05/31 19:07:59-07:00 davem@nuts.davemloft.net +2 -1
#   [SPARC]: First stage of sparc32 sparse work.
# 
# arch/sparc/kernel/ebus.c
#   2004/05/31 19:07:59-07:00 davem@nuts.davemloft.net +2 -2
#   [SPARC]: First stage of sparc32 sparse work.
# 
# arch/sparc/kernel/apc.c
#   2004/05/31 19:07:59-07:00 davem@nuts.davemloft.net +33 -36
#   [SPARC]: First stage of sparc32 sparse work.
# 
# ChangeSet
#   2004/05/31 18:03:02-07:00 davem@kernel.bkbits.net 
#   Merge http://linux-mh.bkbits.net/bluetooth-2.6
#   into kernel.bkbits.net:/home/davem/bluetooth-2.6
# 
# net/bluetooth/sco.c
#   2004/05/31 18:02:57-07:00 davem@kernel.bkbits.net +0 -0
#   Auto merged
# 
# net/bluetooth/rfcomm/sock.c
#   2004/05/31 18:02:57-07:00 davem@kernel.bkbits.net +0 -0
#   Auto merged
# 
# net/bluetooth/l2cap.c
#   2004/05/31 18:02:57-07:00 davem@kernel.bkbits.net +0 -0
#   Auto merged
# 
# net/bluetooth/hci_sock.c
#   2004/05/31 18:02:57-07:00 davem@kernel.bkbits.net +0 -0
#   Auto merged
# 
# drivers/bluetooth/hci_usb.c
#   2004/05/31 18:02:57-07:00 davem@kernel.bkbits.net +0 -0
#   Auto merged
# 
# MAINTAINERS
#   2004/05/31 18:02:57-07:00 davem@kernel.bkbits.net +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/05/31 17:09:43-07:00 davem@nuts.davemloft.net 
#   [SPARC]: Set sparse arch defines explicitly.
# 
# arch/sparc/Makefile
#   2004/05/31 17:09:26-07:00 davem@nuts.davemloft.net +1 -0
#   [SPARC]: Set sparse arch defines explicitly.
# 
# arch/sparc64/Makefile
#   2004/05/31 17:09:25-07:00 davem@nuts.davemloft.net +2 -0
#   [SPARC]: Set sparse arch defines explicitly.
# 
# ChangeSet
#   2004/05/31 16:56:32-07:00 akpm@osdl.org 
#   [PATCH] ppc32: reorg DMA API, add coherent alloc in irq
#   
#   From: Eugene Surovegin <ebs@ebshome.net>
#   
#   Put back DECLARE_PCI_UNMAP_???  and friends accidentaly removed during DMA
#   API reorganization.
#   
#   Signed-off-by: Eugene Surovegin <ebs@ebshome.net>
#   Signed-off-by: Andrew Morton <akpm@osdl.org>
#   Signed-off-by: Linus Torvalds <torvalds@osdl.org>
# 
# include/asm-ppc/pci.h
#   2004/05/31 16:44:01-07:00 akpm@osdl.org +8 -0
#   ppc32: reorg DMA API, add coherent alloc in irq
# 
# ChangeSet
#   2004/05/31 16:25:51-07:00 davem@nuts.davemloft.net 
#   [SPARC64]: Lots of sparse work for arch/sparc64.
# 
# include/asm-sparc64/uaccess.h
#   2004/05/31 16:25:29-07:00 davem@nuts.davemloft.net +8 -2
#   [SPARC64]: Lots of sparse work for arch/sparc64.
# 
# include/asm-sparc64/thread_info.h
#   2004/05/31 16:25:29-07:00 davem@nuts.davemloft.net +2 -1
#   [SPARC64]: Lots of sparse work for arch/sparc64.
# 
# include/asm-sparc64/signal.h
#   2004/05/31 16:25:29-07:00 davem@nuts.davemloft.net +1 -1
#   [SPARC64]: Lots of sparse work for arch/sparc64.
# 
# include/asm-sparc64/siginfo.h
#   2004/05/31 16:25:29-07:00 davem@nuts.davemloft.net +1 -1
#   [SPARC64]: Lots of sparse work for arch/sparc64.
# 
# include/asm-sparc64/lsu.h
#   2004/05/31 16:25:29-07:00 davem@nuts.davemloft.net +13 -11
#   [SPARC64]: Lots of sparse work for arch/sparc64.
# 
# include/asm-sparc64/compat.h
#   2004/05/31 16:25:29-07:00 davem@nuts.davemloft.net +4 -4
#   [SPARC64]: Lots of sparse work for arch/sparc64.
# 
# arch/sparc64/math-emu/math.c
#   2004/05/31 16:25:29-07:00 davem@nuts.davemloft.net +5 -5
#   [SPARC64]: Lots of sparse work for arch/sparc64.
# 
# arch/sparc64/kernel/unaligned.c
#   2004/05/31 16:25:29-07:00 davem@nuts.davemloft.net +24 -24
#   [SPARC64]: Lots of sparse work for arch/sparc64.
# 
# arch/sparc64/kernel/systbls.S
#   2004/05/31 16:25:29-07:00 davem@nuts.davemloft.net +1 -1
#   [SPARC64]: Lots of sparse work for arch/sparc64.
# 
# arch/sparc64/kernel/sys_sunos32.c
#   2004/05/31 16:25:29-07:00 davem@nuts.davemloft.net +174 -151
#   [SPARC64]: Lots of sparse work for arch/sparc64.
# 
# arch/sparc64/kernel/sys_sparc32.c
#   2004/05/31 16:25:29-07:00 davem@nuts.davemloft.net +141 -106
#   [SPARC64]: Lots of sparse work for arch/sparc64.
# 
# arch/sparc64/kernel/sys_sparc.c
#   2004/05/31 16:25:29-07:00 davem@nuts.davemloft.net +15 -13
#   [SPARC64]: Lots of sparse work for arch/sparc64.
# 
# arch/sparc64/kernel/sunos_ioctl32.c
#   2004/05/31 16:25:29-07:00 davem@nuts.davemloft.net +7 -6
#   [SPARC64]: Lots of sparse work for arch/sparc64.
# 
# arch/sparc64/kernel/signal32.c
#   2004/05/31 16:25:29-07:00 davem@nuts.davemloft.net +8 -5
#   [SPARC64]: Lots of sparse work for arch/sparc64.
# 
# arch/sparc64/kernel/signal.c
#   2004/05/31 16:25:29-07:00 davem@nuts.davemloft.net +5 -3
#   [SPARC64]: Lots of sparse work for arch/sparc64.
# 
# arch/sparc64/kernel/ptrace.c
#   2004/05/31 16:25:29-07:00 davem@nuts.davemloft.net +24 -14
#   [SPARC64]: Lots of sparse work for arch/sparc64.
# 
# arch/sparc64/kernel/pci_schizo.c
#   2004/05/31 16:25:29-07:00 davem@nuts.davemloft.net +21 -21
#   [SPARC64]: Lots of sparse work for arch/sparc64.
# 
# arch/sparc64/kernel/pci_psycho.c
#   2004/05/31 16:25:29-07:00 davem@nuts.davemloft.net +106 -106
#   [SPARC64]: Lots of sparse work for arch/sparc64.
# 
# arch/sparc64/kernel/module.c
#   2004/05/31 16:25:29-07:00 davem@nuts.davemloft.net +2 -2
#   [SPARC64]: Lots of sparse work for arch/sparc64.
# 
# arch/sparc64/kernel/ioctl32.c
#   2004/05/31 16:25:29-07:00 davem@nuts.davemloft.net +31 -26
#   [SPARC64]: Lots of sparse work for arch/sparc64.
# 
# arch/sparc64/kernel/ebus.c
#   2004/05/31 16:25:29-07:00 davem@nuts.davemloft.net +2 -2
#   [SPARC64]: Lots of sparse work for arch/sparc64.
# 
# arch/sparc64/kernel/traps.c
#   2004/05/31 16:25:28-07:00 davem@nuts.davemloft.net +8 -5
#   [SPARC64]: Lots of sparse work for arch/sparc64.
# 
# arch/sparc64/kernel/setup.c
#   2004/05/31 16:25:28-07:00 davem@nuts.davemloft.net +1 -1
#   [SPARC64]: Lots of sparse work for arch/sparc64.
# 
# arch/sparc64/kernel/process.c
#   2004/05/31 16:25:28-07:00 davem@nuts.davemloft.net +34 -26
#   [SPARC64]: Lots of sparse work for arch/sparc64.
# 
# arch/sparc64/kernel/irq.c
#   2004/05/31 16:25:28-07:00 davem@nuts.davemloft.net +2 -2
#   [SPARC64]: Lots of sparse work for arch/sparc64.
# 
# ChangeSet
#   2004/05/31 15:18:46-07:00 torvalds@ppc970.osdl.org 
#   sparse: make x86 and ppc64 set the architecture-specific #define's
#   explcitly.
#   
#   sparse doesn't set any arch defines itself.
# 
# arch/ppc64/Makefile
#   2004/05/31 15:18:41-07:00 torvalds@ppc970.osdl.org +2 -1
#   sparse: make x86 and ppc64 set the architecture-specific #define's
#   explcitly.
#   
#   sparse doesn't set any arch defines itself.
# 
# arch/i386/Makefile
#   2004/05/31 15:18:41-07:00 torvalds@ppc970.osdl.org +1 -0
#   sparse: make x86 and ppc64 set the architecture-specific #define's
#   explcitly.
#   
#   sparse doesn't set any arch defines itself.
# 
# ChangeSet
#   2004/05/31 15:11:45-07:00 petero2@telia.com 
#   [PATCH] Avoid excessive stack usage in NFS
#   
#   Assigning '*wdata' with a dynamic initializer creates a
#   temporary structure copy on the stack, and then the final
#   data is initialized with a "memcpy()".
#   
#   As a result, these NFS functions use more than 800 bytes
#   of stack-space.
#   
#   Changing the code to just do a memset followed by explicit
#   initialization of the non-zero member variables takes the
#   stack usage down to 36 bytes. 
#   
#   Here is a patch that does exactly that.
# 
# fs/nfs/write.c
#   2004/05/31 14:29:33-07:00 petero2@telia.com +11 -17
#   Avoid excessive stack usage in NFS
# 
# fs/nfs/read.c
#   2004/05/31 14:29:26-07:00 petero2@telia.com +10 -16
#   Avoid excessive stack usage in NFS
# 
# ChangeSet
#   2004/05/31 14:44:34-07:00 davem@nuts.davemloft.net 
#   [SPARC64]: __volatile --> __volatile__
# 
# include/asm-sparc64/uaccess.h
#   2004/05/31 14:44:16-07:00 davem@nuts.davemloft.net +1 -1
#   [SPARC64]: __volatile --> __volatile__
# 
# arch/sparc64/kernel/process.c
#   2004/05/31 14:44:16-07:00 davem@nuts.davemloft.net +18 -18
#   [SPARC64]: __volatile --> __volatile__
# 
# ChangeSet
#   2004/05/31 14:41:04-07:00 davem@nuts.davemloft.net 
#   [SPARC64]: Annotate 64-bit constants with 'UL'
# 
# include/asm-sparc64/pstate.h
#   2004/05/31 14:40:46-07:00 davem@nuts.davemloft.net +53 -51
#   [SPARC64]: Annotate 64-bit constants with 'UL'
# 
# include/asm-sparc64/pgtable.h
#   2004/05/31 14:40:46-07:00 davem@nuts.davemloft.net +63 -49
#   [SPARC64]: Annotate 64-bit constants with 'UL'
# 
# include/asm-sparc64/pci.h
#   2004/05/31 14:40:46-07:00 davem@nuts.davemloft.net +1 -1
#   [SPARC64]: Annotate 64-bit constants with 'UL'
# 
# include/asm-sparc64/page.h
#   2004/05/31 14:40:46-07:00 davem@nuts.davemloft.net +5 -11
#   [SPARC64]: Annotate 64-bit constants with 'UL'
# 
# include/asm-sparc64/iommu.h
#   2004/05/31 14:40:46-07:00 davem@nuts.davemloft.net +8 -8
#   [SPARC64]: Annotate 64-bit constants with 'UL'
# 
# include/asm-sparc64/chmctrl.h
#   2004/05/31 14:40:46-07:00 davem@nuts.davemloft.net +77 -77
#   [SPARC64]: Annotate 64-bit constants with 'UL'
# 
# arch/sparc64/kernel/sbus.c
#   2004/05/31 14:40:46-07:00 davem@nuts.davemloft.net +38 -38
#   [SPARC64]: Annotate 64-bit constants with 'UL'
# 
# include/asm-sparc64/const.h
#   2004/05/31 14:40:31-07:00 davem@nuts.davemloft.net +19 -0
#   [SPARC64]: Annotate 64-bit constants with 'UL'
# 
# include/asm-sparc64/const.h
#   2004/05/31 14:40:31-07:00 davem@nuts.davemloft.net +0 -0
#   BitKeeper file /disk1/BK/sparc-2.6/include/asm-sparc64/const.h
# 
# ChangeSet
#   2004/05/31 23:34:49+02:00 marcel@holtmann.org 
#   [Bluetooth] Add quirk for broken RTX Telecom based dongles
#   
#   Some RTX Telecom based USB dongles offer SCO support, but their
#   implementation is broken. This patch disables the use of the ISOC
#   interface for these devices.
# 
# drivers/bluetooth/hci_usb.c
#   2004/05/31 23:32:24+02:00 marcel@holtmann.org +32 -29
#   Add quirk for broken RTX Telecom based dongles
# 
# drivers/bluetooth/hci_usb.h
#   2004/05/31 23:31:42+02:00 marcel@holtmann.org +27 -40
#   Add quirk for broken RTX Telecom based dongles
# 
# ChangeSet
#   2004/05/31 23:02:50+02:00 marcel@holtmann.org 
#   [Bluetooth] Add dynamic channel allocation for RFCOMM server sockets
#   
#   If no channel is specified for a RFCOMM server socket, it will search
#   for the next free one and automaticly bind to it.
#   
#   Proposed by Stephen Crane <steve.crane@rococosoft.com>
# 
# net/bluetooth/rfcomm/core.c
#   2004/05/31 23:01:42+02:00 marcel@holtmann.org +1 -1
#   Add dynamic channel allocation for RFCOMM server sockets
# 
# net/bluetooth/rfcomm/sock.c
#   2004/05/31 22:57:15+02:00 marcel@holtmann.org +21 -0
#   Add dynamic channel allocation for RFCOMM server sockets
# 
# ChangeSet
#   2004/05/31 22:52:34+02:00 marcel@holtmann.org 
#   [Bluetooth] Add dynamic PSM allocation for L2CAP server sockets
#   
#   If no PSM is specified for a L2CAP server socket, it will search
#   for the next free one and automaticly bind to it.
#   
#   Proposed by Stephen Crane <steve.crane@rococosoft.com>
# 
# net/bluetooth/l2cap.c
#   2004/05/31 22:49:24+02:00 marcel@holtmann.org +21 -2
#   Add dynamic PSM allocation for L2CAP server sockets
# 
# ChangeSet
#   2004/05/31 22:44:36+02:00 marcel@holtmann.org 
#   [Bluetooth] Allocate protocol number for HIDP support
#   
#   This patch allocates the next free protocol number for the upcoming
#   HIDP support.
# 
# net/bluetooth/af_bluetooth.c
#   2004/05/31 22:43:39+02:00 marcel@holtmann.org +2 -2
#   Allocate protocol number for HIDP support
# 
# include/net/bluetooth/bluetooth.h
#   2004/05/31 22:43:23+02:00 marcel@holtmann.org +1 -0
#   Allocate protocol number for HIDP support
# 
# ChangeSet
#   2004/05/31 22:34:23+02:00 marcel@holtmann.org 
#   [Bluetooth] Update Kconfig help entries
#   
#   This patch updates the address of the BlueZ project and changes
#   some wording of the help entries.
# 
# net/bluetooth/cmtp/Kconfig
#   2004/05/31 22:33:08+02:00 marcel@holtmann.org +1 -1
#   Update Kconfig help entries
# 
# net/bluetooth/rfcomm/Kconfig
#   2004/05/31 22:33:06+02:00 marcel@holtmann.org +1 -1
#   Update Kconfig help entries
# 
# net/bluetooth/bnep/Kconfig
#   2004/05/31 22:33:06+02:00 marcel@holtmann.org +2 -6
#   Update Kconfig help entries
# 
# net/bluetooth/Kconfig
#   2004/05/31 22:33:04+02:00 marcel@holtmann.org +10 -12
#   Update Kconfig help entries
# 
# MAINTAINERS
#   2004/05/31 22:32:39+02:00 marcel@holtmann.org +4 -14
#   Update address of the BlueZ project
# 
# ChangeSet
#   2004/05/31 22:16:59+02:00 marcel@holtmann.org 
#   [Bluetooth] Remove CVS tags and cleanup the code
#   
#   Since we are using Bitkeeper the CVS tags are useless. This patch
#   removes them and makes some whitespace cleanups.
# 
# net/bluetooth/hci_sysfs.c
#   2004/05/31 22:15:13+02:00 marcel@holtmann.org +3 -1
#   Remove CVS tags and cleanup the code
# 
# net/bluetooth/hci_event.c
#   2004/05/31 22:15:12+02:00 marcel@holtmann.org +16 -20
#   Remove CVS tags and cleanup the code
# 
# net/bluetooth/hci_sock.c
#   2004/05/31 22:15:11+02:00 marcel@holtmann.org +33 -38
#   Remove CVS tags and cleanup the code
# 
# net/bluetooth/hci_core.c
#   2004/05/31 22:15:11+02:00 marcel@holtmann.org +23 -27
#   Remove CVS tags and cleanup the code
# 
# net/bluetooth/hci_conn.c
#   2004/05/31 22:15:10+02:00 marcel@holtmann.org +13 -17
#   Remove CVS tags and cleanup the code
# 
# net/bluetooth/sco.c
#   2004/05/31 22:15:09+02:00 marcel@holtmann.org +61 -64
#   Remove CVS tags and cleanup the code
# 
# net/bluetooth/lib.c
#   2004/05/31 22:15:09+02:00 marcel@holtmann.org +2 -6
#   Remove CVS tags and cleanup the code
# 
# net/bluetooth/l2cap.c
#   2004/05/31 22:15:08+02:00 marcel@holtmann.org +87 -91
#   Remove CVS tags and cleanup the code
# 
# net/bluetooth/af_bluetooth.c
#   2004/05/31 22:15:05+02:00 marcel@holtmann.org +12 -15
#   Remove CVS tags and cleanup the code
# 
# include/net/bluetooth/hci_core.h
#   2004/05/31 22:14:59+02:00 marcel@holtmann.org +29 -33
#   Remove CVS tags and cleanup the code
# 
# include/net/bluetooth/rfcomm.h
#   2004/05/31 22:14:58+02:00 marcel@holtmann.org +0 -8
#   Remove CVS tags and cleanup the code
# 
# include/net/bluetooth/sco.h
#   2004/05/31 22:14:57+02:00 marcel@holtmann.org +3 -7
#   Remove CVS tags and cleanup the code
# 
# include/net/bluetooth/hci.h
#   2004/05/31 22:14:56+02:00 marcel@holtmann.org +0 -4
#   Remove CVS tags and cleanup the code
# 
# include/net/bluetooth/bluetooth.h
#   2004/05/31 22:14:55+02:00 marcel@holtmann.org +13 -17
#   Remove CVS tags and cleanup the code
# 
# include/net/bluetooth/l2cap.h
#   2004/05/31 22:14:39+02:00 marcel@holtmann.org +8 -12
#   Remove CVS tags and cleanup the code
# 
# ChangeSet
#   2004/05/31 13:06:15-07:00 davem@nuts.davemloft.net 
#   [SPARC64]: Fix NR_IRQS check in hardirq.h
# 
# include/asm-sparc64/hardirq.h
#   2004/05/31 13:05:58-07:00 davem@nuts.davemloft.net +0 -9
#   [SPARC64]: Fix NR_IRQS check in hardirq.h
# 
# ChangeSet
#   2004/05/31 12:35:54-07:00 torvalds@ppc970.osdl.org 
#   ppc64: more user address fixups.
#   
#   Removed one (harmless) direct user pointer access.
# 
# arch/ppc64/mm/fault.c
#   2004/05/31 12:35:49-07:00 torvalds@ppc970.osdl.org +1 -1
#   ppc64: more user address fixups.
#   
#   Removed one (harmless) direct user pointer access.
# 
# arch/ppc64/kernel/sys_ppc32.c
#   2004/05/31 12:35:49-07:00 torvalds@ppc970.osdl.org +3 -3
#   ppc64: more user address fixups.
#   
#   Removed one (harmless) direct user pointer access.
# 
# arch/ppc64/kernel/signal32.c
#   2004/05/31 12:35:49-07:00 torvalds@ppc970.osdl.org +15 -19
#   ppc64: more user address fixups.
#   
#   Removed one (harmless) direct user pointer access.
# 
# arch/ppc64/kernel/ptrace32.c
#   2004/05/31 12:35:49-07:00 torvalds@ppc970.osdl.org +12 -12
#   ppc64: more user address fixups.
#   
#   Removed one (harmless) direct user pointer access.
# 
# arch/ppc64/kernel/align.c
#   2004/05/31 12:35:49-07:00 torvalds@ppc970.osdl.org +4 -4
#   ppc64: more user address fixups.
#   
#   Removed one (harmless) direct user pointer access.
# 
# ChangeSet
#   2004/05/31 12:21:49-07:00 torvalds@ppc970.osdl.org 
#   ppc64: add more user annotations to ptrace.c
# 
# arch/ppc64/kernel/ptrace.c
#   2004/05/31 12:21:43-07:00 torvalds@ppc970.osdl.org +6 -6
#   ppc64: add more user annotations to ptrace.c
# 
# ChangeSet
#   2004/05/31 12:17:16-07:00 torvalds@ppc970.osdl.org 
#   ppc64: fix more user pointers in signal handling
# 
# arch/ppc64/kernel/signal.c
#   2004/05/31 12:17:11-07:00 torvalds@ppc970.osdl.org +9 -9
#   ppc64: fix more user pointers in signal handling
# 
# ChangeSet
#   2004/05/31 21:04:38+02:00 marcel@holtmann.org 
#   [Bluetooth] Move function exports out of syms.c
#   
#   With Linux 2.6 there is no need to keep the function exports in a
#   central file and thus the use of syms.c makes no real sense. Remove
#   it and add the EXPORT_SYMBOL calls to the functions they belong to.
# 
# net/bluetooth/hci_event.c
#   2004/05/31 21:02:01+02:00 marcel@holtmann.org +1 -0
#   Move function exports out of syms.c
# 
# net/bluetooth/hci_core.c
#   2004/05/31 21:02:00+02:00 marcel@holtmann.org +12 -0
#   Move function exports out of syms.c
# 
# net/bluetooth/hci_conn.c
#   2004/05/31 21:01:59+02:00 marcel@holtmann.org +4 -0
#   Move function exports out of syms.c
# 
# net/bluetooth/Makefile
#   2004/05/31 21:01:58+02:00 marcel@holtmann.org +1 -1
#   Move function exports out of syms.c
# 
# net/bluetooth/lib.c
#   2004/05/31 21:01:57+02:00 marcel@holtmann.org +7 -0
#   Move function exports out of syms.c
# 
# net/bluetooth/af_bluetooth.c
#   2004/05/31 20:57:43+02:00 marcel@holtmann.org +11 -0
#   Move function exports out of syms.c
# 
# BitKeeper/deleted/.del-syms.c~2adcf95c9f1715c0
#   2004/05/31 20:28:06+02:00 marcel@holtmann.org +0 -0
#   Delete: net/bluetooth/syms.c
# 
# ChangeSet
#   2004/05/31 11:19:40-07:00 torvalds@ppc970.osdl.org 
#   sparse: make x86 user pointer checks stricter.
#   
#   Also use "__force" when forcing the user address to "unsigned long"
#   for the address limit check.
# 
# include/asm-i386/uaccess.h
#   2004/05/31 11:19:35-07:00 torvalds@ppc970.osdl.org +12 -4
#   sparse: make x86 user pointer checks stricter.
#   
#   Also use "__force" when forcing the user address to "unsigned long"
#   for the address limit check.
# 
# ChangeSet
#   2004/05/31 10:41:08-07:00 torvalds@ppc970.osdl.org 
#   ppc64: missing __user annotations noticed by stricter checks.
# 
# arch/ppc64/kernel/time.c
#   2004/05/31 10:41:03-07:00 torvalds@ppc970.osdl.org +2 -2
#   ppc64: missing __user annotations noticed by stricter checks.
# 
# arch/ppc64/kernel/process.c
#   2004/05/31 10:41:03-07:00 torvalds@ppc970.osdl.org +3 -3
#   ppc64: missing __user annotations noticed by stricter checks.
# 
# ChangeSet
#   2004/05/31 10:39:30-07:00 torvalds@ppc970.osdl.org 
#   ppc64: check more of the user access functions for proper arguments.
# 
# include/asm-ppc64/uaccess.h
#   2004/05/31 10:39:25-07:00 torvalds@ppc970.osdl.org +8 -2
#   ppc64: check more of the user access functions for proper arguments.
# 
# ChangeSet
#   2004/05/31 10:38:48-07:00 torvalds@ppc970.osdl.org 
#   sparse: add "__force" type attribute for forcing a cast.
# 
# include/linux/compiler.h
#   2004/05/31 10:38:43-07:00 torvalds@ppc970.osdl.org +2 -0
#   sparse: add "__force" type attribute for forcing a cast.
# 
# ChangeSet
#   2004/05/31 09:59:55-07:00 viro@parcelfarce.linux.theplanet.co.uk 
#   [PATCH] sparse: asus_acpi dereference of userland pointers
#   
#   Direct sscanf() on userland buffer in procfs ->write_proc().  Fixed.
# 
# drivers/acpi/asus_acpi.c
#   2004/05/30 21:10:18-07:00 viro@parcelfarce.linux.theplanet.co.uk +33 -15
#   sparse: asus_acpi dereference of userland pointers
# 
# ChangeSet
#   2004/05/31 11:47:23+01:00 rmk@flint.arm.linux.org.uk 
#   [ARM] Correct permissions on several ARMv6 files.
# 
# arch/arm/mm/tlb-v6.S
#   2004/05/31 11:43:06+01:00 rmk@flint.arm.linux.org.uk +0 -0
#   Change mode to -rw-r--r--
# 
# arch/arm/mm/proc-v6.S
#   2004/05/31 11:43:05+01:00 rmk@flint.arm.linux.org.uk +0 -0
#   Change mode to -rw-r--r--
# 
# arch/arm/mm/copypage-v6.c
#   2004/05/31 11:43:05+01:00 rmk@flint.arm.linux.org.uk +0 -0
#   Change mode to -rw-r--r--
# 
# arch/arm/mm/cache-v6.S
#   2004/05/31 11:43:05+01:00 rmk@flint.arm.linux.org.uk +0 -0
#   Change mode to -rw-r--r--
# 
# arch/arm/mm/blockops.c
#   2004/05/31 11:43:05+01:00 rmk@flint.arm.linux.org.uk +0 -0
#   Change mode to -rw-r--r--
# 
# arch/arm/mm/abort-ev6.S
#   2004/05/31 11:43:05+01:00 rmk@flint.arm.linux.org.uk +0 -0
#   Change mode to -rw-r--r--
# 
# ChangeSet
#   2004/05/31 11:41:16+01:00 rmk@flint.arm.linux.org.uk 
#   [ARM] Eliminate meminfo 'end' element
#   
#   Some machines decided to initialise this element.  It's not necessary
#   since find_memend_and_nodes() initialises this itself.  However,
#   'end' is not required if we initialise high_memory in this function
#   rather than waiting until mem_init() is called.
# 
# include/asm-arm/setup.h
#   2004/05/31 11:38:39+01:00 rmk@flint.arm.linux.org.uk +0 -1
#   Remove meminfo 'end' element
# 
# arch/arm/mm/init.c
#   2004/05/31 11:38:39+01:00 rmk@flint.arm.linux.org.uk +2 -2
#   Initialise high_memory earlier - this eliminates meminfo.end
# 
# arch/arm/mach-clps711x/fortunet.c
#   2004/05/31 11:38:39+01:00 rmk@flint.arm.linux.org.uk +12 -5
#   Use named initialisers to initialise memmap
#   Removve initialisation of memmap.end
# 
# arch/arm/mach-clps711x/clep7312.c
#   2004/05/31 11:38:38+01:00 rmk@flint.arm.linux.org.uk +0 -1
#   Remove initialisation of meminfo .end
# 
# ChangeSet
#   2004/05/31 11:15:46+01:00 rmk@flint.arm.linux.org.uk 
#   [PCMCIA] Fix up SOC PCMCIA socket timing calculations
#   
#   The timing calculations used by the PXA platforms did not always take
#   account of the timings handed to us by PCMCIA, and where it did, it
#   assumed IO timings for memory windows.
#   
#   We fix this, and provide a generic function which calculates the
#   required timings (in nanoseconds) for IO, memory and attribute
#   windows.  The SOC drivers only have to convert this information to
#   whatever format the hardware requires to achieve at least these
#   timing parameters.
# 
# drivers/pcmcia/soc_common.h
#   2004/05/31 11:13:14+01:00 rmk@flint.arm.linux.org.uk +7 -0
#   Add soc_pcmcia_timing structure and prototype for
#   soc_common_pcmcia_get_timing()
# 
# drivers/pcmcia/soc_common.c
#   2004/05/31 11:13:13+01:00 rmk@flint.arm.linux.org.uk +23 -0
#   Add calc_speed() and soc_common_pcmcia_get_timing()
# 
# drivers/pcmcia/sa11xx_base.c
#   2004/05/31 11:13:13+01:00 rmk@flint.arm.linux.org.uk +11 -29
#   Move calc_speed() into soc_common.c.  Use
#   soc_common_pcmcia_get_timing() to obtain socket timing.
# 
# drivers/pcmcia/pxa2xx_base.c
#   2004/05/31 11:13:13+01:00 rmk@flint.arm.linux.org.uk +7 -9
#   Use soc_common_pcmcia_get_timing() to obtain timing parameters for
#   socket.  Consolidate pxa2xx_pcmcia_set_mc* calls in
#   pxa2xx_pcmcia_update_mcxx().
# 
# ChangeSet
#   2004/05/31 00:38:17-07:00 viro@parcelfarce.linux.theplanet.co.uk 
#   [PATCH] sparse: reiserfs annotation
#   
#   Everything straigthforward and takes care of almost all sparse warnings
#   in fs/reiserfs/*.
# 
# fs/reiserfs/ioctl.c
#   2004/05/30 19:10:29-07:00 viro@parcelfarce.linux.theplanet.co.uk +4 -4
#   sparse: reiserfs annotation
# 
# fs/reiserfs/file.c
#   2004/05/30 19:10:29-07:00 viro@parcelfarce.linux.theplanet.co.uk +2 -2
#   sparse: reiserfs annotation
# 
# ChangeSet
#   2004/05/30 23:17:04-07:00 viro@parcelfarce.linux.theplanet.co.uk 
#   [PATCH] trivial annotation for arch/i386/kernel/*
#   
#   Several places in arch/i386/kernel were still un-annotated - they didn't
#   trip copy_.._user(), so they stayed alive.  Caught and killed.
#   
#   That's not all - there's a big cluster of them in vm86.c, but I haven't
#   looked into that code yet.
# 
# arch/i386/kernel/signal.c
#   2004/05/30 18:52:17-07:00 viro@parcelfarce.linux.theplanet.co.uk +12 -12
#   trivial annotation for arch/i386/kernel/*
# 
# arch/i386/kernel/ptrace.c
#   2004/05/30 18:52:17-07:00 viro@parcelfarce.linux.theplanet.co.uk +17 -16
#   trivial annotation for arch/i386/kernel/*
# 
# arch/i386/kernel/msr.c
#   2004/05/30 18:52:17-07:00 viro@parcelfarce.linux.theplanet.co.uk +4 -4
#   trivial annotation for arch/i386/kernel/*
# 
# arch/i386/kernel/microcode.c
#   2004/05/30 18:52:17-07:00 viro@parcelfarce.linux.theplanet.co.uk +3 -3
#   trivial annotation for arch/i386/kernel/*
# 
# arch/i386/kernel/i387.c
#   2004/05/30 18:52:17-07:00 viro@parcelfarce.linux.theplanet.co.uk +2 -2
#   trivial annotation for arch/i386/kernel/*
# 
# ChangeSet
#   2004/05/30 22:00:08-07:00 torvalds@ppc970.osdl.org 
#   ppc64: mark the "regshere" marker with proper type information.
# 
# arch/ppc64/xmon/xmon.c
#   2004/05/30 22:00:02-07:00 torvalds@ppc970.osdl.org +1 -1
#   ppc64: mark the "regshere" marker with proper type information.
# 
# arch/ppc64/kernel/process.c
#   2004/05/30 22:00:02-07:00 torvalds@ppc970.osdl.org +1 -1
#   ppc64: mark the "regshere" marker with proper type information.
# 
# ChangeSet
#   2004/05/30 21:35:38-07:00 viro@parcelfarce.linux.theplanet.co.uk 
#   [PATCH] sparse alpha: the rest of it
#   
#   A bunch of "return in void function" dealt with, removed bogus extern
#   from definition of __load_new_mm_context(), sanitized fscking ugly
#   CROSS_64K() helper (even if sparse doesn't segfault on that anymore,
#   it's _still_ fscking ugly).
# 
# include/asm-alpha/floppy.h
#   2004/05/30 17:16:29-07:00 viro@parcelfarce.linux.theplanet.co.uk +5 -4
#   sparse alpha: the rest of it
# 
# arch/alpha/mm/fault.c
#   2004/05/30 17:16:07-07:00 viro@parcelfarce.linux.theplanet.co.uk +1 -1
#   sparse alpha: the rest of it
# 
# arch/alpha/kernel/err_titan.c
#   2004/05/30 17:15:50-07:00 viro@parcelfarce.linux.theplanet.co.uk +4 -2
#   sparse alpha: the rest of it
# 
# arch/alpha/kernel/err_marvel.c
#   2004/05/30 17:15:43-07:00 viro@parcelfarce.linux.theplanet.co.uk +2 -1
#   sparse alpha: the rest of it
# 
# arch/alpha/kernel/core_marvel.c
#   2004/05/30 17:15:25-07:00 viro@parcelfarce.linux.theplanet.co.uk +1 -1
#   sparse alpha: the rest of it
# 
# ChangeSet
#   2004/05/30 21:34:09-07:00 viro@parcelfarce.linux.theplanet.co.uk 
#   [PATCH] sparse alpha: utimes()
#   
#   	... and that's where I'd found do_utimes() crap before I went
#   grepping ;-)
# 
# arch/alpha/kernel/osf_sys.c
#   2004/05/30 17:14:28-07:00 viro@parcelfarce.linux.theplanet.co.uk +1 -15
#   sparse alpha: utimes()
# 
# ChangeSet
#   2004/05/30 21:33:58-07:00 viro@parcelfarce.linux.theplanet.co.uk 
#   [PATCH] sparse alpha: trivial parts of __user annotation
#   
#   Trivial stuff in arch/alpha annotated; in two cases of
#   osf_proplist_syscall() dereferencing userland pointers replaced with
#   get_user
# 
# arch/alpha/math-emu/math.c
#   2004/05/30 17:13:06-07:00 viro@parcelfarce.linux.theplanet.co.uk +2 -2
#   sparse alpha: trivial parts of __user annotation
# 
# arch/alpha/kernel/signal.c
#   2004/05/30 17:12:46-07:00 viro@parcelfarce.linux.theplanet.co.uk +15 -14
#   sparse alpha: trivial parts of __user annotation
# 
# arch/alpha/kernel/process.c
#   2004/05/30 17:12:30-07:00 viro@parcelfarce.linux.theplanet.co.uk +5 -3
#   sparse alpha: trivial parts of __user annotation
# 
# arch/alpha/kernel/osf_sys.c
#   2004/05/30 17:12:19-07:00 viro@parcelfarce.linux.theplanet.co.uk +75 -79
#   sparse alpha: trivial parts of __user annotation
# 
# ChangeSet
#   2004/05/30 21:33:47-07:00 viro@parcelfarce.linux.theplanet.co.uk 
#   [PATCH] sparse alpha: #if abuses
#   
#   #if where #ifdef should've been
# 
# include/asm-alpha/semaphore.h
#   2004/05/30 17:07:33-07:00 viro@parcelfarce.linux.theplanet.co.uk +4 -4
#   sparse alpha: #if abuses
# 
# include/asm-alpha/core_mcpcia.h
#   2004/05/30 17:07:55-07:00 viro@parcelfarce.linux.theplanet.co.uk +5 -5
#   sparse alpha: #if abuses
# 
# arch/alpha/kernel/smp.c
#   2004/05/30 17:08:47-07:00 viro@parcelfarce.linux.theplanet.co.uk +2 -2
#   sparse alpha: #if abuses
# 
# arch/alpha/kernel/semaphore.c
#   2004/05/30 17:08:36-07:00 viro@parcelfarce.linux.theplanet.co.uk +4 -4
#   sparse alpha: #if abuses
# 
# arch/alpha/kernel/machvec_impl.h
#   2004/05/30 17:08:14-07:00 viro@parcelfarce.linux.theplanet.co.uk +2 -2
#   sparse alpha: #if abuses
# 
# ChangeSet
#   2004/05/30 21:33:36-07:00 viro@parcelfarce.linux.theplanet.co.uk 
#   [PATCH] sparse alpha: long constants
#   
#   Long constants marked as such
# 
# include/asm-alpha/pgtable.h
#   2004/05/30 17:03:12-07:00 viro@parcelfarce.linux.theplanet.co.uk +1 -1
#   sparse alpha: long constants
# 
# include/asm-alpha/page.h
#   2004/05/30 17:02:59-07:00 viro@parcelfarce.linux.theplanet.co.uk +11 -3
#   sparse alpha: long constants
# 
# include/asm-alpha/io.h
#   2004/05/30 17:02:42-07:00 viro@parcelfarce.linux.theplanet.co.uk +2 -2
#   sparse alpha: long constants
# 
# include/asm-alpha/core_polaris.h
#   2004/05/30 17:02:29-07:00 viro@parcelfarce.linux.theplanet.co.uk +7 -7
#   sparse alpha: long constants
# 
# arch/alpha/mm/init.c
#   2004/05/30 17:05:47-07:00 viro@parcelfarce.linux.theplanet.co.uk +5 -5
#   sparse alpha: long constants
# 
# arch/alpha/math-emu/math.c
#   2004/05/30 17:05:33-07:00 viro@parcelfarce.linux.theplanet.co.uk +1 -1
#   sparse alpha: long constants
# 
# arch/alpha/kernel/sys_sx164.c
#   2004/05/30 17:05:07-07:00 viro@parcelfarce.linux.theplanet.co.uk +1 -1
#   sparse alpha: long constants
# 
# arch/alpha/kernel/setup.c
#   2004/05/30 17:04:53-07:00 viro@parcelfarce.linux.theplanet.co.uk +3 -3
#   sparse alpha: long constants
# 
# arch/alpha/kernel/core_wildfire.c
#   2004/05/30 17:04:23-07:00 viro@parcelfarce.linux.theplanet.co.uk +2 -2
#   sparse alpha: long constants
# 
# arch/alpha/kernel/core_titan.c
#   2004/05/30 17:04:15-07:00 viro@parcelfarce.linux.theplanet.co.uk +2 -2
#   sparse alpha: long constants
# 
# arch/alpha/kernel/core_irongate.c
#   2004/05/30 17:03:54-07:00 viro@parcelfarce.linux.theplanet.co.uk +2 -2
#   sparse alpha: long constants
# 
# arch/alpha/kernel/core_cia.c
#   2004/05/30 17:03:46-07:00 viro@parcelfarce.linux.theplanet.co.uk +1 -1
#   sparse alpha: long constants
# 
# ChangeSet
#   2004/05/30 21:33:26-07:00 viro@parcelfarce.linux.theplanet.co.uk 
#   [PATCH] sparse alpha: beginning of __user annotation
#   
#   Copying primitives annotated.
# 
# include/asm-alpha/uaccess.h
#   2004/05/30 17:00:07-07:00 viro@parcelfarce.linux.theplanet.co.uk +42 -19
#   sparse alpha: beginning of __user annotation
# 
# include/asm-alpha/checksum.h
#   2004/05/30 17:00:22-07:00 viro@parcelfarce.linux.theplanet.co.uk +1 -1
#   sparse alpha: beginning of __user annotation
# 
# arch/alpha/lib/csum_partial_copy.c
#   2004/05/30 17:01:21-07:00 viro@parcelfarce.linux.theplanet.co.uk +9 -8
#   sparse alpha: beginning of __user annotation
# 
# ChangeSet
#   2004/05/30 21:33:10-07:00 torvalds@ppc970.osdl.org 
#   ppc64: more explicitly typed constants
# 
# include/asm-ppc64/pgtable.h
#   2004/05/30 21:33:05-07:00 torvalds@ppc970.osdl.org +3 -3
#   ppc64: more explicitly typed constants
# 
# ChangeSet
#   2004/05/30 20:09:42-07:00 viro@parcelfarce.linux.theplanet.co.uk 
#   [PATCH] sparse: SIOCGIFCONF handling - the rest of it
#   
#   Fixed the type of SIOCGIFCONF callback; inet instance was already
#   correctly annotated, decnet one was _not_.  Moreover, decnet callback
#   needed fixing - dereferencing userland address.
# 
# net/decnet/dn_dev.c
#   2004/05/30 14:17:01-07:00 viro@parcelfarce.linux.theplanet.co.uk +16 -8
#   sparse: SIOCGIFCONF handling - the rest of it
# 
# include/linux/netdevice.h
#   2004/05/30 14:17:01-07:00 viro@parcelfarce.linux.theplanet.co.uk +1 -1
#   sparse: SIOCGIFCONF handling - the rest of it
# 
# ChangeSet
#   2004/05/30 20:09:31-07:00 viro@parcelfarce.linux.theplanet.co.uk 
#   [PATCH] sparse: tty_driver ->write_proc()
#   
#   Made ->write_proc in tty_driver suitable for procfs write callback
# 
# include/linux/tty_driver.h
#   2004/05/30 13:47:19-07:00 viro@parcelfarce.linux.theplanet.co.uk +2 -2
#   sparse: tty_driver ->write_proc()
# 
# ChangeSet
#   2004/05/30 20:09:21-07:00 viro@parcelfarce.linux.theplanet.co.uk 
#   [PATCH] sparse: n_tty annotation
#   
#   n_tty annotated, ldisc_struct ->read() and ->write() got __user
#   on their buf argument.
# 
# include/linux/tty_ldisc.h
#   2004/05/30 13:39:05-07:00 viro@parcelfarce.linux.theplanet.co.uk +2 -2
#   sparse: n_tty annotation
# 
# drivers/char/n_tty.c
#   2004/05/30 13:38:40-07:00 viro@parcelfarce.linux.theplanet.co.uk +6 -6
#   sparse: n_tty annotation
# 
# ChangeSet
#   2004/05/30 20:09:10-07:00 viro@parcelfarce.linux.theplanet.co.uk 
#   [PATCH] sparse: vt and friends
#   
#   vt, vt_ioctl, consolemap and selection annotated, struct unimapdesc
#   and struct consolefontdesc got __user on their pointer members.
# 
# include/linux/vt_kern.h
#   2004/05/30 13:37:41-07:00 viro@parcelfarce.linux.theplanet.co.uk +8 -8
#   sparse: vt and friends
# 
# include/linux/selection.h
#   2004/05/30 13:37:36-07:00 viro@parcelfarce.linux.theplanet.co.uk +2 -2
#   sparse: vt and friends
# 
# include/linux/kd.h
#   2004/05/30 13:37:26-07:00 viro@parcelfarce.linux.theplanet.co.uk +3 -2
#   sparse: vt and friends
# 
# drivers/char/vt_ioctl.c
#   2004/05/30 13:36:38-07:00 viro@parcelfarce.linux.theplanet.co.uk +36 -36
#   sparse: vt and friends
# 
# drivers/char/vt.c
#   2004/05/30 13:36:33-07:00 viro@parcelfarce.linux.theplanet.co.uk +17 -16
#   sparse: vt and friends
# 
# drivers/char/selection.c
#   2004/05/30 13:37:00-07:00 viro@parcelfarce.linux.theplanet.co.uk +13 -21
#   sparse: vt and friends
# 
# drivers/char/consolemap.c
#   2004/05/30 13:36:54-07:00 viro@parcelfarce.linux.theplanet.co.uk +10 -12
#   sparse: vt and friends
# 
# ChangeSet
#   2004/05/30 20:08:59-07:00 viro@parcelfarce.linux.theplanet.co.uk 
#   [PATCH] sparse: tty_ioctl annotation
#   
#   tty_ioctl.c annotation
# 
# drivers/char/tty_ioctl.c
#   2004/05/30 13:35:31-07:00 viro@parcelfarce.linux.theplanet.co.uk +32 -31
#   sparse: tty_ioctl annotation
# 
# ChangeSet
#   2004/05/30 20:08:48-07:00 viro@parcelfarce.linux.theplanet.co.uk 
#   [PATCH] sparse: tty_io annotation
#   
#   tty_io.c annotated
# 
# drivers/char/tty_io.c
#   2004/05/30 13:31:55-07:00 viro@parcelfarce.linux.theplanet.co.uk +41 -40
#   sparse: tty_io annotation
# 
# ChangeSet
#   2004/05/30 20:08:37-07:00 viro@parcelfarce.linux.theplanet.co.uk 
#   [PATCH] sparse: fs/compat.c::copy_iocb() cleanup
#   
#   That "u64" in there is actually struct iocb __user *.  Changed
#   prototype, killed casts in body and caller...
# 
# fs/compat.c
#   2004/05/30 13:14:17-07:00 viro@parcelfarce.linux.theplanet.co.uk +3 -3
#   sparse: fs/compat.c::copy_iocb() cleanup
# 
# ChangeSet
#   2004/05/30 20:08:26-07:00 viro@parcelfarce.linux.theplanet.co.uk 
#   [PATCH] sparse: amd64 - rest
#   
#   return void in floppy.h and "conditionally long" constants in page.h.
#   
#   Would be useful to teach as(1) about C notation for long...
# 
# include/asm-x86_64/page.h
#   2004/05/30 13:09:21-07:00 viro@parcelfarce.linux.theplanet.co.uk +8 -3
#   sparse: amd64 - rest
# 
# include/asm-x86_64/floppy.h
#   2004/05/30 13:08:29-07:00 viro@parcelfarce.linux.theplanet.co.uk +1 -1
#   sparse: amd64 - rest
# 
# ChangeSet
#   2004/05/30 20:08:15-07:00 viro@parcelfarce.linux.theplanet.co.uk 
#   [PATCH] sparse: amd64 - long constants
#   
#   Long constants marked as such.
# 
# include/asm-x86_64/uaccess.h
#   2004/05/30 13:05:01-07:00 viro@parcelfarce.linux.theplanet.co.uk +1 -1
#   sparse: amd64 - long constants
# 
# include/asm-x86_64/processor.h
#   2004/05/30 13:04:53-07:00 viro@parcelfarce.linux.theplanet.co.uk +1 -1
#   sparse: amd64 - long constants
# 
# include/asm-x86_64/pgtable.h
#   2004/05/30 13:04:43-07:00 viro@parcelfarce.linux.theplanet.co.uk +5 -5
#   sparse: amd64 - long constants
# 
# ChangeSet
#   2004/05/30 20:08:04-07:00 viro@parcelfarce.linux.theplanet.co.uk 
#   [PATCH] sparse: amd64 - #if abuse fixes
#   
#   #if where #ifdef should've been.  Fixed.
# 
# include/asm-x86_64/semaphore.h
#   2004/05/30 13:01:37-07:00 viro@parcelfarce.linux.theplanet.co.uk +7 -7
#   sparse: amd64 - #if abuse fixes
# 
# arch/x86_64/kernel/signal.c
#   2004/05/30 13:01:01-07:00 viro@parcelfarce.linux.theplanet.co.uk +6 -6
#   sparse: amd64 - #if abuse fixes
# 
# ChangeSet
#   2004/05/30 20:07:53-07:00 viro@parcelfarce.linux.theplanet.co.uk 
#   [PATCH] sparse: amd64 - more trivial annotations
# 
# include/asm-x86_64/checksum.h
#   2004/05/30 12:58:19-07:00 viro@parcelfarce.linux.theplanet.co.uk +2 -2
#   sparse: amd64 - more trivial annotations
# 
# arch/x86_64/ia32/tls32.c
#   2004/05/30 12:56:33-07:00 viro@parcelfarce.linux.theplanet.co.uk +7 -6
#   sparse: amd64 - more trivial annotations
# 
# arch/x86_64/ia32/sys_ia32.c
#   2004/05/30 12:56:26-07:00 viro@parcelfarce.linux.theplanet.co.uk +56 -55
#   sparse: amd64 - more trivial annotations
# 
# ChangeSet
#   2004/05/30 20:07:42-07:00 viro@parcelfarce.linux.theplanet.co.uk 
#   [PATCH] sparse: amd64 annotations - trivial part
#   
#   Annotation of amd64 code - just adding __user where needed...
# 
# include/asm-x86_64/sigcontext.h
#   2004/05/30 12:51:20-07:00 viro@parcelfarce.linux.theplanet.co.uk +2 -1
#   sparse: amd64 annotations - trivial part
# 
# include/asm-x86_64/ptrace.h
#   2004/05/30 12:51:02-07:00 viro@parcelfarce.linux.theplanet.co.uk +1 -1
#   sparse: amd64 annotations - trivial part
# 
# include/asm-x86_64/ia32.h
#   2004/05/30 12:50:34-07:00 viro@parcelfarce.linux.theplanet.co.uk +2 -2
#   sparse: amd64 annotations - trivial part
# 
# include/asm-x86_64/i387.h
#   2004/05/30 12:50:26-07:00 viro@parcelfarce.linux.theplanet.co.uk +5 -5
#   sparse: amd64 annotations - trivial part
# 
# include/asm-x86_64/fpu32.h
#   2004/05/30 12:50:18-07:00 viro@parcelfarce.linux.theplanet.co.uk +2 -2
#   sparse: amd64 annotations - trivial part
# 
# arch/x86_64/kernel/sys_x86_64.c
#   2004/05/30 12:49:35-07:00 viro@parcelfarce.linux.theplanet.co.uk +4 -4
#   sparse: amd64 annotations - trivial part
# 
# arch/x86_64/kernel/signal.c
#   2004/05/30 12:49:35-07:00 viro@parcelfarce.linux.theplanet.co.uk +13 -12
#   sparse: amd64 annotations - trivial part
# 
# arch/x86_64/kernel/ptrace.c
#   2004/05/30 12:49:35-07:00 viro@parcelfarce.linux.theplanet.co.uk +21 -20
#   sparse: amd64 annotations - trivial part
# 
# arch/x86_64/kernel/process.c
#   2004/05/30 12:49:35-07:00 viro@parcelfarce.linux.theplanet.co.uk +5 -4
#   sparse: amd64 annotations - trivial part
# 
# arch/x86_64/kernel/ldt.c
#   2004/05/30 12:49:35-07:00 viro@parcelfarce.linux.theplanet.co.uk +4 -4
#   sparse: amd64 annotations - trivial part
# 
# arch/x86_64/kernel/i387.c
#   2004/05/30 12:49:35-07:00 viro@parcelfarce.linux.theplanet.co.uk +5 -5
#   sparse: amd64 annotations - trivial part
# 
# arch/x86_64/ia32/ptrace32.c
#   2004/05/30 12:49:35-07:00 viro@parcelfarce.linux.theplanet.co.uk +16 -14
#   sparse: amd64 annotations - trivial part
# 
# arch/x86_64/ia32/ia32_signal.c
#   2004/05/30 12:49:35-07:00 viro@parcelfarce.linux.theplanet.co.uk +20 -19
#   sparse: amd64 annotations - trivial part
# 
# arch/x86_64/ia32/ia32_ioctl.c
#   2004/05/30 12:49:35-07:00 viro@parcelfarce.linux.theplanet.co.uk +5 -5
#   sparse: amd64 annotations - trivial part
# 
# arch/x86_64/ia32/fpu32.c
#   2004/05/30 12:49:35-07:00 viro@parcelfarce.linux.theplanet.co.uk +8 -8
#   sparse: amd64 annotations - trivial part
# 
# ChangeSet
#   2004/05/30 20:07:30-07:00 viro@parcelfarce.linux.theplanet.co.uk 
#   [PATCH] sparse: amd64 annotation - beginning
#   
#   	Annotated basic primitives (copy_.._user, get_user, ...).
#   Functions got __user in prototypes, macros (in uaccess.h) got a
#   conditional check - see CHECK_UPTR() below.  If you have more elegant
#   way to deal with the macros - please, tell.
# 
# include/asm-x86_64/uaccess.h
#   2004/05/30 12:35:49-07:00 viro@parcelfarce.linux.theplanet.co.uk +34 -20
#   sparse: amd64 annotation - beginning
# 
# include/asm-x86_64/compat.h
#   2004/05/30 12:35:02-07:00 viro@parcelfarce.linux.theplanet.co.uk +4 -4
#   sparse: amd64 annotation - beginning
# 
# arch/x86_64/lib/usercopy.c
#   2004/05/30 12:37:21-07:00 viro@parcelfarce.linux.theplanet.co.uk +8 -8
#   sparse: amd64 annotation - beginning
# 
# arch/x86_64/lib/csum-wrappers.c
#   2004/05/30 12:37:12-07:00 viro@parcelfarce.linux.theplanet.co.uk +6 -6
#   sparse: amd64 annotation - beginning
# 
# ChangeSet
#   2004/05/30 20:07:19-07:00 viro@parcelfarce.linux.theplanet.co.uk 
#   [PATCH] sparse: net/* non-ANSI argument lists
# 
# net/ipv6/ip6_flowlabel.c
#   2004/05/30 12:13:56-07:00 viro@parcelfarce.linux.theplanet.co.uk +2 -2
#   sparse: net/* non-ANSI argument lists
# 
# net/ipv4/netfilter/ip_conntrack_core.c
#   2004/05/30 12:13:35-07:00 viro@parcelfarce.linux.theplanet.co.uk +1 -1
#   sparse: net/* non-ANSI argument lists
# 
# net/core/netpoll.c
#   2004/05/30 12:13:16-07:00 viro@parcelfarce.linux.theplanet.co.uk +1 -1
#   sparse: net/* non-ANSI argument lists
# 
# ChangeSet
#   2004/05/30 20:07:08-07:00 viro@parcelfarce.linux.theplanet.co.uk 
#   [PATCH] sparse: more net/* annotation
#   
#   	Annotation of net/* ...copy... that deals with userland pointers +
#   several bits that fell out of previous patch (trivial annotations)
# 
# net/ipv6/af_inet6.c
#   2004/05/30 12:08:58-07:00 viro@parcelfarce.linux.theplanet.co.uk +4 -4
#   sparse: more net/* annotation
# 
# net/ipv4/tcp.c
#   2004/05/30 12:04:58-07:00 viro@parcelfarce.linux.theplanet.co.uk +3 -3
#   sparse: more net/* annotation
# 
# net/core/scm.c
#   2004/05/30 12:08:14-07:00 viro@parcelfarce.linux.theplanet.co.uk +8 -6
#   sparse: more net/* annotation
# 
# net/core/iovec.c
#   2004/05/30 12:08:10-07:00 viro@parcelfarce.linux.theplanet.co.uk +1 -1
#   sparse: more net/* annotation
# 
# net/core/datagram.c
#   2004/05/30 12:05:59-07:00 viro@parcelfarce.linux.theplanet.co.uk +2 -2
#   sparse: more net/* annotation
# 
# include/net/checksum.h
#   2004/05/30 12:06:38-07:00 viro@parcelfarce.linux.theplanet.co.uk +2 -2
#   sparse: more net/* annotation
# 
# include/linux/skbuff.h
#   2004/05/30 12:09:46-07:00 viro@parcelfarce.linux.theplanet.co.uk +3 -3
#   sparse: more net/* annotation
# 
# ChangeSet
#   2004/05/30 20:06:56-07:00 viro@parcelfarce.linux.theplanet.co.uk 
#   [PATCH] sparse: trivial part of net/* annotation
# 
# net/unix/af_unix.c
#   2004/05/30 11:53:02-07:00 viro@parcelfarce.linux.theplanet.co.uk +2 -2
#   sparse: trivial part of net/* annotation
# 
# net/sunrpc/sysctl.c
#   2004/05/30 11:54:02-07:00 viro@parcelfarce.linux.theplanet.co.uk +10 -9
#   sparse: trivial part of net/* annotation
# 
# net/sunrpc/rpc_pipe.c
#   2004/05/30 11:53:51-07:00 viro@parcelfarce.linux.theplanet.co.uk +1 -1
#   sparse: trivial part of net/* annotation
# 
# net/sunrpc/cache.c
#   2004/05/30 11:53:39-07:00 viro@parcelfarce.linux.theplanet.co.uk +5 -5
#   sparse: trivial part of net/* annotation
# 
# net/socket.c
#   2004/05/30 11:52:51-07:00 viro@parcelfarce.linux.theplanet.co.uk +2 -2
#   sparse: trivial part of net/* annotation
# 
# net/packet/af_packet.c
#   2004/05/30 11:54:22-07:00 viro@parcelfarce.linux.theplanet.co.uk +2 -2
#   sparse: trivial part of net/* annotation
# 
# net/ipv6/route.c
#   2004/05/30 11:55:16-07:00 viro@parcelfarce.linux.theplanet.co.uk +2 -2
#   sparse: trivial part of net/* annotation
# 
# net/ipv6/raw.c
#   2004/05/30 11:55:02-07:00 viro@parcelfarce.linux.theplanet.co.uk +2 -2
#   sparse: trivial part of net/* annotation
# 
# net/ipv6/addrconf.c
#   2004/05/30 11:54:45-07:00 viro@parcelfarce.linux.theplanet.co.uk +9 -8
#   sparse: trivial part of net/* annotation
# 
# net/ipv4/udp.c
#   2004/05/30 11:57:26-07:00 viro@parcelfarce.linux.theplanet.co.uk +2 -2
#   sparse: trivial part of net/* annotation
# 
# net/ipv4/tcp.c
#   2004/05/30 11:57:18-07:00 viro@parcelfarce.linux.theplanet.co.uk +1 -1
#   sparse: trivial part of net/* annotation
# 
# net/ipv4/sysctl_net_ipv4.c
#   2004/05/30 11:56:35-07:00 viro@parcelfarce.linux.theplanet.co.uk +6 -5
#   sparse: trivial part of net/* annotation
# 
# net/ipv4/route.c
#   2004/05/30 11:56:26-07:00 viro@parcelfarce.linux.theplanet.co.uk +10 -6
#   sparse: trivial part of net/* annotation
# 
# net/ipv4/raw.c
#   2004/05/30 11:56:17-07:00 viro@parcelfarce.linux.theplanet.co.uk +2 -2
#   sparse: trivial part of net/* annotation
# 
# net/ipv4/devinet.c
#   2004/05/30 11:56:05-07:00 viro@parcelfarce.linux.theplanet.co.uk +8 -8
#   sparse: trivial part of net/* annotation
# 
# net/ipv4/arp.c
#   2004/05/30 11:55:45-07:00 viro@parcelfarce.linux.theplanet.co.uk +1 -1
#   sparse: trivial part of net/* annotation
# 
# net/ipv4/af_inet.c
#   2004/05/30 11:55:36-07:00 viro@parcelfarce.linux.theplanet.co.uk +2 -2
#   sparse: trivial part of net/* annotation
# 
# net/compat.c
#   2004/05/30 11:52:46-07:00 viro@parcelfarce.linux.theplanet.co.uk +39 -40
#   sparse: trivial part of net/* annotation
# 
# include/net/ip6_route.h
#   2004/05/30 11:58:39-07:00 viro@parcelfarce.linux.theplanet.co.uk +1 -1
#   sparse: trivial part of net/* annotation
# 
# include/net/ip.h
#   2004/05/30 11:58:32-07:00 viro@parcelfarce.linux.theplanet.co.uk +4 -4
#   sparse: trivial part of net/* annotation
# 
# include/net/compat.h
#   2004/05/30 11:58:25-07:00 viro@parcelfarce.linux.theplanet.co.uk +3 -3
#   sparse: trivial part of net/* annotation
# 
# include/net/arp.h
#   2004/05/30 11:58:15-07:00 viro@parcelfarce.linux.theplanet.co.uk +1 -1
#   sparse: trivial part of net/* annotation
# 
# include/net/addrconf.h
#   2004/05/30 11:58:05-07:00 viro@parcelfarce.linux.theplanet.co.uk +3 -3
#   sparse: trivial part of net/* annotation
# 
# include/linux/inetdevice.h
#   2004/05/30 11:58:54-07:00 viro@parcelfarce.linux.theplanet.co.uk +1 -1
#   sparse: trivial part of net/* annotation
# 
# ChangeSet
#   2004/05/30 20:06:44-07:00 viro@parcelfarce.linux.theplanet.co.uk 
#   [PATCH] sparse: missed piece of sock_get_timestamp() annotation
# 
# net/atm/ioctl.c
#   2004/05/30 11:49:35-07:00 viro@parcelfarce.linux.theplanet.co.uk +2 -2
#   sparse: missed piece of sock_get_timestamp() annotation
# 
# ChangeSet
#   2004/05/30 20:06:33-07:00 viro@parcelfarce.linux.theplanet.co.uk 
#   [PATCH] sparse: dev_ioctl() callers
#   
#   	dev_ioctl() has a __user pointer argument; however, its declaration
#   lacks that and callers are also wrong.  Declaration fixed, callers updated.
# 
# net/x25/af_x25.c
#   2004/05/30 11:37:22-07:00 viro@parcelfarce.linux.theplanet.co.uk +1 -1
#   sparse: dev_ioctl() callers
# 
# net/wanrouter/af_wanpipe.c
#   2004/05/30 11:37:38-07:00 viro@parcelfarce.linux.theplanet.co.uk +1 -1
#   sparse: dev_ioctl() callers
# 
# net/unix/af_unix.c
#   2004/05/30 11:38:09-07:00 viro@parcelfarce.linux.theplanet.co.uk +1 -1
#   sparse: dev_ioctl() callers
# 
# net/socket.c
#   2004/05/30 11:37:11-07:00 viro@parcelfarce.linux.theplanet.co.uk +2 -2
#   sparse: dev_ioctl() callers
# 
# net/rose/af_rose.c
#   2004/05/30 11:38:38-07:00 viro@parcelfarce.linux.theplanet.co.uk +1 -1
#   sparse: dev_ioctl() callers
# 
# net/packet/af_packet.c
#   2004/05/30 11:39:15-07:00 viro@parcelfarce.linux.theplanet.co.uk +1 -1
#   sparse: dev_ioctl() callers
# 
# net/netrom/af_netrom.c
#   2004/05/30 11:39:44-07:00 viro@parcelfarce.linux.theplanet.co.uk +1 -1
#   sparse: dev_ioctl() callers
# 
# net/llc/af_llc.c
#   2004/05/30 11:39:55-07:00 viro@parcelfarce.linux.theplanet.co.uk +1 -1
#   sparse: dev_ioctl() callers
# 
# net/irda/af_irda.c
#   2004/05/30 11:40:08-07:00 viro@parcelfarce.linux.theplanet.co.uk +1 -1
#   sparse: dev_ioctl() callers
# 
# net/ipx/af_ipx.c
#   2004/05/30 11:40:25-07:00 viro@parcelfarce.linux.theplanet.co.uk +1 -1
#   sparse: dev_ioctl() callers
# 
# net/ipv6/af_inet6.c
#   2004/05/30 11:41:25-07:00 viro@parcelfarce.linux.theplanet.co.uk +1 -1
#   sparse: dev_ioctl() callers
# 
# net/ipv4/af_inet.c
#   2004/05/30 11:42:07-07:00 viro@parcelfarce.linux.theplanet.co.uk +1 -1
#   sparse: dev_ioctl() callers
# 
# net/econet/af_econet.c
#   2004/05/30 11:42:44-07:00 viro@parcelfarce.linux.theplanet.co.uk +1 -1
#   sparse: dev_ioctl() callers
# 
# net/decnet/af_decnet.c
#   2004/05/30 11:42:55-07:00 viro@parcelfarce.linux.theplanet.co.uk +1 -1
#   sparse: dev_ioctl() callers
# 
# net/ax25/af_ax25.c
#   2004/05/30 11:43:08-07:00 viro@parcelfarce.linux.theplanet.co.uk +1 -1
#   sparse: dev_ioctl() callers
# 
# net/appletalk/ddp.c
#   2004/05/30 11:43:32-07:00 viro@parcelfarce.linux.theplanet.co.uk +1 -1
#   sparse: dev_ioctl() callers
# 
# include/linux/netdevice.h
#   2004/05/30 11:44:27-07:00 viro@parcelfarce.linux.theplanet.co.uk +1 -1
#   sparse: dev_ioctl() callers
# 
# ChangeSet
#   2004/05/30 20:06:21-07:00 viro@parcelfarce.linux.theplanet.co.uk 
#   [PATCH] sparse: missed setsockopt wrappers
#   
#   Here's the tail of setsockopt I've missed - for old protocol families we
#   have wrappers around those methods.
# 
# include/linux/net.h
#   2004/05/30 11:20:58-07:00 viro@parcelfarce.linux.theplanet.co.uk +2 -2
#   sparse: missed setsockopt wrappers
# 
# ChangeSet
#   2004/05/30 20:01:28-07:00 ak@suse.de 
#   [PATCH] Fix compilation on x86-64
#   
#   I managed to break compilation with my last patch with a last minute edit.
# 
# arch/x86_64/mm/pageattr.c
#   2004/05/30 16:08:38-07:00 ak@suse.de +0 -1
#   Fix compilation on x86-64
# 
# ChangeSet
#   2004/05/30 19:12:54-07:00 davem@nuts.davemloft.net 
#   [PKT_SCHED]: Missing rta_len init in sch_delay.
# 
# net/sched/sch_delay.c
#   2004/05/30 19:12:33-07:00 davem@nuts.davemloft.net +1 -0
#   [PKT_SCHED]: Missing rta_len init in sch_delay.
# 
# ChangeSet
#   2004/05/30 17:43:22-07:00 davem@nuts.davemloft.net 
#   [SPARC]: Do tty_flip_buffer_push outside of port lock.
# 
# drivers/serial/sunzilog.c
#   2004/05/30 17:43:04-07:00 davem@nuts.davemloft.net +16 -7
#   [SPARC]: Do tty_flip_buffer_push outside of port lock.
# 
# drivers/serial/sunsu.c
#   2004/05/30 17:43:04-07:00 davem@nuts.davemloft.net +16 -4
#   [SPARC]: Do tty_flip_buffer_push outside of port lock.
# 
# drivers/serial/sunsab.c
#   2004/05/30 17:43:04-07:00 davem@nuts.davemloft.net +19 -10
#   [SPARC]: Do tty_flip_buffer_push outside of port lock.
# 
# ChangeSet
#   2004/05/30 17:39:32-07:00 davem@nuts.davemloft.net 
#   [SPARC64]: Update defconfig.
# 
# arch/sparc64/defconfig
#   2004/05/30 17:39:15-07:00 davem@nuts.davemloft.net +4 -5
#   [SPARC64]: Update defconfig.
# 
# ChangeSet
#   2004/05/30 12:50:19-07:00 torvalds@ppc970.osdl.org 
#   ppc64: use "ASM_CONST()" to give proper C type to constants
#   that can also be used in assembly language context.
#   
#   This one fixes the common CPU_FTR_COHERENT_ICACHE warning in
#   asm/cacheflush.h.
# 
# include/asm-ppc64/page.h
#   2004/05/30 12:50:14-07:00 torvalds@ppc970.osdl.org +2 -1
#   ppc64: use "ASM_CONST()" to give proper C type to constants
#   that can also be used in assembly language context.
# 
# include/asm-ppc64/cacheflush.h
#   2004/05/30 12:50:14-07:00 torvalds@ppc970.osdl.org +1 -1
#   ppc64: use "ASM_CONST()" to give proper C type to constants
#   that can also be used in assembly language context.
# 
# ChangeSet
#   2004/05/30 11:55:25-07:00 ak@suse.de 
#   [PATCH] Really fix empty node 0 on x86-64
#   
#   x86-64 shares some numa code with i386, and that didn't handle holes in
#   the node map properly.  Fix this.
# 
# include/asm-i386/cpu.h
#   2004/05/23 06:42:44-07:00 ak@suse.de +2 -4
#   Really fix empty node 0 on x86-64
# 
# arch/i386/mach-default/topology.c
#   2004/05/18 11:00:04-07:00 ak@suse.de +4 -2
#   Really fix empty node 0 on x86-64
# 
# ChangeSet
#   2004/05/30 11:55:13-07:00 ak@suse.de 
#   [PATCH] x86-64 update
#   
#   Add accumulated bug fixes for x86-64 and some minor cleanups.
#   
#    - Add ptep_set_access_flags from i386
#    - Change memory text mapping to 10MB from 40MB to make alias window
#      smaller
#    - Disable change_page_attr for kernel mapoing for now (wrong, but the
#      other code also doesn't work)
#    - Add .bss.page_aligned and align interrupt/exception stacks (idea from
#      Matt Mackall)
#    - Protect sysenter MSR setup against missing registers. 
#    - Set mce tolerance level to 1 (panic instead of deadlock)
#    - Fix cross 4GB bug in find_first_bit (Michael Matz)
#    - Add missing memory clobbers in bitops.h (Suresh B.  Siddha)
#    - Check kernel size at boot up
#    - Set boot cpu online at boot to fix early printk
#    - Fix EFER bit definitions (Dave Jones)
#    - Fix comments in 32bit syscall table.
#    - Quieten all 32bit syscalls that are unimplemented in 32bit. 
#    - Various MCE fixes suggested by Eric Morton, David Boles et.al.
#      More to come.
#    - Quieten some printks
#    - Fix cpu online check in msr driver
#    - Lower polling interval for machine checks to 5 minutes to avoid
#      overrunning the registers. 
#    - Make memcpy_{from,to}io more compatible with i386 (Roland Dreier)
# 
# arch/x86_64/kernel/Makefile-HEAD
#   2004/05/23 16:18:04-07:00 ak@suse.de +38 -0
#   x86-64 update
# 
# include/asm-x86_64/pgtable.h
#   2004/05/30 08:07:16-07:00 ak@suse.de +14 -0
#   x86-64 update
# 
# include/asm-x86_64/page.h
#   2004/05/30 06:56:53-07:00 ak@suse.de +1 -1
#   x86-64 update
# 
# include/asm-x86_64/msr.h
#   2004/05/25 08:39:30-07:00 ak@suse.de +2 -2
#   x86-64 update
# 
# include/asm-x86_64/io.h
#   2004/05/17 14:12:13-07:00 ak@suse.de +7 -2
#   x86-64 update
# 
# include/asm-x86_64/ia32_unistd.h
#   2004/05/23 07:25:41-07:00 ak@suse.de +2 -1
#   x86-64 update
# 
# include/asm-x86_64/bitops.h
#   2004/05/27 10:18:23-07:00 ak@suse.de +3 -4
#   x86-64 update
# 
# arch/x86_64/mm/pageattr.c
#   2004/05/30 11:35:44-07:00 ak@suse.de +5 -4
#   x86-64 update
# 
# arch/x86_64/mm/init.c
#   2004/05/18 10:59:32-07:00 ak@suse.de +1 -3
#   x86-64 update
# 
# arch/x86_64/lib/io.c
#   2004/05/17 14:12:13-07:00 ak@suse.de +6 -4
#   x86-64 update
# 
# arch/x86_64/lib/Makefile
#   2004/05/17 14:12:13-07:00 ak@suse.de +3 -1
#   x86-64 update
# 
# arch/x86_64/kernel/x8664_ksyms.c
#   2004/05/17 14:12:13-07:00 ak@suse.de +0 -3
#   x86-64 update
# 
# arch/x86_64/kernel/vmlinux.lds.S
#   2004/05/30 04:33:25-07:00 ak@suse.de +3 -2
#   x86-64 update
# 
# arch/x86_64/kernel/smpboot.c
#   2004/05/30 04:37:23-07:00 ak@suse.de +6 -4
#   x86-64 update
# 
# arch/x86_64/kernel/setup64.c
#   2004/05/30 04:34:53-07:00 ak@suse.de +3 -2
#   x86-64 update
# 
# arch/x86_64/kernel/setup.c
#   2004/05/30 04:37:23-07:00 ak@suse.de +2 -2
#   x86-64 update
# 
# arch/x86_64/kernel/msr.c
#   2004/05/30 07:32:49-07:00 ak@suse.de +1 -1
#   x86-64 update
# 
# arch/x86_64/kernel/mpparse.c
#   2004/05/21 09:50:37-07:00 ak@suse.de +5 -1
#   x86-64 update
# 
# arch/x86_64/kernel/mce.c
#   2004/05/30 07:32:49-07:00 ak@suse.de +23 -8
#   x86-64 update
# 
# arch/x86_64/kernel/head64.c
#   2004/05/27 09:34:10-07:00 ak@suse.de +9 -0
#   x86-64 update
# 
# arch/x86_64/kernel/head.S
#   2004/05/30 06:59:46-07:00 ak@suse.de +3 -16
#   x86-64 update
# 
# arch/x86_64/kernel/acpi/sleep.c
#   2004/05/21 09:51:11-07:00 ak@suse.de +1 -1
#   x86-64 update
# 
# arch/x86_64/kernel/Makefile-HEAD
#   2004/05/23 16:18:04-07:00 ak@suse.de +0 -0
#   BitKeeper file /home/torvalds/v2.6/linux/arch/x86_64/kernel/Makefile-HEAD
# 
# arch/x86_64/ia32/syscall32.c
#   2004/05/29 05:29:55-07:00 ak@suse.de +3 -3
#   x86-64 update
# 
# arch/x86_64/ia32/ia32entry.S
#   2004/05/30 10:55:21-07:00 ak@suse.de +31 -30
#   x86-64 update
# 
# arch/x86_64/ia32/ia32_signal.c
#   2004/05/23 15:29:24-07:00 ak@suse.de +2 -3
#   x86-64 update
# 
# ChangeSet
#   2004/05/30 11:47:20-07:00 torvalds@ppc970.osdl.org 
#   ppc64: fix untyped large constants so that they don't cause
#   sparse to warn about implicit typing.
# 
# include/asm-ppc64/iSeries/HvCallSc.h
#   2004/05/30 11:47:15-07:00 torvalds@ppc970.osdl.org +8 -8
#   ppc64: fix untyped large constants so that they don't cause
#   sparse to warn about implicit typing.
# 
# ChangeSet
#   2004/05/30 11:10:51-07:00 torvalds@ppc970.osdl.org 
#   Add __user annotations to sock_get_timestamp()
# 
# net/x25/af_x25.c
#   2004/05/30 11:10:46-07:00 torvalds@ppc970.osdl.org +1 -1
#   Add __user annotations to sock_get_timestamp()
# 
# net/wanrouter/af_wanpipe.c
#   2004/05/30 11:10:46-07:00 torvalds@ppc970.osdl.org +1 -1
#   Add __user annotations to sock_get_timestamp()
# 
# net/rose/af_rose.c
#   2004/05/30 11:10:45-07:00 torvalds@ppc970.osdl.org +1 -1
#   Add __user annotations to sock_get_timestamp()
# 
# net/packet/af_packet.c
#   2004/05/30 11:10:45-07:00 torvalds@ppc970.osdl.org +1 -1
#   Add __user annotations to sock_get_timestamp()
# 
# net/netrom/af_netrom.c
#   2004/05/30 11:10:45-07:00 torvalds@ppc970.osdl.org +1 -1
#   Add __user annotations to sock_get_timestamp()
# 
# net/irda/af_irda.c
#   2004/05/30 11:10:45-07:00 torvalds@ppc970.osdl.org +1 -1
#   Add __user annotations to sock_get_timestamp()
# 
# net/ipx/af_ipx.c
#   2004/05/30 11:10:45-07:00 torvalds@ppc970.osdl.org +1 -1
#   Add __user annotations to sock_get_timestamp()
# 
# net/ipv6/af_inet6.c
#   2004/05/30 11:10:45-07:00 torvalds@ppc970.osdl.org +1 -1
#   Add __user annotations to sock_get_timestamp()
# 
# net/ipv4/af_inet.c
#   2004/05/30 11:10:45-07:00 torvalds@ppc970.osdl.org +1 -1
#   Add __user annotations to sock_get_timestamp()
# 
# net/econet/af_econet.c
#   2004/05/30 11:10:45-07:00 torvalds@ppc970.osdl.org +1 -1
#   Add __user annotations to sock_get_timestamp()
# 
# net/core/sock.c
#   2004/05/30 11:10:45-07:00 torvalds@ppc970.osdl.org +1 -1
#   Add __user annotations to sock_get_timestamp()
# 
# net/ax25/af_ax25.c
#   2004/05/30 11:10:45-07:00 torvalds@ppc970.osdl.org +1 -1
#   Add __user annotations to sock_get_timestamp()
# 
# net/appletalk/ddp.c
#   2004/05/30 11:10:45-07:00 torvalds@ppc970.osdl.org +1 -1
#   Add __user annotations to sock_get_timestamp()
# 
# include/net/sock.h
#   2004/05/30 11:10:45-07:00 torvalds@ppc970.osdl.org +1 -1
#   Add __user annotations to sock_get_timestamp()
# 
# ChangeSet
#   2004/05/30 10:32:16-07:00 pepe@attika.ath.cx 
#   [PATCH] make vram boot option actually work
#   
#   The following patch makes the vram boot option actually be recognized
#   and its value assigned to the vram variable.
#   
#   Signed-off-by: Linus Torvalds <torvalds@osdl.org>
# 
# drivers/video/vesafb.c
#   2004/05/30 09:43:18-07:00 pepe@attika.ath.cx +1 -1
#   make vram boot option actually work
# 
# ChangeSet
#   2004/05/30 14:40:37+01:00 rmk@flint.arm.linux.org.uk 
#   [ARM] Add two more missing __user annotations for sparse.
# 
# arch/arm/kernel/signal.c
#   2004/05/30 14:38:17+01:00 rmk@flint.arm.linux.org.uk +2 -2
#   Add missing __user annotation for accessing user stack.
# 
# arch/arm/kernel/ptrace.c
#   2004/05/30 14:38:17+01:00 rmk@flint.arm.linux.org.uk +1 -1
#   Add missing __user annotation for PTRACE_PEEK{TEXT,DATA}
# 
# ChangeSet
#   2004/05/28 13:06:14-04:00 jgarzik@redhat.com 
#   [netdrvr 8139too] remove bogus config option test
#   
#   8139too should not be testing CONFIG_EMBEDDED.
#   
#   Thanks to Christoph Hellwig for pointing this out.
# 
# drivers/net/8139too.c
#   2004/05/28 13:06:08-04:00 jgarzik@redhat.com +1 -1
#   [netdrvr 8139too] remove bogus config option test
#   
#   8139too should not be testing CONFIG_EMBEDDED.
#   
#   Thanks to Christoph Hellwig for pointing this out.
# 
# ChangeSet
#   2004/05/27 16:59:31-04:00 jgarzik@redhat.com 
#   [netdrvr e1000] use generic ethtool_ops provided in net/core/ethtool.c
# 
# drivers/net/e1000/e1000_ethtool.c
#   2004/05/27 16:59:25-04:00 jgarzik@redhat.com +4 -33
#   [netdrvr e1000] use generic ethtool_ops provided in net/core/ethtool.c
# 
# ChangeSet
#   2004/05/27 14:28:39+01:00 davej@redhat.com 
#   [AGPGART] SIS AGP updates
#   
#   Signed-off-by: Dave Jones <davej@redhat.com>
#   
#   From: "Heilmann, Oliver" <Oliver.Heilmann@drkw.com>
#                                                                                            
#   * renamed sis_648_enable to sis_delayed_enable and removed chipset
#     references
#                                                                                            
#   * All chipsets that require the sis delay-hack are listed in
#     sis_broken_chipsets (and no other place).
#                                                                                            
#   * There are two new module options to force agp3-spec compliant
#     initialisation and/or the delay hack.  As I only have a 648FX chipset to
#     test on, I figured this might be useful to experiment with on other
#     chipsets (i.e.746[FX]).
#                                                                                            
#   Basically, if you have an  SiS chipset and your machine freezes when you
#   start X, try the -agp_sis_force_delay=1 option. If this fixes your
#   problem add your PCI ID to sis_broken_chipsets in sis-agp.c
#   Note to 746[FX] people: I'm still not sure what the differences between
#   the two 746 versions and the 648 series are. If this patch does not work
#   for you try playing with the agp_sis_agp_spec module option. Any
#   feedback is greatly appreciated.
# 
# drivers/char/agp/sis-agp.c
#   2004/05/27 14:28:32+01:00 davej@redhat.com +36 -24
#   [AGPGART] SIS AGP updates
#   
#   Signed-off-by: Dave Jones <davej@redhat.com>
#   
#   From: "Heilmann, Oliver" <Oliver.Heilmann@drkw.com>
#                                                                                            
#   * renamed sis_648_enable to sis_delayed_enable and removed chipset
#     references
#                                                                                            
#   * All chipsets that require the sis delay-hack are listed in
#     sis_broken_chipsets (and no other place).
#                                                                                            
#   * There are two new module options to force agp3-spec compliant
#     initialisation and/or the delay hack.  As I only have a 648FX chipset to
#     test on, I figured this might be useful to experiment with on other
#     chipsets (i.e.746[FX]).
#                                                                                            
#   Basically, if you have an  SiS chipset and your machine freezes when you
#   start X, try the -agp_sis_force_delay=1 option. If this fixes your
#   problem add your PCI ID to sis_broken_chipsets in sis-agp.c
#   Note to 746[FX] people: I'm still not sure what the differences between
#   the two 746 versions and the 648 series are. If this patch does not work
#   for you try playing with the agp_sis_agp_spec module option. Any
#   feedback is greatly appreciated.
# 
# ChangeSet
#   2004/05/27 11:30:39+01:00 davej@redhat.com 
#   [CPUFREQ] Make powernow-k7 module parameter not need powernow prefix.
#   From: Bruno Ducrot
#   
#   because powernow_k7.powernow_acpi_force=1 looks silly.
# 
# arch/i386/kernel/cpu/cpufreq/powernow-k7.c
#   2004/05/27 11:30:31+01:00 davej@redhat.com +3 -4
#   [CPUFREQ] Make powernow-k7 module parameter not need powernow prefix.
#   From: Bruno Ducrot
#   
#   because powernow_k7.powernow_acpi_force=1 looks silly.
# 
# ChangeSet
#   2004/05/26 22:30:23+01:00 davej@redhat.com 
#   [CPUFREQ] fix panic in powernow_k8_verify on MP but PSB systems.
#   
#   Instead of -ENODEV; powernow_k8_cpu_init returns 0 if it's running on a MP
#   system but PSB BIOS is tried... this causes a panic in
#   powernow_k8_verify, as can be seen at
#   http://forums.gentoo.org/viewtopic.php?t=177423
#   
#   Signed-off-by: Dave Jones <davej@redhat.com>
#   Signed-off-by: Dominik Brodowski <linux@brodo.de>
# 
# arch/i386/kernel/cpu/cpufreq/powernow-k8.c
#   2004/05/26 22:30:16+01:00 davej@redhat.com +1 -1
#   [CPUFREQ] fix panic in powernow_k8_verify on MP but PSB systems.
#   
#   Instead of -ENODEV; powernow_k8_cpu_init returns 0 if it's running on a MP
#   system but PSB BIOS is tried... this causes a panic in
#   powernow_k8_verify, as can be seen at
#   http://forums.gentoo.org/viewtopic.php?t=177423
#   
#   Signed-off-by: Dave Jones <davej@redhat.com>
#   Signed-off-by: Dominik Brodowski <linux@brodo.de>
# 
# ChangeSet
#   2004/05/26 16:32:13+01:00 aia21@cantab.net 
#   NTFS: 2.1.12 release - Fix the second fix to the decompression engine.
# 
# fs/ntfs/super.c
#   2004/05/26 16:32:04+01:00 aia21@cantab.net +1 -1
#   Fix typo in error message.
# 
# fs/ntfs/compress.c
#   2004/05/26 16:32:04+01:00 aia21@cantab.net +6 -14
#   Undo the second decompression engine fix (see 2.1.9 release ChangeLog
#   entry) as it was only fixing a theoretical bug but at the same time
#   it badly broke the handling of sparse and uncompressed compression
#   blocks.
# 
# fs/ntfs/Makefile
#   2004/05/26 16:32:04+01:00 aia21@cantab.net +1 -1
#   Update for 2.1.12 release.
# 
# fs/ntfs/ChangeLog
#   2004/05/26 16:32:04+01:00 aia21@cantab.net +5 -1
#   Update
# 
# Documentation/filesystems/ntfs.txt
#   2004/05/26 16:32:03+01:00 aia21@cantab.net +3 -0
#   Update
# 
# ChangeSet
#   2004/05/25 16:31:28+01:00 aia21@cantab.net 
#   NTFS: Cleanup dirty ntfs inode handling (fs/ntfs/inode.[hc]) which also
#         includes an adapted ntfs_commit_inode() and an implementation of
#         ntfs_write_inode() which for now just cleans dirty inodes without
#         writing them (it does emit a warning that this is happening).
# 
# fs/ntfs/inode.h
#   2004/05/25 16:31:22+01:00 aia21@cantab.net +9 -0
#   Cleanup dirty ntfs inode handling (fs/ntfs/inode.[hc]) which also
#   includes an adapted ntfs_commit_inode() and an implementation of
#   ntfs_write_inode() which for now just cleans dirty inodes without
#   writing them (it does emit a warning that this is happening).
# 
# fs/ntfs/inode.c
#   2004/05/25 16:31:22+01:00 aia21@cantab.net +84 -41
#   Cleanup dirty ntfs inode handling (fs/ntfs/inode.[hc]) which also
#   includes an adapted ntfs_commit_inode() and an implementation of
#   ntfs_write_inode() which for now just cleans dirty inodes without
#   writing them (it does emit a warning that this is happening).
# 
# fs/ntfs/dir.c
#   2004/05/25 16:31:22+01:00 aia21@cantab.net +1 -1
#   Change a rogue a debug message to print inode number in hex, not decimal.
# 
# fs/ntfs/ChangeLog
#   2004/05/25 16:31:21+01:00 aia21@cantab.net +4 -0
#   Update.
# 
# ChangeSet
#   2004/05/24 22:06:20+01:00 davej@redhat.com 
#   [CPUFREQ] Scaling on VIA C3 Nehemiah works now.
#   So remove the warning printk.
# 
# arch/i386/kernel/cpu/cpufreq/longhaul.c
#   2004/05/24 22:06:13+01:00 davej@redhat.com +1 -5
#   [CPUFREQ] Scaling on VIA C3 Nehemiah works now.
#   So remove the warning printk.
# 
# ChangeSet
#   2004/05/24 22:03:26+01:00 davej@redhat.com 
#   [CPUFREQ] Make longhaul debug a module option.
# 
# arch/i386/kernel/cpu/cpufreq/longhaul.c
#   2004/05/24 22:03:19+01:00 davej@redhat.com +14 -12
#   [CPUFREQ] Make longhaul debug a module option.
# 
# ChangeSet
#   2004/05/24 21:39:03+01:00 davej@redhat.com 
#   [CPUFREQ] Fix leak in powernow-k8
#   Spotted by Yury Umanets
# 
# arch/i386/kernel/cpu/cpufreq/powernow-k8.c
#   2004/05/24 21:38:56+01:00 davej@redhat.com +5 -1
#   [CPUFREQ] Fix leak in powernow-k8
#   Spotted by Yury Umanets
# 
# ChangeSet
#   2004/05/24 21:29:57+01:00 davej@redhat.com 
#   [CPUFREQ] Remove a bunch of trailing whitespace from the powernow-k8 driver.
# 
# arch/i386/kernel/cpu/cpufreq/powernow-k8.c
#   2004/05/24 21:29:50+01:00 davej@redhat.com +4 -4
#   [CPUFREQ] Remove a bunch of trailing whitespace from the powernow-k8 driver.
# 
# ChangeSet
#   2004/05/24 21:20:35+01:00 davej@redhat.com 
#   [CPUFREQ] Quieten the powernow-k7 init printk a little.
#   There seem to be quite a few desktop K7 processors which support the
#   powernow cpuid call, but don't actually offer any powernow scaling.
#   In which case the driver prints out
#   "PowerNOW! Technology present. Can scale: nothing" which looks a bit odd,
#   and just adds to confusion of end-users.
#   Change things so that we don't print anything at all if we can't do anything.
#   
#   Also kill some trailing whitespace gremlins that crept in.
# 
# arch/i386/kernel/cpu/cpufreq/powernow-k7.c
#   2004/05/24 21:20:28+01:00 davej@redhat.com +7 -7
#   [CPUFREQ] Quieten the powernow-k7 init printk a little.
#   There seem to be quite a few desktop K7 processors which support the
#   powernow cpuid call, but don't actually offer any powernow scaling.
#   In which case the driver prints out
#   "PowerNOW! Technology present. Can scale: nothing" which looks a bit odd,
#   and just adds to confusion of end-users.
#   Change things so that we don't print anything at all if we can't do anything.
#   
#   Also kill some trailing whitespace gremlins that crept in.
# 
# ChangeSet
#   2004/05/24 21:12:04+01:00 davej@redhat.com 
#   [CPUFREQ] Use correct printk prefix in p4-clockmod driver
# 
# arch/i386/kernel/cpu/cpufreq/p4-clockmod.c
#   2004/05/24 21:11:57+01:00 davej@redhat.com +1 -1
#   [CPUFREQ] Use correct printk prefix in p4-clockmod driver
# 
# ChangeSet
#   2004/05/24 21:09:12+01:00 davej@redhat.com 
#   [CPUFREQ] Remove some unneeded includes.
# 
# arch/i386/kernel/cpu/cpufreq/p4-clockmod.c
#   2004/05/24 21:09:05+01:00 davej@redhat.com +0 -1
#   [CPUFREQ] Remove some unneeded includes.
# 
# arch/i386/kernel/cpu/cpufreq/gx-suspmod.c
#   2004/05/24 21:09:05+01:00 davej@redhat.com +0 -1
#   [CPUFREQ] Remove some unneeded includes.
# 
# ChangeSet
#   2004/05/24 21:06:38+01:00 davej@redhat.com 
#   [CPUFREQ] Convert longhaul driver to use module_param
# 
# arch/i386/kernel/cpu/cpufreq/longhaul.c
#   2004/05/24 21:06:31+01:00 davej@redhat.com +3 -1
#   [CPUFREQ] Convert longhaul driver to use module_param
# 
# ChangeSet
#   2004/05/23 15:24:28+01:00 davej@redhat.com 
#   [CPUFREQ] Silence noisy debugging printk in longhaul driver.
# 
# arch/i386/kernel/cpu/cpufreq/longhaul.c
#   2004/05/23 15:24:20+01:00 davej@redhat.com +29 -30
#   [CPUFREQ] Silence noisy debugging printk in longhaul driver.
#   
#   (Also remove a load of whitespace noise)
# 
# ChangeSet
#   2004/05/23 13:02:45+01:00 davej@redhat.com 
#   [AGPGART] Fix a potential leak in intel driver.
#   It's not leaking anything currently, as agp_alloc_bridge() doesn't do any
#   actual allocations right now, but if/when things get changed to support
#   multiple bridges, these error paths need to free up the allocation.
#    
# 
# drivers/char/agp/intel-agp.c
#   2004/05/23 13:02:38+01:00 davej@redhat.com +6 -3
#   [AGPGART] Fix a potential leak in intel driver.
#   It's not leaking anything currently, as agp_alloc_bridge() doesn't do any
#   actual allocations right now, but if/when things get changed to support
#   multiple bridges, these error paths need to free up the allocation.
#    
# 
# fs/ntfs/super.c
#   2004/05/20 14:52:43+01:00 aia21@cantab.net +1 -1
#   Improve comment.
# 
# fs/ntfs/inode.c
#   2004/05/20 14:52:43+01:00 aia21@cantab.net +1 -1
#   Improve comment.
# 
# ChangeSet
#   2004/05/19 15:47:31+01:00 davej@redhat.com 
#   [AGPGART] Remove lots of trailing whitespace from amd64 gart driver.
#   No code changes.
# 
# drivers/char/agp/amd64-agp.c
#   2004/05/19 15:47:25+01:00 davej@redhat.com +67 -69
#   [AGPGART] Remove lots of trailing whitespace from amd64 gart driver.
#   No code changes.
# 
# ChangeSet
#   2004/05/19 15:43:11+01:00 davej@redhat.com 
#   [AGPGART] Add missing SIS755 ID to AMD64 AGP driver
#   From: Andi Kleen
# 
# drivers/char/agp/amd64-agp.c
#   2004/05/19 15:43:05+01:00 davej@redhat.com +9 -0
#   [AGPGART] Add missing SIS755 ID to AMD64 AGP driver
#   From: Andi Kleen
# 
# ChangeSet
#   2004/05/19 15:41:33+01:00 davej@redhat.com 
#   [AGPGART] Make the Nvidia AGP driver only announce PCI IDs it actually supports.
#   From: Andi Kleen
# 
# drivers/char/agp/nvidia-agp.c
#   2004/05/19 15:41:26+01:00 davej@redhat.com +9 -1
#   [AGPGART] Make the Nvidia AGP driver only announce PCI IDs it actually supports.
#   From: Andi Kleen
# 
# ChangeSet
#   2004/05/19 15:40:43+01:00 davej@redhat.com 
#   [AGPGART] Make the VIA AGP driver only announce PCI IDs it actually supports.
#   Avoids dups with the AMD64 driver.
#   From: Andi Kleen
# 
# drivers/char/agp/via-agp.c
#   2004/05/19 15:40:36+01:00 davej@redhat.com +37 -21
#   [AGPGART] Make the VIA AGP driver only announce PCI IDs it actually supports.
#   Avoids dups with the AMD64 driver.
#   From: Andi Kleen
# 
# ChangeSet
#   2004/05/19 15:39:09+01:00 davej@redhat.com 
#   [AGPGART] kill trailing whitespace & indentation fixes.
# 
# drivers/char/agp/amd-k7-agp.c
#   2004/05/19 15:39:03+01:00 davej@redhat.com +9 -9
#   [AGPGART] kill trailing whitespace & indentation fixes.
# 
# ChangeSet
#   2004/05/19 15:36:10+01:00 davej@redhat.com 
#   [AGPGART] Make the driver only announce the PCI IDs it actually supports.
#   This avoids dups with the amd64 driver.
#   From: Andi Kleen
# 
# drivers/char/agp/amd-k7-agp.c
#   2004/05/19 15:36:03+01:00 davej@redhat.com +24 -15
#   [AGPGART] Make the driver only announce the PCI IDs it actually supports.
#   This avoids dups with the amd64 driver.
#   From: Andi Kleen
# 
# ChangeSet
#   2004/05/17 22:45:04+01:00 aia21@cantab.net 
#   NTFS: Add a new address space operations struct, ntfs_mst_aops, for mst
#         protected attributes.  This is because the default ntfs_aops do not
#         make sense with mst protected data and were they to write anything to
#         such an attribute they would cause data corruption so we provide
#         ntfs_mst_aops which does not have any write related operations set.
# 
# fs/ntfs/ntfs.h
#   2004/05/17 22:42:28+01:00 aia21@cantab.net +1 -0
#   Add a new address space operations struct, ntfs_mst_aops, for mst
#   protected attributes.
# 
# fs/ntfs/inode.c
#   2004/05/17 22:42:15+01:00 aia21@cantab.net +5 -2
#   Add a new address space operations struct, ntfs_mst_aops, for mst
#   protected attributes.
# 
# fs/ntfs/aops.c
#   2004/05/17 22:41:44+01:00 aia21@cantab.net +9 -0
#   Add a new address space operations struct, ntfs_mst_aops, for mst
#   protected attributes.
# 
# fs/ntfs/Makefile
#   2004/05/17 22:41:38+01:00 aia21@cantab.net +1 -1
#   Update
# 
# fs/ntfs/ChangeLog
#   2004/05/17 22:41:31+01:00 aia21@cantab.net +8 -0
#   Update
# 
# ChangeSet
#   2004/05/17 16:29:24+01:00 davej@redhat.com 
#   [AGPGART] Don't abort if Intel-agp can't find AGP capability.
#   Some bridges don't have this set it seems.
#   Detective work, and fixing by Andi Kleen.
# 
# drivers/char/agp/intel-agp.c
#   2004/05/17 16:29:18+01:00 davej@redhat.com +0 -2
#   [AGPGART] Don't abort if Intel-agp can't find AGP capability.
#   Some bridges don't have this set it seems.
#   Detective work, and fixing by Andi Kleen.
# 
# ChangeSet
#   2004/05/12 11:50:18+01:00 davej@redhat.com 
#   [AGPGART] Various Intel/EM64T AGP fixes.
#   
#   From Andi Kleen.
#   
#   - Add full PCI IDs to the module table for intel-agp and intel-mch-agp.
#   Don't use PCI_ANY_ID for device, since the drivers cannot handle unknown
#   devices anyways.
#   This fixes the problems with them loading both when compiled in and
#   also helps external tools that use the module PCI table to find the
#   correct driver.
#   - Remove wrong hack in intel-mch-agp that checked for long mode.
#   EM64T capability has nothing to do with the MCH version.
#   To avoid double probing the fix above is better.
#   - Handle the case of no AGP capability (unlikely, but better to handle it)
# 
# drivers/char/agp/intel-mch-agp.c
#   2004/05/12 11:50:12+01:00 davej@redhat.com +11 -4
#   [AGPGART] Various Intel/EM64T AGP fixes.
#   
#   From Andi Kleen.
#   
#   - Add full PCI IDs to the module table for intel-agp and intel-mch-agp.
#   Don't use PCI_ANY_ID for device, since the drivers cannot handle unknown
#   devices anyways.
#   This fixes the problems with them loading both when compiled in and
#   also helps external tools that use the module PCI table to find the
#   correct driver.
#   - Remove wrong hack in intel-mch-agp that checked for long mode.
#   EM64T capability has nothing to do with the MCH version.
#   To avoid double probing the fix above is better.
#   - Handle the case of no AGP capability (unlikely, but better to handle it)
# 
# drivers/char/agp/intel-agp.c
#   2004/05/12 11:50:12+01:00 davej@redhat.com +32 -8
#   [AGPGART] Various Intel/EM64T AGP fixes.
#   
#   From Andi Kleen.
#   
#   - Add full PCI IDs to the module table for intel-agp and intel-mch-agp.
#   Don't use PCI_ANY_ID for device, since the drivers cannot handle unknown
#   devices anyways.
#   This fixes the problems with them loading both when compiled in and
#   also helps external tools that use the module PCI table to find the
#   correct driver.
#   - Remove wrong hack in intel-mch-agp that checked for long mode.
#   EM64T capability has nothing to do with the MCH version.
#   To avoid double probing the fix above is better.
#   - Handle the case of no AGP capability (unlikely, but better to handle it)
# 
# ChangeSet
#   2004/04/16 20:16:10+01:00 davej@redhat.com 
#   [AGPGART] If ati_create_gatt_pages() fails, don't propagate an address we've freed.
# 
# drivers/char/agp/ati-agp.c
#   2004/04/16 20:16:04+01:00 davej@redhat.com +1 -0
#   [AGPGART] If ati_create_gatt_pages() fails, don't propagate an address we've freed.
# 
diff -Nru a/Documentation/SubmittingPatches b/Documentation/SubmittingPatches
--- a/Documentation/SubmittingPatches	2004-06-02 23:26:58 -07:00
+++ b/Documentation/SubmittingPatches	2004-06-02 23:26:58 -07:00
@@ -259,6 +259,47 @@
 
 
 
+11) Sign your work
+
+To improve tracking of who did what, especially with patches that can
+percolate to their final resting place in the kernel through several
+layers of maintainers, we've introduced a "sign-off" procedure on
+patches that are being emailed around.
+
+The sign-off is a simple line at the end of the explanation for the
+patch, which certifies that you wrote it or otherwise have the right to
+pass it on as a open-source patch.  The rules are pretty simple: if you
+can certify the below:
+
+        Developer's Certificate of Origin 1.0
+
+        By making a contribution to this project, I certify that:
+
+        (a) The contribution was created in whole or in part by me and I
+            have the right to submit it under the open source license
+            indicated in the file; or
+
+        (b) The contribution is based upon previous work that, to the best
+            of my knowledge, is covered under an appropriate open source
+            license and I have the right under that license to submit that
+            work with modifications, whether created in whole or in part
+            by me, under the same open source license (unless I am
+            permitted to submit under a different license), as indicated
+            in the file; or
+
+        (c) The contribution was provided directly to me by some other
+            person who certified (a), (b) or (c) and I have not modified
+            it.
+
+then you just add a line saying
+
+	Signed-off-by: Random J Developer <random@developer.org>
+
+Some people also put extra tags at the end.  They'll just be ignored for
+now, but you can do this to mark internal company procedures or just
+point out some special detail about the sign-off. 
+
+
 -----------------------------------
 SECTION 2 - HINTS, TIPS, AND TRICKS
 -----------------------------------
diff -Nru a/Documentation/fb/vesafb.txt b/Documentation/fb/vesafb.txt
--- a/Documentation/fb/vesafb.txt	2004-06-02 23:27:00 -07:00
+++ b/Documentation/fb/vesafb.txt	2004-06-02 23:27:00 -07:00
@@ -146,6 +146,10 @@
 
 mtrr	setup memory type range registers for the vesafb framebuffer.
 
+vram:n	remap 'n' MiB of video RAM. If 0 or not specified, remap memory
+	according to video mode. (2.5.66 patch/idea by Antonino Daplas
+	reversed to give override possibility (allocate more fb memory
+	than the kernel would) to 2.4 by tmb@iki.fi)
 
 Have fun!
 
diff -Nru a/Documentation/filesystems/ntfs.txt b/Documentation/filesystems/ntfs.txt
--- a/Documentation/filesystems/ntfs.txt	2004-06-02 23:26:59 -07:00
+++ b/Documentation/filesystems/ntfs.txt	2004-06-02 23:26:59 -07:00
@@ -273,6 +273,9 @@
 
 Note, a technical ChangeLog aimed at kernel hackers is in fs/ntfs/ChangeLog.
 
+2.1.12:
+	- Fix the second fix to the decompression engine from the 2.1.9 release
+	  and some further internals cleanups.
 2.1.11:
 	- Driver internal cleanups.
 2.1.10:
diff -Nru a/MAINTAINERS b/MAINTAINERS
--- a/MAINTAINERS	2004-06-02 23:26:59 -07:00
+++ b/MAINTAINERS	2004-06-02 23:26:59 -07:00
@@ -359,6 +359,8 @@
 M:	maxk@qualcomm.com
 L:	bluez-devel@lists.sf.net
 W:	http://bluez.sf.net
+W:	http://www.bluez.org
+W:	http://www.holtmann.org/linux/bluetooth/
 S:	Maintained
 
 BLUETOOTH RFCOMM LAYER
@@ -366,7 +368,6 @@
 M:	marcel@holtmann.org
 P:	Maxim Krasnyansky
 M:	maxk@qualcomm.com
-W:	http://bluez.sf.net
 S:	Maintained
 
 BLUETOOTH BNEP LAYER
@@ -374,71 +375,60 @@
 M:	marcel@holtmann.org
 P:	Maxim Krasnyansky
 M:	maxk@qualcomm.com
-W:	http://bluez.sf.net
 S:	Maintained
 
 BLUETOOTH CMTP LAYER
 P:	Marcel Holtmann
 M:	marcel@holtmann.org
-W:	http://www.holtmann.org/linux/bluetooth/
 S:	Maintained
 
-BLUETOOTH HCI USB DRIVER
+BLUETOOTH HCI UART DRIVER
 P:	Marcel Holtmann
 M:	marcel@holtmann.org
 P:	Maxim Krasnyansky
 M:	maxk@qualcomm.com
-W:	http://bluez.sf.net
 S:	Maintained
 
-BLUETOOTH HCI UART DRIVER
+BLUETOOTH HCI USB DRIVER
 P:	Marcel Holtmann
 M:	marcel@holtmann.org
 P:	Maxim Krasnyansky
 M:	maxk@qualcomm.com
-W:	http://bluez.sf.net
 S:	Maintained
 
 BLUETOOTH HCI BCM203X DRIVER
 P:	Marcel Holtmann
 M:	marcel@holtmann.org
-W:	http://www.holtmann.org/linux/bluetooth/
 S:	Maintained
 
 BLUETOOTH HCI BFUSB DRIVER
 P:	Marcel Holtmann
 M:	marcel@holtmann.org
-W:	http://www.holtmann.org/linux/bluetooth/
 S:	Maintained
 
 BLUETOOTH HCI DTL1 DRIVER
 P:	Marcel Holtmann
 M:	marcel@holtmann.org
-W:	http://www.holtmann.org/linux/bluetooth/
 S:	Maintained
 
 BLUETOOTH HCI BLUECARD DRIVER
 P:	Marcel Holtmann
 M:	marcel@holtmann.org
-W:	http://www.holtmann.org/linux/bluetooth/
 S:	Maintained
 
 BLUETOOTH HCI BT3C DRIVER
 P:	Marcel Holtmann
 M:	marcel@holtmann.org
-W:	http://www.holtmann.org/linux/bluetooth/
 S:	Maintained
 
 BLUETOOTH HCI BTUART DRIVER
 P:	Marcel Holtmann
 M:	marcel@holtmann.org
-W:	http://www.holtmann.org/linux/bluetooth/
 S:	Maintained
 
 BLUETOOTH HCI VHCI DRIVER
 P:	Maxim Krasnyansky
 M:	maxk@qualcomm.com
-W:	http://bluez.sf.net
 S:	Maintained
 
 BONDING DRIVER
diff -Nru a/Makefile b/Makefile
--- a/Makefile	2004-06-02 23:26:59 -07:00
+++ b/Makefile	2004-06-02 23:26:59 -07:00
@@ -904,6 +904,7 @@
 	@echo  '  rpm		  - Build a kernel as an RPM package'
 	@echo  '  tags/TAGS	  - Generate tags file for editors'
 	@echo  '  cscope	  - Generate cscope index'
+	@echo  '  checkstack      - Generate a list of stack hogs'
 	@echo  ''
 	@echo  'Documentation targets:'
 	@$(MAKE) -f $(srctree)/Documentation/DocBook/Makefile dochelp
diff -Nru a/arch/alpha/kernel/core_cia.c b/arch/alpha/kernel/core_cia.c
--- a/arch/alpha/kernel/core_cia.c	2004-06-02 23:26:59 -07:00
+++ b/arch/alpha/kernel/core_cia.c	2004-06-02 23:26:59 -07:00
@@ -762,7 +762,7 @@
 		*(vip)CIA_IOC_PCI_W3_MASK = 0xfff00000;
 		*(vip)CIA_IOC_PCI_T3_BASE = 0 >> 2;
 
-		alpha_mv.pci_dac_offset = 0x200000000;
+		alpha_mv.pci_dac_offset = 0x200000000UL;
 		*(vip)CIA_IOC_PCI_W_DAC = alpha_mv.pci_dac_offset >> 32;
 	}
 
diff -Nru a/arch/alpha/kernel/core_irongate.c b/arch/alpha/kernel/core_irongate.c
--- a/arch/alpha/kernel/core_irongate.c	2004-06-02 23:27:00 -07:00
+++ b/arch/alpha/kernel/core_irongate.c	2004-06-02 23:27:00 -07:00
@@ -287,9 +287,9 @@
 	hose->sparse_mem_base = 0;
 	hose->sparse_io_base = 0;
 	hose->dense_mem_base
-	  = (IRONGATE_MEM & 0xffffffffff) | 0x80000000000;
+	  = (IRONGATE_MEM & 0xffffffffffUL) | 0x80000000000UL;
 	hose->dense_io_base
-	  = (IRONGATE_IO & 0xffffffffff) | 0x80000000000;
+	  = (IRONGATE_IO & 0xffffffffffUL) | 0x80000000000UL;
 
 	hose->sg_isa = hose->sg_pci = NULL;
 	__direct_map_base = 0;
diff -Nru a/arch/alpha/kernel/core_marvel.c b/arch/alpha/kernel/core_marvel.c
--- a/arch/alpha/kernel/core_marvel.c	2004-06-02 23:26:58 -07:00
+++ b/arch/alpha/kernel/core_marvel.c	2004-06-02 23:26:58 -07:00
@@ -718,7 +718,7 @@
 	if (((long)addr >> 41) == -2)
 		return;	/* kseg map, nothing to do */
 	if (addr)
-		return vfree((void *)(PAGE_MASK & addr)); 
+		vfree((void *)(PAGE_MASK & addr)); 
 }
 
 #ifndef CONFIG_ALPHA_GENERIC
diff -Nru a/arch/alpha/kernel/core_titan.c b/arch/alpha/kernel/core_titan.c
--- a/arch/alpha/kernel/core_titan.c	2004-06-02 23:26:59 -07:00
+++ b/arch/alpha/kernel/core_titan.c	2004-06-02 23:26:59 -07:00
@@ -258,9 +258,9 @@
 	hose->sparse_mem_base = 0;
 	hose->sparse_io_base = 0;
 	hose->dense_mem_base
-	  = (TITAN_MEM(index) & 0xffffffffff) | 0x80000000000;
+	  = (TITAN_MEM(index) & 0xffffffffffUL) | 0x80000000000UL;
 	hose->dense_io_base
-	  = (TITAN_IO(index) & 0xffffffffff) | 0x80000000000;
+	  = (TITAN_IO(index) & 0xffffffffffUL) | 0x80000000000UL;
 
 	hose->config_space_base = TITAN_CONF(index);
 	hose->index = index;
diff -Nru a/arch/alpha/kernel/core_wildfire.c b/arch/alpha/kernel/core_wildfire.c
--- a/arch/alpha/kernel/core_wildfire.c	2004-06-02 23:26:58 -07:00
+++ b/arch/alpha/kernel/core_wildfire.c	2004-06-02 23:26:58 -07:00
@@ -285,8 +285,8 @@
 		    fe = WILDFIRE_fe(soft_qbb, i);
 
 		    if ((iop->iop_hose[i].init.csr & 1) == 1 &&
-			((ne->ne_what_am_i.csr & 0xf00000300) == 0x100000300) &&
-			((fe->fe_what_am_i.csr & 0xf00000300) == 0x100000200))
+			((ne->ne_what_am_i.csr & 0xf00000300UL) == 0x100000300UL) &&
+			((fe->fe_what_am_i.csr & 0xf00000300UL) == 0x100000200UL))
 		    {
 		        wildfire_pca_mask |= 1 << ((soft_qbb << 2) + i);
 		    }
diff -Nru a/arch/alpha/kernel/err_marvel.c b/arch/alpha/kernel/err_marvel.c
--- a/arch/alpha/kernel/err_marvel.c	2004-06-02 23:27:00 -07:00
+++ b/arch/alpha/kernel/err_marvel.c	2004-06-02 23:27:00 -07:00
@@ -1077,7 +1077,8 @@
 
 	default:
 		/* Don't know it - pass it up.  */
-		return ev7_machine_check(vector, la_ptr, regs);
+		ev7_machine_check(vector, la_ptr, regs);
+		return;
 	}	
 
 	/*
diff -Nru a/arch/alpha/kernel/err_titan.c b/arch/alpha/kernel/err_titan.c
--- a/arch/alpha/kernel/err_titan.c	2004-06-02 23:27:00 -07:00
+++ b/arch/alpha/kernel/err_titan.c	2004-06-02 23:27:00 -07:00
@@ -407,8 +407,10 @@
 	/*
 	 * Only handle system errors here 
 	 */
-	if ((vector != SCB_Q_SYSMCHK) && (vector != SCB_Q_SYSERR)) 
-		return ev6_machine_check(vector, la_ptr, regs);
+	if ((vector != SCB_Q_SYSMCHK) && (vector != SCB_Q_SYSERR)) {
+		ev6_machine_check(vector, la_ptr, regs);
+		return;
+	}
 
 	/* 
 	 * It's a system error, handle it here
diff -Nru a/arch/alpha/kernel/machvec_impl.h b/arch/alpha/kernel/machvec_impl.h
--- a/arch/alpha/kernel/machvec_impl.h	2004-06-02 23:27:00 -07:00
+++ b/arch/alpha/kernel/machvec_impl.h	2004-06-02 23:27:00 -07:00
@@ -20,10 +20,10 @@
 #define TITAN_HAE_ADDRESS	(&alpha_mv.hae_cache)
 #define WILDFIRE_HAE_ADDRESS	(&alpha_mv.hae_cache)
 
-#if CIA_ONE_HAE_WINDOW
+#ifdef CIA_ONE_HAE_WINDOW
 #define CIA_HAE_ADDRESS		(&alpha_mv.hae_cache)
 #endif
-#if MCPCIA_ONE_HAE_WINDOW
+#ifdef MCPCIA_ONE_HAE_WINDOW
 #define MCPCIA_HAE_ADDRESS	(&alpha_mv.hae_cache)
 #endif
 
diff -Nru a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
--- a/arch/alpha/kernel/osf_sys.c	2004-06-02 23:26:58 -07:00
+++ b/arch/alpha/kernel/osf_sys.c	2004-06-02 23:26:58 -07:00
@@ -91,7 +91,7 @@
  * braindamage (it can't really handle filesystems where the directory
  * offset differences aren't the same as "d_reclen").
  */
-#define NAME_OFFSET(de) ((int) ((de)->d_name - (char *) (de)))
+#define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de)))
 #define ROUND_UP(x) (((x)+3) & ~3)
 
 struct osf_dirent {
@@ -102,8 +102,8 @@
 };
 
 struct osf_dirent_callback {
-	struct osf_dirent *dirent;
-	long *basep;
+	struct osf_dirent __user *dirent;
+	long __user *basep;
 	unsigned int count;
 	int error;
 };
@@ -112,7 +112,7 @@
 osf_filldir(void *__buf, const char *name, int namlen, loff_t offset,
 	    ino_t ino, unsigned int d_type)
 {
-	struct osf_dirent *dirent;
+	struct osf_dirent __user *dirent;
 	struct osf_dirent_callback *buf = (struct osf_dirent_callback *) __buf;
 	unsigned int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1);
 
@@ -131,15 +131,15 @@
 	if (copy_to_user(dirent->d_name, name, namlen) ||
 	    put_user(0, dirent->d_name + namlen))
 		return -EFAULT;
-	dirent = (void *)dirent + reclen;
+	dirent = (void __user *)dirent + reclen;
 	buf->dirent = dirent;
 	buf->count -= reclen;
 	return 0;
 }
 
 asmlinkage int
-osf_getdirentries(unsigned int fd, struct osf_dirent *dirent,
-		  unsigned int count, long *basep)
+osf_getdirentries(unsigned int fd, struct osf_dirent __user *dirent,
+		  unsigned int count, long __user *basep)
 {
 	int error;
 	struct file *file;
@@ -215,10 +215,10 @@
 	int f_files;
 	int f_ffree;
 	__kernel_fsid_t f_fsid;
-} *osf_stat;
+};
 
 static int
-linux_to_osf_statfs(struct kstatfs *linux_stat, struct osf_statfs *osf_stat,
+linux_to_osf_statfs(struct kstatfs *linux_stat, struct osf_statfs __user *osf_stat,
 		    unsigned long bufsiz)
 {
 	struct osf_statfs tmp_stat;
@@ -239,7 +239,7 @@
 }
 
 static int
-do_osf_statfs(struct dentry * dentry, struct osf_statfs *buffer,
+do_osf_statfs(struct dentry * dentry, struct osf_statfs __user *buffer,
 	      unsigned long bufsiz)
 {
 	struct kstatfs linux_stat;
@@ -250,7 +250,7 @@
 }
 
 asmlinkage int
-osf_statfs(char *path, struct osf_statfs *buffer, unsigned long bufsiz)
+osf_statfs(char __user *path, struct osf_statfs __user *buffer, unsigned long bufsiz)
 {
 	struct nameidata nd;
 	int retval;
@@ -264,7 +264,7 @@
 }
 
 asmlinkage int
-osf_fstatfs(unsigned long fd, struct osf_statfs *buffer, unsigned long bufsiz)
+osf_fstatfs(unsigned long fd, struct osf_statfs __user *buffer, unsigned long bufsiz)
 {
 	struct file *file;
 	int retval;
@@ -284,13 +284,13 @@
  * Although to be frank, neither are the native Linux/i386 ones..
  */
 struct ufs_args {
-	char *devname;
+	char __user *devname;
 	int flags;
 	uid_t exroot;
 };
 
 struct cdfs_args {
-	char *devname;
+	char __user *devname;
 	int flags;
 	uid_t exroot;
 
@@ -299,7 +299,7 @@
 };
 
 struct procfs_args {
-	char *devname;
+	char __user *devname;
 	int flags;
 	uid_t exroot;
 };
@@ -313,7 +313,7 @@
  * unhappy with OSF UFS. [CHECKME]
  */
 static int
-osf_ufs_mount(char *dirname, struct ufs_args *args, int flags)
+osf_ufs_mount(char *dirname, struct ufs_args __user *args, int flags)
 {
 	int retval;
 	struct cdfs_args tmp;
@@ -333,7 +333,7 @@
 }
 
 static int
-osf_cdfs_mount(char *dirname, struct cdfs_args *args, int flags)
+osf_cdfs_mount(char *dirname, struct cdfs_args __user *args, int flags)
 {
 	int retval;
 	struct cdfs_args tmp;
@@ -353,7 +353,7 @@
 }
 
 static int
-osf_procfs_mount(char *dirname, struct procfs_args *args, int flags)
+osf_procfs_mount(char *dirname, struct procfs_args __user *args, int flags)
 {
 	struct procfs_args tmp;
 
@@ -364,7 +364,7 @@
 }
 
 asmlinkage int
-osf_mount(unsigned long typenr, char *path, int flag, void *data)
+osf_mount(unsigned long typenr, char __user *path, int flag, void __user *data)
 {
 	int retval = -EINVAL;
 	char *name;
@@ -377,13 +377,13 @@
 		goto out;
 	switch (typenr) {
 	case 1:
-		retval = osf_ufs_mount(name, (struct ufs_args *) data, flag);
+		retval = osf_ufs_mount(name, data, flag);
 		break;
 	case 6:
-		retval = osf_cdfs_mount(name, (struct cdfs_args *) data, flag);
+		retval = osf_cdfs_mount(name, data, flag);
 		break;
 	case 9:
-		retval = osf_procfs_mount(name, (struct procfs_args *) data, flag);
+		retval = osf_procfs_mount(name, data, flag);
 		break;
 	default:
 		printk("osf_mount(%ld, %x)\n", typenr, flag);
@@ -395,7 +395,7 @@
 }
 
 asmlinkage int
-osf_utsname(char *name)
+osf_utsname(char __user *name)
 {
 	int error;
 
@@ -434,7 +434,7 @@
  * For compatibility with OSF/1 only.  Use utsname(2) instead.
  */
 asmlinkage int
-osf_getdomainname(char *name, int namelen)
+osf_getdomainname(char __user *name, int namelen)
 {
 	unsigned len;
 	int i, error;
@@ -459,7 +459,7 @@
 }
 
 asmlinkage long
-osf_shmat(int shmid, void *shmaddr, int shmflg)
+osf_shmat(int shmid, void __user *shmaddr, int shmflg)
 {
 	unsigned long raddr;
 	long err;
@@ -497,39 +497,39 @@
 
 union pl_args {
 	struct setargs {
-		char *path;
+		char __user *path;
 		long follow;
 		long nbytes;
-		char *buf;
+		char __user *buf;
 	} set;
 	struct fsetargs {
 		long fd;
 		long nbytes;
-		char *buf;
+		char __user *buf;
 	} fset;
 	struct getargs {
-		char *path;
+		char __user *path;
 		long follow;
-		struct proplistname_args *name_args;
+		struct proplistname_args __user *name_args;
 		long nbytes;
-		char *buf;
-		int *min_buf_size;
+		char __user *buf;
+		int __user *min_buf_size;
 	} get;
 	struct fgetargs {
 		long fd;
-		struct proplistname_args *name_args;
+		struct proplistname_args __user *name_args;
 		long nbytes;
-		char *buf;
-		int *min_buf_size;
+		char __user *buf;
+		int __user *min_buf_size;
 	} fget;
 	struct delargs {
-		char *path;
+		char __user *path;
 		long follow;
-		struct proplistname_args *name_args;
+		struct proplistname_args __user *name_args;
 	} del;
 	struct fdelargs {
 		long fd;
-		struct proplistname_args *name_args;
+		struct proplistname_args __user *name_args;
 	} fdel;
 };
 
@@ -540,24 +540,20 @@
 };
 
 asmlinkage long
-osf_proplist_syscall(enum pl_code code, union pl_args *args)
+osf_proplist_syscall(enum pl_code code, union pl_args __user *args)
 {
 	long error;
-	int *min_buf_size_ptr;
+	int __user *min_buf_size_ptr;
 
 	lock_kernel();
 	switch (code) {
 	case PL_SET:
-		error = verify_area(VERIFY_READ, &args->set.nbytes,
-				    sizeof(args->set.nbytes));
-		if (!error)
-			error = args->set.nbytes;
+		if (get_user(error, &args->set.nbytes))
+			error = -EFAULT;
 		break;
 	case PL_FSET:
-		error = verify_area(VERIFY_READ, &args->fset.nbytes,
-				    sizeof(args->fset.nbytes));
-		if (!error)
-			error = args->fset.nbytes;
+		if (get_user(error, &args->fset.nbytes))
+			error = -EFAULT;
 		break;
 	case PL_GET:
 		error = get_user(min_buf_size_ptr, &args->get.min_buf_size);
@@ -584,7 +580,7 @@
 }
 
 asmlinkage int
-osf_sigstack(struct sigstack *uss, struct sigstack *uoss)
+osf_sigstack(struct sigstack __user *uss, struct sigstack __user *uoss)
 {
 	unsigned long usp = rdusp();
 	unsigned long oss_sp = current->sas_ss_sp + current->sas_ss_size;
@@ -625,7 +621,7 @@
 }
 
 asmlinkage long
-osf_sysinfo(int command, char *buf, long count)
+osf_sysinfo(int command, char __user *buf, long count)
 {
 	static char * sysinfo_table[] = {
 		system_utsname.sysname,
@@ -664,8 +660,8 @@
 }
 
 asmlinkage unsigned long
-osf_getsysinfo(unsigned long op, void *buffer, unsigned long nbytes,
-	       int *start, void *arg)
+osf_getsysinfo(unsigned long op, void __user *buffer, unsigned long nbytes,
+	       int __user *start, void __user *arg)
 {
 	unsigned long w;
 	struct percpu_struct *cpu;
@@ -677,7 +673,7 @@
 
  		w = current_thread_info()->ieee_state & IEEE_SW_MASK;
  		w = swcr_update_status(w, rdfpcr());
-		if (put_user(w, (unsigned long *) buffer))
+		if (put_user(w, (unsigned long __user *) buffer))
 			return -EFAULT;
 		return 0;
 
@@ -693,7 +689,7 @@
 		if (nbytes < sizeof(unsigned int))
 			return -EINVAL;
  		w = (current_thread_info()->flags >> UAC_SHIFT) & UAC_BITMASK;
- 		if (put_user(w, (unsigned int *)buffer))
+ 		if (put_user(w, (unsigned int __user *)buffer))
  			return -EFAULT;
  		return 1;
 
@@ -703,7 +699,7 @@
 		cpu = (struct percpu_struct*)
 		  ((char*)hwrpb + hwrpb->processor_offset);
 		w = cpu->type;
-		if (put_user(w, (unsigned long *)buffer))
+		if (put_user(w, (unsigned long  __user*)buffer))
 			return -EFAULT;
 		return 1;
 
@@ -722,8 +718,8 @@
 }
 
 asmlinkage unsigned long
-osf_setsysinfo(unsigned long op, void *buffer, unsigned long nbytes,
-	       int *start, void *arg)
+osf_setsysinfo(unsigned long op, void __user *buffer, unsigned long nbytes,
+	       int __user *start, void __user *arg)
 {
 	switch (op) {
 	case SSI_IEEE_FP_CONTROL: {
@@ -737,7 +733,7 @@
 		 */
 
 		/* Update softare trap enable bits.  */
-		if (get_user(swcr, (unsigned long *)buffer))
+		if (get_user(swcr, (unsigned long __user *)buffer))
 			return -EFAULT;
 		current_thread_info()->ieee_state
 		  = ((current_thread_info()->ieee_state & ~IEEE_SW_MASK)
@@ -788,9 +784,9 @@
 		
  		for (i = 0; i < nbytes; ++i) {
 
- 			if (get_user(v, 2*i + (unsigned int *)buffer))
+ 			if (get_user(v, 2*i + (unsigned int __user *)buffer))
  				return -EFAULT;
- 			if (get_user(w, 2*i + 1 + (unsigned int *)buffer))
+ 			if (get_user(w, 2*i + 1 + (unsigned int __user *)buffer))
  				return -EFAULT;
  			switch (v) {
  			case SSIN_UACPROC:
@@ -835,7 +831,7 @@
 };
 
 static inline long
-get_tv32(struct timeval *o, struct timeval32 *i)
+get_tv32(struct timeval *o, struct timeval32 __user *i)
 {
 	return (!access_ok(VERIFY_READ, i, sizeof(*i)) ||
 		(__get_user(o->tv_sec, &i->tv_sec) |
@@ -843,7 +839,7 @@
 }
 
 static inline long
-put_tv32(struct timeval32 *o, struct timeval *i)
+put_tv32(struct timeval32 __user *o, struct timeval *i)
 {
 	return (!access_ok(VERIFY_WRITE, o, sizeof(*o)) ||
 		(__put_user(i->tv_sec, &o->tv_sec) |
@@ -851,7 +847,7 @@
 }
 
 static inline long
-get_it32(struct itimerval *o, struct itimerval32 *i)
+get_it32(struct itimerval *o, struct itimerval32 __user *i)
 {
 	return (!access_ok(VERIFY_READ, i, sizeof(*i)) ||
 		(__get_user(o->it_interval.tv_sec, &i->it_interval.tv_sec) |
@@ -861,7 +857,7 @@
 }
 
 static inline long
-put_it32(struct itimerval32 *o, struct itimerval *i)
+put_it32(struct itimerval32 __user *o, struct itimerval *i)
 {
 	return (!access_ok(VERIFY_WRITE, o, sizeof(*o)) ||
 		(__put_user(i->it_interval.tv_sec, &o->it_interval.tv_sec) |
@@ -878,7 +874,7 @@
 }
 
 asmlinkage int
-osf_gettimeofday(struct timeval32 *tv, struct timezone *tz)
+osf_gettimeofday(struct timeval32 __user *tv, struct timezone __user *tz)
 {
 	if (tv) {
 		struct timeval ktv;
@@ -894,7 +890,7 @@
 }
 
 asmlinkage int
-osf_settimeofday(struct timeval32 *tv, struct timezone *tz)
+osf_settimeofday(struct timeval32 __user *tv, struct timezone __user *tz)
 {
 	struct timespec kts;
 	struct timezone ktz;
@@ -914,7 +910,7 @@
 }
 
 asmlinkage int
-osf_getitimer(int which, struct itimerval32 *it)
+osf_getitimer(int which, struct itimerval32 __user *it)
 {
 	struct itimerval kit;
 	int error;
@@ -927,7 +923,7 @@
 }
 
 asmlinkage int
-osf_setitimer(int which, struct itimerval32 *in, struct itimerval32 *out)
+osf_setitimer(int which, struct itimerval32 __user *in, struct itimerval32 __user *out)
 {
 	struct itimerval kin, kout;
 	int error;
@@ -950,16 +946,9 @@
 }
 
 asmlinkage int
-osf_utimes(const char *filename, struct timeval32 *tvs)
+osf_utimes(char __user *filename, struct timeval32 __user *tvs)
 {
-	char *kfilename;
 	struct timeval ktvs[2];
-	mm_segment_t old_fs;
-	int ret;
-
-	kfilename = getname(filename);
-	if (IS_ERR(kfilename))
-		return PTR_ERR(kfilename);
 
 	if (tvs) {
 		if (get_tv32(&ktvs[0], &tvs[0]) ||
@@ -967,22 +956,15 @@
 			return -EFAULT;
 	}
 
-	old_fs = get_fs();
-	set_fs(KERNEL_DS);
-	ret = sys_utimes(kfilename, tvs ? ktvs : 0);
-	set_fs(old_fs);
-
-	putname(kfilename);
-
-	return ret;
+	return do_utimes(filename, tvs ? ktvs : 0);
 }
 
 #define MAX_SELECT_SECONDS \
 	((unsigned long) (MAX_SCHEDULE_TIMEOUT / HZ)-1)
 
 asmlinkage int
-osf_select(int n, fd_set *inp, fd_set *outp, fd_set *exp,
-	   struct timeval32 *tvp)
+osf_select(int n, fd_set __user *inp, fd_set __user *outp, fd_set __user *exp,
+	   struct timeval32 __user *tvp)
 {
 	fd_set_bits fds;
 	char *bits;
@@ -1081,7 +1063,7 @@
 };
 
 asmlinkage int
-osf_getrusage(int who, struct rusage32 *ru)
+osf_getrusage(int who, struct rusage32 __user *ru)
 {
 	struct rusage32 r;
 
@@ -1116,7 +1098,7 @@
 }
 
 asmlinkage int
-osf_wait4(pid_t pid, int *ustatus, int options, struct rusage32 *ur)
+osf_wait4(pid_t pid, int __user *ustatus, int options, struct rusage32 __user *ur)
 {
 	if (!ur) {
 		return sys_wait4(pid, ustatus, options, NULL);
@@ -1163,7 +1145,7 @@
  * one is the time remaining.. Ho humm.. No documentation.
  */
 asmlinkage int
-osf_usleep_thread(struct timeval32 *sleep, struct timeval32 *remain)
+osf_usleep_thread(struct timeval32 __user *sleep, struct timeval32 __user *remain)
 {
 	struct timeval tmp;
 	unsigned long ticks;
@@ -1221,7 +1203,7 @@
 };
 
 asmlinkage int
-sys_old_adjtimex(struct timex32 *txc_p)
+sys_old_adjtimex(struct timex32 __user *txc_p)
 {
         struct timex txc;
 	int ret;
@@ -1316,12 +1298,12 @@
    compatibility with old versions of OSF/1 where iov_len
    was defined as int. */
 static int
-osf_fix_iov_len(const struct iovec *iov, unsigned long count)
+osf_fix_iov_len(const struct iovec __user *iov, unsigned long count)
 {
 	unsigned long i;
 
 	for (i = 0 ; i < count ; i++) {
-		int *iov_len_high = (int *)&iov[i].iov_len + 1;
+		int *iov_len_high = (int __user *)&iov[i].iov_len + 1;
 
 		if (put_user(0, iov_len_high))
 			return -EFAULT;
@@ -1330,7 +1312,7 @@
 }
 
 asmlinkage ssize_t
-osf_readv(unsigned long fd, const struct iovec * vector, unsigned long count)
+osf_readv(unsigned long fd, const struct iovec __user * vector, unsigned long count)
 {
 	if (unlikely(personality(current->personality) == PER_OSF4))
 		if (osf_fix_iov_len(vector, count))
@@ -1339,7 +1321,7 @@
 }
 
 asmlinkage ssize_t
-osf_writev(unsigned long fd, const struct iovec * vector, unsigned long count)
+osf_writev(unsigned long fd, const struct iovec __user * vector, unsigned long count)
 {
 	if (unlikely(personality(current->personality) == PER_OSF4))
 		if (osf_fix_iov_len(vector, count))
diff -Nru a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c
--- a/arch/alpha/kernel/process.c	2004-06-02 23:27:00 -07:00
+++ b/arch/alpha/kernel/process.c	2004-06-02 23:27:00 -07:00
@@ -239,8 +239,9 @@
  * with parameters (SIGCHLD, 0).
  */
 int
-alpha_clone(unsigned long clone_flags, unsigned long usp, int *parent_tid,
-	    int *child_tid, unsigned long tls_value, struct pt_regs *regs)
+alpha_clone(unsigned long clone_flags, unsigned long usp,
+	    int __user *parent_tid, int __user *child_tid,
+	    unsigned long tls_value, struct pt_regs *regs)
 {
 	if (!usp)
 		usp = rdusp();
@@ -464,7 +465,8 @@
  * Don't do this at home.
  */
 asmlinkage int
-sys_execve(char *ufilename, char **argv, char **envp,
+sys_execve(char __user *ufilename, char __user * __user *argv,
+	   char __user * __user *envp,
 	   unsigned long a3, unsigned long a4, unsigned long a5,
 	   struct pt_regs regs)
 {
diff -Nru a/arch/alpha/kernel/semaphore.c b/arch/alpha/kernel/semaphore.c
--- a/arch/alpha/kernel/semaphore.c	2004-06-02 23:26:59 -07:00
+++ b/arch/alpha/kernel/semaphore.c	2004-06-02 23:26:59 -07:00
@@ -163,7 +163,7 @@
 void __sched
 down(struct semaphore *sem)
 {
-#if WAITQUEUE_DEBUG
+#ifdef WAITQUEUE_DEBUG
 	CHECK_MAGIC(sem->__magic);
 #endif
 #ifdef CONFIG_DEBUG_SEMAPHORE
@@ -177,7 +177,7 @@
 int __sched
 down_interruptible(struct semaphore *sem)
 {
-#if WAITQUEUE_DEBUG
+#ifdef WAITQUEUE_DEBUG
 	CHECK_MAGIC(sem->__magic);
 #endif
 #ifdef CONFIG_DEBUG_SEMAPHORE
@@ -193,7 +193,7 @@
 {
 	int ret;
 
-#if WAITQUEUE_DEBUG
+#ifdef WAITQUEUE_DEBUG
 	CHECK_MAGIC(sem->__magic);
 #endif
 
@@ -212,7 +212,7 @@
 void
 up(struct semaphore *sem)
 {
-#if WAITQUEUE_DEBUG
+#ifdef WAITQUEUE_DEBUG
 	CHECK_MAGIC(sem->__magic);
 #endif
 #ifdef CONFIG_DEBUG_SEMAPHORE
diff -Nru a/arch/alpha/kernel/setup.c b/arch/alpha/kernel/setup.c
--- a/arch/alpha/kernel/setup.c	2004-06-02 23:26:58 -07:00
+++ b/arch/alpha/kernel/setup.c	2004-06-02 23:26:58 -07:00
@@ -1359,7 +1359,7 @@
 		L1I = L1D = CSHAPE(8*1024, 5, 1);
 		L3 = -1;
 
-		car = *(vuip) phys_to_virt (0x120000078);
+		car = *(vuip) phys_to_virt (0x120000078UL);
 		size = 64*1024 * (1 << ((car >> 5) & 7));
 		/* No typo -- 8 byte cacheline size.  Whodathunk.  */
 		L2 = (car & 1 ? CSHAPE (size, 3, 1) : -1);
@@ -1374,7 +1374,7 @@
 		L1I = L1D = CSHAPE(8*1024, 5, 1);
 
 		/* Check the line size of the Scache.  */
-		sc_ctl = *(vulp) phys_to_virt (0xfffff000a8);
+		sc_ctl = *(vulp) phys_to_virt (0xfffff000a8UL);
 		width = sc_ctl & 0x1000 ? 6 : 5;
 		L2 = CSHAPE (96*1024, width, 3);
 
@@ -1406,7 +1406,7 @@
 		}
 		L3 = -1;
 
-		cbox_config = *(vulp) phys_to_virt (0xfffff00008);
+		cbox_config = *(vulp) phys_to_virt (0xfffff00008UL);
 		size = 512*1024 * (1 << ((cbox_config >> 12) & 3));
 
 #if 0
diff -Nru a/arch/alpha/kernel/signal.c b/arch/alpha/kernel/signal.c
--- a/arch/alpha/kernel/signal.c	2004-06-02 23:26:59 -07:00
+++ b/arch/alpha/kernel/signal.c	2004-06-02 23:26:59 -07:00
@@ -84,8 +84,8 @@
 }
 
 asmlinkage int 
-osf_sigaction(int sig, const struct osf_sigaction *act,
-	      struct osf_sigaction *oact)
+osf_sigaction(int sig, const struct osf_sigaction __user *act,
+	      struct osf_sigaction __user *oact)
 {
 	struct k_sigaction new_ka, old_ka;
 	int ret;
@@ -115,8 +115,9 @@
 }
 
 asmlinkage long
-sys_rt_sigaction(int sig, const struct sigaction *act, struct sigaction *oact,
-		 size_t sigsetsize, void *restorer)
+sys_rt_sigaction(int sig, const struct sigaction __user *act,
+		 struct sigaction __user *oact,
+		 size_t sigsetsize, void __user *restorer)
 {
 	struct k_sigaction new_ka, old_ka;
 	int ret;
@@ -165,7 +166,7 @@
 }
 
 asmlinkage int
-do_rt_sigsuspend(sigset_t *uset, size_t sigsetsize,
+do_rt_sigsuspend(sigset_t __user *uset, size_t sigsetsize,
 		 struct pt_regs *reg, struct switch_stack *sw)
 {
 	sigset_t oldset, set;
@@ -192,7 +193,7 @@
 }
 
 asmlinkage int
-sys_sigaltstack(const stack_t *uss, stack_t *uoss)
+sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss)
 {
 	return do_sigaltstack(uss, uoss, rdusp());
 }
@@ -223,7 +224,7 @@
 #define INSN_CALLSYS		0x00000083
 
 static long
-restore_sigcontext(struct sigcontext *sc, struct pt_regs *regs,
+restore_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,
 		   struct switch_stack *sw)
 {
 	unsigned long usp;
@@ -276,7 +277,7 @@
    registers and transfer control from userland.  */
 
 asmlinkage void
-do_sigreturn(struct sigcontext *sc, struct pt_regs *regs,
+do_sigreturn(struct sigcontext __user *sc, struct pt_regs *regs,
 	     struct switch_stack *sw)
 {
 	sigset_t set;
@@ -314,7 +315,7 @@
 }
 
 asmlinkage void
-do_rt_sigreturn(struct rt_sigframe *frame, struct pt_regs *regs,
+do_rt_sigreturn(struct rt_sigframe __user *frame, struct pt_regs *regs,
 		struct switch_stack *sw)
 {
 	sigset_t set;
@@ -356,17 +357,17 @@
  * Set up a signal frame.
  */
 
-static inline void *
+static inline void __user *
 get_sigframe(struct k_sigaction *ka, unsigned long sp, size_t frame_size)
 {
 	if ((ka->sa.sa_flags & SA_ONSTACK) != 0 && ! on_sig_stack(sp))
 		sp = current->sas_ss_sp + current->sas_ss_size;
 
-	return (void *)((sp - frame_size) & -32ul);
+	return (void __user *)((sp - frame_size) & -32ul);
 }
 
 static long
-setup_sigcontext(struct sigcontext *sc, struct pt_regs *regs, 
+setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs, 
 		 struct switch_stack *sw, unsigned long mask, unsigned long sp)
 {
 	long i, err = 0;
@@ -426,7 +427,7 @@
 	    struct pt_regs *regs, struct switch_stack * sw)
 {
 	unsigned long oldsp, r26, err = 0;
-	struct sigframe *frame;
+	struct sigframe __user *frame;
 
 	oldsp = rdusp();
 	frame = get_sigframe(ka, oldsp, sizeof(*frame));
@@ -479,7 +480,7 @@
 	       sigset_t *set, struct pt_regs *regs, struct switch_stack * sw)
 {
 	unsigned long oldsp, r26, err = 0;
-	struct rt_sigframe *frame;
+	struct rt_sigframe __user *frame;
 
 	oldsp = rdusp();
 	frame = get_sigframe(ka, oldsp, sizeof(*frame));
diff -Nru a/arch/alpha/kernel/smp.c b/arch/alpha/kernel/smp.c
--- a/arch/alpha/kernel/smp.c	2004-06-02 23:26:59 -07:00
+++ b/arch/alpha/kernel/smp.c	2004-06-02 23:26:59 -07:00
@@ -779,7 +779,7 @@
 void
 smp_send_reschedule(int cpu)
 {
-#if DEBUG_IPI_MSG
+#ifdef DEBUG_IPI_MSG
 	if (cpu == hard_smp_processor_id())
 		printk(KERN_WARNING
 		       "smp_send_reschedule: Sending IPI to self.\n");
@@ -791,7 +791,7 @@
 smp_send_stop(void)
 {
 	unsigned long to_whom = cpu_present_mask & ~(1UL << smp_processor_id());
-#if DEBUG_IPI_MSG
+#ifdef DEBUG_IPI_MSG
 	if (hard_smp_processor_id() != boot_cpu_id)
 		printk(KERN_WARNING "smp_send_stop: Not on boot cpu.\n");
 #endif
diff -Nru a/arch/alpha/kernel/sys_sx164.c b/arch/alpha/kernel/sys_sx164.c
--- a/arch/alpha/kernel/sys_sx164.c	2004-06-02 23:26:59 -07:00
+++ b/arch/alpha/kernel/sys_sx164.c	2004-06-02 23:26:59 -07:00
@@ -51,7 +51,7 @@
 	if (alpha_using_srm)
 		init_srm_irqs(40, 0x3f0000);
 	else
-		init_pyxis_irqs(0xff00003f0000);
+		init_pyxis_irqs(0xff00003f0000UL);
 
 	setup_irq(16+6, &timer_cascade_irqaction);
 }
diff -Nru a/arch/alpha/lib/csum_partial_copy.c b/arch/alpha/lib/csum_partial_copy.c
--- a/arch/alpha/lib/csum_partial_copy.c	2004-06-02 23:26:59 -07:00
+++ b/arch/alpha/lib/csum_partial_copy.c	2004-06-02 23:26:59 -07:00
@@ -99,7 +99,7 @@
  * Ok. This isn't fun, but this is the EASY case.
  */
 static inline unsigned long
-csum_partial_cfu_aligned(const unsigned long *src, unsigned long *dst,
+csum_partial_cfu_aligned(const unsigned long __user *src, unsigned long *dst,
 			 long len, unsigned long checksum,
 			 int *errp)
 {
@@ -139,7 +139,8 @@
  * easy.
  */
 static inline unsigned long
-csum_partial_cfu_dest_aligned(const unsigned long *src, unsigned long *dst,
+csum_partial_cfu_dest_aligned(const unsigned long __user *src,
+			      unsigned long *dst,
 			      unsigned long soff,
 			      long len, unsigned long checksum,
 			      int *errp)
@@ -327,7 +328,7 @@
 }
 
 static unsigned int
-do_csum_partial_copy_from_user(const char *src, char *dst, int len,
+do_csum_partial_copy_from_user(const char __user *src, char *dst, int len,
 			       unsigned int sum, int *errp)
 {
 	unsigned long checksum = (unsigned) sum;
@@ -338,12 +339,12 @@
 		if (!doff) {
 			if (!soff)
 				checksum = csum_partial_cfu_aligned(
-					(const unsigned long *) src,
+					(const unsigned long __user *) src,
 					(unsigned long *) dst,
 					len-8, checksum, errp);
 			else
 				checksum = csum_partial_cfu_dest_aligned(
-					(const unsigned long *) src,
+					(const unsigned long __user *) src,
 					(unsigned long *) dst,
 					soff, len-8, checksum, errp);
 		} else {
@@ -351,13 +352,13 @@
 			ldq_u(partial_dest, dst);
 			if (!soff)
 				checksum = csum_partial_cfu_src_aligned(
-					(const unsigned long *) src,
+					(const unsigned long __user *) src,
 					(unsigned long *) dst,
 					doff, len-8, checksum,
 					partial_dest, errp);
 			else
 				checksum = csum_partial_cfu_unaligned(
-					(const unsigned long *) src,
+					(const unsigned long __user *) src,
 					(unsigned long *) dst,
 					soff, doff, len-8, checksum,
 					partial_dest, errp);
@@ -368,7 +369,7 @@
 }
 
 unsigned int
-csum_partial_copy_from_user(const char *src, char *dst, int len,
+csum_partial_copy_from_user(const char __user *src, char *dst, int len,
 			    unsigned int sum, int *errp)
 {
 	if (!access_ok(src, len, VERIFY_READ)) {
diff -Nru a/arch/alpha/math-emu/math.c b/arch/alpha/math-emu/math.c
--- a/arch/alpha/math-emu/math.c	2004-06-02 23:27:00 -07:00
+++ b/arch/alpha/math-emu/math.c	2004-06-02 23:27:00 -07:00
@@ -106,7 +106,7 @@
 	__u32 insn;
 	long si_code;
 
-	get_user(insn, (__u32*)pc);
+	get_user(insn, (__u32 __user *)pc);
 	fc     = (insn >>  0) & 0x1f;	/* destination register */
 	fb     = (insn >> 16) & 0x1f;
 	fa     = (insn >> 21) & 0x1f;
@@ -171,7 +171,7 @@
 					_FP_FRAC_SET_1(DB, _FP_ZEROFRAC_1);
 			}
 			FP_CMP_D(res, DA, DB, 3);
-			vc = 0x4000000000000000;
+			vc = 0x4000000000000000UL;
 			/* CMPTEQ, CMPTUN don't trap on QNaN,
 			   while CMPTLT and CMPTLE do */
 			if (res == 3
@@ -351,7 +351,7 @@
 	 * up to the first occurrence of such an instruction.
 	 */
 	while (write_mask) {
-		get_user(insn, (__u32*)(trigger_pc));
+		get_user(insn, (__u32 __user *)(trigger_pc));
 		opcode = insn >> 26;
 		rc = insn & 0x1f;
 
diff -Nru a/arch/alpha/mm/fault.c b/arch/alpha/mm/fault.c
--- a/arch/alpha/mm/fault.c	2004-06-02 23:26:59 -07:00
+++ b/arch/alpha/mm/fault.c	2004-06-02 23:26:59 -07:00
@@ -40,7 +40,7 @@
 unsigned long last_asn = ASN_FIRST_VERSION;
 #endif
 
-extern void
+void
 __load_new_mm_context(struct mm_struct *next_mm)
 {
 	unsigned long mmc;
diff -Nru a/arch/alpha/mm/init.c b/arch/alpha/mm/init.c
--- a/arch/alpha/mm/init.c	2004-06-02 23:27:00 -07:00
+++ b/arch/alpha/mm/init.c	2004-06-02 23:27:00 -07:00
@@ -152,9 +152,9 @@
 
 	/* Set the vptb.  This is often done by the bootloader, but 
 	   shouldn't be required.  */
-	if (hwrpb->vptb != 0xfffffffe00000000) {
-		wrvptptr(0xfffffffe00000000);
-		hwrpb->vptb = 0xfffffffe00000000;
+	if (hwrpb->vptb != 0xfffffffe00000000UL) {
+		wrvptptr(0xfffffffe00000000UL);
+		hwrpb->vptb = 0xfffffffe00000000UL;
 		hwrpb_update_checksum(hwrpb);
 	}
 
@@ -301,8 +301,8 @@
 	/* Move the vptb back to where the SRM console expects it.  */
 	swapper_pg_dir[1] = swapper_pg_dir[1023];
 	tbia();
-	wrvptptr(0x200000000);
-	hwrpb->vptb = 0x200000000;
+	wrvptptr(0x200000000UL);
+	hwrpb->vptb = 0x200000000UL;
 	hwrpb_update_checksum(hwrpb);
 
 	/* Reload the page tables that the console had in use.  */
diff -Nru a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c
--- a/arch/arm/kernel/irq.c	2004-06-02 23:26:58 -07:00
+++ b/arch/arm/kernel/irq.c	2004-06-02 23:26:58 -07:00
@@ -447,7 +447,7 @@
  * come via this function.  Instead, they should provide their
  * own 'handler'
  */
-asmlinkage void asm_do_IRQ(int irq, struct pt_regs *regs)
+asmlinkage void asm_do_IRQ(unsigned int irq, struct pt_regs *regs)
 {
 	struct irqdesc *desc = irq_desc + irq;
 
diff -Nru a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c
--- a/arch/arm/kernel/ptrace.c	2004-06-02 23:26:58 -07:00
+++ b/arch/arm/kernel/ptrace.c	2004-06-02 23:26:58 -07:00
@@ -622,7 +622,7 @@
 			ret = access_process_vm(child, addr, &tmp,
 						sizeof(unsigned long), 0);
 			if (ret == sizeof(unsigned long))
-				ret = put_user(tmp, (unsigned long *) data);
+				ret = put_user(tmp, (unsigned long __user *) data);
 			else
 				ret = -EIO;
 			break;
diff -Nru a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c
--- a/arch/arm/kernel/signal.c	2004-06-02 23:26:58 -07:00
+++ b/arch/arm/kernel/signal.c	2004-06-02 23:26:58 -07:00
@@ -564,10 +564,10 @@
 				regs->ARM_r7 = __NR_restart_syscall;
 				regs->ARM_pc -= 2;
 			} else {
-				u32 *usp;
+				u32 __user *usp;
 
 				regs->ARM_sp -= 12;
-				usp = (u32 *)regs->ARM_sp;
+				usp = (u32 __user *)regs->ARM_sp;
 
 				put_user(regs->ARM_pc, &usp[0]);
 				/* swi __NR_restart_syscall */
diff -Nru a/arch/arm/mach-clps711x/clep7312.c b/arch/arm/mach-clps711x/clep7312.c
--- a/arch/arm/mach-clps711x/clep7312.c	2004-06-02 23:26:59 -07:00
+++ b/arch/arm/mach-clps711x/clep7312.c	2004-06-02 23:26:59 -07:00
@@ -31,7 +31,6 @@
 	    char **cmdline, struct meminfo *mi)
 {
 	mi->nr_banks=1;
-	mi->end = 0xc0FFFFFF;
 	mi->bank[0].start = 0xc0000000;
 	mi->bank[0].size = 0x01000000;
 	mi->bank[0].node = 0;
diff -Nru a/arch/arm/mach-clps711x/fortunet.c b/arch/arm/mach-clps711x/fortunet.c
--- a/arch/arm/mach-clps711x/fortunet.c	2004-06-02 23:26:59 -07:00
+++ b/arch/arm/mach-clps711x/fortunet.c	2004-06-02 23:26:59 -07:00
@@ -34,7 +34,16 @@
 extern void clps711x_map_io(void);
 extern void clps711x_init_irq(void);
 
-struct meminfo memmap = { 1, 0xC1000000, {{0xC0000000,0x01000000,0}}};
+struct meminfo memmap = {
+	.nr_banks	= 1,
+	.bank		= {
+		{
+			.start	= 0xC0000000,
+			.size	= 0x01000000,
+			.node	= 0
+		},
+	},
+};
 
 typedef struct tag_IMAGE_PARAMS
 {
@@ -53,9 +62,8 @@
 fortunet_fixup(struct machine_desc *desc, struct tag *tags,
 		 char **cmdline, struct meminfo *mi)
 {
-	IMAGE_PARAMS *ip;
-	ip = (IMAGE_PARAMS *)__phys_to_virt(IMAGE_PARAMS_PHYS);
-	*cmdline = (char *)__phys_to_virt(ip->command_line);
+	IMAGE_PARAMS *ip = phys_to_virt(IMAGE_PARAMS_PHYS);
+	*cmdline = phys_to_virt(ip->command_line);
 #ifdef CONFIG_BLK_DEV_INITRD
 	if(ip->ramdisk_ok)
 	{
@@ -64,7 +72,6 @@
 	}
 #endif
 	memmap.bank[0].size = ip->ram_size;
-	memmap.end = ip->ram_size+0xC0000000;
 	*mi = memmap;
 }
 
diff -Nru a/arch/arm/mach-integrator/core.c b/arch/arm/mach-integrator/core.c
--- a/arch/arm/mach-integrator/core.c	2004-06-02 23:27:00 -07:00
+++ b/arch/arm/mach-integrator/core.c	2004-06-02 23:27:00 -07:00
@@ -108,7 +108,7 @@
 
 #define CM_CTRL	IO_ADDRESS(INTEGRATOR_HDR_BASE) + INTEGRATOR_HDR_CTRL_OFFSET
 
-static spinlock_t cm_lock;
+static spinlock_t cm_lock = SPIN_LOCK_UNLOCKED;
 
 /**
  * cm_control - update the CM_CTRL register.
diff -Nru a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c
--- a/arch/arm/mach-pxa/pxa25x.c	2004-06-02 23:27:00 -07:00
+++ b/arch/arm/mach-pxa/pxa25x.c	2004-06-02 23:27:00 -07:00
@@ -83,12 +83,21 @@
 EXPORT_SYMBOL(get_clk_frequency_khz);
 
 /*
- * Return the current lclk requency in units of 10kHz
+ * Return the current memory clock frequency in units of 10kHz
  */
-unsigned int get_lclk_frequency_10khz(void)
+unsigned int get_memclk_frequency_10khz(void)
 {
 	return L_clk_mult[(CCCR >> 0) & 0x1f] * BASE_CLK / 10000;
 }
 
-EXPORT_SYMBOL(get_lclk_frequency_10khz);
+EXPORT_SYMBOL(get_memclk_frequency_10khz);
 
+/*
+ * Return the current LCD clock frequency in units of 10kHz
+ */
+unsigned int get_lcdclk_frequency_10khz(void)
+{
+	return get_memclk_frequency_10khz();
+}
+
+EXPORT_SYMBOL(get_lcdclk_frequency_10khz);
diff -Nru a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c
--- a/arch/arm/mach-pxa/pxa27x.c	2004-06-02 23:26:59 -07:00
+++ b/arch/arm/mach-pxa/pxa27x.c	2004-06-02 23:26:59 -07:00
@@ -21,100 +21,98 @@
 
 #include "generic.h"
 
-/* Crystal clock : 13-MHZ*/
+/* Crystal clock: 13MHz */
 #define BASE_CLK	13000000
 
 /*
  * Get the clock frequency as reflected by CCSR and the turbo flag.
  * We assume these values have been applied via a fcs.
  * If info is not 0 we also display the current settings.
- *
- * For more details, refer to Bulverde Manual, section 3.8.2.1
  */
 unsigned int get_clk_frequency_khz( int info)
 {
-	unsigned long ccsr, turbo, b, ht;
-	unsigned int l, L, m, M, n2, N, S, cccra;
+	unsigned long ccsr, clkcfg;
+	unsigned int l, L, m, M, n2, N, S;
+       	int cccr_a, t, ht, b;
 
 	ccsr = CCSR;
-	cccra = CCCR & (0x1 << 25);
+	cccr_a = CCCR & (1 << 25);
 
 	/* Read clkcfg register: it has turbo, b, half-turbo (and f) */
-	asm( "mrc\tp14, 0, %0, c6, c0, 0" : "=r" (turbo) );
-	b = (turbo & (0x1 << 3));
-	ht = (turbo & (0x1 << 2));
+	asm( "mrc\tp14, 0, %0, c6, c0, 0" : "=r" (clkcfg) );
+	t  = clkcfg & (1 << 1);
+	ht = clkcfg & (1 << 2);
+	b  = clkcfg & (1 << 3);
 
 	l  = ccsr & 0x1f;
 	n2 = (ccsr>>7) & 0xf;
-	if (l == 31) {
-		/* The calculation from the Yellow Book is incorrect:
-		   it says M=4 for L=21-30 (which is easy to calculate
-		   by subtracting 1 and then dividing by 10, but not
-		   with 31, so we'll do it manually */
-		m = 1 << 2;
-	} else {
-		m = 1 << ((l-1)/10);
-	}
+	m  = (l <= 10) ? 1 : (l <= 20) ? 2 : 4;
 
-	L = l * BASE_CLK;
-	N = (n2 * L) / 2;
-	S = (b) ? L : (L/2);
-	if (cccra == 0)
-		M = L/m;
-	else
-		M = (b) ? L : (L/2);
+	L  = l * BASE_CLK;
+	N  = (L * n2) / 2;
+	M  = (!cccr_a) ? (L/m) : ((b) ? L : (L/2));
+	S  = (b) ? L : (L/2);
 
 	if (info) {
 		printk( KERN_INFO "Run Mode clock: %d.%02dMHz (*%d)\n",
 			L / 1000000, (L % 1000000) / 10000, l );
-		printk( KERN_INFO "Memory clock: %d.%02dMHz (/%d)\n",
-			M / 1000000, (M % 1000000) / 10000, m );
 		printk( KERN_INFO "Turbo Mode clock: %d.%02dMHz (*%d.%d, %sactive)\n",
 			N / 1000000, (N % 1000000)/10000, n2 / 2, (n2 % 2)*5,
-			(turbo & 1) ? "" : "in" );
+			(t) ? "" : "in" );
+		printk( KERN_INFO "Memory clock: %d.%02dMHz (/%d)\n",
+			M / 1000000, (M % 1000000) / 10000, m );
 		printk( KERN_INFO "System bus clock: %d.%02dMHz \n",
 			S / 1000000, (S % 1000000) / 10000 );
 	}
 
-	return (turbo & 1) ? (N/1000) : (L/1000);
+	return (t) ? (N/1000) : (L/1000);
 }
 
 /*
  * Return the current mem clock frequency in units of 10kHz as
  * reflected by CCCR[A], B, and L
  */
-unsigned int get_lclk_frequency_10khz(void)
+unsigned int get_memclk_frequency_10khz(void)
 {
-	unsigned long ccsr, clkcfg, b;
-	unsigned int l, L, m, M, cccra;
+	unsigned long ccsr, clkcfg;
+	unsigned int l, L, m, M;
+       	int cccr_a, b;
 
-	cccra = CCCR & (0x1 << 25);
+	ccsr = CCSR;
+	cccr_a = CCCR & (1 << 25);
 
-	/* Read clkcfg register to obtain b */
+	/* Read clkcfg register: it has turbo, b, half-turbo (and f) */
 	asm( "mrc\tp14, 0, %0, c6, c0, 0" : "=r" (clkcfg) );
-	b = (clkcfg & (0x1 << 3));
+	b = clkcfg & (1 << 3);
 
-	ccsr = CCSR;
-	l  =  ccsr & 0x1f;
-	if (l == 31) {
-		/* The calculation from the Yellow Book is incorrect:
-		   it says M=4 for L=21-30 (which is easy to calculate
-		   by subtracting 1 and then dividing by 10, but not
-		   with 31, so we'll do it manually */
-		m = 1 << 2;
-	} else {
-		m = 1 << ((l-1)/10);
-	}
+	l = ccsr & 0x1f;
+	m = (l <= 10) ? 1 : (l <= 20) ? 2 : 4;
 
 	L = l * BASE_CLK;
-	if (cccra == 0)
-		M = L/m;
-	else
-		M = (b) ? L : L/2;
+	M = (!cccr_a) ? (L/m) : ((b) ? L : (L/2));
 
 	return (M / 10000);
 }
 
-EXPORT_SYMBOL(get_clk_frequency_khz);
-EXPORT_SYMBOL(get_lclk_frequency_10khz);
+/*
+ * Return the current LCD clock frequency in units of 10kHz as
+ */
+unsigned int get_lcdclk_frequency_10khz(void)
+{
+	unsigned long ccsr;
+	unsigned int l, L, k, K;
+
+	ccsr = CCSR;
+
+	l = ccsr & 0x1f;
+	k = (l <= 7) ? 1 : (l <= 16) ? 2 : 4;
 
+	L = l * BASE_CLK;
+	K = L / k;
+
+	return (K / 10000);
+}
+
+EXPORT_SYMBOL(get_clk_frequency_khz);
+EXPORT_SYMBOL(get_memclk_frequency_10khz);
+EXPORT_SYMBOL(get_lcdclk_frequency_10khz);
diff -Nru a/arch/arm/mm/init.c b/arch/arm/mm/init.c
--- a/arch/arm/mm/init.c	2004-06-02 23:26:58 -07:00
+++ b/arch/arm/mm/init.c	2004-06-02 23:26:58 -07:00
@@ -225,6 +225,8 @@
 		bootmem_pages += np[i].bootmap_pages;
 	}
 
+	high_memory = __va(memend_pfn << PAGE_SHIFT);
+
 	/*
 	 * This doesn't seem to be used by the Linux memory
 	 * manager any more.  If we can get rid of it, we
@@ -232,7 +234,6 @@
 	 */
 	max_low_pfn = memend_pfn - O_PFN_DOWN(PHYS_OFFSET);
 	max_pfn = memend_pfn - O_PFN_DOWN(PHYS_OFFSET);
-	mi->end = memend_pfn << PAGE_SHIFT;
 
 	return bootmem_pages;
 }
@@ -280,6 +281,7 @@
 static __init void reserve_node_zero(unsigned int bootmap_pfn, unsigned int bootmap_pages)
 {
 	pg_data_t *pgdat = NODE_DATA(0);
+	unsigned long res_size = 0;
 
 	/*
 	 * Register the kernel text and data with bootmem.
@@ -303,31 +305,32 @@
 			     bootmap_pages << PAGE_SHIFT);
 
 	/*
-	 * Hmm... This should go elsewhere, but we really really
-	 * need to stop things allocating the low memory; we need
-	 * a better implementation of GFP_DMA which does not assume
-	 * that DMA-able memory starts at zero.
+	 * Hmm... This should go elsewhere, but we really really need to
+	 * stop things allocating the low memory; ideally we need a better
+	 * implementation of GFP_DMA which does not assume that DMA-able
+	 * memory starts at zero.
 	 */
-	if (machine_is_integrator())
-		reserve_bootmem_node(pgdat, 0, __pa(swapper_pg_dir));
+	if (machine_is_integrator() || machine_is_cintegrator())
+		res_size = __pa(swapper_pg_dir) - PHYS_OFFSET;
+
 	/*
-	 * These should likewise go elsewhere.  They pre-reserve
-	 * the screen memory region at the start of main system
-	 * memory.
+	 * These should likewise go elsewhere.  They pre-reserve the
+	 * screen memory region at the start of main system memory.
 	 */
-	if (machine_is_archimedes() || machine_is_a5k())
-		reserve_bootmem_node(pgdat, 0x02000000, 0x00080000);
 	if (machine_is_edb7211())
-		reserve_bootmem_node(pgdat, 0xc0000000, 0x00020000);
+		res_size = 0x00020000;
 	if (machine_is_p720t())
-		reserve_bootmem_node(pgdat, PHYS_OFFSET, 0x00014000);
+		res_size = 0x00014000;
+
 #ifdef CONFIG_SA1111
 	/*
-	 * Because of the SA1111 DMA bug, we want to preserve
-	 * our precious DMA-able memory...
+	 * Because of the SA1111 DMA bug, we want to preserve our
+	 * precious DMA-able memory...
 	 */
-	reserve_bootmem_node(pgdat, PHYS_OFFSET, __pa(swapper_pg_dir)-PHYS_OFFSET);
+	res_size = __pa(swapper_pg_dir) - PHYS_OFFSET;
 #endif
+	if (res_size)
+		reserve_bootmem_node(pgdat, PHYS_OFFSET, res_size);
 }
 
 /*
@@ -546,7 +549,6 @@
 	datapages = &_end - &_etext;
 	initpages = &__init_end - &__init_begin;
 
-	high_memory = (void *)__va(meminfo.end);
 #ifndef CONFIG_DISCONTIGMEM
 	max_mapnr   = virt_to_page(high_memory) - mem_map;
 #endif
@@ -601,7 +603,7 @@
 
 void free_initmem(void)
 {
-	if (!machine_is_integrator()) {
+	if (!machine_is_integrator() && !machine_is_cintegrator()) {
 		free_area((unsigned long)(&__init_begin),
 			  (unsigned long)(&__init_end),
 			  "init");
diff -Nru a/arch/cris/Kconfig b/arch/cris/Kconfig
--- a/arch/cris/Kconfig	2004-06-02 23:27:00 -07:00
+++ b/arch/cris/Kconfig	2004-06-02 23:27:00 -07:00
@@ -27,19 +27,11 @@
 
 source "fs/Kconfig.binfmt"
 
-config ETRAX_KGDB
-	bool "Use kernel gdb debugger"
-	---help---
-	  The CRIS version of gdb can be used to remotely debug a running
-	  Linux kernel via the serial debug port.  Provided you have gdb-cris
-	  installed, run gdb-cris vmlinux, then type
-
-	  (gdb) set remotebaud 115200           <- kgdb uses 115200 as default
-	  (gdb) target remote /dev/ttyS0        <- maybe you use another port
-
-	  This should connect you to your booted kernel (or boot it now if you
-	  didn't before).  The kernel halts when it boots, waiting for gdb if
-	  this option is turned on!
+config ETRAX_CMDLINE
+	string "Kernel command line"
+	default "root=/dev/mtdblock3"
+	help
+	  Pass additional commands to the kernel.
 
 config ETRAX_WATCHDOG
 	bool "Enable ETRAX watchdog"
@@ -99,11 +91,6 @@
 	help
 	  Support the xsim ETRAX Simulator.
 
-config ETRAX200LX
-	bool "ETRAX-200LX-V32"
-	help
-	  Support CRIS V32.
-
 endchoice
 
 config ETRAX_ARCH_V10
@@ -111,11 +98,6 @@
        default y if ETRAX100LX || ETRAX100LX_V2
        default n if !(ETRAX100LX || ETRAX100LX_V2) 
 
-config ETRAX_ARCH_V32
-       bool
-       default y if ETRAX200LX
-       default n if !(ETRAX200LX) 
-
 config ETRAX_DRAM_SIZE
 	int "DRAM size (dec, in MB)"
 	default "8"
@@ -128,35 +110,18 @@
 	help
 	  Width in bytes of the Flash bus (1, 2 or 4). Is usually 2.
 
-config ETRAX_ROOT_DEVICE
-	string "Root device name"
-	default "/dev/mtdblock3"
-	help
-	  Specifies the device that should be mounted as root file system
-	  when booting from flash. The axisflashmap driver adds an additional
-	  mtd partition for the appended root file system image, so this option
-	  should normally be the mtdblock device for the partition after the
-	  last partition in the partition table.
-
-# duplicate choice configs are not yet supported, so the followinguse 
-# doesn't work:
-
 source arch/cris/arch-v10/Kconfig
 
 endmenu
 
 # bring in ETRAX built-in drivers
 menu "Drivers for built-in interfaces"
-
 source arch/cris/arch-v10/drivers/Kconfig
 
 endmenu
 
 source "drivers/base/Kconfig"
 
-# bring in Etrax built-in drivers
-source "arch/cris/drivers/Kconfig"
-
 # standard linux drivers
 source "drivers/mtd/Kconfig"
 
@@ -211,6 +176,37 @@
 	int "Profile shift count"
 	depends on PROFILE
 	default "2"
+
+config ETRAX_KGDB
+	bool "Use kernel GDB debugger"
+	---help---
+	  The CRIS version of gdb can be used to remotely debug a running
+	  Linux kernel via the serial debug port.  Provided you have gdb-cris
+	  installed, run gdb-cris vmlinux, then type
+
+	  (gdb) set remotebaud 115200           <- kgdb uses 115200 as default
+	  (gdb) target remote /dev/ttyS0        <- maybe you use another port
+
+	  This should connect you to your booted kernel (or boot it now if you
+	  didn't before).  The kernel halts when it boots, waiting for gdb if
+	  this option is turned on!
+
+
+config DEBUG_INFO
+        bool "Compile the kernel with debug info"
+        help
+          If you say Y here the resulting kernel image will include
+          debugging info resulting in a larger kernel image.
+          Say Y here only if you plan to use gdb to debug the kernel.
+          If you don't debug the kernel, you can say N.
+
+config FRAME_POINTER
+        bool "Compile the kernel with frame pointers"
+        help
+          If you say Y here the resulting kernel image will be slightly larger
+          and slower, but it will give very useful debugging information.
+          If you don't debug the kernel, you can say N, but we may not be able
+          to solve problems without frame pointers.
 
 endmenu
 
diff -Nru a/arch/cris/Makefile b/arch/cris/Makefile
--- a/arch/cris/Makefile	2004-06-02 23:26:59 -07:00
+++ b/arch/cris/Makefile	2004-06-02 23:26:59 -07:00
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.15 2003/07/04 12:47:53 tobiasa Exp $
+# $Id: Makefile,v 1.20 2004/05/14 14:35:58 orjanf Exp $
 # cris/Makefile
 #
 # This file is included by the global makefile so that you can add your own
@@ -34,7 +34,7 @@
 
 CFLAGS := $(CFLAGS) -mlinux -march=$(arch-y) -pipe
 
-ifdef CONFIG_ETRAX_KGDB
+ifdef CONFIG_FRAME_POINTER
 CFLAGS := $(subst -fomit-frame-pointer,,$(CFLAGS)) -g
 CFLAGS += -fno-omit-frame-pointer
 endif
@@ -90,10 +90,14 @@
 
 # Create some links to make all tools happy
 arch/$(ARCH)/.links:
+	@rm -rf arch/$(ARCH)/drivers
 	@ln -sfn $(SARCH)/drivers arch/$(ARCH)/drivers
+	@rm -rf arch/$(ARCH)/boot
 	@ln -sfn $(SARCH)/boot arch/$(ARCH)/boot
+	@rm -rf arch/$(ARCH)/lib
 	@ln -sfn $(SARCH)/lib arch/$(ARCH)/lib
-	@ln -sfn $(SARCH)/vmlinux.lds.S arch/$(ARCH)/kernel/vmlinux.lds.S
+	@ln -sfn $(SARCH) arch/$(ARCH)/arch
+	@ln -sfn ../$(SARCH)/vmlinux.lds.S arch/$(ARCH)/kernel/vmlinux.lds.S
 	@touch $@
 
 # Create link to sub arch includes
diff -Nru a/arch/cris/arch-v10/boot/compressed/misc.c b/arch/cris/arch-v10/boot/compressed/misc.c
--- a/arch/cris/arch-v10/boot/compressed/misc.c	2004-06-02 23:27:00 -07:00
+++ b/arch/cris/arch-v10/boot/compressed/misc.c	2004-06-02 23:27:00 -07:00
@@ -1,7 +1,7 @@
 /*
  * misc.c
  *
- * $Id: misc.c,v 1.4 2003/04/09 05:20:45 starvik Exp $
+ * $Id: misc.c,v 1.6 2003/10/27 08:04:31 starvik Exp $
  * 
  * This is a collection of several routines from gzip-1.0.3 
  * adapted for Linux.
@@ -263,7 +263,7 @@
 	__asm__ volatile ("move vr,%0" : "=rm" (revision));
 	if (revision < 10)
 	{
-		puts("You need an ETRAX 100LX to run linux 2.4\n");
+		puts("You need an ETRAX 100LX to run linux 2.6\n");
 		while(1);
 	}
 
diff -Nru a/arch/cris/arch-v10/defconfig b/arch/cris/arch-v10/defconfig
--- a/arch/cris/arch-v10/defconfig	2004-06-02 23:26:59 -07:00
+++ b/arch/cris/arch-v10/defconfig	2004-06-02 23:26:59 -07:00
@@ -267,6 +267,7 @@
 # CONFIG_BLK_DEV_ISAPNP is not set
 # CONFIG_IDE_CHIPSETS is not set
 # CONFIG_IDEDMA_AUTO is not set
+# CONFIG_BLK_DEV_IDE_MODES is not set
 
 #
 # SCSI support
diff -Nru a/arch/cris/arch-v10/drivers/Kconfig b/arch/cris/arch-v10/drivers/Kconfig
--- a/arch/cris/arch-v10/drivers/Kconfig	2004-06-02 23:26:58 -07:00
+++ b/arch/cris/arch-v10/drivers/Kconfig	2004-06-02 23:26:58 -07:00
@@ -11,29 +11,6 @@
 	bool
 	depends on ETRAX_ETHERNET
 	default y
-	---help---
-	  Ethernet (also called IEEE 802.3 or ISO 8802-2) is the most common
-	  type of Local Area Network (LAN) in universities and companies.
-
-	  Common varieties of Ethernet are: 10BASE-2 or Thinnet (10 Mbps over
-	  coaxial cable, linking computers in a chain), 10BASE-T or twisted
-	  pair (10 Mbps over twisted pair cable, linking computers to central
-	  hubs), 10BASE-F (10 Mbps over optical fiber links, using hubs),
-	  100BASE-TX (100 Mbps over two twisted pair cables, using hubs),
-	  100BASE-T4 (100 Mbps over 4 standard voice-grade twisted pair
-	  cables, using hubs), 100BASE-FX (100 Mbps over optical fiber links)
-	  [the 100BASE varieties are also known as Fast Ethernet], and Gigabit
-	  Ethernet (1 Gbps over optical fiber or short copper links).
-
-	  If your Linux machine will be connected to an Ethernet and you have
-	  an Ethernet network interface card (NIC) installed in your computer,
-	  say Y here and read the Ethernet-HOWTO, available from
-	  <http://www.tldp.org/docs.html#howto>. You will then also have
-	  to say Y to the driver for your particular NIC.
-
-	  Note that the answer to this question won't directly affect the
-	  kernel: saying N will just cause the configurator to skip all
-	  the questions about Ethernet network cards. If unsure, say N.
 
 choice
 	prompt "Network LED behavior"
@@ -110,6 +87,32 @@
 	  the same DMA channels.
 
 choice
+	prompt "Ser0 DMA out assignment"
+	depends on ETRAX_SERIAL_PORT0
+	default ETRAX_SERIAL_PORT0_DMA6_OUT
+
+config CONFIG_ETRAX_SERIAL_PORT0_NO_DMA_OUT
+       bool "No DMA out"
+
+config CONFIG_ETRAX_SERIAL_PORT0_DMA6_OUT
+       bool "DMA 6"
+
+endchoice
+
+choice
+	prompt "Ser0 DMA in assignment"
+	depends on ETRAX_SERIAL_PORT0
+	default ETRAX_SERIAL_PORT0_DMA7_IN
+
+config CONFIG_ETRAX_SERIAL_PORT0_NO_DMA_IN
+       bool "No DMA in"
+
+config CONFIG_ETRAX_SERIAL_PORT0_DMA7_IN
+       bool "DMA 7"
+
+endchoice
+
+choice
 	prompt "Ser0 DTR, RI, DSR and CD assignment"
 	depends on ETRAX_SERIAL_PORT0
 	default ETRAX_SER0_DTR_RI_DSR_CD_ON_NONE
@@ -198,6 +201,32 @@
 	  Enables the ETRAX 100 serial driver for ser1 (ttyS1).
 
 choice
+	prompt "Ser1 DMA out assignment"
+	depends on ETRAX_SERIAL_PORT1
+	default ETRAX_SERIAL_PORT1_DMA8_OUT
+
+config CONFIG_ETRAX_SERIAL_PORT1_NO_DMA_OUT
+       bool "No DMA out"
+
+config CONFIG_ETRAX_SERIAL_PORT1_DMA8_OUT
+       bool "DMA 8"
+
+endchoice
+
+choice
+	prompt "Ser1 DMA in assignment"
+	depends on ETRAX_SERIAL_PORT1
+	default ETRAX_SERIAL_PORT1_DMA9_IN
+
+config CONFIG_ETRAX_SERIAL_PORT1_NO_DMA_IN
+       bool "No DMA in"
+
+config CONFIG_ETRAX_SERIAL_PORT1_DMA9_IN
+       bool "DMA 9"
+
+endchoice
+
+choice
 	prompt "Ser1 DTR, RI, DSR and CD assignment"
 	depends on ETRAX_SERIAL_PORT1
 	default ETRAX_SER1_DTR_RI_DSR_CD_ON_NONE
@@ -289,6 +318,32 @@
 	  Enables the ETRAX 100 serial driver for ser2 (ttyS2).
 
 choice
+	prompt "Ser2 DMA out assignment"
+	depends on ETRAX_SERIAL_PORT2
+	default ETRAX_SERIAL_PORT2_DMA2_OUT
+
+config CONFIG_ETRAX_SERIAL_PORT2_NO_DMA_OUT
+       bool "No DMA out"
+
+config CONFIG_ETRAX_SERIAL_PORT2_DMA2_OUT
+       bool "DMA 2"
+
+endchoice
+
+choice
+	prompt "Ser2 DMA in assignment"
+	depends on ETRAX_SERIAL_PORT2
+	default ETRAX_SERIAL_PORT2_DMA3_IN
+
+config CONFIG_ETRAX_SERIAL_PORT2_NO_DMA_IN
+       bool "No DMA in"
+
+config CONFIG_ETRAX_SERIAL_PORT2_DMA3_IN
+       bool "DMA 3"
+
+endchoice
+
+choice
 	prompt "Ser2 DTR, RI, DSR and CD assignment"
 	depends on ETRAX_SERIAL_PORT2
 	default ETRAX_SER2_DTR_RI_DSR_CD_ON_NONE
@@ -377,6 +432,32 @@
 	  Enables the ETRAX 100 serial driver for ser3 (ttyS3).
 
 choice
+	prompt "Ser3 DMA out assignment"
+	depends on ETRAX_SERIAL_PORT3
+	default ETRAX_SERIAL_PORT3_DMA4_OUT
+
+config CONFIG_ETRAX_SERIAL_PORT3_NO_DMA_OUT
+       bool "No DMA out"
+
+config CONFIG_ETRAX_SERIAL_PORT3_DMA4_OUT
+       bool "DMA 4"
+
+endchoice
+
+choice
+	prompt "Ser3 DMA in assignment"
+	depends on ETRAX_SERIAL_PORT3
+	default ETRAX_SERIAL_PORT3_DMA5_IN
+
+config CONFIG_ETRAX_SERIAL_PORT3_NO_DMA_IN
+       bool "No DMA in"
+
+config CONFIG_ETRAX_SERIAL_PORT3_DMA5_IN
+       bool "DMA 5"
+
+endchoice
+
+choice
 	prompt "Ser3 DTR, RI, DSR and CD assignment"
 	depends on ETRAX_SERIAL_PORT3
 	default ETRAX_SER3_DTR_RI_DSR_CD_ON_NONE
@@ -465,6 +546,95 @@
 	  It's necessary to disable the serial receiver to avoid serial
 	  loopback.  Not all products are able to do this in software only.
 	  Axis 2400/2401 must disable receiver.
+
+config ETRAX_IDE
+	bool "ATA/IDE support"
+	help
+	  Enable this to get support for ATA/IDE.
+	  You can't use parallell ports or SCSI ports
+	  at the same time.
+
+# here we should add the CONFIG_'s necessary to enable the basic
+# general ide drivers so the common case does not need to go
+# into that config submenu. enable disk and CD support. others
+# need to go fiddle in the submenu..
+config IDE
+	tristate
+	depends on ETRAX_IDE
+	default y
+
+config BLK_DEV_IDE
+	tristate
+	depends on ETRAX_IDE
+	default y
+
+config BLK_DEV_IDEDISK
+	tristate
+	depends on ETRAX_IDE
+	default y
+
+config BLK_DEV_IDECD
+	tristate
+	depends on ETRAX_IDE
+	default y
+
+config BLK_DEV_IDEDMA
+	bool
+	depends on ETRAX_IDE
+	default y
+
+config DMA_NONPCI
+	bool
+	depends on ETRAX_IDE
+	default y
+
+config ETRAX_IDE_DELAY
+	int "Delay for drives to regain consciousness"
+	depends on ETRAX_IDE
+	default 15
+	help
+	  Number of seconds to wait for IDE drives to spin up after an IDE
+	  reset.
+choice
+	prompt "IDE reset pin"
+	depends on ETRAX_IDE
+	default ETRAX_IDE_PB7_RESET
+
+config ETRAX_IDE_PB7_RESET
+	bool "Port_PB_Bit_7"
+	help
+	  IDE reset on pin 7 on port B
+
+config ETRAX_IDE_G27_RESET
+        bool "Port_G_Bit_27"
+	help
+	  IDE reset on pin 27 on port G
+
+endchoice
+
+
+config ETRAX_USB_HOST
+	bool "USB host"
+	help
+	   This option enables the host functionality of the ETRAX 100LX
+	   built-in USB controller. In host mode the controller is designed
+	   for CTRL and BULK traffic only, INTR traffic may work as well
+	   however (depending on the requirements of timeliness).
+
+config USB
+       tristate
+       depends on ETRAX_USB_HOST
+       default y
+
+config ETRAX_USB_HOST_PORT1
+       bool "  USB port 1 enabled"
+       depends on ETRAX_USB_HOST
+       default n
+
+config ETRAX_USB_HOST_PORT2
+       bool "  USB port 2 enabled"
+       depends on ETRAX_USB_HOST
+       default n
 
 config ETRAX_AXISFLASHMAP
 	bool "Axis flash-map support"
diff -Nru a/arch/cris/arch-v10/drivers/Makefile b/arch/cris/arch-v10/drivers/Makefile
--- a/arch/cris/arch-v10/drivers/Makefile	2004-06-02 23:26:58 -07:00
+++ b/arch/cris/arch-v10/drivers/Makefile	2004-06-02 23:26:58 -07:00
@@ -10,5 +10,7 @@
 obj-$(CONFIG_ETRAX_GPIO) 	        += gpio.o
 obj-$(CONFIG_ETRAX_DS1302)              += ds1302.o
 obj-$(CONFIG_ETRAX_PCF8563)		+= pcf8563.o
+obj-$(CONFIG_ETRAX_IDE)                 += ide.o
+obj-$(CONFIG_ETRAX_USB_HOST)            += usb-host.o
 
 
diff -Nru a/arch/cris/arch-v10/drivers/axisflashmap.c b/arch/cris/arch-v10/drivers/axisflashmap.c
--- a/arch/cris/arch-v10/drivers/axisflashmap.c	2004-06-02 23:27:00 -07:00
+++ b/arch/cris/arch-v10/drivers/axisflashmap.c	2004-06-02 23:27:00 -07:00
@@ -11,6 +11,9 @@
  * partition split defined below.
  *
  * $Log: axisflashmap.c,v $
+ * Revision 1.8  2004/05/14 07:58:03  starvik
+ * Merge of changes from 2.4
+ *
  * Revision 1.6  2003/07/04 08:27:37  starvik
  * Merge of Linux 2.5.74
  *
@@ -153,6 +156,9 @@
 /* From head.S */
 extern unsigned long romfs_start, romfs_length, romfs_in_flash;
 
+/* The master mtd for the entire flash. */
+struct mtd_info* axisflash_mtd = NULL;
+
 /* Map driver functions. */
 
 static __u8 flash_read8(struct map_info *map, unsigned long ofs)
@@ -314,7 +320,8 @@
 {
 	struct mtd_info *mtd_cs = NULL;
 
-	printk("%s: Probing a 0x%08lx bytes large window at 0x%08lx.\n",
+	printk(KERN_INFO
+               "%s: Probing a 0x%08lx bytes large window at 0x%08lx.\n",
 	       map_cs->name, map_cs->size, map_cs->map_priv_1);
 
 #ifdef CONFIG_MTD_AMDSTD
@@ -398,7 +405,7 @@
 	struct mtd_info *mymtd;
 	int err = 0;
 	int pidx = 0;
-	struct partitiontable_head *ptable_head;
+	struct partitiontable_head *ptable_head = NULL;
 	struct partitiontable_entry *ptable;
 	int use_default_ptable = 1; /* Until proven otherwise. */
 	const char *pmsg = "  /dev/flash%d at 0x%08x, size 0x%08x\n";
@@ -407,19 +414,22 @@
 		/* There's no reason to use this module if no flash chip can
 		 * be identified. Make sure that's understood.
 		 */
-		panic("axisflashmap found no flash chip!\n");
+		printk(KERN_INFO "axisflashmap: Found no flash chip.\n");
+	} else {
+		printk(KERN_INFO "%s: 0x%08x bytes of flash memory.\n",
+		       mymtd->name, mymtd->size);
+		axisflash_mtd = mymtd;
 	}
 
-	printk("%s: 0x%08x bytes of flash memory.\n",
-	       mymtd->name, mymtd->size);
-
-	mymtd->owner = THIS_MODULE;
-
-	ptable_head = (struct partitiontable_head *)(FLASH_CACHED_ADDR +
-		      CONFIG_ETRAX_PTABLE_SECTOR + PARTITION_TABLE_OFFSET);
+	if (mymtd) {
+		mymtd->owner = THIS_MODULE;
+		ptable_head = (struct partitiontable_head *)(FLASH_CACHED_ADDR +
+			      CONFIG_ETRAX_PTABLE_SECTOR +
+			      PARTITION_TABLE_OFFSET);
+	}
 	pidx++;  /* First partition is always set to the default. */
 
-	if ((ptable_head->magic == PARTITION_TABLE_MAGIC)
+	if (ptable_head && (ptable_head->magic == PARTITION_TABLE_MAGIC)
 	    && (ptable_head->size <
 		(MAX_PARTITIONS * sizeof(struct partitiontable_entry) +
 		PARTITIONTABLE_END_MARKER_SIZE))
@@ -454,7 +464,7 @@
 		ptable_ok = (csum == ptable_head->checksum);
 
 		/* Read the entries and use/show the info.  */
-		printk(" Found a%s partition table at 0x%p-0x%p.\n",
+		printk(KERN_INFO " Found a%s partition table at 0x%p-0x%p.\n",
 		       (ptable_ok ? " valid" : "n invalid"), ptable_head,
 		       max_addr);
 
@@ -486,22 +496,25 @@
 		axis_partitions[pidx].offset = romfs_start - FLASH_CACHED_ADDR;
 		axis_partitions[pidx].mask_flags |= MTD_WRITEABLE;
 
-		printk(" Adding readonly flash partition for romfs image:\n");
+		printk(KERN_INFO
+                       " Adding readonly flash partition for romfs image:\n");
 		printk(pmsg, pidx, axis_partitions[pidx].offset,
 		       axis_partitions[pidx].size);
 		pidx++;
 	}
 
-	if (use_default_ptable) {
-		printk(" Using default partition table.\n");
-		err = add_mtd_partitions(mymtd, axis_default_partitions,
-		                         NUM_DEFAULT_PARTITIONS);
-	} else {
-		err = add_mtd_partitions(mymtd, axis_partitions, pidx);
-	}
+        if (mymtd) {
+		if (use_default_ptable) {
+			printk(KERN_INFO " Using default partition table.\n");
+			err = add_mtd_partitions(mymtd, axis_default_partitions,
+						 NUM_DEFAULT_PARTITIONS);
+		} else {
+			err = add_mtd_partitions(mymtd, axis_partitions, pidx);
+		}
 
-	if (err) {
-		panic("axisflashmap could not add MTD partitions!\n");
+		if (err) {
+			panic("axisflashmap could not add MTD partitions!\n");
+		}
 	}
 
 	if (!romfs_in_flash) {
@@ -522,7 +535,7 @@
 			      "mtd_info!\n");
 		}
 
-		printk(" Adding RAM partition for romfs image:\n");
+		printk(KERN_INFO " Adding RAM partition for romfs image:\n");
 		printk(pmsg, pidx, romfs_start, romfs_length);
 
 		err = mtdram_init_device(mtd_ram, (void*)romfs_start, 
@@ -539,3 +552,5 @@
 
 /* This adds the above to the kernels init-call chain. */
 module_init(init_axis_flash);
+
+EXPORT_SYMBOL(axisflash_mtd);
diff -Nru a/arch/cris/arch-v10/drivers/ds1302.c b/arch/cris/arch-v10/drivers/ds1302.c
--- a/arch/cris/arch-v10/drivers/ds1302.c	2004-06-02 23:27:00 -07:00
+++ b/arch/cris/arch-v10/drivers/ds1302.c	2004-06-02 23:27:00 -07:00
@@ -4,9 +4,18 @@
 *!
 *! DESCRIPTION: Implements an interface for the DS1302 RTC through Etrax I/O
 *!
-*! Functions exported: ds1302_readreg, ds1302_writereg, ds1302_init, get_rtc_status
+*! Functions exported: ds1302_readreg, ds1302_writereg, ds1302_init
 *!
 *! $Log: ds1302.c,v $
+*! Revision 1.13  2004/05/28 09:26:59  starvik
+*! Modified I2C initialization to work in 2.6.
+*!
+*! Revision 1.12  2004/05/14 07:58:03  starvik
+*! Merge of changes from 2.4
+*!
+*! Revision 1.10  2004/02/04 09:25:12  starvik
+*! Merge of Linux 2.6.2
+*!
 *! Revision 1.9  2003/07/04 08:27:37  starvik
 *! Merge of Linux 2.5.74
 *!
@@ -114,7 +123,7 @@
 *!
 *! (C) Copyright 1999, 2000, 2001  Axis Communications AB, LUND, SWEDEN
 *!
-*! $Id: ds1302.c,v 1.9 2003/07/04 08:27:37 starvik Exp $
+*! $Id: ds1302.c,v 1.13 2004/05/28 09:26:59 starvik Exp $
 *!
 *!***************************************************************************/
 
@@ -283,12 +292,23 @@
 void
 ds1302_writereg(int reg, unsigned char val) 
 {
-	ds1302_wenable();
-	start();
-	out_byte(0x80 | (reg << 1)); /* write register */
-	out_byte(val);
-	stop();
-	ds1302_wdisable();
+#ifndef CONFIG_ETRAX_RTC_READONLY
+	int do_writereg = 1;
+#else
+	int do_writereg = 0;
+
+	if (reg == RTC_TRICKLECHARGER)
+		do_writereg = 1;
+#endif
+
+	if (do_writereg) {
+		ds1302_wenable();
+		start();
+		out_byte(0x80 | (reg << 1)); /* write register */
+		out_byte(val);
+		stop();
+		ds1302_wdisable();
+	}
 }
 
 void
@@ -426,20 +446,33 @@
 			tcs_val = RTC_TCR_PATTERN | (tcs_val & 0x0F);
 			ds1302_writereg(RTC_TRICKLECHARGER, tcs_val);
 			return 0;
-		}                
+		}
+		case RTC_VLOW_RD:
+		{
+			/* TODO:
+			 * Implement voltage low detection support
+			 */
+			printk(KERN_WARNING "DS1302: RTC Voltage Low detection"
+			       " is not supported\n");
+			return 0;
+		}
+		case RTC_VLOW_SET:
+		{
+			/* TODO:
+			 * Nothing to do since Voltage Low detection is not supported
+			 */
+			return 0;
+		}
 		default:
 			return -ENOIOCTLCMD;
 	}
 }
 
-int
-get_rtc_status(char *buf) 
+static void
+print_rtc_status(void)
 {
-	char *p;
 	struct rtc_time tm;
 
-	p = buf;
-
 	get_rtc_time(&tm);
 
 	/*
@@ -447,16 +480,12 @@
 	 * time or for Universal Standard Time (GMT). Probably local though.
 	 */
 
-	p += sprintf(p,
-		"rtc_time\t: %02d:%02d:%02d\n"
-		"rtc_date\t: %04d-%02d-%02d\n",
-		tm.tm_hour, tm.tm_min, tm.tm_sec,
-		tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday);
-
-	return  p - buf;
+	printk(KERN_INFO "rtc_time\t: %02d:%02d:%02d\n",
+	       tm.tm_hour, tm.tm_min, tm.tm_sec);
+	printk(KERN_INFO "rtc_date\t: %04d-%02d-%02d\n",
+	       tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday);
 }
 
-
 /* The various file operations we support. */
 
 static struct file_operations rtc_fops = {
@@ -487,11 +516,10 @@
 	out_byte(0xc1); /* read RAM byte 0 */
 
 	if((res = in_byte()) == MAGIC_PATTERN) {
-		char buf[100];
 		stop();
 		ds1302_wdisable();
-		printk("%s: RTC found.\n", ds1302_name);
-		printk("%s: SDA, SCL, RST on PB%i, PB%i, %s%i\n",
+		printk(KERN_INFO "%s: RTC found.\n", ds1302_name);
+		printk(KERN_INFO "%s: SDA, SCL, RST on PB%i, PB%i, %s%i\n",
 		       ds1302_name,
 		       CONFIG_ETRAX_DS1302_SDABIT,
 		       CONFIG_ETRAX_DS1302_SCLBIT,
@@ -501,12 +529,10 @@
 		       "PB",
 #endif
 		       CONFIG_ETRAX_DS1302_RSTBIT);
-                get_rtc_status(buf);
-                printk(buf);
+                print_rtc_status();
 		retval = 1;
 	} else {
 		stop();
-		printk("%s: RTC not found.\n", ds1302_name);
 		retval = 0;
 	}
 
@@ -518,7 +544,9 @@
 
 int __init
 ds1302_init(void) 
-{ 
+{
+	i2c_init();
+
 	if (!ds1302_probe()) {
 #ifdef CONFIG_ETRAX_DS1302_RST_ON_GENERIC_PORT
 #if CONFIG_ETRAX_DS1302_RSTBIT == 27
@@ -539,16 +567,20 @@
 				   (IO_STATE(R_GEN_CONFIG, g0dir, out)));    
     		*R_GEN_CONFIG = genconfig_shadow;
 #endif
-		if (!ds1302_probe())
+		if (!ds1302_probe()) {
+			printk(KERN_WARNING "%s: RTC not found.\n", ds1302_name);
       			return -1;
+		}
 #else
+		printk(KERN_WARNING "%s: RTC not found.\n", ds1302_name);
     		return -1;
 #endif
   	}
-  
 	/* Initialise trickle charger */
 	ds1302_writereg(RTC_TRICKLECHARGER,
 			RTC_TCR_PATTERN |(CONFIG_ETRAX_DS1302_TRICKLE_CHARGE & 0x0F));
+        /* Start clock by resetting CLOCK_HALT */
+	ds1302_writereg(RTC_SECONDS, (ds1302_readreg(RTC_SECONDS) & 0x7F));
 	return 0;
 }
 
diff -Nru a/arch/cris/arch-v10/drivers/eeprom.c b/arch/cris/arch-v10/drivers/eeprom.c
--- a/arch/cris/arch-v10/drivers/eeprom.c	2004-06-02 23:26:59 -07:00
+++ b/arch/cris/arch-v10/drivers/eeprom.c	2004-06-02 23:26:59 -07:00
@@ -20,6 +20,9 @@
 *!                                  in the spin-lock.
 *!
 *!  $Log: eeprom.c,v $
+*!  Revision 1.10  2003/09/11 07:29:48  starvik
+*!  Merge of Linux 2.6.0-test5
+*!
 *!  Revision 1.9  2003/07/04 08:27:37  starvik
 *!  Merge of Linux 2.5.74
 *!
@@ -441,9 +444,9 @@
 static int eeprom_open(struct inode * inode, struct file * file)
 {
 
-  if(iminor(inode) != EEPROM_MINOR_NR)
+  if(MINOR(inode->i_rdev) != EEPROM_MINOR_NR)
      return -ENXIO;
-  if(imajor(inode) != EEPROM_MAJOR_NR)
+  if(MAJOR(inode->i_rdev) != EEPROM_MAJOR_NR)
      return -ENXIO;
 
   if( eeprom.size > 0 )
diff -Nru a/arch/cris/arch-v10/drivers/ethernet.c b/arch/cris/arch-v10/drivers/ethernet.c
--- a/arch/cris/arch-v10/drivers/ethernet.c	2004-06-02 23:26:59 -07:00
+++ b/arch/cris/arch-v10/drivers/ethernet.c	2004-06-02 23:26:59 -07:00
@@ -1,4 +1,4 @@
-/* $Id: ethernet.c,v 1.17 2003/07/04 08:27:37 starvik Exp $
+/* $Id: ethernet.c,v 1.22 2004/05/14 07:58:03 starvik Exp $
  *
  * e100net.c: A network driver for the ETRAX 100LX network controller.
  *
@@ -7,6 +7,15 @@
  * The outline of this driver comes from skeleton.c.
  *
  * $Log: ethernet.c,v $
+ * Revision 1.22  2004/05/14 07:58:03  starvik
+ * Merge of changes from 2.4
+ *
+ * Revision 1.20  2004/03/11 11:38:40  starvik
+ * Merge of Linux 2.6.4
+ *
+ * Revision 1.18  2003/12/03 13:45:46  starvik
+ * Use hardware pad for short packets to prevent information leakage.
+ *
  * Revision 1.17  2003/07/04 08:27:37  starvik
  * Merge of Linux 2.5.74
  *
@@ -258,6 +267,16 @@
 	struct sk_buff* skb;
 } etrax_eth_descr;
 
+/* Some transceivers requires special handling */
+struct transceiver_ops
+{
+	unsigned int oui;
+	void (*check_speed)(void);
+	void (*check_duplex)(void);
+};
+
+struct transceiver_ops* transceiver;
+
 /* Duplex settings */
 enum duplex
 {
@@ -278,10 +297,17 @@
 */
 #define MDIO_BASE_STATUS_REG                0x1
 #define MDIO_BASE_CONTROL_REG               0x0
+#define MDIO_PHY_ID_HIGH_REG                0x2
+#define MDIO_PHY_ID_LOW_REG                 0x3
 #define MDIO_BC_NEGOTIATE                0x0200
 #define MDIO_BC_FULL_DUPLEX_MASK         0x0100
 #define MDIO_BC_AUTO_NEG_MASK            0x1000
 #define MDIO_BC_SPEED_SELECT_MASK        0x2000
+#define MDIO_STATUS_100_FD               0x4000
+#define MDIO_STATUS_100_HD               0x2000
+#define MDIO_STATUS_10_FD                0x1000
+#define MDIO_STATUS_10_HD                0x0800
+#define MDIO_STATUS_SPEED_DUPLEX_MASK	 0x7800
 #define MDIO_ADVERTISMENT_REG               0x4
 #define MDIO_ADVERT_100_FD                0x100
 #define MDIO_ADVERT_100_HD                0x080
@@ -295,9 +321,13 @@
 
 /* Broadcom specific */
 #define MDIO_AUX_CTRL_STATUS_REG           0x18
-#define MDIO_FULL_DUPLEX_IND                0x1
-#define MDIO_SPEED                          0x2
-#define MDIO_PHYS_ADDR                      0x0
+#define MDIO_BC_FULL_DUPLEX_IND             0x1
+#define MDIO_BC_SPEED                       0x2
+
+/* TDK specific */
+#define MDIO_TDK_DIAGNOSTIC_REG              18
+#define MDIO_TDK_DIAGNOSTIC_RATE          0x400
+#define MDIO_TDK_DIAGNOSTIC_DPLX          0x800
 
 /* Network flash constants */
 #define NET_FLASH_TIME                  (HZ/50) /* 20 ms */
@@ -341,6 +371,9 @@
 static etrax_eth_descr TxDescList[NBR_OF_TX_DESC] __attribute__ ((aligned(32)));
 
 static unsigned int network_rec_config_shadow = 0;
+static unsigned int mdio_phy_addr; /* Transciever address */
+
+static unsigned int network_tr_ctrl_shadow = 0;
 
 /* Network speed indication. */
 static struct timer_list speed_timer = TIMER_INITIALIZER(NULL, 0, 0);
@@ -376,6 +409,7 @@
 static void e100_hardware_send_packet(char *buf, int length);
 static void update_rx_stats(struct net_device_stats *);
 static void update_tx_stats(struct net_device_stats *);
+static int e100_probe_transceiver(void);
 
 static void e100_check_speed(unsigned long dummy);
 static void e100_set_speed(unsigned long speed);
@@ -393,6 +427,21 @@
 static void e100_clear_network_leds(unsigned long dummy);
 static void e100_set_network_leds(int active);
 
+static void broadcom_check_speed(void);
+static void broadcom_check_duplex(void);
+static void tdk_check_speed(void);
+static void tdk_check_duplex(void);
+static void generic_check_speed(void);
+static void generic_check_duplex(void);
+
+struct transceiver_ops transceivers[] =
+{
+	{0x1018, broadcom_check_speed, broadcom_check_duplex},  /* Broadcom */
+	{0xC039, tdk_check_speed, tdk_check_duplex},            /* TDK 2120 */
+	{0x039C, tdk_check_speed, tdk_check_duplex},            /* TDK 2120C */
+	{0x0000, generic_check_speed, generic_check_duplex}     /* Generic, must be last */
+};
+
 #define tx_done(dev) (*R_DMA_CH0_CMD == 0)
 
 /*
@@ -409,7 +458,8 @@
 	struct net_device *dev;
 	int i, err;
 
-	printk("ETRAX 100LX 10/100MBit ethernet v2.0 (c) 2000-2003 Axis Communications AB\n");
+	printk(KERN_INFO
+	       "ETRAX 100LX 10/100MBit ethernet v2.0 (c) 2000-2003 Axis Communications AB\n");
 
 	dev = alloc_etherdev(sizeof(struct net_local));
 	if (!dev)
@@ -496,7 +546,6 @@
 	current_speed_selection = 0; /* Auto */
 	speed_timer.expires = jiffies + NET_LINK_UP_CHECK_INTERVAL;
 	speed_timer.function = e100_check_speed;
-	add_timer(&speed_timer);
         
 	clear_led_timer.function = e100_clear_network_leds;
         
@@ -504,7 +553,6 @@
 	current_duplex = autoneg;
 	duplex_timer.expires = jiffies + NET_DUPLEX_CHECK_INTERVAL;		
 	duplex_timer.function = e100_check_duplex;
-	add_timer(&duplex_timer);
 
 	/* Initialize group address registers to make sure that no */
 	/* unwanted addresses are matched */
@@ -543,7 +591,7 @@
 
 	/* show it in the log as well */
 
-	printk("%s: changed MAC to ", dev->name);
+	printk(KERN_INFO "%s: changed MAC to ", dev->name);
 
 	for (i = 0; i < 5; i++)
 		printk("%02X:", dev->dev_addr[i]);
@@ -569,12 +617,6 @@
 {
 	unsigned long flags;
 
-	/* disable the ethernet interface while we configure it */
-
-	*R_NETWORK_GEN_CONFIG =
-		IO_STATE(R_NETWORK_GEN_CONFIG, phy,    mii_clk) |
-		IO_STATE(R_NETWORK_GEN_CONFIG, enable, off);
-
 	/* enable the MDIO output pin */
 
 	*R_NETWORK_MGM_CTRL = IO_STATE(R_NETWORK_MGM_CTRL, mdoe, enable);
@@ -645,14 +687,14 @@
 		IO_STATE(R_NETWORK_GEN_CONFIG, phy,    mii_clk) |
 		IO_STATE(R_NETWORK_GEN_CONFIG, enable, on);
 
-	*R_NETWORK_TR_CTRL = 
-		IO_STATE(R_NETWORK_TR_CTRL, clr_error, clr) |
-		IO_STATE(R_NETWORK_TR_CTRL, delay, none) |
-		IO_STATE(R_NETWORK_TR_CTRL, cancel, dont) |
-		IO_STATE(R_NETWORK_TR_CTRL, cd, enable) |
-		IO_STATE(R_NETWORK_TR_CTRL, retry, enable) |
-		IO_STATE(R_NETWORK_TR_CTRL, pad, enable) |
-		IO_STATE(R_NETWORK_TR_CTRL, crc, enable);
+	SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, clr_error, clr);
+	SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, delay, none);
+	SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, cancel, dont);
+	SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, cd, enable);
+	SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, retry, enable);
+	SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, pad, enable);
+	SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, crc, enable);
+	*R_NETWORK_TR_CTRL = network_tr_ctrl_shadow;
 
 	save_flags(flags);
 	cli();
@@ -660,7 +702,8 @@
 	/* enable the irq's for ethernet DMA */
 
 	*R_IRQ_MASK2_SET =
-		IO_STATE(R_IRQ_MASK2_SET, dma1_eop, set); 
+		IO_STATE(R_IRQ_MASK2_SET, dma0_eop, set) |
+		IO_STATE(R_IRQ_MASK2_SET, dma1_eop, set);
 
 	*R_IRQ_MASK0_SET =
 		IO_STATE(R_IRQ_MASK0_SET, overrun,       set) |
@@ -689,6 +732,14 @@
 
 	restore_flags(flags);
 	
+	/* Probe for transceiver */
+	if (e100_probe_transceiver())
+		goto grace_exit3;
+
+	/* Start duplex/speed timers */
+	add_timer(&speed_timer);
+	add_timer(&duplex_timer);
+
 	/* We are now ready to accept transmit requeusts from
 	 * the queueing layer of the networking.
 	 */
@@ -696,6 +747,8 @@
 
 	return 0;
 
+grace_exit3:
+	free_irq(NETWORK_STATUS_IRQ_NBR, (void *)dev);
 grace_exit2:
 	free_irq(NETWORK_DMA_TX_IRQ_NBR, (void *)dev);
 grace_exit1:
@@ -706,8 +759,37 @@
 
 
 static void
+generic_check_speed(void)
+{
+	unsigned long data;
+	data = e100_get_mdio_reg(MDIO_ADVERTISMENT_REG);
+	if ((data & MDIO_ADVERT_100_FD) ||
+	    (data & MDIO_ADVERT_100_HD))
+		current_speed = 100;
+	else
+		current_speed = 10;
+}
+
+static void
+tdk_check_speed(void)
+{
+	unsigned long data;
+	data = e100_get_mdio_reg(MDIO_TDK_DIAGNOSTIC_REG);
+	current_speed = (data & MDIO_TDK_DIAGNOSTIC_RATE ? 100 : 10);
+}
+
+static void
+broadcom_check_speed(void)
+{
+	unsigned long data;
+	data = e100_get_mdio_reg(MDIO_AUX_CTRL_STATUS_REG);
+	current_speed = (data & MDIO_BC_SPEED ? 100 : 10);
+}
+
+static void
 e100_check_speed(unsigned long dummy)
 {
+	static int led_initiated = 0;
 	unsigned long data;
 	int old_speed = current_speed;
 
@@ -715,12 +797,13 @@
 	if (!(data & MDIO_LINK_UP_MASK)) {
 		current_speed = 0;
 	} else {
-		data = e100_get_mdio_reg(MDIO_AUX_CTRL_STATUS_REG);
-		current_speed = (data & MDIO_SPEED ? 100 : 10);
+		transceiver->check_speed();
 	}
 	
-	if (old_speed != current_speed)
+	if ((old_speed != current_speed) || !led_initiated) {
+		led_initiated = 1;
 		e100_set_network_leds(NO_NETWORK_ACTIVITY);
+	}
 
 	/* Reinitialize the timer. */
 	speed_timer.expires = jiffies + NET_LINK_UP_CHECK_INTERVAL;
@@ -781,29 +864,21 @@
 static void
 e100_set_speed(unsigned long speed)
 {
-	current_speed_selection = speed;
-	e100_negotiate();
+	if (speed != current_speed_selection) {
+		current_speed_selection = speed;
+		e100_negotiate();
+	}
 }
 
 static void
 e100_check_duplex(unsigned long dummy)
 {
-	unsigned long data;
-
-	data = e100_get_mdio_reg(MDIO_AUX_CTRL_STATUS_REG);
-        
-	if (data & MDIO_FULL_DUPLEX_IND) {
-		if (!full_duplex) { /* Duplex changed to full? */
-			full_duplex = 1;
-			SETF(network_rec_config_shadow, R_NETWORK_REC_CONFIG, duplex, full_duplex);
-			*R_NETWORK_REC_CONFIG = network_rec_config_shadow;
-		}
-	} else { /* half */
-		if (full_duplex) { /* Duplex changed to half? */
-			full_duplex = 0;
-			SETF(network_rec_config_shadow, R_NETWORK_REC_CONFIG, duplex, full_duplex);
-			*R_NETWORK_REC_CONFIG = network_rec_config_shadow;
-		}
+	int old_duplex = full_duplex;
+	transceiver->check_duplex();
+	if (old_duplex != full_duplex) {
+		/* Duplex changed */
+		SETF(network_rec_config_shadow, R_NETWORK_REC_CONFIG, duplex, full_duplex);
+		*R_NETWORK_REC_CONFIG = network_rec_config_shadow;
 	}
 
 	/* Reinitialize the timer. */
@@ -811,13 +886,72 @@
 	add_timer(&duplex_timer);
 }
 
+static void
+generic_check_duplex(void)
+{
+	unsigned long data;
+	data = e100_get_mdio_reg(MDIO_ADVERTISMENT_REG);
+	if ((data & MDIO_ADVERT_100_FD) ||
+	    (data & MDIO_ADVERT_10_FD))
+		full_duplex = 1;
+	else
+		full_duplex = 0;
+}
+
+static void
+tdk_check_duplex(void)
+{
+	unsigned long data;
+	data = e100_get_mdio_reg(MDIO_TDK_DIAGNOSTIC_REG);
+	full_duplex = (data & MDIO_TDK_DIAGNOSTIC_DPLX) ? 1 : 0;
+}
+
+static void
+broadcom_check_duplex(void)
+{
+	unsigned long data;
+	data = e100_get_mdio_reg(MDIO_AUX_CTRL_STATUS_REG);
+	full_duplex = (data & MDIO_BC_FULL_DUPLEX_IND) ? 1 : 0;
+}
+
 static void 
 e100_set_duplex(enum duplex new_duplex)
 {
-	current_duplex = new_duplex;
-	e100_negotiate();
+	if (new_duplex != current_duplex) {
+		current_duplex = new_duplex;
+		e100_negotiate();
+	}
 }
 
+static int
+e100_probe_transceiver(void)
+{
+	unsigned int phyid_high;
+	unsigned int phyid_low;
+	unsigned int oui;
+	struct transceiver_ops* ops = NULL;
+
+	/* Probe MDIO physical address */
+	for (mdio_phy_addr = 0; mdio_phy_addr <= 31; mdio_phy_addr++) {
+		if (e100_get_mdio_reg(MDIO_BASE_STATUS_REG) != 0xffff)
+			break;
+	}
+	if (mdio_phy_addr == 32)
+		 return -ENODEV;
+
+	/* Get manufacturer */
+	phyid_high = e100_get_mdio_reg(MDIO_PHY_ID_HIGH_REG);
+	phyid_low = e100_get_mdio_reg(MDIO_PHY_ID_LOW_REG);
+	oui = (phyid_high << 6) | (phyid_low >> 10);
+
+	for (ops = &transceivers[0]; ops->oui; ops++) {
+		if (ops->oui == oui)
+			break;
+	}
+	transceiver = ops;
+
+	return 0;
+}
 
 static unsigned short
 e100_get_mdio_reg(unsigned char reg_num)
@@ -827,7 +961,7 @@
 	int bitCounter;
 	
 	/* Start of frame, OP Code, Physical Address, Register Address */
-	cmd = (MDIO_START << 14) | (MDIO_READ << 12) | (MDIO_PHYS_ADDR << 7) |
+	cmd = (MDIO_START << 14) | (MDIO_READ << 12) | (mdio_phy_addr << 7) |
 		(reg_num << 2);
 	
 	e100_send_mdio_cmd(cmd, 0);
@@ -848,7 +982,7 @@
 	int bitCounter;
 	unsigned short cmd;
 
-	cmd = (MDIO_START << 14) | (MDIO_WRITE << 12) | (MDIO_PHYS_ADDR << 7) |
+	cmd = (MDIO_START << 14) | (MDIO_WRITE << 12) | (mdio_phy_addr << 7) |
 	      (reg << 2);
 
 	e100_send_mdio_cmd(cmd, 1);
@@ -916,7 +1050,7 @@
 
 	data = e100_get_mdio_reg(MDIO_BASE_CONTROL_REG);
 
-	cmd = (MDIO_START << 14) | (MDIO_WRITE << 12) | (MDIO_PHYS_ADDR << 7) | (MDIO_BASE_CONTROL_REG << 2);
+	cmd = (MDIO_START << 14) | (MDIO_WRITE << 12) | (mdio_phy_addr << 7) | (MDIO_BASE_CONTROL_REG << 2);
 
 	e100_send_mdio_cmd(cmd, 1);
 	
@@ -984,7 +1118,6 @@
 e100_send_packet(struct sk_buff *skb, struct net_device *dev)
 {
 	struct net_local *np = (struct net_local *)dev->priv;
-	int length = ETH_ZLEN < skb->len ? skb->len : ETH_ZLEN;
 	unsigned char *buf = skb->data;
 	unsigned long flags;
 	
@@ -997,15 +1130,12 @@
 
 	dev->trans_start = jiffies;
 	
-	e100_hardware_send_packet(buf, length);
+	e100_hardware_send_packet(buf, skb->len);
 
 	myNextTxDesc = phys_to_virt(myNextTxDesc->descr.next);
 
 	/* Stop queue if full */
 	if (myNextTxDesc == myFirstTxDesc) {
-		/* Enable transmit interrupt to wake up queue */
-		*R_DMA_CH0_CLR_INTR = IO_STATE(R_DMA_CH0_CLR_INTR, clr_eop, do);		
-		*R_IRQ_MASK2_SET = IO_STATE(R_IRQ_MASK2_SET, dma0_eop, set);
 		netif_stop_queue(dev);
 	}
 
@@ -1026,6 +1156,11 @@
 	struct net_local *np = (struct net_local *)dev->priv;
 	unsigned long irqbits = *R_IRQ_MASK2_RD;
  
+	/* Disable RX/TX IRQs to avoid reentrancy */
+	*R_IRQ_MASK2_CLR =
+	  IO_STATE(R_IRQ_MASK2_CLR, dma0_eop, clr) |
+	  IO_STATE(R_IRQ_MASK2_CLR, dma1_eop, clr);
+
 	/* Handle received packets */
 	if (irqbits & IO_STATE(R_IRQ_MASK2_RD, dma1_eop, active)) {
 		/* acknowledge the eop interrupt */
@@ -1069,9 +1204,14 @@
 	if (irqbits & IO_STATE(R_IRQ_MASK2_RD, dma0_eop, active)) {
 		/* acknowledge the eop interrupt and wake up queue */
 		*R_DMA_CH0_CLR_INTR = IO_STATE(R_DMA_CH0_CLR_INTR, clr_eop, do);
-		*R_IRQ_MASK2_CLR = IO_STATE(R_IRQ_MASK2_CLR, dma0_eop, clr);		
 		netif_wake_queue(dev);
 	}
+
+	/* Enable RX/TX IRQs again */
+	*R_IRQ_MASK2_SET =
+	  IO_STATE(R_IRQ_MASK2_SET, dma0_eop, set) |
+	  IO_STATE(R_IRQ_MASK2_SET, dma1_eop, set);
+
 	return IRQ_HANDLED;
 }
 
@@ -1084,7 +1224,9 @@
 
 	/* check for underrun irq */
 	if (irqbits & IO_STATE(R_IRQ_MASK0_RD, underrun, active)) { 
-		*R_NETWORK_TR_CTRL = IO_STATE(R_NETWORK_TR_CTRL, clr_error, clr);
+		SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, clr_error, clr);
+		*R_NETWORK_TR_CTRL = network_tr_ctrl_shadow;
+		SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, clr_error, nop);
 		np->stats.tx_errors++;
 		D(printk("ethernet receiver underrun!\n"));
 	}
@@ -1096,6 +1238,9 @@
 	}
 	/* check for excessive collision irq */
 	if (irqbits & IO_STATE(R_IRQ_MASK0_RD, excessive_col, active)) { 
+		SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, clr_error, clr);
+		*R_NETWORK_TR_CTRL = network_tr_ctrl_shadow;
+		SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, clr_error, nop);
 		*R_NETWORK_TR_CTRL = IO_STATE(R_NETWORK_TR_CTRL, clr_error, clr);
 		np->stats.tx_errors++;
 		D(printk("ethernet excessive collisions!\n"));
@@ -1210,14 +1355,10 @@
 {
 	struct net_local *np = (struct net_local *)dev->priv;
 
-	printk("Closing %s.\n", dev->name);
+	printk(KERN_INFO "Closing %s.\n", dev->name);
 
 	netif_stop_queue(dev);
 
-	*R_NETWORK_GEN_CONFIG =
-		IO_STATE(R_NETWORK_GEN_CONFIG, phy,    mii_clk) |
-		IO_STATE(R_NETWORK_GEN_CONFIG, enable, off);
-	
 	*R_IRQ_MASK0_CLR =
 		IO_STATE(R_IRQ_MASK0_CLR, overrun, clr) |
 		IO_STATE(R_IRQ_MASK0_CLR, underrun, clr) |
@@ -1245,6 +1386,10 @@
 	update_rx_stats(&np->stats);
 	update_tx_stats(&np->stats);
 
+	/* Stop speed/duplex timers */
+	del_timer(&speed_timer);
+	del_timer(&duplex_timer);
+
 	return 0;
 }
 
@@ -1259,7 +1404,7 @@
 		case SIOCETHTOOL:
 			return e100_ethtool_ioctl(dev,ifr);
 		case SIOCGMIIPHY: /* Get PHY address */
-			data->phy_id = MDIO_PHYS_ADDR;
+			data->phy_id = mdio_phy_addr;
 			break;
 		case SIOCGMIIREG: /* Read MII register */
 			data->val_out = e100_get_mdio_reg(data->reg_num);
@@ -1278,7 +1423,7 @@
 		case SET_ETH_SPEED_AUTO:              /* Auto negotiate speed */
 			e100_set_speed(0);
 			break;
-		case SET_ETH_DUPLEX_HALF:              /* Hhalf duplex. */
+		case SET_ETH_DUPLEX_HALF:              /* Half duplex. */
 			e100_set_duplex(half);
 			break;
 		case SET_ETH_DUPLEX_FULL:              /* Full duplex. */
@@ -1312,12 +1457,12 @@
 			  SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full;
 			ecmd.port = PORT_TP;
 			ecmd.transceiver = XCVR_EXTERNAL;
-			ecmd.phy_address = MDIO_PHYS_ADDR;
+			ecmd.phy_address = mdio_phy_addr;
 			ecmd.speed = current_speed;
 			ecmd.duplex = full_duplex ? DUPLEX_FULL : DUPLEX_HALF;
 			ecmd.advertising = ADVERTISED_TP;
 			if (current_duplex == autoneg && current_speed_selection == 0)
-				ecmd.advertising = ADVERTISED_Autoneg;
+				ecmd.advertising |= ADVERTISED_Autoneg;
 			else {
 				ecmd.advertising |= 
 				  ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full |
@@ -1355,7 +1500,7 @@
 			struct ethtool_drvinfo info;
 			memset((void *) &info, 0, sizeof (info));
 			strncpy(info.driver, "ETRAX 100LX", sizeof(info.driver) - 1);
-			strncpy(info.version, "$Revision: 1.17 $", sizeof(info.version) - 1);
+			strncpy(info.version, "$Revision: 1.22 $", sizeof(info.version) - 1);
 			strncpy(info.fw_version, "N/A", sizeof(info.fw_version) - 1);
 			strncpy(info.bus_info, "N/A", sizeof(info.bus_info) - 1);
 			info.regdump_len = 0;
@@ -1595,7 +1740,11 @@
 
 	if (!current_speed) {
 		/* Make LED red, link is down */
+#if defined(CONFIG_ETRAX_NETWORK_RED_ON_NO_CONNECTION)
+		LED_NETWORK_SET(LED_RED);
+#else
 		LED_NETWORK_SET(LED_OFF);
+#endif
 	}
 	else if (light_leds) {
 		if (current_speed == 10) {
@@ -1614,5 +1763,27 @@
 {
 	return etrax_ethernet_init();
 }
+
+static int __init
+e100_boot_setup(char* str)
+{
+	struct sockaddr sa = {0};
+	int i;
+
+	/* Parse the colon separated Ethernet station address */
+	for (i = 0; i <  ETH_ALEN; i++) {
+		unsigned int tmp;
+		if (sscanf(str + 3*i, "%2x", &tmp) != 1) {
+			printk(KERN_WARNING "Malformed station address");
+			return 0;
+		}
+		sa.sa_data[i] = (char)tmp;
+	}
+
+	default_mac = sa;
+	return 1;
+}
+
+__setup("etrax100_eth=", e100_boot_setup);
 
 module_init(etrax_init_module);
diff -Nru a/arch/cris/arch-v10/drivers/gpio.c b/arch/cris/arch-v10/drivers/gpio.c
--- a/arch/cris/arch-v10/drivers/gpio.c	2004-06-02 23:26:58 -07:00
+++ b/arch/cris/arch-v10/drivers/gpio.c	2004-06-02 23:26:58 -07:00
@@ -1,4 +1,4 @@
-/* $Id: gpio.c,v 1.8 2003/07/04 08:27:37 starvik Exp $
+/* $Id: gpio.c,v 1.11 2004/05/14 07:58:03 starvik Exp $
  *
  * Etrax general port I/O device
  *
@@ -9,6 +9,12 @@
  *             Johan Adolfsson  (read/set directions, write, port G)
  *
  * $Log: gpio.c,v $
+ * Revision 1.11  2004/05/14 07:58:03  starvik
+ * Merge of changes from 2.4
+ *
+ * Revision 1.9  2003/09/11 07:29:48  starvik
+ * Merge of Linux 2.6.0-test5
+ *
  * Revision 1.8  2003/07/04 08:27:37  starvik
  * Merge of Linux 2.5.74
  *
@@ -183,6 +189,7 @@
 static struct gpio_private *alarmlist = 0;
 
 static int gpio_some_alarms = 0; /* Set if someone uses alarm */
+static unsigned long gpio_pa_irq_enabled_mask = 0;
 
 /* Port A and B use 8 bit access, but Port G is 32 bit */
 #define NUM_PORTS (GPIO_MINOR_B+1)
@@ -252,13 +259,19 @@
 	unsigned long data;
 	poll_wait(file, &priv->alarm_wq, wait);
 	if (priv->minor == GPIO_MINOR_A) {
+		unsigned long flags;
 		unsigned long tmp;
 		data = *R_PORT_PA_DATA;
 		/* PA has support for high level interrupt -
 		 * lets activate for those low and with highalarm set
 		 */
 		tmp = ~data & priv->highalarm & 0xFF;
-		*R_IRQ_MASK1_SET = (tmp << R_IRQ_MASK1_SET__pa0__BITNR);
+		tmp = (tmp << R_IRQ_MASK1_SET__pa0__BITNR);
+		save_flags(flags); cli();
+		gpio_pa_irq_enabled_mask |= tmp;
+		*R_IRQ_MASK1_SET = tmp;
+		restore_flags(flags);
+
 	} else if (priv->minor == GPIO_MINOR_B)
 		data = *R_PORT_PB_DATA;
 	else if (priv->minor == GPIO_MINOR_G)
@@ -312,12 +325,15 @@
 {
 	unsigned long tmp;
 	/* Find what PA interrupts are active */
-	tmp = (*R_IRQ_READ1 >> R_IRQ_READ1__pa0__BITNR) & 0xFF;
+	tmp = (*R_IRQ_READ1);
+
+	/* Find those that we have enabled */
+	tmp &= gpio_pa_irq_enabled_mask;
+
 	/* Clear them.. */
-	/* NOTE: Maybe we need to be more careful here if some other
-	 * driver uses PA interrupt as well?
-	 */
-	*R_IRQ_MASK1_CLR = (tmp << R_IRQ_MASK1_CLR__pa0__BITNR);
+	*R_IRQ_MASK1_CLR = tmp;
+	gpio_pa_irq_enabled_mask &= ~tmp;
+
 	if (gpio_some_alarms) {
 		return IRQ_RETVAL(etrax_gpio_wake_up_check());
 	}
@@ -386,7 +402,7 @@
 gpio_open(struct inode *inode, struct file *filp)
 {
 	struct gpio_private *priv;
-	int p = iminor(inode);
+	int p = MINOR(inode->i_rdev);
 
 	if (p > GPIO_MINOR_LAST)
 		return -EINVAL;
@@ -479,6 +495,7 @@
 		return ~(*priv->dir_shadow) & 0xFF; /* Only 8 bits */
 	} else if (priv->minor == GPIO_MINOR_G) {
 		/* We must fiddle with R_GEN_CONFIG to change dir */
+		save_flags(flags); cli();
 		if (((arg & dir_g_in_bits) != arg) && 
 		    (arg & changeable_dir_g)) {
 			arg &= changeable_dir_g;
@@ -503,16 +520,17 @@
 				dir_g_in_bits |= (1<<24);
 				dir_g_out_bits &= ~(1<<24);
 			}
-			printk("gpio: SETINPUT on port G set "
-				"genconfig to 0x%08lX "
-				"in_bits: 0x%08lX "
-				"out_bits: 0x%08lX\n", 
-			       (unsigned long)genconfig_shadow, 
-			       dir_g_in_bits, dir_g_out_bits);
+			D(printk(KERN_INFO "gpio: SETINPUT on port G set "
+				 "genconfig to 0x%08lX "
+				 "in_bits: 0x%08lX "
+				 "out_bits: 0x%08lX\n",
+			         (unsigned long)genconfig_shadow,
+			         dir_g_in_bits, dir_g_out_bits));
 			*R_GEN_CONFIG = genconfig_shadow;
 			/* Must be a >120 ns delay before writing this again */
 				
 		}
+		restore_flags(flags);
 		return dir_g_in_bits;
 	}
 	return 0;
@@ -529,6 +547,7 @@
 		return *priv->dir_shadow;
 	} else if (priv->minor == GPIO_MINOR_G) {
 		/* We must fiddle with R_GEN_CONFIG to change dir */			
+		save_flags(flags); cli();
 		if (((arg & dir_g_out_bits) != arg) &&
 		    (arg & changeable_dir_g)) {
 			/* Set bits in genconfig to set to output */
@@ -552,15 +571,16 @@
 				dir_g_out_bits |= (1<<24);
 				dir_g_in_bits &= ~(1<<24);
 			}
-			printk("gpio: SETOUTPUT on port G set "
-				"genconfig to 0x%08lX "
-				"in_bits: 0x%08lX "
-				"out_bits: 0x%08lX\n", 
-			       (unsigned long)genconfig_shadow, 
-			       dir_g_in_bits, dir_g_out_bits);
+			D(printk(KERN_INFO "gpio: SETOUTPUT on port G set "
+				 "genconfig to 0x%08lX "
+				 "in_bits: 0x%08lX "
+				 "out_bits: 0x%08lX\n",
+			         (unsigned long)genconfig_shadow,
+			         dir_g_in_bits, dir_g_out_bits));
 			*R_GEN_CONFIG = genconfig_shadow;
 			/* Must be a >120 ns delay before writing this again */
 		}
+		restore_flags(flags);
 		return dir_g_out_bits & 0x7FFFFFFF;
 	}
 	return 0;
@@ -625,6 +645,20 @@
 		// clear alarm for bits with 1 in arg
 		priv->highalarm &= ~arg;
 		priv->lowalarm  &= ~arg;
+		{
+			/* Must update gpio_some_alarms */
+			struct gpio_private *p = alarmlist;
+			int some_alarms;
+			some_alarms = 0;
+			while (p) {
+				if (p->highalarm | p->lowalarm) {
+					some_alarms = 1;
+					break;
+				}
+				p = p->next;
+			}
+			gpio_some_alarms = some_alarms;
+		}
 		break;
 	case IO_READDIR: /* Use IO_SETGET_INPUT/OUTPUT instead! */
 		/* Read direction 0=input 1=output */
@@ -844,9 +878,9 @@
 	dir_g_in_bits |= (~dir_g_shadow & changeable_dir_g);
 
 
-	printk("GPIO port G: in_bits: 0x%08lX out_bits: 0x%08lX val: %08lX\n",
+	printk(KERN_INFO "GPIO port G: in_bits: 0x%08lX out_bits: 0x%08lX val: %08lX\n",
 	       dir_g_in_bits, dir_g_out_bits, (unsigned long)*R_PORT_G_DATA);
-	printk("GPIO port G: dir: %08lX changeable: %08lX\n", 
+	printk(KERN_INFO "GPIO port G: dir: %08lX changeable: %08lX\n",
 	       dir_g_shadow, changeable_dir_g);
 }
 
@@ -883,7 +917,7 @@
 
 #endif
 	gpio_init_port_g();
-	printk("ETRAX 100LX GPIO driver v2.5, (c) 2001, 2002 Axis Communications AB\n");
+	printk(KERN_INFO "ETRAX 100LX GPIO driver v2.5, (c) 2001, 2002 Axis Communications AB\n");
 	/* We call etrax_gpio_wake_up_check() from timer interrupt and
 	 * from cpu_idle() in kernel/process.c
 	 * The check in cpu_idle() reduces latency from ~15 ms to ~6 ms
@@ -891,11 +925,11 @@
 	 */  
 	if (request_irq(TIMER0_IRQ_NBR, gpio_poll_timer_interrupt,
 			SA_SHIRQ | SA_INTERRUPT,"gpio poll", NULL)) {
-		printk("err: timer0 irq for gpio\n");
+		printk(KERN_CRIT "err: timer0 irq for gpio\n");
 	}
 	if (request_irq(PA_IRQ_NBR, gpio_pa_interrupt,
 			SA_SHIRQ | SA_INTERRUPT,"gpio PA", NULL)) {
-		printk("err: PA irq for gpio\n");
+		printk(KERN_CRIT "err: PA irq for gpio\n");
 	}
 	
 
diff -Nru a/arch/cris/arch-v10/drivers/i2c.c b/arch/cris/arch-v10/drivers/i2c.c
--- a/arch/cris/arch-v10/drivers/i2c.c	2004-06-02 23:26:58 -07:00
+++ b/arch/cris/arch-v10/drivers/i2c.c	2004-06-02 23:26:58 -07:00
@@ -12,6 +12,12 @@
 *!                                 don't use PB_I2C if DS1302 uses same bits,
 *!                                 use PB.
 *! $Log: i2c.c,v $
+*! Revision 1.7  2004/05/28 09:26:59  starvik
+*! Modified I2C initialization to work in 2.6.
+*!
+*! Revision 1.6  2004/05/14 07:58:03  starvik
+*! Merge of changes from 2.4
+*!
 *! Revision 1.4  2002/12/11 13:13:57  starvik
 *! Added arch/ to v10 specific includes
 *! Added fix from Linux 2.4 in serial.c (flush_to_flip_buffer)
@@ -63,7 +69,7 @@
 *! (C) Copyright 1999-2002 Axis Communications AB, LUND, SWEDEN
 *!
 *!***************************************************************************/
-/* $Id: i2c.c,v 1.4 2002/12/11 13:13:57 starvik Exp $ */
+/* $Id: i2c.c,v 1.7 2004/05/28 09:26:59 starvik Exp $ */
 
 /****************** INCLUDE FILES SECTION ***********************************/
 
@@ -310,6 +316,12 @@
 	}
 	i2c_clk(I2C_CLOCK_HIGH);
 	i2c_delay(CLOCK_HIGH_TIME);
+
+        /*
+	 * we leave the clock low, getbyte is usually followed
+	 * by sendack/nack, they assume the clock to be low
+	 */
+        i2c_clk(I2C_CLOCK_LOW);
 	return aBitByte;
 }
 
@@ -372,6 +384,13 @@
 	}
 
 	/*
+	 * our clock is high now, make sure data is low
+	 * before we enable our output. If we keep data high
+	 * and enable output, we would generate a stop condition.
+	 */
+	i2c_data(I2C_DATA_LOW);
+
+	/*
 	 * end clock pulse
 	 */
 	i2c_enable();
@@ -428,6 +447,37 @@
 
 /*#---------------------------------------------------------------------------
 *#
+*# FUNCTION NAME: i2c_sendnack
+*#
+*# DESCRIPTION  : Sends NACK on received data
+*#
+*#--------------------------------------------------------------------------*/
+void
+i2c_sendnack(void)
+{
+	/*
+	 * enable output
+	 */
+	i2c_delay(CLOCK_LOW_TIME);
+	i2c_dir_out();
+	/*
+	 * set data high
+	 */
+	i2c_data(I2C_DATA_HIGH);
+	/*
+	 * generate clock pulse
+	 */
+	i2c_delay(CLOCK_HIGH_TIME/6);
+	i2c_clk(I2C_CLOCK_HIGH);
+	i2c_delay(CLOCK_HIGH_TIME);
+	i2c_clk(I2C_CLOCK_LOW);
+	i2c_delay(CLOCK_LOW_TIME);
+
+	i2c_dir_in();
+}
+
+/*#---------------------------------------------------------------------------
+*#
 *# FUNCTION NAME: i2c_writereg
 *#
 *# DESCRIPTION  : Writes a value to an I2C device
@@ -489,7 +539,7 @@
 	} while(error && cntr--);
 
 	i2c_delay(CLOCK_LOW_TIME);
-	
+
 	return -error;
 }
 
@@ -557,7 +607,8 @@
 		 */
 		b = i2c_inbyte();
 		/*
-		 * send Ack
+		 * last received byte needs to be nacked
+		 * instead of acked
 		 */
 		i2c_sendack();
 		/*
@@ -634,11 +685,9 @@
 	.release  = i2c_release,
 };
 
-static int __init
+int __init
 i2c_init(void)
 {
-	int res;
-
 	/* Setup and enable the Port B I2C interface */
 
 #ifndef CONFIG_ETRAX_I2C_USES_PB_NOT_PB_I2C
@@ -656,21 +705,28 @@
 			  IO_STATE(R_PORT_PB_DIR, dir0, input)  |
 			  IO_STATE(R_PORT_PB_DIR, dir1, output));
 
-	/* register char device */
+	return 0;
+}
+
+static int __init
+i2c_register(void)
+{
+	int res;
 
-	res = register_chrdev(I2C_MAJOR, i2c_name, &i2c_fops);
+	i2c_init();
+  	res = register_chrdev(I2C_MAJOR, i2c_name, &i2c_fops);
 	if(res < 0) {
 		printk(KERN_ERR "i2c: couldn't get a major number.\n");
 		return res;
 	}
 
-	printk("I2C driver v2.2, (c) 1999-2001 Axis Communications AB\n");
+	printk(KERN_INFO "I2C driver v2.2, (c) 1999-2001 Axis Communications AB\n");
 	
 	return 0;
 }
 
-/* this makes sure that i2c_init is called during boot */
+/* this makes sure that i2c_register is called during boot */
 
-module_init(i2c_init);
+module_init(i2c_register);
 
 /****************** END OF FILE i2c.c ********************************/
diff -Nru a/arch/cris/arch-v10/drivers/i2c.h b/arch/cris/arch-v10/drivers/i2c.h
--- a/arch/cris/arch-v10/drivers/i2c.h	2004-06-02 23:27:00 -07:00
+++ b/arch/cris/arch-v10/drivers/i2c.h	2004-06-02 23:27:00 -07:00
@@ -1,4 +1,6 @@
-/* $Id: i2c.h,v 1.2 2002/11/18 13:16:06 starvik Exp $ */
+/* $Id: i2c.h,v 1.3 2004/05/28 09:26:59 starvik Exp $ */
+
+int i2c_init(void);
 
 /* High level I2C actions */
 int i2c_writereg(unsigned char theSlave, unsigned char theReg, unsigned char theValue);
diff -Nru a/arch/cris/arch-v10/drivers/ide.c b/arch/cris/arch-v10/drivers/ide.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/arch/cris/arch-v10/drivers/ide.c	2004-06-02 23:27:00 -07:00
@@ -0,0 +1,945 @@
+/* $Id: ide.c,v 1.1 2004/01/22 08:22:58 starvik Exp $
+ *
+ * Etrax specific IDE functions, like init and PIO-mode setting etc.
+ * Almost the entire ide.c is used for the rest of the Etrax ATA driver.
+ * Copyright (c) 2000-2004 Axis Communications AB
+ *
+ * Authors:    Bjorn Wesen        (initial version)
+ *             Mikael Starvik     (pio setup stuff, Linux 2.6 port)
+ */
+
+/* Regarding DMA:
+ *
+ * There are two forms of DMA - "DMA handshaking" between the interface and the drive,
+ * and DMA between the memory and the interface. We can ALWAYS use the latter, since it's
+ * something built-in in the Etrax. However only some drives support the DMA-mode handshaking
+ * on the ATA-bus. The normal PC driver and Triton interface disables memory-if DMA when the
+ * device can't do DMA handshaking for some stupid reason. We don't need to do that.
+ */
+
+#undef REALLY_SLOW_IO           /* most systems can safely undef this */
+
+#include <linux/config.h>
+#include <linux/types.h>
+#include <linux/kernel.h>
+#include <linux/timer.h>
+#include <linux/mm.h>
+#include <linux/interrupt.h>
+#include <linux/delay.h>
+#include <linux/blkdev.h>
+#include <linux/hdreg.h>
+#include <linux/ide.h>
+#include <linux/init.h>
+
+#include <asm/io.h>
+#include <asm/arch/svinto.h>
+#include <asm/dma.h>
+
+/* number of Etrax DMA descriptors */
+#define MAX_DMA_DESCRS 64
+
+/* number of times to retry busy-flags when reading/writing IDE-registers
+ * this can't be too high because a hung harddisk might cause the watchdog
+ * to trigger (sometimes INB and OUTB are called with irq's disabled)
+ */
+
+#define IDE_REGISTER_TIMEOUT 300
+
+#ifdef CONFIG_ETRAX_IDE_CSE1_16_RESET
+/* address where the memory-mapped IDE reset bit lives, if used */
+static volatile unsigned long *reset_addr;
+#endif
+
+static int e100_read_command = 0;
+
+#define LOWDB(x)
+#define D(x)
+
+void
+etrax100_ide_outw(unsigned short data, ide_ioreg_t reg) {
+	int timeleft;
+	LOWDB(printk("ow: data 0x%x, reg 0x%x\n", data, reg));
+
+	/* note the lack of handling any timeouts. we stop waiting, but we don't
+	 * really notify anybody.
+	 */
+
+	timeleft = IDE_REGISTER_TIMEOUT;
+	/* wait for busy flag */
+	while(timeleft && (*R_ATA_STATUS_DATA & IO_MASK(R_ATA_STATUS_DATA, busy)))
+		timeleft--;
+
+	/*
+	 * Fall through at a timeout, so the ongoing command will be
+	 * aborted by the write below, which is expected to be a dummy
+	 * command to the command register.  This happens when a faulty
+	 * drive times out on a command.  See comment on timeout in
+	 * INB.
+	 */
+	if(!timeleft)
+		printk("ATA timeout reg 0x%lx := 0x%x\n", reg, data);
+
+	*R_ATA_CTRL_DATA = reg | data; /* write data to the drive's register */
+
+	timeleft = IDE_REGISTER_TIMEOUT;
+	/* wait for transmitter ready */
+	while(timeleft && !(*R_ATA_STATUS_DATA &
+			    IO_MASK(R_ATA_STATUS_DATA, tr_rdy)))
+		timeleft--;
+}
+
+void
+etrax100_ide_outb(unsigned char data, ide_ioreg_t reg)
+{
+	etrax100_ide_outw(data, reg);
+}
+
+void
+etrax100_ide_outbsync(ide_drive_t *drive, u8 addr, unsigned long port)
+{
+	etrax100_ide_outw(addr, port);
+}
+
+unsigned short
+etrax100_ide_inw(ide_ioreg_t reg) {
+	int status;
+	int timeleft;
+
+	timeleft = IDE_REGISTER_TIMEOUT;
+	/* wait for busy flag */
+	while(timeleft && (*R_ATA_STATUS_DATA & IO_MASK(R_ATA_STATUS_DATA, busy)))
+		timeleft--;
+
+	if(!timeleft) {
+		/*
+		 * If we're asked to read the status register, like for
+		 * example when a command does not complete for an
+		 * extended time, but the ATA interface is stuck in a
+		 * busy state at the *ETRAX* ATA interface level (as has
+		 * happened repeatedly with at least one bad disk), then
+		 * the best thing to do is to pretend that we read
+		 * "busy" in the status register, so the IDE driver will
+		 * time-out, abort the ongoing command and perform a
+		 * reset sequence.  Note that the subsequent OUT_BYTE
+		 * call will also timeout on busy, but as long as the
+		 * write is still performed, everything will be fine.
+		 */
+		if ((reg & IO_MASK (R_ATA_CTRL_DATA, addr))
+		    == IO_FIELD (R_ATA_CTRL_DATA, addr, IDE_STATUS_OFFSET))
+			return BUSY_STAT;
+		else
+			/* For other rare cases we assume 0 is good enough.  */
+			return 0;
+	}
+
+	*R_ATA_CTRL_DATA = reg | IO_STATE(R_ATA_CTRL_DATA, rw, read); /* read data */
+
+	timeleft = IDE_REGISTER_TIMEOUT;
+	/* wait for available */
+	while(timeleft && !((status = *R_ATA_STATUS_DATA) &
+			    IO_MASK(R_ATA_STATUS_DATA, dav)))
+		timeleft--;
+
+	if(!timeleft)
+		return 0;
+
+	LOWDB(printk("inb: 0x%x from reg 0x%x\n", status & 0xff, reg));
+
+        return (unsigned short)status;
+}
+
+unsigned char
+etrax100_ide_inb(ide_ioreg_t reg)
+{
+	return (unsigned char)etrax100_ide_inw(reg);
+}
+
+/* PIO timing (in R_ATA_CONFIG)
+ *
+ *                        _____________________________
+ * ADDRESS :     ________/
+ *
+ *                            _______________
+ * DIOR    :     ____________/               \__________
+ *
+ *                               _______________
+ * DATA    :     XXXXXXXXXXXXXXXX_______________XXXXXXXX
+ *
+ *
+ * DIOR is unbuffered while address and data is buffered.
+ * This creates two problems:
+ * 1. The DIOR pulse is to early (because it is unbuffered)
+ * 2. The rise time of DIOR is long
+ *
+ * There are at least three different plausible solutions
+ * 1. Use a pad capable of larger currents in Etrax
+ * 2. Use an external buffer
+ * 3. Make the strobe pulse longer
+ *
+ * Some of the strobe timings below are modified to compensate
+ * for this. This implies a slight performance decrease.
+ *
+ * THIS SHOULD NEVER BE CHANGED!
+ *
+ * TODO: Is this true for the latest LX boards still ?
+ */
+
+#define ATA_DMA2_STROBE  4
+#define ATA_DMA2_HOLD    0
+#define ATA_DMA1_STROBE  4
+#define ATA_DMA1_HOLD    1
+#define ATA_DMA0_STROBE 12
+#define ATA_DMA0_HOLD    9
+#define ATA_PIO4_SETUP   1
+#define ATA_PIO4_STROBE  5
+#define ATA_PIO4_HOLD    0
+#define ATA_PIO3_SETUP   1
+#define ATA_PIO3_STROBE  5
+#define ATA_PIO3_HOLD    1
+#define ATA_PIO2_SETUP   1
+#define ATA_PIO2_STROBE  6
+#define ATA_PIO2_HOLD    2
+#define ATA_PIO1_SETUP   2
+#define ATA_PIO1_STROBE 11
+#define ATA_PIO1_HOLD    4
+#define ATA_PIO0_SETUP   4
+#define ATA_PIO0_STROBE 19
+#define ATA_PIO0_HOLD    4
+
+static int e100_dma_check (ide_drive_t *drive);
+static int e100_dma_begin (ide_drive_t *drive);
+static int e100_dma_end (ide_drive_t *drive);
+static int e100_dma_read (ide_drive_t *drive);
+static int e100_dma_write (ide_drive_t *drive);
+static void e100_ide_input_data (ide_drive_t *drive, void *, unsigned int);
+static void e100_ide_output_data (ide_drive_t *drive, void *, unsigned int);
+static void e100_atapi_input_bytes(ide_drive_t *drive, void *, unsigned int);
+static void e100_atapi_output_bytes(ide_drive_t *drive, void *, unsigned int);
+static int e100_dma_off (ide_drive_t *drive);
+static int e100_dma_verbose (ide_drive_t *drive);
+
+
+/*
+ * good_dma_drives() lists the model names (from "hdparm -i")
+ * of drives which do not support mword2 DMA but which are
+ * known to work fine with this interface under Linux.
+ */
+
+const char *good_dma_drives[] = {"Micropolis 2112A",
+				 "CONNER CTMA 4000",
+				 "CONNER CTT8000-A",
+				 NULL};
+
+static void tune_e100_ide(ide_drive_t *drive, byte pio)
+{
+	pio = 4;
+	/* pio = ide_get_best_pio_mode(drive, pio, 4, NULL); */
+
+	/* set pio mode! */
+
+	switch(pio) {
+		case 0:
+			*R_ATA_CONFIG = ( IO_FIELD( R_ATA_CONFIG, enable,     1 ) |
+					  IO_FIELD( R_ATA_CONFIG, dma_strobe, ATA_DMA2_STROBE ) |
+					  IO_FIELD( R_ATA_CONFIG, dma_hold,   ATA_DMA2_HOLD ) |
+					  IO_FIELD( R_ATA_CONFIG, pio_setup,  ATA_PIO0_SETUP ) |
+					  IO_FIELD( R_ATA_CONFIG, pio_strobe, ATA_PIO0_STROBE ) |
+					  IO_FIELD( R_ATA_CONFIG, pio_hold,   ATA_PIO0_HOLD ) );
+			break;
+		case 1:
+			*R_ATA_CONFIG = ( IO_FIELD( R_ATA_CONFIG, enable,     1 ) |
+					  IO_FIELD( R_ATA_CONFIG, dma_strobe, ATA_DMA2_STROBE ) |
+					  IO_FIELD( R_ATA_CONFIG, dma_hold,   ATA_DMA2_HOLD ) |
+					  IO_FIELD( R_ATA_CONFIG, pio_setup,  ATA_PIO1_SETUP ) |
+					  IO_FIELD( R_ATA_CONFIG, pio_strobe, ATA_PIO1_STROBE ) |
+					  IO_FIELD( R_ATA_CONFIG, pio_hold,   ATA_PIO1_HOLD ) );
+			break;
+		case 2:
+			*R_ATA_CONFIG = ( IO_FIELD( R_ATA_CONFIG, enable,     1 ) |
+					  IO_FIELD( R_ATA_CONFIG, dma_strobe, ATA_DMA2_STROBE ) |
+					  IO_FIELD( R_ATA_CONFIG, dma_hold,   ATA_DMA2_HOLD ) |
+					  IO_FIELD( R_ATA_CONFIG, pio_setup,  ATA_PIO2_SETUP ) |
+					  IO_FIELD( R_ATA_CONFIG, pio_strobe, ATA_PIO2_STROBE ) |
+					  IO_FIELD( R_ATA_CONFIG, pio_hold,   ATA_PIO2_HOLD ) );
+			break;
+		case 3:
+			*R_ATA_CONFIG = ( IO_FIELD( R_ATA_CONFIG, enable,     1 ) |
+					  IO_FIELD( R_ATA_CONFIG, dma_strobe, ATA_DMA2_STROBE ) |
+					  IO_FIELD( R_ATA_CONFIG, dma_hold,   ATA_DMA2_HOLD ) |
+					  IO_FIELD( R_ATA_CONFIG, pio_setup,  ATA_PIO3_SETUP ) |
+					  IO_FIELD( R_ATA_CONFIG, pio_strobe, ATA_PIO3_STROBE ) |
+					  IO_FIELD( R_ATA_CONFIG, pio_hold,   ATA_PIO3_HOLD ) );
+			break;
+		case 4:
+			*R_ATA_CONFIG = ( IO_FIELD( R_ATA_CONFIG, enable,     1 ) |
+					  IO_FIELD( R_ATA_CONFIG, dma_strobe, ATA_DMA2_STROBE ) |
+					  IO_FIELD( R_ATA_CONFIG, dma_hold,   ATA_DMA2_HOLD ) |
+					  IO_FIELD( R_ATA_CONFIG, pio_setup,  ATA_PIO4_SETUP ) |
+					  IO_FIELD( R_ATA_CONFIG, pio_strobe, ATA_PIO4_STROBE ) |
+					  IO_FIELD( R_ATA_CONFIG, pio_hold,   ATA_PIO4_HOLD ) );
+			break;
+	}
+}
+
+void __init
+init_e100_ide (void)
+{
+	volatile unsigned int dummy;
+	int h;
+
+	printk("ide: ETRAX 100LX built-in ATA DMA controller\n");
+
+	/* first fill in some stuff in the ide_hwifs fields */
+
+	for(h = 0; h < MAX_HWIFS; h++) {
+		ide_hwif_t *hwif = &ide_hwifs[h];
+		hwif->mmio = 2;
+		hwif->chipset = ide_etrax100;
+		hwif->tuneproc = &tune_e100_ide;
+                hwif->ata_input_data = &e100_ide_input_data;
+                hwif->ata_output_data = &e100_ide_output_data;
+                hwif->atapi_input_bytes = &e100_atapi_input_bytes;
+                hwif->atapi_output_bytes = &e100_atapi_output_bytes;
+                hwif->ide_dma_check = &e100_dma_check;
+                hwif->ide_dma_end = &e100_dma_end;
+		hwif->ide_dma_write = &e100_dma_write;
+		hwif->ide_dma_read = &e100_dma_read;
+		hwif->ide_dma_begin = &e100_dma_begin;
+		hwif->OUTB = &etrax100_ide_outb;
+		hwif->OUTW = &etrax100_ide_outw;
+		hwif->OUTBSYNC = &etrax100_ide_outbsync;
+		hwif->INB = &etrax100_ide_inb;
+		hwif->INW = &etrax100_ide_inw;
+		hwif->ide_dma_off_quietly = &e100_dma_off;
+		hwif->ide_dma_verbose = &e100_dma_verbose;
+		hwif->sg_table =
+		  kmalloc(sizeof(struct scatterlist) * PRD_ENTRIES, GFP_KERNEL);
+	}
+
+	/* actually reset and configure the etrax100 ide/ata interface */
+
+	*R_ATA_CTRL_DATA = 0;
+	*R_ATA_TRANSFER_CNT = 0;
+	*R_ATA_CONFIG = 0;
+
+	genconfig_shadow = (genconfig_shadow &
+			    ~IO_MASK(R_GEN_CONFIG, dma2) &
+			    ~IO_MASK(R_GEN_CONFIG, dma3) &
+			    ~IO_MASK(R_GEN_CONFIG, ata)) |
+		( IO_STATE( R_GEN_CONFIG, dma3, ata    ) |
+		  IO_STATE( R_GEN_CONFIG, dma2, ata    ) |
+		  IO_STATE( R_GEN_CONFIG, ata,  select ) );
+
+	*R_GEN_CONFIG = genconfig_shadow;
+
+        /* pull the chosen /reset-line low */
+
+#ifdef CONFIG_ETRAX_IDE_G27_RESET
+        REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow, 27, 0);
+#endif
+#ifdef CONFIG_ETRAX_IDE_CSE1_16_RESET
+        REG_SHADOW_SET(port_cse1_addr, port_cse1_shadow, 16, 0);
+#endif
+#ifdef CONFIG_ETRAX_IDE_CSP0_8_RESET
+        REG_SHADOW_SET(port_csp0_addr, port_csp0_shadow, 8, 0);
+#endif
+#ifdef CONFIG_ETRAX_IDE_PB7_RESET
+	port_pb_dir_shadow = port_pb_dir_shadow |
+		IO_STATE(R_PORT_PB_DIR, dir7, output);
+	*R_PORT_PB_DIR = port_pb_dir_shadow;
+	REG_SHADOW_SET(R_PORT_PB_DATA, port_pb_data_shadow, 7, 1);
+#endif
+
+	/* wait some */
+
+	udelay(25);
+
+	/* de-assert bus-reset */
+
+#ifdef CONFIG_ETRAX_IDE_CSE1_16_RESET
+	REG_SHADOW_SET(port_cse1_addr, port_cse1_shadow, 16, 1);
+#endif
+#ifdef CONFIG_ETRAX_IDE_CSP0_8_RESET
+	REG_SHADOW_SET(port_csp0_addr, port_csp0_shadow, 8, 1);
+#endif
+#ifdef CONFIG_ETRAX_IDE_G27_RESET
+	REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow, 27, 1);
+#endif
+
+	/* make a dummy read to set the ata controller in a proper state */
+	dummy = *R_ATA_STATUS_DATA;
+
+	*R_ATA_CONFIG = ( IO_FIELD( R_ATA_CONFIG, enable,     1 ) |
+			  IO_FIELD( R_ATA_CONFIG, dma_strobe, ATA_DMA2_STROBE ) |
+			  IO_FIELD( R_ATA_CONFIG, dma_hold,   ATA_DMA2_HOLD ) |
+			  IO_FIELD( R_ATA_CONFIG, pio_setup,  ATA_PIO4_SETUP ) |
+			  IO_FIELD( R_ATA_CONFIG, pio_strobe, ATA_PIO4_STROBE ) |
+			  IO_FIELD( R_ATA_CONFIG, pio_hold,   ATA_PIO4_HOLD ) );
+
+	*R_ATA_CTRL_DATA = ( IO_STATE( R_ATA_CTRL_DATA, rw,   read) |
+			     IO_FIELD( R_ATA_CTRL_DATA, addr, 1   ) );
+
+	while(*R_ATA_STATUS_DATA & IO_MASK(R_ATA_STATUS_DATA, busy)); /* wait for busy flag*/
+
+	*R_IRQ_MASK0_SET = ( IO_STATE( R_IRQ_MASK0_SET, ata_irq0, set ) |
+			     IO_STATE( R_IRQ_MASK0_SET, ata_irq1, set ) |
+			     IO_STATE( R_IRQ_MASK0_SET, ata_irq2, set ) |
+			     IO_STATE( R_IRQ_MASK0_SET, ata_irq3, set ) );
+
+	printk("ide: waiting %d seconds for drives to regain consciousness\n",
+	       CONFIG_ETRAX_IDE_DELAY);
+
+	h = jiffies + (CONFIG_ETRAX_IDE_DELAY * HZ);
+	while(time_before(jiffies, h)) /* nothing */ ;
+
+	/* reset the dma channels we will use */
+
+	RESET_DMA(ATA_TX_DMA_NBR);
+	RESET_DMA(ATA_RX_DMA_NBR);
+	WAIT_DMA(ATA_TX_DMA_NBR);
+	WAIT_DMA(ATA_RX_DMA_NBR);
+
+}
+
+static int e100_dma_off (ide_drive_t *drive)
+{
+	return 0;
+}
+
+static int e100_dma_verbose (ide_drive_t *drive)
+{
+	printk(", DMA(mode 2)");
+	return 0;
+}
+
+static etrax_dma_descr mydescr;
+
+/*
+ * The following routines are mainly used by the ATAPI drivers.
+ *
+ * These routines will round up any request for an odd number of bytes,
+ * so if an odd bytecount is specified, be sure that there's at least one
+ * extra byte allocated for the buffer.
+ */
+static void
+e100_atapi_input_bytes (ide_drive_t *drive, void *buffer, unsigned int bytecount)
+{
+	ide_ioreg_t data_reg = IDE_DATA_REG;
+
+	D(printk("atapi_input_bytes, dreg 0x%x, buffer 0x%x, count %d\n",
+		 data_reg, buffer, bytecount));
+
+	if(bytecount & 1) {
+		printk("warning, odd bytecount in cdrom_in_bytes = %d.\n", bytecount);
+		bytecount++; /* to round off */
+	}
+
+	/* make sure the DMA channel is available */
+	RESET_DMA(ATA_RX_DMA_NBR);
+	WAIT_DMA(ATA_RX_DMA_NBR);
+
+	/* setup DMA descriptor */
+
+	mydescr.sw_len = bytecount;
+	mydescr.ctrl   = d_eol;
+	mydescr.buf    = virt_to_phys(buffer);
+
+	/* start the dma channel */
+
+	*R_DMA_CH3_FIRST = virt_to_phys(&mydescr);
+	*R_DMA_CH3_CMD   = IO_STATE(R_DMA_CH3_CMD, cmd, start);
+
+	/* initiate a multi word dma read using PIO handshaking */
+
+	*R_ATA_TRANSFER_CNT = IO_FIELD(R_ATA_TRANSFER_CNT, count, bytecount >> 1);
+
+	*R_ATA_CTRL_DATA = data_reg |
+		IO_STATE(R_ATA_CTRL_DATA, rw,       read) |
+		IO_STATE(R_ATA_CTRL_DATA, src_dst,  dma) |
+		IO_STATE(R_ATA_CTRL_DATA, handsh,   pio) |
+		IO_STATE(R_ATA_CTRL_DATA, multi,    on) |
+		IO_STATE(R_ATA_CTRL_DATA, dma_size, word);
+
+	/* wait for completion */
+
+	LED_DISK_READ(1);
+	WAIT_DMA(ATA_RX_DMA_NBR);
+	LED_DISK_READ(0);
+
+#if 0
+        /* old polled transfer code
+	 * this should be moved into a new function that can do polled
+	 * transfers if DMA is not available
+	 */
+
+        /* initiate a multi word read */
+
+        *R_ATA_TRANSFER_CNT = wcount << 1;
+
+        *R_ATA_CTRL_DATA = data_reg |
+                IO_STATE(R_ATA_CTRL_DATA, rw,       read) |
+                IO_STATE(R_ATA_CTRL_DATA, src_dst,  register) |
+                IO_STATE(R_ATA_CTRL_DATA, handsh,   pio) |
+                IO_STATE(R_ATA_CTRL_DATA, multi,    on) |
+                IO_STATE(R_ATA_CTRL_DATA, dma_size, word);
+
+        /* svinto has a latency until the busy bit actually is set */
+
+        nop(); nop();
+        nop(); nop();
+        nop(); nop();
+        nop(); nop();
+        nop(); nop();
+
+        /* unit should be busy during multi transfer */
+        while((status = *R_ATA_STATUS_DATA) & IO_MASK(R_ATA_STATUS_DATA, busy)) {
+                while(!(status & IO_MASK(R_ATA_STATUS_DATA, dav)))
+                        status = *R_ATA_STATUS_DATA;
+                *ptr++ = (unsigned short)(status & 0xffff);
+        }
+#endif
+}
+
+static void
+e100_atapi_output_bytes (ide_drive_t *drive, void *buffer, unsigned int bytecount)
+{
+	ide_ioreg_t data_reg = IDE_DATA_REG;
+
+	D(printk("atapi_output_bytes, dreg 0x%x, buffer 0x%x, count %d\n",
+		 data_reg, buffer, bytecount));
+
+	if(bytecount & 1) {
+		printk("odd bytecount %d in atapi_out_bytes!\n", bytecount);
+		bytecount++;
+	}
+
+	/* make sure the DMA channel is available */
+	RESET_DMA(ATA_TX_DMA_NBR);
+	WAIT_DMA(ATA_TX_DMA_NBR);
+
+	/* setup DMA descriptor */
+
+	mydescr.sw_len = bytecount;
+	mydescr.ctrl   = d_eol;
+	mydescr.buf    = virt_to_phys(buffer);
+
+	/* start the dma channel */
+
+	*R_DMA_CH2_FIRST = virt_to_phys(&mydescr);
+	*R_DMA_CH2_CMD   = IO_STATE(R_DMA_CH2_CMD, cmd, start);
+
+	/* initiate a multi word dma write using PIO handshaking */
+
+	*R_ATA_TRANSFER_CNT = IO_FIELD(R_ATA_TRANSFER_CNT, count, bytecount >> 1);
+
+	*R_ATA_CTRL_DATA = data_reg |
+		IO_STATE(R_ATA_CTRL_DATA, rw,       write) |
+		IO_STATE(R_ATA_CTRL_DATA, src_dst,  dma) |
+		IO_STATE(R_ATA_CTRL_DATA, handsh,   pio) |
+		IO_STATE(R_ATA_CTRL_DATA, multi,    on) |
+		IO_STATE(R_ATA_CTRL_DATA, dma_size, word);
+
+	/* wait for completion */
+
+	LED_DISK_WRITE(1);
+	WAIT_DMA(ATA_TX_DMA_NBR);
+	LED_DISK_WRITE(0);
+
+#if 0
+        /* old polled write code - see comment in input_bytes */
+
+	/* wait for busy flag */
+        while(*R_ATA_STATUS_DATA & IO_MASK(R_ATA_STATUS_DATA, busy));
+
+        /* initiate a multi word write */
+
+        *R_ATA_TRANSFER_CNT = bytecount >> 1;
+
+        ctrl = data_reg |
+                IO_STATE(R_ATA_CTRL_DATA, rw,       write) |
+                IO_STATE(R_ATA_CTRL_DATA, src_dst,  register) |
+                IO_STATE(R_ATA_CTRL_DATA, handsh,   pio) |
+                IO_STATE(R_ATA_CTRL_DATA, multi,    on) |
+                IO_STATE(R_ATA_CTRL_DATA, dma_size, word);
+
+        LED_DISK_WRITE(1);
+
+        /* Etrax will set busy = 1 until the multi pio transfer has finished
+         * and tr_rdy = 1 after each successful word transfer.
+         * When the last byte has been transferred Etrax will first set tr_tdy = 1
+         * and then busy = 0 (not in the same cycle). If we read busy before it
+         * has been set to 0 we will think that we should transfer more bytes
+         * and then tr_rdy would be 0 forever. This is solved by checking busy
+         * in the inner loop.
+         */
+
+        do {
+                *R_ATA_CTRL_DATA = ctrl | *ptr++;
+                while(!(*R_ATA_STATUS_DATA & IO_MASK(R_ATA_STATUS_DATA, tr_rdy)) &&
+                      (*R_ATA_STATUS_DATA & IO_MASK(R_ATA_STATUS_DATA, busy)));
+        } while(*R_ATA_STATUS_DATA & IO_MASK(R_ATA_STATUS_DATA, busy));
+
+        LED_DISK_WRITE(0);
+#endif
+
+}
+
+/*
+ * This is used for most PIO data transfers *from* the IDE interface
+ */
+static void
+e100_ide_input_data (ide_drive_t *drive, void *buffer, unsigned int wcount)
+{
+	e100_atapi_input_bytes(drive, buffer, wcount << 2);
+}
+
+/*
+ * This is used for most PIO data transfers *to* the IDE interface
+ */
+static void
+e100_ide_output_data (ide_drive_t *drive, void *buffer, unsigned int wcount)
+{
+	e100_atapi_output_bytes(drive, buffer, wcount << 2);
+}
+
+/* we only have one DMA channel on the chip for ATA, so we can keep these statically */
+static etrax_dma_descr ata_descrs[MAX_DMA_DESCRS];
+static unsigned int ata_tot_size;
+
+/*
+ * e100_ide_build_dmatable() prepares a dma request.
+ * Returns 0 if all went okay, returns 1 otherwise.
+ */
+static int e100_ide_build_dmatable (ide_drive_t *drive)
+{
+	ide_hwif_t *hwif = HWIF(drive);
+	struct scatterlist* sg;
+	struct request *rq  = HWGROUP(drive)->rq;
+	unsigned long size, addr;
+	unsigned int count = 0;
+	int i = 0;
+
+	sg = hwif->sg_table;
+
+	ata_tot_size = 0;
+
+	if (HWGROUP(drive)->rq->flags & REQ_DRIVE_TASKFILE) {
+		u8 *virt_addr = rq->buffer;
+		int sector_count = rq->nr_sectors;
+		memset(&sg[0], 0, sizeof(*sg));
+		sg[0].page = virt_to_page(virt_addr);
+		sg[0].offset = offset_in_page(virt_addr);
+		sg[0].length =  sector_count  * SECTOR_SIZE;
+		hwif->sg_nents = i = 1;
+	}
+	else
+	{
+		hwif->sg_nents = i = blk_rq_map_sg(drive->queue, rq, hwif->sg_table);
+	}
+
+
+	while(i) {
+		/*
+		 * Determine addr and size of next buffer area.  We assume that
+		 * individual virtual buffers are always composed linearly in
+		 * physical memory.  For example, we assume that any 8kB buffer
+		 * is always composed of two adjacent physical 4kB pages rather
+		 * than two possibly non-adjacent physical 4kB pages.
+		 */
+		/* group sequential buffers into one large buffer */
+		addr = page_to_phys(sg->page) + sg->offset;
+		size = sg_dma_len(sg);
+		while (sg++, --i) {
+			if ((addr + size) != page_to_phys(sg->page) + sg->offset)
+				break;
+			size += sg_dma_len(sg);
+		}
+
+		/* did we run out of descriptors? */
+
+		if(count >= MAX_DMA_DESCRS) {
+			printk("%s: too few DMA descriptors\n", drive->name);
+			return 1;
+		}
+
+		/* however, this case is more difficult - R_ATA_TRANSFER_CNT cannot be more
+		   than 65536 words per transfer, so in that case we need to either
+		   1) use a DMA interrupt to re-trigger R_ATA_TRANSFER_CNT and continue with
+		      the descriptors, or
+		   2) simply do the request here, and get dma_intr to only ide_end_request on
+		      those blocks that were actually set-up for transfer.
+		*/
+
+		if(ata_tot_size + size > 131072) {
+			printk("too large total ATA DMA request, %d + %d!\n", ata_tot_size, (int)size);
+			return 1;
+		}
+
+		/* If size > 65536 it has to be splitted into new descriptors. Since we don't handle
+                   size > 131072 only one split is necessary */
+
+		if(size > 65536) {
+ 		        /* ok we want to do IO at addr, size bytes. set up a new descriptor entry */
+                        ata_descrs[count].sw_len = 0;  /* 0 means 65536, this is a 16-bit field */
+                        ata_descrs[count].ctrl = 0;
+                        ata_descrs[count].buf = addr;
+                        ata_descrs[count].next = virt_to_phys(&ata_descrs[count + 1]);
+                        count++;
+                        ata_tot_size += 65536;
+                        /* size and addr should refere to not handled data */
+                        size -= 65536;
+                        addr += 65536;
+                }
+		/* ok we want to do IO at addr, size bytes. set up a new descriptor entry */
+                if(size == 65536) {
+			ata_descrs[count].sw_len = 0;  /* 0 means 65536, this is a 16-bit field */
+                } else {
+			ata_descrs[count].sw_len = size;
+                }
+		ata_descrs[count].ctrl = 0;
+		ata_descrs[count].buf = addr;
+		ata_descrs[count].next = virt_to_phys(&ata_descrs[count + 1]);
+		count++;
+		ata_tot_size += size;
+	}
+
+	if (count) {
+		/* set the end-of-list flag on the last descriptor */
+		ata_descrs[count - 1].ctrl |= d_eol;
+		/* return and say all is ok */
+		return 0;
+	}
+
+	printk("%s: empty DMA table?\n", drive->name);
+	return 1;	/* let the PIO routines handle this weirdness */
+}
+
+static int config_drive_for_dma (ide_drive_t *drive)
+{
+        const char **list;
+        struct hd_driveid *id = drive->id;
+
+        if (id && (id->capability & 1)) {
+                /* Enable DMA on any drive that supports mword2 DMA */
+                if ((id->field_valid & 2) && (id->dma_mword & 0x404) == 0x404) {
+                        drive->using_dma = 1;
+                        return 0;               /* DMA enabled */
+                }
+
+                /* Consult the list of known "good" drives */
+                list = good_dma_drives;
+                while (*list) {
+                        if (!strcmp(*list++,id->model)) {
+                                drive->using_dma = 1;
+                                return 0;       /* DMA enabled */
+                        }
+                }
+        }
+        return 1;       /* DMA not enabled */
+}
+
+/*
+ * etrax_dma_intr() is the handler for disk read/write DMA interrupts
+ */
+static ide_startstop_t etrax_dma_intr (ide_drive_t *drive)
+{
+	int i, dma_stat;
+	byte stat;
+
+	LED_DISK_READ(0);
+	LED_DISK_WRITE(0);
+
+	dma_stat = HWIF(drive)->ide_dma_end(drive);
+	stat = HWIF(drive)->INB(IDE_STATUS_REG);		/* get drive status */
+	if (OK_STAT(stat,DRIVE_READY,drive->bad_wstat|DRQ_STAT)) {
+		if (!dma_stat) {
+			struct request *rq;
+			rq = HWGROUP(drive)->rq;
+			for (i = rq->nr_sectors; i > 0;) {
+				i -= rq->current_nr_sectors;
+				DRIVER(drive)->end_request(drive, 1, rq->nr_sectors);
+			}
+			return ide_stopped;
+		}
+		printk("%s: bad DMA status\n", drive->name);
+	}
+	return DRIVER(drive)->error(drive, "dma_intr", stat);
+}
+
+/*
+ * Functions below initiates/aborts DMA read/write operations on a drive.
+ *
+ * The caller is assumed to have selected the drive and programmed the drive's
+ * sector address using CHS or LBA.  All that remains is to prepare for DMA
+ * and then issue the actual read/write DMA/PIO command to the drive.
+ *
+ * For ATAPI devices, we just prepare for DMA and return. The caller should
+ * then issue the packet command to the drive and call us again with
+ * ide_dma_begin afterwards.
+ *
+ * Returns 0 if all went well.
+ * Returns 1 if DMA read/write could not be started, in which case
+ * the caller should revert to PIO for the current request.
+ */
+
+static int e100_dma_check(ide_drive_t *drive)
+{
+	return config_drive_for_dma (drive);
+}
+
+static int e100_dma_end(ide_drive_t *drive)
+{
+	/* TODO: check if something went wrong with the DMA */
+	return 0;
+}
+
+static int e100_start_dma(ide_drive_t *drive, int atapi, int reading)
+{
+	if(reading) {
+
+		RESET_DMA(ATA_RX_DMA_NBR); /* sometimes the DMA channel get stuck so we need to do this */
+		WAIT_DMA(ATA_RX_DMA_NBR);
+
+		/* set up the Etrax DMA descriptors */
+
+		if(e100_ide_build_dmatable (drive))
+			return 1;
+
+		if(!atapi) {
+			/* set the irq handler which will finish the request when DMA is done */
+
+			ide_set_handler(drive, &etrax_dma_intr, WAIT_CMD, NULL);
+
+			/* issue cmd to drive */
+                        if ((HWGROUP(drive)->rq->cmd == IDE_DRIVE_TASKFILE) &&
+			    (drive->addressing == 1)) {
+				ide_task_t *args = HWGROUP(drive)->rq->special;
+				etrax100_ide_outb(args->tfRegister[IDE_COMMAND_OFFSET], IDE_COMMAND_REG);
+			} else if (drive->addressing) {
+				etrax100_ide_outb(WIN_READDMA_EXT, IDE_COMMAND_REG);
+			} else {
+				etrax100_ide_outb(WIN_READDMA, IDE_COMMAND_REG);
+			}
+		}
+
+		/* begin DMA */
+
+		/* need to do this before RX DMA due to a chip bug
+		 * it is enough to just flush the part of the cache that
+		 * corresponds to the buffers we start, but since HD transfers
+		 * usually are more than 8 kB, it is easier to optimize for the
+		 * normal case and just flush the entire cache. its the only
+		 * way to be sure! (OB movie quote)
+		 */
+		flush_etrax_cache();
+		*R_DMA_CH3_FIRST = virt_to_phys(ata_descrs);
+		*R_DMA_CH3_CMD   = IO_STATE(R_DMA_CH3_CMD, cmd, start);
+
+		/* initiate a multi word dma read using DMA handshaking */
+
+		*R_ATA_TRANSFER_CNT =
+			IO_FIELD(R_ATA_TRANSFER_CNT, count, ata_tot_size >> 1);
+
+		*R_ATA_CTRL_DATA =
+			IO_FIELD(R_ATA_CTRL_DATA, data, IDE_DATA_REG) |
+			IO_STATE(R_ATA_CTRL_DATA, rw,       read) |
+			IO_STATE(R_ATA_CTRL_DATA, src_dst,  dma)  |
+			IO_STATE(R_ATA_CTRL_DATA, handsh,   dma)  |
+			IO_STATE(R_ATA_CTRL_DATA, multi,    on)   |
+			IO_STATE(R_ATA_CTRL_DATA, dma_size, word);
+
+		LED_DISK_READ(1);
+
+		D(printk("dma read of %d bytes.\n", ata_tot_size));
+
+	} else {
+		/* writing */
+
+		RESET_DMA(ATA_TX_DMA_NBR); /* sometimes the DMA channel get stuck so we need to do this */
+		WAIT_DMA(ATA_TX_DMA_NBR);
+
+		/* set up the Etrax DMA descriptors */
+
+		if(e100_ide_build_dmatable (drive))
+			return 1;
+
+		if(!atapi) {
+			/* set the irq handler which will finish the request when DMA is done */
+
+			ide_set_handler(drive, &etrax_dma_intr, WAIT_CMD, NULL);
+
+			/* issue cmd to drive */
+			if ((HWGROUP(drive)->rq->cmd == IDE_DRIVE_TASKFILE) &&
+			    (drive->addressing == 1)) {
+				ide_task_t *args = HWGROUP(drive)->rq->special;
+				etrax100_ide_outb(args->tfRegister[IDE_COMMAND_OFFSET], IDE_COMMAND_REG);
+			} else if (drive->addressing) {
+				etrax100_ide_outb(WIN_WRITEDMA_EXT, IDE_COMMAND_REG);
+			} else {
+				etrax100_ide_outb(WIN_WRITEDMA, IDE_COMMAND_REG);
+			}
+		}
+
+		/* begin DMA */
+
+		*R_DMA_CH2_FIRST = virt_to_phys(ata_descrs);
+		*R_DMA_CH2_CMD   = IO_STATE(R_DMA_CH2_CMD, cmd, start);
+
+		/* initiate a multi word dma write using DMA handshaking */
+
+		*R_ATA_TRANSFER_CNT =
+			IO_FIELD(R_ATA_TRANSFER_CNT, count, ata_tot_size >> 1);
+
+		*R_ATA_CTRL_DATA =
+			IO_FIELD(R_ATA_CTRL_DATA, data,     IDE_DATA_REG) |
+			IO_STATE(R_ATA_CTRL_DATA, rw,       write) |
+			IO_STATE(R_ATA_CTRL_DATA, src_dst,  dma) |
+			IO_STATE(R_ATA_CTRL_DATA, handsh,   dma) |
+			IO_STATE(R_ATA_CTRL_DATA, multi,    on) |
+			IO_STATE(R_ATA_CTRL_DATA, dma_size, word);
+
+		LED_DISK_WRITE(1);
+
+		D(printk("dma write of %d bytes.\n", ata_tot_size));
+	}
+	return 0;
+}
+
+static int e100_dma_write(ide_drive_t *drive)
+{
+	e100_read_command = 0;
+	/* ATAPI-devices (not disks) first call ide_dma_read/write to set the direction
+	 * then they call ide_dma_begin after they have issued the appropriate drive command
+	 * themselves to actually start the chipset DMA. so we just return here if we're
+	 * not a diskdrive.
+	 */
+	if (drive->media != ide_disk)
+                return 0;
+	return e100_start_dma(drive, 0, 0);
+}
+
+static int e100_dma_read(ide_drive_t *drive)
+{
+	e100_read_command = 1;
+	/* ATAPI-devices (not disks) first call ide_dma_read/write to set the direction
+	 * then they call ide_dma_begin after they have issued the appropriate drive command
+	 * themselves to actually start the chipset DMA. so we just return here if we're
+	 * not a diskdrive.
+	 */
+	if (drive->media != ide_disk)
+                return 0;
+	return e100_start_dma(drive, 0, 1);
+}
+
+static int e100_dma_begin(ide_drive_t *drive)
+{
+	/* begin DMA, used by ATAPI devices which want to issue the
+	 * appropriate IDE command themselves.
+	 *
+	 * they have already called ide_dma_read/write to set the
+	 * static reading flag, now they call ide_dma_begin to do
+	 * the real stuff. we tell our code below not to issue
+	 * any IDE commands itself and jump into it.
+	 */
+	 return e100_start_dma(drive, 1, e100_read_command);
+}
diff -Nru a/arch/cris/arch-v10/drivers/pcf8563.c b/arch/cris/arch-v10/drivers/pcf8563.c
--- a/arch/cris/arch-v10/drivers/pcf8563.c	2004-06-02 23:26:59 -07:00
+++ b/arch/cris/arch-v10/drivers/pcf8563.c	2004-06-02 23:26:59 -07:00
@@ -15,7 +15,7 @@
  *
  * Author: Tobias Anderberg <tobiasa@axis.com>.
  *
- * $Id: pcf8563.c,v 1.1 2002/12/12 08:27:26 starvik Exp $
+ * $Id: pcf8563.c,v 1.4 2004/05/28 09:26:59 starvik Exp $
  */
 
 #include <linux/config.h>
@@ -28,6 +28,7 @@
 #include <linux/fs.h>
 #include <linux/ioctl.h>
 #include <linux/delay.h>
+#include <linux/bcd.h>
 
 #include <asm/uaccess.h>
 #include <asm/system.h>
@@ -39,7 +40,7 @@
 #define PCF8563_MAJOR 121		/* Local major number. */
 #define DEVICE_NAME "rtc"		/* Name which is registered in /proc/devices. */
 #define PCF8563_NAME "PCF8563"
-#define DRIVER_VERSION "$Revision: 1.1 $"
+#define DRIVER_VERSION "$Revision: 1.4 $"
 
 /* I2C bus slave registers. */
 #define RTC_I2C_READ		0xa3
@@ -85,7 +86,12 @@
 void
 pcf8563_writereg(int reg, unsigned char val) 
 {
-	i2c_writereg(RTC_I2C_WRITE,reg,val);
+#ifdef CONFIG_ETRAX_RTC_READONLY
+	if (reg == RTC_CONTROL1 || (reg >= RTC_SECONDS && reg <= RTC_YEAR))
+		return;
+#endif
+
+	rtc_write(reg, val);
 }
 
 void
@@ -120,6 +126,9 @@
 pcf8563_init(void)
 {
 	unsigned char ret;
+
+	i2c_init();
+
 	/*
 	 * First of all we need to reset the chip. This is done by
 	 * clearing control1, control2 and clk freq, clear the 
@@ -152,14 +161,6 @@
 	
 	if (rtc_write(RTC_WEEKDAY_ALARM, 0x00) < 0)
 		goto err;
-
-	if (register_chrdev(PCF8563_MAJOR, DEVICE_NAME, &pcf8563_fops) < 0) {
-		printk(KERN_INFO "%s: Unable to get major numer %d for RTC device.\n", 
-		       PCF8563_NAME, PCF8563_MAJOR);
-		return -1;
-	}
-
-	printk(KERN_INFO "%s Real-Time Clock Driver, %s\n", PCF8563_NAME, DRIVER_VERSION);
         
 	/* Check for low voltage, and warn about it.. */
 	if (rtc_read(RTC_SECONDS) & 0x80)
@@ -210,9 +211,11 @@
 			break;
 		case RTC_SET_TIME:
 			{
+#ifdef CONFIG_ETRAX_RTC_READONLY
+				return -EPERM;
+#else
 				int leap;
 				int century;
-				unsigned long flags;
 				struct rtc_time tm;
 
 				memset(&tm, 0, sizeof (struct rtc_time));
@@ -256,8 +259,35 @@
 				rtc_write(RTC_SECONDS, tm.tm_sec);
 
 				return 0;
+#endif /* !CONFIG_ETRAX_RTC_READONLY */
 			}
-			break;
+
+		case RTC_VLOW_RD:
+		{
+			int vl_bit = 0;
+
+			if (rtc_read(RTC_SECONDS) & 0x80) {
+				vl_bit = 1;
+				printk(KERN_WARNING "%s: RTC Voltage Low - reliable "
+				       "date/time information is no longer guaranteed!\n",
+				       PCF8563_NAME);
+			}
+			if (copy_to_user((int *) arg, &vl_bit, sizeof(int)))
+				return -EFAULT;
+
+			return 0;
+		}
+
+		case RTC_VLOW_SET:
+		{
+			/* Clear the VL bit in the seconds register */
+			int ret = rtc_read(RTC_SECONDS);
+
+			rtc_write(RTC_SECONDS, (ret & 0x7F));
+
+			return 0;
+		}
+
 		default:
 				return -ENOTTY;
 	}
@@ -265,5 +295,19 @@
 	return 0;
 }
 
-module_init(pcf8563_init);
+static int __init
+pcf8563_register(void)
+{
+	pcf8563_init();
+	if (register_chrdev(PCF8563_MAJOR, DEVICE_NAME, &pcf8563_fops) < 0) {
+		printk(KERN_INFO "%s: Unable to get major numer %d for RTC device.\n",
+		       PCF8563_NAME, PCF8563_MAJOR);
+		return -1;
+	}
+
+	printk(KERN_INFO "%s Real-Time Clock Driver, %s\n", PCF8563_NAME, DRIVER_VERSION);
+        return 0;
+}
+
+module_init(pcf8563_register);
 module_exit(pcf8563_exit);
diff -Nru a/arch/cris/arch-v10/drivers/serial.c b/arch/cris/arch-v10/drivers/serial.c
--- a/arch/cris/arch-v10/drivers/serial.c	2004-06-02 23:26:59 -07:00
+++ b/arch/cris/arch-v10/drivers/serial.c	2004-06-02 23:26:59 -07:00
@@ -1,4 +1,4 @@
-/* $Id: serial.c,v 1.17 2003/07/04 08:27:37 starvik Exp $
+/* $Id: serial.c,v 1.20 2004/05/24 12:00:20 starvik Exp $
  *
  * Serial port driver for the ETRAX 100LX chip
  *
@@ -7,6 +7,16 @@
  *    Many, many authors. Based once upon a time on serial.c for 16x50.
  *
  * $Log: serial.c,v $
+ * Revision 1.20  2004/05/24 12:00:20  starvik
+ * Big merge of stuff from Linux 2.4 (e.g. manual mode for the serial port).
+ *
+ * Revision 1.19  2004/05/17 13:12:15  starvik
+ * Kernel console hook
+ * Big merge from Linux 2.4 still pending.
+ *
+ * Revision 1.18  2003/10/28 07:18:30  starvik
+ * Compiles with debug info
+ *
  * Revision 1.17  2003/07/04 08:27:37  starvik
  * Merge of Linux 2.5.74
  *
@@ -399,7 +409,7 @@
  *
  */
 
-static char *serial_version = "$Revision: 1.17 $";
+static char *serial_version = "$Revision: 1.20 $";
 
 #include <linux/config.h>
 #include <linux/version.h>
@@ -447,6 +457,10 @@
 #error "RX_TIMEOUT_TICKS == 0 not allowed, use 1"
 #endif
 
+#if defined(CONFIG_ETRAX_RS485_ON_PA) && defined(CONFIG_ETRAX_RS485_ON_PORT_G)
+#error "Disable either CONFIG_ETRAX_RS485_ON_PA or CONFIG_ETRAX_RS485_ON_PORT_G"
+#endif
+
 /*
  * All of the compatibilty code so we can compile serial.c against
  * older kernels is hidden in serial_compat.h
@@ -473,7 +487,7 @@
 //#define SERIAL_DEBUG_DATA
 //#define SERIAL_DEBUG_THROTTLE
 //#define SERIAL_DEBUG_IO  /* Debug for Extra control and status pins */
-#define SERIAL_DEBUG_LINE 0 /* What serport we want to debug */
+//#define SERIAL_DEBUG_LINE 0 /* What serport we want to debug */
 
 /* Enable this to use serial interrupts to handle when you
    expect the first received event on the serial port to
@@ -481,14 +495,74 @@
    from eLinux */
 #define SERIAL_HANDLE_EARLY_ERRORS
 
-#define TTY_THROTTLE_LIMIT (TTY_FLIPBUF_SIZE/10)
+/* Defined and used in n_tty.c, but we need it here as well */
+#define TTY_THRESHOLD_THROTTLE 128
 
+/* Due to buffersizes and threshold values, our SERIAL_DESCR_BUF_SIZE
+ * must not be to high or flow control won't work if we leave it to the tty
+ * layer so we have our own throttling in flush_to_flip
+ * TTY_FLIPBUF_SIZE=512,
+ * TTY_THRESHOLD_THROTTLE/UNTHROTTLE=128
+ * BUF_SIZE can't be > 128
+ */
+/* Currently 16 descriptors x 128 bytes = 2048 bytes */
 #define SERIAL_DESCR_BUF_SIZE 256
 
+#define SERIAL_PRESCALE_BASE 3125000 /* 3.125MHz */
+#define DEF_BAUD_BASE SERIAL_PRESCALE_BASE
+
+/* We don't want to load the system with massive fast timer interrupt
+ * on high baudrates so limit it to 250 us (4kHz) */
+#define MIN_FLUSH_TIME_USEC 250
+
 /* Add an x here to log a lot of timer stuff */
 #define TIMERD(x)
+/* Debug details of interrupt handling */
+#define DINTR1(x)  /* irq on/off, errors */
+#define DINTR2(x)    /* tx and rx */
+/* Debug flip buffer stuff */
+#define DFLIP(x)
+/* Debug flow control and overview of data flow */
+#define DFLOW(x)
+#define DBAUD(x)
+#define DLOG_INT_TRIG(x)
 
+//#define DEBUG_LOG_INCLUDED
+#ifndef DEBUG_LOG_INCLUDED
 #define DEBUG_LOG(line, string, value)
+#else
+struct debug_log_info
+{
+	unsigned long time;
+	unsigned long timer_data;
+//  int line;
+	const char *string;
+	int value;
+};
+#define DEBUG_LOG_SIZE 4096
+
+struct debug_log_info debug_log[DEBUG_LOG_SIZE];
+int debug_log_pos = 0;
+
+#define DEBUG_LOG(_line, _string, _value) do { \
+  if ((_line) == SERIAL_DEBUG_LINE) {\
+    debug_log_func(_line, _string, _value); \
+  }\
+}while(0)
+
+void debug_log_func(int line, const char *string, int value)
+{
+	if (debug_log_pos < DEBUG_LOG_SIZE) {
+		debug_log[debug_log_pos].time = jiffies;
+		debug_log[debug_log_pos].timer_data = *R_TIMER_DATA;
+//    debug_log[debug_log_pos].line = line;
+		debug_log[debug_log_pos].string = string;
+		debug_log[debug_log_pos].value = value;
+		debug_log_pos++;
+	}
+	/*printk(string, value);*/
+}
+#endif
 
 #ifndef CONFIG_ETRAX_SERIAL_RX_TIMEOUT_TICKS
 /* Default number of timer ticks before flushing rx fifo 
@@ -498,11 +572,14 @@
 #define CONFIG_ETRAX_SERIAL_RX_TIMEOUT_TICKS 5 
 #endif
 
+unsigned long timer_data_to_ns(unsigned long timer_data);
+
 static void change_speed(struct e100_serial *info);
+static void rs_throttle(struct tty_struct * tty);
 static void rs_wait_until_sent(struct tty_struct *tty, int timeout);
 static int rs_write(struct tty_struct * tty, int from_user,
                     const unsigned char *buf, int count);
-static inline int raw_write(struct tty_struct * tty, int from_user,
+extern _INLINE_ int rs_raw_write(struct tty_struct * tty, int from_user,
                             const unsigned char *buf, int count);
 #ifdef CONFIG_ETRAX_RS485
 static int e100_write_rs485(struct tty_struct * tty, int from_user,
@@ -511,7 +588,7 @@
 static int get_lsr_info(struct e100_serial * info, unsigned int *value);
 
 
-#define DEF_BAUD 0x99   /* 115.2 kbit/s */
+#define DEF_BAUD 115200   /* 115.2 kbit/s */
 #define STD_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST)
 #define DEF_RX 0x20  /* or SERIAL_CTRL_W >> 8 */
 /* Default value of tx_ctrl register: has txd(bit 7)=1 (idle) as default */
@@ -520,6 +597,7 @@
 /* offsets from R_SERIALx_CTRL */
 
 #define REG_DATA 0
+#define REG_DATA_STATUS32 0 /* this is the 32 bit register R_SERIALx_READ */
 #define REG_TR_DATA 0
 #define REG_STATUS 1
 #define REG_TR_CTRL 1
@@ -555,60 +633,162 @@
  */
 
 
+/* Mask for the irqs possibly enabled in R_IRQ_MASK1_RD etc. */
+static const unsigned long e100_ser_int_mask = 0
+#ifdef CONFIG_ETRAX_SERIAL_PORT0
+| IO_MASK(R_IRQ_MASK1_RD, ser0_data) | IO_MASK(R_IRQ_MASK1_RD, ser0_ready)
+#endif
+#ifdef CONFIG_ETRAX_SERIAL_PORT1
+| IO_MASK(R_IRQ_MASK1_RD, ser1_data) | IO_MASK(R_IRQ_MASK1_RD, ser1_ready)
+#endif
+#ifdef CONFIG_ETRAX_SERIAL_PORT2
+| IO_MASK(R_IRQ_MASK1_RD, ser2_data) | IO_MASK(R_IRQ_MASK1_RD, ser2_ready)
+#endif
+#ifdef CONFIG_ETRAX_SERIAL_PORT3
+| IO_MASK(R_IRQ_MASK1_RD, ser3_data) | IO_MASK(R_IRQ_MASK1_RD, ser3_ready)
+#endif
+;
+unsigned long r_alt_ser_baudrate_shadow = 0;
+
 /* this is the data for the four serial ports in the etrax100 */
 /*  DMA2(ser2), DMA4(ser3), DMA6(ser0) or DMA8(ser1) */
 /* R_DMA_CHx_CLR_INTR, R_DMA_CHx_FIRST, R_DMA_CHx_CMD */
 
 static struct e100_serial rs_table[] = {
-	{ DEF_BAUD, (unsigned char *)R_SERIAL0_CTRL, 1U << 12, /* uses DMA 6 and 7 */
-	  R_DMA_CH6_CLR_INTR, R_DMA_CH6_FIRST, R_DMA_CH6_CMD,
-	  R_DMA_CH6_STATUS, R_DMA_CH6_HWSW, R_DMA_CH6_DESCR,
-	  R_DMA_CH7_CLR_INTR, R_DMA_CH7_FIRST, R_DMA_CH7_CMD,
-	  R_DMA_CH7_STATUS, R_DMA_CH7_HWSW, R_DMA_CH7_DESCR,
-	  STD_FLAGS, DEF_RX, DEF_TX, 2,
+	{ .baud        = DEF_BAUD,
+	  .port        = (unsigned char *)R_SERIAL0_CTRL,
+	  .irq         = 1U << 12, /* uses DMA 6 and 7 */
+	  .oclrintradr = R_DMA_CH6_CLR_INTR,
+	  .ofirstadr   = R_DMA_CH6_FIRST,
+	  .ocmdadr     = R_DMA_CH6_CMD,
+	  .ostatusadr  = R_DMA_CH6_STATUS,
+	  .iclrintradr = R_DMA_CH7_CLR_INTR,
+	  .ifirstadr   = R_DMA_CH7_FIRST,
+	  .icmdadr     = R_DMA_CH7_CMD,
+	  .idescradr   = R_DMA_CH7_DESCR,
+	  .flags       = STD_FLAGS,
+	  .rx_ctrl     = DEF_RX,
+	  .tx_ctrl     = DEF_TX,
+	  .iseteop     = 2,
 #ifdef CONFIG_ETRAX_SERIAL_PORT0
-          1
+          .enabled  = 1,
+#ifdef CONFIG_ETRAX_SERIAL_PORT0_DMA6_OUT
+	  .dma_out_enabled = 1,
+#else
+	  .dma_out_enabled = 0,
+#endif
+#ifdef CONFIG_ETRAX_SERIAL_PORT0_DMA7_IN
+	  .dma_in_enabled = 1,
+#else
+	  .dma_in_enabled = 0
+#endif
 #else
-          0
+          .enabled  = 0,
+	  .dma_out_enabled = 0,
+	  .dma_in_enabled = 0
 #endif
+
 },  /* ttyS0 */
 #ifndef CONFIG_SVINTO_SIM
-	{ DEF_BAUD, (unsigned char *)R_SERIAL1_CTRL, 1U << 16, /* uses DMA 8 and 9 */
-	  R_DMA_CH8_CLR_INTR, R_DMA_CH8_FIRST, R_DMA_CH8_CMD,
-	  R_DMA_CH8_STATUS, R_DMA_CH8_HWSW, R_DMA_CH8_DESCR,
-	  R_DMA_CH9_CLR_INTR, R_DMA_CH9_FIRST, R_DMA_CH9_CMD,
-	  R_DMA_CH9_STATUS, R_DMA_CH9_HWSW, R_DMA_CH9_DESCR,
-	  STD_FLAGS, DEF_RX, DEF_TX, 3 ,
+	{ .baud        = DEF_BAUD,
+	  .port        = (unsigned char *)R_SERIAL1_CTRL,
+	  .irq         = 1U << 16, /* uses DMA 8 and 9 */
+	  .oclrintradr = R_DMA_CH8_CLR_INTR,
+	  .ofirstadr   = R_DMA_CH8_FIRST,
+	  .ocmdadr     = R_DMA_CH8_CMD,
+	  .ostatusadr  = R_DMA_CH8_STATUS,
+	  .iclrintradr = R_DMA_CH9_CLR_INTR,
+	  .ifirstadr   = R_DMA_CH9_FIRST,
+	  .icmdadr     = R_DMA_CH9_CMD,
+	  .idescradr   = R_DMA_CH9_DESCR,
+	  .flags       = STD_FLAGS,
+	  .rx_ctrl     = DEF_RX,
+	  .tx_ctrl     = DEF_TX,
+	  .iseteop     = 3,
 #ifdef CONFIG_ETRAX_SERIAL_PORT1
-          1
+          .enabled  = 1,
+#ifdef CONFIG_ETRAX_SERIAL_PORT1_DMA8_OUT
+	  .dma_out_enabled = 1,
+#else
+	  .dma_out_enabled = 0,
+#endif
+#ifdef CONFIG_ETRAX_SERIAL_PORT1_DMA9_IN
+	  .dma_in_enabled = 1,
+#else
+	  .dma_in_enabled = 0
+#endif
 #else
-          0
+          .enabled  = 0,
+	  .dma_out_enabled = 0,
+	  .dma_in_enabled = 0
 #endif
 },  /* ttyS1 */
 
-	{ DEF_BAUD, (unsigned char *)R_SERIAL2_CTRL, 1U << 4,  /* uses DMA 2 and 3 */
-	  R_DMA_CH2_CLR_INTR, R_DMA_CH2_FIRST, R_DMA_CH2_CMD,
-	  R_DMA_CH2_STATUS, R_DMA_CH2_HWSW, R_DMA_CH2_DESCR,
-	  R_DMA_CH3_CLR_INTR, R_DMA_CH3_FIRST, R_DMA_CH3_CMD,
-	  R_DMA_CH3_STATUS, R_DMA_CH3_HWSW, R_DMA_CH3_DESCR,
-	  STD_FLAGS, DEF_RX, DEF_TX, 0,
+	{ .baud        = DEF_BAUD,
+	  .port        = (unsigned char *)R_SERIAL2_CTRL,
+	  .irq         = 1U << 4,  /* uses DMA 2 and 3 */
+	  .oclrintradr = R_DMA_CH2_CLR_INTR,
+	  .ofirstadr   = R_DMA_CH2_FIRST,
+	  .ocmdadr     = R_DMA_CH2_CMD,
+	  .ostatusadr  = R_DMA_CH2_STATUS,
+	  .iclrintradr = R_DMA_CH3_CLR_INTR,
+	  .ifirstadr   = R_DMA_CH3_FIRST,
+	  .icmdadr     = R_DMA_CH3_CMD,
+	  .idescradr   = R_DMA_CH3_DESCR,
+	  .flags       = STD_FLAGS,
+	  .rx_ctrl     = DEF_RX,
+	  .tx_ctrl     = DEF_TX,
+	  .iseteop     = 0,
 #ifdef CONFIG_ETRAX_SERIAL_PORT2
-          1
+          .enabled  = 1,
+#ifdef CONFIG_ETRAX_SERIAL_PORT2_DMA2_OUT
+	  .dma_out_enabled = 1,
+#else
+	  .dma_out_enabled = 0,
+#endif
+#ifdef CONFIG_ETRAX_SERIAL_PORT2_DMA3_IN
+	  .dma_in_enabled = 1,
 #else
-          0
+	  .dma_in_enabled = 0
+#endif
+#else
+          .enabled  = 0,
+	  .dma_out_enabled = 0,
+	  .dma_in_enabled = 0
 #endif
  },  /* ttyS2 */
 
-	{ DEF_BAUD, (unsigned char *)R_SERIAL3_CTRL, 1U << 8,  /* uses DMA 4 and 5 */
-	  R_DMA_CH4_CLR_INTR, R_DMA_CH4_FIRST, R_DMA_CH4_CMD,
-	  R_DMA_CH4_STATUS, R_DMA_CH4_HWSW, R_DMA_CH4_DESCR,
-	  R_DMA_CH5_CLR_INTR, R_DMA_CH5_FIRST, R_DMA_CH5_CMD,
-	  R_DMA_CH5_STATUS, R_DMA_CH5_HWSW, R_DMA_CH5_DESCR,
-	  STD_FLAGS, DEF_RX, DEF_TX, 1,
+	{ .baud        = DEF_BAUD,
+	  .port        = (unsigned char *)R_SERIAL3_CTRL,
+	  .irq         = 1U << 8,  /* uses DMA 4 and 5 */
+	  .oclrintradr = R_DMA_CH4_CLR_INTR,
+	  .ofirstadr   = R_DMA_CH4_FIRST,
+	  .ocmdadr     = R_DMA_CH4_CMD,
+	  .ostatusadr  = R_DMA_CH4_STATUS,
+	  .iclrintradr = R_DMA_CH5_CLR_INTR,
+	  .ifirstadr   = R_DMA_CH5_FIRST,
+	  .icmdadr     = R_DMA_CH5_CMD,
+	  .idescradr   = R_DMA_CH5_DESCR,
+	  .flags       = STD_FLAGS,
+	  .rx_ctrl     = DEF_RX,
+	  .tx_ctrl     = DEF_TX,
+	  .iseteop     = 1,
 #ifdef CONFIG_ETRAX_SERIAL_PORT3
-          1
+          .enabled  = 1,
+#ifdef CONFIG_ETRAX_SERIAL_PORT3_DMA4_OUT
+	  .dma_out_enabled = 1,
+#else
+	  .dma_out_enabled = 0,
+#endif
+#ifdef CONFIG_ETRAX_SERIAL_PORT3_DMA5_IN
+	  .dma_in_enabled = 1,
 #else
-          0
+	  .dma_in_enabled = 0
+#endif
+#else
+          .enabled  = 0,
+	  .dma_out_enabled = 0,
+	  .dma_in_enabled = 0
 #endif
  }   /* ttyS3 */
 #endif
@@ -616,6 +796,9 @@
 
 
 #define NR_PORTS (sizeof(rs_table)/sizeof(struct e100_serial))
+
+static struct termios *serial_termios[NR_PORTS];
+static struct termios *serial_termios_locked[NR_PORTS];
 #ifdef CONFIG_ETRAX_SERIAL_FAST_TIMER
 static struct fast_timer fast_timers[NR_PORTS];
 #endif
@@ -652,6 +835,9 @@
 #if defined(CONFIG_ETRAX_RS485_ON_PA)
 static int rs485_pa_bit = CONFIG_ETRAX_RS485_ON_PA_BIT;
 #endif
+#if defined(CONFIG_ETRAX_RS485_ON_PORT_G)
+static int rs485_port_g_bit = CONFIG_ETRAX_RS485_ON_PORT_G_BIT;
+#endif
 #endif
 
 /* Info and macros needed for each ports extra control/status signals. */
@@ -761,7 +947,7 @@
 #  endif
 #endif
 
-#define SER0_PB_BITSUM (CONFIG_ETRAX_SER1_DTR_ON_PB_BIT+CONFIG_ETRAX_SER1_RI_ON_PB_BIT+CONFIG_ETRAX_SER1_DSR_ON_PB_BIT+CONFIG_ETRAX_SER1_CD_ON_PB_BIT)
+#define SER1_PB_BITSUM (CONFIG_ETRAX_SER1_DTR_ON_PB_BIT+CONFIG_ETRAX_SER1_RI_ON_PB_BIT+CONFIG_ETRAX_SER1_DSR_ON_PB_BIT+CONFIG_ETRAX_SER1_CD_ON_PB_BIT)
 
 #if SER1_PB_BITSUM != -4
 #  if CONFIG_ETRAX_SER1_DTR_ON_PB_BIT == -1
@@ -1081,15 +1267,9 @@
 };
 #endif /* !CONFIG_ETRAX_SERX_DTR_RI_DSR_CD_MIXED */
 
-#if defined(CONFIG_ETRAX_RS485) && defined(CONFIG_ETRAX_RS485_ON_PA)
-unsigned char rs485_pa_port = CONFIG_ETRAX_RS485_ON_PA_BIT;
-#endif
-
-
 #define E100_RTS_MASK 0x20
 #define E100_CTS_MASK 0x40
 
-
 /* All serial port signals are active low:
  * active   = 0 -> 3.3V to RS-232 driver -> -12V on RS-232 level
  * inactive = 1 -> 0V   to RS-232 driver -> +12V on RS-232 level
@@ -1151,6 +1331,10 @@
 
 	/* calc timeout */
 	info->char_time_usec = ((bits * 1000000) / info->baud) + 1;
+	info->flush_time_usec = 4*info->char_time_usec;
+	if (info->flush_time_usec < MIN_FLUSH_TIME_USEC)
+		info->flush_time_usec = MIN_FLUSH_TIME_USEC;
+
 }
 
 /*
@@ -1250,9 +1434,13 @@
 e100_rts(struct e100_serial *info, int set)
 {
 #ifndef CONFIG_SVINTO_SIM
+	unsigned long flags;
+	save_flags(flags);
+	cli();
 	info->rx_ctrl &= ~E100_RTS_MASK;
 	info->rx_ctrl |= (set ? 0 : E100_RTS_MASK);  /* RTS is active low */
 	info->port[REG_REC_CTRL] = info->rx_ctrl;
+	restore_flags(flags);
 #ifdef SERIAL_DEBUG_IO  
 	printk("ser%i rts %i\n", info->line, set);
 #endif
@@ -1326,6 +1514,7 @@
 #ifdef SERIAL_DEBUG_INTR
 	printk("rxdma_irq(%d): 0\n",info->line);
 #endif
+	DINTR1(DEBUG_LOG(info->line,"IRQ disable_rxdma_irq %i\n", info->line));
 	*R_IRQ_MASK2_CLR = (info->irq << 2) | (info->irq << 3);
 }
 
@@ -1335,30 +1524,33 @@
 #ifdef SERIAL_DEBUG_INTR
 	printk("rxdma_irq(%d): 1\n",info->line);
 #endif
+	DINTR1(DEBUG_LOG(info->line,"IRQ enable_rxdma_irq %i\n", info->line));
 	*R_IRQ_MASK2_SET = (info->irq << 2) | (info->irq << 3);
 }
 
 /* the tx DMA uses only dma_descr interrupt */
 
-static inline void
+static _INLINE_ void
 e100_disable_txdma_irq(struct e100_serial *info) 
 {
 #ifdef SERIAL_DEBUG_INTR
 	printk("txdma_irq(%d): 0\n",info->line);
 #endif
+	DINTR1(DEBUG_LOG(info->line,"IRQ disable_txdma_irq %i\n", info->line));
 	*R_IRQ_MASK2_CLR = info->irq;
 }
 
-static inline void
+static _INLINE_ void
 e100_enable_txdma_irq(struct e100_serial *info) 
 {
 #ifdef SERIAL_DEBUG_INTR
 	printk("txdma_irq(%d): 1\n",info->line);
 #endif
+	DINTR1(DEBUG_LOG(info->line,"IRQ enable_txdma_irq %i\n", info->line));
 	*R_IRQ_MASK2_SET = info->irq;
 }
 
-static inline void
+static _INLINE_ void
 e100_disable_txdma_channel(struct e100_serial *info)
 {
 	unsigned long flags;
@@ -1367,32 +1559,46 @@
 	 * ( set to something other then serialX)
 	 */
 	save_flags(flags);
-	cli();  
+	cli();
+	DFLOW(DEBUG_LOG(info->line, "disable_txdma_channel %i\n", info->line));
 	if (info->line == 0) {
-		genconfig_shadow &=  ~IO_MASK(R_GEN_CONFIG, dma6);
-		genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma6, unused);
+		if ((genconfig_shadow & IO_MASK(R_GEN_CONFIG, dma6)) ==
+		    IO_STATE(R_GEN_CONFIG, dma6, serial0)) {
+			genconfig_shadow &=  ~IO_MASK(R_GEN_CONFIG, dma6);
+			genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma6, unused);
+		}
 	} else if (info->line == 1) {
-		genconfig_shadow &=  ~IO_MASK(R_GEN_CONFIG, dma8);
-		genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma8, usb);
+		if ((genconfig_shadow & IO_MASK(R_GEN_CONFIG, dma8)) ==
+		    IO_STATE(R_GEN_CONFIG, dma8, serial1)) {
+			genconfig_shadow &=  ~IO_MASK(R_GEN_CONFIG, dma8);
+			genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma8, usb);
+		}
 	} else if (info->line == 2) {
-		genconfig_shadow &=  ~IO_MASK(R_GEN_CONFIG, dma2);
-		genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma2, par0);
+		if ((genconfig_shadow & IO_MASK(R_GEN_CONFIG, dma2)) ==
+		    IO_STATE(R_GEN_CONFIG, dma2, serial2)) {
+			genconfig_shadow &=  ~IO_MASK(R_GEN_CONFIG, dma2);
+			genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma2, par0);
+		}
 	} else if (info->line == 3) {
-		genconfig_shadow &=  ~IO_MASK(R_GEN_CONFIG, dma4);
-		genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma4, par1);
+		if ((genconfig_shadow & IO_MASK(R_GEN_CONFIG, dma4)) ==
+		    IO_STATE(R_GEN_CONFIG, dma4, serial3)) {
+			genconfig_shadow &=  ~IO_MASK(R_GEN_CONFIG, dma4);
+			genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma4, par1);
+		}
 	}
 	*R_GEN_CONFIG = genconfig_shadow;
 	restore_flags(flags);
 }
 
 
-static inline void
+static _INLINE_ void
 e100_enable_txdma_channel(struct e100_serial *info)
 {
 	unsigned long flags;
   
 	save_flags(flags);
-	cli();  
+	cli();
+	DFLOW(DEBUG_LOG(info->line, "enable_txdma_channel %i\n", info->line));
 	/* Enable output DMA channel for the serial port in question */
 	if (info->line == 0) {
 		genconfig_shadow &=  ~IO_MASK(R_GEN_CONFIG, dma6);
@@ -1411,6 +1617,70 @@
 	restore_flags(flags);
 }
 
+static _INLINE_ void
+e100_disable_rxdma_channel(struct e100_serial *info)
+{
+	unsigned long flags;
+
+	/* Disable input DMA channel for the serial port in question
+	 * ( set to something other then serialX)
+	 */
+	save_flags(flags);
+	cli();
+	if (info->line == 0) {
+		if ((genconfig_shadow & IO_MASK(R_GEN_CONFIG, dma7)) ==
+		    IO_STATE(R_GEN_CONFIG, dma7, serial0)) {
+			genconfig_shadow &=  ~IO_MASK(R_GEN_CONFIG, dma7);
+			genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma7, unused);
+		}
+	} else if (info->line == 1) {
+		if ((genconfig_shadow & IO_MASK(R_GEN_CONFIG, dma9)) ==
+		    IO_STATE(R_GEN_CONFIG, dma9, serial1)) {
+			genconfig_shadow &=  ~IO_MASK(R_GEN_CONFIG, dma9);
+			genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma9, usb);
+		}
+	} else if (info->line == 2) {
+		if ((genconfig_shadow & IO_MASK(R_GEN_CONFIG, dma3)) ==
+		    IO_STATE(R_GEN_CONFIG, dma3, serial2)) {
+			genconfig_shadow &=  ~IO_MASK(R_GEN_CONFIG, dma3);
+			genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma3, par0);
+		}
+	} else if (info->line == 3) {
+		if ((genconfig_shadow & IO_MASK(R_GEN_CONFIG, dma5)) ==
+		    IO_STATE(R_GEN_CONFIG, dma5, serial3)) {
+			genconfig_shadow &=  ~IO_MASK(R_GEN_CONFIG, dma5);
+			genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma5, par1);
+		}
+	}
+	*R_GEN_CONFIG = genconfig_shadow;
+	restore_flags(flags);
+}
+
+
+static _INLINE_ void
+e100_enable_rxdma_channel(struct e100_serial *info)
+{
+	unsigned long flags;
+
+	save_flags(flags);
+	cli();
+	/* Enable input DMA channel for the serial port in question */
+	if (info->line == 0) {
+		genconfig_shadow &=  ~IO_MASK(R_GEN_CONFIG, dma7);
+		genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma7, serial0);
+	} else if (info->line == 1) {
+		genconfig_shadow &=  ~IO_MASK(R_GEN_CONFIG, dma9);
+		genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma9, serial1);
+	} else if (info->line == 2) {
+		genconfig_shadow &=  ~IO_MASK(R_GEN_CONFIG, dma3);
+		genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma3, serial2);
+	} else if (info->line == 3) {
+		genconfig_shadow &=  ~IO_MASK(R_GEN_CONFIG, dma5);
+		genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma5, serial3);
+	}
+	*R_GEN_CONFIG = genconfig_shadow;
+	restore_flags(flags);
+}
 
 #ifdef SERIAL_HANDLE_EARLY_ERRORS
 /* in order to detect and fix errors on the first byte
@@ -1422,6 +1692,7 @@
 #ifdef SERIAL_DEBUG_INTR
 	printk("ser_irq(%d): 0\n",info->line);
 #endif
+	DINTR1(DEBUG_LOG(info->line,"IRQ disable data_irq %i\n", info->line));
 	*R_IRQ_MASK1_CLR = (1U << (8+2*info->line));
 }
 
@@ -1434,10 +1705,49 @@
 	       (8+2*info->line),
 	       (1U << (8+2*info->line)));
 #endif
+	DINTR1(DEBUG_LOG(info->line,"IRQ enable data_irq %i\n", info->line));
 	*R_IRQ_MASK1_SET = (1U << (8+2*info->line));
 }
 #endif
 
+static inline void
+e100_disable_serial_tx_ready_irq(struct e100_serial *info)
+{
+#ifdef SERIAL_DEBUG_INTR
+	printk("ser_tx_irq(%d): 0\n",info->line);
+#endif
+	DINTR1(DEBUG_LOG(info->line,"IRQ disable ready_irq %i\n", info->line));
+	*R_IRQ_MASK1_CLR = (1U << (8+1+2*info->line));
+}
+
+static inline void
+e100_enable_serial_tx_ready_irq(struct e100_serial *info)
+{
+#ifdef SERIAL_DEBUG_INTR
+	printk("ser_tx_irq(%d): 1\n",info->line);
+	printk("**** %d = %d\n",
+	       (8+1+2*info->line),
+	       (1U << (8+1+2*info->line)));
+#endif
+	DINTR2(DEBUG_LOG(info->line,"IRQ enable ready_irq %i\n", info->line));
+	*R_IRQ_MASK1_SET = (1U << (8+1+2*info->line));
+}
+
+static inline void e100_enable_rx_irq(struct e100_serial *info)
+{
+	if (info->uses_dma_in)
+		e100_enable_rxdma_irq(info);
+	else
+		e100_enable_serial_data_irq(info);
+}
+static inline void e100_disable_rx_irq(struct e100_serial *info)
+{
+	if (info->uses_dma_in)
+		e100_disable_rxdma_irq(info);
+	else
+		e100_disable_serial_data_irq(info);
+}
+
 #if defined(CONFIG_ETRAX_RS485)
 /* Enable RS-485 mode on selected port. This is UGLY. */
 static int
@@ -1448,10 +1758,23 @@
 #if defined(CONFIG_ETRAX_RS485_ON_PA)	
 	*R_PORT_PA_DATA = port_pa_data_shadow |= (1 << rs485_pa_bit);
 #endif
+#if defined(CONFIG_ETRAX_RS485_ON_PORT_G)
+	REG_SHADOW_SET(R_PORT_G_DATA,  port_g_data_shadow,
+		       rs485_port_g_bit, 1);
+#endif
+#if defined(CONFIG_ETRAX_RS485_LTC1387)
+	REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow,
+		       CONFIG_ETRAX_RS485_LTC1387_DXEN_PORT_G_BIT, 1);
+	REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow,
+		       CONFIG_ETRAX_RS485_LTC1387_RXEN_PORT_G_BIT, 1);
+#endif
 
 	info->rs485.rts_on_send = 0x01 & r->rts_on_send;
 	info->rs485.rts_after_sent = 0x01 & r->rts_after_sent;
-	info->rs485.delay_rts_before_send = r->delay_rts_before_send;
+	if (r->delay_rts_before_send >= 1000)
+		info->rs485.delay_rts_before_send = 1000;
+	else
+		info->rs485.delay_rts_before_send = r->delay_rts_before_send;
 	info->rs485.enabled = r->enabled;
 /*	printk("rts: on send = %i, after = %i, enabled = %i",
 		    info->rs485.rts_on_send,
@@ -1491,7 +1814,7 @@
 	e100_rts(info, info->rs485.rts_after_sent);
 #if defined(CONFIG_ETRAX_RS485_DISABLE_RECEIVER)
 	e100_enable_rx(info);
-	e100_enable_rxdma_irq(info);
+	e100_enable_rx_irq(info);
 #endif
 }
 #endif
@@ -1513,8 +1836,12 @@
 	if (info) {
 		unsigned long flags;
 		unsigned long xoff;
-		
+
 		save_flags(flags); cli();
+		DFLOW(DEBUG_LOG(info->line, "XOFF rs_stop xmit %i\n",
+				CIRC_CNT(info->xmit.head,
+					 info->xmit.tail,SERIAL_XMIT_SIZE)));
+
 		xoff = IO_FIELD(R_SERIAL0_XOFF, xoff_char, STOP_CHAR(info->tty));
 		xoff |= IO_STATE(R_SERIAL0_XOFF, tx_stop, stop);
 		if (tty->termios->c_iflag & IXON ) {
@@ -1535,6 +1862,9 @@
 		unsigned long xoff;
 
 		save_flags(flags); cli();
+		DFLOW(DEBUG_LOG(info->line, "XOFF rs_start xmit %i\n",
+				CIRC_CNT(info->xmit.head,
+					 info->xmit.tail,SERIAL_XMIT_SIZE)));
 		xoff = IO_FIELD(R_SERIAL0_XOFF, xoff_char, STOP_CHAR(tty));
 		xoff |= IO_STATE(R_SERIAL0_XOFF, tx_stop, enable);
 		if (tty->termios->c_iflag & IXON ) {
@@ -1542,6 +1872,9 @@
 		}
 	
 		*((unsigned long *)&info->port[REG_XOFF]) = xoff;
+		if (!info->uses_dma_out &&
+		    info->xmit.head != info->xmit.tail && info->xmit.buf)
+			e100_enable_serial_tx_ready_irq(info);
 		
 		restore_flags(flags);
 	}
@@ -1576,6 +1909,8 @@
 rs_sched_event(struct e100_serial *info,
 				    int event)
 {
+	if (info->event & (1 << event))
+		return;
 	info->event |= 1 << event;
 	schedule_work(&info->work);
 }
@@ -1592,7 +1927,7 @@
  */
 
 static void 
-transmit_chars(struct e100_serial *info)
+transmit_chars_dma(struct e100_serial *info)
 {
 	unsigned int c, sentl;
 	struct etrax_dma_descr *descr;
@@ -1600,11 +1935,11 @@
 #ifdef CONFIG_SVINTO_SIM
 	/* This will output too little if tail is not 0 always since
 	 * we don't reloop to send the other part. Anyway this SHOULD be a
-	 * no-op - transmit_chars would never really be called during sim
+	 * no-op - transmit_chars_dma would never really be called during sim
 	 * since rs_write does not write into the xmit buffer then.
 	 */
 	if (info->xmit.tail)
-		printk("Error in serial.c:transmit_chars(), tail!=0\n");
+		printk("Error in serial.c:transmit_chars-dma(), tail!=0\n");
 	if (info->xmit.head != info->xmit.tail) {
 		SIMCOUT(info->xmit.buf + info->xmit.tail,
 			CIRC_CNT(info->xmit.head,
@@ -1626,7 +1961,7 @@
 #endif
 	if (!info->tr_running) {
 		/* weirdo... we shouldn't get here! */
-		printk(KERN_WARNING "Achtung: transmit_chars with !tr_running\n");
+		printk(KERN_WARNING "Achtung: transmit_chars_dma with !tr_running\n");
 		return;
 	}
 
@@ -1642,6 +1977,8 @@
 		/* otherwise we find the amount of data sent here */
 		sentl = descr->hw_len;
 
+	DFLOW(DEBUG_LOG(info->line, "TX %i done\n", sentl));
+
 	/* update stats */
 	info->icount.tx += sentl;
 
@@ -1659,6 +1996,13 @@
 
 	c = CIRC_CNT_TO_END(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE);
 
+	/* Don't send all in one DMA transfer - divide it so we wake up
+	 * application before all is sent
+	 */
+
+	if (c >= 4*WAKEUP_CHARS)
+		c = c/2;
+
 	if (c <= 0) {
 		/* our job here is done, don't schedule any new DMA transfer */
 		info->tr_running = 0;
@@ -1678,17 +2022,17 @@
 
 	/* ok we can schedule a dma send of c chars starting at info->xmit.tail */
 	/* set up the descriptor correctly for output */
-
+	DFLOW(DEBUG_LOG(info->line, "TX %i\n", c));
 	descr->ctrl = d_int | d_eol | d_wait; /* Wait needed for tty_wait_until_sent() */
 	descr->sw_len = c;
 	descr->buf = virt_to_phys(info->xmit.buf + info->xmit.tail);
 	descr->status = 0;
 
 	*info->ofirstadr = virt_to_phys(descr); /* write to R_DMAx_FIRST */
-	*info->ocmdadr = 1;       /* dma command start -> R_DMAx_CMD */
+	*info->ocmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, start);
 	
 	/* DMA is now running (hopefully) */
-} /* transmit_chars */
+} /* transmit_chars_dma */
 
 static void 
 start_transmit(struct e100_serial *info)
@@ -1702,15 +2046,17 @@
 	info->tr_descr.hw_len = 0;
 	info->tr_descr.status = 0;
 	info->tr_running = 1;
-
-	transmit_chars(info);
+	if (info->uses_dma_out)
+		transmit_chars_dma(info);
+	else
+		e100_enable_serial_tx_ready_irq(info);
 } /* start_transmit */
 
 #ifdef CONFIG_ETRAX_SERIAL_FAST_TIMER
 static int serial_fast_timer_started = 0;
 static int serial_fast_timer_expired = 0;
 static void flush_timeout_function(unsigned long data);
-#define START_FLUSH_FAST_TIMER(info, string) {\
+#define START_FLUSH_FAST_TIMER_TIME(info, string, usec) {\
   unsigned long timer_flags; \
   save_flags(timer_flags); \
   cli(); \
@@ -1721,7 +2067,7 @@
     start_one_shot_timer(&fast_timers[info->line], \
                          flush_timeout_function, \
                          (unsigned long)info, \
-                         info->char_time_usec*4, \
+                         (usec), \
                          string); \
   } \
   else { \
@@ -1729,8 +2075,10 @@
   } \
   restore_flags(timer_flags); \
 }
+#define START_FLUSH_FAST_TIMER(info, string) START_FLUSH_FAST_TIMER_TIME(info, string, info->flush_time_usec)
 
 #else
+#define START_FLUSH_FAST_TIMER_TIME(info, string, usec)
 #define START_FLUSH_FAST_TIMER(info, string)
 #endif
 
@@ -1775,17 +2123,26 @@
 add_char_and_flag(struct e100_serial *info, unsigned char data, unsigned char flag)
 {
 	struct etrax_recv_buffer *buffer;
+	if (info->uses_dma_in) {
+		if (!(buffer = alloc_recv_buffer(4)))
+			return 0;
 
-	if (!(buffer = alloc_recv_buffer(4)))
-		return 0;
-
-	buffer->length = 1;
-	buffer->error = flag;
-	buffer->buffer[0] = data;
+		buffer->length = 1;
+		buffer->error = flag;
+		buffer->buffer[0] = data;
 	
-	append_recv_buffer(info, buffer);
+		append_recv_buffer(info, buffer);
 
-	info->icount.rx++;
+		info->icount.rx++;
+	} else {
+		struct tty_struct *tty = info->tty;
+		*tty->flip.char_buf_ptr = data;
+		*tty->flip.flag_buf_ptr = flag;
+		tty->flip.flag_buf_ptr++;
+		tty->flip.char_buf_ptr++;
+		tty->flip.count++;
+		info->icount.rx++;
+	}
 
 	return 1;
 }
@@ -1847,7 +2204,14 @@
 		/* Reset the status information */
 		descr->status = 0;
 
-		DEBUG_LOG(info->line, "recvl %lu\n", recvl);
+		DFLOW(  DEBUG_LOG(info->line, "RX %lu\n", recvl);
+			if (info->tty->stopped) {
+				unsigned char *buf = phys_to_virt(descr->buf);
+				DEBUG_LOG(info->line, "rx 0x%02X\n", buf[0]);
+				DEBUG_LOG(info->line, "rx 0x%02X\n", buf[1]);
+				DEBUG_LOG(info->line, "rx 0x%02X\n", buf[2]);
+			}
+			);
 
 		/* update stats */
 		info->icount.rx += recvl;
@@ -1859,7 +2223,7 @@
 }
 
 static _INLINE_ void 
-receive_chars(struct e100_serial *info)
+receive_chars_dma(struct e100_serial *info)
 {
 	struct tty_struct *tty;
 	unsigned char rstat;
@@ -1881,7 +2245,8 @@
 		return;
 
 #ifdef SERIAL_HANDLE_EARLY_ERRORS
-	e100_enable_serial_data_irq(info);
+	if (info->uses_dma_in)
+		e100_enable_serial_data_irq(info);
 #endif	
 
 	if (info->errorcode == ERRCODE_INSERT_BREAK)
@@ -1891,6 +2256,9 @@
 
 	/* Read the status register to detect errors */
 	rstat = info->port[REG_STATUS];
+	if (rstat & IO_MASK(R_SERIAL0_STATUS, xoff_detect) ) {
+		DFLOW(DEBUG_LOG(info->line, "XOFF detect stat %x\n", rstat));
+	}
 
 	if (rstat & SER_ERROR_MASK) {
 		/* If we got an error, we must reset it by reading the
@@ -1959,16 +2327,16 @@
 	 */
 	return;
 #endif
-
-	/* reset the input dma channel to be sure it works */
-
-	*info->icmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, reset);
-	while (IO_EXTRACT(R_DMA_CH6_CMD, cmd, *info->icmdadr) ==
-	       IO_STATE_VALUE(R_DMA_CH6_CMD, cmd, reset));
-
 	info->tty->flip.count = 0;
+	if (info->uses_dma_in) {
+		/* reset the input dma channel to be sure it works */
 
-	start_recv_dma(info);
+		*info->icmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, reset);
+		while (IO_EXTRACT(R_DMA_CH6_CMD, cmd, *info->icmdadr) ==
+		       IO_STATE_VALUE(R_DMA_CH6_CMD, cmd, reset));
+
+		start_recv_dma(info);
+	}
 }
 
 
@@ -2014,27 +2382,27 @@
 	
 	for (i = 0; i < NR_PORTS; i++) {
 		info = rs_table + i;
-		if (!info->enabled || !info->uses_dma) 
+		if (!info->enabled || !info->uses_dma_out)
 			continue; 
 		/* check for dma_descr (don't need to check for dma_eop in output dma for serial */
 		if (ireg & info->irq) {  
 			handled = 1;
 			/* we can send a new dma bunch. make it so. */
-			DEBUG_LOG(info->line, "tr_interrupt %i\n", i);
+			DINTR2(DEBUG_LOG(info->line, "tr_interrupt %i\n", i));
 			/* Read jiffies_usec first, 
 			 * we want this time to be as late as possible
 			 */
  			PROCSTAT(ser_stat[info->line].tx_dma_ints++);
 			info->last_tx_active_usec = GET_JIFFIES_USEC();
 			info->last_tx_active = jiffies;
-			transmit_chars(info);
+			transmit_chars_dma(info);
 		}
 		
 		/* FIXME: here we should really check for a change in the
 		   status lines and if so call status_handle(info) */
 	}
 	return IRQ_RETVAL(handled);
-}
+} /* tr_interrupt */
 
 /* dma input channel interrupt handler */
 
@@ -2054,7 +2422,7 @@
 		const char *s = "What? rec_interrupt in simulator??\n";
 		SIMCOUT(s,strlen(s));
 	}
-	return;
+	return IRQ_HANDLED;
 #endif
 	
 	/* find out the line that caused this irq and get it from rs_table */
@@ -2063,20 +2431,20 @@
 	
 	for (i = 0; i < NR_PORTS; i++) {
 		info = rs_table + i;
-		if (!info->enabled || !info->uses_dma) 
+		if (!info->enabled || !info->uses_dma_in)
 			continue; 
 		/* check for both dma_eop and dma_descr for the input dma channel */
 		if (ireg & ((info->irq << 2) | (info->irq << 3))) {
 			handled = 1; 
 			/* we have received something */
-			receive_chars(info);
+			receive_chars_dma(info);
 		}
 		
 		/* FIXME: here we should really check for a change in the
 		   status lines and if so call status_handle(info) */
 	}
 	return IRQ_RETVAL(handled);
-}
+} /* rec_interrupt */
 
 static _INLINE_ int
 force_eop_if_needed(struct e100_serial *info)
@@ -2116,20 +2484,21 @@
 	if (!info->forced_eop) {
 		info->forced_eop = 1;
 		PROCSTAT(ser_stat[info->line].timeout_flush_cnt++);
-		DEBUG_LOG(info->line, "timeout EOP %i\n", info->line);
+		TIMERD(DEBUG_LOG(info->line, "timeout EOP %i\n", info->line));
 		FORCE_EOP(info);
 	}
 
 	return 1;
 }
 
-static _INLINE_ void
+extern _INLINE_ void
 flush_to_flip_buffer(struct e100_serial *info)
 {
 	struct tty_struct *tty;
 	struct etrax_recv_buffer *buffer;
 	unsigned int length;
 	unsigned long flags;
+	int max_flip_size;
 
 	if (!info->first_recv_buffer)
 		return;
@@ -2143,12 +2512,46 @@
 	}
 
 	length = tty->flip.count;
+	/* Don't flip more than the ldisc has room for.
+	 * The return value from ldisc.receive_room(tty) - might not be up to
+	 * date, the previous flip of up to TTY_FLIPBUF_SIZE might be on the
+	 * processed and not accounted for yet.
+	 * Since we use DMA, 1 SERIAL_DESCR_BUF_SIZE could be on the way.
+	 * Lets buffer data here and let flow control take care of it.
+	 * Since we normally flip large chunks, the ldisc don't react
+	 * with throttle until too late if we flip to much.
+	 */
+	max_flip_size = tty->ldisc.receive_room(tty);
+	if (max_flip_size < 0)
+		max_flip_size = 0;
+	if (max_flip_size <= (TTY_FLIPBUF_SIZE +         /* Maybe not accounted for */
+			      length + info->recv_cnt +  /* We have this queued */
+			      2*SERIAL_DESCR_BUF_SIZE +    /* This could be on the way */
+			      TTY_THRESHOLD_THROTTLE)) { /* Some slack */
+		/* check TTY_THROTTLED first so it indicates our state */
+		if (!test_and_set_bit(TTY_THROTTLED, &tty->flags)) {
+			DFLOW(DEBUG_LOG(info->line,"flush_to_flip throttles room %lu\n", max_flip_size));
+			rs_throttle(tty);
+		}
+#if 0
+		else if (max_flip_size <= (TTY_FLIPBUF_SIZE +         /* Maybe not accounted for */
+					   length + info->recv_cnt +  /* We have this queued */
+					   SERIAL_DESCR_BUF_SIZE +    /* This could be on the way */
+					   TTY_THRESHOLD_THROTTLE)) { /* Some slack */
+			DFLOW(DEBUG_LOG(info->line,"flush_to_flip throttles again! %lu\n", max_flip_size));
+			rs_throttle(tty);
+		}
+#endif
+	}
+
+	if (max_flip_size > TTY_FLIPBUF_SIZE)
+		max_flip_size = TTY_FLIPBUF_SIZE;
 
-	while ((buffer = info->first_recv_buffer) && length < TTY_FLIPBUF_SIZE) {
+	while ((buffer = info->first_recv_buffer) && length < max_flip_size) {
 		unsigned int count = buffer->length;
 
-		if (length + count > TTY_FLIPBUF_SIZE)
-			count = TTY_FLIPBUF_SIZE - length;
+		if (length + count > max_flip_size)
+			count = max_flip_size - length;
 
 		memcpy(tty->flip.char_buf_ptr + length, buffer->buffer, count);
 		memset(tty->flip.flag_buf_ptr + length, TTY_NORMAL, count);
@@ -2156,6 +2559,7 @@
 
 		length += count;
 		info->recv_cnt -= count;
+		DFLIP(DEBUG_LOG(info->line,"flip: %i\n", length));
 
 		if (count == buffer->length) {
 			info->first_recv_buffer = buffer->next;
@@ -2171,9 +2575,30 @@
 		info->last_recv_buffer = NULL;
 
 	tty->flip.count = length;
-
+	DFLIP(if (tty->ldisc.chars_in_buffer(tty) > 3500) {
+		DEBUG_LOG(info->line, "ldisc %lu\n",
+			  tty->ldisc.chars_in_buffer(tty));
+		DEBUG_LOG(info->line, "flip.count %lu\n",
+			  tty->flip.count);
+	      }
+	      );
 	restore_flags(flags);
 
+	DFLIP(
+	  if (1) {
+
+		  if (test_bit(TTY_DONT_FLIP, &tty->flags)) {
+			  DEBUG_LOG(info->line, "*** TTY_DONT_FLIP set flip.count %i ***\n", tty->flip.count);
+			  DEBUG_LOG(info->line, "*** recv_cnt %i\n", info->recv_cnt);
+		  } else {
+		  }
+		  DEBUG_LOG(info->line, "*** rxtot %i\n", info->icount.rx);
+		  DEBUG_LOG(info->line, "ldisc %lu\n", tty->ldisc.chars_in_buffer(tty));
+		  DEBUG_LOG(info->line, "room  %lu\n", tty->ldisc.receive_room(tty));
+	  }
+
+	);
+
 	/* this includes a check for low-latency */
 	tty_flip_buffer_push(tty);
 }
@@ -2181,12 +2606,19 @@
 static _INLINE_ void
 check_flush_timeout(struct e100_serial *info)
 {
-	force_eop_if_needed(info);
-
+	/* Flip what we've got (if we can) */
 	flush_to_flip_buffer(info);
 
+	/* We might need to flip later, but not to fast
+	 * since the system is busy processing input... */
 	if (info->first_recv_buffer)
-		START_FLUSH_FAST_TIMER(info, "flip");
+		START_FLUSH_FAST_TIMER_TIME(info, "flip", 2000);
+
+	/* Force eop last, since data might have come while we're processing
+	 * and if we started the slow timer above, we won't start a fast
+	 * below.
+	 */
+	force_eop_if_needed(info);
 }
 
 #ifdef CONFIG_ETRAX_SERIAL_FAST_TIMER
@@ -2222,7 +2654,7 @@
 	
 	for (i = 0; i < NR_PORTS; i++) {
 		info = rs_table + i;
-		if (info->uses_dma) 
+		if (info->uses_dma_in)
 			check_flush_timeout(info);
 	}
 
@@ -2301,14 +2733,158 @@
 
 */
 
-extern irqreturn_t _INLINE_ handle_ser_interrupt(struct e100_serial *info)
+extern _INLINE_
+struct e100_serial * handle_ser_rx_interrupt_no_dma(struct e100_serial *info)
 {
-	unsigned char rstat = info->port[REG_STATUS];
+	unsigned long data_read;
+	struct tty_struct *tty = info->tty;
+
+	if (!tty) {
+		printk("!NO TTY!\n");
+		return info;
+	}
+	if (tty->flip.count >= TTY_FLIPBUF_SIZE - TTY_THRESHOLD_THROTTLE) {
+		/* check TTY_THROTTLED first so it indicates our state */
+		if (!test_and_set_bit(TTY_THROTTLED, &tty->flags)) {
+			DFLOW(DEBUG_LOG(info->line, "rs_throttle flip.count: %i\n", tty->flip.count));
+			rs_throttle(tty);
+		}
+	}
+	if (tty->flip.count >= TTY_FLIPBUF_SIZE) {
+		DEBUG_LOG(info->line, "force FLIP! %i\n", tty->flip.count);
+		tty->flip.work.func((void *) tty);
+		if (tty->flip.count >= TTY_FLIPBUF_SIZE) {
+			DEBUG_LOG(info->line, "FLIP FULL! %i\n", tty->flip.count);
+			return info;		/* if TTY_DONT_FLIP is set */
+		}
+	}
+	/* Read data and status at the same time */
+	data_read = *((unsigned long *)&info->port[REG_DATA_STATUS32]);
+more_data:
+	if (data_read & IO_MASK(R_SERIAL0_READ, xoff_detect) ) {
+		DFLOW(DEBUG_LOG(info->line, "XOFF detect\n", 0));
+	}
+	DINTR2(DEBUG_LOG(info->line, "ser_rx   %c\n", IO_EXTRACT(R_SERIAL0_READ, data_in, data_read)));
+
+	if (data_read & ( IO_MASK(R_SERIAL0_READ, framing_err) |
+			  IO_MASK(R_SERIAL0_READ, par_err) |
+			  IO_MASK(R_SERIAL0_READ, overrun) )) {
+		/* An error */
+		info->last_rx_active_usec = GET_JIFFIES_USEC();
+		info->last_rx_active = jiffies;
+		DINTR1(DEBUG_LOG(info->line, "ser_rx err stat_data %04X\n", data_read));
+		DLOG_INT_TRIG(
+		if (!log_int_trig1_pos) {
+			log_int_trig1_pos = log_int_pos;
+			log_int(rdpc(), 0, 0);
+		}
+		);
+
+
+		if ( ((data_read & IO_MASK(R_SERIAL0_READ, data_in)) == 0) &&
+		     (data_read & IO_MASK(R_SERIAL0_READ, framing_err)) ) {
+			/* Most likely a break, but we get interrupts over and
+			 * over again.
+			 */
+
+			if (!info->break_detected_cnt) {
+				DEBUG_LOG(info->line, "#BRK start\n", 0);
+			}
+			if (data_read & IO_MASK(R_SERIAL0_READ, rxd)) {
+				/* The RX pin is high now, so the break
+				 * must be over, but....
+				 * we can't really know if we will get another
+				 * last byte ending the break or not.
+				 * And we don't know if the byte (if any) will
+				 * have an error or look valid.
+				 */
+				DEBUG_LOG(info->line, "# BL BRK\n", 0);
+				info->errorcode = ERRCODE_INSERT_BREAK;
+			}
+			info->break_detected_cnt++;
+		} else {
+			/* The error does not look like a break, but could be
+			 * the end of one
+			 */
+			if (info->break_detected_cnt) {
+				DEBUG_LOG(info->line, "EBRK %i\n", info->break_detected_cnt);
+				info->errorcode = ERRCODE_INSERT_BREAK;
+			} else {
+				if (info->errorcode == ERRCODE_INSERT_BREAK) {
+					info->icount.brk++;
+					*tty->flip.char_buf_ptr = 0;
+					*tty->flip.flag_buf_ptr = TTY_BREAK;
+					tty->flip.flag_buf_ptr++;
+					tty->flip.char_buf_ptr++;
+					tty->flip.count++;
+					info->icount.rx++;
+				}
+				*tty->flip.char_buf_ptr = IO_EXTRACT(R_SERIAL0_READ, data_in, data_read);
+
+				if (data_read & IO_MASK(R_SERIAL0_READ, par_err)) {
+					info->icount.parity++;
+					*tty->flip.flag_buf_ptr = TTY_PARITY;
+				} else if (data_read & IO_MASK(R_SERIAL0_READ, overrun)) {
+					info->icount.overrun++;
+					*tty->flip.flag_buf_ptr = TTY_OVERRUN;
+				} else if (data_read & IO_MASK(R_SERIAL0_READ, framing_err)) {
+					info->icount.frame++;
+					*tty->flip.flag_buf_ptr = TTY_FRAME;
+				}
+				info->errorcode = 0;
+			}
+			info->break_detected_cnt = 0;
+		}
+	} else if (data_read & IO_MASK(R_SERIAL0_READ, data_avail)) {
+		/* No error */
+		DLOG_INT_TRIG(
+		if (!log_int_trig1_pos) {
+			if (log_int_pos >= log_int_size) {
+				log_int_pos = 0;
+			}
+			log_int_trig0_pos = log_int_pos;
+			log_int(rdpc(), 0, 0);
+		}
+		);
+		*tty->flip.char_buf_ptr = IO_EXTRACT(R_SERIAL0_READ, data_in, data_read);
+		*tty->flip.flag_buf_ptr = 0;
+	} else {
+		DEBUG_LOG(info->line, "ser_rx int but no data_avail  %08lX\n", data_read);
+	}
+
+
+	tty->flip.flag_buf_ptr++;
+	tty->flip.char_buf_ptr++;
+	tty->flip.count++;
+	info->icount.rx++;
+	data_read = *((unsigned long *)&info->port[REG_DATA_STATUS32]);
+	if (data_read & IO_MASK(R_SERIAL0_READ, data_avail)) {
+		DEBUG_LOG(info->line, "ser_rx   %c in loop\n", IO_EXTRACT(R_SERIAL0_READ, data_in, data_read));
+		goto more_data;
+	}
+
+	tty_flip_buffer_push(info->tty);
+	return info;
+}
+
+extern _INLINE_
+struct e100_serial* handle_ser_rx_interrupt(struct e100_serial *info)
+{
+	unsigned char rstat;
 
 #ifdef SERIAL_DEBUG_INTR
 	printk("Interrupt from serport %d\n", i);
 #endif
 /*	DEBUG_LOG(info->line, "ser_interrupt stat %03X\n", rstat | (i << 8)); */
+	if (!info->uses_dma_in) {
+		return handle_ser_rx_interrupt_no_dma(info);
+	}
+	/* DMA is used */
+	rstat = info->port[REG_STATUS];
+	if (rstat & IO_MASK(R_SERIAL0_STATUS, xoff_detect) ) {
+		DFLOW(DEBUG_LOG(info->line, "XOFF detect\n", 0));
+	}
+
 	if (rstat & SER_ERROR_MASK) {
 		unsigned char data;
 
@@ -2318,7 +2894,8 @@
 		 * data_in field
 		 */
 		data = info->port[REG_DATA];
-
+		DINTR1(DEBUG_LOG(info->line, "ser_rx!  %c\n", data));
+		DINTR1(DEBUG_LOG(info->line, "ser_rx err stat %02X\n", rstat));
 		if (!data && (rstat & SER_FRAMING_ERR_MASK)) {
 			/* Most likely a break, but we get interrupts over and
 			 * over again.
@@ -2347,15 +2924,22 @@
 				DEBUG_LOG(info->line, "EBRK %i\n", info->break_detected_cnt);
 				info->errorcode = ERRCODE_INSERT_BREAK;
 			} else {
-				if (info->errorcode == ERRCODE_INSERT_BREAK)
+				if (info->errorcode == ERRCODE_INSERT_BREAK) {
+					info->icount.brk++;
 					add_char_and_flag(info, '\0', TTY_BREAK);
+				}
 
-				if (rstat & SER_PAR_ERR_MASK)
+				if (rstat & SER_PAR_ERR_MASK) {
+					info->icount.parity++;
 					add_char_and_flag(info, data, TTY_PARITY);
-				else if (rstat & SER_OVERRUN_MASK)
+				} else if (rstat & SER_OVERRUN_MASK) {
+					info->icount.overrun++;
 					add_char_and_flag(info, data, TTY_OVERRUN);
-				else if (rstat & SER_FRAMING_ERR_MASK)
+				} else if (rstat & SER_FRAMING_ERR_MASK) {
+					info->icount.frame++;
 					add_char_and_flag(info, data, TTY_FRAME);
+				}
+
 				info->errorcode = 0;
 			}
 			info->break_detected_cnt = 0;
@@ -2379,7 +2963,7 @@
 			if (elapsed_usec < 2*info->char_time_usec) {
 				DEBUG_LOG(info->line, "FBRK %i\n", info->line);
 				/* Report as BREAK (error) and let
-				 * receive_chars() handle it
+				 * receive_chars_dma() handle it
 				 */
 				info->errorcode = ERRCODE_SET_BREAK;
 			} else {
@@ -2392,38 +2976,196 @@
 		printk("** OK, disabling ser_interrupts\n");
 #endif
 		e100_disable_serial_data_irq(info);
-
+		DINTR2(DEBUG_LOG(info->line, "ser_rx OK %d\n", info->line));
 		info->break_detected_cnt = 0;
 
 		PROCSTAT(ser_stat[info->line].ser_ints_ok_cnt++);
-		DEBUG_LOG(info->line, "ser_int OK %d\n", info->line);
 	}
-
 	/* Restarting the DMA never hurts */
 	*info->icmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, restart);
 	START_FLUSH_FAST_TIMER(info, "ser_int");
-	return IRQ_HANDLED;
-} /* handle_ser_interrupt */
+	return info;
+} /* handle_ser_rx_interrupt */
+
+extern _INLINE_ void handle_ser_tx_interrupt(struct e100_serial *info)
+{
+	unsigned long flags;
+
+	if (info->x_char) {
+		unsigned char rstat;
+		DFLOW(DEBUG_LOG(info->line, "tx_int: xchar 0x%02X\n", info->x_char));
+		save_flags(flags); cli();
+		rstat = info->port[REG_STATUS];
+		DFLOW(DEBUG_LOG(info->line, "stat %x\n", rstat));
+
+		info->port[REG_TR_DATA] = info->x_char;
+		info->icount.tx++;
+		info->x_char = 0;
+		/* We must enable since it is disabled in ser_interrupt */
+		e100_enable_serial_tx_ready_irq(info);
+		restore_flags(flags);
+		return;
+	}
+	if (info->uses_dma_out) {
+		unsigned char rstat;
+		int i;
+		/* We only use normal tx interrupt when sending x_char */
+		DFLOW(DEBUG_LOG(info->line, "tx_int: xchar sent\n", 0));
+		save_flags(flags); cli();
+		rstat = info->port[REG_STATUS];
+		DFLOW(DEBUG_LOG(info->line, "stat %x\n", rstat));
+		e100_disable_serial_tx_ready_irq(info);
+		if (info->tty->stopped)
+			rs_stop(info->tty);
+		/* Enable the DMA channel and tell it to continue */
+		e100_enable_txdma_channel(info);
+		/* Wait 12 cycles before doing the DMA command */
+		for(i = 6;  i > 0; i--)
+			nop();
+
+		*info->ocmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, continue);
+		restore_flags(flags);
+		return;
+	}
+	/* Normal char-by-char interrupt */
+	if (info->xmit.head == info->xmit.tail
+	    || info->tty->stopped
+	    || info->tty->hw_stopped) {
+		DFLOW(DEBUG_LOG(info->line, "tx_int: stopped %i\n", info->tty->stopped));
+		e100_disable_serial_tx_ready_irq(info);
+		info->tr_running = 0;
+		return;
+	}
+	DINTR2(DEBUG_LOG(info->line, "tx_int %c\n", info->xmit.buf[info->xmit.tail]));
+	/* Send a byte, rs485 timing is critical so turn of ints */
+	save_flags(flags); cli();
+	info->port[REG_TR_DATA] = info->xmit.buf[info->xmit.tail];
+	info->xmit.tail = (info->xmit.tail + 1) & (SERIAL_XMIT_SIZE-1);
+	info->icount.tx++;
+	if (info->xmit.head == info->xmit.tail) {
+#if defined(CONFIG_ETRAX_RS485) && defined(CONFIG_ETRAX_FAST_TIMER)
+		if (info->rs485.enabled) {
+			/* Set a short timer to toggle RTS */
+			start_one_shot_timer(&fast_timers_rs485[info->line],
+			                     rs485_toggle_rts_timer_function,
+			                     (unsigned long)info,
+			                     info->char_time_usec*2,
+			                     "RS-485");
+		}
+#endif /* RS485 */
+		info->last_tx_active_usec = GET_JIFFIES_USEC();
+		info->last_tx_active = jiffies;
+		e100_disable_serial_tx_ready_irq(info);
+		info->tr_running = 0;
+		DFLOW(DEBUG_LOG(info->line, "tx_int: stop2\n", 0));
+	} else {
+		/* We must enable since it is disabled in ser_interrupt */
+		e100_enable_serial_tx_ready_irq(info);
+	}
+	restore_flags(flags);
+
+	if (CIRC_CNT(info->xmit.head,
+		     info->xmit.tail,
+		     SERIAL_XMIT_SIZE) < WAKEUP_CHARS)
+		rs_sched_event(info, RS_EVENT_WRITE_WAKEUP);
+
+} /* handle_ser_tx_interrupt */
 
+/* result of time measurements:
+ * RX duration 54-60 us when doing something, otherwise 6-9 us
+ * ser_int duration: just sending: 8-15 us normally, up to 73 us
+ */
 static irqreturn_t
 ser_interrupt(int irq, void *dev_id, struct pt_regs *regs)
 {
+	static volatile int tx_started = 0;
 	struct e100_serial *info;
 	int i;
+	unsigned long flags;
+	unsigned long irq_mask1_rd;
+	unsigned long data_mask = (1 << (8+2*0)); /* ser0 data_avail */
 	int handled = 0;
+	static volatile unsigned long reentered_ready_mask = 0;
 
+	save_flags(flags); cli();
+	irq_mask1_rd = *R_IRQ_MASK1_RD;
+	/* First handle all rx interrupts with ints disabled */
+	info = rs_table;
+	irq_mask1_rd &= e100_ser_int_mask;
 	for (i = 0; i < NR_PORTS; i++) {
-		info = rs_table + i;
-
-		if (!info->enabled || !info->uses_dma) 
-			continue; 
-
-		/* Which line caused the irq? */
-		if (*R_IRQ_MASK1_RD & (1U << (8+2*info->line))) { 
+		/* Which line caused the data irq? */
+		if (irq_mask1_rd & data_mask) {
 			handled = 1;
-			handle_ser_interrupt(info);
+			handle_ser_rx_interrupt(info);
 		}
+		info += 1;
+		data_mask <<= 2;
 	}
+	/* Handle tx interrupts with interrupts enabled so we
+	 * can take care of new data interrupts while transmitting
+	 * We protect the tx part with the tx_started flag.
+	 * We disable the tr_ready interrupts we are about to handle and
+	 * unblock the serial interrupt so new serial interrupts may come.
+	 *
+	 * If we get a new interrupt:
+	 *  - it migth be due to synchronous serial ports.
+	 *  - serial irq will be blocked by general irq handler.
+	 *  - async data will be handled above (sync will be ignored).
+	 *  - tx_started flag will prevent us from trying to send again and
+	 *    we will exit fast - no need to unblock serial irq.
+	 *  - Next (sync) serial interrupt handler will be runned with
+	 *    disabled interrupt due to restore_flags() at end of function,
+	 *    so sync handler will not be preempted or reentered.
+	 */
+	if (!tx_started) {
+		unsigned long ready_mask;
+		unsigned long
+		tx_started = 1;
+		/* Only the tr_ready interrupts left */
+		irq_mask1_rd &= (IO_MASK(R_IRQ_MASK1_RD, ser0_ready) |
+				 IO_MASK(R_IRQ_MASK1_RD, ser1_ready) |
+				 IO_MASK(R_IRQ_MASK1_RD, ser2_ready) |
+				 IO_MASK(R_IRQ_MASK1_RD, ser3_ready));
+		while (irq_mask1_rd) {
+			/* Disable those we are about to handle */
+			*R_IRQ_MASK1_CLR = irq_mask1_rd;
+			/* Unblock the serial interrupt */
+			*R_VECT_MASK_SET = IO_STATE(R_VECT_MASK_SET, serial, set);
+
+			sti();
+			ready_mask = (1 << (8+1+2*0)); /* ser0 tr_ready */
+			info = rs_table;
+			for (i = 0; i < NR_PORTS; i++) {
+				/* Which line caused the ready irq? */
+				if (irq_mask1_rd & ready_mask) {
+					handled = 1;
+					handle_ser_tx_interrupt(info);
+				}
+				info += 1;
+				ready_mask <<= 2;
+			}
+			/* handle_ser_tx_interrupt enables tr_ready interrupts */
+			cli();
+			/* Handle reentered TX interrupt */
+			irq_mask1_rd = reentered_ready_mask;
+		}
+		cli();
+		tx_started = 0;
+	} else {
+		unsigned long ready_mask;
+		ready_mask = irq_mask1_rd & (IO_MASK(R_IRQ_MASK1_RD, ser0_ready) |
+					     IO_MASK(R_IRQ_MASK1_RD, ser1_ready) |
+					     IO_MASK(R_IRQ_MASK1_RD, ser2_ready) |
+					     IO_MASK(R_IRQ_MASK1_RD, ser3_ready));
+		if (ready_mask) {
+			reentered_ready_mask |= ready_mask;
+			/* Disable those we are about to handle */
+			*R_IRQ_MASK1_CLR = ready_mask;
+			DFLOW(DEBUG_LOG(SERIAL_DEBUG_LINE, "ser_int reentered with TX %X\n", ready_mask));
+		}
+	}
+
+	restore_flags(flags);
 	return IRQ_RETVAL(handled);
 } /* ser_interrupt */
 #endif
@@ -2489,7 +3231,7 @@
 		info->xmit.buf = (unsigned char *) xmit_page;
 
 #ifdef SERIAL_DEBUG_OPEN
-	printk("starting up ttyS%d (xmit_buf 0x%p, recv_buf 0x%p)...\n", info->line, info->xmit.buf, info->recv.buf);
+	printk("starting up ttyS%d (xmit_buf 0x%p)...\n", info->line, info->xmit.buf);
 #endif
 
 #ifdef CONFIG_SVINTO_SIM
@@ -2520,24 +3262,39 @@
 	 * Reset the DMA channels and make sure their interrupts are cleared
 	 */
 
-	info->uses_dma = 1;
-	*info->icmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, reset);
-	*info->ocmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, reset);
-
-	/* Wait until reset cycle is complete */
-	while (IO_EXTRACT(R_DMA_CH6_CMD, cmd, *info->icmdadr) ==
-	       IO_STATE_VALUE(R_DMA_CH6_CMD, cmd, reset));
+	if (info->dma_in_enabled) {
+		info->uses_dma_in = 1;
+		e100_enable_rxdma_channel(info);
+
+		*info->icmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, reset);
+
+		/* Wait until reset cycle is complete */
+		while (IO_EXTRACT(R_DMA_CH6_CMD, cmd, *info->icmdadr) ==
+		       IO_STATE_VALUE(R_DMA_CH6_CMD, cmd, reset));
+
+		/* Make sure the irqs are cleared */
+		*info->iclrintradr =
+			IO_STATE(R_DMA_CH6_CLR_INTR, clr_descr, do) |
+			IO_STATE(R_DMA_CH6_CLR_INTR, clr_eop, do);
+	} else {
+		e100_disable_rxdma_channel(info);
+	}
 
-	while (IO_EXTRACT(R_DMA_CH6_CMD, cmd, *info->ocmdadr) ==
-	       IO_STATE_VALUE(R_DMA_CH6_CMD, cmd, reset));
+	if (info->dma_out_enabled) {
+		info->uses_dma_out = 1;
+		e100_enable_txdma_channel(info);
+		*info->ocmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, reset);
 
-	/* Make sure the irqs are cleared */
-	*info->iclrintradr =
-		IO_STATE(R_DMA_CH6_CLR_INTR, clr_descr, do) |
-		IO_STATE(R_DMA_CH6_CLR_INTR, clr_eop, do);
-	*info->oclrintradr =
-		IO_STATE(R_DMA_CH6_CLR_INTR, clr_descr, do) |
-		IO_STATE(R_DMA_CH6_CLR_INTR, clr_eop, do);
+		while (IO_EXTRACT(R_DMA_CH6_CMD, cmd, *info->ocmdadr) ==
+		       IO_STATE_VALUE(R_DMA_CH6_CMD, cmd, reset));
+
+		/* Make sure the irqs are cleared */
+		*info->oclrintradr =
+			IO_STATE(R_DMA_CH6_CLR_INTR, clr_descr, do) |
+			IO_STATE(R_DMA_CH6_CLR_INTR, clr_eop, do);
+	} else {
+		e100_disable_txdma_channel(info);
+	}
 
 	if (info->tty)
 		clear_bit(TTY_IO_ERROR, &info->tty->flags);
@@ -2563,9 +3320,10 @@
 	(void)info->port[REG_DATA];
 
 	/* enable the interrupts */
+	if (info->uses_dma_out)
+		e100_enable_txdma_irq(info);
 
-	e100_enable_txdma_irq(info);
-	e100_enable_rxdma_irq(info);
+	e100_enable_rx_irq(info);
 
 	info->tr_running = 0; /* to be sure we don't lock up the transmitter */
 
@@ -2606,20 +3364,28 @@
 
 #ifndef CONFIG_SVINTO_SIM	
 	/* shut down the transmitter and receiver */
-
+	DFLOW(DEBUG_LOG(info->line, "shutdown %i\n", info->line));
 	e100_disable_rx(info);
 	info->port[REG_TR_CTRL] = (info->tx_ctrl &= ~0x40);
 
-	e100_disable_rxdma_irq(info);
-	e100_disable_txdma_irq(info);
-
-	info->tr_running = 0;
-
-	/* reset both dma channels */
+	/* disable interrupts, reset dma channels */
+	if (info->uses_dma_in) {
+		e100_disable_rxdma_irq(info);
+		*info->icmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, reset);
+		info->uses_dma_in = 0;
+	} else {
+		e100_disable_serial_data_irq(info);
+	}
 
-	*info->icmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, reset);
-	*info->ocmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, reset);
-	info->uses_dma = 0;
+	if (info->uses_dma_out) {
+		e100_disable_txdma_irq(info);
+		info->tr_running = 0;
+		*info->ocmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, reset);
+		info->uses_dma_out = 0;
+	} else {
+		e100_disable_serial_tx_ready_irq(info);
+		info->tr_running = 0;
+	}
 
 #endif /* CONFIG_SVINTO_SIM */
 
@@ -2667,7 +3433,7 @@
 {
 	unsigned int cflag;
 	unsigned long xoff;
-
+	unsigned long flags;
 	/* first some safety checks */
 	
 	if (!info->tty || !info->tty->termios)
@@ -2676,17 +3442,80 @@
 		return;
 	
 	cflag = info->tty->termios->c_cflag;
-	
+
 	/* possibly, the tx/rx should be disabled first to do this safely */
 	
 	/* change baud-rate and write it to the hardware */
-	
-	info->baud = cflag_to_baud(cflag);
+	if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST) {
+		/* Special baudrate */
+		u32 mask = 0xFF << (info->line*8); /* Each port has 8 bits */
+		unsigned long alt_source =
+				IO_STATE(R_ALT_SER_BAUDRATE, ser0_rec, normal) |
+				IO_STATE(R_ALT_SER_BAUDRATE, ser0_tr, normal);
+		/* R_ALT_SER_BAUDRATE selects the source */
+		DBAUD(printk("Custom baudrate: baud_base/divisor %lu/%i\n",
+		       (unsigned long)info->baud_base, info->custom_divisor));
+		if (info->baud_base == SERIAL_PRESCALE_BASE) {
+			/* 0, 2-65535 (0=65536) */
+			u16 divisor = info->custom_divisor;
+			/* R_SERIAL_PRESCALE (upper 16 bits of R_CLOCK_PRESCALE) */
+			/* baudrate is 3.125MHz/custom_divisor */
+			alt_source =
+				IO_STATE(R_ALT_SER_BAUDRATE, ser0_rec, prescale) |
+				IO_STATE(R_ALT_SER_BAUDRATE, ser0_tr, prescale);
+			alt_source = 0x11;
+			DBAUD(printk("Writing SERIAL_PRESCALE: divisor %i\n", divisor));
+			*R_SERIAL_PRESCALE = divisor;
+			info->baud = SERIAL_PRESCALE_BASE/divisor;
+		}
+#ifdef CONFIG_ETRAX_EXTERN_PB6CLK_ENABLED
+		else if ((info->baud_base==CONFIG_ETRAX_EXTERN_PB6CLK_FREQ/8 &&
+			  info->custom_divisor == 1) ||
+			 (info->baud_base==CONFIG_ETRAX_EXTERN_PB6CLK_FREQ &&
+			  info->custom_divisor == 8)) {
+				/* ext_clk selected */
+				alt_source =
+					IO_STATE(R_ALT_SER_BAUDRATE, ser0_rec, extern) |
+					IO_STATE(R_ALT_SER_BAUDRATE, ser0_tr, extern);
+				DBAUD(printk("using external baudrate: %lu\n", CONFIG_ETRAX_EXTERN_PB6CLK_FREQ/8));
+				info->baud = CONFIG_ETRAX_EXTERN_PB6CLK_FREQ/8;
+			}
+		}
+#endif
+		else
+		{
+			/* Bad baudbase, we don't support using timer0
+			 * for baudrate.
+			 */
+			printk(KERN_WARNING "Bad baud_base/custom_divisor: %lu/%i\n",
+			       (unsigned long)info->baud_base, info->custom_divisor);
+		}
+		r_alt_ser_baudrate_shadow &= ~mask;
+		r_alt_ser_baudrate_shadow |= (alt_source << (info->line*8));
+		*R_ALT_SER_BAUDRATE = r_alt_ser_baudrate_shadow;
+	} else {
+		/* Normal baudrate */
+		/* Make sure we use normal baudrate */
+		u32 mask = 0xFF << (info->line*8); /* Each port has 8 bits */
+		unsigned long alt_source =
+			IO_STATE(R_ALT_SER_BAUDRATE, ser0_rec, normal) |
+			IO_STATE(R_ALT_SER_BAUDRATE, ser0_tr, normal);
+		r_alt_ser_baudrate_shadow &= ~mask;
+		r_alt_ser_baudrate_shadow |= (alt_source << (info->line*8));
+#ifndef CONFIG_SVINTO_SIM
+		*R_ALT_SER_BAUDRATE = r_alt_ser_baudrate_shadow;
+#endif /* CONFIG_SVINTO_SIM */
+
+		info->baud = cflag_to_baud(cflag);
+#ifndef CONFIG_SVINTO_SIM
+		info->port[REG_BAUD] = cflag_to_etrax_baud(cflag);
+#endif /* CONFIG_SVINTO_SIM */
+	}
 	
 #ifndef CONFIG_SVINTO_SIM
-	info->port[REG_BAUD] = cflag_to_etrax_baud(cflag);
 	/* start with default settings and then fill in changes */
-
+	save_flags(flags);
+	cli();
 	/* 8 bit, no/even parity */
 	info->rx_ctrl &= ~(IO_MASK(R_SERIAL0_REC_CTRL, rec_bitnr) |
 			   IO_MASK(R_SERIAL0_REC_CTRL, rec_par_en) |
@@ -2717,24 +3546,19 @@
 	}
 	
 	if (cflag & CMSPAR) {
-		/* enable stick parity */
+		/* enable stick parity, PARODD mean Mark which matches ETRAX */
 		info->tx_ctrl |= IO_STATE(R_SERIAL0_TR_CTRL, tr_stick_par, stick);
 		info->rx_ctrl |= IO_STATE(R_SERIAL0_REC_CTRL, rec_stick_par, stick);
-		if (!(cflag & PARODD)) {
-			/* set mark parity */
-			info->tx_ctrl |= IO_STATE(R_SERIAL0_TR_CTRL, tr_par, odd);
-			info->rx_ctrl |= IO_STATE(R_SERIAL0_REC_CTRL, rec_par, odd);
-		}
-	} else {
-		if (cflag & PARODD) {
-			/* set odd parity */
-			info->tx_ctrl |= IO_STATE(R_SERIAL0_TR_CTRL, tr_par, odd);
-			info->rx_ctrl |= IO_STATE(R_SERIAL0_REC_CTRL, rec_par, odd);
-		}
+	}
+	if (cflag & PARODD) {
+		/* set odd parity (or Mark if CMSPAR) */
+		info->tx_ctrl |= IO_STATE(R_SERIAL0_TR_CTRL, tr_par, odd);
+		info->rx_ctrl |= IO_STATE(R_SERIAL0_REC_CTRL, rec_par, odd);
 	}
 	
 	if (cflag & CRTSCTS) {
 		/* enable automatic CTS handling */
+		DFLOW(DEBUG_LOG(info->line, "FLOW auto_cts enabled\n", 0));
 		info->tx_ctrl |= IO_STATE(R_SERIAL0_TR_CTRL, auto_cts, active);
 	}
 	
@@ -2750,13 +3574,16 @@
 	xoff = IO_FIELD(R_SERIAL0_XOFF, xoff_char, STOP_CHAR(info->tty));
 	xoff |= IO_STATE(R_SERIAL0_XOFF, tx_stop, enable);
 	if (info->tty->termios->c_iflag & IXON ) {
+		DFLOW(DEBUG_LOG(info->line, "FLOW XOFF enabled 0x%02X\n", STOP_CHAR(info->tty)));
 		xoff |= IO_STATE(R_SERIAL0_XOFF, auto_xoff, enable);
 	}
 	
 	*((unsigned long *)&info->port[REG_XOFF]) = xoff;
+	restore_flags(flags);
 #endif /* !CONFIG_SVINTO_SIM */
 
 	update_char_time(info);
+
 } /* change_speed */
 
 /* start transmitting chars NOW */
@@ -2786,8 +3613,8 @@
 	restore_flags(flags);
 }
 
-extern inline int 
-raw_write(struct tty_struct * tty, int from_user,
+extern _INLINE_ int
+rs_raw_write(struct tty_struct * tty, int from_user,
 	  const unsigned char *buf, int count)
 {
 	int	c, ret = 0;
@@ -2801,7 +3628,7 @@
 	
 #ifdef SERIAL_DEBUG_DATA
 	if (info->line == SERIAL_DEBUG_LINE)
-		printk("raw_write (%d), status %d\n", 
+		printk("rs_raw_write (%d), status %d\n",
 		       count, info->port[REG_STATUS]);
 #endif
 
@@ -2811,6 +3638,9 @@
 	return count;
 #endif
 	save_flags(flags);
+	DFLOW(DEBUG_LOG(info->line, "write count %i ", count));
+	DFLOW(DEBUG_LOG(info->line, "ldisc %i\n", tty->ldisc.chars_in_buffer(tty)));
+
 	
 	/* the cli/restore_flags pairs below are needed because the
 	 * DMA interrupt handler moves the info->xmit values. the memcpy
@@ -2878,6 +3708,7 @@
 	 * this does not need IRQ protection since if tr_running == 0
 	 * the IRQ's are not running anyway for this port.
 	 */
+	DFLOW(DEBUG_LOG(info->line, "write ret %i\n", ret));
 	
 	if (info->xmit.head != info->xmit.tail &&
 	    !tty->stopped &&
@@ -2887,7 +3718,7 @@
 	}
  	
 	return ret;
-} /* raw_write() */
+} /* raw_raw_write() */
 
 static int 
 rs_write(struct tty_struct * tty, int from_user,
@@ -2909,7 +3740,7 @@
 		e100_rts(info, info->rs485.rts_on_send);
 #if defined(CONFIG_ETRAX_RS485_DISABLE_RECEIVER)
 		e100_disable_rx(info);
-		e100_disable_rxdma_irq(info);
+		e100_enable_rx_irq(info);
 #endif
 
 		if (info->rs485.delay_rts_before_send > 0) {
@@ -2919,7 +3750,7 @@
 	}
 #endif /* CONFIG_ETRAX_RS485 */
 
-	count = raw_write(tty, from_user, buf, count);
+	count = rs_raw_write(tty, from_user, buf, count);
 
 #if defined(CONFIG_ETRAX_RS485)
 	if (info->rs485.enabled)
@@ -3003,23 +3834,33 @@
  * This function is used to send a high-priority XON/XOFF character to
  * the device
  *
- * Since we use DMA we don't check for info->x_char in transmit_chars,
- * just disable DMA channel and write the character when possible.
+ * Since we use DMA we don't check for info->x_char in transmit_chars_dma(),
+ * but we do it in handle_ser_tx_interrupt().
+ * We disable DMA channel and enable tx ready interrupt and write the
+ * character when possible.
  */
 static void rs_send_xchar(struct tty_struct *tty, char ch)
 {
 	struct e100_serial *info = (struct e100_serial *)tty->driver_data;
+	unsigned long flags;
+	save_flags(flags); cli();
+	if (info->uses_dma_out) {
+		/* Put the DMA on hold and disable the channel */
+		*info->ocmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, hold);
+		while (IO_EXTRACT(R_DMA_CH6_CMD, cmd, *info->ocmdadr) !=
+		       IO_STATE_VALUE(R_DMA_CH6_CMD, cmd, hold));
+		e100_disable_txdma_channel(info);
+	}
 
-	e100_disable_txdma_channel(info);
-
-	/* Wait for tr_ready */
-	while (!(info->port[REG_STATUS] & IO_MASK(R_SERIAL0_STATUS, tr_ready)))
-		/* wait */;
-
-	/* Write the XON/XOFF char */
-	info->port[REG_TR_DATA] = ch;
+	/* Must make sure transmitter is not stopped before we can transmit */
+	if (tty->stopped)
+		rs_start(tty);
 
-	e100_enable_txdma_channel(info);
+	/* Enable manual transmit interrupt and send from there */
+	DFLOW(DEBUG_LOG(info->line, "rs_send_xchar 0x%02X\n", ch));
+	info->x_char = ch;
+	e100_enable_serial_tx_ready_irq(info);
+	restore_flags(flags);
 }
 
 /*
@@ -3034,21 +3875,18 @@
 rs_throttle(struct tty_struct * tty)
 {
 	struct e100_serial *info = (struct e100_serial *)tty->driver_data;
-	unsigned long flags;
 #ifdef SERIAL_DEBUG_THROTTLE
 	char	buf[64];
 
-	printk("throttle %s: %d....\n", _tty_name(tty, buf),
-	       tty->ldisc.chars_in_buffer(tty));
+	printk("throttle %s: %lu....\n", tty_name(tty, buf),
+	       (unsigned long)tty->ldisc.chars_in_buffer(tty));
 #endif
+	DFLOW(DEBUG_LOG(info->line,"rs_throttle %lu\n", tty->ldisc.chars_in_buffer(tty)));
 
 	/* Do RTS before XOFF since XOFF might take some time */
 	if (tty->termios->c_cflag & CRTSCTS) {
-		/* Turn off RTS line (do this atomic) */
-		save_flags(flags); 
-		cli();
+		/* Turn off RTS line */
 		e100_rts(info, 0);
-		restore_flags(flags);
 	}
 	if (I_IXOFF(tty))
 		rs_send_xchar(tty, STOP_CHAR(tty));
@@ -3059,21 +3897,18 @@
 rs_unthrottle(struct tty_struct * tty)
 {
 	struct e100_serial *info = (struct e100_serial *)tty->driver_data;
-	unsigned long flags;
 #ifdef SERIAL_DEBUG_THROTTLE
 	char	buf[64];
 
-	printk("unthrottle %s: %d....\n", _tty_name(tty, buf),
-	       tty->ldisc.chars_in_buffer(tty));
+	printk("unthrottle %s: %lu....\n", tty_name(tty, buf),
+	       (unsigned long)tty->ldisc.chars_in_buffer(tty));
 #endif
-
+	DFLOW(DEBUG_LOG(info->line,"rs_unthrottle ldisc %d\n", tty->ldisc.chars_in_buffer(tty)));
+	DFLOW(DEBUG_LOG(info->line,"rs_unthrottle flip.count: %i\n", tty->flip.count));
 	/* Do RTS before XOFF since XOFF might take some time */
 	if (tty->termios->c_cflag & CRTSCTS) {
-		/* Assert RTS line (do this atomic) */
-		save_flags(flags); 
-		cli();
+		/* Assert RTS line  */
 		e100_rts(info, 1);
-		restore_flags(flags);
 	}
 
 	if (I_IXOFF(tty)) {
@@ -3110,8 +3945,10 @@
 	tmp.port = (int)info->port;
 	tmp.irq = info->irq;
 	tmp.flags = info->flags;
+	tmp.baud_base = info->baud_base;
 	tmp.close_delay = info->close_delay;
 	tmp.closing_wait = info->closing_wait;
+	tmp.custom_divisor = info->custom_divisor;
 	if (copy_to_user(retinfo, &tmp, sizeof(*retinfo)))
 		return -EFAULT;
 	return 0;
@@ -3149,8 +3986,10 @@
 	 * At this point, we start making changes.....
 	 */
 	
+	info->baud_base = new_serial.baud_base;
 	info->flags = ((info->flags & ~ASYNC_FLAGS) |
 		       (new_serial.flags & ASYNC_FLAGS));
+	info->custom_divisor = new_serial.custom_divisor;
 	info->type = new_serial.type;
 	info->close_delay = new_serial.close_delay;
 	info->closing_wait = new_serial.closing_wait;
@@ -3418,6 +4257,7 @@
 
 	change_speed(info);
 
+	/* Handle turning off CRTSCTS */
 	if ((old_termios->c_cflag & CRTSCTS) &&
 	    !(tty->termios->c_cflag & CRTSCTS)) {
 		tty->hw_stopped = 0;
@@ -3426,6 +4266,42 @@
 	
 }
 
+/* In debugport.c - register a console write function that uses the normal
+ * serial driver
+ */
+typedef int (*debugport_write_function)(int i, const char *buf, unsigned int len);
+
+extern debugport_write_function debug_write_function;
+
+static int rs_debug_write_function(int i, const char *buf, unsigned int len)
+{
+	int cnt;
+        struct tty_struct *tty;
+        static int recurse_cnt = 0;
+
+        tty = rs_table[i].tty;
+        if (tty)  {
+		unsigned long flags;
+		if (recurse_cnt > 5) /* We skip this debug output */
+			return 1;
+
+		local_irq_save(flags);
+		recurse_cnt++;
+                do {
+                        cnt = rs_write(tty, 0, buf, len);
+                        if (cnt >= 0) {
+                                buf += cnt;
+                                len -= cnt;
+                        } else
+                                len = cnt;
+                } while(len > 0);
+		recurse_cnt--;
+		local_irq_restore(flags);
+                return 1;
+        }
+        return 0;
+}
+
 /*
  * ------------------------------------------------------------
  * rs_close()
@@ -3483,6 +4359,12 @@
 	}
 	info->flags |= ASYNC_CLOSING;
 	/*
+	 * Save the termios structure, since this port may have
+	 * separate termios for callout and dialin.
+	 */
+	if (info->flags & ASYNC_NORMAL_ACTIVE)
+		info->normal_termios = *tty->termios;
+	/*
 	 * Now we wait for the transmit buffer to clear; and we notify 
 	 * the line discipline to only process XON/XOFF characters.
 	 */
@@ -3499,7 +4381,7 @@
 
 #ifndef CONFIG_SVINTO_SIM
 	e100_disable_rx(info);
-	e100_disable_rxdma_irq(info);
+	e100_disable_rx_irq(info);
 
 	if (info->flags & ASYNC_INITIALIZED) {
 		/*
@@ -3538,6 +4420,16 @@
 #if defined(CONFIG_ETRAX_RS485_ON_PA)
 		*R_PORT_PA_DATA = port_pa_data_shadow &= ~(1 << rs485_pa_bit);
 #endif
+#if defined(CONFIG_ETRAX_RS485_ON_PORT_G)
+		REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow,
+			       rs485_port_g_bit, 0);
+#endif
+#if defined(CONFIG_ETRAX_RS485_LTC1387)
+		REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow,
+			       CONFIG_ETRAX_RS485_LTC1387_DXEN_PORT_G_BIT, 0);
+		REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow,
+			       CONFIG_ETRAX_RS485_LTC1387_RXEN_PORT_G_BIT, 0);
+#endif
 	}
 #endif
 }
@@ -3637,8 +4529,9 @@
 		return 0;
 	}
 	
-	if (tty->termios->c_cflag & CLOCAL)
-		do_clocal = 1;
+	if (tty->termios->c_cflag & CLOCAL) {
+			do_clocal = 1;
+	}
 	
 	/*
 	 * Block waiting for the carrier detect and the line to become
@@ -3664,7 +4557,7 @@
 	while (1) {
 		save_flags(flags);
 		cli();
-                /* assert RTS and DTR */
+		/* assert RTS and DTR */
 		e100_rts(info, 1);
 		e100_dtr(info, 1);
 		restore_flags(flags);
@@ -3681,7 +4574,7 @@
 #endif
 			break;
 		}
-                if (!(info->flags & ASYNC_CLOSING) && do_clocal)
+		if (!(info->flags & ASYNC_CLOSING) && do_clocal)
 			/* && (do_clocal || DCD_IS_ASSERTED) */
 			break;
 		if (signal_pending(current)) {
@@ -3787,10 +4680,21 @@
 #endif
 		return retval;
 	}
-  
+
+	if ((info->count == 1) && (info->flags & ASYNC_SPLIT_TERMIOS)) {
+		*tty->termios = info->normal_termios;
+		change_speed(info);
+	}
+
 #ifdef SERIAL_DEBUG_OPEN
 	printk("rs_open ttyS%d successful...\n", info->line);
 #endif
+	DLOG_INT_TRIG( log_int_pos = 0);
+
+	DFLIP(	if (info->line == SERIAL_DEBUG_LINE) {
+			info->icount.rx = 0;
+		} );
+
 	return 0;
 }
 
@@ -3798,10 +4702,11 @@
  * /proc fs routines....
  */
 
-extern inline int line_info(char *buf, struct e100_serial *info)
+extern _INLINE_ int line_info(char *buf, struct e100_serial *info)
 {
 	char	stat_buf[30];
 	int	ret;
+	unsigned long tmp;
 
 	ret = sprintf(buf, "%d: uart:E100 port:%lX irq:%d",
 		      info->line, (unsigned long)info->port, info->irq);
@@ -3831,11 +4736,39 @@
 	ret += sprintf(buf+ret, " tx:%lu rx:%lu",
 		       (unsigned long)info->icount.tx,
 		       (unsigned long)info->icount.rx);
+	tmp = CIRC_CNT(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE);
+	if (tmp) {
+		ret += sprintf(buf+ret, " tx_pend:%lu/%lu",
+			       (unsigned long)tmp,
+			       (unsigned long)SERIAL_XMIT_SIZE);
+	}
 
 	ret += sprintf(buf+ret, " rx_pend:%lu/%lu",
 		       (unsigned long)info->recv_cnt,
 		       (unsigned long)info->max_recv_cnt);
 
+#if 1
+	if (info->tty) {
+
+		if (info->tty->stopped)
+			ret += sprintf(buf+ret, " stopped:%i",
+				       (int)info->tty->stopped);
+		if (info->tty->hw_stopped)
+			ret += sprintf(buf+ret, " hw_stopped:%i",
+				       (int)info->tty->hw_stopped);
+	}
+
+	{
+		unsigned char rstat = info->port[REG_STATUS];
+		if (rstat & IO_MASK(R_SERIAL0_STATUS, xoff_detect) )
+			ret += sprintf(buf+ret, " xoff_detect:1");
+	}
+
+#endif
+
+
+
+
 	if (info->icount.frame)
 		ret += sprintf(buf+ret, " fe:%lu",
 			       (unsigned long)info->icount.frame);
@@ -3879,6 +4812,22 @@
 			len = 0;
 		}
 	}
+#ifdef DEBUG_LOG_INCLUDED
+	for (i = 0; i < debug_log_pos; i++) {
+		len += sprintf(page + len, "%-4i %lu.%lu ", i, debug_log[i].time, timer_data_to_ns(debug_log[i].timer_data));
+		len += sprintf(page + len, debug_log[i].string, debug_log[i].value);
+		if (len+begin > off+count)
+			goto done;
+		if (len+begin < off) {
+			begin += len;
+			len = 0;
+		}
+	}
+	len += sprintf(page + len, "debug_log %i/%i  %li bytes\n",
+		       i, DEBUG_LOG_SIZE, begin+len);
+	debug_log_pos = 0;
+#endif
+
 	*eof = 1;
 done:
 	if (off >= len+begin)
@@ -3893,7 +4842,7 @@
 show_serial_version(void)
 {
 	printk(KERN_INFO
-	       "ETRAX 100LX serial-driver %s, (c) 2000-2003 Axis Communications AB\r\n",
+	       "ETRAX 100LX serial-driver %s, (c) 2000-2004 Axis Communications AB\r\n",
 	       &serial_version[11]); /* "$Revision: x.yy" */
 }
 
@@ -3952,20 +4901,25 @@
 	driver->init_termios.c_cflag =
 		B115200 | CS8 | CREAD | HUPCL | CLOCAL; /* is normally B9600 default... */
 	driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS;
+	driver->termios = serial_termios;
+	driver->termios_locked = serial_termios_locked;
+
 	tty_set_operations(driver, &rs_ops);
+        serial_driver = driver;
 	if (tty_register_driver(driver))
 		panic("Couldn't register serial driver\n");
-        serial_driver = driver;
-  
 	/* do some initializing for the separate ports */
   
 	for (i = 0, info = rs_table; i < NR_PORTS; i++,info++) {
-		info->uses_dma = 0;   
+		info->uses_dma_in = 0;
+		info->uses_dma_out = 0;
 		info->line = i;
 		info->tty = 0;
 		info->type = PORT_ETRAX;
 		info->tr_running = 0;
 		info->forced_eop = 0;
+		info->baud_base = DEF_BAUD_BASE;
+		info->custom_divisor = 0;
 		info->flags = 0;
 		info->close_delay = 5*HZ/10;
 		info->closing_wait = 30*HZ;
@@ -3973,6 +4927,7 @@
 		info->event = 0;
 		info->count = 0;
 		info->blocked_open = 0;
+		info->normal_termios = driver->init_termios;
 		init_waitqueue_head(&info->open_wait);
 		init_waitqueue_head(&info->close_wait);
 		info->xmit.buf = NULL;
@@ -4009,39 +4964,62 @@
 #ifndef CONFIG_SVINTO_SIM
 	/* Not needed in simulator.  May only complicate stuff. */
 	/* hook the irq's for DMA channel 6 and 7, serial output and input, and some more... */
+
+	if (request_irq(SERIAL_IRQ_NBR, ser_interrupt, SA_SHIRQ | SA_INTERRUPT, "serial ", NULL))
+		panic("irq8");
+
 #ifdef CONFIG_ETRAX_SERIAL_PORT0
+#ifdef CONFIG_ETRAX_SERIAL_PORT0_DMA6_OUT
 	if (request_irq(SER0_DMA_TX_IRQ_NBR, tr_interrupt, SA_INTERRUPT, "serial 0 dma tr", NULL))
 		panic("irq22");
+#endif
+#ifdef CONFIG_ETRAX_SERIAL_PORT0_DMA7_IN
 	if (request_irq(SER0_DMA_RX_IRQ_NBR, rec_interrupt, SA_INTERRUPT, "serial 0 dma rec", NULL))
 		panic("irq23");
 #endif
-#ifdef SERIAL_HANDLE_EARLY_ERRORS
-	if (request_irq(SERIAL_IRQ_NBR, ser_interrupt, SA_SHIRQ | SA_INTERRUPT, "serial ", NULL))
-		panic("irq8");
 #endif
+
 #ifdef CONFIG_ETRAX_SERIAL_PORT1
+#ifdef CONFIG_ETRAX_SERIAL_PORT1_DMA8_OUT
 	if (request_irq(SER1_DMA_TX_IRQ_NBR, tr_interrupt, SA_INTERRUPT, "serial 1 dma tr", NULL))
 		panic("irq24");
+#endif
+#ifdef CONFIG_ETRAX_SERIAL_PORT1_DMA9_IN
 	if (request_irq(SER1_DMA_RX_IRQ_NBR, rec_interrupt, SA_INTERRUPT, "serial 1 dma rec", NULL))
 		panic("irq25");
 #endif
+#endif
 #ifdef CONFIG_ETRAX_SERIAL_PORT2
 	/* DMA Shared with par0 (and SCSI0 and ATA) */
-	if (request_irq(SER2_DMA_TX_IRQ_NBR, tr_interrupt, SA_SHIRQ, "serial 2 dma tr", NULL))
+#ifdef CONFIG_ETRAX_SERIAL_PORT2_DMA2_OUT
+	if (request_irq(SER2_DMA_TX_IRQ_NBR, tr_interrupt, SA_SHIRQ | SA_INTERRUPT, "serial 2 dma tr", NULL))
 		panic("irq18");
-	if (request_irq(SER2_DMA_RX_IRQ_NBR, rec_interrupt, SA_SHIRQ, "serial 2 dma rec", NULL))
+#endif
+#ifdef CONFIG_ETRAX_SERIAL_PORT2_DMA3_IN
+	if (request_irq(SER2_DMA_RX_IRQ_NBR, rec_interrupt, SA_SHIRQ | SA_INTERRUPT, "serial 2 dma rec", NULL))
 		panic("irq19");
 #endif
+#endif
 #ifdef CONFIG_ETRAX_SERIAL_PORT3
 	/* DMA Shared with par1 (and SCSI1 and Extern DMA 0) */
-	if (request_irq(SER3_DMA_TX_IRQ_NBR, tr_interrupt, SA_SHIRQ, "serial 3 dma tr", NULL))
+#ifdef CONFIG_ETRAX_SERIAL_PORT3_DMA4_OUT
+	if (request_irq(SER3_DMA_TX_IRQ_NBR, tr_interrupt, SA_SHIRQ | SA_INTERRUPT, "serial 3 dma tr", NULL))
 		panic("irq20");
-	if (request_irq(SER3_DMA_RX_IRQ_NBR, rec_interrupt, SA_SHIRQ, "serial 3 dma rec", NULL))
+#endif
+#ifdef CONFIG_ETRAX_SERIAL_PORT3_DMA5_IN
+	if (request_irq(SER3_DMA_RX_IRQ_NBR, rec_interrupt, SA_SHIRQ | SA_INTERRUPT, "serial 3 dma rec", NULL))
 		panic("irq21");
 #endif
+#endif
 
+#ifdef CONFIG_ETRAX_SERIAL_FLUSH_DMA_FAST
+	if (request_irq(TIMER1_IRQ_NBR, timeout_interrupt, SA_SHIRQ | SA_INTERRUPT,
+		       "fast serial dma timeout", NULL)) {
+		printk(KERN_CRIT "err: timer1 irq\n");
+	}
+#endif
 #endif /* CONFIG_SVINTO_SIM */
-
+	debug_write_function = rs_debug_write_function;
 	return 0;
 }
 
diff -Nru a/arch/cris/arch-v10/drivers/serial.h b/arch/cris/arch-v10/drivers/serial.h
--- a/arch/cris/arch-v10/drivers/serial.h	2004-06-02 23:27:00 -07:00
+++ b/arch/cris/arch-v10/drivers/serial.h	2004-06-02 23:27:00 -07:00
@@ -44,15 +44,11 @@
 	volatile u32		*ofirstadr;   /* adr to R_DMA_CHx_FIRST */
 	volatile u8		*ocmdadr;     /* adr to R_DMA_CHx_CMD */
 	const volatile u8	*ostatusadr;  /* adr to R_DMA_CHx_STATUS */
-	volatile u32		*ohwswadr;    /* adr to R_DMA_CHx_HWSW */
-	volatile u32		*odescradr;   /* adr to R_DMA_CHx_DESCR */
 
 	/* Input registers */
 	volatile u8		*iclrintradr; /* adr to R_DMA_CHx_CLR_INTR */
 	volatile u32		*ifirstadr;   /* adr to R_DMA_CHx_FIRST */
 	volatile u8		*icmdadr;     /* adr to R_DMA_CHx_CMD */
-	const volatile u8	*istatusadr;  /* adr to R_DMA_CHx_STATUS */
-	volatile u32		*ihwswadr;    /* adr to R_DMA_CHx_HWSW */
 	volatile u32		*idescradr;   /* adr to R_DMA_CHx_DESCR */
 
 	int			flags;	/* defined in tty.h */
@@ -60,14 +56,17 @@
 	u8			rx_ctrl; /* shadow for R_SERIALx_REC_CTRL */
 	u8			tx_ctrl; /* shadow for R_SERIALx_TR_CTRL */
 	u8			iseteop; /* bit number for R_SET_EOP for the input dma */
-
 	int			enabled; /* Set to 1 if the port is enabled in HW config */
-  
-	/* end of fields defined in rs_table[] in .c-file */
 
-	int			uses_dma; /* Set to 1 if DMA should be used */
-	unsigned char           forced_eop; /* a fifo eop has been forced */
+	u8		dma_out_enabled:1; /* Set to 1 if DMA should be used */
+	u8		dma_in_enabled:1;  /* Set to 1 if DMA should be used */
 
+	/* end of fields defined in rs_table[] in .c-file */
+	u8		uses_dma_in;  /* Set to 1 if DMA is used */
+	u8		uses_dma_out; /* Set to 1 if DMA is used */
+	u8		forced_eop;   /* a fifo eop has been forced */
+	int			baud_base;     /* For special baudrates */
+	int			custom_divisor; /* For special baudrates */
 	struct etrax_dma_descr	tr_descr;
 	struct etrax_dma_descr	rec_descr[SERIAL_RECV_DESCRIPTORS];
 	int			cur_rec_descr;
@@ -95,6 +94,8 @@
 
 	struct work_struct	work;
 	struct async_icount	icount;   /* error-statistics etc.*/
+	struct termios		normal_termios;
+	struct termios		callout_termios;
 #ifdef DECLARE_WAITQUEUE
 	wait_queue_head_t	open_wait;
 	wait_queue_head_t	close_wait;
@@ -104,6 +105,7 @@
 #endif  
 
 	unsigned long		char_time_usec;       /* The time for 1 char, in usecs */
+	unsigned long		flush_time_usec;      /* How often we should flush */
 	unsigned long		last_tx_active_usec;  /* Last tx usec in the jiffies */
 	unsigned long		last_tx_active;       /* Last tx time in jiffies */
 	unsigned long		last_rx_active_usec;  /* Last rx usec in the jiffies */
diff -Nru a/arch/cris/arch-v10/kernel/debugport.c b/arch/cris/arch-v10/kernel/debugport.c
--- a/arch/cris/arch-v10/kernel/debugport.c	2004-06-02 23:26:58 -07:00
+++ b/arch/cris/arch-v10/kernel/debugport.c	2004-06-02 23:26:58 -07:00
@@ -12,6 +12,15 @@
  *    init_etrax_debug()
  *
  * $Log: debugport.c,v $
+ * Revision 1.14  2004/05/17 13:11:29  starvik
+ * Disable DMA until real serial driver is up
+ *
+ * Revision 1.13  2004/05/14 07:58:01  starvik
+ * Merge of changes from 2.4
+ *
+ * Revision 1.12  2003/09/11 07:29:49  starvik
+ * Merge of Linux 2.6.0-test5
+ *
  * Revision 1.11  2003/07/07 09:53:36  starvik
  * Revert all the 2.5.74 merge changes to make the console work again
  *
@@ -59,7 +68,7 @@
 #include <linux/init.h>
 #include <linux/major.h>
 #include <linux/delay.h>
-
+#include <linux/tty.h>
 #include <asm/system.h>
 #include <asm/arch/svinto.h>
 #include <asm/io.h>             /* Get SIMCOUT. */
@@ -124,22 +133,28 @@
 
 #define MIN_SIZE 32 /* Size that triggers the FIFO to flush characters to interface */
 
-/* Write a string of count length to the console (debug port) using DMA, polled
- * for completion. Interrupts are disabled during the whole process. Some
- * caution needs to be taken to not interfere with ttyS business on this port.
- */
+static struct tty_driver *serial_driver;
+
+typedef int (*debugport_write_function)(int i, const char *buf, unsigned int len);
+
+debugport_write_function debug_write_function = NULL;
+
+static void
+console_write_direct(struct console *co, const char *buf, unsigned int len)
+{
+	int i;
+	/* Send data */
+	for (i = 0; i < len; i++) {
+		/* Wait until transmitter is ready and send.*/
+		while(!(*DEBUG_READ & IO_MASK(R_SERIAL0_READ, tr_ready)));
+                *DEBUG_WRITE = buf[i];
+	}
+}
 
 static void 
 console_write(struct console *co, const char *buf, unsigned int len)
 {
-
-	static struct etrax_dma_descr descr;
-	static struct etrax_dma_descr descr2;
-	static char tmp_buf[MIN_SIZE];
-	static int tmp_size = 0;
-
-	unsigned long flags; 
-	
+	unsigned long flags;
 #ifdef CONFIG_ETRAX_DEBUG_PORT_NULL
         /* no debug printout at all */
         return;
@@ -150,86 +165,18 @@
 	SIMCOUT(buf,len);
 	return;
 #endif
-	
-	local_save_flags(flags);
-	local_irq_disable();
 
 #ifdef CONFIG_ETRAX_KGDB
 	/* kgdb needs to output debug info using the gdb protocol */
 	putDebugString(buf, len);
-	local_irq_restore(flags);
 	return;
 #endif
 
-	/* To make this work together with the real serial port driver
-	 * we have to make sure that everything is flushed when we leave
-	 * here. The following steps are made to assure this:
-	 * 1. Wait until DMA stops, FIFO is empty and serial port pipeline empty.
-	 * 2. Write at least half the FIFO to trigger flush to serial port.
-	 * 3. Wait until DMA stops, FIFO is empty and serial port pipeline empty.
-         */
-
-	/* Do we have enough characters to make the DMA/FIFO happy? */
-	if (tmp_size + len < MIN_SIZE)
-	{
-		int size = min((int)(MIN_SIZE - tmp_size),(int)len);
-		memcpy(&tmp_buf[tmp_size], buf, size);
-		tmp_size += size;
-		len -= size;
-        
-		/* Pad with space if complete line */
-		if (tmp_buf[tmp_size-1] == '\n')
-		{
-			memset(&tmp_buf[tmp_size-1], ' ', MIN_SIZE - tmp_size);
-			tmp_buf[MIN_SIZE - 1] = '\n';
-			tmp_size = MIN_SIZE;
-			len = 0;
-		}
-		else
-		{
-                  /* Wait for more characters */
-			local_irq_restore(flags);
+	local_irq_save(flags);
+	if (debug_write_function)
+		if (debug_write_function(co->index, buf, len))
 			return;
-		}
-	}
-
-	/* make sure the transmitter is enabled. 
-	 * NOTE: this overrides any setting done in ttySx, to 8N1, no auto-CTS.
-	 * in the future, move the tr/rec_ctrl shadows from etrax100ser.c to
-	 * shadows.c and use it here as well...
-	 */
-
-	*DEBUG_TR_CTRL = 0x40;
-	while(*DEBUG_OCMD & 7); /* Until DMA is not running */
-	while(*DEBUG_STATUS & 0x7f); /* wait until output FIFO is empty as well */
-	udelay(200); /* Wait for last two characters to leave the serial transmitter */
-
-	if (tmp_size)
-	{
-		descr.ctrl = len ?  0 : d_eop | d_wait | d_eol;
-		descr.sw_len = tmp_size;
-		descr.buf = virt_to_phys(tmp_buf);
-		descr.next = virt_to_phys(&descr2);
-		descr2.ctrl = d_eop | d_wait | d_eol;
-		descr2.sw_len = len;
-		descr2.buf = virt_to_phys((char*)buf);
-	}
-	else
-	{
-		descr.ctrl = d_eop | d_wait | d_eol;
-		descr.sw_len = len;
-		descr.buf = virt_to_phys((char*)buf);
-	}
-
-	*DEBUG_FIRST = virt_to_phys(&descr); /* write to R_DMAx_FIRST */
-	*DEBUG_OCMD = 1;       /* dma command start -> R_DMAx_CMD */
-
-	/* wait until the output dma channel is ready again */
-	while(*DEBUG_OCMD & 7);
-	while(*DEBUG_STATUS & 0x7f);
-	udelay(200);
-
-	tmp_size = 0;
+	console_write_direct(co, buf, len);
 	local_irq_restore(flags);
 }
 
@@ -279,10 +226,11 @@
 	*DEBUG_REC_CTRL = IO_STATE(R_SERIAL0_REC_CTRL, rec_enable, enable);
 }
 
-static kdev_t 
-console_device(struct console *c)
+static struct tty_driver*
+console_device(struct console *c, int *index)
 {
-         return mk_kdev(TTY_MAJOR, 64 + c->index);
+	*index = c->index;
+	return serial_driver;
 }
 
 static int __init 
@@ -311,5 +259,33 @@
 void __init 
 init_etrax_debug(void)
 {
+#if CONFIG_ETRAX_DEBUG_PORT_NULL
+	return;
+#endif
+
+#if DEBUG_PORT_IDX == 0
+	genconfig_shadow &=  ~IO_MASK(R_GEN_CONFIG, dma6);
+	genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma6, unused);
+#elif DEBUG_PORT_IDX == 1
+	genconfig_shadow &=  ~IO_MASK(R_GEN_CONFIG, dma8);
+	genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma8, usb);
+#elif DEBUG_PORT_IDX == 2
+	genconfig_shadow &=  ~IO_MASK(R_GEN_CONFIG, dma2);
+	genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma2, par0);
+#elif DEBUG_PORT_IDX == 3
+	genconfig_shadow &=  ~IO_MASK(R_GEN_CONFIG, dma4);
+	genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma4, par1);
+#endif
+	*R_GEN_CONFIG = genconfig_shadow;
+
 	register_console(&sercons);
+}
+
+int __init
+init_console(void)
+{
+	serial_driver = alloc_tty_driver(1);
+	if (!serial_driver)
+		return -ENOMEM;
+	return 0;
 }
diff -Nru a/arch/cris/arch-v10/kernel/entry.S b/arch/cris/arch-v10/kernel/entry.S
--- a/arch/cris/arch-v10/kernel/entry.S	2004-06-02 23:26:59 -07:00
+++ b/arch/cris/arch-v10/kernel/entry.S	2004-06-02 23:26:59 -07:00
@@ -1,4 +1,4 @@
-/* $Id: entry.S,v 1.16 2003/07/04 08:27:41 starvik Exp $
+/* $Id: entry.S,v 1.18 2004/05/11 12:28:25 starvik Exp $
  *
  *  linux/arch/cris/entry.S
  *
@@ -7,6 +7,12 @@
  *  Authors:	Bjorn Wesen (bjornw@axis.com)
  *
  *  $Log: entry.S,v $
+ *  Revision 1.18  2004/05/11 12:28:25  starvik
+ *  Merge of Linux 2.6.6
+ *
+ *  Revision 1.17  2003/09/11 07:29:49  starvik
+ *  Merge of Linux 2.6.0-test5
+ *
  *  Revision 1.16  2003/07/04 08:27:41  starvik
  *  Merge of Linux 2.5.74
  *
@@ -1060,6 +1066,19 @@
  	.long sys_clock_nanosleep
 	.long sys_statfs64
 	.long sys_fstatfs64	
+	.long sys_tgkill	/* 270 */
+	.long sys_utimes
+ 	.long sys_fadvise64_64
+	.long sys_ni_syscall	/* sys_vserver */
+	.long sys_ni_syscall	/* sys_mbind */
+	.long sys_ni_syscall	/* 275 sys_get_mempolicy */
+	.long sys_ni_syscall	/* sys_set_mempolicy */
+	.long sys_mq_open
+	.long sys_mq_unlink
+	.long sys_mq_timedsend
+	.long sys_mq_timedreceive	/* 280 */
+	.long sys_mq_notify
+	.long sys_mq_getsetattr
 		
         /*
          * NOTE!! This doesn't have to be exact - we just have
diff -Nru a/arch/cris/arch-v10/kernel/fasttimer.c b/arch/cris/arch-v10/kernel/fasttimer.c
--- a/arch/cris/arch-v10/kernel/fasttimer.c	2004-06-02 23:26:58 -07:00
+++ b/arch/cris/arch-v10/kernel/fasttimer.c	2004-06-02 23:26:58 -07:00
@@ -1,10 +1,16 @@
-/* $Id: fasttimer.c,v 1.4 2003/07/04 08:27:41 starvik Exp $
+/* $Id: fasttimer.c,v 1.6 2004/05/14 10:18:39 starvik Exp $
  * linux/arch/cris/kernel/fasttimer.c
  *
  * Fast timers for ETRAX100/ETRAX100LX
  * This may be useful in other OS than Linux so use 2 space indentation...
  *
  * $Log: fasttimer.c,v $
+ * Revision 1.6  2004/05/14 10:18:39  starvik
+ * Export fast_timer_list
+ *
+ * Revision 1.5  2004/05/14 07:58:01  starvik
+ * Merge of changes from 2.4
+ *
  * Revision 1.4  2003/07/04 08:27:41  starvik
  * Merge of Linux 2.5.74
  *
@@ -130,7 +136,7 @@
 static int fast_timer_is_init = 0;
 static int fast_timer_ints = 0;
 
-static struct fast_timer *fast_timer_list = NULL;
+struct fast_timer *fast_timer_list = NULL;
 
 #ifdef DEBUG_LOG_INCLUDED
 #define DEBUG_LOG_MAX 128
@@ -325,7 +331,8 @@
     {
       if (tmp == t)
       {
-        printk("timer name: %s data: 0x%08lX already in list!\n", name, data);
+        printk(KERN_WARNING
+               "timer name: %s data: 0x%08lX already in list!\n", name, data);
         sanity_failed++;
         return;
       }
@@ -784,7 +791,7 @@
       cli();
       if (t->next != nextt)
       {
-        printk("timer removed!\n");
+        printk(KERN_WARNING "timer removed!\n");
       }
       t = nextt;
     }
@@ -965,7 +972,7 @@
     int i;
 #endif
 
-    printk("fast_timer_init()\n");
+    printk(KERN_INFO "fast_timer_init()\n");
 
 #if 0 && defined(FAST_TIMER_TEST)
     for (i = 0; i <= TIMER0_DIV; i++)
diff -Nru a/arch/cris/arch-v10/kernel/head.S b/arch/cris/arch-v10/kernel/head.S
--- a/arch/cris/arch-v10/kernel/head.S	2004-06-02 23:27:00 -07:00
+++ b/arch/cris/arch-v10/kernel/head.S	2004-06-02 23:27:00 -07:00
@@ -1,4 +1,4 @@
-/* $Id: head.S,v 1.6 2003/04/28 05:31:46 starvik Exp $
+/* $Id: head.S,v 1.7 2004/05/14 07:58:01 starvik Exp $
  * 
  * Head of the kernel - alter with care
  *
@@ -7,6 +7,9 @@
  * Authors:	Bjorn Wesen (bjornw@axis.com)
  * 
  * $Log: head.S,v $
+ * Revision 1.7  2004/05/14 07:58:01  starvik
+ * Merge of changes from 2.4
+ *
  * Revision 1.6  2003/04/28 05:31:46  starvik
  * Added section attributes
  *
@@ -331,7 +334,16 @@
 	move.d START_ETHERNET_CLOCK, $r0
 	move.d $r0, [R_NETWORK_GEN_CONFIG]
 #endif
-		
+
+	;; Set up waitstates etc according to kernel configuration.
+#ifndef CONFIG_SVINTO_SIM
+	move.d   CONFIG_ETRAX_DEF_R_WAITSTATES, $r0
+	move.d   $r0, [R_WAITSTATES]
+
+	move.d   CONFIG_ETRAX_DEF_R_BUS_CONFIG, $r0
+	move.d   $r0, [R_BUS_CONFIG]
+#endif
+
 	;; We need to initialze DRAM registers before we start using the DRAM
 
 	cmp.d	RAM_INIT_MAGIC, $r8	; Already initialized?
@@ -626,8 +638,19 @@
 		| IO_STATE (R_GEN_CONFIG, dma4, extdma0),$r0
 #endif
 
-#if defined(CONFIG_BLUETOOTH) && (defined(CONFIG_BLUETOOTH_RESET_G10) || defined(CONFIG_BLUETOOTH_RESET_G11))
-	or.d	  IO_STATE (R_GEN_CONFIG, g8_15dir, out),$r0
+#if defined(CONFIG_ETRAX_DEF_R_PORT_G0_DIR_OUT)
+        or.d      IO_STATE (R_GEN_CONFIG, g0dir, out),$r0
+#endif
+
+#if defined(CONFIG_ETRAX_DEF_R_PORT_G8_15_DIR_OUT)
+        or.d      IO_STATE (R_GEN_CONFIG, g8_15dir, out),$r0
+#endif
+#if defined(CONFIG_ETRAX_DEF_R_PORT_G16_23_DIR_OUT)
+       or.d      IO_STATE (R_GEN_CONFIG, g16_23dir, out),$r0
+#endif
+
+#if defined(CONFIG_ETRAX_DEF_R_PORT_G24_DIR_OUT)
+       or.d      IO_STATE (R_GEN_CONFIG, g24dir, out),$r0
 #endif
 
 	move.d	$r0,[genconfig_shadow] ; init a shadow register of R_GEN_CONFIG
diff -Nru a/arch/cris/arch-v10/kernel/process.c b/arch/cris/arch-v10/kernel/process.c
--- a/arch/cris/arch-v10/kernel/process.c	2004-06-02 23:26:59 -07:00
+++ b/arch/cris/arch-v10/kernel/process.c	2004-06-02 23:26:59 -07:00
@@ -1,4 +1,4 @@
-/* $Id: process.c,v 1.3 2003/07/04 08:27:41 starvik Exp $
+/* $Id: process.c,v 1.6 2004/05/11 12:28:25 starvik Exp $
  * 
  *  linux/arch/cris/kernel/process.c
  *
@@ -16,6 +16,7 @@
 #include <linux/err.h>
 #include <linux/fs.h>
 #include <linux/slab.h>
+#include <asm/arch/svinto.h>
 #include <linux/init.h>
 
 #ifdef CONFIG_ETRAX_GPIO
@@ -249,3 +250,19 @@
 }
 #undef last_sched
 #undef first_sched
+
+void show_regs(struct pt_regs * regs)
+{
+	unsigned long usp = rdusp();
+	printk("IRP: %08lx SRP: %08lx DCCR: %08lx USP: %08lx MOF: %08lx\n",
+	       regs->irp, regs->srp, regs->dccr, usp, regs->mof );
+	printk(" r0: %08lx  r1: %08lx   r2: %08lx  r3: %08lx\n",
+	       regs->r0, regs->r1, regs->r2, regs->r3);
+	printk(" r4: %08lx  r5: %08lx   r6: %08lx  r7: %08lx\n",
+	       regs->r4, regs->r5, regs->r6, regs->r7);
+	printk(" r8: %08lx  r9: %08lx  r10: %08lx r11: %08lx\n",
+	       regs->r8, regs->r9, regs->r10, regs->r11);
+	printk("r12: %08lx r13: %08lx oR10: %08lx\n",
+	       regs->r12, regs->r13, regs->orig_r10);
+}
+
diff -Nru a/arch/cris/arch-v10/kernel/ptrace.c b/arch/cris/arch-v10/kernel/ptrace.c
--- a/arch/cris/arch-v10/kernel/ptrace.c	2004-06-02 23:27:00 -07:00
+++ b/arch/cris/arch-v10/kernel/ptrace.c	2004-06-02 23:27:00 -07:00
@@ -118,19 +118,13 @@
 		/* Read the word at location address in the USER area. */
 		case PTRACE_PEEKUSR: {
 			unsigned long tmp;
-			
+
 			ret = -EIO;
-			if ((addr & 3) || addr < 0 || addr >= sizeof(struct user))
+			if ((addr & 3) || addr < 0 || addr > PT_MAX << 2)
 				break;
-			
-			tmp = 0;  /* Default return condition */
-			ret = -EIO;
-			
-			if (addr < sizeof(struct pt_regs)) {
-				tmp = get_reg(child, addr >> 2);
-				ret = put_user(tmp, (unsigned long *)data);
-			}
-			
+
+			tmp = get_reg(child, addr >> 2);
+			ret = put_user(tmp, (unsigned long *)data);
 			break;
 		}
 		
@@ -148,28 +142,21 @@
  		/* Write the word at location address in the USER area. */
 		case PTRACE_POKEUSR:
 			ret = -EIO;
-			
-			if ((addr & 3) || addr < 0 || addr >= sizeof(struct user))
+			if ((addr & 3) || addr < 0 || addr > PT_MAX << 2)
 				break;
 
-			if (addr < sizeof(struct pt_regs)) {
-				addr >>= 2;
+			addr >>= 2;
 
-				if (addr == PT_DCCR) {
-					/*
-					 * Don't allow the tracing process to
-					 * change stuff like interrupt enable,
-					 * kernel/user bit, etc.
-					 */
-					data &= DCCR_MASK;
-					data |= get_reg(child, PT_DCCR) & ~DCCR_MASK;
-				}
-				
-				if (put_reg(child, addr, data))
-					break;
-				
-				ret = 0;
+			if (addr == PT_DCCR) {
+				/* don't allow the tracing process to change stuff like
+				 * interrupt enable, kernel/user bit, dma enables etc.
+				 */
+				data &= DCCR_MASK;
+				data |= get_reg(child, PT_DCCR) & ~DCCR_MASK;
 			}
+			if (put_reg(child, addr, data))
+				break;
+			ret = 0;
 			break;
 
 		case PTRACE_SYSCALL:
@@ -237,7 +224,7 @@
 				
 				if (put_user(tmp, (unsigned long *) data)) {
 					ret = -EFAULT;
-					break;
+					goto out_tsk;
 				}
 				
 				data += sizeof(long);
@@ -255,7 +242,7 @@
 			for (i = 0; i <= PT_MAX; i++) {
 				if (get_user(tmp, (unsigned long *) data)) {
 					ret = -EFAULT;
-					break;
+					goto out_tsk;
 				}
 				
 				if (i == PT_DCCR) {
@@ -290,12 +277,10 @@
 	if (!(current->ptrace & PT_PTRACED))
 		return;
 	
-	current->exit_code = SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD)
-					? 0x80 : 0);
-	
-	current->state = TASK_STOPPED;
-	notify_parent(current, SIGCHLD);
-	schedule();
+	/* the 0x80 provides a way for the tracing parent to distinguish
+	   between a syscall stop and SIGTRAP delivery */
+	ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD)
+				 ? 0x80 : 0));
 	
 	/*
 	 * This isn't the same as continuing with a signal, but it will do for
diff -Nru a/arch/cris/arch-v10/kernel/setup.c b/arch/cris/arch-v10/kernel/setup.c
--- a/arch/cris/arch-v10/kernel/setup.c	2004-06-02 23:27:00 -07:00
+++ b/arch/cris/arch-v10/kernel/setup.c	2004-06-02 23:27:00 -07:00
@@ -1,4 +1,4 @@
-/* $Id: setup.c,v 1.1 2002/12/11 15:42:02 starvik Exp $
+/*
  *
  *  linux/arch/cris/arch-v10/kernel/setup.c
  *
@@ -94,3 +94,10 @@
 }
 
 #endif /* CONFIG_PROC_FS */
+
+void
+show_etrax_copyright(void)
+{
+	printk(KERN_INFO
+               "Linux/CRIS port on ETRAX 100LX (c) 2001 Axis Communications AB\n");
+}
diff -Nru a/arch/cris/arch-v10/kernel/signal.c b/arch/cris/arch-v10/kernel/signal.c
--- a/arch/cris/arch-v10/kernel/signal.c	2004-06-02 23:26:58 -07:00
+++ b/arch/cris/arch-v10/kernel/signal.c	2004-06-02 23:26:58 -07:00
@@ -180,6 +180,9 @@
 	unsigned int err = 0;
 	unsigned long old_usp;
 
+        /* Always make any pending restarted system calls return -EINTR */
+	current_thread_info()->restart_block.fn = do_no_restart_syscall;
+
 	/* restore the regs from &sc->regs (same as sc, since regs is first)
 	 * (sc is already checked for VERIFY_READ since the sigframe was
 	 *  checked in sys_sigreturn previously)
@@ -492,7 +495,6 @@
 		/* If so, check system call restarting.. */
 		switch (regs->r10) {
 			case -ERESTART_RESTARTBLOCK:
-				current_thread_info()->restart_block.fn = do_no_restart_syscall;
 			case -ERESTARTNOHAND:
 				/* ERESTARTNOHAND means that the syscall should only be
 				   restarted if there was no handler for the signal, and since
diff -Nru a/arch/cris/arch-v10/kernel/time.c b/arch/cris/arch-v10/kernel/time.c
--- a/arch/cris/arch-v10/kernel/time.c	2004-06-02 23:27:00 -07:00
+++ b/arch/cris/arch-v10/kernel/time.c	2004-06-02 23:27:00 -07:00
@@ -1,4 +1,4 @@
-/* $Id: time.c,v 1.2 2003/07/04 08:27:41 starvik Exp $
+/* $Id: time.c,v 1.3 2004/06/01 05:38:42 starvik Exp $
  *
  *  linux/arch/cris/arch-v10/kernel/time.c
  *
@@ -276,6 +276,12 @@
 		have_rtc = 1;
 		update_xtime_from_cmos();
 	}
+
+	/*
+	 * Initialize wall_to_monotonic such that adding it to xtime will yield zero, the
+	 * tv_nsec field must be normalized (i.e., 0 <= nsec < NSEC_PER_SEC).
+	 */
+	set_normalized_timespec(&wall_to_monotonic, -xtime.tv_sec, -xtime.tv_nsec);
 
 	/* Setup the etrax timers
 	 * Base frequency is 25000 hz, divider 250 -> 100 HZ
diff -Nru a/arch/cris/arch-v10/lib/dram_init.S b/arch/cris/arch-v10/lib/dram_init.S
--- a/arch/cris/arch-v10/lib/dram_init.S	2004-06-02 23:27:00 -07:00
+++ b/arch/cris/arch-v10/lib/dram_init.S	2004-06-02 23:27:00 -07:00
@@ -1,4 +1,4 @@
-/* $Id: dram_init.S,v 1.3 2003/03/31 09:38:37 starvik Exp $
+/* $Id: dram_init.S,v 1.4 2003/09/22 09:21:59 starvik Exp $
  * 
  * DRAM/SDRAM initialization - alter with care
  * This file is intended to be included from other assembler files
@@ -11,6 +11,10 @@
  * Authors:  Mikael Starvik (starvik@axis.com)	
  * 
  * $Log: dram_init.S,v $
+ * Revision 1.4  2003/09/22 09:21:59  starvik
+ * Decompresser is linked to 0x407xxxxx and sdram commands are at 0x000xxxxx
+ * so we need to mask off 12 bits.
+ *
  * Revision 1.3  2003/03/31 09:38:37  starvik
  * Corrected calculation of end of sdram init commands
  *
@@ -152,9 +156,9 @@
 	
 	; Issue initialization command sequence
 	move.d   _sdram_commands_start, $r2
-	and.d    0x00ffffff, $r2 ; Make sure commands are read from flash
+	and.d    0x000fffff, $r2 ; Make sure commands are read from flash
 	move.d   _sdram_commands_end,  $r3
-	and.d    0x00ffffff, $r3
+	and.d    0x000fffff, $r3
 1:	clear.d  $r4
 	move.b   [$r2+], $r4
 	lslq     9, $r4	; Command starts at bit 9
diff -Nru a/arch/cris/arch-v10/lib/old_checksum.c b/arch/cris/arch-v10/lib/old_checksum.c
--- a/arch/cris/arch-v10/lib/old_checksum.c	2004-06-02 23:27:00 -07:00
+++ b/arch/cris/arch-v10/lib/old_checksum.c	2004-06-02 23:27:00 -07:00
@@ -1,4 +1,4 @@
-/* $Id: old_checksum.c,v 1.2 2002/11/05 06:45:12 starvik Exp $
+/* $Id: old_checksum.c,v 1.3 2003/10/27 08:04:32 starvik Exp $
  *
  * INET		An implementation of the TCP/IP protocol suite for the LINUX
  *		operating system.  INET is implemented using the  BSD Socket
@@ -76,7 +76,7 @@
     sum += *((unsigned short *)buff)++;
   }
   if(endMarker - buff > 0) {
-    sum += *buff;                 /* add extra byte separately */
+    sum += *buff;                 /* add extra byte seperately */
   }
   BITOFF;
   return(sum);
diff -Nru a/arch/cris/arch-v10/mm/fault.c b/arch/cris/arch-v10/mm/fault.c
--- a/arch/cris/arch-v10/mm/fault.c	2004-06-02 23:27:00 -07:00
+++ b/arch/cris/arch-v10/mm/fault.c	2004-06-02 23:27:00 -07:00
@@ -30,7 +30,7 @@
 	*search_exception_tables(unsigned long addr);
 
 asmlinkage void do_page_fault(unsigned long address, struct pt_regs *regs,
-                              int error_code);
+                              int protection, int writeaccess);
 
 /* fast TLB-fill fault handler
  * this is called from entry.S with interrupts disabled
@@ -39,8 +39,9 @@
 void
 handle_mmu_bus_fault(struct pt_regs *regs)
 {
-	int cause, select;
+	int cause;
 #ifdef DEBUG
+	int select;
 	int index;
 	int page_id;
 	int acc, inv;
@@ -48,15 +49,14 @@
 	int miss, we, writeac;
 	pmd_t *pmd;
 	pte_t pte;
-	int errcode;
 	unsigned long address;
 
 	cause = *R_MMU_CAUSE;
-	select = *R_TLB_SELECT;
 
 	address = cause & PAGE_MASK; /* get faulting address */
 
 #ifdef DEBUG
+	select = *R_TLB_SELECT;
 	page_id = IO_EXTRACT(R_MMU_CAUSE,  page_id,   cause);
 	acc     = IO_EXTRACT(R_MMU_CAUSE,  acc_excp,  cause);
 	inv     = IO_EXTRACT(R_MMU_CAUSE,  inv_excp,  cause);  
@@ -82,12 +82,6 @@
 	if(writeac)
 		regs->csrinstr &= ~(1 << 5);
 	
-	/* Set errcode's R/W flag according to the mode which caused the
-	 * fault
-	 */
-
-	errcode = writeac << 1;
-
 	D(printk("bus_fault from IRP 0x%lx: addr 0x%lx, miss %d, inv %d, we %d, acc %d, dx %d pid %d\n",
 		 regs->irp, address, miss, inv, we, acc, index, page_id));
 
@@ -99,16 +93,20 @@
 		 */
 
 		pmd = (pmd_t *)(current_pgd + pgd_index(address));
-		if (pmd_none(*pmd))
-			goto dofault;
+		if (pmd_none(*pmd)) {
+			do_page_fault(address, regs, 0, writeac);
+			return;
+		}
 		if (pmd_bad(*pmd)) {
 			printk("bad pgdir entry 0x%lx at 0x%p\n", *(unsigned long*)pmd, pmd);
 			pmd_clear(pmd);
 			return;
 		}
 		pte = *pte_offset_kernel(pmd, address);
-		if (!pte_present(pte))
-			goto dofault;
+		if (!pte_present(pte)) {
+			do_page_fault(address, regs, 0, writeac);
+			return;
+		}
 
 #ifdef DEBUG
 		printk(" found pte %lx pg %p ", pte_val(pte), pte_page(pte));
@@ -143,14 +141,10 @@
 		*R_TLB_LO = pte_val(pte);
 
 		return;
-	} 
-
-	errcode = 1 | (we << 1);
+	}
 
- dofault:
-	/* leave it to the MM system fault handler below */
-	D(printk("do_page_fault %lx errcode %d\n", address, errcode));
-	do_page_fault(address, regs, errcode);
+	/* leave it to the MM system fault handler */
+	do_page_fault(address, regs, 1, we);
 }
 
 /* Called from arch/cris/mm/fault.c to find fixup code. */
diff -Nru a/arch/cris/arch-v10/mm/tlb.c b/arch/cris/arch-v10/mm/tlb.c
--- a/arch/cris/arch-v10/mm/tlb.c	2004-06-02 23:27:00 -07:00
+++ b/arch/cris/arch-v10/mm/tlb.c	2004-06-02 23:27:00 -07:00
@@ -212,7 +212,7 @@
 
 void 
 switch_mm(struct mm_struct *prev, struct mm_struct *next,
-	  struct task_struct *tsk, int cpu)
+	  struct task_struct *tsk)
 {
 	/* make sure we have a context */
 
diff -Nru a/arch/cris/defconfig b/arch/cris/defconfig
--- a/arch/cris/defconfig	2004-06-02 23:26:59 -07:00
+++ b/arch/cris/defconfig	2004-06-02 23:26:59 -07:00
@@ -1,25 +1,55 @@
 #
 # Automatically generated make config: don't edit
 #
+CONFIG_MMU=y
 CONFIG_UID16=y
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
-# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
 
 #
 # Code maturity level options
 #
 CONFIG_EXPERIMENTAL=y
+CONFIG_CLEAN_COMPILE=y
+CONFIG_STANDALONE=y
+CONFIG_BROKEN_ON_SMP=y
 
 #
 # General setup
 #
-CONFIG_NET=y
-CONFIG_SYSVIPC=y
+CONFIG_SWAP=y
+# CONFIG_SYSVIPC is not set
+# CONFIG_POSIX_MQUEUE is not set
 # CONFIG_BSD_PROCESS_ACCT is not set
-# CONFIG_SYSCTL is not set
+CONFIG_SYSCTL=y
+# CONFIG_AUDIT is not set
+CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_HOTPLUG is not set
+# CONFIG_IKCONFIG is not set
+CONFIG_EMBEDDED=y
+# CONFIG_KALLSYMS is not set
+CONFIG_FUTEX=y
+CONFIG_EPOLL=y
+CONFIG_IOSCHED_NOOP=y
+CONFIG_IOSCHED_AS=y
+CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
+# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+
+#
+# Loadable module support
+#
+# CONFIG_MODULES is not set
+
+#
+# General setup
+#
 CONFIG_BINFMT_ELF=y
-# CONFIG_ETRAX_KGDB is not set
-# CONFIG_ETRAX_WATCHDOG is not set
+# CONFIG_BINFMT_MISC is not set
+CONFIG_ETRAX_CMDLINE="root=/dev/mtdblock3 init=/linuxrc"
+CONFIG_ETRAX_WATCHDOG=y
+CONFIG_ETRAX_WATCHDOG_NICE_DOGGY=y
+CONFIG_ETRAX_FAST_TIMER=y
+# CONFIG_PREEMPT is not set
 
 #
 # Hardware setup
@@ -27,74 +57,170 @@
 CONFIG_ETRAX100LX=y
 # CONFIG_ETRAX100LX_V2 is not set
 # CONFIG_SVINTO_SIM is not set
-CONFIG_ETRAX_DRAM_SIZE=8
+CONFIG_ETRAX_ARCH_V10=y
+CONFIG_ETRAX_DRAM_SIZE=16
 CONFIG_ETRAX_FLASH_BUSWIDTH=2
-CONFIG_ETRAX_ROOT_DEVICE="/dev/mtdblock3"
+CONFIG_CRIS_LOW_MAP=y
+CONFIG_ETRAX_DRAM_VIRTUAL_BASE=60000000
+CONFIG_ETRAX_PA_LEDS=y
+# CONFIG_ETRAX_PB_LEDS is not set
+# CONFIG_ETRAX_CSP0_LEDS is not set
+# CONFIG_ETRAX_NO_LEDS is not set
+CONFIG_ETRAX_LED1G=2
+CONFIG_ETRAX_LED1R=2
+CONFIG_ETRAX_LED2G=3
+CONFIG_ETRAX_LED2R=3
+CONFIG_ETRAX_LED3G=2
+CONFIG_ETRAX_LED3R=2
+CONFIG_ETRAX_DEBUG_PORT0=y
+# CONFIG_ETRAX_DEBUG_PORT1 is not set
+# CONFIG_ETRAX_DEBUG_PORT2 is not set
+# CONFIG_ETRAX_DEBUG_PORT3 is not set
+# CONFIG_ETRAX_DEBUG_PORT_NULL is not set
+CONFIG_ETRAX_RESCUE_SER0=y
+# CONFIG_ETRAX_RESCUE_SER1 is not set
+# CONFIG_ETRAX_RESCUE_SER2 is not set
+# CONFIG_ETRAX_RESCUE_SER3 is not set
+CONFIG_ETRAX_DEF_R_WAITSTATES=0x95f8
+CONFIG_ETRAX_DEF_R_BUS_CONFIG=0x104
+CONFIG_ETRAX_SDRAM=y
+CONFIG_ETRAX_DEF_R_SDRAM_CONFIG=0x00e03636
+CONFIG_ETRAX_DEF_R_SDRAM_TIMING=0x80008002
+CONFIG_ETRAX_DEF_R_PORT_PA_DIR=0x1d
+CONFIG_ETRAX_DEF_R_PORT_PA_DATA=0xf0
+CONFIG_ETRAX_DEF_R_PORT_PB_CONFIG=0x00
+CONFIG_ETRAX_DEF_R_PORT_PB_DIR=0x1e
+CONFIG_ETRAX_DEF_R_PORT_PB_DATA=0xf3
+# CONFIG_ETRAX_SOFT_SHUTDOWN is not set
 
 #
-# Drivers for ETRAX 100LX built-in interfaces
+# Drivers for built-in interfaces
+#
+CONFIG_ETRAX_ETHERNET=y
+CONFIG_NET_ETHERNET=y
+# CONFIG_ETRAX_NETWORK_LED_ON_WHEN_LINK is not set
+CONFIG_ETRAX_NETWORK_LED_ON_WHEN_ACTIVITY=y
+CONFIG_ETRAX_SERIAL=y
+CONFIG_ETRAX_SERIAL_FAST_TIMER=y
+CONFIG_ETRAX_SERIAL_PORT0=y
+# CONFIG_CONFIG_ETRAX_SERIAL_PORT0_NO_DMA_OUT is not set
+CONFIG_CONFIG_ETRAX_SERIAL_PORT0_DMA6_OUT=y
+# CONFIG_CONFIG_ETRAX_SERIAL_PORT0_NO_DMA_IN is not set
+CONFIG_CONFIG_ETRAX_SERIAL_PORT0_DMA7_IN=y
+CONFIG_ETRAX_SER0_DTR_RI_DSR_CD_ON_NONE=y
+# CONFIG_ETRAX_SER0_DTR_RI_DSR_CD_ON_PA is not set
+# CONFIG_ETRAX_SER0_DTR_RI_DSR_CD_ON_PB is not set
+# CONFIG_ETRAX_SER0_DTR_RI_DSR_CD_MIXED is not set
+CONFIG_ETRAX_SER0_DTR_ON_PA_BIT=-1
+CONFIG_ETRAX_SER0_RI_ON_PA_BIT=-1
+CONFIG_ETRAX_SER0_DSR_ON_PA_BIT=-1
+CONFIG_ETRAX_SER0_CD_ON_PA_BIT=-1
+CONFIG_ETRAX_SER0_DTR_ON_PB_BIT=-1
+CONFIG_ETRAX_SER0_RI_ON_PB_BIT=-1
+CONFIG_ETRAX_SER0_DSR_ON_PB_BIT=-1
+CONFIG_ETRAX_SER0_CD_ON_PB_BIT=-1
+# CONFIG_ETRAX_SERIAL_PORT1 is not set
+CONFIG_ETRAX_SERIAL_PORT2=y
+# CONFIG_CONFIG_ETRAX_SERIAL_PORT2_NO_DMA_OUT is not set
+CONFIG_CONFIG_ETRAX_SERIAL_PORT2_DMA2_OUT=y
+# CONFIG_CONFIG_ETRAX_SERIAL_PORT2_NO_DMA_IN is not set
+CONFIG_CONFIG_ETRAX_SERIAL_PORT2_DMA3_IN=y
+CONFIG_ETRAX_SER2_DTR_RI_DSR_CD_ON_NONE=y
+# CONFIG_ETRAX_SER2_DTR_RI_DSR_CD_ON_PA is not set
+# CONFIG_ETRAX_SER2_DTR_RI_DSR_CD_ON_PB is not set
+# CONFIG_ETRAX_SER2_DTR_RI_DSR_CD_MIXED is not set
+CONFIG_ETRAX_SER2_DTR_ON_PA_BIT=-1
+CONFIG_ETRAX_SER2_RI_ON_PA_BIT=-1
+CONFIG_ETRAX_SER2_DSR_ON_PA_BIT=-1
+CONFIG_ETRAX_SER2_CD_ON_PA_BIT=-1
+CONFIG_ETRAX_SER2_DTR_ON_PB_BIT=-1
+CONFIG_ETRAX_SER2_RI_ON_PB_BIT=-1
+CONFIG_ETRAX_SER2_DSR_ON_PB_BIT=-1
+CONFIG_ETRAX_SER2_CD_ON_PB_BIT=-1
+# CONFIG_ETRAX_SERIAL_PORT3 is not set
+# CONFIG_ETRAX_RS485 is not set
+# CONFIG_ETRAX_IDE is not set
+# CONFIG_IDE is not set
+# CONFIG_ETRAX_USB_HOST is not set
+CONFIG_ETRAX_AXISFLASHMAP=y
+CONFIG_ETRAX_PTABLE_SECTOR=65536
+CONFIG_MTD=y
+CONFIG_MTD_CFI=y
+CONFIG_MTD_CFI_AMDSTD=y
+CONFIG_MTD_OBSOLETE_CHIPS=y
+CONFIG_MTD_AMDSTD=y
+CONFIG_MTD_CHAR=y
+CONFIG_MTD_BLOCK=y
+CONFIG_MTD_PARTITIONS=y
+CONFIG_MTD_CONCAT=y
+# CONFIG_ETRAX_I2C is not set
+CONFIG_ETRAX_GPIO=y
+CONFIG_ETRAX_PA_BUTTON_BITMASK=0x02
+CONFIG_ETRAX_PA_CHANGEABLE_DIR=0x00
+CONFIG_ETRAX_PA_CHANGEABLE_BITS=0xFF
+CONFIG_ETRAX_PB_CHANGEABLE_DIR=0x00
+CONFIG_ETRAX_PB_CHANGEABLE_BITS=0xFF
+# CONFIG_ETRAX_RTC is not set
+
+#
+# Generic Driver Options
 #
 
 #
 # Memory Technology Devices (MTD)
 #
-CONFIG_MTD=y
 # CONFIG_MTD_DEBUG is not set
+# CONFIG_MTD_REDBOOT_PARTS is not set
+# CONFIG_MTD_CMDLINE_PARTS is not set
 
 #
-# Disk-On-Chip Device Drivers
+# User Modules And Translation Layers
 #
-# CONFIG_MTD_DOC1000 is not set
-# CONFIG_MTD_DOC2000 is not set
-# CONFIG_MTD_DOC2001 is not set
-# CONFIG_MTD_DOCPROBE is not set
+# CONFIG_FTL is not set
+# CONFIG_NFTL is not set
+# CONFIG_INFTL is not set
 
 #
-# RAM/ROM Device Drivers
+# RAM/ROM/Flash chip drivers
 #
-# CONFIG_MTD_PMC551 is not set
-# CONFIG_MTD_SLRAM is not set
-# CONFIG_MTD_RAM is not set
+# CONFIG_MTD_JEDECPROBE is not set
+CONFIG_MTD_GEN_PROBE=y
+# CONFIG_MTD_CFI_ADV_OPTIONS is not set
+# CONFIG_MTD_CFI_INTELEXT is not set
+# CONFIG_MTD_CFI_STAA is not set
+CONFIG_MTD_RAM=y
 # CONFIG_MTD_ROM is not set
-# CONFIG_MTD_MTDRAM is not set
+# CONFIG_MTD_ABSENT is not set
+# CONFIG_MTD_SHARP is not set
+# CONFIG_MTD_JEDEC is not set
 
 #
-# Linearly Mapped Flash Device Drivers
+# Mapping drivers for chip access
 #
-CONFIG_MTD_CFI=y
-# CONFIG_MTD_CFI_GEOMETRY is not set
-# CONFIG_MTD_CFI_INTELEXT is not set
-CONFIG_MTD_CFI_AMDSTD=y
-CONFIG_MTD_AMDSTD=y
-# CONFIG_MTD_SHARP is not set
+CONFIG_MTD_COMPLEX_MAPPINGS=y
 # CONFIG_MTD_PHYSMAP is not set
-# CONFIG_MTD_NORA is not set
-# CONFIG_MTD_PNC2000 is not set
-# CONFIG_MTD_RPXLITE is not set
-# CONFIG_MTD_SC520CDP is not set
-# CONFIG_MTD_SBC_MEDIAGX is not set
-# CONFIG_MTD_ELAN_104NC is not set
-# CONFIG_MTD_SA1100 is not set
-# CONFIG_MTD_DC21285 is not set
-# CONFIG_MTD_CSTM_CFI_JEDEC is not set
-# CONFIG_MTD_JEDEC is not set
-# CONFIG_MTD_MIXMEM is not set
-# CONFIG_MTD_OCTAGON is not set
-# CONFIG_MTD_VMAX is not set
 
 #
-# NAND Flash Device Drivers
+# Self-contained MTD device drivers
 #
-# CONFIG_MTD_NAND is not set
-# CONFIG_MTD_NAND_SPIA is not set
+# CONFIG_MTD_SLRAM is not set
+CONFIG_MTD_MTDRAM=y
+CONFIG_MTDRAM_TOTAL_SIZE=0
+CONFIG_MTDRAM_ERASE_SIZE=64
+CONFIG_MTDRAM_ABS_POS=0x0
+# CONFIG_MTD_BLKMTD is not set
 
 #
-# User Modules And Translation Layers
+# Disk-On-Chip Device Drivers
 #
-CONFIG_MTD_CHAR=y
-CONFIG_MTD_BLOCK=y
-# CONFIG_FTL is not set
-# CONFIG_NFTL is not set
+# CONFIG_MTD_DOC2000 is not set
+# CONFIG_MTD_DOC2001 is not set
+# CONFIG_MTD_DOC2001PLUS is not set
+
+#
+# NAND Flash Device Drivers
+#
+# CONFIG_MTD_NAND is not set
 
 #
 # Parallel port support
@@ -102,51 +228,98 @@
 # CONFIG_PARPORT is not set
 
 #
-# Plug and Play configuration
+# Plug and Play support
 #
-# CONFIG_PNP is not set
-# CONFIG_ISAPNP is not set
 
 #
 # Block devices
 #
 # CONFIG_BLK_DEV_FD is not set
-# CONFIG_BLK_DEV_XD is not set
-# CONFIG_PARIDE is not set
-# CONFIG_BLK_CPQ_DA is not set
-# CONFIG_BLK_CPQ_CISS_DA is not set
-# CONFIG_BLK_DEV_DAC960 is not set
 # CONFIG_BLK_DEV_LOOP is not set
 # CONFIG_BLK_DEV_NBD is not set
-# CONFIG_BLK_DEV_RAM is not set
+CONFIG_BLK_DEV_RAM=y
+CONFIG_BLK_DEV_RAM_SIZE=4096
 # CONFIG_BLK_DEV_INITRD is not set
 
 #
+# Multi-device support (RAID and LVM)
+#
+# CONFIG_MD is not set
+
+#
+# ATA/ATAPI/MFM/RLL support
+#
+
+#
+# SCSI device support
+#
+# CONFIG_SCSI is not set
+
+#
+# IEEE 1394 (FireWire) support
+#
+# CONFIG_IEEE1394 is not set
+
+#
+# I2O device support
+#
+
+#
+# Networking support
+#
+CONFIG_NET=y
+
+#
 # Networking options
 #
-# CONFIG_PACKET is not set
-# CONFIG_NETLINK is not set
-# CONFIG_NETFILTER is not set
-# CONFIG_FILTER is not set
+CONFIG_PACKET=y
+# CONFIG_PACKET_MMAP is not set
+# CONFIG_NETLINK_DEV is not set
 CONFIG_UNIX=y
+# CONFIG_NET_KEY is not set
 CONFIG_INET=y
 # CONFIG_IP_MULTICAST is not set
 # CONFIG_IP_ADVANCED_ROUTER is not set
 # CONFIG_IP_PNP is not set
 # CONFIG_NET_IPIP is not set
 # CONFIG_NET_IPGRE is not set
-# CONFIG_INET_ECN is not set
+# CONFIG_ARPD is not set
 # CONFIG_SYN_COOKIES is not set
+# CONFIG_INET_AH is not set
+# CONFIG_INET_ESP is not set
+# CONFIG_INET_IPCOMP is not set
+
+#
+# IP: Virtual Server Configuration
+#
+# CONFIG_IP_VS is not set
 # CONFIG_IPV6 is not set
-# CONFIG_KHTTPD is not set
+CONFIG_NETFILTER=y
+# CONFIG_NETFILTER_DEBUG is not set
+
+#
+# IP: Netfilter Configuration
+#
+# CONFIG_IP_NF_CONNTRACK is not set
+# CONFIG_IP_NF_QUEUE is not set
+# CONFIG_IP_NF_IPTABLES is not set
+# CONFIG_IP_NF_ARPTABLES is not set
+# CONFIG_IP_NF_COMPAT_IPCHAINS is not set
+# CONFIG_IP_NF_COMPAT_IPFWADM is not set
+
+#
+# SCTP Configuration (EXPERIMENTAL)
+#
+# CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
+# CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
+# CONFIG_LLC2 is not set
 # CONFIG_IPX is not set
 # CONFIG_ATALK is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 # CONFIG_X25 is not set
 # CONFIG_LAPB is not set
-# CONFIG_LLC is not set
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
@@ -159,167 +332,114 @@
 # CONFIG_NET_SCHED is not set
 
 #
-# Telephony Support
-#
-# CONFIG_PHONE is not set
-# CONFIG_PHONE_IXJ is not set
-
-#
-# ATA/IDE/MFM/RLL support
-#
-# CONFIG_IDE is not set
-
-#
-# IDE, ATA and ATAPI Block devices
-#
-# CONFIG_BLK_DEV_IDE is not set
-# CONFIG_BLK_DEV_HD_IDE is not set
-# CONFIG_BLK_DEV_HD is not set
-# CONFIG_BLK_DEV_IDEDISK is not set
-# CONFIG_IDEDISK_MULTI_MODE is not set
-# CONFIG_BLK_DEV_IDECS is not set
-# CONFIG_BLK_DEV_IDECD is not set
-# CONFIG_BLK_DEV_IDETAPE is not set
-# CONFIG_BLK_DEV_IDEFLOPPY is not set
-# CONFIG_BLK_DEV_IDESCSI is not set
-# CONFIG_BLK_DEV_CMD640 is not set
-# CONFIG_BLK_DEV_CMD640_ENHANCED is not set
-# CONFIG_BLK_DEV_ISAPNP is not set
-# CONFIG_IDE_CHIPSETS is not set
-# CONFIG_IDEDMA_AUTO is not set
-
-#
-# SCSI support
-#
-# CONFIG_SCSI is not set
-
-#
-# I2O device support
-#
-# CONFIG_I2O is not set
-# CONFIG_I2O_BLOCK is not set
-# CONFIG_I2O_LAN is not set
-# CONFIG_I2O_SCSI is not set
-# CONFIG_I2O_PROC is not set
-
-#
-# Network device support
+# Network testing
 #
+# CONFIG_NET_PKTGEN is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_HAMRADIO is not set
+# CONFIG_IRDA is not set
+# CONFIG_BT is not set
 CONFIG_NETDEVICES=y
-
-#
-# ARCnet devices
-#
-# CONFIG_ARCNET is not set
 # CONFIG_DUMMY is not set
 # CONFIG_BONDING is not set
 # CONFIG_EQUALIZER is not set
 # CONFIG_TUN is not set
-# CONFIG_NET_SB1000 is not set
 
 #
 # Ethernet (10 or 100Mbit)
 #
-CONFIG_NET_ETHERNET=y
-# CONFIG_NET_VENDOR_3COM is not set
-# CONFIG_LANCE is not set
-# CONFIG_NET_VENDOR_SMC is not set
-# CONFIG_NET_VENDOR_RACAL is not set
-# CONFIG_AT1700 is not set
-# CONFIG_DEPCA is not set
-# CONFIG_NET_ISA is not set
-# CONFIG_NET_PCI is not set
-# CONFIG_NET_POCKET is not set
+# CONFIG_MII is not set
 
 #
 # Ethernet (1000 Mbit)
 #
-# CONFIG_ACENIC is not set
-# CONFIG_HAMACHI is not set
-# CONFIG_YELLOWFIN is not set
-# CONFIG_SK98LIN is not set
-# CONFIG_FDDI is not set
-# CONFIG_HIPPI is not set
-# CONFIG_PLIP is not set
-# CONFIG_PPP is not set
-# CONFIG_SLIP is not set
 
 #
-# Wireless LAN (non-hamradio)
+# Ethernet (10000 Mbit)
 #
-# CONFIG_NET_RADIO is not set
 
 #
 # Token Ring devices
 #
-# CONFIG_TR is not set
-# CONFIG_NET_FC is not set
-# CONFIG_RCPCI is not set
-# CONFIG_SHAPER is not set
+
+#
+# Wireless LAN (non-hamradio)
+#
+# CONFIG_NET_RADIO is not set
 
 #
 # Wan interfaces
 #
 # CONFIG_WAN is not set
+# CONFIG_PPP is not set
+# CONFIG_SLIP is not set
+# CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
 
 #
-# Amateur Radio support
+# ISDN subsystem
 #
-# CONFIG_HAMRADIO is not set
+# CONFIG_ISDN is not set
 
 #
-# IrDA (infrared) support
+# Telephony Support
 #
-# CONFIG_IRDA is not set
+# CONFIG_PHONE is not set
 
 #
-# ISDN subsystem
+# Input device support
 #
-# CONFIG_ISDN is not set
+# CONFIG_INPUT is not set
 
 #
-# CD-ROM drivers (not for SCSI or IDE/ATAPI drives)
+# Userland interfaces
 #
-# CONFIG_CD_NO_IDESCSI is not set
 
 #
-# Input core support
+# Input I/O drivers
+#
+# CONFIG_GAMEPORT is not set
+CONFIG_SOUND_GAMEPORT=y
+CONFIG_SERIO=y
+# CONFIG_SERIO_I8042 is not set
+# CONFIG_SERIO_SERPORT is not set
+# CONFIG_SERIO_CT82C710 is not set
+
+#
+# Input Device Drivers
 #
-# CONFIG_INPUT is not set
 
 #
 # Character devices
 #
 # CONFIG_VT is not set
-# CONFIG_SERIAL is not set
-# CONFIG_SERIAL_EXTENDED is not set
 # CONFIG_SERIAL_NONSTANDARD is not set
-# CONFIG_UNIX98_PTYS is not set
 
 #
-# I2C support
+# Serial drivers
 #
-# CONFIG_I2C is not set
+# CONFIG_SERIAL_8250 is not set
 
 #
-# Mice
+# Non-8250 serial port support
 #
-# CONFIG_BUSMOUSE is not set
-# CONFIG_MOUSE is not set
+CONFIG_UNIX98_PTYS=y
+CONFIG_LEGACY_PTYS=y
+CONFIG_LEGACY_PTY_COUNT=256
+# CONFIG_QIC02_TAPE is not set
 
 #
-# Joysticks
+# IPMI
 #
-# CONFIG_JOYSTICK is not set
-# CONFIG_QIC02_TAPE is not set
+# CONFIG_IPMI_HANDLER is not set
 
 #
 # Watchdog Cards
 #
 # CONFIG_WATCHDOG is not set
-# CONFIG_INTEL_RNG is not set
-# CONFIG_NVRAM is not set
 # CONFIG_RTC is not set
+# CONFIG_GEN_RTC is not set
 # CONFIG_DTLK is not set
 # CONFIG_R3964 is not set
 # CONFIG_APPLICOM is not set
@@ -330,6 +450,7 @@
 # CONFIG_FTAPE is not set
 # CONFIG_AGP is not set
 # CONFIG_DRM is not set
+# CONFIG_RAW_DRIVER is not set
 
 #
 # Multimedia devices
@@ -337,76 +458,98 @@
 # CONFIG_VIDEO_DEV is not set
 
 #
+# Digital Video Broadcasting Devices
+#
+# CONFIG_DVB is not set
+
+#
 # File systems
 #
+# CONFIG_EXT2_FS is not set
+# CONFIG_EXT3_FS is not set
+# CONFIG_JBD is not set
+# CONFIG_REISERFS_FS is not set
+# CONFIG_JFS_FS is not set
+# CONFIG_XFS_FS is not set
+# CONFIG_MINIX_FS is not set
+# CONFIG_ROMFS_FS is not set
 # CONFIG_QUOTA is not set
 # CONFIG_AUTOFS_FS is not set
 # CONFIG_AUTOFS4_FS is not set
+
+#
+# CD-ROM/DVD Filesystems
+#
+# CONFIG_ISO9660_FS is not set
+# CONFIG_UDF_FS is not set
+
+#
+# DOS/FAT/NT Filesystems
+#
+# CONFIG_FAT_FS is not set
+# CONFIG_NTFS_FS is not set
+
+#
+# Pseudo filesystems
+#
+CONFIG_PROC_FS=y
+CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
+# CONFIG_DEVFS_FS is not set
+# CONFIG_DEVPTS_FS_XATTR is not set
+CONFIG_TMPFS=y
+# CONFIG_HUGETLB_PAGE is not set
+CONFIG_RAMFS=y
+
+#
+# Miscellaneous filesystems
+#
 # CONFIG_ADFS_FS is not set
-# CONFIG_ADFS_FS_RW is not set
 # CONFIG_AFFS_FS is not set
 # CONFIG_HFS_FS is not set
+# CONFIG_HFSPLUS_FS is not set
+# CONFIG_BEFS_FS is not set
 # CONFIG_BFS_FS is not set
-# CONFIG_FAT_FS is not set
-# CONFIG_MSDOS_FS is not set
-# CONFIG_UMSDOS_FS is not set
-# CONFIG_VFAT_FS is not set
 # CONFIG_EFS_FS is not set
-# CONFIG_JFFS_FS is not set
+CONFIG_JFFS_FS=y
+CONFIG_JFFS_FS_VERBOSE=0
+# CONFIG_JFFS2_FS is not set
 CONFIG_CRAMFS=y
-CONFIG_RAMFS=y
-# CONFIG_ISO9660_FS is not set
-# CONFIG_JOLIET is not set
-# CONFIG_MINIX_FS is not set
-# CONFIG_NTFS_FS is not set
-# CONFIG_NTFS_DEBUG is not set
-# CONFIG_NTFS_RW is not set
+# CONFIG_VXFS_FS is not set
 # CONFIG_HPFS_FS is not set
-CONFIG_PROC_FS=y
-# CONFIG_DEVFS_FS is not set
-# CONFIG_DEVFS_MOUNT is not set
-# CONFIG_DEVFS_DEBUG is not set
-# CONFIG_DEVPTS_FS is not set
 # CONFIG_QNX4FS_FS is not set
-# CONFIG_QNX4FS_RW is not set
-# CONFIG_ROMFS_FS is not set
-# CONFIG_EXT2_FS is not set
 # CONFIG_SYSV_FS is not set
-# CONFIG_SYSV_FS_WRITE is not set
-# CONFIG_UDF_FS is not set
-# CONFIG_UDF_RW is not set
 # CONFIG_UFS_FS is not set
-# CONFIG_UFS_FS_WRITE is not set
 
 #
 # Network File Systems
 #
-# CONFIG_CODA_FS is not set
-# CONFIG_NFS_FS is not set
-# CONFIG_NFS_V3 is not set
-# CONFIG_ROOT_NFS is not set
+CONFIG_NFS_FS=y
+CONFIG_NFS_V3=y
+# CONFIG_NFS_V4 is not set
+# CONFIG_NFS_DIRECTIO is not set
 # CONFIG_NFSD is not set
-# CONFIG_NFSD_V3 is not set
-# CONFIG_SUNRPC is not set
-# CONFIG_LOCKD is not set
+CONFIG_LOCKD=y
+CONFIG_LOCKD_V4=y
+# CONFIG_EXPORTFS is not set
+CONFIG_SUNRPC=y
+# CONFIG_RPCSEC_GSS_KRB5 is not set
 # CONFIG_SMB_FS is not set
+# CONFIG_CIFS is not set
 # CONFIG_NCP_FS is not set
-# CONFIG_NCPFS_PACKET_SIGNING is not set
-# CONFIG_NCPFS_IOCTL_LOCKING is not set
-# CONFIG_NCPFS_STRONG is not set
-# CONFIG_NCPFS_NFS_NS is not set
-# CONFIG_NCPFS_OS2_NS is not set
-# CONFIG_NCPFS_SMALLDOS is not set
-# CONFIG_NCPFS_MOUNT_SUBDIR is not set
-# CONFIG_NCPFS_NDS_DOMAINS is not set
-# CONFIG_NCPFS_NLS is not set
-# CONFIG_NCPFS_EXTRAS is not set
+# CONFIG_CODA_FS is not set
+# CONFIG_INTERMEZZO_FS is not set
+# CONFIG_AFS_FS is not set
 
 #
 # Partition Types
 #
 # CONFIG_PARTITION_ADVANCED is not set
 CONFIG_MSDOS_PARTITION=y
+
+#
+# Native Language Support
+#
 # CONFIG_NLS is not set
 
 #
@@ -417,9 +560,33 @@
 #
 # USB support
 #
-# CONFIG_USB is not set
+
+#
+# USB Gadget Support
+#
+# CONFIG_USB_GADGET is not set
 
 #
 # Kernel hacking
 #
 # CONFIG_PROFILE is not set
+# CONFIG_ETRAX_KGDB is not set
+# CONFIG_DEBUG_INFO is not set
+# CONFIG_FRAME_POINTER is not set
+
+#
+# Security options
+#
+# CONFIG_SECURITY is not set
+
+#
+# Cryptographic options
+#
+# CONFIG_CRYPTO is not set
+
+#
+# Library routines
+#
+# CONFIG_CRC32 is not set
+# CONFIG_LIBCRC32C is not set
+CONFIG_ZLIB_INFLATE=y
diff -Nru a/arch/cris/kernel/Makefile b/arch/cris/kernel/Makefile
--- a/arch/cris/kernel/Makefile	2004-06-02 23:26:59 -07:00
+++ b/arch/cris/kernel/Makefile	2004-06-02 23:26:59 -07:00
@@ -1,14 +1,14 @@
-# $Id: Makefile,v 1.8 2003/04/09 05:20:47 starvik Exp $
+# $Id: Makefile,v 1.10 2004/05/14 10:18:12 starvik Exp $
 #
 # Makefile for the linux kernel.
 #
 
-extra-y := vmlinux.lds.s
+extra-y	:= vmlinux.lds.s
 
 obj-y   := process.o traps.o irq.o ptrace.o setup.o \
 	   time.o sys_cris.o semaphore.o
 
-obj-$(CONFIG_MODULES)    += ksyms.o
+obj-$(CONFIG_MODULES)    += crisksyms.o
 obj-$(CONFIG_MODULES)	 += module.o
 
 clean:
diff -Nru a/arch/cris/kernel/crisksyms.c b/arch/cris/kernel/crisksyms.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/arch/cris/kernel/crisksyms.c	2004-06-02 23:27:00 -07:00
@@ -0,0 +1,104 @@
+#include <linux/config.h>
+#include <linux/module.h>
+#include <linux/user.h>
+#include <linux/elfcore.h>
+#include <linux/sched.h>
+#include <linux/in6.h>
+#include <linux/interrupt.h>
+#include <linux/smp_lock.h>
+#include <linux/pm.h>
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/tty.h>
+
+#include <asm/semaphore.h>
+#include <asm/processor.h>
+#include <asm/uaccess.h>
+#include <asm/checksum.h>
+#include <asm/io.h>
+#include <asm/hardirq.h>
+#include <asm/delay.h>
+#include <asm/irq.h>
+#include <asm/pgtable.h>
+#include <asm/fasttimer.h>
+
+extern void dump_thread(struct pt_regs *, struct user *);
+extern unsigned long get_cmos_time(void);
+extern void __Udiv(void);
+extern void __Umod(void);
+extern void __Div(void);
+extern void __Mod(void);
+extern void __ashrdi3(void);
+extern void iounmap(void *addr);
+
+/* Platform dependent support */
+EXPORT_SYMBOL(dump_thread);
+EXPORT_SYMBOL(enable_irq);
+EXPORT_SYMBOL(disable_irq);
+EXPORT_SYMBOL(kernel_thread);
+EXPORT_SYMBOL(get_cmos_time);
+EXPORT_SYMBOL(loops_per_usec);
+
+/* String functions */
+EXPORT_SYMBOL(memcmp);
+EXPORT_SYMBOL(memmove);
+EXPORT_SYMBOL(strpbrk);
+EXPORT_SYMBOL(strstr);
+EXPORT_SYMBOL(strcpy);
+EXPORT_SYMBOL(strchr);
+EXPORT_SYMBOL(strcmp);
+EXPORT_SYMBOL(strlen);
+EXPORT_SYMBOL(strcat);
+EXPORT_SYMBOL(strncat);
+EXPORT_SYMBOL(strncmp);
+EXPORT_SYMBOL(strncpy);
+
+/* Math functions */
+EXPORT_SYMBOL(__Udiv);
+EXPORT_SYMBOL(__Umod);
+EXPORT_SYMBOL(__Div);
+EXPORT_SYMBOL(__Mod);
+EXPORT_SYMBOL(__ashrdi3);
+
+/* Memory functions */
+EXPORT_SYMBOL(__ioremap);
+EXPORT_SYMBOL(iounmap);
+
+/* Semaphore functions */
+EXPORT_SYMBOL(__up);
+EXPORT_SYMBOL(__down);
+EXPORT_SYMBOL(__down_interruptible);
+EXPORT_SYMBOL(__down_trylock);
+
+/* Export shadow registers for the CPU I/O pins */
+EXPORT_SYMBOL(genconfig_shadow);
+EXPORT_SYMBOL(port_pa_data_shadow);
+EXPORT_SYMBOL(port_pa_dir_shadow);
+EXPORT_SYMBOL(port_pb_data_shadow);
+EXPORT_SYMBOL(port_pb_dir_shadow);
+EXPORT_SYMBOL(port_pb_config_shadow);
+EXPORT_SYMBOL(port_g_data_shadow);
+
+/* Userspace access functions */
+EXPORT_SYMBOL(__copy_user_zeroing);
+EXPORT_SYMBOL(__copy_user);
+
+/* Cache flush functions */
+EXPORT_SYMBOL(flush_etrax_cache);
+EXPORT_SYMBOL(prepare_rx_descriptor);
+
+#undef memcpy
+#undef memset
+extern void * memset(void *, int, __kernel_size_t);
+extern void * memcpy(void *, const void *, __kernel_size_t);
+EXPORT_SYMBOL_NOVERS(memcpy);
+EXPORT_SYMBOL_NOVERS(memset);
+
+#ifdef CONFIG_ETRAX_FAST_TIMER
+/* Fast timer functions */
+EXPORT_SYMBOL(fast_timer_list);
+EXPORT_SYMBOL(start_one_shot_timer);
+EXPORT_SYMBOL(del_fast_timer);
+EXPORT_SYMBOL(schedule_usleep);
+#endif
+
diff -Nru a/arch/cris/kernel/hexify.c b/arch/cris/kernel/hexify.c
--- a/arch/cris/kernel/hexify.c	2004-06-02 23:27:00 -07:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,31 +0,0 @@
-#include <stdio.h>
-
-
-void main()
-{
-	int c;
-	int comma=0;
-	int count=0;
-	while((c=getchar())!=EOF)
-	{
-		unsigned char x=c;
-		if(comma)
-			printf(",");
-		else
-			comma=1;
-		if(count==8)
-		{
-			count=0;
-			printf("\n");
-		}
-		if(count==0)
-			printf("\t");
-		printf("0x%02X",c);
-		count++;
-	}
-	if(count)
-		printf("\n");
-	exit(0);
-}
-
-		
diff -Nru a/arch/cris/kernel/irq.c b/arch/cris/kernel/irq.c
--- a/arch/cris/kernel/irq.c	2004-06-02 23:27:00 -07:00
+++ b/arch/cris/kernel/irq.c	2004-06-02 23:27:00 -07:00
@@ -1,4 +1,4 @@
-/* $Id: irq.c,v 1.8 2003/07/04 08:27:52 starvik Exp $
+/*
  *
  *	linux/arch/cris/kernel/irq.c
  *
@@ -99,7 +99,7 @@
 		if (!action) 
 			goto skip;
 		seq_printf(p, "%2d: %10u %c %s",
-			i, kstat_cpu(0).irqs[i],
+			i, kstat_this_cpu.irqs[i],
 			(action->flags & SA_INTERRUPT) ? '+' : ' ',
 			action->name);
 		for (action = action->next; action; action = action->next) {
@@ -129,13 +129,12 @@
 
         cpu = smp_processor_id();
         irq_enter();
-	kstat_cpu(cpu).irqs[irq]++;
+	kstat_cpu(cpu).irqs[irq - FIRST_IRQ]++;
+	action = irq_action[irq - FIRST_IRQ];
 
-	action = irq_action[irq];
         if (action) {
                 if (!(action->flags & SA_INTERRUPT))
                         local_irq_enable();
-                action = irq_action[irq];
                 do_random = 0;
                 do {
                         do_random |= action->flags;
@@ -175,7 +174,7 @@
 	struct irqaction *old, **p;
 	unsigned long flags;
 
-	p = irq_action + irq;
+	p = irq_action + irq - FIRST_IRQ;
 	if ((old = *p) != NULL) {
 		/* Can't share interrupts unless both agree to */
 		if (!(old->flags & new->flags & SA_SHIRQ))
@@ -230,12 +229,6 @@
 	int retval;
 	struct irqaction * action;
 
-	/* interrupts 0 and 1 are hardware breakpoint and NMI and we can't support
-	   these yet. interrupt 15 is the multiple irq, it's special. */
-
-	if(irq < 2 || irq == 15 || irq >= NR_IRQS)
-		return -EINVAL;
-
 	if(!handler)
 		return -EINVAL;
 
@@ -270,7 +263,7 @@
 		printk("Trying to free IRQ%d\n",irq);
 		return;
 	}
-	for (p = irq + irq_action; (action = *p) != NULL; p = &action->next) {
+	for (p = irq - FIRST_IRQ + irq_action; (action = *p) != NULL; p = &action->next) {
 		if (action->dev_id != dev_id)
 			continue;
 
@@ -278,7 +271,7 @@
 		local_save_flags(flags);
 		local_irq_disable();
 		*p = action->next;
-		if (!irq_action[irq]) {
+		if (!irq_action[irq - FIRST_IRQ]) {
 			mask_irq(irq);
 			arch_free_irq(irq);
 		}
diff -Nru a/arch/cris/kernel/ksyms.c b/arch/cris/kernel/ksyms.c
--- a/arch/cris/kernel/ksyms.c	2004-06-02 23:27:00 -07:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,96 +0,0 @@
-#include <linux/config.h>
-#include <linux/module.h>
-#include <linux/user.h>
-#include <linux/elfcore.h>
-#include <linux/sched.h>
-#include <linux/in6.h>
-#include <linux/interrupt.h>
-#include <linux/smp_lock.h>
-#include <linux/pm.h>
-#include <linux/kernel.h>
-#include <linux/string.h>
-#include <linux/tty.h>
- 
-#include <asm/semaphore.h>
-#include <asm/processor.h>
-#include <asm/uaccess.h>
-#include <asm/checksum.h>
-#include <asm/io.h>
-#include <asm/hardirq.h>
-#include <asm/delay.h>
-#include <asm/irq.h>
-#include <asm/pgtable.h>
-
-extern void dump_thread(struct pt_regs *, struct user *);
-extern unsigned long get_cmos_time(void);
-extern void __Udiv(void);
-extern void __Umod(void);
-extern void __Div(void);
-extern void __Mod(void);
-extern void __ashrdi3(void);
-extern void iounmap(void *addr);
-
-/* Platform dependent support */
-EXPORT_SYMBOL(dump_thread);
-EXPORT_SYMBOL(enable_irq);
-EXPORT_SYMBOL(disable_irq);
-EXPORT_SYMBOL(kernel_thread);
-EXPORT_SYMBOL(get_cmos_time);
-EXPORT_SYMBOL(loops_per_usec);
-
-/* String functions */
-EXPORT_SYMBOL(memcmp);
-EXPORT_SYMBOL(memmove);
-EXPORT_SYMBOL(strpbrk);
-EXPORT_SYMBOL(strstr);
-EXPORT_SYMBOL(strcpy);
-EXPORT_SYMBOL(strchr);
-EXPORT_SYMBOL(strcmp);
-EXPORT_SYMBOL(strlen);
-EXPORT_SYMBOL(strcat);
-EXPORT_SYMBOL(strncat);
-EXPORT_SYMBOL(strncmp);
-EXPORT_SYMBOL(strncpy);
-
-/* Math functions */
-EXPORT_SYMBOL(__Udiv);
-EXPORT_SYMBOL(__Umod);
-EXPORT_SYMBOL(__Div);
-EXPORT_SYMBOL(__Mod);
-EXPORT_SYMBOL(__ashrdi3);
-
-/* Memory functions */
-EXPORT_SYMBOL(__ioremap);
-EXPORT_SYMBOL(iounmap);
-
-/* Semaphore functions */
-EXPORT_SYMBOL(__up);
-EXPORT_SYMBOL(__down);
-EXPORT_SYMBOL(__down_interruptible);
-EXPORT_SYMBOL(__down_trylock);
-
-/* Export shadow registers for the CPU I/O pins */
-EXPORT_SYMBOL(genconfig_shadow);
-EXPORT_SYMBOL(port_pa_data_shadow);
-EXPORT_SYMBOL(port_pa_dir_shadow);
-EXPORT_SYMBOL(port_pb_data_shadow);
-EXPORT_SYMBOL(port_pb_dir_shadow);
-EXPORT_SYMBOL(port_pb_config_shadow);
-EXPORT_SYMBOL(port_g_data_shadow);
-
-/* Userspace access functions */
-EXPORT_SYMBOL(__copy_user_zeroing);
-EXPORT_SYMBOL(__copy_user);
-
-/* Cache flush functions */
-EXPORT_SYMBOL(flush_etrax_cache);
-EXPORT_SYMBOL(prepare_rx_descriptor);
-
-#undef memcpy
-#undef memset
-extern void * memset(void *, int, __kernel_size_t);
-extern void * memcpy(void *, const void *, __kernel_size_t);
-EXPORT_SYMBOL_NOVERS(memcpy);
-EXPORT_SYMBOL_NOVERS(memset);
-
-
diff -Nru a/arch/cris/kernel/module.c b/arch/cris/kernel/module.c
--- a/arch/cris/kernel/module.c	2004-06-02 23:26:59 -07:00
+++ b/arch/cris/kernel/module.c	2004-06-02 23:26:59 -07:00
@@ -75,8 +75,6 @@
 		sym = (Elf32_Sym *)sechdrs[symindex].sh_addr
 			+ ELF32_R_SYM(rel[i].r_info);
 
-                /* TODO: This is probably not correct */
-                printk("Beware: untested code in module.c!\n");
                 /* We add the value into the location given */
                 *location += sym->st_value;
 	}
@@ -89,9 +87,26 @@
 		       unsigned int relsec,
 		       struct module *me)
 {
-	printk(KERN_ERR "module %s: ADD RELOCATION unsupported\n",
-	       me->name);
-	return -ENOEXEC;
+  	unsigned int i;
+	Elf32_Rela *rela = (void *)sechdrs[relsec].sh_addr;
+
+	DEBUGP ("Applying relocate section %u to %u\n", relsec,
+		sechdrs[relsec].sh_info);
+
+	for (i = 0; i < sechdrs[relsec].sh_size / sizeof (*rela); i++) {
+		/* This is where to make the change */
+		uint32_t *loc
+			= ((void *)sechdrs[sechdrs[relsec].sh_info].sh_addr
+			   + rela[i].r_offset);
+		/* This is the symbol it is referring to.  Note that all
+		   undefined symbols have been resolved.  */
+		Elf32_Sym *sym
+			= ((Elf32_Sym *)sechdrs[symindex].sh_addr
+			   + ELF32_R_SYM (rela[i].r_info));
+		*loc = sym->st_value + rela[i].r_addend;
+	}
+
+	return 0;
 }
 
 int module_finalize(const Elf_Ehdr *hdr,
diff -Nru a/arch/cris/kernel/process.c b/arch/cris/kernel/process.c
--- a/arch/cris/kernel/process.c	2004-06-02 23:26:59 -07:00
+++ b/arch/cris/kernel/process.c	2004-06-02 23:26:59 -07:00
@@ -1,4 +1,4 @@
-/* $Id: process.c,v 1.14 2003/06/10 10:21:12 johana Exp $
+/* $Id: process.c,v 1.17 2004/04/05 13:53:48 starvik Exp $
  * 
  *  linux/arch/cris/kernel/process.c
  *
@@ -8,9 +8,18 @@
  *  Authors:   Bjorn Wesen (bjornw@axis.com)
  *
  *  $Log: process.c,v $
+ *  Revision 1.17  2004/04/05 13:53:48  starvik
+ *  Merge of Linux 2.6.5
+ *
+ *  Revision 1.16  2003/10/27 08:04:33  starvik
+ *  Merge of Linux 2.6.0-test9
+ *
+ *  Revision 1.15  2003/09/11 07:29:52  starvik
+ *  Merge of Linux 2.6.0-test5
+ *
  *  Revision 1.14  2003/06/10 10:21:12  johana
  *  Moved thread_saved_pc() from arch/cris/kernel/process.c to
- *  subarch specific process.c. 
+ *  subarch specific process.c. arch-v32 has an erp, no irp.
  *
  *  Revision 1.13  2003/04/09 05:20:47  starvik
  *  Merge of Linux 2.5.67
@@ -94,6 +103,7 @@
 #include <asm/atomic.h>
 #include <asm/pgtable.h>
 #include <asm/uaccess.h>
+#include <asm/irq.h>
 #include <linux/module.h>
 #include <linux/spinlock.h>
 #include <linux/fs_struct.h>
@@ -182,13 +192,17 @@
 {
 	/* endless idle loop with no priority at all */
 	while (1) {
-		void (*idle)(void) = pm_idle;
-		if (!idle)
-			idle = default_idle;
-		while (!need_resched())
+		while (!need_resched()) {
+			void (*idle)(void) = pm_idle;
+
+			if (!idle)
+				idle = default_idle;
+
 			idle();
+		}
 		schedule();
 	}
+
 }
 
 void hard_reset_now (void);
diff -Nru a/arch/cris/kernel/setup.c b/arch/cris/kernel/setup.c
--- a/arch/cris/kernel/setup.c	2004-06-02 23:27:00 -07:00
+++ b/arch/cris/kernel/setup.c	2004-06-02 23:27:00 -07:00
@@ -1,4 +1,4 @@
-/* $Id: setup.c,v 1.7 2003/07/04 08:27:52 starvik Exp $
+/*
  *
  *  linux/arch/cris/kernel/setup.c
  *
@@ -10,6 +10,7 @@
  * This file handles the architecture-dependent parts of initialization
  */
 
+#include <linux/config.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/bootmem.h>
@@ -38,6 +39,8 @@
 
 extern unsigned long romfs_start, romfs_length, romfs_in_flash; /* from head.S */
 
+extern void show_etrax_copyright(void);		/* arch-vX/kernel/setup.c */
+
 /* This mainly sets up the memory area, and can be really confusing.
  *
  * The physical DRAM is virtually mapped into dram_start to dram_end
@@ -153,18 +156,16 @@
 	*cmdline_p = command_line;
 
 #ifdef CONFIG_ETRAX_CMDLINE
-	strlcpy(command_line, CONFIG_ETRAX_CMDLINE, sizeof(command_line));
-#elif defined(CONFIG_ETRAX_ROOT_DEVICE)
-	strlcpy(command_line, "root=", sizeof(command_line));
-	strlcat(command_line, CONFIG_ETRAX_ROOT_DEVICE,
-		sizeof(command_line));
-#endif
+	strlcpy(command_line, CONFIG_ETRAX_CMDLINE, COMMAND_LINE_SIZE);
 	command_line[COMMAND_LINE_SIZE - 1] = '\0';
 
-	/* give credit for the CRIS port */
-
-	printk("Linux/CRIS port on ETRAX 100LX (c) 2001 Axis Communications AB\n");
+	/* Save command line for future references. */
+	memcpy(saved_command_line, command_line, COMMAND_LINE_SIZE);
+	saved_command_line[COMMAND_LINE_SIZE - 1] = '\0';
+#endif
 
+	/* give credit for the CRIS port */
+	show_etrax_copyright();
 }
 
 static void *c_start(struct seq_file *m, loff_t *pos)
diff -Nru a/arch/cris/kernel/sys_cris.c b/arch/cris/kernel/sys_cris.c
--- a/arch/cris/kernel/sys_cris.c	2004-06-02 23:26:58 -07:00
+++ b/arch/cris/kernel/sys_cris.c	2004-06-02 23:26:58 -07:00
@@ -1,4 +1,4 @@
-/* $Id: sys_cris.c,v 1.5 2003/07/04 08:27:52 starvik Exp $
+/* $Id: sys_cris.c,v 1.6 2004/03/11 11:38:40 starvik Exp $
  *
  * linux/arch/cris/kernel/sys_cris.c
  *
diff -Nru a/arch/cris/kernel/time.c b/arch/cris/kernel/time.c
--- a/arch/cris/kernel/time.c	2004-06-02 23:26:59 -07:00
+++ b/arch/cris/kernel/time.c	2004-06-02 23:26:59 -07:00
@@ -1,4 +1,4 @@
-/* $Id: time.c,v 1.9 2003/07/04 08:27:52 starvik Exp $
+/* $Id: time.c,v 1.14 2004/06/01 05:38:11 starvik Exp $
  *
  *  linux/arch/cris/kernel/time.c
  *
@@ -29,6 +29,7 @@
 #include <linux/jiffies.h>
 #include <linux/bcd.h>
 #include <linux/timex.h>
+#include <linux/init.h>
 
 u64 jiffies_64 = INITIAL_JIFFIES;
 
@@ -39,6 +40,8 @@
 #define TICK_SIZE tick
 
 extern unsigned long wall_jiffies;
+extern unsigned long loops_per_jiffy; /* init/main.c */
+unsigned long loops_per_usec;
 
 extern unsigned long do_slow_gettimeoffset(void);
 static unsigned long (*do_gettimeoffset)(void) = do_slow_gettimeoffset;
@@ -62,6 +65,15 @@
 		if (lost)
 			usec += lost * (1000000 / HZ);
 	}
+
+        /*
+	 * If time_adjust is negative then NTP is slowing the clock
+	 * so make sure not to go into next possible interval.
+	 * Better to lose some accuracy than have time go backwards..
+	 */
+	if (unlikely(time_adjust < 0) && usec > tickadj)
+		usec = tickadj;
+
 	sec = xtime.tv_sec;
 	usec += xtime.tv_nsec / 1000;
 	local_irq_restore(flags);
@@ -79,35 +91,33 @@
 
 int do_settimeofday(struct timespec *tv)
 {
-	unsigned long flags;
+	time_t wtm_sec, sec = tv->tv_sec;
+	long wtm_nsec, nsec = tv->tv_nsec;
 
-        if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
+	if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
 		return -EINVAL;
 
-	local_irq_save(flags);
-	local_irq_disable();
-
-	/* This is revolting. We need to set the xtime.tv_usec
-	 * correctly. However, the value in this location is
-	 * is value at the last tick.
-	 * Discover what correction gettimeofday
-	 * would have done, and then undo it!
+	write_seqlock_irq(&xtime_lock);
+	/*
+	 * This is revolting. We need to set "xtime" correctly. However, the
+	 * value in this location is the value at the most recent update of
+	 * wall time.  Discover what correction gettimeofday() would have
+	 * made, and then undo it!
 	 */
-	tv->tv_nsec -= do_gettimeoffset() * 1000;
-        tv->tv_nsec -= (jiffies - wall_jiffies) * TICK_NSEC;
+	nsec -= do_gettimeoffset() * NSEC_PER_USEC;
+	nsec -= (jiffies - wall_jiffies) * TICK_NSEC;
+
+	wtm_sec  = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
+	wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);
+
+	set_normalized_timespec(&xtime, sec, nsec);
+	set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec);
 
-	while (tv->tv_nsec < 0) {
-		tv->tv_nsec += NSEC_PER_SEC;
-		tv->tv_sec--;
-	}
-	xtime.tv_sec = tv->tv_sec;
-	xtime.tv_nsec = tv->tv_nsec;
 	time_adjust = 0;		/* stop active adjtime() */
 	time_status |= STA_UNSYNC;
-	time_state = TIME_ERROR;	/* p. 24, (a) */
 	time_maxerror = NTP_PHASE_LIMIT;
 	time_esterror = NTP_PHASE_LIMIT;
-	local_irq_restore(flags);
+	write_sequnlock_irq(&xtime_lock);
 	clock_was_set();
 	return 0;
 }
@@ -125,7 +135,7 @@
 	int retval = 0;
 	int real_seconds, real_minutes, cmos_minutes;
 
-	printk("set_rtc_mmss(%lu)\n", nowtime);
+	printk(KERN_DEBUG "set_rtc_mmss(%lu)\n", nowtime);
 
 	if(!have_rtc)
 		return 0;
@@ -174,7 +184,8 @@
 	mon = CMOS_READ(RTC_MONTH);
 	year = CMOS_READ(RTC_YEAR);
 
-	printk("rtc: sec 0x%x min 0x%x hour 0x%x day 0x%x mon 0x%x year 0x%x\n", 
+	printk(KERN_DEBUG
+	       "rtc: sec 0x%x min 0x%x hour 0x%x day 0x%x mon 0x%x year 0x%x\n",
 	       sec, min, hour, day, mon, year);
 
 	BCD_TO_BIN(sec);
@@ -202,3 +213,20 @@
 		xtime.tv_nsec = 0;
 	}
 }
+
+/*
+ * Scheduler clock - returns current time in nanosec units.
+ */
+unsigned long long sched_clock(void)
+{
+	return (unsigned long long)jiffies * (1000000000 / HZ);
+}
+
+static int
+__init init_udelay(void)
+{
+	loops_per_usec = (loops_per_jiffy * HZ) / 1000000;
+	return 0;
+}
+
+__initcall(init_udelay);
diff -Nru a/arch/cris/kernel/traps.c b/arch/cris/kernel/traps.c
--- a/arch/cris/kernel/traps.c	2004-06-02 23:27:00 -07:00
+++ b/arch/cris/kernel/traps.c	2004-06-02 23:27:00 -07:00
@@ -1,4 +1,4 @@
-/* $Id: traps.c,v 1.7 2003/07/04 08:27:52 starvik Exp $
+/* $Id: traps.c,v 1.9 2004/05/11 12:28:26 starvik Exp $
  *
  *  linux/arch/cris/traps.c
  *
@@ -14,6 +14,7 @@
  */
 
 #include <linux/init.h>
+#include <linux/module.h>
 #include <asm/pgtable.h>
 #include <asm/uaccess.h>
 
diff -Nru a/arch/cris/mm/fault.c b/arch/cris/mm/fault.c
--- a/arch/cris/mm/fault.c	2004-06-02 23:27:00 -07:00
+++ b/arch/cris/mm/fault.c	2004-06-02 23:27:00 -07:00
@@ -6,9 +6,18 @@
  *  Authors:  Bjorn Wesen 
  * 
  *  $Log: fault.c,v $
+ *  Revision 1.11  2004/05/14 07:58:05  starvik
+ *  Merge of changes from 2.4
+ *
+ *  Revision 1.10  2003/10/27 14:51:24  starvik
+ *  Removed debugcode
+ *
+ *  Revision 1.9  2003/10/27 14:50:42  starvik
+ *  Changed do_page_fault signature
+ *
  *  Revision 1.8  2003/07/04 13:02:48  tobiasa
  *  Moved code snippet from arch/cris/mm/fault.c that searches for fixup code
- *  to separate function in arch-specific files.
+ *  to seperate function in arch-specific files.
  *
  *  Revision 1.7  2003/01/22 06:48:38  starvik
  *  Fixed warnings issued by GCC 3.2.1
@@ -95,10 +104,6 @@
 extern int find_fixup_code(struct pt_regs *);
 extern void die_if_kernel(const char *, struct pt_regs *, long);
 
-asmlinkage void do_invalid_op (struct pt_regs *, unsigned long);
-asmlinkage void do_page_fault(unsigned long address, struct pt_regs *regs,
-			      int error_code);
-
 /* debug of low-level TLB reload */
 #undef DEBUG
 
@@ -134,14 +139,16 @@
 
 asmlinkage void
 do_page_fault(unsigned long address, struct pt_regs *regs,
-	      int error_code)
+	      int protection, int writeaccess)
 {
 	struct task_struct *tsk;
 	struct mm_struct *mm;
 	struct vm_area_struct * vma;
-	int writeaccess;
 	siginfo_t info;
 
+        D(printk("Page fault for %X at %X, prot %d write %d\n",
+                 address, regs->erp, protection, writeaccess));
+
 	tsk = current;
 
 	/*
@@ -164,7 +171,7 @@
 	 */
 
 	if (address >= VMALLOC_START &&
-	    !(error_code & 1) &&
+	    !protection &&
 	    !user_mode(regs))
 		goto vmalloc_fault;
 
@@ -172,7 +179,6 @@
 	sti();
 
 	mm = tsk->mm;
-	writeaccess = error_code & 2;
 	info.si_code = SEGV_MAPERR;
 
 	/*
@@ -291,7 +297,7 @@
 		printk(KERN_ALERT "Unable to handle kernel access");
 	printk(" at virtual address %08lx\n",address);
 
-	die_if_kernel("Oops", regs, error_code);
+	die_if_kernel("Oops", regs, (writeaccess << 1) | protection);
 
 	do_exit(SIGKILL);
 
diff -Nru a/arch/cris/mm/init.c b/arch/cris/mm/init.c
--- a/arch/cris/mm/init.c	2004-06-02 23:26:59 -07:00
+++ b/arch/cris/mm/init.c	2004-06-02 23:26:59 -07:00
@@ -7,6 +7,13 @@
  *  Authors:  Bjorn Wesen (bjornw@axis.com)
  *
  *  $Log: init.c,v $
+ *  Revision 1.11  2004/05/28 09:28:56  starvik
+ *  Calculation of loops_per_usec moved because initalization order has changed
+ *  in Linux 2.6.
+ *
+ *  Revision 1.10  2004/05/14 07:58:05  starvik
+ *  Merge of changes from 2.4
+ *
  *  Revision 1.9  2003/07/04 08:27:54  starvik
  *  Merge of Linux 2.5.74
  *
@@ -120,9 +127,6 @@
 
 unsigned long empty_zero_page;
 
-extern unsigned long loops_per_jiffy; /* init/main.c */
-unsigned long loops_per_usec;
-
 extern char _stext, _edata, _etext; /* From linkerscript */
 extern char __init_begin, __init_end;
 
@@ -190,7 +194,8 @@
         datasize =  (unsigned long) &_edata - (unsigned long) &_etext;
         initsize =  (unsigned long) &__init_end - (unsigned long) &__init_begin;
 	
-        printk("Memory: %luk/%luk available (%dk kernel code, %dk reserved, %dk data, "
+        printk(KERN_INFO
+               "Memory: %luk/%luk available (%dk kernel code, %dk reserved, %dk data, "
 	       "%dk init)\n" ,
 	       (unsigned long) nr_free_pages() << (PAGE_SHIFT-10),
 	       max_mapnr << (PAGE_SHIFT-10),
@@ -199,16 +204,6 @@
 	       datasize >> 10,
 	       initsize >> 10
                );
-
-	/* HACK alert - calculate a loops_per_usec for asm/delay.h here
-	 * since this is called just after calibrate_delay in init/main.c
-	 * but before places which use udelay. cannot be in time.c since
-	 * that is called _before_ calibrate_delay
-	 */
-
-	loops_per_usec = (loops_per_jiffy * HZ) / 1000000;
-
-	return;
 }
 
 /* free the pages occupied by initialization code */
@@ -225,6 +220,6 @@
                 free_page(addr);
                 totalram_pages++;
         }
-        printk ("Freeing unused kernel memory: %luk freed\n", 
+        printk (KERN_INFO "Freeing unused kernel memory: %luk freed\n",
 		(unsigned long)((&__init_end - &__init_begin) >> 10));
 }
diff -Nru a/arch/cris/mm/ioremap.c b/arch/cris/mm/ioremap.c
--- a/arch/cris/mm/ioremap.c	2004-06-02 23:26:58 -07:00
+++ b/arch/cris/mm/ioremap.c	2004-06-02 23:26:58 -07:00
@@ -118,31 +118,6 @@
 	if (!size || last_addr < phys_addr)
 		return NULL;
 
-#if 0
-	/* TODO: Here we can put checks for driver-writer abuse...  */
-
-	/*
-	 * Don't remap the low PCI/ISA area, it's always mapped..
-	 */
-	if (phys_addr >= 0xA0000 && last_addr < 0x100000)
-		return phys_to_virt(phys_addr);
-
-	/*
-	 * Don't allow anybody to remap normal RAM that we're using..
-	 */
-	if (phys_addr < virt_to_phys(high_memory)) {
-		char *t_addr, *t_end;
-		struct page *page;
-
-		t_addr = __va(phys_addr);
-		t_end = t_addr + (size - 1);
-	   
-		for(page = virt_to_page(t_addr); page <= virt_to_page(t_end); page++)
-			if(!PageReserved(page))
-				return NULL;
-	}
-#endif
-
 	/*
 	 * Mappings have to be page-aligned
 	 */
diff -Nru a/arch/i386/Makefile b/arch/i386/Makefile
--- a/arch/i386/Makefile	2004-06-02 23:26:59 -07:00
+++ b/arch/i386/Makefile	2004-06-02 23:26:59 -07:00
@@ -18,6 +18,7 @@
 LDFLAGS		:= -m elf_i386
 OBJCOPYFLAGS	:= -O binary -R .note -R .comment -S
 LDFLAGS_vmlinux :=
+CHECK		:= $(CHECK) -D__i386__=1
 
 CFLAGS += -pipe -msoft-float
 
diff -Nru a/arch/i386/kernel/acpi/wakeup.S b/arch/i386/kernel/acpi/wakeup.S
--- a/arch/i386/kernel/acpi/wakeup.S	2004-06-02 23:26:58 -07:00
+++ b/arch/i386/kernel/acpi/wakeup.S	2004-06-02 23:26:58 -07:00
@@ -270,6 +270,7 @@
 	call	save_registers
 	pushl	$3
 	call	acpi_enter_sleep_state
+	addl	$4,%esp
 	ret
 	.p2align 4,,7
 ret_point:
diff -Nru a/arch/i386/kernel/cpu/cpufreq/gx-suspmod.c b/arch/i386/kernel/cpu/cpufreq/gx-suspmod.c
--- a/arch/i386/kernel/cpu/cpufreq/gx-suspmod.c	2004-06-02 23:26:59 -07:00
+++ b/arch/i386/kernel/cpu/cpufreq/gx-suspmod.c	2004-06-02 23:26:59 -07:00
@@ -75,7 +75,6 @@
 
 #include <linux/kernel.h>
 #include <linux/module.h> 
-#include <linux/sched.h>
 #include <linux/init.h>
 #include <linux/smp.h>
 #include <linux/cpufreq.h>
diff -Nru a/arch/i386/kernel/cpu/cpufreq/longhaul.c b/arch/i386/kernel/cpu/cpufreq/longhaul.c
--- a/arch/i386/kernel/cpu/cpufreq/longhaul.c	2004-06-02 23:26:58 -07:00
+++ b/arch/i386/kernel/cpu/cpufreq/longhaul.c	2004-06-02 23:26:58 -07:00
@@ -18,7 +18,8 @@
  */
 
 #include <linux/kernel.h>
-#include <linux/module.h> 
+#include <linux/module.h>
+#include <linux/moduleparam.h>
 #include <linux/init.h>
 #include <linux/cpufreq.h>
 #include <linux/slab.h>
@@ -30,25 +31,25 @@
 
 #include "longhaul.h"
 
-#define DEBUG
-
-#ifdef DEBUG
-#define dprintk(msg...) printk(msg)
-#else
-#define dprintk(msg...) do { } while(0)
-#endif
-
 #define PFX "longhaul: "
 
 static unsigned int numscales=16, numvscales;
+static unsigned int fsb;
 static int minvid, maxvid;
 static int can_scale_voltage;
 static int vrmrev;
 
-
 /* Module parameters */
 static int dont_scale_voltage;
-static unsigned int fsb;
+static int debug;
+static int debug;
+
+static void dprintk(const char *msg, ...)
+{
+	if (debug == 1)
+		printk(msg);
+}
+
 
 #define __hlt()     __asm__ __volatile__("hlt": : :"memory")
 
@@ -118,8 +119,7 @@
 
 	cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
 
-	dprintk (KERN_INFO PFX "FSB:%d Mult:%d.%dx\n", fsb,
-				mult/10, mult%10);
+	dprintk (KERN_INFO PFX "FSB:%d Mult:%d.%dx\n", fsb, mult/10, mult%10);
 
 	switch (longhaul_version) {
 	case 1:
@@ -167,16 +167,16 @@
 		longhaul.bits.SoftBusRatio = clock_ratio_index & 0xf;
 		longhaul.bits.SoftBusRatio4 = (clock_ratio_index & 0x10) >> 4;
 		longhaul.bits.EnableSoftBusRatio = 1;
-		
+
 		longhaul.bits.RevisionKey = 0x0;
-		
+
 		wrmsrl(MSR_VIA_LONGHAUL, longhaul.val);
 		__hlt();
-		
+
 		rdmsrl (MSR_VIA_LONGHAUL, longhaul.val);
 		longhaul.bits.EnableSoftBusRatio = 0;
 		longhaul.bits.RevisionKey = 0xf;
-		wrmsrl (MSR_VIA_LONGHAUL, longhaul.val);		
+		wrmsrl (MSR_VIA_LONGHAUL, longhaul.val);
 		break;
 	}
 
@@ -276,26 +276,26 @@
 				break;
 		}
 		break;
-		
+
 	case 4:
 		rdmsrl (MSR_VIA_LONGHAUL, longhaul.val);
-		
+
 		//TODO: Nehemiah may have borken MaxMHzBR.
 		// need to extrapolate from FSB.
-		
+
 		invalue2 = longhaul.bits.MinMHzBR;
 		invalue = longhaul.bits.MaxMHzBR;
-		if (longhaul.bits.MaxMHzBR4) 
+		if (longhaul.bits.MaxMHzBR4)
 			invalue += 16;
 		maxmult=multipliers[invalue];
-		
+
 		maxmult=longhaul_get_cpu_mult();
-		
+
 		printk(KERN_INFO PFX " invalue: %ld  maxmult: %d \n", invalue, maxmult);
 		printk(KERN_INFO PFX " invalue2: %ld \n", invalue2);
-		
+
 		minmult=50;
-		
+
 		switch (longhaul.bits.MaxMHzFSB) {
 		case 0x0:	fsb=133;
 				break;
@@ -306,8 +306,8 @@
 		case 0x3:	fsb=66;
 				break;
 		}
-		
-		break;	
+
+		break;
 	}
 
 	dprintk (KERN_INFO PFX "MinMult=%d.%dx MaxMult=%d.%dx\n",
@@ -418,13 +418,13 @@
 			    unsigned int relation)
 {
 	unsigned int table_index = 0;
- 	unsigned int new_clock_ratio = 0;
+	unsigned int new_clock_ratio = 0;
 
 	if (cpufreq_frequency_table_target(policy, longhaul_table, target_freq, relation, &table_index))
 		return -EINVAL;
 
 	new_clock_ratio = longhaul_table[table_index].index & 0xFF;
- 
+
 	longhaul_setstate(new_clock_ratio);
 
 	return 0;
@@ -500,7 +500,6 @@
 			break;
 		}
 		break;
-		
 
 	default:
 		cpuname = "Unknown";
@@ -514,11 +513,11 @@
 	if (ret != 0)
 		return ret;
 
- 	if ((longhaul_version==2) && (dont_scale_voltage==0))
+	if ((longhaul_version==2) && (dont_scale_voltage==0))
 		longhaul_setup_voltagescaling();
 
 	policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
- 	policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
+	policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
 	policy->cur = calc_speed (longhaul_get_cpu_mult(), fsb);
 
 	ret = cpufreq_frequency_table_cpuinfo(policy, longhaul_table);
@@ -530,7 +529,7 @@
 	return 0;
 }
 
-static int __exit longhaul_cpu_exit(struct cpufreq_policy *policy)
+static int __devexit longhaul_cpu_exit(struct cpufreq_policy *policy)
 {
 	cpufreq_frequency_table_put_attr(policy->cpu);
 	return 0;
@@ -542,14 +541,14 @@
 };
 
 static struct cpufreq_driver longhaul_driver = {
-	.verify 	= longhaul_verify,
-	.target 	= longhaul_target,
-	.get 		= longhaul_get,
-	.init		= longhaul_cpu_init,
-	.exit		= longhaul_cpu_exit,
-	.name		= "longhaul",
-	.owner		= THIS_MODULE,
-	.attr		= longhaul_attr,
+	.verify	= longhaul_verify,
+	.target	= longhaul_target,
+	.get	= longhaul_get,
+	.init	= longhaul_cpu_init,
+	.exit	= __devexit_p(longhaul_cpu_exit),
+	.name	= "longhaul",
+	.owner	= THIS_MODULE,
+	.attr	= longhaul_attr,
 };
 
 static int __init longhaul_init (void)
@@ -560,12 +559,8 @@
 		return -ENODEV;
 
 	switch (c->x86_model) {
-	case 6 ... 8:
+	case 6 ... 9:
 		return cpufreq_register_driver(&longhaul_driver);
-	case 9:
-		printk (KERN_INFO PFX "Nehemiah unsupported: Waiting on working silicon "
-						"from VIA before this is usable.\n");
-		break;
 	default:
 		printk (KERN_INFO PFX "Unknown VIA CPU. Contact davej@codemonkey.org.uk\n");
 	}
@@ -579,7 +574,11 @@
 	kfree(longhaul_table);
 }
 
-MODULE_PARM (dont_scale_voltage, "i");
+module_param (dont_scale_voltage, int, 0644);
+MODULE_PARM_DESC(dont_scale_voltage, "Don't scale voltage of processor");
+
+module_param (debug, int, 0644);
+MODULE_PARM_DESC(debug, "Dump debugging information.");
 
 MODULE_AUTHOR ("Dave Jones <davej@codemonkey.org.uk>");
 MODULE_DESCRIPTION ("Longhaul driver for VIA Cyrix processors.");
diff -Nru a/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c b/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c
--- a/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c	2004-06-02 23:27:00 -07:00
+++ b/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c	2004-06-02 23:27:00 -07:00
@@ -27,7 +27,6 @@
 #include <linux/smp.h>
 #include <linux/cpufreq.h>
 #include <linux/slab.h>
-#include <linux/sched.h>
 
 #include <asm/processor.h> 
 #include <asm/msr.h>
@@ -35,7 +34,7 @@
 
 #include "speedstep-lib.h"
 
-#define PFX	"cpufreq: "
+#define PFX	"p4-clockmod: "
 
 /*
  * Duty Cycle (3bits), note DC_DISABLE is not specified in
diff -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-06-02 23:26:58 -07:00
+++ b/arch/i386/kernel/cpu/cpufreq/powernow-k7.c	2004-06-02 23:26:58 -07:00
@@ -16,7 +16,7 @@
 
 #include <linux/config.h>
 #include <linux/kernel.h>
-#include <linux/module.h> 
+#include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/init.h>
 #include <linux/cpufreq.h>
@@ -86,7 +86,7 @@
 /* divide by 10 to get FID. */
 static int fid_codes[32] = {
     110, 115, 120, 125, 50, 55, 60, 65,
-    70, 75, 80, 85, 90, 95, 100, 105, 
+    70, 75, 80, 85, 90, 95, 100, 105,
     30, 190, 40, 200, 130, 135, 140, 210,
     150, 225, 160, 165, 170, 180, -1, -1,
 };
@@ -95,7 +95,7 @@
  * configuration purpose.
  */
 
-static int powernow_acpi_force;
+static int acpi_force;
 
 static struct cpufreq_frequency_table *powernow_table;
 
@@ -144,6 +144,11 @@
 	}
 
 	cpuid(0x80000007, &eax, &ebx, &ecx, &edx);
+
+	/* Check we can actually do something before we say anything.*/
+	if (!(edx & (1 << 1 | 1 << 2)))
+		return 0;
+
 	printk (KERN_INFO PFX "PowerNOW! Technology present. Can scale: ");
 
 	if (edx & 1 << 1) {
@@ -159,11 +164,6 @@
 		can_scale_vid=1;
 	}
 
-	if (!(edx & (1 << 1 | 1 << 2))) {
-		printk ("nothing.\n");
-		return 0;
-	}
-
 	printk (".\n");
 	return 1;
 }
@@ -572,7 +572,7 @@
 	}
 	dprintk(KERN_INFO PFX "FSB: %3d.%03d MHz\n", fsb/1000, fsb%1000);
 
-	if ((dmi_broken & BROKEN_CPUFREQ) || powernow_acpi_force) {
+	if ((dmi_broken & BROKEN_CPUFREQ) || acpi_force) {
 		printk (KERN_INFO PFX "PSB/PST known to be broken.  Trying ACPI instead\n");
 		result = powernow_acpi_init();
 	} else {
@@ -653,8 +653,7 @@
 		kfree(powernow_table);
 }
 
-module_param(powernow_acpi_force,  int, 0444);
-
+module_param(acpi_force,  int, 0444);
 MODULE_PARM_DESC(acpi_force, "Force ACPI to be used");
 
 MODULE_AUTHOR ("Dave Jones <davej@codemonkey.org.uk>");
diff -Nru a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c
--- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c	2004-06-02 23:26:59 -07:00
+++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c	2004-06-02 23:26:59 -07:00
@@ -553,7 +553,7 @@
 		printk(KERN_ERR PFX "no p states to transition\n");
 		return -ENODEV;
 	}
-                                                                                                    
+
 	if (check_pst_table(data, pst, maxvid))
 		return -EINVAL;
 
@@ -736,9 +736,9 @@
 		/* verify only 1 entry from the lo frequency table */
 		if ((fid < HI_FID_TABLE_BOTTOM) && (cntlofreq++)) {
 			printk(KERN_ERR PFX "Too many lo freq table entries\n");
-			goto err_out;
+			goto err_out_mem;
 		}
-                                                                                                            
+
 		if (powernow_table[i].frequency != (data->acpi_data.states[i].core_frequency * 1000)) {
 			printk(KERN_INFO PFX "invalid freq entries %u kHz vs. %u kHz\n",
 				powernow_table[i].frequency,
@@ -757,12 +757,16 @@
 	print_basics(data);
 	powernow_k8_acpi_pst_values(data, 0);
 	return 0;
+
+err_out_mem:
+	kfree(powernow_table);
+
 err_out:
 	acpi_processor_unregister_performance(&data->acpi_data, data->cpu);
 
 	/* data->acpi_data.state_count informs us at ->exit() whether ACPI was used */
 	data->acpi_data.state_count = 0;
-                                                                                                            
+
 	return -ENODEV;
 }
 
@@ -945,7 +949,7 @@
 		if ((num_online_cpus() != 1) || (num_possible_cpus() != 1)) {
 			printk(KERN_INFO PFX "MP systems not supported by PSB BIOS structure\n");
 			kfree(data);
-			return 0;
+			return -ENODEV;
 		}
 		rc = find_psb_table(data);
 		if (rc) {
@@ -1047,7 +1051,7 @@
 	if (query_current_values_with_pending_wait(data))
 		goto out;
 
-	khz = find_khz_freq_from_fid(data->currfid);	
+	khz = find_khz_freq_from_fid(data->currfid);
 
  out:
 	preempt_enable_no_resched();
diff -Nru a/arch/i386/kernel/i387.c b/arch/i386/kernel/i387.c
--- a/arch/i386/kernel/i387.c	2004-06-02 23:27:00 -07:00
+++ b/arch/i386/kernel/i387.c	2004-06-02 23:27:00 -07:00
@@ -246,7 +246,7 @@
 	to = &buf->_st[0];
 	from = (struct _fpxreg *) &fxsave->st_space[0];
 	for ( i = 0 ; i < 8 ; i++, to++, from++ ) {
-		unsigned long *t = (unsigned long *)to;
+		unsigned long __user *t = (unsigned long __user *)to;
 		unsigned long *f = (unsigned long *)from;
 
 		if (__put_user(*f, t) ||
@@ -281,7 +281,7 @@
 	from = &buf->_st[0];
 	for ( i = 0 ; i < 8 ; i++, to++, from++ ) {
 		unsigned long *t = (unsigned long *)to;
-		unsigned long *f = (unsigned long *)from;
+		unsigned long __user *f = (unsigned long __user *)from;
 
 		if (__get_user(*t, f) ||
 				__get_user(*(t + 1), f + 1) ||
diff -Nru a/arch/i386/kernel/microcode.c b/arch/i386/kernel/microcode.c
--- a/arch/i386/kernel/microcode.c	2004-06-02 23:26:58 -07:00
+++ b/arch/i386/kernel/microcode.c	2004-06-02 23:26:58 -07:00
@@ -113,7 +113,7 @@
 /* no concurrent ->write()s are allowed on /dev/cpu/microcode */
 static DECLARE_MUTEX(microcode_sem);
 
-static void *user_buffer;		/* user area microcode data buffer */
+static void __user *user_buffer;	/* user area microcode data buffer */
 static unsigned int user_buffer_size;	/* it's size */
 
 typedef enum mc_error_code {
@@ -425,7 +425,7 @@
 	return error;
 }
 
-static ssize_t microcode_write (struct file *file, const char *buf, size_t len, loff_t *ppos)
+static ssize_t microcode_write (struct file *file, const char __user *buf, size_t len, loff_t *ppos)
 {
 	ssize_t ret;
 
@@ -441,7 +441,7 @@
 
 	down(&microcode_sem);
 
-	user_buffer = (void *) buf;
+	user_buffer = (void __user *) buf;
 	user_buffer_size = (int) len;
 
 	ret = do_microcode_update();
diff -Nru a/arch/i386/kernel/msr.c b/arch/i386/kernel/msr.c
--- a/arch/i386/kernel/msr.c	2004-06-02 23:26:59 -07:00
+++ b/arch/i386/kernel/msr.c	2004-06-02 23:26:59 -07:00
@@ -184,7 +184,7 @@
 static ssize_t msr_read(struct file *file, char __user * buf,
 			size_t count, loff_t * ppos)
 {
-	u32 *tmp = (u32 *) buf;
+	u32 __user *tmp = (u32 __user *) buf;
 	u32 data[2];
 	size_t rv;
 	u32 reg = *ppos;
@@ -203,13 +203,13 @@
 		tmp += 2;
 	}
 
-	return ((char *)tmp) - buf;
+	return ((char __user *)tmp) - buf;
 }
 
 static ssize_t msr_write(struct file *file, const char __user *buf,
 			 size_t count, loff_t *ppos)
 {
-	const u32 *tmp = (const u32 *)buf;
+	const u32 __user *tmp = (const u32 __user *)buf;
 	u32 data[2];
 	size_t rv;
 	u32 reg = *ppos;
@@ -228,7 +228,7 @@
 		tmp += 2;
 	}
 
-	return ((char *)tmp) - buf;
+	return ((char __user *)tmp) - buf;
 }
 
 static int msr_open(struct inode *inode, struct file *file)
diff -Nru a/arch/i386/kernel/ptrace.c b/arch/i386/kernel/ptrace.c
--- a/arch/i386/kernel/ptrace.c	2004-06-02 23:26:59 -07:00
+++ b/arch/i386/kernel/ptrace.c	2004-06-02 23:26:59 -07:00
@@ -235,6 +235,7 @@
 	struct task_struct *child;
 	struct user * dummy = NULL;
 	int i, ret;
+	unsigned long __user *datap = (unsigned long __user *)data;
 
 	lock_kernel();
 	ret = -EPERM;
@@ -283,7 +284,7 @@
 		ret = -EIO;
 		if (copied != sizeof(tmp))
 			break;
-		ret = put_user(tmp,(unsigned long *) data);
+		ret = put_user(tmp, datap);
 		break;
 	}
 
@@ -305,7 +306,7 @@
 			addr = addr >> 2;
 			tmp = child->thread.debugreg[addr];
 		}
-		ret = put_user(tmp,(unsigned long *) data);
+		ret = put_user(tmp, datap);
 		break;
 	}
 
@@ -423,13 +424,13 @@
 		break;
 
 	case PTRACE_GETREGS: { /* Get all gp regs from the child. */
-	  	if (!access_ok(VERIFY_WRITE, (unsigned *)data, FRAME_SIZE*sizeof(long))) {
+	  	if (!access_ok(VERIFY_WRITE, datap, FRAME_SIZE*sizeof(long))) {
 			ret = -EIO;
 			break;
 		}
 		for ( i = 0; i < FRAME_SIZE*sizeof(long); i += sizeof(long) ) {
-			__put_user(getreg(child, i),(unsigned long *) data);
-			data += sizeof(long);
+			__put_user(getreg(child, i), datap);
+			datap++;
 		}
 		ret = 0;
 		break;
@@ -437,21 +438,21 @@
 
 	case PTRACE_SETREGS: { /* Set all gp regs in the child. */
 		unsigned long tmp;
-	  	if (!access_ok(VERIFY_READ, (unsigned *)data, FRAME_SIZE*sizeof(long))) {
+	  	if (!access_ok(VERIFY_READ, datap, FRAME_SIZE*sizeof(long))) {
 			ret = -EIO;
 			break;
 		}
 		for ( i = 0; i < FRAME_SIZE*sizeof(long); i += sizeof(long) ) {
-			__get_user(tmp, (unsigned long *) data);
+			__get_user(tmp, datap);
 			putreg(child, i, tmp);
-			data += sizeof(long);
+			datap++;
 		}
 		ret = 0;
 		break;
 	}
 
 	case PTRACE_GETFPREGS: { /* Get the child FPU state. */
-		if (!access_ok(VERIFY_WRITE, (unsigned *)data,
+		if (!access_ok(VERIFY_WRITE, datap,
 			       sizeof(struct user_i387_struct))) {
 			ret = -EIO;
 			break;
@@ -464,7 +465,7 @@
 	}
 
 	case PTRACE_SETFPREGS: { /* Set the child FPU state. */
-		if (!access_ok(VERIFY_READ, (unsigned *)data,
+		if (!access_ok(VERIFY_READ, datap,
 			       sizeof(struct user_i387_struct))) {
 			ret = -EIO;
 			break;
@@ -476,7 +477,7 @@
 	}
 
 	case PTRACE_GETFPXREGS: { /* Get the child extended FPU state. */
-		if (!access_ok(VERIFY_WRITE, (unsigned *)data,
+		if (!access_ok(VERIFY_WRITE, datap,
 			       sizeof(struct user_fxsr_struct))) {
 			ret = -EIO;
 			break;
@@ -488,7 +489,7 @@
 	}
 
 	case PTRACE_SETFPXREGS: { /* Set the child extended FPU state. */
-		if (!access_ok(VERIFY_READ, (unsigned *)data,
+		if (!access_ok(VERIFY_READ, datap,
 			       sizeof(struct user_fxsr_struct))) {
 			ret = -EIO;
 			break;
@@ -499,13 +500,13 @@
 	}
 
 	case PTRACE_GET_THREAD_AREA:
-		ret = ptrace_get_thread_area(child,
-					     addr, (struct user_desc __user *) data);
+		ret = ptrace_get_thread_area(child, addr,
+					(struct user_desc __user *) data);
 		break;
 
 	case PTRACE_SET_THREAD_AREA:
-		ret = ptrace_set_thread_area(child,
-					     addr, (struct user_desc __user *) data);
+		ret = ptrace_set_thread_area(child, addr,
+					(struct user_desc __user *) data);
 		break;
 
 	default:
diff -Nru a/arch/i386/kernel/scx200.c b/arch/i386/kernel/scx200.c
--- a/arch/i386/kernel/scx200.c	2004-06-02 23:27:00 -07:00
+++ b/arch/i386/kernel/scx200.c	2004-06-02 23:27:00 -07:00
@@ -86,7 +86,10 @@
 
 	if ((bridge = pci_find_device(PCI_VENDOR_ID_NS, 
 				      PCI_DEVICE_ID_NS_SCx200_BRIDGE,
-				      NULL)) == NULL)
+				      NULL)) == NULL
+	    && (bridge = pci_find_device(PCI_VENDOR_ID_NS,
+					 PCI_DEVICE_ID_NS_SC1100_BRIDGE,
+					 NULL)) == NULL)
 		return -ENODEV;
 
 	base = pci_resource_start(bridge, 0);
diff -Nru a/arch/i386/kernel/signal.c b/arch/i386/kernel/signal.c
--- a/arch/i386/kernel/signal.c	2004-06-02 23:26:59 -07:00
+++ b/arch/i386/kernel/signal.c	2004-06-02 23:26:59 -07:00
@@ -269,12 +269,12 @@
 
 	tmp = 0;
 	__asm__("movl %%gs,%0" : "=r"(tmp): "0"(tmp));
-	err |= __put_user(tmp, (unsigned int *)&sc->gs);
+	err |= __put_user(tmp, (unsigned int __user *)&sc->gs);
 	__asm__("movl %%fs,%0" : "=r"(tmp): "0"(tmp));
-	err |= __put_user(tmp, (unsigned int *)&sc->fs);
+	err |= __put_user(tmp, (unsigned int __user *)&sc->fs);
 
-	err |= __put_user(regs->xes, (unsigned int *)&sc->es);
-	err |= __put_user(regs->xds, (unsigned int *)&sc->ds);
+	err |= __put_user(regs->xes, (unsigned int __user *)&sc->es);
+	err |= __put_user(regs->xds, (unsigned int __user *)&sc->ds);
 	err |= __put_user(regs->edi, &sc->edi);
 	err |= __put_user(regs->esi, &sc->esi);
 	err |= __put_user(regs->ebp, &sc->ebp);
@@ -286,10 +286,10 @@
 	err |= __put_user(current->thread.trap_no, &sc->trapno);
 	err |= __put_user(current->thread.error_code, &sc->err);
 	err |= __put_user(regs->eip, &sc->eip);
-	err |= __put_user(regs->xcs, (unsigned int *)&sc->cs);
+	err |= __put_user(regs->xcs, (unsigned int __user *)&sc->cs);
 	err |= __put_user(regs->eflags, &sc->eflags);
 	err |= __put_user(regs->esp, &sc->esp_at_signal);
-	err |= __put_user(regs->xss, (unsigned int *)&sc->ss);
+	err |= __put_user(regs->xss, (unsigned int __user *)&sc->ss);
 
 	tmp = save_i387(fpstate);
 	if (tmp < 0)
@@ -381,9 +381,9 @@
 	 * reasons and because gdb uses it as a signature to notice
 	 * signal handler stack frames.
 	 */
-	err |= __put_user(0xb858, (short *)(frame->retcode+0));
-	err |= __put_user(__NR_sigreturn, (int *)(frame->retcode+2));
-	err |= __put_user(0x80cd, (short *)(frame->retcode+6));
+	err |= __put_user(0xb858, (short __user *)(frame->retcode+0));
+	err |= __put_user(__NR_sigreturn, (int __user *)(frame->retcode+2));
+	err |= __put_user(0x80cd, (short __user *)(frame->retcode+6));
 
 	if (err)
 		goto give_sigsegv;
@@ -462,9 +462,9 @@
 	 * reasons and because gdb uses it as a signature to notice
 	 * signal handler stack frames.
 	 */
-	err |= __put_user(0xb8, (char *)(frame->retcode+0));
-	err |= __put_user(__NR_rt_sigreturn, (int *)(frame->retcode+1));
-	err |= __put_user(0x80cd, (short *)(frame->retcode+5));
+	err |= __put_user(0xb8, (char __user *)(frame->retcode+0));
+	err |= __put_user(__NR_rt_sigreturn, (int __user *)(frame->retcode+1));
+	err |= __put_user(0x80cd, (short __user *)(frame->retcode+5));
 
 	if (err)
 		goto give_sigsegv;
diff -Nru a/arch/i386/mach-default/topology.c b/arch/i386/mach-default/topology.c
--- a/arch/i386/mach-default/topology.c	2004-06-02 23:27:00 -07:00
+++ b/arch/i386/mach-default/topology.c	2004-06-02 23:27:00 -07:00
@@ -41,8 +41,10 @@
 {
 	int i;
 
-	for (i = 0; i < num_online_nodes(); i++)
-		arch_register_node(i);
+	for (i = 0; i < MAX_NUMNODES; i++) {
+		if (node_online(i))
+			arch_register_node(i);
+	}
 	for (i = 0; i < NR_CPUS; i++)
 		if (cpu_possible(i)) arch_register_cpu(i);
 	return 0;
diff -Nru a/arch/ppc64/Makefile b/arch/ppc64/Makefile
--- a/arch/ppc64/Makefile	2004-06-02 23:26:58 -07:00
+++ b/arch/ppc64/Makefile	2004-06-02 23:26:58 -07:00
@@ -20,8 +20,9 @@
 AS              := $(AS) -64
 LD              := $(LD) -m elf64ppc
 CC		:= $(CC) -m64
-CHECK		:= $(CHECK) -m64
 endif
+
+CHECK		:= $(CHECK) -m64 -D__powerpc__=1
 
 LDFLAGS		:= -m elf64ppc
 LDFLAGS_vmlinux	:= -Bstatic -e $(KERNELLOAD) -Ttext $(KERNELLOAD)
diff -Nru a/arch/ppc64/configs/iSeries_defconfig b/arch/ppc64/configs/iSeries_defconfig
--- a/arch/ppc64/configs/iSeries_defconfig	2004-06-02 23:27:00 -07:00
+++ b/arch/ppc64/configs/iSeries_defconfig	2004-06-02 23:27:00 -07:00
@@ -23,19 +23,23 @@
 #
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
+# CONFIG_POSIX_MQUEUE is not set
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
+# CONFIG_AUDIT is not set
 CONFIG_LOG_BUF_SHIFT=17
 CONFIG_HOTPLUG=y
 CONFIG_IKCONFIG=y
 CONFIG_IKCONFIG_PROC=y
-CONFIG_EMBEDDED=y
+# CONFIG_EMBEDDED is not set
 CONFIG_KALLSYMS=y
+# CONFIG_KALLSYMS_ALL is not set
 CONFIG_FUTEX=y
 CONFIG_EPOLL=y
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
@@ -48,6 +52,7 @@
 # CONFIG_MODVERSIONS is not set
 # CONFIG_KMOD is not set
 CONFIG_STOP_MACHINE=y
+CONFIG_SYSVIPC_COMPAT=y
 
 #
 # Platform support
@@ -60,6 +65,7 @@
 # CONFIG_IOMMU_VMERGE is not set
 CONFIG_SMP=y
 CONFIG_NR_CPUS=32
+# CONFIG_SCHED_SMT is not set
 CONFIG_MSCHUNKS=y
 CONFIG_LPARCFG=y
 
@@ -72,6 +78,7 @@
 # CONFIG_BINFMT_MISC is not set
 CONFIG_PCI_LEGACY_PROC=y
 CONFIG_PCI_NAMES=y
+# CONFIG_HOTPLUG_CPU is not set
 
 #
 # PCMCIA/CardBus support
@@ -148,7 +155,6 @@
 # Some SCSI devices (e.g. CD jukebox) support multiple LUNs
 #
 CONFIG_SCSI_MULTI_LUN=y
-CONFIG_SCSI_REPORT_LUNS=y
 CONFIG_SCSI_CONSTANTS=y
 # CONFIG_SCSI_LOGGING is not set
 
@@ -180,6 +186,7 @@
 # CONFIG_SCSI_IPS is not set
 # CONFIG_SCSI_INIA100 is not set
 # CONFIG_SCSI_SYM53C8XX_2 is not set
+# CONFIG_SCSI_IPR is not set
 # CONFIG_SCSI_QLOGIC_ISP is not set
 # CONFIG_SCSI_QLOGIC_FC is not set
 # CONFIG_SCSI_QLOGIC_1280 is not set
@@ -221,6 +228,7 @@
 #
 # I2O device support
 #
+# CONFIG_I2O is not set
 
 #
 # Macintosh device drivers
@@ -247,7 +255,6 @@
 # CONFIG_NET_IPGRE is not set
 # CONFIG_IP_MROUTE is not set
 # CONFIG_ARPD is not set
-CONFIG_INET_ECN=y
 CONFIG_SYN_COOKIES=y
 CONFIG_INET_AH=m
 CONFIG_INET_ESP=m
@@ -258,8 +265,6 @@
 #
 # CONFIG_IP_VS is not set
 # CONFIG_IPV6 is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 CONFIG_NETFILTER=y
 # CONFIG_NETFILTER_DEBUG is not set
 
@@ -319,16 +324,18 @@
 CONFIG_IP_NF_ARP_MANGLE=m
 CONFIG_IP_NF_COMPAT_IPCHAINS=m
 CONFIG_IP_NF_COMPAT_IPFWADM=m
+# CONFIG_IP_NF_RAW is not set
 CONFIG_XFRM=y
 CONFIG_XFRM_USER=m
 
 #
 # SCTP Configuration (EXPERIMENTAL)
 #
-CONFIG_IPV6_SCTP__=y
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
 # CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
 CONFIG_LLC=y
 # CONFIG_LLC2 is not set
 # CONFIG_IPX is not set
@@ -350,16 +357,23 @@
 # Network testing
 #
 # CONFIG_NET_PKTGEN is not set
+CONFIG_NETPOLL=y
+CONFIG_NETPOLL_RX=y
+CONFIG_NETPOLL_TRAP=y
+CONFIG_NET_POLL_CONTROLLER=y
+# CONFIG_HAMRADIO is not set
+# CONFIG_IRDA is not set
+# CONFIG_BT is not set
 CONFIG_NETDEVICES=y
+CONFIG_DUMMY=m
+CONFIG_BONDING=m
+# CONFIG_EQUALIZER is not set
+CONFIG_TUN=m
 
 #
 # ARCnet devices
 #
 # CONFIG_ARCNET is not set
-CONFIG_DUMMY=m
-CONFIG_BONDING=m
-# CONFIG_EQUALIZER is not set
-CONFIG_TUN=m
 
 #
 # Ethernet (10 or 100Mbit)
@@ -397,43 +411,9 @@
 # CONFIG_VIA_RHINE is not set
 
 #
-# Ethernet (1000 Mbit)
+# Gigabit Ethernet (1000/10000 Mbit)
 #
-CONFIG_ACENIC=y
-CONFIG_ACENIC_OMIT_TIGON_I=y
-# CONFIG_DL2K is not set
-CONFIG_E1000=y
-# CONFIG_E1000_NAPI is not set
-# CONFIG_NS83820 is not set
-# CONFIG_HAMACHI is not set
-# CONFIG_YELLOWFIN is not set
-# CONFIG_R8169 is not set
-# CONFIG_SIS190 is not set
-# CONFIG_SK98LIN is not set
-# CONFIG_TIGON3 is not set
-
-#
-# Ethernet (10000 Mbit)
-#
-CONFIG_IXGB=m
-# CONFIG_IXGB_NAPI is not set
-# CONFIG_VETH is not set
-# CONFIG_FDDI is not set
-# CONFIG_HIPPI is not set
-CONFIG_PPP=m
-# CONFIG_PPP_MULTILINK is not set
-# CONFIG_PPP_FILTER is not set
-CONFIG_PPP_ASYNC=m
-CONFIG_PPP_SYNC_TTY=m
-CONFIG_PPP_DEFLATE=m
-CONFIG_PPP_BSDCOMP=m
-CONFIG_PPPOE=m
-# CONFIG_SLIP is not set
-
-#
-# Wireless LAN (non-hamradio)
-#
-# CONFIG_NET_RADIO is not set
+# CONFIG_NET_GIGE is not set
 
 #
 # Token Ring devices
@@ -443,33 +423,31 @@
 # CONFIG_IBMLS is not set
 # CONFIG_3C359 is not set
 # CONFIG_TMS380TR is not set
-# CONFIG_NET_FC is not set
-# CONFIG_SHAPER is not set
-CONFIG_NETCONSOLE=y
-
-#
-# Wan interfaces
-#
-# CONFIG_WAN is not set
-
-#
-# Amateur Radio support
-#
-# CONFIG_HAMRADIO is not set
 
 #
-# IrDA (infrared) support
+# Wireless LAN (non-hamradio)
 #
-# CONFIG_IRDA is not set
+# CONFIG_NET_RADIO is not set
 
 #
-# Bluetooth support
+# Wan interfaces
 #
-# CONFIG_BT is not set
-CONFIG_NETPOLL=y
-CONFIG_NETPOLL_RX=y
-CONFIG_NETPOLL_TRAP=y
-CONFIG_NET_POLL_CONTROLLER=y
+# CONFIG_WAN is not set
+CONFIG_ISERIES_VETH=y
+# CONFIG_FDDI is not set
+# CONFIG_HIPPI is not set
+CONFIG_PPP=m
+# CONFIG_PPP_MULTILINK is not set
+# CONFIG_PPP_FILTER is not set
+CONFIG_PPP_ASYNC=m
+CONFIG_PPP_SYNC_TTY=m
+CONFIG_PPP_DEFLATE=m
+CONFIG_PPP_BSDCOMP=m
+CONFIG_PPPOE=m
+# CONFIG_SLIP is not set
+# CONFIG_NET_FC is not set
+# CONFIG_SHAPER is not set
+CONFIG_NETCONSOLE=y
 
 #
 # ISDN subsystem
@@ -489,7 +467,10 @@
 #
 # Userland interfaces
 #
-# CONFIG_INPUT_MOUSEDEV is not set
+CONFIG_INPUT_MOUSEDEV=y
+CONFIG_INPUT_MOUSEDEV_PSAUX=y
+CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
+CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
 # CONFIG_INPUT_JOYDEV is not set
 # CONFIG_INPUT_TSDEV is not set
 # CONFIG_INPUT_EVDEV is not set
@@ -518,7 +499,6 @@
 #
 # Character devices
 #
-# CONFIG_VT is not set
 # CONFIG_SERIAL_NONSTANDARD is not set
 
 #
@@ -532,11 +512,6 @@
 CONFIG_UNIX98_PTYS=y
 CONFIG_LEGACY_PTYS=y
 CONFIG_LEGACY_PTY_COUNT=256
-
-#
-# Mice
-#
-# CONFIG_BUSMOUSE is not set
 # CONFIG_QIC02_TAPE is not set
 
 #
@@ -618,6 +593,7 @@
 CONFIG_REISERFS_FS=y
 # CONFIG_REISERFS_CHECK is not set
 # CONFIG_REISERFS_PROC_INFO is not set
+# CONFIG_REISERFS_FS_XATTR is not set
 CONFIG_JFS_FS=y
 CONFIG_JFS_POSIX_ACL=y
 # CONFIG_JFS_DEBUG is not set
@@ -655,6 +631,7 @@
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
 CONFIG_DEVPTS_FS_XATTR=y
 # CONFIG_DEVPTS_FS_SECURITY is not set
@@ -695,10 +672,11 @@
 CONFIG_LOCKD_V4=y
 CONFIG_EXPORTFS=y
 CONFIG_SUNRPC=y
-CONFIG_SUNRPC_GSS=m
-CONFIG_RPCSEC_GSS_KRB5=m
+CONFIG_SUNRPC_GSS=y
+CONFIG_RPCSEC_GSS_KRB5=y
 # CONFIG_SMB_FS is not set
 CONFIG_CIFS=m
+# CONFIG_CIFS_STATS is not set
 # CONFIG_NCP_FS is not set
 # CONFIG_CODA_FS is not set
 # CONFIG_AFS_FS is not set
@@ -757,8 +735,8 @@
 #
 CONFIG_VIOCONS=y
 CONFIG_VIODASD=y
-CONFIG_VIOCD=y
-# CONFIG_VIOTAPE is not set
+CONFIG_VIOCD=m
+CONFIG_VIOTAPE=m
 CONFIG_VIOPATH=y
 
 #
@@ -778,6 +756,7 @@
 # CONFIG_DEBUGGER is not set
 # CONFIG_PPCDBG is not set
 # CONFIG_DEBUG_INFO is not set
+# CONFIG_IRQSTACKS is not set
 
 #
 # Security options
@@ -791,11 +770,11 @@
 CONFIG_CRYPTO_HMAC=y
 CONFIG_CRYPTO_NULL=m
 CONFIG_CRYPTO_MD4=m
-CONFIG_CRYPTO_MD5=m
+CONFIG_CRYPTO_MD5=y
 CONFIG_CRYPTO_SHA1=m
 CONFIG_CRYPTO_SHA256=m
 CONFIG_CRYPTO_SHA512=m
-CONFIG_CRYPTO_DES=m
+CONFIG_CRYPTO_DES=y
 CONFIG_CRYPTO_BLOWFISH=m
 CONFIG_CRYPTO_TWOFISH=m
 CONFIG_CRYPTO_SERPENT=m
@@ -804,11 +783,14 @@
 CONFIG_CRYPTO_CAST6=m
 CONFIG_CRYPTO_ARC4=m
 CONFIG_CRYPTO_DEFLATE=m
+# CONFIG_CRYPTO_MICHAEL_MIC is not set
+# CONFIG_CRYPTO_CRC32C is not set
 CONFIG_CRYPTO_TEST=m
 
 #
 # Library routines
 #
 CONFIG_CRC32=y
+# CONFIG_LIBCRC32C is not set
 CONFIG_ZLIB_INFLATE=y
 CONFIG_ZLIB_DEFLATE=m
diff -Nru a/arch/ppc64/kernel/align.c b/arch/ppc64/kernel/align.c
--- a/arch/ppc64/kernel/align.c	2004-06-02 23:27:00 -07:00
+++ b/arch/ppc64/kernel/align.c	2004-06-02 23:27:00 -07:00
@@ -217,7 +217,7 @@
 	unsigned dsisr;
 	unsigned char __user *addr;
 	unsigned char __user *p;
-	unsigned long *lp;
+	unsigned long __user *lp;
 	union {
 		long ll;
 		double dd;
@@ -242,9 +242,9 @@
 
 	if (cur_cpu_spec->cpu_features & CPU_FTR_NODSISRALIGN) {
 	    unsigned int real_instr;
-	    if (__get_user(real_instr, (unsigned int *)regs->nip))
+	    if (__get_user(real_instr, (unsigned int __user *)regs->nip))
 		return 0;
-	    dsisr = make_dsisr(*((unsigned *)regs->nip));
+	    dsisr = make_dsisr(real_instr);
 	}
 
 	/* extract the operation and registers from the dsisr */
@@ -361,7 +361,7 @@
 		p = addr;
 		switch (nb) {
 		case 128:	/* Special case - must be dcbz */
-			lp = (unsigned long *)p;
+			lp = (unsigned long __user *)p;
 			for (i = 0; i < L1_CACHE_BYTES / sizeof(long); ++i)
 				ret |= __put_user(0, lp++);
 			break;
diff -Nru a/arch/ppc64/kernel/asm-offsets.c b/arch/ppc64/kernel/asm-offsets.c
--- a/arch/ppc64/kernel/asm-offsets.c	2004-06-02 23:26:59 -07:00
+++ b/arch/ppc64/kernel/asm-offsets.c	2004-06-02 23:26:59 -07:00
@@ -73,7 +73,6 @@
         DEFINE(ICACHEL1LINESIZE, offsetof(struct systemcfg, iCacheL1LineSize));
         DEFINE(ICACHEL1LOGLINESIZE, offsetof(struct naca_struct, iCacheL1LogLineSize));
         DEFINE(ICACHEL1LINESPERPAGE, offsetof(struct naca_struct, iCacheL1LinesPerPage));
-	DEFINE(SLBSIZE, offsetof(struct naca_struct, slb_size));
 	DEFINE(PLATFORM, offsetof(struct systemcfg, platform));
 
 	/* paca */
diff -Nru a/arch/ppc64/kernel/eeh.c b/arch/ppc64/kernel/eeh.c
--- a/arch/ppc64/kernel/eeh.c	2004-06-02 23:26:59 -07:00
+++ b/arch/ppc64/kernel/eeh.c	2004-06-02 23:26:59 -07:00
@@ -612,33 +612,25 @@
 }
 
 /**
- * eeh_add_device - perform EEH initialization for the indicated pci device
- * @dev: pci device for which to set up EEH
+ * eeh_add_device_early - enable EEH for the indicated device_node
+ * @dn: device node for which to set up EEH
  *
- * This routine can be used to perform EEH initialization for PCI
+ * This routine must be used to perform EEH initialization for PCI
  * devices that were added after system boot (e.g. hotplug, dlpar).
+ * This routine must be called before any i/o is performed to the
+ * adapter (inluding any config-space i/o).
  * Whether this actually enables EEH or not for this device depends
- * on the type of the device, on earlier boot command-line
- * arguments & etc.
+ * on the CEC architecture, type of the device, on earlier boot
+ * command-line arguments & etc.
  */
-void eeh_add_device(struct pci_dev *dev)
+void eeh_add_device_early(struct device_node *dn)
 {
-	struct device_node *dn;
 	struct pci_controller *phb;
 	struct eeh_early_enable_info info;
 
-	if (!dev || !eeh_subsystem_enabled)
+	if (!dn || !eeh_subsystem_enabled)
 		return;
-
-#ifdef DEBUG
-	printk(KERN_DEBUG "EEH: adding device %s %s\n", pci_name(dev),
-	       pci_pretty_name(dev));
-#endif
-	dn = pci_device_to_OF_node(dev);
-	if (NULL == dn)
-		return;
-
-	phb = PCI_GET_PHB_PTR(dev);
+	phb = dn->phb;
 	if (NULL == phb || 0 == phb->buid) {
 		printk(KERN_WARNING "EEH: Expected buid but found none\n");
 		return;
@@ -646,11 +638,30 @@
 
 	info.buid_hi = BUID_HI(phb->buid);
 	info.buid_lo = BUID_LO(phb->buid);
-
 	early_enable_eeh(dn, &info);
+}
+EXPORT_SYMBOL(eeh_add_device_early);
+
+/**
+ * eeh_add_device_late - perform EEH initialization for the indicated pci device
+ * @dev: pci device for which to set up EEH
+ *
+ * This routine must be used to complete EEH initialization for PCI
+ * devices that were added after system boot (e.g. hotplug, dlpar).
+ */
+void eeh_add_device_late(struct pci_dev *dev)
+{
+	if (!dev || !eeh_subsystem_enabled)
+		return;
+
+#ifdef DEBUG
+	printk(KERN_DEBUG "EEH: adding device %s %s\n", pci_name(dev),
+	       pci_pretty_name(dev));
+#endif
+
 	pci_addr_cache_insert_device (dev);
 }
-EXPORT_SYMBOL(eeh_add_device);
+EXPORT_SYMBOL(eeh_add_device_late);
 
 /**
  * eeh_remove_device - undo EEH setup for the indicated pci device
diff -Nru a/arch/ppc64/kernel/head.S b/arch/ppc64/kernel/head.S
--- a/arch/ppc64/kernel/head.S	2004-06-02 23:26:59 -07:00
+++ b/arch/ppc64/kernel/head.S	2004-06-02 23:26:59 -07:00
@@ -1123,13 +1123,11 @@
 	 */
 
 	/* r20 = paca */
-	/* use a cpu feature mask if we ever change our slb size */
-SLB_NUM_ENTRIES = 64
 1:	ld	r22,PACASTABRR(r20)
 	addi	r21,r22,1
 	cmpdi	r21,SLB_NUM_ENTRIES
 	blt+	2f
-	li	r21,1			/* dont touch bolted slot 0 */
+	li	r21,2			/* dont touch slot 0 or 1 */
 2:	std	r21,PACASTABRR(r20)
 
 	/* r20 = paca, r22 = entry */
diff -Nru a/arch/ppc64/kernel/iSeries_setup.c b/arch/ppc64/kernel/iSeries_setup.c
--- a/arch/ppc64/kernel/iSeries_setup.c	2004-06-02 23:27:00 -07:00
+++ b/arch/ppc64/kernel/iSeries_setup.c	2004-06-02 23:27:00 -07:00
@@ -563,11 +563,6 @@
 	lmb_add(0, systemcfg->physicalMemorySize);
 	lmb_analyze();	/* ?? */
 	lmb_reserve(0, __pa(klimit));
-
-	/* 
-	 * Hardcode to GP size.  I am not sure where to get this info. DRENG
-	 */
-	naca->slb_size = 64;
 }
 
 /*
@@ -858,3 +853,12 @@
 		}
 	}
 }
+
+int __init iSeries_src_init(void)
+{
+        /* clear the progress line */
+        ppc_md.progress(" ", 0xffff);
+        return 0;
+}
+
+late_initcall(iSeries_src_init);
diff -Nru a/arch/ppc64/kernel/pacaData.c b/arch/ppc64/kernel/pacaData.c
--- a/arch/ppc64/kernel/pacaData.c	2004-06-02 23:27:00 -07:00
+++ b/arch/ppc64/kernel/pacaData.c	2004-06-02 23:27:00 -07:00
@@ -42,6 +42,7 @@
 	.xStab_data = {							    \
 		.real = (asrr),		/* Real pointer to segment table */ \
 		.virt = (asrv),		/* Virt pointer to segment table */ \
+		.next_round_robin = 1,					    \
 	},								    \
 	.lpQueuePtr = (lpq),		/* &xItLpQueue, */		    \
 	/* .xRtas = {							    \
@@ -54,7 +55,8 @@
 		.xFPRegsInUse = 1,					    \
 		.xDynProcStatus = 2,					    \
 		.xDecrVal = 0x00ff0000,					    \
-		.xEndOfQuantum = 0xfffffffffffffffful			    \
+		.xEndOfQuantum = 0xfffffffffffffffful,			    \
+		.xSLBCount = 64,					    \
 	},								    \
 	.xRegSav = {							    \
 		.xDesc = 0xd397d9e2,	/* "LpRS" */			    \
diff -Nru a/arch/ppc64/kernel/process.c b/arch/ppc64/kernel/process.c
--- a/arch/ppc64/kernel/process.c	2004-06-02 23:26:59 -07:00
+++ b/arch/ppc64/kernel/process.c	2004-06-02 23:26:59 -07:00
@@ -332,8 +332,8 @@
          * entry is the TOC value we need to use.
          */
 	set_fs(USER_DS);
-	__get_user(entry, (unsigned long *)fdptr);
-	__get_user(toc, (unsigned long *)fdptr+1);
+	__get_user(entry, (unsigned long __user *)fdptr);
+	__get_user(toc, (unsigned long __user *)fdptr+1);
 
 	/* Check whether the e_entry function descriptor entries
 	 * need to be relocated before we can use them.
@@ -386,7 +386,7 @@
 	unsigned int val;
 
 	val = __unpack_fe01(tsk->thread.fpexc_mode);
-	return put_user(val, (unsigned int *) adr);
+	return put_user(val, (unsigned int __user *) adr);
 }
 
 int sys_clone(unsigned long clone_flags, unsigned long p2, unsigned long p3,
@@ -546,7 +546,7 @@
 		 * We look for the "regshere" marker in the current frame.
 		 */
 		if (validate_sp(sp, p, sizeof(struct pt_regs) + 400)
-		    && _sp[12] == 0x7265677368657265) {
+		    && _sp[12] == 0x7265677368657265ul) {
 			struct pt_regs *regs = (struct pt_regs *)
 				(sp + STACK_FRAME_OVERHEAD);
 			printk("--- Exception: %lx", regs->trap);
diff -Nru a/arch/ppc64/kernel/prom.c b/arch/ppc64/kernel/prom.c
--- a/arch/ppc64/kernel/prom.c	2004-06-02 23:27:00 -07:00
+++ b/arch/ppc64/kernel/prom.c	2004-06-02 23:27:00 -07:00
@@ -458,13 +458,6 @@
 		PROM_BUG();
 	}
 
-	/* 
-	 * Hardcode to GP size.  I am not sure where to get this info
-	 * in general, as there does not appear to be a slb-size OF
-	 * entry.  At least in Condor and earlier.  DRENG 
-	 */
-	_naca->slb_size = 64;
-
 	/* Add an eye catcher and the systemcfg layout version number */
 	strcpy(_systemcfg->eye_catcher, RELOC("SYSTEMCFG:PPC64"));
 	_systemcfg->version.major = SYSTEMCFG_MAJOR;
@@ -654,8 +647,6 @@
 #endif /* DEBUG_PROM */
 }
 
-static char hypertas_funcs[1024];
-
 static void __init
 prom_instantiate_rtas(void)
 {
@@ -665,6 +656,7 @@
 	struct systemcfg *_systemcfg = RELOC(systemcfg);
 	ihandle prom_rtas;
         u32 getprop_rval;
+	char hypertas_funcs[4];
 
 #ifdef DEBUG_PROM
 	prom_print(RELOC("prom_instantiate_rtas: start...\n"));
@@ -1556,7 +1548,7 @@
 		if (*mem_end != RELOC(initrd_start))
 			prom_panic(RELOC("No memory for copy_device_tree"));
 
-		prom_print("Huge device_tree: moving initrd\n");
+		prom_print(RELOC("Huge device_tree: moving initrd\n"));
 		/* Move by 4M. */
 		initrd_len = RELOC(initrd_end) - RELOC(initrd_start);
 		*mem_end = RELOC(initrd_start) + 4 * 1024 * 1024;
@@ -1590,6 +1582,7 @@
 	char *prev_name, *namep;
 	unsigned char *valp;
 	unsigned long offset = reloc_offset();
+	phandle ibm_phandle;
 
 	np = make_room(mem_start, mem_end, struct device_node);
 	memset(np, 0, sizeof(*np));
@@ -1652,23 +1645,24 @@
 		prev_propp = &pp->next;
 	}
 
-	/* Add a "linux_phandle" value */
-        if (np->node) {
-		u32 ibm_phandle = 0;
-		int len;
-
-                /* First see if "ibm,phandle" exists and use its value */
-                len = (int)
-                        call_prom(RELOC("getprop"), 4, 1, node, RELOC("ibm,phandle"),
-                                  &ibm_phandle, sizeof(ibm_phandle));
-                if (len < 0) {
-                        np->linux_phandle = np->node;
-                } else {
-                        np->linux_phandle = ibm_phandle;
-		}
-	}
-
-	*prev_propp = 0;
+	/* Add a "linux,phandle" property. */
+	namep = make_room(mem_start, mem_end, char[16]);
+	strcpy(namep, RELOC("linux,phandle"));
+	pp = make_room(mem_start, mem_end, struct property);
+	pp->name = PTRUNRELOC(namep);
+	pp->length = sizeof(phandle);
+	valp = make_room(mem_start, mem_end, phandle);
+	pp->value = PTRUNRELOC(valp);
+	*(phandle *)valp = node;
+	*prev_propp = PTRUNRELOC(pp);
+	pp->next = NULL;
+
+	/* Set np->linux_phandle to the value of the ibm,phandle property
+	   if it exists, otherwise to the phandle for this node. */
+	np->linux_phandle = node;
+	if ((int)call_prom(RELOC("getprop"), 4, 1, node, RELOC("ibm,phandle"),
+			   &ibm_phandle, sizeof(ibm_phandle)) > 0)
+		np->linux_phandle = ibm_phandle;
 
 	/* get the node's full name */
 	namep = (char *)*mem_start;
diff -Nru a/arch/ppc64/kernel/ptrace.c b/arch/ppc64/kernel/ptrace.c
--- a/arch/ppc64/kernel/ptrace.c	2004-06-02 23:27:00 -07:00
+++ b/arch/ppc64/kernel/ptrace.c	2004-06-02 23:27:00 -07:00
@@ -101,7 +101,7 @@
 		ret = -EIO;
 		if (copied != sizeof(tmp))
 			break;
-		ret = put_user(tmp,(unsigned long *) data);
+		ret = put_user(tmp,(unsigned long __user *) data);
 		break;
 	}
 
@@ -123,7 +123,7 @@
 				giveup_fpu(child);
 			tmp = ((unsigned long *)child->thread.fpr)[index - PT_FPR0];
 		}
-		ret = put_user(tmp,(unsigned long *) data);
+		ret = put_user(tmp,(unsigned long __user *) data);
 		break;
 	}
 
@@ -213,7 +213,7 @@
 	case PPC_PTRACE_GETREGS: { /* Get GPRs 0 - 31. */
 		int i;
 		unsigned long *reg = &((unsigned long *)child->thread.regs)[0];
-		unsigned long *tmp = (unsigned long *)addr;
+		unsigned long __user *tmp = (unsigned long __user *)addr;
 
 		for (i = 0; i < 32; i++) {
 			ret = put_user(*reg, tmp);
@@ -228,7 +228,7 @@
 	case PPC_PTRACE_SETREGS: { /* Set GPRs 0 - 31. */
 		int i;
 		unsigned long *reg = &((unsigned long *)child->thread.regs)[0];
-		unsigned long *tmp = (unsigned long *)addr;
+		unsigned long __user *tmp = (unsigned long __user *)addr;
 
 		for (i = 0; i < 32; i++) {
 			ret = get_user(*reg, tmp);
@@ -243,7 +243,7 @@
 	case PPC_PTRACE_GETFPREGS: { /* Get FPRs 0 - 31. */
 		int i;
 		unsigned long *reg = &((unsigned long *)child->thread.fpr)[0];
-		unsigned long *tmp = (unsigned long *)addr;
+		unsigned long __user *tmp = (unsigned long __user *)addr;
 
 		if (child->thread.regs->msr & MSR_FP)
 			giveup_fpu(child);
@@ -261,7 +261,7 @@
 	case PPC_PTRACE_SETFPREGS: { /* Get FPRs 0 - 31. */
 		int i;
 		unsigned long *reg = &((unsigned long *)child->thread.fpr)[0];
-		unsigned long *tmp = (unsigned long *)addr;
+		unsigned long __user *tmp = (unsigned long __user *)addr;
 
 		if (child->thread.regs->msr & MSR_FP)
 			giveup_fpu(child);
diff -Nru a/arch/ppc64/kernel/ptrace32.c b/arch/ppc64/kernel/ptrace32.c
--- a/arch/ppc64/kernel/ptrace32.c	2004-06-02 23:26:59 -07:00
+++ b/arch/ppc64/kernel/ptrace32.c	2004-06-02 23:26:59 -07:00
@@ -89,7 +89,7 @@
 		ret = -EIO;
 		if (copied != sizeof(tmp))
 			break;
-		ret = put_user(tmp, (u32*)data);
+		ret = put_user(tmp, (u32 __user *)data);
 		break;
 	}
 
@@ -106,19 +106,19 @@
 	case PPC_PTRACE_PEEKDATA_3264: {
 		u32 tmp;
 		int copied;
-		u32* addrOthers;
+		u32 __user * addrOthers;
 
 		ret = -EIO;
 
 		/* Get the addr in the other process that we want to read */
-		if (get_user(addrOthers, (u32**)addr) != 0)
+		if (get_user(addrOthers, (u32 __user * __user *)addr) != 0)
 			break;
 
 		copied = access_process_vm(child, (u64)addrOthers, &tmp,
 				sizeof(tmp), 0);
 		if (copied != sizeof(tmp))
 			break;
-		ret = put_user(tmp, (u32*)data);
+		ret = put_user(tmp, (u32 __user *)data);
 		break;
 	}
 
@@ -145,7 +145,7 @@
 			 */
 			tmp = ((unsigned int *)child->thread.fpr)[index - PT_FPR0];
 		}
-		ret = put_user((unsigned int)tmp, (u32*)data);
+		ret = put_user((unsigned int)tmp, (u32 __user *)data);
 		break;
 	}
   
@@ -186,7 +186,7 @@
 			tmp = get_reg(child, numReg);
 		} 
 		reg32bits = ((u32*)&tmp)[part];
-		ret = put_user(reg32bits, (u32*)data);
+		ret = put_user(reg32bits, (u32 __user *)data);
 		break;
 	}
 
@@ -215,11 +215,11 @@
 	case PPC_PTRACE_POKETEXT_3264:
 	case PPC_PTRACE_POKEDATA_3264: {
 		u32 tmp = data;
-		u32* addrOthers;
+		u32 __user * addrOthers;
 
 		/* Get the addr in the other process that we want to write into */
 		ret = -EIO;
-		if (get_user(addrOthers, (u32**)addr) != 0)
+		if (get_user(addrOthers, (u32 __user * __user *)addr) != 0)
 			break;
 		ret = 0;
 		if (access_process_vm(child, (u64)addrOthers, &tmp,
@@ -347,7 +347,7 @@
 	case PPC_PTRACE_GETREGS: { /* Get GPRs 0 - 31. */
 		int i;
 		unsigned long *reg = &((unsigned long *)child->thread.regs)[0];
-		unsigned int *tmp = (unsigned int *)addr;
+		unsigned int __user *tmp = (unsigned int __user *)addr;
 
 		for (i = 0; i < 32; i++) {
 			ret = put_user(*reg, tmp);
@@ -362,7 +362,7 @@
 	case PPC_PTRACE_SETREGS: { /* Set GPRs 0 - 31. */
 		int i;
 		unsigned long *reg = &((unsigned long *)child->thread.regs)[0];
-		unsigned int *tmp = (unsigned int *)addr;
+		unsigned int __user *tmp = (unsigned int __user *)addr;
 
 		for (i = 0; i < 32; i++) {
 			ret = get_user(*reg, tmp);
@@ -377,7 +377,7 @@
 	case PPC_PTRACE_GETFPREGS: { /* Get FPRs 0 - 31. */
 		int i;
 		unsigned long *reg = &((unsigned long *)child->thread.fpr)[0];
-		unsigned int *tmp = (unsigned int *)addr;
+		unsigned int __user *tmp = (unsigned int __user *)addr;
 
 		if (child->thread.regs->msr & MSR_FP)
 			giveup_fpu(child);
@@ -395,7 +395,7 @@
 	case PPC_PTRACE_SETFPREGS: { /* Get FPRs 0 - 31. */
 		int i;
 		unsigned long *reg = &((unsigned long *)child->thread.fpr)[0];
-		unsigned int *tmp = (unsigned int *)addr;
+		unsigned int __user *tmp = (unsigned int __user *)addr;
 
 		if (child->thread.regs->msr & MSR_FP)
 			giveup_fpu(child);
diff -Nru a/arch/ppc64/kernel/signal.c b/arch/ppc64/kernel/signal.c
--- a/arch/ppc64/kernel/signal.c	2004-06-02 23:26:58 -07:00
+++ b/arch/ppc64/kernel/signal.c	2004-06-02 23:26:58 -07:00
@@ -154,7 +154,7 @@
 	/* We always copy to/from vrsave, it's 0 if we don't have or don't
 	 * use altivec.
 	 */
-	err |= __put_user(current->thread.vrsave, (u32 *)&v_regs[33]);
+	err |= __put_user(current->thread.vrsave, (u32 __user *)&v_regs[33]);
 #else /* CONFIG_ALTIVEC */
 	err |= __put_user(0, &sc->v_regs);
 #endif /* CONFIG_ALTIVEC */
@@ -216,7 +216,7 @@
 		memset(&current->thread.vr, 0, 33);
 	/* Always get VRSAVE back */
 	if (v_regs != 0)
-		err |= __get_user(current->thread.vrsave, (u32 *)&v_regs[33]);
+		err |= __get_user(current->thread.vrsave, (u32 __user *)&v_regs[33]);
 	else
 		current->thread.vrsave = 0;
 #endif /* CONFIG_ALTIVEC */
@@ -311,8 +311,8 @@
 	if (new_ctx == NULL)
 		return 0;
 	if (verify_area(VERIFY_READ, new_ctx, sizeof(*new_ctx))
-	    || __get_user(tmp, (u8 *) new_ctx)
-	    || __get_user(tmp, (u8 *) (new_ctx + 1) - 1))
+	    || __get_user(tmp, (u8 __user *) new_ctx)
+	    || __get_user(tmp, (u8 __user *) (new_ctx + 1) - 1))
 		return -EFAULT;
 
 	/*
@@ -384,7 +384,7 @@
 	 * descriptor is the entry address of signal and the second
 	 * entry is the TOC value we need to use.
 	 */
-	func_descr_t *funct_desc_ptr;
+	func_descr_t __user *funct_desc_ptr;
 	struct rt_sigframe __user *frame;
 	unsigned long newsp = 0;
 	long err = 0;
@@ -418,11 +418,11 @@
 	if (err)
 		goto badframe;
 
-	funct_desc_ptr = (func_descr_t *) ka->sa.sa_handler;
+	funct_desc_ptr = (func_descr_t __user *) ka->sa.sa_handler;
 
 	/* Allocate a dummy caller frame for the signal handler. */
 	newsp = (unsigned long)frame - __SIGNAL_FRAMESIZE;
-	err |= put_user(0, (unsigned long *)newsp);
+	err |= put_user(0, (unsigned long __user *)newsp);
 
 	/* Set up "regs" so we "return" to the signal handler. */
 	err |= get_user(regs->nip, &funct_desc_ptr->entry);
@@ -432,8 +432,8 @@
 	regs->gpr[3] = signr;
 	regs->result = 0;
 	if (ka->sa.sa_flags & SA_SIGINFO) {
-		err |= get_user(regs->gpr[4], (unsigned long *)&frame->pinfo);
-		err |= get_user(regs->gpr[5], (unsigned long *)&frame->puc);
+		err |= get_user(regs->gpr[4], (unsigned long __user *)&frame->pinfo);
+		err |= get_user(regs->gpr[5], (unsigned long __user *)&frame->puc);
 		regs->gpr[6] = (unsigned long) frame;
 	} else {
 		regs->gpr[4] = (unsigned long)&frame->uc.uc_mcontext;
diff -Nru a/arch/ppc64/kernel/signal32.c b/arch/ppc64/kernel/signal32.c
--- a/arch/ppc64/kernel/signal32.c	2004-06-02 23:27:00 -07:00
+++ b/arch/ppc64/kernel/signal32.c	2004-06-02 23:27:00 -07:00
@@ -165,7 +165,7 @@
 	 * significant bits of a vector, we "cheat" and stuff VRSAVE in the
 	 * most significant bits of that same vector. --BenH
 	 */
-	if (__put_user(current->thread.vrsave, (u32 *)&frame->mc_vregs[32]))
+	if (__put_user(current->thread.vrsave, (u32 __user *)&frame->mc_vregs[32]))
 		return 1;
 #endif /* CONFIG_ALTIVEC */
 
@@ -232,7 +232,7 @@
 		memset(&current->thread.vr, 0, ELF_NVRREG32 * sizeof(vector128));
 
 	/* Always get VRSAVE back */
-	if (__get_user(current->thread.vrsave, (u32 *)&sr->mc_vregs[32]))
+	if (__get_user(current->thread.vrsave, (u32 __user *)&sr->mc_vregs[32]))
 		return 1;
 #endif /* CONFIG_ALTIVEC */
 
@@ -289,8 +289,8 @@
 	}
 }
 
-long sys32_sigaction(int sig, struct old_sigaction32 *act,
-		struct old_sigaction32 *oact)
+long sys32_sigaction(int sig, struct old_sigaction32 __user *act,
+		struct old_sigaction32 __user *oact)
 {
 	struct k_sigaction new_ka, old_ka;
 	int ret;
@@ -589,9 +589,11 @@
  *       sigaltatck               sys32_sigaltstack
  */
 
-int sys32_sigaltstack(u32 newstack, u32 oldstack, int r5,
+int sys32_sigaltstack(u32 __new, u32 __old, int r5,
 		      int r6, int r7, int r8, struct pt_regs *regs)
 {
+	stack_32_t __user * newstack = (stack_32_t __user *)(long) __new;
+	stack_32_t __user * oldstack = (stack_32_t __user *)(long) __old;
 	stack_t uss, uoss;
 	int ret;
 	mm_segment_t old_fs;
@@ -605,12 +607,9 @@
 
 	/* Put new stack info in local 64 bit stack struct */
 	if (newstack &&
-		(get_user((long)uss.ss_sp,
-			  &((stack_32_t *)(long)newstack)->ss_sp) ||
-		 __get_user(uss.ss_flags,
-			 &((stack_32_t *)(long)newstack)->ss_flags) ||
-		 __get_user(uss.ss_size,
-			 &((stack_32_t *)(long)newstack)->ss_size)))
+		(get_user((long)uss.ss_sp, &newstack->ss_sp) ||
+		 __get_user(uss.ss_flags, &newstack->ss_flags) ||
+		 __get_user(uss.ss_size, &newstack->ss_size)))
 		return -EFAULT; 
 
 	old_fs = get_fs();
@@ -623,12 +622,9 @@
 	set_fs(old_fs);
 	/* Copy the stack information to the user output buffer */
 	if (!ret && oldstack  &&
-		(put_user((long)uoss.ss_sp,
-			  &((stack_32_t *)(long)oldstack)->ss_sp) ||
-		 __put_user(uoss.ss_flags,
-			 &((stack_32_t *)(long)oldstack)->ss_flags) ||
-		 __put_user(uoss.ss_size,
-			 &((stack_32_t *)(long)oldstack)->ss_size)))
+		(put_user((long)uoss.ss_sp, &oldstack->ss_sp) ||
+		 __put_user(uoss.ss_flags, &oldstack->ss_flags) ||
+		 __put_user(uoss.ss_size, &oldstack->ss_size)))
 		return -EFAULT;
 	return ret;
 }
@@ -746,8 +742,8 @@
 	if (new_ctx == NULL)
 		return 0;
 	if (verify_area(VERIFY_READ, new_ctx, sizeof(*new_ctx))
-	    || __get_user(tmp, (u8 *) new_ctx)
-	    || __get_user(tmp, (u8 *) (new_ctx + 1) - 1))
+	    || __get_user(tmp, (u8 __user *) new_ctx)
+	    || __get_user(tmp, (u8 __user *) (new_ctx + 1) - 1))
 		return -EFAULT;
 
 	/*
diff -Nru a/arch/ppc64/kernel/stab.c b/arch/ppc64/kernel/stab.c
--- a/arch/ppc64/kernel/stab.c	2004-06-02 23:27:00 -07:00
+++ b/arch/ppc64/kernel/stab.c	2004-06-02 23:27:00 -07:00
@@ -24,6 +24,23 @@
 static void make_slbe(unsigned long esid, unsigned long vsid, int large,
 		      int kernel_segment);
 
+static inline void slb_add_bolted(void)
+{
+#ifndef CONFIG_PPC_ISERIES
+	unsigned long esid = GET_ESID(VMALLOCBASE);
+	unsigned long vsid = get_kernel_vsid(VMALLOCBASE);
+
+	WARN_ON(!irqs_disabled());
+
+	/*
+	 * Bolt in the first vmalloc segment. Since modules end
+	 * up there it gets hit very heavily.
+	 */
+	get_paca()->xStab_data.next_round_robin = 1;
+	make_slbe(esid, vsid, 0, 1);
+#endif
+}
+
 /*
  * Build an entry for the base kernel segment and put it into
  * the segment table or SLB.  All other segment table or SLB
@@ -48,9 +65,12 @@
 		asm volatile("isync":::"memory");
 		asm volatile("slbmte  %0,%0"::"r" (0) : "memory");
 		asm volatile("isync; slbia; isync":::"memory");
+		get_paca()->xStab_data.next_round_robin = 0;
 		make_slbe(esid, vsid, seg0_largepages, 1);
 		asm volatile("isync":::"memory");
 #endif
+
+		slb_add_bolted();
 	} else {
 		asm volatile("isync; slbia; isync":::"memory");
 		make_ste(stab, esid, vsid);
@@ -317,6 +337,7 @@
 		unsigned long word0;
 		slb_dword1    data;
 	} vsid_data;
+	struct paca_struct *lpaca = get_paca();
 
 	/*
 	 * We take the next entry, round robin. Previously we tried
@@ -330,18 +351,25 @@
 	 * for the kernel stack during the first part of exception exit 
 	 * which gets invalidated due to a tlbie from another cpu at a
 	 * non recoverable point (after setting srr0/1) - Anton
+	 *
+	 * paca Ksave is always valid (even when on the interrupt stack)
+	 * so we use that.
 	 */
-	castout_entry = get_paca()->xStab_data.next_round_robin;
+	castout_entry = lpaca->xStab_data.next_round_robin;
 	do {
 		entry = castout_entry;
 		castout_entry++; 
-		if (castout_entry >= naca->slb_size)
-			castout_entry = 1; 
+		/*
+		 * We bolt in the first kernel segment and the first
+		 * vmalloc segment.
+		 */
+		if (castout_entry >= SLB_NUM_ENTRIES)
+			castout_entry = 2;
 		asm volatile("slbmfee  %0,%1" : "=r" (esid_data) : "r" (entry));
 	} while (esid_data.data.v &&
-		 esid_data.data.esid == GET_ESID(__get_SP()));
+		 esid_data.data.esid == GET_ESID(lpaca->xKsave));
 
-	get_paca()->xStab_data.next_round_robin = castout_entry;
+	lpaca->xStab_data.next_round_robin = castout_entry;
 
 	/* slbie not needed as the previous mapping is still valid. */
 
@@ -422,6 +450,9 @@
 	}
 
 	esid = GET_ESID(ea);
+#ifndef CONFIG_PPC_ISERIES
+	BUG_ON((esid << SID_SHIFT) == VMALLOCBASE);
+#endif
 	__slb_allocate(esid, vsid, context);
 
 	return 0;
@@ -479,18 +510,19 @@
 		slb_dword0 data;
 	} esid_data;
 
-
 	if (offset <= NR_STAB_CACHE_ENTRIES) {
 		int i;
 		asm volatile("isync" : : : "memory");
 		for (i = 0; i < offset; i++) {
 			esid_data.word0 = 0;
 			esid_data.data.esid = __get_cpu_var(stab_cache[i]);
+			BUG_ON(esid_data.data.esid == GET_ESID(VMALLOCBASE));
 			asm volatile("slbie %0" : : "r" (esid_data));
 		}
 		asm volatile("isync" : : : "memory");
 	} else {
 		asm volatile("isync; slbia; isync" : : : "memory");
+		slb_add_bolted();
 	}
 
 	/* Workaround POWER5 < DD2.1 issue */
diff -Nru a/arch/ppc64/kernel/sys_ppc32.c b/arch/ppc64/kernel/sys_ppc32.c
--- a/arch/ppc64/kernel/sys_ppc32.c	2004-06-02 23:27:00 -07:00
+++ b/arch/ppc64/kernel/sys_ppc32.c	2004-06-02 23:27:00 -07:00
@@ -173,7 +173,7 @@
 		goto efault;
 	if (__put_user(0, dirent->d_name + namlen))
 		goto efault;
-	if (__put_user(d_type, (char *) dirent + reclen - 1))
+	if (__put_user(d_type, (char __user *) dirent + reclen - 1))
 		goto efault;
 	buf->previous = dirent;
 	dirent = (void __user *)dirent + reclen;
@@ -1105,7 +1105,7 @@
 	int error;
 	size_t oldlen;
 	size_t __user *oldlenp = NULL;
-	unsigned long addr = (((long)&args->__unused[0]) + 7) & ~7;
+	unsigned long addr = (((unsigned long)&args->__unused[0]) + 7) & ~7;
 
 	if (copy_from_user(&tmp, args, sizeof(tmp)))
 		return -EFAULT;
@@ -1118,7 +1118,7 @@
 		   glibc's __sysctl uses rw memory for the structure
 		   anyway.  */
 		oldlenp = (size_t __user *)addr;
-		if (get_user(oldlen, (u32 *)A(tmp.oldlenp)) ||
+		if (get_user(oldlen, (u32 __user *)A(tmp.oldlenp)) ||
 		    put_user(oldlen, oldlenp))
 			return -EFAULT;
 	}
diff -Nru a/arch/ppc64/kernel/time.c b/arch/ppc64/kernel/time.c
--- a/arch/ppc64/kernel/time.c	2004-06-02 23:27:00 -07:00
+++ b/arch/ppc64/kernel/time.c	2004-06-02 23:27:00 -07:00
@@ -430,7 +430,7 @@
  * fields itself.  This way, the fields which are used for 
  * do_settimeofday get updated too.
  */
-long ppc64_sys32_stime(int* tptr)
+long ppc64_sys32_stime(int __user * tptr)
 {
 	int value;
 	struct timespec myTimeval;
@@ -455,7 +455,7 @@
  * fields itself.  This way, the fields which are used for 
  * do_settimeofday get updated too.
  */
-long ppc64_sys_stime(long* tptr)
+long ppc64_sys_stime(long __user * tptr)
 {
 	long value;
 	struct timespec myTimeval;
diff -Nru a/arch/ppc64/mm/fault.c b/arch/ppc64/mm/fault.c
--- a/arch/ppc64/mm/fault.c	2004-06-02 23:27:00 -07:00
+++ b/arch/ppc64/mm/fault.c	2004-06-02 23:27:00 -07:00
@@ -45,7 +45,7 @@
 {
 	unsigned int inst;
 
-	if (get_user(inst, (unsigned int *)regs->nip))
+	if (get_user(inst, (unsigned int __user *)regs->nip))
 		return 0;
 	/* check for 1 in the rA field */
 	if (((inst >> 16) & 0x1f) != 1)
diff -Nru a/arch/ppc64/xmon/xmon.c b/arch/ppc64/xmon/xmon.c
--- a/arch/ppc64/xmon/xmon.c	2004-06-02 23:27:00 -07:00
+++ b/arch/ppc64/xmon/xmon.c	2004-06-02 23:27:00 -07:00
@@ -1402,7 +1402,7 @@
 		/* Look for "regshere" marker to see if this is
 		   an exception frame. */
 		if (mread(sp + 0x60, &marker, sizeof(unsigned long))
-		    && marker == 0x7265677368657265) {
+		    && marker == 0x7265677368657265ul) {
 			if (mread(sp + 0x70, &regs, sizeof(regs))
 			    != sizeof(regs)) {
 				printf("Couldn't read registers at %lx\n",
@@ -2512,7 +2512,7 @@
 
 	printf("SLB contents of cpu %x\n", smp_processor_id());
 
-	for (i = 0; i < naca->slb_size; i++) {
+	for (i = 0; i < SLB_NUM_ENTRIES; i++) {
 		asm volatile("slbmfee  %0,%1" : "=r" (tmp) : "r" (i));
 		printf("%02d %016lx ", i, tmp);
 
diff -Nru a/arch/sparc/Makefile b/arch/sparc/Makefile
--- a/arch/sparc/Makefile	2004-06-02 23:26:58 -07:00
+++ b/arch/sparc/Makefile	2004-06-02 23:26:58 -07:00
@@ -13,6 +13,7 @@
 
 AS              := $(AS) -32
 LDFLAGS		:= -m elf32_sparc
+CHECK		:= $(CHECK) -D__sparc__=1
 
 #CFLAGS := $(CFLAGS) -g -pipe -fcall-used-g5 -fcall-used-g7
 CFLAGS := $(CFLAGS) -m32 -pipe -mno-fpu -fcall-used-g5 -fcall-used-g7
diff -Nru a/arch/sparc/kernel/apc.c b/arch/sparc/kernel/apc.c
--- a/arch/sparc/kernel/apc.c	2004-06-02 23:27:00 -07:00
+++ b/arch/sparc/kernel/apc.c	2004-06-02 23:27:00 -07:00
@@ -84,47 +84,44 @@
 }
 
 static int apc_ioctl(struct inode *inode, struct file *f, 
-		     unsigned int cmd, unsigned long arg)
+		     unsigned int cmd, unsigned long __arg)
 {
-	__u8 inarg;
+	__u8 inarg, __user *arg;
 
+	arg = (__u8 __user *) __arg;
 	switch (cmd) {
-		case APCIOCGFANCTL:
-			if(put_user(apc_readb(APC_FANCTL_REG) & APC_REGMASK, (__u8*) arg)) {
+	case APCIOCGFANCTL:
+		if (put_user(apc_readb(APC_FANCTL_REG) & APC_REGMASK, arg))
 				return -EFAULT;
-			}
-			break;
-		case APCIOCGCPWR:
-			if(put_user(apc_readb(APC_CPOWER_REG) & APC_REGMASK, (__u8*) arg)) {
-				return -EFAULT;
-			}
-			break;
-		case APCIOCGBPORT:
-			if(put_user(apc_readb(APC_BPORT_REG) & APC_BPMASK, (__u8*) arg)) {
-				return -EFAULT;
-			}
-			break;
+		break;
 
-		case APCIOCSFANCTL:
-			if(get_user(inarg, (__u8*) arg)) {
-				return -EFAULT;
-			}
-			apc_writeb(inarg & APC_REGMASK, APC_FANCTL_REG);
-			break;
-		case APCIOCSCPWR:
-			if(get_user(inarg, (__u8*) arg)) {
-				return -EFAULT;
-			}
-			apc_writeb(inarg & APC_REGMASK, APC_CPOWER_REG);
-			break;
-		case APCIOCSBPORT:
-			if(get_user(inarg, (__u8*) arg)) {
-				return -EFAULT;
-			}
-			apc_writeb(inarg & APC_BPMASK, APC_BPORT_REG);
-			break;
-		default:
-			return -EINVAL;
+	case APCIOCGCPWR:
+		if (put_user(apc_readb(APC_CPOWER_REG) & APC_REGMASK, arg))
+			return -EFAULT;
+		break;
+
+	case APCIOCGBPORT:
+		if (put_user(apc_readb(APC_BPORT_REG) & APC_BPMASK, arg))
+			return -EFAULT;
+		break;
+
+	case APCIOCSFANCTL:
+		if (get_user(inarg, arg))
+			return -EFAULT;
+		apc_writeb(inarg & APC_REGMASK, APC_FANCTL_REG);
+		break;
+	case APCIOCSCPWR:
+		if (get_user(inarg, arg))
+			return -EFAULT;
+		apc_writeb(inarg & APC_REGMASK, APC_CPOWER_REG);
+		break;
+	case APCIOCSBPORT:
+		if (get_user(inarg, arg))
+			return -EFAULT;
+		apc_writeb(inarg & APC_BPMASK, APC_BPORT_REG);
+		break;
+	default:
+		return -EINVAL;
 	};
 
 	return 0;
diff -Nru a/arch/sparc/kernel/ebus.c b/arch/sparc/kernel/ebus.c
--- a/arch/sparc/kernel/ebus.c	2004-06-02 23:27:00 -07:00
+++ b/arch/sparc/kernel/ebus.c	2004-06-02 23:27:00 -07:00
@@ -238,7 +238,7 @@
 		child->bus = dev->bus;
 		fill_ebus_child(node, &regs[0], child);
 
-		while ((node = prom_getsibling(node))) {
+		while ((node = prom_getsibling(node)) != 0) {
 			child->next = (struct linux_ebus_child *)
 				ebus_alloc(sizeof(struct linux_ebus_child));
 
@@ -330,7 +330,7 @@
 		dev->bus = ebus;
 		fill_ebus_device(nd, dev);
 
-		while ((nd = prom_getsibling(nd))) {
+		while ((nd = prom_getsibling(nd)) != 0) {
 			dev->next = (struct linux_ebus_device *)
 				ebus_alloc(sizeof(struct linux_ebus_device));
 
diff -Nru a/arch/sparc/kernel/irq.c b/arch/sparc/kernel/irq.c
--- a/arch/sparc/kernel/irq.c	2004-06-02 23:26:58 -07:00
+++ b/arch/sparc/kernel/irq.c	2004-06-02 23:26:58 -07:00
@@ -216,7 +216,8 @@
 	if (sparc_cpu_model == sun4d) {
 		extern void sun4d_free_irq(unsigned int, void *);
 		
-		return sun4d_free_irq(irq, dev_id);
+		sun4d_free_irq(irq, dev_id);
+		return;
 	}
 	cpu_irq = irq & (NR_IRQS - 1);
         if (cpu_irq > 14) {  /* 14 irq levels on the sparc */
diff -Nru a/arch/sparc/kernel/muldiv.c b/arch/sparc/kernel/muldiv.c
--- a/arch/sparc/kernel/muldiv.c	2004-06-02 23:27:00 -07:00
+++ b/arch/sparc/kernel/muldiv.c	2004-06-02 23:27:00 -07:00
@@ -54,25 +54,25 @@
 	}
 }
 
-#define fetch_reg(reg, regs) ({							\
-	struct reg_window *win;							\
-	register unsigned long ret;						\
-										\
-	if (!(reg)) ret = 0;							\
-	else if((reg) < 16) {							\
-		ret = regs->u_regs[(reg)];					\
-	} else {								\
-		/* Ho hum, the slightly complicated case. */			\
-		win = (struct reg_window *)regs->u_regs[UREG_FP];		\
-		if (get_user (ret, &win->locals[(reg) - 16])) return -1;	\
-	}									\
-	ret;									\
+#define fetch_reg(reg, regs) ({						\
+	struct reg_window __user *win;					\
+	register unsigned long ret;					\
+									\
+	if (!(reg)) ret = 0;						\
+	else if ((reg) < 16) {						\
+		ret = regs->u_regs[(reg)];				\
+	} else {							\
+		/* Ho hum, the slightly complicated case. */		\
+		win = (struct reg_window __user *)regs->u_regs[UREG_FP];\
+		if (get_user (ret, &win->locals[(reg) - 16])) return -1;\
+	}								\
+	ret;								\
 })
 
 static inline int
 store_reg(unsigned int result, unsigned int reg, struct pt_regs *regs)
 {
-	struct reg_window *win;
+	struct reg_window __user *win;
 
 	if (!reg)
 		return 0;
@@ -81,7 +81,7 @@
 		return 0;
 	} else {
 		/* need to use put_user() in this case: */
-		win = (struct reg_window *)regs->u_regs[UREG_FP];
+		win = (struct reg_window __user *) regs->u_regs[UREG_FP];
 		return (put_user(result, &win->locals[reg - 16]));
 	}
 }
@@ -89,23 +89,30 @@
 extern void handle_hw_divzero (struct pt_regs *regs, unsigned long pc,
 			       unsigned long npc, unsigned long psr);
 
-/* Should return 0 if mul/div emulation succeeded and SIGILL should not be issued */
+/* Should return 0 if mul/div emulation succeeded and SIGILL should
+ * not be issued.
+ */
 int do_user_muldiv(struct pt_regs *regs, unsigned long pc)
 {
 	unsigned int insn;
 	int inst;
 	unsigned int rs1, rs2, rdv;
 
-	if (!pc) return -1; /* This happens to often, I think */
-	if (get_user (insn, (unsigned int *)pc)) return -1;
-	if ((insn & 0xc1400000) != 0x80400000) return -1;
+	if (!pc)
+		return -1; /* This happens to often, I think */
+	if (get_user (insn, (unsigned int __user *)pc))
+		return -1;
+	if ((insn & 0xc1400000) != 0x80400000)
+		return -1;
 	inst = ((insn >> 19) & 0xf);
-	if ((inst & 0xe) != 10 && (inst & 0xe) != 14) return -1;
+	if ((inst & 0xe) != 10 && (inst & 0xe) != 14)
+		return -1;
+
 	/* Now we know we have to do something with umul, smul, udiv or sdiv */
 	rs1 = (insn >> 14) & 0x1f;
 	rs2 = insn & 0x1f;
 	rdv = (insn >> 25) & 0x1f;
-	if(has_imm13(insn)) {
+	if (has_imm13(insn)) {
 		maybe_flush_windows(rs1, 0, rdv);
 		rs2 = sign_extend_imm13(insn);
 	} else {
diff -Nru a/arch/sparc/kernel/process.c b/arch/sparc/kernel/process.c
--- a/arch/sparc/kernel/process.c	2004-06-02 23:26:58 -07:00
+++ b/arch/sparc/kernel/process.c	2004-06-02 23:26:58 -07:00
@@ -400,23 +400,30 @@
 	}
 }
 
-static __inline__ struct sparc_stackf *
-clone_stackframe(struct sparc_stackf *dst, struct sparc_stackf *src)
+static __inline__ struct sparc_stackf __user *
+clone_stackframe(struct sparc_stackf __user *dst,
+		 struct sparc_stackf __user *src)
 {
-	unsigned long size;
-	struct sparc_stackf *sp;
-
-	size = ((unsigned long)src->fp) - ((unsigned long)src);
-	sp = (struct sparc_stackf *)(((unsigned long)dst) - size); 
+	unsigned long size, fp;
+	struct sparc_stackf *tmp;
+	struct sparc_stackf __user *sp;
+
+	if (get_user(tmp, &src->fp))
+		return NULL;
+
+	fp = (unsigned long) tmp;
+	size = (fp - ((unsigned long) src));
+	fp = (unsigned long) dst;
+	sp = (struct sparc_stackf __user *)(fp - size); 
 
 	/* do_fork() grabs the parent semaphore, we must release it
 	 * temporarily so we can build the child clone stack frame
 	 * without deadlocking.
 	 */
-	if (copy_to_user(sp, src, size))
-		sp = (struct sparc_stackf *) 0;
-	else if (put_user(dst, &sp->fp))
-		sp = (struct sparc_stackf *) 0;
+	if (__copy_user(sp, src, size))
+		sp = NULL;
+	else if (put_user(fp, &sp->fp))
+		sp = NULL;
 
 	return sp;
 }
@@ -435,8 +442,8 @@
 
 	return do_fork(clone_flags, stack_start,
 		       regs, stack_size,
-		       (int *) parent_tid_ptr,
-		       (int *) child_tid_ptr);
+		       (int __user *) parent_tid_ptr,
+		       (int __user *) child_tid_ptr);
 }
 
 /* Copy a Sparc thread.  The fork() return value conventions
@@ -519,15 +526,17 @@
 		p->thread.current_ds = USER_DS;
 
 		if (sp != regs->u_regs[UREG_FP]) {
-			struct sparc_stackf *childstack;
-			struct sparc_stackf *parentstack;
+			struct sparc_stackf __user *childstack;
+			struct sparc_stackf __user *parentstack;
 
 			/*
 			 * This is a clone() call with supplied user stack.
 			 * Set some valid stack frames to give to the child.
 			 */
-			childstack = (struct sparc_stackf *) (sp & ~0x7UL);
-			parentstack = (struct sparc_stackf *) regs->u_regs[UREG_FP];
+			childstack = (struct sparc_stackf __user *)
+				(sp & ~0x7UL);
+			parentstack = (struct sparc_stackf __user *)
+				regs->u_regs[UREG_FP];
 
 #if 0
 			printk("clone: parent stack:\n");
@@ -654,12 +663,14 @@
 	if(regs->u_regs[UREG_G1] == 0)
 		base = 1;
 
-	filename = getname((char *)regs->u_regs[base + UREG_I0]);
+	filename = getname((char __user *)regs->u_regs[base + UREG_I0]);
 	error = PTR_ERR(filename);
 	if(IS_ERR(filename))
 		goto out;
-	error = do_execve(filename, (char **) regs->u_regs[base + UREG_I1],
-			  (char **) regs->u_regs[base + UREG_I2], regs);
+	error = do_execve(filename,
+			  (char __user * __user *)regs->u_regs[base + UREG_I1],
+			  (char __user * __user *)regs->u_regs[base + UREG_I2],
+			  regs);
 	putname(filename);
 	if (error == 0)
 		current->ptrace &= ~PT_DTRACE;
@@ -679,25 +690,25 @@
 {
 	long retval;
 
-	__asm__ __volatile("mov %4, %%g2\n\t"    /* Set aside fn ptr... */
-			   "mov %5, %%g3\n\t"    /* and arg. */
-			   "mov %1, %%g1\n\t"
-			   "mov %2, %%o0\n\t"    /* Clone flags. */
-			   "mov 0, %%o1\n\t"     /* usp arg == 0 */
-			   "t 0x10\n\t"          /* Linux/Sparc clone(). */
-			   "cmp %%o1, 0\n\t"
-			   "be 1f\n\t"           /* The parent, just return. */
-			   " nop\n\t"            /* Delay slot. */
-			   "jmpl %%g2, %%o7\n\t" /* Call the function. */
-			   " mov %%g3, %%o0\n\t" /* Get back the arg in delay. */
-			   "mov %3, %%g1\n\t"
-			   "t 0x10\n\t"          /* Linux/Sparc exit(). */
-			   /* Notreached by child. */
-			   "1: mov %%o0, %0\n\t" :
-			   "=r" (retval) :
-			   "i" (__NR_clone), "r" (flags | CLONE_VM | CLONE_UNTRACED),
-			   "i" (__NR_exit),  "r" (fn), "r" (arg) :
-			   "g1", "g2", "g3", "o0", "o1", "memory", "cc");
+	__asm__ __volatile__("mov %4, %%g2\n\t"    /* Set aside fn ptr... */
+			     "mov %5, %%g3\n\t"    /* and arg. */
+			     "mov %1, %%g1\n\t"
+			     "mov %2, %%o0\n\t"    /* Clone flags. */
+			     "mov 0, %%o1\n\t"     /* usp arg == 0 */
+			     "t 0x10\n\t"          /* Linux/Sparc clone(). */
+			     "cmp %%o1, 0\n\t"
+			     "be 1f\n\t"           /* The parent, just return. */
+			     " nop\n\t"            /* Delay slot. */
+			     "jmpl %%g2, %%o7\n\t" /* Call the function. */
+			     " mov %%g3, %%o0\n\t" /* Get back the arg in delay. */
+			     "mov %3, %%g1\n\t"
+			     "t 0x10\n\t"          /* Linux/Sparc exit(). */
+			     /* Notreached by child. */
+			     "1: mov %%o0, %0\n\t" :
+			     "=r" (retval) :
+			     "i" (__NR_clone), "r" (flags | CLONE_VM | CLONE_UNTRACED),
+			     "i" (__NR_exit),  "r" (fn), "r" (arg) :
+			     "g1", "g2", "g3", "o0", "o1", "memory", "cc");
 	return retval;
 }
 
diff -Nru a/arch/sparc/kernel/ptrace.c b/arch/sparc/kernel/ptrace.c
--- a/arch/sparc/kernel/ptrace.c	2004-06-02 23:27:00 -07:00
+++ b/arch/sparc/kernel/ptrace.c	2004-06-02 23:27:00 -07:00
@@ -50,8 +50,10 @@
 static void
 pt_succ_return_linux(struct pt_regs *regs, unsigned long value, long *addr)
 {
-	if(put_user(value, addr))
-		return pt_error_return(regs, EFAULT);
+	if (put_user(value, (long __user *) addr)) {
+		pt_error_return(regs, EFAULT);
+		return;
+	}
 	regs->u_regs[UREG_I0] = 0;
 	regs->psr &= ~PSR_C;
 	regs->pc = regs->npc;
@@ -368,7 +370,7 @@
 	}
 
 	case PTRACE_GETREGS: {
-		struct pt_regs *pregs = (struct pt_regs *) addr;
+		struct pt_regs __user *pregs = (struct pt_regs __user *) addr;
 		struct pt_regs *cregs = child->thread.kregs;
 		int rval;
 
@@ -391,7 +393,7 @@
 	}
 
 	case PTRACE_SETREGS: {
-		struct pt_regs *pregs = (struct pt_regs *) addr;
+		struct pt_regs __user *pregs = (struct pt_regs __user *) addr;
 		struct pt_regs *cregs = child->thread.kregs;
 		unsigned long psr, pc, npc, y;
 		int i;
@@ -433,7 +435,8 @@
 				unsigned long *insnaddr;
 				unsigned long insn;
 			} fpq[16];
-		} *fps = (struct fps *) addr;
+		};
+		struct fps __user *fps = (struct fps __user *) addr;
 		int i;
 
 		i = verify_area(VERIFY_WRITE, fps, sizeof(struct fps));
@@ -467,7 +470,8 @@
 				unsigned long *insnaddr;
 				unsigned long insn;
 			} fpq[16];
-		} *fps = (struct fps *) addr;
+		};
+		struct fps __user *fps = (struct fps __user *) addr;
 		int i;
 
 		i = verify_area(VERIFY_READ, fps, sizeof(struct fps));
@@ -489,7 +493,8 @@
 
 	case PTRACE_READTEXT:
 	case PTRACE_READDATA: {
-		int res = ptrace_readdata(child, addr, (void *) addr2, data);
+		int res = ptrace_readdata(child, addr,
+					  (void __user *) addr2, data);
 
 		if (res == data) {
 			pt_succ_return(regs, 0);
@@ -504,7 +509,8 @@
 
 	case PTRACE_WRITETEXT:
 	case PTRACE_WRITEDATA: {
-		int res = ptrace_writedata(child, (void *) addr2, addr, data);
+		int res = ptrace_writedata(child, (void __user *) addr2,
+					   addr, data);
 
 		if (res == data) {
 			pt_succ_return(regs, 0);
diff -Nru a/arch/sparc/kernel/signal.c b/arch/sparc/kernel/signal.c
--- a/arch/sparc/kernel/signal.c	2004-06-02 23:27:00 -07:00
+++ b/arch/sparc/kernel/signal.c	2004-06-02 23:27:00 -07:00
@@ -234,7 +234,7 @@
 	if (verify_area(VERIFY_READ, sf, sizeof(*sf)))
 		goto segv_and_exit;
 
-	if (((uint) sf) & 3)
+	if (((unsigned long) sf) & 3)
 		goto segv_and_exit;
 
 	err = __get_user(pc,  &sf->info.si_regs.pc);
@@ -289,8 +289,10 @@
 
 	synchronize_user_stack();
 
-	if (current->thread.new_signal)
-		return do_new_sigreturn(regs);
+	if (current->thread.new_signal) {
+		do_new_sigreturn(regs);
+		return;
+	}
 
 	scptr = (struct sigcontext __user *) regs->u_regs[UREG_I0];
 
@@ -347,6 +349,7 @@
 	struct rt_signal_frame __user *sf;
 	unsigned int psr, pc, npc;
 	__siginfo_fpu_t __user *fpu_save;
+	mm_segment_t old_fs;
 	sigset_t set;
 	stack_t st;
 	int err;
@@ -386,7 +389,10 @@
 	/* It is more difficult to avoid calling this function than to
 	 * call it and ignore errors.
 	 */
-	do_sigaltstack(&st, NULL, (unsigned long)sf);
+	old_fs = get_fs();
+	set_fs(KERNEL_DS);
+	do_sigaltstack((const stack_t __user *) &st, NULL, (unsigned long)sf);
+	set_fs(old_fs);
 
 	sigdelsetmask(&set, ~_BLOCKABLE);
 	spin_lock_irq(&current->sighand->siglock);
@@ -849,7 +855,7 @@
 
 	/* Arguments passed to signal handler */
 	if (regs->u_regs[14]){
-		struct reg_window *rw = (struct reg_window __user *)
+		struct reg_window __user *rw = (struct reg_window __user *)
 			regs->u_regs[14];
 
 		err |= __put_user(signr, &rw->ins[0]);
@@ -860,8 +866,8 @@
 			goto sigsegv;
 
 		regs->u_regs[UREG_I0] = signr;
-		regs->u_regs[UREG_I1] = (uint) si;
-		regs->u_regs[UREG_I2] = (uint) uc;
+		regs->u_regs[UREG_I1] = (unsigned long) si;
+		regs->u_regs[UREG_I2] = (unsigned long) uc;
 	}
 	return;
 
@@ -932,6 +938,7 @@
 {
 	svr4_gregset_t  __user *gr;
 	unsigned long pc, npc, psr;
+	mm_segment_t old_fs;
 	sigset_t set;
 	svr4_sigset_t setv;
 	int err;
@@ -945,7 +952,7 @@
 	if (current_thread_info()->w_saved)
 		goto sigsegv_and_return;
 
-	if (((uint) c) & 3)
+	if (((unsigned long) c) & 3)
 		goto sigsegv_and_return;
 
 	if (!__access_ok((unsigned long)c, sizeof(*c)))
@@ -977,7 +984,11 @@
 		
 	/* It is more difficult to avoid calling this function than to
 	   call it and ignore errors.  */
-	do_sigaltstack(&st, NULL, regs->u_regs[UREG_I6]);
+	old_fs = get_fs();
+	set_fs(KERNEL_DS);
+	do_sigaltstack((const stack_t __user *) &st, NULL,
+		       regs->u_regs[UREG_I6]);
+	set_fs(old_fs);
 	
 	set.sig[0] = setv.sigbits[0];
 	set.sig[1] = setv.sigbits[1];
diff -Nru a/arch/sparc/kernel/sunos_ioctl.c b/arch/sparc/kernel/sunos_ioctl.c
--- a/arch/sparc/kernel/sunos_ioctl.c	2004-06-02 23:27:00 -07:00
+++ b/arch/sparc/kernel/sunos_ioctl.c	2004-06-02 23:27:00 -07:00
@@ -41,18 +41,19 @@
 		goto out;
 
 	/* First handle an easy compat. case for tty ldisc. */
-	if(cmd == TIOCSETD) {
-		int *p, ntty = N_TTY, tmp;
+	if (cmd == TIOCSETD) {
+		int __user *p;
+		int ntty = N_TTY, tmp;
 		mm_segment_t oldfs;
 
-		p = (int *) arg;
+		p = (int __user *) arg;
 		ret = -EFAULT;
-		if(get_user(tmp, p))
+		if (get_user(tmp, p))
 			goto out;
-		if(tmp == 2) {
+		if (tmp == 2) {
 			oldfs = get_fs();
 			set_fs(KERNEL_DS);
-			ret = sys_ioctl(fd, cmd, (int) &ntty);
+			ret = sys_ioctl(fd, cmd, (unsigned long) &ntty);
 			set_fs(oldfs);
 			ret = (ret == -EINVAL ? -EOPNOTSUPP : ret);
 			goto out;
@@ -60,7 +61,7 @@
 	}
 
 	/* Binary compatibility is good American knowhow fuckin' up. */
-	if(cmd == TIOCNOTTY) {
+	if (cmd == TIOCNOTTY) {
 		ret = sys_setsid();
 		goto out;
 	}
@@ -176,39 +177,39 @@
 		goto out;
 	/* Non posix grp */
 	case _IOW('t', 118, int): {
-		int oldval, newval, *ptr;
+		int oldval, newval, __user *ptr;
 
 		cmd = TIOCSPGRP;
-		ptr = (int *) arg;
+		ptr = (int __user *) arg;
 		ret = -EFAULT;
-		if(get_user(oldval, ptr))
+		if (get_user(oldval, ptr))
 			goto out;
 		ret = sys_ioctl(fd, cmd, arg);
 		__get_user(newval, ptr);
-		if(newval == -1) {
+		if (newval == -1) {
 			__put_user(oldval, ptr);
 			ret = -EIO;
 		}
-		if(ret == -ENOTTY)
+		if (ret == -ENOTTY)
 			ret = -EIO;
 		goto out;
 	}
 
 	case _IOR('t', 119, int): {
-		int oldval, newval, *ptr;
+		int oldval, newval, __user *ptr;
 
 		cmd = TIOCGPGRP;
-		ptr = (int *) arg;
+		ptr = (int __user *) arg;
 		ret = -EFAULT;
-		if(get_user(oldval, ptr))
+		if (get_user(oldval, ptr))
 			goto out;
 		ret = sys_ioctl(fd, cmd, arg);
 		__get_user(newval, ptr);
-		if(newval == -1) {
+		if (newval == -1) {
 			__put_user(oldval, ptr);
 			ret = -EIO;
 		}
-		if(ret == -ENOTTY)
+		if (ret == -ENOTTY)
 			ret = -EIO;
 		goto out;
 	}
diff -Nru a/arch/sparc/kernel/sys_sparc.c b/arch/sparc/kernel/sys_sparc.c
--- a/arch/sparc/kernel/sys_sparc.c	2004-06-02 23:26:59 -07:00
+++ b/arch/sparc/kernel/sys_sparc.c	2004-06-02 23:26:59 -07:00
@@ -136,7 +136,8 @@
 			if (!ptr)
 				goto out;
 			err = -EFAULT;
-			if(get_user(fourth.__pad, (void __user **)ptr))
+			if (get_user(fourth.__pad,
+				     (void __user * __user *)ptr))
 				goto out;
 			err = sys_semctl (first, second, third, fourth);
 			goto out;
@@ -165,7 +166,9 @@
 				goto out;
 				}
 			case 1: default:
-				err = sys_msgrcv (first, (struct msgbuf *) ptr, second, fifth, third);
+				err = sys_msgrcv (first,
+						  (struct msgbuf __user *) ptr,
+						  second, fifth, third);
 				goto out;
 			}
 		case MSGGET:
@@ -194,7 +197,8 @@
 				goto out;
 				}
 			case 1:	/* iBCS2 emulator entry point */
-				err = do_shmat (first, (char __user *) ptr, second, (ulong __user *) third);
+				err = do_shmat (first, (char __user *) ptr,
+						second, (ulong *) third);
 				goto out;
 			}
 		case SHMDT: 
diff -Nru a/arch/sparc/kernel/sys_sunos.c b/arch/sparc/kernel/sys_sunos.c
--- a/arch/sparc/kernel/sys_sunos.c	2004-06-02 23:26:59 -07:00
+++ b/arch/sparc/kernel/sys_sunos.c	2004-06-02 23:26:59 -07:00
@@ -71,7 +71,7 @@
 	struct file * file = NULL;
 	unsigned long retval, ret_type;
 
-	if(flags & MAP_NORESERVE) {
+	if (flags & MAP_NORESERVE) {
 		static int cnt;
 		if (cnt++ < 10)
 			printk("%s: unimplemented SunOS MAP_NORESERVE mmap() flag\n",
@@ -79,7 +79,7 @@
 		flags &= ~MAP_NORESERVE;
 	}
 	retval = -EBADF;
-	if(!(flags & MAP_ANONYMOUS)) {
+	if (!(flags & MAP_ANONYMOUS)) {
 		if (fd >= SUNOS_NR_OPEN)
 			goto out;
 		file = fget(fd);
@@ -93,8 +93,8 @@
 	 * SunOS is so stupid some times... hmph!
 	 */
 	if (file) {
-		if(imajor(file->f_dentry->d_inode) == MEM_MAJOR &&
-		   iminor(file->f_dentry->d_inode) == 5) {
+		if (imajor(file->f_dentry->d_inode) == MEM_MAJOR &&
+		    iminor(file->f_dentry->d_inode) == 5) {
 			flags |= MAP_ANONYMOUS;
 			fput(file);
 			file = 0;
@@ -103,7 +103,7 @@
 	ret_type = flags & _MAP_NEW;
 	flags &= ~_MAP_NEW;
 
-	if(!(flags & MAP_FIXED))
+	if (!(flags & MAP_FIXED))
 		addr = 0;
 	else {
 		if (ARCH_SUN4C_SUN4 &&
@@ -122,7 +122,7 @@
 	down_write(&current->mm->mmap_sem);
 	retval = do_mmap(file, addr, len, prot, flags, off);
 	up_write(&current->mm->mmap_sem);
-	if(!ret_type)
+	if (!ret_type)
 		retval = ((retval < PAGE_OFFSET) ? 0 : retval);
 
 out_putf:
@@ -149,8 +149,8 @@
 	unsigned long newbrk, oldbrk;
 
 	down_write(&current->mm->mmap_sem);
-	if(ARCH_SUN4C_SUN4) {
-		if(brk >= 0x20000000 && brk < 0xe0000000) {
+	if (ARCH_SUN4C_SUN4) {
+		if (brk >= 0x20000000 && brk < 0xe0000000) {
 			goto out;
 		}
 	}
@@ -223,7 +223,7 @@
 	lock_kernel();
 	oldbrk = current->mm->brk;
 	error = sunos_brk(((int) current->mm->brk) + increment);
-	if(!error)
+	if (!error)
 		error = oldbrk;
 	unlock_kernel();
 	return error;
@@ -314,20 +314,20 @@
 };
 
 struct sunos_dirent_callback {
-    struct sunos_dirent *curr;
-    struct sunos_dirent *previous;
+    struct sunos_dirent __user *curr;
+    struct sunos_dirent __user *previous;
     int count;
     int error;
 };
 
-#define NAME_OFFSET(de) ((int) ((de)->d_name - (char *) (de)))
+#define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de)))
 #define ROUND_UP(x) (((x)+sizeof(long)-1) & ~(sizeof(long)-1))
 
 static int sunos_filldir(void * __buf, const char * name, int namlen,
 			 loff_t offset, ino_t ino, unsigned int d_type)
 {
-	struct sunos_dirent * dirent;
-	struct sunos_dirent_callback * buf = (struct sunos_dirent_callback *) __buf;
+	struct sunos_dirent __user *dirent;
+	struct sunos_dirent_callback * buf = __buf;
 	int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1);
 
 	buf->error = -EINVAL;	/* only used if we fail.. */
@@ -343,16 +343,16 @@
 	put_user(reclen, &dirent->d_reclen);
 	copy_to_user(dirent->d_name, name, namlen);
 	put_user(0, dirent->d_name + namlen);
-	dirent = (void *)dirent + reclen;
+	dirent = (void __user *) dirent + reclen;
 	buf->curr = dirent;
 	buf->count -= reclen;
 	return 0;
 }
 
-asmlinkage int sunos_getdents(unsigned int fd, void * dirent, int cnt)
+asmlinkage int sunos_getdents(unsigned int fd, void __user *dirent, int cnt)
 {
 	struct file * file;
-	struct sunos_dirent * lastdirent;
+	struct sunos_dirent __user *lastdirent;
 	struct sunos_dirent_callback buf;
 	int error = -EBADF;
 
@@ -367,7 +367,7 @@
 	if (cnt < (sizeof(struct sunos_dirent) + 255))
 		goto out_putf;
 
-	buf.curr = (struct sunos_dirent *) dirent;
+	buf.curr = (struct sunos_dirent __user *) dirent;
 	buf.previous = NULL;
 	buf.count = cnt;
 	buf.error = 0;
@@ -398,8 +398,8 @@
 };
 
 struct sunos_direntry_callback {
-    struct sunos_direntry *curr;
-    struct sunos_direntry *previous;
+    struct sunos_direntry __user *curr;
+    struct sunos_direntry __user *previous;
     int count;
     int error;
 };
@@ -407,8 +407,8 @@
 static int sunos_filldirentry(void * __buf, const char * name, int namlen,
 			      loff_t offset, ino_t ino, unsigned int d_type)
 {
-	struct sunos_direntry * dirent;
-	struct sunos_direntry_callback * buf = (struct sunos_direntry_callback *) __buf;
+	struct sunos_direntry __user *dirent;
+	struct sunos_direntry_callback *buf = __buf;
 	int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1);
 
 	buf->error = -EINVAL;	/* only used if we fail.. */
@@ -422,16 +422,17 @@
 	put_user(reclen, &dirent->d_reclen);
 	copy_to_user(dirent->d_name, name, namlen);
 	put_user(0, dirent->d_name + namlen);
-	dirent = (void *)dirent + reclen;
+	dirent = (void __user *) dirent + reclen;
 	buf->curr = dirent;
 	buf->count -= reclen;
 	return 0;
 }
 
-asmlinkage int sunos_getdirentries(unsigned int fd, void * dirent, int cnt, unsigned int *basep)
+asmlinkage int sunos_getdirentries(unsigned int fd, void __user *dirent,
+				   int cnt, unsigned int __user *basep)
 {
 	struct file * file;
-	struct sunos_direntry * lastdirent;
+	struct sunos_direntry __user *lastdirent;
 	struct sunos_direntry_callback buf;
 	int error = -EBADF;
 
@@ -443,10 +444,10 @@
 		goto out;
 
 	error = -EINVAL;
-	if(cnt < (sizeof(struct sunos_direntry) + 255))
+	if (cnt < (sizeof(struct sunos_direntry) + 255))
 		goto out_putf;
 
-	buf.curr = (struct sunos_direntry *) dirent;
+	buf.curr = (struct sunos_direntry __user *) dirent;
 	buf.previous = NULL;
 	buf.count = cnt;
 	buf.error = 0;
@@ -477,7 +478,7 @@
 	char mach[9];
 };
 
-asmlinkage int sunos_uname(struct sunos_utsname *name)
+asmlinkage int sunos_uname(struct sunos_utsname __user *name)
 {
 	int ret;
 	down_read(&uts_sem);
@@ -556,7 +557,7 @@
 	return ret;
 }
 
-asmlinkage int sunos_pathconf(char *path, int name)
+asmlinkage int sunos_pathconf(char __user *path, int name)
 {
 	int ret;
 
@@ -566,7 +567,8 @@
 
 /* SunOS mount system call emulation */
 
-asmlinkage int sunos_select(int width, fd_set *inp, fd_set *outp, fd_set *exp, struct timeval *tvp)
+asmlinkage int sunos_select(int width, fd_set __user *inp, fd_set __user *outp,
+			    fd_set __user *exp, struct timeval __user *tvp)
 {
 	int ret;
 
@@ -604,19 +606,19 @@
 };
 
 struct sunos_nfs_mount_args {
-	struct sockaddr_in  *addr; /* file server address */
-	struct nfs_fh *fh;     /* File handle to be mounted */
+	struct sockaddr_in  __user *addr; /* file server address */
+	struct nfs_fh __user *fh;     /* File handle to be mounted */
 	int        flags;      /* flags */
 	int        wsize;      /* write size in bytes */
 	int        rsize;      /* read size in bytes */
 	int        timeo;      /* initial timeout in .1 secs */
 	int        retrans;    /* times to retry send */
-	char       *hostname;  /* server's hostname */
+	char       __user *hostname;  /* server's hostname */
 	int        acregmin;   /* attr cache file min secs */
 	int        acregmax;   /* attr cache file max secs */
 	int        acdirmin;   /* attr cache dir min secs */
 	int        acdirmax;   /* attr cache dir max secs */
-	char       *netname;   /* server's netname */
+	char       __user *netname;   /* server's netname */
 };
 
 
@@ -680,7 +682,7 @@
 	return def_value;
 }
 
-static int sunos_nfs_mount(char *dir_name, int linux_flags, void *data)
+static int sunos_nfs_mount(char *dir_name, int linux_flags, void __user *data)
 {
 	int  server_fd, err;
 	char *the_name, *mount_page;
@@ -729,7 +731,7 @@
 	linux_nfs_mount.acdirmax = sunos_mount.acdirmax;
 
 	the_name = getname(sunos_mount.hostname);
-	if(IS_ERR(the_name))
+	if (IS_ERR(the_name))
 		return PTR_ERR(the_name);
 
 	strlcpy(linux_nfs_mount.hostname, the_name,
@@ -749,7 +751,7 @@
 }
 
 asmlinkage int
-sunos_mount(char *type, char *dir, int flags, void *data)
+sunos_mount(char __user *type, char __user *dir, int flags, void __user *data)
 {
 	int linux_flags = 0;
 	int ret = -EINVAL;
@@ -768,11 +770,11 @@
 	if (flags & (SMNT_GRPID|SMNT_NOSUB|SMNT_MULTI|SMNT_SYS5))
 		goto out;
 
-	if(flags & SMNT_REMOUNT)
+	if (flags & SMNT_REMOUNT)
 		linux_flags |= MS_REMOUNT;
-	if(flags & SMNT_RDONLY)
+	if (flags & SMNT_RDONLY)
 		linux_flags |= MS_RDONLY;
-	if(flags & SMNT_NOSUID)
+	if (flags & SMNT_NOSUID)
 		linux_flags |= MS_NOSUID;
 
 	dir_page = getname(dir);
@@ -785,20 +787,20 @@
 	if (IS_ERR(type_page))
 		goto out1;
 
-	if(strcmp(type_page, "ext2") == 0) {
+	if (strcmp(type_page, "ext2") == 0) {
 		dev_fname = getname(data);
-	} else if(strcmp(type_page, "iso9660") == 0) {
+	} else if (strcmp(type_page, "iso9660") == 0) {
 		dev_fname = getname(data);
-	} else if(strcmp(type_page, "minix") == 0) {
+	} else if (strcmp(type_page, "minix") == 0) {
 		dev_fname = getname(data);
-	} else if(strcmp(type_page, "nfs") == 0) {
+	} else if (strcmp(type_page, "nfs") == 0) {
 		ret = sunos_nfs_mount (dir_page, flags, data);
 		goto out2;
-        } else if(strcmp(type_page, "ufs") == 0) {
+        } else if (strcmp(type_page, "ufs") == 0) {
 		printk("Warning: UFS filesystem mounts unsupported.\n");
 		ret = -ENODEV;
 		goto out2;
-	} else if(strcmp(type_page, "proc")) {
+	} else if (strcmp(type_page, "proc")) {
 		ret = -ENODEV;
 		goto out2;
 	}
@@ -823,8 +825,8 @@
 	int ret;
 
 	/* So stupid... */
-	if((!pid || pid == current->pid) &&
-	   !pgid) {
+	if ((!pid || pid == current->pid) &&
+	    !pgid) {
 		sys_setsid();
 		ret = 0;
 	} else {
@@ -834,7 +836,8 @@
 }
 
 /* So stupid... */
-asmlinkage int sunos_wait4(pid_t pid, unsigned int *stat_addr, int options, struct rusage *ru)
+asmlinkage int sunos_wait4(pid_t pid, unsigned int __user *stat_addr,
+			   int options, struct rusage __user*ru)
 {
 	int ret;
 
@@ -861,7 +864,7 @@
 	return -1;
 }
 
-extern asmlinkage unsigned long sunos_gethostid(void)
+asmlinkage unsigned long sunos_gethostid(void)
 {
 	unsigned long ret;
 
@@ -882,7 +885,7 @@
 #define   _SC_SAVED_IDS           7
 #define   _SC_VERSION             8
 
-extern asmlinkage long sunos_sysconf (int name)
+asmlinkage long sunos_sysconf (int name)
 {
 	long ret;
 
@@ -947,7 +950,8 @@
 			arg3=SETALL; break;
 		}
 		/* sys_semctl(): */
-		arg4.__pad=ptr; /* value to modify semaphore to */
+		/* value to modify semaphore to */
+		arg4.__pad = (void __user *) ptr;
 		ret = sys_semctl((int)arg1, (int)arg2, (int)arg3, arg4 );
 		break;
 	case 1:
@@ -956,7 +960,7 @@
 		break;
 	case 2:
 		/* sys_semop(): */
-		ret = sys_semop((int)arg1, (struct sembuf *)arg2, (unsigned)arg3);
+		ret = sys_semop((int)arg1, (struct sembuf __user *)arg2, (unsigned)arg3);
 		break;
 	default:
 		ret = -EINVAL;
@@ -978,18 +982,18 @@
 		break;
 	case 1:
 		rval = sys_msgctl((int)arg1, (int)arg2,
-				  (struct msqid_ds *)arg3);
+				  (struct msqid_ds __user *)arg3);
 		break;
 	case 2:
 		lock_kernel();
 		sp = (struct sparc_stackf *)current->thread.kregs->u_regs[UREG_FP];
 		arg5 = sp->xxargs[0];
 		unlock_kernel();
-		rval = sys_msgrcv((int)arg1, (struct msgbuf *)arg2,
+		rval = sys_msgrcv((int)arg1, (struct msgbuf __user *)arg2,
 				  (size_t)arg3, (long)arg4, (int)arg5);
 		break;
 	case 3:
-		rval = sys_msgsnd((int)arg1, (struct msgbuf *)arg2,
+		rval = sys_msgsnd((int)arg1, (struct msgbuf __user *)arg2,
 				  (size_t)arg3, (int)arg4);
 		break;
 	default:
@@ -1008,17 +1012,17 @@
 	switch(op) {
 	case 0:
 		/* do_shmat(): attach a shared memory area */
-		rval = do_shmat((int)arg1,(char *)arg2,(int)arg3,&raddr);
-		if(!rval)
+		rval = do_shmat((int)arg1,(char __user *)arg2,(int)arg3,&raddr);
+		if (!rval)
 			rval = (int) raddr;
 		break;
 	case 1:
 		/* sys_shmctl(): modify shared memory area attr. */
-		rval = sys_shmctl((int)arg1,(int)arg2,(struct shmid_ds *)arg3);
+		rval = sys_shmctl((int)arg1,(int)arg2,(struct shmid_ds __user *)arg3);
 		break;
 	case 2:
 		/* sys_shmdt(): detach a shared memory area */
-		rval = sys_shmdt((char *)arg1);
+		rval = sys_shmdt((char __user *)arg1);
 		break;
 	case 3:
 		/* sys_shmget(): get a shared memory area */
@@ -1051,7 +1055,7 @@
 	return ret;
 }
 
-asmlinkage int sunos_read(unsigned int fd,char *buf,int count)
+asmlinkage int sunos_read(unsigned int fd, char __user *buf, int count)
 {
 	int ret;
 
@@ -1059,7 +1063,8 @@
 	return ret;
 }
 
-asmlinkage int sunos_readv(unsigned long fd, const struct iovec * vector, long count)
+asmlinkage int sunos_readv(unsigned long fd, const struct iovec __user *vector,
+			   long count)
 {
 	int ret;
 
@@ -1067,7 +1072,7 @@
 	return ret;
 }
 
-asmlinkage int sunos_write(unsigned int fd,char *buf,int count)
+asmlinkage int sunos_write(unsigned int fd, char __user *buf, int count)
 {
 	int ret;
 
@@ -1075,7 +1080,8 @@
 	return ret;
 }
 
-asmlinkage int sunos_writev(unsigned long fd, const struct iovec * vector, long count)
+asmlinkage int sunos_writev(unsigned long fd,
+			    const struct iovec __user *vector, long count)
 {
 	int ret;
 
@@ -1083,7 +1089,7 @@
 	return ret;
 }
 
-asmlinkage int sunos_recv(int fd, void * ubuf, int size, unsigned flags)
+asmlinkage int sunos_recv(int fd, void __user *ubuf, int size, unsigned flags)
 {
 	int ret;
 
@@ -1091,7 +1097,7 @@
 	return ret;
 }
 
-asmlinkage int sunos_send(int fd, void * buff, int len, unsigned flags)
+asmlinkage int sunos_send(int fd, void __user *buff, int len, unsigned flags)
 {
 	int ret;
 
@@ -1099,7 +1105,8 @@
 	return ret;
 }
 
-asmlinkage int sunos_accept(int fd, struct sockaddr *sa, int *addrlen)
+asmlinkage int sunos_accept(int fd, struct sockaddr __user *sa,
+			    int __user *addrlen)
 {
 	int ret;
 
@@ -1115,13 +1122,13 @@
 #define SUNOS_SV_INTERRUPT 2
 
 asmlinkage int
-sunos_sigaction(int sig, const struct old_sigaction *act,
-		struct old_sigaction *oact)
+sunos_sigaction(int sig, const struct old_sigaction __user *act,
+		struct old_sigaction __user *oact)
 {
 	struct k_sigaction new_ka, old_ka;
 	int ret;
 
-	if(act) {
+	if (act) {
 		old_sigset_t mask;
 
 		if (verify_area(VERIFY_READ, act, sizeof(*act)) ||
@@ -1156,8 +1163,8 @@
 }
 
 
-asmlinkage int sunos_setsockopt(int fd, int level, int optname, char *optval,
-				int optlen)
+asmlinkage int sunos_setsockopt(int fd, int level, int optname,
+				char __user *optval, int optlen)
 {
 	int tr_opt = optname;
 	int ret;
@@ -1171,8 +1178,8 @@
 	return ret;
 }
 
-asmlinkage int sunos_getsockopt(int fd, int level, int optname, char *optval,
-				int *optlen)
+asmlinkage int sunos_getsockopt(int fd, int level, int optname,
+				char __user *optval, int __user *optlen)
 {
 	int tr_opt = optname;
 	int ret;
diff -Nru a/arch/sparc/kernel/unaligned.c b/arch/sparc/kernel/unaligned.c
--- a/arch/sparc/kernel/unaligned.c	2004-06-02 23:27:00 -07:00
+++ b/arch/sparc/kernel/unaligned.c	2004-06-02 23:27:00 -07:00
@@ -109,14 +109,14 @@
 
 static inline unsigned long safe_fetch_reg(unsigned int reg, struct pt_regs *regs)
 {
-	struct reg_window *win;
+	struct reg_window __user *win;
 	unsigned long ret;
 
-	if(reg < 16)
+	if (reg < 16)
 		return (!reg ? 0 : regs->u_regs[reg]);
 
 	/* Ho hum, the slightly complicated case. */
-	win = (struct reg_window *) regs->u_regs[UREG_FP];
+	win = (struct reg_window __user *) regs->u_regs[UREG_FP];
 
 	if ((unsigned long)win & 3)
 		return -1;
@@ -431,29 +431,32 @@
 	int retval, check = (dir == load) ? VERIFY_READ : VERIFY_WRITE;
 	int size = ((insn >> 19) & 3) == 3 ? 8 : 4;
 
-	if((regs->pc | regs->npc) & 3)
+	if ((regs->pc | regs->npc) & 3)
 		return 0;
 
 	/* Must verify_area() in all the necessary places. */
-#define WINREG_ADDR(regnum) ((void *)(((unsigned long *)regs->u_regs[UREG_FP])+(regnum)))
+#define WINREG_ADDR(regnum) \
+	((void __user *)(((unsigned long *)regs->u_regs[UREG_FP])+(regnum)))
+
 	retval = 0;
 	reg = (insn >> 25) & 0x1f;
-	if(reg >= 16) {
+	if (reg >= 16) {
 		retval = verify_area(check, WINREG_ADDR(reg - 16), size);
-		if(retval)
+		if (retval)
 			return retval;
 	}
 	reg = (insn >> 14) & 0x1f;
-	if(reg >= 16) {
+	if (reg >= 16) {
 		retval = verify_area(check, WINREG_ADDR(reg - 16), size);
-		if(retval)
+		if (retval)
 			return retval;
 	}
-	if(!(insn & 0x2000)) {
+	if (!(insn & 0x2000)) {
 		reg = (insn & 0x1f);
-		if(reg >= 16) {
-			retval = verify_area(check, WINREG_ADDR(reg - 16), size);
-			if(retval)
+		if (reg >= 16) {
+			retval = verify_area(check, WINREG_ADDR(reg - 16),
+					     size);
+			if (retval)
 				return retval;
 		}
 	}
diff -Nru a/arch/sparc/kernel/windows.c b/arch/sparc/kernel/windows.c
--- a/arch/sparc/kernel/windows.c	2004-06-02 23:26:59 -07:00
+++ b/arch/sparc/kernel/windows.c	2004-06-02 23:26:59 -07:00
@@ -69,8 +69,8 @@
 		unsigned long sp = tp->rwbuf_stkptrs[window];
 
 		/* Ok, let it rip. */
-		if(copy_to_user((char *) sp, &tp->reg_window[window],
-				sizeof(struct reg_window)))
+		if (copy_to_user((char __user *) sp, &tp->reg_window[window],
+				 sizeof(struct reg_window)))
 			continue;
 
 		shift_window_buffer(window, tp->w_saved - 1, tp);
@@ -117,8 +117,9 @@
 	for(window = 0; window < tp->w_saved; window++) {
 		unsigned long sp = tp->rwbuf_stkptrs[window];
 
-		if((sp & 7) ||
-		   copy_to_user((char *) sp, &tp->reg_window[window], sizeof(struct reg_window)))
+		if ((sp & 7) ||
+		    copy_to_user((char __user *) sp, &tp->reg_window[window],
+				 sizeof(struct reg_window)))
 			do_exit(SIGILL);
 	}
 	tp->w_saved = 0;
diff -Nru a/arch/sparc/math-emu/math.c b/arch/sparc/math-emu/math.c
--- a/arch/sparc/math-emu/math.c	2004-06-02 23:26:59 -07:00
+++ b/arch/sparc/math-emu/math.c	2004-06-02 23:26:59 -07:00
@@ -175,7 +175,7 @@
 #ifdef DEBUG_MATHEMU
 		printk("precise trap at %08lx\n", regs->pc);
 #endif
-		if (!get_user(insn, (u32 *)regs->pc)) {
+		if (!get_user(insn, (u32 __user *) regs->pc)) {
 			retcode = do_one_mathemu(insn, &fpt->thread.fsr, fpt->thread.float_regs);
 			if (retcode) {
 				/* in this case we need to fix up PC & nPC */
@@ -193,7 +193,7 @@
 			break;
 	}
 	/* Now empty the queue and clear the queue_not_empty flag */
-	if(retcode)
+	if (retcode)
 		fpt->thread.fsr &= ~(0x3000 | FSR_CEXC_MASK);
 	else
 		fpt->thread.fsr &= ~0x3000;
@@ -219,18 +219,18 @@
 	would_trap = (fsr & ((long)eflag << FSR_TEM_SHIFT)) != 0UL;
 
 	/* If trapping, we only want to signal one bit. */
-	if(would_trap != 0) {
+	if (would_trap != 0) {
 		eflag &= ((fsr & FSR_TEM_MASK) >> FSR_TEM_SHIFT);
-		if((eflag & (eflag - 1)) != 0) {
-			if(eflag & FP_EX_INVALID)
+		if ((eflag & (eflag - 1)) != 0) {
+			if (eflag & FP_EX_INVALID)
 				eflag = FP_EX_INVALID;
-			else if(eflag & FP_EX_OVERFLOW)
+			else if (eflag & FP_EX_OVERFLOW)
 				eflag = FP_EX_OVERFLOW;
-			else if(eflag & FP_EX_UNDERFLOW)
+			else if (eflag & FP_EX_UNDERFLOW)
 				eflag = FP_EX_UNDERFLOW;
-			else if(eflag & FP_EX_DIVZERO)
+			else if (eflag & FP_EX_DIVZERO)
 				eflag = FP_EX_DIVZERO;
-			else if(eflag & FP_EX_INEXACT)
+			else if (eflag & FP_EX_INEXACT)
 				eflag = FP_EX_INEXACT;
 		}
 	}
@@ -250,11 +250,11 @@
 	 *    CEXC just generated is OR'd into the
 	 *    existing value of AEXC.
 	 */
-	if(would_trap == 0)
+	if (would_trap == 0)
 		fsr |= ((long)eflag << FSR_AEXC_SHIFT);
 
 	/* If trapping, indicate fault trap type IEEE. */
-	if(would_trap != 0)
+	if (would_trap != 0)
 		fsr |= (1UL << 14);
 
 	*pfsr = fsr;
@@ -515,7 +515,7 @@
 		case 7: FP_PACK_QP (rd, QR); break;
 		}
 	}
-	if(_fex == 0)
+	if (_fex == 0)
 		return 1;				/* success! */
 	return record_exception(pfsr, _fex);
 }
diff -Nru a/arch/sparc/mm/fault.c b/arch/sparc/mm/fault.c
--- a/arch/sparc/mm/fault.c	2004-06-02 23:26:59 -07:00
+++ b/arch/sparc/mm/fault.c	2004-06-02 23:26:59 -07:00
@@ -412,10 +412,10 @@
 		address = regs->pc;
 	} else if (!write &&
 		   !(regs->psr & PSR_PS)) {
-		unsigned int insn, *ip;
+		unsigned int insn, __user *ip;
 
-		ip = (unsigned int *)regs->pc;
-		if (! get_user(insn, ip)) {
+		ip = (unsigned int __user *)regs->pc;
+		if (!get_user(insn, ip)) {
 			if ((insn & 0xc1680000) == 0xc0680000)
 				write = 1;
 		}
diff -Nru a/arch/sparc64/Makefile b/arch/sparc64/Makefile
--- a/arch/sparc64/Makefile	2004-06-02 23:27:00 -07:00
+++ b/arch/sparc64/Makefile	2004-06-02 23:27:00 -07:00
@@ -8,6 +8,8 @@
 # Copyright (C) 1998 Jakub Jelinek (jj@ultra.linux.cz)
 #
 
+CHECK		:= $(CHECK) -D__sparc__=1 -D__sparc_v9__=1
+
 AFLAGS_vmlinux.lds.o += -Usparc
 
 CC		:= $(shell if $(CC) -m64 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo $(CC); else echo sparc64-linux-gcc; fi )
diff -Nru a/arch/sparc64/defconfig b/arch/sparc64/defconfig
--- a/arch/sparc64/defconfig	2004-06-02 23:26:59 -07:00
+++ b/arch/sparc64/defconfig	2004-06-02 23:26:59 -07:00
@@ -864,8 +864,9 @@
 # CONFIG_VIA_RHINE_MMIO is not set
 
 #
-# Ethernet (1000 Mbit)
+# Gigabit Ethernet (1000/10000 Mbit)
 #
+CONFIG_NET_GIGE=y
 CONFIG_ACENIC=m
 # CONFIG_ACENIC_OMIT_TIGON_I is not set
 CONFIG_DL2K=m
@@ -878,10 +879,6 @@
 CONFIG_R8169=m
 CONFIG_SK98LIN=m
 CONFIG_TIGON3=m
-
-#
-# Ethernet (10000 Mbit)
-#
 CONFIG_IXGB=m
 CONFIG_IXGB_NAPI=y
 CONFIG_S2IO=m
@@ -1133,6 +1130,7 @@
 CONFIG_SENSORS_LM83=m
 CONFIG_SENSORS_LM85=m
 CONFIG_SENSORS_LM90=m
+CONFIG_SENSORS_MAX1619=m
 CONFIG_SENSORS_VIA686A=m
 CONFIG_SENSORS_W83781D=m
 CONFIG_SENSORS_W83L785TS=m
@@ -1255,6 +1253,7 @@
 CONFIG_SMB_FS=m
 # CONFIG_SMB_NLS_DEFAULT is not set
 CONFIG_CIFS=m
+# CONFIG_CIFS_STATS is not set
 CONFIG_NCP_FS=m
 # CONFIG_NCPFS_PACKET_SIGNING is not set
 # CONFIG_NCPFS_IOCTL_LOCKING is not set
diff -Nru a/arch/sparc64/kernel/ebus.c b/arch/sparc64/kernel/ebus.c
--- a/arch/sparc64/kernel/ebus.c	2004-06-02 23:26:59 -07:00
+++ b/arch/sparc64/kernel/ebus.c	2004-06-02 23:26:59 -07:00
@@ -509,7 +509,7 @@
 		fill_ebus_child(node, &regs[0],
 				child, child_regs_nonstandard(dev));
 
-		while ((node = prom_getsibling(node))) {
+		while ((node = prom_getsibling(node)) != 0) {
 			child->next = ebus_alloc(sizeof(struct linux_ebus_child));
 
 			child = child->next;
@@ -611,7 +611,7 @@
 		dev->bus = ebus;
 		fill_ebus_device(nd, dev);
 
-		while ((nd = prom_getsibling(nd))) {
+		while ((nd = prom_getsibling(nd)) != 0) {
 			dev->next = ebus_alloc(sizeof(struct linux_ebus_device));
 
 			dev = dev->next;
diff -Nru a/arch/sparc64/kernel/ioctl32.c b/arch/sparc64/kernel/ioctl32.c
--- a/arch/sparc64/kernel/ioctl32.c	2004-06-02 23:27:00 -07:00
+++ b/arch/sparc64/kernel/ioctl32.c	2004-06-02 23:27:00 -07:00
@@ -60,11 +60,11 @@
 	u32 r, g, b;
 	mm_segment_t old_fs = get_fs();
 	
-	ret = get_user(f.index, &(((struct fbcmap32 *)arg)->index));
-	ret |= __get_user(f.count, &(((struct fbcmap32 *)arg)->count));
-	ret |= __get_user(r, &(((struct fbcmap32 *)arg)->red));
-	ret |= __get_user(g, &(((struct fbcmap32 *)arg)->green));
-	ret |= __get_user(b, &(((struct fbcmap32 *)arg)->blue));
+	ret = get_user(f.index, &(((struct fbcmap32 __user *)arg)->index));
+	ret |= __get_user(f.count, &(((struct fbcmap32 __user *)arg)->count));
+	ret |= __get_user(r, &(((struct fbcmap32 __user *)arg)->red));
+	ret |= __get_user(g, &(((struct fbcmap32 __user *)arg)->green));
+	ret |= __get_user(b, &(((struct fbcmap32 __user *)arg)->blue));
 	if (ret)
 		return -EFAULT;
 	if ((f.index < 0) || (f.index > 255)) return -EINVAL;
@@ -113,16 +113,21 @@
 	u32 m, i;
 	mm_segment_t old_fs = get_fs();
 	
-	ret = copy_from_user (&f, (struct fbcursor32 *)arg, 2 * sizeof (short) + 2 * sizeof(struct fbcurpos));
-	ret |= __get_user(f.size.x, &(((struct fbcursor32 *)arg)->size.x));
-	ret |= __get_user(f.size.y, &(((struct fbcursor32 *)arg)->size.y));
-	ret |= __get_user(f.cmap.index, &(((struct fbcursor32 *)arg)->cmap.index));
-	ret |= __get_user(f.cmap.count, &(((struct fbcursor32 *)arg)->cmap.count));
-	ret |= __get_user(r, &(((struct fbcursor32 *)arg)->cmap.red));
-	ret |= __get_user(g, &(((struct fbcursor32 *)arg)->cmap.green));
-	ret |= __get_user(b, &(((struct fbcursor32 *)arg)->cmap.blue));
-	ret |= __get_user(m, &(((struct fbcursor32 *)arg)->mask));
-	ret |= __get_user(i, &(((struct fbcursor32 *)arg)->image));
+	ret = copy_from_user (&f, (struct fbcursor32 __user *) arg,
+			      2 * sizeof (short) + 2 * sizeof(struct fbcurpos));
+	ret |= __get_user(f.size.x,
+			  &(((struct fbcursor32 __user *)arg)->size.x));
+	ret |= __get_user(f.size.y,
+			  &(((struct fbcursor32 __user *)arg)->size.y));
+	ret |= __get_user(f.cmap.index,
+			  &(((struct fbcursor32 __user *)arg)->cmap.index));
+	ret |= __get_user(f.cmap.count,
+			  &(((struct fbcursor32 __user *)arg)->cmap.count));
+	ret |= __get_user(r, &(((struct fbcursor32 __user *)arg)->cmap.red));
+	ret |= __get_user(g, &(((struct fbcursor32 __user *)arg)->cmap.green));
+	ret |= __get_user(b, &(((struct fbcursor32 __user *)arg)->cmap.blue));
+	ret |= __get_user(m, &(((struct fbcursor32 __user *)arg)->mask));
+	ret |= __get_user(i, &(((struct fbcursor32 __user *)arg)->image));
 	if (ret)
 		return -EFAULT;
 	if (f.set & FB_CUR_SETCMAP) {
@@ -167,7 +172,7 @@
 
 static int drm32_version(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
-	drm32_version_t *uversion = (drm32_version_t *)arg;
+	drm32_version_t __user *uversion = (drm32_version_t __user *)arg;
 	char __user *name_ptr, *date_ptr, *desc_ptr;
 	u32 tmp1, tmp2, tmp3;
 	drm_version_t kversion;
@@ -245,7 +250,7 @@
 
 static int drm32_getsetunique(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
-	drm32_unique_t *uarg = (drm32_unique_t *)arg;
+	drm32_unique_t __user *uarg = (drm32_unique_t __user *)arg;
 	drm_unique_t karg;
 	mm_segment_t old_fs;
 	char __user *uptr;
@@ -309,7 +314,7 @@
 
 static int drm32_addmap(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
-	drm32_map_t *uarg = (drm32_map_t *) arg;
+	drm32_map_t __user *uarg = (drm32_map_t __user *) arg;
 	drm_map_t karg;
 	mm_segment_t old_fs;
 	u32 tmp;
@@ -324,7 +329,7 @@
 	if (ret)
 		return -EFAULT;
 
-	karg.handle = A(tmp);
+	karg.handle = (void *) (unsigned long) tmp;
 
 	old_fs = get_fs();
 	set_fs(KERNEL_DS);
@@ -354,7 +359,7 @@
 
 static int drm32_info_bufs(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
-	drm32_buf_info_t *uarg = (drm32_buf_info_t *)arg;
+	drm32_buf_info_t __user *uarg = (drm32_buf_info_t __user *)arg;
 	drm_buf_desc_t __user *ulist;
 	drm_buf_info_t karg;
 	mm_segment_t old_fs;
@@ -400,7 +405,7 @@
 
 static int drm32_free_bufs(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
-	drm32_buf_free_t *uarg = (drm32_buf_free_t *)arg;
+	drm32_buf_free_t __user *uarg = (drm32_buf_free_t __user *)arg;
 	drm_buf_free_t karg;
 	mm_segment_t old_fs;
 	int __user *ulist;
@@ -448,7 +453,7 @@
 
 static int drm32_map_bufs(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
-	drm32_buf_map_t *uarg = (drm32_buf_map_t *)arg;
+	drm32_buf_map_t __user *uarg = (drm32_buf_map_t __user *)arg;
 	drm32_buf_pub_t __user *ulist;
 	drm_buf_map_t karg;
 	mm_segment_t old_fs;
@@ -460,7 +465,7 @@
 	    get_user(tmp2, &uarg->list))
 		return -EFAULT;
 
-	karg.virtual = A(tmp1);
+	karg.virtual = (void *) (unsigned long) tmp1;
 	ulist = A(tmp2);
 
 	orig_count = karg.count;
@@ -477,7 +482,7 @@
 		    get_user(tmp1, &ulist[i].address))
 			goto out;
 
-		karg.list[i].address = A(tmp1);
+		karg.list[i].address = (void *) (unsigned long) tmp1;
 	}
 
 	old_fs = get_fs();
@@ -527,7 +532,7 @@
  */
 static int drm32_dma(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
-	drm32_dma_t *uarg = (drm32_dma_t *) arg;
+	drm32_dma_t __user *uarg = (drm32_dma_t __user *) arg;
 	int __user *u_si, *u_ss, *u_ri, *u_rs;
 	drm_dma_t karg;
 	mm_segment_t old_fs;
@@ -637,7 +642,7 @@
 
 static int drm32_res_ctx(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
-	drm32_ctx_res_t *uarg = (drm32_ctx_res_t *) arg;
+	drm32_ctx_res_t __user *uarg = (drm32_ctx_res_t __user *) arg;
 	drm_ctx_t __user *ulist;
 	drm_ctx_res_t karg;
 	mm_segment_t old_fs;
diff -Nru a/arch/sparc64/kernel/irq.c b/arch/sparc64/kernel/irq.c
--- a/arch/sparc64/kernel/irq.c	2004-06-02 23:27:00 -07:00
+++ b/arch/sparc64/kernel/irq.c	2004-06-02 23:27:00 -07:00
@@ -1164,7 +1164,7 @@
 
 #define HEX_DIGITS 16
 
-static unsigned int parse_hex_value (const char *buffer,
+static unsigned int parse_hex_value (const char __user *buffer,
 		unsigned long count, unsigned long *ret)
 {
 	unsigned char hexnum [HEX_DIGITS];
@@ -1233,7 +1233,7 @@
 	 */
 }
 
-static int irq_affinity_write_proc (struct file *file, const char *buffer,
+static int irq_affinity_write_proc (struct file *file, const char __user *buffer,
 					unsigned long count, void *data)
 {
 	int irq = (long) data, full_count = count, err;
diff -Nru a/arch/sparc64/kernel/module.c b/arch/sparc64/kernel/module.c
--- a/arch/sparc64/kernel/module.c	2004-06-02 23:26:59 -07:00
+++ b/arch/sparc64/kernel/module.c	2004-06-02 23:26:59 -07:00
@@ -31,7 +31,7 @@
 		return;
 	}
 
-	for (p = &modvmlist ; (tmp = *p) ; p = &tmp->next) {
+	for (p = &modvmlist; (tmp = *p) != NULL; p = &tmp->next) {
 		if (tmp->addr == addr) {
 			*p = tmp->next;
 			goto found;
@@ -66,7 +66,7 @@
 		return NULL;
 		
 	addr = (void *) MODULES_VADDR;
-	for (p = &modvmlist; (tmp = *p) ; p = &tmp->next) {
+	for (p = &modvmlist; (tmp = *p) != NULL; p = &tmp->next) {
 		if (size + (unsigned long) addr < (unsigned long) tmp->addr)
 			break;
 		addr = (void *) (tmp->size + (unsigned long) tmp->addr);
diff -Nru a/arch/sparc64/kernel/pci_psycho.c b/arch/sparc64/kernel/pci_psycho.c
--- a/arch/sparc64/kernel/pci_psycho.c	2004-06-02 23:26:59 -07:00
+++ b/arch/sparc64/kernel/pci_psycho.c	2004-06-02 23:26:59 -07:00
@@ -42,29 +42,29 @@
 
 /* Misc. PSYCHO PCI controller register offsets and definitions. */
 #define PSYCHO_CONTROL		0x0010UL
-#define  PSYCHO_CONTROL_IMPL	 0xf000000000000000 /* Implementation of this PSYCHO*/
-#define  PSYCHO_CONTROL_VER	 0x0f00000000000000 /* Version of this PSYCHO       */
-#define  PSYCHO_CONTROL_MID	 0x00f8000000000000 /* UPA Module ID of PSYCHO      */
-#define  PSYCHO_CONTROL_IGN	 0x0007c00000000000 /* Interrupt Group Number       */
-#define  PSYCHO_CONTROL_RESV     0x00003ffffffffff0 /* Reserved                     */
-#define  PSYCHO_CONTROL_APCKEN	 0x0000000000000008 /* Address Parity Check Enable  */
-#define  PSYCHO_CONTROL_APERR	 0x0000000000000004 /* Incoming System Addr Parerr  */
-#define  PSYCHO_CONTROL_IAP	 0x0000000000000002 /* Invert UPA Parity            */
-#define  PSYCHO_CONTROL_MODE	 0x0000000000000001 /* PSYCHO clock mode            */
+#define  PSYCHO_CONTROL_IMPL	 0xf000000000000000UL /* Implementation of this PSYCHO*/
+#define  PSYCHO_CONTROL_VER	 0x0f00000000000000UL /* Version of this PSYCHO       */
+#define  PSYCHO_CONTROL_MID	 0x00f8000000000000UL /* UPA Module ID of PSYCHO      */
+#define  PSYCHO_CONTROL_IGN	 0x0007c00000000000UL /* Interrupt Group Number       */
+#define  PSYCHO_CONTROL_RESV     0x00003ffffffffff0UL /* Reserved                     */
+#define  PSYCHO_CONTROL_APCKEN	 0x0000000000000008UL /* Address Parity Check Enable  */
+#define  PSYCHO_CONTROL_APERR	 0x0000000000000004UL /* Incoming System Addr Parerr  */
+#define  PSYCHO_CONTROL_IAP	 0x0000000000000002UL /* Invert UPA Parity            */
+#define  PSYCHO_CONTROL_MODE	 0x0000000000000001UL /* PSYCHO clock mode            */
 #define PSYCHO_PCIA_CTRL	0x2000UL
 #define PSYCHO_PCIB_CTRL	0x4000UL
-#define  PSYCHO_PCICTRL_RESV1	 0xfffffff000000000 /* Reserved                     */
-#define  PSYCHO_PCICTRL_SBH_ERR	 0x0000000800000000 /* Streaming byte hole error    */
-#define  PSYCHO_PCICTRL_SERR	 0x0000000400000000 /* SERR signal asserted         */
-#define  PSYCHO_PCICTRL_SPEED	 0x0000000200000000 /* PCI speed (1 is U2P clock)   */
-#define  PSYCHO_PCICTRL_RESV2	 0x00000001ffc00000 /* Reserved                     */
-#define  PSYCHO_PCICTRL_ARB_PARK 0x0000000000200000 /* PCI arbitration parking      */
-#define  PSYCHO_PCICTRL_RESV3	 0x00000000001ff800 /* Reserved                     */
-#define  PSYCHO_PCICTRL_SBH_INT	 0x0000000000000400 /* Streaming byte hole int enab */
-#define  PSYCHO_PCICTRL_WEN	 0x0000000000000200 /* Power Mgmt Wake Enable       */
-#define  PSYCHO_PCICTRL_EEN	 0x0000000000000100 /* PCI Error Interrupt Enable   */
-#define  PSYCHO_PCICTRL_RESV4	 0x00000000000000c0 /* Reserved                     */
-#define  PSYCHO_PCICTRL_AEN	 0x000000000000003f /* PCI DVMA Arbitration Enable  */
+#define  PSYCHO_PCICTRL_RESV1	 0xfffffff000000000UL /* Reserved                     */
+#define  PSYCHO_PCICTRL_SBH_ERR	 0x0000000800000000UL /* Streaming byte hole error    */
+#define  PSYCHO_PCICTRL_SERR	 0x0000000400000000UL /* SERR signal asserted         */
+#define  PSYCHO_PCICTRL_SPEED	 0x0000000200000000UL /* PCI speed (1 is U2P clock)   */
+#define  PSYCHO_PCICTRL_RESV2	 0x00000001ffc00000UL /* Reserved                     */
+#define  PSYCHO_PCICTRL_ARB_PARK 0x0000000000200000UL /* PCI arbitration parking      */
+#define  PSYCHO_PCICTRL_RESV3	 0x00000000001ff800UL /* Reserved                     */
+#define  PSYCHO_PCICTRL_SBH_INT	 0x0000000000000400UL /* Streaming byte hole int enab */
+#define  PSYCHO_PCICTRL_WEN	 0x0000000000000200UL /* Power Mgmt Wake Enable       */
+#define  PSYCHO_PCICTRL_EEN	 0x0000000000000100UL /* PCI Error Interrupt Enable   */
+#define  PSYCHO_PCICTRL_RESV4	 0x00000000000000c0UL /* Reserved                     */
+#define  PSYCHO_PCICTRL_AEN	 0x000000000000003fUL /* PCI DVMA Arbitration Enable  */
 
 /* U2P Programmer's Manual, page 13-55, configuration space
  * address format:
@@ -403,11 +403,11 @@
  */
 #define PSYCHO_STRBUF_CONTROL_A 0x2800UL
 #define PSYCHO_STRBUF_CONTROL_B 0x4800UL
-#define  PSYCHO_STRBUF_CTRL_LPTR    0x00000000000000f0 /* LRU Lock Pointer */
-#define  PSYCHO_STRBUF_CTRL_LENAB   0x0000000000000008 /* LRU Lock Enable */
-#define  PSYCHO_STRBUF_CTRL_RRDIS   0x0000000000000004 /* Rerun Disable */
-#define  PSYCHO_STRBUF_CTRL_DENAB   0x0000000000000002 /* Diagnostic Mode Enable */
-#define  PSYCHO_STRBUF_CTRL_ENAB    0x0000000000000001 /* Streaming Buffer Enable */
+#define  PSYCHO_STRBUF_CTRL_LPTR    0x00000000000000f0UL /* LRU Lock Pointer */
+#define  PSYCHO_STRBUF_CTRL_LENAB   0x0000000000000008UL /* LRU Lock Enable */
+#define  PSYCHO_STRBUF_CTRL_RRDIS   0x0000000000000004UL /* Rerun Disable */
+#define  PSYCHO_STRBUF_CTRL_DENAB   0x0000000000000002UL /* Diagnostic Mode Enable */
+#define  PSYCHO_STRBUF_CTRL_ENAB    0x0000000000000001UL /* Streaming Buffer Enable */
 #define PSYCHO_STRBUF_FLUSH_A   0x2808UL
 #define PSYCHO_STRBUF_FLUSH_B   0x4808UL
 #define PSYCHO_STRBUF_FSYNC_A   0x2810UL
@@ -416,22 +416,22 @@
 #define PSYCHO_STC_DATA_B	0xc000UL
 #define PSYCHO_STC_ERR_A	0xb400UL
 #define PSYCHO_STC_ERR_B	0xc400UL
-#define  PSYCHO_STCERR_WRITE	 0x0000000000000002	/* Write Error */
-#define  PSYCHO_STCERR_READ	 0x0000000000000001	/* Read Error */
+#define  PSYCHO_STCERR_WRITE	 0x0000000000000002UL	/* Write Error */
+#define  PSYCHO_STCERR_READ	 0x0000000000000001UL	/* Read Error */
 #define PSYCHO_STC_TAG_A	0xb800UL
 #define PSYCHO_STC_TAG_B	0xc800UL
-#define  PSYCHO_STCTAG_PPN	 0x0fffffff00000000	/* Physical Page Number */
-#define  PSYCHO_STCTAG_VPN	 0x00000000ffffe000	/* Virtual Page Number */
-#define  PSYCHO_STCTAG_VALID	 0x0000000000000002	/* Valid */
-#define  PSYCHO_STCTAG_WRITE	 0x0000000000000001	/* Writable */
+#define  PSYCHO_STCTAG_PPN	 0x0fffffff00000000UL	/* Physical Page Number */
+#define  PSYCHO_STCTAG_VPN	 0x00000000ffffe000UL	/* Virtual Page Number */
+#define  PSYCHO_STCTAG_VALID	 0x0000000000000002UL	/* Valid */
+#define  PSYCHO_STCTAG_WRITE	 0x0000000000000001UL	/* Writable */
 #define PSYCHO_STC_LINE_A	0xb900UL
 #define PSYCHO_STC_LINE_B	0xc900UL
-#define  PSYCHO_STCLINE_LINDX	 0x0000000001e00000	/* LRU Index */
-#define  PSYCHO_STCLINE_SPTR	 0x00000000001f8000	/* Dirty Data Start Pointer */
-#define  PSYCHO_STCLINE_LADDR	 0x0000000000007f00	/* Line Address */
-#define  PSYCHO_STCLINE_EPTR	 0x00000000000000fc	/* Dirty Data End Pointer */
-#define  PSYCHO_STCLINE_VALID	 0x0000000000000002	/* Valid */
-#define  PSYCHO_STCLINE_FOFN	 0x0000000000000001	/* Fetch Outstanding / Flush Necessary */
+#define  PSYCHO_STCLINE_LINDX	 0x0000000001e00000UL	/* LRU Index */
+#define  PSYCHO_STCLINE_SPTR	 0x00000000001f8000UL	/* Dirty Data Start Pointer */
+#define  PSYCHO_STCLINE_LADDR	 0x0000000000007f00UL	/* Line Address */
+#define  PSYCHO_STCLINE_EPTR	 0x00000000000000fcUL	/* Dirty Data End Pointer */
+#define  PSYCHO_STCLINE_VALID	 0x0000000000000002UL	/* Valid */
+#define  PSYCHO_STCLINE_FOFN	 0x0000000000000001UL	/* Fetch Outstanding / Flush Necessary */
 
 static spinlock_t stc_buf_lock = SPIN_LOCK_UNLOCKED;
 static unsigned long stc_error_buf[128];
@@ -555,24 +555,24 @@
  * interrogate the IOMMU state to see if it is the cause.
  */
 #define PSYCHO_IOMMU_CONTROL	0x0200UL
-#define  PSYCHO_IOMMU_CTRL_RESV     0xfffffffff9000000 /* Reserved                      */
-#define  PSYCHO_IOMMU_CTRL_XLTESTAT 0x0000000006000000 /* Translation Error Status      */
-#define  PSYCHO_IOMMU_CTRL_XLTEERR  0x0000000001000000 /* Translation Error encountered */
-#define  PSYCHO_IOMMU_CTRL_LCKEN    0x0000000000800000 /* Enable translation locking    */
-#define  PSYCHO_IOMMU_CTRL_LCKPTR   0x0000000000780000 /* Translation lock pointer      */
-#define  PSYCHO_IOMMU_CTRL_TSBSZ    0x0000000000070000 /* TSB Size                      */
-#define  PSYCHO_IOMMU_TSBSZ_1K      0x0000000000000000 /* TSB Table 1024 8-byte entries */
-#define  PSYCHO_IOMMU_TSBSZ_2K      0x0000000000010000 /* TSB Table 2048 8-byte entries */
-#define  PSYCHO_IOMMU_TSBSZ_4K      0x0000000000020000 /* TSB Table 4096 8-byte entries */
-#define  PSYCHO_IOMMU_TSBSZ_8K      0x0000000000030000 /* TSB Table 8192 8-byte entries */
-#define  PSYCHO_IOMMU_TSBSZ_16K     0x0000000000040000 /* TSB Table 16k 8-byte entries  */
-#define  PSYCHO_IOMMU_TSBSZ_32K     0x0000000000050000 /* TSB Table 32k 8-byte entries  */
-#define  PSYCHO_IOMMU_TSBSZ_64K     0x0000000000060000 /* TSB Table 64k 8-byte entries  */
-#define  PSYCHO_IOMMU_TSBSZ_128K    0x0000000000070000 /* TSB Table 128k 8-byte entries */
-#define  PSYCHO_IOMMU_CTRL_RESV2    0x000000000000fff8 /* Reserved                      */
-#define  PSYCHO_IOMMU_CTRL_TBWSZ    0x0000000000000004 /* Assumed page size, 0=8k 1=64k */
-#define  PSYCHO_IOMMU_CTRL_DENAB    0x0000000000000002 /* Diagnostic mode enable        */
-#define  PSYCHO_IOMMU_CTRL_ENAB     0x0000000000000001 /* IOMMU Enable                  */
+#define  PSYCHO_IOMMU_CTRL_RESV     0xfffffffff9000000UL /* Reserved                      */
+#define  PSYCHO_IOMMU_CTRL_XLTESTAT 0x0000000006000000UL /* Translation Error Status      */
+#define  PSYCHO_IOMMU_CTRL_XLTEERR  0x0000000001000000UL /* Translation Error encountered */
+#define  PSYCHO_IOMMU_CTRL_LCKEN    0x0000000000800000UL /* Enable translation locking    */
+#define  PSYCHO_IOMMU_CTRL_LCKPTR   0x0000000000780000UL /* Translation lock pointer      */
+#define  PSYCHO_IOMMU_CTRL_TSBSZ    0x0000000000070000UL /* TSB Size                      */
+#define  PSYCHO_IOMMU_TSBSZ_1K      0x0000000000000000UL /* TSB Table 1024 8-byte entries */
+#define  PSYCHO_IOMMU_TSBSZ_2K      0x0000000000010000UL /* TSB Table 2048 8-byte entries */
+#define  PSYCHO_IOMMU_TSBSZ_4K      0x0000000000020000UL /* TSB Table 4096 8-byte entries */
+#define  PSYCHO_IOMMU_TSBSZ_8K      0x0000000000030000UL /* TSB Table 8192 8-byte entries */
+#define  PSYCHO_IOMMU_TSBSZ_16K     0x0000000000040000UL /* TSB Table 16k 8-byte entries  */
+#define  PSYCHO_IOMMU_TSBSZ_32K     0x0000000000050000UL /* TSB Table 32k 8-byte entries  */
+#define  PSYCHO_IOMMU_TSBSZ_64K     0x0000000000060000UL /* TSB Table 64k 8-byte entries  */
+#define  PSYCHO_IOMMU_TSBSZ_128K    0x0000000000070000UL /* TSB Table 128k 8-byte entries */
+#define  PSYCHO_IOMMU_CTRL_RESV2    0x000000000000fff8UL /* Reserved                      */
+#define  PSYCHO_IOMMU_CTRL_TBWSZ    0x0000000000000004UL /* Assumed page size, 0=8k 1=64k */
+#define  PSYCHO_IOMMU_CTRL_DENAB    0x0000000000000002UL /* Diagnostic mode enable        */
+#define  PSYCHO_IOMMU_CTRL_ENAB     0x0000000000000001UL /* IOMMU Enable                  */
 #define PSYCHO_IOMMU_TSBBASE	0x0208UL
 #define PSYCHO_IOMMU_FLUSH	0x0210UL
 #define PSYCHO_IOMMU_TAG	0xa580UL
@@ -698,18 +698,18 @@
  * relating to UPA interface transactions.
  */
 #define PSYCHO_UE_AFSR	0x0030UL
-#define  PSYCHO_UEAFSR_PPIO	0x8000000000000000 /* Primary PIO is cause         */
-#define  PSYCHO_UEAFSR_PDRD	0x4000000000000000 /* Primary DVMA read is cause   */
-#define  PSYCHO_UEAFSR_PDWR	0x2000000000000000 /* Primary DVMA write is cause  */
-#define  PSYCHO_UEAFSR_SPIO	0x1000000000000000 /* Secondary PIO is cause       */
-#define  PSYCHO_UEAFSR_SDRD	0x0800000000000000 /* Secondary DVMA read is cause */
-#define  PSYCHO_UEAFSR_SDWR	0x0400000000000000 /* Secondary DVMA write is cause*/
-#define  PSYCHO_UEAFSR_RESV1	0x03ff000000000000 /* Reserved                     */
-#define  PSYCHO_UEAFSR_BMSK	0x0000ffff00000000 /* Bytemask of failed transfer  */
-#define  PSYCHO_UEAFSR_DOFF	0x00000000e0000000 /* Doubleword Offset            */
-#define  PSYCHO_UEAFSR_MID	0x000000001f000000 /* UPA MID causing the fault    */
-#define  PSYCHO_UEAFSR_BLK	0x0000000000800000 /* Trans was block operation    */
-#define  PSYCHO_UEAFSR_RESV2	0x00000000007fffff /* Reserved                     */
+#define  PSYCHO_UEAFSR_PPIO	0x8000000000000000UL /* Primary PIO is cause         */
+#define  PSYCHO_UEAFSR_PDRD	0x4000000000000000UL /* Primary DVMA read is cause   */
+#define  PSYCHO_UEAFSR_PDWR	0x2000000000000000UL /* Primary DVMA write is cause  */
+#define  PSYCHO_UEAFSR_SPIO	0x1000000000000000UL /* Secondary PIO is cause       */
+#define  PSYCHO_UEAFSR_SDRD	0x0800000000000000UL /* Secondary DVMA read is cause */
+#define  PSYCHO_UEAFSR_SDWR	0x0400000000000000UL /* Secondary DVMA write is cause*/
+#define  PSYCHO_UEAFSR_RESV1	0x03ff000000000000UL /* Reserved                     */
+#define  PSYCHO_UEAFSR_BMSK	0x0000ffff00000000UL /* Bytemask of failed transfer  */
+#define  PSYCHO_UEAFSR_DOFF	0x00000000e0000000UL /* Doubleword Offset            */
+#define  PSYCHO_UEAFSR_MID	0x000000001f000000UL /* UPA MID causing the fault    */
+#define  PSYCHO_UEAFSR_BLK	0x0000000000800000UL /* Trans was block operation    */
+#define  PSYCHO_UEAFSR_RESV2	0x00000000007fffffUL /* Reserved                     */
 #define PSYCHO_UE_AFAR	0x0038UL
 
 static irqreturn_t psycho_ue_intr(int irq, void *dev_id, struct pt_regs *regs)
@@ -774,19 +774,19 @@
 
 /* Correctable Errors. */
 #define PSYCHO_CE_AFSR	0x0040UL
-#define  PSYCHO_CEAFSR_PPIO	0x8000000000000000 /* Primary PIO is cause         */
-#define  PSYCHO_CEAFSR_PDRD	0x4000000000000000 /* Primary DVMA read is cause   */
-#define  PSYCHO_CEAFSR_PDWR	0x2000000000000000 /* Primary DVMA write is cause  */
-#define  PSYCHO_CEAFSR_SPIO	0x1000000000000000 /* Secondary PIO is cause       */
-#define  PSYCHO_CEAFSR_SDRD	0x0800000000000000 /* Secondary DVMA read is cause */
-#define  PSYCHO_CEAFSR_SDWR	0x0400000000000000 /* Secondary DVMA write is cause*/
-#define  PSYCHO_CEAFSR_RESV1	0x0300000000000000 /* Reserved                     */
-#define  PSYCHO_CEAFSR_ESYND	0x00ff000000000000 /* Syndrome Bits                */
-#define  PSYCHO_CEAFSR_BMSK	0x0000ffff00000000 /* Bytemask of failed transfer  */
-#define  PSYCHO_CEAFSR_DOFF	0x00000000e0000000 /* Double Offset                */
-#define  PSYCHO_CEAFSR_MID	0x000000001f000000 /* UPA MID causing the fault    */
-#define  PSYCHO_CEAFSR_BLK	0x0000000000800000 /* Trans was block operation    */
-#define  PSYCHO_CEAFSR_RESV2	0x00000000007fffff /* Reserved                     */
+#define  PSYCHO_CEAFSR_PPIO	0x8000000000000000UL /* Primary PIO is cause         */
+#define  PSYCHO_CEAFSR_PDRD	0x4000000000000000UL /* Primary DVMA read is cause   */
+#define  PSYCHO_CEAFSR_PDWR	0x2000000000000000UL /* Primary DVMA write is cause  */
+#define  PSYCHO_CEAFSR_SPIO	0x1000000000000000UL /* Secondary PIO is cause       */
+#define  PSYCHO_CEAFSR_SDRD	0x0800000000000000UL /* Secondary DVMA read is cause */
+#define  PSYCHO_CEAFSR_SDWR	0x0400000000000000UL /* Secondary DVMA write is cause*/
+#define  PSYCHO_CEAFSR_RESV1	0x0300000000000000UL /* Reserved                     */
+#define  PSYCHO_CEAFSR_ESYND	0x00ff000000000000UL /* Syndrome Bits                */
+#define  PSYCHO_CEAFSR_BMSK	0x0000ffff00000000UL /* Bytemask of failed transfer  */
+#define  PSYCHO_CEAFSR_DOFF	0x00000000e0000000UL /* Double Offset                */
+#define  PSYCHO_CEAFSR_MID	0x000000001f000000UL /* UPA MID causing the fault    */
+#define  PSYCHO_CEAFSR_BLK	0x0000000000800000UL /* Trans was block operation    */
+#define  PSYCHO_CEAFSR_RESV2	0x00000000007fffffUL /* Reserved                     */
 #define PSYCHO_CE_AFAR	0x0040UL
 
 static irqreturn_t psycho_ce_intr(int irq, void *dev_id, struct pt_regs *regs)
@@ -857,20 +857,20 @@
  */
 #define PSYCHO_PCI_AFSR_A	0x2010UL
 #define PSYCHO_PCI_AFSR_B	0x4010UL
-#define  PSYCHO_PCIAFSR_PMA	0x8000000000000000 /* Primary Master Abort Error   */
-#define  PSYCHO_PCIAFSR_PTA	0x4000000000000000 /* Primary Target Abort Error   */
-#define  PSYCHO_PCIAFSR_PRTRY	0x2000000000000000 /* Primary Excessive Retries    */
-#define  PSYCHO_PCIAFSR_PPERR	0x1000000000000000 /* Primary Parity Error         */
-#define  PSYCHO_PCIAFSR_SMA	0x0800000000000000 /* Secondary Master Abort Error */
-#define  PSYCHO_PCIAFSR_STA	0x0400000000000000 /* Secondary Target Abort Error */
-#define  PSYCHO_PCIAFSR_SRTRY	0x0200000000000000 /* Secondary Excessive Retries  */
-#define  PSYCHO_PCIAFSR_SPERR	0x0100000000000000 /* Secondary Parity Error       */
-#define  PSYCHO_PCIAFSR_RESV1	0x00ff000000000000 /* Reserved                     */
-#define  PSYCHO_PCIAFSR_BMSK	0x0000ffff00000000 /* Bytemask of failed transfer  */
-#define  PSYCHO_PCIAFSR_BLK	0x0000000080000000 /* Trans was block operation    */
-#define  PSYCHO_PCIAFSR_RESV2	0x0000000040000000 /* Reserved                     */
-#define  PSYCHO_PCIAFSR_MID	0x000000003e000000 /* MID causing the error        */
-#define  PSYCHO_PCIAFSR_RESV3	0x0000000001ffffff /* Reserved                     */
+#define  PSYCHO_PCIAFSR_PMA	0x8000000000000000UL /* Primary Master Abort Error   */
+#define  PSYCHO_PCIAFSR_PTA	0x4000000000000000UL /* Primary Target Abort Error   */
+#define  PSYCHO_PCIAFSR_PRTRY	0x2000000000000000UL /* Primary Excessive Retries    */
+#define  PSYCHO_PCIAFSR_PPERR	0x1000000000000000UL /* Primary Parity Error         */
+#define  PSYCHO_PCIAFSR_SMA	0x0800000000000000UL /* Secondary Master Abort Error */
+#define  PSYCHO_PCIAFSR_STA	0x0400000000000000UL /* Secondary Target Abort Error */
+#define  PSYCHO_PCIAFSR_SRTRY	0x0200000000000000UL /* Secondary Excessive Retries  */
+#define  PSYCHO_PCIAFSR_SPERR	0x0100000000000000UL /* Secondary Parity Error       */
+#define  PSYCHO_PCIAFSR_RESV1	0x00ff000000000000UL /* Reserved                     */
+#define  PSYCHO_PCIAFSR_BMSK	0x0000ffff00000000UL /* Bytemask of failed transfer  */
+#define  PSYCHO_PCIAFSR_BLK	0x0000000080000000UL /* Trans was block operation    */
+#define  PSYCHO_PCIAFSR_RESV2	0x0000000040000000UL /* Reserved                     */
+#define  PSYCHO_PCIAFSR_MID	0x000000003e000000UL /* MID causing the error        */
+#define  PSYCHO_PCIAFSR_RESV3	0x0000000001ffffffUL /* Reserved                     */
 #define PSYCHO_PCI_AFAR_A	0x2018UL
 #define PSYCHO_PCI_AFAR_B	0x4018UL
 
@@ -1017,9 +1017,9 @@
 
 /* XXX What about PowerFail/PowerManagement??? -DaveM */
 #define PSYCHO_ECC_CTRL		0x0020
-#define  PSYCHO_ECCCTRL_EE	 0x8000000000000000 /* Enable ECC Checking */
-#define  PSYCHO_ECCCTRL_UE	 0x4000000000000000 /* Enable UE Interrupts */
-#define  PSYCHO_ECCCTRL_CE	 0x2000000000000000 /* Enable CE INterrupts */
+#define  PSYCHO_ECCCTRL_EE	 0x8000000000000000UL /* Enable ECC Checking */
+#define  PSYCHO_ECCCTRL_UE	 0x4000000000000000UL /* Enable UE Interrupts */
+#define  PSYCHO_ECCCTRL_CE	 0x2000000000000000UL /* Enable CE INterrupts */
 #define PSYCHO_UE_INO		0x2e
 #define PSYCHO_CE_INO		0x2f
 #define PSYCHO_PCIERR_A_INO	0x30
@@ -1282,14 +1282,14 @@
 #define PSYCHO_IRQ_RETRY	0x1a00UL
 #define PSYCHO_PCIA_DIAG	0x2020UL
 #define PSYCHO_PCIB_DIAG	0x4020UL
-#define  PSYCHO_PCIDIAG_RESV	 0xffffffffffffff80 /* Reserved                     */
-#define  PSYCHO_PCIDIAG_DRETRY	 0x0000000000000040 /* Disable retry limit          */
-#define  PSYCHO_PCIDIAG_DISYNC	 0x0000000000000020 /* Disable DMA wr / irq sync    */
-#define  PSYCHO_PCIDIAG_DDWSYNC	 0x0000000000000010 /* Disable DMA wr / PIO rd sync */
-#define  PSYCHO_PCIDIAG_IDDPAR	 0x0000000000000008 /* Invert DMA data parity       */
-#define  PSYCHO_PCIDIAG_IPDPAR	 0x0000000000000004 /* Invert PIO data parity       */
-#define  PSYCHO_PCIDIAG_IPAPAR	 0x0000000000000002 /* Invert PIO address parity    */
-#define  PSYCHO_PCIDIAG_LPBACK	 0x0000000000000001 /* Enable loopback mode         */
+#define  PSYCHO_PCIDIAG_RESV	 0xffffffffffffff80UL /* Reserved                     */
+#define  PSYCHO_PCIDIAG_DRETRY	 0x0000000000000040UL /* Disable retry limit          */
+#define  PSYCHO_PCIDIAG_DISYNC	 0x0000000000000020UL /* Disable DMA wr / irq sync    */
+#define  PSYCHO_PCIDIAG_DDWSYNC	 0x0000000000000010UL /* Disable DMA wr / PIO rd sync */
+#define  PSYCHO_PCIDIAG_IDDPAR	 0x0000000000000008UL /* Invert DMA data parity       */
+#define  PSYCHO_PCIDIAG_IPDPAR	 0x0000000000000004UL /* Invert PIO data parity       */
+#define  PSYCHO_PCIDIAG_IPAPAR	 0x0000000000000002UL /* Invert PIO address parity    */
+#define  PSYCHO_PCIDIAG_LPBACK	 0x0000000000000001UL /* Enable loopback mode         */
 
 static void psycho_controller_hwinit(struct pci_controller_info *p)
 {
diff -Nru a/arch/sparc64/kernel/pci_schizo.c b/arch/sparc64/kernel/pci_schizo.c
--- a/arch/sparc64/kernel/pci_schizo.c	2004-06-02 23:27:00 -07:00
+++ b/arch/sparc64/kernel/pci_schizo.c	2004-06-02 23:27:00 -07:00
@@ -56,24 +56,24 @@
 #define SCHIZO_STRBUF_CTRL_ENAB    0x0000000000000001UL /* Streaming Buffer Enable */
 
 /* IOMMU control register. */
-#define SCHIZO_IOMMU_CTRL_RESV     0xfffffffff9000000 /* Reserved                      */
-#define SCHIZO_IOMMU_CTRL_XLTESTAT 0x0000000006000000 /* Translation Error Status      */
-#define SCHIZO_IOMMU_CTRL_XLTEERR  0x0000000001000000 /* Translation Error encountered */
-#define SCHIZO_IOMMU_CTRL_LCKEN    0x0000000000800000 /* Enable translation locking    */
-#define SCHIZO_IOMMU_CTRL_LCKPTR   0x0000000000780000 /* Translation lock pointer      */
-#define SCHIZO_IOMMU_CTRL_TSBSZ    0x0000000000070000 /* TSB Size                      */
-#define SCHIZO_IOMMU_TSBSZ_1K      0x0000000000000000 /* TSB Table 1024 8-byte entries */
-#define SCHIZO_IOMMU_TSBSZ_2K      0x0000000000010000 /* TSB Table 2048 8-byte entries */
-#define SCHIZO_IOMMU_TSBSZ_4K      0x0000000000020000 /* TSB Table 4096 8-byte entries */
-#define SCHIZO_IOMMU_TSBSZ_8K      0x0000000000030000 /* TSB Table 8192 8-byte entries */
-#define SCHIZO_IOMMU_TSBSZ_16K     0x0000000000040000 /* TSB Table 16k 8-byte entries  */
-#define SCHIZO_IOMMU_TSBSZ_32K     0x0000000000050000 /* TSB Table 32k 8-byte entries  */
-#define SCHIZO_IOMMU_TSBSZ_64K     0x0000000000060000 /* TSB Table 64k 8-byte entries  */
-#define SCHIZO_IOMMU_TSBSZ_128K    0x0000000000070000 /* TSB Table 128k 8-byte entries */
-#define SCHIZO_IOMMU_CTRL_RESV2    0x000000000000fff8 /* Reserved                      */
-#define SCHIZO_IOMMU_CTRL_TBWSZ    0x0000000000000004 /* Assumed page size, 0=8k 1=64k */
-#define SCHIZO_IOMMU_CTRL_DENAB    0x0000000000000002 /* Diagnostic mode enable        */
-#define SCHIZO_IOMMU_CTRL_ENAB     0x0000000000000001 /* IOMMU Enable                  */
+#define SCHIZO_IOMMU_CTRL_RESV     0xfffffffff9000000UL /* Reserved                      */
+#define SCHIZO_IOMMU_CTRL_XLTESTAT 0x0000000006000000UL /* Translation Error Status      */
+#define SCHIZO_IOMMU_CTRL_XLTEERR  0x0000000001000000UL /* Translation Error encountered */
+#define SCHIZO_IOMMU_CTRL_LCKEN    0x0000000000800000UL /* Enable translation locking    */
+#define SCHIZO_IOMMU_CTRL_LCKPTR   0x0000000000780000UL /* Translation lock pointer      */
+#define SCHIZO_IOMMU_CTRL_TSBSZ    0x0000000000070000UL /* TSB Size                      */
+#define SCHIZO_IOMMU_TSBSZ_1K      0x0000000000000000UL /* TSB Table 1024 8-byte entries */
+#define SCHIZO_IOMMU_TSBSZ_2K      0x0000000000010000UL /* TSB Table 2048 8-byte entries */
+#define SCHIZO_IOMMU_TSBSZ_4K      0x0000000000020000UL /* TSB Table 4096 8-byte entries */
+#define SCHIZO_IOMMU_TSBSZ_8K      0x0000000000030000UL /* TSB Table 8192 8-byte entries */
+#define SCHIZO_IOMMU_TSBSZ_16K     0x0000000000040000UL /* TSB Table 16k 8-byte entries  */
+#define SCHIZO_IOMMU_TSBSZ_32K     0x0000000000050000UL /* TSB Table 32k 8-byte entries  */
+#define SCHIZO_IOMMU_TSBSZ_64K     0x0000000000060000UL /* TSB Table 64k 8-byte entries  */
+#define SCHIZO_IOMMU_TSBSZ_128K    0x0000000000070000UL /* TSB Table 128k 8-byte entries */
+#define SCHIZO_IOMMU_CTRL_RESV2    0x000000000000fff8UL /* Reserved                      */
+#define SCHIZO_IOMMU_CTRL_TBWSZ    0x0000000000000004UL /* Assumed page size, 0=8k 1=64k */
+#define SCHIZO_IOMMU_CTRL_DENAB    0x0000000000000002UL /* Diagnostic mode enable        */
+#define SCHIZO_IOMMU_CTRL_ENAB     0x0000000000000001UL /* IOMMU Enable                  */
 
 /* Schizo config space address format is nearly identical to
  * that of PSYCHO:
@@ -1111,9 +1111,9 @@
 
 /* Nearly identical to PSYCHO equivalents... */
 #define SCHIZO_ECC_CTRL		0x10020UL
-#define  SCHIZO_ECCCTRL_EE	 0x8000000000000000 /* Enable ECC Checking */
-#define  SCHIZO_ECCCTRL_UE	 0x4000000000000000 /* Enable UE Interrupts */
-#define  SCHIZO_ECCCTRL_CE	 0x2000000000000000 /* Enable CE INterrupts */
+#define  SCHIZO_ECCCTRL_EE	 0x8000000000000000UL /* Enable ECC Checking */
+#define  SCHIZO_ECCCTRL_UE	 0x4000000000000000UL /* Enable UE Interrupts */
+#define  SCHIZO_ECCCTRL_CE	 0x2000000000000000UL /* Enable CE INterrupts */
 
 #define SCHIZO_SAFARI_ERRCTRL	0x10008UL
 #define  SCHIZO_SAFERRCTRL_EN	 0x8000000000000000UL
diff -Nru a/arch/sparc64/kernel/process.c b/arch/sparc64/kernel/process.c
--- a/arch/sparc64/kernel/process.c	2004-06-02 23:26:59 -07:00
+++ b/arch/sparc64/kernel/process.c	2004-06-02 23:26:59 -07:00
@@ -160,39 +160,43 @@
 
 static void show_regwindow32(struct pt_regs *regs)
 {
-	struct reg_window32 *rw;
+	struct reg_window32 __user *rw;
 	struct reg_window32 r_w;
 	mm_segment_t old_fs;
 	
 	__asm__ __volatile__ ("flushw");
-	rw = (struct reg_window32 *)((long)(unsigned)regs->u_regs[14]);
+	rw = (struct reg_window32 __user *)((long)(unsigned)regs->u_regs[14]);
 	old_fs = get_fs();
 	set_fs (USER_DS);
 	if (copy_from_user (&r_w, rw, sizeof(r_w))) {
 		set_fs (old_fs);
 		return;
 	}
-	rw = &r_w;
+
 	set_fs (old_fs);			
 	printk("l0: %08x l1: %08x l2: %08x l3: %08x "
 	       "l4: %08x l5: %08x l6: %08x l7: %08x\n",
-	       rw->locals[0], rw->locals[1], rw->locals[2], rw->locals[3],
-	       rw->locals[4], rw->locals[5], rw->locals[6], rw->locals[7]);
+	       r_w.locals[0], r_w.locals[1], r_w.locals[2], r_w.locals[3],
+	       r_w.locals[4], r_w.locals[5], r_w.locals[6], r_w.locals[7]);
 	printk("i0: %08x i1: %08x i2: %08x i3: %08x "
 	       "i4: %08x i5: %08x i6: %08x i7: %08x\n",
-	       rw->ins[0], rw->ins[1], rw->ins[2], rw->ins[3],
-	       rw->ins[4], rw->ins[5], rw->ins[6], rw->ins[7]);
+	       r_w.ins[0], r_w.ins[1], r_w.ins[2], r_w.ins[3],
+	       r_w.ins[4], r_w.ins[5], r_w.ins[6], r_w.ins[7]);
 }
 
 static void show_regwindow(struct pt_regs *regs)
 {
-	struct reg_window *rw;
+	struct reg_window __user *rw;
+	struct reg_window *rwk;
 	struct reg_window r_w;
 	mm_segment_t old_fs;
 
 	if ((regs->tstate & TSTATE_PRIV) || !(test_thread_flag(TIF_32BIT))) {
 		__asm__ __volatile__ ("flushw");
-		rw = (struct reg_window *)(regs->u_regs[14] + STACK_BIAS);
+		rw = (struct reg_window __user *)
+			(regs->u_regs[14] + STACK_BIAS);
+		rwk = (struct reg_window *)
+			(regs->u_regs[14] + STACK_BIAS);
 		if (!(regs->tstate & TSTATE_PRIV)) {
 			old_fs = get_fs();
 			set_fs (USER_DS);
@@ -200,7 +204,7 @@
 				set_fs (old_fs);
 				return;
 			}
-			rw = &r_w;
+			rwk = &r_w;
 			set_fs (old_fs);			
 		}
 	} else {
@@ -208,15 +212,15 @@
 		return;
 	}
 	printk("l0: %016lx l1: %016lx l2: %016lx l3: %016lx\n",
-	       rw->locals[0], rw->locals[1], rw->locals[2], rw->locals[3]);
+	       rwk->locals[0], rwk->locals[1], rwk->locals[2], rwk->locals[3]);
 	printk("l4: %016lx l5: %016lx l6: %016lx l7: %016lx\n",
-	       rw->locals[4], rw->locals[5], rw->locals[6], rw->locals[7]);
+	       rwk->locals[4], rwk->locals[5], rwk->locals[6], rwk->locals[7]);
 	printk("i0: %016lx i1: %016lx i2: %016lx i3: %016lx\n",
-	       rw->ins[0], rw->ins[1], rw->ins[2], rw->ins[3]);
+	       rwk->ins[0], rwk->ins[1], rwk->ins[2], rwk->ins[3]);
 	printk("i4: %016lx i5: %016lx i6: %016lx i7: %016lx\n",
-	       rw->ins[4], rw->ins[5], rw->ins[6], rw->ins[7]);
+	       rwk->ins[4], rwk->ins[5], rwk->ins[6], rwk->ins[7]);
 	if (regs->tstate & TSTATE_PRIV)
-		print_symbol("I7: <%s>\n", rw->ins[7]);
+		print_symbol("I7: <%s>\n", rwk->ins[7]);
 }
 
 void show_stackframe(struct sparc_stackf *sf)
@@ -471,10 +475,10 @@
 	if (!(test_thread_flag(TIF_32BIT))) {
 		csp += STACK_BIAS;
 		psp += STACK_BIAS;
-		__get_user(fp, &(((struct reg_window *)psp)->ins[6]));
+		__get_user(fp, &(((struct reg_window __user *)psp)->ins[6]));
 		fp += STACK_BIAS;
 	} else
-		__get_user(fp, &(((struct reg_window32 *)psp)->ins[6]));
+		__get_user(fp, &(((struct reg_window32 __user *)psp)->ins[6]));
 
 	/* Now 8-byte align the stack as this is mandatory in the
 	 * Sparc ABI due to how register windows work.  This hides
@@ -487,11 +491,12 @@
 	if (copy_in_user((void __user *) rval, (void __user *) psp, distance))
 		rval = 0;
 	else if (test_thread_flag(TIF_32BIT)) {
-		if (put_user(((u32)csp), &(((struct reg_window32 *)rval)->ins[6])))
+		if (put_user(((u32)csp),
+			     &(((struct reg_window32 __user *)rval)->ins[6])))
 			rval = 0;
 	} else {
 		if (put_user(((u64)csp - STACK_BIAS),
-			     &(((struct reg_window *)rval)->ins[6])))
+			     &(((struct reg_window __user *)rval)->ins[6])))
 			rval = 0;
 		else
 			rval = rval - STACK_BIAS;
@@ -533,7 +538,7 @@
 			unsigned long sp = (t->rwbuf_stkptrs[window] + bias);
 			struct reg_window *rwin = &t->reg_window[window];
 
-			if (!copy_to_user((char *)sp, rwin, winsize)) {
+			if (!copy_to_user((char __user *)sp, rwin, winsize)) {
 				shift_window_buffer(window, get_thread_wsaved() - 1, t);
 				set_thread_wsaved(get_thread_wsaved() - 1);
 			}
@@ -562,7 +567,7 @@
 			unsigned long sp = (t->rwbuf_stkptrs[window] + bias);
 			struct reg_window *rwin = &t->reg_window[window];
 
-			if (copy_to_user((char *)sp, rwin, winsize))
+			if (copy_to_user((char __user *)sp, rwin, winsize))
 				goto barf;
 		} while (window--);
 	}
@@ -592,8 +597,8 @@
 
 	return do_fork(clone_flags, stack_start,
 		       regs, stack_size,
-		       (int *) parent_tid_ptr,
-		       (int *) child_tid_ptr);
+		       (int __user *) parent_tid_ptr,
+		       (int __user *) child_tid_ptr);
 }
 
 /* Copy a Sparc thread.  The fork() return value conventions
@@ -694,24 +699,24 @@
 	 * So we stash 'fn' and 'arg' into global registers which
 	 * will not be modified by the parent.
 	 */
-	__asm__ __volatile("mov %4, %%g2\n\t"	   /* Save FN into global */
-			   "mov %5, %%g3\n\t"	   /* Save ARG into global */
-			   "mov %1, %%g1\n\t"	   /* Clone syscall nr. */
-			   "mov %2, %%o0\n\t"	   /* Clone flags. */
-			   "mov 0, %%o1\n\t"	   /* usp arg == 0 */
-			   "t 0x6d\n\t"		   /* Linux/Sparc clone(). */
-			   "brz,a,pn %%o1, 1f\n\t" /* Parent, just return. */
-			   " mov %%o0, %0\n\t"
-			   "jmpl %%g2, %%o7\n\t"   /* Call the function. */
-			   " mov %%g3, %%o0\n\t"   /* Set arg in delay. */
-			   "mov %3, %%g1\n\t"
-			   "t 0x6d\n\t"		   /* Linux/Sparc exit(). */
-			   /* Notreached by child. */
-			   "1:" :
-			   "=r" (retval) :
-			   "i" (__NR_clone), "r" (flags | CLONE_VM | CLONE_UNTRACED),
-			   "i" (__NR_exit),  "r" (fn), "r" (arg) :
-			   "g1", "g2", "g3", "o0", "o1", "memory", "cc");
+	__asm__ __volatile__("mov %4, %%g2\n\t"	   /* Save FN into global */
+			     "mov %5, %%g3\n\t"	   /* Save ARG into global */
+			     "mov %1, %%g1\n\t"	   /* Clone syscall nr. */
+			     "mov %2, %%o0\n\t"	   /* Clone flags. */
+			     "mov 0, %%o1\n\t"	   /* usp arg == 0 */
+			     "t 0x6d\n\t"	   /* Linux/Sparc clone(). */
+			     "brz,a,pn %%o1, 1f\n\t" /* Parent, just return. */
+			     " mov %%o0, %0\n\t"
+			     "jmpl %%g2, %%o7\n\t"   /* Call the function. */
+			     " mov %%g3, %%o0\n\t"   /* Set arg in delay. */
+			     "mov %3, %%g1\n\t"
+			     "t 0x6d\n\t"	   /* Linux/Sparc exit(). */
+			     /* Notreached by child. */
+			     "1:" :
+			     "=r" (retval) :
+			     "i" (__NR_clone), "r" (flags | CLONE_VM | CLONE_UNTRACED),
+			     "i" (__NR_exit),  "r" (fn), "r" (arg) :
+			     "g1", "g2", "g3", "o0", "o1", "memory", "cc");
 	return retval;
 }
 
@@ -806,12 +811,15 @@
 	if (regs->u_regs[UREG_G1] == 0)
 		base = 1;
 
-	filename = getname((char *)regs->u_regs[base + UREG_I0]);
+	filename = getname((char __user *)regs->u_regs[base + UREG_I0]);
 	error = PTR_ERR(filename);
 	if (IS_ERR(filename))
 		goto out;
-	error = do_execve(filename, (char **) regs->u_regs[base + UREG_I1],
-			  (char **) regs->u_regs[base + UREG_I2], regs);
+	error = do_execve(filename,
+			  (char __user * __user *)
+			  regs->u_regs[base + UREG_I1],
+			  (char __user * __user *)
+			  regs->u_regs[base + UREG_I2], regs);
 	putname(filename);
 	if (!error) {
 		fprs_write(0);
diff -Nru a/arch/sparc64/kernel/ptrace.c b/arch/sparc64/kernel/ptrace.c
--- a/arch/sparc64/kernel/ptrace.c	2004-06-02 23:27:00 -07:00
+++ b/arch/sparc64/kernel/ptrace.c	2004-06-02 23:27:00 -07:00
@@ -53,11 +53,15 @@
 pt_succ_return_linux(struct pt_regs *regs, unsigned long value, long *addr)
 {
 	if (test_thread_flag(TIF_32BIT)) {
-		if (put_user(value, (unsigned int *)addr))
-			return pt_error_return(regs, EFAULT);
+		if (put_user(value, (unsigned int __user *) addr)) {
+			pt_error_return(regs, EFAULT);
+			return;
+		}
 	} else {
-		if (put_user(value, addr))
-			return pt_error_return(regs, EFAULT);
+		if (put_user(value, (long __user *) addr)) {
+			pt_error_return(regs, EFAULT);
+			return;
+		}
 	}
 	regs->u_regs[UREG_I0] = 0;
 	regs->tstate &= ~(TSTATE_ICARRY | TSTATE_XCARRY);
@@ -253,7 +257,8 @@
 	}
 
 	case PTRACE_GETREGS: {
-		struct pt_regs32 *pregs = (struct pt_regs32 *) addr;
+		struct pt_regs32 __user *pregs =
+			(struct pt_regs32 __user *) addr;
 		struct pt_regs *cregs = child->thread_info->kregs;
 		int rval;
 
@@ -277,7 +282,7 @@
 	}
 
 	case PTRACE_GETREGS64: {
-		struct pt_regs *pregs = (struct pt_regs *) addr;
+		struct pt_regs __user *pregs = (struct pt_regs __user *) addr;
 		struct pt_regs *cregs = child->thread_info->kregs;
 		unsigned long tpc = cregs->tpc;
 		int rval;
@@ -304,7 +309,8 @@
 	}
 
 	case PTRACE_SETREGS: {
-		struct pt_regs32 *pregs = (struct pt_regs32 *) addr;
+		struct pt_regs32 __user *pregs =
+			(struct pt_regs32 __user *) addr;
 		struct pt_regs *cregs = child->thread_info->kregs;
 		unsigned int psr, pc, npc, y;
 		int i;
@@ -337,7 +343,7 @@
 	}
 
 	case PTRACE_SETREGS64: {
-		struct pt_regs *pregs = (struct pt_regs *) addr;
+		struct pt_regs __user *pregs = (struct pt_regs __user *) addr;
 		struct pt_regs *cregs = child->thread_info->kregs;
 		unsigned long tstate, tpc, tnpc, y;
 		int i;
@@ -385,7 +391,8 @@
 				unsigned int insnaddr;
 				unsigned int insn;
 			} fpq[16];
-		} *fps = (struct fps *) addr;
+		};
+		struct fps __user *fps = (struct fps __user *) addr;
 		unsigned long *fpregs = child->thread_info->fpregs;
 
 		if (copy_to_user(&fps->regs[0], fpregs,
@@ -406,7 +413,8 @@
 		struct fps {
 			unsigned int regs[64];
 			unsigned long fsr;
-		} *fps = (struct fps *) addr;
+		};
+		struct fps __user *fps = (struct fps __user *) addr;
 		unsigned long *fpregs = child->thread_info->fpregs;
 
 		if (copy_to_user(&fps->regs[0], fpregs,
@@ -430,7 +438,8 @@
 				unsigned int insnaddr;
 				unsigned int insn;
 			} fpq[16];
-		} *fps = (struct fps *) addr;
+		};
+		struct fps __user *fps = (struct fps __user *) addr;
 		unsigned long *fpregs = child->thread_info->fpregs;
 		unsigned fsr;
 
@@ -453,7 +462,8 @@
 		struct fps {
 			unsigned int regs[64];
 			unsigned long fsr;
-		} *fps = (struct fps *) addr;
+		};
+		struct fps __user *fps = (struct fps __user *) addr;
 		unsigned long *fpregs = child->thread_info->fpregs;
 
 		if (copy_from_user(fpregs, &fps->regs[0],
@@ -472,7 +482,7 @@
 	case PTRACE_READTEXT:
 	case PTRACE_READDATA: {
 		int res = ptrace_readdata(child, addr,
-					  (void *)addr2, data);
+					  (char __user *)addr2, data);
 		if (res == data) {
 			pt_succ_return(regs, 0);
 			goto flush_and_out;
@@ -485,7 +495,7 @@
 
 	case PTRACE_WRITETEXT:
 	case PTRACE_WRITEDATA: {
-		int res = ptrace_writedata(child, (void *) addr2,
+		int res = ptrace_writedata(child, (char __user *) addr2,
 					   addr, data);
 		if (res == data) {
 			pt_succ_return(regs, 0);
diff -Nru a/arch/sparc64/kernel/sbus.c b/arch/sparc64/kernel/sbus.c
--- a/arch/sparc64/kernel/sbus.c	2004-06-02 23:27:00 -07:00
+++ b/arch/sparc64/kernel/sbus.c	2004-06-02 23:27:00 -07:00
@@ -810,17 +810,17 @@
 /* Error interrupt handling. */
 #define SYSIO_UE_AFSR	0x0030UL
 #define SYSIO_UE_AFAR	0x0038UL
-#define  SYSIO_UEAFSR_PPIO	0x8000000000000000 /* Primary PIO is cause         */
-#define  SYSIO_UEAFSR_PDRD	0x4000000000000000 /* Primary DVMA read is cause   */
-#define  SYSIO_UEAFSR_PDWR	0x2000000000000000 /* Primary DVMA write is cause  */
-#define  SYSIO_UEAFSR_SPIO	0x1000000000000000 /* Secondary PIO is cause       */
-#define  SYSIO_UEAFSR_SDRD	0x0800000000000000 /* Secondary DVMA read is cause */
-#define  SYSIO_UEAFSR_SDWR	0x0400000000000000 /* Secondary DVMA write is cause*/
-#define  SYSIO_UEAFSR_RESV1	0x03ff000000000000 /* Reserved                     */
-#define  SYSIO_UEAFSR_DOFF	0x0000e00000000000 /* Doubleword Offset            */
-#define  SYSIO_UEAFSR_SIZE	0x00001c0000000000 /* Bad transfer size is 2**SIZE */
-#define  SYSIO_UEAFSR_MID	0x000003e000000000 /* UPA MID causing the fault    */
-#define  SYSIO_UEAFSR_RESV2	0x0000001fffffffff /* Reserved                     */
+#define  SYSIO_UEAFSR_PPIO  0x8000000000000000UL /* Primary PIO cause         */
+#define  SYSIO_UEAFSR_PDRD  0x4000000000000000UL /* Primary DVMA read cause   */
+#define  SYSIO_UEAFSR_PDWR  0x2000000000000000UL /* Primary DVMA write cause  */
+#define  SYSIO_UEAFSR_SPIO  0x1000000000000000UL /* Secondary PIO is cause    */
+#define  SYSIO_UEAFSR_SDRD  0x0800000000000000UL /* Secondary DVMA read cause */
+#define  SYSIO_UEAFSR_SDWR  0x0400000000000000UL /* Secondary DVMA write cause*/
+#define  SYSIO_UEAFSR_RESV1 0x03ff000000000000UL /* Reserved                  */
+#define  SYSIO_UEAFSR_DOFF  0x0000e00000000000UL /* Doubleword Offset         */
+#define  SYSIO_UEAFSR_SIZE  0x00001c0000000000UL /* Bad transfer size 2^SIZE  */
+#define  SYSIO_UEAFSR_MID   0x000003e000000000UL /* UPA MID causing the fault */
+#define  SYSIO_UEAFSR_RESV2 0x0000001fffffffffUL /* Reserved                  */
 static irqreturn_t sysio_ue_handler(int irq, void *dev_id, struct pt_regs *regs)
 {
 	struct sbus_bus *sbus = dev_id;
@@ -881,18 +881,18 @@
 
 #define SYSIO_CE_AFSR	0x0040UL
 #define SYSIO_CE_AFAR	0x0048UL
-#define  SYSIO_CEAFSR_PPIO	0x8000000000000000 /* Primary PIO is cause         */
-#define  SYSIO_CEAFSR_PDRD	0x4000000000000000 /* Primary DVMA read is cause   */
-#define  SYSIO_CEAFSR_PDWR	0x2000000000000000 /* Primary DVMA write is cause  */
-#define  SYSIO_CEAFSR_SPIO	0x1000000000000000 /* Secondary PIO is cause       */
-#define  SYSIO_CEAFSR_SDRD	0x0800000000000000 /* Secondary DVMA read is cause */
-#define  SYSIO_CEAFSR_SDWR	0x0400000000000000 /* Secondary DVMA write is cause*/
-#define  SYSIO_CEAFSR_RESV1	0x0300000000000000 /* Reserved                     */
-#define  SYSIO_CEAFSR_ESYND	0x00ff000000000000 /* Syndrome Bits                */
-#define  SYSIO_CEAFSR_DOFF	0x0000e00000000000 /* Double Offset                */
-#define  SYSIO_CEAFSR_SIZE	0x00001c0000000000 /* Bad transfer size is 2**SIZE */
-#define  SYSIO_CEAFSR_MID	0x000003e000000000 /* UPA MID causing the fault    */
-#define  SYSIO_CEAFSR_RESV2	0x0000001fffffffff /* Reserved                     */
+#define  SYSIO_CEAFSR_PPIO  0x8000000000000000UL /* Primary PIO cause         */
+#define  SYSIO_CEAFSR_PDRD  0x4000000000000000UL /* Primary DVMA read cause   */
+#define  SYSIO_CEAFSR_PDWR  0x2000000000000000UL /* Primary DVMA write cause  */
+#define  SYSIO_CEAFSR_SPIO  0x1000000000000000UL /* Secondary PIO cause       */
+#define  SYSIO_CEAFSR_SDRD  0x0800000000000000UL /* Secondary DVMA read cause */
+#define  SYSIO_CEAFSR_SDWR  0x0400000000000000UL /* Secondary DVMA write cause*/
+#define  SYSIO_CEAFSR_RESV1 0x0300000000000000UL /* Reserved                  */
+#define  SYSIO_CEAFSR_ESYND 0x00ff000000000000UL /* Syndrome Bits             */
+#define  SYSIO_CEAFSR_DOFF  0x0000e00000000000UL /* Double Offset             */
+#define  SYSIO_CEAFSR_SIZE  0x00001c0000000000UL /* Bad transfer size 2^SIZE  */
+#define  SYSIO_CEAFSR_MID   0x000003e000000000UL /* UPA MID causing the fault */
+#define  SYSIO_CEAFSR_RESV2 0x0000001fffffffffUL /* Reserved                  */
 static irqreturn_t sysio_ce_handler(int irq, void *dev_id, struct pt_regs *regs)
 {
 	struct sbus_bus *sbus = dev_id;
@@ -958,18 +958,18 @@
 
 #define SYSIO_SBUS_AFSR		0x2010UL
 #define SYSIO_SBUS_AFAR		0x2018UL
-#define  SYSIO_SBAFSR_PLE	0x8000000000000000 /* Primary Late PIO Error       */
-#define  SYSIO_SBAFSR_PTO	0x4000000000000000 /* Primary SBUS Timeout         */
-#define  SYSIO_SBAFSR_PBERR	0x2000000000000000 /* Primary SBUS Error ACK       */
-#define  SYSIO_SBAFSR_SLE	0x1000000000000000 /* Secondary Late PIO Error     */
-#define  SYSIO_SBAFSR_STO	0x0800000000000000 /* Secondary SBUS Timeout       */
-#define  SYSIO_SBAFSR_SBERR	0x0400000000000000 /* Secondary SBUS Error ACK     */
-#define  SYSIO_SBAFSR_RESV1	0x03ff000000000000 /* Reserved                     */
-#define  SYSIO_SBAFSR_RD	0x0000800000000000 /* Primary was late PIO read    */
-#define  SYSIO_SBAFSR_RESV2	0x0000600000000000 /* Reserved                     */
-#define  SYSIO_SBAFSR_SIZE	0x00001c0000000000 /* Size of transfer             */
-#define  SYSIO_SBAFSR_MID	0x000003e000000000 /* MID causing the error        */
-#define  SYSIO_SBAFSR_RESV3	0x0000001fffffffff /* Reserved                     */
+#define  SYSIO_SBAFSR_PLE   0x8000000000000000UL /* Primary Late PIO Error    */
+#define  SYSIO_SBAFSR_PTO   0x4000000000000000UL /* Primary SBUS Timeout      */
+#define  SYSIO_SBAFSR_PBERR 0x2000000000000000UL /* Primary SBUS Error ACK    */
+#define  SYSIO_SBAFSR_SLE   0x1000000000000000UL /* Secondary Late PIO Error  */
+#define  SYSIO_SBAFSR_STO   0x0800000000000000UL /* Secondary SBUS Timeout    */
+#define  SYSIO_SBAFSR_SBERR 0x0400000000000000UL /* Secondary SBUS Error ACK  */
+#define  SYSIO_SBAFSR_RESV1 0x03ff000000000000UL /* Reserved                  */
+#define  SYSIO_SBAFSR_RD    0x0000800000000000UL /* Primary was late PIO read */
+#define  SYSIO_SBAFSR_RESV2 0x0000600000000000UL /* Reserved                  */
+#define  SYSIO_SBAFSR_SIZE  0x00001c0000000000UL /* Size of transfer          */
+#define  SYSIO_SBAFSR_MID   0x000003e000000000UL /* MID causing the error     */
+#define  SYSIO_SBAFSR_RESV3 0x0000001fffffffffUL /* Reserved                  */
 static irqreturn_t sysio_sbus_error_handler(int irq, void *dev_id, struct pt_regs *regs)
 {
 	struct sbus_bus *sbus = dev_id;
@@ -1030,9 +1030,9 @@
 }
 
 #define ECC_CONTROL	0x0020UL
-#define  SYSIO_ECNTRL_ECCEN	0x8000000000000000 /* Enable ECC Checking          */
-#define  SYSIO_ECNTRL_UEEN	0x4000000000000000 /* Enable UE Interrupts         */
-#define  SYSIO_ECNTRL_CEEN	0x2000000000000000 /* Enable CE Interrupts         */
+#define  SYSIO_ECNTRL_ECCEN	0x8000000000000000UL /* Enable ECC Checking   */
+#define  SYSIO_ECNTRL_UEEN	0x4000000000000000UL /* Enable UE Interrupts  */
+#define  SYSIO_ECNTRL_CEEN	0x2000000000000000UL /* Enable CE Interrupts  */
 
 #define SYSIO_UE_INO		0x34
 #define SYSIO_CE_INO		0x35
diff -Nru a/arch/sparc64/kernel/setup.c b/arch/sparc64/kernel/setup.c
--- a/arch/sparc64/kernel/setup.c	2004-06-02 23:26:59 -07:00
+++ b/arch/sparc64/kernel/setup.c	2004-06-02 23:26:59 -07:00
@@ -293,7 +293,7 @@
 		unsigned long tte;
 
 		tte = args[3];
-		prom_printf("%lx ", (tte & 0x07FC000000000000) >> 50);
+		prom_printf("%lx ", (tte & 0x07FC000000000000UL) >> 50);
 
 		args[2] = 2;
 		args[args[1] + 3] = 0;
diff -Nru a/arch/sparc64/kernel/signal.c b/arch/sparc64/kernel/signal.c
--- a/arch/sparc64/kernel/signal.c	2004-06-02 23:26:59 -07:00
+++ b/arch/sparc64/kernel/signal.c	2004-06-02 23:26:59 -07:00
@@ -42,7 +42,8 @@
 /* {set, get}context() needed for 64-bit SparcLinux userland. */
 asmlinkage void sparc64_set_context(struct pt_regs *regs)
 {
-	struct ucontext *ucp = (struct ucontext __user *) regs->u_regs[UREG_I0];
+	struct ucontext __user *ucp = (struct ucontext __user *)
+		regs->u_regs[UREG_I0];
 	mc_gregset_t __user *grp;
 	unsigned long pc, npc, tstate;
 	unsigned long fp, i7;
@@ -139,7 +140,8 @@
 
 asmlinkage void sparc64_get_context(struct pt_regs *regs)
 {
-	struct ucontext *ucp = (struct ucontext __user *) regs->u_regs[UREG_I0];
+	struct ucontext __user *ucp = (struct ucontext __user *)
+		regs->u_regs[UREG_I0];
 	mc_gregset_t __user *grp;
 	mcontext_t __user *mcp;
 	unsigned long fp, i7;
@@ -427,7 +429,7 @@
 	   call it and ignore errors.  */
 	old_fs = get_fs();
 	set_fs(KERNEL_DS);
-	do_sigaltstack(&st, NULL, (unsigned long)sf);
+	do_sigaltstack((const stack_t __user *) &st, NULL, (unsigned long)sf);
 	set_fs(old_fs);
 
 	sigdelsetmask(&set, ~_BLOCKABLE);
diff -Nru a/arch/sparc64/kernel/signal32.c b/arch/sparc64/kernel/signal32.c
--- a/arch/sparc64/kernel/signal32.c	2004-06-02 23:26:58 -07:00
+++ b/arch/sparc64/kernel/signal32.c	2004-06-02 23:26:58 -07:00
@@ -345,8 +345,10 @@
 	current_thread_info()->restart_block.fn = do_no_restart_syscall;
 
 	synchronize_user_stack();
-	if (test_thread_flag(TIF_NEWSIGNALS))
-		return do_new_sigreturn32(regs);
+	if (test_thread_flag(TIF_NEWSIGNALS)) {
+		do_new_sigreturn32(regs);
+		return;
+	}
 
 	scptr = (struct sigcontext32 __user *)
 		(regs->u_regs[UREG_I0] & 0x00000000ffffffffUL);
@@ -469,7 +471,7 @@
 	   call it and ignore errors.  */
 	old_fs = get_fs();
 	set_fs(KERNEL_DS);
-	do_sigaltstack(&st, NULL, (unsigned long)sf);
+	do_sigaltstack((stack_t __user *) &st, NULL, (unsigned long)sf);
 	set_fs(old_fs);
 	
 	switch (_NSIG_WORDS) {
@@ -1039,7 +1041,7 @@
 	   call it and ignore errors.  */
 	old_fs = get_fs();
 	set_fs(KERNEL_DS);
-	do_sigaltstack(&st, NULL, regs->u_regs[UREG_I6]);
+	do_sigaltstack((stack_t __user *) &st, NULL, regs->u_regs[UREG_I6]);
 	set_fs(old_fs);
 	
 	sigdelsetmask(&set, ~_BLOCKABLE);
@@ -1361,7 +1363,8 @@
 	uss.ss_sp = (void *) (long) u_ss_sp;
 	old_fs = get_fs();
 	set_fs(KERNEL_DS);
-	ret = do_sigaltstack(ussa ? &uss : NULL, uossa ? &uoss : NULL, sp);
+	ret = do_sigaltstack(ussa ? (stack_t __user *) &uss : NULL,
+			     uossa ? (stack_t __user *) &uoss : NULL, sp);
 	set_fs(old_fs);
 	if (!ret && uossa && (put_user((long)uoss.ss_sp, &((stack_t32 __user *)(long)uossa)->ss_sp) ||
 		    __put_user(uoss.ss_flags, &((stack_t32 __user *)(long)uossa)->ss_flags) ||
diff -Nru a/arch/sparc64/kernel/sunos_ioctl32.c b/arch/sparc64/kernel/sunos_ioctl32.c
--- a/arch/sparc64/kernel/sunos_ioctl32.c	2004-06-02 23:27:00 -07:00
+++ b/arch/sparc64/kernel/sunos_ioctl32.c	2004-06-02 23:27:00 -07:00
@@ -104,10 +104,11 @@
 
 	if(cmd == TIOCSETD) {
 		mm_segment_t old_fs = get_fs();
-		int *p, ntty = N_TTY;
+		int __user *p;
+		int ntty = N_TTY;
 		int tmp;
 
-		p = (int *)A(arg);
+		p = (int __user *)A(arg);
 		ret = -EFAULT;
 		if(get_user(tmp, p))
 			goto out;
@@ -237,10 +238,10 @@
 
 	/* Non posix grp */
 	case _IOW('t', 118, int): {
-		int oldval, newval, *ptr;
+		int oldval, newval, __user *ptr;
 
 		cmd = TIOCSPGRP;
-		ptr = (int *) A(arg);
+		ptr = (int __user *) A(arg);
 		ret = -EFAULT;
 		if(get_user(oldval, ptr))
 			goto out;
@@ -256,10 +257,10 @@
 	}
 
 	case _IOR('t', 119, int): {
-		int oldval, newval, *ptr;
+		int oldval, newval, __user *ptr;
 
 		cmd = TIOCGPGRP;
-		ptr = (int *) A(arg);
+		ptr = (int __user *) A(arg);
 		ret = -EFAULT;
 		if(get_user(oldval, ptr))
 			goto out;
diff -Nru a/arch/sparc64/kernel/sys_sparc.c b/arch/sparc64/kernel/sys_sparc.c
--- a/arch/sparc64/kernel/sys_sparc.c	2004-06-02 23:26:59 -07:00
+++ b/arch/sparc64/kernel/sys_sparc.c	2004-06-02 23:26:59 -07:00
@@ -208,10 +208,10 @@
 	if (call <= SEMCTL)
 		switch (call) {
 		case SEMOP:
-			err = sys_semtimedop (first, (struct sembuf *)ptr, second, NULL);
+			err = sys_semtimedop (first, (struct sembuf __user *)ptr, second, NULL);
 			goto out;
 		case SEMTIMEDOP:
-			err = sys_semtimedop (first, (struct sembuf *)ptr, second, (const struct timespec *) fifth);
+			err = sys_semtimedop (first, (struct sembuf __user *)ptr, second, (const struct timespec __user *) fifth);
 			goto out;
 		case SEMGET:
 			err = sys_semget (first, second, (int)third);
@@ -222,7 +222,7 @@
 			if (!ptr)
 				goto out;
 			err = -EFAULT;
-			if(get_user(fourth.__pad, (void **)ptr))
+			if (get_user(fourth.__pad, (void __user * __user *)ptr))
 				goto out;
 			err = sys_semctl (first, second | IPC_64, (int)third, fourth);
 			goto out;
@@ -234,17 +234,17 @@
 	if (call <= MSGCTL) 
 		switch (call) {
 		case MSGSND:
-			err = sys_msgsnd (first, (struct msgbuf *) ptr, 
+			err = sys_msgsnd (first, (struct msgbuf __user *) ptr, 
 					  second, (int)third);
 			goto out;
 		case MSGRCV:
-			err = sys_msgrcv (first, (struct msgbuf *) ptr, second, fifth, (int)third);
+			err = sys_msgrcv (first, (struct msgbuf __user *) ptr, second, fifth, (int)third);
 			goto out;
 		case MSGGET:
 			err = sys_msgget ((key_t) first, second);
 			goto out;
 		case MSGCTL:
-			err = sys_msgctl (first, second | IPC_64, (struct msqid_ds *) ptr);
+			err = sys_msgctl (first, second | IPC_64, (struct msqid_ds __user *) ptr);
 			goto out;
 		default:
 			err = -ENOSYS;
@@ -254,7 +254,7 @@
 		switch (call) {
 		case SHMAT: {
 			ulong raddr;
-			err = do_shmat (first, (char *) ptr, second, &raddr);
+			err = do_shmat (first, (char __user *) ptr, second, &raddr);
 			if (!err) {
 				if (put_user(raddr, (ulong __user *) third))
 					err = -EFAULT;
@@ -262,13 +262,13 @@
 			goto out;
 		}
 		case SHMDT:
-			err = sys_shmdt ((char *)ptr);
+			err = sys_shmdt ((char __user *)ptr);
 			goto out;
 		case SHMGET:
 			err = sys_shmget (first, second, (int)third);
 			goto out;
 		case SHMCTL:
-			err = sys_shmctl (first, second | IPC_64, (struct shmid_ds *) ptr);
+			err = sys_shmctl (first, second | IPC_64, (struct shmid_ds __user *) ptr);
 			goto out;
 		default:
 			err = -ENOSYS;
@@ -636,8 +636,8 @@
 	switch(opcode) {
 	case PERFCTR_ON:
 		current_thread_info()->pcr_reg = arg2;
-		current_thread_info()->user_cntd0 = (u64 *) arg0;
-		current_thread_info()->user_cntd1 = (u64 *) arg1;
+		current_thread_info()->user_cntd0 = (u64 __user *) arg0;
+		current_thread_info()->user_cntd1 = (u64 __user *) arg1;
 		current_thread_info()->kernel_cntd0 =
 			current_thread_info()->kernel_cntd1 = 0;
 		write_pcr(arg2);
@@ -684,7 +684,8 @@
 		break;
 
 	case PERFCTR_SETPCR: {
-		u64 *user_pcr = (u64 *)arg0;
+		u64 __user *user_pcr = (u64 __user *)arg0;
+
 		if (!test_thread_flag(TIF_PERFCTR)) {
 			err = -EINVAL;
 			break;
@@ -698,7 +699,8 @@
 	}
 
 	case PERFCTR_GETPCR: {
-		u64 *user_pcr = (u64 *)arg0;
+		u64 __user *user_pcr = (u64 __user *)arg0;
+
 		if (!test_thread_flag(TIF_PERFCTR)) {
 			err = -EINVAL;
 			break;
diff -Nru a/arch/sparc64/kernel/sys_sparc32.c b/arch/sparc64/kernel/sys_sparc32.c
--- a/arch/sparc64/kernel/sys_sparc32.c	2004-06-02 23:26:59 -07:00
+++ b/arch/sparc64/kernel/sys_sparc32.c	2004-06-02 23:26:59 -07:00
@@ -87,12 +87,12 @@
 })
 
  
-asmlinkage long sys32_chown16(const char * filename, u16 user, u16 group)
+asmlinkage long sys32_chown16(const char __user * filename, u16 user, u16 group)
 {
 	return sys_chown(filename, low2highuid(user), low2highgid(group));
 }
 
-asmlinkage long sys32_lchown16(const char * filename, u16 user, u16 group)
+asmlinkage long sys32_lchown16(const char __user * filename, u16 user, u16 group)
 {
 	return sys_lchown(filename, low2highuid(user), low2highgid(group));
 }
@@ -128,7 +128,7 @@
 		low2highuid(suid));
 }
 
-asmlinkage long sys32_getresuid16(u16 *ruid, u16 *euid, u16 *suid)
+asmlinkage long sys32_getresuid16(u16 __user *ruid, u16 __user *euid, u16 __user *suid)
 {
 	int retval;
 
@@ -145,7 +145,7 @@
 		low2highgid(sgid));
 }
 
-asmlinkage long sys32_getresgid16(u16 *rgid, u16 *egid, u16 *sgid)
+asmlinkage long sys32_getresgid16(u16 __user *rgid, u16 __user *egid, u16 __user *sgid)
 {
 	int retval;
 
@@ -166,7 +166,7 @@
 	return sys_setfsgid((gid_t)gid);
 }
 
-static int groups16_to_user(u16 *grouplist, struct group_info *group_info)
+static int groups16_to_user(u16 __user *grouplist, struct group_info *group_info)
 {
 	int i;
 	u16 group;
@@ -180,7 +180,7 @@
 	return 0;
 }
 
-static int groups16_from_user(struct group_info *group_info, u16 *grouplist)
+static int groups16_from_user(struct group_info *group_info, u16 __user *grouplist)
 {
 	int i;
 	u16 group;
@@ -194,7 +194,7 @@
 	return 0;
 }
 
-asmlinkage long sys32_getgroups16(int gidsetsize, u16 *grouplist)
+asmlinkage long sys32_getgroups16(int gidsetsize, u16 __user *grouplist)
 {
 	int i;
 
@@ -218,7 +218,7 @@
 	return i;
 }
 
-asmlinkage long sys32_setgroups16(int gidsetsize, u16 *grouplist)
+asmlinkage long sys32_setgroups16(int gidsetsize, u16 __user *grouplist)
 {
 	struct group_info *group_info;
 	int retval;
@@ -265,14 +265,14 @@
 
 /* 32-bit timeval and related flotsam.  */
 
-static long get_tv32(struct timeval *o, struct compat_timeval *i)
+static long get_tv32(struct timeval *o, struct compat_timeval __user *i)
 {
 	return (!access_ok(VERIFY_READ, tv32, sizeof(*tv32)) ||
 		(__get_user(o->tv_sec, &i->tv_sec) |
 		 __get_user(o->tv_usec, &i->tv_usec)));
 }
 
-static inline long put_tv32(struct compat_timeval *o, struct timeval *i)
+static inline long put_tv32(struct compat_timeval __user *o, struct timeval *i)
 {
 	return (!access_ok(VERIFY_WRITE, o, sizeof(*o)) ||
 		(__put_user(i->tv_sec, &o->tv_sec) |
@@ -392,12 +392,12 @@
 	if (!uptr)
 		goto out;
 	err = -EFAULT;
-	if (get_user (pad, (u32 *)uptr))
+	if (get_user (pad, (u32 __user *)uptr))
 		goto out;
 	if ((third & ~IPC_64) == SETVAL)
 		fourth.val = (int)pad;
 	else
-		fourth.__pad = (void *)A(pad);
+		fourth.__pad = (void __user *)A(pad);
 	if (IPCOP_MASK (third) &
 	    (IPCOP_MASK (IPC_INFO) | IPCOP_MASK (SEM_INFO) | IPCOP_MASK (GETVAL) |
 	     IPCOP_MASK (GETPID) | IPCOP_MASK (GETNCNT) | IPCOP_MASK (GETZCNT) |
@@ -405,7 +405,8 @@
 		err = sys_semctl (first, second, third, fourth);
 	} else if (third & IPC_64) {
 		struct semid64_ds s;
-		struct semid64_ds32 *usp = (struct semid64_ds32 *)A(pad);
+		struct semid64_ds32 __user *usp =
+			(struct semid64_ds32 __user *)A(pad);
 		mm_segment_t old_fs;
 		int need_back_translation;
 
@@ -415,13 +416,13 @@
 			err |= __get_user (s.sem_perm.mode, &usp->sem_perm.mode);
 			if (err)
 				goto out;
-			fourth.__pad = &s;
+			fourth.__pad = (void __user *) &s;
 		}
 		need_back_translation =
 			(IPCOP_MASK (third) &
 			 (IPCOP_MASK (SEM_STAT) | IPCOP_MASK (IPC_STAT))) != 0;
 		if (need_back_translation)
-			fourth.__pad = &s;
+			fourth.__pad = (void __user *) &s;
 		old_fs = get_fs ();
 		set_fs (KERNEL_DS);
 		err = sys_semctl (first, second, third, fourth);
@@ -433,7 +434,8 @@
 		}
 	} else {
 		struct semid_ds s;
-		struct semid_ds32 *usp = (struct semid_ds32 *)A(pad);
+		struct semid_ds32 __user *usp =
+			(struct semid_ds32 __user *)A(pad);
 		mm_segment_t old_fs;
 		int need_back_translation;
 
@@ -443,13 +445,13 @@
 			err |= __get_user (s.sem_perm.mode, &usp->sem_perm.mode);
 			if (err)
 				goto out;
-			fourth.__pad = &s;
+			fourth.__pad = (void __user *) &s;
 		}
 		need_back_translation =
 			(IPCOP_MASK (third) &
 			 (IPCOP_MASK (SEM_STAT) | IPCOP_MASK (IPC_STAT))) != 0;
 		if (need_back_translation)
-			fourth.__pad = &s;
+			fourth.__pad = (void __user *) &s;
 		old_fs = get_fs ();
 		set_fs (KERNEL_DS);
 		err = sys_semctl (first, second, third, fourth);
@@ -475,7 +477,7 @@
 static int do_sys32_msgsnd (int first, int second, int third, void *uptr)
 {
 	struct msgbuf *p = kmalloc (second + sizeof (struct msgbuf), GFP_USER);
-	struct msgbuf32 *up = (struct msgbuf32 *)uptr;
+	struct msgbuf32 __user *up = (struct msgbuf32 __user *) uptr;
 	mm_segment_t old_fs;
 	int err;
 
@@ -487,7 +489,7 @@
 		goto out;
 	old_fs = get_fs ();
 	set_fs (KERNEL_DS);
-	err = sys_msgsnd (first, p, second, third);
+	err = sys_msgsnd (first, (struct msgbuf __user *) p, second, third);
 	set_fs (old_fs);
 out:
 	kfree (p);
@@ -497,13 +499,14 @@
 static int do_sys32_msgrcv (int first, int second, int msgtyp, int third,
 			    int version, void *uptr)
 {
-	struct msgbuf32 *up;
+	struct msgbuf32 __user *up;
 	struct msgbuf *p;
 	mm_segment_t old_fs;
 	int err;
 
 	if (!version) {
-		struct ipc_kludge *uipck = (struct ipc_kludge *)uptr;
+		struct ipc_kludge __user *uipck =
+			(struct ipc_kludge __user *) uptr;
 		struct ipc_kludge ipck;
 
 		err = -EINVAL;
@@ -521,11 +524,12 @@
 		goto out;
 	old_fs = get_fs ();
 	set_fs (KERNEL_DS);
-	err = sys_msgrcv (first, p, second, msgtyp, third);
+	err = sys_msgrcv (first, (struct msgbuf __user *) p, second,
+			  msgtyp, third);
 	set_fs (old_fs);
 	if (err < 0)
 		goto free_then_out;
-	up = (struct msgbuf32 *)uptr;
+	up = (struct msgbuf32 __user *) uptr;
 	if (put_user (p->mtype, &up->mtype) ||
 	    __copy_to_user (&up->mtext, p->mtext, err))
 		err = -EFAULT;
@@ -542,10 +546,12 @@
 	if (IPCOP_MASK (second) &
 	    (IPCOP_MASK (IPC_INFO) | IPCOP_MASK (MSG_INFO) |
 	     IPCOP_MASK (IPC_RMID))) {
-		err = sys_msgctl (first, second, (struct msqid_ds *)uptr);
+		err = sys_msgctl (first, second,
+				  (struct msqid_ds __user *)uptr);
 	} else if (second & IPC_64) {
 		struct msqid64_ds m;
-		struct msqid64_ds32 *up = (struct msqid64_ds32 *)uptr;
+		struct msqid64_ds32 __user *up =
+			(struct msqid64_ds32 __user *) uptr;
 		mm_segment_t old_fs;
 
 		if (second == (IPC_SET|IPC_64)) {
@@ -558,7 +564,7 @@
 		}
 		old_fs = get_fs ();
 		set_fs (KERNEL_DS);
-		err = sys_msgctl (first, second, (struct msqid_ds *)&m);
+		err = sys_msgctl (first, second, (struct msqid_ds __user *)&m);
 		set_fs (old_fs);
 		if (IPCOP_MASK (second) &
 		    (IPCOP_MASK (MSG_STAT) | IPCOP_MASK (IPC_STAT))) {
@@ -573,7 +579,8 @@
 		}
 	} else {
 		struct msqid_ds m;
-		struct msqid_ds32 *up = (struct msqid_ds32 *)uptr;
+		struct msqid_ds32 __user *up =
+			(struct msqid_ds32 __user *)uptr;
 		mm_segment_t old_fs;
 
 		if (second == IPC_SET) {
@@ -586,7 +593,7 @@
 		}
 		old_fs = get_fs ();
 		set_fs (KERNEL_DS);
-		err = sys_msgctl (first, second, &m);
+		err = sys_msgctl (first, second, (struct msqid_ds __user *) &m);
 		set_fs (old_fs);
 		if (IPCOP_MASK (second) &
 		    (IPCOP_MASK (MSG_STAT) | IPCOP_MASK (IPC_STAT))) {
@@ -614,10 +621,10 @@
 	return err;
 }
 
-static int do_sys32_shmat (int first, int second, int third, int version, void *uptr)
+static int do_sys32_shmat (int first, int second, int third, int version, void __user *uptr)
 {
 	unsigned long raddr;
-	u32 *uaddr = (u32 *)A((u32)third);
+	u32 __user *uaddr = (u32 __user *)A((u32)third);
 	int err = -EINVAL;
 
 	if (version == 1)
@@ -639,10 +646,12 @@
 	     IPCOP_MASK (IPC_RMID))) {
 		if (second == (IPC_INFO|IPC_64))
 			second = IPC_INFO; /* So that we don't have to translate it */
-		err = sys_shmctl (first, second, (struct shmid_ds *)uptr);
+		err = sys_shmctl (first, second,
+				  (struct shmid_ds __user *) uptr);
 	} else if ((second & IPC_64) && second != (SHM_INFO|IPC_64)) {
 		struct shmid64_ds s;
-		struct shmid64_ds32 *up = (struct shmid64_ds32 *)uptr;
+		struct shmid64_ds32 __user *up =
+			(struct shmid64_ds32 __user *) uptr;
 		mm_segment_t old_fs;
 
 		if (second == (IPC_SET|IPC_64)) {
@@ -654,7 +663,7 @@
 		}
 		old_fs = get_fs ();
 		set_fs (KERNEL_DS);
-		err = sys_shmctl (first, second, (struct shmid_ds *)&s);
+		err = sys_shmctl (first, second, (struct shmid_ds __user *)&s);
 		set_fs (old_fs);
 		if (err < 0)
 			goto out;
@@ -672,7 +681,8 @@
 		}
 	} else {
 		struct shmid_ds s;
-		struct shmid_ds32 *up = (struct shmid_ds32 *)uptr;
+		struct shmid_ds32 __user *up =
+			(struct shmid_ds32 __user *) uptr;
 		mm_segment_t old_fs;
 
 		second &= ~IPC_64;
@@ -685,7 +695,7 @@
 		}
 		old_fs = get_fs ();
 		set_fs (KERNEL_DS);
-		err = sys_shmctl (first, second, &s);
+		err = sys_shmctl (first, second, (struct shmid_ds __user *) &s);
 		set_fs (old_fs);
 		if (err < 0)
 			goto out;
@@ -696,7 +706,9 @@
 				int used_ids;
 				u32 shm_tot, shm_rss, shm_swp;
 				u32 swap_attempts, swap_successes;
-			} *uip = (struct shm_info32 *)uptr;
+			};
+			struct shm_info32 __user *uip =
+				(struct shm_info32 __user *) uptr;
 			struct shm_info *kp = (struct shm_info *)&s;
 			int err2 = put_user (kp->used_ids, &uip->used_ids);
 			err2 |= __put_user (kp->shm_tot, &uip->shm_tot);
@@ -730,11 +742,11 @@
 	return err;
 }
 
-static int sys32_semtimedop(int semid, struct sembuf *tsems, int nsems,
-			    const struct compat_timespec *timeout32)
+static int sys32_semtimedop(int semid, struct sembuf __user *tsems, int nsems,
+			    const struct compat_timespec __user *timeout32)
 {
 	struct compat_timespec t32;
-	struct timespec *t64 = compat_alloc_user_space(sizeof(*t64));
+	struct timespec __user *t64 = compat_alloc_user_space(sizeof(*t64));
 
 	if (copy_from_user(&t32, timeout32, sizeof(t32)))
 		return -EFAULT;
@@ -757,10 +769,10 @@
 		switch (call) {
 		case SEMOP:
 			/* struct sembuf is the same on 32 and 64bit :)) */
-			err = sys_semtimedop (first, (struct sembuf *)AA(ptr), second, NULL);
+			err = sys_semtimedop (first, (struct sembuf __user *)AA(ptr), second, NULL);
 			goto out;
 		case SEMTIMEDOP:
-			err = sys32_semtimedop (first, (struct sembuf *)AA(ptr), second, (const struct compat_timespec *) AA(fifth));
+			err = sys32_semtimedop (first, (struct sembuf __user *)AA(ptr), second, (const struct compat_timespec __user *) AA(fifth));
 		case SEMGET:
 			err = sys_semget (first, second, third);
 			goto out;
@@ -794,10 +806,10 @@
 		switch (call) {
 		case SHMAT:
 			err = do_sys32_shmat (first, second, third,
-					      version, (void *)AA(ptr));
+					      version, (void __user *)AA(ptr));
 			goto out;
 		case SHMDT: 
-			err = sys_shmdt ((char *)AA(ptr));
+			err = sys_shmdt ((char __user *)AA(ptr));
 			goto out;
 		case SHMGET:
 			err = sys_shmget (first, second, third);
@@ -816,7 +828,7 @@
 	return err;
 }
 
-asmlinkage int sys32_truncate64(const char * path, unsigned long high, unsigned long low)
+asmlinkage int sys32_truncate64(const char __user * path, unsigned long high, unsigned long low)
 {
 	if ((int)high < 0)
 		return -EINVAL;
@@ -834,7 +846,7 @@
 
 /* readdir & getdents */
 
-#define NAME_OFFSET(de) ((int) ((de)->d_name - (char *) (de)))
+#define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de)))
 #define ROUND_UP(x) (((x)+sizeof(u32)-1) & ~(sizeof(u32)-1))
 
 struct old_linux_dirent32 {
@@ -845,7 +857,7 @@
 };
 
 struct readdir_callback32 {
-	struct old_linux_dirent32 * dirent;
+	struct old_linux_dirent32 __user * dirent;
 	int count;
 };
 
@@ -853,7 +865,7 @@
 		      loff_t offset, ino_t ino, unsigned int d_type)
 {
 	struct readdir_callback32 * buf = (struct readdir_callback32 *) __buf;
-	struct old_linux_dirent32 * dirent;
+	struct old_linux_dirent32 __user * dirent;
 
 	if (buf->count)
 		return -EINVAL;
@@ -867,7 +879,7 @@
 	return 0;
 }
 
-asmlinkage int old32_readdir(unsigned int fd, struct old_linux_dirent32 *dirent, unsigned int count)
+asmlinkage int old32_readdir(unsigned int fd, struct old_linux_dirent32 __user *dirent, unsigned int count)
 {
 	int error = -EBADF;
 	struct file * file;
@@ -899,8 +911,8 @@
 };
 
 struct getdents_callback32 {
-	struct linux_dirent32 * current_dir;
-	struct linux_dirent32 * previous;
+	struct linux_dirent32 __user *current_dir;
+	struct linux_dirent32 __user *previous;
 	int count;
 	int error;
 };
@@ -908,7 +920,7 @@
 static int filldir(void * __buf, const char * name, int namlen, loff_t offset, ino_t ino,
 		   unsigned int d_type)
 {
-	struct linux_dirent32 * dirent;
+	struct linux_dirent32 __user * dirent;
 	struct getdents_callback32 * buf = (struct getdents_callback32 *) __buf;
 	int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 2);
 
@@ -924,17 +936,17 @@
 	put_user(reclen, &dirent->d_reclen);
 	copy_to_user(dirent->d_name, name, namlen);
 	put_user(0, dirent->d_name + namlen);
-	put_user(d_type, (char *) dirent + reclen - 1);
-	dirent = (void *) dirent + reclen;
+	put_user(d_type, (char __user *) dirent + reclen - 1);
+	dirent = (void __user *) dirent + reclen;
 	buf->current_dir = dirent;
 	buf->count -= reclen;
 	return 0;
 }
 
-asmlinkage int sys32_getdents(unsigned int fd, struct linux_dirent32 *dirent, unsigned int count)
+asmlinkage int sys32_getdents(unsigned int fd, struct linux_dirent32 __user *dirent, unsigned int count)
 {
 	struct file * file;
-	struct linux_dirent32 * lastdirent;
+	struct linux_dirent32 __user *lastdirent;
 	struct getdents_callback32 buf;
 	int error = -EBADF;
 
@@ -964,7 +976,7 @@
 
 /* end of readdir & getdents */
 
-int cp_compat_stat(struct kstat *stat, struct compat_stat *statbuf)
+int cp_compat_stat(struct kstat *stat, struct compat_stat __user *statbuf)
 {
 	int err;
 
@@ -1016,7 +1028,7 @@
 	char _f[20-2*sizeof(int)-sizeof(int)];
 };
 
-asmlinkage int sys32_sysinfo(struct sysinfo32 *info)
+asmlinkage int sys32_sysinfo(struct sysinfo32 __user *info)
 {
 	struct sysinfo s;
 	int ret, err;
@@ -1024,7 +1036,7 @@
 	mm_segment_t old_fs = get_fs ();
 	
 	set_fs(KERNEL_DS);
-	ret = sys_sysinfo(&s);
+	ret = sys_sysinfo((struct sysinfo __user *) &s);
 	set_fs(old_fs);
 	/* Check to see if any memory value is too large for 32-bit and
          * scale down if needed.
@@ -1063,21 +1075,21 @@
 	return ret;
 }
 
-asmlinkage int sys32_sched_rr_get_interval(compat_pid_t pid, struct compat_timespec *interval)
+asmlinkage int sys32_sched_rr_get_interval(compat_pid_t pid, struct compat_timespec __user *interval)
 {
 	struct timespec t;
 	int ret;
 	mm_segment_t old_fs = get_fs ();
 	
 	set_fs (KERNEL_DS);
-	ret = sys_sched_rr_get_interval(pid, &t);
+	ret = sys_sched_rr_get_interval(pid, (struct timespec __user *) &t);
 	set_fs (old_fs);
 	if (put_compat_timespec(&t, interval))
 		return -EFAULT;
 	return ret;
 }
 
-asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t *set, compat_sigset_t *oset, compat_size_t sigsetsize)
+asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t __user *set, compat_sigset_t __user *oset, compat_size_t sigsetsize)
 {
 	sigset_t s;
 	compat_sigset_t s32;
@@ -1095,7 +1107,10 @@
 		}
 	}
 	set_fs (KERNEL_DS);
-	ret = sys_rt_sigprocmask(how, set ? &s : NULL, oset ? &s : NULL, sigsetsize);
+	ret = sys_rt_sigprocmask(how,
+				 set ? (sigset_t __user *) &s : NULL,
+				 oset ? (sigset_t __user *) &s : NULL,
+				 sigsetsize);
 	set_fs (old_fs);
 	if (ret) return ret;
 	if (oset) {
@@ -1111,7 +1126,7 @@
 	return 0;
 }
 
-asmlinkage int sys32_rt_sigpending(compat_sigset_t *set, compat_size_t sigsetsize)
+asmlinkage int sys32_rt_sigpending(compat_sigset_t __user *set, compat_size_t sigsetsize)
 {
 	sigset_t s;
 	compat_sigset_t s32;
@@ -1119,7 +1134,7 @@
 	mm_segment_t old_fs = get_fs();
 		
 	set_fs (KERNEL_DS);
-	ret = sys_rt_sigpending(&s, sigsetsize);
+	ret = sys_rt_sigpending((sigset_t __user *) &s, sigsetsize);
 	set_fs (old_fs);
 	if (!ret) {
 		switch (_NSIG_WORDS) {
@@ -1135,8 +1150,9 @@
 }
 
 asmlinkage int
-sys32_rt_sigtimedwait(compat_sigset_t *uthese, siginfo_t32 *uinfo,
-		      struct compat_timespec *uts, compat_size_t sigsetsize)
+sys32_rt_sigtimedwait(compat_sigset_t __user *uthese, siginfo_t32 __user *uinfo,
+		      struct compat_timespec __user *uts,
+		      compat_size_t sigsetsize)
 {
 	int ret, sig;
 	sigset_t these;
@@ -1219,7 +1235,7 @@
 }
 
 asmlinkage int
-sys32_rt_sigqueueinfo(int pid, int sig, siginfo_t32 *uinfo)
+sys32_rt_sigqueueinfo(int pid, int sig, siginfo_t32 __user *uinfo)
 {
 	siginfo_t info;
 	int ret;
@@ -1229,12 +1245,13 @@
 	    copy_from_user (info._sifields._pad, uinfo->_sifields._pad, SI_PAD_SIZE))
 		return -EFAULT;
 	set_fs (KERNEL_DS);
-	ret = sys_rt_sigqueueinfo(pid, sig, &info);
+	ret = sys_rt_sigqueueinfo(pid, sig, (siginfo_t __user *) &info);
 	set_fs (old_fs);
 	return ret;
 }
 
-asmlinkage int sys32_sigaction (int sig, struct old_sigaction32 *act, struct old_sigaction32 *oact)
+asmlinkage int sys32_sigaction (int sig, struct old_sigaction32 __user *act,
+				struct old_sigaction32 __user *oact)
 {
         struct k_sigaction new_ka, old_ka;
         int ret;
@@ -1273,8 +1290,9 @@
 }
 
 asmlinkage int
-sys32_rt_sigaction(int sig, struct sigaction32 *act, struct sigaction32 *oact,
-		   void *restorer, compat_size_t sigsetsize)
+sys32_rt_sigaction(int sig, struct sigaction32 __user *act,
+		   struct sigaction32 __user *oact,
+		   void __user *restorer, compat_size_t sigsetsize)
 {
         struct k_sigaction new_ka, old_ka;
         int ret;
@@ -1344,7 +1362,7 @@
         if((u32)regs->u_regs[UREG_G1] == 0)
                 base = 1;
 
-        filename = getname((char *)AA(regs->u_regs[base + UREG_I0]));
+        filename = getname((char __user *)AA(regs->u_regs[base + UREG_I0]));
 	error = PTR_ERR(filename);
         if(IS_ERR(filename))
                 goto out;
@@ -1366,12 +1384,14 @@
 
 #ifdef CONFIG_MODULES
 
-asmlinkage int sys32_init_module(void *umod, u32 len, const char *uargs)
+asmlinkage int sys32_init_module(void __user *umod, u32 len,
+				 const char __user *uargs)
 {
 	return sys_init_module(umod, len, uargs);
 }
 
-asmlinkage int sys32_delete_module(const char *name_user, unsigned int flags)
+asmlinkage int sys32_delete_module(const char __user *name_user,
+				   unsigned int flags)
 {
 	return sys_delete_module(name_user, flags);
 }
@@ -1397,7 +1417,8 @@
 
 extern struct timezone sys_tz;
 
-asmlinkage int sys32_gettimeofday(struct compat_timeval *tv, struct timezone *tz)
+asmlinkage int sys32_gettimeofday(struct compat_timeval __user *tv,
+				  struct timezone __user *tz)
 {
 	if (tv) {
 		struct timeval ktv;
@@ -1412,7 +1433,7 @@
 	return 0;
 }
 
-static inline long get_ts32(struct timespec *o, struct compat_timeval *i)
+static inline long get_ts32(struct timespec *o, struct compat_timeval __user *i)
 {
 	long usec;
 
@@ -1426,7 +1447,8 @@
 	return 0;
 }
 
-asmlinkage int sys32_settimeofday(struct compat_timeval *tv, struct timezone *tz)
+asmlinkage int sys32_settimeofday(struct compat_timeval __user *tv,
+				  struct timezone __user *tz)
 {
 	struct timespec kts;
 	struct timezone ktz;
@@ -1443,7 +1465,8 @@
 	return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL);
 }
 
-asmlinkage int sys32_utimes(char *filename, struct compat_timeval *tvs)
+asmlinkage int sys32_utimes(char __user *filename,
+			    struct compat_timeval __user *tvs)
 {
 	struct timeval ktvs[2];
 
@@ -1472,7 +1495,7 @@
 				  (unsigned long) dfn,
 				  (unsigned long) off,
 				  (unsigned long) len,
-				  (unsigned char *)AA(ubuf));
+				  (unsigned char __user *)AA(ubuf));
 }
 
 asmlinkage int sys32_pciconfig_write(u32 bus, u32 dfn, u32 off, u32 len, u32 ubuf)
@@ -1481,7 +1504,7 @@
 				   (unsigned long) dfn,
 				   (unsigned long) off,
 				   (unsigned long) len,
-				   (unsigned char *)AA(ubuf));
+				   (unsigned char __user *)AA(ubuf));
 }
 
 asmlinkage int sys32_prctl(int option, u32 arg2, u32 arg3, u32 arg4, u32 arg5)
@@ -1494,13 +1517,15 @@
 }
 
 
-asmlinkage compat_ssize_t sys32_pread64(unsigned int fd, char *ubuf,
-				   compat_size_t count, u32 poshi, u32 poslo)
+asmlinkage compat_ssize_t sys32_pread64(unsigned int fd, char __user *ubuf,
+					compat_size_t count,
+					u32 poshi, u32 poslo)
 {
-	return sys_pread64(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo));
+	return sys_pread64(fd, ubuf, count,
+			   ((loff_t)AA(poshi) << 32) | AA(poslo));
 }
 
-asmlinkage compat_ssize_t sys32_pwrite64(unsigned int fd, char *ubuf,
+asmlinkage compat_ssize_t sys32_pwrite64(unsigned int fd, char __user *ubuf,
 				    compat_size_t count, u32 poshi, u32 poslo)
 {
 	return sys_pwrite64(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo));
@@ -1522,7 +1547,7 @@
 				((loff_t)AA(lenhi)<<32)|AA(lenlo), advice);
 }
 
-asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t *offset, s32 count)
+asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset, s32 count)
 {
 	mm_segment_t old_fs = get_fs();
 	int ret;
@@ -1532,7 +1557,9 @@
 		return -EFAULT;
 		
 	set_fs(KERNEL_DS);
-	ret = sys_sendfile(out_fd, in_fd, offset ? &of : NULL, count);
+	ret = sys_sendfile(out_fd, in_fd,
+			   offset ? (off_t __user *) &of : NULL,
+			   count);
 	set_fs(old_fs);
 	
 	if (offset && put_user(of, offset))
@@ -1541,7 +1568,7 @@
 	return ret;
 }
 
-asmlinkage int sys32_sendfile64(int out_fd, int in_fd, compat_loff_t *offset, s32 count)
+asmlinkage int sys32_sendfile64(int out_fd, int in_fd, compat_loff_t __user *offset, s32 count)
 {
 	mm_segment_t old_fs = get_fs();
 	int ret;
@@ -1551,7 +1578,9 @@
 		return -EFAULT;
 		
 	set_fs(KERNEL_DS);
-	ret = sys_sendfile64(out_fd, in_fd, offset ? &lof : NULL, count);
+	ret = sys_sendfile64(out_fd, in_fd,
+			     offset ? (loff_t __user *) &lof : NULL,
+			     count);
 	set_fs(old_fs);
 	
 	if (offset && put_user(lof, offset))
@@ -1577,7 +1606,7 @@
 
 extern int do_adjtimex(struct timex *);
 
-asmlinkage int sys32_adjtimex(struct timex32 *utp)
+asmlinkage int sys32_adjtimex(struct timex32 __user *utp)
 {
 	struct timex txc;
 	int ret;
@@ -1637,7 +1666,7 @@
  * not force O_LARGEFILE on.
  */
 
-asmlinkage long sparc32_open(const char * filename, int flags, int mode)
+asmlinkage long sparc32_open(const char __user *filename, int flags, int mode)
 {
 	char * tmp;
 	int fd, error;
@@ -1732,15 +1761,15 @@
 	u32 __unused[4];
 };
 
-asmlinkage long sys32_sysctl(struct __sysctl_args32 *args)
+asmlinkage long sys32_sysctl(struct __sysctl_args32 __user *args)
 {
 #ifndef CONFIG_SYSCTL
 	return -ENOSYS;
 #else
 	struct __sysctl_args32 tmp;
 	int error;
-	size_t oldlen, *oldlenp = NULL;
-	unsigned long addr = (((long)&args->__unused[0]) + 7) & ~7;
+	size_t oldlen, __user *oldlenp = NULL;
+	unsigned long addr = (((unsigned long)&args->__unused[0]) + 7UL) & ~7UL;
 
 	if (copy_from_user(&tmp, args, sizeof(tmp)))
 		return -EFAULT;
@@ -1752,20 +1781,21 @@
 		   basically copy the whole sysctl.c here, and
 		   glibc's __sysctl uses rw memory for the structure
 		   anyway.  */
-		if (get_user(oldlen, (u32 *)A(tmp.oldlenp)) ||
-		    put_user(oldlen, (size_t *)addr))
+		if (get_user(oldlen, (u32 __user *)A(tmp.oldlenp)) ||
+		    put_user(oldlen, (size_t __user *)addr))
 			return -EFAULT;
-		oldlenp = (size_t *)addr;
+		oldlenp = (size_t __user *)addr;
 	}
 
 	lock_kernel();
-	error = do_sysctl((int *)A(tmp.name), tmp.nlen, (void *)A(tmp.oldval),
-			  oldlenp, (void *)A(tmp.newval), tmp.newlen);
+	error = do_sysctl((int __user *)A(tmp.name), tmp.nlen,
+			  (void __user *)A(tmp.oldval),
+			  oldlenp, (void __user *)A(tmp.newval), tmp.newlen);
 	unlock_kernel();
 	if (oldlenp) {
 		if (!error) {
-			if (get_user(oldlen, (size_t *)addr) ||
-			    put_user(oldlen, (u32 *)A(tmp.oldlenp)))
+			if (get_user(oldlen, (size_t __user *)addr) ||
+			    put_user(oldlen, (u32 __user *)A(tmp.oldlenp)))
 				error = -EFAULT;
 		}
 		copy_to_user(args->__unused, tmp.__unused, sizeof(tmp.__unused));
@@ -1774,18 +1804,21 @@
 #endif
 }
 
-long sys32_lookup_dcookie(u32 cookie_high, u32 cookie_low, char *buf, size_t len)
+long sys32_lookup_dcookie(u32 cookie_high, u32 cookie_low,
+			  char __user *buf, size_t len)
 {
 	return sys_lookup_dcookie((u64)cookie_high << 32 | cookie_low,
 				  buf, len);
 }
 
 extern asmlinkage long
-sys_timer_create(clockid_t which_clock, struct sigevent *timer_event_spec,
-		 timer_t * created_timer_id);
+sys_timer_create(clockid_t which_clock,
+		 struct sigevent __user *timer_event_spec,
+		 timer_t __user *created_timer_id);
 
 long
-sys32_timer_create(u32 clock, struct sigevent32 *se32, timer_t *timer_id)
+sys32_timer_create(u32 clock, struct sigevent32 __user *se32,
+		   timer_t __user *timer_id)
 {
 	struct sigevent se;
 	mm_segment_t oldfs;
@@ -1808,7 +1841,9 @@
 
 	oldfs = get_fs();
 	set_fs(KERNEL_DS);
-	err = sys_timer_create(clock, &se, &t);
+	err = sys_timer_create(clock,
+			       (struct sigevent __user *) &se,
+			       (timer_t __user *) &t);
 	set_fs(oldfs);
 
 	if (!err)
diff -Nru a/arch/sparc64/kernel/sys_sunos32.c b/arch/sparc64/kernel/sys_sunos32.c
--- a/arch/sparc64/kernel/sys_sunos32.c	2004-06-02 23:26:59 -07:00
+++ b/arch/sparc64/kernel/sys_sunos32.c	2004-06-02 23:26:59 -07:00
@@ -187,7 +187,7 @@
 	/* This should do it hopefully... */
 	oldbrk = (int)current->mm->brk;
 	error = sunos_brk(((int) current->mm->brk) + increment);
-	if(!error)
+	if (!error)
 		error = oldbrk;
 	return error;
 }
@@ -273,19 +273,19 @@
 };
 
 struct sunos_dirent_callback {
-    struct sunos_dirent *curr;
-    struct sunos_dirent *previous;
+    struct sunos_dirent __user *curr;
+    struct sunos_dirent __user *previous;
     int count;
     int error;
 };
 
-#define NAME_OFFSET(de) ((int) ((de)->d_name - (char *) (de)))
+#define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de)))
 #define ROUND_UP(x) (((x)+sizeof(s32)-1) & ~(sizeof(s32)-1))
 
 static int sunos_filldir(void * __buf, const char * name, int namlen,
 			 loff_t offset, ino_t ino, unsigned int d_type)
 {
-	struct sunos_dirent * dirent;
+	struct sunos_dirent __user *dirent;
 	struct sunos_dirent_callback * buf = (struct sunos_dirent_callback *) __buf;
 	int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1);
 
@@ -302,7 +302,7 @@
 	put_user(reclen, &dirent->d_reclen);
 	copy_to_user(dirent->d_name, name, namlen);
 	put_user(0, dirent->d_name + namlen);
-	dirent = (void *) dirent + reclen;
+	dirent = (void __user *) dirent + reclen;
 	buf->curr = dirent;
 	buf->count -= reclen;
 	return 0;
@@ -311,23 +311,23 @@
 asmlinkage int sunos_getdents(unsigned int fd, u32 u_dirent, int cnt)
 {
 	struct file * file;
-	struct sunos_dirent * lastdirent;
+	struct sunos_dirent __user *lastdirent;
 	struct sunos_dirent_callback buf;
 	int error = -EBADF;
-	void *dirent = (void *)A(u_dirent);
+	void __user *dirent = (void __user *)A(u_dirent);
 
-	if(fd >= SUNOS_NR_OPEN)
+	if (fd >= SUNOS_NR_OPEN)
 		goto out;
 
 	file = fget(fd);
-	if(!file)
+	if (!file)
 		goto out;
 
 	error = -EINVAL;
-	if(cnt < (sizeof(struct sunos_dirent) + 255))
+	if (cnt < (sizeof(struct sunos_dirent) + 255))
 		goto out_putf;
 
-	buf.curr = (struct sunos_dirent *) dirent;
+	buf.curr = (struct sunos_dirent __user *) dirent;
 	buf.previous = NULL;
 	buf.count = cnt;
 	buf.error = 0;
@@ -358,8 +358,8 @@
 };
 
 struct sunos_direntry_callback {
-    struct sunos_direntry *curr;
-    struct sunos_direntry *previous;
+    struct sunos_direntry __user *curr;
+    struct sunos_direntry __user *previous;
     int count;
     int error;
 };
@@ -367,8 +367,9 @@
 static int sunos_filldirentry(void * __buf, const char * name, int namlen,
 			      loff_t offset, ino_t ino, unsigned int d_type)
 {
-	struct sunos_direntry * dirent;
-	struct sunos_direntry_callback * buf = (struct sunos_direntry_callback *) __buf;
+	struct sunos_direntry __user *dirent;
+	struct sunos_direntry_callback * buf =
+		(struct sunos_direntry_callback *) __buf;
 	int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1);
 
 	buf->error = -EINVAL;	/* only used if we fail.. */
@@ -382,7 +383,7 @@
 	put_user(reclen, &dirent->d_reclen);
 	copy_to_user(dirent->d_name, name, namlen);
 	put_user(0, dirent->d_name + namlen);
-	dirent = (void *) dirent + reclen;
+	dirent = (void __user *) dirent + reclen;
 	buf->curr = dirent;
 	buf->count -= reclen;
 	return 0;
@@ -391,25 +392,25 @@
 asmlinkage int sunos_getdirentries(unsigned int fd, u32 u_dirent,
 				   int cnt, u32 u_basep)
 {
-	void *dirent = (void *) A(u_dirent);
-	unsigned int *basep = (unsigned int *)A(u_basep);
+	void __user *dirent = (void __user *) A(u_dirent);
+	unsigned int __user *basep = (unsigned int __user *)A(u_basep);
 	struct file * file;
-	struct sunos_direntry * lastdirent;
+	struct sunos_direntry __user *lastdirent;
 	int error = -EBADF;
 	struct sunos_direntry_callback buf;
 
-	if(fd >= SUNOS_NR_OPEN)
+	if (fd >= SUNOS_NR_OPEN)
 		goto out;
 
 	file = fget(fd);
-	if(!file)
+	if (!file)
 		goto out;
 
 	error = -EINVAL;
-	if(cnt < (sizeof(struct sunos_direntry) + 255))
+	if (cnt < (sizeof(struct sunos_direntry) + 255))
 		goto out_putf;
 
-	buf.curr = (struct sunos_direntry *) dirent;
+	buf.curr = (struct sunos_direntry __user *) dirent;
 	buf.previous = NULL;
 	buf.count = cnt;
 	buf.error = 0;
@@ -440,17 +441,22 @@
 	char mach[9];
 };
 
-asmlinkage int sunos_uname(struct sunos_utsname *name)
+asmlinkage int sunos_uname(struct sunos_utsname __user *name)
 {
 	int ret;
 
 	down_read(&uts_sem);
-	ret = copy_to_user(&name->sname[0], &system_utsname.sysname[0], sizeof(name->sname) - 1);
-	ret |= copy_to_user(&name->nname[0], &system_utsname.nodename[0], sizeof(name->nname) - 1);
+	ret = copy_to_user(&name->sname[0], &system_utsname.sysname[0],
+			   sizeof(name->sname) - 1);
+	ret |= copy_to_user(&name->nname[0], &system_utsname.nodename[0],
+			    sizeof(name->nname) - 1);
 	ret |= put_user('\0', &name->nname[8]);
-	ret |= copy_to_user(&name->rel[0], &system_utsname.release[0], sizeof(name->rel) - 1);
-	ret |= copy_to_user(&name->ver[0], &system_utsname.version[0], sizeof(name->ver) - 1);
-	ret |= copy_to_user(&name->mach[0], &system_utsname.machine[0], sizeof(name->mach) - 1);
+	ret |= copy_to_user(&name->rel[0], &system_utsname.release[0],
+			    sizeof(name->rel) - 1);
+	ret |= copy_to_user(&name->ver[0], &system_utsname.version[0],
+			    sizeof(name->ver) - 1);
+	ret |= copy_to_user(&name->mach[0], &system_utsname.machine[0],
+			    sizeof(name->mach) - 1);
 	up_read(&uts_sem);
 	return (ret ? -EFAULT : 0);
 }
@@ -536,7 +542,7 @@
 	ret = compat_sys_select(width, compat_ptr(inp), compat_ptr(outp),
 				compat_ptr(exp), compat_ptr(tvp_x));
 	if (ret == -EINTR && tvp_x) {
-		struct compat_timeval *tvp = compat_ptr(tvp_x);
+		struct compat_timeval __user *tvp = compat_ptr(tvp_x);
 		time_t sec, usec;
 
 		__get_user(sec, &tvp->tv_sec);
@@ -552,6 +558,10 @@
 	return;
 }
 
+#if 0 /* This code doesn't translate user pointers correctly,
+       * disable for now. -DaveM
+       */
+
 /* XXXXXXXXXX SunOS mount/umount. XXXXXXXXXXX */
 #define SMNT_RDONLY       1
 #define SMNT_NOSUID       2
@@ -600,7 +610,7 @@
 	struct file   *file;
 
 	file = fget(fd);
-	if(!file)
+	if (!file)
 		return 0;
 
 	inode = file->f_dentry->d_inode;
@@ -645,7 +655,7 @@
 }
 
 /* XXXXXXXXXXXXXXXXXXXX */
-static int sunos_nfs_mount(char *dir_name, int linux_flags, void *data)
+static int sunos_nfs_mount(char *dir_name, int linux_flags, void __user *data)
 {
 	int  server_fd, err;
 	char *the_name, *mount_page;
@@ -665,10 +675,10 @@
 	if (server_fd < 0)
 		return -ENXIO;
 
-	if (copy_from_user(&linux_nfs_mount.addr,sunos_mount.addr,
-				sizeof(*sunos_mount.addr)) ||
-	    copy_from_user(&linux_nfs_mount.root,sunos_mount.fh,
-				sizeof(*sunos_mount.fh))) {
+	if (copy_from_user(&linux_nfs_mount.addr, sunos_mount.addr,
+			   sizeof(*sunos_mount.addr)) ||
+	    copy_from_user(&linux_nfs_mount.root, sunos_mount.fh,
+			   sizeof(*sunos_mount.fh))) {
 		sys_close (server_fd);
 		return -EFAULT;
 	}
@@ -694,7 +704,7 @@
 	linux_nfs_mount.acdirmax = sunos_mount.acdirmax;
 
 	the_name = getname(sunos_mount.hostname);
-	if(IS_ERR(the_name))
+	if (IS_ERR(the_name))
 		return PTR_ERR(the_name);
 
 	strlcpy(linux_nfs_mount.hostname, the_name,
@@ -733,11 +743,11 @@
 	if (flags & (SMNT_GRPID|SMNT_NOSUB|SMNT_MULTI|SMNT_SYS5))
 		goto out;
 
-	if(flags & SMNT_REMOUNT)
+	if (flags & SMNT_REMOUNT)
 		linux_flags |= MS_REMOUNT;
-	if(flags & SMNT_RDONLY)
+	if (flags & SMNT_RDONLY)
 		linux_flags |= MS_RDONLY;
-	if(flags & SMNT_NOSUID)
+	if (flags & SMNT_NOSUID)
 		linux_flags |= MS_NOSUID;
 
 	dir_page = getname(dir);
@@ -750,20 +760,20 @@
 	if (IS_ERR(type_page))
 		goto out1;
 
-	if(strcmp(type_page, "ext2") == 0) {
+	if (strcmp(type_page, "ext2") == 0) {
 		dev_fname = getname(data);
-	} else if(strcmp(type_page, "iso9660") == 0) {
+	} else if (strcmp(type_page, "iso9660") == 0) {
 		dev_fname = getname(data);
-	} else if(strcmp(type_page, "minix") == 0) {
+	} else if (strcmp(type_page, "minix") == 0) {
 		dev_fname = getname(data);
-	} else if(strcmp(type_page, "nfs") == 0) {
+	} else if (strcmp(type_page, "nfs") == 0) {
 		ret = sunos_nfs_mount (dir_page, flags, data);
 		goto out2;
-        } else if(strcmp(type_page, "ufs") == 0) {
+        } else if (strcmp(type_page, "ufs") == 0) {
 		printk("Warning: UFS filesystem mounts unsupported.\n");
 		ret = -ENODEV;
 		goto out2;
-	} else if(strcmp(type_page, "proc")) {
+	} else if (strcmp(type_page, "proc")) {
 		ret = -ENODEV;
 		goto out2;
 	}
@@ -782,15 +792,15 @@
 out:
 	return ret;
 }
-
+#endif
 
 asmlinkage int sunos_setpgrp(pid_t pid, pid_t pgid)
 {
 	int ret;
 
 	/* So stupid... */
-	if((!pid || pid == current->pid) &&
-	   !pgid) {
+	if ((!pid || pid == current->pid) &&
+	    !pgid) {
 		sys_setsid();
 		ret = 0;
 	} else {
@@ -825,7 +835,7 @@
 	return -1;
 }
 
-extern asmlinkage u32 sunos_gethostid(void)
+asmlinkage u32 sunos_gethostid(void)
 {
 	u32 ret;
 
@@ -844,7 +854,7 @@
 #define   _SC_SAVED_IDS           7
 #define   _SC_VERSION             8
 
-extern asmlinkage s32 sunos_sysconf (int name)
+asmlinkage s32 sunos_sysconf (int name)
 {
 	s32 ret;
 
@@ -908,7 +918,8 @@
 			arg3=SETALL; break;
 		}
 		/* sys_semctl(): */
-		arg4.__pad=(void *)A(ptr); /* value to modify semaphore to */
+		/* value to modify semaphore to */
+		arg4.__pad=(void __user *)A(ptr);
 		ret = sys_semctl((int)arg1, (int)arg2, (int)arg3, arg4);
 		break;
 	case 1:
@@ -917,7 +928,8 @@
 		break;
 	case 2:
 		/* sys_semop(): */
-		ret = sys_semop((int)arg1, (struct sembuf *)A(arg2), (unsigned)arg3);
+		ret = sys_semop((int)arg1, (struct sembuf __user *)A(arg2),
+				(unsigned int) arg3);
 		break;
 	default:
 		ret = -EINVAL;
@@ -959,65 +971,65 @@
         compat_ipc_pid_t msg_lrpid;
 };
 
-static inline int sunos_msqid_get(struct msqid_ds32 *user,
+static inline int sunos_msqid_get(struct msqid_ds32 __user *user,
 				  struct msqid_ds *kern)
 {
-	if(get_user(kern->msg_perm.key, &user->msg_perm.key)		||
-	   __get_user(kern->msg_perm.uid, &user->msg_perm.uid)		||
-	   __get_user(kern->msg_perm.gid, &user->msg_perm.gid)		||
-	   __get_user(kern->msg_perm.cuid, &user->msg_perm.cuid)	||
-	   __get_user(kern->msg_perm.cgid, &user->msg_perm.cgid)	||
-	   __get_user(kern->msg_stime, &user->msg_stime)		||
-	   __get_user(kern->msg_rtime, &user->msg_rtime)		||
-	   __get_user(kern->msg_ctime, &user->msg_ctime)		||
-	   __get_user(kern->msg_ctime, &user->msg_cbytes)		||
-	   __get_user(kern->msg_ctime, &user->msg_qnum)			||
-	   __get_user(kern->msg_ctime, &user->msg_qbytes)		||
-	   __get_user(kern->msg_ctime, &user->msg_lspid)		||
-	   __get_user(kern->msg_ctime, &user->msg_lrpid))
+	if (get_user(kern->msg_perm.key, &user->msg_perm.key)		||
+	    __get_user(kern->msg_perm.uid, &user->msg_perm.uid)		||
+	    __get_user(kern->msg_perm.gid, &user->msg_perm.gid)		||
+	    __get_user(kern->msg_perm.cuid, &user->msg_perm.cuid)	||
+	    __get_user(kern->msg_perm.cgid, &user->msg_perm.cgid)	||
+	    __get_user(kern->msg_stime, &user->msg_stime)		||
+	    __get_user(kern->msg_rtime, &user->msg_rtime)		||
+	    __get_user(kern->msg_ctime, &user->msg_ctime)		||
+	    __get_user(kern->msg_ctime, &user->msg_cbytes)		||
+	    __get_user(kern->msg_ctime, &user->msg_qnum)		||
+	    __get_user(kern->msg_ctime, &user->msg_qbytes)		||
+	    __get_user(kern->msg_ctime, &user->msg_lspid)		||
+	    __get_user(kern->msg_ctime, &user->msg_lrpid))
 		return -EFAULT;
 	return 0;
 }
 
-static inline int sunos_msqid_put(struct msqid_ds32 *user,
+static inline int sunos_msqid_put(struct msqid_ds32 __user *user,
 				  struct msqid_ds *kern)
 {
-	if(put_user(kern->msg_perm.key, &user->msg_perm.key)		||
-	   __put_user(kern->msg_perm.uid, &user->msg_perm.uid)		||
-	   __put_user(kern->msg_perm.gid, &user->msg_perm.gid)		||
-	   __put_user(kern->msg_perm.cuid, &user->msg_perm.cuid)	||
-	   __put_user(kern->msg_perm.cgid, &user->msg_perm.cgid)	||
-	   __put_user(kern->msg_stime, &user->msg_stime)		||
-	   __put_user(kern->msg_rtime, &user->msg_rtime)		||
-	   __put_user(kern->msg_ctime, &user->msg_ctime)		||
-	   __put_user(kern->msg_ctime, &user->msg_cbytes)		||
-	   __put_user(kern->msg_ctime, &user->msg_qnum)			||
-	   __put_user(kern->msg_ctime, &user->msg_qbytes)		||
-	   __put_user(kern->msg_ctime, &user->msg_lspid)		||
-	   __put_user(kern->msg_ctime, &user->msg_lrpid))
+	if (put_user(kern->msg_perm.key, &user->msg_perm.key)		||
+	    __put_user(kern->msg_perm.uid, &user->msg_perm.uid)		||
+	    __put_user(kern->msg_perm.gid, &user->msg_perm.gid)		||
+	    __put_user(kern->msg_perm.cuid, &user->msg_perm.cuid)	||
+	    __put_user(kern->msg_perm.cgid, &user->msg_perm.cgid)	||
+	    __put_user(kern->msg_stime, &user->msg_stime)		||
+	    __put_user(kern->msg_rtime, &user->msg_rtime)		||
+	    __put_user(kern->msg_ctime, &user->msg_ctime)		||
+	    __put_user(kern->msg_ctime, &user->msg_cbytes)		||
+	    __put_user(kern->msg_ctime, &user->msg_qnum)		||
+	    __put_user(kern->msg_ctime, &user->msg_qbytes)		||
+	    __put_user(kern->msg_ctime, &user->msg_lspid)		||
+	    __put_user(kern->msg_ctime, &user->msg_lrpid))
 		return -EFAULT;
 	return 0;
 }
 
-static inline int sunos_msgbuf_get(struct msgbuf32 *user, struct msgbuf *kern, int len)
+static inline int sunos_msgbuf_get(struct msgbuf32 __user *user, struct msgbuf *kern, int len)
 {
-	if(get_user(kern->mtype, &user->mtype)	||
-	   __copy_from_user(kern->mtext, &user->mtext, len))
+	if (get_user(kern->mtype, &user->mtype)	||
+	    __copy_from_user(kern->mtext, &user->mtext, len))
 		return -EFAULT;
 	return 0;
 }
 
-static inline int sunos_msgbuf_put(struct msgbuf32 *user, struct msgbuf *kern, int len)
+static inline int sunos_msgbuf_put(struct msgbuf32 __user *user, struct msgbuf *kern, int len)
 {
-	if(put_user(kern->mtype, &user->mtype)	||
-	   __copy_to_user(user->mtext, kern->mtext, len))
+	if (put_user(kern->mtype, &user->mtype)	||
+	    __copy_to_user(user->mtext, kern->mtext, len))
 		return -EFAULT;
 	return 0;
 }
 
 asmlinkage int sunos_msgsys(int op, u32 arg1, u32 arg2, u32 arg3, u32 arg4)
 {
-	struct sparc_stackf32 *sp;
+	struct sparc_stackf32 __user *sp;
 	struct msqid_ds kds;
 	struct msgbuf *kmbuf;
 	mm_segment_t old_fs = get_fs();
@@ -1029,13 +1041,13 @@
 		rval = sys_msgget((key_t)arg1, (int)arg2);
 		break;
 	case 1:
-		if(!sunos_msqid_get((struct msqid_ds32 *)A(arg3), &kds)) {
+		if (!sunos_msqid_get((struct msqid_ds32 __user *)A(arg3), &kds)) {
 			set_fs(KERNEL_DS);
 			rval = sys_msgctl((int)arg1, (int)arg2,
-					  (struct msqid_ds *)A(arg3));
+					  (struct msqid_ds __user *)A(arg3));
 			set_fs(old_fs);
-			if(!rval)
-				rval = sunos_msqid_put((struct msqid_ds32 *)A(arg3),
+			if (!rval)
+				rval = sunos_msqid_put((struct msqid_ds32 __user *)A(arg3),
 						       &kds);
 		} else
 			rval = -EFAULT;
@@ -1044,21 +1056,22 @@
 		rval = -EFAULT;
 		kmbuf = (struct msgbuf *)kmalloc(sizeof(struct msgbuf) + arg3,
 						 GFP_KERNEL);
-		if(!kmbuf)
+		if (!kmbuf)
 			break;
-		sp = (struct sparc_stackf32 *)
+		sp = (struct sparc_stackf32 __user *)
 			(current_thread_info()->kregs->u_regs[UREG_FP] & 0xffffffffUL);
-		if(get_user(arg5, &sp->xxargs[0])) {
+		if (get_user(arg5, &sp->xxargs[0])) {
 			rval = -EFAULT;
 			kfree(kmbuf);
 			break;
 		}
 		set_fs(KERNEL_DS);
-		rval = sys_msgrcv((int)arg1, kmbuf, (size_t)arg3,
+		rval = sys_msgrcv((int)arg1, (struct msgbuf __user *) kmbuf,
+				  (size_t)arg3,
 				  (long)arg4, (int)arg5);
 		set_fs(old_fs);
-		if(!rval)
-			rval = sunos_msgbuf_put((struct msgbuf32 *)A(arg2),
+		if (!rval)
+			rval = sunos_msgbuf_put((struct msgbuf32 __user *)A(arg2),
 						kmbuf, arg3);
 		kfree(kmbuf);
 		break;
@@ -1066,11 +1079,12 @@
 		rval = -EFAULT;
 		kmbuf = (struct msgbuf *)kmalloc(sizeof(struct msgbuf) + arg3,
 						 GFP_KERNEL);
-		if(!kmbuf || sunos_msgbuf_get((struct msgbuf32 *)A(arg2),
-					      kmbuf, arg3))
+		if (!kmbuf || sunos_msgbuf_get((struct msgbuf32 __user *)A(arg2),
+					       kmbuf, arg3))
 			break;
 		set_fs(KERNEL_DS);
-		rval = sys_msgsnd((int)arg1, kmbuf, (size_t)arg3, (int)arg4);
+		rval = sys_msgsnd((int)arg1, (struct msgbuf __user *) kmbuf,
+				  (size_t)arg3, (int)arg4);
 		set_fs(old_fs);
 		kfree(kmbuf);
 		break;
@@ -1092,40 +1106,40 @@
         unsigned short          shm_nattch;
 };
                                                         
-static inline int sunos_shmid_get(struct shmid_ds32 *user,
+static inline int sunos_shmid_get(struct shmid_ds32 __user *user,
 				  struct shmid_ds *kern)
 {
-	if(get_user(kern->shm_perm.key, &user->shm_perm.key)		||
-	   __get_user(kern->shm_perm.uid, &user->shm_perm.uid)		||
-	   __get_user(kern->shm_perm.gid, &user->shm_perm.gid)		||
-	   __get_user(kern->shm_perm.cuid, &user->shm_perm.cuid)	||
-	   __get_user(kern->shm_perm.cgid, &user->shm_perm.cgid)	||
-	   __get_user(kern->shm_segsz, &user->shm_segsz)		||
-	   __get_user(kern->shm_atime, &user->shm_atime)		||
-	   __get_user(kern->shm_dtime, &user->shm_dtime)		||
-	   __get_user(kern->shm_ctime, &user->shm_ctime)		||
-	   __get_user(kern->shm_cpid, &user->shm_cpid)			||
-	   __get_user(kern->shm_lpid, &user->shm_lpid)			||
-	   __get_user(kern->shm_nattch, &user->shm_nattch))
+	if (get_user(kern->shm_perm.key, &user->shm_perm.key)		||
+	    __get_user(kern->shm_perm.uid, &user->shm_perm.uid)		||
+	    __get_user(kern->shm_perm.gid, &user->shm_perm.gid)		||
+	    __get_user(kern->shm_perm.cuid, &user->shm_perm.cuid)	||
+	    __get_user(kern->shm_perm.cgid, &user->shm_perm.cgid)	||
+	    __get_user(kern->shm_segsz, &user->shm_segsz)		||
+	    __get_user(kern->shm_atime, &user->shm_atime)		||
+	    __get_user(kern->shm_dtime, &user->shm_dtime)		||
+	    __get_user(kern->shm_ctime, &user->shm_ctime)		||
+	    __get_user(kern->shm_cpid, &user->shm_cpid)			||
+	    __get_user(kern->shm_lpid, &user->shm_lpid)			||
+	    __get_user(kern->shm_nattch, &user->shm_nattch))
 		return -EFAULT;
 	return 0;
 }
 
-static inline int sunos_shmid_put(struct shmid_ds32 *user,
+static inline int sunos_shmid_put(struct shmid_ds32 __user *user,
 				  struct shmid_ds *kern)
 {
-	if(put_user(kern->shm_perm.key, &user->shm_perm.key)		||
-	   __put_user(kern->shm_perm.uid, &user->shm_perm.uid)		||
-	   __put_user(kern->shm_perm.gid, &user->shm_perm.gid)		||
-	   __put_user(kern->shm_perm.cuid, &user->shm_perm.cuid)	||
-	   __put_user(kern->shm_perm.cgid, &user->shm_perm.cgid)	||
-	   __put_user(kern->shm_segsz, &user->shm_segsz)		||
-	   __put_user(kern->shm_atime, &user->shm_atime)		||
-	   __put_user(kern->shm_dtime, &user->shm_dtime)		||
-	   __put_user(kern->shm_ctime, &user->shm_ctime)		||
-	   __put_user(kern->shm_cpid, &user->shm_cpid)			||
-	   __put_user(kern->shm_lpid, &user->shm_lpid)			||
-	   __put_user(kern->shm_nattch, &user->shm_nattch))
+	if (put_user(kern->shm_perm.key, &user->shm_perm.key)		||
+	    __put_user(kern->shm_perm.uid, &user->shm_perm.uid)		||
+	    __put_user(kern->shm_perm.gid, &user->shm_perm.gid)		||
+	    __put_user(kern->shm_perm.cuid, &user->shm_perm.cuid)	||
+	    __put_user(kern->shm_perm.cgid, &user->shm_perm.cgid)	||
+	    __put_user(kern->shm_segsz, &user->shm_segsz)		||
+	    __put_user(kern->shm_atime, &user->shm_atime)		||
+	    __put_user(kern->shm_dtime, &user->shm_dtime)		||
+	    __put_user(kern->shm_ctime, &user->shm_ctime)		||
+	    __put_user(kern->shm_cpid, &user->shm_cpid)			||
+	    __put_user(kern->shm_lpid, &user->shm_lpid)			||
+	    __put_user(kern->shm_nattch, &user->shm_nattch))
 		return -EFAULT;
 	return 0;
 }
@@ -1140,25 +1154,26 @@
 	switch(op) {
 	case 0:
 		/* do_shmat(): attach a shared memory area */
-		rval = do_shmat((int)arg1,(char *)A(arg2),(int)arg3,&raddr);
-		if(!rval)
+		rval = do_shmat((int)arg1,(char __user *)A(arg2),(int)arg3,&raddr);
+		if (!rval)
 			rval = (int) raddr;
 		break;
 	case 1:
 		/* sys_shmctl(): modify shared memory area attr. */
-		if(!sunos_shmid_get((struct shmid_ds32 *)A(arg3), &ksds)) {
+		if (!sunos_shmid_get((struct shmid_ds32 __user *)A(arg3), &ksds)) {
 			set_fs(KERNEL_DS);
-			rval = sys_shmctl((int)arg1,(int)arg2, &ksds);
+			rval = sys_shmctl((int) arg1,(int) arg2,
+					  (struct shmid_ds __user *) &ksds);
 			set_fs(old_fs);
-			if(!rval)
-				rval = sunos_shmid_put((struct shmid_ds32 *)A(arg3),
+			if (!rval)
+				rval = sunos_shmid_put((struct shmid_ds32 __user *)A(arg3),
 						       &ksds);
 		} else
 			rval = -EFAULT;
 		break;
 	case 2:
 		/* sys_shmdt(): detach a shared memory area */
-		rval = sys_shmdt((char *)A(arg1));
+		rval = sys_shmdt((char __user *)A(arg1));
 		break;
 	case 3:
 		/* sys_shmget(): get a shared memory area */
@@ -1204,7 +1219,7 @@
 {
 	int ret;
 
-	ret = check_nonblock(sys_read(fd, (char *)A(buf), count), fd);
+	ret = check_nonblock(sys_read(fd, (char __user *)A(buf), count), fd);
 	return ret;
 }
 
@@ -1212,7 +1227,8 @@
 {
 	int ret;
 
-	ret = check_nonblock(compat_sys_readv(fd, (void*)A(vector), count), fd);
+	ret = check_nonblock(compat_sys_readv(fd, (void __user *) A(vector),
+					      count), fd);
 	return ret;
 }
 
@@ -1220,7 +1236,7 @@
 {
 	int ret;
 
-	ret = check_nonblock(sys_write(fd, (char *)A(buf), count), fd);
+	ret = check_nonblock(sys_write(fd, (char __user *)A(buf), count), fd);
 	return ret;
 }
 
@@ -1228,7 +1244,8 @@
 {
 	int ret;
 
-	ret = check_nonblock(compat_sys_writev(fd, (void*)A(vector), count), fd);
+	ret = check_nonblock(compat_sys_writev(fd, (void __user *)A(vector),
+					       count), fd);
 	return ret;
 }
 
@@ -1236,7 +1253,8 @@
 {
 	int ret;
 
-	ret = check_nonblock(sys_recv(fd, (void *)A(ubuf), size, flags), fd);
+	ret = check_nonblock(sys_recv(fd, (void __user *)A(ubuf),
+				      size, flags), fd);
 	return ret;
 }
 
@@ -1244,7 +1262,8 @@
 {
 	int ret;
 
-	ret = check_nonblock(sys_send(fd, (void *)A(buff), len, flags), fd);
+	ret = check_nonblock(sys_send(fd, (void __user *)A(buff),
+				      len, flags), fd);
 	return ret;
 }
 
@@ -1253,8 +1272,9 @@
 	int ret;
 
 	while (1) {
-		ret = check_nonblock(sys_accept(fd, (struct sockaddr *)A(sa),
-						(int *)A(addrlen)), fd);
+		ret = check_nonblock(sys_accept(fd,
+						(struct sockaddr __user *)A(sa),
+						(int __user *)A(addrlen)), fd);
 		if (ret != -ENETUNREACH && ret != -EHOSTUNREACH)
 			break;
 	}
@@ -1272,11 +1292,11 @@
 		compat_old_sigset_t mask;
 		u32 u_handler;
 
-		if (get_user(u_handler, &((struct old_sigaction32 *)A(act))->sa_handler) ||
-		    __get_user(new_ka.sa.sa_flags, &((struct old_sigaction32 *)A(act))->sa_flags))
+		if (get_user(u_handler, &((struct old_sigaction32 __user *)A(act))->sa_handler) ||
+		    __get_user(new_ka.sa.sa_flags, &((struct old_sigaction32 __user *)A(act))->sa_flags))
 			return -EFAULT;
 		new_ka.sa.sa_handler = (void *) (long) u_handler;
-		__get_user(mask, &((struct old_sigaction32 *)A(act))->sa_mask);
+		__get_user(mask, &((struct old_sigaction32 __user *)A(act))->sa_mask);
 		new_ka.sa.sa_restorer = NULL;
 		new_ka.ka_restorer = NULL;
 		siginitset(&new_ka.sa.sa_mask, mask);
@@ -1287,10 +1307,10 @@
 
 	if (!ret && oact) {
 		old_ka.sa.sa_flags ^= SUNOS_SV_INTERRUPT;
-		if (put_user((long)old_ka.sa.sa_handler, &((struct old_sigaction32 *)A(oact))->sa_handler) ||
-		    __put_user(old_ka.sa.sa_flags, &((struct old_sigaction32 *)A(oact))->sa_flags))
+		if (put_user((long)old_ka.sa.sa_handler, &((struct old_sigaction32 __user *)A(oact))->sa_handler) ||
+		    __put_user(old_ka.sa.sa_flags, &((struct old_sigaction32 __user *)A(oact))->sa_flags))
 			return -EFAULT;
-		__put_user(old_ka.sa.sa_mask.sig[0], &((struct old_sigaction32 *)A(oact))->sa_mask);
+		__put_user(old_ka.sa.sa_mask.sig[0], &((struct old_sigaction32 __user *)A(oact))->sa_mask);
 	}
 
 	return ret;
@@ -1307,7 +1327,8 @@
 		if (tr_opt >=2 && tr_opt <= 6)
 			tr_opt += 30;
 	}
-	ret = sys_setsockopt(fd, level, tr_opt, (char *)A(optval), optlen);
+	ret = sys_setsockopt(fd, level, tr_opt,
+			     (char __user *)A(optval), optlen);
 	return ret;
 }
 
@@ -1322,6 +1343,8 @@
 		if (tr_opt >=2 && tr_opt <= 6)
 			tr_opt += 30;
 	}
-	ret = compat_sys_getsockopt(fd, level, tr_opt, (void*)(unsigned long)optval, (void*)(unsigned long)optlen);
+	ret = compat_sys_getsockopt(fd, level, tr_opt,
+				    (void __user *)(unsigned long) optval,
+				    (void __user *)(unsigned long) optlen);
 	return ret;
 }
diff -Nru a/arch/sparc64/kernel/systbls.S b/arch/sparc64/kernel/systbls.S
--- a/arch/sparc64/kernel/systbls.S	2004-06-02 23:26:59 -07:00
+++ b/arch/sparc64/kernel/systbls.S	2004-06-02 23:26:59 -07:00
@@ -205,7 +205,7 @@
 	.word sys_oldumount, sunos_nosys, sunos_nosys
 	.word sys_getdomainname, sys_setdomainname
 	.word sunos_nosys, sys_quotactl, sunos_nosys
-	.word sunos_mount, sys_ustat, sunos_semsys
+	.word sunos_nosys, sys_ustat, sunos_semsys
 	.word sunos_nosys, sunos_shmsys, sunos_audit
 	.word sunos_nosys, sunos_getdents, sys_setsid
 	.word sys_fchdir, sunos_nosys, sunos_nosys
diff -Nru a/arch/sparc64/kernel/traps.c b/arch/sparc64/kernel/traps.c
--- a/arch/sparc64/kernel/traps.c	2004-06-02 23:27:00 -07:00
+++ b/arch/sparc64/kernel/traps.c	2004-06-02 23:27:00 -07:00
@@ -1708,7 +1708,7 @@
 	printk("\n");
 }
 
-void user_instruction_dump (unsigned int *pc)
+static void user_instruction_dump (unsigned int __user *pc)
 {
 	int i;
 	unsigned int buf[9];
@@ -1813,7 +1813,7 @@
 			regs->tpc &= 0xffffffff;
 			regs->tnpc &= 0xffffffff;
 		}
-		user_instruction_dump ((unsigned int *) regs->tpc);
+		user_instruction_dump ((unsigned int __user *) regs->tpc);
 	}
 #ifdef CONFIG_SMP
 	smp_report_regs();
@@ -1838,7 +1838,7 @@
 		die_if_kernel("Kernel illegal instruction", regs);
 	if (test_thread_flag(TIF_32BIT))
 		pc = (u32)pc;
-	if (get_user(insn, (u32 *)pc) != -EFAULT) {
+	if (get_user(insn, (u32 __user *) pc) != -EFAULT) {
 		if ((insn & 0xc1ffc000) == 0x81700000) /* POPC */ {
 			if (handle_popc(insn, regs))
 				return;
@@ -1862,9 +1862,12 @@
 	if (regs->tstate & TSTATE_PRIV) {
 		extern void kernel_unaligned_trap(struct pt_regs *regs,
 						  unsigned int insn, 
-						  unsigned long sfar, unsigned long sfsr);
+						  unsigned long sfar,
+						  unsigned long sfsr);
 
-		return kernel_unaligned_trap(regs, *((unsigned int *)regs->tpc), sfar, sfsr);
+		kernel_unaligned_trap(regs, *((unsigned int *)regs->tpc),
+				      sfar, sfsr);
+		return;
 	}
 	info.si_signo = SIGBUS;
 	info.si_errno = 0;
diff -Nru a/arch/sparc64/kernel/unaligned.c b/arch/sparc64/kernel/unaligned.c
--- a/arch/sparc64/kernel/unaligned.c	2004-06-02 23:26:59 -07:00
+++ b/arch/sparc64/kernel/unaligned.c	2004-06-02 23:26:59 -07:00
@@ -128,12 +128,12 @@
 		win = (struct reg_window *)(regs->u_regs[UREG_FP] + STACK_BIAS);
 		value = win->locals[reg - 16];
 	} else if (test_thread_flag(TIF_32BIT)) {
-		struct reg_window32 *win32;
-		win32 = (struct reg_window32 *)((unsigned long)((u32)regs->u_regs[UREG_FP]));
+		struct reg_window32 __user *win32;
+		win32 = (struct reg_window32 __user *)((unsigned long)((u32)regs->u_regs[UREG_FP]));
 		get_user(value, &win32->locals[reg - 16]);
 	} else {
-		struct reg_window *win;
-		win = (struct reg_window *)(regs->u_regs[UREG_FP] + STACK_BIAS);
+		struct reg_window __user *win;
+		win = (struct reg_window __user *)(regs->u_regs[UREG_FP] + STACK_BIAS);
 		get_user(value, &win->locals[reg - 16]);
 	}
 	return value;
@@ -477,12 +477,12 @@
 			regs->u_regs[rd] = ret;
 	} else {
 		if (test_thread_flag(TIF_32BIT)) {
-			struct reg_window32 *win32;
-			win32 = (struct reg_window32 *)((unsigned long)((u32)regs->u_regs[UREG_FP]));
+			struct reg_window32 __user *win32;
+			win32 = (struct reg_window32 __user *)((unsigned long)((u32)regs->u_regs[UREG_FP]));
 			put_user(ret, &win32->locals[rd - 16]);
 		} else {
-			struct reg_window *win;
-			win = (struct reg_window *)(regs->u_regs[UREG_FP] + STACK_BIAS);
+			struct reg_window __user *win;
+			win = (struct reg_window __user *)(regs->u_regs[UREG_FP] + STACK_BIAS);
 			put_user(ret, &win->locals[rd - 16]);
 		}
 	}
@@ -540,10 +540,10 @@
 			data_access_exception(regs, 0, addr);
 			return 1;
 		}
-		if (put_user (first >> 32, (u32 *)addr) ||
-		    __put_user ((u32)first, (u32 *)(addr + 4)) ||
-		    __put_user (second >> 32, (u32 *)(addr + 8)) ||
-		    __put_user ((u32)second, (u32 *)(addr + 12))) {
+		if (put_user (first >> 32, (u32 __user *)addr) ||
+		    __put_user ((u32)first, (u32 __user *)(addr + 4)) ||
+		    __put_user (second >> 32, (u32 __user *)(addr + 8)) ||
+		    __put_user ((u32)second, (u32 __user *)(addr + 12))) {
 		    	data_access_exception(regs, 0, addr);
 		    	return 1;
 		}
@@ -568,10 +568,10 @@
 		for (i = 0; i < size; i++)
 			data[i] = 0;
 		
-		err = get_user (data[0], (u32 *)addr);
+		err = get_user (data[0], (u32 __user *) addr);
 		if (!err) {
 			for (i = 1; i < size; i++)
-				err |= __get_user (data[i], (u32 *)(addr + 4*i));
+				err |= __get_user (data[i], (u32 __user *)(addr + 4*i));
 		}
 		if (err && !(asi & 0x2 /* NF */)) {
 			data_access_exception(regs, 0, addr);
@@ -620,13 +620,13 @@
 		if ((insn & 0x780000) == 0x180000)
 			reg[1] = 0;
 	} else if (test_thread_flag(TIF_32BIT)) {
-		put_user(0, (int *)reg);
+		put_user(0, (int __user *) reg);
 		if ((insn & 0x780000) == 0x180000)
-			put_user(0, ((int *)reg) + 1);
+			put_user(0, ((int __user *) reg) + 1);
 	} else {
-		put_user(0, reg);
+		put_user(0, (unsigned long __user *) reg);
 		if ((insn & 0x780000) == 0x180000)
-			put_user(0, reg + 1);
+			put_user(0, (unsigned long __user *) reg + 1);
 	}
 	advance(regs);
 }
@@ -646,13 +646,13 @@
 		die_if_kernel("lddfmna from kernel", regs);
 	if (test_thread_flag(TIF_32BIT))
 		pc = (u32)pc;
-	if (get_user(insn, (u32 *)pc) != -EFAULT) {
+	if (get_user(insn, (u32 __user *) pc) != -EFAULT) {
 		asi = sfsr >> 16;
 		if ((asi > ASI_SNFL) ||
 		    (asi < ASI_P))
 			goto daex;
-		if (get_user(first, (u32 *)sfar) ||
-		     get_user(second, (u32 *)(sfar + 4))) {
+		if (get_user(first, (u32 __user *)sfar) ||
+		     get_user(second, (u32 __user *)(sfar + 4))) {
 			if (asi & 0x2) /* NF */ {
 				first = 0; second = 0;
 			} else
@@ -698,7 +698,7 @@
 		die_if_kernel("stdfmna from kernel", regs);
 	if (test_thread_flag(TIF_32BIT))
 		pc = (u32)pc;
-	if (get_user(insn, (u32 *)pc) != -EFAULT) {
+	if (get_user(insn, (u32 __user *) pc) != -EFAULT) {
 		freg = ((insn >> 25) & 0x1e) | ((insn >> 20) & 0x20);
 		asi = sfsr >> 16;
 		value = 0;
@@ -717,8 +717,8 @@
 			value = __swab64p(&value); break;
 		default: goto daex;
 		}
-		if (put_user (value >> 32, (u32 *)sfar) ||
-		    __put_user ((u32)value, (u32 *)(sfar + 4)))
+		if (put_user (value >> 32, (u32 __user *) sfar) ||
+		    __put_user ((u32)value, (u32 __user *)(sfar + 4)))
 			goto daex;
 	} else {
 daex:		data_access_exception(regs, sfsr, sfar);
diff -Nru a/arch/sparc64/math-emu/math.c b/arch/sparc64/math-emu/math.c
--- a/arch/sparc64/math-emu/math.c	2004-06-02 23:26:59 -07:00
+++ b/arch/sparc64/math-emu/math.c	2004-06-02 23:26:59 -07:00
@@ -185,7 +185,7 @@
 		die_if_kernel("unfinished/unimplemented FPop from kernel", regs);
 	if (test_thread_flag(TIF_32BIT))
 		pc = (u32)pc;
-	if (get_user(insn, (u32 *)pc) != -EFAULT) {
+	if (get_user(insn, (u32 __user *) pc) != -EFAULT) {
 		if ((insn & 0xc1f80000) == 0x81a00000) /* FPOP1 */ {
 			switch ((insn >> 5) & 0x1ff) {
 			/* QUAD - ftt == 3 */
@@ -298,14 +298,14 @@
 				else if (freg < 16)
 					XR = regs->u_regs[freg];
 				else if (test_thread_flag(TIF_32BIT)) {
-					struct reg_window32 *win32;
+					struct reg_window32 __user *win32;
 					flushw_user ();
-					win32 = (struct reg_window32 *)((unsigned long)((u32)regs->u_regs[UREG_FP]));
+					win32 = (struct reg_window32 __user *)((unsigned long)((u32)regs->u_regs[UREG_FP]));
 					get_user(XR, &win32->locals[freg - 16]);
 				} else {
-					struct reg_window *win;
+					struct reg_window __user *win;
 					flushw_user ();
-					win = (struct reg_window *)(regs->u_regs[UREG_FP] + STACK_BIAS);
+					win = (struct reg_window __user *)(regs->u_regs[UREG_FP] + STACK_BIAS);
 					get_user(XR, &win->locals[freg - 16]);
 				}
 				IR = 0;
diff -Nru a/arch/x86_64/ia32/fpu32.c b/arch/x86_64/ia32/fpu32.c
--- a/arch/x86_64/ia32/fpu32.c	2004-06-02 23:26:58 -07:00
+++ b/arch/x86_64/ia32/fpu32.c	2004-06-02 23:26:58 -07:00
@@ -72,15 +72,15 @@
 
 
 static inline int convert_fxsr_from_user(struct i387_fxsave_struct *fxsave,
-					 struct _fpstate_ia32 *buf)
+					 struct _fpstate_ia32 __user *buf)
 {
 	struct _fpxreg *to;
-	struct _fpreg *from;
+	struct _fpreg __user *from;
 	int i;
 	u32 v;
 	int err = 0;
 
-#define G(num,val) err |= __get_user(val, num + (u32 *)buf)
+#define G(num,val) err |= __get_user(val, num + (u32 __user *)buf)
 	G(0, fxsave->cwd);
 	G(1, fxsave->swd);
 	G(2, fxsave->twd);
@@ -104,12 +104,12 @@
 }
 
 
-static inline int convert_fxsr_to_user(struct _fpstate_ia32 *buf,
+static inline int convert_fxsr_to_user(struct _fpstate_ia32 __user *buf,
 				       struct i387_fxsave_struct *fxsave,
 				       struct pt_regs *regs,
 				       struct task_struct *tsk)
 {
-	struct _fpreg *to;
+	struct _fpreg __user *to;
 	struct _fpxreg *from;
 	int i;
 	u16 cs,ds; 
@@ -125,7 +125,7 @@
 		cs = regs->cs;
 	} 
 
-#define P(num,val) err |= __put_user(val, num + (u32 *)buf)
+#define P(num,val) err |= __put_user(val, num + (u32 __user *)buf)
 	P(0, (u32)fxsave->cwd | 0xffff0000);
 	P(1, (u32)fxsave->swd | 0xffff0000);
 	P(2, twd_fxsr_to_i387(fxsave));
@@ -147,7 +147,7 @@
 	return 0;
 }
 
-int restore_i387_ia32(struct task_struct *tsk, struct _fpstate_ia32 *buf, int fsave) 
+int restore_i387_ia32(struct task_struct *tsk, struct _fpstate_ia32 __user *buf, int fsave) 
 { 
 	clear_fpu(tsk);
 	if (!fsave) { 
@@ -162,7 +162,7 @@
 }  
 
 int save_i387_ia32(struct task_struct *tsk, 
-		   struct _fpstate_ia32 *buf, 
+		   struct _fpstate_ia32 __user *buf, 
 		   struct pt_regs *regs,
 		   int fsave)
 {
diff -Nru a/arch/x86_64/ia32/ia32_ioctl.c b/arch/x86_64/ia32/ia32_ioctl.c
--- a/arch/x86_64/ia32/ia32_ioctl.c	2004-06-02 23:26:59 -07:00
+++ b/arch/x86_64/ia32/ia32_ioctl.c	2004-06-02 23:26:59 -07:00
@@ -21,7 +21,7 @@
 #ifndef TIOCGDEV
 #define TIOCGDEV       _IOR('T',0x32, unsigned int)
 #endif
-static int tiocgdev(unsigned fd, unsigned cmd,  unsigned int *ptr) 
+static int tiocgdev(unsigned fd, unsigned cmd,  unsigned int __user *ptr) 
 { 
 
 	struct file *file = fget(fd);
@@ -54,7 +54,7 @@
 		ret = sys_ioctl(fd, RTC_IRQP_READ, (unsigned long)&val); 
 		set_fs(oldfs); 
 		if (!ret)
-			ret = put_user(val, (unsigned int*) arg); 
+			ret = put_user(val, (unsigned int __user *) arg); 
 		return ret; 
 
 	case RTC_IRQP_SET32: 
@@ -66,7 +66,7 @@
 		ret = sys_ioctl(fd, RTC_EPOCH_READ, (unsigned long) &val); 
 		set_fs(oldfs); 
 		if (!ret)
-			ret = put_user(val, (unsigned int*) arg); 
+			ret = put_user(val, (unsigned int __user *) arg); 
 		return ret; 
 
 	case RTC_EPOCH_SET32:
@@ -113,7 +113,7 @@
 	struct mtrr_gentry g;
 	struct mtrr_sentry s;
 	int get = 0, err = 0; 
-	struct mtrr_gentry32 *g32 = (struct mtrr_gentry32 *)arg; 
+	struct mtrr_gentry32 __user *g32 = (struct mtrr_gentry32 __user *)arg; 
 	mm_segment_t oldfs = get_fs(); 
 
 	switch (cmd) { 
@@ -139,7 +139,7 @@
 
 		arg = (unsigned long)&g; 
 	} else { 
-		struct mtrr_sentry32 *s32 = (struct mtrr_sentry32 *)arg;
+		struct mtrr_sentry32 __user *s32 = (struct mtrr_sentry32 __user *)arg;
 		err = get_user(s.base, &s32->base);
 		err |= get_user(s.size, &s32->size);
 		err |= get_user(s.type, &s32->type);
diff -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-06-02 23:27:00 -07:00
+++ b/arch/x86_64/ia32/ia32_signal.c	2004-06-02 23:27:00 -07:00
@@ -42,7 +42,7 @@
 #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
 
 asmlinkage int do_signal(struct pt_regs *regs, sigset_t *oldset);
-void signal_fault(struct pt_regs *regs, void *frame, char *where);
+void signal_fault(struct pt_regs *regs, void __user *frame, char *where);
 
 int ia32_copy_siginfo_to_user(siginfo_t32 __user *to, siginfo_t *from)
 {
@@ -136,8 +136,9 @@
 }
 
 asmlinkage long
-sys32_sigaltstack(const stack_ia32_t *uss_ptr, stack_ia32_t *uoss_ptr, 
-				  struct pt_regs regs)
+sys32_sigaltstack(const stack_ia32_t __user *uss_ptr,
+		  stack_ia32_t __user *uoss_ptr, 
+		  struct pt_regs regs)
 {
 	stack_t uss,uoss; 
 	int ret;
@@ -193,7 +194,7 @@
 };
 
 static int
-ia32_restore_sigcontext(struct pt_regs *regs, struct sigcontext_ia32 *sc, unsigned int *peax)
+ia32_restore_sigcontext(struct pt_regs *regs, struct sigcontext_ia32 __user *sc, unsigned int *peax)
 {
 	unsigned int err = 0;
 	
@@ -252,9 +253,9 @@
 
 	{
 		u32 tmp;
-		struct _fpstate_ia32 * buf;
+		struct _fpstate_ia32 __user * buf;
 		err |= __get_user(tmp, &sc->fpstate);
-		buf = (struct _fpstate_ia32 *) (u64)tmp;
+		buf = compat_ptr(tmp);
 		if (buf) {
 			if (verify_area(VERIFY_READ, buf, sizeof(*buf)))
 				goto badframe;
@@ -275,7 +276,7 @@
 
 asmlinkage long sys32_sigreturn(struct pt_regs regs)
 {
-	struct sigframe *frame = (struct sigframe *)(regs.rsp - 8);
+	struct sigframe __user *frame = (struct sigframe __user *)(regs.rsp-8);
 	sigset_t set;
 	unsigned int eax;
 
@@ -304,9 +305,8 @@
 
 asmlinkage long sys32_rt_sigreturn(struct pt_regs regs)
 {
-	struct rt_sigframe *frame = (struct rt_sigframe *)(regs.rsp - 4);
+	struct rt_sigframe __user *frame = (struct rt_sigframe __user *)(regs.rsp - 4);
 	sigset_t set;
-	stack_t st;
 	unsigned int eax;
 
 	if (verify_area(VERIFY_READ, frame, sizeof(*frame)))
@@ -338,20 +338,20 @@
  */
 
 static int
-ia32_setup_sigcontext(struct sigcontext_ia32 *sc, struct _fpstate_ia32 *fpstate,
+ia32_setup_sigcontext(struct sigcontext_ia32 __user *sc, struct _fpstate_ia32 __user *fpstate,
 		 struct pt_regs *regs, unsigned int mask)
 {
 	int tmp, err = 0;
 
 	tmp = 0;
 	__asm__("movl %%gs,%0" : "=r"(tmp): "0"(tmp));
-	err |= __put_user(tmp, (unsigned int *)&sc->gs);
+	err |= __put_user(tmp, (unsigned int __user *)&sc->gs);
 	__asm__("movl %%fs,%0" : "=r"(tmp): "0"(tmp));
-	err |= __put_user(tmp, (unsigned int *)&sc->fs);
+	err |= __put_user(tmp, (unsigned int __user *)&sc->fs);
 	__asm__("movl %%ds,%0" : "=r"(tmp): "0"(tmp));
-	err |= __put_user(tmp, (unsigned int *)&sc->ds);
+	err |= __put_user(tmp, (unsigned int __user *)&sc->ds);
 	__asm__("movl %%es,%0" : "=r"(tmp): "0"(tmp));
-	err |= __put_user(tmp, (unsigned int *)&sc->es);
+	err |= __put_user(tmp, (unsigned int __user *)&sc->es);
 
 	err |= __put_user((u32)regs->rdi, &sc->edi);
 	err |= __put_user((u32)regs->rsi, &sc->esi);
@@ -388,7 +388,7 @@
 /*
  * Determine which stack to use..
  */
-static void *
+static void __user *
 get_sigframe(struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size)
 {
 	unsigned long rsp;
@@ -409,13 +409,13 @@
 		rsp = (unsigned long) ka->sa.sa_restorer;
 	}
 
-	return (void *)((rsp - frame_size) & -8UL);
+	return (void __user *)((rsp - frame_size) & -8UL);
 }
 
 void ia32_setup_frame(int sig, struct k_sigaction *ka,
 			compat_sigset_t *set, struct pt_regs * regs)
 {
-	struct sigframe *frame;
+	struct sigframe __user *frame;
 	int err = 0;
 
 	frame = get_sigframe(ka, regs, sizeof(*frame));
@@ -502,7 +502,7 @@
 void ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
 			   compat_sigset_t *set, struct pt_regs * regs)
 {
-	struct rt_sigframe *frame;
+	struct rt_sigframe __user *frame;
 	int err = 0;
 
 	frame = get_sigframe(ka, regs, sizeof(*frame));
diff -Nru a/arch/x86_64/ia32/ia32entry.S b/arch/x86_64/ia32/ia32entry.S
--- a/arch/x86_64/ia32/ia32entry.S	2004-06-02 23:26:59 -07:00
+++ b/arch/x86_64/ia32/ia32entry.S	2004-06-02 23:26:59 -07:00
@@ -322,7 +322,7 @@
 	.quad sys_mknod
 	.quad sys_chmod		/* 15 */
 	.quad sys_lchown16
-	.quad ni_syscall			/* old break syscall holder */
+	.quad quiet_ni_syscall			/* old break syscall holder */
 	.quad sys_stat
 	.quad sys32_lseek
 	.quad sys_getpid		/* 20 */
@@ -336,11 +336,11 @@
 	.quad sys_fstat	/* (old)fstat */
 	.quad sys_pause
 	.quad compat_sys_utime	/* 30 */
-	.quad ni_syscall	/* old stty syscall holder */
-	.quad ni_syscall	/* old gtty syscall holder */
+	.quad quiet_ni_syscall	/* old stty syscall holder */
+	.quad quiet_ni_syscall	/* old gtty syscall holder */
 	.quad sys_access
 	.quad sys_nice	
-	.quad ni_syscall	/* 35 */	/* old ftime syscall holder */
+	.quad quiet_ni_syscall	/* 35 */	/* old ftime syscall holder */
 	.quad sys_sync
 	.quad sys32_kill
 	.quad sys_rename
@@ -349,7 +349,7 @@
 	.quad sys_dup
 	.quad sys32_pipe
 	.quad compat_sys_times
-	.quad ni_syscall			/* old prof syscall holder */
+	.quad quiet_ni_syscall			/* old prof syscall holder */
 	.quad sys_brk		/* 45 */
 	.quad sys_setgid16
 	.quad sys_getgid16
@@ -358,12 +358,12 @@
 	.quad sys_getegid16	/* 50 */
 	.quad sys_acct
 	.quad sys_umount			/* new_umount */
-	.quad ni_syscall			/* old lock syscall holder */
+	.quad quiet_ni_syscall			/* old lock syscall holder */
 	.quad compat_sys_ioctl
 	.quad compat_sys_fcntl64		/* 55 */
-	.quad ni_syscall			/* old mpx syscall holder */
+	.quad quiet_ni_syscall			/* old mpx syscall holder */
 	.quad sys_setpgid
-	.quad ni_syscall			/* old ulimit syscall holder */
+	.quad quiet_ni_syscall			/* old ulimit syscall holder */
 	.quad sys32_olduname
 	.quad sys_umask		/* 60 */
 	.quad sys_chroot
@@ -403,7 +403,7 @@
 	.quad sys_fchown16		/* 95 */
 	.quad sys_getpriority
 	.quad sys_setpriority
-	.quad ni_syscall			/* old profil syscall holder */
+	.quad quiet_ni_syscall			/* old profil syscall holder */
 	.quad compat_sys_statfs
 	.quad compat_sys_fstatfs		/* 100 */
 	.quad sys_ioperm
@@ -417,7 +417,7 @@
 	.quad sys32_uname
 	.quad stub32_iopl		/* 110 */
 	.quad sys_vhangup
-	.quad ni_syscall	/* old "idle" system call */
+	.quad quiet_ni_syscall	/* old "idle" system call */
 	.quad sys32_vm86_warning	/* vm86old */ 
 	.quad compat_sys_wait4
 	.quad sys_swapoff		/* 115 */
@@ -442,7 +442,7 @@
 	.quad quiet_ni_syscall	/* bdflush */
 	.quad sys_sysfs		/* 135 */
 	.quad sys_personality
-	.quad ni_syscall	/* for afs_syscall */
+	.quad quiet_ni_syscall	/* for afs_syscall */
 	.quad sys_setfsuid16
 	.quad sys_setfsgid16
 	.quad sys_llseek		/* 140 */
@@ -493,8 +493,8 @@
 	.quad sys_capset
 	.quad stub32_sigaltstack
 	.quad sys32_sendfile
-	.quad ni_syscall		/* streams1 */
-	.quad ni_syscall		/* streams2 */
+	.quad quiet_ni_syscall		/* streams1 */
+	.quad quiet_ni_syscall		/* streams2 */
 	.quad stub32_vfork            /* 190 */
 	.quad compat_sys_getrlimit
 	.quad sys32_mmap2
@@ -543,51 +543,52 @@
 	.quad sys_removexattr	/* 235 */
 	.quad sys_lremovexattr
 	.quad sys_fremovexattr
-	.quad sys_tkill		/* 238 */ 
+	.quad sys_tkill
 	.quad sys_sendfile64 
 	.quad compat_sys_futex		/* 240 */
-        .quad compat_sys_sched_setaffinity
-        .quad compat_sys_sched_getaffinity
+	.quad compat_sys_sched_setaffinity
+	.quad compat_sys_sched_getaffinity
 	.quad sys32_set_thread_area
 	.quad sys32_get_thread_area
-	.quad sys32_io_setup
+	.quad sys32_io_setup		/* 245 */
 	.quad sys_io_destroy
 	.quad sys32_io_getevents
 	.quad sys32_io_submit
 	.quad sys_io_cancel
-	.quad sys_fadvise64
-	.quad quiet_ni_syscall /* free_huge_pages */
-	.quad sys_exit_group /* exit_group */
+	.quad sys_fadvise64		/* 250 */
+	.quad quiet_ni_syscall 	/* free_huge_pages */
+	.quad sys_exit_group
 	.quad sys_lookup_dcookie
 	.quad sys_epoll_create
-	.quad sys_epoll_ctl
+	.quad sys_epoll_ctl		/* 255 */
 	.quad sys_epoll_wait
 	.quad sys_remap_file_pages
 	.quad sys_set_tid_address
 	.quad sys32_timer_create
-	.quad compat_timer_settime
+	.quad compat_timer_settime	/* 260 */
 	.quad compat_timer_gettime
 	.quad sys_timer_getoverrun
 	.quad sys_timer_delete
 	.quad compat_clock_settime
-	.quad compat_clock_gettime
+	.quad compat_clock_gettime	/* 265 */
 	.quad compat_clock_getres
 	.quad compat_clock_nanosleep
-	.quad compat_statfs64   /* statfs64 */
-	.quad compat_fstatfs64  /* fstatfs64 */
-	.quad sys_tgkill
+	.quad compat_statfs64
+	.quad compat_fstatfs64
+	.quad sys_tgkill		/* 270 */
 	.quad compat_sys_utimes
 	.quad sys32_fadvise64_64
-	.quad sys_ni_syscall	/* sys_vserver */
-	.quad sys_ni_syscall	/* sys_mbind */
-	.quad sys_ni_syscall	/* 275 sys_get_mempolicy */
-	.quad sys_ni_syscall	/* sys_set_mempolicy */
+	.quad quiet_ni_syscall	/* sys_vserver */
+	.quad sys_mbind
+	.quad compat_get_mempolicy	/* 275 */
+	.quad sys_set_mempolicy
 	.quad compat_sys_mq_open
 	.quad sys_mq_unlink
 	.quad compat_sys_mq_timedsend
 	.quad compat_sys_mq_timedreceive	/* 280 */
 	.quad compat_sys_mq_notify
 	.quad compat_sys_mq_getsetattr
+	.quad quiet_ni_syscall		/* reserved for kexec */
 	/* don't forget to change IA32_NR_syscalls */
 ia32_syscall_end:		
 	.rept IA32_NR_syscalls-(ia32_syscall_end-ia32_sys_call_table)/8
diff -Nru a/arch/x86_64/ia32/ptrace32.c b/arch/x86_64/ia32/ptrace32.c
--- a/arch/x86_64/ia32/ptrace32.c	2004-06-02 23:26:59 -07:00
+++ b/arch/x86_64/ia32/ptrace32.c	2004-06-02 23:26:59 -07:00
@@ -19,6 +19,7 @@
 #include <linux/mm.h>
 #include <linux/ptrace.h>
 #include <asm/ptrace.h>
+#include <asm/compat.h>
 #include <asm/uaccess.h>
 #include <asm/user32.h>
 #include <asm/user.h>
@@ -228,6 +229,7 @@
 {
 	struct task_struct *child;
 	struct pt_regs *childregs; 
+	void __user *datap = compat_ptr(data);
 	int ret;
 	__u32 val;
 
@@ -264,7 +266,7 @@
 		if (access_process_vm(child, addr, &val, sizeof(u32), 0)!=sizeof(u32))
 			ret = -EIO;
 		else
-			ret = put_user(val, (unsigned int *)(u64)data); 
+			ret = put_user(val, (unsigned int __user *)datap); 
 		break; 
 
 	case PTRACE_POKEDATA:
@@ -277,7 +279,7 @@
 	case PTRACE_PEEKUSR:
 		ret = getreg32(child, addr, &val);
 		if (ret == 0)
-			ret = put_user(val, (__u32 *)(unsigned long) data);
+			ret = put_user(val, (__u32 __user *)datap);
 		break;
 
 	case PTRACE_POKEUSR:
@@ -286,15 +288,15 @@
 
 	case PTRACE_GETREGS: { /* Get all gp regs from the child. */
 		int i;
-	  	if (!access_ok(VERIFY_WRITE, (unsigned *)(unsigned long)data, 16*4)) {
+	  	if (!access_ok(VERIFY_WRITE, datap, 16*4)) {
 			ret = -EIO;
 			break;
 		}
 		ret = 0;
 		for ( i = 0; i <= 16*4 ; i += sizeof(__u32) ) {
 			getreg32(child, i, &val);
-			ret |= __put_user(val,(u32 *) (unsigned long) data);
-			data += sizeof(u32);
+			ret |= __put_user(val,(u32 __user *)datap);
+			datap += sizeof(u32);
 		}
 		break;
 	}
@@ -302,40 +304,40 @@
 	case PTRACE_SETREGS: { /* Set all gp regs in the child. */
 		unsigned long tmp;
 		int i;
-	  	if (!access_ok(VERIFY_READ, (unsigned *)(unsigned long)data, 16*4)) {
+	  	if (!access_ok(VERIFY_READ, datap, 16*4)) {
 			ret = -EIO;
 			break;
 		}
 		ret = 0; 
 		for ( i = 0; i <= 16*4; i += sizeof(u32) ) {
-			ret |= __get_user(tmp, (u32 *) (unsigned long) data);
+			ret |= __get_user(tmp, (u32 __user *)datap);
 			putreg32(child, i, tmp);
-			data += sizeof(u32);
+			datap += sizeof(u32);
 		}
 		break;
 	}
 
 	case PTRACE_GETFPREGS:
 		ret = -EIO; 
-		if (!access_ok(VERIFY_READ, (void *)(u64)data, 
+		if (!access_ok(VERIFY_READ, compat_ptr(data), 
 			       sizeof(struct user_i387_struct)))
 			break;
-		save_i387_ia32(child, (void *)(u64)data, childregs, 1);
+		save_i387_ia32(child, datap, childregs, 1);
 		ret = 0; 
 			break;
 
 	case PTRACE_SETFPREGS:
 		ret = -EIO;
-		if (!access_ok(VERIFY_WRITE, (void *)(u64)data, 
+		if (!access_ok(VERIFY_WRITE, datap, 
 			       sizeof(struct user_i387_struct)))
 			break;
 		ret = 0;
 		/* don't check EFAULT to be bug-to-bug compatible to i386 */
-		restore_i387_ia32(child, (void *)(u64)data, 1);
+		restore_i387_ia32(child, datap, 1);
 		break;
 
 	case PTRACE_GETFPXREGS: { 
-		struct user32_fxsr_struct *u = (void *)(u64)data; 
+		struct user32_fxsr_struct __user *u = datap;
 		init_fpu(child); 
 		ret = -EIO;
 		if (!access_ok(VERIFY_WRITE, u, sizeof(*u)))
@@ -348,7 +350,7 @@
 		break; 
 	} 
 	case PTRACE_SETFPXREGS: { 
-		struct user32_fxsr_struct *u = (void *)(u64)data; 
+		struct user32_fxsr_struct __user *u = datap;
 		unlazy_fpu(child);
 		ret = -EIO;
 		if (!access_ok(VERIFY_READ, u, sizeof(*u)))
diff -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-06-02 23:26:59 -07:00
+++ b/arch/x86_64/ia32/sys_ia32.c	2004-06-02 23:26:59 -07:00
@@ -76,9 +76,9 @@
 #define A(__x)		((unsigned long)(__x))
 #define AA(__x)		((unsigned long)(__x))
 #define ROUND_UP(x,a)	((__typeof__(x))(((unsigned long)(x) + ((a) - 1)) & ~((a) - 1)))
-#define NAME_OFFSET(de) ((int) ((de)->d_name - (char *) (de)))
+#define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de)))
 
-int cp_compat_stat(struct kstat *kbuf, struct compat_stat *ubuf)
+int cp_compat_stat(struct kstat *kbuf, struct compat_stat __user *ubuf)
 {
 	typeof(ubuf->st_uid) uid = 0;
 	typeof(ubuf->st_gid) gid = 0;
@@ -110,7 +110,7 @@
 }
 
 asmlinkage long
-sys32_truncate64(char * filename, unsigned long offset_low, unsigned long offset_high)
+sys32_truncate64(char __user * filename, unsigned long offset_low, unsigned long offset_high)
 {
        return sys_truncate(filename, ((loff_t) offset_high << 32) | offset_low);
 }
@@ -125,7 +125,7 @@
    support for 64bit inode numbers. */
 
 static int
-cp_stat64(struct stat64 *ubuf, struct kstat *stat)
+cp_stat64(struct stat64 __user *ubuf, struct kstat *stat)
 {
 	typeof(ubuf->st_uid) uid = 0;
 	typeof(ubuf->st_gid) gid = 0;
@@ -154,7 +154,7 @@
 }
 
 asmlinkage long
-sys32_stat64(char * filename, struct stat64 *statbuf)
+sys32_stat64(char __user * filename, struct stat64 __user *statbuf)
 {
 	struct kstat stat;
 	int ret = vfs_stat(filename, &stat);
@@ -164,7 +164,7 @@
 }
 
 asmlinkage long
-sys32_lstat64(char * filename, struct stat64 *statbuf)
+sys32_lstat64(char __user * filename, struct stat64 __user *statbuf)
 {
 	struct kstat stat;
 	int ret = vfs_lstat(filename, &stat);
@@ -174,7 +174,7 @@
 }
 
 asmlinkage long
-sys32_fstat64(unsigned int fd, struct stat64 *statbuf)
+sys32_fstat64(unsigned int fd, struct stat64 __user *statbuf)
 {
 	struct kstat stat;
 	int ret = vfs_fstat(fd, &stat);
@@ -199,7 +199,7 @@
 };
 
 asmlinkage long
-sys32_mmap(struct mmap_arg_struct *arg)
+sys32_mmap(struct mmap_arg_struct __user *arg)
 {
 	struct mmap_arg_struct a;
 	struct file *file = NULL;
@@ -241,7 +241,7 @@
 }
 
 asmlinkage long
-sys32_pipe(int *fd)
+sys32_pipe(int __user *fd)
 {
 	int retval;
 	int fds[2];
@@ -256,8 +256,8 @@
 }
 
 asmlinkage long
-sys32_rt_sigaction(int sig, struct sigaction32 *act,
-		   struct sigaction32 *oact,  unsigned int sigsetsize)
+sys32_rt_sigaction(int sig, struct sigaction32 __user *act,
+		   struct sigaction32 __user *oact,  unsigned int sigsetsize)
 {
 	struct k_sigaction new_ka, old_ka;
 	int ret;
@@ -321,7 +321,7 @@
 }
 
 asmlinkage long
-sys32_sigaction (int sig, struct old_sigaction32 *act, struct old_sigaction32 *oact)
+sys32_sigaction (int sig, struct old_sigaction32 __user *act, struct old_sigaction32 __user *oact)
 {
         struct k_sigaction new_ka, old_ka;
         int ret;
@@ -395,7 +395,7 @@
 }
 
 static inline long
-get_tv32(struct timeval *o, struct compat_timeval *i)
+get_tv32(struct timeval *o, struct compat_timeval __user *i)
 {
 	int err = -EFAULT; 
 	if (access_ok(VERIFY_READ, i, sizeof(*i))) { 
@@ -406,7 +406,7 @@
 }
 
 static inline long
-put_tv32(struct compat_timeval *o, struct timeval *i)
+put_tv32(struct compat_timeval __user *o, struct timeval *i)
 {
 	int err = -EFAULT;
 	if (access_ok(VERIFY_WRITE, o, sizeof(*o))) { 
@@ -442,7 +442,7 @@
 extern struct timezone sys_tz;
 
 asmlinkage long
-sys32_gettimeofday(struct compat_timeval *tv, struct timezone *tz)
+sys32_gettimeofday(struct compat_timeval __user *tv, struct timezone __user *tz)
 {
 	if (tv) {
 		struct timeval ktv;
@@ -458,7 +458,7 @@
 }
 
 asmlinkage long
-sys32_settimeofday(struct compat_timeval *tv, struct timezone *tz)
+sys32_settimeofday(struct compat_timeval __user *tv, struct timezone __user *tz)
 {
 	struct timeval ktv;
 	struct timespec kts;
@@ -493,14 +493,14 @@
 };
 
 struct getdents32_callback {
-	struct linux32_dirent * current_dir;
-	struct linux32_dirent * previous;
+	struct linux32_dirent __user * current_dir;
+	struct linux32_dirent __user * previous;
 	int count;
 	int error;
 };
 
 struct readdir32_callback {
-	struct old_linux32_dirent * dirent;
+	struct old_linux32_dirent __user * dirent;
 	int count;
 };
 
@@ -508,7 +508,7 @@
 filldir32 (void *__buf, const char *name, int namlen, loff_t offset, ino_t ino,
 	   unsigned int d_type)
 {
-	struct linux32_dirent * dirent;
+	struct linux32_dirent __user * dirent;
 	struct getdents32_callback * buf = (struct getdents32_callback *) __buf;
 	int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 2, 4);
 
@@ -524,18 +524,18 @@
 	put_user(reclen, &dirent->d_reclen);
 	copy_to_user(dirent->d_name, name, namlen);
 	put_user(0, dirent->d_name + namlen);
-	put_user(d_type, (char *)dirent + reclen - 1); 
-	dirent = ((void *)dirent) + reclen;
+	put_user(d_type, (char __user *)dirent + reclen - 1); 
+	dirent = ((void __user *)dirent) + reclen;
 	buf->current_dir = dirent;
 	buf->count -= reclen;
 	return 0;
 }
 
 asmlinkage long
-sys32_getdents (unsigned int fd, void * dirent, unsigned int count)
+sys32_getdents (unsigned int fd, void __user * dirent, unsigned int count)
 {
 	struct file * file;
-	struct linux32_dirent * lastdirent;
+	struct linux32_dirent __user * lastdirent;
 	struct getdents32_callback buf;
 	int error;
 
@@ -544,7 +544,7 @@
 	if (!file)
 		goto out;
 
-	buf.current_dir = (struct linux32_dirent *) dirent;
+	buf.current_dir = (struct linux32_dirent __user *) dirent;
 	buf.previous = NULL;
 	buf.count = count;
 	buf.error = 0;
@@ -569,7 +569,7 @@
 fillonedir32 (void * __buf, const char * name, int namlen, loff_t offset, ino_t ino, unsigned d_type)
 {
 	struct readdir32_callback * buf = (struct readdir32_callback *) __buf;
-	struct old_linux32_dirent * dirent;
+	struct old_linux32_dirent __user * dirent;
 
 	if (buf->count)
 		return -EINVAL;
@@ -584,7 +584,7 @@
 }
 
 asmlinkage long
-sys32_oldreaddir (unsigned int fd, void * dirent, unsigned int count)
+sys32_oldreaddir (unsigned int fd, void __user * dirent, unsigned int count)
 {
 	int error;
 	struct file * file;
@@ -615,7 +615,7 @@
 };
 
 asmlinkage long
-sys32_old_select(struct sel_arg_struct *arg)
+sys32_old_select(struct sel_arg_struct __user *arg)
 {
 	struct sel_arg_struct a;
 
@@ -630,7 +630,7 @@
  * sys_gettimeofday().  x86-64 did this but i386 Linux did not
  * so we have to implement this system call here.
  */
-asmlinkage long sys32_time(int * tloc)
+asmlinkage long sys32_time(int __user * tloc)
 {
 	int i;
 	struct timeval tv;
@@ -693,7 +693,7 @@
 };
 
 asmlinkage long
-sys32_sysinfo(struct sysinfo32 *info)
+sys32_sysinfo(struct sysinfo32 __user *info)
 {
 	struct sysinfo s;
 	int ret;
@@ -742,7 +742,7 @@
 }
                 
 asmlinkage long
-sys32_sched_rr_get_interval(compat_pid_t pid, struct compat_timespec *interval)
+sys32_sched_rr_get_interval(compat_pid_t pid, struct compat_timespec __user *interval)
 {
 	struct timespec t;
 	int ret;
@@ -782,8 +782,8 @@
 
 
 asmlinkage long
-sys32_rt_sigtimedwait(compat_sigset_t *uthese, siginfo_t32 *uinfo,
-		      struct compat_timespec *uts, compat_size_t sigsetsize)
+sys32_rt_sigtimedwait(compat_sigset_t __user *uthese, siginfo_t32 __user *uinfo,
+		      struct compat_timespec __user *uts, compat_size_t sigsetsize)
 {
 	sigset_t s;
 	compat_sigset_t s32;
@@ -820,7 +820,7 @@
 }
 
 asmlinkage long
-sys32_rt_sigqueueinfo(int pid, int sig, siginfo_t32 *uinfo)
+sys32_rt_sigqueueinfo(int pid, int sig, siginfo_t32 __user *uinfo)
 {
 	siginfo_t info;
 	int ret;
@@ -856,7 +856,7 @@
 
 
 asmlinkage long
-sys32_sysctl(struct sysctl_ia32 *args32)
+sys32_sysctl(struct sysctl_ia32 __user *args32)
 {
 #ifndef CONFIG_SYSCTL
 	return -ENOSYS; 
@@ -906,14 +906,14 @@
 
 /* warning: next two assume little endian */ 
 asmlinkage long
-sys32_pread(unsigned int fd, char *ubuf, u32 count, u32 poslo, u32 poshi)
+sys32_pread(unsigned int fd, char __user *ubuf, u32 count, u32 poslo, u32 poshi)
 {
 	return sys_pread64(fd, ubuf, count,
 			 ((loff_t)AA(poshi) << 32) | AA(poslo));
 }
 
 asmlinkage long
-sys32_pwrite(unsigned int fd, char *ubuf, u32 count, u32 poslo, u32 poshi)
+sys32_pwrite(unsigned int fd, char __user *ubuf, u32 count, u32 poslo, u32 poshi)
 {
 	return sys_pwrite64(fd, ubuf, count,
 			  ((loff_t)AA(poshi) << 32) | AA(poslo));
@@ -934,7 +934,7 @@
 }
 
 asmlinkage long
-sys32_sendfile(int out_fd, int in_fd, compat_off_t *offset, s32 count)
+sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset, s32 count)
 {
 	mm_segment_t old_fs = get_fs();
 	int ret;
@@ -971,7 +971,7 @@
 extern int do_adjtimex(struct timex *);
 
 asmlinkage long
-sys32_adjtimex(struct timex32 *utp)
+sys32_adjtimex(struct timex32 __user *utp)
 {
 	struct timex txc;
 	int ret;
@@ -1056,7 +1056,7 @@
 	return error;
 }
 
-asmlinkage long sys32_olduname(struct oldold_utsname * name)
+asmlinkage long sys32_olduname(struct oldold_utsname __user * name)
 {
 	int error;
 
@@ -1090,7 +1090,7 @@
 	 return error;
 }
 
-long sys32_uname(struct old_utsname * name)
+long sys32_uname(struct old_utsname __user * name)
 {
 	int err;
 	if (!name)
@@ -1124,7 +1124,7 @@
 	return ret;
 } 
 
-asmlinkage long sys32_execve(char *name, compat_uptr_t __user *argv,
+asmlinkage long sys32_execve(char __user *name, compat_uptr_t __user *argv,
 			     compat_uptr_t __user *envp, struct pt_regs regs)
 {
 	long error;
@@ -1143,8 +1143,8 @@
 
 asmlinkage long sys32_clone(unsigned int clone_flags, unsigned int newsp, struct pt_regs regs)
 {
-	void *parent_tid = (void *)regs.rdx;
-	void *child_tid = (void *)regs.rdi; 
+	void __user *parent_tid = (void __user *)regs.rdx;
+	void __user *child_tid = (void __user *)regs.rdi; 
 	if (!newsp)
 		newsp = regs.rsp;
         return do_fork(clone_flags & ~CLONE_IDLETASK, newsp, &regs, 0, 
@@ -1166,7 +1166,7 @@
 }
  
 
-long sys32_io_setup(unsigned nr_reqs, u32 *ctx32p)
+long sys32_io_setup(unsigned nr_reqs, u32 __user *ctx32p)
 { 
 	long ret; 
 	aio_context_t ctx64;
@@ -1181,7 +1181,7 @@
 } 
 
 asmlinkage long sys32_io_submit(aio_context_t ctx_id, int nr,
-		   compat_uptr_t *iocbpp)
+		   compat_uptr_t __user *iocbpp)
 {
 	struct kioctx *ctx;
 	long ret = 0;
@@ -1201,7 +1201,8 @@
 
 	for (i=0; i<nr; i++) {
 		compat_uptr_t p32;
-		struct iocb *user_iocb, tmp;
+		struct iocb __user *user_iocb;
+		struct iocb tmp;
 
 		if (unlikely(__get_user(p32, iocbpp + i))) {
 			ret = -EFAULT;
@@ -1227,8 +1228,8 @@
 asmlinkage long sys32_io_getevents(aio_context_t ctx_id,
 				 unsigned long min_nr,
 				 unsigned long nr,
-				 struct io_event *events,
-				 struct compat_timespec *timeout)
+				 struct io_event __user *events,
+				 struct compat_timespec __user *timeout)
 { 	
 	long ret;
 	mm_segment_t oldfs; 
@@ -1248,7 +1249,7 @@
 	return ret;
 } 
 
-asmlinkage long sys32_open(const char * filename, int flags, int mode)
+asmlinkage long sys32_open(const char __user * filename, int flags, int mode)
 {
 	char * tmp;
 	int fd, error;
@@ -1285,11 +1286,11 @@
 		 timer_t __user * created_timer_id);
 
 long
-sys32_timer_create(u32 clock, struct sigevent32 *se32, timer_t *timer_id)
+sys32_timer_create(u32 clock, struct sigevent32 __user *se32, timer_t __user *timer_id)
 {
 	struct sigevent se;
-       mm_segment_t oldfs;
-       long err;
+	mm_segment_t oldfs;
+	long err;
 
 	if (se32) { 
 		memset(&se, 0, sizeof(struct sigevent)); 
@@ -1303,9 +1304,9 @@
 	if (!access_ok(VERIFY_WRITE,timer_id,sizeof(timer_t)))
 		return -EFAULT;
 
-       oldfs = get_fs();
+	oldfs = get_fs();
 	set_fs(KERNEL_DS);
-       err = sys_timer_create(clock, se32 ? &se : NULL, timer_id);
+	err = sys_timer_create(clock, se32 ? &se : NULL, timer_id);
 	set_fs(oldfs); 
 	
 	return err; 
diff -Nru a/arch/x86_64/ia32/syscall32.c b/arch/x86_64/ia32/syscall32.c
--- a/arch/x86_64/ia32/syscall32.c	2004-06-02 23:26:59 -07:00
+++ b/arch/x86_64/ia32/syscall32.c	2004-06-02 23:26:59 -07:00
@@ -83,9 +83,9 @@
 
 	/* Load these always in case some future AMD CPU supports
 	   SYSENTER from compat mode too. */
-	wrmsr(MSR_IA32_SYSENTER_CS, __KERNEL_CS, 0);
-	wrmsr(MSR_IA32_SYSENTER_ESP, 0, 0);
-	wrmsrl(MSR_IA32_SYSENTER_EIP, ia32_sysenter_target);
+	checking_wrmsrl(MSR_IA32_SYSENTER_CS, (u64)__KERNEL_CS);
+	checking_wrmsrl(MSR_IA32_SYSENTER_ESP, 0ULL);
+	checking_wrmsrl(MSR_IA32_SYSENTER_EIP, (u64)ia32_sysenter_target);
 
 	wrmsrl(MSR_CSTAR, ia32_cstar_target);
 }
diff -Nru a/arch/x86_64/ia32/tls32.c b/arch/x86_64/ia32/tls32.c
--- a/arch/x86_64/ia32/tls32.c	2004-06-02 23:27:00 -07:00
+++ b/arch/x86_64/ia32/tls32.c	2004-06-02 23:27:00 -07:00
@@ -28,7 +28,7 @@
  * Set a given TLS descriptor:
  * When you want addresses > 32bit use arch_prctl() 
  */
-int do_set_thread_area(struct thread_struct *t, struct user_desc *u_info)
+int do_set_thread_area(struct thread_struct *t, struct user_desc __user *u_info)
 {
 	struct user_desc info;
 	struct n_desc_struct *desc;
@@ -75,7 +75,7 @@
 	return 0;
 }
 
-asmlinkage long sys32_set_thread_area(struct user_desc *u_info)
+asmlinkage long sys32_set_thread_area(struct user_desc __user *u_info)
 { 
 	return do_set_thread_area(&current->thread, u_info); 
 } 
@@ -102,7 +102,7 @@
 #define GET_USEABLE(desc)	(((desc)->b >> 20) & 1)
 #define GET_LONGMODE(desc)	(((desc)->b >> 21) & 1)
 
-int do_get_thread_area(struct thread_struct *t, struct user_desc *u_info)
+int do_get_thread_area(struct thread_struct *t, struct user_desc __user *u_info)
 {
 	struct user_desc info;
 	struct n_desc_struct *desc;
@@ -132,7 +132,7 @@
 	return 0;
 }
 
-asmlinkage long sys32_get_thread_area(struct user_desc *u_info)
+asmlinkage long sys32_get_thread_area(struct user_desc __user *u_info)
 {
 	return do_get_thread_area(&current->thread, u_info);
 } 
@@ -141,10 +141,11 @@
 int ia32_child_tls(struct task_struct *p, struct pt_regs *childregs)
 {
 	struct n_desc_struct *desc;
-	struct user_desc info, *cp;
+	struct user_desc info;
+	struct user_desc __user *cp;
 	int idx;
 	
-	cp = (void *)childregs->rsi;
+	cp = (void __user *)childregs->rsi;
 	if (copy_from_user(&info, cp, sizeof(info)))
 		return -EFAULT;
 	if (LDT_empty(&info))
diff -Nru a/arch/x86_64/kernel/Makefile-HEAD b/arch/x86_64/kernel/Makefile-HEAD
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/arch/x86_64/kernel/Makefile-HEAD	2004-06-02 23:27:00 -07:00
@@ -0,0 +1,38 @@
+#
+# Makefile for the linux kernel.
+#
+
+extra-y 	:= head.o head64.o init_task.o vmlinux.lds.s
+EXTRA_AFLAGS	:= -traditional
+obj-y	:= process.o semaphore.o signal.o entry.o traps.o irq.o \
+		ptrace.o i8259.o ioport.o ldt.o setup.o time.o sys_x86_64.o \
+		x8664_ksyms.o i387.o syscall.o vsyscall.o \
+		setup64.o bootflag.o e820.o reboot.o warmreboot.o
+obj-y += mce.o
+
+obj-$(CONFIG_MTRR)		+= ../../i386/kernel/cpu/mtrr/
+obj-$(CONFIG_ACPI_BOOT)		+= acpi/
+obj-$(CONFIG_X86_MSR)		+= msr.o
+obj-$(CONFIG_MICROCODE)		+= microcode.o
+obj-$(CONFIG_X86_CPUID)		+= cpuid.o
+obj-$(CONFIG_SMP)		+= smp.o smpboot.o trampoline.o
+obj-$(CONFIG_X86_LOCAL_APIC)	+= apic.o  nmi.o
+obj-$(CONFIG_X86_IO_APIC)	+= io_apic.o mpparse.o
+obj-$(CONFIG_PM)		+= suspend.o
+obj-$(CONFIG_SOFTWARE_SUSPEND)	+= suspend_asm.o
+obj-$(CONFIG_CPU_FREQ)		+= cpufreq/
+obj-$(CONFIG_EARLY_PRINTK)	+= early_printk.o
+obj-$(CONFIG_GART_IOMMU)	+= pci-gart.o aperture.o
+obj-$(CONFIG_DUMMY_IOMMU)	+= pci-nommu.o pci-dma.o
+obj-$(CONFIG_SWIOTLB)		+= swiotlb.o
+obj-$(CONFIG_SCHED_SMT)		+= domain.o
+
+obj-$(CONFIG_MODULES)		+= module.o
+
+obj-y				+= topology.o
+
+bootflag-y			+= ../../i386/kernel/bootflag.o
+cpuid-$(subst m,y,$(CONFIG_X86_CPUID))  += ../../i386/kernel/cpuid.o
+topology-y                     += ../../i386/mach-default/topology.o
+swiotlb-$(CONFIG_SWIOTLB)      += ../../ia64/lib/swiotlb.o
+microcode-$(subst m,y,$(CONFIG_MICROCODE))  += ../../i386/kernel/microcode.o
diff -Nru a/arch/x86_64/kernel/acpi/sleep.c b/arch/x86_64/kernel/acpi/sleep.c
--- a/arch/x86_64/kernel/acpi/sleep.c	2004-06-02 23:26:58 -07:00
+++ b/arch/x86_64/kernel/acpi/sleep.c	2004-06-02 23:26:58 -07:00
@@ -114,7 +114,7 @@
 	acpi_wakeup_address = (unsigned long)alloc_bootmem_low(PAGE_SIZE);
 	if ((&wakeup_end - &wakeup_start) > PAGE_SIZE)
 		printk(KERN_CRIT "ACPI: Wakeup code way too big, will crash on attempt to suspend\n");
-	printk(KERN_DEBUG "ACPI: have wakeup address 0x%8.8lx\n", acpi_wakeup_address);
+	Dprintk(KERN_DEBUG "ACPI: have wakeup address 0x%8.8lx\n", acpi_wakeup_address);
 }
 
 static int __init acpi_sleep_setup(char *str)
diff -Nru a/arch/x86_64/kernel/head.S b/arch/x86_64/kernel/head.S
--- a/arch/x86_64/kernel/head.S	2004-06-02 23:26:59 -07:00
+++ b/arch/x86_64/kernel/head.S	2004-06-02 23:26:59 -07:00
@@ -255,7 +255,7 @@
 	
 .org 0x5000
 ENTRY(level2_kernel_pgt)
-	/* 40MB kernel mapping. The kernel code cannot be bigger than that.
+	/* 10MB kernel mapping. The kernel code cannot be bigger than that.
 	   When you change this change KERNEL_TEXT_SIZE in page.h too. */
 	/* (2^48-(2*1024*1024*1024)-((2^39)*511)-((2^30)*510)) = 0 */
 	.quad	0x0000000000000183
@@ -263,21 +263,8 @@
 	.quad	0x0000000000400183
 	.quad	0x0000000000600183
 	.quad	0x0000000000800183
-	.quad	0x0000000000A00183
-	.quad	0x0000000000C00183
-	.quad	0x0000000000E00183
-	.quad	0x0000000001000183
-	.quad	0x0000000001200183
-	.quad	0x0000000001400183
-	.quad	0x0000000001600183
-	.quad	0x0000000001800183
-	.quad	0x0000000001A00183
-	.quad	0x0000000001C00183
-	.quad	0x0000000001E00183
-	.quad	0x0000000002000183
-	.quad	0x0000000002200183
-	.quad	0x0000000002400183
-	.quad	0x0000000002600183
+	/* 10MB mapping for now to decrease the aliasing window */
+	.fill   15,8,0
 	/* Module mapping starts here */
 	.fill	492,8,0
 
diff -Nru a/arch/x86_64/kernel/head64.c b/arch/x86_64/kernel/head64.c
--- a/arch/x86_64/kernel/head64.c	2004-06-02 23:26:59 -07:00
+++ b/arch/x86_64/kernel/head64.c	2004-06-02 23:26:59 -07:00
@@ -73,6 +73,8 @@
 	boot_cpu_data.x86_mask = eax & 0xf;
 }
 
+extern char _end[];
+
 void __init x86_64_start_kernel(char * real_mode_data)
 {
 	char *s;
@@ -80,6 +82,9 @@
 	clear_bss();
 	pda_init(0);
 	copy_bootdata(real_mode_data);
+#ifdef CONFIG_SMP
+	cpu_set(0, cpu_online_map);
+#endif
 	/* default console: */
 	if (!strstr(saved_command_line, "console="))
 		strcat(saved_command_line, " console=tty0"); 
@@ -95,6 +100,10 @@
 	if (strstr(saved_command_line, "disableapic"))
 		disable_apic = 1;
 #endif
+	/* You need early console to see that */
+	if (__pa_symbol(&_end) >= KERNEL_TEXT_SIZE)
+		panic("Kernel too big for kernel mapping\n");
+
 	setup_boot_cpu_data();
 	start_kernel();
 }
diff -Nru a/arch/x86_64/kernel/i387.c b/arch/x86_64/kernel/i387.c
--- a/arch/x86_64/kernel/i387.c	2004-06-02 23:26:59 -07:00
+++ b/arch/x86_64/kernel/i387.c	2004-06-02 23:26:59 -07:00
@@ -77,7 +77,7 @@
  * Signal frame handlers.
  */
 
-int save_i387(struct _fpstate *buf)
+int save_i387(struct _fpstate __user *buf)
 {
 	struct task_struct *tsk = current;
 	int err = 0;
@@ -95,7 +95,7 @@
 		return 0;
 	tsk->used_math = 0; /* trigger finit */ 
 	if (tsk->thread_info->status & TS_USEDFPU) {
-		err = save_i387_checking((struct i387_fxsave_struct *)buf);
+		err = save_i387_checking((struct i387_fxsave_struct __user *)buf);
 		if (err) return err;
 		stts();
 		} else {
@@ -110,14 +110,14 @@
  * ptrace request handlers.
  */
 
-int get_fpregs(struct user_i387_struct *buf, struct task_struct *tsk)
+int get_fpregs(struct user_i387_struct __user *buf, struct task_struct *tsk)
 {
 	init_fpu(tsk);
-	return __copy_to_user((void *)buf, &tsk->thread.i387.fxsave,
+	return __copy_to_user(buf, &tsk->thread.i387.fxsave,
 			       sizeof(struct user_i387_struct)) ? -EFAULT : 0;
 }
 
-int set_fpregs(struct task_struct *tsk, struct user_i387_struct *buf)
+int set_fpregs(struct task_struct *tsk, struct user_i387_struct __user *buf)
 {
 	if (__copy_from_user(&tsk->thread.i387.fxsave, buf, 
 			     sizeof(struct user_i387_struct)))
diff -Nru a/arch/x86_64/kernel/ldt.c b/arch/x86_64/kernel/ldt.c
--- a/arch/x86_64/kernel/ldt.c	2004-06-02 23:27:00 -07:00
+++ b/arch/x86_64/kernel/ldt.c	2004-06-02 23:27:00 -07:00
@@ -125,7 +125,7 @@
 	}
 }
 
-static int read_ldt(void * ptr, unsigned long bytecount)
+static int read_ldt(void __user * ptr, unsigned long bytecount)
 {
 	int err;
 	unsigned long size;
@@ -153,7 +153,7 @@
 	return bytecount;
 }
 
-static int read_default_ldt(void * ptr, unsigned long bytecount)
+static int read_default_ldt(void __user * ptr, unsigned long bytecount)
 {
 	/* Arbitrary number */ 
 	/* x86-64 default LDT is all zeros */
@@ -164,7 +164,7 @@
 	return bytecount; 
 }
 
-static int write_ldt(void * ptr, unsigned long bytecount, int oldmode)
+static int write_ldt(void __user * ptr, unsigned long bytecount, int oldmode)
 {
 	struct task_struct *me = current;
 	struct mm_struct * mm = me->mm;
@@ -225,7 +225,7 @@
 	return error;
 }
 
-asmlinkage int sys_modify_ldt(int func, void *ptr, unsigned long bytecount)
+asmlinkage int sys_modify_ldt(int func, void __user *ptr, unsigned long bytecount)
 {
 	int ret = -ENOSYS;
 
diff -Nru a/arch/x86_64/kernel/mce.c b/arch/x86_64/kernel/mce.c
--- a/arch/x86_64/kernel/mce.c	2004-06-02 23:26:59 -07:00
+++ b/arch/x86_64/kernel/mce.c	2004-06-02 23:26:59 -07:00
@@ -26,7 +26,7 @@
 
 static int mce_disabled __initdata;
 /* 0: always panic, 1: panic if deadlock possible, 2: try to avoid panic */ 
-static int tolerant = 2;
+static int tolerant = 1;
 static int banks;
 static unsigned long bank[NR_BANKS] = { [0 ... NR_BANKS-1] = ~0UL };
 
@@ -96,7 +96,8 @@
 	int i;
 	oops_begin();
 	for (i = 0; i < MCE_LOG_LEN; i++) {
-		if (mcelog.entry[i].tsc < start)
+		unsigned long tsc = mcelog.entry[i].tsc;
+		if (time_before(tsc, start))
 			continue;
 		print_mce(&mcelog.entry[i]); 
 		if (mcelog.entry[i].tsc == backup->tsc)
@@ -120,8 +121,8 @@
 
 void do_machine_check(struct pt_regs * regs, long error_code)
 {
-	struct mce m;
-	int nowayout = 0;
+	struct mce m, panicm;
+	int nowayout = (tolerant < 1); 
 	int kill_it = 0;
 	u64 mcestart;
 	int i;
@@ -149,12 +150,23 @@
 	for (i = 0; i < banks; i++) {
 		if (!bank[i])
 			continue;
+		
+		/* Did this bank cause the exception? */ 
+		/* XXX: check more flags  */
+		if ((m.status & MCI_STATUS_PCC)) { 
+			panicm = m; 
+		} else {
+			m.rip = 0;
+			m.cs = 0;
+		}
+
+		m.misc = 0; 
+		m.addr = 0;
 
 		rdmsrl(MSR_IA32_MC0_STATUS + i*4, m.status);
 		if ((m.status & MCI_STATUS_VAL) == 0)
 			continue;
 
-		nowayout |= (tolerant < 1); 
 		nowayout |= !!(m.status & (MCI_STATUS_OVER|MCI_STATUS_PCC));
 		kill_it |= !!(m.status & MCI_STATUS_UC);
 		m.bank = i;
@@ -176,7 +188,10 @@
 	if (nowayout)
 		mce_panic("Machine check", &m, mcestart);
 	if (kill_it) {
-		int user_space = (m.rip && (m.cs & 3));
+		int user_space = 0;
+
+		if (m.mcgstatus & MCG_STATUS_RIPV)
+			user_space = m.rip && (m.cs & 3);
 		
 		/* When the machine was in user space and the CPU didn't get
 		   confused it's normally not necessary to panic, unless you 
@@ -187,7 +202,7 @@
 		   it is best to just halt the machine. */
 		if ((!user_space && (panic_on_oops || tolerant < 2)) ||
 		    (unsigned)current->pid <= 1)
-			mce_panic("Uncorrected machine check", &m, mcestart);
+			mce_panic("Uncorrected machine check", &panicm, mcestart);
 
 		/* do_exit takes an awful lot of locks and has as slight risk 
 		   of deadlocking. If you don't want that don't set tolerant >= 2 */
@@ -207,7 +222,7 @@
  * Periodic polling timer for "silent" machine check errors.
  */
 
-static int check_interval = 3600; /* one hour */
+static int check_interval = 5 * 60; /* 5 minutes */
 static void mcheck_timer(void *data);
 static DECLARE_WORK(mcheck_work, mcheck_timer, NULL);
 
diff -Nru a/arch/x86_64/kernel/mpparse.c b/arch/x86_64/kernel/mpparse.c
--- a/arch/x86_64/kernel/mpparse.c	2004-06-02 23:26:59 -07:00
+++ b/arch/x86_64/kernel/mpparse.c	2004-06-02 23:26:59 -07:00
@@ -575,6 +575,7 @@
 	extern void __bad_mpf_size(void); 
 	unsigned int *bp = phys_to_virt(base);
 	struct intel_mp_floating *mpf;
+	static int printed __initdata; 
 
 	Dprintk("Scan SMP from %p for %ld bytes.\n", bp,length);
 	if (sizeof(*mpf) != 16)
@@ -598,7 +599,10 @@
 		bp += 4;
 		length -= 16;
 	}
-	printk(KERN_INFO "No mptable found.\n");
+	if (!printed) {		
+		printk(KERN_INFO "No mptable found.\n");
+		printed = 1;
+	}
 	return 0;
 }
 
diff -Nru a/arch/x86_64/kernel/msr.c b/arch/x86_64/kernel/msr.c
--- a/arch/x86_64/kernel/msr.c	2004-06-02 23:26:58 -07:00
+++ b/arch/x86_64/kernel/msr.c	2004-06-02 23:26:58 -07:00
@@ -241,7 +241,7 @@
   int cpu = iminor(file->f_dentry->d_inode);
   struct cpuinfo_x86 *c = &(cpu_data)[cpu];
   
-  if (!cpu_online(cpu))
+  if (cpu >= NR_CPUS || !cpu_online(cpu))
     return -ENXIO;		/* No such CPU */
   if ( !cpu_has(c, X86_FEATURE_MSR) )
     return -EIO;		/* MSR not supported */
diff -Nru a/arch/x86_64/kernel/process.c b/arch/x86_64/kernel/process.c
--- a/arch/x86_64/kernel/process.c	2004-06-02 23:26:59 -07:00
+++ b/arch/x86_64/kernel/process.c	2004-06-02 23:26:59 -07:00
@@ -521,7 +521,8 @@
  * sys_execve() executes a new program.
  */
 asmlinkage 
-long sys_execve(char *name, char **argv,char **envp, struct pt_regs regs)
+long sys_execve(char __user *name, char __user * __user *argv,
+		char __user * __user *envp, struct pt_regs regs)
 {
 	long error;
 	char * filename;
@@ -550,7 +551,7 @@
 	return do_fork(SIGCHLD, regs.rsp, &regs, 0, NULL, NULL);
 }
 
-asmlinkage long sys_clone(unsigned long clone_flags, unsigned long newsp, void *parent_tid, void *child_tid, struct pt_regs regs)
+asmlinkage long sys_clone(unsigned long clone_flags, unsigned long newsp, void __user *parent_tid, void __user *child_tid, struct pt_regs regs)
 {
 	if (!newsp)
 		newsp = regs.rsp;
@@ -664,7 +665,7 @@
 			rdmsrl(MSR_FS_BASE, base);
 		} else
 			base = task->thread.fs;
-		ret = put_user(base, (unsigned long *)addr); 
+		ret = put_user(base, (unsigned long __user *)addr); 
 		break; 
 	}
 	case ARCH_GET_GS: { 
@@ -675,7 +676,7 @@
 			rdmsrl(MSR_KERNEL_GS_BASE, base);
 		} else
 			base = task->thread.gs;
-		ret = put_user(base, (unsigned long *)addr); 
+		ret = put_user(base, (unsigned long __user *)addr); 
 		break;
 	}
 
diff -Nru a/arch/x86_64/kernel/ptrace.c b/arch/x86_64/kernel/ptrace.c
--- a/arch/x86_64/kernel/ptrace.c	2004-06-02 23:26:59 -07:00
+++ b/arch/x86_64/kernel/ptrace.c	2004-06-02 23:26:59 -07:00
@@ -232,7 +232,7 @@
 		ret = -EIO;
 		if (copied != sizeof(tmp))
 			break;
-		ret = put_user(tmp,(unsigned long *) data);
+		ret = put_user(tmp,(unsigned long __user *) data);
 		break;
 	}
 
@@ -271,7 +271,7 @@
 			tmp = 0;
 			break;
 		}
-		ret = put_user(tmp,(unsigned long *) data);
+		ret = put_user(tmp,(unsigned long __user *) data);
 		break;
 	}
 
@@ -360,19 +360,20 @@
 		   don't use it against 64bit processes, use
 		   PTRACE_ARCH_PRCTL instead. */
 	case PTRACE_SET_THREAD_AREA: {
+		struct user_desc __user *p;
 		int old; 
-		get_user(old,  &((struct user_desc *)data)->entry_number); 
-		put_user(addr, &((struct user_desc *)data)->entry_number);
-		ret = do_set_thread_area(&child->thread, 
-					 (struct user_desc *)data);
-		put_user(old,  &((struct user_desc *)data)->entry_number); 
+		p = (struct user_desc __user *)data;
+		get_user(old,  &p->entry_number); 
+		put_user(addr, &p->entry_number);
+		ret = do_set_thread_area(&child->thread, p);
+		put_user(old,  &p->entry_number); 
 		break;
 	case PTRACE_GET_THREAD_AREA:
-		get_user(old,  &((struct user_desc *)data)->entry_number); 
-		put_user(addr, &((struct user_desc *)data)->entry_number);
-		ret = do_get_thread_area(&child->thread, 
-					 (struct user_desc *)data);
-		put_user(old,  &((struct user_desc *)data)->entry_number); 
+		p = (struct user_desc __user *)data;
+		get_user(old,  &p->entry_number); 
+		put_user(addr, &p->entry_number);
+		ret = do_get_thread_area(&child->thread, p);
+		put_user(old,  &p->entry_number); 
 		break;
 	} 
 #endif
@@ -428,12 +429,12 @@
 		break;
 
 	case PTRACE_GETREGS: { /* Get all gp regs from the child. */
-	  	if (!access_ok(VERIFY_WRITE, (unsigned *)data, FRAME_SIZE)) {
+	  	if (!access_ok(VERIFY_WRITE, (unsigned __user *)data, FRAME_SIZE)) {
 			ret = -EIO;
 			break;
 		}
 		for (ui = 0; ui < sizeof(struct user_regs_struct); ui += sizeof(long)) {
-			__put_user(getreg(child, ui),(unsigned long *) data);
+			__put_user(getreg(child, ui),(unsigned long __user *) data);
 			data += sizeof(long);
 		}
 		ret = 0;
@@ -442,12 +443,12 @@
 
 	case PTRACE_SETREGS: { /* Set all gp regs in the child. */
 		unsigned long tmp;
-	  	if (!access_ok(VERIFY_READ, (unsigned *)data, FRAME_SIZE)) {
+	  	if (!access_ok(VERIFY_READ, (unsigned __user *)data, FRAME_SIZE)) {
 			ret = -EIO;
 			break;
 		}
 		for (ui = 0; ui < sizeof(struct user_regs_struct); ui += sizeof(long)) {
-			__get_user(tmp, (unsigned long *) data);
+			__get_user(tmp, (unsigned long __user *) data);
 			putreg(child, ui, tmp);
 			data += sizeof(long);
 		}
@@ -456,23 +457,23 @@
 	}
 
 	case PTRACE_GETFPREGS: { /* Get the child extended FPU state. */
-		if (!access_ok(VERIFY_WRITE, (unsigned *)data,
+		if (!access_ok(VERIFY_WRITE, (unsigned __user *)data,
 			       sizeof(struct user_i387_struct))) {
 			ret = -EIO;
 			break;
 		}
-		ret = get_fpregs((struct user_i387_struct *)data, child);
+		ret = get_fpregs((struct user_i387_struct __user *)data, child);
 		break;
 	}
 
 	case PTRACE_SETFPREGS: { /* Set the child extended FPU state. */
-		if (!access_ok(VERIFY_READ, (unsigned *)data,
+		if (!access_ok(VERIFY_READ, (unsigned __user *)data,
 			       sizeof(struct user_i387_struct))) {
 			ret = -EIO;
 			break;
 		}
 		child->used_math = 1;
-		ret = set_fpregs(child, (struct user_i387_struct *)data);
+		ret = set_fpregs(child, (struct user_i387_struct __user *)data);
 		break;
 	}
 
diff -Nru a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c
--- a/arch/x86_64/kernel/setup.c	2004-06-02 23:26:58 -07:00
+++ b/arch/x86_64/kernel/setup.c	2004-06-02 23:26:58 -07:00
@@ -909,7 +909,7 @@
 			c->x86_model += ((tfms >> 16) & 0xF) << 4;
 		} 
 		if (c->x86_capability[0] & (1<<19)) 
-       		c->x86_clflush_size = ((misc >> 8) & 0xff) * 8;
+			c->x86_clflush_size = ((misc >> 8) & 0xff) * 8;
 	} else {
 		/* Have CPUID level 0 only - unheard of */
 		c->x86 = 4;
@@ -967,7 +967,7 @@
 			display_cacheinfo(c);
 			break;
 	}
-	
+
 	select_idle_routine(c);
 	detect_ht(c); 
 		
diff -Nru a/arch/x86_64/kernel/setup64.c b/arch/x86_64/kernel/setup64.c
--- a/arch/x86_64/kernel/setup64.c	2004-06-02 23:26:59 -07:00
+++ b/arch/x86_64/kernel/setup64.c	2004-06-02 23:26:59 -07:00
@@ -39,7 +39,7 @@
 extern struct desc_ptr cpu_gdt_descr[];
 struct desc_ptr idt_descr = { 256 * 16, (unsigned long) idt_table }; 
 
-char boot_cpu_stack[IRQSTACKSIZE] __cacheline_aligned;
+char boot_cpu_stack[IRQSTACKSIZE] __attribute__((section(".bss.page_aligned")));
 
 unsigned long __supported_pte_mask = ~0UL;
 static int do_not_nx __initdata = 0;
@@ -190,7 +190,8 @@
 	pda->irqstackptr += IRQSTACKSIZE-64;
 } 
 
-char boot_exception_stacks[N_EXCEPTION_STACKS * EXCEPTION_STKSZ];
+char boot_exception_stacks[N_EXCEPTION_STACKS * EXCEPTION_STKSZ] 
+__attribute__((section(".bss.page_aligned")));
 
 void __init syscall_init(void)
 {
diff -Nru a/arch/x86_64/kernel/signal.c b/arch/x86_64/kernel/signal.c
--- a/arch/x86_64/kernel/signal.c	2004-06-02 23:27:00 -07:00
+++ b/arch/x86_64/kernel/signal.c	2004-06-02 23:27:00 -07:00
@@ -40,7 +40,7 @@
             sigset_t *set, struct pt_regs * regs); 
 
 asmlinkage long
-sys_rt_sigsuspend(sigset_t *unewset, size_t sigsetsize, struct pt_regs regs)
+sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize, struct pt_regs regs)
 {
 	sigset_t saveset, newset;
 
@@ -57,7 +57,7 @@
 	current->blocked = newset;
 	recalc_sigpending();
 	spin_unlock_irq(&current->sighand->siglock);
-#if DEBUG_SIG
+#ifdef DEBUG_SIG
 	printk("rt_sigsuspend savset(%lx) newset(%lx) regs(%p) rip(%lx)\n",
 		saveset, newset, &regs, regs.rip);
 #endif 
@@ -71,7 +71,7 @@
 }
 
 asmlinkage long
-sys_sigaltstack(const stack_t *uss, stack_t *uoss, struct pt_regs regs)
+sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, struct pt_regs regs)
 {
 	return do_sigaltstack(uss, uoss, regs.rsp);
 }
@@ -89,7 +89,7 @@
 };
 
 static int
-restore_sigcontext(struct pt_regs *regs, struct sigcontext *sc, unsigned long *prax)
+restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, unsigned long *prax)
 {
 	unsigned int err = 0;
 
@@ -117,7 +117,7 @@
 	}
 
 	{
-		struct _fpstate * buf;
+		struct _fpstate __user * buf;
 		err |= __get_user(buf, &sc->fpstate);
 
 		if (buf) {
@@ -136,10 +136,11 @@
 
 asmlinkage long sys_rt_sigreturn(struct pt_regs regs)
 {
-	struct rt_sigframe *frame = (struct rt_sigframe *)(regs.rsp - 8);
+	struct rt_sigframe __user *frame;
 	sigset_t set;
 	long eax;
 
+	frame = (struct rt_sigframe __user *)(regs.rsp - 8);
 	if (verify_area(VERIFY_READ, frame, sizeof(*frame))) { 
 		goto badframe;
 	} 
@@ -157,7 +158,7 @@
 		goto badframe;
 	} 
 
-#if DEBUG_SIG
+#ifdef DEBUG_SIG
 	printk("%d sigreturn rip:%lx rsp:%lx frame:%p rax:%lx\n",current->pid,regs.rip,regs.rsp,frame,eax);
 #endif
 
@@ -176,7 +177,7 @@
  */
 
 static inline int
-setup_sigcontext(struct sigcontext *sc, struct pt_regs *regs, unsigned long mask, struct task_struct *me)
+setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs, unsigned long mask, struct task_struct *me)
 {
 	int err = 0;
 
@@ -213,7 +214,7 @@
  * Determine which stack to use..
  */
 
-static void *
+static void __user *
 get_stack(struct k_sigaction *ka, struct pt_regs *regs, unsigned long size)
 {
 	unsigned long rsp;
@@ -228,20 +229,20 @@
 			rsp = current->sas_ss_sp + current->sas_ss_size;
 	}
 
-	return (void *)round_down(rsp - size, 16); 
+	return (void __user *)round_down(rsp - size, 16); 
 }
 
 static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
 			   sigset_t *set, struct pt_regs * regs)
 {
-	struct rt_sigframe *frame;
-	struct _fpstate *fp = NULL; 
+	struct rt_sigframe __user *frame;
+	struct _fpstate __user *fp = NULL; 
 	int err = 0;
 	struct task_struct *me = current;
 
 	if (me->used_math) {
 		fp = get_stack(ka, regs, sizeof(struct _fpstate)); 
-		frame = (void *)round_down((u64)fp - sizeof(struct rt_sigframe), 16) - 8;
+		frame = (void __user *)round_down((u64)fp - sizeof(struct rt_sigframe), 16) - 8;
 
 		if (!access_ok(VERIFY_WRITE, fp, sizeof(struct _fpstate))) { 
 		goto give_sigsegv;
@@ -294,7 +295,7 @@
 		goto give_sigsegv;
 	} 
 
-#if DEBUG_SIG
+#ifdef DEBUG_SIG
 	printk("%d old rip %lx old rsp %lx old rax %lx\n", current->pid,regs->rip,regs->rsp,regs->rax);
 #endif
 
@@ -319,7 +320,7 @@
 	set_fs(USER_DS);
 	regs->eflags &= ~TF_MASK;
 
-#if DEBUG_SIG
+#ifdef DEBUG_SIG
 	printk("SIG deliver (%s:%d): sp=%p pc=%p ra=%p\n",
 		current->comm, current->pid, frame, regs->rip, frame->pretcode);
 #endif
@@ -342,7 +343,7 @@
 {
 	struct k_sigaction *ka = &current->sighand->action[sig-1];
 
-#if DEBUG_SIG
+#ifdef DEBUG_SIG
 	printk("handle_signal pid:%d sig:%lu rip:%lx rsp:%lx regs=%p\n", current->pid, sig, 
 		regs->rip, regs->rsp, regs);
 #endif
@@ -454,7 +455,7 @@
 
 void do_notify_resume(struct pt_regs *regs, sigset_t *oldset, __u32 thread_info_flags)
 {
-#if DEBUG_SIG
+#ifdef DEBUG_SIG
 	printk("do_notify_resume flags:%x rip:%lx rsp:%lx caller:%lx pending:%lx\n",
 	       thread_info_flags, regs->rip, regs->rsp, __builtin_return_address(0),signal_pending(current)); 
 #endif
@@ -470,7 +471,7 @@
 		do_signal(regs,oldset);
 }
 
-void signal_fault(struct pt_regs *regs, void *frame, char *where)
+void signal_fault(struct pt_regs *regs, void __user *frame, char *where)
 { 
 	struct task_struct *me = current; 
 	if (exception_trace)
diff -Nru a/arch/x86_64/kernel/smpboot.c b/arch/x86_64/kernel/smpboot.c
--- a/arch/x86_64/kernel/smpboot.c	2004-06-02 23:27:00 -07:00
+++ b/arch/x86_64/kernel/smpboot.c	2004-06-02 23:27:00 -07:00
@@ -895,15 +895,17 @@
 					cpu_set(i, cpu_sibling_map[cpu]);
 				}
 			}
-		} else {
+		} else { 
 			siblings++;
 			cpu_set(cpu, cpu_sibling_map[cpu]);
 		}
 
-		if (siblings != smp_num_siblings)
-			printk(KERN_WARNING
-	       "WARNING: %d siblings found for CPU%d, should be %d\n",
+		if (siblings != smp_num_siblings) {
+			printk(KERN_WARNING 
+	       "WARNING: %d siblings found for CPU%d, should be %d\n", 
 			       siblings, cpu, smp_num_siblings);
+			smp_num_siblings = siblings;
+		}       
 	}
 
 	Dprintk("Boot done.\n");
diff -Nru a/arch/x86_64/kernel/sys_x86_64.c b/arch/x86_64/kernel/sys_x86_64.c
--- a/arch/x86_64/kernel/sys_x86_64.c	2004-06-02 23:26:59 -07:00
+++ b/arch/x86_64/kernel/sys_x86_64.c	2004-06-02 23:26:59 -07:00
@@ -25,7 +25,7 @@
  * sys_pipe() is the normal C calling standard for creating
  * a pipe. It's not the way Unix traditionally does this, though.
  */
-asmlinkage long sys_pipe(int *fildes)
+asmlinkage long sys_pipe(int __user *fildes)
 {
 	int fd[2];
 	int error;
@@ -142,7 +142,7 @@
 	}
 }
 
-asmlinkage long sys_uname(struct new_utsname * name)
+asmlinkage long sys_uname(struct new_utsname __user * name)
 {
 	int err;
 	down_read(&uts_sem);
@@ -153,13 +153,13 @@
 	return err ? -EFAULT : 0;
 }
 
-asmlinkage long wrap_sys_shmat(int shmid, char *shmaddr, int shmflg)
+asmlinkage long wrap_sys_shmat(int shmid, char __user *shmaddr, int shmflg)
 {
 	unsigned long raddr;
 	return do_shmat(shmid,shmaddr,shmflg,&raddr) ?: (long)raddr;
 }
 
-asmlinkage long sys_time64(long * tloc)
+asmlinkage long sys_time64(long __user * tloc)
 {
 	struct timeval now; 
 	int i; 
diff -Nru a/arch/x86_64/kernel/vmlinux.lds.S b/arch/x86_64/kernel/vmlinux.lds.S
--- a/arch/x86_64/kernel/vmlinux.lds.S	2004-06-02 23:26:58 -07:00
+++ b/arch/x86_64/kernel/vmlinux.lds.S	2004-06-02 23:26:58 -07:00
@@ -39,6 +39,7 @@
 
   __bss_start = .;		/* BSS */
   .bss : {
+	*(.bss.page_aligned)	
 	*(.bss)
 	}
   __bss_end = .;
@@ -75,8 +76,8 @@
   . = ALIGN(8192);		/* init_task */
   .data.init_task : { *(.data.init_task) }
 
-  . = ALIGN(4096); 
-  .data.boot_pgt : { *(.data.boot_pgt) }
+  . = ALIGN(4096);
+  .data.page_aligned : { *(.data.page_aligned) }
 
   . = ALIGN(4096);		/* Init code and data */
   __init_begin = .;
diff -Nru a/arch/x86_64/kernel/x8664_ksyms.c b/arch/x86_64/kernel/x8664_ksyms.c
--- a/arch/x86_64/kernel/x8664_ksyms.c	2004-06-02 23:26:58 -07:00
+++ b/arch/x86_64/kernel/x8664_ksyms.c	2004-06-02 23:26:58 -07:00
@@ -219,6 +219,3 @@
 #endif
 
 EXPORT_SYMBOL(sys_ioctl);
-
-EXPORT_SYMBOL(memcpy_toio);
-EXPORT_SYMBOL(memcpy_fromio);
diff -Nru a/arch/x86_64/lib/Makefile b/arch/x86_64/lib/Makefile
--- a/arch/x86_64/lib/Makefile	2004-06-02 23:26:58 -07:00
+++ b/arch/x86_64/lib/Makefile	2004-06-02 23:26:58 -07:00
@@ -4,9 +4,11 @@
 
 CFLAGS_csum-partial.o := -funroll-loops
 
+obj-y := io.o
+
 lib-y := csum-partial.o csum-copy.o csum-wrappers.o delay.o \
 	usercopy.o getuser.o putuser.o  \
-	thunk.o io.o clear_page.o copy_page.o bitstr.o
+	thunk.o clear_page.o copy_page.o bitstr.o
 lib-y += memcpy.o memmove.o memset.o copy_user.o
 
 lib-$(CONFIG_HAVE_DEC_LOCK) += dec_and_lock.o
diff -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-06-02 23:26:58 -07:00
+++ b/arch/x86_64/lib/csum-wrappers.c	2004-06-02 23:26:58 -07:00
@@ -19,7 +19,7 @@
  * src and dst are best aligned to 64bits. 
  */ 
 unsigned int 
-csum_partial_copy_from_user(const char *src, char *dst, 
+csum_partial_copy_from_user(const char __user *src, char *dst, 
 			    int len, unsigned int isum, int *errp)
 { 
 	*errp = 0;
@@ -33,7 +33,7 @@
 		if (unlikely((unsigned long)src & 6)) {			
 			while (((unsigned long)src & 6) && len >= 2) { 
 				__u16 val16;			
-				*errp = __get_user(val16, (__u16 *)src); 
+				*errp = __get_user(val16, (__u16 __user *)src); 
 				if (*errp)
 					return isum;
 				*(__u16 *)dst = val16;
@@ -43,7 +43,7 @@
 				len -= 2;
 			}
 		}
-		isum = csum_partial_copy_generic(src,dst,len,isum,errp,NULL);
+		isum = csum_partial_copy_generic((void *)src,dst,len,isum,errp,NULL);
 		if (likely(*errp == 0)) 
 			return isum;
 	} 
@@ -66,7 +66,7 @@
  * src and dst are best aligned to 64bits.
  */ 
 unsigned int 
-csum_partial_copy_to_user(const char *src, char *dst, 
+csum_partial_copy_to_user(const char *src, char __user *dst, 
 			  int len, unsigned int isum, int *errp)
 { 
 	if (unlikely(!access_ok(VERIFY_WRITE, dst, len))) {
@@ -78,7 +78,7 @@
 		while (((unsigned long)dst & 6) && len >= 2) { 
 			__u16 val16 = *(__u16 *)src;
 			isum = add32_with_carry(isum, val16);
-			*errp = __put_user(val16, (__u16 *)dst);
+			*errp = __put_user(val16, (__u16 __user *)dst);
 			if (*errp)
 				return isum;
 			src += 2; 
@@ -88,7 +88,7 @@
 	}
 
 	*errp = 0;
-	return csum_partial_copy_generic(src,dst,len,isum,NULL,errp); 
+	return csum_partial_copy_generic(src, (void *)dst,len,isum,NULL,errp); 
 } 
 
 EXPORT_SYMBOL(csum_partial_copy_to_user);
diff -Nru a/arch/x86_64/lib/io.c b/arch/x86_64/lib/io.c
--- a/arch/x86_64/lib/io.c	2004-06-02 23:26:58 -07:00
+++ b/arch/x86_64/lib/io.c	2004-06-02 23:26:58 -07:00
@@ -2,12 +2,14 @@
 #include <asm/io.h>
 #include <linux/module.h>
 
-void *memcpy_toio(void *dst,const void*src,unsigned len)
+void *__memcpy_toio(unsigned long dst,const void*src,unsigned len)
 {
-	return __inline_memcpy(dst,src,len);
+	return __inline_memcpy((void *) dst,src,len);
 }
+EXPORT_SYMBOL(__memcpy_toio);
 
-void *memcpy_fromio(void *dst,const void*src,unsigned len)
+void *__memcpy_fromio(void *dst,unsigned long src,unsigned len)
 {
-	return __inline_memcpy(dst,src,len);
+	return __inline_memcpy(dst,(const void *) src,len);
 }
+EXPORT_SYMBOL(__memcpy_fromio);
diff -Nru a/arch/x86_64/lib/usercopy.c b/arch/x86_64/lib/usercopy.c
--- a/arch/x86_64/lib/usercopy.c	2004-06-02 23:26:58 -07:00
+++ b/arch/x86_64/lib/usercopy.c	2004-06-02 23:26:58 -07:00
@@ -40,7 +40,7 @@
 } while (0)
 
 long
-__strncpy_from_user(char *dst, const char *src, long count)
+__strncpy_from_user(char *dst, const char __user *src, long count)
 {
 	long res;
 	__do_strncpy_from_user(dst, src, count, res);
@@ -48,7 +48,7 @@
 }
 
 long
-strncpy_from_user(char *dst, const char *src, long count)
+strncpy_from_user(char *dst, const char __user *src, long count)
 {
 	long res = -EFAULT;
 	if (access_ok(VERIFY_READ, src, 1))
@@ -60,7 +60,7 @@
  * Zero Userspace
  */
 
-unsigned long __clear_user(void *addr, unsigned long size)
+unsigned long __clear_user(void __user *addr, unsigned long size)
 {
 	long __d0;
 	/* no memory constraint because it doesn't change any memory gcc knows
@@ -94,7 +94,7 @@
 }
 
 
-unsigned long clear_user(void *to, unsigned long n)
+unsigned long clear_user(void __user *to, unsigned long n)
 {
 	if (access_ok(VERIFY_WRITE, to, n))
 		return __clear_user(to, n);
@@ -107,7 +107,7 @@
  * Return 0 on exception, a value greater than N if too long
  */
 
-long strnlen_user(const char *s, long n)
+long strnlen_user(const char __user *s, long n)
 {
 	long res = 0;
 	char c;
@@ -127,7 +127,7 @@
 	}
 }
 
-long strlen_user(const char *s)
+long strlen_user(const char __user *s)
 {
 	long res = 0;
 	char c;
@@ -142,10 +142,10 @@
 	}
 }
 
-unsigned long copy_in_user(void *to, const void *from, unsigned len)
+unsigned long copy_in_user(void __user *to, const void __user *from, unsigned len)
 {
 	if (access_ok(VERIFY_WRITE, to, len) && access_ok(VERIFY_READ, from, len)) { 
-		return copy_user_generic(to, from, len);
+		return copy_user_generic((void *)to, (void *)from, len);
 	} 
 	return len;		
 }
diff -Nru a/arch/x86_64/mm/init.c b/arch/x86_64/mm/init.c
--- a/arch/x86_64/mm/init.c	2004-06-02 23:26:58 -07:00
+++ b/arch/x86_64/mm/init.c	2004-06-02 23:26:58 -07:00
@@ -512,9 +512,7 @@
 	/* Should check here against the e820 map to avoid double free */ 
 #ifdef CONFIG_DISCONTIGMEM
 	int nid = phys_to_nid(phys);
-	if (phys < HIGH_MEMORY && nid) 
-		panic("reserve of %lx at node %d", phys, nid);
-	reserve_bootmem_node(NODE_DATA(nid), phys, len);
+  	reserve_bootmem_node(NODE_DATA(nid), phys, len);
 #else       		
 	reserve_bootmem(phys, len);    
 #endif
diff -Nru a/arch/x86_64/mm/pageattr.c b/arch/x86_64/mm/pageattr.c
--- a/arch/x86_64/mm/pageattr.c	2004-06-02 23:26:59 -07:00
+++ b/arch/x86_64/mm/pageattr.c	2004-06-02 23:26:59 -07:00
@@ -96,8 +96,7 @@
  * No more special protections in this 2/4MB area - revert to a
  * large page again. 
  */
-static void revert_page(struct page *kpte_page, unsigned long address, 
-			pgprot_t ref_prot)
+static void revert_page(unsigned long address, pgprot_t ref_prot)
 {
        pgd_t *pgd;
        pmd_t *pmd; 
@@ -145,7 +144,7 @@
 
 	if (page_count(kpte_page) == 1) {
 		save_page(address, kpte_page); 		     
-		revert_page(kpte_page, address, ref_prot);
+		revert_page(address, ref_prot);
 	} 
 	return 0;
 } 
@@ -176,7 +175,8 @@
 			break; 
 		/* Handle kernel mapping too which aliases part of the
 		 * lowmem */
-		if (page_to_phys(page) < KERNEL_TEXT_SIZE) {		
+		/* Disabled right now. Fixme */ 
+		if (0 && page_to_phys(page) < KERNEL_TEXT_SIZE) {		
 			unsigned long addr2;
 			addr2 = __START_KERNEL_map + page_to_phys(page);
 			err = __change_page_attr(addr2, page, prot, 
diff -Nru a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c
--- a/drivers/acpi/asus_acpi.c	2004-06-02 23:26:59 -07:00
+++ b/drivers/acpi/asus_acpi.c	2004-06-02 23:26:59 -07:00
@@ -40,6 +40,7 @@
 #include <linux/proc_fs.h>
 #include <acpi/acpi_drivers.h>
 #include <acpi/acpi_bus.h>
+#include <asm/uaccess.h>
 
 #define ASUS_ACPI_VERSION "0.28"
 
@@ -480,16 +481,31 @@
 	return (hotk->status & ledmask) ? 1 : 0;
 }
 
+static int parse_arg(const char __user *buf, unsigned long count, int *val)
+{
+	char s[32];
+	if (!count)
+		return 0;
+	if (count > 31)
+		return -EINVAL;
+	if (copy_from_user(s, buf, count))
+		return -EFAULT;
+	s[count] = 0;
+	if (sscanf(s, "%i", val) != 1)
+		return -EINVAL;
+	return count;
+}
 
 /* FIXME: kill extraneous args so it can be called independently */
 static int
-write_led(const char *buffer, unsigned long count, struct asus_hotk *hotk, 
+write_led(const char __user *buffer, unsigned long count, struct asus_hotk *hotk, 
           char *ledname, int ledmask, int invert)
 {
 	int value;
 	int led_out = 0;
 
-	if (sscanf(buffer, "%i", &value) == 1)
+	count = parse_arg(buffer, count, &value);
+	if (count > 0)
 		led_out = value ? 1 : 0;
 
 	hotk->status =
@@ -518,7 +534,7 @@
 
 
 static int
-proc_write_mled(struct file *file, const char *buffer,
+proc_write_mled(struct file *file, const char __user *buffer,
 		unsigned long count, void *data)
 {
 	struct asus_hotk *hotk = (struct asus_hotk *) data;
@@ -537,7 +553,7 @@
 }
 
 static int
-proc_write_wled(struct file *file, const char *buffer,
+proc_write_wled(struct file *file, const char __user *buffer,
 		unsigned long count, void *data)
 {
 	struct asus_hotk *hotk = (struct asus_hotk *) data;
@@ -556,7 +572,7 @@
 }
 
 static int
-proc_write_tled(struct file *file, const char *buffer,
+proc_write_tled(struct file *file, const char __user *buffer,
 		unsigned long count, void *data)
 {
 	struct asus_hotk *hotk = (struct asus_hotk *) data;
@@ -640,13 +656,14 @@
 
 
 static int
-proc_write_lcd(struct file *file, const char *buffer,
+proc_write_lcd(struct file *file, const char __user *buffer,
 	       unsigned long count, void *data)
 {
 	int value;
 	struct asus_hotk *hotk = (struct asus_hotk *) data;
 	
-	if (sscanf(buffer, "%i", &value) == 1)
+	count = parse_arg(buffer, count, &value);
+	if (count > 0)
 		set_lcd_state(hotk, value);
 	return count;
 }
@@ -707,17 +724,18 @@
 }
 
 static int
-proc_write_brn(struct file *file, const char *buffer,
+proc_write_brn(struct file *file, const char __user *buffer,
 	       unsigned long count, void *data)
 {
 	int value;
 	struct asus_hotk *hotk = (struct asus_hotk *) data;
 
-	if (sscanf(buffer, "%d", &value) == 1) {
+	count = parse_arg(buffer, count, &value);
+	if (count > 0) {
 		value = (0 < value) ? ((15 < value) ? 15 : value) : 0;
 			/* 0 <= value <= 15 */
 		set_brightness(value, hotk);
-	} else {
+	} else if (count < 0) {
 		printk(KERN_WARNING "Asus ACPI: Error reading user input\n");
 	}
 
@@ -756,17 +774,17 @@
  * simultaneously, so be warned. See the acpi4asus README for more info.
  */
 static int
-proc_write_disp(struct file *file, const char *buffer,
+proc_write_disp(struct file *file, const char __user *buffer,
 	       unsigned long count, void *data)
 {
 	int value;
 	struct asus_hotk *hotk = (struct asus_hotk *) data;
 
-	if (sscanf(buffer, "%d", &value) == 1)
+	count = parse_arg(buffer, count, &value);
+	if (count > 0)
 		set_display(value, hotk);
-	else {
+	else if (count < 0)
 		printk(KERN_WARNING "Asus ACPI: Error reading user input\n");
-	}
 
 	return count;
 }
@@ -774,7 +792,7 @@
 
 typedef int (proc_readfunc)(char *page, char **start, off_t off, int count,
 	                     int *eof, void *data);
-typedef int (proc_writefunc)(struct file *file, const char *buffer,
+typedef int (proc_writefunc)(struct file *file, const char __user *buffer,
 	                      unsigned long count, void *data);
 
 static int
diff -Nru a/drivers/block/cpqarray.c b/drivers/block/cpqarray.c
--- a/drivers/block/cpqarray.c	2004-06-02 23:26:58 -07:00
+++ b/drivers/block/cpqarray.c	2004-06-02 23:26:58 -07:00
@@ -418,7 +418,8 @@
 	}
 	hba[i]->access.set_intr_mask(hba[i], 0);
 	if (request_irq(hba[i]->intr, do_ida_intr,
-		SA_INTERRUPT|SA_SHIRQ, hba[i]->devname, hba[i]))
+		SA_INTERRUPT|SA_SHIRQ|SA_SAMPLE_RANDOM,
+		hba[i]->devname, hba[i]))
 	{
 		printk(KERN_ERR "cpqarray: Unable to get irq %d for %s\n",
 				hba[i]->intr, hba[i]->devname);
diff -Nru a/drivers/bluetooth/hci_usb.c b/drivers/bluetooth/hci_usb.c
--- a/drivers/bluetooth/hci_usb.c	2004-06-02 23:27:00 -07:00
+++ b/drivers/bluetooth/hci_usb.c	2004-06-02 23:27:00 -07:00
@@ -29,9 +29,7 @@
  *    Copyright (c) 2000 Greg Kroah-Hartman        <greg@kroah.com>
  *    Copyright (c) 2000 Mark Douglas Corner       <mcorner@umich.edu>
  *
- * $Id: hci_usb.c,v 1.8 2002/07/18 17:23:09 maxk Exp $    
  */
-#define VERSION "2.5"
 
 #include <linux/config.h>
 #include <linux/module.h>
@@ -57,9 +55,9 @@
 
 #ifndef CONFIG_BT_HCIUSB_DEBUG
 #undef  BT_DBG
-#define BT_DBG( A... )
+#define BT_DBG(D...)
 #undef  BT_DMP
-#define BT_DMP( A... )
+#define BT_DMP(D...)
 #endif
 
 #ifndef CONFIG_BT_HCIUSB_ZERO_PACKET
@@ -67,6 +65,8 @@
 #define URB_ZERO_PACKET 0
 #endif
 
+#define VERSION "2.6"
+
 static struct usb_driver hci_usb_driver; 
 
 static struct usb_device_id bluetooth_ids[] = {
@@ -100,7 +100,10 @@
 	/* Digianswer device */
 	{ USB_DEVICE(0x08fd, 0x0001), .driver_info = HCI_DIGIANSWER },
 
-	{ }     /* Terminating entry */
+	/* RTX Telecom based adapter with buggy SCO support */
+	{ USB_DEVICE(0x0400, 0x0807), .driver_info = HCI_BROKEN_ISOC },
+
+	{ }	/* Terminating entry */
 };
 
 struct _urb *_urb_alloc(int isoc, int gfp)
@@ -393,7 +396,7 @@
 {
 	struct hci_usb *husb = (struct hci_usb *) hdev->driver_data;
 	unsigned long flags;
-	
+
 	if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags))
 		return 0;
 
@@ -402,7 +405,7 @@
 	/* Synchronize with completion handlers */
 	write_lock_irqsave(&husb->completion_lock, flags);
 	write_unlock_irqrestore(&husb->completion_lock, flags);
-	
+
 	hci_usb_unlink_urbs(husb);
 	hci_usb_flush(hdev);
 	return 0;
@@ -414,7 +417,7 @@
 	int err;
 
 	BT_DBG("%s urb %p type %d", husb->hdev->name, urb, _urb->type);
-	
+
 	_urb_queue_tail(__pending_q(husb, _urb->type), _urb);
 	err = usb_submit_urb(urb, GFP_ATOMIC);
 	if (err) {
@@ -551,7 +554,7 @@
 				skb_queue_head(q, skb);
 		}
 #endif
-		
+
 		/* Process ACL queue */
 		q = __transmit_q(husb, HCI_ACLDATA_PKT);
 		while (atomic_read(__pending_tx(husb, HCI_ACLDATA_PKT)) < HCI_MAX_BULK_TX &&
@@ -656,7 +659,7 @@
 				if (count >= HCI_SCO_HDR_SIZE) {
 					struct hci_sco_hdr *h = data;
 					len = HCI_SCO_HDR_SIZE + h->dlen;
-				} else 
+				} else
 					return -EILSEQ;
 				break;
 #endif
@@ -702,7 +705,7 @@
 	struct _urb *_urb = container_of(urb, struct _urb, urb);
 	struct hci_usb *husb = (void *) urb->context;
 	struct hci_dev *hdev = husb->hdev;
-	int    err, count = urb->actual_length;
+	int err, count = urb->actual_length;
 
 	BT_DBG("%s urb %p type %d status %d count %d flags %x", hdev->name, urb,
 			_urb->type, urb->status, count, urb->transfer_flags);
@@ -743,7 +746,7 @@
 
 resubmit:
 	urb->dev = husb->udev;
-	err      = usb_submit_urb(urb, GFP_ATOMIC);
+	err = usb_submit_urb(urb, GFP_ATOMIC);
 	BT_DBG("%s urb %p type %d resubmit status %d", hdev->name, urb,
 			_urb->type, err);
 
@@ -779,7 +782,7 @@
 	_urb_queue_tail(__completed_q(husb, _urb->type), _urb);
 
 	hci_usb_tx_wakeup(husb);
-	
+
 	read_unlock(&husb->completion_lock);
 }
 
@@ -819,9 +822,8 @@
 
 	if (intf->cur_altsetting->desc.bInterfaceNumber > 0)
 		return -ENODEV;
-	
-	/* Find endpoints that we need */
 
+	/* Find endpoints that we need */
 	uif = intf->cur_altsetting;
 	for (e = 0; e < uif->desc.bNumEndpoints; e++) {
 		ep = &uif->endpoint[e];
@@ -862,16 +864,17 @@
 		husb->ctrl_req = HCI_DIGI_REQ;
 	else
 		husb->ctrl_req = HCI_CTRL_REQ;
-	
-	/* Find isochronous endpoints that we can use */
 
+	/* Find isochronous endpoints that we can use */
 	size = 0; 
 	isoc_iface = NULL;
 	isoc_alts  = 0;
 	isoc_ifnum = 1;
 
 #ifdef CONFIG_BT_HCIUSB_SCO
-	isoc_iface = usb_ifnum_to_if(udev, isoc_ifnum);
+	if (!(id->driver_info & HCI_BROKEN_ISOC))
+		isoc_iface = usb_ifnum_to_if(udev, isoc_ifnum);
+
 	if (isoc_iface) {
 		int a;
 		struct usb_host_endpoint *isoc_out_ep = NULL;
@@ -917,10 +920,10 @@
 		}
 	}
 #endif
-	
+
 	husb->completion_lock = RW_LOCK_UNLOCKED;
 
-	for (i = 0; i < 4; i++) {	
+	for (i = 0; i < 4; i++) {
 		skb_queue_head_init(&husb->transmit_q[i]);
 		_urb_queue_init(&husb->pending_q[i]);
 		_urb_queue_init(&husb->completed_q[i]);
@@ -939,10 +942,10 @@
 	hdev->driver_data = husb;
 	SET_HCIDEV_DEV(hdev, &intf->dev);
 
-	hdev->open  = hci_usb_open;
-	hdev->close = hci_usb_close;
-	hdev->flush = hci_usb_flush;
-	hdev->send  = hci_usb_send_frame;
+	hdev->open     = hci_usb_open;
+	hdev->close    = hci_usb_close;
+	hdev->flush    = hci_usb_flush;
+	hdev->send     = hci_usb_send_frame;
 	hdev->destruct = hci_usb_destruct;
 
 	hdev->owner = THIS_MODULE;
@@ -993,11 +996,11 @@
 }
 
 static struct usb_driver hci_usb_driver = {
-	.owner      =  THIS_MODULE,
-	.name       =  "hci_usb",
-	.probe      =  hci_usb_probe,
-	.disconnect =  hci_usb_disconnect,
-	.id_table   =  bluetooth_ids,
+	.owner		= THIS_MODULE,
+	.name		= "hci_usb",
+	.probe		= hci_usb_probe,
+	.disconnect	= hci_usb_disconnect,
+	.id_table	= bluetooth_ids,
 };
 
 static int __init hci_usb_init(void)
diff -Nru a/drivers/bluetooth/hci_usb.h b/drivers/bluetooth/hci_usb.h
--- a/drivers/bluetooth/hci_usb.h	2004-06-02 23:27:00 -07:00
+++ b/drivers/bluetooth/hci_usb.h	2004-06-02 23:27:00 -07:00
@@ -23,33 +23,28 @@
    SOFTWARE IS DISCLAIMED.
 */
 
-/*
- * $Id: hci_usb.h,v 1.2 2002/03/18 19:10:04 maxk Exp $
- */
-
-#ifdef __KERNEL__
-
 /* Class, SubClass, and Protocol codes that describe a Bluetooth device */
-#define HCI_DEV_CLASS        0xe0	/* Wireless class */
-#define HCI_DEV_SUBCLASS     0x01	/* RF subclass */
-#define HCI_DEV_PROTOCOL     0x01	/* Bluetooth programming protocol */
-
-#define HCI_CTRL_REQ	     0x20
-#define HCI_DIGI_REQ	     0x40
+#define HCI_DEV_CLASS		0xe0	/* Wireless class */
+#define HCI_DEV_SUBCLASS	0x01	/* RF subclass */
+#define HCI_DEV_PROTOCOL	0x01	/* Bluetooth programming protocol */
+
+#define HCI_CTRL_REQ		0x20
+#define HCI_DIGI_REQ		0x40
+
+#define HCI_IGNORE		0x01
+#define HCI_RESET		0x02
+#define HCI_DIGIANSWER		0x04
+#define HCI_BROKEN_ISOC		0x08
 
-#define HCI_IGNORE           0x01
-#define HCI_RESET            0x02
-#define HCI_DIGIANSWER       0x04
+#define HCI_MAX_IFACE_NUM	3
 
-#define HCI_MAX_IFACE_NUM	3 
-
-#define HCI_MAX_BULK_TX     	4
-#define HCI_MAX_BULK_RX     	1
+#define HCI_MAX_BULK_TX		4
+#define HCI_MAX_BULK_RX		1
 
 #define HCI_MAX_ISOC_RX		2
 #define HCI_MAX_ISOC_TX		2
 
-#define HCI_MAX_ISOC_FRAMES     10
+#define HCI_MAX_ISOC_FRAMES	10
 
 struct _urb_queue {
 	struct list_head head;
@@ -79,16 +74,16 @@
 
 static inline void _urb_queue_head(struct _urb_queue *q, struct _urb *_urb)
 {
-        unsigned long flags;
-        spin_lock_irqsave(&q->lock, flags);
+	unsigned long flags;
+	spin_lock_irqsave(&q->lock, flags);
 	list_add(&_urb->list, &q->head); _urb->queue = q;
 	spin_unlock_irqrestore(&q->lock, flags);
 }
 
 static inline void _urb_queue_tail(struct _urb_queue *q, struct _urb *_urb)
 {
-        unsigned long flags;
-        spin_lock_irqsave(&q->lock, flags);
+	unsigned long flags;
+	spin_lock_irqsave(&q->lock, flags);
 	list_add_tail(&_urb->list, &q->head); _urb->queue = q;
 	spin_unlock_irqrestore(&q->lock, flags);
 }
@@ -96,9 +91,9 @@
 static inline void _urb_unlink(struct _urb *_urb)
 {
 	struct _urb_queue *q = _urb->queue;
-        unsigned long flags;
+	unsigned long flags;
 	if (q) {
-        	spin_lock_irqsave(&q->lock, flags);
+		spin_lock_irqsave(&q->lock, flags);
 		list_del(&_urb->list); _urb->queue = NULL;
 		spin_unlock_irqrestore(&q->lock, flags);
 	}
@@ -106,41 +101,33 @@
 
 struct _urb *_urb_dequeue(struct _urb_queue *q);
 
-#ifndef container_of
-#define container_of(ptr, type, member) ({                      \
-		        const typeof( ((type *)0)->member ) *__mptr = (ptr);    \
-			        (type *)( (char *)__mptr - offsetof(type,member) );})
-#endif
-
 struct hci_usb {
 	struct hci_dev		*hdev;
 
 	unsigned long		state;
 	
-	struct usb_device 	*udev;
+	struct usb_device	*udev;
 	
 	struct usb_host_endpoint	*bulk_in_ep;
 	struct usb_host_endpoint	*bulk_out_ep;
 	struct usb_host_endpoint	*intr_in_ep;
 
-	struct usb_interface            *isoc_iface;
+	struct usb_interface		*isoc_iface;
 	struct usb_host_endpoint	*isoc_out_ep;
 	struct usb_host_endpoint	*isoc_in_ep;
 
 	__u8			ctrl_req;
 
 	struct sk_buff_head	transmit_q[4];
-	struct sk_buff		*reassembly[4]; // Reassembly buffers
+	struct sk_buff		*reassembly[4];		/* Reassembly buffers */
 
 	rwlock_t		completion_lock;
 
-	atomic_t		pending_tx[4];  // Number of pending requests 
-	struct _urb_queue	pending_q[4];   // Pending requests
-	struct _urb_queue	completed_q[4]; // Completed requests
+	atomic_t		pending_tx[4];		/* Number of pending requests */
+	struct _urb_queue	pending_q[4];		/* Pending requests */
+	struct _urb_queue	completed_q[4];		/* Completed requests */
 };
 
 /* States  */
 #define HCI_USB_TX_PROCESS	1
 #define HCI_USB_TX_WAKEUP	2
-
-#endif /* __KERNEL__ */
diff -Nru a/drivers/char/agp/amd-k7-agp.c b/drivers/char/agp/amd-k7-agp.c
--- a/drivers/char/agp/amd-k7-agp.c	2004-06-02 23:27:00 -07:00
+++ b/drivers/char/agp/amd-k7-agp.c	2004-06-02 23:27:00 -07:00
@@ -20,6 +20,8 @@
 #define AMD_TLBFLUSH	0x0c	/* In mmio region (32-bit register) */
 #define AMD_CACHEENTRY	0x10	/* In mmio region (32-bit register) */
 
+static struct pci_device_id agp_amdk7_pci_table[];
+
 struct amd_page_map {
 	unsigned long *real;
 	unsigned long *remapped;
@@ -41,7 +43,7 @@
 
 	SetPageReserved(virt_to_page(page_map->real));
 	global_cache_flush();
-	page_map->remapped = ioremap_nocache(virt_to_phys(page_map->real), 
+	page_map->remapped = ioremap_nocache(virt_to_phys(page_map->real),
 					    PAGE_SIZE);
 	if (page_map->remapped == NULL) {
 		ClearPageReserved(virt_to_page(page_map->real));
@@ -90,7 +92,7 @@
 	int retval = 0;
 	int i;
 
-	tables = kmalloc((nr_tables + 1) * sizeof(struct amd_page_map *), 
+	tables = kmalloc((nr_tables + 1) * sizeof(struct amd_page_map *),
 			 GFP_KERNEL);
 	if (tables == NULL)
 		return -ENOMEM;
@@ -124,7 +126,7 @@
 #define GET_PAGE_DIR_OFF(addr) (addr >> 22)
 #define GET_PAGE_DIR_IDX(addr) (GET_PAGE_DIR_OFF(addr) - \
 	GET_PAGE_DIR_OFF(agp_bridge->gart_bus_addr))
-#define GET_GATT_OFF(addr) ((addr & 0x003ff000) >> 12) 
+#define GET_GATT_OFF(addr) ((addr & 0x003ff000) >> 12)
 #define GET_GATT(addr) (amd_irongate_private.gatt_pages[\
 	GET_PAGE_DIR_IDX(addr)]->remapped)
 
@@ -174,7 +176,7 @@
 static int amd_free_gatt_table(void)
 {
 	struct amd_page_map page_dir;
-   
+
 	page_dir.real = (unsigned long *)agp_bridge->gatt_table_real;
 	page_dir.remapped = (unsigned long *)agp_bridge->gatt_table;
 
@@ -224,9 +226,9 @@
 
 	/* Write the Sync register */
 	pci_write_config_byte(agp_bridge->dev, AMD_MODECNTL, 0x80);
-   
-   	/* Set indexing mode */
-   	pci_write_config_byte(agp_bridge->dev, AMD_MODECNTL2, 0x00);
+
+	/* Set indexing mode */
+	pci_write_config_byte(agp_bridge->dev, AMD_MODECNTL2, 0x00);
 
 	/* Write the enable register */
 	enable_reg = INREG16(amd_irongate_private.registers, AMD_GARTENABLE);
@@ -394,7 +396,6 @@
 static int __devinit agp_amdk7_probe(struct pci_dev *pdev,
 				     const struct pci_device_id *ent)
 {
-	struct agp_device_ids *devs = amd_agp_device_ids;
 	struct agp_bridge_data *bridge;
 	u8 cap_ptr;
 	int j;
@@ -403,19 +404,10 @@
 	if (!cap_ptr)
 		return -ENODEV;
 
-	for (j = 0; devs[j].chipset_name; j++) {
-		if (pdev->device == devs[j].device_id) {
-			printk (KERN_INFO PFX "Detected AMD %s chipset\n",
-					devs[j].chipset_name);
-			goto found;
-		}
-	}
-
-	printk(KERN_ERR PFX "Unsupported AMD chipset (device id: %04x)\n",
-		    pdev->device);
-	return -ENODEV;
+	j = ent - agp_amdk7_pci_table;
+	printk(KERN_INFO PFX "Detected AMD %s chipset\n",
+	       amd_agp_device_ids[j].chipset_name);
 
-found:
 	bridge = agp_alloc_bridge();
 	if (!bridge)
 		return -ENOMEM;
@@ -442,12 +434,29 @@
 	agp_put_bridge(bridge);
 }
 
+/* must be the same order as name table above */
 static struct pci_device_id agp_amdk7_pci_table[] = {
 	{
 	.class		= (PCI_CLASS_BRIDGE_HOST << 8),
 	.class_mask	= ~0,
 	.vendor		= PCI_VENDOR_ID_AMD,
-	.device		= PCI_ANY_ID,
+	.device		= PCI_DEVICE_ID_AMD_FE_GATE_7006,
+	.subvendor	= PCI_ANY_ID,
+	.subdevice	= PCI_ANY_ID,
+	},
+	{
+	.class		= (PCI_CLASS_BRIDGE_HOST << 8),
+	.class_mask	= ~0,
+	.vendor		= PCI_VENDOR_ID_AMD,
+	.device		= PCI_DEVICE_ID_AMD_FE_GATE_700E,
+	.subvendor	= PCI_ANY_ID,
+	.subdevice	= PCI_ANY_ID,
+	},
+	{
+	.class		= (PCI_CLASS_BRIDGE_HOST << 8),
+	.class_mask	= ~0,
+	.vendor		= PCI_VENDOR_ID_AMD,
+	.device		= PCI_DEVICE_ID_AMD_FE_GATE_700C,
 	.subvendor	= PCI_ANY_ID,
 	.subdevice	= PCI_ANY_ID,
 	},
diff -Nru a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c
--- a/drivers/char/agp/amd64-agp.c	2004-06-02 23:26:59 -07:00
+++ b/drivers/char/agp/amd64-agp.c	2004-06-02 23:26:59 -07:00
@@ -1,7 +1,7 @@
-/* 
+/*
  * Copyright 2001-2003 SuSE Labs.
  * Distributed under the GNU public license, v2.
- * 
+ *
  * This is a GART driver for the AMD Opteron/Athlon64 on-CPU northbridge.
  * It also includes support for the AMD 8151 AGP bridge,
  * although it doesn't actually do much, as all the real
@@ -194,7 +194,7 @@
 
 	/* keep CPU's coherent. */
 	flush_amd64_tlb (hammer);
-	
+
 	return aper_base;
 }
 
@@ -261,53 +261,53 @@
 
 /* Some basic sanity checks for the aperture. */
 static int __devinit aperture_valid(u64 aper, u32 size)
-{ 
+{
 	u32 pfn, c;
-	if (aper == 0) { 
+	if (aper == 0) {
 		printk(KERN_ERR PFX "No aperture\n");
-		return 0; 
+		return 0;
 	}
 	if (size < 32*1024*1024) {
 		printk(KERN_ERR PFX "Aperture too small (%d MB)\n", size>>20);
 		return 0;
 	}
-	if (aper + size > 0xffffffff) { 
-		printk(KERN_ERR PFX "Aperture out of bounds\n"); 
+	if (aper + size > 0xffffffff) {
+		printk(KERN_ERR PFX "Aperture out of bounds\n");
 		return 0;
-	} 
+	}
 	pfn = aper >> PAGE_SHIFT;
-	for (c = 0; c < size/PAGE_SIZE; c++) { 
+	for (c = 0; c < size/PAGE_SIZE; c++) {
 		if (!pfn_valid(pfn + c))
 			break;
-		if (!PageReserved(pfn_to_page(pfn + c))) { 
+		if (!PageReserved(pfn_to_page(pfn + c))) {
 			printk(KERN_ERR PFX "Aperture pointing to RAM\n");
 			return 0;
 		}
 	}
 
 	/* Request the Aperture. This catches cases when someone else
-	   already put a mapping in there - happens with some very broken BIOS 
+	   already put a mapping in there - happens with some very broken BIOS
 
-	   Maybe better to use pci_assign_resource/pci_enable_device instead trusting
-	   the bridges? */
+	   Maybe better to use pci_assign_resource/pci_enable_device instead
+	   trusting the bridges? */
 	if (!aperture_resource &&
 	    !(aperture_resource = request_mem_region(aper, size, "aperture"))) {
-		printk(KERN_ERR PFX "Aperture conflicts with PCI mapping.\n"); 
+		printk(KERN_ERR PFX "Aperture conflicts with PCI mapping.\n");
 		return 0;
 	}
 	return 1;
-} 
+}
 
-/* 
+/*
  * W*s centric BIOS sometimes only set up the aperture in the AGP
- * bridge, not the northbridge. On AMD64 this is handled early 
+ * bridge, not the northbridge. On AMD64 this is handled early
  * in aperture.c, but when GART_IOMMU is not enabled or we run
- * on a 32bit kernel this needs to be redone. 
+ * on a 32bit kernel this needs to be redone.
  * Unfortunately it is impossible to fix the aperture here because it's too late
  * to allocate that much memory. But at least error out cleanly instead of
  * crashing.
- */ 
-static __devinit int fix_northbridge(struct pci_dev *nb, struct pci_dev *agp, 
+ */
+static __devinit int fix_northbridge(struct pci_dev *nb, struct pci_dev *agp,
 								 u16 cap)
 {
 	u32 aper_low, aper_hi;
@@ -316,38 +316,38 @@
 	u32 nb_order, nb_base;
 	u16 apsize;
 
-	pci_read_config_dword(nb, 0x90, &nb_order); 
+	pci_read_config_dword(nb, 0x90, &nb_order);
 	nb_order = (nb_order >> 1) & 7;
-	pci_read_config_dword(nb, 0x94, &nb_base); 
-	nb_aper = nb_base << 25;	
-	if (aperture_valid(nb_aper, (32*1024*1024)<<nb_order)) { 
+	pci_read_config_dword(nb, 0x94, &nb_base);
+	nb_aper = nb_base << 25;
+	if (aperture_valid(nb_aper, (32*1024*1024)<<nb_order)) {
 		return 0;
 	}
 
 	/* Northbridge seems to contain crap. Try the AGP bridge. */
 
-	pci_read_config_word(agp, cap+0x14, &apsize); 
-	if (apsize == 0xffff) 
-		return -1; 
+	pci_read_config_word(agp, cap+0x14, &apsize);
+	if (apsize == 0xffff)
+		return -1;
 
 	apsize &= 0xfff;
 	/* Some BIOS use weird encodings not in the AGPv3 table. */
-	if (apsize & 0xff) 
-		apsize |= 0xf00; 
-	order = 7 - hweight16(apsize); 
+	if (apsize & 0xff)
+		apsize |= 0xf00;
+	order = 7 - hweight16(apsize);
 
 	pci_read_config_dword(agp, 0x10, &aper_low);
 	pci_read_config_dword(agp, 0x14, &aper_hi);
-	aper = (aper_low & ~((1<<22)-1)) | ((u64)aper_hi << 32); 
+	aper = (aper_low & ~((1<<22)-1)) | ((u64)aper_hi << 32);
 	printk(KERN_INFO PFX "Aperture from AGP @ %Lx size %u MB\n", aper, 32 << order);
 	if (order < 0 || !aperture_valid(aper, (32*1024*1024)<<order))
-		return -1; 
-	
-	pci_write_config_dword(nb, 0x90, order << 1); 
-	pci_write_config_dword(nb, 0x94, aper >> 25); 
+		return -1;
+
+	pci_write_config_dword(nb, 0x90, order << 1);
+	pci_write_config_dword(nb, 0x94, aper >> 25);
 
 	return 0;
-} 
+}
 
 static __devinit int cache_nbs (struct pci_dev *pdev, u32 cap_ptr)
 {
@@ -355,19 +355,19 @@
 	int i = 0;
 
 	/* cache pci_devs of northbridges. */
-	while ((loop_dev = pci_find_device(PCI_VENDOR_ID_AMD, 0x1103, loop_dev)) 
+	while ((loop_dev = pci_find_device(PCI_VENDOR_ID_AMD, 0x1103, loop_dev))
 			!= NULL) {
-		if (i == MAX_HAMMER_GARTS) { 
+		if (i == MAX_HAMMER_GARTS) {
 			printk(KERN_ERR PFX "Too many northbridges for AGP\n");
 			return -1;
 		}
-		if (fix_northbridge(loop_dev, pdev, cap_ptr) < 0) { 
+		if (fix_northbridge(loop_dev, pdev, cap_ptr) < 0) {
 			printk(KERN_ERR PFX "No usable aperture found.\n");
-#ifdef __x86_64__ 
+#ifdef __x86_64__
 			/* should port this to i386 */
 			printk(KERN_ERR PFX "Consider rebooting with iommu=memaper=2 to get a good aperture.\n");
-#endif 
-			return -1;  
+#endif
+			return -1;
 		}
 		hammers[i++] = loop_dev;
 	}
@@ -377,8 +377,7 @@
 
 /* Handle AMD 8151 quirks */
 static void __devinit amd8151_init(struct pci_dev *pdev, struct agp_bridge_data *bridge)
-
-{		
+{
 	char *revstring;
 	u8 rev_id;
 
@@ -417,12 +416,12 @@
 
 /* Handle shadow device of the Nvidia NForce3 */
 /* CHECK-ME original 2.4 version set up some IORRs. Check if that is needed. */
-static int __devinit nforce3_agp_init(struct pci_dev *pdev) 
-{ 
+static int __devinit nforce3_agp_init(struct pci_dev *pdev)
+{
 	u32 tmp, apbase, apbar, aplimit;
-	struct pci_dev *dev1; 
+	struct pci_dev *dev1;
 	int i;
-	unsigned size = amd64_fetch_size(); 
+	unsigned size = amd64_fetch_size();
 
 	printk(KERN_INFO PFX "Setting up Nforce3 AGP.\n");
 
@@ -432,17 +431,17 @@
 			"nForce3 chipset, but could not find "
 			"the secondary device.\n");
 		return -ENODEV;
-	}	
+	}
 
-	for (i = 0; i < ARRAY_SIZE(nforce3_sizes); i++) 
+	for (i = 0; i < ARRAY_SIZE(nforce3_sizes); i++)
 		if (nforce3_sizes[i].size == size)
-			break; 
+			break;
 
 	if (i == ARRAY_SIZE(nforce3_sizes)) {
-		printk(KERN_INFO PFX "No NForce3 size found for %d\n", size); 
-		return -ENODEV; 
+		printk(KERN_INFO PFX "No NForce3 size found for %d\n", size);
+		return -ENODEV;
 	}
-	
+
 	pci_read_config_dword(dev1, NVIDIA_X86_64_1_APSIZE, &tmp);
 	tmp &= ~(0xf);
 	tmp |= nforce3_sizes[i].size_value;
@@ -491,8 +490,7 @@
 	    pdev->device == PCI_DEVICE_ID_AMD_8151_0) {
 		amd8151_init(pdev, bridge);
 	} else {
-		printk(KERN_INFO PFX "Detected AGP bridge %x\n",
-			pdev->devfn);
+		printk(KERN_INFO PFX "Detected AGP bridge %x\n", pdev->devfn);
 	}
 
 	bridge->driver = &amd_8151_driver;
@@ -507,10 +505,10 @@
 		return -ENODEV;
 	}
 
-	if (pdev->vendor == PCI_VENDOR_ID_NVIDIA) { 
+	if (pdev->vendor == PCI_VENDOR_ID_NVIDIA) {
 		int ret = nforce3_agp_init(pdev);
-		if (ret) { 
-			agp_put_bridge(bridge); 
+		if (ret) {
+			agp_put_bridge(bridge);
 			return ret;
 		}
 	}
@@ -523,8 +521,8 @@
 {
 	struct agp_bridge_data *bridge = pci_get_drvdata(pdev);
 
-	release_mem_region(virt_to_phys(bridge->gatt_table_real), 
-			   amd64_aperture_sizes[bridge->aperture_size_idx].size); 
+	release_mem_region(virt_to_phys(bridge->gatt_table_real),
+			   amd64_aperture_sizes[bridge->aperture_size_idx].size);
 	agp_remove_bridge(bridge);
 	agp_put_bridge(bridge);
 }
@@ -581,6 +579,15 @@
 	.subvendor	= PCI_ANY_ID,
 	.subdevice	= PCI_ANY_ID,
 	},
+	/* SIS 755 */
+	{
+	.class		= (PCI_CLASS_BRIDGE_HOST << 8),
+	.class_mask	= ~0,
+	.vendor		= PCI_VENDOR_ID_SI,
+	.device		= PCI_DEVICE_ID_SI_755,
+	.subvendor	= PCI_ANY_ID,
+	.subdevice	= PCI_ANY_ID,
+	},
 	{ }
 };
 
@@ -600,15 +607,15 @@
 	int err = 0;
 	if (agp_off)
 		return -EINVAL;
-	if (pci_module_init(&agp_amd64_pci_driver) > 0) { 
+	if (pci_module_init(&agp_amd64_pci_driver) > 0) {
 		struct pci_dev *dev;
-		if (!agp_try_unsupported && !agp_try_unsupported_boot) { 
+		if (!agp_try_unsupported && !agp_try_unsupported_boot) {
 			printk(KERN_INFO PFX "No supported AGP bridge found.\n");
-#ifdef MODULE			
+#ifdef MODULE
 			printk(KERN_INFO PFX "You can try agp_try_unsupported=1\n");
 #else
 			printk(KERN_INFO PFX "You can boot with agp=try_unsupported\n");
-#endif			
+#endif
 			return -ENODEV;
 		}
 
@@ -622,12 +629,12 @@
 		while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev))) {
 			if (!pci_find_capability(dev, PCI_CAP_ID_AGP))
 				continue;
-			/* Only one bridge supported right now */	
+			/* Only one bridge supported right now */
 			if (agp_amd64_probe(dev, NULL) == 0) {
 				err = 0;
 				break;
-			}	
-		}		
+			}
+		}
 	}
 	return err;
 }
diff -Nru a/drivers/char/agp/ati-agp.c b/drivers/char/agp/ati-agp.c
--- a/drivers/char/agp/ati-agp.c	2004-06-02 23:27:00 -07:00
+++ b/drivers/char/agp/ati-agp.c	2004-06-02 23:27:00 -07:00
@@ -131,6 +131,7 @@
 				i--;
 			}
 			kfree (tables);
+			tables = NULL;
 			retval = -ENOMEM;
 			break;
 		}
diff -Nru a/drivers/char/agp/backend.c b/drivers/char/agp/backend.c
--- a/drivers/char/agp/backend.c	2004-06-02 23:27:00 -07:00
+++ b/drivers/char/agp/backend.c	2004-06-02 23:27:00 -07:00
@@ -238,11 +238,14 @@
 }
 EXPORT_SYMBOL(agp_put_bridge);
 
- 
+
 int agp_add_bridge(struct agp_bridge_data *bridge)
 {
 	int error;
 
+	if (agp_off)
+		return -ENODEV;
+
 	if (!bridge->dev) {
 		printk (KERN_DEBUG PFX "Erk, registering with no pci_dev!\n");
 		return -EINVAL;
@@ -308,9 +311,9 @@
 
 static int __init agp_init(void)
 {
-	if (!agp_off) 
-	printk(KERN_INFO "Linux agpgart interface v%d.%d (c) Dave Jones\n",
-	       AGPGART_VERSION_MAJOR, AGPGART_VERSION_MINOR);
+	if (!agp_off)
+		printk(KERN_INFO "Linux agpgart interface v%d.%d (c) Dave Jones\n",
+			AGPGART_VERSION_MAJOR, AGPGART_VERSION_MINOR);
 	return 0;
 }
 
@@ -325,7 +328,7 @@
 		agp_off = 1;
 	if (!strcmp(s,"try_unsupported"))
 		agp_try_unsupported_boot = 1;
-	return 1;	
+	return 1;
 }
 __setup("agp=", agp_setup);
 #endif
diff -Nru a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c
--- a/drivers/char/agp/intel-agp.c	2004-06-02 23:26:59 -07:00
+++ b/drivers/char/agp/intel-agp.c	2004-06-02 23:26:59 -07:00
@@ -1233,7 +1233,7 @@
 				name);
 		return 0;
 	}
-	
+
 	intel_i810_private.i810_dev = i810_dev;
 	return 1;
 }
@@ -1382,8 +1382,10 @@
 		name = "E7205";
 		break;
 	default:
-		printk(KERN_ERR PFX "Unsupported Intel chipset (device id: %04x)\n",
+		if (cap_ptr)
+			printk(KERN_WARNING PFX "Unsupported Intel chipset (device id: %04x)\n",
 			    pdev->device);
+		agp_put_bridge(bridge);
 		return -ENODEV;
 	};
 
@@ -1406,7 +1408,8 @@
 	if (!r->start && r->end) {
 		if(pci_assign_resource(pdev, 0)) {
 			printk(KERN_ERR PFX "could not assign resource 0\n");
-			return (-ENODEV);
+			agp_put_bridge(bridge);
+			return -ENODEV;
 		}
 	}
 
@@ -1417,7 +1420,8 @@
 	*/
 	if (pci_enable_device(pdev)) {
 		printk(KERN_ERR PFX "Unable to Enable PCI device\n");
-		return (-ENODEV);
+		agp_put_bridge(bridge);
+		return -ENODEV;
 	}
 
 	/* Fill in the mode register */
@@ -1442,14 +1446,11 @@
 	agp_put_bridge(bridge);
 }
 
-static int agp_intel_suspend(struct pci_dev *dev, u32 state)
-{
-	return 0;
-}
-
 static int agp_intel_resume(struct pci_dev *pdev)
 {
 	struct agp_bridge_data *bridge = pci_get_drvdata(pdev);
+	
+	pci_restore_state(pdev, pdev->saved_config_space);
 
 	if (bridge->driver == &intel_generic_driver)
 		intel_configure();
@@ -1462,14 +1463,36 @@
 }
 
 static struct pci_device_id agp_intel_pci_table[] = {
-	{
-	.class		= (PCI_CLASS_BRIDGE_HOST << 8),
-	.class_mask	= ~0,
-	.vendor		= PCI_VENDOR_ID_INTEL,
-	.device		= PCI_ANY_ID,
-	.subvendor	= PCI_ANY_ID,
-	.subdevice	= PCI_ANY_ID,
-	},
+#define ID(x)						\
+	{ 						\
+	.class		= (PCI_CLASS_BRIDGE_HOST << 8),	\
+	.class_mask	= ~0,				\
+	.vendor		= PCI_VENDOR_ID_INTEL,		\
+	.device		= x,				\
+	.subvendor	= PCI_ANY_ID,			\
+	.subdevice	= PCI_ANY_ID,			\
+	}
+	ID(PCI_DEVICE_ID_INTEL_82443LX_0),
+	ID(PCI_DEVICE_ID_INTEL_82443BX_0),
+	ID(PCI_DEVICE_ID_INTEL_82443GX_0),
+	ID(PCI_DEVICE_ID_INTEL_82810_MC1),
+	ID(PCI_DEVICE_ID_INTEL_82810_MC3),
+	ID(PCI_DEVICE_ID_INTEL_82810E_MC),
+	ID(PCI_DEVICE_ID_INTEL_82815_MC),
+	ID(PCI_DEVICE_ID_INTEL_82820_HB),
+	ID(PCI_DEVICE_ID_INTEL_82820_UP_HB),
+	ID(PCI_DEVICE_ID_INTEL_82830_HB),
+	ID(PCI_DEVICE_ID_INTEL_82840_HB),
+	ID(PCI_DEVICE_ID_INTEL_82845_HB),
+	ID(PCI_DEVICE_ID_INTEL_82845G_HB),
+	ID(PCI_DEVICE_ID_INTEL_82850_HB),
+	ID(PCI_DEVICE_ID_INTEL_82855PM_HB),
+	ID(PCI_DEVICE_ID_INTEL_82855GM_HB),
+	ID(PCI_DEVICE_ID_INTEL_82860_HB),
+	ID(PCI_DEVICE_ID_INTEL_82865_HB),
+	ID(PCI_DEVICE_ID_INTEL_82875_HB),
+	ID(PCI_DEVICE_ID_INTEL_7505_0),
+	ID(PCI_DEVICE_ID_INTEL_7205_0),	
 	{ }
 };
 
@@ -1480,7 +1503,6 @@
 	.id_table	= agp_intel_pci_table,
 	.probe		= agp_intel_probe,
 	.remove		= agp_intel_remove,
-	.suspend	= agp_intel_suspend,
 	.resume		= agp_intel_resume,
 };
 
diff -Nru a/drivers/char/agp/intel-mch-agp.c b/drivers/char/agp/intel-mch-agp.c
--- a/drivers/char/agp/intel-mch-agp.c	2004-06-02 23:26:58 -07:00
+++ b/drivers/char/agp/intel-mch-agp.c	2004-06-02 23:26:58 -07:00
@@ -491,10 +491,9 @@
 	char *name = "(unknown)";
 	u8 cap_ptr = 0;
 
-	if (!boot_cpu_has(X86_FEATURE_LM))
-		return -ENODEV;
-
 	cap_ptr = pci_find_capability(pdev, PCI_CAP_ID_AGP);
+	if (!cap_ptr) 
+		return -ENODEV;
 
 	bridge = agp_alloc_bridge();
 	if (!bridge)
@@ -570,14 +569,11 @@
 	agp_put_bridge(bridge);
 }
 
-static int agp_intelmch_suspend(struct pci_dev *dev, u32 state)
-{
-	return 0;
-}
-
 static int agp_intelmch_resume(struct pci_dev *pdev)
 {
 	struct agp_bridge_data *bridge = pci_get_drvdata(pdev);
+	
+	pci_restore_state(pdev, pdev->saved_config_space);
 
 	if (bridge->driver == &intel_845_driver)
 		intel_845_configure();
@@ -590,7 +586,15 @@
 	.class		= (PCI_CLASS_BRIDGE_HOST << 8),
 	.class_mask	= ~0,
 	.vendor		= PCI_VENDOR_ID_INTEL,
-	.device		= PCI_ANY_ID,
+	.device		= PCI_DEVICE_ID_INTEL_82865_HB,
+	.subvendor	= PCI_ANY_ID,
+	.subdevice	= PCI_ANY_ID,
+	},
+	{
+	.class		= (PCI_CLASS_BRIDGE_HOST << 8),
+	.class_mask	= ~0,
+	.vendor		= PCI_VENDOR_ID_INTEL,
+	.device		= PCI_DEVICE_ID_INTEL_82875_HB,
 	.subvendor	= PCI_ANY_ID,
 	.subdevice	= PCI_ANY_ID,
 	},
@@ -604,7 +608,6 @@
 	.id_table	= agp_intelmch_pci_table,
 	.probe		= agp_intelmch_probe,
 	.remove		= agp_intelmch_remove,
-	.suspend	= agp_intelmch_suspend,
 	.resume		= agp_intelmch_resume,
 };
 
diff -Nru a/drivers/char/agp/nvidia-agp.c b/drivers/char/agp/nvidia-agp.c
--- a/drivers/char/agp/nvidia-agp.c	2004-06-02 23:26:58 -07:00
+++ b/drivers/char/agp/nvidia-agp.c	2004-06-02 23:26:58 -07:00
@@ -380,7 +380,15 @@
 	.class		= (PCI_CLASS_BRIDGE_HOST << 8),
 	.class_mask	= ~0,
 	.vendor		= PCI_VENDOR_ID_NVIDIA,
-	.device		= PCI_ANY_ID,
+	.device		= PCI_DEVICE_ID_NVIDIA_NFORCE,
+	.subvendor	= PCI_ANY_ID,
+	.subdevice	= PCI_ANY_ID,
+	},
+	{
+	.class		= (PCI_CLASS_BRIDGE_HOST << 8),
+	.class_mask	= ~0,
+	.vendor		= PCI_VENDOR_ID_NVIDIA,
+	.device		= PCI_DEVICE_ID_NVIDIA_NFORCE2,
 	.subvendor	= PCI_ANY_ID,
 	.subdevice	= PCI_ANY_ID,
 	},
diff -Nru a/drivers/char/agp/sis-agp.c b/drivers/char/agp/sis-agp.c
--- a/drivers/char/agp/sis-agp.c	2004-06-02 23:26:58 -07:00
+++ b/drivers/char/agp/sis-agp.c	2004-06-02 23:26:58 -07:00
@@ -13,6 +13,8 @@
 #define SIS_TLBCNTRL	0x97
 #define SIS_TLBFLUSH	0x98
 
+static int __devinitdata agp_sis_force_delay = 0;
+static int __devinitdata agp_sis_agp_spec = -1;
 
 static int sis_fetch_size(void)
 {
@@ -67,7 +69,7 @@
 			      (previous_size->size_value & ~(0x03)));
 }
 
-static void sis_648_enable(u32 mode)
+static void sis_delayed_enable(u32 mode)
 {
 	struct pci_dev *device = NULL;
 	u32 command;
@@ -94,13 +96,12 @@
 		pci_write_config_dword(device, agp + PCI_AGP_COMMAND, command);
 
 		/*
-		 * Weird: on 648(fx) and 746(fx) chipsets any rate change in the target
+		 * Weird: on some sis chipsets any rate change in the target
 		 * command register triggers a 5ms screwup during which the master
 		 * cannot be configured		 
 		 */
-		if (device->device == PCI_DEVICE_ID_SI_648 ||
-		    device->device == PCI_DEVICE_ID_SI_746) {
-			printk(KERN_INFO PFX "SiS chipset with AGP problems detected. Giving bridge time to recover.\n");
+		if (device->device == agp_bridge->dev->device) {
+			printk(KERN_INFO PFX "SiS delay workaround: giving bridge time to recover.\n");
 			set_current_state(TASK_UNINTERRUPTIBLE);
 			schedule_timeout (1+(HZ*10)/1000);
 		}
@@ -223,28 +224,35 @@
 };
 
 
+// chipsets that require the 'delay hack'
+static int sis_broken_chipsets[] __devinitdata = {
+	PCI_DEVICE_ID_SI_648,
+	PCI_DEVICE_ID_SI_746,
+	0 // terminator
+};
+
 static void __devinit sis_get_driver(struct agp_bridge_data *bridge)
 {
-	if (bridge->dev->device == PCI_DEVICE_ID_SI_648) { 
-		sis_driver.agp_enable=sis_648_enable;
-		if (agp_bridge->major_version == 3) {
-			sis_driver.aperture_sizes = agp3_generic_sizes;
-			sis_driver.size_type = U16_APER_SIZE;
-			sis_driver.num_aperture_sizes = AGP_GENERIC_SIZES_ENTRIES;
-			sis_driver.configure = agp3_generic_configure;
-			sis_driver.fetch_size = agp3_generic_fetch_size;
-			sis_driver.cleanup = agp3_generic_cleanup;
-			sis_driver.tlb_flush = agp3_generic_tlbflush;
-		}
-	}
+	int i;
 
-	if (bridge->dev->device == PCI_DEVICE_ID_SI_746) {
-		/*
-		 * We don't know enough about the 746 to enable it properly.
-		 * Though we do know that it needs the 'delay' hack to settle
-		 * after changing modes.
-		 */
-		sis_driver.agp_enable=sis_648_enable;
+	for(i=0; sis_broken_chipsets[i]!=0; ++i)
+		if(bridge->dev->device==sis_broken_chipsets[i])
+			break;
+
+	if(sis_broken_chipsets[i] || agp_sis_force_delay)
+		sis_driver.agp_enable=sis_delayed_enable;
+
+	// sis chipsets that indicate less than agp3.5
+	// are not actually fully agp3 compliant
+	if ((agp_bridge->major_version == 3 && agp_bridge->minor_version >= 5
+	     && agp_sis_agp_spec!=0) || agp_sis_agp_spec==1) {
+		sis_driver.aperture_sizes = agp3_generic_sizes;
+		sis_driver.size_type = U16_APER_SIZE;
+		sis_driver.num_aperture_sizes = AGP_GENERIC_SIZES_ENTRIES;
+		sis_driver.configure = agp3_generic_configure;
+		sis_driver.fetch_size = agp3_generic_fetch_size;
+		sis_driver.cleanup = agp3_generic_cleanup;
+		sis_driver.tlb_flush = agp3_generic_tlbflush;
 	}
 }
 
@@ -335,4 +343,8 @@
 module_init(agp_sis_init);
 module_exit(agp_sis_cleanup);
 
+MODULE_PARM(agp_sis_force_delay,"i");
+MODULE_PARM_DESC(agp_sis_force_delay,"forces sis delay hack");
+MODULE_PARM(agp_sis_agp_spec,"i");
+MODULE_PARM_DESC(agp_sis_agp_spec,"0=force sis init, 1=force generic agp3 init, default: autodetect");
 MODULE_LICENSE("GPL and additional rights");
diff -Nru a/drivers/char/agp/sworks-agp.c b/drivers/char/agp/sworks-agp.c
--- a/drivers/char/agp/sworks-agp.c	2004-06-02 23:26:59 -07:00
+++ b/drivers/char/agp/sworks-agp.c	2004-06-02 23:26:59 -07:00
@@ -248,26 +248,13 @@
  */
 static void serverworks_tlbflush(struct agp_memory *temp)
 {
-	unsigned long end;
+	OUTREG8(serverworks_private.registers, SVWRKS_POSTFLUSH, 1);
+	while(INREG8(serverworks_private.registers, SVWRKS_POSTFLUSH) == 1)
+		cpu_relax();
 
-	OUTREG8(serverworks_private.registers, SVWRKS_POSTFLUSH, 0x01);
-	end = jiffies + 3*HZ;
-	while(INREG8(serverworks_private.registers, 
-		     SVWRKS_POSTFLUSH) == 0x01) {
-		if((signed)(end - jiffies) <= 0) {
-			printk(KERN_ERR PFX "Posted write buffer flush took more"
-			       "then 3 seconds\n");
-		}
-	}
-	OUTREG32(serverworks_private.registers, SVWRKS_DIRFLUSH, 0x00000001);
-	end = jiffies + 3*HZ;
-	while(INREG32(serverworks_private.registers, 
-		     SVWRKS_DIRFLUSH) == 0x00000001) {
-		if((signed)(end - jiffies) <= 0) {
-			printk(KERN_ERR PFX "TLB flush took more"
-			       "then 3 seconds\n");
-		}
-	}
+	OUTREG32(serverworks_private.registers, SVWRKS_DIRFLUSH, 1);
+	while(INREG32(serverworks_private.registers, SVWRKS_DIRFLUSH) == 1)
+		cpu_relax();
 }
 
 static int serverworks_configure(void)
diff -Nru a/drivers/char/agp/via-agp.c b/drivers/char/agp/via-agp.c
--- a/drivers/char/agp/via-agp.c	2004-06-02 23:27:00 -07:00
+++ b/drivers/char/agp/via-agp.c	2004-06-02 23:27:00 -07:00
@@ -9,6 +9,8 @@
 #include <linux/agp_backend.h>
 #include "agp.h"
 
+static struct pci_device_id agp_via_pci_table[];
+
 #define VIA_GARTCTRL	0x80
 #define VIA_APSIZE	0x84
 #define VIA_ATTBASE	0x88
@@ -378,20 +380,9 @@
 	if (!cap_ptr)
 		return -ENODEV;
 
-	/* probe for known chipsets */
-	for (j = 0; devs[j].chipset_name; j++) {
-		if (pdev->device == devs[j].device_id) {
-			printk (KERN_INFO PFX "Detected VIA %s chipset\n",
-					devs[j].chipset_name);
-			goto found;
-		}
-	}
-
-	printk(KERN_ERR PFX "Unsupported VIA chipset (device id: %04x)\n",
-		    pdev->device);
-	return -ENODEV;
+	j = ent - agp_via_pci_table;
+	printk (KERN_INFO PFX "Detected VIA %s chipset\n", devs[j].chipset_name);
 
-found:
 	bridge = agp_alloc_bridge();
 	if (!bridge)
 		return -ENOMEM;
@@ -432,15 +423,40 @@
 	agp_put_bridge(bridge);
 }
 
+/* must be the same order as name table above */
 static struct pci_device_id agp_via_pci_table[] = {
-	{
-	.class		= (PCI_CLASS_BRIDGE_HOST << 8),
-	.class_mask	= ~0,
-	.vendor		= PCI_VENDOR_ID_VIA,
-	.device		= PCI_ANY_ID,
-	.subvendor	= PCI_ANY_ID,
-	.subdevice	= PCI_ANY_ID,
-	},
+#define ID(x) \
+	{						\
+	.class		= (PCI_CLASS_BRIDGE_HOST << 8),	\
+	.class_mask	= ~0,				\
+	.vendor		= PCI_VENDOR_ID_VIA,		\
+	.device		= x,				\
+	.subvendor	= PCI_ANY_ID,			\
+	.subdevice	= PCI_ANY_ID,			\
+	}
+	ID(PCI_DEVICE_ID_VIA_82C598_0),
+	ID(PCI_DEVICE_ID_VIA_8501_0),
+	ID(PCI_DEVICE_ID_VIA_8601_0),
+	ID(PCI_DEVICE_ID_VIA_82C691_0),
+	ID(PCI_DEVICE_ID_VIA_8371_0),
+	ID(PCI_DEVICE_ID_VIA_8633_0),
+	ID(PCI_DEVICE_ID_VIA_XN266),
+	ID(PCI_DEVICE_ID_VIA_8361),
+	ID(PCI_DEVICE_ID_VIA_8363_0),
+	ID(PCI_DEVICE_ID_VIA_8753_0),
+	ID(PCI_DEVICE_ID_VIA_8367_0),
+	ID(PCI_DEVICE_ID_VIA_8653_0),
+	ID(PCI_DEVICE_ID_VIA_XM266),
+	ID(PCI_DEVICE_ID_VIA_862X_0),
+	ID(PCI_DEVICE_ID_VIA_8377_0),
+	ID(PCI_DEVICE_ID_VIA_8605_0),
+	ID(PCI_DEVICE_ID_VIA_8703_51_0),
+	ID(PCI_DEVICE_ID_VIA_8754C_0),
+	ID(PCI_DEVICE_ID_VIA_8763_0),
+	ID(PCI_DEVICE_ID_VIA_8378_0),
+	ID(PCI_DEVICE_ID_VIA_PT880),
+	ID(PCI_DEVICE_ID_VIA_8783_0),
+	ID(PCI_DEVICE_ID_VIA_PX8X0_0),	
 	{ }
 };
 
diff -Nru a/drivers/char/consolemap.c b/drivers/char/consolemap.c
--- a/drivers/char/consolemap.c	2004-06-02 23:27:00 -07:00
+++ b/drivers/char/consolemap.c	2004-06-02 23:27:00 -07:00
@@ -257,12 +257,12 @@
  * 0xf000-0xf0ff "transparent" Unicodes) whereas the "new" variants set
  * Unicodes explicitly.
  */
-int con_set_trans_old(unsigned char * arg)
+int con_set_trans_old(unsigned char __user * arg)
 {
 	int i;
 	unsigned short *p = translations[USER_MAP];
 
-	i = verify_area(VERIFY_READ, (void *)arg, E_TABSZ);
+	i = verify_area(VERIFY_READ, arg, E_TABSZ);
 	if (i)
 		return i;
 
@@ -276,12 +276,12 @@
 	return 0;
 }
 
-int con_get_trans_old(unsigned char * arg)
+int con_get_trans_old(unsigned char __user * arg)
 {
 	int i, ch;
 	unsigned short *p = translations[USER_MAP];
 
-	i = verify_area(VERIFY_WRITE, (void *)arg, E_TABSZ);
+	i = verify_area(VERIFY_WRITE, arg, E_TABSZ);
 	if (i)
 		return i;
 
@@ -293,13 +293,12 @@
 	return 0;
 }
 
-int con_set_trans_new(ushort * arg)
+int con_set_trans_new(ushort __user * arg)
 {
 	int i;
 	unsigned short *p = translations[USER_MAP];
 
-	i = verify_area(VERIFY_READ, (void *)arg,
-			E_TABSZ*sizeof(unsigned short));
+	i = verify_area(VERIFY_READ, arg, E_TABSZ*sizeof(unsigned short));
 	if (i)
 		return i;
 
@@ -313,13 +312,12 @@
 	return 0;
 }
 
-int con_get_trans_new(ushort * arg)
+int con_get_trans_new(ushort __user * arg)
 {
 	int i;
 	unsigned short *p = translations[USER_MAP];
 
-	i = verify_area(VERIFY_WRITE, (void *)arg,
-			E_TABSZ*sizeof(unsigned short));
+	i = verify_area(VERIFY_WRITE, arg, E_TABSZ*sizeof(unsigned short));
 	if (i)
 		return i;
 
@@ -470,7 +468,7 @@
 }
 
 int
-con_set_unimap(int con, ushort ct, struct unipair *list)
+con_set_unimap(int con, ushort ct, struct unipair __user *list)
 {
 	int err = 0, err1, i;
 	struct uni_pagedir *p, *q;
@@ -598,7 +596,7 @@
 }
 
 int
-con_get_unimap(int con, ushort ct, ushort *uct, struct unipair *list)
+con_get_unimap(int con, ushort ct, ushort __user *uct, struct unipair __user *list)
 {
 	int i, j, k, ect;
 	u16 **p1, *p2;
diff -Nru a/drivers/char/n_tty.c b/drivers/char/n_tty.c
--- a/drivers/char/n_tty.c	2004-06-02 23:26:58 -07:00
+++ b/drivers/char/n_tty.c	2004-06-02 23:26:58 -07:00
@@ -249,7 +249,7 @@
  * things.
  */
 static ssize_t opost_block(struct tty_struct * tty,
-		       const unsigned char * inbuf, unsigned int nr)
+		       const unsigned char __user * inbuf, unsigned int nr)
 {
 	char	buf[80];
 	int	space;
@@ -946,7 +946,7 @@
  * the buffer to head pointer.
  */
 static inline int copy_from_read_buf(struct tty_struct *tty,
-				      unsigned char **b,
+				      unsigned char __user **b,
 				      size_t *nr)
 
 {
@@ -976,9 +976,9 @@
 extern ssize_t redirected_tty_write(struct file *,const char *,size_t,loff_t *);
 
 static ssize_t read_chan(struct tty_struct *tty, struct file *file,
-			 unsigned char *buf, size_t nr)
+			 unsigned char __user *buf, size_t nr)
 {
-	unsigned char *b = buf;
+	unsigned char __user *b = buf;
 	DECLARE_WAITQUEUE(wait, current);
 	int c;
 	int minimum, time;
@@ -1183,9 +1183,9 @@
 }
 
 static ssize_t write_chan(struct tty_struct * tty, struct file * file,
-			  const unsigned char * buf, size_t nr)
+			  const unsigned char __user * buf, size_t nr)
 {
-	const unsigned char *b = buf;
+	const unsigned char __user *b = buf;
 	DECLARE_WAITQUEUE(wait, current);
 	int c;
 	ssize_t retval = 0;
diff -Nru a/drivers/char/selection.c b/drivers/char/selection.c
--- a/drivers/char/selection.c	2004-06-02 23:27:00 -07:00
+++ b/drivers/char/selection.c	2004-06-02 23:27:00 -07:00
@@ -3,10 +3,10 @@
  *
  * This module exports the functions:
  *
- *     'int set_selection(const unsigned long arg)'
+ *     'int set_selection(struct tiocl_selection __user *, struct tty_struct *)'
  *     'void clear_selection(void)'
- *     'int paste_selection(struct tty_struct *tty)'
- *     'int sel_loadlut(const unsigned long arg)'
+ *     'int paste_selection(struct tty_struct *)'
+ *     'int sel_loadlut(char __user *)'
  *
  * Now that /dev/vcs exists, most of this can disappear again.
  */
@@ -95,9 +95,9 @@
 }
 
 /* set inwordLut contents. Invoked by ioctl(). */
-int sel_loadlut(const unsigned long arg)
+int sel_loadlut(char __user *p)
 {
-	return copy_from_user(inwordLut, (u32 *)(arg+4), 32) ? -EFAULT : 0;
+	return copy_from_user(inwordLut, (u32 __user *)(p+4), 32) ? -EFAULT : 0;
 }
 
 /* does screen address p correspond to character at LH/RH edge of screen? */
@@ -113,7 +113,7 @@
 }
 
 /* set the current selection. Invoked by ioctl() or by kernel code. */
-int set_selection(const struct tiocl_selection *sel, struct tty_struct *tty, int user)
+int set_selection(const struct tiocl_selection __user *sel, struct tty_struct *tty)
 {
 	int sel_mode, new_sel_start, new_sel_end, spc;
 	char *bp, *obp;
@@ -124,21 +124,13 @@
 
 	{ unsigned short xs, ys, xe, ye;
 
-	  if (user) {
-		  if (verify_area(VERIFY_READ, sel, sizeof(*sel)))
-		  	return -EFAULT;
-		  __get_user(xs, &sel->xs);
-		  __get_user(ys, &sel->ys);
-		  __get_user(xe, &sel->xe);
-		  __get_user(ye, &sel->ye);
-		  __get_user(sel_mode, &sel->sel_mode);
-	  } else {
-		  xs = sel->xs; /* set selection from kernel */
-		  ys = sel->ys;
-		  xe = sel->xe;
-		  ye = sel->ye;
-		  sel_mode = sel->sel_mode;
-	  }
+	  if (verify_area(VERIFY_READ, sel, sizeof(*sel)))
+		return -EFAULT;
+	  __get_user(xs, &sel->xs);
+	  __get_user(ys, &sel->ys);
+	  __get_user(xe, &sel->xe);
+	  __get_user(ye, &sel->ye);
+	  __get_user(sel_mode, &sel->sel_mode);
 	  xs--; ys--; xe--; ye--;
 	  xs = limit(xs, video_num_columns - 1);
 	  ys = limit(ys, video_num_lines - 1);
diff -Nru a/drivers/char/tty_io.c b/drivers/char/tty_io.c
--- a/drivers/char/tty_io.c	2004-06-02 23:26:59 -07:00
+++ b/drivers/char/tty_io.c	2004-06-02 23:26:59 -07:00
@@ -134,9 +134,9 @@
 
 static void initialize_tty_struct(struct tty_struct *tty);
 
-static ssize_t tty_read(struct file *, char *, size_t, loff_t *);
-static ssize_t tty_write(struct file *, const char *, size_t, loff_t *);
-ssize_t redirected_tty_write(struct file *, const char *, size_t, loff_t *);
+static ssize_t tty_read(struct file *, char __user *, size_t, loff_t *);
+static ssize_t tty_write(struct file *, const char __user *, size_t, loff_t *);
+ssize_t redirected_tty_write(struct file *, const char __user *, size_t, loff_t *);
 static unsigned int tty_poll(struct file *, poll_table *);
 static int tty_open(struct inode *, struct file *);
 static int tty_release(struct inode *, struct file *);
@@ -339,7 +339,7 @@
 
 EXPORT_SYMBOL(tty_check_change);
 
-static ssize_t hung_up_tty_read(struct file * file, char * buf,
+static ssize_t hung_up_tty_read(struct file * file, char __user * buf,
 				size_t count, loff_t *ppos)
 {
 	/* Can't seek (pread) on ttys.  */
@@ -348,7 +348,7 @@
 	return 0;
 }
 
-static ssize_t hung_up_tty_write(struct file * file, const char * buf,
+static ssize_t hung_up_tty_write(struct file * file, const char __user * buf,
 				 size_t count, loff_t *ppos)
 {
 	/* Can't seek (pwrite) on ttys.  */
@@ -638,7 +638,7 @@
 
 EXPORT_SYMBOL(start_tty);
 
-static ssize_t tty_read(struct file * file, char * buf, size_t count, 
+static ssize_t tty_read(struct file * file, char __user * buf, size_t count, 
 			loff_t *ppos)
 {
 	int i;
@@ -672,10 +672,10 @@
  * denial-of-service type attacks
  */
 static inline ssize_t do_tty_write(
-	ssize_t (*write)(struct tty_struct *, struct file *, const unsigned char *, size_t),
+	ssize_t (*write)(struct tty_struct *, struct file *, const unsigned char __user *, size_t),
 	struct tty_struct *tty,
 	struct file *file,
-	const unsigned char *buf,
+	const unsigned char __user *buf,
 	size_t count)
 {
 	ssize_t ret = 0, written = 0;
@@ -717,7 +717,7 @@
 }
 
 
-static ssize_t tty_write(struct file * file, const char * buf, size_t count,
+static ssize_t tty_write(struct file * file, const char __user * buf, size_t count,
 			 loff_t *ppos)
 {
 	struct tty_struct * tty;
@@ -735,10 +735,10 @@
 	if (!tty->ldisc.write)
 		return -EIO;
 	return do_tty_write(tty->ldisc.write, tty, file,
-			    (const unsigned char *)buf, count);
+			    (const unsigned char __user *)buf, count);
 }
 
-ssize_t redirected_tty_write(struct file * file, const char * buf, size_t count,
+ssize_t redirected_tty_write(struct file * file, const char __user * buf, size_t count,
 			 loff_t *ppos)
 {
 	struct file *p = NULL;
@@ -1490,19 +1490,19 @@
 	return 0;
 }
 
-static int tiocsti(struct tty_struct *tty, char * arg)
+static int tiocsti(struct tty_struct *tty, char __user *p)
 {
 	char ch, mbz = 0;
 
 	if ((current->signal->tty != tty) && !capable(CAP_SYS_ADMIN))
 		return -EPERM;
-	if (get_user(ch, arg))
+	if (get_user(ch, p))
 		return -EFAULT;
 	tty->ldisc.receive_buf(tty, &ch, &mbz, 1);
 	return 0;
 }
 
-static int tiocgwinsz(struct tty_struct *tty, struct winsize * arg)
+static int tiocgwinsz(struct tty_struct *tty, struct winsize __user * arg)
 {
 	if (copy_to_user(arg, &tty->winsize, sizeof(*arg)))
 		return -EFAULT;
@@ -1510,7 +1510,7 @@
 }
 
 static int tiocswinsz(struct tty_struct *tty, struct tty_struct *real_tty,
-	struct winsize * arg)
+	struct winsize __user * arg)
 {
 	struct winsize tmp_ws;
 
@@ -1565,11 +1565,11 @@
 }
 
 
-static int fionbio(struct file *file, int *arg)
+static int fionbio(struct file *file, int __user *p)
 {
 	int nonblock;
 
-	if (get_user(nonblock, arg))
+	if (get_user(nonblock, p))
 		return -EFAULT;
 
 	if (nonblock)
@@ -1620,7 +1620,7 @@
 	return 0;
 }
 
-static int tiocgpgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t *arg)
+static int tiocgpgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t __user *p)
 {
 	/*
 	 * (tty == real_tty) is a cheap way of
@@ -1628,10 +1628,10 @@
 	 */
 	if (tty == real_tty && current->signal->tty != real_tty)
 		return -ENOTTY;
-	return put_user(real_tty->pgrp, arg);
+	return put_user(real_tty->pgrp, p);
 }
 
-static int tiocspgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t *arg)
+static int tiocspgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t __user *p)
 {
 	pid_t pgrp;
 	int retval = tty_check_change(real_tty);
@@ -1644,7 +1644,7 @@
 	    (current->signal->tty != real_tty) ||
 	    (real_tty->session != current->signal->session))
 		return -ENOTTY;
-	if (get_user(pgrp, (pid_t *) arg))
+	if (get_user(pgrp, p))
 		return -EFAULT;
 	if (pgrp < 0)
 		return -EINVAL;
@@ -1654,7 +1654,7 @@
 	return 0;
 }
 
-static int tiocgsid(struct tty_struct *tty, struct tty_struct *real_tty, pid_t *arg)
+static int tiocgsid(struct tty_struct *tty, struct tty_struct *real_tty, pid_t __user *p)
 {
 	/*
 	 * (tty == real_tty) is a cheap way of
@@ -1664,14 +1664,14 @@
 		return -ENOTTY;
 	if (real_tty->session <= 0)
 		return -ENOTTY;
-	return put_user(real_tty->session, arg);
+	return put_user(real_tty->session, p);
 }
 
-static int tiocsetd(struct tty_struct *tty, int *arg)
+static int tiocsetd(struct tty_struct *tty, int __user *p)
 {
 	int ldisc;
 
-	if (get_user(ldisc, arg))
+	if (get_user(ldisc, p))
 		return -EFAULT;
 	return tty_set_ldisc(tty, ldisc);
 }
@@ -1690,7 +1690,7 @@
 }
 
 static int
-tty_tiocmget(struct tty_struct *tty, struct file *file, unsigned long arg)
+tty_tiocmget(struct tty_struct *tty, struct file *file, int __user *p)
 {
 	int retval = -EINVAL;
 
@@ -1698,21 +1698,21 @@
 		retval = tty->driver->tiocmget(tty, file);
 
 		if (retval >= 0)
-			retval = put_user(retval, (int *)arg);
+			retval = put_user(retval, p);
 	}
 	return retval;
 }
 
 static int
 tty_tiocmset(struct tty_struct *tty, struct file *file, unsigned int cmd,
-	     unsigned long arg)
+	     unsigned __user *p)
 {
 	int retval = -EINVAL;
 
 	if (tty->driver->tiocmset) {
 		unsigned int set, clear, val;
 
-		retval = get_user(val, (unsigned int *)arg);
+		retval = get_user(val, p);
 		if (retval)
 			return retval;
 
@@ -1745,6 +1745,7 @@
 	      unsigned int cmd, unsigned long arg)
 {
 	struct tty_struct *tty, *real_tty;
+	void __user *p = (void __user *)arg;
 	int retval;
 	
 	tty = (struct tty_struct *)file->private_data;
@@ -1802,15 +1803,15 @@
 
 	switch (cmd) {
 		case TIOCSTI:
-			return tiocsti(tty, (char *)arg);
+			return tiocsti(tty, p);
 		case TIOCGWINSZ:
-			return tiocgwinsz(tty, (struct winsize *) arg);
+			return tiocgwinsz(tty, p);
 		case TIOCSWINSZ:
-			return tiocswinsz(tty, real_tty, (struct winsize *) arg);
+			return tiocswinsz(tty, real_tty, p);
 		case TIOCCONS:
 			return real_tty!=tty ? -EINVAL : tioccons(file);
 		case FIONBIO:
-			return fionbio(file, (int *) arg);
+			return fionbio(file, p);
 		case TIOCEXCL:
 			set_bit(TTY_EXCLUSIVE, &tty->flags);
 			return 0;
@@ -1829,15 +1830,15 @@
 		case TIOCSCTTY:
 			return tiocsctty(tty, arg);
 		case TIOCGPGRP:
-			return tiocgpgrp(tty, real_tty, (pid_t *) arg);
+			return tiocgpgrp(tty, real_tty, p);
 		case TIOCSPGRP:
-			return tiocspgrp(tty, real_tty, (pid_t *) arg);
+			return tiocspgrp(tty, real_tty, p);
 		case TIOCGSID:
-			return tiocgsid(tty, real_tty, (pid_t *) arg);
+			return tiocgsid(tty, real_tty, p);
 		case TIOCGETD:
-			return put_user(tty->ldisc.num, (int *) arg);
+			return put_user(tty->ldisc.num, (int __user *)p);
 		case TIOCSETD:
-			return tiocsetd(tty, (int *) arg);
+			return tiocsetd(tty, p);
 #ifdef CONFIG_VT
 		case TIOCLINUX:
 			return tioclinux(tty, arg);
@@ -1865,12 +1866,12 @@
 			return send_break(tty, arg ? arg*(HZ/10) : HZ/4);
 
 		case TIOCMGET:
-			return tty_tiocmget(tty, file, arg);
+			return tty_tiocmget(tty, file, p);
 
 		case TIOCMSET:
 		case TIOCMBIC:
 		case TIOCMBIS:
-			return tty_tiocmset(tty, file, cmd, arg);
+			return tty_tiocmset(tty, file, cmd, p);
 	}
 	if (tty->driver->ioctl) {
 		int retval = (tty->driver->ioctl)(tty, file, cmd, arg);
diff -Nru a/drivers/char/tty_ioctl.c b/drivers/char/tty_ioctl.c
--- a/drivers/char/tty_ioctl.c	2004-06-02 23:27:00 -07:00
+++ b/drivers/char/tty_ioctl.c	2004-06-02 23:27:00 -07:00
@@ -140,7 +140,7 @@
 		(*tty->ldisc.set_termios)(tty, &old_termios);
 }
 
-static int set_termios(struct tty_struct * tty, unsigned long arg, int opt)
+static int set_termios(struct tty_struct * tty, void __user *arg, int opt)
 {
 	struct termios tmp_termios;
 	int retval = tty_check_change(tty);
@@ -151,11 +151,11 @@
 	if (opt & TERMIOS_TERMIO) {
 		memcpy(&tmp_termios, tty->termios, sizeof(struct termios));
 		if (user_termio_to_kernel_termios(&tmp_termios,
-						  (struct termio *) arg))
+						(struct termio __user *)arg))
 			return -EFAULT;
 	} else {
 		if (user_termios_to_kernel_termios(&tmp_termios,
-						   (struct termios *) arg))
+						(struct termios __user *)arg))
 			return -EFAULT;
 	}
 
@@ -172,7 +172,7 @@
 	return 0;
 }
 
-static int get_termio(struct tty_struct * tty, struct termio * termio)
+static int get_termio(struct tty_struct * tty, struct termio __user * termio)
 {
 	if (kernel_termios_to_user_termio(termio, tty->termios))
 		return -EFAULT;
@@ -222,7 +222,7 @@
 	return flags;
 }
 
-static int get_sgttyb(struct tty_struct * tty, struct sgttyb * sgttyb)
+static int get_sgttyb(struct tty_struct * tty, struct sgttyb __user * sgttyb)
 {
 	struct sgttyb tmp;
 
@@ -260,7 +260,7 @@
 	}
 }
 
-static int set_sgttyb(struct tty_struct * tty, struct sgttyb * sgttyb)
+static int set_sgttyb(struct tty_struct * tty, struct sgttyb __user * sgttyb)
 {
 	int retval;
 	struct sgttyb tmp;
@@ -281,7 +281,7 @@
 #endif
 
 #ifdef TIOCGETC
-static int get_tchars(struct tty_struct * tty, struct tchars * tchars)
+static int get_tchars(struct tty_struct * tty, struct tchars __user * tchars)
 {
 	struct tchars tmp;
 
@@ -294,7 +294,7 @@
 	return copy_to_user(tchars, &tmp, sizeof(tmp)) ? -EFAULT : 0;
 }
 
-static int set_tchars(struct tty_struct * tty, struct tchars * tchars)
+static int set_tchars(struct tty_struct * tty, struct tchars __user * tchars)
 {
 	struct tchars tmp;
 
@@ -311,7 +311,7 @@
 #endif
 
 #ifdef TIOCGLTC
-static int get_ltchars(struct tty_struct * tty, struct ltchars * ltchars)
+static int get_ltchars(struct tty_struct * tty, struct ltchars __user * ltchars)
 {
 	struct ltchars tmp;
 
@@ -324,7 +324,7 @@
 	return copy_to_user(ltchars, &tmp, sizeof(tmp)) ? -EFAULT : 0;
 }
 
-static int set_ltchars(struct tty_struct * tty, struct ltchars * ltchars)
+static int set_ltchars(struct tty_struct * tty, struct ltchars __user * ltchars)
 {
 	struct ltchars tmp;
 
@@ -363,6 +363,7 @@
 		       unsigned int cmd, unsigned long arg)
 {
 	struct tty_struct * real_tty;
+	void __user *p = (void __user *)arg;
 	int retval;
 
 	if (tty->driver->type == TTY_DRIVER_TYPE_PTY &&
@@ -374,41 +375,41 @@
 	switch (cmd) {
 #ifdef TIOCGETP
 		case TIOCGETP:
-			return get_sgttyb(real_tty, (struct sgttyb *) arg);
+			return get_sgttyb(real_tty, (struct sgttyb __user *) arg);
 		case TIOCSETP:
 		case TIOCSETN:
-			return set_sgttyb(real_tty, (struct sgttyb *) arg);
+			return set_sgttyb(real_tty, (struct sgttyb __user *) arg);
 #endif
 #ifdef TIOCGETC
 		case TIOCGETC:
-			return get_tchars(real_tty, (struct tchars *) arg);
+			return get_tchars(real_tty, p);
 		case TIOCSETC:
-			return set_tchars(real_tty, (struct tchars *) arg);
+			return set_tchars(real_tty, p);
 #endif
 #ifdef TIOCGLTC
 		case TIOCGLTC:
-			return get_ltchars(real_tty, (struct ltchars *) arg);
+			return get_ltchars(real_tty, p);
 		case TIOCSLTC:
-			return set_ltchars(real_tty, (struct ltchars *) arg);
+			return set_ltchars(real_tty, p);
 #endif
 		case TCGETS:
-			if (kernel_termios_to_user_termios((struct termios *)arg, real_tty->termios))
+			if (kernel_termios_to_user_termios((struct termios __user *)arg, real_tty->termios))
 				return -EFAULT;
 			return 0;
 		case TCSETSF:
-			return set_termios(real_tty, arg,  TERMIOS_FLUSH | TERMIOS_WAIT);
+			return set_termios(real_tty, p,  TERMIOS_FLUSH | TERMIOS_WAIT);
 		case TCSETSW:
-			return set_termios(real_tty, arg, TERMIOS_WAIT);
+			return set_termios(real_tty, p, TERMIOS_WAIT);
 		case TCSETS:
-			return set_termios(real_tty, arg, 0);
+			return set_termios(real_tty, p, 0);
 		case TCGETA:
-			return get_termio(real_tty,(struct termio *) arg);
+			return get_termio(real_tty, p);
 		case TCSETAF:
-			return set_termios(real_tty, arg, TERMIOS_FLUSH | TERMIOS_WAIT | TERMIOS_TERMIO);
+			return set_termios(real_tty, p, TERMIOS_FLUSH | TERMIOS_WAIT | TERMIOS_TERMIO);
 		case TCSETAW:
-			return set_termios(real_tty, arg, TERMIOS_WAIT | TERMIOS_TERMIO);
+			return set_termios(real_tty, p, TERMIOS_WAIT | TERMIOS_TERMIO);
 		case TCSETA:
-			return set_termios(real_tty, arg, TERMIOS_TERMIO);
+			return set_termios(real_tty, p, TERMIOS_TERMIO);
 		case TCXONC:
 			retval = tty_check_change(tty);
 			if (retval)
@@ -462,21 +463,21 @@
 		case TIOCOUTQ:
 			return put_user(tty->driver->chars_in_buffer ?
 					tty->driver->chars_in_buffer(tty) : 0,
-					(int *) arg);
+					(int __user *) arg);
 		case TIOCINQ:
 			retval = tty->read_cnt;
 			if (L_ICANON(tty))
 				retval = inq_canon(tty);
-			return put_user(retval, (unsigned int *) arg);
+			return put_user(retval, (unsigned int __user *) arg);
 		case TIOCGLCKTRMIOS:
-			if (kernel_termios_to_user_termios((struct termios *)arg, real_tty->termios_locked))
+			if (kernel_termios_to_user_termios((struct termios __user *)arg, real_tty->termios_locked))
 				return -EFAULT;
 			return 0;
 
 		case TIOCSLCKTRMIOS:
 			if (!capable(CAP_SYS_ADMIN))
 				return -EPERM;
-			if (user_termios_to_kernel_termios(real_tty->termios_locked, (struct termios *) arg))
+			if (user_termios_to_kernel_termios(real_tty->termios_locked, (struct termios __user *) arg))
 				return -EFAULT;
 			return 0;
 
@@ -487,7 +488,7 @@
 			if (tty->driver->type != TTY_DRIVER_TYPE_PTY ||
 			    tty->driver->subtype != PTY_TYPE_MASTER)
 				return -ENOTTY;
-			if (get_user(pktmode, (int *) arg))
+			if (get_user(pktmode, (int __user *) arg))
 				return -EFAULT;
 			if (pktmode) {
 				if (!tty->packet) {
@@ -499,9 +500,9 @@
 			return 0;
 		}
 		case TIOCGSOFTCAR:
-			return put_user(C_CLOCAL(tty) ? 1 : 0, (int *) arg);
+			return put_user(C_CLOCAL(tty) ? 1 : 0, (int __user *)arg);
 		case TIOCSSOFTCAR:
-			if (get_user(arg, (unsigned int *) arg))
+			if (get_user(arg, (unsigned int __user *) arg))
 				return -EFAULT;
 			tty->termios->c_cflag =
 				((tty->termios->c_cflag & ~CLOCAL) |
diff -Nru a/drivers/char/vt.c b/drivers/char/vt.c
--- a/drivers/char/vt.c	2004-06-02 23:27:00 -07:00
+++ b/drivers/char/vt.c	2004-06-02 23:27:00 -07:00
@@ -152,7 +152,7 @@
 static void save_cur(int currcons);
 static void reset_terminal(int currcons, int do_clear);
 static void con_flush_chars(struct tty_struct *tty);
-static void set_vesa_blanking(unsigned long arg);
+static void set_vesa_blanking(char __user *p);
 static void set_cursor(int currcons);
 static void hide_cursor(int currcons);
 static void console_callback(void *ignored);
@@ -2274,6 +2274,7 @@
 int tioclinux(struct tty_struct *tty, unsigned long arg)
 {
 	char type, data;
+	char __user *p = (char __user *)arg;
 	int lines;
 	int ret;
 
@@ -2281,14 +2282,14 @@
 		return -EINVAL;
 	if (current->signal->tty != tty && !capable(CAP_SYS_ADMIN))
 		return -EPERM;
-	if (get_user(type, (char *)arg))
+	if (get_user(type, p))
 		return -EFAULT;
 	ret = 0;
 	switch (type)
 	{
 		case TIOCL_SETSEL:
 			acquire_console_sem();
-			ret = set_selection((struct tiocl_selection *)((char *)arg+1), tty, 1);
+			ret = set_selection((struct tiocl_selection __user *)(p+1), tty);
 			release_console_sem();
 			break;
 		case TIOCL_PASTESEL:
@@ -2298,7 +2299,7 @@
 			unblank_screen();
 			break;
 		case TIOCL_SELLOADLUT:
-			ret = sel_loadlut(arg);
+			ret = sel_loadlut(p);
 			break;
 		case TIOCL_GETSHIFTSTATE:
 			
@@ -2309,20 +2310,20 @@
 	 * related to the kernel should not use this.
 	 */
 	 		data = shift_state;
-			ret = __put_user(data, (char *) arg);
+			ret = __put_user(data, p);
 			break;
 		case TIOCL_GETMOUSEREPORTING:
 			data = mouse_reporting();
-			ret = __put_user(data, (char *) arg);
+			ret = __put_user(data, p);
 			break;
 		case TIOCL_SETVESABLANK:
-			set_vesa_blanking(arg);
+			set_vesa_blanking(p);
 			break;
 		case TIOCL_SETKMSGREDIRECT:
 			if (!capable(CAP_SYS_ADMIN)) {
 				ret = -EPERM;
 			} else {
-				if (get_user(data, (char *)arg+1))
+				if (get_user(data, p+1))
 					ret = -EFAULT;
 				else
 					kmsg_redirect = data;
@@ -2332,7 +2333,7 @@
 			ret = fg_console;
 			break;
 		case TIOCL_SCROLLCONSOLE:
-			if (get_user(lines, (s32 *)((char *)arg+4))) {
+			if (get_user(lines, (s32 __user *)(p+4))) {
 				ret = -EFAULT;
 			} else {
 				scrollfront(lines);
@@ -2757,11 +2758,10 @@
  *	Screen blanking
  */
 
-static void set_vesa_blanking(unsigned long arg)
+static void set_vesa_blanking(char __user *p)
 {
-    char *argp = (char *)arg + 1;
     unsigned int mode;
-    get_user(mode, argp);
+    get_user(mode, p + 1);
     vesa_blank_mode = (mode < 4) ? mode : 0;
 }
 
@@ -2937,7 +2937,7 @@
 		sw->con_set_palette(vc_cons[currcons].d, color_table);
 }
 
-static int set_get_cmap(unsigned char *arg, int set)
+static int set_get_cmap(unsigned char __user *arg, int set)
 {
     int i, j, k;
 
@@ -2972,7 +2972,7 @@
  * map, 3 bytes per colour, 16 colours, range from 0 to 255.
  */
 
-int con_set_cmap(unsigned char *arg)
+int con_set_cmap(unsigned char __user *arg)
 {
 	int rc;
 
@@ -2983,7 +2983,7 @@
 	return rc;
 }
 
-int con_get_cmap(unsigned char *arg)
+int con_get_cmap(unsigned char __user *arg)
 {
 	int rc;
 
@@ -3037,7 +3037,8 @@
 			goto quit;
 		if (!op->height) {		/* Need to guess font height [compat] */
 			int h, i;
-			u8 *charmap = op->data, tmp;
+			u8 __user *charmap = op->data;
+			u8 tmp;
 			
 			/* If from KDFONTOP ioctl, don't allow things which can be done in userland,
 			   so that we can get rid of this soon */
diff -Nru a/drivers/char/vt_ioctl.c b/drivers/char/vt_ioctl.c
--- a/drivers/char/vt_ioctl.c	2004-06-02 23:27:00 -07:00
+++ b/drivers/char/vt_ioctl.c	2004-06-02 23:27:00 -07:00
@@ -75,7 +75,7 @@
 #define s (tmp.kb_table)
 #define v (tmp.kb_value)
 static inline int
-do_kdsk_ioctl(int cmd, struct kbentry *user_kbe, int perm, struct kbd_struct *kbd)
+do_kdsk_ioctl(int cmd, struct kbentry __user *user_kbe, int perm, struct kbd_struct *kbd)
 {
 	struct kbentry tmp;
 	ushort *key_map, val, ov;
@@ -160,7 +160,7 @@
 #undef v
 
 static inline int 
-do_kbkeycode_ioctl(int cmd, struct kbkeycode *user_kbkc, int perm)
+do_kbkeycode_ioctl(int cmd, struct kbkeycode __user *user_kbkc, int perm)
 {
 	struct kbkeycode tmp;
 	int kc = 0;
@@ -183,11 +183,12 @@
 }
 
 static inline int
-do_kdgkb_ioctl(int cmd, struct kbsentry *user_kdgkb, int perm)
+do_kdgkb_ioctl(int cmd, struct kbsentry __user *user_kdgkb, int perm)
 {
 	struct kbsentry *kbs;
 	char *p;
 	u_char *q;
+	u_char __user *up;
 	int sz;
 	int delta;
 	char *first_free, *fj, *fnw;
@@ -212,15 +213,15 @@
 	case KDGKBSENT:
 		sz = sizeof(kbs->kb_string) - 1; /* sz should have been
 						  a struct member */
-		q = user_kdgkb->kb_string;
+		up = user_kdgkb->kb_string;
 		p = func_table[i];
 		if(p)
 			for ( ; *p && sz; p++, sz--)
-				if (put_user(*p, q++)) {
+				if (put_user(*p, up++)) {
 					ret = -EFAULT;
 					goto reterr;
 				}
-		if (put_user('\0', q)) {
+		if (put_user('\0', up)) {
 			ret = -EFAULT;
 			goto reterr;
 		}
@@ -292,7 +293,7 @@
 }
 
 static inline int 
-do_fontx_ioctl(int cmd, struct consolefontdesc *user_cfd, int perm, struct console_font_op *op)
+do_fontx_ioctl(int cmd, struct consolefontdesc __user *user_cfd, int perm, struct console_font_op *op)
 {
 	struct consolefontdesc cfdarg;
 	int i;
@@ -332,7 +333,7 @@
 }
 
 static inline int 
-do_unimap_ioctl(int cmd, struct unimapdesc *user_ud, int perm, unsigned int console)
+do_unimap_ioctl(int cmd, struct unimapdesc __user *user_ud, int perm, unsigned int console)
 {
 	struct unimapdesc tmp;
 	int i = 0; 
@@ -370,6 +371,7 @@
 	struct kbd_struct * kbd;
 	unsigned int console;
 	unsigned char ucval;
+	void __user *up = (void __user *)arg;
 	int i, perm;
 	
 	console = vt->vc_num;
@@ -453,14 +455,12 @@
 		if (!capable(CAP_SYS_TTY_CONFIG))
 			return -EPERM;
 
-		if (copy_from_user(&kbrep, (void *)arg,
-				   sizeof(struct kbd_repeat)))
+		if (copy_from_user(&kbrep, up, sizeof(struct kbd_repeat)))
 			return -EFAULT;
 		err = kbd_rate(&kbrep);
 		if (err)
 			return err;
-		if (copy_to_user((void *)arg, &kbrep,
-				 sizeof(struct kbd_repeat)))
+		if (copy_to_user(up, &kbrep, sizeof(struct kbd_repeat)))
 			return -EFAULT;
 		return 0;
 	}
@@ -565,25 +565,25 @@
 	case KDGKBMETA:
 		ucval = (vc_kbd_mode(kbd, VC_META) ? K_ESCPREFIX : K_METABIT);
 	setint:
-		return put_user(ucval, (int *)arg); 
+		return put_user(ucval, (int __user *)arg); 
 
 	case KDGETKEYCODE:
 	case KDSETKEYCODE:
 		if(!capable(CAP_SYS_TTY_CONFIG))
 			perm=0;
-		return do_kbkeycode_ioctl(cmd, (struct kbkeycode *)arg, perm);
+		return do_kbkeycode_ioctl(cmd, up, perm);
 
 	case KDGKBENT:
 	case KDSKBENT:
-		return do_kdsk_ioctl(cmd, (struct kbentry *)arg, perm, kbd);
+		return do_kdsk_ioctl(cmd, up, perm, kbd);
 
 	case KDGKBSENT:
 	case KDSKBSENT:
-		return do_kdgkb_ioctl(cmd, (struct kbsentry *)arg, perm);
+		return do_kdgkb_ioctl(cmd, up, perm);
 
 	case KDGKBDIACR:
 	{
-		struct kbdiacrs *a = (struct kbdiacrs *)arg;
+		struct kbdiacrs __user *a = up;
 
 		if (put_user(accent_table_size, &a->kb_cnt))
 			return -EFAULT;
@@ -594,7 +594,7 @@
 
 	case KDSKBDIACR:
 	{
-		struct kbdiacrs *a = (struct kbdiacrs *)arg;
+		struct kbdiacrs __user *a = up;
 		unsigned int ct;
 
 		if (!perm)
@@ -630,7 +630,7 @@
 	case KDGETLED:
 		ucval = getledstate();
 	setchar:
-		return put_user(ucval, (char*)arg);
+		return put_user(ucval, (char __user *)arg);
 
 	case KDSETLED:
 		if (!perm)
@@ -663,7 +663,7 @@
 
 		if (!perm)
 			return -EPERM;
-		if (copy_from_user(&tmp, (void*)arg, sizeof(struct vt_mode)))
+		if (copy_from_user(&tmp, up, sizeof(struct vt_mode)))
 			return -EFAULT;
 		if (tmp.mode != VT_AUTO && tmp.mode != VT_PROCESS)
 			return -EINVAL;
@@ -687,7 +687,7 @@
 		memcpy(&tmp, &vt_cons[console]->vt_mode, sizeof(struct vt_mode));
 		release_console_sem();
 
-		rc = copy_to_user((void*)arg, &tmp, sizeof(struct vt_mode));
+		rc = copy_to_user(up, &tmp, sizeof(struct vt_mode));
 		return rc ? -EFAULT : 0;
 	}
 
@@ -698,7 +698,7 @@
 	 */
 	case VT_GETSTATE:
 	{
-		struct vt_stat *vtstat = (struct vt_stat *)arg;
+		struct vt_stat __user *vtstat = up;
 		unsigned short state, mask;
 
 		if (put_user(fg_console + 1, &vtstat->v_active))
@@ -844,7 +844,7 @@
 
 	case VT_RESIZE:
 	{
-		struct vt_sizes *vtsizes = (struct vt_sizes *) arg;
+		struct vt_sizes __user *vtsizes = up;
 		ushort ll,cc;
 		if (!perm)
 			return -EPERM;
@@ -861,11 +861,11 @@
 
 	case VT_RESIZEX:
 	{
-		struct vt_consize *vtconsize = (struct vt_consize *) arg;
+		struct vt_consize __user *vtconsize = up;
 		ushort ll,cc,vlin,clin,vcol,ccol;
 		if (!perm)
 			return -EPERM;
-		if (verify_area(VERIFY_READ, (void *)vtconsize,
+		if (verify_area(VERIFY_READ, vtconsize,
 				sizeof(struct vt_consize)))
 			return -EFAULT;
 		__get_user(ll, &vtconsize->v_rows);
@@ -932,14 +932,14 @@
 	case PIO_CMAP:
                 if (!perm)
 			return -EPERM;
-                return con_set_cmap((char *)arg);
+                return con_set_cmap(up);
 
 	case GIO_CMAP:
-                return con_get_cmap((char *)arg);
+                return con_get_cmap(up);
 
 	case PIO_FONTX:
 	case GIO_FONTX:
-		return do_fontx_ioctl(cmd, (struct consolefontdesc *)arg, perm, &op);
+		return do_fontx_ioctl(cmd, up, perm, &op);
 
 	case PIO_FONTRESET:
 	{
@@ -963,13 +963,13 @@
 	}
 
 	case KDFONTOP: {
-		if (copy_from_user(&op, (void *) arg, sizeof(op)))
+		if (copy_from_user(&op, up, sizeof(op)))
 			return -EFAULT;
 		if (!perm && op.op != KD_FONT_OP_GET)
 			return -EPERM;
 		i = con_font_op(console, &op);
 		if (i) return i;
-		if (copy_to_user((void *) arg, &op, sizeof(op)))
+		if (copy_to_user(up, &op, sizeof(op)))
 			return -EFAULT;
 		return 0;
 	}
@@ -977,24 +977,24 @@
 	case PIO_SCRNMAP:
 		if (!perm)
 			return -EPERM;
-		return con_set_trans_old((unsigned char *)arg);
+		return con_set_trans_old(up);
 
 	case GIO_SCRNMAP:
-		return con_get_trans_old((unsigned char *)arg);
+		return con_get_trans_old(up);
 
 	case PIO_UNISCRNMAP:
 		if (!perm)
 			return -EPERM;
-		return con_set_trans_new((unsigned short *)arg);
+		return con_set_trans_new(up);
 
 	case GIO_UNISCRNMAP:
-		return con_get_trans_new((unsigned short *)arg);
+		return con_get_trans_new(up);
 
 	case PIO_UNIMAPCLR:
 	      { struct unimapinit ui;
 		if (!perm)
 			return -EPERM;
-		i = copy_from_user(&ui, (void *)arg, sizeof(struct unimapinit));
+		i = copy_from_user(&ui, up, sizeof(struct unimapinit));
 		if (i) return -EFAULT;
 		con_clear_unimap(console, &ui);
 		return 0;
@@ -1002,7 +1002,7 @@
 
 	case PIO_UNIMAP:
 	case GIO_UNIMAP:
-		return do_unimap_ioctl(cmd, (struct unimapdesc *)arg, perm, console);
+		return do_unimap_ioctl(cmd, up, perm, console);
 
 	case VT_LOCKSWITCH:
 		if (!capable(CAP_SYS_TTY_CONFIG))
diff -Nru a/drivers/char/watchdog/scx200_wdt.c b/drivers/char/watchdog/scx200_wdt.c
--- a/drivers/char/watchdog/scx200_wdt.c	2004-06-02 23:26:59 -07:00
+++ b/drivers/char/watchdog/scx200_wdt.c	2004-06-02 23:26:59 -07:00
@@ -221,10 +221,16 @@
 
 	printk(KERN_DEBUG NAME ": NatSemi SCx200 Watchdog Driver\n");
 
-	/* First check that this really is a NatSemi SCx200 CPU */
+	/*
+	 * First check that this really is a NatSemi SCx200 CPU or a Geode
+	 * SC1100 processor
+	 */
 	if ((pci_find_device(PCI_VENDOR_ID_NS,
 			     PCI_DEVICE_ID_NS_SCx200_BRIDGE,
-			     NULL)) == NULL)
+			     NULL)) == NULL
+	    && (pci_find_device(PCI_VENDOR_ID_NS,
+				PCI_DEVICE_ID_NS_SC1100_BRIDGE,
+				NULL)) == NULL)
 		return -ENODEV;
 
 	/* More sanity checks, verify that the configuration block is there */
diff -Nru a/drivers/char/watchdog/w83627hf_wdt.c b/drivers/char/watchdog/w83627hf_wdt.c
--- a/drivers/char/watchdog/w83627hf_wdt.c	2004-06-02 23:26:59 -07:00
+++ b/drivers/char/watchdog/w83627hf_wdt.c	2004-06-02 23:26:59 -07:00
@@ -72,7 +72,7 @@
 #define WDT_EFDR (WDT_EFIR+1) /* Extended Function Data Register */
 
 static void
-wdt_ctrl(int timeout)
+w83627hf_select_wd_register(void)
 {
 	outb_p(0x87, WDT_EFER); /* Enter extended function mode */
 	outb_p(0x87, WDT_EFER); /* Again according to manual */
@@ -81,23 +81,64 @@
 	outb_p(0x08, WDT_EFDR); /* select logical device 8 (GPIO2) */
 	outb_p(0x30, WDT_EFER); /* select CR30 */
 	outb_p(0x01, WDT_EFDR); /* set bit 0 to activate GPIO2 */
+}
+
+static void
+w83627hf_unselect_wd_register(void)
+{
+	outb_p(0xAA, WDT_EFER); /* Leave extended function mode */
+}
+
+/* tyan motherboards seem to set F5 to 0x4C ?
+ * So explicitly init to appropriate value. */
+static void
+w83627hf_init(void)
+{
+	unsigned char t;
+
+	w83627hf_select_wd_register();
+
+	outb_p(0xF5, WDT_EFER); /* Select CRF5 */
+	t=inb_p(WDT_EFDR);      /* read CRF5 */
+	t&=~0x0C;               /* set second mode & disable keyboard turning off watchdog */
+	outb_p(t, WDT_EFDR);    /* Write back to CRF5 */
+
+	w83627hf_unselect_wd_register();
+}
+
+static void
+wdt_ctrl(int timeout)
+{
+	w83627hf_select_wd_register();
 
 	outb_p(0xF6, WDT_EFER);    /* Select CRF6 */
 	outb_p(timeout, WDT_EFDR); /* Write Timeout counter to CRF6 */
 
-	outb_p(0xAA, WDT_EFER); /* Leave extended function mode */
+	w83627hf_unselect_wd_register();
 }
 
-static void
+static int
 wdt_ping(void)
 {
 	wdt_ctrl(timeout);
+	return 0;
 }
 
-static void
+static int
 wdt_disable(void)
 {
 	wdt_ctrl(0);
+	return 0;
+}
+
+static int
+wdt_set_heartbeat(int t)
+{
+	if ((t < 1) || (t > 63))
+		return -EINVAL;
+
+	timeout = t;
+	return 0;
 }
 
 static ssize_t
@@ -134,7 +175,7 @@
 	static struct watchdog_info ident = {
 		.options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE,
 		.firmware_version = 1,
-		.identity = "Advantech WDT",
+		.identity = "W83627HF WDT",
 	};
 
 	switch (cmd) {
@@ -154,9 +195,8 @@
 	case WDIOC_SETTIMEOUT:
 	  if (get_user(new_timeout, (int *)arg))
 		  return -EFAULT;
-	  if ((new_timeout < 1) || (new_timeout > 63))
+	  if (wdt_set_heartbeat(new_timeout))
 		  return -EINVAL;
-	  timeout = new_timeout;
 	  wdt_ping();
 	  /* Fall */
 
@@ -211,8 +251,8 @@
 		printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n");
 		wdt_ping();
 	}
-	clear_bit(0, &wdt_is_open);
 	expect_close = 0;
+	clear_bit(0, &wdt_is_open);
 	return 0;
 }
 
@@ -266,10 +306,10 @@
 
 	printk(KERN_INFO "WDT driver for the Winbond(TM) W83627HF Super I/O chip initialising.\n");
 
-	if (timeout < 1 || timeout > 63) {
-		timeout = WATCHDOG_TIMEOUT;
-		printk (KERN_INFO PFX "timeout value must be 1<=x<=63, using %d\n",
-			timeout);
+	if (wdt_set_heartbeat(timeout)) {
+		wdt_set_heartbeat(WATCHDOG_TIMEOUT);
+		printk (KERN_INFO PFX "timeout value must be 1<=timeout<=63, using %d\n",
+			WATCHDOG_TIMEOUT);
 	}
 
 	if (!request_region(wdt_io, 1, WATCHDOG_NAME)) {
@@ -278,6 +318,8 @@
 		ret = -EIO;
 		goto out;
 	}
+
+	w83627hf_init();
 
 	ret = register_reboot_notifier(&wdt_notifier);
 	if (ret != 0) {
diff -Nru a/drivers/i2c/busses/scx200_acb.c b/drivers/i2c/busses/scx200_acb.c
--- a/drivers/i2c/busses/scx200_acb.c	2004-06-02 23:26:59 -07:00
+++ b/drivers/i2c/busses/scx200_acb.c	2004-06-02 23:26:59 -07:00
@@ -43,7 +43,7 @@
 MODULE_LICENSE("GPL");
 
 #define MAX_DEVICES 4
-static int base[MAX_DEVICES] = { 0x840 };
+static int base[MAX_DEVICES] = { 0x820, 0x840 };
 MODULE_PARM(base, "1-4i");
 MODULE_PARM_DESC(base, "Base addresses for the ACCESS.bus controllers");
 
@@ -510,7 +510,10 @@
 	/* Verify that this really is a SCx200 processor */
 	if (pci_find_device(PCI_VENDOR_ID_NS,
 			    PCI_DEVICE_ID_NS_SCx200_BRIDGE,
-			    NULL) == NULL)
+			    NULL) == NULL
+	    && pci_find_device(PCI_VENDOR_ID_NS,
+			       PCI_DEVICE_ID_NS_SC1100_BRIDGE,
+			       NULL) == NULL)
 		return -ENODEV;
 
 	rc = -ENXIO;
diff -Nru a/drivers/md/md.c b/drivers/md/md.c
--- a/drivers/md/md.c	2004-06-02 23:26:59 -07:00
+++ b/drivers/md/md.c	2004-06-02 23:26:59 -07:00
@@ -1607,7 +1607,7 @@
 	spin_lock(&pers_lock);
 	if (!pers[pnum] || !try_module_get(pers[pnum]->owner)) {
 		spin_unlock(&pers_lock);
-		printk(KERN_ERR "md: personality %d is not loaded!\n",
+		printk(KERN_WARNING "md: personality %d is not loaded!\n",
 		       pnum);
 		return -EINVAL;
 	}
diff -Nru a/drivers/net/8139too.c b/drivers/net/8139too.c
--- a/drivers/net/8139too.c	2004-06-02 23:26:58 -07:00
+++ b/drivers/net/8139too.c	2004-06-02 23:26:58 -07:00
@@ -171,7 +171,7 @@
  * Receive ring size 
  * Warning: 64K ring has hardware issues and may lock up.
  */
-#if defined(CONFIG_SH_DREAMCAST) || defined(CONFIG_EMBEDDED)
+#if defined(CONFIG_SH_DREAMCAST)
 #define RX_BUF_IDX	1	/* 16K ring */
 #else
 #define RX_BUF_IDX	2	/* 32K ring */
diff -Nru a/drivers/net/Kconfig b/drivers/net/Kconfig
--- a/drivers/net/Kconfig	2004-06-02 23:27:00 -07:00
+++ b/drivers/net/Kconfig	2004-06-02 23:27:00 -07:00
@@ -1874,25 +1874,12 @@
 #	Gigabit Ethernet
 #
 
-menu "Gigabit Ethernet (1000/10000 Mbit)"
+menu "Ethernet (1000 Mbit)"
 	depends on NETDEVICES
 
-config NET_GIGE
-	bool "Gigabit Ethernet (1000/10000 Mbit) controller support"
-	depends on NETDEVICES && NET_ETHERNET && (PCI || SBUS)
-	help
-	  Gigabit ethernet.  It's yummy and fast, fast, fast.
-
-	  Note that the answer to this question doesn't directly affect the
-	  kernel: saying N will just cause the configurator to skip all
-	  the questions about this class of network cards. If you say Y, you
-	  will be asked for your specific card in the following questions.
-	  
-	  If you are unsure, say Y.
-
 config ACENIC
 	tristate "Alteon AceNIC/3Com 3C985/NetGear GA620 Gigabit support"
-	depends on PCI && NET_GIGE
+	depends on PCI
 	---help---
 	  Say Y here if you have an Alteon AceNIC, 3Com 3C985(B), NetGear
 	  GA620, SGI Gigabit or Farallon PN9000-SX PCI Gigabit Ethernet
@@ -1919,7 +1906,7 @@
 
 config DL2K
 	tristate "D-Link DL2000-based Gigabit Ethernet support"
-	depends on PCI && NET_GIGE
+	depends on PCI
 	select CRC32
 	help
 	  This driver supports D-Link 2000-based gigabit ethernet cards, which
@@ -1932,7 +1919,7 @@
 
 config E1000
 	tristate "Intel(R) PRO/1000 Gigabit Ethernet support"
-	depends on PCI && NET_GIGE
+	depends on PCI
 	---help---
 	  This driver supports Intel(R) PRO/1000 gigabit ethernet family of
 	  adapters, which includes:
@@ -1979,7 +1966,7 @@
 
 config MYRI_SBUS
 	tristate "MyriCOM Gigabit Ethernet support"
-	depends on SBUS && NET_GIGE
+	depends on SBUS
 	help
 	  This driver supports MyriCOM Sbus gigabit Ethernet cards.
 
@@ -1988,7 +1975,7 @@
 
 config NS83820
 	tristate "National Semiconduct DP83820 support"
-	depends on PCI && NET_GIGE
+	depends on PCI
 	help
 	  This is a driver for the National Semiconductor DP83820 series
 	  of gigabit ethernet MACs.  Cards using this chipset include
@@ -1998,7 +1985,7 @@
 
 config HAMACHI
 	tristate "Packet Engines Hamachi GNIC-II support"
-	depends on PCI && NET_GIGE
+	depends on PCI
 	select MII
 	help
 	  If you have a Gigabit Ethernet card of this type, say Y and read
@@ -2011,7 +1998,7 @@
 
 config YELLOWFIN
 	tristate "Packet Engines Yellowfin Gigabit-NIC support (EXPERIMENTAL)"
-	depends on PCI && EXPERIMENTAL && NET_GIGE
+	depends on PCI && EXPERIMENTAL
 	select CRC32
 	---help---
 	  Say Y here if you have a Packet Engines G-NIC PCI Gigabit Ethernet
@@ -2025,7 +2012,7 @@
 
 config R8169
 	tristate "Realtek 8169 gigabit ethernet support"
-	depends on PCI && NET_GIGE
+	depends on PCI
 	select CRC32
 	---help---
 	  Say Y here if you have a Realtek 8169 PCI Gigabit Ethernet adapter.
@@ -2035,7 +2022,7 @@
 
 config SK98LIN
 	tristate "Marvell Yukon Chipset / SysKonnect SK-98xx Support"
-	depends on PCI && NET_GIGE
+	depends on PCI
 	---help---
 	  Say Y here if you have a Marvell Yukon or SysKonnect SK-98xx/SK-95xx
 	  compliant Gigabit Ethernet Adapter. The following adapters are supported
@@ -2114,16 +2101,25 @@
 
 config TIGON3
 	tristate "Broadcom Tigon3 support"
-	depends on PCI && NET_GIGE
+	depends on PCI
 	help
 	  This driver supports Broadcom Tigon3 based gigabit Ethernet cards.
 
 	  To compile this driver as a module, choose M here: the module
 	  will be called tg3.  This is recommended.
 
+endmenu
+
+#
+#	10 Gigabit Ethernet
+#
+
+menu "Ethernet (10000 Mbit)"
+	depends on NETDEVICES
+
 config IXGB
 	tristate "Intel(R) PRO/10GbE support"
-	depends on PCI && NET_GIGE
+	depends on PCI
 	---help---
 	  This driver supports Intel(R) PRO/10GbE family of
 	  adapters, which includes:
@@ -2155,7 +2151,7 @@
 
 config S2IO
 	tristate "S2IO 10Gbe XFrame NIC"
-	depends on PCI && NET_GIGE
+	depends on PCI
 	---help---
 	  This driver supports the 10Gbe XFrame NIC of S2IO. 
 	  For help regarding driver compilation, installation and 
diff -Nru a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c
--- a/drivers/net/e1000/e1000_ethtool.c	2004-06-02 23:26:59 -07:00
+++ b/drivers/net/e1000/e1000_ethtool.c	2004-06-02 23:26:59 -07:00
@@ -297,30 +297,7 @@
 	return 0;
 }
 
-static uint32_t
-e1000_get_sg(struct net_device *netdev)
-{
-	return (netdev->features & NETIF_F_SG) != 0;
-}
-
-static int
-e1000_set_sg(struct net_device *netdev, uint32_t data)
-{
-	if (data)
-		netdev->features |= NETIF_F_SG;
-	else
-		netdev->features &= ~NETIF_F_SG;
-
-	return 0;
-}
-
 #ifdef NETIF_F_TSO
-static uint32_t
-e1000_get_tso(struct net_device *netdev)
-{
-	return (netdev->features & NETIF_F_TSO) != 0;
-} 
-
 static int
 e1000_set_tso(struct net_device *netdev, uint32_t data)
 {
@@ -1577,12 +1554,6 @@
 	return 0;
 }
 
-static uint32_t
-e1000_get_link(struct net_device *netdev)
-{
-	return netif_carrier_ok(netdev);
-}
-
 static int 
 e1000_get_stats_count(struct net_device *netdev)
 {
@@ -1635,7 +1606,7 @@
 	.get_msglevel	        = e1000_get_msglevel,
 	.set_msglevel	        = e1000_set_msglevel,
 	.nway_reset             = e1000_nway_reset,
-	.get_link               = e1000_get_link,
+	.get_link               = ethtool_op_get_link,
 	.get_eeprom_len         = e1000_get_eeprom_len,
 	.get_eeprom             = e1000_get_eeprom,
 	.set_eeprom             = e1000_set_eeprom,
@@ -1647,10 +1618,10 @@
 	.set_rx_csum		= e1000_set_rx_csum,
 	.get_tx_csum		= e1000_get_tx_csum,
 	.set_tx_csum		= e1000_set_tx_csum,
-	.get_sg			= e1000_get_sg,
-	.set_sg			= e1000_set_sg,
+	.get_sg			= ethtool_op_get_sg,
+	.set_sg			= ethtool_op_set_sg,
 #ifdef NETIF_F_TSO
-	.get_tso		= e1000_get_tso,
+	.get_tso		= ethtool_op_get_tso,
 	.set_tso		= e1000_set_tso,
 #endif
 	.self_test_count        = e1000_diag_test_count,
diff -Nru a/drivers/net/iseries_veth.c b/drivers/net/iseries_veth.c
--- a/drivers/net/iseries_veth.c	2004-06-02 23:26:59 -07:00
+++ b/drivers/net/iseries_veth.c	2004-06-02 23:26:59 -07:00
@@ -461,6 +461,11 @@
 		if (cnx->msgs)
 			for (i = 0; i < VETH_NUMBUFFERS; ++i)
 				veth_recycle_msg(cnx, cnx->msgs + i);
+		spin_unlock_irq(&cnx->lock);
+		veth_flush_pending(cnx);
+		spin_lock_irq(&cnx->lock);
+		if (cnx->state & VETH_STATE_RESET)
+			goto restart;
 	}
 
 	if (cnx->state & VETH_STATE_SHUTDOWN)
@@ -796,6 +801,48 @@
 	return -EOPNOTSUPP;
 }
 
+static void veth_tx_timeout(struct net_device *dev)
+{
+	struct veth_port *port = (struct veth_port *)dev->priv;
+	struct net_device_stats *stats = &port->stats;
+	unsigned long flags;
+	int i;
+
+	stats->tx_errors++;
+
+	spin_lock_irqsave(&port->pending_gate, flags);
+
+	printk(KERN_WARNING "%s: Tx timeout!  Resetting lp connections: %08x\n",
+	       dev->name, port->pending_lpmask);
+
+	/* If we've timed out the queue must be stopped, which should
+	 * only ever happen when there is a pending packet. */
+	WARN_ON(! port->pending_lpmask);
+
+	for (i = 0; i < HVMAXARCHITECTEDLPS; i++) {
+		struct veth_lpar_connection *cnx = veth_cnx[i];
+
+		if (! (port->pending_lpmask & (1<<i)))
+			continue;
+
+		/* If we're pending on it, we must be connected to it,
+		 * so we should certainly have a structure for it. */
+		BUG_ON(! cnx);
+
+		/* Theoretically we could be kicking a connection
+		 * which doesn't deserve it, but in practice if we've
+		 * had a Tx timeout, the pending_lpmask will have
+		 * exactly one bit set - the connection causing the
+		 * problem. */
+		spin_lock(&cnx->lock);
+		cnx->state |= VETH_STATE_RESET;
+		veth_kick_statemachine(cnx);
+		spin_unlock(&cnx->lock);
+	}
+
+	spin_unlock_irqrestore(&port->pending_gate, flags);
+}
+
 struct net_device * __init veth_probe_one(int vlan)
 {
 	struct net_device *dev;
@@ -843,6 +890,9 @@
 	dev->set_multicast_list = veth_set_multicast_list;
 	dev->do_ioctl = veth_ioctl;
 
+	dev->watchdog_timeo = 2 * (VETH_ACKTIMEOUT * HZ / 1000000);
+	dev->tx_timeout = veth_tx_timeout;
+
 	rc = register_netdev(dev);
 	if (rc != 0) {
 		veth_printk(KERN_ERR,
@@ -938,19 +988,10 @@
 	int rc;
 
 	for (i = 0; i < HVMAXARCHITECTEDLPS; i++) {
-		struct sk_buff *clone;
-
 		if ((lpmask & (1 << i)) == 0)
 			continue;
 
-		clone = skb_clone(skb, GFP_ATOMIC);
-		if (! clone) {
-			veth_error("%s: skb_clone failed %p\n",
-				   dev->name, skb);
-			continue;
-		}
-
-		rc = veth_transmit_to_one(clone, i, dev);
+		rc = veth_transmit_to_one(skb_get(skb), i, dev);
 		if (! rc)
 			lpmask &= ~(1<<i);
 	}
@@ -984,27 +1025,28 @@
 		lpmask = port->lpar_map;
 	}
 
+	spin_lock_irqsave(&port->pending_gate, flags);
+
 	lpmask = veth_transmit_to_many(skb, lpmask, dev);
 
 	if (! lpmask) {
 		dev_kfree_skb(skb);
 	} else {
-		spin_lock_irqsave(&port->pending_gate, flags);
 		if (port->pending_skb) {
 			veth_error("%s: Tx while skb was pending!\n",
 				   dev->name);
 			dev_kfree_skb(skb);
-                       spin_unlock_irqrestore(&port->pending_gate, flags);
+			spin_unlock_irqrestore(&port->pending_gate, flags);
 			return 1;
 		}
 
 		port->pending_skb = skb;
 		port->pending_lpmask = lpmask;
 		netif_stop_queue(dev);
-
-		spin_unlock_irqrestore(&port->pending_gate, flags);
 	}
 
+	spin_unlock_irqrestore(&port->pending_gate, flags);
+
 	return 0;
 }
 
@@ -1058,7 +1100,7 @@
 			if (! port->pending_lpmask) {
 				dev_kfree_skb_any(port->pending_skb);
 				port->pending_skb = NULL;
-				netif_start_queue(dev);
+				netif_wake_queue(dev);
 			}
 		}
 		spin_unlock_irqrestore(&port->pending_gate, flags);
diff -Nru a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c
--- a/drivers/net/ixgb/ixgb_main.c	2004-06-02 23:26:58 -07:00
+++ b/drivers/net/ixgb/ixgb_main.c	2004-06-02 23:26:58 -07:00
@@ -1610,7 +1610,7 @@
 		 */
 
 		atomic_inc(&adapter->irq_sem);
-		IXGB_WRITE_REG(&adapter->hw, IMC, ~0);
+		IXGB_WRITE_REG(hw, IMC, ~0);
 		__netif_rx_schedule(netdev);
 	}
 #else
diff -Nru a/drivers/net/plip.c b/drivers/net/plip.c
--- a/drivers/net/plip.c	2004-06-02 23:27:00 -07:00
+++ b/drivers/net/plip.c	2004-06-02 23:27:00 -07:00
@@ -1219,6 +1219,9 @@
 	struct net_local *nl = netdev_priv(dev);
 	struct plipconf *pc = (struct plipconf *) &rq->ifr_data;
 
+	if (cmd != SIOCDEVPLIP)
+		return -EOPNOTSUPP;
+
 	switch(pc->pcmd) {
 	case PLIP_GET_TIMEOUT:
 		pc->trigger = nl->trigger;
diff -Nru a/drivers/net/ppp_async.c b/drivers/net/ppp_async.c
--- a/drivers/net/ppp_async.c	2004-06-02 23:27:00 -07:00
+++ b/drivers/net/ppp_async.c	2004-06-02 23:27:00 -07:00
@@ -205,10 +205,10 @@
 {
 	struct asyncppp *ap;
 
-	write_lock(&disc_data_lock);
+	write_lock_irq(&disc_data_lock);
 	ap = tty->disc_data;
 	tty->disc_data = 0;
-	write_unlock(&disc_data_lock);
+	write_unlock_irq(&disc_data_lock);
 	if (ap == 0)
 		return;
 
diff -Nru a/drivers/net/ppp_synctty.c b/drivers/net/ppp_synctty.c
--- a/drivers/net/ppp_synctty.c	2004-06-02 23:26:59 -07:00
+++ b/drivers/net/ppp_synctty.c	2004-06-02 23:26:59 -07:00
@@ -251,10 +251,10 @@
 {
 	struct syncppp *ap;
 
-	write_lock(&disc_data_lock);
+	write_lock_irq(&disc_data_lock);
 	ap = tty->disc_data;
 	tty->disc_data = 0;
-	write_unlock(&disc_data_lock);
+	write_unlock_irq(&disc_data_lock);
 	if (ap == 0)
 		return;
 
diff -Nru a/drivers/net/s2io.c b/drivers/net/s2io.c
--- a/drivers/net/s2io.c	2004-06-02 23:26:59 -07:00
+++ b/drivers/net/s2io.c	2004-06-02 23:26:59 -07:00
@@ -238,7 +238,7 @@
       name:"S2IO",
       id_table:s2io_tbl,
       probe:s2io_init_nic,
-      remove:s2io_rem_nic,
+      remove:__devexit_p(s2io_rem_nic),
 };
 
 /*  
@@ -4355,7 +4355,7 @@
 *  and free up all resource held up by the device. This could be in response 
 *  to a Hot plug event or when the driver is to be removed from memory.
 */
-static void __exit s2io_rem_nic(struct pci_dev *pdev)
+static void __devexit s2io_rem_nic(struct pci_dev *pdev)
 {
 	struct net_device *dev =
 	    (struct net_device *) pci_get_drvdata(pdev);
diff -Nru a/drivers/net/s2io.h b/drivers/net/s2io.h
--- a/drivers/net/s2io.h	2004-06-02 23:26:59 -07:00
+++ b/drivers/net/s2io.h	2004-06-02 23:26:59 -07:00
@@ -825,7 +825,7 @@
  */
 static int __devinit s2io_init_nic(struct pci_dev *pdev,
 				   const struct pci_device_id *pre);
-static void __exit s2io_rem_nic(struct pci_dev *pdev);
+static void __devexit s2io_rem_nic(struct pci_dev *pdev);
 static int initSharedMem(struct s2io_nic *sp);
 static void freeSharedMem(struct s2io_nic *sp);
 static int initNic(struct s2io_nic *nic);
diff -Nru a/drivers/net/tulip/eeprom.c b/drivers/net/tulip/eeprom.c
--- a/drivers/net/tulip/eeprom.c	2004-06-02 23:27:00 -07:00
+++ b/drivers/net/tulip/eeprom.c	2004-06-02 23:27:00 -07:00
@@ -90,12 +90,8 @@
  */
 static void __devinit tulip_build_fake_mediatable(struct tulip_private *tp)
 {
-#ifdef __hppa__
-	unsigned char *ee_data = tp->eeprom;
-
-	if (ee_data[0] == 0x3c && ee_data[1] == 0x10 && 
-		(ee_data[2] == 0x63 || ee_data[2] == 0x61) && ee_data[3] == 0x10) {
-
+#ifdef CONFIG_GSC
+	if (tp->flags & NEEDS_FAKE_MEDIA_TABLE) {
 		static unsigned char leafdata[] =
 			{ 0x01,       /* phy number */
 			  0x02,       /* gpr setup sequence length */
@@ -306,12 +302,12 @@
 
 /*  EEPROM_Ctrl bits. */
 #define EE_SHIFT_CLK	0x02	/* EEPROM shift clock. */
-#define EE_CS			0x01	/* EEPROM chip select. */
+#define EE_CS		0x01	/* EEPROM chip select. */
 #define EE_DATA_WRITE	0x04	/* Data from the Tulip to EEPROM. */
-#define EE_WRITE_0		0x01
-#define EE_WRITE_1		0x05
+#define EE_WRITE_0	0x01
+#define EE_WRITE_1	0x05
 #define EE_DATA_READ	0x08	/* Data from the EEPROM chip. */
-#define EE_ENB			(0x4800 | EE_CS)
+#define EE_ENB		(0x4800 | EE_CS)
 
 /* Delay between EEPROM clock transitions.
    Even at 33Mhz current PCI implementations don't overrun the EEPROM clock.
@@ -322,11 +318,12 @@
 #define EE_READ_CMD		(6)
 
 /* Note: this routine returns extra data bits for size detection. */
-int __devinit tulip_read_eeprom(long ioaddr, int location, int addr_len)
+int __devinit tulip_read_eeprom(struct net_device *dev, int location, int addr_len)
 {
 	int i;
 	unsigned retval = 0;
-	long ee_addr = ioaddr + CSR9;
+	struct tulip_private *tp = dev->priv;
+	long ee_addr = tp->base_addr + CSR9;
 	int read_cmd = location | (EE_READ_CMD << addr_len);
 
 	outl(EE_ENB & ~EE_CS, ee_addr);
@@ -354,6 +351,6 @@
 
 	/* Terminate the EEPROM access. */
 	outl(EE_ENB & ~EE_CS, ee_addr);
-	return retval;
+	return (tp->flags & HAS_SWAPPED_SEEPROM) ? swab16(retval) : retval;
 }
 
diff -Nru a/drivers/net/tulip/tulip.h b/drivers/net/tulip/tulip.h
--- a/drivers/net/tulip/tulip.h	2004-06-02 23:27:00 -07:00
+++ b/drivers/net/tulip/tulip.h	2004-06-02 23:27:00 -07:00
@@ -64,6 +64,8 @@
 	COMET_MAC_ADDR		= 0x0800,
 	HAS_PCI_MWI		= 0x1000,
 	HAS_PHY_IRQ		= 0x2000,
+	HAS_SWAPPED_SEEPROM	= 0x4000,
+	NEEDS_FAKE_MEDIA_TABLE	= 0x8000,
 };
 
 
@@ -407,7 +409,7 @@
 
 /* eeprom.c */
 void tulip_parse_eeprom(struct net_device *dev);
-int tulip_read_eeprom(long ioaddr, int location, int addr_len);
+int tulip_read_eeprom(struct net_device *dev, int location, int addr_len);
 
 /* interrupt.c */
 extern unsigned int tulip_max_interrupt_work;
diff -Nru a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c
--- a/drivers/net/tulip/tulip_core.c	2004-06-02 23:26:59 -07:00
+++ b/drivers/net/tulip/tulip_core.c	2004-06-02 23:26:59 -07:00
@@ -1246,6 +1246,7 @@
 	long ioaddr;
 	static int board_idx = -1;
 	int chip_idx = ent->driver_data;
+	const char *chip_name = tulip_tbl[chip_idx].chip_name;
 	unsigned int eeprom_missing = 0;
 	unsigned int force_csr0 = 0;
 
@@ -1414,6 +1415,23 @@
 
 	pci_set_master(pdev);
 
+#ifdef CONFIG_GSC
+	if (pdev->subsystem_vendor == PCI_VENDOR_ID_HP) {
+		switch (pdev->subsystem_device) {
+		default:
+			break;
+		case 0x1061:
+		case 0x1062:
+		case 0x1063:
+		case 0x1098:
+		case 0x1099:
+		case 0x10EE:
+			tp->flags |= HAS_SWAPPED_SEEPROM | NEEDS_FAKE_MEDIA_TABLE;
+			chip_name = "GSC DS21140 Tulip";
+		}
+	}
+#endif
+
 	/* Clear the missed-packet counter. */
 	inl(ioaddr + CSR8);
 
@@ -1442,11 +1460,13 @@
 	} else {
 		/* A serial EEPROM interface, we read now and sort it out later. */
 		int sa_offset = 0;
-		int ee_addr_size = tulip_read_eeprom(ioaddr, 0xff, 8) & 0x40000 ? 8 : 6;
+		int ee_addr_size = tulip_read_eeprom(dev, 0xff, 8) & 0x40000 ? 8 : 6;
 
-		for (i = 0; i < sizeof(tp->eeprom)/2; i++)
-			((u16 *)ee_data)[i] =
-				le16_to_cpu(tulip_read_eeprom(ioaddr, i, ee_addr_size));
+		for (i = 0; i < sizeof(tp->eeprom); i+=2) {
+			u16 data = tulip_read_eeprom(dev, i/2, ee_addr_size);
+			ee_data[i] = data & 0xff;
+			ee_data[i + 1] = data >> 8;
+		}
 
 		/* DEC now has a specification (see Notes) but early board makers
 		   just put the address in the first EEPROM locations. */
@@ -1489,25 +1509,26 @@
                        tp->flags &= ~HAS_MEDIA_TABLE;
                }
 #endif
-#ifdef __hppa__
-		/* 3x5 HSC (J3514A) has a broken srom */
-		if(ee_data[0] == 0x61 && ee_data[1] == 0x10) {
+#ifdef CONFIG_GSC
+		/* Check to see if we have a broken srom */
+		if (ee_data[0] == 0x61 && ee_data[1] == 0x10) {
 			/* pci_vendor_id and subsystem_id are swapped */
 			ee_data[0] = ee_data[2];
 			ee_data[1] = ee_data[3];
 			ee_data[2] = 0x61;
 			ee_data[3] = 0x10;
 
-			/* srom need to be byte-swaped and shifted up 1 word.  
-			 * This shift needs to happen at the end of the MAC
-			 * first because of the 2 byte overlap.
+			/* HSC-PCI boards need to be byte-swaped and shifted
+			 * up 1 word.  This shift needs to happen at the end
+			 * of the MAC first because of the 2 byte overlap.
 			 */
-			for(i = 4; i >= 0; i -= 2) {
+			for (i = 4; i >= 0; i -= 2) {
 				ee_data[17 + i + 3] = ee_data[17 + i];
 				ee_data[16 + i + 5] = ee_data[16 + i];
 			}
 		}
 #endif
+
 		for (i = 0; i < 6; i ++) {
 			dev->dev_addr[i] = ee_data[i + sa_offset];
 			sum += ee_data[i + sa_offset];
@@ -1628,7 +1649,7 @@
 		goto err_out_free_ring;
 
 	printk(KERN_INFO "%s: %s rev %d at %#3lx,",
-	       dev->name, tulip_tbl[chip_idx].chip_name, chip_rev, ioaddr);
+	       dev->name, chip_name, chip_rev, ioaddr);
 	pci_set_drvdata(pdev, dev);
 
 	if (eeprom_missing)
diff -Nru a/drivers/net/wan/Makefile b/drivers/net/wan/Makefile
--- a/drivers/net/wan/Makefile	2004-06-02 23:26:59 -07:00
+++ b/drivers/net/wan/Makefile	2004-06-02 23:26:59 -07:00
@@ -61,6 +61,9 @@
 obj-$(CONFIG_WANXL)		+= wanxl.o
 obj-$(CONFIG_PCI200SYN)		+= pci200syn.o
 
+clean-files := wanxlfw.inc
+$(obj)/wanxl.o:	$(obj)/wanxlfw.inc
+
 ifeq ($(CONFIG_WANXL_BUILD_FIRMWARE),y)
 ifeq ($(ARCH),m68k)
   AS68K = $(AS)
@@ -72,12 +75,12 @@
 
 quiet_cmd_build_wanxlfw = BLD FW  $@
       cmd_build_wanxlfw = \
-	$(CPP) -Wp,-MD,$(depfile) -Iinclude $(obj)/wanxlfw.S | $(AS68K) -m68360 -o $(obj)/wanxlfw.o; \
+	$(CPP) -Wp,-MD,$(depfile) -I$(srctree)/include $< | $(AS68K) -m68360 -o $(obj)/wanxlfw.o; \
 	$(LD68K) --oformat binary -Ttext 0x1000 $(obj)/wanxlfw.o -o $(obj)/wanxlfw.bin; \
 	hexdump -ve '"\n" 16/1 "0x%02X,"' $(obj)/wanxlfw.bin | sed 's/0x  ,//g;1s/^/static u8 firmware[]={/;$$s/,$$/\n};\n/' >$(obj)/wanxlfw.inc; \
 	rm -f $(obj)/wanxlfw.bin $(obj)/wanxlfw.o
 
-$(obj)/wanxlfw.inc:	$(obj)/wanxlfw.S
+$(obj)/wanxlfw.inc:	$(src)/wanxlfw.S
 	$(call if_changed_dep,build_wanxlfw)
 targets += wanxlfw.inc
 endif
diff -Nru a/drivers/net/wan/c101.c b/drivers/net/wan/c101.c
--- a/drivers/net/wan/c101.c	2004-06-02 23:27:00 -07:00
+++ b/drivers/net/wan/c101.c	2004-06-02 23:27:00 -07:00
@@ -379,8 +379,6 @@
 		return result;
 	}
 
-	/* XXX: are we OK with having that done when card is already up? */
-
 	sca_init_sync_port(card); /* Set up C101 memory */
 	hdlc_set_carrier(!(sca_in(MSCI1_OFFSET + ST3, card) & ST3_DCD), dev);
 
diff -Nru a/drivers/net/wan/farsync.c b/drivers/net/wan/farsync.c
--- a/drivers/net/wan/farsync.c	2004-06-02 23:27:00 -07:00
+++ b/drivers/net/wan/farsync.c	2004-06-02 23:27:00 -07:00
@@ -21,9 +21,10 @@
 #include <linux/pci.h>
 #include <linux/ioport.h>
 #include <linux/init.h>
-#include <asm/uaccess.h>
 #include <linux/if.h>
 #include <linux/hdlc.h>
+#include <asm/io.h>
+#include <asm/uaccess.h>
 
 #include "farsync.h"
 
diff -Nru a/drivers/net/wan/hd6457x.c b/drivers/net/wan/hd6457x.c
--- a/drivers/net/wan/hd6457x.c	2004-06-02 23:26:58 -07:00
+++ b/drivers/net/wan/hd6457x.c	2004-06-02 23:26:58 -07:00
@@ -610,7 +610,6 @@
 	card_t* card = port_to_card(port);
 
 	/* reset channel */
-	netif_stop_queue(dev);
 	sca_out(CMD_RESET, get_msci(port) + CMD, port_to_card(port));
 #ifdef __HD64570_H
 	/* disable MSCI interrupts */
@@ -624,6 +623,7 @@
 	sca_outl(sca_inl(IER0, card) &
 		 (phy_node(port) ? 0x00FF00FF : 0xFF00FF00), IER0, card);
 #endif
+	netif_stop_queue(dev);
 }
 
 
diff -Nru a/drivers/net/wan/hdlc_cisco.c b/drivers/net/wan/hdlc_cisco.c
--- a/drivers/net/wan/hdlc_cisco.c	2004-06-02 23:26:59 -07:00
+++ b/drivers/net/wan/hdlc_cisco.c	2004-06-02 23:26:59 -07:00
@@ -180,7 +180,8 @@
 
 		case CISCO_KEEPALIVE_REQ:
 			hdlc->state.cisco.rxseq = ntohl(cisco_data->par1);
-			if (ntohl(cisco_data->par2)==hdlc->state.cisco.txseq) {
+			if (hdlc->state.cisco.request_sent &&
+			    ntohl(cisco_data->par2)==hdlc->state.cisco.txseq) {
 				hdlc->state.cisco.last_poll = jiffies;
 				if (!hdlc->state.cisco.up) {
 					u32 sec, min, hrs, days;
@@ -192,8 +193,9 @@
 					       "uptime %ud%uh%um%us)\n",
 					       dev->name, days, hrs,
 					       min, sec);
+					netif_carrier_on(dev);
+					hdlc->state.cisco.up = 1;
 				}
-				hdlc->state.cisco.up = 1;
 			}
 
 			dev_kfree_skb_any(skb);
@@ -219,17 +221,18 @@
 	struct net_device *dev = (struct net_device *)arg;
 	hdlc_device *hdlc = dev_to_hdlc(dev);
 
-	if (hdlc->state.cisco.up && jiffies - hdlc->state.cisco.last_poll >=
-	    hdlc->state.cisco.settings.timeout * HZ) {
+	if (hdlc->state.cisco.up &&
+	    time_after(jiffies, hdlc->state.cisco.last_poll +
+		       hdlc->state.cisco.settings.timeout * HZ)) {
 		hdlc->state.cisco.up = 0;
 		printk(KERN_INFO "%s: Link down\n", dev->name);
-		if (netif_carrier_ok(dev))
-			netif_carrier_off(dev);
+		netif_carrier_off(dev);
 	}
 
 	cisco_keepalive_send(dev, CISCO_KEEPALIVE_REQ,
 			     ++hdlc->state.cisco.txseq,
 			     hdlc->state.cisco.rxseq);
+	hdlc->state.cisco.request_sent = 1;
 	hdlc->state.cisco.timer.expires = jiffies +
 		hdlc->state.cisco.settings.interval * HZ;
 	hdlc->state.cisco.timer.function = cisco_timer;
@@ -242,8 +245,8 @@
 static void cisco_start(struct net_device *dev)
 {
 	hdlc_device *hdlc = dev_to_hdlc(dev);
-	hdlc->state.cisco.last_poll = 0;
 	hdlc->state.cisco.up = 0;
+	hdlc->state.cisco.request_sent = 0;
 	hdlc->state.cisco.txseq = hdlc->state.cisco.rxseq = 0;
 
 	init_timer(&hdlc->state.cisco.timer);
@@ -257,9 +260,12 @@
 
 static void cisco_stop(struct net_device *dev)
 {
-	del_timer_sync(&dev_to_hdlc(dev)->state.cisco.timer);
+	hdlc_device *hdlc = dev_to_hdlc(dev);
+	del_timer_sync(&hdlc->state.cisco.timer);
 	if (netif_carrier_ok(dev))
 		netif_carrier_off(dev);
+	hdlc->state.cisco.up = 0;
+	hdlc->state.cisco.request_sent = 0;
 }
 
 
diff -Nru a/drivers/net/wan/hdlc_fr.c b/drivers/net/wan/hdlc_fr.c
--- a/drivers/net/wan/hdlc_fr.c	2004-06-02 23:27:00 -07:00
+++ b/drivers/net/wan/hdlc_fr.c	2004-06-02 23:27:00 -07:00
@@ -584,8 +584,9 @@
 	u32 list;
 
 	if (hdlc->state.fr.settings.dce)
-		reliable = (jiffies - hdlc->state.fr.last_poll <
-			    hdlc->state.fr.settings.t392 * HZ);
+		reliable = hdlc->state.fr.request &&
+			time_before(jiffies, hdlc->state.fr.last_poll +
+				    hdlc->state.fr.settings.t392 * HZ);
 	else {
 		hdlc->state.fr.last_errors <<= 1; /* Shift the list */
 		if (hdlc->state.fr.request) {
@@ -617,6 +618,7 @@
 
 		fr_lmi_send(dev, hdlc->state.fr.n391cnt == 0);
 
+		hdlc->state.fr.last_poll = jiffies;
 		hdlc->state.fr.request = 1;
 		hdlc->state.fr.timer.expires = jiffies +
 			hdlc->state.fr.settings.t391 * HZ;
@@ -689,6 +691,7 @@
 			       dev->name, reptype);
 			return 1;
 		}
+		hdlc->state.fr.last_poll = jiffies;
 	}
 
 	error = 0;
@@ -728,7 +731,12 @@
 
 	/* DTE */
 
-	if (reptype != LMI_FULLREP || error)
+	hdlc->state.fr.request = 0; /* got response, no request pending */
+
+	if (error)
+		return 0;
+
+	if (reptype != LMI_FULLREP)
 		return 0;
 
 	stat_len = 3;
@@ -829,9 +837,6 @@
 			if (fr_lmi_recv(ndev, skb))
 				goto rx_error;
 			else {
-				/* No request pending */
-				hdlc->state.fr.request = 0;
-				hdlc->state.fr.last_poll = jiffies;
 				dev_kfree_skb_any(skb);
 				return NET_RX_SUCCESS;
 			}
@@ -946,9 +951,6 @@
 	printk(KERN_DEBUG "fr_start\n");
 #endif
 	if (hdlc->state.fr.settings.lmi != LMI_NONE) {
-		if (netif_carrier_ok(dev))
-			netif_carrier_off(dev);
-		hdlc->state.fr.last_poll = 0;
 		hdlc->state.fr.reliable = 0;
 		hdlc->state.fr.dce_changed = 1;
 		hdlc->state.fr.request = 0;
diff -Nru a/drivers/net/wan/hdlc_generic.c b/drivers/net/wan/hdlc_generic.c
--- a/drivers/net/wan/hdlc_generic.c	2004-06-02 23:26:58 -07:00
+++ b/drivers/net/wan/hdlc_generic.c	2004-06-02 23:26:58 -07:00
@@ -15,6 +15,11 @@
  *	* X.25
  *
  * Use sethdlc utility to set line parameters, protocol and PVCs
+ *
+ * How does it work:
+ * - proto.open(), close(), start(), stop() calls are serialized.
+ *   The order is: open, [ start, stop ... ] close ...
+ * - proto.start() and stop() are called with spin_lock_irq held.
  */
 
 #include <linux/config.h>
@@ -33,7 +38,7 @@
 #include <linux/hdlc.h>
 
 
-static const char* version = "HDLC support module revision 1.16";
+static const char* version = "HDLC support module revision 1.17";
 
 #undef DEBUG_LINK
 
@@ -69,51 +74,75 @@
 
 
 
+static void __hdlc_set_carrier_on(struct net_device *dev)
+{
+	hdlc_device *hdlc = dev_to_hdlc(dev);
+	if (hdlc->proto.start)
+		return hdlc->proto.start(dev);
+#ifdef DEBUG_LINK
+	if (netif_carrier_ok(dev))
+		printk(KERN_ERR "hdlc_set_carrier_on(): already on\n");
+#endif
+	netif_carrier_on(dev);
+}
+
+
+
+static void __hdlc_set_carrier_off(struct net_device *dev)
+{
+	hdlc_device *hdlc = dev_to_hdlc(dev);
+	if (hdlc->proto.stop)
+		return hdlc->proto.stop(dev);
+
+#ifdef DEBUG_LINK
+	if (!netif_carrier_ok(dev))
+		printk(KERN_ERR "hdlc_set_carrier_off(): already off\n");
+#endif
+	netif_carrier_off(dev);
+}
+
+
+
 void hdlc_set_carrier(int on, struct net_device *dev)
 {
 	hdlc_device *hdlc = dev_to_hdlc(dev);
+	unsigned long flags;
 	on = on ? 1 : 0;
 
 #ifdef DEBUG_LINK
 	printk(KERN_DEBUG "hdlc_set_carrier %i\n", on);
 #endif
 
-	spin_lock_irq(&hdlc->state_lock);
+	spin_lock_irqsave(&hdlc->state_lock, flags);
 
 	if (hdlc->carrier == on)
 		goto carrier_exit; /* no change in DCD line level */
 
-	printk(KERN_INFO "%s: carrier %s\n", dev->name,
-	       on ? "ON" : "off");
+#ifdef DEBUG_LINK
+	printk(KERN_INFO "%s: carrier %s\n", dev->name, on ? "ON" : "off");
+#endif
 	hdlc->carrier = on;
 
 	if (!hdlc->open)
 		goto carrier_exit;
 
-	if (hdlc->carrier) {
-		if (hdlc->proto.start)
-			hdlc->proto.start(dev);
-		else if (!netif_carrier_ok(dev))
-			netif_carrier_on(dev);
-
-	} else { /* no carrier */
-		if (hdlc->proto.stop)
-			hdlc->proto.stop(dev);
-		else if (netif_carrier_ok(dev))
-			netif_carrier_off(dev);
-	}
+	if (hdlc->carrier)
+		__hdlc_set_carrier_on(dev);
+	else
+		__hdlc_set_carrier_off(dev);
 
- carrier_exit:
-	spin_unlock_irq(&hdlc->state_lock);
+carrier_exit:
+	spin_unlock_irqrestore(&hdlc->state_lock, flags);
 }
 
 
+
 /* Must be called by hardware driver when HDLC device is being opened */
 int hdlc_open(struct net_device *dev)
 {
 	hdlc_device *hdlc = dev_to_hdlc(dev);
 #ifdef DEBUG_LINK
-	printk(KERN_DEBUG "hdlc_open carrier %i open %i\n",
+	printk(KERN_DEBUG "hdlc_open() carrier %i open %i\n",
 	       hdlc->carrier, hdlc->open);
 #endif
 
@@ -128,14 +157,8 @@
 
 	spin_lock_irq(&hdlc->state_lock);
 
-	if (hdlc->carrier) {
-		if (hdlc->proto.start)
-			hdlc->proto.start(dev);
-		else if (!netif_carrier_ok(dev))
-			netif_carrier_on(dev);
-
-	} else if (netif_carrier_ok(dev))
-		netif_carrier_off(dev);
+	if (hdlc->carrier)
+		__hdlc_set_carrier_on(dev);
 
 	hdlc->open = 1;
 
@@ -150,15 +173,15 @@
 {
 	hdlc_device *hdlc = dev_to_hdlc(dev);
 #ifdef DEBUG_LINK
-	printk(KERN_DEBUG "hdlc_close carrier %i open %i\n",
+	printk(KERN_DEBUG "hdlc_close() carrier %i open %i\n",
 	       hdlc->carrier, hdlc->open);
 #endif
 
 	spin_lock_irq(&hdlc->state_lock);
 
 	hdlc->open = 0;
-	if (hdlc->carrier && hdlc->proto.stop)
-		hdlc->proto.stop(dev);
+	if (hdlc->carrier)
+		__hdlc_set_carrier_off(dev);
 
 	spin_unlock_irq(&hdlc->state_lock);
 
@@ -185,7 +208,7 @@
 #endif
 
 #ifndef CONFIG_HDLC_FR
-#define hdlc_fr_ioctl(dev, ifr)	-ENOSYS
+#define hdlc_fr_ioctl(dev, ifr)		-ENOSYS
 #endif
 
 #ifndef CONFIG_HDLC_X25
@@ -257,31 +280,16 @@
 
 int register_hdlc_device(struct net_device *dev)
 {
-	int result;
-	hdlc_device *hdlc = dev_to_hdlc(dev);
-
-	dev->get_stats = hdlc_get_stats;
-	dev->change_mtu = hdlc_change_mtu;
-	dev->mtu = HDLC_MAX_MTU;
-
-	dev->type = ARPHRD_RAWHDLC;
-	dev->hard_header_len = 16;
-
-	dev->flags = IFF_POINTOPOINT | IFF_NOARP;
-
-	hdlc->proto.id = -1;
-	hdlc->proto.detach = NULL;
-	hdlc->carrier = 1;
-	hdlc->open = 0;
-	spin_lock_init(&hdlc->state_lock);
-
-	result = dev_alloc_name(dev, "hdlc%d");
+	int result = dev_alloc_name(dev, "hdlc%d");
 	if (result < 0)
 		return result;
 
 	result = register_netdev(dev);
 	if (result != 0)
 		return -EIO;
+
+	if (netif_carrier_ok(dev))
+		netif_carrier_off(dev); /* no carrier until DCD goes up */
 
 	return 0;
 }
diff -Nru a/drivers/net/wan/wanxl.c b/drivers/net/wan/wanxl.c
--- a/drivers/net/wan/wanxl.c	2004-06-02 23:27:00 -07:00
+++ b/drivers/net/wan/wanxl.c	2004-06-02 23:27:00 -07:00
@@ -418,8 +418,10 @@
 
 	timeout = jiffies + HZ;
 	do
-		if (get_status(port)->open)
+		if (get_status(port)->open) {
+			netif_start_queue(dev);
 			return 0;
+		}
 	while (time_after(timeout, jiffies));
 
 	printk(KERN_ERR "%s: unable to open port\n", dev->name);
@@ -449,6 +451,8 @@
 
 	if (get_status(port)->open)
 		printk(KERN_ERR "%s: unable to close port\n", dev->name);
+
+	netif_stop_queue(dev);
 
 	for (i = 0; i < TX_BUFFERS; i++) {
 		desc_t *desc = &get_status(port)->tx_descs[i];
diff -Nru a/drivers/net/wan/wanxlfw.inc b/drivers/net/wan/wanxlfw.inc
--- a/drivers/net/wan/wanxlfw.inc	2004-06-02 23:26:59 -07:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,158 +0,0 @@
-static u8 firmware[]={
-0x60,0x00,0x00,0x16,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0xB9,0x40,0x00,0x00,0x00,0x00,0x00,
-0x10,0x14,0x42,0x80,0x4A,0xB0,0x09,0xB0,0x00,0x00,0x10,0x04,0x67,0x00,0x00,0x0E,
-0x06,0xB0,0x40,0x00,0x00,0x00,0x09,0xB0,0x00,0x00,0x10,0x04,0x58,0x80,0x0C,0x80,
-0x00,0x00,0x00,0x10,0x66,0x00,0xFF,0xDE,0x21,0xFC,0x00,0x00,0x16,0xBC,0x00,0x6C,
-0x21,0xFC,0x00,0x00,0x17,0x5E,0x01,0x00,0x21,0xFC,0x00,0x00,0x16,0xDE,0x01,0x78,
-0x21,0xFC,0x00,0x00,0x16,0xFE,0x01,0x74,0x21,0xFC,0x00,0x00,0x17,0x1E,0x01,0x70,
-0x21,0xFC,0x00,0x00,0x17,0x3E,0x01,0x6C,0x21,0xFC,0x00,0x00,0x18,0x4C,0x02,0x00,
-0x23,0xFC,0x78,0x00,0x00,0x00,0xFF,0xFC,0x15,0x48,0x33,0xFC,0x04,0x80,0xFF,0xFC,
-0x10,0x26,0x33,0xFC,0x01,0x10,0xFF,0xFC,0x10,0x2A,0x23,0xFC,0x00,0xD4,0x9F,0x40,
-0xFF,0xFC,0x15,0x40,0x23,0xFC,0x00,0x00,0x05,0x43,0xFF,0xF9,0x01,0x00,0x23,0xFC,
-0x00,0x00,0x05,0x43,0xFF,0xF9,0x01,0x14,0x23,0xFC,0x00,0x00,0x00,0x00,0xFF,0xF9,
-0x01,0x10,0x23,0xFC,0x00,0x00,0x00,0x08,0xFF,0xF9,0x01,0x24,0x23,0xFC,0x00,0x00,
-0x01,0x01,0xFF,0xF9,0x01,0x28,0x00,0xB9,0x00,0x0F,0x03,0x00,0xFF,0xF9,0x00,0xE8,
-0x23,0xFC,0x00,0x00,0x00,0x01,0xFF,0xF9,0x00,0xD4,0x61,0x00,0x06,0x74,0x33,0xFC,
-0xFF,0xFF,0xFF,0xFC,0x15,0x52,0x42,0x79,0xFF,0xFC,0x15,0x50,0x42,0x79,0xFF,0xFC,
-0x15,0x64,0x2E,0x3A,0x08,0x50,0x42,0xB9,0x00,0x00,0x19,0x54,0x4A,0x87,0x66,0x00,
-0x00,0x0E,0x4E,0x72,0x22,0x00,0x46,0xFC,0x27,0x00,0x60,0x00,0xFF,0xE6,0x42,0x80,
-0x42,0x86,0x08,0x07,0x00,0x04,0x67,0x00,0x00,0x0A,0x08,0x87,0x00,0x00,0x61,0x00,
-0x02,0xA0,0x08,0x07,0x00,0x00,0x67,0x00,0x00,0x06,0x61,0x00,0x00,0x36,0x08,0x07,
-0x00,0x08,0x67,0x00,0x00,0x06,0x61,0x00,0x02,0xB8,0x08,0x07,0x00,0x0C,0x67,0x00,
-0x00,0x0A,0x61,0x00,0x04,0x94,0x61,0x00,0x03,0x60,0xE2,0x8F,0x58,0x80,0x0C,0x80,
-0x00,0x00,0x00,0x10,0x66,0x00,0xFF,0xBC,0x23,0xC6,0xFF,0xF9,0x00,0xE4,0x60,0x00,
-0xFF,0x92,0x20,0x70,0x09,0xB0,0x00,0x00,0x10,0x04,0x4A,0xA8,0x00,0x00,0x66,0x00,
-0x02,0x4E,0x21,0x7C,0x00,0x00,0x00,0x01,0x00,0x00,0x42,0xB0,0x09,0xB0,0x00,0x00,
-0x19,0x58,0x42,0xB0,0x09,0xB0,0x00,0x00,0x19,0x68,0x42,0xB0,0x09,0xB0,0x00,0x00,
-0x19,0x78,0x42,0xB0,0x09,0xB0,0x00,0x00,0x19,0x88,0x22,0x39,0xFF,0xFC,0x16,0xEC,
-0xC2,0xB0,0x09,0xB0,0x00,0x00,0x18,0xF2,0x0C,0xA8,0x00,0x00,0x00,0x04,0x00,0x18,
-0x66,0x00,0x00,0x0E,0x82,0xB0,0x09,0xB0,0x00,0x00,0x18,0xE2,0x60,0x00,0x00,0x0A,
-0x82,0xB0,0x09,0xB0,0x00,0x00,0x18,0xD2,0x23,0xC1,0xFF,0xFC,0x16,0xEC,0x00,0x70,
-0x10,0x00,0x09,0xB0,0x00,0x00,0x19,0xAA,0x61,0x00,0x05,0x76,0x22,0x30,0x09,0xB0,
-0x00,0x00,0x18,0x92,0x22,0x70,0x09,0xB0,0x00,0x00,0x18,0x72,0x74,0x08,0x26,0x3C,
-0x18,0x00,0x00,0x00,0x0C,0xA8,0x00,0x00,0x00,0x01,0x00,0x10,0x67,0x00,0x00,0x06,
-0x08,0xC3,0x00,0x1A,0x22,0xC3,0x22,0xC1,0x06,0x81,0x00,0x00,0x05,0xFC,0x51,0xCA,
-0xFF,0xF4,0x08,0xC3,0x00,0x1D,0x22,0xC3,0x22,0xC1,0x74,0x1C,0x22,0xFC,0x90,0x00,
-0x00,0x00,0x22,0xC1,0x06,0x81,0x00,0x00,0x05,0xFC,0x51,0xCA,0xFF,0xF0,0x22,0xFC,
-0xB0,0x00,0x00,0x00,0x22,0xC1,0x22,0x70,0x09,0xB0,0x00,0x00,0x18,0x62,0x24,0x70,
-0x09,0xB0,0x00,0x00,0x18,0x52,0x25,0x7C,0x00,0x00,0xFF,0xFF,0x00,0x10,0x25,0x7C,
-0x00,0x00,0x00,0x00,0x00,0x14,0x22,0x30,0x09,0xB0,0x00,0x00,0x18,0x72,0x33,0x41,
-0x00,0x02,0x06,0x81,0x00,0x00,0x00,0x50,0x33,0x41,0x00,0x00,0x13,0x7C,0x00,0x08,
-0x00,0x04,0x13,0x7C,0x00,0x08,0x00,0x05,0x0C,0xA8,0x00,0x00,0x00,0x05,0x00,0x10,
-0x66,0x00,0x00,0x2A,0x42,0x6A,0x00,0x08,0x23,0x7C,0x00,0x00,0xF0,0xB8,0x00,0x34,
-0x23,0x7C,0x00,0x00,0xFF,0xFF,0x00,0x38,0x33,0x7C,0x05,0xFA,0x00,0x46,0x31,0xBC,
-0x00,0x02,0x09,0xB0,0x00,0x00,0x19,0x9C,0x60,0x00,0x00,0xBC,0x0C,0xA8,0x00,0x00,
-0x00,0x07,0x00,0x10,0x66,0x00,0x00,0x2C,0x35,0x7C,0x08,0x00,0x00,0x08,0x23,0x7C,
-0xDE,0xBB,0x20,0xE3,0x00,0x34,0x23,0x7C,0xFF,0xFF,0xFF,0xFF,0x00,0x38,0x33,0x7C,
-0x05,0xFC,0x00,0x46,0x31,0xBC,0x00,0x04,0x09,0xB0,0x00,0x00,0x19,0x9C,0x60,0x00,
-0x00,0x86,0x0C,0xA8,0x00,0x00,0x00,0x04,0x00,0x10,0x66,0x00,0x00,0x26,0x42,0x6A,
-0x00,0x08,0x23,0x7C,0x00,0x00,0xF0,0xB8,0x00,0x34,0x42,0xA9,0x00,0x38,0x33,0x7C,
-0x05,0xFA,0x00,0x46,0x31,0xBC,0x00,0x02,0x09,0xB0,0x00,0x00,0x19,0x9C,0x60,0x00,
-0x00,0x56,0x0C,0xA8,0x00,0x00,0x00,0x06,0x00,0x10,0x66,0x00,0x00,0x28,0x35,0x7C,
-0x08,0x00,0x00,0x08,0x23,0x7C,0xDE,0xBB,0x20,0xE3,0x00,0x34,0x42,0xA9,0x00,0x38,
-0x33,0x7C,0x05,0xFC,0x00,0x46,0x31,0xBC,0x00,0x04,0x09,0xB0,0x00,0x00,0x19,0x9C,
-0x60,0x00,0x00,0x24,0x42,0x6A,0x00,0x08,0x23,0x7C,0x00,0x00,0xF0,0xB8,0x00,0x34,
-0x23,0x7C,0x00,0x00,0xFF,0xFF,0x00,0x38,0x33,0x7C,0x05,0xF8,0x00,0x46,0x42,0x70,
-0x09,0xB0,0x00,0x00,0x19,0x9C,0x25,0x7C,0x00,0x00,0x00,0x03,0x00,0x04,0x0C,0xA8,
-0x00,0x00,0x00,0x02,0x00,0x14,0x66,0x00,0x00,0x0E,0x25,0x7C,0x10,0x04,0x09,0x00,
-0x00,0x00,0x60,0x00,0x00,0x0A,0x25,0x7C,0x10,0x04,0x00,0x00,0x00,0x00,0x33,0x7C,
-0x05,0xFC,0x00,0x06,0x22,0x00,0xE9,0x89,0x00,0x81,0x00,0x00,0x00,0x01,0x33,0xC1,
-0xFF,0xFC,0x15,0xC0,0x08,0x39,0x00,0x00,0xFF,0xFC,0x15,0xC0,0x66,0x00,0xFF,0xF6,
-0x35,0x7C,0x00,0x1F,0x00,0x14,0x00,0xAA,0x00,0x00,0x00,0x30,0x00,0x00,0x4E,0x75,
-0x20,0x70,0x09,0xB0,0x00,0x00,0x18,0x52,0x42,0x68,0x00,0x14,0x02,0xA8,0xFF,0xFF,
-0xFF,0xCF,0x00,0x00,0x02,0x70,0xEF,0xFF,0x09,0xB0,0x00,0x00,0x19,0xAA,0x61,0x00,
-0x03,0x70,0x22,0x30,0x09,0xB0,0x00,0x00,0x10,0x04,0x42,0xB0,0x19,0x90,0x4E,0x75,
-0x0C,0xB0,0x00,0x00,0x00,0x0A,0x09,0xB0,0x00,0x00,0x19,0x78,0x67,0x00,0x00,0xA8,
-0x22,0x30,0x09,0xB0,0x00,0x00,0x19,0x68,0x24,0x01,0x4C,0x3C,0x20,0x00,0x00,0x00,
-0x00,0x0C,0xD4,0xB0,0x09,0xB0,0x00,0x00,0x10,0x04,0x06,0x82,0x00,0x00,0x00,0x1C,
-0x0C,0xB0,0x00,0x00,0x00,0x10,0x29,0x90,0x66,0x00,0x00,0x7C,0x20,0x70,0x29,0xA0,
-0x00,0x04,0xE7,0x89,0xD2,0xB0,0x09,0xB0,0x00,0x00,0x18,0x72,0x22,0x70,0x19,0xA0,
-0x00,0x04,0x24,0x30,0x29,0xA0,0x00,0x08,0x31,0x82,0x19,0xA0,0x00,0x02,0x56,0x82,
-0x02,0x82,0xFF,0xFF,0xFF,0xFC,0x23,0xC8,0xFF,0xF9,0x01,0x04,0x23,0xC9,0xFF,0xF9,
-0x01,0x08,0x23,0xC2,0xFF,0xF9,0x01,0x0C,0x23,0xFC,0x00,0x00,0x01,0x03,0xFF,0xF9,
-0x01,0x28,0x61,0x00,0x01,0xF6,0x08,0xF0,0x00,0x1F,0x19,0x90,0x22,0x30,0x09,0xB0,
-0x00,0x00,0x19,0x68,0x52,0x81,0x0C,0x81,0x00,0x00,0x00,0x0A,0x66,0x00,0x00,0x04,
-0x42,0x81,0x21,0x81,0x09,0xB0,0x00,0x00,0x19,0x68,0x52,0xB0,0x09,0xB0,0x00,0x00,
-0x19,0x78,0x60,0x00,0xFF,0x4C,0x4E,0x75,0x22,0x30,0x09,0xB0,0x00,0x00,0x19,0x88,
-0xE7,0x89,0xD2,0xB0,0x09,0xB0,0x00,0x00,0x18,0x82,0x34,0x30,0x19,0x90,0x08,0x02,
-0x00,0x0F,0x66,0x00,0x01,0x12,0x08,0x02,0x00,0x01,0x66,0x00,0x00,0xE6,0x4A,0x70,
-0x09,0xB0,0x00,0x00,0x19,0x9C,0x66,0x00,0x00,0x06,0x08,0x82,0x00,0x02,0x02,0x42,
-0x0C,0xBC,0x0C,0x42,0x0C,0x00,0x66,0x00,0x00,0xDC,0x42,0x83,0x36,0x30,0x19,0xA0,
-0x00,0x02,0x96,0x70,0x09,0xB0,0x00,0x00,0x19,0x9C,0x0C,0x43,0x05,0xF8,0x6E,0x00,
-0x00,0xC4,0x24,0x3A,0x04,0x84,0x4C,0x3C,0x20,0x00,0x00,0x00,0x00,0x0C,0xD4,0xBA,
-0xFA,0xF4,0x0C,0xB0,0x00,0x00,0x00,0x00,0x29,0x90,0x66,0x00,0x00,0x96,0x21,0x83,
-0x29,0xA0,0x00,0x08,0x20,0x70,0x19,0xA0,0x00,0x04,0x22,0x70,0x29,0xA0,0x00,0x04,
-0x4A,0x89,0x67,0x00,0x00,0x2A,0x56,0x83,0x02,0x83,0xFF,0xFF,0xFF,0xFC,0x23,0xC8,
-0xFF,0xF9,0x01,0x1C,0x23,0xC9,0xFF,0xF9,0x01,0x18,0x23,0xC3,0xFF,0xF9,0x01,0x20,
-0x23,0xFC,0x00,0x00,0x03,0x01,0xFF,0xF9,0x01,0x28,0x61,0x00,0x01,0x2C,0x21,0xB0,
-0x09,0xB0,0x00,0x00,0x18,0xC2,0x29,0x90,0x08,0xC6,0x00,0x04,0x24,0x3A,0x04,0x1A,
-0x52,0x82,0x0C,0x82,0x00,0x00,0x00,0x28,0x66,0x00,0x00,0x04,0x42,0x82,0x23,0xC2,
-0x00,0x00,0x19,0x98,0x02,0x70,0xF0,0x00,0x19,0x90,0x08,0xF0,0x00,0x1F,0x19,0x90,
-0x22,0x30,0x09,0xB0,0x00,0x00,0x19,0x88,0x52,0x81,0x0C,0x81,0x00,0x00,0x00,0x1E,
-0x66,0x00,0x00,0x04,0x42,0x81,0x21,0x81,0x09,0xB0,0x00,0x00,0x19,0x88,0x60,0x00,
-0xFE,0xF8,0x24,0x30,0x09,0xB0,0x00,0x00,0x10,0x04,0x52,0xB0,0x29,0xA0,0x00,0x08,
-0x60,0x00,0xFF,0xC2,0x24,0x30,0x09,0xB0,0x00,0x00,0x10,0x04,0x52,0xB0,0x29,0xA0,
-0x00,0x0C,0x60,0x00,0xFF,0xB0,0x4E,0x75,0x4A,0xB0,0x09,0xB0,0x00,0x00,0x19,0x78,
-0x67,0x00,0x00,0x86,0x22,0x30,0x09,0xB0,0x00,0x00,0x19,0x58,0x24,0x01,0xE7,0x89,
-0xD2,0xB0,0x09,0xB0,0x00,0x00,0x18,0x72,0x36,0x30,0x19,0x90,0x08,0x03,0x00,0x0F,
-0x66,0x00,0x00,0x66,0x8C,0xB0,0x09,0xB0,0x00,0x00,0x18,0xA2,0x53,0xB0,0x09,0xB0,
-0x00,0x00,0x19,0x78,0x22,0x30,0x09,0xB0,0x00,0x00,0x19,0x58,0x52,0x81,0x0C,0x81,
-0x00,0x00,0x00,0x0A,0x66,0x00,0x00,0x04,0x42,0x81,0x21,0x81,0x09,0xB0,0x00,0x00,
-0x19,0x58,0x4C,0x3C,0x20,0x00,0x00,0x00,0x00,0x0C,0xD4,0xB0,0x09,0xB0,0x00,0x00,
-0x10,0x04,0x06,0x82,0x00,0x00,0x00,0x1C,0x08,0x03,0x00,0x01,0x66,0x00,0x00,0x0E,
-0x21,0xBC,0x00,0x00,0x00,0x20,0x29,0x90,0x60,0x00,0xFF,0x7E,0x21,0xBC,0x00,0x00,
-0x00,0x30,0x29,0x90,0x60,0x00,0xFF,0x72,0x4E,0x75,0x2F,0x00,0x40,0xE7,0x20,0x39,
-0xFF,0xF9,0x01,0x28,0x08,0x00,0x00,0x04,0x66,0x00,0x00,0x2C,0x4E,0x72,0x22,0x00,
-0x46,0xFC,0x27,0x00,0x60,0x00,0xFF,0xE8,0x2F,0x00,0x40,0xE7,0x20,0x39,0xFF,0xF9,
-0x01,0x28,0x08,0x00,0x00,0x0C,0x66,0x00,0x00,0x0E,0x4E,0x72,0x22,0x00,0x46,0xFC,
-0x27,0x00,0x60,0x00,0xFF,0xE8,0x46,0xDF,0x20,0x1F,0x4E,0x75,0x2F,0x00,0x20,0x39,
-0xFF,0xF9,0x00,0xE0,0x23,0xC0,0xFF,0xF9,0x00,0xE0,0x81,0xB9,0x00,0x00,0x19,0x54,
-0x23,0xFC,0x00,0x00,0x09,0x09,0xFF,0xF9,0x01,0x28,0x20,0x1F,0x4E,0x73,0x00,0xB9,
-0x00,0x00,0x00,0x00,0xFF,0xFC,0x16,0x10,0x00,0xB9,0x00,0x00,0x10,0x00,0x00,0x00,
-0x19,0x54,0x23,0xFC,0x40,0x00,0x00,0x00,0xFF,0xFC,0x15,0x4C,0x4E,0x73,0x00,0xB9,
-0x00,0x00,0x00,0x00,0xFF,0xFC,0x16,0x30,0x00,0xB9,0x00,0x00,0x20,0x00,0x00,0x00,
-0x19,0x54,0x23,0xFC,0x20,0x00,0x00,0x00,0xFF,0xFC,0x15,0x4C,0x4E,0x73,0x00,0xB9,
-0x00,0x00,0x00,0x00,0xFF,0xFC,0x16,0x50,0x00,0xB9,0x00,0x00,0x40,0x00,0x00,0x00,
-0x19,0x54,0x23,0xFC,0x10,0x00,0x00,0x00,0xFF,0xFC,0x15,0x4C,0x4E,0x73,0x00,0xB9,
-0x00,0x00,0x00,0x00,0xFF,0xFC,0x16,0x70,0x00,0xB9,0x00,0x00,0x80,0x00,0x00,0x00,
-0x19,0x54,0x23,0xFC,0x08,0x00,0x00,0x00,0xFF,0xFC,0x15,0x4C,0x4E,0x73,0x4E,0x73,
-0x2F,0x00,0x2F,0x01,0x2F,0x02,0x2F,0x08,0x2F,0x09,0x42,0x80,0x20,0x7C,0xFF,0xFB,
-0x00,0x00,0x32,0x10,0x02,0x81,0x00,0x00,0x00,0xE7,0x0C,0x41,0x00,0x42,0x66,0x00,
-0x00,0x0A,0x32,0x3C,0x0E,0x08,0x60,0x00,0x00,0x3E,0x0C,0x41,0x00,0x63,0x66,0x00,
-0x00,0x0A,0x32,0x3C,0x04,0x08,0x60,0x00,0x00,0x2E,0x0C,0x41,0x00,0x84,0x66,0x00,
-0x00,0x0A,0x32,0x3C,0x02,0x08,0x60,0x00,0x00,0x1E,0x0C,0x41,0x00,0xA5,0x66,0x00,
-0x00,0x0A,0x32,0x3C,0x0D,0x08,0x60,0x00,0x00,0x0E,0x32,0x3C,0x00,0x08,0x34,0x3C,
-0x80,0xE7,0x60,0x00,0x00,0x14,0x34,0x30,0x09,0xB0,0x00,0x00,0x19,0xAA,0x02,0x42,
-0x30,0x00,0x82,0x42,0x34,0x3C,0x80,0xFF,0xB2,0x70,0x09,0xB0,0x00,0x00,0x19,0xAC,
-0x67,0x00,0x00,0x0C,0x31,0x81,0x09,0xB0,0x00,0x00,0x19,0xAC,0x30,0x81,0x32,0x39,
-0xFF,0xFC,0x15,0x66,0xC2,0x70,0x09,0xB0,0x00,0x00,0x19,0x02,0x67,0x00,0x00,0x0C,
-0x32,0x10,0x02,0x41,0xFF,0xF7,0x60,0x00,0x00,0x08,0x32,0x10,0x00,0x41,0x00,0x08,
-0xC2,0x42,0x22,0x70,0x09,0xB0,0x00,0x00,0x10,0x04,0xB2,0xA9,0x00,0x04,0x67,0x00,
-0x00,0x12,0x23,0x41,0x00,0x04,0x23,0xF0,0x09,0xB0,0x00,0x00,0x18,0xB2,0xFF,0xF9,
-0x00,0xE4,0x54,0x88,0x58,0x80,0x0C,0x80,0x00,0x00,0x00,0x10,0x66,0x00,0xFF,0x34,
-0x22,0x5F,0x20,0x5F,0x24,0x1F,0x22,0x1F,0x20,0x1F,0x4E,0x75,0x61,0x00,0xFF,0x12,
-0x4E,0x73,0xFF,0xFC,0x16,0x00,0xFF,0xFC,0x16,0x20,0xFF,0xFC,0x16,0x40,0xFF,0xFC,
-0x16,0x60,0xFF,0xFC,0x0C,0x00,0xFF,0xFC,0x0D,0x00,0xFF,0xFC,0x0E,0x00,0xFF,0xFC,
-0x0F,0x00,0xFF,0xFC,0x00,0x00,0xFF,0xFC,0x01,0x40,0xFF,0xFC,0x02,0x80,0xFF,0xFC,
-0x03,0xC0,0xFF,0xFC,0x00,0x50,0xFF,0xFC,0x01,0x90,0xFF,0xFC,0x02,0xD0,0xFF,0xFC,
-0x04,0x10,0x00,0x00,0x40,0x00,0x00,0x01,0x2F,0x60,0x00,0x02,0x1E,0xC0,0x00,0x03,
-0x0E,0x20,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x04,0x00,0x00,
-0x00,0x08,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x80,0x00,0x00,
-0x01,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x11,0x00,0x00,0x00,0x12,0x00,0x00,
-0x00,0x13,0x00,0x00,0x00,0x2C,0x00,0x00,0x3E,0x00,0x00,0x2C,0x00,0x00,0x3E,0x00,
-0x00,0x00,0x00,0x00,0x00,0x2D,0x00,0x00,0x3F,0x00,0x00,0x2D,0x00,0x00,0x3F,0x00,
-0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,
-0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x80,0x00,0x00,0x02,0x00,0x00,0x00,0x08,0x00,
-0x77,0x61,0x6E,0x58,0x4C,0x20,0x66,0x69,0x72,0x6D,0x77,0x61,0x72,0x65,0x0A,0x43,
-0x6F,0x70,0x79,0x72,0x69,0x67,0x68,0x74,0x20,0x28,0x43,0x29,0x20,0x32,0x30,0x30,
-0x33,0x20,0x4B,0x72,0x7A,0x79,0x73,0x7A,0x74,0x6F,0x66,0x20,0x48,0x61,0x6C,0x61,
-0x73,0x61,0x20,0x3C,0x6B,0x68,0x63,0x40,0x70,0x6D,0x2E,0x77,0x61,0x77,0x2E,0x70,
-0x6C,0x3E,0x0A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
-};
diff -Nru a/drivers/net/wan/wanxlfw.inc_shipped b/drivers/net/wan/wanxlfw.inc_shipped
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/net/wan/wanxlfw.inc_shipped	2004-06-02 23:26:59 -07:00
@@ -0,0 +1,158 @@
+static u8 firmware[]={
+0x60,0x00,0x00,0x16,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0xB9,0x40,0x00,0x00,0x00,0x00,0x00,
+0x10,0x14,0x42,0x80,0x4A,0xB0,0x09,0xB0,0x00,0x00,0x10,0x04,0x67,0x00,0x00,0x0E,
+0x06,0xB0,0x40,0x00,0x00,0x00,0x09,0xB0,0x00,0x00,0x10,0x04,0x58,0x80,0x0C,0x80,
+0x00,0x00,0x00,0x10,0x66,0x00,0xFF,0xDE,0x21,0xFC,0x00,0x00,0x16,0xBC,0x00,0x6C,
+0x21,0xFC,0x00,0x00,0x17,0x5E,0x01,0x00,0x21,0xFC,0x00,0x00,0x16,0xDE,0x01,0x78,
+0x21,0xFC,0x00,0x00,0x16,0xFE,0x01,0x74,0x21,0xFC,0x00,0x00,0x17,0x1E,0x01,0x70,
+0x21,0xFC,0x00,0x00,0x17,0x3E,0x01,0x6C,0x21,0xFC,0x00,0x00,0x18,0x4C,0x02,0x00,
+0x23,0xFC,0x78,0x00,0x00,0x00,0xFF,0xFC,0x15,0x48,0x33,0xFC,0x04,0x80,0xFF,0xFC,
+0x10,0x26,0x33,0xFC,0x01,0x10,0xFF,0xFC,0x10,0x2A,0x23,0xFC,0x00,0xD4,0x9F,0x40,
+0xFF,0xFC,0x15,0x40,0x23,0xFC,0x00,0x00,0x05,0x43,0xFF,0xF9,0x01,0x00,0x23,0xFC,
+0x00,0x00,0x05,0x43,0xFF,0xF9,0x01,0x14,0x23,0xFC,0x00,0x00,0x00,0x00,0xFF,0xF9,
+0x01,0x10,0x23,0xFC,0x00,0x00,0x00,0x08,0xFF,0xF9,0x01,0x24,0x23,0xFC,0x00,0x00,
+0x01,0x01,0xFF,0xF9,0x01,0x28,0x00,0xB9,0x00,0x0F,0x03,0x00,0xFF,0xF9,0x00,0xE8,
+0x23,0xFC,0x00,0x00,0x00,0x01,0xFF,0xF9,0x00,0xD4,0x61,0x00,0x06,0x74,0x33,0xFC,
+0xFF,0xFF,0xFF,0xFC,0x15,0x52,0x42,0x79,0xFF,0xFC,0x15,0x50,0x42,0x79,0xFF,0xFC,
+0x15,0x64,0x2E,0x3A,0x08,0x50,0x42,0xB9,0x00,0x00,0x19,0x54,0x4A,0x87,0x66,0x00,
+0x00,0x0E,0x4E,0x72,0x22,0x00,0x46,0xFC,0x27,0x00,0x60,0x00,0xFF,0xE6,0x42,0x80,
+0x42,0x86,0x08,0x07,0x00,0x04,0x67,0x00,0x00,0x0A,0x08,0x87,0x00,0x00,0x61,0x00,
+0x02,0xA0,0x08,0x07,0x00,0x00,0x67,0x00,0x00,0x06,0x61,0x00,0x00,0x36,0x08,0x07,
+0x00,0x08,0x67,0x00,0x00,0x06,0x61,0x00,0x02,0xB8,0x08,0x07,0x00,0x0C,0x67,0x00,
+0x00,0x0A,0x61,0x00,0x04,0x94,0x61,0x00,0x03,0x60,0xE2,0x8F,0x58,0x80,0x0C,0x80,
+0x00,0x00,0x00,0x10,0x66,0x00,0xFF,0xBC,0x23,0xC6,0xFF,0xF9,0x00,0xE4,0x60,0x00,
+0xFF,0x92,0x20,0x70,0x09,0xB0,0x00,0x00,0x10,0x04,0x4A,0xA8,0x00,0x00,0x66,0x00,
+0x02,0x4E,0x21,0x7C,0x00,0x00,0x00,0x01,0x00,0x00,0x42,0xB0,0x09,0xB0,0x00,0x00,
+0x19,0x58,0x42,0xB0,0x09,0xB0,0x00,0x00,0x19,0x68,0x42,0xB0,0x09,0xB0,0x00,0x00,
+0x19,0x78,0x42,0xB0,0x09,0xB0,0x00,0x00,0x19,0x88,0x22,0x39,0xFF,0xFC,0x16,0xEC,
+0xC2,0xB0,0x09,0xB0,0x00,0x00,0x18,0xF2,0x0C,0xA8,0x00,0x00,0x00,0x04,0x00,0x18,
+0x66,0x00,0x00,0x0E,0x82,0xB0,0x09,0xB0,0x00,0x00,0x18,0xE2,0x60,0x00,0x00,0x0A,
+0x82,0xB0,0x09,0xB0,0x00,0x00,0x18,0xD2,0x23,0xC1,0xFF,0xFC,0x16,0xEC,0x00,0x70,
+0x10,0x00,0x09,0xB0,0x00,0x00,0x19,0xAA,0x61,0x00,0x05,0x76,0x22,0x30,0x09,0xB0,
+0x00,0x00,0x18,0x92,0x22,0x70,0x09,0xB0,0x00,0x00,0x18,0x72,0x74,0x08,0x26,0x3C,
+0x18,0x00,0x00,0x00,0x0C,0xA8,0x00,0x00,0x00,0x01,0x00,0x10,0x67,0x00,0x00,0x06,
+0x08,0xC3,0x00,0x1A,0x22,0xC3,0x22,0xC1,0x06,0x81,0x00,0x00,0x05,0xFC,0x51,0xCA,
+0xFF,0xF4,0x08,0xC3,0x00,0x1D,0x22,0xC3,0x22,0xC1,0x74,0x1C,0x22,0xFC,0x90,0x00,
+0x00,0x00,0x22,0xC1,0x06,0x81,0x00,0x00,0x05,0xFC,0x51,0xCA,0xFF,0xF0,0x22,0xFC,
+0xB0,0x00,0x00,0x00,0x22,0xC1,0x22,0x70,0x09,0xB0,0x00,0x00,0x18,0x62,0x24,0x70,
+0x09,0xB0,0x00,0x00,0x18,0x52,0x25,0x7C,0x00,0x00,0xFF,0xFF,0x00,0x10,0x25,0x7C,
+0x00,0x00,0x00,0x00,0x00,0x14,0x22,0x30,0x09,0xB0,0x00,0x00,0x18,0x72,0x33,0x41,
+0x00,0x02,0x06,0x81,0x00,0x00,0x00,0x50,0x33,0x41,0x00,0x00,0x13,0x7C,0x00,0x08,
+0x00,0x04,0x13,0x7C,0x00,0x08,0x00,0x05,0x0C,0xA8,0x00,0x00,0x00,0x05,0x00,0x10,
+0x66,0x00,0x00,0x2A,0x42,0x6A,0x00,0x08,0x23,0x7C,0x00,0x00,0xF0,0xB8,0x00,0x34,
+0x23,0x7C,0x00,0x00,0xFF,0xFF,0x00,0x38,0x33,0x7C,0x05,0xFA,0x00,0x46,0x31,0xBC,
+0x00,0x02,0x09,0xB0,0x00,0x00,0x19,0x9C,0x60,0x00,0x00,0xBC,0x0C,0xA8,0x00,0x00,
+0x00,0x07,0x00,0x10,0x66,0x00,0x00,0x2C,0x35,0x7C,0x08,0x00,0x00,0x08,0x23,0x7C,
+0xDE,0xBB,0x20,0xE3,0x00,0x34,0x23,0x7C,0xFF,0xFF,0xFF,0xFF,0x00,0x38,0x33,0x7C,
+0x05,0xFC,0x00,0x46,0x31,0xBC,0x00,0x04,0x09,0xB0,0x00,0x00,0x19,0x9C,0x60,0x00,
+0x00,0x86,0x0C,0xA8,0x00,0x00,0x00,0x04,0x00,0x10,0x66,0x00,0x00,0x26,0x42,0x6A,
+0x00,0x08,0x23,0x7C,0x00,0x00,0xF0,0xB8,0x00,0x34,0x42,0xA9,0x00,0x38,0x33,0x7C,
+0x05,0xFA,0x00,0x46,0x31,0xBC,0x00,0x02,0x09,0xB0,0x00,0x00,0x19,0x9C,0x60,0x00,
+0x00,0x56,0x0C,0xA8,0x00,0x00,0x00,0x06,0x00,0x10,0x66,0x00,0x00,0x28,0x35,0x7C,
+0x08,0x00,0x00,0x08,0x23,0x7C,0xDE,0xBB,0x20,0xE3,0x00,0x34,0x42,0xA9,0x00,0x38,
+0x33,0x7C,0x05,0xFC,0x00,0x46,0x31,0xBC,0x00,0x04,0x09,0xB0,0x00,0x00,0x19,0x9C,
+0x60,0x00,0x00,0x24,0x42,0x6A,0x00,0x08,0x23,0x7C,0x00,0x00,0xF0,0xB8,0x00,0x34,
+0x23,0x7C,0x00,0x00,0xFF,0xFF,0x00,0x38,0x33,0x7C,0x05,0xF8,0x00,0x46,0x42,0x70,
+0x09,0xB0,0x00,0x00,0x19,0x9C,0x25,0x7C,0x00,0x00,0x00,0x03,0x00,0x04,0x0C,0xA8,
+0x00,0x00,0x00,0x02,0x00,0x14,0x66,0x00,0x00,0x0E,0x25,0x7C,0x10,0x04,0x09,0x00,
+0x00,0x00,0x60,0x00,0x00,0x0A,0x25,0x7C,0x10,0x04,0x00,0x00,0x00,0x00,0x33,0x7C,
+0x05,0xFC,0x00,0x06,0x22,0x00,0xE9,0x89,0x00,0x81,0x00,0x00,0x00,0x01,0x33,0xC1,
+0xFF,0xFC,0x15,0xC0,0x08,0x39,0x00,0x00,0xFF,0xFC,0x15,0xC0,0x66,0x00,0xFF,0xF6,
+0x35,0x7C,0x00,0x1F,0x00,0x14,0x00,0xAA,0x00,0x00,0x00,0x30,0x00,0x00,0x4E,0x75,
+0x20,0x70,0x09,0xB0,0x00,0x00,0x18,0x52,0x42,0x68,0x00,0x14,0x02,0xA8,0xFF,0xFF,
+0xFF,0xCF,0x00,0x00,0x02,0x70,0xEF,0xFF,0x09,0xB0,0x00,0x00,0x19,0xAA,0x61,0x00,
+0x03,0x70,0x22,0x30,0x09,0xB0,0x00,0x00,0x10,0x04,0x42,0xB0,0x19,0x90,0x4E,0x75,
+0x0C,0xB0,0x00,0x00,0x00,0x0A,0x09,0xB0,0x00,0x00,0x19,0x78,0x67,0x00,0x00,0xA8,
+0x22,0x30,0x09,0xB0,0x00,0x00,0x19,0x68,0x24,0x01,0x4C,0x3C,0x20,0x00,0x00,0x00,
+0x00,0x0C,0xD4,0xB0,0x09,0xB0,0x00,0x00,0x10,0x04,0x06,0x82,0x00,0x00,0x00,0x1C,
+0x0C,0xB0,0x00,0x00,0x00,0x10,0x29,0x90,0x66,0x00,0x00,0x7C,0x20,0x70,0x29,0xA0,
+0x00,0x04,0xE7,0x89,0xD2,0xB0,0x09,0xB0,0x00,0x00,0x18,0x72,0x22,0x70,0x19,0xA0,
+0x00,0x04,0x24,0x30,0x29,0xA0,0x00,0x08,0x31,0x82,0x19,0xA0,0x00,0x02,0x56,0x82,
+0x02,0x82,0xFF,0xFF,0xFF,0xFC,0x23,0xC8,0xFF,0xF9,0x01,0x04,0x23,0xC9,0xFF,0xF9,
+0x01,0x08,0x23,0xC2,0xFF,0xF9,0x01,0x0C,0x23,0xFC,0x00,0x00,0x01,0x03,0xFF,0xF9,
+0x01,0x28,0x61,0x00,0x01,0xF6,0x08,0xF0,0x00,0x1F,0x19,0x90,0x22,0x30,0x09,0xB0,
+0x00,0x00,0x19,0x68,0x52,0x81,0x0C,0x81,0x00,0x00,0x00,0x0A,0x66,0x00,0x00,0x04,
+0x42,0x81,0x21,0x81,0x09,0xB0,0x00,0x00,0x19,0x68,0x52,0xB0,0x09,0xB0,0x00,0x00,
+0x19,0x78,0x60,0x00,0xFF,0x4C,0x4E,0x75,0x22,0x30,0x09,0xB0,0x00,0x00,0x19,0x88,
+0xE7,0x89,0xD2,0xB0,0x09,0xB0,0x00,0x00,0x18,0x82,0x34,0x30,0x19,0x90,0x08,0x02,
+0x00,0x0F,0x66,0x00,0x01,0x12,0x08,0x02,0x00,0x01,0x66,0x00,0x00,0xE6,0x4A,0x70,
+0x09,0xB0,0x00,0x00,0x19,0x9C,0x66,0x00,0x00,0x06,0x08,0x82,0x00,0x02,0x02,0x42,
+0x0C,0xBC,0x0C,0x42,0x0C,0x00,0x66,0x00,0x00,0xDC,0x42,0x83,0x36,0x30,0x19,0xA0,
+0x00,0x02,0x96,0x70,0x09,0xB0,0x00,0x00,0x19,0x9C,0x0C,0x43,0x05,0xF8,0x6E,0x00,
+0x00,0xC4,0x24,0x3A,0x04,0x84,0x4C,0x3C,0x20,0x00,0x00,0x00,0x00,0x0C,0xD4,0xBA,
+0xFA,0xF4,0x0C,0xB0,0x00,0x00,0x00,0x00,0x29,0x90,0x66,0x00,0x00,0x96,0x21,0x83,
+0x29,0xA0,0x00,0x08,0x20,0x70,0x19,0xA0,0x00,0x04,0x22,0x70,0x29,0xA0,0x00,0x04,
+0x4A,0x89,0x67,0x00,0x00,0x2A,0x56,0x83,0x02,0x83,0xFF,0xFF,0xFF,0xFC,0x23,0xC8,
+0xFF,0xF9,0x01,0x1C,0x23,0xC9,0xFF,0xF9,0x01,0x18,0x23,0xC3,0xFF,0xF9,0x01,0x20,
+0x23,0xFC,0x00,0x00,0x03,0x01,0xFF,0xF9,0x01,0x28,0x61,0x00,0x01,0x2C,0x21,0xB0,
+0x09,0xB0,0x00,0x00,0x18,0xC2,0x29,0x90,0x08,0xC6,0x00,0x04,0x24,0x3A,0x04,0x1A,
+0x52,0x82,0x0C,0x82,0x00,0x00,0x00,0x28,0x66,0x00,0x00,0x04,0x42,0x82,0x23,0xC2,
+0x00,0x00,0x19,0x98,0x02,0x70,0xF0,0x00,0x19,0x90,0x08,0xF0,0x00,0x1F,0x19,0x90,
+0x22,0x30,0x09,0xB0,0x00,0x00,0x19,0x88,0x52,0x81,0x0C,0x81,0x00,0x00,0x00,0x1E,
+0x66,0x00,0x00,0x04,0x42,0x81,0x21,0x81,0x09,0xB0,0x00,0x00,0x19,0x88,0x60,0x00,
+0xFE,0xF8,0x24,0x30,0x09,0xB0,0x00,0x00,0x10,0x04,0x52,0xB0,0x29,0xA0,0x00,0x08,
+0x60,0x00,0xFF,0xC2,0x24,0x30,0x09,0xB0,0x00,0x00,0x10,0x04,0x52,0xB0,0x29,0xA0,
+0x00,0x0C,0x60,0x00,0xFF,0xB0,0x4E,0x75,0x4A,0xB0,0x09,0xB0,0x00,0x00,0x19,0x78,
+0x67,0x00,0x00,0x86,0x22,0x30,0x09,0xB0,0x00,0x00,0x19,0x58,0x24,0x01,0xE7,0x89,
+0xD2,0xB0,0x09,0xB0,0x00,0x00,0x18,0x72,0x36,0x30,0x19,0x90,0x08,0x03,0x00,0x0F,
+0x66,0x00,0x00,0x66,0x8C,0xB0,0x09,0xB0,0x00,0x00,0x18,0xA2,0x53,0xB0,0x09,0xB0,
+0x00,0x00,0x19,0x78,0x22,0x30,0x09,0xB0,0x00,0x00,0x19,0x58,0x52,0x81,0x0C,0x81,
+0x00,0x00,0x00,0x0A,0x66,0x00,0x00,0x04,0x42,0x81,0x21,0x81,0x09,0xB0,0x00,0x00,
+0x19,0x58,0x4C,0x3C,0x20,0x00,0x00,0x00,0x00,0x0C,0xD4,0xB0,0x09,0xB0,0x00,0x00,
+0x10,0x04,0x06,0x82,0x00,0x00,0x00,0x1C,0x08,0x03,0x00,0x01,0x66,0x00,0x00,0x0E,
+0x21,0xBC,0x00,0x00,0x00,0x20,0x29,0x90,0x60,0x00,0xFF,0x7E,0x21,0xBC,0x00,0x00,
+0x00,0x30,0x29,0x90,0x60,0x00,0xFF,0x72,0x4E,0x75,0x2F,0x00,0x40,0xE7,0x20,0x39,
+0xFF,0xF9,0x01,0x28,0x08,0x00,0x00,0x04,0x66,0x00,0x00,0x2C,0x4E,0x72,0x22,0x00,
+0x46,0xFC,0x27,0x00,0x60,0x00,0xFF,0xE8,0x2F,0x00,0x40,0xE7,0x20,0x39,0xFF,0xF9,
+0x01,0x28,0x08,0x00,0x00,0x0C,0x66,0x00,0x00,0x0E,0x4E,0x72,0x22,0x00,0x46,0xFC,
+0x27,0x00,0x60,0x00,0xFF,0xE8,0x46,0xDF,0x20,0x1F,0x4E,0x75,0x2F,0x00,0x20,0x39,
+0xFF,0xF9,0x00,0xE0,0x23,0xC0,0xFF,0xF9,0x00,0xE0,0x81,0xB9,0x00,0x00,0x19,0x54,
+0x23,0xFC,0x00,0x00,0x09,0x09,0xFF,0xF9,0x01,0x28,0x20,0x1F,0x4E,0x73,0x00,0xB9,
+0x00,0x00,0x00,0x00,0xFF,0xFC,0x16,0x10,0x00,0xB9,0x00,0x00,0x10,0x00,0x00,0x00,
+0x19,0x54,0x23,0xFC,0x40,0x00,0x00,0x00,0xFF,0xFC,0x15,0x4C,0x4E,0x73,0x00,0xB9,
+0x00,0x00,0x00,0x00,0xFF,0xFC,0x16,0x30,0x00,0xB9,0x00,0x00,0x20,0x00,0x00,0x00,
+0x19,0x54,0x23,0xFC,0x20,0x00,0x00,0x00,0xFF,0xFC,0x15,0x4C,0x4E,0x73,0x00,0xB9,
+0x00,0x00,0x00,0x00,0xFF,0xFC,0x16,0x50,0x00,0xB9,0x00,0x00,0x40,0x00,0x00,0x00,
+0x19,0x54,0x23,0xFC,0x10,0x00,0x00,0x00,0xFF,0xFC,0x15,0x4C,0x4E,0x73,0x00,0xB9,
+0x00,0x00,0x00,0x00,0xFF,0xFC,0x16,0x70,0x00,0xB9,0x00,0x00,0x80,0x00,0x00,0x00,
+0x19,0x54,0x23,0xFC,0x08,0x00,0x00,0x00,0xFF,0xFC,0x15,0x4C,0x4E,0x73,0x4E,0x73,
+0x2F,0x00,0x2F,0x01,0x2F,0x02,0x2F,0x08,0x2F,0x09,0x42,0x80,0x20,0x7C,0xFF,0xFB,
+0x00,0x00,0x32,0x10,0x02,0x81,0x00,0x00,0x00,0xE7,0x0C,0x41,0x00,0x42,0x66,0x00,
+0x00,0x0A,0x32,0x3C,0x0E,0x08,0x60,0x00,0x00,0x3E,0x0C,0x41,0x00,0x63,0x66,0x00,
+0x00,0x0A,0x32,0x3C,0x04,0x08,0x60,0x00,0x00,0x2E,0x0C,0x41,0x00,0x84,0x66,0x00,
+0x00,0x0A,0x32,0x3C,0x02,0x08,0x60,0x00,0x00,0x1E,0x0C,0x41,0x00,0xA5,0x66,0x00,
+0x00,0x0A,0x32,0x3C,0x0D,0x08,0x60,0x00,0x00,0x0E,0x32,0x3C,0x00,0x08,0x34,0x3C,
+0x80,0xE7,0x60,0x00,0x00,0x14,0x34,0x30,0x09,0xB0,0x00,0x00,0x19,0xAA,0x02,0x42,
+0x30,0x00,0x82,0x42,0x34,0x3C,0x80,0xFF,0xB2,0x70,0x09,0xB0,0x00,0x00,0x19,0xAC,
+0x67,0x00,0x00,0x0C,0x31,0x81,0x09,0xB0,0x00,0x00,0x19,0xAC,0x30,0x81,0x32,0x39,
+0xFF,0xFC,0x15,0x66,0xC2,0x70,0x09,0xB0,0x00,0x00,0x19,0x02,0x67,0x00,0x00,0x0C,
+0x32,0x10,0x02,0x41,0xFF,0xF7,0x60,0x00,0x00,0x08,0x32,0x10,0x00,0x41,0x00,0x08,
+0xC2,0x42,0x22,0x70,0x09,0xB0,0x00,0x00,0x10,0x04,0xB2,0xA9,0x00,0x04,0x67,0x00,
+0x00,0x12,0x23,0x41,0x00,0x04,0x23,0xF0,0x09,0xB0,0x00,0x00,0x18,0xB2,0xFF,0xF9,
+0x00,0xE4,0x54,0x88,0x58,0x80,0x0C,0x80,0x00,0x00,0x00,0x10,0x66,0x00,0xFF,0x34,
+0x22,0x5F,0x20,0x5F,0x24,0x1F,0x22,0x1F,0x20,0x1F,0x4E,0x75,0x61,0x00,0xFF,0x12,
+0x4E,0x73,0xFF,0xFC,0x16,0x00,0xFF,0xFC,0x16,0x20,0xFF,0xFC,0x16,0x40,0xFF,0xFC,
+0x16,0x60,0xFF,0xFC,0x0C,0x00,0xFF,0xFC,0x0D,0x00,0xFF,0xFC,0x0E,0x00,0xFF,0xFC,
+0x0F,0x00,0xFF,0xFC,0x00,0x00,0xFF,0xFC,0x01,0x40,0xFF,0xFC,0x02,0x80,0xFF,0xFC,
+0x03,0xC0,0xFF,0xFC,0x00,0x50,0xFF,0xFC,0x01,0x90,0xFF,0xFC,0x02,0xD0,0xFF,0xFC,
+0x04,0x10,0x00,0x00,0x40,0x00,0x00,0x01,0x2F,0x60,0x00,0x02,0x1E,0xC0,0x00,0x03,
+0x0E,0x20,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x04,0x00,0x00,
+0x00,0x08,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x80,0x00,0x00,
+0x01,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x11,0x00,0x00,0x00,0x12,0x00,0x00,
+0x00,0x13,0x00,0x00,0x00,0x2C,0x00,0x00,0x3E,0x00,0x00,0x2C,0x00,0x00,0x3E,0x00,
+0x00,0x00,0x00,0x00,0x00,0x2D,0x00,0x00,0x3F,0x00,0x00,0x2D,0x00,0x00,0x3F,0x00,
+0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,
+0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x80,0x00,0x00,0x02,0x00,0x00,0x00,0x08,0x00,
+0x77,0x61,0x6E,0x58,0x4C,0x20,0x66,0x69,0x72,0x6D,0x77,0x61,0x72,0x65,0x0A,0x43,
+0x6F,0x70,0x79,0x72,0x69,0x67,0x68,0x74,0x20,0x28,0x43,0x29,0x20,0x32,0x30,0x30,
+0x33,0x20,0x4B,0x72,0x7A,0x79,0x73,0x7A,0x74,0x6F,0x66,0x20,0x48,0x61,0x6C,0x61,
+0x73,0x61,0x20,0x3C,0x6B,0x68,0x63,0x40,0x70,0x6D,0x2E,0x77,0x61,0x77,0x2E,0x70,
+0x6C,0x3E,0x0A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
+};
diff -Nru a/drivers/net/wireless/prism54/isl_38xx.c b/drivers/net/wireless/prism54/isl_38xx.c
--- a/drivers/net/wireless/prism54/isl_38xx.c	2004-06-02 23:26:59 -07:00
+++ b/drivers/net/wireless/prism54/isl_38xx.c	2004-06-02 23:26:59 -07:00
@@ -1,4 +1,4 @@
-/*  $Header: /var/lib/cvs/prism54-ng/ksrc/isl_38xx.c,v 1.22 2004/02/28 03:06:07 mcgrof Exp $
+/*
  *  
  *  Copyright (C) 2002 Intersil Americas Inc.
  *  Copyright (C) 2003-2004 Luis R. Rodriguez <mcgrof@ruslug.rutgers.edu>_
diff -Nru a/drivers/net/wireless/prism54/isl_38xx.h b/drivers/net/wireless/prism54/isl_38xx.h
--- a/drivers/net/wireless/prism54/isl_38xx.h	2004-06-02 23:27:00 -07:00
+++ b/drivers/net/wireless/prism54/isl_38xx.h	2004-06-02 23:27:00 -07:00
@@ -1,4 +1,4 @@
-/*  $Header: /var/lib/cvs/prism54-ng/ksrc/isl_38xx.h,v 1.22 2004/02/28 03:06:07 mcgrof Exp $
+/*
  *  
  *  Copyright (C) 2002 Intersil Americas Inc.
  *
diff -Nru a/drivers/net/wireless/prism54/isl_ioctl.c b/drivers/net/wireless/prism54/isl_ioctl.c
--- a/drivers/net/wireless/prism54/isl_ioctl.c	2004-06-02 23:26:59 -07:00
+++ b/drivers/net/wireless/prism54/isl_ioctl.c	2004-06-02 23:26:59 -07:00
@@ -1,7 +1,7 @@
-/*  $Header: /var/lib/cvs/prism54-ng/ksrc/isl_ioctl.c,v 1.140 2004/02/28 03:06:07 mcgrof Exp $
+/*
  *  
  *  Copyright (C) 2002 Intersil Americas Inc.
- *            (C) 2003 Aurelien Alleaume <slts@free.fr>
+ *            (C) 2003,2004 Aurelien Alleaume <slts@free.fr>
  *            (C) 2003 Herbert Valerio Riedel <hvr@gnu.org>
  *            (C) 2003 Luis R. Rodriguez <mcgrof@ruslug.rutgers.edu>
  *
@@ -87,9 +87,9 @@
 
 	/* For now, just catch early the Repeater and Secondary modes here */
 	if (iw_mode == IW_MODE_REPEAT || iw_mode == IW_MODE_SECOND) {
-		printk(KERN_DEBUG "%s(): Sorry, Repeater mode and Secondary mode "
-				"are not yet supported by this driver.\n",
-		       __FUNCTION__);
+		printk(KERN_DEBUG
+		       "%s(): Sorry, Repeater mode and Secondary mode "
+		       "are not yet supported by this driver.\n", __FUNCTION__);
 		return -EINVAL;
 	}
 
@@ -143,8 +143,8 @@
 {
 	u32 t;
 	struct obj_buffer psm_buffer = {
-		.size = cpu_to_le32(PSM_BUFFER_SIZE),
-		.addr = cpu_to_le32(priv->device_psm_buffer)
+		.size = PSM_BUFFER_SIZE,
+		.addr = priv->device_psm_buffer
 	};
 
 	mgt_set(priv, DOT11_OID_CHANNEL, &init_channel);
@@ -285,7 +285,7 @@
 	/* Commit in Monitor mode is not necessary, also setting essid
 	 * in Monitor mode does not make sense and isn't allowed for this
 	 * device's firmware */
-	if(priv->iw_mode != IW_MODE_MONITOR)
+	if (priv->iw_mode != IW_MODE_MONITOR)
 		return mgt_set_request(priv, DOT11_OID_SSID, 0, NULL);
 	return 0;
 }
@@ -327,34 +327,15 @@
 {
 	islpci_private *priv = netdev_priv(ndev);
 	int rvalue;
-	u32 c = 0;
+	u32 c;
 
-	/* prepare the structure for the set object */
 	if (fwrq->m < 1000)
-		/* structure value contains a channel indication */
+		/* we have a channel number */
 		c = fwrq->m;
-	else {
-		/* structure contains a frequency indication and fwrq->e = 1 */
-		int f = fwrq->m / 100000;
-
-		if (fwrq->e != 1)
-			return -EINVAL;
-		if ((f >= 2412) && (f <= 2484)) {
-			while ((c < 14) && (f != frequency_list_bg[c]))
-				c++;
-			if (c >= 14)
-				return -EINVAL;
-		} else if ((f >= (int) 5170) && (f <= (int) 5320)) {
-			while ((c < 12) && (f != frequency_list_a[c]))
-				c++;
-			if (c >= 12)
-				return -EINVAL;
-		} else
-			return -EINVAL;
-		c++;
-	}
+	else
+		c = (fwrq->e == 1) ? channel_of_freq(fwrq->m / 100000) : 0;
 
-	rvalue = mgt_set_request(priv, DOT11_OID_CHANNEL, 0, &c);
+	rvalue = c ? mgt_set_request(priv, DOT11_OID_CHANNEL, 0, &c) : -EINVAL;
 
 	/* Call commit handler */
 	return (rvalue ? rvalue : -EINPROGRESS);
@@ -410,7 +391,7 @@
 
 	mgt_commit(priv);
 	priv->ndev->type = (priv->iw_mode == IW_MODE_MONITOR)
-	    ? ARPHRD_IEEE80211 : ARPHRD_ETHER;
+	    ? priv->monitor_type : ARPHRD_ETHER;
 	up_write(&priv->mib_sem);
 
 	return 0;
@@ -531,20 +512,20 @@
 	    mgt_get_request(priv, DOT11_OID_SUPPORTEDFREQUENCIES, 0, NULL, &r);
 	freq = r.ptr;
 
-	range->num_channels = le16_to_cpu(freq->nr);
-	range->num_frequency = le16_to_cpu(freq->nr);
+	range->num_channels = freq->nr;
+	range->num_frequency = freq->nr;
 
 	/* Frequencies are not listed in the right order. The reordering is probably
 	 * firmware dependant and thus should work for everyone.
 	 */
-	m = min(IW_MAX_FREQUENCIES, (int) le16_to_cpu(freq->nr));
+	m = min(IW_MAX_FREQUENCIES, (int) freq->nr);
 	for (i = 0; i < m - 12; i++) {
-		range->freq[i].m = le16_to_cpu(freq->mhz[12 + i]);
+		range->freq[i].m = freq->mhz[12 + i];
 		range->freq[i].e = 6;
 		range->freq[i].i = i + 1;
 	}
 	for (i = m - 12; i < m; i++) {
-		range->freq[i].m = le16_to_cpu(freq->mhz[i - m + 12]);
+		range->freq[i].m = freq->mhz[i - m + 12];
 		range->freq[i].e = 6;
 		range->freq[i].i = i + 23;
 	}
@@ -655,7 +636,7 @@
 #define CAP_CRYPT 0x10
 
 	/* Mode */
-	cap = le16_to_cpu(bss->capinfo);
+	cap = bss->capinfo;
 	iwe.u.mode = 0;
 	if (cap & CAP_ESS)
 		iwe.u.mode = IW_MODE_MASTER;
@@ -747,7 +728,7 @@
 	bsslist = r.ptr;
 
 	/* ok now, scan the list and translate its info */
-	for (i = 0; i < min(IW_MAX_AP, (int) le32_to_cpu(bsslist->nr)); i++)
+	for (i = 0; i < min(IW_MAX_AP, (int) bsslist->nr); i++)
 		current_ev = prism54_translate_bss(ndev, current_ev,
 						   extra + IW_SCAN_MAX_DATA,
 						   &(bsslist->bsslist[i]),
@@ -869,25 +850,26 @@
 		return mgt_set_request(priv, DOT11_OID_PROFILES, 0, &profile);
 	}
 	
-	if((ret = mgt_get_request(priv, DOT11_OID_SUPPORTEDRATES, 0, NULL, &r)))
+	if ((ret =
+	     mgt_get_request(priv, DOT11_OID_SUPPORTEDRATES, 0, NULL, &r)))
 		return ret;
 		
 	rate = (u32) (vwrq->value / 500000);
 	data = r.ptr;
 	i = 0;
 	
-	while(data[i]) {
-		if(rate && (data[i] == rate)) {
+	while (data[i]) {
+		if (rate && (data[i] == rate)) {
 			break;
 		}
-		if(vwrq->value == i) {
+		if (vwrq->value == i) {
 			break;
 		}
 		data[i] |= 0x80;
 		i++;
 	}
 		
-	if(!data[i]) {
+	if (!data[i]) {
 		return -EINVAL;
 	}
 	
@@ -931,12 +913,12 @@
 	union oid_res_t r;
 
 	/* Get the current bit rate */
-	if((rvalue = mgt_get_request(priv, GEN_OID_LINKSTATE, 0, NULL, &r)))
+	if ((rvalue = mgt_get_request(priv, GEN_OID_LINKSTATE, 0, NULL, &r)))
 		return rvalue;
 	vwrq->value = r.u * 500000;
 
 	/* request the device for the enabled rates */
-	if((rvalue = mgt_get_request(priv, DOT11_OID_RATES, 0, NULL, &r)))
+	if ((rvalue = mgt_get_request(priv, DOT11_OID_RATES, 0, NULL, &r)))
 		return rvalue;
 	data = r.ptr;
 	vwrq->fixed = (data[0] != 0) && (data[1] == 0);
@@ -1225,7 +1207,7 @@
 
 	rvalue = mgt_get_request(priv, OID_INL_OUTPUTPOWER, 0, NULL, &r);
 	/* intersil firmware operates in 0.25 dBm (1/4 dBm) */
-	vwrq->value = (s32)r.u / 4;
+	vwrq->value = (s32) r.u / 4;
 	vwrq->fixed = 1;
 	/* radio is not turned of
 	 * btw: how is possible to turn off only the radio 
@@ -1271,28 +1253,41 @@
 }
 
 static int
-prism54_set_beacon(struct net_device *ndev, struct iw_request_info *info,
-		   __u32 * uwrq, char *extra)
+prism54_get_oid(struct net_device *ndev, struct iw_request_info *info,
+		struct iw_point *dwrq, char *extra)
 {
-	int rvalue = mgt_set_request((islpci_private *) netdev_priv(ndev),
-				     DOT11_OID_BEACONPERIOD, 0, uwrq);
+	union oid_res_t r;
+	int rvalue;
+	enum oid_num_t n = dwrq->flags;
 
-	return (rvalue ? rvalue : -EINPROGRESS);
+	rvalue = mgt_get_request((islpci_private *) ndev->priv, n, 0, NULL, &r);
+	dwrq->length = mgt_response_to_str(n, &r, extra);
+	if ((isl_oid[n].flags & OID_FLAG_TYPE) != OID_TYPE_U32)
+		kfree(r.ptr);
+	return rvalue;
 }
 
 static int
-prism54_get_beacon(struct net_device *ndev, struct iw_request_info *info,
+prism54_set_u32(struct net_device *ndev, struct iw_request_info *info,
 		   __u32 * uwrq, char *extra)
 {
-	union oid_res_t r;
-	int rvalue;
+	/*
+	   u32 *i = (int *) extra;
+	   int param = *i;
+	   int u = *(i + 1);
+	 */
+	u32 oid = uwrq[0], u = uwrq[1];
 
-	rvalue =
-	    mgt_get_request((islpci_private *) netdev_priv(ndev),
-			    DOT11_OID_BEACONPERIOD, 0, NULL, &r);
-	*uwrq = r.u;
+	return mgt_set_request((islpci_private *) ndev->priv, oid, 0, &u);
+}
 
-	return rvalue;
+static int
+prism54_set_raw(struct net_device *ndev, struct iw_request_info *info,
+		struct iw_point *dwrq, char *extra)
+{
+	u32 oid = dwrq->flags;
+
+	return mgt_set_request((islpci_private *) ndev->priv, oid, 0, extra);
 }
 
 void
@@ -1511,8 +1506,9 @@
 		return -ENOMEM;
 
 	/* Tell the card to kick every client */
-	mlme->id = cpu_to_le16(0);
-	rvalue = mgt_set_request(netdev_priv(ndev), DOT11_OID_DISASSOCIATE, 0, mlme);
+	mlme->id = 0;
+	rvalue =
+	    mgt_set_request(netdev_priv(ndev), DOT11_OID_DISASSOCIATE, 0, mlme);
 	kfree(mlme);
 
 	return rvalue;
@@ -1535,8 +1531,9 @@
 
 	/* Tell the card to only kick the corresponding bastard */
 	memcpy(mlme->address, addr->sa_data, ETH_ALEN);
-	mlme->id = cpu_to_le16(-1);
-	rvalue = mgt_set_request(netdev_priv(ndev), DOT11_OID_DISASSOCIATE, 0, mlme);
+	mlme->id = -1;
+	rvalue =
+	    mgt_set_request(netdev_priv(ndev), DOT11_OID_DISASSOCIATE, 0, mlme);
 
 	kfree(mlme);
 
@@ -1551,12 +1548,12 @@
 {
 	const u8 *a = mlme->address;
 	int n = snprintf(dest, IW_CUSTOM_MAX,
-			 "%s %s %2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X %s",
+			 "%s %s %2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X %s (%2.2X)",
 			 str,
-			 ((priv->iw_mode == IW_MODE_MASTER) ? "to" : "from"),
+			 ((priv->iw_mode == IW_MODE_MASTER) ? "from" : "to"),
 			 a[0], a[1], a[2], a[3], a[4], a[5],
 			 (error ? (mlme->code ? " : REJECTED " : " : ACCEPTED ")
-			  : ""));
+			  : ""), mlme->code);
 	BUG_ON(n > IW_CUSTOM_MAX);
 	*length = n;
 }
@@ -1598,14 +1595,15 @@
 {
 	islpci_private *priv = netdev_priv(ndev);
 
-	if (le32_to_cpu(bitrate)) {
+	if (bitrate) {
 		if (priv->iw_mode == IW_MODE_INFRA) {
 			union iwreq_data uwrq;
 			prism54_get_wap(ndev, NULL, (struct sockaddr *) &uwrq,
 					NULL);
 			wireless_send_event(ndev, SIOCGIWAP, &uwrq, NULL);
 		} else
-			send_simple_event(netdev_priv(ndev), "Link established");
+			send_simple_event(netdev_priv(ndev),
+					  "Link established");
 	} else
 		send_simple_event(netdev_priv(ndev), "Link lost");
 }
@@ -1765,15 +1763,14 @@
 static void
 handle_request(islpci_private *priv, struct obj_mlme *mlme, enum oid_num_t oid)
 {
-	if (((le16_to_cpu(mlme->state) == DOT11_STATE_AUTHING) ||
-	     (le16_to_cpu(mlme->state) == DOT11_STATE_ASSOCING))
+	if (((mlme->state == DOT11_STATE_AUTHING) ||
+	     (mlme->state == DOT11_STATE_ASSOCING))
 	    && mgt_mlme_answer(priv)) {
 		/* Someone is requesting auth and we must respond. Just send back
 		 * the trap with error code set accordingly.
 		 */
-		mlme->code = cpu_to_le16(prism54_mac_accept(&priv->acl,
-							    mlme->
-							    address) ? 0 : 1);
+		mlme->code = prism54_mac_accept(&priv->acl,
+						mlme->address) ? 0 : 1;
 		mgt_set_request(priv, oid, 0, mlme);
 	}
 }
@@ -1797,6 +1794,13 @@
 	 * suited. We use the more flexible custom event facility.
 	 */
 
+	/* I fear prism54_process_bss_data won't work with big endian data */
+	if ((oid == DOT11_OID_BEACON) || (oid == DOT11_OID_PROBE))
+		prism54_process_bss_data(priv, oid, mlme->address,
+					 payload, len);
+
+	mgt_le_to_cpu(isl_oid[oid].flags & OID_FLAG_TYPE, (void *) mlme);
+
 	switch (oid) {
 
 	case GEN_OID_LINKSTATE:
@@ -1831,8 +1835,6 @@
 		break;
 
 	case DOT11_OID_BEACON:
-		prism54_process_bss_data(priv, oid, mlme->address,
-					 payload, len);
 		send_formatted_event(priv,
 				     "Received a beacon from an unkown AP",
 				     mlme, 0);
@@ -1840,8 +1842,6 @@
 
 	case DOT11_OID_PROBE:
 		/* we received a probe from a client. */
-		prism54_process_bss_data(priv, oid, mlme->address,
-					 payload, len);
 		send_formatted_event(priv, "Received a probe from client", mlme,
 				     0);
 		break;
@@ -1915,13 +1915,6 @@
 }
 
 int
-prism54_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd)
-{
-	/* should we really support this old stuff ? */
-	return -EOPNOTSUPP;
-}
-
-int
 prism54_set_wpa(struct net_device *ndev, struct iw_request_info *info,
 		__u32 * uwrq, char *extra)
 {
@@ -1951,8 +1944,30 @@
 }
 
 int
+prism54_set_prismhdr(struct net_device *ndev, struct iw_request_info *info,
+		     __u32 * uwrq, char *extra)
+{
+	islpci_private *priv = netdev_priv(ndev);
+	priv->monitor_type =
+	    (*uwrq ? ARPHRD_IEEE80211_PRISM : ARPHRD_IEEE80211);
+	if (priv->iw_mode == IW_MODE_MONITOR)
+		priv->ndev->type = priv->monitor_type;
+
+	return 0;
+}
+
+int
+prism54_get_prismhdr(struct net_device *ndev, struct iw_request_info *info,
+		     __u32 * uwrq, char *extra)
+{
+	islpci_private *priv = netdev_priv(ndev);
+	*uwrq = (priv->monitor_type == ARPHRD_IEEE80211_PRISM);
+	return 0;
+}
+
+int
 prism54_set_maxframeburst(struct net_device *ndev, struct iw_request_info *info,
-		__u32 *uwrq, char *extra)
+			  __u32 * uwrq, char *extra)
 {
 	islpci_private *priv = netdev_priv(ndev);
 	u32 max_burst;
@@ -1965,7 +1980,7 @@
 
 int
 prism54_get_maxframeburst(struct net_device *ndev, struct iw_request_info *info,
-		__u32 *uwrq, char *extra)
+			  __u32 * uwrq, char *extra)
 {
 	islpci_private *priv = netdev_priv(ndev);
 	union oid_res_t r;
@@ -1979,7 +1994,7 @@
 
 int
 prism54_set_profile(struct net_device *ndev, struct iw_request_info *info,
-		__u32 *uwrq, char *extra)
+		    __u32 * uwrq, char *extra)
 {
 	islpci_private *priv = netdev_priv(ndev);
 	u32 profile;
@@ -1992,7 +2007,7 @@
 
 int
 prism54_get_profile(struct net_device *ndev, struct iw_request_info *info,
-		__u32 *uwrq, char *extra)
+		    __u32 * uwrq, char *extra)
 {
 	islpci_private *priv = netdev_priv(ndev);
 	union oid_res_t r;
@@ -2005,8 +2020,8 @@
 }
 
 int
-prism54_oid(struct net_device *ndev, struct iw_request_info *info,
-		__u32 *uwrq, char *extra)
+prism54_debug_oid(struct net_device *ndev, struct iw_request_info *info,
+		  __u32 * uwrq, char *extra)
 {
 	islpci_private *priv = netdev_priv(ndev);
 	
@@ -2017,7 +2032,7 @@
 }
 
 int
-prism54_get_oid(struct net_device *ndev, struct iw_request_info *info,
+prism54_debug_get_oid(struct net_device *ndev, struct iw_request_info *info,
 		struct iw_point *data, char *extra)
 {
 	islpci_private *priv = netdev_priv(ndev);
@@ -2028,11 +2043,15 @@
 	data->length = 0;
 	
 	if (islpci_get_state(priv) >= PRV_STATE_INIT) {
-		ret = islpci_mgt_transaction(priv->ndev, PIMFOR_OP_GET, priv->priv_oid, extra, 256, &response);
+		ret =
+		    islpci_mgt_transaction(priv->ndev, PIMFOR_OP_GET,
+					   priv->priv_oid, extra, 256,
+					   &response);
 		response_op = response->header->operation;
 		printk("%s: ret: %i\n", ndev->name, ret);
 		printk("%s: response_op: %i\n", ndev->name, response_op);
-		if (ret || !response || response->header->operation == PIMFOR_OP_ERROR) {
+		if (ret || !response
+		    || response->header->operation == PIMFOR_OP_ERROR) {
 			if (response) {
 				islpci_mgt_release(response);
 			}
@@ -2051,21 +2070,26 @@
 }
 
 int
-prism54_set_oid(struct net_device *ndev, struct iw_request_info *info,
+prism54_debug_set_oid(struct net_device *ndev, struct iw_request_info *info,
 		struct iw_point *data, char *extra)
 {
 	islpci_private *priv = netdev_priv(ndev);
 	struct islpci_mgmtframe *response = NULL;
 	int ret = 0, response_op = PIMFOR_OP_ERROR;
 	
-	printk("%s: set_oid 0x%08X\tlen: %d\n", ndev->name, priv->priv_oid, data->length);
+	printk("%s: set_oid 0x%08X\tlen: %d\n", ndev->name, priv->priv_oid,
+	       data->length);
 	
 	if (islpci_get_state(priv) >= PRV_STATE_INIT) {
-		ret = islpci_mgt_transaction(priv->ndev, PIMFOR_OP_SET, priv->priv_oid, extra, data->length, &response);
+		ret =
+		    islpci_mgt_transaction(priv->ndev, PIMFOR_OP_SET,
+					   priv->priv_oid, extra, data->length,
+					   &response);
 		printk("%s: ret: %i\n", ndev->name, ret);
 		if (!ret) {
 			response_op = response->header->operation;
-			printk("%s: response_op: %i\n", ndev->name, response_op);
+			printk("%s: response_op: %i\n", ndev->name,
+			       response_op);
 			islpci_mgt_release(response);
 		}
 		if (ret || response_op == PIMFOR_OP_ERROR) {
@@ -2077,6 +2101,31 @@
 	return ret;
 }
 
+static int
+prism54_set_spy(struct net_device *ndev,
+		struct iw_request_info *info,
+		union iwreq_data *uwrq, char *extra)
+{
+	islpci_private *priv = netdev_priv(ndev);
+	u32 u, oid = OID_INL_CONFIG;
+
+	down_write(&priv->mib_sem);
+	mgt_get(priv, OID_INL_CONFIG, &u);
+
+	if ((uwrq->data.length == 0) && (priv->spy_data.spy_number > 0))
+		/* disable spy */
+		u &= ~INL_CONFIG_RXANNEX;
+	else if ((uwrq->data.length > 0) && (priv->spy_data.spy_number == 0))
+		/* enable spy */
+		u |= INL_CONFIG_RXANNEX;
+
+	mgt_set(priv, OID_INL_CONFIG, &u);
+	mgt_commit_list(priv, &oid, 1);
+	up_write(&priv->mib_sem);
+
+	return iw_handler_set_spy(ndev, info, uwrq, extra);
+}
+
 static const iw_handler prism54_handler[] = {
 	(iw_handler) prism54_commit,	/* SIOCSIWCOMMIT */
 	(iw_handler) prism54_get_name,	/* SIOCGIWNAME */
@@ -2094,7 +2143,7 @@
 	(iw_handler) NULL,	/* SIOCGIWPRIV */
 	(iw_handler) NULL,	/* SIOCSIWSTATS */
 	(iw_handler) NULL,	/* SIOCGIWSTATS */
-	iw_handler_set_spy,	/* SIOCSIWSPY */
+	prism54_set_spy,	/* SIOCSIWSPY */
 	iw_handler_get_spy,	/* SIOCGIWSPY */
 	iw_handler_set_thrspy,	/* SIOCSIWTHRSPY */
 	iw_handler_get_thrspy,	/* SIOCGIWTHRSPY */
@@ -2129,33 +2178,50 @@
 /* The low order bit identify a SET (0) or a GET (1) ioctl.  */
 
 #define PRISM54_RESET		SIOCIWFIRSTPRIV
-#define PRISM54_GET_BEACON	SIOCIWFIRSTPRIV+1
-#define PRISM54_SET_BEACON	SIOCIWFIRSTPRIV+2
-#define PRISM54_GET_POLICY SIOCIWFIRSTPRIV+3
-#define PRISM54_SET_POLICY SIOCIWFIRSTPRIV+4
-#define PRISM54_GET_MAC 	   SIOCIWFIRSTPRIV+5
-#define PRISM54_ADD_MAC 	   SIOCIWFIRSTPRIV+6
+#define PRISM54_GET_POLICY	SIOCIWFIRSTPRIV+1
+#define PRISM54_SET_POLICY	SIOCIWFIRSTPRIV+2
+#define PRISM54_GET_MAC		SIOCIWFIRSTPRIV+3
+#define PRISM54_ADD_MAC		SIOCIWFIRSTPRIV+4
 
-#define PRISM54_DEL_MAC    SIOCIWFIRSTPRIV+8
+#define PRISM54_DEL_MAC		SIOCIWFIRSTPRIV+6
 
-#define PRISM54_KICK_MAC   SIOCIWFIRSTPRIV+10
+#define PRISM54_KICK_MAC	SIOCIWFIRSTPRIV+8
 
-#define PRISM54_KICK_ALL   SIOCIWFIRSTPRIV+12
+#define PRISM54_KICK_ALL	SIOCIWFIRSTPRIV+10
 
-#define PRISM54_GET_WPA	   SIOCIWFIRSTPRIV+13
-#define PRISM54_SET_WPA	   SIOCIWFIRSTPRIV+14
+#define PRISM54_GET_WPA		SIOCIWFIRSTPRIV+11
+#define PRISM54_SET_WPA		SIOCIWFIRSTPRIV+12
+
+#define PRISM54_DBG_OID		SIOCIWFIRSTPRIV+14
+#define PRISM54_DBG_GET_OID	SIOCIWFIRSTPRIV+15
+#define PRISM54_DBG_SET_OID	SIOCIWFIRSTPRIV+16
 
-#define PRISM54_OID	   SIOCIWFIRSTPRIV+16
 #define PRISM54_GET_OID	   SIOCIWFIRSTPRIV+17
-#define PRISM54_SET_OID	   SIOCIWFIRSTPRIV+18
+#define PRISM54_SET_OID_U32	SIOCIWFIRSTPRIV+18
+#define	PRISM54_SET_OID_STR	SIOCIWFIRSTPRIV+20
+#define	PRISM54_SET_OID_ADDR	SIOCIWFIRSTPRIV+22
+
+#define PRISM54_GET_PRISMHDR	SIOCIWFIRSTPRIV+23
+#define PRISM54_SET_PRISMHDR	SIOCIWFIRSTPRIV+24
+
+#define IWPRIV_SET_U32(n,x)	{ n, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_"x }
+#define IWPRIV_SET_SSID(n,x)	{ n, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 1, 0, "set_"x }
+#define IWPRIV_SET_ADDR(n,x)	{ n, IW_PRIV_TYPE_ADDR | IW_PRIV_SIZE_FIXED | 1, 0, "set_"x }
+#define IWPRIV_GET(n,x)	{ n, 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | PRIV_STR_SIZE, "get_"x }
+
+#define IWPRIV_U32(n,x)		IWPRIV_SET_U32(n,x), IWPRIV_GET(n,x)
+#define IWPRIV_SSID(n,x)	IWPRIV_SET_SSID(n,x), IWPRIV_GET(n,x)
+#define IWPRIV_ADDR(n,x)	IWPRIV_SET_ADDR(n,x), IWPRIV_GET(n,x)
+
+/* Note : limited to 128 private ioctls */
 
 static const struct iw_priv_args prism54_private_args[] = {
 /*{ cmd, set_args, get_args, name } */
 	{PRISM54_RESET, 0, 0, "reset"},
-	{PRISM54_GET_BEACON, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
-	 "getBeaconPeriod"},
-	{PRISM54_SET_BEACON, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0,
-	 "setBeaconPeriod"},
+	{PRISM54_GET_PRISMHDR, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+	 "get_prismhdr"},
+	{PRISM54_SET_PRISMHDR, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0,
+	 "set_prismhdr"},
 	{PRISM54_GET_POLICY, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
 	 "getPolicy"},
 	{PRISM54_SET_POLICY, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0,
@@ -2172,15 +2238,77 @@
 	 "get_wpa"},
 	{PRISM54_SET_WPA, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0,
 	 "set_wpa"},
-	{PRISM54_OID, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "oid"},
-	{PRISM54_GET_OID, 0, IW_PRIV_TYPE_BYTE | 256, "get_oid"},
-	{PRISM54_SET_OID, IW_PRIV_TYPE_BYTE | 256, 0, "set_oid"},
+	{PRISM54_DBG_OID, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0,
+	 "dbg_oid"},
+	{PRISM54_DBG_GET_OID, 0, IW_PRIV_TYPE_BYTE | 256, "dbg_get_oid"},
+	{PRISM54_DBG_SET_OID, IW_PRIV_TYPE_BYTE | 256, 0, "dbg_get_oid"},
+	/* --- sub-ioctls handlers --- */
+	{PRISM54_GET_OID,
+	 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | PRIV_STR_SIZE, ""},
+	{PRISM54_SET_OID_U32,
+	 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, ""},
+	{PRISM54_SET_OID_STR,
+	 IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 1, 0, ""},
+	{PRISM54_SET_OID_ADDR,
+	 IW_PRIV_TYPE_ADDR | IW_PRIV_SIZE_FIXED | 1, 0, ""},
+	/* --- sub-ioctls definitions --- */
+	IWPRIV_ADDR(GEN_OID_MACADDRESS, "addr"),
+	IWPRIV_GET(GEN_OID_LINKSTATE, "linkstate"),
+	IWPRIV_U32(DOT11_OID_BSSTYPE, "bsstype"),
+	IWPRIV_ADDR(DOT11_OID_BSSID, "bssid"),
+	IWPRIV_U32(DOT11_OID_STATE, "state"),
+	IWPRIV_U32(DOT11_OID_AID, "aid"),
+
+	IWPRIV_SSID(DOT11_OID_SSIDOVERRIDE, "ssidoverride"),
+
+	IWPRIV_U32(DOT11_OID_MEDIUMLIMIT, "medlimit"),
+	IWPRIV_U32(DOT11_OID_BEACONPERIOD, "beacon"),
+	IWPRIV_U32(DOT11_OID_DTIMPERIOD, "dtimperiod"),
+
+	IWPRIV_U32(DOT11_OID_AUTHENABLE, "authenable"),
+	IWPRIV_U32(DOT11_OID_PRIVACYINVOKED, "privinvok"),
+	IWPRIV_U32(DOT11_OID_EXUNENCRYPTED, "exunencrypt"),
+	
+	IWPRIV_U32(DOT11_OID_REKEYTHRESHOLD, "rekeythresh"),
+
+	IWPRIV_U32(DOT11_OID_MAXTXLIFETIME, "maxtxlife"),
+	IWPRIV_U32(DOT11_OID_MAXRXLIFETIME, "maxrxlife"),
+	IWPRIV_U32(DOT11_OID_ALOFT_FIXEDRATE, "fixedrate"),
+	IWPRIV_U32(DOT11_OID_MAXFRAMEBURST, "frameburst"),
+	IWPRIV_U32(DOT11_OID_PSM, "psm"),
+
+	IWPRIV_U32(DOT11_OID_BRIDGELOCAL, "bridge"),
+	IWPRIV_U32(DOT11_OID_CLIENTS, "clients"),
+	IWPRIV_U32(DOT11_OID_CLIENTSASSOCIATED, "clientassoc"),
+	IWPRIV_U32(DOT11_OID_DOT1XENABLE, "dot1xenable"),
+	IWPRIV_U32(DOT11_OID_ANTENNARX, "rxant"),
+	IWPRIV_U32(DOT11_OID_ANTENNATX, "txant"),
+	IWPRIV_U32(DOT11_OID_ANTENNADIVERSITY, "antdivers"),
+	IWPRIV_U32(DOT11_OID_EDTHRESHOLD, "edthresh"),
+	IWPRIV_U32(DOT11_OID_PREAMBLESETTINGS, "preamble"),
+	IWPRIV_GET(DOT11_OID_RATES, "rates"),
+	IWPRIV_U32(DOT11_OID_OUTPUTPOWER, ".11outpower"),
+	IWPRIV_GET(DOT11_OID_SUPPORTEDRATES, "supprates"),
+	IWPRIV_GET(DOT11_OID_SUPPORTEDFREQUENCIES, "suppfreq"),
+
+	IWPRIV_U32(DOT11_OID_NOISEFLOOR, "noisefloor"),
+	IWPRIV_GET(DOT11_OID_FREQUENCYACTIVITY, "freqactivity"),
+	IWPRIV_U32(DOT11_OID_NONERPPROTECTION, "nonerpprotec"),
+	IWPRIV_U32(DOT11_OID_PROFILES, "profile"),
+	IWPRIV_GET(DOT11_OID_EXTENDEDRATES, "extrates"),
+	IWPRIV_U32(DOT11_OID_MLMEAUTOLEVEL, "mlmelevel"),
+
+	IWPRIV_GET(DOT11_OID_BSSS, "bsss"),
+	IWPRIV_GET(DOT11_OID_BSSLIST, "bsslist"),
+	IWPRIV_U32(OID_INL_MODE, "mode"),
+	IWPRIV_U32(OID_INL_CONFIG, "config"),
+	IWPRIV_U32(OID_INL_DOT11D_CONFORMANCE, ".11dconform"),
+	IWPRIV_GET(OID_INL_PHYCAPABILITIES, "phycapa"),
+	IWPRIV_U32(OID_INL_OUTPUTPOWER, "outpower"),
 };
 
 static const iw_handler prism54_private_handler[] = {
 	(iw_handler) prism54_reset,
-	(iw_handler) prism54_get_beacon,
-	(iw_handler) prism54_set_beacon,
 	(iw_handler) prism54_get_policy,
 	(iw_handler) prism54_set_policy,
 	(iw_handler) prism54_get_mac,
@@ -2194,9 +2322,17 @@
 	(iw_handler) prism54_get_wpa,
 	(iw_handler) prism54_set_wpa,
 	(iw_handler) NULL,
-	(iw_handler) prism54_oid,
+	(iw_handler) prism54_debug_oid,
+	(iw_handler) prism54_debug_get_oid,
+	(iw_handler) prism54_debug_set_oid,
 	(iw_handler) prism54_get_oid,
-	(iw_handler) prism54_set_oid,
+	(iw_handler) prism54_set_u32,
+	(iw_handler) NULL,
+	(iw_handler) prism54_set_raw,
+	(iw_handler) NULL,
+	(iw_handler) prism54_set_raw,
+	(iw_handler) prism54_get_prismhdr,
+	(iw_handler) prism54_set_prismhdr,
 };
 
 const struct iw_handler_def prism54_handler_def = {
@@ -2207,5 +2343,13 @@
 	.standard = (iw_handler *) prism54_handler,
 	.private = (iw_handler *) prism54_private_handler,
 	.private_args = (struct iw_priv_args *) prism54_private_args,
+	.spy_offset = offsetof(islpci_private, spy_data),
 };
 
+/* For ioctls that don't work with the new API */
+
+int
+prism54_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd)
+{
+	return -EOPNOTSUPP;
+}
diff -Nru a/drivers/net/wireless/prism54/isl_ioctl.h b/drivers/net/wireless/prism54/isl_ioctl.h
--- a/drivers/net/wireless/prism54/isl_ioctl.h	2004-06-02 23:26:59 -07:00
+++ b/drivers/net/wireless/prism54/isl_ioctl.h	2004-06-02 23:26:59 -07:00
@@ -1,4 +1,4 @@
-/*  $Header: /var/lib/cvs/prism54-ng/ksrc/isl_ioctl.h,v 1.30 2004/01/30 16:24:00 ajfa Exp $
+/*
  *  
  *  Copyright (C) 2002 Intersil Americas Inc.
  *            (C) 2003 Aurelien Alleaume <slts@free.fr>
diff -Nru a/drivers/net/wireless/prism54/isl_oid.h b/drivers/net/wireless/prism54/isl_oid.h
--- a/drivers/net/wireless/prism54/isl_oid.h	2004-06-02 23:26:59 -07:00
+++ b/drivers/net/wireless/prism54/isl_oid.h	2004-06-02 23:26:59 -07:00
@@ -1,8 +1,9 @@
 /*
- *  $Id: isl_oid.h,v 1.3 2004/03/09 09:05:27 mcgrof Exp $
+ *
  *  
  *  Copyright (C) 2003 Herbert Valerio Riedel <hvr@gnu.org>
  *  Copyright (C) 2004 Luis R. Rodriguez <mcgrof@ruslug.rutgers.edu>
+ *  Copyright (C) 2004 Aurelien Alleaume <slts@free.fr>
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -457,16 +458,29 @@
 	OID_NUM_LAST
 };
 
-/* We  could add more flags. eg: in which mode are they allowed, ro, rw, ...*/
-#define OID_FLAG_CACHED	0x01
-#define OID_FLAG_U32	0x02
-#define OID_FLAG_MLMEEX	0x04	/* this type is special because of a variable
-				   size field when sending. Not yet implemented (not used in driver). */
+#define OID_FLAG_CACHED		0x80
+#define OID_FLAG_TYPE		0x7f
+
+#define OID_TYPE_U32		0x01
+#define OID_TYPE_SSID		0x02
+#define OID_TYPE_KEY		0x03
+#define OID_TYPE_BUFFER		0x04
+#define OID_TYPE_BSS		0x05
+#define OID_TYPE_BSSLIST	0x06
+#define OID_TYPE_FREQUENCIES	0x07
+#define OID_TYPE_MLME		0x08
+#define OID_TYPE_MLMEEX		0x09
+#define OID_TYPE_ADDR		0x0A
+#define OID_TYPE_RAW		0x0B
+
+/* OID_TYPE_MLMEEX is special because of a variable size field when sending.
+ * Not yet implemented (not used in driver anyway).
+ */
 
 struct oid_t {
 	enum oid_num_t oid;
 	short range;		/* to define a range of oid */
-	short size;		/* size of the associated data */
+	short size;		/* max size of the associated data */
 	char flags;
 };
 
@@ -478,6 +492,7 @@
 #define	IWMAX_BITRATES	20
 #define	IWMAX_BSS	24
 #define IWMAX_FREQ	30
+#define PRIV_STR_SIZE	1024
 
 #endif				/* !defined(_ISL_OID_H) */
 /* EOF */
diff -Nru a/drivers/net/wireless/prism54/islpci_dev.c b/drivers/net/wireless/prism54/islpci_dev.c
--- a/drivers/net/wireless/prism54/islpci_dev.c	2004-06-02 23:26:58 -07:00
+++ b/drivers/net/wireless/prism54/islpci_dev.c	2004-06-02 23:26:58 -07:00
@@ -1,4 +1,4 @@
-/*  $Header: /var/lib/cvs/prism54-ng/ksrc/islpci_dev.c,v 1.68 2004/02/28 03:06:07 mcgrof Exp $
+/*
  *  
  *  Copyright (C) 2002 Intersil Americas Inc.
  *  Copyright (C) 2003 Herbert Valerio Riedel <hvr@gnu.org>
@@ -715,9 +715,9 @@
 	priv = netdev_priv(ndev);
 	priv->ndev = ndev;
 	priv->pdev = pdev;
-
+	priv->monitor_type = ARPHRD_IEEE80211;
 	priv->ndev->type = (priv->iw_mode == IW_MODE_MONITOR) ?
-		ARPHRD_IEEE80211: ARPHRD_ETHER;
+		priv->monitor_type : ARPHRD_ETHER;
 
 	/* save the start and end address of the PCI memory area */
 	ndev->mem_start = (unsigned long) priv->device_base;
@@ -743,8 +743,10 @@
 	/* initialize workqueue's */
 	INIT_WORK(&priv->stats_work,
 		  (void (*)(void *)) prism54_update_stats, priv);
-
 	priv->stats_timestamp = 0;
+
+	INIT_WORK(&priv->reset_task, islpci_do_reset_and_wake, priv);
+	priv->reset_task_pending = 0;
 
 	/* allocate various memory areas */
 	if (islpci_alloc_memory(priv))
diff -Nru a/drivers/net/wireless/prism54/islpci_dev.h b/drivers/net/wireless/prism54/islpci_dev.h
--- a/drivers/net/wireless/prism54/islpci_dev.h	2004-06-02 23:26:59 -07:00
+++ b/drivers/net/wireless/prism54/islpci_dev.h	2004-06-02 23:26:59 -07:00
@@ -1,8 +1,9 @@
-/*  $Header: /var/lib/cvs/prism54-ng/ksrc/islpci_dev.h,v 1.53 2004/02/28 03:06:07 mcgrof Exp $
+/*
  *  
  *  Copyright (C) 2002 Intersil Americas Inc. 
  *  Copyright (C) 2003 Herbert Valerio Riedel <hvr@gnu.org>
  *  Copyright (C) 2003 Luis R. Rodriguez <mcgrof@ruslug.rutgers.edu>
+ *  Copyright (C) 2003 Aurelien Alleaume <slts@free.fr>
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -25,6 +26,7 @@
 #include <linux/version.h>
 #include <linux/netdevice.h>
 #include <linux/wireless.h>
+#include <net/iw_handler.h>
 #include <linux/list.h>
 
 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,41)
@@ -110,6 +112,10 @@
 	struct iw_statistics local_iwstatistics;
 	struct iw_statistics iwstatistics;
 
+	struct iw_spy_data spy_data; /* iwspy support */
+
+	int monitor_type; /* ARPHRD_IEEE80211 or ARPHRD_IEEE80211_PRISM */
+
 	struct islpci_acl acl;
 
 	/* PCI bus allocation & configuration members */
@@ -187,6 +193,9 @@
 	struct list_head bss_wpa_list;
 	int num_bss_wpa;
 	struct semaphore wpa_sem;
+
+	struct work_struct reset_task;
+	int reset_task_pending;
 } islpci_private;
 
 static inline islpci_state_t
diff -Nru a/drivers/net/wireless/prism54/islpci_eth.c b/drivers/net/wireless/prism54/islpci_eth.c
--- a/drivers/net/wireless/prism54/islpci_eth.c	2004-06-02 23:26:58 -07:00
+++ b/drivers/net/wireless/prism54/islpci_eth.c	2004-06-02 23:26:58 -07:00
@@ -1,7 +1,7 @@
-/*  $Header: /var/lib/cvs/prism54-ng/ksrc/islpci_eth.c,v 1.27 2004/01/30 16:24:00 ajfa Exp $
+/*
  *  
  *  Copyright (C) 2002 Intersil Americas Inc.
- *
+ *  Copyright (C) 2004 Aurelien Alleaume <slts@free.fr>
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License
@@ -24,10 +24,12 @@
 #include <linux/delay.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
+#include <linux/if_arp.h>
 
 #include "isl_38xx.h"
 #include "islpci_eth.h"
 #include "islpci_mgt.h"
+#include "oid_mgt.h"
 
 /******************************************************************************
     Network Interface functions
@@ -246,6 +248,69 @@
 	return err;
 }
 
+static inline int
+islpci_monitor_rx(islpci_private *priv, struct sk_buff **skb)
+{
+	/* The card reports full 802.11 packets but with a 20 bytes
+	 * header and without the FCS. But there a is a bit that
+	 * indicates if the packet is corrupted :-) */
+	struct rfmon_header *hdr = (struct rfmon_header *) (*skb)->data;
+	if (hdr->flags & 0x01)
+		/* This one is bad. Drop it ! */
+		return -1;
+	if (priv->ndev->type == ARPHRD_IEEE80211_PRISM) {
+		struct avs_80211_1_header *avs;
+		/* extract the relevant data from the header */
+		u32 clock = hdr->clock;
+		u8 rate = hdr->rate;
+		u16 freq = be16_to_cpu(hdr->freq);
+		u8 rssi = hdr->rssi;
+
+		skb_pull(*skb, sizeof (struct rfmon_header));
+
+		if (skb_headroom(*skb) < sizeof (struct avs_80211_1_header)) {
+			struct sk_buff *newskb = skb_copy_expand(*skb,
+								 sizeof (struct
+									 avs_80211_1_header),
+								 0, GFP_ATOMIC);
+			if (newskb) {
+				kfree_skb(*skb);
+				*skb = newskb;
+			} else
+				return -1;
+			/* This behavior is not very subtile... */
+		}
+
+		/* make room for the new header and fill it. */
+		avs =
+		    (struct avs_80211_1_header *) skb_push(*skb,
+							   sizeof (struct
+								   avs_80211_1_header));
+
+		avs->version = htonl(P80211CAPTURE_VERSION);
+		avs->length = htonl(sizeof (struct avs_80211_1_header));
+		avs->mactime = __cpu_to_be64(clock);
+		avs->hosttime = __cpu_to_be64(jiffies);
+		avs->phytype = htonl(6);	/*OFDM: 6 for (g), 8 for (a) */
+		avs->channel = htonl(channel_of_freq(freq));
+		avs->datarate = htonl(rate * 5);
+		avs->antenna = htonl(0);	/*unknown */
+		avs->priority = htonl(0);	/*unknown */
+		avs->ssi_type = htonl(2);	/*2: dBm, 3: raw RSSI */
+		avs->ssi_signal = htonl(rssi);
+		avs->ssi_noise = htonl(priv->local_iwstatistics.qual.noise);	/*better than 'undefined', I assume */
+		avs->preamble = htonl(0);	/*unknown */
+		avs->encoding = htonl(0);	/*unknown */
+	} else
+		skb_pull(*skb, sizeof (struct rfmon_header));
+
+	(*skb)->protocol = htons(ETH_P_802_2);
+	(*skb)->mac.raw = (*skb)->data;
+	(*skb)->pkt_type = PACKET_OTHERHOST;
+
+	return 0;
+}
+
 int
 islpci_eth_receive(islpci_private *priv)
 {
@@ -266,7 +331,8 @@
 	index = priv->free_data_rx % ISL38XX_CB_RX_QSIZE;
 	size = le16_to_cpu(control_block->rx_data_low[index].size);
 	skb = priv->data_low_rx[index];
-	offset = ((unsigned long) le32_to_cpu(control_block->rx_data_low[index].address) -
+	offset = ((unsigned long)
+		  le32_to_cpu(control_block->rx_data_low[index].address) -
 		  (unsigned long) skb->data) & 3;
 
 #if VERBOSE > SHOW_ERROR_MESSAGES
@@ -314,29 +380,32 @@
 	/* do some additional sk_buff and network layer parameters */
 	skb->dev = ndev;
 
-	/* take care of monitor mode */
-	if (priv->iw_mode == IW_MODE_MONITOR) {
-		/* The card reports full 802.11 packets but with a 20 bytes
-		 * header and without the FCS. But there a is a bit that
-		 * indicates if the packet is corrupted :-) */
-		/* int i; */
-		if (skb->data[8] & 0x01){
-			/* This one is bad. Drop it !*/
-			discard = 1;
-			/* printk("BAD\n");*/
+	/* take care of monitor mode and spy monitoring. */
+	if (priv->iw_mode == IW_MODE_MONITOR)
+		discard = islpci_monitor_rx(priv, &skb);
+	else {
+		if (skb->data[2 * ETH_ALEN] == 0) {
+			/* The packet has a rx_annex. Read it for spy monitoring, Then
+			 * remove it, while keeping the 2 leading MAC addr.
+			 */
+			struct iw_quality wstats;
+			struct rx_annex_header *annex =
+			    (struct rx_annex_header *) skb->data;
+			wstats.level = annex->rfmon.rssi;
+			/* The noise value can be a bit outdated if nobody's 
+			 * reading wireless stats... */
+			wstats.noise = priv->local_iwstatistics.qual.noise;
+			wstats.qual = wstats.level - wstats.noise;
+			wstats.updated = 0x07;
+			/* Update spy records */
+			wireless_spy_update(ndev, annex->addr2, &wstats);
+
+			memcpy(skb->data + sizeof (struct rfmon_header),
+			       skb->data, 2 * ETH_ALEN);
+			skb_pull(skb, sizeof (struct rfmon_header));
 		}
-		/*
-		for(i=0;i<50;i++)
-			printk("%2.2X:",skb->data[i]);
-		printk("\n");
-		*/		
-		skb_pull(skb, 20);
-		skb->protocol = htons(ETH_P_802_2);
-		skb->mac.raw = skb->data;
-		skb->pkt_type = PACKET_OTHERHOST;
-	} else
 		skb->protocol = eth_type_trans(skb, ndev);
-
+	}
 	skb->ip_summed = CHECKSUM_NONE;
 	priv->statistics.rx_packets++;
 	priv->statistics.rx_bytes += size;
@@ -351,8 +420,7 @@
 	if (discard) {
 		dev_kfree_skb(skb);
 		skb = NULL;
-	}
-	else
+	} else
 		netif_rx(skb);
 
 	/* increment the read index for the rx data low queue */
@@ -403,7 +471,7 @@
 		wmb();
 
 		/* increment the driver read pointer */
-		add_le32p((u32 *) & control_block->
+		add_le32p((u32 *) &control_block->
 			  driver_curr_frag[ISL38XX_CB_RX_DATA_LQ], 1);
 	}
 
@@ -414,6 +482,15 @@
 }
 
 void
+islpci_do_reset_and_wake(void *data)
+{
+       islpci_private *priv = (islpci_private *) data;
+       islpci_reset(priv, 1);
+       netif_wake_queue(priv->ndev);
+       priv->reset_task_pending = 0;
+}
+
+void
 islpci_eth_tx_timeout(struct net_device *ndev)
 {
 	islpci_private *priv = netdev_priv(ndev);
@@ -422,13 +499,11 @@
 	/* increment the transmit error counter */
 	statistics->tx_errors++;
 
-#if 0
-	/* don't do this here! we are not allowed to sleep since we are in interrupt context */
-	if (islpci_reset(priv))
-		printk(KERN_ERR "%s: error on TX timeout card reset!\n",
-		       ndev->name);
-#endif
+	if (!priv->reset_task_pending) {
+		priv->reset_task_pending = 1;
+		netif_stop_queue(ndev);
+		schedule_work(&priv->reset_task);
+	}
 
-	/* netif_wake_queue(ndev); */
 	return;
 }
diff -Nru a/drivers/net/wireless/prism54/islpci_eth.h b/drivers/net/wireless/prism54/islpci_eth.h
--- a/drivers/net/wireless/prism54/islpci_eth.h	2004-06-02 23:27:00 -07:00
+++ b/drivers/net/wireless/prism54/islpci_eth.h	2004-06-02 23:27:00 -07:00
@@ -1,4 +1,4 @@
-/*  $Header: /var/lib/cvs/prism54-ng/ksrc/islpci_eth.h,v 1.5 2004/01/12 22:16:32 jmaurer Exp $
+/*
  *  
  *  Copyright (C) 2002 Intersil Americas Inc.
  *
@@ -23,9 +23,51 @@
 #include "isl_38xx.h"
 #include "islpci_dev.h"
 
+struct rfmon_header {
+	u16 unk0;		/* = 0x0000 */
+	u16 length;		/* = 0x1400 */
+	u32 clock;		/* 1MHz clock */
+	u8 flags;
+	u8 unk1;
+	u8 rate;
+	u8 unk2;
+	u16 freq;
+	u16 unk3;
+	u8 rssi;
+	u8 padding[3];
+} __attribute__ ((packed));
+
+struct rx_annex_header {
+	u8 addr1[ETH_ALEN];
+	u8 addr2[ETH_ALEN];
+	struct rfmon_header rfmon;
+} __attribute__ ((packed));
+
+/* wlan-ng (and hopefully others) AVS header, version one.  Fields in
+ * network byte order. */
+#define P80211CAPTURE_VERSION 0x80211001
+
+struct avs_80211_1_header {
+	uint32_t version;
+	uint32_t length;
+	uint64_t mactime;
+	uint64_t hosttime;
+	uint32_t phytype;
+	uint32_t channel;
+	uint32_t datarate;
+	uint32_t antenna;
+	uint32_t priority;
+	uint32_t ssi_type;
+	int32_t ssi_signal;
+	int32_t ssi_noise;
+	uint32_t preamble;
+	uint32_t encoding;
+};
+
 void islpci_eth_cleanup_transmit(islpci_private *, isl38xx_control_block *);
 int islpci_eth_transmit(struct sk_buff *, struct net_device *);
 int islpci_eth_receive(islpci_private *);
 void islpci_eth_tx_timeout(struct net_device *);
+void islpci_do_reset_and_wake(void *data);
 
 #endif				/* _ISL_GEN_H */
diff -Nru a/drivers/net/wireless/prism54/islpci_hotplug.c b/drivers/net/wireless/prism54/islpci_hotplug.c
--- a/drivers/net/wireless/prism54/islpci_hotplug.c	2004-06-02 23:26:59 -07:00
+++ b/drivers/net/wireless/prism54/islpci_hotplug.c	2004-06-02 23:26:59 -07:00
@@ -1,4 +1,4 @@
-/*  $Header: /var/lib/cvs/prism54-ng/ksrc/islpci_hotplug.c,v 1.56 2004/02/26 23:33:02 mcgrof Exp $
+/*
  *  
  *  Copyright (C) 2002 Intersil Americas Inc.
  *  Copyright (C) 2003 Herbert Valerio Riedel <hvr@gnu.org>
diff -Nru a/drivers/net/wireless/prism54/islpci_mgt.c b/drivers/net/wireless/prism54/islpci_mgt.c
--- a/drivers/net/wireless/prism54/islpci_mgt.c	2004-06-02 23:26:59 -07:00
+++ b/drivers/net/wireless/prism54/islpci_mgt.c	2004-06-02 23:26:59 -07:00
@@ -1,4 +1,4 @@
-/*  $Header: /var/lib/cvs/prism54-ng/ksrc/islpci_mgt.c,v 1.40 2004/02/01 10:57:23 mcgrof Exp $
+/*
  *  
  *  Copyright (C) 2002 Intersil Americas Inc.
  *  Copyright 2004 Jens Maurer <Jens.Maurer@gmx.net>
diff -Nru a/drivers/net/wireless/prism54/islpci_mgt.h b/drivers/net/wireless/prism54/islpci_mgt.h
--- a/drivers/net/wireless/prism54/islpci_mgt.h	2004-06-02 23:26:58 -07:00
+++ b/drivers/net/wireless/prism54/islpci_mgt.h	2004-06-02 23:26:58 -07:00
@@ -1,4 +1,4 @@
-/*  $Header: /var/lib/cvs/prism54-ng/ksrc/islpci_mgt.h,v 1.22 2004/01/30 16:24:00 ajfa Exp $
+/*
  *  
  *  Copyright (C) 2002 Intersil Americas Inc.
  *  Copyright (C) 2003 Luis R. Rodriguez <mcgrof@ruslug.rutgers.edu>
diff -Nru a/drivers/net/wireless/prism54/oid_mgt.c b/drivers/net/wireless/prism54/oid_mgt.c
--- a/drivers/net/wireless/prism54/oid_mgt.c	2004-06-02 23:27:00 -07:00
+++ b/drivers/net/wireless/prism54/oid_mgt.c	2004-06-02 23:27:00 -07:00
@@ -1,5 +1,5 @@
 /*   
- *  Copyright (C) 2003 Aurelien Alleaume <slts@free.fr>
+ *  Copyright (C) 2003,2004 Aurelien Alleaume <slts@free.fr>
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -31,182 +31,210 @@
 	5240, 5260, 5280, 5300, 5320
 };
 
-#define OID_U32(x) {x, 0, sizeof(u32), OID_FLAG_U32}
-#define OID_U32_C(x) {x, 0, sizeof(u32), OID_FLAG_U32 | OID_FLAG_CACHED}
-#define OID_STRUCT(x,s) {x, 0, sizeof(s), 0}
-#define OID_STRUCT_C(x,s) {x, 0, sizeof(s), OID_FLAG_CACHED}
-#define OID_STRUCT_MLME(x){x, 0, sizeof(struct obj_mlme), 0}
-#define OID_STRUCT_MLMEEX(x){x, 0, sizeof(struct obj_mlmeex), OID_FLAG_MLMEEX}
+int
+channel_of_freq(int f)
+{
+	int c = 0;
+
+	if ((f >= 2412) && (f <= 2484)) {
+		while ((c < 14) && (f != frequency_list_bg[c]))
+			c++;
+		if (c >= 14)
+			return 0;
+	} else if ((f >= (int) 5170) && (f <= (int) 5320)) {
+		while ((c < 12) && (f != frequency_list_a[c]))
+			c++;
+		if (c >= 12)
+			return 0;
+	} else
+		return 0;
+
+	return ++c;
+}
+
+#define OID_STRUCT(name,oid,s,t) [name] = {oid, 0, sizeof(s), t}
+#define OID_STRUCT_C(name,oid,s,t) OID_STRUCT(name,oid,s,t | OID_FLAG_CACHED)
+#define OID_U32(name,oid) OID_STRUCT(name,oid,u32,OID_TYPE_U32)
+#define OID_U32_C(name,oid) OID_STRUCT_C(name,oid,u32,OID_TYPE_U32)
+#define OID_STRUCT_MLME(name,oid) OID_STRUCT(name,oid,struct obj_mlme,OID_TYPE_MLME)
+#define OID_STRUCT_MLMEEX(name,oid) OID_STRUCT(name,oid,struct obj_mlmeex,OID_TYPE_MLMEEX)
 
-#define OID_UNKNOWN(x) {x, 0, 0, 0}
+#define OID_UNKNOWN(name,oid) OID_STRUCT(name,oid,0,0)
 
 struct oid_t isl_oid[] = {
-	[GEN_OID_MACADDRESS] = OID_STRUCT(0x00000000, u8[6]),
-	[GEN_OID_LINKSTATE] = OID_U32(0x00000001),
-	[GEN_OID_WATCHDOG] = OID_UNKNOWN(0x00000002),
-	[GEN_OID_MIBOP] = OID_UNKNOWN(0x00000003),
-	[GEN_OID_OPTIONS] = OID_UNKNOWN(0x00000004),
-	[GEN_OID_LEDCONFIG] = OID_UNKNOWN(0x00000005),
+	OID_STRUCT(GEN_OID_MACADDRESS, 0x00000000, u8[6], OID_TYPE_ADDR),
+	OID_U32(GEN_OID_LINKSTATE, 0x00000001),
+	OID_UNKNOWN(GEN_OID_WATCHDOG, 0x00000002),
+	OID_UNKNOWN(GEN_OID_MIBOP, 0x00000003),
+	OID_UNKNOWN(GEN_OID_OPTIONS, 0x00000004),
+	OID_UNKNOWN(GEN_OID_LEDCONFIG, 0x00000005),
 
 	/* 802.11 */
-	[DOT11_OID_BSSTYPE] = OID_U32_C(0x10000000),
-	[DOT11_OID_BSSID] = OID_STRUCT_C(0x10000001, u8[6]),
-	[DOT11_OID_SSID] = OID_STRUCT_C(0x10000002, struct obj_ssid),
-	[DOT11_OID_STATE] = OID_U32(0x10000003),
-	[DOT11_OID_AID] = OID_U32(0x10000004),
-	[DOT11_OID_COUNTRYSTRING] = OID_STRUCT(0x10000005, u8[4]),
-	[DOT11_OID_SSIDOVERRIDE] = OID_STRUCT_C(0x10000006, struct obj_ssid),
-
-	[DOT11_OID_MEDIUMLIMIT] = OID_U32(0x11000000),
-	[DOT11_OID_BEACONPERIOD] = OID_U32_C(0x11000001),
-	[DOT11_OID_DTIMPERIOD] = OID_U32(0x11000002),
-	[DOT11_OID_ATIMWINDOW] = OID_U32(0x11000003),
-	[DOT11_OID_LISTENINTERVAL] = OID_U32(0x11000004),
-	[DOT11_OID_CFPPERIOD] = OID_U32(0x11000005),
-	[DOT11_OID_CFPDURATION] = OID_U32(0x11000006),
-
-	[DOT11_OID_AUTHENABLE] = OID_U32_C(0x12000000),
-	[DOT11_OID_PRIVACYINVOKED] = OID_U32_C(0x12000001),
-	[DOT11_OID_EXUNENCRYPTED] = OID_U32_C(0x12000002),
-	[DOT11_OID_DEFKEYID] = OID_U32_C(0x12000003),
-	[DOT11_OID_DEFKEYX] = {0x12000004, 3, sizeof (struct obj_key), OID_FLAG_CACHED},	/* DOT11_OID_DEFKEY1,...DOT11_OID_DEFKEY4 */
-	[DOT11_OID_STAKEY] = OID_UNKNOWN(0x12000008),
-	[DOT11_OID_REKEYTHRESHOLD] = OID_U32(0x12000009),
-	[DOT11_OID_STASC] = OID_UNKNOWN(0x1200000a),
-
-	[DOT11_OID_PRIVTXREJECTED] = OID_U32(0x1a000000),
-	[DOT11_OID_PRIVRXPLAIN] = OID_U32(0x1a000001),
-	[DOT11_OID_PRIVRXFAILED] = OID_U32(0x1a000002),
-	[DOT11_OID_PRIVRXNOKEY] = OID_U32(0x1a000003),
-
-	[DOT11_OID_RTSTHRESH] = OID_U32_C(0x13000000),
-	[DOT11_OID_FRAGTHRESH] = OID_U32_C(0x13000001),
-	[DOT11_OID_SHORTRETRIES] = OID_U32_C(0x13000002),
-	[DOT11_OID_LONGRETRIES] = OID_U32_C(0x13000003),
-	[DOT11_OID_MAXTXLIFETIME] = OID_U32_C(0x13000004),
-	[DOT11_OID_MAXRXLIFETIME] = OID_U32(0x13000005),
-	[DOT11_OID_AUTHRESPTIMEOUT] = OID_U32(0x13000006),
-	[DOT11_OID_ASSOCRESPTIMEOUT] = OID_U32(0x13000007),
-
-	[DOT11_OID_ALOFT_TABLE] = OID_UNKNOWN(0x1d000000),
-	[DOT11_OID_ALOFT_CTRL_TABLE] = OID_UNKNOWN(0x1d000001),
-	[DOT11_OID_ALOFT_RETREAT] = OID_UNKNOWN(0x1d000002),
-	[DOT11_OID_ALOFT_PROGRESS] = OID_UNKNOWN(0x1d000003),
-	[DOT11_OID_ALOFT_FIXEDRATE] = OID_U32(0x1d000004),
-	[DOT11_OID_ALOFT_RSSIGRAPH] = OID_UNKNOWN(0x1d000005),
-	[DOT11_OID_ALOFT_CONFIG] = OID_UNKNOWN(0x1d000006),
+	OID_U32_C(DOT11_OID_BSSTYPE, 0x10000000),
+	OID_STRUCT_C(DOT11_OID_BSSID, 0x10000001, u8[6], OID_TYPE_SSID),
+	OID_STRUCT_C(DOT11_OID_SSID, 0x10000002, struct obj_ssid,
+		     OID_TYPE_SSID),
+	OID_U32(DOT11_OID_STATE, 0x10000003),
+	OID_U32(DOT11_OID_AID, 0x10000004),
+	OID_STRUCT(DOT11_OID_COUNTRYSTRING, 0x10000005, u8[4], OID_TYPE_RAW),
+	OID_STRUCT_C(DOT11_OID_SSIDOVERRIDE, 0x10000006, struct obj_ssid,
+		     OID_TYPE_SSID),
+
+	OID_U32(DOT11_OID_MEDIUMLIMIT, 0x11000000),
+	OID_U32_C(DOT11_OID_BEACONPERIOD, 0x11000001),
+	OID_U32(DOT11_OID_DTIMPERIOD, 0x11000002),
+	OID_U32(DOT11_OID_ATIMWINDOW, 0x11000003),
+	OID_U32(DOT11_OID_LISTENINTERVAL, 0x11000004),
+	OID_U32(DOT11_OID_CFPPERIOD, 0x11000005),
+	OID_U32(DOT11_OID_CFPDURATION, 0x11000006),
+
+	OID_U32_C(DOT11_OID_AUTHENABLE, 0x12000000),
+	OID_U32_C(DOT11_OID_PRIVACYINVOKED, 0x12000001),
+	OID_U32_C(DOT11_OID_EXUNENCRYPTED, 0x12000002),
+	OID_U32_C(DOT11_OID_DEFKEYID, 0x12000003),
+	[DOT11_OID_DEFKEYX] = {0x12000004, 3, sizeof (struct obj_key),
+			       OID_FLAG_CACHED | OID_TYPE_KEY},	/* DOT11_OID_DEFKEY1,...DOT11_OID_DEFKEY4 */
+	OID_UNKNOWN(DOT11_OID_STAKEY, 0x12000008),
+	OID_U32(DOT11_OID_REKEYTHRESHOLD, 0x12000009),
+	OID_UNKNOWN(DOT11_OID_STASC, 0x1200000a),
+
+	OID_U32(DOT11_OID_PRIVTXREJECTED, 0x1a000000),
+	OID_U32(DOT11_OID_PRIVRXPLAIN, 0x1a000001),
+	OID_U32(DOT11_OID_PRIVRXFAILED, 0x1a000002),
+	OID_U32(DOT11_OID_PRIVRXNOKEY, 0x1a000003),
+
+	OID_U32_C(DOT11_OID_RTSTHRESH, 0x13000000),
+	OID_U32_C(DOT11_OID_FRAGTHRESH, 0x13000001),
+	OID_U32_C(DOT11_OID_SHORTRETRIES, 0x13000002),
+	OID_U32_C(DOT11_OID_LONGRETRIES, 0x13000003),
+	OID_U32_C(DOT11_OID_MAXTXLIFETIME, 0x13000004),
+	OID_U32(DOT11_OID_MAXRXLIFETIME, 0x13000005),
+	OID_U32(DOT11_OID_AUTHRESPTIMEOUT, 0x13000006),
+	OID_U32(DOT11_OID_ASSOCRESPTIMEOUT, 0x13000007),
+
+	OID_UNKNOWN(DOT11_OID_ALOFT_TABLE, 0x1d000000),
+	OID_UNKNOWN(DOT11_OID_ALOFT_CTRL_TABLE, 0x1d000001),
+	OID_UNKNOWN(DOT11_OID_ALOFT_RETREAT, 0x1d000002),
+	OID_UNKNOWN(DOT11_OID_ALOFT_PROGRESS, 0x1d000003),
+	OID_U32(DOT11_OID_ALOFT_FIXEDRATE, 0x1d000004),
+	OID_UNKNOWN(DOT11_OID_ALOFT_RSSIGRAPH, 0x1d000005),
+	OID_UNKNOWN(DOT11_OID_ALOFT_CONFIG, 0x1d000006),
 
 	[DOT11_OID_VDCFX] = {0x1b000000, 7, 0, 0},
-	[DOT11_OID_MAXFRAMEBURST] = OID_U32(0x1b000008), /* in microseconds */
+	OID_U32(DOT11_OID_MAXFRAMEBURST, 0x1b000008),
 
-	[DOT11_OID_PSM] = OID_U32(0x14000000),
-	[DOT11_OID_CAMTIMEOUT] = OID_U32(0x14000001),
-	[DOT11_OID_RECEIVEDTIMS] = OID_U32(0x14000002),
-	[DOT11_OID_ROAMPREFERENCE] = OID_U32(0x14000003),
-
-	[DOT11_OID_BRIDGELOCAL] = OID_U32(0x15000000),
-	[DOT11_OID_CLIENTS] = OID_U32(0x15000001),
-	[DOT11_OID_CLIENTSASSOCIATED] = OID_U32(0x15000002),
+	OID_U32(DOT11_OID_PSM, 0x14000000),
+	OID_U32(DOT11_OID_CAMTIMEOUT, 0x14000001),
+	OID_U32(DOT11_OID_RECEIVEDTIMS, 0x14000002),
+	OID_U32(DOT11_OID_ROAMPREFERENCE, 0x14000003),
+
+	OID_U32(DOT11_OID_BRIDGELOCAL, 0x15000000),
+	OID_U32(DOT11_OID_CLIENTS, 0x15000001),
+	OID_U32(DOT11_OID_CLIENTSASSOCIATED, 0x15000002),
 	[DOT11_OID_CLIENTX] = {0x15000003, 2006, 0, 0},	/* DOT11_OID_CLIENTX,...DOT11_OID_CLIENT2007 */
 
-	[DOT11_OID_CLIENTFIND] = OID_STRUCT(0x150007DB, u8[6]),
-	[DOT11_OID_WDSLINKADD] = OID_STRUCT(0x150007DC, u8[6]),
-	[DOT11_OID_WDSLINKREMOVE] = OID_STRUCT(0x150007DD, u8[6]),
-	[DOT11_OID_EAPAUTHSTA] = OID_STRUCT(0x150007DE, u8[6]),
-	[DOT11_OID_EAPUNAUTHSTA] = OID_STRUCT(0x150007DF, u8[6]),
-	[DOT11_OID_DOT1XENABLE] = OID_U32_C(0x150007E0),
-	[DOT11_OID_MICFAILURE] = OID_UNKNOWN(0x150007E1),
-	[DOT11_OID_REKEYINDICATE] = OID_UNKNOWN(0x150007E2),
-
-	[DOT11_OID_MPDUTXSUCCESSFUL] = OID_U32(0x16000000),
-	[DOT11_OID_MPDUTXONERETRY] = OID_U32(0x16000001),
-	[DOT11_OID_MPDUTXMULTIPLERETRIES] = OID_U32(0x16000002),
-	[DOT11_OID_MPDUTXFAILED] = OID_U32(0x16000003),
-	[DOT11_OID_MPDURXSUCCESSFUL] = OID_U32(0x16000004),
-	[DOT11_OID_MPDURXDUPS] = OID_U32(0x16000005),
-	[DOT11_OID_RTSSUCCESSFUL] = OID_U32(0x16000006),
-	[DOT11_OID_RTSFAILED] = OID_U32(0x16000007),
-	[DOT11_OID_ACKFAILED] = OID_U32(0x16000008),
-	[DOT11_OID_FRAMERECEIVES] = OID_U32(0x16000009),
-	[DOT11_OID_FRAMEERRORS] = OID_U32(0x1600000A),
-	[DOT11_OID_FRAMEABORTS] = OID_U32(0x1600000B),
-	[DOT11_OID_FRAMEABORTSPHY] = OID_U32(0x1600000C),
-
-	[DOT11_OID_SLOTTIME] = OID_U32(0x17000000),
-	[DOT11_OID_CWMIN] = OID_U32(0x17000001),
-	[DOT11_OID_CWMAX] = OID_U32(0x17000002),
-	[DOT11_OID_ACKWINDOW] = OID_U32(0x17000003),
-	[DOT11_OID_ANTENNARX] = OID_U32(0x17000004),
-	[DOT11_OID_ANTENNATX] = OID_U32(0x17000005),
-	[DOT11_OID_ANTENNADIVERSITY] = OID_U32(0x17000006),
-	[DOT11_OID_CHANNEL] = OID_U32_C(0x17000007),
-	[DOT11_OID_EDTHRESHOLD] = OID_U32_C(0x17000008),
-	[DOT11_OID_PREAMBLESETTINGS] = OID_U32(0x17000009),
-	[DOT11_OID_RATES] = OID_STRUCT(0x1700000A, u8[IWMAX_BITRATES + 1]),
-	[DOT11_OID_CCAMODESUPPORTED] = OID_U32(0x1700000B),
-	[DOT11_OID_CCAMODE] = OID_U32(0x1700000C),
-	[DOT11_OID_RSSIVECTOR] = OID_U32(0x1700000D),
-	[DOT11_OID_OUTPUTPOWERTABLE] = OID_U32(0x1700000E),
-	[DOT11_OID_OUTPUTPOWER] = OID_U32_C(0x1700000F),
-	[DOT11_OID_SUPPORTEDRATES] =
-	    OID_STRUCT(0x17000010, u8[IWMAX_BITRATES + 1]),
-	[DOT11_OID_FREQUENCY] = OID_U32_C(0x17000011),
-	[DOT11_OID_SUPPORTEDFREQUENCIES] = {0x17000012, 0, sizeof (struct
-								   obj_frequencies)
-					    + sizeof (u16) * IWMAX_FREQ, 0},
-
-	[DOT11_OID_NOISEFLOOR] = OID_U32(0x17000013),
-	[DOT11_OID_FREQUENCYACTIVITY] =
-	    OID_STRUCT(0x17000014, u8[IWMAX_FREQ + 1]),
-	[DOT11_OID_IQCALIBRATIONTABLE] = OID_UNKNOWN(0x17000015),
-	[DOT11_OID_NONERPPROTECTION] = OID_U32(0x17000016),
-	[DOT11_OID_SLOTSETTINGS] = OID_U32(0x17000017),
-	[DOT11_OID_NONERPTIMEOUT] = OID_U32(0x17000018),
-	[DOT11_OID_PROFILES] = OID_U32(0x17000019),
-	[DOT11_OID_EXTENDEDRATES] =
-	    OID_STRUCT(0x17000020, u8[IWMAX_BITRATES + 1]),
-
-	[DOT11_OID_DEAUTHENTICATE] = OID_STRUCT_MLME(0x18000000),
-	[DOT11_OID_AUTHENTICATE] = OID_STRUCT_MLME(0x18000001),
-	[DOT11_OID_DISASSOCIATE] = OID_STRUCT_MLME(0x18000002),
-	[DOT11_OID_ASSOCIATE] = OID_STRUCT_MLME(0x18000003),
-	[DOT11_OID_SCAN] = OID_UNKNOWN(0x18000004),
-	[DOT11_OID_BEACON] = OID_STRUCT_MLMEEX(0x18000005),
-	[DOT11_OID_PROBE] = OID_STRUCT_MLMEEX(0x18000006),
-	[DOT11_OID_DEAUTHENTICATEEX] = OID_STRUCT_MLMEEX(0x18000007),
-	[DOT11_OID_AUTHENTICATEEX] = OID_STRUCT_MLMEEX(0x18000008),
-	[DOT11_OID_DISASSOCIATEEX] = OID_STRUCT_MLMEEX(0x18000009),
-	[DOT11_OID_ASSOCIATEEX] = OID_STRUCT_MLMEEX(0x1800000A),
-	[DOT11_OID_REASSOCIATE] = OID_STRUCT_MLMEEX(0x1800000B),
-	[DOT11_OID_REASSOCIATEEX] = OID_STRUCT_MLMEEX(0x1800000C),
-
-	[DOT11_OID_NONERPSTATUS] = OID_U32(0x1E000000),
-
-	[DOT11_OID_STATIMEOUT] = OID_U32(0x19000000),
-	[DOT11_OID_MLMEAUTOLEVEL] = OID_U32_C(0x19000001),
-	[DOT11_OID_BSSTIMEOUT] = OID_U32(0x19000002),
-	[DOT11_OID_ATTACHMENT] = OID_UNKNOWN(0x19000003),
-	[DOT11_OID_PSMBUFFER] = OID_STRUCT_C(0x19000004, struct obj_buffer),
-
-	[DOT11_OID_BSSS] = OID_U32(0x1C000000),
-	[DOT11_OID_BSSX] = {0x1C000001, 63, sizeof (struct obj_bss), 0},	/*DOT11_OID_BSS1,...,DOT11_OID_BSS64 */
-	[DOT11_OID_BSSFIND] = OID_STRUCT(0x1C000042, struct obj_bss),
+	OID_STRUCT(DOT11_OID_CLIENTFIND, 0x150007DB, u8[6], OID_TYPE_ADDR),
+	OID_STRUCT(DOT11_OID_WDSLINKADD, 0x150007DC, u8[6], OID_TYPE_ADDR),
+	OID_STRUCT(DOT11_OID_WDSLINKREMOVE, 0x150007DD, u8[6], OID_TYPE_ADDR),
+	OID_STRUCT(DOT11_OID_EAPAUTHSTA, 0x150007DE, u8[6], OID_TYPE_ADDR),
+	OID_STRUCT(DOT11_OID_EAPUNAUTHSTA, 0x150007DF, u8[6], OID_TYPE_ADDR),
+	OID_U32_C(DOT11_OID_DOT1XENABLE, 0x150007E0),
+	OID_UNKNOWN(DOT11_OID_MICFAILURE, 0x150007E1),
+	OID_UNKNOWN(DOT11_OID_REKEYINDICATE, 0x150007E2),
+
+	OID_U32(DOT11_OID_MPDUTXSUCCESSFUL, 0x16000000),
+	OID_U32(DOT11_OID_MPDUTXONERETRY, 0x16000001),
+	OID_U32(DOT11_OID_MPDUTXMULTIPLERETRIES, 0x16000002),
+	OID_U32(DOT11_OID_MPDUTXFAILED, 0x16000003),
+	OID_U32(DOT11_OID_MPDURXSUCCESSFUL, 0x16000004),
+	OID_U32(DOT11_OID_MPDURXDUPS, 0x16000005),
+	OID_U32(DOT11_OID_RTSSUCCESSFUL, 0x16000006),
+	OID_U32(DOT11_OID_RTSFAILED, 0x16000007),
+	OID_U32(DOT11_OID_ACKFAILED, 0x16000008),
+	OID_U32(DOT11_OID_FRAMERECEIVES, 0x16000009),
+	OID_U32(DOT11_OID_FRAMEERRORS, 0x1600000A),
+	OID_U32(DOT11_OID_FRAMEABORTS, 0x1600000B),
+	OID_U32(DOT11_OID_FRAMEABORTSPHY, 0x1600000C),
+
+	OID_U32(DOT11_OID_SLOTTIME, 0x17000000),
+	OID_U32(DOT11_OID_CWMIN, 0x17000001),
+	OID_U32(DOT11_OID_CWMAX, 0x17000002),
+	OID_U32(DOT11_OID_ACKWINDOW, 0x17000003),
+	OID_U32(DOT11_OID_ANTENNARX, 0x17000004),
+	OID_U32(DOT11_OID_ANTENNATX, 0x17000005),
+	OID_U32(DOT11_OID_ANTENNADIVERSITY, 0x17000006),
+	OID_U32_C(DOT11_OID_CHANNEL, 0x17000007),
+	OID_U32_C(DOT11_OID_EDTHRESHOLD, 0x17000008),
+	OID_U32(DOT11_OID_PREAMBLESETTINGS, 0x17000009),
+	OID_STRUCT(DOT11_OID_RATES, 0x1700000A, u8[IWMAX_BITRATES + 1],
+		   OID_TYPE_RAW),
+	OID_U32(DOT11_OID_CCAMODESUPPORTED, 0x1700000B),
+	OID_U32(DOT11_OID_CCAMODE, 0x1700000C),
+	OID_UNKNOWN(DOT11_OID_RSSIVECTOR, 0x1700000D),
+	OID_UNKNOWN(DOT11_OID_OUTPUTPOWERTABLE, 0x1700000E),
+	OID_U32(DOT11_OID_OUTPUTPOWER, 0x1700000F),
+	OID_STRUCT(DOT11_OID_SUPPORTEDRATES, 0x17000010,
+		   u8[IWMAX_BITRATES + 1], OID_TYPE_RAW),
+	OID_U32_C(DOT11_OID_FREQUENCY, 0x17000011),
+	[DOT11_OID_SUPPORTEDFREQUENCIES] =
+	    {0x17000012, 0, sizeof (struct obj_frequencies)
+	     + sizeof (u16) * IWMAX_FREQ, OID_TYPE_FREQUENCIES},
+
+	OID_U32(DOT11_OID_NOISEFLOOR, 0x17000013),
+	OID_STRUCT(DOT11_OID_FREQUENCYACTIVITY, 0x17000014, u8[IWMAX_FREQ + 1],
+		   OID_TYPE_RAW),
+	OID_UNKNOWN(DOT11_OID_IQCALIBRATIONTABLE, 0x17000015),
+	OID_U32(DOT11_OID_NONERPPROTECTION, 0x17000016),
+	OID_U32(DOT11_OID_SLOTSETTINGS, 0x17000017),
+	OID_U32(DOT11_OID_NONERPTIMEOUT, 0x17000018),
+	OID_U32(DOT11_OID_PROFILES, 0x17000019),
+	OID_STRUCT(DOT11_OID_EXTENDEDRATES, 0x17000020,
+		   u8[IWMAX_BITRATES + 1], OID_TYPE_RAW),
+
+	OID_STRUCT_MLME(DOT11_OID_DEAUTHENTICATE, 0x18000000),
+	OID_STRUCT_MLME(DOT11_OID_AUTHENTICATE, 0x18000001),
+	OID_STRUCT_MLME(DOT11_OID_DISASSOCIATE, 0x18000002),
+	OID_STRUCT_MLME(DOT11_OID_ASSOCIATE, 0x18000003),
+	OID_UNKNOWN(DOT11_OID_SCAN, 0x18000004),
+	OID_STRUCT_MLMEEX(DOT11_OID_BEACON, 0x18000005),
+	OID_STRUCT_MLMEEX(DOT11_OID_PROBE, 0x18000006),
+	OID_STRUCT_MLMEEX(DOT11_OID_DEAUTHENTICATEEX, 0x18000007),
+	OID_STRUCT_MLMEEX(DOT11_OID_AUTHENTICATEEX, 0x18000008),
+	OID_STRUCT_MLMEEX(DOT11_OID_DISASSOCIATEEX, 0x18000009),
+	OID_STRUCT_MLMEEX(DOT11_OID_ASSOCIATEEX, 0x1800000A),
+	OID_STRUCT_MLMEEX(DOT11_OID_REASSOCIATE, 0x1800000B),
+	OID_STRUCT_MLMEEX(DOT11_OID_REASSOCIATEEX, 0x1800000C),
+
+	OID_U32(DOT11_OID_NONERPSTATUS, 0x1E000000),
+
+	OID_U32(DOT11_OID_STATIMEOUT, 0x19000000),
+	OID_U32_C(DOT11_OID_MLMEAUTOLEVEL, 0x19000001),
+	OID_U32(DOT11_OID_BSSTIMEOUT, 0x19000002),
+	OID_UNKNOWN(DOT11_OID_ATTACHMENT, 0x19000003),
+	OID_STRUCT_C(DOT11_OID_PSMBUFFER, 0x19000004, struct obj_buffer,
+		     OID_TYPE_BUFFER),
+
+	OID_U32(DOT11_OID_BSSS, 0x1C000000),
+	[DOT11_OID_BSSX] = {0x1C000001, 63, sizeof (struct obj_bss),
+			    OID_TYPE_BSS},	/*DOT11_OID_BSS1,...,DOT11_OID_BSS64 */
+	OID_STRUCT(DOT11_OID_BSSFIND, 0x1C000042, struct obj_bss, OID_TYPE_BSS),
 	[DOT11_OID_BSSLIST] = {0x1C000043, 0, sizeof (struct
 						      obj_bsslist) +
-			       sizeof (struct obj_bss[IWMAX_BSS]), 0},
+			       sizeof (struct obj_bss[IWMAX_BSS]),
+			       OID_TYPE_BSSLIST},
 
-	[OID_INL_TUNNEL] = OID_UNKNOWN(0xFF020000),
-	[OID_INL_MEMADDR] = OID_UNKNOWN(0xFF020001),
-	[OID_INL_MEMORY] = OID_UNKNOWN(0xFF020002),
-	[OID_INL_MODE] = OID_U32_C(0xFF020003),
-	[OID_INL_COMPONENT_NR] = OID_UNKNOWN(0xFF020004),
-	[OID_INL_VERSION] = OID_UNKNOWN(0xFF020005),
-	[OID_INL_INTERFACE_ID] = OID_UNKNOWN(0xFF020006),
-	[OID_INL_COMPONENT_ID] = OID_UNKNOWN(0xFF020007),
-	[OID_INL_CONFIG] = OID_U32_C(0xFF020008),
-	[OID_INL_DOT11D_CONFORMANCE] = OID_U32_C(0xFF02000C),
-	[OID_INL_PHYCAPABILITIES] = OID_U32(0xFF02000D),
-	[OID_INL_OUTPUTPOWER] = OID_U32_C(0xFF02000F),
+	OID_UNKNOWN(OID_INL_TUNNEL, 0xFF020000),
+	OID_UNKNOWN(OID_INL_MEMADDR, 0xFF020001),
+	OID_UNKNOWN(OID_INL_MEMORY, 0xFF020002),
+	OID_U32_C(OID_INL_MODE, 0xFF020003),
+	OID_UNKNOWN(OID_INL_COMPONENT_NR, 0xFF020004),
+	OID_UNKNOWN(OID_INL_VERSION, 0xFF020005),
+	OID_UNKNOWN(OID_INL_INTERFACE_ID, 0xFF020006),
+	OID_UNKNOWN(OID_INL_COMPONENT_ID, 0xFF020007),
+	OID_U32_C(OID_INL_CONFIG, 0xFF020008),
+	OID_U32_C(OID_INL_DOT11D_CONFORMANCE, 0xFF02000C),
+	OID_U32(OID_INL_PHYCAPABILITIES, 0xFF02000D),
+	OID_U32_C(OID_INL_OUTPUTPOWER, 0xFF02000F),
 
 };
 
@@ -257,6 +285,134 @@
 	priv->mib = NULL;
 }
 
+void
+mgt_le_to_cpu(int type, void *data)
+{
+	switch (type) {
+	case OID_TYPE_U32:
+		*(u32 *) data = le32_to_cpu(*(u32 *) data);
+		break;
+	case OID_TYPE_BUFFER:{
+			struct obj_buffer *buff = data;
+			buff->size = le32_to_cpu(buff->size);
+			buff->addr = le32_to_cpu(buff->addr);
+			break;
+		}
+	case OID_TYPE_BSS:{
+			struct obj_bss *bss = data;
+			bss->age = le16_to_cpu(bss->age);
+			bss->channel = le16_to_cpu(bss->channel);
+			bss->capinfo = le16_to_cpu(bss->capinfo);
+			bss->rates = le16_to_cpu(bss->rates);
+			bss->basic_rates = le16_to_cpu(bss->basic_rates);
+			break;
+		}
+	case OID_TYPE_BSSLIST:{
+			struct obj_bsslist *list = data;
+			int i;
+			list->nr = le32_to_cpu(list->nr);
+			for (i = 0; i < list->nr; i++)
+				mgt_le_to_cpu(OID_TYPE_BSS, &list->bsslist[i]);
+			break;
+		}
+	case OID_TYPE_FREQUENCIES:{
+			struct obj_frequencies *freq = data;
+			int i;
+			freq->nr = le16_to_cpu(freq->nr);
+			for (i = 0; i < freq->nr; i++)
+				freq->mhz[i] = le16_to_cpu(freq->mhz[i]);
+			break;
+		}
+	case OID_TYPE_MLME:{
+			struct obj_mlme *mlme = data;
+			mlme->id = le16_to_cpu(mlme->id);
+			mlme->state = le16_to_cpu(mlme->state);
+			mlme->code = le16_to_cpu(mlme->code);
+			break;
+		}
+	case OID_TYPE_MLMEEX:{
+			struct obj_mlmeex *mlme = data;
+			mlme->id = le16_to_cpu(mlme->id);
+			mlme->state = le16_to_cpu(mlme->state);
+			mlme->code = le16_to_cpu(mlme->code);
+			mlme->size = le16_to_cpu(mlme->size);
+			break;
+		}
+	case OID_TYPE_SSID:
+	case OID_TYPE_KEY:
+	case OID_TYPE_ADDR:
+	case OID_TYPE_RAW:
+		break;
+	default:
+		BUG();
+	}
+}
+
+static void
+mgt_cpu_to_le(int type, void *data)
+{
+	switch (type) {
+	case OID_TYPE_U32:
+		*(u32 *) data = cpu_to_le32(*(u32 *) data);
+		break;
+	case OID_TYPE_BUFFER:{
+			struct obj_buffer *buff = data;
+			buff->size = cpu_to_le32(buff->size);
+			buff->addr = cpu_to_le32(buff->addr);
+			break;
+		}
+	case OID_TYPE_BSS:{
+			struct obj_bss *bss = data;
+			bss->age = cpu_to_le16(bss->age);
+			bss->channel = cpu_to_le16(bss->channel);
+			bss->capinfo = cpu_to_le16(bss->capinfo);
+			bss->rates = cpu_to_le16(bss->rates);
+			bss->basic_rates = cpu_to_le16(bss->basic_rates);
+			break;
+		}
+	case OID_TYPE_BSSLIST:{
+			struct obj_bsslist *list = data;
+			int i;
+			list->nr = cpu_to_le32(list->nr);
+			for (i = 0; i < list->nr; i++)
+				mgt_cpu_to_le(OID_TYPE_BSS, &list->bsslist[i]);
+			break;
+		}
+	case OID_TYPE_FREQUENCIES:{
+			struct obj_frequencies *freq = data;
+			int i;
+			freq->nr = cpu_to_le16(freq->nr);
+			for (i = 0; i < freq->nr; i++)
+				freq->mhz[i] = cpu_to_le16(freq->mhz[i]);
+			break;
+		}
+	case OID_TYPE_MLME:{
+			struct obj_mlme *mlme = data;
+			mlme->id = cpu_to_le16(mlme->id);
+			mlme->state = cpu_to_le16(mlme->state);
+			mlme->code = cpu_to_le16(mlme->code);
+			break;
+		}
+	case OID_TYPE_MLMEEX:{
+			struct obj_mlmeex *mlme = data;
+			mlme->id = cpu_to_le16(mlme->id);
+			mlme->state = cpu_to_le16(mlme->state);
+			mlme->code = cpu_to_le16(mlme->code);
+			mlme->size = cpu_to_le16(mlme->size);
+			break;
+		}
+	case OID_TYPE_SSID:
+	case OID_TYPE_KEY:
+	case OID_TYPE_ADDR:
+	case OID_TYPE_RAW:
+		break;
+	default:
+		BUG();
+	}
+}
+
+/* Note : data is modified during this function */
+
 int
 mgt_set_request(islpci_private *priv, enum oid_num_t n, int extra, void *data)
 {
@@ -265,7 +421,7 @@
 	int response_op = PIMFOR_OP_ERROR;
 	int dlen;
 	void *cache, *_data = data;
-	u32 oid, u;
+	u32 oid;
 
 	BUG_ON(OID_NUM_LAST <= n);
 	BUG_ON(extra > isl_oid[n].range);
@@ -279,13 +435,11 @@
 	cache += (cache ? extra * dlen : 0);
 	oid = isl_oid[n].oid + extra;
 
-	if (data == NULL)
+	if (_data == NULL)
 		/* we are requested to re-set a cached value */
 		_data = cache;
-	if ((isl_oid[n].flags & OID_FLAG_U32) && data) {
-		u = cpu_to_le32(*(u32 *) data);
-		_data = &u;
-	}
+	else
+		mgt_cpu_to_le(isl_oid[n].flags & OID_FLAG_TYPE, _data);
 	/* If we are going to write to the cache, we don't want anyone to read
 	 * it -> acquire write lock.
 	 * Else we could acquire a read lock to be sure we don't bother the
@@ -313,6 +467,10 @@
 		up_write(&priv->mib_sem);
 	}
 
+	/* re-set given data to what it was */
+	if (data)
+		mgt_le_to_cpu(isl_oid[n].flags & OID_FLAG_TYPE, data);
+
 	return ret;
 }
 
@@ -326,7 +484,7 @@
 	struct islpci_mgmtframe *response = NULL;
 	
 	int dlen;
-	void *cache, *_res=NULL;
+	void *cache, *_res = NULL;
 	u32 oid;
 
 	BUG_ON(OID_NUM_LAST <= n);
@@ -362,20 +520,19 @@
 		_res = cache;
 		ret = 0;
 	}
-	if (isl_oid[n].flags & OID_FLAG_U32) {
-		if (ret)
-			res->u = 0;
-		else
-			res->u = le32_to_cpu(*(u32 *) _res);
-	} else {
+	if ((isl_oid[n].flags & OID_FLAG_TYPE) == OID_TYPE_U32)
+		res->u = ret ? 0 : le32_to_cpu(*(u32 *) _res);
+	else {
 		res->ptr = kmalloc(reslen, GFP_KERNEL);
 		BUG_ON(res->ptr == NULL);
 		if (ret)
 			memset(res->ptr, 0, reslen);
-		else
+		else {
 			memcpy(res->ptr, _res, reslen);
+			mgt_le_to_cpu(isl_oid[n].flags & OID_FLAG_TYPE,
+				      res->ptr);
+		}
 	}
-
 	if (cache)
 		up_read(&priv->mib_sem);
 
@@ -404,7 +561,7 @@
 		int j = 0;
 		u32 oid = t->oid;
 		BUG_ON(data == NULL);
-		while (j <= t->range){
+		while (j <= t->range) {
 			response = NULL;
 			ret |= islpci_mgt_transaction(priv->ndev, PIMFOR_OP_SET,
 			                              oid, data, t->size,
@@ -431,13 +588,21 @@
 	BUG_ON(priv->mib[n] == NULL);
 
 	memcpy(priv->mib[n], data, isl_oid[n].size);
-	if (isl_oid[n].flags & OID_FLAG_U32)
-		*(u32 *) priv->mib[n] = cpu_to_le32(*(u32 *) priv->mib[n]);
+	mgt_cpu_to_le(isl_oid[n].flags & OID_FLAG_TYPE, priv->mib[n]);
 }
 
-/* Commits the cache. If something goes wrong, it restarts the device. Lock
- * outside
- */
+void
+mgt_get(islpci_private *priv, enum oid_num_t n, void *res)
+{
+	BUG_ON(OID_NUM_LAST <= n);
+	BUG_ON(priv->mib[n] == NULL);
+	BUG_ON(res == NULL);
+
+	memcpy(res, priv->mib[n], isl_oid[n].size);
+	mgt_le_to_cpu(isl_oid[n].flags & OID_FLAG_TYPE, res);
+}
+
+/* Commits the cache. Lock outside. */
 
 static enum oid_num_t commit_part1[] = {
 	OID_INL_CONFIG,
@@ -528,5 +693,104 @@
 
 	printk(KERN_DEBUG "looking for an unknown oid 0x%x", oid);
 
+	return 0;
+}
+
+int
+mgt_response_to_str(enum oid_num_t n, union oid_res_t *r, char *str)
+{
+	switch (isl_oid[n].flags & OID_FLAG_TYPE) {
+	case OID_TYPE_U32:
+		return snprintf(str, PRIV_STR_SIZE, "%u\n", r->u);
+		break;
+	case OID_TYPE_BUFFER:{
+			struct obj_buffer *buff = r->ptr;
+			return snprintf(str, PRIV_STR_SIZE,
+					"size=%u\naddr=0x%X\n", buff->size,
+					buff->addr);
+		}
+		break;
+	case OID_TYPE_BSS:{
+			struct obj_bss *bss = r->ptr;
+			return snprintf(str, PRIV_STR_SIZE,
+					"age=%u\nchannel=%u\n\
+				        capinfo=0x%X\nrates=0x%X\nbasic_rates=0x%X\n", bss->age, bss->channel, bss->capinfo, bss->rates, bss->basic_rates);
+		}
+		break;
+	case OID_TYPE_BSSLIST:{
+			struct obj_bsslist *list = r->ptr;
+			int i, k;
+			k = snprintf(str, PRIV_STR_SIZE, "nr=%u\n", list->nr);
+			for (i = 0; i < list->nr; i++)
+				k += snprintf(str + k, PRIV_STR_SIZE - k,
+					      "bss[%u] : \nage=%u\nchannel=%u\ncapinfo=0x%X\nrates=0x%X\nbasic_rates=0x%X\n",
+					      i, list->bsslist[i].age,
+					      list->bsslist[i].channel,
+					      list->bsslist[i].capinfo,
+					      list->bsslist[i].rates,
+					      list->bsslist[i].basic_rates);
+			return k;
+		}
+		break;
+	case OID_TYPE_FREQUENCIES:{
+			struct obj_frequencies *freq = r->ptr;
+			int i, t;
+			printk("nr : %u\n", freq->nr);
+			t = snprintf(str, PRIV_STR_SIZE, "nr=%u\n", freq->nr);
+			for (i = 0; i < freq->nr; i++)
+				t += snprintf(str + t, PRIV_STR_SIZE - t,
+					      "mhz[%u]=%u\n", i, freq->mhz[i]);
+			return t;
+		}
+		break;
+	case OID_TYPE_MLME:{
+			struct obj_mlme *mlme = r->ptr;
+			return snprintf(str, PRIV_STR_SIZE, "id=0x%X\nstate=0x%X\n\
+			         code=0x%X\n", mlme->id, mlme->state,
+					mlme->code);
+		}
+		break;
+	case OID_TYPE_MLMEEX:{
+			struct obj_mlmeex *mlme = r->ptr;
+			return snprintf(str, PRIV_STR_SIZE, "id=0x%X\nstate=0x%X\n\
+			         code=0x%X\nsize=0x%X\n", mlme->id, mlme->state,
+					mlme->code, mlme->size);
+		}
+		break;
+	case OID_TYPE_SSID:{
+			struct obj_ssid *ssid = r->ptr;
+			return snprintf(str, PRIV_STR_SIZE,
+					"length=%u\noctets=%s\n",
+					ssid->length, ssid->octets);
+		}
+		break;
+	case OID_TYPE_KEY:{
+			struct obj_key *key = r->ptr;
+			int t, i;
+			t = snprintf(str, PRIV_STR_SIZE,
+				     "type=0x%X\nlength=0x%X\nkey=0x",
+				     key->type, key->length);
+			for (i = 0; i < key->length; i++)
+				t += snprintf(str + t, PRIV_STR_SIZE - t,
+					      "%02X:", key->key[i]);
+			t += snprintf(str + t, PRIV_STR_SIZE - t, "\n");
+			return t;
+		}
+		break;
+	case OID_TYPE_RAW:
+	case OID_TYPE_ADDR:{
+			unsigned char *buff = r->ptr;
+			int t, i;
+			t = snprintf(str, PRIV_STR_SIZE, "hex data=");
+			for (i = 0; i < isl_oid[n].size; i++)
+				t += snprintf(str + t, PRIV_STR_SIZE - t,
+					      "%02X:", buff[i]);
+			t += snprintf(str + t, PRIV_STR_SIZE - t, "\n");
+			return t;
+		}
+		break;
+	default:
+		BUG();
+	}
 	return 0;
 }
diff -Nru a/drivers/net/wireless/prism54/oid_mgt.h b/drivers/net/wireless/prism54/oid_mgt.h
--- a/drivers/net/wireless/prism54/oid_mgt.h	2004-06-02 23:27:00 -07:00
+++ b/drivers/net/wireless/prism54/oid_mgt.h	2004-06-02 23:27:00 -07:00
@@ -1,4 +1,4 @@
-/*   
+/*
  *  Copyright (C) 2003 Aurelien Alleaume <slts@free.fr>
  *
  *  This program is free software; you can redistribute it and/or modify
@@ -28,9 +28,12 @@
 
 void mgt_clean(islpci_private *);
 
+/* I don't know where to put these 3 */
 extern const int frequency_list_bg[];
-
 extern const int frequency_list_a[];
+int channel_of_freq(int);
+
+void mgt_le_to_cpu(int, void *);
 
 int mgt_set_request(islpci_private *, enum oid_num_t, int, void *);
 
@@ -41,11 +44,15 @@
 
 void mgt_set(islpci_private *, enum oid_num_t, void *);
 
+void mgt_get(islpci_private *, enum oid_num_t, void *);
+
 void mgt_commit(islpci_private *);
 
 int mgt_mlme_answer(islpci_private *);
 
 enum oid_num_t mgt_oidtonum(u32 oid);
+
+int mgt_response_to_str(enum oid_num_t, union oid_res_t *, char *);
 
 #endif				/* !defined(_OID_MGT_H) */
 /* EOF */
diff -Nru a/drivers/pcmcia/pxa2xx_base.c b/drivers/pcmcia/pxa2xx_base.c
--- a/drivers/pcmcia/pxa2xx_base.c	2004-06-02 23:27:00 -07:00
+++ b/drivers/pcmcia/pxa2xx_base.c	2004-06-02 23:27:00 -07:00
@@ -113,21 +113,24 @@
 	return 0;
 }
 
-static int pxa2xx_pcmcia_set_mcxx(struct soc_pcmcia_socket *skt, unsigned int lclk)
+static int pxa2xx_pcmcia_set_mcxx(struct soc_pcmcia_socket *skt, unsigned int clk)
 {
+	struct soc_pcmcia_timing timing;
 	int sock = skt->nr;
 
-	pxa2xx_pcmcia_set_mcmem( sock, SOC_PCMCIA_5V_MEM_ACCESS, lclk );
-	pxa2xx_pcmcia_set_mcatt( sock, SOC_PCMCIA_ATTR_MEM_ACCESS, lclk );
-	pxa2xx_pcmcia_set_mcio( sock, SOC_PCMCIA_IO_ACCESS, lclk );
+	soc_common_pcmcia_get_timing(skt, &timing);
+
+	pxa2xx_pcmcia_set_mcmem(sock, timing.mem, clk);
+	pxa2xx_pcmcia_set_mcatt(sock, timing.attr, clk);
+	pxa2xx_pcmcia_set_mcio(sock, timing.io, clk);
 
 	return 0;
 }
 
 static int pxa2xx_pcmcia_set_timing(struct soc_pcmcia_socket *skt)
 {
-	unsigned int lclk = get_lclk_frequency_10khz();
-	return pxa2xx_pcmcia_set_mcxx(skt, lclk);
+	unsigned int clk = get_memclk_frequency_10khz();
+	return pxa2xx_pcmcia_set_mcxx(skt, clk);
 }
 
 int pxa2xx_drv_pcmcia_probe(struct device *dev)
@@ -237,12 +240,7 @@
 
 	down(&soc_sockets_lock);
 	list_for_each_entry(skt, &soc_sockets, node) {
-		pxa2xx_pcmcia_set_mcio(skt->nr, calc_speed(skt->spd_io,
-				       MAX_IO_WIN, SOC_PCMCIA_IO_ACCESS), clock);
-		pxa2xx_pcmcia_set_mcmem(skt->nr, calc_speed(skt->spd_io,
-					MAX_IO_WIN, SOC_PCMCIA_3V_MEM_ACCESS), clock );
-		pxa2xx_pcmcia_set_mcatt(skt->nr, calc_speed(skt->spd_io,
-					MAX_IO_WIN, SOC_PCMCIA_3V_MEM_ACCESS), clock );
+		pxa2xx_pcmcia_set_mcxx(skt, clock);
 	}
 	up(&soc_sockets_lock);
 }
diff -Nru a/drivers/pcmcia/sa11xx_base.c b/drivers/pcmcia/sa11xx_base.c
--- a/drivers/pcmcia/sa11xx_base.c	2004-06-02 23:26:59 -07:00
+++ b/drivers/pcmcia/sa11xx_base.c	2004-06-02 23:26:59 -07:00
@@ -69,21 +69,6 @@
 	return sa1100_pcmcia_mecr_bs(cmd_time, cpu_speed);
 }
 
-static unsigned short
-calc_speed(unsigned short *spds, int num, unsigned short dflt)
-{
-	unsigned short speed = 0;
-	int i;
-
-	for (i = 0; i < num; i++)
-		if (speed < spds[i])
-			speed = spds[i];
-	if (speed == 0)
-		speed = dflt;
-
-	return speed;
-}
-
 /* sa1100_pcmcia_set_mecr()
  * ^^^^^^^^^^^^^^^^^^^^^^^^
  *
@@ -95,19 +80,16 @@
 static int
 sa1100_pcmcia_set_mecr(struct soc_pcmcia_socket *skt, unsigned int cpu_clock)
 {
+	struct soc_pcmcia_timing timing;
 	u32 mecr, old_mecr;
 	unsigned long flags;
-	unsigned short speed;
 	unsigned int bs_io, bs_mem, bs_attr;
 
-	speed = calc_speed(skt->spd_io, MAX_IO_WIN, SOC_PCMCIA_IO_ACCESS);
-	bs_io = skt->ops->get_timing(skt, cpu_clock, speed);
-
-	speed = calc_speed(skt->spd_mem, MAX_WIN, SOC_PCMCIA_3V_MEM_ACCESS);
-	bs_mem = skt->ops->get_timing(skt, cpu_clock, speed);
+	soc_common_pcmcia_get_timing(skt, &timing);
 
-	speed = calc_speed(skt->spd_attr, MAX_WIN, SOC_PCMCIA_3V_MEM_ACCESS);
-	bs_attr = skt->ops->get_timing(skt, cpu_clock, speed);
+	bs_io = skt->ops->get_timing(skt, cpu_clock, timing.io);
+	bs_mem = skt->ops->get_timing(skt, cpu_clock, timing.mem);
+	bs_attr = skt->ops->get_timing(skt, cpu_clock, timing.attr);
 
 	local_irq_save(flags);
 
@@ -138,20 +120,20 @@
 static int
 sa1100_pcmcia_show_timing(struct soc_pcmcia_socket *skt, char *buf)
 {
+	struct soc_pcmcia_timing timing;
 	unsigned int clock = cpufreq_get(0);
 	unsigned long mecr = MECR;
 	char *p = buf;
 
-	p+=sprintf(p, "I/O      : %u (%u)\n",
-		   calc_speed(skt->spd_io, MAX_IO_WIN, SOC_PCMCIA_IO_ACCESS),
+	soc_common_pcmcia_get_timing(skt, &timing);
+
+	p+=sprintf(p, "I/O      : %u (%u)\n", timing.io,
 		   sa1100_pcmcia_cmd_time(clock, MECR_BSIO_GET(mecr, skt->nr)));
 
-	p+=sprintf(p, "attribute: %u (%u)\n",
-		   calc_speed(skt->spd_attr, MAX_WIN, SOC_PCMCIA_3V_MEM_ACCESS),
+	p+=sprintf(p, "attribute: %u (%u)\n", timing.attr,
 		   sa1100_pcmcia_cmd_time(clock, MECR_BSA_GET(mecr, skt->nr)));
 
-	p+=sprintf(p, "common   : %u (%u)\n",
-		   calc_speed(skt->spd_mem, MAX_WIN, SOC_PCMCIA_3V_MEM_ACCESS),
+	p+=sprintf(p, "common   : %u (%u)\n", timing.mem,
 		   sa1100_pcmcia_cmd_time(clock, MECR_BSM_GET(mecr, skt->nr)));
 
 	return p - buf;
diff -Nru a/drivers/pcmcia/soc_common.c b/drivers/pcmcia/soc_common.c
--- a/drivers/pcmcia/soc_common.c	2004-06-02 23:26:58 -07:00
+++ b/drivers/pcmcia/soc_common.c	2004-06-02 23:26:58 -07:00
@@ -68,6 +68,29 @@
 
 #define to_soc_pcmcia_socket(x)	container_of(x, struct soc_pcmcia_socket, socket)
 
+static unsigned short
+calc_speed(unsigned short *spds, int num, unsigned short dflt)
+{
+	unsigned short speed = 0;
+	int i;
+
+	for (i = 0; i < num; i++)
+		if (speed < spds[i])
+			speed = spds[i];
+	if (speed == 0)
+		speed = dflt;
+
+	return speed;
+}
+
+void soc_common_pcmcia_get_timing(struct soc_pcmcia_socket *skt, struct soc_pcmcia_timing *timing)
+{
+	timing->io = calc_speed(skt->spd_io, MAX_IO_WIN, SOC_PCMCIA_IO_ACCESS);
+	timing->mem = calc_speed(skt->spd_mem, MAX_WIN, SOC_PCMCIA_3V_MEM_ACCESS);
+	timing->attr = calc_speed(skt->spd_attr, MAX_WIN, SOC_PCMCIA_3V_MEM_ACCESS);
+}
+EXPORT_SYMBOL(soc_common_pcmcia_get_timing);
+
 static unsigned int soc_common_pcmcia_skt_state(struct soc_pcmcia_socket *skt)
 {
 	struct pcmcia_state state;
diff -Nru a/drivers/pcmcia/soc_common.h b/drivers/pcmcia/soc_common.h
--- a/drivers/pcmcia/soc_common.h	2004-06-02 23:27:00 -07:00
+++ b/drivers/pcmcia/soc_common.h	2004-06-02 23:27:00 -07:00
@@ -112,10 +112,17 @@
 	const char *str;
 };
 
+struct soc_pcmcia_timing {
+	unsigned short io;
+	unsigned short mem;
+	unsigned short attr;
+};
+
 extern int soc_pcmcia_request_irqs(struct soc_pcmcia_socket *skt, struct pcmcia_irqs *irqs, int nr);
 extern void soc_pcmcia_free_irqs(struct soc_pcmcia_socket *skt, struct pcmcia_irqs *irqs, int nr);
 extern void soc_pcmcia_disable_irqs(struct soc_pcmcia_socket *skt, struct pcmcia_irqs *irqs, int nr);
 extern void soc_pcmcia_enable_irqs(struct soc_pcmcia_socket *skt, struct pcmcia_irqs *irqs, int nr);
+extern void soc_common_pcmcia_get_timing(struct soc_pcmcia_socket *, struct soc_pcmcia_timing *);
 
 
 extern struct list_head soc_pcmcia_sockets;
diff -Nru a/drivers/pnp/pnpbios/Kconfig b/drivers/pnp/pnpbios/Kconfig
--- a/drivers/pnp/pnpbios/Kconfig	2004-06-02 23:27:00 -07:00
+++ b/drivers/pnp/pnpbios/Kconfig	2004-06-02 23:27:00 -07:00
@@ -3,7 +3,7 @@
 #
 config PNPBIOS
 	bool "Plug and Play BIOS support (EXPERIMENTAL)"
-	depends on PNP && EXPERIMENTAL
+	depends on PNP && X86 && EXPERIMENTAL
 	---help---
 	  Linux uses the PNPBIOS as defined in "Plug and Play BIOS
 	  Specification Version 1.0A May 5, 1994" to autodetect built-in
diff -Nru a/drivers/scsi/ata_piix.c b/drivers/scsi/ata_piix.c
--- a/drivers/scsi/ata_piix.c	2004-06-02 23:26:59 -07:00
+++ b/drivers/scsi/ata_piix.c	2004-06-02 23:26:59 -07:00
@@ -28,7 +28,7 @@
 #include <linux/blkdev.h>
 #include <linux/delay.h>
 #include "scsi.h"
-#include "hosts.h"
+#include <scsi/scsi_host.h>
 #include <linux/libata.h>
 
 #define DRV_NAME	"ata_piix"
diff -Nru a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
--- a/drivers/scsi/libata-core.c	2004-06-02 23:26:58 -07:00
+++ b/drivers/scsi/libata-core.c	2004-06-02 23:26:58 -07:00
@@ -39,7 +39,7 @@
 #include <linux/workqueue.h>
 #include <scsi/scsi.h>
 #include "scsi.h"
-#include "hosts.h"
+#include <scsi/scsi_host.h>
 #include <linux/libata.h>
 #include <asm/io.h>
 #include <asm/semaphore.h>
diff -Nru a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c
--- a/drivers/scsi/libata-scsi.c	2004-06-02 23:26:59 -07:00
+++ b/drivers/scsi/libata-scsi.c	2004-06-02 23:26:59 -07:00
@@ -27,7 +27,7 @@
 #include <linux/spinlock.h>
 #include <scsi/scsi.h>
 #include "scsi.h"
-#include "hosts.h"
+#include <scsi/scsi_host.h>
 #include <linux/libata.h>
 
 #include "libata.h"
@@ -1156,6 +1156,7 @@
 
 	switch(scsicmd[0]) {
 		/* no-op's, complete with success */
+		case SYNCHRONIZE_CACHE:		/* FIXME: temporary */
 		case REZERO_UNIT:
 		case SEEK_6:
 		case SEEK_10:
diff -Nru a/drivers/scsi/sata_promise.c b/drivers/scsi/sata_promise.c
--- a/drivers/scsi/sata_promise.c	2004-06-02 23:27:00 -07:00
+++ b/drivers/scsi/sata_promise.c	2004-06-02 23:27:00 -07:00
@@ -34,7 +34,7 @@
 #include <linux/interrupt.h>
 #include <linux/sched.h>
 #include "scsi.h"
-#include "hosts.h"
+#include <scsi/scsi_host.h>
 #include <linux/libata.h>
 #include <asm/io.h>
 #include "sata_promise.h"
@@ -457,14 +457,14 @@
 
 static void pdc_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf)
 {
-	if (tf->protocol == ATA_PROT_PIO)
+	if (tf->protocol != ATA_PROT_DMA)
 		ata_tf_load_mmio(ap, tf);
 }
 
 
 static void pdc_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf)
 {
-	if (tf->protocol == ATA_PROT_PIO)
+	if (tf->protocol != ATA_PROT_DMA)
 		ata_exec_command_mmio(ap, tf);
 }
 
diff -Nru a/drivers/scsi/sata_sil.c b/drivers/scsi/sata_sil.c
--- a/drivers/scsi/sata_sil.c	2004-06-02 23:26:58 -07:00
+++ b/drivers/scsi/sata_sil.c	2004-06-02 23:26:58 -07:00
@@ -34,7 +34,7 @@
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include "scsi.h"
-#include "hosts.h"
+#include <scsi/scsi_host.h>
 #include <linux/libata.h>
 
 #define DRV_NAME	"sata_sil"
diff -Nru a/drivers/scsi/sata_sis.c b/drivers/scsi/sata_sis.c
--- a/drivers/scsi/sata_sis.c	2004-06-02 23:26:59 -07:00
+++ b/drivers/scsi/sata_sis.c	2004-06-02 23:26:59 -07:00
@@ -34,7 +34,7 @@
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include "scsi.h"
-#include "hosts.h"
+#include <scsi/scsi_host.h>
 #include <linux/libata.h>
 
 #define DRV_NAME	"sata_sis"
diff -Nru a/drivers/scsi/sata_svw.c b/drivers/scsi/sata_svw.c
--- a/drivers/scsi/sata_svw.c	2004-06-02 23:26:59 -07:00
+++ b/drivers/scsi/sata_svw.c	2004-06-02 23:26:59 -07:00
@@ -40,7 +40,7 @@
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include "scsi.h"
-#include "hosts.h"
+#include <scsi/scsi_host.h>
 #include <linux/libata.h>
 
 #ifdef CONFIG_PPC_OF
diff -Nru a/drivers/scsi/sata_sx4.c b/drivers/scsi/sata_sx4.c
--- a/drivers/scsi/sata_sx4.c	2004-06-02 23:26:58 -07:00
+++ b/drivers/scsi/sata_sx4.c	2004-06-02 23:26:58 -07:00
@@ -34,7 +34,7 @@
 #include <linux/interrupt.h>
 #include <linux/sched.h>
 #include "scsi.h"
-#include "hosts.h"
+#include <scsi/scsi_host.h>
 #include <linux/libata.h>
 #include <asm/io.h>
 #include "sata_promise.h"
@@ -826,14 +826,14 @@
 
 static void pdc_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf)
 {
-	if (tf->protocol == ATA_PROT_PIO)
+	if (tf->protocol != ATA_PROT_DMA)
 		ata_tf_load_mmio(ap, tf);
 }
 
 
 static void pdc_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf)
 {
-	if (tf->protocol == ATA_PROT_PIO)
+	if (tf->protocol != ATA_PROT_DMA)
 		ata_exec_command_mmio(ap, tf);
 }
 
diff -Nru a/drivers/scsi/sata_via.c b/drivers/scsi/sata_via.c
--- a/drivers/scsi/sata_via.c	2004-06-02 23:26:58 -07:00
+++ b/drivers/scsi/sata_via.c	2004-06-02 23:26:58 -07:00
@@ -33,7 +33,7 @@
 #include <linux/blkdev.h>
 #include <linux/delay.h>
 #include "scsi.h"
-#include "hosts.h"
+#include <scsi/scsi_host.h>
 #include <linux/libata.h>
 #include <asm/io.h>
 
diff -Nru a/drivers/scsi/sata_vsc.c b/drivers/scsi/sata_vsc.c
--- a/drivers/scsi/sata_vsc.c	2004-06-02 23:26:59 -07:00
+++ b/drivers/scsi/sata_vsc.c	2004-06-02 23:26:59 -07:00
@@ -22,7 +22,7 @@
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include "scsi.h"
-#include "hosts.h"
+#include <scsi/scsi_host.h>
 #include <linux/libata.h>
 
 #define DRV_NAME	"sata_vsc"
diff -Nru a/drivers/serial/sunsab.c b/drivers/serial/sunsab.c
--- a/drivers/serial/sunsab.c	2004-06-02 23:26:59 -07:00
+++ b/drivers/serial/sunsab.c	2004-06-02 23:26:59 -07:00
@@ -97,9 +97,10 @@
 		udelay(1);
 }
 
-static void receive_chars(struct uart_sunsab_port *up,
-			  union sab82532_irq_status *stat,
-			  struct pt_regs *regs)
+static struct tty_struct *
+receive_chars(struct uart_sunsab_port *up,
+	      union sab82532_irq_status *stat,
+	      struct pt_regs *regs)
 {
 	struct tty_struct *tty = NULL;
 	unsigned char buf[32];
@@ -126,7 +127,7 @@
 	if (stat->sreg.isr0 & SAB82532_ISR0_TIME) {
 		sunsab_cec_wait(up);
 		writeb(SAB82532_CMDR_RFRD, &up->regs->w.cmdr);
-		return;
+		return tty;
 	}
 
 	if (stat->sreg.isr0 & SAB82532_ISR0_RFO)
@@ -153,7 +154,7 @@
 		if (unlikely(tty->flip.count >= TTY_FLIPBUF_SIZE)) {
 			tty->flip.work.func((void *)tty);
 			if (tty->flip.count >= TTY_FLIPBUF_SIZE)
-				return; // if TTY_DONT_FLIP is set
+				return tty; // if TTY_DONT_FLIP is set
 		}
 
 		*tty->flip.char_buf_ptr = ch;
@@ -225,11 +226,10 @@
 		}
 	}
 
-	if (tty)
-		tty_flip_buffer_push(tty);
-
 	if (saw_console_brk)
 		sun_do_break();
+
+	return tty;
 }
 
 static void sunsab_stop_tx(struct uart_port *, unsigned int);
@@ -311,6 +311,7 @@
 static irqreturn_t sunsab_interrupt(int irq, void *dev_id, struct pt_regs *regs)
 {
 	struct uart_sunsab_port *up = dev_id;
+	struct tty_struct *tty;
 	union sab82532_irq_status status;
 	unsigned long flags;
 
@@ -322,10 +323,11 @@
 	if (readb(&up->regs->r.gis) & SAB82532_GIS_ISA1)
 		status.sreg.isr1 = readb(&up->regs->r.isr1);
 
+	tty = NULL;
 	if (status.stat) {
 		if (status.sreg.isr0 & (SAB82532_ISR0_TCD | SAB82532_ISR0_TIME |
 					SAB82532_ISR0_RFO | SAB82532_ISR0_RPF))
-			receive_chars(up, &status, regs);
+			tty = receive_chars(up, &status, regs);
 		if ((status.sreg.isr0 & SAB82532_ISR0_CDSC) ||
 		    (status.sreg.isr1 & SAB82532_ISR1_CSC))
 			check_status(up, &status);
@@ -335,6 +337,9 @@
 
 	spin_unlock(&up->port.lock);
 
+	if (tty)
+		tty_flip_buffer_push(tty);
+
 	up++;
 
 	spin_lock(&up->port.lock);
@@ -345,10 +350,11 @@
 	if (readb(&up->regs->r.gis) & SAB82532_GIS_ISB1)
 		status.sreg.isr1 = readb(&up->regs->r.isr1);
 
+	tty = NULL;
 	if (status.stat) {
 		if (status.sreg.isr0 & (SAB82532_ISR0_TCD | SAB82532_ISR0_TIME |
 					SAB82532_ISR0_RFO | SAB82532_ISR0_RPF))
-			receive_chars(up, &status, regs);
+			tty = receive_chars(up, &status, regs);
 		if ((status.sreg.isr0 & SAB82532_ISR0_CDSC) ||
 		    (status.sreg.isr1 & (SAB82532_ISR1_BRK | SAB82532_ISR1_CSC)))
 			check_status(up, &status);
@@ -357,6 +363,9 @@
 	}
 
 	spin_unlock_irqrestore(&up->port.lock, flags);
+
+	if (tty)
+		tty_flip_buffer_push(tty);
 
 	return IRQ_HANDLED;
 }
diff -Nru a/drivers/serial/sunsu.c b/drivers/serial/sunsu.c
--- a/drivers/serial/sunsu.c	2004-06-02 23:26:58 -07:00
+++ b/drivers/serial/sunsu.c	2004-06-02 23:26:58 -07:00
@@ -310,7 +310,7 @@
 	spin_unlock_irqrestore(&up->port.lock, flags);
 }
 
-static _INLINE_ void
+static _INLINE_ struct tty_struct *
 receive_chars(struct uart_sunsu_port *up, unsigned char *status, struct pt_regs *regs)
 {
 	struct tty_struct *tty = up->port.info->tty;
@@ -322,7 +322,7 @@
 		if (unlikely(tty->flip.count >= TTY_FLIPBUF_SIZE)) {
 			tty->flip.work.func((void *)tty);
 			if (tty->flip.count >= TTY_FLIPBUF_SIZE)
-				return; // if TTY_DONT_FLIP is set
+				return tty; // if TTY_DONT_FLIP is set
 		}
 		ch = serial_inp(up, UART_RX);
 		*tty->flip.char_buf_ptr = ch;
@@ -396,10 +396,11 @@
 	ignore_char:
 		*status = serial_inp(up, UART_LSR);
 	} while ((*status & UART_LSR_DR) && (max_count-- > 0));
-	tty_flip_buffer_push(tty);
 
 	if (saw_console_brk)
 		sun_do_break();
+
+	return tty;
 }
 
 static _INLINE_ void transmit_chars(struct uart_sunsu_port *up)
@@ -464,12 +465,23 @@
 	spin_lock_irqsave(&up->port.lock, flags);
 
 	do {
+		struct tty_struct *tty;
+
 		status = serial_inp(up, UART_LSR);
+		tty = NULL;
 		if (status & UART_LSR_DR)
-			receive_chars(up, &status, regs);
+			tty = receive_chars(up, &status, regs);
 		check_modem_status(up);
 		if (status & UART_LSR_THRE)
 			transmit_chars(up);
+
+		spin_unlock_irqrestore(&up->port.lock, flags);
+
+		if (tty)
+			tty_flip_buffer_push(tty);
+
+		spin_lock_irqsave(&up->port.lock, flags);
+
 	} while (!(serial_in(up, UART_IIR) & UART_IIR_NO_INT));
 
 	spin_unlock_irqrestore(&up->port.lock, flags);
diff -Nru a/drivers/serial/sunzilog.c b/drivers/serial/sunzilog.c
--- a/drivers/serial/sunzilog.c	2004-06-02 23:27:00 -07:00
+++ b/drivers/serial/sunzilog.c	2004-06-02 23:27:00 -07:00
@@ -313,9 +313,10 @@
 	}
 }
 
-static void sunzilog_receive_chars(struct uart_sunzilog_port *up,
-				   struct zilog_channel *channel,
-				   struct pt_regs *regs)
+static struct tty_struct *
+sunzilog_receive_chars(struct uart_sunzilog_port *up,
+		       struct zilog_channel *channel,
+		       struct pt_regs *regs)
 {
 	struct tty_struct *tty;
 	unsigned char ch, r1;
@@ -414,8 +415,7 @@
 		}
 	}
 
-	if (tty)
-		tty_flip_buffer_push(tty);
+	return tty;
 }
 
 static void sunzilog_status_handle(struct uart_sunzilog_port *up,
@@ -550,19 +550,21 @@
 	while (up) {
 		struct zilog_channel *channel
 			= ZILOG_CHANNEL_FROM_PORT(&up->port);
+		struct tty_struct *tty;
 		unsigned char r3;
 
 		spin_lock(&up->port.lock);
 		r3 = read_zsreg(channel, R3);
 
 		/* Channel A */
+		tty = NULL;
 		if (r3 & (CHAEXT | CHATxIP | CHARxIP)) {
 			sbus_writeb(RES_H_IUS, &channel->control);
 			ZSDELAY();
 			ZS_WSYNC(channel);
 
 			if (r3 & CHARxIP)
-				sunzilog_receive_chars(up, channel, regs);
+				tty = sunzilog_receive_chars(up, channel, regs);
 			if (r3 & CHAEXT)
 				sunzilog_status_handle(up, channel, regs);
 			if (r3 & CHATxIP)
@@ -570,24 +572,31 @@
 		}
 		spin_unlock(&up->port.lock);
 
+		if (tty)
+			tty_flip_buffer_push(tty);
+
 		/* Channel B */
 		up = up->next;
 		channel = ZILOG_CHANNEL_FROM_PORT(&up->port);
 
 		spin_lock(&up->port.lock);
+		tty = NULL;
 		if (r3 & (CHBEXT | CHBTxIP | CHBRxIP)) {
 			sbus_writeb(RES_H_IUS, &channel->control);
 			ZSDELAY();
 			ZS_WSYNC(channel);
 
 			if (r3 & CHBRxIP)
-				sunzilog_receive_chars(up, channel, regs);
+				tty = sunzilog_receive_chars(up, channel, regs);
 			if (r3 & CHBEXT)
 				sunzilog_status_handle(up, channel, regs);
 			if (r3 & CHBTxIP)
 				sunzilog_transmit_chars(up, channel);
 		}
 		spin_unlock(&up->port.lock);
+
+		if (tty)
+			tty_flip_buffer_push(tty);
 
 		up = up->next;
 	}
diff -Nru a/drivers/video/aty/radeon_accel.c b/drivers/video/aty/radeon_accel.c
--- a/drivers/video/aty/radeon_accel.c	2004-06-02 23:26:59 -07:00
+++ b/drivers/video/aty/radeon_accel.c	2004-06-02 23:26:59 -07:00
@@ -13,7 +13,10 @@
 		rinfo->dp_gui_master_cntl  /* contains, like GMC_DST_32BPP */
                 | GMC_BRUSH_SOLID_COLOR
                 | ROP3_P);
-	OUTREG(DP_BRUSH_FRGD_CLR, region->color);
+	if (radeon_get_dstbpp(rinfo->depth) != DST_8BPP)
+		OUTREG(DP_BRUSH_FRGD_CLR, rinfo->pseudo_palette[region->color]);
+	else
+		OUTREG(DP_BRUSH_FRGD_CLR, region->color);
 	OUTREG(DP_WRITE_MSK, 0xffffffff);
 	OUTREG(DP_CNTL, (DST_X_LEFT_TO_RIGHT | DST_Y_TOP_TO_BOTTOM));
 
diff -Nru a/drivers/video/aty/radeon_pm.c b/drivers/video/aty/radeon_pm.c
--- a/drivers/video/aty/radeon_pm.c	2004-06-02 23:27:00 -07:00
+++ b/drivers/video/aty/radeon_pm.c	2004-06-02 23:27:00 -07:00
@@ -867,7 +867,7 @@
 	}
 
 	/* Blank display and LCD */
-	radeonfb_blank(VESA_POWERDOWN+1, info);
+	radeonfb_blank(VESA_POWERDOWN, info);
 
 	/* Sleep */
 	rinfo->asleep = 1;
diff -Nru a/drivers/video/pxafb.c b/drivers/video/pxafb.c
--- a/drivers/video/pxafb.c	2004-06-02 23:26:59 -07:00
+++ b/drivers/video/pxafb.c	2004-06-02 23:26:59 -07:00
@@ -432,7 +432,7 @@
          * (DPC) bit? or perhaps set it based on the various clock
          * speeds */
 
-	pcd = (unsigned long long)get_lclk_frequency_10khz() * (unsigned long long)pixclock;
+	pcd = (unsigned long long)get_lcdclk_frequency_10khz() * pixclock;
 	pcd /= 100000000 * 2;
 	/* no need for this, since we should subtract 1 anyway. they cancel */
 	/* pcd += 1; */ /* make up for integer math truncations */
diff -Nru a/drivers/video/vesafb.c b/drivers/video/vesafb.c
--- a/drivers/video/vesafb.c	2004-06-02 23:26:58 -07:00
+++ b/drivers/video/vesafb.c	2004-06-02 23:26:58 -07:00
@@ -207,7 +207,7 @@
 			mtrr=1;
 		else if (! strcmp(this_opt, "nomtrr"))
 			mtrr=0;
-		else if (! strcmp(this_opt, "vram"))
+		else if (! strncmp(this_opt, "vram:", 5))
 			vram = simple_strtoul(this_opt+5, NULL, 0);
 	}
 	return 0;
diff -Nru a/fs/aio.c b/fs/aio.c
--- a/fs/aio.c	2004-06-02 23:26:59 -07:00
+++ b/fs/aio.c	2004-06-02 23:26:59 -07:00
@@ -538,19 +538,25 @@
 
 static void use_mm(struct mm_struct *mm)
 {
-	struct mm_struct *active_mm = current->active_mm;
+	struct mm_struct *active_mm;
+
 	atomic_inc(&mm->mm_count);
+	task_lock(current);
+	active_mm = current->active_mm;
 	current->mm = mm;
 	if (mm != active_mm) {
 		current->active_mm = mm;
 		activate_mm(active_mm, mm);
 	}
+	task_unlock(current);
 	mmdrop(active_mm);
 }
 
 static void unuse_mm(struct mm_struct *mm)
 {
+	task_lock(current);
 	current->mm = NULL;
+	task_unlock(current);
 	/* active_mm is still 'mm' */
 	enter_lazy_tlb(mm, current);
 }
@@ -608,7 +614,7 @@
 		spin_lock_irqsave(&ctx->ctx_lock, flags);
 		list_add_tail(&iocb->ki_run_list, &ctx->run_list);
 		spin_unlock_irqrestore(&ctx->ctx_lock, flags);
-		schedule_work(&ctx->wq);
+		queue_work(aio_wq, &ctx->wq);
 	}
 }
 
diff -Nru a/fs/compat.c b/fs/compat.c
--- a/fs/compat.c	2004-06-02 23:26:59 -07:00
+++ b/fs/compat.c	2004-06-02 23:26:59 -07:00
@@ -614,7 +614,7 @@
 }
 
 static inline long
-copy_iocb(long nr, u32 __user *ptr32, u64 __user *ptr64)
+copy_iocb(long nr, u32 __user *ptr32, struct iocb __user * __user *ptr64)
 {
 	compat_uptr_t uptr;
 	int i;
@@ -622,7 +622,7 @@
 	for (i = 0; i < nr; ++i) {
 		if (get_user(uptr, ptr32 + i))
 			return -EFAULT;
-		if (put_user((u64)compat_ptr(uptr), ptr64 + i))
+		if (put_user(compat_ptr(uptr), ptr64 + i))
 			return -EFAULT;
 	}
 	return 0;
@@ -643,7 +643,7 @@
 		nr = MAX_AIO_SUBMITS;
 	
 	iocb64 = compat_alloc_user_space(nr * sizeof(*iocb64));
-	ret = copy_iocb(nr, iocb, (u64 __user *) iocb64);
+	ret = copy_iocb(nr, iocb, iocb64);
 	if (!ret)
 		ret = sys_io_submit(ctx_id, nr, iocb64);
 	return ret;
diff -Nru a/fs/nfs/read.c b/fs/nfs/read.c
--- a/fs/nfs/read.c	2004-06-02 23:26:58 -07:00
+++ b/fs/nfs/read.c	2004-06-02 23:26:58 -07:00
@@ -103,22 +103,16 @@
 	if (!rdata)
 		return -ENOMEM;
 
-	*rdata = (struct nfs_read_data) {
-		.flags		= (IS_SWAPFILE(inode)? NFS_RPC_SWAPFLAGS : 0),
-		.cred		= NULL,
-		.inode		= inode,
-		.pages		= LIST_HEAD_INIT(rdata->pages),
-		.args		= {
-			.fh		= NFS_FH(inode),
-			.lockowner	= current->files,
-			.pages		= &page,
-			.pgbase		= 0UL,
-			.count		= rsize,
-		},
-		.res		= {
-			.fattr		= &rdata->fattr,
-		}
-	};
+	memset(rdata, 0, sizeof(*rdata));
+	rdata->flags = (IS_SWAPFILE(inode)? NFS_RPC_SWAPFLAGS : 0);
+	rdata->inode = inode;
+	INIT_LIST_HEAD(&rdata->pages);
+	rdata->args.fh = NFS_FH(inode);
+	rdata->args.lockowner = current->files;
+	rdata->args.pages = &page;
+	rdata->args.pgbase = 0UL;
+	rdata->args.count = rsize;
+	rdata->res.fattr = &rdata->fattr;
 
 	dprintk("NFS: nfs_readpage_sync(%p)\n", page);
 
diff -Nru a/fs/nfs/write.c b/fs/nfs/write.c
--- a/fs/nfs/write.c	2004-06-02 23:27:00 -07:00
+++ b/fs/nfs/write.c	2004-06-02 23:27:00 -07:00
@@ -185,23 +185,17 @@
 	if (!wdata)
 		return -ENOMEM;
 
-	*wdata = (struct nfs_write_data) {
-		.flags		= how,
-		.cred		= NULL,
-		.inode		= inode,
-		.args		= {
-			.fh		= NFS_FH(inode),
-			.lockowner	= current->files,
-			.pages		= &page,
-			.stable		= NFS_FILE_SYNC,
-			.pgbase		= offset,
-			.count		= wsize,
-		},
-		.res		= {
-			.fattr		= &wdata->fattr,
-			.verf		= &wdata->verf,
-		},
-	};
+	memset(wdata, 0, sizeof(*wdata));
+	wdata->flags = how;
+	wdata->inode = inode;
+	wdata->args.fh = NFS_FH(inode);
+	wdata->args.lockowner = current->files;
+	wdata->args.pages = &page;
+	wdata->args.stable = NFS_FILE_SYNC;
+	wdata->args.pgbase = offset;
+	wdata->args.count = wsize;
+	wdata->res.fattr = &wdata->fattr;
+	wdata->res.verf = &wdata->verf;
 
 	dprintk("NFS:      nfs_writepage_sync(%s/%Ld %d@%Ld)\n",
 		inode->i_sb->s_id,
diff -Nru a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
--- a/fs/nfsd/vfs.c	2004-06-02 23:26:59 -07:00
+++ b/fs/nfsd/vfs.c	2004-06-02 23:26:59 -07:00
@@ -567,7 +567,7 @@
 static spinlock_t ra_lock = SPIN_LOCK_UNLOCKED;
 
 static inline struct raparms *
-nfsd_get_raparms(dev_t dev, ino_t ino)
+nfsd_get_raparms(dev_t dev, ino_t ino, struct address_space *mapping)
 {
 	struct raparms	*ra, **rap, **frap = NULL;
 	int depth = 0;
@@ -589,7 +589,7 @@
 	ra = *frap;
 	ra->p_dev = dev;
 	ra->p_ino = ino;
-	memset(&ra->p_ra, 0, sizeof(ra->p_ra));
+	file_ra_state_init(&ra->p_ra, mapping);
 found:
 	if (rap != &raparm_cache) {
 		*rap = ra->p_next;
@@ -661,7 +661,8 @@
 #endif
 
 	/* Get readahead parameters */
-	ra = nfsd_get_raparms(inode->i_sb->s_dev, inode->i_ino);
+	ra = nfsd_get_raparms(inode->i_sb->s_dev, inode->i_ino,
+			      inode->i_mapping->host->i_mapping);
 	if (ra)
 		file.f_ra = ra->p_ra;
 
@@ -677,9 +678,12 @@
 	}
 
 	/* Write back readahead params */
-	if (ra)
+	if (ra) {
+		spin_lock(&ra_lock);
 		ra->p_ra = file.f_ra;
-
+		ra->p_count--;
+		spin_unlock(&ra_lock);
+	}
 	if (err >= 0) {
 		nfsdstats.io_read += err;
 		*count = err;
diff -Nru a/fs/ntfs/ChangeLog b/fs/ntfs/ChangeLog
--- a/fs/ntfs/ChangeLog	2004-06-02 23:26:59 -07:00
+++ b/fs/ntfs/ChangeLog	2004-06-02 23:26:59 -07:00
@@ -25,6 +25,22 @@
 	  sufficient for synchronisation here. We then just need to make sure
 	  ntfs_readpage/writepage/truncate interoperate properly with us.
 
+2.1.12 - Fix the second fix to the decompression engine and some cleanups.
+
+	- Add a new address space operations struct, ntfs_mst_aops, for mst
+	  protected attributes.  This is because the default ntfs_aops do not
+	  make sense with mst protected data and were they to write anything to
+	  such an attribute they would cause data corruption so we provide
+	  ntfs_mst_aops which does not have any write related operations set.
+	- Cleanup dirty ntfs inode handling (fs/ntfs/inode.[hc]) which also
+	  includes an adapted ntfs_commit_inode() and an implementation of
+	  ntfs_write_inode() which for now just cleans dirty inodes without
+	  writing them (it does emit a warning that this is happening).
+	- Undo the second decompression engine fix (see 2.1.9 release ChangeLog
+	  entry) as it was only fixing a theoretical bug but at the same time
+	  it badly broke the handling of sparse and uncompressed compression
+	  blocks.
+
 2.1.11 - Driver internal cleanups.
 
 	- Only build logfile.o if building the driver with read-write support.
diff -Nru a/fs/ntfs/Makefile b/fs/ntfs/Makefile
--- a/fs/ntfs/Makefile	2004-06-02 23:26:59 -07:00
+++ b/fs/ntfs/Makefile	2004-06-02 23:26:59 -07:00
@@ -5,7 +5,7 @@
 ntfs-objs := aops.o attrib.o compress.o debug.o dir.o file.o inode.o mft.o \
 	     mst.o namei.o super.o sysctl.o unistr.o upcase.o
 
-EXTRA_CFLAGS = -DNTFS_VERSION=\"2.1.11\"
+EXTRA_CFLAGS = -DNTFS_VERSION=\"2.1.12\"
 
 ifeq ($(CONFIG_NTFS_DEBUG),y)
 EXTRA_CFLAGS += -DDEBUG
diff -Nru a/fs/ntfs/aops.c b/fs/ntfs/aops.c
--- a/fs/ntfs/aops.c	2004-06-02 23:27:00 -07:00
+++ b/fs/ntfs/aops.c	2004-06-02 23:27:00 -07:00
@@ -1788,3 +1788,12 @@
 #endif
 };
 
+/**
+ * ntfs_mst_aops - general address space operations for mst protecteed inodes
+ *		   and attributes
+ */
+struct address_space_operations ntfs_mst_aops = {
+	.readpage	= ntfs_readpage,	/* Fill page with data. */
+	.sync_page	= block_sync_page,	/* Currently, just unplugs the
+						   disk request queue. */
+};
diff -Nru a/fs/ntfs/compress.c b/fs/ntfs/compress.c
--- a/fs/ntfs/compress.c	2004-06-02 23:26:59 -07:00
+++ b/fs/ntfs/compress.c	2004-06-02 23:26:59 -07:00
@@ -507,7 +507,7 @@
 	 */
 	unsigned int nr_pages = (end_vcn - start_vcn) <<
 			vol->cluster_size_bits >> PAGE_CACHE_SHIFT;
-	unsigned int xpage, max_page, max_ofs, cur_page, cur_ofs, i;
+	unsigned int xpage, max_page, cur_page, cur_ofs, i;
 	unsigned int cb_clusters, cb_max_ofs;
 	int block, max_block, cb_max_page, bhs_size, nr_bhs, err = 0;
 	struct page **pages;
@@ -550,11 +550,8 @@
 	 */
 	max_page = ((VFS_I(ni)->i_size + PAGE_CACHE_SIZE - 1) >>
 			PAGE_CACHE_SHIFT) - offset;
-	max_ofs = (VFS_I(ni)->i_size + PAGE_CACHE_SIZE - 1) & ~PAGE_CACHE_MASK;
-	if (nr_pages < max_page) {
+	if (nr_pages < max_page)
 		max_page = nr_pages;
-		max_ofs = 0;
-	}
 	for (i = 0; i < max_page; i++, offset++) {
 		if (i != xpage)
 			pages[i] = grab_cache_page_nowait(mapping, offset);
@@ -722,14 +719,8 @@
 	cb_max_page >>= PAGE_CACHE_SHIFT;
 
 	/* Catch end of file inside a compression block. */
-	if (cb_max_page >= max_page) {
-		if (cb_max_page > max_page) {
-			cb_max_page = max_page;
-			cb_max_ofs = max_ofs;
-		} else if (cb_max_ofs > max_ofs) {
-			cb_max_ofs = max_ofs;
-		}
-	}
+	if (cb_max_page > max_page)
+		cb_max_page = max_page;
 
 	if (vcn == start_vcn - cb_clusters) {
 		/* Sparse cb, zero out page range overlapping the cb. */
@@ -897,7 +888,8 @@
 		if (page) {
 			ntfs_error(vol->sb, "Still have pages left! "
 					"Terminating them with extreme "
-					"prejudice.");
+					"prejudice.  Inode 0x%lx, page index "
+					"0x%lx.", ni->mft_no, page->index);
 			if (cur_page == xpage && !xpage_done)
 				SetPageError(page);
 			flush_dcache_page(page);
diff -Nru a/fs/ntfs/dir.c b/fs/ntfs/dir.c
--- a/fs/ntfs/dir.c	2004-06-02 23:26:59 -07:00
+++ b/fs/ntfs/dir.c	2004-06-02 23:26:59 -07:00
@@ -1196,7 +1196,7 @@
 	ia_mapping = vdir->i_mapping;
 	bmp_vi = ndir->itype.index.bmp_ino;
 	if (unlikely(!bmp_vi)) {
-		ntfs_debug("Inode %lu, regetting index bitmap.", vdir->i_ino);
+		ntfs_debug("Inode 0x%lx, regetting index bitmap.", vdir->i_ino);
 		bmp_vi = ntfs_attr_iget(vdir, AT_BITMAP, I30, 4);
 		if (unlikely(IS_ERR(bmp_vi))) {
 			ntfs_error(sb, "Failed to get bitmap attribute.");
diff -Nru a/fs/ntfs/inode.c b/fs/ntfs/inode.c
--- a/fs/ntfs/inode.c	2004-06-02 23:27:00 -07:00
+++ b/fs/ntfs/inode.c	2004-06-02 23:27:00 -07:00
@@ -872,7 +872,7 @@
 		/* Setup the operations for this inode. */
 		vi->i_op = &ntfs_dir_inode_ops;
 		vi->i_fop = &ntfs_dir_ops;
-		vi->i_mapping->a_ops = &ntfs_aops;
+		vi->i_mapping->a_ops = &ntfs_mst_aops;
 	} else {
 		/* It is a file. */
 		reinit_attr_search_ctx(ctx);
@@ -1249,7 +1249,10 @@
 	/* Setup the operations for this attribute inode. */
 	vi->i_op = NULL;
 	vi->i_fop = NULL;
-	vi->i_mapping->a_ops = &ntfs_aops;
+	if (NInoMstProtected(ni))
+		vi->i_mapping->a_ops = &ntfs_mst_aops;
+	else
+		vi->i_mapping->a_ops = &ntfs_aops;
 
 	if (!NInoCompressed(ni))
 		vi->i_blocks = ni->allocated_size >> 9;
@@ -1339,7 +1342,7 @@
 	ni->name_len = 0;
 
 	/*
-	 * This sets up our little cheat allowing us to reuse the async io
+	 * This sets up our little cheat allowing us to reuse the async read io
 	 * completion handler for directories.
 	 */
 	ni->itype.index.block_size = vol->mft_record_size;
@@ -1703,18 +1706,6 @@
 }
 
 /**
- * ntfs_commit_inode - write out a dirty inode
- * @ni:		inode to write out
- *
- */
-int ntfs_commit_inode(ntfs_inode *ni)
-{
-	ntfs_debug("Entering for inode 0x%lx.", ni->mft_no);
-	NInoClearDirty(ni);
-	return 0;
-}
-
-/**
  * ntfs_put_inode - handler for when the inode reference count is decremented
  * @vi:		vfs inode
  *
@@ -1742,34 +1733,6 @@
 
 void __ntfs_clear_inode(ntfs_inode *ni)
 {
-	int err;
-
-	ntfs_debug("Entering for inode 0x%lx.", ni->mft_no);
-	if (NInoDirty(ni)) {
-		err = ntfs_commit_inode(ni);
-		if (err) {
-			ntfs_error(ni->vol->sb, "Failed to commit dirty "
-					"inode synchronously.");
-			// FIXME: Do something!!!
-		}
-	}
-	/* Synchronize with ntfs_commit_inode(). */
-	down(&ni->mrec_lock);
-	up(&ni->mrec_lock);
-	if (NInoDirty(ni)) {
-		ntfs_error(ni->vol->sb, "Failed to commit dirty inode "
-				"asynchronously.");
-		// FIXME: Do something!!!
-	}
-	/* No need to lock at this stage as no one else has a reference. */
-	if (ni->nr_extents > 0) {
-		int i;
-
-		// FIXME: Handle dirty case for each extent inode!
-		for (i = 0; i < ni->nr_extents; i++)
-			ntfs_clear_extent_inode(ni->ext.extent_ntfs_inos[i]);
-		kfree(ni->ext.extent_ntfs_inos);
-	}
 	/* Free all alocated memory. */
 	down_write(&ni->run_list.lock);
 	if (ni->run_list.rl) {
@@ -1799,6 +1762,20 @@
 
 void ntfs_clear_extent_inode(ntfs_inode *ni)
 {
+	ntfs_debug("Entering for inode 0x%lx.", ni->mft_no);
+
+	BUG_ON(NInoAttr(ni));
+	BUG_ON(ni->nr_extents != -1);
+
+#ifdef NTFS_RW
+	if (NInoDirty(ni)) {
+		if (!is_bad_inode(VFS_I(ni->ext.base_ntfs_ino)))
+			ntfs_error(ni->vol->sb, "Clearing dirty extent inode!  "
+					"Losing data!  This is a BUG!!!");
+		// FIXME:  Do something!!!
+	}
+#endif /* NTFS_RW */
+
 	__ntfs_clear_inode(ni);
 
 	/* Bye, bye... */
@@ -1819,6 +1796,30 @@
 {
 	ntfs_inode *ni = NTFS_I(vi);
 
+#ifdef NTFS_RW
+	if (NInoDirty(ni)) {
+		BOOL was_bad = (is_bad_inode(vi));
+
+		/* Committing the inode also commits all extent inodes. */
+		ntfs_commit_inode(vi);
+
+		if (!was_bad && (is_bad_inode(vi) || NInoDirty(ni))) {
+			ntfs_error(vi->i_sb, "Failed to commit dirty inode "
+					"0x%lx.  Losing data!", vi->i_ino);
+			// FIXME:  Do something!!!
+		}
+	}
+#endif /* NTFS_RW */
+
+	/* No need to lock at this stage as no one else has a reference. */
+	if (ni->nr_extents > 0) {
+		int i;
+
+		for (i = 0; i < ni->nr_extents; i++)
+			ntfs_clear_extent_inode(ni->ext.extent_ntfs_inos[i]);
+		kfree(ni->ext.extent_ntfs_inos);
+	}
+
 	__ntfs_clear_inode(ni);
 
 	if (NInoAttr(ni)) {
@@ -1959,4 +1960,49 @@
 	return err;
 }
 
-#endif
+void ntfs_write_inode(struct inode *vi, int sync)
+{
+	ntfs_inode *ni = NTFS_I(vi);
+
+	ntfs_debug("Entering for %sinode 0x%lx.", NInoAttr(ni) ? "attr " : "",
+			vi->i_ino);
+
+	/*
+	 * Dirty attribute inodes are written via their real inodes so just
+	 * clean them here.
+	 */
+	if (NInoAttr(ni)) {
+		NInoClearDirty(ni);
+		return;
+	}
+
+	/* Write this base mft record. */
+	if (NInoDirty(ni)) {
+		ntfs_warning(vi->i_sb, "Cleaning dirty inode 0x%lx without "
+				"writing to disk as this is not yet "
+				"implemented.", vi->i_ino);
+		NInoClearDirty(ni);
+	}
+
+	/* Write all attached extent mft records. */
+	down(&ni->extent_lock);
+	if (ni->nr_extents > 0) {
+		int i;
+		ntfs_inode **extent_nis = ni->ext.extent_ntfs_inos;
+
+		for (i = 0; i < ni->nr_extents; i++) {
+			ntfs_inode *tni = extent_nis[i];
+
+			if (NInoDirty(tni)) {
+				ntfs_warning(vi->i_sb, "Cleaning dirty extent "
+						"inode 0x%lx without writing "
+						"to disk as this is not yet "
+						"implemented.", tni->mft_no);
+				NInoClearDirty(tni);
+			}
+		}
+	}
+	up(&ni->extent_lock);
+}
+
+#endif /* NTFS_RW */
diff -Nru a/fs/ntfs/inode.h b/fs/ntfs/inode.h
--- a/fs/ntfs/inode.h	2004-06-02 23:27:00 -07:00
+++ b/fs/ntfs/inode.h	2004-06-02 23:27:00 -07:00
@@ -281,6 +281,15 @@
 
 extern int ntfs_setattr(struct dentry *dentry, struct iattr *attr);
 
+extern void ntfs_write_inode(struct inode *vi, int sync);
+
+static inline void ntfs_commit_inode(struct inode *vi)
+{
+	if (!is_bad_inode(vi))
+		ntfs_write_inode(vi, 1);
+	return;
+}
+
 #endif /* NTFS_RW */
 
 #endif /* _LINUX_NTFS_INODE_H */
diff -Nru a/fs/ntfs/ntfs.h b/fs/ntfs/ntfs.h
--- a/fs/ntfs/ntfs.h	2004-06-02 23:26:59 -07:00
+++ b/fs/ntfs/ntfs.h	2004-06-02 23:26:59 -07:00
@@ -62,6 +62,7 @@
 /* The various operations structs defined throughout the driver files. */
 extern struct super_operations ntfs_sops;
 extern struct address_space_operations ntfs_aops;
+extern struct address_space_operations ntfs_mst_aops;
 extern struct address_space_operations ntfs_mft_aops;
 
 extern struct  file_operations ntfs_file_ops;
diff -Nru a/fs/ntfs/super.c b/fs/ntfs/super.c
--- a/fs/ntfs/super.c	2004-06-02 23:27:00 -07:00
+++ b/fs/ntfs/super.c	2004-06-02 23:27:00 -07:00
@@ -763,7 +763,7 @@
 	/* The $MFTMirr, like the $MFT is multi sector transfer protected. */
 	NInoSetMstProtected(tmp_ni);
 	/*
-	 * Set up our little cheat allowing us to reuse the async io
+	 * Set up our little cheat allowing us to reuse the async read io
 	 * completion handler for directories.
 	 */
 	tmp_ni->itype.index.block_size = vol->mft_record_size;
@@ -1142,7 +1142,7 @@
 #ifdef NTFS_RW
 	/* Make sure that no unsupported volume flags are set. */
 	if (vol->vol_flags & VOLUME_MUST_MOUNT_RO_MASK) {
-		static const char *es1 = "Volume has unsupported flags set ";
+		static const char *es1 = "Volume has unsupported flags set";
 		static const char *es2 = ".  Run chkdsk and mount in Windows.";
 
 		/* If a read-write mount, convert it to a read-only mount. */
diff -Nru a/fs/reiserfs/file.c b/fs/reiserfs/file.c
--- a/fs/reiserfs/file.c	2004-06-02 23:26:58 -07:00
+++ b/fs/reiserfs/file.c	2004-06-02 23:26:58 -07:00
@@ -545,7 +545,7 @@
 								 array to
 								 prepared pages
 								*/
-				const char *buf /* Pointer to user-supplied
+				const char __user *buf /* Pointer to user-supplied
 						   data*/
 				)
 {
@@ -1062,7 +1062,7 @@
 
 */
 ssize_t reiserfs_file_write( struct file *file, /* the file we are going to write into */
-                             const char *buf, /*  pointer to user supplied data
+                             const char __user *buf, /*  pointer to user supplied data
 (in userspace) */
                              size_t count, /* amount of bytes to write */
                              loff_t *ppos /* pointer to position in file that we start writing at. Should be updated to
diff -Nru a/fs/reiserfs/ioctl.c b/fs/reiserfs/ioctl.c
--- a/fs/reiserfs/ioctl.c	2004-06-02 23:26:59 -07:00
+++ b/fs/reiserfs/ioctl.c	2004-06-02 23:26:59 -07:00
@@ -36,7 +36,7 @@
 	case REISERFS_IOC_GETFLAGS:
 		flags = REISERFS_I(inode) -> i_attrs;
 		i_attrs_to_sd_attrs( inode, ( __u16 * ) &flags );
-		return put_user(flags, (int *) arg);
+		return put_user(flags, (int __user *) arg);
 	case REISERFS_IOC_SETFLAGS: {
 		if (IS_RDONLY(inode))
 			return -EROFS;
@@ -44,7 +44,7 @@
 		if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))
 			return -EPERM;
 
-		if (get_user(flags, (int *) arg))
+		if (get_user(flags, (int __user *) arg))
 			return -EFAULT;
 
 		if ( ( ( flags ^ REISERFS_I(inode) -> i_attrs) & ( REISERFS_IMMUTABLE_FL | REISERFS_APPEND_FL)) &&
@@ -66,13 +66,13 @@
 		return 0;
 	}
 	case REISERFS_IOC_GETVERSION:
-		return put_user(inode->i_generation, (int *) arg);
+		return put_user(inode->i_generation, (int __user *) arg);
 	case REISERFS_IOC_SETVERSION:
 		if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))
 			return -EPERM;
 		if (IS_RDONLY(inode))
 			return -EROFS;
-		if (get_user(inode->i_generation, (int *) arg))
+		if (get_user(inode->i_generation, (int __user *) arg))
 			return -EFAULT;	
 		inode->i_ctime = CURRENT_TIME;
 		mark_inode_dirty(inode);
diff -Nru a/include/asm-alpha/checksum.h b/include/asm-alpha/checksum.h
--- a/include/asm-alpha/checksum.h	2004-06-02 23:26:58 -07:00
+++ b/include/asm-alpha/checksum.h	2004-06-02 23:26:58 -07:00
@@ -43,7 +43,7 @@
  * here even more important to align src and dst on a 32-bit (or even
  * better 64-bit) boundary
  */
-unsigned int csum_partial_copy_from_user(const char *src, char *dst, int len, unsigned int sum, int *errp);
+unsigned int csum_partial_copy_from_user(const char __user *src, char *dst, int len, unsigned int sum, int *errp);
 
 unsigned int csum_partial_copy_nocheck(const char *src, char *dst, int len, unsigned int sum);
 
diff -Nru a/include/asm-alpha/core_mcpcia.h b/include/asm-alpha/core_mcpcia.h
--- a/include/asm-alpha/core_mcpcia.h	2004-06-02 23:27:00 -07:00
+++ b/include/asm-alpha/core_mcpcia.h	2004-06-02 23:27:00 -07:00
@@ -167,7 +167,7 @@
 
 /* Hack!  Only words for bus 0.  */
 
-#if !MCPCIA_ONE_HAE_WINDOW
+#ifndef MCPCIA_ONE_HAE_WINDOW
 #define MCPCIA_HAE_ADDRESS	MCPCIA_HAE_MEM(4)
 #endif
 #define MCPCIA_IACK_SC		_MCPCIA_IACK_SC(4)
@@ -351,7 +351,7 @@
 	unsigned long hose = in_addr & ~0xffffffffUL;
 	unsigned long result, work;
 
-#if !MCPCIA_ONE_HAE_WINDOW
+#ifndef MCPCIA_ONE_HAE_WINDOW
 	unsigned long msb;
 	msb = addr & ~MCPCIA_MEM_MASK;
 	set_hae(msb);
@@ -370,7 +370,7 @@
 	unsigned long hose = in_addr & ~0xffffffffUL;
 	unsigned long result, work;
 
-#if !MCPCIA_ONE_HAE_WINDOW
+#ifndef MCPCIA_ONE_HAE_WINDOW
 	unsigned long msb;
 	msb = addr & ~MCPCIA_MEM_MASK;
 	set_hae(msb);
@@ -389,7 +389,7 @@
 	unsigned long hose = in_addr & ~0xffffffffUL;
 	unsigned long w;
 
-#if !MCPCIA_ONE_HAE_WINDOW
+#ifndef MCPCIA_ONE_HAE_WINDOW
 	unsigned long msb;
 	msb = addr & ~MCPCIA_MEM_MASK;
 	set_hae(msb);
@@ -407,7 +407,7 @@
 	unsigned long hose = in_addr & ~0xffffffffUL;
 	unsigned long w;
 
-#if !MCPCIA_ONE_HAE_WINDOW
+#ifndef MCPCIA_ONE_HAE_WINDOW
 	unsigned long msb;
 	msb = addr & ~MCPCIA_MEM_MASK;
 	set_hae(msb);
diff -Nru a/include/asm-alpha/core_polaris.h b/include/asm-alpha/core_polaris.h
--- a/include/asm-alpha/core_polaris.h	2004-06-02 23:26:59 -07:00
+++ b/include/asm-alpha/core_polaris.h	2004-06-02 23:26:59 -07:00
@@ -18,13 +18,13 @@
  */
 
 /* Polaris memory regions */
-#define POLARIS_SPARSE_MEM_BASE		(IDENT_ADDR + 0xf800000000)
-#define POLARIS_DENSE_MEM_BASE		(IDENT_ADDR + 0xf900000000)
-#define POLARIS_SPARSE_IO_BASE		(IDENT_ADDR + 0xf980000000)
-#define POLARIS_SPARSE_CONFIG_BASE	(IDENT_ADDR + 0xf9c0000000)
-#define POLARIS_IACK_BASE		(IDENT_ADDR + 0xf9f8000000)
-#define POLARIS_DENSE_IO_BASE		(IDENT_ADDR + 0xf9fc000000)
-#define POLARIS_DENSE_CONFIG_BASE	(IDENT_ADDR + 0xf9fe000000)
+#define POLARIS_SPARSE_MEM_BASE		(IDENT_ADDR + 0xf800000000UL)
+#define POLARIS_DENSE_MEM_BASE		(IDENT_ADDR + 0xf900000000UL)
+#define POLARIS_SPARSE_IO_BASE		(IDENT_ADDR + 0xf980000000UL)
+#define POLARIS_SPARSE_CONFIG_BASE	(IDENT_ADDR + 0xf9c0000000UL)
+#define POLARIS_IACK_BASE		(IDENT_ADDR + 0xf9f8000000UL)
+#define POLARIS_DENSE_IO_BASE		(IDENT_ADDR + 0xf9fc000000UL)
+#define POLARIS_DENSE_CONFIG_BASE	(IDENT_ADDR + 0xf9fe000000UL)
 
 #define POLARIS_IACK_SC			POLARIS_IACK_BASE
 
diff -Nru a/include/asm-alpha/floppy.h b/include/asm-alpha/floppy.h
--- a/include/asm-alpha/floppy.h	2004-06-02 23:27:00 -07:00
+++ b/include/asm-alpha/floppy.h	2004-06-02 23:27:00 -07:00
@@ -108,10 +108,11 @@
  * on that platform... ;-}
  */
 
-#define CROSS_64KB(a,s)						\
-({ unsigned long __s64 = (unsigned long)(a);			\
-   unsigned long __e64 = __s64 + (unsigned long)(s) - 1;	\
-   (__s64 ^ __e64) & ~0xfffful; })
+static inline unsigned long CROSS_64KB(void *a, unsigned long s)
+{
+	unsigned long p = (unsigned long)a;
+	return ((p + s - 1) ^ p) & ~0xffffUL;
+}
 
 #define EXTRA_FLOPPY_PARAMS
 
diff -Nru a/include/asm-alpha/io.h b/include/asm-alpha/io.h
--- a/include/asm-alpha/io.h	2004-06-02 23:27:00 -07:00
+++ b/include/asm-alpha/io.h	2004-06-02 23:27:00 -07:00
@@ -9,9 +9,9 @@
  * Virtual -> physical identity mapping starts at this offset
  */
 #ifdef USE_48_BIT_KSEG
-#define IDENT_ADDR     0xffff800000000000
+#define IDENT_ADDR     0xffff800000000000UL
 #else
-#define IDENT_ADDR     0xfffffc0000000000
+#define IDENT_ADDR     0xfffffc0000000000UL
 #endif
 
 #ifdef __KERNEL__
diff -Nru a/include/asm-alpha/page.h b/include/asm-alpha/page.h
--- a/include/asm-alpha/page.h	2004-06-02 23:27:00 -07:00
+++ b/include/asm-alpha/page.h	2004-06-02 23:27:00 -07:00
@@ -73,16 +73,24 @@
 	return order;
 }
 
-#endif /* !__ASSEMBLY__ */
+#ifdef USE_48_BIT_KSEG
+#define PAGE_OFFSET		0xffff800000000000UL
+#else
+#define PAGE_OFFSET		0xfffffc0000000000UL
+#endif
 
-/* to align the pointer to the (next) page boundary */
-#define PAGE_ALIGN(addr)	(((addr)+PAGE_SIZE-1)&PAGE_MASK)
+#else
 
 #ifdef USE_48_BIT_KSEG
 #define PAGE_OFFSET		0xffff800000000000
 #else
 #define PAGE_OFFSET		0xfffffc0000000000
 #endif
+
+#endif /* !__ASSEMBLY__ */
+
+/* to align the pointer to the (next) page boundary */
+#define PAGE_ALIGN(addr)	(((addr)+PAGE_SIZE-1)&PAGE_MASK)
 
 #define __pa(x)			((unsigned long) (x) - PAGE_OFFSET)
 #define __va(x)			((void *)((unsigned long) (x) + PAGE_OFFSET))
diff -Nru a/include/asm-alpha/pgtable.h b/include/asm-alpha/pgtable.h
--- a/include/asm-alpha/pgtable.h	2004-06-02 23:26:59 -07:00
+++ b/include/asm-alpha/pgtable.h	2004-06-02 23:26:59 -07:00
@@ -83,7 +83,7 @@
 #define __DIRTY_BITS	(_PAGE_DIRTY | _PAGE_KWE | _PAGE_UWE)
 #define __ACCESS_BITS	(_PAGE_ACCESSED | _PAGE_KRE | _PAGE_URE)
 
-#define _PFN_MASK	0xFFFFFFFF00000000
+#define _PFN_MASK	0xFFFFFFFF00000000UL
 
 #define _PAGE_TABLE	(_PAGE_VALID | __DIRTY_BITS | __ACCESS_BITS)
 #define _PAGE_CHG_MASK	(_PFN_MASK | __DIRTY_BITS | __ACCESS_BITS)
diff -Nru a/include/asm-alpha/semaphore.h b/include/asm-alpha/semaphore.h
--- a/include/asm-alpha/semaphore.h	2004-06-02 23:27:00 -07:00
+++ b/include/asm-alpha/semaphore.h	2004-06-02 23:27:00 -07:00
@@ -18,12 +18,12 @@
 struct semaphore {
 	atomic_t count;
 	wait_queue_head_t wait;
-#if WAITQUEUE_DEBUG
+#ifdef WAITQUEUE_DEBUG
 	long __magic;
 #endif
 };
 
-#if WAITQUEUE_DEBUG
+#ifdef WAITQUEUE_DEBUG
 # define __SEM_DEBUG_INIT(name)		, (long)&(name).__magic
 #else
 # define __SEM_DEBUG_INIT(name)
@@ -53,7 +53,7 @@
 
 	atomic_set(&sem->count, val);
 	init_waitqueue_head(&sem->wait);
-#if WAITQUEUE_DEBUG
+#ifdef WAITQUEUE_DEBUG
 	sem->__magic = (long)&sem->__magic;
 #endif
 }
@@ -142,7 +142,7 @@
 		__up_wakeup(sem);
 }
 
-#if !WAITQUEUE_DEBUG && !defined(CONFIG_DEBUG_SEMAPHORE)
+#if !defined(WAITQUEUE_DEBUG) && !defined(CONFIG_DEBUG_SEMAPHORE)
 extern inline void down(struct semaphore *sem)
 {
 	__down(sem);
diff -Nru a/include/asm-alpha/uaccess.h b/include/asm-alpha/uaccess.h
--- a/include/asm-alpha/uaccess.h	2004-06-02 23:27:00 -07:00
+++ b/include/asm-alpha/uaccess.h	2004-06-02 23:27:00 -07:00
@@ -29,6 +29,14 @@
 
 #define segment_eq(a,b)	((a).seg == (b).seg)
 
+#ifdef __CHECKER__
+#define CHECK_UPTR(ptr) do {                            \
+        __typeof__(*(ptr)) *__dummy_check_uptr =        \
+		(void __user *)&__dummy_check_uptr;     \
+} while(0)
+#else
+#define CHECK_UPTR(ptr)
+#endif
 
 /*
  * Is a address valid? This does a straightforward calculation rather
@@ -43,10 +51,13 @@
 #define __access_ok(addr,size,segment) \
 	(((segment).seg & (addr | size | (addr+size))) == 0)
 
-#define access_ok(type,addr,size) \
-	__access_ok(((unsigned long)(addr)),(size),get_fs())
+#define access_ok(type,addr,size)				\
+({								\
+	CHECK_UPTR(addr);					\
+	__access_ok(((unsigned long)(addr)),(size),get_fs());	\
+})
 
-extern inline int verify_area(int type, const void * addr, unsigned long size)
+extern inline int verify_area(int type, const void __user * addr, unsigned long size)
 {
 	return access_ok(type,addr,size) ? 0 : -EFAULT;
 }
@@ -90,6 +101,7 @@
 #define __get_user_nocheck(x,ptr,size)				\
 ({								\
 	long __gu_err = 0, __gu_val;				\
+	CHECK_UPTR(ptr);					\
 	switch (size) {						\
 	  case 1: __get_user_8(ptr); break;			\
 	  case 2: __get_user_16(ptr); break;			\
@@ -105,6 +117,7 @@
 ({								\
 	long __gu_err = -EFAULT, __gu_val = 0;			\
 	const __typeof__(*(ptr)) *__gu_addr = (ptr);		\
+	CHECK_UPTR(ptr);					\
 	if (__access_ok((long)__gu_addr,size,segment)) {	\
 		__gu_err = 0;					\
 		switch (size) {					\
@@ -204,6 +217,7 @@
 #define __put_user_nocheck(x,ptr,size)				\
 ({								\
 	long __pu_err = 0;					\
+	CHECK_UPTR(ptr);					\
 	switch (size) {						\
 	  case 1: __put_user_8(x,ptr); break;			\
 	  case 2: __put_user_16(x,ptr); break;			\
@@ -218,6 +232,7 @@
 ({								\
 	long __pu_err = -EFAULT;				\
 	__typeof__(*(ptr)) *__pu_addr = (ptr);			\
+	CHECK_UPTR(ptr);					\
 	if (__access_ok((long)__pu_addr,size,segment)) {	\
 		__pu_err = 0;					\
 		switch (size) {					\
@@ -371,34 +386,42 @@
 }
 
 extern inline long
-__copy_tofrom_user(void *to, const void *from, long len, const void *validate)
+__copy_tofrom_user(void *to, const void *from, long len, const void __user *validate)
 {
 	if (__access_ok((long)validate, len, get_fs()))
 		len = __copy_tofrom_user_nocheck(to, from, len);
 	return len;
 }
 
-#define __copy_to_user(to,from,n)   __copy_tofrom_user_nocheck((to),(from),(n))
-#define __copy_from_user(to,from,n) __copy_tofrom_user_nocheck((to),(from),(n))
+#define __copy_to_user(to,from,n)				\
+({								\
+	CHECK_UPTR(to);						\
+	__copy_tofrom_user_nocheck((void *)(to),(from),(n));	\
+})
+#define __copy_from_user(to,from,n)				\
+({								\
+	CHECK_UPTR(from);					\
+	__copy_tofrom_user_nocheck((to),(void *)(from),(n));	\
+})
 
 extern inline long
-copy_to_user(void *to, const void *from, long n)
+copy_to_user(void __user *to, const void *from, long n)
 {
-	return __copy_tofrom_user(to, from, n, to);
+	return __copy_tofrom_user((void *)to, from, n, to);
 }
 
 extern inline long
-copy_from_user(void *to, const void *from, long n)
+copy_from_user(void *to, const void __user *from, long n)
 {
-	return __copy_tofrom_user(to, from, n, from);
+	return __copy_tofrom_user(to, (void *)from, n, from);
 }
 
 extern void __do_clear_user(void);
 
 extern inline long
-__clear_user(void *to, long len)
+__clear_user(void __user *to, long len)
 {
-	register void * __cl_to __asm__("$6") = to;
+	register void __user * __cl_to __asm__("$6") = to;
 	register long __cl_len __asm__("$0") = len;
 	__asm__ __volatile__(
 		__module_call(28, 2, __do_clear_user)
@@ -410,7 +433,7 @@
 }
 
 extern inline long
-clear_user(void *to, long len)
+clear_user(void __user *to, long len)
 {
 	if (__access_ok((long)to, len, get_fs()))
 		len = __clear_user(to, len);
@@ -423,10 +446,10 @@
 /* Returns: -EFAULT if exception before terminator, N if the entire
    buffer filled, else strlen.  */
 
-extern long __strncpy_from_user(char *__to, const char *__from, long __to_len);
+extern long __strncpy_from_user(char *__to, const char __user *__from, long __to_len);
 
 extern inline long
-strncpy_from_user(char *to, const char *from, long n)
+strncpy_from_user(char *to, const char __user *from, long n)
 {
 	long ret = -EFAULT;
 	if (__access_ok((long)from, 0, get_fs()))
@@ -435,18 +458,18 @@
 }
 
 /* Returns: 0 if bad, string length+1 (memory size) of string if ok */
-extern long __strlen_user(const char *);
+extern long __strlen_user(const char __user *);
 
-extern inline long strlen_user(const char *str)
+extern inline long strlen_user(const char __user *str)
 {
 	return access_ok(VERIFY_READ,str,0) ? __strlen_user(str) : 0;
 }
 
 /* Returns: 0 if exception before NUL or reaching the supplied limit (N),
  * a value greater than N if the limit would be exceeded, else strlen.  */
-extern long __strnlen_user(const char *, long);
+extern long __strnlen_user(const char __user *, long);
 
-extern inline long strnlen_user(const char *str, long n)
+extern inline long strnlen_user(const char __user *str, long n)
 {
 	return access_ok(VERIFY_READ,str,0) ? __strnlen_user(str, n) : 0;
 }
diff -Nru a/include/asm-arm/arch-pxa/hardware.h b/include/asm-arm/arch-pxa/hardware.h
--- a/include/asm-arm/arch-pxa/hardware.h	2004-06-02 23:26:58 -07:00
+++ b/include/asm-arm/arch-pxa/hardware.h	2004-06-02 23:26:58 -07:00
@@ -83,9 +83,10 @@
 extern void pxa_gpio_mode( int gpio_mode );
 
 /*
- * return current lclk frequency in units of 10kHz
+ * return current memory and LCD clock frequency in units of 10kHz
  */
-extern unsigned int get_lclk_frequency_10khz(void);
+extern unsigned int get_memclk_frequency_10khz(void);
+extern unsigned int get_lcdclk_frequency_10khz(void);
 
 #endif
 
diff -Nru a/include/asm-arm/setup.h b/include/asm-arm/setup.h
--- a/include/asm-arm/setup.h	2004-06-02 23:26:59 -07:00
+++ b/include/asm-arm/setup.h	2004-06-02 23:26:59 -07:00
@@ -196,7 +196,6 @@
 
 struct meminfo {
 	int nr_banks;
-	unsigned long end;
 	struct {
 		unsigned long start;
 		unsigned long size;
diff -Nru a/include/asm-cris/arch-v10/cache.h b/include/asm-cris/arch-v10/cache.h
--- a/include/asm-cris/arch-v10/cache.h	2004-06-02 23:27:00 -07:00
+++ b/include/asm-cris/arch-v10/cache.h	2004-06-02 23:27:00 -07:00
@@ -3,6 +3,7 @@
 
 /* Etrax 100LX have 32-byte cache-lines. */
 #define L1_CACHE_BYTES 32
+#define L1_CACHE_SHIFT 5
 #define L1_CACHE_SHIFT_MAX 5
 
 #endif /* _ASM_ARCH_CACHE_H */
diff -Nru a/include/asm-cris/arch-v10/irq.h b/include/asm-cris/arch-v10/irq.h
--- a/include/asm-cris/arch-v10/irq.h	2004-06-02 23:26:58 -07:00
+++ b/include/asm-cris/arch-v10/irq.h	2004-06-02 23:26:58 -07:00
@@ -8,6 +8,11 @@
 #include <asm/arch/sv_addr_ag.h>
 
 #define NR_IRQS 32
+
+/* The first vector number used for IRQs in v10 is really 0x20 */
+/* but all the code and constants are offseted to make 0 the first */
+#define FIRST_IRQ 0
+
 #define SOME_IRQ_NBR        IO_BITNR(R_VECT_MASK_RD, some)   /* 0 ? */
 #define NMI_IRQ_NBR         IO_BITNR(R_VECT_MASK_RD, nmi)    /* 1 */
 #define TIMER0_IRQ_NBR      IO_BITNR(R_VECT_MASK_RD, timer0) /* 2 */
diff -Nru a/include/asm-cris/arch-v10/offset.h b/include/asm-cris/arch-v10/offset.h
--- a/include/asm-cris/arch-v10/offset.h	2004-06-02 23:26:58 -07:00
+++ b/include/asm-cris/arch-v10/offset.h	2004-06-02 23:26:58 -07:00
@@ -25,7 +25,7 @@
 #define THREAD_usp 4 /* offsetof(struct thread_struct, usp) */
 #define THREAD_dccr 8 /* offsetof(struct thread_struct, dccr) */
 
-#define TASK_pid 121 /* offsetof(struct task_struct, pid) */
+#define TASK_pid 133 /* offsetof(struct task_struct, pid) */
 
 #define LCLONE_VM 256 /* CLONE_VM */
 #define LCLONE_UNTRACED 8388608 /* CLONE_UNTRACED */
diff -Nru a/include/asm-cris/bitops.h b/include/asm-cris/bitops.h
--- a/include/asm-cris/bitops.h	2004-06-02 23:27:00 -07:00
+++ b/include/asm-cris/bitops.h	2004-06-02 23:27:00 -07:00
@@ -296,6 +296,50 @@
 }
 
 /**
+ * find_next_bit - find the first set bit in a memory region
+ * @addr: The address to base the search on
+ * @offset: The bitnumber to start searching at
+ * @size: The maximum size to search
+ */
+static __inline__ int find_next_bit(void *addr, int size, int offset)
+{
+	unsigned long *p = ((unsigned long *) addr) + (offset >> 5);
+        unsigned long result = offset & ~31UL;
+        unsigned long tmp;
+
+        if (offset >= size)
+                return size;
+        size -= result;
+        offset &= 31UL;
+        if (offset) {
+                tmp = *(p++);
+                tmp &= (~0UL << offset);
+                if (size < 32)
+                        goto found_first;
+                if (tmp)
+                        goto found_middle;
+                size -= 32;
+                result += 32;
+        }
+        while (size & ~31UL) {
+                if ((tmp = *(p++)))
+                        goto found_middle;
+                result += 32;
+                size -= 32;
+        }
+        if (!size)
+                return result;
+        tmp = *p;
+
+found_first:
+        tmp &= (~0UL >> (32 - size));
+        if (tmp == 0UL)        /* Are any bits set? */
+                return result + size; /* Nope. */
+found_middle:
+        return result + __ffs(tmp);
+}
+
+/**
  * find_first_zero_bit - find the first zero bit in a memory region
  * @addr: The address to start the search at
  * @size: The maximum size to search
@@ -306,6 +350,8 @@
 
 #define find_first_zero_bit(addr, size) \
         find_next_zero_bit((addr), (size), 0)
+#define find_first_bit(addr, size) \
+        find_next_bit((addr), (size), 0)
 
 #define ext2_set_bit                 test_and_set_bit
 #define ext2_set_bit_atomic(l,n,a)   test_and_set_bit(n,a)
diff -Nru a/include/asm-cris/dma-mapping.h b/include/asm-cris/dma-mapping.h
--- a/include/asm-cris/dma-mapping.h	2004-06-02 23:27:00 -07:00
+++ b/include/asm-cris/dma-mapping.h	2004-06-02 23:27:00 -07:00
@@ -1 +1,125 @@
-#include <asm-generic/dma-mapping.h>
+#ifndef _ASM_CRIS_DMA_MAPPING_H
+#define _ASM_CRIS_DMA_MAPPING_H
+
+#include "scatterlist.h"
+
+static inline int
+dma_supported(struct device *dev, u64 mask)
+{
+	BUG();
+	return 0;
+}
+
+static inline int
+dma_set_mask(struct device *dev, u64 dma_mask)
+{
+	BUG();
+	return 1;
+}
+
+static inline void *
+dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		   int flag)
+{
+	BUG();
+	return NULL;
+}
+
+static inline void
+dma_free_coherent(struct device *dev, size_t size, void *cpu_addr,
+		    dma_addr_t dma_handle)
+{
+	BUG();
+}
+
+static inline dma_addr_t
+dma_map_single(struct device *dev, void *cpu_addr, size_t size,
+	       enum dma_data_direction direction)
+{
+	BUG();
+	return 0;
+}
+
+static inline void
+dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
+		 enum dma_data_direction direction)
+{
+	BUG();
+}
+
+static inline dma_addr_t
+dma_map_page(struct device *dev, struct page *page,
+	     unsigned long offset, size_t size,
+	     enum dma_data_direction direction)
+{
+	BUG();
+	return 0;
+}
+
+static inline void
+dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
+	       enum dma_data_direction direction)
+{
+	BUG();
+}
+
+static inline int
+dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
+	   enum dma_data_direction direction)
+{
+	BUG();
+	return 1;
+}
+
+static inline void
+dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
+	     enum dma_data_direction direction)
+{
+	BUG();
+}
+
+static inline void
+dma_sync_single(struct device *dev, dma_addr_t dma_handle, size_t size,
+		enum dma_data_direction direction)
+{
+	BUG();
+}
+
+static inline void
+dma_sync_sg(struct device *dev, struct scatterlist *sg, int nelems,
+	    enum dma_data_direction direction)
+{
+	BUG();
+}
+
+/* Now for the API extensions over the pci_ one */
+
+#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
+#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
+#define dma_is_consistent(d)	(1)
+
+static inline int
+dma_get_cache_alignment(void)
+{
+	/* no easy way to get cache size on all processors, so return
+	 * the maximum possible, to be safe */
+	return (1 << L1_CACHE_SHIFT_MAX);
+}
+
+static inline void
+dma_sync_single_range(struct device *dev, dma_addr_t dma_handle,
+		      unsigned long offset, size_t size,
+		      enum dma_data_direction direction)
+{
+	BUG();
+}
+
+static inline void
+dma_cache_sync(void *vaddr, size_t size,
+	       enum dma_data_direction direction)
+{
+	BUG();
+}
+
+#endif
+
diff -Nru a/include/asm-cris/fasttimer.h b/include/asm-cris/fasttimer.h
--- a/include/asm-cris/fasttimer.h	2004-06-02 23:26:59 -07:00
+++ b/include/asm-cris/fasttimer.h	2004-06-02 23:26:59 -07:00
@@ -1,4 +1,4 @@
-/* $Id: fasttimer.h,v 1.2 2002/12/11 13:03:43 starvik Exp $
+/* $Id: fasttimer.h,v 1.3 2004/05/14 10:19:19 starvik Exp $
  * linux/include/asm-cris/fasttimer.h
  *
  * Fast timers for ETRAX100LX
@@ -23,6 +23,8 @@
   unsigned long data;
   const char *name;
 };
+
+extern struct fast_timer *fast_timer_list;
 
 void start_one_shot_timer(struct fast_timer *t,
                           fast_timer_function_type *function,
diff -Nru a/include/asm-cris/io.h b/include/asm-cris/io.h
--- a/include/asm-cris/io.h	2004-06-02 23:27:00 -07:00
+++ b/include/asm-cris/io.h	2004-06-02 23:27:00 -07:00
@@ -72,6 +72,8 @@
 
 #define IO_SPACE_LIMIT 0xffff
 #define inb(x) (0)
+#define inw(x) (0)
+#define inl(x) (0)
 #define outb(x,y)
 #define outw(x,y)
 #define outl(x,y)
diff -Nru a/include/asm-cris/ioctl.h b/include/asm-cris/ioctl.h
--- a/include/asm-cris/ioctl.h	2004-06-02 23:26:59 -07:00
+++ b/include/asm-cris/ioctl.h	2004-06-02 23:26:59 -07:00
@@ -53,11 +53,18 @@
 	 ((nr)   << _IOC_NRSHIFT) | \
 	 ((size) << _IOC_SIZESHIFT))
 
+/* provoke compile error for invalid uses of size argument */
+extern int __invalid_size_argument_for_IOC;
+#define _IOC_TYPECHECK(t) \
+	((sizeof(t) == sizeof(t[1]) && \
+	  sizeof(t) < (1 << _IOC_SIZEBITS)) ? \
+	  sizeof(t) : __invalid_size_argument_for_IOC)
+
 /* used to create numbers */
 #define _IO(type,nr)		_IOC(_IOC_NONE,(type),(nr),0)
-#define _IOR(type,nr,size)	_IOC(_IOC_READ,(type),(nr),sizeof(size))
-#define _IOW(type,nr,size)	_IOC(_IOC_WRITE,(type),(nr),sizeof(size))
-#define _IOWR(type,nr,size)	_IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size))
+#define _IOR(type,nr,size)	_IOC(_IOC_READ,(type),(nr),(_IOC_TYPECHECK(size)))
+#define _IOW(type,nr,size)	_IOC(_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size)))
+#define _IOWR(type,nr,size)	_IOC(_IOC_READ|_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size)))
 
 /* used to decode ioctl numbers.. */
 #define _IOC_DIR(nr)		(((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
diff -Nru a/include/asm-cris/local.h b/include/asm-cris/local.h
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/include/asm-cris/local.h	2004-06-02 23:27:00 -07:00
@@ -0,0 +1 @@
+#include <asm-generic/local.h>
diff -Nru a/include/asm-cris/page.h b/include/asm-cris/page.h
--- a/include/asm-cris/page.h	2004-06-02 23:26:59 -07:00
+++ b/include/asm-cris/page.h	2004-06-02 23:26:59 -07:00
@@ -6,7 +6,11 @@
 
 /* PAGE_SHIFT determines the page size */
 #define PAGE_SHIFT	13
+#ifndef __ASSEMBLY__
 #define PAGE_SIZE	(1UL << PAGE_SHIFT)
+#else
+#define PAGE_SIZE	(1 << PAGE_SHIFT)
+#endif
 #define PAGE_MASK	(~(PAGE_SIZE-1))
 
 #ifdef __KERNEL__
@@ -20,10 +24,12 @@
 /*
  * These are used to make use of C type-checking..
  */
+#ifndef __ASSEMBLY__
 typedef struct { unsigned long pte; } pte_t;
 typedef struct { unsigned long pmd; } pmd_t;
 typedef struct { unsigned long pgd; } pgd_t;
 typedef struct { unsigned long pgprot; } pgprot_t;
+#endif
 
 #define pte_val(x)	((x).pte)
 #define pmd_val(x)	((x).pmd)
@@ -51,7 +57,7 @@
 
 #define virt_to_page(kaddr)    (mem_map + (((unsigned long)(kaddr) - PAGE_OFFSET) >> PAGE_SHIFT))
 #define VALID_PAGE(page)       (((page) - mem_map) < max_mapnr)
-#define virt_addr_valid(kaddr)	pfn_valid((kaddr) >> PAGE_SHIFT)
+#define virt_addr_valid(kaddr)	pfn_valid((unsigned)(kaddr) >> PAGE_SHIFT)
 
 /* convert a page (based on mem_map and forward) to a physical address
  * do this by figuring out the virtual address and then use __pa
@@ -72,8 +78,6 @@
          BUG(); \
 } while (0)
 
-#endif /* __ASSEMBLY__ */
-
 /* Pure 2^n version of get_order */
 static inline int get_order(unsigned long size)
 {
@@ -87,6 +91,7 @@
 	} while (size);
 	return order;
 }
+#endif /* __ASSEMBLY__ */
 
 #define VM_DATA_DEFAULT_FLAGS	(VM_READ | VM_WRITE | VM_EXEC | \
 				 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
diff -Nru a/include/asm-cris/pci.h b/include/asm-cris/pci.h
--- a/include/asm-cris/pci.h	2004-06-02 23:26:58 -07:00
+++ b/include/asm-cris/pci.h	2004-06-02 23:26:58 -07:00
@@ -1,9 +1,13 @@
 #ifndef __ASM_CRIS_PCI_H
 #define __ASM_CRIS_PCI_H
 
+#include <asm/scatterlist.h>
+#include <asm-generic/pci-dma-compat.h>
+
 /* ETRAX chips don't have a PCI bus. This file is just here because some stupid .c code
  * includes it even if CONFIG_PCI is not set.
  */
+#define PCI_DMA_BUS_IS_PHYS       (1)
 
 #endif /* __ASM_CRIS_PCI_H */
 
diff -Nru a/include/asm-cris/pgtable.h b/include/asm-cris/pgtable.h
--- a/include/asm-cris/pgtable.h	2004-06-02 23:26:58 -07:00
+++ b/include/asm-cris/pgtable.h	2004-06-02 23:26:58 -07:00
@@ -5,9 +5,11 @@
 #ifndef _CRIS_PGTABLE_H
 #define _CRIS_PGTABLE_H
 
+#ifndef __ASSEMBLY__
 #include <linux/config.h>
 #include <linux/sched.h>
 #include <asm/mmu.h>
+#endif
 #include <asm/arch/pgtable.h>
 
 /*
@@ -21,8 +23,9 @@
  * This file contains the functions and defines necessary to modify and use
  * the CRIS page table tree.
  */
-
+#ifndef __ASSEMBLY__
 extern void paging_init(void);
+#endif
 
 /* Certain architectures need to do special things when pte's
  * within a page table are directly modified.  Thus, the following
@@ -72,8 +75,10 @@
 #define FIRST_USER_PGD_NR       0
 
 /* zero page used for uninitialized stuff */
+#ifndef __ASSEMBLY__
 extern unsigned long empty_zero_page;
 #define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page))
+#endif
 
 /* number of bits that fit into a memory pointer */
 #define BITS_PER_PTR			(8*sizeof(unsigned long))
@@ -104,6 +109,8 @@
 #define pmd_present(x)	(pmd_val(x) & _PAGE_PRESENT)
 #define pmd_clear(xp)	do { pmd_val(*(xp)) = 0; } while (0)
 
+#ifndef __ASSEMBLY__
+
 /*
  * The "pgd_xxx()" functions here are trivial for a folded two-level
  * setup: the pgd is never bad, and a pmd always exists (as it's folded
@@ -337,4 +344,5 @@
 #define pte_to_pgoff(x)	(pte_val(x) >> 6)
 #define pgoff_to_pte(x)	__pte(((x) << 6) | _PAGE_FILE)
 
+#endif /* __ASSEMBLY__ */
 #endif /* _CRIS_PGTABLE_H */
diff -Nru a/include/asm-cris/ptrace.h b/include/asm-cris/ptrace.h
--- a/include/asm-cris/ptrace.h	2004-06-02 23:26:59 -07:00
+++ b/include/asm-cris/ptrace.h	2004-06-02 23:26:59 -07:00
@@ -3,8 +3,10 @@
 
 #include <asm/arch/ptrace.h>
 
+#ifdef __KERNEL__
 /* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */
 #define PTRACE_GETREGS            12
 #define PTRACE_SETREGS            13
+#endif
 
 #endif /* _CRIS_PTRACE_H */
diff -Nru a/include/asm-cris/rtc.h b/include/asm-cris/rtc.h
--- a/include/asm-cris/rtc.h	2004-06-02 23:26:58 -07:00
+++ b/include/asm-cris/rtc.h	2004-06-02 23:26:58 -07:00
@@ -100,6 +100,8 @@
 #define RTC_RD_TIME		_IOR(RTC_MAGIC, 0x09, struct rtc_time)	/* Read RTC time. */
 #define RTC_SET_TIME		_IOW(RTC_MAGIC, 0x0a, struct rtc_time)	/* Set RTC time. */
 #define RTC_SET_CHARGE  	_IOW(RTC_MAGIC, 0x0b, int) 		
-#define RTC_MAX_IOCTL 0x0b
+#define RTC_VLOW_RD     _IOR(RTC_MAGIC, 0x11, int)  /* Voltage Low detector */
+#define RTC_VLOW_SET    _IO(RTC_MAGIC, 0x12)        /* Clear voltage low information */
+#define RTC_MAX_IOCTL 0x12
 
 #endif /* __RTC_H__ */
diff -Nru a/include/asm-cris/sections.h b/include/asm-cris/sections.h
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/include/asm-cris/sections.h	2004-06-02 23:27:00 -07:00
@@ -0,0 +1,7 @@
+#ifndef _CRIS_SECTIONS_H
+#define _CRIS_SECTIONS_H
+
+/* nothing to see, move along */
+#include <asm-generic/sections.h>
+
+#endif
diff -Nru a/include/asm-cris/semaphore-helper.h b/include/asm-cris/semaphore-helper.h
--- a/include/asm-cris/semaphore-helper.h	2004-06-02 23:27:00 -07:00
+++ b/include/asm-cris/semaphore-helper.h	2004-06-02 23:27:00 -07:00
@@ -52,7 +52,7 @@
 		dec(&sem->waking);
 		ret = 1;
 	} else if (signal_pending(tsk)) {
-		count_inc(&sem->count);
+		inc(&sem->count);
 		ret = -EINTR;
 	}
 	local_irq_restore(flags);
@@ -67,7 +67,7 @@
 	local_save_flags(flags);
 	local_irq_disable();
 	if (read(&sem->waking) <= 0)
-		count_inc(&sem->count);
+		inc(&sem->count);
 	else {
 		dec(&sem->waking);
 		ret = 0;
diff -Nru a/include/asm-cris/semaphore.h b/include/asm-cris/semaphore.h
--- a/include/asm-cris/semaphore.h	2004-06-02 23:26:59 -07:00
+++ b/include/asm-cris/semaphore.h	2004-06-02 23:26:59 -07:00
@@ -21,7 +21,7 @@
 int printk(const char *fmt, ...);
 
 struct semaphore {
-	int count; /* not atomic_t since we do the atomicity here already */
+	atomic_t count;
 	atomic_t waking;
 	wait_queue_head_t wait;
 #if WAITQUEUE_DEBUG
@@ -36,7 +36,7 @@
 #endif
 
 #define __SEMAPHORE_INITIALIZER(name,count)             \
-        { count, ATOMIC_INIT(0),          \
+        { ATOMIC_INIT(count), ATOMIC_INIT(0),           \
           __WAIT_QUEUE_HEAD_INITIALIZER((name).wait)    \
           __SEM_DEBUG_INIT(name) }
 
@@ -84,7 +84,7 @@
 	/* atomically decrement the semaphores count, and if its negative, we wait */
 	local_save_flags(flags);
 	local_irq_disable();
-	failed = --(sem->count) < 0;
+	failed = --(sem->count.counter) < 0;
 	local_irq_restore(flags);
 	if(failed) {
 		__down(sem);
@@ -110,7 +110,7 @@
 	/* atomically decrement the semaphores count, and if its negative, we wait */
 	local_save_flags(flags);
 	local_irq_disable();
-	failed = --(sem->count) < 0;
+	failed = --(sem->count.counter) < 0;
 	local_irq_restore(flags);
 	if(failed)
 		failed = __down_interruptible(sem);
@@ -128,7 +128,7 @@
 
 	local_save_flags(flags);
 	local_irq_disable();
-	failed = --(sem->count) < 0;
+	failed = --(sem->count.counter) < 0;
 	local_irq_restore(flags);
 	if(failed)
 		failed = __down_trylock(sem);
@@ -153,7 +153,7 @@
 	/* atomically increment the semaphores count, and if it was negative, we wake people */
 	local_save_flags(flags);
 	local_irq_disable();
-	wakeup = ++(sem->count) <= 0;
+	wakeup = ++(sem->count.counter) <= 0;
 	local_irq_restore(flags);
 	if(wakeup) {
 		__up(sem);
diff -Nru a/include/asm-cris/termbits.h b/include/asm-cris/termbits.h
--- a/include/asm-cris/termbits.h	2004-06-02 23:26:58 -07:00
+++ b/include/asm-cris/termbits.h	2004-06-02 23:26:58 -07:00
@@ -154,7 +154,7 @@
 #define  B6250000  0010007
 /* etrax 200 supports this as well */
 #define  B12500000 0010010
-#define CIBAUD	  002003600000	/* input baud rate */
+#define CIBAUD	  002003600000	/* input baud rate (used in v32) */
 /* The values for CIBAUD bits are the same as the values for CBAUD and CBAUDEX
  * shifted left IBSHIFT bits.
  */
diff -Nru a/include/asm-cris/types.h b/include/asm-cris/types.h
--- a/include/asm-cris/types.h	2004-06-02 23:26:59 -07:00
+++ b/include/asm-cris/types.h	2004-06-02 23:26:59 -07:00
@@ -50,6 +50,7 @@
 /* Dma addresses are 32-bits wide, just like our other addresses.  */
  
 typedef u32 dma_addr_t;
+typedef u32 dma64_addr_t;
 
 typedef unsigned int kmem_bufctl_t;
 
diff -Nru a/include/asm-cris/unistd.h b/include/asm-cris/unistd.h
--- a/include/asm-cris/unistd.h	2004-06-02 23:27:00 -07:00
+++ b/include/asm-cris/unistd.h	2004-06-02 23:27:00 -07:00
@@ -275,8 +275,21 @@
 #define __NR_clock_nanosleep	(__NR_timer_create+8)
 #define __NR_statfs64		268
 #define __NR_fstatfs64		269
+#define __NR_tgkill		270
+#define __NR_utimes		271
+#define __NR_fadvise64_64	272
+#define __NR_vserver		273
+#define __NR_mbind		274
+#define __NR_get_mempolicy	275
+#define __NR_set_mempolicy	276
+#define __NR_mq_open 		277
+#define __NR_mq_unlink		(__NR_mq_open+1)
+#define __NR_mq_timedsend	(__NR_mq_open+2)
+#define __NR_mq_timedreceive	(__NR_mq_open+3)
+#define __NR_mq_notify		(__NR_mq_open+4)
+#define __NR_mq_getsetattr	(__NR_mq_open+5)
  
-#define NR_syscalls 270
+#define NR_syscalls 283
 
 
 #ifdef __KERNEL__
@@ -307,6 +320,7 @@
 
 #include <linux/compiler.h>
 #include <linux/types.h>
+#include <linux/linkage.h>
 
 /*
  * we need this inline - forking from kernel space will result
diff -Nru a/include/asm-i386/bitops.h b/include/asm-i386/bitops.h
--- a/include/asm-i386/bitops.h	2004-06-02 23:26:59 -07:00
+++ b/include/asm-i386/bitops.h	2004-06-02 23:26:59 -07:00
@@ -290,7 +290,7 @@
 		"shll $3,%%edi\n\t"
 		"addl %%edi,%%edx"
 		:"=d" (res), "=&c" (d0), "=&D" (d1), "=&a" (d2)
-		:"1" ((size + 31) >> 5), "2" (addr), "b" (addr));
+		:"1" ((size + 31) >> 5), "2" (addr), "b" (addr) : "memory");
 	return res;
 }
 
@@ -318,7 +318,7 @@
 		"shll $3,%%edi\n\t"
 		"addl %%edi,%%eax"
 		:"=a" (res), "=&c" (d0), "=&D" (d1)
-		:"1" ((size + 31) >> 5), "2" (addr), "b" (addr));
+		:"1" ((size + 31) >> 5), "2" (addr), "b" (addr) : "memory");
 	return res;
 }
 
diff -Nru a/include/asm-i386/cpu.h b/include/asm-i386/cpu.h
--- a/include/asm-i386/cpu.h	2004-06-02 23:26:59 -07:00
+++ b/include/asm-i386/cpu.h	2004-06-02 23:26:59 -07:00
@@ -18,10 +18,8 @@
 	
 #ifdef CONFIG_NUMA
 	int node = cpu_to_node(num);
-
-	if (!node_online(node))
-		return 0; 
-	parent = &node_devices[node].node;
+	if (node_online(node))
+		parent = &node_devices[node].node;
 #endif /* CONFIG_NUMA */
 
 	return register_cpu(&cpu_devices[num].cpu, num, parent);
diff -Nru a/include/asm-i386/uaccess.h b/include/asm-i386/uaccess.h
--- a/include/asm-i386/uaccess.h	2004-06-02 23:26:58 -07:00
+++ b/include/asm-i386/uaccess.h	2004-06-02 23:26:58 -07:00
@@ -43,7 +43,7 @@
 } ____cacheline_aligned_in_smp movsl_mask;
 #endif
 
-#define __addr_ok(addr) ((unsigned long)(addr) < (current_thread_info()->addr_limit.seg))
+#define __addr_ok(addr) ((unsigned long __force)(addr) < (current_thread_info()->addr_limit.seg))
 
 /*
  * Test whether a block of memory is a valid user space address.
@@ -56,6 +56,7 @@
  */
 #define __range_ok(addr,size) ({ \
 	unsigned long flag,sum; \
+	__chk_user_ptr(addr); \
 	asm("addl %3,%1 ; sbbl %0,%0; cmpl %1,%4; sbbl $0,%0" \
 		:"=&r" (flag), "=r" (sum) \
 		:"1" (addr),"g" ((int)(size)),"g" (current_thread_info()->addr_limit.seg)); \
@@ -170,6 +171,7 @@
  */
 #define get_user(x,ptr)							\
 ({	int __ret_gu,__val_gu;						\
+	__chk_user_ptr(ptr);						\
 	switch(sizeof (*(ptr))) {					\
 	case 1:  __get_user_x(1,__ret_gu,__val_gu,ptr); break;		\
 	case 2:  __get_user_x(2,__ret_gu,__val_gu,ptr); break;		\
@@ -288,6 +290,7 @@
 #define __put_user_size(x,ptr,size,retval,errret)			\
 do {									\
 	retval = 0;							\
+	__chk_user_ptr(ptr);						\
 	switch (size) {							\
 	case 1: __put_user_asm(x,ptr,retval,"b","b","iq",errret);break;	\
 	case 2: __put_user_asm(x,ptr,retval,"w","w","ir",errret);break; \
@@ -346,6 +349,7 @@
 #define __get_user_size(x,ptr,size,retval,errret)			\
 do {									\
 	retval = 0;							\
+	__chk_user_ptr(ptr);						\
 	switch (size) {							\
 	case 1: __get_user_asm(x,ptr,retval,"b","b","=q",errret);break;	\
 	case 2: __get_user_asm(x,ptr,retval,"w","w","=r",errret);break;	\
@@ -403,13 +407,13 @@
 
 		switch (n) {
 		case 1:
-			__put_user_size(*(u8 *)from, (u8 *)to, 1, ret, 1);
+			__put_user_size(*(u8 *)from, (u8 __user *)to, 1, ret, 1);
 			return ret;
 		case 2:
-			__put_user_size(*(u16 *)from, (u16 *)to, 2, ret, 2);
+			__put_user_size(*(u16 *)from, (u16 __user *)to, 2, ret, 2);
 			return ret;
 		case 4:
-			__put_user_size(*(u32 *)from, (u32 *)to, 4, ret, 4);
+			__put_user_size(*(u32 *)from, (u32 __user *)to, 4, ret, 4);
 			return ret;
 		}
 	}
diff -Nru a/include/asm-ppc/pci.h b/include/asm-ppc/pci.h
--- a/include/asm-ppc/pci.h	2004-06-02 23:27:00 -07:00
+++ b/include/asm-ppc/pci.h	2004-06-02 23:27:00 -07:00
@@ -61,6 +61,14 @@
  */
 #define PCI_DMA_BUS_IS_PHYS     (1)
 
+/* pci_unmap_{page,single} is a nop so... */
+#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
+#define DECLARE_PCI_UNMAP_LEN(LEN_NAME)
+#define pci_unmap_addr(PTR, ADDR_NAME)		(0)
+#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL)	do { } while (0)
+#define pci_unmap_len(PTR, LEN_NAME)		(0)
+#define pci_unmap_len_set(PTR, LEN_NAME, VAL)	do { } while (0)
+
 /*
  * At present there are very few 32-bit PPC machines that can have
  * memory above the 4GB point, and we don't support that.
diff -Nru a/include/asm-ppc64/cacheflush.h b/include/asm-ppc64/cacheflush.h
--- a/include/asm-ppc64/cacheflush.h	2004-06-02 23:26:58 -07:00
+++ b/include/asm-ppc64/cacheflush.h	2004-06-02 23:26:58 -07:00
@@ -40,7 +40,7 @@
 
 static inline void flush_icache_range(unsigned long start, unsigned long stop)
 {
-	if (!(cur_cpu_spec->cpu_features & CPU_FTR_COHERENT_ICACHE))
+	if (!(cur_cpu_spec->cpu_features & ASM_CONST(CPU_FTR_COHERENT_ICACHE)))
 		__flush_icache_range(start, stop);
 }
 
diff -Nru a/include/asm-ppc64/eeh.h b/include/asm-ppc64/eeh.h
--- a/include/asm-ppc64/eeh.h	2004-06-02 23:27:00 -07:00
+++ b/include/asm-ppc64/eeh.h	2004-06-02 23:27:00 -07:00
@@ -47,16 +47,16 @@
 void __init pci_addr_cache_build(void);
 
 /**
- * eeh_add_device - perform EEH initialization for the indicated pci device
- * @dev: pci device for which to set up EEH
+ * eeh_add_device_early
+ * eeh_add_device_late
  *
- * This routine can be used to perform EEH initialization for PCI
- * devices that were added after system boot (e.g. hotplug, dlpar).
- * Whether this actually enables EEH or not for this device depends
- * on the type of the device, on earlier boot command-line
- * arguments & etc.
+ * Perform eeh initialization for devices added after boot.
+ * Call eeh_add_device_early before doing any i/o to the
+ * device (including config space i/o).  Call eeh_add_device_late
+ * to finish the eeh setup for this device.
  */
-void eeh_add_device(struct pci_dev *);
+void eeh_add_device_early(struct device_node *);
+void eeh_add_device_late(struct pci_dev *);
 
 /**
  * eeh_remove_device - undo EEH setup for the indicated pci device
diff -Nru a/include/asm-ppc64/iSeries/HvCallSc.h b/include/asm-ppc64/iSeries/HvCallSc.h
--- a/include/asm-ppc64/iSeries/HvCallSc.h	2004-06-02 23:26:58 -07:00
+++ b/include/asm-ppc64/iSeries/HvCallSc.h	2004-06-02 23:26:58 -07:00
@@ -21,14 +21,14 @@
 
 #include <asm/iSeries/HvTypes.h>
 
-#define HvCallBase		0x8000000000000000
-#define HvCallCc		0x8001000000000000
-#define HvCallCfg		0x8002000000000000
-#define HvCallEvent		0x8003000000000000
-#define HvCallHpt		0x8004000000000000
-#define HvCallPci		0x8005000000000000
-#define HvCallSm		0x8007000000000000
-#define HvCallXm		0x8009000000000000
+#define HvCallBase		0x8000000000000000ul
+#define HvCallCc		0x8001000000000000ul
+#define HvCallCfg		0x8002000000000000ul
+#define HvCallEvent		0x8003000000000000ul
+#define HvCallHpt		0x8004000000000000ul
+#define HvCallPci		0x8005000000000000ul
+#define HvCallSm		0x8007000000000000ul
+#define HvCallXm		0x8009000000000000ul
 
 u64 HvCall0( u64 );
 u64 HvCall1( u64, u64 );
diff -Nru a/include/asm-ppc64/mmu_context.h b/include/asm-ppc64/mmu_context.h
--- a/include/asm-ppc64/mmu_context.h	2004-06-02 23:26:59 -07:00
+++ b/include/asm-ppc64/mmu_context.h	2004-06-02 23:26:59 -07:00
@@ -172,8 +172,14 @@
  * After we have set current->mm to a new value, this activates
  * the context for the new mm so we see the new mappings.
  */
-#define activate_mm(active_mm, mm) \
-	switch_mm(active_mm, mm, current);
+static inline void activate_mm(struct mm_struct *prev, struct mm_struct *next)
+{
+	unsigned long flags;
+
+	local_irq_save(flags);
+	switch_mm(prev, next, current);
+	local_irq_restore(flags);
+}
 
 #define VSID_RANDOMIZER 42470972311UL
 #define VSID_MASK	0xfffffffffUL
diff -Nru a/include/asm-ppc64/naca.h b/include/asm-ppc64/naca.h
--- a/include/asm-ppc64/naca.h	2004-06-02 23:26:59 -07:00
+++ b/include/asm-ppc64/naca.h	2004-06-02 23:26:59 -07:00
@@ -30,7 +30,7 @@
 	u64 log;                        /* Ptr to log buffer         0x30 */
 	u64 serialPortAddr;		/* Phy addr of serial port   0x38 */
 	u64 interrupt_controller;	/* Type of int controller    0x40 */ 
-	u64 slb_size;			/* SLB size in entries       0x48 */
+	u64 unused1;			/* was SLB size in entries   0x48 */
 	u64 pftSize;			/* Log 2 of page table size  0x50 */
 	void *systemcfg;		/* Pointer to systemcfg data 0x58 */
 	u32 dCacheL1LogLineSize;	/* L1 d-cache line size Log2 0x60 */
diff -Nru a/include/asm-ppc64/page.h b/include/asm-ppc64/page.h
--- a/include/asm-ppc64/page.h	2004-06-02 23:26:58 -07:00
+++ b/include/asm-ppc64/page.h	2004-06-02 23:26:58 -07:00
@@ -15,7 +15,8 @@
 #ifdef __ASSEMBLY__
   #define ASM_CONST(x) x
 #else
-  #define ASM_CONST(x) x##UL
+  #define __ASM_CONST(x) x##UL
+  #define ASM_CONST(x) __ASM_CONST(x)
 #endif
 
 /* PAGE_SHIFT determines the page size */
diff -Nru a/include/asm-ppc64/pgtable.h b/include/asm-ppc64/pgtable.h
--- a/include/asm-ppc64/pgtable.h	2004-06-02 23:27:00 -07:00
+++ b/include/asm-ppc64/pgtable.h	2004-06-02 23:27:00 -07:00
@@ -47,7 +47,7 @@
 /*
  * Define the address range of the vmalloc VM area.
  */
-#define VMALLOC_START (0xD000000000000000)
+#define VMALLOC_START (0xD000000000000000ul)
 #define VMALLOC_END   (VMALLOC_START + VALID_EA_BITS)
 
 /*
@@ -56,8 +56,8 @@
  */
 #define IMALLOC_START     (ioremap_bot)
 #define IMALLOC_VMADDR(x) ((unsigned long)(x))
-#define PHBS_IO_BASE  	  (0xE000000000000000)	/* Reserve 2 gigs for PHBs */
-#define IMALLOC_BASE      (0xE000000080000000)  
+#define PHBS_IO_BASE  	  (0xE000000000000000ul)	/* Reserve 2 gigs for PHBs */
+#define IMALLOC_BASE      (0xE000000080000000ul)  
 #define IMALLOC_END       (IMALLOC_BASE + VALID_EA_BITS)
 
 /*
diff -Nru a/include/asm-ppc64/processor.h b/include/asm-ppc64/processor.h
--- a/include/asm-ppc64/processor.h	2004-06-02 23:26:58 -07:00
+++ b/include/asm-ppc64/processor.h	2004-06-02 23:26:58 -07:00
@@ -634,4 +634,10 @@
 
 #endif /* ASSEMBLY */
 
+/*
+ * Number of entries in the SLB. If this ever changes we should handle
+ * it with a use a cpu feature fixup.
+ */
+#define SLB_NUM_ENTRIES 64
+
 #endif /* __ASM_PPC64_PROCESSOR_H */
diff -Nru a/include/asm-ppc64/uaccess.h b/include/asm-ppc64/uaccess.h
--- a/include/asm-ppc64/uaccess.h	2004-06-02 23:26:59 -07:00
+++ b/include/asm-ppc64/uaccess.h	2004-06-02 23:26:59 -07:00
@@ -54,7 +54,7 @@
 	(((segment).seg & (addr | size )) == 0)
 
 #define access_ok(type,addr,size) \
-	__access_ok(((unsigned long)(addr)),(size),get_fs())
+	__access_ok(((__force unsigned long)(addr)),(size),get_fs())
 
 static inline int verify_area(int type, const void __user *addr, unsigned long size)
 {
@@ -116,6 +116,7 @@
 #define __put_user_nocheck(x,ptr,size)				\
 ({								\
 	long __pu_err;						\
+	__chk_user_ptr(ptr);					\
 	__put_user_size((x),(ptr),(size),__pu_err,-EFAULT);	\
 	__pu_err;						\
 })
@@ -123,7 +124,7 @@
 #define __put_user_check(x,ptr,size)					\
 ({									\
 	long __pu_err = -EFAULT;					\
-	__typeof__(*(ptr)) *__pu_addr = (ptr);				\
+	void __user *__pu_addr = (ptr);					\
 	if (access_ok(VERIFY_WRITE,__pu_addr,size))			\
 		__put_user_size((x),__pu_addr,(size),__pu_err,-EFAULT);	\
 	__pu_err;							\
@@ -187,6 +188,7 @@
 do {									\
 	might_sleep();							\
 	retval = 0;							\
+	__chk_user_ptr(ptr);						\
 	switch (size) {							\
 	  case 1: __get_user_asm(x,ptr,retval,"lbz",errret); break;	\
 	  case 2: __get_user_asm(x,ptr,retval,"lhz",errret); break;	\
diff -Nru a/include/asm-sparc/hardirq.h b/include/asm-sparc/hardirq.h
--- a/include/asm-sparc/hardirq.h	2004-06-02 23:27:00 -07:00
+++ b/include/asm-sparc/hardirq.h	2004-06-02 23:27:00 -07:00
@@ -57,15 +57,6 @@
 #define HARDIRQ_OFFSET  (1UL << HARDIRQ_SHIFT)
 
 /*
- * The hardirq mask has to be large enough to have
- * space for potentially all IRQ sources in the system
- * nesting on a single CPU:
- */
-#if (1 << HARDIRQ_BITS) < NR_IRQS
-# error HARDIRQ_BITS is too low!
-#endif
-
-/*
  * Are we doing bottom half or hardware interrupt processing?
  * Are we in a softirq context? Interrupt context?
  */
diff -Nru a/include/asm-sparc/ipc.h b/include/asm-sparc/ipc.h
--- a/include/asm-sparc/ipc.h	2004-06-02 23:26:58 -07:00
+++ b/include/asm-sparc/ipc.h	2004-06-02 23:26:58 -07:00
@@ -7,7 +7,7 @@
  * See arch/sparc/kernel/sys_sparc.c for ugly details..
  */
 struct ipc_kludge {
-	struct msgbuf *msgp;
+	struct msgbuf __user *msgp;
 	long msgtyp;
 };
 
diff -Nru a/include/asm-sparc/semaphore.h b/include/asm-sparc/semaphore.h
--- a/include/asm-sparc/semaphore.h	2004-06-02 23:27:00 -07:00
+++ b/include/asm-sparc/semaphore.h	2004-06-02 23:27:00 -07:00
@@ -13,12 +13,12 @@
 	atomic24_t count;
 	int sleepers;
 	wait_queue_head_t wait;
-#if WAITQUEUE_DEBUG
+#ifdef WAITQUEUE_DEBUG
 	long __magic;
 #endif
 };
 
-#if WAITQUEUE_DEBUG
+#ifdef WAITQUEUE_DEBUG
 # define __SEM_DEBUG_INIT(name) \
 		, (long)&(name).__magic
 #else
@@ -43,7 +43,7 @@
 	atomic24_set(&sem->count, val);
 	sem->sleepers = 0;
 	init_waitqueue_head(&sem->wait);
-#if WAITQUEUE_DEBUG
+#ifdef WAITQUEUE_DEBUG
 	sem->__magic = (long)&sem->__magic;
 #endif
 }
@@ -68,7 +68,7 @@
 	register volatile int *ptr asm("g1");
 	register int increment asm("g2");
 
-#if WAITQUEUE_DEBUG
+#ifdef WAITQUEUE_DEBUG
 	CHECK_MAGIC(sem->__magic);
 #endif
 	might_sleep();
@@ -105,7 +105,7 @@
 	register volatile int *ptr asm("g1");
 	register int increment asm("g2");
 
-#if WAITQUEUE_DEBUG
+#ifdef WAITQUEUE_DEBUG
 	CHECK_MAGIC(sem->__magic);
 #endif
 	might_sleep();
@@ -145,7 +145,7 @@
 	register volatile int *ptr asm("g1");
 	register int increment asm("g2");
 
-#if WAITQUEUE_DEBUG
+#ifdef WAITQUEUE_DEBUG
 	CHECK_MAGIC(sem->__magic);
 #endif
 
@@ -184,7 +184,7 @@
 	register volatile int *ptr asm("g1");
 	register int increment asm("g2");
 
-#if WAITQUEUE_DEBUG
+#ifdef WAITQUEUE_DEBUG
 	CHECK_MAGIC(sem->__magic);
 #endif
 
diff -Nru a/include/asm-sparc/signal.h b/include/asm-sparc/signal.h
--- a/include/asm-sparc/signal.h	2004-06-02 23:26:59 -07:00
+++ b/include/asm-sparc/signal.h	2004-06-02 23:26:59 -07:00
@@ -199,7 +199,7 @@
 #ifdef __KERNEL__
 struct k_sigaction {
 	struct __new_sigaction	sa;
-	void			*ka_restorer;
+	void			__user *ka_restorer;
 };
 #endif
 
@@ -211,7 +211,7 @@
 };
 
 typedef struct sigaltstack {
-	void		*ss_sp;
+	void		__user *ss_sp;
 	int		ss_flags;
 	size_t		ss_size;
 } stack_t;
diff -Nru a/include/asm-sparc/thread_info.h b/include/asm-sparc/thread_info.h
--- a/include/asm-sparc/thread_info.h	2004-06-02 23:27:00 -07:00
+++ b/include/asm-sparc/thread_info.h	2004-06-02 23:27:00 -07:00
@@ -17,6 +17,7 @@
 
 #include <asm/btfixup.h>
 #include <asm/ptrace.h>
+#include <asm/page.h>
 
 /*
  * Low level task data.
diff -Nru a/include/asm-sparc/uaccess.h b/include/asm-sparc/uaccess.h
--- a/include/asm-sparc/uaccess.h	2004-06-02 23:27:00 -07:00
+++ b/include/asm-sparc/uaccess.h	2004-06-02 23:27:00 -07:00
@@ -94,10 +94,12 @@
  */
 #define put_user(x,ptr) ({ \
 unsigned long __pu_addr = (unsigned long)(ptr); \
+__chk_user_ptr(ptr); \
 __put_user_check((__typeof__(*(ptr)))(x),__pu_addr,sizeof(*(ptr))); })
 
 #define get_user(x,ptr) ({ \
 unsigned long __gu_addr = (unsigned long)(ptr); \
+__chk_user_ptr(ptr); \
 __get_user_check((x),__gu_addr,sizeof(*(ptr)),__typeof__(*(ptr))); })
 
 /*
@@ -292,32 +294,32 @@
 
 extern int __get_user_bad(void);
 
-extern unsigned long __copy_user(void *to, const void *from, unsigned long size);
+extern unsigned long __copy_user(void __user *to, const void __user *from, unsigned long size);
 
 static inline unsigned long copy_to_user(void __user *to, const void *from, unsigned long n)
 {
 	if (n && __access_ok((unsigned long) to, n))
-		return __copy_user((void *) to, from, n);
+		return __copy_user(to, (void __user *) from, n);
 	else
 		return n;
 }
 
 static inline unsigned long __copy_to_user(void __user *to, const void *from, unsigned long n)
 {
-	return __copy_user((void *)to, from, n);
+	return __copy_user(to, (void __user *) from, n);
 }
 
 static inline unsigned long copy_from_user(void *to, const void __user *from, unsigned long n)
 {
 	if (n && __access_ok((unsigned long) from, n))
-		return __copy_user(to, (void *) from, n);
+		return __copy_user((void __user *) to, from, n);
 	else
 		return n;
 }
 
 static inline unsigned long __copy_from_user(void *to, const void __user *from, unsigned long n)
 {
-	return __copy_user(to, (void *)from, n);
+	return __copy_user((void __user *) to, from, n);
 }
 
 static inline unsigned long __clear_user(void __user *addr, unsigned long size)
diff -Nru a/include/asm-sparc64/chmctrl.h b/include/asm-sparc64/chmctrl.h
--- a/include/asm-sparc64/chmctrl.h	2004-06-02 23:26:59 -07:00
+++ b/include/asm-sparc64/chmctrl.h	2004-06-02 23:26:59 -07:00
@@ -14,171 +14,171 @@
 #define CHMCTRL_MACTRL		0x30 /* Memory Address Control		*/
 
 /* Memory Timing Control I */
-#define TCTRL1_SDRAMCTL_DLY	0xf000000000000000
+#define TCTRL1_SDRAMCTL_DLY	0xf000000000000000UL
 #define TCTRL1_SDRAMCTL_DLY_SHIFT     60
-#define TCTRL1_SDRAMCLK_DLY	0x0e00000000000000
+#define TCTRL1_SDRAMCLK_DLY	0x0e00000000000000UL
 #define TCTRL1_SDRAMCLK_DLY_SHIFT     57
-#define TCTRL1_R		0x0100000000000000
+#define TCTRL1_R		0x0100000000000000UL
 #define TCTRL1_R_SHIFT 		      56
-#define TCTRL1_AUTORFR_CYCLE	0x00fe000000000000
+#define TCTRL1_AUTORFR_CYCLE	0x00fe000000000000UL
 #define TCTRL1_AUTORFR_CYCLE_SHIFT    49
-#define TCTRL1_RD_WAIT		0x0001f00000000000
+#define TCTRL1_RD_WAIT		0x0001f00000000000UL
 #define TCTRL1_RD_WAIT_SHIFT	      44
-#define TCTRL1_PC_CYCLE		0x00000fc000000000
+#define TCTRL1_PC_CYCLE		0x00000fc000000000UL
 #define TCTRL1_PC_CYCLE_SHIFT	      38
-#define TCTRL1_WR_MORE_RAS_PW	0x0000003f00000000
+#define TCTRL1_WR_MORE_RAS_PW	0x0000003f00000000UL
 #define TCTRL1_WR_MORE_RAS_PW_SHIFT   32
-#define TCTRL1_RD_MORE_RAW_PW	0x00000000fc000000
+#define TCTRL1_RD_MORE_RAW_PW	0x00000000fc000000UL
 #define TCTRL1_RD_MORE_RAS_PW_SHIFT   26
-#define TCTRL1_ACT_WR_DLY	0x0000000003f00000
+#define TCTRL1_ACT_WR_DLY	0x0000000003f00000UL
 #define TCTRL1_ACT_WR_DLY_SHIFT	      20
-#define TCTRL1_ACT_RD_DLY	0x00000000000fc000
+#define TCTRL1_ACT_RD_DLY	0x00000000000fc000UL
 #define TCTRL1_ACT_RD_DLY_SHIFT	      14
-#define TCTRL1_BANK_PRESENT	0x0000000000003000
+#define TCTRL1_BANK_PRESENT	0x0000000000003000UL
 #define TCTRL1_BANK_PRESENT_SHIFT     12
-#define TCTRL1_RFR_INT		0x0000000000000ff8
+#define TCTRL1_RFR_INT		0x0000000000000ff8UL
 #define TCTRL1_RFR_INT_SHIFT	      3
-#define TCTRL1_SET_MODE_REG	0x0000000000000004
+#define TCTRL1_SET_MODE_REG	0x0000000000000004UL
 #define TCTRL1_SET_MODE_REG_SHIFT     2
-#define TCTRL1_RFR_ENABLE	0x0000000000000002
+#define TCTRL1_RFR_ENABLE	0x0000000000000002UL
 #define TCTRL1_RFR_ENABLE_SHIFT	      1
-#define TCTRL1_PRECHG_ALL	0x0000000000000001
+#define TCTRL1_PRECHG_ALL	0x0000000000000001UL
 #define TCTRL1_PRECHG_ALL_SHIFT	      0
 
 /* Memory Timing Control II */
-#define TCTRL2_WR_MSEL_DLY	0xfc00000000000000
+#define TCTRL2_WR_MSEL_DLY	0xfc00000000000000UL
 #define TCTRL2_WR_MSEL_DLY_SHIFT      58
-#define TCTRL2_RD_MSEL_DLY	0x03f0000000000000
+#define TCTRL2_RD_MSEL_DLY	0x03f0000000000000UL
 #define TCTRL2_RD_MSEL_DLY_SHIFT      52
-#define TCTRL2_WRDATA_THLD	0x000c000000000000
+#define TCTRL2_WRDATA_THLD	0x000c000000000000UL
 #define TCTRL2_WRDATA_THLD_SHIFT      50
-#define TCTRL2_RDWR_RD_TI_DLY	0x0003f00000000000
+#define TCTRL2_RDWR_RD_TI_DLY	0x0003f00000000000UL
 #define TCTRL2_RDWR_RD_TI_DLY_SHIFT   44
-#define TCTRL2_AUTOPRECHG_ENBL	0x0000080000000000
+#define TCTRL2_AUTOPRECHG_ENBL	0x0000080000000000UL
 #define TCTRL2_AUTOPRECHG_ENBL_SHIFT  43
-#define TCTRL2_RDWR_PI_MORE_DLY	0x000007c000000000
+#define TCTRL2_RDWR_PI_MORE_DLY	0x000007c000000000UL
 #define TCTRL2_RDWR_PI_MORE_DLY_SHIFT 38
-#define TCTRL2_RDWR_1_DLY	0x0000003f00000000
+#define TCTRL2_RDWR_1_DLY	0x0000003f00000000UL
 #define TCTRL2_RDWR_1_DLY_SHIFT       32
-#define TCTRL2_WRWR_PI_MORE_DLY	0x00000000f8000000
+#define TCTRL2_WRWR_PI_MORE_DLY	0x00000000f8000000UL
 #define TCTRL2_WRWR_PI_MORE_DLY_SHIFT 27
-#define TCTRL2_WRWR_1_DLY	0x0000000007e00000
+#define TCTRL2_WRWR_1_DLY	0x0000000007e00000UL
 #define TCTRL2_WRWR_1_DLY_SHIFT       21
-#define TCTRL2_RDWR_RD_PI_MORE_DLY 0x00000000001f0000
+#define TCTRL2_RDWR_RD_PI_MORE_DLY 0x00000000001f0000UL
 #define TCTRL2_RDWR_RD_PI_MORE_DLY_SHIFT 16
-#define TCTRL2_R		0x0000000000008000
+#define TCTRL2_R		0x0000000000008000UL
 #define TCTRL2_R_SHIFT		      15
-#define TCTRL2_SDRAM_MODE_REG_DATA 0x0000000000007fff
+#define TCTRL2_SDRAM_MODE_REG_DATA 0x0000000000007fffUL
 #define TCTRL2_SDRAM_MODE_REG_DATA_SHIFT 0
 
 /* Memory Timing Control III */
-#define TCTRL3_SDRAM_CTL_DLY	0xf000000000000000
+#define TCTRL3_SDRAM_CTL_DLY	0xf000000000000000UL
 #define TCTRL3_SDRAM_CTL_DLY_SHIFT    60
-#define TCTRL3_SDRAM_CLK_DLY	0x0e00000000000000
+#define TCTRL3_SDRAM_CLK_DLY	0x0e00000000000000UL
 #define TCTRL3_SDRAM_CLK_DLY_SHIFT    57
-#define TCTRL3_R		0x0100000000000000
+#define TCTRL3_R		0x0100000000000000UL
 #define TCTRL3_R_SHIFT		      56
-#define TCTRL3_AUTO_RFR_CYCLE	0x00fe000000000000
+#define TCTRL3_AUTO_RFR_CYCLE	0x00fe000000000000UL
 #define TCTRL3_AUTO_RFR_CYCLE_SHIFT   49
-#define TCTRL3_RD_WAIT		0x0001f00000000000
+#define TCTRL3_RD_WAIT		0x0001f00000000000UL
 #define TCTRL3_RD_WAIT_SHIFT	      44
-#define TCTRL3_PC_CYCLE		0x00000fc000000000
+#define TCTRL3_PC_CYCLE		0x00000fc000000000UL
 #define TCTRL3_PC_CYCLE_SHIFT	      38
-#define TCTRL3_WR_MORE_RAW_PW	0x0000003f00000000
+#define TCTRL3_WR_MORE_RAW_PW	0x0000003f00000000UL
 #define TCTRL3_WR_MORE_RAW_PW_SHIFT   32
-#define TCTRL3_RD_MORE_RAW_PW	0x00000000fc000000
+#define TCTRL3_RD_MORE_RAW_PW	0x00000000fc000000UL
 #define TCTRL3_RD_MORE_RAW_PW_SHIFT   26
-#define TCTRL3_ACT_WR_DLY	0x0000000003f00000
+#define TCTRL3_ACT_WR_DLY	0x0000000003f00000UL
 #define TCTRL3_ACT_WR_DLY_SHIFT       20
-#define TCTRL3_ACT_RD_DLY	0x00000000000fc000
+#define TCTRL3_ACT_RD_DLY	0x00000000000fc000UL
 #define TCTRL3_ACT_RD_DLY_SHIFT       14
-#define TCTRL3_BANK_PRESENT	0x0000000000003000
+#define TCTRL3_BANK_PRESENT	0x0000000000003000UL
 #define TCTRL3_BANK_PRESENT_SHIFT     12
-#define TCTRL3_RFR_INT		0x0000000000000ff8
+#define TCTRL3_RFR_INT		0x0000000000000ff8UL
 #define TCTRL3_RFR_INT_SHIFT	      3
-#define TCTRL3_SET_MODE_REG	0x0000000000000004
+#define TCTRL3_SET_MODE_REG	0x0000000000000004UL
 #define TCTRL3_SET_MODE_REG_SHIFT     2
-#define TCTRL3_RFR_ENABLE	0x0000000000000002
+#define TCTRL3_RFR_ENABLE	0x0000000000000002UL
 #define TCTRL3_RFR_ENABLE_SHIFT       1
-#define TCTRL3_PRECHG_ALL	0x0000000000000001
+#define TCTRL3_PRECHG_ALL	0x0000000000000001UL
 #define TCTRL3_PRECHG_ALL_SHIFT	      0
 
 /* Memory Timing Control IV */
-#define TCTRL4_WR_MSEL_DLY	0xfc00000000000000
+#define TCTRL4_WR_MSEL_DLY	0xfc00000000000000UL
 #define TCTRL4_WR_MSEL_DLY_SHIFT      58
-#define TCTRL4_RD_MSEL_DLY	0x03f0000000000000
+#define TCTRL4_RD_MSEL_DLY	0x03f0000000000000UL
 #define TCTRL4_RD_MSEL_DLY_SHIFT      52
-#define TCTRL4_WRDATA_THLD	0x000c000000000000
+#define TCTRL4_WRDATA_THLD	0x000c000000000000UL
 #define TCTRL4_WRDATA_THLD_SHIFT      50
-#define TCTRL4_RDWR_RD_RI_DLY	0x0003f00000000000
+#define TCTRL4_RDWR_RD_RI_DLY	0x0003f00000000000UL
 #define TCTRL4_RDWR_RD_RI_DLY_SHIFT   44
-#define TCTRL4_AUTO_PRECHG_ENBL	0x0000080000000000
+#define TCTRL4_AUTO_PRECHG_ENBL	0x0000080000000000UL
 #define TCTRL4_AUTO_PRECHG_ENBL_SHIFT 43
-#define TCTRL4_RD_WR_PI_MORE_DLY 0x000007c000000000
+#define TCTRL4_RD_WR_PI_MORE_DLY 0x000007c000000000UL
 #define TCTRL4_RD_WR_PI_MORE_DLY_SHIFT 38
-#define TCTRL4_RD_WR_TI_DLY	0x0000003f00000000
+#define TCTRL4_RD_WR_TI_DLY	0x0000003f00000000UL
 #define TCTRL4_RD_WR_TI_DLY_SHIFT     32
-#define TCTRL4_WR_WR_PI_MORE_DLY 0x00000000f8000000
+#define TCTRL4_WR_WR_PI_MORE_DLY 0x00000000f8000000UL
 #define TCTRL4_WR_WR_PI_MORE_DLY_SHIFT 27
-#define TCTRL4_WR_WR_TI_DLY	0x0000000007e00000
+#define TCTRL4_WR_WR_TI_DLY	0x0000000007e00000UL
 #define TCTRL4_WR_WR_TI_DLY_SHIFT     21
-#define TCTRL4_RDWR_RD_PI_MORE_DLY 0x00000000001f0000
+#define TCTRL4_RDWR_RD_PI_MORE_DLY 0x00000000001f000UL0
 #define TCTRL4_RDWR_RD_PI_MORE_DLY_SHIFT 16
-#define TCTRL4_R		0x0000000000008000
+#define TCTRL4_R		0x0000000000008000UL
 #define TCTRL4_R_SHIFT		      15
-#define TCTRL4_SDRAM_MODE_REG_DATA 0x0000000000007fff
+#define TCTRL4_SDRAM_MODE_REG_DATA 0x0000000000007fffUL
 #define TCTRL4_SDRAM_MODE_REG_DATA_SHIFT 0
 
 /* All 4 memory address decoding registers have the
  * same layout.
  */
-#define MEM_DECODE_VALID	0x8000000000000000 /* Valid */
+#define MEM_DECODE_VALID	0x8000000000000000UL /* Valid */
 #define MEM_DECODE_VALID_SHIFT	      63
-#define MEM_DECODE_UK		0x001ffe0000000000 /* Upper mask */
+#define MEM_DECODE_UK		0x001ffe0000000000UL /* Upper mask */
 #define MEM_DECODE_UK_SHIFT	      41
-#define MEM_DECODE_UM		0x0000001ffff00000 /* Upper match */
+#define MEM_DECODE_UM		0x0000001ffff00000UL /* Upper match */
 #define MEM_DECODE_UM_SHIFT	      20
-#define MEM_DECODE_LK		0x000000000003c000 /* Lower mask */
+#define MEM_DECODE_LK		0x000000000003c000UL /* Lower mask */
 #define MEM_DECODE_LK_SHIFT	      14
-#define MEM_DECODE_LM		0x0000000000000f00 /* Lower match */
+#define MEM_DECODE_LM		0x0000000000000f00UL /* Lower match */
 #define MEM_DECODE_LM_SHIFT           8
 
-#define PA_UPPER_BITS		0x000007fffc000000
+#define PA_UPPER_BITS		0x000007fffc000000UL
 #define PA_UPPER_BITS_SHIFT	26
-#define PA_LOWER_BITS		0x00000000000003c0
+#define PA_LOWER_BITS		0x00000000000003c0UL
 #define PA_LOWER_BITS_SHIFT	6
 
-#define MACTRL_R0		         0x8000000000000000
+#define MACTRL_R0		         0x8000000000000000UL
 #define MACTRL_R0_SHIFT		         63
-#define MACTRL_ADDR_LE_PW                0x7000000000000000
+#define MACTRL_ADDR_LE_PW                0x7000000000000000UL
 #define MACTRL_ADDR_LE_PW_SHIFT		 60
-#define MACTRL_CMD_PW                    0x0f00000000000000
+#define MACTRL_CMD_PW                    0x0f00000000000000UL
 #define MACTRL_CMD_PW_SHIFT		 56
-#define MACTRL_HALF_MODE_WR_MSEL_DLY     0x00fc000000000000
+#define MACTRL_HALF_MODE_WR_MSEL_DLY     0x00fc000000000000UL
 #define MACTRL_HALF_MODE_WR_MSEL_DLY_SHIFT 50
-#define MACTRL_HALF_MODE_RD_MSEL_DLY     0x0003f00000000000
+#define MACTRL_HALF_MODE_RD_MSEL_DLY     0x0003f00000000000UL
 #define MACTRL_HALF_MODE_RD_MSEL_DLY_SHIFT 44
-#define MACTRL_HALF_MODE_SDRAM_CTL_DLY   0x00000f0000000000
+#define MACTRL_HALF_MODE_SDRAM_CTL_DLY   0x00000f0000000000UL
 #define MACTRL_HALF_MODE_SDRAM_CTL_DLY_SHIFT 40
-#define MACTRL_HALF_MODE_SDRAM_CLK_DLY   0x000000e000000000
+#define MACTRL_HALF_MODE_SDRAM_CLK_DLY   0x000000e000000000UL
 #define MACTRL_HALF_MODE_SDRAM_CLK_DLY_SHIFT 37
-#define MACTRL_R1                        0x0000001000000000
+#define MACTRL_R1                        0x0000001000000000UL
 #define MACTRL_R1_SHIFT                      36
-#define MACTRL_BANKSEL_N_ROWADDR_SIZE_B3 0x0000000f00000000
+#define MACTRL_BANKSEL_N_ROWADDR_SIZE_B3 0x0000000f00000000UL
 #define MACTRL_BANKSEL_N_ROWADDR_SIZE_B3_SHIFT 32
-#define MACTRL_ENC_INTLV_B3              0x00000000f8000000
+#define MACTRL_ENC_INTLV_B3              0x00000000f8000000UL
 #define MACTRL_ENC_INTLV_B3_SHIFT              27
-#define MACTRL_BANKSEL_N_ROWADDR_SIZE_B2 0x0000000007800000
+#define MACTRL_BANKSEL_N_ROWADDR_SIZE_B2 0x0000000007800000UL
 #define MACTRL_BANKSEL_N_ROWADDR_SIZE_B2_SHIFT 23
-#define MACTRL_ENC_INTLV_B2              0x00000000007c0000
+#define MACTRL_ENC_INTLV_B2              0x00000000007c0000UL
 #define MACTRL_ENC_INTLV_B2_SHIFT              18
-#define MACTRL_BANKSEL_N_ROWADDR_SIZE_B1 0x000000000003c000
+#define MACTRL_BANKSEL_N_ROWADDR_SIZE_B1 0x000000000003c000UL
 #define MACTRL_BANKSEL_N_ROWADDR_SIZE_B1_SHIFT 14
-#define MACTRL_ENC_INTLV_B1              0x0000000000003e00
+#define MACTRL_ENC_INTLV_B1              0x0000000000003e00UL
 #define MACTRL_ENC_INTLV_B1_SHIFT               9
-#define MACTRL_BANKSEL_N_ROWADDR_SIZE_B0 0x00000000000001e0
+#define MACTRL_BANKSEL_N_ROWADDR_SIZE_B0 0x00000000000001e0UL
 #define MACTRL_BANKSEL_N_ROWADDR_SIZE_B0_SHIFT  5
-#define MACTRL_ENC_INTLV_B0              0x000000000000001f
+#define MACTRL_ENC_INTLV_B0              0x000000000000001fUL
 #define MACTRL_ENC_INTLV_B0_SHIFT               0
 
 #endif /* _SPARC64_CHMCTRL_H */
diff -Nru a/include/asm-sparc64/compat.h b/include/asm-sparc64/compat.h
--- a/include/asm-sparc64/compat.h	2004-06-02 23:26:59 -07:00
+++ b/include/asm-sparc64/compat.h	2004-06-02 23:26:59 -07:00
@@ -116,12 +116,12 @@
  */
 typedef	u32		compat_uptr_t;
 
-static inline void *compat_ptr(compat_uptr_t uptr)
+static inline void __user *compat_ptr(compat_uptr_t uptr)
 {
-	return (void *)(unsigned long)uptr;
+	return (void __user *)(unsigned long)uptr;
 }
 
-static __inline__ void *compat_alloc_user_space(long len)
+static __inline__ void __user *compat_alloc_user_space(long len)
 {
 	struct pt_regs *regs = current_thread_info()->kregs;
 	unsigned long usp = regs->u_regs[UREG_I6];
@@ -129,7 +129,7 @@
 	if (!(test_thread_flag(TIF_32BIT)))
 		usp += STACK_BIAS;
 
-	return (void *) (usp - len);
+	return (void __user *) (usp - len);
 }
 
 #endif /* _ASM_SPARC64_COMPAT_H */
diff -Nru a/include/asm-sparc64/const.h b/include/asm-sparc64/const.h
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/include/asm-sparc64/const.h	2004-06-02 23:27:00 -07:00
@@ -0,0 +1,19 @@
+/* const.h: Macros for dealing with constants.  */
+
+#ifndef _SPARC64_CONST_H
+#define _SPARC64_CONST_H
+
+/* Some constant macros are used in both assembler and
+ * C code.  Therefore we cannot annotate them always with
+ * 'UL' and other type specificers unilaterally.  We
+ * use the following macros to deal with this.
+ */
+
+#ifdef __ASSEMBLY__
+#define _AC(X,Y)	X
+#else
+#define _AC(X,Y)	(X##Y)
+#endif
+
+
+#endif /* !(_SPARC64_CONST_H) */
diff -Nru a/include/asm-sparc64/hardirq.h b/include/asm-sparc64/hardirq.h
--- a/include/asm-sparc64/hardirq.h	2004-06-02 23:27:00 -07:00
+++ b/include/asm-sparc64/hardirq.h	2004-06-02 23:27:00 -07:00
@@ -56,15 +56,6 @@
 #define HARDIRQ_OFFSET	(1UL << HARDIRQ_SHIFT)
 
 /*
- * The hardirq mask has to be large enough to have
- * space for potentially all IRQ sources in the system
- * nesting on a single CPU:
- */
-#if (1 << HARDIRQ_BITS) < NR_IRQS
-# error HARDIRQ_BITS is too low!
-#endif
-
-/*
  * Are we doing bottom half or hardware interrupt processing?
  * Are we in a softirq context? Interrupt context?
  */
diff -Nru a/include/asm-sparc64/iommu.h b/include/asm-sparc64/iommu.h
--- a/include/asm-sparc64/iommu.h	2004-06-02 23:26:59 -07:00
+++ b/include/asm-sparc64/iommu.h	2004-06-02 23:26:59 -07:00
@@ -7,13 +7,13 @@
 #define _SPARC64_IOMMU_H
 
 /* The format of an iopte in the page tables. */
-#define IOPTE_VALID         0x8000000000000000 /* IOPTE is valid                   */
-#define IOPTE_64K           0x2000000000000000 /* IOPTE is for 64k page            */
-#define IOPTE_STBUF         0x1000000000000000 /* DVMA can use streaming buffer    */
-#define IOPTE_INTRA         0x0800000000000000 /* SBUS slot-->slot direct transfer */
-#define IOPTE_CONTEXT	    0x07ff800000000000 /* Context number		   */
-#define IOPTE_PAGE          0x00007fffffffe000 /* Physical page number (PA[42:13]) */
-#define IOPTE_CACHE         0x0000000000000010 /* Cached (in UPA E-cache)          */
-#define IOPTE_WRITE         0x0000000000000002 /* Writeable                        */
+#define IOPTE_VALID   0x8000000000000000UL /* IOPTE is valid                  */
+#define IOPTE_64K     0x2000000000000000UL /* IOPTE is for 64k page           */
+#define IOPTE_STBUF   0x1000000000000000UL /* DVMA can use streaming buffer   */
+#define IOPTE_INTRA   0x0800000000000000UL /* SBUS slot-->slot direct transfer*/
+#define IOPTE_CONTEXT 0x07ff800000000000UL /* Context number		      */
+#define IOPTE_PAGE    0x00007fffffffe000UL /* Physical page number (PA[42:13])*/
+#define IOPTE_CACHE   0x0000000000000010UL /* Cached (in UPA E-cache)         */
+#define IOPTE_WRITE   0x0000000000000002UL /* Writeable                       */
 
 #endif /* !(_SPARC_IOMMU_H) */
diff -Nru a/include/asm-sparc64/lsu.h b/include/asm-sparc64/lsu.h
--- a/include/asm-sparc64/lsu.h	2004-06-02 23:26:58 -07:00
+++ b/include/asm-sparc64/lsu.h	2004-06-02 23:26:58 -07:00
@@ -2,17 +2,19 @@
 #ifndef _SPARC64_LSU_H
 #define _SPARC64_LSU_H
 
+#include <asm/const.h>
+
 /* LSU Control Register */
-#define LSU_CONTROL_PM		0x000001fe00000000 /* Phys-watchpoint byte mask     */
-#define LSU_CONTROL_VM		0x00000001fe000000 /* Virt-watchpoint byte mask     */
-#define LSU_CONTROL_PR		0x0000000001000000 /* Phys-read watchpoint enable   */
-#define LSU_CONTROL_PW		0x0000000000800000 /* Phys-write watchpoint enable  */
-#define LSU_CONTROL_VR		0x0000000000400000 /* Virt-read watchpoint enable   */
-#define LSU_CONTROL_VW		0x0000000000200000 /* Virt-write watchpoint enable  */
-#define LSU_CONTROL_FM		0x00000000000ffff0 /* Parity mask enables.          */
-#define LSU_CONTROL_DM		0x0000000000000008 /* Data MMU enable.              */
-#define LSU_CONTROL_IM		0x0000000000000004 /* Instruction MMU enable.       */
-#define LSU_CONTROL_DC		0x0000000000000002 /* Data cache enable.            */
-#define LSU_CONTROL_IC		0x0000000000000001 /* Instruction cache enable.     */
+#define LSU_CONTROL_PM _AC(0x000001fe00000000,UL) /* Phys-watchpoint byte mask*/
+#define LSU_CONTROL_VM _AC(0x00000001fe000000,UL) /* Virt-watchpoint byte mask*/
+#define LSU_CONTROL_PR _AC(0x0000000001000000,UL) /* Phys-rd watchpoint enable*/
+#define LSU_CONTROL_PW _AC(0x0000000000800000,UL) /* Phys-wr watchpoint enable*/
+#define LSU_CONTROL_VR _AC(0x0000000000400000,UL) /* Virt-rd watchpoint enable*/
+#define LSU_CONTROL_VW _AC(0x0000000000200000,UL) /* Virt-wr watchpoint enable*/
+#define LSU_CONTROL_FM _AC(0x00000000000ffff0,UL) /* Parity mask enables.     */
+#define LSU_CONTROL_DM _AC(0x0000000000000008,UL) /* Data MMU enable.         */
+#define LSU_CONTROL_IM _AC(0x0000000000000004,UL) /* Instruction MMU enable.  */
+#define LSU_CONTROL_DC _AC(0x0000000000000002,UL) /* Data cache enable.       */
+#define LSU_CONTROL_IC _AC(0x0000000000000001,UL) /* Instruction cache enable.*/
 
 #endif /* !(_SPARC64_LSU_H) */
diff -Nru a/include/asm-sparc64/page.h b/include/asm-sparc64/page.h
--- a/include/asm-sparc64/page.h	2004-06-02 23:26:59 -07:00
+++ b/include/asm-sparc64/page.h	2004-06-02 23:26:59 -07:00
@@ -4,18 +4,12 @@
 #define _SPARC64_PAGE_H
 
 #include <linux/config.h>
+#include <asm/const.h>
 
 #define PAGE_SHIFT   13
-#ifndef __ASSEMBLY__
-/* I have my suspicions... -DaveM */
-#define PAGE_SIZE    (1UL << PAGE_SHIFT)
-#else
-#define PAGE_SIZE    (1 << PAGE_SHIFT)
-#endif
-
+#define PAGE_SIZE    (_AC(1,UL) << PAGE_SHIFT)
 #define PAGE_MASK    (~(PAGE_SIZE-1))
 
-
 #ifdef __KERNEL__
 
 #ifndef __ASSEMBLY__
@@ -99,13 +93,13 @@
 #endif
 
 #ifdef CONFIG_HUGETLB_PAGE
-#define HPAGE_SIZE		((1UL) << HPAGE_SHIFT)
+#define HPAGE_SIZE		(_AC(1,UL) << HPAGE_SHIFT)
 #define HPAGE_MASK		(~(HPAGE_SIZE - 1UL))
 #define HUGETLB_PAGE_ORDER	(HPAGE_SHIFT - PAGE_SHIFT)
 #endif
 
 #define TASK_UNMAPPED_BASE	(test_thread_flag(TIF_32BIT) ? \
-				 (0x0000000070000000UL) : (PAGE_OFFSET))
+				 (_AC(0x0000000070000000,UL)) : (PAGE_OFFSET))
 
 #endif /* !(__ASSEMBLY__) */
 
@@ -115,7 +109,7 @@
 /* We used to stick this into a hard-coded global register (%g4)
  * but that does not make sense anymore.
  */
-#define PAGE_OFFSET		0xFFFFF80000000000
+#define PAGE_OFFSET		_AC(0xFFFFF80000000000,UL)
 
 #define __pa(x)			((unsigned long)(x) - PAGE_OFFSET)
 #define __va(x)			((void *)((unsigned long) (x) + PAGE_OFFSET))
diff -Nru a/include/asm-sparc64/pci.h b/include/asm-sparc64/pci.h
--- a/include/asm-sparc64/pci.h	2004-06-02 23:26:58 -07:00
+++ b/include/asm-sparc64/pci.h	2004-06-02 23:26:58 -07:00
@@ -168,7 +168,7 @@
  * can drive enough of the 64 bits.
  */
 #define PCI64_REQUIRED_MASK	(~(dma64_addr_t)0)
-#define PCI64_ADDR_BASE		0xfffc000000000000
+#define PCI64_ADDR_BASE		0xfffc000000000000UL
 
 /* Usage of the pci_dac_foo interfaces is only valid if this
  * test passes.
diff -Nru a/include/asm-sparc64/pgtable.h b/include/asm-sparc64/pgtable.h
--- a/include/asm-sparc64/pgtable.h	2004-06-02 23:26:58 -07:00
+++ b/include/asm-sparc64/pgtable.h	2004-06-02 23:26:58 -07:00
@@ -18,6 +18,7 @@
 #include <asm/system.h>
 #include <asm/page.h>
 #include <asm/processor.h>
+#include <asm/const.h>
 
 /* The kernel image occupies 0x4000000 to 0x1000000 (4MB --> 16MB).
  * The page copy blockops use 0x1000000 to 0x18000000 (16MB --> 24MB).
@@ -26,14 +27,14 @@
  * There is a single static kernel PMD which maps from 0x0 to address
  * 0x400000000.
  */
-#define	TLBTEMP_BASE		0x0000000001000000
-#define MODULES_VADDR		0x0000000002000000
-#define MODULES_LEN		0x000000007e000000
-#define MODULES_END		0x0000000080000000
-#define VMALLOC_START		0x0000000140000000
-#define VMALLOC_END		0x0000000200000000
-#define LOW_OBP_ADDRESS		0x00000000f0000000
-#define HI_OBP_ADDRESS		0x0000000100000000
+#define	TLBTEMP_BASE		_AC(0x0000000001000000,UL)
+#define MODULES_VADDR		_AC(0x0000000002000000,UL)
+#define MODULES_LEN		_AC(0x000000007e000000,UL)
+#define MODULES_END		_AC(0x0000000080000000,UL)
+#define VMALLOC_START		_AC(0x0000000140000000,UL)
+#define VMALLOC_END		_AC(0x0000000200000000,UL)
+#define LOW_OBP_ADDRESS		_AC(0x00000000f0000000,UL)
+#define HI_OBP_ADDRESS		_AC(0x0000000100000000,UL)
 
 /* XXX All of this needs to be rethought so we can take advantage
  * XXX cheetah's full 64-bit virtual address space, ie. no more hole
@@ -49,7 +50,9 @@
  * long). Finally, the higher few bits determine pgde#.
  */
 
-/* PMD_SHIFT determines the size of the area a second-level page table can map */
+/* PMD_SHIFT determines the size of the area a second-level page
+ * table can map
+ */
 #define PMD_SHIFT	(PAGE_SHIFT + (PAGE_SHIFT-3))
 #define PMD_SIZE	(1UL << PMD_SHIFT)
 #define PMD_MASK	(~(PMD_SIZE-1))
@@ -78,7 +81,8 @@
  */
 #define REAL_PTRS_PER_PMD	(1UL << PMD_BITS)
 #define PTRS_PER_PMD		((const int)(test_thread_flag(TIF_32BIT) ? \
-				 (1UL << (32 - (PAGE_SHIFT-3) - PAGE_SHIFT)) : (REAL_PTRS_PER_PMD)))
+				 (1UL << (32 - (PAGE_SHIFT-3) - PAGE_SHIFT)) : \
+				 (REAL_PTRS_PER_PMD)))
 
 /*
  * We cannot use the top address range because VPTE table lives there. This
@@ -86,9 +90,9 @@
  * vpte size, then aligns it to the number of bytes mapped by one pgde, and
  * thus calculates the number of pgdes needed.
  */
-#define PTRS_PER_PGD	(((1UL << VA_BITS) - VPTE_SIZE + (1UL << (PAGE_SHIFT + \
-			(PAGE_SHIFT-3) + PMD_BITS)) - 1) / (1UL << (PAGE_SHIFT + \
-			(PAGE_SHIFT-3) + PMD_BITS)))
+#define PTRS_PER_PGD (((1UL << VA_BITS) - VPTE_SIZE + (1UL << (PAGE_SHIFT + \
+		      (PAGE_SHIFT-3) + PMD_BITS)) - 1) / (1UL << (PAGE_SHIFT + \
+		      (PAGE_SHIFT-3) + PMD_BITS)))
 
 /* Kernel has a separate 44bit address space. */
 #define USER_PTRS_PER_PGD	((const int)(test_thread_flag(TIF_32BIT)) ? \
@@ -102,33 +106,33 @@
 #endif /* !(__ASSEMBLY__) */
 
 /* Spitfire/Cheetah TTE bits. */
-#define _PAGE_VALID	0x8000000000000000	/* Valid TTE                          */
-#define _PAGE_R		0x8000000000000000	/* Used to keep ref bit up to date    */
-#define _PAGE_SZ4MB	0x6000000000000000	/* 4MB Page                           */
-#define _PAGE_SZ512K	0x4000000000000000	/* 512K Page                          */
-#define _PAGE_SZ64K	0x2000000000000000	/* 64K Page                           */
-#define _PAGE_SZ8K	0x0000000000000000	/* 8K Page                            */
-#define _PAGE_NFO	0x1000000000000000	/* No Fault Only                      */
-#define _PAGE_IE	0x0800000000000000	/* Invert Endianness                  */
-#define _PAGE_SN	0x0000800000000000	/* (Cheetah) Snoop                    */
-#define _PAGE_PADDR_SF	0x000001FFFFFFE000	/* (Spitfire) Phys Address [40:13]    */
-#define _PAGE_PADDR	0x000007FFFFFFE000	/* (Cheetah) Phys Address [42:13]     */
-#define _PAGE_SOFT	0x0000000000001F80	/* Software bits                      */
-#define _PAGE_L		0x0000000000000040	/* Locked TTE                         */
-#define _PAGE_CP	0x0000000000000020	/* Cacheable in Physical Cache        */
-#define _PAGE_CV	0x0000000000000010	/* Cacheable in Virtual Cache         */
-#define _PAGE_E		0x0000000000000008	/* side-Effect                        */
-#define _PAGE_P		0x0000000000000004	/* Privileged Page                    */
-#define _PAGE_W		0x0000000000000002	/* Writable                           */
-#define _PAGE_G		0x0000000000000001	/* Global                             */
+#define _PAGE_VALID	_AC(0x8000000000000000,UL) /* Valid TTE               */
+#define _PAGE_R		_AC(0x8000000000000000,UL) /* Keep ref bit up to date */
+#define _PAGE_SZ4MB	_AC(0x6000000000000000,UL) /* 4MB Page                */
+#define _PAGE_SZ512K	_AC(0x4000000000000000,UL) /* 512K Page               */
+#define _PAGE_SZ64K	_AC(0x2000000000000000,UL) /* 64K Page                */
+#define _PAGE_SZ8K	_AC(0x0000000000000000,UL) /* 8K Page                 */
+#define _PAGE_NFO	_AC(0x1000000000000000,UL) /* No Fault Only           */
+#define _PAGE_IE	_AC(0x0800000000000000,UL) /* Invert Endianness       */
+#define _PAGE_SN	_AC(0x0000800000000000,UL) /* (Cheetah) Snoop         */
+#define _PAGE_PADDR_SF	_AC(0x000001FFFFFFE000,UL) /* (Spitfire) paddr [40:13]*/
+#define _PAGE_PADDR	_AC(0x000007FFFFFFE000,UL) /* (Cheetah) paddr [42:13] */
+#define _PAGE_SOFT	_AC(0x0000000000001F80,UL) /* Software bits           */
+#define _PAGE_L		_AC(0x0000000000000040,UL) /* Locked TTE              */
+#define _PAGE_CP	_AC(0x0000000000000020,UL) /* Cacheable in P-Cache    */
+#define _PAGE_CV	_AC(0x0000000000000010,UL) /* Cacheable in V-Cache    */
+#define _PAGE_E		_AC(0x0000000000000008,UL) /* side-Effect             */
+#define _PAGE_P		_AC(0x0000000000000004,UL) /* Privileged Page         */
+#define _PAGE_W		_AC(0x0000000000000002,UL) /* Writable                */
+#define _PAGE_G		_AC(0x0000000000000001,UL) /* Global                  */
 
 /* Here are the SpitFire software bits we use in the TTE's. */
-#define _PAGE_FILE	0x0000000000001000	/* Pagecache page                     */
-#define _PAGE_MODIFIED	0x0000000000000800	/* Modified Page (ie. dirty)          */
-#define _PAGE_ACCESSED	0x0000000000000400	/* Accessed Page (ie. referenced)     */
-#define _PAGE_READ	0x0000000000000200	/* Readable SW Bit                    */
-#define _PAGE_WRITE	0x0000000000000100	/* Writable SW Bit                    */
-#define _PAGE_PRESENT	0x0000000000000080	/* Present Page (ie. not swapped out) */
+#define _PAGE_FILE	_AC(0x0000000000001000,UL)	/* Pagecache page     */
+#define _PAGE_MODIFIED	_AC(0x0000000000000800,UL)	/* Modified (dirty)   */
+#define _PAGE_ACCESSED	_AC(0x0000000000000400,UL)	/* Accessed (ref'd)   */
+#define _PAGE_READ	_AC(0x0000000000000200,UL)	/* Readable SW Bit    */
+#define _PAGE_WRITE	_AC(0x0000000000000100,UL)	/* Writable SW Bit    */
+#define _PAGE_PRESENT	_AC(0x0000000000000080,UL)	/* Present            */
 
 #if PAGE_SHIFT == 13
 #define _PAGE_SZBITS	_PAGE_SZ8K
@@ -173,7 +177,8 @@
 
 #define _PFN_MASK	_PAGE_PADDR
 
-#define pg_iobits (_PAGE_VALID | _PAGE_PRESENT | __DIRTY_BITS | __ACCESS_BITS | _PAGE_E)
+#define pg_iobits (_PAGE_VALID | _PAGE_PRESENT | __DIRTY_BITS | \
+		   __ACCESS_BITS | _PAGE_E)
 
 #define __P000	PAGE_NONE
 #define __P001	PAGE_READONLY
@@ -260,9 +265,12 @@
 #define pte_dirty(pte)		(pte_val(pte) & _PAGE_MODIFIED)
 #define pte_young(pte)		(pte_val(pte) & _PAGE_ACCESSED)
 #define pte_wrprotect(pte)	(__pte(pte_val(pte) & ~(_PAGE_WRITE|_PAGE_W)))
-#define pte_rdprotect(pte)	(__pte(((pte_val(pte)<<1UL)>>1UL) & ~_PAGE_READ))
-#define pte_mkclean(pte)	(__pte(pte_val(pte) & ~(_PAGE_MODIFIED|_PAGE_W)))
-#define pte_mkold(pte)		(__pte(((pte_val(pte)<<1UL)>>1UL) & ~_PAGE_ACCESSED))
+#define pte_rdprotect(pte)	\
+	(__pte(((pte_val(pte)<<1UL)>>1UL) & ~_PAGE_READ))
+#define pte_mkclean(pte)	\
+	(__pte(pte_val(pte) & ~(_PAGE_MODIFIED|_PAGE_W)))
+#define pte_mkold(pte)		\
+	(__pte(((pte_val(pte)<<1UL)>>1UL) & ~_PAGE_ACCESSED))
 
 /* Permanent address of a page. */
 #define __page_address(page)	page_address(page)
@@ -280,12 +288,14 @@
 #define pgd_offset_k(address) pgd_offset(&init_mm, address)
 
 /* Find an entry in the second-level page table.. */
-#define pmd_offset(dir, address)	((pmd_t *) pgd_page(*(dir)) + \
-					((address >> PMD_SHIFT) & (REAL_PTRS_PER_PMD-1)))
+#define pmd_offset(dir, address)	\
+	((pmd_t *) pgd_page(*(dir)) + \
+	 ((address >> PMD_SHIFT) & (REAL_PTRS_PER_PMD-1)))
 
 /* Find an entry in the third-level page table.. */
-#define pte_index(dir, address)	((pte_t *) __pmd_page(*(dir)) + \
-					((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)))
+#define pte_index(dir, address)	\
+	((pte_t *) __pmd_page(*(dir)) + \
+	 ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)))
 #define pte_offset_kernel		pte_index
 #define pte_offset_map			pte_index
 #define pte_offset_map_nested		pte_index
@@ -305,7 +315,8 @@
 static inline pte_t mk_pte_io(unsigned long page, pgprot_t prot, int space)
 {
 	pte_t pte;
-	pte_val(pte) = ((page) | pgprot_val(prot) | _PAGE_E) & ~(unsigned long)_PAGE_CACHE;
+	pte_val(pte) = (((page) | pgprot_val(prot) | _PAGE_E) &
+			~(unsigned long)_PAGE_CACHE);
 	pte_val(pte) |= (((unsigned long)space) << 32);
 	return pte;
 }
@@ -365,7 +376,8 @@
 #define kern_addr_valid(addr)	\
 	(test_bit(__pa((unsigned long)(addr))>>22, sparc64_valid_addr_bitmap))
 
-extern int io_remap_page_range(struct vm_area_struct *vma, unsigned long from, unsigned long offset,
+extern int io_remap_page_range(struct vm_area_struct *vma, unsigned long from,
+			       unsigned long offset,
 			       unsigned long size, pgprot_t prot, int space);
 
 #include <asm-generic/pgtable.h>
@@ -376,7 +388,9 @@
 /* We provide a special get_unmapped_area for framebuffer mmaps to try and use
  * the largest alignment possible such that larget PTEs can be used.
  */
-extern unsigned long get_fb_unmapped_area(struct file *filp, unsigned long, unsigned long, unsigned long, unsigned long);
+extern unsigned long get_fb_unmapped_area(struct file *filp, unsigned long,
+					  unsigned long, unsigned long,
+					  unsigned long);
 #define HAVE_ARCH_FB_UNMAPPED_AREA
 
 /*
diff -Nru a/include/asm-sparc64/pstate.h b/include/asm-sparc64/pstate.h
--- a/include/asm-sparc64/pstate.h	2004-06-02 23:27:00 -07:00
+++ b/include/asm-sparc64/pstate.h	2004-06-02 23:27:00 -07:00
@@ -2,6 +2,8 @@
 #ifndef _SPARC64_PSTATE_H
 #define _SPARC64_PSTATE_H
 
+#include <asm/const.h>
+
 /* The V9 PSTATE Register (with SpitFire extensions).
  *
  * -----------------------------------------------------------------------
@@ -9,20 +11,20 @@
  * -----------------------------------------------------------------------
  *  63  12  11   10    9     8    7   6   5     4     3     2     1    0
  */
-#define PSTATE_IG	0x0000000000000800	/* Interrupt Globals.		*/
-#define PSTATE_MG	0x0000000000000400	/* MMU Globals.			*/
-#define PSTATE_CLE	0x0000000000000200	/* Current Little Endian.	*/
-#define PSTATE_TLE	0x0000000000000100	/* Trap Little Endian.		*/
-#define PSTATE_MM	0x00000000000000c0	/* Memory Model.		*/
-#define PSTATE_TSO	0x0000000000000000	/* MM: Total Store Order	*/
-#define PSTATE_PSO	0x0000000000000040	/* MM: Partial Store Order	*/
-#define PSTATE_RMO	0x0000000000000080	/* MM: Relaxed Memory Order	*/
-#define PSTATE_RED	0x0000000000000020	/* Reset Error Debug State.	*/
-#define PSTATE_PEF	0x0000000000000010	/* Floating Point Enable.	*/
-#define PSTATE_AM	0x0000000000000008	/* Address Mask.		*/
-#define PSTATE_PRIV	0x0000000000000004	/* Privilege.			*/
-#define PSTATE_IE	0x0000000000000002	/* Interrupt Enable.		*/
-#define PSTATE_AG	0x0000000000000001	/* Alternate Globals.		*/
+#define PSTATE_IG   _AC(0x0000000000000800,UL) /* Interrupt Globals.	*/
+#define PSTATE_MG   _AC(0x0000000000000400,UL) /* MMU Globals.		*/
+#define PSTATE_CLE  _AC(0x0000000000000200,UL) /* Current Little Endian.*/
+#define PSTATE_TLE  _AC(0x0000000000000100,UL) /* Trap Little Endian.	*/
+#define PSTATE_MM   _AC(0x00000000000000c0,UL) /* Memory Model.		*/
+#define PSTATE_TSO  _AC(0x0000000000000000,UL) /* MM: TotalStoreOrder	*/
+#define PSTATE_PSO  _AC(0x0000000000000040,UL) /* MM: PartialStoreOrder	*/
+#define PSTATE_RMO  _AC(0x0000000000000080,UL) /* MM: RelaxedMemoryOrder*/
+#define PSTATE_RED  _AC(0x0000000000000020,UL) /* Reset Error Debug.	*/
+#define PSTATE_PEF  _AC(0x0000000000000010,UL) /* Floating Point Enable.*/
+#define PSTATE_AM   _AC(0x0000000000000008,UL) /* Address Mask.		*/
+#define PSTATE_PRIV _AC(0x0000000000000004,UL) /* Privilege.		*/
+#define PSTATE_IE   _AC(0x0000000000000002,UL) /* Interrupt Enable.	*/
+#define PSTATE_AG   _AC(0x0000000000000001,UL) /* Alternate Globals.	*/
 
 /* The V9 TSTATE Register (with SpitFire and Linux extensions).
  *
@@ -31,35 +33,35 @@
  * ---------------------------------------------------------------
  *  63    40 39   32 31   24 23    20 19       8 7      5 4     0
  */
-#define TSTATE_CCR	0x000000ff00000000	/* Condition Codes.		*/
-#define TSTATE_XCC	0x000000f000000000	/* Condition Codes.		*/
-#define TSTATE_XNEG	0x0000008000000000	/* %xcc Negative.		*/
-#define TSTATE_XZERO	0x0000004000000000	/* %xcc Zero.			*/
-#define TSTATE_XOVFL	0x0000002000000000	/* %xcc Overflow.		*/
-#define TSTATE_XCARRY	0x0000001000000000	/* %xcc Carry.			*/
-#define TSTATE_ICC	0x0000000f00000000	/* Condition Codes.		*/
-#define TSTATE_INEG	0x0000000800000000	/* %icc Negative.		*/
-#define TSTATE_IZERO	0x0000000400000000	/* %icc Zero.			*/
-#define TSTATE_IOVFL	0x0000000200000000	/* %icc Overflow.		*/
-#define TSTATE_ICARRY	0x0000000100000000	/* %icc Carry.			*/
-#define TSTATE_ASI	0x00000000ff000000	/* Address Space Identifier.	*/
-#define TSTATE_PIL	0x0000000000f00000	/* %pil (Linux traps set this)  */
-#define TSTATE_PSTATE	0x00000000000fff00	/* PSTATE.			*/
-#define TSTATE_IG	0x0000000000080000	/* Interrupt Globals.		*/
-#define TSTATE_MG	0x0000000000040000	/* MMU Globals.			*/
-#define TSTATE_CLE	0x0000000000020000	/* Current Little Endian.	*/
-#define TSTATE_TLE	0x0000000000010000	/* Trap Little Endian.		*/
-#define TSTATE_MM	0x000000000000c000	/* Memory Model.		*/
-#define TSTATE_TSO	0x0000000000000000	/* MM: Total Store Order	*/
-#define TSTATE_PSO	0x0000000000004000	/* MM: Partial Store Order	*/
-#define TSTATE_RMO	0x0000000000008000	/* MM: Relaxed Memory Order	*/
-#define TSTATE_RED	0x0000000000002000	/* Reset Error Debug State.	*/
-#define TSTATE_PEF	0x0000000000001000	/* Floating Point Enable.	*/
-#define TSTATE_AM	0x0000000000000800	/* Address Mask.		*/
-#define TSTATE_PRIV	0x0000000000000400	/* Privilege.			*/
-#define TSTATE_IE	0x0000000000000200	/* Interrupt Enable.		*/
-#define TSTATE_AG	0x0000000000000100	/* Alternate Globals.		*/
-#define TSTATE_CWP	0x000000000000001f	/* Current Window Pointer.	*/
+#define TSTATE_CCR	_AC(0x000000ff00000000,UL) /* Condition Codes.	*/
+#define TSTATE_XCC	_AC(0x000000f000000000,UL) /* Condition Codes.	*/
+#define TSTATE_XNEG	_AC(0x0000008000000000,UL) /* %xcc Negative.	*/
+#define TSTATE_XZERO	_AC(0x0000004000000000,UL) /* %xcc Zero.	*/
+#define TSTATE_XOVFL	_AC(0x0000002000000000,UL) /* %xcc Overflow.	*/
+#define TSTATE_XCARRY	_AC(0x0000001000000000,UL) /* %xcc Carry.	*/
+#define TSTATE_ICC	_AC(0x0000000f00000000,UL) /* Condition Codes.	*/
+#define TSTATE_INEG	_AC(0x0000000800000000,UL) /* %icc Negative.	*/
+#define TSTATE_IZERO	_AC(0x0000000400000000,UL) /* %icc Zero.	*/
+#define TSTATE_IOVFL	_AC(0x0000000200000000,UL) /* %icc Overflow.	*/
+#define TSTATE_ICARRY	_AC(0x0000000100000000,UL) /* %icc Carry.	*/
+#define TSTATE_ASI	_AC(0x00000000ff000000,UL) /* AddrSpace ID.	*/
+#define TSTATE_PIL	_AC(0x0000000000f00000,UL) /* %pil (Linux traps)*/
+#define TSTATE_PSTATE	_AC(0x00000000000fff00,UL) /* PSTATE.		*/
+#define TSTATE_IG	_AC(0x0000000000080000,UL) /* Interrupt Globals.*/
+#define TSTATE_MG	_AC(0x0000000000040000,UL) /* MMU Globals.	*/
+#define TSTATE_CLE	_AC(0x0000000000020000,UL) /* CurrLittleEndian.	*/
+#define TSTATE_TLE	_AC(0x0000000000010000,UL) /* TrapLittleEndian.	*/
+#define TSTATE_MM	_AC(0x000000000000c000,UL) /* Memory Model.	*/
+#define TSTATE_TSO	_AC(0x0000000000000000,UL) /* MM: TSO		*/
+#define TSTATE_PSO	_AC(0x0000000000004000,UL) /* MM: PSO		*/
+#define TSTATE_RMO	_AC(0x0000000000008000,UL) /* MM: RMO		*/
+#define TSTATE_RED	_AC(0x0000000000002000,UL) /* Reset Error Debug.*/
+#define TSTATE_PEF	_AC(0x0000000000001000,UL) /* FPU Enable.	*/
+#define TSTATE_AM	_AC(0x0000000000000800,UL) /* Address Mask.	*/
+#define TSTATE_PRIV	_AC(0x0000000000000400,UL) /* Privilege.	*/
+#define TSTATE_IE	_AC(0x0000000000000200,UL) /* Interrupt Enable.	*/
+#define TSTATE_AG	_AC(0x0000000000000100,UL) /* Alternate Globals.*/
+#define TSTATE_CWP	_AC(0x000000000000001f,UL) /* Curr Win-Pointer.	*/
 
 /* Floating-Point Registers State Register.
  *
@@ -68,9 +70,9 @@
  * --------------------------------
  *  63     3    2       1      0
  */
-#define FPRS_FEF	0x0000000000000004	/* Enable Floating Point.	*/
-#define FPRS_DU		0x0000000000000002	/* Dirty Upper.			*/
-#define FPRS_DL		0x0000000000000001	/* Dirty Lower.			*/
+#define FPRS_FEF	_AC(0x0000000000000004,UL) /* FPU Enable.	*/
+#define FPRS_DU		_AC(0x0000000000000002,UL) /* Dirty Upper.	*/
+#define FPRS_DL		_AC(0x0000000000000001,UL) /* Dirty Lower.	*/
 
 /* Version Register.
  *
@@ -79,10 +81,10 @@
  * ------------------------------------------------------
  *  63   48 47  32 31  24 23  16 15    8 7    5 4      0
  */
-#define VERS_MANUF	0xffff000000000000	/* Manufacturer.		*/
-#define VERS_IMPL	0x0000ffff00000000	/* Implementation.		*/
-#define VERS_MASK	0x00000000ff000000	/* Mask Set Revision.		*/
-#define VERS_MAXTL	0x000000000000ff00	/* Maximum Trap Level.		*/
-#define VERS_MAXWIN	0x000000000000001f	/* Maximum Reg Window Index.	*/
+#define VERS_MANUF	_AC(0xffff000000000000,UL) /* Manufacturer.	*/
+#define VERS_IMPL	_AC(0x0000ffff00000000,UL) /* Implementation.	*/
+#define VERS_MASK	_AC(0x00000000ff000000,UL) /* Mask Set Revision.*/
+#define VERS_MAXTL	_AC(0x000000000000ff00,UL) /* Max Trap Level.	*/
+#define VERS_MAXWIN	_AC(0x000000000000001f,UL) /* Max RegWindow Idx.*/
 
 #endif /* !(_SPARC64_PSTATE_H) */
diff -Nru a/include/asm-sparc64/siginfo.h b/include/asm-sparc64/siginfo.h
--- a/include/asm-sparc64/siginfo.h	2004-06-02 23:27:00 -07:00
+++ b/include/asm-sparc64/siginfo.h	2004-06-02 23:27:00 -07:00
@@ -99,7 +99,7 @@
 	} _sigev_un;
 } sigevent_t32;
 
-extern int copy_siginfo_to_user32(siginfo_t32 *to, siginfo_t *from);
+extern int copy_siginfo_to_user32(siginfo_t32 __user *to, siginfo_t *from);
 
 #endif /* __KERNEL__ */
 
diff -Nru a/include/asm-sparc64/signal.h b/include/asm-sparc64/signal.h
--- a/include/asm-sparc64/signal.h	2004-06-02 23:26:59 -07:00
+++ b/include/asm-sparc64/signal.h	2004-06-02 23:26:59 -07:00
@@ -212,7 +212,7 @@
 
 struct k_sigaction {
 	struct __new_sigaction 	sa;
-	void			*ka_restorer;
+	void __user		*ka_restorer;
 };
 #endif
 
diff -Nru a/include/asm-sparc64/thread_info.h b/include/asm-sparc64/thread_info.h
--- a/include/asm-sparc64/thread_info.h	2004-06-02 23:27:00 -07:00
+++ b/include/asm-sparc64/thread_info.h	2004-06-02 23:27:00 -07:00
@@ -56,7 +56,8 @@
 	unsigned long		gsr[7];
 	unsigned long		xfsr[7];
 
-	__u64			*user_cntd0, *user_cntd1;
+	__u64			__user *user_cntd0;
+	__u64			__user *user_cntd1;
 	__u64			kernel_cntd0, kernel_cntd1;
 	__u64			pcr_reg;
 
diff -Nru a/include/asm-sparc64/uaccess.h b/include/asm-sparc64/uaccess.h
--- a/include/asm-sparc64/uaccess.h	2004-06-02 23:26:59 -07:00
+++ b/include/asm-sparc64/uaccess.h	2004-06-02 23:26:59 -07:00
@@ -101,10 +101,12 @@
  */
 #define put_user(x,ptr) ({ \
 unsigned long __pu_addr = (unsigned long)(ptr); \
+__chk_user_ptr(ptr); \
 __put_user_nocheck((__typeof__(*(ptr)))(x),__pu_addr,sizeof(*(ptr))); })
 
 #define get_user(x,ptr) ({ \
 unsigned long __gu_addr = (unsigned long)(ptr); \
+__chk_user_ptr(ptr); \
 __get_user_nocheck((x),__gu_addr,sizeof(*(ptr)),__typeof__(*(ptr))); })
 
 #define __put_user(x,ptr) put_user(x,ptr)
@@ -163,7 +165,7 @@
 	".previous\n\n\t"						\
        : "=r" (foo) : "r" (x), "r" (__m(addr)));			\
 else									\
-__asm__ __volatile(							\
+__asm__ __volatile__(							\
 	"/* Put user asm ret, inline. */\n"				\
 "1:\t"	"st"#size "a %1, [%2] %%asi\n\n\t"				\
 	".section .fixup,#alloc,#execinstr\n\t"				\
@@ -263,12 +265,12 @@
 #define copy_to_user __copy_to_user
 #define copy_in_user __copy_in_user
 
-extern unsigned long __bzero_noasi(void *, unsigned long);
+extern unsigned long __bzero_noasi(void __user *, unsigned long);
 
 static inline unsigned long __clear_user(void __user *addr, unsigned long size)
 {
 	
-	return __bzero_noasi((void *) addr, size);
+	return __bzero_noasi(addr, size);
 }
 
 #define clear_user __clear_user
diff -Nru a/include/asm-x86_64/bitops.h b/include/asm-x86_64/bitops.h
--- a/include/asm-x86_64/bitops.h	2004-06-02 23:26:59 -07:00
+++ b/include/asm-x86_64/bitops.h	2004-06-02 23:26:59 -07:00
@@ -337,15 +337,14 @@
 		"repe; scasl\n\t"
 		"jz 1f\n\t"
 		"leaq -4(%%rdi),%%rdi\n\t"
-		"bsfq (%%rdi),%%rax\n"
-		"1:\tsubl %%ebx,%%edi\n\t"
+		"bsfl (%%rdi),%%eax\n"
+		"1:\tsubq %%rbx,%%rdi\n\t"
 		"shll $3,%%edi\n\t"
 		"addl %%edi,%%eax"
 		:"=a" (res), "=&c" (d0), "=&D" (d1)
-		:"1" ((size + 31) >> 5), "2" (addr), "b" (addr));
+		:"1" ((size + 31) >> 5), "2" (addr), "b" (addr) : "memory");
 	return res;
 }
-
 
 /**
  * find_next_bit - find the first set bit in a memory region
diff -Nru a/include/asm-x86_64/checksum.h b/include/asm-x86_64/checksum.h
--- a/include/asm-x86_64/checksum.h	2004-06-02 23:27:00 -07:00
+++ b/include/asm-x86_64/checksum.h	2004-06-02 23:27:00 -07:00
@@ -139,9 +139,9 @@
 					       int *src_err_ptr, int *dst_err_ptr);
 
 
-extern unsigned int csum_partial_copy_from_user(const char *src, char *dst, 
+extern unsigned int csum_partial_copy_from_user(const char __user *src, char *dst, 
 				       int len, unsigned int isum, int *errp);
-extern unsigned int csum_partial_copy_to_user(const char *src, char *dst, 
+extern unsigned int csum_partial_copy_to_user(const char *src, char __user *dst, 
 				      int len, unsigned int isum, int *errp);
 extern unsigned int csum_partial_copy_nocheck(const char *src, char *dst, int len, 
 					      unsigned int sum);
diff -Nru a/include/asm-x86_64/compat.h b/include/asm-x86_64/compat.h
--- a/include/asm-x86_64/compat.h	2004-06-02 23:27:00 -07:00
+++ b/include/asm-x86_64/compat.h	2004-06-02 23:27:00 -07:00
@@ -186,15 +186,15 @@
  */
 typedef	u32		compat_uptr_t;
 
-static inline void *compat_ptr(compat_uptr_t uptr)
+static inline void __user *compat_ptr(compat_uptr_t uptr)
 {
-	return (void *)(unsigned long)uptr;
+	return (void __user *)(unsigned long)uptr;
 }
 
-static __inline__ void *compat_alloc_user_space(long len)
+static __inline__ void __user *compat_alloc_user_space(long len)
 {
 	struct pt_regs *regs = (void *)current->thread.rsp0 - sizeof(struct pt_regs); 
-	return (void *)regs->rsp - len; 
+	return (void __user *)regs->rsp - len; 
 }
 
 #endif /* _ASM_X86_64_COMPAT_H */
diff -Nru a/include/asm-x86_64/floppy.h b/include/asm-x86_64/floppy.h
--- a/include/asm-x86_64/floppy.h	2004-06-02 23:26:59 -07:00
+++ b/include/asm-x86_64/floppy.h	2004-06-02 23:26:59 -07:00
@@ -170,7 +170,7 @@
 static void _fd_dma_mem_free(unsigned long addr, unsigned long size)
 {
 	if((unsigned long) addr >= (unsigned long) high_memory)
-		return vfree((void *)addr);
+		vfree((void *)addr);
 	else
 		free_pages(addr, get_order(size));		
 }
diff -Nru a/include/asm-x86_64/fpu32.h b/include/asm-x86_64/fpu32.h
--- a/include/asm-x86_64/fpu32.h	2004-06-02 23:26:59 -07:00
+++ b/include/asm-x86_64/fpu32.h	2004-06-02 23:26:59 -07:00
@@ -3,8 +3,8 @@
 
 struct _fpstate_ia32;
 
-int restore_i387_ia32(struct task_struct *tsk, struct _fpstate_ia32 *buf, int fsave);
-int save_i387_ia32(struct task_struct *tsk, struct _fpstate_ia32 *buf, 
+int restore_i387_ia32(struct task_struct *tsk, struct _fpstate_ia32 __user *buf, int fsave);
+int save_i387_ia32(struct task_struct *tsk, struct _fpstate_ia32 __user *buf, 
 		   struct pt_regs *regs, int fsave);
 
 #endif
diff -Nru a/include/asm-x86_64/i387.h b/include/asm-x86_64/i387.h
--- a/include/asm-x86_64/i387.h	2004-06-02 23:26:59 -07:00
+++ b/include/asm-x86_64/i387.h	2004-06-02 23:26:59 -07:00
@@ -23,7 +23,7 @@
 extern unsigned int mxcsr_feature_mask;
 extern void mxcsr_feature_mask_init(void);
 extern void init_fpu(struct task_struct *child);
-extern int save_i387(struct _fpstate *buf);
+extern int save_i387(struct _fpstate __user *buf);
 
 static inline int need_signal_i387(struct task_struct *me) 
 { 
@@ -57,10 +57,10 @@
 /*
  * ptrace request handers...
  */
-extern int get_fpregs(struct user_i387_struct *buf,
+extern int get_fpregs(struct user_i387_struct __user *buf,
 		      struct task_struct *tsk);
 extern int set_fpregs(struct task_struct *tsk,
-		      struct user_i387_struct *buf);
+		      struct user_i387_struct __user *buf);
 
 /*
  * i387 state interaction
@@ -93,7 +93,7 @@
 	return err;
 } 
 
-static inline int save_i387_checking(struct i387_fxsave_struct *fx) 
+static inline int save_i387_checking(struct i387_fxsave_struct __user *fx) 
 { 
 	int err;
 	asm volatile("1:  rex64 ; fxsave (%[fx])\n\t"
@@ -136,7 +136,7 @@
 /* 
  * This restores directly out of user space. Exceptions are handled.
  */
-static inline int restore_i387(struct _fpstate *buf)
+static inline int restore_i387(struct _fpstate __user *buf)
 {
 	return restore_fpu_checking((struct i387_fxsave_struct *)buf);
 }
diff -Nru a/include/asm-x86_64/ia32.h b/include/asm-x86_64/ia32.h
--- a/include/asm-x86_64/ia32.h	2004-06-02 23:27:00 -07:00
+++ b/include/asm-x86_64/ia32.h	2004-06-02 23:27:00 -07:00
@@ -168,8 +168,8 @@
 #ifdef __KERNEL__
 struct user_desc;
 struct siginfo_t;
-int do_get_thread_area(struct thread_struct *t, struct user_desc *u_info);
-int do_set_thread_area(struct thread_struct *t, struct user_desc *u_info);
+int do_get_thread_area(struct thread_struct *t, struct user_desc __user *info);
+int do_set_thread_area(struct thread_struct *t, struct user_desc __user *info);
 int ia32_child_tls(struct task_struct *p, struct pt_regs *childregs);
 int ia32_copy_siginfo_from_user(siginfo_t *to, siginfo_t32 __user *from);
 int ia32_copy_siginfo_to_user(siginfo_t32 __user *to, siginfo_t *from);
diff -Nru a/include/asm-x86_64/ia32_unistd.h b/include/asm-x86_64/ia32_unistd.h
--- a/include/asm-x86_64/ia32_unistd.h	2004-06-02 23:26:59 -07:00
+++ b/include/asm-x86_64/ia32_unistd.h	2004-06-02 23:26:59 -07:00
@@ -288,7 +288,8 @@
 #define __NR_ia32_mq_timedreceive	(__NR_ia32_mq_open+3)
 #define __NR_ia32_mq_notify		(__NR_ia32_mq_open+4)
 #define __NR_ia32_mq_getsetattr	(__NR_ia32_mq_open+5)
+#define __NR_ia32_kexec		283
 
-#define IA32_NR_syscalls 285	/* must be > than biggest syscall! */
+#define IA32_NR_syscalls 287	/* must be > than biggest syscall! */
 
 #endif /* _ASM_X86_64_IA32_UNISTD_H_ */
diff -Nru a/include/asm-x86_64/io.h b/include/asm-x86_64/io.h
--- a/include/asm-x86_64/io.h	2004-06-02 23:26:59 -07:00
+++ b/include/asm-x86_64/io.h	2004-06-02 23:26:59 -07:00
@@ -195,8 +195,13 @@
 #define __raw_writel writel
 #define __raw_writeq writeq
 
-void *memcpy_fromio(void*,const void*,unsigned); 
-void *memcpy_toio(void*,const void*,unsigned); 
+void *__memcpy_fromio(void*,unsigned long,unsigned);
+void *__memcpy_toio(unsigned long,const void*,unsigned);
+
+#define memcpy_fromio(to,from,len) \
+  __memcpy_fromio((to),(unsigned long)(from),(len))
+#define memcpy_toio(to,from,len) \
+  __memcpy_toio((unsigned long)(to),(from),(len))
 #define memset_io(a,b,c)	memset((void *)(a),(b),(c))
 
 /*
diff -Nru a/include/asm-x86_64/msr.h b/include/asm-x86_64/msr.h
--- a/include/asm-x86_64/msr.h	2004-06-02 23:27:00 -07:00
+++ b/include/asm-x86_64/msr.h	2004-06-02 23:27:00 -07:00
@@ -143,8 +143,8 @@
 #define _EFER_NX 11  /* No execute enable */
 
 #define EFER_SCE (1<<_EFER_SCE)
-#define EFER_LME (1<<EFER_LME)
-#define EFER_LMA (1<<EFER_LMA)
+#define EFER_LME (1<<_EFER_LME)
+#define EFER_LMA (1<<_EFER_LMA)
 #define EFER_NX (1<<_EFER_NX)
 
 /* Intel MSRs. Some also available on other CPUs */
diff -Nru a/include/asm-x86_64/page.h b/include/asm-x86_64/page.h
--- a/include/asm-x86_64/page.h	2004-06-02 23:26:58 -07:00
+++ b/include/asm-x86_64/page.h	2004-06-02 23:26:58 -07:00
@@ -65,21 +65,26 @@
 extern unsigned long vm_data_default_flags, vm_data_default_flags32;
 extern unsigned long vm_force_exec32;
 
+#define __START_KERNEL		0xffffffff80100000UL
+#define __START_KERNEL_map	0xffffffff80000000UL
+#define __PAGE_OFFSET           0x0000010000000000UL	/* 1 << 40 */
+
+#else
+#define __START_KERNEL		0xffffffff80100000
+#define __START_KERNEL_map	0xffffffff80000000
+#define __PAGE_OFFSET           0x0000010000000000	/* 1 << 40 */
 #endif /* !__ASSEMBLY__ */
 
 /* to align the pointer to the (next) page boundary */
 #define PAGE_ALIGN(addr)	(((addr)+PAGE_SIZE-1)&PAGE_MASK)
 
 /* See Documentation/x86_64/mm.txt for a description of the memory map. */
-#define __START_KERNEL		0xffffffff80100000
-#define __START_KERNEL_map	0xffffffff80000000
-#define __PAGE_OFFSET           0x0000010000000000	/* 1 << 40 */
 #define __PHYSICAL_MASK_SHIFT	40
 #define __PHYSICAL_MASK		((1UL << __PHYSICAL_MASK_SHIFT) - 1)
 #define __VIRTUAL_MASK_SHIFT	48
 #define __VIRTUAL_MASK		((1UL << __VIRTUAL_MASK_SHIFT) - 1)
 
-#define KERNEL_TEXT_SIZE  (40UL*1024*1024)
+#define KERNEL_TEXT_SIZE  (10UL*1024*1024)
 #define KERNEL_TEXT_START 0xffffffff80000000UL 
 
 #ifndef __ASSEMBLY__
diff -Nru a/include/asm-x86_64/pgtable.h b/include/asm-x86_64/pgtable.h
--- a/include/asm-x86_64/pgtable.h	2004-06-02 23:27:00 -07:00
+++ b/include/asm-x86_64/pgtable.h	2004-06-02 23:27:00 -07:00
@@ -124,13 +124,13 @@
 
 
 #ifndef __ASSEMBLY__
-#define VMALLOC_START    0xffffff0000000000
-#define VMALLOC_END      0xffffff7fffffffff
-#define MODULES_VADDR    0xffffffffa0000000
-#define MODULES_END      0xffffffffafffffff
+#define VMALLOC_START    0xffffff0000000000UL
+#define VMALLOC_END      0xffffff7fffffffffUL
+#define MODULES_VADDR    0xffffffffa0000000UL
+#define MODULES_END      0xffffffffafffffffUL
 #define MODULES_LEN   (MODULES_END - MODULES_VADDR)
 
-#define IOMAP_START      0xfffffe8000000000
+#define IOMAP_START      0xfffffe8000000000UL
 
 #define _PAGE_BIT_PRESENT	0
 #define _PAGE_BIT_RW		1
@@ -382,6 +382,20 @@
 #define pte_unmap_nested(pte) /* NOP */ 
 
 #define update_mmu_cache(vma,address,pte) do { } while (0)
+
+/* We only update the dirty/accessed state if we set
+ * the dirty bit by hand in the kernel, since the hardware
+ * will do the accessed bit for us, and we don't want to
+ * race with other CPU's that might be updating the dirty
+ * bit at the same time. */
+#define  __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
+#define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \
+	do {								  \
+		if (__dirty) {						  \
+			set_pte(__ptep, __entry);			  \
+			flush_tlb_page(__vma, __address);		  \
+		}							  \
+	} while (0)
 
 /* Encode and de-code a swap entry */
 #define __swp_type(x)			(((x).val >> 1) & 0x3f)
diff -Nru a/include/asm-x86_64/processor.h b/include/asm-x86_64/processor.h
--- a/include/asm-x86_64/processor.h	2004-06-02 23:27:00 -07:00
+++ b/include/asm-x86_64/processor.h	2004-06-02 23:27:00 -07:00
@@ -166,7 +166,7 @@
 /*
  * User space process size: 512GB - 1GB (default).
  */
-#define TASK_SIZE	(0x0000007fc0000000)
+#define TASK_SIZE	(0x0000007fc0000000UL)
 
 /* This decides where the kernel will search for a free chunk of vm
  * space during mmap's.
diff -Nru a/include/asm-x86_64/ptrace.h b/include/asm-x86_64/ptrace.h
--- a/include/asm-x86_64/ptrace.h	2004-06-02 23:26:59 -07:00
+++ b/include/asm-x86_64/ptrace.h	2004-06-02 23:26:59 -07:00
@@ -83,7 +83,7 @@
 #if defined(__KERNEL__) && !defined(__ASSEMBLY__) 
 #define user_mode(regs) (!!((regs)->cs & 3))
 #define instruction_pointer(regs) ((regs)->rip)
-void signal_fault(struct pt_regs *regs, void *frame, char *where);
+void signal_fault(struct pt_regs *regs, void __user *frame, char *where);
 
 enum {
         EF_CF   = 0x00000001,
diff -Nru a/include/asm-x86_64/semaphore.h b/include/asm-x86_64/semaphore.h
--- a/include/asm-x86_64/semaphore.h	2004-06-02 23:26:58 -07:00
+++ b/include/asm-x86_64/semaphore.h	2004-06-02 23:26:58 -07:00
@@ -47,12 +47,12 @@
 	atomic_t count;
 	int sleepers;
 	wait_queue_head_t wait;
-#if WAITQUEUE_DEBUG
+#ifdef WAITQUEUE_DEBUG
 	long __magic;
 #endif
 };
 
-#if WAITQUEUE_DEBUG
+#ifdef WAITQUEUE_DEBUG
 # define __SEM_DEBUG_INIT(name) \
 		, (int)&(name).__magic
 #else
@@ -83,7 +83,7 @@
 	atomic_set(&sem->count, val);
 	sem->sleepers = 0;
 	init_waitqueue_head(&sem->wait);
-#if WAITQUEUE_DEBUG
+#ifdef WAITQUEUE_DEBUG
 	sem->__magic = (int)&sem->__magic;
 #endif
 }
@@ -115,7 +115,7 @@
  */
 static inline void down(struct semaphore * sem)
 {
-#if WAITQUEUE_DEBUG
+#ifdef WAITQUEUE_DEBUG
 	CHECK_MAGIC(sem->__magic);
 #endif
 	might_sleep();
@@ -142,7 +142,7 @@
 {
 	int result;
 
-#if WAITQUEUE_DEBUG
+#ifdef WAITQUEUE_DEBUG
 	CHECK_MAGIC(sem->__magic);
 #endif
 	might_sleep();
@@ -171,7 +171,7 @@
 {
 	int result;
 
-#if WAITQUEUE_DEBUG
+#ifdef WAITQUEUE_DEBUG
 	CHECK_MAGIC(sem->__magic);
 #endif
 
@@ -199,7 +199,7 @@
  */
 static inline void up(struct semaphore * sem)
 {
-#if WAITQUEUE_DEBUG
+#ifdef WAITQUEUE_DEBUG
 	CHECK_MAGIC(sem->__magic);
 #endif
 	__asm__ __volatile__(
diff -Nru a/include/asm-x86_64/sigcontext.h b/include/asm-x86_64/sigcontext.h
--- a/include/asm-x86_64/sigcontext.h	2004-06-02 23:26:59 -07:00
+++ b/include/asm-x86_64/sigcontext.h	2004-06-02 23:26:59 -07:00
@@ -2,6 +2,7 @@
 #define _ASM_X86_64_SIGCONTEXT_H
 
 #include <asm/types.h>
+#include <linux/compiler.h>
 
 /* FXSAVE frame */
 /* Note: reserved1/2 may someday contain valuable data. Always save/restore
@@ -47,7 +48,7 @@
 	unsigned long trapno;
 	unsigned long oldmask;
 	unsigned long cr2;
-	struct _fpstate *fpstate;	/* zero when no FPU context */
+	struct _fpstate __user *fpstate;	/* zero when no FPU context */
 	unsigned long reserved1[8];
 };
 
diff -Nru a/include/asm-x86_64/uaccess.h b/include/asm-x86_64/uaccess.h
--- a/include/asm-x86_64/uaccess.h	2004-06-02 23:26:59 -07:00
+++ b/include/asm-x86_64/uaccess.h	2004-06-02 23:26:59 -07:00
@@ -24,7 +24,7 @@
 
 #define MAKE_MM_SEG(s)	((mm_segment_t) { (s) })
 
-#define KERNEL_DS	MAKE_MM_SEG(0xFFFFFFFFFFFFFFFF)
+#define KERNEL_DS	MAKE_MM_SEG(0xFFFFFFFFFFFFFFFFUL)
 #define USER_DS		MAKE_MM_SEG(PAGE_OFFSET)
 
 #define get_ds()	(KERNEL_DS)
@@ -33,6 +33,16 @@
 
 #define segment_eq(a,b)	((a).seg == (b).seg)
 
+#ifdef __CHECKER__
+#define CHECK_UPTR(ptr) do {				\
+	__typeof__(*(ptr)) *__dummy_check_uptr =	\
+		(void __user *)&__dummy_check_uptr;	\
+} while(0)
+#else
+#define CHECK_UPTR(ptr)
+#endif
+
+
 #define __addr_ok(addr) (!((unsigned long)(addr) & (current_thread_info()->addr_limit.seg)))
 
 /*
@@ -40,15 +50,16 @@
  */
 #define __range_not_ok(addr,size) ({ \
 	unsigned long flag,sum; \
+	CHECK_UPTR(addr);	\
 	asm("# range_ok\n\r" \
 		"addq %3,%1 ; sbbq %0,%0 ; cmpq %1,%4 ; sbbq $0,%0"  \
 		:"=&r" (flag), "=r" (sum) \
 		:"1" (addr),"g" ((long)(size)),"g" (current_thread_info()->addr_limit.seg)); \
 	flag; })
 
-#define access_ok(type,addr,size) (__range_not_ok(addr,size) == 0)
+#define access_ok(type, addr, size) (__range_not_ok(addr,size) == 0)
 
-extern inline int verify_area(int type, const void * addr, unsigned long size)
+extern inline int verify_area(int type, const void __user * addr, unsigned long size)
 {
 	return access_ok(type,addr,size) ? 0 : -EFAULT;
 }
@@ -103,6 +114,7 @@
 #define get_user(x,ptr)							\
 ({	long __val_gu;							\
 	int __ret_gu; 							\
+	CHECK_UPTR(ptr);						\
 	switch(sizeof (*(ptr))) {					\
 	case 1:  __get_user_x(1,__ret_gu,__val_gu,ptr); break;		\
 	case 2:  __get_user_x(2,__ret_gu,__val_gu,ptr); break;		\
@@ -138,6 +150,7 @@
 #define __put_user_nocheck(x,ptr,size)			\
 ({							\
 	int __pu_err;					\
+	CHECK_UPTR(ptr);				\
 	__put_user_size((x),(ptr),(size),__pu_err);	\
 	__pu_err;					\
 })
@@ -193,6 +206,7 @@
 ({								\
 	int __gu_err;						\
 	long __gu_val;						\
+	CHECK_UPTR(ptr);					\
 	__get_user_size(__gu_val,(ptr),(size),__gu_err);	\
 	(x) = (__typeof__(*(ptr)))__gu_val;			\
 	__gu_err;						\
@@ -235,15 +249,15 @@
 /* Handles exceptions in both to and from, but doesn't do access_ok */
 extern unsigned long copy_user_generic(void *to, const void *from, unsigned len); 
 
-extern unsigned long copy_to_user(void *to, const void *from, unsigned len); 
-extern unsigned long copy_from_user(void *to, const void *from, unsigned len); 
-extern unsigned long copy_in_user(void *to, const void *from, unsigned len); 
+extern unsigned long copy_to_user(void __user *to, const void *from, unsigned len); 
+extern unsigned long copy_from_user(void *to, const void __user *from, unsigned len); 
+extern unsigned long copy_in_user(void __user *to, const void __user *from, unsigned len); 
 
-static inline int __copy_from_user(void *dst, const void *src, unsigned size) 
+static inline int __copy_from_user(void *dst, const void __user *src, unsigned size) 
 { 
        int ret = 0;
 	if (!__builtin_constant_p(size))
-		return copy_user_generic(dst,src,size);
+		return copy_user_generic(dst,(void *)src,size);
 	switch (size) { 
 	case 1:__get_user_asm(*(u8*)dst,(u8 *)src,ret,"b","b","=q",1); 
 		return ret;
@@ -264,15 +278,15 @@
 		__get_user_asm(*(u64*)(8+(char*)dst),(u64*)(8+(char*)src),ret,"q","","=r",8);
 		return ret; 
 	default:
-		return copy_user_generic(dst,src,size); 
+		return copy_user_generic(dst,(void *)src,size); 
 	}
 }	
 
-static inline int __copy_to_user(void *dst, const void *src, unsigned size) 
+static inline int __copy_to_user(void __user *dst, const void *src, unsigned size) 
 { 
        int ret = 0;
 	if (!__builtin_constant_p(size))
-		return copy_user_generic(dst,src,size);
+		return copy_user_generic((void *)dst,src,size);
 	switch (size) { 
 	case 1:__put_user_asm(*(u8*)src,(u8 *)dst,ret,"b","b","iq",1); 
 		return ret;
@@ -295,16 +309,16 @@
 		__put_user_asm(1[(u64*)src],1+(u64*)dst,ret,"q","","ir",8);
 		return ret; 
 	default:
-		return copy_user_generic(dst,src,size); 
+		return copy_user_generic((void *)dst,src,size); 
 	}
 }	
 
 
-static inline int __copy_in_user(void *dst, const void *src, unsigned size) 
+static inline int __copy_in_user(void __user *dst, const void __user *src, unsigned size) 
 { 
        int ret = 0;
 	if (!__builtin_constant_p(size))
-		return copy_user_generic(dst,src,size);
+		return copy_user_generic((void *)dst,(void *)src,size);
 	switch (size) { 
 	case 1: { 
 		u8 tmp;
@@ -336,15 +350,15 @@
 		return ret;
 	}
 	default:
-		return copy_user_generic(dst,src,size); 
+		return copy_user_generic((void *)dst,(void *)src,size); 
 	}
 }	
 
-long strncpy_from_user(char *dst, const char *src, long count);
-long __strncpy_from_user(char *dst, const char *src, long count);
-long strnlen_user(const char *str, long n);
-long strlen_user(const char *str);
-unsigned long clear_user(void *mem, unsigned long len);
-unsigned long __clear_user(void *mem, unsigned long len);
+long strncpy_from_user(char *dst, const char __user *src, long count);
+long __strncpy_from_user(char *dst, const char __user *src, long count);
+long strnlen_user(const char __user *str, long n);
+long strlen_user(const char __user *str);
+unsigned long clear_user(void __user *mem, unsigned long len);
+unsigned long __clear_user(void __user *mem, unsigned long len);
 
 #endif /* __X86_64_UACCESS_H */
diff -Nru a/include/linux/compiler.h b/include/linux/compiler.h
--- a/include/linux/compiler.h	2004-06-02 23:26:59 -07:00
+++ b/include/linux/compiler.h	2004-06-02 23:26:59 -07:00
@@ -5,10 +5,14 @@
 # define __user		__attribute__((noderef, address_space(1)))
 # define __kernel	/* default address space */
 # define __safe		__attribute__((safe))
+# define __force	__attribute__((force))
+extern void __chk_user_ptr(void __user *);
 #else
 # define __user
 # define __kernel
 # define __safe
+# define __force
+# define __chk_user_ptr(x) (void)0
 #endif
 
 #ifdef __KERNEL__
diff -Nru a/include/linux/futex.h b/include/linux/futex.h
--- a/include/linux/futex.h	2004-06-02 23:26:59 -07:00
+++ b/include/linux/futex.h	2004-06-02 23:26:59 -07:00
@@ -8,9 +8,10 @@
 #define FUTEX_WAKE (1)
 #define FUTEX_FD (2)
 #define FUTEX_REQUEUE (3)
-
+#define FUTEX_CMP_REQUEUE (4)
 
 long do_futex(unsigned long uaddr, int op, int val,
-		unsigned long timeout, unsigned long uaddr2, int val2);
+		unsigned long timeout, unsigned long uaddr2, int val2,
+		int val3);
 
 #endif
diff -Nru a/include/linux/hdlc.h b/include/linux/hdlc.h
--- a/include/linux/hdlc.h	2004-06-02 23:27:00 -07:00
+++ b/include/linux/hdlc.h	2004-06-02 23:27:00 -07:00
@@ -134,7 +134,7 @@
 			int dce_pvc_count;
 
 			struct timer_list timer;
-			int last_poll;
+			unsigned long last_poll;
 			int reliable;
 			int dce_changed;
 			int request;
@@ -149,8 +149,9 @@
 			cisco_proto settings;
 
 			struct timer_list timer;
-			int last_poll;
+			unsigned long last_poll;
 			int up;
+			int request_sent;
 			u32 txseq; /* TX sequence number */
 			u32 rxseq; /* RX sequence number */
 		}cisco;
diff -Nru a/include/linux/inetdevice.h b/include/linux/inetdevice.h
--- a/include/linux/inetdevice.h	2004-06-02 23:26:59 -07:00
+++ b/include/linux/inetdevice.h	2004-06-02 23:26:59 -07:00
@@ -96,7 +96,7 @@
 
 extern struct net_device 	*ip_dev_find(u32 addr);
 extern int		inet_addr_onlink(struct in_device *in_dev, u32 a, u32 b);
-extern int		devinet_ioctl(unsigned int cmd, void *);
+extern int		devinet_ioctl(unsigned int cmd, void __user *);
 extern void		devinet_init(void);
 extern struct in_device *inetdev_init(struct net_device *dev);
 extern struct in_device	*inetdev_by_index(int);
diff -Nru a/include/linux/kd.h b/include/linux/kd.h
--- a/include/linux/kd.h	2004-06-02 23:27:00 -07:00
+++ b/include/linux/kd.h	2004-06-02 23:27:00 -07:00
@@ -1,6 +1,7 @@
 #ifndef _LINUX_KD_H
 #define _LINUX_KD_H
 #include <linux/types.h>
+#include <linux/compiler.h>
 
 /* 0x4B is 'K', to avoid collision with termios and vt */
 
@@ -12,7 +13,7 @@
 struct consolefontdesc {
 	unsigned short charcount;	/* characters in font (256 or 512) */
 	unsigned short charheight;	/* scan lines per character (1-32) */
-	char *chardata;			/* font data in expanded form */
+	char __user *chardata;		/* font data in expanded form */
 };
 
 #define PIO_FONTRESET   0x4B6D	/* reset to default font */
@@ -63,7 +64,7 @@
 };
 struct unimapdesc {
 	unsigned short entry_ct;
-	struct unipair *entries;
+	struct unipair __user *entries;
 };
 #define PIO_UNIMAP	0x4B67	/* put unicode-to-font mapping in kernel */
 #define PIO_UNIMAPCLR	0x4B68	/* clear table, possibly advise hash algorithm */
diff -Nru a/include/linux/mca.h b/include/linux/mca.h
--- a/include/linux/mca.h	2004-06-02 23:26:59 -07:00
+++ b/include/linux/mca.h	2004-06-02 23:26:59 -07:00
@@ -144,7 +144,7 @@
 {
 }
 
-static inline void mca_set_adapter_procfn(int slot, MCA_ProcFn *fn, void* dev)
+static inline void mca_set_adapter_procfn(int slot, MCA_ProcFn fn, void* dev)
 {
 }
 #endif
diff -Nru a/include/linux/net.h b/include/linux/net.h
--- a/include/linux/net.h	2004-06-02 23:26:59 -07:00
+++ b/include/linux/net.h	2004-06-02 23:26:59 -07:00
@@ -217,9 +217,9 @@
 SOCKCALL_WRAP(name, listen, (struct socket *sock, int len), (sock, len)) \
 SOCKCALL_WRAP(name, shutdown, (struct socket *sock, int flags), (sock, flags)) \
 SOCKCALL_WRAP(name, setsockopt, (struct socket *sock, int level, int optname, \
-			 char *optval, int optlen), (sock, level, optname, optval, optlen)) \
+			 char __user *optval, int optlen), (sock, level, optname, optval, optlen)) \
 SOCKCALL_WRAP(name, getsockopt, (struct socket *sock, int level, int optname, \
-			 char *optval, int *optlen), (sock, level, optname, optval, optlen)) \
+			 char __user *optval, int __user *optlen), (sock, level, optname, optval, optlen)) \
 SOCKCALL_WRAP(name, sendmsg, (struct kiocb *iocb, struct socket *sock, struct msghdr *m, size_t len), \
 	      (iocb, sock, m, len)) \
 SOCKCALL_WRAP(name, recvmsg, (struct kiocb *iocb, struct socket *sock, struct msghdr *m, size_t len, int flags), \
diff -Nru a/include/linux/netdevice.h b/include/linux/netdevice.h
--- a/include/linux/netdevice.h	2004-06-02 23:27:00 -07:00
+++ b/include/linux/netdevice.h	2004-06-02 23:27:00 -07:00
@@ -558,7 +558,7 @@
 extern int		netpoll_trap(void);
 #endif
 
-typedef int gifconf_func_t(struct net_device * dev, char * bufptr, int len);
+typedef int gifconf_func_t(struct net_device * dev, char __user * bufptr, int len);
 extern int		register_gifconf(unsigned int family, gifconf_func_t * gifconf);
 static inline int unregister_gifconf(unsigned int family)
 {
@@ -676,7 +676,7 @@
 extern int		netif_rx(struct sk_buff *skb);
 #define HAVE_NETIF_RECEIVE_SKB 1
 extern int		netif_receive_skb(struct sk_buff *skb);
-extern int		dev_ioctl(unsigned int cmd, void *);
+extern int		dev_ioctl(unsigned int cmd, void __user *);
 extern int		dev_ethtool(struct ifreq *);
 extern unsigned		dev_get_flags(const struct net_device *);
 extern int		dev_change_flags(struct net_device *, unsigned);
diff -Nru a/include/linux/pci_ids.h b/include/linux/pci_ids.h
--- a/include/linux/pci_ids.h	2004-06-02 23:26:59 -07:00
+++ b/include/linux/pci_ids.h	2004-06-02 23:26:59 -07:00
@@ -373,6 +373,7 @@
 #define PCI_DEVICE_ID_NS_SCx200_AUDIO	0x0503
 #define PCI_DEVICE_ID_NS_SCx200_VIDEO	0x0504
 #define PCI_DEVICE_ID_NS_SCx200_XBUS	0x0505
+#define PCI_DEVICE_ID_NS_SC1100_BRIDGE	0x0510
 #define PCI_DEVICE_ID_NS_87410		0xd001
 
 #define PCI_VENDOR_ID_TSENG		0x100c
diff -Nru a/include/linux/selection.h b/include/linux/selection.h
--- a/include/linux/selection.h	2004-06-02 23:26:59 -07:00
+++ b/include/linux/selection.h	2004-06-02 23:26:59 -07:00
@@ -13,9 +13,9 @@
 extern int sel_cons;
 
 extern void clear_selection(void);
-extern int set_selection(const struct tiocl_selection *sel, struct tty_struct *tty, int user);
+extern int set_selection(const struct tiocl_selection __user *sel, struct tty_struct *tty);
 extern int paste_selection(struct tty_struct *tty);
-extern int sel_loadlut(const unsigned long arg);
+extern int sel_loadlut(char __user *p);
 extern int mouse_reporting(void);
 extern void mouse_report(struct tty_struct * tty, int butt, int mrx, int mry);
 
diff -Nru a/include/linux/skbuff.h b/include/linux/skbuff.h
--- a/include/linux/skbuff.h	2004-06-02 23:26:59 -07:00
+++ b/include/linux/skbuff.h	2004-06-02 23:26:59 -07:00
@@ -1014,13 +1014,13 @@
 extern unsigned int    datagram_poll(struct file *file, struct socket *sock,
 				     struct poll_table_struct *wait);
 extern int	       skb_copy_datagram(const struct sk_buff *from,
-					 int offset, char *to, int size);
+					 int offset, char __user *to, int size);
 extern int	       skb_copy_datagram_iovec(const struct sk_buff *from,
 					       int offset, struct iovec *to,
 					       int size);
 extern int	       skb_copy_and_csum_datagram(const struct sk_buff *skb,
-						  int offset, u8 *to, int len,
-						  unsigned int *csump);
+						  int offset, u8 __user *to,
+						  int len, unsigned int *csump);
 extern int	       skb_copy_and_csum_datagram_iovec(const
 							struct sk_buff *skb,
 							int hlen,
diff -Nru a/include/linux/timer.h b/include/linux/timer.h
--- a/include/linux/timer.h	2004-06-02 23:27:00 -07:00
+++ b/include/linux/timer.h	2004-06-02 23:27:00 -07:00
@@ -4,6 +4,7 @@
 #include <linux/config.h>
 #include <linux/list.h>
 #include <linux/spinlock.h>
+#include <linux/stddef.h>
 
 struct tvec_t_base_s;
 
diff -Nru a/include/linux/tty_driver.h b/include/linux/tty_driver.h
--- a/include/linux/tty_driver.h	2004-06-02 23:26:59 -07:00
+++ b/include/linux/tty_driver.h	2004-06-02 23:26:59 -07:00
@@ -145,7 +145,7 @@
 	void (*send_xchar)(struct tty_struct *tty, char ch);
 	int (*read_proc)(char *page, char **start, off_t off,
 			  int count, int *eof, void *data);
-	int (*write_proc)(struct file *file, const char *buffer,
+	int (*write_proc)(struct file *file, const char __user *buffer,
 			  unsigned long count, void *data);
 	int (*tiocmget)(struct tty_struct *tty, struct file *file);
 	int (*tiocmset)(struct tty_struct *tty, struct file *file,
@@ -207,7 +207,7 @@
 	void (*send_xchar)(struct tty_struct *tty, char ch);
 	int (*read_proc)(char *page, char **start, off_t off,
 			  int count, int *eof, void *data);
-	int (*write_proc)(struct file *file, const char *buffer,
+	int (*write_proc)(struct file *file, const char __user *buffer,
 			  unsigned long count, void *data);
 	int (*tiocmget)(struct tty_struct *tty, struct file *file);
 	int (*tiocmset)(struct tty_struct *tty, struct file *file,
diff -Nru a/include/linux/tty_ldisc.h b/include/linux/tty_ldisc.h
--- a/include/linux/tty_ldisc.h	2004-06-02 23:27:00 -07:00
+++ b/include/linux/tty_ldisc.h	2004-06-02 23:27:00 -07:00
@@ -114,9 +114,9 @@
 	void	(*flush_buffer)(struct tty_struct *tty);
 	ssize_t	(*chars_in_buffer)(struct tty_struct *tty);
 	ssize_t	(*read)(struct tty_struct * tty, struct file * file,
-			unsigned char * buf, size_t nr);
+			unsigned char __user * buf, size_t nr);
 	ssize_t	(*write)(struct tty_struct * tty, struct file * file,
-			 const unsigned char * buf, size_t nr);	
+			 const unsigned char __user * buf, size_t nr);	
 	int	(*ioctl)(struct tty_struct * tty, struct file * file,
 			 unsigned int cmd, unsigned long arg);
 	void	(*set_termios)(struct tty_struct *tty, struct termios * old);
diff -Nru a/include/linux/vt_kern.h b/include/linux/vt_kern.h
--- a/include/linux/vt_kern.h	2004-06-02 23:27:00 -07:00
+++ b/include/linux/vt_kern.h	2004-06-02 23:27:00 -07:00
@@ -49,8 +49,8 @@
 void unblank_screen(void);
 void poke_blanked_console(void);
 int con_font_op(int currcons, struct console_font_op *op);
-int con_set_cmap(unsigned char *cmap);
-int con_get_cmap(unsigned char *cmap);
+int con_set_cmap(unsigned char __user *cmap);
+int con_get_cmap(unsigned char __user *cmap);
 void scrollback(int);
 void scrollfront(int);
 void update_region(int currcons, unsigned long start, int count);
@@ -66,13 +66,13 @@
 struct unimapinit;
 struct unipair;
 
-int con_set_trans_old(unsigned char * table);
-int con_get_trans_old(unsigned char * table);
-int con_set_trans_new(unsigned short * table);
-int con_get_trans_new(unsigned short * table);
+int con_set_trans_old(unsigned char __user * table);
+int con_get_trans_old(unsigned char __user * table);
+int con_set_trans_new(unsigned short __user * table);
+int con_get_trans_new(unsigned short __user * table);
 int con_clear_unimap(int currcons, struct unimapinit *ui);
-int con_set_unimap(int currcons, ushort ct, struct unipair *list);
-int con_get_unimap(int currcons, ushort ct, ushort *uct, struct unipair *list);
+int con_set_unimap(int currcons, ushort ct, struct unipair __user *list);
+int con_get_unimap(int currcons, ushort ct, ushort __user *uct, struct unipair __user *list);
 int con_set_default_unimap(int currcons);
 void con_free_unimap(int currcons);
 void con_protect_unimap(int currcons, int rdonly);
diff -Nru a/include/net/addrconf.h b/include/net/addrconf.h
--- a/include/net/addrconf.h	2004-06-02 23:27:00 -07:00
+++ b/include/net/addrconf.h	2004-06-02 23:27:00 -07:00
@@ -52,9 +52,9 @@
 extern void			addrconf_init(void);
 extern void			addrconf_cleanup(void);
 
-extern int			addrconf_add_ifaddr(void *arg);
-extern int			addrconf_del_ifaddr(void *arg);
-extern int			addrconf_set_dstaddr(void *arg);
+extern int			addrconf_add_ifaddr(void __user *arg);
+extern int			addrconf_del_ifaddr(void __user *arg);
+extern int			addrconf_set_dstaddr(void __user *arg);
 
 extern int			ipv6_chk_addr(struct in6_addr *addr,
 					      struct net_device *dev,
diff -Nru a/include/net/arp.h b/include/net/arp.h
--- a/include/net/arp.h	2004-06-02 23:26:58 -07:00
+++ b/include/net/arp.h	2004-06-02 23:26:58 -07:00
@@ -13,7 +13,7 @@
 extern int	arp_rcv(struct sk_buff *skb, struct net_device *dev,
 			struct packet_type *pt);
 extern int	arp_find(unsigned char *haddr, struct sk_buff *skb);
-extern int	arp_ioctl(unsigned int cmd, void *arg);
+extern int	arp_ioctl(unsigned int cmd, void __user *arg);
 extern void     arp_send(int type, int ptype, u32 dest_ip, 
 			 struct net_device *dev, u32 src_ip, 
 			 unsigned char *dest_hw, unsigned char *src_hw, unsigned char *th);
diff -Nru a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
--- a/include/net/bluetooth/bluetooth.h	2004-06-02 23:26:59 -07:00
+++ b/include/net/bluetooth/bluetooth.h	2004-06-02 23:26:59 -07:00
@@ -22,10 +22,6 @@
    SOFTWARE IS DISCLAIMED.
 */
 
-/*
- *  $Id: bluetooth.h,v 1.8 2002/04/17 17:37:20 maxk Exp $
- */
-
 #ifndef __BLUETOOTH_H
 #define __BLUETOOTH_H
 
@@ -41,26 +37,27 @@
 #endif
 
 /* Reserv for core and drivers use */
-#define BT_SKB_RESERVE       8
+#define BT_SKB_RESERVE	8
 
-#define BTPROTO_L2CAP   0
-#define BTPROTO_HCI     1
-#define BTPROTO_SCO   	2
+#define BTPROTO_L2CAP	0
+#define BTPROTO_HCI	1
+#define BTPROTO_SCO	2
 #define BTPROTO_RFCOMM	3
 #define BTPROTO_BNEP	4
 #define BTPROTO_CMTP	5
+#define BTPROTO_HIDP	6
 
-#define SOL_HCI     0
-#define SOL_L2CAP   6
-#define SOL_SCO     17
-#define SOL_RFCOMM  18
+#define SOL_HCI		0
+#define SOL_L2CAP	6
+#define SOL_SCO		17
+#define SOL_RFCOMM	18
 
 #define BT_INFO(fmt, arg...) printk(KERN_INFO "Bluetooth: " fmt "\n" , ## arg)
 #define BT_DBG(fmt, arg...)  printk(KERN_INFO "%s: " fmt "\n" , __FUNCTION__ , ## arg)
 #define BT_ERR(fmt, arg...)  printk(KERN_ERR  "%s: " fmt "\n" , __FUNCTION__ , ## arg)
 
 #ifdef HCI_DATA_DUMP
-#define BT_DMP(buf, len)    bt_dump(__FUNCTION__, buf, len)
+#define BT_DMP(buf, len) bt_dump(__FUNCTION__, buf, len)
 #else
 #define BT_DMP(D...)
 #endif
@@ -122,7 +119,7 @@
 
 struct bt_sock_list {
 	struct hlist_head head;
-	rwlock_t	  lock;
+	rwlock_t          lock;
 };
 
 int  bt_sock_register(int proto, struct net_proto_family *ops);
@@ -139,7 +136,7 @@
 
 /* Skb helpers */
 struct bt_skb_cb {
-	int    incoming;
+	int incoming;
 };
 #define bt_cb(skb) ((struct bt_skb_cb *)(skb->cb)) 
 
@@ -155,7 +152,7 @@
 }
 
 static inline struct sk_buff *bt_skb_send_alloc(struct sock *sk, unsigned long len, 
-						       int nb, int *err)
+							int nb, int *err)
 {
 	struct sk_buff *skb;
 
@@ -178,6 +175,6 @@
 
 void bt_dump(char *pref, __u8 *buf, int count);
 
-int  bt_err(__u16 code);
+int bt_err(__u16 code);
 
 #endif /* __BLUETOOTH_H */
diff -Nru a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
--- a/include/net/bluetooth/hci.h	2004-06-02 23:27:00 -07:00
+++ b/include/net/bluetooth/hci.h	2004-06-02 23:27:00 -07:00
@@ -22,10 +22,6 @@
    SOFTWARE IS DISCLAIMED.
 */
 
-/*
- *  $Id: hci.h,v 1.4 2002/04/18 22:26:15 maxk Exp $
- */
-
 #ifndef __HCI_H
 #define __HCI_H
 
diff -Nru a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
--- a/include/net/bluetooth/hci_core.h	2004-06-02 23:26:59 -07:00
+++ b/include/net/bluetooth/hci_core.h	2004-06-02 23:26:59 -07:00
@@ -22,10 +22,6 @@
    SOFTWARE IS DISCLAIMED.
 */
 
-/* 
- * $Id: hci_core.h,v 1.3 2002/04/17 18:55:21 maxk Exp $ 
- */
-
 #ifndef __HCI_CORE_H
 #define __HCI_CORE_H
 
@@ -63,12 +59,12 @@
 struct hci_dev {
 	struct list_head list;
 	spinlock_t	lock;
-	atomic_t 	refcnt;
+	atomic_t	refcnt;
 
 	char		name[8];
 	unsigned long	flags;
 	__u16		id;
-	__u8	 	type;
+	__u8		type;
 	bdaddr_t	bdaddr;
 	__u8		features[8];
 	__u16		voice_setting;
@@ -79,38 +75,38 @@
 
 	unsigned long	quirks;
 
-	atomic_t 	cmd_cnt;
-	unsigned int 	acl_cnt;
-	unsigned int 	sco_cnt;
+	atomic_t	cmd_cnt;
+	unsigned int	acl_cnt;
+	unsigned int	sco_cnt;
 
 	unsigned int	acl_mtu;
-	unsigned int 	sco_mtu;
+	unsigned int	sco_mtu;
 	unsigned int	acl_pkts;
 	unsigned int	sco_pkts;
 
-	unsigned long   cmd_last_tx;
-	unsigned long   acl_last_tx;
-	unsigned long   sco_last_tx;
+	unsigned long	cmd_last_tx;
+	unsigned long	acl_last_tx;
+	unsigned long	sco_last_tx;
 
-	struct tasklet_struct 	cmd_task;
+	struct tasklet_struct	cmd_task;
 	struct tasklet_struct	rx_task;
-	struct tasklet_struct 	tx_task;
+	struct tasklet_struct	tx_task;
 
 	struct sk_buff_head	rx_q;
-	struct sk_buff_head 	raw_q;
-	struct sk_buff_head 	cmd_q;
+	struct sk_buff_head	raw_q;
+	struct sk_buff_head	cmd_q;
 
-	struct sk_buff     	*sent_cmd;
+	struct sk_buff		*sent_cmd;
 
 	struct semaphore	req_lock;
 	wait_queue_head_t	req_wait_q;
 	__u32			req_status;
 	__u32			req_result;
 
-	struct inquiry_cache 	inq_cache;
-	struct hci_conn_hash 	conn_hash;
+	struct inquiry_cache	inq_cache;
+	struct hci_conn_hash	conn_hash;
 
-	struct hci_dev_stats 	stat;
+	struct hci_dev_stats	stat;
 
 	void			*driver_data;
 	void			*core_data;
@@ -118,12 +114,12 @@
 	atomic_t 		promisc;
 
 #ifdef CONFIG_PROC_FS
-	struct proc_dir_entry   *proc;
+	struct proc_dir_entry	*proc;
 #endif
 
 	struct class_device	class_dev;
 
-	struct module           *owner;
+	struct module 		*owner;
 
 	int (*open)(struct hci_dev *hdev);
 	int (*close)(struct hci_dev *hdev);
@@ -140,9 +136,9 @@
 	atomic_t	 refcnt;
 	spinlock_t	 lock;
 
-	bdaddr_t         dst;
-	__u16            handle;
-	__u16            state;
+	bdaddr_t	 dst;
+	__u16		 handle;
+	__u16		 state;
 	__u8		 type;
 	__u8		 out;
 	__u32		 link_mode;
@@ -154,12 +150,12 @@
 
 	struct timer_list timer;
 	
-	struct hci_dev 	*hdev;
+	struct hci_dev	*hdev;
 	void		*l2cap_data;
 	void		*sco_data;
 	void		*priv;
 
-	struct hci_conn *link;
+	struct hci_conn	*link;
 };
 
 extern struct hci_proto *hci_proto[];
@@ -215,7 +211,7 @@
 	struct hci_conn_hash *h = &hdev->conn_hash;
 	INIT_LIST_HEAD(&h->list);
 	spin_lock_init(&h->lock);
-	h->num = 0;	
+	h->num = 0;
 }
 
 static inline void hci_conn_hash_add(struct hci_dev *hdev, struct hci_conn *c)
@@ -233,7 +229,7 @@
 }
 
 static inline struct hci_conn *hci_conn_hash_lookup_handle(struct hci_dev *hdev,
-	       				__u16 handle)
+					__u16 handle)
 {
 	struct hci_conn_hash *h = &hdev->conn_hash;
 	struct list_head *p;
@@ -244,7 +240,7 @@
 		if (c->handle == handle)
 			return c;
 	}
-        return NULL;
+	return NULL;
 }
 
 static inline struct hci_conn *hci_conn_hash_lookup_ba(struct hci_dev *hdev,
@@ -259,7 +255,7 @@
 		if (c->type == type && !bacmp(&c->dst, ba))
 			return c;
 	}
-        return NULL;
+	return NULL;
 }
 
 void hci_acl_connect(struct hci_conn *conn);
@@ -506,7 +502,7 @@
 /* HCI info for socket */
 #define hci_pi(sk)	((struct hci_pinfo *)sk->sk_protinfo)
 struct hci_pinfo {
-	struct hci_dev 	  *hdev;
+	struct hci_dev    *hdev;
 	struct hci_filter filter;
 	__u32             cmsg_mask;
 };
diff -Nru a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
--- a/include/net/bluetooth/l2cap.h	2004-06-02 23:26:58 -07:00
+++ b/include/net/bluetooth/l2cap.h	2004-06-02 23:26:58 -07:00
@@ -22,18 +22,14 @@
    SOFTWARE IS DISCLAIMED.
 */
 
-/*
- *  $Id: l2cap.h,v 1.1.1.1 2002/03/08 21:03:15 maxk Exp $
- */
-
 #ifndef __L2CAP_H
 #define __L2CAP_H
 
 /* L2CAP defaults */
-#define L2CAP_DEFAULT_MTU 	672
+#define L2CAP_DEFAULT_MTU	672
 #define L2CAP_DEFAULT_FLUSH_TO	0xFFFF
 
-#define L2CAP_CONN_TIMEOUT 	(HZ * 40)
+#define L2CAP_CONN_TIMEOUT	(HZ * 40)
 
 /* L2CAP socket address */
 struct sockaddr_l2 {
@@ -190,10 +186,10 @@
 struct l2cap_conn {
 	struct hci_conn	*hcon;
 
-	bdaddr_t 	*dst;
-	bdaddr_t 	*src;
+	bdaddr_t	*dst;
+	bdaddr_t	*src;
 	
-	unsigned int    mtu;
+	unsigned int	mtu;
 
 	spinlock_t	lock;
 	
@@ -227,9 +223,9 @@
 
 	__u16		sport;
 
-	struct l2cap_conn 	*conn;
-	struct sock 		*next_c;
-	struct sock 		*prev_c;
+	struct l2cap_conn	*conn;
+	struct sock		*next_c;
+	struct sock		*prev_c;
 };
 
 #define L2CAP_CONF_REQ_SENT    0x01
diff -Nru a/include/net/bluetooth/rfcomm.h b/include/net/bluetooth/rfcomm.h
--- a/include/net/bluetooth/rfcomm.h	2004-06-02 23:27:00 -07:00
+++ b/include/net/bluetooth/rfcomm.h	2004-06-02 23:27:00 -07:00
@@ -21,14 +21,6 @@
    SOFTWARE IS DISCLAIMED.
 */
 
-/* 
-   RPN support    -    Dirk Husemann <hud@zurich.ibm.com>
-*/
-
-/*
- * $Id: rfcomm.h,v 1.29 2002/10/02 20:26:17 maxk Exp $
- */
-
 #ifndef __RFCOMM_H
 #define __RFCOMM_H
 
diff -Nru a/include/net/bluetooth/sco.h b/include/net/bluetooth/sco.h
--- a/include/net/bluetooth/sco.h	2004-06-02 23:26:58 -07:00
+++ b/include/net/bluetooth/sco.h	2004-06-02 23:26:58 -07:00
@@ -22,19 +22,15 @@
    SOFTWARE IS DISCLAIMED.
 */
 
-/*
- *  $Id: sco.h,v 1.1.1.1 2002/03/08 21:03:15 maxk Exp $
- */
-
 #ifndef __SCO_H
 #define __SCO_H
 
 /* SCO defaults */
-#define SCO_DEFAULT_MTU 	500
+#define SCO_DEFAULT_MTU		500
 #define SCO_DEFAULT_FLUSH_TO	0xFFFF
 
-#define SCO_CONN_TIMEOUT 	(HZ * 40)
-#define SCO_DISCONN_TIMEOUT 	(HZ * 2)
+#define SCO_CONN_TIMEOUT	(HZ * 40)
+#define SCO_DISCONN_TIMEOUT	(HZ * 2)
 #define SCO_CONN_IDLE_TIMEOUT	(HZ * 60)
 
 /* SCO socket address */
diff -Nru a/include/net/checksum.h b/include/net/checksum.h
--- a/include/net/checksum.h	2004-06-02 23:26:58 -07:00
+++ b/include/net/checksum.h	2004-06-02 23:26:58 -07:00
@@ -95,7 +95,7 @@
 
 #ifndef _HAVE_ARCH_COPY_AND_CSUM_FROM_USER
 static inline
-unsigned int csum_and_copy_from_user (const char *src, char *dst,
+unsigned int csum_and_copy_from_user (const char __user *src, char *dst,
 				      int len, int sum, int *err_ptr)
 {
 	if (verify_area(VERIFY_READ, src, len) == 0)
@@ -110,7 +110,7 @@
 
 #ifndef HAVE_CSUM_COPY_USER
 static __inline__ unsigned int csum_and_copy_to_user
-(const char *src, char *dst, int len, unsigned int sum, int *err_ptr)
+(const char *src, char __user *dst, int len, unsigned int sum, int *err_ptr)
 {
 	sum = csum_partial(src, len, sum);
 
diff -Nru a/include/net/compat.h b/include/net/compat.h
--- a/include/net/compat.h	2004-06-02 23:26:59 -07:00
+++ b/include/net/compat.h	2004-06-02 23:26:59 -07:00
@@ -29,9 +29,9 @@
 
 extern int get_compat_msghdr(struct msghdr *, struct compat_msghdr __user *);
 extern int verify_compat_iovec(struct msghdr *, struct iovec *, char *, int);
-extern asmlinkage long compat_sys_sendmsg(int,struct compat_msghdr *,unsigned);
-extern asmlinkage long compat_sys_recvmsg(int,struct compat_msghdr *,unsigned);
-extern asmlinkage long compat_sys_getsockopt(int, int, int, char *, int *);
+extern asmlinkage long compat_sys_sendmsg(int,struct compat_msghdr __user *,unsigned);
+extern asmlinkage long compat_sys_recvmsg(int,struct compat_msghdr __user *,unsigned);
+extern asmlinkage long compat_sys_getsockopt(int, int, int, char __user *, int __user *);
 extern int put_cmsg_compat(struct msghdr*, int, int, int, void *);
 extern int cmsghdr_from_user_compat_to_kern(struct msghdr *, unsigned char *,
 		int);
diff -Nru a/include/net/ip.h b/include/net/ip.h
--- a/include/net/ip.h	2004-06-02 23:27:00 -07:00
+++ b/include/net/ip.h	2004-06-02 23:27:00 -07:00
@@ -300,11 +300,11 @@
  * fed into the routing cache should use these handlers.
  */
 int ipv4_doint_and_flush(ctl_table *ctl, int write,
-			 struct file* filp, void *buffer,
+			 struct file* filp, void __user *buffer,
 			 size_t *lenp);
-int ipv4_doint_and_flush_strategy(ctl_table *table, int *name, int nlen,
-				  void *oldval, size_t *oldlenp,
-				  void *newval, size_t newlen, 
+int ipv4_doint_and_flush_strategy(ctl_table *table, int __user *name, int nlen,
+				  void __user *oldval, size_t __user *oldlenp,
+				  void __user *newval, size_t newlen, 
 				  void **context);
 
 #endif	/* _IP_H */
diff -Nru a/include/net/ip6_route.h b/include/net/ip6_route.h
--- a/include/net/ip6_route.h	2004-06-02 23:26:58 -07:00
+++ b/include/net/ip6_route.h	2004-06-02 23:26:58 -07:00
@@ -35,7 +35,7 @@
 extern void			ip6_route_init(void);
 extern void			ip6_route_cleanup(void);
 
-extern int			ipv6_route_ioctl(unsigned int cmd, void *arg);
+extern int			ipv6_route_ioctl(unsigned int cmd, void __user *arg);
 
 extern int			ip6_route_add(struct in6_rtmsg *rtmsg,
 					      struct nlmsghdr *,
diff -Nru a/include/net/sock.h b/include/net/sock.h
--- a/include/net/sock.h	2004-06-02 23:27:00 -07:00
+++ b/include/net/sock.h	2004-06-02 23:27:00 -07:00
@@ -1049,7 +1049,7 @@
 	}		
 } 
 
-extern int sock_get_timestamp(struct sock *, struct timeval *);
+extern int sock_get_timestamp(struct sock *, struct timeval __user *);
 
 /* 
  *	Enable debug/info messages 
diff -Nru a/init/Kconfig b/init/Kconfig
--- a/init/Kconfig	2004-06-02 23:27:00 -07:00
+++ b/init/Kconfig	2004-06-02 23:27:00 -07:00
@@ -92,7 +92,7 @@
 
 config POSIX_MQUEUE
 	bool "POSIX Message Queues"
-	depends on EXPERIMENTAL
+	depends on NET && EXPERIMENTAL
 	---help---
 	  POSIX variant of message queues is a part of IPC. In POSIX message
 	  queues every message has a priority which decides about succession
diff -Nru a/kernel/compat.c b/kernel/compat.c
--- a/kernel/compat.c	2004-06-02 23:26:59 -07:00
+++ b/kernel/compat.c	2004-06-02 23:26:59 -07:00
@@ -210,7 +210,8 @@
 
 #ifdef CONFIG_FUTEX
 asmlinkage long compat_sys_futex(u32 __user *uaddr, int op, int val,
-		struct compat_timespec __user *utime, u32 __user *uaddr2)
+		struct compat_timespec __user *utime, u32 __user *uaddr2,
+		int val3)
 {
 	struct timespec t;
 	unsigned long timeout = MAX_SCHEDULE_TIMEOUT;
@@ -221,11 +222,11 @@
 			return -EFAULT;
 		timeout = timespec_to_jiffies(&t) + 1;
 	}
-	if (op == FUTEX_REQUEUE)
+	if (op >= FUTEX_REQUEUE)
 		val2 = (int) (long) utime;
 
 	return do_futex((unsigned long)uaddr, op, val, timeout,
-			(unsigned long)uaddr2, val2);
+			(unsigned long)uaddr2, val2, val3);
 }
 #endif
 
diff -Nru a/kernel/exit.c b/kernel/exit.c
--- a/kernel/exit.c	2004-06-02 23:27:00 -07:00
+++ b/kernel/exit.c	2004-06-02 23:27:00 -07:00
@@ -737,6 +737,14 @@
 	tsk->flags |= PF_DEAD;
 
 	/*
+	 * Clear these here so that update_process_times() won't try to deliver
+	 * itimer, profile or rlimit signals to this task while it is in late exit.
+	 */
+	tsk->it_virt_incr = 0;
+	tsk->it_prof_value = 0;
+	tsk->rlim[RLIMIT_CPU].rlim_cur = RLIM_INFINITY;
+
+	/*
 	 * In the preemption case it must be impossible for the task
 	 * to get runnable again, so use "_raw_" unlock to keep
 	 * preempt_count elevated until we schedule().
diff -Nru a/kernel/futex.c b/kernel/futex.c
--- a/kernel/futex.c	2004-06-02 23:26:59 -07:00
+++ b/kernel/futex.c	2004-06-02 23:26:59 -07:00
@@ -96,6 +96,7 @@
  */
 struct futex_hash_bucket {
        spinlock_t              lock;
+       unsigned int	    nqueued;
        struct list_head       chain;
 };
 
@@ -318,13 +319,14 @@
  * physical page.
  */
 static int futex_requeue(unsigned long uaddr1, unsigned long uaddr2,
-				int nr_wake, int nr_requeue)
+			 int nr_wake, int nr_requeue, int *valp)
 {
 	union futex_key key1, key2;
 	struct futex_hash_bucket *bh1, *bh2;
 	struct list_head *head1;
 	struct futex_q *this, *next;
 	int ret, drop_count = 0;
+	unsigned int nqueued;
 
 	down_read(&current->mm->mmap_sem);
 
@@ -338,12 +340,41 @@
 	bh1 = hash_futex(&key1);
 	bh2 = hash_futex(&key2);
 
+	nqueued = bh1->nqueued;
+	if (likely(valp != NULL)) {
+		int curval;
+
+		/* In order to avoid doing get_user while
+		   holding bh1->lock and bh2->lock, nqueued
+		   (monotonically increasing field) must be first
+		   read, then *uaddr1 fetched from userland and
+		   after acquiring lock nqueued field compared with
+		   the stored value.  The smp_mb () below
+		   makes sure that bh1->nqueued is read from memory
+		   before *uaddr1.  */
+		smp_mb();
+
+		if (get_user(curval, (int *)uaddr1) != 0) {
+			ret = -EFAULT;
+			goto out;
+		}
+		if (curval != *valp) {
+			ret = -EAGAIN;
+			goto out;
+		}
+	}
+
 	if (bh1 < bh2)
 		spin_lock(&bh1->lock);
 	spin_lock(&bh2->lock);
 	if (bh1 > bh2)
 		spin_lock(&bh1->lock);
 
+	if (unlikely(nqueued != bh1->nqueued && valp != NULL)) {
+		ret = -EAGAIN;
+		goto out_unlock;
+	}
+
 	head1 = &bh1->chain;
 	list_for_each_entry_safe(this, next, head1, list) {
 		if (!match_futex (&this->key, &key1))
@@ -365,6 +396,7 @@
 		}
 	}
 
+out_unlock:
 	spin_unlock(&bh1->lock);
 	if (bh1 != bh2)
 		spin_unlock(&bh2->lock);
@@ -398,6 +430,7 @@
 	q->lock_ptr = &bh->lock;
 
 	spin_lock(&bh->lock);
+	bh->nqueued++;
 	list_add_tail(&q->list, &bh->chain);
 	spin_unlock(&bh->lock);
 }
@@ -625,7 +658,7 @@
 }
 
 long do_futex(unsigned long uaddr, int op, int val, unsigned long timeout,
-		unsigned long uaddr2, int val2)
+		unsigned long uaddr2, int val2, int val3)
 {
 	int ret;
 
@@ -641,7 +674,10 @@
 		ret = futex_fd(uaddr, val);
 		break;
 	case FUTEX_REQUEUE:
-		ret = futex_requeue(uaddr, uaddr2, val, val2);
+		ret = futex_requeue(uaddr, uaddr2, val, val2, NULL);
+		break;
+	case FUTEX_CMP_REQUEUE:
+		ret = futex_requeue(uaddr, uaddr2, val, val2, &val3);
 		break;
 	default:
 		ret = -ENOSYS;
@@ -651,7 +687,8 @@
 
 
 asmlinkage long sys_futex(u32 __user *uaddr, int op, int val,
-			  struct timespec __user *utime, u32 __user *uaddr2)
+			  struct timespec __user *utime, u32 __user *uaddr2,
+			  int val3)
 {
 	struct timespec t;
 	unsigned long timeout = MAX_SCHEDULE_TIMEOUT;
@@ -665,11 +702,11 @@
 	/*
 	 * requeue parameter in 'utime' if op == FUTEX_REQUEUE.
 	 */
-	if (op == FUTEX_REQUEUE)
+	if (op >= FUTEX_REQUEUE)
 		val2 = (int) (long) utime;
 
 	return do_futex((unsigned long)uaddr, op, val, timeout,
-			(unsigned long)uaddr2, val2);
+			(unsigned long)uaddr2, val2, val3);
 }
 
 static struct super_block *
diff -Nru a/kernel/kthread.c b/kernel/kthread.c
--- a/kernel/kthread.c	2004-06-02 23:27:00 -07:00
+++ b/kernel/kthread.c	2004-06-02 23:27:00 -07:00
@@ -11,6 +11,7 @@
 #include <linux/err.h>
 #include <linux/unistd.h>
 #include <linux/file.h>
+#include <linux/module.h>
 #include <asm/semaphore.h>
 
 struct kthread_create_info
@@ -41,7 +42,7 @@
 {
 	return (kthread_stop_info.k == current);
 }
-
+EXPORT_SYMBOL(kthread_should_stop);
 
 static void kthread_exit_files(void)
 {
@@ -144,6 +145,7 @@
 
 	return create.result;
 }
+EXPORT_SYMBOL(kthread_create);
 
 void kthread_bind(struct task_struct *k, unsigned int cpu)
 {
@@ -153,6 +155,7 @@
 	set_task_cpu(k, cpu);
 	k->cpus_allowed = cpumask_of_cpu(cpu);
 }
+EXPORT_SYMBOL(kthread_bind);
 
 int kthread_stop(struct task_struct *k)
 {
@@ -180,3 +183,4 @@
 
 	return ret;
 }
+EXPORT_SYMBOL(kthread_stop);
diff -Nru a/kernel/sched.c b/kernel/sched.c
--- a/kernel/sched.c	2004-06-02 23:27:00 -07:00
+++ b/kernel/sched.c	2004-06-02 23:27:00 -07:00
@@ -1663,11 +1663,8 @@
  * tasks if there is an imbalance.
  *
  * Called with this_rq unlocked.
- *
- * This function is marked noinline to work around a compiler
- * bug with gcc 3.3.3-hammer on x86-64.
  */
-static int noinline load_balance(int this_cpu, runqueue_t *this_rq,
+static int load_balance(int this_cpu, runqueue_t *this_rq,
 			struct sched_domain *sd, enum idle_type idle)
 {
 	struct sched_group *group;
@@ -1684,6 +1681,11 @@
 	busiest = find_busiest_queue(group);
 	if (!busiest)
 		goto out_balanced;
+	/*
+	 * This should be "impossible", but since load
+	 * balancing is inherently racy and statistical,
+	 * it could happen in theory.
+	 */
 	if (unlikely(busiest == this_rq)) {
 		WARN_ON(1);
 		goto out_balanced;
@@ -1847,6 +1849,15 @@
  		}
 
 		rq = cpu_rq(push_cpu);
+
+		/*
+		 * This condition is "impossible", but since load
+		 * balancing is inherently a bit racy and statistical,
+		 * it can trigger.. Reported by Bjorn Helgaas on a
+		 * 128-cpu setup.
+		 */
+		if (unlikely(busiest == rq))
+			goto next_group;
 		double_lock_balance(busiest, rq);
 		move_tasks(rq, push_cpu, busiest, 1, sd, IDLE);
 		spin_unlock(&rq->lock);
diff -Nru a/kernel/signal.c b/kernel/signal.c
--- a/kernel/signal.c	2004-06-02 23:26:59 -07:00
+++ b/kernel/signal.c	2004-06-02 23:26:59 -07:00
@@ -2175,7 +2175,7 @@
 }
 
 /**
- *  sys_tkill - send signal to one specific thread
+ *  sys_tgkill - send signal to one specific thread
  *  @tgid: the thread group ID of the thread
  *  @pid: the PID of the thread
  *  @sig: signal to be sent
diff -Nru a/kernel/sys.c b/kernel/sys.c
--- a/kernel/sys.c	2004-06-02 23:26:58 -07:00
+++ b/kernel/sys.c	2004-06-02 23:26:58 -07:00
@@ -274,6 +274,7 @@
 cond_syscall(sys_mbind)
 cond_syscall(sys_get_mempolicy)
 cond_syscall(sys_set_mempolicy)
+cond_syscall(compat_get_mempolicy)
 
 /* arch-specific weak syscall entries */
 cond_syscall(sys_pciconfig_read)
diff -Nru a/mm/slab.c b/mm/slab.c
--- a/mm/slab.c	2004-06-02 23:27:00 -07:00
+++ b/mm/slab.c	2004-06-02 23:27:00 -07:00
@@ -477,10 +477,12 @@
 EXPORT_SYMBOL(malloc_sizes);
 
 /* Must match cache_sizes above. Out of line to keep cache footprint low. */
-static struct cache_names {
+struct cache_names {
 	char *name;
 	char *name_dma;
-} cache_names[] = {
+};
+
+static struct cache_names __initdata cache_names[] = {
 #define CACHE(x) { .name = "size-" #x, .name_dma = "size-" #x "(DMA)" },
 #include <linux/kmalloc_sizes.h>
 	{ 0, }
diff -Nru a/net/appletalk/ddp.c b/net/appletalk/ddp.c
--- a/net/appletalk/ddp.c	2004-06-02 23:27:00 -07:00
+++ b/net/appletalk/ddp.c	2004-06-02 23:27:00 -07:00
@@ -1795,7 +1795,7 @@
 			break;
 		}
 		case SIOCGSTAMP:
-			rc = sock_get_timestamp(sk, (struct timeval *)arg);
+			rc = sock_get_timestamp(sk, (struct timeval __user *)arg);
 			break;
 		/* Routing */
 		case SIOCADDRT:
@@ -1829,7 +1829,7 @@
 		case SIOCGIFCOUNT:
 		case SIOCGIFINDEX:
 		case SIOCGIFNAME:
-			rc = dev_ioctl(cmd, (void *)arg);
+			rc = dev_ioctl(cmd, (void __user *)arg);
 			break;
 	}
 
diff -Nru a/net/atm/ioctl.c b/net/atm/ioctl.c
--- a/net/atm/ioctl.c	2004-06-02 23:27:00 -07:00
+++ b/net/atm/ioctl.c	2004-06-02 23:27:00 -07:00
@@ -76,8 +76,8 @@
 				goto done;
 			}
 		case SIOCGSTAMP: /* borrowed from IP */
-			error = sock_get_timestamp(vcc->sk, (struct timeval *)
-						   arg);
+			error = sock_get_timestamp(vcc->sk,
+					(struct timeval __user *) arg);
 			goto done;
 		case ATM_SETSC:
 			printk(KERN_WARNING "ATM_SETSC is obsolete\n");
diff -Nru a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
--- a/net/ax25/af_ax25.c	2004-06-02 23:27:00 -07:00
+++ b/net/ax25/af_ax25.c	2004-06-02 23:27:00 -07:00
@@ -1694,7 +1694,7 @@
 
 	case SIOCGSTAMP:
 		if (sk != NULL) {
-			res = sock_get_timestamp(sk, (struct timeval *)arg);
+			res = sock_get_timestamp(sk, (struct timeval __user *)arg);
 			break;
 	 	}
 		res = -EINVAL;
@@ -1826,7 +1826,7 @@
 		break;
 
 	default:
-		res = dev_ioctl(cmd, (void *)arg);
+		res = dev_ioctl(cmd, (void __user *)arg);
 		break;
 	}
 	release_sock(sk);
diff -Nru a/net/bluetooth/Kconfig b/net/bluetooth/Kconfig
--- a/net/bluetooth/Kconfig	2004-06-02 23:27:00 -07:00
+++ b/net/bluetooth/Kconfig	2004-06-02 23:27:00 -07:00
@@ -14,22 +14,20 @@
 
 	  Linux Bluetooth subsystem consist of several layers:
 	     Bluetooth Core (HCI device and connection manager, scheduler)
-	     HCI Device drivers (interface to the hardware)
-	     L2CAP Module (L2CAP protocol)
-	     SCO Module (SCO links)
-	     RFCOMM Module (RFCOMM protocol)  
-	     BNEP Module (BNEP protocol)
-	     CMTP Module (CMTP protocol)
+	     HCI Device drivers (Interface to the hardware)
+	     SCO Module (SCO audio links)
+	     L2CAP Module (Logical Link Control and Adaptation Protocol)
+	     RFCOMM Module (RFCOMM Protocol)  
+	     BNEP Module (Bluetooth Network Encapsulation Protocol)
+	     CMTP Module (CAPI Message Transport Protocol)
 
-	  Say Y here to enable Linux Bluetooth support and to build Bluetooth Core
-	  layer.
+	  Say Y here to compile Bluetooth support into the kernel or say M to
+	  compile it as module (bluetooth).
 
 	  To use Linux Bluetooth subsystem, you will need several user-space
 	  utilities like hciconfig and hcid.  These utilities and updates to
 	  Bluetooth kernel modules are provided in the BlueZ packages.
-	  For more information, see <http://bluez.sourceforge.net/>.
-
-	  If you want to compile Bluetooth Core as module (bluetooth) say M here.
+	  For more information, see <http://www.bluez.org/>.
 
 config BT_L2CAP
 	tristate "L2CAP protocol support"
@@ -46,7 +44,7 @@
 	tristate "SCO links support"
 	depends on BT
 	help
-	  SCO link provides voice transport over Bluetooth. SCO support is
+	  SCO link provides voice transport over Bluetooth.  SCO support is
 	  required for voice applications like Headset and Audio.
 
 	  Say Y here to compile SCO support into the kernel or say M to
diff -Nru a/net/bluetooth/Makefile b/net/bluetooth/Makefile
--- a/net/bluetooth/Makefile	2004-06-02 23:26:58 -07:00
+++ b/net/bluetooth/Makefile	2004-06-02 23:26:58 -07:00
@@ -9,4 +9,4 @@
 obj-$(CONFIG_BT_BNEP)	+= bnep/
 obj-$(CONFIG_BT_CMTP)	+= cmtp/
 
-bluetooth-objs := af_bluetooth.o hci_core.o hci_conn.o hci_event.o hci_sock.o hci_sysfs.o lib.o syms.o
+bluetooth-objs := af_bluetooth.o hci_core.o hci_conn.o hci_event.o hci_sock.o hci_sysfs.o lib.o
diff -Nru a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c
--- a/net/bluetooth/af_bluetooth.c	2004-06-02 23:26:58 -07:00
+++ b/net/bluetooth/af_bluetooth.c	2004-06-02 23:26:58 -07:00
@@ -22,12 +22,7 @@
    SOFTWARE IS DISCLAIMED.
 */
 
-/*
- *  Bluetooth address family and sockets.
- *
- * $Id: af_bluetooth.c,v 1.3 2002/04/17 17:37:15 maxk Exp $
- */
-#define VERSION "2.4"
+/* Bluetooth address family and sockets. */
 
 #include <linux/config.h>
 #include <linux/module.h>
@@ -53,13 +48,16 @@
 
 #ifndef CONFIG_BT_SOCK_DEBUG
 #undef  BT_DBG
-#define BT_DBG( A... )
+#define BT_DBG(D...)
 #endif
 
+#define VERSION "2.5"
+
 struct proc_dir_entry *proc_bt;
+EXPORT_SYMBOL(proc_bt);
 
 /* Bluetooth sockets */
-#define BT_MAX_PROTO	6
+#define BT_MAX_PROTO	7
 static struct net_proto_family *bt_proto[BT_MAX_PROTO];
 
 static kmem_cache_t *bt_sock_cache;
@@ -75,6 +73,7 @@
 	bt_proto[proto] = ops;
 	return 0;
 }
+EXPORT_SYMBOL(bt_sock_register);
 
 int bt_sock_unregister(int proto)
 {
@@ -87,6 +86,7 @@
 	bt_proto[proto] = NULL;
 	return 0;
 }
+EXPORT_SYMBOL(bt_sock_unregister);
 
 static int bt_sock_create(struct socket *sock, int proto)
 {
@@ -116,7 +116,7 @@
 	sk = sk_alloc(PF_BLUETOOTH, prio, sizeof(struct bt_sock), bt_sock_cache);
 	if (!sk)
 		return NULL;
-	
+
 	if (pi_size) {
 		pi = kmalloc(pi_size, prio);
 		if (!pi) {
@@ -129,13 +129,14 @@
 
 	sock_init_data(sock, sk);
 	INIT_LIST_HEAD(&bt_sk(sk)->accept_q);
-	
+
 	sk->sk_zapped   = 0;
 	sk->sk_protocol = proto;
 	sk->sk_state    = BT_OPEN;
 
 	return sk;
 }
+EXPORT_SYMBOL(bt_sock_alloc);
 
 void bt_sock_link(struct bt_sock_list *l, struct sock *sk)
 {
@@ -143,6 +144,7 @@
 	sk_add_node(sk, &l->head);
 	write_unlock_bh(&l->lock);
 }
+EXPORT_SYMBOL(bt_sock_link);
 
 void bt_sock_unlink(struct bt_sock_list *l, struct sock *sk)
 {
@@ -150,6 +152,7 @@
 	sk_del_node_init(sk);
 	write_unlock_bh(&l->lock);
 }
+EXPORT_SYMBOL(bt_sock_unlink);
 
 void bt_accept_enqueue(struct sock *parent, struct sock *sk)
 {
@@ -160,6 +163,7 @@
 	bt_sk(sk)->parent = parent;
 	parent->sk_ack_backlog++;
 }
+EXPORT_SYMBOL(bt_accept_enqueue);
 
 static void bt_accept_unlink(struct sock *sk)
 {
@@ -175,19 +179,19 @@
 {
 	struct list_head *p, *n;
 	struct sock *sk;
-	
+
 	BT_DBG("parent %p", parent);
 
 	list_for_each_safe(p, n, &bt_sk(parent)->accept_q) {
 		sk = (struct sock *) list_entry(p, struct bt_sock, accept_q);
-		
+
 		lock_sock(sk);
 		if (sk->sk_state == BT_CLOSED) {
 			release_sock(sk);
 			bt_accept_unlink(sk);
 			continue;
 		}
-		
+
 		if (sk->sk_state == BT_CONNECTED || !newsock) {
 			bt_accept_unlink(sk);
 			if (newsock)
@@ -199,6 +203,7 @@
 	}
 	return NULL;
 }
+EXPORT_SYMBOL(bt_accept_dequeue);
 
 int bt_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
 	struct msghdr *msg, size_t len, int flags)
@@ -235,6 +240,7 @@
 
 	return err ? : copied;
 }
+EXPORT_SYMBOL(bt_sock_recvmsg);
 
 static inline unsigned int bt_accept_poll(struct sock *parent)
 {
@@ -287,6 +293,7 @@
 
 	return mask;
 }
+EXPORT_SYMBOL(bt_sock_poll);
 
 int bt_sock_wait_state(struct sock *sk, int state, unsigned long timeo)
 {
@@ -322,9 +329,10 @@
 	remove_wait_queue(sk->sk_sleep, &wait);
 	return err;
 }
+EXPORT_SYMBOL(bt_sock_wait_state);
 
 static struct net_proto_family bt_sock_family_ops = {
-	.owner  = THIS_MODULE,
+	.owner	= THIS_MODULE,
 	.family	= PF_BLUETOOTH,
 	.create	= bt_sock_create,
 };
@@ -342,7 +350,7 @@
 	proc_bt = proc_mkdir("bluetooth", NULL);
 	if (proc_bt)
 		proc_bt->owner = THIS_MODULE;
-	
+
 	/* Init socket cache */
 	bt_sock_cache = kmem_cache_create("bt_sock",
 			sizeof(struct bt_sock), 0,
@@ -352,7 +360,7 @@
 		BT_ERR("Socket cache creation failed");
 		return -ENOMEM;
 	}
-	
+
 	sock_register(&bt_sock_family_ops);
 
 	BT_INFO("HCI device and connection manager initialized");
diff -Nru a/net/bluetooth/bnep/Kconfig b/net/bluetooth/bnep/Kconfig
--- a/net/bluetooth/bnep/Kconfig	2004-06-02 23:27:00 -07:00
+++ b/net/bluetooth/bnep/Kconfig	2004-06-02 23:27:00 -07:00
@@ -4,12 +4,8 @@
 	select CRC32
 	help
 	  BNEP (Bluetooth Network Encapsulation Protocol) is Ethernet
-	  emulation layer on top of Bluetooth. BNEP is required for Bluetooth
-	  PAN (Personal Area Network).
-
-	  To use BNEP, you will need user-space utilities provided in the 
-	  BlueZ-PAN package.
-	  For more information, see <http://bluez.sourceforge.net>.
+	  emulation layer on top of Bluetooth.  BNEP is required for
+	  Bluetooth PAN (Personal Area Network).
 
 	  Say Y here to compile BNEP support into the kernel or say M to
 	  compile it as module (bnep).
diff -Nru a/net/bluetooth/cmtp/Kconfig b/net/bluetooth/cmtp/Kconfig
--- a/net/bluetooth/cmtp/Kconfig	2004-06-02 23:26:59 -07:00
+++ b/net/bluetooth/cmtp/Kconfig	2004-06-02 23:26:59 -07:00
@@ -3,7 +3,7 @@
 	depends on BT && BT_L2CAP && ISDN_CAPI
 	help
 	  CMTP (CAPI Message Transport Protocol) is a transport layer
-	  for CAPI messages. CMTP is required for the Bluetooth Common
+	  for CAPI messages.  CMTP is required for the Bluetooth Common
 	  ISDN Access Profile.
 
 	  Say Y here to compile CMTP support into the kernel or say M to
diff -Nru a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
--- a/net/bluetooth/hci_conn.c	2004-06-02 23:27:00 -07:00
+++ b/net/bluetooth/hci_conn.c	2004-06-02 23:27:00 -07:00
@@ -22,11 +22,7 @@
    SOFTWARE IS DISCLAIMED.
 */
 
-/*
- * HCI Connection handling.
- *
- * $Id: hci_conn.c,v 1.2 2002/04/17 17:37:16 maxk Exp $
- */
+/* Bluetooth HCI connection handling. */
 
 #include <linux/config.h>
 #include <linux/module.h>
@@ -54,7 +50,7 @@
 
 #ifndef CONFIG_BT_HCI_CORE_DEBUG
 #undef  BT_DBG
-#define BT_DBG( A... )
+#define BT_DBG(D...)
 #endif
 
 void hci_acl_connect(struct hci_conn *conn)
@@ -178,10 +174,10 @@
 
 int hci_conn_del(struct hci_conn *conn)
 {
-	struct hci_dev  *hdev = conn->hdev;
+	struct hci_dev *hdev = conn->hdev;
 
 	BT_DBG("%s conn %p handle %d", hdev->name, conn, conn->handle);
-	
+
 	hci_conn_del_timer(conn);
 
 	if (conn->type == SCO_LINK) {
@@ -226,14 +222,14 @@
 
 	list_for_each(p, &hci_dev_list) {
 		struct hci_dev *d = list_entry(p, struct hci_dev, list);
-		
+
 		if (!test_bit(HCI_UP, &d->flags))
 			continue;
 
 		/* Simple routing: 
-	 	 * 	No source address - find interface with bdaddr != dst 
-	 	 *	Source address 	  - find interface with bdaddr == src 
-	 	 */
+		 *   No source address - find interface with bdaddr != dst
+		 *   Source address    - find interface with bdaddr == src
+		 */
 
 		if (use_src) {
 			if (!bacmp(&d->bdaddr, src)) {
@@ -252,6 +248,7 @@
 	read_unlock_bh(&hci_dev_list_lock);
 	return hdev;
 }
+EXPORT_SYMBOL(hci_get_route);
 
 /* Create SCO or ACL connection.
  * Device _must_ be locked */
@@ -294,15 +291,16 @@
 		return acl;
 	}
 }
+EXPORT_SYMBOL(hci_connect);
 
 /* Authenticate remote device */
 int hci_conn_auth(struct hci_conn *conn)
 {
 	BT_DBG("conn %p", conn);
-	
+
 	if (conn->link_mode & HCI_LM_AUTH)
 		return 1;
-	
+
 	if (!test_and_set_bit(HCI_CONN_AUTH_PEND, &conn->pend)) {
 		struct hci_cp_auth_requested cp;
 		cp.handle = __cpu_to_le16(conn->handle);
@@ -310,15 +308,16 @@
 	}
 	return 0;
 }
+EXPORT_SYMBOL(hci_conn_auth);
 
 /* Enable encryption */
 int hci_conn_encrypt(struct hci_conn *conn)
 {
 	BT_DBG("conn %p", conn);
-	
+
 	if (conn->link_mode & HCI_LM_ENCRYPT)
 		return 1;
-	
+
 	if (test_and_set_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend))
 		return 0;
 
@@ -330,12 +329,13 @@
 	}
 	return 0;
 }
+EXPORT_SYMBOL(hci_conn_encrypt);
 
 /* Drop all connection on the device */
 void hci_conn_hash_flush(struct hci_dev *hdev)
 {
 	struct hci_conn_hash *h = &hdev->conn_hash;
-        struct list_head *p;
+	struct list_head *p;
 
 	BT_DBG("hdev %s", hdev->name);
 
diff -Nru a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
--- a/net/bluetooth/hci_core.c	2004-06-02 23:26:59 -07:00
+++ b/net/bluetooth/hci_core.c	2004-06-02 23:26:59 -07:00
@@ -22,11 +22,7 @@
    SOFTWARE IS DISCLAIMED.
 */
 
-/*
- * Bluetooth HCI Core.
- *
- * $Id: hci_core.c,v 1.6 2002/04/17 17:37:16 maxk Exp $
- */
+/* Bluetooth HCI core. */
 
 #include <linux/config.h>
 #include <linux/module.h>
@@ -55,7 +51,7 @@
 
 #ifndef CONFIG_BT_HCI_CORE_DEBUG
 #undef  BT_DBG
-#define BT_DBG( A... )
+#define BT_DBG(D...)
 #endif
 
 static void hci_cmd_task(unsigned long arg);
@@ -288,6 +284,7 @@
 	read_unlock(&hci_dev_list_lock);
 	return hdev;
 }
+EXPORT_SYMBOL(hci_dev_get);
 
 /* ---- Inquiry support ---- */
 void inquiry_cache_flush(struct hci_dev *hdev)
@@ -416,7 +413,7 @@
 
 	if (!copy_to_user(ptr, &ir, sizeof(ir))) {
 		ptr += sizeof(ir);
-	        if (copy_to_user(ptr, buf, sizeof(struct inquiry_info) *
+		if (copy_to_user(ptr, buf, sizeof(struct inquiry_info) *
 					ir.num_rsp))
 			err = -EFAULT;
 	} else 
@@ -459,7 +456,7 @@
 
 		//__hci_request(hdev, hci_reset_req, 0, HZ);
 		ret = __hci_request(hdev, hci_init_req, 0, HCI_INIT_TIMEOUT);
-       
+
 		clear_bit(HCI_INIT, &hdev->flags);
 	}
 
@@ -514,7 +511,7 @@
 	inquiry_cache_flush(hdev);
 	hci_conn_hash_flush(hdev);
 	hci_dev_unlock_bh(hdev);
-	
+
 	hci_notify(hdev, HCI_DEV_DOWN);
 
 	if (hdev->flush)
@@ -558,7 +555,7 @@
 {
 	struct hci_dev *hdev;
 	int err;
-	
+
 	if (!(hdev = hci_dev_get(dev)))
 		return -ENODEV;
 	err = hci_dev_do_close(hdev);
@@ -649,19 +646,19 @@
 			if (err)
 				break;
 		}
-			
+
 		err = hci_request(hdev, hci_encrypt_req,
 					dr.dev_opt, HCI_INIT_TIMEOUT);
 		break;
-	
+
 	case HCISETSCAN:
 		err = hci_request(hdev, hci_scan_req, dr.dev_opt, HCI_INIT_TIMEOUT);
 		break;
-	
+
 	case HCISETPTYPE:
 		hdev->pkt_type = (__u16) dr.dev_opt;
 		break;
-		
+
 	case HCISETLINKPOL:
 		hdev->link_policy = (__u16) dr.dev_opt;
 		break;
@@ -683,7 +680,7 @@
 	default:
 		err = -EINVAL;
 		break;
-	}	
+	}
 	hci_dev_put(hdev);
 	return err;
 }
@@ -779,6 +776,7 @@
 
 	return hdev;
 }
+EXPORT_SYMBOL(hci_alloc_dev);
 
 /* Free HCI device */
 void hci_free_dev(struct hci_dev *hdev)
@@ -786,6 +784,7 @@
 	/* will free via class release */
 	class_device_put(&hdev->class_dev);
 }
+EXPORT_SYMBOL(hci_free_dev);
 
 /* Register HCI device */
 int hci_register_dev(struct hci_dev *hdev)
@@ -802,7 +801,7 @@
 
 	/* Find first available device id */
 	list_for_each(p, &hci_dev_list) {
-	       	if (list_entry(p, struct hci_dev, list)->id != id)
+		if (list_entry(p, struct hci_dev, list)->id != id)
 			break;
 		head = p; id++;
 	}
@@ -813,7 +812,7 @@
 
 	atomic_set(&hdev->refcnt, 1);
 	spin_lock_init(&hdev->lock);
-			
+
 	hdev->flags = 0;
 	hdev->pkt_type  = (HCI_DM1 | HCI_DH1 | HCI_HV1);
 	hdev->link_mode = (HCI_LM_ACCEPT);
@@ -836,7 +835,7 @@
 	memset(&hdev->stat, 0, sizeof(struct hci_dev_stats));
 
 	atomic_set(&hdev->promisc, 0);
-		
+
 	write_unlock_bh(&hci_dev_list_lock);
 
 	hci_register_sysfs(hdev);
@@ -845,6 +844,7 @@
 
 	return id;
 }
+EXPORT_SYMBOL(hci_register_dev);
 
 /* Unregister HCI device */
 int hci_unregister_dev(struct hci_dev *hdev)
@@ -864,6 +864,7 @@
 	__hci_dev_put(hdev);
 	return 0;
 }
+EXPORT_SYMBOL(hci_unregister_dev);
 
 /* Suspend HCI device */
 int hci_suspend_dev(struct hci_dev *hdev)
@@ -871,13 +872,15 @@
 	hci_notify(hdev, HCI_DEV_SUSPEND);
 	return 0;
 }
+EXPORT_SYMBOL(hci_suspend_dev);
 
 /* Resume HCI device */
 int hci_resume_dev(struct hci_dev *hdev)
 {
 	hci_notify(hdev, HCI_DEV_RESUME);
 	return 0;
-}       
+}
+EXPORT_SYMBOL(hci_resume_dev);
 
 /* ---- Interface to upper protocols ---- */
 
@@ -903,6 +906,7 @@
 
 	return err;
 }
+EXPORT_SYMBOL(hci_register_proto);
 
 int hci_unregister_proto(struct hci_proto *hp)
 {
@@ -924,6 +928,7 @@
 
 	return err;
 }
+EXPORT_SYMBOL(hci_unregister_proto);
 
 static int hci_send_frame(struct sk_buff *skb)
 {
@@ -938,7 +943,7 @@
 
 	if (atomic_read(&hdev->promisc)) {
 		/* Time stamp */
-	        do_gettimeofday(&skb->stamp);
+		do_gettimeofday(&skb->stamp);
 
 		hci_send_to_sock(hdev, skb);
 	}
@@ -980,6 +985,7 @@
 
 	return 0;
 }
+EXPORT_SYMBOL(hci_send_cmd);
 
 /* Get data from the previously sent command */
 void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 ogf, __u16 ocf)
@@ -1026,7 +1032,7 @@
 	if (!(list = skb_shinfo(skb)->frag_list)) {
 		/* Non fragmented */
 		BT_DBG("%s nonfrag skb %p len %d", hdev->name, skb, skb->len);
-		
+
 		skb_queue_tail(&conn->data_q, skb);
 	} else {
 		/* Fragmented */
@@ -1044,7 +1050,7 @@
 			skb->dev = (void *) hdev;
 			skb->pkt_type = HCI_ACLDATA_PKT;
 			hci_add_acl_hdr(skb, conn->handle, flags | ACL_CONT);
-		
+
 			BT_DBG("%s frag %p len %d", hdev->name, skb, skb->len);
 
 			__skb_queue_tail(&conn->data_q, skb);
@@ -1052,10 +1058,11 @@
 
 		spin_unlock_bh(&conn->data_q.lock);
 	}
-		
+
 	hci_sched_tx(hdev);
 	return 0;
 }
+EXPORT_SYMBOL(hci_send_acl);
 
 /* Send SCO data */
 int hci_send_sco(struct hci_conn *conn, struct sk_buff *skb)
@@ -1082,6 +1089,7 @@
 	hci_sched_tx(hdev);
 	return 0;
 }
+EXPORT_SYMBOL(hci_send_sco);
 
 /* ---- HCI TX task (outgoing data) ---- */
 
@@ -1091,7 +1099,7 @@
 	struct hci_conn_hash *h = &hdev->conn_hash;
 	struct hci_conn  *conn = NULL;
 	int num = 0, min = ~0;
-        struct list_head *p;
+	struct list_head *p;
 
 	/* We don't have to lock device here. Connections are always 
 	 * added and removed with TX task disabled. */
@@ -1124,7 +1132,7 @@
 static inline void hci_acl_tx_to(struct hci_dev *hdev)
 {
 	struct hci_conn_hash *h = &hdev->conn_hash;
-        struct list_head *p;
+	struct list_head *p;
 	struct hci_conn  *c;
 
 	BT_ERR("%s ACL tx timeout", hdev->name);
@@ -1265,7 +1273,7 @@
 	hci_dev_lock(hdev);
 	conn = hci_conn_hash_lookup_handle(hdev, handle);
 	hci_dev_unlock(hdev);
-	
+
 	if (conn) {
 		register struct hci_proto *hp;
 
@@ -1348,7 +1356,7 @@
 		BT_ERR("%s command tx timeout", hdev->name);
 		atomic_set(&hdev->cmd_cnt, 1);
 	}
-	
+
 	/* Send queued commands */
 	if (atomic_read(&hdev->cmd_cnt) && (skb = skb_dequeue(&hdev->cmd_q))) {
 		if (hdev->sent_cmd)
diff -Nru a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
--- a/net/bluetooth/hci_event.c	2004-06-02 23:26:58 -07:00
+++ b/net/bluetooth/hci_event.c	2004-06-02 23:26:58 -07:00
@@ -22,11 +22,7 @@
    SOFTWARE IS DISCLAIMED.
 */
 
-/*
- * HCI Events.
- *
- * $Id: hci_event.c,v 1.3 2002/04/17 17:37:16 maxk Exp $
- */
+/* Bluetooth HCI event handling. */
 
 #include <linux/config.h>
 #include <linux/module.h>
@@ -54,7 +50,7 @@
 
 #ifndef CONFIG_BT_HCI_CORE_DEBUG
 #undef  BT_DBG
-#define BT_DBG( A... )
+#define BT_DBG(D...)
 #endif
 
 /* Handle HCI Event packets */
@@ -98,9 +94,9 @@
 
 		if (rd->status)
 			break;
-		
+
 		hci_dev_lock(hdev);
-	
+
 		conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(rd->handle));
 		if (conn) {
 			if (rd->role)
@@ -355,7 +351,7 @@
 		return;
 
 	hci_dev_lock(hdev);
-	
+
 	conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &cp->bdaddr);
 
 	BT_DBG("%s status 0x%x bdaddr %s conn %p", hdev->name,
@@ -572,7 +568,7 @@
 	BT_DBG("%s", hdev->name);
 
 	hci_dev_lock(hdev);
-	
+
 	conn = hci_conn_hash_lookup_ba(hdev, ev->link_type, &ev->bdaddr);
 	if (!conn) {
 		hci_dev_unlock(hdev);
@@ -585,7 +581,7 @@
 
 		if (test_bit(HCI_AUTH, &hdev->flags))
 			conn->link_mode |= HCI_LM_AUTH;
-		
+
 		if (test_bit(HCI_ENCRYPT, &hdev->flags))
 			conn->link_mode |= HCI_LM_ENCRYPT;
 
@@ -643,7 +639,7 @@
 		return;
 
 	hci_dev_lock(hdev);
-	
+
 	conn = hci_conn_hash_lookup_handle(hdev, handle);
 	if (conn) {
 		conn->state = BT_CLOSED;
@@ -709,7 +705,7 @@
 		return;
 
 	hci_dev_lock(hdev);
-	
+
 	conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr);
 	if (conn) {
 		if (ev->role)
@@ -731,7 +727,7 @@
 	BT_DBG("%s status %d", hdev->name, ev->status);
 
 	hci_dev_lock(hdev);
-	
+
 	conn = hci_conn_hash_lookup_handle(hdev, handle);
 	if (conn) {
 		if (!ev->status)
@@ -739,7 +735,7 @@
 		clear_bit(HCI_CONN_AUTH_PEND, &conn->pend);
 
 		hci_proto_auth_cfm(conn, ev->status);
-		
+
 		if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend)) {
 			if (!ev->status) {
 				struct hci_cp_set_conn_encrypt cp;
@@ -768,11 +764,11 @@
 	BT_DBG("%s status %d", hdev->name, ev->status);
 
 	hci_dev_lock(hdev);
-	
+
 	conn = hci_conn_hash_lookup_handle(hdev, handle);
 	if (conn) {
 		if (!ev->status) {
-		       	if (ev->encrypt)
+			if (ev->encrypt)
 				conn->link_mode |= HCI_LM_ENCRYPT;
 			else
 				conn->link_mode &= ~HCI_LM_ENCRYPT;
@@ -840,7 +836,7 @@
 	case HCI_EV_CMD_STATUS:
 		cs = (struct hci_ev_cmd_status *) skb->data;
 		skb_pull(skb, sizeof(cs));
-				
+
 		opcode = __le16_to_cpu(cs->opcode);
 		ogf = hci_opcode_ogf(opcode);
 		ocf = hci_opcode_ocf(opcode);
@@ -928,15 +924,16 @@
 		return;
 
 	hdr = (void *) skb_put(skb, HCI_EVENT_HDR_SIZE);
-       	hdr->evt  = HCI_EV_STACK_INTERNAL;
+	hdr->evt  = HCI_EV_STACK_INTERNAL;
 	hdr->plen = sizeof(*ev) + dlen;
 
 	ev  = (void *) skb_put(skb, sizeof(*ev) + dlen);
 	ev->type = type;
 	memcpy(ev->data, data, dlen);
-	
+
 	skb->pkt_type = HCI_EVENT_PKT;
 	skb->dev = (void *) hdev;
 	hci_send_to_sock(hdev, skb);
 	kfree_skb(skb);
 }
+EXPORT_SYMBOL(hci_si_event);
diff -Nru a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
--- a/net/bluetooth/hci_sock.c	2004-06-02 23:26:59 -07:00
+++ b/net/bluetooth/hci_sock.c	2004-06-02 23:26:59 -07:00
@@ -22,11 +22,7 @@
    SOFTWARE IS DISCLAIMED.
 */
 
-/*
- * Bluetooth HCI socket layer.
- *
- * $Id: hci_sock.c,v 1.4 2002/04/18 22:26:14 maxk Exp $
- */
+/* Bluetooth HCI sockets. */
 
 #include <linux/config.h>
 #include <linux/module.h>
@@ -56,7 +52,7 @@
 
 #ifndef CONFIG_BT_HCI_SOCK_DEBUG
 #undef  BT_DBG
-#define BT_DBG( A... )
+#define BT_DBG(D...)
 #endif
 
 /* ----- HCI socket interface ----- */
@@ -139,7 +135,6 @@
 
 		if (sock_queue_rcv_skb(sk, nskb))
 			kfree_skb(nskb);
-		
 	}
 	read_unlock(&hci_sk_list.lock);
 }
@@ -318,14 +313,14 @@
 	__u32 mask = hci_pi(sk)->cmsg_mask;
 
 	if (mask & HCI_CMSG_DIR)
-        	put_cmsg(msg, SOL_HCI, HCI_CMSG_DIR, sizeof(int), &bt_cb(skb)->incoming);
+		put_cmsg(msg, SOL_HCI, HCI_CMSG_DIR, sizeof(int), &bt_cb(skb)->incoming);
 
 	if (mask & HCI_CMSG_TSTAMP)
-        	put_cmsg(msg, SOL_HCI, HCI_CMSG_TSTAMP, sizeof(skb->stamp), &skb->stamp);
+		put_cmsg(msg, SOL_HCI, HCI_CMSG_TSTAMP, sizeof(skb->stamp), &skb->stamp);
 }
  
 static int hci_sock_recvmsg(struct kiocb *iocb, struct socket *sock, 
-			    struct msghdr *msg, size_t len, int flags)
+				struct msghdr *msg, size_t len, int flags)
 {
 	int noblock = flags & MSG_DONTWAIT;
 	struct sock *sk = sock->sk;
@@ -355,7 +350,7 @@
 	err = skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copied);
 
 	hci_sock_cmsg(sk, msg, skb);
-	
+
 	skb_free_datagram(sk, skb);
 
 	return err ? : copied;
@@ -406,7 +401,7 @@
 
 		if (((ogf > HCI_SFLT_MAX_OGF) ||
 				!hci_test_bit(ocf & HCI_FLT_OCF_BITS, &hci_sec_filter.ocf_mask[ogf])) &&
-		    			!capable(CAP_NET_RAW)) {
+					!capable(CAP_NET_RAW)) {
 			err = -EPERM;
 			goto drop;
 		}
@@ -487,9 +482,9 @@
 			uf.event_mask[1] &= *((u32 *) hci_sec_filter.event_mask + 1);
 		}
 
-		{	
+		{
 			struct hci_filter *f = &hci_pi(sk)->filter;
-		
+
 			f->type_mask = uf.type_mask;
 			f->opcode    = uf.opcode;
 			*((u32 *) f->event_mask + 0) = uf.event_mask[0];
@@ -501,7 +496,7 @@
 		err = -ENOPROTOOPT;
 		break;
 	}
-	
+
 	release_sock(sk);
 	return err;
 }
@@ -539,7 +534,7 @@
 	case HCI_FILTER:
 		{
 			struct hci_filter *f = &hci_pi(sk)->filter;
-		
+
 			uf.type_mask = f->type_mask;
 			uf.opcode    = f->opcode;
 			uf.event_mask[0] = *((u32 *) f->event_mask + 0);
@@ -560,23 +555,23 @@
 }
 
 struct proto_ops hci_sock_ops = {
-	.family =	PF_BLUETOOTH,
-	.owner =	THIS_MODULE,
-	.release =	hci_sock_release,
-	.bind =		hci_sock_bind,
-	.getname =	hci_sock_getname,
-	.sendmsg =	hci_sock_sendmsg,
-	.recvmsg =	hci_sock_recvmsg,
-	.ioctl =	hci_sock_ioctl,
-	.poll =		datagram_poll,
-	.listen =	sock_no_listen,
-	.shutdown =	sock_no_shutdown,
-	.setsockopt =	hci_sock_setsockopt,
-	.getsockopt =	hci_sock_getsockopt,
-	.connect =	sock_no_connect,
-	.socketpair =	sock_no_socketpair,
-	.accept =	sock_no_accept,
-	.mmap =		sock_no_mmap
+	.family		= PF_BLUETOOTH,
+	.owner		= THIS_MODULE,
+	.release	= hci_sock_release,
+	.bind		= hci_sock_bind,
+	.getname	= hci_sock_getname,
+	.sendmsg	= hci_sock_sendmsg,
+	.recvmsg	= hci_sock_recvmsg,
+	.ioctl		= hci_sock_ioctl,
+	.poll		= datagram_poll,
+	.listen		= sock_no_listen,
+	.shutdown	= sock_no_shutdown,
+	.setsockopt	= hci_sock_setsockopt,
+	.getsockopt	= hci_sock_getsockopt,
+	.connect	= sock_no_connect,
+	.socketpair	= sock_no_socketpair,
+	.accept		= sock_no_accept,
+	.mmap		= sock_no_mmap
 };
 
 static int hci_sock_create(struct socket *sock, int protocol)
@@ -597,7 +592,7 @@
 	sk_set_owner(sk, THIS_MODULE);
 
 	sock->state = SS_UNCONNECTED;
-	sk->sk_state   = BT_OPEN;
+	sk->sk_state = BT_OPEN;
 
 	bt_sock_link(&hci_sk_list, sk);
 	return 0;
@@ -607,14 +602,14 @@
 {
 	struct hci_dev *hdev = (struct hci_dev *) ptr;
 	struct hci_ev_si_device ev;
-	
+
 	BT_DBG("hdev %s event %ld", hdev->name, event);
 
 	/* Send event to sockets */
 	ev.event  = event;
 	ev.dev_id = hdev->id;
 	hci_si_event(NULL, HCI_EV_SI_DEVICE, sizeof(ev), &ev);
-	
+
 	if (event == HCI_DEV_UNREG) {
 		struct sock *sk;
 		struct hlist_node *node;
@@ -640,9 +635,9 @@
 }
 
 struct net_proto_family hci_sock_family_ops = {
-	.family = PF_BLUETOOTH,
+	.family	= PF_BLUETOOTH,
 	.owner	= THIS_MODULE,
-	.create = hci_sock_create,
+	.create	= hci_sock_create,
 };
 
 struct notifier_block hci_sock_nblock = {
diff -Nru a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
--- a/net/bluetooth/hci_sysfs.c	2004-06-02 23:27:00 -07:00
+++ b/net/bluetooth/hci_sysfs.c	2004-06-02 23:27:00 -07:00
@@ -1,3 +1,5 @@
+/* Bluetooth HCI driver model support. */
+
 #include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
@@ -7,7 +9,7 @@
 
 #ifndef CONFIG_BT_HCI_CORE_DEBUG
 #undef  BT_DBG
-#define BT_DBG( A... )
+#define BT_DBG(D...)
 #endif
 
 static ssize_t show_name(struct class_device *cdev, char *buf)
diff -Nru a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
--- a/net/bluetooth/l2cap.c	2004-06-02 23:27:00 -07:00
+++ b/net/bluetooth/l2cap.c	2004-06-02 23:27:00 -07:00
@@ -22,12 +22,7 @@
    SOFTWARE IS DISCLAIMED.
 */
 
-/*
- * Bluetooth L2CAP core and sockets.
- *
- * $Id: l2cap.c,v 1.15 2002/09/09 01:14:52 maxk Exp $
- */
-#define VERSION "2.1"
+/* Bluetooth L2CAP core and sockets. */
 
 #include <linux/config.h>
 #include <linux/module.h>
@@ -59,9 +54,11 @@
 
 #ifndef CONFIG_BT_L2CAP_DEBUG
 #undef  BT_DBG
-#define BT_DBG( A... )
+#define BT_DBG(D...)
 #endif
 
+#define VERSION "2.2"
+
 static struct proto_ops l2cap_sock_ops;
 
 struct bt_sock_list l2cap_sk_list = {
@@ -135,11 +132,11 @@
 
 	hcon->l2cap_data = conn;
 	conn->hcon = hcon;
-	
+
 	conn->mtu = hcon->hdev->acl_mtu;
 	conn->src = &hcon->hdev->bdaddr;
 	conn->dst = &hcon->dst;
-	
+
 	spin_lock_init(&conn->lock);
 	conn->chan_list.lock = RW_LOCK_UNLOCKED;
 
@@ -374,10 +371,10 @@
 
 	if (sock->type != SOCK_SEQPACKET && sock->type != SOCK_DGRAM && sock->type != SOCK_RAW)
 		return -ESOCKTNOSUPPORT;
-	
+
 	if (sock->type == SOCK_RAW && !capable(CAP_NET_RAW))
 		return -EPERM;
-	
+
 	sock->ops = &l2cap_sock_ops;
 
 	sk = l2cap_sock_alloc(sock, protocol, GFP_KERNEL);
@@ -407,6 +404,7 @@
 	}
 
 	write_lock_bh(&l2cap_sk_list.lock);
+
 	if (la->l2_psm && __l2cap_get_sock_by_addr(la->l2_psm, &la->l2_bdaddr)) {
 		err = -EADDRINUSE;
 	} else {
@@ -416,6 +414,7 @@
 		l2cap_pi(sk)->sport = la->l2_psm;
 		sk->sk_state = BT_BOUND;
 	}
+
 	write_unlock_bh(&l2cap_sk_list.lock);
 
 done:
@@ -428,8 +427,8 @@
 	bdaddr_t *src = &bt_sk(sk)->src;
 	bdaddr_t *dst = &bt_sk(sk)->dst;
 	struct l2cap_conn *conn;
-	struct hci_conn   *hcon;
-	struct hci_dev    *hdev;
+	struct hci_conn *hcon;
+	struct hci_dev *hdev;
 	int err = 0;
 
 	BT_DBG("%s -> %s psm 0x%2.2x", batostr(src), batostr(dst), l2cap_pi(sk)->psm);
@@ -550,8 +549,25 @@
 	}
 
 	if (!l2cap_pi(sk)->psm) {
+		bdaddr_t *src = &bt_sk(sk)->src;
+		u16 psm;
+
 		err = -EINVAL;
-		goto done;
+
+		write_lock_bh(&l2cap_sk_list.lock);
+
+		for (psm = 0x1001; psm < 0x1100; psm += 2)
+			if (!__l2cap_get_sock_by_addr(psm, src)) {
+				l2cap_pi(sk)->psm   = htobs(psm);
+				l2cap_pi(sk)->sport = htobs(psm);
+				err = 0;
+				break;
+			}
+
+		write_unlock_bh(&l2cap_sk_list.lock);
+
+		if (err < 0)
+			goto done;
 	}
 
 	sk->sk_max_ack_backlog = backlog;
@@ -834,7 +850,8 @@
 
 	BT_DBG("sock %p, sk %p", sock, sk);
 
-	if (!sk) return 0;
+	if (!sk)
+		return 0;
 
 	lock_sock(sk);
 	if (!sk->sk_shutdown) {
@@ -856,7 +873,8 @@
 
 	BT_DBG("sock %p, sk %p", sock, sk);
 
-	if (!sk) return 0;
+	if (!sk)
+		return 0;
 
 	err = l2cap_sock_shutdown(sock, 2);
 
@@ -988,7 +1006,7 @@
 
 	sk->sk_state  = BT_CLOSED;
 	sk->sk_zapped = 1;
-	
+
 	if (err)
 		sk->sk_err = err;
 
@@ -1111,7 +1129,7 @@
 
 	len = L2CAP_HDR_SIZE + L2CAP_CMD_HDR_SIZE + dlen;
 	count = min_t(unsigned int, conn->mtu, len);
-	
+
 	skb = bt_skb_alloc(count, GFP_ATOMIC);
 	if (!skb)
 		return NULL;
@@ -1132,7 +1150,7 @@
 	}
 
 	len -= skb->len;
-	
+
 	/* Continuation fragments (no L2CAP header) */
 	frag = &skb_shinfo(skb)->frag_list;
 	while (len) {
@@ -1141,12 +1159,12 @@
 		*frag = bt_skb_alloc(count, GFP_ATOMIC);
 		if (!*frag)
 			goto fail;
-		
+
 		memcpy(skb_put(*frag, count), data, count);
 
 		len  -= count;
 		data += count;
-		
+
 		frag = &(*frag)->next;
 	}
 
@@ -1238,7 +1256,7 @@
 
 		case L2CAP_CONF_QOS:
 			break;
-		
+
 		default:
 			if (hint)
 				break;
@@ -1306,8 +1324,7 @@
 	int result = 0;
 
 	/* Configure output options and let the other side know
-	 * which ones we don't like.
-	 */
+	 * which ones we don't like. */
 	if (pi->conf_mtu < pi->omtu) {
 		l2cap_add_conf_opt(ptr, L2CAP_CONF_MTU, 2, pi->omtu);
 		result = L2CAP_CONF_UNACCEPT;
@@ -1533,13 +1550,11 @@
 	case L2CAP_CONF_UNACCEPT:
 		if (++l2cap_pi(sk)->conf_retry < L2CAP_CONF_MAX_RETRIES) {
 			char req[128];
-			/* 
-			   It does not make sense to adjust L2CAP parameters 
-			   that are currently defined in the spec. We simply 
-			   resend config request that we sent earlier. It is
-			   stupid :) but it helps qualification testing
-			   which expects at least some response from us.
-			*/
+			/* It does not make sense to adjust L2CAP parameters
+			 * that are currently defined in the spec. We simply
+			 * resend config request that we sent earlier. It is
+			 * stupid, but it helps qualification testing which
+			 * expects at least some response from us. */
 			l2cap_send_req(conn, L2CAP_CONF_REQ,
 				l2cap_build_conf_req(sk, req), req);
 			goto done;
@@ -1594,7 +1609,7 @@
 	l2cap_send_rsp(conn, cmd->ident, L2CAP_DISCONN_RSP, sizeof(rsp), &rsp);
 
 	sk->sk_shutdown = SHUTDOWN_MASK;
-	
+
 	l2cap_chan_del(sk, ECONNRESET);
 	bh_unlock_sock(sk);
 
@@ -1723,11 +1738,11 @@
 	if (l2cap_pi(sk)->imtu < skb->len)
 		goto drop;
 
-	/* If socket recv buffers overflows we drop data here 
-	 * which is *bad* because L2CAP has to be reliable. 
-	 * But we don't have any other choice. L2CAP doesn't 
-	 * provide flow control mechanism */ 
-	
+	/* If socket recv buffers overflows we drop data here
+	 * which is *bad* because L2CAP has to be reliable.
+	 * But we don't have any other choice. L2CAP doesn't
+	 * provide flow control mechanism */
+
 	if (!sock_queue_rcv_skb(sk, skb))
 		goto done;
 
@@ -1787,7 +1802,7 @@
 		skb_pull(skb, 2);
 		l2cap_conless_channel(conn, psm, skb);
 		break;
-		
+
 	default:
 		l2cap_data_channel(conn, cid, skb);
 		break;
@@ -1839,7 +1854,7 @@
 			l2cap_conn_ready(conn);
 	} else 
 		l2cap_conn_del(hcon, bt_err(status));
-	
+
 	return 0;
 }
 
@@ -1861,7 +1876,7 @@
 	struct l2cap_conn_rsp rsp;
 	struct sock *sk;
 	int result;
-	
+
 	if (!(conn = hcon->l2cap_data))
 		return 0;
 	l = &conn->chan_list;
@@ -1908,7 +1923,7 @@
 	struct l2cap_conn_rsp rsp;
 	struct sock *sk;
 	int result;
-	
+
 	if (!(conn = hcon->l2cap_data))
 		return 0;
 	l = &conn->chan_list;
@@ -2069,10 +2084,10 @@
 }
 
 static struct seq_operations l2cap_seq_ops = {
-	.start  = l2cap_seq_start,
-	.next   = l2cap_seq_next,
-	.stop   = l2cap_seq_stop,
-	.show   = l2cap_seq_show 
+	.start	= l2cap_seq_start,
+	.next	= l2cap_seq_next,
+	.stop	= l2cap_seq_stop,
+	.show	= l2cap_seq_show 
 };
 
 static int l2cap_seq_open(struct inode *inode, struct file *file)
@@ -2081,76 +2096,76 @@
 }
 
 static struct file_operations l2cap_seq_fops = {
-	.owner	 = THIS_MODULE,
-	.open    = l2cap_seq_open,
-	.read    = seq_read,
-	.llseek  = seq_lseek,
-	.release = seq_release,
+	.owner		= THIS_MODULE,
+	.open		= l2cap_seq_open,
+	.read		= seq_read,
+	.llseek		= seq_lseek,
+	.release	= seq_release,
 };
 
-static int  __init l2cap_proc_init(void)
+static int __init l2cap_proc_init(void)
 {
-        struct proc_dir_entry *p = create_proc_entry("l2cap", S_IRUGO, proc_bt);
-        if (!p)
-                return -ENOMEM;
+	struct proc_dir_entry *p = create_proc_entry("l2cap", S_IRUGO, proc_bt);
+	if (!p)
+		return -ENOMEM;
 	p->owner     = THIS_MODULE;
-        p->proc_fops = &l2cap_seq_fops;
-        return 0;
+	p->proc_fops = &l2cap_seq_fops;
+	return 0;
 }
 
 static void __exit l2cap_proc_cleanup(void)
 {
-        remove_proc_entry("l2cap", proc_bt);
+	remove_proc_entry("l2cap", proc_bt);
 }
 
 #else /* CONFIG_PROC_FS */
 
-static int  __init l2cap_proc_init(void)
+static int __init l2cap_proc_init(void)
 {
-        return 0;
+	return 0;
 }
 
 static void __exit l2cap_proc_cleanup(void)
 {
-        return;
+	return;
 }
 #endif /* CONFIG_PROC_FS */
 
 static struct proto_ops l2cap_sock_ops = {
-	.family  =      PF_BLUETOOTH,
-	.owner   =	THIS_MODULE,
-	.release =      l2cap_sock_release,
-	.bind    =      l2cap_sock_bind,
-	.connect =      l2cap_sock_connect,
-	.listen  =      l2cap_sock_listen,
-	.accept  =      l2cap_sock_accept,
-	.getname =      l2cap_sock_getname,
-	.sendmsg =      l2cap_sock_sendmsg,
-	.recvmsg =      bt_sock_recvmsg,
-	.poll    =      bt_sock_poll,
-	.mmap    =      sock_no_mmap,
-	.socketpair =   sock_no_socketpair,
-	.ioctl      =   sock_no_ioctl,
-	.shutdown   =   l2cap_sock_shutdown,
-	.setsockopt =   l2cap_sock_setsockopt,
-	.getsockopt =   l2cap_sock_getsockopt
+	.family		= PF_BLUETOOTH,
+	.owner		= THIS_MODULE,
+	.release	= l2cap_sock_release,
+	.bind		= l2cap_sock_bind,
+	.connect	= l2cap_sock_connect,
+	.listen		= l2cap_sock_listen,
+	.accept		= l2cap_sock_accept,
+	.getname	= l2cap_sock_getname,
+	.sendmsg	= l2cap_sock_sendmsg,
+	.recvmsg	= bt_sock_recvmsg,
+	.poll		= bt_sock_poll,
+	.mmap		= sock_no_mmap,
+	.socketpair	= sock_no_socketpair,
+	.ioctl		= sock_no_ioctl,
+	.shutdown	= l2cap_sock_shutdown,
+	.setsockopt	= l2cap_sock_setsockopt,
+	.getsockopt	= l2cap_sock_getsockopt
 };
 
 static struct net_proto_family l2cap_sock_family_ops = {
-	.family =       PF_BLUETOOTH,
-	.create	=       l2cap_sock_create,
-	.owner	=	THIS_MODULE,
+	.family	= PF_BLUETOOTH,
+	.owner	= THIS_MODULE,
+	.create	= l2cap_sock_create,
 };
 
 static struct hci_proto l2cap_hci_proto = {
-	.name =         "L2CAP",
-	.id   =         HCI_PROTO_L2CAP,
-	.connect_ind =  l2cap_connect_ind,
-	.connect_cfm =  l2cap_connect_cfm,
-	.disconn_ind =  l2cap_disconn_ind,
-	.auth_cfm    =  l2cap_auth_cfm,
-	.encrypt_cfm =  l2cap_encrypt_cfm,
-	.recv_acldata =	l2cap_recv_acldata
+	.name		= "L2CAP",
+	.id		= HCI_PROTO_L2CAP,
+	.connect_ind	= l2cap_connect_ind,
+	.connect_cfm	= l2cap_connect_cfm,
+	.disconn_ind	= l2cap_disconn_ind,
+	.auth_cfm	= l2cap_auth_cfm,
+	.encrypt_cfm	= l2cap_encrypt_cfm,
+	.recv_acldata	= l2cap_recv_acldata
 };
 
 static int __init l2cap_init(void)
@@ -2168,7 +2183,7 @@
 	}
 
 	l2cap_proc_init();
-	
+
 	BT_INFO("L2CAP ver %s", VERSION);
 	BT_INFO("L2CAP socket layer initialized");
 
@@ -2189,9 +2204,9 @@
 
 void l2cap_load(void)
 {
-	/* Dummy function to trigger automatic L2CAP module loading by 
-	   other modules that use L2CAP sockets but don not use any other
-	   symbols from it. */
+	/* Dummy function to trigger automatic L2CAP module loading by
+	 * other modules that use L2CAP sockets but don not use any othe
+	 * symbols from it. */
 	return;
 }
 EXPORT_SYMBOL(l2cap_load);
diff -Nru a/net/bluetooth/lib.c b/net/bluetooth/lib.c
--- a/net/bluetooth/lib.c	2004-06-02 23:26:58 -07:00
+++ b/net/bluetooth/lib.c	2004-06-02 23:26:58 -07:00
@@ -22,11 +22,10 @@
    SOFTWARE IS DISCLAIMED.
 */
 
-/*
- * Bluetooth kernel library.
- *
- * $Id: lib.c,v 1.1 2002/03/08 21:06:59 maxk Exp $
- */
+/* Bluetooth kernel library. */
+
+#include <linux/config.h>
+#include <linux/module.h>
 
 #include <linux/kernel.h>
 #include <linux/stddef.h>
@@ -58,6 +57,7 @@
 	if (line[0])
 		printk(KERN_INFO "%s:%s\n", pref, line);
 }
+EXPORT_SYMBOL(bt_dump);
 
 void baswap(bdaddr_t *dst, bdaddr_t *src)
 {
@@ -68,6 +68,7 @@
 	for (i = 0; i < 6; i++)
 		d[i] = s[5 - i];
 }
+EXPORT_SYMBOL(baswap);
 
 char *batostr(bdaddr_t *ba)
 {
@@ -76,11 +77,12 @@
 
 	i ^= 1;
 	sprintf(str[i], "%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X",
-	        ba->b[0], ba->b[1], ba->b[2],
+		ba->b[0], ba->b[1], ba->b[2],
 		ba->b[3], ba->b[4], ba->b[5]);
 
 	return str[i];
 }
+EXPORT_SYMBOL(batostr);
 
 /* Bluetooth error codes to Unix errno mapping */
 int bt_err(__u16 code)
@@ -173,3 +175,4 @@
 		return ENOSYS;
 	}
 }
+EXPORT_SYMBOL(bt_err);
diff -Nru a/net/bluetooth/rfcomm/Kconfig b/net/bluetooth/rfcomm/Kconfig
--- a/net/bluetooth/rfcomm/Kconfig	2004-06-02 23:26:59 -07:00
+++ b/net/bluetooth/rfcomm/Kconfig	2004-06-02 23:26:59 -07:00
@@ -2,7 +2,7 @@
 	tristate "RFCOMM protocol support"
 	depends on BT && BT_L2CAP
 	help
-	  RFCOMM provides connection oriented stream transport. RFCOMM
+	  RFCOMM provides connection oriented stream transport.  RFCOMM
 	  support is required for Dialup Networking, OBEX and other Bluetooth
 	  applications.
 
diff -Nru a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c
--- a/net/bluetooth/rfcomm/core.c	2004-06-02 23:26:58 -07:00
+++ b/net/bluetooth/rfcomm/core.c	2004-06-02 23:26:58 -07:00
@@ -50,7 +50,7 @@
 #include <net/bluetooth/l2cap.h>
 #include <net/bluetooth/rfcomm.h>
 
-#define VERSION "1.2"
+#define VERSION "1.3"
 
 #ifndef CONFIG_BT_RFCOMM_DEBUG
 #undef  BT_DBG
diff -Nru a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c
--- a/net/bluetooth/rfcomm/sock.c	2004-06-02 23:26:59 -07:00
+++ b/net/bluetooth/rfcomm/sock.c	2004-06-02 23:26:59 -07:00
@@ -398,6 +398,27 @@
 		goto done;
 	}
 
+	if (!rfcomm_pi(sk)->channel) {
+		bdaddr_t *src = &bt_sk(sk)->src;
+		u8 channel;
+
+		err = -EINVAL;
+
+		write_lock_bh(&rfcomm_sk_list.lock);
+
+		for (channel = 1; channel < 31; channel++)
+			if (!__rfcomm_get_sock_by_addr(channel, src)) {
+				rfcomm_pi(sk)->channel = channel;
+				err = 0;
+				break;
+			}
+
+		write_unlock_bh(&rfcomm_sk_list.lock);
+
+		if (err < 0)
+			goto done;
+	}
+
 	sk->sk_max_ack_backlog = backlog;
 	sk->sk_ack_backlog = 0;
 	sk->sk_state = BT_LISTEN;
diff -Nru a/net/bluetooth/sco.c b/net/bluetooth/sco.c
--- a/net/bluetooth/sco.c	2004-06-02 23:26:59 -07:00
+++ b/net/bluetooth/sco.c	2004-06-02 23:26:59 -07:00
@@ -22,12 +22,7 @@
    SOFTWARE IS DISCLAIMED.
 */
 
-/*
- * Bluetooth SCO sockets.
- *
- * $Id: sco.c,v 1.3 2002/04/17 17:37:16 maxk Exp $
- */
-#define VERSION "0.3"
+/* Bluetooth SCO sockets. */
 
 #include <linux/config.h>
 #include <linux/module.h>
@@ -58,9 +53,11 @@
 
 #ifndef CONFIG_BT_SCO_DEBUG
 #undef  BT_DBG
-#define BT_DBG( A... )
+#define BT_DBG(D...)
 #endif
 
+#define VERSION "0.3"
+
 static struct proto_ops sco_sock_ops;
 
 static struct bt_sock_list sco_sk_list = {
@@ -137,7 +134,7 @@
 
 	conn->src = &hdev->bdaddr;
 	conn->dst = &hcon->dst;
-	
+
 	if (hdev->sco_mtu > 0)
 		conn->mtu = hdev->sco_mtu;
 	else
@@ -483,7 +480,7 @@
 	}
 
 	write_lock_bh(&sco_sk_list.lock);
-	
+
 	if (bacmp(src, BDADDR_ANY) && __sco_get_sock_by_addr(src)) {
 		err = -EADDRINUSE;
 	} else {
@@ -491,7 +488,7 @@
 		bacpy(&bt_sk(sk)->src, &sa->sco_bdaddr);
 		sk->sk_state = BT_BOUND;
 	}
-	
+
 	write_unlock_bh(&sco_sk_list.lock);
 
 done:
@@ -694,7 +691,7 @@
 			err = -ENOTCONN;
 			break;
 		}
-		
+
 		opts.mtu = sco_pi(sk)->conn->mtu;
 
 		BT_DBG("mtu %d", opts.mtu);
@@ -737,7 +734,7 @@
 
 	if (!sk)
 		return 0;
-	
+
 	sco_sock_close(sk);
 
 	if (sock_flag(sk, SOCK_LINGER) && sk->sk_lingertime) {
@@ -811,7 +808,7 @@
 		sk = sco_sock_alloc(NULL, BTPROTO_SCO, GFP_ATOMIC);
 		if (!sk) {
 			bh_unlock_sock(parent);
-                	goto done;
+			goto done;
 		}
 
 		sco_sock_init(sk, parent);
@@ -820,14 +817,14 @@
 		bacpy(&bt_sk(sk)->dst, conn->dst);
 
 		hci_conn_hold(conn->hcon);
-        	__sco_chan_add(conn, sk, parent);
+		__sco_chan_add(conn, sk, parent);
 
-        	sk->sk_state = BT_CONNECTED;
+		sk->sk_state = BT_CONNECTED;
 
 		/* Wake up parent */
 		parent->sk_data_ready(parent, 1);
-	
-        	bh_unlock_sock(parent);
+
+		bh_unlock_sock(parent);
 	}
 
 done:
@@ -858,7 +855,7 @@
 			sco_conn_ready(conn);
 	} else 
 		sco_conn_del(hcon, bt_err(status));
-	
+
 	return 0;
 }
 
@@ -931,10 +928,10 @@
 }
 
 static struct seq_operations sco_seq_ops = {
-	.start  = sco_seq_start,
-	.next   = sco_seq_next,
-	.stop   = sco_seq_stop,
-	.show   = sco_seq_show 
+	.start	= sco_seq_start,
+	.next	= sco_seq_next,
+	.stop	= sco_seq_stop,
+	.show	= sco_seq_show 
 };
 
 static int sco_seq_open(struct inode *inode, struct file *file)
@@ -943,74 +940,74 @@
 }
 
 static struct file_operations sco_seq_fops = {
-	.owner	 = THIS_MODULE,
-	.open    = sco_seq_open,
-	.read    = seq_read,
-	.llseek  = seq_lseek,
-	.release = seq_release,
+	.owner		= THIS_MODULE,
+	.open		= sco_seq_open,
+	.read		= seq_read,
+	.llseek		= seq_lseek,
+	.release	= seq_release,
 };
 
-static int  __init sco_proc_init(void)
+static int __init sco_proc_init(void)
 {
-        struct proc_dir_entry *p = create_proc_entry("sco", S_IRUGO, proc_bt);
-        if (!p)
-                return -ENOMEM;
+	struct proc_dir_entry *p = create_proc_entry("sco", S_IRUGO, proc_bt);
+	if (!p)
+		return -ENOMEM;
 	p->owner     = THIS_MODULE;
-        p->proc_fops = &sco_seq_fops;
-        return 0;
+	p->proc_fops = &sco_seq_fops;
+	return 0;
 }
 
 static void __exit sco_proc_cleanup(void)
 {
-        remove_proc_entry("sco", proc_bt);
+	remove_proc_entry("sco", proc_bt);
 }
 
 #else /* CONFIG_PROC_FS */
 
-static int  __init sco_proc_init(void)
+static int __init sco_proc_init(void)
 {
-        return 0;
+	return 0;
 }
 
 static void __exit sco_proc_cleanup(void)
 {
-        return;
+	return;
 }
 #endif /* CONFIG_PROC_FS */
 
 static struct proto_ops sco_sock_ops = {
-	.family  =      PF_BLUETOOTH,
-	.owner   =	THIS_MODULE,
-	.release =      sco_sock_release,
-	.bind    =     	sco_sock_bind,
-	.connect =      sco_sock_connect,
-	.listen  =      sco_sock_listen,
-	.accept  =      sco_sock_accept,
-	.getname =      sco_sock_getname,
-	.sendmsg =      sco_sock_sendmsg,
-	.recvmsg =      bt_sock_recvmsg,
-	.poll    =      bt_sock_poll,
-	.ioctl   =      sock_no_ioctl,
-	.mmap    =      sock_no_mmap,
-	.socketpair =   sock_no_socketpair,
-	.shutdown   =   sock_no_shutdown,
-	.setsockopt =   sco_sock_setsockopt,
-	.getsockopt =   sco_sock_getsockopt
+	.family		= PF_BLUETOOTH,
+	.owner		= THIS_MODULE,
+	.release	= sco_sock_release,
+	.bind		= sco_sock_bind,
+	.connect	= sco_sock_connect,
+	.listen		= sco_sock_listen,
+	.accept		= sco_sock_accept,
+	.getname	= sco_sock_getname,
+	.sendmsg	= sco_sock_sendmsg,
+	.recvmsg	= bt_sock_recvmsg,
+	.poll		= bt_sock_poll,
+	.ioctl		= sock_no_ioctl,
+	.mmap		= sock_no_mmap,
+	.socketpair	= sock_no_socketpair,
+	.shutdown	= sock_no_shutdown,
+	.setsockopt	= sco_sock_setsockopt,
+	.getsockopt	= sco_sock_getsockopt
 };
 
 static struct net_proto_family sco_sock_family_ops = {
-	.family =       PF_BLUETOOTH,
-	.create =       sco_sock_create,
-	.owner	=	THIS_MODULE,
+	.family	= PF_BLUETOOTH,
+	.owner	= THIS_MODULE,
+	.create	= sco_sock_create,
 };
 
 static struct hci_proto sco_hci_proto = {
-	.name =         "SCO",
-	.id   =         HCI_PROTO_SCO,
-	.connect_ind =  sco_connect_ind,
-	.connect_cfm =  sco_connect_cfm,
-	.disconn_ind =  sco_disconn_ind,
-	.recv_scodata =	sco_recv_scodata
+	.name		= "SCO",
+	.id		= HCI_PROTO_SCO,
+	.connect_ind	= sco_connect_ind,
+	.connect_cfm	= sco_connect_cfm,
+	.disconn_ind	= sco_disconn_ind,
+	.recv_scodata	= sco_recv_scodata
 };
 
 static int __init sco_init(void)
@@ -1028,7 +1025,7 @@
 	}
 
 	sco_proc_init();
-	
+
 	BT_INFO("SCO (Voice Link) ver %s", VERSION);
 	BT_INFO("SCO socket layer initialized");
 
diff -Nru a/net/bluetooth/syms.c b/net/bluetooth/syms.c
--- a/net/bluetooth/syms.c	2004-06-02 23:26:59 -07:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,84 +0,0 @@
-/* 
-   BlueZ - Bluetooth protocol stack for Linux
-   Copyright (C) 2000-2001 Qualcomm Incorporated
-
-   Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com>
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License version 2 as
-   published by the Free Software Foundation;
-
-   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-   OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
-   IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
-   CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES 
-   WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 
-   ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 
-   OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-   ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, 
-   COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS 
-   SOFTWARE IS DISCLAIMED.
-*/
-
-/*
- * Bluetooth symbols.
- *
- * $Id: syms.c,v 1.1 2002/03/08 21:06:59 maxk Exp $
- */
-
-#include <linux/config.h>
-#include <linux/module.h>
-
-#include <linux/types.h>
-#include <linux/errno.h>
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/skbuff.h>
-#include <linux/socket.h>
-
-#include <net/bluetooth/bluetooth.h>
-#include <net/bluetooth/hci_core.h>
-
-/* HCI Core */
-EXPORT_SYMBOL(hci_alloc_dev);
-EXPORT_SYMBOL(hci_free_dev);
-EXPORT_SYMBOL(hci_register_dev);
-EXPORT_SYMBOL(hci_unregister_dev);
-EXPORT_SYMBOL(hci_suspend_dev);
-EXPORT_SYMBOL(hci_resume_dev);
-
-EXPORT_SYMBOL(hci_register_proto);
-EXPORT_SYMBOL(hci_unregister_proto);
-
-EXPORT_SYMBOL(hci_get_route);
-EXPORT_SYMBOL(hci_connect);
-EXPORT_SYMBOL(hci_dev_get);
-EXPORT_SYMBOL(hci_conn_auth);
-EXPORT_SYMBOL(hci_conn_encrypt);
-
-EXPORT_SYMBOL(hci_send_acl);
-EXPORT_SYMBOL(hci_send_sco);
-EXPORT_SYMBOL(hci_send_cmd);
-EXPORT_SYMBOL(hci_si_event);
-
-/* Bluetooth lib */
-EXPORT_SYMBOL(bt_dump);
-EXPORT_SYMBOL(baswap);
-EXPORT_SYMBOL(batostr);
-EXPORT_SYMBOL(bt_err);
-
-/* Bluetooth sockets */
-EXPORT_SYMBOL(bt_sock_register);
-EXPORT_SYMBOL(bt_sock_unregister);
-EXPORT_SYMBOL(bt_sock_alloc);
-EXPORT_SYMBOL(bt_sock_link);
-EXPORT_SYMBOL(bt_sock_unlink);
-EXPORT_SYMBOL(bt_sock_recvmsg);
-EXPORT_SYMBOL(bt_sock_poll);
-EXPORT_SYMBOL(bt_accept_enqueue);
-EXPORT_SYMBOL(bt_accept_dequeue);
-EXPORT_SYMBOL(bt_sock_wait_state);
-
-EXPORT_SYMBOL(proc_bt);
diff -Nru a/net/compat.c b/net/compat.c
--- a/net/compat.c	2004-06-02 23:26:59 -07:00
+++ b/net/compat.c	2004-06-02 23:26:59 -07:00
@@ -29,7 +29,7 @@
 #include <net/compat.h>
 
 static inline int iov_from_user_compat_to_kern(struct iovec *kiov,
-					  struct compat_iovec *uiov32,
+					  struct compat_iovec __user *uiov32,
 					  int niov)
 {
 	int tot_len = 0;
@@ -53,7 +53,7 @@
 	return tot_len;
 }
 
-int get_compat_msghdr(struct msghdr *kmsg, struct compat_msghdr *umsg)
+int get_compat_msghdr(struct msghdr *kmsg, struct compat_msghdr __user *umsg)
 {
 	compat_uptr_t tmp1, tmp2, tmp3;
 
@@ -98,7 +98,7 @@
 	}
 
 	tot_len = iov_from_user_compat_to_kern(kern_iov,
-					  (struct compat_iovec *)kern_msg->msg_iov,
+					  (struct compat_iovec __user *)kern_msg->msg_iov,
 					  kern_msg->msg_iovlen);
 	if(tot_len >= 0)
 		kern_msg->msg_iov = kern_iov;
@@ -112,7 +112,7 @@
 #define CMSG_COMPAT_ALIGN(len)	ALIGN((len), sizeof(s32))
 
 #define CMSG_COMPAT_DATA(cmsg)				\
-	((void *)((char *)(cmsg) + CMSG_COMPAT_ALIGN(sizeof(struct compat_cmsghdr))))
+	((void __user *)((char __user *)(cmsg) + CMSG_COMPAT_ALIGN(sizeof(struct compat_cmsghdr))))
 #define CMSG_COMPAT_SPACE(len)				\
 	(CMSG_COMPAT_ALIGN(sizeof(struct compat_cmsghdr)) + CMSG_COMPAT_ALIGN(len))
 #define CMSG_COMPAT_LEN(len)				\
@@ -120,20 +120,17 @@
 
 #define CMSG_COMPAT_FIRSTHDR(msg)			\
 	(((msg)->msg_controllen) >= sizeof(struct compat_cmsghdr) ?	\
-	 (struct compat_cmsghdr *)((msg)->msg_control) :		\
-	 (struct compat_cmsghdr *)NULL)
+	 (struct compat_cmsghdr __user *)((msg)->msg_control) :		\
+	 (struct compat_cmsghdr __user *)NULL)
 
-static inline struct compat_cmsghdr *cmsg_compat_nxthdr(struct msghdr *msg,
-		struct compat_cmsghdr *cmsg, int cmsg_len)
+static inline struct compat_cmsghdr __user *cmsg_compat_nxthdr(struct msghdr *msg,
+		struct compat_cmsghdr __user *cmsg, int cmsg_len)
 {
-	struct compat_cmsghdr *ptr;
-
-	ptr = (struct compat_cmsghdr *)(((unsigned char *)cmsg) +
-			CMSG_COMPAT_ALIGN(cmsg_len));
-	if ((unsigned long)((char *)(ptr + 1) - (char *)msg->msg_control) >
+	char __user *ptr = (char __user *)cmsg + CMSG_COMPAT_ALIGN(cmsg_len);
+	if ((unsigned long)(ptr + 1 - (char __user *)msg->msg_control) >
 			msg->msg_controllen)
 		return NULL;
-	return ptr;
+	return (struct compat_cmsghdr __user *)ptr;
 }
 
 /* There is a lot of hair here because the alignment rules (and
@@ -143,7 +140,7 @@
 int cmsghdr_from_user_compat_to_kern(struct msghdr *kmsg,
 			       unsigned char *stackbuf, int stackbuf_size)
 {
-	struct compat_cmsghdr *ucmsg;
+	struct compat_cmsghdr __user *ucmsg;
 	struct cmsghdr *kcmsg, *kcmsg_base;
 	compat_size_t ucmlen;
 	__kernel_size_t kcmlen, tmp;
@@ -159,7 +156,7 @@
 		if(CMSG_COMPAT_ALIGN(ucmlen) <
 		   CMSG_COMPAT_ALIGN(sizeof(struct compat_cmsghdr)))
 			return -EINVAL;
-		if((unsigned long)(((char *)ucmsg - (char *)kmsg->msg_control)
+		if((unsigned long)(((char __user *)ucmsg - (char __user *)kmsg->msg_control)
 				   + ucmlen) > kmsg->msg_controllen)
 			return -EINVAL;
 
@@ -217,7 +214,7 @@
 int put_cmsg_compat(struct msghdr *kmsg, int level, int type, int len, void *data)
 {
 	struct compat_timeval ctv;
-	struct compat_cmsghdr *cm = (struct compat_cmsghdr *) kmsg->msg_control;
+	struct compat_cmsghdr __user *cm = (struct compat_cmsghdr __user *) kmsg->msg_control;
 	struct compat_cmsghdr cmhdr;
 	int cmlen;
 
@@ -255,17 +252,17 @@
 
 void scm_detach_fds_compat(struct msghdr *kmsg, struct scm_cookie *scm)
 {
-	struct compat_cmsghdr *cm = (struct compat_cmsghdr *) kmsg->msg_control;
+	struct compat_cmsghdr __user *cm = (struct compat_cmsghdr __user *) kmsg->msg_control;
 	int fdmax = (kmsg->msg_controllen - sizeof(struct compat_cmsghdr)) / sizeof(int);
 	int fdnum = scm->fp->count;
 	struct file **fp = scm->fp->fp;
-	int *cmfptr;
+	int __user *cmfptr;
 	int err = 0, i;
 
 	if (fdnum < fdmax)
 		fdmax = fdnum;
 
-	for (i = 0, cmfptr = (int *) CMSG_COMPAT_DATA(cm); i < fdmax; i++, cmfptr++) {
+	for (i = 0, cmfptr = (int __user *) CMSG_COMPAT_DATA(cm); i < fdmax; i++, cmfptr++) {
 		int new_fd;
 		err = get_unused_fd();
 		if (err < 0)
@@ -322,10 +319,10 @@
 };
 
 static int do_netfilter_replace(int fd, int level, int optname,
-				char *optval, int optlen)
+				char __user *optval, int optlen)
 {
-	struct compat_ipt_replace *urepl = (struct compat_ipt_replace *)optval;
-	struct ipt_replace *repl_nat;
+	struct compat_ipt_replace __user *urepl;
+	struct ipt_replace __user *repl_nat;
 	char name[IPT_TABLE_MAXNAMELEN];
 	u32 origsize, tmp32, num_counters;
 	unsigned int repl_nat_size;
@@ -333,6 +330,7 @@
 	int i;
 	compat_uptr_t ucntrs;
 
+	urepl = (struct compat_ipt_replace __user *)optval;
 	if (get_user(origsize, &urepl->size))
 		return -EFAULT;
 
@@ -399,7 +397,7 @@
 
 
 	ret = sys_setsockopt(fd, level, optname,
-			     (char *)repl_nat, repl_nat_size);
+			     (char __user *)repl_nat, repl_nat_size);
 
 out:
 	return ret;
@@ -414,10 +412,10 @@
 };
 
 static int do_set_attach_filter(int fd, int level, int optname,
-				char *optval, int optlen)
+				char __user *optval, int optlen)
 {
-	struct compat_sock_fprog *fprog32 = (struct compat_sock_fprog *)optval;
-	struct sock_fprog *kfprog = compat_alloc_user_space(sizeof(struct sock_fprog)); 
+	struct compat_sock_fprog __user *fprog32 = (struct compat_sock_fprog __user *)optval;
+	struct sock_fprog __user *kfprog = compat_alloc_user_space(sizeof(struct sock_fprog)); 
 	compat_uptr_t ptr;
 	u16 len;
 
@@ -429,13 +427,13 @@
 	    __put_user(compat_ptr(ptr), &kfprog->filter))
 		return -EFAULT;
 
-	return sys_setsockopt(fd, level, optname, (char *)kfprog, 
+	return sys_setsockopt(fd, level, optname, (char __user *)kfprog, 
 			      sizeof(struct sock_fprog));
 }
 
-static int do_set_sock_timeout(int fd, int level, int optname, char *optval, int optlen)
+static int do_set_sock_timeout(int fd, int level, int optname, char __user *optval, int optlen)
 {
-	struct compat_timeval *up = (struct compat_timeval *) optval;
+	struct compat_timeval __user *up = (struct compat_timeval __user *) optval;
 	struct timeval ktime;
 	mm_segment_t old_fs;
 	int err;
@@ -455,7 +453,7 @@
 }
 
 asmlinkage long compat_sys_setsockopt(int fd, int level, int optname,
-				char *optval, int optlen)
+				char __user *optval, int optlen)
 {
 	if (optname == IPT_SO_SET_REPLACE)
 		return do_netfilter_replace(fd, level, optname,
@@ -469,14 +467,15 @@
 	return sys_setsockopt(fd, level, optname, optval, optlen);
 }
 
-static int do_get_sock_timeout(int fd, int level, int optname, char *optval,
-		int *optlen)
+static int do_get_sock_timeout(int fd, int level, int optname,
+		char __user *optval, int __user *optlen)
 {
-	struct compat_timeval *up = (struct compat_timeval *) optval;
+	struct compat_timeval __user *up;
 	struct timeval ktime;
 	mm_segment_t old_fs;
 	int len, err;
 
+	up = (struct compat_timeval __user *) optval;
 	if (get_user(len, optlen))
 		return -EFAULT;
 	if (len < sizeof(*up))
@@ -498,7 +497,7 @@
 }
 
 asmlinkage long compat_sys_getsockopt(int fd, int level, int optname,
-				char *optval, int *optlen)
+				char __user *optval, int __user *optlen)
 {
 	if (optname == SO_RCVTIMEO || optname == SO_SNDTIMEO)
 		return do_get_sock_timeout(fd, level, optname, optval, optlen);
@@ -512,17 +511,17 @@
 				AL(6),AL(2),AL(5),AL(5),AL(3),AL(3)};
 #undef AL
 
-asmlinkage long compat_sys_sendmsg(int fd, struct compat_msghdr *msg, unsigned flags)
+asmlinkage long compat_sys_sendmsg(int fd, struct compat_msghdr __user *msg, unsigned flags)
 {
-	return sys_sendmsg(fd, (struct msghdr *)msg, flags | MSG_CMSG_COMPAT);
+	return sys_sendmsg(fd, (struct msghdr __user *)msg, flags | MSG_CMSG_COMPAT);
 }
 
-asmlinkage long compat_sys_recvmsg(int fd, struct compat_msghdr *msg, unsigned int flags)
+asmlinkage long compat_sys_recvmsg(int fd, struct compat_msghdr __user *msg, unsigned int flags)
 {
-	return sys_recvmsg(fd, (struct msghdr *)msg, flags | MSG_CMSG_COMPAT);
+	return sys_recvmsg(fd, (struct msghdr __user *)msg, flags | MSG_CMSG_COMPAT);
 }
 
-asmlinkage long compat_sys_socketcall(int call, u32 *args)
+asmlinkage long compat_sys_socketcall(int call, u32 __user *args)
 {
 	int ret;
 	u32 a[6];
diff -Nru a/net/core/datagram.c b/net/core/datagram.c
--- a/net/core/datagram.c	2004-06-02 23:26:59 -07:00
+++ b/net/core/datagram.c	2004-06-02 23:26:59 -07:00
@@ -202,7 +202,7 @@
 /*
  *	Copy a datagram to a linear buffer.
  */
-int skb_copy_datagram(const struct sk_buff *skb, int offset, char *to, int size)
+int skb_copy_datagram(const struct sk_buff *skb, int offset, char __user *to, int size)
 {
 	struct iovec iov = {
 		.iov_base = to,
@@ -297,7 +297,7 @@
 }
 
 int skb_copy_and_csum_datagram(const struct sk_buff *skb, int offset,
-			       u8 *to, int len, unsigned int *csump)
+			       u8 __user *to, int len, unsigned int *csump)
 {
 	int start = skb_headlen(skb);
 	int pos = 0;
diff -Nru a/net/core/dev.c b/net/core/dev.c
--- a/net/core/dev.c	2004-06-02 23:26:59 -07:00
+++ b/net/core/dev.c	2004-06-02 23:26:59 -07:00
@@ -1958,7 +1958,7 @@
 {
 	struct ifconf ifc;
 	struct net_device *dev;
-	char *pos;
+	char __user *pos;
 	int len;
 	int total;
 	int i;
diff -Nru a/net/core/iovec.c b/net/core/iovec.c
--- a/net/core/iovec.c	2004-06-02 23:27:00 -07:00
+++ b/net/core/iovec.c	2004-06-02 23:27:00 -07:00
@@ -192,7 +192,7 @@
 	}
 
 	while (len > 0) {
-		u8 *base = iov->iov_base + offset;
+		u8 __user *base = iov->iov_base + offset;
 		int copy = min_t(unsigned int, len, iov->iov_len - offset);
 
 		offset = 0;
diff -Nru a/net/core/netpoll.c b/net/core/netpoll.c
--- a/net/core/netpoll.c	2004-06-02 23:27:00 -07:00
+++ b/net/core/netpoll.c	2004-06-02 23:27:00 -07:00
@@ -623,7 +623,7 @@
 	np->dev = 0;
 }
 
-int netpoll_trap()
+int netpoll_trap(void)
 {
 	return trapped;
 }
diff -Nru a/net/core/scm.c b/net/core/scm.c
--- a/net/core/scm.c	2004-06-02 23:26:59 -07:00
+++ b/net/core/scm.c	2004-06-02 23:26:59 -07:00
@@ -169,7 +169,7 @@
 
 int put_cmsg(struct msghdr * msg, int level, int type, int len, void *data)
 {
-	struct cmsghdr *cm = (struct cmsghdr*)msg->msg_control;
+	struct cmsghdr __user *cm = (struct cmsghdr __user *)msg->msg_control;
 	struct cmsghdr cmhdr;
 	int cmlen = CMSG_LEN(len);
 	int err;
@@ -204,16 +204,18 @@
 
 void scm_detach_fds(struct msghdr *msg, struct scm_cookie *scm)
 {
-	struct cmsghdr *cm = (struct cmsghdr*)msg->msg_control;
+	struct cmsghdr __user *cm = (struct cmsghdr __user*)msg->msg_control;
 
 	int fdmax = 0;
 	int fdnum = scm->fp->count;
 	struct file **fp = scm->fp->fp;
-	int *cmfptr;
+	int __user *cmfptr;
 	int err = 0, i;
 
-	if (MSG_CMSG_COMPAT & msg->msg_flags)
-		return scm_detach_fds_compat(msg, scm);
+	if (MSG_CMSG_COMPAT & msg->msg_flags) {
+		scm_detach_fds_compat(msg, scm);
+		return;
+	}
 
 	if (msg->msg_controllen > sizeof(struct cmsghdr))
 		fdmax = ((msg->msg_controllen - sizeof(struct cmsghdr))
@@ -222,7 +224,7 @@
 	if (fdnum < fdmax)
 		fdmax = fdnum;
 
-	for (i=0, cmfptr=(int*)CMSG_DATA(cm); i<fdmax; i++, cmfptr++)
+	for (i=0, cmfptr=(int __user *)CMSG_DATA(cm); i<fdmax; i++, cmfptr++)
 	{
 		int new_fd;
 		err = security_file_receive(fp[i]);
diff -Nru a/net/core/sock.c b/net/core/sock.c
--- a/net/core/sock.c	2004-06-02 23:27:00 -07:00
+++ b/net/core/sock.c	2004-06-02 23:27:00 -07:00
@@ -1172,7 +1172,7 @@
 /* When > 0 there are consumers of rx skb time stamps */
 atomic_t netstamp_needed = ATOMIC_INIT(0); 
 
-int sock_get_timestamp(struct sock *sk, struct timeval *userstamp)
+int sock_get_timestamp(struct sock *sk, struct timeval __user *userstamp)
 { 
 	if (!sock_flag(sk, SOCK_TIMESTAMP))
 		sock_enable_timestamp(sk);
diff -Nru a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c
--- a/net/decnet/af_decnet.c	2004-06-02 23:26:59 -07:00
+++ b/net/decnet/af_decnet.c	2004-06-02 23:26:59 -07:00
@@ -1248,7 +1248,7 @@
 		break;
 
 	default:
-		err = dev_ioctl(cmd, (void *)arg);
+		err = dev_ioctl(cmd, (void __user *)arg);
 		break;
 	}
 
diff -Nru a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c
--- a/net/decnet/dn_dev.c	2004-06-02 23:26:59 -07:00
+++ b/net/decnet/dn_dev.c	2004-06-02 23:26:59 -07:00
@@ -1294,35 +1294,43 @@
  * it as a compile time option. Probably you should use the
  * rtnetlink interface instead.
  */
-int dnet_gifconf(struct net_device *dev, char *buf, int len)
+int dnet_gifconf(struct net_device *dev, char __user *buf, int len)
 {
 	struct dn_dev *dn_db = (struct dn_dev *)dev->dn_ptr;
 	struct dn_ifaddr *ifa;
-	struct ifreq *ifr = (struct ifreq *)buf;
+	char buffer[DN_IFREQ_SIZE];
+	struct ifreq *ifr = (struct ifreq *)buffer;
+	struct sockaddr_dn *addr = (struct sockaddr_dn *)&ifr->ifr_addr;
 	int done = 0;
 
 	if ((dn_db == NULL) || ((ifa = dn_db->ifa_list) == NULL))
 		return 0;
 
 	for(; ifa; ifa = ifa->ifa_next) {
-		if (!ifr) {
+		if (!buf) {
 			done += sizeof(DN_IFREQ_SIZE);
 			continue;
 		}
 		if (len < DN_IFREQ_SIZE)
 			return done;
-		memset(ifr, 0, DN_IFREQ_SIZE);
+		memset(buffer, 0, DN_IFREQ_SIZE);
 
 		if (ifa->ifa_label)
 			strcpy(ifr->ifr_name, ifa->ifa_label);
 		else
 			strcpy(ifr->ifr_name, dev->name);
 
-		(*(struct sockaddr_dn *) &ifr->ifr_addr).sdn_family = AF_DECnet;
-		(*(struct sockaddr_dn *) &ifr->ifr_addr).sdn_add.a_len = 2;
-		(*(dn_address *)(*(struct sockaddr_dn *) &ifr->ifr_addr).sdn_add.a_addr) = ifa->ifa_local;
+		addr->sdn_family = AF_DECnet;
+		addr->sdn_add.a_len = 2;
+		memcpy(addr->sdn_add.a_addr, &ifa->ifa_local,
+			sizeof(dn_address));
 
-		ifr = (struct ifreq *)((char *)ifr + DN_IFREQ_SIZE);
+		if (copy_to_user(buf, buffer, DN_IFREQ_SIZE)) {
+			done = -EFAULT;
+			break;
+		}
+
+		buf  += DN_IFREQ_SIZE;
 		len  -= DN_IFREQ_SIZE;
 		done += DN_IFREQ_SIZE;
 	}
diff -Nru a/net/econet/af_econet.c b/net/econet/af_econet.c
--- a/net/econet/af_econet.c	2004-06-02 23:26:59 -07:00
+++ b/net/econet/af_econet.c	2004-06-02 23:26:59 -07:00
@@ -665,7 +665,7 @@
 
 	switch(cmd) {
 		case SIOCGSTAMP:
-			return sock_get_timestamp(sk,(struct timeval *)arg);
+			return sock_get_timestamp(sk,(struct timeval __user *)arg);
 
 		case SIOCSIFADDR:
 		case SIOCGIFADDR:
@@ -673,7 +673,7 @@
 			break;
 
 		default:
-			return dev_ioctl(cmd,(void *) arg);
+			return dev_ioctl(cmd,(void __user *) arg);
 	}
 	/*NOTREACHED*/
 	return 0;
diff -Nru a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
--- a/net/ipv4/af_inet.c	2004-06-02 23:26:58 -07:00
+++ b/net/ipv4/af_inet.c	2004-06-02 23:26:58 -07:00
@@ -843,7 +843,7 @@
 
 	switch (cmd) {
 		case SIOCGSTAMP:
-			err = sock_get_timestamp(sk, (struct timeval *)arg);
+			err = sock_get_timestamp(sk, (struct timeval __user *)arg);
 			break;
 		case SIOCADDRT:
 		case SIOCDELRT:
@@ -853,7 +853,7 @@
 		case SIOCDARP:
 		case SIOCGARP:
 		case SIOCSARP:
-			err = arp_ioctl(cmd, (void *)arg);
+			err = arp_ioctl(cmd, (void __user *)arg);
 			break;
 		case SIOCGIFADDR:
 		case SIOCSIFADDR:
@@ -866,13 +866,13 @@
 		case SIOCSIFPFLAGS:
 		case SIOCGIFPFLAGS:
 		case SIOCSIFFLAGS:
-			err = devinet_ioctl(cmd, (void *)arg);
+			err = devinet_ioctl(cmd, (void __user *)arg);
 			break;
 		default:
 			if (!sk->sk_prot->ioctl ||
 			    (err = sk->sk_prot->ioctl(sk, cmd, arg)) ==
 			    					-ENOIOCTLCMD)
-				err = dev_ioctl(cmd, (void *)arg);
+				err = dev_ioctl(cmd, (void __user *)arg);
 			break;
 	}
 	return err;
diff -Nru a/net/ipv4/arp.c b/net/ipv4/arp.c
--- a/net/ipv4/arp.c	2004-06-02 23:27:00 -07:00
+++ b/net/ipv4/arp.c	2004-06-02 23:27:00 -07:00
@@ -1103,7 +1103,7 @@
  *	Handle an ARP layer I/O control request.
  */
 
-int arp_ioctl(unsigned int cmd, void *arg)
+int arp_ioctl(unsigned int cmd, void __user *arg)
 {
 	int err;
 	struct arpreq r;
diff -Nru a/net/ipv4/devinet.c b/net/ipv4/devinet.c
--- a/net/ipv4/devinet.c	2004-06-02 23:26:59 -07:00
+++ b/net/ipv4/devinet.c	2004-06-02 23:26:59 -07:00
@@ -489,7 +489,7 @@
 }
 
 
-int devinet_ioctl(unsigned int cmd, void *arg)
+int devinet_ioctl(unsigned int cmd, void __user *arg)
 {
 	struct ifreq ifr;
 	struct sockaddr_in sin_orig;
@@ -713,7 +713,7 @@
 	goto out;
 }
 
-static int inet_gifconf(struct net_device *dev, char *buf, int len)
+static int inet_gifconf(struct net_device *dev, char __user *buf, int len)
 {
 	struct in_device *in_dev = __in_dev_get(dev);
 	struct in_ifaddr *ifa;
@@ -1136,7 +1136,7 @@
 }
 
 static int devinet_sysctl_forward(ctl_table *ctl, int write,
-				  struct file* filp, void *buffer,
+				  struct file* filp, void __user *buffer,
 				  size_t *lenp)
 {
 	int *valp = ctl->data;
@@ -1154,7 +1154,7 @@
 }
 
 int ipv4_doint_and_flush(ctl_table *ctl, int write,
-			 struct file* filp, void *buffer,
+			 struct file* filp, void __user *buffer,
 			 size_t *lenp)
 {
 	int *valp = ctl->data;
@@ -1167,9 +1167,9 @@
 	return ret;
 }
 
-int ipv4_doint_and_flush_strategy(ctl_table *table, int *name, int nlen,
-				  void *oldval, size_t *oldlenp,
-				  void *newval, size_t newlen, 
+int ipv4_doint_and_flush_strategy(ctl_table *table, int __user *name, int nlen,
+				  void __user *oldval, size_t __user *oldlenp,
+				  void __user *newval, size_t newlen, 
 				  void **context)
 {
 	int *valp = table->data;
@@ -1181,7 +1181,7 @@
 	if (newlen != sizeof(int))
 		return -EINVAL;
 
-	if (get_user(new, (int *)newval))
+	if (get_user(new, (int __user *)newval))
 		return -EFAULT;
 
 	if (new == *valp)
diff -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-06-02 23:26:58 -07:00
+++ b/net/ipv4/netfilter/ip_conntrack_core.c	2004-06-02 23:26:58 -07:00
@@ -920,7 +920,7 @@
 }
 
 struct ip_conntrack_expect *
-ip_conntrack_expect_alloc()
+ip_conntrack_expect_alloc(void)
 {
 	struct ip_conntrack_expect *new;
 	
diff -Nru a/net/ipv4/raw.c b/net/ipv4/raw.c
--- a/net/ipv4/raw.c	2004-06-02 23:26:59 -07:00
+++ b/net/ipv4/raw.c	2004-06-02 23:26:59 -07:00
@@ -631,7 +631,7 @@
 	switch (cmd) {
 		case SIOCOUTQ: {
 			int amount = atomic_read(&sk->sk_wmem_alloc);
-			return put_user(amount, (int *)arg);
+			return put_user(amount, (int __user *)arg);
 		}
 		case SIOCINQ: {
 			struct sk_buff *skb;
@@ -642,7 +642,7 @@
 			if (skb != NULL)
 				amount = skb->len;
 			spin_unlock_irq(&sk->sk_receive_queue.lock);
-			return put_user(amount, (int *)arg);
+			return put_user(amount, (int __user *)arg);
 		}
 
 		default:
diff -Nru a/net/ipv4/route.c b/net/ipv4/route.c
--- a/net/ipv4/route.c	2004-06-02 23:27:00 -07:00
+++ b/net/ipv4/route.c	2004-06-02 23:27:00 -07:00
@@ -2482,7 +2482,7 @@
 static int flush_delay;
 
 static int ipv4_sysctl_rtcache_flush(ctl_table *ctl, int write,
-					struct file *filp, void *buffer,
+					struct file *filp, void __user *buffer,
 					size_t *lenp)
 {
 	if (write) {
@@ -2494,15 +2494,19 @@
 	return -EINVAL;
 }
 
-static int ipv4_sysctl_rtcache_flush_strategy(ctl_table *table, int *name,
-						int nlen, void *oldval,
-						size_t *oldlenp, void *newval,
-						size_t newlen, void **context)
+static int ipv4_sysctl_rtcache_flush_strategy(ctl_table *table,
+						int __user *name,
+						int nlen,
+						void __user *oldval,
+						size_t __user *oldlenp,
+						void __user *newval,
+						size_t newlen,
+						void **context)
 {
 	int delay;
 	if (newlen != sizeof(int))
 		return -EINVAL;
-	if (get_user(delay, (int *)newval))
+	if (get_user(delay, (int __user *)newval))
 		return -EFAULT; 
 	rt_cache_flush(delay); 
 	return 0;
diff -Nru a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c
--- a/net/ipv4/sysctl_net_ipv4.c	2004-06-02 23:27:00 -07:00
+++ b/net/ipv4/sysctl_net_ipv4.c	2004-06-02 23:27:00 -07:00
@@ -62,7 +62,7 @@
 
 static
 int ipv4_sysctl_forward(ctl_table *ctl, int write, struct file * filp,
-			void *buffer, size_t *lenp)
+			void __user *buffer, size_t *lenp)
 {
 	int val = ipv4_devconf.forwarding;
 	int ret;
@@ -75,9 +75,10 @@
 	return ret;
 }
 
-static int ipv4_sysctl_forward_strategy(ctl_table *table, int *name, int nlen,
-			 void *oldval, size_t *oldlenp,
-			 void *newval, size_t newlen, 
+static int ipv4_sysctl_forward_strategy(ctl_table *table,
+			 int __user *name, int nlen,
+			 void __user *oldval, size_t __user *oldlenp,
+			 void __user *newval, size_t newlen, 
 			 void **context)
 {
 	int *valp = table->data;
@@ -89,7 +90,7 @@
 	if (newlen != sizeof(int))
 		return -EINVAL;
 
-	if (get_user(new, (int *)newval))
+	if (get_user(new, (int __user *)newval))
 		return -EFAULT;
 
 	if (new == *valp)
diff -Nru a/net/ipv4/tcp.c b/net/ipv4/tcp.c
--- a/net/ipv4/tcp.c	2004-06-02 23:26:59 -07:00
+++ b/net/ipv4/tcp.c	2004-06-02 23:26:59 -07:00
@@ -530,7 +530,7 @@
 		return -ENOIOCTLCMD;
 	};
 
-	return put_user(answ, (int *)arg);
+	return put_user(answ, (int __user *)arg);
 }
 
 
@@ -966,7 +966,7 @@
 #define TCP_PAGE(sk)	(inet_sk(sk)->sndmsg_page)
 #define TCP_OFF(sk)	(inet_sk(sk)->sndmsg_off)
 
-static inline int tcp_copy_to_page(struct sock *sk, char *from,
+static inline int tcp_copy_to_page(struct sock *sk, char __user *from,
 				   struct sk_buff *skb, struct page *page,
 				   int off, int copy)
 {
@@ -991,7 +991,7 @@
 	return 0;
 }
 
-static inline int skb_add_data(struct sk_buff *skb, char *from, int copy)
+static inline int skb_add_data(struct sk_buff *skb, char __user *from, int copy)
 {
 	int err = 0;
 	unsigned int csum;
@@ -1065,7 +1065,7 @@
 
 	while (--iovlen >= 0) {
 		int seglen = iov->iov_len;
-		unsigned char *from = iov->iov_base;
+		unsigned char __user *from = iov->iov_base;
 
 		iov++;
 
diff -Nru a/net/ipv4/udp.c b/net/ipv4/udp.c
--- a/net/ipv4/udp.c	2004-06-02 23:26:58 -07:00
+++ b/net/ipv4/udp.c	2004-06-02 23:26:58 -07:00
@@ -725,7 +725,7 @@
 		case SIOCOUTQ:
 		{
 			int amount = atomic_read(&sk->sk_wmem_alloc);
-			return put_user(amount, (int *)arg);
+			return put_user(amount, (int __user *)arg);
 		}
 
 		case SIOCINQ:
@@ -745,7 +745,7 @@
 				amount = skb->len - sizeof(struct udphdr);
 			}
 			spin_unlock_irq(&sk->sk_receive_queue.lock);
-			return put_user(amount, (int *)arg);
+			return put_user(amount, (int __user *)arg);
 		}
 
 		default:
diff -Nru a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
--- a/net/ipv6/addrconf.c	2004-06-02 23:27:00 -07:00
+++ b/net/ipv6/addrconf.c	2004-06-02 23:27:00 -07:00
@@ -1510,7 +1510,7 @@
  *	Special case for SIT interfaces where we create a new "virtual"
  *	device.
  */
-int addrconf_set_dstaddr(void *arg)
+int addrconf_set_dstaddr(void __user *arg)
 {
 	struct in6_ifreq ireq;
 	struct net_device *dev;
@@ -1630,7 +1630,7 @@
 }
 
 
-int addrconf_add_ifaddr(void *arg)
+int addrconf_add_ifaddr(void __user *arg)
 {
 	struct in6_ifreq ireq;
 	int err;
@@ -1647,7 +1647,7 @@
 	return err;
 }
 
-int addrconf_del_ifaddr(void *arg)
+int addrconf_del_ifaddr(void __user *arg)
 {
 	struct in6_ifreq ireq;
 	int err;
@@ -3003,7 +3003,7 @@
 
 static
 int addrconf_sysctl_forward(ctl_table *ctl, int write, struct file * filp,
-			   void *buffer, size_t *lenp)
+			   void __user *buffer, size_t *lenp)
 {
 	int *valp = ctl->data;
 	int val = *valp;
@@ -3031,9 +3031,10 @@
 }
 
 static int addrconf_sysctl_forward_strategy(ctl_table *table, 
-					    int *name, int nlen,
-					    void *oldval, size_t *oldlenp,
-					    void *newval, size_t newlen,
+					    int __user *name, int nlen,
+					    void __user *oldval,
+					    size_t __user *oldlenp,
+					    void __user *newval, size_t newlen,
 					    void **context)
 {
 	int *valp = table->data;
@@ -3043,7 +3044,7 @@
 		return 0;
 	if (newlen != sizeof(int))
 		return -EINVAL;
-	if (get_user(new, (int *)newval))
+	if (get_user(new, (int __user *)newval))
 		return -EFAULT;
 	if (new == *valp)
 		return 0;
diff -Nru a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
--- a/net/ipv6/af_inet6.c	2004-06-02 23:26:59 -07:00
+++ b/net/ipv6/af_inet6.c	2004-06-02 23:26:59 -07:00
@@ -474,23 +474,23 @@
 	switch(cmd) 
 	{
 	case SIOCGSTAMP:
-		return sock_get_timestamp(sk, (struct timeval *)arg);
+		return sock_get_timestamp(sk, (struct timeval __user *)arg);
 
 	case SIOCADDRT:
 	case SIOCDELRT:
 	  
-		return(ipv6_route_ioctl(cmd,(void *)arg));
+		return(ipv6_route_ioctl(cmd,(void __user *)arg));
 
 	case SIOCSIFADDR:
-		return addrconf_add_ifaddr((void *) arg);
+		return addrconf_add_ifaddr((void __user *) arg);
 	case SIOCDIFADDR:
-		return addrconf_del_ifaddr((void *) arg);
+		return addrconf_del_ifaddr((void __user *) arg);
 	case SIOCSIFDSTADDR:
-		return addrconf_set_dstaddr((void *) arg);
+		return addrconf_set_dstaddr((void __user *) arg);
 	default:
 		if (!sk->sk_prot->ioctl ||
 		    (err = sk->sk_prot->ioctl(sk, cmd, arg)) == -ENOIOCTLCMD)
-			return(dev_ioctl(cmd,(void *) arg));		
+			return(dev_ioctl(cmd,(void __user *) arg));		
 		return err;
 	}
 	/*NOTREACHED*/
diff -Nru a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c
--- a/net/ipv6/ip6_flowlabel.c	2004-06-02 23:26:58 -07:00
+++ b/net/ipv6/ip6_flowlabel.c	2004-06-02 23:26:58 -07:00
@@ -692,14 +692,14 @@
 #endif
 
 
-void ip6_flowlabel_init()
+void ip6_flowlabel_init(void)
 {
 #ifdef CONFIG_PROC_FS
 	proc_net_fops_create("ip6_flowlabel", S_IRUGO, &ip6fl_seq_fops);
 #endif
 }
 
-void ip6_flowlabel_cleanup()
+void ip6_flowlabel_cleanup(void)
 {
 	del_timer(&ip6_fl_gc_timer);
 #ifdef CONFIG_PROC_FS
diff -Nru a/net/ipv6/raw.c b/net/ipv6/raw.c
--- a/net/ipv6/raw.c	2004-06-02 23:26:59 -07:00
+++ b/net/ipv6/raw.c	2004-06-02 23:26:59 -07:00
@@ -875,7 +875,7 @@
 		case SIOCOUTQ:
 		{
 			int amount = atomic_read(&sk->sk_wmem_alloc);
-			return put_user(amount, (int *)arg);
+			return put_user(amount, (int __user *)arg);
 		}
 		case SIOCINQ:
 		{
@@ -887,7 +887,7 @@
 			if (skb != NULL)
 				amount = skb->tail - skb->h.raw;
 			spin_unlock_irq(&sk->sk_receive_queue.lock);
-			return put_user(amount, (int *)arg);
+			return put_user(amount, (int __user *)arg);
 		}
 
 		default:
diff -Nru a/net/ipv6/route.c b/net/ipv6/route.c
--- a/net/ipv6/route.c	2004-06-02 23:27:00 -07:00
+++ b/net/ipv6/route.c	2004-06-02 23:27:00 -07:00
@@ -1219,7 +1219,7 @@
 	read_unlock_bh(&rt6_lock);
 }
 
-int ipv6_route_ioctl(unsigned int cmd, void *arg)
+int ipv6_route_ioctl(unsigned int cmd, void __user *arg)
 {
 	struct in6_rtmsg rtmsg;
 	int err;
@@ -1886,7 +1886,7 @@
 
 static
 int ipv6_sysctl_rtcache_flush(ctl_table *ctl, int write, struct file * filp,
-			      void *buffer, size_t *lenp)
+			      void __user *buffer, size_t *lenp)
 {
 	if (write) {
 		proc_dointvec(ctl, write, filp, buffer, lenp);
diff -Nru a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c
--- a/net/ipx/af_ipx.c	2004-06-02 23:26:58 -07:00
+++ b/net/ipx/af_ipx.c	2004-06-02 23:26:58 -07:00
@@ -1872,7 +1872,7 @@
 	case SIOCGSTAMP:
 		rc = -EINVAL;
 		if (sk) 
-			rc = sock_get_timestamp(sk, (struct timeval *)arg);
+			rc = sock_get_timestamp(sk, (struct timeval __user *)arg);
 		break;
 	case SIOCGIFDSTADDR:
 	case SIOCSIFDSTADDR:
@@ -1883,7 +1883,7 @@
 		rc = -EINVAL;
 		break;
 	default:
-		rc = dev_ioctl(cmd,(void *) arg);
+		rc = dev_ioctl(cmd,(void __user *) arg);
 		break;
 	}
 
diff -Nru a/net/irda/af_irda.c b/net/irda/af_irda.c
--- a/net/irda/af_irda.c	2004-06-02 23:26:59 -07:00
+++ b/net/irda/af_irda.c	2004-06-02 23:26:59 -07:00
@@ -1797,7 +1797,7 @@
 
 	case SIOCGSTAMP:
 		if (sk != NULL)
-			return sock_get_timestamp(sk, (struct timeval *)arg);
+			return sock_get_timestamp(sk, (struct timeval __user *)arg);
 		return -EINVAL;
 
 	case SIOCGIFADDR:
@@ -1813,7 +1813,7 @@
 		return -EINVAL;
 	default:
 		IRDA_DEBUG(1, "%s(), doing device ioctl!\n", __FUNCTION__);
-		return dev_ioctl(cmd, (void *) arg);
+		return dev_ioctl(cmd, (void __user *) arg);
 	}
 
 	/*NOTREACHED*/
diff -Nru a/net/llc/af_llc.c b/net/llc/af_llc.c
--- a/net/llc/af_llc.c	2004-06-02 23:26:58 -07:00
+++ b/net/llc/af_llc.c	2004-06-02 23:26:58 -07:00
@@ -867,7 +867,7 @@
 static int llc_ui_ioctl(struct socket *sock, unsigned int cmd,
 			unsigned long arg)
 {
-	return dev_ioctl(cmd, (void *)arg);
+	return dev_ioctl(cmd, (void __user *)arg);
 }
 
 /**
diff -Nru a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c
--- a/net/netrom/af_netrom.c	2004-06-02 23:26:59 -07:00
+++ b/net/netrom/af_netrom.c	2004-06-02 23:26:59 -07:00
@@ -1202,7 +1202,7 @@
 	case SIOCGSTAMP:
 		ret = -EINVAL;
 		if (sk != NULL)
-			ret = sock_get_timestamp(sk, (struct timeval *)arg);
+			ret = sock_get_timestamp(sk, (struct timeval __user *)arg);
 		release_sock(sk);
 		return ret;
 
@@ -1228,7 +1228,7 @@
 
 	default:
 		release_sock(sk);
-		return dev_ioctl(cmd, (void *)arg);
+		return dev_ioctl(cmd, (void __user *)arg);
 	}
 	release_sock(sk);
 
diff -Nru a/net/packet/af_packet.c b/net/packet/af_packet.c
--- a/net/packet/af_packet.c	2004-06-02 23:26:59 -07:00
+++ b/net/packet/af_packet.c	2004-06-02 23:26:59 -07:00
@@ -1450,7 +1450,7 @@
 		case SIOCOUTQ:
 		{
 			int amount = atomic_read(&sk->sk_wmem_alloc);
-			return put_user(amount, (int *)arg);
+			return put_user(amount, (int __user *)arg);
 		}
 		case SIOCINQ:
 		{
@@ -1462,10 +1462,10 @@
 			if (skb)
 				amount = skb->len;
 			spin_unlock_bh(&sk->sk_receive_queue.lock);
-			return put_user(amount, (int *)arg);
+			return put_user(amount, (int __user *)arg);
 		}
 		case SIOCGSTAMP:
-			return sock_get_timestamp(sk, (struct timeval *)arg);
+			return sock_get_timestamp(sk, (struct timeval __user *)arg);
 			
 #ifdef CONFIG_INET
 		case SIOCADDRT:
@@ -1486,7 +1486,7 @@
 #endif
 
 		default:
-			return dev_ioctl(cmd, (void *)arg);
+			return dev_ioctl(cmd, (void __user *)arg);
 	}
 	return 0;
 }
diff -Nru a/net/rose/af_rose.c b/net/rose/af_rose.c
--- a/net/rose/af_rose.c	2004-06-02 23:26:59 -07:00
+++ b/net/rose/af_rose.c	2004-06-02 23:26:59 -07:00
@@ -1270,7 +1270,7 @@
 
 	case SIOCGSTAMP:
 		if (sk != NULL) 
-			return sock_get_timestamp(sk, (struct timeval *)arg);
+			return sock_get_timestamp(sk, (struct timeval __user *)arg);
 		return -EINVAL;
 
 	case SIOCGIFADDR:
@@ -1335,7 +1335,7 @@
 		return 0;
 
 	default:
-		return dev_ioctl(cmd, (void *)arg);
+		return dev_ioctl(cmd, (void __user *)arg);
 	}
 
 	return 0;
diff -Nru a/net/sched/sch_delay.c b/net/sched/sch_delay.c
--- a/net/sched/sch_delay.c	2004-06-02 23:26:58 -07:00
+++ b/net/sched/sch_delay.c	2004-06-02 23:26:58 -07:00
@@ -165,6 +165,7 @@
 		return -ENOMEM;
 
 	rta->rta_type = RTM_NEWQDISC;
+	rta->rta_len = RTA_LENGTH(sizeof(struct tc_fifo_qopt));
 	((struct tc_fifo_qopt *)RTA_DATA(rta))->limit = limit;
 	ret = q->ops->change(q, rta);
 	kfree(rta);
diff -Nru a/net/socket.c b/net/socket.c
--- a/net/socket.c	2004-06-02 23:26:59 -07:00
+++ b/net/socket.c	2004-06-02 23:26:59 -07:00
@@ -775,24 +775,24 @@
 	unlock_kernel();
 	sock = SOCKET_I(inode);
 	if (cmd >= SIOCDEVPRIVATE && cmd <= (SIOCDEVPRIVATE + 15)) {
-		err = dev_ioctl(cmd, (void *)arg);
+		err = dev_ioctl(cmd, (void __user *)arg);
 	} else
 #ifdef WIRELESS_EXT
 	if (cmd >= SIOCIWFIRST && cmd <= SIOCIWLAST) {
-		err = dev_ioctl(cmd, (void *)arg);
+		err = dev_ioctl(cmd, (void __user *)arg);
 	} else
 #endif	/* WIRELESS_EXT */
 	switch (cmd) {
 		case FIOSETOWN:
 		case SIOCSPGRP:
 			err = -EFAULT;
-			if (get_user(pid, (int *)arg))
+			if (get_user(pid, (int __user *)arg))
 				break;
 			err = f_setown(sock->file, pid, 1);
 			break;
 		case FIOGETOWN:
 		case SIOCGPGRP:
-			err = put_user(sock->file->f_owner.pid, (int *)arg);
+			err = put_user(sock->file->f_owner.pid, (int __user *)arg);
 			break;
 		case SIOCGIFBR:
 		case SIOCSIFBR:
diff -Nru a/net/sunrpc/cache.c b/net/sunrpc/cache.c
--- a/net/sunrpc/cache.c	2004-06-02 23:26:59 -07:00
+++ b/net/sunrpc/cache.c	2004-06-02 23:26:59 -07:00
@@ -575,7 +575,7 @@
 };
 
 static ssize_t
-cache_read(struct file *filp, char *buf, size_t count, loff_t *ppos)
+cache_read(struct file *filp, char __user *buf, size_t count, loff_t *ppos)
 {
 	struct cache_reader *rp = filp->private_data;
 	struct cache_request *rq;
@@ -656,7 +656,7 @@
 static char write_buf[8192]; /* protected by queue_io_sem */
 
 static ssize_t
-cache_write(struct file *filp, const char *buf, size_t count,
+cache_write(struct file *filp, const char __user *buf, size_t count,
 	    loff_t *ppos)
 {
 	int err;
@@ -743,7 +743,7 @@
 		}
 	spin_unlock(&queue_lock);
 
-	return put_user(len, (int *)arg);
+	return put_user(len, (int __user *)arg);
 }
 
 static int
@@ -1166,7 +1166,7 @@
 	.release	= content_release,
 };
 
-static ssize_t read_flush(struct file *file, char *buf,
+static ssize_t read_flush(struct file *file, char __user *buf,
 			    size_t count, loff_t *ppos)
 {
 	struct cache_detail *cd = PDE(file->f_dentry->d_inode)->data;
@@ -1187,7 +1187,7 @@
 	return len;
 }
 
-static ssize_t write_flush(struct file * file, const char * buf,
+static ssize_t write_flush(struct file * file, const char __user * buf,
 			     size_t count, loff_t *ppos)
 {
 	struct cache_detail *cd = PDE(file->f_dentry->d_inode)->data;
diff -Nru a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
--- a/net/sunrpc/rpc_pipe.c	2004-06-02 23:26:59 -07:00
+++ b/net/sunrpc/rpc_pipe.c	2004-06-02 23:26:59 -07:00
@@ -270,7 +270,7 @@
 			msg = (struct rpc_pipe_msg *)filp->private_data;
 			len += msg->len - msg->copied;
 		}
-		return put_user(len, (int *)arg);
+		return put_user(len, (int __user *)arg);
 	default:
 		return -EINVAL;
 	}
diff -Nru a/net/sunrpc/sysctl.c b/net/sunrpc/sysctl.c
--- a/net/sunrpc/sysctl.c	2004-06-02 23:26:58 -07:00
+++ b/net/sunrpc/sysctl.c	2004-06-02 23:26:58 -07:00
@@ -58,9 +58,10 @@
 
 static int
 proc_dodebug(ctl_table *table, int write, struct file *file,
-				void *buffer, size_t *lenp)
+				void __user *buffer, size_t *lenp)
 {
-	char		tmpbuf[20], *p, c;
+	char		tmpbuf[20], c, *s;
+	char __user *p;
 	unsigned int	value;
 	size_t		left, len;
 
@@ -74,7 +75,7 @@
 	if (write) {
 		if (!access_ok(VERIFY_READ, buffer, left))
 			return -EFAULT;
-		p = (char *) buffer;
+		p = buffer;
 		while (left && __get_user(c, p) >= 0 && isspace(c))
 			left--, p++;
 		if (!left)
@@ -86,12 +87,12 @@
 			return -EFAULT;
 		tmpbuf[left] = '\0';
 
-		for (p = tmpbuf, value = 0; '0' <= *p && *p <= '9'; p++, left--)
-			value = 10 * value + (*p - '0');
-		if (*p && !isspace(*p))
+		for (s = tmpbuf, value = 0; '0' <= *s && *s <= '9'; s++, left--)
+			value = 10 * value + (*s - '0');
+		if (*s && !isspace(*s))
 			return -EINVAL;
-		while (left && isspace(*p))
-			left--, p++;
+		while (left && isspace(*s))
+			left--, s++;
 		*(unsigned int *) table->data = value;
 		/* Display the RPC tasks on writing to rpc_debug */
 		if (table->ctl_name == CTL_RPCDEBUG) {
@@ -106,7 +107,7 @@
 		if (__copy_to_user(buffer, tmpbuf, len))
 			return -EFAULT;
 		if ((left -= len) > 0) {
-			if (put_user('\n', (char *)buffer + len))
+			if (put_user('\n', (char __user *)buffer + len))
 				return -EFAULT;
 			left--;
 		}
diff -Nru a/net/unix/af_unix.c b/net/unix/af_unix.c
--- a/net/unix/af_unix.c	2004-06-02 23:26:59 -07:00
+++ b/net/unix/af_unix.c	2004-06-02 23:26:59 -07:00
@@ -1829,7 +1829,7 @@
 	{
 		case SIOCOUTQ:
 			amount = atomic_read(&sk->sk_wmem_alloc);
-			err = put_user(amount, (int *)arg);
+			err = put_user(amount, (int __user *)arg);
 			break;
 		case SIOCINQ:
 		{
@@ -1844,12 +1844,12 @@
 			if (skb)
 				amount=skb->len;
 			spin_unlock(&sk->sk_receive_queue.lock);
-			err = put_user(amount, (int *)arg);
+			err = put_user(amount, (int __user *)arg);
 			break;
 		}
 
 		default:
-			err = dev_ioctl(cmd, (void *)arg);
+			err = dev_ioctl(cmd, (void __user *)arg);
 			break;
 	}
 	return err;
diff -Nru a/net/wanrouter/af_wanpipe.c b/net/wanrouter/af_wanpipe.c
--- a/net/wanrouter/af_wanpipe.c	2004-06-02 23:27:00 -07:00
+++ b/net/wanrouter/af_wanpipe.c	2004-06-02 23:27:00 -07:00
@@ -1765,7 +1765,7 @@
 	switch(cmd) 
 	{
 		case SIOCGSTAMP:
-			return sock_get_timestamp(sk, (struct timeval *)arg);
+			return sock_get_timestamp(sk, (struct timeval __user *)arg);
 
 		case SIOC_WANPIPE_CHECK_TX:
 
@@ -1832,7 +1832,7 @@
 #endif
 
 		default:
-			return dev_ioctl(cmd,(void *) arg);
+			return dev_ioctl(cmd,(void __user *) arg);
 	}
 	/*NOTREACHED*/
 }
diff -Nru a/net/x25/af_x25.c b/net/x25/af_x25.c
--- a/net/x25/af_x25.c	2004-06-02 23:27:00 -07:00
+++ b/net/x25/af_x25.c	2004-06-02 23:27:00 -07:00
@@ -1209,7 +1209,7 @@
 			rc = -EINVAL;
 			if (sk)
 				rc = sock_get_timestamp(sk, 
-						(struct timeval *)arg); 
+						(struct timeval __user *)arg); 
 			break;
 		case SIOCGIFADDR:
 		case SIOCSIFADDR:
@@ -1306,7 +1306,7 @@
 		}
 
  		default:
-			rc = dev_ioctl(cmd, (void *)arg);
+			rc = dev_ioctl(cmd, (void __user *)arg);
 			break;
 	}
 
diff -Nru a/scripts/checkstack.pl b/scripts/checkstack.pl
--- a/scripts/checkstack.pl	2004-06-02 23:26:59 -07:00
+++ b/scripts/checkstack.pl	2004-06-02 23:26:59 -07:00
@@ -36,7 +36,7 @@
 		$re = qr/.*sub.*sp, sp, #(([0-9]{2}|[3-9])[0-9]{2})/o;
 	} elsif ($arch =~ /^i[3456]86$/) {
 		#c0105234:       81 ec ac 05 00 00       sub    $0x5ac,%esp
-		$re = qr/^.*sub    \$(0x$x{3,5}),\%esp$/o;
+		$re = qr/^.*[as][du][db]    \$(0x$x{1,8}),\%esp$/o;
 	} elsif ($arch =~ /^ia64$/) {
 		#e0000000044011fc:       01 0f fc 8c     adds r12=-384,r12
 		$re = qr/.*adds.*r12=-(([0-9]{2}|[3-9])[0-9]{2}),r12/o;
@@ -48,10 +48,10 @@
 		$re = qr/.*addiu.*sp,sp,-(([0-9]{2}|[3-9])[0-9]{2})/o;
 	} elsif ($arch =~ /^ppc$/) {
 		#c00029f4:       94 21 ff 30     stwu    r1,-208(r1)
-		$re = qr/.*stwu.*r1,-($x{3,5})\(r1\)/o;
+		$re = qr/.*stwu.*r1,-($x{1,8})\(r1\)/o;
 	} elsif ($arch =~ /^ppc64$/) {
 		#XXX
-		$re = qr/.*stdu.*r1,-($x{3,5})\(r1\)/o;
+		$re = qr/.*stdu.*r1,-($x{1,8})\(r1\)/o;
 	} elsif ($arch =~ /^s390x?$/) {
 		#   11160:       a7 fb ff 60             aghi   %r15,-160
 		$re = qr/.*ag?hi.*\%r15,-(([0-9]{2}|[3-9])[0-9]{2})/o;
@@ -79,6 +79,12 @@
 		my $size = $1;
 		$size = hex($size) if ($size =~ /^0x/);
 
+		if ($size > 0x80000000) {
+			$size = - $size;
+			$size += 0x80000000;
+			$size += 0x80000000;
+		}
+
 		$line =~ m/^($xs*).*/;
 		my $addr = $1;
 		$addr =~ s/ /0/g;
@@ -90,6 +96,7 @@
 			$intro .= '	';
 			$padlen -= 8;
 		}
+		next if ($size < 100);
 		$stack[@stack] = "$intro$size\n";
 	}
 }
diff -Nru a/security/selinux/Kconfig b/security/selinux/Kconfig
--- a/security/selinux/Kconfig	2004-06-02 23:26:58 -07:00
+++ b/security/selinux/Kconfig	2004-06-02 23:26:58 -07:00
@@ -1,6 +1,6 @@
 config SECURITY_SELINUX
 	bool "NSA SELinux Support"
-	depends on SECURITY
+	depends on SECURITY && NET
 	default n
 	help
 	  This selects NSA Security-Enhanced Linux (SELinux).